@webstudio-is/react-sdk 0.208.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 +0 -31
- package/lib/types/embed-template.d.ts +3 -9
- package/lib/types/props.d.ts +852 -195
- package/package.json +8 -8
package/lib/index.js
CHANGED
|
@@ -400,30 +400,6 @@ var generateDataFromEmbedTemplate = (treeTemplate, metas, generateId = nanoid) =
|
|
|
400
400
|
resources: []
|
|
401
401
|
};
|
|
402
402
|
};
|
|
403
|
-
var namespaceEmbedTemplateComponents = (template, namespace, components) => {
|
|
404
|
-
return template.map((item) => {
|
|
405
|
-
if (item.type === "text") {
|
|
406
|
-
return item;
|
|
407
|
-
}
|
|
408
|
-
if (item.type === "expression") {
|
|
409
|
-
return item;
|
|
410
|
-
}
|
|
411
|
-
if (item.type === "instance") {
|
|
412
|
-
const prefix = components.has(item.component) ? `${namespace}:` : "";
|
|
413
|
-
return {
|
|
414
|
-
...item,
|
|
415
|
-
component: `${prefix}${item.component}`,
|
|
416
|
-
children: namespaceEmbedTemplateComponents(
|
|
417
|
-
item.children,
|
|
418
|
-
namespace,
|
|
419
|
-
components
|
|
420
|
-
)
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
item;
|
|
424
|
-
throw Error("Impossible case");
|
|
425
|
-
});
|
|
426
|
-
};
|
|
427
403
|
var namespaceMatcher = (namespace, matcher) => {
|
|
428
404
|
const newMatcher = structuredClone(matcher);
|
|
429
405
|
if (newMatcher.component?.$eq) {
|
|
@@ -458,13 +434,6 @@ var namespaceMeta = (meta, namespace, components) => {
|
|
|
458
434
|
if (newMeta.indexWithinAncestor) {
|
|
459
435
|
newMeta.indexWithinAncestor = components.has(newMeta.indexWithinAncestor) ? `${namespace}:${newMeta.indexWithinAncestor}` : newMeta.indexWithinAncestor;
|
|
460
436
|
}
|
|
461
|
-
if (newMeta.template) {
|
|
462
|
-
newMeta.template = namespaceEmbedTemplateComponents(
|
|
463
|
-
newMeta.template,
|
|
464
|
-
namespace,
|
|
465
|
-
components
|
|
466
|
-
);
|
|
467
|
-
}
|
|
468
437
|
return newMeta;
|
|
469
438
|
};
|
|
470
439
|
|
|
@@ -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;
|