progress on migrating to heex templates and font-icons

This commit is contained in:
Adam Piontek 2022-08-13 07:32:36 -04:00
parent d43daafdb7
commit 3eff955672
21793 changed files with 2161968 additions and 16895 deletions

11
assets_old/node_modules/dom-serializer/LICENSE generated vendored Normal file
View 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
assets_old/node_modules/dom-serializer/README.md generated vendored Normal file
View file

@ -0,0 +1 @@
Renders a DOM node or an array of DOM nodes to a string.

View file

@ -0,0 +1,102 @@
{
"elementNames" : {
"altglyph" : "altGlyph",
"altglyphdef" : "altGlyphDef",
"altglyphitem" : "altGlyphItem",
"animatecolor" : "animateColor",
"animatemotion" : "animateMotion",
"animatetransform" : "animateTransform",
"clippath" : "clipPath",
"feblend" : "feBlend",
"fecolormatrix" : "feColorMatrix",
"fecomponenttransfer" : "feComponentTransfer",
"fecomposite" : "feComposite",
"feconvolvematrix" : "feConvolveMatrix",
"fediffuselighting" : "feDiffuseLighting",
"fedisplacementmap" : "feDisplacementMap",
"fedistantlight" : "feDistantLight",
"fedropshadow" : "feDropShadow",
"feflood" : "feFlood",
"fefunca" : "feFuncA",
"fefuncb" : "feFuncB",
"fefuncg" : "feFuncG",
"fefuncr" : "feFuncR",
"fegaussianblur" : "feGaussianBlur",
"feimage" : "feImage",
"femerge" : "feMerge",
"femergenode" : "feMergeNode",
"femorphology" : "feMorphology",
"feoffset" : "feOffset",
"fepointlight" : "fePointLight",
"fespecularlighting" : "feSpecularLighting",
"fespotlight" : "feSpotLight",
"fetile" : "feTile",
"feturbulence" : "feTurbulence",
"foreignobject" : "foreignObject",
"glyphref" : "glyphRef",
"lineargradient" : "linearGradient",
"radialgradient" : "radialGradient",
"textpath" : "textPath"
},
"attributeNames" : {
"definitionurl" : "definitionURL",
"attributename" : "attributeName",
"attributetype" : "attributeType",
"basefrequency" : "baseFrequency",
"baseprofile" : "baseProfile",
"calcmode" : "calcMode",
"clippathunits" : "clipPathUnits",
"diffuseconstant" : "diffuseConstant",
"edgemode" : "edgeMode",
"filterunits" : "filterUnits",
"glyphref" : "glyphRef",
"gradienttransform" : "gradientTransform",
"gradientunits" : "gradientUnits",
"kernelmatrix" : "kernelMatrix",
"kernelunitlength" : "kernelUnitLength",
"keypoints" : "keyPoints",
"keysplines" : "keySplines",
"keytimes" : "keyTimes",
"lengthadjust" : "lengthAdjust",
"limitingconeangle" : "limitingConeAngle",
"markerheight" : "markerHeight",
"markerunits" : "markerUnits",
"markerwidth" : "markerWidth",
"maskcontentunits" : "maskContentUnits",
"maskunits" : "maskUnits",
"numoctaves" : "numOctaves",
"pathlength" : "pathLength",
"patterncontentunits" : "patternContentUnits",
"patterntransform" : "patternTransform",
"patternunits" : "patternUnits",
"pointsatx" : "pointsAtX",
"pointsaty" : "pointsAtY",
"pointsatz" : "pointsAtZ",
"preservealpha" : "preserveAlpha",
"preserveaspectratio" : "preserveAspectRatio",
"primitiveunits" : "primitiveUnits",
"refx" : "refX",
"refy" : "refY",
"repeatcount" : "repeatCount",
"repeatdur" : "repeatDur",
"requiredextensions" : "requiredExtensions",
"requiredfeatures" : "requiredFeatures",
"specularconstant" : "specularConstant",
"specularexponent" : "specularExponent",
"spreadmethod" : "spreadMethod",
"startoffset" : "startOffset",
"stddeviation" : "stdDeviation",
"stitchtiles" : "stitchTiles",
"surfacescale" : "surfaceScale",
"systemlanguage" : "systemLanguage",
"tablevalues" : "tableValues",
"targetx" : "targetX",
"targety" : "targetY",
"textlength" : "textLength",
"viewbox" : "viewBox",
"viewtarget" : "viewTarget",
"xchannelselector" : "xChannelSelector",
"ychannelselector" : "yChannelSelector",
"zoomandpan" : "zoomAndPan"
}
}

