@webstudio-is/sdk 0.219.0 → 0.221.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/__generated__/normalize.css.js +8 -17
- package/lib/core-templates.js +340 -76
- package/lib/index.js +25 -76
- package/lib/types/core-metas.d.ts +0 -1010
- package/lib/types/core-templates.d.ts +2 -0
- package/lib/types/schema/component-meta.d.ts +892 -915
- package/lib/types/schema/webstudio.d.ts +22 -22
- package/package.json +5 -5
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",
|
|
@@ -857,22 +852,14 @@ var componentCategories = [
|
|
|
857
852
|
"localization",
|
|
858
853
|
"radix",
|
|
859
854
|
"xml",
|
|
855
|
+
"other",
|
|
860
856
|
"hidden",
|
|
861
857
|
"internal"
|
|
862
858
|
];
|
|
863
|
-
var stateCategories = ["states", "component-states"];
|
|
864
859
|
var ComponentState = z15.object({
|
|
865
|
-
category: z15.enum(stateCategories).optional(),
|
|
866
860
|
selector: z15.string(),
|
|
867
861
|
label: z15.string()
|
|
868
862
|
});
|
|
869
|
-
var defaultStates = [
|
|
870
|
-
{ selector: ":hover", label: "Hover" },
|
|
871
|
-
{ selector: ":active", label: "Active" },
|
|
872
|
-
{ selector: ":focus", label: "Focus" },
|
|
873
|
-
{ selector: ":focus-visible", label: "Focus Visible" },
|
|
874
|
-
{ selector: ":focus-within", label: "Focus Within" }
|
|
875
|
-
];
|
|
876
863
|
var ComponentContent = z15.string();
|
|
877
864
|
var ContentModel = z15.object({
|
|
878
865
|
/*
|
|
@@ -891,11 +878,6 @@ var ContentModel = z15.object({
|
|
|
891
878
|
});
|
|
892
879
|
var WsComponentMeta = z15.object({
|
|
893
880
|
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
881
|
contentModel: ContentModel.optional(),
|
|
900
882
|
// when this field is specified component receives
|
|
901
883
|
// prop with index of same components withiin specified ancestor
|
|
@@ -904,10 +886,13 @@ var WsComponentMeta = z15.object({
|
|
|
904
886
|
indexWithinAncestor: z15.optional(z15.string()),
|
|
905
887
|
label: z15.optional(z15.string()),
|
|
906
888
|
description: z15.string().optional(),
|
|
907
|
-
icon: z15.string(),
|
|
889
|
+
icon: z15.string().optional(),
|
|
908
890
|
presetStyle: z15.optional(z15.record(z15.string(), z15.array(PresetStyleDecl))),
|
|
909
891
|
states: z15.optional(z15.array(ComponentState)),
|
|
910
|
-
order: z15.number().optional()
|
|
892
|
+
order: z15.number().optional(),
|
|
893
|
+
// properties and html attributes that will be always visible in properties panel
|
|
894
|
+
initialProps: z15.array(z15.string()).optional(),
|
|
895
|
+
props: z15.record(PropMeta).optional()
|
|
911
896
|
});
|
|
912
897
|
|
|
913
898
|
// src/core-metas.ts
|
|
@@ -916,8 +901,7 @@ import {
|
|
|
916
901
|
ListViewIcon,
|
|
917
902
|
PaintBrushIcon,
|
|
918
903
|
SettingsIcon,
|
|
919
|
-
AddTemplateInstanceIcon
|
|
920
|
-
BoxIcon
|
|
904
|
+
AddTemplateInstanceIcon
|
|
921
905
|
} from "@webstudio-is/icons/svg";
|
|
922
906
|
|
|
923
907
|
// src/__generated__/normalize.css.ts
|
|
@@ -1067,29 +1051,20 @@ var body = [
|
|
|
1067
1051
|
{
|
|
1068
1052
|
property: "border-left-width",
|
|
1069
1053
|
value: { type: "unit", unit: "px", value: 1 }
|
|
1070
|
-
}
|
|
1071
|
-
];
|
|
1072
|
-
var hr = [
|
|
1073
|
-
{ property: "height", value: { type: "unit", unit: "number", value: 0 } },
|
|
1074
|
-
{ property: "color", value: { type: "keyword", value: "inherit" } },
|
|
1075
|
-
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1076
|
-
{
|
|
1077
|
-
property: "border-top-width",
|
|
1078
|
-
value: { type: "unit", unit: "px", value: 1 }
|
|
1079
|
-
},
|
|
1080
|
-
{
|
|
1081
|
-
property: "border-right-width",
|
|
1082
|
-
value: { type: "unit", unit: "px", value: 1 }
|
|
1083
1054
|
},
|
|
1084
1055
|
{
|
|
1085
|
-
property: "
|
|
1086
|
-
value: { type: "
|
|
1056
|
+
property: "-webkit-font-smoothing",
|
|
1057
|
+
value: { type: "keyword", value: "antialiased" }
|
|
1087
1058
|
},
|
|
1088
1059
|
{
|
|
1089
|
-
property: "
|
|
1090
|
-
value: { type: "
|
|
1060
|
+
property: "-moz-osx-font-smoothing",
|
|
1061
|
+
value: { type: "keyword", value: "grayscale" }
|
|
1091
1062
|
}
|
|
1092
1063
|
];
|
|
1064
|
+
var hr = [
|
|
1065
|
+
{ property: "height", value: { type: "unit", unit: "number", value: 0 } },
|
|
1066
|
+
{ property: "color", value: { type: "keyword", value: "inherit" } }
|
|
1067
|
+
];
|
|
1093
1068
|
var b = [
|
|
1094
1069
|
{
|
|
1095
1070
|
property: "font-weight",
|
|
@@ -1528,6 +1503,8 @@ var tagProperty = "data-ws-tag";
|
|
|
1528
1503
|
|
|
1529
1504
|
// src/__generated__/tags.ts
|
|
1530
1505
|
var tags = [
|
|
1506
|
+
"div",
|
|
1507
|
+
"span",
|
|
1531
1508
|
"a",
|
|
1532
1509
|
"abbr",
|
|
1533
1510
|
"address",
|
|
@@ -1555,7 +1532,6 @@ var tags = [
|
|
|
1555
1532
|
"details",
|
|
1556
1533
|
"dfn",
|
|
1557
1534
|
"dialog",
|
|
1558
|
-
"div",
|
|
1559
1535
|
"dl",
|
|
1560
1536
|
"dt",
|
|
1561
1537
|
"em",
|
|
@@ -1612,7 +1588,6 @@ var tags = [
|
|
|
1612
1588
|
"slot",
|
|
1613
1589
|
"small",
|
|
1614
1590
|
"source",
|
|
1615
|
-
"span",
|
|
1616
1591
|
"strong",
|
|
1617
1592
|
"sub",
|
|
1618
1593
|
"summary",
|
|
@@ -1643,17 +1618,12 @@ var rootMeta = {
|
|
|
1643
1618
|
html
|
|
1644
1619
|
}
|
|
1645
1620
|
};
|
|
1646
|
-
var rootPropsMeta = {
|
|
1647
|
-
props: {}
|
|
1648
|
-
};
|
|
1649
1621
|
var elementComponent = "ws:element";
|
|
1650
1622
|
var elementMeta = {
|
|
1651
1623
|
label: "Element",
|
|
1652
|
-
icon: BoxIcon,
|
|
1653
1624
|
// convert [object Module] to [object Object] to enable structured cloning
|
|
1654
|
-
presetStyle: { ...normalize_css_exports }
|
|
1655
|
-
|
|
1656
|
-
var elementPropsMeta = {
|
|
1625
|
+
presetStyle: { ...normalize_css_exports },
|
|
1626
|
+
initialProps: [tagProperty, "id", "class"],
|
|
1657
1627
|
props: {
|
|
1658
1628
|
[tagProperty]: {
|
|
1659
1629
|
type: "string",
|
|
@@ -1671,17 +1641,15 @@ var collectionMeta = {
|
|
|
1671
1641
|
contentModel: {
|
|
1672
1642
|
category: "instance",
|
|
1673
1643
|
children: ["instance"]
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
var collectionPropsMeta = {
|
|
1644
|
+
},
|
|
1645
|
+
initialProps: ["data"],
|
|
1677
1646
|
props: {
|
|
1678
1647
|
data: {
|
|
1679
1648
|
required: true,
|
|
1680
1649
|
control: "json",
|
|
1681
1650
|
type: "json"
|
|
1682
1651
|
}
|
|
1683
|
-
}
|
|
1684
|
-
initialProps: ["data"]
|
|
1652
|
+
}
|
|
1685
1653
|
};
|
|
1686
1654
|
var descendantComponent = "ws:descendant";
|
|
1687
1655
|
var descendantMeta = {
|
|
@@ -1692,9 +1660,8 @@ var descendantMeta = {
|
|
|
1692
1660
|
children: []
|
|
1693
1661
|
},
|
|
1694
1662
|
// @todo infer possible presets
|
|
1695
|
-
presetStyle: {}
|
|
1696
|
-
|
|
1697
|
-
var descendantPropsMeta = {
|
|
1663
|
+
presetStyle: {},
|
|
1664
|
+
initialProps: ["selector"],
|
|
1698
1665
|
props: {
|
|
1699
1666
|
selector: {
|
|
1700
1667
|
required: true,
|
|
@@ -1719,8 +1686,7 @@ var descendantPropsMeta = {
|
|
|
1719
1686
|
" hr"
|
|
1720
1687
|
]
|
|
1721
1688
|
}
|
|
1722
|
-
}
|
|
1723
|
-
initialProps: ["selector"]
|
|
1689
|
+
}
|
|
1724
1690
|
};
|
|
1725
1691
|
var blockComponent = "ws:block";
|
|
1726
1692
|
var blockTemplateComponent = "ws:block-template";
|
|
@@ -1731,9 +1697,6 @@ var blockTemplateMeta = {
|
|
|
1731
1697
|
children: ["instance"]
|
|
1732
1698
|
}
|
|
1733
1699
|
};
|
|
1734
|
-
var blockTemplatePropsMeta = {
|
|
1735
|
-
props: {}
|
|
1736
|
-
};
|
|
1737
1700
|
var blockMeta = {
|
|
1738
1701
|
label: "Content Block",
|
|
1739
1702
|
icon: ContentBlockIcon,
|
|
@@ -1742,9 +1705,6 @@ var blockMeta = {
|
|
|
1742
1705
|
children: [blockTemplateComponent, "instance"]
|
|
1743
1706
|
}
|
|
1744
1707
|
};
|
|
1745
|
-
var blockPropsMeta = {
|
|
1746
|
-
props: {}
|
|
1747
|
-
};
|
|
1748
1708
|
var coreMetas = {
|
|
1749
1709
|
[rootComponent]: rootMeta,
|
|
1750
1710
|
[elementComponent]: elementMeta,
|
|
@@ -1753,14 +1713,6 @@ var coreMetas = {
|
|
|
1753
1713
|
[blockComponent]: blockMeta,
|
|
1754
1714
|
[blockTemplateComponent]: blockTemplateMeta
|
|
1755
1715
|
};
|
|
1756
|
-
var corePropsMetas = {
|
|
1757
|
-
[rootComponent]: rootPropsMeta,
|
|
1758
|
-
[elementComponent]: elementPropsMeta,
|
|
1759
|
-
[collectionComponent]: collectionPropsMeta,
|
|
1760
|
-
[descendantComponent]: descendantPropsMeta,
|
|
1761
|
-
[blockComponent]: blockPropsMeta,
|
|
1762
|
-
[blockTemplateComponent]: blockTemplatePropsMeta
|
|
1763
|
-
};
|
|
1764
1716
|
var isCoreComponent = (component) => component === rootComponent || component === elementComponent || component === collectionComponent || component === descendantComponent || component === blockComponent || component === blockTemplateComponent;
|
|
1765
1717
|
var isComponentDetachable = (component) => component !== rootComponent && component !== blockTemplateComponent && component !== descendantComponent;
|
|
1766
1718
|
|
|
@@ -2854,12 +2806,10 @@ export {
|
|
|
2854
2806
|
collectionComponent,
|
|
2855
2807
|
componentCategories,
|
|
2856
2808
|
coreMetas,
|
|
2857
|
-
corePropsMetas,
|
|
2858
2809
|
createImageValueTransformer,
|
|
2859
2810
|
createScope,
|
|
2860
2811
|
decodeDataVariableId as decodeDataSourceVariable,
|
|
2861
2812
|
decodeDataVariableId,
|
|
2862
|
-
defaultStates,
|
|
2863
2813
|
descendantComponent,
|
|
2864
2814
|
documentTypes,
|
|
2865
2815
|
durationUnitValueSchema,
|
|
@@ -2897,7 +2847,6 @@ export {
|
|
|
2897
2847
|
replaceFormActionsWithResources,
|
|
2898
2848
|
rootComponent,
|
|
2899
2849
|
scrollAnimationSchema,
|
|
2900
|
-
stateCategories,
|
|
2901
2850
|
systemParameter,
|
|
2902
2851
|
tags,
|
|
2903
2852
|
transpileExpression,
|