Initial commit

This commit is contained in:
pasketti
2026-04-05 16:14:49 -04:00
commit ebee3a5534
14059 changed files with 2588797 additions and 0 deletions

14
node_modules/min-document/.testem.json generated vendored Normal file
View File

@@ -0,0 +1,14 @@
{
"launchers": {
"node": {
"command": "node ./test"
}
},
"src_files": [
"./**/*.js"
],
"before_tests": "npm run build-test",
"on_exit": "rm test/static/bundle.js",
"test_page": "test/static/index.html",
"launch_in_dev": ["node", "phantomjs"]
}

19
node_modules/min-document/LICENCE generated vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2013 Colingo.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

156
node_modules/min-document/docs.mli generated vendored Normal file
View File

@@ -0,0 +1,156 @@
type Comment := {
data: String,
length: Number,
nodeName: "#comment",
nodeType: 8,
nodeValue: String,
ownerDoucment: null | Document,
toString: (this: Comment) => String
}
type DOMText := {
data: String,
type: "DOMTextNode",
length: Number,
nodeType: 3,
toString: (this: DOMText) => String,
replaceChild: (
this: DOMText,
index: Number,
length: Number,
value: String
) => void
}
type DOMNode := DOMText | DOMElement | DocumentFragment
type DOMChild := DOMText | DOMElement
type DOMElement := {
tagName: String,
className: String,
dataset: Object<String, Any>,
childNodes: Array<DOMChild>,
parentNode: null | DOMElement,
style: Object<String, String>,
type: "DOMElement",
nodeType: 1,
ownerDoucment: null | Document,
namespaceURI: null | String,
appendChild: (this: DOMElement, child: DOMChild) => DOMChild,
replaceChild:(
this: DOMElement,
elem: DOMChild,
needle: DOMChild
) => DOMChild,
removeChild: (this: DOMElement, child: DOMChild) => DOMChild,
insertBefore: (
this: DOMElement,
elem: DOMChild,
needle: DOMChild | null | undefined
) => DOMChild,
addEventListener: addEventListener,
dispatchEvent: dispatchEvent,
focus: () => void,
toString: (this: DOMElement) => String,
getElementsByClassName: (
this: DOMElement,
className: String
) => Array<DOMElement>,
getElementsByTagName: (
this: DOMElement,
tagName: String
) => Array<DOMElement>,
}
type DocumentFragment := {
childNodes: Array<DOMChild>,
parentNode: null | DOMElement,
type: "DocumentFragment",
nodeType: 11,
nodeName: "#document-fragment",
ownerDoucment: Document | null,
appendChild: (this: DocumentFragment, child: DOMChild),
replaceChild:
(this: DocumentFragment, elem: DOMChild, needle: DOMChild),
removeChild: (this: DocumentFragment, child: DOMChild),
toString: (this: DocumentFragment) => String
}
type Document := {
body: DOMElement,
childNodes: Array<DOMChild>,
documentElement: DOMElement,
nodeType: 9,
createComment: (this: Document, data: String) => Commment,
createTextNode: (this: Document, value: String) => DOMText,
createElement: (this: Document, tagName: String) => DOMElement,
createElementNS: (
this: Document,
namespace: String | null,
tagName: String
) => DOMElement,
createDocumentFragment: (this: Document) => DocumentFragment,
createEvent: () => Event,
getElementById: (
this: Document,
id: String,
) => null | DOMElement,
getElementsByClassName: (
this: Document,
className: String
) => Array<DOMElement>,
getElementsByTagName: (
this: Document,
tagName: String
) => Array<DOMElement>
}
type Event := {
type: String,
bubbles: Boolean,
cancelable: Boolean,
initEvent: (
this: Event,
type: String,
bubbles: Boolean,
cancelable: Boolean
) => void
}
type addEventListener := (
this: DOMElement,
type: String,
listener: Listener
) => void
type dispatchEvent := (
this: DOMElement,
ev: Event
)
min-document/event/add-event-listener := addEventListener
min-document/event/dispatch-event := dispatchEvent
min-document/document := () => Document
min-document/dom-element :=
(tagName: String, owner?: Document, namespace?: String | null) => DOMElement
min-document/dom-fragment :=
(owner?: Document) => DocumentFragment
min-document/dom-text :=
(value: String, owner?: Document) => DOMText
min-document/event := () => Event
min-document/serialize := (DOMElement) => String
min-document := Document

