@juo/blocks 1.13.0-alpha.2 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/dist/ExtensionRoot-CRJx0Dtr.js +378 -0
  2. package/dist/block.d.ts +0 -50
  3. package/dist/block.d.ts.map +1 -1
  4. package/dist/{bridge-r7Yk8fjY.js → bridge-D838SWmN.js} +147 -42
  5. package/dist/context.d.ts.map +1 -1
  6. package/dist/core.js +1120 -2157
  7. package/dist/css-runtime-DWytAzZ5.js +1532 -0
  8. package/dist/editor/bridge.d.ts +8 -7
  9. package/dist/editor/bridge.d.ts.map +1 -1
  10. package/dist/editor/canvas-mode-signal.d.ts +22 -0
  11. package/dist/editor/canvas-mode-signal.d.ts.map +1 -0
  12. package/dist/editor/canvas-mode.d.ts +15 -0
  13. package/dist/editor/canvas-mode.d.ts.map +1 -0
  14. package/dist/editor/canvas-mode.test.d.ts +2 -0
  15. package/dist/editor/canvas-mode.test.d.ts.map +1 -0
  16. package/dist/editor/components.d.ts +113 -0
  17. package/dist/editor/components.d.ts.map +1 -1
  18. package/dist/editor/components.test.d.ts.map +1 -1
  19. package/dist/editor/handler.d.ts.map +1 -1
  20. package/dist/editor/handler.test.d.ts +2 -0
  21. package/dist/editor/handler.test.d.ts.map +1 -0
  22. package/dist/editor/layout-command-emitter.d.ts +31 -0
  23. package/dist/editor/layout-command-emitter.d.ts.map +1 -0
  24. package/dist/editor/layout-command-emitter.test.d.ts +2 -0
  25. package/dist/editor/layout-command-emitter.test.d.ts.map +1 -0
  26. package/dist/editor/layout-system-signal.d.ts +21 -0
  27. package/dist/editor/layout-system-signal.d.ts.map +1 -0
  28. package/dist/editor/main.d.ts +2 -2
  29. package/dist/editor/main.d.ts.map +1 -1
  30. package/dist/editor/messages.d.ts +90 -14
  31. package/dist/editor/messages.d.ts.map +1 -1
  32. package/dist/editor/surface-context.d.ts +7 -0
  33. package/dist/editor/surface-context.d.ts.map +1 -0
  34. package/dist/editor/surface-context.test.d.ts +2 -0
  35. package/dist/editor/surface-context.test.d.ts.map +1 -0
  36. package/dist/editor/wrapper-shared.d.ts +31 -0
  37. package/dist/editor/wrapper-shared.d.ts.map +1 -0
  38. package/dist/editor.js +887 -88
  39. package/dist/flows/WorkflowService.d.ts +2 -0
  40. package/dist/flows/WorkflowService.d.ts.map +1 -1
  41. package/dist/gridstack-adapter-DreG3XnB.js +5490 -0
  42. package/dist/layout/css-runtime.d.ts +41 -0
  43. package/dist/layout/css-runtime.d.ts.map +1 -0
  44. package/dist/layout/css-runtime.test.d.ts +2 -0
  45. package/dist/layout/css-runtime.test.d.ts.map +1 -0
  46. package/dist/layout/derive.d.ts +4 -0
  47. package/dist/layout/derive.d.ts.map +1 -0
  48. package/dist/layout/derive.test.d.ts +2 -0
  49. package/dist/layout/derive.test.d.ts.map +1 -0
  50. package/dist/layout/dividers.d.ts +34 -0
  51. package/dist/layout/dividers.d.ts.map +1 -0
  52. package/dist/layout/dividers.test.d.ts +2 -0
  53. package/dist/layout/dividers.test.d.ts.map +1 -0
  54. package/dist/layout/engine.d.ts +3 -0
  55. package/dist/layout/engine.d.ts.map +1 -0
  56. package/dist/layout/engine.test.d.ts +2 -0
  57. package/dist/layout/engine.test.d.ts.map +1 -0
  58. package/dist/layout/grid-utils.d.ts +57 -0
  59. package/dist/layout/grid-utils.d.ts.map +1 -0
  60. package/dist/layout/grid-utils.test.d.ts +2 -0
  61. package/dist/layout/grid-utils.test.d.ts.map +1 -0
  62. package/dist/layout/index.d.ts +12 -0
  63. package/dist/layout/index.d.ts.map +1 -0
  64. package/dist/layout/index.test.d.ts +2 -0
  65. package/dist/layout/index.test.d.ts.map +1 -0
  66. package/dist/layout/insert.d.ts +31 -0
  67. package/dist/layout/insert.d.ts.map +1 -0
  68. package/dist/layout/insert.test.d.ts +2 -0
  69. package/dist/layout/insert.test.d.ts.map +1 -0
  70. package/dist/layout/project-css.d.ts +6 -0
  71. package/dist/layout/project-css.d.ts.map +1 -0
  72. package/dist/layout/project-css.test.d.ts +2 -0
  73. package/dist/layout/project-css.test.d.ts.map +1 -0
  74. package/dist/layout/project-gridstack.d.ts +50 -0
  75. package/dist/layout/project-gridstack.d.ts.map +1 -0
  76. package/dist/layout/project-gridstack.test.d.ts +2 -0
  77. package/dist/layout/project-gridstack.test.d.ts.map +1 -0
  78. package/dist/layout/reconcile.d.ts +22 -0
  79. package/dist/layout/reconcile.d.ts.map +1 -0
  80. package/dist/layout/reconcile.test.d.ts +2 -0
  81. package/dist/layout/reconcile.test.d.ts.map +1 -0
  82. package/dist/layout/types.d.ts +118 -0
  83. package/dist/layout/types.d.ts.map +1 -0
  84. package/dist/layout-mode-adapter-BBd4JRQd.js +21 -0
  85. package/dist/main.d.ts +8 -4
  86. package/dist/main.d.ts.map +1 -1
  87. package/dist/morph-Dj-xvrwt.js +182 -0
  88. package/dist/preact.js +1 -1
  89. package/dist/project-gridstack-DYLMKSH1.js +52 -0
  90. package/dist/react.js +1 -1
  91. package/dist/services/customer/customerService.d.ts +2 -3
  92. package/dist/services/customer/customerService.d.ts.map +1 -1
  93. package/dist/services/customer/index.d.ts +0 -1
  94. package/dist/services/customer/index.d.ts.map +1 -1
  95. package/dist/services/customer/types.d.ts +1 -4
  96. package/dist/services/customer/types.d.ts.map +1 -1
  97. package/dist/services/index.d.ts +0 -3
  98. package/dist/services/index.d.ts.map +1 -1
  99. package/dist/services/login/index.d.ts +1 -3
  100. package/dist/services/login/index.d.ts.map +1 -1
  101. package/dist/services/login/loginService.d.ts +2 -6
  102. package/dist/services/login/loginService.d.ts.map +1 -1
  103. package/dist/services/orders/adapter.d.ts +0 -2
  104. package/dist/services/orders/adapter.d.ts.map +1 -1
  105. package/dist/services/orders/index.d.ts +1 -1
  106. package/dist/services/orders/index.d.ts.map +1 -1
  107. package/dist/services/product/adapter.d.ts +2 -27
  108. package/dist/services/product/adapter.d.ts.map +1 -1
  109. package/dist/services/product/index.d.ts +1 -1
  110. package/dist/services/product/index.d.ts.map +1 -1
  111. package/dist/services/product/productService.d.ts.map +1 -1
  112. package/dist/services/product/types.d.ts +0 -68
  113. package/dist/services/product/types.d.ts.map +1 -1
  114. package/dist/services/subscription/adapter.d.ts +2 -77
  115. package/dist/services/subscription/adapter.d.ts.map +1 -1
  116. package/dist/services/subscription/index.d.ts +1 -1
  117. package/dist/services/subscription/index.d.ts.map +1 -1
  118. package/dist/services/subscription/subscriptionService.d.ts +6 -1
  119. package/dist/services/subscription/subscriptionService.d.ts.map +1 -1
  120. package/dist/services/subscription/types.d.ts +9 -220
  121. package/dist/services/subscription/types.d.ts.map +1 -1
  122. package/dist/theme-state.d.ts +17 -2
  123. package/dist/theme-state.d.ts.map +1 -1
  124. package/dist/theme-state.layout.test.d.ts +2 -0
  125. package/dist/theme-state.layout.test.d.ts.map +1 -0
  126. package/dist/theme-state.test.d.ts +2 -0
  127. package/dist/theme-state.test.d.ts.map +1 -0
  128. package/dist/utils/index.d.ts +0 -6
  129. package/dist/utils/index.d.ts.map +1 -1
  130. package/dist/vue/block.d.ts.map +1 -1
  131. package/dist/vue.js +4 -25
  132. package/dist/web-components/ExtensionRoot.d.ts +50 -3
  133. package/dist/web-components/ExtensionRoot.d.ts.map +1 -1
  134. package/dist/web-components/editor/ExtensionRoot.d.ts +11 -0
  135. package/dist/web-components/editor/ExtensionRoot.d.ts.map +1 -0
  136. package/dist/web-components/editor/ExtensionRoot.test.d.ts +2 -0
  137. package/dist/web-components/editor/ExtensionRoot.test.d.ts.map +1 -0
  138. package/dist/web-components/editor/InlineText.d.ts +1 -0
  139. package/dist/web-components/editor/InlineText.d.ts.map +1 -1
  140. package/dist/web-components/editor/editor-layout-controller.d.ts +28 -0
  141. package/dist/web-components/editor/editor-layout-controller.d.ts.map +1 -0
  142. package/dist/web-components/editor/gridstack-adapter.d.ts +3 -0
  143. package/dist/web-components/editor/gridstack-adapter.d.ts.map +1 -0
  144. package/dist/web-components/editor/gridstack-adapter.test.d.ts +2 -0
  145. package/dist/web-components/editor/gridstack-adapter.test.d.ts.map +1 -0
  146. package/dist/web-components/editor/morph.d.ts +32 -0
  147. package/dist/web-components/editor/morph.d.ts.map +1 -0
  148. package/dist/web-components/editor/morph.test.d.ts +2 -0
  149. package/dist/web-components/editor/morph.test.d.ts.map +1 -0
  150. package/dist/web-components/layout/layout-controller.d.ts +55 -0
  151. package/dist/web-components/layout/layout-controller.d.ts.map +1 -0
  152. package/dist/web-components/layout/view-layout-controller.d.ts +17 -0
  153. package/dist/web-components/layout/view-layout-controller.d.ts.map +1 -0
  154. package/dist/web-components/layout/view-layout-controller.test.d.ts +2 -0
  155. package/dist/web-components/layout/view-layout-controller.test.d.ts.map +1 -0
  156. package/dist/web-components/layout-grid.d.ts +47 -0
  157. package/dist/web-components/layout-grid.d.ts.map +1 -0
  158. package/dist/web-components/layout-grid.test.d.ts +2 -0
  159. package/dist/web-components/layout-grid.test.d.ts.map +1 -0
  160. package/dist/web-components/layout-mode-adapter.d.ts +51 -0
  161. package/dist/web-components/layout-mode-adapter.d.ts.map +1 -0
  162. package/dist/web-components/layout-mode-adapter.test.d.ts +2 -0
  163. package/dist/web-components/layout-mode-adapter.test.d.ts.map +1 -0
  164. package/dist/web-components-editor.js +125 -18
  165. package/dist/web-components-runtime.js +4 -4
  166. package/package.json +3 -2
  167. package/dist/ExtensionRoot-peABLAZZ.js +0 -231
  168. package/dist/block-B6s9jL7l.js +0 -966
  169. package/dist/block.devtools.test.d.ts +0 -2
  170. package/dist/block.devtools.test.d.ts.map +0 -1
  171. package/dist/context.devtools.test.d.ts +0 -2
  172. package/dist/context.devtools.test.d.ts.map +0 -1
  173. package/dist/devtools/env.d.ts +0 -3
  174. package/dist/devtools/env.d.ts.map +0 -1
  175. package/dist/devtools/hook.d.ts +0 -35
  176. package/dist/devtools/hook.d.ts.map +0 -1
  177. package/dist/devtools/index.d.ts +0 -4
  178. package/dist/devtools/index.d.ts.map +0 -1
  179. package/dist/devtools/protocol.d.ts +0 -91
  180. package/dist/devtools/protocol.d.ts.map +0 -1
  181. package/dist/devtools.js +0 -44
  182. package/dist/editor/overlays.d.ts +0 -14
  183. package/dist/editor/overlays.d.ts.map +0 -1
  184. package/dist/editor/overlays.test.d.ts +0 -2
  185. package/dist/editor/overlays.test.d.ts.map +0 -1
  186. package/dist/juo-workflow-DY4rd256.js +0 -868
  187. package/dist/overlay-wrapper.d.ts +0 -69
  188. package/dist/overlay-wrapper.d.ts.map +0 -1
  189. package/dist/overlay-wrapper.test.d.ts +0 -2
  190. package/dist/overlay-wrapper.test.d.ts.map +0 -1
  191. package/dist/overlays/OverlayService.d.ts +0 -34
  192. package/dist/overlays/OverlayService.d.ts.map +0 -1
  193. package/dist/overlays/OverlayService.test.d.ts +0 -2
  194. package/dist/overlays/OverlayService.test.d.ts.map +0 -1
  195. package/dist/registry.devtools.test.d.ts +0 -2
  196. package/dist/registry.devtools.test.d.ts.map +0 -1
  197. package/dist/services/customer/adapter.d.ts +0 -8
  198. package/dist/services/customer/adapter.d.ts.map +0 -1
  199. package/dist/services/login/adapter.d.ts +0 -32
  200. package/dist/services/login/adapter.d.ts.map +0 -1
  201. package/dist/services/order/adapter.d.ts +0 -9
  202. package/dist/services/order/adapter.d.ts.map +0 -1
  203. package/dist/services/order/index.d.ts +0 -5
  204. package/dist/services/order/index.d.ts.map +0 -1
  205. package/dist/services/order/orderService.d.ts +0 -7
  206. package/dist/services/order/orderService.d.ts.map +0 -1
  207. package/dist/services/order/types.d.ts +0 -21
  208. package/dist/services/order/types.d.ts.map +0 -1
  209. package/dist/services/product/adapter.test.d.ts +0 -2
  210. package/dist/services/product/adapter.test.d.ts.map +0 -1
  211. package/dist/services/schedules/adapter.d.ts +0 -71
  212. package/dist/services/schedules/adapter.d.ts.map +0 -1
  213. package/dist/services/schedules/adapter.test.d.ts +0 -2
  214. package/dist/services/schedules/adapter.test.d.ts.map +0 -1
  215. package/dist/services/schedules/index.d.ts +0 -5
  216. package/dist/services/schedules/index.d.ts.map +0 -1
  217. package/dist/services/schedules/schedulesService.d.ts +0 -11
  218. package/dist/services/schedules/schedulesService.d.ts.map +0 -1
  219. package/dist/services/schedules/schedulesService.test.d.ts +0 -2
  220. package/dist/services/schedules/schedulesService.test.d.ts.map +0 -1
  221. package/dist/services/schedules/types.d.ts +0 -226
  222. package/dist/services/schedules/types.d.ts.map +0 -1
  223. package/dist/services/settings/index.d.ts +0 -3
  224. package/dist/services/settings/index.d.ts.map +0 -1
  225. package/dist/services/settings/settingsService.d.ts +0 -7
  226. package/dist/services/settings/settingsService.d.ts.map +0 -1
  227. package/dist/services/settings/settingsService.test.d.ts +0 -2
  228. package/dist/services/settings/settingsService.test.d.ts.map +0 -1
  229. package/dist/services/settings/types.d.ts +0 -35
  230. package/dist/services/settings/types.d.ts.map +0 -1
  231. package/dist/services/shop/index.d.ts +0 -3
  232. package/dist/services/shop/index.d.ts.map +0 -1
  233. package/dist/services/shop/shopService.d.ts +0 -12
  234. package/dist/services/shop/shopService.d.ts.map +0 -1
  235. package/dist/services/shop/shopService.test.d.ts +0 -2
  236. package/dist/services/shop/shopService.test.d.ts.map +0 -1
  237. package/dist/services/shop/types.d.ts +0 -7
  238. package/dist/services/shop/types.d.ts.map +0 -1
  239. package/dist/services/subscription/adapter.test.d.ts +0 -2
  240. package/dist/services/subscription/adapter.test.d.ts.map +0 -1
  241. package/dist/services/subscription/types.test.d.ts +0 -2
  242. package/dist/services/subscription/types.test.d.ts.map +0 -1
  243. package/dist/theme-state.params.test.d.ts +0 -2
  244. package/dist/theme-state.params.test.d.ts.map +0 -1
  245. package/dist/theme-state.translations.test.d.ts +0 -2
  246. package/dist/theme-state.translations.test.d.ts.map +0 -1
