@webstudio-is/react-sdk 0.58.0 → 0.59.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/cjs/components/component-meta.js +6 -0
- package/lib/cjs/components/link-block.ws.js +1 -0
- package/lib/cjs/components/link.ws.js +1 -0
- package/lib/components/component-meta.js +6 -0
- package/lib/components/link-block.ws.js +2 -1
- package/lib/components/link.ws.js +1 -0
- package/lib/types/components/component-meta.d.ts +29 -0
- package/lib/types/index.d.ts +1 -1
- package/package.json +11 -11
- package/src/components/component-meta.ts +8 -0
- package/src/components/link-block.ws.tsx +2 -1
- package/src/components/link.ws.tsx +1 -0
- package/src/index.ts +1 -0
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var component_meta_exports = {};
|
|
20
20
|
__export(component_meta_exports, {
|
|
21
|
+
ComponentState: () => ComponentState,
|
|
21
22
|
componentCategories: () => componentCategories
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(component_meta_exports);
|
|
@@ -33,6 +34,10 @@ const componentCategories = [
|
|
|
33
34
|
"media",
|
|
34
35
|
"forms"
|
|
35
36
|
];
|
|
37
|
+
const ComponentState = import_zod.z.object({
|
|
38
|
+
selector: import_zod.z.string(),
|
|
39
|
+
label: import_zod.z.string()
|
|
40
|
+
});
|
|
36
41
|
const WsComponentMeta = import_zod.z.object({
|
|
37
42
|
category: import_zod.z.enum(componentCategories).optional(),
|
|
38
43
|
// container - can accept other components with dnd
|
|
@@ -50,5 +55,6 @@ const WsComponentMeta = import_zod.z.object({
|
|
|
50
55
|
label: import_zod.z.string(),
|
|
51
56
|
Icon: import_zod.z.function(),
|
|
52
57
|
presetStyle: import_zod.z.optional(import_zod.z.any()),
|
|
58
|
+
states: import_zod.z.optional(import_zod.z.array(ComponentState)),
|
|
53
59
|
children: import_zod.z.optional(import_zod.z.array(import_zod.z.string()))
|
|
54
60
|
});
|
|
@@ -10,6 +10,10 @@ const componentCategories = [
|
|
|
10
10
|
"media",
|
|
11
11
|
"forms"
|
|
12
12
|
];
|
|
13
|
+
const ComponentState = z.object({
|
|
14
|
+
selector: z.string(),
|
|
15
|
+
label: z.string()
|
|
16
|
+
});
|
|
13
17
|
const WsComponentMeta = z.object({
|
|
14
18
|
category: z.enum(componentCategories).optional(),
|
|
15
19
|
// container - can accept other components with dnd
|
|
@@ -27,8 +31,10 @@ const WsComponentMeta = z.object({
|
|
|
27
31
|
label: z.string(),
|
|
28
32
|
Icon: z.function(),
|
|
29
33
|
presetStyle: z.optional(z.any()),
|
|
34
|
+
states: z.optional(z.array(ComponentState)),
|
|
30
35
|
children: z.optional(z.array(z.string()))
|
|
31
36
|
});
|
|
32
37
|
export {
|
|
38
|
+
ComponentState,
|
|
33
39
|
componentCategories
|
|
34
40
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BoxLinkIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { props } from "./__generated__/link-block.props";
|
|
3
|
-
import { propsMeta as linkPropsMeta } from "./link.ws";
|
|
3
|
+
import { meta as linkMeta, propsMeta as linkPropsMeta } from "./link.ws";
|
|
4
4
|
import { a } from "../css/normalize";
|
|
5
5
|
const presetStyle = {
|
|
6
6
|
a: {
|
|
@@ -16,6 +16,7 @@ const meta = {
|
|
|
16
16
|
type: "container",
|
|
17
17
|
label: "Link Block",
|
|
18
18
|
Icon: BoxLinkIcon,
|
|
19
|
+
states: linkMeta.states,
|
|
19
20
|
presetStyle
|
|
20
21
|
};
|
|
21
22
|
const propsMeta = {
|
|
@@ -581,17 +581,42 @@ declare const WsComponentPropsMeta: z.ZodObject<{
|
|
|
581
581
|
}>;
|
|
582
582
|
export type WsComponentPropsMeta = z.infer<typeof WsComponentPropsMeta>;
|
|
583
583
|
export declare const componentCategories: readonly ["general", "typography", "media", "forms"];
|
|
584
|
+
export declare const ComponentState: z.ZodObject<{
|
|
585
|
+
selector: z.ZodString;
|
|
586
|
+
label: z.ZodString;
|
|
587
|
+
}, "strip", z.ZodTypeAny, {
|
|
588
|
+
label: string;
|
|
589
|
+
selector: string;
|
|
590
|
+
}, {
|
|
591
|
+
label: string;
|
|
592
|
+
selector: string;
|
|
593
|
+
}>;
|
|
594
|
+
export type ComponentState = z.infer<typeof ComponentState>;
|
|
584
595
|
declare const WsComponentMeta: z.ZodObject<{
|
|
585
596
|
category: z.ZodOptional<z.ZodEnum<["general", "typography", "media", "forms"]>>;
|
|
586
597
|
type: z.ZodEnum<["container", "control", "embed", "rich-text", "rich-text-child"]>;
|
|
587
598
|
label: z.ZodString;
|
|
588
599
|
Icon: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
|
|
589
600
|
presetStyle: z.ZodOptional<z.ZodAny>;
|
|
601
|
+
states: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
602
|
+
selector: z.ZodString;
|
|
603
|
+
label: z.ZodString;
|
|
604
|
+
}, "strip", z.ZodTypeAny, {
|
|
605
|
+
label: string;
|
|
606
|
+
selector: string;
|
|
607
|
+
}, {
|
|
608
|
+
label: string;
|
|
609
|
+
selector: string;
|
|
610
|
+
}>, "many">>;
|
|
590
611
|
children: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
591
612
|
}, "strip", z.ZodTypeAny, {
|
|
592
613
|
children?: string[] | undefined;
|
|
593
614
|
category?: "media" | "general" | "typography" | "forms" | undefined;
|
|
594
615
|
presetStyle?: any;
|
|
616
|
+
states?: {
|
|
617
|
+
label: string;
|
|
618
|
+
selector: string;
|
|
619
|
+
}[] | undefined;
|
|
595
620
|
type: "embed" | "control" | "container" | "rich-text" | "rich-text-child";
|
|
596
621
|
label: string;
|
|
597
622
|
Icon: (...args: unknown[]) => unknown;
|
|
@@ -599,6 +624,10 @@ declare const WsComponentMeta: z.ZodObject<{
|
|
|
599
624
|
children?: string[] | undefined;
|
|
600
625
|
category?: "media" | "general" | "typography" | "forms" | undefined;
|
|
601
626
|
presetStyle?: any;
|
|
627
|
+
states?: {
|
|
628
|
+
label: string;
|
|
629
|
+
selector: string;
|
|
630
|
+
}[] | undefined;
|
|
602
631
|
type: "embed" | "control" | "container" | "rich-text" | "rich-text-child";
|
|
603
632
|
label: string;
|
|
604
633
|
Icon: (...args: unknown[]) => unknown;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export * from "./app";
|
|
|
6
6
|
export * from "./components/components";
|
|
7
7
|
export * from "./components/components-utils";
|
|
8
8
|
export { customComponents, customComponentMetas, customComponentPropsMetas, } from "./app/custom-components";
|
|
9
|
-
export { type WsComponentPropsMeta, type WsComponentMeta, componentCategories, } from "./components/component-meta";
|
|
9
|
+
export { type WsComponentPropsMeta, type WsComponentMeta, type ComponentState, componentCategories, } from "./components/component-meta";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"html-tags": "^3.2.0",
|
|
39
39
|
"nanoevents": "^7.0.1",
|
|
40
40
|
"nanostores": "^0.7.1",
|
|
41
|
-
"@webstudio-is/asset-uploader": "^0.
|
|
42
|
-
"@webstudio-is/css-data": "^0.
|
|
43
|
-
"@webstudio-is/css-engine": "^0.
|
|
44
|
-
"@webstudio-is/css-vars": "^0.
|
|
45
|
-
"@webstudio-is/fonts": "^0.
|
|
46
|
-
"@webstudio-is/generate-arg-types": "^0.
|
|
47
|
-
"@webstudio-is/icons": "^0.
|
|
48
|
-
"@webstudio-is/image": "^0.
|
|
49
|
-
"@webstudio-is/prisma-client": "^0.
|
|
50
|
-
"@webstudio-is/project-build": "^0.
|
|
41
|
+
"@webstudio-is/asset-uploader": "^0.59.0",
|
|
42
|
+
"@webstudio-is/css-data": "^0.59.0",
|
|
43
|
+
"@webstudio-is/css-engine": "^0.59.0",
|
|
44
|
+
"@webstudio-is/css-vars": "^0.59.0",
|
|
45
|
+
"@webstudio-is/fonts": "^0.59.0",
|
|
46
|
+
"@webstudio-is/generate-arg-types": "^0.59.0",
|
|
47
|
+
"@webstudio-is/icons": "^0.59.0",
|
|
48
|
+
"@webstudio-is/image": "^0.59.0",
|
|
49
|
+
"@webstudio-is/prisma-client": "^0.59.0",
|
|
50
|
+
"@webstudio-is/project-build": "^0.59.0"
|
|
51
51
|
},
|
|
52
52
|
"exports": {
|
|
53
53
|
".": {
|
|
@@ -23,6 +23,13 @@ export const componentCategories = [
|
|
|
23
23
|
"forms",
|
|
24
24
|
] as const;
|
|
25
25
|
|
|
26
|
+
export const ComponentState = z.object({
|
|
27
|
+
selector: z.string(),
|
|
28
|
+
label: z.string(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type ComponentState = z.infer<typeof ComponentState>;
|
|
32
|
+
|
|
26
33
|
const WsComponentMeta = z.object({
|
|
27
34
|
category: z.enum(componentCategories).optional(),
|
|
28
35
|
// container - can accept other components with dnd
|
|
@@ -40,6 +47,7 @@ const WsComponentMeta = z.object({
|
|
|
40
47
|
label: z.string(),
|
|
41
48
|
Icon: z.function(),
|
|
42
49
|
presetStyle: z.optional(z.any()),
|
|
50
|
+
states: z.optional(z.array(ComponentState)),
|
|
43
51
|
children: z.optional(z.array(z.string())),
|
|
44
52
|
});
|
|
45
53
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BoxLinkIcon } from "@webstudio-is/icons";
|
|
2
2
|
import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
|
|
3
3
|
import { props } from "./__generated__/link-block.props";
|
|
4
|
-
import { propsMeta as linkPropsMeta } from "./link.ws";
|
|
4
|
+
import { meta as linkMeta, propsMeta as linkPropsMeta } from "./link.ws";
|
|
5
5
|
import type { defaultTag } from "./link-block";
|
|
6
6
|
import type { Style } from "@webstudio-is/css-data";
|
|
7
7
|
import { a } from "../css/normalize";
|
|
@@ -21,6 +21,7 @@ export const meta: WsComponentMeta = {
|
|
|
21
21
|
type: "container",
|
|
22
22
|
label: "Link Block",
|
|
23
23
|
Icon: BoxLinkIcon,
|
|
24
|
+
states: linkMeta.states,
|
|
24
25
|
presetStyle,
|
|
25
26
|
};
|
|
26
27
|
|