72
node_modules/min-document/document.js generated vendored Normal file
View File

@@ -0,0 +1,72 @@
var domWalk = require("dom-walk")
var Comment = require("./dom-comment.js")
var DOMText = require("./dom-text.js")
var DOMElement = require("./dom-element.js")
var DocumentFragment = require("./dom-fragment.js")
var Event = require("./event.js")
var dispatchEvent = require("./event/dispatch-event.js")
var addEventListener = require("./event/add-event-listener.js")
var removeEventListener = require("./event/remove-event-listener.js")
module.exports = Document;
function Document() {
if (!(this instanceof Document)) {
return new Document();
}
this.head = this.createElement("head")
this.body = this.createElement("body")
this.documentElement = this.createElement("html")
this.documentElement.appendChild(this.head)
this.documentElement.appendChild(this.body)
this.childNodes = [this.documentElement]
this.nodeType = 9
}
var proto = Document.prototype;
proto.createTextNode = function createTextNode(value) {
return new DOMText(value, this)
}
proto.createElementNS = function createElementNS(namespace, tagName) {
var ns = namespace === null ? null : String(namespace)
return new DOMElement(tagName, this, ns)
}
proto.createElement = function createElement(tagName) {
return new DOMElement(tagName, this)
}
proto.createDocumentFragment = function createDocumentFragment() {
return new DocumentFragment(this)
}
proto.createEvent = function createEvent(family) {
return new Event(family)
}
proto.createComment = function createComment(data) {
return new Comment(data, this)
}
proto.getElementById = function getElementById(id) {
id = String(id)
var result = domWalk(this.childNodes, function (node) {
if (String(node.id) === id) {
return node
}
})
return result || null
}
proto.getElementsByClassName = DOMElement.prototype.getElementsByClassName
proto.getElementsByTagName = DOMElement.prototype.getElementsByTagName
proto.contains = DOMElement.prototype.contains
proto.removeEventListener = removeEventListener
proto.addEventListener = addEventListener
proto.dispatchEvent = dispatchEvent

19
node_modules/min-document/dom-comment.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
module.exports = Comment
function Comment(data, owner) {
if (!(this instanceof Comment)) {
return new Comment(data, owner)
}
this.data = data
this.nodeValue = data
this.length = data.length
this.ownerDocument = owner || null
}
Comment.prototype.nodeType = 8
Comment.prototype.nodeName = "#comment"
Comment.prototype.toString = function _Comment_toString() {
return "[object Comment]"
}

209
node_modules/min-document/dom-element.js generated vendored Normal file
View File

