@opensystemslab/map 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -4
- package/dist/component-lib.es.js +1 -1
- package/dist/component-lib.umd.js +321 -88
- package/dist/{html2canvas.esm-f5b1510b.mjs → html2canvas.esm-1a1724a1.mjs} +1750 -1357
- package/dist/index-c7aa277b.mjs +47112 -0
- package/dist/{index.es-15046b1b.mjs → index.es-f278d6d5.mjs} +1265 -1112
- package/dist/index.html +104 -71
- package/dist/{purify.es-22c1781a.mjs → purify.es-00aa4070.mjs} +28 -8
- package/dist/style.css +1 -1
- package/package.json +22 -25
- package/types/components/address-autocomplete/index.d.ts +3 -3
- package/types/components/my-map/drawing.d.ts +2 -2
- package/types/components/my-map/index.d.ts +8 -2
- package/types/components/my-map/projections.d.ts +1 -1
- package/types/components/my-map/utils.d.ts +1 -1
- package/types/lib/ordnanceSurvey.d.ts +1 -1
- package/dist/index-8d60c5e4.mjs +0 -37564
package/dist/index.html
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="en">
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
<!-- <style>
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8" />
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7
|
+
<title>OS Web Components Sandbox</title>
|
8
|
+
<script type="module" src="component-lib.es.js"></script>
|
9
|
+
<!-- OS vector tile source specifies fonts in .pbf format, which OpenLayers can't load, so make them available directly -->
|
10
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
11
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
12
|
+
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600&display=swap"
|
13
|
+
rel="stylesheet" />
|
14
|
+
<!-- Examples of available style options for postcode-search & address-autocomplete -->
|
15
|
+
<!-- <style>
|
17
16
|
address-autocomplete {
|
18
17
|
--autocomplete__label__font-size: 25px;
|
19
18
|
--autocomplete__input__padding: 6px 40px 7px 12px;
|
@@ -38,18 +37,21 @@
|
|
38
37
|
--postcode__input__height: 60px;
|
39
38
|
}
|
40
39
|
</style> -->
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
<
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
40
|
+
</head>
|
41
|
+
|
42
|
+
<body style="font-family:Inter,Helvetica,sans-serif;">
|
43
|
+
<div style="display:flex;flex-direction:column;">
|
44
|
+
<h1 style="color:red;font-size:16px;">*** This is a testing sandbox - these components are unaware of each other!
|
45
|
+
***</h1>
|
46
|
+
<div style="margin-bottom:1em">
|
47
|
+
<my-map zoom="20" maxZoom="23" id="example-map" drawMode useScaleBarStyle showScale showNorthArrow showPrint
|
48
|
+
osProxyEndpoint="https://api.editor.planx.dev/proxy/ordnance-survey" />
|
49
|
+
</div>
|
50
|
+
<div style="margin-bottom:1em">
|
51
|
+
<postcode-search hintText="Optional hint text shows up here" id="example-postcode" />
|
52
|
+
</div>
|
53
|
+
<div style="margin-bottom:1em; background-color: white;">
|
54
|
+
<!--
|
53
55
|
Examples (as of March 2022):
|
54
56
|
SE5 OHU (Southwark): default/"standard" postcode example, fetches 65 LPI addresses
|
55
57
|
SE19 1NT (Lambeth): 56 DPA addresses -> 128 LPI addresses (87 "approved"), now requires paginated fetch
|
@@ -59,58 +61,89 @@
|
|
59
61
|
Example with default value (used for planx "change" & "back" button behavior):
|
60
62
|
<address-autocomplete postcode="SE5 0HU" id="example-autocomplete" initialAddress="75, COBOURG ROAD, LONDON" />
|
61
63
|
-->
|
62
|
-
|
63
|
-
</div>
|
64
|
+
<address-autocomplete postcode="SE5 0HU" id="example-autocomplete" arrowStyle="light" labelStyle="static" />
|
64
65
|
</div>
|
65
|
-
|
66
|
-
|
67
|
-
|
66
|
+
</div>
|
67
|
+
<script>
|
68
|
+
// --- MAP --- //
|
69
|
+
const map = document.querySelector("my-map");
|
70
|
+
map.clipGeojsonData = {
|
71
|
+
"type": "Feature",
|
72
|
+
"geometry": {
|
73
|
+
"type": "Polygon",
|
74
|
+
"coordinates": [
|
75
|
+
[
|
76
|
+
[
|
77
|
+
-0.128307852848053,
|
78
|
+
51.50748361634746
|
79
|
+
],
|
80
|
+
[
|
81
|
+
-0.1274388171272278,
|
82
|
+
51.50773069282454
|
83
|
+
],
|
84
|
+
[
|
85
|
+
-0.12710085879135133,
|
86
|
+
51.507243216327
|
87
|
+
],
|
88
|
+
[
|
89
|
+
-0.12802890311050416,
|
90
|
+
51.50705957656797
|
91
|
+
],
|
92
|
+
[
|
93
|
+
-0.128307852848053,
|
94
|
+
51.50748361634746
|
95
|
+
]
|
96
|
+
]
|
97
|
+
]
|
98
|
+
},
|
99
|
+
};
|
100
|
+
|
101
|
+
map.addEventListener("ready", (event) => {
|
102
|
+
console.log("map ready");
|
103
|
+
});
|
68
104
|
|
69
|
-
|
70
|
-
|
71
|
-
});
|
105
|
+
// applicable when drawMode is enabled
|
106
|
+
map.addEventListener("areaChange", ({ detail: area }) => {
|
107
|
+
console.debug({ area });
|
108
|
+
});
|
109
|
+
map.addEventListener("geojsonChange", ({ detail: geojson }) => {
|
110
|
+
console.debug({ geojson });
|
111
|
+
});
|
72
112
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
113
|
+
// applicable when showFeaturesAtPoint is enabled
|
114
|
+
map.addEventListener("featuresAreaChange", ({ detail: featuresArea }) => {
|
115
|
+
console.debug({ featuresArea });
|
116
|
+
});
|
117
|
+
map.addEventListener("featuresGeojsonChange", ({ detail: featuresGeojson }) => {
|
118
|
+
console.debug({ featuresGeojson });
|
119
|
+
});
|
80
120
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
map.addEventListener("featuresGeojsonChange", ({ detail: featuresGeojson }) => {
|
86
|
-
console.debug({ featuresGeojson });
|
87
|
-
});
|
121
|
+
// applicable when geojsonData is provided
|
122
|
+
map.addEventListener("geojsonDataArea", ({ detail: geojsonDataArea }) => {
|
123
|
+
console.debug({ geojsonDataArea });
|
124
|
+
});
|
88
125
|
|
89
|
-
|
90
|
-
|
91
|
-
console.debug({ geojsonDataArea });
|
92
|
-
});
|
126
|
+
// --- POSTCODE SEARCH --- //
|
127
|
+
const search = document.querySelector("postcode-search");
|
93
128
|
|
94
|
-
|
95
|
-
|
129
|
+
search.addEventListener("postcodeChange", ({ detail }) => {
|
130
|
+
console.debug({ detail });
|
131
|
+
});
|
96
132
|
|
97
|
-
|
98
|
-
|
99
|
-
});
|
133
|
+
// --- ADDRESS AUTOCOMPLETE --- //
|
134
|
+
const autocomplete = document.querySelector("address-autocomplete");
|
100
135
|
|
101
|
-
|
102
|
-
|
136
|
+
autocomplete.addEventListener("ready", ({ detail: data }) => {
|
137
|
+
console.log("autocomplete ready", { data });
|
138
|
+
});
|
103
139
|
|
104
|
-
|
105
|
-
|
106
|
-
})
|
140
|
+
autocomplete.addEventListener(
|
141
|
+
"addressSelection",
|
142
|
+
({ detail: address }) => {
|
143
|
+
console.debug({ detail: address });
|
144
|
+
}
|
145
|
+
);
|
146
|
+
</script>
|
147
|
+
</body>
|
107
148
|
|
108
|
-
|
109
|
-
"addressSelection",
|
110
|
-
({ detail: address }) => {
|
111
|
-
console.debug({ detail: address });
|
112
|
-
}
|
113
|
-
);
|
114
|
-
</script>
|
115
|
-
</body>
|
116
|
-
</html>
|
149
|
+
</html>
|
@@ -1,4 +1,6 @@
|
|
1
|
+
/*! @license DOMPurify 2.4.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.3/LICENSE */
|
1
2
|
function C(r) {
|
3
|
+
"@babel/helpers - typeof";
|
2
4
|
return C = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
3
5
|
return typeof n;
|
4
6
|
} : function(n) {
|
@@ -42,7 +44,7 @@ function Ut(r) {
|
|
42
44
|
return Array.from(r);
|
43
45
|
}
|
44
46
|
function Ht(r, n) {
|
45
|
-
if (
|
47
|
+
if (r) {
|
46
48
|
if (typeof r == "string")
|
47
49
|
return Pe(r, n);
|
48
50
|
var o = Object.prototype.toString.call(r).slice(8, -1);
|
@@ -126,8 +128,10 @@ function ne(r, n) {
|
|
126
128
|
}
|
127
129
|
var st = A(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), we = A(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Ie = A(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Zt = A(["animate", "color-profile", "cursor", "discard", "fedropshadow", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Ce = A(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]), Jt = A(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), ut = A(["#text"]), ft = A(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]), xe = A(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), ct = A(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), ie = A(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Qt = R(/\{\{[\w\W]*|[\w\W]*\}\}/gm), er = R(/<%[\w\W]*|[\w\W]*%>/gm), tr = R(/\${[\w\W]*}/gm), rr = R(/^data-[\-\w.\u00B7-\uFFFF]/), ar = R(/^aria-[\-\w]+$/), nr = R(
|
128
130
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
131
|
+
// eslint-disable-line no-useless-escape
|
129
132
|
), ir = R(/^(?:\w+script|data):/i), or = R(
|
130
133
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
134
|
+
// eslint-disable-line no-control-regex
|
131
135
|
), lr = R(/^html$/i), sr = function() {
|
132
136
|
return typeof window > "u" ? null : window;
|
133
137
|
}, ur = function(n, o) {
|
@@ -189,14 +193,21 @@ function pt() {
|
|
189
193
|
})), j = null, he = null, Be = !0, _e = !0, We = !1, F = !1, x = !1, Ae = !1, Ee = !1, U = !1, J = !1, Q = !1, $e = !0, je = !1, Nt = "user-content-", ye = !0, Y = !1, H = {}, z = null, Ye = l({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]), Ve = null, Xe = l({}, ["audio", "video", "img", "source", "image", "track"]), ge = null, qe = l({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ee = "http://www.w3.org/1998/Math/MathML", te = "http://www.w3.org/2000/svg", M = "http://www.w3.org/1999/xhtml", G = M, be = !1, Se = null, Dt = l({}, [ee, te, M], Le), k, Lt = ["application/xhtml+xml", "text/html"], Mt = "text/html", p, B = null, wt = s.createElement("form"), Ke = function(e) {
|
190
194
|
return e instanceof RegExp || e instanceof Function;
|
191
195
|
}, Re = function(e) {
|
192
|
-
B && B === e || ((!e || C(e) !== "object") && (e = {}), e = P(e), k =
|
196
|
+
B && B === e || ((!e || C(e) !== "object") && (e = {}), e = P(e), k = // eslint-disable-next-line unicorn/prefer-includes
|
197
|
+
Lt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? k = Mt : k = e.PARSER_MEDIA_TYPE, p = k === "application/xhtml+xml" ? Le : le, m = "ALLOWED_TAGS" in e ? l({}, e.ALLOWED_TAGS, p) : ze, v = "ALLOWED_ATTR" in e ? l({}, e.ALLOWED_ATTR, p) : Ge, Se = "ALLOWED_NAMESPACES" in e ? l({}, e.ALLOWED_NAMESPACES, Le) : Dt, ge = "ADD_URI_SAFE_ATTR" in e ? l(
|
193
198
|
P(qe),
|
199
|
+
// eslint-disable-line indent
|
194
200
|
e.ADD_URI_SAFE_ATTR,
|
201
|
+
// eslint-disable-line indent
|
195
202
|
p
|
203
|
+
// eslint-disable-line indent
|
196
204
|
) : qe, Ve = "ADD_DATA_URI_TAGS" in e ? l(
|
197
205
|
P(Xe),
|
206
|
+
// eslint-disable-line indent
|
198
207
|
e.ADD_DATA_URI_TAGS,
|
208
|
+
// eslint-disable-line indent
|
199
209
|
p
|
210
|
+
// eslint-disable-line indent
|
200
211
|
) : Xe, z = "FORBID_CONTENTS" in e ? l({}, e.FORBID_CONTENTS, p) : Ye, j = "FORBID_TAGS" in e ? l({}, e.FORBID_TAGS, p) : {}, he = "FORBID_ATTR" in e ? l({}, e.FORBID_ATTR, p) : {}, H = "USE_PROFILES" in e ? e.USE_PROFILES : !1, Be = e.ALLOW_ARIA_ATTR !== !1, _e = e.ALLOW_DATA_ATTR !== !1, We = e.ALLOW_UNKNOWN_PROTOCOLS || !1, F = e.SAFE_FOR_TEMPLATES || !1, x = e.WHOLE_DOCUMENT || !1, U = e.RETURN_DOM || !1, J = e.RETURN_DOM_FRAGMENT || !1, Q = e.RETURN_TRUSTED_TYPE || !1, Ee = e.FORCE_BODY || !1, $e = e.SANITIZE_DOM !== !1, je = e.SANITIZE_NAMED_PROPS || !1, ye = e.KEEP_CONTENT !== !1, Y = e.IN_PLACE || !1, Te = e.ALLOWED_URI_REGEXP || Te, G = e.NAMESPACE || M, e.CUSTOM_ELEMENT_HANDLING && Ke(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (c.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && Ke(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (c.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (c.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), F && (_e = !1), J && (U = !0), H && (m = l({}, S(ut)), v = [], H.html === !0 && (l(m, st), l(v, ft)), H.svg === !0 && (l(m, we), l(v, xe), l(v, ie)), H.svgFilters === !0 && (l(m, Ie), l(v, xe), l(v, ie)), H.mathMl === !0 && (l(m, Ce), l(v, ct), l(v, ie))), e.ADD_TAGS && (m === ze && (m = P(m)), l(m, e.ADD_TAGS, p)), e.ADD_ATTR && (v === Ge && (v = P(v)), l(v, e.ADD_ATTR, p)), e.ADD_URI_SAFE_ATTR && l(ge, e.ADD_URI_SAFE_ATTR, p), e.FORBID_CONTENTS && (z === Ye && (z = P(z)), l(z, e.FORBID_CONTENTS, p)), ye && (m["#text"] = !0), x && l(m, ["html", "head", "body"]), m.table && (l(m, ["tbody"]), delete j.tbody), A && A(e), B = e);
|
201
212
|
}, Ze = l({}, ["mi", "mo", "mn", "ms", "mtext"]), Je = l({}, ["foreignobject", "desc", "title", "annotation-xml"]), It = l({}, ["title", "style", "font", "a", "script"]), re = l({}, we);
|
202
213
|
l(re, Ie), l(re, Zt);
|
@@ -209,7 +220,7 @@ function pt() {
|
|
209
220
|
tagName: "template"
|
210
221
|
});
|
211
222
|
var a = le(e.tagName), u = le(t.tagName);
|
212
|
-
return Se[e.namespaceURI] ? e.namespaceURI === te ? t.namespaceURI === M ? a === "svg" : t.namespaceURI === ee ? a === "svg" && (u === "annotation-xml" || Ze[u]) :
|
223
|
+
return Se[e.namespaceURI] ? e.namespaceURI === te ? t.namespaceURI === M ? a === "svg" : t.namespaceURI === ee ? a === "svg" && (u === "annotation-xml" || Ze[u]) : !!re[a] : e.namespaceURI === ee ? t.namespaceURI === M ? a === "math" : t.namespaceURI === te ? a === "math" && Je[u] : !!Oe[a] : e.namespaceURI === M ? t.namespaceURI === te && !Je[u] || t.namespaceURI === ee && !Ze[u] ? !1 : !Oe[a] && (It[a] || !re[a]) : !!(k === "application/xhtml+xml" && Se[e.namespaceURI]) : !1;
|
213
224
|
}, w = function(e) {
|
214
225
|
X(n.removed, {
|
215
226
|
element: e
|
@@ -274,6 +285,7 @@ function pt() {
|
|
274
285
|
return Et.call(
|
275
286
|
e.ownerDocument || e,
|
276
287
|
e,
|
288
|
+
// eslint-disable-next-line no-bitwise
|
277
289
|
W.SHOW_ELEMENT | W.SHOW_COMMENT | W.SHOW_TEXT,
|
278
290
|
null,
|
279
291
|
!1
|
@@ -283,7 +295,7 @@ function pt() {
|
|
283
295
|
}, V = function(e) {
|
284
296
|
return C(L) === "object" ? e instanceof L : e && C(e) === "object" && typeof e.nodeType == "number" && typeof e.nodeName == "string";
|
285
297
|
}, I = function(e, t, a) {
|
286
|
-
|
298
|
+
D[e] && Yt(D[e], function(u) {
|
287
299
|
u.call(n, t, a, B);
|
288
300
|
});
|
289
301
|
}, tt = function(e) {
|
@@ -316,7 +328,14 @@ function pt() {
|
|
316
328
|
if (!(_e && !he[t] && _(St, t))) {
|
317
329
|
if (!(Be && _(Rt, t))) {
|
318
330
|
if (!v[t] || he[t]) {
|
319
|
-
if (
|
331
|
+
if (
|
332
|
+
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
333
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
334
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
335
|
+
!(at(e) && (c.tagNameCheck instanceof RegExp && _(c.tagNameCheck, e) || c.tagNameCheck instanceof Function && c.tagNameCheck(e)) && (c.attributeNameCheck instanceof RegExp && _(c.attributeNameCheck, t) || c.attributeNameCheck instanceof Function && c.attributeNameCheck(t)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
336
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
337
|
+
t === "is" && c.allowCustomizedBuiltInElements && (c.tagNameCheck instanceof RegExp && _(c.tagNameCheck, a) || c.tagNameCheck instanceof Function && c.tagNameCheck(a)))
|
338
|
+
)
|
320
339
|
return !1;
|
321
340
|
} else if (!ge[t]) {
|
322
341
|
if (!_(Te, b(a, He, ""))) {
|
@@ -337,7 +356,7 @@ function pt() {
|
|
337
356
|
var t, a, u, E;
|
338
357
|
I("beforeSanitizeAttributes", e, null);
|
339
358
|
var h = e.attributes;
|
340
|
-
if (
|
359
|
+
if (h) {
|
341
360
|
var T = {
|
342
361
|
attrName: "",
|
343
362
|
attrValue: "",
|
@@ -354,7 +373,7 @@ function pt() {
|
|
354
373
|
}
|
355
374
|
F && (a = b(a, pe, " "), a = b(a, de, " "), a = b(a, ve, " "));
|
356
375
|
var it = p(e.nodeName);
|
357
|
-
if (
|
376
|
+
if (rt(it, u, a)) {
|
358
377
|
if (je && (u === "id" || u === "name") && (Ne(d, e), a = Nt + a), g && C(q) === "object" && typeof q.getAttributeType == "function" && !De)
|
359
378
|
switch (q.getAttributeType(it, u)) {
|
360
379
|
case "TrustedHTML":
|
@@ -405,7 +424,8 @@ function pt() {
|
|
405
424
|
} else if (i instanceof L)
|
406
425
|
t = Qe("<!---->"), a = t.ownerDocument.importNode(i, !0), a.nodeType === 1 && a.nodeName === "BODY" || a.nodeName === "HTML" ? t = a : t.appendChild(a);
|
407
426
|
else {
|
408
|
-
if (!U && !F && !x &&
|
427
|
+
if (!U && !F && !x && // eslint-disable-next-line unicorn/prefer-includes
|
428
|
+
i.indexOf("<") === -1)
|
409
429
|
return g && Q ? g.createHTML(i) : i;
|
410
430
|
if (t = Qe(i), !t)
|
411
431
|
return U ? null : Q ? ce : "";
|