@webstudio-is/react-sdk 0.23.0 → 0.25.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/props.cjs CHANGED
@@ -37,7 +37,7 @@ const getPropsByInstanceIdStore = () => {
37
37
  };
38
38
  const getPropsByInstanceId = (props) => {
39
39
  const propsByInstanceId = /* @__PURE__ */ new Map();
40
- for (const prop of props) {
40
+ for (const prop of props.values()) {
41
41
  let instanceProps = propsByInstanceId.get(prop.instanceId);
42
42
  if (instanceProps === void 0) {
43
43
  instanceProps = [];
@@ -36,7 +36,9 @@ const InstanceRoot = ({
36
36
  if (data.tree === null) {
37
37
  throw new Error("Tree is null");
38
38
  }
39
- (0, import_props.setPropsByInstanceIdStore)((0, import_nanostores.atom)((0, import_props.getPropsByInstanceId)(data.tree.props)));
39
+ (0, import_props.setPropsByInstanceIdStore)(
40
+ (0, import_nanostores.atom)((0, import_props.getPropsByInstanceId)(new Map(data.tree.props)))
41
+ );
40
42
  (0, import_params.setParams)(data.params ?? null);
41
43
  (0, import_components.registerComponents)(customComponents);
42
44
  return (0, import_create_elements_tree.createElementsTree)({
package/lib/props.js CHANGED
@@ -10,7 +10,7 @@ const getPropsByInstanceIdStore = () => {
10
10
  };
11
11
  const getPropsByInstanceId = (props) => {
12
12
  const propsByInstanceId = /* @__PURE__ */ new Map();
13
- for (const prop of props) {
13
+ for (const prop of props.values()) {
14
14
  let instanceProps = propsByInstanceId.get(prop.instanceId);
15
15
  if (instanceProps === void 0) {
16
16
  instanceProps = [];
package/lib/tree/root.js CHANGED
@@ -13,7 +13,9 @@ const InstanceRoot = ({
13
13
  if (data.tree === null) {
14
14
  throw new Error("Tree is null");
15
15
  }
16
- setPropsByInstanceIdStore(atom(getPropsByInstanceId(data.tree.props)));
16
+ setPropsByInstanceIdStore(
17
+ atom(getPropsByInstanceId(new Map(data.tree.props)))
18
+ );
17
19
  setParams(data.params ?? null);
18
20
  registerComponents(customComponents);
19
21
  return createElementsTree({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/react-sdk",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "Webstudio JavaScript / TypeScript API",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -47,12 +47,12 @@
47
47
  "mitt": "^3.0.0",
48
48
  "nanostores": "^0.7.1",
49
49
  "warn-once": "^0.1.1",
50
- "@webstudio-is/asset-uploader": "^0.23.0",
51
- "@webstudio-is/css-data": "^0.23.0",
52
- "@webstudio-is/icons": "^0.23.0",
53
- "@webstudio-is/image": "^0.23.0",
54
- "@webstudio-is/prisma-client": "^0.23.0",
55
- "@webstudio-is/project-build": "^0.23.0"
50
+ "@webstudio-is/asset-uploader": "^0.25.0",
51
+ "@webstudio-is/css-data": "^0.25.0",
52
+ "@webstudio-is/icons": "^0.25.0",
53
+ "@webstudio-is/image": "^0.25.0",
54
+ "@webstudio-is/prisma-client": "^0.25.0",
55
+ "@webstudio-is/project-build": "^0.25.0"
56
56
  },
57
57
  "exports": {
58
58
  "import": "./lib/index.js",
package/src/props.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { useMemo } from "react";
2
2
  import { atom, computed, type ReadableAtom } from "nanostores";
3
3
  import { useStore } from "@nanostores/react";
4
- import type { Instance, Props } from "@webstudio-is/project-build";
4
+ import type { Instance, Prop, Props } from "@webstudio-is/project-build";
5
5
  import type { Asset } from "@webstudio-is/asset-uploader";
6
6
 
7
- type PropsByInstanceId = Map<Instance["id"], Props>;
7
+ type PropsByInstanceId = Map<Instance["id"], Prop[]>;
8
8
 
9
9
  type PropsByInstanceIdStore = ReadableAtom<PropsByInstanceId>;
10
10
 
@@ -20,7 +20,7 @@ export const getPropsByInstanceIdStore = () => {
20
20
 
21
21
  export const getPropsByInstanceId = (props: Props) => {
22
22
  const propsByInstanceId: PropsByInstanceId = new Map();
23
- for (const prop of props) {
23
+ for (const prop of props.values()) {
24
24
  let instanceProps = propsByInstanceId.get(prop.instanceId);
25
25
  if (instanceProps === undefined) {
26
26
  instanceProps = [];
package/src/tree/root.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { ComponentProps } from "react";
2
2
  import { atom } from "nanostores";
3
- import type { Breakpoint } from "@webstudio-is/css-data";
4
3
  import type { Tree } from "@webstudio-is/project-build";
5
4
  import type { Asset } from "@webstudio-is/asset-uploader";
6
5
  import { createElementsTree } from "./create-elements-tree";
@@ -12,7 +11,6 @@ import { getPropsByInstanceId, setPropsByInstanceIdStore } from "../props";
12
11
 
13
12
  export type Data = {
14
13
  tree: Tree | null;
15
- breakpoints: Array<Breakpoint>;
16
14
  assets: Array<Asset>;
17
15
  params?: Params;
18
16
  };
@@ -32,7 +30,9 @@ export const InstanceRoot = ({
32
30
  throw new Error("Tree is null");
33
31
  }
34
32
 
35
- setPropsByInstanceIdStore(atom(getPropsByInstanceId(data.tree.props)));
33
+ setPropsByInstanceIdStore(
34
+ atom(getPropsByInstanceId(new Map(data.tree.props)))
35
+ );
36
36
 
37
37
  setParams(data.params ?? null);
38
38