@webstudio-is/react-sdk 0.206.0 → 0.207.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 CHANGED
@@ -779,33 +779,33 @@ var generateWebstudioComponent = ({
779
779
  classesMap
780
780
  }) => {
781
781
  const instance = instances.get(rootInstanceId);
782
- if (instance === void 0) {
783
- return "";
784
- }
785
782
  const indexesWithinAncestors = getIndexesWithinAncestors(metas, instances, [
786
783
  rootInstanceId
787
784
  ]);
788
785
  const usedDataSources = /* @__PURE__ */ new Map();
789
- const generatedJsx = generateJsxElement({
790
- context: "expression",
791
- scope,
792
- instance,
793
- props,
794
- dataSources,
795
- usedDataSources,
796
- indexesWithinAncestors,
797
- classesMap,
798
- children: generateJsxChildren({
786
+ let generatedJsx = "<></>\n";
787
+ if (instance) {
788
+ generatedJsx = generateJsxElement({
789
+ context: "expression",
799
790
  scope,
800
- children: instance.children,
801
- instances,
791
+ instance,
802
792
  props,
803
793
  dataSources,
804
794
  usedDataSources,
805
795
  indexesWithinAncestors,
806
- classesMap
807
- })
808
- });
796
+ classesMap,
797
+ children: generateJsxChildren({
798
+ scope,
799
+ children: instance.children,
800
+ instances,
801
+ props,
802
+ dataSources,
803
+ usedDataSources,
804
+ indexesWithinAncestors,
805
+ classesMap
806
+ })
807
+ });
808
+ }
809
809
  let generatedProps = "";
810
810
  let generatedParameters = "";
811
811
  const uniqueParameters = new Set(
package/lib/runtime.js CHANGED
@@ -7,7 +7,8 @@ import {
7
7
  var ReactSdkContext = createContext({
8
8
  assetBaseUrl: "/",
9
9
  imageLoader: ({ src }) => src,
10
- resources: {}
10
+ resources: {},
11
+ breakpoints: []
11
12
  });
12
13
  var useResource = (name) => {
13
14
  const { resources } = useContext(ReactSdkContext);
@@ -22,5 +22,10 @@ export type Params = {
22
22
  export declare const ReactSdkContext: import("react").Context<Params & {
23
23
  imageLoader: ImageLoader;
24
24
  resources: Record<string, any>;
25
+ breakpoints: {
26
+ id: string;
27
+ minWidth?: number;
28
+ maxWidth?: number;
29
+ }[];
25
30
  }>;
26
31
  export declare const useResource: (name: string) => any;
@@ -394,6 +394,7 @@ export declare const normalizeProps: ({ props, assetBaseUrl, assets, uploadingIm
394
394
  };
395
395
  name?: string | undefined;
396
396
  description?: string | undefined;
397
+ enabled?: [string, boolean][] | undefined;
397
398
  }[];
398
399
  source?: "closest" | "nearest" | "root" | undefined;
399
400
  axis?: "block" | "x" | "inline" | "y" | undefined;
@@ -699,6 +700,7 @@ export declare const normalizeProps: ({ props, assetBaseUrl, assets, uploadingIm
699
700
  };
700
701
  name?: string | undefined;
701
702
  description?: string | undefined;
703
+ enabled?: [string, boolean][] | undefined;
702
704
  }[];
703
705
  subject?: string | undefined;
704
706
  axis?: "block" | "x" | "inline" | "y" | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/react-sdk",
3
- "version": "0.206.0",
3
+ "version": "0.207.0",
4
4
  "description": "Webstudio JavaScript / TypeScript API",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -11,10 +11,10 @@
11
11
  "react": "18.3.0-canary-14898b6a9-20240318",
12
12
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
13
13
  "strip-indent": "^4.0.0",
14
- "type-fest": "^4.32.0",
15
- "vitest": "^3.0.4",
14
+ "type-fest": "^4.37.0",
15
+ "vitest": "^3.0.8",
16
16
  "zod": "^3.22.4",
17
- "@webstudio-is/template": "0.206.0",
17
+ "@webstudio-is/template": "0.207.0",
18
18
  "@webstudio-is/tsconfig": "1.0.7"
19
19
  },
20
20
  "peerDependencies": {
@@ -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/css-engine": "0.206.0",
30
- "@webstudio-is/fonts": "0.206.0",
31
- "@webstudio-is/icons": "^0.206.0",
32
- "@webstudio-is/image": "0.206.0",
33
- "@webstudio-is/sdk": "0.206.0"
29
+ "@webstudio-is/css-engine": "0.207.0",
30
+ "@webstudio-is/fonts": "0.207.0",
31
+ "@webstudio-is/icons": "^0.207.0",
32
+ "@webstudio-is/image": "0.207.0",
33
+ "@webstudio-is/sdk": "0.207.0"
34
34
  },
35
35
  "exports": {
36
36
  ".": {
package/placeholder.d.ts CHANGED
@@ -11,6 +11,12 @@ declare module "__CLIENT__" {
11
11
 
12
12
  export const favIconAsset: string | undefined;
13
13
 
14
+ export const breakpoints: {
15
+ id: string;
16
+ minWidth?: number;
17
+ maxWidth?: number;
18
+ }[];
19
+
14
20
  // Font assets on current page (can be preloaded)
15
21
  export const pageFontAssets: string[];
16
22