@emasoft/svg-matrix 1.0.27 → 1.0.29

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.
Files changed (46) hide show
  1. package/README.md +325 -0
  2. package/bin/svg-matrix.js +994 -378
  3. package/bin/svglinter.cjs +4172 -433
  4. package/bin/svgm.js +744 -184
  5. package/package.json +16 -4
  6. package/src/animation-references.js +71 -52
  7. package/src/arc-length.js +160 -96
  8. package/src/bezier-analysis.js +257 -117
  9. package/src/bezier-intersections.js +411 -148
  10. package/src/browser-verify.js +240 -100
  11. package/src/clip-path-resolver.js +350 -142
  12. package/src/convert-path-data.js +279 -134
  13. package/src/css-specificity.js +78 -70
  14. package/src/flatten-pipeline.js +751 -263
  15. package/src/geometry-to-path.js +511 -182
  16. package/src/index.js +191 -46
  17. package/src/inkscape-support.js +404 -0
  18. package/src/marker-resolver.js +278 -164
  19. package/src/mask-resolver.js +209 -98
  20. package/src/matrix.js +147 -67
  21. package/src/mesh-gradient.js +187 -96
  22. package/src/off-canvas-detection.js +201 -104
  23. package/src/path-analysis.js +187 -107
  24. package/src/path-data-plugins.js +628 -167
  25. package/src/path-simplification.js +0 -1
  26. package/src/pattern-resolver.js +125 -88
  27. package/src/polygon-clip.js +111 -66
  28. package/src/svg-boolean-ops.js +194 -118
  29. package/src/svg-collections.js +48 -19
  30. package/src/svg-flatten.js +282 -164
  31. package/src/svg-parser.js +427 -200
  32. package/src/svg-rendering-context.js +147 -104
  33. package/src/svg-toolbox.js +16411 -3298
  34. package/src/svg2-polyfills.js +114 -245
  35. package/src/transform-decomposition.js +46 -41
  36. package/src/transform-optimization.js +89 -68
  37. package/src/transforms2d.js +49 -16
  38. package/src/transforms3d.js +58 -22
  39. package/src/use-symbol-resolver.js +150 -110
  40. package/src/vector.js +67 -15
  41. package/src/vendor/README.md +110 -0
  42. package/src/vendor/inkscape-hatch-polyfill.js +401 -0
  43. package/src/vendor/inkscape-hatch-polyfill.min.js +8 -0
  44. package/src/vendor/inkscape-mesh-polyfill.js +843 -0
  45. package/src/vendor/inkscape-mesh-polyfill.min.js +8 -0
  46. package/src/verification.js +288 -124
