Initial
This commit is contained in:
11
resources/app/node_modules/dom-serializer/LICENSE
generated
vendored
Normal file
11
resources/app/node_modules/dom-serializer/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 The cheeriojs contributors
|
||||
|
||||
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.
|
||||
1
resources/app/node_modules/dom-serializer/lib/esm/foreignNames.d.ts.map
generated
vendored
Normal file
1
resources/app/node_modules/dom-serializer/lib/esm/foreignNames.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"foreignNames.d.ts","sourceRoot":"","sources":["../../src/foreignNames.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,qBAwCxB,CAAC;AACF,eAAO,MAAM,cAAc,qBA8D1B,CAAC"}
|
||||
100
resources/app/node_modules/dom-serializer/lib/esm/foreignNames.js
generated
vendored
Normal file
100
resources/app/node_modules/dom-serializer/lib/esm/foreignNames.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
export const elementNames = new Map([
|
||||
"altGlyph",
|
||||
"altGlyphDef",
|
||||
"altGlyphItem",
|
||||
"animateColor",
|
||||
"animateMotion",
|
||||
"animateTransform",
|
||||
"clipPath",
|
||||
"feBlend",
|
||||
"feColorMatrix",
|
||||
"feComponentTransfer",
|
||||
"feComposite",
|
||||
"feConvolveMatrix",
|
||||
"feDiffuseLighting",
|
||||
"feDisplacementMap",
|
||||
"feDistantLight",
|
||||
"feDropShadow",
|
||||
"feFlood",
|
||||
"feFuncA",
|
||||
"feFuncB",
|
||||
"feFuncG",
|
||||
"feFuncR",
|
||||
"feGaussianBlur",
|
||||
"feImage",
|
||||
"feMerge",
|
||||
"feMergeNode",
|
||||
"feMorphology",
|
||||
"feOffset",
|
||||
"fePointLight",
|
||||
"feSpecularLighting",
|
||||
"feSpotLight",
|
||||
"feTile",
|
||||
"feTurbulence",
|
||||
"foreignObject",
|
||||
"glyphRef",
|
||||
"linearGradient",
|
||||
"radialGradient",
|
||||
"textPath",
|
||||
].map((val) => [val.toLowerCase(), val]));
|
||||
export const attributeNames = new Map([
|
||||
"definitionURL",
|
||||
"attributeName",
|
||||
"attributeType",
|
||||
"baseFrequency",
|
||||
"baseProfile",
|
||||
"calcMode",
|
||||
"clipPathUnits",
|
||||
"diffuseConstant",
|
||||
"edgeMode",
|
||||
"filterUnits",
|
||||
"glyphRef",
|
||||
"gradientTransform",
|
||||
"gradientUnits",
|
||||
"kernelMatrix",
|
||||
"kernelUnitLength",
|
||||
"keyPoints",
|
||||
"keySplines",
|
||||
"keyTimes",
|
||||
"lengthAdjust",
|
||||
"limitingConeAngle",
|
||||
"markerHeight",
|
||||
"markerUnits",
|
||||
"markerWidth",
|
||||
"maskContentUnits",
|
||||
"maskUnits",
|
||||
"numOctaves",
|
||||
"pathLength",
|
||||
"patternContentUnits",
|
||||
"patternTransform",
|
||||
"patternUnits",
|
||||
"pointsAtX",
|
||||
"pointsAtY",
|
||||
"pointsAtZ",
|
||||
"preserveAlpha",
|
||||
"preserveAspectRatio",
|
||||
"primitiveUnits",
|
||||
"refX",
|
||||
"refY",
|
||||
"repeatCount",
|
||||
"repeatDur",
|
||||
"requiredExtensions",
|
||||
"requiredFeatures",
|
||||
"specularConstant",
|
||||
"specularExponent",
|
||||
"spreadMethod",
|
||||
"startOffset",
|
||||
"stdDeviation",
|
||||
"stitchTiles",
|
||||
"surfaceScale",
|
||||
"systemLanguage",
|
||||
"tableValues",
|
||||
"targetX",
|
||||
"targetY",
|
||||
"textLength",
|
||||
"viewBox",
|
||||
"viewTarget",
|
||||
"xChannelSelector",
|
||||
"yChannelSelector",
|
||||
"zoomAndPan",
|
||||
].map((val) => [val.toLowerCase(), val]));
|
||||
1
resources/app/node_modules/dom-serializer/lib/esm/index.d.ts.map
generated
vendored
Normal file
1
resources/app/node_modules/dom-serializer/lib/esm/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA4ED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,EAClC,OAAO,GAAE,oBAAyB,GACjC,MAAM,CAUR;AAED,eAAe,MAAM,CAAC"}
|
||||
190
resources/app/node_modules/dom-serializer/lib/esm/index.js
generated
vendored
Normal file
190
resources/app/node_modules/dom-serializer/lib/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Module dependencies
|
||||
*/
|
||||
import * as ElementType from "domelementtype";
|
||||
import { encodeXML, escapeAttribute, escapeText } from "entities";
|
||||
/**
|
||||
* Mixed-case SVG and MathML tags & attributes
|
||||
* recognized by the HTML parser.
|
||||
*
|
||||
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
|
||||
*/
|
||||
import { elementNames, attributeNames } from "./foreignNames.js";
|
||||
const unencodedElements = new Set([
|
||||
"style",
|
||||
"script",
|
||||
"xmp",
|
||||
"iframe",
|
||||
"noembed",
|
||||
"noframes",
|
||||
"plaintext",
|
||||
"noscript",
|
||||
]);
|
||||
function replaceQuotes(value) {
|
||||
return value.replace(/"/g, """);
|
||||
}
|
||||
/**
|
||||
* Format attributes
|
||||
*/
|
||||
function formatAttributes(attributes, opts) {
|
||||
var _a;
|
||||
if (!attributes)
|
||||
return;
|
||||
const encode = ((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) === false
|
||||
? replaceQuotes
|
||||
: opts.xmlMode || opts.encodeEntities !== "utf8"
|
||||
? encodeXML
|
||||
: escapeAttribute;
|
||||
return Object.keys(attributes)
|
||||
.map((key) => {
|
||||
var _a, _b;
|
||||
const value = (_a = attributes[key]) !== null && _a !== void 0 ? _a : "";
|
||||
if (opts.xmlMode === "foreign") {
|
||||
/* Fix up mixed-case attribute names */
|
||||
key = (_b = attributeNames.get(key)) !== null && _b !== void 0 ? _b : key;
|
||||
}
|
||||
if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
|
||||
return key;
|
||||
}
|
||||
return `${key}="${encode(value)}"`;
|
||||
})
|
||||
.join(" ");
|
||||
}
|
||||
/**
|
||||
* Self-enclosing tags
|
||||
*/
|
||||
const singleTag = new Set([
|
||||
"area",
|
||||
"base",
|
||||
"basefont",
|
||||
"br",
|
||||
"col",
|
||||
"command",
|
||||
"embed",
|
||||
"frame",
|
||||
"hr",
|
||||
"img",
|
||||
"input",
|
||||
"isindex",
|
||||
"keygen",
|
||||
"link",
|
||||
"meta",
|
||||
"param",
|
||||
"source",
|
||||
"track",
|
||||
"wbr",
|
||||
]);
|
||||
/**
|
||||
* Renders a DOM node or an array of DOM nodes to a string.
|
||||
*
|
||||
* Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
|
||||
*
|
||||
* @param node Node to be rendered.
|
||||
* @param options Changes serialization behavior
|
||||
*/
|
||||
export function render(node, options = {}) {
|
||||
const nodes = "length" in node ? node : [node];
|
||||
let output = "";
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
output += renderNode(nodes[i], options);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
export default render;
|
||||
function renderNode(node, options) {
|
||||
switch (node.type) {
|
||||
case ElementType.Root:
|
||||
return render(node.children, options);
|
||||
// @ts-expect-error We don't use `Doctype` yet
|
||||
case ElementType.Doctype:
|
||||
case ElementType.Directive:
|
||||
return renderDirective(node);
|
||||
case ElementType.Comment:
|
||||
return renderComment(node);
|
||||
case ElementType.CDATA:
|
||||
return renderCdata(node);
|
||||
case ElementType.Script:
|
||||
case ElementType.Style:
|
||||
case ElementType.Tag:
|
||||
return renderTag(node, options);
|
||||
case ElementType.Text:
|
||||
return renderText(node, options);
|
||||
}
|
||||
}
|
||||
const foreignModeIntegrationPoints = new Set([
|
||||
"mi",
|
||||
"mo",
|
||||
"mn",
|
||||
"ms",
|
||||
"mtext",
|
||||
"annotation-xml",
|
||||
"foreignObject",
|
||||
"desc",
|
||||
"title",
|
||||
]);
|
||||
const foreignElements = new Set(["svg", "math"]);
|
||||
function renderTag(elem, opts) {
|
||||
var _a;
|
||||
// Handle SVG / MathML in HTML
|
||||
if (opts.xmlMode === "foreign") {
|
||||
/* Fix up mixed-case element names */
|
||||
elem.name = (_a = elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name;
|
||||
/* Exit foreign mode at integration points */
|
||||
if (elem.parent &&
|
||||
foreignModeIntegrationPoints.has(elem.parent.name)) {
|
||||
opts = { ...opts, xmlMode: false };
|
||||
}
|
||||
}
|
||||
if (!opts.xmlMode && foreignElements.has(elem.name)) {
|
||||
opts = { ...opts, xmlMode: "foreign" };
|
||||
}
|
||||
let tag = `<${elem.name}`;
|
||||
const attribs = formatAttributes(elem.attribs, opts);
|
||||
if (attribs) {
|
||||
tag += ` ${attribs}`;
|
||||
}
|
||||
if (elem.children.length === 0 &&
|
||||
(opts.xmlMode
|
||||
? // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags
|
||||
opts.selfClosingTags !== false
|
||||
: // User explicitly asked for self-closing tags, even in HTML mode
|
||||
opts.selfClosingTags && singleTag.has(elem.name))) {
|
||||
if (!opts.xmlMode)
|
||||
tag += " ";
|
||||
tag += "/>";
|
||||
}
|
||||
else {
|
||||
tag += ">";
|
||||
if (elem.children.length > 0) {
|
||||
tag += render(elem.children, opts);
|
||||
}
|
||||
if (opts.xmlMode || !singleTag.has(elem.name)) {
|
||||
tag += `</${elem.name}>`;
|
||||
}
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
function renderDirective(elem) {
|
||||
return `<${elem.data}>`;
|
||||
}
|
||||
function renderText(elem, opts) {
|
||||
var _a;
|
||||
let data = elem.data || "";
|
||||
// If entities weren't decoded, no need to encode them back
|
||||
if (((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) !== false &&
|
||||
!(!opts.xmlMode &&
|
||||
elem.parent &&
|
||||
unencodedElements.has(elem.parent.name))) {
|
||||
data =
|
||||
opts.xmlMode || opts.encodeEntities !== "utf8"
|
||||
? encodeXML(data)
|
||||
: escapeText(data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
function renderCdata(elem) {
|
||||
return `<![CDATA[${elem.children[0].data}]]>`;
|
||||
}
|
||||
function renderComment(elem) {
|
||||
return `<!--${elem.data}-->`;
|
||||
}
|
||||
1
resources/app/node_modules/dom-serializer/lib/esm/package.json
generated
vendored
Normal file
1
resources/app/node_modules/dom-serializer/lib/esm/package.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"type":"module"}
|
||||
1
resources/app/node_modules/dom-serializer/lib/foreignNames.d.ts.map
generated
vendored
Normal file
1
resources/app/node_modules/dom-serializer/lib/foreignNames.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"foreignNames.d.ts","sourceRoot":"","sources":["../src/foreignNames.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,qBAwCxB,CAAC;AACF,eAAO,MAAM,cAAc,qBA8D1B,CAAC"}
|
||||
103
resources/app/node_modules/dom-serializer/lib/foreignNames.js
generated
vendored
Normal file
103
resources/app/node_modules/dom-serializer/lib/foreignNames.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.attributeNames = exports.elementNames = void 0;
|
||||
exports.elementNames = new Map([
|
||||
"altGlyph",
|
||||
"altGlyphDef",
|
||||
"altGlyphItem",
|
||||
"animateColor",
|
||||
"animateMotion",
|
||||
"animateTransform",
|
||||
"clipPath",
|
||||
"feBlend",
|
||||
"feColorMatrix",
|
||||
"feComponentTransfer",
|
||||
"feComposite",
|
||||
"feConvolveMatrix",
|
||||
"feDiffuseLighting",
|
||||
"feDisplacementMap",
|
||||
"feDistantLight",
|
||||
"feDropShadow",
|
||||
"feFlood",
|
||||
"feFuncA",
|
||||
"feFuncB",
|
||||
"feFuncG",
|
||||
"feFuncR",
|
||||
"feGaussianBlur",
|
||||
"feImage",
|
||||
"feMerge",
|
||||
"feMergeNode",
|
||||
"feMorphology",
|
||||
"feOffset",
|
||||
"fePointLight",
|
||||
"feSpecularLighting",
|
||||
"feSpotLight",
|
||||
"feTile",
|
||||
"feTurbulence",
|
||||
"foreignObject",
|
||||
"glyphRef",
|
||||
"linearGradient",
|
||||
"radialGradient",
|
||||
"textPath",
|
||||
].map(function (val) { return [val.toLowerCase(), val]; }));
|
||||
exports.attributeNames = new Map([
|
||||
"definitionURL",
|
||||
"attributeName",
|
||||
"attributeType",
|
||||
"baseFrequency",
|
||||
"baseProfile",
|
||||
"calcMode",
|
||||
"clipPathUnits",
|
||||
"diffuseConstant",
|
||||
"edgeMode",
|
||||
"filterUnits",
|
||||
"glyphRef",
|
||||
"gradientTransform",
|
||||
"gradientUnits",
|
||||
"kernelMatrix",
|
||||
"kernelUnitLength",
|
||||
"keyPoints",
|
||||
"keySplines",
|
||||
"keyTimes",
|
||||
"lengthAdjust",
|
||||
"limitingConeAngle",
|
||||
"markerHeight",
|
||||
"markerUnits",
|
||||
"markerWidth",
|
||||
"maskContentUnits",
|
||||
"maskUnits",
|
||||
"numOctaves",
|
||||
"pathLength",
|
||||
"patternContentUnits",
|
||||
"patternTransform",
|
||||
"patternUnits",
|
||||
"pointsAtX",
|
||||
"pointsAtY",
|
||||
"pointsAtZ",
|
||||
"preserveAlpha",
|
||||
"preserveAspectRatio",
|
||||
"primitiveUnits",
|
||||
"refX",
|
||||
"refY",
|
||||
"repeatCount",
|
||||
"repeatDur",
|
||||
"requiredExtensions",
|
||||
"requiredFeatures",
|
||||
"specularConstant",
|
||||
"specularExponent",
|
||||
"spreadMethod",
|
||||
"startOffset",
|
||||
"stdDeviation",
|
||||
"stitchTiles",
|
||||
"surfaceScale",
|
||||
"systemLanguage",
|
||||
"tableValues",
|
||||
"targetX",
|
||||
"targetY",
|
||||
"textLength",
|
||||
"viewBox",
|
||||
"viewTarget",
|
||||
"xChannelSelector",
|
||||
"yChannelSelector",
|
||||
"zoomAndPan",
|
||||
].map(function (val) { return [val.toLowerCase(), val]; }));
|
||||
1
resources/app/node_modules/dom-serializer/lib/index.d.ts.map
generated
vendored
Normal file
1
resources/app/node_modules/dom-serializer/lib/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA4ED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,EAClC,OAAO,GAAE,oBAAyB,GACjC,MAAM,CAUR;AAED,eAAe,MAAM,CAAC"}
|
||||
229
resources/app/node_modules/dom-serializer/lib/index.js
generated
vendored
Normal file
229
resources/app/node_modules/dom-serializer/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
"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 __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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.render = void 0;
|
||||
/*
|
||||
* Module dependencies
|
||||
*/
|
||||
var ElementType = __importStar(require("domelementtype"));
|
||||
var entities_1 = require("entities");
|
||||
/**
|
||||
* Mixed-case SVG and MathML tags & attributes
|
||||
* recognized by the HTML parser.
|
||||
*
|
||||
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
|
||||
*/
|
||||
var foreignNames_js_1 = require("./foreignNames.js");
|
||||
var unencodedElements = new Set([
|
||||
"style",
|
||||
"script",
|
||||
"xmp",
|
||||
"iframe",
|
||||
"noembed",
|
||||
"noframes",
|
||||
"plaintext",
|
||||
"noscript",
|
||||
]);
|
||||
function replaceQuotes(value) {
|
||||
return value.replace(/"/g, """);
|
||||
}
|
||||
/**
|
||||
* Format attributes
|
||||
*/
|
||||
function formatAttributes(attributes, opts) {
|
||||
var _a;
|
||||
if (!attributes)
|
||||
return;
|
||||
var encode = ((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) === false
|
||||
? replaceQuotes
|
||||
: opts.xmlMode || opts.encodeEntities !== "utf8"
|
||||
? entities_1.encodeXML
|
||||
: entities_1.escapeAttribute;
|
||||
return Object.keys(attributes)
|
||||
.map(function (key) {
|
||||
var _a, _b;
|
||||
var value = (_a = attributes[key]) !== null && _a !== void 0 ? _a : "";
|
||||
if (opts.xmlMode === "foreign") {
|
||||
/* Fix up mixed-case attribute names */
|
||||
key = (_b = foreignNames_js_1.attributeNames.get(key)) !== null && _b !== void 0 ? _b : key;
|
||||
}
|
||||
if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
|
||||
return key;
|
||||
}
|
||||
return "".concat(key, "=\"").concat(encode(value), "\"");
|
||||
})
|
||||
.join(" ");
|
||||
}
|
||||
/**
|
||||
* Self-enclosing tags
|
||||
*/
|
||||
var singleTag = new Set([
|
||||
"area",
|
||||
"base",
|
||||
"basefont",
|
||||
"br",
|
||||
"col",
|
||||
"command",
|
||||
"embed",
|
||||
"frame",
|
||||
"hr",
|
||||
"img",
|
||||
"input",
|
||||
"isindex",
|
||||
"keygen",
|
||||
"link",
|
||||
"meta",
|
||||
"param",
|
||||
"source",
|
||||
"track",
|
||||
"wbr",
|
||||
]);
|
||||
/**
|
||||
* Renders a DOM node or an array of DOM nodes to a string.
|
||||
*
|
||||
* Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
|
||||
*
|
||||
* @param node Node to be rendered.
|
||||
* @param options Changes serialization behavior
|
||||
*/
|
||||
function render(node, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
var nodes = "length" in node ? node : [node];
|
||||
var output = "";
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
output += renderNode(nodes[i], options);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
exports.render = render;
|
||||
exports.default = render;
|
||||
function renderNode(node, options) {
|
||||
switch (node.type) {
|
||||
case ElementType.Root:
|
||||
return render(node.children, options);
|
||||
// @ts-expect-error We don't use `Doctype` yet
|
||||
case ElementType.Doctype:
|
||||
case ElementType.Directive:
|
||||
return renderDirective(node);
|
||||
case ElementType.Comment:
|
||||
return renderComment(node);
|
||||
case ElementType.CDATA:
|
||||
return renderCdata(node);
|
||||
case ElementType.Script:
|
||||
case ElementType.Style:
|
||||
case ElementType.Tag:
|
||||
return renderTag(node, options);
|
||||
case ElementType.Text:
|
||||
return renderText(node, options);
|
||||
}
|
||||
}
|
||||
var foreignModeIntegrationPoints = new Set([
|
||||
"mi",
|
||||
"mo",
|
||||
"mn",
|
||||
"ms",
|
||||
"mtext",
|
||||
"annotation-xml",
|
||||
"foreignObject",
|
||||
"desc",
|
||||
"title",
|
||||
]);
|
||||
var foreignElements = new Set(["svg", "math"]);
|
||||
function renderTag(elem, opts) {
|
||||
var _a;
|
||||
// Handle SVG / MathML in HTML
|
||||
if (opts.xmlMode === "foreign") {
|
||||
/* Fix up mixed-case element names */
|
||||
elem.name = (_a = foreignNames_js_1.elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name;
|
||||
/* Exit foreign mode at integration points */
|
||||
if (elem.parent &&
|
||||
foreignModeIntegrationPoints.has(elem.parent.name)) {
|
||||
opts = __assign(__assign({}, opts), { xmlMode: false });
|
||||
}
|
||||
}
|
||||
if (!opts.xmlMode && foreignElements.has(elem.name)) {
|
||||
opts = __assign(__assign({}, opts), { xmlMode: "foreign" });
|
||||
}
|
||||
var tag = "<".concat(elem.name);
|
||||
var attribs = formatAttributes(elem.attribs, opts);
|
||||
if (attribs) {
|
||||
tag += " ".concat(attribs);
|
||||
}
|
||||
if (elem.children.length === 0 &&
|
||||
(opts.xmlMode
|
||||
? // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags
|
||||
opts.selfClosingTags !== false
|
||||
: // User explicitly asked for self-closing tags, even in HTML mode
|
||||
opts.selfClosingTags && singleTag.has(elem.name))) {
|
||||
if (!opts.xmlMode)
|
||||
tag += " ";
|
||||
tag += "/>";
|
||||
}
|
||||
else {
|
||||
tag += ">";
|
||||
if (elem.children.length > 0) {
|
||||
tag += render(elem.children, opts);
|
||||
}
|
||||
if (opts.xmlMode || !singleTag.has(elem.name)) {
|
||||
tag += "</".concat(elem.name, ">");
|
||||
}
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
function renderDirective(elem) {
|
||||
return "<".concat(elem.data, ">");
|
||||
}
|
||||
function renderText(elem, opts) {
|
||||
var _a;
|
||||
var data = elem.data || "";
|
||||
// If entities weren't decoded, no need to encode them back
|
||||
if (((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) !== false &&
|
||||
!(!opts.xmlMode &&
|
||||
elem.parent &&
|
||||
unencodedElements.has(elem.parent.name))) {
|
||||
data =
|
||||
opts.xmlMode || opts.encodeEntities !== "utf8"
|
||||
? (0, entities_1.encodeXML)(data)
|
||||
: (0, entities_1.escapeText)(data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
function renderCdata(elem) {
|
||||
return "<![CDATA[".concat(elem.children[0].data, "]]>");
|
||||
}
|
||||
function renderComment(elem) {
|
||||
return "<!--".concat(elem.data, "-->");
|
||||
}
|
||||
49
resources/app/node_modules/dom-serializer/package.json
generated
vendored
Normal file
49
resources/app/node_modules/dom-serializer/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "dom-serializer",
|
||||
"version": "2.0.0",
|
||||
"description": "render domhandler DOM nodes to a string",
|
||||
"author": "Felix Boehm <me@feedic.com>",
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/cheeriojs/dom-serializer.git"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"module": "lib/esm/index.js",
|
||||
"exports": {
|
||||
"require": "./lib/index.js",
|
||||
"import": "./lib/esm/index.js"
|
||||
},
|
||||
"files": [
|
||||
"lib/**/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"domelementtype": "^2.3.0",
|
||||
"domhandler": "^5.0.2",
|
||||
"entities": "^4.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "^17.0.23",
|
||||
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
||||
"@typescript-eslint/parser": "^5.18.0",
|
||||
"cheerio": "^1.0.0-rc.9",
|
||||
"eslint": "^8.12.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"htmlparser2": "^7.2.0",
|
||||
"jest": "^27.5.1",
|
||||
"prettier": "^2.6.2",
|
||||
"ts-jest": "^27.1.4",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "ts-jest",
|
||||
"testEnvironment": "node",
|
||||
"moduleNameMapper": {
|
||||
"^(.*)\\.js$": "$1"
|
||||
}
|
||||
},
|
||||
"funding": "https://github.com/cheeriojs/dom-serializer?sponsor=1",
|
||||
"license": "MIT"
|
||||
}
|
||||
Reference in New Issue
Block a user