From f06956efd2dc4bf77244a9fcce2b883a00b925af Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Thu, 21 Dec 2023 22:46:53 +0800 Subject: updated node modules --- node_modules/svgo/plugins/_collections.js | 137 +++++++++- node_modules/svgo/plugins/_transforms.js | 2 +- node_modules/svgo/plugins/applyTransforms.js | 37 ++- node_modules/svgo/plugins/cleanupAttrs.js | 2 +- .../svgo/plugins/cleanupEnableBackground.js | 148 +++++++++-- node_modules/svgo/plugins/cleanupIds.js | 70 ++--- node_modules/svgo/plugins/collapseGroups.js | 2 +- .../svgo/plugins/convertOneStopGradients.js | 168 ++++++++++++ node_modules/svgo/plugins/convertPathData.js | 80 ++++-- node_modules/svgo/plugins/convertShapeToPath.js | 2 +- node_modules/svgo/plugins/convertStyleToAttrs.js | 2 +- node_modules/svgo/plugins/convertTransform.js | 22 +- node_modules/svgo/plugins/inlineStyles.js | 270 +++++++++---------- node_modules/svgo/plugins/mergeStyles.js | 2 +- node_modules/svgo/plugins/minifyStyles.js | 98 +++---- node_modules/svgo/plugins/moveGroupAttrsToElems.js | 3 +- node_modules/svgo/plugins/plugins-types.d.ts | 289 +++++++++++++++++++++ node_modules/svgo/plugins/plugins-types.ts | 251 ------------------ node_modules/svgo/plugins/prefixIds.js | 204 +++++++++------ .../svgo/plugins/removeAttributesBySelector.js | 2 +- node_modules/svgo/plugins/removeAttrs.js | 8 +- node_modules/svgo/plugins/removeComments.js | 28 +- node_modules/svgo/plugins/removeDesc.js | 4 +- node_modules/svgo/plugins/removeEditorsNSData.js | 2 +- node_modules/svgo/plugins/removeEmptyContainers.js | 3 + node_modules/svgo/plugins/removeHiddenElems.js | 172 ++++++++++-- node_modules/svgo/plugins/removeOffCanvasPaths.js | 2 +- node_modules/svgo/plugins/removeRasterImages.js | 2 +- node_modules/svgo/plugins/removeScriptElement.js | 49 +++- node_modules/svgo/plugins/removeTitle.js | 2 +- .../svgo/plugins/removeUnknownsAndDefaults.js | 16 +- .../svgo/plugins/removeUselessStrokeAndFill.js | 3 +- node_modules/svgo/plugins/removeXMLNS.js | 1 - node_modules/svgo/plugins/removeXlink.js | 226 ++++++++++++++++ node_modules/svgo/plugins/reusePaths.js | 146 ++++++++--- 35 files changed, 1730 insertions(+), 725 deletions(-) create mode 100644 node_modules/svgo/plugins/convertOneStopGradients.js create mode 100644 node_modules/svgo/plugins/plugins-types.d.ts delete mode 100644 node_modules/svgo/plugins/plugins-types.ts create mode 100644 node_modules/svgo/plugins/removeXlink.js (limited to 'node_modules/svgo/plugins') diff --git a/node_modules/svgo/plugins/_collections.js b/node_modules/svgo/plugins/_collections.js index dfa8bff6..b9e67cb7 100644 --- a/node_modules/svgo/plugins/_collections.js +++ b/node_modules/svgo/plugins/_collections.js @@ -93,13 +93,19 @@ exports.elemsGroups = { ], }; -exports.textElems = exports.elemsGroups.textContent.concat('title'); +/** + * Elements where adding or removing whitespace may effect rendering, metadata, + * or semantic meaning. + * + * @see https://developer.mozilla.org/docs/Web/HTML/Element/pre + */ +exports.textElems = [...exports.elemsGroups.textContent, 'title', 'pre']; exports.pathElems = ['path', 'glyph', 'missing-glyph']; -// https://www.w3.org/TR/SVG11/intro.html#Definitions /** * @type {Record>} + * @see https://www.w3.org/TR/SVG11/intro.html#Definitions */ exports.attrsGroups = { animationAddition: ['additive', 'accumulate'], @@ -218,13 +224,72 @@ exports.attrsGroups = { 'xlink:title', ], documentEvent: [ - 'onunload', 'onabort', 'onerror', 'onresize', 'onscroll', + 'onunload', 'onzoom', ], + documentElementEvent: ['oncopy', 'oncut', 'onpaste'], + globalEvent: [ + 'oncancel', + 'oncanplay', + 'oncanplaythrough', + 'onchange', + 'onclick', + 'onclose', + 'oncuechange', + 'ondblclick', + 'ondrag', + 'ondragend', + 'ondragenter', + 'ondragleave', + 'ondragover', + 'ondragstart', + 'ondrop', + 'ondurationchange', + 'onemptied', + 'onended', + 'onerror', + 'onfocus', + 'oninput', + 'oninvalid', + 'onkeydown', + 'onkeypress', + 'onkeyup', + 'onload', + 'onloadeddata', + 'onloadedmetadata', + 'onloadstart', + 'onmousedown', + 'onmouseenter', + 'onmouseleave', + 'onmousemove', + 'onmouseout', + 'onmouseover', + 'onmouseup', + 'onmousewheel', + 'onpause', + 'onplay', + 'onplaying', + 'onprogress', + 'onratechange', + 'onreset', + 'onresize', + 'onscroll', + 'onseeked', + 'onseeking', + 'onselect', + 'onshow', + 'onstalled', + 'onsubmit', + 'onsuspend', + 'ontimeupdate', + 'ontoggle', + 'onvolumechange', + 'onwaiting', + ], filterPrimitive: ['x', 'y', 'width', 'height', 'result'], transferFunction: [ 'type', @@ -304,7 +369,6 @@ exports.attrsGroupsDefaults = { }, }; -// https://www.w3.org/TR/SVG11/eltindex.html /** * @type {Record, @@ -313,6 +377,7 @@ exports.attrsGroupsDefaults = { * contentGroups?: Array, * content?: Array, * }>} + * @see https://www.w3.org/TR/SVG11/eltindex.html */ exports.elems = { a: { @@ -1889,7 +1954,9 @@ exports.editorNamespaces = [ 'http://www.vector.evaxdesign.sk', ]; -// https://www.w3.org/TR/SVG11/linking.html#processingIRI +/** + * @see https://www.w3.org/TR/SVG11/linking.html#processingIRI + */ exports.referencesProps = [ 'clip-path', 'color-profile', @@ -1903,7 +1970,9 @@ exports.referencesProps = [ 'style', ]; -// https://www.w3.org/TR/SVG11/propidx.html +/** + * @see https://www.w3.org/TR/SVG11/propidx.html + */ exports.inheritableAttrs = [ 'clip-rule', 'color', @@ -2157,7 +2226,9 @@ exports.colorsShortNames = { '#f5deb3': 'wheat', }; -// https://www.w3.org/TR/SVG11/single-page.html#types-DataTypeColor +/** + * @see https://www.w3.org/TR/SVG11/single-page.html#types-DataTypeColor + */ exports.colorsProps = [ 'color', 'fill', @@ -2166,3 +2237,55 @@ exports.colorsProps = [ 'flood-color', 'lighting-color', ]; + +/** @see https://developer.mozilla.org/docs/Web/CSS/Pseudo-classes */ +exports.pseudoClasses = { + displayState: ['fullscreen', 'modal', 'picture-in-picture'], + input: [ + 'autofill', + 'enabled', + 'disabled', + 'read-only', + 'read-write', + 'placeholder-shown', + 'default', + 'checked', + 'indetermined', + 'blank', + 'valid', + 'invalid', + 'in-range', + 'out-of-range', + 'required', + 'optional', + 'user-invalid', + ], + linguistic: ['dir', 'lang'], + location: [ + 'any-link', + 'link', + 'visited', + 'local-link', + 'target', + 'target-within', + 'scope', + ], + resourceState: ['playing', 'paused'], + timeDimensional: ['current', 'past', 'future'], + treeStructural: [ + 'root', + 'empty', + 'nth-child', + 'nth-last-child', + 'first-child', + 'last-child', + 'only-child', + 'nth-of-type', + 'nth-last-of-type', + 'first-of-type', + 'last-of-type', + 'only-of-type', + ], + userAction: ['hover', 'active', 'focus', 'focus-visible', 'focus-within'], + functional: ['is', 'not', 'where', 'has'], +}; diff --git a/node_modules/svgo/plugins/_transforms.js b/node_modules/svgo/plugins/_transforms.js index 159f1a3b..efc141c7 100644 --- a/node_modules/svgo/plugins/_transforms.js +++ b/node_modules/svgo/plugins/_transforms.js @@ -22,7 +22,7 @@ exports.transform2js = (transformString) => { const transforms = []; // current transform context /** - * @type {null | TransformItem} + * @type {?TransformItem} */ let current = null; // split value into ['', 'translate', '10 50', '', 'scale', '2', '', 'rotate', '-45', ''] diff --git a/node_modules/svgo/plugins/applyTransforms.js b/node_modules/svgo/plugins/applyTransforms.js index bf60ac89..c0b848c9 100644 --- a/node_modules/svgo/plugins/applyTransforms.js +++ b/node_modules/svgo/plugins/applyTransforms.js @@ -12,7 +12,10 @@ const { transformArc, } = require('./_transforms.js'); const { path2js } = require('./_path.js'); -const { removeLeadingZero } = require('../lib/svgo/tools.js'); +const { + removeLeadingZero, + includesUrlReference, +} = require('../lib/svgo/tools.js'); const { referencesProps, attrsGroupsDefaults } = require('./_collections.js'); /** @@ -35,9 +38,6 @@ const applyTransforms = (root, params) => { return { element: { enter: (node) => { - const computedStyle = computeStyle(stylesheet, node); - - // used only for paths for now if (node.attributes.d == null) { return; } @@ -48,7 +48,7 @@ const applyTransforms = (root, params) => { } // if there are no 'stroke' attr and references to other objects such as - // gradiends or clip-path which are also subjects to transform. + // gradients or clip-path which are also subjects to transform. if ( node.attributes.transform == null || node.attributes.transform === '' || @@ -57,32 +57,41 @@ const applyTransforms = (root, params) => { node.attributes.style != null || Object.entries(node.attributes).some( ([name, value]) => - referencesProps.includes(name) && value.includes('url(') + referencesProps.includes(name) && includesUrlReference(value) ) ) { return; } + const computedStyle = computeStyle(stylesheet, node); + const transformStyle = computedStyle.transform; + + // Transform overridden in