@antv/util 3.0.1 → 3.1.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/README.md +167 -4
- package/dist/util.min.js +1 -1
- package/esm/color/arr2rgb.js +3 -3
- package/esm/color/arr2rgb.js.map +1 -1
- package/esm/color/gradient.js +9 -9
- package/esm/color/gradient.js.map +1 -1
- package/esm/color/tocssgradient.js +18 -18
- package/esm/color/tocssgradient.js.map +1 -1
- package/esm/color/torgb.js +6 -6
- package/esm/color/torgb.js.map +1 -1
- package/esm/helper/to-radian.js +1 -1
- package/esm/helper/to-radian.js.map +1 -1
- package/esm/matrix/index.js +8 -8
- package/esm/matrix/index.js.map +1 -1
- package/esm/path/convert/path-2-absolute.d.ts +2 -0
- package/esm/path/convert/path-2-absolute.js +83 -0
- package/esm/path/convert/path-2-absolute.js.map +1 -0
- package/esm/path/convert/path-2-curve.d.ts +2 -0
- package/esm/path/convert/path-2-curve.js +56 -0
- package/esm/path/convert/path-2-curve.js.map +1 -0
- package/esm/path/convert/path-2-string.d.ts +6 -0
- package/esm/path/convert/path-2-string.js +11 -0
- package/esm/path/convert/path-2-string.js.map +1 -0
- package/esm/path/index.d.ts +17 -16
- package/esm/path/index.js +17 -16
- package/esm/path/index.js.map +1 -1
- package/esm/path/parser/finalize-segment.d.ts +5 -0
- package/esm/path/parser/finalize-segment.js +27 -0
- package/esm/path/parser/finalize-segment.js.map +1 -0
- package/esm/path/parser/is-arc-command.d.ts +4 -0
- package/esm/path/parser/is-arc-command.js +7 -0
- package/esm/path/parser/is-arc-command.js.map +1 -0
- package/esm/path/parser/is-digit-start.d.ts +6 -0
- package/esm/path/parser/is-digit-start.js +11 -0
- package/esm/path/parser/is-digit-start.js.map +1 -0
- package/esm/path/parser/is-path-command.d.ts +4 -0
- package/esm/path/parser/is-path-command.js +23 -0
- package/esm/path/parser/is-path-command.js.map +1 -0
- package/esm/path/parser/is-space.d.ts +4 -0
- package/esm/path/parser/is-space.js +22 -0
- package/esm/path/parser/is-space.js.map +1 -0
- package/esm/path/parser/params-count.d.ts +13 -0
- package/esm/path/parser/params-count.js +14 -0
- package/esm/path/parser/params-count.js.map +1 -0
- package/esm/path/parser/params-parser.d.ts +10 -0
- package/esm/path/parser/params-parser.js +11 -0
- package/esm/path/parser/params-parser.js.map +1 -0
- package/esm/path/parser/parse-path-string.d.ts +6 -0
- package/esm/path/parser/parse-path-string.js +21 -0
- package/esm/path/parser/parse-path-string.js.map +1 -0
- package/esm/path/parser/path-parser.d.ts +16 -0
- package/esm/path/parser/path-parser.js +18 -0
- package/esm/path/parser/path-parser.js.map +1 -0
- package/esm/path/parser/scan-flag.d.ts +6 -0
- package/esm/path/parser/scan-flag.js +20 -0
- package/esm/path/parser/scan-flag.js.map +1 -0
- package/esm/path/parser/scan-param.d.ts +6 -0
- package/esm/path/parser/scan-param.js +83 -0
- package/esm/path/parser/scan-param.js.map +1 -0
- package/esm/path/parser/scan-segment.d.ts +6 -0
- package/esm/path/parser/scan-segment.js +57 -0
- package/esm/path/parser/scan-segment.js.map +1 -0
- package/esm/path/parser/skip-spaces.d.ts +7 -0
- package/esm/path/parser/skip-spaces.js +13 -0
- package/esm/path/parser/skip-spaces.js.map +1 -0
- package/esm/path/process/arc-2-cubic.d.ts +7 -1
- package/esm/path/process/arc-2-cubic.js +276 -133
- package/esm/path/process/arc-2-cubic.js.map +1 -1
- package/esm/path/process/clone-path.d.ts +2 -0
- package/esm/path/process/clone-path.js +4 -0
- package/esm/path/process/clone-path.js.map +1 -0
- package/esm/path/process/fix-arc.d.ts +2 -0
- package/esm/path/process/fix-arc.js +16 -0
- package/esm/path/process/fix-arc.js.map +1 -0
- package/esm/path/process/line-2-cubic.js +17 -32
- package/esm/path/process/line-2-cubic.js.map +1 -1
- package/esm/path/process/normalize-path.d.ts +8 -0
- package/esm/path/process/normalize-path.js +35 -0
- package/esm/path/process/normalize-path.js.map +1 -0
- package/esm/path/process/normalize-segment.d.ts +6 -0
- package/esm/path/process/normalize-segment.js +42 -0
- package/esm/path/process/normalize-segment.js.map +1 -0
- package/esm/path/process/quad-2-cubic.js +2 -2
- package/esm/path/process/quad-2-cubic.js.map +1 -1
- package/esm/path/process/reverse-curve.d.ts +2 -0
- package/esm/path/process/reverse-curve.js +13 -0
- package/esm/path/process/reverse-curve.js.map +1 -0
- package/esm/path/process/round-path.d.ts +6 -0
- package/esm/path/process/round-path.js +20 -0
- package/esm/path/process/round-path.js.map +1 -0
- package/esm/path/process/segment-2-cubic.d.ts +2 -2
- package/esm/path/process/segment-2-cubic.js +23 -19
- package/esm/path/process/segment-2-cubic.js.map +1 -1
- package/esm/path/types.d.ts +114 -17
- package/esm/path/util/distance-square-root.d.ts +1 -0
- package/esm/path/util/distance-square-root.js +4 -0
- package/esm/path/util/distance-square-root.js.map +1 -0
- package/esm/path/util/equalize-segments.d.ts +2 -0
- package/esm/path/util/equalize-segments.js +68 -0
- package/esm/path/util/equalize-segments.js.map +1 -0
- package/esm/path/util/get-draw-direction.d.ts +2 -0
- package/esm/path/util/get-draw-direction.js +5 -0
- package/esm/path/util/get-draw-direction.js.map +1 -0
- package/esm/path/util/get-path-area.d.ts +8 -0
- package/esm/path/util/get-path-area.js +68 -0
- package/esm/path/util/get-path-area.js.map +1 -0
- package/esm/path/util/get-path-bbox-total-length.d.ts +5 -0
- package/esm/path/util/get-path-bbox-total-length.js +37 -0
- package/esm/path/util/get-path-bbox-total-length.js.map +1 -0
- package/esm/path/util/get-path-bbox.d.ts +5 -0
- package/esm/path/util/get-path-bbox.js +35 -0
- package/esm/path/util/get-path-bbox.js.map +1 -0
- package/esm/path/util/get-point-at-length.d.ts +5 -0
- package/esm/path/util/get-point-at-length.js +8 -0
- package/esm/path/util/get-point-at-length.js.map +1 -0
- package/esm/path/util/get-properties-at-length.d.ts +6 -0
- package/esm/path/util/get-properties-at-length.js +58 -0
- package/esm/path/util/get-properties-at-length.js.map +1 -0
- package/esm/path/util/get-properties-at-point.d.ts +7 -0
- package/esm/path/util/get-properties-at-point.js +69 -0
- package/esm/path/util/get-properties-at-point.js.map +1 -0
- package/esm/path/util/get-rotated-curve.d.ts +2 -0
- package/esm/path/util/get-rotated-curve.js +34 -0
- package/esm/path/util/get-rotated-curve.js.map +1 -0
- package/esm/path/util/get-total-length.d.ts +8 -0
- package/esm/path/util/get-total-length.js +11 -0
- package/esm/path/util/get-total-length.js.map +1 -0
- package/esm/path/util/is-absolute-array.d.ts +6 -0
- package/esm/path/util/is-absolute-array.js +11 -0
- package/esm/path/util/is-absolute-array.js.map +1 -0
- package/esm/path/util/is-curve-array.d.ts +9 -0
- package/esm/path/util/is-curve-array.js +12 -0
- package/esm/path/util/is-curve-array.js.map +1 -0
- package/esm/path/util/is-normalized-array.d.ts +7 -0
- package/esm/path/util/is-normalized-array.js +10 -0
- package/esm/path/util/is-normalized-array.js.map +1 -0
- package/esm/path/util/is-path-array.d.ts +5 -0
- package/esm/path/util/is-path-array.js +12 -0
- package/esm/path/util/is-path-array.js.map +1 -0
- package/esm/path/util/is-point-in-stroke.d.ts +5 -0
- package/esm/path/util/is-point-in-stroke.js +9 -0
- package/esm/path/util/is-point-in-stroke.js.map +1 -0
- package/esm/path/util/mid-point.d.ts +1 -0
- package/esm/path/util/mid-point.js +8 -0
- package/esm/path/util/mid-point.js.map +1 -0
- package/esm/path/util/path-length-factory.d.ts +7 -0
- package/esm/path/util/path-length-factory.js +94 -0
- package/esm/path/util/path-length-factory.js.map +1 -0
- package/esm/path/util/rotate-vector.d.ts +4 -0
- package/esm/path/util/rotate-vector.js +6 -0
- package/esm/path/util/rotate-vector.js.map +1 -0
- package/esm/path/util/segment-arc-factory.d.ts +6 -0
- package/esm/path/util/segment-arc-factory.js +135 -0
- package/esm/path/util/segment-arc-factory.js.map +1 -0
- package/esm/path/util/segment-cubic-factory.d.ts +6 -0
- package/esm/path/util/segment-cubic-factory.js +63 -0
- package/esm/path/util/segment-cubic-factory.js.map +1 -0
- package/esm/path/util/segment-line-factory.d.ts +6 -0
- package/esm/path/util/segment-line-factory.js +35 -0
- package/esm/path/util/segment-line-factory.js.map +1 -0
- package/esm/path/util/segment-quad-factory.d.ts +6 -0
- package/esm/path/util/segment-quad-factory.js +65 -0
- package/esm/path/util/segment-quad-factory.js.map +1 -0
- package/lib/color/arr2rgb.js +3 -3
- package/lib/color/arr2rgb.js.map +1 -1
- package/lib/color/gradient.js +12 -12
- package/lib/color/gradient.js.map +1 -1
- package/lib/color/tocssgradient.js +18 -18
- package/lib/color/tocssgradient.js.map +1 -1
- package/lib/color/torgb.js +7 -7
- package/lib/color/torgb.js.map +1 -1
- package/lib/helper/to-radian.js +1 -1
- package/lib/helper/to-radian.js.map +1 -1
- package/lib/matrix/index.js +9 -9
- package/lib/matrix/index.js.map +1 -1
- package/lib/path/convert/path-2-absolute.d.ts +2 -0
- package/lib/path/convert/path-2-absolute.js +87 -0
- package/lib/path/convert/path-2-absolute.js.map +1 -0
- package/lib/path/convert/path-2-curve.d.ts +2 -0
- package/lib/path/convert/path-2-curve.js +60 -0
- package/lib/path/convert/path-2-curve.js.map +1 -0
- package/lib/path/convert/path-2-string.d.ts +6 -0
- package/lib/path/convert/path-2-string.js +15 -0
- package/lib/path/convert/path-2-string.js.map +1 -0
- package/lib/path/index.d.ts +17 -16
- package/lib/path/index.js +42 -31
- package/lib/path/index.js.map +1 -1
- package/lib/path/parser/finalize-segment.d.ts +5 -0
- package/lib/path/parser/finalize-segment.js +31 -0
- package/lib/path/parser/finalize-segment.js.map +1 -0
- package/lib/path/parser/is-arc-command.d.ts +4 -0
- package/lib/path/parser/is-arc-command.js +11 -0
- package/lib/path/parser/is-arc-command.js.map +1 -0
- package/lib/path/parser/is-digit-start.d.ts +6 -0
- package/lib/path/parser/is-digit-start.js +16 -0
- package/lib/path/parser/is-digit-start.js.map +1 -0
- package/lib/path/parser/is-path-command.d.ts +4 -0
- package/lib/path/parser/is-path-command.js +27 -0
- package/lib/path/parser/is-path-command.js.map +1 -0
- package/lib/path/parser/is-space.d.ts +4 -0
- package/lib/path/parser/is-space.js +26 -0
- package/lib/path/parser/is-space.js.map +1 -0
- package/lib/path/parser/params-count.d.ts +13 -0
- package/lib/path/parser/params-count.js +17 -0
- package/lib/path/parser/params-count.js.map +1 -0
- package/lib/path/parser/params-parser.d.ts +10 -0
- package/lib/path/parser/params-parser.js +14 -0
- package/lib/path/parser/params-parser.js.map +1 -0
- package/lib/path/parser/parse-path-string.d.ts +6 -0
- package/lib/path/parser/parse-path-string.js +25 -0
- package/lib/path/parser/parse-path-string.js.map +1 -0
- package/lib/path/parser/path-parser.d.ts +16 -0
- package/lib/path/parser/path-parser.js +22 -0
- package/lib/path/parser/path-parser.js.map +1 -0
- package/lib/path/parser/scan-flag.d.ts +6 -0
- package/lib/path/parser/scan-flag.js +24 -0
- package/lib/path/parser/scan-flag.js.map +1 -0
- package/lib/path/parser/scan-param.d.ts +6 -0
- package/lib/path/parser/scan-param.js +87 -0
- package/lib/path/parser/scan-param.js.map +1 -0
- package/lib/path/parser/scan-segment.d.ts +6 -0
- package/lib/path/parser/scan-segment.js +61 -0
- package/lib/path/parser/scan-segment.js.map +1 -0
- package/lib/path/parser/skip-spaces.d.ts +7 -0
- package/lib/path/parser/skip-spaces.js +17 -0
- package/lib/path/parser/skip-spaces.js.map +1 -0
- package/lib/path/process/arc-2-cubic.d.ts +7 -1
- package/lib/path/process/arc-2-cubic.js +276 -133
- package/lib/path/process/arc-2-cubic.js.map +1 -1
- package/lib/path/process/clone-path.d.ts +2 -0
- package/lib/path/process/clone-path.js +8 -0
- package/lib/path/process/clone-path.js.map +1 -0
- package/lib/path/process/fix-arc.d.ts +2 -0
- package/lib/path/process/fix-arc.js +20 -0
- package/lib/path/process/fix-arc.js.map +1 -0
- package/lib/path/process/line-2-cubic.js +17 -32
- package/lib/path/process/line-2-cubic.js.map +1 -1
- package/lib/path/process/normalize-path.d.ts +8 -0
- package/lib/path/process/normalize-path.js +39 -0
- package/lib/path/process/normalize-path.js.map +1 -0
- package/lib/path/process/normalize-segment.d.ts +6 -0
- package/lib/path/process/normalize-segment.js +46 -0
- package/lib/path/process/normalize-segment.js.map +1 -0
- package/lib/path/process/quad-2-cubic.js +2 -2
- package/lib/path/process/quad-2-cubic.js.map +1 -1
- package/lib/path/process/reverse-curve.d.ts +2 -0
- package/lib/path/process/reverse-curve.js +17 -0
- package/lib/path/process/reverse-curve.js.map +1 -0
- package/lib/path/process/round-path.d.ts +6 -0
- package/lib/path/process/round-path.js +24 -0
- package/lib/path/process/round-path.js.map +1 -0
- package/lib/path/process/segment-2-cubic.d.ts +2 -2
- package/lib/path/process/segment-2-cubic.js +26 -22
- package/lib/path/process/segment-2-cubic.js.map +1 -1
- package/lib/path/types.d.ts +114 -17
- package/lib/path/util/distance-square-root.d.ts +1 -0
- package/lib/path/util/distance-square-root.js +8 -0
- package/lib/path/util/distance-square-root.js.map +1 -0
- package/lib/path/util/equalize-segments.d.ts +2 -0
- package/lib/path/util/equalize-segments.js +72 -0
- package/lib/path/util/equalize-segments.js.map +1 -0
- package/lib/path/util/get-draw-direction.d.ts +2 -0
- package/lib/path/util/get-draw-direction.js +9 -0
- package/lib/path/util/get-draw-direction.js.map +1 -0
- package/lib/path/util/get-path-area.d.ts +8 -0
- package/lib/path/util/get-path-area.js +72 -0
- package/lib/path/util/get-path-area.js.map +1 -0
- package/lib/path/util/get-path-bbox-total-length.d.ts +5 -0
- package/lib/path/util/get-path-bbox-total-length.js +41 -0
- package/lib/path/util/get-path-bbox-total-length.js.map +1 -0
- package/lib/path/util/get-path-bbox.d.ts +5 -0
- package/lib/path/util/get-path-bbox.js +39 -0
- package/lib/path/util/get-path-bbox.js.map +1 -0
- package/lib/path/util/get-point-at-length.d.ts +5 -0
- package/lib/path/util/get-point-at-length.js +12 -0
- package/lib/path/util/get-point-at-length.js.map +1 -0
- package/lib/path/util/get-properties-at-length.d.ts +6 -0
- package/lib/path/util/get-properties-at-length.js +62 -0
- package/lib/path/util/get-properties-at-length.js.map +1 -0
- package/lib/path/util/get-properties-at-point.d.ts +7 -0
- package/lib/path/util/get-properties-at-point.js +73 -0
- package/lib/path/util/get-properties-at-point.js.map +1 -0
- package/lib/path/util/get-rotated-curve.d.ts +2 -0
- package/lib/path/util/get-rotated-curve.js +38 -0
- package/lib/path/util/get-rotated-curve.js.map +1 -0
- package/lib/path/util/get-total-length.d.ts +8 -0
- package/lib/path/util/get-total-length.js +15 -0
- package/lib/path/util/get-total-length.js.map +1 -0
- package/lib/path/util/is-absolute-array.d.ts +6 -0
- package/lib/path/util/is-absolute-array.js +15 -0
- package/lib/path/util/is-absolute-array.js.map +1 -0
- package/lib/path/util/is-curve-array.d.ts +9 -0
- package/lib/path/util/is-curve-array.js +16 -0
- package/lib/path/util/is-curve-array.js.map +1 -0
- package/lib/path/util/is-normalized-array.d.ts +7 -0
- package/lib/path/util/is-normalized-array.js +14 -0
- package/lib/path/util/is-normalized-array.js.map +1 -0
- package/lib/path/util/is-path-array.d.ts +5 -0
- package/lib/path/util/is-path-array.js +16 -0
- package/lib/path/util/is-path-array.js.map +1 -0
- package/lib/path/util/is-point-in-stroke.d.ts +5 -0
- package/lib/path/util/is-point-in-stroke.js +13 -0
- package/lib/path/util/is-point-in-stroke.js.map +1 -0
- package/lib/path/util/mid-point.d.ts +1 -0
- package/lib/path/util/mid-point.js +12 -0
- package/lib/path/util/mid-point.js.map +1 -0
- package/lib/path/util/path-length-factory.d.ts +7 -0
- package/lib/path/util/path-length-factory.js +98 -0
- package/lib/path/util/path-length-factory.js.map +1 -0
- package/lib/path/util/rotate-vector.d.ts +4 -0
- package/lib/path/util/rotate-vector.js +10 -0
- package/lib/path/util/rotate-vector.js.map +1 -0
- package/lib/path/util/segment-arc-factory.d.ts +6 -0
- package/lib/path/util/segment-arc-factory.js +139 -0
- package/lib/path/util/segment-arc-factory.js.map +1 -0
- package/lib/path/util/segment-cubic-factory.d.ts +6 -0
- package/lib/path/util/segment-cubic-factory.js +67 -0
- package/lib/path/util/segment-cubic-factory.js.map +1 -0
- package/lib/path/util/segment-line-factory.d.ts +6 -0
- package/lib/path/util/segment-line-factory.js +39 -0
- package/lib/path/util/segment-line-factory.js.map +1 -0
- package/lib/path/util/segment-quad-factory.d.ts +6 -0
- package/lib/path/util/segment-quad-factory.js +69 -0
- package/lib/path/util/segment-quad-factory.js.map +1 -0
- package/package.json +1 -1
- package/src/path/convert/path-2-absolute.ts +90 -0
- package/src/path/convert/path-2-curve.ts +68 -0
- package/src/path/convert/path-2-string.ts +12 -0
- package/src/path/index.ts +18 -16
- package/src/path/parser/finalize-segment.ts +30 -0
- package/src/path/parser/is-arc-command.ts +6 -0
- package/src/path/parser/is-digit-start.ts +13 -0
- package/src/path/parser/is-path-command.ts +22 -0
- package/src/path/parser/is-space.ts +23 -0
- package/src/path/parser/params-count.ts +13 -0
- package/src/path/parser/params-parser.ts +10 -0
- package/src/path/parser/parse-path-string.ts +26 -0
- package/src/path/parser/path-parser.ts +35 -0
- package/src/path/parser/scan-flag.ts +24 -0
- package/src/path/parser/scan-param.ts +98 -0
- package/src/path/parser/scan-segment.ts +68 -0
- package/src/path/parser/skip-spaces.ts +14 -0
- package/src/path/process/arc-2-cubic.ts +332 -215
- package/src/path/process/clone-path.ts +5 -0
- package/src/path/process/fix-arc.ts +17 -0
- package/src/path/process/line-2-cubic.ts +17 -33
- package/src/path/process/normalize-path.ts +42 -0
- package/src/path/process/normalize-segment.ts +42 -0
- package/src/path/process/reverse-curve.ts +18 -0
- package/src/path/process/round-path.ts +22 -0
- package/src/path/process/segment-2-cubic.ts +28 -27
- package/src/path/types.ts +190 -17
- package/src/path/util/distance-square-root.ts +3 -0
- package/src/path/util/equalize-segments.ts +79 -0
- package/src/path/util/get-draw-direction.ts +6 -0
- package/src/path/util/get-path-area.ts +83 -0
- package/src/path/util/get-path-bbox-total-length.ts +45 -0
- package/src/path/util/get-path-bbox.ts +42 -0
- package/src/path/util/get-point-at-length.ts +9 -0
- package/src/path/util/get-properties-at-length.ts +65 -0
- package/src/path/util/get-properties-at-point.ts +73 -0
- package/src/path/util/get-rotated-curve.ts +42 -0
- package/src/path/util/get-total-length.ts +12 -0
- package/src/path/util/is-absolute-array.ts +14 -0
- package/src/path/util/is-curve-array.ts +13 -0
- package/src/path/util/is-normalized-array.ts +11 -0
- package/src/path/util/is-path-array.ts +15 -0
- package/src/path/util/is-point-in-stroke.ts +10 -0
- package/src/path/util/mid-point.ts +7 -0
- package/src/path/util/path-length-factory.ts +98 -0
- package/src/path/util/rotate-vector.ts +5 -0
- package/src/path/util/segment-arc-factory.ts +186 -0
- package/src/path/util/segment-cubic-factory.ts +92 -0
- package/src/path/util/segment-line-factory.ts +36 -0
- package/src/path/util/segment-quad-factory.ts +90 -0
- package/esm/path/catmull-rom-2-bezier.d.ts +0 -10
- package/esm/path/catmull-rom-2-bezier.js +0 -115
- package/esm/path/catmull-rom-2-bezier.js.map +0 -1
- package/esm/path/fill-path-by-diff.d.ts +0 -5
- package/esm/path/fill-path-by-diff.js +0 -110
- package/esm/path/fill-path-by-diff.js.map +0 -1
- package/esm/path/fill-path.d.ts +0 -1
- package/esm/path/fill-path.js +0 -129
- package/esm/path/fill-path.js.map +0 -1
- package/esm/path/format-path.d.ts +0 -1
- package/esm/path/format-path.js +0 -139
- package/esm/path/format-path.js.map +0 -1
- package/esm/path/get-arc-params.d.ts +0 -17
- package/esm/path/get-arc-params.js +0 -90
- package/esm/path/get-arc-params.js.map +0 -1
- package/esm/path/get-line-intersect.d.ts +0 -14
- package/esm/path/get-line-intersect.js +0 -33
- package/esm/path/get-line-intersect.js.map +0 -1
- package/esm/path/is-polygons-intersect.d.ts +0 -1
- package/esm/path/is-polygons-intersect.js +0 -81
- package/esm/path/is-polygons-intersect.js.map +0 -1
- package/esm/path/parse-path-array.d.ts +0 -1
- package/esm/path/parse-path-array.js +0 -5
- package/esm/path/parse-path-array.js.map +0 -1
- package/esm/path/parse-path-string.d.ts +0 -1
- package/esm/path/parse-path-string.js +0 -57
- package/esm/path/parse-path-string.js.map +0 -1
- package/esm/path/parse-path.d.ts +0 -1
- package/esm/path/parse-path.js +0 -33
- package/esm/path/parse-path.js.map +0 -1
- package/esm/path/path-2-absolute.d.ts +0 -1
- package/esm/path/path-2-absolute.js +0 -124
- package/esm/path/path-2-absolute.js.map +0 -1
- package/esm/path/path-2-curve.d.ts +0 -2
- package/esm/path/path-2-curve.js +0 -63
- package/esm/path/path-2-curve.js.map +0 -1
- package/esm/path/path-2-segments.d.ts +0 -1
- package/esm/path/path-2-segments.js +0 -138
- package/esm/path/path-2-segments.js.map +0 -1
- package/esm/path/path-intersection.d.ts +0 -9
- package/esm/path/path-intersection.js +0 -366
- package/esm/path/path-intersection.js.map +0 -1
- package/esm/path/point-in-polygon.d.ts +0 -5
- package/esm/path/point-in-polygon.js +0 -49
- package/esm/path/point-in-polygon.js.map +0 -1
- package/esm/path/rect-path.d.ts +0 -4
- package/esm/path/rect-path.js +0 -19
- package/esm/path/rect-path.js.map +0 -1
- package/lib/path/catmull-rom-2-bezier.d.ts +0 -10
- package/lib/path/catmull-rom-2-bezier.js +0 -119
- package/lib/path/catmull-rom-2-bezier.js.map +0 -1
- package/lib/path/fill-path-by-diff.d.ts +0 -5
- package/lib/path/fill-path-by-diff.js +0 -117
- package/lib/path/fill-path-by-diff.js.map +0 -1
- package/lib/path/fill-path.d.ts +0 -1
- package/lib/path/fill-path.js +0 -133
- package/lib/path/fill-path.js.map +0 -1
- package/lib/path/format-path.d.ts +0 -1
- package/lib/path/format-path.js +0 -143
- package/lib/path/format-path.js.map +0 -1
- package/lib/path/get-arc-params.d.ts +0 -17
- package/lib/path/get-arc-params.js +0 -95
- package/lib/path/get-arc-params.js.map +0 -1
- package/lib/path/get-line-intersect.d.ts +0 -14
- package/lib/path/get-line-intersect.js +0 -37
- package/lib/path/get-line-intersect.js.map +0 -1
- package/lib/path/is-polygons-intersect.d.ts +0 -1
- package/lib/path/is-polygons-intersect.js +0 -85
- package/lib/path/is-polygons-intersect.js.map +0 -1
- package/lib/path/parse-path-array.d.ts +0 -1
- package/lib/path/parse-path-array.js +0 -9
- package/lib/path/parse-path-array.js.map +0 -1
- package/lib/path/parse-path-string.d.ts +0 -1
- package/lib/path/parse-path-string.js +0 -61
- package/lib/path/parse-path-string.js.map +0 -1
- package/lib/path/parse-path.d.ts +0 -1
- package/lib/path/parse-path.js +0 -37
- package/lib/path/parse-path.js.map +0 -1
- package/lib/path/path-2-absolute.d.ts +0 -1
- package/lib/path/path-2-absolute.js +0 -128
- package/lib/path/path-2-absolute.js.map +0 -1
- package/lib/path/path-2-curve.d.ts +0 -2
- package/lib/path/path-2-curve.js +0 -67
- package/lib/path/path-2-curve.js.map +0 -1
- package/lib/path/path-2-segments.d.ts +0 -1
- package/lib/path/path-2-segments.js +0 -142
- package/lib/path/path-2-segments.js.map +0 -1
- package/lib/path/path-intersection.d.ts +0 -9
- package/lib/path/path-intersection.js +0 -370
- package/lib/path/path-intersection.js.map +0 -1
- package/lib/path/point-in-polygon.d.ts +0 -5
- package/lib/path/point-in-polygon.js +0 -53
- package/lib/path/point-in-polygon.js.map +0 -1
- package/lib/path/rect-path.d.ts +0 -4
- package/lib/path/rect-path.js +0 -23
- package/lib/path/rect-path.js.map +0 -1
- package/src/path/catmull-rom-2-bezier.ts +0 -141
- package/src/path/fill-path-by-diff.ts +0 -116
- package/src/path/fill-path.ts +0 -129
- package/src/path/format-path.ts +0 -142
- package/src/path/get-arc-params.ts +0 -102
- package/src/path/get-line-intersect.ts +0 -46
- package/src/path/is-polygons-intersect.ts +0 -95
- package/src/path/parse-path-array.ts +0 -5
- package/src/path/parse-path-string.ts +0 -62
- package/src/path/parse-path.ts +0 -34
- package/src/path/path-2-absolute.ts +0 -132
- package/src/path/path-2-curve.ts +0 -69
- package/src/path/path-2-segments.ts +0 -142
- package/src/path/path-intersection.ts +0 -419
- package/src/path/point-in-polygon.ts +0 -56
- package/src/path/rect-path.ts +0 -22
package/lib/color/torgb.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toRGB = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const arr2rgb_1 = require("./arr2rgb");
|
|
5
|
+
const RGB_REG = /rgba?\(([\s.,0-9]+)\)/;
|
|
6
6
|
/**
|
|
7
7
|
* 创建辅助 tag 取颜色
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
10
|
function createTmp() {
|
|
11
|
-
|
|
11
|
+
const i = document.createElement('i');
|
|
12
12
|
i.title = 'Web Colour Picker';
|
|
13
13
|
i.style.display = 'none';
|
|
14
14
|
document.body.appendChild(i);
|
|
15
15
|
return i;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
let iEl;
|
|
18
18
|
/**
|
|
19
19
|
* 将颜色转换到 rgb 的格式
|
|
20
20
|
* @param {color} color 颜色
|
|
@@ -30,9 +30,9 @@ function toRGB(color) {
|
|
|
30
30
|
iEl = createTmp();
|
|
31
31
|
}
|
|
32
32
|
iEl.style.color = color;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
let rst = document.defaultView.getComputedStyle(iEl, '').getPropertyValue('color');
|
|
34
|
+
const matches = RGB_REG.exec(rst);
|
|
35
|
+
const cArray = matches[1].split(/\s*,\s*/).map((s) => Number(s));
|
|
36
36
|
rst = (0, arr2rgb_1.arr2rgb)(cArray);
|
|
37
37
|
return rst;
|
|
38
38
|
}
|
package/lib/color/torgb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"torgb.js","sourceRoot":"src/","sources":["color/torgb.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"torgb.js","sourceRoot":"src/","sources":["color/torgb.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AAEpC,MAAM,OAAO,GAAG,uBAAuB,CAAC;AAExC;;;GAGG;AACH,SAAS,SAAS;IAChB,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC,CAAC,KAAK,GAAG,mBAAmB,CAAC;IAC9B,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC7B,OAAO,CAAC,CAAC;AACX,CAAC;AAED,IAAI,GAAgB,CAAC;AAErB;;;;GAIG;AACH,SAAgB,KAAK,CAAC,KAAa;IACjC,eAAe;IACf,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1C,OAAO,KAAK,CAAC;KACd;IAED,IAAI,CAAC,GAAG,EAAE;QACR,YAAY;QACZ,GAAG,GAAG,SAAS,EAAE,CAAC;KACnB;IAED,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IAExB,IAAI,GAAG,GAAG,QAAQ,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAEnF,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAa,CAAC;IAC9C,MAAM,MAAM,GAAa,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3E,GAAG,GAAG,IAAA,iBAAO,EAAC,MAAM,CAAC,CAAC;IAEtB,OAAO,GAAG,CAAC;AACb,CAAC;AArBD,sBAqBC"}
|
package/lib/helper/to-radian.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-radian.js","sourceRoot":"src/","sources":["helper/to-radian.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"to-radian.js","sourceRoot":"src/","sources":["helper/to-radian.ts"],"names":[],"mappings":";;;AAAA,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAE7B,SAAgB,QAAQ,CAAC,MAAc;IACrC,OAAO,MAAM,GAAG,MAAM,CAAC;AACzB,CAAC;AAFD,4BAEC"}
|
package/lib/matrix/index.js
CHANGED
|
@@ -4,19 +4,19 @@ exports.vertical = exports.angleTo = exports.direction = exports.transform = voi
|
|
|
4
4
|
/**
|
|
5
5
|
* @description 扩展方法,提供 gl-matrix 为提供的方法
|
|
6
6
|
* */
|
|
7
|
-
|
|
7
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
8
8
|
function leftTranslate(out, a, v) {
|
|
9
|
-
|
|
9
|
+
const transMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
10
10
|
gl_matrix_1.mat3.fromTranslation(transMat, v);
|
|
11
11
|
return gl_matrix_1.mat3.multiply(out, transMat, a);
|
|
12
12
|
}
|
|
13
13
|
function leftRotate(out, a, rad) {
|
|
14
|
-
|
|
14
|
+
const rotateMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
15
15
|
gl_matrix_1.mat3.fromRotation(rotateMat, rad);
|
|
16
16
|
return gl_matrix_1.mat3.multiply(out, rotateMat, a);
|
|
17
17
|
}
|
|
18
18
|
function leftScale(out, a, v) {
|
|
19
|
-
|
|
19
|
+
const scaleMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
20
20
|
gl_matrix_1.mat3.fromScaling(scaleMat, v);
|
|
21
21
|
return gl_matrix_1.mat3.multiply(out, scaleMat, a);
|
|
22
22
|
}
|
|
@@ -29,9 +29,9 @@ function leftMultiply(out, a, a1) {
|
|
|
29
29
|
* @param actions
|
|
30
30
|
*/
|
|
31
31
|
function transform(m, actions) {
|
|
32
|
-
|
|
33
|
-
for (
|
|
34
|
-
|
|
32
|
+
const matrix = m ? [].concat(m) : [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
33
|
+
for (let i = 0, len = actions.length; i < len; i++) {
|
|
34
|
+
const action = actions[i];
|
|
35
35
|
switch (action[0]) {
|
|
36
36
|
case 't':
|
|
37
37
|
leftTranslate(matrix, matrix, [action[1], action[2]]);
|
|
@@ -69,8 +69,8 @@ exports.direction = direction;
|
|
|
69
69
|
* @param direct
|
|
70
70
|
*/
|
|
71
71
|
function angleTo(v1, v2, direct) {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const ang = gl_matrix_1.vec2.angle(v1, v2);
|
|
73
|
+
const angleLargeThanPI = direction(v1, v2) >= 0;
|
|
74
74
|
if (direct) {
|
|
75
75
|
if (angleLargeThanPI) {
|
|
76
76
|
return Math.PI * 2 - ang;
|
package/lib/matrix/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["matrix/index.ts"],"names":[],"mappings":";;;AAAA;;KAEK;AACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["matrix/index.ts"],"names":[],"mappings":";;;AAAA;;KAEK;AACL,yCAAuC;AAIvC,SAAS,aAAa,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD,gBAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAClC,OAAO,gBAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG;IAC7B,MAAM,SAAS,GAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACxD,gBAAI,CAAC,YAA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AcC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,GAAa,EAAE,CAAW,EAAE,IAAa;IAChE,IAAI,IAAI,EAAE;QACR,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACd,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KACpB;SAAM;QACL,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACnB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KACf;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAVD,4BAUC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.path2Absolute = void 0;
|
|
4
|
+
const clone_path_1 = require("../process/clone-path");
|
|
5
|
+
const is_absolute_array_1 = require("../util/is-absolute-array");
|
|
6
|
+
const parse_path_string_1 = require("../parser/parse-path-string");
|
|
7
|
+
function path2Absolute(pathInput) {
|
|
8
|
+
if ((0, is_absolute_array_1.isAbsoluteArray)(pathInput)) {
|
|
9
|
+
return (0, clone_path_1.clonePath)(pathInput);
|
|
10
|
+
}
|
|
11
|
+
const path = (0, parse_path_string_1.parsePathString)(pathInput);
|
|
12
|
+
// if (!path || !path.length) {
|
|
13
|
+
// return [['M', 0, 0]];
|
|
14
|
+
// }
|
|
15
|
+
let x = 0;
|
|
16
|
+
let y = 0;
|
|
17
|
+
let mx = 0;
|
|
18
|
+
let my = 0;
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
return path.map((segment) => {
|
|
21
|
+
const values = segment.slice(1).map(Number);
|
|
22
|
+
const [pathCommand] = segment;
|
|
23
|
+
const absCommand = pathCommand.toUpperCase();
|
|
24
|
+
if (pathCommand === 'M') {
|
|
25
|
+
[x, y] = values;
|
|
26
|
+
mx = x;
|
|
27
|
+
my = y;
|
|
28
|
+
return ['M', x, y];
|
|
29
|
+
}
|
|
30
|
+
let absoluteSegment;
|
|
31
|
+
if (pathCommand !== absCommand) {
|
|
32
|
+
switch (absCommand) {
|
|
33
|
+
case 'A':
|
|
34
|
+
absoluteSegment = [
|
|
35
|
+
absCommand,
|
|
36
|
+
values[0],
|
|
37
|
+
values[1],
|
|
38
|
+
values[2],
|
|
39
|
+
values[3],
|
|
40
|
+
values[4],
|
|
41
|
+
values[5] + x,
|
|
42
|
+
values[6] + y,
|
|
43
|
+
];
|
|
44
|
+
break;
|
|
45
|
+
case 'V':
|
|
46
|
+
absoluteSegment = [absCommand, values[0] + y];
|
|
47
|
+
break;
|
|
48
|
+
case 'H':
|
|
49
|
+
absoluteSegment = [absCommand, values[0] + x];
|
|
50
|
+
break;
|
|
51
|
+
default: {
|
|
52
|
+
// use brakets for `eslint: no-case-declaration`
|
|
53
|
+
// https://stackoverflow.com/a/50753272/803358
|
|
54
|
+
const absValues = values.map((n, j) => n + (j % 2 ? y : x));
|
|
55
|
+
// for n, l, c, s, q, t
|
|
56
|
+
absoluteSegment = [absCommand, ...absValues];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
absoluteSegment = [absCommand, ...values];
|
|
62
|
+
}
|
|
63
|
+
const segLength = absoluteSegment.length;
|
|
64
|
+
switch (absCommand) {
|
|
65
|
+
case 'Z':
|
|
66
|
+
x = mx;
|
|
67
|
+
y = my;
|
|
68
|
+
break;
|
|
69
|
+
case 'H':
|
|
70
|
+
[, x] = absoluteSegment;
|
|
71
|
+
break;
|
|
72
|
+
case 'V':
|
|
73
|
+
[, y] = absoluteSegment;
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
x = absoluteSegment[segLength - 2];
|
|
77
|
+
y = absoluteSegment[segLength - 1];
|
|
78
|
+
if (absCommand === 'M') {
|
|
79
|
+
mx = x;
|
|
80
|
+
my = y;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return absoluteSegment;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
exports.path2Absolute = path2Absolute;
|
|
87
|
+
//# sourceMappingURL=path-2-absolute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-2-absolute.js","sourceRoot":"src/","sources":["path/convert/path-2-absolute.ts"],"names":[],"mappings":";;;AAAA,sDAAkD;AAClD,iEAA4D;AAC5D,mEAA8D;AAG9D,SAAgB,aAAa,CAAC,SAA6B;IACzD,IAAI,IAAA,mCAAe,EAAC,SAAS,CAAC,EAAE;QAC9B,OAAO,IAAA,sBAAS,EAAC,SAAS,CAAkB,CAAC;KAC9C;IAED,MAAM,IAAI,GAAG,IAAA,mCAAe,EAAC,SAAsB,CAAc,CAAC;IAElE,+BAA+B;IAC/B,0BAA0B;IAC1B,IAAI;IACJ,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,IAAI,EAAE,GAAG,CAAC,CAAC;IAEX,aAAa;IACb,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5C,MAAM,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC;QAC9B,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;QAE7C,IAAI,WAAW,KAAK,GAAG,EAAE;YACvB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC;YAChB,EAAE,GAAG,CAAC,CAAC;YACP,EAAE,GAAG,CAAC,CAAC;YACP,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SACpB;QACD,IAAI,eAAgC,CAAC;QA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AAG,eAAe,CAAC;gBACxB,MAAM;YACR,KAAK,GAAG;gBACN,CAAC,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC;gBACxB,MAAM;YACR;gBACE,CAAC,GAAG,eAAe,CAAC,SAAS,GAAG,CAAC,CAAW,CAAC;gBAC7C,CAAC,GAAG,eAAe,CAAC,SAAS,GAAG,CAAC,CAAW,CAAC;gBAE7C,IAAI,UAAU,KAAK,GAAG,EAAE;oBACtB,EAAE,GAAG,CAAC,CAAC;oBACP,EAAE,GAAG,CAAC,CAAC;iBACR;SACJ;QACD,OAAO,eAAe,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AApFD,sCAoFC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.path2Curve = void 0;
|
|
4
|
+
const params_parser_1 = require("../parser/params-parser");
|
|
5
|
+
const clone_path_1 = require("../process/clone-path");
|
|
6
|
+
const fix_arc_1 = require("../process/fix-arc");
|
|
7
|
+
const normalize_path_1 = require("../process/normalize-path");
|
|
8
|
+
const is_curve_array_1 = require("../util/is-curve-array");
|
|
9
|
+
const segment_2_cubic_1 = require("../process/segment-2-cubic");
|
|
10
|
+
// import { fixPath } from '../process/fix-path';
|
|
11
|
+
function path2Curve(pathInput, needZCommandIndexes = false) {
|
|
12
|
+
if ((0, is_curve_array_1.isCurveArray)(pathInput)) {
|
|
13
|
+
const cloned = (0, clone_path_1.clonePath)(pathInput);
|
|
14
|
+
if (needZCommandIndexes) {
|
|
15
|
+
return [cloned, []];
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return cloned;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// fixPath will remove 'Z' command
|
|
22
|
+
// const path = fixPath(normalizePath(pathInput));
|
|
23
|
+
const path = (0, normalize_path_1.normalizePath)(pathInput);
|
|
24
|
+
const params = Object.assign({}, params_parser_1.paramsParser);
|
|
25
|
+
const allPathCommands = [];
|
|
26
|
+
let pathCommand = '';
|
|
27
|
+
let ii = path.length;
|
|
28
|
+
let segment;
|
|
29
|
+
let seglen;
|
|
30
|
+
const zCommandIndexes = [];
|
|
31
|
+
for (let i = 0; i < ii; i += 1) {
|
|
32
|
+
if (path[i])
|
|
33
|
+
[pathCommand] = path[i];
|
|
34
|
+
allPathCommands[i] = pathCommand;
|
|
35
|
+
const curveSegment = (0, segment_2_cubic_1.segmentToCubic)(path[i], params);
|
|
36
|
+
path[i] = curveSegment;
|
|
37
|
+
(0, fix_arc_1.fixArc)(path, allPathCommands, i);
|
|
38
|
+
ii = path.length; // solves curveArrays ending in Z
|
|
39
|
+
// keep Z command account for lineJoin
|
|
40
|
+
// @see https://github.com/antvis/util/issues/68
|
|
41
|
+
if (pathCommand === 'Z') {
|
|
42
|
+
zCommandIndexes.push(i);
|
|
43
|
+
}
|
|
44
|
+
segment = path[i];
|
|
45
|
+
seglen = segment.length;
|
|
46
|
+
params.x1 = +segment[seglen - 2];
|
|
47
|
+
params.y1 = +segment[seglen - 1];
|
|
48
|
+
params.x2 = +segment[seglen - 4] || params.x1;
|
|
49
|
+
params.y2 = +segment[seglen - 3] || params.y1;
|
|
50
|
+
}
|
|
51
|
+
// validate
|
|
52
|
+
if (needZCommandIndexes) {
|
|
53
|
+
return [path, zCommandIndexes];
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return path;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.path2Curve = path2Curve;
|
|
60
|
+
//# sourceMappingURL=path-2-curve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-2-curve.js","sourceRoot":"src/","sources":["path/convert/path-2-curve.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AACvD,sDAAkD;AAClD,gDAA4C;AAC5C,8DAA0D;AAC1D,2DAAsD;AACtD,gEAA4D;AAE5D,iDAAiD;AAEjD,SAAgB,UAAU,CACxB,SA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OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAExB,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC;QAC9C,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC;KAC/C;IAED,WAAW;IAEX,IAAI,mBAAmB,EAAE;QACvB,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;KAChC;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AA1DD,gCA0DC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.path2String = void 0;
|
|
4
|
+
const round_path_1 = require("../process/round-path");
|
|
5
|
+
/**
|
|
6
|
+
* Returns a valid `d` attribute string value created
|
|
7
|
+
* by rounding values and concatenating the `pathArray` segments.
|
|
8
|
+
*/
|
|
9
|
+
function path2String(path, round = 'off') {
|
|
10
|
+
return (0, round_path_1.roundPath)(path, round)
|
|
11
|
+
.map((x) => x[0] + x.slice(1).join(' '))
|
|
12
|
+
.join('');
|
|
13
|
+
}
|
|
14
|
+
exports.path2String = path2String;
|
|
15
|
+
//# sourceMappingURL=path-2-string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-2-string.js","sourceRoot":"src/","sources":["path/convert/path-2-string.ts"],"names":[],"mappings":";;;AAAA,sDAAkD;AAGlD;;;GAGG;AACH,SAAgB,WAAW,CAAC,IAAe,EAAE,QAAwB,KAAK;IACxE,OAAO,IAAA,sBAAS,EAAC,IAAI,EAAE,KAAK,CAAC;SAC1B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACvC,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAJD,kCAIC"}
|
package/lib/path/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
1
|
+
export { path2String } from './convert/path-2-string';
|
|
2
|
+
export { path2Curve } from './convert/path-2-curve';
|
|
3
|
+
export { path2Absolute } from './convert/path-2-absolute';
|
|
4
|
+
export { clonePath } from './process/clone-path';
|
|
5
|
+
export { normalizePath } from './process/normalize-path';
|
|
6
|
+
export { reverseCurve } from './process/reverse-curve';
|
|
7
|
+
export { getPathBBox } from './util/get-path-bbox';
|
|
8
|
+
export { getTotalLength } from './util/get-total-length';
|
|
9
|
+
export { getPathBBoxTotalLength } from './util/get-path-bbox-total-length';
|
|
10
|
+
export { getRotatedCurve } from './util/get-rotated-curve';
|
|
11
|
+
export { getPathArea } from './util/get-path-area';
|
|
12
|
+
export { getDrawDirection } from './util/get-draw-direction';
|
|
13
|
+
export { getPointAtLength } from './util/get-point-at-length';
|
|
14
|
+
export { isPointInStroke } from './util/is-point-in-stroke';
|
|
15
|
+
export { distanceSquareRoot } from './util/distance-square-root';
|
|
16
|
+
export { equalizeSegments } from './util/equalize-segments';
|
|
17
|
+
export * from './types';
|
package/lib/path/index.js
CHANGED
|
@@ -1,36 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "catmullRom2Bezier", { enumerable: true, get: function () { return catmull_rom_2_bezier_1.catmullRom2Bezier; } });
|
|
8
|
-
var fill_path_1 = require("./fill-path");
|
|
9
|
-
Object.defineProperty(exports, "fillPath", { enumerable: true, get: function () { return fill_path_1.fillPath; } });
|
|
10
|
-
var fill_path_by_diff_1 = require("./fill-path-by-diff");
|
|
11
|
-
Object.defineProperty(exports, "fillPathByDiff", { enumerable: true, get: function () { return fill_path_by_diff_1.fillPathByDiff; } });
|
|
12
|
-
var format_path_1 = require("./format-path");
|
|
13
|
-
Object.defineProperty(exports, "formatPath", { enumerable: true, get: function () { return format_path_1.formatPath; } });
|
|
14
|
-
var path_intersection_1 = require("./path-intersection");
|
|
15
|
-
Object.defineProperty(exports, "pathIntersection", { enumerable: true, get: function () { return path_intersection_1.pathIntersection; } });
|
|
16
|
-
var parse_path_array_1 = require("./parse-path-array");
|
|
17
|
-
Object.defineProperty(exports, "parsePathArray", { enumerable: true, get: function () { return parse_path_array_1.parsePathArray; } });
|
|
18
|
-
var parse_path_string_1 = require("./parse-path-string");
|
|
19
|
-
Object.defineProperty(exports, "parsePathString", { enumerable: true, get: function () { return parse_path_string_1.parsePathString; } });
|
|
20
|
-
var path_2_curve_1 = require("./path-2-curve");
|
|
13
|
+
exports.equalizeSegments = exports.distanceSquareRoot = exports.isPointInStroke = exports.getPointAtLength = exports.getDrawDirection = exports.getPathArea = exports.getRotatedCurve = exports.getPathBBoxTotalLength = exports.getTotalLength = exports.getPathBBox = exports.reverseCurve = exports.normalizePath = exports.clonePath = exports.path2Absolute = exports.path2Curve = exports.path2String = void 0;
|
|
14
|
+
var path_2_string_1 = require("./convert/path-2-string");
|
|
15
|
+
Object.defineProperty(exports, "path2String", { enumerable: true, get: function () { return path_2_string_1.path2String; } });
|
|
16
|
+
var path_2_curve_1 = require("./convert/path-2-curve");
|
|
21
17
|
Object.defineProperty(exports, "path2Curve", { enumerable: true, get: function () { return path_2_curve_1.path2Curve; } });
|
|
22
|
-
var path_2_absolute_1 = require("./path-2-absolute");
|
|
18
|
+
var path_2_absolute_1 = require("./convert/path-2-absolute");
|
|
23
19
|
Object.defineProperty(exports, "path2Absolute", { enumerable: true, get: function () { return path_2_absolute_1.path2Absolute; } });
|
|
24
|
-
var
|
|
25
|
-
Object.defineProperty(exports, "
|
|
26
|
-
var
|
|
27
|
-
Object.defineProperty(exports, "
|
|
28
|
-
var
|
|
29
|
-
Object.defineProperty(exports, "
|
|
30
|
-
var
|
|
31
|
-
Object.defineProperty(exports, "
|
|
32
|
-
var
|
|
33
|
-
Object.defineProperty(exports, "
|
|
34
|
-
var
|
|
35
|
-
Object.defineProperty(exports, "
|
|
20
|
+
var clone_path_1 = require("./process/clone-path");
|
|
21
|
+
Object.defineProperty(exports, "clonePath", { enumerable: true, get: function () { return clone_path_1.clonePath; } });
|
|
22
|
+
var normalize_path_1 = require("./process/normalize-path");
|
|
23
|
+
Object.defineProperty(exports, "normalizePath", { enumerable: true, get: function () { return normalize_path_1.normalizePath; } });
|
|
24
|
+
var reverse_curve_1 = require("./process/reverse-curve");
|
|
25
|
+
Object.defineProperty(exports, "reverseCurve", { enumerable: true, get: function () { return reverse_curve_1.reverseCurve; } });
|
|
26
|
+
var get_path_bbox_1 = require("./util/get-path-bbox");
|
|
27
|
+
Object.defineProperty(exports, "getPathBBox", { enumerable: true, get: function () { return get_path_bbox_1.getPathBBox; } });
|
|
28
|
+
var get_total_length_1 = require("./util/get-total-length");
|
|
29
|
+
Object.defineProperty(exports, "getTotalLength", { enumerable: true, get: function () { return get_total_length_1.getTotalLength; } });
|
|
30
|
+
var get_path_bbox_total_length_1 = require("./util/get-path-bbox-total-length");
|
|
31
|
+
Object.defineProperty(exports, "getPathBBoxTotalLength", { enumerable: true, get: function () { return get_path_bbox_total_length_1.getPathBBoxTotalLength; } });
|
|
32
|
+
var get_rotated_curve_1 = require("./util/get-rotated-curve");
|
|
33
|
+
Object.defineProperty(exports, "getRotatedCurve", { enumerable: true, get: function () { return get_rotated_curve_1.getRotatedCurve; } });
|
|
34
|
+
var get_path_area_1 = require("./util/get-path-area");
|
|
35
|
+
Object.defineProperty(exports, "getPathArea", { enumerable: true, get: function () { return get_path_area_1.getPathArea; } });
|
|
36
|
+
var get_draw_direction_1 = require("./util/get-draw-direction");
|
|
37
|
+
Object.defineProperty(exports, "getDrawDirection", { enumerable: true, get: function () { return get_draw_direction_1.getDrawDirection; } });
|
|
38
|
+
var get_point_at_length_1 = require("./util/get-point-at-length");
|
|
39
|
+
Object.defineProperty(exports, "getPointAtLength", { enumerable: true, get: function () { return get_point_at_length_1.getPointAtLength; } });
|
|
40
|
+
var is_point_in_stroke_1 = require("./util/is-point-in-stroke");
|
|
41
|
+
Object.defineProperty(exports, "isPointInStroke", { enumerable: true, get: function () { return is_point_in_stroke_1.isPointInStroke; } });
|
|
42
|
+
var distance_square_root_1 = require("./util/distance-square-root");
|
|
43
|
+
Object.defineProperty(exports, "distanceSquareRoot", { enumerable: true, get: function () { return distance_square_root_1.distanceSquareRoot; } });
|
|
44
|
+
var equalize_segments_1 = require("./util/equalize-segments");
|
|
45
|
+
Object.defineProperty(exports, "equalizeSegments", { enumerable: true, get: function () { return equalize_segments_1.equalizeSegments; } });
|
|
46
|
+
__exportStar(require("./types"), exports);
|
|
36
47
|
//# sourceMappingURL=index.js.map
|
package/lib/path/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["path/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["path/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yDAAsD;AAA7C,4GAAA,WAAW,OAAA;AACpB,uDAAoD;AAA3C,0GAAA,UAAU,OAAA;AACnB,6DAA0D;AAAjD,gHAAA,aAAa,OAAA;AACtB,mDAAiD;AAAxC,uGAAA,SAAS,OAAA;AAClB,2DAAyD;AAAhD,+GAAA,aAAa,OAAA;AACtB,yDAAuD;AAA9C,6GAAA,YAAY,OAAA;AACrB,sDAAmD;AAA1C,4GAAA,WAAW,OAAA;AACpB,4DAAyD;AAAhD,kHAAA,cAAc,OAAA;AACvB,gFAA2E;AAAlE,oIAAA,sBAAsB,OAAA;AAC/B,8DAA2D;AAAlD,oHAAA,eAAe,OAAA;AACxB,sDAAmD;AAA1C,4GAAA,WAAW,OAAA;AACpB,gEAA6D;AAApD,sHAAA,gBAAgB,OAAA;AACzB,kEAA8D;AAArD,uHAAA,gBAAgB,OAAA;AACzB,gEAA4D;AAAnD,qHAAA,eAAe,OAAA;AACxB,oEAAiE;AAAxD,0HAAA,kBAAkB,OAAA;AAC3B,8DAA4D;AAAnD,qHAAA,gBAAgB,OAAA;AAEzB,0CAAwB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.finalizeSegment = void 0;
|
|
4
|
+
const params_count_1 = require("./params-count");
|
|
5
|
+
/**
|
|
6
|
+
* Breaks the parsing of a pathString once a segment is finalized.
|
|
7
|
+
*/
|
|
8
|
+
function finalizeSegment(path) {
|
|
9
|
+
let pathCommand = path.pathValue[path.segmentStart];
|
|
10
|
+
let LK = pathCommand.toLowerCase();
|
|
11
|
+
const { data } = path;
|
|
12
|
+
while (data.length >= params_count_1.paramsCount[LK]) {
|
|
13
|
+
// overloaded `moveTo`
|
|
14
|
+
// https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts
|
|
15
|
+
if (LK === 'm' && data.length > 2) {
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
path.segments.push([pathCommand, ...data.splice(0, 2)]);
|
|
18
|
+
LK = 'l';
|
|
19
|
+
pathCommand = pathCommand === 'm' ? 'l' : 'L';
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
path.segments.push([pathCommand, ...data.splice(0, params_count_1.paramsCount[LK])]);
|
|
24
|
+
}
|
|
25
|
+
if (!params_count_1.paramsCount[LK]) {
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.finalizeSegment = finalizeSegment;
|
|
31
|
+
//# sourceMappingURL=finalize-segment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalize-segment.js","sourceRoot":"src/","sources":["path/parser/finalize-segment.ts"],"names":[],"mappings":";;;AACA,iDAA6C;AAG7C;;GAEG;AACH,SAAgB,eAAe,CAAC,IAAgB;IAC9C,IAAI,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAgB,CAAC;IACnE,IAAI,EAAE,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;IACnC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEtB,OAAO,IAAI,CAAC,MAAM,IAAI,0BAAW,CAAC,EAAE,CAAC,EAAE;QACrC,sBAAsB;QACtB,2EAA2E;QAC3E,IAAI,EAAE,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACjC,aAAa;YACb,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACxD,EAAE,GAAG,GAAG,CAAC;YACT,WAAW,GAAG,WAAW,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;SAC/C;aAAM;YACL,aAAa;YACb,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,0BAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SACvE;QAED,IAAI,CAAC,0BAAW,CAAC,EAAE,CAAC,EAAE;YACpB,MAAM;SACP;KACF;AACH,CAAC;AAtBD,0CAsBC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isArcCommand = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the character is an A (arc-to) path command.
|
|
6
|
+
*/
|
|
7
|
+
function isArcCommand(code) {
|
|
8
|
+
return (code | 0x20) === 0x61;
|
|
9
|
+
}
|
|
10
|
+
exports.isArcCommand = isArcCommand;
|
|
11
|
+
//# sourceMappingURL=is-arc-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-arc-command.js","sourceRoot":"src/","sources":["path/parser/is-arc-command.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;AAChC,CAAC;AAFD,oCAEC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDigit = exports.isDigitStart = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the character is or belongs to a number.
|
|
6
|
+
* [0-9]|+|-|.
|
|
7
|
+
*/
|
|
8
|
+
function isDigitStart(code) {
|
|
9
|
+
return ((code >= 48 && code <= 57) /* 0..9 */ || code === 0x2b /* + */ || code === 0x2d /* - */ || code === 0x2e); /* . */
|
|
10
|
+
}
|
|
11
|
+
exports.isDigitStart = isDigitStart;
|
|
12
|
+
function isDigit(code) {
|
|
13
|
+
return code >= 48 && code <= 57; // 0..9
|
|
14
|
+
}
|
|
15
|
+
exports.isDigit = isDigit;
|
|
16
|
+
//# sourceMappingURL=is-digit-start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-digit-start.js","sourceRoot":"src/","sources":["path/parser/is-digit-start.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,CACL,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,UAAU,IAAI,IAAI,KAAK,IAAI,CAAC,OAAO,IAAI,IAAI,KAAK,IAAI,CAAC,OAAO,IAAI,IAAI,KAAK,IAAI,CACzG,CAAC,CAAC,OAAO;AACZ,CAAC;AAJD,oCAIC;AAED,SAAgB,OAAO,CAAC,IAAY;IAClC,OAAO,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO;AAC1C,CAAC;AAFD,0BAEC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPathCommand = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the character is a path command.
|
|
6
|
+
*/
|
|
7
|
+
function isPathCommand(code) {
|
|
8
|
+
// eslint-disable-next-line no-bitwise -- Impossible to satisfy
|
|
9
|
+
switch (code | 0x20) {
|
|
10
|
+
case 0x6d /* m */:
|
|
11
|
+
case 0x7a /* z */:
|
|
12
|
+
case 0x6c /* l */:
|
|
13
|
+
case 0x68 /* h */:
|
|
14
|
+
case 0x76 /* v */:
|
|
15
|
+
case 0x63 /* c */:
|
|
16
|
+
case 0x73 /* s */:
|
|
17
|
+
case 0x71 /* q */:
|
|
18
|
+
case 0x74 /* t */:
|
|
19
|
+
case 0x61 /* a */:
|
|
20
|
+
// case 0x72/* r */:
|
|
21
|
+
return true;
|
|
22
|
+
default:
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.isPathCommand = isPathCommand;
|
|
27
|
+
//# sourceMappingURL=is-path-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-path-command.js","sourceRoot":"src/","sources":["path/parser/is-path-command.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,+DAA+D;IAC/D,QAAQ,IAAI,GAAG,IAAI,EAAE;QACnB,KAAK,IAAI,CAAC,OAAO,CAAC;QAClB,KAAK,IAAI,CAAC,OAAO,CAAC;QAClB,KAAK,IAAI,CAAC,OAAO,CAAC;QAClB,KAAK,IAAI,CAAC,OAAO,CAAC;QAClB,KAAK,IAAI,CAAC,OAAO,CAAC;QAClB,KAAK,IAAI,CAAC,OAAO,CAAC;QAClB,KAAK,IAAI,CAAC,OAAO,CAAC;QAClB,KAAK,IAAI,CAAC,OAAO,CAAC;QAClB,KAAK,IAAI,CAAC,OAAO,CAAC;QAClB,KAAK,IAAI,CAAC,OAAO;YACf,oBAAoB;YACpB,OAAO,IAAI,CAAC;QACd;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC;AAlBD,sCAkBC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSpace = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the character is a space.
|
|
6
|
+
*/
|
|
7
|
+
function isSpace(ch) {
|
|
8
|
+
const specialSpaces = [
|
|
9
|
+
0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x202f,
|
|
10
|
+
0x205f, 0x3000, 0xfeff,
|
|
11
|
+
];
|
|
12
|
+
/* istanbul ignore next */
|
|
13
|
+
return (ch === 0x0a ||
|
|
14
|
+
ch === 0x0d ||
|
|
15
|
+
ch === 0x2028 ||
|
|
16
|
+
ch === 0x2029 || // Line terminators
|
|
17
|
+
// White spaces
|
|
18
|
+
ch === 0x20 ||
|
|
19
|
+
ch === 0x09 ||
|
|
20
|
+
ch === 0x0b ||
|
|
21
|
+
ch === 0x0c ||
|
|
22
|
+
ch === 0xa0 ||
|
|
23
|
+
(ch >= 0x1680 && specialSpaces.includes(ch)));
|
|
24
|
+
}
|
|
25
|
+
exports.isSpace = isSpace;
|
|
26
|
+
//# sourceMappingURL=is-space.js.map
|