@@ -102,7 +102,9 @@ export const referencesProps = new Set([
102
102
 
103
103
  export const elemsGroups = {
104
104
  animation: new Set([
105
- 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'set'
105
+ // Include both mixed-case and lowercase for case-insensitive matching
106
+ 'animate', 'animateColor', 'animatecolor', 'animateMotion', 'animatemotion',
107
+ 'animateTransform', 'animatetransform', 'set'
106
108
  ]),
107
109
  descriptive: new Set([
108
110
  'desc', 'metadata', 'title'
@@ -117,8 +119,10 @@ export const elemsGroups = {
117
119
  'hatch', 'linearGradient', 'meshGradient', 'pattern', 'radialGradient', 'solidColor'
118
120
  ]),
119
121
  nonRendering: new Set([
120
- 'clipPath', 'filter', 'linearGradient', 'marker', 'mask', 'pattern',
121
- 'radialGradient', 'solidColor', 'symbol'
122
+ // Include both mixed-case and lowercase for case-insensitive matching
123
+ 'clipPath', 'clippath', 'filter', 'linearGradient', 'lineargradient',
124
+ 'marker', 'mask', 'pattern', 'radialGradient', 'radialgradient',
125
+ 'solidColor', 'solidcolor', 'symbol'
122
126
  ]),
123
127
  container: new Set([
124
128
  'a', 'defs', 'g', 'marker', 'mask', 'pattern', 'svg', 'switch', 'symbol'
@@ -701,38 +705,40 @@ export const attrsGroupsDeprecated = {
701
705
  export const allowedChildrenPerElement = {
702
706
  'svg': new Set([
703
707
  'a', 'altGlyphDef', 'animate', 'animateColor', 'animateMotion', 'animateTransform',
704
- 'circle', 'clipPath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face',
708
+ 'circle', 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face',
705
709
  'foreignObject', 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata',
706
710
  'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script',
707
711
  'set', 'style', 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
708
712
  ]),
709
713
  'g': new Set([
710
714
  'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
711
- 'clipPath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
715
+ 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
712
716
  'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
713
717
  'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
714
- 'svg', 'switch', 'symbol', 'text', 'title', 'use'
718
+ 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
715
719
  ]),
716
720
  'defs': new Set([
717
721
  'a', 'altGlyphDef', 'animate', 'animateColor', 'animateMotion', 'animateTransform',
718
- 'circle', 'clipPath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face',
722
+ 'circle', 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face',
719
723
  'foreignObject', 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata',
720
724
  'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script',
721
- 'set', 'style', 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
725
+ 'set', 'style', 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view',
726
+ // SVG 2.0 elements
727
+ 'meshgradient', 'meshGradient', 'hatch', 'solidcolor', 'solidColor'
722
728
  ]),
723
729
  'symbol': new Set([
724
730
  'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
725
- 'clipPath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
731
+ 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
726
732
  'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
727
733
  'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
728
- 'svg', 'switch', 'symbol', 'text', 'title', 'use'
734
+ 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
729
735
  ]),
730
736
  'marker': new Set([
731
737
  'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
732
- 'clipPath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
738
+ 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
733
739
  'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
734
740
  'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
735
- 'svg', 'switch', 'symbol', 'text', 'title', 'use'
741
+ 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
736
742
  ]),
737
743
  'clipPath': new Set([
738
744
  'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle', 'desc',
@@ -741,29 +747,29 @@ export const allowedChildrenPerElement = {
741
747
  ]),
742
748
  'mask': new Set([
743
749
  'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
744
- 'clipPath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
750
+ 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
745
751
  'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
746
752
  'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
747
- 'svg', 'switch', 'symbol', 'text', 'title', 'use'
753
+ 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
748
754
  ]),
749
755
  'pattern': new Set([
750
756
  'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
751
- 'clipPath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
757
+ 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
752
758
  'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
753
759
  'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
754
- 'svg', 'switch', 'symbol', 'text', 'title', 'use'
760
+ 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
755
761
  ]),
756
762
  'a': new Set([
757
763
  'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
758
- 'clipPath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
764
+ 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
759
765
  'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
760
766
  'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
761
767
  'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
762
768
  ]),
763
769
  'switch': new Set([
764
770
  'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
765
- 'desc', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'metadata', 'path',
766
- 'polygon', 'polyline', 'rect', 'set', 'svg', 'switch', 'text', 'title', 'use'
771
+ 'cursor', 'desc', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'metadata', 'path',
772
+ 'polygon', 'polyline', 'rect', 'set', 'svg', 'switch', 'text', 'title', 'use', 'view'
767
773
  ]),
768
774
  'text': new Set([
769
775
  'a', 'altGlyph', 'animate', 'animateColor', 'animateMotion', 'animateTransform',
@@ -781,6 +787,29 @@ export const allowedChildrenPerElement = {
781
787
  'radialGradient': new Set([
782
788
  'animate', 'animateTransform', 'desc', 'metadata', 'set', 'stop', 'title'
783
789
  ]),
790
+ // SVG 2.0 mesh gradient element hierarchy
791
+ 'meshgradient': new Set([
792
+ 'animate', 'animateTransform', 'desc', 'metadata', 'meshrow', 'set', 'title'
793
+ ]),
794
+ 'meshGradient': new Set([
795
+ 'animate', 'animateTransform', 'desc', 'metadata', 'meshrow', 'set', 'title'
796
+ ]),
797
+ 'meshrow': new Set([
798
+ 'meshpatch'
799
+ ]),
800
+ 'meshpatch': new Set([
801
+ 'stop'
802
+ ]),
803
+ // SVG 2.0 hatch element
804
+ 'hatch': new Set([
805
+ 'animate', 'animateTransform', 'desc', 'hatchpath', 'hatchPath', 'metadata', 'script', 'set', 'style', 'title'
806
+ ]),
807
+ 'hatchpath': new Set([
808
+ 'animate', 'animateTransform', 'desc', 'metadata', 'script', 'set', 'title'
809
+ ]),
810
+ 'hatchPath': new Set([
811
+ 'animate', 'animateTransform', 'desc', 'metadata', 'script', 'set', 'title'
812
+ ]),
784
813
  'filter': new Set([
785
814
  'animate', 'animateTransform', 'desc', 'feBlend', 'feColorMatrix', 'feComponentTransfer',
786
815
  'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap',