@makeswift/runtime 0.28.8-canary.2 → 0.28.8-canary.21

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 (508) 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/Embed/Embed.js +2 -1
  8. package/dist/cjs/components/builtin/Embed/Embed.js.map +1 -1
  9. package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
  10. package/dist/cjs/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
  11. package/dist/cjs/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js.map +1 -1
  12. package/dist/cjs/controls/index.js +4 -0
  13. package/dist/cjs/controls/index.js.map +1 -1
  14. package/dist/cjs/controls/link.js.map +1 -1
  15. package/dist/cjs/controls/rich-text/control.js +16 -3
  16. package/dist/cjs/controls/rich-text/control.js.map +1 -1
  17. package/dist/cjs/controls/rich-text/rich-text.js +2 -2
  18. package/dist/cjs/controls/rich-text/rich-text.js.map +1 -1
  19. package/dist/cjs/controls/rich-text-v2/control.js +15 -2
  20. package/dist/cjs/controls/rich-text-v2/control.js.map +1 -1
  21. package/dist/cjs/controls/rich-text-v2/rich-text-v2.js +2 -2
  22. package/dist/cjs/controls/rich-text-v2/rich-text-v2.js.map +1 -1
  23. package/dist/cjs/controls/serialization/base/index.js +1 -0
  24. package/dist/cjs/controls/serialization/base/index.js.map +1 -1
  25. package/dist/cjs/controls/slot.js.map +1 -1
  26. package/dist/cjs/next/testing/breakpoints.js +3 -15
  27. package/dist/cjs/next/testing/breakpoints.js.map +1 -1
  28. package/dist/cjs/next/testing/element-data.js +3 -82
  29. package/dist/cjs/next/testing/element-data.js.map +1 -1
  30. package/dist/cjs/next/testing/react-runtime.js.map +1 -1
  31. package/dist/cjs/prop-controllers/instances.js +20 -4
  32. package/dist/cjs/prop-controllers/instances.js.map +1 -1
  33. package/dist/cjs/runtimes/react/components/Element.js +37 -12
  34. package/dist/cjs/runtimes/react/components/Element.js.map +1 -1
  35. package/dist/cjs/runtimes/react/components/ElementRegistration.js +32 -11
  36. package/dist/cjs/runtimes/react/components/ElementRegistration.js.map +1 -1
  37. package/dist/cjs/runtimes/react/components/control-instances-context.js +38 -0
  38. package/dist/cjs/runtimes/react/components/control-instances-context.js.map +1 -0
  39. package/dist/cjs/runtimes/react/components/resolve-props.js +12 -1
  40. package/dist/cjs/runtimes/react/components/resolve-props.js.map +1 -1
  41. package/dist/cjs/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
  42. package/dist/cjs/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js +4 -2
  43. package/dist/cjs/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js.map +1 -1
  44. package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js +2 -2
  45. package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
  46. package/dist/cjs/{utils/is.js → runtimes/react/controls/slot/index.js} +10 -7
  47. package/dist/cjs/runtimes/react/controls/slot/index.js.map +1 -0
  48. package/dist/cjs/runtimes/react/controls/{group.js → slot/render-slot.js} +13 -21
  49. package/dist/cjs/runtimes/react/controls/slot/render-slot.js.map +1 -0
  50. package/dist/cjs/runtimes/react/controls/{slot.js → slot/slot-value.js} +24 -26
  51. package/dist/cjs/runtimes/react/controls/slot/slot-value.js.map +1 -0
  52. package/dist/cjs/runtimes/react/controls/style.js.map +1 -1
  53. package/dist/cjs/runtimes/react/element-imperative-handle.js +2 -2
  54. package/dist/cjs/runtimes/react/element-imperative-handle.js.map +1 -1
  55. package/dist/cjs/runtimes/react/hooks/use-control-instance.js +88 -0
  56. package/dist/cjs/runtimes/react/hooks/use-control-instance.js.map +1 -0
  57. package/dist/cjs/runtimes/react/hooks/use-control-instances.js +29 -0
  58. package/dist/cjs/runtimes/react/hooks/use-control-instances.js.map +1 -0
  59. package/dist/cjs/runtimes/react/hooks/use-disable-register-element.js +3 -3
  60. package/dist/cjs/runtimes/react/hooks/use-disable-register-element.js.map +1 -1
  61. package/dist/cjs/runtimes/react/hooks/use-resolved-props.js +17 -33
  62. package/dist/cjs/runtimes/react/hooks/use-resolved-props.js.map +1 -1
  63. package/dist/cjs/runtimes/react/hooks/use-stylesheet-factory.js +3 -3
  64. package/dist/cjs/runtimes/react/hooks/use-stylesheet-factory.js.map +1 -1
  65. package/dist/cjs/runtimes/react/react-runtime-core.js +2 -1
  66. package/dist/cjs/runtimes/react/react-runtime-core.js.map +1 -1
  67. package/dist/cjs/runtimes/react/stylesheet-factory.js +17 -0
  68. package/dist/cjs/runtimes/react/stylesheet-factory.js.map +1 -0
  69. package/dist/cjs/runtimes/react/testing/index.js +25 -0
  70. package/dist/cjs/runtimes/react/testing/index.js.map +1 -0
  71. package/dist/cjs/runtimes/react/testing/react-provider.js +38 -0
  72. package/dist/cjs/runtimes/react/testing/react-provider.js.map +1 -0
  73. package/dist/cjs/slate/TypographyPlugin/normalizeTypographyUp.js.map +1 -1
  74. package/dist/cjs/slate/selectors.js.map +1 -1
  75. package/dist/cjs/slate/utils/toText.js.map +1 -1
  76. package/dist/cjs/state/actions/index.js +4 -4
  77. package/dist/cjs/state/actions/index.js.map +1 -1
  78. package/dist/cjs/state/actions/internal/action-types.js +34 -0
  79. package/dist/cjs/state/actions/internal/action-types.js.map +1 -0
  80. package/dist/cjs/state/actions/internal/index.js +0 -17
  81. package/dist/cjs/state/actions/internal/index.js.map +1 -1
  82. package/dist/cjs/state/actions/internal/read-only-action-types.js +44 -0
  83. package/dist/cjs/state/actions/internal/read-only-action-types.js.map +1 -0
  84. package/dist/cjs/state/actions/internal/read-only-actions.js +13 -92
  85. package/dist/cjs/state/actions/internal/read-only-actions.js.map +1 -1
  86. package/dist/cjs/state/actions/internal/read-write-action-types.js +42 -0
  87. package/dist/cjs/state/actions/internal/read-write-action-types.js.map +1 -0
  88. package/dist/cjs/state/actions/internal/read-write-actions.js +119 -14
  89. package/dist/cjs/state/actions/internal/read-write-actions.js.map +1 -1
  90. package/dist/cjs/state/builder-api/action-types.js +49 -0
  91. package/dist/cjs/state/builder-api/action-types.js.map +1 -0
  92. package/dist/cjs/state/builder-api/actions.js +14 -36
  93. package/dist/cjs/state/builder-api/actions.js.map +1 -1
  94. package/dist/cjs/state/builder-api/proxy.js +2 -1
  95. package/dist/cjs/state/builder-api/proxy.js.map +1 -1
  96. package/dist/cjs/state/host-api/action-types.js +43 -0
  97. package/dist/cjs/state/host-api/action-types.js.map +1 -0
  98. package/dist/cjs/state/{host-api.js → host-api/actions.js} +17 -33
  99. package/dist/cjs/state/host-api/actions.js.map +1 -0
  100. package/dist/cjs/state/host-api/index.js +25 -0
  101. package/dist/cjs/state/host-api/index.js.map +1 -0
  102. package/dist/cjs/state/middleware/read-write/builder-api/index.js +15 -15
  103. package/dist/cjs/state/middleware/read-write/builder-api/index.js.map +1 -1
  104. package/dist/cjs/state/middleware/read-write/measure-box-models.js +3 -3
  105. package/dist/cjs/state/middleware/read-write/measure-box-models.js.map +1 -1
  106. package/dist/cjs/state/middleware/read-write/prop-controller-handles.js +10 -47
  107. package/dist/cjs/state/middleware/read-write/prop-controller-handles.js.map +1 -1
  108. package/dist/cjs/state/modules/api-resources.js +5 -5
  109. package/dist/cjs/state/modules/api-resources.js.map +1 -1
  110. package/dist/cjs/state/modules/breakpoints.js +4 -4
  111. package/dist/cjs/state/modules/breakpoints.js.map +1 -1
  112. package/dist/cjs/state/modules/components-meta.js +3 -3
  113. package/dist/cjs/state/modules/components-meta.js.map +1 -1
  114. package/dist/cjs/state/modules/element-trees.js +53 -25
  115. package/dist/cjs/state/modules/element-trees.js.map +1 -1
  116. package/dist/cjs/state/modules/is-in-builder.js +2 -2
  117. package/dist/cjs/state/modules/is-in-builder.js.map +1 -1
  118. package/dist/cjs/state/modules/is-read-only.js +2 -2
  119. package/dist/cjs/state/modules/is-read-only.js.map +1 -1
  120. package/dist/cjs/state/modules/locale.js +2 -2
  121. package/dist/cjs/state/modules/locale.js.map +1 -1
  122. package/dist/cjs/state/modules/localized-resources-map.js +3 -3
  123. package/dist/cjs/state/modules/localized-resources-map.js.map +1 -1
  124. package/dist/cjs/state/modules/{prop-controllers.js → prop-controller-descriptors.js} +7 -7
  125. package/dist/cjs/state/modules/prop-controller-descriptors.js.map +1 -0
  126. package/dist/cjs/state/modules/react-components.js +3 -3
  127. package/dist/cjs/state/modules/react-components.js.map +1 -1
  128. package/dist/cjs/state/modules/read-write/box-models.js +5 -5
  129. package/dist/cjs/state/modules/read-write/box-models.js.map +1 -1
  130. package/dist/cjs/state/modules/read-write/element-imperative-handles.js +3 -3
  131. package/dist/cjs/state/modules/read-write/element-imperative-handles.js.map +1 -1
  132. package/dist/cjs/state/modules/{prop-controller-handles.js → read-write/prop-controllers.js} +5 -5
  133. package/dist/cjs/state/modules/read-write/prop-controllers.js.map +1 -0
  134. package/dist/cjs/state/read-only-state.js +9 -44
  135. package/dist/cjs/state/read-only-state.js.map +1 -1
  136. package/dist/cjs/state/read-write-state.js +37 -0
  137. package/dist/cjs/state/read-write-state.js.map +1 -1
  138. package/dist/cjs/state/shared-api/action-types.js +33 -0
  139. package/dist/cjs/state/shared-api/action-types.js.map +1 -0
  140. package/dist/cjs/state/{shared-api.js → shared-api/actions.js} +8 -14
  141. package/dist/cjs/state/shared-api/actions.js.map +1 -0
  142. package/dist/cjs/state/shared-api/index.js +25 -0
  143. package/dist/cjs/state/shared-api/index.js.map +1 -0
  144. package/dist/cjs/state/store.js +5 -3
  145. package/dist/cjs/state/store.js.map +1 -1
  146. package/dist/cjs/state/translations/get.js +1 -4
  147. package/dist/cjs/state/translations/get.js.map +1 -1
  148. package/dist/cjs/state/translations/merge.js.map +1 -1
  149. package/dist/cjs/state/unified-state.js +12 -0
  150. package/dist/cjs/state/unified-state.js.map +1 -1
  151. package/dist/cjs/testing/breakpoints.js +35 -0
  152. package/dist/cjs/testing/breakpoints.js.map +1 -0
  153. package/dist/cjs/testing/element-data.js +102 -0
  154. package/dist/cjs/testing/element-data.js.map +1 -0
  155. package/dist/cjs/testing/read-write-state.js +32 -0
  156. package/dist/cjs/testing/read-write-state.js.map +1 -0
  157. package/dist/cjs/translations/index.js.map +1 -1
  158. package/dist/cjs/utils/intersection.js.map +1 -1
  159. package/dist/esm/api/graphql-api-client.js +1 -1
  160. package/dist/esm/api/rest-api-client.js +1 -1
  161. package/dist/esm/api-handler/handlers/manifest.js +1 -1
  162. package/dist/esm/builder/host-to-builder-actions.js +2 -4
  163. package/dist/esm/builder/host-to-builder-actions.js.map +1 -1
  164. package/dist/esm/client/index.js +1 -1
  165. package/dist/esm/components/builtin/Embed/Embed.js +3 -2
  166. package/dist/esm/components/builtin/Embed/Embed.js.map +1 -1
  167. package/dist/esm/components/builtin/Form/Form.js.map +1 -1
  168. package/dist/esm/components/builtin/Navigation/components/DropDownButton/index.js +5 -1
  169. package/dist/esm/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
  170. package/dist/esm/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js +5 -1
  171. package/dist/esm/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js.map +1 -1
  172. package/dist/esm/controls/index.js +4 -0
  173. package/dist/esm/controls/index.js.map +1 -1
  174. package/dist/esm/controls/link.js.map +1 -1
  175. package/dist/esm/controls/rich-text/control.js +16 -3
  176. package/dist/esm/controls/rich-text/control.js.map +1 -1
  177. package/dist/esm/controls/rich-text/rich-text.js +2 -2
  178. package/dist/esm/controls/rich-text/rich-text.js.map +1 -1
  179. package/dist/esm/controls/rich-text-v2/control.js +15 -2
  180. package/dist/esm/controls/rich-text-v2/control.js.map +1 -1
  181. package/dist/esm/controls/rich-text-v2/rich-text-v2.js +2 -2
  182. package/dist/esm/controls/rich-text-v2/rich-text-v2.js.map +1 -1
  183. package/dist/esm/controls/serialization/base/index.js +2 -0
  184. package/dist/esm/controls/serialization/base/index.js.map +1 -1
  185. package/dist/esm/controls/slot.js.map +1 -1
  186. package/dist/esm/next/testing/breakpoints.js +1 -8
  187. package/dist/esm/next/testing/breakpoints.js.map +1 -1
  188. package/dist/esm/next/testing/element-data.js +1 -75
  189. package/dist/esm/next/testing/element-data.js.map +1 -1
  190. package/dist/esm/next/testing/react-runtime.js.map +1 -1
  191. package/dist/esm/prop-controllers/instances.js +20 -4
  192. package/dist/esm/prop-controllers/instances.js.map +1 -1
  193. package/dist/esm/runtimes/react/components/Element.js +35 -13
  194. package/dist/esm/runtimes/react/components/Element.js.map +1 -1
  195. package/dist/esm/runtimes/react/components/ElementRegistration.js +37 -12
  196. package/dist/esm/runtimes/react/components/ElementRegistration.js.map +1 -1
  197. package/dist/esm/runtimes/react/components/control-instances-context.js +13 -0
  198. package/dist/esm/runtimes/react/components/control-instances-context.js.map +1 -0
  199. package/dist/esm/runtimes/react/components/resolve-props.js +12 -1
  200. package/dist/esm/runtimes/react/components/resolve-props.js.map +1 -1
  201. package/dist/esm/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
  202. package/dist/esm/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js +4 -2
  203. package/dist/esm/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js.map +1 -1
  204. package/dist/esm/runtimes/react/controls/rich-text/rich-text.js +1 -1
  205. package/dist/esm/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
  206. package/dist/esm/runtimes/react/controls/slot/index.js +5 -0
  207. package/dist/esm/runtimes/react/controls/slot/index.js.map +1 -0
  208. package/dist/esm/runtimes/react/controls/slot/render-slot.js +13 -0
  209. package/dist/esm/runtimes/react/controls/slot/render-slot.js.map +1 -0
  210. package/dist/esm/runtimes/react/controls/{slot.js → slot/slot-value.js} +27 -23
  211. package/dist/esm/runtimes/react/controls/slot/slot-value.js.map +1 -0
  212. package/dist/esm/runtimes/react/controls/style.js.map +1 -1
  213. package/dist/esm/runtimes/react/element-imperative-handle.js +1 -1
  214. package/dist/esm/runtimes/react/element-imperative-handle.js.map +1 -1
  215. package/dist/esm/runtimes/react/hooks/use-control-instance.js +62 -0
  216. package/dist/esm/runtimes/react/hooks/use-control-instance.js.map +1 -0
  217. package/dist/esm/runtimes/react/hooks/use-control-instances.js +5 -0
  218. package/dist/esm/runtimes/react/hooks/use-control-instances.js.map +1 -0
  219. package/dist/esm/runtimes/react/hooks/use-disable-register-element.js +2 -2
  220. package/dist/esm/runtimes/react/hooks/use-disable-register-element.js.map +1 -1
  221. package/dist/esm/runtimes/react/hooks/use-resolved-props.js +17 -23
  222. package/dist/esm/runtimes/react/hooks/use-resolved-props.js.map +1 -1
  223. package/dist/esm/runtimes/react/hooks/use-stylesheet-factory.js +3 -3
  224. package/dist/esm/runtimes/react/hooks/use-stylesheet-factory.js.map +1 -1
  225. package/dist/esm/runtimes/react/react-runtime-core.js +2 -1
  226. package/dist/esm/runtimes/react/react-runtime-core.js.map +1 -1
  227. package/dist/esm/runtimes/react/stylesheet-factory.js +1 -0
  228. package/dist/esm/runtimes/react/stylesheet-factory.js.map +1 -0
  229. package/dist/esm/runtimes/react/testing/index.js +3 -0
  230. package/dist/esm/runtimes/react/testing/index.js.map +1 -0
  231. package/dist/esm/runtimes/react/testing/react-provider.js +14 -0
  232. package/dist/esm/runtimes/react/testing/react-provider.js.map +1 -0
  233. package/dist/esm/slate/TypographyPlugin/normalizeTypographyUp.js.map +1 -1
  234. package/dist/esm/slate/selectors.js.map +1 -1
  235. package/dist/esm/slate/utils/toText.js.map +1 -1
  236. package/dist/esm/state/actions/index.js +2 -2
  237. package/dist/esm/state/actions/index.js.map +1 -1
  238. package/dist/esm/state/actions/internal/action-types.js +10 -0
  239. package/dist/esm/state/actions/internal/action-types.js.map +1 -0
  240. package/dist/esm/state/actions/internal/index.js +0 -9
  241. package/dist/esm/state/actions/internal/index.js.map +1 -1
  242. package/dist/esm/state/actions/internal/read-only-action-types.js +20 -0
  243. package/dist/esm/state/actions/internal/read-only-action-types.js.map +1 -0
  244. package/dist/esm/state/actions/internal/read-only-actions.js +1 -73
  245. package/dist/esm/state/actions/internal/read-only-actions.js.map +1 -1
  246. package/dist/esm/state/actions/internal/read-write-action-types.js +18 -0
  247. package/dist/esm/state/actions/internal/read-write-action-types.js.map +1 -0
  248. package/dist/esm/state/actions/internal/read-write-actions.js +94 -8
  249. package/dist/esm/state/actions/internal/read-write-actions.js.map +1 -1
  250. package/dist/esm/state/builder-api/action-types.js +25 -0
  251. package/dist/esm/state/builder-api/action-types.js.map +1 -0
  252. package/dist/esm/state/builder-api/actions.js +1 -24
  253. package/dist/esm/state/builder-api/actions.js.map +1 -1
  254. package/dist/esm/state/builder-api/proxy.js +2 -1
  255. package/dist/esm/state/builder-api/proxy.js.map +1 -1
  256. package/dist/esm/state/host-api/action-types.js +19 -0
  257. package/dist/esm/state/host-api/action-types.js.map +1 -0
  258. package/dist/esm/state/{host-api.js → host-api/actions.js} +2 -17
  259. package/dist/esm/state/host-api/actions.js.map +1 -0
  260. package/dist/esm/state/host-api/index.js +3 -0
  261. package/dist/esm/state/host-api/index.js.map +1 -0
  262. package/dist/esm/state/middleware/read-write/builder-api/index.js +1 -1
  263. package/dist/esm/state/middleware/read-write/builder-api/index.js.map +1 -1
  264. package/dist/esm/state/middleware/read-write/measure-box-models.js +3 -3
  265. package/dist/esm/state/middleware/read-write/measure-box-models.js.map +1 -1
  266. package/dist/esm/state/middleware/read-write/prop-controller-handles.js +13 -47
  267. package/dist/esm/state/middleware/read-write/prop-controller-handles.js.map +1 -1
  268. package/dist/esm/state/modules/api-resources.js +2 -2
  269. package/dist/esm/state/modules/api-resources.js.map +1 -1
  270. package/dist/esm/state/modules/breakpoints.js +2 -2
  271. package/dist/esm/state/modules/breakpoints.js.map +1 -1
  272. package/dist/esm/state/modules/components-meta.js +1 -1
  273. package/dist/esm/state/modules/components-meta.js.map +1 -1
  274. package/dist/esm/state/modules/element-trees.js +50 -22
  275. package/dist/esm/state/modules/element-trees.js.map +1 -1
  276. package/dist/esm/state/modules/is-in-builder.js +1 -1
  277. package/dist/esm/state/modules/is-in-builder.js.map +1 -1
  278. package/dist/esm/state/modules/is-read-only.js +1 -1
  279. package/dist/esm/state/modules/is-read-only.js.map +1 -1
  280. package/dist/esm/state/modules/locale.js +1 -1
  281. package/dist/esm/state/modules/locale.js.map +1 -1
  282. package/dist/esm/state/modules/localized-resources-map.js +1 -1
  283. package/dist/esm/state/modules/localized-resources-map.js.map +1 -1
  284. package/dist/esm/state/modules/{prop-controllers.js → prop-controller-descriptors.js} +2 -2
  285. package/dist/esm/state/modules/prop-controller-descriptors.js.map +1 -0
  286. package/dist/esm/state/modules/react-components.js +1 -1
  287. package/dist/esm/state/modules/react-components.js.map +1 -1
  288. package/dist/esm/state/modules/read-write/box-models.js +2 -2
  289. package/dist/esm/state/modules/read-write/box-models.js.map +1 -1
  290. package/dist/esm/state/modules/read-write/element-imperative-handles.js +3 -3
  291. package/dist/esm/state/modules/read-write/element-imperative-handles.js.map +1 -1
  292. package/dist/esm/state/modules/{prop-controller-handles.js → read-write/prop-controllers.js} +2 -2
  293. package/dist/esm/state/modules/read-write/prop-controllers.js.map +1 -0
  294. package/dist/esm/state/read-only-state.js +9 -41
  295. package/dist/esm/state/read-only-state.js.map +1 -1
  296. package/dist/esm/state/read-write-state.js +34 -0
  297. package/dist/esm/state/read-write-state.js.map +1 -1
  298. package/dist/esm/state/shared-api/action-types.js +9 -0
  299. package/dist/esm/state/shared-api/action-types.js.map +1 -0
  300. package/dist/esm/state/{shared-api.js → shared-api/actions.js} +2 -7
  301. package/dist/esm/state/shared-api/actions.js.map +1 -0
  302. package/dist/esm/state/shared-api/index.js +3 -0
  303. package/dist/esm/state/shared-api/index.js.map +1 -0
  304. package/dist/esm/state/store.js +3 -1
  305. package/dist/esm/state/store.js.map +1 -1
  306. package/dist/esm/state/translations/get.js +1 -4
  307. package/dist/esm/state/translations/get.js.map +1 -1
  308. package/dist/esm/state/translations/merge.js +3 -1
  309. package/dist/esm/state/translations/merge.js.map +1 -1
  310. package/dist/esm/state/unified-state.js +4 -0
  311. package/dist/esm/state/unified-state.js.map +1 -1
  312. package/dist/esm/testing/breakpoints.js +9 -0
  313. package/dist/esm/testing/breakpoints.js.map +1 -0
  314. package/dist/esm/testing/element-data.js +76 -0
  315. package/dist/esm/testing/element-data.js.map +1 -0
  316. package/dist/esm/testing/read-write-state.js +8 -0
  317. package/dist/esm/testing/read-write-state.js.map +1 -0
  318. package/dist/esm/translations/index.js.map +1 -1
  319. package/dist/esm/utils/intersection.js.map +1 -1
  320. package/dist/types/api/schema/page-pathname-slice.d.ts +2 -2
  321. package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts +6 -6
  322. package/dist/types/api-handler/handlers/webhook/types.d.ts +20 -20
  323. package/dist/types/builder/host-to-builder-actions.d.ts.map +1 -1
  324. package/dist/types/components/builtin/Embed/Embed.d.ts.map +1 -1
  325. package/dist/types/components/builtin/Form/Form.d.ts +1 -1
  326. package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
  327. package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts.map +1 -1
  328. package/dist/types/components/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
  329. package/dist/types/components/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
  330. package/dist/types/components/shared/BackgroundsContainer/components/BackgroundVideo/index.d.ts.map +1 -1
  331. package/dist/types/controls/__tests__/slot.test.d.ts +3 -0
  332. package/dist/types/controls/__tests__/slot.test.d.ts.map +1 -0
  333. package/dist/types/controls/index.d.ts +1 -1
  334. package/dist/types/controls/index.d.ts.map +1 -1
  335. package/dist/types/controls/rich-text/control.d.ts +5 -1
  336. package/dist/types/controls/rich-text/control.d.ts.map +1 -1
  337. package/dist/types/controls/rich-text/rich-text.d.ts +2 -2
  338. package/dist/types/controls/rich-text/rich-text.d.ts.map +1 -1
  339. package/dist/types/controls/rich-text-v2/control.d.ts +6 -2
  340. package/dist/types/controls/rich-text-v2/control.d.ts.map +1 -1
  341. package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts +2 -2
  342. package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  343. package/dist/types/controls/serialization/base/index.d.ts.map +1 -1
  344. package/dist/types/controls/slot.d.ts +1 -1
  345. package/dist/types/controls/slot.d.ts.map +1 -1
  346. package/dist/types/locale.d.ts +1 -1
  347. package/dist/types/next/testing/breakpoints.d.ts +1 -3
  348. package/dist/types/next/testing/breakpoints.d.ts.map +1 -1
  349. package/dist/types/next/testing/element-data.d.ts +1 -54
  350. package/dist/types/next/testing/element-data.d.ts.map +1 -1
  351. package/dist/types/next/testing/react-runtime.d.ts.map +1 -1
  352. package/dist/types/prop-controllers/instances.d.ts +9 -3
  353. package/dist/types/prop-controllers/instances.d.ts.map +1 -1
  354. package/dist/types/runtimes/react/components/Element.d.ts.map +1 -1
  355. package/dist/types/runtimes/react/components/ElementRegistration.d.ts +4 -4
  356. package/dist/types/runtimes/react/components/ElementRegistration.d.ts.map +1 -1
  357. package/dist/types/runtimes/react/components/__tests__/element-registration.test.d.ts +3 -0
  358. package/dist/types/runtimes/react/components/__tests__/element-registration.test.d.ts.map +1 -0
  359. package/dist/types/runtimes/react/components/control-instances-context.d.ts +9 -0
  360. package/dist/types/runtimes/react/components/control-instances-context.d.ts.map +1 -0
  361. package/dist/types/runtimes/react/components/resolve-props.d.ts.map +1 -1
  362. package/dist/types/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts +1 -1
  363. package/dist/types/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts.map +1 -1
  364. package/dist/types/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.d.ts.map +1 -1
  365. package/dist/types/runtimes/react/controls/slot/index.d.ts +2 -0
  366. package/dist/types/runtimes/react/controls/slot/index.d.ts.map +1 -0
  367. package/dist/types/runtimes/react/controls/slot/render-slot.d.ts +9 -0
  368. package/dist/types/runtimes/react/controls/slot/render-slot.d.ts.map +1 -0
  369. package/dist/types/runtimes/react/controls/{slot.d.ts → slot/slot-value.d.ts} +7 -7
  370. package/dist/types/runtimes/react/controls/slot/slot-value.d.ts.map +1 -0
  371. package/dist/types/runtimes/react/element-imperative-handle.d.ts +1 -1
  372. package/dist/types/runtimes/react/element-imperative-handle.d.ts.map +1 -1
  373. package/dist/types/runtimes/react/hooks/__tests__/use-control-instance.test.d.ts +3 -0
  374. package/dist/types/runtimes/react/hooks/__tests__/use-control-instance.test.d.ts.map +1 -0
  375. package/dist/types/runtimes/react/hooks/use-control-instance.d.ts +7 -0
  376. package/dist/types/runtimes/react/hooks/use-control-instance.d.ts.map +1 -0
  377. package/dist/types/runtimes/react/hooks/use-control-instances.d.ts +2 -0
  378. package/dist/types/runtimes/react/hooks/use-control-instances.d.ts.map +1 -0
  379. package/dist/types/runtimes/react/hooks/use-disable-register-element.d.ts +1 -1
  380. package/dist/types/runtimes/react/hooks/use-disable-register-element.d.ts.map +1 -1
  381. package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts +9 -2
  382. package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts.map +1 -1
  383. package/dist/types/runtimes/react/hooks/use-store.d.ts +2 -4
  384. package/dist/types/runtimes/react/hooks/use-store.d.ts.map +1 -1
  385. package/dist/types/runtimes/react/hooks/use-stylesheet-factory.d.ts +1 -5
  386. package/dist/types/runtimes/react/hooks/use-stylesheet-factory.d.ts.map +1 -1
  387. package/dist/types/runtimes/react/react-runtime-core.d.ts +9 -1
  388. package/dist/types/runtimes/react/react-runtime-core.d.ts.map +1 -1
  389. package/dist/types/runtimes/react/stylesheet-factory.d.ts +6 -0
  390. package/dist/types/runtimes/react/stylesheet-factory.d.ts.map +1 -0
  391. package/dist/types/runtimes/react/testing/index.d.ts +3 -0
  392. package/dist/types/runtimes/react/testing/index.d.ts.map +1 -0
  393. package/dist/types/runtimes/react/testing/react-provider.d.ts +8 -0
  394. package/dist/types/runtimes/react/testing/react-provider.d.ts.map +1 -0
  395. package/dist/types/slate/InlineModePlugin/index.d.ts +1 -1
  396. package/dist/types/slate/LinkPlugin/getValue.d.ts.map +1 -1
  397. package/dist/types/slate/LinkPlugin/index.d.ts.map +1 -1
  398. package/dist/types/slate/TypographyPlugin/getValue.d.ts.map +1 -1
  399. package/dist/types/slate/TypographyPlugin/index.d.ts.map +1 -1
  400. package/dist/types/slate/selectors.d.ts +2 -2
  401. package/dist/types/slate/selectors.d.ts.map +1 -1
  402. package/dist/types/slate/utils/toText.d.ts.map +1 -1
  403. package/dist/types/state/__tests__/fixtures/serialized-descriptors-from-builder.d.ts.map +1 -1
  404. package/dist/types/state/__tests__/fixtures/translatable-content-sample.d.ts.map +1 -1
  405. package/dist/types/state/__tests__/test-store.d.ts +2 -4
  406. package/dist/types/state/__tests__/test-store.d.ts.map +1 -1
  407. package/dist/types/state/actions/index.d.ts +7 -6
  408. package/dist/types/state/actions/index.d.ts.map +1 -1
  409. package/dist/types/state/actions/internal/action-types.d.ts +27 -0
  410. package/dist/types/state/actions/internal/action-types.d.ts.map +1 -0
  411. package/dist/types/state/actions/internal/index.d.ts +0 -25
  412. package/dist/types/state/actions/internal/index.d.ts.map +1 -1
  413. package/dist/types/state/actions/internal/read-only-action-types.d.ts +15 -0
  414. package/dist/types/state/actions/internal/read-only-action-types.d.ts.map +1 -0
  415. package/dist/types/state/actions/internal/read-only-actions.d.ts +3 -76
  416. package/dist/types/state/actions/internal/read-only-actions.d.ts.map +1 -1
  417. package/dist/types/state/actions/internal/read-write-action-types.d.ts +15 -0
  418. package/dist/types/state/actions/internal/read-write-action-types.d.ts.map +1 -0
  419. package/dist/types/state/actions/internal/read-write-actions.d.ts +71 -8
  420. package/dist/types/state/actions/internal/read-write-actions.d.ts.map +1 -1
  421. package/dist/types/state/builder-api/action-types.d.ts +22 -0
  422. package/dist/types/state/builder-api/action-types.d.ts.map +1 -0
  423. package/dist/types/state/builder-api/actions.d.ts +1 -21
  424. package/dist/types/state/builder-api/actions.d.ts.map +1 -1
  425. package/dist/types/state/builder-api/proxy.d.ts.map +1 -1
  426. package/dist/types/state/host-api/action-types.d.ts +17 -0
  427. package/dist/types/state/host-api/action-types.d.ts.map +1 -0
  428. package/dist/types/state/{host-api.d.ts → host-api/actions.d.ts} +7 -22
  429. package/dist/types/state/host-api/actions.d.ts.map +1 -0
  430. package/dist/types/state/host-api/index.d.ts +3 -0
  431. package/dist/types/state/host-api/index.d.ts.map +1 -0
  432. package/dist/types/state/middleware/read-write/__tests__/fixtures/operations.d.ts.map +1 -0
  433. package/dist/types/state/middleware/read-write/__tests__/fixtures/root-elements.d.ts.map +1 -0
  434. package/dist/types/state/middleware/read-write/__tests__/prop-controller-handles.test.d.ts +2 -0
  435. package/dist/types/state/middleware/read-write/__tests__/prop-controller-handles.test.d.ts.map +1 -0
  436. package/dist/types/state/middleware/read-write/__tests__/update-element-tree.test.d.ts +2 -0
  437. package/dist/types/state/middleware/read-write/__tests__/update-element-tree.test.d.ts.map +1 -0
  438. package/dist/types/state/middleware/read-write/prop-controller-handles.d.ts.map +1 -1
  439. package/dist/types/state/modules/__tests__/fixtures/element-trees.d.ts +737 -0
  440. package/dist/types/state/modules/__tests__/fixtures/element-trees.d.ts.map +1 -1
  441. package/dist/types/state/modules/components-meta.d.ts +3 -0
  442. package/dist/types/state/modules/components-meta.d.ts.map +1 -1
  443. package/dist/types/state/modules/element-trees.d.ts +1 -1
  444. package/dist/types/state/modules/element-trees.d.ts.map +1 -1
  445. package/dist/types/state/modules/{prop-controllers.d.ts → prop-controller-descriptors.d.ts} +1 -1
  446. package/dist/types/state/modules/prop-controller-descriptors.d.ts.map +1 -0
  447. package/dist/types/state/modules/{prop-controller-handles.d.ts → read-write/prop-controllers.d.ts} +4 -4
  448. package/dist/types/state/modules/{prop-controller-handles.d.ts.map → read-write/prop-controllers.d.ts.map} +1 -1
  449. package/dist/types/state/read-only-state.d.ts +6 -70
  450. package/dist/types/state/read-only-state.d.ts.map +1 -1
  451. package/dist/types/state/read-write-state.d.ts +67 -4
  452. package/dist/types/state/read-write-state.d.ts.map +1 -1
  453. package/dist/types/state/shared-api/action-types.d.ts +6 -0
  454. package/dist/types/state/shared-api/action-types.d.ts.map +1 -0
  455. package/dist/types/state/{shared-api.d.ts → shared-api/actions.d.ts} +3 -7
  456. package/dist/types/state/shared-api/actions.d.ts.map +1 -0
  457. package/dist/types/state/shared-api/index.d.ts +3 -0
  458. package/dist/types/state/shared-api/index.d.ts.map +1 -0
  459. package/dist/types/state/store.d.ts +4 -8
  460. package/dist/types/state/store.d.ts.map +1 -1
  461. package/dist/types/state/translations/get.d.ts +1 -1
  462. package/dist/types/state/translations/get.d.ts.map +1 -1
  463. package/dist/types/state/translations/merge.d.ts +1 -1
  464. package/dist/types/state/translations/merge.d.ts.map +1 -1
  465. package/dist/types/state/unified-state.d.ts +2 -0
  466. package/dist/types/state/unified-state.d.ts.map +1 -1
  467. package/dist/types/testing/breakpoints.d.ts +4 -0
  468. package/dist/types/testing/breakpoints.d.ts.map +1 -0
  469. package/dist/types/testing/element-data.d.ts +59 -0
  470. package/dist/types/testing/element-data.d.ts.map +1 -0
  471. package/dist/types/testing/read-write-state.d.ts +3 -0
  472. package/dist/types/testing/read-write-state.d.ts.map +1 -0
  473. package/dist/types/translations/index.d.ts +1 -1
  474. package/dist/types/translations/index.d.ts.map +1 -1
  475. package/dist/types/utils/intersection.d.ts +2 -1
  476. package/dist/types/utils/intersection.d.ts.map +1 -1
  477. package/package.json +9 -6
  478. package/react/builtins/package.json +1 -1
  479. package/dist/cjs/runtimes/react/controls/group.js.map +0 -1
  480. package/dist/cjs/runtimes/react/controls/slot.js.map +0 -1
  481. package/dist/cjs/state/host-api.js.map +0 -1
  482. package/dist/cjs/state/modules/prop-controller-handles.js.map +0 -1
  483. package/dist/cjs/state/modules/prop-controllers.js.map +0 -1
  484. package/dist/cjs/state/shared-api.js.map +0 -1
  485. package/dist/cjs/utils/is.js.map +0 -1
  486. package/dist/esm/runtimes/react/controls/group.js +0 -23
  487. package/dist/esm/runtimes/react/controls/group.js.map +0 -1
  488. package/dist/esm/runtimes/react/controls/slot.js.map +0 -1
  489. package/dist/esm/state/host-api.js.map +0 -1
  490. package/dist/esm/state/modules/prop-controller-handles.js.map +0 -1
  491. package/dist/esm/state/modules/prop-controllers.js.map +0 -1
  492. package/dist/esm/state/shared-api.js.map +0 -1
  493. package/dist/esm/utils/is.js +0 -6
  494. package/dist/esm/utils/is.js.map +0 -1
  495. package/dist/types/runtimes/react/controls/group.d.ts +0 -11
  496. package/dist/types/runtimes/react/controls/group.d.ts.map +0 -1
  497. package/dist/types/runtimes/react/controls/slot.d.ts.map +0 -1
  498. package/dist/types/state/__tests__/fixtures/operations.d.ts.map +0 -1
  499. package/dist/types/state/__tests__/fixtures/root-elements.d.ts.map +0 -1
  500. package/dist/types/state/__tests__/react-builder-preview.test.d.ts +0 -2
  501. package/dist/types/state/__tests__/react-builder-preview.test.d.ts.map +0 -1
  502. package/dist/types/state/host-api.d.ts.map +0 -1
  503. package/dist/types/state/modules/prop-controllers.d.ts.map +0 -1
  504. package/dist/types/state/shared-api.d.ts.map +0 -1
  505. package/dist/types/utils/is.d.ts +0 -3
  506. package/dist/types/utils/is.d.ts.map +0 -1
  507. /package/dist/types/state/{__tests__ → middleware/read-write/__tests__}/fixtures/operations.d.ts +0 -0
  508. /package/dist/types/state/{__tests__ → middleware/read-write/__tests__}/fixtures/root-elements.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/runtimes/react/controls/slot/slot-value.tsx"],"sourcesContent":["'use client'\n\nimport {\n type ComponentPropsWithoutRef,\n type ElementType,\n type ReactNode,\n useEffect,\n useState,\n memo,\n} from 'react'\nimport { cx } from '@emotion/css'\n\nimport {\n SlotDefinition,\n SlotControl,\n type DataType,\n type ControlInstanceKey,\n} from '@makeswift/controls'\n\nimport { type SlotConfig, type SlotPlaceholderConfig } from '../../../../controls/slot'\n\nimport { Element } from '../../components/Element'\nimport { getIndexes } from '../../../../components/utils/columns'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\n\nimport { useIsInBuilder } from '../../hooks/use-is-in-builder'\nimport { useControlInstance } from '../../hooks/use-control-instance'\n\nimport { useStyle } from '../../use-style'\nimport { pollBoxModel } from '../../poll-box-model'\n\nexport const SlotValue = memo(function SlotValue({\n data,\n instanceKey,\n config,\n}: {\n data: DataType<SlotDefinition<ReactNode>> | undefined\n instanceKey: ControlInstanceKey | undefined\n config: SlotConfig\n}): ReactNode {\n const control = useControlInstance(instanceKey, SlotControl)\n\n // TODO(miguel): While the UI shouldn't allow the state, we should probably check that at least\n // one element is visible.\n if (data == null || data.elements.length === 0) {\n return <Slot.Placeholder control={control} placeholder={config.unstable_placeholder} />\n }\n\n return (\n <Slot control={control}>\n {data.elements.map((element, i) => (\n <Slot.Item key={element.key} control={control} grid={data.columns} index={i}>\n <Element element={element} />\n </Slot.Item>\n ))}\n </Slot>\n )\n})\n\ntype SlotProps<T extends ElementType> = {\n as?: T\n control: SlotControl | null\n children?: ReactNode\n className?: string\n}\n\nexport function Slot<T extends ElementType = 'div'>({\n as,\n control,\n children,\n className,\n ...restOfProps\n}: SlotProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof SlotProps<T>>) {\n const As = as ?? 'div'\n const [element, setElement] = useState<Element | null>(null)\n const baseClassName = useStyle({\n display: 'flex',\n flexWrap: 'wrap',\n width: '100%',\n })\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeContainerBoxModel(boxModel),\n })\n }, [element, control])\n\n return (\n <As {...restOfProps} ref={setElement} className={cx(baseClassName, className)}>\n {children}\n </As>\n )\n}\n\nSlot.Placeholder = SlotPlaceholder\n\nSlot.Item = SlotItem\n\ntype SlotItemProps<T extends ElementType> = {\n as?: T\n control: SlotControl | null\n // @arvin: review for correctness\n grid: DataType<SlotDefinition<ReactNode>> extends undefined\n ? undefined\n : NonNullable<DataType<SlotDefinition<ReactNode>>>['columns']\n index: number\n children?: ReactNode\n className?: string\n}\n\nfunction SlotItem<T extends ElementType = 'div'>({\n as,\n control,\n grid,\n index,\n children,\n className,\n ...restOfProps\n}: SlotItemProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof SlotItemProps<T>>): ReactNode {\n const As = as ?? 'div'\n const [element, setElement] = useState<Element | null>(null)\n const baseClassName = useStyle({\n display: 'flex',\n ...useResponsiveStyle([grid], ([{ count = 12, spans = [[12]] } = {}]) => {\n const [rowIndex, columnIndex] = getIndexes(spans, index)\n const span = spans[rowIndex][columnIndex]\n const flexBasis = `calc(100% * ${(span / count).toFixed(5)})`\n\n return span === 0 ? { display: 'none' } : { flexBasis, minWidth: flexBasis }\n }),\n })\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeItemBoxModel(index, boxModel),\n })\n }, [element, control, index])\n\n return (\n <As {...restOfProps} ref={setElement} className={cx(baseClassName, className)}>\n {children}\n </As>\n )\n}\n\ntype SlotPlaceholderProps = {\n control: SlotControl | null\n placeholder?: SlotPlaceholderConfig\n}\n\nconst DEFAULT_SHOW_PLACEHOLDER_IN_BUILDER_ONLY = false\nconst DEFAULT_PLACEHOLDER_HEIGHT_PX = 80\n\nfunction SlotPlaceholder({ control, placeholder }: SlotPlaceholderProps): ReactNode {\n const isInBuilder = useIsInBuilder()\n const [element, setElement] = useState<Element | null>(null)\n\n // TODO: When ready, we can default to only showing the slot placeholder in\n // the builder\n const showInBuilderOnly = placeholder?.builderOnly ?? DEFAULT_SHOW_PLACEHOLDER_IN_BUILDER_ONLY\n const placeholderHeight = placeholder?.height ?? DEFAULT_PLACEHOLDER_HEIGHT_PX\n const text = placeholder?.text\n\n const hidePlaceholder = showInBuilderOnly && !isInBuilder\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeContainerBoxModel(boxModel),\n })\n }, [element, control])\n\n return (\n <div\n ref={setElement}\n className={useStyle({\n width: '100%',\n background: 'rgba(161, 168, 194, 0.18)',\n })}\n style={{\n height: hidePlaceholder ? 0 : placeholderHeight,\n visibility: hidePlaceholder ? 'hidden' : undefined,\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"100%\"\n height=\"100%\"\n className={useStyle({ overflow: 'visible', padding: 8 })}\n >\n <rect\n x={0}\n y={0}\n width=\"100%\"\n height=\"100%\"\n strokeWidth={2}\n strokeDasharray=\"4 2\"\n fill=\"none\"\n stroke=\"rgba(161, 168, 194, 0.40)\"\n rx=\"4\"\n ry=\"4\"\n />\n {text != null && (\n <text\n x=\"50%\"\n y=\"50%\"\n dominantBaseline=\"central\"\n textAnchor=\"middle\"\n fill=\"rgba(161, 168, 194, 0.80)\"\n fontSize=\"14px\"\n fontFamily=\"sans-serif\"\n style={{ userSelect: 'none' }}\n >\n {text}\n </text>\n )}\n </svg>\n </div>\n )\n}\n"],"mappings":";AA6CW,cAmJL,YAnJK;AA3CX;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AAEnB;AAAA,EAEE;AAAA,OAGK;AAIP,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,0BAA0B;AAEnC,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AAEnC,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAEtB,MAAM,YAAY,KAAK,SAASA,WAAU;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AACF,GAIc;AACZ,QAAM,UAAU,mBAAmB,aAAa,WAAW;AAI3D,MAAI,QAAQ,QAAQ,KAAK,SAAS,WAAW,GAAG;AAC9C,WAAO,oBAAC,KAAK,aAAL,EAAiB,SAAkB,aAAa,OAAO,sBAAsB;AAAA,EACvF;AAEA,SACE,oBAAC,QAAK,SACH,eAAK,SAAS,IAAI,CAAC,SAAS,MAC3B,oBAA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,CAAC;AAAA,UAEvD;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,GAAG;AAAA,gBACH,GAAG;AAAA,gBACH,OAAM;AAAA,gBACN,QAAO;AAAA,gBACP,aAAa;AAAA,gBACb,iBAAgB;AAAA,gBAChB,MAAK;AAAA,gBACL,QAAO;AAAA,gBACP,IAAG;AAAA,gBACH,IAAG;AAAA;AAAA,YACL;AAAA,YACC,QAAQ,QACP;AAAA,cAAC;AAAA;AAAA,gBACC,GAAE;AAAA,gBACF,GAAE;AAAA,gBACF,kBAAiB;AAAA,gBACjB,YAAW;AAAA,gBACX,MAAK;AAAA,gBACL,UAAS;AAAA,gBACT,YAAW;AAAA,gBACX,OAAO,EAAE,YAAY,OAAO;AAAA,gBAE3B;AAAA;AAAA,YACH;AAAA;AAAA;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;","names":["SlotValue"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/controls/style.ts"],"sourcesContent":["import { type CSSObject } from '@emotion/serialize'\nimport {\n Style,\n type StyleProperty,\n type ResolvedBorderSideData,\n type FontSizePropertyData,\n type WidthPropertyData,\n type ResolvedStyleData,\n} from '@makeswift/controls'\n\nimport { colorToString } from '../../../components/utils/colorToString'\nimport { responsiveStyle } from '../../../components/utils/responsive-style'\n\nimport { BorderRadiusLonghandPropertyData } from '../../../css/border-radius'\nimport { lengthPercentageDataToString } from '../../../css/length-percentage'\nimport { marginPropertyDataToStyle } from '../../../css/margin'\nimport { paddingPropertyDataToStyle } from '../../../css/padding'\nimport { Breakpoints } from '../../../state/modules/breakpoints'\n\nconst defaultMargin = {\n marginTop: 0,\n marginRight: 'auto',\n marginBottom: 0,\n marginLeft: 'auto',\n}\n\nconst defaultPadding = {\n paddingTop: 0,\n paddingRight: 0,\n paddingBottom: 0,\n paddingLeft: 0,\n}\n\nexport function styleV1Css(\n breakpoints: Breakpoints,\n style: ResolvedStyleData | undefined,\n properties: StyleProperty[],\n): CSSObject {\n return {\n ...(properties.includes(Style.Width) && {\n maxWidth: '100%',\n }),\n ...responsiveStyle(\n breakpoints,\n [\n style?.width,\n style?.margin,\n style?.padding,\n style?.border,\n style?.borderRadius,\n style?.textStyle,\n ] as const,\n ([width, margin, padding, border, borderRadius, textStyle]) => ({\n ...(properties.includes(Style.Width) && {\n width: widthToString(width) ?? '100%',\n }),\n ...(properties.includes(Style.Margin) &&\n marginPropertyDataToStyle(margin ?? defaultMargin, defaultMargin)),\n ...(properties.includes(Style.Padding) &&\n paddingPropertyDataToStyle(padding ?? defaultPadding, defaultPadding)),\n ...(properties.includes(Style.Border) && {\n borderTop: borderSideToString(border?.borderTop) ?? '0 solid black',\n borderRight: borderSideToString(border?.borderRight) ?? '0 solid black',\n borderBottom: borderSideToString(border?.borderBottom) ?? '0 solid black',\n borderLeft: borderSideToString(border?.borderLeft) ?? '0 solid black',\n }),\n ...(properties.includes(Style.BorderRadius) && {\n borderTopLeftRadius: borderRadiusToString(borderRadius?.borderTopLeftRadius) ?? 0,\n borderTopRightRadius: borderRadiusToString(borderRadius?.borderTopRightRadius) ?? 0,\n borderBottomRightRadius: borderRadiusToString(borderRadius?.borderBottomRightRadius) ?? 0,\n borderBottomLeftRadius: borderRadiusToString(borderRadius?.borderBottomLeftRadius) ?? 0,\n }),\n ...(properties.includes(Style.TextStyle) && {\n ...(textStyle?.fontFamily && { \n fontFamily: textStyle.fontFamily.toLowerCase().startsWith('var(') \n ? textStyle.fontFamily \n : `\"${textStyle.fontFamily}\"` \n }),\n ...(textStyle?.letterSpacing && { letterSpacing: textStyle.letterSpacing }),\n ...(textStyle?.fontSize && { fontSize: fontSizeToString(textStyle.fontSize) }),\n ...(textStyle?.fontWeight && { fontWeight: textStyle.fontWeight }),\n textTransform: textStyle?.textTransform ?? [],\n fontStyle: textStyle?.fontStyle ?? [],\n }),\n }),\n ),\n }\n\n function widthToString(widthProperty: WidthPropertyData | undefined): string | null {\n if (widthProperty == null) return null\n\n return lengthPercentageDataToString(widthProperty)\n }\n\n function borderSideToString(\n borderSide: ResolvedBorderSideData | null | undefined,\n ): string | null {\n if (borderSide == null) return null\n\n const { width, color, style } = borderSide\n return `${width != null ? width : 0}px ${style} ${\n color != null ? colorToString(color) : 'black'\n }`\n }\n\n function borderRadiusToString(\n borderRadius: BorderRadiusLonghandPropertyData | null | undefined,\n ): string | null {\n if (borderRadius == null) return null\n\n return lengthPercentageDataToString(borderRadius)\n }\n\n function fontSizeToString(fontSize: NonNullable<FontSizePropertyData>) {\n return `${fontSize.value}${fontSize.unit}`\n }\n}\n"],"mappings":"AACA;AAAA,EACE;AAAA,OAMK;AAEP,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAGhC,SAAS,oCAAoC;AAC7C,SAAS,iCAAiC;AAC1C,SAAS,kCAAkC;AAG3C,MAAM,gBAAgB;AAAA,EACpB,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AACd;AAEA,MAAM,iBAAiB;AAAA,EACrB,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AACf;AAEO,SAAS,WACd,aACA,OACA,YACW;AACX,SAAO;AAAA,IACL,GAAI,WAAW,SAAS,MAAM,KAAK,KAAK;AAAA,MACtC,UAAU;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,MACD;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,MACA,CAAC,CAAC,OAAO,QAAQ,SAAS,QAAQ,cAAc,SAAS,OAAO;AAAA,QAC9D,GAAI,WAAW,SAAS,MAAM,KAAK,KAAK;AAAA,UACtC,OAAO,cAAc,KAAK,KAAK;AAAA,QACjC;AAAA,QACA,GAAI,WAAW,SAAS,MAAM,MAAM,KAClC,0BAA0B,UAAU,eAAe,aAAa;AAAA,QAClE,GAAI,WAAW,SAAS,MAAM,OAAO,K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AG,SAAS,OAAO,QAAQ,CAAC,MAAMA,MAAK,IAC5C,SAAS,OAAO,cAAc,KAAK,IAAI,OACzC;AAAA,EACF;AAEA,WAAS,qBACP,cACe;AACf,QAAI,gBAAgB;AAAM,aAAO;AAEjC,WAAO,6BAA6B,YAAY;AAAA,EAClD;AAEA,WAAS,iBAAiB,UAA6C;AACrE,WAAO,GAAG,SAAS,KAAK,GAAG,SAAS,IAAI;AAAA,EAC1C;AACF;","names":["style"]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/controls/style.ts"],"sourcesContent":["import { type CSSObject } from '@emotion/serialize'\nimport {\n Style,\n type StyleProperty,\n type ResolvedBorderSideData,\n type FontSizePropertyData,\n type WidthPropertyData,\n type ResolvedStyleData,\n} from '@makeswift/controls'\n\nimport { colorToString } from '../../../components/utils/colorToString'\nimport { responsiveStyle } from '../../../components/utils/responsive-style'\n\nimport { BorderRadiusLonghandPropertyData } from '../../../css/border-radius'\nimport { lengthPercentageDataToString } from '../../../css/length-percentage'\nimport { marginPropertyDataToStyle } from '../../../css/margin'\nimport { paddingPropertyDataToStyle } from '../../../css/padding'\nimport { Breakpoints } from '../../../state/modules/breakpoints'\n\nconst defaultMargin = {\n marginTop: 0,\n marginRight: 'auto',\n marginBottom: 0,\n marginLeft: 'auto',\n}\n\nconst defaultPadding = {\n paddingTop: 0,\n paddingRight: 0,\n paddingBottom: 0,\n paddingLeft: 0,\n}\n\nexport function styleV1Css(\n breakpoints: Breakpoints,\n style: ResolvedStyleData | undefined,\n properties: StyleProperty[],\n): CSSObject {\n return {\n ...(properties.includes(Style.Width) && {\n maxWidth: '100%',\n }),\n ...responsiveStyle(\n breakpoints,\n [\n style?.width,\n style?.margin,\n style?.padding,\n style?.border,\n style?.borderRadius,\n style?.textStyle,\n ] as const,\n ([width, margin, padding, border, borderRadius, textStyle]) => ({\n ...(properties.includes(Style.Width) && {\n width: widthToString(width) ?? '100%',\n }),\n ...(properties.includes(Style.Margin) &&\n marginPropertyDataToStyle(margin ?? defaultMargin, defaultMargin)),\n ...(properties.includes(Style.Padding) &&\n paddingPropertyDataToStyle(padding ?? defaultPadding, defaultPadding)),\n ...(properties.includes(Style.Border) && {\n borderTop: borderSideToString(border?.borderTop) ?? '0 solid black',\n borderRight: borderSideToString(border?.borderRight) ?? '0 solid black',\n borderBottom: borderSideToString(border?.borderBottom) ?? '0 solid black',\n borderLeft: borderSideToString(border?.borderLeft) ?? '0 solid black',\n }),\n ...(properties.includes(Style.BorderRadius) && {\n borderTopLeftRadius: borderRadiusToString(borderRadius?.borderTopLeftRadius) ?? 0,\n borderTopRightRadius: borderRadiusToString(borderRadius?.borderTopRightRadius) ?? 0,\n borderBottomRightRadius: borderRadiusToString(borderRadius?.borderBottomRightRadius) ?? 0,\n borderBottomLeftRadius: borderRadiusToString(borderRadius?.borderBottomLeftRadius) ?? 0,\n }),\n ...(properties.includes(Style.TextStyle) && {\n ...(textStyle?.fontFamily && {\n fontFamily: textStyle.fontFamily.toLowerCase().startsWith('var(')\n ? textStyle.fontFamily\n : `\"${textStyle.fontFamily}\"`,\n }),\n ...(textStyle?.letterSpacing && { letterSpacing: textStyle.letterSpacing }),\n ...(textStyle?.fontSize && { fontSize: fontSizeToString(textStyle.fontSize) }),\n ...(textStyle?.fontWeight && { fontWeight: textStyle.fontWeight }),\n textTransform: textStyle?.textTransform ?? [],\n fontStyle: textStyle?.fontStyle ?? [],\n }),\n }),\n ),\n }\n\n function widthToString(widthProperty: WidthPropertyData | undefined): string | null {\n if (widthProperty == null) return null\n\n return lengthPercentageDataToString(widthProperty)\n }\n\n function borderSideToString(\n borderSide: ResolvedBorderSideData | null | undefined,\n ): string | null {\n if (borderSide == null) return null\n\n const { width, color, style } = borderSide\n return `${width != null ? width : 0}px ${style} ${\n color != null ? colorToString(color) : 'black'\n }`\n }\n\n function borderRadiusToString(\n borderRadius: BorderRadiusLonghandPropertyData | null | undefined,\n ): string | null {\n if (borderRadius == null) return null\n\n return lengthPercentageDataToString(borderRadius)\n }\n\n function fontSizeToString(fontSize: NonNullable<FontSizePropertyData>) {\n return `${fontSize.value}${fontSize.unit}`\n }\n}\n"],"mappings":"AACA;AAAA,EACE;AAAA,OAMK;AAEP,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAGhC,SAAS,oCAAoC;AAC7C,SAAS,iCAAiC;AAC1C,SAAS,kCAAkC;AAG3C,MAAM,gBAAgB;AAAA,EACpB,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AACd;AAEA,MAAM,iBAAiB;AAAA,EACrB,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AACf;AAEO,SAAS,WACd,aACA,OACA,YACW;AACX,SAAO;AAAA,IACL,GAAI,WAAW,SAAS,MAAM,KAAK,KAAK;AAAA,MACtC,UAAU;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,MACD;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,MACA,CAAC,CAAC,OAAO,QAAQ,SAAS,QAAQ,cAAc,SAAS,OAAO;AAAA,QAC9D,GAAI,WAAW,SAAS,MAAM,KAAK,KAAK;AAAA,UACtC,OAAO,cAAc,KAAK,KAAK;AAAA,QACjC;AAAA,QACA,GAAI,WAAW,SAAS,MAAM,MAAM,KAClC,0BAA0B,UAAU,eAAe,aAAa;AAAA,QAClE,GAAI,WAAW,SAAS,MAAM,OAAO,KACnC,2BAA2B,WAAW,gBAAgB,cAAc;AAAA,QACtE,GAAI,WAAW,SAAS,MAAM,MAAM,KAAK;AAAA,UACvC,WAAW,mBAAmB,QAAQ,SAAS,KAAK;AAAA,UACpD,aAAa,mBAAmB,QAAQ,WAAW,KAAK;AAAA,UACxD,cAAc,mBAAmB,QAAQ,YAAY,KAAK;AAAA,UAC1D,YAAY,mBAAmB,QAAQ,UAAU,KAAK;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AAAA,EAC1C;AACF;","names":["style"]}
@@ -1,7 +1,7 @@
1
1
  import { isMeasurable, measure } from "../../state/modules/read-write/box-models";
2
2
  import {
3
3
  isPropControllersHandle
4
- } from "../../state/modules/prop-controller-handles";
4
+ } from "../../state/modules/read-write/prop-controllers";
5
5
  class ElementImperativeHandle {
6
6
  getCurrent = () => null;
7
7
  lastPropControllers = null;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/runtimes/react/element-imperative-handle.ts"],"sourcesContent":["import { BoxModelHandle, type BoxDisplayModel } from '../../state/modules/read-write/box-models'\nimport { Descriptor } from '../../prop-controllers/descriptors'\nimport { DescriptorsPropControllers } from '../../prop-controllers/instances'\nimport { isMeasurable, measure } from '../../state/modules/read-write/box-models'\nimport {\n isPropControllersHandle,\n PropControllersHandle,\n} from '../../state/modules/prop-controller-handles'\n\nexport class ElementImperativeHandle<\n T extends Record<string, Descriptor> = Record<string, Descriptor>,\n >\n implements BoxModelHandle, PropControllersHandle<T>\n{\n private getCurrent: () => unknown = () => null\n private lastPropControllers: DescriptorsPropControllers<T> | null = null\n\n callback(getCurrent: () => unknown) {\n const current = this.getCurrent()\n\n if (current === null) this.setPropControllers(null)\n\n this.getCurrent = getCurrent\n\n if (this.lastPropControllers !== null) this.setPropControllers(this.lastPropControllers)\n }\n\n getBoxModel(): BoxDisplayModel | null {\n const current = this.getCurrent()\n\n return isMeasurable(current) ? measure(current) : null\n }\n\n setPropControllers(propControllers: DescriptorsPropControllers<T> | null): void {\n const current = this.getCurrent()\n\n if (isPropControllersHandle(current)) current.setPropControllers(propControllers)\n\n this.lastPropControllers = propControllers\n }\n\n getDomNode(): Element | null {\n const current = this.getCurrent()\n\n if (isDomNodeHandle(current)) return current.getDomNode()\n\n return current instanceof Element ? current : null\n }\n}\n\ntype DomNodeHandle = {\n getDomNode(): Element | null\n}\n\nexport function isDomNodeHandle(value: unknown): value is DomNodeHandle {\n if (\n typeof value === 'object' &&\n value !== null &&\n 'getDomNode' in value &&\n typeof (value as { getDomNode: unknown }).getDomNode === 'function'\n ) {\n return true\n }\n\n return false\n}\n"],"mappings":"AAGA,SAAS,cAAc,eAAe;AACtC;AAAA,EACE;AAAA,OAEK;AAEA,MAAM,wBAIb;AAAA,EACU,aAA4B,MAAM;AAAA,EAClC,sBAA4D;AAAA,EAEpE,SAAS,YAA2B;AAClC,UAAM,UAAU,KAAK,WAAW;AAEhC,QAAI,YAAY;AAAM,WAAK,mBAAmB,IAAI;AAElD,SAAK,aAAa;AAElB,QAAI,KAAK,wBAAwB;AAAM,WAAK,mBAAmB,KAAK,mBAAmB;AAAA,EACzF;AAAA,EAEA,cAAsC;AACpC,UAAM,UAAU,KAAK,WAAW;AAEhC,WAAO,aAAa,OAAO,IAAI,QAAQ,OAAO,IAAI;AAAA,EACpD;AAAA,EAEA,mBAAmB,iBAA6D;AAC9E,UAAM,UAAU,KAAK,WAAW;AAEhC,QAAI,wBAAwB,OAAO;AAAG,cAAQ,mBAAmB,eAAe;AAEhF,SAAK,sBAAsB;AAAA,EAC7B;AAAA,EAEA,aAA6B;AAC3B,UAAM,UAAU,KAAK,WAAW;AAEhC,QAAI,gBAAgB,OAAO;AAAG,aAAO,QAAQ,WAAW;AAExD,WAAO,mBAAmB,UAAU,UAAU;AAAA,EAChD;AACF;AAMO,SAAS,gBAAgB,OAAwC;AACtE,MACE,OAAO,UAAU,YACjB,UAAU,QACV,gBAAgB,SAChB,OAAQ,MAAkC,eAAe,YACzD;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/runtimes/react/element-imperative-handle.ts"],"sourcesContent":["import { BoxModelHandle, type BoxDisplayModel } from '../../state/modules/read-write/box-models'\nimport { Descriptor } from '../../prop-controllers/descriptors'\nimport { DescriptorsPropControllers } from '../../prop-controllers/instances'\nimport { isMeasurable, measure } from '../../state/modules/read-write/box-models'\nimport {\n isPropControllersHandle,\n PropControllersHandle,\n} from '../../state/modules/read-write/prop-controllers'\n\nexport class ElementImperativeHandle<\n T extends Record<string, Descriptor> = Record<string, Descriptor>,\n >\n implements BoxModelHandle, PropControllersHandle<T>\n{\n private getCurrent: () => unknown = () => null\n private lastPropControllers: DescriptorsPropControllers<T> | null = null\n\n callback(getCurrent: () => unknown) {\n const current = this.getCurrent()\n\n if (current === null) this.setPropControllers(null)\n\n this.getCurrent = getCurrent\n\n if (this.lastPropControllers !== null) this.setPropControllers(this.lastPropControllers)\n }\n\n getBoxModel(): BoxDisplayModel | null {\n const current = this.getCurrent()\n\n return isMeasurable(current) ? measure(current) : null\n }\n\n setPropControllers(propControllers: DescriptorsPropControllers<T> | null): void {\n const current = this.getCurrent()\n\n if (isPropControllersHandle(current)) current.setPropControllers(propControllers)\n\n this.lastPropControllers = propControllers\n }\n\n getDomNode(): Element | null {\n const current = this.getCurrent()\n\n if (isDomNodeHandle(current)) return current.getDomNode()\n\n return current instanceof Element ? current : null\n }\n}\n\ntype DomNodeHandle = {\n getDomNode(): Element | null\n}\n\nexport function isDomNodeHandle(value: unknown): value is DomNodeHandle {\n if (\n typeof value === 'object' &&\n value !== null &&\n 'getDomNode' in value &&\n typeof (value as { getDomNode: unknown }).getDomNode === 'function'\n ) {\n return true\n }\n\n return false\n}\n"],"mappings":"AAGA,SAAS,cAAc,eAAe;AACtC;AAAA,EACE;AAAA,OAEK;AAEA,MAAM,wBAIb;AAAA,EACU,aAA4B,MAAM;AAAA,EAClC,sBAA4D;AAAA,EAEpE,SAAS,YAA2B;AAClC,UAAM,UAAU,KAAK,WAAW;AAEhC,QAAI,YAAY;AAAM,WAAK,mBAAmB,IAAI;AAElD,SAAK,aAAa;AAElB,QAAI,KAAK,wBAAwB;AAAM,WAAK,mBAAmB,KAAK,mBAAmB;AAAA,EACzF;AAAA,EAEA,cAAsC;AACpC,UAAM,UAAU,KAAK,WAAW;AAEhC,WAAO,aAAa,OAAO,IAAI,QAAQ,OAAO,IAAI;AAAA,EACpD;AAAA,EAEA,mBAAmB,iBAA6D;AAC9E,UAAM,UAAU,KAAK,WAAW;AAEhC,QAAI,wBAAwB,OAAO;AAAG,cAAQ,mBAAmB,eAAe;AAEhF,SAAK,sBAAsB;AAAA,EAC7B;AAAA,EAEA,aAA6B;AAC3B,UAAM,UAAU,KAAK,WAAW;AAEhC,QAAI,gBAAgB,OAAO;AAAG,aAAO,QAAQ,WAAW;AAExD,WAAO,mBAAmB,UAAU,UAAU;AAAA,EAChD;AACF;AAMO,SAAS,gBAAgB,OAAwC;AACtE,MACE,OAAO,UAAU,YACjB,UAAU,QACV,gBAAgB,SAChB,OAAQ,MAAkC,eAAe,YACzD;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,62 @@
1
+ import { useCallback, useSyncExternalStore } from "react";
2
+ import { isNotNil } from "@makeswift/controls";
3
+ import { useControlInstances } from "./use-control-instances";
4
+ function useControlInstance(instanceKey, instanceClass) {
5
+ const { elementKey, propPath } = instanceKey ?? {};
6
+ const instances = useControlInstances(elementKey);
7
+ const getInstance = useCallback(
8
+ () => instances != null && propPath != null ? getInstanceByPropPath(instances, propPath) : null,
9
+ [instances, propPath]
10
+ );
11
+ const subscribe = useCallback(
12
+ (onStateChange) => {
13
+ if (instances == null || propPath == null)
14
+ return () => {
15
+ };
16
+ let unsubscribes = [];
17
+ const handleStateChange = () => {
18
+ resubscribe();
19
+ onStateChange();
20
+ };
21
+ const resubscribe = () => {
22
+ unsubscribes.forEach((unsubscribe) => unsubscribe());
23
+ const chain = getInstanceChainByPropPath(instances, propPath).filter(isNotNil);
24
+ unsubscribes = chain.map((instance) => instance.subscribe(handleStateChange));
25
+ };
26
+ resubscribe();
27
+ return () => unsubscribes.forEach((unsubscribe) => unsubscribe());
28
+ },
29
+ [instances, propPath]
30
+ );
31
+ const result = useSyncExternalStore(subscribe, getInstance, getInstance);
32
+ if (result) {
33
+ const foundKey = result.instanceKey;
34
+ if (foundKey.elementKey !== elementKey || foundKey.propPath != propPath) {
35
+ console.error("Mismatching control instance key: expected", instanceKey, " got", foundKey);
36
+ return null;
37
+ }
38
+ if (!(result instanceof instanceClass)) {
39
+ console.error(
40
+ `Unexpected control instance class: requested '${instanceClass.name}', found '${result.constructor.name}'`,
41
+ { instanceKey }
42
+ );
43
+ return null;
44
+ }
45
+ }
46
+ return result;
47
+ }
48
+ function getInstanceChainByPropPath(instances, propPath) {
49
+ const [parentProp, ...childPath] = propPath.split(".");
50
+ const parentInstance = instances[parentProp];
51
+ const getInstanceChain = (parent, childPath2) => parent == null || childPath2.length === 0 ? [parent ?? null] : [parent, ...getInstanceChain(parent.child(childPath2[0]), childPath2.slice(1))];
52
+ return getInstanceChain(parentInstance, childPath);
53
+ }
54
+ function getInstanceByPropPath(instances, propPath) {
55
+ return getInstanceChainByPropPath(instances, propPath).at(-1) ?? null;
56
+ }
57
+ export {
58
+ getInstanceByPropPath,
59
+ getInstanceChainByPropPath,
60
+ useControlInstance
61
+ };
62
+ //# sourceMappingURL=use-control-instance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-control-instance.ts"],"sourcesContent":["import { useCallback, useSyncExternalStore } from 'react'\nimport { type AnyControlInstance, type ControlInstanceKey, isNotNil } from '@makeswift/controls'\n\nimport { useControlInstances } from './use-control-instances'\n\ntype InstanceConstructor<T extends AnyControlInstance> = abstract new (...args: never[]) => T\n\nexport function useControlInstance<T extends AnyControlInstance>(\n instanceKey: ControlInstanceKey | undefined,\n instanceClass: InstanceConstructor<T>,\n): T | null {\n const { elementKey, propPath } = instanceKey ?? {}\n\n const instances = useControlInstances(elementKey)\n const getInstance = useCallback(\n () =>\n instances != null && propPath != null ? getInstanceByPropPath(instances, propPath) : null,\n [instances, propPath],\n )\n\n const subscribe = useCallback(\n (onStateChange: () => void) => {\n if (instances == null || propPath == null) return () => {}\n\n let unsubscribes: (() => void)[] = []\n\n // recompute the instance chain and resubscribe to its updates on every notification,\n // since a control's own update (e.g. a `ListControl` replacing its children) can replace\n // the instances further down the chain\n const handleStateChange = () => {\n resubscribe()\n onStateChange()\n }\n\n const resubscribe = () => {\n unsubscribes.forEach(unsubscribe => unsubscribe())\n\n const chain = getInstanceChainByPropPath(instances, propPath).filter(isNotNil)\n unsubscribes = chain.map(instance => instance.subscribe(handleStateChange))\n }\n\n resubscribe()\n\n return () => unsubscribes.forEach(unsubscribe => unsubscribe())\n },\n [instances, propPath],\n )\n\n const result = useSyncExternalStore(subscribe, getInstance, getInstance)\n\n if (result) {\n const foundKey = result.instanceKey\n if (foundKey.elementKey !== elementKey || foundKey.propPath != propPath) {\n console.error('Mismatching control instance key: expected', instanceKey, ' got', foundKey)\n return null\n }\n\n if (!(result instanceof instanceClass)) {\n console.error(\n `Unexpected control instance class: requested '${instanceClass.name}', found '${result.constructor.name}'`,\n { instanceKey },\n )\n\n return null\n }\n }\n\n return result\n}\n\nexport function getInstanceChainByPropPath(\n instances: Record<string, AnyControlInstance>,\n propPath: string,\n): (AnyControlInstance | null)[] {\n const [parentProp, ...childPath] = propPath.split('.')\n const parentInstance = instances[parentProp]\n\n const getInstanceChain = (\n parent: AnyControlInstance | undefined,\n childPath: string[],\n ): (AnyControlInstance | null)[] =>\n parent == null || childPath.length === 0\n ? [parent ?? null]\n : [parent, ...getInstanceChain(parent.child(childPath[0]), childPath.slice(1))]\n\n return getInstanceChain(parentInstance, childPath)\n}\n\nexport function getInstanceByPropPath(\n instances: Record<string, AnyControlInstance>,\n propPath: string,\n): AnyControlInstance | null {\n return getInstanceChainByPropPath(instances, propPath).at(-1) ?? null\n}\n"],"mappings":"AAAA,SAAS,aAAa,4BAA4B;AAClD,SAA2D,gBAAgB;AAE3E,SAAS,2BAA2B;AAI7B,SAAS,mBACd,aACA,eACU;AACV,QAAM,EAAE,YAAY,SAAS,IAAI,eAAe,CAAC;AAEjD,QAAM,YAAY,oBAAoB,UAAU;AAChD,QAAM,cAAc;AAAA,IAClB,MACE,aAAa,QAAQ,YAAY,OAAO,sBAAsB,WAAW,QAAQ,IAAI;A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,GAAGA,WAAU,MAAM,CAAC,CAAC,CAAC;AAElF,SAAO,iBAAiB,gBAAgB,SAAS;AACnD;AAEO,SAAS,sBACd,WACA,UAC2B;AAC3B,SAAO,2BAA2B,WAAW,QAAQ,EAAE,GAAG,EAAE,KAAK;AACnE;","names":["childPath"]}
@@ -0,0 +1,5 @@
1
+ import { useControlInstances } from "../components/control-instances-context";
2
+ export {
3
+ useControlInstances
4
+ };
5
+ //# sourceMappingURL=use-control-instances.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-control-instances.ts"],"sourcesContent":["export { useControlInstances } from '../components/control-instances-context'\n"],"mappings":"AAAA,SAAS,2BAA2B;","names":[]}
@@ -1,10 +1,10 @@
1
1
  import { createContext, useContext } from "react";
2
2
  const DisableRegisterElement = createContext(false);
3
- function useDisableRegisterElement() {
3
+ function useIsRegisterElementDisabled() {
4
4
  return useContext(DisableRegisterElement);
5
5
  }
6
6
  export {
7
7
  DisableRegisterElement,
8
- useDisableRegisterElement
8
+ useIsRegisterElementDisabled
9
9
  };
10
10
  //# sourceMappingURL=use-disable-register-element.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-disable-register-element.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nexport const DisableRegisterElement = createContext(false)\n\nexport function useDisableRegisterElement() {\n return useContext(DisableRegisterElement)\n}\n"],"mappings":"AAAA,SAAS,eAAe,kBAAkB;AAEnC,MAAM,yBAAyB,cAAc,KAAK;AAElD,SAAS,4BAA4B;AAC1C,SAAO,WAAW,sBAAsB;AAC1C;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-disable-register-element.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nexport const DisableRegisterElement = createContext(false)\n\nexport function useIsRegisterElementDisabled() {\n return useContext(DisableRegisterElement)\n}\n"],"mappings":"AAAA,SAAS,eAAe,kBAAkB;AAEnC,MAAM,yBAAyB,cAAc,KAAK;AAElD,SAAS,+BAA+B;AAC7C,SAAO,WAAW,sBAAsB;AAC1C;","names":[]}
@@ -2,30 +2,22 @@ import { useMemo, useEffect, useRef, useSyncExternalStore, useCallback } from "r
2
2
  import {
3
3
  mapValues
4
4
  } from "@makeswift/controls";
5
- import * as ReactPage from "../../../state/read-only-state";
6
5
  import { useResourceResolver } from "./use-resource-resolver";
7
- import { useDocumentKey } from "./use-document-context";
8
- import { useSelector } from "./use-selector";
9
- import { useStylesheetFactory } from "./use-stylesheet-factory";
10
- import { useResolvableRecord } from "./use-resolvable-record";
11
6
  import { propErrorHandlingProxy } from "../utils/prop-error-handling-proxy";
12
- function useControlInstances(elementKey) {
13
- const documentKey = useDocumentKey();
14
- return useSelector((state) => {
15
- if (documentKey == null)
16
- return null;
17
- return ReactPage.getPropControllers(state, { documentKey, elementKey });
18
- });
19
- }
20
- function useResolvedProps(propDefs, elementData, elementKey) {
21
- const stylesheetFactory = useStylesheetFactory();
7
+ import { useResolvableRecord } from "./use-resolvable-record";
8
+ function useResolvedProps({
9
+ elementKey,
10
+ propDefs,
11
+ propData,
12
+ controlInstances,
13
+ stylesheetFactory
14
+ }) {
22
15
  const resourceResolver = useResourceResolver();
23
- const controls = useControlInstances(elementKey);
24
16
  const cache = useRef({}).current;
25
17
  const resolveProp = useCallback(
26
18
  (def, propName) => {
27
- const data = elementData[propName];
28
- const control = controls?.[propName];
19
+ const data = propData[propName];
20
+ const control = controlInstances?.[propName];
29
21
  if (cache[propName] != null && data === cache[propName].data && control === cache[propName].control) {
30
22
  return cache[propName].resolvedValue;
31
23
  }
@@ -38,24 +30,26 @@ function useResolvedProps(propDefs, elementData, elementKey) {
38
30
  cache[propName] = { data, control, resolvedValue };
39
31
  return resolvedValue;
40
32
  },
41
- [controls, elementData, resourceResolver, stylesheetFactory]
33
+ [propData, cache, resourceResolver, controlInstances, stylesheetFactory]
42
34
  );
43
35
  const resolvables = useMemo(
44
36
  () => mapValues(propDefs, (def, propName) => {
45
37
  const defaultValue = def.config?.defaultValue;
46
38
  return propErrorHandlingProxy(resolveProp(def, propName), defaultValue, (error) => {
47
39
  console.warn(
48
- `Error reading value for prop "${propName}", falling back to \`${defaultValue}\`.`,
40
+ `Error reading value for prop "${propName}" of element ${elementKey}, falling back to \`${defaultValue}\`.`,
49
41
  { control: def, error }
50
42
  );
51
43
  });
52
44
  }),
53
- [propDefs, resolveProp]
45
+ [propDefs, resolveProp, elementKey]
54
46
  );
55
47
  const props = useResolvableRecord(resolvables);
56
48
  useEffect(() => {
57
- props.triggerResolve();
58
- }, [props]);
49
+ props.triggerResolve().catch((err) => {
50
+ console.log(`Error while resolving props for element ${elementKey}`, err);
51
+ });
52
+ }, [props, elementKey]);
59
53
  const resolvedProps = useSyncExternalStore(props.subscribe, props.readStable, props.readStable);
60
54
  stylesheetFactory.useDefinedStyles();
61
55
  return resolvedProps;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-resolved-props.ts"],"sourcesContent":["import { useMemo, useEffect, useRef, useSyncExternalStore, useCallback } from 'react'\nimport {\n ControlDefinition,\n ControlInstance,\n mapValues,\n type Data,\n type Resolvable,\n} from '@makeswift/controls'\n\nimport * as ReactPage from '../../../state/read-only-state'\nimport { useResourceResolver } from './use-resource-resolver'\nimport { useDocumentKey } from './use-document-context'\nimport { useSelector } from './use-selector'\n\nimport { useStylesheetFactory } from './use-stylesheet-factory'\n\nimport { useResolvableRecord } from './use-resolvable-record'\nimport { propErrorHandlingProxy } from '../utils/prop-error-handling-proxy'\n\nfunction useControlInstances(elementKey: string): Record<string, ControlInstance> | null {\n const documentKey = useDocumentKey()\n\n return useSelector(state => {\n if (documentKey == null) return null\n\n return ReactPage.getPropControllers(state, { documentKey, elementKey })\n })\n}\n\ntype CacheItem = {\n data: Data\n control: ControlInstance | undefined\n resolvedValue: Resolvable<unknown>\n}\n\nexport function useResolvedProps(\n propDefs: Record<string, ControlDefinition>,\n elementData: Record<string, Data>,\n elementKey: string,\n): Record<string, unknown> {\n const stylesheetFactory = useStylesheetFactory()\n const resourceResolver = useResourceResolver()\n const controls = useControlInstances(elementKey)\n\n const cache = useRef<Record<string, CacheItem>>({}).current\n const resolveProp = useCallback(\n (def: ControlDefinition, propName: string) => {\n const data = elementData[propName]\n const control = controls?.[propName]\n\n if (\n cache[propName] != null &&\n data === cache[propName].data &&\n control === cache[propName].control\n ) {\n return cache[propName].resolvedValue\n }\n\n const resolvedValue = def.resolveValue(\n data,\n resourceResolver,\n stylesheetFactory.get(propName),\n control,\n )\n\n cache[propName] = { data, control, resolvedValue }\n return resolvedValue\n },\n [controls, elementData, resourceResolver, stylesheetFactory],\n )\n\n const resolvables = useMemo<Record<string, Resolvable<unknown>>>(\n () =>\n mapValues(propDefs, (def, propName) => {\n const defaultValue = (def.config as any)?.defaultValue\n return propErrorHandlingProxy(resolveProp(def, propName), defaultValue, error => {\n console.warn(\n `Error reading value for prop \"${propName}\", falling back to \\`${defaultValue}\\`.`,\n { control: def, error },\n )\n })\n }),\n [propDefs, resolveProp],\n )\n\n const props = useResolvableRecord(resolvables)\n\n // no need to call `triggerResolve` on the server, all the resources should already be in\n // the host API client's cache (populated from the snapshot's cache)\n useEffect(() => {\n props.triggerResolve()\n }, [props])\n\n // the order is important here, the styles are defined in the process of the props resolution,\n // calling `useDefinedStyles` before the props are resolved would effectively be a noop\n const resolvedProps = useSyncExternalStore(props.subscribe, props.readStable, props.readStable)\n\n stylesheetFactory.useDefinedStyles()\n\n return resolvedProps\n}\n"],"mappings":"AAAA,SAAS,SAAS,WAAW,QAAQ,sBAAsB,mBAAmB;AAC9E;AAAA,EAGE;AAAA,OAGK;AAEP,YAAY,eAAe;AAC3B,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAE5B,SAAS,4BAA4B;AAErC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AAEvC,SAAS,oBAAoB,YAA4D;AACvF,QAAM,cAAc,eAAe;AAEnC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K,CAAC;AAIV,QAAM,gBAAgB,qBAAqB,MAAM,WAAW,MAAM,YAAY,MAAM,UAAU;AAE9F,oBAAkB,iBAAiB;AAEnC,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-resolved-props.ts"],"sourcesContent":["import { useMemo, useEffect, useRef, useSyncExternalStore, useCallback } from 'react'\nimport {\n ControlDefinition,\n ControlInstance,\n mapValues,\n type Data,\n type Resolvable,\n} from '@makeswift/controls'\n\nimport { useResourceResolver } from './use-resource-resolver'\n\nimport { type StylesheetFactory } from '../stylesheet-factory'\nimport { propErrorHandlingProxy } from '../utils/prop-error-handling-proxy'\n\nimport { useResolvableRecord } from './use-resolvable-record'\n\ntype CacheItem = {\n data: Data\n control: ControlInstance | undefined\n resolvedValue: Resolvable<unknown>\n}\n\nexport function useResolvedProps({\n elementKey,\n propDefs,\n propData,\n controlInstances,\n stylesheetFactory,\n}: {\n elementKey: string\n propDefs: Record<string, ControlDefinition>\n propData: Record<string, Data>\n controlInstances: Record<string, ControlInstance> | null\n stylesheetFactory: StylesheetFactory\n}): Record<string, unknown> {\n const resourceResolver = useResourceResolver()\n\n const cache = useRef<Record<string, CacheItem>>({}).current\n const resolveProp = useCallback(\n (def: ControlDefinition, propName: string) => {\n const data = propData[propName]\n const control = controlInstances?.[propName]\n\n if (\n cache[propName] != null &&\n data === cache[propName].data &&\n control === cache[propName].control\n ) {\n return cache[propName].resolvedValue\n }\n\n const resolvedValue = def.resolveValue(\n data,\n resourceResolver,\n stylesheetFactory.get(propName),\n control,\n )\n\n cache[propName] = { data, control, resolvedValue }\n return resolvedValue\n },\n [propData, cache, resourceResolver, controlInstances, stylesheetFactory],\n )\n\n const resolvables = useMemo<Record<string, Resolvable<unknown>>>(\n () =>\n mapValues(propDefs, (def, propName) => {\n const defaultValue = (def.config as any)?.defaultValue\n return propErrorHandlingProxy(resolveProp(def, propName), defaultValue, error => {\n console.warn(\n `Error reading value for prop \"${propName}\" of element ${elementKey}, falling back to \\`${defaultValue}\\`.`,\n { control: def, error },\n )\n })\n }),\n [propDefs, resolveProp, elementKey],\n )\n\n const props = useResolvableRecord(resolvables)\n\n // no need to call `triggerResolve` on the server, all the resources should already be in\n // the host API client's cache (populated from the snapshot's cache)\n useEffect(() => {\n props.triggerResolve().catch(err => {\n console.log(`Error while resolving props for element ${elementKey}`, err)\n })\n }, [props, elementKey])\n\n // the order is important here, the styles are defined in the process of the props resolution,\n // calling `useDefinedStyles` before the props are resolved would effectively be a noop\n const resolvedProps = useSyncExternalStore(props.subscribe, props.readStable, props.readStable)\n\n stylesheetFactory.useDefinedStyles()\n\n return resolvedProps\n}\n"],"mappings":"AAAA,SAAS,SAAS,WAAW,QAAQ,sBAAsB,mBAAmB;AAC9E;AAAA,EAGE;AAAA,OAGK;AAEP,SAAS,2BAA2B;AAGpC,SAAS,8BAA8B;AAEvC,SAAS,2BAA2B;AAQ7B,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAM4B;AAC1B,QAAM,mBAAmB,oBAAoB;AAE7C,QAAM,QAAQ,OAAkC,CAAC,CAAC,EAAE;AACpD,QAAM,cAAc;AAAA,IAClB,CAAC,KAAwB,aAAqB;AAC5C,YAAM,OAAO,SAAS,QAAQ;AAC9B,YAAM,UAAU,mBAAmB,QAAQ;AAE3C,UACE,MAAM,QAAQ,KAAK,QACnB,SAAS,MAAM,QAAQ,EAAE,QACzB,YAAY,MAAM,QAAQ,EAAE,SAC5B;AACA,eAAO,MAAM,QAAQ,EAAE;AAAA,MACzB;AAEA,YAAM,gBAAgB,IAAI;AAAA,QACxB;AAAA,QACA;AAAA,QACA,kBAAkB,IAAI,QAAQ;AAAA,QAC9B;AAAA,MACF;AAEA,YAAM,QAAQ,IAAI,EAAE,MAAM,SAAS,cAAc;AACjD,aAAO;AAAA,IACT;AAAA,IACA,CAAC,UAAU,OAAO,kBAAkB,kBAAkB,iBAAiB;AAAA,EACzE;AAEA,QAAM,cAAc;AAAA,IAClB,MACE,UAAU,UAAU,CAAC,KAAK,aAAa;AACrC,YAAM,eAAgB,IAAI,QAAgB;AAC1C,aAAO,uBAAuB,YAAY,KAAK,QAAQ,GAAG,cAAc,WAAS;AAC/E,gBAAQ;AAAA,UACN,iCAAiC,QAAQ,gBAAgB,UAAU,uBAAuB,YAAY;AAAA,UACtG,EAAE,SAAS,KAAK,MAAM;AAAA,QACxB;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,IACH,CAAC,UAAU,aAAa,UAAU;AAAA,EACpC;AAEA,QAAM,QAAQ,oBAAoB,WAAW;AAI7C,YAAU,MAAM;AACd,UAAM,eAAe,EAAE,MAAM,SAAO;AAClC,cAAQ,IAAI,2CAA2C,UAAU,IAAI,GAAG;AAAA,IAC1E,CAAC;AAAA,EACH,GAAG,CAAC,OAAO,UAAU,CAAC;AAItB,QAAM,gBAAgB,qBAAqB,MAAM,WAAW,MAAM,YAAY,MAAM,UAAU;AAE9F,oBAAkB,iBAAiB;AAEnC,SAAO;AACT;","names":[]}
@@ -3,12 +3,12 @@ import { serializeStyles } from "@emotion/serialize";
3
3
  import {
4
4
  isNotNil
5
5
  } from "@makeswift/controls";
6
- import { useCache } from "../root-style-registry";
7
6
  import { resolvedStyleToCss } from "../lib/resolved-style-to-css";
7
+ import { pollBoxModel } from "../poll-box-model";
8
+ import { useCache } from "../root-style-registry";
9
+ import { useStyles, serializedStyleClassName } from "../use-style";
8
10
  import { useBreakpoints } from "./use-breakpoints";
9
11
  import { useCssId } from "./use-css-id";
10
- import { useStyles, serializedStyleClassName } from "../use-style";
11
- import { pollBoxModel } from "../poll-box-model";
12
12
  function useStylesheetFactory() {
13
13
  const breakpoints = useBreakpoints();
14
14
  const cache = useCache();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-stylesheet-factory.ts"],"sourcesContent":["import { useMemo, useEffect, useRef } from 'react'\nimport { serializeStyles } from '@emotion/serialize'\nimport { type EmotionCache } from '@emotion/cache'\nimport { type SerializedStyles } from '@emotion/utils'\n\nimport {\n type BoxDisplayModel,\n type Breakpoints,\n type Stylesheet,\n type ResolvedStyle,\n isNotNil,\n} from '@makeswift/controls'\n\nimport { useCache } from '../root-style-registry'\nimport { resolvedStyleToCss } from '../lib/resolved-style-to-css'\n\nimport { useBreakpoints } from './use-breakpoints'\nimport { useCssId } from './use-css-id'\nimport { useStyles, serializedStyleClassName } from '../use-style'\nimport { pollBoxModel } from '../poll-box-model'\n\nexport type StylesheetFactory = {\n get(propName: string): Stylesheet\n useDefinedStyles(): void\n}\n\nexport function useStylesheetFactory(): StylesheetFactory {\n const breakpoints = useBreakpoints()\n const cache = useCache()\n const componentUid = useCssId()\n\n const computedStyles = useRef<Record<string, SerializedStyles>>({}).current\n const boxModelCallbacks = useRef<Record<string, (boxModel: BoxDisplayModel | null) => void>>(\n {},\n ).current\n\n return useMemo(() => {\n const getStylesheet = (styleSheetId: string): Stylesheet => ({\n breakpoints(): Breakpoints {\n return breakpoints\n },\n\n defineStyle(\n style: ResolvedStyle,\n onBoxModelChange?: (boxModel: BoxDisplayModel | null) => void,\n ): string {\n const serialized = serializeStyle(breakpoints, style, cache)\n const uid = `u-${componentUid}-${styleSheetId}`\n computedStyles[uid] = serialized\n\n const className = serializedStyleClassName(cache, serialized)\n if (!onBoxModelChange) return className\n\n boxModelCallbacks[uid] = onBoxModelChange\n return `${className} ${uid}`\n },\n\n child(id: string): Stylesheet {\n return getStylesheet(`${styleSheetId}-${id}`)\n },\n })\n\n return {\n get(propName: string): Stylesheet {\n return getStylesheet(propName)\n },\n\n useDefinedStyles() {\n useStyles(cache, Object.values(computedStyles))\n\n useEffect(() => {\n const unsubscribes = Object.entries(boxModelCallbacks)\n .map(([uid, callback]) =>\n callback != null\n ? pollBoxModel({\n element: document.querySelector(`.${uid}`),\n onBoxModelChange: callback,\n })\n : undefined,\n )\n .filter(isNotNil)\n\n return () => unsubscribes.forEach(fn => fn())\n }, [Object.keys(boxModelCallbacks).join(' ')])\n },\n }\n }, [breakpoints, cache, componentUid])\n}\n\nfunction serializeStyle(\n breakpoints: Breakpoints,\n style: ResolvedStyle,\n cache: EmotionCache,\n): SerializedStyles {\n const css = resolvedStyleToCss(breakpoints, style)\n return serializeStyles([css], cache.registered)\n}\n"],"mappings":"AAAA,SAAS,SAAS,WAAW,cAAc;AAC3C,SAAS,uBAAuB;AAIhC;AAAA,EAKE;AAAA,OACK;AAEP,SAAS,gBAAgB;AACzB,SAAS,0BAA0B;AAEnC,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AACzB,SAAS,WAAW,gCAAgC;AACpD,SAAS,oBAAoB;AAOtB,SAAS,uBAA0C;AACxD,QAAM,cAAc,eAAe;AACnC,QAAM,QAAQ,SAAS;AACvB,QAAM,eAAe,SAAS;AAE9B,QAAM,iBAAiB,OAAyC,CAAC,CAAC,EAAE;AACpE,QAAM,oBAAoB;AAAA,IACxB,CAAC;AAAA,EACH,EAAE;AAEF,SAAO,QAAQ,MAAM;AACnB,UAAM,gBAAgB,CAAC,kBAAsC;AAAA,MAC3D,cAA2B;AACzB,eAAO;AAAA,MACT;AAAA,MAEA,YACE,OACA,kBACQ;AACR,cAAM,aAAa,eAAe,aAAa,OAAO,KAAK;AAC3D,cAAM,MAAM,KAAK,YAAY,IAAI,YAAY;AAC7C,uBAAe,GAAG,IAAI;AAEtB,cAAM,YAAY,yBAAyB,OAAO,UAAU;AAC5D,YAAI,CAAC;AAAkB,iBAAO;AAE9B,0BAAkB,GAAG,IAAI;AACzB,eAAO,GAAG,SAAS,IAAI,GAAG;AAAA,MAC5B;AAAA,MAEA,MAAM,IAAwB;AAC5B,eAAO,cAAc,GAAG,YAAY,IAAI,EAAE,EAAE;AAAA,MAC9C;AAAA,IACF;AAEA,WAAO;AAAA,MACL,IAAI,UAA8B;AAChC,eAAO,cAAc,QAAQ;AAAA,MAC/B;AAAA,MAEA,mBAAmB;AACjB,kBAAU,OAAO,OAAO,OAAO,cAAc,CAAC;AAE9C,kBAAU,MAAM;AACd,gBAAM,eAAe,OAAO,QAAQ,iBAAiB,EAClD;AAAA,YAAI,CAAC,CAAC,KAAK,QAAQ,MAClB,YAAY,OACR,aAAa;AAAA,cACX,SAAS,SAAS,cAAc,IAAI,GAAG,EAAE;AAAA,cACzC,kBAAkB;AAAA,YACpB,CAAC,IACD;AAAA,UACN,EACC,OAAO,QAAQ;AAElB,iBAAO,MAAM,aAAa,QAAQ,QAAM,GAAG,CAAC;AAAA,QAC9C,GAAG,CAAC,OAAO,KAAK,iBAAiB,EAAE,KAAK,GAAG,CAAC,CAAC;AAAA,MAC/C;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,OAAO,YAAY,CAAC;AACvC;AAEA,SAAS,eACP,aACA,OACA,OACkB;AAClB,QAAM,MAAM,mBAAmB,aAAa,KAAK;AACjD,SAAO,gBAAgB,CAAC,GAAG,GAAG,MAAM,UAAU;AAChD;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-stylesheet-factory.ts"],"sourcesContent":["import { useMemo, useEffect, useRef } from 'react'\nimport { serializeStyles } from '@emotion/serialize'\nimport { type EmotionCache } from '@emotion/cache'\nimport { type SerializedStyles } from '@emotion/utils'\n\nimport {\n type BoxDisplayModel,\n type Breakpoints,\n type Stylesheet,\n type ResolvedStyle,\n isNotNil,\n} from '@makeswift/controls'\n\nimport { resolvedStyleToCss } from '../lib/resolved-style-to-css'\nimport { pollBoxModel } from '../poll-box-model'\nimport { useCache } from '../root-style-registry'\nimport { type StylesheetFactory } from '../stylesheet-factory'\nimport { useStyles, serializedStyleClassName } from '../use-style'\n\nimport { useBreakpoints } from './use-breakpoints'\nimport { useCssId } from './use-css-id'\n\nexport function useStylesheetFactory(): StylesheetFactory {\n const breakpoints = useBreakpoints()\n const cache = useCache()\n const componentUid = useCssId()\n\n const computedStyles = useRef<Record<string, SerializedStyles>>({}).current\n const boxModelCallbacks = useRef<Record<string, (boxModel: BoxDisplayModel | null) => void>>(\n {},\n ).current\n\n return useMemo(() => {\n const getStylesheet = (styleSheetId: string): Stylesheet => ({\n breakpoints(): Breakpoints {\n return breakpoints\n },\n\n defineStyle(\n style: ResolvedStyle,\n onBoxModelChange?: (boxModel: BoxDisplayModel | null) => void,\n ): string {\n const serialized = serializeStyle(breakpoints, style, cache)\n const uid = `u-${componentUid}-${styleSheetId}`\n computedStyles[uid] = serialized\n\n const className = serializedStyleClassName(cache, serialized)\n if (!onBoxModelChange) return className\n\n boxModelCallbacks[uid] = onBoxModelChange\n return `${className} ${uid}`\n },\n\n child(id: string): Stylesheet {\n return getStylesheet(`${styleSheetId}-${id}`)\n },\n })\n\n return {\n get(propName: string): Stylesheet {\n return getStylesheet(propName)\n },\n\n useDefinedStyles() {\n useStyles(cache, Object.values(computedStyles))\n\n useEffect(() => {\n const unsubscribes = Object.entries(boxModelCallbacks)\n .map(([uid, callback]) =>\n callback != null\n ? pollBoxModel({\n element: document.querySelector(`.${uid}`),\n onBoxModelChange: callback,\n })\n : undefined,\n )\n .filter(isNotNil)\n\n return () => unsubscribes.forEach(fn => fn())\n }, [Object.keys(boxModelCallbacks).join(' ')])\n },\n }\n }, [breakpoints, cache, componentUid])\n}\n\nfunction serializeStyle(\n breakpoints: Breakpoints,\n style: ResolvedStyle,\n cache: EmotionCache,\n): SerializedStyles {\n const css = resolvedStyleToCss(breakpoints, style)\n return serializeStyles([css], cache.registered)\n}\n"],"mappings":"AAAA,SAAS,SAAS,WAAW,cAAc;AAC3C,SAAS,uBAAuB;AAIhC;AAAA,EAKE;AAAA,OACK;AAEP,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AAEzB,SAAS,WAAW,gCAAgC;AAEpD,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AAElB,SAAS,uBAA0C;AACxD,QAAM,cAAc,eAAe;AACnC,QAAM,QAAQ,SAAS;AACvB,QAAM,eAAe,SAAS;AAE9B,QAAM,iBA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AK;AACjD,SAAO,gBAAgB,CAAC,GAAG,GAAG,MAAM,UAAU;AAChD;","names":[]}
@@ -21,13 +21,14 @@ class ReactRuntimeCore extends RuntimeCore {
21
21
  hidden = false,
22
22
  description,
23
23
  builtinSuspense,
24
+ unstable_migration,
24
25
  props
25
26
  }) {
26
27
  validateComponentType(type, component);
27
28
  const unregisterComponent = this.protoStore.dispatch(
28
29
  registerComponentEffect(
29
30
  type,
30
- { label, icon, hidden, description, builtinSuspense },
31
+ { label, icon, hidden, description, builtinSuspense, unstable_migration },
31
32
  props ?? {}
32
33
  )
33
34
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/runtimes/react/react-runtime-core.ts"],"sourcesContent":["import { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls'\n\nimport { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors'\n\nimport { supportsActivity } from './components/activity-with-fallback'\n\nimport {\n registerComponentEffect,\n registerReactComponentEffect,\n} from '../../state/actions/internal/read-only-actions'\n\nimport { ComponentIcon } from '../../state/modules/components-meta'\nimport type { ComponentType } from '../../state/read-only-state'\n\nimport { RuntimeCore } from './runtime-core'\n\nfunction validateComponentType(type: string, component?: ComponentType): void {\n const componentName = component?.name ?? 'Component'\n if (typeof type !== 'string' || type === '') {\n throw new Error(\n `${componentName}: A non-empty string \\`type\\` is required for component registration, got ${type}`,\n )\n }\n}\n\nexport class ReactRuntimeCore extends RuntimeCore {\n registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n C extends ComponentType<{ [K in keyof P]: DescriptorValueType<P[K]> }>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Cube,\n hidden = false,\n description,\n builtinSuspense,\n props,\n }: {\n type: string\n label: string\n icon?: ComponentIcon\n hidden?: boolean\n description?: string\n /**\n * In React <= 19.1, controls the default `<Suspense>` boundary.\n * Ignored in React >= 19.2; components are always wrapped in `<Activity>`.\n * Defaults to `true`.\n */\n builtinSuspense?: boolean\n props?: P\n },\n ): () => void {\n validateComponentType(type, component as unknown as ComponentType)\n\n const unregisterComponent = this.protoStore.dispatch(\n registerComponentEffect(\n type,\n { label, icon, hidden, description, builtinSuspense },\n props ?? {},\n ),\n )\n\n if (supportsActivity() && builtinSuspense !== undefined) {\n console.warn(\n 'builtinSuspense is ignored in React >= 19.2; components are always wrapped in <Activity>.',\n )\n }\n\n const unregisterReactComponent = this.protoStore.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n}\n"],"mappings":"AAIA,SAAS,wBAAwB;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,qBAAqB;AAG9B,SAAS,mBAAmB;AAE5B,SAAS,sBAAsB,MAAc,WAAiC;AAC5E,QAAM,gBAAgB,WAAW,QAAQ;AACzC,MAAI,OAAO,SAAS,YAAY,SAAS,IAAI;AAC3C,UAAM,IAAI;AAAA,MACR,GAAG,aAAa,6EAA6E,IAAI;AAAA,IACnG;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,YAAY;AAAA,EAChD,kBAKE,WACA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO,cAAc;AAAA,IACrB,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAcY;AACZ,0BAAsB,MAAM,SAAqC;AAEjE,UAAM,sBAAsB,KAAK,WAAW;AAAA,MAC1C;AAAA,QACE;AAAA,QACA,EAAE,OAAO,MAAM,QAAQ,aAAa,gBAAgB;AAAA,QACpD,SAAS,CAAC;AAAA,MACZ;AAAA,IACF;AAEA,QAAI,iBAAiB,KAAK,oBAAoB,QAAW;AACvD,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAEA,UAAM,2BAA2B,KAAK,WAAW;AAAA,MAC/C,6BAA6B,MAAM,SAAqC;AAAA,IAC1E;AAEA,WAAO,MAAM;AACX,0BAAoB;AACpB,+BAAyB;AAAA,IAC3B;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/runtimes/react/react-runtime-core.ts"],"sourcesContent":["import { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls'\n\nimport { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors'\n\nimport { supportsActivity } from './components/activity-with-fallback'\n\nimport {\n registerComponentEffect,\n registerReactComponentEffect,\n} from '../../state/actions/internal/read-only-actions'\n\nimport { ComponentIcon } from '../../state/modules/components-meta'\nimport type { ComponentType } from '../../state/read-only-state'\n\nimport { RuntimeCore } from './runtime-core'\n\nfunction validateComponentType(type: string, component?: ComponentType): void {\n const componentName = component?.name ?? 'Component'\n if (typeof type !== 'string' || type === '') {\n throw new Error(\n `${componentName}: A non-empty string \\`type\\` is required for component registration, got ${type}`,\n )\n }\n}\n\nexport class ReactRuntimeCore extends RuntimeCore {\n registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n C extends ComponentType<{ [K in keyof P]: DescriptorValueType<P[K]> }>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Cube,\n hidden = false,\n description,\n builtinSuspense,\n unstable_migration,\n props,\n }: {\n type: string\n label: string\n icon?: ComponentIcon\n hidden?: boolean\n description?: string\n /**\n * In React <= 19.1, controls the default `<Suspense>` boundary.\n * Ignored in React >= 19.2; components are always wrapped in `<Activity>`.\n * Defaults to `true`.\n */\n builtinSuspense?: boolean\n /**\n * Marks this registration as superseded by `replacementType`. When\n * `replacementType` differs from `type`, the builder offers a way to\n * update existing instances.\n */\n unstable_migration?: { replacementType: string }\n props?: P\n },\n ): () => void {\n validateComponentType(type, component as unknown as ComponentType)\n\n const unregisterComponent = this.protoStore.dispatch(\n registerComponentEffect(\n type,\n { label, icon, hidden, description, builtinSuspense, unstable_migration },\n props ?? {},\n ),\n )\n\n if (supportsActivity() && builtinSuspense !== undefined) {\n console.warn(\n 'builtinSuspense is ignored in React >= 19.2; components are always wrapped in <Activity>.',\n )\n }\n\n const unregisterReactComponent = this.protoStore.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n}\n"],"mappings":"AAIA,SAAS,wBAAwB;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,qBAAqB;AAG9B,SAAS,mBAAmB;AAE5B,SAAS,sBAAsB,MAAc,WAAiC;AAC5E,QAAM,gBAAgB,WAAW,QAAQ;AACzC,MAAI,OAAO,SAAS,YAAY,SAAS,IAAI;AAC3C,UAAM,IAAI;AAAA,MACR,GAAG,aAAa,6EAA6E,IAAI;AAAA,IACnG;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,YAAY;AAAA,EAChD,kBAKE,WACA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO,cAAc;AAAA,IACrB,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAoBY;AACZ,0BAAsB,MAAM,SAAqC;AAEjE,UAAM,sBAAsB,KAAK,WAAW;AAAA,MAC1C;AAAA,QACE;AAAA,QACA,EAAE,OAAO,MAAM,QAAQ,aAAa,iBAAiB,mBAAmB;AAAA,QACxE,SAAS,CAAC;AAAA,MACZ;AAAA,IACF;AAEA,QAAI,iBAAiB,KAAK,oBAAoB,QAAW;AACvD,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAEA,UAAM,2BAA2B,KAAK,WAAW;AAAA,MAC/C,6BAA6B,MAAM,SAAqC;AAAA,IAC1E;AAEA,WAAO,MAAM;AACX,0BAAoB;AACpB,+BAAyB;AAAA,IAC3B;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=stylesheet-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,3 @@
1
+ export * from "./react-provider";
2
+ export * from "./react-runtime";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/testing/index.ts"],"sourcesContent":["export * from './react-provider'\nexport * from './react-runtime'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { RuntimeProvider } from "../components/RuntimeProvider";
3
+ import { DefaultRootStyleRegistry } from "../root-style-registry";
4
+ function ReactProvider({
5
+ children,
6
+ runtime,
7
+ siteVersion = null
8
+ }) {
9
+ return /* @__PURE__ */ jsx(RuntimeProvider, { siteVersion, runtime, children: /* @__PURE__ */ jsx(DefaultRootStyleRegistry, { children }) });
10
+ }
11
+ export {
12
+ ReactProvider
13
+ };
14
+ //# sourceMappingURL=react-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/testing/react-provider.tsx"],"sourcesContent":["import { type ReactRuntimeCore } from '../react-runtime-core'\nimport { RuntimeProvider } from '../components/RuntimeProvider'\n\nimport { DefaultRootStyleRegistry } from '../root-style-registry'\nimport { SiteVersion } from '../../../api/site-version'\n\nexport function ReactProvider({\n children,\n runtime,\n siteVersion = null,\n}: {\n children: React.ReactNode\n runtime: ReactRuntimeCore\n siteVersion?: SiteVersion | null\n}) {\n return (\n <RuntimeProvider siteVersion={siteVersion} runtime={runtime}>\n <DefaultRootStyleRegistry>{children}</DefaultRootStyleRegistry>\n </RuntimeProvider>\n )\n}\n"],"mappings":"AAiBM;AAhBN,SAAS,uBAAuB;AAEhC,SAAS,gCAAgC;AAGlC,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAIG;AACD,SACE,oBAAC,mBAAgB,aAA0B,SACzC,8BAAC,4BAA0B,UAAS,GACtC;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/slate/TypographyPlugin/normalizeTypographyUp.ts"],"sourcesContent":["import { Editor, Element, NodeEntry, Transforms, Node, Text } from 'slate'\nimport { RichTextTypography } from '@makeswift/controls'\n\nimport { MakeswiftEditor } from '../types'\nimport keys from '../../utils/keys'\nimport deepEqual from '../../utils/deepEqual'\nimport { shallowMergeTypographies } from './normalizeTypographyDown'\n\nfunction shallowAnd<A extends Record<string, unknown>, B extends Record<string, unknown>>(\n a: A,\n b: B,\n): A & B {\n const bKeys = keys(b)\n const aPrime = { ...a } as A & B\n const and = {} as A & B\n\n bKeys.forEach(key => {\n if (deepEqual(aPrime[key], b[key])) and[key] = aPrime[key]\n })\n\n return and\n}\n\nfunction shallowAndTypographies(...typographies: RichTextTypography[]): RichTextTypography {\n return {\n id: typographies.every(typography => typography?.id === typographies.at(0)?.id)\n ? typographies.at(0)?.id\n : undefined,\n style: [\n ...new Set(\n typographies.flatMap(typography => typography?.style.map(node => node.deviceId) ?? []),\n ),\n ].flatMap(deviceId => {\n const stylesForThisDevice = typographies\n .map(typography => typography.style.find(s => s.deviceId === deviceId)?.value)\n .filter((typography): typography is RichTextTypography['style'][number]['value'] =>\n Boolean(typography),\n )\n\n if (typographies.length !== stylesForThisDevice.length) return []\n\n const value = stylesForThisDevice.reduce(\n (acc, curr) => {\n return shallowAnd(acc, curr)\n },\n stylesForThisDevice.at(0) as RichTextTypography['style'][number]['value'],\n )\n\n if (value == null || Object.keys(value).length === 0) {\n return []\n }\n\n return [\n {\n deviceId,\n value,\n },\n ]\n }),\n }\n}\n\nfunction shallowInverseAnd<A extends Record<string, unknown>, B extends Record<string, unknown>>(\n a: A,\n b: B,\n): A & B {\n const bKeys = Array.from(new Set([...keys(b), ...keys(a)]))\n const aPrime = { ...a } as A & B\n const bPrime = { ...b } as A & B\n const xor = {} as A & B\n\n bKeys.forEach(key => {\n if (!deepEqual(aPrime[key], bPrime[key as any])) xor[key] = aPrime[key]\n })\n\n return xor\n}\n\nfunction shallowInverseAndTypographies(\n a: RichTextTypography,\n b: RichTextTypography,\n): RichTextTypography {\n const typography = { style: [] } as RichTextTypography\n if (a?.id !== b.id) {\n typography.id = a?.id\n }\n\n if (a && a.style.length > 0) {\n const styles: RichTextTypography['style'] = []\n for (const style of a.style) {\n const bDeviceTypography = b.style.find(s => s.deviceId === style.deviceId)\n if (bDeviceTypography == null) {\n styles.push(style)\n } else {\n const uniquePropertiesOfA = shallowInverseAnd(style.value, bDeviceTypography.value)\n\n if (Object.keys(uniquePropertiesOfA).length > 0) {\n styles.push({\n deviceId: style.deviceId,\n value: uniquePropertiesOfA,\n })\n }\n }\n }\n typography.style = styles\n }\n\n return typography\n}\n\n/**\n * If a text is empty then don't include it in our comparison.\n */\nfunction isException(node: Node): boolean {\n return Text.isText(node) && node.text === ''\n}\n\nexport function normalizeTypographyUp(editor: MakeswiftEditor, entry: NodeEntry): boolean {\n const [node, path] = entry\n if (Element.isElement(node) && node.children.length) {\n const typographiesOfChildren = node.children\n .filter(child => !isException(child))\n .map(child => child.typography)\n\n const definedTypographiesOfChildren = typographiesOfChildren.filter(\n (typography): typography is RichTextTypography => Boolean(typography),\n )\n if (typographiesOfChildren.length === definedTypographiesOfChildren.length) {\n let sharedTypography: RichTextTypography = shallowAndTypographies(\n ...definedTypographiesOfChildren,\n )\n\n if (sharedTypography.style.length > 0 || sharedTypography.id != null) {\n const rootTypography: RichTextTypography = shallowMergeTypographies(\n sharedTypography,\n node.typography,\n )\n Editor.withoutNormalizing(editor, () => {\n Transforms.setNodes(editor, { typography: rootTypography }, { at: path })\n for (let i = 0; i < node.children.length; i++) {\n const typography: RichTextTypography = shallowInverseAndTypographies(\n node.children.at(i)?.typography ?? { style: [] },\n sharedTypography,\n )\n\n Transforms.setNodes(editor, { typography }, { at: [...path, i] })\n }\n })\n return true\n }\n }\n }\n return false\n}\n"],"mappings":"AAAA,SAAS,QAAQ,SAAoB,YAAkB,YAAY;AAInE,OAAO,UAAU;AACjB,OAAO,eAAe;AACtB,SAAS,gCAAgC;AAEzC,SAAS,WACP,GACA,GACO;AACP,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,uBAAuB;AAAA,MAC3D,CAAC,eAAiD,QAAQ,UAAU;AAAA,IACtE;AACA,QAAI,uBAAuB,WAAW,8BAA8B,QAAQ;AAC1E,UAAI,mBAAuC;AAAA,QACzC,GAAG;AAAA,MACL;AAEA,UAAI,iBAAiB,MAAM,SAAS,KAAK,iBAAiB,MAAM,MAAM;AACpE,cAAM,iBAAqC;AAAA,UACzC;AAAA,UACA,KAAK;AAAA,QACP;AACA,eAAO,mBAAmB,QAAQ,MAAM;AACtC,qBAAW,SAAS,QAAQ,EAAE,YAAY,eAAe,GAAG,EAAE,IAAI,KAAK,CAAC;AACxE,mBAAS,IAAI,GAAG,IAAI,KAAK,SAAS,QAAQ,KAAK;AAC7C,kBAAM,aAAiC;AAAA,cACrC,KAAK,SAAS,GAAG,CAAC,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE;AAAA,cAC/C;AAAA,YACF;AAEA,uBAAW,SAAS,QAAQ,EAAE,WAAW,GAAG,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC;AAAA,UAClE;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/slate/TypographyPlugin/normalizeTypographyUp.ts"],"sourcesContent":["import { Editor, Element, NodeEntry, Transforms, Node, Text } from 'slate'\nimport { type Data, RichTextTypography } from '@makeswift/controls'\n\nimport { MakeswiftEditor } from '../types'\nimport keys from '../../utils/keys'\nimport deepEqual from '../../utils/deepEqual'\nimport { shallowMergeTypographies } from './normalizeTypographyDown'\n\nfunction shallowAnd<A extends Record<string, Data>, B extends Record<string, Data>>(\n a: A,\n b: B,\n): A & B {\n const bKeys = keys(b)\n const aPrime = { ...a } as A & B\n const and = {} as A & B\n\n bKeys.forEach(key => {\n if (deepEqual(aPrime[key], b[key])) and[key] = aPrime[key]\n })\n\n return and\n}\n\nfunction shallowAndTypographies(...typographies: RichTextTypography[]): RichTextTypography {\n return {\n id: typographies.every(typography => typography?.id === typographies.at(0)?.id)\n ? typographies.at(0)?.id\n : undefined,\n style: [\n ...new Set(\n typographies.flatMap(typography => typography?.style.map(node => node.deviceId) ?? []),\n ),\n ].flatMap(deviceId => {\n const stylesForThisDevice = typographies\n .map(typography => typography.style.find(s => s.deviceId === deviceId)?.value)\n .filter((typography): typography is RichTextTypography['style'][number]['value'] =>\n Boolean(typography),\n )\n\n if (typographies.length !== stylesForThisDevice.length) return []\n\n const value = stylesForThisDevice.reduce(\n (acc, curr) => {\n return shallowAnd(acc, curr)\n },\n stylesForThisDevice.at(0) as RichTextTypography['style'][number]['value'],\n )\n\n if (value == null || Object.keys(value).length === 0) {\n return []\n }\n\n return [\n {\n deviceId,\n value,\n },\n ]\n }),\n }\n}\n\nfunction shallowInverseAnd<A extends Record<string, Data>, B extends Record<string, Data>>(\n a: A,\n b: B,\n): A & B {\n const bKeys = Array.from(new Set([...keys(b), ...keys(a)]))\n const aPrime = { ...a } as A & B\n const bPrime = { ...b } as A & B\n const xor = {} as A & B\n\n bKeys.forEach(key => {\n if (!deepEqual(aPrime[key], bPrime[key])) xor[key] = aPrime[key]\n })\n\n return xor\n}\n\nfunction shallowInverseAndTypographies(\n a: RichTextTypography,\n b: RichTextTypography,\n): RichTextTypography {\n const typography = { style: [] } as RichTextTypography\n if (a?.id !== b.id) {\n typography.id = a?.id\n }\n\n if (a && a.style.length > 0) {\n const styles: RichTextTypography['style'] = []\n for (const style of a.style) {\n const bDeviceTypography = b.style.find(s => s.deviceId === style.deviceId)\n if (bDeviceTypography == null) {\n styles.push(style)\n } else {\n const uniquePropertiesOfA = shallowInverseAnd(style.value, bDeviceTypography.value)\n\n if (Object.keys(uniquePropertiesOfA).length > 0) {\n styles.push({\n deviceId: style.deviceId,\n value: uniquePropertiesOfA,\n })\n }\n }\n }\n typography.style = styles\n }\n\n return typography\n}\n\n/**\n * If a text is empty then don't include it in our comparison.\n */\nfunction isException(node: Node): boolean {\n return Text.isText(node) && node.text === ''\n}\n\nexport function normalizeTypographyUp(editor: MakeswiftEditor, entry: NodeEntry): boolean {\n const [node, path] = entry\n if (Element.isElement(node) && node.children.length) {\n const typographiesOfChildren = node.children\n .filter(child => !isException(child))\n .map(child => child.typography)\n\n const definedTypographiesOfChildren = typographiesOfChildren.filter(\n (typography): typography is RichTextTypography => Boolean(typography),\n )\n if (typographiesOfChildren.length === definedTypographiesOfChildren.length) {\n let sharedTypography: RichTextTypography = shallowAndTypographies(\n ...definedTypographiesOfChildren,\n )\n\n if (sharedTypography.style.length > 0 || sharedTypography.id != null) {\n const rootTypography: RichTextTypography = shallowMergeTypographies(\n sharedTypography,\n node.typography,\n )\n Editor.withoutNormalizing(editor, () => {\n Transforms.setNodes(editor, { typography: rootTypography }, { at: path })\n for (let i = 0; i < node.children.length; i++) {\n const typography: RichTextTypography = shallowInverseAndTypographies(\n node.children.at(i)?.typography ?? { style: [] },\n sharedTypography,\n )\n\n Transforms.setNodes(editor, { typography }, { at: [...path, i] })\n }\n })\n return true\n }\n }\n }\n return false\n}\n"],"mappings":"AAAA,SAAS,QAAQ,SAAoB,YAAkB,YAAY;AAInE,OAAO,UAAU;AACjB,OAAO,eAAe;AACtB,SAAS,gCAAgC;AAEzC,SAAS,WACP,GACA,GACO;AACP,QAAM,QAAQ,KAAK,CAAC;AACpB,QAAM,SAAS,EAAE,GAAG,EAAE;AACtB,QAAM,MAAM,CAAC;AAEb,QAAM,QAAQ,SAAO;AACnB,QAAI,UAAU,OAAO,GAAG,GAAG,EAAE,GAAG,CAAC;AAAG,UAAI,GAAG,IAAI,OAAO,GAAG;AAAA,EAC3D,CAAC;AAED,SAAO;AACT;AAEA,SAAS,0BAA0B,cAAwD;AACzF,SAAO;AAAA,IACL,IAAI,aAAa,MAAM,gBAAc,YAAY,OAAO,aAAa,GAAG,CAAC,GAAG,EAAE,IAC1E,aAAa,GAAG,CAAC,GAAG,KACpB;AAAA,IACJ,OAAO;AAAA,MACL,GAAG,IAAI;AAAA,Q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7C,kBAAM,aAAiC;AAAA,cACrC,KAAK,SAAS,GAAG,CAAC,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE;AAAA,cAC/C;AAAA,YACF;AAEA,uBAAW,SAAS,QAAQ,EAAE,WAAW,GAAG,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC;AAAA,UAClE;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/slate/selectors.ts"],"sourcesContent":["import { Editor, NodeEntry, Range, Text } from 'slate'\nimport {\n type Breakpoints,\n type BreakpointId,\n findBreakpointOverride,\n Slate,\n} from '@makeswift/controls'\n\nimport { EditableBlockKey } from './BlockPlugin/types'\n\nimport unhangRange from './utils/unhangRange'\nimport shallowEqual from '../utils/shallowEqual'\nimport { isNonNullable } from '../utils/isNonNullable'\n\nimport deepEqual from '../utils/deepEqual'\nimport keys from '../utils/keys'\n\nexport function getSelection(editor: Editor): Range {\n if (editor.selection) return unhangRange(editor, editor.selection)\n return {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n }\n}\n\nexport function getBlocksInSelection(editor: Editor): NodeEntry<Slate.RootBlock>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Slate.isRootBlock(node),\n }),\n ).filter((entry): entry is NodeEntry<Slate.RootBlock> => Slate.isRootBlock(entry[0]))\n}\n\nexport function getInlinesInSelection(editor: Editor): NodeEntry<Slate.Inline>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Slate.isInline(node),\n }),\n ).filter((entry): entry is NodeEntry<Slate.Inline> => Slate.isInline(entry[0]))\n}\n\nexport function getActiveBlockType(editor: Editor): Slate.RootBlockType | null {\n const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type)\n\n return rootBlocks.reduce<Slate.RootBlockType | null>(\n (a, b) => (a === b ? b : null),\n rootBlocks.at(0) ?? null,\n )\n}\n\nexport function getActiveBlockValue(editor: Editor, key: EditableBlockKey) {\n const blocks = getBlocksInSelection(editor)\n\n const active = blocks.map(\n ([block]) => block[key] ?? null,\n ) as (Slate.ResponsiveBlockTextAlignment | null)[]\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\nexport function getActiveBlockDeviceOverrideValue(\n editor: Editor,\n key: EditableBlockKey,\n breakpoints: Breakpoints,\n deviceId: BreakpointId,\n) {\n const active: (Slate.BlockTextAlignment | null)[] = []\n const blocks = getBlocksInSelection(editor)\n\n blocks.forEach(([block]) => {\n const deviceOverride =\n findBreakpointOverride<Slate.BlockTextAlignment>(breakpoints, block[key], deviceId) || null\n active.push(deviceOverride?.value ?? null)\n })\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\n// Typography\n\nconst concat = (a: unknown[], b: unknown[]) => a.concat(b)\n\n// TODO: This is more cruft from trying to remove null from the typography type. This optimization is not worth it.\n/**\n * This is a c/p of the intersection of the utils from the root utils folder.\n * The only change is defaulting to undefined instead of to null.\n */\nexport default function intersection<A extends Record<string, unknown>, B extends A>(\n a: A,\n b: B,\n isEqual: (a: unknown, b: unknown) => boolean = deepEqual,\n): { [K in keyof A]: A[K] | undefined } {\n const allKeys = [...new Set([...keys(a), ...keys(b)])] as (keyof A)[]\n\n return allKeys.reduce(\n (acc, k) => {\n if (isEqual(a[k], b[k])) acc[k] = a[k]\n else acc[k] = undefined\n\n return acc\n },\n {} as { [K in keyof A]: A[K] | undefined },\n )\n}\n\nconst fuseTypographyMarks = (\n values: Array<Slate.Typography | null | undefined>,\n breakpoints: Breakpoints,\n): Slate.Typography => {\n const devices = [\n ...new Set(\n values\n .filter(isNonNullable)\n .map(({ style }) => style.map(({ deviceId }) => deviceId))\n .reduce(concat, []),\n ),\n ] as BreakpointId[]\n\n return {\n id: values.map(v => v && v.id).reduce((a, b) => (a === b ? a : undefined)) ?? undefined,\n style: devices.map(deviceId =>\n values\n .map(\n v =>\n (v && findBreakpointOverride(breakpoints, v.style, deviceId)) || {\n deviceId,\n value: {},\n },\n )\n .reduce((acc, { value }) => {\n const a = intersection(acc.value, value)\n return {\n deviceId,\n value: a,\n }\n }),\n ),\n }\n}\n\nexport function getActiveTypographyMark(\n editor: Editor,\n breakpoints: Breakpoints,\n): Slate.Typography {\n const active: Slate.Typography[] = []\n\n const textNodes = Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Text.isText(node),\n })\n\n for (const [node] of textNodes) {\n if (Text.isText(node) && 'typography' in node && node.typography != undefined) {\n active.push(node.typography)\n }\n }\n return active.length === 0 ? { style: [] } : fuseTypographyMarks(active, breakpoints)\n}\n"],"mappings":"AAAA,SAAS,QAA0B,YAAY;AAC/C;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAIP,OAAO,iBAAiB;AACxB,OAAO,kBAAkB;AACzB,SAAS,qBAAqB;AAE9B,OAAO,eAAe;AACtB,OAAO,UAAU;AAEV,SAAS,aAAa,QAAuB;AAClD,MAAI,OAAO;AAAW,WAAO,YAAY,QAAQ,OAAO,SAAS;AACjE,SAAO;AAAA,IACL,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AACF;AAEO,SAAS,qBAAqB,QAA8C;AACjF,SAAO,MAAM;AAAA,IACX,OAAO,MAAM,QAAQ;AAAA,MACnB,IAAI,aAAa,MAAM;AAAA,MACvB,OAAO,UAAQ,MAAM,YAAY,IAAI;AAAA,IACvC,CAAC;AAAA,EACH,EAAE,OAAO,CAAC,UAA+C,MAAM,YAAY,MAAM,CAAC,CAAC,CAAC;AACtF;AAEO,SAAS,sBAAsB,QAA2C;AAC/E,SAAO,MAAM;AAAA,IACX,OAAO,MAAM,QAAQ;AAAA,MACnB,IAAI,aAAa,MAAM;AAAA,MACvB,OAAO,UAAQ,MAAM,S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A,EACF;AACA,SAAO,OAAO,WAAW,IAAI,EAAE,OAAO,CAAC,EAAE,IAAI,oBAAoB,QAAQ,WAAW;AACtF;","names":[]}
1
+ {"version":3,"sources":["../../../src/slate/selectors.ts"],"sourcesContent":["import { Editor, NodeEntry, Range, Text } from 'slate'\nimport {\n type Breakpoints,\n type BreakpointId,\n type Data,\n findBreakpointOverride,\n Slate,\n} from '@makeswift/controls'\n\nimport { EditableBlockKey } from './BlockPlugin/types'\n\nimport unhangRange from './utils/unhangRange'\nimport shallowEqual from '../utils/shallowEqual'\nimport { isNonNullable } from '../utils/isNonNullable'\n\nimport deepEqual from '../utils/deepEqual'\nimport keys from '../utils/keys'\n\nexport function getSelection(editor: Editor): Range {\n if (editor.selection) return unhangRange(editor, editor.selection)\n return {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n }\n}\n\nexport function getBlocksInSelection(editor: Editor): NodeEntry<Slate.RootBlock>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Slate.isRootBlock(node),\n }),\n ).filter((entry): entry is NodeEntry<Slate.RootBlock> => Slate.isRootBlock(entry[0]))\n}\n\nexport function getInlinesInSelection(editor: Editor): NodeEntry<Slate.Inline>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Slate.isInline(node),\n }),\n ).filter((entry): entry is NodeEntry<Slate.Inline> => Slate.isInline(entry[0]))\n}\n\nexport function getActiveBlockType(editor: Editor): Slate.RootBlockType | null {\n const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type)\n\n return rootBlocks.reduce<Slate.RootBlockType | null>(\n (a, b) => (a === b ? b : null),\n rootBlocks.at(0) ?? null,\n )\n}\n\nexport function getActiveBlockValue(editor: Editor, key: EditableBlockKey) {\n const blocks = getBlocksInSelection(editor)\n\n const active = blocks.map(\n ([block]) => block[key] ?? null,\n ) as (Slate.ResponsiveBlockTextAlignment | null)[]\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\nexport function getActiveBlockDeviceOverrideValue(\n editor: Editor,\n key: EditableBlockKey,\n breakpoints: Breakpoints,\n deviceId: BreakpointId,\n) {\n const active: (Slate.BlockTextAlignment | null)[] = []\n const blocks = getBlocksInSelection(editor)\n\n blocks.forEach(([block]) => {\n const deviceOverride =\n findBreakpointOverride<Slate.BlockTextAlignment>(breakpoints, block[key], deviceId) || null\n active.push(deviceOverride?.value ?? null)\n })\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\n// Typography\n\nconst concat = (a: unknown[], b: unknown[]) => a.concat(b)\n\n// TODO: This is more cruft from trying to remove null from the typography type. This optimization is not worth it.\n/**\n * This is a c/p of the intersection of the utils from the root utils folder.\n * The only change is defaulting to undefined instead of to null.\n */\nexport default function intersection<A extends Record<string, Data>, B extends A>(\n a: A,\n b: B,\n isEqual: (a: Data, b: Data) => boolean = deepEqual,\n): { [K in keyof A]: A[K] | undefined } {\n const allKeys = [...new Set([...keys(a), ...keys(b)])] as (keyof A)[]\n\n return allKeys.reduce(\n (acc, k) => {\n if (isEqual(a[k], b[k])) acc[k] = a[k]\n else acc[k] = undefined\n\n return acc\n },\n {} as { [K in keyof A]: A[K] | undefined },\n )\n}\n\nconst fuseTypographyMarks = (\n values: Array<Slate.Typography | null | undefined>,\n breakpoints: Breakpoints,\n): Slate.Typography => {\n const devices = [\n ...new Set(\n values\n .filter(isNonNullable)\n .map(({ style }) => style.map(({ deviceId }) => deviceId))\n .reduce(concat, []),\n ),\n ] as BreakpointId[]\n\n return {\n id: values.map(v => v && v.id).reduce((a, b) => (a === b ? a : undefined)) ?? undefined,\n style: devices.map(deviceId =>\n values\n .map(\n v =>\n (v && findBreakpointOverride(breakpoints, v.style, deviceId)) || {\n deviceId,\n value: {},\n },\n )\n .reduce((acc, { value }) => {\n const a = intersection(acc.value, value)\n return {\n deviceId,\n value: a,\n }\n }),\n ),\n }\n}\n\nexport function getActiveTypographyMark(\n editor: Editor,\n breakpoints: Breakpoints,\n): Slate.Typography {\n const active: Slate.Typography[] = []\n\n const textNodes = Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Text.isText(node),\n })\n\n for (const [node] of textNodes) {\n if (Text.isText(node) && 'typography' in node && node.typography != undefined) {\n active.push(node.typography)\n }\n }\n return active.length === 0 ? { style: [] } : fuseTypographyMarks(active, breakpoints)\n}\n"],"mappings":"AAAA,SAAS,QAA0B,YAAY;AAC/C;AAAA,EAIE;AAAA,EACA;AAAA,OACK;AAIP,OAAO,iBAAiB;AACxB,OAAO,kBAAkB;AACzB,SAAS,qBAAqB;AAE9B,OAAO,eAAe;AACtB,OAAO,UAAU;AAEV,SAAS,aAAa,QAAuB;AAClD,MAAI,OAAO;AAAW,WAAO,YAAY,QAAQ,OAAO,SAAS;AACjE,SAAO;AAAA,IACL,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AACF;AAEO,SAAS,qBAAqB,QAA8C;AACjF,SAAO,MAAM;AAAA,IACX,OAAO,MAAM,QAAQ;AAAA,MACnB,IAAI,aAAa,MAAM;AAAA,MACvB,OAAO,UAAQ,MAAM,YAAY,IAAI;AAAA,IACvC,CAAC;AAAA,EACH,EAAE,OAAO,CAAC,UAA+C,MAAM,YAAY,MAAM,CAAC,CAAC,CAAC;AACtF;AAEO,SAAS,sBAAsB,QAA2C;AAC/E,SAAO,MAAM;AAAA,IACX,OAAO,MAAM,QAAQ;AAAA,MACnB,IAAI,aAAa,MAAM;AAAA,MACvB,OAAO,UAAQ,MAAM,SAAS,IAAI;AAAA,IACpC,CAAC;AAAA,EACH,EAAE,OAAO,CAAC,UAA4C,MAAM,SAAS,MAAM,CAAC,CAAC,CAAC;AAChF;AAEO,SAAS,mBAAmB,QAA4C;AAC7E,QAAM,aAAa,qBAAqB,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,MAAM,KAAK,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B;AACrB,QAAM,UAAU;AAAA,IACd,GAAG,IAAI;AAAA,MACL,OACG,OAAO,aAAa,EACpB,IAAI,CAAC,EAAE,MAAM,MAAM,MAAM,IAAI,CAAC,EAAE,SAAS,MAAM,QAAQ,CAAC,EACxD,OAAO,QAAQ,CAAC,CAAC;AAAA,IACtB;AAAA,EACF;AAEA,SAAO;AAAA,IACL,IAAI,OAAO,IAAI,OAAK,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,GAAG,MAAO,MAAM,IAAI,IAAI,MAAU,KAAK;AAAA,IAC9E,OAAO,QAAQ;AAAA,MAAI,cACjB,OACG;AAAA,QACC,OACG,KAAK,uBAAuB,aAAa,EAAE,OAAO,QAAQ,KAAM;AAAA,UAC/D;AAAA,UACA,OAAO,CAAC;AAAA,QACV;AAAA,MACJ,EACC,OAAO,CAAC,KAAK,EAAE,MAAM,MAAM;AAC1B,cAAM,IAAI,aAAa,IAAI,OAAO,KAAK;AACvC,eAAO;AAAA,UACL;AAAA,UACA,OAAO;AAAA,QACT;AAAA,MACF,CAAC;AAAA,IACL;AAAA,EACF;AACF;AAEO,SAAS,wBACd,QACA,aACkB;AAClB,QAAM,SAA6B,CAAC;AAEpC,QAAM,YAAY,OAAO,MAAM,QAAQ;AAAA,IACrC,IAAI,aAAa,MAAM;AAAA,IACvB,OAAO,UAAQ,KAAK,OAAO,IAAI;AAAA,EACjC,CAAC;AAED,aAAW,CAAC,IAAI,KAAK,WAAW;AAC9B,QAAI,KAAK,OAAO,IAAI,KAAK,gBAAgB,QAAQ,KAAK,cAAc,QAAW;AAC7E,aAAO,KAAK,KAAK,UAAU;AAAA,IAC7B;AAAA,EACF;AACA,SAAO,OAAO,WAAW,IAAI,EAAE,OAAO,CAAC,EAAE,IAAI,oBAAoB,QAAQ,WAAW;AACtF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/slate/utils/toText.ts"],"sourcesContent":["import { type Descendant } from 'slate'\nimport { Slate } from '@makeswift/controls'\n\nimport { RichText, RichTextV2Mode } from '../../controls/rich-text-v2'\n\nfunction isBlock(descendant: Descendant): descendant is Slate.Block {\n if (Slate.isText(descendant)) return false\n return Slate.isBlock(descendant)\n}\n\nfunction getTextByDescendant(descendant: Descendant, mode: RichTextV2Mode): string {\n if (Slate.isText(descendant)) {\n return descendant.text ?? ''\n }\n\n if (Slate.isDefaultElement(descendant)) {\n return mode === RichText.Mode.Inline\n ? descendant.children.map(descendant => getTextByDescendant(descendant, mode)).join('') ?? ''\n : descendant.children\n .map(descendant => getTextByDescendant(descendant, mode))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n }\n\n if (Slate.isBlock(descendant)) {\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant, mode))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n }\n\n if (Slate.isInline(descendant)) {\n return (\n descendant.children.map(descendant => getTextByDescendant(descendant, mode)).join('') ?? ''\n )\n }\n\n return ''\n}\n\nexport function toText(descendants: Descendant[], mode: RichTextV2Mode): string {\n return descendants.map(node => getTextByDescendant(node, mode)).join('\\n')\n}\n"],"mappings":"AACA,SAAS,aAAa;AAEtB,SAAS,gBAAgC;AAEzC,SAAS,QAAQ,YAAmD;AAClE,MAAI,MAAM,OAAO,UAAU;AAAG,WAAO;AACrC,SAAO,MAAM,QAAQ,UAAU;AACjC;AAEA,SAAS,oBAAoB,YAAwB,MAA8B;AACjF,MAAI,MAAM,OAAO,UAAU,GAAG;AAC5B,WAAO,WAAW,QAAQ;AAAA,EAC5B;AAEA,MAAI,MAAM,iBAAiB,UAAU,GAAG;AACtC,WAAO,SAAS,SAAS,KAAK,SAC1B,WAAW,SAAS,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,KACzF,WAAW,SACR,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EACvD,KAAK,WAAW,SAAS,MAAM,OAAO,IAAI,OAAO,EAAE,KAAK;AAAA,EACjE;AAEA,MAAI,MAAM,QAAQ,UAAU,GAAG;AAC7B,WACE,WAAW,SACR,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EACvD,KAAK,WAAW,SAAS,MAAM,OAAO,IAAI,OAAO,EAAE,KAAK;AAAA,EAE/D;AAEA,MAAI,MAAM,SAAS,UAAU,GAAG;AAC9B,WACE,WAAW,SAAS,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK;AAAA,EAE7F;AAEA,SAAO;AACT;AAEO,SAAS,OAAO,aAA2B,MAA8B;AAC9E,SAAO,YAAY,IAAI,UAAQ,oBAAoB,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI;AAC3E;","names":["descendant"]}
1
+ {"version":3,"sources":["../../../../src/slate/utils/toText.ts"],"sourcesContent":["import { type Descendant } from 'slate'\nimport { Slate } from '@makeswift/controls'\n\nimport { RichText, RichTextV2Mode } from '../../controls/rich-text-v2'\n\nfunction isBlock(descendant: Descendant): descendant is Slate.Block {\n if (Slate.isText(descendant)) return false\n return Slate.isBlock(descendant)\n}\n\nfunction getTextByDescendant(descendant: Descendant, mode: RichTextV2Mode): string {\n if (Slate.isText(descendant)) {\n return descendant.text ?? ''\n }\n\n if (Slate.isDefaultElement(descendant)) {\n return mode === RichText.Mode.Inline\n ? (descendant.children.map(descendant => getTextByDescendant(descendant, mode)).join('') ??\n '')\n : (descendant.children\n .map(descendant => getTextByDescendant(descendant, mode))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? '')\n }\n\n if (Slate.isBlock(descendant)) {\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant, mode))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n }\n\n if (Slate.isInline(descendant)) {\n return (\n descendant.children.map(descendant => getTextByDescendant(descendant, mode)).join('') ?? ''\n )\n }\n\n return ''\n}\n\nexport function toText(descendants: Descendant[], mode: RichTextV2Mode): string {\n return descendants.map(node => getTextByDescendant(node, mode)).join('\\n')\n}\n"],"mappings":"AACA,SAAS,aAAa;AAEtB,SAAS,gBAAgC;AAEzC,SAAS,QAAQ,YAAmD;AAClE,MAAI,MAAM,OAAO,UAAU;AAAG,WAAO;AACrC,SAAO,MAAM,QAAQ,UAAU;AACjC;AAEA,SAAS,oBAAoB,YAAwB,MAA8B;AACjF,MAAI,MAAM,OAAO,UAAU,GAAG;AAC5B,WAAO,WAAW,QAAQ;AAAA,EAC5B;AAEA,MAAI,MAAM,iBAAiB,UAAU,GAAG;AACtC,WAAO,SAAS,SAAS,KAAK,SACzB,WAAW,SAAS,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EAAE,KAAK,EAAE,KACnF,KACD,WAAW,SACT,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EACvD,KAAK,WAAW,SAAS,MAAM,OAAO,IAAI,OAAO,EAAE,KAAK;AAAA,EACjE;AAEA,MAAI,MAAM,QAAQ,UAAU,GAAG;AAC7B,WACE,WAAW,SACR,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EACvD,KAAK,WAAW,SAAS,MAAM,OAAO,IAAI,OAAO,EAAE,KAAK;AAAA,EAE/D;AAEA,MAAI,MAAM,SAAS,UAAU,GAAG;AAC9B,WACE,WAAW,SAAS,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK;AAAA,EAE7F;AAEA,SAAO;AACT;AAEO,SAAS,OAAO,aAA2B,MAA8B;AAC9E,SAAO,YAAY,IAAI,UAAQ,oBAAoB,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI;AAC3E;","names":["descendant"]}
@@ -1,7 +1,7 @@
1
1
  import { isAction } from "@reduxjs/toolkit";
2
- import { BuilderActionTypes } from "../builder-api/actions";
2
+ import { BuilderActionTypes } from "../builder-api/action-types";
3
3
  import { HostActionTypes } from "../host-api";
4
- import { InternalActionTypes } from "./internal";
4
+ import { InternalActionTypes } from "./internal/action-types";
5
5
  const ActionTypes = {
6
6
  ...HostActionTypes,
7
7
  ...BuilderActionTypes,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/state/actions/index.ts"],"sourcesContent":["import { isAction } from '@reduxjs/toolkit'\n\nimport { type BuilderAction, BuilderActionTypes } from '../builder-api/actions'\nimport { type HostAction, HostActionTypes } from '../host-api'\n\nimport { type InternalAction, InternalActionTypes } from './internal'\n\nexport { type UnknownAction } from '@reduxjs/toolkit'\nexport { type DocumentPayload } from '../shared-api'\n\nexport const ActionTypes = {\n ...HostActionTypes,\n ...BuilderActionTypes,\n ...InternalActionTypes,\n} as const\n\nexport type Action = HostAction | BuilderAction | InternalAction\n\nexport function isKnownAction(action: unknown): action is Action {\n return isAction(action) && Object.hasOwn(ActionTypes, action.type)\n}\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,SAA6B,0BAA0B;AACvD,SAA0B,uBAAuB;AAEjD,SAA8B,2BAA2B;AAKlD,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAIO,SAAS,cAAc,QAAmC;AAC/D,SAAO,SAAS,MAAM,KAAK,OAAO,OAAO,aAAa,OAAO,IAAI;AACnE;","names":[]}
1
+ {"version":3,"sources":["../../../../src/state/actions/index.ts"],"sourcesContent":["import { isAction } from '@reduxjs/toolkit'\n\nimport { type BuilderAction } from '../builder-api/actions'\nimport { BuilderActionTypes } from '../builder-api/action-types'\nimport { type HostAction, HostActionTypes } from '../host-api'\n\nimport { type InternalAction } from './internal'\nimport { InternalActionTypes } from './internal/action-types'\n\nexport { type UnknownAction } from '@reduxjs/toolkit'\nexport { type DocumentPayload } from '../shared-api'\n\nexport const ActionTypes = {\n ...HostActionTypes,\n ...BuilderActionTypes,\n ...InternalActionTypes,\n} as const\n\nexport type Action = HostAction | BuilderAction | InternalAction\n\nexport function isKnownAction(action: unknown): action is Action {\n return isAction(action) && Object.hasOwn(ActionTypes, action.type)\n}\n"],"mappings":"AAAA,SAAS,gBAAgB;AAGzB,SAAS,0BAA0B;AACnC,SAA0B,uBAAuB;AAGjD,SAAS,2BAA2B;AAK7B,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAIO,SAAS,cAAc,QAAmC;AAC/D,SAAO,SAAS,MAAM,KAAK,OAAO,OAAO,aAAa,OAAO,IAAI;AACnE;","names":[]}
@@ -0,0 +1,10 @@
1
+ import { ReadOnlyActionTypes } from "./read-only-action-types";
2
+ import { ReadWriteActionTypes } from "./read-write-action-types";
3
+ const InternalActionTypes = {
4
+ ...ReadOnlyActionTypes,
5
+ ...ReadWriteActionTypes
6
+ };
7
+ export {
8
+ InternalActionTypes
9
+ };
10
+ //# sourceMappingURL=action-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/state/actions/internal/action-types.ts"],"sourcesContent":["import { ReadOnlyActionTypes } from './read-only-action-types'\nimport { ReadWriteActionTypes } from './read-write-action-types'\n\nexport const InternalActionTypes = {\n ...ReadOnlyActionTypes,\n ...ReadWriteActionTypes,\n} as const\n"],"mappings":"AAAA,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AAE9B,MAAM,sBAAsB;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AACL;","names":[]}
@@ -1,10 +1 @@
1
- import { ReadOnlyActionTypes } from "./read-only-actions";
2
- import { ReadWriteActionTypes } from "./read-write-actions";
3
- const InternalActionTypes = {
4
- ...ReadOnlyActionTypes,
5
- ...ReadWriteActionTypes
6
- };
7
- export {
8
- InternalActionTypes
9
- };
10
1
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/state/actions/internal/index.ts"],"sourcesContent":["import { type ReadOnlyAction, ReadOnlyActionTypes } from './read-only-actions'\nimport { type ReadWriteAction, ReadWriteActionTypes } from './read-write-actions'\n\nexport const InternalActionTypes = {\n ...ReadOnlyActionTypes,\n ...ReadWriteActionTypes,\n} as const\n\nexport type InternalAction = ReadOnlyAction | ReadWriteAction\n"],"mappings":"AAAA,SAA8B,2BAA2B;AACzD,SAA+B,4BAA4B;AAEpD,MAAM,sBAAsB;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AACL;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,20 @@
1
+ const ReadOnlyActionTypes = {
2
+ // TODO: this one should be a read-write action and we should refuse
3
+ // to fetch resources on the client in read-only mode
4
+ API_RESOURCE_FULFILLED: "API_RESOURCE_FULFILLED",
5
+ CREATE_ELEMENT_TREE: "CREATE_ELEMENT_TREE",
6
+ DELETE_ELEMENT_TREE: "DELETE_ELEMENT_TREE",
7
+ REGISTER_COMPONENT: "REGISTER_COMPONENT",
8
+ UNREGISTER_COMPONENT: "UNREGISTER_COMPONENT",
9
+ REGISTER_REACT_COMPONENT: "REGISTER_REACT_COMPONENT",
10
+ UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT",
11
+ SET_BREAKPOINTS: "SET_BREAKPOINTS",
12
+ UPDATE_CLIENT_BREAKPOINT: "UPDATE_CLIENT_BREAKPOINT",
13
+ SET_LOCALE: "SET_LOCALE",
14
+ SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER",
15
+ SET_IS_READ_ONLY: "SET_IS_READ_ONLY"
16
+ };
17
+ export {
18
+ ReadOnlyActionTypes
19
+ };
20
+ //# sourceMappingURL=read-only-action-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/state/actions/internal/read-only-action-types.ts"],"sourcesContent":["export const ReadOnlyActionTypes = {\n // TODO: this one should be a read-write action and we should refuse\n // to fetch resources on the client in read-only mode\n API_RESOURCE_FULFILLED: 'API_RESOURCE_FULFILLED',\n\n CREATE_ELEMENT_TREE: 'CREATE_ELEMENT_TREE',\n DELETE_ELEMENT_TREE: 'DELETE_ELEMENT_TREE',\n\n REGISTER_COMPONENT: 'REGISTER_COMPONENT',\n UNREGISTER_COMPONENT: 'UNREGISTER_COMPONENT',\n\n REGISTER_REACT_COMPONENT: 'REGISTER_REACT_COMPONENT',\n UNREGISTER_REACT_COMPONENT: 'UNREGISTER_REACT_COMPONENT',\n\n SET_BREAKPOINTS: 'SET_BREAKPOINTS',\n UPDATE_CLIENT_BREAKPOINT: 'UPDATE_CLIENT_BREAKPOINT',\n\n SET_LOCALE: 'SET_LOCALE',\n\n SET_IS_IN_BUILDER: 'SET_IS_IN_BUILDER',\n SET_IS_READ_ONLY: 'SET_IS_READ_ONLY',\n} as const\n"],"mappings":"AAAO,MAAM,sBAAsB;AAAA;AAAA;AAAA,EAGjC,wBAAwB;AAAA,EAExB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EAErB,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EAEtB,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAE5B,iBAAiB;AAAA,EACjB,0BAA0B;AAAA,EAE1B,YAAY;AAAA,EAEZ,mBAAmB;AAAA,EACnB,kBAAkB;AACpB;","names":[]}