@makeswift/runtime 0.26.4-canary.1 → 0.26.5

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 (700) hide show
  1. package/dist/cjs/api/client.js +2 -13
  2. package/dist/cjs/api/client.js.map +1 -1
  3. package/dist/cjs/api/react.js +256 -0
  4. package/dist/cjs/api/react.js.map +1 -0
  5. package/dist/cjs/api-handler/handlers/element-tree.js.map +1 -1
  6. package/dist/cjs/api-handler/handlers/manifest.js +1 -1
  7. package/dist/cjs/api-handler/handlers/merge-translated-data.js.map +1 -1
  8. package/dist/cjs/api-handler/handlers/translatable-data.js.map +1 -1
  9. package/dist/cjs/api-handler/handlers/webhook/diff-projection.js +62 -0
  10. package/dist/cjs/api-handler/handlers/webhook/diff-projection.js.map +1 -0
  11. package/dist/cjs/builder/host-to-builder-actions.js +3 -3
  12. package/dist/cjs/builder/host-to-builder-actions.js.map +1 -1
  13. package/dist/cjs/builder/index.js +2 -2
  14. package/dist/cjs/builder/index.js.map +1 -1
  15. package/dist/cjs/builder/serialization.js +78 -0
  16. package/dist/cjs/builder/serialization.js.map +1 -0
  17. package/dist/cjs/client/index.js +8 -8
  18. package/dist/cjs/client/index.js.map +1 -1
  19. package/dist/cjs/components/builtin/Box/Box.js +1 -1
  20. package/dist/cjs/components/builtin/Box/Box.js.map +1 -1
  21. package/dist/cjs/components/builtin/Form/Form.js +1 -1
  22. package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
  23. package/dist/cjs/components/hooks/useTableFormFieldRefs.js +1 -1
  24. package/dist/cjs/components/hooks/useTableFormFieldRefs.js.map +1 -1
  25. package/dist/cjs/controls/serialization/base/index.js +78 -0
  26. package/dist/cjs/controls/serialization/base/index.js.map +1 -0
  27. package/dist/cjs/controls/serialization/base/visitor.js +59 -0
  28. package/dist/cjs/controls/serialization/base/visitor.js.map +1 -0
  29. package/dist/cjs/controls/serialization/index.js +55 -0
  30. package/dist/cjs/controls/serialization/index.js.map +1 -0
  31. package/dist/cjs/controls/serialization/message-port/function-serialization.js +79 -0
  32. package/dist/cjs/controls/serialization/message-port/function-serialization.js.map +1 -0
  33. package/dist/cjs/controls/serialization/message-port/index.js +25 -0
  34. package/dist/cjs/controls/serialization/message-port/index.js.map +1 -0
  35. package/dist/cjs/controls/serialization/message-port/visitor.js +48 -0
  36. package/dist/cjs/controls/serialization/message-port/visitor.js.map +1 -0
  37. package/dist/cjs/next/api-handler/config/app-router.js +10 -1
  38. package/dist/cjs/next/api-handler/config/app-router.js.map +1 -1
  39. package/dist/cjs/next/api-handler/config/pages-router.js +1 -1
  40. package/dist/cjs/next/api-handler/config/pages-router.js.map +1 -1
  41. package/dist/cjs/next/components/framework-provider/index.js +1 -1
  42. package/dist/cjs/next/components/framework-provider/index.js.map +1 -1
  43. package/dist/cjs/next/components/tests/controls/color-control/fixtures.js.map +1 -1
  44. package/dist/cjs/next/components/tests/controls/page-control-prop-rendering.js +2 -1
  45. package/dist/cjs/next/components/tests/controls/page-control-prop-rendering.js.map +1 -1
  46. package/dist/cjs/next/components/tests/controls/rich-text-v2-control/fixtures.js.map +1 -1
  47. package/dist/cjs/next/components/tests/makeswift-component/fixtures.js +2 -1
  48. package/dist/cjs/next/components/tests/makeswift-component/fixtures.js.map +1 -1
  49. package/dist/cjs/next/components/tests/prop-controllers/page-prop-controller.js +3 -2
  50. package/dist/cjs/next/components/tests/prop-controllers/page-prop-controller.js.map +1 -1
  51. package/dist/cjs/next/fetch.js +30 -0
  52. package/dist/cjs/next/fetch.js.map +1 -0
  53. package/dist/cjs/next/runtime.js +35 -0
  54. package/dist/cjs/next/runtime.js.map +1 -0
  55. package/dist/cjs/next/testing/element-data.js +3 -3
  56. package/dist/cjs/next/testing/element-data.js.map +1 -1
  57. package/dist/cjs/next/testing/index.js +0 -2
  58. package/dist/cjs/next/testing/index.js.map +1 -1
  59. package/dist/cjs/next/testing/page-rendering.js +3 -3
  60. package/dist/cjs/next/testing/page-rendering.js.map +1 -1
  61. package/dist/cjs/prop-controllers/descriptors.js.map +1 -1
  62. package/dist/cjs/prop-controllers/instances.js.map +1 -1
  63. package/dist/cjs/prop-controllers/serialization.js +355 -0
  64. package/dist/cjs/prop-controllers/serialization.js.map +1 -0
  65. package/dist/cjs/runtimes/react/components/Document.js +2 -2
  66. package/dist/cjs/runtimes/react/components/Document.js.map +1 -1
  67. package/dist/cjs/runtimes/react/components/DocumentRoot.js.map +1 -1
  68. package/dist/cjs/runtimes/react/components/Element.js +2 -2
  69. package/dist/cjs/runtimes/react/components/Element.js.map +1 -1
  70. package/dist/cjs/runtimes/react/components/ElementData.js.map +1 -1
  71. package/dist/cjs/runtimes/react/components/ElementReference.js.map +1 -1
  72. package/dist/cjs/runtimes/react/components/ElementRegistration.js +2 -2
  73. package/dist/cjs/runtimes/react/components/ElementRegistration.js.map +1 -1
  74. package/dist/cjs/runtimes/react/components/GoogleFontLink.js +55 -0
  75. package/dist/cjs/runtimes/react/components/GoogleFontLink.js.map +1 -0
  76. package/dist/cjs/runtimes/react/components/MakeswiftComponent.js +2 -2
  77. package/dist/cjs/runtimes/react/components/MakeswiftComponent.js.map +1 -1
  78. package/dist/cjs/runtimes/react/components/MakeswiftFonts.js +33 -0
  79. package/dist/cjs/runtimes/react/components/MakeswiftFonts.js.map +1 -0
  80. package/dist/cjs/runtimes/react/components/RuntimeProvider.js +5 -6
  81. package/dist/cjs/runtimes/react/components/RuntimeProvider.js.map +1 -1
  82. package/dist/cjs/runtimes/react/components/framework-context.js +13 -3
  83. package/dist/cjs/runtimes/react/components/framework-context.js.map +1 -1
  84. package/dist/cjs/runtimes/react/components/page/Page.js.map +1 -1
  85. package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js +3 -2
  86. package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
  87. package/dist/cjs/runtimes/react/controls/rich-text-v2/rich-text-v2.js +2 -2
  88. package/dist/cjs/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
  89. package/dist/cjs/runtimes/react/controls.js +2 -2
  90. package/dist/cjs/runtimes/react/controls.js.map +1 -1
  91. package/dist/cjs/runtimes/react/element-imperative-handle.js +1 -1
  92. package/dist/cjs/runtimes/react/element-imperative-handle.js.map +1 -1
  93. package/dist/cjs/runtimes/react/hooks/use-async-effect.js +55 -0
  94. package/dist/cjs/runtimes/react/hooks/use-async-effect.js.map +1 -0
  95. package/dist/cjs/runtimes/react/hooks/use-breakpoints.js +2 -2
  96. package/dist/cjs/runtimes/react/hooks/use-breakpoints.js.map +1 -1
  97. package/dist/cjs/runtimes/react/hooks/use-builder-edit-mode.js +2 -2
  98. package/dist/cjs/runtimes/react/hooks/use-builder-edit-mode.js.map +1 -1
  99. package/dist/cjs/runtimes/react/hooks/use-cache-data.js +2 -2
  100. package/dist/cjs/runtimes/react/hooks/use-cache-data.js.map +1 -1
  101. package/dist/cjs/runtimes/react/hooks/use-component.js +3 -3
  102. package/dist/cjs/runtimes/react/hooks/use-component.js.map +1 -1
  103. package/dist/cjs/runtimes/react/hooks/use-current-breakpoint.js +39 -0
  104. package/dist/cjs/runtimes/react/hooks/use-current-breakpoint.js.map +1 -0
  105. package/dist/cjs/runtimes/react/hooks/use-dispatch.js.map +1 -1
  106. package/dist/cjs/runtimes/react/hooks/use-document.js +2 -2
  107. package/dist/cjs/runtimes/react/hooks/use-document.js.map +1 -1
  108. package/dist/cjs/runtimes/react/hooks/use-element-id.js +2 -2
  109. package/dist/cjs/runtimes/react/hooks/use-element-id.js.map +1 -1
  110. package/dist/cjs/runtimes/react/hooks/use-is-in-builder.js +2 -2
  111. package/dist/cjs/runtimes/react/hooks/use-is-in-builder.js.map +1 -1
  112. package/dist/cjs/runtimes/react/hooks/use-is-preview.js +33 -0
  113. package/dist/cjs/runtimes/react/hooks/use-is-preview.js.map +1 -0
  114. package/dist/cjs/runtimes/react/hooks/use-register-document.js.map +1 -1
  115. package/dist/cjs/runtimes/react/hooks/use-resolved-props.js +2 -2
  116. package/dist/cjs/runtimes/react/hooks/use-resolved-props.js.map +1 -1
  117. package/dist/cjs/runtimes/react/hooks/use-resource-resolver.js +1 -1
  118. package/dist/cjs/runtimes/react/hooks/use-resource-resolver.js.map +1 -1
  119. package/dist/cjs/runtimes/react/hooks/use-selector.js.map +1 -1
  120. package/dist/cjs/runtimes/react/hooks/use-store.js.map +1 -1
  121. package/dist/cjs/runtimes/react/hooks/use-universal-dispatch.js.map +1 -1
  122. package/dist/cjs/runtimes/react/host-api-client.js +3 -4
  123. package/dist/cjs/runtimes/react/host-api-client.js.map +1 -1
  124. package/dist/cjs/runtimes/react/index.js +3 -3
  125. package/dist/cjs/runtimes/react/index.js.map +1 -1
  126. package/dist/cjs/runtimes/react/lib/resolved-style-to-css.js +59 -0
  127. package/dist/cjs/runtimes/react/lib/resolved-style-to-css.js.map +1 -0
  128. package/dist/cjs/runtimes/react/poll-box-model.js +1 -1
  129. package/dist/cjs/runtimes/react/poll-box-model.js.map +1 -1
  130. package/dist/cjs/runtimes/react/react-runtime-core.js +3 -3
  131. package/dist/cjs/runtimes/react/react-runtime-core.js.map +1 -1
  132. package/dist/cjs/runtimes/react/runtime-core.js +2 -4
  133. package/dist/cjs/runtimes/react/runtime-core.js.map +1 -1
  134. package/dist/cjs/runtimes/react/testing/react-runtime.js +3 -2
  135. package/dist/cjs/runtimes/react/testing/react-runtime.js.map +1 -1
  136. package/dist/cjs/runtimes/react/utils/can-accept-ref.js.map +1 -1
  137. package/dist/cjs/runtimes/react/utils/google-fonts-url.js +49 -0
  138. package/dist/cjs/runtimes/react/utils/google-fonts-url.js.map +1 -0
  139. package/dist/cjs/state/actions/internal/read-only-actions.js +25 -17
  140. package/dist/cjs/state/actions/internal/read-only-actions.js.map +1 -1
  141. package/dist/cjs/state/actions/internal/read-write-actions.js +7 -1
  142. package/dist/cjs/state/actions/internal/read-write-actions.js.map +1 -1
  143. package/dist/cjs/state/actions/internal.js +205 -0
  144. package/dist/cjs/state/actions/internal.js.map +1 -0
  145. package/dist/cjs/state/builder-api/actions.js +8 -11
  146. package/dist/cjs/state/builder-api/actions.js.map +1 -1
  147. package/dist/cjs/state/builder-api/api.js +17 -0
  148. package/dist/cjs/state/builder-api/api.js.map +1 -0
  149. package/dist/cjs/state/builder-api/navigation-listener.js +110 -0
  150. package/dist/cjs/state/builder-api/navigation-listener.js.map +1 -0
  151. package/dist/cjs/state/host-api.js.map +1 -1
  152. package/dist/cjs/state/makeswift-api-client.js +20 -34
  153. package/dist/cjs/state/makeswift-api-client.js.map +1 -1
  154. package/dist/cjs/state/middleware/{read-write/makeswift-api-client-sync.js → makeswift-api-client-sync.js} +1 -1
  155. package/dist/cjs/state/middleware/makeswift-api-client-sync.js.map +1 -0
  156. package/dist/cjs/state/middleware/read-write/builder-api/index.js +11 -2
  157. package/dist/cjs/state/middleware/read-write/builder-api/index.js.map +1 -1
  158. package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js +3 -0
  159. package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -1
  160. package/dist/cjs/state/middleware/read-write/index.js +40 -0
  161. package/dist/cjs/state/middleware/read-write/index.js.map +1 -0
  162. package/dist/cjs/state/middleware/{prop-controller-handles.js → read-write/prop-controller-handles.js} +8 -8
  163. package/dist/cjs/state/middleware/read-write/prop-controller-handles.js.map +1 -0
  164. package/dist/cjs/state/mixins/breakpoint-watch.js +72 -0
  165. package/dist/cjs/state/mixins/breakpoint-watch.js.map +1 -0
  166. package/dist/cjs/state/modules/api-resources.js +4 -7
  167. package/dist/cjs/state/modules/api-resources.js.map +1 -1
  168. package/dist/cjs/state/modules/box-models.js +127 -0
  169. package/dist/cjs/state/modules/box-models.js.map +1 -0
  170. package/dist/cjs/state/modules/breakpoints.js +1 -2
  171. package/dist/cjs/state/modules/breakpoints.js.map +1 -1
  172. package/dist/cjs/state/modules/builder-edit-mode.js +1 -2
  173. package/dist/cjs/state/modules/builder-edit-mode.js.map +1 -1
  174. package/dist/cjs/state/modules/components-meta.js +2 -3
  175. package/dist/cjs/state/modules/components-meta.js.map +1 -1
  176. package/dist/cjs/state/modules/element-imperative-handles.js +60 -0
  177. package/dist/cjs/state/modules/element-imperative-handles.js.map +1 -0
  178. package/dist/cjs/state/modules/element-trees.js +3 -5
  179. package/dist/cjs/state/modules/element-trees.js.map +1 -1
  180. package/dist/cjs/state/modules/is-in-builder.js +1 -2
  181. package/dist/cjs/state/modules/is-in-builder.js.map +1 -1
  182. package/dist/cjs/state/modules/is-preview.js +47 -0
  183. package/dist/cjs/state/modules/is-preview.js.map +1 -0
  184. package/dist/cjs/state/modules/locale.js +1 -4
  185. package/dist/cjs/state/modules/locale.js.map +1 -1
  186. package/dist/cjs/state/modules/localized-resources-map.js +2 -4
  187. package/dist/cjs/state/modules/localized-resources-map.js.map +1 -1
  188. package/dist/cjs/state/modules/pointer.js +47 -0
  189. package/dist/cjs/state/modules/pointer.js.map +1 -0
  190. package/dist/cjs/state/modules/prop-controllers.js +2 -3
  191. package/dist/cjs/state/modules/prop-controllers.js.map +1 -1
  192. package/dist/cjs/state/modules/react-components.js +2 -3
  193. package/dist/cjs/state/modules/react-components.js.map +1 -1
  194. package/dist/cjs/state/modules/read-only-documents.js +2 -3
  195. package/dist/cjs/state/modules/read-only-documents.js.map +1 -1
  196. package/dist/cjs/state/modules/read-write/box-models.js +17 -2
  197. package/dist/cjs/state/modules/read-write/box-models.js.map +1 -1
  198. package/dist/cjs/state/modules/read-write-documents.js +98 -0
  199. package/dist/cjs/state/modules/read-write-documents.js.map +1 -0
  200. package/dist/cjs/state/modules/site-version.js +0 -3
  201. package/dist/cjs/state/modules/site-version.js.map +1 -1
  202. package/dist/cjs/state/react-builder-preview.js +508 -18
  203. package/dist/cjs/state/react-builder-preview.js.map +1 -1
  204. package/dist/cjs/state/react-page.js +250 -6
  205. package/dist/cjs/state/react-page.js.map +1 -1
  206. package/dist/cjs/state/read-only-state.js +23 -1
  207. package/dist/cjs/state/read-only-state.js.map +1 -1
  208. package/dist/cjs/state/read-write-state.js +9 -2
  209. package/dist/cjs/state/read-write-state.js.map +1 -1
  210. package/dist/cjs/state/shared-api.js.map +1 -1
  211. package/dist/cjs/state/store.js +219 -0
  212. package/dist/cjs/state/store.js.map +1 -0
  213. package/dist/cjs/state/translations/get.js +2 -2
  214. package/dist/cjs/state/translations/get.js.map +1 -1
  215. package/dist/cjs/state/translations/merge.js +2 -2
  216. package/dist/cjs/state/translations/merge.js.map +1 -1
  217. package/dist/cjs/state/unified-state.js +17 -0
  218. package/dist/cjs/state/unified-state.js.map +1 -0
  219. package/dist/cjs/translations/index.js +32 -0
  220. package/dist/cjs/translations/index.js.map +1 -0
  221. package/dist/cjs/unstable-framework-support/index.js +4 -2
  222. package/dist/cjs/unstable-framework-support/index.js.map +1 -1
  223. package/dist/cjs/utils/deferred.js +39 -0
  224. package/dist/cjs/utils/deferred.js.map +1 -0
  225. package/dist/cjs/utils/ref-counted-map.js +120 -0
  226. package/dist/cjs/utils/ref-counted-map.js.map +1 -0
  227. package/dist/esm/api/client.js +2 -13
  228. package/dist/esm/api/client.js.map +1 -1
  229. package/dist/esm/api/react.js +223 -0
  230. package/dist/esm/api/react.js.map +1 -0
  231. package/dist/esm/api-handler/handlers/element-tree.js.map +1 -1
  232. package/dist/esm/api-handler/handlers/manifest.js +1 -1
  233. package/dist/esm/api-handler/handlers/merge-translated-data.js.map +1 -1
  234. package/dist/esm/api-handler/handlers/translatable-data.js.map +1 -1
  235. package/dist/esm/api-handler/handlers/webhook/diff-projection.js +38 -0
  236. package/dist/esm/api-handler/handlers/webhook/diff-projection.js.map +1 -0
  237. package/dist/esm/builder/host-to-builder-actions.js +4 -4
  238. package/dist/esm/builder/host-to-builder-actions.js.map +1 -1
  239. package/dist/esm/builder/index.js +1 -1
  240. package/dist/esm/builder/index.js.map +1 -1
  241. package/dist/esm/builder/serialization.js +59 -0
  242. package/dist/esm/builder/serialization.js.map +1 -0
  243. package/dist/esm/client/index.js +5 -5
  244. package/dist/esm/client/index.js.map +1 -1
  245. package/dist/esm/components/builtin/Box/Box.js +1 -1
  246. package/dist/esm/components/builtin/Box/Box.js.map +1 -1
  247. package/dist/esm/components/builtin/Form/Form.js +1 -1
  248. package/dist/esm/components/builtin/Form/Form.js.map +1 -1
  249. package/dist/esm/components/hooks/useTableFormFieldRefs.js +1 -1
  250. package/dist/esm/components/hooks/useTableFormFieldRefs.js.map +1 -1
  251. package/dist/esm/controls/serialization/base/index.js +78 -0
  252. package/dist/esm/controls/serialization/base/index.js.map +1 -0
  253. package/dist/esm/controls/serialization/base/visitor.js +39 -0
  254. package/dist/esm/controls/serialization/base/visitor.js.map +1 -0
  255. package/dist/esm/controls/serialization/index.js +30 -0
  256. package/dist/esm/controls/serialization/index.js.map +1 -0
  257. package/dist/esm/controls/serialization/message-port/function-serialization.js +52 -0
  258. package/dist/esm/controls/serialization/message-port/function-serialization.js.map +1 -0
  259. package/dist/esm/controls/serialization/message-port/index.js +3 -0
  260. package/dist/esm/controls/serialization/message-port/index.js.map +1 -0
  261. package/dist/esm/controls/serialization/message-port/visitor.js +24 -0
  262. package/dist/esm/controls/serialization/message-port/visitor.js.map +1 -0
  263. package/dist/esm/next/api-handler/config/app-router.js +10 -1
  264. package/dist/esm/next/api-handler/config/app-router.js.map +1 -1
  265. package/dist/esm/next/api-handler/config/pages-router.js +1 -1
  266. package/dist/esm/next/api-handler/config/pages-router.js.map +1 -1
  267. package/dist/esm/next/components/framework-provider/index.js +5 -2
  268. package/dist/esm/next/components/framework-provider/index.js.map +1 -1
  269. package/dist/esm/next/components/tests/controls/color-control/fixtures.js.map +1 -1
  270. package/dist/esm/next/components/tests/controls/page-control-prop-rendering.js +2 -1
  271. package/dist/esm/next/components/tests/controls/page-control-prop-rendering.js.map +1 -1
  272. package/dist/esm/next/components/tests/controls/rich-text-v2-control/fixtures.js.map +1 -1
  273. package/dist/esm/next/components/tests/makeswift-component/fixtures.js +2 -1
  274. package/dist/esm/next/components/tests/makeswift-component/fixtures.js.map +1 -1
  275. package/dist/esm/next/components/tests/prop-controllers/page-prop-controller.js +3 -2
  276. package/dist/esm/next/components/tests/prop-controllers/page-prop-controller.js.map +1 -1
  277. package/dist/esm/next/fetch.js +6 -0
  278. package/dist/esm/next/fetch.js.map +1 -0
  279. package/dist/esm/next/runtime.js +11 -0
  280. package/dist/esm/next/runtime.js.map +1 -0
  281. package/dist/esm/next/testing/element-data.js +1 -1
  282. package/dist/esm/next/testing/element-data.js.map +1 -1
  283. package/dist/esm/next/testing/index.js +0 -1
  284. package/dist/esm/next/testing/index.js.map +1 -1
  285. package/dist/esm/next/testing/page-rendering.js +3 -3
  286. package/dist/esm/next/testing/page-rendering.js.map +1 -1
  287. package/dist/esm/prop-controllers/descriptors.js.map +1 -1
  288. package/dist/esm/prop-controllers/instances.js.map +1 -1
  289. package/dist/esm/prop-controllers/serialization.js +338 -0
  290. package/dist/esm/prop-controllers/serialization.js.map +1 -0
  291. package/dist/esm/runtimes/react/components/Document.js +1 -1
  292. package/dist/esm/runtimes/react/components/Document.js.map +1 -1
  293. package/dist/esm/runtimes/react/components/DocumentRoot.js.map +1 -1
  294. package/dist/esm/runtimes/react/components/Element.js +1 -3
  295. package/dist/esm/runtimes/react/components/Element.js.map +1 -1
  296. package/dist/esm/runtimes/react/components/ElementData.js.map +1 -1
  297. package/dist/esm/runtimes/react/components/ElementReference.js.map +1 -1
  298. package/dist/esm/runtimes/react/components/ElementRegistration.js +1 -1
  299. package/dist/esm/runtimes/react/components/ElementRegistration.js.map +1 -1
  300. package/dist/esm/runtimes/react/components/GoogleFontLink.js +35 -0
  301. package/dist/esm/runtimes/react/components/GoogleFontLink.js.map +1 -0
  302. package/dist/esm/runtimes/react/components/MakeswiftComponent.js +1 -1
  303. package/dist/esm/runtimes/react/components/MakeswiftComponent.js.map +1 -1
  304. package/dist/esm/runtimes/react/components/MakeswiftFonts.js +9 -0
  305. package/dist/esm/runtimes/react/components/MakeswiftFonts.js.map +1 -0
  306. package/dist/esm/runtimes/react/components/RuntimeProvider.js +4 -5
  307. package/dist/esm/runtimes/react/components/RuntimeProvider.js.map +1 -1
  308. package/dist/esm/runtimes/react/components/framework-context.js +14 -2
  309. package/dist/esm/runtimes/react/components/framework-context.js.map +1 -1
  310. package/dist/esm/runtimes/react/components/page/Page.js.map +1 -1
  311. package/dist/esm/runtimes/react/controls/rich-text/rich-text.js +3 -2
  312. package/dist/esm/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
  313. package/dist/esm/runtimes/react/controls/rich-text-v2/rich-text-v2.js +2 -2
  314. package/dist/esm/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
  315. package/dist/esm/runtimes/react/controls.js +2 -2
  316. package/dist/esm/runtimes/react/controls.js.map +1 -1
  317. package/dist/esm/runtimes/react/element-imperative-handle.js +1 -1
  318. package/dist/esm/runtimes/react/element-imperative-handle.js.map +1 -1
  319. package/dist/esm/runtimes/react/hooks/use-async-effect.js +31 -0
  320. package/dist/esm/runtimes/react/hooks/use-async-effect.js.map +1 -0
  321. package/dist/esm/runtimes/react/hooks/use-breakpoints.js +1 -1
  322. package/dist/esm/runtimes/react/hooks/use-breakpoints.js.map +1 -1
  323. package/dist/esm/runtimes/react/hooks/use-builder-edit-mode.js +1 -1
  324. package/dist/esm/runtimes/react/hooks/use-builder-edit-mode.js.map +1 -1
  325. package/dist/esm/runtimes/react/hooks/use-cache-data.js +1 -1
  326. package/dist/esm/runtimes/react/hooks/use-cache-data.js.map +1 -1
  327. package/dist/esm/runtimes/react/hooks/use-component.js +1 -1
  328. package/dist/esm/runtimes/react/hooks/use-component.js.map +1 -1
  329. package/dist/esm/runtimes/react/hooks/use-current-breakpoint.js +15 -0
  330. package/dist/esm/runtimes/react/hooks/use-current-breakpoint.js.map +1 -0
  331. package/dist/esm/runtimes/react/hooks/use-dispatch.js.map +1 -1
  332. package/dist/esm/runtimes/react/hooks/use-document.js +1 -1
  333. package/dist/esm/runtimes/react/hooks/use-document.js.map +1 -1
  334. package/dist/esm/runtimes/react/hooks/use-element-id.js +1 -1
  335. package/dist/esm/runtimes/react/hooks/use-element-id.js.map +1 -1
  336. package/dist/esm/runtimes/react/hooks/use-is-in-builder.js +1 -1
  337. package/dist/esm/runtimes/react/hooks/use-is-in-builder.js.map +1 -1
  338. package/dist/esm/runtimes/react/hooks/use-is-preview.js +9 -0
  339. package/dist/esm/runtimes/react/hooks/use-is-preview.js.map +1 -0
  340. package/dist/esm/runtimes/react/hooks/use-register-document.js.map +1 -1
  341. package/dist/esm/runtimes/react/hooks/use-resolved-props.js +2 -2
  342. package/dist/esm/runtimes/react/hooks/use-resolved-props.js.map +1 -1
  343. package/dist/esm/runtimes/react/hooks/use-resource-resolver.js +1 -1
  344. package/dist/esm/runtimes/react/hooks/use-resource-resolver.js.map +1 -1
  345. package/dist/esm/runtimes/react/hooks/use-selector.js.map +1 -1
  346. package/dist/esm/runtimes/react/hooks/use-store.js.map +1 -1
  347. package/dist/esm/runtimes/react/hooks/use-universal-dispatch.js.map +1 -1
  348. package/dist/esm/runtimes/react/host-api-client.js +2 -3
  349. package/dist/esm/runtimes/react/host-api-client.js.map +1 -1
  350. package/dist/esm/runtimes/react/index.js +2 -2
  351. package/dist/esm/runtimes/react/index.js.map +1 -1
  352. package/dist/esm/runtimes/react/lib/resolved-style-to-css.js +38 -0
  353. package/dist/esm/runtimes/react/lib/resolved-style-to-css.js.map +1 -0
  354. package/dist/esm/runtimes/react/poll-box-model.js +1 -1
  355. package/dist/esm/runtimes/react/poll-box-model.js.map +1 -1
  356. package/dist/esm/runtimes/react/react-runtime-core.js +1 -4
  357. package/dist/esm/runtimes/react/react-runtime-core.js.map +1 -1
  358. package/dist/esm/runtimes/react/runtime-core.js +5 -3
  359. package/dist/esm/runtimes/react/runtime-core.js.map +1 -1
  360. package/dist/esm/runtimes/react/testing/react-runtime.js +3 -2
  361. package/dist/esm/runtimes/react/testing/react-runtime.js.map +1 -1
  362. package/dist/esm/runtimes/react/utils/can-accept-ref.js.map +1 -1
  363. package/dist/esm/runtimes/react/utils/google-fonts-url.js +23 -0
  364. package/dist/esm/runtimes/react/utils/google-fonts-url.js.map +1 -0
  365. package/dist/esm/state/actions/internal/read-only-actions.js +21 -14
  366. package/dist/esm/state/actions/internal/read-only-actions.js.map +1 -1
  367. package/dist/esm/state/actions/internal/read-write-actions.js +6 -1
  368. package/dist/esm/state/actions/internal/read-write-actions.js.map +1 -1
  369. package/dist/esm/state/actions/internal.js +162 -0
  370. package/dist/esm/state/actions/internal.js.map +1 -0
  371. package/dist/esm/state/builder-api/actions.js +7 -8
  372. package/dist/esm/state/builder-api/actions.js.map +1 -1
  373. package/dist/esm/state/builder-api/api.js +1 -0
  374. package/dist/esm/state/builder-api/api.js.map +1 -0
  375. package/dist/esm/state/builder-api/navigation-listener.js +86 -0
  376. package/dist/esm/state/builder-api/navigation-listener.js.map +1 -0
  377. package/dist/esm/state/host-api.js.map +1 -1
  378. package/dist/esm/state/makeswift-api-client.js +19 -33
  379. package/dist/esm/state/makeswift-api-client.js.map +1 -1
  380. package/dist/esm/state/middleware/{read-write/makeswift-api-client-sync.js → makeswift-api-client-sync.js} +1 -1
  381. package/dist/esm/state/middleware/makeswift-api-client-sync.js.map +1 -0
  382. package/dist/esm/state/middleware/read-write/builder-api/index.js +11 -2
  383. package/dist/esm/state/middleware/read-write/builder-api/index.js.map +1 -1
  384. package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js +3 -0
  385. package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -1
  386. package/dist/esm/state/middleware/read-write/index.js +16 -0
  387. package/dist/esm/state/middleware/read-write/index.js.map +1 -0
  388. package/dist/esm/state/middleware/{prop-controller-handles.js → read-write/prop-controller-handles.js} +8 -8
  389. package/dist/esm/state/middleware/read-write/prop-controller-handles.js.map +1 -0
  390. package/dist/esm/state/mixins/breakpoint-watch.js +48 -0
  391. package/dist/esm/state/mixins/breakpoint-watch.js.map +1 -0
  392. package/dist/esm/state/modules/api-resources.js +5 -8
  393. package/dist/esm/state/modules/api-resources.js.map +1 -1
  394. package/dist/esm/state/modules/box-models.js +98 -0
  395. package/dist/esm/state/modules/box-models.js.map +1 -0
  396. package/dist/esm/state/modules/breakpoints.js +2 -3
  397. package/dist/esm/state/modules/breakpoints.js.map +1 -1
  398. package/dist/esm/state/modules/builder-edit-mode.js +2 -3
  399. package/dist/esm/state/modules/builder-edit-mode.js.map +1 -1
  400. package/dist/esm/state/modules/components-meta.js +3 -4
  401. package/dist/esm/state/modules/components-meta.js.map +1 -1
  402. package/dist/esm/state/modules/element-imperative-handles.js +35 -0
  403. package/dist/esm/state/modules/element-imperative-handles.js.map +1 -0
  404. package/dist/esm/state/modules/element-trees.js +4 -6
  405. package/dist/esm/state/modules/element-trees.js.map +1 -1
  406. package/dist/esm/state/modules/is-in-builder.js +2 -3
  407. package/dist/esm/state/modules/is-in-builder.js.map +1 -1
  408. package/dist/esm/state/modules/is-preview.js +21 -0
  409. package/dist/esm/state/modules/is-preview.js.map +1 -0
  410. package/dist/esm/state/modules/locale.js +1 -4
  411. package/dist/esm/state/modules/locale.js.map +1 -1
  412. package/dist/esm/state/modules/localized-resources-map.js +3 -5
  413. package/dist/esm/state/modules/localized-resources-map.js.map +1 -1
  414. package/dist/esm/state/modules/pointer.js +22 -0
  415. package/dist/esm/state/modules/pointer.js.map +1 -0
  416. package/dist/esm/state/modules/prop-controllers.js +3 -4
  417. package/dist/esm/state/modules/prop-controllers.js.map +1 -1
  418. package/dist/esm/state/modules/react-components.js +3 -4
  419. package/dist/esm/state/modules/react-components.js.map +1 -1
  420. package/dist/esm/state/modules/read-only-documents.js +6 -4
  421. package/dist/esm/state/modules/read-only-documents.js.map +1 -1
  422. package/dist/esm/state/modules/read-write/box-models.js +16 -2
  423. package/dist/esm/state/modules/read-write/box-models.js.map +1 -1
  424. package/dist/esm/state/modules/read-write-documents.js +60 -0
  425. package/dist/esm/state/modules/read-write-documents.js.map +1 -0
  426. package/dist/esm/state/modules/site-version.js +0 -3
  427. package/dist/esm/state/modules/site-version.js.map +1 -1
  428. package/dist/esm/state/react-builder-preview.js +500 -15
  429. package/dist/esm/state/react-builder-preview.js.map +1 -1
  430. package/dist/esm/state/react-page.js +240 -7
  431. package/dist/esm/state/react-page.js.map +1 -1
  432. package/dist/esm/state/read-only-state.js +20 -1
  433. package/dist/esm/state/read-only-state.js.map +1 -1
  434. package/dist/esm/state/read-write-state.js +7 -1
  435. package/dist/esm/state/read-write-state.js.map +1 -1
  436. package/dist/esm/state/shared-api.js.map +1 -1
  437. package/dist/esm/state/store.js +188 -0
  438. package/dist/esm/state/store.js.map +1 -0
  439. package/dist/esm/state/translations/get.js +1 -1
  440. package/dist/esm/state/translations/get.js.map +1 -1
  441. package/dist/esm/state/translations/merge.js +1 -1
  442. package/dist/esm/state/translations/merge.js.map +1 -1
  443. package/dist/esm/state/unified-state.js +1 -0
  444. package/dist/esm/state/unified-state.js.map +1 -0
  445. package/dist/esm/translations/index.js +7 -0
  446. package/dist/esm/translations/index.js.map +1 -0
  447. package/dist/esm/unstable-framework-support/index.js +4 -2
  448. package/dist/esm/unstable-framework-support/index.js.map +1 -1
  449. package/dist/esm/utils/deferred.js +15 -0
  450. package/dist/esm/utils/deferred.js.map +1 -0
  451. package/dist/esm/utils/ref-counted-map.js +96 -0
  452. package/dist/esm/utils/ref-counted-map.js.map +1 -0
  453. package/dist/types/api/client.d.ts +2 -5
  454. package/dist/types/api/client.d.ts.map +1 -1
  455. package/dist/types/api/react.d.ts +82 -0
  456. package/dist/types/api/react.d.ts.map +1 -0
  457. package/dist/types/api-handler/handlers/element-tree.d.ts +1 -1
  458. package/dist/types/api-handler/handlers/element-tree.d.ts.map +1 -1
  459. package/dist/types/api-handler/handlers/merge-translated-data.d.ts +1 -1
  460. package/dist/types/api-handler/handlers/merge-translated-data.d.ts.map +1 -1
  461. package/dist/types/api-handler/handlers/translatable-data.d.ts +1 -1
  462. package/dist/types/api-handler/handlers/translatable-data.d.ts.map +1 -1
  463. package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts +201 -0
  464. package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts.map +1 -0
  465. package/dist/types/api-handler/handlers/webhook/types.d.ts +4 -4
  466. package/dist/types/builder/host-to-builder-actions.d.ts +2 -2
  467. package/dist/types/builder/host-to-builder-actions.d.ts.map +1 -1
  468. package/dist/types/builder/index.d.ts +2 -2
  469. package/dist/types/builder/index.d.ts.map +1 -1
  470. package/dist/types/builder/serialization.d.ts +23 -0
  471. package/dist/types/builder/serialization.d.ts.map +1 -0
  472. package/dist/types/builder/serialization.test.d.ts +2 -0
  473. package/dist/types/builder/serialization.test.d.ts.map +1 -0
  474. package/dist/types/client/index.d.ts +2 -2
  475. package/dist/types/client/index.d.ts.map +1 -1
  476. package/dist/types/client/tests/client.get-component-snapshots.test.d.ts +2 -0
  477. package/dist/types/client/tests/client.get-component-snapshots.test.d.ts.map +1 -0
  478. package/dist/types/client/tests/client.get-fonts.test.d.ts +2 -0
  479. package/dist/types/client/tests/client.get-fonts.test.d.ts.map +1 -0
  480. package/dist/types/client/tests/client.introspect-many.test.d.ts +2 -0
  481. package/dist/types/client/tests/client.introspect-many.test.d.ts.map +1 -0
  482. package/dist/types/components/builtin/Box/Box.d.ts +1 -1
  483. package/dist/types/components/builtin/Box/Box.d.ts.map +1 -1
  484. package/dist/types/components/builtin/Form/Form.d.ts +1 -1
  485. package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
  486. package/dist/types/components/hooks/__tests__/useMediaQuery.test.d.ts +3 -0
  487. package/dist/types/components/hooks/__tests__/useMediaQuery.test.d.ts.map +1 -0
  488. package/dist/types/controls/serialization/base/index.d.ts +10 -0
  489. package/dist/types/controls/serialization/base/index.d.ts.map +1 -0
  490. package/dist/types/controls/serialization/base/visitor.d.ts +7 -0
  491. package/dist/types/controls/serialization/base/visitor.d.ts.map +1 -0
  492. package/dist/types/controls/serialization/index.d.ts +10 -0
  493. package/dist/types/controls/serialization/index.d.ts.map +1 -0
  494. package/dist/types/controls/serialization/message-port/function-serialization.d.ts +16 -0
  495. package/dist/types/controls/serialization/message-port/function-serialization.d.ts.map +1 -0
  496. package/dist/types/controls/serialization/message-port/function-serialization.test.d.ts +2 -0
  497. package/dist/types/controls/serialization/message-port/function-serialization.test.d.ts.map +1 -0
  498. package/dist/types/controls/serialization/message-port/index.d.ts +3 -0
  499. package/dist/types/controls/serialization/message-port/index.d.ts.map +1 -0
  500. package/dist/types/controls/serialization/message-port/visitor.d.ts +7 -0
  501. package/dist/types/controls/serialization/message-port/visitor.d.ts.map +1 -0
  502. package/dist/types/locale.d.ts +1 -1
  503. package/dist/types/next/api-handler/config/app-router.d.ts.map +1 -1
  504. package/dist/types/next/api-handler/config/pages-router.test.d.ts +2 -0
  505. package/dist/types/next/api-handler/config/pages-router.test.d.ts.map +1 -0
  506. package/dist/types/next/components/framework-provider/index.d.ts.map +1 -1
  507. package/dist/types/next/components/tests/controls/code-control.test.d.ts +2 -0
  508. package/dist/types/next/components/tests/controls/code-control.test.d.ts.map +1 -0
  509. package/dist/types/next/components/tests/controls/color-control/fixtures.d.ts +1 -1
  510. package/dist/types/next/components/tests/controls/color-control/fixtures.d.ts.map +1 -1
  511. package/dist/types/next/components/tests/controls/page-control-prop-rendering.d.ts +3 -3
  512. package/dist/types/next/components/tests/controls/page-control-prop-rendering.d.ts.map +1 -1
  513. package/dist/types/next/components/tests/controls/rich-text-v2-control/fixtures.d.ts +1 -1
  514. package/dist/types/next/components/tests/controls/rich-text-v2-control/fixtures.d.ts.map +1 -1
  515. package/dist/types/next/components/tests/makeswift-component/fixtures.d.ts +1 -1
  516. package/dist/types/next/components/tests/makeswift-component/fixtures.d.ts.map +1 -1
  517. package/dist/types/next/components/tests/prop-controllers/page-prop-controller.d.ts +1 -1
  518. package/dist/types/next/components/tests/prop-controllers/page-prop-controller.d.ts.map +1 -1
  519. package/dist/types/next/fetch.d.ts +3 -0
  520. package/dist/types/next/fetch.d.ts.map +1 -0
  521. package/dist/types/next/runtime.d.ts +10 -0
  522. package/dist/types/next/runtime.d.ts.map +1 -0
  523. package/dist/types/next/testing/element-data.d.ts +1 -1
  524. package/dist/types/next/testing/element-data.d.ts.map +1 -1
  525. package/dist/types/next/testing/index.d.ts +0 -1
  526. package/dist/types/next/testing/index.d.ts.map +1 -1
  527. package/dist/types/next/testing/page-rendering.d.ts.map +1 -1
  528. package/dist/types/prop-controllers/descriptors.d.ts +1 -1
  529. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
  530. package/dist/types/prop-controllers/instances.d.ts +1 -1
  531. package/dist/types/prop-controllers/instances.d.ts.map +1 -1
  532. package/dist/types/prop-controllers/serialization.d.ts +228 -0
  533. package/dist/types/prop-controllers/serialization.d.ts.map +1 -0
  534. package/dist/types/runtimes/react/components/Document.d.ts +1 -1
  535. package/dist/types/runtimes/react/components/Document.d.ts.map +1 -1
  536. package/dist/types/runtimes/react/components/DocumentRoot.d.ts +1 -1
  537. package/dist/types/runtimes/react/components/DocumentRoot.d.ts.map +1 -1
  538. package/dist/types/runtimes/react/components/Element.d.ts +1 -1
  539. package/dist/types/runtimes/react/components/Element.d.ts.map +1 -1
  540. package/dist/types/runtimes/react/components/ElementData.d.ts +1 -1
  541. package/dist/types/runtimes/react/components/ElementData.d.ts.map +1 -1
  542. package/dist/types/runtimes/react/components/ElementReference.d.ts +1 -1
  543. package/dist/types/runtimes/react/components/ElementReference.d.ts.map +1 -1
  544. package/dist/types/runtimes/react/components/GoogleFontLink.d.ts +14 -0
  545. package/dist/types/runtimes/react/components/GoogleFontLink.d.ts.map +1 -0
  546. package/dist/types/runtimes/react/components/MakeswiftFonts.d.ts +7 -0
  547. package/dist/types/runtimes/react/components/MakeswiftFonts.d.ts.map +1 -0
  548. package/dist/types/runtimes/react/components/RuntimeProvider.d.ts +1 -1
  549. package/dist/types/runtimes/react/components/RuntimeProvider.d.ts.map +1 -1
  550. package/dist/types/runtimes/react/components/framework-context.d.ts +4 -2
  551. package/dist/types/runtimes/react/components/framework-context.d.ts.map +1 -1
  552. package/dist/types/runtimes/react/components/page/Page.d.ts +1 -1
  553. package/dist/types/runtimes/react/components/page/Page.d.ts.map +1 -1
  554. package/dist/types/runtimes/react/controls.d.ts +2 -2
  555. package/dist/types/runtimes/react/controls.d.ts.map +1 -1
  556. package/dist/types/runtimes/react/element-imperative-handle.d.ts +1 -1
  557. package/dist/types/runtimes/react/element-imperative-handle.d.ts.map +1 -1
  558. package/dist/types/runtimes/react/hooks/__tests__/use-async-effect.test.d.ts +2 -0
  559. package/dist/types/runtimes/react/hooks/__tests__/use-async-effect.test.d.ts.map +1 -0
  560. package/dist/types/runtimes/react/hooks/use-async-effect.d.ts +3 -0
  561. package/dist/types/runtimes/react/hooks/use-async-effect.d.ts.map +1 -0
  562. package/dist/types/runtimes/react/hooks/use-cache-data.d.ts +1 -1
  563. package/dist/types/runtimes/react/hooks/use-cache-data.d.ts.map +1 -1
  564. package/dist/types/runtimes/react/hooks/use-component.d.ts +1 -1
  565. package/dist/types/runtimes/react/hooks/use-component.d.ts.map +1 -1
  566. package/dist/types/runtimes/react/hooks/use-current-breakpoint.d.ts +3 -0
  567. package/dist/types/runtimes/react/hooks/use-current-breakpoint.d.ts.map +1 -0
  568. package/dist/types/runtimes/react/hooks/use-dispatch.d.ts +3 -3
  569. package/dist/types/runtimes/react/hooks/use-dispatch.d.ts.map +1 -1
  570. package/dist/types/runtimes/react/hooks/use-document.d.ts +1 -1
  571. package/dist/types/runtimes/react/hooks/use-document.d.ts.map +1 -1
  572. package/dist/types/runtimes/react/hooks/use-is-preview.d.ts +2 -0
  573. package/dist/types/runtimes/react/hooks/use-is-preview.d.ts.map +1 -0
  574. package/dist/types/runtimes/react/hooks/use-register-document.d.ts +1 -1
  575. package/dist/types/runtimes/react/hooks/use-register-document.d.ts.map +1 -1
  576. package/dist/types/runtimes/react/hooks/use-selector.d.ts +3 -3
  577. package/dist/types/runtimes/react/hooks/use-selector.d.ts.map +1 -1
  578. package/dist/types/runtimes/react/hooks/use-store.d.ts +4 -4
  579. package/dist/types/runtimes/react/hooks/use-store.d.ts.map +1 -1
  580. package/dist/types/runtimes/react/hooks/use-universal-dispatch.d.ts +1 -1
  581. package/dist/types/runtimes/react/hooks/use-universal-dispatch.d.ts.map +1 -1
  582. package/dist/types/runtimes/react/host-api-client.d.ts +1 -1
  583. package/dist/types/runtimes/react/host-api-client.d.ts.map +1 -1
  584. package/dist/types/runtimes/react/index.d.ts +1 -1
  585. package/dist/types/runtimes/react/index.d.ts.map +1 -1
  586. package/dist/types/runtimes/react/lib/resolved-style-to-css.d.ts +4 -0
  587. package/dist/types/runtimes/react/lib/resolved-style-to-css.d.ts.map +1 -0
  588. package/dist/types/runtimes/react/poll-box-model.d.ts +1 -1
  589. package/dist/types/runtimes/react/poll-box-model.d.ts.map +1 -1
  590. package/dist/types/runtimes/react/react-runtime-core.d.ts +1 -1
  591. package/dist/types/runtimes/react/react-runtime-core.d.ts.map +1 -1
  592. package/dist/types/runtimes/react/runtime-core.d.ts +1 -2
  593. package/dist/types/runtimes/react/runtime-core.d.ts.map +1 -1
  594. package/dist/types/runtimes/react/testing/react-runtime.d.ts +4 -1
  595. package/dist/types/runtimes/react/testing/react-runtime.d.ts.map +1 -1
  596. package/dist/types/runtimes/react/utils/can-accept-ref.d.ts +1 -1
  597. package/dist/types/runtimes/react/utils/can-accept-ref.d.ts.map +1 -1
  598. package/dist/types/runtimes/react/utils/google-fonts-url.d.ts +6 -0
  599. package/dist/types/runtimes/react/utils/google-fonts-url.d.ts.map +1 -0
  600. package/dist/types/state/__tests__/fixtures/serialized-descriptors-from-builder.d.ts +5 -0
  601. package/dist/types/state/__tests__/fixtures/serialized-descriptors-from-builder.d.ts.map +1 -0
  602. package/dist/types/state/__tests__/fixtures/translatable-content-sample.d.ts +3 -0
  603. package/dist/types/state/__tests__/fixtures/translatable-content-sample.d.ts.map +1 -0
  604. package/dist/types/state/__tests__/get-translatable-content.test.d.ts +2 -0
  605. package/dist/types/state/__tests__/get-translatable-content.test.d.ts.map +1 -0
  606. package/dist/types/state/__tests__/react-page.test.d.ts +2 -0
  607. package/dist/types/state/__tests__/react-page.test.d.ts.map +1 -0
  608. package/dist/types/state/__tests__/store.read-write-state.test.d.ts +2 -0
  609. package/dist/types/state/__tests__/store.read-write-state.test.d.ts.map +1 -0
  610. package/dist/types/state/__tests__/test-store.d.ts +31 -0
  611. package/dist/types/state/__tests__/test-store.d.ts.map +1 -0
  612. package/dist/types/state/actions/index.d.ts +5 -8
  613. package/dist/types/state/actions/index.d.ts.map +1 -1
  614. package/dist/types/state/actions/internal/index.d.ts +4 -2
  615. package/dist/types/state/actions/internal/index.d.ts.map +1 -1
  616. package/dist/types/state/actions/internal/read-only-actions.d.ts +25 -13
  617. package/dist/types/state/actions/internal/read-only-actions.d.ts.map +1 -1
  618. package/dist/types/state/actions/internal/read-write-actions.d.ts +6 -1
  619. package/dist/types/state/actions/internal/read-write-actions.d.ts.map +1 -1
  620. package/dist/types/state/actions/internal.d.ts +181 -0
  621. package/dist/types/state/actions/internal.d.ts.map +1 -0
  622. package/dist/types/state/builder-api/actions.d.ts +14 -14
  623. package/dist/types/state/builder-api/actions.d.ts.map +1 -1
  624. package/dist/types/state/builder-api/api.d.ts +9 -0
  625. package/dist/types/state/builder-api/api.d.ts.map +1 -0
  626. package/dist/types/state/builder-api/navigation-listener.d.ts +3 -0
  627. package/dist/types/state/builder-api/navigation-listener.d.ts.map +1 -0
  628. package/dist/types/state/host-api.d.ts +1 -1
  629. package/dist/types/state/host-api.d.ts.map +1 -1
  630. package/dist/types/state/makeswift-api-client.d.ts +2 -11
  631. package/dist/types/state/makeswift-api-client.d.ts.map +1 -1
  632. package/dist/types/state/middleware/makeswift-api-client-sync.d.ts +5 -0
  633. package/dist/types/state/middleware/makeswift-api-client-sync.d.ts.map +1 -0
  634. package/dist/types/state/middleware/read-write/builder-api/index.d.ts.map +1 -1
  635. package/dist/types/state/middleware/read-write/builder-api/initialize-connection.d.ts.map +1 -1
  636. package/dist/types/state/middleware/read-write/index.d.ts +5 -0
  637. package/dist/types/state/middleware/read-write/index.d.ts.map +1 -0
  638. package/dist/types/state/middleware/{prop-controller-handles.d.ts → read-write/prop-controller-handles.d.ts} +1 -1
  639. package/dist/types/state/middleware/read-write/prop-controller-handles.d.ts.map +1 -0
  640. package/dist/types/state/mixins/breakpoint-watch.d.ts +11 -0
  641. package/dist/types/state/mixins/breakpoint-watch.d.ts.map +1 -0
  642. package/dist/types/state/modules/api-resources.d.ts.map +1 -1
  643. package/dist/types/state/modules/box-models.d.ts +23 -0
  644. package/dist/types/state/modules/box-models.d.ts.map +1 -0
  645. package/dist/types/state/modules/breakpoints.d.ts.map +1 -1
  646. package/dist/types/state/modules/builder-edit-mode.d.ts.map +1 -1
  647. package/dist/types/state/modules/components-meta.d.ts.map +1 -1
  648. package/dist/types/state/modules/element-imperative-handles.d.ts +7 -0
  649. package/dist/types/state/modules/element-imperative-handles.d.ts.map +1 -0
  650. package/dist/types/state/modules/element-trees.d.ts.map +1 -1
  651. package/dist/types/state/modules/is-in-builder.d.ts.map +1 -1
  652. package/dist/types/state/modules/is-preview.d.ts +6 -0
  653. package/dist/types/state/modules/is-preview.d.ts.map +1 -0
  654. package/dist/types/state/modules/locale.d.ts.map +1 -1
  655. package/dist/types/state/modules/localized-resources-map.d.ts.map +1 -1
  656. package/dist/types/state/modules/pointer.d.ts +12 -0
  657. package/dist/types/state/modules/pointer.d.ts.map +1 -0
  658. package/dist/types/state/modules/prop-controllers.d.ts.map +1 -1
  659. package/dist/types/state/modules/react-components.d.ts.map +1 -1
  660. package/dist/types/state/modules/read-only-documents.d.ts.map +1 -1
  661. package/dist/types/state/modules/read-write/box-models.d.ts +12 -9
  662. package/dist/types/state/modules/read-write/box-models.d.ts.map +1 -1
  663. package/dist/types/state/modules/read-write-documents.d.ts +14 -0
  664. package/dist/types/state/modules/read-write-documents.d.ts.map +1 -0
  665. package/dist/types/state/modules/site-version.d.ts.map +1 -1
  666. package/dist/types/state/react-builder-preview.d.ts +93 -26
  667. package/dist/types/state/react-builder-preview.d.ts.map +1 -1
  668. package/dist/types/state/react-page.d.ts +136 -20
  669. package/dist/types/state/react-page.d.ts.map +1 -1
  670. package/dist/types/state/read-only-state.d.ts +10 -1
  671. package/dist/types/state/read-only-state.d.ts.map +1 -1
  672. package/dist/types/state/read-write-state.d.ts +12 -6
  673. package/dist/types/state/read-write-state.d.ts.map +1 -1
  674. package/dist/types/state/shared-api.d.ts.map +1 -1
  675. package/dist/types/state/store.d.ts +86 -0
  676. package/dist/types/state/store.d.ts.map +1 -0
  677. package/dist/types/state/translations/get.d.ts +1 -1
  678. package/dist/types/state/translations/get.d.ts.map +1 -1
  679. package/dist/types/state/translations/merge.d.ts +1 -1
  680. package/dist/types/state/translations/merge.d.ts.map +1 -1
  681. package/dist/types/state/unified-state.d.ts +9 -0
  682. package/dist/types/state/unified-state.d.ts.map +1 -0
  683. package/dist/types/translations/index.d.ts +6 -0
  684. package/dist/types/translations/index.d.ts.map +1 -0
  685. package/dist/types/unstable-framework-support/index.d.ts +1 -1
  686. package/dist/types/unstable-framework-support/index.d.ts.map +1 -1
  687. package/dist/types/utils/__tests__/ref-counted-map.test.d.ts +2 -0
  688. package/dist/types/utils/__tests__/ref-counted-map.test.d.ts.map +1 -0
  689. package/dist/types/utils/deferred.d.ts +7 -0
  690. package/dist/types/utils/deferred.d.ts.map +1 -0
  691. package/dist/types/utils/ref-counted-map.d.ts +32 -0
  692. package/dist/types/utils/ref-counted-map.d.ts.map +1 -0
  693. package/package.json +3 -3
  694. package/dist/cjs/state/middleware/prop-controller-handles.js.map +0 -1
  695. package/dist/cjs/state/middleware/read-write/makeswift-api-client-sync.js.map +0 -1
  696. package/dist/esm/state/middleware/prop-controller-handles.js.map +0 -1
  697. package/dist/esm/state/middleware/read-write/makeswift-api-client-sync.js.map +0 -1
  698. package/dist/types/state/middleware/prop-controller-handles.d.ts.map +0 -1
  699. package/dist/types/state/middleware/read-write/makeswift-api-client-sync.d.ts +0 -5
  700. package/dist/types/state/middleware/read-write/makeswift-api-client-sync.d.ts.map +0 -1
