@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 +1 @@
1
- {"version":3,"file":"block-catalog.d.ts","sourceRoot":"","sources":["../../src/components/block-catalog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAU5E;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,+BA8D/E"}
1
+ {"version":3,"file":"block-catalog.d.ts","sourceRoot":"","sources":["../../src/components/block-catalog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAU5E;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,+BA+D/E"}
@@ -0,0 +1,25 @@
1
+ /** ホバー中ブロックの CSS アンカー名(`position-anchor` の参照先) */
2
+ export declare const BGE_BLOCK_MENU_BLOCK_ANCHOR = "--bge-current-block";
3
+ /**
4
+ * ブロック内アイテム(`[data-bgi]`)の CSS アンカー名を返す。
5
+ * @param index - ブロック内の出現順(0 始まり)
6
+ * @example
7
+ * ```ts
8
+ * bgeBlockMenuItemAnchorName(0); // '--bge-block-menu-item-0'
9
+ * ```
10
+ */
11
+ export declare function bgeBlockMenuItemAnchorName(index: number): `--bge-block-menu-item-${number}`;
12
+ /**
13
+ * @param blockEl - `[data-bge-container]` のブロック要素
14
+ */
15
+ export declare function clearBlockMenuAnchors(blockEl: HTMLElement): void;
16
+ /**
17
+ * メニューとアイテムオーバーレイが参照するアンカーをブロック DOM に付与する。
18
+ * `itemEls` は `Item.getInstance` で解決済みの `[data-bgi]` だけを渡す(オーバーレイの
19
+ * `value` インデックスと `itemsRef` が同じ並びになる)。
20
+ * @param blockEl - `[data-bge-container]` のブロック要素
21
+ * @param itemEls - アンカーを付与するアイテム要素(出現順)
22
+ * @returns 付与したアイテムアンカー名の一覧(オーバーレイの `position-anchor` 用)
23
+ */
24
+ export declare function applyBlockMenuAnchors(blockEl: HTMLElement, itemEls: readonly HTMLElement[]): readonly string[];
25
+ //# sourceMappingURL=block-menu-anchors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-menu-anchors.d.ts","sourceRoot":"","sources":["../../src/components/block-menu-anchors.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,eAAO,MAAM,2BAA2B,wBAAwB,CAAC;AAEjE;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACzC,KAAK,EAAE,MAAM,GACX,yBAAyB,MAAM,EAAE,CAEnC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAKhE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,SAAS,WAAW,EAAE,GAC7B,SAAS,MAAM,EAAE,CASnB"}
@@ -1,7 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
2
  /**
3
- * Icon button of the block menu with an anchored tooltip. The action is
4
- * declared with the Invoker Commands API instead of a click handler.
3
+ * Icon button of the block menu with an anchored hint tooltip (`interestfor`
4
+ * + `popover="hint"`). Esc dismisses the tooltip without moving pointer or
5
+ * focus (WCAG 1.4.13). The admin UI targets the latest stable Chrome, which
6
+ * implements Interest Invokers; without `HTMLButtonElement.prototype
7
+ * .interestForElement`, hints do not open (there is no CSS-only fallback).
8
+ * The action is declared with the Invoker Commands API instead of a click
9
+ * handler.
5
10
  * @param root0
6
11
  * @param root0.label
7
12
  * @param root0.command
@@ -1 +1 @@
1
- {"version":3,"file":"block-menu-button.d.ts","sourceRoot":"","sources":["../../src/components/block-menu-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAMtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,EAC/B,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,EACL,QAAQ,GACR,EAAE;IACF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC7B,+BAiBA"}
1
+ {"version":3,"file":"block-menu-button.d.ts","sourceRoot":"","sources":["../../src/components/block-menu-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAItD,OAAO,sBAAsB,CAAC;AAG9B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,EAC/B,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,EACL,QAAQ,GACR,EAAE;IACF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC7B,+BAoBA"}
@@ -1,50 +1,56 @@
1
1
  import { Ref } from 'react';
2
2
  /**
3
- * 選択中ブロックの位置・サイズ・下マージン。座標とサイズはドキュメント
4
- * 座標系のpx。`BlockMenu` が `getBlockAtPosition` の戻り値から算出し、
5
- * `BlockMenuView` はこれをCSSカスタムプロパティに変換してメニューを
6
- * ブロックに追従させる。
3
+ * 選択中ブロックの下マージン表示用。`BlockMenu` がブロック要素の
4
+ * 算出スタイルから読み取り、余白インジケータ(`.bgeMenuMargin`)に渡す。
5
+ * 位置とサイズは CSS アンカー配置(`--bge-current-block`)で追従する。
7
6
  * @example
8
7
  * ```ts
9
- * const geometry: MenuGeometry = {
10
- * width: 320,
11
- * height: 120,
12
- * x: 0,
13
- * y: 0,
8
+ * const margin: BlockMenuMargin = {
14
9
  * marginBlockEnd: 16,
15
10
  * marginBlockEndValue: '1em',
16
11
  * };
17
12
  * ```
18
13
  */
19
- export interface MenuGeometry {
20
- readonly width: number;
21
- readonly height: number;
22
- readonly x: number;
23
- readonly y: number;
14
+ export interface BlockMenuMargin {
24
15
  /** ブロック要素の `margin-block-end` 算出値(px) */
25
16
  readonly marginBlockEnd: number;
26
17
  /** `margin-block-end` のCSS値そのまま(例: `'1em'`) */
27
18
  readonly marginBlockEndValue: string;
28
19
  }
29
20
  /**
30
- * ブロック内の各アイテム(`[data-bgi]`要素)のオーバーレイ矩形。
31
- * 座標はブロック左上を原点とした相対px。クリックするとそのアイテムの
32
- * エディタが開く透明ボタンの位置決めに使う。
21
+ * ブロック内の各アイテム(`[data-bgi]`)に付与した CSS アンカー名。
22
+ * 対応する DOM 要素の `anchor-name` と一致し、オーバーレイの
23
+ * `position-anchor` が参照する。
33
24
  * @example
34
25
  * ```ts
35
- * const rect: ItemOverlayRect = { x: 8, y: 8, width: 140, height: 40 };
26
+ * const anchor: ItemOverlayAnchor = { anchorName: '--bge-block-menu-item-0' };
36
27
  * ```
37
28
  */
38
- export interface ItemOverlayRect {
29
+ export interface ItemOverlayAnchor {
30
+ readonly anchorName: string;
31
+ }
32
+ /**
33
+ * @deprecated {@link BlockMenuMargin} に置き換え。位置・サイズはアンカー配置で決まる。
34
+ */
35
+ export type MenuGeometry = BlockMenuMargin & {
36
+ readonly width: number;
37
+ readonly height: number;
38
+ readonly x: number;
39
+ readonly y: number;
40
+ };
41
+ /**
42
+ * @deprecated {@link ItemOverlayAnchor} に置き換え。
43
+ */
44
+ export type ItemOverlayRect = ItemOverlayAnchor & {
39
45
  readonly x: number;
40
46
  readonly y: number;
41
47
  readonly width: number;
42
48
  readonly height: number;
43
- }
49
+ };
44
50
  /**
45
51
  * `BlockMenu` の描画専用の中身。マウス追跡・`BurgerBlock` 解決・
46
- * `engine` 接続は一切持たず、位置とアイテム矩形を props で受け取って
47
- * 並べるだけの純粋なプレゼンテーションコンポーネント。
52
+ * `engine` 接続は一切持たず、マージンとアイテムアンカーを props で
53
+ * 受け取って並べるだけの純粋なプレゼンテーションコンポーネント。
48
54
  *
49
55
  * `BurgerBlock` の実インスタンス生成なしに見た目だけ確認したい用途
50
56
  * (Storybook)のために `BlockMenu` から切り出されている。
@@ -53,8 +59,8 @@ export interface ItemOverlayRect {
53
59
  * @param root0.menuId
54
60
  * @param root0.commandBusId
55
61
  * @param root0.visible
56
- * @param root0.geometry
57
- * @param root0.itemRects
62
+ * @param root0.margin
63
+ * @param root0.itemAnchors
58
64
  * @param root0.isMutable
59
65
  * @example
60
66
  * ```tsx
@@ -63,20 +69,20 @@ export interface ItemOverlayRect {
63
69
  * menuId="bge-block-menu"
64
70
  * commandBusId={engine.commandBus.receiverId}
65
71
  * visible
66
- * geometry={{ width: 100, height: 40, x: 0, y: 0, marginBlockEnd: 0, marginBlockEndValue: '0px' }}
67
- * itemRects={[]}
72
+ * margin={{ marginBlockEnd: 0, marginBlockEndValue: '0px' }}
73
+ * itemAnchors={[{ anchorName: '--bge-block-menu-item-0' }]}
68
74
  * isMutable
69
75
  * />
70
76
  * ```
71
77
  */
72
- export declare function BlockMenuView({ rootRef, menuId, commandBusId, visible, geometry, itemRects, isMutable, }: {
78
+ export declare function BlockMenuView({ rootRef, menuId, commandBusId, visible, margin, itemAnchors, isMutable, }: {
73
79
  readonly rootRef: Ref<HTMLDivElement>;
74
80
  readonly menuId: string;
75
81
  /** 同一documentに複数エンジンが存在する場合の配送先。`engine.commandBus.receiverId` */
76
82
  readonly commandBusId: string;
77
83
  readonly visible: boolean;
78
- readonly geometry: MenuGeometry;
79
- readonly itemRects: readonly ItemOverlayRect[];
84
+ readonly margin: BlockMenuMargin;
85
+ readonly itemAnchors: readonly ItemOverlayAnchor[];
80
86
  readonly isMutable: boolean;
81
87
  }): import('react').JSX.Element;
82
88
  //# sourceMappingURL=block-menu-view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"block-menu-view.d.ts","sourceRoot":"","sources":["../../src/components/block-menu-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAiB,MAAM,OAAO,CAAC;AAkBhD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,+CAA+C;IAC/C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACrC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC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;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG;IACjD,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,aAAa,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,YAAY,EACZ,OAAO,EACP,MAAM,EACN,WAAW,EACX,SAAS,GACT,EAAE;IACF,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACnD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC5B,+BAwGA"}
@@ -1 +1 @@
1
- {"version":3,"file":"block-menu.d.ts","sourceRoot":"","sources":["../../src/components/block-menu.tsx"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAA;CAAE,+BAgM3E"}
1
+ {"version":3,"file":"block-menu.d.ts","sourceRoot":"","sources":["../../src/components/block-menu.tsx"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAA;CAAE,+BAiK3E"}
@@ -1 +1 @@
1
- {"version":3,"file":"block-options.d.ts","sourceRoot":"","sources":["../../src/components/block-options.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAYvD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;CAAE,+BAkStE"}
1
+ {"version":3,"file":"block-options.d.ts","sourceRoot":"","sources":["../../src/components/block-options.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAYvD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;CAAE,+BAsStE"}
@@ -1 +1 @@
1
- {"version":3,"file":"editable-area-view.d.ts","sourceRoot":"","sources":["../../src/components/editable-area-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAiB9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAAC,EAChC,IAAI,EACJ,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,GACP,EAAE;IACF,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChF,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACnD,+BAwOA"}
1
+ {"version":3,"file":"editable-area-view.d.ts","sourceRoot":"","sources":["../../src/components/editable-area-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAkB9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAAC,EAChC,IAAI,EACJ,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,GACP,EAAE;IACF,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChF,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACnD,+BAwOA"}
@@ -12,8 +12,9 @@ export interface FieldDefinition {
12
12
  }
13
13
  /**
14
14
  * Owns the Front Matter field list — the actual data, as opposed to the
15
- * view's own UI-only state (collapsed, add-dialog-open, in-progress JSON
16
- * drafts). `createFrontMatterEditor`'s handle reads `getData()`/
15
+ * view's own UI-only state (add-dialog-open, in-progress JSON drafts).
16
+ * Whether the panel is open is not part of this store.
17
+ * `createFrontMatterEditor`'s handle reads `getData()`/
17
18
  * `getSnapshot()` directly and subscribes to be notified of changes,
18
19
  * instead of a mutable closure variable updated from inside a React
19
20
  * callback — the handle has no other way to read React state from
@@ -87,9 +88,19 @@ export interface FrontMatterEditorHandle extends Disposable {
87
88
  export declare function createFrontMatterEditor(options: FrontMatterEditorOptions): FrontMatterEditorHandle;
88
89
  /**
89
90
  * Front Matterの動的フォーム本体。フィールド一覧は`store`(唯一の
90
- * データソース)から読み、折りたたみ・追加ダイアログ・JSON下書きは
91
- * この見た目だけのUI状態としてローカルに持つ。操作は Invoker Commands
92
- * (`--fm-toggle` / `--fm-add-field` / `--fm-delete-field`)で受ける
91
+ * データソース)から読み、追加ダイアログとJSON下書きはこの見た目だけの
92
+ * UI状態としてローカルに持つ。フィールドの追加と削除は Invoker Commands
93
+ * (`--fm-add-field` / `--fm-delete-field`)で受ける。
94
+ *
95
+ * 開閉は `<details>` の `open` に任せる。Invoker Command と React の
96
+ * state には戻さない。同じ状態をコマンドのハンドラと DOM の属性の両方に
97
+ * 持つと、再レンダーのたびにどちらかがもう一方を上書きする。
98
+ *
99
+ * 「+ 追加」は `summary` の外に置く。`summary` の内容モデルはフレーズ内容
100
+ * で、ボタンを入れると対話要素の入れ子になり、押すとパネルも開閉する。
101
+ * 閉じた `details` の中に置くと、閉じている間はボタンが押せなくなる。
102
+ * 見た目は見出し行の右端だが、DOM 順ではフィールドの後なので、キーボードの
103
+ * 移動順は見出し、フィールド、追加ボタンになる。
93
104
  * @param root0
94
105
  * @param root0.store
95
106
  * @example
@@ -1 +1 @@
1
- {"version":3,"file":"front-matter-editor.d.ts","sourceRoot":"","sources":["../../src/components/front-matter-editor.tsx"],"names":[],"mappings":"AAQA;;GAEG;AACH,KAAK,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gBAAgB;;IAC5B,QAAQ,CAAC,WAAW,QAAO,SAAS,eAAe,EAAE,CAAiB;IACtE,QAAQ,CAAC,SAAS,GAAI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AgB,uBAAuB,CACtC,OAAO,EAAE,wBAAwB,GAC/B,uBAAuB,CA8BzB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE,+BA6GpF"}
@@ -1,8 +1,9 @@
1
1
  export { BlockCatalog } from './block-catalog.js';
2
+ export { BGE_BLOCK_MENU_BLOCK_ANCHOR } from './block-menu-anchors.js';
2
3
  export { BlockMenu } from './block-menu.js';
3
4
  export { BlockMenuButton } from './block-menu-button.js';
4
5
  export { BlockMenuView } from './block-menu-view.js';
5
- export type { MenuGeometry, ItemOverlayRect } from './block-menu-view.js';
6
+ export type { BlockMenuMargin, ItemOverlayAnchor, MenuGeometry, ItemOverlayRect, } from './block-menu-view.js';
6
7
  export { BlockOptions } from './block-options.js';
7
8
  export { DraftSwitcher } from './draft-switcher.js';
8
9
  export { EditableAreaView } from './editable-area-view.js';
@@ -17,5 +18,6 @@ export { TableEditor } from './table-editor.js';
17
18
  export type { TableEditorData } from './table-editor.js';
18
19
  export { Tabs } from './tabs.js';
19
20
  export { Thumbnail } from './thumbnail.js';
21
+ export { ThumbnailButton } from './thumbnail-button.js';
20
22
  export { WysiwygField } from './wysiwyg-field.js';
21
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MA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AE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACN,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,GAChB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACX,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,IAAI,0BAA0B,GAC7C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Thumbnail that is itself a button. Pressing it invokes `command` on the
3
+ * `commandfor` target (like every other button in the editor UI, no click
4
+ * handler). The `label` is hidden until the pointer hovers it or it gets
5
+ * keyboard focus, so the thumbnail stays uncluttered but the action is
6
+ * discoverable.
7
+ *
8
+ * An empty `src` renders a placeholder of the same size, so a row of
9
+ * thumbnails keeps its layout while some of them have no file yet.
10
+ *
11
+ * `aria-label` is the accessible name. It must contain `label` and say what
12
+ * the button acts on, since several of these buttons sit side by side.
13
+ * @param root0
14
+ * @param root0.src - File URL to preview; empty for "no file yet"
15
+ * @param root0.label - Text shown on hover / focus (e.g. `編集`)
16
+ * @param root0.command - Command name invoked on the `commandfor` target (a custom `--`-prefixed command or a built-in one)
17
+ * @param root0.commandfor - The id of the element that receives the command; it must be in the same document as the button
18
+ * @param root0.value - Passed to the command handler as `source.value`
19
+ * @example
20
+ * ```tsx
21
+ * <ThumbnailButton
22
+ * src={slide.path}
23
+ * label="編集"
24
+ * aria-label={`スライド${index + 1}を編集`}
25
+ * command="--edit-slide"
26
+ * commandfor={rootId}
27
+ * value={String(index)}
28
+ * />
29
+ * ```
30
+ */
31
+ export declare function ThumbnailButton({ src, label, 'aria-label': ariaLabel, command, commandfor, value, }: {
32
+ readonly src: string;
33
+ readonly label: string;
34
+ readonly 'aria-label': string;
35
+ readonly command: string;
36
+ readonly commandfor: string;
37
+ readonly value?: string;
38
+ }): import('react').JSX.Element;
39
+ //# sourceMappingURL=thumbnail-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thumbnail-button.d.ts","sourceRoot":"","sources":["../../src/components/thumbnail-button.tsx"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,eAAe,CAAC,EAC/B,GAAG,EACH,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,OAAO,EACP,UAAU,EACV,KAAK,GACL,EAAE;IACF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACxB,+BAwBA"}
@@ -0,0 +1,87 @@
1
+ import { o as CommandBus, r as UIStateStore } from "./dist-DYydjVsL.js";
2
+ // ../core/dist/config-defaults.js
3
+ /**
4
+ * Fill the required keys of a `Config` that `config` omits (or sets to
5
+ * `undefined`) with empty values (`[]`, `''`, `null`); the keys it has,
6
+ * including optional ones such as `mediaQueries`, are kept as they are.
7
+ *
8
+ * Writers that build HTML without an editor engine (`render()`, the agent tools
9
+ * that write to disk) hold only part of the project config. They fill it here,
10
+ * so every such writer gets the same values for the same config.
11
+ * @param config - The keys the caller has
12
+ * @returns A complete `Config`
13
+ * @example
14
+ * ```ts
15
+ * const config = withConfigDefaults({ mediaQueries: ['(max-width: 599px)'] });
16
+ * // config.classList is [], config.googleMapsApiKey is null
17
+ * ```
18
+ */
19
+ function withConfigDefaults(config = {}) {
20
+ return {
21
+ ...config,
22
+ classList: config.classList ?? [],
23
+ googleMapsApiKey: config.googleMapsApiKey ?? null,
24
+ sampleImagePath: config.sampleImagePath ?? "",
25
+ sampleFilePath: config.sampleFilePath ?? "",
26
+ stylesheets: config.stylesheets ?? []
27
+ };
28
+ }
29
+ // src/testing/create-mock-engine.ts
30
+ /**
31
+ * テストやStorybookでコンポーネントを描画するための最小限のfake engineを作る。
32
+ *
33
+ * `uiState`/`commandBus`は本物のインスタンスをそのまま使う(`BurgerEditorEngine`は
34
+ * private constructorのため直接`new`できず、キャストで代用する)。コンポーネントが
35
+ * 実際に呼ぶメソッド・プロパティだけを`overrides`で個別に差し込む。
36
+ *
37
+ * `config`は必須のキーだけを持つ最小の値を既定にする(エディタが`useEngine().config`を
38
+ * 読むため)。別の設定を試すときは`overrides`で`config`を渡す。
39
+ *
40
+ * `overrides`にgetterを渡した場合はライブなアクセサとして保持される(単純な
41
+ * オブジェクトスプレッドだとgetterがマージ時点の値へ固定されてしまうため、
42
+ * `Object.defineProperties`でプロパティ記述子ごと合成する)。
43
+ * @param overrides - コンポーネントが必要とする追加プロパティ・メソッド
44
+ * @example
45
+ * ```ts
46
+ * const engine = createMockEngine({ content: { type: 'draft' } });
47
+ * ```
48
+ * @example
49
+ * ```ts
50
+ * // uiStateのprocessingを都度反映するライブなgetterを差し込む
51
+ * const uiState = new UIStateStore();
52
+ * const engine = createMockEngine({
53
+ * uiState,
54
+ * get isProcessed() {
55
+ * return uiState.getSnapshot().processing;
56
+ * },
57
+ * });
58
+ * ```
59
+ */
60
+ function createMockEngine(overrides = {}) {
61
+ const base = {
62
+ el: document.createElement("div"),
63
+ uiState: new UIStateStore(),
64
+ commandBus: new CommandBus(),
65
+ config: withConfigDefaults({
66
+ sampleImagePath: "/img/sample.png",
67
+ sampleFilePath: "/pdf/sample.pdf"
68
+ }),
69
+ content: { type: "main" },
70
+ isProcessed: false,
71
+ serverAPI: {},
72
+ save: () => {},
73
+ clearCurrentBlock: () => {},
74
+ showMain: () => {},
75
+ showDraft: () => {},
76
+ hasDraft: () => false,
77
+ getContentStylesheet: () => Promise.resolve(""),
78
+ getCustomProperties: () => /* @__PURE__ */ new Map(),
79
+ getRepeatMinInlineSizeVariants: () => null,
80
+ getEditableContent: () => null,
81
+ commitSourceEdit: async () => {}
82
+ };
83
+ return Object.defineProperties(base, Object.getOwnPropertyDescriptors(overrides));
84
+ }
85
+ export { createMockEngine as t };
86
+
87
+ //# sourceMappingURL=create-mock-engine-BloCpuEu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-mock-engine-BloCpuEu.js","names":["withConfigDefaults","config","classList","googleMapsApiKey","sampleImagePath","sampleFilePath","stylesheets","CommandBus","UIStateStore","withConfigDefaults","createMockEngine","overrides","el","document","createElement","base","uiState","commandBus","config","sampleImagePath","sampleFilePath","content","type","isProcessed","serverAPI","save","clearCurrentBlock","showMain","showDraft","hasDraft","getContentStylesheet","Promise","resolve","getCustomProperties","Map","getRepeatMinInlineSizeVariants","getEditableContent","commitSourceEdit","Object","defineProperties","getOwnPropertyDescriptors"],"sources":["../../core/dist/config-defaults.js","../src/testing/create-mock-engine.ts"],"sourcesContent":["/**\n * Fill the required keys of a `Config` that `config` omits (or sets to\n * `undefined`) with empty values (`[]`, `''`, `null`); the keys it has,\n * including optional ones such as `mediaQueries`, are kept as they are.\n *\n * Writers that build HTML without an editor engine (`render()`, the agent tools\n * that write to disk) hold only part of the project config. They fill it here,\n * so every such writer gets the same values for the same config.\n * @param config - The keys the caller has\n * @returns A complete `Config`\n * @example\n * ```ts\n * const config = withConfigDefaults({ mediaQueries: ['(max-width: 599px)'] });\n * // config.classList is [], config.googleMapsApiKey is null\n * ```\n */\nexport function withConfigDefaults(config = {}) {\n return {\n ...config,\n classList: config.classList ?? [],\n googleMapsApiKey: config.googleMapsApiKey ?? null,\n sampleImagePath: config.sampleImagePath ?? '',\n sampleFilePath: config.sampleFilePath ?? '',\n stylesheets: config.stylesheets ?? [],\n };\n}\n","import type { BurgerEditorEngine } from '@burger-editor/core';\n\nimport { CommandBus, UIStateStore, withConfigDefaults } from '@burger-editor/core';\n\n/**\n * テストやStorybookでコンポーネントを描画するための最小限のfake engineを作る。\n *\n * `uiState`/`commandBus`は本物のインスタンスをそのまま使う(`BurgerEditorEngine`は\n * private constructorのため直接`new`できず、キャストで代用する)。コンポーネントが\n * 実際に呼ぶメソッド・プロパティだけを`overrides`で個別に差し込む。\n *\n * `config`は必須のキーだけを持つ最小の値を既定にする(エディタが`useEngine().config`を\n * 読むため)。別の設定を試すときは`overrides`で`config`を渡す。\n *\n * `overrides`にgetterを渡した場合はライブなアクセサとして保持される(単純な\n * オブジェクトスプレッドだとgetterがマージ時点の値へ固定されてしまうため、\n * `Object.defineProperties`でプロパティ記述子ごと合成する)。\n * @param overrides - コンポーネントが必要とする追加プロパティ・メソッド\n * @example\n * ```ts\n * const engine = createMockEngine({ content: { type: 'draft' } });\n * ```\n * @example\n * ```ts\n * // uiStateのprocessingを都度反映するライブなgetterを差し込む\n * const uiState = new UIStateStore();\n * const engine = createMockEngine({\n * uiState,\n * get isProcessed() {\n * return uiState.getSnapshot().processing;\n * },\n * });\n * ```\n */\nexport function createMockEngine(\n\toverrides: Record<string, unknown> = {},\n): BurgerEditorEngine {\n\tconst el = document.createElement('div');\n\n\tconst base = {\n\t\tel,\n\t\tuiState: new UIStateStore(),\n\t\tcommandBus: new CommandBus(),\n\t\t// アイテムのエディタは`useEngine().config`を読む。差し込み忘れでundefinedを\n\t\t// 読んで落ちないよう、必須キーだけの最小の設定を既定にする\n\t\tconfig: withConfigDefaults({\n\t\t\tsampleImagePath: '/img/sample.png',\n\t\t\tsampleFilePath: '/pdf/sample.pdf',\n\t\t}),\n\t\tcontent: { type: 'main' },\n\t\tisProcessed: false,\n\t\tserverAPI: {},\n\t\tsave: () => {},\n\t\tclearCurrentBlock: () => {},\n\t\tshowMain: () => {},\n\t\tshowDraft: () => {},\n\t\thasDraft: () => false,\n\t\tgetContentStylesheet: () => Promise.resolve(''),\n\t\tgetCustomProperties: () => new Map(),\n\t\tgetRepeatMinInlineSizeVariants: () => null,\n\t\tgetEditableContent: () => null,\n\t\t// EditableAreaViewはソースモードを抜けるたびにこれを呼ぶため、\n\t\t// スタブし忘れると`commitSourceEdit is not a function`でstory/testが\n\t\t// 落ちる。実際にreplaceContents→saveの経路を検証したいテストは\n\t\t// このデフォルトごと`commitSourceEdit`をoverrideすること\n\t\tcommitSourceEdit: async () => {},\n\t};\n\n\treturn Object.defineProperties(\n\t\tbase,\n\t\tObject.getOwnPropertyDescriptors(overrides),\n\t) as unknown as BurgerEditorEngine;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,SAAgBA,mBAAmBC,SAAS,CAAC,GAAG;CAC5C,OAAO;EACH,GAAGA;EACHC,WAAWD,OAAOC,aAAa,CAAA;EAC/BC,kBAAkBF,OAAOE,oBAAoB;EAC7CC,iBAAiBH,OAAOG,mBAAmB;EAC3CC,gBAAgBJ,OAAOI,kBAAkB;EACzCC,aAAaL,OAAOK,eAAe,CAAA;CACvC;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACSA,SAAgBI,iBACfC,YAAqC,CAAC,GACjB;CAGrB,MAAMI,OAAO;EACZH,IAHUC,SAASC,cAAc,KAGjCF;EACAI,SAAS,IAAIR,aAAa;EAC1BS,YAAY,IAAIV,WAAW;EAG3BW,QAAQT,mBAAmB;GAC1BU,iBAAiB;GACjBC,gBAAgB;EACjB,CAAC;EACDC,SAAS,EAAEC,MAAM,OAAO;EACxBC,aAAa;EACbC,WAAW,CAAC;EACZC,YAAY,CAAC;EACbC,yBAAyB,CAAC;EAC1BC,gBAAgB,CAAC;EACjBC,iBAAiB,CAAC;EAClBC,gBAAgB;EAChBC,4BAA4BC,QAAQC,QAAQ,EAAE;EAC9CC,2CAA2B,IAAIC,IAAI;EACnCC,sCAAsC;EACtCC,0BAA0B;EAK1BC,kBAAkB,YAAY,CAAC;CAChC;CAEA,OAAOC,OAAOC,iBACbxB,MACAuB,OAAOE,0BAA0B7B,SAAS,CAC3C;AACD"}