Add yet-another-react-lightbox package and update .gitignore to exclude node_modules

This commit is contained in:
IGNY8 VPS (Salman)
2025-11-12 18:50:30 +00:00
parent bd2a5570a9
commit c92f4a5edd
9304 changed files with 29 additions and 2008667 deletions

View File

@@ -1,8 +0,0 @@
import { filter } from '../utils/utils.js'
// IE11: children does not work for svg nodes
export default function children(node) {
return filter(node.childNodes, function (child) {
return child.nodeType === 1
})
}

View File

@@ -1,115 +0,0 @@
;(function () {
try {
if (SVGElement.prototype.innerHTML) return
} catch (e) {
return
}
const serializeXML = function (node, output) {
const nodeType = node.nodeType
if (nodeType === 3) {
output.push(
node.textContent
.replace(/&/, '&')
.replace(/</, '&lt;')
.replace('>', '&gt;')
)
} else if (nodeType === 1) {
output.push('<', node.tagName)
if (node.hasAttributes()) {
;[].forEach.call(node.attributes, function (attrNode) {
output.push(' ', attrNode.name, '="', attrNode.value, '"')
})
}
output.push('>')
if (node.hasChildNodes()) {
;[].forEach.call(node.childNodes, function (childNode) {
serializeXML(childNode, output)
})
} else {
// output.push('/>')
}
output.push('</', node.tagName, '>')
} else if (nodeType === 8) {
output.push('<!--', node.nodeValue, '-->')
}
}
Object.defineProperty(SVGElement.prototype, 'innerHTML', {
get: function () {
const output = []
let childNode = this.firstChild
while (childNode) {
serializeXML(childNode, output)
childNode = childNode.nextSibling
}
return output.join('')
},
set: function (markupText) {
while (this.firstChild) {
this.removeChild(this.firstChild)
}
try {
const dXML = new DOMParser()
dXML.async = false
const sXML =
"<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>" +
markupText +
'</svg>'
const svgDocElement = dXML.parseFromString(
sXML,
'text/xml'
).documentElement
let childNode = svgDocElement.firstChild
while (childNode) {
this.appendChild(this.ownerDocument.importNode(childNode, true))
childNode = childNode.nextSibling
}
} catch (e) {
throw new Error('Can not set innerHTML on node')
}
}
})
Object.defineProperty(SVGElement.prototype, 'outerHTML', {
get: function () {
const output = []
serializeXML(this, output)
return output.join('')
},
set: function (markupText) {
while (this.firstChild) {
this.removeChild(this.firstChild)
}
try {
const dXML = new DOMParser()
dXML.async = false
const sXML =
"<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>" +
markupText +
'</svg>'
const svgDocElement = dXML.parseFromString(
sXML,
'text/xml'
).documentElement
let childNode = svgDocElement.firstChild
while (childNode) {
this.parentNode.insertBefore(
this.ownerDocument.importNode(childNode, true),
this
)
// this.appendChild(this.ownerDocument.importNode(childNode, true));
childNode = childNode.nextSibling
}
} catch (e) {
throw new Error('Can not set outerHTML on node')
}
}
})
})()