@lvce-editor/renderer-process 30.45.1 → 30.46.0

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.
@@ -1625,20 +1625,20 @@ const Head$1 = 'head';
1625
1625
  const Title$1 = 'title';
1626
1626
  const Meta$1 = 'meta';
1627
1627
  const Canvas$1 = 'canvas';
1628
- const Circle$1 = 'circle';
1628
+ const Circle$2 = 'circle';
1629
1629
  const Form$1 = 'form';
1630
- const Defs$1 = 'defs';
1631
- const Ellipse$1 = 'ellipse';
1632
- const G$1 = 'g';
1633
- const Line$1 = 'line';
1634
- const Path$1 = 'path';
1635
- const Polygon$1 = 'polygon';
1636
- const Polyline$1 = 'polyline';
1630
+ const Defs$2 = 'defs';
1631
+ const Ellipse$2 = 'ellipse';
1632
+ const G$2 = 'g';
1633
+ const Line$2 = 'line';
1634
+ const Path$2 = 'path';
1635
+ const Polygon$2 = 'polygon';
1636
+ const Polyline$2 = 'polyline';
1637
1637
  const Quote$1 = 'quote';
1638
1638
  const BlockQuote$1 = 'blockquote';
1639
- const Rect$1 = 'rect';
1640
- const Svg$1 = 'svg';
1641
- const Use$1 = 'use';
1639
+ const Rect$2 = 'rect';
1640
+ const Svg$2 = 'svg';
1641
+ const Use$2 = 'use';
1642
1642
 
1643
1643
  const Audio = 0;
1644
1644
  const Button = 1;
@@ -1708,17 +1708,17 @@ const Canvas = 77;
1708
1708
  const Form = 78;
1709
1709
  const BlockQuote = 79;
1710
1710
  const Quote = 80;
1711
- const Circle = 81;
1712
- const Defs = 82;
1713
- const Ellipse = 83;
1714
- const G = 84;
1715
- const Line = 85;
1716
- const Path = 86;
1717
- const Polygon = 87;
1718
- const Polyline = 88;
1719
- const Rect = 89;
1720
- const Svg = 90;
1721
- const Use = 91;
1711
+ const Circle$1 = 81;
1712
+ const Defs$1 = 82;
1713
+ const Ellipse$1 = 83;
1714
+ const G$1 = 84;
1715
+ const Line$1 = 85;
1716
+ const Path$1 = 86;
1717
+ const Polygon$1 = 87;
1718
+ const Polyline$1 = 88;
1719
+ const Rect$1 = 89;
1720
+ const Svg$1 = 90;
1721
+ const Use$1 = 91;
1722
1722
  const Reference$1 = 100;
1723
1723
 