@@ -0,0 +1,41 @@
1
+ import { LayoutDocument } from './types';
2
+ /** Attribute that scopes a runtime grid container's generated stylesheet. */
3
+ export declare const LAYOUT_SCOPE_ATTR = "data-juo-layout";
4
+ /** CSS attribute selector for a given grid scope id. */
5
+ export declare function layoutScopeSelector(scopeId: string): string;
6
+ /**
7
+ * Build the scoped CSS Grid stylesheet for a layout, reconciled against the
8
+ * block ids actually being rendered (prune orphans / autofill unplaced).
9
+ * Pure: no DOM access.
10
+ */
11
+ export declare function buildLayoutCss(layout: LayoutDocument, blockIds: string[], scopeId: string): string;
12
+ export type GridLayoutRuntime = {
13
+ css: string;
14
+ /**
15
+ * Leader block ids (leftmost block of each divider row) — draw the full-width
16
+ * bare-style divider line above their row.
17
+ */
18
+ dividerBlockIds: Set<string>;
19
+ /**
20
+ * Every block on a divider row — get the extra divider-row spacing so the gap
21
+ * grows (gap | divider | gap) only where a divider is drawn.
22
+ */
23
+ dividerRowBlockIds: Set<string>;
24
+ /**
25
+ * Blocks with the sticky `fill` flag set. Used to reflect the "fill" toggle's
26
+ * active/pressed state onto the block wrapper chrome (only the block the
27
+ * merchant filled — never its neighbours).
28
+ */
29
+ fullWidthBlockIds: Set<string>;
30
+ };
31
+ /**
32
+ * Reconcile layout, emit scoped CSS, and classify bare-style row dividers in
33
+ * one pass (avoids double reconciliation in ExtensionRoot).
34
+ *
35
+ * Empty-block collapse is handled entirely in CSS (see `collapseRule` in
36
+ * project-css): an empty block sets `display:none` and, because row spacing is a
37
+ * per-item bottom margin rather than row-gap, its row closes up with no ghost
38
+ * gap — no runtime re-projection needed.
39
+ */
40
+ export declare function buildGridLayout(layout: LayoutDocument, blockIds: string[], scopeId: string): GridLayoutRuntime;
41
+ //# sourceMappingURL=css-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-runtime.d.ts","sourceRoot":"","sources":["../../src/layout/css-runtime.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,oBAAoB,CAAC;AAEnD,wDAAwD;AACxD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,MAAM,GACd,MAAM,CAMR;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B;;;OAGG;IACH,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC;;;;OAIG;IACH,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,MAAM,GACd,iBAAiB,CAsBnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=css-runtime.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-runtime.test.d.ts","sourceRoot":"","sources":["../../src/layout/css-runtime.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { BreakpointDef, LayoutDocument, LayoutForBreakpoint } from './types';
2
+ export declare function deriveLayout(base: LayoutForBreakpoint, target: BreakpointDef): LayoutForBreakpoint;
3
+ export declare function resolveLayout(doc: LayoutDocument, breakpointId: string): LayoutForBreakpoint;
4
+ //# sourceMappingURL=derive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/layout/derive.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAY,cAAc,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE5F,wBAAgB,YAAY,CAC1B,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,aAAa,GACpB,mBAAmB,CAWrB;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,MAAM,GACnB,mBAAmB,CAYrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=derive.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive.test.d.ts","sourceRoot":"","sources":["../../src/layout/derive.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ import { GridRect } from './types';
2
+ export type RowDividerClassification = {
3
+ /**
4
+ * Leftmost block (reading order) of each divider row — draws the full-width
5
+ * horizontal divider line above its row. A subset of `rowBlockIds`.
6
+ */
7
+ leaderBlockIds: Set<string>;
8
+ /**
9
+ * Every block belonging to a divider row. These receive the extra
10
+ * divider-row spacing (a top margin) so the boundary grows to
11
+ * gap | divider | gap ONLY where a divider is actually drawn — boundaries
12
+ * without a divider keep the regular single row-gap. Tagging all members
13
+ * (not just the leader) keeps side-by-side blocks on the same row aligned.
14
+ */
15
+ rowBlockIds: Set<string>;
16
+ };
17
+ /**
18
+ * Classify "divider rows": grid rows below the first whose top boundary is a
19
+ * clean full-width break (not crossed by any spanning block). Such a boundary
20
+ * gets a horizontal divider line plus extra breathing room.
21
+ *
22
+ * Rules:
23
+ * 1. The first row is never a divider row (no divider above the content top).
24
+ * 2. If any block spans across a row boundary (a tall block with
25
+ * `r < boundary < r + h`), that boundary is NOT a clean break — drawing a
26
+ * full-width line there would slice through the spanning block, and the
27
+ * rows beside it should read as a single band. Such rows are skipped, so
28
+ * they keep the regular gap with no divider (e.g. a tall "Upcoming items"
29
+ * next to a stacked "Upcoming renewal" / "Subscription notifications").
30
+ * 3. Only the leftmost block of a divider row leads the line (drawn once,
31
+ * full canvas width); every block on that row gets the spacing margin.
32
+ */
33
+ export declare function classifyRowDividers(items: Record<string, GridRect>, blockIds: readonly string[]): RowDividerClassification;
34
+ //# sourceMappingURL=dividers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dividers.d.ts","sourceRoot":"","sources":["../../src/layout/dividers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B;;;;;;OAMG;IACH,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC/B,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,wBAAwB,CA8B1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dividers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dividers.test.d.ts","sourceRoot":"","sources":["../../src/layout/dividers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { LayoutEngine } from './types';
2
+ export declare const gridV1Engine: LayoutEngine;
3
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/layout/engine.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,YAAY,EAAE,YAiG1B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=engine.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.test.d.ts","sourceRoot":"","sources":["../../src/layout/engine.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,57 @@
1
+ import { GridRect } from './types';
2
+ export declare function clampRect(rect: GridRect, cols: number): GridRect;
3
+ export declare function rectsOverlap(a: GridRect, b: GridRect): boolean;
4
+ export declare function readingOrder(items: Record<string, GridRect>): string[];
5
+ /**
6
+ * Compact items with GridStack `float:false` gravity: pull every block up as
7
+ * far as it fits, preserving its column (`c`) and size (`w`/`h`), in reading
8
+ * order (row then column). This:
9
+ * - removes vertical gaps (e.g. left behind by a deleted block), and
10
+ * - resolves overlaps (e.g. after a block is stretched to full width over its
11
+ * row-mates) by pushing later blocks down instead of letting them overlay.
12
+ *
13
+ * The result is deterministic and idempotent for an already-compact layout, so
14
+ * it matches what layout mode (GridStack) shows and is safe to re-run.
15
+ */
16
+ export declare function compactItems(items: Record<string, GridRect>, cols: number): Record<string, GridRect>;
17
+ /**
18
+ * Compute the free horizontal span available to `target` within its row band
19
+ * (the rows it vertically overlaps), given the other blocks in `items`.
20
+ *
21
+ * - `left` = the right edge (c + w) of the nearest block sitting to the left of
22
+ * `target` in the same band, or 0 if none.
23
+ * - `right` = the left edge (c) of the nearest block sitting to the right of
24
+ * `target` in the same band, or `cols` if none.
25
+ *
26
+ * Blocks that don't share any row with `target`, and the target itself
27
+ * (`target.id` compared via reference is not possible here, so pass `excludeId`),
28
+ * are ignored. This defines the maximum width a block can grow to WITHOUT moving
29
+ * any neighbour — the basis for the "fill" toggle.
30
+ */
31
+ export declare function rowBandBounds(items: Record<string, GridRect>, target: GridRect, cols: number, excludeId?: string): {
32
+ left: number;
33
+ right: number;
34
+ };
35
+ /**
36
+ * Re-apply every sticky `fill` block's layout. Fill blocks that share a row band
37
+ * and the same free segment (the span between the non-fill blocks that bound
38
+ * them) split that segment EQUALLY, laid left→right in reading order. As a
39
+ * neighbour is stretched the segment shrinks and the fill blocks squeeze down
40
+ * together; once a block's equal share would fall below the minimum width
41
+ * (`ceil(cols / MAX_BLOCKS_PER_ROW)`) it can no longer squeeze, so the overflow
42
+ * blocks wrap to their own fresh full-width rows below the band.
43
+ *
44
+ * When nothing overflows, non-fill blocks are never moved and no compaction runs
45
+ * — fill only ever consumes empty columns in place, so it can't create overlaps.
46
+ * When a block wraps, the layout is compacted so the vacated/added rows close up.
47
+ *
48
+ * Run after any mutation (drag, delete, resize, reflow) so filled blocks reclaim
49
+ * the space a neighbour vacates and re-equalise as row-mates come and go.
50
+ */
51
+ export declare function applyFillExpansion(items: Record<string, GridRect>, cols: number): Record<string, GridRect>;
52
+ /** Finds the first free cell scanning rows top-to-bottom, columns left-to-right. @param cols must be >= 1. */
53
+ export declare function findFreeRect(items: Record<string, GridRect>, size: {
54
+ w: number;
55
+ h: number;
56
+ }, cols: number): GridRect;
57
+ //# sourceMappingURL=grid-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-utils.d.ts","sourceRoot":"","sources":["../../src/layout/grid-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAY5D,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAOhE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAO9D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,EAAE,CAOtE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC/B,IAAI,EAAE,MAAM,GACX,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAe1B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC/B,MAAM,EAAE,QAAQ,EAChB,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAejC;AAmCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC/B,IAAI,EAAE,MAAM,GACX,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CA6E1B;AAED,8GAA8G;AAC9G,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC/B,IAAI,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAC9B,IAAI,EAAE,MAAM,GACX,QAAQ,CAYV"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=grid-utils.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-utils.test.d.ts","sourceRoot":"","sources":["../../src/layout/grid-utils.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ export type { BreakpointId, GridRect, GridConfig, ContainerQuery, BreakpointDef, LayoutForBreakpoint, LayoutDocument, GridCtx, LayoutCommand, LayoutEngine, LayoutEngineId, } from './types';
2
+ export { GRID_V1_ENGINE_ID, DEFAULT_GRID, DEFAULT_BREAKPOINTS, PAGE_ROOT_SLOT, } from './types';
3
+ export { clampRect, rectsOverlap, readingOrder, findFreeRect, compactItems, } from './grid-utils';
4
+ export { gridV1Engine } from './engine';
5
+ export { deriveLayout, resolveLayout } from './derive';
6
+ export { projectToCss } from './project-css';
7
+ export { projectToGridStack, type GridStackProjection, type GridStackWidgetProjection, } from './project-gridstack';
8
+ export { createDefaultLayoutDocument, reconcileLayout, compactLayoutDocument, expandFillLayoutDocument, } from './reconcile';
9
+ export { classifyRowDividers, type RowDividerClassification, } from './dividers';
10
+ export { DEFAULT_NEW_BLOCK_HEIGHT, insertRectRelative, type InsertPosition, } from './insert';
11
+ export { LAYOUT_SCOPE_ATTR, layoutScopeSelector, buildLayoutCss, buildGridLayout, type GridLayoutRuntime, } from './css-runtime';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,OAAO,EACP,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,2BAA2B,EAC3B,eAAe,EACf,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,KAAK,cAAc,GACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/layout/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import { LayoutDocument } from './types';
2
+ export type InsertPosition = "before" | "after";
3
+ /**
4
+ * Default height (in row units) for a freshly added block. `1` row (= rowUnit,
5
+ * 40px by default) is too short for the layout-mode skeleton's icon + name +
6
+ * lines and clips the label, so new blocks start a few rows tall. The merchant
7
+ * can still resize down in layout mode.
8
+ */
9
+ export declare const DEFAULT_NEW_BLOCK_HEIGHT = 4;
10
+ /**
11
+ * Insert a rect for `blockId` adjacent to `targetId` in the base breakpoint of
12
+ * `doc`, so a block added via the editor's add buttons lands directly
13
+ * above/below the block it was added relative to — not at the end of the grid.
14
+ *
15
+ * The new block inherits the target's column (`c`) and width (`w`) so it appears
16
+ * in the same lane the user added it from (full-width when the target is
17
+ * full-width). Every block at or below the insertion row is shifted down by the
18
+ * new block's height so reading order is preserved regardless of GridStack's
19
+ * compaction.
20
+ *
21
+ * Returns a NEW document; the input is never mutated. If the base breakpoint or
22
+ * the target's rect is missing (layout not reconciled yet), the document is
23
+ * returned unchanged — `reconcileLayout` then falls back to its default
24
+ * end-of-grid placement.
25
+ */
26
+ export declare function insertRectRelative(doc: LayoutDocument, args: {
27
+ blockId: string;
28
+ targetId: string;
29
+ position: InsertPosition;
30
+ }): LayoutDocument;
31
+ //# sourceMappingURL=insert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../src/layout/insert.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAE5D,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAA;CAAE,GACpE,cAAc,CA8BhB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=insert.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert.test.d.ts","sourceRoot":"","sources":["../../src/layout/insert.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { LayoutDocument } from './types';
2
+ export declare function projectToCss(doc: LayoutDocument, opts: {
3
+ scope: string;
4
+ domOrder?: string[];
5
+ }): string;
6
+ //# sourceMappingURL=project-css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-css.d.ts","sourceRoot":"","sources":["../../src/layout/project-css.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAwB,cAAc,EAAuB,MAAM,SAAS,CAAC;AAsMzF,wBAAgB,YAAY,CAC1B,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAC3C,MAAM,CAqBR"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project-css.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-css.test.d.ts","sourceRoot":"","sources":["../../src/layout/project-css.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,50 @@
1
+ import { LayoutDocument } from './types';
2
+ export { MAX_BLOCKS_PER_ROW } from './types';
3
+ /**
4
+ * Minimum height (in row units) the merchant may resize a block to in layout
5
+ * mode. Below this the layout-mode skeleton's icon + name label gets clipped
6
+ * and the block becomes unidentifiable, so we floor the resize handle here
7
+ * (enforced via GridStack's per-widget `minH`).
8
+ */
9
+ export declare const MIN_BLOCK_ROWS = 2;
10
+ /**
11
+ * Minimum width (in CSS px) the merchant may resize a block to in layout mode.
12
+ * Sized so a block can shrink to a third of the grid (≈4 of 12 columns) at
13
+ * realistic canvas widths, letting three blocks sit alongside each other — the
14
+ * previous 320px "mobile block" floor forced blocks to ~half the grid, capping
15
+ * a row at two. Columns are a fraction of the grid width, so this is converted
16
+ * to a per-widget `minW` (column count) by the adapter, which is the only place
17
+ * that knows the live pixel width.
18
+ */
19
+ export declare const MIN_BLOCK_PX = 200;
20
+ export type GridStackWidgetProjection = {
21
+ id: string;
22
+ x: number;
23
+ y: number;
24
+ w: number;
25
+ h: number;
26
+ minH: number;
27
+ /** True when the block already fills the free span of its row band. */
28
+ filled: boolean;
29
+ };
30
+ export type GridStackProjection = {
31
+ options: {
32
+ column: number;
33
+ cellHeight: number;
34
+ margin: number;
35
+ float: boolean;
36
+ sizeToContent: boolean;
37
+ };
38
+ widgets: GridStackWidgetProjection[];
39
+ };
40
+ /**
41
+ * Resolve which breakpoint a container of `containerWidthPx` renders, mirroring
42
+ * the CSS `@container (max-width:N)` cascade in `project-css.ts`: start at the
43
+ * base (widest) breakpoint and let each narrower breakpoint whose `maxWidth`
44
+ * query matches override it (document order = widest→narrowest, so the last
45
+ * match — the narrowest applicable — wins). Returns the base id when the width
46
+ * can't be measured (0 / jsdom), so layout mode defaults to desktop.
47
+ */
48
+ export declare function resolveActiveBreakpoint(doc: LayoutDocument, containerWidthPx: number): string;
49
+ export declare function projectToGridStack(doc: LayoutDocument, breakpointId: string): GridStackProjection;
50
+ //# sourceMappingURL=project-gridstack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-gridstack.d.ts","sourceRoot":"","sources":["../../src/layout/project-gridstack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,OAAO,CAAC;QACf,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC;IACF,OAAO,EAAE,yBAAyB,EAAE,CAAC;CACtC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,cAAc,EACnB,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAQR;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,MAAM,GACnB,mBAAmB,CAgCrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project-gridstack.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-gridstack.test.d.ts","sourceRoot":"","sources":["../../src/layout/project-gridstack.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import { LayoutDocument } from './types';
2
+ export declare function createDefaultLayoutDocument(blockIds: string[]): LayoutDocument;
3
+ export declare function reconcileLayout(doc: LayoutDocument | null | undefined, blockIds: string[]): LayoutDocument;
4
+ /**
5
+ * Compact the base (authored) breakpoint of a layout document with
6
+ * `float:false` gravity (see `compactItems`). Used after mutations that can
7
+ * leave the settled CSS-grid view out of sync with the GridStack model — most
8
+ * notably deleting a block (which otherwise leaves a vertical gap) or stretching
9
+ * one to full width (which otherwise overlays its row-mates). Narrower
10
+ * breakpoints are derived at projection time and need no compaction here.
11
+ */
12
+ export declare function compactLayoutDocument(doc: LayoutDocument | null | undefined): LayoutDocument | null | undefined;
13
+ /**
14
+ * Re-apply sticky `fill` expansion to the base (authored) breakpoint of a layout
15
+ * document (see `applyFillExpansion`). Mutations routed through the block tree
16
+ * (e.g. deleting or adding a block) reconcile + compact the layout but do NOT go
17
+ * through the grid engine's command pipeline, so without this a fill block never
18
+ * reclaims the columns a deleted row-mate vacates. Kept document-level to mirror
19
+ * `compactLayoutDocument` and run right after it.
20
+ */
21
+ export declare function expandFillLayoutDocument(doc: LayoutDocument | null | undefined): LayoutDocument | null | undefined;
22
+ //# sourceMappingURL=reconcile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconcile.d.ts","sourceRoot":"","sources":["../../src/layout/reconcile.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,cAAc,EAEpB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,cAAc,CAa9E;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,EACtC,QAAQ,EAAE,MAAM,EAAE,GACjB,cAAc,CA4BhB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,GACrC,cAAc,GAAG,IAAI,GAAG,SAAS,CAUnC;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,GACrC,cAAc,GAAG,IAAI,GAAG,SAAS,CAUnC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=reconcile.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconcile.test.d.ts","sourceRoot":"","sources":["../../src/layout/reconcile.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,118 @@
1
+ export type BreakpointId = string;
2
+ /**
3
+ * 0-indexed cell coordinates (c/r) and spans (w/h).
4
+ *
5
+ * `fill` is a sticky per-block flag: when true the block consumes all the free
6
+ * space in its row band (up to full width) and keeps doing so as neighbours move
7
+ * — see {@link applyFillExpansion}. It's toggled by the `fillWidth` command and
8
+ * cleared when the merchant manually resizes the block's width.
9
+ */
10
+ export type GridRect = {
11
+ c: number;
12
+ r: number;
13
+ w: number;
14
+ h: number;
15
+ fill?: boolean;
16
+ };
17
+ export type GridConfig = {
18
+ cols: number;
19
+ gap: number;
20
+ rowUnit: number;
21
+ };
22
+ export type ContainerQuery = {
23
+ maxWidth: number;
24
+ };
25
+ export type BreakpointDef = {
26
+ id: BreakpointId;
27
+ cols: number;
28
+ /** Absent for the base (widest) breakpoint; present for narrower ones. */
29
+ query?: ContainerQuery;
30
+ };
31
+ export type LayoutForBreakpoint = {
32
+ grid: GridConfig;
33
+ /** Keyed by Block.id — the ONLY thing the renderer reads. */
34
+ items: Record<string, GridRect>;
35
+ /** Engine-private (future zones/stacks/groups) — opaque to model/renderer. */
36
+ data?: unknown;
37
+ };
38
+ /**
39
+ * Identifier of a real layout-document engine format (the shape a persisted
40
+ * {@link LayoutDocument} is authored in). This is the canonical registry of
41
+ * engines — add `"grid-v2"` etc. here. It intentionally does NOT include
42
+ * `"legacy"`: legacy is the *absence* of the layout system, not a document
43
+ * format, so no doc is ever tagged `"legacy"`. The theme-level opt-in
44
+ * (`GlobalStyles.layoutEngine`) layers `"legacy"` on top of this set.
45
+ */
46
+ export type LayoutEngineId = "grid-v1";
47
+ export type LayoutDocument = {
48
+ version: 1;
49
+ engine: LayoutEngineId;
50
+ /** Ordered widest → narrowest; index 0 is the authored base. */
51
+ breakpoints: BreakpointDef[];
52
+ layouts: Partial<Record<BreakpointId, LayoutForBreakpoint>>;
53
+ };
54
+ /** Runtime context passed to engine methods: the resolved GridConfig plus the active breakpoint id. */
55
+ export type GridCtx = {
56
+ breakpoint: BreakpointId;
57
+ cols: number;
58
+ gap: number;
59
+ rowUnit: number;
60
+ };
61
+ export type LayoutCommand = {
62
+ kind: "add";
63
+ blockId: string;
64
+ rect?: GridRect;
65
+ } | {
66
+ kind: "move";
67
+ blockId: string;
68
+ to: {
69
+ c: number;
70
+ r: number;
71
+ };
72
+ } | {
73
+ kind: "resize";
74
+ blockId: string;
75
+ size: {
76
+ w: number;
77
+ h: number;
78
+ };
79
+ } | {
80
+ kind: "remove";
81
+ blockId: string;
82
+ } | {
83
+ kind: "setRects";
84
+ rects: Record<string, GridRect>;
85
+ }
86
+ /**
87
+ * Toggle a block's sticky `fill` flag. When enabled the block expands to
88
+ * consume the free space in its row band (and re-expands as neighbours move);
89
+ * when disabled it keeps its current width.
90
+ */
91
+ | {
92
+ kind: "fillWidth";
93
+ blockId: string;
94
+ };
95
+ export interface LayoutEngine {
96
+ id: LayoutEngineId;
97
+ applyCommand(doc: LayoutDocument, cmd: LayoutCommand, ctx: GridCtx): LayoutDocument;
98
+ reflow(doc: LayoutDocument, ctx: GridCtx): LayoutDocument;
99
+ }
100
+ export declare const GRID_V1_ENGINE_ID: LayoutEngineId;
101
+ /**
102
+ * The slot whose children the MVP LayoutDocument governs (the "page-root
103
+ * slot"). The editor's getLayoutBlockIds and the runtime ExtensionRoot
104
+ * grid container both key off this so they govern the SAME block set.
105
+ */
106
+ export declare const PAGE_ROOT_SLOT = "content";
107
+ export declare const DEFAULT_GRID: Readonly<GridConfig>;
108
+ /**
109
+ * Maximum number of blocks allowed side by side in a single row. Fill blocks
110
+ * split their free row-band space equally down to a floor of
111
+ * `ceil(cols / MAX_BLOCKS_PER_ROW)` columns; below that they wrap to a new
112
+ * full-width row (see `applyFillExpansion` in grid-utils). The GridStack
113
+ * adapter uses the same floor for per-widget `minW`, capping a row at this many
114
+ * blocks regardless of the live canvas width.
115
+ */
116
+ export declare const MAX_BLOCKS_PER_ROW = 3;
117
+ export declare const DEFAULT_BREAKPOINTS: readonly BreakpointDef[];
118
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/layout/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,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layout-interaction-end";
3
+ const LAYOUT_POP_CLASS = "juo-layout-pop";
4
+ let current = null;
5
+ function registerLayoutModeAdapter(adapter) {
6
+ current = adapter;
7
+ }
8
+ function getLayoutModeAdapter() {
9
+ return current;
10
+ }
11
+ function clearLayoutModeAdapter() {
12
+ current = null;
13
+ }
14
+ export {
15
+ LAYOUT_INTERACTION_END,
16
+ LAYOUT_INTERACTION_START,
17
+ LAYOUT_POP_CLASS,
18
+ clearLayoutModeAdapter,
19
+ getLayoutModeAdapter,
20
+ registerLayoutModeAdapter
21
+ };
package/dist/main.d.ts CHANGED
@@ -1,14 +1,18 @@
1
1
  export type { Block, BlockInstance, BlockDefinition, BlockLocaleFile, BlockRenderer, BlockPreset, BlockPresets, } from './block';
