@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
@@ -1,8 +1,37 @@
1
+ const BLOCK_WRAPPER_TAG = "juo-editor-block-wrapper";
2
+ const LAYOUT_BLOCK_WRAPPER_TAG = "juo-editor-layout-block-wrapper";
3
+ const WRAPPER_TAG_NAMES = /* @__PURE__ */ new Set([
4
+ BLOCK_WRAPPER_TAG.toUpperCase(),
5
+ LAYOUT_BLOCK_WRAPPER_TAG.toUpperCase()
6
+ ]);
7
+ const WRAPPER_SELECTOR = `${BLOCK_WRAPPER_TAG}[data-block-id], ${LAYOUT_BLOCK_WRAPPER_TAG}[data-block-id]`;
8
+ function isBlockWrapperTag(tagName) {
9
+ return WRAPPER_TAG_NAMES.has(tagName.toUpperCase());
10
+ }
11
+ function getBlockLabel(block) {
12
+ return block.definition.displayName ?? block.definition.name;
13
+ }
14
+ function resolveOutlineTarget(slotted) {
15
+ const root = slotted.shadowRoot ?? slotted;
16
+ let el = root.firstElementChild;
17
+ while (el) {
18
+ if (el.tagName === "STYLE") {
19
+ el = el.nextElementSibling;
20
+ continue;
21
+ }
22
+ if (getComputedStyle(el).display === "contents") {
23
+ el = el.firstElementChild;
24
+ continue;
25
+ }
26
+ return el;
27
+ }
28
+ return slotted.shadowRoot ? null : slotted;
29
+ }
1
30
  function isEditorMessage(message) {
2
- return message.type === "PROVIDE_THEME_STATE" || message.type === "PROVIDE_TRANSLATION_OVERRIDES" || message.type === "SELECT_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "ADD_BLOCK" || message.type === "REMOVE_BLOCK" || message.type === "MOVE_BLOCK" || message.type === "SET_BLOCK_PRESET" || message.type === "SET_LOCALE" || message.type === "SET_GLOBAL_STYLES" || message.type === "PROVIDE_GLOBAL_STYLES" || message.type === "SCROLL_SYNC" || message.type === "REQUEST_CONTENT_HEIGHT" || message.type === "ADD_BLOCK_MENU_CLOSED";
31
+ return message.type === "PROVIDE_THEME_STATE" || message.type === "PROVIDE_TRANSLATION_OVERRIDES" || message.type === "SELECT_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "ADD_BLOCK" || message.type === "REMOVE_BLOCK" || message.type === "MOVE_BLOCK" || message.type === "SET_BLOCK_PRESET" || message.type === "SET_LOCALE" || message.type === "SET_GLOBAL_STYLES" || message.type === "PROVIDE_GLOBAL_STYLES" || message.type === "SCROLL_SYNC" || message.type === "REQUEST_CONTENT_HEIGHT" || message.type === "ADD_BLOCK_MENU_CLOSED" || message.type === "PROVIDE_LAYOUT" || message.type === "PROVIDE_LAYOUT_DOCUMENT" || message.type === "SET_LAYOUTING_MODE";
3
32
  }
4
33
  function isIframeMessage(message) {
5
- return message.type === "SELECT_BLOCK" || message.type === "IFRAME_READY" || message.type === "REGISTER_BLOCKS" || message.type === "REGISTER_ROUTES" || message.type === "REGISTER_OVERLAYS" || message.type === "REMOVE_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "REQUEST_THEME_STATE" || message.type === "UPSERT_THEME_STATE" || message.type === "REQUEST_TRANSLATION_OVERRIDES" || message.type === "UPDATE_BLOCK_TRANSLATION" || message.type === "REGISTER_BLOCK_TRANSLATION_KEYS" || message.type === "FOCUS_INLINE_TEXT" || message.type === "REQUEST_GLOBAL_STYLES" || message.type === "PROVIDE_INITIAL_GLOBAL_STYLES" || message.type === "REPORT_CONTENT_HEIGHT" || message.type === "SCROLL_SYNC" || message.type === "OPEN_ADD_BLOCK_MENU";
34
+ return message.type === "SELECT_BLOCK" || message.type === "IFRAME_READY" || message.type === "REGISTER_BLOCKS" || message.type === "REGISTER_ROUTES" || message.type === "REMOVE_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "REQUEST_THEME_STATE" || message.type === "UPSERT_THEME_STATE" || message.type === "REQUEST_TRANSLATION_OVERRIDES" || message.type === "UPDATE_BLOCK_TRANSLATION" || message.type === "REGISTER_BLOCK_TRANSLATION_KEYS" || message.type === "FOCUS_INLINE_TEXT" || message.type === "REQUEST_GLOBAL_STYLES" || message.type === "PROVIDE_INITIAL_GLOBAL_STYLES" || message.type === "REPORT_CONTENT_HEIGHT" || message.type === "SCROLL_SYNC" || message.type === "OPEN_ADD_BLOCK_MENU" || message.type === "REQUEST_CLOSE_ADD_BLOCK_MENU" || message.type === "LAYOUT_COMMAND" || message.type === "LAYOUTING_MODE_CHANGED" || message.type === "REPORT_BLOCK_CONTENT_SIZE";
6
35
  }
