@makeswift/runtime 0.26.3 → 0.26.4-canary.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 (529) hide show
  1. package/dist/cjs/api/{react.js → client.js} +4 -4
  2. package/dist/cjs/api/client.js.map +1 -0
  3. package/dist/cjs/api-handler/handlers/element-tree.js.map +1 -1
  4. package/dist/cjs/api-handler/handlers/manifest.js +1 -1
  5. package/dist/cjs/api-handler/handlers/merge-translated-data.js.map +1 -1
  6. package/dist/cjs/api-handler/handlers/translatable-data.js.map +1 -1
  7. package/dist/cjs/builder/host-to-builder-actions.js +3 -3
  8. package/dist/cjs/builder/host-to-builder-actions.js.map +1 -1
  9. package/dist/cjs/builder/index.js +2 -2
  10. package/dist/cjs/builder/index.js.map +1 -1
  11. package/dist/cjs/client/index.js +8 -8
  12. package/dist/cjs/client/index.js.map +1 -1
  13. package/dist/cjs/components/builtin/Box/Box.js +1 -1
  14. package/dist/cjs/components/builtin/Box/Box.js.map +1 -1
  15. package/dist/cjs/components/builtin/Form/Form.js +1 -1
  16. package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
  17. package/dist/cjs/components/hooks/useTableFormFieldRefs.js +1 -1
  18. package/dist/cjs/components/hooks/useTableFormFieldRefs.js.map +1 -1
  19. package/dist/cjs/next/components/tests/controls/color-control/fixtures.js.map +1 -1
  20. package/dist/cjs/next/components/tests/controls/page-control-prop-rendering.js +1 -2
  21. package/dist/cjs/next/components/tests/controls/page-control-prop-rendering.js.map +1 -1
  22. package/dist/cjs/next/components/tests/controls/rich-text-v2-control/fixtures.js.map +1 -1
  23. package/dist/cjs/next/components/tests/makeswift-component/fixtures.js +1 -2
  24. package/dist/cjs/next/components/tests/makeswift-component/fixtures.js.map +1 -1
  25. package/dist/cjs/next/components/tests/prop-controllers/page-prop-controller.js +2 -3
  26. package/dist/cjs/next/components/tests/prop-controllers/page-prop-controller.js.map +1 -1
  27. package/dist/cjs/next/testing/element-data.js +3 -3
  28. package/dist/cjs/next/testing/element-data.js.map +1 -1
  29. package/dist/cjs/next/testing/index.js +2 -0
  30. package/dist/cjs/next/testing/index.js.map +1 -1
  31. package/dist/cjs/next/testing/page-rendering.js +3 -3
  32. package/dist/cjs/next/testing/page-rendering.js.map +1 -1
  33. package/dist/cjs/next/testing/react-runtime.js +29 -0
  34. package/dist/cjs/next/testing/react-runtime.js.map +1 -0
  35. package/dist/cjs/prop-controllers/descriptors.js.map +1 -1
  36. package/dist/cjs/prop-controllers/instances.js.map +1 -1
  37. package/dist/cjs/runtimes/react/components/Document.js +2 -2
  38. package/dist/cjs/runtimes/react/components/Document.js.map +1 -1
  39. package/dist/cjs/runtimes/react/components/DocumentRoot.js.map +1 -1
  40. package/dist/cjs/runtimes/react/components/Element.js +2 -2
  41. package/dist/cjs/runtimes/react/components/Element.js.map +1 -1
  42. package/dist/cjs/runtimes/react/components/ElementData.js.map +1 -1
  43. package/dist/cjs/runtimes/react/components/ElementReference.js.map +1 -1
  44. package/dist/cjs/runtimes/react/components/ElementRegistration.js +2 -2
  45. package/dist/cjs/runtimes/react/components/ElementRegistration.js.map +1 -1
  46. package/dist/cjs/runtimes/react/components/MakeswiftComponent.js +2 -2
  47. package/dist/cjs/runtimes/react/components/MakeswiftComponent.js.map +1 -1
  48. package/dist/cjs/runtimes/react/components/RuntimeProvider.js +3 -3
  49. package/dist/cjs/runtimes/react/components/RuntimeProvider.js.map +1 -1
  50. package/dist/cjs/runtimes/react/components/page/Page.js.map +1 -1
  51. package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js +2 -3
  52. package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
  53. package/dist/cjs/runtimes/react/controls/rich-text-v2/rich-text-v2.js +2 -2
  54. package/dist/cjs/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
  55. package/dist/cjs/runtimes/react/controls.js +2 -2
  56. package/dist/cjs/runtimes/react/controls.js.map +1 -1
  57. package/dist/cjs/runtimes/react/element-imperative-handle.js +1 -1
  58. package/dist/cjs/runtimes/react/element-imperative-handle.js.map +1 -1
  59. package/dist/cjs/runtimes/react/hooks/use-breakpoints.js +2 -2
  60. package/dist/cjs/runtimes/react/hooks/use-breakpoints.js.map +1 -1
  61. package/dist/cjs/runtimes/react/hooks/use-builder-edit-mode.js +2 -2
  62. package/dist/cjs/runtimes/react/hooks/use-builder-edit-mode.js.map +1 -1
  63. package/dist/cjs/runtimes/react/hooks/use-cache-data.js +2 -2
  64. package/dist/cjs/runtimes/react/hooks/use-cache-data.js.map +1 -1
  65. package/dist/cjs/runtimes/react/hooks/use-component.js +3 -3
  66. package/dist/cjs/runtimes/react/hooks/use-component.js.map +1 -1
  67. package/dist/cjs/runtimes/react/hooks/use-dispatch.js.map +1 -1
  68. package/dist/cjs/runtimes/react/hooks/use-document.js +2 -2
  69. package/dist/cjs/runtimes/react/hooks/use-document.js.map +1 -1
  70. package/dist/cjs/runtimes/react/hooks/use-element-id.js +2 -2
  71. package/dist/cjs/runtimes/react/hooks/use-element-id.js.map +1 -1
  72. package/dist/cjs/runtimes/react/hooks/use-is-in-builder.js +2 -2
  73. package/dist/cjs/runtimes/react/hooks/use-is-in-builder.js.map +1 -1
  74. package/dist/cjs/runtimes/react/hooks/{use-is-preview.js → use-is-read-only.js} +9 -9
  75. package/dist/cjs/runtimes/react/hooks/use-is-read-only.js.map +1 -0
  76. package/dist/cjs/runtimes/react/hooks/use-register-document.js.map +1 -1
  77. package/dist/cjs/runtimes/react/hooks/use-resolved-props.js +2 -2
  78. package/dist/cjs/runtimes/react/hooks/use-resolved-props.js.map +1 -1
  79. package/dist/cjs/runtimes/react/hooks/use-resource-resolver.js +1 -1
  80. package/dist/cjs/runtimes/react/hooks/use-resource-resolver.js.map +1 -1
  81. package/dist/cjs/runtimes/react/hooks/use-selector.js.map +1 -1
  82. package/dist/cjs/runtimes/react/hooks/use-store.js.map +1 -1
  83. package/dist/cjs/runtimes/react/hooks/use-universal-dispatch.js.map +1 -1
  84. package/dist/cjs/runtimes/react/host-api-client.js +2 -2
  85. package/dist/cjs/runtimes/react/host-api-client.js.map +1 -1
  86. package/dist/cjs/runtimes/react/index.js +3 -3
  87. package/dist/cjs/runtimes/react/index.js.map +1 -1
  88. package/dist/cjs/runtimes/react/poll-box-model.js +1 -1
  89. package/dist/cjs/runtimes/react/poll-box-model.js.map +1 -1
  90. package/dist/cjs/runtimes/react/react-runtime-core.js +3 -3
  91. package/dist/cjs/runtimes/react/react-runtime-core.js.map +1 -1
  92. package/dist/cjs/runtimes/react/runtime-core.js +4 -2
  93. package/dist/cjs/runtimes/react/runtime-core.js.map +1 -1
  94. package/dist/cjs/runtimes/react/testing/react-runtime.js +32 -0
  95. package/dist/cjs/runtimes/react/testing/react-runtime.js.map +1 -0
  96. package/dist/cjs/runtimes/react/utils/can-accept-ref.js.map +1 -1
  97. package/dist/cjs/state/actions/internal/index.js +34 -0
  98. package/dist/cjs/state/actions/internal/index.js.map +1 -0
  99. package/dist/cjs/state/actions/{internal.js → internal/read-only-actions.js} +30 -62
  100. package/dist/cjs/state/actions/internal/read-only-actions.js.map +1 -0
  101. package/dist/cjs/state/actions/internal/read-write-actions.js +70 -0
  102. package/dist/cjs/state/actions/internal/read-write-actions.js.map +1 -0
  103. package/dist/cjs/state/builder-api/actions.js +11 -8
  104. package/dist/cjs/state/builder-api/actions.js.map +1 -1
  105. package/dist/cjs/state/host-api.js.map +1 -1
  106. package/dist/cjs/state/makeswift-api-client.js +2 -2
  107. package/dist/cjs/state/makeswift-api-client.js.map +1 -1
  108. package/dist/cjs/state/middleware/prop-controller-handles.js +114 -0
  109. package/dist/cjs/state/middleware/prop-controller-handles.js.map +1 -0
  110. package/dist/cjs/state/middleware/read-only-element-tree.js +52 -0
  111. package/dist/cjs/state/middleware/read-only-element-tree.js.map +1 -0
  112. package/dist/cjs/state/middleware/read-write/builder-api/element-size.js +40 -0
  113. package/dist/cjs/state/middleware/read-write/builder-api/element-size.js.map +1 -0
  114. package/dist/cjs/state/middleware/read-write/builder-api/index.js +76 -0
  115. package/dist/cjs/state/middleware/read-write/builder-api/index.js.map +1 -0
  116. package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js +278 -0
  117. package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -0
  118. package/dist/cjs/state/middleware/read-write/makeswift-api-client-sync.js +37 -0
  119. package/dist/cjs/state/middleware/read-write/makeswift-api-client-sync.js.map +1 -0
  120. package/dist/cjs/state/middleware/read-write/measure-box-models.js +71 -0
  121. package/dist/cjs/state/middleware/read-write/measure-box-models.js.map +1 -0
  122. package/dist/cjs/state/middleware/read-write/update-element-tree.js +59 -0
  123. package/dist/cjs/state/middleware/read-write/update-element-tree.js.map +1 -0
  124. package/dist/cjs/state/modules/api-resources.js +7 -4
  125. package/dist/cjs/state/modules/api-resources.js.map +1 -1
  126. package/dist/cjs/state/modules/breakpoints.js +2 -1
  127. package/dist/cjs/state/modules/breakpoints.js.map +1 -1
  128. package/dist/cjs/state/modules/builder-edit-mode.js +2 -1
  129. package/dist/cjs/state/modules/builder-edit-mode.js.map +1 -1
  130. package/dist/cjs/state/modules/components-meta.js +3 -2
  131. package/dist/cjs/state/modules/components-meta.js.map +1 -1
  132. package/dist/cjs/state/modules/element-trees.js +5 -3
  133. package/dist/cjs/state/modules/element-trees.js.map +1 -1
  134. package/dist/cjs/state/modules/is-in-builder.js +2 -1
  135. package/dist/cjs/state/modules/is-in-builder.js.map +1 -1
  136. package/dist/cjs/state/modules/{is-preview.js → is-read-only.js} +12 -9
  137. package/dist/cjs/state/modules/is-read-only.js.map +1 -0
  138. package/dist/cjs/state/modules/localized-resources-map.js +4 -2
  139. package/dist/cjs/state/modules/localized-resources-map.js.map +1 -1
  140. package/dist/cjs/state/modules/prop-controllers.js +3 -2
  141. package/dist/cjs/state/modules/prop-controllers.js.map +1 -1
  142. package/dist/cjs/state/modules/react-components.js +3 -2
  143. package/dist/cjs/state/modules/react-components.js.map +1 -1
  144. package/dist/cjs/state/modules/read-only-documents.js +3 -2
  145. package/dist/cjs/state/modules/read-only-documents.js.map +1 -1
  146. package/dist/cjs/state/modules/{box-models.js → read-write/box-models.js} +6 -4
  147. package/dist/cjs/state/modules/read-write/box-models.js.map +1 -0
  148. package/dist/cjs/state/modules/{element-imperative-handles.js → read-write/element-imperative-handles.js} +4 -3
  149. package/dist/cjs/state/modules/read-write/element-imperative-handles.js.map +1 -0
  150. package/dist/cjs/state/modules/{pointer.js → read-write/pointer.js} +3 -2
  151. package/dist/cjs/state/modules/read-write/pointer.js.map +1 -0
  152. package/dist/cjs/state/modules/{read-write-documents.js → read-write/read-write-documents.js} +3 -3
  153. package/dist/cjs/state/modules/read-write/read-write-documents.js.map +1 -0
  154. package/dist/cjs/state/ops/copy-element-tree.js +67 -0
  155. package/dist/cjs/state/ops/copy-element-tree.js.map +1 -0
  156. package/dist/cjs/state/ops/merge-element.js +73 -0
  157. package/dist/cjs/state/ops/merge-element.js.map +1 -0
  158. package/dist/cjs/state/react-builder-preview.js +18 -508
  159. package/dist/cjs/state/react-builder-preview.js.map +1 -1
  160. package/dist/cjs/state/react-page.js +6 -250
  161. package/dist/cjs/state/react-page.js.map +1 -1
  162. package/dist/cjs/state/read-only-state.js +209 -0
  163. package/dist/cjs/state/read-only-state.js.map +1 -0
  164. package/dist/cjs/state/read-write-state.js +121 -0
  165. package/dist/cjs/state/read-write-state.js.map +1 -0
  166. package/dist/cjs/state/shared-api.js.map +1 -1
  167. package/dist/cjs/state/translations/get.js +2 -2
  168. package/dist/cjs/state/translations/get.js.map +1 -1
  169. package/dist/cjs/state/translations/merge.js +2 -2
  170. package/dist/cjs/state/translations/merge.js.map +1 -1
  171. package/dist/esm/api/{react.js → client.js} +1 -1
  172. package/dist/esm/api/client.js.map +1 -0
  173. package/dist/esm/api-handler/handlers/element-tree.js.map +1 -1
  174. package/dist/esm/api-handler/handlers/manifest.js +1 -1
  175. package/dist/esm/api-handler/handlers/merge-translated-data.js.map +1 -1
  176. package/dist/esm/api-handler/handlers/translatable-data.js.map +1 -1
  177. package/dist/esm/builder/host-to-builder-actions.js +4 -4
  178. package/dist/esm/builder/host-to-builder-actions.js.map +1 -1
  179. package/dist/esm/builder/index.js +1 -1
  180. package/dist/esm/builder/index.js.map +1 -1
  181. package/dist/esm/client/index.js +5 -5
  182. package/dist/esm/client/index.js.map +1 -1
  183. package/dist/esm/components/builtin/Box/Box.js +1 -1
  184. package/dist/esm/components/builtin/Box/Box.js.map +1 -1
  185. package/dist/esm/components/builtin/Form/Form.js +1 -1
  186. package/dist/esm/components/builtin/Form/Form.js.map +1 -1
  187. package/dist/esm/components/hooks/useTableFormFieldRefs.js +1 -1
  188. package/dist/esm/components/hooks/useTableFormFieldRefs.js.map +1 -1
  189. package/dist/esm/next/components/tests/controls/color-control/fixtures.js.map +1 -1
  190. package/dist/esm/next/components/tests/controls/page-control-prop-rendering.js +1 -2
  191. package/dist/esm/next/components/tests/controls/page-control-prop-rendering.js.map +1 -1
  192. package/dist/esm/next/components/tests/controls/rich-text-v2-control/fixtures.js.map +1 -1
  193. package/dist/esm/next/components/tests/makeswift-component/fixtures.js +1 -2
  194. package/dist/esm/next/components/tests/makeswift-component/fixtures.js.map +1 -1
  195. package/dist/esm/next/components/tests/prop-controllers/page-prop-controller.js +2 -3
  196. package/dist/esm/next/components/tests/prop-controllers/page-prop-controller.js.map +1 -1
  197. package/dist/esm/next/testing/element-data.js +1 -1
  198. package/dist/esm/next/testing/element-data.js.map +1 -1
  199. package/dist/esm/next/testing/index.js +1 -0
  200. package/dist/esm/next/testing/index.js.map +1 -1
  201. package/dist/esm/next/testing/page-rendering.js +3 -3
  202. package/dist/esm/next/testing/page-rendering.js.map +1 -1
  203. package/dist/esm/next/testing/react-runtime.js +5 -0
  204. package/dist/esm/next/testing/react-runtime.js.map +1 -0
  205. package/dist/esm/prop-controllers/descriptors.js.map +1 -1
  206. package/dist/esm/prop-controllers/instances.js.map +1 -1
  207. package/dist/esm/runtimes/react/components/Document.js +1 -1
  208. package/dist/esm/runtimes/react/components/Document.js.map +1 -1
  209. package/dist/esm/runtimes/react/components/DocumentRoot.js.map +1 -1
  210. package/dist/esm/runtimes/react/components/Element.js +3 -1
  211. package/dist/esm/runtimes/react/components/Element.js.map +1 -1
  212. package/dist/esm/runtimes/react/components/ElementData.js.map +1 -1
  213. package/dist/esm/runtimes/react/components/ElementReference.js.map +1 -1
  214. package/dist/esm/runtimes/react/components/ElementRegistration.js +1 -1
  215. package/dist/esm/runtimes/react/components/ElementRegistration.js.map +1 -1
  216. package/dist/esm/runtimes/react/components/MakeswiftComponent.js +1 -1
  217. package/dist/esm/runtimes/react/components/MakeswiftComponent.js.map +1 -1
  218. package/dist/esm/runtimes/react/components/RuntimeProvider.js +2 -2
  219. package/dist/esm/runtimes/react/components/RuntimeProvider.js.map +1 -1
  220. package/dist/esm/runtimes/react/components/page/Page.js.map +1 -1
  221. package/dist/esm/runtimes/react/controls/rich-text/rich-text.js +2 -3
  222. package/dist/esm/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
  223. package/dist/esm/runtimes/react/controls/rich-text-v2/rich-text-v2.js +2 -2
  224. package/dist/esm/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
  225. package/dist/esm/runtimes/react/controls.js +2 -2
  226. package/dist/esm/runtimes/react/controls.js.map +1 -1
  227. package/dist/esm/runtimes/react/element-imperative-handle.js +1 -1
  228. package/dist/esm/runtimes/react/element-imperative-handle.js.map +1 -1
  229. package/dist/esm/runtimes/react/hooks/use-breakpoints.js +1 -1
  230. package/dist/esm/runtimes/react/hooks/use-breakpoints.js.map +1 -1
  231. package/dist/esm/runtimes/react/hooks/use-builder-edit-mode.js +1 -1
  232. package/dist/esm/runtimes/react/hooks/use-builder-edit-mode.js.map +1 -1
  233. package/dist/esm/runtimes/react/hooks/use-cache-data.js +1 -1
  234. package/dist/esm/runtimes/react/hooks/use-cache-data.js.map +1 -1
  235. package/dist/esm/runtimes/react/hooks/use-component.js +1 -1
  236. package/dist/esm/runtimes/react/hooks/use-component.js.map +1 -1
  237. package/dist/esm/runtimes/react/hooks/use-dispatch.js.map +1 -1
  238. package/dist/esm/runtimes/react/hooks/use-document.js +1 -1
  239. package/dist/esm/runtimes/react/hooks/use-document.js.map +1 -1
  240. package/dist/esm/runtimes/react/hooks/use-element-id.js +1 -1
  241. package/dist/esm/runtimes/react/hooks/use-element-id.js.map +1 -1
  242. package/dist/esm/runtimes/react/hooks/use-is-in-builder.js +1 -1
  243. package/dist/esm/runtimes/react/hooks/use-is-in-builder.js.map +1 -1
  244. package/dist/esm/runtimes/react/hooks/use-is-read-only.js +9 -0
  245. package/dist/esm/runtimes/react/hooks/use-is-read-only.js.map +1 -0
  246. package/dist/esm/runtimes/react/hooks/use-register-document.js.map +1 -1
  247. package/dist/esm/runtimes/react/hooks/use-resolved-props.js +2 -2
  248. package/dist/esm/runtimes/react/hooks/use-resolved-props.js.map +1 -1
  249. package/dist/esm/runtimes/react/hooks/use-resource-resolver.js +1 -1
  250. package/dist/esm/runtimes/react/hooks/use-resource-resolver.js.map +1 -1
  251. package/dist/esm/runtimes/react/hooks/use-selector.js.map +1 -1
  252. package/dist/esm/runtimes/react/hooks/use-store.js.map +1 -1
  253. package/dist/esm/runtimes/react/hooks/use-universal-dispatch.js.map +1 -1
  254. package/dist/esm/runtimes/react/host-api-client.js +1 -1
  255. package/dist/esm/runtimes/react/host-api-client.js.map +1 -1
  256. package/dist/esm/runtimes/react/index.js +2 -2
  257. package/dist/esm/runtimes/react/index.js.map +1 -1
  258. package/dist/esm/runtimes/react/poll-box-model.js +1 -1
  259. package/dist/esm/runtimes/react/poll-box-model.js.map +1 -1
  260. package/dist/esm/runtimes/react/react-runtime-core.js +4 -1
  261. package/dist/esm/runtimes/react/react-runtime-core.js.map +1 -1
  262. package/dist/esm/runtimes/react/runtime-core.js +3 -5
  263. package/dist/esm/runtimes/react/runtime-core.js.map +1 -1
  264. package/dist/esm/runtimes/react/testing/react-runtime.js +8 -0
  265. package/dist/esm/runtimes/react/testing/react-runtime.js.map +1 -0
  266. package/dist/esm/runtimes/react/utils/can-accept-ref.js.map +1 -1
  267. package/dist/esm/state/actions/internal/index.js +10 -0
  268. package/dist/esm/state/actions/internal/index.js.map +1 -0
  269. package/dist/esm/state/actions/{internal.js → internal/read-only-actions.js} +24 -52
  270. package/dist/esm/state/actions/internal/read-only-actions.js.map +1 -0
  271. package/dist/esm/state/actions/internal/read-write-actions.js +41 -0
  272. package/dist/esm/state/actions/internal/read-write-actions.js.map +1 -0
  273. package/dist/esm/state/builder-api/actions.js +8 -7
  274. package/dist/esm/state/builder-api/actions.js.map +1 -1
  275. package/dist/esm/state/host-api.js.map +1 -1
  276. package/dist/esm/state/makeswift-api-client.js +1 -1
  277. package/dist/esm/state/makeswift-api-client.js.map +1 -1
  278. package/dist/esm/state/middleware/prop-controller-handles.js +80 -0
  279. package/dist/esm/state/middleware/prop-controller-handles.js.map +1 -0
  280. package/dist/esm/state/middleware/read-only-element-tree.js +28 -0
  281. package/dist/esm/state/middleware/read-only-element-tree.js.map +1 -0
  282. package/dist/esm/state/middleware/read-write/builder-api/element-size.js +16 -0
  283. package/dist/esm/state/middleware/read-write/builder-api/element-size.js.map +1 -0
  284. package/dist/esm/state/middleware/read-write/builder-api/index.js +52 -0
  285. package/dist/esm/state/middleware/read-write/builder-api/index.js.map +1 -0
  286. package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js +251 -0
  287. package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -0
  288. package/dist/esm/state/middleware/read-write/makeswift-api-client-sync.js +13 -0
  289. package/dist/esm/state/middleware/read-write/makeswift-api-client-sync.js.map +1 -0
  290. package/dist/esm/state/middleware/read-write/measure-box-models.js +37 -0
  291. package/dist/esm/state/middleware/read-write/measure-box-models.js.map +1 -0
  292. package/dist/esm/state/middleware/read-write/update-element-tree.js +35 -0
  293. package/dist/esm/state/middleware/read-write/update-element-tree.js.map +1 -0
  294. package/dist/esm/state/modules/api-resources.js +8 -5
  295. package/dist/esm/state/modules/api-resources.js.map +1 -1
  296. package/dist/esm/state/modules/breakpoints.js +3 -2
  297. package/dist/esm/state/modules/breakpoints.js.map +1 -1
  298. package/dist/esm/state/modules/builder-edit-mode.js +3 -2
  299. package/dist/esm/state/modules/builder-edit-mode.js.map +1 -1
  300. package/dist/esm/state/modules/components-meta.js +4 -3
  301. package/dist/esm/state/modules/components-meta.js.map +1 -1
  302. package/dist/esm/state/modules/element-trees.js +6 -4
  303. package/dist/esm/state/modules/element-trees.js.map +1 -1
  304. package/dist/esm/state/modules/is-in-builder.js +3 -2
  305. package/dist/esm/state/modules/is-in-builder.js.map +1 -1
  306. package/dist/esm/state/modules/is-read-only.js +24 -0
  307. package/dist/esm/state/modules/is-read-only.js.map +1 -0
  308. package/dist/esm/state/modules/localized-resources-map.js +5 -3
  309. package/dist/esm/state/modules/localized-resources-map.js.map +1 -1
  310. package/dist/esm/state/modules/prop-controllers.js +4 -3
  311. package/dist/esm/state/modules/prop-controllers.js.map +1 -1
  312. package/dist/esm/state/modules/react-components.js +4 -3
  313. package/dist/esm/state/modules/react-components.js.map +1 -1
  314. package/dist/esm/state/modules/read-only-documents.js +4 -6
  315. package/dist/esm/state/modules/read-only-documents.js.map +1 -1
  316. package/dist/esm/state/modules/{box-models.js → read-write/box-models.js} +6 -4
  317. package/dist/esm/state/modules/read-write/box-models.js.map +1 -0
  318. package/dist/esm/state/modules/{element-imperative-handles.js → read-write/element-imperative-handles.js} +4 -3
  319. package/dist/esm/state/modules/read-write/element-imperative-handles.js.map +1 -0
  320. package/dist/esm/state/modules/{pointer.js → read-write/pointer.js} +3 -2
  321. package/dist/esm/state/modules/read-write/pointer.js.map +1 -0
  322. package/dist/esm/state/modules/{read-write-documents.js → read-write/read-write-documents.js} +3 -3
  323. package/dist/esm/state/modules/read-write/read-write-documents.js.map +1 -0
  324. package/dist/esm/state/ops/copy-element-tree.js +37 -0
  325. package/dist/esm/state/ops/copy-element-tree.js.map +1 -0
  326. package/dist/esm/state/ops/merge-element.js +39 -0
  327. package/dist/esm/state/ops/merge-element.js.map +1 -0
  328. package/dist/esm/state/react-builder-preview.js +15 -500
  329. package/dist/esm/state/react-builder-preview.js.map +1 -1
  330. package/dist/esm/state/react-page.js +7 -240
  331. package/dist/esm/state/react-page.js.map +1 -1
  332. package/dist/esm/state/read-only-state.js +157 -0
  333. package/dist/esm/state/read-only-state.js.map +1 -0
  334. package/dist/esm/state/read-write-state.js +76 -0
  335. package/dist/esm/state/read-write-state.js.map +1 -0
  336. package/dist/esm/state/shared-api.js.map +1 -1
  337. package/dist/esm/state/translations/get.js +1 -1
  338. package/dist/esm/state/translations/get.js.map +1 -1
  339. package/dist/esm/state/translations/merge.js +1 -1
  340. package/dist/esm/state/translations/merge.js.map +1 -1
  341. package/dist/types/api/{react.d.ts → client.d.ts} +1 -1
  342. package/dist/types/api/client.d.ts.map +1 -0
  343. package/dist/types/api-handler/handlers/element-tree.d.ts +1 -1
  344. package/dist/types/api-handler/handlers/element-tree.d.ts.map +1 -1
  345. package/dist/types/api-handler/handlers/merge-translated-data.d.ts +1 -1
  346. package/dist/types/api-handler/handlers/merge-translated-data.d.ts.map +1 -1
  347. package/dist/types/api-handler/handlers/translatable-data.d.ts +1 -1
  348. package/dist/types/api-handler/handlers/translatable-data.d.ts.map +1 -1
  349. package/dist/types/api-handler/handlers/webhook/types.d.ts +4 -4
  350. package/dist/types/builder/host-to-builder-actions.d.ts +2 -2
  351. package/dist/types/builder/host-to-builder-actions.d.ts.map +1 -1
  352. package/dist/types/builder/index.d.ts +2 -2
  353. package/dist/types/builder/index.d.ts.map +1 -1
  354. package/dist/types/client/index.d.ts +2 -2
  355. package/dist/types/client/index.d.ts.map +1 -1
  356. package/dist/types/components/builtin/Box/Box.d.ts +1 -1
  357. package/dist/types/components/builtin/Box/Box.d.ts.map +1 -1
  358. package/dist/types/components/builtin/Form/Form.d.ts +1 -1
  359. package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
  360. package/dist/types/locale.d.ts +1 -1
  361. package/dist/types/next/components/tests/controls/color-control/fixtures.d.ts +1 -1
  362. package/dist/types/next/components/tests/controls/color-control/fixtures.d.ts.map +1 -1
  363. package/dist/types/next/components/tests/controls/page-control-prop-rendering.d.ts +3 -3
  364. package/dist/types/next/components/tests/controls/page-control-prop-rendering.d.ts.map +1 -1
  365. package/dist/types/next/components/tests/controls/rich-text-v2-control/fixtures.d.ts +1 -1
  366. package/dist/types/next/components/tests/controls/rich-text-v2-control/fixtures.d.ts.map +1 -1
  367. package/dist/types/next/components/tests/makeswift-component/fixtures.d.ts +1 -1
  368. package/dist/types/next/components/tests/makeswift-component/fixtures.d.ts.map +1 -1
  369. package/dist/types/next/components/tests/prop-controllers/page-prop-controller.d.ts +1 -1
  370. package/dist/types/next/components/tests/prop-controllers/page-prop-controller.d.ts.map +1 -1
  371. package/dist/types/next/testing/element-data.d.ts +1 -1
  372. package/dist/types/next/testing/element-data.d.ts.map +1 -1
  373. package/dist/types/next/testing/index.d.ts +1 -0
  374. package/dist/types/next/testing/index.d.ts.map +1 -1
  375. package/dist/types/next/testing/page-rendering.d.ts.map +1 -1
  376. package/dist/types/next/testing/react-runtime.d.ts +2 -0
  377. package/dist/types/next/testing/react-runtime.d.ts.map +1 -0
  378. package/dist/types/prop-controllers/descriptors.d.ts +1 -1
  379. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
  380. package/dist/types/prop-controllers/instances.d.ts +1 -1
  381. package/dist/types/prop-controllers/instances.d.ts.map +1 -1
  382. package/dist/types/runtimes/react/components/Document.d.ts +1 -1
  383. package/dist/types/runtimes/react/components/Document.d.ts.map +1 -1
  384. package/dist/types/runtimes/react/components/DocumentRoot.d.ts +1 -1
  385. package/dist/types/runtimes/react/components/DocumentRoot.d.ts.map +1 -1
  386. package/dist/types/runtimes/react/components/Element.d.ts +1 -1
  387. package/dist/types/runtimes/react/components/Element.d.ts.map +1 -1
  388. package/dist/types/runtimes/react/components/ElementData.d.ts +1 -1
  389. package/dist/types/runtimes/react/components/ElementData.d.ts.map +1 -1
  390. package/dist/types/runtimes/react/components/ElementReference.d.ts +1 -1
  391. package/dist/types/runtimes/react/components/ElementReference.d.ts.map +1 -1
  392. package/dist/types/runtimes/react/components/RuntimeProvider.d.ts +1 -1
  393. package/dist/types/runtimes/react/components/RuntimeProvider.d.ts.map +1 -1
  394. package/dist/types/runtimes/react/components/page/Page.d.ts +1 -1
  395. package/dist/types/runtimes/react/components/page/Page.d.ts.map +1 -1
  396. package/dist/types/runtimes/react/controls.d.ts +2 -2
  397. package/dist/types/runtimes/react/controls.d.ts.map +1 -1
  398. package/dist/types/runtimes/react/element-imperative-handle.d.ts +1 -1
  399. package/dist/types/runtimes/react/element-imperative-handle.d.ts.map +1 -1
  400. package/dist/types/runtimes/react/hooks/use-cache-data.d.ts +1 -1
  401. package/dist/types/runtimes/react/hooks/use-cache-data.d.ts.map +1 -1
  402. package/dist/types/runtimes/react/hooks/use-component.d.ts +1 -1
  403. package/dist/types/runtimes/react/hooks/use-component.d.ts.map +1 -1
  404. package/dist/types/runtimes/react/hooks/use-dispatch.d.ts +3 -3
  405. package/dist/types/runtimes/react/hooks/use-dispatch.d.ts.map +1 -1
  406. package/dist/types/runtimes/react/hooks/use-document.d.ts +1 -1
  407. package/dist/types/runtimes/react/hooks/use-document.d.ts.map +1 -1
  408. package/dist/types/runtimes/react/hooks/use-is-read-only.d.ts +2 -0
  409. package/dist/types/runtimes/react/hooks/use-is-read-only.d.ts.map +1 -0
  410. package/dist/types/runtimes/react/hooks/use-register-document.d.ts +1 -1
  411. package/dist/types/runtimes/react/hooks/use-register-document.d.ts.map +1 -1
  412. package/dist/types/runtimes/react/hooks/use-selector.d.ts +3 -3
  413. package/dist/types/runtimes/react/hooks/use-selector.d.ts.map +1 -1
  414. package/dist/types/runtimes/react/hooks/use-store.d.ts +4 -4
  415. package/dist/types/runtimes/react/hooks/use-store.d.ts.map +1 -1
  416. package/dist/types/runtimes/react/hooks/use-universal-dispatch.d.ts +1 -1
  417. package/dist/types/runtimes/react/hooks/use-universal-dispatch.d.ts.map +1 -1
  418. package/dist/types/runtimes/react/host-api-client.d.ts +1 -1
  419. package/dist/types/runtimes/react/host-api-client.d.ts.map +1 -1
  420. package/dist/types/runtimes/react/index.d.ts +1 -1
  421. package/dist/types/runtimes/react/index.d.ts.map +1 -1
  422. package/dist/types/runtimes/react/poll-box-model.d.ts +1 -1
  423. package/dist/types/runtimes/react/poll-box-model.d.ts.map +1 -1
  424. package/dist/types/runtimes/react/react-runtime-core.d.ts +1 -1
  425. package/dist/types/runtimes/react/react-runtime-core.d.ts.map +1 -1
  426. package/dist/types/runtimes/react/runtime-core.d.ts +2 -1
  427. package/dist/types/runtimes/react/runtime-core.d.ts.map +1 -1
  428. package/dist/types/runtimes/react/testing/react-runtime.d.ts +3 -0
  429. package/dist/types/runtimes/react/testing/react-runtime.d.ts.map +1 -0
  430. package/dist/types/runtimes/react/utils/can-accept-ref.d.ts +1 -1
  431. package/dist/types/runtimes/react/utils/can-accept-ref.d.ts.map +1 -1
  432. package/dist/types/state/__tests__/merge-element.test.d.ts +2 -0
  433. package/dist/types/state/__tests__/merge-element.test.d.ts.map +1 -0
  434. package/dist/types/state/actions/index.d.ts +6 -5
  435. package/dist/types/state/actions/index.d.ts.map +1 -1
  436. package/dist/types/state/actions/internal/index.d.ts +25 -0
  437. package/dist/types/state/actions/internal/index.d.ts.map +1 -0
  438. package/dist/types/state/actions/{internal.d.ts → internal/read-only-actions.d.ts} +33 -67
  439. package/dist/types/state/actions/internal/read-only-actions.d.ts.map +1 -0
  440. package/dist/types/state/actions/internal/read-write-actions.d.ts +48 -0
  441. package/dist/types/state/actions/internal/read-write-actions.d.ts.map +1 -0
  442. package/dist/types/state/builder-api/actions.d.ts +14 -14
  443. package/dist/types/state/builder-api/actions.d.ts.map +1 -1
  444. package/dist/types/state/host-api.d.ts +1 -1
  445. package/dist/types/state/host-api.d.ts.map +1 -1
  446. package/dist/types/state/middleware/prop-controller-handles.d.ts +4 -0
  447. package/dist/types/state/middleware/prop-controller-handles.d.ts.map +1 -0
  448. package/dist/types/state/middleware/read-only-element-tree.d.ts +4 -0
  449. package/dist/types/state/middleware/read-only-element-tree.d.ts.map +1 -0
  450. package/dist/types/state/middleware/read-write/builder-api/element-size.d.ts +12 -0
  451. package/dist/types/state/middleware/read-write/builder-api/element-size.d.ts.map +1 -0
  452. package/dist/types/state/middleware/read-write/builder-api/index.d.ts +5 -0
  453. package/dist/types/state/middleware/read-write/builder-api/index.d.ts.map +1 -0
  454. package/dist/types/state/middleware/read-write/builder-api/initialize-connection.d.ts +6 -0
  455. package/dist/types/state/middleware/read-write/builder-api/initialize-connection.d.ts.map +1 -0
  456. package/dist/types/state/middleware/read-write/makeswift-api-client-sync.d.ts +5 -0
  457. package/dist/types/state/middleware/read-write/makeswift-api-client-sync.d.ts.map +1 -0
  458. package/dist/types/state/middleware/read-write/measure-box-models.d.ts +4 -0
  459. package/dist/types/state/middleware/read-write/measure-box-models.d.ts.map +1 -0
  460. package/dist/types/state/middleware/read-write/update-element-tree.d.ts +4 -0
  461. package/dist/types/state/middleware/read-write/update-element-tree.d.ts.map +1 -0
  462. package/dist/types/state/modules/api-resources.d.ts.map +1 -1
  463. package/dist/types/state/modules/breakpoints.d.ts.map +1 -1
  464. package/dist/types/state/modules/builder-edit-mode.d.ts.map +1 -1
  465. package/dist/types/state/modules/components-meta.d.ts.map +1 -1
  466. package/dist/types/state/modules/element-trees.d.ts.map +1 -1
  467. package/dist/types/state/modules/is-in-builder.d.ts.map +1 -1
  468. package/dist/types/state/modules/{is-preview.d.ts → is-read-only.d.ts} +3 -3
  469. package/dist/types/state/modules/is-read-only.d.ts.map +1 -0
  470. package/dist/types/state/modules/localized-resources-map.d.ts.map +1 -1
  471. package/dist/types/state/modules/prop-controllers.d.ts.map +1 -1
  472. package/dist/types/state/modules/react-components.d.ts.map +1 -1
  473. package/dist/types/state/modules/read-only-documents.d.ts.map +1 -1
  474. package/dist/types/state/modules/{box-models.d.ts → read-write/box-models.d.ts} +1 -1
  475. package/dist/types/state/modules/read-write/box-models.d.ts.map +1 -0
  476. package/dist/types/state/modules/read-write/element-imperative-handles.d.ts +6 -0
  477. package/dist/types/state/modules/read-write/element-imperative-handles.d.ts.map +1 -0
  478. package/dist/types/state/modules/{pointer.d.ts → read-write/pointer.d.ts} +2 -3
  479. package/dist/types/state/modules/read-write/pointer.d.ts.map +1 -0
  480. package/dist/types/state/modules/{read-write-documents.d.ts → read-write/read-write-documents.d.ts} +4 -4
  481. package/dist/types/state/modules/read-write/read-write-documents.d.ts.map +1 -0
  482. package/dist/types/state/ops/copy-element-tree.d.ts +37 -0
  483. package/dist/types/state/ops/copy-element-tree.d.ts.map +1 -0
  484. package/dist/types/state/ops/merge-element.d.ts +4 -0
  485. package/dist/types/state/ops/merge-element.d.ts.map +1 -0
  486. package/dist/types/state/react-builder-preview.d.ts +26 -93
  487. package/dist/types/state/react-builder-preview.d.ts.map +1 -1
  488. package/dist/types/state/react-page.d.ts +20 -136
  489. package/dist/types/state/react-page.d.ts.map +1 -1
  490. package/dist/types/state/read-only-state.d.ts +122 -0
  491. package/dist/types/state/read-only-state.d.ts.map +1 -0
  492. package/dist/types/state/read-write-state.d.ts +56 -0
  493. package/dist/types/state/read-write-state.d.ts.map +1 -0
  494. package/dist/types/state/shared-api.d.ts.map +1 -1
  495. package/dist/types/state/translations/get.d.ts +1 -1
  496. package/dist/types/state/translations/get.d.ts.map +1 -1
  497. package/dist/types/state/translations/merge.d.ts +1 -1
  498. package/dist/types/state/translations/merge.d.ts.map +1 -1
  499. package/package.json +1 -1
  500. package/dist/cjs/api/react.js.map +0 -1
  501. package/dist/cjs/runtimes/react/hooks/use-is-preview.js.map +0 -1
  502. package/dist/cjs/state/actions/internal.js.map +0 -1
  503. package/dist/cjs/state/modules/box-models.js.map +0 -1
  504. package/dist/cjs/state/modules/element-imperative-handles.js.map +0 -1
  505. package/dist/cjs/state/modules/is-preview.js.map +0 -1
  506. package/dist/cjs/state/modules/pointer.js.map +0 -1
  507. package/dist/cjs/state/modules/read-write-documents.js.map +0 -1
  508. package/dist/esm/api/react.js.map +0 -1
  509. package/dist/esm/runtimes/react/hooks/use-is-preview.js +0 -9
  510. package/dist/esm/runtimes/react/hooks/use-is-preview.js.map +0 -1
  511. package/dist/esm/state/actions/internal.js.map +0 -1
  512. package/dist/esm/state/modules/box-models.js.map +0 -1
  513. package/dist/esm/state/modules/element-imperative-handles.js.map +0 -1
  514. package/dist/esm/state/modules/is-preview.js +0 -21
  515. package/dist/esm/state/modules/is-preview.js.map +0 -1
  516. package/dist/esm/state/modules/pointer.js.map +0 -1
  517. package/dist/esm/state/modules/read-write-documents.js.map +0 -1
  518. package/dist/types/api/react.d.ts.map +0 -1
  519. package/dist/types/runtimes/react/hooks/use-is-preview.d.ts +0 -2
  520. package/dist/types/runtimes/react/hooks/use-is-preview.d.ts.map +0 -1
  521. package/dist/types/state/__tests__/react-page.test.d.ts +0 -2
  522. package/dist/types/state/__tests__/react-page.test.d.ts.map +0 -1
  523. package/dist/types/state/actions/internal.d.ts.map +0 -1
  524. package/dist/types/state/modules/box-models.d.ts.map +0 -1
  525. package/dist/types/state/modules/element-imperative-handles.d.ts +0 -7
  526. package/dist/types/state/modules/element-imperative-handles.d.ts.map +0 -1
  527. package/dist/types/state/modules/is-preview.d.ts.map +0 -1
  528. package/dist/types/state/modules/pointer.d.ts.map +0 -1
  529. package/dist/types/state/modules/read-write-documents.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-builder-edit-mode.ts"],"sourcesContent":["import { BuilderEditMode } from '../../../state/modules/builder-edit-mode'\nimport { getBuilderEditMode } from '../../../state/react-page'\nimport { useSelector } from './use-selector'\n\nexport function useBuilderEditMode(): BuilderEditMode | null {\n return useSelector(state => getBuilderEditMode(state))\n}\n"],"mappings":"AACA,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAErB,SAAS,qBAA6C;AAC3D,SAAO,YAAY,WAAS,mBAAmB,KAAK,CAAC;AACvD;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-builder-edit-mode.ts"],"sourcesContent":["import { BuilderEditMode } from '../../../state/modules/builder-edit-mode'\nimport { getBuilderEditMode } from '../../../state/read-only-state'\nimport { useSelector } from './use-selector'\n\nexport function useBuilderEditMode(): BuilderEditMode | null {\n return useSelector(state => getBuilderEditMode(state))\n}\n"],"mappings":"AACA,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAErB,SAAS,qBAA6C;AAC3D,SAAO,YAAY,WAAS,mBAAmB,KAAK,CAAC;AACvD;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from "react";