17
assets_old/node_modules/dom-serializer/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,17 @@
export interface DomSerializerOptions {
xmlMode?: boolean | 'foreign';
decodeEntities?: boolean;
}
/**
* 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 nodes Nodes to be rendered.
* @param options Changes serialization behavior
*/
export default function render(
nodes: {} | {}[],
options?: DomSerializerOptions
): string;

183
assets_old/node_modules/dom-serializer/index.js generated vendored Normal file
View file

@ -0,0 +1,183 @@
/*
Module dependencies
*/
var ElementType = require('domelementtype');
var entities = 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 = require('./foreignNames.json');
foreignNames.elementNames.__proto__ = null; /* use as a simple dictionary */
foreignNames.attributeNames.__proto__ = null;
var unencodedElements = {
__proto__: null,
style: true,
script: true,
xmp: true,
iframe: true,
noembed: true,
noframes: true,
plaintext: true,
noscript: true
};
/*
Format attributes
*/
function formatAttrs(attributes, opts) {
if (!attributes) return;
var output = '';
var value;
// Loop through the attributes
for (var key in attributes) {
value = attributes[key];
if (output) {
output += ' ';
}
if (opts.xmlMode === 'foreign') {
/* fix up mixed-case attribute names */
key = foreignNames.attributeNames[key] || key;
}
output += key;
if ((value !== null && value !== '') || opts.xmlMode) {
output +=
'="' +
(opts.decodeEntities
? entities.encodeXML(value)
: value.replace(/\"/g, '"')) +
'"';
}
}
return output;
}
/*
Self-enclosing tags (stolen from node-htmlparser)
*/
var singleTag = {
__proto__: null,
area: true,
base: true,
basefont: true,
br: true,
col: true,
command: true,
embed: true,
frame: true,
hr: true,
img: true,
input: true,
isindex: true,
keygen: true,
link: true,
meta: true,
param: true,
source: true,
track: true,
wbr: true
};
var render = (module.exports = function(dom, opts) {
if (!Array.isArray(dom) && !dom.cheerio) dom = [dom];
opts = opts || {};
var output = '';
for (var i = 0; i < dom.length; i++) {
var elem = dom[i];
if (elem.type === 'root') output += render(elem.children, opts);
else if (ElementType.isTag(elem)) output += renderTag(elem, opts);
else if (elem.type === ElementType.Directive)
output += renderDirective(elem);
else if (elem.type === ElementType.Comment) output += renderComment(elem);
else if (elem.type === ElementType.CDATA) output += renderCdata(elem);
else output += renderText(elem, opts);
}
return output;
});
var foreignModeIntegrationPoints = [
'mi',
'mo',
'mn',
'ms',
'mtext',
'annotation-xml',
'foreignObject',
'desc',
'title'
];
function renderTag(elem, opts) {
// Handle SVG / MathML in HTML
if (opts.xmlMode === 'foreign') {
/* fix up mixed-case element names */
elem.name = foreignNames.elementNames[elem.name] || elem.name;
/* exit foreign mode at integration points */
if (
elem.parent &&
foreignModeIntegrationPoints.indexOf(elem.parent.name) >= 0
)
opts = Object.assign({}, opts, { xmlMode: false });
}
if (!opts.xmlMode && ['svg', 'math'].indexOf(elem.name) >= 0) {
opts = Object.assign({}, opts, { xmlMode: 'foreign' });
}
var tag = '<' + elem.name;
var attribs = formatAttrs(elem.attribs, opts);
if (attribs) {
tag += ' ' + attribs;
}
if (opts.xmlMode && (!elem.children || elem.children.length === 0)) {
tag += '/>';
} else {
tag += '>';
if (elem.children) {
tag += render(elem.children, opts);
}
if (!singleTag[elem.name] || opts.xmlMode) {
tag += '</' + elem.name + '>';
}
}
return tag;
}
function renderDirective(elem) {
return '<' + elem.data + '>';
}
function renderText(elem, opts) {
var data = elem.data || '';
// if entities weren't decoded, no need to encode them back
if (
opts.decodeEntities &&
!(elem.parent && elem.parent.name in unencodedElements)
) {
data = entities.encodeXML(data);
}
return data;
}
function renderCdata(elem) {
return '<![CDATA[' + elem.children[0].data + ']]>';
}
function renderComment(elem) {
return '<!--' + elem.data + '-->';
}

View file

@ -0,0 +1,11 @@
Copyright (c) Felix Böhm
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,48 @@
/** Types of elements found in htmlparser2's DOM */
export declare const enum ElementType {
/** Type for the root element of a document */
Root = "root",
/** Type for Text */
Text = "text",
/** Type for <? ... ?> */
Directive = "directive",
/** Type for <!-- ... --> */
Comment = "comment",
/** Type for <script> tags */
Script = "script",
/** Type for <style> tags */
Style = "style",
/** Type for Any tag */
Tag = "tag",
/** Type for <![CDATA[ ... ]]> */
CDATA = "cdata",
/** Type for <!doctype ...> */
Doctype = "doctype"
}
/**
* Tests whether an element is a tag or not.
*
* @param elem Element to test
*/
export declare function isTag(elem: {
type: ElementType;
}): boolean;
/** Type for the root element of a document */
export declare const Root = ElementType.Root;
/** Type for Text */
export declare const Text = ElementType.Text;
/** Type for <? ... ?> */
export declare const Directive = ElementType.Directive;
/** Type for <!-- ... --> */
export declare const Comment = ElementType.Comment;
/** Type for <script> tags */
export declare const Script = ElementType.Script;
/** Type for <style> tags */
export declare const Style = ElementType.Style;
/** Type for Any tag */
export declare const Tag = ElementType.Tag;
/** Type for <![CDATA[ ... ]]> */
export declare const CDATA = ElementType.CDATA;
/** Type for <!doctype ...> */
export declare const Doctype = ElementType.Doctype;
//# sourceMappingURL=index.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,0BAAkB,WAAW;IACzB,8CAA8C;IAC9C,IAAI,SAAS;IACb,oBAAoB;IACpB,IAAI,SAAS;IACb,yBAAyB;IACzB,SAAS,cAAc;IACvB,4BAA4B;IAC5B,OAAO,YAAY;IACnB,6BAA6B;IAC7B,MAAM,WAAW;IACjB,4BAA4B;IAC5B,KAAK,UAAU;IACf,uBAAuB;IACvB,GAAG,QAAQ;IACX,iCAAiC;IACjC,KAAK,UAAU;IACf,8BAA8B;IAC9B,OAAO,YAAY;CACtB;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG,OAAO,CAM1D;AAGD,8CAA8C;AAC9C,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,oBAAoB;AACpB,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,yBAAyB;AACzB,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAC/C,4BAA4B;AAC5B,eAAO,MAAM,OAAO,sBAAsB,CAAC;AAC3C,6BAA6B;AAC7B,eAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,4BAA4B;AAC5B,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,uBAAuB;AACvB,eAAO,MAAM,GAAG,kBAAkB,CAAC;AACnC,iCAAiC;AACjC,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,8BAA8B;AAC9B,eAAO,MAAM,OAAO,sBAAsB,CAAC"}

View file

@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Doctype = exports.CDATA = exports.Tag = exports.Style = exports.Script = exports.Comment = exports.Directive = exports.Text = exports.Root = exports.isTag = void 0;
/**
* Tests whether an element is a tag or not.
*
* @param elem Element to test
*/
function isTag(elem) {
return (elem.type === "tag" /* Tag */ ||
elem.type === "script" /* Script */ ||
elem.type === "style" /* Style */);
}
exports.isTag = isTag;
// Exports for backwards compatibility
/** Type for the root element of a document */
exports.Root = "root" /* Root */;
/** Type for Text */
exports.Text = "text" /* Text */;
/** Type for <? ... ?> */
exports.Directive = "directive" /* Directive */;
/** Type for <!-- ... --> */
exports.Comment = "comment" /* Comment */;
/** Type for <script> tags */
exports.Script = "script" /* Script */;
/** Type for <style> tags */
exports.Style = "style" /* Style */;
/** Type for Any tag */
exports.Tag = "tag" /* Tag */;
/** Type for <![CDATA[ ... ]]> */
exports.CDATA = "cdata" /* CDATA */;
/** Type for <!doctype ...> */
exports.Doctype = "doctype" /* Doctype */;

View file

@ -0,0 +1,45 @@
{
"name": "domelementtype",
"version": "2.1.0",
"description": "all the types of nodes in htmlparser2's dom",
"author": "Felix Boehm <me@feedic.com>",
"license": "BSD-2-Clause",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/fb55"
}
],
"sideEffects": false,
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib/**/*"
],
"repository": {
"type": "git",
"url": "git://github.com/fb55/domelementtype.git"
},
"keywords": [
"dom",
"htmlparser2"
],
"scripts": {
"test": "npm run lint && prettier --check **/*.{ts,json,md}",
"lint": "eslint src",
"format": "prettier --write **/*.{ts,json,md}",
"build": "tsc",
"prepare": "npm run build"
},
"prettier": {
"tabWidth": 4
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
"eslint": "^7.9.0",
"eslint-config-prettier": "^6.0.0",
"prettier": "^2.1.1",
"typescript": "^4.0.2"
}
}

