@juo/blocks 1.13.0 → 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 (132) hide show
  1. package/dist/ExtensionRoot-CRJx0Dtr.js +378 -0
  2. package/dist/block.d.ts.map +1 -1
  3. package/dist/{bridge-w5KQ-czl.js → bridge-D838SWmN.js} +146 -32
  4. package/dist/context.d.ts.map +1 -1
  5. package/dist/core.js +775 -35
  6. package/dist/{juo-workflow-BlG9CcAG.js → css-runtime-DWytAzZ5.js} +466 -611
  7. package/dist/editor/bridge.d.ts +8 -0
  8. package/dist/editor/bridge.d.ts.map +1 -1
  9. package/dist/editor/canvas-mode-signal.d.ts +22 -0
  10. package/dist/editor/canvas-mode-signal.d.ts.map +1 -0
  11. package/dist/editor/canvas-mode.d.ts +15 -0
  12. package/dist/editor/canvas-mode.d.ts.map +1 -0
  13. package/dist/editor/canvas-mode.test.d.ts +2 -0
  14. package/dist/editor/canvas-mode.test.d.ts.map +1 -0
  15. package/dist/editor/components.d.ts +113 -0
  16. package/dist/editor/components.d.ts.map +1 -1
  17. package/dist/editor/components.test.d.ts.map +1 -1
  18. package/dist/editor/handler.d.ts.map +1 -1
  19. package/dist/editor/handler.test.d.ts +2 -0
  20. package/dist/editor/handler.test.d.ts.map +1 -0
  21. package/dist/editor/layout-command-emitter.d.ts +31 -0
  22. package/dist/editor/layout-command-emitter.d.ts.map +1 -0
  23. package/dist/editor/layout-command-emitter.test.d.ts +2 -0
  24. package/dist/editor/layout-command-emitter.test.d.ts.map +1 -0
  25. package/dist/editor/layout-system-signal.d.ts +21 -0
  26. package/dist/editor/layout-system-signal.d.ts.map +1 -0
  27. package/dist/editor/main.d.ts +1 -0
  28. package/dist/editor/main.d.ts.map +1 -1
  29. package/dist/editor/messages.d.ts +90 -3
  30. package/dist/editor/messages.d.ts.map +1 -1
  31. package/dist/editor/messages.test.d.ts +2 -0
  32. package/dist/editor/messages.test.d.ts.map +1 -0
  33. package/dist/editor/surface-context.d.ts +7 -0
  34. package/dist/editor/surface-context.d.ts.map +1 -0
  35. package/dist/editor/surface-context.test.d.ts +2 -0
  36. package/dist/editor/surface-context.test.d.ts.map +1 -0
  37. package/dist/editor/wrapper-shared.d.ts +31 -0
  38. package/dist/editor/wrapper-shared.d.ts.map +1 -0
  39. package/dist/editor.js +863 -45
  40. package/dist/gridstack-adapter-DreG3XnB.js +5490 -0
  41. package/dist/layout/css-runtime.d.ts +41 -0
  42. package/dist/layout/css-runtime.d.ts.map +1 -0
  43. package/dist/layout/css-runtime.test.d.ts +2 -0
  44. package/dist/layout/css-runtime.test.d.ts.map +1 -0
  45. package/dist/layout/derive.d.ts +4 -0
  46. package/dist/layout/derive.d.ts.map +1 -0
  47. package/dist/layout/derive.test.d.ts +2 -0
  48. package/dist/layout/derive.test.d.ts.map +1 -0
  49. package/dist/layout/dividers.d.ts +34 -0
  50. package/dist/layout/dividers.d.ts.map +1 -0
  51. package/dist/layout/dividers.test.d.ts +2 -0
  52. package/dist/layout/dividers.test.d.ts.map +1 -0
  53. package/dist/layout/engine.d.ts +3 -0
  54. package/dist/layout/engine.d.ts.map +1 -0
  55. package/dist/layout/engine.test.d.ts +2 -0
  56. package/dist/layout/engine.test.d.ts.map +1 -0
  57. package/dist/layout/grid-utils.d.ts +57 -0
  58. package/dist/layout/grid-utils.d.ts.map +1 -0
  59. package/dist/layout/grid-utils.test.d.ts +2 -0
  60. package/dist/layout/grid-utils.test.d.ts.map +1 -0
  61. package/dist/layout/index.d.ts +12 -0
  62. package/dist/layout/index.d.ts.map +1 -0
  63. package/dist/layout/index.test.d.ts +2 -0
  64. package/dist/layout/index.test.d.ts.map +1 -0
  65. package/dist/layout/insert.d.ts +31 -0
  66. package/dist/layout/insert.d.ts.map +1 -0
  67. package/dist/layout/insert.test.d.ts +2 -0
  68. package/dist/layout/insert.test.d.ts.map +1 -0
  69. package/dist/layout/project-css.d.ts +6 -0
  70. package/dist/layout/project-css.d.ts.map +1 -0
  71. package/dist/layout/project-css.test.d.ts +2 -0
  72. package/dist/layout/project-css.test.d.ts.map +1 -0
  73. package/dist/layout/project-gridstack.d.ts +50 -0
  74. package/dist/layout/project-gridstack.d.ts.map +1 -0
  75. package/dist/layout/project-gridstack.test.d.ts +2 -0
  76. package/dist/layout/project-gridstack.test.d.ts.map +1 -0
  77. package/dist/layout/reconcile.d.ts +22 -0
  78. package/dist/layout/reconcile.d.ts.map +1 -0
  79. package/dist/layout/reconcile.test.d.ts +2 -0
  80. package/dist/layout/reconcile.test.d.ts.map +1 -0
  81. package/dist/layout/types.d.ts +118 -0
  82. package/dist/layout/types.d.ts.map +1 -0
  83. package/dist/layout-mode-adapter-BBd4JRQd.js +21 -0
  84. package/dist/main.d.ts +7 -1
  85. package/dist/main.d.ts.map +1 -1
  86. package/dist/morph-Dj-xvrwt.js +182 -0
  87. package/dist/preact.js +1 -1
  88. package/dist/project-gridstack-DYLMKSH1.js +52 -0
  89. package/dist/react.js +1 -1
  90. package/dist/theme-state.d.ts +16 -0
  91. package/dist/theme-state.d.ts.map +1 -1
  92. package/dist/theme-state.layout.test.d.ts +2 -0
  93. package/dist/theme-state.layout.test.d.ts.map +1 -0
  94. package/dist/theme-state.test.d.ts +2 -0
  95. package/dist/theme-state.test.d.ts.map +1 -0
  96. package/dist/vue.js +1 -1
  97. package/dist/web-components/ExtensionRoot.d.ts +50 -2
  98. package/dist/web-components/ExtensionRoot.d.ts.map +1 -1
  99. package/dist/web-components/editor/ExtensionRoot.d.ts +11 -0
  100. package/dist/web-components/editor/ExtensionRoot.d.ts.map +1 -0
  101. package/dist/web-components/editor/ExtensionRoot.test.d.ts +2 -0
  102. package/dist/web-components/editor/ExtensionRoot.test.d.ts.map +1 -0
  103. package/dist/web-components/editor/InlineText.d.ts +1 -0
  104. package/dist/web-components/editor/InlineText.d.ts.map +1 -1
  105. package/dist/web-components/editor/editor-layout-controller.d.ts +28 -0
  106. package/dist/web-components/editor/editor-layout-controller.d.ts.map +1 -0
  107. package/dist/web-components/editor/gridstack-adapter.d.ts +3 -0
  108. package/dist/web-components/editor/gridstack-adapter.d.ts.map +1 -0
  109. package/dist/web-components/editor/gridstack-adapter.test.d.ts +2 -0
  110. package/dist/web-components/editor/gridstack-adapter.test.d.ts.map +1 -0
  111. package/dist/web-components/editor/morph.d.ts +32 -0
  112. package/dist/web-components/editor/morph.d.ts.map +1 -0
  113. package/dist/web-components/editor/morph.test.d.ts +2 -0
  114. package/dist/web-components/editor/morph.test.d.ts.map +1 -0
  115. package/dist/web-components/layout/layout-controller.d.ts +55 -0
  116. package/dist/web-components/layout/layout-controller.d.ts.map +1 -0
  117. package/dist/web-components/layout/view-layout-controller.d.ts +17 -0
  118. package/dist/web-components/layout/view-layout-controller.d.ts.map +1 -0
  119. package/dist/web-components/layout/view-layout-controller.test.d.ts +2 -0
  120. package/dist/web-components/layout/view-layout-controller.test.d.ts.map +1 -0
  121. package/dist/web-components/layout-grid.d.ts +47 -0
  122. package/dist/web-components/layout-grid.d.ts.map +1 -0
  123. package/dist/web-components/layout-grid.test.d.ts +2 -0
  124. package/dist/web-components/layout-grid.test.d.ts.map +1 -0
  125. package/dist/web-components/layout-mode-adapter.d.ts +51 -0
  126. package/dist/web-components/layout-mode-adapter.d.ts.map +1 -0
  127. package/dist/web-components/layout-mode-adapter.test.d.ts +2 -0
  128. package/dist/web-components/layout-mode-adapter.test.d.ts.map +1 -0
  129. package/dist/web-components-editor.js +125 -17
  130. package/dist/web-components-runtime.js +4 -3
  131. package/package.json +3 -2
  132. package/dist/ExtensionRoot-2xTGTu3K.js +0 -219