2
- import { updateAPIClientCache } from "../../../state/actions/internal";
2
+ import { updateAPIClientCache } from "../../../state/actions/internal/read-write-actions";
3
3
  import { useMakeswiftHostApiClient } from "../host-api-client";
4
4
  function useCacheData(cacheData) {
5
5
  const { makeswiftApiClient: apiStore } = useMakeswiftHostApiClient();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-cache-data.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { type CacheData } from '../../../api/react'\nimport { updateAPIClientCache } from '../../../state/actions/internal'\n\nimport { useMakeswiftHostApiClient } from '../host-api-client'\n\nexport function useCacheData(cacheData: CacheData) {\n const { makeswiftApiClient: apiStore } = useMakeswiftHostApiClient()\n\n // We perform cache hydration immediately on render - this is safe to do per\n // render because updating the API cache is idempotent. For precedence, see:\n //\n // https://github.com/TanStack/query/blob/8f9f183f11df3709a1a38c4efce1452788041f88/packages/react-query/src/HydrationBoundary.tsx#L41\n useMemo(() => apiStore.dispatch(updateAPIClientCache(cacheData)), [cacheData])\n}\n"],"mappings":"AAAA,SAAS,eAAe;AAExB,SAAS,4BAA4B;AAErC,SAAS,iCAAiC;AAEnC,SAAS,aAAa,WAAsB;AACjD,QAAM,EAAE,oBAAoB,SAAS,IAAI,0BAA0B;AAMnE,UAAQ,MAAM,SAAS,SAAS,qBAAqB,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC;AAC/E;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-cache-data.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { type CacheData } from '../../../api/client'\nimport { updateAPIClientCache } from '../../../state/actions/internal/read-write-actions'\n\nimport { useMakeswiftHostApiClient } from '../host-api-client'\n\nexport function useCacheData(cacheData: CacheData) {\n const { makeswiftApiClient: apiStore } = useMakeswiftHostApiClient()\n\n // We perform cache hydration immediately on render - this is safe to do per\n // render because updating the API cache is idempotent. For precedence, see:\n //\n // https://github.com/TanStack/query/blob/8f9f183f11df3709a1a38c4efce1452788041f88/packages/react-query/src/HydrationBoundary.tsx#L41\n useMemo(() => apiStore.dispatch(updateAPIClientCache(cacheData)), [cacheData])\n}\n"],"mappings":"AAAA,SAAS,eAAe;AAExB,SAAS,4BAA4B;AAErC,SAAS,iCAAiC;AAEnC,SAAS,aAAa,WAAsB;AACjD,QAAM,EAAE,oBAAoB,SAAS,IAAI,0BAA0B;AAMnE,UAAQ,MAAM,SAAS,SAAS,qBAAqB,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC;AAC/E;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getReactComponent,
3
3
  getComponentMeta
4
- } from "../../../state/react-page";
4
+ } from "../../../state/read-only-state";
5
5
  import { useSelector } from "./use-selector";