View file

@ -0,0 +1 @@
All the types of nodes in htmlparser2's DOM.

View file

@ -0,0 +1,11 @@
Copyright (c) Felix Böhm
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,5 @@
export declare const decodeXML: (str: string) => string;
export declare const decodeHTMLStrict: (str: string) => string;
export declare type MapType = Record<string, string>;
export declare const decodeHTML: (str: string) => string;
//# sourceMappingURL=decode.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../src/decode.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS,QAOL,MAAM,WAP0B,CAAC;AAClD,eAAO,MAAM,gBAAgB,QAMZ,MAAM,WANoC,CAAC;AAE5D,oBAAY,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAS7C,eAAO,MAAM,UAAU,QAyBN,MAAM,WACnB,CAAC"}

View file

@ -0,0 +1,53 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeHTML = exports.decodeHTMLStrict = exports.decodeXML = void 0;
var entities_json_1 = __importDefault(require("./maps/entities.json"));
var legacy_json_1 = __importDefault(require("./maps/legacy.json"));
var xml_json_1 = __importDefault(require("./maps/xml.json"));
var decode_codepoint_1 = __importDefault(require("./decode_codepoint"));
var strictEntityRe = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;
exports.decodeXML = getStrictDecoder(xml_json_1.default);
exports.decodeHTMLStrict = getStrictDecoder(entities_json_1.default);
function getStrictDecoder(map) {
var replace = getReplacer(map);
return function (str) { return String(str).replace(strictEntityRe, replace); };
}
var sorter = function (a, b) { return (a < b ? 1 : -1); };
exports.decodeHTML = (function () {
var legacy = Object.keys(legacy_json_1.default).sort(sorter);
var keys = Object.keys(entities_json_1.default).sort(sorter);
for (var i = 0, j = 0; i < keys.length; i++) {
if (legacy[j] === keys[i]) {
keys[i] += ";?";
j++;
}
else {
keys[i] += ";";
}
}
var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g");
var replace = getReplacer(entities_json_1.default);
function replacer(str) {
if (str.substr(-1) !== ";")
str += ";";
return replace(str);
}
// TODO consider creating a merged map
return function (str) { return String(str).replace(re, replacer); };
})();
function getReplacer(map) {
return function replace(str) {
if (str.charAt(1) === "#") {
var secondChar = str.charAt(2);
if (secondChar === "X" || secondChar === "x") {
return decode_codepoint_1.default(parseInt(str.substr(3), 16));
}
return decode_codepoint_1.default(parseInt(str.substr(2), 10));
}
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
return map[str.slice(1, -1)] || str;
};
}