@@ -0,0 +1,182 @@
1
+ import { canvasMode, effect } from "@juo/blocks";
2
+ import { K as getEditorBridge, o as createLayoutingModeChangedMessage, W as WRAPPER_SELECTOR } from "./bridge-D838SWmN.js";
3
+ import { LAYOUT_INTERACTION_START, LAYOUT_INTERACTION_END, LAYOUT_POP_CLASS } from "./layout-mode-adapter-BBd4JRQd.js";
4
+ function setCanvasMode(enabled) {
5
+ var _a;
6
+ if (canvasMode.value === enabled) return;
7
+ (_a = getEditorBridge()) == null ? void 0 : _a.preserveScrollAcrossReflow();
8
+ canvasMode.value = enabled;
9
+ }
10
+ function resetCanvasMode() {
11
+ canvasMode.value = false;
12
+ }
13
+ let interacting = false;
14
+ let exitListenersBound = false;
15
+ let initialized = false;
16
+ function notifyParentMode(enabled) {
17
+ var _a;
18
+ (_a = getEditorBridge()) == null ? void 0 : _a.sendMessage(createLayoutingModeChangedMessage({ enabled }));
19
+ }
20
+ function prefersReducedMotion() {
21
+ return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
22
+ }
23
+ const VT_STYLE_ID = "juo-morph-vt-style";
24
+ const VT_NAME_PREFIX = "juo-block-";
25
+ function ensureViewTransitionCss() {
26
+ if (typeof document === "undefined" || document.getElementById(VT_STYLE_ID)) {
27
+ return;
28
+ }
29
+ const style = document.createElement("style");
30
+ style.id = VT_STYLE_ID;
31
+ style.textContent = `
32
+ ::view-transition-group(*) {
33
+ animation-duration: 380ms;
34
+ animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
35
+ }
36
+ `;
37
+ (document.head ?? document.documentElement).appendChild(style);
38
+ }
39
+ function collectBlockWrappers() {
40
+ const out = [];
41
+ const seen = /* @__PURE__ */ new Set();
42
+ const walk = (root) => {
43
+ if (seen.has(root)) return;
44
+ seen.add(root);
45
+ for (const el of Array.from(
46
+ root.querySelectorAll(WRAPPER_SELECTOR)
47
+ )) {
48
+ out.push(el);
49
+ }
50
+ for (const el of Array.from(root.querySelectorAll("*"))) {
51
+ const sr = el.shadowRoot;
52
+ if (sr != null) walk(sr);
53
+ }
54
+ };
55
+ walk(document);
56
+ return out;
57
+ }
58
+ function viewTransitionName(blockId) {
59
+ return VT_NAME_PREFIX + blockId.replace(/[^a-zA-Z0-9_-]/g, "_");
60
+ }
61
+ function findWrapper(blockId) {
62
+ for (const el of collectBlockWrappers()) {
63
+ if (el.getAttribute("data-block-id") === blockId) return el;
64
+ }
65
+ return null;
66
+ }
67
+ function resolveWrapper(block) {
68
+ if (block.isConnected) return block;
69
+ const id = block.getAttribute("data-block-id");
70
+ return id != null ? findWrapper(id) : null;
71
+ }
72
+ function scrollBlockIntoView(block) {
73
+ const el = resolveWrapper(block);
74
+ if (el == null || typeof el.scrollIntoView !== "function") return;
75
+ el.scrollIntoView({ block: "start", inline: "nearest" });
76
+ }
77
+ function popBlock(block) {
78
+ const wrapper = resolveWrapper(block);
79
+ const item = wrapper == null ? void 0 : wrapper.closest(".grid-stack-item");
80
+ if (item == null) return;
81
+ item.classList.remove(LAYOUT_POP_CLASS);
82
+ void item.offsetWidth;
83
+ item.classList.add(LAYOUT_POP_CLASS);
84
+ const clear = () => item.classList.remove(LAYOUT_POP_CLASS);
85
+ item.addEventListener("animationend", clear, { once: true });
86
+ if (typeof setTimeout === "function") setTimeout(clear, 450);
87
+ }
88
+ function withMorphTransition(fn) {
89
+ const doc = document;
90
+ if (typeof doc.startViewTransition !== "function" || prefersReducedMotion()) {
91
+ fn();
92
+ return Promise.resolve();
93
+ }
94
+ ensureViewTransitionCss();
95
+ const wrappers = collectBlockWrappers();
96
+ for (const el of wrappers) {
97
+ const id = el.getAttribute("data-block-id");
98
+ if (id != null) el.style.viewTransitionName = viewTransitionName(id);
99
+ }
100
+ const clearNames = () => {
101
+ for (const el of wrappers) el.style.viewTransitionName = "";
102
+ };
103
+ let transition;
104
+ try {
105
+ transition = doc.startViewTransition(() => {
106
+ fn();
107
+ });
108
+ } catch {
109
+ fn();
110
+ clearNames();
111
+ return Promise.resolve();
112
+ }
113
+ if (transition.finished != null) {
114
+ return Promise.resolve(transition.finished).then(clearNames, clearNames);
115
+ }
116
+ clearNames();
117
+ return Promise.resolve();
118
+ }
119
+ function isInsideGridItem(e) {
120
+ const path = typeof e.composedPath === "function" ? e.composedPath() : [];
121
+ return path.some(
122
+ (n) => n instanceof Element && (n.classList.contains("grid-stack-item") || n.classList.contains("grid-stack-item-content"))
123
+ );
124
+ }
125
+ function onExitPointerDown(e) {
126
+ if (interacting || isInsideGridItem(e)) return;
127
+ exitToView();
128
+ }
129
+ function onExitKeyDown(e) {
130
+ if (e.key === "Escape") exitToView();
131
+ }
132
+ function bindExitListeners() {
133
+ if (exitListenersBound || typeof document === "undefined") return;
134
+ exitListenersBound = true;
135
+ document.addEventListener("pointerdown", onExitPointerDown, true);
136
+ document.addEventListener("keydown", onExitKeyDown, true);
137
+ }
138
+ function unbindExitListeners() {
139
+ if (!exitListenersBound) return;
140
+ exitListenersBound = false;
141
+ document.removeEventListener("pointerdown", onExitPointerDown, true);
142
+ document.removeEventListener("keydown", onExitKeyDown, true);
143
+ }
144
+ function enterLayout(block) {
145
+ if (canvasMode.value) {
146
+ notifyParentMode(true);
147
+ return;
148
+ }
149
+ const done = withMorphTransition(() => {
150
+ setCanvasMode(true);
151
+ if (block != null) scrollBlockIntoView(block);
152
+ });
153
+ notifyParentMode(true);
154
+ if (block != null) void done.then(() => popBlock(block));
155
+ }
156
+ function exitToView() {
157
+ if (!canvasMode.value) return;
158
+ withMorphTransition(() => {
159
+ setCanvasMode(false);
160
+ });
161
+ notifyParentMode(false);
162
+ }
163
+ function initMorphController() {
164
+ if (initialized || typeof document === "undefined") return;
165
+ initialized = true;
166
+ effect(() => {
167
+ if (canvasMode.value) bindExitListeners();
168
+ else unbindExitListeners();
169
+ });
170
+ document.addEventListener(LAYOUT_INTERACTION_START, () => {
171
+ interacting = true;
172
+ });
173
+ document.addEventListener(LAYOUT_INTERACTION_END, () => {
174
+ interacting = false;
175
+ });
176
+ }
177
+ export {
178
+ enterLayout as e,
179
+ initMorphController as i,
180
+ resetCanvasMode as r,
181
+ setCanvasMode as s
182
+ };
package/dist/preact.js CHANGED
@@ -6,7 +6,7 @@ import { useState, useRef, useEffect, useContext as useContext$1, useMemo } from
6
6
  import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-VhmfGB3N.js";