6
6
  function useComponent(type) {
7
7
  return useSelector((state) => getReactComponent(state, type));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-component.ts"],"sourcesContent":["import {\n type ComponentType,\n type ComponentMeta,\n getReactComponent,\n getComponentMeta,\n} from '../../../state/react-page'\nimport { useSelector } from './use-selector'\n\nexport function useComponent(type: string): ComponentType | null {\n return useSelector(state => getReactComponent(state, type))\n}\n\nexport function useComponentMeta(type: string): ComponentMeta | null {\n return useSelector(state => getComponentMeta(state, type))\n}\n"],"mappings":"AAAA;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAErB,SAAS,aAAa,MAAoC;AAC/D,SAAO,YAAY,WAAS,kBAAkB,OAAO,IAAI,CAAC;AAC5D;AAEO,SAAS,iBAAiB,MAAoC;AACnE,SAAO,YAAY,WAAS,iBAAiB,OAAO,IAAI,CAAC;AAC3D;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-component.ts"],"sourcesContent":["import {\n type ComponentType,\n type ComponentMeta,\n getReactComponent,\n getComponentMeta,\n} from '../../../state/read-only-state'\nimport { useSelector } from './use-selector'\n\nexport function useComponent(type: string): ComponentType | null {\n return useSelector(state => getReactComponent(state, type))\n}\n\nexport function useComponentMeta(type: string): ComponentMeta | null {\n return useSelector(state => getComponentMeta(state, type))\n}\n"],"mappings":"AAAA;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAErB,SAAS,aAAa,MAAoC;AAC/D,SAAO,YAAY,WAAS,kBAAkB,OAAO,IAAI,CAAC;AAC5D;AAEO,SAAS,iBAAiB,MAAoC;AACnE,SAAO,YAAY,WAAS,iBAAiB,OAAO,IAAI,CAAC;AAC3D;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-dispatch.ts"],"sourcesContent":["import { useStore } from './use-store'\nimport { Dispatch as ReactPageDispatch } from '../../../state/react-page'\nimport { Dispatch as ReactBuilderPreviewDispatch } from '../../../state/react-builder-preview'\n\ntype Dispatch = ReactPageDispatch & ReactBuilderPreviewDispatch\n\nexport function useDispatch(): Dispatch {\n const store = useStore()\n\n return store.dispatch\n}\n"],"mappings":"AAAA,SAAS,gBAAgB;AAMlB,SAAS,cAAwB;AACtC,QAAM,QAAQ,SAAS;AAEvB,SAAO,MAAM;AACf;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-dispatch.ts"],"sourcesContent":["import { useStore } from './use-store'\nimport { type Dispatch as ReadOnlyDispatch } from '../../../state/read-only-state'\nimport { type Dispatch as ReadWriteDispatch } from '../../../state/read-write-state'\n\ntype Dispatch = ReadOnlyDispatch & ReadWriteDispatch\n\nexport function useDispatch(): Dispatch {\n const store = useStore()\n\n return store.dispatch\n}\n"],"mappings":"AAAA,SAAS,gBAAgB;AAMlB,SAAS,cAAwB;AACtC,QAAM,QAAQ,SAAS;AAEvB,SAAO,MAAM;AACf;","names":[]}
@@ -1,4 +1,4 @@
1
- import { getDocument } from "../../../state/react-page";
1
+ import { getDocument } from "../../../state/read-only-state";
2
2
  import { useSelector } from "./use-selector";
3
3
  function useDocument(documentKey) {
4
4
  return useSelector((state) => getDocument(state, documentKey));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-document.ts"],"sourcesContent":["import { Document, getDocument } from '../../../state/react-page'\nimport { useSelector } from './use-selector'\n\nexport function useDocument(documentKey: string): Document | null {\n return useSelector(state => getDocument(state, documentKey))\n}\n"],"mappings":"AAAA,SAAmB,mBAAmB;AACtC,SAAS,mBAAmB;AAErB,SAAS,YAAY,aAAsC;AAChE,SAAO,YAAY,WAAS,YAAY,OAAO,WAAW,CAAC;AAC7D;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-document.ts"],"sourcesContent":["import { Document, getDocument } from '../../../state/read-only-state'\nimport { useSelector } from './use-selector'\n\nexport function useDocument(documentKey: string): Document | null {\n return useSelector(state => getDocument(state, documentKey))\n}\n"],"mappings":"AAAA,SAAmB,mBAAmB;AACtC,SAAS,mBAAmB;AAErB,SAAS,YAAY,aAAsC;AAChE,SAAO,YAAY,WAAS,YAAY,OAAO,WAAW,CAAC;AAC7D;","names":[]}
@@ -1,4 +1,4 @@
1
- import { getElementId } from "../../../state/react-page";
1
+ import { getElementId } from "../../../state/read-only-state";
2
2
  import { useDocumentKey } from "./use-document-context";
3
3
  import { useSelector } from "./use-selector";
4
4
  function useElementId(elementKey) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-element-id.ts"],"sourcesContent":["import { getElementId } from '../../../state/react-page'\nimport { useDocumentKey } from './use-document-context'\nimport { useSelector } from './use-selector'\n\nexport function useElementId(elementKey: string | null | undefined): string | null {\n const documentKey = useDocumentKey()\n\n return useSelector(state =>\n documentKey == null || elementKey == null ? null : getElementId(state, documentKey, elementKey),\n )\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAErB,SAAS,aAAa,YAAsD;AACjF,QAAM,cAAc,eAAe;AAEnC,SAAO;AAAA,IAAY,WACjB,eAAe,QAAQ,cAAc,OAAO,OAAO,aAAa,OAAO,aAAa,UAAU;AAAA,EAChG;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-element-id.ts"],"sourcesContent":["import { getElementId } from '../../../state/read-only-state'\nimport { useDocumentKey } from './use-document-context'\nimport { useSelector } from './use-selector'\n\nexport function useElementId(elementKey: string | null | undefined): string | null {\n const documentKey = useDocumentKey()\n\n return useSelector(state =>\n documentKey == null || elementKey == null ? null : getElementId(state, documentKey, elementKey),\n )\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAErB,SAAS,aAAa,YAAsD;AACjF,QAAM,cAAc,eAAe;AAEnC,SAAO;AAAA,IAAY,WACjB,eAAe,QAAQ,cAAc,OAAO,OAAO,aAAa,OAAO,aAAa,UAAU;AAAA,EAChG;AACF;","names":[]}
@@ -1,4 +1,4 @@
1
- import { getIsInBuilder } from "../../../state/react-page";
1
+ import { getIsInBuilder } from "../../../state/read-only-state";
2
2
  import { useSelector } from "./use-selector";
3
3
  function useIsInBuilder() {
4
4
  return useSelector((state) => getIsInBuilder(state));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-is-in-builder.ts"],"sourcesContent":["import { getIsInBuilder } from '../../../state/react-page'\nimport { useSelector } from './use-selector'\n\nexport function useIsInBuilder(): boolean {\n return useSelector(state => getIsInBuilder(state))\n}\n"],"mappings":"AAAA,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAErB,SAAS,iBAA0B;AACxC,SAAO,YAAY,WAAS,eAAe,KAAK,CAAC;AACnD;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-is-in-builder.ts"],"sourcesContent":["import { getIsInBuilder } from '../../../state/read-only-state'\nimport { useSelector } from './use-selector'\n\nexport function useIsInBuilder(): boolean {\n return useSelector(state => getIsInBuilder(state))\n}\n"],"mappings":"AAAA,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAErB,SAAS,iBAA0B;AACxC,SAAO,YAAY,WAAS,eAAe,KAAK,CAAC;AACnD;","names":[]}
@@ -0,0 +1,9 @@
1
+ import { getIsReadOnly } from "../../../state/read-only-state";
2
+ import { useSelector } from "./use-selector";
3
+ function useIsReadOnly() {
4
+ return useSelector((state) => getIsReadOnly(state));
5
+ }
6
+ export {
7
+ useIsReadOnly
8
+ };
9
+ //# sourceMappingURL=use-is-read-only.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-is-read-only.ts"],"sourcesContent":["import { getIsReadOnly } from '../../../state/read-only-state'\nimport { useSelector } from './use-selector'\n\nexport function useIsReadOnly(): boolean {\n return useSelector(state => getIsReadOnly(state))\n}\n"],"mappings":"AAAA,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAErB,SAAS,gBAAyB;AACvC,SAAO,YAAY,WAAS,cAAc,KAAK,CAAC;AAClD;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-register-document.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { type Document } from '../../../state/react-page'\nimport { useDispatch } from './use-dispatch'\nimport { useIsInBuilder } from './use-is-in-builder'\nimport { registerDocument, registerDocumentsEffect } from '../../../state/shared-api'\nimport { registerBuilderDocumentsEffect } from '../../../state/builder-api/actions'\n\nimport { isServer } from '../../../utils/is-server'\nimport { useIsomorphicLayoutEffect } from '../../../components/hooks/useIsomorphicLayoutEffect'\n\n/**\n * @param document Document to register\n */\nexport function useRegisterDocument(document: Document): void {\n const isInBuilder = useIsInBuilder()\n const dispatch = useDispatch()\n\n if (isServer()) {\n dispatch(registerDocument(document))\n }\n\n /*\n Layout effect is to ensure that the document registration happens prior to the\n attempted creation/registration of prop controllers in child components.\n */\n useIsomorphicLayoutEffect(() => {\n return dispatch(registerDocumentsEffect([document]))\n }, [dispatch, document])\n\n // TODO: Decide whether to do this via middleware or via explicit action (like\n // what we're doing below)\n useEffect(() => {\n if (!isInBuilder) return\n return dispatch(registerBuilderDocumentsEffect([document]))\n }, [isInBuilder, document])\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAE1B,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB,+BAA+B;AAC1D,SAAS,sCAAsC;AAE/C,SAAS,gBAAgB;AACzB,SAAS,iCAAiC;AAKnC,SAAS,oBAAoB,UAA0B;AAC5D,QAAM,cAAc,eAAe;AACnC,QAAM,WAAW,YAAY;AAE7B,MAAI,SAAS,GAAG;AACd,aAAS,iBAAiB,QAAQ,CAAC;AAAA,EACrC;AAMA,4BAA0B,MAAM;AAC9B,WAAO,SAAS,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AAAA,EACrD,GAAG,CAAC,UAAU,QAAQ,CAAC;AAIvB,YAAU,MAAM;AACd,QAAI,CAAC;AAAa;AAClB,WAAO,SAAS,+BAA+B,CAAC,QAAQ,CAAC,CAAC;AAAA,EAC5D,GAAG,CAAC,aAAa,QAAQ,CAAC;AAC5B;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-register-document.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { type Document } from '../../../state/read-only-state'\nimport { useDispatch } from './use-dispatch'\nimport { useIsInBuilder } from './use-is-in-builder'\nimport { registerDocument, registerDocumentsEffect } from '../../../state/shared-api'\nimport { registerBuilderDocumentsEffect } from '../../../state/builder-api/actions'\n\nimport { isServer } from '../../../utils/is-server'\nimport { useIsomorphicLayoutEffect } from '../../../components/hooks/useIsomorphicLayoutEffect'\n\n/**\n * @param document Document to register\n */\nexport function useRegisterDocument(document: Document): void {\n const isInBuilder = useIsInBuilder()\n const dispatch = useDispatch()\n\n if (isServer()) {\n dispatch(registerDocument(document))\n }\n\n /*\n Layout effect is to ensure that the document registration happens prior to the\n attempted creation/registration of prop controllers in child components.\n */\n useIsomorphicLayoutEffect(() => {\n return dispatch(registerDocumentsEffect([document]))\n }, [dispatch, document])\n\n // TODO: Decide whether to do this via middleware or via explicit action (like\n // what we're doing below)\n useEffect(() => {\n if (!isInBuilder) return\n return dispatch(registerBuilderDocumentsEffect([document]))\n }, [isInBuilder, document])\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAE1B,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB,+BAA+B;AAC1D,SAAS,sCAAsC;AAE/C,SAAS,gBAAgB;AACzB,SAAS,iCAAiC;AAKnC,SAAS,oBAAoB,UAA0B;AAC5D,QAAM,cAAc,eAAe;AACnC,QAAM,WAAW,YAAY;AAE7B,MAAI,SAAS,GAAG;AACd,aAAS,iBAAiB,QAAQ,CAAC;AAAA,EACrC;AAMA,4BAA0B,MAAM;AAC9B,WAAO,SAAS,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AAAA,EACrD,GAAG,CAAC,UAAU,QAAQ,CAAC;AAIvB,YAAU,MAAM;AACd,QAAI,CAAC;AAAa;AAClB,WAAO,SAAS,+BAA+B,CAAC,QAAQ,CAAC,CAAC;AAAA,EAC5D,GAAG,CAAC,aAAa,QAAQ,CAAC;AAC5B;","names":[]}
@@ -2,7 +2,7 @@ import { useMemo, useEffect, useRef, useSyncExternalStore, useCallback } from "r
2
2
  import {
3
3
  mapValues
4
4
  } from "@makeswift/controls";
5
- import * as ReactPage from "../../../state/react-page";
5
+ import * as ReactPage from "../../../state/read-only-state";
6
6
  import { useResourceResolver } from "./use-resource-resolver";
7
7
  import { useDocumentKey } from "./use-document-context";
8
8
  import { useSelector } from "./use-selector";
@@ -14,7 +14,7 @@ function useControlInstances(elementKey) {
14
14
  return useSelector((state) => {
15
15
  if (documentKey == null)
16
16
  return null;
17
- return ReactPage.getPropControllers(state, documentKey, elementKey);
17
+ return ReactPage.getPropControllers(state, { documentKey, elementKey });
18
18
  });
19
19
  }
20
20
  function useResolvedProps(propDefs, elementData, elementKey) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-resolved-props.ts"],"sourcesContent":["import { useMemo, useEffect, useRef, useSyncExternalStore, useCallback } from 'react'\nimport {\n ControlDefinition,\n ControlInstance,\n mapValues,\n type Data,\n type Resolvable,\n} from '@makeswift/controls'\n\nimport * as ReactPage from '../../../state/react-page'\nimport { useResourceResolver } from './use-resource-resolver'\nimport { useDocumentKey } from './use-document-context'\nimport { useSelector } from './use-selector'\n\nimport { useStylesheetFactory } from './use-stylesheet-factory'\n\nimport { useResolvableRecord } from './use-resolvable-record'\nimport { propErrorHandlingProxy } from '../utils/prop-error-handling-proxy'\n\nfunction useControlInstances(elementKey: string): Record<string, ControlInstance> | null {\n const documentKey = useDocumentKey()\n\n return useSelector(state => {\n if (documentKey == null) return null\n\n return ReactPage.getPropControllers(state, documentKey, elementKey)\n })\n}\n\ntype CacheItem = {\n data: Data\n control: ControlInstance | undefined\n resolvedValue: Resolvable<unknown>\n}\n\nexport function useResolvedProps(\n propDefs: Record<string, ControlDefinition>,\n elementData: Record<string, Data>,\n elementKey: string,\n): Record<string, unknown> {\n const stylesheetFactory = useStylesheetFactory()\n const resourceResolver = useResourceResolver()\n const controls = useControlInstances(elementKey)\n\n const cache = useRef<Record<string, CacheItem>>({}).current\n const resolveProp = useCallback(\n (def: ControlDefinition, propName: string) => {\n const data = elementData[propName]\n const control = controls?.[propName]\n\n if (\n cache[propName] != null &&\n data === cache[propName].data &&\n control === cache[propName].control\n ) {\n return cache[propName].resolvedValue\n }\n\n const resolvedValue = def.resolveValue(\n data,\n resourceResolver,\n stylesheetFactory.get(propName),\n control,\n )\n\n cache[propName] = { data, control, resolvedValue }\n return resolvedValue\n },\n [controls, elementData, resourceResolver, stylesheetFactory],\n )\n\n const resolvables = useMemo<Record<string, Resolvable<unknown>>>(\n () =>\n mapValues(propDefs, (def, propName) => {\n const defaultValue = (def.config as any)?.defaultValue\n return propErrorHandlingProxy(resolveProp(def, propName), defaultValue, error => {\n console.warn(\n `Error reading value for prop \"${propName}\", falling back to \\`${defaultValue}\\`.`,\n { control: def, error },\n )\n })\n }),\n [propDefs, resolveProp],\n )\n\n const props = useResolvableRecord(resolvables)\n\n // no need to call `triggerResolve` on the server, all the resources should already be in\n // the host API client's cache (populated from the snapshot's cache)\n useEffect(() => {\n props.triggerResolve()\n }, [props])\n\n // the order is important here, the styles are defined in the process of the props resolution,\n // calling `useDefinedStyles` before the props are resolved would effectively be a noop\n const resolvedProps = useSyncExternalStore(props.subscribe, props.readStable, props.readStable)\n\n stylesheetFactory.useDefinedStyles()\n\n return resolvedProps\n}\n"],"mappings":"AAAA,SAAS,SAAS,WAAW,QAAQ,sBAAsB,mBAAmB;AAC9E;AAAA,EAGE;AAAA,OAGK;AAEP,YAAY,eAAe;AAC3B,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAE5B,SAAS,4BAA4B;AAErC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AAEvC,SAAS,oBAAoB,YAA4D;AACvF,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY,WAAS;AAC1B,QAAI,eAAe;AAAM,aAAO;AAEhC,WAAO,UAAU,mBAAmB,OAAO,aAAa,UAAU;AAAA,EACpE,CAAC;AACH;AAQO,SAAS,iBACd,UACA,aACA,YACyB;AACzB,QAAM,oBAAoB,qBAAqB;AAC/C,QAAM,mBAAmB,oBAAoB;AAC7C,QAAM,WAAW,oBAAoB,UAAU;AAE/C,QAAM,QAAQ,OAAkC,CAAC,CAAC,EAAE;AACpD,QAAM,cAAc;AAAA,IAClB,CAAC,KAAwB,aAAqB;AAC5C,YAAM,OAAO,YAAY,QAAQ;AACjC,YAAM,UAAU,WAAW,QAAQ;AAEnC,UACE,MAAM,QAAQ,KAAK,QACnB,SAAS,MAAM,QAAQ,EAAE,QACzB,YAAY,MAAM,QAAQ,EAAE,SAC5B;AACA,eAAO,MAAM,QAAQ,EAAE;AAAA,MACzB;AAEA,YAAM,gBAAgB,IAAI;AAAA,QACxB;AAAA,QACA;AAAA,QACA,kBAAkB,IAAI,QAAQ;AAAA,QAC9B;AAAA,MACF;AAEA,YAAM,QAAQ,IAAI,EAAE,MAAM,SAAS,cAAc;AACjD,aAAO;AAAA,IACT;AAAA,IACA,CAAC,UAAU,aAAa,kBAAkB,iBAAiB;AAAA,EAC7D;AAEA,QAAM,cAAc;AAAA,IAClB,MACE,UAAU,UAAU,CAAC,KAAK,aAAa;AACrC,YAAM,eAAgB,IAAI,QAAgB;AAC1C,aAAO,uBAAuB,YAAY,KAAK,QAAQ,GAAG,cAAc,WAAS;AAC/E,gBAAQ;AAAA,UACN,iCAAiC,QAAQ,wBAAwB,YAAY;AAAA,UAC7E,EAAE,SAAS,KAAK,MAAM;AAAA,QACxB;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,IACH,CAAC,UAAU,WAAW;AAAA,EACxB;AAEA,QAAM,QAAQ,oBAAoB,WAAW;AAI7C,YAAU,MAAM;AACd,UAAM,eAAe;AAAA,EACvB,GAAG,CAAC,KAAK,CAAC;AAIV,QAAM,gBAAgB,qBAAqB,MAAM,WAAW,MAAM,YAAY,MAAM,UAAU;AAE9F,oBAAkB,iBAAiB;AAEnC,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-resolved-props.ts"],"sourcesContent":["import { useMemo, useEffect, useRef, useSyncExternalStore, useCallback } from 'react'\nimport {\n ControlDefinition,\n ControlInstance,\n mapValues,\n type Data,\n type Resolvable,\n} from '@makeswift/controls'\n\nimport * as ReactPage from '../../../state/read-only-state'\nimport { useResourceResolver } from './use-resource-resolver'\nimport { useDocumentKey } from './use-document-context'\nimport { useSelector } from './use-selector'\n\nimport { useStylesheetFactory } from './use-stylesheet-factory'\n\nimport { useResolvableRecord } from './use-resolvable-record'\nimport { propErrorHandlingProxy } from '../utils/prop-error-handling-proxy'\n\nfunction useControlInstances(elementKey: string): Record<string, ControlInstance> | null {\n const documentKey = useDocumentKey()\n\n return useSelector(state => {\n if (documentKey == null) return null\n\n return ReactPage.getPropControllers(state, { documentKey, elementKey })\n })\n}\n\ntype CacheItem = {\n data: Data\n control: ControlInstance | undefined\n resolvedValue: Resolvable<unknown>\n}\n\nexport function useResolvedProps(\n propDefs: Record<string, ControlDefinition>,\n elementData: Record<string, Data>,\n elementKey: string,\n): Record<string, unknown> {\n const stylesheetFactory = useStylesheetFactory()\n const resourceResolver = useResourceResolver()\n const controls = useControlInstances(elementKey)\n\n const cache = useRef<Record<string, CacheItem>>({}).current\n const resolveProp = useCallback(\n (def: ControlDefinition, propName: string) => {\n const data = elementData[propName]\n const control = controls?.[propName]\n\n if (\n cache[propName] != null &&\n data === cache[propName].data &&\n control === cache[propName].control\n ) {\n return cache[propName].resolvedValue\n }\n\n const resolvedValue = def.resolveValue(\n data,\n resourceResolver,\n stylesheetFactory.get(propName),\n control,\n )\n\n cache[propName] = { data, control, resolvedValue }\n return resolvedValue\n },\n [controls, elementData, resourceResolver, stylesheetFactory],\n )\n\n const resolvables = useMemo<Record<string, Resolvable<unknown>>>(\n () =>\n mapValues(propDefs, (def, propName) => {\n const defaultValue = (def.config as any)?.defaultValue\n return propErrorHandlingProxy(resolveProp(def, propName), defaultValue, error => {\n console.warn(\n `Error reading value for prop \"${propName}\", falling back to \\`${defaultValue}\\`.`,\n { control: def, error },\n )\n })\n }),\n [propDefs, resolveProp],\n )\n\n const props = useResolvableRecord(resolvables)\n\n // no need to call `triggerResolve` on the server, all the resources should already be in\n // the host API client's cache (populated from the snapshot's cache)\n useEffect(() => {\n props.triggerResolve()\n }, [props])\n\n // the order is important here, the styles are defined in the process of the props resolution,\n // calling `useDefinedStyles` before the props are resolved would effectively be a noop\n const resolvedProps = useSyncExternalStore(props.subscribe, props.readStable, props.readStable)\n\n stylesheetFactory.useDefinedStyles()\n\n return resolvedProps\n}\n"],"mappings":"AAAA,SAAS,SAAS,WAAW,QAAQ,sBAAsB,mBAAmB;AAC9E;AAAA,EAGE;AAAA,OAGK;AAEP,YAAY,eAAe;AAC3B,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAE5B,SAAS,4BAA4B;AAErC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AAEvC,SAAS,oBAAoB,YAA4D;AACvF,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY,WAAS;AAC1B,QAAI,eAAe;AAAM,aAAO;AAEhC,WAAO,UAAU,mBAAmB,OAAO,EAAE,aAAa,WAAW,CAAC;AAAA,EACxE,CAAC;AACH;AAQO,SAAS,iBACd,UACA,aACA,YACyB;AACzB,QAAM,oBAAoB,qBAAqB;AAC/C,QAAM,mBAAmB,oBAAoB;AAC7C,QAAM,WAAW,oBAAoB,UAAU;AAE/C,QAAM,QAAQ,OAAkC,CAAC,CAAC,EAAE;AACpD,QAAM,cAAc;AAAA,IAClB,CAAC,KAAwB,aAAqB;AAC5C,YAAM,OAAO,YAAY,QAAQ;AACjC,YAAM,UAAU,WAAW,QAAQ;AAEnC,UACE,MAAM,QAAQ,KAAK,QACnB,SAAS,MAAM,QAAQ,EAAE,QACzB,YAAY,MAAM,QAAQ,EAAE,SAC5B;AACA,eAAO,MAAM,QAAQ,EAAE;AAAA,MACzB;AAEA,YAAM,gBAAgB,IAAI;AAAA,QACxB;AAAA,QACA;AAAA,QACA,kBAAkB,IAAI,QAAQ;AAAA,QAC9B;AAAA,MACF;AAEA,YAAM,QAAQ,IAAI,EAAE,MAAM,SAAS,cAAc;AACjD,aAAO;AAAA,IACT;AAAA,IACA,CAAC,UAAU,aAAa,kBAAkB,iBAAiB;AAAA,EAC7D;AAEA,QAAM,cAAc;AAAA,IAClB,MACE,UAAU,UAAU,CAAC,KAAK,aAAa;AACrC,YAAM,eAAgB,IAAI,QAAgB;AAC1C,aAAO,uBAAuB,YAAY,KAAK,QAAQ,GAAG,cAAc,WAAS;AAC/E,gBAAQ;AAAA,UACN,iCAAiC,QAAQ,wBAAwB,YAAY;AAAA,UAC7E,EAAE,SAAS,KAAK,MAAM;AAAA,QACxB;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,IACH,CAAC,UAAU,WAAW;AAAA,EACxB;AAEA,QAAM,QAAQ,oBAAoB,WAAW;AAI7C,YAAU,MAAM;AACd,UAAM,eAAe;AAAA,EACvB,GAAG,CAAC,KAAK,CAAC;AAIV,QAAM,gBAAgB,qBAAqB,MAAM,WAAW,MAAM,YAAY,MAAM,UAAU;AAE9F,oBAAkB,iBAAiB;AAEnC,SAAO;AACT;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from "react";
2
- import * as ReactPage from "../../../state/react-page";
2
+ import * as ReactPage from "../../../state/read-only-state";
3
3
  import { useMakeswiftHostApiClient } from "../host-api-client";
4
4
  import { useStore } from "./use-store";
5
5
  import { useDocumentKey, useDocumentLocale } from "./use-document-context";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-resource-resolver.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { type ResourceResolver } from '@makeswift/controls'\n\nimport * as ReactPage from '../../../state/react-page'\nimport { useMakeswiftHostApiClient } from '../host-api-client'\nimport { useStore } from './use-store'\nimport { useDocumentKey, useDocumentLocale } from './use-document-context'\n\nexport function useResourceResolver(): ResourceResolver {\n const store = useStore()\n const client = useMakeswiftHostApiClient()\n\n const documentKey = useDocumentKey()\n const locale = useDocumentLocale()\n\n return useMemo<ResourceResolver>(() => {\n return {\n resolveSwatch: swatchId => client.resolveSwatch(swatchId),\n resolveFile: fileId => client.resolveFile(fileId),\n resolveTypography: typographyId => client.resolveTypography(typographyId),\n resolvePagePathnameSlice: pageId => client.resolvePagePathnameSlice({ pageId, locale }),\n resolveElementId: elementKey => {\n const read = () =>\n documentKey == null\n ? null\n : ReactPage.getElementId(store.getState(), documentKey, elementKey)\n\n let lastValue: string | null = null\n return {\n name: `element-id:${documentKey}:${elementKey}`,\n readStable: () => (lastValue = read()),\n subscribe: (onUpdate: () => void) =>\n store.subscribe(() => {\n if (read() !== lastValue) onUpdate()\n }),\n }\n },\n }\n }, [client, store, documentKey, locale])\n}\n"],"mappings":"AAAA,SAAS,eAAe;AAGxB,YAAY,eAAe;AAC3B,SAAS,iCAAiC;AAC1C,SAAS,gBAAgB;AACzB,SAAS,gBAAgB,yBAAyB;AAE3C,SAAS,sBAAwC;AACtD,QAAM,QAAQ,SAAS;AACvB,QAAM,SAAS,0BAA0B;AAEzC,QAAM,cAAc,eAAe;AACnC,QAAM,SAAS,kBAAkB;AAEjC,SAAO,QAA0B,MAAM;AACrC,WAAO;AAAA,MACL,eAAe,cAAY,OAAO,cAAc,QAAQ;AAAA,MACxD,aAAa,YAAU,OAAO,YAAY,MAAM;AAAA,MAChD,mBAAmB,kBAAgB,OAAO,kBAAkB,YAAY;AAAA,MACxE,0BAA0B,YAAU,OAAO,yBAAyB,EAAE,QAAQ,OAAO,CAAC;AAAA,MACtF,kBAAkB,gBAAc;AAC9B,cAAM,OAAO,MACX,eAAe,OACX,OACA,UAAU,aAAa,MAAM,SAAS,GAAG,aAAa,UAAU;AAEtE,YAAI,YAA2B;AAC/B,eAAO;AAAA,UACL,MAAM,cAAc,WAAW,IAAI,UAAU;AAAA,UAC7C,YAAY,MAAO,YAAY,KAAK;AAAA,UACpC,WAAW,CAAC,aACV,MAAM,UAAU,MAAM;AACpB,gBAAI,KAAK,MAAM;AAAW,uBAAS;AAAA,UACrC,CAAC;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,OAAO,aAAa,MAAM,CAAC;AACzC;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-resource-resolver.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { type ResourceResolver } from '@makeswift/controls'\n\nimport * as ReactPage from '../../../state/read-only-state'\nimport { useMakeswiftHostApiClient } from '../host-api-client'\nimport { useStore } from './use-store'\nimport { useDocumentKey, useDocumentLocale } from './use-document-context'\n\nexport function useResourceResolver(): ResourceResolver {\n const store = useStore()\n const client = useMakeswiftHostApiClient()\n\n const documentKey = useDocumentKey()\n const locale = useDocumentLocale()\n\n return useMemo<ResourceResolver>(() => {\n return {\n resolveSwatch: swatchId => client.resolveSwatch(swatchId),\n resolveFile: fileId => client.resolveFile(fileId),\n resolveTypography: typographyId => client.resolveTypography(typographyId),\n resolvePagePathnameSlice: pageId => client.resolvePagePathnameSlice({ pageId, locale }),\n resolveElementId: elementKey => {\n const read = () =>\n documentKey == null\n ? null\n : ReactPage.getElementId(store.getState(), documentKey, elementKey)\n\n let lastValue: string | null = null\n return {\n name: `element-id:${documentKey}:${elementKey}`,\n readStable: () => (lastValue = read()),\n subscribe: (onUpdate: () => void) =>\n store.subscribe(() => {\n if (read() !== lastValue) onUpdate()\n }),\n }\n },\n }\n }, [client, store, documentKey, locale])\n}\n"],"mappings":"AAAA,SAAS,eAAe;AAGxB,YAAY,eAAe;AAC3B,SAAS,iCAAiC;AAC1C,SAAS,gBAAgB;AACzB,SAAS,gBAAgB,yBAAyB;AAE3C,SAAS,sBAAwC;AACtD,QAAM,QAAQ,SAAS;AACvB,QAAM,SAAS,0BAA0B;AAEzC,QAAM,cAAc,eAAe;AACnC,QAAM,SAAS,kBAAkB;AAEjC,SAAO,QAA0B,MAAM;AACrC,WAAO;AAAA,MACL,eAAe,cAAY,OAAO,cAAc,QAAQ;AAAA,MACxD,aAAa,YAAU,OAAO,YAAY,MAAM;AAAA,MAChD,mBAAmB,kBAAgB,OAAO,kBAAkB,YAAY;AAAA,MACxE,0BAA0B,YAAU,OAAO,yBAAyB,EAAE,QAAQ,OAAO,CAAC;AAAA,MACtF,kBAAkB,gBAAc;AAC9B,cAAM,OAAO,MACX,eAAe,OACX,OACA,UAAU,aAAa,MAAM,SAAS,GAAG,aAAa,UAAU;AAEtE,YAAI,YAA2B;AAC/B,eAAO;AAAA,UACL,MAAM,cAAc,WAAW,IAAI,UAAU;AAAA,UAC7C,YAAY,MAAO,YAAY,KAAK;AAAA,UACpC,WAAW,CAAC,aACV,MAAM,UAAU,MAAM;AACpB,gBAAI,KAAK,MAAM;AAAW,uBAAS;AAAA,UACrC,CAAC;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,OAAO,aAAa,MAAM,CAAC;AACzC;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-selector.ts"],"sourcesContent":["import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'\n\nimport { useStore } from './use-store'\nimport { State as ReactPageState } from '../../../state/react-page'\nimport { State as ReactBuilderPreviewState } from '../../../state/react-builder-preview'\n\ntype State = ReactPageState | ReactBuilderPreviewState\n\nexport function useSelector<R>(selector: (state: State) => R): R {\n const store = useStore()\n\n return useSyncExternalStoreWithSelector(store.subscribe, store.getState, store.getState, selector)\n}\n"],"mappings":"AAAA,SAAS,wCAAwC;AAEjD,SAAS,gBAAgB;AAMlB,SAAS,YAAe,UAAkC;AAC/D,QAAM,QAAQ,SAAS;AAEvB,SAAO,iCAAiC,MAAM,WAAW,MAAM,UAAU,MAAM,UAAU,QAAQ;AACnG;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-selector.ts"],"sourcesContent":["import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'\n\nimport { useStore } from './use-store'\nimport { type State as ReadOnlyState } from '../../../state/read-only-state'\nimport { type State as ReadWriteState } from '../../../state/read-write-state'\n\ntype State = ReadOnlyState | ReadWriteState\n\nexport function useSelector<R>(selector: (state: State) => R): R {\n const store = useStore()\n\n return useSyncExternalStoreWithSelector(store.subscribe, store.getState, store.getState, selector)\n}\n"],"mappings":"AAAA,SAAS,wCAAwC;AAEjD,SAAS,gBAAgB;AAMlB,SAAS,YAAe,UAAkC;AAC/D,QAAM,QAAQ,SAAS;AAEvB,SAAO,iCAAiC,MAAM,WAAW,MAAM,UAAU,MAAM,UAAU,QAAQ;AACnG;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-store.ts"],"sourcesContent":["'use client'\n\nimport { createContext, useContext } from 'react'\nimport { Store } from '../../../state/react-page'\n\nexport const StoreContext = createContext<Store | null>(null)\n\nexport function useStore(): Store {\n const store = useContext(StoreContext)\n if (store == null) {\n throw new Error('`useStore` must be used within a `StoreProvider`')\n }\n\n return store\n}\n"],"mappings":";AAEA,SAAS,eAAe,kBAAkB;AAGnC,MAAM,eAAe,cAA4B,IAAI;AAErD,SAAS,WAAkB;AAChC,QAAM,QAAQ,WAAW,YAAY;AACrC,MAAI,SAAS,MAAM;AACjB,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-store.ts"],"sourcesContent":["'use client'\n\nimport { createContext, useContext } from 'react'\nimport { type Store } from '../../../state/react-page'\n\nexport const StoreContext = createContext<Store | null>(null)\n\nexport function useStore(): Store {\n const store = useContext(StoreContext)\n if (store == null) {\n throw new Error('`useStore` must be used within a `StoreProvider`')\n }\n\n return store\n}\n"],"mappings":";AAEA,SAAS,eAAe,kBAAkB;AAGnC,MAAM,eAAe,cAA4B,IAAI;AAErD,SAAS,WAAkB;AAChC,QAAM,QAAQ,WAAW,YAAY;AACrC,MAAI,SAAS,MAAM;AACjB,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AAEA,SAAO;AACT;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-universal-dispatch.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport type { ThunkAction } from '@reduxjs/toolkit'\n\nimport { type Dispatch } from '../../../state/react-page'\nimport { type Action } from '../../../state/actions'\n\nimport { isServer } from '../../../utils/is-server'\n\n// overloaded signatures\nexport function useUniversalDispatch<Args extends any[], A extends Action>(\n dispatch: Dispatch,\n action: (...args: Args) => A,\n args: Args,\n): void\nexport function useUniversalDispatch<Args extends any[], A extends Action>(\n dispatch: Dispatch,\n action: (...args: Args) => ThunkAction<() => void, any, any, A>,\n args: Args,\n): void\n// implementation\nexport function useUniversalDispatch<Args extends any[], A extends Action>(\n dispatch: Dispatch,\n action: (...args: Args) => ThunkAction<() => void, any, any, A>,\n args: Args,\n) {\n if (isServer()) {\n dispatch(action(...args))\n }\n\n useEffect(() => {\n dispatch(action(...args))\n }, [dispatch, action, ...args])\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAM1B,SAAS,gBAAgB;AAclB,SAAS,qBACd,UACA,QACA,MACA;AACA,MAAI,SAAS,GAAG;AACd,aAAS,OAAO,GAAG,IAAI,CAAC;AAAA,EAC1B;AAEA,YAAU,MAAM;AACd,aAAS,OAAO,GAAG,IAAI,CAAC;AAAA,EAC1B,GAAG,CAAC,UAAU,QAAQ,GAAG,IAAI,CAAC;AAChC;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-universal-dispatch.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport type { ThunkAction } from '@reduxjs/toolkit'\n\nimport { type Dispatch } from '../../../state/read-only-state'\nimport { type Action } from '../../../state/actions'\n\nimport { isServer } from '../../../utils/is-server'\n\n// overloaded signatures\nexport function useUniversalDispatch<Args extends any[], A extends Action>(\n dispatch: Dispatch,\n action: (...args: Args) => A,\n args: Args,\n): void\nexport function useUniversalDispatch<Args extends any[], A extends Action>(\n dispatch: Dispatch,\n action: (...args: Args) => ThunkAction<() => void, any, any, A>,\n args: Args,\n): void\n// implementation\nexport function useUniversalDispatch<Args extends any[], A extends Action>(\n dispatch: Dispatch,\n action: (...args: Args) => ThunkAction<() => void, any, any, A>,\n args: Args,\n) {\n if (isServer()) {\n dispatch(action(...args))\n }\n\n useEffect(() => {\n dispatch(action(...args))\n }, [dispatch, action, ...args])\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAM1B,SAAS,gBAAgB;AAclB,SAAS,qBACd,UACA,QACA,MACA;AACA,MAAI,SAAS,GAAG;AACd,aAAS,OAAO,GAAG,IAAI,CAAC;AAAA,EAC1B;AAEA,YAAU,MAAM;AACd,aAAS,OAAO,GAAG,IAAI,CAAC;AAAA,EAC1B,GAAG,CAAC,UAAU,QAAQ,GAAG,IAAI,CAAC;AAChC;","names":[]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { createContext, useContext } from "react";
4
- import { MakeswiftHostApiClient } from "../../api/react";
4
+ import { MakeswiftHostApiClient } from "../../api/client";
5
5
  const Context = createContext(
6
6
  new MakeswiftHostApiClient({
7
7
  uri: "https://api.makeswift.com/graphql",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/runtimes/react/host-api-client.tsx"],"sourcesContent":["'use client'\n\nimport { ReactNode, createContext, useContext } from 'react'\nimport { MakeswiftHostApiClient } from '../../api/react'\n\nconst Context = createContext(\n new MakeswiftHostApiClient({\n uri: 'https://api.makeswift.com/graphql',\n fetch: async (url, init) => {\n console.warn(\n 'Using fallback `fetch` implementation, resource revalidation may not work as expected.',\n { url },\n )\n return fetch(url, init)\n },\n }),\n)\n\nexport function useMakeswiftHostApiClient(): MakeswiftHostApiClient {\n return useContext(Context)\n}\n\nexport function MakeswiftHostApiClientProvider({\n client,\n children,\n}: {\n client: MakeswiftHostApiClient\n children: ReactNode\n}) {\n return <Context.Provider value={client}>{children}</Context.Provider>\n}\n"],"mappings":";AA6BS;AA3BT,SAAoB,eAAe,kBAAkB;AACrD,SAAS,8BAA8B;AAEvC,MAAM,UAAU;AAAA,EACd,IAAI,uBAAuB;AAAA,IACzB,KAAK;AAAA,IACL,OAAO,OAAO,KAAK,SAAS;AAC1B,cAAQ;AAAA,QACN;AAAA,QACA,EAAE,IAAI;AAAA,MACR;AACA,aAAO,MAAM,KAAK,IAAI;AAAA,IACxB;AAAA,EACF,CAAC;AACH;AAEO,SAAS,4BAAoD;AAClE,SAAO,WAAW,OAAO;AAC3B;AAEO,SAAS,+BAA+B;AAAA,EAC7C;AAAA,EACA;AACF,GAGG;AACD,SAAO,oBAAC,QAAQ,UAAR,EAAiB,OAAO,QAAS,UAAS;AACpD;","names":[]}
1
+ {"version":3,"sources":["../../../../src/runtimes/react/host-api-client.tsx"],"sourcesContent":["'use client'\n\nimport { ReactNode, createContext, useContext } from 'react'\nimport { MakeswiftHostApiClient } from '../../api/client'\n\nconst Context = createContext(\n new MakeswiftHostApiClient({\n uri: 'https://api.makeswift.com/graphql',\n fetch: async (url, init) => {\n console.warn(\n 'Using fallback `fetch` implementation, resource revalidation may not work as expected.',\n { url },\n )\n return fetch(url, init)\n },\n }),\n)\n\nexport function useMakeswiftHostApiClient(): MakeswiftHostApiClient {\n return useContext(Context)\n}\n\nexport function MakeswiftHostApiClientProvider({\n client,\n children,\n}: {\n client: MakeswiftHostApiClient\n children: ReactNode\n}) {\n return <Context.Provider value={client}>{children}</Context.Provider>\n}\n"],"mappings":";AA6BS;AA3BT,SAAoB,eAAe,kBAAkB;AACrD,SAAS,8BAA8B;AAEvC,MAAM,UAAU;AAAA,EACd,IAAI,uBAAuB;AAAA,IACzB,KAAK;AAAA,IACL,OAAO,OAAO,KAAK,SAAS;AAC1B,cAAQ;AAAA,QACN;AAAA,QACA,EAAE,IAAI;AAAA,MACR;AACA,aAAO,MAAM,KAAK,IAAI;AAAA,IACxB;AAAA,EACF,CAAC;AACH;AAEO,SAAS,4BAAoD;AAClE,SAAO,WAAW,OAAO;AAC3B;AAEO,SAAS,+BAA+B;AAAA,EAC7C;AAAA,EACA;AACF,GAGG;AACD,SAAO,oBAAC,QAAQ,UAAR,EAAiB,OAAO,QAAS,UAAS;AACpD;","names":[]}
@@ -7,7 +7,7 @@ import { useBuilderEditMode } from "./hooks/use-builder-edit-mode";
7
7
  import { useDocumentKey } from "./hooks/use-document-context";
8
8
  import { useElementId } from "./hooks/use-element-id";
9
9
  import { useIsInBuilder } from "./hooks/use-is-in-builder";
10
- import { useIsPreview } from "./hooks/use-is-preview";
10
+ import { useIsReadOnly } from "./hooks/use-is-read-only";
11
11
  import { useSelector } from "./hooks/use-selector";
12
12
  import { StoreContext, useStore } from "./hooks/use-store";
13
13
  export {
@@ -21,7 +21,7 @@ export {
21
21
  useDocumentKey,
22
22
  useElementId,
23
23
  useIsInBuilder,
24
- useIsPreview,
24
+ useIsReadOnly,
25
25
  useSelector,
26
26
  useStore
27
27
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/runtimes/react/index.ts"],"sourcesContent":["export { ReactRuntime } from './react-runtime'\n\nexport { Element } from './components/Element'\nexport { DocumentRoot } from './components/DocumentRoot'\nexport { RuntimeProvider } from './components/RuntimeProvider'\n\nexport { useBreakpoints } from './hooks/use-breakpoints'\nexport { useBuilderEditMode } from './hooks/use-builder-edit-mode'\nexport { useDocumentKey } from './hooks/use-document-context'\nexport { useElementId } from './hooks/use-element-id'\nexport { useIsInBuilder } from './hooks/use-is-in-builder'\nexport { useIsPreview } from './hooks/use-is-preview'\nexport { useSelector } from './hooks/use-selector'\nexport { StoreContext, useStore } from './hooks/use-store'\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAEhC,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,cAAc,gBAAgB;","names":[]}
1
+ {"version":3,"sources":["../../../../src/runtimes/react/index.ts"],"sourcesContent":["export { ReactRuntime } from './react-runtime'\n\nexport { Element } from './components/Element'\nexport { DocumentRoot } from './components/DocumentRoot'\nexport { RuntimeProvider } from './components/RuntimeProvider'\n\nexport { useBreakpoints } from './hooks/use-breakpoints'\nexport { useBuilderEditMode } from './hooks/use-builder-edit-mode'\nexport { useDocumentKey } from './hooks/use-document-context'\nexport { useElementId } from './hooks/use-element-id'\nexport { useIsInBuilder } from './hooks/use-is-in-builder'\nexport { useIsReadOnly } from './hooks/use-is-read-only'\nexport { useSelector } from './hooks/use-selector'\nexport { StoreContext, useStore } from './hooks/use-store'\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAEhC,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,cAAc,gBAAgB;","names":[]}
@@ -1,4 +1,4 @@
1
- import { getBox } from "../../state/modules/box-models";
1
+ import { getBox } from "../../state/modules/read-write/box-models";
2
2
  import deepEqual from "../../utils/deepEqual";
3
3
  function pollBoxModel({
4
4
  element,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/runtimes/react/poll-box-model.ts"],"sourcesContent":["import { BoxModel, getBox } from '../../state/modules/box-models'\nimport deepEqual from '../../utils/deepEqual'\n\nexport function pollBoxModel({\n element,\n onBoxModelChange,\n}: {\n element: Element | null\n onBoxModelChange(boxModel: BoxModel | null): void\n}): () => void {\n let currentBoxModel: BoxModel | null = null\n\n const handleAnimationFrameRequest = () => {\n const measuredBoxModel = element == null ? null : getBox(element)\n\n if (!deepEqual(currentBoxModel, measuredBoxModel)) {\n currentBoxModel = measuredBoxModel\n\n onBoxModelChange(currentBoxModel)\n }\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n\n onBoxModelChange(null)\n }\n}\n"],"mappings":"AAAA,SAAmB,cAAc;AACjC,OAAO,eAAe;AAEf,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AACF,GAGe;AACb,MAAI,kBAAmC;AAEvC,QAAM,8BAA8B,MAAM;AACxC,UAAM,mBAAmB,WAAW,OAAO,OAAO,OAAO,OAAO;AAEhE,QAAI,CAAC,UAAU,iBAAiB,gBAAgB,GAAG;AACjD,wBAAkB;AAElB,uBAAiB,eAAe;AAAA,IAClC;AAEA,2BAAuB,sBAAsB,2BAA2B;AAAA,EAC1E;AAEA,MAAI,uBAAuB,sBAAsB,2BAA2B;AAE5E,SAAO,MAAM;AACX,yBAAqB,oBAAoB;AAEzC,qBAAiB,IAAI;AAAA,EACvB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/runtimes/react/poll-box-model.ts"],"sourcesContent":["import { BoxModel, getBox } from '../../state/modules/read-write/box-models'\nimport deepEqual from '../../utils/deepEqual'\n\nexport function pollBoxModel({\n element,\n onBoxModelChange,\n}: {\n element: Element | null\n onBoxModelChange(boxModel: BoxModel | null): void\n}): () => void {\n let currentBoxModel: BoxModel | null = null\n\n const handleAnimationFrameRequest = () => {\n const measuredBoxModel = element == null ? null : getBox(element)\n\n if (!deepEqual(currentBoxModel, measuredBoxModel)) {\n currentBoxModel = measuredBoxModel\n\n onBoxModelChange(currentBoxModel)\n }\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n\n onBoxModelChange(null)\n }\n}\n"],"mappings":"AAAA,SAAmB,cAAc;AACjC,OAAO,eAAe;AAEf,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AACF,GAGe;AACb,MAAI,kBAAmC;AAEvC,QAAM,8BAA8B,MAAM;AACxC,UAAM,mBAAmB,WAAW,OAAO,OAAO,OAAO,OAAO;AAEhE,QAAI,CAAC,UAAU,iBAAiB,gBAAgB,GAAG;AACjD,wBAAkB;AAElB,uBAAiB,eAAe;AAAA,IAClC;AAEA,2BAAuB,sBAAsB,2BAA2B;AAAA,EAC1E;AAEA,MAAI,uBAAuB,sBAAsB,2BAA2B;AAE5E,SAAO,MAAM;AACX,yBAAqB,oBAAoB;AAEzC,qBAAiB,IAAI;AAAA,EACvB;AACF;","names":[]}
@@ -1,5 +1,8 @@
1
1
  import { supportsActivity } from "./components/activity-with-fallback";
2
- import { registerComponentEffect, registerReactComponentEffect } from "../../state/actions/internal";
2
+ import {
3
+ registerComponentEffect,
4
+ registerReactComponentEffect
5
+ } from "../../state/actions/internal/read-only-actions";
3
6
  import { ComponentIcon } from "../../state/modules/components-meta";
4
7
  import { RuntimeCore } from "./runtime-core";
5
8
  function validateComponentType(type, component) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/runtimes/react/react-runtime-core.ts"],"sourcesContent":["import { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls'\n\nimport { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors'\n\nimport { supportsActivity } from './components/activity-with-fallback'\n\nimport { registerComponentEffect, registerReactComponentEffect } from '../../state/actions/internal'\n\nimport { BreakpointsInput } from '../../state/modules/breakpoints'\nimport { ComponentIcon } from '../../state/modules/components-meta'\nimport type { ComponentType } from '../../state/react-page'\n\nimport { RuntimeCore } from './runtime-core'\n\nfunction validateComponentType(type: string, component?: ComponentType): void {\n const componentName = component?.name ?? 'Component'\n if (typeof type !== 'string' || type === '') {\n throw new Error(\n `${componentName}: A non-empty string \\`type\\` is required for component registration, got ${type}`,\n )\n }\n}\n\nexport class ReactRuntimeCore extends RuntimeCore {\n registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n C extends ComponentType<{ [K in keyof P]: DescriptorValueType<P[K]> }>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Cube,\n hidden = false,\n description,\n builtinSuspense,\n props,\n }: {\n type: string\n label: string\n icon?: ComponentIcon\n hidden?: boolean\n description?: string\n /**\n * In React <= 19.1, controls the default `<Suspense>` boundary.\n * Ignored in React >= 19.2; components are always wrapped in `<Activity>`.\n * Defaults to `true`.\n */\n builtinSuspense?: boolean\n props?: P\n },\n ): () => void {\n validateComponentType(type, component as unknown as ComponentType)\n\n const unregisterComponent = this.store.dispatch(\n registerComponentEffect(\n type,\n { label, icon, hidden, description, builtinSuspense },\n props ?? {},\n ),\n )\n\n if (supportsActivity() && builtinSuspense !== undefined) {\n console.warn(\n 'builtinSuspense is ignored in React >= 19.2; components are always wrapped in <Activity>.',\n )\n }\n\n const unregisterReactComponent = this.store.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n\n constructor({ breakpoints }: { breakpoints?: BreakpointsInput } = {}) {\n super({ breakpoints })\n }\n}\n"],"mappings":"AAIA,SAAS,wBAAwB;AAEjC,SAAS,yBAAyB,oCAAoC;AAGtE,SAAS,qBAAqB;AAG9B,SAAS,mBAAmB;AAE5B,SAAS,sBAAsB,MAAc,WAAiC;AAC5E,QAAM,gBAAgB,WAAW,QAAQ;AACzC,MAAI,OAAO,SAAS,YAAY,SAAS,IAAI;AAC3C,UAAM,IAAI;AAAA,MACR,GAAG,aAAa,6EAA6E,IAAI;AAAA,IACnG;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,YAAY;AAAA,EAChD,kBAKE,WACA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO,cAAc;AAAA,IACrB,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAcY;AACZ,0BAAsB,MAAM,SAAqC;AAEjE,UAAM,sBAAsB,KAAK,MAAM;AAAA,MACrC;AAAA,QACE;AAAA,QACA,EAAE,OAAO,MAAM,QAAQ,aAAa,gBAAgB;AAAA,QACpD,SAAS,CAAC;AAAA,MACZ;AAAA,IACF;AAEA,QAAI,iBAAiB,KAAK,oBAAoB,QAAW;AACvD,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAEA,UAAM,2BAA2B,KAAK,MAAM;AAAA,MAC1C,6BAA6B,MAAM,SAAqC;AAAA,IAC1E;AAEA,WAAO,MAAM;AACX,0BAAoB;AACpB,+BAAyB;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,YAAY,EAAE,YAAY,IAAwC,CAAC,GAAG;AACpE,UAAM,EAAE,YAAY,CAAC;AAAA,EACvB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/runtimes/react/react-runtime-core.ts"],"sourcesContent":["import { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls'\n\nimport { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors'\n\nimport { supportsActivity } from './components/activity-with-fallback'\n\nimport {\n registerComponentEffect,\n registerReactComponentEffect,\n} from '../../state/actions/internal/read-only-actions'\n\nimport { BreakpointsInput } from '../../state/modules/breakpoints'\nimport { ComponentIcon } from '../../state/modules/components-meta'\nimport type { ComponentType } from '../../state/read-only-state'\n\nimport { RuntimeCore } from './runtime-core'\n\nfunction validateComponentType(type: string, component?: ComponentType): void {\n const componentName = component?.name ?? 'Component'\n if (typeof type !== 'string' || type === '') {\n throw new Error(\n `${componentName}: A non-empty string \\`type\\` is required for component registration, got ${type}`,\n )\n }\n}\n\nexport class ReactRuntimeCore extends RuntimeCore {\n registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n C extends ComponentType<{ [K in keyof P]: DescriptorValueType<P[K]> }>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Cube,\n hidden = false,\n description,\n builtinSuspense,\n props,\n }: {\n type: string\n label: string\n icon?: ComponentIcon\n hidden?: boolean\n description?: string\n /**\n * In React <= 19.1, controls the default `<Suspense>` boundary.\n * Ignored in React >= 19.2; components are always wrapped in `<Activity>`.\n * Defaults to `true`.\n */\n builtinSuspense?: boolean\n props?: P\n },\n ): () => void {\n validateComponentType(type, component as unknown as ComponentType)\n\n const unregisterComponent = this.store.dispatch(\n registerComponentEffect(\n type,\n { label, icon, hidden, description, builtinSuspense },\n props ?? {},\n ),\n )\n\n if (supportsActivity() && builtinSuspense !== undefined) {\n console.warn(\n 'builtinSuspense is ignored in React >= 19.2; components are always wrapped in <Activity>.',\n )\n }\n\n const unregisterReactComponent = this.store.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n\n constructor({ breakpoints }: { breakpoints?: BreakpointsInput } = {}) {\n super({ breakpoints })\n }\n}\n"],"mappings":"AAIA,SAAS,wBAAwB;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAGP,SAAS,qBAAqB;AAG9B,SAAS,mBAAmB;AAE5B,SAAS,sBAAsB,MAAc,WAAiC;AAC5E,QAAM,gBAAgB,WAAW,QAAQ;AACzC,MAAI,OAAO,SAAS,YAAY,SAAS,IAAI;AAC3C,UAAM,IAAI;AAAA,MACR,GAAG,aAAa,6EAA6E,IAAI;AAAA,IACnG;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,YAAY;AAAA,EAChD,kBAKE,WACA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO,cAAc;AAAA,IACrB,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAcY;AACZ,0BAAsB,MAAM,SAAqC;AAEjE,UAAM,sBAAsB,KAAK,MAAM;AAAA,MACrC;AAAA,QACE;AAAA,QACA,EAAE,OAAO,MAAM,QAAQ,aAAa,gBAAgB;AAAA,QACpD,SAAS,CAAC;AAAA,MACZ;AAAA,IACF;AAEA,QAAI,iBAAiB,KAAK,oBAAoB,QAAW;AACvD,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAEA,UAAM,2BAA2B,KAAK,MAAM;AAAA,MAC1C,6BAA6B,MAAM,SAAqC;AAAA,IAC1E;AAEA,WAAO,MAAM;AACX,0BAAoB;AACpB,+BAAyB;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,YAAY,EAAE,YAAY,IAAwC,CAAC,GAAG;AACpE,UAAM,EAAE,YAAY,CAAC;AAAA,EACvB;AACF;","names":[]}
@@ -1,11 +1,9 @@
1
1
  import {
2
2
  parseBreakpointsInput
3
3
  } from "../../state/modules/breakpoints";
4
- import {
5
- configureStore,
6
- copyElementTree,
7
- getBreakpoints
8
- } from "../../state/react-page";
4
+ import { copyElementTree } from "../../state/ops/copy-element-tree";
5
+ import { getBreakpoints } from "../../state/read-only-state";
6
+ import { configureStore } from "../../state/react-page";
9
7
  class RuntimeCore {
10
8
  store;
11
9
  constructor({ breakpoints }) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/runtimes/react/runtime-core.ts"],"sourcesContent":["import { type SerializableReplacementContext } from '@makeswift/controls'\n\nimport {\n Breakpoints,\n BreakpointsInput,\n parseBreakpointsInput,\n} from '../../state/modules/breakpoints'\n\nimport {\n configureStore,\n copyElementTree,\n getBreakpoints,\n type Store,\n type Element,\n type ElementData,\n} from '../../state/react-page'\n\nexport class RuntimeCore {\n store: Store\n\n constructor({ breakpoints }: { breakpoints?: BreakpointsInput }) {\n this.store = configureStore({\n name: 'Runtime store',\n preloadedState: null,\n breakpoints: breakpoints ? parseBreakpointsInput(breakpoints) : undefined,\n })\n }\n\n copyElementTree(\n elementTree: ElementData,\n replacementContext: SerializableReplacementContext,\n ): Element {\n return copyElementTree(this.store.getState(), elementTree, replacementContext)\n }\n\n getBreakpoints(): Breakpoints {\n return getBreakpoints(this.store.getState())\n }\n}\n"],"mappings":"AAEA;AAAA,EAGE;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAEA,MAAM,YAAY;AAAA,EACvB;AAAA,EAEA,YAAY,EAAE,YAAY,GAAuC;AAC/D,SAAK,QAAQ,eAAe;AAAA,MAC1B,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa,cAAc,sBAAsB,WAAW,IAAI;AAAA,IAClE,CAAC;AAAA,EACH;AAAA,EAEA,gBACE,aACA,oBACS;AACT,WAAO,gBAAgB,KAAK,MAAM,SAAS,GAAG,aAAa,kBAAkB;AAAA,EAC/E;AAAA,EAEA,iBAA8B;AAC5B,WAAO,eAAe,KAAK,MAAM,SAAS,CAAC;AAAA,EAC7C;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/runtimes/react/runtime-core.ts"],"sourcesContent":["import { type SerializableReplacementContext } from '@makeswift/controls'\n\nimport {\n Breakpoints,\n BreakpointsInput,\n parseBreakpointsInput,\n} from '../../state/modules/breakpoints'\n\nimport { copyElementTree } from '../../state/ops/copy-element-tree'\n\nimport { getBreakpoints, type Element, type ElementData } from '../../state/read-only-state'\nimport { configureStore, type Store } from '../../state/react-page'\n\nexport class RuntimeCore {\n store: Store\n\n constructor({ breakpoints }: { breakpoints?: BreakpointsInput }) {\n this.store = configureStore({\n name: 'Runtime store',\n preloadedState: null,\n breakpoints: breakpoints ? parseBreakpointsInput(breakpoints) : undefined,\n })\n }\n\n copyElementTree(\n elementTree: ElementData,\n replacementContext: SerializableReplacementContext,\n ): Element {\n return copyElementTree(this.store.getState(), elementTree, replacementContext)\n }\n\n getBreakpoints(): Breakpoints {\n return getBreakpoints(this.store.getState())\n }\n}\n"],"mappings":"AAEA;AAAA,EAGE;AAAA,OACK;AAEP,SAAS,uBAAuB;AAEhC,SAAS,sBAAsD;AAC/D,SAAS,sBAAkC;AAEpC,MAAM,YAAY;AAAA,EACvB;AAAA,EAEA,YAAY,EAAE,YAAY,GAAuC;AAC/D,SAAK,QAAQ,eAAe;AAAA,MAC1B,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa,cAAc,sBAAsB,WAAW,IAAI;AAAA,IAClE,CAAC;AAAA,EACH;AAAA,EAEA,gBACE,aACA,oBACS;AACT,WAAO,gBAAgB,KAAK,MAAM,SAAS,GAAG,aAAa,kBAAkB;AAAA,EAC/E;AAAA,EAEA,iBAA8B;AAC5B,WAAO,eAAe,KAAK,MAAM,SAAS,CAAC;AAAA,EAC7C;AACF;","names":[]}
@@ -0,0 +1,8 @@
1
+ import { ReactRuntime } from "../react-runtime";
2
+ function createReactRuntime() {
3
+ return new ReactRuntime();
4
+ }
5
+ export {
6
+ createReactRuntime
7
+ };
8
+ //# sourceMappingURL=react-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/testing/react-runtime.tsx"],"sourcesContent":["import { ReactRuntime } from '../react-runtime'\n\nexport function createReactRuntime() {\n return new ReactRuntime()\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAEtB,SAAS,qBAAqB;AACnC,SAAO,IAAI,aAAa;AAC1B;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/utils/can-accept-ref.ts"],"sourcesContent":["import type { Component, PropsWithoutRef, RefAttributes } from 'react'\nimport { type ComponentType } from '../../../state/react-page'\n\ntype WrapperComponent = {\n $$typeof: string\n new (props: PropsWithoutRef<any> & RefAttributes<any>, context?: any): Component<any>\n}\n\ntype MemoComponent = WrapperComponent & {\n type: ComponentType\n}\n\n// See https://github.com/facebook/react/blob/main/packages/shared/ReactSymbols.js\nconst REACT_MEMO_TYPE: symbol = Symbol.for('react.memo')\nconst REACT_LAZY_TYPE: symbol = Symbol.for('react.lazy')\nconst REACT_FORWARD_REF_TYPE: symbol = Symbol.for('react.forward_ref')\n\nfunction hasTypeofSymbol(c: ComponentType, type: symbol): c is WrapperComponent {\n // React uses `$$typeof` field on its wrapper components to identify them,\n // see https://github.com/facebook/react/blob/main/packages/shared/ReactElementType.js\n // and https://github.com/search?q=repo%3Afacebook%2Freact%20%24%24typeof&type=code\n return c != null && '$$typeof' in c && c.$$typeof === type\n}\n\nfunction isMemoComponent(c: ComponentType): c is MemoComponent {\n return hasTypeofSymbol(c, REACT_MEMO_TYPE)\n}\n\nfunction isLazyComponent(c: ComponentType) {\n return hasTypeofSymbol(c, REACT_LAZY_TYPE)\n}\n\nfunction isForwardRef(c: ComponentType) {\n return hasTypeofSymbol(c, REACT_FORWARD_REF_TYPE)\n}\n\nfunction unwrapIfMemo(c: ComponentType): ComponentType {\n return isMemoComponent(c) ? c.type : c\n}\n\nfunction isClassComponent(c: ComponentType) {\n return typeof c === 'function' && c.prototype && Boolean(c.prototype.isReactComponent)\n}\n\nfunction canAcceptRefImpl(c: ComponentType) {\n return (\n isClassComponent(c) ||\n isForwardRef(c) ||\n // will try to pass a ref to all lazy components since we can't know if they accept refs without loading them\n isLazyComponent(c)\n )\n}\n\nexport function canAcceptRef(c: ComponentType) {\n return canAcceptRefImpl(unwrapIfMemo(c))\n}\n"],"mappings":"AAaA,MAAM,kBAA0B,OAAO,IAAI,YAAY;AACvD,MAAM,kBAA0B,OAAO,IAAI,YAAY;AACvD,MAAM,yBAAiC,OAAO,IAAI,mBAAmB;AAErE,SAAS,gBAAgB,GAAkB,MAAqC;AAI9E,SAAO,KAAK,QAAQ,cAAc,KAAK,EAAE,aAAa;AACxD;AAEA,SAAS,gBAAgB,GAAsC;AAC7D,SAAO,gBAAgB,GAAG,eAAe;AAC3C;AAEA,SAAS,gBAAgB,GAAkB;AACzC,SAAO,gBAAgB,GAAG,eAAe;AAC3C;AAEA,SAAS,aAAa,GAAkB;AACtC,SAAO,gBAAgB,GAAG,sBAAsB;AAClD;AAEA,SAAS,aAAa,GAAiC;AACrD,SAAO,gBAAgB,CAAC,IAAI,EAAE,OAAO;AACvC;AAEA,SAAS,iBAAiB,GAAkB;AAC1C,SAAO,OAAO,MAAM,cAAc,EAAE,aAAa,QAAQ,EAAE,UAAU,gBAAgB;AACvF;AAEA,SAAS,iBAAiB,GAAkB;AAC1C,SACE,iBAAiB,CAAC,KAClB,aAAa,CAAC;AAAA,EAEd,gBAAgB,CAAC;AAErB;AAEO,SAAS,aAAa,GAAkB;AAC7C,SAAO,iBAAiB,aAAa,CAAC,CAAC;AACzC;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/utils/can-accept-ref.ts"],"sourcesContent":["import type { Component, PropsWithoutRef, RefAttributes } from 'react'\nimport { type ComponentType } from '../../../state/read-only-state'\n\ntype WrapperComponent = {\n $$typeof: string\n new (props: PropsWithoutRef<any> & RefAttributes<any>, context?: any): Component<any>\n}\n\ntype MemoComponent = WrapperComponent & {\n type: ComponentType\n}\n\n// See https://github.com/facebook/react/blob/main/packages/shared/ReactSymbols.js\nconst REACT_MEMO_TYPE: symbol = Symbol.for('react.memo')\nconst REACT_LAZY_TYPE: symbol = Symbol.for('react.lazy')\nconst REACT_FORWARD_REF_TYPE: symbol = Symbol.for('react.forward_ref')\n\nfunction hasTypeofSymbol(c: ComponentType, type: symbol): c is WrapperComponent {\n // React uses `$$typeof` field on its wrapper components to identify them,\n // see https://github.com/facebook/react/blob/main/packages/shared/ReactElementType.js\n // and https://github.com/search?q=repo%3Afacebook%2Freact%20%24%24typeof&type=code\n return c != null && '$$typeof' in c && c.$$typeof === type\n}\n\nfunction isMemoComponent(c: ComponentType): c is MemoComponent {\n return hasTypeofSymbol(c, REACT_MEMO_TYPE)\n}\n\nfunction isLazyComponent(c: ComponentType) {\n return hasTypeofSymbol(c, REACT_LAZY_TYPE)\n}\n\nfunction isForwardRef(c: ComponentType) {\n return hasTypeofSymbol(c, REACT_FORWARD_REF_TYPE)\n}\n\nfunction unwrapIfMemo(c: ComponentType): ComponentType {\n return isMemoComponent(c) ? c.type : c\n}\n\nfunction isClassComponent(c: ComponentType) {\n return typeof c === 'function' && c.prototype && Boolean(c.prototype.isReactComponent)\n}\n\nfunction canAcceptRefImpl(c: ComponentType) {\n return (\n isClassComponent(c) ||\n isForwardRef(c) ||\n // will try to pass a ref to all lazy components since we can't know if they accept refs without loading them\n isLazyComponent(c)\n )\n}\n\nexport function canAcceptRef(c: ComponentType) {\n return canAcceptRefImpl(unwrapIfMemo(c))\n}\n"],"mappings":"AAaA,MAAM,kBAA0B,OAAO,IAAI,YAAY;AACvD,MAAM,kBAA0B,OAAO,IAAI,YAAY;AACvD,MAAM,yBAAiC,OAAO,IAAI,mBAAmB;AAErE,SAAS,gBAAgB,GAAkB,MAAqC;AAI9E,SAAO,KAAK,QAAQ,cAAc,KAAK,EAAE,aAAa;AACxD;AAEA,SAAS,gBAAgB,GAAsC;AAC7D,SAAO,gBAAgB,GAAG,eAAe;AAC3C;AAEA,SAAS,gBAAgB,GAAkB;AACzC,SAAO,gBAAgB,GAAG,eAAe;AAC3C;AAEA,SAAS,aAAa,GAAkB;AACtC,SAAO,gBAAgB,GAAG,sBAAsB;AAClD;AAEA,SAAS,aAAa,GAAiC;AACrD,SAAO,gBAAgB,CAAC,IAAI,EAAE,OAAO;AACvC;AAEA,SAAS,iBAAiB,GAAkB;AAC1C,SAAO,OAAO,MAAM,cAAc,EAAE,aAAa,QAAQ,EAAE,UAAU,gBAAgB;AACvF;AAEA,SAAS,iBAAiB,GAAkB;AAC1C,SACE,iBAAiB,CAAC,KAClB,aAAa,CAAC;AAAA,EAEd,gBAAgB,CAAC;AAErB;AAEO,SAAS,aAAa,GAAkB;AAC7C,SAAO,iBAAiB,aAAa,CAAC,CAAC;AACzC;","names":[]}
@@ -0,0 +1,10 @@
1
+ import { ReadOnlyActionTypes } from "./read-only-actions";
2
+ import { ReadWriteActionTypes } from "./read-write-actions";
3
+ const InternalActionTypes = {
4
+ ...ReadOnlyActionTypes,
5
+ ...ReadWriteActionTypes
6
+ };
7
+ export {
8
+ InternalActionTypes
9
+ };
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/state/actions/internal/index.ts"],"sourcesContent":["import { type ReadOnlyAction, ReadOnlyActionTypes } from './read-only-actions'\nimport { type ReadWriteAction, ReadWriteActionTypes } from './read-write-actions'\n\nexport const InternalActionTypes = {\n ...ReadOnlyActionTypes,\n ...ReadWriteActionTypes,\n} as const\n\nexport type InternalAction = ReadOnlyAction | ReadWriteAction\n"],"mappings":"AAAA,SAA8B,2BAA2B;AACzD,SAA+B,4BAA4B;AAEpD,MAAM,sBAAsB;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AACL;","names":[]}
@@ -1,14 +1,13 @@
1
- const InternalActionTypes = {
1
+ const ReadOnlyActionTypes = {
2
+ // TODO: this one should be a read-write action and we should refuse
3
+ // to fetch resources on the client in read-only mode
2
4
  API_RESOURCE_FULFILLED: "API_RESOURCE_FULFILLED",
3
5
  CREATE_ELEMENT_TREE: "CREATE_ELEMENT_TREE",
4
6
  DELETE_ELEMENT_TREE: "DELETE_ELEMENT_TREE",
5
- CHANGE_ELEMENT_TREE: "CHANGE_ELEMENT_TREE",
6
7
  REGISTER_COMPONENT: "REGISTER_COMPONENT",
7
8
  UNREGISTER_COMPONENT: "UNREGISTER_COMPONENT",
8
9
  REGISTER_COMPONENT_HANDLE: "REGISTER_COMPONENT_HANDLE",
9
10
  UNREGISTER_COMPONENT_HANDLE: "UNREGISTER_COMPONENT_HANDLE",
10
- REGISTER_MEASURABLE: "REGISTER_MEASURABLE",
11
- UNREGISTER_MEASURABLE: "UNREGISTER_MEASURABLE",
12
11
  REGISTER_PROP_CONTROLLERS: "REGISTER_PROP_CONTROLLERS",
13
12
  UNREGISTER_PROP_CONTROLLERS: "UNREGISTER_PROP_CONTROLLERS",
14
13
  REGISTER_PROP_CONTROLLERS_HANDLE: "REGISTER_PROP_CONTROLLERS_HANDLE",
@@ -16,37 +15,31 @@ const InternalActionTypes = {
16
15
  REGISTER_REACT_COMPONENT: "REGISTER_REACT_COMPONENT",
17
16
  UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT",
18
17
  SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER",
19
- UPDATE_API_CLIENT_CACHE: "UPDATE_API_CLIENT_CACHE"
18
+ SET_IS_READ_ONLY: "SET_IS_READ_ONLY"
20
19
  };
21
20
  function apiResourceFulfilled(resourceType, resourceId, resource, locale) {
22
21
  return {
23
- type: InternalActionTypes.API_RESOURCE_FULFILLED,
22
+ type: ReadOnlyActionTypes.API_RESOURCE_FULFILLED,
24
23
  payload: { resourceType, resourceId, resource, locale }
25
24
  };
26
25
  }
27
26
  function createElementTree(payload) {
28
27
  return {
29
- type: InternalActionTypes.CREATE_ELEMENT_TREE,
28
+ type: ReadOnlyActionTypes.CREATE_ELEMENT_TREE,
30
29
  payload
31
30
  };
32
31
  }
33
32
  function deleteElementTree(payload) {
34
- return { type: InternalActionTypes.DELETE_ELEMENT_TREE, payload };
35
- }
36
- function changeElementTree(payload) {
37
- return {
38
- type: InternalActionTypes.CHANGE_ELEMENT_TREE,
39
- payload
40
- };
33
+ return { type: ReadOnlyActionTypes.DELETE_ELEMENT_TREE, payload };
41
34
  }
42
35
  function registerComponent(type, meta, propControllerDescriptors) {
43
36
  return {
44
- type: InternalActionTypes.REGISTER_COMPONENT,
37
+ type: ReadOnlyActionTypes.REGISTER_COMPONENT,
45
38
  payload: { type, meta, propControllerDescriptors }
46
39
  };
47
40
  }
48
41
  function unregisterComponent(type) {
49
- return { type: InternalActionTypes.UNREGISTER_COMPONENT, payload: { type } };
42
+ return { type: ReadOnlyActionTypes.UNREGISTER_COMPONENT, payload: { type } };
50
43
  }
51
44
  function registerComponentEffect(type, meta, propControllerDescriptors) {
52
45
  return (dispatch) => {
@@ -58,13 +51,13 @@ function registerComponentEffect(type, meta, propControllerDescriptors) {
58
51
  }
59
52
  function registerComponentHandle(documentKey, elementKey, componentHandle) {
60
53
  return {
61
- type: InternalActionTypes.REGISTER_COMPONENT_HANDLE,
54
+ type: ReadOnlyActionTypes.REGISTER_COMPONENT_HANDLE,
62
55
  payload: { documentKey, elementKey, componentHandle }
63
56
  };
64
57
  }
65
58
  function unregisterComponentHandle(documentKey, elementKey) {
66
59
  return {
67
- type: InternalActionTypes.UNREGISTER_COMPONENT_HANDLE,
60
+ type: ReadOnlyActionTypes.UNREGISTER_COMPONENT_HANDLE,
68
61
  payload: { documentKey, elementKey }
69
62
  };
70
63
  }
@@ -76,52 +69,35 @@ function registerComponentHandleEffect(documentKey, elementKey, componentHandle)
76
69
  };
77
70
  };
78
71
  }
79
- function registerMeasurable(documentKey, elementKey, measurable) {
80
- return {
81
- type: InternalActionTypes.REGISTER_MEASURABLE,
82
- payload: { documentKey, elementKey, measurable }
83
- };
84
- }
85
- function unregisterMeasurable(documentKey, elementKey) {
86
- return { type: InternalActionTypes.UNREGISTER_MEASURABLE, payload: { documentKey, elementKey } };
87
- }
88
- function registerMeasurableEffect(documentKey, elementKey, measurable) {
89
- return (dispatch) => {
90
- dispatch(registerMeasurable(documentKey, elementKey, measurable));
91
- return () => {
92
- dispatch(unregisterMeasurable(documentKey, elementKey));
93
- };
94
- };
95
- }
96
72
  function registerPropControllersHandle(documentKey, elementKey, handle) {
97
73
  return {
98
- type: InternalActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,
74
+ type: ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,
99
75
  payload: { documentKey, elementKey, handle }
100
76
  };
101
77
  }
102
78
  function unregisterPropControllersHandle(documentKey, elementKey) {
103
79
  return {
104
- type: InternalActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,
80
+ type: ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,
105
81
  payload: { documentKey, elementKey }
106
82
  };
107
83
  }
108
84
  function registerPropControllers(documentKey, elementKey, propControllers) {
109
85
  return {
110
- type: InternalActionTypes.REGISTER_PROP_CONTROLLERS,
86
+ type: ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS,
111
87
  payload: { documentKey, elementKey, propControllers }
112
88
  };
113
89
  }
114
90
  function unregisterPropControllers(documentKey, elementKey) {
115
91
  return {
116
- type: InternalActionTypes.UNREGISTER_PROP_CONTROLLERS,
92
+ type: ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS,
117
93
  payload: { documentKey, elementKey }
118
94
  };
119
95
  }
120
96
  function registerReactComponent(type, component) {
121
- return { type: InternalActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } };
97
+ return { type: ReadOnlyActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } };
122
98
  }
123
99
  function unregisterReactComponent(type) {
124
- return { type: InternalActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } };
100
+ return { type: ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } };
125
101
  }
126
102
  function registerReactComponentEffect(type, component) {
127
103
  return (dispatch) => {
@@ -132,31 +108,27 @@ function registerReactComponentEffect(type, component) {
132
108
  };
133
109
  }
134
110
  function setIsInBuilder(isInBuilder) {
135
- return { type: InternalActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder };
111
+ return { type: ReadOnlyActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder };
136
112
  }
137
- function updateAPIClientCache(payload) {
138
- return { type: InternalActionTypes.UPDATE_API_CLIENT_CACHE, payload };
113
+ function setIsReadOnly(isReadOnly) {
114
+ return { type: ReadOnlyActionTypes.SET_IS_READ_ONLY, payload: isReadOnly };
139
115
  }
140
116
  export {
141
- InternalActionTypes,
117
+ ReadOnlyActionTypes,
142
118
  apiResourceFulfilled,
143
- changeElementTree,
144
119
  createElementTree,
145
120
  deleteElementTree,
146
121
  registerComponent,
147
122
  registerComponentEffect,
148
123
  registerComponentHandle,
149
124
  registerComponentHandleEffect,
150
- registerMeasurable,
151
- registerMeasurableEffect,
152
125
  registerPropControllers,
153
126
  registerPropControllersHandle,
154
127
  registerReactComponentEffect,
155
128
  setIsInBuilder,
129
+ setIsReadOnly,
156
130
  unregisterComponent,
157
- unregisterMeasurable,
158
131
  unregisterPropControllers,
159
- unregisterPropControllersHandle,
160
- updateAPIClientCache
132
+ unregisterPropControllersHandle
161
133
  };
162
- //# sourceMappingURL=internal.js.map
134
+ //# sourceMappingURL=read-only-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/state/actions/internal/read-only-actions.ts"],"sourcesContent":["import { type ThunkAction } from '@reduxjs/toolkit'\n\nimport { ControlInstance } from '@makeswift/controls'\n\nimport { ElementImperativeHandle } from '../../../runtimes/react/element-imperative-handle'\n\nimport { type APIResource, APIResourceType, APIResourceLocale } from '../../../api/types'\nimport { type Descriptor as PropControllerDescriptor } from '../../../prop-controllers/descriptors'\n\nimport { type ComponentMeta } from '../../modules/components-meta'\nimport { type PropControllersHandle } from '../../modules/prop-controller-handles'\nimport { type ComponentType } from '../../modules/react-components'\nimport { type DescriptorsByComponentType } from '../../modules/prop-controllers'\n\nimport { type DocumentPayload } from '../../shared-api'\n\nexport const ReadOnlyActionTypes = {\n // TODO: this one should be a read-write action and we should refuse\n // to fetch resources on the client in read-only mode\n API_RESOURCE_FULFILLED: 'API_RESOURCE_FULFILLED',\n\n CREATE_ELEMENT_TREE: 'CREATE_ELEMENT_TREE',\n DELETE_ELEMENT_TREE: 'DELETE_ELEMENT_TREE',\n\n REGISTER_COMPONENT: 'REGISTER_COMPONENT',\n UNREGISTER_COMPONENT: 'UNREGISTER_COMPONENT',\n REGISTER_COMPONENT_HANDLE: 'REGISTER_COMPONENT_HANDLE',\n UNREGISTER_COMPONENT_HANDLE: 'UNREGISTER_COMPONENT_HANDLE',\n\n REGISTER_PROP_CONTROLLERS: 'REGISTER_PROP_CONTROLLERS',\n UNREGISTER_PROP_CONTROLLERS: 'UNREGISTER_PROP_CONTROLLERS',\n REGISTER_PROP_CONTROLLERS_HANDLE: 'REGISTER_PROP_CONTROLLERS_HANDLE',\n UNREGISTER_PROP_CONTROLLERS_HANDLE: 'UNREGISTER_PROP_CONTROLLERS_HANDLE',\n\n REGISTER_REACT_COMPONENT: 'REGISTER_REACT_COMPONENT',\n UNREGISTER_REACT_COMPONENT: 'UNREGISTER_REACT_COMPONENT',\n\n SET_IS_IN_BUILDER: 'SET_IS_IN_BUILDER',\n SET_IS_READ_ONLY: 'SET_IS_READ_ONLY',\n} as const\n\ntype APIResourceFulfilledAction = {\n type: typeof ReadOnlyActionTypes.API_RESOURCE_FULFILLED\n payload: {\n resourceType: APIResourceType\n resourceId: string\n resource: APIResource | null\n locale?: string | null\n }\n}\n\ntype CreateElementTreeAction = {\n type: typeof ReadOnlyActionTypes.CREATE_ELEMENT_TREE\n payload: { document: DocumentPayload; descriptors: DescriptorsByComponentType }\n}\n\ntype DeleteElementTreeAction = {\n type: typeof ReadOnlyActionTypes.DELETE_ELEMENT_TREE\n payload: { documentKey: string }\n}\n\nexport type RegisterComponentAction = {\n type: typeof ReadOnlyActionTypes.REGISTER_COMPONENT\n payload: {\n type: string\n meta: ComponentMeta\n propControllerDescriptors: Record<string, PropControllerDescriptor>\n }\n}\n\nexport type UnregisterComponentAction = {\n type: typeof ReadOnlyActionTypes.UNREGISTER_COMPONENT\n payload: { type: string }\n}\n\ntype RegisterComponentHandleAction = {\n type: typeof ReadOnlyActionTypes.REGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string; componentHandle: ElementImperativeHandle }\n}\n\ntype UnregisterComponentHandleAction = {\n type: typeof ReadOnlyActionTypes.UNREGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterPropControllersHandleAction = {\n type: typeof ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string; handle: PropControllersHandle }\n}\n\ntype UnregisterPropControllersHandleAction = {\n type: typeof ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterPropControllersAction = {\n type: typeof ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS\n payload: {\n documentKey: string\n elementKey: string\n propControllers: Record<string, ControlInstance>\n }\n}\n\ntype UnregisterPropControllersAction = {\n type: typeof ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterReactComponentAction = {\n type: typeof ReadOnlyActionTypes.REGISTER_REACT_COMPONENT\n payload: { type: string; component: ComponentType }\n}\n\ntype UnregisterReactComponentAction = {\n type: typeof ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT\n payload: { type: string }\n}\n\ntype SetIsInBuilderAction = {\n type: typeof ReadOnlyActionTypes.SET_IS_IN_BUILDER\n payload: boolean\n}\n\ntype SetIsReadOnlyAction = {\n type: typeof ReadOnlyActionTypes.SET_IS_READ_ONLY\n payload: boolean\n}\nexport type ReadOnlyAction =\n | APIResourceFulfilledAction\n | CreateElementTreeAction\n | DeleteElementTreeAction\n | RegisterComponentAction\n | UnregisterComponentAction\n | RegisterComponentHandleAction\n | UnregisterComponentHandleAction\n | RegisterPropControllersHandleAction\n | UnregisterPropControllersHandleAction\n | RegisterPropControllersAction\n | UnregisterPropControllersAction\n | RegisterReactComponentAction\n | UnregisterReactComponentAction\n | SetIsInBuilderAction\n | SetIsReadOnlyAction\n\nexport function apiResourceFulfilled<T extends APIResourceType>(\n resourceType: T,\n resourceId: string,\n resource: APIResource | null,\n locale?: APIResourceLocale<T>,\n): APIResourceFulfilledAction {\n return {\n type: ReadOnlyActionTypes.API_RESOURCE_FULFILLED,\n payload: { resourceType, resourceId, resource, locale },\n }\n}\n\nexport function createElementTree(\n payload: CreateElementTreeAction['payload'],\n): CreateElementTreeAction {\n return {\n type: ReadOnlyActionTypes.CREATE_ELEMENT_TREE,\n payload,\n }\n}\n\nexport function deleteElementTree(\n payload: DeleteElementTreeAction['payload'],\n): DeleteElementTreeAction {\n return { type: ReadOnlyActionTypes.DELETE_ELEMENT_TREE, payload }\n}\n\nexport function registerComponent(\n type: string,\n meta: ComponentMeta,\n propControllerDescriptors: Record<string, PropControllerDescriptor>,\n): RegisterComponentAction {\n return {\n type: ReadOnlyActionTypes.REGISTER_COMPONENT,\n payload: { type, meta, propControllerDescriptors },\n }\n}\n\nexport function unregisterComponent(type: string): UnregisterComponentAction {\n return { type: ReadOnlyActionTypes.UNREGISTER_COMPONENT, payload: { type } }\n}\n\nexport function registerComponentEffect(\n type: string,\n meta: ComponentMeta,\n propControllerDescriptors: Record<string, PropControllerDescriptor>,\n): ThunkAction<() => void, unknown, unknown, ReadOnlyAction> {\n return dispatch => {\n dispatch(registerComponent(type, meta, propControllerDescriptors))\n\n return () => {\n dispatch(unregisterComponent(type))\n }\n }\n}\n\nexport function registerComponentHandle(\n documentKey: string,\n elementKey: string,\n componentHandle: ElementImperativeHandle,\n): RegisterComponentHandleAction {\n return {\n type: ReadOnlyActionTypes.REGISTER_COMPONENT_HANDLE,\n payload: { documentKey, elementKey, componentHandle },\n }\n}\n\nfunction unregisterComponentHandle(\n documentKey: string,\n elementKey: string,\n): UnregisterComponentHandleAction {\n return {\n type: ReadOnlyActionTypes.UNREGISTER_COMPONENT_HANDLE,\n payload: { documentKey, elementKey },\n }\n}\n\nexport function registerComponentHandleEffect(\n documentKey: string,\n elementKey: string,\n componentHandle: ElementImperativeHandle,\n): ThunkAction<() => void, unknown, unknown, ReadOnlyAction> {\n return dispatch => {\n dispatch(registerComponentHandle(documentKey, elementKey, componentHandle))\n\n return () => {\n dispatch(unregisterComponentHandle(documentKey, elementKey))\n }\n }\n}\n\nexport function registerPropControllersHandle(\n documentKey: string,\n elementKey: string,\n handle: PropControllersHandle,\n): RegisterPropControllersHandleAction {\n return {\n type: ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,\n payload: { documentKey, elementKey, handle },\n }\n}\n\nexport function unregisterPropControllersHandle(\n documentKey: string,\n elementKey: string,\n): UnregisterPropControllersHandleAction {\n return {\n type: ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,\n payload: { documentKey, elementKey },\n }\n}\n\nexport function registerPropControllers(\n documentKey: string,\n elementKey: string,\n propControllers: Record<string, ControlInstance>,\n): RegisterPropControllersAction {\n return {\n type: ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS,\n payload: { documentKey, elementKey, propControllers },\n }\n}\n\nexport function unregisterPropControllers(\n documentKey: string,\n elementKey: string,\n): UnregisterPropControllersAction {\n return {\n type: ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS,\n payload: { documentKey, elementKey },\n }\n}\n\nfunction registerReactComponent(\n type: string,\n component: ComponentType,\n): RegisterReactComponentAction {\n return { type: ReadOnlyActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } }\n}\n\nfunction unregisterReactComponent(type: string): UnregisterReactComponentAction {\n return { type: ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } }\n}\n\nexport function registerReactComponentEffect(\n type: string,\n component: ComponentType,\n): ThunkAction<() => void, unknown, unknown, ReadOnlyAction> {\n return dispatch => {\n dispatch(registerReactComponent(type, component))\n\n return () => {\n dispatch(unregisterReactComponent(type))\n }\n }\n}\n\nexport function setIsInBuilder(isInBuilder: boolean): SetIsInBuilderAction {\n return { type: ReadOnlyActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder }\n}\n\nexport function setIsReadOnly(isReadOnly: boolean): SetIsReadOnlyAction {\n return { type: ReadOnlyActionTypes.SET_IS_READ_ONLY, payload: isReadOnly }\n}\n"],"mappings":"AAgBO,MAAM,sBAAsB;AAAA;AAAA;AAAA,EAGjC,wBAAwB;AAAA,EAExB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EAErB,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EACtB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAE7B,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAC7B,kCAAkC;AAAA,EAClC,oCAAoC;AAAA,EAEpC,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAE5B,mBAAmB;AAAA,EACnB,kBAAkB;AACpB;AA0GO,SAAS,qBACd,cACA,YACA,UACA,QAC4B;AAC5B,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,cAAc,YAAY,UAAU,OAAO;AAAA,EACxD;AACF;AAEO,SAAS,kBACd,SACyB;AACzB,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B;AAAA,EACF;AACF;AAEO,SAAS,kBACd,SACyB;AACzB,SAAO,EAAE,MAAM,oBAAoB,qBAAqB,QAAQ;AAClE;AAEO,SAAS,kBACd,MACA,MACA,2BACyB;AACzB,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,MAAM,MAAM,0BAA0B;AAAA,EACnD;AACF;AAEO,SAAS,oBAAoB,MAAyC;AAC3E,SAAO,EAAE,MAAM,oBAAoB,sBAAsB,SAAS,EAAE,KAAK,EAAE;AAC7E;AAEO,SAAS,wBACd,MACA,MACA,2BAC2D;AAC3D,SAAO,cAAY;AACjB,aAAS,kBAAkB,MAAM,MAAM,yBAAyB,CAAC;AAEjE,WAAO,MAAM;AACX,eAAS,oBAAoB,IAAI,CAAC;AAAA,IACpC;AAAA,EACF;AACF;AAEO,SAAS,wBACd,aACA,YACA,iBAC+B;AAC/B,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,YAAY,gBAAgB;AAAA,EACtD;AACF;AAEA,SAAS,0BACP,aACA,YACiC;AACjC,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,WAAW;AAAA,EACrC;AACF;AAEO,SAAS,8BACd,aACA,YACA,iBAC2D;AAC3D,SAAO,cAAY;AACjB,aAAS,wBAAwB,aAAa,YAAY,eAAe,CAAC;AAE1E,WAAO,MAAM;AACX,eAAS,0BAA0B,aAAa,UAAU,CAAC;AAAA,IAC7D;AAAA,EACF;AACF;AAEO,SAAS,8BACd,aACA,YACA,QACqC;AACrC,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,YAAY,OAAO;AAAA,EAC7C;AACF;AAEO,SAAS,gCACd,aACA,YACuC;AACvC,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,WAAW;AAAA,EACrC;AACF;AAEO,SAAS,wBACd,aACA,YACA,iBAC+B;AAC/B,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,YAAY,gBAAgB;AAAA,EACtD;AACF;AAEO,SAAS,0BACd,aACA,YACiC;AACjC,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,WAAW;AAAA,EACrC;AACF;AAEA,SAAS,uBACP,MACA,WAC8B;AAC9B,SAAO,EAAE,MAAM,oBAAoB,0BAA0B,SAAS,EAAE,MAAM,UAAU,EAAE;AAC5F;AAEA,SAAS,yBAAyB,MAA8C;AAC9E,SAAO,EAAE,MAAM,oBAAoB,4BAA4B,SAAS,EAAE,KAAK,EAAE;AACnF;AAEO,SAAS,6BACd,MACA,WAC2D;AAC3D,SAAO,cAAY;AACjB,aAAS,uBAAuB,MAAM,SAAS,CAAC;AAEhD,WAAO,MAAM;AACX,eAAS,yBAAyB,IAAI,CAAC;AAAA,IACzC;AAAA,EACF;AACF;AAEO,SAAS,eAAe,aAA4C;AACzE,SAAO,EAAE,MAAM,oBAAoB,mBAAmB,SAAS,YAAY;AAC7E;AAEO,SAAS,cAAc,YAA0C;AACtE,SAAO,EAAE,MAAM,oBAAoB,kBAAkB,SAAS,WAAW;AAC3E;","names":[]}