1724
1724
  const VirtualDomElements = {
@@ -1731,25 +1731,25 @@ const VirtualDomElements = {
1731
1731
  Br,
1732
1732
  Button,
1733
1733
  Canvas,
1734
- Circle,
1734
+ Circle: Circle$1,
1735
1735
  Cite,
1736
1736
  Code,
1737
1737
  Col,
1738
1738
  ColGroup,
1739
1739
  Data,
1740
1740
  Dd,
1741
- Defs,
1741
+ Defs: Defs$1,
1742
1742
  Del,
1743
1743
  Div,
1744
1744
  Dl,
1745
1745
  Dt,
1746
- Ellipse,
1746
+ Ellipse: Ellipse$1,
1747
1747
  Em,
1748
1748
  Figcaption,
1749
1749
  Figure,
1750
1750
  Footer,
1751
1751
  Form,
1752
- G,
1752
+ G: G$1,
1753
1753
  H1,
1754
1754
  H2,
1755
1755
  H3,
@@ -1768,19 +1768,19 @@ const VirtualDomElements = {
1768
1768
  Kbd,
1769
1769
  Label,
1770
1770
  Li,
1771
- Line,
1771
+ Line: Line$1,
1772
1772
  Main,
1773
1773
  Meta,
1774
1774
  Nav,
1775
1775
  Ol,
1776
1776
  Option,
1777
1777
  P,
1778
- Path,
1779
- Polygon,
1780
- Polyline,
1778
+ Path: Path$1,
1779
+ Polygon: Polygon$1,
1780
+ Polyline: Polyline$1,
1781
1781
  Pre,
1782
1782
  Quote,
1783
- Rect,
1783
+ Rect: Rect$1,
1784
1784
  Reference: Reference$1,
1785
1785
  Search,
1786
1786
  Section,
@@ -1788,7 +1788,7 @@ const VirtualDomElements = {
1788
1788
  Span,
1789
1789
  Strong,
1790
1790
  Style,
1791
- Svg,
1791
+ Svg: Svg$1,
1792
1792
  TBody,
1793
1793
  THead,
1794
1794
  Table,
@@ -1801,7 +1801,7 @@ const VirtualDomElements = {
1801
1801
  Title,
1802
1802
  Tr,
1803
1803
  Ul,
1804
- Use,
1804
+ Use: Use$1,
1805
1805
  Video
1806
1806
  };
1807
1807
 
@@ -1814,25 +1814,25 @@ const elementTagMap = {
1814
1814
  [Br]: Br$1,
1815
1815
  [Button]: Button$1,
1816
1816
  [Canvas]: Canvas$1,
1817
- [Circle]: Circle$1,
1817
+ [Circle$1]: Circle$2,
1818
1818
  [Cite]: Cite$1,
1819
1819
  [Code]: Code$1,
1820
1820
  [Col]: Col$1,
1821
1821
  [ColGroup]: ColGroup$1,
1822
1822
  [Data]: Data$1,
1823
1823
  [Dd]: Dd$1,
1824
- [Defs]: Defs$1,
1824
+ [Defs$1]: Defs$2,
1825
1825
  [Del]: Del$1,
1826
1826
  [Div]: Div$1,
1827
1827
  [Dl]: Dl$1,
1828
1828
  [Dt]: Dt$1,
1829
- [Ellipse]: Ellipse$1,
1829
+ [Ellipse$1]: Ellipse$2,
1830
1830
  [Em]: Em$1,
1831
1831
  [Figcaption]: Figcaption$1,
1832
1832
  [Figure]: Figure$1,
1833
1833
  [Footer]: Footer$1,
1834
1834
  [Form]: Form$1,
1835
- [G]: G$1,
1835
+ [G$1]: G$2,
1836
1836
  [H1]: H1$1,
1837
1837
  [H2]: H2$1,
1838
1838
  [H3]: H3$1,
@@ -1851,26 +1851,26 @@ const elementTagMap = {
1851
1851
  [Kbd]: Kbd$1,
1852
1852
  [Label]: Label$1,
1853
1853
  [Li]: Li$1,
1854
- [Line]: Line$1,
1854
+ [Line$1]: Line$2,
1855
1855
  [Main]: Main$1,
1856
1856
  [Meta]: Meta$1,
1857
1857
  [Nav]: Nav$1,
1858
1858
  [Ol]: Ol$1,
1859
1859
  [Option]: Option$1,
1860
1860
  [P]: P$1,
1861
- [Path]: Path$1,
1862
- [Polygon]: Polygon$1,
1863
- [Polyline]: Polyline$1,
1861
+ [Path$1]: Path$2,
1862
+ [Polygon$1]: Polygon$2,
1863
+ [Polyline$1]: Polyline$2,
1864
1864
  [Pre]: Pre$1,
1865
1865
  [Quote]: Quote$1,
1866
- [Rect]: Rect$1,
1866
+ [Rect$1]: Rect$2,
1867
1867
  [Search]: Search$1,
1868
1868
  [Section]: Section$1,
1869
1869
  [Select]: Select$1,
1870
1870
  [Span]: Span$1,
1871
1871
  [Strong]: Strong$1,
1872
1872
  [Style]: Style$1,
1873
- [Svg]: Svg$1,
1873
+ [Svg$1]: Svg$2,
1874
1874
  [Table]: Table$1,
1875
1875
  [TBody]: TBody$1,
1876
1876
  [Td]: Td$1,
@@ -1882,7 +1882,7 @@ const elementTagMap = {
1882
1882
  [Title]: Title$1,
1883
1883
  [Tr]: Tr$1,
1884
1884
  [Ul]: Ul$1,
1885
- [Use]: Use$1,
1885
+ [Use$1]: Use$2,
1886
1886
  [Video]: Video$1
1887
1887
  };
1888
1888
  const getElementTag$1 = type => {
@@ -2090,6 +2090,11 @@ const removeProp = ($Element, key) => {
2090
2090
  detachEvent($Element, eventName);
2091
2091
  return;
2092
2092
  }
2093
+ if ($Element instanceof SVGElement) {
2094
+ const attributeName = removedAttributeProps.get(key) || key;
2095
+ $Element.removeAttribute(attributeName);
2096
+ return;
2097
+ }
2093
2098
  if ((key === 'height' || key === 'width') && $Element instanceof HTMLImageElement) {
2094
2099
  $Element.removeAttribute(key);
2095
2100
  return;
@@ -2101,7 +2106,15 @@ const removeProp = ($Element, key) => {
2101
2106
  const attributeName = removedAttributeProps.get(key) || key;
2102
2107
  $Element.removeAttribute(attributeName);
2103
2108
  };
2104
- const setProp = ($Element, key, value, eventMap, newEventMap) => {
2109
+ const setSvgProp = ($Element, key, value) => {
2110
+ if (key === 'style') {
2111
+ setStyle($Element, value);
2112
+ return;
2113
+ }
2114
+ const attributeName = removedAttributeProps.get(key) || key;
2115
+ $Element.setAttribute(attributeName, String(value));
2116
+ };
2117
+ const setHtmlProp = ($Element, key, value) => {
2105
2118
  if (key.startsWith('aria-')) {
2106
2119
  $Element.setAttribute(key, String(value));
2107
2120
  return;
@@ -2152,10 +2165,6 @@ const setProp = ($Element, key, value, eventMap, newEventMap) => {
2152
2165
  $Element.style.webkitMaskImage = `url('${value}')`;
2153
2166
  return;
2154
2167
  }
2155
- if (eventProps.has(key)) {
2156
- setEventProp($Element, key, value, eventMap, newEventMap);
2157
- return;
2158
- }
2159
2168
  if (key === 'style') {
2160
2169
  setStyle($Element, value);
2161
2170
  return;
@@ -2170,6 +2179,17 @@ const setProp = ($Element, key, value, eventMap, newEventMap) => {
2170
2179
  }
2171
2180
  $Element[key] = value;
2172
2181
  };
2182
+ const setProp = ($Element, key, value, eventMap, newEventMap) => {
2183
+ if (eventProps.has(key)) {
2184
+ setEventProp($Element, key, value, eventMap, newEventMap);
2185
+ return;
2186
+ }
2187
+ if ($Element instanceof SVGElement) {
2188
+ setSvgProp($Element, key, value);
2189
+ return;
2190
+ }
2191
+ setHtmlProp($Element, key, value);
2192
+ };
2173
2193
 
2174
2194
  const setProps = ($Element, props, eventMap, newEventMap) => {
2175
2195
  for (const key in props) {
@@ -2181,15 +2201,28 @@ const setProps = ($Element, props, eventMap, newEventMap) => {
2181
2201
  };
2182
2202
 
2183
2203
  const {
2204
+ Circle,
2205
+ Defs,
2206
+ Ellipse,
2207
+ G,
2208
+ Line,
2209
+ Path,
2210
+ Polygon,
2211
+ Polyline,
2212
+ Rect,
2213
+ Svg,
2184
2214
  Text,
2215
+ Use,
2185
2216
  Reference} = VirtualDomElements;
2186
2217
 
2218
+ const svgNamespace = 'http://www.w3.org/2000/svg';
2219
+ const svgElementTypes = new Set([Circle, Defs, Ellipse, G, Line, Path, Polygon, Polyline, Rect, Svg, Use]);
2187
2220
  const renderDomTextNode = element => {
2188
2221
  return document.createTextNode(element.text);
2189
2222
  };
2190
2223
  const renderDomElement = (element, eventMap, newEventMap) => {
2191
2224
  const tag = getElementTag(element.type);
2192
- const $Element = document.createElement(tag);
2225
+ const $Element = svgElementTypes.has(element.type) ? document.createElementNS(svgNamespace, tag) : document.createElement(tag);
2193
2226
  setProps($Element, element, eventMap, newEventMap);
2194
2227
  return $Element;
2195
2228
  };
@@ -780,20 +780,20 @@ const Head$1 = 'head';
780
780
  const Title$1 = 'title';
781
781
  const Meta$1 = 'meta';
782
782
  const Canvas$1 = 'canvas';
783
- const Circle$1 = 'circle';
783
+ const Circle$2 = 'circle';
784
784
  const Form$1 = 'form';
785
- const Defs$1 = 'defs';
786
- const Ellipse$1 = 'ellipse';
787
- const G$1 = 'g';
788
- const Line$1 = 'line';
789
- const Path$1 = 'path';
790
- const Polygon$1 = 'polygon';
791
- const Polyline$1 = 'polyline';
785
+ const Defs$2 = 'defs';
786
+ const Ellipse$2 = 'ellipse';
787
+ const G$2 = 'g';
788
+ const Line$2 = 'line';
789
+ const Path$2 = 'path';
790
+ const Polygon$2 = 'polygon';
791
+ const Polyline$2 = 'polyline';
792
792
  const Quote$3 = 'quote';
793
793
  const BlockQuote$1 = 'blockquote';
794
- const Rect$1 = 'rect';
795
- const Svg$1 = 'svg';
796
- const Use$1 = 'use';
794
+ const Rect$2 = 'rect';
795
+ const Svg$2 = 'svg';
796
+ const Use$2 = 'use';
797
797
 
798
798
  const Audio$2 = 0;
799
799
  const Button = 1;
@@ -863,17 +863,17 @@ const Canvas = 77;
863
863
  const Form = 78;
864
864
  const BlockQuote = 79;
865
865
  const Quote$2 = 80;
866
- const Circle = 81;
867
- const Defs = 82;
868
- const Ellipse = 83;
869
- const G = 84;
870
- const Line = 85;
871
- const Path = 86;
872
- const Polygon = 87;
873
- const Polyline = 88;
874
- const Rect = 89;
875
- const Svg = 90;
876
- const Use = 91;
866
+ const Circle$1 = 81;
867
+ const Defs$1 = 82;
868
+ const Ellipse$1 = 83;
869
+ const G$1 = 84;
870
+ const Line$1 = 85;
871
+ const Path$1 = 86;
872
+ const Polygon$1 = 87;
873
+ const Polyline$1 = 88;
874
+ const Rect$1 = 89;
875
+ const Svg$1 = 90;
876
+ const Use$1 = 91;
877
877
  const Reference$1 = 100;
878
878
 
879
879
  const VirtualDomElements = {
@@ -886,25 +886,25 @@ const VirtualDomElements = {
886
886
  Br,
887
887
  Button,
888
888
  Canvas,
889
- Circle,
889
+ Circle: Circle$1,
890
890
  Cite,
891
891
  Code,
892
892
  Col,
893
893
  ColGroup,
894
894
  Data,
895
895
  Dd,
896
- Defs,
896
+ Defs: Defs$1,
897
897
  Del,
898
898
  Div,
899
899
  Dl,
900
900
  Dt,
901
- Ellipse,
901
+ Ellipse: Ellipse$1,
902
902
  Em,
903
903
  Figcaption,
904
904
  Figure,
905
905
  Footer,
906
906
  Form,
907
- G,
907
+ G: G$1,
908
908
  H1,
909
909
  H2,
910
910
  H3,
@@ -923,19 +923,19 @@ const VirtualDomElements = {
923
923
  Kbd,
924
924
  Label,
925
925
  Li,
926
- Line,
926
+ Line: Line$1,
927
927
  Main,
928
928
  Meta,
929
929
  Nav,
930
930
  Ol,
931
931
  Option,
932
932
  P,
933
- Path,
934
- Polygon,
935
- Polyline,
933
+ Path: Path$1,
934
+ Polygon: Polygon$1,
935
+ Polyline: Polyline$1,
936
936
  Pre,
937
937
  Quote: Quote$2,
938
- Rect,
938
+ Rect: Rect$1,
939
939
  Reference: Reference$1,
940
940
  Search,
941
941
  Section,
@@ -943,7 +943,7 @@ const VirtualDomElements = {
943
943
  Span,
944
944
  Strong,
945
945
  Style,
946
- Svg,
946
+ Svg: Svg$1,
947
947
  TBody,
948
948
  THead,
949
949
  Table,
@@ -956,7 +956,7 @@ const VirtualDomElements = {
956
956
  Title,
957
957
  Tr,
958
958
  Ul,
959
- Use,
959
+ Use: Use$1,
960
960
  Video: Video$1
961
961
  };
962
962
 
@@ -969,25 +969,25 @@ const elementTagMap = {
969
969
  [Br]: Br$1,
970
970
  [Button]: Button$1,
971
971
  [Canvas]: Canvas$1,
972
- [Circle]: Circle$1,
972
+ [Circle$1]: Circle$2,
973
973
  [Cite]: Cite$1,
974
974
  [Code]: Code$1,
975
975
  [Col]: Col$1,
976
976
  [ColGroup]: ColGroup$1,
977
977
  [Data]: Data$1,
978
978
  [Dd]: Dd$1,
979
- [Defs]: Defs$1,
979
+ [Defs$1]: Defs$2,
980
980
  [Del]: Del$1,
981
981
  [Div]: Div$1,
982
982
  [Dl]: Dl$1,
983
983
  [Dt]: Dt$1,
984
- [Ellipse]: Ellipse$1,
984
+ [Ellipse$1]: Ellipse$2,
985
985
  [Em]: Em$1,
986
986
  [Figcaption]: Figcaption$1,
987
987
  [Figure]: Figure$1,
988
988
  [Footer]: Footer$1,
989
989
  [Form]: Form$1,
990
- [G]: G$1,
990
+ [G$1]: G$2,
991
991
  [H1]: H1$1,
992
992
  [H2]: H2$1,
993
993
  [H3]: H3$1,
@@ -1006,26 +1006,26 @@ const elementTagMap = {
1006
1006
  [Kbd]: Kbd$1,
1007
1007
  [Label]: Label$1,
1008
1008
  [Li]: Li$1,
1009
- [Line]: Line$1,
1009
+ [Line$1]: Line$2,
1010
1010
  [Main]: Main$1,
1011
1011
  [Meta]: Meta$1,
1012
1012
  [Nav]: Nav$1,
1013
1013
  [Ol]: Ol$1,
1014
1014
  [Option]: Option$1,
1015
1015
  [P]: P$1,
1016
- [Path]: Path$1,
1017
- [Polygon]: Polygon$1,
1018
- [Polyline]: Polyline$1,
1016
+ [Path$1]: Path$2,
1017
+ [Polygon$1]: Polygon$2,
1018
+ [Polyline$1]: Polyline$2,
1019
1019
  [Pre]: Pre$1,
1020
1020
  [Quote$2]: Quote$3,
1021
- [Rect]: Rect$1,
1021
+ [Rect$1]: Rect$2,
1022
1022
  [Search]: Search$1,
1023
1023
  [Section]: Section$1,
1024
1024
  [Select]: Select$1,
1025
1025
  [Span]: Span$1,
1026
1026
  [Strong]: Strong$1,
1027
1027
  [Style]: Style$1,
1028
- [Svg]: Svg$1,
1028
+ [Svg$1]: Svg$2,
1029
1029
  [Table]: Table$1,
1030
1030
  [TBody]: TBody$1,
1031
1031
  [Td]: Td$1,
@@ -1037,7 +1037,7 @@ const elementTagMap = {
1037
1037
  [Title]: Title$1,
1038
1038
  [Tr]: Tr$1,
1039
1039
  [Ul]: Ul$1,
1040
- [Use]: Use$1,
1040
+ [Use$1]: Use$2,
1041
1041
  [Video$1]: Video$2
1042
1042
  };
1043
1043
  const getElementTag$1 = type => {
@@ -1526,6 +1526,11 @@ const removeProp = ($Element, key) => {
1526
1526
  detachEvent($Element, eventName);
1527
1527
  return;
1528
1528
  }
1529
+ if ($Element instanceof SVGElement) {
1530
+ const attributeName = removedAttributeProps.get(key) || key;
1531
+ $Element.removeAttribute(attributeName);
1532
+ return;
1533
+ }
1529
1534
  if ((key === 'height' || key === 'width') && $Element instanceof HTMLImageElement) {
1530
1535
  $Element.removeAttribute(key);
1531
1536
  return;
@@ -1537,7 +1542,15 @@ const removeProp = ($Element, key) => {
1537
1542
  const attributeName = removedAttributeProps.get(key) || key;
1538
1543
  $Element.removeAttribute(attributeName);
1539
1544
  };
1540
- const setProp = ($Element, key, value, eventMap, newEventMap) => {
1545
+ const setSvgProp = ($Element, key, value) => {
1546
+ if (key === 'style') {
1547
+ setStyle($Element, value);
1548
+ return;
1549
+ }
1550
+ const attributeName = removedAttributeProps.get(key) || key;
1551
+ $Element.setAttribute(attributeName, String(value));
1552
+ };
1553
+ const setHtmlProp = ($Element, key, value) => {
1541
1554
  if (key.startsWith('aria-')) {
1542
1555
  $Element.setAttribute(key, String(value));
1543
1556
  return;
@@ -1588,10 +1601,6 @@ const setProp = ($Element, key, value, eventMap, newEventMap) => {
1588
1601
  $Element.style.webkitMaskImage = `url('${value}')`;
1589
1602
  return;
1590
1603
  }
1591
- if (eventProps.has(key)) {
1592
- setEventProp($Element, key, value, eventMap, newEventMap);
1593
- return;
1594
- }
1595
1604
  if (key === 'style') {
1596
1605
  setStyle($Element, value);
1597
1606
  return;
@@ -1606,6 +1615,17 @@ const setProp = ($Element, key, value, eventMap, newEventMap) => {
1606
1615
  }
1607
1616
  $Element[key] = value;
1608
1617
  };
1618
+ const setProp = ($Element, key, value, eventMap, newEventMap) => {
1619
+ if (eventProps.has(key)) {
1620
+ setEventProp($Element, key, value, eventMap, newEventMap);
1621
+ return;
1622
+ }
1623
+ if ($Element instanceof SVGElement) {
1624
+ setSvgProp($Element, key, value);
1625
+ return;
1626
+ }
1627
+ setHtmlProp($Element, key, value);
1628
+ };
1609
1629
 
1610
1630
  const setProps = ($Element, props, eventMap, newEventMap) => {
1611
1631
  for (const key in props) {
@@ -1617,15 +1637,28 @@ const setProps = ($Element, props, eventMap, newEventMap) => {
1617
1637
  };
1618
1638
 
1619
1639
  const {
1640
+ Circle,
1641
+ Defs,
1642
+ Ellipse,
1643
+ G,
1644
+ Line,
1645
+ Path,
1646
+ Polygon,
1647
+ Polyline,
1648
+ Rect,
1649
+ Svg,
1620
1650
  Text,
1651
+ Use,
1621
1652
  Reference} = VirtualDomElements;
1622
1653
 
1654
+ const svgNamespace = 'http://www.w3.org/2000/svg';
1655
+ const svgElementTypes = new Set([Circle, Defs, Ellipse, G, Line, Path, Polygon, Polyline, Rect, Svg, Use]);
1623
1656
  const renderDomTextNode = element => {
1624
1657
  return document.createTextNode(element.text);
1625
1658
  };
1626
1659
  const renderDomElement = (element, eventMap, newEventMap) => {
1627
1660
  const tag = getElementTag(element.type);
1628
- const $Element = document.createElement(tag);
1661
+ const $Element = svgElementTypes.has(element.type) ? document.createElementNS(svgNamespace, tag) : document.createElement(tag);
1629
1662
  setProps($Element, element, eventMap, newEventMap);
1630
1663
  return $Element;
1631
1664
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.45.1",
3
+ "version": "30.46.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"