2
- export { attachEmptyTracking, backfillInstanceDefaults, createBlockInstance, createBlockInstanceFromJSON, createBlockInstanceFromObject, createCeRenderer, defineBlock, defineBlockRuntime, getDefinedBlocks, hasRenderedContent, isStubDefinition, withWrapper, registerBlock, SelectedBlockContext, createSelectedBlock, BlockWrapperEvent, serializeBlocks, onRegisterBlock, getDevtoolsBlockState, setDevtoolsBlockProp, __recordDevtoolsInstance, __recordDevtoolsPropSetter, } from './block';
3
- export { ThemeStateContext, createThemeState, indexOverrides, type TranslationCatalogs, type TranslationMode, type TranslationScope, type TranslationOverride, type ThemeLocaleState, type ThemeState, type ThemeSurface, type ThemeSurfaceState, type GlobalStyles, type GlobalStyleColors, type ThemeType, DEFAULT_GLOBAL_STYLES, } from './theme-state';
2
+ export { attachEmptyTracking, backfillInstanceDefaults, createBlockInstance, createBlockInstanceFromJSON, createBlockInstanceFromObject, createCeRenderer, defineBlock, defineBlockRuntime, getDefinedBlocks, hasRenderedContent, isStubDefinition, withWrapper, registerBlock, SelectedBlockContext, createSelectedBlock, BlockWrapperEvent, serializeBlocks, onRegisterBlock, } from './block';
3
+ export { ThemeStateContext, createThemeState, indexOverrides, type TranslationCatalogs, type TranslationMode, type TranslationScope, type TranslationOverride, type ThemeLocaleState, type ThemeState, type ThemeSurface, type ThemeSurfaceState, type GlobalStyles, type GlobalStyleColors, type ThemeType, type LayoutEngine, DEFAULT_GLOBAL_STYLES, } from './theme-state';
4
4
  export { TranslationContext, createTranslationService, type TranslationServiceOptions, type TranslationService, } from './translation';
