1
0

add initial marp implementation with sample content and build configuration

This commit is contained in:
2025-09-13 18:13:22 +02:00
parent dcacc9b409
commit e5f219507f
10319 changed files with 1402023 additions and 0 deletions

146
node_modules/mathjax-full/js/adaptors/HTMLAdaptor.d.ts generated vendored Normal file
View File

@@ -0,0 +1,146 @@
import { OptionList } from '../util/Options.js';
import { AttributeData, AbstractDOMAdaptor, DOMAdaptor } from '../core/DOMAdaptor.js';
export interface MinDocument<N, T> {
documentElement: N;
head: N;
body: N;
title: string;
doctype: {
name: string;
};
createElement(kind: string): N;
createElementNS(ns: string, kind: string): N;
createTextNode(text: string): T;
querySelectorAll(selector: string): ArrayLike<N>;
}
export interface MinHTMLElement<N, T> {
nodeType: number;
nodeName: string;
nodeValue: string;
textContent: string;
innerHTML: string;
outerHTML: string;
parentNode: N | Node;
nextSibling: N | T | Node;
previousSibling: N | T | Node;
offsetWidth: number;
offsetHeight: number;
attributes: AttributeData[] | NamedNodeMap;
className: string;
classList: DOMTokenList;
style: OptionList;
sheet?: {
insertRule: (rule: string, index?: number) => void;
};
childNodes: (N | T)[] | NodeList;
firstChild: N | T | Node;
lastChild: N | T | Node;
getElementsByTagName(name: string): N[] | HTMLCollectionOf<Element>;
getElementsByTagNameNS(ns: string, name: string): N[] | HTMLCollectionOf<Element>;
contains(child: N | T): boolean;
appendChild(child: N | T): N | T | Node;
removeChild(child: N | T): N | T | Node;
replaceChild(nnode: N | T, onode: N | T): N | T | Node;
insertBefore(nchild: N | T, ochild: N | T): void;
cloneNode(deep: boolean): N | Node;
setAttribute(name: string, value: string): void;
setAttributeNS(ns: string, name: string, value: string): void;
getAttribute(name: string): string;
removeAttribute(name: string): void;
hasAttribute(name: string): boolean;
getBoundingClientRect(): Object;
getBBox?(): {
x: number;
y: number;
width: number;
height: number;
};
}
export interface MinText<N, T> {
nodeType: number;
nodeName: string;
nodeValue: string;
parentNode: N | Node;
nextSibling: N | T | Node;
previousSibling: N | T | Node;
splitText(n: number): T;
}
export interface MinDOMParser<D> {
parseFromString(text: string, format?: string): D;
}
export interface MinXMLSerializer<N> {
serializeToString(node: N): string;
}
export interface MinWindow<N, D> {
document: D;
DOMParser: {
new (): MinDOMParser<D>;
};
XMLSerializer: {
new (): MinXMLSerializer<N>;
};
NodeList: any;
HTMLCollection: any;
HTMLElement: any;
DocumentFragment: any;
Document: any;
getComputedStyle(node: N): any;
}
export interface MinHTMLAdaptor<N, T, D> extends DOMAdaptor<N, T, D> {
window: MinWindow<N, D>;
}
export declare class HTMLAdaptor<N extends MinHTMLElement<N, T>, T extends MinText<N, T>, D extends MinDocument<N, T>> extends AbstractDOMAdaptor<N, T, D> implements MinHTMLAdaptor<N, T, D> {
window: MinWindow<N, D>;
parser: MinDOMParser<D>;
constructor(window: MinWindow<N, D>);
parse(text: string, format?: string): D;
protected create(kind: string, ns?: string): N;
text(text: string): T;
head(doc: D): N;
body(doc: D): N;
root(doc: D): N;
doctype(doc: D): string;
tags(node: N, name: string, ns?: string): N[];
getElements(nodes: (string | N | N[])[], _document: D): N[];
contains(container: N, node: N | T): boolean;
parent(node: N | T): N;
append(node: N, child: N | T): N | T;
insert(nchild: N | T, ochild: N | T): void;
remove(child: N | T): N | T;
replace(nnode: N | T, onode: N | T): N | T;
clone(node: N): N;
split(node: T, n: number): T;
next(node: N | T): N | T;
previous(node: N | T): N | T;
firstChild(node: N): N | T;
lastChild(node: N): N | T;
childNodes(node: N): (N | T)[];
childNode(node: N, i: number): N | T;
kind(node: N | T): string;
value(node: N | T): string;
textContent(node: N): string;
innerHTML(node: N): string;
outerHTML(node: N): string;
serializeXML(node: N): string;
setAttribute(node: N, name: string, value: string, ns?: string): void;
getAttribute(node: N, name: string): string;
removeAttribute(node: N, name: string): void;
hasAttribute(node: N, name: string): boolean;
allAttributes(node: N): AttributeData[];
addClass(node: N, name: string): void;
removeClass(node: N, name: string): void;
hasClass(node: N, name: string): boolean;
setStyle(node: N, name: string, value: string): void;
getStyle(node: N, name: string): any;
allStyles(node: N): any;
insertRules(node: N, rules: string[]): void;
fontSize(node: N): number;
fontFamily(node: N): any;
nodeSize(node: N, em?: number, local?: boolean): [number, number];
nodeBBox(node: N): {
left: number;
right: number;
top: number;
bottom: number;
};
}

257
node_modules/mathjax-full/js/adaptors/HTMLAdaptor.js generated vendored Normal file
View File

@@ -0,0 +1,257 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HTMLAdaptor = void 0;
var DOMAdaptor_js_1 = require("../core/DOMAdaptor.js");
var HTMLAdaptor = (function (_super) {
__extends(HTMLAdaptor, _super);
function HTMLAdaptor(window) {
var _this = _super.call(this, window.document) || this;
_this.window = window;
_this.parser = new window.DOMParser();
return _this;
}
HTMLAdaptor.prototype.parse = function (text, format) {
if (format === void 0) { format = 'text/html'; }
return this.parser.parseFromString(text, format);
};
HTMLAdaptor.prototype.create = function (kind, ns) {
return (ns ?
this.document.createElementNS(ns, kind) :
this.document.createElement(kind));
};
HTMLAdaptor.prototype.text = function (text) {
return this.document.createTextNode(text);
};
HTMLAdaptor.prototype.head = function (doc) {
return doc.head || doc;
};
HTMLAdaptor.prototype.body = function (doc) {
return doc.body || doc;
};
HTMLAdaptor.prototype.root = function (doc) {
return doc.documentElement || doc;
};
HTMLAdaptor.prototype.doctype = function (doc) {
return (doc.doctype ? "<!DOCTYPE ".concat(doc.doctype.name, ">") : '');
};
HTMLAdaptor.prototype.tags = function (node, name, ns) {
if (ns === void 0) { ns = null; }
var nodes = (ns ? node.getElementsByTagNameNS(ns, name) : node.getElementsByTagName(name));
return Array.from(nodes);
};
HTMLAdaptor.prototype.getElements = function (nodes, _document) {
var e_1, _a;
var containers = [];
try {
for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
var node = nodes_1_1.value;
if (typeof (node) === 'string') {
containers = containers.concat(Array.from(this.document.querySelectorAll(node)));
}
else if (Array.isArray(node)) {
containers = containers.concat(Array.from(node));
}
else if (node instanceof this.window.NodeList || node instanceof this.window.HTMLCollection) {
containers = containers.concat(Array.from(node));
}
else {
containers.push(node);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
}
finally { if (e_1) throw e_1.error; }
}
return containers;
};
HTMLAdaptor.prototype.contains = function (container, node) {
return container.contains(node);
};
HTMLAdaptor.prototype.parent = function (node) {
return node.parentNode;
};
HTMLAdaptor.prototype.append = function (node, child) {
return node.appendChild(child);
};
HTMLAdaptor.prototype.insert = function (nchild, ochild) {
return this.parent(ochild).insertBefore(nchild, ochild);
};
HTMLAdaptor.prototype.remove = function (child) {
return this.parent(child).removeChild(child);
};
HTMLAdaptor.prototype.replace = function (nnode, onode) {
return this.parent(onode).replaceChild(nnode, onode);
};
HTMLAdaptor.prototype.clone = function (node) {
return node.cloneNode(true);
};
HTMLAdaptor.prototype.split = function (node, n) {
return node.splitText(n);
};
HTMLAdaptor.prototype.next = function (node) {
return node.nextSibling;
};
HTMLAdaptor.prototype.previous = function (node) {
return node.previousSibling;
};
HTMLAdaptor.prototype.firstChild = function (node) {
return node.firstChild;
};
HTMLAdaptor.prototype.lastChild = function (node) {
return node.lastChild;
};
HTMLAdaptor.prototype.childNodes = function (node) {
return Array.from(node.childNodes);
};
HTMLAdaptor.prototype.childNode = function (node, i) {
return node.childNodes[i];
};
HTMLAdaptor.prototype.kind = function (node) {
var n = node.nodeType;
return (n === 1 || n === 3 || n === 8 ? node.nodeName.toLowerCase() : '');
};
HTMLAdaptor.prototype.value = function (node) {
return node.nodeValue || '';
};
HTMLAdaptor.prototype.textContent = function (node) {
return node.textContent;
};
HTMLAdaptor.prototype.innerHTML = function (node) {
return node.innerHTML;
};
HTMLAdaptor.prototype.outerHTML = function (node) {
return node.outerHTML;
};
HTMLAdaptor.prototype.serializeXML = function (node) {
var serializer = new this.window.XMLSerializer();
return serializer.serializeToString(node);
};
HTMLAdaptor.prototype.setAttribute = function (node, name, value, ns) {
if (ns === void 0) { ns = null; }
if (!ns) {
return node.setAttribute(name, value);
}
name = ns.replace(/.*\//, '') + ':' + name.replace(/^.*:/, '');
return node.setAttributeNS(ns, name, value);
};
HTMLAdaptor.prototype.getAttribute = function (node, name) {
return node.getAttribute(name);
};
HTMLAdaptor.prototype.removeAttribute = function (node, name) {
return node.removeAttribute(name);
};
HTMLAdaptor.prototype.hasAttribute = function (node, name) {
return node.hasAttribute(name);
};
HTMLAdaptor.prototype.allAttributes = function (node) {
return Array.from(node.attributes).map(function (x) {
return { name: x.name, value: x.value };
});
};
HTMLAdaptor.prototype.addClass = function (node, name) {
if (node.classList) {
node.classList.add(name);
}
else {
node.className = (node.className + ' ' + name).trim();
}
};
HTMLAdaptor.prototype.removeClass = function (node, name) {
if (node.classList) {
node.classList.remove(name);
}
else {
node.className = node.className.split(/ /).filter(function (c) { return c !== name; }).join(' ');
}
};
HTMLAdaptor.prototype.hasClass = function (node, name) {
if (node.classList) {
return node.classList.contains(name);
}
return node.className.split(/ /).indexOf(name) >= 0;
};
HTMLAdaptor.prototype.setStyle = function (node, name, value) {
node.style[name] = value;
};
HTMLAdaptor.prototype.getStyle = function (node, name) {
return node.style[name];
};
HTMLAdaptor.prototype.allStyles = function (node) {
return node.style.cssText;
};
HTMLAdaptor.prototype.insertRules = function (node, rules) {
var e_2, _a;
try {
for (var _b = __values(rules.reverse()), _c = _b.next(); !_c.done; _c = _b.next()) {
var rule = _c.value;
try {
node.sheet.insertRule(rule, 0);
}
catch (e) {
console.warn("MathJax: can't insert css rule '".concat(rule, "': ").concat(e.message));
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
};
HTMLAdaptor.prototype.fontSize = function (node) {
var style = this.window.getComputedStyle(node);
return parseFloat(style.fontSize);
};
HTMLAdaptor.prototype.fontFamily = function (node) {
var style = this.window.getComputedStyle(node);
return style.fontFamily || '';
};
HTMLAdaptor.prototype.nodeSize = function (node, em, local) {
if (em === void 0) { em = 1; }
if (local === void 0) { local = false; }
if (local && node.getBBox) {
var _a = node.getBBox(), width = _a.width, height = _a.height;
return [width / em, height / em];
}
return [node.offsetWidth / em, node.offsetHeight / em];
};
HTMLAdaptor.prototype.nodeBBox = function (node) {
var _a = node.getBoundingClientRect(), left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom;
return { left: left, right: right, top: top, bottom: bottom };
};
return HTMLAdaptor;
}(DOMAdaptor_js_1.AbstractDOMAdaptor));
exports.HTMLAdaptor = HTMLAdaptor;
//# sourceMappingURL=HTMLAdaptor.js.map

File diff suppressed because one or more lines are too long

6
node_modules/mathjax-full/js/adaptors/NodeMixin.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import { DOMAdaptor } from '../core/DOMAdaptor.js';
import { OptionList } from '../util/Options.js';
export declare type Constructor<T> = (new (...args: any[]) => T);
export declare type AdaptorConstructor<N, T, D> = Constructor<DOMAdaptor<N, T, D>>;
export declare const NodeMixinOptions: OptionList;
export declare function NodeMixin<N, T, D, A extends AdaptorConstructor<N, T, D>>(Base: A, options?: typeof NodeMixinOptions): A;

106
node_modules/mathjax-full/js/adaptors/NodeMixin.js generated vendored Normal file
View File

@@ -0,0 +1,106 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeMixin = exports.NodeMixinOptions = void 0;
var Options_js_1 = require("../util/Options.js");
exports.NodeMixinOptions = {
badCSS: true,
badSizes: true,
};
function NodeMixin(Base, options) {
var _a;
if (options === void 0) { options = {}; }
options = (0, Options_js_1.userOptions)((0, Options_js_1.defaultOptions)({}, exports.NodeMixinOptions), options);
return _a = (function (_super) {
__extends(NodeAdaptor, _super);
function NodeAdaptor() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var _this = _super.call(this, args[0]) || this;
var CLASS = _this.constructor;
_this.options = (0, Options_js_1.userOptions)((0, Options_js_1.defaultOptions)({}, CLASS.OPTIONS), args[1]);
return _this;
}
NodeAdaptor.prototype.fontSize = function (node) {
return (options.badCSS ? this.options.fontSize : _super.prototype.fontSize.call(this, node));
};
NodeAdaptor.prototype.fontFamily = function (node) {
return (options.badCSS ? this.options.fontFamily : _super.prototype.fontFamily.call(this, node));
};
NodeAdaptor.prototype.nodeSize = function (node, em, local) {
if (em === void 0) { em = 1; }
if (local === void 0) { local = null; }
if (!options.badSizes) {
return _super.prototype.nodeSize.call(this, node, em, local);
}
var text = this.textContent(node);
var non = Array.from(text.replace(NodeAdaptor.cjkPattern, '')).length;
var CJK = Array.from(text).length - non;
return [
CJK * this.options.cjkCharWidth + non * this.options.unknownCharWidth,
this.options.unknownCharHeight
];
};
NodeAdaptor.prototype.nodeBBox = function (node) {
return (options.badSizes ? { left: 0, right: 0, top: 0, bottom: 0 } : _super.prototype.nodeBBox.call(this, node));
};
return NodeAdaptor;
}(Base)),
_a.OPTIONS = __assign(__assign({}, (options.badCSS ? {
fontSize: 16,
fontFamily: 'Times',
} : {})), (options.badSizes ? {
cjkCharWidth: 1,
unknownCharWidth: .6,
unknownCharHeight: .8,
} : {})),
_a.cjkPattern = new RegExp([
'[',
'\u1100-\u115F',
'\u2329\u232A',
'\u2E80-\u303E',
'\u3040-\u3247',
'\u3250-\u4DBF',
'\u4E00-\uA4C6',
'\uA960-\uA97C',
'\uAC00-\uD7A3',
'\uF900-\uFAFF',
'\uFE10-\uFE19',
'\uFE30-\uFE6B',
'\uFF01-\uFF60\uFFE0-\uFFE6',
"\uD82C\uDC00-\uD82C\uDC01",
"\uD83C\uDE00-\uD83C\uDE51",
"\uD840\uDC00-\uD8BF\uDFFD",
']'
].join(''), 'gu'),
_a;
}
exports.NodeMixin = NodeMixin;
//# sourceMappingURL=NodeMixin.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NodeMixin.js","sourceRoot":"","sources":["../../ts/adaptors/NodeMixin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,iDAA2E;AAiB9D,QAAA,gBAAgB,GAAe;IAC1C,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;CACf,CAAC;AAOF,SAAgB,SAAS,CACvB,IAAO,EACP,OAAqC;;IAArC,wBAAA,EAAA,YAAqC;IAGrC,OAAO,GAAG,IAAA,wBAAW,EAAC,IAAA,2BAAc,EAAC,EAAE,EAAE,wBAAgB,CAAC,EAAE,OAAO,CAAC,CAAC;IAErE;YAAiC,+BAAI;YAkDnC;gBAAY,cAAc;qBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;oBAAd,yBAAc;;gBAA1B,YACE,kBAAM,IAAI,CAAC,CAAC,CAAC,CAAC,SAGf;gBAFC,IAAI,KAAK,GAAG,KAAI,CAAC,WAAiC,CAAC;gBACnD,KAAI,CAAC,OAAO,GAAG,IAAA,wBAAW,EAAC,IAAA,2BAAc,EAAC,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;;YACzE,CAAC;YAOM,8BAAQ,GAAf,UAAgB,IAAO;gBACrB,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAM,QAAQ,YAAC,IAAI,CAAC,CAAC,CAAC;YACzE,CAAC;YAOM,gCAAU,GAAjB,UAAkB,IAAO;gBACvB,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAM,UAAU,YAAC,IAAI,CAAC,CAAC,CAAC;YAC7E,CAAC;YAKM,8BAAQ,GAAf,UAAgB,IAAO,EAAE,EAAc,EAAE,KAAqB;gBAArC,mBAAA,EAAA,MAAc;gBAAE,sBAAA,EAAA,YAAqB;gBAC5D,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;oBACrB,OAAO,iBAAM,QAAQ,YAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;iBACxC;gBACD,IAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBACpC,IAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;gBACxE,IAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC;gBAC1C,OAAO;oBACL,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB;oBACrE,IAAI,CAAC,OAAO,CAAC,iBAAiB;iBACX,CAAC;YACxB,CAAC;YAKM,8BAAQ,GAAf,UAAgB,IAAO;gBACrB,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC,CAAC,CAAC,CAAC,iBAAM,QAAQ,YAAC,IAAI,CAAC,CAAC,CAAC;YAC5F,CAAC;YAEH,kBAAC;QAAD,CAAC,AAjGM,CAA0B,IAAI;QAKrB,UAAO,yBAChB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;YACnB,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,OAAO;SACpB,CAAC,CAAC,CAAC,EAAE,CAAC,GACJ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrB,YAAY,EAAE,CAAC;YACf,gBAAgB,EAAE,EAAE;YACpB,iBAAiB,EAAE,EAAE;SACtB,CAAC,CAAC,CAAC,EAAE,CAAC,CACP;QAKY,aAAU,GAAG,IAAI,MAAM,CAAC;YACpC,GAAG;YACH,eAAe;YACf,cAAc;YACd,eAAe;YACf,eAAe;YACf,eAAe;YACf,eAAe;YACf,eAAe;YACf,eAAe;YACf,eAAe;YACf,eAAe;YACf,eAAe;YACf,4BAA4B;YAC5B,2BAAqB;YACrB,2BAAqB;YACrB,2BAAqB;YACrB,GAAG;SACJ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,CAAE;WA2DlB;AAEJ,CAAC;AA1GD,8BA0GC"}

View File

@@ -0,0 +1,13 @@
import { HTMLAdaptor } from './HTMLAdaptor.js';
declare global {
interface Window {
Document: typeof Document;
DOMParser: typeof DOMParser;
XMLSerializer: typeof XMLSerializer;
HTMLElement: typeof HTMLElement;
HTMLCollection: typeof HTMLCollection;
NodeList: typeof NodeList;
DocumentFragment: typeof DocumentFragment;
}
}
export declare function browserAdaptor(): HTMLAdaptor<HTMLElement, Text, Document>;

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.browserAdaptor = void 0;
var HTMLAdaptor_js_1 = require("./HTMLAdaptor.js");
function browserAdaptor() {
return new HTMLAdaptor_js_1.HTMLAdaptor(window);
}
exports.browserAdaptor = browserAdaptor;
//# sourceMappingURL=browserAdaptor.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"browserAdaptor.js","sourceRoot":"","sources":["../../ts/adaptors/browserAdaptor.ts"],"names":[],"mappings":";;;AAuBA,mDAA6C;AAsB7C,SAAgB,cAAc;IAC5B,OAAO,IAAI,4BAAW,CAA8B,MAAM,CAAC,CAAC;AAC9D,CAAC;AAFD,wCAEC"}

View File

@@ -0,0 +1,3 @@
import { liteAdaptor } from './liteAdaptor.js';
import { browserAdaptor } from './browserAdaptor.js';
export declare const chooseAdaptor: typeof browserAdaptor | typeof liteAdaptor;

15
node_modules/mathjax-full/js/adaptors/chooseAdaptor.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.chooseAdaptor = void 0;
var liteAdaptor_js_1 = require("./liteAdaptor.js");
var browserAdaptor_js_1 = require("./browserAdaptor.js");
var choose;
try {
document;
choose = browserAdaptor_js_1.browserAdaptor;
}
catch (e) {
choose = liteAdaptor_js_1.liteAdaptor;
}
exports.chooseAdaptor = choose;
//# sourceMappingURL=chooseAdaptor.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"chooseAdaptor.js","sourceRoot":"","sources":["../../ts/adaptors/chooseAdaptor.ts"],"names":[],"mappings":";;;AAuBA,mDAA6C;AAC7C,yDAAmD;AAEnD,IAAI,MAAM,CAAC;AAEX,IAAI;IACF,QAAQ,CAAC;IACT,MAAM,GAAG,kCAAc,CAAC;CACzB;AAAC,OAAO,CAAC,EAAE;IACV,MAAM,GAAG,4BAAW,CAAC;CACtB;AAKY,QAAA,aAAa,GAAG,MAAM,CAAC"}

View File

@@ -0,0 +1,9 @@
import { HTMLAdaptor } from './HTMLAdaptor.js';
import { Constructor } from './NodeMixin.js';
import { OptionList } from '../util/Options.js';
export declare type HTMLAdaptorConstructor = Constructor<HTMLAdaptor<HTMLElement, Text, Document>>;
declare const JsdomAdaptor_base: HTMLAdaptorConstructor;
export declare class JsdomAdaptor extends JsdomAdaptor_base {
}
export declare function jsdomAdaptor(JSDOM: any, options?: OptionList): JsdomAdaptor;
export {};

34
node_modules/mathjax-full/js/adaptors/jsdomAdaptor.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.jsdomAdaptor = exports.JsdomAdaptor = void 0;
var HTMLAdaptor_js_1 = require("./HTMLAdaptor.js");
var NodeMixin_js_1 = require("./NodeMixin.js");
var JsdomAdaptor = (function (_super) {
__extends(JsdomAdaptor, _super);
function JsdomAdaptor() {
return _super !== null && _super.apply(this, arguments) || this;
}
return JsdomAdaptor;
}((0, NodeMixin_js_1.NodeMixin)(HTMLAdaptor_js_1.HTMLAdaptor)));
exports.JsdomAdaptor = JsdomAdaptor;
function jsdomAdaptor(JSDOM, options) {
if (options === void 0) { options = null; }
return new JsdomAdaptor(new JSDOM().window, options);
}
exports.jsdomAdaptor = jsdomAdaptor;
//# sourceMappingURL=jsdomAdaptor.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"jsdomAdaptor.js","sourceRoot":"","sources":["../../ts/adaptors/jsdomAdaptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,mDAA6C;AAC7C,+CAAsD;AAWtD;IAAkC,gCAA2E;IAA7G;;IAA+G,CAAC;IAAD,mBAAC;AAAD,CAAC,AAAhH,CAAkC,IAAA,wBAAS,EAAsD,4BAAW,CAAC,GAAG;AAAnG,oCAAY;AAQzB,SAAgB,YAAY,CAAC,KAAU,EAAE,OAA0B;IAA1B,wBAAA,EAAA,cAA0B;IACjE,OAAO,IAAI,YAAY,CAAC,IAAI,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC;AAFD,oCAEC"}

View File

@@ -0,0 +1,11 @@
import { HTMLAdaptor } from './HTMLAdaptor.js';
import { Constructor } from './NodeMixin.js';
import { OptionList } from '../util/Options.js';
export declare type HTMLAdaptorConstructor = Constructor<HTMLAdaptor<HTMLElement, Text, Document>>;
declare const LinkedomAdaptor_base: HTMLAdaptorConstructor;
export declare class LinkedomAdaptor extends LinkedomAdaptor_base {
parse(text: string, format?: string): Document;
serializeXML(node: HTMLElement): string;
}
export declare function linkedomAdaptor(parseHTML: any, options?: OptionList): LinkedomAdaptor;
export {};

View File

@@ -0,0 +1,49 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.linkedomAdaptor = exports.LinkedomAdaptor = void 0;
var HTMLAdaptor_js_1 = require("./HTMLAdaptor.js");
var NodeMixin_js_1 = require("./NodeMixin.js");
var LinkedomAdaptor = (function (_super) {
__extends(LinkedomAdaptor, _super);
function LinkedomAdaptor() {
return _super !== null && _super.apply(this, arguments) || this;
}
LinkedomAdaptor.prototype.parse = function (text, format) {
if (format === void 0) { format = 'text/html'; }
if (!text.match(/^(?:\s|\n)*</))
text = '<html>' + text + '</html>';
return this.parser.parseFromString(text, format);
};
LinkedomAdaptor.prototype.serializeXML = function (node) {
return this.outerHTML(node);
};
return LinkedomAdaptor;
}((0, NodeMixin_js_1.NodeMixin)(HTMLAdaptor_js_1.HTMLAdaptor)));
exports.LinkedomAdaptor = LinkedomAdaptor;
function linkedomAdaptor(parseHTML, options) {
if (options === void 0) { options = null; }
var window = parseHTML('<html></html>');
window.constructor.prototype.HTMLCollection = (function () {
function HTMLCollection() {
}
return HTMLCollection;
}());
return new LinkedomAdaptor(window, options);
}
exports.linkedomAdaptor = linkedomAdaptor;
//# sourceMappingURL=linkedomAdaptor.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"linkedomAdaptor.js","sourceRoot":"","sources":["../../ts/adaptors/linkedomAdaptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,mDAA6C;AAC7C,+CAAsD;AAWtD;IAAqC,mCAA2E;IAAhH;;IAuBA,CAAC;IAlBQ,+BAAK,GAAZ,UAAa,IAAY,EAAE,MAA4B;QAA5B,uBAAA,EAAA,oBAA4B;QAIrD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;YAAE,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC;QACpE,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;IAQM,sCAAY,GAAnB,UAAoB,IAAiB;QACnC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAEH,sBAAC;AAAD,CAAC,AAvBD,CAAqC,IAAA,wBAAS,EAAsD,4BAAW,CAAC,GAuB/G;AAvBY,0CAAe;AA+B5B,SAAgB,eAAe,CAAC,SAAc,EAAE,OAA0B;IAA1B,wBAAA,EAAA,cAA0B;IACxE,IAAM,MAAM,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC;IAC1C,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc;QAAG;QAAO,CAAC;QAAD,qBAAC;IAAD,CAAC,AAAR,GAAQ,CAAC;IACvD,OAAO,IAAI,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAJD,0CAIC"}

View File

@@ -0,0 +1,9 @@
import { LiteElement } from './Element.js';
export declare class LiteDocument {
root: LiteElement;
head: LiteElement;
body: LiteElement;
type: string;
get kind(): string;
constructor();
}

23
node_modules/mathjax-full/js/adaptors/lite/Document.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiteDocument = void 0;
var Element_js_1 = require("./Element.js");
var LiteDocument = (function () {
function LiteDocument() {
this.root = new Element_js_1.LiteElement('html', {}, [
this.head = new Element_js_1.LiteElement('head'),
this.body = new Element_js_1.LiteElement('body')
]);
this.type = '';
}
Object.defineProperty(LiteDocument.prototype, "kind", {
get: function () {
return '#document';
},
enumerable: false,
configurable: true
});
return LiteDocument;
}());
exports.LiteDocument = LiteDocument;
//# sourceMappingURL=Document.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Document.js","sourceRoot":"","sources":["../../../ts/adaptors/lite/Document.ts"],"names":[],"mappings":";;;AAuBA,2CAAyC;AAMzC;IA6BE;QACE,IAAI,CAAC,IAAI,GAAG,IAAI,wBAAW,CAAC,MAAM,EAAE,EAAE,EAAE;YACtC,IAAI,CAAC,IAAI,GAAG,IAAI,wBAAW,CAAC,MAAM,CAAC;YACnC,IAAI,CAAC,IAAI,GAAG,IAAI,wBAAW,CAAC,MAAM,CAAC;SACpC,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACjB,CAAC;IAbD,sBAAW,8BAAI;aAAf;YACE,OAAO,WAAW,CAAC;QACrB,CAAC;;;OAAA;IAYH,mBAAC;AAAD,CAAC,AApCD,IAoCC;AApCY,oCAAY"}

View File

@@ -0,0 +1,13 @@
import { OptionList } from '../../util/Options.js';
import { Styles } from '../../util/Styles.js';
import { LiteText } from './Text.js';
export declare type LiteAttributeList = OptionList;
export declare type LiteNode = LiteElement | LiteText;
export declare class LiteElement {
kind: string;
attributes: LiteAttributeList;
children: LiteNode[];
parent: LiteElement;
styles: Styles;
constructor(kind: string, attributes?: LiteAttributeList, children?: LiteNode[]);
}

77
node_modules/mathjax-full/js/adaptors/lite/Element.js generated vendored Normal file
View File

@@ -0,0 +1,77 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiteElement = void 0;
var LiteElement = (function () {
function LiteElement(kind, attributes, children) {
var e_1, _a;
if (attributes === void 0) { attributes = {}; }
if (children === void 0) { children = []; }
this.kind = kind;
this.attributes = __assign({}, attributes);
this.children = __spreadArray([], __read(children), false);
try {
for (var _b = __values(this.children), _c = _b.next(); !_c.done; _c = _b.next()) {
var child = _c.value;
child.parent = this;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
this.styles = null;
}
return LiteElement;
}());
exports.LiteElement = LiteElement;
//# sourceMappingURL=Element.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Element.js","sourceRoot":"","sources":["../../../ts/adaptors/lite/Element.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA;IAgCE,qBAAY,IAAY,EAAE,UAAkC,EAAE,QAAyB;;QAA7D,2BAAA,EAAA,eAAkC;QAAE,yBAAA,EAAA,aAAyB;QACrF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,gBAAO,UAAU,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,4BAAO,QAAQ,SAAC,CAAC;;YAC9B,KAAoB,IAAA,KAAA,SAAA,IAAI,CAAC,QAAQ,CAAA,gBAAA,4BAAE;gBAA9B,IAAM,KAAK,WAAA;gBACd,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;aACrB;;;;;;;;;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IACH,kBAAC;AAAD,CAAC,AAzCD,IAyCC;AAzCY,kCAAW"}

7
node_modules/mathjax-full/js/adaptors/lite/List.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import { LiteNode } from './Element.js';
export declare class LiteList<N> {
nodes: N[];
constructor(children: N[]);
append(node: N): void;
[Symbol.iterator](): Iterator<LiteNode>;
}

50
node_modules/mathjax-full/js/adaptors/lite/List.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiteList = void 0;
var LiteList = (function () {
function LiteList(children) {
this.nodes = [];
this.nodes = __spreadArray([], __read(children), false);
}
LiteList.prototype.append = function (node) {
this.nodes.push(node);
};
LiteList.prototype[Symbol.iterator] = function () {
var i = 0;
return {
next: function () {
return (i === this.nodes.length ?
{ value: null, done: true } :
{ value: this.nodes[i++], done: false });
}
};
};
return LiteList;
}());
exports.LiteList = LiteList;
//# sourceMappingURL=List.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../ts/adaptors/lite/List.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA;IAUE,kBAAY,QAAa;QANlB,UAAK,GAAQ,EAAE,CAAC;QAOrB,IAAI,CAAC,KAAK,4BAAO,QAAQ,SAAC,CAAC;IAC7B,CAAC;IAKM,yBAAM,GAAb,UAAc,IAAO;QACnB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAKM,mBAAC,MAAM,CAAC,QAAQ,CAAC,GAAxB;QACE,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,OAAO;YAIL,IAAI,EAAJ;gBACE,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;oBACzB,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;oBAC3B,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC;YACjD,CAAC;SACF,CAAC;IACJ,CAAC;IAEH,eAAC;AAAD,CAAC,AAtCD,IAsCC;AAtCY,4BAAQ"}

43
node_modules/mathjax-full/js/adaptors/lite/Parser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import { MinDOMParser } from '../HTMLAdaptor.js';
import { LiteDocument } from './Document.js';
import { LiteElement } from './Element.js';
import { LiteText, LiteComment } from './Text.js';
import { LiteAdaptor } from '../liteAdaptor.js';
export declare namespace PATTERNS {
const TAGNAME = "[a-z][^\\s\\n>]*";
const ATTNAME = "[a-z][^\\s\\n>=]*";
const VALUE = "(?:'[^']*'|\"[^\"]*\"|[^\\s\\n]+)";
const VALUESPLIT = "(?:'([^']*)'|\"([^\"]*)\"|([^\\s\\n]+))";
const SPACE = "(?:\\s|\\n)+";
const OPTIONALSPACE = "(?:\\s|\\n)*";
const ATTRIBUTE: string;
const ATTRIBUTESPLIT: string;
const TAG: string;
const tag: RegExp;
const attr: RegExp;
const attrsplit: RegExp;
}
export declare class LiteParser implements MinDOMParser<LiteDocument> {
static SELF_CLOSING: {
[name: string]: boolean;
};
static PCDATA: {
[name: string]: boolean;
};
static CDATA_ATTR: {
[name: string]: boolean;
};
parseFromString(text: string, _format?: string, adaptor?: LiteAdaptor): LiteDocument;
protected addText(adaptor: LiteAdaptor, node: LiteElement, text: string): LiteText;
protected addComment(adaptor: LiteAdaptor, node: LiteElement, comment: string): LiteComment;
protected closeTag(adaptor: LiteAdaptor, node: LiteElement, tag: string): LiteElement;
protected openTag(adaptor: LiteAdaptor, node: LiteElement, tag: string, parts: string[]): LiteElement;
protected addAttributes(adaptor: LiteAdaptor, node: LiteElement, attributes: string[]): void;
protected handlePCDATA(adaptor: LiteAdaptor, node: LiteElement, kind: string, parts: string[]): void;
protected checkDocument(adaptor: LiteAdaptor, root: LiteDocument): void;
protected getOnlyChild(adaptor: LiteAdaptor, body: LiteElement): LiteElement;
serialize(adaptor: LiteAdaptor, node: LiteElement, xml?: boolean): string;
serializeInner(adaptor: LiteAdaptor, node: LiteElement, xml?: boolean): string;
protectAttribute(text: string): string;
protectHTML(text: string): string;
}

326
node_modules/mathjax-full/js/adaptors/lite/Parser.js generated vendored Normal file
View File

@@ -0,0 +1,326 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiteParser = exports.PATTERNS = void 0;
var Entities = __importStar(require("../../util/Entities.js"));
var Element_js_1 = require("./Element.js");
var Text_js_1 = require("./Text.js");
var PATTERNS;
(function (PATTERNS) {
PATTERNS.TAGNAME = '[a-z][^\\s\\n>]*';
PATTERNS.ATTNAME = '[a-z][^\\s\\n>=]*';
PATTERNS.VALUE = "(?:'[^']*'|\"[^\"]*\"|[^\\s\\n]+)";
PATTERNS.VALUESPLIT = "(?:'([^']*)'|\"([^\"]*)\"|([^\\s\\n]+))";
PATTERNS.SPACE = '(?:\\s|\\n)+';
PATTERNS.OPTIONALSPACE = '(?:\\s|\\n)*';
PATTERNS.ATTRIBUTE = PATTERNS.ATTNAME + '(?:' + PATTERNS.OPTIONALSPACE + '=' + PATTERNS.OPTIONALSPACE + PATTERNS.VALUE + ')?';
PATTERNS.ATTRIBUTESPLIT = '(' + PATTERNS.ATTNAME + ')(?:' + PATTERNS.OPTIONALSPACE + '=' + PATTERNS.OPTIONALSPACE + PATTERNS.VALUESPLIT + ')?';
PATTERNS.TAG = '(<(?:' + PATTERNS.TAGNAME + '(?:' + PATTERNS.SPACE + PATTERNS.ATTRIBUTE + ')*'
+ PATTERNS.OPTIONALSPACE + '/?|/' + PATTERNS.TAGNAME + '|!--[^]*?--|![^]*?)(?:>|$))';
PATTERNS.tag = new RegExp(PATTERNS.TAG, 'i');
PATTERNS.attr = new RegExp(PATTERNS.ATTRIBUTE, 'i');
PATTERNS.attrsplit = new RegExp(PATTERNS.ATTRIBUTESPLIT, 'i');
})(PATTERNS = exports.PATTERNS || (exports.PATTERNS = {}));
var LiteParser = (function () {
function LiteParser() {
}
LiteParser.prototype.parseFromString = function (text, _format, adaptor) {
if (_format === void 0) { _format = 'text/html'; }
if (adaptor === void 0) { adaptor = null; }
var root = adaptor.createDocument();
var node = adaptor.body(root);
var parts = text.replace(/<\?.*?\?>/g, '').split(PATTERNS.tag);
while (parts.length) {
var text_1 = parts.shift();
var tag = parts.shift();
if (text_1) {
this.addText(adaptor, node, text_1);
}
if (tag && tag.charAt(tag.length - 1) === '>') {
if (tag.charAt(1) === '!') {
this.addComment(adaptor, node, tag);
}
else if (tag.charAt(1) === '/') {
node = this.closeTag(adaptor, node, tag);
}
else {
node = this.openTag(adaptor, node, tag, parts);
}
}
}
this.checkDocument(adaptor, root);
return root;
};
LiteParser.prototype.addText = function (adaptor, node, text) {
text = Entities.translate(text);
return adaptor.append(node, adaptor.text(text));
};
LiteParser.prototype.addComment = function (adaptor, node, comment) {
return adaptor.append(node, new Text_js_1.LiteComment(comment));
};
LiteParser.prototype.closeTag = function (adaptor, node, tag) {
var kind = tag.slice(2, tag.length - 1).toLowerCase();
while (adaptor.parent(node) && adaptor.kind(node) !== kind) {
node = adaptor.parent(node);
}
return adaptor.parent(node);
};
LiteParser.prototype.openTag = function (adaptor, node, tag, parts) {
var PCDATA = this.constructor.PCDATA;
var SELF_CLOSING = this.constructor.SELF_CLOSING;
var kind = tag.match(/<(.*?)[\s\n>\/]/)[1].toLowerCase();
var child = adaptor.node(kind);
var attributes = tag.replace(/^<.*?[\s\n>]/, '').split(PATTERNS.attrsplit);
if (attributes.pop().match(/>$/) || attributes.length < 5) {
this.addAttributes(adaptor, child, attributes);
adaptor.append(node, child);
if (!SELF_CLOSING[kind] && !tag.match(/\/>$/)) {
if (PCDATA[kind]) {
this.handlePCDATA(adaptor, child, kind, parts);
}
else {
node = child;
}
}
}
return node;
};
LiteParser.prototype.addAttributes = function (adaptor, node, attributes) {
var CDATA_ATTR = this.constructor.CDATA_ATTR;
while (attributes.length) {
var _a = __read(attributes.splice(0, 5), 5), name_1 = _a[1], v1 = _a[2], v2 = _a[3], v3 = _a[4];
var value = v1 || v2 || v3 || '';
if (!CDATA_ATTR[name_1]) {
value = Entities.translate(value);
}
adaptor.setAttribute(node, name_1, value);
}
};
LiteParser.prototype.handlePCDATA = function (adaptor, node, kind, parts) {
var pcdata = [];
var etag = '</' + kind + '>';
var ptag = '';
while (parts.length && ptag !== etag) {
pcdata.push(ptag);
pcdata.push(parts.shift());
ptag = parts.shift();
}
adaptor.append(node, adaptor.text(pcdata.join('')));
};
LiteParser.prototype.checkDocument = function (adaptor, root) {
var e_1, _a, e_2, _b;
var node = this.getOnlyChild(adaptor, adaptor.body(root));
if (!node)
return;
try {
for (var _c = __values(adaptor.childNodes(adaptor.body(root))), _d = _c.next(); !_d.done; _d = _c.next()) {
var child = _d.value;
if (child === node) {
break;
}
if (child instanceof Text_js_1.LiteComment && child.value.match(/^<!DOCTYPE/)) {
root.type = child.value;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_1) throw e_1.error; }
}
switch (adaptor.kind(node)) {
case 'html':
try {
for (var _e = __values(node.children), _f = _e.next(); !_f.done; _f = _e.next()) {
var child = _f.value;
switch (adaptor.kind(child)) {
case 'head':
root.head = child;
break;
case 'body':
root.body = child;
break;
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
}
finally { if (e_2) throw e_2.error; }
}
root.root = node;
adaptor.remove(node);
if (adaptor.parent(root.body) !== node) {
adaptor.append(node, root.body);
}
if (adaptor.parent(root.head) !== node) {
adaptor.insert(root.head, root.body);
}
break;
case 'head':
root.head = adaptor.replace(node, root.head);
break;
case 'body':
root.body = adaptor.replace(node, root.body);
break;
}
};
LiteParser.prototype.getOnlyChild = function (adaptor, body) {
var e_3, _a;
var node = null;
try {
for (var _b = __values(adaptor.childNodes(body)), _c = _b.next(); !_c.done; _c = _b.next()) {
var child = _c.value;
if (child instanceof Element_js_1.LiteElement) {
if (node)
return null;
node = child;
}
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
return node;
};
LiteParser.prototype.serialize = function (adaptor, node, xml) {
var _this = this;
if (xml === void 0) { xml = false; }
var SELF_CLOSING = this.constructor.SELF_CLOSING;
var CDATA = this.constructor.CDATA_ATTR;
var tag = adaptor.kind(node);
var attributes = adaptor.allAttributes(node).map(function (x) { return x.name + '="' + (CDATA[x.name] ? x.value : _this.protectAttribute(x.value)) + '"'; }).join(' ');
var content = this.serializeInner(adaptor, node, xml);
var html = '<' + tag + (attributes ? ' ' + attributes : '')
+ ((!xml || content) && !SELF_CLOSING[tag] ? ">".concat(content, "</").concat(tag, ">") : xml ? '/>' : '>');
return html;
};
LiteParser.prototype.serializeInner = function (adaptor, node, xml) {
var _this = this;
if (xml === void 0) { xml = false; }
var PCDATA = this.constructor.PCDATA;
if (PCDATA.hasOwnProperty(node.kind)) {
return adaptor.childNodes(node).map(function (x) { return adaptor.value(x); }).join('');
}
return adaptor.childNodes(node).map(function (x) {
var kind = adaptor.kind(x);
return (kind === '#text' ? _this.protectHTML(adaptor.value(x)) :
kind === '#comment' ? x.value :
_this.serialize(adaptor, x, xml));
}).join('');
};
LiteParser.prototype.protectAttribute = function (text) {
if (typeof text !== 'string') {
text = String(text);
}
return text.replace(/"/g, '&quot;');
};
LiteParser.prototype.protectHTML = function (text) {
return text.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
};
LiteParser.SELF_CLOSING = {
area: true,
base: true,
br: true,
col: true,
command: true,
embed: true,
hr: true,
img: true,
input: true,
keygen: true,
link: true,
menuitem: true,
meta: true,
param: true,
source: true,
track: true,
wbr: true
};
LiteParser.PCDATA = {
option: true,
textarea: true,
fieldset: true,
title: true,
style: true,
script: true
};
LiteParser.CDATA_ATTR = {
style: true,
datafld: true,
datasrc: true,
href: true,
src: true,
longdesc: true,
usemap: true,
cite: true,
datetime: true,
action: true,
axis: true,
profile: true,
content: true,
scheme: true
};
return LiteParser;
}());
exports.LiteParser = LiteParser;
//# sourceMappingURL=Parser.js.map

File diff suppressed because one or more lines are too long

10
node_modules/mathjax-full/js/adaptors/lite/Text.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import { LiteElement } from './Element.js';
export declare class LiteText {
value: string;
parent: LiteElement;
get kind(): string;
constructor(text?: string);
}
export declare class LiteComment extends LiteText {
get kind(): string;
}

49
node_modules/mathjax-full/js/adaptors/lite/Text.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiteComment = exports.LiteText = void 0;
var LiteText = (function () {
function LiteText(text) {
if (text === void 0) { text = ''; }
this.value = text;
}
Object.defineProperty(LiteText.prototype, "kind", {
get: function () {
return '#text';
},
enumerable: false,
configurable: true
});
return LiteText;
}());
exports.LiteText = LiteText;
var LiteComment = (function (_super) {
__extends(LiteComment, _super);
function LiteComment() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(LiteComment.prototype, "kind", {
get: function () {
return '#comment';
},
enumerable: false,
configurable: true
});
return LiteComment;
}(LiteText));
exports.LiteComment = LiteComment;
//# sourceMappingURL=Text.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../ts/adaptors/lite/Text.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA6BA;IAsBE,kBAAY,IAAiB;QAAjB,qBAAA,EAAA,SAAiB;QAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAVD,sBAAW,0BAAI;aAAf;YACE,OAAO,OAAO,CAAC;QACjB,CAAC;;;OAAA;IASH,eAAC;AAAD,CAAC,AAzBD,IAyBC;AAzBY,4BAAQ;AA+BrB;IAAiC,+BAAQ;IAAzC;;IAIA,CAAC;IAHC,sBAAW,6BAAI;aAAf;YACE,OAAO,UAAU,CAAC;QACpB,CAAC;;;OAAA;IACH,kBAAC;AAAD,CAAC,AAJD,CAAiC,QAAQ,GAIxC;AAJY,kCAAW"}

14
node_modules/mathjax-full/js/adaptors/lite/Window.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import { LiteElement } from './Element.js';
import { LiteDocument } from './Document.js';
import { LiteList } from './List.js';
import { LiteParser } from './Parser.js';
export declare class LiteWindow {
document: LiteDocument;
DOMParser: typeof LiteParser;
NodeList: typeof LiteList;
HTMLCollection: typeof LiteList;
HTMLElement: typeof LiteElement;
DocumentFragment: typeof LiteList;
Document: typeof LiteDocument;
constructor();
}

21
node_modules/mathjax-full/js/adaptors/lite/Window.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiteWindow = void 0;
var Element_js_1 = require("./Element.js");
var Document_js_1 = require("./Document.js");
var List_js_1 = require("./List.js");
var Parser_js_1 = require("./Parser.js");
var LiteWindow = (function () {
function LiteWindow() {
this.DOMParser = Parser_js_1.LiteParser;
this.NodeList = List_js_1.LiteList;
this.HTMLCollection = List_js_1.LiteList;
this.HTMLElement = Element_js_1.LiteElement;
this.DocumentFragment = List_js_1.LiteList;
this.Document = Document_js_1.LiteDocument;
this.document = new Document_js_1.LiteDocument();
}
return LiteWindow;
}());
exports.LiteWindow = LiteWindow;
//# sourceMappingURL=Window.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Window.js","sourceRoot":"","sources":["../../../ts/adaptors/lite/Window.ts"],"names":[],"mappings":";;;AAuBA,2CAAyC;AACzC,6CAA2C;AAC3C,qCAAmC;AACnC,yCAAuC;AAMvC;IAiCE;QAzBO,cAAS,GAAsB,sBAAU,CAAC;QAI1C,aAAQ,GAAoB,kBAAQ,CAAC;QAIrC,mBAAc,GAAoB,kBAAQ,CAAC;QAI3C,gBAAW,GAAuB,wBAAW,CAAC;QAI9C,qBAAgB,GAAqB,kBAAQ,CAAC;QAI9C,aAAQ,GAAyB,0BAAY,CAAC;QAMnD,IAAI,CAAC,QAAQ,GAAG,IAAI,0BAAY,EAAE,CAAC;IACrC,CAAC;IACH,iBAAC;AAAD,CAAC,AApCD,IAoCC;AApCY,gCAAU"}

77
node_modules/mathjax-full/js/adaptors/liteAdaptor.d.ts generated vendored Normal file
View File

@@ -0,0 +1,77 @@
import { AbstractDOMAdaptor } from '../core/DOMAdaptor.js';
import { Constructor } from './NodeMixin.js';
import { LiteDocument } from './lite/Document.js';
import { LiteElement, LiteNode } from './lite/Element.js';
import { LiteText, LiteComment } from './lite/Text.js';
import { LiteWindow } from './lite/Window.js';
import { LiteParser } from './lite/Parser.js';
import { OptionList } from '../util/Options.js';
export declare class LiteBase extends AbstractDOMAdaptor<LiteElement, LiteText, LiteDocument> {
document: LiteDocument;
window: LiteWindow;
parser: LiteParser;
constructor();
parse(text: string, format?: string): LiteDocument;
protected create(kind: string, _ns?: string): LiteElement;
text(text: string): LiteText;
comment(text: string): LiteComment;
createDocument(): LiteDocument;
head(doc: LiteDocument): LiteElement;
body(doc: LiteDocument): LiteElement;
root(doc: LiteDocument): LiteElement;
doctype(doc: LiteDocument): string;
tags(node: LiteElement, name: string, ns?: string): LiteElement[];
elementById(node: LiteElement, id: string): LiteElement;
elementsByClass(node: LiteElement, name: string): LiteElement[];
getElements(nodes: (string | LiteElement | LiteElement[])[], document: LiteDocument): LiteElement[];
contains(container: LiteNode, node: LiteNode | LiteText): boolean;
parent(node: LiteNode): LiteElement;
childIndex(node: LiteNode): number;
append(node: LiteElement, child: LiteNode): LiteNode;
insert(nchild: LiteNode, ochild: LiteNode): void;
remove(child: LiteNode): LiteNode;
replace(nnode: LiteNode, onode: LiteNode): LiteNode;
clone(node: LiteElement): LiteElement;
split(node: LiteText, n: number): LiteText;
next(node: LiteNode): LiteNode;
previous(node: LiteNode): LiteNode;
firstChild(node: LiteElement): LiteNode;
lastChild(node: LiteElement): LiteNode;
childNodes(node: LiteElement): LiteNode[];
childNode(node: LiteElement, i: number): LiteNode;
kind(node: LiteNode): string;
value(node: LiteNode | LiteText): string;
textContent(node: LiteElement): string;
innerHTML(node: LiteElement): string;
outerHTML(node: LiteElement): string;
serializeXML(node: LiteElement): string;
setAttribute(node: LiteElement, name: string, value: string | number, ns?: string): void;
getAttribute(node: LiteElement, name: string): any;
removeAttribute(node: LiteElement, name: string): void;
hasAttribute(node: LiteElement, name: string): boolean;
allAttributes(node: LiteElement): {
name: string;
value: string;
}[];
addClass(node: LiteElement, name: string): void;
removeClass(node: LiteElement, name: string): void;
hasClass(node: LiteElement, name: string): boolean;
setStyle(node: LiteElement, name: string, value: string): void;
getStyle(node: LiteElement, name: string): string;
allStyles(node: LiteElement): any;
insertRules(node: LiteElement, rules: string[]): void;
fontSize(_node: LiteElement): number;
fontFamily(_node: LiteElement): string;
nodeSize(_node: LiteElement, _em?: number, _local?: boolean): [number, number];
nodeBBox(_node: LiteElement): {
left: number;
right: number;
top: number;
bottom: number;
};
}
declare const LiteAdaptor_base: Constructor<LiteBase>;
export declare class LiteAdaptor extends LiteAdaptor_base {
}
export declare function liteAdaptor(options?: OptionList): LiteAdaptor;
export {};

445
node_modules/mathjax-full/js/adaptors/liteAdaptor.js generated vendored Normal file
View File

@@ -0,0 +1,445 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.liteAdaptor = exports.LiteAdaptor = exports.LiteBase = void 0;
var DOMAdaptor_js_1 = require("../core/DOMAdaptor.js");
var NodeMixin_js_1 = require("./NodeMixin.js");
var Document_js_1 = require("./lite/Document.js");
var Element_js_1 = require("./lite/Element.js");
var Text_js_1 = require("./lite/Text.js");
var Window_js_1 = require("./lite/Window.js");
var Parser_js_1 = require("./lite/Parser.js");
var Styles_js_1 = require("../util/Styles.js");
var LiteBase = (function (_super) {
__extends(LiteBase, _super);
function LiteBase() {
var _this = _super.call(this) || this;
_this.parser = new Parser_js_1.LiteParser();
_this.window = new Window_js_1.LiteWindow();
return _this;
}
LiteBase.prototype.parse = function (text, format) {
return this.parser.parseFromString(text, format, this);
};
LiteBase.prototype.create = function (kind, _ns) {
if (_ns === void 0) { _ns = null; }
return new Element_js_1.LiteElement(kind);
};
LiteBase.prototype.text = function (text) {
return new Text_js_1.LiteText(text);
};
LiteBase.prototype.comment = function (text) {
return new Text_js_1.LiteComment(text);
};
LiteBase.prototype.createDocument = function () {
return new Document_js_1.LiteDocument();
};
LiteBase.prototype.head = function (doc) {
return doc.head;
};
LiteBase.prototype.body = function (doc) {
return doc.body;
};
LiteBase.prototype.root = function (doc) {
return doc.root;
};
LiteBase.prototype.doctype = function (doc) {
return doc.type;
};
LiteBase.prototype.tags = function (node, name, ns) {
if (ns === void 0) { ns = null; }
var stack = [];
var tags = [];
if (ns) {
return tags;
}
var n = node;
while (n) {
var kind = n.kind;
if (kind !== '#text' && kind !== '#comment') {
n = n;
if (kind === name) {
tags.push(n);
}
if (n.children.length) {
stack = n.children.concat(stack);
}
}
n = stack.shift();
}
return tags;
};
LiteBase.prototype.elementById = function (node, id) {
var stack = [];
var n = node;
while (n) {
if (n.kind !== '#text' && n.kind !== '#comment') {
n = n;
if (n.attributes['id'] === id) {
return n;
}
if (n.children.length) {
stack = n.children.concat(stack);
}
}
n = stack.shift();
}
return null;
};
LiteBase.prototype.elementsByClass = function (node, name) {
var stack = [];
var tags = [];
var n = node;
while (n) {
if (n.kind !== '#text' && n.kind !== '#comment') {
n = n;
var classes = (n.attributes['class'] || '').trim().split(/ +/);
if (classes.includes(name)) {
tags.push(n);
}
if (n.children.length) {
stack = n.children.concat(stack);
}
}
n = stack.shift();
}
return tags;
};
LiteBase.prototype.getElements = function (nodes, document) {
var e_1, _a;
var containers = [];
var body = this.body(document);
try {
for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
var node = nodes_1_1.value;
if (typeof (node) === 'string') {
if (node.charAt(0) === '#') {
var n = this.elementById(body, node.slice(1));
if (n) {
containers.push(n);
}
}
else if (node.charAt(0) === '.') {
containers = containers.concat(this.elementsByClass(body, node.slice(1)));
}
else if (node.match(/^[-a-z][-a-z0-9]*$/i)) {
containers = containers.concat(this.tags(body, node));
}
}
else if (Array.isArray(node)) {
containers = containers.concat(node);
}
else if (node instanceof this.window.NodeList || node instanceof this.window.HTMLCollection) {
containers = containers.concat(node.nodes);
}
else {
containers.push(node);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
}
finally { if (e_1) throw e_1.error; }
}
return containers;
};
LiteBase.prototype.contains = function (container, node) {
while (node && node !== container) {
node = this.parent(node);
}
return !!node;
};
LiteBase.prototype.parent = function (node) {
return node.parent;
};
LiteBase.prototype.childIndex = function (node) {
return (node.parent ? node.parent.children.findIndex(function (n) { return n === node; }) : -1);
};
LiteBase.prototype.append = function (node, child) {
if (child.parent) {
this.remove(child);
}
node.children.push(child);
child.parent = node;
return child;
};
LiteBase.prototype.insert = function (nchild, ochild) {
if (nchild.parent) {
this.remove(nchild);
}
if (ochild && ochild.parent) {
var i = this.childIndex(ochild);
ochild.parent.children.splice(i, 0, nchild);
nchild.parent = ochild.parent;
}
};
LiteBase.prototype.remove = function (child) {
var i = this.childIndex(child);
if (i >= 0) {
child.parent.children.splice(i, 1);
}
child.parent = null;
return child;
};
LiteBase.prototype.replace = function (nnode, onode) {
var i = this.childIndex(onode);
if (i >= 0) {
onode.parent.children[i] = nnode;
nnode.parent = onode.parent;
onode.parent = null;
}
return onode;
};
LiteBase.prototype.clone = function (node) {
var _this = this;
var nnode = new Element_js_1.LiteElement(node.kind);
nnode.attributes = __assign({}, node.attributes);
nnode.children = node.children.map(function (n) {
if (n.kind === '#text') {
return new Text_js_1.LiteText(n.value);
}
else if (n.kind === '#comment') {
return new Text_js_1.LiteComment(n.value);
}
else {
var m = _this.clone(n);
m.parent = nnode;
return m;
}
});
return nnode;
};
LiteBase.prototype.split = function (node, n) {
var text = new Text_js_1.LiteText(node.value.slice(n));
node.value = node.value.slice(0, n);
node.parent.children.splice(this.childIndex(node) + 1, 0, text);
text.parent = node.parent;
return text;
};
LiteBase.prototype.next = function (node) {
var parent = node.parent;
if (!parent)
return null;
var i = this.childIndex(node) + 1;
return (i >= 0 && i < parent.children.length ? parent.children[i] : null);
};
LiteBase.prototype.previous = function (node) {
var parent = node.parent;
if (!parent)
return null;
var i = this.childIndex(node) - 1;
return (i >= 0 ? parent.children[i] : null);
};
LiteBase.prototype.firstChild = function (node) {
return node.children[0];
};
LiteBase.prototype.lastChild = function (node) {
return node.children[node.children.length - 1];
};
LiteBase.prototype.childNodes = function (node) {
return __spreadArray([], __read(node.children), false);
};
LiteBase.prototype.childNode = function (node, i) {
return node.children[i];
};
LiteBase.prototype.kind = function (node) {
return node.kind;
};
LiteBase.prototype.value = function (node) {
return (node.kind === '#text' ? node.value :
node.kind === '#comment' ? node.value.replace(/^<!(--)?((?:.|\n)*)\1>$/, '$2') : '');
};
LiteBase.prototype.textContent = function (node) {
var _this = this;
return node.children.reduce(function (s, n) {
return s + (n.kind === '#text' ? n.value :
n.kind === '#comment' ? '' : _this.textContent(n));
}, '');
};
LiteBase.prototype.innerHTML = function (node) {
return this.parser.serializeInner(this, node);
};
LiteBase.prototype.outerHTML = function (node) {
return this.parser.serialize(this, node);
};
LiteBase.prototype.serializeXML = function (node) {
return this.parser.serialize(this, node, true);
};
LiteBase.prototype.setAttribute = function (node, name, value, ns) {
if (ns === void 0) { ns = null; }
if (typeof value !== 'string') {
value = String(value);
}
if (ns) {
name = ns.replace(/.*\//, '') + ':' + name.replace(/^.*:/, '');
}
node.attributes[name] = value;
if (name === 'style') {
node.styles = null;
}
};
LiteBase.prototype.getAttribute = function (node, name) {
return node.attributes[name];
};
LiteBase.prototype.removeAttribute = function (node, name) {
delete node.attributes[name];
};
LiteBase.prototype.hasAttribute = function (node, name) {
return node.attributes.hasOwnProperty(name);
};
LiteBase.prototype.allAttributes = function (node) {
var e_2, _a;
var attributes = node.attributes;
var list = [];
try {
for (var _b = __values(Object.keys(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
var name_1 = _c.value;
list.push({ name: name_1, value: attributes[name_1] });
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
return list;
};
LiteBase.prototype.addClass = function (node, name) {
var classes = (node.attributes['class'] || '').split(/ /);
if (!classes.find(function (n) { return n === name; })) {
classes.push(name);
node.attributes['class'] = classes.join(' ');
}
};
LiteBase.prototype.removeClass = function (node, name) {
var classes = (node.attributes['class'] || '').split(/ /);
var i = classes.findIndex(function (n) { return n === name; });
if (i >= 0) {
classes.splice(i, 1);
node.attributes['class'] = classes.join(' ');
}
};
LiteBase.prototype.hasClass = function (node, name) {
var classes = (node.attributes['class'] || '').split(/ /);
return !!classes.find(function (n) { return n === name; });
};
LiteBase.prototype.setStyle = function (node, name, value) {
if (!node.styles) {
node.styles = new Styles_js_1.Styles(this.getAttribute(node, 'style'));
}
node.styles.set(name, value);
node.attributes['style'] = node.styles.cssText;
};
LiteBase.prototype.getStyle = function (node, name) {
if (!node.styles) {
var style = this.getAttribute(node, 'style');
if (!style) {
return '';
}
node.styles = new Styles_js_1.Styles(style);
}
return node.styles.get(name);
};
LiteBase.prototype.allStyles = function (node) {
return this.getAttribute(node, 'style');
};
LiteBase.prototype.insertRules = function (node, rules) {
node.children = [this.text(rules.join('\n\n') + '\n\n' + this.textContent(node))];
};
LiteBase.prototype.fontSize = function (_node) {
return 0;
};
LiteBase.prototype.fontFamily = function (_node) {
return '';
};
LiteBase.prototype.nodeSize = function (_node, _em, _local) {
if (_em === void 0) { _em = 1; }
if (_local === void 0) { _local = null; }
return [0, 0];
};
LiteBase.prototype.nodeBBox = function (_node) {
return { left: 0, right: 0, top: 0, bottom: 0 };
};
return LiteBase;
}(DOMAdaptor_js_1.AbstractDOMAdaptor));
exports.LiteBase = LiteBase;
var LiteAdaptor = (function (_super) {
__extends(LiteAdaptor, _super);
function LiteAdaptor() {
return _super !== null && _super.apply(this, arguments) || this;
}
return LiteAdaptor;
}((0, NodeMixin_js_1.NodeMixin)(LiteBase)));
exports.LiteAdaptor = LiteAdaptor;
function liteAdaptor(options) {
if (options === void 0) { options = null; }
return new LiteAdaptor(null, options);
}
exports.liteAdaptor = liteAdaptor;
//# sourceMappingURL=liteAdaptor.js.map

File diff suppressed because one or more lines are too long