@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.
- package/dist/ExtensionRoot-CRJx0Dtr.js +378 -0
- package/dist/block.d.ts +0 -50
- package/dist/block.d.ts.map +1 -1
- package/dist/{bridge-r7Yk8fjY.js → bridge-D838SWmN.js} +147 -42
- package/dist/context.d.ts.map +1 -1
- package/dist/core.js +1120 -2157
- package/dist/css-runtime-DWytAzZ5.js +1532 -0
- package/dist/editor/bridge.d.ts +8 -7
- package/dist/editor/bridge.d.ts.map +1 -1
- package/dist/editor/canvas-mode-signal.d.ts +22 -0
- package/dist/editor/canvas-mode-signal.d.ts.map +1 -0
- package/dist/editor/canvas-mode.d.ts +15 -0
- package/dist/editor/canvas-mode.d.ts.map +1 -0
- package/dist/editor/canvas-mode.test.d.ts +2 -0
- package/dist/editor/canvas-mode.test.d.ts.map +1 -0
- package/dist/editor/components.d.ts +113 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/components.test.d.ts.map +1 -1
- package/dist/editor/handler.d.ts.map +1 -1
- package/dist/editor/handler.test.d.ts +2 -0
- package/dist/editor/handler.test.d.ts.map +1 -0
- package/dist/editor/layout-command-emitter.d.ts +31 -0
- package/dist/editor/layout-command-emitter.d.ts.map +1 -0
- package/dist/editor/layout-command-emitter.test.d.ts +2 -0
- package/dist/editor/layout-command-emitter.test.d.ts.map +1 -0
- package/dist/editor/layout-system-signal.d.ts +21 -0
- package/dist/editor/layout-system-signal.d.ts.map +1 -0
- package/dist/editor/main.d.ts +2 -2
- package/dist/editor/main.d.ts.map +1 -1
- package/dist/editor/messages.d.ts +90 -14
- package/dist/editor/messages.d.ts.map +1 -1
- package/dist/editor/surface-context.d.ts +7 -0
- package/dist/editor/surface-context.d.ts.map +1 -0
- package/dist/editor/surface-context.test.d.ts +2 -0
- package/dist/editor/surface-context.test.d.ts.map +1 -0
- package/dist/editor/wrapper-shared.d.ts +31 -0
- package/dist/editor/wrapper-shared.d.ts.map +1 -0
- package/dist/editor.js +887 -88
- package/dist/flows/WorkflowService.d.ts +2 -0
- package/dist/flows/WorkflowService.d.ts.map +1 -1
- package/dist/gridstack-adapter-DreG3XnB.js +5490 -0
- package/dist/layout/css-runtime.d.ts +41 -0
- package/dist/layout/css-runtime.d.ts.map +1 -0
- package/dist/layout/css-runtime.test.d.ts +2 -0
- package/dist/layout/css-runtime.test.d.ts.map +1 -0
- package/dist/layout/derive.d.ts +4 -0
- package/dist/layout/derive.d.ts.map +1 -0
- package/dist/layout/derive.test.d.ts +2 -0
- package/dist/layout/derive.test.d.ts.map +1 -0
- package/dist/layout/dividers.d.ts +34 -0
- package/dist/layout/dividers.d.ts.map +1 -0
- package/dist/layout/dividers.test.d.ts +2 -0
- package/dist/layout/dividers.test.d.ts.map +1 -0
- package/dist/layout/engine.d.ts +3 -0
- package/dist/layout/engine.d.ts.map +1 -0
- package/dist/layout/engine.test.d.ts +2 -0
- package/dist/layout/engine.test.d.ts.map +1 -0
- package/dist/layout/grid-utils.d.ts +57 -0
- package/dist/layout/grid-utils.d.ts.map +1 -0
- package/dist/layout/grid-utils.test.d.ts +2 -0
- package/dist/layout/grid-utils.test.d.ts.map +1 -0
- package/dist/layout/index.d.ts +12 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.test.d.ts +2 -0
- package/dist/layout/index.test.d.ts.map +1 -0
- package/dist/layout/insert.d.ts +31 -0
- package/dist/layout/insert.d.ts.map +1 -0
- package/dist/layout/insert.test.d.ts +2 -0
- package/dist/layout/insert.test.d.ts.map +1 -0
- package/dist/layout/project-css.d.ts +6 -0
- package/dist/layout/project-css.d.ts.map +1 -0
- package/dist/layout/project-css.test.d.ts +2 -0
- package/dist/layout/project-css.test.d.ts.map +1 -0
- package/dist/layout/project-gridstack.d.ts +50 -0
- package/dist/layout/project-gridstack.d.ts.map +1 -0
- package/dist/layout/project-gridstack.test.d.ts +2 -0
- package/dist/layout/project-gridstack.test.d.ts.map +1 -0
- package/dist/layout/reconcile.d.ts +22 -0
- package/dist/layout/reconcile.d.ts.map +1 -0
- package/dist/layout/reconcile.test.d.ts +2 -0
- package/dist/layout/reconcile.test.d.ts.map +1 -0
- package/dist/layout/types.d.ts +118 -0
- package/dist/layout/types.d.ts.map +1 -0
- package/dist/layout-mode-adapter-BBd4JRQd.js +21 -0
- package/dist/main.d.ts +8 -4
- package/dist/main.d.ts.map +1 -1
- package/dist/morph-Dj-xvrwt.js +182 -0
- package/dist/preact.js +1 -1
- package/dist/project-gridstack-DYLMKSH1.js +52 -0
- package/dist/react.js +1 -1
- package/dist/services/customer/customerService.d.ts +2 -3
- package/dist/services/customer/customerService.d.ts.map +1 -1
- package/dist/services/customer/index.d.ts +0 -1
- package/dist/services/customer/index.d.ts.map +1 -1
- package/dist/services/customer/types.d.ts +1 -4
- package/dist/services/customer/types.d.ts.map +1 -1
- package/dist/services/index.d.ts +0 -3
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/login/index.d.ts +1 -3
- package/dist/services/login/index.d.ts.map +1 -1
- package/dist/services/login/loginService.d.ts +2 -6
- package/dist/services/login/loginService.d.ts.map +1 -1
- package/dist/services/orders/adapter.d.ts +0 -2
- package/dist/services/orders/adapter.d.ts.map +1 -1
- package/dist/services/orders/index.d.ts +1 -1
- package/dist/services/orders/index.d.ts.map +1 -1
- package/dist/services/product/adapter.d.ts +2 -27
- package/dist/services/product/adapter.d.ts.map +1 -1
- package/dist/services/product/index.d.ts +1 -1
- package/dist/services/product/index.d.ts.map +1 -1
- package/dist/services/product/productService.d.ts.map +1 -1
- package/dist/services/product/types.d.ts +0 -68
- package/dist/services/product/types.d.ts.map +1 -1
- package/dist/services/subscription/adapter.d.ts +2 -77
- package/dist/services/subscription/adapter.d.ts.map +1 -1
- package/dist/services/subscription/index.d.ts +1 -1
- package/dist/services/subscription/index.d.ts.map +1 -1
- package/dist/services/subscription/subscriptionService.d.ts +6 -1
- package/dist/services/subscription/subscriptionService.d.ts.map +1 -1
- package/dist/services/subscription/types.d.ts +9 -220
- package/dist/services/subscription/types.d.ts.map +1 -1
- package/dist/theme-state.d.ts +17 -2
- package/dist/theme-state.d.ts.map +1 -1
- package/dist/theme-state.layout.test.d.ts +2 -0
- package/dist/theme-state.layout.test.d.ts.map +1 -0
- package/dist/theme-state.test.d.ts +2 -0
- package/dist/theme-state.test.d.ts.map +1 -0
- package/dist/utils/index.d.ts +0 -6
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/vue/block.d.ts.map +1 -1
- package/dist/vue.js +4 -25
- package/dist/web-components/ExtensionRoot.d.ts +50 -3
- package/dist/web-components/ExtensionRoot.d.ts.map +1 -1
- package/dist/web-components/editor/ExtensionRoot.d.ts +11 -0
- package/dist/web-components/editor/ExtensionRoot.d.ts.map +1 -0
- package/dist/web-components/editor/ExtensionRoot.test.d.ts +2 -0
- package/dist/web-components/editor/ExtensionRoot.test.d.ts.map +1 -0
- package/dist/web-components/editor/InlineText.d.ts +1 -0
- package/dist/web-components/editor/InlineText.d.ts.map +1 -1
- package/dist/web-components/editor/editor-layout-controller.d.ts +28 -0
- package/dist/web-components/editor/editor-layout-controller.d.ts.map +1 -0
- package/dist/web-components/editor/gridstack-adapter.d.ts +3 -0
- package/dist/web-components/editor/gridstack-adapter.d.ts.map +1 -0
- package/dist/web-components/editor/gridstack-adapter.test.d.ts +2 -0
- package/dist/web-components/editor/gridstack-adapter.test.d.ts.map +1 -0
- package/dist/web-components/editor/morph.d.ts +32 -0
- package/dist/web-components/editor/morph.d.ts.map +1 -0
- package/dist/web-components/editor/morph.test.d.ts +2 -0
- package/dist/web-components/editor/morph.test.d.ts.map +1 -0
- package/dist/web-components/layout/layout-controller.d.ts +55 -0
- package/dist/web-components/layout/layout-controller.d.ts.map +1 -0
- package/dist/web-components/layout/view-layout-controller.d.ts +17 -0
- package/dist/web-components/layout/view-layout-controller.d.ts.map +1 -0
- package/dist/web-components/layout/view-layout-controller.test.d.ts +2 -0
- package/dist/web-components/layout/view-layout-controller.test.d.ts.map +1 -0
- package/dist/web-components/layout-grid.d.ts +47 -0
- package/dist/web-components/layout-grid.d.ts.map +1 -0
- package/dist/web-components/layout-grid.test.d.ts +2 -0
- package/dist/web-components/layout-grid.test.d.ts.map +1 -0
- package/dist/web-components/layout-mode-adapter.d.ts +51 -0
- package/dist/web-components/layout-mode-adapter.d.ts.map +1 -0
- package/dist/web-components/layout-mode-adapter.test.d.ts +2 -0
- package/dist/web-components/layout-mode-adapter.test.d.ts.map +1 -0
- package/dist/web-components-editor.js +125 -18
- package/dist/web-components-runtime.js +4 -4
- package/package.json +3 -2
- package/dist/ExtensionRoot-peABLAZZ.js +0 -231
- package/dist/block-B6s9jL7l.js +0 -966
- package/dist/block.devtools.test.d.ts +0 -2
- package/dist/block.devtools.test.d.ts.map +0 -1
- package/dist/context.devtools.test.d.ts +0 -2
- package/dist/context.devtools.test.d.ts.map +0 -1
- package/dist/devtools/env.d.ts +0 -3
- package/dist/devtools/env.d.ts.map +0 -1
- package/dist/devtools/hook.d.ts +0 -35
- package/dist/devtools/hook.d.ts.map +0 -1
- package/dist/devtools/index.d.ts +0 -4
- package/dist/devtools/index.d.ts.map +0 -1
- package/dist/devtools/protocol.d.ts +0 -91
- package/dist/devtools/protocol.d.ts.map +0 -1
- package/dist/devtools.js +0 -44
- package/dist/editor/overlays.d.ts +0 -14
- package/dist/editor/overlays.d.ts.map +0 -1
- package/dist/editor/overlays.test.d.ts +0 -2
- package/dist/editor/overlays.test.d.ts.map +0 -1
- package/dist/juo-workflow-DY4rd256.js +0 -868
- package/dist/overlay-wrapper.d.ts +0 -69
- package/dist/overlay-wrapper.d.ts.map +0 -1
- package/dist/overlay-wrapper.test.d.ts +0 -2
- package/dist/overlay-wrapper.test.d.ts.map +0 -1
- package/dist/overlays/OverlayService.d.ts +0 -34
- package/dist/overlays/OverlayService.d.ts.map +0 -1
- package/dist/overlays/OverlayService.test.d.ts +0 -2
- package/dist/overlays/OverlayService.test.d.ts.map +0 -1
- package/dist/registry.devtools.test.d.ts +0 -2
- package/dist/registry.devtools.test.d.ts.map +0 -1
- package/dist/services/customer/adapter.d.ts +0 -8
- package/dist/services/customer/adapter.d.ts.map +0 -1
- package/dist/services/login/adapter.d.ts +0 -32
- package/dist/services/login/adapter.d.ts.map +0 -1
- package/dist/services/order/adapter.d.ts +0 -9
- package/dist/services/order/adapter.d.ts.map +0 -1
- package/dist/services/order/index.d.ts +0 -5
- package/dist/services/order/index.d.ts.map +0 -1
- package/dist/services/order/orderService.d.ts +0 -7
- package/dist/services/order/orderService.d.ts.map +0 -1
- package/dist/services/order/types.d.ts +0 -21
- package/dist/services/order/types.d.ts.map +0 -1
- package/dist/services/product/adapter.test.d.ts +0 -2
- package/dist/services/product/adapter.test.d.ts.map +0 -1
- package/dist/services/schedules/adapter.d.ts +0 -71
- package/dist/services/schedules/adapter.d.ts.map +0 -1
- package/dist/services/schedules/adapter.test.d.ts +0 -2
- package/dist/services/schedules/adapter.test.d.ts.map +0 -1
- package/dist/services/schedules/index.d.ts +0 -5
- package/dist/services/schedules/index.d.ts.map +0 -1
- package/dist/services/schedules/schedulesService.d.ts +0 -11
- package/dist/services/schedules/schedulesService.d.ts.map +0 -1
- package/dist/services/schedules/schedulesService.test.d.ts +0 -2
- package/dist/services/schedules/schedulesService.test.d.ts.map +0 -1
- package/dist/services/schedules/types.d.ts +0 -226
- package/dist/services/schedules/types.d.ts.map +0 -1
- package/dist/services/settings/index.d.ts +0 -3
- package/dist/services/settings/index.d.ts.map +0 -1
- package/dist/services/settings/settingsService.d.ts +0 -7
- package/dist/services/settings/settingsService.d.ts.map +0 -1
- package/dist/services/settings/settingsService.test.d.ts +0 -2
- package/dist/services/settings/settingsService.test.d.ts.map +0 -1
- package/dist/services/settings/types.d.ts +0 -35
- package/dist/services/settings/types.d.ts.map +0 -1
- package/dist/services/shop/index.d.ts +0 -3
- package/dist/services/shop/index.d.ts.map +0 -1
- package/dist/services/shop/shopService.d.ts +0 -12
- package/dist/services/shop/shopService.d.ts.map +0 -1
- package/dist/services/shop/shopService.test.d.ts +0 -2
- package/dist/services/shop/shopService.test.d.ts.map +0 -1
- package/dist/services/shop/types.d.ts +0 -7
- package/dist/services/shop/types.d.ts.map +0 -1
- package/dist/services/subscription/adapter.test.d.ts +0 -2
- package/dist/services/subscription/adapter.test.d.ts.map +0 -1
- package/dist/services/subscription/types.test.d.ts +0 -2
- package/dist/services/subscription/types.test.d.ts.map +0 -1
- package/dist/theme-state.params.test.d.ts +0 -2
- package/dist/theme-state.params.test.d.ts.map +0 -1
- package/dist/theme-state.translations.test.d.ts +0 -2
- 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 === "
|
|
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
|
|
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
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
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
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
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
|
};
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;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,OAAO,YAAA;CAItC;AAED,qBAAa,mBAAmB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,KAAK;aAEpD,OAAO,EAAE,CAAC;aACV,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;aACrB,SAAS,CAAC,EAAE,OAAO;gBAFnB,OAAO,EAAE,CAAC,EACV,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EACrB,SAAS,CAAC,EAAE,OAAO,YAAA;CAItC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,mBAAmB;QAC3B;;;WAGG;QACH,iBAAiB,EAAE,mBAAmB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAElE;;;WAGG;QACH,iBAAiB,EAAE,mBAAmB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;KACnE;CACF;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,cAAc,EACrD,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,CAAC,EACV,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,IAAI,CAGN;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,cAAc,EACpD,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,CAAC,GACT,WAAW,CAAC,CAAC,CAAC,CAchB;AAED,MAAM,MAAM,yBAAyB,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;AAE9E,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,cAAc,EACvD,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,CAAC,EACV,QAAQ,EAAE,yBAAyB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAClD,MAAM,IAAI,CAqBZ;AAED,qBAAa,WAAY,SAAQ,WAAW;IAC1C,OAAO,CAAC,KAAK,CAAuC;IACpD,OAAO,CAAC,SAAS,CAAsD;IAEvE,iBAAiB;CAyDlB"}
|