View file

@ -0,0 +1,2 @@
export default function decodeCodePoint(codePoint: number): string;
//# sourceMappingURL=decode_codepoint.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"decode_codepoint.d.ts","sourceRoot":"","sources":["../src/decode_codepoint.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAUjE"}

View file

@ -0,0 +1,30 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var decode_json_1 = __importDefault(require("./maps/decode.json"));
// Adapted from https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119
var fromCodePoint =
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
String.fromCodePoint ||
function (codePoint) {
var output = "";
if (codePoint > 0xffff) {
codePoint -= 0x10000;
output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800);
codePoint = 0xdc00 | (codePoint & 0x3ff);
}
output += String.fromCharCode(codePoint);
return output;
};
function decodeCodePoint(codePoint) {
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
return "\uFFFD";
}
if (codePoint in decode_json_1.default) {
codePoint = decode_json_1.default[codePoint];
}
return fromCodePoint(codePoint);
}
exports.default = decodeCodePoint;

View file

@ -0,0 +1,47 @@
/**
* Encodes all non-ASCII characters, as well as characters not valid in XML
* documents using XML entities.
*
* If a character has no equivalent entity, a
* numeric hexadecimal reference (eg. `&#xfc;`) will be used.
*/
export declare const encodeXML: (data: string) => string;
/**
* Encodes all entities and non-ASCII characters in the input.
*
* This includes characters that are valid ASCII characters in HTML documents.
* For example `#` will be encoded as `&num;`. To get a more compact output,
* consider using the `encodeNonAsciiHTML` function.
*
* If a character has no equivalent entity, a
* numeric hexadecimal reference (eg. `&#xfc;`) will be used.
*/
export declare const encodeHTML: (data: string) => string;
/**
* Encodes all non-ASCII characters, as well as characters not valid in HTML
* documents using HTML entities.
*
* If a character has no equivalent entity, a
* numeric hexadecimal reference (eg. `&#xfc;`) will be used.
*/
export declare const encodeNonAsciiHTML: (data: string) => string;
/**
* Encodes all non-ASCII characters, as well as characters not valid in XML
* documents using numeric hexadecimal reference (eg. `&#xfc;`).
*
* Have a look at `escapeUTF8` if you want a more concise output at the expense
* of reduced transportability.
*
* @param data String to escape.
*/
export declare function escape(data: string): string;
/**
* Encodes all characters not valid in XML documents using numeric hexadecimal
* reference (eg. `&#xfc;`).
*
* Note that the output will be character-set dependent.
*
* @param data String to escape.
*/
export declare function escapeUTF8(data: string): string;
//# sourceMappingURL=encode.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../src/encode.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,SAwIJ,MAAM,WAxI4B,CAAC;AAOrD;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,SAkFL,MAAM,WAlFuC,CAAC;AAChE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,SA+Gb,MAAM,WA/GsC,CAAC;AAqF/D;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C"}

