@webstudio-is/react-sdk 0.209.0 → 0.210.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 -37
- package/lib/types/embed-template.d.ts +1 -48
- package/package.json +8 -8
package/lib/index.js
CHANGED
|
@@ -400,42 +400,6 @@ var generateDataFromEmbedTemplate = (treeTemplate, metas, generateId = nanoid) =
|
|
|
400
400
|
resources: []
|
|
401
401
|
};
|
|
402
402
|
};
|
|
403
|
-
var namespaceMatcher = (namespace, matcher) => {
|
|
404
|
-
const newMatcher = structuredClone(matcher);
|
|
405
|
-
if (newMatcher.component?.$eq) {
|
|
406
|
-
newMatcher.component.$eq = `${namespace}:${newMatcher.component.$eq}`;
|
|
407
|
-
}
|
|
408
|
-
if (newMatcher.component?.$neq) {
|
|
409
|
-
newMatcher.component.$neq = `${namespace}:${newMatcher.component.$neq}`;
|
|
410
|
-
}
|
|
411
|
-
if (newMatcher.component?.$in) {
|
|
412
|
-
newMatcher.component.$in = newMatcher.component.$in.map(
|
|
413
|
-
(component) => `${namespace}:${component}`
|
|
414
|
-
);
|
|
415
|
-
}
|
|
416
|
-
if (newMatcher.component?.$nin) {
|
|
417
|
-
newMatcher.component.$nin = newMatcher.component.$nin.map(
|
|
418
|
-
(component) => `${namespace}:${component}`
|
|
419
|
-
);
|
|
420
|
-
}
|
|
421
|
-
return newMatcher;
|
|
422
|
-
};
|
|
423
|
-
var namespaceMeta = (meta, namespace, components) => {
|
|
424
|
-
const newMeta = { ...meta };
|
|
425
|
-
if (newMeta.constraints) {
|
|
426
|
-
if (Array.isArray(newMeta.constraints)) {
|
|
427
|
-
newMeta.constraints = newMeta.constraints.map(
|
|
428
|
-
(matcher) => namespaceMatcher(namespace, matcher)
|
|
429
|
-
);
|
|
430
|
-
} else {
|
|
431
|
-
newMeta.constraints = namespaceMatcher(namespace, newMeta.constraints);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
if (newMeta.indexWithinAncestor) {
|
|
435
|
-
newMeta.indexWithinAncestor = components.has(newMeta.indexWithinAncestor) ? `${namespace}:${newMeta.indexWithinAncestor}` : newMeta.indexWithinAncestor;
|
|
436
|
-
}
|
|
437
|
-
return newMeta;
|
|
438
|
-
};
|
|
439
403
|
|
|
440
404
|
// src/component-generator.ts
|
|
441
405
|
import {
|
|
@@ -843,7 +807,6 @@ export {
|
|
|
843
807
|
idAttribute,
|
|
844
808
|
indexAttribute,
|
|
845
809
|
isAttributeNameSafe,
|
|
846
|
-
namespaceMeta,
|
|
847
810
|
normalizeProps,
|
|
848
811
|
selectorIdAttribute,
|
|
849
812
|
showAttribute,
|
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
import type { Instance, WebstudioFragment, WsEmbedTemplate,
|
|
1
|
+
import type { Instance, WebstudioFragment, WsEmbedTemplate, WsComponentMeta } from "@webstudio-is/sdk";
|
|
2
2
|
export declare const generateDataFromEmbedTemplate: (treeTemplate: WsEmbedTemplate, metas: Map<Instance["component"], WsComponentMeta>, generateId?: () => string) => WebstudioFragment;
|
|
3
|
-
export declare const namespaceMeta: (meta: WsComponentMeta, namespace: string, components: Set<EmbedTemplateInstance["component"]>) => {
|
|
4
|
-
type: "control" | "embed" | "container" | "rich-text-child";
|
|
5
|
-
description?: string | undefined;
|
|
6
|
-
category?: "xml" | "hidden" | "data" | "media" | "general" | "typography" | "forms" | "localization" | "radix" | "internal" | undefined;
|
|
7
|
-
placeholder?: string | undefined;
|
|
8
|
-
label?: string | undefined;
|
|
9
|
-
order?: number | undefined;
|
|
10
|
-
states?: {
|
|
11
|
-
label: string;
|
|
12
|
-
selector: string;
|
|
13
|
-
category?: "states" | "component-states" | undefined;
|
|
14
|
-
}[] | undefined;
|
|
15
|
-
constraints?: {
|
|
16
|
-
relation: "ancestor" | "parent" | "self" | "child" | "descendant";
|
|
17
|
-
text?: false | undefined;
|
|
18
|
-
component?: {
|
|
19
|
-
$eq?: string | undefined;
|
|
20
|
-
$neq?: string | undefined;
|
|
21
|
-
$in?: string[] | undefined;
|
|
22
|
-
$nin?: string[] | undefined;
|
|
23
|
-
} | undefined;
|
|
24
|
-
tag?: {
|
|
25
|
-
$eq?: string | undefined;
|
|
26
|
-
$neq?: string | undefined;
|
|
27
|
-
$in?: string[] | undefined;
|
|
28
|
-
$nin?: string[] | undefined;
|
|
29
|
-
} | undefined;
|
|
30
|
-
} | {
|
|
31
|
-
relation: "ancestor" | "parent" | "self" | "child" | "descendant";
|
|
32
|
-
text?: false | undefined;
|
|
33
|
-
component?: {
|
|
34
|
-
$eq?: string | undefined;
|
|
35
|
-
$neq?: string | undefined;
|
|
36
|
-
$in?: string[] | undefined;
|
|
37
|
-
$nin?: string[] | undefined;
|
|
38
|
-
} | undefined;
|
|
39
|
-
tag?: {
|
|
40
|
-
$eq?: string | undefined;
|
|
41
|
-
$neq?: string | undefined;
|
|
42
|
-
$in?: string[] | undefined;
|
|
43
|
-
$nin?: string[] | undefined;
|
|
44
|
-
} | undefined;
|
|
45
|
-
}[] | undefined;
|
|
46
|
-
indexWithinAncestor?: string | undefined;
|
|
47
|
-
icon: string;
|
|
48
|
-
presetStyle?: import("@webstudio-is/sdk").PresetStyle;
|
|
49
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.210.0",
|
|
4
4
|
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"type-fest": "^4.37.0",
|
|
15
15
|
"vitest": "^3.0.8",
|
|
16
16
|
"zod": "^3.24.2",
|
|
17
|
-
"@webstudio-is/
|
|
18
|
-
"@webstudio-is/
|
|
17
|
+
"@webstudio-is/tsconfig": "1.0.7",
|
|
18
|
+
"@webstudio-is/template": "0.210.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"change-case": "^5.4.4",
|
|
27
27
|
"html-tags": "^4.0.0",
|
|
28
28
|
"nanoid": "^5.0.9",
|
|
29
|
-
"@webstudio-is/
|
|
30
|
-
"@webstudio-is/
|
|
31
|
-
"@webstudio-is/
|
|
32
|
-
"@webstudio-is/
|
|
33
|
-
"@webstudio-is/sdk": "0.
|
|
29
|
+
"@webstudio-is/fonts": "0.210.0",
|
|
30
|
+
"@webstudio-is/icons": "^0.210.0",
|
|
31
|
+
"@webstudio-is/image": "0.210.0",
|
|
32
|
+
"@webstudio-is/css-engine": "0.210.0",
|
|
33
|
+
"@webstudio-is/sdk": "0.210.0"
|
|
34
34
|
},
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|