@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
@@ -24,7 +24,7 @@ __export(is_in_builder_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(is_in_builder_exports);
26
26
  var import_actions = require("../actions");
27
- var import_read_only_actions = require("../actions/internal/read-only-actions");
27
+ var import_read_only_action_types = require("../actions/internal/read-only-action-types");
28
28
  function getInitialState() {
29
29
  return false;
30
30
  }
@@ -35,7 +35,7 @@ function reducer(state = getInitialState(), action) {
35
35
  if (!(0, import_actions.isKnownAction)(action))
36
36
  return state;
37
37
  switch (action.type) {
38
- case import_read_only_actions.ReadOnlyActionTypes.SET_IS_IN_BUILDER:
38
+ case import_read_only_action_types.ReadOnlyActionTypes.SET_IS_IN_BUILDER:
39
39
  return action.payload;
40
40
  default:
41
41
  return state;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/state/modules/is-in-builder.ts"],"sourcesContent":["import { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-actions'\n\nexport type State = boolean\n\nexport function getInitialState(): State {\n return false\n}\n\nexport function getIsInBuilder(state: State): boolean {\n return state\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.SET_IS_IN_BUILDER:\n return action.payload\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+D;AAC/D,+BAAoC;AAI7B,SAAS,kBAAyB;AACvC,SAAO;AACT;AAEO,SAAS,eAAe,OAAuB;AACpD,SAAO;AACT;AAEO,SAAS,QAAQ,QAAe,gBAAgB,GAAG,QAAuC;AAC/F,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,6CAAoB;AACvB,aAAO,OAAO;AAAA,IAEhB;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/state/modules/is-in-builder.ts"],"sourcesContent":["import { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-action-types'\n\nexport type State = boolean\n\nexport function getInitialState(): State {\n return false\n}\n\nexport function getIsInBuilder(state: State): boolean {\n return state\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.SET_IS_IN_BUILDER:\n return action.payload\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+D;AAC/D,oCAAoC;AAI7B,SAAS,kBAAyB;AACvC,SAAO;AACT;AAEO,SAAS,eAAe,OAAuB;AACpD,SAAO;AACT;AAEO,SAAS,QAAQ,QAAe,gBAAgB,GAAG,QAAuC;AAC/F,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,kDAAoB;AACvB,aAAO,OAAO;AAAA,IAEhB;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
@@ -24,7 +24,7 @@ __export(is_read_only_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(is_read_only_exports);
26
26
  var import_actions = require("../actions");
27
- var import_read_only_actions = require("../actions/internal/read-only-actions");
27
+ var import_read_only_action_types = require("../actions/internal/read-only-action-types");
28
28
  function getInitialState(isReadOnly = true) {
29
29
  return isReadOnly;
30
30
  }
@@ -35,7 +35,7 @@ function reducer(state = getInitialState(), action) {
35
35
  if (!(0, import_actions.isKnownAction)(action))
36
36
  return state;
37
37
  switch (action.type) {
38
- case import_read_only_actions.ReadOnlyActionTypes.SET_IS_READ_ONLY:
38
+ case import_read_only_action_types.ReadOnlyActionTypes.SET_IS_READ_ONLY:
39
39
  return action.payload;
40
40
  default:
41
41
  return state;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/state/modules/is-read-only.ts"],"sourcesContent":["import { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-actions'\n\nexport type State = boolean\n\nexport function getInitialState(isReadOnly = true): State {\n return isReadOnly\n}\n\nexport function getIsReadOnly(state: State): boolean {\n return state\n}\n\nexport function reducer(state = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.SET_IS_READ_ONLY:\n return action.payload\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+D;AAC/D,+BAAoC;AAI7B,SAAS,gBAAgB,aAAa,MAAa;AACxD,SAAO;AACT;AAEO,SAAS,cAAc,OAAuB;AACnD,SAAO;AACT;AAEO,SAAS,QAAQ,QAAQ,gBAAgB,GAAG,QAAuC;AACxF,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,6CAAoB;AACvB,aAAO,OAAO;AAAA,IAEhB;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/state/modules/is-read-only.ts"],"sourcesContent":["import { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-action-types'\n\nexport type State = boolean\n\nexport function getInitialState(isReadOnly = true): State {\n return isReadOnly\n}\n\nexport function getIsReadOnly(state: State): boolean {\n return state\n}\n\nexport function reducer(state = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.SET_IS_READ_ONLY:\n return action.payload\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+D;AAC/D,oCAAoC;AAI7B,SAAS,gBAAgB,aAAa,MAAa;AACxD,SAAO;AACT;AAEO,SAAS,cAAc,OAAuB;AACnD,SAAO;AACT;AAEO,SAAS,QAAQ,QAAQ,gBAAgB,GAAG,QAAuC;AACxF,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,kDAAoB;AACvB,aAAO,OAAO;AAAA,IAEhB;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
@@ -24,7 +24,7 @@ __export(locale_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(locale_exports);
26
26
  var import_actions = require("../actions");
27
- var import_read_only_actions = require("../actions/internal/read-only-actions");
27
+ var import_read_only_action_types = require("../actions/internal/read-only-action-types");
28
28
  function getInitialState(locale = null) {
29
29
  return locale;
30
30
  }
@@ -35,7 +35,7 @@ function reducer(state = getInitialState(), action) {
35
35
  if (!(0, import_actions.isKnownAction)(action))
36
36
  return state;
37
37
  switch (action.type) {
38
- case import_read_only_actions.ReadOnlyActionTypes.SET_LOCALE:
38
+ case import_read_only_action_types.ReadOnlyActionTypes.SET_LOCALE:
39
39
  return action.payload.locale;
40
40
  default:
41
41
  return state;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/state/modules/locale.ts"],"sourcesContent":["import { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-actions'\n\nexport type State = string | null\n\nexport function getInitialState(locale: string | null = null): State {\n return locale\n}\n\nexport function getLocale(state: State): string | null {\n return state\n}\n\nexport function reducer(state = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.SET_LOCALE:\n return action.payload.locale\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+D;AAC/D,+BAAoC;AAI7B,SAAS,gBAAgB,SAAwB,MAAa;AACnE,SAAO;AACT;AAEO,SAAS,UAAU,OAA6B;AACrD,SAAO;AACT;AAEO,SAAS,QAAQ,QAAQ,gBAAgB,GAAG,QAAuC;AACxF,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,6CAAoB;AACvB,aAAO,OAAO,QAAQ;AAAA,IAExB;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/state/modules/locale.ts"],"sourcesContent":["import { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-action-types'\n\nexport type State = string | null\n\nexport function getInitialState(locale: string | null = null): State {\n return locale\n}\n\nexport function getLocale(state: State): string | null {\n return state\n}\n\nexport function reducer(state = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.SET_LOCALE:\n return action.payload.locale\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+D;AAC/D,oCAAoC;AAI7B,SAAS,gBAAgB,SAAwB,MAAa;AACnE,SAAO;AACT;AAEO,SAAS,UAAU,OAA6B;AACrD,SAAO;AACT;AAEO,SAAS,QAAQ,QAAQ,gBAAgB,GAAG,QAAuC;AACxF,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,kDAAoB;AACvB,aAAO,OAAO,QAAQ;AAAA,IAExB;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
@@ -26,7 +26,7 @@ __export(localized_resources_map_exports, {
26
26
  module.exports = __toCommonJS(localized_resources_map_exports);
27
27
  var import_controls = require("@makeswift/controls");
28
28
  var import_actions = require("../actions");
29
- var import_read_write_actions = require("../actions/internal/read-write-actions");
29
+ var import_read_write_action_types = require("../actions/internal/read-write-action-types");
30
30
  var import_host_api = require("../host-api");
31
31
  function getInitialState(serializedState = {}) {
32
32
  return new Map(
@@ -60,7 +60,7 @@ function reducer(state = getInitialState(), action) {
60
60
  (state.get(locale) ?? /* @__PURE__ */ new Map()).set(resourceId, localizedResourceId)
61
61
  );
62
62
  }
63
- case import_read_write_actions.ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE: {
63
+ case import_read_write_action_types.ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE: {
64
64
  const { localizedResourcesMap } = action.payload;
65
65
  return Object.entries(localizedResourcesMap).reduce((state2, [locale, resources]) => {
66
66
  const existing = state2.get(locale) ?? /* @__PURE__ */ new Map();
@@ -70,7 +70,7 @@ function reducer(state = getInitialState(), action) {
70
70
  return updated === existing ? state2 : new Map(state2).set(locale, updated);
71
71
  }, state);
72
72
  }
73
- case import_read_write_actions.ReadWriteActionTypes.CLEAR_API_CLIENT_CACHE: {
73
+ case import_read_write_action_types.ReadWriteActionTypes.CLEAR_API_CLIENT_CACHE: {
74
74
  return getInitialState();
75
75
  }
76
76
  default:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/state/modules/localized-resources-map.ts"],"sourcesContent":["import { mapValues } from '@makeswift/controls'\nimport { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadWriteActionTypes } from '../actions/internal/read-write-actions'\nimport { HostActionTypes } from '../host-api'\n\ntype State = Map<string, Map<string, string | null>>\n\nexport type SerializedState = {\n [locale: string]: {\n [resourceId: string]: string | null\n }\n}\n\nexport function getInitialState(serializedState: SerializedState = {}): State {\n return new Map(\n Object.entries(mapValues(serializedState, resources => new Map(Object.entries(resources)))),\n )\n}\n\nexport function getSerializedState(state: State): SerializedState {\n return mapValues(Object.fromEntries(state.entries()), resources =>\n Object.fromEntries(resources.entries()),\n )\n}\n\nexport function getLocalizedResourceId(\n state: State,\n locale: string,\n resourceId: string,\n): string | undefined | null {\n return state.get(locale)?.get(resourceId)\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case HostActionTypes.SET_LOCALIZED_RESOURCE_ID: {\n const { resourceId, localizedResourceId, locale } = action.payload\n\n if (locale == null) {\n console.error('Attempt to set a localized resource ID for a non-localized page', {\n resourceId,\n localizedResourceId,\n })\n\n return state\n }\n\n return new Map(state).set(\n locale,\n (state.get(locale) ?? new Map()).set(resourceId, localizedResourceId),\n )\n }\n\n case ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE: {\n const { localizedResourcesMap } = action.payload\n\n return Object.entries(localizedResourcesMap).reduce((state, [locale, resources]) => {\n const existing = state.get(locale) ?? new Map<string, string | null>()\n const updated = Object.entries(resources).reduce((r, [id, localizedId]) => {\n return r.get(id) != null ? r : new Map(r).set(id, localizedId)\n }, existing)\n\n return updated === existing ? state : new Map(state).set(locale, updated)\n }, state)\n }\n\n case ReadWriteActionTypes.CLEAR_API_CLIENT_CACHE: {\n return getInitialState()\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA0B;AAC1B,qBAA+D;AAC/D,gCAAqC;AACrC,sBAAgC;AAUzB,SAAS,gBAAgB,kBAAmC,CAAC,GAAU;AAC5E,SAAO,IAAI;AAAA,IACT,OAAO,YAAQ,2BAAU,iBAAiB,eAAa,IAAI,IAAI,OAAO,QAAQ,SAAS,CAAC,CAAC,CAAC;AAAA,EAC5F;AACF;AAEO,SAAS,mBAAmB,OAA+B;AAChE,aAAO;AAAA,IAAU,OAAO,YAAY,MAAM,QAAQ,CAAC;AAAA,IAAG,eACpD,OAAO,YAAY,UAAU,QAAQ,CAAC;AAAA,EACxC;AACF;AAEO,SAAS,uBACd,OACA,QACA,YAC2B;AAC3B,SAAO,MAAM,IAAI,MAAM,GAAG,IAAI,UAAU;AAC1C;AAEO,SAAS,QAAQ,QAAe,gBAAgB,GAAG,QAAuC;AAC/F,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,gCAAgB,2BAA2B;AAC9C,YAAM,EAAE,YAAY,qBAAqB,OAAO,IAAI,OAAO;AAE3D,UAAI,UAAU,MAAM;AAClB,gBAAQ,MAAM,mEAAmE;AAAA,UAC/E;AAAA,UACA;AAAA,QACF,CAAC;AAED,eAAO;AAAA,MACT;AAEA,aAAO,IAAI,IAAI,KAAK,EAAE;AAAA,QACpB;AAAA,SACC,MAAM,IAAI,MAAM,KAAK,oBAAI,IAAI,GAAG,IAAI,YAAY,mBAAmB;AAAA,MACtE;AAAA,IACF;AAAA,IAEA,KAAK,+CAAqB,yBAAyB;AACjD,YAAM,EAAE,sBAAsB,IAAI,OAAO;AAEzC,aAAO,OAAO,QAAQ,qBAAqB,EAAE,OAAO,CAACA,QAAO,CAAC,QAAQ,SAAS,MAAM;AAClF,cAAM,WAAWA,OAAM,IAAI,MAAM,KAAK,oBAAI,IAA2B;AACrE,cAAM,UAAU,OAAO,QAAQ,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,WAAW,MAAM;AACzE,iBAAO,EAAE,IAAI,EAAE,KAAK,OAAO,IAAI,IAAI,IAAI,CAAC,EAAE,IAAI,IAAI,WAAW;AAAA,QAC/D,GAAG,QAAQ;AAEX,eAAO,YAAY,WAAWA,SAAQ,IAAI,IAAIA,MAAK,EAAE,IAAI,QAAQ,OAAO;AAAA,MAC1E,GAAG,KAAK;AAAA,IACV;AAAA,IAEA,KAAK,+CAAqB,wBAAwB;AAChD,aAAO,gBAAgB;AAAA,IACzB;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":["state"]}
1
+ {"version":3,"sources":["../../../../src/state/modules/localized-resources-map.ts"],"sourcesContent":["import { mapValues } from '@makeswift/controls'\nimport { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadWriteActionTypes } from '../actions/internal/read-write-action-types'\nimport { HostActionTypes } from '../host-api'\n\ntype State = Map<string, Map<string, string | null>>\n\nexport type SerializedState = {\n [locale: string]: {\n [resourceId: string]: string | null\n }\n}\n\nexport function getInitialState(serializedState: SerializedState = {}): State {\n return new Map(\n Object.entries(mapValues(serializedState, resources => new Map(Object.entries(resources)))),\n )\n}\n\nexport function getSerializedState(state: State): SerializedState {\n return mapValues(Object.fromEntries(state.entries()), resources =>\n Object.fromEntries(resources.entries()),\n )\n}\n\nexport function getLocalizedResourceId(\n state: State,\n locale: string,\n resourceId: string,\n): string | undefined | null {\n return state.get(locale)?.get(resourceId)\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case HostActionTypes.SET_LOCALIZED_RESOURCE_ID: {\n const { resourceId, localizedResourceId, locale } = action.payload\n\n if (locale == null) {\n console.error('Attempt to set a localized resource ID for a non-localized page', {\n resourceId,\n localizedResourceId,\n })\n\n return state\n }\n\n return new Map(state).set(\n locale,\n (state.get(locale) ?? new Map()).set(resourceId, localizedResourceId),\n )\n }\n\n case ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE: {\n const { localizedResourcesMap } = action.payload\n\n return Object.entries(localizedResourcesMap).reduce((state, [locale, resources]) => {\n const existing = state.get(locale) ?? new Map<string, string | null>()\n const updated = Object.entries(resources).reduce((r, [id, localizedId]) => {\n return r.get(id) != null ? r : new Map(r).set(id, localizedId)\n }, existing)\n\n return updated === existing ? state : new Map(state).set(locale, updated)\n }, state)\n }\n\n case ReadWriteActionTypes.CLEAR_API_CLIENT_CACHE: {\n return getInitialState()\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA0B;AAC1B,qBAA+D;AAC/D,qCAAqC;AACrC,sBAAgC;AAUzB,SAAS,gBAAgB,kBAAmC,CAAC,GAAU;AAC5E,SAAO,IAAI;AAAA,IACT,OAAO,YAAQ,2BAAU,iBAAiB,eAAa,IAAI,IAAI,OAAO,QAAQ,SAAS,CAAC,CAAC,CAAC;AAAA,EAC5F;AACF;AAEO,SAAS,mBAAmB,OAA+B;AAChE,aAAO;AAAA,IAAU,OAAO,YAAY,MAAM,QAAQ,CAAC;AAAA,IAAG,eACpD,OAAO,YAAY,UAAU,QAAQ,CAAC;AAAA,EACxC;AACF;AAEO,SAAS,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c) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var prop_controllers_exports = {};
20
- __export(prop_controllers_exports, {
19
+ var prop_controller_descriptors_exports = {};
20
+ __export(prop_controller_descriptors_exports, {
21
21
  getComponentPropControllerDescriptors: () => getComponentPropControllerDescriptors,
22
22
  getInitialState: () => getInitialState,
23
23
  getPropControllerDescriptors: () => getPropControllerDescriptors,
24
24
  reducer: () => reducer
25
25
  });
26
- module.exports = __toCommonJS(prop_controllers_exports);
26
+ module.exports = __toCommonJS(prop_controller_descriptors_exports);
27
27
  var import_actions = require("../actions");
28
- var import_read_only_actions = require("../actions/internal/read-only-actions");
28
+ var import_read_only_action_types = require("../actions/internal/read-only-action-types");
29
29
  function getInitialState({
30
30
  propControllerDescriptors = /* @__PURE__ */ new Map()
31
31
  } = {}) {
@@ -41,9 +41,9 @@ function reducer(state = getInitialState(), action) {
41
41
  if (!(0, import_actions.isKnownAction)(action))
42
42
  return state;
43
43
  switch (action.type) {
44
- case import_read_only_actions.ReadOnlyActionTypes.REGISTER_COMPONENT:
44
+ case import_read_only_action_types.ReadOnlyActionTypes.REGISTER_COMPONENT:
45
45
  return new Map(state).set(action.payload.type, action.payload.propControllerDescriptors);
46
- case import_read_only_actions.ReadOnlyActionTypes.UNREGISTER_COMPONENT: {
46
+ case import_read_only_action_types.ReadOnlyActionTypes.UNREGISTER_COMPONENT: {
47
47
  const nextState = new Map(state);
48
48
  const deleted = nextState.delete(action.payload.type);
49
49
  return deleted ? nextState : state;
@@ -59,4 +59,4 @@ function reducer(state = getInitialState(), action) {
59
59
  getPropControllerDescriptors,
60
60
  reducer
61
61
  });
62
- //# sourceMappingURL=prop-controllers.js.map
62
+ //# sourceMappingURL=prop-controller-descriptors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/state/modules/prop-controller-descriptors.ts"],"sourcesContent":["import { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-action-types'\n\nimport { Descriptor as PropControllerDescriptor } from '../../prop-controllers/descriptors'\n\nexport type { PropControllerDescriptor }\n\nexport type DescriptorsByProp = Record<string, PropControllerDescriptor>\nexport type DescriptorsByComponentType = Map<string, DescriptorsByProp>\nexport type State = DescriptorsByComponentType\n\nexport function getInitialState({\n propControllerDescriptors = new Map(),\n}: {\n propControllerDescriptors?: State\n} = {}): State {\n return propControllerDescriptors\n}\n\nexport function getPropControllerDescriptors(state: State): State {\n return state\n}\n\nexport function getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): DescriptorsByProp | null {\n return getPropControllerDescriptors(state).get(componentType) ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.REGISTER_COMPONENT:\n return new Map(state).set(action.payload.type, action.payload.propControllerDescriptors)\n\n case ReadOnlyActionTypes.UNREGISTER_COMPONENT: {\n const nextState = new Map(state)\n const deleted = nextState.delete(action.payload.type)\n return deleted ? nextState : state\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+D;AAC/D,oCAAoC;AAU7B,SAAS,gBAAgB;AAAA,EAC9B,4BAA4B,oBAAI,IAAI;AACtC,IAEI,CAAC,GAAU;AACb,SAAO;AACT;AAEO,SAAS,6BAA6B,OAAqB;AAChE,SAAO;AACT;AAEO,SAAS,sCACd,OACA,eAC0B;AAC1B,SAAO,6BAA6B,KAAK,EAAE,IAAI,aAAa,KAAK;AACnE;AAEO,SAAS,QAAQ,QAAe,gBAAgB,GAAG,QAAuC;AAC/F,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,kDAAoB;AACvB,aAAO,IAAI,IAAI,KAAK,EAAE,IAAI,OAAO,QAAQ,MAAM,OAAO,QAAQ,yBAAyB;AAAA,IAEzF,KAAK,kDAAoB,sBAAsB;AAC7C,YAAM,YAAY,IAAI,IAAI,KAAK;AAC/B,YAAM,UAAU,UAAU,OAAO,OAAO,QAAQ,IAAI;AACpD,aAAO,UAAU,YAAY;AAAA,IAC/B;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
@@ -24,7 +24,7 @@ __export(react_components_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(react_components_exports);
26
26
  var import_actions = require("../actions");
27
- var import_read_only_actions = require("../actions/internal/read-only-actions");
27
+ var import_read_only_action_types = require("../actions/internal/read-only-action-types");
28
28
  function getInitialState({
29
29
  reactComponents = /* @__PURE__ */ new Map()
30
30
  } = {}) {
@@ -40,9 +40,9 @@ function reducer(state = getInitialState(), action) {
40
40
  if (!(0, import_actions.isKnownAction)(action))
41
41
  return state;
42
42
  switch (action.type) {
43
- case import_read_only_actions.ReadOnlyActionTypes.REGISTER_REACT_COMPONENT:
43
+ case import_read_only_action_types.ReadOnlyActionTypes.REGISTER_REACT_COMPONENT:
44
44
  return new Map(state).set(action.payload.type, action.payload.component);
45
- case import_read_only_actions.ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT: {
45
+ case import_read_only_action_types.ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT: {
46
46
  const nextState = new Map(state);
47
47
  const deleted = nextState.delete(action.payload.type);
48
48
  return deleted ? nextState : state;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/state/modules/react-components.tsx"],"sourcesContent":["import type { Component, PropsWithoutRef, ReactNode, RefAttributes } from 'react'\n\nimport { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-actions'\n\nexport type ComponentType<P = Record<string, any>, T = any> =\n | { new (props: PropsWithoutRef<P> & RefAttributes<T>, context?: any): Component<P> }\n | ((props: PropsWithoutRef<P> & RefAttributes<T>, context?: any) => ReactNode)\n\nexport type State = Map<string, ComponentType>\n\nexport function getInitialState({\n reactComponents = new Map(),\n}: { reactComponents?: Map<string, ComponentType> } = {}): State {\n return reactComponents\n}\n\nfunction getReactComponents(state: State): Map<string, ComponentType> {\n return state\n}\n\nexport function getReactComponent(state: State, type: string): ComponentType | null {\n return getReactComponents(state).get(type) ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction) {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.REGISTER_REACT_COMPONENT:\n return new Map(state).set(action.payload.type, action.payload.component)\n\n case ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT: {\n const nextState = new Map(state)\n\n const deleted = nextState.delete(action.payload.type)\n\n return deleted ? nextState : state\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAA+D;AAC/D,+BAAoC;AAQ7B,SAAS,gBAAgB;AAAA,EAC9B,kBAAkB,oBAAI,IAAI;AAC5B,IAAsD,CAAC,GAAU;AAC/D,SAAO;AACT;AAEA,SAAS,mBAAmB,OAA0C;AACpE,SAAO;AACT;AAEO,SAAS,kBAAkB,OAAc,MAAoC;AAClF,SAAO,mBAAmB,KAAK,EAAE,IAAI,IAAI,KAAK;AAChD;AAEO,SAAS,QAAQ,QAAe,gBAAgB,GAAG,QAAgC;AACxF,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,6CAAoB;AACvB,aAAO,IAAI,IAAI,KAAK,EAAE,IAAI,OAAO,QAAQ,MAAM,OAAO,QAAQ,SAAS;AAAA,IAEzE,KAAK,6CAAoB,4BAA4B;AACnD,YAAM,YAAY,IAAI,IAAI,KAAK;AAE/B,YAAM,UAAU,UAAU,OAAO,OAAO,QAAQ,IAAI;AAEpD,aAAO,UAAU,YAAY;AAAA,IAC/B;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/state/modules/react-components.tsx"],"sourcesContent":["import type { Component, PropsWithoutRef, ReactNode, RefAttributes } from 'react'\n\nimport { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-action-types'\n\nexport type ComponentType<P = Record<string, any>, T = any> =\n | { new (props: PropsWithoutRef<P> & RefAttributes<T>, context?: any): Component<P> }\n | ((props: PropsWithoutRef<P> & RefAttributes<T>, context?: any) => ReactNode)\n\nexport type State = Map<string, ComponentType>\n\nexport function getInitialState({\n reactComponents = new Map(),\n}: { reactComponents?: Map<string, ComponentType> } = {}): State {\n return reactComponents\n}\n\nfunction getReactComponents(state: State): Map<string, ComponentType> {\n return state\n}\n\nexport function getReactComponent(state: State, type: string): ComponentType | null {\n return getReactComponents(state).get(type) ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction) {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.REGISTER_REACT_COMPONENT:\n return new Map(state).set(action.payload.type, action.payload.component)\n\n case ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT: {\n const nextState = new Map(state)\n\n const deleted = nextState.delete(action.payload.type)\n\n return deleted ? nextState : state\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAA+D;AAC/D,oCAAoC;AAQ7B,SAAS,gBAAgB;AAAA,EAC9B,kBAAkB,oBAAI,IAAI;AAC5B,IAAsD,CAAC,GAAU;AAC/D,SAAO;AACT;AAEA,SAAS,mBAAmB,OAA0C;AACpE,SAAO;AACT;AAEO,SAAS,kBAAkB,OAAc,MAAoC;AAClF,SAAO,mBAAmB,KAAK,EAAE,IAAI,IAAI,KAAK;AAChD;AAEO,SAAS,QAAQ,QAAe,gBAAgB,GAAG,QAAgC;AACxF,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,kDAAoB;AACvB,aAAO,IAAI,IAAI,KAAK,EAAE,IAAI,OAAO,QAAQ,MAAM,OAAO,QAAQ,SAAS;AAAA,IAEzE,KAAK,kDAAoB,4BAA4B;AACnD,YAAM,YAAY,IAAI,IAAI,KAAK;AAE/B,YAAM,UAAU,UAAU,OAAO,OAAO,QAAQ,IAAI;AAEpD,aAAO,UAAU,YAAY;AAAA,IAC/B;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
@@ -33,8 +33,8 @@ __export(box_models_exports, {
33
33
  module.exports = __toCommonJS(box_models_exports);
34
34
  var import_css_box_model = require("css-box-model");
35
35
  var import_actions = require("../../actions");
36
- var import_read_write_actions = require("../../actions/internal/read-write-actions");
37
- var import_actions2 = require("../../builder-api/actions");
36
+ var import_read_write_action_types = require("../../actions/internal/read-write-action-types");
37
+ var import_action_types = require("../../builder-api/action-types");
38
38
  function parse(rawString) {
39
39
  const value = Number(rawString.replace(/px$/, ""));
40
40
  return Number.isFinite(value) ? value : 0;
@@ -87,7 +87,7 @@ function reducer(state = getInitialState(), action) {
87
87
  if (!(0, import_actions.isKnownAction)(action))
88
88
  return state;
89
89
  switch (action.type) {
90
- case import_read_write_actions.ReadWriteActionTypes.REGISTER_MEASURABLE: {
90
+ case import_read_write_action_types.ReadWriteActionTypes.REGISTER_MEASURABLE: {
91
91
  const { documentKey, elementKey, measurable } = action.payload;
92
92
  return {
93
93
  ...state,
@@ -97,13 +97,13 @@ function reducer(state = getInitialState(), action) {
97
97
  )
98
98
  };
99
99
  }
100
- case import_read_write_actions.ReadWriteActionTypes.UNREGISTER_MEASURABLE: {
100
+ case import_read_write_action_types.ReadWriteActionTypes.UNREGISTER_MEASURABLE: {
101
101
  const { documentKey, elementKey } = action.payload;
102
102
  const nextMeasurables = new Map(state.measurables.get(documentKey) ?? []);
103
103
  const deleted = nextMeasurables.delete(elementKey);
104
104
  return deleted ? { ...state, measurables: new Map(state.measurables).set(documentKey, nextMeasurables) } : state;
105
105
  }
106
- case import_actions2.BuilderActionTypes.CHANGE_ELEMENT_BOX_MODELS: {
106
+ case import_action_types.BuilderActionTypes.CHANGE_ELEMENT_BOX_MODELS: {
107
107
  const { changedElementBoxModels } = action.payload;
108
108
  if (changedElementBoxModels.size === 0)
109
109
  return state;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/state/modules/read-write/box-models.ts"],"sourcesContent":["import { type BoxDisplayModel } from '@makeswift/controls'\nimport {\n createBox as createBoxWithoutScroll,\n CreateBoxArgs,\n getBox as getBoxWithoutScroll,\n withScroll,\n} from 'css-box-model'\n\nimport { type Action, type UnknownAction, isKnownAction } from '../../actions'\nimport { ReadWriteActionTypes } from '../../actions/internal/read-write-actions'\nimport { BuilderActionTypes } from '../../builder-api/actions'\n\nexport type { BoxDisplayModel }\n\nexport function parse(rawString: string): number {\n const value = Number(rawString.replace(/px$/, ''))\n\n return Number.isFinite(value) ? value : 0\n}\n\nexport function createBox(boxArgs: CreateBoxArgs & { visible?: boolean }): BoxDisplayModel {\n const box = withScroll(createBoxWithoutScroll(boxArgs))\n return { ...box, visible: boxArgs.visible }\n}\n\nexport function isElementVisible(element: Element): boolean {\n // checkVisibility is widely supported as of March 2024, but we're adding this\n // check as a precaution for browsers where it may not be available.\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility\n if (element.checkVisibility == null) {\n return true\n }\n\n return element.checkVisibility({\n visibilityProperty: true,\n contentVisibilityAuto: true,\n opacityProperty: true,\n })\n}\n\nexport function getBox(element: Element): BoxDisplayModel {\n const visible = isElementVisible(element)\n const boxModel = withScroll(getBoxWithoutScroll(element))\n\n return { ...boxModel, visible }\n}\n\nexport interface BoxModelHandle {\n getBoxModel(): BoxDisplayModel | null\n}\n\nexport type Measurable = Element | BoxModelHandle\n\nexport function isMeasurable(value: unknown): value is Measurable {\n if (value instanceof Element) return true\n\n if (\n typeof value === 'object' &&\n value !== null &&\n 'getBoxModel' in value &&\n typeof (value as { getBoxModel: unknown }).getBoxModel === 'function'\n ) {\n return true\n }\n\n return false\n}\n\nexport function measure(measurable: Measurable): BoxDisplayModel | null {\n if (measurable instanceof Element) return getBox(measurable)\n\n return measurable.getBoxModel()\n}\n\nexport type State = {\n measurables: Map<string, Map<string, Measurable>>\n boxModels: Map<string, Map<string, BoxDisplayModel>>\n}\n\nexport function getInitialState(): State {\n return { measurables: new Map(), boxModels: new Map() }\n}\n\nexport function getMeasurables(state: State): Map<string, Map<string, Measurable>> {\n return state.measurables\n}\n\nexport function getBoxModels(state: State): Map<string, Map<string, BoxDisplayModel>> {\n return state.boxModels\n}\n\nexport function getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxDisplayModel | null {\n return getBoxModels(state).get(documentKey)?.get(elementKey) ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction) {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadWriteActionTypes.REGISTER_MEASURABLE: {\n const { documentKey, elementKey, measurable } = action.payload\n\n return {\n ...state,\n measurables: new Map(state.measurables).set(\n documentKey,\n new Map(state.measurables.get(documentKey) ?? []).set(elementKey, measurable),\n ),\n }\n }\n\n case ReadWriteActionTypes.UNREGISTER_MEASURABLE: {\n const { documentKey, elementKey } = action.payload\n const nextMeasurables = new Map(state.measurables.get(documentKey) ?? [])\n\n const deleted = nextMeasurables.delete(elementKey)\n\n return deleted\n ? { ...state, measurables: new Map(state.measurables).set(documentKey, nextMeasurables) }\n : state\n }\n\n case BuilderActionTypes.CHANGE_ELEMENT_BOX_MODELS: {\n const { changedElementBoxModels } = action.payload\n\n if (changedElementBoxModels.size === 0) return state\n\n const nextBoxModels = new Map(state.boxModels)\n\n changedElementBoxModels.forEach((changedBoxModels, documentKey) => {\n const nextDocumentBoxModels = new Map(nextBoxModels.get(documentKey) ?? [])\n\n changedBoxModels.forEach((changedBoxModel, elementKey) => {\n if (changedBoxModel == null) nextDocumentBoxModels.delete(elementKey)\n else nextDocumentBoxModels.set(elementKey, changedBoxModel)\n })\n\n if (nextDocumentBoxModels.size > 0) nextBoxModels.set(documentKey, nextDocumentBoxModels)\n else nextBoxModels.delete(documentKey)\n })\n\n return { ...state, boxModels: nextBoxModels }\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,2BAKO;AAEP,qBAA+D;AAC/D,gCAAqC;AACrC,IAAAA,kBAAmC;AAI5B,SAAS,MAAM,WAA2B;AAC/C,QAAM,QAAQ,OAAO,UAAU,QAAQ,OAAO,EAAE,CAAC;AAEjD,SAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAC1C;AAEO,SAAS,UAAU,SAAiE;AACzF,QAAM,UAAM,qCAAW,qBAAAC,WAAuB,OAAO,CAAC;AACtD,SAAO,EAAE,GAAG,KAAK,SAAS,QAAQ,QAAQ;AAC5C;AAEO,SAAS,iBAAiB,SAA2B;AAI1D,MAAI,QAAQ,mBAAmB,MAAM;AACnC,WAAO;AAAA,EACT;AAEA,SAAO,QAAQ,gBAAgB;AAAA,IAC7B,oBAAoB;AAAA,IACpB,uBAAuB;AAAA,IACvB,iBAAiB;AAAA,EACnB,CAAC;AACH;AAEO,SAAS,OAAO,SAAmC;AACxD,QAAM,UAAU,iBAAiB,OAAO;AACxC,QAAM,eAAW,qCAAW,qBAAAC,QAAoB,OAAO,CAAC;AAExD,SAAO,EAAE,GAAG,UAAU,QAAQ;AAChC;AAQO,SAAS,aAAa,OAAqC;AAChE,MAAI,iBAAiB;AAAS,WAAO;AAErC,MACE,OAAO,UAAU,YACjB,UAAU,QACV,iBAAiB,SACjB,OAAQ,MAAmC,gBAAgB,YAC3D;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,SAAS,QAAQ,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,IAAI,IAAI,MAAM,SAAS;AAE7C,8BAAwB,QAAQ,CAAC,kBAAkB,gBAAgB;AACjE,cAAM,wBAAwB,IAAI,IAAI,cAAc,IAAI,WAAW,KAAK,CAAC,CAAC;AAE1E,yBAAiB,QAAQ,CAAC,iBAAiB,eAAe;AACxD,cAAI,mBAAmB;AAAM,kCAAsB,OAAO,UAAU;AAAA;AAC/D,kCAAsB,IAAI,YAAY,eAAe;AAAA,QAC5D,CAAC;AAED,YAAI,sBAAsB,OAAO;AAAG,wBAAc,IAAI,aAAa,qBAAqB;AAAA;AACnF,wBAAc,OAAO,WAAW;AAAA,MACvC,CAAC;AAED,aAAO,EAAE,GAAG,OAAO,WAAW,cAAc;AAAA,IAC9C;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":["import_actions","createBoxWithoutScroll","getBoxWithoutScroll"]}
1
+ {"version":3,"sources":["../../../../../src/state/modules/read-write/box-models.ts"],"sourcesContent":["import { type BoxDisplayModel } from '@makeswift/controls'\nimport {\n createBox as createBoxWithoutScroll,\n CreateBoxArgs,\n getBox as getBoxWithoutScroll,\n withScroll,\n} from 'css-box-model'\n\nimport { type Action, type UnknownAction, isKnownAction } from '../../actions'\nimport { ReadWriteActionTypes } from '../../actions/internal/read-write-action-types'\nimport { BuilderActionTypes } from '../../builder-api/action-types'\n\nexport type { BoxDisplayModel }\n\nexport function parse(rawString: string): number {\n const value = Number(rawString.replace(/px$/, ''))\n\n return Number.isFinite(value) ? value : 0\n}\n\nexport function createBox(boxArgs: CreateBoxArgs & { visible?: boolean }): BoxDisplayModel {\n const box = withScroll(createBoxWithoutScroll(boxArgs))\n return { ...box, visible: boxArgs.visible }\n}\n\nexport function isElementVisible(element: Element): boolean {\n // checkVisibility is widely supported as of March 2024, but we're adding this\n // check as a precaution for browsers where it may not be available.\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility\n if (element.checkVisibility == null) {\n return true\n }\n\n return element.checkVisibility({\n visibilityProperty: true,\n contentVisibilityAuto: true,\n opacityProperty: true,\n })\n}\n\nexport function getBox(element: Element): BoxDisplayModel {\n const visible = isElementVisible(element)\n const boxModel = withScroll(getBoxWithoutScroll(element))\n\n return { ...boxModel, visible }\n}\n\nexport interface BoxModelHandle {\n getBoxModel(): BoxDisplayModel | null\n}\n\nexport type Measurable = Element | BoxModelHandle\n\nexport function isMeasurable(value: unknown): value is Measurable {\n if (value instanceof Element) return true\n\n if (\n typeof value === 'object' &&\n value !== null &&\n 'getBoxModel' in value &&\n typeof (value as { getBoxModel: unknown }).getBoxModel === 'function'\n ) {\n return true\n }\n\n return false\n}\n\nexport function measure(measurable: Measurable): BoxDisplayModel | null {\n if (measurable instanceof Element) return getBox(measurable)\n\n return measurable.getBoxModel()\n}\n\nexport type State = {\n measurables: Map<string, Map<string, Measurable>>\n boxModels: Map<string, Map<string, BoxDisplayModel>>\n}\n\nexport function getInitialState(): State {\n return { measurables: new Map(), boxModels: new Map() }\n}\n\nexport function getMeasurables(state: State): Map<string, Map<string, Measurable>> {\n return state.measurables\n}\n\nexport function getBoxModels(state: State): Map<string, Map<string, BoxDisplayModel>> {\n return state.boxModels\n}\n\nexport function getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxDisplayModel | null {\n return getBoxModels(state).get(documentKey)?.get(elementKey) ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction) {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadWriteActionTypes.REGISTER_MEASURABLE: {\n const { documentKey, elementKey, measurable } = action.payload\n\n return {\n ...state,\n measurables: new Map(state.measurables).set(\n documentKey,\n new Map(state.measurables.get(documentKey) ?? []).set(elementKey, measurable),\n ),\n }\n }\n\n case ReadWriteActionTypes.UNREGISTER_MEASURABLE: {\n const { documentKey, elementKey } = action.payload\n const nextMeasurables = new Map(state.measurables.get(documentKey) ?? [])\n\n const deleted = nextMeasurables.delete(elementKey)\n\n return deleted\n ? { ...state, measurables: new Map(state.measurables).set(documentKey, nextMeasurables) }\n : state\n }\n\n case BuilderActionTypes.CHANGE_ELEMENT_BOX_MODELS: {\n const { changedElementBoxModels } = action.payload\n\n if (changedElementBoxModels.size === 0) return state\n\n const nextBoxModels = new Map(state.boxModels)\n\n changedElementBoxModels.forEach((changedBoxModels, documentKey) => {\n const nextDocumentBoxModels = new Map(nextBoxModels.get(documentKey) ?? [])\n\n changedBoxModels.forEach((changedBoxModel, elementKey) => {\n if (changedBoxModel == null) nextDocumentBoxModels.delete(elementKey)\n else nextDocumentBoxModels.set(elementKey, changedBoxModel)\n })\n\n if (nextDocumentBoxModels.size > 0) nextBoxModels.set(documentKey, nextDocumentBoxModels)\n else nextBoxModels.delete(documentKey)\n })\n\n return { ...state, boxModels: nextBoxModels }\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,2BAKO;AAEP,qBAA+D;AAC/D,qCAAqC;AACrC,0BAAmC;AAI5B,SAAS,MAAM,WAA2B;AAC/C,QAAM,QAAQ,OAAO,UAAU,QAAQ,OAAO,EAAE,CAAC;AAEjD,SAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAC1C;AAEO,SAAS,UAAU,SAAiE;AACzF,QAAM,UAAM,qCAAW,qBAAAA,WAAuB,OAAO,CAAC;AACtD,SAAO,EAAE,GAAG,KAAK,SAAS,QAAQ,QAAQ;AAC5C;AAEO,SAAS,iBAAiB,SAA2B;AAI1D,MAAI,QAAQ,mBAAmB,MAAM;AACnC,WAAO;AAAA,EACT;AAEA,SAAO,QAAQ,gBAAgB;AAAA,IAC7B,oBAAoB;AAAA,IACpB,uBAAuB;AAAA,IACvB,iBAAiB;AAAA,EACnB,CAAC;AACH;AAEO,SAAS,OAAO,SAAmC;AACxD,QAAM,UAAU,iBAAiB,OAAO;AACxC,QAAM,eAAW,qCAAW,qBAAAC,QA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,OAAO,UAAU;AAEjD,aAAO,UACH,EAAE,GAAG,OAAO,aAAa,IAAI,IAAI,MAAM,WAAW,EAAE,IAAI,aAAa,eAAe,EAAE,IACtF;AAAA,IACN;AAAA,IAEA,KAAK,uCAAmB,2BAA2B;AACjD,YAAM,EAAE,wBAAwB,IAAI,OAAO;AAE3C,UAAI,wBAAwB,SAAS;AAAG,eAAO;AAE/C,YAAM,gBAAgB,IAAI,IAAI,MAAM,SAAS;AAE7C,8BAAwB,QAAQ,CAAC,kBAAkB,gBAAgB;AACjE,cAAM,wBAAwB,IAAI,IAAI,cAAc,IAAI,WAAW,KAAK,CAAC,CAAC;AAE1E,yBAAiB,QAAQ,CAAC,iBAAiB,eAAe;AACxD,cAAI,mBAAmB;AAAM,kCAAsB,OAAO,UAAU;AAAA;AAC/D,kCAAsB,IAAI,YAAY,eAAe;AAAA,QAC5D,CAAC;AAED,YAAI,sBAAsB,OAAO;AAAG,wBAAc,IAAI,aAAa,qBAAqB;AAAA;AACnF,wBAAc,OAAO,WAAW;AAAA,MACvC,CAAC;AAED,aAAO,EAAE,GAAG,OAAO,WAAW,cAAc;AAAA,IAC9C;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":["createBoxWithoutScroll","getBoxWithoutScroll"]}
@@ -23,7 +23,7 @@ __export(element_imperative_handles_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(element_imperative_handles_exports);
25
25
  var import_actions = require("../../actions");
26
- var import_read_only_actions = require("../../actions/internal/read-only-actions");
26
+ var import_read_write_action_types = require("../../actions/internal/read-write-action-types");
27
27
  function getElementImperativeHandles(state) {
28
28
  return state;
29
29
  }
@@ -34,7 +34,7 @@ function reducer(state = getInitialState(), action) {
34
34
  if (!(0, import_actions.isKnownAction)(action))
35
35
  return state;
36
36
  switch (action.type) {
37
- case import_read_only_actions.ReadOnlyActionTypes.REGISTER_COMPONENT_HANDLE:
37
+ case import_read_write_action_types.ReadWriteActionTypes.REGISTER_COMPONENT_HANDLE:
38
38
  return new Map(state).set(
39
39
  action.payload.documentKey,
40
40
  new Map(new Map(state.get(action.payload.documentKey) ?? [])).set(
@@ -42,7 +42,7 @@ function reducer(state = getInitialState(), action) {
42
42
  action.payload.componentHandle
43
43
  )
44
44
  );
45
- case import_read_only_actions.ReadOnlyActionTypes.UNREGISTER_COMPONENT_HANDLE: {
45
+ case import_read_write_action_types.ReadWriteActionTypes.UNREGISTER_COMPONENT_HANDLE: {
46
46
  const byElementKey = new Map(state.get(action.payload.documentKey) ?? []);
47
47
  const deleted = byElementKey.delete(action.payload.elementKey);
48
48
  if (!deleted)
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/state/modules/read-write/element-imperative-handles.ts"],"sourcesContent":["import { ElementImperativeHandle } from '../../../runtimes/react/element-imperative-handle'\nimport { type Action, type UnknownAction, isKnownAction } from '../../actions'\nimport { ReadOnlyActionTypes } from '../../actions/internal/read-only-actions'\n\nexport type State = Map<string, Map<string, ElementImperativeHandle>>\n\nexport function getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return state\n}\n\nfunction getInitialState(): State {\n return new Map()\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.REGISTER_COMPONENT_HANDLE:\n return new Map(state).set(\n action.payload.documentKey,\n new Map(new Map(state.get(action.payload.documentKey) ?? [])).set(\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n\n case ReadOnlyActionTypes.UNREGISTER_COMPONENT_HANDLE: {\n const byElementKey = new Map(state.get(action.payload.documentKey) ?? [])\n\n const deleted = byElementKey.delete(action.payload.elementKey)\n\n if (!deleted) return state\n\n return new Map(state).set(action.payload.documentKey, byElementKey)\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAA+D;AAC/D,+BAAoC;AAI7B,SAAS,4BACd,OACmD;AACnD,SAAO;AACT;AAEA,SAAS,kBAAyB;AAChC,SAAO,oBAAI,IAAI;AACjB;AAEO,SAAS,QAAQ,QAAe,gBAAgB,GAAG,QAAuC;AAC/F,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,6CAAoB;AACvB,aAAO,IAAI,IAAI,KAAK,EAAE;AAAA,QACpB,OAAO,QAAQ;AAAA,QACf,IAAI,IAAI,IAAI,IAAI,MAAM,IAAI,OAAO,QAAQ,WAAW,KAAK,CAAC,CAAC,CAAC,EAAE;AAAA,UAC5D,OAAO,QAAQ;AAAA,UACf,OAAO,QAAQ;AAAA,QACjB;AAAA,MACF;AAAA,IAEF,KAAK,6CAAoB,6BAA6B;AACpD,YAAM,eAAe,IAAI,IAAI,MAAM,IAAI,OAAO,QAAQ,WAAW,KAAK,CAAC,CAAC;AAExE,YAAM,UAAU,aAAa,OAAO,OAAO,QAAQ,UAAU;AAE7D,UAAI,CAAC;AAAS,eAAO;AAErB,aAAO,IAAI,IAAI,KAAK,EAAE,IAAI,OAAO,QAAQ,aAAa,YAAY;AAAA,IACpE;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/state/modules/read-write/element-imperative-handles.ts"],"sourcesContent":["import { ElementImperativeHandle } from '../../../runtimes/react/element-imperative-handle'\nimport { type Action, type UnknownAction, isKnownAction } from '../../actions'\nimport { ReadWriteActionTypes } from '../../actions/internal/read-write-action-types'\n\nexport type State = Map<string, Map<string, ElementImperativeHandle>>\n\nexport function getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return state\n}\n\nfunction getInitialState(): State {\n return new Map()\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadWriteActionTypes.REGISTER_COMPONENT_HANDLE:\n return new Map(state).set(\n action.payload.documentKey,\n new Map(new Map(state.get(action.payload.documentKey) ?? [])).set(\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n\n case ReadWriteActionTypes.UNREGISTER_COMPONENT_HANDLE: {\n const byElementKey = new Map(state.get(action.payload.documentKey) ?? [])\n\n const deleted = byElementKey.delete(action.payload.elementKey)\n\n if (!deleted) return state\n\n return new Map(state).set(action.payload.documentKey, byElementKey)\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAA+D;AAC/D,qCAAqC;AAI9B,SAAS,4BACd,OACmD;AACnD,SAAO;AACT;AAEA,SAAS,kBAAyB;AAChC,SAAO,oBAAI,IAAI;AACjB;AAEO,SAAS,QAAQ,QAAe,gBAAgB,GAAG,QAAuC;AAC/F,MAAI,KAAC,8BAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,oDAAqB;AACxB,aAAO,IAAI,IAAI,KAAK,EAAE;AAAA,QACpB,OAAO,QAAQ;AAAA,QACf,IAAI,IAAI,IAAI,IAAI,MAAM,IAAI,OAAO,QAAQ,WAAW,KAAK,CAAC,CAAC,CAAC,EAAE;AAAA,UAC5D,OAAO,QAAQ;AAAA,UACf,OAAO,QAAQ;AAAA,QACjB;AAAA,MACF;AAAA,IAEF,KAAK,oDAAqB,6BAA6B;AACrD,YAAM,eAAe,IAAI,IAAI,MAAM,IAAI,OAAO,QAAQ,WAAW,KAAK,CAAC,CAAC;AAExE,YAAM,UAAU,aAAa,OAAO,OAAO,QAAQ,UAAU;AAE7D,UAAI,CAAC;AAAS,eAAO;AAErB,aAAO,IAAI,IAAI,KAAK,EAAE,IAAI,OAAO,QAAQ,aAAa,YAAY;AAAA,IACpE;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
@@ -16,8 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var prop_controller_handles_exports = {};
20
- __export(prop_controller_handles_exports, {
19
+ var prop_controllers_exports = {};
20
+ __export(prop_controllers_exports, {
21
21
  getInitialState: () => getInitialState,
22
22
  getPropController: () => getPropController,
23
23
  getPropControllers: () => getPropControllers,
@@ -25,8 +25,8 @@ __export(prop_controller_handles_exports, {
25
25
  isPropControllersHandle: () => isPropControllersHandle,
26
26
  reducer: () => reducer
27
27
  });
28
- module.exports = __toCommonJS(prop_controller_handles_exports);
29
- var import_actions = require("../actions");
28
+ module.exports = __toCommonJS(prop_controllers_exports);
29
+ var import_actions = require("../../actions");
30
30
  function isPropControllersHandle(value) {
31
31
  if (typeof value === "object" && value !== null && "setPropControllers" in value && typeof value.setPropControllers === "function") {
32
32
  return true;
@@ -94,4 +94,4 @@ function reducer(state = getInitialState(), action) {
94
94
  isPropControllersHandle,
95
95
  reducer
96
96
  });
97
- //# sourceMappingURL=prop-controller-handles.js.map
97
+ //# sourceMappingURL=prop-controllers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/state/modules/read-write/prop-controllers.ts"],"sourcesContent":["import { ControlInstance } from '@makeswift/controls'\nimport { type Action, type UnknownAction, ActionTypes, isKnownAction } from '../../actions'\nimport type { DescriptorsPropControllers } from '../../../prop-controllers/instances'\nimport type { Descriptor } from '../../../prop-controllers/descriptors'\n\nexport interface PropControllersHandle<\n T extends Record<string, Descriptor> = Record<string, Descriptor>,\n> {\n setPropControllers(propControllers: DescriptorsPropControllers<T> | null): void\n}\n\nexport function isPropControllersHandle(value: unknown): value is PropControllersHandle {\n if (\n typeof value === 'object' &&\n value !== null &&\n 'setPropControllers' in value &&\n typeof (value as { setPropControllers: unknown }).setPropControllers === 'function'\n ) {\n return true\n }\n\n return false\n}\n\nexport type State = {\n handles: Map<string, Map<string, PropControllersHandle>>\n instances: Map<string, Map<string, Record<string, ControlInstance>>>\n}\n\nexport function getInitialState(): State {\n return { handles: new Map(), instances: new Map() }\n}\n\nexport function getPropControllersHandle(\n state: State,\n documentKey: string,\n elementKey: string,\n): PropControllersHandle | null {\n return state.handles.get(documentKey)?.get(elementKey) ?? null\n}\n\nexport function getPropControllers(\n state: State,\n documentKey: string,\n elementKey: string,\n): Record<string, ControlInstance> | null {\n return state.instances.get(documentKey)?.get(elementKey) ?? null\n}\n\nexport function getPropController(\n state: State,\n documentKey: string,\n elementKey: string,\n propName: string,\n): ControlInstance | null {\n return getPropControllers(state, documentKey, elementKey)?.[propName] ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey, handle } = action.payload\n\n return {\n ...state,\n handles: new Map(state.handles).set(\n documentKey,\n new Map(state.handles.get(documentKey) ?? []).set(elementKey, handle),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey } = action.payload\n const nextHandles = new Map(state.handles.get(documentKey) ?? [])\n\n const deleted = nextHandles.delete(elementKey)\n\n return deleted\n ? { ...state, handles: new Map(state.handles).set(documentKey, nextHandles) }\n : state\n }\n\n case ActionTypes.REGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey, propControllers } = action.payload\n\n return {\n ...state,\n instances: new Map(state.instances).set(\n documentKey,\n new Map(state.instances.get(documentKey) ?? []).set(elementKey, propControllers),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey } = action.payload\n const nextInstances = new Map(state.instances.get(documentKey) ?? [])\n\n const deleted = nextInstances.delete(elementKey)\n\n return deleted\n ? { ...state, instances: new Map(state.instances).set(documentKey, nextInstances) }\n : state\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;A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O,SAAS,IAAI,IAAI,MAAM,OAAO,EAAE,IAAI,aAAa,WAAW,EAAE,IAC1E;AAAA,IACN;AAAA,IAEA,KAAK,2BAAY,2BAA2B;AAC1C,YAAM,EAAE,aAAa,YAAY,gBAAgB,IAAI,OAAO;AAE5D,aAAO;AAAA,QACL,GAAG;AAAA,QACH,WAAW,IAAI,IAAI,MAAM,SAAS,EAAE;AAAA,UAClC;AAAA,UACA,IAAI,IAAI,MAAM,UAAU,IAAI,WAAW,KAAK,CAAC,CAAC,EAAE,IAAI,YAAY,eAAe;AAAA,QACjF;AAAA,MACF;AAAA,IACF;AAAA,IAEA,KAAK,2BAAY,6BAA6B;AAC5C,YAAM,EAAE,aAAa,WAAW,IAAI,OAAO;AAC3C,YAAM,gBAAgB,IAAI,IAAI,MAAM,UAAU,IAAI,WAAW,KAAK,CAAC,CAAC;AAEpE,YAAM,UAAU,cAAc,OAAO,UAAU;AAE/C,aAAO,UACH,EAAE,GAAG,OAAO,WAAW,IAAI,IAAI,MAAM,SAAS,EAAE,IAAI,aAAa,aAAa,EAAE,IAChF;AAAA,IACN;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
@@ -47,10 +47,7 @@ __export(read_only_state_exports, {
47
47
  getIsInBuilder: () => getIsInBuilder,
48
48
  getIsReadOnly: () => getIsReadOnly,
49
49
  getLocale: () => getLocale,
50
- getPropController: () => getPropController,
51
50
  getPropControllerDescriptors: () => getPropControllerDescriptors,
52
- getPropControllers: () => getPropControllers,
53
- getPropControllersHandle: () => getPropControllersHandle,
54
51
  getReactComponent: () => getReactComponent,
55
52
  getRootElement: () => import_read_only_documents.getRootElement,
56
53
  isElementReference: () => import_read_only_documents.isElementReference,
@@ -64,8 +61,7 @@ var Documents = __toESM(require("./modules/read-only-documents"));
64
61
  var ElementTrees = __toESM(require("./modules/element-trees"));
65
62
  var ReactComponents = __toESM(require("./modules/react-components"));
66
63
  var ComponentsMeta = __toESM(require("./modules/components-meta"));
67
- var PropControllers = __toESM(require("./modules/prop-controllers"));
68
- var PropControllerHandles = __toESM(require("./modules/prop-controller-handles"));
64
+ var PropControllerDescriptors = __toESM(require("./modules/prop-controller-descriptors"));
69
65
  var IsInBuilder = __toESM(require("./modules/is-in-builder"));
70
66
  var IsReadOnly = __toESM(require("./modules/is-read-only"));
71
67
  var BuilderEditMode = __toESM(require("./modules/builder-edit-mode"));
@@ -79,8 +75,7 @@ const reducers = {
79
75
  elementTrees: ElementTrees.reducer,
80
76
  reactComponents: ReactComponents.reducer,
81
77
  componentsMeta: ComponentsMeta.reducer,
82
- propControllers: PropControllers.reducer,
83
- propControllerHandles: PropControllerHandles.reducer,
78
+ propControllerDescriptors: PropControllerDescriptors.reducer,
84
79
  isInBuilder: IsInBuilder.reducer,
85
80
  builderEditMode: BuilderEditMode.reducer,
86
81
  breakpoints: Breakpoints.reducer
@@ -115,47 +110,20 @@ function getComponentsMeta(state) {
115
110
  function getComponentMeta(state, type) {
116
111
  return ComponentsMeta.getComponentMeta(getComponentsMetaStateSlice(state), type);
117
112
  }
118
- function getPropControllersStateSlice(state) {
119
- return state.propControllers;
113
+ function getPropControllerDescriptorsStateSlice(state) {
114
+ return state.propControllerDescriptors;
120
115
  }
121
116
  function getPropControllerDescriptors(state) {
122
- return PropControllers.getPropControllerDescriptors(getPropControllersStateSlice(state));
117
+ return PropControllerDescriptors.getPropControllerDescriptors(
118
+ getPropControllerDescriptorsStateSlice(state)
119
+ );
123
120
  }
124
121
  function getComponentPropControllerDescriptors(state, componentType) {
125
- return PropControllers.getComponentPropControllerDescriptors(
126
- getPropControllersStateSlice(state),
122
+ return PropControllerDescriptors.getComponentPropControllerDescriptors(
123
+ getPropControllerDescriptorsStateSlice(state),
127
124
  componentType
128
125
  );
129
126
  }
130
- function getPropControllerHandlesStateSlice(state) {
131
- return state.propControllerHandles;
132
- }
133
- function getPropControllers(state, { documentKey, elementKey }) {
134
- return PropControllerHandles.getPropControllers(
135
- getPropControllerHandlesStateSlice(state),
136
- documentKey,
137
- elementKey
138
- );
139
- }
140
- function getPropControllersHandle(state, { documentKey, elementKey }) {
141
- return PropControllerHandles.getPropControllersHandle(
142
- getPropControllerHandlesStateSlice(state),
143
- documentKey,
144
- elementKey
145
- );
146
- }
147
- function getPropController(state, {
148
- documentKey,
149
- elementKey,
150
- propName
151
- }) {
152
- return PropControllerHandles.getPropController(
153
- getPropControllerHandlesStateSlice(state),
154
- documentKey,
155
- elementKey,
156
- propName
157
- );
158
- }
159
127
  const getDocumentKeysSortedByDepth = (0, import_reselect.createSelector)(
160
128
  [getDocumentsStateSlice, getElementTreesSlice],
161
129
  (documents, elementTrees) => {
@@ -219,10 +187,7 @@ function getLocale(state) {
219
187
  getIsInBuilder,
220
188
  getIsReadOnly,
221
189
  getLocale,
222
- getPropController,
223
190
  getPropControllerDescriptors,
224
- getPropControllers,
225
- getPropControllersHandle,
226
191
  getReactComponent,
227
192
  getRootElement,
228
193
  isElementReference,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/state/read-only-state.ts"],"sourcesContent":["import { type ThunkDispatch } from '@reduxjs/toolkit'\n\nimport { createSelector } from 'reselect'\n\nimport * as SiteVersion from './modules/site-version'\nimport * as Locale from './modules/locale'\nimport * as Documents from './modules/read-only-documents'\nimport * as ElementTrees from './modules/element-trees'\nimport * as ReactComponents from './modules/react-components'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllers from './modules/prop-controllers'\nimport * as PropControllerHandles from './modules/prop-controller-handles'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as IsReadOnly from './modules/is-read-only'\nimport * as BuilderEditMode from './modules/builder-edit-mode'\nimport * as Breakpoints from './modules/breakpoints'\n\nimport { type Action } from './actions'\n\nexport type {\n Data,\n Document,\n DocumentReference,\n Element,\n ElementData,\n ElementReference,\n} from './modules/read-only-documents'\n\nexport {\n createBaseDocument,\n createDocumentReference,\n getRootElement,\n isElementReference,\n} from './modules/read-only-documents'\n\nexport type { ComponentType } from './modules/react-components'\nexport type { ComponentMeta } from './modules/components-meta'\n\nexport const reducers = {\n siteVersion: SiteVersion.reducer,\n isReadOnly: IsReadOnly.reducer,\n locale: Locale.reducer,\n documents: Documents.reducer,\n elementTrees: ElementTrees.reducer,\n reactComponents: ReactComponents.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllers: PropControllers.reducer,\n propControllerHandles: PropControllerHandles.reducer,\n isInBuilder: IsInBuilder.reducer,\n builderEditMode: BuilderEditMode.reducer,\n breakpoints: Breakpoints.reducer,\n}\n\nexport type State = {\n siteVersion: SiteVersion.State\n isReadOnly: IsReadOnly.State\n locale: Locale.State\n documents: Documents.State\n elementTrees: ElementTrees.State\n reactComponents: ReactComponents.State\n componentsMeta: ComponentsMeta.State\n propControllers: PropControllers.State\n propControllerHandles: PropControllerHandles.State\n isInBuilder: IsInBuilder.State\n builderEditMode: BuilderEditMode.State\n breakpoints: Breakpoints.State\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction getDocumentsStateSlice(state: State): Documents.State {\n return state.documents\n}\n\nexport function getDocument(state: State, documentKey: string): Documents.Document | null {\n return Documents.getDocument(getDocumentsStateSlice(state), documentKey)\n}\n\nfunction getElementTreesSlice(state: State): ElementTrees.State {\n return state.elementTrees\n}\n\nexport function getElements(\n state: State,\n documentKey: string,\n): ElementTrees.ElementTree['elements'] {\n return ElementTrees.getElements(getElementTreesSlice(state), documentKey)\n}\n\nexport function getElementIds(\n state: State,\n documentKey: string,\n): ElementTrees.ElementTree['elementIds'] {\n return ElementTrees.getElementIds(getElementTreesSlice(state), documentKey)\n}\n\nfunction getReactComponentsStateSlice(state: State): ReactComponents.State {\n return state.reactComponents\n}\n\nexport function getReactComponent(\n state: State,\n type: string,\n): ReactComponents.ComponentType | null {\n return ReactComponents.getReactComponent(getReactComponentsStateSlice(state), type)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nexport function getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nexport function getComponentMeta(state: State, type: string): ComponentsMeta.ComponentMeta | null {\n return ComponentsMeta.getComponentMeta(getComponentsMetaStateSlice(state), type)\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nexport function getPropControllerDescriptors(state: State): PropControllers.State {\n return PropControllers.getPropControllerDescriptors(getPropControllersStateSlice(state))\n}\n\nexport function getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): PropControllers.DescriptorsByProp | null {\n return PropControllers.getComponentPropControllerDescriptors(\n getPropControllersStateSlice(state),\n componentType,\n )\n}\n\nfunction getPropControllerHandlesStateSlice(state: State): PropControllerHandles.State {\n return state.propControllerHandles\n}\n\nexport function getPropControllers(\n state: State,\n { documentKey, elementKey }: { documentKey: string; elementKey: string },\n) {\n return PropControllerHandles.getPropControllers(\n getPropControllerHandlesStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\nexport function getPropControllersHandle(\n state: State,\n { documentKey, elementKey }: { documentKey: string; elementKey: string },\n) {\n return PropControllerHandles.getPropControllersHandle(\n getPropControllerHandlesStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\nexport function getPropController(\n state: State,\n {\n documentKey,\n elementKey,\n propName,\n }: { documentKey: string; elementKey: string; propName: string },\n) {\n return PropControllerHandles.getPropController(\n getPropControllerHandlesStateSlice(state),\n documentKey,\n elementKey,\n propName,\n )\n}\n\n/**\n * Returns all document keys sorted by depth, i.e., parent documents come before child documents.\n */\nexport const getDocumentKeysSortedByDepth: (state: State) => string[] = createSelector(\n [getDocumentsStateSlice, getElementTreesSlice],\n (documents, elementTrees) => {\n return [...documents.keys()].sort((a, b) => (elementTrees.get(a)?.elements.has(b) ? -1 : 1))\n },\n)\n\nexport function getElement(\n state: State,\n documentKey: string,\n elementKey: string,\n): Documents.Element | null {\n return ElementTrees.getElement(getElementTreesSlice(state), documentKey, elementKey)\n}\n\nexport function getElementId(state: State, documentKey: string, elementKey: string): string | null {\n return ElementTrees.getElementId(getElementTreesSlice(state), documentKey, elementKey)\n}\n\nexport function getElementPropControllerDescriptors(\n state: State,\n documentKey: string,\n elementKey: string,\n): Record<string, PropControllers.PropControllerDescriptor> | null {\n const element = getElement(state, documentKey, elementKey)\n\n if (element == null || Documents.isElementReference(element)) return null\n\n return getComponentPropControllerDescriptors(state, element.type)\n}\n\nexport function getIsInBuilder(state: State): boolean {\n return state.isInBuilder\n}\n\nexport function getIsReadOnly(state: State): boolean {\n return state.isReadOnly\n}\n\nexport function getBuilderEditMode(state: State): BuilderEditMode.State {\n return state.builderEditMode\n}\n\nfunction getBreakpointsStateSlice(state: State): Breakpoints.State {\n return state.breakpoints\n}\n\nexport function getBreakpoints(state: State): Breakpoints.Breakpoints {\n return getBreakpointsStateSlice(state).breakpoints\n}\n\nexport function getBaseBreakpoint(state: State): Breakpoints.BreakpointId {\n return getBreakpointsStateSlice(state).baseBreakpoint\n}\n\nexport function getClientBreakpoint(state: State): Breakpoints.BreakpointId {\n return getBreakpointsStateSlice(state).clientBreakpoint\n}\n\nexport function getLocale(state: State): string | null {\n return state.locale\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAA+B;AAE/B,kBAA6B;AAC7B,aAAwB;AACxB,gBAA2B;AAC3B,mBAA8B;AAC9B,sBAAiC;AACjC,qBAAgC;AAChC,sBAAiC;AACjC,4BAAuC;AACvC,kBAA6B;AAC7B,iBAA4B;AAC5B,sBAAiC;AACjC,kBAA6B;AAa7B,iCAKO;AAKA,MAAM,WAAW;AAAA,EACtB,aAAa,YAAY;AAAA,EACzB,YAAY,WAA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C;AACtE,SAAO,MAAM;AACf;AAEA,SAAS,yBAAyB,OAAiC;AACjE,SAAO,MAAM;AACf;AAEO,SAAS,eAAe,OAAuC;AACpE,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,kBAAkB,OAAwC;AACxE,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,oBAAoB,OAAwC;AAC1E,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,UAAU,OAA6B;AACrD,SAAO,MAAM;AACf;","names":[]}
1
+ {"version":3,"sources":["../../../src/state/read-only-state.ts"],"sourcesContent":["import { type ThunkDispatch } from '@reduxjs/toolkit'\n\nimport { createSelector } from 'reselect'\n\nimport * as SiteVersion from './modules/site-version'\nimport * as Locale from './modules/locale'\nimport * as Documents from './modules/read-only-documents'\nimport * as ElementTrees from './modules/element-trees'\nimport * as ReactComponents from './modules/react-components'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllerDescriptors from './modules/prop-controller-descriptors'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as IsReadOnly from './modules/is-read-only'\nimport * as BuilderEditMode from './modules/builder-edit-mode'\nimport * as Breakpoints from './modules/breakpoints'\n\nimport { type Action } from './actions'\n\nexport type {\n Data,\n Document,\n DocumentReference,\n Element,\n ElementData,\n ElementReference,\n} from './modules/read-only-documents'\n\nexport {\n createBaseDocument,\n createDocumentReference,\n getRootElement,\n isElementReference,\n} from './modules/read-only-documents'\n\nexport type { ComponentType } from './modules/react-components'\nexport type { ComponentMeta } from './modules/components-meta'\n\nexport const reducers = {\n siteVersion: SiteVersion.reducer,\n isReadOnly: IsReadOnly.reducer,\n locale: Locale.reducer,\n documents: Documents.reducer,\n elementTrees: ElementTrees.reducer,\n reactComponents: ReactComponents.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllerDescriptors: PropControllerDescriptors.reducer,\n isInBuilder: IsInBuilder.reducer,\n builderEditMode: BuilderEditMode.reducer,\n breakpoints: Breakpoints.reducer,\n}\n\nexport type State = {\n siteVersion: SiteVersion.State\n isReadOnly: IsReadOnly.State\n locale: Locale.State\n documents: Documents.State\n elementTrees: ElementTrees.State\n reactComponents: ReactComponents.State\n componentsMeta: ComponentsMeta.State\n propControllerDescriptors: PropControllerDescriptors.State\n isInBuilder: IsInBuilder.State\n builderEditMode: BuilderEditMode.State\n breakpoints: Breakpoints.State\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction getDocumentsStateSlice(state: State): Documents.State {\n return state.documents\n}\n\nexport function getDocument(state: State, documentKey: string): Documents.Document | null {\n return Documents.getDocument(getDocumentsStateSlice(state), documentKey)\n}\n\nfunction getElementTreesSlice(state: State): ElementTrees.State {\n return state.elementTrees\n}\n\nexport function getElements(\n state: State,\n documentKey: string,\n): ElementTrees.ElementTree['elements'] {\n return ElementTrees.getElements(getElementTreesSlice(state), documentKey)\n}\n\nexport function getElementIds(\n state: State,\n documentKey: string,\n): ElementTrees.ElementTree['elementIds'] {\n return ElementTrees.getElementIds(getElementTreesSlice(state), documentKey)\n}\n\nfunction getReactComponentsStateSlice(state: State): ReactComponents.State {\n return state.reactComponents\n}\n\nexport function getReactComponent(\n state: State,\n type: string,\n): ReactComponents.ComponentType | null {\n return ReactComponents.getReactComponent(getReactComponentsStateSlice(state), type)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nexport function getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nexport function getComponentMeta(state: State, type: string): ComponentsMeta.ComponentMeta | null {\n return ComponentsMeta.getComponentMeta(getComponentsMetaStateSlice(state), type)\n}\n\nfunction getPropControllerDescriptorsStateSlice(state: State): PropControllerDescriptors.State {\n return state.propControllerDescriptors\n}\n\nexport function getPropControllerDescriptors(state: State): PropControllerDescriptors.State {\n return PropControllerDescriptors.getPropControllerDescriptors(\n getPropControllerDescriptorsStateSlice(state),\n )\n}\n\nexport function getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): PropControllerDescriptors.DescriptorsByProp | null {\n return PropControllerDescriptors.getComponentPropControllerDescriptors(\n getPropControllerDescriptorsStateSlice(state),\n componentType,\n )\n}\n\n/**\n * Returns all document keys sorted by depth, i.e., parent documents come before child documents.\n */\nexport const getDocumentKeysSortedByDepth: (state: State) => string[] = createSelector(\n [getDocumentsStateSlice, getElementTreesSlice],\n (documents, elementTrees) => {\n return [...documents.keys()].sort((a, b) => (elementTrees.get(a)?.elements.has(b) ? -1 : 1))\n },\n)\n\nexport function getElement(\n state: State,\n documentKey: string,\n elementKey: string,\n): Documents.Element | null {\n return ElementTrees.getElement(getElementTreesSlice(state), documentKey, elementKey)\n}\n\nexport function getElementId(state: State, documentKey: string, elementKey: string): string | null {\n return ElementTrees.getElementId(getElementTreesSlice(state), documentKey, elementKey)\n}\n\nexport function getElementPropControllerDescriptors(\n state: State,\n documentKey: string,\n elementKey: string,\n): Record<string, PropControllerDescriptors.PropControllerDescriptor> | null {\n const element = getElement(state, documentKey, elementKey)\n\n if (element == null || Documents.isElementReference(element)) return null\n\n return getComponentPropControllerDescriptors(state, element.type)\n}\n\nexport function getIsInBuilder(state: State): boolean {\n return state.isInBuilder\n}\n\nexport function getIsReadOnly(state: State): boolean {\n return state.isReadOnly\n}\n\nexport function getBuilderEditMode(state: State): BuilderEditMode.State {\n return state.builderEditMode\n}\n\nfunction getBreakpointsStateSlice(state: State): Breakpoints.State {\n return state.breakpoints\n}\n\nexport function getBreakpoints(state: State): Breakpoints.Breakpoints {\n return getBreakpointsStateSlice(state).breakpoints\n}\n\nexport function getBaseBreakpoint(state: State): Breakpoints.BreakpointId {\n return getBreakpointsStateSlice(state).baseBreakpoint\n}\n\nexport function getClientBreakpoint(state: State): Breakpoints.BreakpointId {\n return getBreakpointsStateSlice(state).clientBreakpoint\n}\n\nexport function getLocale(state: State): string | null {\n return state.locale\n}\n"],"mappings":";;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S,yBAAyB,OAAiC;AACjE,SAAO,MAAM;AACf;AAEO,SAAS,eAAe,OAAuC;AACpE,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,kBAAkB,OAAwC;AACxE,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,oBAAoB,OAAwC;AAC1E,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,UAAU,OAA6B;AACrD,SAAO,MAAM;AACf;","names":[]}
@@ -39,6 +39,9 @@ __export(read_write_state_exports, {
39
39
  getElementImperativeHandlesContainingElement: () => getElementImperativeHandlesContainingElement,
40
40
  getMeasurables: () => getMeasurables,
41
41
  getPointer: () => getPointer,
42
+ getPropController: () => getPropController,
43
+ getPropControllers: () => getPropControllers,
44
+ getPropControllersHandle: () => getPropControllersHandle,
42
45
  parse: () => import_box_models.parse,
43
46
  setupBuilderProxy: () => setupBuilderProxy
44
47
  });
@@ -47,6 +50,7 @@ var import_toolkit = require("@reduxjs/toolkit");
47
50
  var Documents = __toESM(require("./modules/read-write/read-write-documents"));
48
51
  var BoxModels = __toESM(require("./modules/read-write/box-models"));
49
52
  var Pointer = __toESM(require("./modules/read-write/pointer"));
53
+ var PropControllers = __toESM(require("./modules/read-write/prop-controllers"));
50
54
  var ElementImperativeHandles = __toESM(require("./modules/read-write/element-imperative-handles"));
51
55
  var ReadOnlyState = __toESM(require("./read-only-state"));
52
56
  var import_box_models = require("./modules/read-write/box-models");
@@ -55,6 +59,7 @@ const reducers = {
55
59
  documents: Documents.reducer,
56
60
  boxModels: BoxModels.reducer,
57
61
  pointer: Pointer.reducer,
62
+ propControllers: PropControllers.reducer,
58
63
  elementImperativeHandles: ElementImperativeHandles.reducer
59
64
  };
60
65
  function createRootReducer() {
@@ -104,6 +109,35 @@ function getElementImperativeHandlesContainingElement(state, element) {
104
109
  }
105
110
  return filteredElementImperativeHandles;
106
111
  }
112
+ function getPropControllersStateSlice(state) {
113
+ return state.propControllers;
114
+ }
115
+ function getPropControllers(state, { documentKey, elementKey }) {
116
+ return PropControllers.getPropControllers(
117
+ getPropControllersStateSlice(state),
118
+ documentKey,
119
+ elementKey
120
+ );
121
+ }
122
+ function getPropControllersHandle(state, { documentKey, elementKey }) {
123
+ return PropControllers.getPropControllersHandle(
124
+ getPropControllersStateSlice(state),
125
+ documentKey,
126
+ elementKey
127
+ );
128
+ }
129
+ function getPropController(state, {
130
+ documentKey,
131
+ elementKey,
132
+ propName
133
+ }) {
134
+ return PropControllers.getPropController(
135
+ getPropControllersStateSlice(state),
136
+ documentKey,
137
+ elementKey,
138
+ propName
139
+ );
140
+ }
107
141
  function setupBuilderProxy(builderProxy) {
108
142
  return (dispatch) => {
109
143
  return builderProxy.setup({ onHostAction: (action) => dispatch(action) });
@@ -122,6 +156,9 @@ function setupBuilderProxy(builderProxy) {
122
156
  getElementImperativeHandlesContainingElement,
123
157
  getMeasurables,
124
158
  getPointer,
159
+ getPropController,
160
+ getPropControllers,
161
+ getPropControllersHandle,
125
162
  parse,
126
163
  setupBuilderProxy
127
164
  });