@webstudio-is/sdk 0.219.0 → 0.220.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.
- package/lib/core-templates.js +12 -36
- package/lib/index.js +16 -48
- package/lib/types/core-metas.d.ts +0 -1010
- package/lib/types/schema/component-meta.d.ts +889 -902
- package/lib/types/schema/webstudio.d.ts +22 -22
- package/package.json +6 -6
package/lib/core-templates.js
CHANGED
|
@@ -19,8 +19,7 @@ import {
|
|
|
19
19
|
ListViewIcon,
|
|
20
20
|
PaintBrushIcon,
|
|
21
21
|
SettingsIcon,
|
|
22
|
-
AddTemplateInstanceIcon
|
|
23
|
-
BoxIcon
|
|
22
|
+
AddTemplateInstanceIcon
|
|
24
23
|
} from "@webstudio-is/icons/svg";
|
|
25
24
|
|
|
26
25
|
// src/__generated__/normalize.css.ts
|
|
@@ -631,6 +630,8 @@ var tagProperty = "data-ws-tag";
|
|
|
631
630
|
|
|
632
631
|
// src/__generated__/tags.ts
|
|
633
632
|
var tags = [
|
|
633
|
+
"div",
|
|
634
|
+
"span",
|
|
634
635
|
"a",
|
|
635
636
|
"abbr",
|
|
636
637
|
"address",
|
|
@@ -658,7 +659,6 @@ var tags = [
|
|
|
658
659
|
"details",
|
|
659
660
|
"dfn",
|
|
660
661
|
"dialog",
|
|
661
|
-
"div",
|
|
662
662
|
"dl",
|
|
663
663
|
"dt",
|
|
664
664
|
"em",
|
|
@@ -715,7 +715,6 @@ var tags = [
|
|
|
715
715
|
"slot",
|
|
716
716
|
"small",
|
|
717
717
|
"source",
|
|
718
|
-
"span",
|
|
719
718
|
"strong",
|
|
720
719
|
"sub",
|
|
721
720
|
"summary",
|
|
@@ -746,17 +745,12 @@ var rootMeta = {
|
|
|
746
745
|
html
|
|
747
746
|
}
|
|
748
747
|
};
|
|
749
|
-
var rootPropsMeta = {
|
|
750
|
-
props: {}
|
|
751
|
-
};
|
|
752
748
|
var elementComponent = "ws:element";
|
|
753
749
|
var elementMeta = {
|
|
754
750
|
label: "Element",
|
|
755
|
-
icon: BoxIcon,
|
|
756
751
|
// convert [object Module] to [object Object] to enable structured cloning
|
|
757
|
-
presetStyle: { ...normalize_css_exports }
|
|
758
|
-
|
|
759
|
-
var elementPropsMeta = {
|
|
752
|
+
presetStyle: { ...normalize_css_exports },
|
|
753
|
+
initialProps: [tagProperty, "id", "class"],
|
|
760
754
|
props: {
|
|
761
755
|
[tagProperty]: {
|
|
762
756
|
type: "string",
|
|
@@ -773,17 +767,15 @@ var collectionMeta = {
|
|
|
773
767
|
contentModel: {
|
|
774
768
|
category: "instance",
|
|
775
769
|
children: ["instance"]
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
var collectionPropsMeta = {
|
|
770
|
+
},
|
|
771
|
+
initialProps: ["data"],
|
|
779
772
|
props: {
|
|
780
773
|
data: {
|
|
781
774
|
required: true,
|
|
782
775
|
control: "json",
|
|
783
776
|
type: "json"
|
|
784
777
|
}
|
|
785
|
-
}
|
|
786
|
-
initialProps: ["data"]
|
|
778
|
+
}
|
|
787
779
|
};
|
|
788
780
|
var descendantComponent = "ws:descendant";
|
|
789
781
|
var descendantMeta = {
|
|
@@ -794,9 +786,8 @@ var descendantMeta = {
|
|
|
794
786
|
children: []
|
|
795
787
|
},
|
|
796
788
|
// @todo infer possible presets
|
|
797
|
-
presetStyle: {}
|
|
798
|
-
|
|
799
|
-
var descendantPropsMeta = {
|
|
789
|
+
presetStyle: {},
|
|
790
|
+
initialProps: ["selector"],
|
|
800
791
|
props: {
|
|
801
792
|
selector: {
|
|
802
793
|
required: true,
|
|
@@ -821,8 +812,7 @@ var descendantPropsMeta = {
|
|
|
821
812
|
" hr"
|
|
822
813
|
]
|
|
823
814
|
}
|
|
824
|
-
}
|
|
825
|
-
initialProps: ["selector"]
|
|
815
|
+
}
|
|
826
816
|
};
|
|
827
817
|
var blockComponent = "ws:block";
|
|
828
818
|
var blockTemplateComponent = "ws:block-template";
|
|
@@ -833,9 +823,6 @@ var blockTemplateMeta = {
|
|
|
833
823
|
children: ["instance"]
|
|
834
824
|
}
|
|
835
825
|
};
|
|
836
|
-
var blockTemplatePropsMeta = {
|
|
837
|
-
props: {}
|
|
838
|
-
};
|
|
839
826
|
var blockMeta = {
|
|
840
827
|
label: "Content Block",
|
|
841
828
|
icon: ContentBlockIcon,
|
|
@@ -844,9 +831,6 @@ var blockMeta = {
|
|
|
844
831
|
children: [blockTemplateComponent, "instance"]
|
|
845
832
|
}
|
|
846
833
|
};
|
|
847
|
-
var blockPropsMeta = {
|
|
848
|
-
props: {}
|
|
849
|
-
};
|
|
850
834
|
var coreMetas = {
|
|
851
835
|
[rootComponent]: rootMeta,
|
|
852
836
|
[elementComponent]: elementMeta,
|
|
@@ -855,14 +839,6 @@ var coreMetas = {
|
|
|
855
839
|
[blockComponent]: blockMeta,
|
|
856
840
|
[blockTemplateComponent]: blockTemplateMeta
|
|
857
841
|
};
|
|
858
|
-
var corePropsMetas = {
|
|
859
|
-
[rootComponent]: rootPropsMeta,
|
|
860
|
-
[elementComponent]: elementPropsMeta,
|
|
861
|
-
[collectionComponent]: collectionPropsMeta,
|
|
862
|
-
[descendantComponent]: descendantPropsMeta,
|
|
863
|
-
[blockComponent]: blockPropsMeta,
|
|
864
|
-
[blockTemplateComponent]: blockTemplatePropsMeta
|
|
865
|
-
};
|
|
866
842
|
|
|
867
843
|
// src/core-templates.tsx
|
|
868
844
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -870,7 +846,7 @@ var elementMeta2 = {
|
|
|
870
846
|
category: "general",
|
|
871
847
|
order: 0,
|
|
872
848
|
description: "An HTML element is a core building block for web pages, structuring and displaying content like text, images, and links.",
|
|
873
|
-
template: /* @__PURE__ */ jsx(ws.element, {
|
|
849
|
+
template: /* @__PURE__ */ jsx(ws.element, {})
|
|
874
850
|
};
|
|
875
851
|
var collectionItem = new Parameter("collectionItem");
|
|
876
852
|
var collectionMeta2 = {
|
package/lib/index.js
CHANGED
|
@@ -842,11 +842,6 @@ var PresetStyleDecl = z15.object({
|
|
|
842
842
|
property: z15.string(),
|
|
843
843
|
value: StyleValue3
|
|
844
844
|
});
|
|
845
|
-
var WsComponentPropsMeta = z15.object({
|
|
846
|
-
props: z15.record(PropMeta),
|
|
847
|
-
// Props that will be always visible in properties panel.
|
|
848
|
-
initialProps: z15.array(z15.string()).optional()
|
|
849
|
-
});
|
|
850
845
|
var componentCategories = [
|
|
851
846
|
"general",
|
|
852
847
|
"typography",
|
|
@@ -891,11 +886,6 @@ var ContentModel = z15.object({
|
|
|
891
886
|
});
|
|
892
887
|
var WsComponentMeta = z15.object({
|
|
893
888
|
category: z15.enum(componentCategories).optional(),
|
|
894
|
-
/**
|
|
895
|
-
* a property used as textual placeholder when no content specified while in builder
|
|
896
|
-
* also signals to not insert components inside unless dropped explicitly
|
|
897
|
-
*/
|
|
898
|
-
placeholder: z15.string().optional(),
|
|
899
889
|
contentModel: ContentModel.optional(),
|
|
900
890
|
// when this field is specified component receives
|
|
901
891
|
// prop with index of same components withiin specified ancestor
|
|
@@ -904,10 +894,13 @@ var WsComponentMeta = z15.object({
|
|
|
904
894
|
indexWithinAncestor: z15.optional(z15.string()),
|
|
905
895
|
label: z15.optional(z15.string()),
|
|
906
896
|
description: z15.string().optional(),
|
|
907
|
-
icon: z15.string(),
|
|
897
|
+
icon: z15.string().optional(),
|
|
908
898
|
presetStyle: z15.optional(z15.record(z15.string(), z15.array(PresetStyleDecl))),
|
|
909
899
|
states: z15.optional(z15.array(ComponentState)),
|
|
910
|
-
order: z15.number().optional()
|
|
900
|
+
order: z15.number().optional(),
|
|
901
|
+
// properties and html attributes that will be always visible in properties panel
|
|
902
|
+
initialProps: z15.array(z15.string()).optional(),
|
|
903
|
+
props: z15.record(PropMeta).optional()
|
|
911
904
|
});
|
|
912
905
|
|
|
913
906
|
// src/core-metas.ts
|
|
@@ -916,8 +909,7 @@ import {
|
|
|
916
909
|
ListViewIcon,
|
|
917
910
|
PaintBrushIcon,
|
|
918
911
|
SettingsIcon,
|
|
919
|
-
AddTemplateInstanceIcon
|
|
920
|
-
BoxIcon
|
|
912
|
+
AddTemplateInstanceIcon
|
|
921
913
|
} from "@webstudio-is/icons/svg";
|
|
922
914
|
|
|
923
915
|
// src/__generated__/normalize.css.ts
|
|
@@ -1528,6 +1520,8 @@ var tagProperty = "data-ws-tag";
|
|
|
1528
1520
|
|
|
1529
1521
|
// src/__generated__/tags.ts
|
|
1530
1522
|
var tags = [
|
|
1523
|
+
"div",
|
|
1524
|
+
"span",
|
|
1531
1525
|
"a",
|
|
1532
1526
|
"abbr",
|
|
1533
1527
|
"address",
|
|
@@ -1555,7 +1549,6 @@ var tags = [
|
|
|
1555
1549
|
"details",
|
|
1556
1550
|
"dfn",
|
|
1557
1551
|
"dialog",
|
|
1558
|
-
"div",
|
|
1559
1552
|
"dl",
|
|
1560
1553
|
"dt",
|
|
1561
1554
|
"em",
|
|
@@ -1612,7 +1605,6 @@ var tags = [
|
|
|
1612
1605
|
"slot",
|
|
1613
1606
|
"small",
|
|
1614
1607
|
"source",
|
|
1615
|
-
"span",
|
|
1616
1608
|
"strong",
|
|
1617
1609
|
"sub",
|
|
1618
1610
|
"summary",
|
|
@@ -1643,17 +1635,12 @@ var rootMeta = {
|
|
|
1643
1635
|
html
|
|
1644
1636
|
}
|
|
1645
1637
|
};
|
|
1646
|
-
var rootPropsMeta = {
|
|
1647
|
-
props: {}
|
|
1648
|
-
};
|
|
1649
1638
|
var elementComponent = "ws:element";
|
|
1650
1639
|
var elementMeta = {
|
|
1651
1640
|
label: "Element",
|
|
1652
|
-
icon: BoxIcon,
|
|
1653
1641
|
// convert [object Module] to [object Object] to enable structured cloning
|
|
1654
|
-
presetStyle: { ...normalize_css_exports }
|
|
1655
|
-
|
|
1656
|
-
var elementPropsMeta = {
|
|
1642
|
+
presetStyle: { ...normalize_css_exports },
|
|
1643
|
+
initialProps: [tagProperty, "id", "class"],
|
|
1657
1644
|
props: {
|
|
1658
1645
|
[tagProperty]: {
|
|
1659
1646
|
type: "string",
|
|
@@ -1671,17 +1658,15 @@ var collectionMeta = {
|
|
|
1671
1658
|
contentModel: {
|
|
1672
1659
|
category: "instance",
|
|
1673
1660
|
children: ["instance"]
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
var collectionPropsMeta = {
|
|
1661
|
+
},
|
|
1662
|
+
initialProps: ["data"],
|
|
1677
1663
|
props: {
|
|
1678
1664
|
data: {
|
|
1679
1665
|
required: true,
|
|
1680
1666
|
control: "json",
|
|
1681
1667
|
type: "json"
|
|
1682
1668
|
}
|
|
1683
|
-
}
|
|
1684
|
-
initialProps: ["data"]
|
|
1669
|
+
}
|
|
1685
1670
|
};
|
|
1686
1671
|
var descendantComponent = "ws:descendant";
|
|
1687
1672
|
var descendantMeta = {
|
|
@@ -1692,9 +1677,8 @@ var descendantMeta = {
|
|
|
1692
1677
|
children: []
|
|
1693
1678
|
},
|
|
1694
1679
|
// @todo infer possible presets
|
|
1695
|
-
presetStyle: {}
|
|
1696
|
-
|
|
1697
|
-
var descendantPropsMeta = {
|
|
1680
|
+
presetStyle: {},
|
|
1681
|
+
initialProps: ["selector"],
|
|
1698
1682
|
props: {
|
|
1699
1683
|
selector: {
|
|
1700
1684
|
required: true,
|
|
@@ -1719,8 +1703,7 @@ var descendantPropsMeta = {
|
|
|
1719
1703
|
" hr"
|
|
1720
1704
|
]
|
|
1721
1705
|
}
|
|
1722
|
-
}
|
|
1723
|
-
initialProps: ["selector"]
|
|
1706
|
+
}
|
|
1724
1707
|
};
|
|
1725
1708
|
var blockComponent = "ws:block";
|
|
1726
1709
|
var blockTemplateComponent = "ws:block-template";
|
|
@@ -1731,9 +1714,6 @@ var blockTemplateMeta = {
|
|
|
1731
1714
|
children: ["instance"]
|
|
1732
1715
|
}
|
|
1733
1716
|
};
|
|
1734
|
-
var blockTemplatePropsMeta = {
|
|
1735
|
-
props: {}
|
|
1736
|
-
};
|
|
1737
1717
|
var blockMeta = {
|
|
1738
1718
|
label: "Content Block",
|
|
1739
1719
|
icon: ContentBlockIcon,
|
|
@@ -1742,9 +1722,6 @@ var blockMeta = {
|
|
|
1742
1722
|
children: [blockTemplateComponent, "instance"]
|
|
1743
1723
|
}
|
|
1744
1724
|
};
|
|
1745
|
-
var blockPropsMeta = {
|
|
1746
|
-
props: {}
|
|
1747
|
-
};
|
|
1748
1725
|
var coreMetas = {
|
|
1749
1726
|
[rootComponent]: rootMeta,
|
|
1750
1727
|
[elementComponent]: elementMeta,
|
|
@@ -1753,14 +1730,6 @@ var coreMetas = {
|
|
|
1753
1730
|
[blockComponent]: blockMeta,
|
|
1754
1731
|
[blockTemplateComponent]: blockTemplateMeta
|
|
1755
1732
|
};
|
|
1756
|
-
var corePropsMetas = {
|
|
1757
|
-
[rootComponent]: rootPropsMeta,
|
|
1758
|
-
[elementComponent]: elementPropsMeta,
|
|
1759
|
-
[collectionComponent]: collectionPropsMeta,
|
|
1760
|
-
[descendantComponent]: descendantPropsMeta,
|
|
1761
|
-
[blockComponent]: blockPropsMeta,
|
|
1762
|
-
[blockTemplateComponent]: blockTemplatePropsMeta
|
|
1763
|
-
};
|
|
1764
1733
|
var isCoreComponent = (component) => component === rootComponent || component === elementComponent || component === collectionComponent || component === descendantComponent || component === blockComponent || component === blockTemplateComponent;
|
|
1765
1734
|
var isComponentDetachable = (component) => component !== rootComponent && component !== blockTemplateComponent && component !== descendantComponent;
|
|
1766
1735
|
|
|
@@ -2854,7 +2823,6 @@ export {
|
|
|
2854
2823
|
collectionComponent,
|
|
2855
2824
|
componentCategories,
|
|
2856
2825
|
coreMetas,
|
|
2857
|
-
corePropsMetas,
|
|
2858
2826
|
createImageValueTransformer,
|
|
2859
2827
|
createScope,
|
|
2860
2828
|
decodeDataVariableId as decodeDataSourceVariable,
|