@webstudio-is/react-sdk 0.191.4 → 0.192.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/index.js +1723 -0
- package/lib/runtime.js +61 -0
- package/lib/types/component-generator.d.ts +37 -0
- package/lib/types/component-generator.test.d.ts +1 -0
- package/lib/types/components/component-meta.d.ts +3792 -0
- package/lib/types/components/components-utils.d.ts +8 -0
- package/lib/types/context.d.ts +37 -0
- package/lib/types/core-components.d.ts +748 -0
- package/lib/types/css/css.d.ts +21 -0
- package/lib/types/css/css.test.d.ts +1 -0
- package/lib/types/css/global-rules.d.ts +6 -0
- package/lib/types/css/index.d.ts +2 -0
- package/lib/types/embed-template.d.ts +2587 -0
- package/lib/types/embed-template.test.d.ts +1 -0
- package/lib/types/hook.d.ts +34 -0
- package/lib/types/hook.test.d.ts +1 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/instance-utils.d.ts +4 -0
- package/lib/types/instance-utils.test.d.ts +1 -0
- package/lib/types/prop-meta.d.ts +434 -0
- package/lib/types/props.d.ts +104 -0
- package/lib/types/props.test.d.ts +1 -0
- package/lib/types/remix.d.ts +20 -0
- package/lib/types/remix.test.d.ts +1 -0
- package/lib/types/runtime.d.ts +4 -0
- package/lib/types/variable-state.d.ts +2 -0
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Instance, Prop } from "@webstudio-is/sdk";
|
|
2
|
+
import type { IndexesWithinAncestors } from "./instance-utils";
|
|
3
|
+
export type InstanceData = {
|
|
4
|
+
id: Instance["id"];
|
|
5
|
+
instanceKey: string;
|
|
6
|
+
component: Instance["component"];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Hooks are subscriptions to builder events
|
|
10
|
+
* with limited way to interact with it.
|
|
11
|
+
* Called independently from components.
|
|
12
|
+
*/
|
|
13
|
+
export type HookContext = {
|
|
14
|
+
indexesWithinAncestors: IndexesWithinAncestors;
|
|
15
|
+
getPropValue: (instanceData: InstanceData, propName: Prop["name"]) => unknown;
|
|
16
|
+
setMemoryProp: (instanceData: InstanceData, propName: Prop["name"], value: unknown) => void;
|
|
17
|
+
};
|
|
18
|
+
export type InstancePath = InstanceData[];
|
|
19
|
+
type NavigatorEvent = {
|
|
20
|
+
/**
|
|
21
|
+
* List of instances from selected to the root
|
|
22
|
+
*/
|
|
23
|
+
instancePath: InstancePath;
|
|
24
|
+
};
|
|
25
|
+
export type Hook = {
|
|
26
|
+
onNavigatorSelect?: (context: HookContext, event: NavigatorEvent) => void;
|
|
27
|
+
onNavigatorUnselect?: (context: HookContext, event: NavigatorEvent) => void;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Find closest matching instance by component name
|
|
31
|
+
* by lookup in instance path
|
|
32
|
+
*/
|
|
33
|
+
export declare const getClosestInstance: (instancePath: InstancePath, currentInstance: InstanceData, closestComponent: InstanceData["component"]) => InstanceData | undefined;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./remix";
|
|
2
|
+
export * from "./css/index";
|
|
3
|
+
export * from "./core-components";
|
|
4
|
+
export * from "./components/components-utils";
|
|
5
|
+
export { PropMeta } from "./prop-meta";
|
|
6
|
+
export { type WsComponentPropsMeta, type ComponentState, type PresetStyle, WsComponentMeta, componentCategories, stateCategories, defaultStates, } from "./components/component-meta";
|
|
7
|
+
export * from "./embed-template";
|
|
8
|
+
export * from "./props";
|
|
9
|
+
export type * from "./context";
|
|
10
|
+
export { getIndexesWithinAncestors } from "./instance-utils";
|
|
11
|
+
export type * from "./hook";
|
|
12
|
+
export { generateWebstudioComponent, generateJsxElement, generateJsxChildren, } from "./component-generator";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Instance, Instances } from "@webstudio-is/sdk";
|
|
2
|
+
import type { WsComponentMeta } from "./components/component-meta";
|
|
3
|
+
export type IndexesWithinAncestors = Map<Instance["id"], number>;
|
|
4
|
+
export declare const getIndexesWithinAncestors: (metas: Map<Instance["component"], WsComponentMeta>, instances: Instances, rootIds: Instance["id"][]) => IndexesWithinAncestors;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PropMeta: z.ZodUnion<[z.ZodObject<{
|
|
3
|
+
control: z.ZodLiteral<"number">;
|
|
4
|
+
type: z.ZodLiteral<"number">;
|
|
5
|
+
defaultValue: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
label: z.ZodOptional<z.ZodString>;
|
|
7
|
+
description: z.ZodOptional<z.ZodString>;
|
|
8
|
+
required: z.ZodBoolean;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: "number";
|
|
11
|
+
required: boolean;
|
|
12
|
+
control: "number";
|
|
13
|
+
defaultValue?: number | undefined;
|
|
14
|
+
label?: string | undefined;
|
|
15
|
+
description?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
type: "number";
|
|
18
|
+
required: boolean;
|
|
19
|
+
control: "number";
|
|
20
|
+
defaultValue?: number | undefined;
|
|
21
|
+
label?: string | undefined;
|
|
22
|
+
description?: string | undefined;
|
|
23
|
+
}>, z.ZodObject<{
|
|
24
|
+
control: z.ZodLiteral<"range">;
|
|
25
|
+
type: z.ZodLiteral<"number">;
|
|
26
|
+
defaultValue: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
label: z.ZodOptional<z.ZodString>;
|
|
28
|
+
description: z.ZodOptional<z.ZodString>;
|
|
29
|
+
required: z.ZodBoolean;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
type: "number";
|
|
32
|
+
required: boolean;
|
|
33
|
+
control: "range";
|
|
34
|
+
defaultValue?: number | undefined;
|
|
35
|
+
label?: string | undefined;
|
|
36
|
+
description?: string | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
type: "number";
|
|
39
|
+
required: boolean;
|
|
40
|
+
control: "range";
|
|
41
|
+
defaultValue?: number | undefined;
|
|
42
|
+
label?: string | undefined;
|
|
43
|
+
description?: string | undefined;
|
|
44
|
+
}>, z.ZodObject<{
|
|
45
|
+
control: z.ZodLiteral<"text">;
|
|
46
|
+
type: z.ZodLiteral<"string">;
|
|
47
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
48
|
+
/**
|
|
49
|
+
* The number of rows in <textarea>. If set to 0 an <input> will be used instead.
|
|
50
|
+
* In line with Storybook team's plan: https://github.com/storybookjs/storybook/issues/21100
|
|
51
|
+
*/
|
|
52
|
+
rows: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
label: z.ZodOptional<z.ZodString>;
|
|
54
|
+
description: z.ZodOptional<z.ZodString>;
|
|
55
|
+
required: z.ZodBoolean;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
type: "string";
|
|
58
|
+
required: boolean;
|
|
59
|
+
control: "text";
|
|
60
|
+
defaultValue?: string | undefined;
|
|
61
|
+
rows?: number | undefined;
|
|
62
|
+
label?: string | undefined;
|
|
63
|
+
description?: string | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
type: "string";
|
|
66
|
+
required: boolean;
|
|
67
|
+
control: "text";
|
|
68
|
+
defaultValue?: string | undefined;
|
|
69
|
+
rows?: number | undefined;
|
|
70
|
+
label?: string | undefined;
|
|
71
|
+
description?: string | undefined;
|
|
72
|
+
}>, z.ZodObject<{
|
|
73
|
+
control: z.ZodLiteral<"code">;
|
|
74
|
+
type: z.ZodLiteral<"string">;
|
|
75
|
+
language: z.ZodUnion<[z.ZodLiteral<"html">, z.ZodLiteral<"markdown">]>;
|
|
76
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
77
|
+
label: z.ZodOptional<z.ZodString>;
|
|
78
|
+
description: z.ZodOptional<z.ZodString>;
|
|
79
|
+
required: z.ZodBoolean;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
type: "string";
|
|
82
|
+
required: boolean;
|
|
83
|
+
language: "html" | "markdown";
|
|
84
|
+
control: "code";
|
|
85
|
+
defaultValue?: string | undefined;
|
|
86
|
+
label?: string | undefined;
|
|
87
|
+
description?: string | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
type: "string";
|
|
90
|
+
required: boolean;
|
|
91
|
+
language: "html" | "markdown";
|
|
92
|
+
control: "code";
|
|
93
|
+
defaultValue?: string | undefined;
|
|
94
|
+
label?: string | undefined;
|
|
95
|
+
description?: string | undefined;
|
|
96
|
+
}>, z.ZodObject<{
|
|
97
|
+
control: z.ZodLiteral<"codetext">;
|
|
98
|
+
type: z.ZodLiteral<"string">;
|
|
99
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
100
|
+
label: z.ZodOptional<z.ZodString>;
|
|
101
|
+
description: z.ZodOptional<z.ZodString>;
|
|
102
|
+
required: z.ZodBoolean;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
type: "string";
|
|
105
|
+
required: boolean;
|
|
106
|
+
control: "codetext";
|
|
107
|
+
defaultValue?: string | undefined;
|
|
108
|
+
label?: string | undefined;
|
|
109
|
+
description?: string | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
type: "string";
|
|
112
|
+
required: boolean;
|
|
113
|
+
control: "codetext";
|
|
114
|
+
defaultValue?: string | undefined;
|
|
115
|
+
label?: string | undefined;
|
|
116
|
+
description?: string | undefined;
|
|
117
|
+
}>, z.ZodObject<{
|
|
118
|
+
control: z.ZodLiteral<"color">;
|
|
119
|
+
type: z.ZodLiteral<"string">;
|
|
120
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
121
|
+
label: z.ZodOptional<z.ZodString>;
|
|
122
|
+
description: z.ZodOptional<z.ZodString>;
|
|
123
|
+
required: z.ZodBoolean;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
type: "string";
|
|
126
|
+
required: boolean;
|
|
127
|
+
control: "color";
|
|
128
|
+
defaultValue?: string | undefined;
|
|
129
|
+
label?: string | undefined;
|
|
130
|
+
description?: string | undefined;
|
|
131
|
+
}, {
|
|
132
|
+
type: "string";
|
|
133
|
+
required: boolean;
|
|
134
|
+
control: "color";
|
|
135
|
+
defaultValue?: string | undefined;
|
|
136
|
+
label?: string | undefined;
|
|
137
|
+
description?: string | undefined;
|
|
138
|
+
}>, z.ZodObject<{
|
|
139
|
+
control: z.ZodLiteral<"boolean">;
|
|
140
|
+
type: z.ZodLiteral<"boolean">;
|
|
141
|
+
defaultValue: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
label: z.ZodOptional<z.ZodString>;
|
|
143
|
+
description: z.ZodOptional<z.ZodString>;
|
|
144
|
+
required: z.ZodBoolean;
|
|
145
|
+
}, "strip", z.ZodTypeAny, {
|
|
146
|
+
type: "boolean";
|
|
147
|
+
required: boolean;
|
|
148
|
+
control: "boolean";
|
|
149
|
+
defaultValue?: boolean | undefined;
|
|
150
|
+
label?: string | undefined;
|
|
151
|
+
description?: string | undefined;
|
|
152
|
+
}, {
|
|
153
|
+
type: "boolean";
|
|
154
|
+
required: boolean;
|
|
155
|
+
control: "boolean";
|
|
156
|
+
defaultValue?: boolean | undefined;
|
|
157
|
+
label?: string | undefined;
|
|
158
|
+
description?: string | undefined;
|
|
159
|
+
}>, z.ZodObject<{
|
|
160
|
+
control: z.ZodLiteral<"radio">;
|
|
161
|
+
type: z.ZodLiteral<"string">;
|
|
162
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
163
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
164
|
+
label: z.ZodOptional<z.ZodString>;
|
|
165
|
+
description: z.ZodOptional<z.ZodString>;
|
|
166
|
+
required: z.ZodBoolean;
|
|
167
|
+
}, "strip", z.ZodTypeAny, {
|
|
168
|
+
options: string[];
|
|
169
|
+
type: "string";
|
|
170
|
+
required: boolean;
|
|
171
|
+
control: "radio";
|
|
172
|
+
defaultValue?: string | undefined;
|
|
173
|
+
label?: string | undefined;
|
|
174
|
+
description?: string | undefined;
|
|
175
|
+
}, {
|
|
176
|
+
options: string[];
|
|
177
|
+
type: "string";
|
|
178
|
+
required: boolean;
|
|
179
|
+
control: "radio";
|
|
180
|
+
defaultValue?: string | undefined;
|
|
181
|
+
label?: string | undefined;
|
|
182
|
+
description?: string | undefined;
|
|
183
|
+
}>, z.ZodObject<{
|
|
184
|
+
control: z.ZodLiteral<"inline-radio">;
|
|
185
|
+
type: z.ZodLiteral<"string">;
|
|
186
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
187
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
188
|
+
label: z.ZodOptional<z.ZodString>;
|
|
189
|
+
description: z.ZodOptional<z.ZodString>;
|
|
190
|
+
required: z.ZodBoolean;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
options: string[];
|
|
193
|
+
type: "string";
|
|
194
|
+
required: boolean;
|
|
195
|
+
control: "inline-radio";
|
|
196
|
+
defaultValue?: string | undefined;
|
|
197
|
+
label?: string | undefined;
|
|
198
|
+
description?: string | undefined;
|
|
199
|
+
}, {
|
|
200
|
+
options: string[];
|
|
201
|
+
type: "string";
|
|
202
|
+
required: boolean;
|
|
203
|
+
control: "inline-radio";
|
|
204
|
+
defaultValue?: string | undefined;
|
|
205
|
+
label?: string | undefined;
|
|
206
|
+
description?: string | undefined;
|
|
207
|
+
}>, z.ZodObject<{
|
|
208
|
+
control: z.ZodLiteral<"select">;
|
|
209
|
+
type: z.ZodLiteral<"string">;
|
|
210
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
211
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
212
|
+
label: z.ZodOptional<z.ZodString>;
|
|
213
|
+
description: z.ZodOptional<z.ZodString>;
|
|
214
|
+
required: z.ZodBoolean;
|
|
215
|
+
}, "strip", z.ZodTypeAny, {
|
|
216
|
+
options: string[];
|
|
217
|
+
type: "string";
|
|
218
|
+
required: boolean;
|
|
219
|
+
control: "select";
|
|
220
|
+
defaultValue?: string | undefined;
|
|
221
|
+
label?: string | undefined;
|
|
222
|
+
description?: string | undefined;
|
|
223
|
+
}, {
|
|
224
|
+
options: string[];
|
|
225
|
+
type: "string";
|
|
226
|
+
required: boolean;
|
|
227
|
+
control: "select";
|
|
228
|
+
defaultValue?: string | undefined;
|
|
229
|
+
label?: string | undefined;
|
|
230
|
+
description?: string | undefined;
|
|
231
|
+
}>, z.ZodObject<{
|
|
232
|
+
control: z.ZodLiteral<"multi-select">;
|
|
233
|
+
type: z.ZodLiteral<"string[]">;
|
|
234
|
+
defaultValue: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
235
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
236
|
+
label: z.ZodOptional<z.ZodString>;
|
|
237
|
+
description: z.ZodOptional<z.ZodString>;
|
|
238
|
+
required: z.ZodBoolean;
|
|
239
|
+
}, "strip", z.ZodTypeAny, {
|
|
240
|
+
options: string[];
|
|
241
|
+
type: "string[]";
|
|
242
|
+
required: boolean;
|
|
243
|
+
control: "multi-select";
|
|
244
|
+
defaultValue?: string[] | undefined;
|
|
245
|
+
label?: string | undefined;
|
|
246
|
+
description?: string | undefined;
|
|
247
|
+
}, {
|
|
248
|
+
options: string[];
|
|
249
|
+
type: "string[]";
|
|
250
|
+
required: boolean;
|
|
251
|
+
control: "multi-select";
|
|
252
|
+
defaultValue?: string[] | undefined;
|
|
253
|
+
label?: string | undefined;
|
|
254
|
+
description?: string | undefined;
|
|
255
|
+
}>, z.ZodObject<{
|
|
256
|
+
control: z.ZodLiteral<"check">;
|
|
257
|
+
type: z.ZodLiteral<"string[]">;
|
|
258
|
+
defaultValue: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
259
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
260
|
+
label: z.ZodOptional<z.ZodString>;
|
|
261
|
+
description: z.ZodOptional<z.ZodString>;
|
|
262
|
+
required: z.ZodBoolean;
|
|
263
|
+
}, "strip", z.ZodTypeAny, {
|
|
264
|
+
options: string[];
|
|
265
|
+
type: "string[]";
|
|
266
|
+
required: boolean;
|
|
267
|
+
control: "check";
|
|
268
|
+
defaultValue?: string[] | undefined;
|
|
269
|
+
label?: string | undefined;
|
|
270
|
+
description?: string | undefined;
|
|
271
|
+
}, {
|
|
272
|
+
options: string[];
|
|
273
|
+
type: "string[]";
|
|
274
|
+
required: boolean;
|
|
275
|
+
control: "check";
|
|
276
|
+
defaultValue?: string[] | undefined;
|
|
277
|
+
label?: string | undefined;
|
|
278
|
+
description?: string | undefined;
|
|
279
|
+
}>, z.ZodObject<{
|
|
280
|
+
control: z.ZodLiteral<"inline-check">;
|
|
281
|
+
type: z.ZodLiteral<"string[]">;
|
|
282
|
+
defaultValue: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
283
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
284
|
+
label: z.ZodOptional<z.ZodString>;
|
|
285
|
+
description: z.ZodOptional<z.ZodString>;
|
|
286
|
+
required: z.ZodBoolean;
|
|
287
|
+
}, "strip", z.ZodTypeAny, {
|
|
288
|
+
options: string[];
|
|
289
|
+
type: "string[]";
|
|
290
|
+
required: boolean;
|
|
291
|
+
control: "inline-check";
|
|
292
|
+
defaultValue?: string[] | undefined;
|
|
293
|
+
label?: string | undefined;
|
|
294
|
+
description?: string | undefined;
|
|
295
|
+
}, {
|
|
296
|
+
options: string[];
|
|
297
|
+
type: "string[]";
|
|
298
|
+
required: boolean;
|
|
299
|
+
control: "inline-check";
|
|
300
|
+
defaultValue?: string[] | undefined;
|
|
301
|
+
label?: string | undefined;
|
|
302
|
+
description?: string | undefined;
|
|
303
|
+
}>, z.ZodObject<{
|
|
304
|
+
control: z.ZodLiteral<"file">;
|
|
305
|
+
type: z.ZodLiteral<"string">;
|
|
306
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
307
|
+
/** https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept */
|
|
308
|
+
accept: z.ZodOptional<z.ZodString>;
|
|
309
|
+
label: z.ZodOptional<z.ZodString>;
|
|
310
|
+
description: z.ZodOptional<z.ZodString>;
|
|
311
|
+
required: z.ZodBoolean;
|
|
312
|
+
}, "strip", z.ZodTypeAny, {
|
|
313
|
+
type: "string";
|
|
314
|
+
required: boolean;
|
|
315
|
+
control: "file";
|
|
316
|
+
defaultValue?: string | undefined;
|
|
317
|
+
accept?: string | undefined;
|
|
318
|
+
label?: string | undefined;
|
|
319
|
+
description?: string | undefined;
|
|
320
|
+
}, {
|
|
321
|
+
type: "string";
|
|
322
|
+
required: boolean;
|
|
323
|
+
control: "file";
|
|
324
|
+
defaultValue?: string | undefined;
|
|
325
|
+
accept?: string | undefined;
|
|
326
|
+
label?: string | undefined;
|
|
327
|
+
description?: string | undefined;
|
|
328
|
+
}>, z.ZodObject<{
|
|
329
|
+
control: z.ZodLiteral<"url">;
|
|
330
|
+
type: z.ZodLiteral<"string">;
|
|
331
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
332
|
+
label: z.ZodOptional<z.ZodString>;
|
|
333
|
+
description: z.ZodOptional<z.ZodString>;
|
|
334
|
+
required: z.ZodBoolean;
|
|
335
|
+
}, "strip", z.ZodTypeAny, {
|
|
336
|
+
type: "string";
|
|
337
|
+
required: boolean;
|
|
338
|
+
control: "url";
|
|
339
|
+
defaultValue?: string | undefined;
|
|
340
|
+
label?: string | undefined;
|
|
341
|
+
description?: string | undefined;
|
|
342
|
+
}, {
|
|
343
|
+
type: "string";
|
|
344
|
+
required: boolean;
|
|
345
|
+
control: "url";
|
|
346
|
+
defaultValue?: string | undefined;
|
|
347
|
+
label?: string | undefined;
|
|
348
|
+
description?: string | undefined;
|
|
349
|
+
}>, z.ZodObject<{
|
|
350
|
+
control: z.ZodLiteral<"json">;
|
|
351
|
+
type: z.ZodLiteral<"json">;
|
|
352
|
+
defaultValue: z.ZodOptional<z.ZodUnknown>;
|
|
353
|
+
label: z.ZodOptional<z.ZodString>;
|
|
354
|
+
description: z.ZodOptional<z.ZodString>;
|
|
355
|
+
required: z.ZodBoolean;
|
|
356
|
+
}, "strip", z.ZodTypeAny, {
|
|
357
|
+
type: "json";
|
|
358
|
+
required: boolean;
|
|
359
|
+
control: "json";
|
|
360
|
+
defaultValue?: unknown;
|
|
361
|
+
label?: string | undefined;
|
|
362
|
+
description?: string | undefined;
|
|
363
|
+
}, {
|
|
364
|
+
type: "json";
|
|
365
|
+
required: boolean;
|
|
366
|
+
control: "json";
|
|
367
|
+
defaultValue?: unknown;
|
|
368
|
+
label?: string | undefined;
|
|
369
|
+
description?: string | undefined;
|
|
370
|
+
}>, z.ZodObject<{
|
|
371
|
+
control: z.ZodLiteral<"date">;
|
|
372
|
+
type: z.ZodLiteral<"string">;
|
|
373
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
374
|
+
label: z.ZodOptional<z.ZodString>;
|
|
375
|
+
description: z.ZodOptional<z.ZodString>;
|
|
376
|
+
required: z.ZodBoolean;
|
|
377
|
+
}, "strip", z.ZodTypeAny, {
|
|
378
|
+
type: "string";
|
|
379
|
+
required: boolean;
|
|
380
|
+
control: "date";
|
|
381
|
+
defaultValue?: string | undefined;
|
|
382
|
+
label?: string | undefined;
|
|
383
|
+
description?: string | undefined;
|
|
384
|
+
}, {
|
|
385
|
+
type: "string";
|
|
386
|
+
required: boolean;
|
|
387
|
+
control: "date";
|
|
388
|
+
defaultValue?: string | undefined;
|
|
389
|
+
label?: string | undefined;
|
|
390
|
+
description?: string | undefined;
|
|
391
|
+
}>, z.ZodObject<{
|
|
392
|
+
control: z.ZodLiteral<"action">;
|
|
393
|
+
type: z.ZodLiteral<"action">;
|
|
394
|
+
defaultValue: z.ZodOptional<z.ZodUndefined>;
|
|
395
|
+
label: z.ZodOptional<z.ZodString>;
|
|
396
|
+
description: z.ZodOptional<z.ZodString>;
|
|
397
|
+
required: z.ZodBoolean;
|
|
398
|
+
}, "strip", z.ZodTypeAny, {
|
|
399
|
+
type: "action";
|
|
400
|
+
required: boolean;
|
|
401
|
+
control: "action";
|
|
402
|
+
defaultValue?: undefined;
|
|
403
|
+
label?: string | undefined;
|
|
404
|
+
description?: string | undefined;
|
|
405
|
+
}, {
|
|
406
|
+
type: "action";
|
|
407
|
+
required: boolean;
|
|
408
|
+
control: "action";
|
|
409
|
+
defaultValue?: undefined;
|
|
410
|
+
label?: string | undefined;
|
|
411
|
+
description?: string | undefined;
|
|
412
|
+
}>, z.ZodObject<{
|
|
413
|
+
control: z.ZodLiteral<"textContent">;
|
|
414
|
+
type: z.ZodLiteral<"string">;
|
|
415
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
416
|
+
label: z.ZodOptional<z.ZodString>;
|
|
417
|
+
description: z.ZodOptional<z.ZodString>;
|
|
418
|
+
required: z.ZodBoolean;
|
|
419
|
+
}, "strip", z.ZodTypeAny, {
|
|
420
|
+
type: "string";
|
|
421
|
+
required: boolean;
|
|
422
|
+
control: "textContent";
|
|
423
|
+
defaultValue?: string | undefined;
|
|
424
|
+
label?: string | undefined;
|
|
425
|
+
description?: string | undefined;
|
|
426
|
+
}, {
|
|
427
|
+
type: "string";
|
|
428
|
+
required: boolean;
|
|
429
|
+
control: "textContent";
|
|
430
|
+
defaultValue?: string | undefined;
|
|
431
|
+
label?: string | undefined;
|
|
432
|
+
description?: string | undefined;
|
|
433
|
+
}>]>;
|
|
434
|
+
export type PropMeta = z.infer<typeof PropMeta>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type Prop, type Assets, type Pages, type ImageAsset } from "@webstudio-is/sdk";
|
|
2
|
+
export declare const normalizeProps: ({ props, assetBaseUrl, assets, uploadingImageAssets, pages, source, }: {
|
|
3
|
+
props: Prop[];
|
|
4
|
+
assetBaseUrl: string;
|
|
5
|
+
assets: Assets;
|
|
6
|
+
uploadingImageAssets: ImageAsset[];
|
|
7
|
+
pages: Pages;
|
|
8
|
+
source: "canvas" | "prebuild";
|
|
9
|
+
}) => ({
|
|
10
|
+
value: number;
|
|
11
|
+
type: "number";
|
|
12
|
+
name: string;
|
|
13
|
+
id: string;
|
|
14
|
+
instanceId: string;
|
|
15
|
+
required?: boolean | undefined;
|
|
16
|
+
} | {
|
|
17
|
+
value: string;
|
|
18
|
+
type: "string";
|
|
19
|
+
name: string;
|
|
20
|
+
id: string;
|
|
21
|
+
instanceId: string;
|
|
22
|
+
required?: boolean | undefined;
|
|
23
|
+
} | {
|
|
24
|
+
value: boolean;
|
|
25
|
+
type: "boolean";
|
|
26
|
+
name: string;
|
|
27
|
+
id: string;
|
|
28
|
+
instanceId: string;
|
|
29
|
+
required?: boolean | undefined;
|
|
30
|
+
} | {
|
|
31
|
+
type: "json";
|
|
32
|
+
name: string;
|
|
33
|
+
id: string;
|
|
34
|
+
instanceId: string;
|
|
35
|
+
value?: unknown;
|
|
36
|
+
required?: boolean | undefined;
|
|
37
|
+
} | {
|
|
38
|
+
value: string;
|
|
39
|
+
type: "asset";
|
|
40
|
+
name: string;
|
|
41
|
+
id: string;
|
|
42
|
+
instanceId: string;
|
|
43
|
+
required?: boolean | undefined;
|
|
44
|
+
} | {
|
|
45
|
+
value: (string | {
|
|
46
|
+
instanceId: string;
|
|
47
|
+
pageId: string;
|
|
48
|
+
}) & (string | {
|
|
49
|
+
instanceId: string;
|
|
50
|
+
pageId: string;
|
|
51
|
+
} | undefined);
|
|
52
|
+
type: "page";
|
|
53
|
+
name: string;
|
|
54
|
+
id: string;
|
|
55
|
+
instanceId: string;
|
|
56
|
+
required?: boolean | undefined;
|
|
57
|
+
} | {
|
|
58
|
+
value: string[];
|
|
59
|
+
type: "string[]";
|
|
60
|
+
name: string;
|
|
61
|
+
id: string;
|
|
62
|
+
instanceId: string;
|
|
63
|
+
required?: boolean | undefined;
|
|
64
|
+
} | {
|
|
65
|
+
value: string;
|
|
66
|
+
type: "parameter";
|
|
67
|
+
name: string;
|
|
68
|
+
id: string;
|
|
69
|
+
instanceId: string;
|
|
70
|
+
required?: boolean | undefined;
|
|
71
|
+
} | {
|
|
72
|
+
value: string;
|
|
73
|
+
type: "resource";
|
|
74
|
+
name: string;
|
|
75
|
+
id: string;
|
|
76
|
+
instanceId: string;
|
|
77
|
+
required?: boolean | undefined;
|
|
78
|
+
} | {
|
|
79
|
+
value: string;
|
|
80
|
+
type: "expression";
|
|
81
|
+
name: string;
|
|
82
|
+
id: string;
|
|
83
|
+
instanceId: string;
|
|
84
|
+
required?: boolean | undefined;
|
|
85
|
+
} | {
|
|
86
|
+
value: {
|
|
87
|
+
code: string;
|
|
88
|
+
type: "execute";
|
|
89
|
+
args: string[];
|
|
90
|
+
}[];
|
|
91
|
+
type: "action";
|
|
92
|
+
name: string;
|
|
93
|
+
id: string;
|
|
94
|
+
instanceId: string;
|
|
95
|
+
required?: boolean | undefined;
|
|
96
|
+
})[];
|
|
97
|
+
export declare const idAttribute: "data-ws-id";
|
|
98
|
+
export declare const selectorIdAttribute: "data-ws-selector";
|
|
99
|
+
export declare const componentAttribute: "data-ws-component";
|
|
100
|
+
export declare const showAttribute: "data-ws-show";
|
|
101
|
+
export declare const indexAttribute: "data-ws-index";
|
|
102
|
+
export declare const collapsedAttribute: "data-ws-collapsed";
|
|
103
|
+
export declare const textContentAttribute: "data-ws-text-content";
|
|
104
|
+
export declare const isAttributeNameSafe: (attributeName: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* transforms url pattern subset to remix route format
|
|
3
|
+
*
|
|
4
|
+
* /:name/ -> .$name. - named dynamic segment
|
|
5
|
+
* /:name?/ -> .($name). - optional dynamic segment
|
|
6
|
+
* /* -> .$ - splat in the end of pattern
|
|
7
|
+
* /:name* -> .$ - named splat which gets specified name at runtime
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare const generateRemixRoute: (pathname: string) => string;
|
|
11
|
+
/**
|
|
12
|
+
* generates a function to convert remix params to compatible with url pattern groups
|
|
13
|
+
*
|
|
14
|
+
* for /:name* pattern
|
|
15
|
+
* params["*"] is replaced with params["name"]
|
|
16
|
+
*
|
|
17
|
+
* for /* pattern
|
|
18
|
+
* params["*"] is replaced with params[0]
|
|
19
|
+
*/
|
|
20
|
+
export declare const generateRemixParams: (pathname: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.192.0",
|
|
4
4
|
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"html-tags": "^4.0.0",
|
|
27
27
|
"nanoid": "^5.0.8",
|
|
28
28
|
"title-case": "^4.3.2",
|
|
29
|
-
"@webstudio-is/css-engine": "0.
|
|
30
|
-
"@webstudio-is/
|
|
31
|
-
"@webstudio-is/image": "0.
|
|
32
|
-
"@webstudio-is/
|
|
33
|
-
"@webstudio-is/
|
|
29
|
+
"@webstudio-is/css-engine": "0.192.0",
|
|
30
|
+
"@webstudio-is/icons": "^0.192.0",
|
|
31
|
+
"@webstudio-is/image": "0.192.0",
|
|
32
|
+
"@webstudio-is/fonts": "0.192.0",
|
|
33
|
+
"@webstudio-is/sdk": "0.192.0"
|
|
34
34
|
},
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|