View file

@ -0,0 +1,136 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = void 0;
var xml_json_1 = __importDefault(require("./maps/xml.json"));
var inverseXML = getInverseObj(xml_json_1.default);
var xmlReplacer = getInverseReplacer(inverseXML);
/**
* Encodes all non-ASCII characters, as well as characters not valid in XML
* documents using XML entities.
*
* If a character has no equivalent entity, a
* numeric hexadecimal reference (eg. `&#xfc;`) will be used.
*/
exports.encodeXML = getASCIIEncoder(inverseXML);
var entities_json_1 = __importDefault(require("./maps/entities.json"));
var inverseHTML = getInverseObj(entities_json_1.default);
var htmlReplacer = getInverseReplacer(inverseHTML);
/**
* Encodes all entities and non-ASCII characters in the input.
*
* This includes characters that are valid ASCII characters in HTML documents.
* For example `#` will be encoded as `&num;`. To get a more compact output,
* consider using the `encodeNonAsciiHTML` function.
*
* If a character has no equivalent entity, a
* numeric hexadecimal reference (eg. `&#xfc;`) will be used.
*/
exports.encodeHTML = getInverse(inverseHTML, htmlReplacer);
/**
* Encodes all non-ASCII characters, as well as characters not valid in HTML
* documents using HTML entities.
*
* If a character has no equivalent entity, a
* numeric hexadecimal reference (eg. `&#xfc;`) will be used.
*/
exports.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML);
function getInverseObj(obj) {
return Object.keys(obj)
.sort()
.reduce(function (inverse, name) {
inverse[obj[name]] = "&" + name + ";";
return inverse;
}, {});
}
function getInverseReplacer(inverse) {
var single = [];
var multiple = [];
for (var _i = 0, _a = Object.keys(inverse); _i < _a.length; _i++) {
var k = _a[_i];
if (k.length === 1) {
// Add value to single array
single.push("\\" + k);
}
else {
// Add value to multiple array
multiple.push(k);
}
}
// Add ranges to single characters.
single.sort();
for (var start = 0; start < single.length - 1; start++) {
// Find the end of a run of characters
var end = start;
while (end < single.length - 1 &&
single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) {
end += 1;
}
var count = 1 + end - start;
// We want to replace at least three characters
if (count < 3)
continue;
single.splice(start, count, single[start] + "-" + single[end]);
}
multiple.unshift("[" + single.join("") + "]");
return new RegExp(multiple.join("|"), "g");
}
// /[^\0-\x7F]/gu
var reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g;
var getCodePoint =
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
String.prototype.codePointAt != null
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
function (str) { return str.codePointAt(0); }
: // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
function (c) {
return (c.charCodeAt(0) - 0xd800) * 0x400 +
c.charCodeAt(1) -
0xdc00 +
0x10000;
};
function singleCharReplacer(c) {
return "&#x" + (c.length > 1 ? getCodePoint(c) : c.charCodeAt(0))
.toString(16)
.toUpperCase() + ";";
}
function getInverse(inverse, re) {
return function (data) {
return data
.replace(re, function (name) { return inverse[name]; })
.replace(reNonASCII, singleCharReplacer);
};
}
var reEscapeChars = new RegExp(xmlReplacer.source + "|" + reNonASCII.source, "g");
/**
* Encodes all non-ASCII characters, as well as characters not valid in XML
* documents using numeric hexadecimal reference (eg. `&#xfc;`).
*
* Have a look at `escapeUTF8` if you want a more concise output at the expense
* of reduced transportability.
*
* @param data String to escape.
*/
function escape(data) {
return data.replace(reEscapeChars, singleCharReplacer);
}
exports.escape = escape;
/**
* Encodes all characters not valid in XML documents using numeric hexadecimal
* reference (eg. `&#xfc;`).
*
* Note that the output will be character-set dependent.
*
* @param data String to escape.
*/
function escapeUTF8(data) {
return data.replace(xmlReplacer, singleCharReplacer);
}
exports.escapeUTF8 = escapeUTF8;
function getASCIIEncoder(obj) {
return function (data) {
return data.replace(reEscapeChars, function (c) { return obj[c] || singleCharReplacer(c); });
};
}

