@webstudio-is/react-sdk 0.36.0 → 0.41.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.
Files changed (79) hide show
  1. package/lib/app/custom-components/shared/remix-link.js +2 -2
  2. package/lib/cjs/app/custom-components/shared/remix-link.cjs +2 -2
  3. package/lib/cjs/components/__generated__/blockquote.props.cjs +2 -2
  4. package/lib/cjs/components/__generated__/body.props.cjs +2 -2
  5. package/lib/cjs/components/__generated__/bold.props.cjs +2 -2
  6. package/lib/cjs/components/__generated__/box.props.cjs +2 -2
  7. package/lib/cjs/components/__generated__/button.props.cjs +2 -2
  8. package/lib/cjs/components/__generated__/code.props.cjs +2 -2
  9. package/lib/cjs/components/__generated__/form.props.cjs +2 -2
  10. package/lib/cjs/components/__generated__/heading.props.cjs +2 -2
  11. package/lib/cjs/components/__generated__/image.props.cjs +2 -2
  12. package/lib/cjs/components/__generated__/input.props.cjs +2 -2
  13. package/lib/cjs/components/__generated__/italic.props.cjs +2 -2
  14. package/lib/cjs/components/__generated__/link.props.cjs +15 -3
  15. package/lib/cjs/components/__generated__/list-item.props.cjs +2 -2
  16. package/lib/cjs/components/__generated__/list.props.cjs +3 -3
  17. package/lib/cjs/components/__generated__/paragraph.props.cjs +2 -2
  18. package/lib/cjs/components/__generated__/rich-text-link.props.cjs +15 -4
  19. package/lib/cjs/components/__generated__/separator.props.cjs +2 -2
  20. package/lib/cjs/components/__generated__/span.props.cjs +2 -2
  21. package/lib/cjs/components/__generated__/subscript.props.cjs +2 -2
  22. package/lib/cjs/components/__generated__/superscript.props.cjs +2 -2
  23. package/lib/cjs/components/__generated__/text-block.props.cjs +2 -2
  24. package/lib/cjs/components/link.cjs +8 -5
  25. package/lib/cjs/components/link.ws.cjs +1 -1
  26. package/lib/cjs/components/rich-text-link.cjs +5 -7
  27. package/lib/cjs/tree/root.cjs +15 -7
  28. package/lib/components/__generated__/blockquote.props.js +2 -2
  29. package/lib/components/__generated__/body.props.js +2 -2
  30. package/lib/components/__generated__/bold.props.js +2 -2
  31. package/lib/components/__generated__/box.props.js +2 -2
  32. package/lib/components/__generated__/button.props.js +2 -2
  33. package/lib/components/__generated__/code.props.js +2 -2
  34. package/lib/components/__generated__/form.props.js +2 -2
  35. package/lib/components/__generated__/heading.props.js +2 -2
  36. package/lib/components/__generated__/image.props.js +2 -2
  37. package/lib/components/__generated__/input.props.js +2 -2
  38. package/lib/components/__generated__/italic.props.js +2 -2
  39. package/lib/components/__generated__/link.props.js +15 -3
  40. package/lib/components/__generated__/list-item.props.js +2 -2
  41. package/lib/components/__generated__/list.props.js +3 -3
  42. package/lib/components/__generated__/paragraph.props.js +2 -2
  43. package/lib/components/__generated__/rich-text-link.props.js +15 -4
  44. package/lib/components/__generated__/separator.props.js +2 -2
  45. package/lib/components/__generated__/span.props.js +2 -2
  46. package/lib/components/__generated__/subscript.props.js +2 -2
  47. package/lib/components/__generated__/superscript.props.js +2 -2
  48. package/lib/components/__generated__/text-block.props.js +2 -2
  49. package/lib/components/link.js +8 -5
  50. package/lib/components/link.ws.js +1 -1
  51. package/lib/components/rich-text-link.js +5 -7
  52. package/lib/tree/root.js +15 -7
  53. package/package.json +9 -9
  54. package/src/app/custom-components/shared/remix-link.tsx +4 -3
  55. package/src/components/__generated__/blockquote.props.ts +2 -2
  56. package/src/components/__generated__/body.props.ts +2 -2
  57. package/src/components/__generated__/bold.props.ts +2 -2
  58. package/src/components/__generated__/box.props.ts +2 -2
  59. package/src/components/__generated__/button.props.ts +2 -2
  60. package/src/components/__generated__/code.props.ts +2 -2
  61. package/src/components/__generated__/form.props.ts +2 -2
  62. package/src/components/__generated__/heading.props.ts +2 -2
  63. package/src/components/__generated__/image.props.ts +2 -2
  64. package/src/components/__generated__/input.props.ts +2 -2
  65. package/src/components/__generated__/italic.props.ts +2 -2
  66. package/src/components/__generated__/link.props.ts +15 -3
  67. package/src/components/__generated__/list-item.props.ts +2 -2
  68. package/src/components/__generated__/list.props.ts +3 -3
  69. package/src/components/__generated__/paragraph.props.ts +2 -2
  70. package/src/components/__generated__/rich-text-link.props.ts +15 -4
  71. package/src/components/__generated__/separator.props.ts +2 -2
  72. package/src/components/__generated__/span.props.ts +2 -2
  73. package/src/components/__generated__/subscript.props.ts +2 -2
  74. package/src/components/__generated__/superscript.props.ts +2 -2
  75. package/src/components/__generated__/text-block.props.ts +2 -2
  76. package/src/components/link.tsx +11 -2
  77. package/src/components/link.ws.tsx +1 -1
  78. package/src/components/rich-text-link.tsx +5 -4
  79. package/src/tree/root.ts +22 -11
@@ -96,7 +96,7 @@ const props = {
96
96
  "aria-autocomplete": {
97
97
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
98
98
  required: false,
99
- control: "radio",
99
+ control: "select",
100
100
  type: "string",
101
101
  options: ["list", "none", "inline", "both"]
102
102
  },
@@ -359,7 +359,7 @@ const props = {
359
359
  "aria-sort": {
360
360
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
361
361
  required: false,
362
- control: "radio",
362
+ control: "select",
363
363
  type: "string",
364
364
  options: ["none", "ascending", "descending", "other"]
365
365
  },
@@ -113,7 +113,7 @@ const props = {
113
113
  "aria-autocomplete": {
114
114
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
115
115
  required: false,
116
- control: "radio",
116
+ control: "select",
117
117
  type: "string",
118
118
  options: ["list", "none", "inline", "both"]
119
119
  },
@@ -376,7 +376,7 @@ const props = {
376
376
  "aria-sort": {
377
377
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
378
378
  required: false,
379
- control: "radio",
379
+ control: "select",
380
380
  type: "string",
381
381
  options: ["none", "ascending", "descending", "other"]
382
382
  },
@@ -97,7 +97,7 @@ const props = {
97
97
  "aria-autocomplete": {
98
98
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
99
99
  required: false,
100
- control: "radio",
100
+ control: "select",
101
101
  type: "string",
102
102
  options: ["inline", "list", "none", "both"]
103
103
  },
@@ -360,7 +360,7 @@ const props = {
360
360
  "aria-sort": {
361
361
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
362
362
  required: false,
363
- control: "radio",
363
+ control: "select",
364
364
  type: "string",
365
365
  options: ["none", "ascending", "descending", "other"]
366
366
  },
@@ -104,7 +104,7 @@ const props = {
104
104
  "aria-autocomplete": {
105
105
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
106
106
  required: false,
107
- control: "radio",
107
+ control: "select",
108
108
  type: "string",
109
109
  options: ["list", "none", "inline", "both"]
110
110
  },
@@ -367,7 +367,7 @@ const props = {
367
367
  "aria-sort": {
368
368
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
369
369
  required: false,
370
- control: "radio",
370
+ control: "select",
371
371
  type: "string",
372
372
  options: ["none", "ascending", "descending", "other"]
373
373
  },
@@ -96,7 +96,7 @@ const props = {
96
96
  "aria-autocomplete": {
97
97
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
98
98
  required: false,
99
- control: "radio",
99
+ control: "select",
100
100
  type: "string",
101
101
  options: ["list", "none", "inline", "both"]
102
102
  },
@@ -359,7 +359,7 @@ const props = {
359
359
  "aria-sort": {
360
360
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
361
361
  required: false,
362
- control: "radio",
362
+ control: "select",
363
363
  type: "string",
364
364
  options: ["none", "ascending", "descending", "other"]
365
365
  },
@@ -137,7 +137,7 @@ const props = {
137
137
  "aria-autocomplete": {
138
138
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
139
139
  required: false,
140
- control: "radio",
140
+ control: "select",
141
141
  type: "string",
142
142
  options: ["list", "none", "inline", "both"]
143
143
  },
@@ -400,7 +400,7 @@ const props = {
400
400
  "aria-sort": {
401
401
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
402
402
  required: false,
403
- control: "radio",
403
+ control: "select",
404
404
  type: "string",
405
405
  options: ["none", "ascending", "descending", "other"]
406
406
  },
@@ -134,7 +134,7 @@ const props = {
134
134
  "aria-autocomplete": {
135
135
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
136
136
  required: false,
137
- control: "radio",
137
+ control: "select",
138
138
  type: "string",
139
139
  options: ["list", "none", "inline", "both"]
140
140
  },
@@ -397,7 +397,7 @@ const props = {
397
397
  "aria-sort": {
398
398
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
399
399
  required: false,
400
- control: "radio",
400
+ control: "select",
401
401
  type: "string",
402
402
  options: ["none", "ascending", "descending", "other"]
403
403
  },
@@ -96,7 +96,7 @@ const props = {
96
96
  "aria-autocomplete": {
97
97
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
98
98
  required: false,
99
- control: "radio",
99
+ control: "select",
100
100
  type: "string",
101
101
  options: ["list", "none", "inline", "both"]
102
102
  },
@@ -359,7 +359,7 @@ const props = {
359
359
  "aria-sort": {
360
360
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
361
361
  required: false,
362
- control: "radio",
362
+ control: "select",
363
363
  type: "string",
364
364
  options: ["none", "ascending", "descending", "other"]
365
365
  },
@@ -8,7 +8,13 @@ const props = {
8
8
  media: { required: false, control: "text", type: "string" },
9
9
  ping: { required: false, control: "text", type: "string" },
10
10
  rel: { required: false, control: "text", type: "string" },
11
- target: { required: false, control: "text", type: "string" },
11
+ target: {
12
+ required: false,
13
+ control: "select",
14
+ type: "string",
15
+ defaultValue: "self",
16
+ options: ["self", "blank", "parent", "top"]
17
+ },
12
18
  type: { required: false, control: "text", type: "string" },
13
19
  referrerPolicy: {
14
20
  required: false,
@@ -120,7 +126,7 @@ const props = {
120
126
  "aria-autocomplete": {
121
127
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
122
128
  required: false,
123
- control: "radio",
129
+ control: "select",
124
130
  type: "string",
125
131
  options: ["list", "none", "inline", "both"]
126
132
  },
@@ -383,7 +389,7 @@ const props = {
383
389
  "aria-sort": {
384
390
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
385
391
  required: false,
386
- control: "radio",
392
+ control: "select",
387
393
  type: "string",
388
394
  options: ["none", "ascending", "descending", "other"]
389
395
  },
@@ -410,6 +416,12 @@ const props = {
410
416
  required: false,
411
417
  control: "text",
412
418
  type: "string"
419
+ },
420
+ prefetch: {
421
+ required: false,
422
+ control: "radio",
423
+ type: "string",
424
+ options: ["none", "intent", "render"]
413
425
  }
414
426
  };
415
427
  export {
@@ -97,7 +97,7 @@ const props = {
97
97
  "aria-autocomplete": {
98
98
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
99
99
  required: false,
100
- control: "radio",
100
+ control: "select",
101
101
  type: "string",
102
102
  options: ["list", "none", "inline", "both"]
103
103
  },
@@ -360,7 +360,7 @@ const props = {
360
360
  "aria-sort": {
361
361
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
362
362
  required: false,
363
- control: "radio",
363
+ control: "select",
364
364
  type: "string",
365
365
  options: ["none", "ascending", "descending", "other"]
366
366
  },
@@ -96,7 +96,7 @@ const props = {
96
96
  "aria-autocomplete": {
97
97
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
98
98
  required: false,
99
- control: "radio",
99
+ control: "select",
100
100
  type: "string",
101
101
  options: ["list", "none", "inline", "both"]
102
102
  },
@@ -359,7 +359,7 @@ const props = {
359
359
  "aria-sort": {
360
360
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
361
361
  required: false,
362
- control: "radio",
362
+ control: "select",
363
363
  type: "string",
364
364
  options: ["none", "ascending", "descending", "other"]
365
365
  },
@@ -391,7 +391,7 @@ const props = {
391
391
  start: { required: false, control: "number", type: "number" },
392
392
  type: {
393
393
  required: false,
394
- control: "radio",
394
+ control: "select",
395
395
  type: "string",
396
396
  options: ["a", "i", "1", "A", "I"]
397
397
  },
@@ -96,7 +96,7 @@ const props = {
96
96
  "aria-autocomplete": {
97
97
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
98
98
  required: false,
99
- control: "radio",
99
+ control: "select",
100
100
  type: "string",
101
101
  options: ["list", "none", "inline", "both"]
102
102
  },
@@ -359,7 +359,7 @@ const props = {
359
359
  "aria-sort": {
360
360
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
361
361
  required: false,
362
- control: "radio",
362
+ control: "select",
363
363
  type: "string",
364
364
  options: ["none", "ascending", "descending", "other"]
365
365
  },
@@ -3,12 +3,17 @@ const props = {
3
3
  style: { required: false, control: "text", type: "string" },
4
4
  title: { required: false, control: "text", type: "string" },
5
5
  download: { required: false, control: "text", type: "string" },
6
- href: { required: false, control: "text", type: "string", defaultValue: "" },
6
+ href: { required: false, control: "text", type: "string" },
7
7
  hrefLang: { required: false, control: "text", type: "string" },
8
8
  media: { required: false, control: "text", type: "string" },
9
9
  ping: { required: false, control: "text", type: "string" },
10
10
  rel: { required: false, control: "text", type: "string" },
11
- target: { required: false, control: "text", type: "string" },
11
+ target: {
12
+ required: false,
13
+ control: "select",
14
+ type: "string",
15
+ options: ["self", "blank", "parent", "top"]
16
+ },
12
17
  type: { required: false, control: "text", type: "string" },
13
18
  referrerPolicy: {
14
19
  required: false,
@@ -120,7 +125,7 @@ const props = {
120
125
  "aria-autocomplete": {
121
126
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
122
127
  required: false,
123
- control: "radio",
128
+ control: "select",
124
129
  type: "string",
125
130
  options: ["list", "none", "inline", "both"]
126
131
  },
@@ -383,7 +388,7 @@ const props = {
383
388
  "aria-sort": {
384
389
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
385
390
  required: false,
386
- control: "radio",
391
+ control: "select",
387
392
  type: "string",
388
393
  options: ["none", "ascending", "descending", "other"]
389
394
  },
@@ -410,6 +415,12 @@ const props = {
410
415
  required: false,
411
416
  control: "text",
412
417
  type: "string"
418
+ },
419
+ prefetch: {
420
+ required: false,
421
+ control: "radio",
422
+ type: "string",
423
+ options: ["none", "intent", "render"]
413
424
  }
414
425
  };
415
426
  export {
@@ -96,7 +96,7 @@ const props = {
96
96
  "aria-autocomplete": {
97
97
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
98
98
  required: false,
99
- control: "radio",
99
+ control: "select",
100
100
  type: "string",
101
101
  options: ["list", "none", "inline", "both"]
102
102
  },
@@ -359,7 +359,7 @@ const props = {
359
359
  "aria-sort": {
360
360
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
361
361
  required: false,
362
- control: "radio",
362
+ control: "select",
363
363
  type: "string",
364
364
  options: ["none", "ascending", "descending", "other"]
365
365
  },
@@ -96,7 +96,7 @@ const props = {
96
96
  "aria-autocomplete": {
97
97
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
98
98
  required: false,
99
- control: "radio",
99
+ control: "select",
100
100
  type: "string",
101
101
  options: ["list", "none", "inline", "both"]
102
102
  },
@@ -359,7 +359,7 @@ const props = {
359
359
  "aria-sort": {
360
360
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
361
361
  required: false,
362
- control: "radio",
362
+ control: "select",
363
363
  type: "string",
364
364
  options: ["none", "ascending", "descending", "other"]
365
365
  },
@@ -96,7 +96,7 @@ const props = {
96
96
  "aria-autocomplete": {
97
97
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
98
98
  required: false,
99
- control: "radio",
99
+ control: "select",
100
100
  type: "string",
101
101
  options: ["list", "none", "inline", "both"]
102
102
  },
@@ -359,7 +359,7 @@ const props = {
359
359
  "aria-sort": {
360
360
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
361
361
  required: false,
362
- control: "radio",
362
+ control: "select",
363
363
  type: "string",
364
364
  options: ["none", "ascending", "descending", "other"]
365
365
  },
@@ -96,7 +96,7 @@ const props = {
96
96
  "aria-autocomplete": {
97
97
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
98
98
  required: false,
99
- control: "radio",
99
+ control: "select",
100
100
  type: "string",
101
101
  options: ["list", "none", "inline", "both"]
102
102
  },
@@ -359,7 +359,7 @@ const props = {
359
359
  "aria-sort": {
360
360
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
361
361
  required: false,
362
- control: "radio",
362
+ control: "select",
363
363
  type: "string",
364
364
  options: ["none", "ascending", "descending", "other"]
365
365
  },
@@ -96,7 +96,7 @@ const props = {
96
96
  "aria-autocomplete": {
97
97
  description: "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
98
98
  required: false,
99
- control: "radio",
99
+ control: "select",
100
100
  type: "string",
101
101
  options: ["list", "none", "inline", "both"]
102
102
  },
@@ -359,7 +359,7 @@ const props = {
359
359
  "aria-sort": {
360
360
  description: "Indicates if items in a table or grid are sorted in ascending or descending order.",
361
361
  required: false,
362
- control: "radio",
362
+ control: "select",
363
363
  type: "string",
364
364
  options: ["none", "ascending", "descending", "other"]
365
365
  },
@@ -1,11 +1,14 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  const Link = forwardRef(
4
- ({ href = "", ...props }, ref) => /* @__PURE__ */ jsx("a", {
5
- ...props,
6
- href,
7
- ref
8
- })
4
+ ({ href = "", target = "self", ...props }, ref) => {
5
+ return /* @__PURE__ */ jsx("a", {
6
+ ...props,
7
+ target: `_${target}`,
8
+ href,
9
+ ref
10
+ });
11
+ }
9
12
  );
10
13
  Link.displayName = "Link";
11
14
  export {
@@ -20,7 +20,7 @@ const meta = {
20
20
  };
21
21
  const propsMeta = {
22
22
  props,
23
- initialProps: ["href"]
23
+ initialProps: ["href", "target", "prefetch"]
24
24
  };
25
25
  export {
26
26
  meta,
@@ -1,12 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- const RichTextLink = forwardRef(
4
- ({ href = "", ...props }, ref) => /* @__PURE__ */ jsx("a", {
5
- ...props,
6
- href,
7
- ref
8
- })
9
- );
3
+ import { Link } from "./link";
4
+ const RichTextLink = forwardRef((props, ref) => /* @__PURE__ */ jsx(Link, {
5
+ ...props,
6
+ ref
7
+ }));
10
8
  RichTextLink.displayName = "RichTextLink";
11
9
  export {
12
10
  RichTextLink
package/lib/tree/root.js CHANGED
@@ -5,7 +5,7 @@ import { registerComponents } from "../components";
5
5
  import { customComponents as defaultCustomComponents } from "../app/custom-components";
6
6
  import { setParams } from "../app/params";
7
7
  import { getPropsByInstanceId } from "../props";
8
- const denormalizeTree = (instances) => {
8
+ const denormalizeTree = (instances, rootInstanceId) => {
9
9
  const convertTree = (instance) => {
10
10
  const legacyInstance = {
11
11
  type: "instance",
@@ -25,7 +25,11 @@ const denormalizeTree = (instances) => {
25
25
  }
26
26
  return legacyInstance;
27
27
  };
28
- return convertTree(Array.from(instances.values())[0]);
28
+ const rootInstance = instances.get(rootInstanceId);
29
+ if (rootInstance === void 0) {
30
+ return void 0;
31
+ }
32
+ return convertTree(rootInstance);
29
33
  };
30
34
  const InstanceRoot = ({
31
35
  data,
@@ -33,15 +37,19 @@ const InstanceRoot = ({
33
37
  customComponents = defaultCustomComponents,
34
38
  getComponent
35
39
  }) => {
36
- if (data.tree === null) {
37
- throw new Error("Tree is null");
38
- }
39
40
  setParams(data.params ?? null);
40
41
  registerComponents(customComponents);
42
+ const instance = denormalizeTree(
43
+ new Map(data.build.instances),
44
+ data.page.rootInstanceId
45
+ );
46
+ if (instance === void 0) {
47
+ return null;
48
+ }
41
49
  return createElementsTree({
42
- instance: denormalizeTree(new Map(data.tree.instances)),
50
+ instance,
43
51
  propsByInstanceIdStore: atom(
44
- getPropsByInstanceId(new Map(data.tree.props))
52
+ getPropsByInstanceId(new Map(data.build.props))
45
53
  ),
46
54
  assetsStore: atom(new Map(data.assets.map((asset) => [asset.id, asset]))),
47
55
  Component: Component ?? WebstudioComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/react-sdk",
3
- "version": "0.36.0",
3
+ "version": "0.41.0",
4
4
  "description": "Webstudio JavaScript / TypeScript API",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -46,14 +46,14 @@
46
46
  "mitt": "^3.0.0",
47
47
  "nanostores": "^0.7.1",
48
48
  "warn-once": "^0.1.1",
49
- "@webstudio-is/asset-uploader": "^0.36.0",
50
- "@webstudio-is/css-data": "^0.36.0",
51
- "@webstudio-is/css-vars": "^0.36.0",
52
- "@webstudio-is/generate-arg-types": "^0.36.0",
53
- "@webstudio-is/icons": "^0.36.0",
54
- "@webstudio-is/image": "^0.36.0",
55
- "@webstudio-is/prisma-client": "^0.36.0",
56
- "@webstudio-is/project-build": "^0.36.0"
49
+ "@webstudio-is/asset-uploader": "^0.41.0",
50
+ "@webstudio-is/css-data": "^0.41.0",
51
+ "@webstudio-is/css-vars": "^0.41.0",
52
+ "@webstudio-is/generate-arg-types": "^0.41.0",
53
+ "@webstudio-is/icons": "^0.41.0",
54
+ "@webstudio-is/image": "^0.41.0",
55
+ "@webstudio-is/prisma-client": "^0.41.0",
56
+ "@webstudio-is/project-build": "^0.41.0"
57
57
  },
58
58
  "exports": {
59
59
  ".": {
@@ -6,12 +6,13 @@ import type {
6
6
  ForwardRefExoticComponent,
7
7
  } from "react";
8
8
  import { forwardRef } from "react";
9
+ import type { Link as BaseLink } from "../../../components/link";
9
10
 
10
11
  const isAbsoluteUrl = (href: string) => {
11
12
  try {
12
13
  new URL(href);
13
14
  return true;
14
- } catch (e) {
15
+ } catch {
15
16
  return false;
16
17
  }
17
18
  };
@@ -21,7 +22,7 @@ const isAbsoluteUrl = (href: string) => {
21
22
  const isAbsoluteUrlRemix = (href: string) =>
22
23
  /^[a-z+]+:\/\//i.test(href) || href.startsWith("//");
23
24
 
24
- type Props = Omit<ComponentProps<"a">, "href"> & { href?: string };
25
+ type Props = ComponentProps<typeof BaseLink>;
25
26
 
26
27
  type Ref = ElementRef<"a">;
27
28
 
@@ -41,7 +42,7 @@ export const wrapLinkComponent = (
41
42
 
42
43
  if (isAbsolute || willRemixTryToTreatAsAbsoluteAndCrash) {
43
44
  return (
44
- <a
45
+ <BaseLink
45
46
  {...props}
46
47
  href={willRemixTryToTreatAsAbsoluteAndCrash ? "" : href}
47
48
  ref={ref}
@@ -104,7 +104,7 @@ export const props: Record<string, PropMeta> = {
104
104
  description:
105
105
  "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
106
106
  required: false,
107
- control: "radio",
107
+ control: "select",
108
108
  type: "string",
109
109
  options: ["list", "none", "inline", "both"],
110
110
  },
@@ -406,7 +406,7 @@ export const props: Record<string, PropMeta> = {
406
406
  description:
407
407
  "Indicates if items in a table or grid are sorted in ascending or descending order.",
408
408
  required: false,
409
- control: "radio",
409
+ control: "select",
410
410
  type: "string",
411
411
  options: ["none", "ascending", "descending", "other"],
412
412
  },
@@ -103,7 +103,7 @@ export const props: Record<string, PropMeta> = {
103
103
  description:
104
104
  "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
105
105
  required: false,
106
- control: "radio",
106
+ control: "select",
107
107
  type: "string",
108
108
  options: ["list", "none", "inline", "both"],
109
109
  },
@@ -405,7 +405,7 @@ export const props: Record<string, PropMeta> = {
405
405
  description:
406
406
  "Indicates if items in a table or grid are sorted in ascending or descending order.",
407
407
  required: false,
408
- control: "radio",
408
+ control: "select",
409
409
  type: "string",
410
410
  options: ["none", "ascending", "descending", "other"],
411
411
  },
@@ -103,7 +103,7 @@ export const props: Record<string, PropMeta> = {
103
103
  description:
104
104
  "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
105
105
  required: false,
106
- control: "radio",
106
+ control: "select",
107
107
  type: "string",
108
108
  options: ["list", "none", "inline", "both"],
109
109
  },
@@ -405,7 +405,7 @@ export const props: Record<string, PropMeta> = {
405
405
  description:
406
406
  "Indicates if items in a table or grid are sorted in ascending or descending order.",
407
407
  required: false,
408
- control: "radio",
408
+ control: "select",
409
409
  type: "string",
410
410
  options: ["none", "ascending", "descending", "other"],
411
411
  },
@@ -103,7 +103,7 @@ export const props: Record<string, PropMeta> = {
103
103
  description:
104
104
  "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
105
105
  required: false,
106
- control: "radio",
106
+ control: "select",
107
107
  type: "string",
108
108
  options: ["list", "none", "inline", "both"],
109
109
  },
@@ -405,7 +405,7 @@ export const props: Record<string, PropMeta> = {
405
405
  description:
406
406
  "Indicates if items in a table or grid are sorted in ascending or descending order.",
407
407
  required: false,
408
- control: "radio",
408
+ control: "select",
409
409
  type: "string",
410
410
  options: ["none", "ascending", "descending", "other"],
411
411
  },