@webstudio-is/react-sdk 0.151.0 → 0.167.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/css/normalize.js +2 -0
- package/lib/index.js +151 -66
- package/lib/types/component-generator.d.ts +2 -1
- package/lib/types/components/component-meta.d.ts +11 -6
- package/lib/types/core-components.d.ts +148 -0
- package/lib/types/css/css.d.ts +5 -3
- package/lib/types/css/normalize.d.ts +439 -0
- package/lib/types/embed-template.d.ts +10 -2
- package/lib/types/hook.d.ts +1 -0
- package/lib/types/instance-utils.d.ts +1 -0
- package/package.json +8 -10
package/lib/css/normalize.js
CHANGED
|
@@ -60,6 +60,7 @@ var nav = baseStyle;
|
|
|
60
60
|
var section = baseStyle;
|
|
61
61
|
var form = baseStyle;
|
|
62
62
|
var label = baseStyle;
|
|
63
|
+
var time = baseStyle;
|
|
63
64
|
var h1 = baseStyle;
|
|
64
65
|
var h2 = baseStyle;
|
|
65
66
|
var h3 = baseStyle;
|
|
@@ -375,5 +376,6 @@ export {
|
|
|
375
376
|
sup,
|
|
376
377
|
table,
|
|
377
378
|
textarea,
|
|
379
|
+
time,
|
|
378
380
|
ul
|
|
379
381
|
};
|
package/lib/index.js
CHANGED
|
@@ -216,6 +216,106 @@ import {
|
|
|
216
216
|
createRegularStyleSheet,
|
|
217
217
|
generateAtomic
|
|
218
218
|
} from "@webstudio-is/css-engine";
|
|
219
|
+
|
|
220
|
+
// src/core-components.ts
|
|
221
|
+
import { ListViewIcon, PaintBrushIcon } from "@webstudio-is/icons/svg";
|
|
222
|
+
var portalComponent = "Slot";
|
|
223
|
+
var collectionComponent = "ws:collection";
|
|
224
|
+
var collectionMeta = {
|
|
225
|
+
category: "data",
|
|
226
|
+
order: 2,
|
|
227
|
+
type: "container",
|
|
228
|
+
label: "Collection",
|
|
229
|
+
icon: ListViewIcon,
|
|
230
|
+
stylable: false,
|
|
231
|
+
template: [
|
|
232
|
+
{
|
|
233
|
+
type: "instance",
|
|
234
|
+
component: collectionComponent,
|
|
235
|
+
props: [
|
|
236
|
+
{
|
|
237
|
+
name: "data",
|
|
238
|
+
type: "json",
|
|
239
|
+
value: [
|
|
240
|
+
"Collection Item 1",
|
|
241
|
+
"Collection Item 2",
|
|
242
|
+
"Collection Item 3"
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "item",
|
|
247
|
+
type: "parameter",
|
|
248
|
+
variableName: "collectionItem",
|
|
249
|
+
variableAlias: "Collection Item"
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
children: [
|
|
253
|
+
{
|
|
254
|
+
type: "instance",
|
|
255
|
+
component: "Box",
|
|
256
|
+
children: [{ type: "expression", value: "collectionItem" }]
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
};
|
|
262
|
+
var collectionPropsMeta = {
|
|
263
|
+
props: {
|
|
264
|
+
data: {
|
|
265
|
+
required: true,
|
|
266
|
+
control: "json",
|
|
267
|
+
type: "json"
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
initialProps: ["data"]
|
|
271
|
+
};
|
|
272
|
+
var descendantComponent = "ws:descendant";
|
|
273
|
+
var descendantMeta = {
|
|
274
|
+
category: "internal",
|
|
275
|
+
type: "control",
|
|
276
|
+
label: "Descendant",
|
|
277
|
+
icon: PaintBrushIcon,
|
|
278
|
+
detachable: false
|
|
279
|
+
};
|
|
280
|
+
var descendantPropsMeta = {
|
|
281
|
+
props: {
|
|
282
|
+
selector: {
|
|
283
|
+
required: true,
|
|
284
|
+
type: "string",
|
|
285
|
+
control: "select",
|
|
286
|
+
options: [
|
|
287
|
+
" p",
|
|
288
|
+
" h1",
|
|
289
|
+
" h2",
|
|
290
|
+
" h3",
|
|
291
|
+
" h4",
|
|
292
|
+
" h5",
|
|
293
|
+
" h6",
|
|
294
|
+
" :where(strong, b)",
|
|
295
|
+
" :where(em, i)",
|
|
296
|
+
" a",
|
|
297
|
+
" img",
|
|
298
|
+
" blockquote",
|
|
299
|
+
" code",
|
|
300
|
+
" :where(ul, ol)",
|
|
301
|
+
" li",
|
|
302
|
+
" hr"
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
initialProps: ["selector"]
|
|
307
|
+
};
|
|
308
|
+
var coreMetas = {
|
|
309
|
+
[collectionComponent]: collectionMeta,
|
|
310
|
+
[descendantComponent]: descendantMeta
|
|
311
|
+
};
|
|
312
|
+
var corePropsMetas = {
|
|
313
|
+
[collectionComponent]: collectionPropsMeta,
|
|
314
|
+
[descendantComponent]: descendantPropsMeta
|
|
315
|
+
};
|
|
316
|
+
var isCoreComponent = (component) => component === collectionComponent || component === descendantComponent;
|
|
317
|
+
|
|
318
|
+
// src/css/css.ts
|
|
219
319
|
var createImageValueTransformer = (assets, { assetBaseUrl }) => (styleValue) => {
|
|
220
320
|
if (styleValue.type === "image" && styleValue.value.type === "asset") {
|
|
221
321
|
const asset = assets.get(styleValue.value.value);
|
|
@@ -235,6 +335,8 @@ var createImageValueTransformer = (assets, { assetBaseUrl }) => (styleValue) =>
|
|
|
235
335
|
};
|
|
236
336
|
var generateCss = ({
|
|
237
337
|
assets,
|
|
338
|
+
instances,
|
|
339
|
+
props,
|
|
238
340
|
breakpoints,
|
|
239
341
|
styles,
|
|
240
342
|
styleSourceSelections,
|
|
@@ -243,6 +345,20 @@ var generateCss = ({
|
|
|
243
345
|
atomic
|
|
244
346
|
}) => {
|
|
245
347
|
const sheet = createRegularStyleSheet({ name: "ssr" });
|
|
348
|
+
const parentIdByInstanceId = /* @__PURE__ */ new Map();
|
|
349
|
+
for (const instance of instances.values()) {
|
|
350
|
+
for (const child of instance.children) {
|
|
351
|
+
if (child.type === "id") {
|
|
352
|
+
parentIdByInstanceId.set(child.value, instance.id);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
const descendantSelectorByInstanceId = /* @__PURE__ */ new Map();
|
|
357
|
+
for (const prop of props.values()) {
|
|
358
|
+
if (prop.name === "selector" && prop.type === "string") {
|
|
359
|
+
descendantSelectorByInstanceId.set(prop.instanceId, prop.value);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
246
362
|
addGlobalRules(sheet, { assets, assetBaseUrl });
|
|
247
363
|
for (const breakpoint of breakpoints.values()) {
|
|
248
364
|
sheet.addMediaRule(breakpoint.id, breakpoint);
|
|
@@ -271,8 +387,23 @@ var generateCss = ({
|
|
|
271
387
|
});
|
|
272
388
|
}
|
|
273
389
|
const instanceByRule = /* @__PURE__ */ new Map();
|
|
274
|
-
for (const
|
|
275
|
-
|
|
390
|
+
for (const selection of styleSourceSelections.values()) {
|
|
391
|
+
let { instanceId } = selection;
|
|
392
|
+
const { values } = selection;
|
|
393
|
+
let descendantSuffix = "";
|
|
394
|
+
const instance = instances.get(instanceId);
|
|
395
|
+
if (instance?.component === descendantComponent) {
|
|
396
|
+
const parentId = parentIdByInstanceId.get(instanceId);
|
|
397
|
+
const descendantSelector = descendantSelectorByInstanceId.get(instanceId);
|
|
398
|
+
if (parentId && descendantSelector) {
|
|
399
|
+
descendantSuffix = descendantSelector;
|
|
400
|
+
instanceId = parentId;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
const rule = sheet.addNestingRule(
|
|
404
|
+
`[${idAttribute}="${instanceId}"]`,
|
|
405
|
+
descendantSuffix
|
|
406
|
+
);
|
|
276
407
|
rule.applyMixins(values);
|
|
277
408
|
instanceByRule.set(rule, instanceId);
|
|
278
409
|
}
|
|
@@ -405,65 +536,6 @@ var createInstanceElement = ({
|
|
|
405
536
|
);
|
|
406
537
|
};
|
|
407
538
|
|
|
408
|
-
// src/core-components.ts
|
|
409
|
-
import { ListViewIcon } from "@webstudio-is/icons/svg";
|
|
410
|
-
var portalComponent = "Slot";
|
|
411
|
-
var collectionComponent = "ws:collection";
|
|
412
|
-
var collectionMeta = {
|
|
413
|
-
category: "data",
|
|
414
|
-
order: 7,
|
|
415
|
-
type: "container",
|
|
416
|
-
label: "Collection",
|
|
417
|
-
icon: ListViewIcon,
|
|
418
|
-
stylable: false,
|
|
419
|
-
template: [
|
|
420
|
-
{
|
|
421
|
-
type: "instance",
|
|
422
|
-
component: collectionComponent,
|
|
423
|
-
props: [
|
|
424
|
-
{
|
|
425
|
-
name: "data",
|
|
426
|
-
type: "json",
|
|
427
|
-
value: [
|
|
428
|
-
"Collection Item 1",
|
|
429
|
-
"Collection Item 2",
|
|
430
|
-
"Collection Item 3"
|
|
431
|
-
]
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
name: "item",
|
|
435
|
-
type: "parameter",
|
|
436
|
-
variableName: "collectionItem",
|
|
437
|
-
variableAlias: "Collection Item"
|
|
438
|
-
}
|
|
439
|
-
],
|
|
440
|
-
children: [
|
|
441
|
-
{
|
|
442
|
-
type: "instance",
|
|
443
|
-
component: "Box",
|
|
444
|
-
children: [{ type: "expression", value: "collectionItem" }]
|
|
445
|
-
}
|
|
446
|
-
]
|
|
447
|
-
}
|
|
448
|
-
]
|
|
449
|
-
};
|
|
450
|
-
var collectionPropsMeta = {
|
|
451
|
-
props: {
|
|
452
|
-
data: {
|
|
453
|
-
required: true,
|
|
454
|
-
control: "json",
|
|
455
|
-
type: "json"
|
|
456
|
-
}
|
|
457
|
-
},
|
|
458
|
-
initialProps: ["data"]
|
|
459
|
-
};
|
|
460
|
-
var coreMetas = {
|
|
461
|
-
[collectionComponent]: collectionMeta
|
|
462
|
-
};
|
|
463
|
-
var corePropsMetas = {
|
|
464
|
-
[collectionComponent]: collectionPropsMeta
|
|
465
|
-
};
|
|
466
|
-
|
|
467
539
|
// src/prop-meta.ts
|
|
468
540
|
import { z } from "zod";
|
|
469
541
|
var common = {
|
|
@@ -634,7 +706,8 @@ import {
|
|
|
634
706
|
import { StyleValue } from "@webstudio-is/css-engine";
|
|
635
707
|
var EmbedTemplateText = z2.object({
|
|
636
708
|
type: z2.literal("text"),
|
|
637
|
-
value: z2.string()
|
|
709
|
+
value: z2.string(),
|
|
710
|
+
placeholder: z2.boolean().optional()
|
|
638
711
|
});
|
|
639
712
|
var EmbedTemplateExpression = z2.object({
|
|
640
713
|
type: z2.literal("expression"),
|
|
@@ -897,7 +970,8 @@ var createInstancesFromTemplate = (treeTemplate, instances, props, dataSourceByR
|
|
|
897
970
|
if (item.type === "text") {
|
|
898
971
|
parentChildren.push({
|
|
899
972
|
type: "text",
|
|
900
|
-
value: item.value
|
|
973
|
+
value: item.value,
|
|
974
|
+
placeholder: item.placeholder
|
|
901
975
|
});
|
|
902
976
|
}
|
|
903
977
|
if (item.type === "expression") {
|
|
@@ -1011,7 +1085,8 @@ var componentCategories = [
|
|
|
1011
1085
|
"forms",
|
|
1012
1086
|
"radix",
|
|
1013
1087
|
"xml",
|
|
1014
|
-
"hidden"
|
|
1088
|
+
"hidden",
|
|
1089
|
+
"internal"
|
|
1015
1090
|
];
|
|
1016
1091
|
var stateCategories = ["states", "component-states"];
|
|
1017
1092
|
var ComponentState = z3.object({
|
|
@@ -1314,6 +1389,9 @@ className=${JSON.stringify(classes.join(" "))}`;
|
|
|
1314
1389
|
`;
|
|
1315
1390
|
}
|
|
1316
1391
|
}
|
|
1392
|
+
if (instance.component === descendantComponent) {
|
|
1393
|
+
return "";
|
|
1394
|
+
}
|
|
1317
1395
|
if (conditionValue) {
|
|
1318
1396
|
generatedElement += `}
|
|
1319
1397
|
`;
|
|
@@ -1328,11 +1406,15 @@ var generateJsxChildren = ({
|
|
|
1328
1406
|
dataSources,
|
|
1329
1407
|
usedDataSources,
|
|
1330
1408
|
indexesWithinAncestors,
|
|
1331
|
-
classesMap
|
|
1409
|
+
classesMap,
|
|
1410
|
+
excludePlaceholders
|
|
1332
1411
|
}) => {
|
|
1333
1412
|
let generatedChildren = "";
|
|
1334
1413
|
for (const child of children) {
|
|
1335
1414
|
if (child.type === "text") {
|
|
1415
|
+
if (excludePlaceholders && child.placeholder === true) {
|
|
1416
|
+
continue;
|
|
1417
|
+
}
|
|
1336
1418
|
generatedChildren += child.value.split("\n").map((line) => `{${JSON.stringify(line)}}
|
|
1337
1419
|
`).join(`<br />
|
|
1338
1420
|
`);
|
|
@@ -1371,7 +1453,8 @@ var generateJsxChildren = ({
|
|
|
1371
1453
|
props,
|
|
1372
1454
|
dataSources,
|
|
1373
1455
|
usedDataSources,
|
|
1374
|
-
indexesWithinAncestors
|
|
1456
|
+
indexesWithinAncestors,
|
|
1457
|
+
excludePlaceholders
|
|
1375
1458
|
})
|
|
1376
1459
|
});
|
|
1377
1460
|
continue;
|
|
@@ -1483,6 +1566,7 @@ export {
|
|
|
1483
1566
|
createImageValueTransformer,
|
|
1484
1567
|
createInstanceChildrenElements,
|
|
1485
1568
|
defaultStates,
|
|
1569
|
+
descendantComponent,
|
|
1486
1570
|
generateCss,
|
|
1487
1571
|
generateDataFromEmbedTemplate,
|
|
1488
1572
|
generateJsxChildren,
|
|
@@ -1498,6 +1582,7 @@ export {
|
|
|
1498
1582
|
getStyleRules,
|
|
1499
1583
|
idAttribute,
|
|
1500
1584
|
indexAttribute,
|
|
1585
|
+
isCoreComponent,
|
|
1501
1586
|
namespaceMeta,
|
|
1502
1587
|
normalizeProps,
|
|
1503
1588
|
portalComponent,
|
|
@@ -10,7 +10,7 @@ export declare const generateJsxElement: ({ scope, instance, props, dataSources,
|
|
|
10
10
|
children: string;
|
|
11
11
|
classesMap?: Map<string, Array<string>>;
|
|
12
12
|
}) => string;
|
|
13
|
-
export declare const generateJsxChildren: ({ scope, children, instances, props, dataSources, usedDataSources, indexesWithinAncestors, classesMap, }: {
|
|
13
|
+
export declare const generateJsxChildren: ({ scope, children, instances, props, dataSources, usedDataSources, indexesWithinAncestors, classesMap, excludePlaceholders, }: {
|
|
14
14
|
scope: Scope;
|
|
15
15
|
children: Instance["children"];
|
|
16
16
|
instances: Instances;
|
|
@@ -19,6 +19,7 @@ export declare const generateJsxChildren: ({ scope, children, instances, props,
|
|
|
19
19
|
usedDataSources: DataSources;
|
|
20
20
|
indexesWithinAncestors: IndexesWithinAncestors;
|
|
21
21
|
classesMap?: Map<string, Array<string>>;
|
|
22
|
+
excludePlaceholders?: boolean;
|
|
22
23
|
}) => string;
|
|
23
24
|
export declare const generateWebstudioComponent: ({ scope, name, rootInstanceId, parameters, instances, props, dataSources, indexesWithinAncestors, classesMap, }: {
|
|
24
25
|
scope: Scope;
|
|
@@ -718,7 +718,7 @@ declare const WsComponentPropsMeta: z.ZodObject<{
|
|
|
718
718
|
initialProps?: string[] | undefined;
|
|
719
719
|
}>;
|
|
720
720
|
export type WsComponentPropsMeta = z.infer<typeof WsComponentPropsMeta>;
|
|
721
|
-
export declare const componentCategories: readonly ["general", "text", "data", "media", "forms", "radix", "xml", "hidden"];
|
|
721
|
+
export declare const componentCategories: readonly ["general", "text", "data", "media", "forms", "radix", "xml", "hidden", "internal"];
|
|
722
722
|
export declare const stateCategories: readonly ["states", "component-states"];
|
|
723
723
|
export declare const ComponentState: z.ZodObject<{
|
|
724
724
|
category: z.ZodOptional<z.ZodEnum<["states", "component-states"]>>;
|
|
@@ -736,7 +736,7 @@ export declare const ComponentState: z.ZodObject<{
|
|
|
736
736
|
export type ComponentState = z.infer<typeof ComponentState>;
|
|
737
737
|
export declare const defaultStates: ComponentState[];
|
|
738
738
|
export declare const WsComponentMeta: z.ZodObject<{
|
|
739
|
-
category: z.ZodOptional<z.ZodEnum<["general", "text", "data", "media", "forms", "radix", "xml", "hidden"]>>;
|
|
739
|
+
category: z.ZodOptional<z.ZodEnum<["general", "text", "data", "media", "forms", "radix", "xml", "hidden", "internal"]>>;
|
|
740
740
|
type: z.ZodEnum<["container", "control", "embed", "rich-text-child"]>;
|
|
741
741
|
requiredAncestors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
742
742
|
invalidAncestors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -3365,12 +3365,15 @@ export declare const WsComponentMeta: z.ZodObject<{
|
|
|
3365
3365
|
template: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodUnion<[z.ZodType<import("../embed-template").EmbedTemplateInstance, z.ZodTypeDef, import("../embed-template").EmbedTemplateInstance>, z.ZodObject<{
|
|
3366
3366
|
type: z.ZodLiteral<"text">;
|
|
3367
3367
|
value: z.ZodString;
|
|
3368
|
+
placeholder: z.ZodOptional<z.ZodBoolean>;
|
|
3368
3369
|
}, "strip", z.ZodTypeAny, {
|
|
3369
3370
|
value: string;
|
|
3370
3371
|
type: "text";
|
|
3372
|
+
placeholder?: boolean | undefined;
|
|
3371
3373
|
}, {
|
|
3372
3374
|
value: string;
|
|
3373
3375
|
type: "text";
|
|
3376
|
+
placeholder?: boolean | undefined;
|
|
3374
3377
|
}>, z.ZodObject<{
|
|
3375
3378
|
type: z.ZodLiteral<"expression">;
|
|
3376
3379
|
value: z.ZodString;
|
|
@@ -3383,9 +3386,9 @@ export declare const WsComponentMeta: z.ZodObject<{
|
|
|
3383
3386
|
}>]>, "many">>>;
|
|
3384
3387
|
order: z.ZodOptional<z.ZodNumber>;
|
|
3385
3388
|
}, "strip", z.ZodTypeAny, {
|
|
3386
|
-
type: "
|
|
3389
|
+
type: "control" | "embed" | "container" | "rich-text-child";
|
|
3387
3390
|
icon: string;
|
|
3388
|
-
category?: "data" | "text" | "hidden" | "media" | "general" | "forms" | "radix" | "
|
|
3391
|
+
category?: "data" | "xml" | "text" | "hidden" | "media" | "general" | "forms" | "radix" | "internal" | undefined;
|
|
3389
3392
|
requiredAncestors?: string[] | undefined;
|
|
3390
3393
|
invalidAncestors?: string[] | undefined;
|
|
3391
3394
|
indexWithinAncestor?: string | undefined;
|
|
@@ -4270,15 +4273,16 @@ export declare const WsComponentMeta: z.ZodObject<{
|
|
|
4270
4273
|
template?: ({
|
|
4271
4274
|
value: string;
|
|
4272
4275
|
type: "text";
|
|
4276
|
+
placeholder?: boolean | undefined;
|
|
4273
4277
|
} | {
|
|
4274
4278
|
value: string;
|
|
4275
4279
|
type: "expression";
|
|
4276
4280
|
} | import("../embed-template").EmbedTemplateInstance)[] | undefined;
|
|
4277
4281
|
order?: number | undefined;
|
|
4278
4282
|
}, {
|
|
4279
|
-
type: "
|
|
4283
|
+
type: "control" | "embed" | "container" | "rich-text-child";
|
|
4280
4284
|
icon: string;
|
|
4281
|
-
category?: "data" | "text" | "hidden" | "media" | "general" | "forms" | "radix" | "
|
|
4285
|
+
category?: "data" | "xml" | "text" | "hidden" | "media" | "general" | "forms" | "radix" | "internal" | undefined;
|
|
4282
4286
|
requiredAncestors?: string[] | undefined;
|
|
4283
4287
|
invalidAncestors?: string[] | undefined;
|
|
4284
4288
|
indexWithinAncestor?: string | undefined;
|
|
@@ -5163,6 +5167,7 @@ export declare const WsComponentMeta: z.ZodObject<{
|
|
|
5163
5167
|
template?: ({
|
|
5164
5168
|
value: string;
|
|
5165
5169
|
type: "text";
|
|
5170
|
+
placeholder?: boolean | undefined;
|
|
5166
5171
|
} | {
|
|
5167
5172
|
value: string;
|
|
5168
5173
|
type: "expression";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { WsComponentMeta } from "./components/component-meta";
|
|
2
2
|
export declare const portalComponent = "Slot";
|
|
3
3
|
export declare const collectionComponent = "ws:collection";
|
|
4
|
+
export declare const descendantComponent = "ws:descendant";
|
|
4
5
|
export declare const coreMetas: {
|
|
5
6
|
"ws:collection": WsComponentMeta;
|
|
7
|
+
"ws:descendant": WsComponentMeta;
|
|
6
8
|
};
|
|
7
9
|
export declare const corePropsMetas: {
|
|
8
10
|
"ws:collection": {
|
|
@@ -150,4 +152,150 @@ export declare const corePropsMetas: {
|
|
|
150
152
|
}>;
|
|
151
153
|
initialProps?: string[] | undefined;
|
|
152
154
|
};
|
|
155
|
+
"ws:descendant": {
|
|
156
|
+
props: Record<string, {
|
|
157
|
+
type: "number";
|
|
158
|
+
required: boolean;
|
|
159
|
+
control: "number";
|
|
160
|
+
defaultValue?: number | undefined;
|
|
161
|
+
label?: string | undefined;
|
|
162
|
+
description?: string | undefined;
|
|
163
|
+
} | {
|
|
164
|
+
type: "number";
|
|
165
|
+
required: boolean;
|
|
166
|
+
control: "range";
|
|
167
|
+
defaultValue?: number | undefined;
|
|
168
|
+
label?: string | undefined;
|
|
169
|
+
description?: string | undefined;
|
|
170
|
+
} | {
|
|
171
|
+
type: "string";
|
|
172
|
+
required: boolean;
|
|
173
|
+
control: "text";
|
|
174
|
+
defaultValue?: string | undefined;
|
|
175
|
+
rows?: number | undefined;
|
|
176
|
+
label?: string | undefined;
|
|
177
|
+
description?: string | undefined;
|
|
178
|
+
} | {
|
|
179
|
+
type: "string";
|
|
180
|
+
required: boolean;
|
|
181
|
+
control: "code";
|
|
182
|
+
defaultValue?: string | undefined;
|
|
183
|
+
label?: string | undefined;
|
|
184
|
+
description?: string | undefined;
|
|
185
|
+
} | {
|
|
186
|
+
type: "string";
|
|
187
|
+
required: boolean;
|
|
188
|
+
control: "codetext";
|
|
189
|
+
description?: string | undefined;
|
|
190
|
+
label?: string | undefined;
|
|
191
|
+
defaultValue?: string | undefined;
|
|
192
|
+
} | {
|
|
193
|
+
type: "string";
|
|
194
|
+
required: boolean;
|
|
195
|
+
control: "color";
|
|
196
|
+
defaultValue?: string | undefined;
|
|
197
|
+
label?: string | undefined;
|
|
198
|
+
description?: string | undefined;
|
|
199
|
+
} | {
|
|
200
|
+
type: "boolean";
|
|
201
|
+
required: boolean;
|
|
202
|
+
control: "boolean";
|
|
203
|
+
defaultValue?: boolean | undefined;
|
|
204
|
+
label?: string | undefined;
|
|
205
|
+
description?: string | undefined;
|
|
206
|
+
} | {
|
|
207
|
+
options: string[];
|
|
208
|
+
type: "string";
|
|
209
|
+
required: boolean;
|
|
210
|
+
control: "radio";
|
|
211
|
+
defaultValue?: string | undefined;
|
|
212
|
+
label?: string | undefined;
|
|
213
|
+
description?: string | undefined;
|
|
214
|
+
} | {
|
|
215
|
+
options: string[];
|
|
216
|
+
type: "string";
|
|
217
|
+
required: boolean;
|
|
218
|
+
control: "inline-radio";
|
|
219
|
+
defaultValue?: string | undefined;
|
|
220
|
+
label?: string | undefined;
|
|
221
|
+
description?: string | undefined;
|
|
222
|
+
} | {
|
|
223
|
+
options: string[];
|
|
224
|
+
type: "string";
|
|
225
|
+
required: boolean;
|
|
226
|
+
control: "select";
|
|
227
|
+
defaultValue?: string | undefined;
|
|
228
|
+
label?: string | undefined;
|
|
229
|
+
description?: string | undefined;
|
|
230
|
+
} | {
|
|
231
|
+
options: string[];
|
|
232
|
+
type: "string[]";
|
|
233
|
+
required: boolean;
|
|
234
|
+
control: "check";
|
|
235
|
+
defaultValue?: string[] | undefined;
|
|
236
|
+
label?: string | undefined;
|
|
237
|
+
description?: string | undefined;
|
|
238
|
+
} | {
|
|
239
|
+
options: string[];
|
|
240
|
+
type: "string[]";
|
|
241
|
+
required: boolean;
|
|
242
|
+
control: "inline-check";
|
|
243
|
+
defaultValue?: string[] | undefined;
|
|
244
|
+
label?: string | undefined;
|
|
245
|
+
description?: string | undefined;
|
|
246
|
+
} | {
|
|
247
|
+
options: string[];
|
|
248
|
+
type: "string[]";
|
|
249
|
+
required: boolean;
|
|
250
|
+
control: "multi-select";
|
|
251
|
+
defaultValue?: string[] | undefined;
|
|
252
|
+
label?: string | undefined;
|
|
253
|
+
description?: string | undefined;
|
|
254
|
+
} | {
|
|
255
|
+
type: "string";
|
|
256
|
+
required: boolean;
|
|
257
|
+
control: "file";
|
|
258
|
+
defaultValue?: string | undefined;
|
|
259
|
+
accept?: string | undefined;
|
|
260
|
+
label?: string | undefined;
|
|
261
|
+
description?: string | undefined;
|
|
262
|
+
} | {
|
|
263
|
+
type: "string";
|
|
264
|
+
required: boolean;
|
|
265
|
+
control: "url";
|
|
266
|
+
defaultValue?: string | undefined;
|
|
267
|
+
label?: string | undefined;
|
|
268
|
+
description?: string | undefined;
|
|
269
|
+
} | {
|
|
270
|
+
type: "json";
|
|
271
|
+
required: boolean;
|
|
272
|
+
control: "json";
|
|
273
|
+
defaultValue?: unknown;
|
|
274
|
+
label?: string | undefined;
|
|
275
|
+
description?: string | undefined;
|
|
276
|
+
} | {
|
|
277
|
+
type: "string";
|
|
278
|
+
required: boolean;
|
|
279
|
+
control: "date";
|
|
280
|
+
defaultValue?: string | undefined;
|
|
281
|
+
label?: string | undefined;
|
|
282
|
+
description?: string | undefined;
|
|
283
|
+
} | {
|
|
284
|
+
type: "action";
|
|
285
|
+
required: boolean;
|
|
286
|
+
control: "action";
|
|
287
|
+
defaultValue?: undefined;
|
|
288
|
+
label?: string | undefined;
|
|
289
|
+
description?: string | undefined;
|
|
290
|
+
} | {
|
|
291
|
+
type: "string";
|
|
292
|
+
required: boolean;
|
|
293
|
+
control: "textContent";
|
|
294
|
+
defaultValue?: string | undefined;
|
|
295
|
+
label?: string | undefined;
|
|
296
|
+
description?: string | undefined;
|
|
297
|
+
}>;
|
|
298
|
+
initialProps?: string[] | undefined;
|
|
299
|
+
};
|
|
153
300
|
};
|
|
301
|
+
export declare const isCoreComponent: (component: string) => boolean;
|
package/lib/types/css/css.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type TransformValue } from "@webstudio-is/css-engine";
|
|
2
|
-
import type { Assets, Breakpoints, StyleSourceSelections, Styles } from "@webstudio-is/sdk";
|
|
2
|
+
import type { Assets, Breakpoints, Instances, Props, StyleSourceSelections, Styles } from "@webstudio-is/sdk";
|
|
3
3
|
import type { WsComponentMeta } from "../components/component-meta";
|
|
4
4
|
export type CssConfig = {
|
|
5
5
|
assets: Assets;
|
|
6
|
+
instances: Instances;
|
|
7
|
+
props: Props;
|
|
6
8
|
breakpoints: Breakpoints;
|
|
7
9
|
styles: Styles;
|
|
8
10
|
styleSourceSelections: StyleSourceSelections;
|
|
@@ -13,7 +15,7 @@ export type CssConfig = {
|
|
|
13
15
|
export declare const createImageValueTransformer: (assets: Map<string, {
|
|
14
16
|
type: "font";
|
|
15
17
|
name: string;
|
|
16
|
-
format: "ttf" | "woff" | "woff2"
|
|
18
|
+
format: "ttf" | "woff" | "woff2";
|
|
17
19
|
meta: ({
|
|
18
20
|
family: string;
|
|
19
21
|
style: "normal" | "italic" | "oblique";
|
|
@@ -60,7 +62,7 @@ export declare const createImageValueTransformer: (assets: Map<string, {
|
|
|
60
62
|
}>, { assetBaseUrl }: {
|
|
61
63
|
assetBaseUrl: string;
|
|
62
64
|
}) => TransformValue;
|
|
63
|
-
export declare const generateCss: ({ assets, breakpoints, styles, styleSourceSelections, componentMetas, assetBaseUrl, atomic, }: CssConfig) => {
|
|
65
|
+
export declare const generateCss: ({ assets, instances, props, breakpoints, styles, styleSourceSelections, componentMetas, assetBaseUrl, atomic, }: CssConfig) => {
|
|
64
66
|
cssText: string;
|
|
65
67
|
classesMap: Map<string, string[]>;
|
|
66
68
|
};
|
|
@@ -5284,6 +5284,445 @@ export declare const label: ({
|
|
|
5284
5284
|
value: string;
|
|
5285
5285
|
};
|
|
5286
5286
|
})[];
|
|
5287
|
+
export declare const time: ({
|
|
5288
|
+
value: {
|
|
5289
|
+
value: number;
|
|
5290
|
+
type: "unit";
|
|
5291
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5292
|
+
} | {
|
|
5293
|
+
value: string;
|
|
5294
|
+
type: "keyword";
|
|
5295
|
+
} | {
|
|
5296
|
+
value: string;
|
|
5297
|
+
type: "unparsed";
|
|
5298
|
+
hidden?: boolean | undefined;
|
|
5299
|
+
} | {
|
|
5300
|
+
value: string[];
|
|
5301
|
+
type: "fontFamily";
|
|
5302
|
+
} | {
|
|
5303
|
+
type: "rgb";
|
|
5304
|
+
r: number;
|
|
5305
|
+
g: number;
|
|
5306
|
+
b: number;
|
|
5307
|
+
alpha: number;
|
|
5308
|
+
} | {
|
|
5309
|
+
type: "function";
|
|
5310
|
+
name: string;
|
|
5311
|
+
args: {
|
|
5312
|
+
value: number;
|
|
5313
|
+
type: "unit";
|
|
5314
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5315
|
+
} | {
|
|
5316
|
+
value: string;
|
|
5317
|
+
type: "keyword";
|
|
5318
|
+
} | {
|
|
5319
|
+
value: string;
|
|
5320
|
+
type: "unparsed";
|
|
5321
|
+
hidden?: boolean | undefined;
|
|
5322
|
+
} | {
|
|
5323
|
+
value: string[];
|
|
5324
|
+
type: "fontFamily";
|
|
5325
|
+
} | {
|
|
5326
|
+
type: "rgb";
|
|
5327
|
+
r: number;
|
|
5328
|
+
g: number;
|
|
5329
|
+
b: number;
|
|
5330
|
+
alpha: number;
|
|
5331
|
+
} | any | {
|
|
5332
|
+
value: {
|
|
5333
|
+
value: string;
|
|
5334
|
+
type: "asset";
|
|
5335
|
+
} | {
|
|
5336
|
+
type: "url";
|
|
5337
|
+
url: string;
|
|
5338
|
+
};
|
|
5339
|
+
type: "image";
|
|
5340
|
+
hidden?: boolean | undefined;
|
|
5341
|
+
} | {
|
|
5342
|
+
value: ({
|
|
5343
|
+
value: number;
|
|
5344
|
+
type: "unit";
|
|
5345
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5346
|
+
} | {
|
|
5347
|
+
value: string;
|
|
5348
|
+
type: "keyword";
|
|
5349
|
+
} | {
|
|
5350
|
+
value: string;
|
|
5351
|
+
type: "unparsed";
|
|
5352
|
+
hidden?: boolean | undefined;
|
|
5353
|
+
} | {
|
|
5354
|
+
type: "rgb";
|
|
5355
|
+
r: number;
|
|
5356
|
+
g: number;
|
|
5357
|
+
b: number;
|
|
5358
|
+
alpha: number;
|
|
5359
|
+
} | any)[];
|
|
5360
|
+
type: "tuple";
|
|
5361
|
+
hidden?: boolean | undefined;
|
|
5362
|
+
} | {
|
|
5363
|
+
value: string;
|
|
5364
|
+
type: "invalid";
|
|
5365
|
+
} | {
|
|
5366
|
+
value: ({
|
|
5367
|
+
value: number;
|
|
5368
|
+
type: "unit";
|
|
5369
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5370
|
+
} | {
|
|
5371
|
+
value: string;
|
|
5372
|
+
type: "keyword";
|
|
5373
|
+
} | {
|
|
5374
|
+
value: string;
|
|
5375
|
+
type: "unparsed";
|
|
5376
|
+
hidden?: boolean | undefined;
|
|
5377
|
+
} | any | {
|
|
5378
|
+
value: {
|
|
5379
|
+
value: string;
|
|
5380
|
+
type: "asset";
|
|
5381
|
+
} | {
|
|
5382
|
+
type: "url";
|
|
5383
|
+
url: string;
|
|
5384
|
+
};
|
|
5385
|
+
type: "image";
|
|
5386
|
+
hidden?: boolean | undefined;
|
|
5387
|
+
} | {
|
|
5388
|
+
value: ({
|
|
5389
|
+
value: number;
|
|
5390
|
+
type: "unit";
|
|
5391
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5392
|
+
} | {
|
|
5393
|
+
value: string;
|
|
5394
|
+
type: "keyword";
|
|
5395
|
+
} | {
|
|
5396
|
+
value: string;
|
|
5397
|
+
type: "unparsed";
|
|
5398
|
+
hidden?: boolean | undefined;
|
|
5399
|
+
} | {
|
|
5400
|
+
type: "rgb";
|
|
5401
|
+
r: number;
|
|
5402
|
+
g: number;
|
|
5403
|
+
b: number;
|
|
5404
|
+
alpha: number;
|
|
5405
|
+
} | any)[];
|
|
5406
|
+
type: "tuple";
|
|
5407
|
+
hidden?: boolean | undefined;
|
|
5408
|
+
} | {
|
|
5409
|
+
value: string;
|
|
5410
|
+
type: "invalid";
|
|
5411
|
+
})[];
|
|
5412
|
+
type: "layers";
|
|
5413
|
+
} | {
|
|
5414
|
+
type: "guaranteedInvalid";
|
|
5415
|
+
} | {
|
|
5416
|
+
value: "";
|
|
5417
|
+
type: "unset";
|
|
5418
|
+
} | {
|
|
5419
|
+
value: string;
|
|
5420
|
+
type: "var";
|
|
5421
|
+
fallbacks: ({
|
|
5422
|
+
value: number;
|
|
5423
|
+
type: "unit";
|
|
5424
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5425
|
+
} | {
|
|
5426
|
+
value: string;
|
|
5427
|
+
type: "keyword";
|
|
5428
|
+
} | {
|
|
5429
|
+
value: string;
|
|
5430
|
+
type: "unparsed";
|
|
5431
|
+
hidden?: boolean | undefined;
|
|
5432
|
+
} | {
|
|
5433
|
+
value: string[];
|
|
5434
|
+
type: "fontFamily";
|
|
5435
|
+
} | {
|
|
5436
|
+
type: "rgb";
|
|
5437
|
+
r: number;
|
|
5438
|
+
g: number;
|
|
5439
|
+
b: number;
|
|
5440
|
+
alpha: number;
|
|
5441
|
+
} | any | {
|
|
5442
|
+
value: {
|
|
5443
|
+
value: string;
|
|
5444
|
+
type: "asset";
|
|
5445
|
+
} | {
|
|
5446
|
+
type: "url";
|
|
5447
|
+
url: string;
|
|
5448
|
+
};
|
|
5449
|
+
type: "image";
|
|
5450
|
+
hidden?: boolean | undefined;
|
|
5451
|
+
} | {
|
|
5452
|
+
value: ({
|
|
5453
|
+
value: number;
|
|
5454
|
+
type: "unit";
|
|
5455
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5456
|
+
} | {
|
|
5457
|
+
value: string;
|
|
5458
|
+
type: "keyword";
|
|
5459
|
+
} | {
|
|
5460
|
+
value: string;
|
|
5461
|
+
type: "unparsed";
|
|
5462
|
+
hidden?: boolean | undefined;
|
|
5463
|
+
} | {
|
|
5464
|
+
type: "rgb";
|
|
5465
|
+
r: number;
|
|
5466
|
+
g: number;
|
|
5467
|
+
b: number;
|
|
5468
|
+
alpha: number;
|
|
5469
|
+
} | any)[];
|
|
5470
|
+
type: "tuple";
|
|
5471
|
+
hidden?: boolean | undefined;
|
|
5472
|
+
} | {
|
|
5473
|
+
value: ({
|
|
5474
|
+
value: number;
|
|
5475
|
+
type: "unit";
|
|
5476
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5477
|
+
} | {
|
|
5478
|
+
value: string;
|
|
5479
|
+
type: "keyword";
|
|
5480
|
+
} | {
|
|
5481
|
+
value: string;
|
|
5482
|
+
type: "unparsed";
|
|
5483
|
+
hidden?: boolean | undefined;
|
|
5484
|
+
} | any | {
|
|
5485
|
+
value: {
|
|
5486
|
+
value: string;
|
|
5487
|
+
type: "asset";
|
|
5488
|
+
} | {
|
|
5489
|
+
type: "url";
|
|
5490
|
+
url: string;
|
|
5491
|
+
};
|
|
5492
|
+
type: "image";
|
|
5493
|
+
hidden?: boolean | undefined;
|
|
5494
|
+
} | {
|
|
5495
|
+
value: ({
|
|
5496
|
+
value: number;
|
|
5497
|
+
type: "unit";
|
|
5498
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5499
|
+
} | {
|
|
5500
|
+
value: string;
|
|
5501
|
+
type: "keyword";
|
|
5502
|
+
} | {
|
|
5503
|
+
value: string;
|
|
5504
|
+
type: "unparsed";
|
|
5505
|
+
hidden?: boolean | undefined;
|
|
5506
|
+
} | {
|
|
5507
|
+
type: "rgb";
|
|
5508
|
+
r: number;
|
|
5509
|
+
g: number;
|
|
5510
|
+
b: number;
|
|
5511
|
+
alpha: number;
|
|
5512
|
+
} | any)[];
|
|
5513
|
+
type: "tuple";
|
|
5514
|
+
hidden?: boolean | undefined;
|
|
5515
|
+
} | {
|
|
5516
|
+
value: string;
|
|
5517
|
+
type: "invalid";
|
|
5518
|
+
})[];
|
|
5519
|
+
type: "layers";
|
|
5520
|
+
} | {
|
|
5521
|
+
type: "guaranteedInvalid";
|
|
5522
|
+
})[];
|
|
5523
|
+
};
|
|
5524
|
+
} | {
|
|
5525
|
+
value: {
|
|
5526
|
+
value: string;
|
|
5527
|
+
type: "asset";
|
|
5528
|
+
} | {
|
|
5529
|
+
type: "url";
|
|
5530
|
+
url: string;
|
|
5531
|
+
};
|
|
5532
|
+
type: "image";
|
|
5533
|
+
hidden?: boolean | undefined;
|
|
5534
|
+
} | {
|
|
5535
|
+
value: ({
|
|
5536
|
+
value: number;
|
|
5537
|
+
type: "unit";
|
|
5538
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5539
|
+
} | {
|
|
5540
|
+
value: string;
|
|
5541
|
+
type: "keyword";
|
|
5542
|
+
} | {
|
|
5543
|
+
value: string;
|
|
5544
|
+
type: "unparsed";
|
|
5545
|
+
hidden?: boolean | undefined;
|
|
5546
|
+
} | {
|
|
5547
|
+
type: "rgb";
|
|
5548
|
+
r: number;
|
|
5549
|
+
g: number;
|
|
5550
|
+
b: number;
|
|
5551
|
+
alpha: number;
|
|
5552
|
+
} | any)[];
|
|
5553
|
+
type: "tuple";
|
|
5554
|
+
hidden?: boolean | undefined;
|
|
5555
|
+
} | {
|
|
5556
|
+
value: string;
|
|
5557
|
+
type: "invalid";
|
|
5558
|
+
} | {
|
|
5559
|
+
value: ({
|
|
5560
|
+
value: number;
|
|
5561
|
+
type: "unit";
|
|
5562
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5563
|
+
} | {
|
|
5564
|
+
value: string;
|
|
5565
|
+
type: "keyword";
|
|
5566
|
+
} | {
|
|
5567
|
+
value: string;
|
|
5568
|
+
type: "unparsed";
|
|
5569
|
+
hidden?: boolean | undefined;
|
|
5570
|
+
} | any | {
|
|
5571
|
+
value: {
|
|
5572
|
+
value: string;
|
|
5573
|
+
type: "asset";
|
|
5574
|
+
} | {
|
|
5575
|
+
type: "url";
|
|
5576
|
+
url: string;
|
|
5577
|
+
};
|
|
5578
|
+
type: "image";
|
|
5579
|
+
hidden?: boolean | undefined;
|
|
5580
|
+
} | {
|
|
5581
|
+
value: ({
|
|
5582
|
+
value: number;
|
|
5583
|
+
type: "unit";
|
|
5584
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5585
|
+
} | {
|
|
5586
|
+
value: string;
|
|
5587
|
+
type: "keyword";
|
|
5588
|
+
} | {
|
|
5589
|
+
value: string;
|
|
5590
|
+
type: "unparsed";
|
|
5591
|
+
hidden?: boolean | undefined;
|
|
5592
|
+
} | {
|
|
5593
|
+
type: "rgb";
|
|
5594
|
+
r: number;
|
|
5595
|
+
g: number;
|
|
5596
|
+
b: number;
|
|
5597
|
+
alpha: number;
|
|
5598
|
+
} | any)[];
|
|
5599
|
+
type: "tuple";
|
|
5600
|
+
hidden?: boolean | undefined;
|
|
5601
|
+
} | {
|
|
5602
|
+
value: string;
|
|
5603
|
+
type: "invalid";
|
|
5604
|
+
})[];
|
|
5605
|
+
type: "layers";
|
|
5606
|
+
} | {
|
|
5607
|
+
type: "guaranteedInvalid";
|
|
5608
|
+
} | {
|
|
5609
|
+
value: "";
|
|
5610
|
+
type: "unset";
|
|
5611
|
+
} | {
|
|
5612
|
+
value: string;
|
|
5613
|
+
type: "var";
|
|
5614
|
+
fallbacks: ({
|
|
5615
|
+
value: number;
|
|
5616
|
+
type: "unit";
|
|
5617
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5618
|
+
} | {
|
|
5619
|
+
value: string;
|
|
5620
|
+
type: "keyword";
|
|
5621
|
+
} | {
|
|
5622
|
+
value: string;
|
|
5623
|
+
type: "unparsed";
|
|
5624
|
+
hidden?: boolean | undefined;
|
|
5625
|
+
} | {
|
|
5626
|
+
value: string[];
|
|
5627
|
+
type: "fontFamily";
|
|
5628
|
+
} | {
|
|
5629
|
+
type: "rgb";
|
|
5630
|
+
r: number;
|
|
5631
|
+
g: number;
|
|
5632
|
+
b: number;
|
|
5633
|
+
alpha: number;
|
|
5634
|
+
} | any | {
|
|
5635
|
+
value: {
|
|
5636
|
+
value: string;
|
|
5637
|
+
type: "asset";
|
|
5638
|
+
} | {
|
|
5639
|
+
type: "url";
|
|
5640
|
+
url: string;
|
|
5641
|
+
};
|
|
5642
|
+
type: "image";
|
|
5643
|
+
hidden?: boolean | undefined;
|
|
5644
|
+
} | {
|
|
5645
|
+
value: ({
|
|
5646
|
+
value: number;
|
|
5647
|
+
type: "unit";
|
|
5648
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5649
|
+
} | {
|
|
5650
|
+
value: string;
|
|
5651
|
+
type: "keyword";
|
|
5652
|
+
} | {
|
|
5653
|
+
value: string;
|
|
5654
|
+
type: "unparsed";
|
|
5655
|
+
hidden?: boolean | undefined;
|
|
5656
|
+
} | {
|
|
5657
|
+
type: "rgb";
|
|
5658
|
+
r: number;
|
|
5659
|
+
g: number;
|
|
5660
|
+
b: number;
|
|
5661
|
+
alpha: number;
|
|
5662
|
+
} | any)[];
|
|
5663
|
+
type: "tuple";
|
|
5664
|
+
hidden?: boolean | undefined;
|
|
5665
|
+
} | {
|
|
5666
|
+
value: ({
|
|
5667
|
+
value: number;
|
|
5668
|
+
type: "unit";
|
|
5669
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5670
|
+
} | {
|
|
5671
|
+
value: string;
|
|
5672
|
+
type: "keyword";
|
|
5673
|
+
} | {
|
|
5674
|
+
value: string;
|
|
5675
|
+
type: "unparsed";
|
|
5676
|
+
hidden?: boolean | undefined;
|
|
5677
|
+
} | any | {
|
|
5678
|
+
value: {
|
|
5679
|
+
value: string;
|
|
5680
|
+
type: "asset";
|
|
5681
|
+
} | {
|
|
5682
|
+
type: "url";
|
|
5683
|
+
url: string;
|
|
5684
|
+
};
|
|
5685
|
+
type: "image";
|
|
5686
|
+
hidden?: boolean | undefined;
|
|
5687
|
+
} | {
|
|
5688
|
+
value: ({
|
|
5689
|
+
value: number;
|
|
5690
|
+
type: "unit";
|
|
5691
|
+
unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
5692
|
+
} | {
|
|
5693
|
+
value: string;
|
|
5694
|
+
type: "keyword";
|
|
5695
|
+
} | {
|
|
5696
|
+
value: string;
|
|
5697
|
+
type: "unparsed";
|
|
5698
|
+
hidden?: boolean | undefined;
|
|
5699
|
+
} | {
|
|
5700
|
+
type: "rgb";
|
|
5701
|
+
r: number;
|
|
5702
|
+
g: number;
|
|
5703
|
+
b: number;
|
|
5704
|
+
alpha: number;
|
|
5705
|
+
} | any)[];
|
|
5706
|
+
type: "tuple";
|
|
5707
|
+
hidden?: boolean | undefined;
|
|
5708
|
+
} | {
|
|
5709
|
+
value: string;
|
|
5710
|
+
type: "invalid";
|
|
5711
|
+
})[];
|
|
5712
|
+
type: "layers";
|
|
5713
|
+
} | {
|
|
5714
|
+
type: "guaranteedInvalid";
|
|
5715
|
+
})[];
|
|
5716
|
+
};
|
|
5717
|
+
state?: string | undefined;
|
|
5718
|
+
property: import("@webstudio-is/css-engine").StyleProperty;
|
|
5719
|
+
} | {
|
|
5720
|
+
property: "boxSizing";
|
|
5721
|
+
value: {
|
|
5722
|
+
type: "keyword";
|
|
5723
|
+
value: string;
|
|
5724
|
+
};
|
|
5725
|
+
})[];
|
|
5287
5726
|
export declare const h1: ({
|
|
5288
5727
|
value: {
|
|
5289
5728
|
value: number;
|
|
@@ -6,12 +6,15 @@ import type { WsComponentMeta } from "./components/component-meta";
|
|
|
6
6
|
declare const EmbedTemplateText: z.ZodObject<{
|
|
7
7
|
type: z.ZodLiteral<"text">;
|
|
8
8
|
value: z.ZodString;
|
|
9
|
+
placeholder: z.ZodOptional<z.ZodBoolean>;
|
|
9
10
|
}, "strip", z.ZodTypeAny, {
|
|
10
11
|
value: string;
|
|
11
12
|
type: "text";
|
|
13
|
+
placeholder?: boolean | undefined;
|
|
12
14
|
}, {
|
|
13
15
|
value: string;
|
|
14
16
|
type: "text";
|
|
17
|
+
placeholder?: boolean | undefined;
|
|
15
18
|
}>;
|
|
16
19
|
type EmbedTemplateText = z.infer<typeof EmbedTemplateText>;
|
|
17
20
|
declare const EmbedTemplateExpression: z.ZodObject<{
|
|
@@ -10670,12 +10673,15 @@ export declare const EmbedTemplateInstance: z.ZodType<EmbedTemplateInstance>;
|
|
|
10670
10673
|
export declare const WsEmbedTemplate: z.ZodLazy<z.ZodArray<z.ZodUnion<[z.ZodType<EmbedTemplateInstance, z.ZodTypeDef, EmbedTemplateInstance>, z.ZodObject<{
|
|
10671
10674
|
type: z.ZodLiteral<"text">;
|
|
10672
10675
|
value: z.ZodString;
|
|
10676
|
+
placeholder: z.ZodOptional<z.ZodBoolean>;
|
|
10673
10677
|
}, "strip", z.ZodTypeAny, {
|
|
10674
10678
|
value: string;
|
|
10675
10679
|
type: "text";
|
|
10680
|
+
placeholder?: boolean | undefined;
|
|
10676
10681
|
}, {
|
|
10677
10682
|
value: string;
|
|
10678
10683
|
type: "text";
|
|
10684
|
+
placeholder?: boolean | undefined;
|
|
10679
10685
|
}>, z.ZodObject<{
|
|
10680
10686
|
type: z.ZodLiteral<"expression">;
|
|
10681
10687
|
value: z.ZodString;
|
|
@@ -10690,23 +10696,25 @@ export type WsEmbedTemplate = z.infer<typeof WsEmbedTemplate>;
|
|
|
10690
10696
|
export declare const generateDataFromEmbedTemplate: (treeTemplate: ({
|
|
10691
10697
|
value: string;
|
|
10692
10698
|
type: "text";
|
|
10699
|
+
placeholder?: boolean | undefined;
|
|
10693
10700
|
} | {
|
|
10694
10701
|
value: string;
|
|
10695
10702
|
type: "expression";
|
|
10696
10703
|
} | EmbedTemplateInstance)[], metas: Map<Instance["component"], WsComponentMeta>, defaultBreakpointId: Breakpoint["id"], generateId?: () => string) => WebstudioFragment;
|
|
10697
10704
|
export declare const namespaceMeta: (meta: WsComponentMeta, namespace: string, components: Set<EmbedTemplateInstance["component"]>) => {
|
|
10698
|
-
type: "
|
|
10705
|
+
type: "control" | "embed" | "container" | "rich-text-child";
|
|
10699
10706
|
description?: string | undefined;
|
|
10707
|
+
category?: "data" | "xml" | "text" | "hidden" | "media" | "general" | "forms" | "radix" | "internal" | undefined;
|
|
10700
10708
|
label?: string | undefined;
|
|
10701
10709
|
order?: number | undefined;
|
|
10702
10710
|
template?: ({
|
|
10703
10711
|
value: string;
|
|
10704
10712
|
type: "text";
|
|
10713
|
+
placeholder?: boolean | undefined;
|
|
10705
10714
|
} | {
|
|
10706
10715
|
value: string;
|
|
10707
10716
|
type: "expression";
|
|
10708
10717
|
} | EmbedTemplateInstance)[] | undefined;
|
|
10709
|
-
category?: "data" | "text" | "hidden" | "media" | "general" | "forms" | "radix" | "xml" | undefined;
|
|
10710
10718
|
requiredAncestors?: string[] | undefined;
|
|
10711
10719
|
invalidAncestors?: string[] | undefined;
|
|
10712
10720
|
indexWithinAncestor?: string | undefined;
|
package/lib/types/hook.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.167.0",
|
|
4
4
|
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -28,24 +28,22 @@
|
|
|
28
28
|
"html-tags": "^3.3.1",
|
|
29
29
|
"nanoid": "^5.0.1",
|
|
30
30
|
"title-case": "^4.1.0",
|
|
31
|
-
"@webstudio-is/css-engine": "0.
|
|
32
|
-
"@webstudio-is/
|
|
33
|
-
"@webstudio-is/
|
|
34
|
-
"@webstudio-is/
|
|
35
|
-
"@webstudio-is/sdk": "0.
|
|
31
|
+
"@webstudio-is/css-engine": "0.167.0",
|
|
32
|
+
"@webstudio-is/fonts": "0.167.0",
|
|
33
|
+
"@webstudio-is/icons": "^0.167.0",
|
|
34
|
+
"@webstudio-is/image": "0.167.0",
|
|
35
|
+
"@webstudio-is/sdk": "0.167.0"
|
|
36
36
|
},
|
|
37
37
|
"exports": {
|
|
38
38
|
".": {
|
|
39
39
|
"webstudio": "./src/index.ts",
|
|
40
40
|
"types": "./lib/types/index.d.ts",
|
|
41
|
-
"import": "./lib/index.js"
|
|
42
|
-
"require": "./lib/index.js"
|
|
41
|
+
"import": "./lib/index.js"
|
|
43
42
|
},
|
|
44
43
|
"./css-normalize": {
|
|
45
44
|
"webstudio": "./src/css/normalize.ts",
|
|
46
45
|
"types": "./lib/types/css/normalize.d.ts",
|
|
47
|
-
"import": "./lib/css/normalize.js"
|
|
48
|
-
"require": "./lib/css/normalize.js"
|
|
46
|
+
"import": "./lib/css/normalize.js"
|
|
49
47
|
}
|
|
50
48
|
},
|
|
51
49
|
"files": [
|