View file

@ -0,0 +1,27 @@
/**
* Decodes a string with entities.
*
* @param data String to decode.
* @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
* @deprecated Use `decodeXML` or `decodeHTML` directly.
*/
export declare function decode(data: string, level?: number): string;
/**
* Decodes a string with entities. Does not allow missing trailing semicolons for entities.
*
* @param data String to decode.
* @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
* @deprecated Use `decodeHTMLStrict` or `decodeXML` directly.
*/
export declare function decodeStrict(data: string, level?: number): string;
/**
* Encodes a string with entities.
*
* @param data String to encode.
* @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0.
* @deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly.
*/
export declare function encode(data: string, level?: number): string;
export { encodeXML, encodeHTML, encodeNonAsciiHTML, escape, escapeUTF8, encodeHTML as encodeHTML4, encodeHTML as encodeHTML5, } from "./encode";
export { decodeXML, decodeHTML, decodeHTMLStrict, decodeHTML as decodeHTML4, decodeHTML as decodeHTML5, decodeHTMLStrict as decodeHTML4Strict, decodeHTMLStrict as decodeHTML5Strict, decodeXML as decodeXMLStrict, } from "./decode";
//# sourceMappingURL=index.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,OAAO,EACH,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,MAAM,EACN,UAAU,EAEV,UAAU,IAAI,WAAW,EACzB,UAAU,IAAI,WAAW,GAC5B,MAAM,UAAU,CAAC;AAElB,OAAO,EACH,SAAS,EACT,UAAU,EACV,gBAAgB,EAEhB,UAAU,IAAI,WAAW,EACzB,UAAU,IAAI,WAAW,EACzB,gBAAgB,IAAI,iBAAiB,EACrC,gBAAgB,IAAI,iBAAiB,EACrC,SAAS,IAAI,eAAe,GAC/B,MAAM,UAAU,CAAC"}

View file

