@scratch/scratch-svg-renderer 12.1.0-localte-selection → 12.1.0-membership-program
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 +656 -7
- package/TRADEMARK +1 -0
- package/dist/node/scratch-svg-renderer.js +34278 -34209
- package/dist/node/scratch-svg-renderer.js.map +1 -1
- package/dist/web/scratch-svg-renderer.js +76 -43
- package/dist/web/scratch-svg-renderer.js.map +1 -1
- package/package.json +15 -15
- package/src/bitmap-adapter.js +4 -4
- package/src/font-converter.js +1 -1
- package/src/font-inliner.js +1 -1
- package/src/load-svg-string.js +3 -3
- package/src/sanitize-svg.js +3 -3
- package/src/svg-renderer.js +4 -4
- package/src/transform-applier.js +1 -2
|
@@ -11650,7 +11650,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"css-tree","version":"1.1.3","
|
|
|
11650
11650
|
/***/ ((module) => {
|
|
11651
11651
|
|
|
11652
11652
|
"use strict";
|
|
11653
|
-
/*! @license DOMPurify 3.
|
|
11653
|
+
/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
|
|
11654
11654
|
|
|
11655
11655
|
|
|
11656
11656
|
|
|
@@ -11681,12 +11681,18 @@ if (!seal) {
|
|
|
11681
11681
|
};
|
|
11682
11682
|
}
|
|
11683
11683
|
if (!apply) {
|
|
11684
|
-
apply = function apply(
|
|
11685
|
-
|
|
11684
|
+
apply = function apply(func, thisArg) {
|
|
11685
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
11686
|
+
args[_key - 2] = arguments[_key];
|
|
11687
|
+
}
|
|
11688
|
+
return func.apply(thisArg, args);
|
|
11686
11689
|
};
|
|
11687
11690
|
}
|
|
11688
11691
|
if (!construct) {
|
|
11689
|
-
construct = function construct(Func
|
|
11692
|
+
construct = function construct(Func) {
|
|
11693
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
11694
|
+
args[_key2 - 1] = arguments[_key2];
|
|
11695
|
+
}
|
|
11690
11696
|
return new Func(...args);
|
|
11691
11697
|
};
|
|
11692
11698
|
}
|
|
@@ -11715,8 +11721,8 @@ function unapply(func) {
|
|
|
11715
11721
|
if (thisArg instanceof RegExp) {
|
|
11716
11722
|
thisArg.lastIndex = 0;
|
|
11717
11723
|
}
|
|
11718
|
-
for (var
|
|
11719
|
-
args[
|
|
11724
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
11725
|
+
args[_key3 - 1] = arguments[_key3];
|
|
11720
11726
|
}
|
|
11721
11727
|
return apply(func, thisArg, args);
|
|
11722
11728
|
};
|
|
@@ -11727,12 +11733,12 @@ function unapply(func) {
|
|
|
11727
11733
|
* @param func - The constructor function to be wrapped and called.
|
|
11728
11734
|
* @returns A new function that constructs an instance of the given constructor function with the provided arguments.
|
|
11729
11735
|
*/
|
|
11730
|
-
function unconstruct(
|
|
11736
|
+
function unconstruct(Func) {
|
|
11731
11737
|
return function () {
|
|
11732
|
-
for (var
|
|
11733
|
-
args[
|
|
11738
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
11739
|
+
args[_key4] = arguments[_key4];
|
|
11734
11740
|
}
|
|
11735
|
-
return construct(
|
|
11741
|
+
return construct(Func, args);
|
|
11736
11742
|
};
|
|
11737
11743
|
}
|
|
11738
11744
|
/**
|
|
@@ -11831,8 +11837,8 @@ function lookupGetter(object, prop) {
|
|
|
11831
11837
|
return fallbackValue;
|
|
11832
11838
|
}
|
|
11833
11839
|
|
|
11834
|
-
const html$1 = freeze(['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']);
|
|
11835
|
-
const svg$1 = freeze(['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']);
|
|
11840
|
+
const html$1 = freeze(['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', 'search', 'section', 'select', 'shadow', 'slot', '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']);
|
|
11841
|
+
const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
11836
11842
|
const svgFilters = freeze(['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']);
|
|
11837
11843
|
// List of SVG elements that are disallowed by default.
|
|
11838
11844
|
// We still need to know them so that we can do namespace
|
|
@@ -11845,8 +11851,8 @@ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mgly
|
|
|
11845
11851
|
const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
|
|
11846
11852
|
const text = freeze(['#text']);
|
|
11847
11853
|
|
|
11848
|
-
const html = freeze(['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', 'popover', 'popovertarget', 'popovertargetaction', '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', 'wrap', 'xmlns', 'slot']);
|
|
11849
|
-
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', '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', 'exponent', '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', 'intercept', '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', 'slope', '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', 'tablevalues', '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']);
|
|
11854
|
+
const html = freeze(['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', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', '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', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
|
|
11855
|
+
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', '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', 'exponent', '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', 'intercept', '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', 'mask-type', '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', 'slope', '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', 'tablevalues', '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']);
|
|
11850
11856
|
const mathMl = freeze(['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']);
|
|
11851
11857
|
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
11852
11858
|
|
|
@@ -11953,7 +11959,7 @@ const _createHooksMap = function _createHooksMap() {
|
|
|
11953
11959
|
function createDOMPurify() {
|
|
11954
11960
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
11955
11961
|
const DOMPurify = root => createDOMPurify(root);
|
|
11956
|
-
DOMPurify.version = '3.
|
|
11962
|
+
DOMPurify.version = '3.3.0';
|
|
11957
11963
|
DOMPurify.removed = [];
|
|
11958
11964
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
11959
11965
|
// Not running in a browser, provide a factory function
|
|
@@ -12064,6 +12070,21 @@ function createDOMPurify() {
|
|
|
12064
12070
|
let FORBID_TAGS = null;
|
|
12065
12071
|
/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
|
|
12066
12072
|
let FORBID_ATTR = null;
|
|
12073
|
+
/* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
|
|
12074
|
+
const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
12075
|
+
tagCheck: {
|
|
12076
|
+
writable: true,
|
|
12077
|
+
configurable: false,
|
|
12078
|
+
enumerable: true,
|
|
12079
|
+
value: null
|
|
12080
|
+
},
|
|
12081
|
+
attributeCheck: {
|
|
12082
|
+
writable: true,
|
|
12083
|
+
configurable: false,
|
|
12084
|
+
enumerable: true,
|
|
12085
|
+
value: null
|
|
12086
|
+
}
|
|
12087
|
+
}));
|
|
12067
12088
|
/* Decide if ARIA attributes are okay */
|
|
12068
12089
|
let ALLOW_ARIA_ATTR = true;
|
|
12069
12090
|
/* Decide if custom data attributes are okay */
|
|
@@ -12256,16 +12277,24 @@ function createDOMPurify() {
|
|
|
12256
12277
|
}
|
|
12257
12278
|
/* Merge configuration parameters */
|
|
12258
12279
|
if (cfg.ADD_TAGS) {
|
|
12259
|
-
if (
|
|
12260
|
-
|
|
12280
|
+
if (typeof cfg.ADD_TAGS === 'function') {
|
|
12281
|
+
EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
|
|
12282
|
+
} else {
|
|
12283
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
12284
|
+
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
12285
|
+
}
|
|
12286
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
12261
12287
|
}
|
|
12262
|
-
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
12263
12288
|
}
|
|
12264
12289
|
if (cfg.ADD_ATTR) {
|
|
12265
|
-
if (
|
|
12266
|
-
|
|
12290
|
+
if (typeof cfg.ADD_ATTR === 'function') {
|
|
12291
|
+
EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
|
|
12292
|
+
} else {
|
|
12293
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
12294
|
+
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
12295
|
+
}
|
|
12296
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
12267
12297
|
}
|
|
12268
|
-
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
12269
12298
|
}
|
|
12270
12299
|
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
12271
12300
|
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
@@ -12573,7 +12602,7 @@ function createDOMPurify() {
|
|
|
12573
12602
|
return true;
|
|
12574
12603
|
}
|
|
12575
12604
|
/* Remove element if anything forbids its presence */
|
|
12576
|
-
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
12605
|
+
if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
|
|
12577
12606
|
/* Check if we have a custom element to handle */
|
|
12578
12607
|
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
12579
12608
|
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
@@ -12645,12 +12674,12 @@ function createDOMPurify() {
|
|
|
12645
12674
|
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
|
12646
12675
|
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
12647
12676
|
We don't need to check the value; it's always URI safe. */
|
|
12648
|
-
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
12677
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
12649
12678
|
if (
|
|
12650
12679
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
12651
12680
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
12652
12681
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
12653
|
-
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
|
|
12682
|
+
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) ||
|
|
12654
12683
|
// Alternative, second condition checks if it's an `is`-attribute, AND
|
|
12655
12684
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
12656
12685
|
lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
|
|
@@ -12729,7 +12758,12 @@ function createDOMPurify() {
|
|
|
12729
12758
|
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
12730
12759
|
}
|
|
12731
12760
|
/* Work around a security issue with comments inside attributes */
|
|
12732
|
-
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
|
12761
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
|
|
12762
|
+
_removeAttribute(name, currentNode);
|
|
12763
|
+
continue;
|
|
12764
|
+
}
|
|
12765
|
+
/* Make sure we cannot easily use animated hrefs, even if animations are allowed */
|
|
12766
|
+
if (lcName === 'attributename' && stringMatch(value, 'href')) {
|
|
12733
12767
|
_removeAttribute(name, currentNode);
|
|
12734
12768
|
continue;
|
|
12735
12769
|
}
|
|
@@ -15800,8 +15834,8 @@ const base64js = __webpack_require__(/*! base64-js */ "../../node_modules/base64
|
|
|
15800
15834
|
*/
|
|
15801
15835
|
class BitmapAdapter {
|
|
15802
15836
|
/**
|
|
15803
|
-
* @param {?
|
|
15804
|
-
* @param {?
|
|
15837
|
+
* @param {?Function} makeImage HTML image constructor. Tests can provide this.
|
|
15838
|
+
* @param {?Function} makeCanvas HTML canvas constructor. Tests can provide this.
|
|
15805
15839
|
*/
|
|
15806
15840
|
constructor(makeImage, makeCanvas) {
|
|
15807
15841
|
this._makeImage = makeImage ? makeImage : () => new Image();
|
|
@@ -15841,7 +15875,7 @@ class BitmapAdapter {
|
|
|
15841
15875
|
* to resolution 2 bitmaps. Therefore, converting a resolution 1 bitmap means doubling
|
|
15842
15876
|
* it in width and height.
|
|
15843
15877
|
* @param {!string} dataURI Base 64 encoded image data of the bitmap
|
|
15844
|
-
* @param {!
|
|
15878
|
+
* @param {!Function} callback Node-style callback that returns updated dataURI if conversion succeeded
|
|
15845
15879
|
*/
|
|
15846
15880
|
convertResolution1Bitmap(dataURI, callback) {
|
|
15847
15881
|
const image = this._makeImage();
|
|
@@ -15859,7 +15893,7 @@ class BitmapAdapter {
|
|
|
15859
15893
|
* to in Scratch 3.0
|
|
15860
15894
|
* @param {!number} oldWidth original width
|
|
15861
15895
|
* @param {!number} oldHeight original height
|
|
15862
|
-
* @
|
|
15896
|
+
* @returns {object} Array of new width, new height
|
|
15863
15897
|
*/
|
|
15864
15898
|
getResizedWidthHeight(oldWidth, oldHeight) {
|
|
15865
15899
|
const STAGE_WIDTH = 480;
|
|
@@ -16039,7 +16073,7 @@ module.exports = function (svgString) {
|
|
|
16039
16073
|
/**
|
|
16040
16074
|
* Given an SVG, replace Scratch 2.0 fonts with new 3.0 fonts. Add defaults where there are none.
|
|
16041
16075
|
* @param {SVGElement} svgTag The SVG dom object
|
|
16042
|
-
* @
|
|
16076
|
+
* @returns {void}
|
|
16043
16077
|
*/
|
|
16044
16078
|
const convertFonts = function convertFonts(svgTag) {
|
|
16045
16079
|
// Collect all text elements into a list.
|
|
@@ -16094,7 +16128,7 @@ const getFonts = __webpack_require__(/*! scratch-render-fonts */ "../../node_mod
|
|
|
16094
16128
|
* // Using a <link> or <style>@import</style> to link to font-family
|
|
16095
16129
|
* // injected into the document: no effect.
|
|
16096
16130
|
* @param {string} svgString The string representation of the svg to modify
|
|
16097
|
-
* @
|
|
16131
|
+
* @returns {string} The svg with any needed fonts inlined
|
|
16098
16132
|
*/
|
|
16099
16133
|
const inlineSvgFonts = function inlineSvgFonts(svgString) {
|
|
16100
16134
|
const FONTS = getFonts();
|
|
@@ -16176,7 +16210,7 @@ const {
|
|
|
16176
16210
|
/**
|
|
16177
16211
|
* @param {SVGElement} svgTag the tag to search within
|
|
16178
16212
|
* @param {string} [tagName] svg tag to search for (or collect all elements if not given)
|
|
16179
|
-
* @
|
|
16213
|
+
* @returns {Array} a list of elements with the given tagname
|
|
16180
16214
|
*/
|
|
16181
16215
|
const collectElements = (svgTag, tagName) => {
|
|
16182
16216
|
const elts = [];
|
|
@@ -16329,7 +16363,7 @@ const transformText = svgTag => {
|
|
|
16329
16363
|
* This is used to enlarge the computed bounding box, which doesn't take
|
|
16330
16364
|
* stroke width into account.
|
|
16331
16365
|
* @param {SVGSVGElement} rootNode The root SVG node to traverse.
|
|
16332
|
-
* @
|
|
16366
|
+
* @returns {number} The largest stroke width in the SVG.
|
|
16333
16367
|
*/
|
|
16334
16368
|
const findLargestStrokeWidth = rootNode => {
|
|
16335
16369
|
let largestStrokeWidth = 0;
|
|
@@ -16462,7 +16496,7 @@ const normalizeSvg = (svgTag, fromVersion2) => {
|
|
|
16462
16496
|
* mimic Scratch 2.0's SVG rendering.
|
|
16463
16497
|
* @param {!string} svgString String of SVG data to draw in quirks-mode.
|
|
16464
16498
|
* @param {boolean} [fromVersion2] True if we should perform conversion from version 2 to version 3 svg.
|
|
16465
|
-
* @
|
|
16499
|
+
* @returns {SVGSVGElement} The normalized SVG element.
|
|
16466
16500
|
*/
|
|
16467
16501
|
const loadSvgString = (svgString, fromVersion2) => {
|
|
16468
16502
|
// Parse string into SVG XML.
|
|
@@ -16576,7 +16610,7 @@ let _TextDecoder;
|
|
|
16576
16610
|
let _TextEncoder;
|
|
16577
16611
|
if (typeof TextDecoder === 'undefined' || typeof TextEncoder === 'undefined') {
|
|
16578
16612
|
// Wait to require the text encoding polyfill until we know it's needed.
|
|
16579
|
-
|
|
16613
|
+
|
|
16580
16614
|
const encoding = __webpack_require__(/*! fastestsmallesttextencoderdecoder */ "../../node_modules/fastestsmallesttextencoderdecoder/EncoderDecoderTogether.min.js");
|
|
16581
16615
|
_TextDecoder = encoding.TextDecoder;
|
|
16582
16616
|
_TextEncoder = encoding.TextEncoder;
|
|
@@ -16588,7 +16622,7 @@ if (typeof TextDecoder === 'undefined' || typeof TextEncoder === 'undefined') {
|
|
|
16588
16622
|
/**
|
|
16589
16623
|
* Load an SVG Uint8Array of bytes and "sanitize" it
|
|
16590
16624
|
* @param {!Uint8Array} rawData unsanitized SVG daata
|
|
16591
|
-
* @
|
|
16625
|
+
* @returns {Uint8Array} sanitized SVG data
|
|
16592
16626
|
*/
|
|
16593
16627
|
sanitizeSvg.sanitizeByteStream = function (rawData) {
|
|
16594
16628
|
const decoder = new _TextDecoder();
|
|
@@ -16602,7 +16636,7 @@ sanitizeSvg.sanitizeByteStream = function (rawData) {
|
|
|
16602
16636
|
* fixup-svg-string.js, and thus more risky; there are known examples of SVGs that
|
|
16603
16637
|
* it will clobber. We use DOMPurify's svg profile, which restricts many types of tag.
|
|
16604
16638
|
* @param {!string} rawSvgText unsanitized SVG string
|
|
16605
|
-
* @
|
|
16639
|
+
* @returns {string} sanitized SVG text
|
|
16606
16640
|
*/
|
|
16607
16641
|
sanitizeSvg.sanitizeSvgText = function (rawSvgText) {
|
|
16608
16642
|
let sanitizedText = DOMPurify.sanitize(rawSvgText, {
|
|
@@ -16747,7 +16781,7 @@ class SvgRenderer {
|
|
|
16747
16781
|
* Create a quirks-mode SVG renderer for a particular canvas.
|
|
16748
16782
|
* @param {HTMLCanvasElement} [canvas] An optional canvas element to draw to. If this is not provided, the renderer
|
|
16749
16783
|
* will create a new canvas.
|
|
16750
|
-
* @
|
|
16784
|
+
* @class
|
|
16751
16785
|
*/
|
|
16752
16786
|
constructor(canvas) {
|
|
16753
16787
|
/**
|
|
@@ -16801,14 +16835,14 @@ class SvgRenderer {
|
|
|
16801
16835
|
}
|
|
16802
16836
|
|
|
16803
16837
|
/**
|
|
16804
|
-
* @
|
|
16838
|
+
* @returns {Array<number>} the natural size, in Scratch units, of this SVG.
|
|
16805
16839
|
*/
|
|
16806
16840
|
get size() {
|
|
16807
16841
|
return [this._measurements.width, this._measurements.height];
|
|
16808
16842
|
}
|
|
16809
16843
|
|
|
16810
16844
|
/**
|
|
16811
|
-
* @
|
|
16845
|
+
* @returns {Array<number>} the offset (upper left corner) of the SVG's view box.
|
|
16812
16846
|
*/
|
|
16813
16847
|
get viewOffset() {
|
|
16814
16848
|
return [this._measurements.x, this._measurements.y];
|
|
@@ -16883,7 +16917,7 @@ class SvgRenderer {
|
|
|
16883
16917
|
/**
|
|
16884
16918
|
* Draw to the canvas from a loaded image element.
|
|
16885
16919
|
* @param {number} [scale] - Optionally, also scale the image by this factor.
|
|
16886
|
-
|
|
16920
|
+
*/
|
|
16887
16921
|
_drawFromImage(scale) {
|
|
16888
16922
|
if (this._cachedImage === null) return;
|
|
16889
16923
|
const ratio = Number.isFinite(scale) ? scale : 1;
|
|
@@ -17434,14 +17468,13 @@ const _parseUrl = (value, windowRef) => {
|
|
|
17434
17468
|
* on groups down to the leaf level and averaging out the stroke width
|
|
17435
17469
|
* around the shapes. Note that this doens't just change stroke widths, it
|
|
17436
17470
|
* changes path data and attributes throughout the SVG.
|
|
17437
|
-
*
|
|
17438
17471
|
* @param {SVGElement} svgTag The SVG dom object
|
|
17439
17472
|
* @param {Window} windowRef The window to use. Need to pass in for
|
|
17440
17473
|
* tests to work, as they get angry at even the mention of window.
|
|
17441
17474
|
* @param {object} bboxForTesting The bounds to use. Need to pass in for
|
|
17442
17475
|
* tests only, because getBBox doesn't work in Node. This should
|
|
17443
17476
|
* be the bounds of the svgTag without including stroke width or transforms.
|
|
17444
|
-
* @
|
|
17477
|
+
* @returns {void}
|
|
17445
17478
|
*/
|
|
17446
17479
|
const transformStrokeWidths = function transformStrokeWidths(svgTag, windowRef, bboxForTesting) {
|
|
17447
17480
|
const inherited = Matrix.identity();
|