@webstudio-is/react-sdk 0.71.0 → 0.72.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.
@@ -35,7 +35,8 @@ const componentCategories = [
35
35
  "general",
36
36
  "text",
37
37
  "media",
38
- "forms"
38
+ "forms",
39
+ "hidden"
39
40
  ];
40
41
  const stateCategories = ["states", "component-states"];
41
42
  const ComponentState = import_zod.z.object({
@@ -54,6 +54,7 @@ const EmbedTemplateProp = import_zod.z.union([
54
54
  })
55
55
  ]);
56
56
  const EmbedTemplateStyleDeclRaw = import_zod.z.object({
57
+ // State selector, e.g. :hover
57
58
  state: import_zod.z.optional(import_zod.z.string()),
58
59
  property: import_zod.z.string(),
59
60
  value: import_css_data.StyleValue
@@ -9,7 +9,8 @@ const componentCategories = [
9
9
  "general",
10
10
  "text",
11
11
  "media",
12
- "forms"
12
+ "forms",
13
+ "hidden"
13
14
  ];
14
15
  const stateCategories = ["states", "component-states"];
15
16
  const ComponentState = z.object({
@@ -28,6 +28,7 @@ const EmbedTemplateProp = z.union([
28
28
  })
29
29
  ]);
30
30
  const EmbedTemplateStyleDeclRaw = z.object({
31
+ // State selector, e.g. :hover
31
32
  state: z.optional(z.string()),
32
33
  property: z.string(),
33
34
  value: StyleValue
@@ -618,7 +618,7 @@ declare const WsComponentPropsMeta: z.ZodObject<{
618
618
  initialProps?: string[] | undefined;
619
619
  }>;
620
620
  export type WsComponentPropsMeta = z.infer<typeof WsComponentPropsMeta>;
621
- export declare const componentCategories: readonly ["general", "text", "media", "forms"];
621
+ export declare const componentCategories: readonly ["general", "text", "media", "forms", "hidden"];
622
622
  export declare const stateCategories: readonly ["states", "component-states"];
623
623
  export declare const ComponentState: z.ZodObject<{
624
624
  category: z.ZodOptional<z.ZodEnum<["states", "component-states"]>>;
@@ -636,7 +636,7 @@ export declare const ComponentState: z.ZodObject<{
636
636
  export type ComponentState = z.infer<typeof ComponentState>;
637
637
  export declare const defaultStates: ComponentState[];
638
638
  declare const WsComponentMeta: z.ZodObject<{
639
- category: z.ZodOptional<z.ZodEnum<["general", "text", "media", "forms"]>>;
639
+ category: z.ZodOptional<z.ZodEnum<["general", "text", "media", "forms", "hidden"]>>;
640
640
  type: z.ZodEnum<["container", "control", "embed", "rich-text", "rich-text-child"]>;
641
641
  requiredAncestors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
642
642
  invalidAncestors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -1040,7 +1040,7 @@ declare const WsComponentMeta: z.ZodObject<{
1040
1040
  type: "embed" | "control" | "container" | "rich-text" | "rich-text-child";
1041
1041
  label: string;
1042
1042
  icon: string;
1043
- category?: "text" | "media" | "general" | "forms" | undefined;
1043
+ category?: "text" | "hidden" | "media" | "general" | "forms" | undefined;
1044
1044
  requiredAncestors?: string[] | undefined;
1045
1045
  invalidAncestors?: string[] | undefined;
1046
1046
  stylable?: boolean | undefined;
@@ -1243,7 +1243,7 @@ declare const WsComponentMeta: z.ZodObject<{
1243
1243
  type: "embed" | "control" | "container" | "rich-text" | "rich-text-child";
1244
1244
  label: string;
1245
1245
  icon: string;
1246
- category?: "text" | "media" | "general" | "forms" | undefined;
1246
+ category?: "text" | "hidden" | "media" | "general" | "forms" | undefined;
1247
1247
  requiredAncestors?: string[] | undefined;
1248
1248
  invalidAncestors?: string[] | undefined;
1249
1249
  stylable?: boolean | undefined;
@@ -3,7 +3,7 @@ import { type ReadableAtom } from "nanostores";
3
3
  import type { Assets } from "@webstudio-is/asset-uploader";
4
4
  import type { Pages, PropsByInstanceId } from "./props";
5
5
  export declare const ReactSdkContext: import("react").Context<{
6
- renderer?: "canvas" | undefined;
6
+ renderer?: "canvas" | "preview" | undefined;
7
7
  propsByInstanceIdStore: ReadableAtom<PropsByInstanceId>;
8
8
  assetsStore: ReadableAtom<Assets>;
9
9
  pagesStore: ReadableAtom<Pages>;
@@ -6,7 +6,7 @@ import type { Components } from "../components/components-utils";
6
6
  import type { Pages, PropsByInstanceId } from "../props";
7
7
  import type { WebstudioComponent } from "./webstudio-component";
8
8
  export declare const createElementsTree: ({ renderer, instances, rootInstanceId, propsByInstanceIdStore, assetsStore, pagesStore, Component, components, }: {
9
- renderer?: "canvas" | undefined;
9
+ renderer?: "canvas" | "preview" | undefined;
10
10
  instances: Map<string, {
11
11
  type: "instance";
12
12
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/react-sdk",
3
- "version": "0.71.0",
3
+ "version": "0.72.0",
4
4
  "description": "Webstudio JavaScript / TypeScript API",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -13,8 +13,8 @@
13
13
  "jest": "^29.3.1",
14
14
  "react": "^18.2.0",
15
15
  "react-dom": "^18.2.0",
16
- "typescript": "5.0.3",
17
16
  "type-fest": "^3.7.1",
17
+ "typescript": "5.0.3",
18
18
  "zod": "^3.21.4",
19
19
  "@webstudio-is/jest-config": "^1.0.6",
20
20
  "@webstudio-is/scripts": "^0.0.0",
@@ -33,12 +33,12 @@
33
33
  "nanoevents": "^7.0.1",
34
34
  "nanoid": "^3.2.0",
35
35
  "nanostores": "^0.7.1",
36
- "@webstudio-is/asset-uploader": "^0.71.0",
37
- "@webstudio-is/css-data": "^0.71.0",
38
- "@webstudio-is/css-engine": "^0.71.0",
39
- "@webstudio-is/fonts": "^0.71.0",
40
- "@webstudio-is/generate-arg-types": "^0.71.0",
41
- "@webstudio-is/project-build": "^0.71.0"
36
+ "@webstudio-is/asset-uploader": "^0.72.0",
37
+ "@webstudio-is/css-data": "^0.72.0",
38
+ "@webstudio-is/css-engine": "^0.72.0",
39
+ "@webstudio-is/fonts": "^0.72.0",
40
+ "@webstudio-is/generate-arg-types": "^0.72.0",
41
+ "@webstudio-is/project-build": "^0.72.0"
42
42
  },
43
43
  "exports": {
44
44
  ".": {
@@ -21,6 +21,7 @@ export const componentCategories = [
21
21
  "text",
22
22
  "media",
23
23
  "forms",
24
+ "hidden",
24
25
  ] as const;
25
26
 
26
27
  export const stateCategories = ["states", "component-states"] as const;
package/src/context.tsx CHANGED
@@ -4,7 +4,7 @@ import type { Assets } from "@webstudio-is/asset-uploader";
4
4
  import type { Pages, PropsByInstanceId } from "./props";
5
5
 
6
6
  export const ReactSdkContext = createContext<{
7
- renderer?: "canvas";
7
+ renderer?: "canvas" | "preview";
8
8
  propsByInstanceIdStore: ReadableAtom<PropsByInstanceId>;
9
9
  assetsStore: ReadableAtom<Assets>;
10
10
  pagesStore: ReadableAtom<Pages>;
@@ -45,6 +45,7 @@ const EmbedTemplateProp = z.union([
45
45
  type EmbedTemplateProp = z.infer<typeof EmbedTemplateProp>;
46
46
 
47
47
  const EmbedTemplateStyleDeclRaw = z.object({
48
+ // State selector, e.g. :hover
48
49
  state: z.optional(z.string()),
49
50
  property: z.string(),
50
51
  value: StyleValue,
@@ -20,7 +20,7 @@ export const createElementsTree = ({
20
20
  Component,
21
21
  components,
22
22
  }: {
23
- renderer?: "canvas";
23
+ renderer?: "canvas" | "preview";
24
24
  instances: Instances;
25
25
  rootInstanceId: Instance["id"];
26
26
  propsByInstanceIdStore: ReadableAtom<PropsByInstanceId>;