@webstudio-is/sdk 0.212.0 → 0.213.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 +13 -18
- package/lib/index.js +32 -18
- package/lib/types/schema/component-meta.d.ts +43 -0
- package/package.json +5 -5
package/lib/core-templates.js
CHANGED
|
@@ -79,12 +79,12 @@ var descendantMeta = {
|
|
|
79
79
|
type: "control",
|
|
80
80
|
label: "Descendant",
|
|
81
81
|
icon: PaintBrushIcon,
|
|
82
|
+
contentModel: {
|
|
83
|
+
category: "none",
|
|
84
|
+
children: ["empty"]
|
|
85
|
+
},
|
|
82
86
|
// @todo infer possible presets
|
|
83
|
-
presetStyle: {}
|
|
84
|
-
constraints: {
|
|
85
|
-
relation: "parent",
|
|
86
|
-
component: { $in: ["HtmlEmbed", "MarkdownEmbed"] }
|
|
87
|
-
}
|
|
87
|
+
presetStyle: {}
|
|
88
88
|
};
|
|
89
89
|
var descendantPropsMeta = {
|
|
90
90
|
props: {
|
|
@@ -119,9 +119,9 @@ var blockTemplateComponent = "ws:block-template";
|
|
|
119
119
|
var blockTemplateMeta = {
|
|
120
120
|
type: "container",
|
|
121
121
|
icon: AddTemplateInstanceIcon,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
contentModel: {
|
|
123
|
+
category: "none",
|
|
124
|
+
children: ["instance"]
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
var blockTemplatePropsMeta = {
|
|
@@ -131,16 +131,11 @@ var blockMeta = {
|
|
|
131
131
|
type: "container",
|
|
132
132
|
label: "Content Block",
|
|
133
133
|
icon: ContentBlockIcon,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
{
|
|
140
|
-
relation: "child",
|
|
141
|
-
component: { $eq: blockTemplateComponent }
|
|
142
|
-
}
|
|
143
|
-
]
|
|
134
|
+
contentModel: {
|
|
135
|
+
category: "instance",
|
|
136
|
+
children: [blockTemplateComponent, "instance"]
|
|
137
|
+
// @todo prevent deleting block template
|
|
138
|
+
}
|
|
144
139
|
};
|
|
145
140
|
var blockPropsMeta = {
|
|
146
141
|
props: {}
|
package/lib/index.js
CHANGED
|
@@ -981,6 +981,23 @@ var defaultStates = [
|
|
|
981
981
|
{ selector: ":focus-visible", label: "Focus Visible" },
|
|
982
982
|
{ selector: ":focus-within", label: "Focus Within" }
|
|
983
983
|
];
|
|
984
|
+
var ContentModel = z16.object({
|
|
985
|
+
/*
|
|
986
|
+
* instance - accepted by any parent with "instance" in children categories
|
|
987
|
+
* none - accepted by parents with this component name in children categories
|
|
988
|
+
*/
|
|
989
|
+
category: z16.union([z16.literal("instance"), z16.literal("none")]),
|
|
990
|
+
/**
|
|
991
|
+
* transparent - pass through possible children from parent
|
|
992
|
+
* rich-text - can be edited as rich text
|
|
993
|
+
* instance - other instances accepted
|
|
994
|
+
* empty - no children accepted
|
|
995
|
+
* ComponentName - accept specific components with none category
|
|
996
|
+
*/
|
|
997
|
+
children: z16.array(
|
|
998
|
+
z16.string()
|
|
999
|
+
)
|
|
1000
|
+
});
|
|
984
1001
|
var WsComponentMeta = z16.object({
|
|
985
1002
|
category: z16.enum(componentCategories).optional(),
|
|
986
1003
|
// container - can accept other components with dnd or be edited as text
|
|
@@ -994,6 +1011,7 @@ var WsComponentMeta = z16.object({
|
|
|
994
1011
|
*/
|
|
995
1012
|
placeholder: z16.string().optional(),
|
|
996
1013
|
constraints: Matchers.optional(),
|
|
1014
|
+
contentModel: ContentModel.optional(),
|
|
997
1015
|
// when this field is specified component receives
|
|
998
1016
|
// prop with index of same components withiin specified ancestor
|
|
999
1017
|
// important to automatically enumerate collections without
|
|
@@ -1080,12 +1098,12 @@ var descendantMeta = {
|
|
|
1080
1098
|
type: "control",
|
|
1081
1099
|
label: "Descendant",
|
|
1082
1100
|
icon: PaintBrushIcon,
|
|
1101
|
+
contentModel: {
|
|
1102
|
+
category: "none",
|
|
1103
|
+
children: ["empty"]
|
|
1104
|
+
},
|
|
1083
1105
|
// @todo infer possible presets
|
|
1084
|
-
presetStyle: {}
|
|
1085
|
-
constraints: {
|
|
1086
|
-
relation: "parent",
|
|
1087
|
-
component: { $in: ["HtmlEmbed", "MarkdownEmbed"] }
|
|
1088
|
-
}
|
|
1106
|
+
presetStyle: {}
|
|
1089
1107
|
};
|
|
1090
1108
|
var descendantPropsMeta = {
|
|
1091
1109
|
props: {
|
|
@@ -1120,9 +1138,9 @@ var blockTemplateComponent = "ws:block-template";
|
|
|
1120
1138
|
var blockTemplateMeta = {
|
|
1121
1139
|
type: "container",
|
|
1122
1140
|
icon: AddTemplateInstanceIcon,
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1141
|
+
contentModel: {
|
|
1142
|
+
category: "none",
|
|
1143
|
+
children: ["instance"]
|
|
1126
1144
|
}
|
|
1127
1145
|
};
|
|
1128
1146
|
var blockTemplatePropsMeta = {
|
|
@@ -1132,16 +1150,11 @@ var blockMeta = {
|
|
|
1132
1150
|
type: "container",
|
|
1133
1151
|
label: "Content Block",
|
|
1134
1152
|
icon: ContentBlockIcon,
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
{
|
|
1141
|
-
relation: "child",
|
|
1142
|
-
component: { $eq: blockTemplateComponent }
|
|
1143
|
-
}
|
|
1144
|
-
]
|
|
1153
|
+
contentModel: {
|
|
1154
|
+
category: "instance",
|
|
1155
|
+
children: [blockTemplateComponent, "instance"]
|
|
1156
|
+
// @todo prevent deleting block template
|
|
1157
|
+
}
|
|
1145
1158
|
};
|
|
1146
1159
|
var blockPropsMeta = {
|
|
1147
1160
|
props: {}
|
|
@@ -2175,6 +2188,7 @@ export {
|
|
|
2175
2188
|
Breakpoints,
|
|
2176
2189
|
CompilerSettings,
|
|
2177
2190
|
ComponentState,
|
|
2191
|
+
ContentModel,
|
|
2178
2192
|
DataSource,
|
|
2179
2193
|
DataSourceVariableValue,
|
|
2180
2194
|
DataSources,
|
|
@@ -5910,6 +5910,24 @@ export declare const ComponentState: z.ZodObject<{
|
|
|
5910
5910
|
}>;
|
|
5911
5911
|
export type ComponentState = z.infer<typeof ComponentState>;
|
|
5912
5912
|
export declare const defaultStates: ComponentState[];
|
|
5913
|
+
export declare const ContentModel: z.ZodObject<{
|
|
5914
|
+
category: z.ZodUnion<[z.ZodLiteral<"instance">, z.ZodLiteral<"none">]>;
|
|
5915
|
+
/**
|
|
5916
|
+
* transparent - pass through possible children from parent
|
|
5917
|
+
* rich-text - can be edited as rich text
|
|
5918
|
+
* instance - other instances accepted
|
|
5919
|
+
* empty - no children accepted
|
|
5920
|
+
* ComponentName - accept specific components with none category
|
|
5921
|
+
*/
|
|
5922
|
+
children: z.ZodArray<z.ZodType<"instance" | (string & {}) | "transparent" | "rich-text" | "empty", z.ZodTypeDef, "instance" | (string & {}) | "transparent" | "rich-text" | "empty">, "many">;
|
|
5923
|
+
}, "strip", z.ZodTypeAny, {
|
|
5924
|
+
children: ("instance" | (string & {}) | "transparent" | "rich-text" | "empty")[];
|
|
5925
|
+
category: "none" | "instance";
|
|
5926
|
+
}, {
|
|
5927
|
+
children: ("instance" | (string & {}) | "transparent" | "rich-text" | "empty")[];
|
|
5928
|
+
category: "none" | "instance";
|
|
5929
|
+
}>;
|
|
5930
|
+
export type ContentModel = z.infer<typeof ContentModel>;
|
|
5913
5931
|
export declare const WsComponentMeta: z.ZodObject<{
|
|
5914
5932
|
category: z.ZodOptional<z.ZodEnum<["general", "typography", "media", "animations", "data", "forms", "localization", "radix", "xml", "hidden", "internal"]>>;
|
|
5915
5933
|
type: z.ZodEnum<["container", "control", "embed", "rich-text-child"]>;
|
|
@@ -6049,6 +6067,23 @@ export declare const WsComponentMeta: z.ZodObject<{
|
|
|
6049
6067
|
$nin?: string[] | undefined;
|
|
6050
6068
|
} | undefined;
|
|
6051
6069
|
}>, "many">]>>;
|
|
6070
|
+
contentModel: z.ZodOptional<z.ZodObject<{
|
|
6071
|
+
category: z.ZodUnion<[z.ZodLiteral<"instance">, z.ZodLiteral<"none">]>;
|
|
6072
|
+
/**
|
|
6073
|
+
* transparent - pass through possible children from parent
|
|
6074
|
+
* rich-text - can be edited as rich text
|
|
6075
|
+
* instance - other instances accepted
|
|
6076
|
+
* empty - no children accepted
|
|
6077
|
+
* ComponentName - accept specific components with none category
|
|
6078
|
+
*/
|
|
6079
|
+
children: z.ZodArray<z.ZodType<"instance" | (string & {}) | "transparent" | "rich-text" | "empty", z.ZodTypeDef, "instance" | (string & {}) | "transparent" | "rich-text" | "empty">, "many">;
|
|
6080
|
+
}, "strip", z.ZodTypeAny, {
|
|
6081
|
+
children: ("instance" | (string & {}) | "transparent" | "rich-text" | "empty")[];
|
|
6082
|
+
category: "none" | "instance";
|
|
6083
|
+
}, {
|
|
6084
|
+
children: ("instance" | (string & {}) | "transparent" | "rich-text" | "empty")[];
|
|
6085
|
+
category: "none" | "instance";
|
|
6086
|
+
}>>;
|
|
6052
6087
|
indexWithinAncestor: z.ZodOptional<z.ZodString>;
|
|
6053
6088
|
label: z.ZodOptional<z.ZodString>;
|
|
6054
6089
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -11167,6 +11202,10 @@ export declare const WsComponentMeta: z.ZodObject<{
|
|
|
11167
11202
|
$nin?: string[] | undefined;
|
|
11168
11203
|
} | undefined;
|
|
11169
11204
|
}[] | undefined;
|
|
11205
|
+
contentModel?: {
|
|
11206
|
+
children: ("instance" | (string & {}) | "transparent" | "rich-text" | "empty")[];
|
|
11207
|
+
category: "none" | "instance";
|
|
11208
|
+
} | undefined;
|
|
11170
11209
|
indexWithinAncestor?: string | undefined;
|
|
11171
11210
|
presetStyle?: Record<string, {
|
|
11172
11211
|
value: {
|
|
@@ -11818,6 +11857,10 @@ export declare const WsComponentMeta: z.ZodObject<{
|
|
|
11818
11857
|
$nin?: string[] | undefined;
|
|
11819
11858
|
} | undefined;
|
|
11820
11859
|
}[] | undefined;
|
|
11860
|
+
contentModel?: {
|
|
11861
|
+
children: ("instance" | (string & {}) | "transparent" | "rich-text" | "empty")[];
|
|
11862
|
+
category: "none" | "instance";
|
|
11863
|
+
} | undefined;
|
|
11821
11864
|
indexWithinAncestor?: string | undefined;
|
|
11822
11865
|
presetStyle?: Record<string, {
|
|
11823
11866
|
value: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.213.0",
|
|
4
4
|
"description": "Webstudio project data schema",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"reserved-identifiers": "^1.0.0",
|
|
41
41
|
"type-fest": "^4.37.0",
|
|
42
42
|
"zod": "^3.24.2",
|
|
43
|
-
"@webstudio-is/
|
|
44
|
-
"@webstudio-is/
|
|
45
|
-
"@webstudio-is/
|
|
43
|
+
"@webstudio-is/fonts": "0.213.0",
|
|
44
|
+
"@webstudio-is/icons": "0.213.0",
|
|
45
|
+
"@webstudio-is/css-engine": "0.213.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"html-tags": "^4.0.0",
|
|
49
49
|
"vitest": "^3.0.8",
|
|
50
50
|
"@webstudio-is/css-data": "0.0.0",
|
|
51
|
-
"@webstudio-is/template": "0.
|
|
51
|
+
"@webstudio-is/template": "0.213.0",
|
|
52
52
|
"@webstudio-is/tsconfig": "1.0.7"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|