react-native-nano-icons 0.2.0 → 1.0.0-beta.1
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/LICENSES.md +40 -0
- package/README.md +41 -10
- package/android/src/main/java/com/nanoicons/NanoIconFonts.kt +31 -0
- package/android/src/main/java/com/nanoicons/NanoIconView.kt +50 -15
- package/android/src/main/java/com/nanoicons/NanoIconsFontLoaderModule.kt +78 -12
- package/ios/NanoIconFontResolver.h +5 -0
- package/ios/NanoIconFontResolver.mm +32 -0
- package/ios/NanoIconView.h +0 -4
- package/ios/NanoIconView.mm +62 -57
- package/ios/NanoIconsFontLoader.mm +10 -32
- package/lib/commonjs/cli/build.d.ts +11 -3
- package/lib/commonjs/cli/build.js +86 -25
- package/lib/commonjs/cli/config.d.ts +1 -1
- package/lib/commonjs/cli/config.js +1 -1
- package/lib/commonjs/cli/expoConfig.d.ts +3 -2
- package/lib/commonjs/cli/expoConfig.js +22 -9
- package/lib/commonjs/cli/index.d.ts +5 -5
- package/lib/commonjs/cli/index.js +16 -14
- package/lib/commonjs/cli/link.d.ts +4 -3
- package/lib/commonjs/cli/link.js +127 -45
- package/lib/commonjs/cli/logger.js +9 -7
- package/lib/commonjs/plugin/src/buildFonts.d.ts +3 -3
- package/lib/commonjs/plugin/src/buildFonts.js +5 -15
- package/lib/commonjs/plugin/src/index.d.ts +2 -2
- package/lib/commonjs/plugin/src/index.js +2 -2
- package/lib/commonjs/plugin/src/types.d.ts +10 -1
- package/lib/commonjs/plugin/src/withNanoIconsFontLinking.d.ts +1 -1
- package/lib/commonjs/plugin/src/withNanoIconsFontLinking.js +6 -13
- package/lib/commonjs/scripts/cli.js +46 -23
- package/lib/commonjs/src/core/flatten/arcs.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/arcs.js +136 -0
- package/lib/commonjs/src/core/flatten/document.d.ts +35 -0
- package/lib/commonjs/src/core/flatten/document.js +164 -0
- package/lib/commonjs/src/core/flatten/dom.d.ts +24 -0
- package/lib/commonjs/src/core/flatten/dom.js +221 -0
- package/lib/commonjs/src/core/flatten/element.d.ts +12 -0
- package/lib/commonjs/src/core/flatten/element.js +97 -0
- package/lib/commonjs/src/core/flatten/geometry.d.ts +21 -0
- package/lib/commonjs/src/core/flatten/geometry.js +85 -0
- package/lib/commonjs/src/core/flatten/index.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/index.js +11 -0
- package/lib/commonjs/src/core/flatten/inherit.d.ts +13 -0
- package/lib/commonjs/src/core/flatten/inherit.js +249 -0
- package/lib/commonjs/src/core/flatten/path.d.ts +19 -0
- package/lib/commonjs/src/core/flatten/path.js +439 -0
- package/lib/commonjs/src/core/flatten/pathops.d.ts +14 -0
- package/lib/commonjs/src/core/flatten/pathops.js +236 -0
- package/lib/commonjs/src/core/flatten/shape.d.ts +29 -0
- package/lib/commonjs/src/core/flatten/shape.js +415 -0
- package/lib/commonjs/src/core/flatten/stages/clip-path.d.ts +4 -0
- package/lib/commonjs/src/core/flatten/stages/clip-path.js +20 -0
- package/lib/commonjs/src/core/flatten/stages/collapse.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/collapse.js +86 -0
- package/lib/commonjs/src/core/flatten/stages/defs.d.ts +4 -0
- package/lib/commonjs/src/core/flatten/stages/defs.js +49 -0
- package/lib/commonjs/src/core/flatten/stages/discard.d.ts +4 -0
- package/lib/commonjs/src/core/flatten/stages/discard.js +50 -0
- package/lib/commonjs/src/core/flatten/stages/fill-rule.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/fill-rule.js +7 -0
- package/lib/commonjs/src/core/flatten/stages/nested-svg.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/nested-svg.js +131 -0
- package/lib/commonjs/src/core/flatten/stages/opacity.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/opacity.js +7 -0
- package/lib/commonjs/src/core/flatten/stages/shapes.d.ts +7 -0
- package/lib/commonjs/src/core/flatten/stages/shapes.js +37 -0
- package/lib/commonjs/src/core/flatten/stages/stroke.d.ts +3 -0
- package/lib/commonjs/src/core/flatten/stages/stroke.js +34 -0
- package/lib/commonjs/src/core/flatten/stages/styles.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/styles.js +29 -0
- package/lib/commonjs/src/core/flatten/stages/use.d.ts +4 -0
- package/lib/commonjs/src/core/flatten/stages/use.js +80 -0
- package/lib/commonjs/src/core/flatten/stages/validate.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/validate.js +39 -0
- package/lib/commonjs/src/core/flatten/stages.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages.js +40 -0
- package/lib/commonjs/src/core/flatten/transform.d.ts +35 -0
- package/lib/commonjs/src/core/flatten/transform.js +221 -0
- package/lib/commonjs/src/core/font/compile.d.ts +2 -1
- package/lib/commonjs/src/core/font/compile.js +21 -7
- package/lib/commonjs/src/core/font/metrics.js +7 -0
- package/lib/commonjs/src/core/font/quadratic.d.ts +1 -0
- package/lib/commonjs/src/core/font/quadratic.js +31 -0
- package/lib/commonjs/src/core/glyph/merge.d.ts +7 -0
- package/lib/commonjs/src/core/glyph/merge.js +57 -0
- package/lib/commonjs/src/core/glyph/parse.d.ts +26 -0
- package/lib/commonjs/src/core/{svg/svg_dom.js → glyph/parse.js} +21 -77
- package/lib/commonjs/src/core/{svg/layers.d.ts → glyph/placement.d.ts} +1 -13
- package/lib/commonjs/src/core/{svg/layers.js → glyph/placement.js} +0 -17
- package/lib/commonjs/src/core/glyph/validate.d.ts +8 -0
- package/lib/commonjs/src/core/glyph/validate.js +33 -0
- package/lib/commonjs/src/core/pathkit/contours.d.ts +74 -0
- package/lib/commonjs/src/core/{svg/svg_pathops.js → pathkit/contours.js} +72 -312
- package/lib/commonjs/src/core/pathkit/evenodd.d.ts +12 -0
- package/lib/commonjs/src/core/pathkit/evenodd.js +51 -0
- package/lib/commonjs/src/core/pathkit/load.d.ts +2 -0
- package/lib/commonjs/src/core/pathkit/load.js +26 -0
- package/lib/commonjs/src/core/pathkit/types.d.ts +69 -0
- package/lib/commonjs/src/core/pathkit/types.js +2 -0
- package/lib/commonjs/src/core/pipeline/config.d.ts +1 -0
- package/lib/commonjs/src/core/pipeline/iconPool.d.ts +3 -0
- package/lib/commonjs/src/core/pipeline/iconPool.js +51 -0
- package/lib/commonjs/src/core/pipeline/index.d.ts +3 -3
- package/lib/commonjs/src/core/pipeline/index.js +6 -5
- package/lib/commonjs/src/core/pipeline/prepare.d.ts +19 -0
- package/lib/commonjs/src/core/pipeline/prepare.js +56 -0
- package/lib/commonjs/src/core/pipeline/prepareIcon.d.ts +22 -0
- package/lib/commonjs/src/core/pipeline/prepareIcon.js +78 -0
- package/lib/commonjs/src/core/pipeline/prepareWorker.d.ts +1 -0
- package/lib/commonjs/src/core/pipeline/prepareWorker.js +12 -0
- package/lib/commonjs/src/core/pipeline/{run.d.ts → runFontPipeline.d.ts} +7 -4
- package/lib/commonjs/src/core/pipeline/runFontPipeline.js +109 -0
- package/lib/commonjs/src/core/types.d.ts +3 -92
- package/lib/commonjs/src/utils/fingerPrint.d.ts +8 -1
- package/lib/commonjs/src/utils/fingerPrint.js +8 -1
- package/lib/commonjs/src/utils/fontIdentity.d.ts +4 -0
- package/lib/commonjs/src/utils/fontIdentity.js +24 -0
- package/lib/commonjs/src/utils/packageVersion.d.ts +2 -0
- package/lib/commonjs/src/utils/packageVersion.js +37 -0
- package/lib/commonjs/src/utils/parse.d.ts +0 -1
- package/lib/commonjs/src/utils/parse.js +0 -8
- package/lib/commonjs/src/utils/svgPatterns.d.ts +38 -0
- package/lib/commonjs/src/utils/svgPatterns.js +46 -0
- package/lib/module/const/codegenPrimitives.js +1 -2
- package/lib/module/const/colors.js +1 -2
- package/lib/module/createNanoIconsSet.js +1 -2
- package/lib/module/createNanoIconsSet.native.js +11 -4
- package/lib/module/createNanoIconsSet.shared.js +12 -7
- package/lib/module/createNanoIconsSet.web.js +7 -5
- package/lib/module/fontIntegrity.js +99 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.node.js +1 -2
- package/lib/module/loadDynamicFont.js +14 -7
- package/lib/module/nativeFontLoader.js +3 -0
- package/lib/module/nativeFontLoader.web.js +3 -0
- package/lib/module/specs/NativeNanoIconsFontLoader.js +1 -2
- package/lib/module/types.js +1 -2
- package/lib/module/utils/fingerPrint.js +3 -3
- package/lib/module/utils/fontIdentity.js +20 -0
- package/lib/module/utils/glyphRuntime.js +1 -2
- package/lib/module/utils/packageVersion.js +29 -0
- package/lib/module/utils/parse.js +1 -9
- package/lib/module/utils/runtimeLog.js +12 -0
- package/lib/module/utils/shallowEqualColor.js +1 -2
- package/lib/module/utils/svgPatterns.js +49 -0
- package/lib/typescript/src/core/flatten/arcs.d.ts +3 -0
- package/lib/typescript/src/core/flatten/document.d.ts +36 -0
- package/lib/typescript/src/core/flatten/dom.d.ts +25 -0
- package/lib/typescript/src/core/flatten/element.d.ts +13 -0
- package/lib/typescript/src/core/flatten/geometry.d.ts +22 -0
- package/lib/typescript/src/core/flatten/index.d.ts +3 -0
- package/lib/typescript/src/core/flatten/inherit.d.ts +14 -0
- package/lib/typescript/src/core/flatten/path.d.ts +20 -0
- package/lib/typescript/src/core/flatten/pathops.d.ts +15 -0
- package/lib/typescript/src/core/flatten/shape.d.ts +30 -0
- package/lib/typescript/src/core/flatten/stages/clip-path.d.ts +5 -0
- package/lib/typescript/src/core/flatten/stages/collapse.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages/defs.d.ts +5 -0
- package/lib/typescript/src/core/flatten/stages/discard.d.ts +5 -0
- package/lib/typescript/src/core/flatten/stages/fill-rule.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages/nested-svg.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages/opacity.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages/shapes.d.ts +8 -0
- package/lib/typescript/src/core/flatten/stages/stroke.d.ts +4 -0
- package/lib/typescript/src/core/flatten/stages/styles.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages/use.d.ts +5 -0
- package/lib/typescript/src/core/flatten/stages/validate.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages.d.ts +3 -0
- package/lib/typescript/src/core/flatten/transform.d.ts +36 -0
- package/lib/typescript/src/core/glyph/merge.d.ts +8 -0
- package/lib/typescript/src/core/glyph/parse.d.ts +27 -0
- package/lib/typescript/src/core/{svg/layers.d.ts → glyph/placement.d.ts} +2 -14
- package/lib/typescript/src/core/glyph/validate.d.ts +9 -0
- package/lib/typescript/src/core/pathkit/contours.d.ts +75 -0
- package/lib/typescript/src/core/pathkit/evenodd.d.ts +13 -0
- package/lib/typescript/src/core/pathkit/load.d.ts +3 -0
- package/lib/typescript/src/core/pathkit/types.d.ts +70 -0
- package/lib/typescript/src/core/types.d.ts +3 -92
- package/lib/typescript/src/fontIntegrity.d.ts +24 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/nativeFontLoader.d.ts +2 -0
- package/lib/typescript/src/nativeFontLoader.web.d.ts +3 -0
- package/lib/typescript/src/specs/NativeNanoIconsFontLoader.d.ts +1 -0
- package/lib/typescript/src/types.d.ts +5 -0
- package/lib/typescript/src/utils/fingerPrint.d.ts +8 -1
- package/lib/typescript/src/utils/fontIdentity.d.ts +5 -0
- package/lib/typescript/src/utils/packageVersion.d.ts +3 -0
- package/lib/typescript/src/utils/parse.d.ts +0 -1
- package/lib/typescript/src/utils/runtimeLog.d.ts +5 -0
- package/lib/typescript/src/utils/svgPatterns.d.ts +39 -0
- package/package.json +13 -11
- package/src/specs/NativeNanoIconsFontLoader.ts +1 -0
- package/lib/commonjs/src/core/pipeline/managers.d.ts +0 -11
- package/lib/commonjs/src/core/pipeline/managers.js +0 -104
- package/lib/commonjs/src/core/pipeline/run.js +0 -189
- package/lib/commonjs/src/core/svg/svg_dom.d.ts +0 -51
- package/lib/commonjs/src/core/svg/svg_pathops.d.ts +0 -32
- package/lib/module/const/codegenPrimitives.js.map +0 -1
- package/lib/module/const/colors.js.map +0 -1
- package/lib/module/core/font/compile.js +0 -81
- package/lib/module/core/font/compile.js.map +0 -1
- package/lib/module/core/font/metrics.js +0 -37
- package/lib/module/core/font/metrics.js.map +0 -1
- package/lib/module/core/pipeline/config.js +0 -20
- package/lib/module/core/pipeline/config.js.map +0 -1
- package/lib/module/core/pipeline/index.js +0 -5
- package/lib/module/core/pipeline/index.js.map +0 -1
- package/lib/module/core/pipeline/managers.js +0 -94
- package/lib/module/core/pipeline/managers.js.map +0 -1
- package/lib/module/core/pipeline/run.js +0 -204
- package/lib/module/core/pipeline/run.js.map +0 -1
- package/lib/module/core/shims/pathops.py +0 -181
- package/lib/module/core/shims/picosvg-0.22.3-py3-none-any.whl +0 -0
- package/lib/module/core/svg/layers.js +0 -85
- package/lib/module/core/svg/layers.js.map +0 -1
- package/lib/module/core/svg/svg_dom.js +0 -170
- package/lib/module/core/svg/svg_dom.js.map +0 -1
- package/lib/module/core/svg/svg_pathops.js +0 -750
- package/lib/module/core/svg/svg_pathops.js.map +0 -1
- package/lib/module/core/tsconfig.json +0 -32
- package/lib/module/core/types.js +0 -2
- package/lib/module/core/types.js.map +0 -1
- package/lib/module/createNanoIconsSet.js.map +0 -1
- package/lib/module/createNanoIconsSet.native.js.map +0 -1
- package/lib/module/createNanoIconsSet.shared.js.map +0 -1
- package/lib/module/createNanoIconsSet.web.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/index.node.js.map +0 -1
- package/lib/module/loadDynamicFont.js.map +0 -1
- package/lib/module/specs/NativeNanoIconsFontLoader.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/fingerPrint.js.map +0 -1
- package/lib/module/utils/glyphRuntime.js.map +0 -1
- package/lib/module/utils/parse.js.map +0 -1
- package/lib/module/utils/shallowEqualColor.js.map +0 -1
- package/lib/typescript/__tests__/build.unit.test.d.ts +0 -3
- package/lib/typescript/__tests__/build.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/clippath.e2e.test.d.ts +0 -3
- package/lib/typescript/__tests__/clippath.e2e.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/fingerprint.unit.test.d.ts +0 -3
- package/lib/typescript/__tests__/fingerprint.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/glyphRuntime.unit.test.d.ts +0 -2
- package/lib/typescript/__tests__/glyphRuntime.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/link.unit.test.d.ts +0 -3
- package/lib/typescript/__tests__/link.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/loadDynamicFont.unit.test.d.ts +0 -2
- package/lib/typescript/__tests__/loadDynamicFont.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/pipeline.e2e.test.d.ts +0 -3
- package/lib/typescript/__tests__/pipeline.e2e.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/placement.unit.test.d.ts +0 -3
- package/lib/typescript/__tests__/placement.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/svg_dom.unit.test.d.ts +0 -3
- package/lib/typescript/__tests__/svg_dom.unit.test.d.ts.map +0 -1
- package/lib/typescript/cli/build.d.ts +0 -32
- package/lib/typescript/cli/build.d.ts.map +0 -1
- package/lib/typescript/cli/link.d.ts +0 -12
- package/lib/typescript/cli/link.d.ts.map +0 -1
- package/lib/typescript/cli/logger.d.ts +0 -28
- package/lib/typescript/cli/logger.d.ts.map +0 -1
- package/lib/typescript/src/const/codegenPrimitives.d.ts.map +0 -1
- package/lib/typescript/src/const/colors.d.ts.map +0 -1
- package/lib/typescript/src/core/font/compile.d.ts +0 -21
- package/lib/typescript/src/core/font/compile.d.ts.map +0 -1
- package/lib/typescript/src/core/font/metrics.d.ts +0 -2
- package/lib/typescript/src/core/font/metrics.d.ts.map +0 -1
- package/lib/typescript/src/core/pipeline/config.d.ts +0 -16
- package/lib/typescript/src/core/pipeline/config.d.ts.map +0 -1
- package/lib/typescript/src/core/pipeline/index.d.ts +0 -4
- package/lib/typescript/src/core/pipeline/index.d.ts.map +0 -1
- package/lib/typescript/src/core/pipeline/managers.d.ts +0 -12
- package/lib/typescript/src/core/pipeline/managers.d.ts.map +0 -1
- package/lib/typescript/src/core/pipeline/run.d.ts +0 -15
- package/lib/typescript/src/core/pipeline/run.d.ts.map +0 -1
- package/lib/typescript/src/core/svg/layers.d.ts.map +0 -1
- package/lib/typescript/src/core/svg/svg_dom.d.ts +0 -52
- package/lib/typescript/src/core/svg/svg_dom.d.ts.map +0 -1
- package/lib/typescript/src/core/svg/svg_pathops.d.ts +0 -33
- package/lib/typescript/src/core/svg/svg_pathops.d.ts.map +0 -1
- package/lib/typescript/src/core/types.d.ts.map +0 -1
- package/lib/typescript/src/createNanoIconsSet.d.ts.map +0 -1
- package/lib/typescript/src/createNanoIconsSet.native.d.ts.map +0 -1
- package/lib/typescript/src/createNanoIconsSet.shared.d.ts.map +0 -1
- package/lib/typescript/src/createNanoIconsSet.web.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/index.node.d.ts.map +0 -1
- package/lib/typescript/src/loadDynamicFont.d.ts.map +0 -1
- package/lib/typescript/src/specs/NanoIconViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/specs/NativeNanoIconsFontLoader.d.ts.map +0 -1
- package/lib/typescript/src/types.d.ts.map +0 -1
- package/lib/typescript/src/utils/fingerPrint.d.ts.map +0 -1
- package/lib/typescript/src/utils/glyphRuntime.d.ts.map +0 -1
- package/lib/typescript/src/utils/parse.d.ts.map +0 -1
- package/lib/typescript/src/utils/shallowEqualColor.d.ts.map +0 -1
- package/plugin/src/buildFonts.ts +0 -42
- package/plugin/src/index.ts +0 -21
- package/plugin/src/types.ts +0 -42
- package/plugin/src/withNanoIconsFontLinking.ts +0 -136
- package/plugin/tsconfig.json +0 -9
- package/scripts/cli.ts +0 -63
- package/scripts/tsconfig.json +0 -25
- package/src/const/colors.ts +0 -150
- package/src/core/font/compile.ts +0 -99
- package/src/core/font/metrics.ts +0 -44
- package/src/core/pipeline/config.ts +0 -25
- package/src/core/pipeline/index.ts +0 -3
- package/src/core/pipeline/managers.ts +0 -132
- package/src/core/pipeline/run.ts +0 -274
- package/src/core/shims/pathops.py +0 -181
- package/src/core/shims/picosvg-0.22.3-py3-none-any.whl +0 -0
- package/src/core/svg/layers.ts +0 -110
- package/src/core/svg/svg_dom.ts +0 -194
- package/src/core/svg/svg_pathops.ts +0 -1040
- package/src/core/tsconfig.json +0 -32
- package/src/core/types.ts +0 -157
- package/src/createNanoIconsSet.native.tsx +0 -192
- package/src/createNanoIconsSet.shared.tsx +0 -174
- package/src/createNanoIconsSet.tsx +0 -20
- package/src/createNanoIconsSet.web.tsx +0 -109
- package/src/index.node.ts +0 -14
- package/src/index.ts +0 -6
- package/src/loadDynamicFont.ts +0 -162
- package/src/types.ts +0 -31
- package/src/utils/fingerPrint.ts +0 -20
- package/src/utils/glyphRuntime.ts +0 -46
- package/src/utils/parse.ts +0 -67
- package/src/utils/shallowEqualColor.ts +0 -17
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Tags and attribute names use the "{namespace}local" convention.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.XEl = exports.XLINK_NS = exports.SVG_NS = void 0;
|
|
5
|
+
exports.svgTag = svgTag;
|
|
6
|
+
exports.xlinkHrefAttr = xlinkHrefAttr;
|
|
7
|
+
exports.splitNs = splitNs;
|
|
8
|
+
exports.stripNs = stripNs;
|
|
9
|
+
exports.findAll = findAll;
|
|
10
|
+
exports.replaceEl = replaceEl;
|
|
11
|
+
exports.delAttrs = delAttrs;
|
|
12
|
+
exports.parseSvgDocument = parseSvgDocument;
|
|
13
|
+
exports.serializeSvg = serializeSvg;
|
|
14
|
+
const xmldom_1 = require("@xmldom/xmldom");
|
|
15
|
+
const svgPatterns_1 = require("../../utils/svgPatterns");
|
|
16
|
+
exports.SVG_NS = 'http://www.w3.org/2000/svg';
|
|
17
|
+
exports.XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
18
|
+
function svgTag(local) {
|
|
19
|
+
return `{${exports.SVG_NS}}${local}`;
|
|
20
|
+
}
|
|
21
|
+
function xlinkHrefAttr() {
|
|
22
|
+
return `{${exports.XLINK_NS}}href`;
|
|
23
|
+
}
|
|
24
|
+
function splitNs(name) {
|
|
25
|
+
if (name.startsWith('{')) {
|
|
26
|
+
const end = name.indexOf('}');
|
|
27
|
+
return [name.slice(1, end), name.slice(end + 1)];
|
|
28
|
+
}
|
|
29
|
+
return [null, name];
|
|
30
|
+
}
|
|
31
|
+
function stripNs(name) {
|
|
32
|
+
return splitNs(name)[1];
|
|
33
|
+
}
|
|
34
|
+
class XEl {
|
|
35
|
+
tag;
|
|
36
|
+
attrib;
|
|
37
|
+
children;
|
|
38
|
+
parent = null;
|
|
39
|
+
constructor(tag, attrib) {
|
|
40
|
+
this.tag = tag;
|
|
41
|
+
this.attrib = new Map(attrib ?? []);
|
|
42
|
+
this.children = [];
|
|
43
|
+
}
|
|
44
|
+
append(child) {
|
|
45
|
+
child.detach();
|
|
46
|
+
child.parent = this;
|
|
47
|
+
this.children.push(child);
|
|
48
|
+
}
|
|
49
|
+
insert(index, child) {
|
|
50
|
+
child.detach();
|
|
51
|
+
child.parent = this;
|
|
52
|
+
this.children.splice(index, 0, child);
|
|
53
|
+
}
|
|
54
|
+
detach() {
|
|
55
|
+
if (this.parent) {
|
|
56
|
+
const idx = this.parent.children.indexOf(this);
|
|
57
|
+
if (idx !== -1)
|
|
58
|
+
this.parent.children.splice(idx, 1);
|
|
59
|
+
this.parent = null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
index(child) {
|
|
63
|
+
return this.children.indexOf(child);
|
|
64
|
+
}
|
|
65
|
+
deepClone() {
|
|
66
|
+
const copy = new XEl(this.tag, this.attrib);
|
|
67
|
+
for (const child of this.children) {
|
|
68
|
+
copy.append(child.deepClone());
|
|
69
|
+
}
|
|
70
|
+
return copy;
|
|
71
|
+
}
|
|
72
|
+
// this element and all descendants, document order
|
|
73
|
+
*iter() {
|
|
74
|
+
yield this;
|
|
75
|
+
for (const child of this.children) {
|
|
76
|
+
yield* child.iter();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.XEl = XEl;
|
|
81
|
+
function findAll(root, pred) {
|
|
82
|
+
const out = [];
|
|
83
|
+
for (const el of root.iter()) {
|
|
84
|
+
if (pred(el))
|
|
85
|
+
out.push(el);
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
// replace el with the given elements at the same position
|
|
90
|
+
function replaceEl(el, replacements) {
|
|
91
|
+
const parent = el.parent;
|
|
92
|
+
if (!parent)
|
|
93
|
+
throw new Error('Cannot replace element without parent');
|
|
94
|
+
const idx = parent.index(el);
|
|
95
|
+
el.detach();
|
|
96
|
+
replacements.forEach((child, childIdx) => {
|
|
97
|
+
parent.insert(idx + childIdx, child);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function delAttrs(el, ...attrNames) {
|
|
101
|
+
for (const name of attrNames) {
|
|
102
|
+
el.attrib.delete(name);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// ---- parsing ----
|
|
106
|
+
function domNsToTag(node) {
|
|
107
|
+
const ns = node.namespaceURI;
|
|
108
|
+
return ns ? `{${ns}}${node.localName}` : node.nodeName;
|
|
109
|
+
}
|
|
110
|
+
function convertElement(node) {
|
|
111
|
+
const el = new XEl(domNsToTag(node));
|
|
112
|
+
const attrs = node.attributes;
|
|
113
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
114
|
+
const attr = attrs.item(i);
|
|
115
|
+
if (attr.prefix === 'xmlns' || attr.nodeName === 'xmlns') {
|
|
116
|
+
continue; // namespace declarations live in tags, not attrib
|
|
117
|
+
}
|
|
118
|
+
const name = attr.namespaceURI
|
|
119
|
+
? `{${attr.namespaceURI}}${attr.localName}`
|
|
120
|
+
: attr.nodeName;
|
|
121
|
+
el.attrib.set(name, attr.value);
|
|
122
|
+
}
|
|
123
|
+
const children = node.childNodes;
|
|
124
|
+
for (let i = 0; i < children.length; i++) {
|
|
125
|
+
const child = children.item(i);
|
|
126
|
+
// elements only: comments and text nodes are dropped
|
|
127
|
+
if (child.nodeType === 1) {
|
|
128
|
+
el.append(convertElement(child));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return el;
|
|
132
|
+
}
|
|
133
|
+
function parseSvgDocument(content) {
|
|
134
|
+
let text = content;
|
|
135
|
+
// svgs are fond of not declaring xlink
|
|
136
|
+
if (text.includes('xlink:') && !text.includes('xmlns:xlink')) {
|
|
137
|
+
text = text.replace(/<svg([^>]*)>/, (_m, attrs) => `<svg${attrs} xmlns:xlink="${exports.XLINK_NS}">`);
|
|
138
|
+
}
|
|
139
|
+
let parseError = null;
|
|
140
|
+
const parser = new xmldom_1.DOMParser({
|
|
141
|
+
onError: (_level, message) => {
|
|
142
|
+
parseError = parseError ?? message;
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
const doc = parser.parseFromString(text, 'text/xml');
|
|
146
|
+
const root = doc.documentElement;
|
|
147
|
+
if (!root || parseError) {
|
|
148
|
+
throw new Error(`Unable to parse SVG: ${parseError ?? 'no root element'}`);
|
|
149
|
+
}
|
|
150
|
+
return convertElement(root);
|
|
151
|
+
}
|
|
152
|
+
// ---- serialization (pretty print) ----
|
|
153
|
+
function escapeAttr(value) {
|
|
154
|
+
return value
|
|
155
|
+
.replace(svgPatterns_1.XML_AMP, '&')
|
|
156
|
+
.replace(svgPatterns_1.XML_LT, '<')
|
|
157
|
+
.replace(svgPatterns_1.XML_GT, '>')
|
|
158
|
+
.replace(svgPatterns_1.XML_QUOT, '"');
|
|
159
|
+
}
|
|
160
|
+
function attrDisplayName(name) {
|
|
161
|
+
const [ns, local] = splitNs(name);
|
|
162
|
+
if (ns === exports.XLINK_NS)
|
|
163
|
+
return `xlink:${local}`;
|
|
164
|
+
if (ns === exports.SVG_NS || ns === null)
|
|
165
|
+
return local;
|
|
166
|
+
return local; // non-svg attrs are removed before serialization
|
|
167
|
+
}
|
|
168
|
+
function tagDisplayName(tag) {
|
|
169
|
+
const [ns, local] = splitNs(tag);
|
|
170
|
+
if (ns === exports.SVG_NS || ns === null)
|
|
171
|
+
return local;
|
|
172
|
+
throw new Error(`Cannot serialize tag outside svg namespace: ${tag}`);
|
|
173
|
+
}
|
|
174
|
+
function usesXlink(root) {
|
|
175
|
+
for (const el of root.iter()) {
|
|
176
|
+
for (const name of el.attrib.keys()) {
|
|
177
|
+
if (splitNs(name)[0] === exports.XLINK_NS)
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
function serializeEl(el, indent, out) {
|
|
184
|
+
const pad = ' '.repeat(indent);
|
|
185
|
+
const parts = [`${pad}<${tagDisplayName(el.tag)}`];
|
|
186
|
+
for (const [name, value] of el.attrib) {
|
|
187
|
+
parts.push(` ${attrDisplayName(name)}="${escapeAttr(value)}"`);
|
|
188
|
+
}
|
|
189
|
+
if (!el.children.length) {
|
|
190
|
+
parts.push('/>');
|
|
191
|
+
out.push(parts.join(''));
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
parts.push('>');
|
|
195
|
+
out.push(parts.join(''));
|
|
196
|
+
for (const child of el.children) {
|
|
197
|
+
serializeEl(child, indent + 1, out);
|
|
198
|
+
}
|
|
199
|
+
out.push(`${pad}</${tagDisplayName(el.tag)}>`);
|
|
200
|
+
}
|
|
201
|
+
function serializeSvg(root) {
|
|
202
|
+
const out = [];
|
|
203
|
+
const attrs = [`xmlns="${exports.SVG_NS}"`];
|
|
204
|
+
if (usesXlink(root)) {
|
|
205
|
+
attrs.push(`xmlns:xlink="${exports.XLINK_NS}"`);
|
|
206
|
+
}
|
|
207
|
+
for (const [name, value] of root.attrib) {
|
|
208
|
+
attrs.push(`${attrDisplayName(name)}="${escapeAttr(value)}"`);
|
|
209
|
+
}
|
|
210
|
+
if (!root.children.length) {
|
|
211
|
+
out.push(`<${tagDisplayName(root.tag)} ${attrs.join(' ')}/>`);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
out.push(`<${tagDisplayName(root.tag)} ${attrs.join(' ')}>`);
|
|
215
|
+
for (const child of root.children) {
|
|
216
|
+
serializeEl(child, 1, out);
|
|
217
|
+
}
|
|
218
|
+
out.push(`</${tagDisplayName(root.tag)}>`);
|
|
219
|
+
}
|
|
220
|
+
return out.join('\n') + '\n';
|
|
221
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Rect } from './geometry';
|
|
2
|
+
import { XEl } from './dom';
|
|
3
|
+
import { Affine2D } from './transform';
|
|
4
|
+
export declare function numberAttrib(el: XEl, name: string, fallback: number): number;
|
|
5
|
+
export declare function isTag(el: XEl, local: string): boolean;
|
|
6
|
+
export declare function isDefs(tag: string): boolean;
|
|
7
|
+
export declare function isGradient(tag: string): boolean;
|
|
8
|
+
export declare function isGroup(tag: string): boolean;
|
|
9
|
+
export declare function tryRemoveGroup(groupEl: XEl, pushOpacity?: boolean): boolean;
|
|
10
|
+
export declare function elementTransform(el: XEl, currentTransform?: Affine2D): Affine2D;
|
|
11
|
+
export declare function idOfTarget(url: string): string;
|
|
12
|
+
export declare function parseViewBox(s: string): Rect;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.numberAttrib = numberAttrib;
|
|
4
|
+
exports.isTag = isTag;
|
|
5
|
+
exports.isDefs = isDefs;
|
|
6
|
+
exports.isGradient = isGradient;
|
|
7
|
+
exports.isGroup = isGroup;
|
|
8
|
+
exports.tryRemoveGroup = tryRemoveGroup;
|
|
9
|
+
exports.elementTransform = elementTransform;
|
|
10
|
+
exports.idOfTarget = idOfTarget;
|
|
11
|
+
exports.parseViewBox = parseViewBox;
|
|
12
|
+
const geometry_1 = require("./geometry");
|
|
13
|
+
const dom_1 = require("./dom");
|
|
14
|
+
const inherit_1 = require("./inherit");
|
|
15
|
+
const transform_1 = require("./transform");
|
|
16
|
+
const svgPatterns_1 = require("../../utils/svgPatterns");
|
|
17
|
+
const GRADIENT_TAGS = new Set(['linearGradient', 'radialGradient']);
|
|
18
|
+
function numberAttrib(el, name, fallback) {
|
|
19
|
+
return parseFloat(el.attrib.get(name) ?? String(fallback));
|
|
20
|
+
}
|
|
21
|
+
function isTag(el, local) {
|
|
22
|
+
return (0, dom_1.stripNs)(el.tag) === local;
|
|
23
|
+
}
|
|
24
|
+
function isDefs(tag) {
|
|
25
|
+
return (0, dom_1.stripNs)(tag) === 'defs';
|
|
26
|
+
}
|
|
27
|
+
function isGradient(tag) {
|
|
28
|
+
return GRADIENT_TAGS.has((0, dom_1.stripNs)(tag));
|
|
29
|
+
}
|
|
30
|
+
function isGroup(tag) {
|
|
31
|
+
return (0, dom_1.stripNs)(tag) === 'g';
|
|
32
|
+
}
|
|
33
|
+
function clamp(value, minv = 0.0, maxv = 1.0) {
|
|
34
|
+
return Math.max(Math.min(value, maxv), minv);
|
|
35
|
+
}
|
|
36
|
+
function elOpacity(el) {
|
|
37
|
+
return clamp(numberAttrib(el, 'opacity', 1));
|
|
38
|
+
}
|
|
39
|
+
// Groups with 0 < opacity < 1 and >1 child must be retained.
|
|
40
|
+
// This over-retains groups; no difference unless children overlap.
|
|
41
|
+
function isRemovableGroup(el) {
|
|
42
|
+
if (!isGroup(el.tag))
|
|
43
|
+
return false;
|
|
44
|
+
// no attributes makes a group meaningless
|
|
45
|
+
if (el.attrib.size === 0)
|
|
46
|
+
return true;
|
|
47
|
+
const numChildren = el.children.length;
|
|
48
|
+
const opacity = elOpacity(el);
|
|
49
|
+
return numChildren <= 1 || opacity === 0.0 || opacity === 1.0;
|
|
50
|
+
}
|
|
51
|
+
function tryRemoveGroup(groupEl, pushOpacity = true) {
|
|
52
|
+
const remove = isRemovableGroup(groupEl);
|
|
53
|
+
const opacity = elOpacity(groupEl);
|
|
54
|
+
if (remove) {
|
|
55
|
+
const children = [...groupEl.children];
|
|
56
|
+
if (groupEl.parent !== null) {
|
|
57
|
+
(0, dom_1.replaceEl)(groupEl, children);
|
|
58
|
+
}
|
|
59
|
+
if (pushOpacity) {
|
|
60
|
+
for (const child of children) {
|
|
61
|
+
(0, inherit_1.inheritAttrib)({ opacity: (0, geometry_1.ntos)(opacity) }, child);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
// We're keeping the group, but we promised groups only have opacity
|
|
67
|
+
groupEl.attrib.clear();
|
|
68
|
+
groupEl.attrib.set('opacity', (0, geometry_1.ntos)(opacity));
|
|
69
|
+
(0, inherit_1.dropDefaultAttrib)(groupEl.attrib);
|
|
70
|
+
}
|
|
71
|
+
return remove;
|
|
72
|
+
}
|
|
73
|
+
function elementTransform(el, currentTransform = transform_1.Affine2D.identity()) {
|
|
74
|
+
const attr = isGradient(el.tag) ? 'gradientTransform' : 'transform';
|
|
75
|
+
const raw = el.attrib.get(attr);
|
|
76
|
+
if (raw) {
|
|
77
|
+
return transform_1.Affine2D.composeLtr([transform_1.Affine2D.fromString(raw), currentTransform]);
|
|
78
|
+
}
|
|
79
|
+
return currentTransform;
|
|
80
|
+
}
|
|
81
|
+
function idOfTarget(url) {
|
|
82
|
+
const match = svgPatterns_1.URL_ID_REFERENCE.exec(url);
|
|
83
|
+
if (!match) {
|
|
84
|
+
throw new Error(`Unrecognized url "${url}"`);
|
|
85
|
+
}
|
|
86
|
+
return match[1];
|
|
87
|
+
}
|
|
88
|
+
function parseViewBox(s) {
|
|
89
|
+
const box = s
|
|
90
|
+
.split(svgPatterns_1.VIEWBOX_SEPARATOR)
|
|
91
|
+
.filter((v) => v)
|
|
92
|
+
.map((v) => parseFloat(v));
|
|
93
|
+
if (box.length !== 4 || box.some((v) => Number.isNaN(v))) {
|
|
94
|
+
throw new Error(`Unable to parse viewBox: ${s}`);
|
|
95
|
+
}
|
|
96
|
+
return { x: box[0], y: box[1], w: box[2], h: box[3] };
|
|
97
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const DEFAULT_ALMOST_EQUAL_TOLERANCE = 1e-9;
|
|
2
|
+
export type Pt = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function pt(x?: number, y?: number): Pt;
|
|
7
|
+
export declare function almostEqual(c1: number, c2: number, tolerance?: number): boolean;
|
|
8
|
+
export declare function ptEquals(a: Pt, b: Pt): boolean;
|
|
9
|
+
export declare function ptAlmostEquals(a: Pt, b: Pt, tolerance?: number): boolean;
|
|
10
|
+
export declare function ptSub(a: Pt, b: Pt): Pt;
|
|
11
|
+
export declare function ptAdd(a: Pt, b: Pt): Pt;
|
|
12
|
+
export declare function ptMul(a: Pt, scalar: number): Pt;
|
|
13
|
+
export declare function pythonRound(x: number, ndigits: number): number;
|
|
14
|
+
export declare function ntos(n: number): string;
|
|
15
|
+
export type Rect = {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
w: number;
|
|
19
|
+
h: number;
|
|
20
|
+
};
|
|
21
|
+
export declare function rectEmpty(r: Rect): boolean;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_ALMOST_EQUAL_TOLERANCE = void 0;
|
|
4
|
+
exports.pt = pt;
|
|
5
|
+
exports.almostEqual = almostEqual;
|
|
6
|
+
exports.ptEquals = ptEquals;
|
|
7
|
+
exports.ptAlmostEquals = ptAlmostEquals;
|
|
8
|
+
exports.ptSub = ptSub;
|
|
9
|
+
exports.ptAdd = ptAdd;
|
|
10
|
+
exports.ptMul = ptMul;
|
|
11
|
+
exports.pythonRound = pythonRound;
|
|
12
|
+
exports.ntos = ntos;
|
|
13
|
+
exports.rectEmpty = rectEmpty;
|
|
14
|
+
exports.DEFAULT_ALMOST_EQUAL_TOLERANCE = 1e-9;
|
|
15
|
+
function pt(x = 0, y = 0) {
|
|
16
|
+
return { x, y };
|
|
17
|
+
}
|
|
18
|
+
function almostEqual(c1, c2, tolerance = exports.DEFAULT_ALMOST_EQUAL_TOLERANCE) {
|
|
19
|
+
return Math.abs(c1 - c2) <= tolerance;
|
|
20
|
+
}
|
|
21
|
+
function ptEquals(a, b) {
|
|
22
|
+
return a.x === b.x && a.y === b.y;
|
|
23
|
+
}
|
|
24
|
+
function ptAlmostEquals(a, b, tolerance = exports.DEFAULT_ALMOST_EQUAL_TOLERANCE) {
|
|
25
|
+
return almostEqual(a.x, b.x, tolerance) && almostEqual(a.y, b.y, tolerance);
|
|
26
|
+
}
|
|
27
|
+
function ptSub(a, b) {
|
|
28
|
+
return { x: a.x - b.x, y: a.y - b.y };
|
|
29
|
+
}
|
|
30
|
+
function ptAdd(a, b) {
|
|
31
|
+
return { x: a.x + b.x, y: a.y + b.y };
|
|
32
|
+
}
|
|
33
|
+
function ptMul(a, scalar) {
|
|
34
|
+
return { x: a.x * scalar, y: a.y * scalar };
|
|
35
|
+
}
|
|
36
|
+
// Exact port of Python's round(x, ndigits): round-half-to-even computed on
|
|
37
|
+
// the exact binary value of the double, not on a decimal approximation.
|
|
38
|
+
// (Naive `Math.round(x * 10**n) / 10**n` mis-rounds e.g. 0.155 at 2 digits.)
|
|
39
|
+
function pythonRound(x, ndigits) {
|
|
40
|
+
if (!Number.isFinite(x) || (Number.isInteger(x) && ndigits >= 0)) {
|
|
41
|
+
return x;
|
|
42
|
+
}
|
|
43
|
+
// decompose the double into mantissa * 2^exp exactly
|
|
44
|
+
const buf = new DataView(new ArrayBuffer(8));
|
|
45
|
+
buf.setFloat64(0, x);
|
|
46
|
+
const bits = buf.getBigUint64(0);
|
|
47
|
+
const negative = bits >> 63n === 1n;
|
|
48
|
+
const expBits = Number((bits >> 52n) & 0x7ffn);
|
|
49
|
+
const fracBits = bits & 0xfffffffffffffn;
|
|
50
|
+
let mantissa;
|
|
51
|
+
let exp;
|
|
52
|
+
if (expBits === 0) {
|
|
53
|
+
mantissa = fracBits;
|
|
54
|
+
exp = -1074;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
mantissa = fracBits | (1n << 52n);
|
|
58
|
+
exp = expBits - 1075;
|
|
59
|
+
}
|
|
60
|
+
const pow10 = 10n ** BigInt(Math.abs(ndigits));
|
|
61
|
+
// want k = halfEven(x * 10^ndigits) as an exact integer
|
|
62
|
+
let num = mantissa * (ndigits >= 0 ? pow10 : 1n);
|
|
63
|
+
let den = ndigits >= 0 ? 1n : pow10;
|
|
64
|
+
if (exp >= 0) {
|
|
65
|
+
num <<= BigInt(exp);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
den <<= BigInt(-exp);
|
|
69
|
+
}
|
|
70
|
+
let k = num / den;
|
|
71
|
+
const rem = num % den;
|
|
72
|
+
const twice = rem * 2n;
|
|
73
|
+
if (twice > den || (twice === den && k % 2n === 1n)) {
|
|
74
|
+
k += 1n;
|
|
75
|
+
}
|
|
76
|
+
const scaled = ndigits >= 0 ? Number(k) / Number(pow10) : Number(k) * Number(pow10);
|
|
77
|
+
return negative ? -scaled : scaled;
|
|
78
|
+
}
|
|
79
|
+
function ntos(n) {
|
|
80
|
+
// strip superfluous .0 decimals; Python str(int(n)) for integral floats
|
|
81
|
+
return Object.is(n, -0) ? '0' : String(n);
|
|
82
|
+
}
|
|
83
|
+
function rectEmpty(r) {
|
|
84
|
+
return r.w === 0 || r.h === 0;
|
|
85
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flattenSvg = flattenSvg;
|
|
4
|
+
const document_1 = require("./document");
|
|
5
|
+
const pathops_1 = require("./pathops");
|
|
6
|
+
const stages_1 = require("./stages");
|
|
7
|
+
function flattenSvg(svgContent, pathkit) {
|
|
8
|
+
const doc = document_1.SvgDocument.parse(svgContent, (0, pathops_1.createPathOps)(pathkit));
|
|
9
|
+
(0, stages_1.flattenDocument)(doc);
|
|
10
|
+
return doc.serialize();
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { XEl } from './dom';
|
|
2
|
+
export declare const ATTRIB_DEFAULTS: Record<string, string | number>;
|
|
3
|
+
export declare function attribDefault(name: string): string | number;
|
|
4
|
+
export declare function attrName(fieldName: string): string;
|
|
5
|
+
export declare function fieldName(attr: string): string;
|
|
6
|
+
type Attrib = Record<string, string>;
|
|
7
|
+
export declare const INHERITABLE_ATTRIB: ReadonlySet<string>;
|
|
8
|
+
export declare const ATTRIB_W_CUSTOM_INHERITANCE: ReadonlySet<string>;
|
|
9
|
+
export declare const INHERITABLE_ATTRIB_DEFAULTS: Readonly<Attrib>;
|
|
10
|
+
export declare function inheritAttrib(attrib: Attrib | Map<string, string>, child: XEl, skipUnhandled?: boolean, skips?: ReadonlySet<string>): void;
|
|
11
|
+
export declare function attribToPassOn(currentAttrib: Attrib, el: XEl, skips?: ReadonlySet<string>): Attrib;
|
|
12
|
+
export declare function dropDefaultAttrib(attrib: Map<string, string>): void;
|
|
13
|
+
export {};
|