@@ -0,0 +1,209 @@
var domWalk = require("dom-walk")
var dispatchEvent = require("./event/dispatch-event.js")
var addEventListener = require("./event/add-event-listener.js")
var removeEventListener = require("./event/remove-event-listener.js")
var serializeNode = require("./serialize.js")
var htmlns = "http://www.w3.org/1999/xhtml"
module.exports = DOMElement
function DOMElement(tagName, owner, namespace) {
if (!(this instanceof DOMElement)) {
return new DOMElement(tagName)
}
var ns = namespace === undefined ? htmlns : (namespace || null)
this.tagName = ns === htmlns ? String(tagName).toUpperCase() : tagName
this.nodeName = this.tagName
this.className = ""
this.dataset = {}
this.childNodes = []
this.parentNode = null
this.style = {}
this.ownerDocument = owner || null
this.namespaceURI = ns
this._attributes = {}
if (this.tagName === 'INPUT') {
this.type = 'text'
}
}
DOMElement.prototype.type = "DOMElement"
DOMElement.prototype.nodeType = 1
DOMElement.prototype.appendChild = function _Element_appendChild(child) {
if (child.parentNode) {
child.parentNode.removeChild(child)
}
this.childNodes.push(child)
child.parentNode = this
return child
}
DOMElement.prototype.replaceChild =
function _Element_replaceChild(elem, needle) {
// TODO: Throw NotFoundError if needle.parentNode !== this
if (elem.parentNode) {
elem.parentNode.removeChild(elem)
}
var index = this.childNodes.indexOf(needle)
needle.parentNode = null
this.childNodes[index] = elem
elem.parentNode = this
return needle
}
DOMElement.prototype.removeChild = function _Element_removeChild(elem) {
// TODO: Throw NotFoundError if elem.parentNode !== this
var index = this.childNodes.indexOf(elem)
this.childNodes.splice(index, 1)
elem.parentNode = null
return elem
}
DOMElement.prototype.insertBefore =
function _Element_insertBefore(elem, needle) {
// TODO: Throw NotFoundError if referenceElement is a dom node
// and parentNode !== this
if (elem.parentNode) {
elem.parentNode.removeChild(elem)
}
var index = needle === null || needle === undefined ?
-1 :
this.childNodes.indexOf(needle)
if (index > -1) {
this.childNodes.splice(index, 0, elem)
} else {
this.childNodes.push(elem)
}
elem.parentNode = this
return elem
}
DOMElement.prototype.setAttributeNS =
function _Element_setAttributeNS(namespace, name, value) {
var prefix = null
var localName = name
var colonPosition = name.indexOf(":")
if (colonPosition > -1) {
prefix = name.substr(0, colonPosition)
localName = name.substr(colonPosition + 1)
}
if (this.tagName === 'INPUT' && name === 'type') {
this.type = value;
}
else {
var attributes = this._attributes[namespace] || (this._attributes[namespace] = {})
attributes[localName] = {value: value, prefix: prefix}
}
}
DOMElement.prototype.getAttributeNS =
function _Element_getAttributeNS(namespace, name) {
var attributes = this._attributes[namespace];
var value = attributes && attributes[name] && attributes[name].value
if (this.tagName === 'INPUT' && name === 'type') {
return this.type;
}
if (typeof value !== "string") {
return null
}
return value
}
DOMElement.prototype.removeAttributeNS =
function _Element_removeAttributeNS(namespace, name) {
var attributes = this._attributes[namespace];
if (attributes) {
delete attributes[name]
}
}
DOMElement.prototype.hasAttributeNS =
function _Element_hasAttributeNS(namespace, name) {
var attributes = this._attributes[namespace]
return !!attributes && name in attributes;
}
DOMElement.prototype.setAttribute = function _Element_setAttribute(name, value) {
return this.setAttributeNS(null, name, value)
}
DOMElement.prototype.getAttribute = function _Element_getAttribute(name) {
return this.getAttributeNS(null, name)
}
DOMElement.prototype.removeAttribute = function _Element_removeAttribute(name) {
return this.removeAttributeNS(null, name)
}
DOMElement.prototype.hasAttribute = function _Element_hasAttribute(name) {
return this.hasAttributeNS(null, name)
}
DOMElement.prototype.removeEventListener = removeEventListener
DOMElement.prototype.addEventListener = addEventListener
DOMElement.prototype.dispatchEvent = dispatchEvent
// Un-implemented
DOMElement.prototype.focus = function _Element_focus() {
return void 0
}
DOMElement.prototype.toString = function _Element_toString() {
return serializeNode(this)
}
DOMElement.prototype.getElementsByClassName = function _Element_getElementsByClassName(classNames) {
var classes = classNames.split(" ");
var elems = []
domWalk(this, function (node) {
if (node.nodeType === 1) {
var nodeClassName = node.className || ""
var nodeClasses = nodeClassName.split(" ")
if (classes.every(function (item) {
return nodeClasses.indexOf(item) !== -1
})) {
elems.push(node)
}
}
})
return elems
}
DOMElement.prototype.getElementsByTagName = function _Element_getElementsByTagName(tagName) {
tagName = tagName.toLowerCase()
var elems = []
domWalk(this.childNodes, function (node) {
if (node.nodeType === 1 && (tagName === '*' || node.tagName.toLowerCase() === tagName)) {
elems.push(node)
}
})
return elems
}
DOMElement.prototype.contains = function _Element_contains(element) {
return domWalk(this, function (node) {
return element === node
}) || false
}

