@makeswift/runtime 0.28.8-canary.13 → 0.28.8-canary.16

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 (334) hide show
  1. package/dist/cjs/api/graphql-api-client.js +1 -1
  2. package/dist/cjs/api/rest-api-client.js +1 -1
  3. package/dist/cjs/api-handler/handlers/manifest.js +1 -1
  4. package/dist/cjs/builder/host-to-builder-actions.js +5 -5
  5. package/dist/cjs/builder/host-to-builder-actions.js.map +1 -1
  6. package/dist/cjs/client/index.js +1 -1
  7. package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
  8. package/dist/cjs/next/testing/breakpoints.js +3 -15
  9. package/dist/cjs/next/testing/breakpoints.js.map +1 -1
  10. package/dist/cjs/next/testing/element-data.js +3 -82
  11. package/dist/cjs/next/testing/element-data.js.map +1 -1
  12. package/dist/cjs/next/testing/react-runtime.js.map +1 -1
  13. package/dist/cjs/runtimes/react/components/Element.js +21 -6
  14. package/dist/cjs/runtimes/react/components/Element.js.map +1 -1
  15. package/dist/cjs/runtimes/react/components/ElementRegistration.js +5 -3
  16. package/dist/cjs/runtimes/react/components/ElementRegistration.js.map +1 -1
  17. package/dist/cjs/runtimes/react/components/resolve-props.js +5 -1
  18. package/dist/cjs/runtimes/react/components/resolve-props.js.map +1 -1
  19. package/dist/cjs/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
  20. package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js +2 -2
  21. package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
  22. package/dist/cjs/runtimes/react/element-imperative-handle.js +2 -2
  23. package/dist/cjs/runtimes/react/element-imperative-handle.js.map +1 -1
  24. package/dist/cjs/runtimes/react/hooks/use-control-instances.js +4 -3
  25. package/dist/cjs/runtimes/react/hooks/use-control-instances.js.map +1 -1
  26. package/dist/cjs/runtimes/react/hooks/use-resolved-props.js +10 -9
  27. package/dist/cjs/runtimes/react/hooks/use-resolved-props.js.map +1 -1
  28. package/dist/cjs/runtimes/react/testing/index.js +25 -0
  29. package/dist/cjs/runtimes/react/testing/index.js.map +1 -0
  30. package/dist/cjs/runtimes/react/testing/react-provider.js +38 -0
  31. package/dist/cjs/runtimes/react/testing/react-provider.js.map +1 -0
  32. package/dist/cjs/state/actions/index.js +4 -4
  33. package/dist/cjs/state/actions/index.js.map +1 -1
  34. package/dist/cjs/state/actions/internal/action-types.js +34 -0
  35. package/dist/cjs/state/actions/internal/action-types.js.map +1 -0
  36. package/dist/cjs/state/actions/internal/index.js +0 -17
  37. package/dist/cjs/state/actions/internal/index.js.map +1 -1
  38. package/dist/cjs/state/actions/internal/read-only-action-types.js +44 -0
  39. package/dist/cjs/state/actions/internal/read-only-action-types.js.map +1 -0
  40. package/dist/cjs/state/actions/internal/read-only-actions.js +13 -92
  41. package/dist/cjs/state/actions/internal/read-only-actions.js.map +1 -1
  42. package/dist/cjs/state/actions/internal/read-write-action-types.js +41 -0
  43. package/dist/cjs/state/actions/internal/read-write-action-types.js.map +1 -0
  44. package/dist/cjs/state/actions/internal/read-write-actions.js +64 -14
  45. package/dist/cjs/state/actions/internal/read-write-actions.js.map +1 -1
  46. package/dist/cjs/state/builder-api/action-types.js +49 -0
  47. package/dist/cjs/state/builder-api/action-types.js.map +1 -0
  48. package/dist/cjs/state/builder-api/actions.js +14 -36
  49. package/dist/cjs/state/builder-api/actions.js.map +1 -1
  50. package/dist/cjs/state/builder-api/proxy.js +2 -1
  51. package/dist/cjs/state/builder-api/proxy.js.map +1 -1
  52. package/dist/cjs/state/host-api/action-types.js +43 -0
  53. package/dist/cjs/state/host-api/action-types.js.map +1 -0
  54. package/dist/cjs/state/{host-api.js → host-api/actions.js} +17 -33
  55. package/dist/cjs/state/host-api/actions.js.map +1 -0
  56. package/dist/cjs/state/host-api/index.js +25 -0
  57. package/dist/cjs/state/host-api/index.js.map +1 -0
  58. package/dist/cjs/state/middleware/read-write/builder-api/index.js +15 -15
  59. package/dist/cjs/state/middleware/read-write/builder-api/index.js.map +1 -1
  60. package/dist/cjs/state/middleware/read-write/measure-box-models.js +3 -3
  61. package/dist/cjs/state/middleware/read-write/measure-box-models.js.map +1 -1
  62. package/dist/cjs/state/middleware/read-write/prop-controller-handles.js +13 -13
  63. package/dist/cjs/state/middleware/read-write/prop-controller-handles.js.map +1 -1
  64. package/dist/cjs/state/modules/api-resources.js +5 -5
  65. package/dist/cjs/state/modules/api-resources.js.map +1 -1
  66. package/dist/cjs/state/modules/breakpoints.js +4 -4
  67. package/dist/cjs/state/modules/breakpoints.js.map +1 -1
  68. package/dist/cjs/state/modules/components-meta.js +3 -3
  69. package/dist/cjs/state/modules/components-meta.js.map +1 -1
  70. package/dist/cjs/state/modules/element-trees.js +5 -5
  71. package/dist/cjs/state/modules/element-trees.js.map +1 -1
  72. package/dist/cjs/state/modules/is-in-builder.js +2 -2
  73. package/dist/cjs/state/modules/is-in-builder.js.map +1 -1
  74. package/dist/cjs/state/modules/is-read-only.js +2 -2
  75. package/dist/cjs/state/modules/is-read-only.js.map +1 -1
  76. package/dist/cjs/state/modules/locale.js +2 -2
  77. package/dist/cjs/state/modules/locale.js.map +1 -1
  78. package/dist/cjs/state/modules/localized-resources-map.js +3 -3
  79. package/dist/cjs/state/modules/localized-resources-map.js.map +1 -1
  80. package/dist/cjs/state/modules/{prop-controllers.js → prop-controller-descriptors.js} +7 -7
  81. package/dist/cjs/state/modules/prop-controller-descriptors.js.map +1 -0
  82. package/dist/cjs/state/modules/react-components.js +3 -3
  83. package/dist/cjs/state/modules/react-components.js.map +1 -1
  84. package/dist/cjs/state/modules/read-write/box-models.js +5 -5
  85. package/dist/cjs/state/modules/read-write/box-models.js.map +1 -1
  86. package/dist/cjs/state/modules/read-write/element-imperative-handles.js +3 -3
  87. package/dist/cjs/state/modules/read-write/element-imperative-handles.js.map +1 -1
  88. package/dist/cjs/state/modules/{prop-controller-handles.js → read-write/prop-controllers.js} +5 -5
  89. package/dist/cjs/state/modules/read-write/prop-controllers.js.map +1 -0
  90. package/dist/cjs/state/read-only-state.js +9 -44
  91. package/dist/cjs/state/read-only-state.js.map +1 -1
  92. package/dist/cjs/state/read-write-state.js +37 -0
  93. package/dist/cjs/state/read-write-state.js.map +1 -1
  94. package/dist/cjs/state/shared-api/action-types.js +33 -0
  95. package/dist/cjs/state/shared-api/action-types.js.map +1 -0
  96. package/dist/cjs/state/{shared-api.js → shared-api/actions.js} +8 -14
  97. package/dist/cjs/state/shared-api/actions.js.map +1 -0
  98. package/dist/cjs/state/shared-api/index.js +25 -0
  99. package/dist/cjs/state/shared-api/index.js.map +1 -0
  100. package/dist/cjs/state/store.js +3 -3
  101. package/dist/cjs/state/store.js.map +1 -1
  102. package/dist/cjs/state/translations/get.js.map +1 -1
  103. package/dist/cjs/state/translations/merge.js.map +1 -1
  104. package/dist/cjs/state/unified-state.js +12 -0
  105. package/dist/cjs/state/unified-state.js.map +1 -1
  106. package/dist/cjs/testing/breakpoints.js +35 -0
  107. package/dist/cjs/testing/breakpoints.js.map +1 -0
  108. package/dist/cjs/testing/element-data.js +102 -0
  109. package/dist/cjs/testing/element-data.js.map +1 -0
  110. package/dist/cjs/translations/index.js.map +1 -1
  111. package/dist/esm/api/graphql-api-client.js +1 -1
  112. package/dist/esm/api/rest-api-client.js +1 -1
  113. package/dist/esm/api-handler/handlers/manifest.js +1 -1
  114. package/dist/esm/builder/host-to-builder-actions.js +2 -4
  115. package/dist/esm/builder/host-to-builder-actions.js.map +1 -1
  116. package/dist/esm/client/index.js +1 -1
  117. package/dist/esm/components/builtin/Form/Form.js.map +1 -1
  118. package/dist/esm/next/testing/breakpoints.js +1 -8
  119. package/dist/esm/next/testing/breakpoints.js.map +1 -1
  120. package/dist/esm/next/testing/element-data.js +1 -75
  121. package/dist/esm/next/testing/element-data.js.map +1 -1
  122. package/dist/esm/next/testing/react-runtime.js.map +1 -1
  123. package/dist/esm/runtimes/react/components/Element.js +18 -6
  124. package/dist/esm/runtimes/react/components/Element.js.map +1 -1
  125. package/dist/esm/runtimes/react/components/ElementRegistration.js +4 -2
  126. package/dist/esm/runtimes/react/components/ElementRegistration.js.map +1 -1
  127. package/dist/esm/runtimes/react/components/resolve-props.js +5 -1
  128. package/dist/esm/runtimes/react/components/resolve-props.js.map +1 -1
  129. package/dist/esm/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
  130. package/dist/esm/runtimes/react/controls/rich-text/rich-text.js +1 -1
  131. package/dist/esm/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
  132. package/dist/esm/runtimes/react/element-imperative-handle.js +1 -1
  133. package/dist/esm/runtimes/react/element-imperative-handle.js.map +1 -1
  134. package/dist/esm/runtimes/react/hooks/use-control-instances.js +3 -2
  135. package/dist/esm/runtimes/react/hooks/use-control-instances.js.map +1 -1
  136. package/dist/esm/runtimes/react/hooks/use-resolved-props.js +10 -9
  137. package/dist/esm/runtimes/react/hooks/use-resolved-props.js.map +1 -1
  138. package/dist/esm/runtimes/react/testing/index.js +3 -0
  139. package/dist/esm/runtimes/react/testing/index.js.map +1 -0
  140. package/dist/esm/runtimes/react/testing/react-provider.js +14 -0
  141. package/dist/esm/runtimes/react/testing/react-provider.js.map +1 -0
  142. package/dist/esm/state/actions/index.js +2 -2
  143. package/dist/esm/state/actions/index.js.map +1 -1
  144. package/dist/esm/state/actions/internal/action-types.js +10 -0
  145. package/dist/esm/state/actions/internal/action-types.js.map +1 -0
  146. package/dist/esm/state/actions/internal/index.js +0 -9
  147. package/dist/esm/state/actions/internal/index.js.map +1 -1
  148. package/dist/esm/state/actions/internal/read-only-action-types.js +20 -0
  149. package/dist/esm/state/actions/internal/read-only-action-types.js.map +1 -0
  150. package/dist/esm/state/actions/internal/read-only-actions.js +1 -73
  151. package/dist/esm/state/actions/internal/read-only-actions.js.map +1 -1
  152. package/dist/esm/state/actions/internal/read-write-action-types.js +17 -0
  153. package/dist/esm/state/actions/internal/read-write-action-types.js.map +1 -0
  154. package/dist/esm/state/actions/internal/read-write-actions.js +52 -8
  155. package/dist/esm/state/actions/internal/read-write-actions.js.map +1 -1
  156. package/dist/esm/state/builder-api/action-types.js +25 -0
  157. package/dist/esm/state/builder-api/action-types.js.map +1 -0
  158. package/dist/esm/state/builder-api/actions.js +1 -24
  159. package/dist/esm/state/builder-api/actions.js.map +1 -1
  160. package/dist/esm/state/builder-api/proxy.js +2 -1
  161. package/dist/esm/state/builder-api/proxy.js.map +1 -1
  162. package/dist/esm/state/host-api/action-types.js +19 -0
  163. package/dist/esm/state/host-api/action-types.js.map +1 -0
  164. package/dist/esm/state/{host-api.js → host-api/actions.js} +2 -17
  165. package/dist/esm/state/host-api/actions.js.map +1 -0
  166. package/dist/esm/state/host-api/index.js +3 -0
  167. package/dist/esm/state/host-api/index.js.map +1 -0
  168. package/dist/esm/state/middleware/read-write/builder-api/index.js +1 -1
  169. package/dist/esm/state/middleware/read-write/builder-api/index.js.map +1 -1
  170. package/dist/esm/state/middleware/read-write/measure-box-models.js +3 -3
  171. package/dist/esm/state/middleware/read-write/measure-box-models.js.map +1 -1
  172. package/dist/esm/state/middleware/read-write/prop-controller-handles.js +21 -13
  173. package/dist/esm/state/middleware/read-write/prop-controller-handles.js.map +1 -1
  174. package/dist/esm/state/modules/api-resources.js +2 -2
  175. package/dist/esm/state/modules/api-resources.js.map +1 -1
  176. package/dist/esm/state/modules/breakpoints.js +2 -2
  177. package/dist/esm/state/modules/breakpoints.js.map +1 -1
  178. package/dist/esm/state/modules/components-meta.js +1 -1
  179. package/dist/esm/state/modules/components-meta.js.map +1 -1
  180. package/dist/esm/state/modules/element-trees.js +2 -2
  181. package/dist/esm/state/modules/element-trees.js.map +1 -1
  182. package/dist/esm/state/modules/is-in-builder.js +1 -1
  183. package/dist/esm/state/modules/is-in-builder.js.map +1 -1
  184. package/dist/esm/state/modules/is-read-only.js +1 -1
  185. package/dist/esm/state/modules/is-read-only.js.map +1 -1
  186. package/dist/esm/state/modules/locale.js +1 -1
  187. package/dist/esm/state/modules/locale.js.map +1 -1
  188. package/dist/esm/state/modules/localized-resources-map.js +1 -1
  189. package/dist/esm/state/modules/localized-resources-map.js.map +1 -1
  190. package/dist/esm/state/modules/{prop-controllers.js → prop-controller-descriptors.js} +2 -2
  191. package/dist/esm/state/modules/prop-controller-descriptors.js.map +1 -0
  192. package/dist/esm/state/modules/react-components.js +1 -1
  193. package/dist/esm/state/modules/react-components.js.map +1 -1
  194. package/dist/esm/state/modules/read-write/box-models.js +2 -2
  195. package/dist/esm/state/modules/read-write/box-models.js.map +1 -1
  196. package/dist/esm/state/modules/read-write/element-imperative-handles.js +3 -3
  197. package/dist/esm/state/modules/read-write/element-imperative-handles.js.map +1 -1
  198. package/dist/esm/state/modules/{prop-controller-handles.js → read-write/prop-controllers.js} +2 -2
  199. package/dist/esm/state/modules/read-write/prop-controllers.js.map +1 -0
  200. package/dist/esm/state/read-only-state.js +9 -41
  201. package/dist/esm/state/read-only-state.js.map +1 -1
  202. package/dist/esm/state/read-write-state.js +34 -0
  203. package/dist/esm/state/read-write-state.js.map +1 -1
  204. package/dist/esm/state/shared-api/action-types.js +9 -0
  205. package/dist/esm/state/shared-api/action-types.js.map +1 -0
  206. package/dist/esm/state/{shared-api.js → shared-api/actions.js} +2 -7
  207. package/dist/esm/state/shared-api/actions.js.map +1 -0
  208. package/dist/esm/state/shared-api/index.js +3 -0
  209. package/dist/esm/state/shared-api/index.js.map +1 -0
  210. package/dist/esm/state/store.js +1 -1
  211. package/dist/esm/state/store.js.map +1 -1
  212. package/dist/esm/state/translations/get.js.map +1 -1
  213. package/dist/esm/state/translations/merge.js +3 -1
  214. package/dist/esm/state/translations/merge.js.map +1 -1
  215. package/dist/esm/state/unified-state.js +4 -0
  216. package/dist/esm/state/unified-state.js.map +1 -1
  217. package/dist/esm/testing/breakpoints.js +9 -0
  218. package/dist/esm/testing/breakpoints.js.map +1 -0
  219. package/dist/esm/testing/element-data.js +76 -0
  220. package/dist/esm/testing/element-data.js.map +1 -0
  221. package/dist/esm/translations/index.js.map +1 -1
  222. package/dist/types/api/schema/page-pathname-slice.d.ts +2 -2
  223. package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts +6 -6
  224. package/dist/types/api-handler/handlers/webhook/types.d.ts +20 -20
  225. package/dist/types/builder/host-to-builder-actions.d.ts.map +1 -1
  226. package/dist/types/components/builtin/Form/Form.d.ts +1 -1
  227. package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
  228. package/dist/types/components/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
  229. package/dist/types/components/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
  230. package/dist/types/locale.d.ts +1 -1
  231. package/dist/types/next/testing/breakpoints.d.ts +1 -3
  232. package/dist/types/next/testing/breakpoints.d.ts.map +1 -1
  233. package/dist/types/next/testing/element-data.d.ts +1 -54
  234. package/dist/types/next/testing/element-data.d.ts.map +1 -1
  235. package/dist/types/next/testing/react-runtime.d.ts.map +1 -1
  236. package/dist/types/runtimes/react/components/Element.d.ts.map +1 -1
  237. package/dist/types/runtimes/react/components/ElementRegistration.d.ts +1 -1
  238. package/dist/types/runtimes/react/components/ElementRegistration.d.ts.map +1 -1
  239. package/dist/types/runtimes/react/components/resolve-props.d.ts.map +1 -1
  240. package/dist/types/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts +1 -1
  241. package/dist/types/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts.map +1 -1
  242. package/dist/types/runtimes/react/element-imperative-handle.d.ts +1 -1
  243. package/dist/types/runtimes/react/element-imperative-handle.d.ts.map +1 -1
  244. package/dist/types/runtimes/react/hooks/use-control-instances.d.ts.map +1 -1
  245. package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts +4 -3
  246. package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts.map +1 -1
  247. package/dist/types/runtimes/react/hooks/use-store.d.ts +2 -4
  248. package/dist/types/runtimes/react/hooks/use-store.d.ts.map +1 -1
  249. package/dist/types/runtimes/react/testing/index.d.ts +3 -0
  250. package/dist/types/runtimes/react/testing/index.d.ts.map +1 -0
  251. package/dist/types/runtimes/react/testing/react-provider.d.ts +8 -0
  252. package/dist/types/runtimes/react/testing/react-provider.d.ts.map +1 -0
  253. package/dist/types/state/__tests__/test-store.d.ts +2 -4
  254. package/dist/types/state/__tests__/test-store.d.ts.map +1 -1
  255. package/dist/types/state/actions/index.d.ts +6 -6
  256. package/dist/types/state/actions/index.d.ts.map +1 -1
  257. package/dist/types/state/actions/internal/action-types.d.ts +26 -0
  258. package/dist/types/state/actions/internal/action-types.d.ts.map +1 -0
  259. package/dist/types/state/actions/internal/index.d.ts +0 -25
  260. package/dist/types/state/actions/internal/index.d.ts.map +1 -1
  261. package/dist/types/state/actions/internal/read-only-action-types.d.ts +15 -0
  262. package/dist/types/state/actions/internal/read-only-action-types.d.ts.map +1 -0
  263. package/dist/types/state/actions/internal/read-only-actions.d.ts +3 -76
  264. package/dist/types/state/actions/internal/read-only-actions.d.ts.map +1 -1
  265. package/dist/types/state/actions/internal/read-write-action-types.d.ts +14 -0
  266. package/dist/types/state/actions/internal/read-write-action-types.d.ts.map +1 -0
  267. package/dist/types/state/actions/internal/read-write-actions.d.ts +58 -9
  268. package/dist/types/state/actions/internal/read-write-actions.d.ts.map +1 -1
  269. package/dist/types/state/builder-api/action-types.d.ts +22 -0
  270. package/dist/types/state/builder-api/action-types.d.ts.map +1 -0
  271. package/dist/types/state/builder-api/actions.d.ts +1 -21
  272. package/dist/types/state/builder-api/actions.d.ts.map +1 -1
  273. package/dist/types/state/builder-api/proxy.d.ts.map +1 -1
  274. package/dist/types/state/host-api/action-types.d.ts +17 -0
  275. package/dist/types/state/host-api/action-types.d.ts.map +1 -0
  276. package/dist/types/state/{host-api.d.ts → host-api/actions.d.ts} +7 -22
  277. package/dist/types/state/host-api/actions.d.ts.map +1 -0
  278. package/dist/types/state/host-api/index.d.ts +3 -0
  279. package/dist/types/state/host-api/index.d.ts.map +1 -0
  280. package/dist/types/state/middleware/read-write/__tests__/fixtures/operations.d.ts.map +1 -0
  281. package/dist/types/state/middleware/read-write/__tests__/fixtures/root-elements.d.ts.map +1 -0
  282. package/dist/types/state/middleware/read-write/__tests__/prop-controller-handles.test.d.ts +2 -0
  283. package/dist/types/state/middleware/read-write/__tests__/prop-controller-handles.test.d.ts.map +1 -0
  284. package/dist/types/state/middleware/read-write/__tests__/update-element-tree.test.d.ts +2 -0
  285. package/dist/types/state/middleware/read-write/__tests__/update-element-tree.test.d.ts.map +1 -0
  286. package/dist/types/state/middleware/read-write/prop-controller-handles.d.ts.map +1 -1
  287. package/dist/types/state/modules/element-trees.d.ts +1 -1
  288. package/dist/types/state/modules/element-trees.d.ts.map +1 -1
  289. package/dist/types/state/modules/{prop-controllers.d.ts → prop-controller-descriptors.d.ts} +1 -1
  290. package/dist/types/state/modules/prop-controller-descriptors.d.ts.map +1 -0
  291. package/dist/types/state/modules/{prop-controller-handles.d.ts → read-write/prop-controllers.d.ts} +4 -4
  292. package/dist/types/state/modules/{prop-controller-handles.d.ts.map → read-write/prop-controllers.d.ts.map} +1 -1
  293. package/dist/types/state/read-only-state.d.ts +6 -70
  294. package/dist/types/state/read-only-state.d.ts.map +1 -1
  295. package/dist/types/state/read-write-state.d.ts +67 -4
  296. package/dist/types/state/read-write-state.d.ts.map +1 -1
  297. package/dist/types/state/shared-api/action-types.d.ts +6 -0
  298. package/dist/types/state/shared-api/action-types.d.ts.map +1 -0
  299. package/dist/types/state/{shared-api.d.ts → shared-api/actions.d.ts} +3 -7
  300. package/dist/types/state/shared-api/actions.d.ts.map +1 -0
  301. package/dist/types/state/shared-api/index.d.ts +3 -0
  302. package/dist/types/state/shared-api/index.d.ts.map +1 -0
  303. package/dist/types/state/store.d.ts +4 -8
  304. package/dist/types/state/store.d.ts.map +1 -1
  305. package/dist/types/state/translations/get.d.ts +1 -1
  306. package/dist/types/state/translations/get.d.ts.map +1 -1
  307. package/dist/types/state/translations/merge.d.ts +1 -1
  308. package/dist/types/state/translations/merge.d.ts.map +1 -1
  309. package/dist/types/state/unified-state.d.ts +1 -0
  310. package/dist/types/state/unified-state.d.ts.map +1 -1
  311. package/dist/types/testing/breakpoints.d.ts +4 -0
  312. package/dist/types/testing/breakpoints.d.ts.map +1 -0
  313. package/dist/types/testing/element-data.d.ts +55 -0
  314. package/dist/types/testing/element-data.d.ts.map +1 -0
  315. package/dist/types/translations/index.d.ts +1 -1
  316. package/dist/types/translations/index.d.ts.map +1 -1
  317. package/package.json +2 -2
  318. package/dist/cjs/state/host-api.js.map +0 -1
  319. package/dist/cjs/state/modules/prop-controller-handles.js.map +0 -1
  320. package/dist/cjs/state/modules/prop-controllers.js.map +0 -1
  321. package/dist/cjs/state/shared-api.js.map +0 -1
  322. package/dist/esm/state/host-api.js.map +0 -1
  323. package/dist/esm/state/modules/prop-controller-handles.js.map +0 -1
  324. package/dist/esm/state/modules/prop-controllers.js.map +0 -1
  325. package/dist/esm/state/shared-api.js.map +0 -1
  326. package/dist/types/state/__tests__/fixtures/operations.d.ts.map +0 -1
  327. package/dist/types/state/__tests__/fixtures/root-elements.d.ts.map +0 -1
  328. package/dist/types/state/__tests__/react-builder-preview.test.d.ts +0 -2
  329. package/dist/types/state/__tests__/react-builder-preview.test.d.ts.map +0 -1
  330. package/dist/types/state/host-api.d.ts.map +0 -1
  331. package/dist/types/state/modules/prop-controllers.d.ts.map +0 -1
  332. package/dist/types/state/shared-api.d.ts.map +0 -1
  333. /package/dist/types/state/{__tests__ → middleware/read-write/__tests__}/fixtures/operations.d.ts +0 -0
  334. /package/dist/types/state/{__tests__ → middleware/read-write/__tests__}/fixtures/root-elements.d.ts +0 -0