@ -0,0 +1,57 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = void 0;
var decode_1 = require("./decode");
var encode_1 = require("./encode");
/**
* Decodes a string with entities.
*
* @param data String to decode.
* @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
* @deprecated Use `decodeXML` or `decodeHTML` directly.
*/
function decode(data, level) {
return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data);
}
exports.decode = decode;
/**
* Decodes a string with entities. Does not allow missing trailing semicolons for entities.
*
* @param data String to decode.
* @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
* @deprecated Use `decodeHTMLStrict` or `decodeXML` directly.
*/
function decodeStrict(data, level) {
return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data);
}
exports.decodeStrict = decodeStrict;
/**
* Encodes a string with entities.
*
* @param data String to encode.
* @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0.
* @deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly.
*/
function encode(data, level) {
return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data);
}
exports.encode = encode;
var encode_2 = require("./encode");
Object.defineProperty(exports, "encodeXML", { enumerable: true, get: function () { return encode_2.encodeXML; } });
Object.defineProperty(exports, "encodeHTML", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
Object.defineProperty(exports, "encodeNonAsciiHTML", { enumerable: true, get: function () { return encode_2.encodeNonAsciiHTML; } });
Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return encode_2.escape; } });
Object.defineProperty(exports, "escapeUTF8", { enumerable: true, get: function () { return encode_2.escapeUTF8; } });
// Legacy aliases (deprecated)
Object.defineProperty(exports, "encodeHTML4", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
Object.defineProperty(exports, "encodeHTML5", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
var decode_2 = require("./decode");
Object.defineProperty(exports, "decodeXML", { enumerable: true, get: function () { return decode_2.decodeXML; } });
Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
Object.defineProperty(exports, "decodeHTMLStrict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
// Legacy aliases (deprecated)
Object.defineProperty(exports, "decodeHTML4", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
Object.defineProperty(exports, "decodeHTML5", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
Object.defineProperty(exports, "decodeHTML4Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
Object.defineProperty(exports, "decodeHTML5Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
Object.defineProperty(exports, "decodeXMLStrict", { enumerable: true, get: function () { return decode_2.decodeXML; } });

View file

@ -0,0 +1 @@
{"0":65533,"128":8364,"130":8218,"131":402,"132":8222,"133":8230,"134":8224,"135":8225,"136":710,"137":8240,"138":352,"139":8249,"140":338,"142":381,"145":8216,"146":8217,"147":8220,"148":8221,"149":8226,"150":8211,"151":8212,"152":732,"153":8482,"154":353,"155":8250,"156":339,"158":382,"159":376}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"Aacute":"Á","aacute":"á","Acirc":"Â","acirc":"â","acute":"´","AElig":"Æ","aelig":"æ","Agrave":"À","agrave":"à","amp":"&","AMP":"&","Aring":"Å","aring":"å","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","brvbar":"¦","Ccedil":"Ç","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","COPY":"©","curren":"¤","deg":"°","divide":"÷","Eacute":"É","eacute":"é","Ecirc":"Ê","ecirc":"ê","Egrave":"È","egrave":"è","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","GT":">","Iacute":"Í","iacute":"í","Icirc":"Î","icirc":"î","iexcl":"¡","Igrave":"Ì","igrave":"ì","iquest":"¿","Iuml":"Ï","iuml":"ï","laquo":"«","lt":"<","LT":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","Ntilde":"Ñ","ntilde":"ñ","Oacute":"Ó","oacute":"ó","Ocirc":"Ô","ocirc":"ô","Ograve":"Ò","ograve":"ò","ordf":"ª","ordm":"º","Oslash":"Ø","oslash":"ø","Otilde":"Õ","otilde":"õ","Ouml":"Ö","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\"","QUOT":"\"","raquo":"»","reg":"®","REG":"®","sect":"§","shy":"­","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","THORN":"Þ","thorn":"þ","times":"×","Uacute":"Ú","uacute":"ú","Ucirc":"Û","ucirc":"û","Ugrave":"Ù","ugrave":"ù","uml":"¨","Uuml":"Ü","uuml":"ü","Yacute":"Ý","yacute":"ý","yen":"¥","yuml":"ÿ"}

View file

@ -0,0 +1 @@
{"amp":"&","apos":"'","gt":">","lt":"<","quot":"\""}

View file

@ -0,0 +1,64 @@
{
"name": "entities",
"version": "2.2.0",
"description": "Encode & decode XML and HTML entities with ease",
"author": "Felix Boehm <me@feedic.com>",
"funding": "https://github.com/fb55/entities?sponsor=1",
"sideEffects": false,
"keywords": [
"entity",
"decoding",
"encoding",
"html",
"xml",
"html entities"
],
"directories": {
"lib": "lib/"
},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib/**/*"
],
"devDependencies": {
"@types/jest": "^26.0.0",
"@types/node": "^14.11.8",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"coveralls": "*",
"eslint": "^7.11.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-node": "^11.1.0",
"jest": "^26.5.3",
"prettier": "^2.0.5",
"ts-jest": "^26.1.0",
"typescript": "^4.0.2"
},
"scripts": {
"test": "jest --coverage && npm run lint",
"coverage": "cat coverage/lcov.info | coveralls",
"lint": "npm run lint:es && npm run lint:prettier",
"lint:es": "eslint .",
"lint:prettier": "npm run prettier -- --check",
"format": "npm run format:es && npm run format:prettier",
"format:es": "npm run lint:es -- --fix",
"format:prettier": "npm run prettier -- --write",
"prettier": "prettier '**/*.{ts,md,json,yml}'",
"build": "tsc && cp -r src/maps lib",
"prepare": "npm run build"
},
"repository": {
"type": "git",
"url": "git://github.com/fb55/entities.git"
},
"license": "BSD-2-Clause",
"jest": {
"preset": "ts-jest",
"testEnvironment": "node"
},
"prettier": {
"tabWidth": 4,
"proseWrap": "always"
}
}

View file

@ -0,0 +1,57 @@
# entities [![NPM version](http://img.shields.io/npm/v/entities.svg)](https://npmjs.org/package/entities) [![Downloads](https://img.shields.io/npm/dm/entities.svg)](https://npmjs.org/package/entities) [![Build Status](http://img.shields.io/travis/fb55/entities.svg)](http://travis-ci.org/fb55/entities) [![Coverage](http://img.shields.io/coveralls/fb55/entities.svg)](https://coveralls.io/r/fb55/entities)
Encode & decode HTML & XML entities with ease & speed.
## How to…
### …install `entities`
npm install entities
### …use `entities`
```javascript
const entities = require("entities");
//encoding
entities.escape("&#38;"); // "&#x26;#38;"
entities.encodeXML("&#38;"); // "&amp;#38;"
entities.encodeHTML("&#38;"); // "&amp;&num;38&semi;"
//decoding
entities.decodeXML("asdf &amp; &#xFF; &#xFC; &apos;"); // "asdf & ÿ ü '"
entities.decodeHTML("asdf &amp; &yuml; &uuml; &apos;"); // "asdf & ÿ ü '"
```
## Performance
This is how `entities` compares to other libraries on a very basic benchmark
(see `scripts/benchmark.ts`, for 10,000,000 iterations):
| Library | `decode` performance | `encode` performance | Bundle size |
| -------------- | -------------------- | -------------------- | -------------------------------------------------------------------------- |
| entities | 10.809s | 17.683s | ![npm bundle size](https://img.shields.io/bundlephobia/min/entities) |
| html-entities | 14.029s | 22.670s | ![npm bundle size](https://img.shields.io/bundlephobia/min/html-entities) |
| he | 16.163s | 44.010s | ![npm bundle size](https://img.shields.io/bundlephobia/min/he) |
| parse-entities | 28.507s | N/A | ![npm bundle size](https://img.shields.io/bundlephobia/min/parse-entities) |
---
License: BSD-2-Clause
## Security contact information
To report a security vulnerability, please use the
[Tidelift security contact](https://tidelift.com/security). Tidelift will
coordinate the fix and disclosure.
## `entities` for enterprise
Available as part of the Tidelift Subscription
The maintainers of `entities` and thousands of other packages are working with
Tidelift to deliver commercial support and maintenance for the open source
dependencies you use to build your applications. Save time, reduce risk, and
improve code health, while paying the maintainers of the exact dependencies you
use.
[Learn more.](https://tidelift.com/subscription/pkg/npm-entities?utm_source=npm-entities&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

40
assets_old/node_modules/dom-serializer/package.json generated vendored Normal file
View file

@ -0,0 +1,40 @@
{
"name": "dom-serializer",
"version": "0.2.2",
"description": "render dom nodes to string",
"author": "Felix Boehm <me@feedic.com>",
"keywords": [
"html",
"xml",
"render"
],
"repository": {
"type": "git",
"url": "git://github.com/cheeriojs/dom-renderer.git"
},
"main": "./index.js",
"files": [
"index.js",
"index.d.ts",
"foreignNames.json"
],
"dependencies": {
"domelementtype": "^2.0.1",
"entities": "^2.0.0"
},
"devDependencies": {
"cheerio": "^1.0.0-rc.2",
"expect.js": "~0.3.1",
"htmlparser2": "^3.10.0",
"lodash": "^4.17.11",
"mocha": "^6.2.0",
"xyz": "^3.0.0"
},
"scripts": {
"test": "mocha test.js"
},
"prettier": {
"singleQuote": true
},
"license": "MIT"
}