7
7
  import { t } from "./block-VhmfGB3N.js";
8
8
  import { createContext, h, render } from "preact";
9
- import { a as createEditorBridge } from "./bridge-w5KQ-czl.js";
9
+ import { c as createEditorBridge } from "./bridge-D838SWmN.js";
10
10
  function toState(signal) {
11
11
  const [value, setValue] = useState(() => getSignalValue(signal));
12
12
  const disposeRef = useRef(null);
@@ -0,0 +1,52 @@
1
+ import { a1 as resolveLayout } from "./css-runtime-DWytAzZ5.js";
2
+ const MIN_BLOCK_ROWS = 2;
3
+ const MIN_BLOCK_PX = 200;
4
+ function resolveActiveBreakpoint(doc, containerWidthPx) {
5
+ var _a;
6
+ const baseId = ((_a = doc.breakpoints[0]) == null ? void 0 : _a.id) ?? "desktop";
7
+ if (!(containerWidthPx > 0)) return baseId;
8
+ let active = baseId;
9
+ for (const bp of doc.breakpoints.slice(1)) {
10
+ if (bp.query && containerWidthPx <= bp.query.maxWidth) active = bp.id;
11
+ }
12
+ return active;
13
+ }
14
+ function projectToGridStack(doc, breakpointId) {
15
+ const layout = resolveLayout(doc, breakpointId);
16
+ const widgets = Object.keys(layout.items).map((id) => {
17
+ const rect = layout.items[id];
18
+ return {
19
+ id,
20
+ x: rect.c,
21
+ y: rect.r,
22
+ w: rect.w,
23
+ h: Math.max(rect.h, MIN_BLOCK_ROWS),
24
+ minH: MIN_BLOCK_ROWS,
25
+ filled: rect.fill === true
26
+ };
27
+ });
28
+ return {
29
+ options: {
30
+ column: layout.grid.cols,
31
+ cellHeight: layout.grid.rowUnit,
32
+ // GridStack applies margin on each side of a widget; halving gap achieves
33
+ // the same visual spacing as CSS gap. May be fractional for odd gap values.
34
+ margin: layout.grid.gap / 2,
35
+ // Row-aligned MVP: gravity on (compaction) so reordering pulls blocks up
36
+ // and never leaves empty rows. float:true would allow free/masonry
37
+ // placement, producing the "weird gaps" seen in portal rendering.
38
+ float: false,
39
+ // OFF: the merchant owns cell height via the resize handle. Whitespace is
40
+ // avoided by a pure-CSS fill chain in the adapter, not content measurement
41
+ // (which proved circular and caused unbounded grow loops).
42
+ sizeToContent: false
43
+ },
44
+ widgets
45
+ };
46
+ }
47
+ export {
48
+ MIN_BLOCK_ROWS as M,
49
+ MIN_BLOCK_PX as a,
50
+ projectToGridStack as p,
51
+ resolveActiveBreakpoint as r
52
+ };
package/dist/react.js CHANGED
@@ -6,7 +6,7 @@ import React, { useSyncExternalStore, createContext, useState, useContext as use
6
6
  import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-VhmfGB3N.js";
7
7
  import { t } from "./block-VhmfGB3N.js";
8
8
  import { createRoot } from "react-dom/client";
9
- import { a as createEditorBridge } from "./bridge-w5KQ-czl.js";
9
+ import { c as createEditorBridge } from "./bridge-D838SWmN.js";
10
10
  function toState(signal) {
11
11
  const subscribe = (callback) => {
12
12
  const dispose = effect(() => {
@@ -1,6 +1,7 @@
1
1
  import { ReadonlySignal, Signal } from '@preact/signals-core';
2
2
  import { Block, BlockInstance } from './block';
3
3
  import { RouterService } from './services/router';
4
+ import { LayoutDocument, LayoutEngineId } from './layout';
4
5
  export type ThemeSurface = "page" | "overlay";
5
6
  export type GlobalStyleColors = {
6
7
  accent: string;
@@ -14,6 +15,17 @@ export type GlobalStyleColors = {
14
15
  background: string;
15
16
  };
16
17
  export type ThemeType = "neutral" | "warm" | "cold";
18
+ /**
19
+ * Which layout engine renders this theme. Absent is treated as "legacy" so
20
+ * existing themes need no migration. "grid-v1" opts the theme into the
21
+ * grid-based layout system (grid rendering + arrange mode + the layout block
22
+ * wrapper); "legacy" is the classic stacked/flex editing experience.
23
+ *
24
+ * Built by extending the real engine ids ({@link LayoutEngineId}) with the
25
+ * `"legacy"` sentinel (= layout system off). Adding a new engine format only
26
+ * requires touching `LayoutEngineId` in `layout/types.ts`.
27
+ */
28
+ export type LayoutEngine = LayoutEngineId | "legacy";
17
29
  export type GlobalStyles = {
18
30
  volume: "compact" | "comfort" | "spacious";
19
31
  style: "bare" | "ghost" | "tinted" | "solid" | "layered";
@@ -23,10 +35,13 @@ export type GlobalStyles = {
23
35
  theme: "preset" | "custom";
24
36
  themeType: ThemeType;
25
37
  colors: GlobalStyleColors;
38
+ /** Opt-in layout engine version. Omitted/undefined => legacy. */
39
+ layoutEngine?: LayoutEngine;
26
40
  };
27
41
  export declare const DEFAULT_GLOBAL_STYLES: GlobalStyles;
28
42
  export type ThemeSurfaceState = {
29
43
  blocks: Signal<BlockInstance[]>;
44
+ layout: Signal<LayoutDocument | null>;
30
45
  };
31
46
  export type TranslationMode = "override" | "default";
32
47
  export type TranslationScope = {
@@ -77,6 +92,7 @@ export declare function indexOverrides(overrides: TranslationOverride[]): {
77
92
  export declare function createThemeState(deps: {
78
93
  resolve: (surface: ThemeSurface, path: string) => Promise<{
79
94
  blocks: Block[];
95
+ layout?: LayoutDocument | null;
80
96
  } | null>;
81
97
  translations?: {
82
98
  resolveTranslations: (locale: string) => Promise<TranslationOverride[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"theme-state.d.ts","sourceRoot":"","sources":["../src/theme-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAIL,KAAK,KAAK,EAEV,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,SAAS,GAA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MAAM,CAAC,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAChD,CAmBA;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,CACP,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC;QAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACzE,YAAY,CAAC,EAAE;QACb,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;KACzE,CAAC;IACF,mBAAmB,CAAC,EAAE,YAAY,CAAC;IACnC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;CAC9E,GAAG,UAAU,CAwLb"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=theme-state.layout.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-state.layout.test.d.ts","sourceRoot":"","sources":["../src/theme-state.layout.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=theme-state.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-state.test.d.ts","sourceRoot":"","sources":["../src/theme-state.test.ts"],"names":[],"mappings":""}
package/dist/vue.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { customRef, toValue, watchEffect, defineComponent, ref, getCurrentInstance, onMounted, provide, h, renderSlot, inject, computed, useHost, defineCustomElement, triggerRef, render, shallowRef } from "vue";
2
2
  import { effect, signal, injectContext, provideContext, createCeRenderer, attachEmptyTracking } from "@juo/blocks";
3
3
  import { hasRenderedContent } from "@juo/blocks";
4
- import { c as createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-w5KQ-czl.js";
4
+ import { b as createRegisterBlockTranslationKeysMessage, c as createEditorBridge } from "./bridge-D838SWmN.js";
5
5
  const signalsMap = /* @__PURE__ */ new WeakMap();
6
6
  function toSignal(ref2) {
7
7
  if (!signalsMap.has(ref2)) {
@@ -1,3 +1,4 @@
1
+ import { LayoutController } from './layout/layout-controller';
1
2
  export default class ExtensionRoot extends HTMLElement {
2
3
  private state;
3
4
  private themeState;
@@ -16,6 +17,16 @@ export default class ExtensionRoot extends HTMLElement {
16
17
  */
17
18
  private unresolvedNames;
18
19
  private unregisterListener?;
20
+ private static scopeCounter;
21
+ private scopeId;
22
+ /**
23
+ * Pluggable layout strategy. Runtime default renders the settled CSS-Grid/flex
24
+ * view; the editor subclass swaps in a controller that adds the drag/resize
25
+ * adapter path. ExtensionRoot owns block rendering — the controller owns all
26
+ * layout side-effects on this host.
27
+ */
28
+ protected layout: LayoutController;
29
+ private getScopeId;
19
30
  /**
20
31
  * Optional function to wrap each rendered block element.
21
32
  * Called with the rendered block HTMLElement, must return an HTMLElement.
@@ -26,8 +37,45 @@ export default class ExtensionRoot extends HTMLElement {
26
37
  blockWrapper: ((rendered: HTMLElement) => HTMLElement) | null;
27
38
  static get observedAttributes(): string[];
28
39
  constructor();
29
- private wrapperCache;
30
- private withWrapper;
40
+ /**
41
+ * Rendered top-level children cached by stable block id.
42
+ *
43
+ * Keying on id (not BlockInstance identity) is what keeps entering layout
44
+ * mode cheap: a PROVIDE_THEME_STATE that re-materialises the same blocks
45
+ * into fresh instance objects reuses the existing wrapper element instead of
46
+ * recreating the whole subtree — which would otherwise tear down and
47
+ * re-request context for every nested `juo-text` and rip GridStack's managed
48
+ * elements out from under it.
49
+ *
50
+ * `render` is the memoised withWrapper closure (owns a stable outer wrapper
51
+ * element). `signature` is a content hash of the last-rendered block; when
52
+ * it is unchanged (e.g. only `canvasMode`/layout changed) we return the
53
+ * cached element without re-rendering at all. Any real content change —
54
+ * props/slots edited in place, a stub upgrading to its real definition at
55
+ * any depth — flips the signature and forces a re-render.
56
+ */
57
+ private childCache;
58
+ /**
59
+ * The layout engine the cached wrappers were built under. `withWrapper`
60
+ * (block.ts) picks the wrapper *element* (legacy chrome vs. minimal layout
61
+ * wrapper) once, at creation, from `layoutSystemEnabled`. The child cache
62
+ * keys on block id and reuses that memoised closure, so a live engine switch
63
+ * would otherwise keep the stale wrapper tag until a full refresh. Tracking
64
+ * the engine here lets us drop the cache when it flips, forcing fresh
65
+ * closures (and thus the correct wrapper element) on the next render.
66
+ */
67
+ private childCacheEngine;
68
+ /**
69
+ * Content hash of a block subtree: type, props, slot structure and the
70
+ * stub/real state of every node. Identity is deliberately excluded so a
71
+ * re-materialised-but-identical tree reuses its element; stub flags are
72
+ * included so a late-registered definition still re-renders even when its
73
+ * serialised props are unchanged.
74
+ */
75
+ private static signatureOf;
76
+ private renderChild;
77
+ /** Drop cached children whose ids are no longer rendered to avoid leaks. */
78
+ private pruneChildCache;
31
79
  private getSurface;
32
80
  private setStateFromThemeState;
33
81
  connectedCallback(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"ExtensionRoot.d.ts","sourceRoot":"","sources":["../../src/web-components/ExtensionRoot.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;IACpD,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,uBAAuB,CAAC,CAAa;IAC7C,OAAO,CAAC,aAAa,CAAC,CAAa;IACnC,OAAO,CAAC,aAAa,CAA0C;IAE/D;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,kBAAkB,CAAC,CAAa;IAExC;;;;;;OAMG;IACI,YAAY,EAAE,CAAC,CAAC,QAAQ,EAAE,WAAW,KAAK,WAAW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C,UAAU,CAOd;IAEJ;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB,CAAwB;IAEhD;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAiB1B,OAAO,CAAC,WAAW;IAsBnB,4EAA4E;IAC5E,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,sBAAsB;IAM9B,iBAAiB;IAuJjB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAiBzB,oBAAoB;CAoBrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,aAAa,CAAC;KACrC;CACF"}
@@ -0,0 +1,11 @@
1
+ import { default as ExtensionRoot } from '../ExtensionRoot';
2
+ /**
3
+ * Editor build of `juo-extension-root`. Identical to the runtime base except it
4
+ * swaps in the EditorLayoutController, which adds the drag/resize adapter path
5
+ * (and its `canvasMode` dependency). Keeping this in the editor bundle only is
6
+ * what keeps the editor layout-mode modules out of the storefront runtime.
7
+ */
8
+ export default class EditorExtensionRoot extends ExtensionRoot {
9
+ constructor();
10
+ }
11
+ //# sourceMappingURL=ExtensionRoot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExtensionRoot.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/ExtensionRoot.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAG7C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,aAAa;;CAK7D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ExtensionRoot.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExtensionRoot.test.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/ExtensionRoot.test.ts"],"names":[],"mappings":""}
@@ -9,6 +9,7 @@ export default class InlineText extends HTMLElement {
9
9
  private boundHandleClick;
10
10
  private lastValue;
11
11
  private dispose?;
12
+ private domInitialized;
12
13
  static get observedAttributes(): string[];
13
14
  constructor();
14
15
  connectedCallback(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"InlineText.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/InlineText.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAO,CAAC,YAAY,CAAsD;IAC1E,OAAO,CAAC,kBAAkB,CAAmC;IAC7D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,sBAAsB,CAAqC;IACnE,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,iBAAiB;IA0CjB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,oBAAoB;IAiD5B,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAwC;IAEpE,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,UAAU;IA+BlB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzB,oBAAoB;CASrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,UAAU,CAAC;KACxB;CACF"}
1
+ {"version":3,"file":"InlineText.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/InlineText.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAO,CAAC,YAAY,CAAsD;IAC1E,OAAO,CAAC,kBAAkB,CAAmC;IAC7D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,sBAAsB,CAAqC;IACnE,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,OAAO,CAAC,CAAa;IAI7B,OAAO,CAAC,cAAc,CAAS;IAE/B,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,iBAAiB;IA0CjB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,oBAAoB;IA2D5B,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAwC;IAEpE,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,UAAU;IA+BlB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzB,oBAAoB;CASrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,UAAU,CAAC;KACxB;CACF"}
@@ -0,0 +1,28 @@
1
+ import { LayoutApplyInputs, LayoutController, LayoutReactiveState } from '../layout/layout-controller';
2
+ /**
3
+ * Editor layout strategy: while layout (drag/resize) mode is active and a
4
+ * LayoutModeAdapter (GridStack) is registered, delegates layout to the adapter;
5
+ * otherwise falls back to the settled CSS-Grid/flex view via ViewLayoutController.
6
+ * Only ever loaded into the editor bundle — never the storefront runtime.
7
+ */
8
+ export declare class EditorLayoutController implements LayoutController {
9
+ private currentAdapter;
10
+ private readonly view;
11
+ private changeHandler;
12
+ readReactiveState(): LayoutReactiveState;
13
+ apply(host: HTMLElement, inputs: LayoutApplyInputs): void;
14
+ teardown(host: HTMLElement): void;
15
+ /**
16
+ * Idempotently unmount the currently-mounted LayoutModeAdapter. Swallows
17
+ * secondary teardown errors so a broken adapter can't wedge rendering.
18
+ */
19
+ private unmountAdapter;
20
+ /**
21
+ * Stable commit-time rects handler bound to `host`'s surface. Cached so the
22
+ * adapter always receives the same callback reference (created once per
23
+ * controller/host, mirroring the previous per-element handler).
24
+ */
25
+ private handlerFor;
26
+ private surfaceOf;
27
+ }
28
+ //# sourceMappingURL=editor-layout-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-layout-controller.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/editor-layout-controller.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AAQrC;;;;;GAKG;AACH,qBAAa,sBAAuB,YAAW,gBAAgB;IAC7D,OAAO,CAAC,cAAc,CAAkC;IACxD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA8B;IACnD,OAAO,CAAC,aAAa,CAAyD;IAE9E,iBAAiB,IAAI,mBAAmB;IAIxC,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI;IA2DzD,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAKjC;;;OAGG;IACH,OAAO,CAAC,cAAc;IAUtB;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAgBlB,OAAO,CAAC,SAAS;CAGlB"}
@@ -0,0 +1,3 @@
1
+ import { LayoutModeAdapter } from '../layout-mode-adapter';
2
+ export declare function createGridStackAdapter(): LayoutModeAdapter;
3
+ //# sourceMappingURL=gridstack-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gridstack-adapter.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/gridstack-adapter.ts"],"names":[],"mappings":"AAkBA,OAAO,EAIL,KAAK,iBAAiB,EAGvB,MAAM,wBAAwB,CAAC;AAuehC,wBAAgB,sBAAsB,IAAI,iBAAiB,CA8c1D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gridstack-adapter.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gridstack-adapter.test.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/gridstack-adapter.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Run `fn` (a mode swap) inside a View Transition when supported and motion is
3
+ * allowed; otherwise apply it instantly. Assigns per-block `view-transition-name`s
4
+ * so each block morphs from its old rect to its new rect, clearing them once the
5
+ * transition finishes. Used for EXIT/settle and the button toggle — entry-from-grab
6
+ * deliberately bypasses this for instant continuity.
7
+ */
8
+ export declare function withMorphTransition(fn: () => void): Promise<void>;
9
+ /**
10
+ * Enter layout mode from a click on a block's arrange handle ("click to arm").
11
+ * The mode swap is a smooth View Transition morph; the user then drags/resizes
12
+ * the block natively in GridStack. When `block` is given (the exact wrapper the
13
+ * operator grabbed), it is scrolled into view as part of the morph and then
14
+ * plays a one-shot "pop" so it doesn't get lost across the reflow. Passing the
15
+ * element — not an id — avoids targeting the wrong node when blocks share an id.
16
+ * Layout mode persists until an explicit exit (click-away / Escape / button);
17
+ * exit listeners are bound reactively from `canvasMode` in `initMorphController`.
18
+ */
19
+ export declare function enterLayout(block?: HTMLElement): void;
20
+ /** Smoothly morph back to view mode (click-away / Escape / button toggle off). */
21
+ export declare function exitToView(): void;
22
+ /**
23
+ * Wire the controller's lifecycle. Idempotent — safe to call on every load.
24
+ *
25
+ * - Binds/unbinds the click-away + Escape exit listeners from `canvasMode`, so
26
+ * exit works regardless of how layout mode was entered (click-to-arm or the
27
+ * "Edit layout" button).
28
+ * - Tracks an "interacting" flag from the adapter's drag/resize lifecycle so a
29
+ * pointerdown that ends a gesture can't be mistaken for click-away.
30
+ */
31
+ export declare function initMorphController(): void;
32
+ //# sourceMappingURL=morph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"morph.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/morph.ts"],"names":[],"mappings":"AAuKA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCjE;AAyCD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAkBrD;AAED,kFAAkF;AAClF,wBAAgB,UAAU,IAAI,IAAI,CAMjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAa1C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=morph.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"morph.test.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/morph.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ import { BlockInstance } from '../../block';
2
+ import { LayoutDocument } from '../../layout';
3
+ /**
4
+ * Reactive inputs a LayoutController reads inside the ExtensionRoot effect's
5
+ * TRACKED scope. Keeping these behind `readReactiveState()` is what lets the
6
+ * editor controller subscribe the effect to `canvasMode` while the runtime
7
+ * controller subscribes to nothing.
8
+ */
9
+ export type LayoutReactiveState = {
10
+ /** Whether the editor layout (drag/resize) mode is active. Always false at runtime. */
11
+ mode: boolean;
12
+ };
13
+ /**
14
+ * Everything a LayoutController needs to lay out a host's children. Assembled
15
+ * by ExtensionRoot each render pass; `children` are the already-rendered,
16
+ * cached block elements in render order (parallel to `extensionBlocks`).
17
+ */
18
+ export type LayoutApplyInputs = {
19
+ extensionBlocks: BlockInstance[];
20
+ children: HTMLElement[];
21
+ layoutDoc: LayoutDocument | null;
22
+ /** Stable per-host scope id for the generated grid stylesheet. */
23
+ scopeId: string;
24
+ reactive: LayoutReactiveState;
25
+ /**
26
+ * Whether the active theme opts into the grid layout engine
27
+ * (`GlobalStyles.layoutEngine === "grid-v1"`). The `grid-layout` attribute is
28
+ * a per-surface CAPABILITY flag; this is the theme-level ON switch. Both must
29
+ * be true for the grid path to run — legacy themes render the flex/stacked
30
+ * view even on grid-capable surfaces.
31
+ */
32
+ layoutEngineEnabled: boolean;
33
+ };
34
+ /**
35
+ * Pluggable layout strategy for ExtensionRoot. The runtime variant applies a
36
+ * CSS-Grid/flex view; the editor variant additionally delegates to a
37
+ * LayoutModeAdapter (GridStack) while in layout mode. ExtensionRoot owns block
38
+ * rendering; the controller owns all layout/geometry side-effects on the host.
39
+ */
40
+ export interface LayoutController {
41
+ /**
42
+ * Called in the effect's TRACKED scope so any signal reads register as
43
+ * effect dependencies (e.g. the editor controller reads `canvasMode` here so
44
+ * entering/exiting layout mode re-runs the effect).
45
+ */
46
+ readReactiveState(): LayoutReactiveState;
47
+ /** Called in untracked scope: apply layout to `host`. */
48
+ apply(host: HTMLElement, inputs: LayoutApplyInputs): void;
49
+ /**
50
+ * Idempotent: undo any persistent layout side-effect (adapter mount, grid
51
+ * containment). Called on empty/error render branches and on disconnect.
52
+ */
53
+ teardown(host: HTMLElement): void;
54
+ }
55
+ //# sourceMappingURL=layout-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-controller.d.ts","sourceRoot":"","sources":["../../../src/web-components/layout/layout-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,uFAAuF;IACvF,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,aAAa,EAAE,CAAC;IACjC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,SAAS,EAAE,cAAc,GAAG,IAAI,CAAC;IACjC,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;;;;;;OAMG;IACH,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,iBAAiB,IAAI,mBAAmB,CAAC;IACzC,yDAAyD;IACzD,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC1D;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC"}
@@ -0,0 +1,17 @@
1
+ import { LayoutApplyInputs, LayoutController, LayoutReactiveState } from './layout-controller';
2
+ /**
3
+ * Runtime layout strategy: renders the settled CSS-Grid view (or a flex column
4
+ * when no grid layout applies). No editor/canvas dependencies — this is the
5
+ * only layout code the storefront runtime bundle pulls in.
6
+ *
7
+ * Stateless: empty-block collapse is handled entirely in the generated CSS (an
8
+ * empty block sets `display:none` and row spacing is a per-item margin, so its
9
+ * row closes with no ghost gap), so there is nothing to observe or recompute at
10
+ * runtime.
11
+ */
12
+ export declare class ViewLayoutController implements LayoutController {
13
+ readReactiveState(): LayoutReactiveState;
14
+ apply(host: HTMLElement, inputs: LayoutApplyInputs): void;
15
+ teardown(host: HTMLElement): void;
16
+ }
17
+ //# sourceMappingURL=view-layout-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-layout-controller.d.ts","sourceRoot":"","sources":["../../../src/web-components/layout/view-layout-controller.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;GASG;AACH,qBAAa,oBAAqB,YAAW,gBAAgB;IAC3D,iBAAiB,IAAI,mBAAmB;IAIxC,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAyBzD,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;CAGlC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=view-layout-controller.test.d.ts.map