@@ -23,7 +23,7 @@ __export(element_imperative_handle_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(element_imperative_handle_exports);
25
25
  var import_box_models2 = require("../../state/modules/read-write/box-models");
26
- var import_prop_controller_handles = require("../../state/modules/prop-controller-handles");
26
+ var import_prop_controllers = require("../../state/modules/read-write/prop-controllers");
27
27
  class ElementImperativeHandle {
28
28
  getCurrent = () => null;
29
29
  lastPropControllers = null;
@@ -41,7 +41,7 @@ class ElementImperativeHandle {
41
41
  }
42
42
  setPropControllers(propControllers) {
43
43
  const current = this.getCurrent();
44
- if ((0, import_prop_controller_handles.isPropControllersHandle)(current))
44
+ if ((0, import_prop_controllers.isPropControllersHandle)(current))
45
45
  current.setPropControllers(propControllers);
46
46
  this.lastPropControllers = propControllers;
47
47
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/runtimes/react/element-imperative-handle.ts"],"sourcesContent":["import { BoxModelHandle, type BoxDisplayModel } from '../../state/modules/read-write/box-models'\nimport { Descriptor } from '../../prop-controllers/descriptors'\nimport { DescriptorsPropControllers } from '../../prop-controllers/instances'\nimport { isMeasurable, measure } from '../../state/modules/read-write/box-models'\nimport {\n isPropControllersHandle,\n PropControllersHandle,\n} from '../../state/modules/prop-controller-handles'\n\nexport class ElementImperativeHandle<\n T extends Record<string, Descriptor> = Record<string, Descriptor>,\n >\n implements BoxModelHandle, PropControllersHandle<T>\n{\n private getCurrent: () => unknown = () => null\n private lastPropControllers: DescriptorsPropControllers<T> | null = null\n\n callback(getCurrent: () => unknown) {\n const current = this.getCurrent()\n\n if (current === null) this.setPropControllers(null)\n\n this.getCurrent = getCurrent\n\n if (this.lastPropControllers !== null) this.setPropControllers(this.lastPropControllers)\n }\n\n getBoxModel(): BoxDisplayModel | null {\n const current = this.getCurrent()\n\n return isMeasurable(current) ? measure(current) : null\n }\n\n setPropControllers(propControllers: DescriptorsPropControllers<T> | null): void {\n const current = this.getCurrent()\n\n if (isPropControllersHandle(current)) current.setPropControllers(propControllers)\n\n this.lastPropControllers = propControllers\n }\n\n getDomNode(): Element | null {\n const current = this.getCurrent()\n\n if (isDomNodeHandle(current)) return current.getDomNode()\n\n return current instanceof Element ? current : null\n }\n}\n\ntype DomNodeHandle = {\n getDomNode(): Element | null\n}\n\nexport function isDomNodeHandle(value: unknown): value is DomNodeHandle {\n if (\n typeof value === 'object' &&\n value !== null &&\n 'getDomNode' in value &&\n typeof (value as { getDomNode: unknown }).getDomNode === 'function'\n ) {\n return true\n }\n\n return false\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,qBAAsC;AACtC,qCAGO;AAEA,MAAM,wBAIb;AAAA,EACU,aAA4B,MAAM;AAAA,EAClC,sBAA4D;AAAA,EAEpE,SAAS,YAA2B;AAClC,UAAM,UAAU,KAAK,WAAW;AAEhC,QAAI,YAAY;AAAM,WAAK,mBAAmB,IAAI;AAElD,SAAK,aAAa;AAElB,QAAI,KAAK,wBAAwB;AAAM,WAAK,mBAAmB,KAAK,mBAAmB;AAAA,EACzF;AAAA,EAEA,cAAsC;AACpC,UAAM,UAAU,KAAK,WAAW;AAEhC,eAAO,iCAAa,OAAO,QAAI,4BAAQ,OAAO,IAAI;AAAA,EACpD;AAAA,EAEA,mBAAmB,iBAA6D;AAC9E,UAAM,UAAU,KAAK,WAAW;AAEhC,YAAI,wDAAwB,OAAO;AAAG,cAAQ,mBAAmB,eAAe;AAEhF,SAAK,sBAAsB;AAAA,EAC7B;AAAA,EAEA,aAA6B;AAC3B,UAAM,UAAU,KAAK,WAAW;AAEhC,QAAI,gBAAgB,OAAO;AAAG,aAAO,QAAQ,WAAW;AAExD,WAAO,mBAAmB,UAAU,UAAU;AAAA,EAChD;AACF;AAMO,SAAS,gBAAgB,OAAwC;AACtE,MACE,OAAO,UAAU,YACjB,UAAU,QACV,gBAAgB,SAChB,OAAQ,MAAkC,eAAe,YACzD;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":["import_box_models"]}
1
+ {"version":3,"sources":["../../../../src/runtimes/react/element-imperative-handle.ts"],"sourcesContent":["import { BoxModelHandle, type BoxDisplayModel } from '../../state/modules/read-write/box-models'\nimport { Descriptor } from '../../prop-controllers/descriptors'\nimport { DescriptorsPropControllers } from '../../prop-controllers/instances'\nimport { isMeasurable, measure } from '../../state/modules/read-write/box-models'\nimport {\n isPropControllersHandle,\n PropControllersHandle,\n} from '../../state/modules/read-write/prop-controllers'\n\nexport class ElementImperativeHandle<\n T extends Record<string, Descriptor> = Record<string, Descriptor>,\n >\n implements BoxModelHandle, PropControllersHandle<T>\n{\n private getCurrent: () => unknown = () => null\n private lastPropControllers: DescriptorsPropControllers<T> | null = null\n\n callback(getCurrent: () => unknown) {\n const current = this.getCurrent()\n\n if (current === null) this.setPropControllers(null)\n\n this.getCurrent = getCurrent\n\n if (this.lastPropControllers !== null) this.setPropControllers(this.lastPropControllers)\n }\n\n getBoxModel(): BoxDisplayModel | null {\n const current = this.getCurrent()\n\n return isMeasurable(current) ? measure(current) : null\n }\n\n setPropControllers(propControllers: DescriptorsPropControllers<T> | null): void {\n const current = this.getCurrent()\n\n if (isPropControllersHandle(current)) current.setPropControllers(propControllers)\n\n this.lastPropControllers = propControllers\n }\n\n getDomNode(): Element | null {\n const current = this.getCurrent()\n\n if (isDomNodeHandle(current)) return current.getDomNode()\n\n return current instanceof Element ? current : null\n }\n}\n\ntype DomNodeHandle = {\n getDomNode(): Element | null\n}\n\nexport function isDomNodeHandle(value: unknown): value is DomNodeHandle {\n if (\n typeof value === 'object' &&\n value !== null &&\n 'getDomNode' in value &&\n typeof (value as { getDomNode: unknown }).getDomNode === 'function'\n ) {\n return true\n }\n\n return false\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,qBAAsC;AACtC,8BAGO;AAEA,MAAM,wBAIb;AAAA,EACU,aAA4B,MAAM;AAAA,EAClC,sBAA4D;AAAA,EAEpE,SAAS,YAA2B;AAClC,UAAM,UAAU,KAAK,WAAW;AAEhC,QAAI,YAAY;AAAM,WAAK,mBAAmB,IAAI;AAElD,SAAK,aAAa;AAElB,QAAI,KAAK,wBAAwB;AAAM,WAAK,mBAAmB,KAAK,mBAAmB;AAAA,EACzF;AAAA,EAEA,cAAsC;AACpC,UAAM,UAAU,KAAK,WAAW;AAEhC,eAAO,iCAAa,OAAO,QAAI,4BAAQ,OAAO,IAAI;AAAA,EACpD;AAAA,EAEA,mBAAmB,iBAA6D;AAC9E,UAAM,UAAU,KAAK,WAAW;AAEhC,YAAI,iDAAwB,OAAO;AAAG,cAAQ,mBAAmB,eAAe;AAEhF,SAAK,sBAAsB;AAAA,EAC7B;AAAA,EAEA,aAA6B;AAC3B,UAAM,UAAU,KAAK,WAAW;AAEhC,QAAI,gBAAgB,OAAO;AAAG,aAAO,QAAQ,WAAW;AAExD,WAAO,mBAAmB,UAAU,UAAU;AAAA,EAChD;AACF;AAMO,SAAS,gBAAgB,OAAwC;AACtE,MACE,OAAO,UAAU,YACjB,UAAU,QACV,gBAAgB,SAChB,OAAQ,MAAkC,eAAe,YACzD;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":["import_box_models"]}
@@ -21,15 +21,16 @@ __export(use_control_instances_exports, {
21
21
  useControlInstances: () => useControlInstances
22
22
  });
23
23
  module.exports = __toCommonJS(use_control_instances_exports);
24
- var import_read_only_state = require("../../../state/read-only-state");
24
+ var import_read_write_state = require("../../../state/read-write-state");
25
+ var import_unified_state = require("../../../state/unified-state");
25
26
  var import_use_document_context = require("./use-document-context");
26
27
  var import_use_selector = require("./use-selector");
27
28
  function useControlInstances(elementKey) {
28
29
  const documentKey = (0, import_use_document_context.useDocumentKey)();
29
30
  return (0, import_use_selector.useSelector)((state) => {
30
- if (documentKey == null)
31
+ if (documentKey == null || !(0, import_unified_state.isReadWriteState)(state))
31
32
  return null;
32
- return (0, import_read_only_state.getPropControllers)(state, { documentKey, elementKey });
33
+ return (0, import_read_write_state.getPropControllers)(state, { documentKey, elementKey });
33
34
  });
34
35
  }
35
36
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-control-instances.ts"],"sourcesContent":["import { ControlInstance } from '@makeswift/controls'\n\nimport { getPropControllers } from '../../../state/read-only-state'\nimport { useDocumentKey } from './use-document-context'\nimport { useSelector } from './use-selector'\n\nexport function useControlInstances(elementKey: string): Record<string, ControlInstance> | null {\n const documentKey = useDocumentKey()\n\n return useSelector(state => {\n if (documentKey == null) return null\n\n return getPropControllers(state, { documentKey, elementKey })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,6BAAmC;AACnC,kCAA+B;AAC/B,0BAA4B;AAErB,SAAS,oBAAoB,YAA4D;AAC9F,QAAM,kBAAc,4CAAe;AAEnC,aAAO,iCAAY,WAAS;AAC1B,QAAI,eAAe;AAAM,aAAO;AAEhC,eAAO,2CAAmB,OAAO,EAAE,aAAa,WAAW,CAAC;AAAA,EAC9D,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-control-instances.ts"],"sourcesContent":["import { ControlInstance } from '@makeswift/controls'\n\nimport { getPropControllers } from '../../../state/read-write-state'\nimport { isReadWriteState } from '../../../state/unified-state'\nimport { useDocumentKey } from './use-document-context'\nimport { useSelector } from './use-selector'\n\nexport function useControlInstances(elementKey: string): Record<string, ControlInstance> | null {\n const documentKey = useDocumentKey()\n\n return useSelector(state => {\n if (documentKey == null || !isReadWriteState(state)) return null\n\n return getPropControllers(state, { documentKey, elementKey })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,8BAAmC;AACnC,2BAAiC;AACjC,kCAA+B;AAC/B,0BAA4B;AAErB,SAAS,oBAAoB,YAA4D;AAC9F,QAAM,kBAAc,4CAAe;AAEnC,aAAO,iCAAY,WAAS;AAC1B,QAAI,eAAe,QAAQ,KAAC,uCAAiB,KAAK;AAAG,aAAO;AAE5D,eAAO,4CAAmB,OAAO,EAAE,aAAa,WAAW,CAAC;AAAA,EAC9D,CAAC;AACH;","names":[]}
@@ -25,21 +25,20 @@ var import_react = require("react");
25
25
  var import_controls = require("@makeswift/controls");
26
26
  var import_use_resource_resolver = require("./use-resource-resolver");
27
27
  var import_prop_error_handling_proxy = require("../utils/prop-error-handling-proxy");
28
- var import_use_control_instances = require("./use-control-instances");
29
28
  var import_use_resolvable_record = require("./use-resolvable-record");
30
29
  function useResolvedProps({
30
+ elementKey,
31
31
  propDefs,
32
32
  propData,
33
- elementKey,
33
+ controlInstances,
34
34
  stylesheetFactory
35
35
  }) {
36
36
  const resourceResolver = (0, import_use_resource_resolver.useResourceResolver)();
37
- const controls = (0, import_use_control_instances.useControlInstances)(elementKey);
38
37
  const cache = (0, import_react.useRef)({}).current;
39
38
  const resolveProp = (0, import_react.useCallback)(
40
39
  (def, propName) => {
41
40
  const data = propData[propName];
42
- const control = controls?.[propName];
41
+ const control = controlInstances?.[propName];
43
42
  if (cache[propName] != null && data === cache[propName].data && control === cache[propName].control) {
44
43
  return cache[propName].resolvedValue;
45
44
  }
@@ -52,24 +51,26 @@ function useResolvedProps({
52
51
  cache[propName] = { data, control, resolvedValue };
53
52
  return resolvedValue;
54
53
  },
55
- [controls, propData, resourceResolver, stylesheetFactory]
54
+ [propData, cache, resourceResolver, controlInstances, stylesheetFactory]
56
55
  );
57
56
  const resolvables = (0, import_react.useMemo)(
58
57
  () => (0, import_controls.mapValues)(propDefs, (def, propName) => {
59
58
  const defaultValue = def.config?.defaultValue;
60
59
  return (0, import_prop_error_handling_proxy.propErrorHandlingProxy)(resolveProp(def, propName), defaultValue, (error) => {
61
60
  console.warn(
62
- `Error reading value for prop "${propName}", falling back to \`${defaultValue}\`.`,
61
+ `Error reading value for prop "${propName}" of element ${elementKey}, falling back to \`${defaultValue}\`.`,
63
62
  { control: def, error }
64
63
  );
65
64
  });
66
65
  }),
67
- [propDefs, resolveProp]
66
+ [propDefs, resolveProp, elementKey]
68
67
  );
69
68
  const props = (0, import_use_resolvable_record.useResolvableRecord)(resolvables);
70
69
  (0, import_react.useEffect)(() => {
71
- props.triggerResolve();
72
- }, [props]);
70
+ props.triggerResolve().catch((err) => {
71
+ console.log(`Error while resolving props for element ${elementKey}`, err);
72
+ });
73
+ }, [props, elementKey]);
73
74
  const resolvedProps = (0, import_react.useSyncExternalStore)(props.subscribe, props.readStable, props.readStable);
74
75
  stylesheetFactory.useDefinedStyles();
75
76
  return resolvedProps;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-resolved-props.ts"],"sourcesContent":["import { useMemo, useEffect, useRef, useSyncExternalStore, useCallback } from 'react'\nimport {\n ControlDefinition,\n ControlInstance,\n mapValues,\n type Data,\n type Resolvable,\n} from '@makeswift/controls'\n\nimport { useResourceResolver } from './use-resource-resolver'\n\nimport { type StylesheetFactory } from '../stylesheet-factory'\nimport { propErrorHandlingProxy } from '../utils/prop-error-handling-proxy'\n\nimport { useControlInstances } from './use-control-instances'\nimport { useResolvableRecord } from './use-resolvable-record'\n\ntype CacheItem = {\n data: Data\n control: ControlInstance | undefined\n resolvedValue: Resolvable<unknown>\n}\n\nexport function useResolvedProps({\n propDefs,\n propData,\n elementKey,\n stylesheetFactory,\n}: {\n propDefs: Record<string, ControlDefinition>\n propData: Record<string, Data>\n elementKey: string\n stylesheetFactory: StylesheetFactory\n}): Record<string, unknown> {\n const resourceResolver = useResourceResolver()\n const controls = useControlInstances(elementKey)\n\n const cache = useRef<Record<string, CacheItem>>({}).current\n const resolveProp = useCallback(\n (def: ControlDefinition, propName: string) => {\n const data = propData[propName]\n const control = controls?.[propName]\n\n if (\n cache[propName] != null &&\n data === cache[propName].data &&\n control === cache[propName].control\n ) {\n return cache[propName].resolvedValue\n }\n\n const resolvedValue = def.resolveValue(\n data,\n resourceResolver,\n stylesheetFactory.get(propName),\n control,\n )\n\n cache[propName] = { data, control, resolvedValue }\n return resolvedValue\n },\n [controls, propData, resourceResolver, stylesheetFactory],\n )\n\n const resolvables = useMemo<Record<string, Resolvable<unknown>>>(\n () =>\n mapValues(propDefs, (def, propName) => {\n const defaultValue = (def.config as any)?.defaultValue\n return propErrorHandlingProxy(resolveProp(def, propName), defaultValue, error => {\n console.warn(\n `Error reading value for prop \"${propName}\", falling back to \\`${defaultValue}\\`.`,\n { control: def, error },\n )\n })\n }),\n [propDefs, resolveProp],\n )\n\n const props = useResolvableRecord(resolvables)\n\n // no need to call `triggerResolve` on the server, all the resources should already be in\n // the host API client's cache (populated from the snapshot's cache)\n useEffect(() => {\n props.triggerResolve()\n }, [props])\n\n // the order is important here, the styles are defined in the process of the props resolution,\n // calling `useDefinedStyles` before the props are resolved would effectively be a noop\n const resolvedProps = useSyncExternalStore(props.subscribe, props.readStable, props.readStable)\n\n stylesheetFactory.useDefinedStyles()\n\n return resolvedProps\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8E;AAC9E,sBAMO;AAEP,mCAAoC;AAGpC,uCAAuC;AAEvC,mCAAoC;AACpC,mCAAoC;AAQ7B,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAK4B;AAC1B,QAAM,uBAAmB,kDAAoB;AAC7C,QAAM,eAAW,kDAAoB,UAAU;AAE/C,QAAM,YAAQ,qBAAkC,CAAC,CAAC,EAAE;AACpD,QAAM,kBAAc;AAAA,IAClB,CAAC,KAAwB,aAAqB;AAC5C,YAAM,OAAO,SAAS,QAAQ;AAC9B,YAAM,UAAU,WAAW,QAAQ;AAEnC,UACE,MAAM,QAAQ,KAAK,QACnB,SAAS,MAAM,QAAQ,EAAE,QACzB,YAAY,MAAM,QAAQ,EAAE,SAC5B;AACA,eAAO,MAAM,QAAQ,EAAE;AAAA,MACzB;AAEA,YAAM,gBAAgB,IAAI;AAAA,QACxB;AAAA,QACA;AAAA,QACA,kBAAkB,IAAI,QAAQ;AAAA,QAC9B;AAAA,MACF;AAEA,YAAM,QAAQ,IAAI,EAAE,MAAM,SAAS,cAAc;AACjD,aAAO;AAAA,IACT;AAAA,IACA,CAAC,UAAU,UAAU,kBAAkB,iBAAiB;AAAA,EAC1D;AAEA,QAAM,kBAAc;AAAA,IAClB,UACE,2BAAU,UAAU,CAAC,KAAK,aAAa;AACrC,YAAM,eAAgB,IAAI,QAAgB;AAC1C,iBAAO,yDAAuB,YAAY,KAAK,QAAQ,GAAG,cAAc,WAAS;AAC/E,gBAAQ;AAAA,UACN,iCAAiC,QAAQ,wBAAwB,YAAY;AAAA,UAC7E,EAAE,SAAS,KAAK,MAAM;AAAA,QACxB;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,IACH,CAAC,UAAU,WAAW;AAAA,EACxB;AAEA,QAAM,YAAQ,kDAAoB,WAAW;AAI7C,8BAAU,MAAM;AACd,UAAM,eAAe;AAAA,EACvB,GAAG,CAAC,KAAK,CAAC;AAIV,QAAM,oBAAgB,mCAAqB,MAAM,WAAW,MAAM,YAAY,MAAM,UAAU;AAE9F,oBAAkB,iBAAiB;AAEnC,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-resolved-props.ts"],"sourcesContent":["import { useMemo, useEffect, useRef, useSyncExternalStore, useCallback } from 'react'\nimport {\n ControlDefinition,\n ControlInstance,\n mapValues,\n type Data,\n type Resolvable,\n} from '@makeswift/controls'\n\nimport { useResourceResolver } from './use-resource-resolver'\n\nimport { type StylesheetFactory } from '../stylesheet-factory'\nimport { propErrorHandlingProxy } from '../utils/prop-error-handling-proxy'\n\nimport { useResolvableRecord } from './use-resolvable-record'\n\ntype CacheItem = {\n data: Data\n control: ControlInstance | undefined\n resolvedValue: Resolvable<unknown>\n}\n\nexport function useResolvedProps({\n elementKey,\n propDefs,\n propData,\n controlInstances,\n stylesheetFactory,\n}: {\n elementKey: string\n propDefs: Record<string, ControlDefinition>\n propData: Record<string, Data>\n controlInstances: Record<string, ControlInstance> | null\n stylesheetFactory: StylesheetFactory\n}): Record<string, unknown> {\n const resourceResolver = useResourceResolver()\n\n const cache = useRef<Record<string, CacheItem>>({}).current\n const resolveProp = useCallback(\n (def: ControlDefinition, propName: string) => {\n const data = propData[propName]\n const control = controlInstances?.[propName]\n\n if (\n cache[propName] != null &&\n data === cache[propName].data &&\n control === cache[propName].control\n ) {\n return cache[propName].resolvedValue\n }\n\n const resolvedValue = def.resolveValue(\n data,\n resourceResolver,\n stylesheetFactory.get(propName),\n control,\n )\n\n cache[propName] = { data, control, resolvedValue }\n return resolvedValue\n },\n [propData, cache, resourceResolver, controlInstances, stylesheetFactory],\n )\n\n const resolvables = useMemo<Record<string, Resolvable<unknown>>>(\n () =>\n mapValues(propDefs, (def, propName) => {\n const defaultValue = (def.config as any)?.defaultValue\n return propErrorHandlingProxy(resolveProp(def, propName), defaultValue, error => {\n console.warn(\n `Error reading value for prop \"${propName}\" of element ${elementKey}, falling back to \\`${defaultValue}\\`.`,\n { control: def, error },\n )\n })\n }),\n [propDefs, resolveProp, elementKey],\n )\n\n const props = useResolvableRecord(resolvables)\n\n // no need to call `triggerResolve` on the server, all the resources should already be in\n // the host API client's cache (populated from the snapshot's cache)\n useEffect(() => {\n props.triggerResolve().catch(err => {\n console.log(`Error while resolving props for element ${elementKey}`, err)\n })\n }, [props, elementKey])\n\n // the order is important here, the styles are defined in the process of the props resolution,\n // calling `useDefinedStyles` before the props are resolved would effectively be a noop\n const resolvedProps = useSyncExternalStore(props.subscribe, props.readStable, props.readStable)\n\n stylesheetFactory.useDefinedStyles()\n\n return resolvedProps\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8E;AAC9E,sBAMO;AAEP,mCAAoC;AAGpC,uCAAuC;AAEvC,mCAAoC;AAQ7B,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAM4B;AAC1B,QAAM,uBAAmB,kDAAoB;AAE7C,QAAM,YAAQ,qBAAkC,CAAC,CAAC,EAAE;AACpD,QAAM,kBAAc;AAAA,IAClB,CAAC,KAAwB,aAAqB;AAC5C,YAAM,OAAO,SAAS,QAAQ;AAC9B,YAAM,UAAU,mBAAmB,QAAQ;AAE3C,UACE,MAAM,QAAQ,KAAK,QACnB,SAAS,MAAM,QAAQ,EAAE,QACzB,YAAY,MAAM,QAAQ,EAAE,SAC5B;AACA,eAAO,MAAM,QAAQ,EAAE;AAAA,MACzB;AAEA,YAAM,gBAAgB,IAAI;AAAA,QACxB;AAAA,QACA;AAAA,QACA,kBAAkB,IAAI,QAAQ;AAAA,QAC9B;AAAA,MACF;AAEA,YAAM,QAAQ,IAAI,EAAE,MAAM,SAAS,cAAc;AACjD,aAAO;AAAA,IACT;AAAA,IACA,CAAC,UAAU,OAAO,kBAAkB,kBAAkB,iBAAiB;AAAA,EACzE;AAEA,QAAM,kBAAc;AAAA,IAClB,UACE,2BAAU,UAAU,CAAC,KAAK,aAAa;AACrC,YAAM,eAAgB,IAAI,QAAgB;AAC1C,iBAAO,yDAAuB,YAAY,KAAK,QAAQ,GAAG,cAAc,WAAS;AAC/E,gBAAQ;AAAA,UACN,iCAAiC,QAAQ,gBAAgB,UAAU,uBAAuB,YAAY;AAAA,UACtG,EAAE,SAAS,KAAK,MAAM;AAAA,QACxB;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,IACH,CAAC,UAAU,aAAa,UAAU;AAAA,EACpC;AAEA,QAAM,YAAQ,kDAAoB,WAAW;AAI7C,8BAAU,MAAM;AACd,UAAM,eAAe,EAAE,MAAM,SAAO;AAClC,cAAQ,IAAI,2CAA2C,UAAU,IAAI,GAAG;AAAA,IAC1E,CAAC;AAAA,EACH,GAAG,CAAC,OAAO,UAAU,CAAC;AAItB,QAAM,oBAAgB,mCAAqB,MAAM,WAAW,MAAM,YAAY,MAAM,UAAU;AAE9F,oBAAkB,iBAAiB;AAEnC,SAAO;AACT;","names":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var testing_exports = {};
17
+ module.exports = __toCommonJS(testing_exports);
18
+ __reExport(testing_exports, require("./react-provider"), module.exports);
19
+ __reExport(testing_exports, require("./react-runtime"), module.exports);
20
+ // Annotate the CommonJS export names for ESM import in node:
21
+ 0 && (module.exports = {
22
+ ...require("./react-provider"),
23
+ ...require("./react-runtime")
24
+ });
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/testing/index.ts"],"sourcesContent":["export * from './react-provider'\nexport * from './react-runtime'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAc,6BAAd;AACA,4BAAc,4BADd;","names":[]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var react_provider_exports = {};
20
+ __export(react_provider_exports, {
21
+ ReactProvider: () => ReactProvider
22
+ });
23
+ module.exports = __toCommonJS(react_provider_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_RuntimeProvider = require("../components/RuntimeProvider");
26
+ var import_root_style_registry = require("../root-style-registry");
27
+ function ReactProvider({
28
+ children,
29
+ runtime,
30
+ siteVersion = null
31
+ }) {
32
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_RuntimeProvider.RuntimeProvider, { siteVersion, runtime, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_root_style_registry.DefaultRootStyleRegistry, { children }) });
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ ReactProvider
37
+ });
38
+ //# sourceMappingURL=react-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/testing/react-provider.tsx"],"sourcesContent":["import { type ReactRuntimeCore } from '../react-runtime-core'\nimport { RuntimeProvider } from '../components/RuntimeProvider'\n\nimport { DefaultRootStyleRegistry } from '../root-style-registry'\nimport { SiteVersion } from '../../../api/site-version'\n\nexport function ReactProvider({\n children,\n runtime,\n siteVersion = null,\n}: {\n children: React.ReactNode\n runtime: ReactRuntimeCore\n siteVersion?: SiteVersion | null\n}) {\n return (\n <RuntimeProvider siteVersion={siteVersion} runtime={runtime}>\n <DefaultRootStyleRegistry>{children}</DefaultRootStyleRegistry>\n </RuntimeProvider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBM;AAhBN,6BAAgC;AAEhC,iCAAyC;AAGlC,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAIG;AACD,SACE,4CAAC,0CAAgB,aAA0B,SACzC,sDAAC,uDAA0B,UAAS,GACtC;AAEJ;","names":[]}
@@ -23,13 +23,13 @@ __export(actions_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(actions_exports);
25
25
  var import_toolkit = require("@reduxjs/toolkit");
26
- var import_actions = require("../builder-api/actions");
26
+ var import_action_types = require("../builder-api/action-types");
27
27
  var import_host_api = require("../host-api");
28
- var import_internal = require("./internal");
28
+ var import_action_types2 = require("./internal/action-types");
29
29
  const ActionTypes = {
30
30
  ...import_host_api.HostActionTypes,
31
- ...import_actions.BuilderActionTypes,
32
- ...import_internal.InternalActionTypes
31
+ ...import_action_types.BuilderActionTypes,
32
+ ...import_action_types2.InternalActionTypes
33
33
  };
34
34
  function isKnownAction(action) {
35
35
  return (0, import_toolkit.isAction)(action) && Object.hasOwn(ActionTypes, action.type);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/state/actions/index.ts"],"sourcesContent":["import { isAction } from '@reduxjs/toolkit'\n\nimport { type BuilderAction, BuilderActionTypes } from '../builder-api/actions'\nimport { type HostAction, HostActionTypes } from '../host-api'\n\nimport { type InternalAction, InternalActionTypes } from './internal'\n\nexport { type UnknownAction } from '@reduxjs/toolkit'\nexport { type DocumentPayload } from '../shared-api'\n\nexport const ActionTypes = {\n ...HostActionTypes,\n ...BuilderActionTypes,\n ...InternalActionTypes,\n} as const\n\nexport type Action = HostAction | BuilderAction | InternalAction\n\nexport function isKnownAction(action: unknown): action is Action {\n return isAction(action) && Object.hasOwn(ActionTypes, action.type)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAyB;AAEzB,qBAAuD;AACvD,sBAAiD;AAEjD,sBAAyD;AAKlD,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAIO,SAAS,cAAc,QAAmC;AAC/D,aAAO,yBAAS,MAAM,KAAK,OAAO,OAAO,aAAa,OAAO,IAAI;AACnE;","names":[]}
1
+ {"version":3,"sources":["../../../../src/state/actions/index.ts"],"sourcesContent":["import { isAction } from '@reduxjs/toolkit'\n\nimport { type BuilderAction } from '../builder-api/actions'\nimport { BuilderActionTypes } from '../builder-api/action-types'\nimport { type HostAction, HostActionTypes } from '../host-api'\n\nimport { type InternalAction } from './internal'\nimport { InternalActionTypes } from './internal/action-types'\n\nexport { type UnknownAction } from '@reduxjs/toolkit'\nexport { type DocumentPayload } from '../shared-api'\n\nexport const ActionTypes = {\n ...HostActionTypes,\n ...BuilderActionTypes,\n ...InternalActionTypes,\n} as const\n\nexport type Action = HostAction | BuilderAction | InternalAction\n\nexport function isKnownAction(action: unknown): action is Action {\n return isAction(action) && Object.hasOwn(ActionTypes, action.type)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAyB;AAGzB,0BAAmC;AACnC,sBAAiD;AAGjD,IAAAA,uBAAoC;AAK7B,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAIO,SAAS,cAAc,QAAmC;AAC/D,aAAO,yBAAS,MAAM,KAAK,OAAO,OAAO,aAAa,OAAO,IAAI;AACnE;","names":["import_action_types"]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var action_types_exports = {};
20
+ __export(action_types_exports, {
21
+ InternalActionTypes: () => InternalActionTypes
22
+ });
23
+ module.exports = __toCommonJS(action_types_exports);
24
+ var import_read_only_action_types = require("./read-only-action-types");
25
+ var import_read_write_action_types = require("./read-write-action-types");
26
+ const InternalActionTypes = {
27
+ ...import_read_only_action_types.ReadOnlyActionTypes,
28
+ ...import_read_write_action_types.ReadWriteActionTypes
29
+ };
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ InternalActionTypes
33
+ });
34
+ //# sourceMappingURL=action-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/state/actions/internal/action-types.ts"],"sourcesContent":["import { ReadOnlyActionTypes } from './read-only-action-types'\nimport { ReadWriteActionTypes } from './read-write-action-types'\n\nexport const InternalActionTypes = {\n ...ReadOnlyActionTypes,\n ...ReadWriteActionTypes,\n} as const\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAoC;AACpC,qCAAqC;AAE9B,MAAM,sBAAsB;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AACL;","names":[]}
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
6
  var __copyProps = (to, from, except, desc) => {
11
7
  if (from && typeof from === "object" || typeof from === "function") {
12
8
  for (let key of __getOwnPropNames(from))
@@ -17,18 +13,5 @@ var __copyProps = (to, from, except, desc) => {
17
13
  };
18
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
15
  var internal_exports = {};
20
- __export(internal_exports, {
21
- InternalActionTypes: () => InternalActionTypes
22
- });
23
16
  module.exports = __toCommonJS(internal_exports);
24
- var import_read_only_actions = require("./read-only-actions");
25
- var import_read_write_actions = require("./read-write-actions");
26
- const InternalActionTypes = {
27
- ...import_read_only_actions.ReadOnlyActionTypes,
28
- ...import_read_write_actions.ReadWriteActionTypes
29
- };
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
32
- InternalActionTypes
33
- });
34
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/state/actions/internal/index.ts"],"sourcesContent":["import { type ReadOnlyAction, ReadOnlyActionTypes } from './read-only-actions'\nimport { type ReadWriteAction, ReadWriteActionTypes } from './read-write-actions'\n\nexport const InternalActionTypes = {\n ...ReadOnlyActionTypes,\n ...ReadWriteActionTypes,\n} as const\n\nexport type InternalAction = ReadOnlyAction | ReadWriteAction\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAyD;AACzD,gCAA2D;AAEpD,MAAM,sBAAsB;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AACL;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/state/actions/internal/index.ts"],"sourcesContent":["import { type ReadOnlyAction } from './read-only-actions'\nimport { type ReadWriteAction } from './read-write-actions'\n\nexport type InternalAction = ReadOnlyAction | ReadWriteAction\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var read_only_action_types_exports = {};
20
+ __export(read_only_action_types_exports, {
21
+ ReadOnlyActionTypes: () => ReadOnlyActionTypes
22
+ });
23
+ module.exports = __toCommonJS(read_only_action_types_exports);
24
+ const ReadOnlyActionTypes = {
25
+ // TODO: this one should be a read-write action and we should refuse
26
+ // to fetch resources on the client in read-only mode
27
+ API_RESOURCE_FULFILLED: "API_RESOURCE_FULFILLED",
28
+ CREATE_ELEMENT_TREE: "CREATE_ELEMENT_TREE",
29
+ DELETE_ELEMENT_TREE: "DELETE_ELEMENT_TREE",
30
+ REGISTER_COMPONENT: "REGISTER_COMPONENT",
31
+ UNREGISTER_COMPONENT: "UNREGISTER_COMPONENT",
32
+ REGISTER_REACT_COMPONENT: "REGISTER_REACT_COMPONENT",
33
+ UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT",
34
+ SET_BREAKPOINTS: "SET_BREAKPOINTS",
35
+ UPDATE_CLIENT_BREAKPOINT: "UPDATE_CLIENT_BREAKPOINT",
36
+ SET_LOCALE: "SET_LOCALE",
37
+ SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER",
38
+ SET_IS_READ_ONLY: "SET_IS_READ_ONLY"
39
+ };
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ ReadOnlyActionTypes
43
+ });
44
+ //# sourceMappingURL=read-only-action-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/state/actions/internal/read-only-action-types.ts"],"sourcesContent":["export 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\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"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,sBAAsB;AAAA;AAAA;AAAA,EAGjC,wBAAwB;AAAA,EAExB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EAErB,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EAEtB,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAE5B,iBAAiB;AAAA,EACjB,0BAA0B;AAAA,EAE1B,YAAY;AAAA,EAEZ,mBAAmB;AAAA,EACnB,kBAAkB;AACpB;","names":[]}
@@ -18,73 +18,45 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var read_only_actions_exports = {};
20
20
  __export(read_only_actions_exports, {
21
- ReadOnlyActionTypes: () => ReadOnlyActionTypes,
22
21
  apiResourceFulfilled: () => apiResourceFulfilled,
23
22
  createElementTree: () => createElementTree,
24
23
  deleteElementTree: () => deleteElementTree,
25
24
  registerComponent: () => registerComponent,
26
25
  registerComponentEffect: () => registerComponentEffect,
27
- registerComponentHandle: () => registerComponentHandle,
28
- registerComponentHandleEffect: () => registerComponentHandleEffect,
29
- registerPropControllers: () => registerPropControllers,
30
- registerPropControllersHandle: () => registerPropControllersHandle,
31
26
  registerReactComponentEffect: () => registerReactComponentEffect,
32
27
  setBreakpoints: () => setBreakpoints,
33
28
  setIsInBuilder: () => setIsInBuilder,
34
29
  setIsReadOnly: () => setIsReadOnly,
35
30
  setLocale: () => setLocale,
36
31
  unregisterComponent: () => unregisterComponent,
37
- unregisterPropControllers: () => unregisterPropControllers,
38
- unregisterPropControllersHandle: () => unregisterPropControllersHandle,
39
32
  updateClientBreakpoint: () => updateClientBreakpoint
40
33
  });
41
34
  module.exports = __toCommonJS(read_only_actions_exports);
42
35
  var import_locale = require("../../../locale");
43
- const ReadOnlyActionTypes = {
44
- // TODO: this one should be a read-write action and we should refuse
45
- // to fetch resources on the client in read-only mode
46
- API_RESOURCE_FULFILLED: "API_RESOURCE_FULFILLED",
47
- CREATE_ELEMENT_TREE: "CREATE_ELEMENT_TREE",
48
- DELETE_ELEMENT_TREE: "DELETE_ELEMENT_TREE",
49
- REGISTER_COMPONENT: "REGISTER_COMPONENT",
50
- UNREGISTER_COMPONENT: "UNREGISTER_COMPONENT",
51
- REGISTER_COMPONENT_HANDLE: "REGISTER_COMPONENT_HANDLE",
52
- UNREGISTER_COMPONENT_HANDLE: "UNREGISTER_COMPONENT_HANDLE",
53
- REGISTER_PROP_CONTROLLERS: "REGISTER_PROP_CONTROLLERS",
54
- UNREGISTER_PROP_CONTROLLERS: "UNREGISTER_PROP_CONTROLLERS",
55
- REGISTER_PROP_CONTROLLERS_HANDLE: "REGISTER_PROP_CONTROLLERS_HANDLE",
56
- UNREGISTER_PROP_CONTROLLERS_HANDLE: "UNREGISTER_PROP_CONTROLLERS_HANDLE",
57
- REGISTER_REACT_COMPONENT: "REGISTER_REACT_COMPONENT",
58
- UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT",
59
- SET_BREAKPOINTS: "SET_BREAKPOINTS",
60
- UPDATE_CLIENT_BREAKPOINT: "UPDATE_CLIENT_BREAKPOINT",
61
- SET_LOCALE: "SET_LOCALE",
62
- SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER",
63
- SET_IS_READ_ONLY: "SET_IS_READ_ONLY"
64
- };
36
+ var import_read_only_action_types = require("./read-only-action-types");
65
37
  function apiResourceFulfilled(resourceType, resourceId, resource, locale) {
66
38
  return {
67
- type: ReadOnlyActionTypes.API_RESOURCE_FULFILLED,
39
+ type: import_read_only_action_types.ReadOnlyActionTypes.API_RESOURCE_FULFILLED,
68
40
  payload: { resourceType, resourceId, resource, locale }
69
41
  };
70
42
  }
71
43
  function createElementTree(payload) {
72
44
  return {
73
- type: ReadOnlyActionTypes.CREATE_ELEMENT_TREE,
45
+ type: import_read_only_action_types.ReadOnlyActionTypes.CREATE_ELEMENT_TREE,
74
46
  payload
75
47
  };
76
48
  }
77
49
  function deleteElementTree(payload) {
78
- return { type: ReadOnlyActionTypes.DELETE_ELEMENT_TREE, payload };
50
+ return { type: import_read_only_action_types.ReadOnlyActionTypes.DELETE_ELEMENT_TREE, payload };
79
51
  }
80
52
  function registerComponent(type, meta, propControllerDescriptors) {
81
53
  return {
82
- type: ReadOnlyActionTypes.REGISTER_COMPONENT,
54
+ type: import_read_only_action_types.ReadOnlyActionTypes.REGISTER_COMPONENT,
83
55
  payload: { type, meta, propControllerDescriptors }
84
56
  };
85
57
  }
86
58
  function unregisterComponent(type) {
87
- return { type: ReadOnlyActionTypes.UNREGISTER_COMPONENT, payload: { type } };
59
+ return { type: import_read_only_action_types.ReadOnlyActionTypes.UNREGISTER_COMPONENT, payload: { type } };
88
60
  }
89
61
  function registerComponentEffect(type, meta, propControllerDescriptors) {
90
62
  return (dispatch) => {
@@ -94,55 +66,11 @@ function registerComponentEffect(type, meta, propControllerDescriptors) {
94
66
  };
95
67
  };
96
68
  }
97
- function registerComponentHandle(documentKey, elementKey, componentHandle) {
98
- return {
99
- type: ReadOnlyActionTypes.REGISTER_COMPONENT_HANDLE,
100
- payload: { documentKey, elementKey, componentHandle }
101
- };
102
- }
103
- function unregisterComponentHandle(documentKey, elementKey) {
104
- return {
105
- type: ReadOnlyActionTypes.UNREGISTER_COMPONENT_HANDLE,
106
- payload: { documentKey, elementKey }
107
- };
108
- }
109
- function registerComponentHandleEffect(documentKey, elementKey, componentHandle) {
110
- return (dispatch) => {
111
- dispatch(registerComponentHandle(documentKey, elementKey, componentHandle));
112
- return () => {
113
- dispatch(unregisterComponentHandle(documentKey, elementKey));
114
- };
115
- };
116
- }
117
- function registerPropControllersHandle(documentKey, elementKey, handle) {
118
- return {
119
- type: ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,
120
- payload: { documentKey, elementKey, handle }
121
- };
122
- }
123
- function unregisterPropControllersHandle(documentKey, elementKey) {
124
- return {
125
- type: ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,
126
- payload: { documentKey, elementKey }
127
- };
128
- }
129
- function registerPropControllers(documentKey, elementKey, propControllers) {
130
- return {
131
- type: ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS,
132
- payload: { documentKey, elementKey, propControllers }
133
- };
134
- }
135
- function unregisterPropControllers(documentKey, elementKey) {
136
- return {
137
- type: ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS,
138
- payload: { documentKey, elementKey }
139
- };
140
- }
141
69
  function registerReactComponent(type, component) {
142
- return { type: ReadOnlyActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } };
70
+ return { type: import_read_only_action_types.ReadOnlyActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } };
143
71
  }
144
72
  function unregisterReactComponent(type) {
145
- return { type: ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } };
73
+ return { type: import_read_only_action_types.ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } };
146
74
  }
147
75
  function registerReactComponentEffect(type, component) {
148
76
  return (dispatch) => {
@@ -153,43 +81,36 @@ function registerReactComponentEffect(type, component) {
153
81
  };
154
82
  }
155
83
  function setBreakpoints(breakpoints) {
156
- return { type: ReadOnlyActionTypes.SET_BREAKPOINTS, payload: { breakpoints } };
84
+ return { type: import_read_only_action_types.ReadOnlyActionTypes.SET_BREAKPOINTS, payload: { breakpoints } };
157
85
  }
158
86
  function updateClientBreakpoint() {
159
- return { type: ReadOnlyActionTypes.UPDATE_CLIENT_BREAKPOINT };
87
+ return { type: import_read_only_action_types.ReadOnlyActionTypes.UPDATE_CLIENT_BREAKPOINT };
160
88
  }
161
89
  function setLocale(locale, pathname) {
162
90
  return {
163
- type: ReadOnlyActionTypes.SET_LOCALE,
91
+ type: import_read_only_action_types.ReadOnlyActionTypes.SET_LOCALE,
164
92
  payload: { locale: import_locale.localeStringSchema.parse(locale.toString()), pathname }
165
93
  };
166
94
  }
167
95
  function setIsInBuilder(isInBuilder) {
168
- return { type: ReadOnlyActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder };
96
+ return { type: import_read_only_action_types.ReadOnlyActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder };
169
97
  }
170
98
  function setIsReadOnly(isReadOnly) {
171
- return { type: ReadOnlyActionTypes.SET_IS_READ_ONLY, payload: isReadOnly };
99
+ return { type: import_read_only_action_types.ReadOnlyActionTypes.SET_IS_READ_ONLY, payload: isReadOnly };
172
100
  }
173
101
  // Annotate the CommonJS export names for ESM import in node:
174
102
  0 && (module.exports = {
175
- ReadOnlyActionTypes,
176
103
  apiResourceFulfilled,
177
104
  createElementTree,
178
105
  deleteElementTree,
179
106
  registerComponent,
180
107
  registerComponentEffect,
181
- registerComponentHandle,
182
- registerComponentHandleEffect,
183
- registerPropControllers,
184
- registerPropControllersHandle,
185
108
  registerReactComponentEffect,
186
109
  setBreakpoints,
187
110
  setIsInBuilder,
188
111
  setIsReadOnly,
189
112
  setLocale,
190
113
  unregisterComponent,
191
- unregisterPropControllers,
192
- unregisterPropControllersHandle,
193
114
  updateClientBreakpoint
194
115
  });
195
116
  //# 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 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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,oBAAsD;AAG/C,MAAM,sBAAsB;AAAA;AAAA;AAAA,EAGjC,wBAAwB;AAAA,EAExB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EAErB,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EACtB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAE7B,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAC7B,kCAAkC;AAAA,EAClC,oCAAoC;AAAA,EAEpC,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAE5B,iBAAiB;AAAA,EACjB,0BAA0B;AAAA,EAE1B,YAAY;AAAA,EAEZ,mBAAmB;AAAA,EACnB,kBAAkB;AACpB;AA4HO,SAAS,qBACd,cACA,YACA,UACA,QAC4B;AAC5B,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,cAAc,YAAY,UAAU,OAAO;AAAA,EACxD;AACF;AAEO,SAAS,kBACd,SACyB;AACzB,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B;AAAA,EACF;AACF;AAEO,SAAS,kBACd,SACyB;AACzB,SAAO,EAAE,MAAM,oBAAoB,qBAAqB,QAAQ;AAClE;AAEO,SAAS,kBACd,MACA,MACA,2BACyB;AACzB,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,MAAM,MAAM,0BAA0B;AAAA,EACnD;AACF;AAEO,SAAS,oBAAoB,MAAyC;AAC3E,SAAO,EAAE,MAAM,oBAAoB,sBAAsB,SAAS,EAAE,KAAK,EAAE;AAC7E;AAEO,SAAS,wBACd,MACA,MACA,2BAC2D;AAC3D,SAAO,cAAY;AACjB,aAAS,kBAAkB,MAAM,MAAM,yBAAyB,CAAC;AAEjE,WAAO,MAAM;AACX,eAAS,oBAAoB,IAAI,CAAC;AAAA,IACpC;AAAA,EACF;AACF;AAEO,SAAS,wBACd,aACA,YACA,iBAC+B;AAC/B,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,YAAY,gBAAgB;AAAA,EACtD;AACF;AAEA,SAAS,0BACP,aACA,YACiC;AACjC,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,WAAW;AAAA,EACrC;AACF;AAEO,SAAS,8BACd,aACA,YACA,iBAC2D;AAC3D,SAAO,cAAY;AACjB,aAAS,wBAAwB,aAAa,YAAY,eAAe,CAAC;AAE1E,WAAO,MAAM;AACX,eAAS,0BAA0B,aAAa,UAAU,CAAC;AAAA,IAC7D;AAAA,EACF;AACF;AAEO,SAAS,8BACd,aACA,YACA,QACqC;AACrC,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,YAAY,OAAO;AAAA,EAC7C;AACF;AAEO,SAAS,gCACd,aACA,YACuC;AACvC,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,WAAW;AAAA,EACrC;AACF;AAEO,SAAS,wBACd,aACA,YACA,iBAC+B;AAC/B,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,YAAY,gBAAgB;AAAA,EACtD;AACF;AAEO,SAAS,0BACd,aACA,YACiC;AACjC,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,aAAa,WAAW;AAAA,EACrC;AACF;AAEA,SAAS,uBACP,MACA,WAC8B;AAC9B,SAAO,EAAE,MAAM,oBAAoB,0BAA0B,SAAS,EAAE,MAAM,UAAU,EAAE;AAC5F;AAEA,SAAS,yBAAyB,MAA8C;AAC9E,SAAO,EAAE,MAAM,oBAAoB,4BAA4B,SAAS,EAAE,KAAK,EAAE;AACnF;AAEO,SAAS,6BACd,MACA,WAC2D;AAC3D,SAAO,cAAY;AACjB,aAAS,uBAAuB,MAAM,SAAS,CAAC;AAEhD,WAAO,MAAM;AACX,eAAS,yBAAyB,IAAI,CAAC;AAAA,IACzC;AAAA,EACF;AACF;AAEO,SAAS,eAAe,aAAgD;AAC7E,SAAO,EAAE,MAAM,oBAAoB,iBAAiB,SAAS,EAAE,YAAY,EAAE;AAC/E;AAEO,SAAS,yBAAuD;AACrE,SAAO,EAAE,MAAM,oBAAoB,yBAAyB;AAC9D;AAEO,SAAS,UAAU,QAAqB,UAAoC;AACjF,SAAO;AAAA,IACL,MAAM,oBAAoB;AAAA,IAC1B,SAAS,EAAE,QAAQ,iCAAmB,MAAM,OAAO,SAAS,CAAC,GAAG,SAAS;AAAA,EAC3E;AACF;AAEO,SAAS,eAAe,aAA4C;AACzE,SAAO,EAAE,MAAM,oBAAoB,mBAAmB,SAAS,YAAY;AAC7E;AAEO,SAAS,cAAc,YAA0C;AACtE,SAAO,EAAE,MAAM,oBAAoB,kBAAkB,SAAS,WAAW;AAC3E;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/state/actions/internal/read-only-actions.ts"],"sourcesContent":["import { type ThunkAction } from '@reduxjs/toolkit'\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 ComponentType } from '../../modules/react-components'\nimport { type DescriptorsByComponentType } from '../../modules/prop-controller-descriptors'\n\nimport { type LocaleString, localeStringSchema } from '../../../locale'\nimport { type DocumentPayload } from '../../shared-api'\n\nimport { ReadOnlyActionTypes } from './read-only-action-types'\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 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 | 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\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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,oBAAsD;AAGtD,oCAAoC;AAoF7B,SAAS,qBACd,cACA,YACA,UACA,QAC4B;AAC5B,SAAO;AAAA,IACL,MAAM,kDAAoB;AAAA,IAC1B,SAAS,EAAE,cAAc,YAAY,UAAU,OAAO;AAAA,EACxD;AACF;AAEO,SAAS,kBACd,SACyB;AACzB,SAAO;AAAA,IACL,MAAM,kDAAoB;AAAA,IAC1B;AAAA,EACF;AACF;AAEO,SAAS,kBACd,SACyB;AACzB,SAAO,EAAE,MAAM,kDAAoB,qBAAqB,QAAQ;AAClE;AAEO,SAAS,kBACd,MACA,MACA,2BACyB;AACzB,SAAO;AAAA,IACL,MAAM,kDAAoB;AAAA,IAC1B,SAAS,EAAE,MAAM,MAAM,0BAA0B;AAAA,EACnD;AACF;AAEO,SAAS,oBAAoB,MAAyC;AAC3E,SAAO,EAAE,MAAM,kDAAoB,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;AAEA,SAAS,uBACP,MACA,WAC8B;AAC9B,SAAO,EAAE,MAAM,kDAAoB,0BAA0B,SAAS,EAAE,MAAM,UAAU,EAAE;AAC5F;AAEA,SAAS,yBAAyB,MAA8C;AAC9E,SAAO,EAAE,MAAM,kDAAoB,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,aAAgD;AAC7E,SAAO,EAAE,MAAM,kDAAoB,iBAAiB,SAAS,EAAE,YAAY,EAAE;AAC/E;AAEO,SAAS,yBAAuD;AACrE,SAAO,EAAE,MAAM,kDAAoB,yBAAyB;AAC9D;AAEO,SAAS,UAAU,QAAqB,UAAoC;AACjF,SAAO;AAAA,IACL,MAAM,kDAAoB;AAAA,IAC1B,SAAS,EAAE,QAAQ,iCAAmB,MAAM,OAAO,SAAS,CAAC,GAAG,SAAS;AAAA,EAC3E;AACF;AAEO,SAAS,eAAe,aAA4C;AACzE,SAAO,EAAE,MAAM,kDAAoB,mBAAmB,SAAS,YAAY;AAC7E;AAEO,SAAS,cAAc,YAA0C;AACtE,SAAO,EAAE,MAAM,kDAAoB,kBAAkB,SAAS,WAAW;AAC3E;","names":[]}