@webstudio-is/react-sdk 0.207.0 → 0.209.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 +2 -31
- package/lib/types/embed-template.d.ts +3 -9
- package/lib/types/props.d.ts +853 -195
- package/package.json +8 -8
package/lib/index.js
CHANGED
|
@@ -156,6 +156,7 @@ var showAttribute = "data-ws-show";
|
|
|
156
156
|
var indexAttribute = "data-ws-index";
|
|
157
157
|
var collapsedAttribute = "data-ws-collapsed";
|
|
158
158
|
var textContentAttribute = "data-ws-text-content";
|
|
159
|
+
var animationCanPlayOnCanvasAttribute = "data-ws-animation-can-play-on-canvas";
|
|
159
160
|
var attributeNameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
160
161
|
var attributeNameChar = attributeNameStartChar + ":\\-0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
161
162
|
var validAttributeNameRegex = new RegExp(
|
|
@@ -399,30 +400,6 @@ var generateDataFromEmbedTemplate = (treeTemplate, metas, generateId = nanoid) =
|
|
|
399
400
|
resources: []
|
|
400
401
|
};
|
|
401
402
|
};
|
|
402
|
-
var namespaceEmbedTemplateComponents = (template, namespace, components) => {
|
|
403
|
-
return template.map((item) => {
|
|
404
|
-
if (item.type === "text") {
|
|
405
|
-
return item;
|
|
406
|
-
}
|
|
407
|
-
if (item.type === "expression") {
|
|
408
|
-
return item;
|
|
409
|
-
}
|
|
410
|
-
if (item.type === "instance") {
|
|
411
|
-
const prefix = components.has(item.component) ? `${namespace}:` : "";
|
|
412
|
-
return {
|
|
413
|
-
...item,
|
|
414
|
-
component: `${prefix}${item.component}`,
|
|
415
|
-
children: namespaceEmbedTemplateComponents(
|
|
416
|
-
item.children,
|
|
417
|
-
namespace,
|
|
418
|
-
components
|
|
419
|
-
)
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
item;
|
|
423
|
-
throw Error("Impossible case");
|
|
424
|
-
});
|
|
425
|
-
};
|
|
426
403
|
var namespaceMatcher = (namespace, matcher) => {
|
|
427
404
|
const newMatcher = structuredClone(matcher);
|
|
428
405
|
if (newMatcher.component?.$eq) {
|
|
@@ -457,13 +434,6 @@ var namespaceMeta = (meta, namespace, components) => {
|
|
|
457
434
|
if (newMeta.indexWithinAncestor) {
|
|
458
435
|
newMeta.indexWithinAncestor = components.has(newMeta.indexWithinAncestor) ? `${namespace}:${newMeta.indexWithinAncestor}` : newMeta.indexWithinAncestor;
|
|
459
436
|
}
|
|
460
|
-
if (newMeta.template) {
|
|
461
|
-
newMeta.template = namespaceEmbedTemplateComponents(
|
|
462
|
-
newMeta.template,
|
|
463
|
-
namespace,
|
|
464
|
-
components
|
|
465
|
-
);
|
|
466
|
-
}
|
|
467
437
|
return newMeta;
|
|
468
438
|
};
|
|
469
439
|
|
|
@@ -861,6 +831,7 @@ var generateWebstudioComponent = ({
|
|
|
861
831
|
return generatedComponent;
|
|
862
832
|
};
|
|
863
833
|
export {
|
|
834
|
+
animationCanPlayOnCanvasAttribute,
|
|
864
835
|
collapsedAttribute,
|
|
865
836
|
componentAttribute,
|
|
866
837
|
generateDataFromEmbedTemplate,
|
|
@@ -3,18 +3,10 @@ export declare const generateDataFromEmbedTemplate: (treeTemplate: WsEmbedTempla
|
|
|
3
3
|
export declare const namespaceMeta: (meta: WsComponentMeta, namespace: string, components: Set<EmbedTemplateInstance["component"]>) => {
|
|
4
4
|
type: "control" | "embed" | "container" | "rich-text-child";
|
|
5
5
|
description?: string | undefined;
|
|
6
|
-
category?: "
|
|
6
|
+
category?: "xml" | "hidden" | "data" | "media" | "general" | "typography" | "forms" | "localization" | "radix" | "internal" | undefined;
|
|
7
7
|
placeholder?: string | undefined;
|
|
8
8
|
label?: string | undefined;
|
|
9
9
|
order?: number | undefined;
|
|
10
|
-
template?: ({
|
|
11
|
-
value: string;
|
|
12
|
-
type: "text";
|
|
13
|
-
placeholder?: boolean | undefined;
|
|
14
|
-
} | {
|
|
15
|
-
value: string;
|
|
16
|
-
type: "expression";
|
|
17
|
-
} | EmbedTemplateInstance)[] | undefined;
|
|
18
10
|
states?: {
|
|
19
11
|
label: string;
|
|
20
12
|
selector: string;
|
|
@@ -22,6 +14,7 @@ export declare const namespaceMeta: (meta: WsComponentMeta, namespace: string, c
|
|
|
22
14
|
}[] | undefined;
|
|
23
15
|
constraints?: {
|
|
24
16
|
relation: "ancestor" | "parent" | "self" | "child" | "descendant";
|
|
17
|
+
text?: false | undefined;
|
|
25
18
|
component?: {
|
|
26
19
|
$eq?: string | undefined;
|
|
27
20
|
$neq?: string | undefined;
|
|
@@ -36,6 +29,7 @@ export declare const namespaceMeta: (meta: WsComponentMeta, namespace: string, c
|
|
|
36
29
|
} | undefined;
|
|
37
30
|
} | {
|
|
38
31
|
relation: "ancestor" | "parent" | "self" | "child" | "descendant";
|
|
32
|
+
text?: false | undefined;
|
|
39
33
|
component?: {
|
|
40
34
|
$eq?: string | undefined;
|
|
41
35
|
$neq?: string | undefined;
|