@@ -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/client";
4
+ import { MakeswiftHostApiClient } from "../../api/react";
5
5
  const Context = createContext(
6
6
  new MakeswiftHostApiClient({
7
7
  uri: "https://api.makeswift.com/graphql",
@@ -11,8 +11,7 @@ const Context = createContext(
11
11
  { url }
12
12
  );
13
13
  return fetch(url, init);
14
- },
15
- siteVersion: null
14
+ }
16
15
  })
17
16
  );
18
17
  function useMakeswiftHostApiClient() {
@@ -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/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 siteVersion: null,\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":";AA8BS;AA5BT,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,IACA,aAAa;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/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":[]}
@@ -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 { useIsReadOnly } from "./hooks/use-is-read-only";
10
+ import { useIsPreview } from "./hooks/use-is-preview";
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
- useIsReadOnly,
24
+ useIsPreview,
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 { 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
+ {"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":[]}
@@ -0,0 +1,38 @@
1
+ import {
2
+ getBaseBreakpoint,
3
+ getBreakpointMediaQuery
4
+ } from "@makeswift/controls";
5
+ import { styleV1Css } from "../controls/style";
6
+ import { typographyCss } from "../controls/typography";
7
+ function isTypographyStyle(style) {
8
+ return Array.isArray(style);
9
+ }
10
+ function isStyleV2(style) {
11
+ return typeof style === "object" && "getStyle" in style && typeof style.getStyle === "function";
12
+ }
13
+ function styleV2Css(breakpoints, style) {
14
+ return {
15
+ ...style.getStyle(getBaseBreakpoint(breakpoints)),
16
+ ...breakpoints.reduce(
17
+ (styles, breakpoint) => ({
18
+ ...styles,
19
+ [getBreakpointMediaQuery(breakpoint)]: style.getStyle(breakpoint)
20
+ }),
21
+ {}
22
+ )
23
+ };
24
+ }
25
+ function resolvedStyleToCss(breakpoints, style) {
26
+ if (isTypographyStyle(style)) {
27
+ return typographyCss(breakpoints, style);
28
+ }
29
+ if (isStyleV2(style)) {
30
+ return styleV2Css(breakpoints, style);
31
+ }
32
+ const { properties, styleData } = style;
33
+ return styleV1Css(breakpoints, styleData, properties);
34
+ }
35
+ export {
36
+ resolvedStyleToCss
37
+ };
38
+ //# sourceMappingURL=resolved-style-to-css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/lib/resolved-style-to-css.ts"],"sourcesContent":["import { type CSSObject } from '@emotion/serialize'\n\nimport {\n type Breakpoints,\n type ResolvedStyle,\n type ResolvedStyleV2,\n type ResolvedTypographyStyle,\n getBaseBreakpoint,\n getBreakpointMediaQuery,\n} from '@makeswift/controls'\n\nimport { styleV1Css } from '../controls/style'\nimport { typographyCss } from '../controls/typography'\n\nfunction isTypographyStyle(style: ResolvedStyle): style is ResolvedTypographyStyle {\n return Array.isArray(style)\n}\n\nfunction isStyleV2(style: ResolvedStyle): style is ResolvedStyleV2 {\n return typeof style === 'object' && 'getStyle' in style && typeof style.getStyle === 'function'\n}\n\nfunction styleV2Css(breakpoints: Breakpoints, style: ResolvedStyleV2<CSSObject>): CSSObject {\n return {\n ...style.getStyle(getBaseBreakpoint(breakpoints)),\n ...breakpoints.reduce(\n (styles, breakpoint) => ({\n ...styles,\n [getBreakpointMediaQuery(breakpoint)]: style.getStyle(breakpoint),\n }),\n {},\n ),\n }\n}\n\nexport function resolvedStyleToCss(breakpoints: Breakpoints, style: ResolvedStyle): CSSObject {\n if (isTypographyStyle(style)) {\n return typographyCss(breakpoints, style)\n }\n\n if (isStyleV2(style)) {\n return styleV2Css(breakpoints, style as ResolvedStyleV2<CSSObject>)\n }\n\n const { properties, styleData } = style\n return styleV1Css(breakpoints, styleData, properties)\n}\n"],"mappings":"AAEA;AAAA,EAKE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAE9B,SAAS,kBAAkB,OAAwD;AACjF,SAAO,MAAM,QAAQ,KAAK;AAC5B;AAEA,SAAS,UAAU,OAAgD;AACjE,SAAO,OAAO,UAAU,YAAY,cAAc,SAAS,OAAO,MAAM,aAAa;AACvF;AAEA,SAAS,WAAW,aAA0B,OAA8C;AAC1F,SAAO;AAAA,IACL,GAAG,MAAM,SAAS,kBAAkB,WAAW,CAAC;AAAA,IAChD,GAAG,YAAY;AAAA,MACb,CAAC,QAAQ,gBAAgB;AAAA,QACvB,GAAG;AAAA,QACH,CAAC,wBAAwB,UAAU,CAAC,GAAG,MAAM,SAAS,UAAU;AAAA,MAClE;AAAA,MACA,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,SAAS,mBAAmB,aAA0B,OAAiC;AAC5F,MAAI,kBAAkB,KAAK,GAAG;AAC5B,WAAO,cAAc,aAAa,KAAK;AAAA,EACzC;AAEA,MAAI,UAAU,KAAK,GAAG;AACpB,WAAO,WAAW,aAAa,KAAmC;AAAA,EACpE;AAEA,QAAM,EAAE,YAAY,UAAU,IAAI;AAClC,SAAO,WAAW,aAAa,WAAW,UAAU;AACtD;","names":[]}
@@ -1,4 +1,4 @@
1
- import { getBox } from "../../state/modules/read-write/box-models";
1
+ import { getBox } from "../../state/modules/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/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
+ {"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,8 +1,5 @@
1
1
  import { supportsActivity } from "./components/activity-with-fallback";
2
- import {
3
- registerComponentEffect,
4
- registerReactComponentEffect
5
- } from "../../state/actions/internal/read-only-actions";
2
+ import { registerComponentEffect, registerReactComponentEffect } from "../../state/actions/internal";
6
3
  import { ComponentIcon } from "../../state/modules/components-meta";
7
4
  import { RuntimeCore } from "./runtime-core";
8
5
  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 {\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
+ {"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,9 +1,11 @@
1
1
  import {
2
2
  parseBreakpointsInput
3
3
  } from "../../state/modules/breakpoints";
4
- import { copyElementTree } from "../../state/ops/copy-element-tree";
5
- import { getBreakpoints } from "../../state/read-only-state";
6
- import { configureStore } from "../../state/react-page";
4
+ import {
5
+ configureStore,
6
+ copyElementTree,
7
+ getBreakpoints
8
+ } from "../../state/react-page";
7
9
  class RuntimeCore {
8
10
  store;
9
11
  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 { 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":[]}
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,6 +1,7 @@
1
+ import { TestOrigins } from "../../../testing/fixtures";
1
2
  import { ReactRuntime } from "../react-runtime";
2
- function createReactRuntime() {
3
- return new ReactRuntime();
3
+ function createReactRuntime({ breakpoints } = {}) {
4
+ return new ReactRuntime({ fetch, breakpoints, ...TestOrigins });
4
5
  }
5
6
  export {
6
7
  createReactRuntime
@@ -1 +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
+ {"version":3,"sources":["../../../../../src/runtimes/react/testing/react-runtime.tsx"],"sourcesContent":["import { type BreakpointsInput } from '../../../state/modules/breakpoints'\nimport { TestOrigins } from '../../../testing/fixtures'\nimport { ReactRuntime } from '../react-runtime'\n\nexport function createReactRuntime({ breakpoints }: { breakpoints?: BreakpointsInput } = {}) {\n return new ReactRuntime({ fetch, breakpoints, ...TestOrigins })\n}\n"],"mappings":"AACA,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAEtB,SAAS,mBAAmB,EAAE,YAAY,IAAwC,CAAC,GAAG;AAC3F,SAAO,IAAI,aAAa,EAAE,OAAO,aAAa,GAAG,YAAY,CAAC;AAChE;","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/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":[]}
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":[]}
@@ -0,0 +1,23 @@
1
+ const GOOGLE_FONTS_BASE = "https://fonts.googleapis.com/css";
2
+ function getGoogleFontsParamFromFonts(fonts) {
3
+ return fonts.map(({ family, variants }) => `${family.replace(/ /g, "+")}:${variants.join()}`).join("|");
4
+ }
5
+ function getGoogleFontsParamFromSite(site) {
6
+ return site.googleFonts.edges.filter((edge) => edge != null).map(({ activeVariants, node: { family, variants } }) => {
7
+ const activeVariantSpecifiers = variants.filter(
8
+ (variant) => activeVariants.some((activeVariant) => activeVariant.specifier === variant.specifier)
9
+ ).map((variant) => variant.specifier).join();
10
+ return `${family.replace(/ /g, "+")}:${activeVariantSpecifiers}`;
11
+ }).join("|");
12
+ }
13
+ function getGoogleFontsUrl(param) {
14
+ if (param === "")
15
+ return "";
16
+ return `${GOOGLE_FONTS_BASE}?family=${param}&display=swap`;
17
+ }
18
+ export {
19
+ getGoogleFontsParamFromFonts,
20
+ getGoogleFontsParamFromSite,
21
+ getGoogleFontsUrl
22
+ };
23
+ //# sourceMappingURL=google-fonts-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/utils/google-fonts-url.ts"],"sourcesContent":["import { type Site } from '../../../api'\nimport { type Font } from '../../../client'\n\n/*\n Much of the logic here is a duplicate of what's done for font management in the\n `PageHead` component.\n\n Right now these utils are being used by an experimental component (`GoogleFontLink`)\n that we don't yet want to put on the critical path for rendering Makeswift pages.\n*/\n\nconst GOOGLE_FONTS_BASE = 'https://fonts.googleapis.com/css'\n\nexport function getGoogleFontsParamFromFonts(fonts: Font[]): string {\n return fonts\n .map(({ family, variants }) => `${family.replace(/ /g, '+')}:${variants.join()}`)\n .join('|')\n}\n\nexport function getGoogleFontsParamFromSite(site: Site): string {\n return site.googleFonts.edges\n .filter((edge): edge is NonNullable<typeof edge> => edge != null)\n .map(({ activeVariants, node: { family, variants } }) => {\n const activeVariantSpecifiers = variants\n .filter(variant =>\n activeVariants.some(activeVariant => activeVariant.specifier === variant.specifier),\n )\n .map(variant => variant.specifier)\n .join()\n return `${family.replace(/ /g, '+')}:${activeVariantSpecifiers}`\n })\n .join('|')\n}\n\nexport function getGoogleFontsUrl(param: string): string {\n if (param === '') return ''\n return `${GOOGLE_FONTS_BASE}?family=${param}&display=swap`\n}\n"],"mappings":"AAWA,MAAM,oBAAoB;AAEnB,SAAS,6BAA6B,OAAuB;AAClE,SAAO,MACJ,IAAI,CAAC,EAAE,QAAQ,SAAS,MAAM,GAAG,OAAO,QAAQ,MAAM,GAAG,CAAC,IAAI,SAAS,KAAK,CAAC,EAAE,EAC/E,KAAK,GAAG;AACb;AAEO,SAAS,4BAA4B,MAAoB;AAC9D,SAAO,KAAK,YAAY,MACrB,OAAO,CAAC,SAA2C,QAAQ,IAAI,EAC/D,IAAI,CAAC,EAAE,gBAAgB,MAAM,EAAE,QAAQ,SAAS,EAAE,MAAM;AACvD,UAAM,0BAA0B,SAC7B;AAAA,MAAO,aACN,eAAe,KAAK,mBAAiB,cAAc,cAAc,QAAQ,SAAS;AAAA,IACpF,EACC,IAAI,aAAW,QAAQ,SAAS,EAChC,KAAK;AACR,WAAO,GAAG,OAAO,QAAQ,MAAM,GAAG,CAAC,IAAI,uBAAuB;AAAA,EAChE,CAAC,EACA,KAAK,GAAG;AACb;AAEO,SAAS,kBAAkB,OAAuB;AACvD,MAAI,UAAU;AAAI,WAAO;AACzB,SAAO,GAAG,iBAAiB,WAAW,KAAK;AAC7C;","names":[]}
@@ -1,3 +1,4 @@
1
+ import { localeStringSchema } from "../../../locale";
1
2
  const ReadOnlyActionTypes = {
2
3
  // TODO: this one should be a read-write action and we should refuse
3
4
  // to fetch resources on the client in read-only mode
@@ -14,12 +15,11 @@ const ReadOnlyActionTypes = {
14
15
  UNREGISTER_PROP_CONTROLLERS_HANDLE: "UNREGISTER_PROP_CONTROLLERS_HANDLE",
15
16
  REGISTER_REACT_COMPONENT: "REGISTER_REACT_COMPONENT",
16
17
  UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT",
18
+ SET_BREAKPOINTS: "SET_BREAKPOINTS",
19
+ UPDATE_CLIENT_BREAKPOINT: "UPDATE_CLIENT_BREAKPOINT",
20
+ SET_LOCALE: "SET_LOCALE",
17
21
  SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER",
18
- SET_IS_READ_ONLY: "SET_IS_READ_ONLY",
19
- SET_SITE_VERSION: "SET_SITE_VERSION",
20
- // TODO: consolidate with `SET_LOCALE` action in `shared-api.ts`
21
- // (requires changes to the builder to handle null locales)
22
- RESET_LOCALE_STATE: "RESET_LOCALE_STATE"
22
+ SET_IS_READ_ONLY: "SET_IS_READ_ONLY"
23
23
  };
24
24
  function apiResourceFulfilled(resourceType, resourceId, resource, locale) {
25
25
  return {
@@ -111,18 +111,24 @@ function registerReactComponentEffect(type, component) {
111
111
  };
112
112
  };
113
113
  }
114
+ function setBreakpoints(breakpoints) {
115
+ return { type: ReadOnlyActionTypes.SET_BREAKPOINTS, payload: { breakpoints } };
116
+ }
117
+ function updateClientBreakpoint() {
118
+ return { type: ReadOnlyActionTypes.UPDATE_CLIENT_BREAKPOINT };
119
+ }
120
+ function setLocale(locale, pathname) {
121
+ return {
122
+ type: ReadOnlyActionTypes.SET_LOCALE,
123
+ payload: { locale: localeStringSchema.parse(locale.toString()), pathname }
124
+ };
125
+ }
114
126
  function setIsInBuilder(isInBuilder) {
115
127
  return { type: ReadOnlyActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder };
116
128
  }
117
129
  function setIsReadOnly(isReadOnly) {
118
130
  return { type: ReadOnlyActionTypes.SET_IS_READ_ONLY, payload: isReadOnly };
119
131
  }
120
- function setSiteVersion(siteVersion) {
121
- return { type: ReadOnlyActionTypes.SET_SITE_VERSION, payload: siteVersion };
122
- }
123
- function resetLocaleState() {
124
- return { type: ReadOnlyActionTypes.RESET_LOCALE_STATE };
125
- }
126
132
  export {
127
133
  ReadOnlyActionTypes,
128
134
  apiResourceFulfilled,
@@ -135,12 +141,13 @@ export {
135
141
  registerPropControllers,
136
142
  registerPropControllersHandle,
137
143
  registerReactComponentEffect,
138
- resetLocaleState,
144
+ setBreakpoints,
139
145
  setIsInBuilder,
140
146
  setIsReadOnly,
141
- setSiteVersion,
147
+ setLocale,
142
148
  unregisterComponent,
143
149
  unregisterPropControllers,
144
- unregisterPropControllersHandle
150
+ unregisterPropControllersHandle,
151
+ updateClientBreakpoint
145
152
  };
146
153
  //# sourceMappingURL=read-only-actions.js.map
@@ -1 +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 SiteVersion } from '../../../api/site-version'\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 SET_SITE_VERSION: 'SET_SITE_VERSION',\n\n // TODO: consolidate with `SET_LOCALE` action in `shared-api.ts`\n // (requires changes to the builder to handle null locales)\n RESET_LOCALE_STATE: 'RESET_LOCALE_STATE',\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}\n\ntype SetSiteVersionAction = {\n type: typeof ReadOnlyActionTypes.SET_SITE_VERSION\n payload: SiteVersion | null\n}\n\ntype ResetLocaleStateAction = {\n type: typeof ReadOnlyActionTypes.RESET_LOCALE_STATE\n}\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 | SetSiteVersionAction\n | ResetLocaleStateAction\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\nexport function setSiteVersion(siteVersion: SiteVersion | null): SetSiteVersionAction {\n return { type: ReadOnlyActionTypes.SET_SITE_VERSION, payload: siteVersion }\n}\n\nexport function resetLocaleState(): ResetLocaleStateAction {\n return { type: ReadOnlyActionTypes.RESET_LOCALE_STATE }\n}\n"],"mappings":"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","names":[]}
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 Breakpoints } from '../../modules/breakpoints'\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 LocaleString, localeStringSchema } from '../../../locale'\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_BREAKPOINTS: 'SET_BREAKPOINTS',\n UPDATE_CLIENT_BREAKPOINT: 'UPDATE_CLIENT_BREAKPOINT',\n\n SET_LOCALE: 'SET_LOCALE',\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\nexport type SetBreakpointsAction = {\n type: typeof ReadOnlyActionTypes.SET_BREAKPOINTS\n payload: { breakpoints: Breakpoints }\n}\n\ntype UpdateClientBreakpointAction = {\n type: typeof ReadOnlyActionTypes.UPDATE_CLIENT_BREAKPOINT\n}\n\nexport type SetLocaleAction = {\n type: typeof ReadOnlyActionTypes.SET_LOCALE\n payload: { locale: LocaleString; pathname?: 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}\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 | SetBreakpointsAction\n | UpdateClientBreakpointAction\n | SetLocaleAction\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 setBreakpoints(breakpoints: Breakpoints): SetBreakpointsAction {\n return { type: ReadOnlyActionTypes.SET_BREAKPOINTS, payload: { breakpoints } }\n}\n\nexport function updateClientBreakpoint(): UpdateClientBreakpointAction {\n return { type: ReadOnlyActionTypes.UPDATE_CLIENT_BREAKPOINT }\n}\n\nexport function setLocale(locale: Intl.Locale, pathname?: string): SetLocaleAction {\n return {\n type: ReadOnlyActionTypes.SET_LOCALE,\n payload: { locale: localeStringSchema.parse(locale.toString()), pathname },\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":"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","names":[]}
@@ -2,7 +2,8 @@ const ReadWriteActionTypes = {
2
2
  CHANGE_ELEMENT_TREE: "CHANGE_ELEMENT_TREE",
3
3
  REGISTER_MEASURABLE: "REGISTER_MEASURABLE",
4
4
  UNREGISTER_MEASURABLE: "UNREGISTER_MEASURABLE",
5
- UPDATE_API_CLIENT_CACHE: "UPDATE_API_CLIENT_CACHE"
5
+ UPDATE_API_CLIENT_CACHE: "UPDATE_API_CLIENT_CACHE",
6
+ CLEAR_API_CLIENT_CACHE: "CLEAR_API_CLIENT_CACHE"
6
7
  };
7
8
  function changeElementTree(payload) {
8
9
  return {
@@ -30,9 +31,13 @@ function registerMeasurableEffect(documentKey, elementKey, measurable) {
30
31
  function updateAPIClientCache(payload) {
31
32
  return { type: ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE, payload };
32
33
  }
34
+ function clearAPIClientCache() {
35
+ return { type: ReadWriteActionTypes.CLEAR_API_CLIENT_CACHE };
36
+ }
33
37
  export {
34
38
  ReadWriteActionTypes,
35
39
  changeElementTree,
40
+ clearAPIClientCache,
36
41
  registerMeasurable,
37
42
  registerMeasurableEffect,
38
43
  unregisterMeasurable,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/state/actions/internal/read-write-actions.ts"],"sourcesContent":["import { type Operation } from 'ot-json0'\nimport { type ThunkAction } from '@reduxjs/toolkit'\n\nimport { type Measurable } from '../../modules/read-write/box-models'\nimport { type DescriptorsByComponentType } from '../../modules/prop-controllers'\n\nimport { type DocumentPayload } from '../../shared-api'\nimport { type SerializedState as APIClientCache } from '../../makeswift-api-client'\n\nexport const ReadWriteActionTypes = {\n CHANGE_ELEMENT_TREE: 'CHANGE_ELEMENT_TREE',\n REGISTER_MEASURABLE: 'REGISTER_MEASURABLE',\n UNREGISTER_MEASURABLE: 'UNREGISTER_MEASURABLE',\n\n UPDATE_API_CLIENT_CACHE: 'UPDATE_API_CLIENT_CACHE',\n} as const\n\ntype ChangeElementTreeAction = {\n type: typeof ReadWriteActionTypes.CHANGE_ELEMENT_TREE\n payload: {\n oldDocument: DocumentPayload\n newDocument: DocumentPayload\n descriptors: DescriptorsByComponentType\n operation: Operation\n }\n}\n\ntype RegisterMeasurableAction = {\n type: typeof ReadWriteActionTypes.REGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string; measurable: Measurable }\n}\n\ntype UnregisterMeasurableAction = {\n type: typeof ReadWriteActionTypes.UNREGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype UpdateAPIClientCache = {\n type: typeof ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE\n payload: APIClientCache\n}\n\nexport type ReadWriteAction =\n | ChangeElementTreeAction\n | RegisterMeasurableAction\n | UnregisterMeasurableAction\n | UpdateAPIClientCache\n\nexport function changeElementTree(\n payload: ChangeElementTreeAction['payload'],\n): ChangeElementTreeAction {\n return {\n type: ReadWriteActionTypes.CHANGE_ELEMENT_TREE,\n payload,\n }\n}\n\nexport function registerMeasurable(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): RegisterMeasurableAction {\n return {\n type: ReadWriteActionTypes.REGISTER_MEASURABLE,\n payload: { documentKey, elementKey, measurable },\n }\n}\n\nexport function unregisterMeasurable(\n documentKey: string,\n elementKey: string,\n): UnregisterMeasurableAction {\n return { type: ReadWriteActionTypes.UNREGISTER_MEASURABLE, payload: { documentKey, elementKey } }\n}\n\nexport function registerMeasurableEffect(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): ThunkAction<() => void, unknown, unknown, ReadWriteAction> {\n return dispatch => {\n dispatch(registerMeasurable(documentKey, elementKey, measurable))\n\n return () => {\n dispatch(unregisterMeasurable(documentKey, elementKey))\n }\n }\n}\n\nexport function updateAPIClientCache(payload: APIClientCache): UpdateAPIClientCache {\n return { type: ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE, payload }\n}\n"],"mappings":"AASO,MAAM,uBAAuB;AAAA,EAClC,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EAEvB,yBAAyB;AAC3B;AAiCO,SAAS,kBACd,SACyB;AACzB,SAAO;AAAA,IACL,MAAM,qBAAqB;AAAA,IAC3B;AAAA,EACF;AACF;AAEO,SAAS,mBACd,aACA,YACA,YAC0B;AAC1B,SAAO;AAAA,IACL,MAAM,qBAAqB;AAAA,IAC3B,SAAS,EAAE,aAAa,YAAY,WAAW;AAAA,EACjD;AACF;AAEO,SAAS,qBACd,aACA,YAC4B;AAC5B,SAAO,EAAE,MAAM,qBAAqB,uBAAuB,SAAS,EAAE,aAAa,WAAW,EAAE;AAClG;AAEO,SAAS,yBACd,aACA,YACA,YAC4D;AAC5D,SAAO,cAAY;AACjB,aAAS,mBAAmB,aAAa,YAAY,UAAU,CAAC;AAEhE,WAAO,MAAM;AACX,eAAS,qBAAqB,aAAa,UAAU,CAAC;AAAA,IACxD;AAAA,EACF;AACF;AAEO,SAAS,qBAAqB,SAA+C;AAClF,SAAO,EAAE,MAAM,qBAAqB,yBAAyB,QAAQ;AACvE;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/state/actions/internal/read-write-actions.ts"],"sourcesContent":["import { type Operation } from 'ot-json0'\nimport { type ThunkAction } from '@reduxjs/toolkit'\n\nimport { type Measurable } from '../../modules/read-write/box-models'\nimport { type DescriptorsByComponentType } from '../../modules/prop-controllers'\n\nimport { type DocumentPayload } from '../../shared-api'\nimport { type SerializedState as APIClientCache } from '../../makeswift-api-client'\n\nexport const ReadWriteActionTypes = {\n CHANGE_ELEMENT_TREE: 'CHANGE_ELEMENT_TREE',\n REGISTER_MEASURABLE: 'REGISTER_MEASURABLE',\n UNREGISTER_MEASURABLE: 'UNREGISTER_MEASURABLE',\n\n UPDATE_API_CLIENT_CACHE: 'UPDATE_API_CLIENT_CACHE',\n CLEAR_API_CLIENT_CACHE: 'CLEAR_API_CLIENT_CACHE',\n} as const\n\ntype ChangeElementTreeAction = {\n type: typeof ReadWriteActionTypes.CHANGE_ELEMENT_TREE\n payload: {\n oldDocument: DocumentPayload\n newDocument: DocumentPayload\n descriptors: DescriptorsByComponentType\n operation: Operation\n }\n}\n\ntype RegisterMeasurableAction = {\n type: typeof ReadWriteActionTypes.REGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string; measurable: Measurable }\n}\n\ntype UnregisterMeasurableAction = {\n type: typeof ReadWriteActionTypes.UNREGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype UpdateAPIClientCache = {\n type: typeof ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE\n payload: APIClientCache\n}\n\ntype ClearAPIClientCache = {\n type: typeof ReadWriteActionTypes.CLEAR_API_CLIENT_CACHE\n}\n\nexport type ReadWriteAction =\n | ChangeElementTreeAction\n | RegisterMeasurableAction\n | UnregisterMeasurableAction\n | UpdateAPIClientCache\n | ClearAPIClientCache\n\nexport function changeElementTree(\n payload: ChangeElementTreeAction['payload'],\n): ChangeElementTreeAction {\n return {\n type: ReadWriteActionTypes.CHANGE_ELEMENT_TREE,\n payload,\n }\n}\n\nexport function registerMeasurable(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): RegisterMeasurableAction {\n return {\n type: ReadWriteActionTypes.REGISTER_MEASURABLE,\n payload: { documentKey, elementKey, measurable },\n }\n}\n\nexport function unregisterMeasurable(\n documentKey: string,\n elementKey: string,\n): UnregisterMeasurableAction {\n return { type: ReadWriteActionTypes.UNREGISTER_MEASURABLE, payload: { documentKey, elementKey } }\n}\n\nexport function registerMeasurableEffect(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): ThunkAction<() => void, unknown, unknown, ReadWriteAction> {\n return dispatch => {\n dispatch(registerMeasurable(documentKey, elementKey, measurable))\n\n return () => {\n dispatch(unregisterMeasurable(documentKey, elementKey))\n }\n }\n}\n\nexport function updateAPIClientCache(payload: APIClientCache): UpdateAPIClientCache {\n return { type: ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE, payload }\n}\n\nexport function clearAPIClientCache(): ClearAPIClientCache {\n return { type: ReadWriteActionTypes.CLEAR_API_CLIENT_CACHE }\n}\n"],"mappings":"AASO,MAAM,uBAAuB;AAAA,EAClC,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EAEvB,yBAAyB;AAAA,EACzB,wBAAwB;AAC1B;AAsCO,SAAS,kBACd,SACyB;AACzB,SAAO;AAAA,IACL,MAAM,qBAAqB;AAAA,IAC3B;AAAA,EACF;AACF;AAEO,SAAS,mBACd,aACA,YACA,YAC0B;AAC1B,SAAO;AAAA,IACL,MAAM,qBAAqB;AAAA,IAC3B,SAAS,EAAE,aAAa,YAAY,WAAW;AAAA,EACjD;AACF;AAEO,SAAS,qBACd,aACA,YAC4B;AAC5B,SAAO,EAAE,MAAM,qBAAqB,uBAAuB,SAAS,EAAE,aAAa,WAAW,EAAE;AAClG;AAEO,SAAS,yBACd,aACA,YACA,YAC4D;AAC5D,SAAO,cAAY;AACjB,aAAS,mBAAmB,aAAa,YAAY,UAAU,CAAC;AAEhE,WAAO,MAAM;AACX,eAAS,qBAAqB,aAAa,UAAU,CAAC;AAAA,IACxD;AAAA,EACF;AACF;AAEO,SAAS,qBAAqB,SAA+C;AAClF,SAAO,EAAE,MAAM,qBAAqB,yBAAyB,QAAQ;AACvE;AAEO,SAAS,sBAA2C;AACzD,SAAO,EAAE,MAAM,qBAAqB,uBAAuB;AAC7D;","names":[]}
@@ -0,0 +1,162 @@
1
+ const InternalActionTypes = {
2
+ API_RESOURCE_FULFILLED: "API_RESOURCE_FULFILLED",
3
+ CREATE_ELEMENT_TREE: "CREATE_ELEMENT_TREE",
4
+ DELETE_ELEMENT_TREE: "DELETE_ELEMENT_TREE",
5
+ CHANGE_ELEMENT_TREE: "CHANGE_ELEMENT_TREE",
6
+ REGISTER_COMPONENT: "REGISTER_COMPONENT",
7
+ UNREGISTER_COMPONENT: "UNREGISTER_COMPONENT",
8
+ REGISTER_COMPONENT_HANDLE: "REGISTER_COMPONENT_HANDLE",
9
+ UNREGISTER_COMPONENT_HANDLE: "UNREGISTER_COMPONENT_HANDLE",
10
+ REGISTER_MEASURABLE: "REGISTER_MEASURABLE",
11
+ UNREGISTER_MEASURABLE: "UNREGISTER_MEASURABLE",
12
+ REGISTER_PROP_CONTROLLERS: "REGISTER_PROP_CONTROLLERS",
13
+ UNREGISTER_PROP_CONTROLLERS: "UNREGISTER_PROP_CONTROLLERS",
14
+ REGISTER_PROP_CONTROLLERS_HANDLE: "REGISTER_PROP_CONTROLLERS_HANDLE",
15
+ UNREGISTER_PROP_CONTROLLERS_HANDLE: "UNREGISTER_PROP_CONTROLLERS_HANDLE",
16
+ REGISTER_REACT_COMPONENT: "REGISTER_REACT_COMPONENT",
17
+ UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT",
18
+ SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER",
19
+ UPDATE_API_CLIENT_CACHE: "UPDATE_API_CLIENT_CACHE"
20
+ };
21
+ function apiResourceFulfilled(resourceType, resourceId, resource, locale) {
22
+ return {
23
+ type: InternalActionTypes.API_RESOURCE_FULFILLED,
24
+ payload: { resourceType, resourceId, resource, locale }
25
+ };
26
+ }
27
+ function createElementTree(payload) {
28
+ return {
29
+ type: InternalActionTypes.CREATE_ELEMENT_TREE,
30
+ payload
31
+ };
32
+ }
33
+ 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
+ };
41
+ }
42
+ function registerComponent(type, meta, propControllerDescriptors) {
43
+ return {
44
+ type: InternalActionTypes.REGISTER_COMPONENT,
45
+ payload: { type, meta, propControllerDescriptors }
46
+ };
47
+ }
48
+ function unregisterComponent(type) {
49
+ return { type: InternalActionTypes.UNREGISTER_COMPONENT, payload: { type } };
50
+ }
51
+ function registerComponentEffect(type, meta, propControllerDescriptors) {
52
+ return (dispatch) => {
53
+ dispatch(registerComponent(type, meta, propControllerDescriptors));
54
+ return () => {
55
+ dispatch(unregisterComponent(type));
56
+ };
57
+ };
58
+ }
59
+ function registerComponentHandle(documentKey, elementKey, componentHandle) {
60
+ return {
61
+ type: InternalActionTypes.REGISTER_COMPONENT_HANDLE,
62
+ payload: { documentKey, elementKey, componentHandle }
63
+ };
64
+ }
65
+ function unregisterComponentHandle(documentKey, elementKey) {
66
+ return {
67
+ type: InternalActionTypes.UNREGISTER_COMPONENT_HANDLE,
68
+ payload: { documentKey, elementKey }
69
+ };
70
+ }
71
+ function registerComponentHandleEffect(documentKey, elementKey, componentHandle) {
72
+ return (dispatch) => {
73
+ dispatch(registerComponentHandle(documentKey, elementKey, componentHandle));
74
+ return () => {
75
+ dispatch(unregisterComponentHandle(documentKey, elementKey));
76
+ };
77
+ };
78
+ }
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
+ function registerPropControllersHandle(documentKey, elementKey, handle) {
97
+ return {
98
+ type: InternalActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,
99
+ payload: { documentKey, elementKey, handle }
100
+ };
101
+ }
102
+ function unregisterPropControllersHandle(documentKey, elementKey) {
103
+ return {
104
+ type: InternalActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,
105
+ payload: { documentKey, elementKey }
106
+ };
107
+ }
108
+ function registerPropControllers(documentKey, elementKey, propControllers) {
109
+ return {
110
+ type: InternalActionTypes.REGISTER_PROP_CONTROLLERS,
111
+ payload: { documentKey, elementKey, propControllers }
112
+ };
113
+ }
114
+ function unregisterPropControllers(documentKey, elementKey) {
115
+ return {
116
+ type: InternalActionTypes.UNREGISTER_PROP_CONTROLLERS,
117
+ payload: { documentKey, elementKey }
118
+ };
119
+ }
120
+ function registerReactComponent(type, component) {
121
+ return { type: InternalActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } };
122
+ }
123
+ function unregisterReactComponent(type) {
124
+ return { type: InternalActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } };
125
+ }
126
+ function registerReactComponentEffect(type, component) {
127
+ return (dispatch) => {
128
+ dispatch(registerReactComponent(type, component));
129
+ return () => {
130
+ dispatch(unregisterReactComponent(type));
131
+ };
132
+ };
133
+ }
134
+ function setIsInBuilder(isInBuilder) {
135
+ return { type: InternalActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder };
136
+ }
137
+ function updateAPIClientCache(payload) {
138
+ return { type: InternalActionTypes.UPDATE_API_CLIENT_CACHE, payload };
139
+ }
140
+ export {
141
+ InternalActionTypes,
142
+ apiResourceFulfilled,
143
+ changeElementTree,
144
+ createElementTree,
145
+ deleteElementTree,
146
+ registerComponent,
147
+ registerComponentEffect,
148
+ registerComponentHandle,
149
+ registerComponentHandleEffect,
150
+ registerMeasurable,
151
+ registerMeasurableEffect,
152
+ registerPropControllers,
153
+ registerPropControllersHandle,
154
+ registerReactComponentEffect,
155
+ setIsInBuilder,
156
+ unregisterComponent,
157
+ unregisterMeasurable,
158
+ unregisterPropControllers,
159
+ unregisterPropControllersHandle,
160
+ updateAPIClientCache
161
+ };
162
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/state/actions/internal.ts"],"sourcesContent":["import { type Operation } from 'ot-json0'\nimport { 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 Measurable } from '../modules/box-models'\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'\nimport { type SerializedState as APIClientCache } from '../makeswift-api-client'\n\nexport const InternalActionTypes = {\n API_RESOURCE_FULFILLED: 'API_RESOURCE_FULFILLED',\n\n CREATE_ELEMENT_TREE: 'CREATE_ELEMENT_TREE',\n DELETE_ELEMENT_TREE: 'DELETE_ELEMENT_TREE',\n CHANGE_ELEMENT_TREE: 'CHANGE_ELEMENT_TREE',\n\n REGISTER_COMPONENT: 'REGISTER_COMPONENT',\n UNREGISTER_COMPONENT: 'UNREGISTER_COMPONENT',\n\n REGISTER_COMPONENT_HANDLE: 'REGISTER_COMPONENT_HANDLE',\n UNREGISTER_COMPONENT_HANDLE: 'UNREGISTER_COMPONENT_HANDLE',\n\n REGISTER_MEASURABLE: 'REGISTER_MEASURABLE',\n UNREGISTER_MEASURABLE: 'UNREGISTER_MEASURABLE',\n\n REGISTER_PROP_CONTROLLERS: 'REGISTER_PROP_CONTROLLERS',\n UNREGISTER_PROP_CONTROLLERS: 'UNREGISTER_PROP_CONTROLLERS',\n\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\n UPDATE_API_CLIENT_CACHE: 'UPDATE_API_CLIENT_CACHE',\n} as const\n\ntype APIResourceFulfilledAction = {\n type: typeof InternalActionTypes.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 InternalActionTypes.CREATE_ELEMENT_TREE\n payload: { document: DocumentPayload; descriptors: DescriptorsByComponentType }\n}\n\ntype DeleteElementTreeAction = {\n type: typeof InternalActionTypes.DELETE_ELEMENT_TREE\n payload: { documentKey: string }\n}\n\ntype ChangeElementTreeAction = {\n type: typeof InternalActionTypes.CHANGE_ELEMENT_TREE\n payload: {\n oldDocument: DocumentPayload\n newDocument: DocumentPayload\n descriptors: DescriptorsByComponentType\n operation: Operation\n }\n}\n\nexport type RegisterComponentAction = {\n type: typeof InternalActionTypes.REGISTER_COMPONENT\n payload: {\n type: string\n meta: ComponentMeta\n propControllerDescriptors: Record<string, PropControllerDescriptor>\n }\n}\n\nexport type UnregisterComponentAction = {\n type: typeof InternalActionTypes.UNREGISTER_COMPONENT\n payload: { type: string }\n}\n\ntype RegisterComponentHandleAction = {\n type: typeof InternalActionTypes.REGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string; componentHandle: ElementImperativeHandle }\n}\n\ntype UnregisterComponentHandleAction = {\n type: typeof InternalActionTypes.UNREGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterMeasurableAction = {\n type: typeof InternalActionTypes.REGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string; measurable: Measurable }\n}\n\ntype UnregisterMeasurableAction = {\n type: typeof InternalActionTypes.UNREGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterPropControllersHandleAction = {\n type: typeof InternalActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string; handle: PropControllersHandle }\n}\n\ntype UnregisterPropControllersHandleAction = {\n type: typeof InternalActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterPropControllersAction = {\n type: typeof InternalActionTypes.REGISTER_PROP_CONTROLLERS\n payload: {\n documentKey: string\n elementKey: string\n propControllers: Record<string, ControlInstance>\n }\n}\n\ntype UnregisterPropControllersAction = {\n type: typeof InternalActionTypes.UNREGISTER_PROP_CONTROLLERS\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterReactComponentAction = {\n type: typeof InternalActionTypes.REGISTER_REACT_COMPONENT\n payload: { type: string; component: ComponentType }\n}\n\ntype UnregisterReactComponentAction = {\n type: typeof InternalActionTypes.UNREGISTER_REACT_COMPONENT\n payload: { type: string }\n}\n\ntype SetIsInBuilderAction = {\n type: typeof InternalActionTypes.SET_IS_IN_BUILDER\n payload: boolean\n}\n\ntype UpdateAPIClientCache = {\n type: typeof InternalActionTypes.UPDATE_API_CLIENT_CACHE\n payload: APIClientCache\n}\n\nexport type InternalAction =\n | APIResourceFulfilledAction\n | CreateElementTreeAction\n | DeleteElementTreeAction\n | ChangeElementTreeAction\n | RegisterComponentAction\n | UnregisterComponentAction\n | RegisterComponentHandleAction\n | UnregisterComponentHandleAction\n | RegisterMeasurableAction\n | UnregisterMeasurableAction\n | RegisterPropControllersHandleAction\n | UnregisterPropControllersHandleAction\n | RegisterPropControllersAction\n | UnregisterPropControllersAction\n | RegisterReactComponentAction\n | UnregisterReactComponentAction\n | SetIsInBuilderAction\n | UpdateAPIClientCache\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: InternalActionTypes.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: InternalActionTypes.CREATE_ELEMENT_TREE,\n payload,\n }\n}\n\nexport function deleteElementTree(\n payload: DeleteElementTreeAction['payload'],\n): DeleteElementTreeAction {\n return { type: InternalActionTypes.DELETE_ELEMENT_TREE, payload }\n}\n\nexport function changeElementTree(\n payload: ChangeElementTreeAction['payload'],\n): ChangeElementTreeAction {\n return {\n type: InternalActionTypes.CHANGE_ELEMENT_TREE,\n payload,\n }\n}\n\nexport function registerComponent(\n type: string,\n meta: ComponentMeta,\n propControllerDescriptors: Record<string, PropControllerDescriptor>,\n): RegisterComponentAction {\n return {\n type: InternalActionTypes.REGISTER_COMPONENT,\n payload: { type, meta, propControllerDescriptors },\n }\n}\n\nexport function unregisterComponent(type: string): UnregisterComponentAction {\n return { type: InternalActionTypes.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, InternalAction> {\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: InternalActionTypes.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: InternalActionTypes.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, InternalAction> {\n return dispatch => {\n dispatch(registerComponentHandle(documentKey, elementKey, componentHandle))\n\n return () => {\n dispatch(unregisterComponentHandle(documentKey, elementKey))\n }\n }\n}\n\nexport function registerMeasurable(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): RegisterMeasurableAction {\n return {\n type: InternalActionTypes.REGISTER_MEASURABLE,\n payload: { documentKey, elementKey, measurable },\n }\n}\n\nexport function unregisterMeasurable(\n documentKey: string,\n elementKey: string,\n): UnregisterMeasurableAction {\n return { type: InternalActionTypes.UNREGISTER_MEASURABLE, payload: { documentKey, elementKey } }\n}\n\nexport function registerMeasurableEffect(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): ThunkAction<() => void, unknown, unknown, InternalAction> {\n return dispatch => {\n dispatch(registerMeasurable(documentKey, elementKey, measurable))\n\n return () => {\n dispatch(unregisterMeasurable(documentKey, elementKey))\n }\n }\n}\n\nexport function registerPropControllersHandle(\n documentKey: string,\n elementKey: string,\n handle: PropControllersHandle,\n): RegisterPropControllersHandleAction {\n return {\n type: InternalActionTypes.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: InternalActionTypes.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: InternalActionTypes.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: InternalActionTypes.UNREGISTER_PROP_CONTROLLERS,\n payload: { documentKey, elementKey },\n }\n}\n\nfunction registerReactComponent(\n type: string,\n component: ComponentType,\n): RegisterReactComponentAction {\n return { type: InternalActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } }\n}\n\nfunction unregisterReactComponent(type: string): UnregisterReactComponentAction {\n return { type: InternalActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } }\n}\n\nexport function registerReactComponentEffect(\n type: string,\n component: ComponentType,\n): ThunkAction<() => void, unknown, unknown, InternalAction> {\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: InternalActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder }\n}\n\nexport function updateAPIClientCache(payload: APIClientCache): UpdateAPIClientCache {\n return { type: InternalActionTypes.UPDATE_API_CLIENT_CACHE, payload }\n}\n"],"mappings":"AAmBO,MAAM,sBAAsB;AAAA,EACjC,wBAAwB;AAAA,EAExB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EAErB,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EAEtB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAE7B,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EAEvB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAE7B,kCAAkC;AAAA,EAClC,oCAAoC;AAAA,EAEpC,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAE5B,mBAAmB;AAAA,EAEnB,yBAAyB;AAC3B;AAkIO,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,SACyB;AACzB,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B;AAAA,EACF;AACF;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,mBACd,aACA,YACA,YAC0B;AAC1B,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,YAAY,WAAW;AAAA,EACjD;AACF;AAEO,SAAS,qBACd,aACA,YAC4B;AAC5B,SAAO,EAAE,MAAM,oBAAoB,uBAAuB,SAAS,EAAE,aAAa,WAAW,EAAE;AACjG;AAEO,SAAS,yBACd,aACA,YACA,YAC2D;AAC3D,SAAO,cAAY;AACjB,aAAS,mBAAmB,aAAa,YAAY,UAAU,CAAC;AAEhE,WAAO,MAAM;AACX,eAAS,qBAAqB,aAAa,UAAU,CAAC;AAAA,IACxD;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,qBAAqB,SAA+C;AAClF,SAAO,EAAE,MAAM,oBAAoB,yBAAyB,QAAQ;AACtE;","names":[]}