28
node_modules/min-document/dom-fragment.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
var DOMElement = require("./dom-element.js")
module.exports = DocumentFragment
function DocumentFragment(owner) {
if (!(this instanceof DocumentFragment)) {
return new DocumentFragment()
}
this.childNodes = []
this.parentNode = null
this.ownerDocument = owner || null
}
DocumentFragment.prototype.type = "DocumentFragment"
DocumentFragment.prototype.nodeType = 11
DocumentFragment.prototype.nodeName = "#document-fragment"
DocumentFragment.prototype.appendChild = DOMElement.prototype.appendChild
DocumentFragment.prototype.replaceChild = DOMElement.prototype.replaceChild
DocumentFragment.prototype.removeChild = DOMElement.prototype.removeChild
DocumentFragment.prototype.toString =
function _DocumentFragment_toString() {
return this.childNodes.map(function (node) {
return String(node)
}).join("")
}

27
node_modules/min-document/dom-text.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
module.exports = DOMText
function DOMText(value, owner) {
if (!(this instanceof DOMText)) {
return new DOMText(value)
}
this.data = value || ""
this.length = this.data.length
this.ownerDocument = owner || null
}
DOMText.prototype.type = "DOMTextNode"
DOMText.prototype.nodeType = 3
DOMText.prototype.nodeName = "#text"
DOMText.prototype.toString = function _Text_toString() {
return this.data
}
DOMText.prototype.replaceData = function replaceData(index, length, value) {
var current = this.data
var left = current.substring(0, index)
var right = current.substring(index + length, current.length)
this.data = left + value + right
this.length = this.data.length
}

13
node_modules/min-document/event.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
module.exports = Event
function Event(family) {}
Event.prototype.initEvent = function _Event_initEvent(type, bubbles, cancelable) {
this.type = type
this.bubbles = bubbles
this.cancelable = cancelable
}
Event.prototype.preventDefault = function _Event_preventDefault() {
}

17
node_modules/min-document/event/add-event-listener.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
module.exports = addEventListener
function addEventListener(type, listener) {
var elem = this
if (!elem.listeners) {
elem.listeners = {}
}
if (!elem.listeners[type]) {
elem.listeners[type] = []
}
if (elem.listeners[type].indexOf(listener) === -1) {
elem.listeners[type].push(listener)
}
}

31
node_modules/min-document/event/dispatch-event.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
module.exports = dispatchEvent
function dispatchEvent(ev) {
var elem = this
var type = ev.type
if (!ev.target) {
ev.target = elem
}
if (!elem.listeners) {
elem.listeners = {}
}
var listeners = elem.listeners[type]
if (listeners) {
return listeners.forEach(function (listener) {
ev.currentTarget = elem
if (typeof listener === 'function') {
listener(ev)
} else {
listener.handleEvent(ev)
}
})
}
if (elem.parentNode) {
elem.parentNode.dispatchEvent(ev)
}
}

View File

@@ -0,0 +1,19 @@
module.exports = removeEventListener
function removeEventListener(type, listener) {
var elem = this
if (!elem.listeners) {
return
}
if (!elem.listeners[type]) {
return
}
var list = elem.listeners[type]
var index = list.indexOf(listener)
if (index !== -1) {
list.splice(index, 1)
}
}

3
node_modules/min-document/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
var Document = require('./document.js');
module.exports = new Document();

40
node_modules/min-document/package.json generated vendored Normal file
View File