5
5
  export { ContextRequestEvent, ContextProvideEvent, type ContextCallback, createContext, injectContext, provideContext, subscribeContext, type ContextType, type UnknownContext, } from './context';
6
6
  export { StateContext, createState } from './state';
7
- export { defineOverlayWrapper, type OverlayLayout } from './overlay-wrapper';
8
- export { OverlayServiceContext, createOverlayService, type OverlayService, type OverlayState, type OverlayRegistryEntry, } from './overlays/OverlayService';
9
7
  export { waitForDevBlocksUrl, loadBlockRegistry } from './registry';
10
8
  export * from './utils';
11
9
  export * from './services';
12
10
  export * from './flows';
11
+ export * from './layout';
12
+ export { registerLayoutModeAdapter, getLayoutModeAdapter, clearLayoutModeAdapter, type LayoutModeAdapter, type LayoutModeMountInputs, type LayoutModeRectsChange, } from './web-components/layout-mode-adapter';
13
+ export { canvasMode } from './editor/canvas-mode-signal';
14
+ export { layoutSystemEnabled, setLayoutSystemEnabled, } from './editor/layout-system-signal';
15
+ export { setActiveSurfaceContext, getActiveSurfaceContext, clearAllSurfaceContexts, } from './editor/surface-context';
16
+ export { setLayoutCommandEmitter, emitLayoutSetRects, setLayoutCommandDispatcher, emitLayoutCommand, type LayoutCommandEmitter, type LayoutSetRectsEvent, type LayoutCommandDispatcher, type LayoutCommandEvent, } from './editor/layout-command-emitter';
13
17
  export { Signal, signal, effect, computed, untracked, } from '@preact/signals-core';
14
18
  //# sourceMappingURL=main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mBAAmB,EACnB,wBAAw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,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,GACV,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,6BAA6B,EAC7B,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,eAAe,EACpB,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS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