@burger-editor/client 4.0.0-alpha.77 → 4.0.0-alpha.79

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 (50) hide show
  1. package/README.md +42 -41
  2. package/dist/block-swap-view-transition-css.d.ts +7 -0
  3. package/dist/block-swap-view-transition-css.d.ts.map +1 -0
  4. package/dist/client.css +158 -18
  5. package/dist/client.js +1986 -1445
  6. package/dist/client.js.map +1 -1
  7. package/dist/components/block-catalog.d.ts.map +1 -1
  8. package/dist/components/block-menu-anchors.d.ts +25 -0
  9. package/dist/components/block-menu-anchors.d.ts.map +1 -0
  10. package/dist/components/block-menu-button.d.ts +7 -2
  11. package/dist/components/block-menu-button.d.ts.map +1 -1
  12. package/dist/components/block-menu-view.d.ts +35 -29
  13. package/dist/components/block-menu-view.d.ts.map +1 -1
  14. package/dist/components/block-menu.d.ts.map +1 -1
  15. package/dist/components/block-options.d.ts.map +1 -1
  16. package/dist/components/editable-area-view.d.ts.map +1 -1
  17. package/dist/components/front-matter-editor.d.ts +16 -5
  18. package/dist/components/front-matter-editor.d.ts.map +1 -1
  19. package/dist/components/index.d.ts +3 -1
  20. package/dist/components/index.d.ts.map +1 -1
  21. package/dist/components/thumbnail-button.d.ts +39 -0
  22. package/dist/components/thumbnail-button.d.ts.map +1 -0
  23. package/dist/create-mock-engine-BloCpuEu.js +87 -0
  24. package/dist/create-mock-engine-BloCpuEu.js.map +1 -0
  25. package/dist/{engine-context-j4-LLPEh.js → dist-DYydjVsL.js} +772 -516
  26. package/dist/dist-DYydjVsL.js.map +1 -0
  27. package/dist/{editable-area-view-BRYT222Y.js → editable-area-view-DhEipEQV.js} +548 -542
  28. package/dist/editable-area-view-DhEipEQV.js.map +1 -0
  29. package/dist/engine-context-oEEsvNSx.js +49 -0
  30. package/dist/engine-context-oEEsvNSx.js.map +1 -0
  31. package/dist/form/select-field.d.ts +4 -1
  32. package/dist/form/select-field.d.ts.map +1 -1
  33. package/dist/form/text-field.d.ts +11 -1
  34. package/dist/form/text-field.d.ts.map +1 -1
  35. package/dist/interest-hints.d.ts +21 -0
  36. package/dist/interest-hints.d.ts.map +1 -0
  37. package/dist/replace-element.d.ts +12 -4
  38. package/dist/replace-element.d.ts.map +1 -1
  39. package/dist/testing/create-mock-engine.d.ts +3 -0
  40. package/dist/testing/create-mock-engine.d.ts.map +1 -1
  41. package/dist/testing-mock-engine.js +1 -0
  42. package/dist/testing.js +4 -55
  43. package/dist/testing.js.map +1 -1
  44. package/dist/ui.d.ts +1 -0
  45. package/dist/ui.d.ts.map +1 -1
  46. package/dist/ui.js +275 -168
  47. package/dist/ui.js.map +1 -1
  48. package/package.json +26 -22
  49. package/dist/editable-area-view-BRYT222Y.js.map +0 -1
  50. package/dist/engine-context-j4-LLPEh.js.map +0 -1
@@ -1,11 +1,12 @@
1
- import { f as CSS_LAYER, l as Item, n as useEngine, o as createBgeEvent, r as getBlockAtPosition, s as beginProcessing } from "./engine-context-j4-LLPEh.js";
1
+ import { a as beginProcessing, i as createBgeEvent, s as Item, t as getBlockAtPosition, u as CSS_LAYER } from "./dist-DYydjVsL.js";
2
+ import { n as useEngine } from "./engine-context-oEEsvNSx.js";
2
3
  import { c } from "react/compiler-runtime";
3
4
  import { Component, Fragment, Suspense, createContext, createElement, forwardRef, useActionState, useEffect, useEffectEvent, useId, useMemo, useRef, useState } from "react";
4
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
6
  import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
6
7
  import { createRoot } from "react-dom/client";
7
8
  import { createPortal } from "react-dom";
8
- //#region ../utils/dist/append-stylesheet-to.js
9
+ // ../utils/dist/append-stylesheet-to.js
9
10
  /**
10
11
  * Append a `<link rel="stylesheet">` to a document's `<head>`.
11
12
  * @param doc - The target document
@@ -23,8 +24,7 @@ function appendStylesheetTo(doc, url, id) {
23
24
  link.href = `${url}#${id}`;
24
25
  doc.head.append(link);
25
26
  }
26
- //#endregion
27
- //#region ../core/dist/command/commands.js
27
+ // ../core/dist/command/commands.js
28
28
  /**
29
29
  * The engine's command vocabulary — every custom command accepted by the
30
30
  * central command bus. Buttons declare these with
@@ -68,10 +68,9 @@ var BGE_COMMAND = {
68
68
  /** Open the item editor for the item hosting the invoker button. */
69
69
  openItemEditor: "--open-item-editor"
70
70
  };
71
- //#endregion
72
- //#region ../../../node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs
71
+ // ../../../node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs
73
72
  /**
74
- * @license @tabler/icons-react v3.48.0 - MIT
73
+ * @license @tabler/icons-react v3.52.0 - MIT
75
74
  *
76
75
  * This source code is licensed under the MIT license.
77
76
  * See the LICENSE file in the root directory of this source tree.
@@ -97,10 +96,9 @@ var defaultAttributes = {
97
96
  stroke: "none"
98
97
  }
99
98
  };
100
- //#endregion
101
- //#region ../../../node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs
99
+ // ../../../node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs
102
100
  /**
103
- * @license @tabler/icons-react v3.48.0 - MIT
101
+ * @license @tabler/icons-react v3.52.0 - MIT
104
102
  *
105
103
  * This source code is licensed under the MIT license.
106
104
  * See the LICENSE file in the root directory of this source tree.
@@ -130,12 +128,12 @@ var createReactComponent = (type, iconName, iconNamePascal, iconNode) => {
130
128
  return Component;
131
129
  };
132
130
  /**
133
- * @license @tabler/icons-react v3.48.0 - MIT
131
+ * @license @tabler/icons-react v3.52.0 - MIT
134
132
  *
135
133
  * This source code is licensed under the MIT license.
136
134
  * See the LICENSE file in the root directory of this source tree.
137
135
  */