@@ -0,0 +1,40 @@
{
"name": "min-document",
"version": "2.19.0",
"description": "A minimal DOM implementation",
"author": "Raynos <raynos2@gmail.com>",
"repository": "git://github.com/Raynos/min-document.git",
"main": "index",
"homepage": "https://github.com/Raynos/min-document",
"dependencies": {
"dom-walk": "^0.1.0"
},
"devDependencies": {
"run-browser": "git://github.com/Raynos/run-browser",
"tap-dot": "^0.2.1",
"tap-spec": "^0.1.8",
"tape": "^2.12.3"
},
"licenses": [
{
"type": "MIT",
"url": "http://github.com/Raynos/min-document/raw/master/LICENSE"
}
],
"testling": {
"files": "test/index.js",
"browsers": [
"ie/8..latest",
"firefox/16..latest",
"firefox/nightly",
"chrome/22..latest",
"chrome/canary",
"opera/12..latest",
"opera/next",
"safari/5.1..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
}
}

139
node_modules/min-document/serialize.js generated vendored Normal file
View File

@@ -0,0 +1,139 @@
module.exports = serializeNode
var voidElements = ["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];
function serializeNode(node) {
switch (node.nodeType) {
case 3:
return escapeText(node.data)
case 8:
return "<!--" + node.data + "-->"
default:
return serializeElement(node)
}
}
function serializeElement(elem) {
var strings = []
var tagname = elem.tagName
if (elem.namespaceURI === "http://www.w3.org/1999/xhtml") {
tagname = tagname.toLowerCase()
}
strings.push("<" + tagname + properties(elem) + datasetify(elem))
if (voidElements.indexOf(tagname) > -1) {
strings.push(" />")
} else {
strings.push(">")
if (elem.childNodes.length) {
strings.push.apply(strings, elem.childNodes.map(serializeNode))
} else if (elem.textContent || elem.innerText) {
strings.push(escapeText(elem.textContent || elem.innerText))
} else if (elem.innerHTML) {
strings.push(elem.innerHTML)
}
strings.push("</" + tagname + ">")
}
return strings.join("")
}
function isProperty(elem, key) {
var type = typeof elem[key]
if (key === "style" && Object.keys(elem.style).length > 0) {
return true
}
return elem.hasOwnProperty(key) &&
(type === "string" || type === "boolean" || type === "number") &&
key !== "nodeName" && key !== "className" && key !== "tagName" &&
key !== "textContent" && key !== "innerText" && key !== "namespaceURI" && key !== "innerHTML"
}
function stylify(styles) {
if (typeof styles === 'string') return styles
var attr = ""
Object.keys(styles).forEach(function (key) {
var value = styles[key]
key = key.replace(/[A-Z]/g, function(c) {
return "-" + c.toLowerCase();
})
attr += key + ":" + value + ";"
})
return attr
}
function datasetify(elem) {
var ds = elem.dataset
var props = []
for (var key in ds) {
props.push({ name: "data-" + key, value: ds[key] })
}
return props.length ? stringify(props) : ""
}
function stringify(list) {
var attributes = []
list.forEach(function (tuple) {
var name = tuple.name
var value = tuple.value
if (name === "style") {
value = stylify(value)
}
attributes.push(name + "=" + "\"" + escapeAttributeValue(value) + "\"")
})
return attributes.length ? " " + attributes.join(" ") : ""
}
function properties(elem) {
var props = []
for (var key in elem) {
if (isProperty(elem, key)) {
props.push({ name: key, value: elem[key] })
}
}
for (var ns in elem._attributes) {
for (var attribute in elem._attributes[ns]) {
var prop = elem._attributes[ns][attribute]
var name = (prop.prefix ? prop.prefix + ":" : "") + attribute
props.push({ name: name, value: prop.value })
}
}
if (elem.className) {
props.push({ name: "class", value: elem.className })
}
return props.length ? stringify(props) : ""
}
function escapeText(s) {
var str = '';
if (typeof(s) === 'string') {
str = s;
} else if (s) {
str = s.toString();
}
return str
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
}
function escapeAttributeValue(str) {
return escapeText(str).replace(/"/g, "&quot;")
}