7
36
  function createProvideThemeStateMessage(payload) {
8
37
  return {
@@ -141,13 +170,6 @@ function createRegisterRoutesMessage(payload) {
141
170
  timestamp: Date.now()
142
171
  };
143
172
  }
144
- function createRegisterOverlaysMessage(payload) {
145
- return {
146
- type: "REGISTER_OVERLAYS",
147
- payload,
148
- timestamp: Date.now()
149
- };
150
- }
151
173
  function createSetGlobalStylesMessage(payload) {
152
174
  return {
153
175
  type: "SET_GLOBAL_STYLES",
@@ -204,6 +226,55 @@ function createAddBlockMenuClosedMessage(payload) {
204
226
  timestamp: Date.now()
205
227
  };
206
228
  }
229
+ function createRequestCloseAddBlockMenuMessage() {
230
+ return {
231
+ type: "REQUEST_CLOSE_ADD_BLOCK_MENU",
232
+ payload: {},
233
+ timestamp: Date.now()
234
+ };
235
+ }
236
+ function createProvideLayoutMessage(payload) {
237
+ return {
238
+ type: "PROVIDE_LAYOUT",
239
+ payload,
240
+ timestamp: Date.now()
241
+ };
242
+ }
243
+ function createLayoutCommandMessage(payload) {
244
+ return {
245
+ type: "LAYOUT_COMMAND",
246
+ payload,
247
+ timestamp: Date.now()
248
+ };
249
+ }
250
+ function createProvideLayoutDocumentMessage(payload) {
251
+ return {
252
+ type: "PROVIDE_LAYOUT_DOCUMENT",
253
+ payload,
254
+ timestamp: Date.now()
255
+ };
256
+ }
257
+ function createSetLayoutingModeMessage(payload) {
258
+ return {
259
+ type: "SET_LAYOUTING_MODE",
260
+ payload,
261
+ timestamp: Date.now()
262
+ };
263
+ }
264
+ function createLayoutingModeChangedMessage(payload) {
265
+ return {
266
+ type: "LAYOUTING_MODE_CHANGED",
267
+ payload,
268
+ timestamp: Date.now()
269
+ };
270
+ }
271
+ function createReportBlockContentSizeMessage(payload) {
272
+ return {
273
+ type: "REPORT_BLOCK_CONTENT_SIZE",
274
+ payload,
275
+ timestamp: Date.now()
276
+ };
277
+ }
207
278
  let bridgeInstance = null;
208
279
  function getEditorBridge() {
209
280
  return bridgeInstance;
@@ -267,11 +338,13 @@ function createEditorBridge() {
267
338
  });
268
339
  const isAddBlockButton = path.some((node) => {
269
340
  if (!(node instanceof HTMLElement)) return false;
270
- return node.classList.contains("block-wrapper__add-btn") || node.classList.contains("block-wrapper__add-btn-inner") || node.classList.contains("block-wrapper__add-btn-surface") || node.classList.contains("block-wrapper__add-btn-plus") || node.classList.contains("block-wrapper__add-btn-text");
341
+ return node.classList.contains("block-wrapper__add-btn") || node.classList.contains("block-wrapper__add-btn-inner") || node.classList.contains("block-wrapper__add-btn-surface") || node.classList.contains("block-wrapper__add-btn-plus") || node.classList.contains("block-wrapper__add-btn-text") || // Grid layout toolbar's "add block below" button.
342
+ node.classList.contains("layout-block-wrapper__tool-btn--add");
271
343
  });
272
344
  if (isAddBlockButton) {
273
345
  return;
274
346
  }
347
+ sendMessage(createRequestCloseAddBlockMenuMessage());
275
348
  const isEditorUI = path.some((node) => {
276
349
  if (!(node instanceof HTMLElement)) return false;
277
350
  let current = node;
@@ -287,7 +360,7 @@ function createEditorBridge() {
287
360
  });
288
361
  let blockWrapper = null;
289
362
  for (const node of path) {
290
- if (node instanceof HTMLElement && node.tagName === "JUO-EDITOR-BLOCK-WRAPPER") {
363
+ if (node instanceof HTMLElement && isBlockWrapperTag(node.tagName)) {
291
364
  blockWrapper = node;
292
365
  break;
293
366
  }
@@ -399,7 +472,7 @@ function createEditorBridge() {
399
472
  clearTimeout(pending.timer);
400
473
  pendingRequests.delete(data.payload.requestId);
401
474
  pending.resolve(
402
- data.payload.blocks != null ? { blocks: data.payload.blocks } : null
475
+ data.payload.blocks != null ? { blocks: data.payload.blocks, layout: data.payload.layout ?? null } : null
403
476
  );
404
477
  }
405
478
  } else if (data.type === "PROVIDE_TRANSLATION_OVERRIDES" && data.payload.requestId) {
@@ -457,6 +530,7 @@ function createEditorBridge() {
457
530
  let ghostScrollStyleEl = null;
458
531
  let ghostScrollObserver = null;
459
532
  let suppressScrollReport = false;
533
+ let scrollPreserveActive = false;
460
534
  function reportContentHeight() {
461
535
  var _a;
462
536
  if (!isEditorMode) return;
@@ -467,12 +541,32 @@ function createEditorBridge() {
467
541
  sendMessage(createReportContentHeightMessage({ height }));
468
542
  }
469
543
  function handleScrollEvent() {
544
+ if (scrollPreserveActive) return;
470
545
  if (suppressScrollReport) {
471
546
  suppressScrollReport = false;
472
547
  return;
473
548
  }
474
549
  sendMessage(createScrollSyncMessage({ scrollY: window.scrollY }));
475
550
  }
551
+ function preserveScrollAcrossReflow() {
552
+ if (!isEditorMode) return;
553
+ const targetY = window.scrollY;
554
+ scrollPreserveActive = true;
555
+ const raf = typeof requestAnimationFrame === "function" ? (cb) => {
556
+ requestAnimationFrame(() => cb());
557
+ } : (cb) => {
558
+ setTimeout(cb, 0);
559
+ };
560
+ const restore = () => window.scrollTo(0, targetY);
561
+ raf(() => {
562
+ restore();
563
+ raf(() => {
564
+ restore();
565
+ scrollPreserveActive = false;
566
+ sendMessage(createScrollSyncMessage({ scrollY: targetY }));
567
+ });
568
+ });
569
+ }
476
570
  if (isEditorMode) {
477
571
  ghostScrollStyleEl = document.createElement("style");
478
572
  ghostScrollStyleEl.textContent = "html { scrollbar-width: none; } html::-webkit-scrollbar { display: none; }";
@@ -520,45 +614,56 @@ function createEditorBridge() {
520
614
  isEditorMode,
521
615
  sendMessage,
522
616
  onMessage,
523
- getSelectedBlockId: () => selectedBlockId.value,
524
617
  onBlockPresetChange,
525
618
  requestThemeState,
526
619
  upsertThemeState,
527
620
  requestTranslationOverrides,
528
621
  requestGlobalStyles,
622
+ preserveScrollAcrossReflow,
529
623
  destroy
530
624
  };
531
625
  return bridgeInstance;
532
626
  }
533
627
  export {
534
- createUpsertThemeStateMessage as A,
535
- getEditorBridge as B,
536
- isEditorMessage as C,
537
- isIframeMessage as D,
538
- createFocusInlineTextMessage as a,
539
- createUpdateBlockTranslationMessage as b,
628
+ createRequestGlobalStylesMessage as A,
629
+ createRequestThemeStateMessage as B,
630
+ createRequestTranslationOverridesMessage as C,
631
+ createScrollSyncMessage as D,
632
+ createSetBlockPresetMessage as E,
633
+ createSetGlobalStylesMessage as F,
634
+ createSetLayoutingModeMessage as G,
635
+ createSetLocaleMessage as H,
636
+ createUpdateBlockPropsMessage as I,
637
+ createUpsertThemeStateMessage as J,
638
+ getEditorBridge as K,
639
+ LAYOUT_BLOCK_WRAPPER_TAG as L,
640
+ isEditorMessage as M,
641
+ isIframeMessage as N,
642
+ WRAPPER_SELECTOR as W,
643
+ createSelectBlockMessage as a,
644
+ createRegisterBlockTranslationKeysMessage as b,
540
645
  createEditorBridge as c,
541
- createOpenAddBlockMenuMessage as d,
542
- createRemoveBlockMessage as e,
543
- createRegisterBlocksMessage as f,
544
- createRegisterOverlaysMessage as g,
545
- createRegisterRoutesMessage as h,
546
- createAddBlockMenuClosedMessage as i,
547
- createAddBlockMessage as j,
548
- createMoveBlockMessage as k,
549
- createProvideGlobalStylesMessage as l,
550
- createProvideInitialGlobalStylesMessage as m,
551
- createProvideThemeStateMessage as n,
552
- createProvideTranslationOverridesMessage as o,
553
- createRegisterBlockTranslationKeysMessage as p,
554
- createReportContentHeightMessage as q,
555
- createRequestGlobalStylesMessage as r,
556
- createRequestThemeStateMessage as s,
557
- createRequestTranslationOverridesMessage as t,
558
- createScrollSyncMessage as u,
559
- createSelectBlockMessage as v,
560
- createSetBlockPresetMessage as w,
561
- createSetGlobalStylesMessage as x,
562
- createSetLocaleMessage as y,
563
- createUpdateBlockPropsMessage as z
646
+ createFocusInlineTextMessage as d,
647
+ createUpdateBlockTranslationMessage as e,
648
+ createOpenAddBlockMenuMessage as f,
649
+ createRemoveBlockMessage as g,
650
+ getBlockLabel as h,
651
+ isBlockWrapperTag as i,
652
+ createLayoutCommandMessage as j,
653
+ createRegisterBlocksMessage as k,
654
+ createRegisterRoutesMessage as l,
655
+ createAddBlockMenuClosedMessage as m,
656
+ createAddBlockMessage as n,
657
+ createLayoutingModeChangedMessage as o,
658
+ createMoveBlockMessage as p,
659
+ createProvideGlobalStylesMessage as q,
660
+ resolveOutlineTarget as r,
661
+ createProvideInitialGlobalStylesMessage as s,
662
+ createProvideLayoutDocumentMessage as t,
663
+ createProvideLayoutMessage as u,
664
+ createProvideThemeStateMessage as v,
665
+ createProvideTranslationOverridesMessage as w,
666
+ createReportBlockContentSizeMessage as x,
667
+ createReportContentHeightMessage as y,
668
+ createRequestCloseAddBlockMenuMessage as z
564
669
  };
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,CAAC,OAAO,EAAE,SAAS,IAAI,OAAO,GAAG;IAAE,WAAW,EAAE,SAAS,CAAA;CAAE,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,SAAS,OAAO,CACnE,MAAM,CAAC,EACP,MAAM,CAAC,CACR,GACG,CAAC,GACD,KAAK,CAAC;AAEV;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,OAAO,OAAO,KAC5C,OAAO,CAAC,OAAO,GAAG,EAAE,SAAS,CAAC,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,SAAS,IAAI,CACvC,KAAK,EAAE,SAAS,EAChB,WAAW,CAAC,EAAE,MAAM,IAAI,KACrB,IAAI,CAAC;AAEV;;;;;;;;;GASG;AACH,qBAAa,mBAAmB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,KAAK;aAEpD,OAAO,EAAE,CAAC;aACV,QAAQ,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;aACzC,SAAS,CAAC,EAAE,OAAO;gBAFnB,OAAO,EAAE,CAAC,EACV,QAAQ,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EACzC,SAAS,CAAC,EAAE,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