138
- var IconArrowBigDownLine = createReactComponent("outline", "arrow-big-down-line", "ArrowBigDownLine", [["path", {
136
+ var IconArrowBigDownLine = /* @__PURE__ */ createReactComponent("outline", "arrow-big-down-line", "ArrowBigDownLine", [["path", {
139
137
  "d": "M15 12h3.586a1 1 0 0 1 .707 1.707l-6.586 6.586a1 1 0 0 1 -1.414 0l-6.586 -6.586a1 1 0 0 1 .707 -1.707h3.586v-6h6v6",
140
138
  "key": "svg-0"
141
139
  }], ["path", {
@@ -143,12 +141,12 @@ var IconArrowBigDownLine = createReactComponent("outline", "arrow-big-down-line"
143
141
  "key": "svg-1"
144
142
  }]]);
145
143
  /**
146
- * @license @tabler/icons-react v3.48.0 - MIT
144
+ * @license @tabler/icons-react v3.52.0 - MIT
147
145
  *
148
146
  * This source code is licensed under the MIT license.
149
147
  * See the LICENSE file in the root directory of this source tree.
150
148
  */
151
- var IconArrowBigUpLine = createReactComponent("outline", "arrow-big-up-line", "ArrowBigUpLine", [["path", {
149
+ var IconArrowBigUpLine = /* @__PURE__ */ createReactComponent("outline", "arrow-big-up-line", "ArrowBigUpLine", [["path", {
152
150
  "d": "M9 12h-3.586a1 1 0 0 1 -.707 -1.707l6.586 -6.586a1 1 0 0 1 1.414 0l6.586 6.586a1 1 0 0 1 -.707 1.707h-3.586v6h-6v-6",
153
151
  "key": "svg-0"
154
152
  }], ["path", {
@@ -156,12 +154,12 @@ var IconArrowBigUpLine = createReactComponent("outline", "arrow-big-up-line", "A
156
154
  "key": "svg-1"
157
155
  }]]);
158
156
  /**
159
- * @license @tabler/icons-react v3.48.0 - MIT
157
+ * @license @tabler/icons-react v3.52.0 - MIT
160
158
  *
161
159
  * This source code is licensed under the MIT license.
162
160
  * See the LICENSE file in the root directory of this source tree.
163
161
  */
164
- var IconClipboardPlus = createReactComponent("outline", "clipboard-plus", "ClipboardPlus", [
162
+ var IconClipboardPlus = /* @__PURE__ */ createReactComponent("outline", "clipboard-plus", "ClipboardPlus", [
165
163
  ["path", {
166
164
  "d": "M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2",
167
165
  "key": "svg-0"
@@ -180,12 +178,12 @@ var IconClipboardPlus = createReactComponent("outline", "clipboard-plus", "Clipb
180
178
  }]
181
179
  ]);
182
180
  /**
183
- * @license @tabler/icons-react v3.48.0 - MIT
181
+ * @license @tabler/icons-react v3.52.0 - MIT
184
182
  *
185
183
  * This source code is licensed under the MIT license.
186
184
  * See the LICENSE file in the root directory of this source tree.
187
185
  */
188
- var IconClipboard = createReactComponent("outline", "clipboard", "Clipboard", [["path", {
186
+ var IconClipboard = /* @__PURE__ */ createReactComponent("outline", "clipboard", "Clipboard", [["path", {
189
187
  "d": "M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2",
190
188
  "key": "svg-0"
191
189
  }], ["path", {
@@ -193,12 +191,12 @@ var IconClipboard = createReactComponent("outline", "clipboard", "Clipboard", [[
193
191
  "key": "svg-1"
194
192
  }]]);
195
193
  /**
196
- * @license @tabler/icons-react v3.48.0 - MIT
194
+ * @license @tabler/icons-react v3.52.0 - MIT
197
195
  *
198
196
  * This source code is licensed under the MIT license.
199
197
  * See the LICENSE file in the root directory of this source tree.
200
198
  */
201
- var IconLayoutGridAdd = createReactComponent("outline", "layout-grid-add", "LayoutGridAdd", [
199
+ var IconLayoutGridAdd = /* @__PURE__ */ createReactComponent("outline", "layout-grid-add", "LayoutGridAdd", [
202
200
  ["path", {
203
201
  "d": "M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",
204
202
  "key": "svg-0"
@@ -217,12 +215,12 @@ var IconLayoutGridAdd = createReactComponent("outline", "layout-grid-add", "Layo
217
215
  }]
218
216
  ]);
219
217
  /**
220
- * @license @tabler/icons-react v3.48.0 - MIT
218
+ * @license @tabler/icons-react v3.52.0 - MIT
221
219
  *
222
220
  * This source code is licensed under the MIT license.
223
221
  * See the LICENSE file in the root directory of this source tree.
224
222
  */
225
- var IconLayoutGridRemove = createReactComponent("outline", "layout-grid-remove", "LayoutGridRemove", [
223
+ var IconLayoutGridRemove = /* @__PURE__ */ createReactComponent("outline", "layout-grid-remove", "LayoutGridRemove", [
226
224
  ["path", {
227
225
  "d": "M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-4",
228
226
  "key": "svg-0"
@@ -241,12 +239,12 @@ var IconLayoutGridRemove = createReactComponent("outline", "layout-grid-remove",
241
239
  }]
242
240
  ]);
243
241
  /**
244
- * @license @tabler/icons-react v3.48.0 - MIT
242
+ * @license @tabler/icons-react v3.52.0 - MIT
245
243
  *
246
244
  * This source code is licensed under the MIT license.
247
245
  * See the LICENSE file in the root directory of this source tree.
248
246
  */
249
- var IconRowInsertBottom = createReactComponent("outline", "row-insert-bottom", "RowInsertBottom", [
247
+ var IconRowInsertBottom = /* @__PURE__ */ createReactComponent("outline", "row-insert-bottom", "RowInsertBottom", [
250
248
  ["path", {
251
249
  "d": "M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1",
252
250
  "key": "svg-0"
@@ -261,12 +259,12 @@ var IconRowInsertBottom = createReactComponent("outline", "row-insert-bottom", "
261
259
  }]
262
260
  ]);
263
261
  /**
264
- * @license @tabler/icons-react v3.48.0 - MIT
262
+ * @license @tabler/icons-react v3.52.0 - MIT
265
263
  *
266
264
  * This source code is licensed under the MIT license.
267
265
  * See the LICENSE file in the root directory of this source tree.
268
266
  */
269
- var IconRowInsertTop = createReactComponent("outline", "row-insert-top", "RowInsertTop", [
267
+ var IconRowInsertTop = /* @__PURE__ */ createReactComponent("outline", "row-insert-top", "RowInsertTop", [
270
268
  ["path", {
271
269
  "d": "M4 18v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1",
272
270
  "key": "svg-0"
@@ -281,12 +279,12 @@ var IconRowInsertTop = createReactComponent("outline", "row-insert-top", "RowIns
281
279
  }]
282
280
  ]);
283
281
  /**
284
- * @license @tabler/icons-react v3.48.0 - MIT
282
+ * @license @tabler/icons-react v3.52.0 - MIT
285
283
  *
286
284
  * This source code is licensed under the MIT license.
287
285
  * See the LICENSE file in the root directory of this source tree.
288
286
  */
289
- var IconSettings = createReactComponent("outline", "settings", "Settings", [["path", {
287
+ var IconSettings = /* @__PURE__ */ createReactComponent("outline", "settings", "Settings", [["path", {
290
288
  "d": "M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065",
291
289
  "key": "svg-0"
292
290
  }], ["path", {
@@ -294,12 +292,12 @@ var IconSettings = createReactComponent("outline", "settings", "Settings", [["pa
294
292
  "key": "svg-1"
295
293
  }]]);
296
294
  /**
297
- * @license @tabler/icons-react v3.48.0 - MIT
295
+ * @license @tabler/icons-react v3.52.0 - MIT
298
296
  *
299
297
  * This source code is licensed under the MIT license.
300
298
  * See the LICENSE file in the root directory of this source tree.
301
299
  */
302
- var IconTrash = createReactComponent("outline", "trash", "Trash", [
300
+ var IconTrash = /* @__PURE__ */ createReactComponent("outline", "trash", "Trash", [
303
301
  ["path", {
304
302
  "d": "M4 7l16 0",
305
303
  "key": "svg-0"
@@ -329,8 +327,7 @@ var block_catalog_module_default = {
329
327
  pasteSection: "_pasteSection_96ih6_66",
330
328
  pasteButton: "_pasteButton_96ih6_72"
331
329
  };
332
- //#endregion
333
- //#region src/components/block-catalog.tsx
330
+ // src/components/block-catalog.tsx
334
331
  /**
335
332
  * Block catalog dialog content. Adding and pasting blocks are declared
336
333
  * as engine commands; the catalog entry is identified by
@@ -392,6 +389,7 @@ function BlockCatalog(t0) {
392
389
  })
393
390
  }) : /* @__PURE__ */ jsx("span", {
394
391
  className: block_catalog_module_default.img,
392
+ "aria-hidden": "true",
395
393
  dangerouslySetInnerHTML: { __html: blockInfo.definition.svg ?? "" }
396
394
  }), /* @__PURE__ */ jsx("span", {
397
395
  className: block_catalog_module_default.figcaption,
@@ -416,8 +414,7 @@ function BlockCatalog(t0) {
416
414
  } else t4 = $[10];
417
415
  return t4;
418
416
  }
419
- //#endregion
420
- //#region src/components/block-options.tsx
417
+ // src/components/block-options.tsx
421
418
  var containerTypeLabel = {
422
419
  grid: "グリッド",
423
420
  inline: "横並び",
@@ -442,7 +439,7 @@ var containerTypeLabel = {
442
439
  * ```
443
440
  */
444
441
  function BlockOptions(t0) {
445
- const $ = c(72);
442
+ const $ = c(73);
446
443
  const { block } = t0;
447
444
  const engine = useEngine();
448
445
  const currentBlock = block;
@@ -589,7 +586,7 @@ function BlockOptions(t0) {
589
586
  $[22] = t7;
590
587
  } else t7 = $[22];
591
588
  let t8;
592
- if ($[23] !== currentAutoRepeat || $[24] !== currentColumns || $[25] !== effectiveContainerType || $[26] !== options.containerProps.immutable || $[27] !== options.containerProps.repeatMinInlineSize || $[28] !== options.containerProps.type || $[29] !== repeatMinInlineSizeVariants) {
589
+ if ($[23] !== currentAutoRepeat || $[24] !== currentColumns || $[25] !== effectiveContainerType || $[26] !== options.containerProps.immutable || $[27] !== options.containerProps.repeatMinInlineSize || $[28] !== options.containerProps.type || $[29] !== repeatMinInlineSizeVariants || $[30] !== uid) {
593
590
  t8 = effectiveContainerType === "grid" ? options.containerProps.immutable || options.containerProps.type === "float" ? /* @__PURE__ */ jsx("p", { children: "このブロックはコンテナタイプを変更できません。" }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
594
591
  /* @__PURE__ */ jsxs("label", { children: [/* @__PURE__ */ jsx("span", { children: "列の自動調整" }), /* @__PURE__ */ jsxs("select", {
595
592
  name: "bge-options-auto-repeat",
@@ -612,20 +609,20 @@ function BlockOptions(t0) {
612
609
  })
613
610
  ]
614
611
  })] }),
615
- currentAutoRepeat === "fixed" ? /* @__PURE__ */ jsxs("label", { children: [
616
- /* @__PURE__ */ jsx("span", { children: "基準列数" }),
617
- /* @__PURE__ */ jsx("output", { children: currentColumns }),
618
- /* @__PURE__ */ jsx("input", {
619
- name: "bge-options-columns",
620
- type: "range",
621
- value: currentColumns,
622
- onChange: (e_2) => {
623
- setCurrentColumns(e_2.currentTarget.valueAsNumber);
624
- },
625
- min: "1",
626
- max: "5"
627
- })
628
- ] }) : null,
612
+ currentAutoRepeat === "fixed" ? /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsxs("label", { children: [/* @__PURE__ */ jsx("span", { children: "基準列数" }), /* @__PURE__ */ jsx("input", {
613
+ id: `${uid}-columns`,
614
+ name: "bge-options-columns",
615
+ type: "range",
616
+ value: currentColumns,
617
+ onChange: (e_2) => {
618
+ setCurrentColumns(e_2.currentTarget.valueAsNumber);
619
+ },
620
+ min: "1",
621
+ max: "5"
622
+ })] }), /* @__PURE__ */ jsx("output", {
623
+ htmlFor: `${uid}-columns`,
624
+ children: currentColumns
625
+ })] }) : null,
629
626
  currentAutoRepeat !== "fixed" && repeatMinInlineSizeVariants ? /* @__PURE__ */ jsxs("label", { children: [/* @__PURE__ */ jsx("span", { children: "折り返し基準幅" }), /* @__PURE__ */ jsx("select", {
630
627
  name: "bge-options-repeat-min-inline-size",
631
628
  defaultValue: [...repeatMinInlineSizeVariants.properties].find((t9) => {
@@ -642,10 +639,11 @@ function BlockOptions(t0) {
642
639
  $[27] = options.containerProps.repeatMinInlineSize;
643
640
  $[28] = options.containerProps.type;
644
641
  $[29] = repeatMinInlineSizeVariants;
645
- $[30] = t8;
646
- } else t8 = $[30];
642
+ $[30] = uid;
643
+ $[31] = t8;
644
+ } else t8 = $[31];
647
645
  let t9;
648
- if ($[31] !== effectiveContainerType || $[32] !== options.containerProps.float || $[33] !== uid) {
646
+ if ($[32] !== effectiveContainerType || $[33] !== options.containerProps.float || $[34] !== uid) {
649
647
  t9 = effectiveContainerType === "float" ? /* @__PURE__ */ jsxs("div", {
650
648
  role: "radiogroup",
651
649
  "aria-labelledby": `${uid}-float`,
@@ -662,36 +660,36 @@ function BlockOptions(t0) {
662
660
  }), /* @__PURE__ */ jsx("span", { children: label_1 })] }, value_1);
663
661
  })]
664
662
  }) : null;
665
- $[31] = effectiveContainerType;
666
- $[32] = options.containerProps.float;
667
- $[33] = uid;
668
- $[34] = t9;
669
- } else t9 = $[34];
663
+ $[32] = effectiveContainerType;
664
+ $[33] = options.containerProps.float;
665
+ $[34] = uid;
666
+ $[35] = t9;
667
+ } else t9 = $[35];
670
668
  const t10 = options.containerProps.linkarea ?? false;
671
669
  let t11;
672
- if ($[35] !== t10) {
670
+ if ($[36] !== t10) {
673
671
  t11 = /* @__PURE__ */ jsx("input", {
674
672
  type: "checkbox",
675
673
  name: "bge-options-linkarea",
676
674
  value: "true",
677
675
  defaultChecked: t10
678
676
  });
679
- $[35] = t10;
680
- $[36] = t11;
681
- } else t11 = $[36];
677
+ $[36] = t10;
678
+ $[37] = t11;
679
+ } else t11 = $[37];
682
680
  let t12;
683
- if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
681
+ if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
684
682
  t12 = /* @__PURE__ */ jsx("span", { children: "リンクエリア機能を有効にする" });
685
- $[37] = t12;
686
- } else t12 = $[37];
683
+ $[38] = t12;
684
+ } else t12 = $[38];
687
685
  let t13;
688
- if ($[38] !== t11) {
686
+ if ($[39] !== t11) {
689
687
  t13 = /* @__PURE__ */ jsxs("label", { children: [t11, t12] });
690
- $[38] = t11;
691
- $[39] = t13;
692
- } else t13 = $[39];
688
+ $[39] = t11;
689
+ $[40] = t13;
690
+ } else t13 = $[40];
693
691
  let t14;
694
- if ($[40] !== t13 || $[41] !== t5 || $[42] !== t6 || $[43] !== t7 || $[44] !== t8 || $[45] !== t9) {
692
+ if ($[41] !== t13 || $[42] !== t5 || $[43] !== t6 || $[44] !== t7 || $[45] !== t8 || $[46] !== t9) {
695
693
  t14 = /* @__PURE__ */ jsxs("fieldset", { children: [
696
694
  t4,
697
695
  t5,
@@ -701,16 +699,16 @@ function BlockOptions(t0) {
701
699
  t9,
702
700
  t13
703
701
  ] });
704
- $[40] = t13;
705
- $[41] = t5;
706
- $[42] = t6;
707
- $[43] = t7;
708
- $[44] = t8;
709
- $[45] = t9;
710
- $[46] = t14;
711
- } else t14 = $[46];
702
+ $[41] = t13;
703
+ $[42] = t5;
704
+ $[43] = t6;
705
+ $[44] = t7;
706
+ $[45] = t8;
707
+ $[46] = t9;
708
+ $[47] = t14;
709
+ } else t14 = $[47];
712
710
  let t15;
713
- if ($[47] !== cssProps || $[48] !== options.style) {
711
+ if ($[48] !== cssProps || $[49] !== options.style) {
714
712
  t15 = cssProps.size > 0 ? /* @__PURE__ */ jsxs("fieldset", { children: [/* @__PURE__ */ jsx("legend", { children: "ブロックのスタイル拡張" }), [...cssProps].map((t16) => {
715
713
  const [, category] = t16;
716
714
  const selected = [...category.properties].find((t17) => {
@@ -723,71 +721,71 @@ function BlockOptions(t0) {
723
721
  children: [...category.properties].map(_temp2$3)
724
722
  })] }, `bge-options-style-${category.id}`);
725
723
  })] }) : null;
726
- $[47] = cssProps;
727
- $[48] = options.style;
728
- $[49] = t15;
729
- } else t15 = $[49];
724
+ $[48] = cssProps;
725
+ $[49] = options.style;
726
+ $[50] = t15;
727
+ } else t15 = $[50];
730
728
  let t16;
731
- if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
729
+ if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
732
730
  t16 = /* @__PURE__ */ jsx("span", { children: "独自class設定" });
733
- $[50] = t16;
734
- } else t16 = $[50];
731
+ $[51] = t16;
732
+ } else t16 = $[51];
735
733
  let t17;
736
- if ($[51] !== options.classList) {
734
+ if ($[52] !== options.classList) {
737
735
  t17 = options.classList?.join(" ") ?? "";
738
- $[51] = options.classList;
739
- $[52] = t17;
740
- } else t17 = $[52];
736
+ $[52] = options.classList;
737
+ $[53] = t17;
738
+ } else t17 = $[53];
741
739
  const t18 = `${uid}-classes-desc`;
742
740
  let t19;
743
- if ($[53] !== t17 || $[54] !== t18) {
741
+ if ($[54] !== t17 || $[55] !== t18) {
744
742
  t19 = /* @__PURE__ */ jsxs("label", { children: [t16, /* @__PURE__ */ jsx("input", {
745
743
  type: "text",
746
744
  name: "bge-options-classes",
747
745
  defaultValue: t17,
748
746
  "aria-describedby": t18
749
747
  })] });
750
- $[53] = t17;
751
- $[54] = t18;
752
- $[55] = t19;
753
- } else t19 = $[55];
748
+ $[54] = t17;
749
+ $[55] = t18;
750
+ $[56] = t19;
751
+ } else t19 = $[56];
754
752
  const t20 = `${uid}-classes-desc`;
755
753
  let t21;
756
- if ($[56] !== t20) {
754
+ if ($[57] !== t20) {
757
755
  t21 = /* @__PURE__ */ jsx("small", {
758
756
  id: t20,
759
757
  children: "複数指定する場合はスペース(空白文字)で区切ってください。"
760
758
  });
761
- $[56] = t20;
762
- $[57] = t21;
763
- } else t21 = $[57];
759
+ $[57] = t20;
760
+ $[58] = t21;
761
+ } else t21 = $[58];
764
762
  let t22;
765
- if ($[58] === Symbol.for("react.memo_cache_sentinel")) {
763
+ if ($[59] === Symbol.for("react.memo_cache_sentinel")) {
766
764
  t22 = /* @__PURE__ */ jsxs("span", { children: ["ID設定: ", /* @__PURE__ */ jsx("code", { children: "bge-" })] });
767
- $[58] = t22;
768
- } else t22 = $[58];
765
+ $[59] = t22;
766
+ } else t22 = $[59];
769
767
  const t23 = options.id ?? "";
770
768
  const t24 = `${uid}-id-desc`;
771
769
  let t25;
772
- if ($[59] !== t23 || $[60] !== t24) {
770
+ if ($[60] !== t23 || $[61] !== t24) {
773
771
  t25 = /* @__PURE__ */ jsxs("label", { children: [t22, /* @__PURE__ */ jsx("input", {
774
772
  name: "bge-options-id",
775
773
  type: "text",
776
774
  defaultValue: t23,
777
775
  "aria-describedby": t24
778
776
  })] });
779
- $[59] = t23;
780
- $[60] = t24;
781
- $[61] = t25;
782
- } else t25 = $[61];
777
+ $[60] = t23;
778
+ $[61] = t24;
779
+ $[62] = t25;
780
+ } else t25 = $[62];
783
781
  const t26 = `${uid}-id-desc`;
784
782
  let t27;
785
- if ($[62] === Symbol.for("react.memo_cache_sentinel")) {
783
+ if ($[63] === Symbol.for("react.memo_cache_sentinel")) {
786
784
  t27 = /* @__PURE__ */ jsx("code", { children: "bge-" });
787
- $[62] = t27;
788
- } else t27 = $[62];
785
+ $[63] = t27;
786
+ } else t27 = $[63];
789
787
  let t28;
790
- if ($[63] !== t26) {
788
+ if ($[64] !== t26) {
791
789
  t28 = /* @__PURE__ */ jsxs("small", {
792
790
  id: t26,
793
791
  children: [
@@ -796,11 +794,11 @@ function BlockOptions(t0) {
796
794
  "が自動的に先頭に付加されます。"
797
795
  ]
798
796
  });
799
- $[63] = t26;
800
- $[64] = t28;
801
- } else t28 = $[64];
797
+ $[64] = t26;
798
+ $[65] = t28;
799
+ } else t28 = $[65];
802
800
  let t29;
803
- if ($[65] !== t14 || $[66] !== t15 || $[67] !== t19 || $[68] !== t21 || $[69] !== t25 || $[70] !== t28) {
801
+ if ($[66] !== t14 || $[67] !== t15 || $[68] !== t19 || $[69] !== t21 || $[70] !== t25 || $[71] !== t28) {
804
802
  t29 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
805
803
  t14,
806
804
  t15,
@@ -809,14 +807,14 @@ function BlockOptions(t0) {
809
807
  t25,
810
808
  t28
811
809
  ] });
812
- $[65] = t14;
813
- $[66] = t15;
814
- $[67] = t19;
815
- $[68] = t21;
816
- $[69] = t25;
817
- $[70] = t28;
818
- $[71] = t29;
819
- } else t29 = $[71];
810
+ $[66] = t14;
811
+ $[67] = t15;
812
+ $[68] = t19;
813
+ $[69] = t21;
814
+ $[70] = t25;
815
+ $[71] = t28;
816
+ $[72] = t29;
817
+ } else t29 = $[72];
820
818
  return t29;
821
819
  }
822
820
  function _temp2$3(t0) {
@@ -833,8 +831,7 @@ function _temp$4(t0) {
833
831
  children: `${variantName_0} (${data_0.value})`
834
832
  }, variantName_0);
835
833
  }
836
- //#endregion
837
- //#region ../../../node_modules/react-error-boundary/dist/react-error-boundary.js
834
+ // ../../../node_modules/react-error-boundary/dist/react-error-boundary.js
838
835
  var f = createContext(null);
839
836
  function m({ children: r, didCatch: e, error: t, resetErrorBoundary: o }) {
840
837
  const n = useMemo(() => ({
@@ -903,15 +900,13 @@ var C = class extends Component {
903
900
  function g(r = [], e = []) {
904
901
  return r.length !== e.length || r.some((t, o) => !Object.is(t, e[o]));
905
902
  }
906
- //#endregion
907
- //#region src/invoker-commands.ts
903
+ // src/invoker-commands.ts
908
904
  /**
909
905
  * Invoker Commands API attributes for buttons. Re-exported (rather than
910
906
  * imported for side effects only) so that the module augmentation above
911
907
  * survives d.ts bundling and reaches consumers.
912
908
  */
913
- //#endregion
914
- //#region src/editor-dialog.tsx
909
+ // src/editor-dialog.tsx
915
910
  /**
916
911
  * Minimal fallback for a dialog body that suspended and then threw.
917
912
  * Display-only — the dialog's own close button (outside this boundary,
@@ -1126,8 +1121,7 @@ function EditorDialogBody({ name, formId, dialogId, open, action, buttons, child
1126
1121
  children: buttons.complete
1127
1122
  }) : null] })] });
1128
1123
  }
1129
- //#endregion
1130
- //#region src/components/item-editor-host.tsx
1124
+ // src/components/item-editor-host.tsx
1131
1125
  /**
1132
1126
  * Declarative item editor dialog. Renders the item's `Editor` component
1133
1127
  * with editor state derived via `toEditorState`; on submit the state is
@@ -1302,8 +1296,7 @@ function ItemEditorBody(t0) {
1302
1296
  } else t6 = $[23];
1303
1297
  return t6;
1304
1298
  }
1305
- //#endregion
1306
- //#region src/use-engine.ts
1299
+ // src/use-engine.ts
1307
1300
  var identity = (state) => state;
1308
1301
  /**
1309
1302
  * Subscribe to the engine's UI state store.
@@ -1342,74 +1335,51 @@ function useUIState(selector) {
1342
1335
  const engine = useEngine();
1343
1336
  return useSyncExternalStoreWithSelector(engine.uiState.subscribe, engine.uiState.getSnapshot, engine.uiState.getSnapshot, selector ?? identity);
1344
1337
  }
1345
- //#endregion
1346
- //#region src/replace-element.ts
1338
+ // src/replace-element.ts
1339
+ var nextViewTransitionId = 0;
1347
1340
  /**
1341
+ * Swap two adjacent sibling blocks with a View Transition, then wait until it
1342
+ * finishes so `beginProcessing()` covers the same window as before.
1348
1343
  *
1349
- * @param elA
1350
- * @param elB
1351
- * @param duration
1344
+ * Animation length and `prefers-reduced-motion: reduce` are controlled by CSS
1345
+ * injected into the editable-area iframe (`editable-area-view.tsx`), not here.
1346
+ * @param elA - First sibling element
1347
+ * @param elB - Second sibling element (same parent as `elA`)
1348
+ * @example
1349
+ * ```ts
1350
+ * await replaceElement(currentBlock.el, currentBlock.el.nextElementSibling as HTMLElement);
1351
+ * // The two blocks have exchanged positions in the DOM.
1352
+ * ```
1352
1353
  */
1353
- async function replaceElement(elA, elB, duration = 600) {
1354
+ async function replaceElement(elA, elB) {
1354
1355
  if (elA.parentElement !== elB.parentElement) throw new Error("The parent element of the two elements is different.");
1355
- const lockCSS = {
1356
- visibility: "hidden",
1357
- pointerEvents: "none"
1358
- };
1359
- const beforeStyleA = elA.style.cssText.trim();
1360
- const beforeStyleB = elB.style.cssText.trim();
1361
- const boxA = elA.getBoundingClientRect();
1362
- const boxB = elB.getBoundingClientRect();
1363
- const tmpContainer = elA.ownerDocument.createElement("div");
1364
- tmpContainer.style.position = "absolute";
1365
- tmpContainer.style.top = `0px`;
1366
- tmpContainer.style.left = `0px`;
1367
- tmpContainer.style.zIndex = "2147483647";
1368
- const tmpA = elA.cloneNode(true);
1369
- tmpA.style.position = "absolute";
1370
- tmpA.style.top = `${boxA.top}px`;
1371
- tmpA.style.left = `${boxA.left}px`;
1372
- tmpA.style.width = `${boxA.width}px`;
1373
- tmpA.style.height = `${boxA.height}px`;
1374
- tmpA.style.zIndex = "20";
1375
- const tmpB = elB.cloneNode(true);
1376
- tmpB.style.position = "absolute";
1377
- tmpB.style.top = `${boxB.top}px`;
1378
- tmpB.style.left = `${boxB.left}px`;
1379
- tmpB.style.width = `${boxB.width}px`;
1380
- tmpB.style.height = `${boxB.height}px`;
1381
- tmpB.style.zIndex = "10";
1382
- tmpContainer.append(tmpA, tmpB);
1383
- tmpContainer.ownerDocument.body.append(tmpContainer);
1384
- elB.remove();
1385
- elA.before(elB);
1386
- elA.style.visibility = lockCSS.visibility;
1387
- elA.style.pointerEvents = lockCSS.pointerEvents;
1388
- elB.style.visibility = lockCSS.visibility;
1389
- elB.style.pointerEvents = lockCSS.pointerEvents;
1390
- const animateA = tmpA.animate([{
1391
- top: tmpA.style.top,
1392
- left: tmpA.style.left
1393
- }, {
1394
- top: `${boxA.top + boxB.height}px`,
1395
- left: tmpB.style.left
1396
- }], { duration });
1397
- const animateB = tmpB.animate([{
1398
- top: tmpB.style.top,
1399
- left: tmpB.style.left
1400
- }, {
1401
- top: tmpA.style.top,
1402
- left: tmpA.style.left
1403
- }], { duration });
1404
- await Promise.all([animateA.finished, animateB.finished]);
1405
- tmpContainer.remove();
1406
- elA.removeAttribute("style");
1407
- elB.removeAttribute("style");
1408
- if (beforeStyleA) elA.style.cssText = beforeStyleA;
1409
- if (beforeStyleB) elB.style.cssText = beforeStyleB;
1356
+ const doc = elA.ownerDocument;
1357
+ const startViewTransition = doc.startViewTransition?.bind(doc);
1358
+ if (!startViewTransition) {
1359
+ elB.remove();
1360
+ elA.before(elB);
1361
+ return;
1362
+ }
1363
+ const id = ++nextViewTransitionId;
1364
+ const nameA = `bge-block-swap-${id}-a`;
1365
+ const nameB = `bge-block-swap-${id}-b`;
1366
+ const previousNameA = elA.style.viewTransitionName;
1367
+ const previousNameB = elB.style.viewTransitionName;
1368
+ elA.style.viewTransitionName = nameA;
1369
+ elB.style.viewTransitionName = nameB;
1370
+ try {
1371
+ await startViewTransition(() => {
1372
+ elB.remove();
1373
+ elA.before(elB);
1374
+ }).finished;
1375
+ } finally {
1376
+ if (previousNameA) elA.style.viewTransitionName = previousNameA;
1377
+ else elA.style.removeProperty("view-transition-name");
1378
+ if (previousNameB) elB.style.viewTransitionName = previousNameB;
1379
+ else elB.style.removeProperty("view-transition-name");
1380
+ }
1410
1381
  }
1411
- //#endregion
1412
- //#region src/commands/register-engine-commands.ts
1382
+ // src/commands/register-engine-commands.ts
1413
1383
  /**
1414
1384
  * Register the engine's central command dispatch table.
1415
1385
  *
@@ -1534,8 +1504,7 @@ var draft_switcher_module_default = {
1534
1504
  draftTabBtn: "_draftTabBtn_14xtl_16",
1535
1505
  draftCopyBtn: "_draftCopyBtn_14xtl_47"
1536
1506
  };
1537
- //#endregion
1538
- //#region src/components/draft-switcher.tsx
1507
+ // src/components/draft-switcher.tsx
1539
1508
  /**
1540
1509
  * Main/draft content switcher. Switching and copying are declared as
1541
1510
  * engine commands; the pressed state follows `engine.uiState.activeArea`
@@ -1697,8 +1666,7 @@ function _temp2$2(s_0) {
1697
1666
  function _temp$2(s) {
1698
1667
  return s.sourceMode;
1699
1668
  }
1700
- //#endregion
1701
- //#region src/mount.tsx
1669
+ // src/mount.tsx
1702
1670
  /**
1703
1671
  * Mount a React node into a DOM container and return a `Disposable`
1704
1672
  * teardown handle, matching the `UICreator` contract shape used across
@@ -1728,8 +1696,7 @@ function reactMount(node, target) {
1728
1696
  [Symbol.dispose]: teardown
1729
1697
  };
1730
1698
  }
1731
- //#endregion
1732
- //#region src/root-error-boundary.tsx
1699
+ // src/root-error-boundary.tsx
1733
1700
  /**
1734
1701
  * Report a render error onto the engine element as `bge:error`. This is
1735
1702
  * the only way an in-tree failure reaches code outside React — `core`
@@ -1812,8 +1779,7 @@ function RootErrorBoundary(t0) {
1812
1779
  } else t1 = $[1];
1813
1780
  return t1;
1814
1781
  }
1815
- //#endregion
1816
- //#region src/animate-insertion.ts
1782
+ // src/animate-insertion.ts
1817
1783
  var INSERTION_ANIMATION_DURATION_MS = 400;
1818
1784
  /**
1819
1785
  * Expand the block-insertion marker from zero to its natural height.
@@ -1840,8 +1806,30 @@ async function animateInsertion(markerEl) {
1840
1806
  easing: "ease"
1841
1807
  }).finished.then(() => {}, () => {});
1842
1808
  }
1843
- //#endregion
1844
- //#region src/use-command.ts
1809
+ // src/block-swap-view-transition-css.ts
1810
+ /**
1811
+ * Editable-area iframe 文書に注入するブロック入れ替え View Transition 用 CSS。
1812
+ * アニメ時間と prefers-reduced-motion はここが正であり、`replace-element.spec.ts`
1813
+ * でも同じ文字列を注入して検証する。
1814
+ */
1815
+ var BLOCK_SWAP_VIEW_TRANSITION_CSS = `
1816
+ ::view-transition {
1817
+ pointer-events: none;
1818
+ }
1819
+
1820
+ ::view-transition-group(*) {
1821
+ animation-duration: 600ms;
1822
+ }
1823
+
1824
+ @media (prefers-reduced-motion: reduce) {
1825
+ ::view-transition-group(*),
1826
+ ::view-transition-old(*),
1827
+ ::view-transition-new(*) {
1828
+ animation: none;
1829
+ }
1830
+ }
1831
+ `.trim();
1832
+ // src/use-command.ts
1845
1833
  /**
1846
1834
  * Receive Invoker Commands API `command` events on the element the returned
1847
1835
  * ref callback is attached to. Buttons address the element with
@@ -1909,12 +1897,55 @@ function useCommand(handlers) {
1909
1897
  useEffect(t1, t2);
1910
1898
  return setEl;
1911
1899
  }
1912
- var block_menu_button_module_default = { wrapper: "_wrapper_t7zhr_1" };
1913
- //#endregion
1914
- //#region src/components/block-menu-button.tsx
1900
+ // src/components/block-menu-anchors.ts
1901
+ /** ホバー中ブロックの CSS アンカー名(`position-anchor` の参照先) */
1902
+ var BGE_BLOCK_MENU_BLOCK_ANCHOR = "--bge-current-block";
1903
+ /**
1904
+ * ブロック内アイテム(`[data-bgi]`)の CSS アンカー名を返す。
1905
+ * @param index - ブロック内の出現順(0 始まり)
1906
+ * @example
1907
+ * ```ts
1908
+ * bgeBlockMenuItemAnchorName(0); // '--bge-block-menu-item-0'
1909
+ * ```
1910
+ */
1911
+ function bgeBlockMenuItemAnchorName(index) {
1912
+ return `--bge-block-menu-item-${index}`;
1913
+ }
1914
+ /**
1915
+ * @param blockEl - `[data-bge-container]` のブロック要素
1916
+ */
1917
+ function clearBlockMenuAnchors(blockEl) {
1918
+ blockEl.style.removeProperty("anchor-name");
1919
+ for (const itemEl of blockEl.querySelectorAll("[data-bgi]")) itemEl.style.removeProperty("anchor-name");
1920
+ }
1921
+ /**
1922
+ * メニューとアイテムオーバーレイが参照するアンカーをブロック DOM に付与する。
1923
+ * `itemEls` は `Item.getInstance` で解決済みの `[data-bgi]` だけを渡す(オーバーレイの
1924
+ * `value` インデックスと `itemsRef` が同じ並びになる)。
1925
+ * @param blockEl - `[data-bge-container]` のブロック要素
1926
+ * @param itemEls - アンカーを付与するアイテム要素(出現順)
1927
+ * @returns 付与したアイテムアンカー名の一覧(オーバーレイの `position-anchor` 用)
1928
+ */
1929
+ function applyBlockMenuAnchors(blockEl, itemEls) {
1930
+ blockEl.style.setProperty("anchor-name", BGE_BLOCK_MENU_BLOCK_ANCHOR);
1931
+ const anchorNames = [];
1932
+ for (const [index, itemEl] of itemEls.entries()) {
1933
+ const name = bgeBlockMenuItemAnchorName(index);
1934
+ itemEl.style.setProperty("anchor-name", name);
1935
+ anchorNames.push(name);
1936
+ }
1937
+ return anchorNames;
1938
+ }
1939
+ var block_menu_button_module_default = { wrapper: "_wrapper_rfa8x_1" };
1940
+ // src/components/block-menu-button.tsx
1915
1941
  /**
1916
- * Icon button of the block menu with an anchored tooltip. The action is
1917
- * declared with the Invoker Commands API instead of a click handler.
1942
+ * Icon button of the block menu with an anchored hint tooltip (`interestfor`
1943
+ * + `popover="hint"`). Esc dismisses the tooltip without moving pointer or
1944
+ * focus (WCAG 1.4.13). The admin UI targets the latest stable Chrome, which
1945
+ * implements Interest Invokers; without `HTMLButtonElement.prototype
1946
+ * .interestForElement`, hints do not open (there is no CSS-only fallback).
1947
+ * The action is declared with the Invoker Commands API instead of a click
1948
+ * handler.
1918
1949
  * @param root0
1919
1950
  * @param root0.label
1920
1951
  * @param root0.command
@@ -1954,6 +1985,7 @@ function BlockMenuButton(t0) {
1954
1985
  t5 = /* @__PURE__ */ jsx("button", {
1955
1986
  type: "button",
1956
1987
  "aria-labelledby": uid,
1988
+ interestfor: uid,
1957
1989
  command,
1958
1990
  commandfor,
1959
1991
  value,
@@ -1970,6 +2002,7 @@ function BlockMenuButton(t0) {
1970
2002
  if ($[10] !== label || $[11] !== uid) {
1971
2003
  t6 = /* @__PURE__ */ jsx("span", {
1972
2004
  id: uid,
2005
+ popover: "hint",
1973
2006
  children: label
1974
2007
  });
1975
2008
  $[10] = label;
@@ -1991,45 +2024,45 @@ function BlockMenuButton(t0) {
1991
2024
  return t7;
1992
2025
  }
1993
2026
  var block_menu_module_default = {
1994
- bgeMenuBase: "_bgeMenuBase_2cydd_1",
1995
- bgeMenuMargin: "_bgeMenuMargin_2cydd_10",
1996
- bgeMenu: "_bgeMenu_2cydd_1",
1997
- bgeItemOverlay: "_bgeItemOverlay_2cydd_68",
1998
- bgeMoveGroup: "_bgeMoveGroup_2cydd_85",
1999
- bgeStandardGroup: "_bgeStandardGroup_2cydd_86"
2027
+ bgeMenuBase: "_bgeMenuBase_ry5ak_1",
2028
+ bgeMenuMargin: "_bgeMenuMargin_ry5ak_11",
2029
+ bgeMenu: "_bgeMenu_ry5ak_1",
2030
+ bgeItemOverlay: "_bgeItemOverlay_ry5ak_69",
2031
+ bgeMoveGroup: "_bgeMoveGroup_ry5ak_91",
2032
+ bgeStandardGroup: "_bgeStandardGroup_ry5ak_92"
2000
2033
  };
2001
- //#endregion
2002
- //#region src/components/block-menu-view.tsx
2034
+ // src/components/block-menu-view.tsx
2003
2035
  /**
2004
- * 選択中ブロックの位置・サイズ・下マージン。座標とサイズはドキュメント
2005
- * 座標系のpx。`BlockMenu` が `getBlockAtPosition` の戻り値から算出し、
2006
- * `BlockMenuView` はこれをCSSカスタムプロパティに変換してメニューを
2007
- * ブロックに追従させる。
2036
+ * 選択中ブロックの下マージン表示用。`BlockMenu` がブロック要素の
2037
+ * 算出スタイルから読み取り、余白インジケータ(`.bgeMenuMargin`)に渡す。
2038
+ * 位置とサイズは CSS アンカー配置(`--bge-current-block`)で追従する。
2008
2039
  * @example
2009
2040
  * ```ts
2010
- * const geometry: MenuGeometry = {
2011
- * width: 320,
2012
- * height: 120,
2013
- * x: 0,
2014
- * y: 0,
2041
+ * const margin: BlockMenuMargin = {
2015
2042
  * marginBlockEnd: 16,
2016
2043
  * marginBlockEndValue: '1em',
2017
2044
  * };
2018
2045
  * ```
2019
2046
  */
2020
2047
  /**
2021
- * ブロック内の各アイテム(`[data-bgi]`要素)のオーバーレイ矩形。
2022
- * 座標はブロック左上を原点とした相対px。クリックするとそのアイテムの
2023
- * エディタが開く透明ボタンの位置決めに使う。
2048
+ * ブロック内の各アイテム(`[data-bgi]`)に付与した CSS アンカー名。
2049
+ * 対応する DOM 要素の `anchor-name` と一致し、オーバーレイの
2050
+ * `position-anchor` が参照する。
2024
2051
  * @example
2025
2052
  * ```ts
2026
- * const rect: ItemOverlayRect = { x: 8, y: 8, width: 140, height: 40 };
2053
+ * const anchor: ItemOverlayAnchor = { anchorName: '--bge-block-menu-item-0' };
2027
2054
  * ```
2028
2055
  */
2029
2056
  /**
2057
+ * @deprecated {@link BlockMenuMargin} に置き換え。位置・サイズはアンカー配置で決まる。
2058
+ */
2059
+ /**
2060
+ * @deprecated {@link ItemOverlayAnchor} に置き換え。
2061
+ */
2062
+ /**
2030
2063
  * `BlockMenu` の描画専用の中身。マウス追跡・`BurgerBlock` 解決・
2031
- * `engine` 接続は一切持たず、位置とアイテム矩形を props で受け取って
2032
- * 並べるだけの純粋なプレゼンテーションコンポーネント。
2064
+ * `engine` 接続は一切持たず、マージンとアイテムアンカーを props で
2065
+ * 受け取って並べるだけの純粋なプレゼンテーションコンポーネント。
2033
2066
  *
2034
2067
  * `BurgerBlock` の実インスタンス生成なしに見た目だけ確認したい用途
2035
2068
  * (Storybook)のために `BlockMenu` から切り出されている。
@@ -2038,8 +2071,8 @@ var block_menu_module_default = {
2038
2071
  * @param root0.menuId
2039
2072
  * @param root0.commandBusId
2040
2073
  * @param root0.visible
2041
- * @param root0.geometry
2042
- * @param root0.itemRects
2074
+ * @param root0.margin
2075
+ * @param root0.itemAnchors
2043
2076
  * @param root0.isMutable
2044
2077
  * @example
2045
2078
  * ```tsx
@@ -2048,145 +2081,126 @@ var block_menu_module_default = {
2048
2081
  * menuId="bge-block-menu"
2049
2082
  * commandBusId={engine.commandBus.receiverId}
2050
2083
  * visible
2051
- * geometry={{ width: 100, height: 40, x: 0, y: 0, marginBlockEnd: 0, marginBlockEndValue: '0px' }}
2052
- * itemRects={[]}
2084
+ * margin={{ marginBlockEnd: 0, marginBlockEndValue: '0px' }}
2085
+ * itemAnchors={[{ anchorName: '--bge-block-menu-item-0' }]}
2053
2086
  * isMutable
2054
2087
  * />
2055
2088
  * ```
2056
2089
  */
2057
2090
  function BlockMenuView(t0) {
2058
- const $ = c(59);
2059
- const { rootRef, menuId, commandBusId, visible, geometry, itemRects, isMutable } = t0;
2091
+ const $ = c(55);
2092
+ const { rootRef, menuId, commandBusId, visible, margin, itemAnchors, isMutable } = t0;
2060
2093
  const t1 = !visible;
2061
- const t2 = `${geometry.width}px`;
2062
- const t3 = `${geometry.height}px`;
2063
- const t4 = `${geometry.x}px`;
2064
- const t5 = `${geometry.y}px`;
2065
- const t6 = `${geometry.marginBlockEnd ?? "0"}px`;
2066
- let t7;
2067
- if ($[0] !== t2 || $[1] !== t3 || $[2] !== t4 || $[3] !== t5 || $[4] !== t6) {
2068
- t7 = {
2069
- "--width": t2,
2070
- "--height": t3,
2071
- "--x": t4,
2072
- "--y": t5,
2073
- "--margin-block-end": t6
2074
- };
2094
+ const t2 = `${margin.marginBlockEnd}px`;
2095
+ let t3;
2096
+ if ($[0] !== t2) {
2097
+ t3 = { "--margin-block-end": t2 };
2075
2098
  $[0] = t2;
2076
2099
  $[1] = t3;
2077
- $[2] = t4;
2078
- $[3] = t5;
2079
- $[4] = t6;
2080
- $[5] = t7;
2081
- } else t7 = $[5];
2082
- const t8 = t7;
2083
- let t9;
2084
- if ($[6] !== itemRects || $[7] !== menuId) {
2085
- let t10;
2086
- if ($[9] !== menuId) {
2087
- t10 = (rect, index) => /* @__PURE__ */ jsx("button", {
2100
+ } else t3 = $[1];
2101
+ const t4 = t3;
2102
+ let t5;
2103
+ if ($[2] !== itemAnchors || $[3] !== menuId) {
2104
+ let t6;
2105
+ if ($[5] !== menuId) {
2106
+ t6 = (item, index) => /* @__PURE__ */ jsx("button", {
2088
2107
  type: "button",
2089
2108
  className: block_menu_module_default.bgeItemOverlay,
2090
2109
  "aria-label": "コンテンツを編集",
2091
2110
  command: "--open-item-editor",
2092
2111
  commandfor: menuId,
2093
2112
  value: index,
2094
- style: {
2095
- insetInlineStart: `${rect.x}px`,
2096
- insetBlockStart: `${rect.y}px`,
2097
- inlineSize: `${rect.width}px`,
2098
- blockSize: `${rect.height}px`
2099
- }
2100
- }, index);
2101
- $[9] = menuId;
2102
- $[10] = t10;
2103
- } else t10 = $[10];
2104
- t9 = itemRects.map(t10);
2105
- $[6] = itemRects;
2106
- $[7] = menuId;
2107
- $[8] = t9;
2108
- } else t9 = $[8];
2109
- let t10;
2110
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
2111
- t10 = /* @__PURE__ */ jsx(IconArrowBigUpLine, {});
2112
- $[11] = t10;
2113
- } else t10 = $[11];
2114
- let t11;
2115
- if ($[12] !== commandBusId) {
2116
- t11 = /* @__PURE__ */ jsx(BlockMenuButton, {
2113
+ style: { "--item-anchor": item.anchorName }
2114
+ }, item.anchorName);
2115
+ $[5] = menuId;
2116
+ $[6] = t6;
2117
+ } else t6 = $[6];
2118
+ t5 = itemAnchors.map(t6);
2119
+ $[2] = itemAnchors;
2120
+ $[3] = menuId;
2121
+ $[4] = t5;
2122
+ } else t5 = $[4];
2123
+ let t6;
2124
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
2125
+ t6 = /* @__PURE__ */ jsx(IconArrowBigUpLine, {});
2126
+ $[7] = t6;
2127
+ } else t6 = $[7];
2128
+ let t7;
2129
+ if ($[8] !== commandBusId) {
2130
+ t7 = /* @__PURE__ */ jsx(BlockMenuButton, {
2117
2131
  label: "ひとつ上へ移動",
2118
2132
  command: BGE_COMMAND.moveBlock,
2119
2133
  commandfor: commandBusId,
2120
2134
  value: "up",
2121
- children: t10
2135
+ children: t6
2122
2136
  });
2123
- $[12] = commandBusId;
2124
- $[13] = t11;
2125
- } else t11 = $[13];
2126
- let t12;
2127
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
2128
- t12 = /* @__PURE__ */ jsx(IconArrowBigDownLine, {});
2129
- $[14] = t12;
2130
- } else t12 = $[14];
2131
- let t13;
2132
- if ($[15] !== commandBusId) {
2133
- t13 = /* @__PURE__ */ jsx(BlockMenuButton, {
2137
+ $[8] = commandBusId;
2138
+ $[9] = t7;
2139
+ } else t7 = $[9];
2140
+ let t8;
2141
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
2142
+ t8 = /* @__PURE__ */ jsx(IconArrowBigDownLine, {});
2143
+ $[10] = t8;
2144
+ } else t8 = $[10];
2145
+ let t9;
2146
+ if ($[11] !== commandBusId) {
2147
+ t9 = /* @__PURE__ */ jsx(BlockMenuButton, {
2134
2148
  label: "ひとつ下へ移動",
2135
2149
  command: BGE_COMMAND.moveBlock,
2136
2150
  commandfor: commandBusId,
2137
2151
  value: "down",
2138
- children: t12
2152
+ children: t8
2139
2153
  });
2140
- $[15] = commandBusId;
2141
- $[16] = t13;
2142
- } else t13 = $[16];
2143
- let t14;
2144
- if ($[17] !== t11 || $[18] !== t13) {
2145
- t14 = /* @__PURE__ */ jsxs("div", {
2154
+ $[11] = commandBusId;
2155
+ $[12] = t9;
2156
+ } else t9 = $[12];
2157
+ let t10;
2158
+ if ($[13] !== t7 || $[14] !== t9) {
2159
+ t10 = /* @__PURE__ */ jsxs("div", {
2146
2160
  className: block_menu_module_default.bgeMoveGroup,
2147
- children: [t11, t13]
2161
+ children: [t7, t9]
2148
2162
  });
2149
- $[17] = t11;
2150
- $[18] = t13;
2151
- $[19] = t14;
2152
- } else t14 = $[19];
2153
- let t15;
2154
- if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
2155
- t15 = /* @__PURE__ */ jsx(IconRowInsertTop, {});
2156
- $[20] = t15;
2157
- } else t15 = $[20];
2158
- let t16;
2159
- if ($[21] !== commandBusId) {
2160
- t16 = /* @__PURE__ */ jsx(BlockMenuButton, {
2163
+ $[13] = t7;
2164
+ $[14] = t9;
2165
+ $[15] = t10;
2166
+ } else t10 = $[15];
2167
+ let t11;
2168
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
2169
+ t11 = /* @__PURE__ */ jsx(IconRowInsertTop, {});
2170
+ $[16] = t11;
2171
+ } else t11 = $[16];
2172
+ let t12;
2173
+ if ($[17] !== commandBusId) {
2174
+ t12 = /* @__PURE__ */ jsx(BlockMenuButton, {
2161
2175
  label: "上にブロックを追加",
2162
2176
  command: BGE_COMMAND.insertBlock,
2163
2177
  commandfor: commandBusId,
2164
2178
  value: "before",
2165
- children: t15
2179
+ children: t11
2166
2180
  });
2167
- $[21] = commandBusId;
2168
- $[22] = t16;
2169
- } else t16 = $[22];
2170
- let t17;
2171
- if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
2172
- t17 = /* @__PURE__ */ jsx(IconRowInsertBottom, {});
2173
- $[23] = t17;
2174
- } else t17 = $[23];
2175
- let t18;
2176
- if ($[24] !== commandBusId) {
2177
- t18 = /* @__PURE__ */ jsx(BlockMenuButton, {
2181
+ $[17] = commandBusId;
2182
+ $[18] = t12;
2183
+ } else t12 = $[18];
2184
+ let t13;
2185
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
2186
+ t13 = /* @__PURE__ */ jsx(IconRowInsertBottom, {});
2187
+ $[19] = t13;
2188
+ } else t13 = $[19];
2189
+ let t14;
2190
+ if ($[20] !== commandBusId) {
2191
+ t14 = /* @__PURE__ */ jsx(BlockMenuButton, {
2178
2192
  label: "下にブロックを追加",
2179
2193
  command: BGE_COMMAND.insertBlock,
2180
2194
  commandfor: commandBusId,
2181
2195
  value: "after",
2182
- children: t17
2196
+ children: t13
2183
2197
  });
2184
- $[24] = commandBusId;
2185
- $[25] = t18;
2186
- } else t18 = $[25];
2187
- let t19;
2188
- if ($[26] !== commandBusId || $[27] !== isMutable) {
2189
- t19 = isMutable ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(BlockMenuButton, {
2198
+ $[20] = commandBusId;
2199
+ $[21] = t14;
2200
+ } else t14 = $[21];
2201
+ let t15;
2202
+ if ($[22] !== commandBusId || $[23] !== isMutable) {
2203
+ t15 = isMutable ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(BlockMenuButton, {
2190
2204
  label: "ブロック内に要素を追加",
2191
2205
  command: BGE_COMMAND.updateGridItems,
2192
2206
  commandfor: commandBusId,
@@ -2199,132 +2213,131 @@ function BlockMenuView(t0) {
2199
2213
  value: "-1",
2200
2214
  children: /* @__PURE__ */ jsx(IconLayoutGridRemove, {})
2201
2215
  })] }) : null;
2202
- $[26] = commandBusId;
2203
- $[27] = isMutable;
2204
- $[28] = t19;
2205
- } else t19 = $[28];
2206
- let t20;
2207
- if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
2208
- t20 = /* @__PURE__ */ jsx(IconSettings, {});
2209
- $[29] = t20;
2210
- } else t20 = $[29];
2211
- let t21;
2212
- if ($[30] !== commandBusId) {
2213
- t21 = /* @__PURE__ */ jsx(BlockMenuButton, {
2216
+ $[22] = commandBusId;
2217
+ $[23] = isMutable;
2218
+ $[24] = t15;
2219
+ } else t15 = $[24];
2220
+ let t16;
2221
+ if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
2222
+ t16 = /* @__PURE__ */ jsx(IconSettings, {});
2223
+ $[25] = t16;
2224
+ } else t16 = $[25];
2225
+ let t17;
2226
+ if ($[26] !== commandBusId) {
2227
+ t17 = /* @__PURE__ */ jsx(BlockMenuButton, {
2214
2228
  label: "オプション設定",
2215
2229
  command: BGE_COMMAND.openBlockOptions,
2216
2230
  commandfor: commandBusId,
2217
- children: t20
2231
+ children: t16
2218
2232
  });
2219
- $[30] = commandBusId;
2220
- $[31] = t21;
2221
- } else t21 = $[31];
2222
- let t22;
2223
- if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
2224
- t22 = /* @__PURE__ */ jsx(IconClipboardPlus, {});
2225
- $[32] = t22;
2226
- } else t22 = $[32];
2227
- let t23;
2228
- if ($[33] !== commandBusId) {
2229
- t23 = /* @__PURE__ */ jsx(BlockMenuButton, {
2233
+ $[26] = commandBusId;
2234
+ $[27] = t17;
2235
+ } else t17 = $[27];
2236
+ let t18;
2237
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
2238
+ t18 = /* @__PURE__ */ jsx(IconClipboardPlus, {});
2239
+ $[28] = t18;
2240
+ } else t18 = $[28];
2241
+ let t19;
2242
+ if ($[29] !== commandBusId) {
2243
+ t19 = /* @__PURE__ */ jsx(BlockMenuButton, {
2230
2244
  label: "ブロックをコピー",
2231
2245
  command: BGE_COMMAND.copyBlock,
2232
2246
  commandfor: commandBusId,
2233
- children: t22
2247
+ children: t18
2234
2248
  });
2235
- $[33] = commandBusId;
2236
- $[34] = t23;
2237
- } else t23 = $[34];
2238
- let t24;
2239
- if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
2240
- t24 = /* @__PURE__ */ jsx(IconTrash, {});
2241
- $[35] = t24;
2242
- } else t24 = $[35];
2243
- let t25;
2244
- if ($[36] !== commandBusId) {
2245
- t25 = /* @__PURE__ */ jsx(BlockMenuButton, {
2249
+ $[29] = commandBusId;
2250
+ $[30] = t19;
2251
+ } else t19 = $[30];
2252
+ let t20;
2253
+ if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
2254
+ t20 = /* @__PURE__ */ jsx(IconTrash, {});
2255
+ $[31] = t20;
2256
+ } else t20 = $[31];
2257
+ let t21;
2258
+ if ($[32] !== commandBusId) {
2259
+ t21 = /* @__PURE__ */ jsx(BlockMenuButton, {
2246
2260
  label: "ブロックを削除",
2247
2261
  command: BGE_COMMAND.removeBlock,
2248
2262
  commandfor: commandBusId,
2249
- children: t24
2263
+ children: t20
2250
2264
  });
2251
- $[36] = commandBusId;
2252
- $[37] = t25;
2253
- } else t25 = $[37];
2254
- let t26;
2255
- if ($[38] !== t16 || $[39] !== t18 || $[40] !== t19 || $[41] !== t21 || $[42] !== t23 || $[43] !== t25) {
2256
- t26 = /* @__PURE__ */ jsxs("div", {
2265
+ $[32] = commandBusId;
2266
+ $[33] = t21;
2267
+ } else t21 = $[33];
2268
+ let t22;
2269
+ if ($[34] !== t12 || $[35] !== t14 || $[36] !== t15 || $[37] !== t17 || $[38] !== t19 || $[39] !== t21) {
2270
+ t22 = /* @__PURE__ */ jsxs("div", {
2257
2271
  className: block_menu_module_default.bgeStandardGroup,
2258
2272
  children: [
2259
- t16,
2260
- t18,
2273
+ t12,
2274
+ t14,
2275
+ t15,
2276
+ t17,
2261
2277
  t19,
2262
- t21,
2263
- t23,
2264
- t25
2278
+ t21
2265
2279
  ]
2266
2280
  });
2267
- $[38] = t16;
2268
- $[39] = t18;
2269
- $[40] = t19;
2270
- $[41] = t21;
2271
- $[42] = t23;
2272
- $[43] = t25;
2273
- $[44] = t26;
2274
- } else t26 = $[44];
2275
- let t27;
2276
- if ($[45] !== t14 || $[46] !== t26) {
2277
- t27 = /* @__PURE__ */ jsxs("div", {
2281
+ $[34] = t12;
2282
+ $[35] = t14;
2283
+ $[36] = t15;
2284
+ $[37] = t17;
2285
+ $[38] = t19;
2286
+ $[39] = t21;
2287
+ $[40] = t22;
2288
+ } else t22 = $[40];
2289
+ let t23;
2290
+ if ($[41] !== t10 || $[42] !== t22) {
2291
+ t23 = /* @__PURE__ */ jsxs("div", {
2278
2292
  className: block_menu_module_default.bgeMenu,
2279
- children: [t14, t26]
2293
+ children: [t10, t22]
2280
2294
  });
2281
- $[45] = t14;
2282
- $[46] = t26;
2283
- $[47] = t27;
2284
- } else t27 = $[47];
2285
- let t28;
2286
- if ($[48] !== geometry.marginBlockEnd || $[49] !== geometry.marginBlockEndValue) {
2287
- t28 = /* @__PURE__ */ jsx("div", {
2295
+ $[41] = t10;
2296
+ $[42] = t22;
2297
+ $[43] = t23;
2298
+ } else t23 = $[43];
2299
+ let t24;
2300
+ if ($[44] !== margin.marginBlockEnd || $[45] !== margin.marginBlockEndValue) {
2301
+ t24 = /* @__PURE__ */ jsx("div", {
2288
2302
  className: block_menu_module_default.bgeMenuMargin,
2289
2303
  children: /* @__PURE__ */ jsxs("span", { children: [
2290
2304
  "余白: ",
2291
- geometry.marginBlockEndValue,
2305
+ margin.marginBlockEndValue,
2292
2306
  " (",
2293
- geometry.marginBlockEnd,
2307
+ margin.marginBlockEnd,
2294
2308
  "px)"
2295
2309
  ] })
2296
2310
  });
2297
- $[48] = geometry.marginBlockEnd;
2298
- $[49] = geometry.marginBlockEndValue;
2299
- $[50] = t28;
2300
- } else t28 = $[50];
2301
- let t29;
2302
- if ($[51] !== menuId || $[52] !== rootRef || $[53] !== t1 || $[54] !== t27 || $[55] !== t28 || $[56] !== t8 || $[57] !== t9) {
2303
- t29 = /* @__PURE__ */ jsxs("div", {
2311
+ $[44] = margin.marginBlockEnd;
2312
+ $[45] = margin.marginBlockEndValue;
2313
+ $[46] = t24;
2314
+ } else t24 = $[46];
2315
+ let t25;
2316
+ if ($[47] !== menuId || $[48] !== rootRef || $[49] !== t1 || $[50] !== t23 || $[51] !== t24 || $[52] !== t4 || $[53] !== t5) {
2317
+ t25 = /* @__PURE__ */ jsxs("div", {
2304
2318
  ref: rootRef,
2305
2319
  id: menuId,
2306
2320
  hidden: t1,
2307
2321
  className: block_menu_module_default.bgeMenuBase,
2308
- style: t8,
2322
+ style: t4,
2309
2323
  children: [
2310
- t9,
2311
- t27,
2312
- t28
2324
+ t5,
2325
+ t23,
2326
+ t24
2313
2327
  ]
2314
2328
  });
2315
- $[51] = menuId;
2316
- $[52] = rootRef;
2317
- $[53] = t1;
2318
- $[54] = t27;
2319
- $[55] = t28;
2320
- $[56] = t8;
2321
- $[57] = t9;
2322
- $[58] = t29;
2323
- } else t29 = $[58];
2324
- return t29;
2329
+ $[47] = menuId;
2330
+ $[48] = rootRef;
2331
+ $[49] = t1;
2332
+ $[50] = t23;
2333
+ $[51] = t24;
2334
+ $[52] = t4;
2335
+ $[53] = t5;
2336
+ $[54] = t25;
2337
+ } else t25 = $[54];
2338
+ return t25;
2325
2339
  }
2326
- //#endregion
2327
- //#region src/components/block-menu.tsx
2340
+ // src/components/block-menu.tsx
2328
2341
  /**
2329
2342
  * Hover menu over the selected block inside the editable area iframe.
2330
2343
  * Block operations are declared as engine commands; positioning and
@@ -2347,7 +2360,7 @@ function BlockMenuView(t0) {
2347
2360
  * ```
2348
2361
  */
2349
2362
  function BlockMenu(t0) {
2350
- const $ = c(32);
2363
+ const $ = c(33);
2351
2364
  const { container } = t0;
2352
2365
  const engine = useEngine();
2353
2366
  const menuId = useId();
@@ -2358,26 +2371,23 @@ function BlockMenu(t0) {
2358
2371
  t1 = [];
2359
2372
  $[0] = t1;
2360
2373
  } else t1 = $[0];
2361
- const [itemRects, setItemRects] = useState(t1);
2374
+ const [itemAnchors, setItemAnchors] = useState(t1);
2362
2375
  let t2;
2363
2376
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
2364
2377
  t2 = [];
2365
2378
  $[1] = t2;
2366
2379
  } else t2 = $[1];
2367
2380
  const itemsRef = useRef(t2);
2381
+ const anchoredBlockElRef = useRef(null);
2368
2382
  let t3;
2369
2383
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
2370
2384
  t3 = {
2371
- width: 0,
2372
- height: 0,
2373
- x: 0,
2374
- y: 0,
2375
2385
  marginBlockEnd: 0,
2376
2386
  marginBlockEndValue: "0px"
2377
2387
  };
2378
2388
  $[2] = t3;
2379
2389
  } else t3 = $[2];
2380
- const [geometry, setGeometry] = useState(t3);
2390
+ const [margin, setMargin] = useState(t3);
2381
2391
  let t4;
2382
2392
  if ($[3] !== engine.isProcessed || $[4] !== engine.uiState) {
2383
2393
  t4 = { "--open-item-editor": (e) => {
@@ -2393,35 +2403,50 @@ function BlockMenu(t0) {
2393
2403
  } else t4 = $[5];
2394
2404
  const rootRef = useCommand(t4);
2395
2405
  let t5;
2396
- if ($[6] !== engine) {
2406
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
2397
2407
  t5 = () => {
2408
+ const el = anchoredBlockElRef.current;
2409
+ if (el) {
2410
+ clearBlockMenuAnchors(el);
2411
+ anchoredBlockElRef.current = null;
2412
+ }
2413
+ };
2414
+ $[6] = t5;
2415
+ } else t5 = $[6];
2416
+ const clearAnchoredBlock = t5;
2417
+ let t6;
2418
+ if ($[7] !== engine) {
2419
+ t6 = () => {
2398
2420
  setVisible(false);
2421
+ clearAnchoredBlock();
2422
+ setItemAnchors([]);
2423
+ itemsRef.current = [];
2399
2424
  engine.clearCurrentBlock();
2400
2425
  };
2401
- $[6] = engine;
2402
- $[7] = t5;
2403
- } else t5 = $[7];
2404
- const hide = t5;
2405
- let t6;
2406
- if ($[8] !== engine.uiState || $[9] !== hide) {
2407
- t6 = () => engine.uiState.subscribe(() => {
2426
+ $[7] = engine;
2427
+ $[8] = t6;
2428
+ } else t6 = $[8];
2429
+ const hide = t6;
2430
+ let t7;
2431
+ if ($[9] !== engine.uiState || $[10] !== hide) {
2432
+ t7 = () => engine.uiState.subscribe(() => {
2408
2433
  if (engine.uiState.getSnapshot().processing) hide();
2409
2434
  });
2410
- $[8] = engine.uiState;
2411
- $[9] = hide;
2412
- $[10] = t6;
2413
- } else t6 = $[10];
2414
- let t7;
2415
- if ($[11] !== engine || $[12] !== hide) {
2416
- t7 = [engine, hide];
2417
- $[11] = engine;
2418
- $[12] = hide;
2419
- $[13] = t7;
2420
- } else t7 = $[13];
2421
- useEffect(t6, t7);
2435
+ $[9] = engine.uiState;
2436
+ $[10] = hide;
2437
+ $[11] = t7;
2438
+ } else t7 = $[11];
2422
2439
  let t8;
2423
- if ($[14] !== container.ownerDocument || $[15] !== engine || $[16] !== hide) {
2424
- t8 = () => {
2440
+ if ($[12] !== engine || $[13] !== hide) {
2441
+ t8 = [engine, hide];
2442
+ $[12] = engine;
2443
+ $[13] = hide;
2444
+ $[14] = t8;
2445
+ } else t8 = $[14];
2446
+ useEffect(t7, t8);
2447
+ let t9;
2448
+ if ($[15] !== container.ownerDocument || $[16] !== engine || $[17] !== hide) {
2449
+ t9 = () => {
2425
2450
  const doc = container.ownerDocument;
2426
2451
  const body = doc.body;
2427
2452
  const win = doc.defaultView;
@@ -2433,6 +2458,7 @@ function BlockMenu(t0) {
2433
2458
  let raf = 0;
2434
2459
  stack.defer(() => cancelAnimationFrame(raf));
2435
2460
  stack.defer(() => listeners.abort());
2461
+ stack.defer(() => clearAnchoredBlock());
2436
2462
  const updatePosition = () => {
2437
2463
  const selected = getBlockAtPosition(doc, mouseX, mouseY);
2438
2464
  if (!selected) {
@@ -2440,27 +2466,20 @@ function BlockMenu(t0) {
2440
2466
  return;
2441
2467
  }
2442
2468
  setVisible(true);
2443
- const { block, rect, marginBlockEnd } = selected;
2444
- setGeometry({
2445
- width: rect.width,
2446
- height: rect.height,
2447
- x: rect.left,
2448
- y: rect.top,
2469
+ const { block, marginBlockEnd } = selected;
2470
+ const blockEl = block.el;
2471
+ if (anchoredBlockElRef.current !== blockEl) {
2472
+ clearAnchoredBlock();
2473
+ anchoredBlockElRef.current = blockEl;
2474
+ }
2475
+ const itemEntries = [...blockEl.querySelectorAll("[data-bgi]")].map(_temp2$1).filter(_temp3);
2476
+ itemsRef.current = itemEntries.map(_temp4);
2477
+ const anchorNames = applyBlockMenuAnchors(blockEl, itemEntries.map(_temp5));
2478
+ setItemAnchors(anchorNames.map(_temp6));
2479
+ setMargin({
2449
2480
  marginBlockEnd,
2450
- marginBlockEndValue: window.getComputedStyle(block.el).getPropertyValue("--bge-block-margin")
2481
+ marginBlockEndValue: win?.getComputedStyle(blockEl).getPropertyValue("--bge-block-margin") ?? "0px"
2451
2482
  });
2452
- const itemEntries = [...block.el.querySelectorAll("[data-bgi]")].map(_temp2$1).filter(_temp3);
2453
- itemsRef.current = itemEntries.map(_temp4);
2454
- setItemRects(itemEntries.map((t9) => {
2455
- const { el: itemEl_0 } = t9;
2456
- const itemRect = itemEl_0.getBoundingClientRect();
2457
- return {
2458
- x: itemRect.left - rect.left,
2459
- y: itemRect.top - rect.top,
2460
- width: itemRect.width,
2461
- height: itemRect.height
2462
- };
2463
- }));
2464
2483
  engine.setCurrentBlock(block);
2465
2484
  };
2466
2485
  const scheduleUpdate = () => {
@@ -2485,72 +2504,61 @@ function BlockMenu(t0) {
2485
2504
  doc.addEventListener("mouseleave", onHideEvent, { signal });
2486
2505
  win?.addEventListener("mouseleave", onHideEvent, { signal });
2487
2506
  globalThis.addEventListener("resize", onHideEvent, { signal });
2488
- engine.el.addEventListener("bge:saved", scheduleUpdate, { signal });
2489
- const observer = new MutationObserver((mutations) => {
2490
- for (const mutation of mutations) for (const node of mutation.addedNodes) {
2491
- if (node.nodeType !== Node.ELEMENT_NODE) continue;
2492
- const element = node;
2493
- const images = element.matches("img") ? [element] : element.querySelectorAll("img");
2494
- for (const img of images) {
2495
- img.addEventListener("load", scheduleUpdate, { once: true });
2496
- img.addEventListener("error", scheduleUpdate, { once: true });
2497
- img.addEventListener("abort", scheduleUpdate, { once: true });
2498
- }
2499
- }
2500
- });
2501
- observer.observe(doc, {
2502
- childList: true,
2503
- subtree: true
2504
- });
2505
- stack.defer(() => observer.disconnect());
2506
2507
  return () => stack.dispose();
2507
2508
  };
2508
- $[14] = container.ownerDocument;
2509
- $[15] = engine;
2510
- $[16] = hide;
2511
- $[17] = t8;
2512
- } else t8 = $[17];
2513
- let t9;
2514
- if ($[18] !== container || $[19] !== engine || $[20] !== hide) {
2515
- t9 = [
2509
+ $[15] = container.ownerDocument;
2510
+ $[16] = engine;
2511
+ $[17] = hide;
2512
+ $[18] = t9;
2513
+ } else t9 = $[18];
2514
+ let t10;
2515
+ if ($[19] !== container || $[20] !== engine || $[21] !== hide) {
2516
+ t10 = [
2516
2517
  engine,
2517
2518
  container,
2518
- hide
2519
+ hide,
2520
+ clearAnchoredBlock
2519
2521
  ];
2520
- $[18] = container;
2521
- $[19] = engine;
2522
- $[20] = hide;
2523
- $[21] = t9;
2524
- } else t9 = $[21];
2525
- useEffect(t8, t9);
2526
- let t10;
2527
- if ($[22] !== currentBlock) {
2528
- t10 = currentBlock?.isMutable() ?? false;
2529
- $[22] = currentBlock;
2530
- $[23] = t10;
2531
- } else t10 = $[23];
2532
- const isMutable = t10;
2522
+ $[19] = container;
2523
+ $[20] = engine;
2524
+ $[21] = hide;
2525
+ $[22] = t10;
2526
+ } else t10 = $[22];
2527
+ useEffect(t9, t10);
2533
2528
  let t11;
2534
- if ($[24] !== engine.commandBus.receiverId || $[25] !== geometry || $[26] !== isMutable || $[27] !== itemRects || $[28] !== menuId || $[29] !== rootRef || $[30] !== visible) {
2535
- t11 = /* @__PURE__ */ jsx(BlockMenuView, {
2529
+ if ($[23] !== currentBlock) {
2530
+ t11 = currentBlock?.isMutable() ?? false;
2531
+ $[23] = currentBlock;
2532
+ $[24] = t11;
2533
+ } else t11 = $[24];
2534
+ const isMutable = t11;
2535
+ let t12;
2536
+ if ($[25] !== engine.commandBus.receiverId || $[26] !== isMutable || $[27] !== itemAnchors || $[28] !== margin || $[29] !== menuId || $[30] !== rootRef || $[31] !== visible) {
2537
+ t12 = /* @__PURE__ */ jsx(BlockMenuView, {
2536
2538
  rootRef,
2537
2539
  menuId,
2538
2540
  commandBusId: engine.commandBus.receiverId,
2539
2541
  visible,
2540
- geometry,
2541
- itemRects,
2542
+ margin,
2543
+ itemAnchors,
2542
2544
  isMutable
2543
2545
  });
2544
- $[24] = engine.commandBus.receiverId;
2545
- $[25] = geometry;
2546
+ $[25] = engine.commandBus.receiverId;
2546
2547
  $[26] = isMutable;
2547
- $[27] = itemRects;
2548
- $[28] = menuId;
2549
- $[29] = rootRef;
2550
- $[30] = visible;
2551
- $[31] = t11;
2552
- } else t11 = $[31];
2553
- return t11;
2548
+ $[27] = itemAnchors;
2549
+ $[28] = margin;
2550
+ $[29] = menuId;
2551
+ $[30] = rootRef;
2552
+ $[31] = visible;
2553
+ $[32] = t12;
2554
+ } else t12 = $[32];
2555
+ return t12;
2556
+ }
2557
+ function _temp6(anchorName) {
2558
+ return { anchorName };
2559
+ }
2560
+ function _temp5(entry_1) {
2561
+ return entry_1.el;
2554
2562
  }
2555
2563
  function _temp4(entry_0) {
2556
2564
  return entry_0.item;
@@ -2567,8 +2575,7 @@ function _temp2$1(itemEl) {
2567
2575
  function _temp$1(s) {
2568
2576
  return s.currentBlock;
2569
2577
  }
2570
- //#endregion
2571
- //#region src/components/initial-insertion-button.tsx
2578
+ // src/components/initial-insertion-button.tsx
2572
2579
  /**
2573
2580
  * Button shown in an empty editable area to insert the first block.
2574
2581
  * Declares the engine command instead of taking a callback.
@@ -2596,8 +2603,7 @@ function InitialInsertionButton(t0) {
2596
2603
  } else t1 = $[1];
2597
2604
  return t1;
2598
2605
  }
2599
- //#endregion
2600
- //#region src/components/editable-area-view.tsx
2606
+ // src/components/editable-area-view.tsx
2601
2607
  var CONTAINER_PADDING = 10;
2602
2608
  var CONTENT_ID = "bge-editable-area";
2603
2609
  /**
@@ -2676,8 +2682,7 @@ function EditableAreaView(t0) {
2676
2682
  const injectedUiStyle = frameDoc.createElement("style");
2677
2683
  injectedUiStyle.textContent = `@layer ${CSS_LAYER.ui} {
2678
2684
  [data-bge-component='block-menu'] {
2679
- position: absolute;
2680
- inset: 0;
2685
+ position: static;
2681
2686
  z-index: 2147483647;
2682
2687
  pointer-events: none;
2683
2688
  }
@@ -2702,7 +2707,9 @@ function EditableAreaView(t0) {
2702
2707
  outline-offset: 2px;
2703
2708
  animation: bge-highlight-blink 0.5s ease-in-out 2;
2704
2709
  }
2705
- }`;
2710
+ }
2711
+
2712
+ ${BLOCK_SWAP_VIEW_TRANSITION_CSS}`;
2706
2713
  frameDoc.head.append(injectedUiStyle);
2707
2714
  frameDoc.body.setAttribute("style", "margin: 0; border: 0;");
2708
2715
  engine.commandBus.createReceiver(frameDoc.body);
@@ -2950,7 +2957,6 @@ function _temp2(s_1) {
2950
2957
  function _temp(s_0) {
2951
2958
  return s_0.processing;
2952
2959
  }
2953
- //#endregion
2954
- export { IconTrash as _, BlockMenuButton as a, reportRenderError as c, registerEngineCommands as d, useUIState as f, BlockCatalog as g, BlockOptions as h, BlockMenuView as i, reactMount as l, EditorDialog as m, InitialInsertionButton as n, useCommand as o, ItemEditorHost as p, BlockMenu as r, RootErrorBoundary as s, EditableAreaView as t, DraftSwitcher as u, IconRowInsertBottom as v, createReactComponent as y };
2960
+ export { BlockCatalog as _, BlockMenuButton as a, createReactComponent as b, RootErrorBoundary as c, DraftSwitcher as d, registerEngineCommands as f, BlockOptions as g, EditorDialog as h, BlockMenuView as i, reportRenderError as l, ItemEditorHost as m, InitialInsertionButton as n, BGE_BLOCK_MENU_BLOCK_ANCHOR as o, useUIState as p, BlockMenu as r, useCommand as s, EditableAreaView as t, reactMount as u, IconTrash as v, IconRowInsertBottom as y };
2955
2961
 
2956
- //# sourceMappingURL=editable-area-view-BRYT222Y.js.map
2962
+ //# sourceMappingURL=editable-area-view-DhEipEQV.js.map