@tatamicks/core 0.3.2 → 1.0.1

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.
@@ -1,3116 +1,2037 @@
1
+ /**
2
+ * @tatamicks/core - メインエントリポイント
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { ComponentType } from 'react';
1
8
  import { default as default_2 } from 'react';
9
+ import { ForwardRefExoticComponent } from 'react';
2
10
  import { JSX } from 'react/jsx-runtime';
3
- import { MemoExoticComponent } from 'react';
4
11
  import { NamedExoticComponent } from 'react';
5
12
  import { ReactNode } from 'react';
6
13
  import { RefAttributes } from 'react';
7
-
8
- export declare const ACTUAL_UNITS: readonly ["mm", "cm", "pt", "inch", "px"];
9
-
10
- export declare type ActualUnit = (typeof ACTUAL_UNITS)[number];
11
-
12
- export declare const alignmentDefinition: PluginProperties<AlignmentSchema>;
13
-
14
- export declare interface AlignmentSchema {
15
- justifyContent?: HorizontalAlign;
16
- alignItems?: VerticalAlign;
17
- }
18
-
19
- export declare const ALL_UNITS: readonly ["mm", "cm", "fr", "inch", "pt", "px", "%"];
20
-
21
- export declare type AnyBlockPlugin = BlockPlugin<Record<string, Value>, Value>;
22
-
23
- /**
24
- * 値が有限数であることを検証し、失敗時は例外を投げる
25
- * @param value 検証する値
26
- * @param name 値の名前(エラーメッセージに含まれる)
27
- * @throws {Error} 値がInfinityまたはNaNの場合
28
- */
29
- export declare function assertFinite(value: number, name?: string): void;
30
-
31
- /**
32
- * 値が整数であることを検証し、失敗時は例外を投げる
33
- * @param value 検証する値
34
- * @param name 値の名前(エラーメッセージに含まれる)
35
- * @throws {Error} 値が整数でない場合
36
- */
37
- export declare function assertInteger(value: number, name?: string): void;
14
+ import { RefObject } from 'react';
38
15
 
39
16
  /**
40
- * 値が非負(>= 0)であることを検証し、失敗時は例外を投げる
41
- * @param value 検証する値
42
- * @param name 値の名前(エラーメッセージに含まれる)
43
- * @throws {Error} 値が負の場合
17
+ * アクションバーコンポーネント。
18
+ *
19
+ * @remarks
20
+ * **Shell** `sections` 配列でセクションを渡すと区切り線を自動挿入して横並びにレンダリングする。
21
+ *
22
+ * デフォルトの `sections` は `getDefaultActionBarSections()` で取得できる。
44
23
  */
45
- export declare function assertNonNegative(value: number, name?: string): void;
24
+ export declare const ActionBar: {
25
+ ({ sections, className, style, }: ActionBarProps): JSX.Element;
26
+ displayName: string;
27
+ };
46
28
 
47
29
  /**
48
- * 値が正 (> 0) であることを検証し、失敗時は例外を投げる
49
- * @param value 検証する値
50
- * @param name 値の名前(エラーメッセージに含まれる)
51
- * @throws {Error} 値が0以下の場合
30
+ * アクションバーコンポーネントへの props。
52
31
  */
53
- export declare function assertPositive(value: number, name?: string): void;
32
+ export declare interface ActionBarProps {
33
+ /**
34
+ * バーに表示するセクションの配列。
35
+ *
36
+ * 隣接するセクション間には区切り線が自動挿入される。
37
+ *
38
+ * デフォルト値は `getDefaultActionBarSections()` で取得できる。
39
+ */
40
+ sections?: ReactNode[];
41
+ /** カスタムクラス名 */
42
+ className?: string;
43
+ /** インラインスタイル */
44
+ style?: default_2.CSSProperties;
45
+ }
54
46
 
55
47
  /**
56
- * 値が指定範囲内であることを検証し、失敗時は例外を投げる
57
- * @param value 検証する値
58
- * @param min 最小値(含む)
59
- * @param max 最大値(含む)
60
- * @param name 値の名前(エラーメッセージに含まれる)
61
- * @throws {Error} 値が範囲外の場合
48
+ * 登録済みアクションの実行および有効判定インターフェース。
49
+ *
50
+ * @remarks
51
+ * button ブロックのクリック時に呼び出される。
62
52
  */
63
- export declare function assertRange(value: number, min: number, max: number, name?: string): void;
64
-
65
- export declare const BackgroundPanel: default_2.FC<BackgroundPanelProps>;
66
-
67
- export declare interface BackgroundPanelProps {
68
- selectedBlocks: Block[];
69
- onUpdateBlocks: (updates: Record<string, Partial<Block>>) => void;
53
+ export declare interface ActionContext {
54
+ /** 指定 ID のアクションを実行する。 */
55
+ execute(actionId: BuiltinActionId | (string & {}), payload?: unknown): void;
56
+ /** 指定 ID のアクションが実行可能か返す。 */
57
+ isEnabled(actionId: BuiltinActionId | (string & {})): boolean;
70
58
  }
71
59
 
72
- export declare function binarySearch(num: number, arr: readonly number[]): number;
73
-
74
60
  /**
75
- * ブロックデータ(永続化対象)
76
- *
77
- * @template P - プラグイン固有プロパティ型
61
+ * アクション実行後にトースト通知で表示するフィードバック情報。
78
62
  *
79
63
  * @remarks
80
- * - JSONから読み込み、JSONに保存される型
81
- * - グリッド座標(論理座標)で位置を管理
82
- * - 画面サイズやDPIに依存しない
83
- * - FormSchema.blocks の要素型
64
+ * `ActionBar` / `CanvasActionSection` に渡す `onActionFeedback` の引数型。
84
65
  */
85
- export declare interface Block<P = Record<string, Value>> {
86
- id: string;
87
- kind: string;
88
- layout: BlockRect;
89
- style?: BlockStyle;
90
- behavior?: BlockBehavior;
91
- props: P;
92
- initValue?: Value;
66
+ declare interface ActionFeedback {
67
+ /** アクションの識別子 */
68
+ actionId: string;
69
+ /** トースト通知に表示するメッセージ */
70
+ message: string;
71
+ /** ショートカットキーの表示文字列(なしの場合は `null`) */
72
+ shortcut: string | null;
93
73
  }
94
74
 
95
- export declare const BLOCK_SUB_INDEX: {
96
- readonly BG: 10;
97
- readonly CONTENT: 50;
98
- readonly GUIDE: 70;
99
- readonly BORDER: 80;
100
- };
101
-
102
75
  /**
103
- * ブロックの動作設定
76
+ * 末尾に空ページを追加した新しい Book を返す。
104
77
  */
105
- export declare interface BlockBehavior {
106
- readOnly?: boolean;
107
- }
78
+ export declare function addPage(book: Book): Book;
108
79
 
109
80
  /**
110
- * BlockBorder
111
- *
112
- * ブロックの境界線を描画するコンポーネント
113
- * - block.style?.borderで設定された枠線を描画
114
- * - pointer-events: none (クリックイベント透過)
115
- *
116
- * @remarks
117
- * - ユーザー設定の枠線を描画
118
- * - BlockBaseBorderと構造は同じだが、用途とz-indexが異なる
119
- * - BlockBaseBorder: ガイド線(GUIDE層)
120
- * - BlockBorder: 実際の枠線(BORDER層)
81
+ * ブロック内の水平・垂直配置を保持する Props。
121
82
  */
122
- export declare const BlockBorder: default_2.FC<BlockBorderProps>;
83
+ declare interface AlignmentProps {
84
+ /** 水平配置 */
85
+ horizontal?: HorizontalAlign;
86
+ /** 垂直配置 */
87
+ vertical?: VerticalAlign;
88
+ }
123
89
 
124
90
  /**
125
- * BlockBorderコンポーネントのProps
91
+ * 全単位の配列。
126
92
  */
127
- export declare interface BlockBorderProps {
128
- blockSizePx: BlockSizePx;
129
- borderStyle?: BorderStyle;
130
- blockZIndex: number;
131
- subZIndex?: number;
132
- visible?: boolean;
133
- dpi?: number;
134
- className?: string;
135
- }
93
+ declare const ALL_UNITS: readonly ["mm", "cm", "fr", "inch", "pt", "px", "%"];
94
+
95
+ /* Excluded from this release type: AnyBlockPlugin */
136
96
 
137
97
  /**
138
- * BlockCanvas
98
+ * フォーム構築に最低限必要な標準プラグインのリスト。
99
+ *
100
+ * `CheckboxPlugin` / `SelectPlugin` / `TextPlugin` の3つを含む。
139
101
  *
140
- * ブロック背景を描画するコンポーネント
141
- * - z-index: ブロック基底値 + 0 (各ブロックの最下層)
142
- * - pointer-events: none (クリックイベント透過)
143
- * - 背景色のみを描画(境界線はBlockBaseBorderが担当)
102
+ * `createPluginRegistry` にそのまま渡して使用する。
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * import { BASE_PLUGINS, createPluginRegistry } from "@tatamicks/core";
107
+ *
108
+ * const pluginRegistry = createPluginRegistry(BASE_PLUGINS);
109
+ * ```
144
110
  */
145
- export declare const BlockCanvas: default_2.FC<BlockCanvasProps>;
111
+ export declare const BASE_PLUGINS: readonly [BlockPlugin<CheckboxBlockProps, boolean>, BlockPlugin<SelectBlockProps, SelectBlockValue>, BlockPlugin<TextBlockProps, TextBlockValue>];
146
112
 
147
113
  /**
148
- * BlockCanvasコンポーネントのProps
114
+ * 全ブロックに共通して存在する基底プロパティ。
115
+ *
116
+ * コンテナが alignment / padding を CSS に変換し、Renderer は意識しない。
149
117
  */
150
- export declare interface BlockCanvasProps {
151
- blockSizePx: BlockSizePx;
152
- blockZIndex: number;
153
- subZIndex?: number;
154
- backgroundColor?: string;
155
- className?: string;
118
+ declare interface BaseBlockProps extends AlignmentProps, PaddingProps {
119
+ /** 値の読み書き先 `BindingContext` のドットパス。バインディングを使わないブロックは省略可 */
120
+ binding?: string;
156
121
  }
157
122
 
158
- export declare interface BlockChangeEvent {
159
- type: BlockChangeType;
160
- blockIds: string[];
161
- blocks?: Block[];
162
- updates?: Record<string, Partial<Block>>;
163
- }
164
-
165
- export declare enum BlockChangeType {
166
- /** ブロック追加 */
167
- ADD = "add",
168
- /** ブロック更新 */
169
- UPDATE = "update",
170
- /** ブロック削除 */
171
- DELETE = "delete",
172
- /** ブロック移動 */
173
- MOVE = "move",
174
- /** ブロックリサイズ */
175
- RESIZE = "resize",
176
- /** ブロック複製 */
177
- DUPLICATE = "duplicate",
178
- /** ブロック貼り付け */
179
- PASTE = "paste"
180
- }
181
-
182
- export declare const BlockContainer: NamedExoticComponent<BlockContainerProps & RefAttributes<BlockRef>>;
183
-
184
- export declare interface BlockContainerProps {
185
- block: Block;
186
- plugin: BlockPlugin;
187
- blockRectPx: BlockRectPx;
188
- blockZIndex: number;
189
- mode: NoteMode;
190
- value: Value;
191
- onValueChange?: (val: Value) => void;
192
- onValueBlur?: (val: Value) => void;
193
- showGuides?: boolean;
194
- showBorder?: boolean;
195
- blockSubZIndex?: Record<string, number>;
196
- defaultGuideBorder?: BorderStyle;
197
- dpi?: number;
198
- className?: string;
199
- pointerEvents?: "auto" | "none";
200
- }
123
+ declare type BaseRenderer = ForwardRefExoticComponent<RendererProps<Record<string, Value>, Value> & RefAttributes<BlockRef>>;
201
124
 
202
125
  /**
203
- * ブロックコンテナスタイルのオプション
126
+ * binding パスによる設定値の読み書きインターフェース。
127
+ *
128
+ * @remarks
129
+ * `HiddenBinding` の評価および button ブロックのアクション判定に使用される。
204
130
  */
205
- export declare interface BlockContainerStyleOptions {
206
- /** z-index値 (オプション) */
207
- zIndex?: number;
208
- /** ポインターイベントの制御 (デフォルト: "auto") */
209
- pointerEvents?: "auto" | "none";
131
+ export declare interface BindingContext {
132
+ /**
133
+ * 指定パスの値を取得する。
134
+ *
135
+ * - パスが存在し値が `null` の場合: `null` を返す。
136
+ * - パスの値が未設定(未登録)の場合: `undefined` を返す。
137
+ *
138
+ * `extra` として渡す実装では、担当外のパスに対して `undefined` を返すことで
139
+ * 組み込みの BindingContext へのフォールバックを指示できる。
140
+ * 有効値として `null` を返す場合はフォールバックしない。
141
+ */
142
+ get(path: string): Value | undefined;
143
+ /** 指定パスに値を書き込む。 */
144
+ set(path: string, value: Value): void;
210
145
  }
211
146
 
212
147
  /**
213
- * BlockBaseBorder
214
- *
215
- * レイアウト編集時にブロックの境界を可視化するガイド線コンポーネント
216
- * - formモードでのみ使用される
217
- * - block.style?.borderが未設定のブロックに表示
218
- * - pointer-events: none (クリックイベント透過)
148
+ * book 内のブロックを表すインターフェース。
219
149
  *
220
150
  * @remarks
221
- * - 固定スタイル(薄いグレーの実線)でブロック境界を描画
222
- * - ユーザー設定の枠線とは別の、編集補助用のガイド
223
- * - BorderOverlayと構造は同じだが、用途と表示条件が異なる
151
+ * - `kind` はプラグインの登録 ID(`createPluginRegistry` に渡した `kind`)と対応する。
152
+ *
153
+ * - `props` の値解決順序: `block.props` → `page.blockDefaults?.[kind]` → `PropDef.defaultProps`
154
+ *
155
+ * - `id` はブック全体でユニークである必要がある。
156
+ *
157
+ * - `P` のジェネリクスは `Page.blocks: Block[]` に格納すると `Record<string, Value>` に消去される。
158
+ *
159
+ * そのため `block.kind === "text"` のように `kind` で条件分岐しても TypeScript は `props` の型を絞り込まない。
160
+ *
161
+ * props に型安全にアクセスするには `pluginRegistry[block.kind]?.validateProps(block.props)` を使用すること。
162
+ *
163
+ * 実行時の型保証は `BlockPlugin.validateProps` が担保している。
164
+ *
165
+ * - `P` に関数・クラスインスタンス・DOM 要素など非シリアライズ可能な値を含めると、JSON 保存時に値が消失する。
166
+ *
167
+ * 型パラメータ `P` は {@link SerializableRecord}(= `Record<string, Value | undefined>`)互換であること。
168
+ *
169
+ * 検証には `satisfies SerializableRecord` を使用すること。
224
170
  */
225
- export declare const BlockGuideBorder: default_2.FC<BlockGuideBorderProps>;
171
+ export declare interface Block<P extends SerializableRecord = Record<string, Value>> {
172
+ /** ブロック ID */
173
+ id: string;
174
+ /** ブロック種別(プラグインの kind) */
175
+ kind: string;
176
+ /** ブロックの位置とサイズ */
177
+ layout: BlockRect;
178
+ /** ブロック固有のプロパティ(プラグインごとに内容が異なる) */
179
+ props: P;
180
+ /** ブロックのスタイル */
181
+ style?: BlockStyle;
182
+ /** ブロックの動作設定 */
183
+ behavior?: BlockBehavior;
184
+ /** ブロックの表示/非表示を制御する条件式 */
185
+ hiddenBinding?: HiddenBinding;
186
+ /**
187
+ * form モードで送信するデフォルト値。
188
+ *
189
+ * 設定されている場合、edit モードで自動で初期値として使用される。
190
+ */
191
+ initValue?: Value;
192
+ }
226
193
 
227
194
  /**
228
- * BlockBaseBorderコンポーネントのProps
195
+ * ブロックの動作設定。
196
+ *
197
+ * @remarks
198
+ * キーが存在する(`true`)場合に有効、`undefined` の場合は無効として扱う。
229
199
  */
230
- export declare interface BlockGuideBorderProps {
231
- blockSizePx: BlockSizePx;
232
- blockZIndex: number;
233
- subZIndex?: number;
234
- borderStyle?: BorderStyle;
235
- visible?: boolean;
236
- dpi?: number;
237
- className?: string;
238
- }
239
-
240
- export declare const BlockLayer: MemoExoticComponent<({ blocks, pluginRegistry, mode, values, selectedBlockIds, getBlockRectPx, onValueChange, onValueBlur, showGuides, showBorder, blockSubZIndex, defaultGuideBorder, dpi, className, }: BlockLayerProps) => JSX.Element>;
241
-
242
- export declare interface BlockLayerProps {
243
- blocks: Block[];
244
- pluginRegistry: Record<string, BlockPlugin>;
245
- mode: NoteMode;
246
- values: Record<string, Value>;
247
- selectedBlockIds?: string[];
248
- getBlockRectPx: (block: Block) => BlockRectPx;
249
- onValueChange?: OnChange;
250
- onValueBlur?: OnBlur;
251
- showGuides?: boolean;
252
- showBorder?: boolean;
253
- blockSubZIndex?: Record<string, number>;
254
- defaultGuideBorder?: BorderStyle;
255
- dpi?: number;
256
- className?: string;
200
+ export declare interface BlockBehavior {
201
+ /**
202
+ * 読み取り専用フラグ。
203
+ *
204
+ * `NoteMode.VIEW` の強制読み取りとは独立して動作し、EDIT モードでも入力をブロックする。
205
+ */
206
+ readOnly?: true;
207
+ /**
208
+ * コンテンツ実測幅にブロックを伸縮させる。
209
+ *
210
+ * `paper.autoWidth` と組み合わせるとキャンバス幅も追従する。
211
+ */
212
+ widthFit?: true;
213
+ /**
214
+ * コンテンツ実測高さにブロックを伸縮させる。
215
+ *
216
+ * `paper.autoHeight` と組み合わせるとキャンバス高さも追従する。
217
+ */
218
+ heightFit?: true;
257
219
  }
258
220
 
259
221
  /**
260
- * ブロックレイアウト(グリッド座標系)
222
+ * ブロック種別ごとの共通デフォルトプロパティ。
223
+ *
224
+ * @remarks
225
+ * - キー: プラグインの kind(例: `"text"`, `"checkbox"`)
226
+ * - 値: プロパティの部分辞書。`block.props` にキーが存在しない場合に参照され、
227
+ * それも存在しない場合は `PropDef.defaultProps` にフォールバックする
228
+ *
229
+ * @example
230
+ * ```ts
231
+ * const defaults: BlockDefaults = {
232
+ * text: { fontFamily: "serif", verticalAlign: "center" },
233
+ * checkbox: { horizontalAlign: "center" },
234
+ * };
235
+ * ```
261
236
  */
262
- export declare interface BlockLayout {
263
- x: number;
264
- y: number;
265
- w: number;
266
- h: number;
267
- }
237
+ export declare type BlockDefaults = Record<string, Record<string, Value>>;
268
238
 
269
239
  /**
270
- * BlockOrderPanel
271
- * ブロックの配列順序を変更するパネル
272
- * UIでは上が最前面、下が最背面(一般的なデザインソフトと同じ)
273
- * 内部配列では最後が最前面
240
+ * ブロックレイアウト設定 compound widget。
241
+ *
242
+ * @remarks
243
+ * カスタムシェル構築専用。
244
+ *
245
+ * X / Y / W / H の 4 入力を 1 行フラット構成で横並びにする。
246
+ *
247
+ * 12 列 × 1 行グリッド。
248
+ *
249
+ * 列構成:
250
+ *
251
+ * 0(label X) 1(input X) 2(stepper X・8mm)
252
+ *
253
+ * 3(label Y) 4(input Y) 5(stepper Y・8mm)
254
+ *
255
+ * 6(label W) 7(input W) 8(stepper W・8mm)
256
+ *
257
+ * 9(label H) 10(input H) 11(stepper H・8mm)
274
258
  */
275
- export declare const BlockOrderPanel: {
276
- ({ blocks, onBlocksChange, }: BlockOrderPanelProps): JSX.Element;
277
- displayName: string;
278
- };
279
-
280
- export declare interface BlockOrderPanelProps {
281
- /** ブロック一覧 */
282
- blocks: Block[];
283
- /** ブロック更新時のコールバック (blocks配列全体を更新) */
284
- onBlocksChange: (blocks: Block[]) => void;
285
- }
259
+ export declare const blockLayoutWidget: WidgetDef;
286
260
 
287
261
  /**
288
- * BlockPlugin 型定義
262
+ * ブロックプラグインの定義。
263
+ *
264
+ * @remarks
265
+ * 型パラメータ `P` は JSON シリアライズ可能なプロパティのみを持つこと。
266
+ *
267
+ * 関数・クラスインスタンス・DOM 要素などの非 serializable な値を含めると、`book` を JSON 保存・復元した際に値が消失する。
268
+ *
269
+ * `P extends BaseBlockProps` は TypeScript 上の型エラーとならないため、非シリアライズ型を渡してもコンパイル時には検知されない。
270
+ *
271
+ * `P` の serializable 性を型レベルで検証するには `satisfies SerializableRecord` を使う。
289
272
  *
290
- * @template P - プラグイン固有プロパティ型
291
- * @template V - プラグインが扱う値の型
273
+ * @example
274
+ * ```ts
275
+ * import type { SerializableRecord } from "@tatamicks/core";
276
+ *
277
+ * interface MyProps extends BaseBlockProps {
278
+ * label: string;
279
+ * count: number;
280
+ * }
281
+ * // ✅ シリアライズ可能か検証
282
+ * type _check = MyProps satisfies SerializableRecord;
283
+ * ```
292
284
  */
293
- export declare interface BlockPlugin<P = Record<string, Value>, V = Value> {
285
+ declare interface BlockPlugin<P extends BaseBlockProps = BaseBlockProps, V = Value> {
286
+ /** プラグインの一意識別子。`block.kind` と対応する */
294
287
  kind: string;
288
+ /** UI表示・アイコン・デフォルトサイズ等のメタ情報 */
295
289
  meta: BlockPluginMeta;
296
- Renderer: default_2.ForwardRefExoticComponent<RendererProps<P, V> & default_2.RefAttributes<BlockRef>>;
297
- properties: PluginProperties<P>;
290
+ /**
291
+ * ブロックを描画する `forwardRef` コンポーネント。
292
+ *
293
+ * `BlockRef.focus()` を `useImperativeHandle` で公開する必要がある。
294
+ *
295
+ * @example
296
+ * ```tsx
297
+ * const MyRenderer = forwardRef<BlockRef, RendererProps<MyProps, string>>(
298
+ * ({ props, value, onChange, readOnly }, ref) => {
299
+ * const inputRef = useRef<HTMLInputElement>(null);
300
+ * useImperativeHandle(ref, () => ({ focus: () => inputRef.current?.focus() }));
301
+ * return (
302
+ * <input
303
+ * ref={inputRef}
304
+ * value={value ?? ""}
305
+ * readOnly={readOnly}
306
+ * onChange={(e) => onChange(e.target.value)}
307
+ * />
308
+ * );
309
+ * },
310
+ * );
311
+ * ```
312
+ */
313
+ Renderer: ForwardRefExoticComponent<RendererProps<P, V> & RefAttributes<BlockRef>>;
314
+ /**
315
+ * プロパティパネルに表示するプロパティ定義一覧。
316
+ *
317
+ * `defaultProps` は配列順に合成され、同じキーは後ろの定義が優先される。
318
+ */
319
+ properties: PropDef[];
320
+ /**
321
+ * ストレージから読み込んだ生の `block.props` をサニタイズして型安全な Props に変換する。
322
+ *
323
+ * 省略時は raw オブジェクトをそのまま使用する。
324
+ */
298
325
  validateProps?: (props: unknown) => P;
299
- validateValue?: (value: unknown, props: P) => V | null;
326
+ /**
327
+ * 外部 state から読み込んだ生の値をサニタイズする。
328
+ *
329
+ * `undefined` を返した場合は `block.initValue`、それもなければ raw 値にフォールバックする。
330
+ *
331
+ * フォールバックを指示する場合にのみ `undefined` を使い、`null` は正当な値として返せる。
332
+ *
333
+ * 省略時は raw 値をそのまま使用する。
334
+ *
335
+ * 戻り値 `V` は {@link Value} 互換型(JSON serializable)にすること。
336
+ *
337
+ * 日付は `Date` インスタンスではなく ISO 8601 文字列(例: `"2025-01-01"`)で表現する。
338
+ */
339
+ validateValue?: (value: unknown, props: P) => V | undefined;
340
+ /** 旧バージョンの props を現バージョンにマイグレーションする。`validateProps` の前に呼ばれる */
341
+ migrateProps?: (props: unknown) => Record<string, unknown>;
300
342
  }
301
343
 
302
344
  /**
303
- * プラグインのメタ情報
345
+ * pluginのメタ情報(UI表示・アイコン・デフォルトサイズ)。
304
346
  */
305
- export declare interface BlockPluginMeta {
347
+ declare interface BlockPluginMeta {
348
+ /** UIに表示されるブロック名 */
306
349
  displayName: string;
307
- description: string;
308
- icon?: default_2.ComponentType<PluginIconProps>;
309
- defaultSize: BlockSize;
350
+ /** ブロックの説明文 */
351
+ description?: string;
352
+ /** ブロックのグリッド上のデフォルトサイズ */
353
+ defaultSize?: BlockSize;
354
+ /** ブロック選択パネルなどで使用するアイコンコンポーネント */
355
+ icon?: ComponentType<{
356
+ className?: string;
357
+ }>;
310
358
  }
311
359
 
312
360
  /**
313
- * ブロックの位置とサイズ(グリッド座標)
314
- *
315
- * @remarks
316
- * - JSONに保存される論理座標
317
- * - 画面サイズやDPIに依存しない
318
- * - レスポンシブ対応・印刷時の一貫性のためグリッド座標を使用
361
+ * ブロックのグリッド上座標。
319
362
  */
320
363
  export declare interface BlockPos {
364
+ /** グリッド列の開始位置 (0-based) */
321
365
  x: number;
366
+ /** グリッド行の開始位置 (0-based) */
322
367
  y: number;
323
368
  }
324
369
 
325
370
  /**
326
- * ブロックの位置とサイズ(ピクセル座標)
327
- *
328
- * @remarks
329
- * - レンダリング時に使用する物理座標
330
- * - グリッド座標から計算される(BlockLayerで変換)
331
- * - 画面サイズやDPIに依存
332
- */
333
- export declare interface BlockPosPx {
334
- left: number;
335
- top: number;
336
- }
337
-
338
- /**
339
- * PropertyPanel
340
- *
341
- * 選択されたブロックのプロパティを編集するための統合サイドバーコンポーネント。
342
- * BasePanels(共通設定)と PluginPanels(固有設定)を組み合わせて表示します。
371
+ * ブロックのグリッド上の位置とサイズを合わせた矩形領域。
343
372
  */
344
- export declare const BlockPropertyPanel: MemoExoticComponent<({ selectedBlocks, pluginRegistry, onUpdateBlocks, gridSize, className, }: BlockPropertyPanelProps) => JSX.Element>;
345
-
346
- export declare interface BlockPropertyPanelProps {
347
- selectedBlocks: Block[];
348
- pluginRegistry: Record<string, BlockPlugin>;
349
- onUpdateBlocks: (updates: Record<string, Partial<Block>>) => void;
350
- gridSize?: {
351
- cols: number;
352
- rows: number;
353
- };
354
- className?: string;
355
- }
356
-
357
373
  export declare interface BlockRect extends BlockPos, BlockSize {
358
374
  }
359
375
 
360
- export declare interface BlockRectPx extends BlockPosPx, BlockSizePx {
361
- }
362
-
363
376
  /**
364
- * ブロック参照インターフェース (Renderer が実装)
365
- *
366
- * @remarks
367
- * すべてのプラグインのRendererコンポーネントは、
368
- * forwardRefを使用してこのインターフェースを実装する必要があります。
377
+ * Renderer forwardRef で外部に公開するインターフェース。
369
378
  */
370
- export declare interface BlockRef {
371
- /**
372
- * フォーカスメソッド (全プラグイン必須実装)
373
- *
374
- * @remarks
375
- * - キーボード操作でブロックにフォーカスを移動する際に使用
376
- * - 入力可能な要素(input, textarea等)にフォーカスを当てる
377
- */
379
+ declare interface BlockRef {
378
380
  focus: () => void;
379
381
  }
380
382
 
381
- export declare const BlockRenderer: typeof ForwardedBlockRenderer;
382
-
383
383
  /**
384
- * BlockRendererコンポーネントのProps
385
- *
386
- * @template P - プラグイン固有プロパティ型
387
- * @template V - プラグインが扱う値の型
384
+ * ブロックのグリッド上サイズ。
388
385
  */
389
- export declare interface BlockRendererProps<P = Record<string, Value>, V = Value> {
390
- /** ブロックID */
391
- id: string;
392
- /** プラグイン定義 */
393
- plugin: BlockPlugin<P, V>;
394
- /** プラグイン固有プロパティ */
395
- props: P;
396
- /** ブロックの現在値 */
397
- value: V;
398
- /** 値変更コールバック (オプション) */
399
- onChange?: (value: V) => void;
400
- /** 値確定コールバック (オプション) */
401
- onBlur?: (value: V) => void;
402
- /** 読み取り専用フラグ */
403
- readOnly: boolean;
404
- /** 現在のモード */
405
- mode: NoteMode;
406
- /** ブロックの位置とサイズ(ピクセル単位) */
407
- blockSizePx: BlockSizePx;
408
- /** ブロック基底z-index */
409
- blockZIndex: number;
410
- /** ブロック内でのレイヤーz-index (オプション) */
411
- subZIndex?: number;
412
- /** バリデーション状態 (オプション) */
413
- validationState?: "valid" | "invalid" | "warning";
414
- /** 追加のクラス名 */
415
- className?: string;
416
- }
417
-
418
386
  export declare interface BlockSize {
387
+ /** 列方向の幅(列数) */
419
388
  w: number;
389
+ /** 行方向の高さ(行数) */
420
390
  h: number;
421
391
  }
422
392
 
423
- export declare interface BlockSizePx {
424
- width: number;
425
- height: number;
426
- }
427
-
428
393
  /**
429
- * ブロックのスタイル定義
394
+ * ブロックのスタイル定義。
430
395
  */
431
396
  export declare interface BlockStyle {
397
+ /** 背景色 (CSS color 値) */
432
398
  backgroundColor?: string;
399
+ /** 枠線スタイル */
433
400
  border?: BorderStyle;
434
401
  }
435
402
 
436
- export declare type BlockSubIndexValue = (typeof BLOCK_SUB_INDEX)[keyof typeof BLOCK_SUB_INDEX];
437
-
438
- /**
439
- * Block単位のバリデーター関数型
440
- */
441
- export declare type BlockValidator<P = unknown, V = unknown> = (props: P, value: V) => ValidationError | null;
442
-
443
403
  /**
444
- * 複数のBlockバリデーター関数型
445
- */
446
- export declare type BlockValidators<P = unknown, V = unknown> = (props: P, value: V) => ValidationError[];
447
-
448
- /**
449
- * レンダリング用ブロック情報
404
+ * 複数ページのフォームを表すスキーマ(Book)。
450
405
  *
451
406
  * @remarks
452
- * - Blockコンポーネントに渡される型
453
- * - 元のBlockデータ + 計算済みピクセル座標
454
- * - BlockLayerで Block → BlockViewModel に変換される
407
+ * - `pages` は最低1ページ必須(タプル型で空配列を禁止)
408
+ * - `Page.id` はオプション。index による識別がベースだが、並び替え・外部同期には `id` を利用する
409
+ * - `block.id` はブック全体でユニークであること
410
+ * - `paper` はブック全体で共通(全ページ同一の用紙設定を維持する)
455
411
  */
456
- export declare interface BlockViewModel<P = Record<string, Value>> {
457
- /**
458
- * 元のブロックデータへの参照
459
- */
460
- block: Block<P>;
461
- /**
462
- * 計算済みピクセル座標
463
- */
464
- position: BlockRectPx;
465
- /**
466
- * z-index値(配列インデックスから計算)
467
- */
468
- zIndex: number;
469
- /**
470
- * ブロックの現在値
471
- */
472
- value?: Value;
473
- }
474
-
475
- export declare class Border {
476
- private readonly style;
477
- constructor(style: BorderStyle);
478
- get top(): LineStyle | undefined;
479
- get right(): LineStyle | undefined;
480
- get bottom(): LineStyle | undefined;
481
- get left(): LineStyle | undefined;
482
- get hasAnyBorder(): boolean;
483
- getTopSVGProps(widthPx: number, dpi?: number): {
484
- x1: number;
485
- y1: number;
486
- x2: number;
487
- y2: number;
488
- stroke: string;
489
- strokeWidth: number;
490
- strokeDasharray: string | undefined;
491
- vectorEffect: string;
492
- "data-edge": string;
493
- } | null;
494
- getRightSVGProps(widthPx: number, heightPx: number, dpi?: number): {
495
- x1: number;
496
- y1: number;
497
- x2: number;
498
- y2: number;
499
- stroke: string;
500
- strokeWidth: number;
501
- strokeDasharray: string | undefined;
502
- vectorEffect: string;
503
- "data-edge": string;
504
- } | null;
505
- getBottomSVGProps(widthPx: number, heightPx: number, dpi?: number): {
506
- x1: number;
507
- y1: number;
508
- x2: number;
509
- y2: number;
510
- stroke: string;
511
- strokeWidth: number;
512
- strokeDasharray: string | undefined;
513
- vectorEffect: string;
514
- "data-edge": string;
515
- } | null;
516
- getLeftSVGProps(heightPx: number, dpi?: number): {
517
- x1: number;
518
- y1: number;
519
- x2: number;
520
- y2: number;
521
- stroke: string;
522
- strokeWidth: number;
523
- strokeDasharray: string | undefined;
524
- vectorEffect: string;
525
- "data-edge": string;
526
- } | null;
412
+ export declare interface Book {
413
+ /** ブック全体の用紙設定。全ページ共通(PDF の慣習に従いページごとの変更は不可) */
414
+ paper: Paper;
415
+ /** ページ一覧(0-based インデックス順) */
416
+ pages: [Page, ...Page[]];
417
+ /** ブックレベルのメタデータ。例: `{ title: "月次業務報告書", version: "2" }` */
418
+ metaData?: Record<string, Value>;
527
419
  }
528
420
 
529
- export declare const BORDER_UNITS: readonly ["px", "pt", "mm"];
530
-
531
421
  /**
532
- * BorderOverlay
533
- *
534
- * 印刷可能領域の境界線をSVGで描画するオーバーレイコンポーネント
535
- * - z-index: 3 (GridLayerの最上層)
536
- * - pointer-events: none (クリックイベント透過)
537
- * - 印刷可能領域の4辺に境界線を描画
538
- *
539
- * @remarks
540
- * - 境界線は印刷可能領域(contentArea)の外枠に描画される
541
- * - 個別設定(topBorderStyle等)が優先され、なければborderStyleを使用
542
- * - すべてのスタイルが未指定の場合、その辺は描画されない
422
+ * 枠線の幅に使用できる単位の配列。
543
423
  */
544
- export declare const BorderOverlay: default_2.FC<BorderOverlayProps>;
424
+ declare const BORDER_UNITS: readonly ["px", "pt", "mm"];
545
425
 
546
426
  /**
547
- * BorderOverlayコンポーネントのProps
427
+ * 四辺それぞれの枠線スタイル定義。省略した辺は枠線なし。
428
+ *
429
+ * `all` を指定した場合、各辺に個別指定がなければ `all` の値が全辺に適用される。
548
430
  */
549
- export declare interface BorderOverlayProps {
550
- contentPx: PaperContentPx;
551
- marginLeftPx: number;
552
- marginTopPx: number;
553
- borderStyle?: BorderStyle;
554
- visible?: boolean;
555
- dpi?: number;
556
- zIndex?: number;
557
- className?: string;
558
- }
559
-
560
- export declare const BorderPanel: default_2.FC<BorderPanelProps>;
561
-
562
- export declare interface BorderPanelProps {
563
- selectedBlocks: Block[];
564
- onUpdateBlocks: (updates: Record<string, Partial<Block>>) => void;
565
- }
566
-
567
- export declare const BorderRenderer: MemoExoticComponent<({ width, height, border, dpi, className, }: BorderRendererProps) => JSX.Element | null>;
568
-
569
- export declare interface BorderRendererProps {
570
- width: number;
571
- height: number;
572
- border: Border;
573
- dpi?: number;
574
- className?: string;
575
- }
576
-
577
431
  export declare interface BorderStyle {
578
- all?: LineStyle;
579
432
  top?: LineStyle;
580
433
  right?: LineStyle;
581
434
  bottom?: LineStyle;
582
435
  left?: LineStyle;
436
+ /** 全辺共通スタイル。各辺に個別指定がない場合のフォールバック */
437
+ all?: LineStyle;
583
438
  }
584
439
 
440
+ /**
441
+ * 枠線の幅に使用できる単位。
442
+ */
585
443
  export declare type BorderUnit = (typeof BORDER_UNITS)[number];
586
444
 
587
445
  /**
588
- * px単位でのデルタ値をGridDimensionに反映
446
+ * 組み込みアクション ID のユニオン型。
589
447
  *
590
- * @param dimensions - 現在のDimension配列
591
- * @param index - リサイズするグリッドのインデックス
592
- * @param deltaPx - ピクセル単位での変更量
593
- * @param totalContentPx - コンテンツ全体のサイズ(px)
594
- * @returns 更新されたDimension配列
448
+ * `ActionContext.execute` / `ActionContext.isEnabled` の引数に指定したとき IDE の補完候補として表示される。
449
+ * カスタムアクション ID は任意の `string` として渡せる。
595
450
  */
596
- export declare function calculateGridResize(dimensions: Dimension<GridUnit>[], index: number, deltaPx: number, totalContentPx: number): Dimension<GridUnit>[];
451
+ export declare type BuiltinActionId = "undo" | "redo" | "paste" | "delete" | "copy" | "duplicate" | "addPage" | "deletePage" | "selectBlocks" | "goToPage" | "updateBlocks";
597
452
 
598
453
  /**
599
- * リサイズ後のレイアウトを計算
600
- *
601
- * @param params - リサイズパラメータ
602
- * @returns 新しいレイアウト
454
+ * デフォルトのキャンバス操作ボタン widget。
603
455
  *
604
456
  * @remarks
605
- * - 最小サイズは1x1
606
- * - グリッド範囲外にははみ出さない
607
- * - 左端・上端を超える場合は自動的にクランプ
457
+ * カスタムシェル構築専用。
608
458
  *
609
- * @example
610
- * ```typescript
611
- * const newLayout = calculateResizedLayout({
612
- * layout: { x: 2, y: 2, w: 3, h: 3 },
613
- * handle: ResizeHandle.SE,
614
- * deltaCol: 2,
615
- * deltaRow: 1,
616
- * gridCols: 10,
617
- * gridRows: 10,
618
- * });
619
- * // => { x: 2, y: 2, w: 5, h: 4 }
620
- * ```
459
+ * `createCanvasActionsWidget()` と等価。
621
460
  */
622
- export declare function calculateResizedLayout({ layout, handle, deltaCol, deltaRow, gridCols, gridRows, }: ResizeParams): BlockLayout;
461
+ export declare const canvasActionsWidget: WidgetDef;
623
462
 
624
463
  /**
625
- * CanvasPanel
626
- * キャンバス設定の統合パネル
627
- * - PaperSizePanel: 用紙サイズ設定
628
- * - MarginPanel: マージン設定
629
- * - GridSizePanel: グリッドサイズ設定
630
- * - BlockOrderPanel: ブロック順序設定
464
+ * チェックボックスブロックの props 型。
631
465
  */
632
- export declare const CanvasPanel: {
633
- ({ schema, onSchemaChange }: CanvasPanelProps): JSX.Element;
634
- displayName: string;
635
- };
466
+ declare type CheckboxBlockProps = BaseBlockProps & RequiredProps & CheckboxStyleProps;
636
467
 
637
- export declare interface CanvasPanelProps {
638
- /** フォームスキーマ */
639
- schema: FormSchema;
640
- /** スキーマ変更時のコールバック */
641
- onSchemaChange: (newSchema: FormSchema) => void;
642
- }
468
+ /**
469
+ * チェックボックスブロックの値型。
470
+ */
471
+ declare type CheckboxBlockValue = boolean;
643
472
 
644
473
  /**
645
- * チェックボックスコンポーネント
474
+ * チェックボックスブロックのプラグイン定義。
475
+ *
476
+ * `kind: "checkbox"` で登録され、チェック・非チェックを `boolean` 値で管理する。
646
477
  */
647
- export declare const Checkbox: {
648
- ({ value, onChange, readOnly, label: propLabel, config, }: CheckboxProps): default_2.ReactElement;
649
- displayName: string;
650
- };
478
+ export declare const CheckboxPlugin: BlockPlugin<CheckboxBlockProps, CheckboxBlockValue>;
651
479
 
652
- export declare interface CheckboxConfig {
653
- label?: string;
654
- [key: string]: Value;
480
+ /**
481
+ * チェックボックスの外観カスタマイズ設定。
482
+ */
483
+ declare interface CheckboxStyleConfig {
484
+ /** チェックボックス全体のサイズ。 */
485
+ checkboxSize?: Dimension;
486
+ /** 枠の太さ。 */
487
+ borderWidth?: Dimension;
488
+ /** 枠の色。 */
489
+ borderColor?: string;
490
+ /** チェックマークの線の太さ。 */
491
+ checkWidth?: Dimension;
492
+ /** チェックマークの色。 */
493
+ checkColor?: string;
494
+ /** 未チェック時の背景色。 */
495
+ backgroundColor?: string;
496
+ /** チェック時の背景色。 */
497
+ checkedBackgroundColor?: string;
655
498
  }
656
499
 
657
500
  /**
658
- * Checkbox固有のProps
659
- * ★修正: boolean | undefined にして未設定を許容する
501
+ * チェックボックスの外観カスタマイズ props。
660
502
  */
661
- export declare interface CheckboxProps extends PropertyComponentProps<boolean | undefined> {
662
- label?: string;
663
- config?: CheckboxConfig;
503
+ declare interface CheckboxStyleProps {
504
+ /** 外観カスタマイズ設定。 */
505
+ styleConfig?: CheckboxStyleConfig;
664
506
  }
665
507
 
666
508
  /**
667
- * @file clampBlock.ts
668
- * @description ブロックをグリッド範囲内にクランプする共通ロジック
669
- *
670
- * @remarks
671
- * 移動・挿入・リサイズ時のはみ出し防止処理を集約。
672
- * DRY原則に従い、InteractionLayer内の重複コードを排除。
509
+ * Book に存在しない blockId のエントリを `values` から除去して返す。
673
510
  */
511
+ export declare function cleanValues(book: Book, values: Record<string, Value>): Record<string, Value>;
512
+
674
513
  /**
675
- * ブロックの位置をグリッド範囲内にクランプ
676
- *
677
- * @param position - ブロックの位置 (x, y)
678
- * @param size - ブロックのサイズ (w, h)
679
- * @param gridCols - グリッドの列数
680
- * @param gridRows - グリッドの行数
681
- * @returns クランプされた位置 { x, y }
682
- *
683
- * @remarks
684
- * - x は 0 ~ (gridCols - w) の範囲にクランプ
685
- * - y は 0 ~ (gridRows - h) の範囲にクランプ
686
- * - ブロックがグリッドからはみ出さないことを保証
687
- *
688
- * @example
689
- * ```typescript
690
- * const clamped = clampBlockToGrid(
691
- * { x: -1, y: 5 },
692
- * { w: 2, h: 3 },
693
- * 10, // gridCols
694
- * 10 // gridRows
695
- * );
696
- * // => { x: 0, y: 5 }
697
- * ```
698
- */
699
- export declare function clampBlockToGrid(position: {
700
- x: number;
701
- y: number;
702
- }, size: {
703
- w: number;
704
- h: number;
705
- }, gridCols: number, gridRows: number): {
706
- x: number;
707
- y: number;
708
- };
709
-
710
- export declare interface ClampedBlockPosition {
711
- blockId: string;
712
- x: number;
713
- y: number;
714
- }
715
-
716
- /**
717
- * 複数ブロックの移動をクランプ
718
- * 全体のバウンディングボックスを計算し、グリッド範囲内に収めた上で
719
- * 相対位置を保持したまま各ブロックの新しい座標を返す
720
- *
721
- * @param blocks - 移動対象のブロック配列
722
- * @param deltaCol - 列方向の移動量
723
- * @param deltaRow - 行方向の移動量
724
- * @param gridCols - グリッドの列数
725
- * @param gridRows - グリッドの行数
726
- * @returns クランプ後の各ブロックの座標配列
727
- */
728
- export declare function clampMultipleBlocks(blocks: Block[], deltaCol: number, deltaRow: number, gridCols: number, gridRows: number): ClampedBlockPosition[];
729
-
730
- /**
731
- * 印刷後のクリーンアップ処理
732
- */
733
- export declare function cleanupPrint(options?: {
734
- restoreScrollbars?: boolean;
735
- }): void;
736
-
737
- /**
738
- * カラーパレット定義(30色)
739
- */
740
- export declare const COLOR_PALETTE: readonly [{
741
- readonly label: "無色";
742
- readonly value: string | undefined;
743
- }, {
744
- readonly label: "白";
745
- readonly value: "#ffffff";
746
- }, {
747
- readonly label: "グレー1";
748
- readonly value: "#efefef";
749
- }, {
750
- readonly label: "グレー2";
751
- readonly value: "#d9d9d9";
752
- }, {
753
- readonly label: "グレー3";
754
- readonly value: "#cccccc";
755
- }, {
756
- readonly label: "グレー4";
757
- readonly value: "#b7b7b7";
758
- }, {
759
- readonly label: "グレー5";
760
- readonly value: "#999999";
761
- }, {
762
- readonly label: "グレー6";
763
- readonly value: "#666666";
764
- }, {
765
- readonly label: "グレー7";
766
- readonly value: "#434343";
767
- }, {
768
- readonly label: "黒";
769
- readonly value: "#000000";
770
- }, {
771
- readonly label: "薄茶";
772
- readonly value: "#E6B8AF";
773
- }, {
774
- readonly label: "薄赤";
775
- readonly value: "#F4CCCC";
776
- }, {
777
- readonly label: "薄橙";
778
- readonly value: "#FCE5CD";
779
- }, {
780
- readonly label: "薄黄";
781
- readonly value: "#FFF2CC";
782
- }, {
783
- readonly label: "薄緑";
784
- readonly value: "#D9EAD3";
785
- }, {
786
- readonly label: "薄青緑";
787
- readonly value: "#D0E0E3";
788
- }, {
789
- readonly label: "薄青";
790
- readonly value: "#C9DAF8";
791
- }, {
792
- readonly label: "薄青紫";
793
- readonly value: "#CFE2F3";
794
- }, {
795
- readonly label: "薄紫";
796
- readonly value: "#D9D2E9";
797
- }, {
798
- readonly label: "薄赤紫";
799
- readonly value: "#EAD1DC";
800
- }, {
801
- readonly label: "茶";
802
- readonly value: "#DD7E6B";
803
- }, {
804
- readonly label: "赤";
805
- readonly value: "#EA9999";
806
- }, {
807
- readonly label: "橙";
808
- readonly value: "#F9CB9C";
809
- }, {
810
- readonly label: "黄";
811
- readonly value: "#FFE599";
812
- }, {
813
- readonly label: "緑";
814
- readonly value: "#B6D7A8";
815
- }, {
816
- readonly label: "青緑";
817
- readonly value: "#A2C4C9";
818
- }, {
819
- readonly label: "青";
820
- readonly value: "#A4C2F4";
821
- }, {
822
- readonly label: "青紫";
823
- readonly value: "#9FC5E8";
824
- }, {
825
- readonly label: "紫";
826
- readonly value: "#B4A7D6";
827
- }, {
828
- readonly label: "赤紫";
829
- readonly value: "#D5A6BD";
830
- }];
831
-
832
- /**
833
- * カラーパレットコンポーネント
834
- */
835
- export declare const ColorPalette: {
836
- ({ onColorSelect, selectedColor, readOnly, }: ColorPaletteProps): default_2.ReactElement;
837
- displayName: string;
838
- };
839
-
840
- export declare interface ColorPaletteProps {
841
- onColorSelect: (color: string | undefined) => void;
842
- selectedColor?: string;
843
- readOnly?: boolean;
844
- }
845
-
846
- /**
847
- * カラーピッカーコンポーネント
848
- */
849
- export declare const ColorPicker: {
850
- ({ value, onChange, readOnly, showTextInput, allowUndefined: propAllowUndefined, placeholder: propPlaceholder, width: propWidth, height: propHeight, config, }: ColorPickerProps): default_2.ReactElement;
851
- displayName: string;
852
- };
853
-
854
- /**
855
- * Config型定義
856
- * Record<string, Value> との互換性を持たせる
857
- */
858
- export declare interface ColorPickerConfig {
859
- allowUndefined?: boolean;
860
- width?: number;
861
- height?: number;
862
- [key: string]: Value;
863
- }
864
-
865
- /**
866
- * カラーピッカーポップオーバーコンポーネント
867
- */
868
- export declare const ColorPickerPopover: {
869
- ({ isOpen, onClose, rgba, onRgbaChange, onColorSelect, selectedColor, readOnly, }: ColorPickerPopoverProps): default_2.ReactElement | null;
870
- displayName: string;
871
- };
872
-
873
- export declare interface ColorPickerPopoverProps {
874
- isOpen: boolean;
875
- onClose: () => void;
876
- rgba: RGBA;
877
- onRgbaChange: (channel: keyof RGBA, value: number | undefined) => void;
878
- onColorSelect: (color: string | undefined) => void;
879
- selectedColor?: string;
880
- readOnly?: boolean;
881
- }
882
-
883
- /**
884
- * ColorPicker固有のProps
885
- * T は string | undefined
886
- */
887
- export declare interface ColorPickerProps extends PropertyComponentProps<string | undefined> {
888
- /** カラーテキスト入力を表示するか */
889
- showTextInput?: boolean;
890
- /** undefined(未設定)を許容するか */
891
- allowUndefined?: boolean;
892
- /** プレースホルダーテキスト */
893
- placeholder?: string;
894
- /** 幅(px) */
895
- width?: number;
896
- /** 高さ(px) */
897
- height?: number;
898
- /** 設定オブジェクト */
899
- config?: ColorPickerConfig;
900
- }
901
-
902
- /**
903
- * 新規ブロックを作成
514
+ * デフォルトのクリップボード操作ボタン widget。
904
515
  *
905
516
  * @remarks
906
- * Interaction層(D&Dでの配置)や初期化時に使用されます。
517
+ * カスタムシェル構築専用。
907
518
  *
908
- * @param plugin ブロックプラグイン
909
- * @param position グリッド上の配置情報
910
- * @param overrideProps プロパティの上書き(オプション)
911
- * @returns 新しい Block オブジェクト
519
+ * `createClipboardWidget()` と等価。
912
520
  */
913
- export declare function createBlock<P = Record<string, unknown>>(plugin: BlockPlugin<P>, position: {
914
- x: number;
915
- y: number;
916
- w: number;
917
- h: number;
918
- }, overrideProps?: Partial<P>): Block<P>;
521
+ export declare const clipboardWidget: WidgetDef;
919
522
 
920
523
  /**
921
- * ブロック ID を生成
524
+ * ブロックの一意 ID を生成する。
922
525
  *
923
- * @remarks
924
- * UUID/nanoid は使わず、カスタム ID 方式
925
- * タイムスタンプ + ランダム文字列で一意性を保証
526
+ * `kind` をプレフィックスにした UUID 形式(例: `text_xxxxxxxx-...`)。
926
527
  */
927
528
  export declare function createBlockId(kind: string): string;
928
529
 
929
530
  /**
930
- * プラグインの properties 定義から初期Propsを生成
931
- *
932
- * @remarks
933
- * - フラットなプロパティ定義から defaultValue を抽出してオブジェクトを生成します
934
- * - false で無効化されたプロパティはスキップします
935
- * - defaultValue が undefined のプロパティも含めます(CSS変数対応のため)
936
- *
937
- * @param plugin BlockPlugin オブジェクト
938
- * @returns 初期化されたプロパティオブジェクト
939
- */
940
- export declare const createInitialProps: <P>(plugin: BlockPlugin<P>) => P;
941
-
942
- /**
943
- * プラグイン配列からプラグインレジストリを作成
531
+ * キャンバス操作ボタン widget を生成するファクトリ関数。
944
532
  *
945
533
  * @remarks
946
- * - プラグインの kind をキーとしたオブジェクトを生成します
947
- * - 型推論により、配列内の具体的なプラグイン型が保持されます
948
- *
949
- * @template T - BlockPlugin の配列型
950
- * @param plugins プラグインの配列 (as const推奨)
951
- * @returns kind をキーとしたプラグインレジストリ
952
- *
953
- * @example
954
- * ```typescript
955
- * const registry = createPluginRegistry([
956
- * TextPlugin,
957
- * SelectPlugin,
958
- * CheckboxPlugin,
959
- * ] as const);
960
- * // registry.text, registry.select, registry.checkbox が型推論される
961
- * ```
962
- */
963
- export declare function createPluginRegistry<T extends readonly BlockPlugin[]>(plugins: T): Record<string, T[number]>;
964
-
965
- export declare const DEFAULT_DPI = 96;
966
-
967
- export declare const DEFAULT_FONT_FAMILY: readonly SelectOption[];
968
-
969
- export declare const DEFAULT_GRID: Grid;
970
-
971
- export declare const DEFAULT_GUIDE_BORDER: BorderStyle;
972
-
973
- export declare const DEFAULT_GUIDE_LINE: LineStyle;
974
-
975
- export declare const DEFAULT_PAPER: Paper;
976
-
977
- export declare const DEFAULT_PAPER_MARGIN: PaperMargin;
978
-
979
- export declare const DEFAULT_PAPER_SIZES: Record<PaperSizePreset, PaperSize>;
980
-
981
- export declare const DEFAULT_SCHEMA: FormSchema;
982
-
983
- /**
984
- * JSON文字列をFormSchemaにデシリアライズ
985
- *
986
- * @param json - デシリアライズするJSON文字列
987
- * @returns FormSchema (バリデーション済み)
988
- * @throws バリデーションエラー時にエラーをスロー
989
- *
990
- * @example
991
- * ```ts
992
- * const json = '{"paper": {...}, "grid": {...}, "blocks": [...]}';
993
- * const schema = deserializeSchema(json);
994
- * ```
995
- */
996
- export declare function deserializeSchema(json: string): FormSchema;
997
-
998
- /**
999
- * JSON文字列を入力値(values)にデシリアライズ
1000
- *
1001
- * @param json - デシリアライズするJSON文字列
1002
- * @returns Record<string, Value> (バリデーション済み)
1003
- * @throws バリデーションエラー時にエラーをスロー
1004
- *
1005
- * @example
1006
- * ```ts
1007
- * const json = '{"block-1": "Hello", "block-2": 42}';
1008
- * const values = deserializeValues(json);
1009
- * ```
1010
- */
1011
- export declare function deserializeValues(json: string): Record<string, Value>;
1012
-
1013
- export declare interface Dimension<U extends Unit = Unit> {
1014
- value: number;
1015
- unit: U;
1016
- }
1017
-
1018
- export declare const DimensionInput: <U extends Unit>(props: DimensionInputProps<U>) => default_2.ReactElement;
1019
-
1020
- export declare interface DimensionInputConfig<U extends Unit> {
1021
- allowedUnits?: readonly U[];
1022
- min?: number;
1023
- max?: number;
1024
- step?: number;
1025
- placeholder?: string;
1026
- width?: number;
1027
- height?: number;
1028
- [key: string]: Value;
1029
- }
1030
-
1031
- /**
1032
- * DimensionInput固有のProps
1033
- * ★重要: ジェネリクスに `| undefined` を追加して、未設定状態を受け入れられるようにする
1034
- */
1035
- export declare interface DimensionInputProps<U extends Unit> extends PropertyComponentProps<Dimension<U> | undefined> {
1036
- allowedUnits?: readonly U[];
1037
- min?: number;
1038
- max?: number;
1039
- step?: number;
1040
- placeholder?: string;
1041
- /** 幅(px) */
1042
- width?: number;
1043
- /** 高さ(px) */
1044
- height?: number;
1045
- config?: DimensionInputConfig<U>;
1046
- }
1047
-
1048
- export declare function dimensionsToStrings<U extends Unit>(dims: Dimension<U>[]): string[];
1049
-
1050
- export declare function dimensionToString<U extends Unit>(dim: Dimension<U>): string;
1051
-
1052
- /**
1053
- * 浮動小数点のピクセル配列を整数ピクセル配列に変換します。
1054
- *
1055
- * Bresenhamアルゴリズムに基づく累積誤差補正により、
1056
- * 境界位置(prefix sum)のズレを最小化します。
1057
- * これにより視覚的なバランスが保たれ、ピクセルギャップを防ぎます。
1058
- *
1059
- * @example
1060
- * // 767px ÷ 3 = 255.666...
1061
- * distributeRemainder([255.666, 255.666, 255.666])
1062
- * // → [256, 255, 256] (合計767px、累積誤差を均等に分散)
1063
- *
1064
- * @example
1065
- * // 100px ÷ 3 = 33.333...
1066
- * distributeRemainder([33.333, 33.333, 33.333])
1067
- * // → [33, 34, 33] (合計100px、累積誤差を補正)
1068
- *
1069
- * @param floatPixels - 浮動小数点のピクセル値配列
1070
- * @returns 整数のピクセル値配列(合計値は元の合計を四捨五入した値と一致)
1071
- *
1072
- * @see https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
1073
- * @see Zen Grids - Responsive Design's Dirty Little Secret
1074
- */
1075
- export declare function distributeRemainder(floatPixels: number[]): number[];
1076
-
1077
- /**
1078
- * ドラッグ状態の詳細情報
1079
- */
1080
- export declare interface DraggingState {
1081
- /** ドラッグ種別 */
1082
- type: DragType;
1083
- /** ドラッグ対象のブロックID群 */
1084
- blockIds: string[];
1085
- /** 開始グリッド座標 */
1086
- startGrid: {
1087
- col: number;
1088
- row: number;
1089
- };
1090
- /** 現在のグリッド座標 */
1091
- currentGrid: {
1092
- col: number;
1093
- row: number;
1094
- };
1095
- /** 現在のマウス座標 (px, キャンバス相対) - キャンバス外でのゴースト表示用 */
1096
- currentMousePx?: {
1097
- x: number;
1098
- y: number;
1099
- };
1100
- /** リサイズ用: ハンドル位置 */
1101
- handle?: ResizeHandle;
1102
- /** 挿入用: プラグイン種別 */
1103
- pluginKind?: string;
1104
- /** 挿入用: デフォルトサイズ */
1105
- defaultSize?: {
1106
- w: number;
1107
- h: number;
1108
- };
1109
- /** キャンバス外フラグ (true: 範囲外でドロップすると削除) */
1110
- isOutside?: boolean;
1111
- }
1112
-
1113
- export declare const DragLayer: MemoExoticComponent<({ blocks, pluginRegistry, gridLength, draggingState, getBlockRectPx, selectionStyle, ghostZIndex, selectBorderZIndex, blockHandlesZIndex, }: DragLayerProps) => JSX.Element | null>;
1114
-
1115
- export declare interface DragLayerProps {
1116
- blocks: Block[];
1117
- pluginRegistry: Record<string, BlockPlugin>;
1118
- gridLength: {
1119
- cols: number;
1120
- rows: number;
1121
- };
1122
- draggingState: DraggingState | undefined;
1123
- getBlockRectPx: (block: Block) => BlockRectPx;
1124
- selectionStyle?: BorderStyle;
1125
- ghostZIndex?: number;
1126
- selectBorderZIndex?: number;
1127
- blockHandlesZIndex?: number;
1128
- }
1129
-
1130
- /**
1131
- * GlobalDragStore
1132
- *
1133
- * Palette → Canvas 間のドラッグ&ドロップで使用するグローバル状態管理
1134
- * 「現在ドラッグ中のアイテム」を保持し、NoteFormが必要に応じて参照する
1135
- *
1136
- * ## 使用方法
1137
- *
1138
- * ### Palette側 (ホストアプリ)
1139
- * ```tsx
1140
- * const handlePointerDown = (e: React.PointerEvent) => {
1141
- * globalDragStore.start('text', { w: 200, h: 100 });
1142
- *
1143
- * const handleWindowUp = () => {
1144
- * globalDragStore.end();
1145
- * window.removeEventListener('pointerup', handleWindowUp);
1146
- * };
1147
- * window.addEventListener('pointerup', handleWindowUp);
1148
- * };
1149
- * ```
534
+ * カスタムシェル構築専用。
1150
535
  *
1151
- * ### NoteForm側 (core)
1152
- * ```tsx
1153
- * const handlePointerEnter = () => {
1154
- * const item = globalDragStore.get();
1155
- * if (item) {
1156
- * handleInteractionChange({
1157
- * type: InteractionEventType.START_INSERT,
1158
- * pluginKind: item.kind,
1159
- * defaultSize: item.defaultSize,
1160
- * });
1161
- * }
1162
- * };
1163
- * ```
1164
- */
1165
- /**
1166
- * ドラッグ中のアイテム情報
1167
- */
1168
- export declare type DragState = {
1169
- /** プラグインの種類 (例: 'text', 'image') */
1170
- kind: string;
1171
- /** デフォルトサイズ (グリッド単位) */
1172
- defaultSize: {
1173
- w: number;
1174
- h: number;
1175
- };
1176
- } | null;
1177
-
1178
- /**
1179
- * ドラッグ種別
536
+ * 8 × 1 行: [全選択][解除][削除][コピー][貼付][複製][元に戻す][やり直し]
1180
537
  *
1181
- * @remarks
1182
- * ドラッグ操作の種類を型安全に扱うための列挙型
1183
- */
1184
- export declare enum DragType {
1185
- /** ブロックの移動 */
1186
- MOVE = "move",
1187
- /** ブロックのリサイズ */
1188
- RESIZE = "resize",
1189
- /** 新規ブロックの挿入 */
1190
- INSERT = "insert"
1191
- }
1192
-
1193
- export declare const EditingBlock: typeof ForwardedEditingBlock;
1194
-
1195
- export declare interface EditingBlockProps<P = Record<string, Value>, V = Value> {
1196
- /** ブロックID */
1197
- id: string;
1198
- /** プラグイン定義 */
1199
- plugin: BlockPlugin<P, V>;
1200
- /** プラグイン固有プロパティ */
1201
- props: P;
1202
- /** ブロックの現在値 */
1203
- value: V;
1204
- /** 値変更コールバック */
1205
- onChange: (value: V) => void;
1206
- /** 値確定コールバック (オプション) */
1207
- onBlur?: (value: V) => void;
1208
- /** ブロックの位置とサイズ(ピクセル単位) */
1209
- blockRectPx: BlockRectPx;
1210
- /** z-index (オプション、デフォルト: Z_INDEX.EDIT_BLOCK) */
1211
- zIndex?: number;
1212
- /** バリデーション状態 (オプション) */
1213
- validationState?: "valid" | "invalid" | "warning";
1214
- /** 追加のクラス名 */
1215
- className?: string;
1216
- }
1217
-
1218
- /**
1219
- * 印刷を実行(準備 + 印刷 + クリーンアップ)
538
+ * `idPrefix` でブロック ID プレフィックスを変更できる。
1220
539
  */
1221
- export declare function executePrint(options?: {
1222
- title?: string;
1223
- onBeforePrint?: () => void;
1224
- onAfterPrint?: () => void;
1225
- }): void;
540
+ export declare function createCanvasActionsWidget(idPrefix?: string): WidgetDef;
1226
541
 
1227
542
  /**
1228
- * 機能プラグイン (将来の拡張用)
543
+ * クリップボード操作ボタン widget を生成するファクトリ関数。
1229
544
  *
1230
545
  * @remarks
1231
- * 現在未使用。将来的にエディタ全体の機能を拡張するプラグインを定義する際に使用
1232
- * 例: Undo/Redo, 自動保存, PDFエクスポートなど
1233
- */
1234
- export declare interface FeaturePlugin {
1235
- kind: string;
1236
- }
1237
-
1238
- /**
1239
- * 指定された座標にあるブロックを検索します
1240
- *
1241
- * @param point - 検索対象の座標 (Client/Offset座標ではなく、InteractionLayer内の相対座標)
1242
- * @param blocks - ブロックのリスト
1243
- * @param getBlockRectPx - ブロックからピクセル矩形を計算する関数 (useGridCalc由来)
1244
- * @returns 見つかったブロックのID。見つからない場合は null
1245
- */
1246
- export declare function findBlockAtPoint(point: {
1247
- x: number;
1248
- y: number;
1249
- }, blocks: Block[], getBlockRectPx: (block: Block) => BlockRectPx): string | null;
1250
-
1251
- export declare function findGridIndex(starts: readonly number[], maxStep: number, windowPx: number): (px: number) => number;
1252
-
1253
- export declare const FONT_UNITS: readonly ["px", "pt", "mm"];
1254
-
1255
- /**
1256
- * FontStyleSchema の実体定義
1257
- */
1258
- export declare const fontStyleDefinition: PluginProperties<FontStyleSchema>;
1259
-
1260
- export declare interface FontStyleSchema {
1261
- fontSize?: Dimension<FontUnit>;
1262
- fontFamily?: string;
1263
- color?: string;
1264
- fontWeight?: boolean;
1265
- italic?: boolean;
1266
- underline?: boolean;
1267
- lineThrough?: boolean;
1268
- lineHeight?: number;
1269
- }
1270
-
1271
- export declare type FontUnit = (typeof FONT_UNITS)[number];
1272
-
1273
- export declare interface FormSchema {
1274
- paper: Paper;
1275
- grid: Grid;
1276
- blocks: Block[];
1277
- metaData?: Record<string, Value>;
1278
- }
1279
-
1280
- declare const ForwardedBlockRenderer: <P extends Record<string, Value> = Record<string, Value>, V extends Value = Value>(props: BlockRendererProps<P, V> & {
1281
- ref?: default_2.Ref<BlockRef>;
1282
- }) => default_2.ReactElement;
1283
-
1284
- declare const ForwardedEditingBlock: <P extends Record<string, Value>, V extends Value>(props: EditingBlockProps<P, V> & {
1285
- ref?: default_2.ForwardedRef<BlockRef>;
1286
- }) => default_2.ReactElement;
1287
-
1288
- /**
1289
- * ブロックコンテナの共通スタイルを生成
1290
- *
1291
- * @param blockRectPx - ブロックの位置とサイズ (ピクセル単位)
1292
- * @param options - オプション設定
1293
- * @returns React CSSProperties オブジェクト
1294
- *
1295
- * @example
1296
- * ```tsx
1297
- * const style = getBlockContainerStyle(blockRectPx, {
1298
- * zIndex: 2400000,
1299
- * pointerEvents: "auto"
1300
- * });
1301
- * ```
1302
- */
1303
- export declare function getBlockContainerStyle(blockRectPx: BlockRectPx, options?: BlockContainerStyleOptions): default_2.CSSProperties;
1304
-
1305
- /**
1306
- * @file helpers.ts
1307
- * @description z-index計算ヘルパー関数
1308
- */
1309
- /**
1310
- * ブロックの基底z-indexを計算
546
+ * カスタムシェル構築専用。
1311
547
  *
1312
- * @param index - ブロックの配列インデックス (0-based)
1313
- * @returns 基底z-index(ブロックはbase ~ base+9を使用可能)
548
+ * 3 × 1 行: [コピー][貼付][複製]
1314
549
  *
1315
- * @example
1316
- * ```ts
1317
- * getBlockZIndex(0); // 100
1318
- * getBlockZIndex(1); // 200
1319
- * getBlockZIndex(10); // 1100
1320
- * ```
550
+ * `idPrefix` でブロック ID プレフィックスを変更できる。
1321
551
  */
1322
- export declare function getBlockZIndex(index: number): number;
552
+ export declare function createClipboardWidget(idPrefix?: string): WidgetDef;
1323
553
 
1324
554
  /**
1325
- * 選択中のブロックから共通の値を取得する
1326
- * 値がバラバラの場合は undefined を返す
555
+ * 操作履歴(アンドゥ・リドゥ)ボタン widget を生成するファクトリ関数。
1327
556
  *
1328
- * @param blocks 選択中のブロック配列
1329
- * @param path プロパティへのパス (例: "props.text", "layout.x", "style.backgroundColor")
1330
- * @returns 全ブロックで共通の値、または値が異なる場合は undefined
1331
- *
1332
- * @example
1333
- * ```ts
1334
- * // propsの値を取得
1335
- * const textValue = getCommonValue(blocks, "props.text");
557
+ * @remarks
558
+ * カスタムシェル構築専用。
1336
559
  *
1337
- * // layoutの値を取得
1338
- * const xPos = getCommonValue<number>(blocks, "layout.x");
560
+ * 2 列 × 1 行: [元に戻す][やり直し]
1339
561
  *
1340
- * // styleの値を取得
1341
- * const bgColor = getCommonValue(blocks, "style.backgroundColor");
1342
- * ```
562
+ * `idPrefix` でブロック ID プレフィックスを変更できる。
1343
563
  */
1344
- export declare function getCommonValue<T = Value>(blocks: Block[], path: string): T | undefined;
564
+ export declare function createHistoryWidget(idPrefix?: string): WidgetDef;
1345
565
 
1346
566
  /**
1347
- * インタラクション状態からモードを導出する
567
+ * ページナビゲーション widget を生成するファクトリ関数。
1348
568
  *
1349
569
  * @remarks
1350
- * モードは状態の導出値であり、状態そのものではない
1351
- * これにより状態の一貫性が保証される
570
+ * カスタムシェル構築専用。
1352
571
  *
1353
- * @param state - インタラクション状態
1354
- * @returns 現在のモード
1355
- */
1356
- export declare function getInteractionMode(state: InteractionState): InteractionMode;
1357
-
1358
- /**
1359
- * サポートされる最大ブロック数を取得
572
+ * 7 × 1 行の NoteBlock プリセット:
1360
573
  *
1361
- * @returns 最大ブロック数
574
+ * [prev][current][separator][total][next][add][delete]
1362
575
  *
1363
- * @example
1364
- * ```ts
1365
- * getMaxBlockCount(); // 9999 (99,999 - 10) / 10
1366
- * ```
1367
- */
1368
- export declare function getMaxBlockCount(): number;
1369
-
1370
- export declare function getMaxStep(starts: number[]): {
1371
- readonly step: number;
1372
- readonly windowPx: number;
1373
- };
1374
-
1375
- /**
1376
- * 用紙サイズの寸法を取得(mm単位)
576
+ * `pageIdx` と `pageCount` を渡すとインジケーター表示が動的になる。
577
+ *
578
+ * 省略時は「—」が表示される。
1377
579
  */
1378
- export declare function getPaperSize(paperSize: PrintPaperSize, orientation: Orientation): {
1379
- width: number;
1380
- height: number;
1381
- };
1382
-
1383
- export declare const getStrokeDasharray: (lineStyle?: LineStyle) => string | undefined;
580
+ export declare function createPageNavigationWidget(options: {
581
+ pageIdx?: number;
582
+ pageCount?: number;
583
+ }): WidgetDef;
1384
584
 
1385
585
  /**
1386
- * ブロック内のサブレイヤーz-indexを計算
586
+ * プラグインの配列から `kind` をキーとしたレジストリを生成する。
1387
587
  *
1388
- * @param baseZIndex - ブロックの基底z-index
1389
- * @param subIndex - サブレイヤーのオフセット (0-99)
1390
- * @returns サブレイヤーのz-index
588
+ * 各プラグインの `properties` から `defaultProps` を合成し、`Renderer` をベース型に正規化した `ResolvedPlugin` を返す。
1391
589
  *
1392
590
  * @example
1393
591
  * ```ts
1394
- * const baseZ = getBlockZIndex(0); // 100
1395
- * getSubLayerZIndex(baseZ, BLOCK_SUB_INDEX.BG); // 110 (Blockの背景色)
1396
- * getSubLayerZIndex(baseZ, BLOCK_SUB_INDEX.CONTENT); // 150 (Blockのコンテンツ)
592
+ * const registry = createPluginRegistry([TextPlugin, CheckboxPlugin]);
1397
593
  * ```
1398
594
  */
1399
- export declare function getSubZIndex(baseZIndex: number, subIndex: number): number;
1400
-
1401
- /**
1402
- * グローバルドラッグストア
1403
- * シングルトンパターンで実装
1404
- */
1405
- declare class GlobalDragStore {
1406
- private state;
1407
- private listeners;
595
+ export declare function createPluginRegistry(plugins: readonly (Pick<BlockPlugin, "kind" | "meta" | "properties"> & {
1408
596
  /**
1409
- * ドラッグ開始
1410
- * Paletteから呼ばれる
597
+ * `forwardRef()` で生成した React コンポーネント。
1411
598
  *
1412
- * @param kind プラグインの種類
1413
- * @param defaultSize デフォルトサイズ (グリッド単位)
1414
- */
1415
- start(kind: string, defaultSize: {
1416
- w: number;
1417
- h: number;
1418
- }): void;
1419
- /**
1420
- * ドラッグ終了
1421
- * window.pointerup で呼ばれる
599
+ * `ForwardRefExoticComponent<never>` P=never(⊥型)を使うことでどの P でも代入可。
600
+ *
601
+ * 非コンポーネント値(数値等)は型エラーになる。
1422
602
  */
1423
- end(): void;
603
+ Renderer: ForwardRefExoticComponent<never>;
1424
604
  /**
1425
- * 現在の状態を取得
1426
- * NoteFormのonPointerEnterから呼ばれる
605
+ * `never[]` rest 型により、任意の引数型の関数が代入可。
1427
606
  *
1428
- * @returns 現在ドラッグ中のアイテム (なければ null)
607
+ * 非関数値は型エラーになる。
1429
608
  */
1430
- get(): DragState;
609
+ migrateProps?: (...args: never[]) => unknown;
1431
610
  /**
1432
- * 状態変化を監視
1433
- * (現在は使用していないが、将来的なデバッグ用に実装)
611
+ * `never[]` rest 型により、任意の引数型の関数が代入可。
1434
612
  *
1435
- * @param listener 状態変化時に呼ばれる関数
1436
- * @returns アンサブスクライブ関数
613
+ * 非関数値は型エラーになる。
1437
614
  */
1438
- subscribe(listener: Listener): () => void;
615
+ validateProps?: (...args: never[]) => unknown;
1439
616
  /**
1440
- * 全リスナーに状態変化を通知
617
+ * `never[]` rest 型により、任意の引数型の関数が代入可。
618
+ *
619
+ * 非関数値は型エラーになる。
1441
620
  */
1442
- private notify;
1443
- }
621
+ validateValue?: (...args: never[]) => unknown;
622
+ })[]): PluginRegistry;
1444
623
 
1445
624
  /**
1446
- * グローバルドラッグストアのシングルトンインスタンス
625
+ * 選択操作・削除ボタン widget を生成するファクトリ関数。
626
+ *
627
+ * @remarks
628
+ * カスタムシェル構築専用。
629
+ *
630
+ * 3 列 × 1 行: [全選択][選択解除][削除]
631
+ *
632
+ * `idPrefix` でブロック ID プレフィックスを変更できる。
1447
633
  */
1448
- export declare const globalDragStore: GlobalDragStore;
1449
-
1450
- export declare interface Grid {
1451
- cols: Dimension<GridUnit>[];
1452
- rows: Dimension<GridUnit>[];
1453
- }
634
+ export declare function createSelectionDeleteWidget(idPrefix?: string): WidgetDef;
1454
635
 
1455
- export declare const GRID_UNITS: readonly ["mm", "cm", "fr", "inch", "pt", "px"];
636
+ /**
637
+ * デフォルト Book(1ページ・空スキーマ)。
638
+ */
639
+ export declare const DEFAULT_BOOK: Book;
1456
640
 
1457
641
  /**
1458
- * GridCanvas
1459
- *
1460
- * 用紙背景を描画するコンポーネント
1461
- * - z-index: 0 (GridLayerの最下層)
1462
- * - pointer-events: none (クリックイベント透過)
1463
- * - 白い用紙背景を表示
642
+ * デフォルトグリッド。A4 縦置き時にセルがほぼ正方形になるよう、
643
+ * 列数 20・行数 28 に設定。
1464
644
  */
1465
- export declare const GridCanvas: React.FC<GridCanvasProps>;
645
+ export declare const DEFAULT_GRID: Grid;
1466
646
 
1467
647
  /**
1468
- * GridCanvasコンポーネントのProps
648
+ * デフォルトフォームスキーマ(空ページ)。
1469
649
  */
1470
- export declare interface GridCanvasProps {
1471
- canvasPx: PaperCanvasPx;
1472
- backgroundColor?: string;
1473
- boxShadow?: string;
1474
- zIndex?: number;
1475
- className?: string;
1476
- }
650
+ export declare const DEFAULT_PAGE: Page;
1477
651
 
1478
- export declare interface GridChangeEvent {
1479
- type: GridChangeType;
1480
- index?: number;
1481
- cols?: readonly Dimension<GridUnit>[];
1482
- rows?: readonly Dimension<GridUnit>[];
1483
- affectedBlockIds: string[];
1484
- }
652
+ /**
653
+ * デフォルト用紙設定(A4 縦置き、マージン四辺 10 mm)。
654
+ */
655
+ export declare const DEFAULT_PAPER: Paper;
1485
656
 
1486
- export declare type GridChangeType = "resize" | "insert" | "delete" | "equalize";
657
+ /**
658
+ * デフォルトマージン。四辺すべて 10 mm。
659
+ */
660
+ export declare const DEFAULT_PAPER_MARGIN: PaperMargin;
1487
661
 
1488
662
  /**
1489
- * GridDimensionLabel - グリッド線間の寸法表示
1490
- *
1491
- * グリッド線と線の間に寸法(値と単位)を表示します。
1492
- * ダブルクリックで単位編集UIを表示します。
663
+ * 各プリセットのデフォルト寸法定義。
1493
664
  */
1494
- export declare const GridDimensionLabel: MemoExoticComponent<({ direction, index, dimension, position, currentPxSize, marginLeftPx, marginTopPx, isNearCursor, resizingPxSize, onDimensionChange, }: GridDimensionLabelProps) => JSX.Element | null>;
1495
-
1496
- export declare interface GridDimensionLabelProps {
1497
- /** ラベルの方向 ('column' or 'row') */
1498
- direction: "column" | "row";
1499
- /** 次元のインデックス(配列のインデックス) */
1500
- index: number;
1501
- /** 寸法の値(Dimensionオブジェクト) */
1502
- dimension: Dimension<GridUnit>;
1503
- /** ラベルの位置 (px) - 中央座標 */
1504
- position: number;
1505
- /** 現在のpxサイズ(単位変換用) */
1506
- currentPxSize: number;
1507
- /** 印刷可能領域の左マージン (px) */
1508
- marginLeftPx: number;
1509
- /** 印刷可能領域の上マージン (px) */
1510
- marginTopPx: number;
1511
- /** カーソルが近い場合にのみ表示 */
1512
- isNearCursor: boolean;
1513
- /** リサイズ中のプレビューサイズ(px) - 指定時は単位変換して表示 */
1514
- resizingPxSize?: number;
1515
- /** 寸法更新時のコールバック */
1516
- onDimensionChange?: (direction: "column" | "row", index: number, dimension: Dimension<GridUnit>) => void;
1517
- }
665
+ export declare const DEFAULT_PAPER_SIZES: Record<PaperSizePreset, PaperSize>;
1518
666
 
1519
667
  /**
1520
- * GridLayer - グリッドシステムの統合コンポーネント
668
+ * `getDefaultSelectionActionBarItems` + `SelectionActionBar` をキャンバス上に浮かせて表示するオーバーレイ。
1521
669
  *
1522
- * 4つのレイヤーを統合して提供します:
1523
- * 1. GridCanvas (z-index: 0) - 用紙背景
1524
- * 2. MarginOverlay (z-index: 1) - 印刷不可領域の視覚化
1525
- * 3. GridOverlay (z-index: 2) - グリッド線
1526
- * 4. BorderOverlay (z-index: 3) - 印刷可能領域の境界線
670
+ * @remarks
671
+ * `position: relative` なコンテナ内で選択ブロック群の右上コーナーに `SelectionActionBar` を浮かせる。
1527
672
  *
1528
673
  * @example
1529
674
  * ```tsx
1530
- * <GridLayer
1531
- * paper={schema.paper}
1532
- * grid={schema.grid}
1533
- * paperWidthPx={794}
1534
- * paperHeightPx={1123}
1535
- * contentAreaWidthPx={718}
1536
- * contentAreaHeightPx={1047}
1537
- * marginLeftPx={38}
1538
- * marginRightPx={38}
1539
- * marginTopPx={38}
1540
- * marginBottomPx={38}
1541
- * colWidthPxs={[100, 150, 200, 268]}
1542
- * rowHeightPxs={[50, 75, 100, 125, 697]}
1543
- * />
675
+ * <div style={{ position: "relative" }}>
676
+ * <NoteForm ... />
677
+ * <DefaultSelectionActionBarOverlay context={context} />
678
+ * </div>
1544
679
  * ```
1545
680
  */
1546
- export declare const GridLayer: React.FC<GridLayerProps>;
681
+ export declare const DefaultSelectionActionBarOverlay: {
682
+ ({ context, gridSize, isDragging, zIndex, onActionFeedback, }: DefaultSelectionActionBarOverlayProps): JSX.Element;
683
+ displayName: string;
684
+ };
1547
685
 
1548
686
  /**
1549
- * GridLayerのプロパティ
687
+ * `DefaultSelectionActionBarOverlay` コンポーネントへの props。
1550
688
  */
1551
- export declare interface GridLayerProps {
1552
- paperPx: PaperPx;
1553
- gridPosPxs: GridPosPx;
1554
- gridDimensions?: {
1555
- cols: Array<Dimension<GridUnit>>;
1556
- rows: Array<Dimension<GridUnit>>;
1557
- };
1558
- gridLineStyle?: LineStyle;
1559
- borderStyle?: BorderStyle;
1560
- backgroundColor?: string;
1561
- boxShadow?: string;
1562
- marginFillColor?: string;
1563
- showGridLines?: boolean;
1564
- showMargins?: boolean;
1565
- showBorder?: boolean;
1566
- showResizeHandles?: boolean;
1567
- showDimensionLabels?: boolean;
1568
- onGridResize?: (direction: "column" | "row", index: number, delta: number) => void;
1569
- onDimensionChange?: (direction: "column" | "row", index: number, dimension: Dimension<GridUnit>) => void;
1570
- className?: string;
1571
- zIndex?: {
1572
- canvas?: number;
1573
- margin?: number;
1574
- grid?: number;
1575
- border?: number;
1576
- };
1577
- }
1578
-
1579
- /**
1580
- * GridOverlay
1581
- *
1582
- * グリッド線をSVGで描画するオーバーレイコンポーネント
1583
- * - z-index: 2 (GridLayerの最上層)
1584
- * - pointer-events: none (クリックイベント透過)
1585
- * - コンテンツエリア(印刷可能領域)内にグリッド線を描画
1586
- */
1587
- export declare const GridOverlay: default_2.FC<GridOverlayProps>;
1588
-
1589
- /**
1590
- * GridOverlayコンポーネントのProps
1591
- */
1592
- export declare interface GridOverlayProps {
1593
- gridPosPx: GridPosPx;
1594
- contentPx: PaperContentPx;
1595
- marginLeftPx: number;
1596
- marginTopPx: number;
1597
- lineStyle?: LineStyle;
1598
- visible?: boolean;
1599
- zIndex?: number;
1600
- dpi?: number;
1601
- className?: string;
1602
- }
1603
-
1604
- export declare interface GridPosPx {
1605
- cols: number[];
1606
- rows: number[];
1607
- }
1608
-
1609
- /**
1610
- * GridResizeHandle - グリッドリサイズ用のハンドル
1611
- *
1612
- * グリッド線の両端にハンドルを配置し、ドラッグでリサイズ可能にします。
1613
- * 設計文書に従い、「グリッド線そのもののドラッグは禁止」し、
1614
- * 「グリッド線の両端ハンドル」のみをドラッグ可能とします。
1615
- */
1616
- export declare const GridResizeHandle: MemoExoticComponent<({ direction, index, position, marginLeftPx, marginTopPx, onResizeStart, onResize, onResizeEnd, }: GridResizeHandleProps) => JSX.Element>;
1617
-
1618
- /**
1619
- * @file GridResizeHandle.tsx
1620
- * @description グリッドリサイズ用のハンドルコンポーネント
1621
- */
1622
- export declare interface GridResizeHandleProps {
1623
- /** ハンドルの方向 ('column' or 'row') */
1624
- direction: "column" | "row";
1625
- /** グリッドのインデックス (列なら列番号、行なら行番号) */
1626
- index: number;
1627
- /** ハンドルの位置 (px) - グリッド線の位置 */
1628
- position: number;
1629
- /** 印刷可能領域の左マージン (px) */
1630
- marginLeftPx: number;
1631
- /** 印刷可能領域の上マージン (px) */
1632
- marginTopPx: number;
1633
- /** リサイズ開始時のコールバック */
1634
- onResizeStart?: (direction: "column" | "row", index: number) => void;
1635
- /** リサイズ中のコールバック */
1636
- onResize?: (direction: "column" | "row", index: number, delta: number) => void;
1637
- /** リサイズ終了時のコールバック */
1638
- onResizeEnd?: (direction: "column" | "row", index: number, delta: number) => void;
1639
- }
1640
-
1641
- /**
1642
- * GridSizePanel
1643
- * 行・列数を変更するパネル
1644
- */
1645
- export declare const GridSizePanel: {
1646
- ({ grid, onGridChange }: GridSizePanelProps): JSX.Element;
1647
- displayName: string;
1648
- };
1649
-
1650
- export declare interface GridSizePanelProps {
1651
- /** グリッド設定 */
1652
- grid: Grid;
1653
- /** グリッド変更時のコールバック */
1654
- onGridChange: (grid: Grid) => void;
1655
- }
1656
-
1657
- export declare function gridToMms(dims: Dimension<GridUnit>[], contentSizeMm: number): number[];
1658
-
1659
- export declare function gridToPxs(dims: Dimension<GridUnit>[], contentSizeMm: number, dpi: number): number[];
1660
-
1661
- export declare type GridUnit = (typeof GRID_UNITS)[number];
1662
-
1663
- export declare enum HorizontalAlign {
1664
- left = "flex-start",
1665
- center = "center",
1666
- right = "flex-end"
1667
- }
1668
-
1669
- /**
1670
- * ImageSchema の実体定義
1671
- */
1672
- export declare const imageDefinition: PluginProperties<ImageSchema>;
1673
-
1674
- /**
1675
- * 画像プロパティのスキーマ(フラット)
1676
- */
1677
- export declare enum ImageObjectFit {
1678
- Contain = "contain",
1679
- Cover = "cover",
1680
- Fill = "fill",
1681
- None = "none",
1682
- ScaleDown = "scale-down"
1683
- }
1684
-
1685
- export declare interface ImageSchema {
1686
- objectFit?: ImageObjectFit;
1687
- alt?: string;
1688
- }
1689
-
1690
- /**
1691
- * ImportExportPanel
1692
- * スキーマと値のインポート/エクスポート機能を提供
1693
- */
1694
- export declare const ImportExportPanel: {
1695
- ({ schema, values, onSchemaChange, onValuesChange, }: ImportExportPanelProps): JSX.Element;
1696
- displayName: string;
1697
- };
1698
-
1699
- export declare interface ImportExportPanelProps {
1700
- /** スキーマ */
1701
- schema: FormSchema;
1702
- /** 値 */
1703
- values: Record<string, Value>;
1704
- /** スキーマ変更時のコールバック */
1705
- onSchemaChange: (schema: FormSchema) => void;
1706
- /** 値変更時のコールバック */
1707
- onValuesChange: (values: Record<string, Value>) => void;
1708
- }
1709
-
1710
- export declare const InsertGhost: MemoExoticComponent<({ pluginRegistry, gridLength, getBlockRectPx, currentGrid, currentMousePx, pluginKind, defaultSize, isOutside, selectionStyle, ghostZIndex, selectBorderZIndex, blockHandlesZIndex, }: InsertGhostProps) => JSX.Element | null>;
1711
-
1712
- export declare interface InsertGhostProps {
1713
- pluginRegistry: Record<string, BlockPlugin>;
1714
- gridLength: {
1715
- cols: number;
1716
- rows: number;
1717
- };
1718
- getBlockRectPx: (block: Block) => BlockRectPx;
1719
- currentGrid: {
1720
- col: number;
1721
- row: number;
1722
- };
1723
- currentMousePx?: {
1724
- x: number;
1725
- y: number;
1726
- };
1727
- pluginKind: string;
1728
- defaultSize: {
1729
- w: number;
1730
- h: number;
1731
- };
1732
- isOutside: boolean;
1733
- selectionStyle: BorderStyle;
1734
- ghostZIndex?: number;
1735
- selectBorderZIndex?: number;
1736
- blockHandlesZIndex?: number;
1737
- }
1738
-
1739
- export declare const InteractionBlock: default_2.MemoExoticComponent<({ block, rect, showHandles, onResizeStart, activeHandle, selectionStyle, handleStyle, selectBorderZIndex, blockHandlesZIndex, }: InteractionBlockProps) => JSX.Element>;
1740
-
1741
- export declare interface InteractionBlockProps {
1742
- block: Block;
1743
- rect: BlockRectPx;
1744
- showHandles?: boolean;
1745
- onResizeStart?: (e: default_2.PointerEvent, handle: ResizeHandle) => void;
1746
- activeHandle?: ResizeHandle | null;
1747
- selectionStyle?: BorderStyle;
1748
- handleStyle?: typeof RESIZE_HANDLE_STYLE;
1749
- /** 選択枠のz-index (デフォルト: interactionZIndexs.select_border) */
1750
- selectBorderZIndex?: number;
1751
- /** リサイズハンドルのz-index (デフォルト: interactionZIndexs.block_handles) */
1752
- blockHandlesZIndex?: number;
1753
- }
1754
-
1755
- export declare type InteractionChangeEvent = {
1756
- type: InteractionEventType.START_PRESS;
1757
- blockId: string;
1758
- startGrid: {
1759
- col: number;
1760
- row: number;
1761
- };
1762
- selectedBlockIds?: string[];
1763
- } | {
1764
- type: InteractionEventType.UPDATE_DRAG;
1765
- currentGrid: {
1766
- col: number;
1767
- row: number;
1768
- };
1769
- currentMousePx: {
1770
- x: number;
1771
- y: number;
1772
- };
1773
- isOutside?: boolean;
1774
- } | {
1775
- type: InteractionEventType.END_DRAG;
1776
- } | {
1777
- type: InteractionEventType.CANCEL_DRAG;
1778
- } | {
1779
- type: InteractionEventType.EDIT;
1780
- blockId: string;
1781
- } | {
1782
- type: InteractionEventType.END_EDIT;
1783
- } | {
1784
- type: InteractionEventType.START_INSERT;
1785
- pluginKind: string;
1786
- defaultSize: {
1787
- w: number;
1788
- h: number;
1789
- };
1790
- } | {
1791
- type: InteractionEventType.CANCEL_INSERT;
1792
- } | {
1793
- type: InteractionEventType.START_RESIZE;
1794
- blockId: string;
1795
- handle: ResizeHandle;
1796
- startGrid: {
1797
- col: number;
1798
- row: number;
1799
- };
1800
- };
1801
-
1802
- /**
1803
- * インタラクション変更イベント種別
1804
- *
1805
- * @remarks
1806
- * インタラクション変更イベントの種類を型安全に扱うための列挙型
1807
- */
1808
- export declare enum InteractionEventType {
1809
- /** プレス開始(ドラッグ判定前) */
1810
- START_PRESS = "startPress",
1811
- /** ドラッグ更新 */
1812
- UPDATE_DRAG = "updateDrag",
1813
- /** ドラッグ終了 */
1814
- END_DRAG = "endDrag",
1815
- /** ドラッグキャンセル */
1816
- CANCEL_DRAG = "cancelDrag",
1817
- /** 編集開始 */
1818
- EDIT = "edit",
1819
- /** 編集終了 */
1820
- END_EDIT = "endEdit",
1821
- /** 挿入開始 */
1822
- START_INSERT = "startInsert",
1823
- /** 挿入キャンセル */
1824
- CANCEL_INSERT = "cancelInsert",
1825
- /** リサイズ開始 */
1826
- START_RESIZE = "startResize"
1827
- }
1828
-
1829
- export declare const InteractionLayer: MemoExoticComponent<({ blocks, pluginRegistry, gridLength, getBlockRectPx, getColIndex, getRowIndex, state, onChange, selectedBlockIds, onSelectionChange, onBlockChange, scale, className, selectionStyle, handleStyle, editBlockZIndex, selectBorderZIndex, blockHandlesZIndex, dragGhostZIndex, }: InteractionLayerProps) => JSX.Element>;
1830
-
1831
- /**
1832
- * InteractionLayerProps
1833
- */
1834
- export declare interface InteractionLayerProps {
1835
- blocks: Block[];
1836
- pluginRegistry: Record<string, BlockPlugin>;
1837
- gridLength: {
1838
- cols: number;
1839
- rows: number;
1840
- };
1841
- getBlockRectPx: (block: Block) => BlockRectPx;
1842
- getColIndex: (px: number) => number;
1843
- getRowIndex: (px: number) => number;
1844
- state: InteractionState;
1845
- onChange: OnInteractionChange;
1846
- selectedBlockIds: string[];
1847
- onSelectionChange: (blockIds: string[]) => void;
1848
- onBlockChange?: OnBlockChange;
1849
- scale?: number;
1850
- className?: string;
1851
- selectionStyle?: BorderStyle;
1852
- handleStyle?: typeof RESIZE_HANDLE_STYLE;
1853
- editBlockZIndex?: number;
1854
- selectBorderZIndex?: number;
1855
- blockHandlesZIndex?: number;
1856
- dragGhostZIndex?: number;
1857
- }
1858
-
1859
- /**
1860
- * インタラクションモード
1861
- *
1862
- * @remarks
1863
- * インタラクション操作の状態を型安全に扱うための列挙型
1864
- */
1865
- export declare enum InteractionMode {
1866
- /** 待機状態 */
1867
- IDLE = "idle",
1868
- /** マウスダウン中(クリックかドラッグか判定前) */
1869
- PRESSING = "pressing",
1870
- /** ドラッグ確定 */
1871
- DRAGGING = "dragging",
1872
- /** 編集中 */
1873
- EDITING = "editing"
1874
- }
1875
-
1876
- /**
1877
- * インタラクション状態 (単一オブジェクト)
1878
- *
1879
- * @remarks
1880
- * Pluginの `value` に相当する統合状態
1881
- * 全ての操作状態をこのオブジェクト1つで管理する
1882
- *
1883
- * **注意**:
1884
- * - 選択状態(`selectedBlockIds`)は外部で管理されます
1885
- * - モード(`mode`)は`dragging`と`editingBlockId`から導出されます
1886
- */
1887
- export declare interface InteractionState {
1888
- /** 編集中のブロックID (nullの場合は編集モードではない) */
1889
- editingBlockId: string | null;
1890
- /** ドラッグ中の状態 (ドラッグ中のみ有効) */
1891
- dragging?: DraggingState;
1892
- }
1893
-
1894
- export declare const interactionZIndexs: {
1895
- readonly base: 2100000;
1896
- readonly select_block: 2000000;
1897
- readonly block_ghost: 2200000;
1898
- readonly hover_outline: 2300000;
1899
- readonly edit_block: 2400000;
1900
- readonly grid_ghost: 2700000;
1901
- readonly grid_handles: 2800000;
1902
- readonly select_border: 2500000;
1903
- readonly block_handles: 2600000;
1904
- readonly rubber_band: 2900000;
1905
- };
1906
-
1907
- /**
1908
- * Hex カラー文字列の妥当性をチェック
1909
- * @param hex チェックする文字列
1910
- * @returns 妥当な Hex カラー文字列かどうか
1911
- */
1912
- export declare function isValidHex(hex: string): boolean;
1913
-
1914
- export declare const LayoutPanel: default_2.FC<LayoutPanelProps>;
1915
-
1916
- export declare interface LayoutPanelProps {
1917
- selectedBlocks: Block[];
1918
- onUpdateBlocks: (updates: Record<string, Partial<Block>>) => void;
689
+ export declare interface DefaultSelectionActionBarOverlayProps {
690
+ /** NoteContext(`useNoteContext` が返すコンテキスト) */
691
+ context: NoteContext;
692
+ /** グリッドサイズ(レイアウトパネルに使用) */
1919
693
  gridSize?: {
1920
694
  cols: number;
1921
695
  rows: number;
1922
696
  };
1923
- }
1924
-
1925
- export declare interface LineStyle {
1926
- color: string;
1927
- width: Dimension<BorderUnit>;
1928
- type: LineType;
1929
- }
1930
-
1931
- export declare enum LineType {
1932
- SOLID = "solid",// 実線
1933
- DASHED = "dashed",// 破線
1934
- DOTTED = "dotted"
1935
- }
1936
-
1937
- /**
1938
- * 状態変化を監視するリスナー関数
1939
- */
1940
- declare type Listener = (state: DragState) => void;
1941
-
1942
- /**
1943
- * MarginOverlay
1944
- *
1945
- * 用紙のマージン(印刷不可領域)を視覚的に表示するコンポーネント
1946
- * - z-index: 1 (GridCanvasの上、GridOverlayの下)
1947
- * - pointer-events: none (クリックイベント透過)
1948
- * - 半透明の影でマージン領域を表現
1949
- */
1950
- export declare const MarginOverlay: default_2.FC<MarginOverlayProps>;
1951
-
1952
- /**
1953
- * MarginOverlayコンポーネントのProps
1954
- */
1955
- export declare interface MarginOverlayProps {
1956
- paperPx: PaperPx;
1957
- visible?: boolean;
1958
- marginColor?: string;
697
+ /** ドラッグ中のとき `true` を渡すと非表示になる */
698
+ isDragging?: boolean;
699
+ /** z-index(デフォルト: `Z_INDEX.SELECTION_ACTION_BAR`) */
1959
700
  zIndex?: number;
1960
- className?: string;
1961
- }
1962
-
1963
- /**
1964
- * MarginPanel
1965
- * マージンを変更するパネル
1966
- */
1967
- export declare const MarginPanel: {
1968
- ({ paper, onPaperChange }: MarginPanelProps): JSX.Element;
1969
- displayName: string;
1970
- };
1971
-
1972
- export declare interface MarginPanelProps {
1973
- /** 用紙設定 */
1974
- paper: Paper;
1975
- /** 用紙変更時のコールバック */
1976
- onPaperChange: (paper: Paper) => void;
1977
- }
1978
-
1979
- export declare const MetaPanel: default_2.FC<MetaPanelProps>;
1980
-
1981
- export declare interface MetaPanelProps {
1982
- selectedBlocks: Block[];
1983
- onUpdateBlocks: (updates: Record<string, Partial<Block>>) => void;
1984
- }
1985
-
1986
- export declare function mmsToPxs(mms: number[], dpi?: number): number[];
1987
-
1988
- export declare const MovingGhost: MemoExoticComponent<({ blocks, pluginRegistry, gridLength, getBlockRectPx, selectedBlockIds, deltaCol, deltaRow, isOutside, currentMousePx, selectionStyle, ghostZIndex, selectBorderZIndex, blockHandlesZIndex, }: MovingGhostProps) => JSX.Element>;
1989
-
1990
- export declare interface MovingGhostProps {
1991
- blocks: Block[];
1992
- pluginRegistry: Record<string, BlockPlugin>;
1993
- gridLength: {
1994
- cols: number;
1995
- rows: number;
1996
- };
1997
- getBlockRectPx: (block: Block) => BlockRectPx;
1998
- selectedBlockIds: string[];
1999
- deltaCol: number;
2000
- deltaRow: number;
2001
- isOutside: boolean;
2002
- currentMousePx?: {
2003
- x: number;
2004
- y: number;
2005
- };
2006
- selectionStyle: BorderStyle;
2007
- ghostZIndex?: number;
2008
- selectBorderZIndex?: number;
2009
- blockHandlesZIndex?: number;
2010
- }
2011
-
2012
- export declare const multilineDefinition: PluginProperties<MultilineSchema>;
2013
-
2014
- export declare interface MultilineSchema {
2015
- multiline?: boolean;
2016
- wordWrap?: MultilineWordWrap;
2017
- whiteSpace?: MultilineWhiteSpace;
2018
- }
2019
-
2020
- export declare enum MultilineWhiteSpace {
2021
- Normal = "normal",
2022
- NoWrap = "nowrap",
2023
- Pre = "pre",
2024
- PreWrap = "pre-wrap",
2025
- PreLine = "pre-line"
2026
- }
2027
-
2028
- export declare enum MultilineWordWrap {
2029
- Normal = "normal",
2030
- BreakWord = "break-word",
2031
- BreakAll = "break-all"
2032
- }
2033
-
2034
- export declare const NoteEdit: MemoExoticComponent< {
2035
- ({ schema, values, pluginRegistry, onValueChange, scale, className, }: NoteEditProps): JSX.Element;
2036
- displayName: string;
2037
- }>;
2038
-
2039
- export declare const NoteEditor: MemoExoticComponent< {
2040
- ({ schema, values, mode, pluginRegistry, selectedBlockIds, onSchemaChange, onValuesChange, onSelectionChange, scale, className, }: NoteEditorProps): JSX.Element;
2041
- displayName: string;
2042
- }>;
2043
-
2044
- export declare interface NoteEditorProps {
2045
- schema: FormSchema;
2046
- values: Record<string, Value>;
2047
- mode: NoteMode;
2048
- pluginRegistry: Record<string, BlockPlugin>;
2049
- selectedBlockIds?: string[];
2050
- onSchemaChange?: OnSchemaChange;
2051
- onValuesChange?: OnValuesChange;
2052
- onSelectionChange?: (selectedBlockIds: string[]) => void;
2053
- scale?: number;
2054
- className?: string;
2055
- }
2056
-
2057
- export declare interface NoteEditProps {
2058
- schema: FormSchema;
2059
- values: Record<string, Value>;
2060
- pluginRegistry: Record<string, BlockPlugin>;
2061
- onValueChange?: OnChange;
2062
- scale?: number;
2063
- className?: string;
2064
- }
2065
-
2066
- export declare const NoteForm: MemoExoticComponent< {
2067
- ({ schema, pluginRegistry, selectedBlockIds: OuterSelectedBlockIds, onSchemaChange, onSelectionChange: onOuterSelectionChange, scale, className, }: NoteFormProps): JSX.Element;
2068
- displayName: string;
2069
- }>;
2070
-
2071
- export declare interface NoteFormProps {
2072
- schema: FormSchema;
2073
- pluginRegistry: Record<string, BlockPlugin>;
2074
- selectedBlockIds?: string[];
2075
- onSchemaChange?: OnSchemaChange;
2076
- onSelectionChange?: (selectedBlockIds: string[]) => void;
2077
- scale?: number;
2078
- className?: string;
2079
- }
2080
-
2081
- export declare enum NoteMode {
2082
- FORM = "Form",// テンプレート作成モード
2083
- EDIT = "Edit",// 値入力モード
2084
- VIEW = "View"
2085
- }
2086
-
2087
- export declare const NotePrint: NamedExoticComponent<NotePrintProps & RefAttributes<NoteViewPrintRef>>;
2088
-
2089
- export declare interface NotePrintProps {
2090
- schema: FormSchema;
2091
- values?: Record<string, Value>;
2092
- pluginRegistry: Record<string, BlockPlugin>;
2093
- className?: string;
2094
- }
2095
-
2096
- export declare const NoteView: MemoExoticComponent< {
2097
- ({ schema, values, pluginRegistry, scale, className, }: NoteViewProps): JSX.Element;
2098
- displayName: string;
2099
- }>;
2100
-
2101
- /**
2102
- * NoteView ref に公開する印刷メソッド
2103
- */
2104
- export declare interface NoteViewPrintRef {
2105
- /** 印刷ダイアログを開く */
2106
- print: () => void;
2107
- /** 印刷プレビューを開く(ブラウザの印刷ダイアログ) */
2108
- openPrintPreview: () => void;
2109
- }
2110
-
2111
- export declare interface NoteViewProps {
2112
- schema: FormSchema;
2113
- values: Record<string, Value>;
2114
- pluginRegistry: Record<string, BlockPlugin>;
2115
- scale?: number;
2116
- className?: string;
2117
- }
2118
-
2119
- export declare const NumberInput: {
2120
- ({ value, onChange, readOnly, min: propMin, max: propMax, step: propStep, integer: propInteger, placeholder: propPlaceholder, width: propWidth, height: propHeight, config, onBlur, }: NumberInputProps): default_2.ReactElement;
2121
- displayName: string;
2122
- };
2123
-
2124
- export declare interface NumberInputConfig {
2125
- min?: number;
2126
- max?: number;
2127
- step?: number;
2128
- integer?: boolean;
2129
- placeholder?: string;
2130
- width?: number;
2131
- height?: number;
2132
- [key: string]: Value;
2133
- }
2134
-
2135
- export declare interface NumberInputProps extends PropertyComponentProps<number | undefined> {
2136
- min?: number;
2137
- max?: number;
2138
- step?: number;
2139
- integer?: boolean;
2140
- placeholder?: string;
2141
- /** 幅(px) */
2142
- width?: number;
2143
- /** 高さ(px) */
2144
- height?: number;
2145
- config?: NumberInputConfig;
2146
- onBlur?: () => void;
2147
- }
2148
-
2149
- export declare type OnBlockChange = (event: BlockChangeEvent) => void;
2150
-
2151
- export declare type OnBlur = (id: string, value: Value) => void;
2152
-
2153
- export declare type OnChange = (id: string, value: Value) => void;
2154
-
2155
- export declare type OnError = (error: Error, context?: string) => void;
2156
-
2157
- export declare type OnGridChange = (event: GridChangeEvent) => void;
2158
-
2159
- /**
2160
- * インタラクション変更コールバック
2161
- *
2162
- * @remarks
2163
- * Pluginの `onChange` に相当
2164
- * 全ての操作変更をこの1つのコールバックで処理する
2165
- */
2166
- export declare type OnInteractionChange = (event: InteractionChangeEvent) => void;
2167
-
2168
- export declare type OnPaperChange = (event: PaperChangeEvent) => void;
2169
-
2170
- export declare type OnSchemaChange = (schema: FormSchema) => void;
2171
-
2172
- export declare type OnSelectionChange = (selectedIds: string[]) => void;
2173
-
2174
- export declare type OnValidationError = (errors: Record<string, ValidationError[]>) => void;
2175
-
2176
- export declare type OnValuesChange = (values: Record<string, Value>) => void;
2177
-
2178
- /**
2179
- * 用紙の向き
2180
- */
2181
- export declare type Orientation = "portrait" | "landscape";
2182
-
2183
- /**
2184
- * OtherPanel
2185
- * その他の設定の統合パネル
2186
- * - ImportExportPanel: スキーマ・値のインポート/エクスポート
2187
- */
2188
- export declare const OtherPanel: {
2189
- ({ schema, values, onSchemaChange, onValuesChange, }: OtherPanelProps): JSX.Element;
2190
- displayName: string;
2191
- };
2192
-
2193
- export declare interface OtherPanelProps {
2194
- /** フォームスキーマ */
2195
- schema: FormSchema;
2196
- /** 入力データ */
2197
- values: Record<string, Value>;
2198
- /** スキーマ変更時のコールバック */
2199
- onSchemaChange: (newSchema: FormSchema) => void;
2200
- /** 入力データ変更時のコールバック */
2201
- onValuesChange: (newValues: Record<string, Value>) => void;
2202
- }
2203
-
2204
- export declare const PADDING_UNITS: readonly ["mm", "pt", "px", "%"];
2205
-
2206
- /**
2207
- * PaddingSchema の実体定義
2208
- */
2209
- export declare const paddingDefinition: PluginProperties<PaddingSchema>;
2210
-
2211
- /**
2212
- * パディングプロパティのスキーマ
2213
- */
2214
- export declare interface PaddingSchema {
2215
- isIndividual?: boolean;
2216
- all?: Dimension<PaddingUnit>;
2217
- top?: Dimension<PaddingUnit>;
2218
- right?: Dimension<PaddingUnit>;
2219
- bottom?: Dimension<PaddingUnit>;
2220
- left?: Dimension<PaddingUnit>;
2221
- }
2222
-
2223
- export declare type PaddingUnit = (typeof PADDING_UNITS)[number];
2224
-
2225
- /**
2226
- * PalettePanel
2227
- * ブロックをドラッグ&ドロップで挿入するためのパレット
2228
- */
2229
- export declare const PalettePanel: {
2230
- ({ plugins, className }: PalettePanelProps): JSX.Element;
2231
- displayName: string;
2232
- };
2233
-
2234
- export declare interface PalettePanelProps {
2235
- /** 利用可能なプラグイン一覧 */
2236
- plugins: BlockPlugin[];
2237
- /** カスタムクラス名 */
2238
- className?: string;
2239
- }
2240
-
2241
- export declare interface Paper {
2242
- size: PaperSize;
2243
- margin: PaperMargin;
2244
- }
2245
-
2246
- export declare const PAPER_UNITS: readonly ["mm", "cm", "inch"];
2247
-
2248
- export declare interface PaperCanvasPx {
2249
- width: number;
2250
- height: number;
2251
- }
2252
-
2253
- export declare interface PaperChangeEvent {
2254
- type: PaperChangeType;
2255
- paper: Paper;
2256
- }
2257
-
2258
- export declare type PaperChangeType = "size" | "margin" | "preset";
2259
-
2260
- export declare interface PaperContentPx {
2261
- width: number;
2262
- height: number;
2263
- }
2264
-
2265
- export declare interface PaperMargin {
2266
- top: Dimension<PaperUnit>;
2267
- right: Dimension<PaperUnit>;
2268
- bottom: Dimension<PaperUnit>;
2269
- left: Dimension<PaperUnit>;
2270
- }
2271
-
2272
- export declare interface PaperMarginPx {
2273
- top: number;
2274
- right: number;
2275
- bottom: number;
2276
- left: number;
2277
- }
2278
-
2279
- export declare interface PaperPx {
2280
- canvas: PaperCanvasPx;
2281
- margin: PaperMarginPx;
2282
- content: PaperContentPx;
2283
- }
2284
-
2285
- export declare interface PaperSize {
2286
- preset: PaperSizePreset;
2287
- width: Dimension<PaperUnit>;
2288
- height: Dimension<PaperUnit>;
2289
- }
2290
-
2291
- /**
2292
- * PaperSizePanel
2293
- * 用紙サイズを変更するパネル
2294
- */
2295
- export declare const PaperSizePanel: {
2296
- ({ paper, onPaperChange, }: PaperSizePanelProps): JSX.Element;
2297
- displayName: string;
2298
- };
2299
-
2300
- export declare interface PaperSizePanelProps {
2301
- /** 用紙設定 */
2302
- paper: Paper;
2303
- /** 用紙変更時のコールバック */
2304
- onPaperChange: (paper: Paper) => void;
2305
- }
2306
-
2307
- export declare enum PaperSizePreset {
2308
- A4 = "A4",
2309
- B5 = "B5",
2310
- A3 = "A3",
2311
- LETTER = "Letter",
2312
- LEGAL = "Legal",
2313
- CUSTOM = "Custom"
2314
- }
2315
-
2316
- export declare type PaperUnit = (typeof PAPER_UNITS)[number];
2317
-
2318
- /**
2319
- * カラー文字列を RGBA オブジェクトに変換
2320
- * @param value カラー文字列 (#RRGGBB, #RRGGBBAA, rgba(r,g,b,a), undefined)
2321
- * @returns RGBA オブジェクト、または null(変換失敗時)
2322
- */
2323
- export declare function parseColor(value: string | undefined): RGBA | null;
2324
-
2325
- /**
2326
- * PlaceholderSchema の実体定義
2327
- */
2328
- export declare const placeholderDefinition: PluginProperties<PlaceholderSchema>;
2329
-
2330
- /**
2331
- * プレースホルダープロパティのスキーマ(フラット)
2332
- */
2333
- export declare interface PlaceholderSchema {
2334
- placeholder?: string;
2335
- }
2336
-
2337
- declare type Plugin_2<P = Record<string, Value>, V = Value> = BlockPlugin<P, V> | FeaturePlugin;
2338
- export { Plugin_2 as Plugin }
2339
-
2340
- /**
2341
- * プラグインアイコンProps
2342
- */
2343
- export declare interface PluginIconProps {
2344
- className?: string;
2345
- style?: default_2.CSSProperties;
2346
- }
2347
-
2348
- export declare const PluginPanels: React.FC<PluginPanelsProps>;
2349
-
2350
- export declare interface PluginPanelsProps {
2351
- selectedBlocks: Block[];
2352
- pluginRegistry: Record<string, BlockPlugin>;
2353
- onUpdateBlocks: (updates: Record<string, Partial<Block>>) => void;
2354
- }
2355
-
2356
- export declare type PluginProperties<P> = {
2357
- [K in keyof P]-?: PropertyConfig<P[K], P>;
2358
- };
2359
-
2360
- /**
2361
- * 印刷前の準備処理
2362
- */
2363
- export declare function preparePrint(options?: {
2364
- title?: string;
2365
- removeScrollbars?: boolean;
2366
- }): void;
2367
-
2368
- /**
2369
- * 特定の要素だけを印刷
2370
- * 非破壊的な方法: 一時的なクラスを使用して、CSSで他の要素を非表示化
2371
- */
2372
- export declare function printElement(element: HTMLElement, options?: {
2373
- title?: string;
2374
- onBeforePrint?: () => void;
2375
- onAfterPrint?: () => void;
2376
- }): void;
2377
-
2378
- /**
2379
- * 印刷時の余白設定
2380
- */
2381
- export declare interface PrintMargin {
2382
- top?: string;
2383
- right?: string;
2384
- bottom?: string;
2385
- left?: string;
2386
- }
2387
-
2388
- /**
2389
- * @file types/print/index.ts
2390
- * @description 印刷機能関連の型定義
2391
- */
2392
- /**
2393
- * 印刷用の用紙サイズ
2394
- */
2395
- export declare type PrintPaperSize = "A4" | "A3" | "B4" | "B5" | "Letter" | "Legal";
2396
-
2397
- /**
2398
- * 印刷設定
2399
- */
2400
- export declare interface PrintSettings {
2401
- /** 用紙サイズ */
2402
- paperSize?: PrintPaperSize;
2403
- /** 用紙の向き */
2404
- orientation?: Orientation;
2405
- /** 余白 */
2406
- margin?: PrintMargin;
2407
- }
2408
-
2409
- /**
2410
- * PropertiesPanel Props
2411
- *
2412
- * @template P - プラグイン固有プロパティ型
2413
- */
2414
- export declare interface PropertiesPanelProps<P = Record<string, Value>> {
2415
- props: P;
2416
- onChange: (nextProps: P) => void;
2417
- }
2418
-
2419
- export declare interface PropertyComponentProps<T> {
2420
- value: T;
2421
- onChange: (value: T) => void;
2422
- readOnly?: boolean;
2423
- config?: Record<string, Value>;
2424
- }
2425
-
2426
- export declare type PropertyConfig<T, Context> = PropertyDefinition_2<T, Context> | false;
2427
-
2428
- declare interface PropertyDefinition_2<T, Context = Record<string, Value>> {
2429
- /** デフォルト値 */
2430
- defaultValue: T;
2431
- /** UIに表示されるラベル */
2432
- label?: string;
2433
- /** UI上のグループ分け (例: "フォント", "レイアウト") */
2434
- group?: string;
2435
- /** プロパティ編集用のUIコンポーネント */
2436
- Component?: default_2.ComponentType<PropertyComponentProps<T>>;
2437
- config?: Record<string, Value>;
2438
- /** 説明文 (ツールチップ等で表示) */
2439
- description?: string;
2440
- /** 複数ブロック選択時に編集不可にするか */
2441
- disableInMultiSelection?: boolean;
2442
- condition?: (data: Context) => boolean;
2443
- }
2444
- export { PropertyDefinition_2 as PropertyDefinition }
2445
-
2446
- export declare const PropertyField: MemoExoticComponent<({ propertyKey, definition, selectedBlocks, onChange, }: PropertyFieldProps) => JSX.Element | null>;
2447
-
2448
- export declare interface PropertyFieldProps {
2449
- propertyKey: string;
2450
- definition: PropertyDefinition_2<Value, Record<string, Value>>;
2451
- selectedBlocks: Block[];
2452
- onChange: (key: string, val: Value) => void;
2453
- }
2454
-
2455
- /**
2456
- * @file objectUtils.ts
2457
- * @description オブジェクト操作のユーティリティ関数
2458
- */
2459
- /**
2460
- * オブジェクトからundefined/nullプロパティを再帰的に削除する
2461
- * 空オブジェクト{}は保持される(削除指示として重要)
2462
- */
2463
- export declare function removeUndefinedProps<T extends Record<string, unknown>>(obj: T): T;
2464
-
2465
- /**
2466
- * BlockRenderer Props
2467
- *
2468
- * @template P - プラグイン固有プロパティ型
2469
- * @template V - プラグインが扱う値の型
2470
- */
2471
- export declare interface RendererProps<P = Record<string, Value>, V = Value> {
2472
- id: string;
2473
- props: P;
2474
- value: V;
2475
- onChange: (value: V) => void;
2476
- onBlur?: (value: V) => void;
2477
- readOnly: boolean;
2478
- mode: NoteMode;
2479
- dimensions?: {
2480
- widthPx: number;
2481
- heightPx: number;
2482
- };
2483
- validationState?: "valid" | "invalid" | "warning";
2484
- }
2485
-
2486
- export declare const RESIZE_HANDLE_STYLE: ResizeHandleStyle;
2487
-
2488
- export declare const ResizeGhost: MemoExoticComponent<({ blocks, pluginRegistry, gridLength, getBlockRectPx, blockId, handle, deltaCol, deltaRow, isOutside, selectionStyle, ghostZIndex, selectBorderZIndex, blockHandlesZIndex, }: ResizeGhostProps) => JSX.Element | null>;
2489
-
2490
- export declare interface ResizeGhostProps {
2491
- blocks: Block[];
2492
- pluginRegistry: Record<string, BlockPlugin>;
2493
- gridLength: {
2494
- cols: number;
2495
- rows: number;
2496
- };
2497
- getBlockRectPx: (block: Block) => BlockRectPx;
2498
- blockId: string;
2499
- handle: ResizeHandle;
2500
- deltaCol: number;
2501
- deltaRow: number;
2502
- isOutside: boolean;
2503
- selectionStyle: BorderStyle;
2504
- ghostZIndex?: number;
2505
- selectBorderZIndex?: number;
2506
- blockHandlesZIndex?: number;
2507
- }
2508
-
2509
- /**
2510
- * リサイズハンドル方向
2511
- *
2512
- * @remarks
2513
- * 8方向のリサイズハンドルを型安全に扱うための列挙型
2514
- */
2515
- export declare enum ResizeHandle {
2516
- /** 北(上) */
2517
- N = "n",
2518
- /** 北東(右上) */
2519
- NE = "ne",
2520
- /** 東(右) */
2521
- E = "e",
2522
- /** 南東(右下) */
2523
- SE = "se",
2524
- /** 南(下) */
2525
- S = "s",
2526
- /** 南西(左下) */
2527
- SW = "sw",
2528
- /** 西(左) */
2529
- W = "w",
2530
- /** 北西(左上) */
2531
- NW = "nw"
2532
- }
2533
-
2534
- export declare const ResizeHandles: default_2.MemoExoticComponent<({ onResizeStart, activeHandle, handleStyle, zIndex, }: ResizeHandlesProps) => JSX.Element>;
2535
-
2536
- export declare interface ResizeHandlesProps {
2537
- onResizeStart: (e: default_2.PointerEvent, handle: ResizeHandle) => void;
2538
- activeHandle?: ResizeHandle | null;
2539
- handleStyle?: ResizeHandleStyle;
2540
- zIndex?: number;
2541
- }
2542
-
2543
- export declare interface ResizeHandleStyle {
2544
- size: number;
2545
- backgroundColor: string;
2546
- borderColor: string;
2547
- borderWidth: number;
2548
- borderRadius: string;
2549
- }
2550
-
2551
- /**
2552
- * リサイズ計算パラメータ
2553
- */
2554
- export declare interface ResizeParams {
2555
- /** 現在のレイアウト */
2556
- layout: BlockLayout;
2557
- /** リサイズハンドル */
2558
- handle: ResizeHandle;
2559
- /** 列方向の移動量 */
2560
- deltaCol: number;
2561
- /** 行方向の移動量 */
2562
- deltaRow: number;
2563
- /** グリッドの列数 */
2564
- gridCols: number;
2565
- /** グリッドの行数 */
2566
- gridRows: number;
2567
- }
2568
-
2569
- /**
2570
- * RGBA カラー型定義
2571
- */
2572
- export declare interface RGBA {
2573
- r: number;
2574
- g: number;
2575
- b: number;
2576
- a: number;
2577
- }
2578
-
2579
- /**
2580
- * RGBA入力コンポーネント
2581
- */
2582
- export declare const RGBAInputs: {
2583
- ({ rgba, onChange, readOnly, }: RGBAInputsProps): default_2.ReactElement;
2584
- displayName: string;
2585
- };
2586
-
2587
- export declare interface RGBAInputsProps {
2588
- rgba: RGBA;
2589
- onChange: (channel: keyof RGBA, value: number | undefined) => void;
2590
- readOnly?: boolean;
2591
- }
2592
-
2593
- /**
2594
- * ドロップダウン選択コンポーネント
2595
- */
2596
- export declare const Select: {
2597
- <T extends string = string>(props: SelectProps<T>): default_2.ReactElement;
2598
- displayName: string;
2599
- };
2600
-
2601
- /**
2602
- * Config型定義
2603
- */
2604
- export declare interface SelectConfig {
2605
- options?: readonly SelectOption[];
2606
- placeholder?: string;
2607
- width?: number;
2608
- height?: number;
2609
- [key: string]: Value;
2610
- }
2611
-
2612
- export declare const SELECTION_STYLE: BorderStyle;
2613
-
2614
- export declare const SelectionBorder: MemoExoticComponent<({ width, height, zIndex, borderStyle, }: SelectionBorderProps) => JSX.Element>;
2615
-
2616
- declare interface SelectionBorderProps {
2617
- width: number;
2618
- height: number;
2619
- zIndex?: number;
2620
- borderStyle?: BorderStyle;
2621
- }
2622
-
2623
- export declare const SelectionLayer: default_2.MemoExoticComponent<({ blocks, selectedBlockIds, isDragging, draggingState, getBlockRectPx, onResizeStart, selectionStyle, handleStyle, selectBorderZIndex, blockHandlesZIndex, }: SelectionLayerProps) => JSX.Element | null>;
2624
-
2625
- export declare interface SelectionLayerProps {
2626
- blocks: Block[];
2627
- selectedBlockIds: string[];
2628
- isDragging: boolean;
2629
- draggingState?: DraggingState;
2630
- getBlockRectPx: (block: Block) => BlockRectPx;
2631
- onResizeStart: (e: default_2.PointerEvent, handle: ResizeHandle, blockId: string) => void;
2632
- selectionStyle?: BorderStyle;
2633
- handleStyle?: typeof RESIZE_HANDLE_STYLE;
2634
- /** 選択枠のz-index (デフォルト: interactionZIndexs.select_border) */
2635
- selectBorderZIndex?: number;
2636
- /** リサイズハンドルのz-index (デフォルト: interactionZIndexs.block_handles) */
2637
- blockHandlesZIndex?: number;
2638
- }
2639
-
2640
- /**
2641
- * 選択肢の型
2642
- */
2643
- export declare interface SelectOption {
2644
- value: Value;
2645
- label: string;
2646
- [key: string]: Value;
2647
- }
2648
-
2649
- /**
2650
- * Select固有のProps
2651
- */
2652
- export declare interface SelectProps<T extends string = string> extends PropertyComponentProps<T | undefined> {
2653
- options?: readonly SelectOption[];
2654
- placeholder?: string;
2655
- /** 幅(px) */
2656
- width?: number;
2657
- /** 高さ(px) */
2658
- height?: number;
2659
- config?: SelectConfig;
2660
- }
2661
-
2662
- export declare type SerializedValue = string | number | boolean | null | SerializedValue[] | readonly SerializedValue[] | {
2663
- [key: string]: SerializedValue;
2664
- };
2665
-
2666
- /**
2667
- * FormSchemaをJSON文字列にシリアライズ
2668
- *
2669
- * @param schema - シリアライズするスキーマ
2670
- * @param pretty - 整形して出力するか (デフォルト: false)
2671
- * @returns JSON文字列
2672
- *
2673
- * @example
2674
- * ```ts
2675
- * const schema: FormSchema = { ... };
2676
- * const json = serializeSchema(schema);
2677
- * // または整形版
2678
- * const prettyJson = serializeSchema(schema, true);
2679
- * ```
2680
- */
2681
- export declare function serializeSchema(schema: FormSchema, pretty?: boolean): string;
2682
-
2683
- /**
2684
- * 入力値(values)をJSON文字列にシリアライズ
2685
- *
2686
- * @param values - シリアライズする入力値
2687
- * @param pretty - 整形して出力するか (デフォルト: false)
2688
- * @returns JSON文字列
2689
- *
2690
- * @example
2691
- * ```ts
2692
- * const values: Record<string, Value> = {
2693
- * 'block-1': 'Hello',
2694
- * 'block-2': 42,
2695
- * };
2696
- * const json = serializeValues(values);
2697
- * // または整形版
2698
- * const prettyJson = serializeValues(values, true);
2699
- * ```
2700
- */
2701
- export declare function serializeValues(values: Record<string, Value>, pretty?: boolean): string;
2702
-
2703
- /**
2704
- * Sidebar
2705
- * タブ切り替え機能を持つサイドバー
2706
- * - ブロックタブ: BlockPropertyPanel / PalettePanel
2707
- * - キャンバスタブ: CanvasPanel (用紙設定、マージン設定、グリッド設定、ブロック順序)
2708
- * - その他タブ: OtherPanel (スキーマ/値のインポート/エクスポート)
2709
- */
2710
- export declare const Sidebar: {
2711
- ({ blocks, selectedBlockIds, pluginRegistry, onUpdateBlocks, schema, values, onSchemaChange, onValuesChange, gridSize, className, }: SidebarProps): JSX.Element;
2712
- displayName: string;
2713
- };
2714
-
2715
- export declare interface SidebarProps {
2716
- /** 全ブロック */
2717
- blocks: Block[];
2718
- /** 選択中のブロックID一覧 */
2719
- selectedBlockIds: string[];
2720
- /** プラグインレジストリ */
2721
- pluginRegistry: Record<string, BlockPlugin>;
2722
- /** ブロック更新時のコールバック */
2723
- onUpdateBlocks: (updates: Record<string, Partial<Block>>) => void;
2724
- /** フォームスキーマ (CanvasPanel/OtherPanelで使用) */
2725
- schema: FormSchema;
2726
- /** 入力データ (OtherPanelで使用) */
2727
- values: Record<string, Value>;
2728
- /** スキーマ変更時のコールバック */
2729
- onSchemaChange: (newSchema: FormSchema) => void;
2730
- /** 入力データ変更時のコールバック */
2731
- onValuesChange: (newValues: Record<string, Value>) => void;
2732
- /** グリッドサイズ (LayoutPanelで使用) */
2733
- gridSize?: {
2734
- cols: number;
2735
- rows: number;
2736
- };
2737
- /** カスタムクラス名 */
2738
- className?: string;
2739
- }
2740
-
2741
- export declare const SIZE_UNITS: readonly ["mm", "cm", "inch", "pt", "px", "%"];
2742
-
2743
- /**
2744
- * SizeSchema の実体定義
2745
- */
2746
- export declare const sizeDefinition: PluginProperties<SizeSchema>;
2747
-
2748
- /**
2749
- * サイズプロパティのスキーマ
2750
- */
2751
- export declare interface SizeSchema {
2752
- width?: Dimension<SizeUnit>;
2753
- height?: Dimension<SizeUnit>;
2754
- }
2755
-
2756
- export declare type SizeUnit = (typeof SIZE_UNITS)[number];
2757
-
2758
- export declare function stringsToDimensions<U extends Unit>(strs: string[], allowedUnits: readonly U[]): Dimension<U>[];
2759
-
2760
- export declare function stringToDimension<U extends Unit>(str: string, allowedUnits: readonly U[]): Dimension<U>;
2761
-
2762
- /**
2763
- * TabPanel
2764
- * タブコンテンツの共通ラッパー
2765
- */
2766
- export declare const TabPanel: ({ children, emptyMessage, className, }: TabPanelProps) => JSX.Element;
2767
-
2768
- export declare interface TabPanelProps {
2769
- /** パネルの内容 */
2770
- children: ReactNode;
2771
- /** 空状態のメッセージ(childrenがない場合に表示) */
2772
- emptyMessage?: string;
2773
- /** カスタムクラス名 */
2774
- className?: string;
2775
- }
2776
-
2777
- export declare const Tabs: default_2.FC<TabsProps>;
2778
-
2779
- export declare const TabsContent: default_2.FC<TabsContentProps>;
2780
-
2781
- export declare interface TabsContentProps {
2782
- value: string;
2783
- children: default_2.ReactNode;
2784
- className?: string;
2785
- }
2786
-
2787
- export declare const TabsList: default_2.FC<TabsListProps>;
2788
-
2789
- export declare interface TabsListProps {
2790
- children: default_2.ReactNode;
2791
- className?: string;
2792
- width?: number;
2793
- height?: number;
2794
- style?: default_2.CSSProperties;
2795
- }
2796
-
2797
- export declare interface TabsProps {
2798
- defaultValue: string;
2799
- value?: string;
2800
- onValueChange?: (value: string) => void;
2801
- children: default_2.ReactNode;
2802
- variant?: "default" | "segmented";
2803
- className?: string;
2804
- }
2805
-
2806
- export declare const TabsTrigger: default_2.FC<TabsTriggerProps>;
2807
-
2808
- export declare interface TabsTriggerProps {
2809
- value: string;
2810
- children: default_2.ReactNode;
2811
- className?: string;
2812
- disabled?: boolean;
2813
- width?: number;
2814
- height?: number;
2815
- style?: default_2.CSSProperties;
2816
- }
2817
-
2818
- /**
2819
- * テキスト入力コンポーネント
2820
- */
2821
- export declare const TextInput: {
2822
- ({ value, onChange, readOnly, placeholder: propPlaceholder, maxLength: propMaxLength, multiline: propMultiline, rows: propRows, width, height, config, onBlur, }: TextInputProps): default_2.ReactElement;
2823
- displayName: string;
2824
- };
2825
-
2826
- /**
2827
- * Config型定義
2828
- * Record<string, Value> との互換性を持たせる
2829
- */
2830
- export declare interface TextInputConfig {
2831
- placeholder?: string;
2832
- maxLength?: number;
2833
- multiline?: boolean;
2834
- rows?: number;
2835
- width?: number;
2836
- height?: number;
2837
- [key: string]: Value;
2838
- }
2839
-
2840
- /**
2841
- * TextInput固有のProps
2842
- * T は string | undefined
2843
- */
2844
- export declare interface TextInputProps extends PropertyComponentProps<string | undefined> {
2845
- placeholder?: string;
2846
- maxLength?: number;
2847
- multiline?: boolean;
2848
- rows?: number;
2849
- width?: number;
2850
- height?: number;
2851
- config?: TextInputConfig;
2852
- onBlur?: () => void;
2853
- }
2854
-
2855
- /**
2856
- * RGBA オブジェクトを Hex 文字列に変換
2857
- * @param rgba RGBA オブジェクト
2858
- * @returns #RRGGBB または #RRGGBBAA 形式の文字列、透明の場合は undefined
2859
- */
2860
- export declare function toHex(rgba: RGBA): string | undefined;
2861
-
2862
- export declare const toMm: {
2863
- fromCm(cm: number): number;
2864
- fromInch(inch: number): number;
2865
- fromPt(pt: number): number;
2866
- fromPx(px: number): number;
2867
- fromDim<U extends Unit>(dim: Dimension<U>): number;
2868
- };
2869
-
2870
- export declare const toPx: {
2871
- _assertDpi(dpi: number): void;
2872
- fromMm(mm: number, dpi?: number): number;
2873
- fromCm(cm: number, dpi?: number): number;
2874
- fromInch(inch: number, dpi?: number): number;
2875
- fromPt(pt: number, dpi?: number): number;
2876
- fromPx(px: number, dpi?: number): number;
2877
- fromDim<U extends Unit>(dim: Dimension<U>, dpi?: number, baseSizePx?: number): number;
2878
- };
2879
-
2880
- /**
2881
- * RGBA オブジェクトを rgba() 文字列に変換
2882
- * @param rgba RGBA オブジェクト
2883
- * @returns rgba(r, g, b, a) 形式の文字列、透明の場合は undefined
2884
- */
2885
- export declare function toRgbaString(rgba: RGBA): string | undefined;
2886
-
2887
- export declare type Unit = (typeof ALL_UNITS)[number];
2888
-
2889
- /**
2890
- * ほぼすべてのブロックで使用される共通プロパティ定義
2891
- *
2892
- * ## 使用方法
2893
- * ```typescript
2894
- * export const MyPlugin: BlockPlugin = {
2895
- * properties: {
2896
- * ...universalProperties, // フラットに展開
2897
- * // プラグイン固有のプロパティ
2898
- * customProp: { ... },
2899
- * },
2900
- * };
2901
- * ```
2902
- *
2903
- * ## 上書き
2904
- * 個別のプロパティを上書きする場合は、後から定義します:
2905
- * ```typescript
2906
- * properties: {
2907
- * ...universalProperties,
2908
- * justifyContent: {
2909
- * ...universalProperties.justifyContent,
2910
- * defaultValue: HorizontalAlign.center, // デフォルト値を変更
2911
- * },
2912
- * }
2913
- * ```
2914
- *
2915
- * ## 含まれるプロパティ
2916
- * - **alignment** (justifyContent, alignItems): コンテンツの配置
2917
- * - **padding** (isIndividual, all, top, right, bottom, left): 余白
2918
- */
2919
- export declare const universalProperties: {
2920
- readonly isIndividual: PropertyConfig<boolean | undefined, PaddingSchema>;
2921
- readonly all: PropertyConfig<Dimension<"mm" | "pt" | "px" | "%"> | undefined, PaddingSchema>;
2922
- readonly top: PropertyConfig<Dimension<"mm" | "pt" | "px" | "%"> | undefined, PaddingSchema>;
2923
- readonly right: PropertyConfig<Dimension<"mm" | "pt" | "px" | "%"> | undefined, PaddingSchema>;
2924
- readonly bottom: PropertyConfig<Dimension<"mm" | "pt" | "px" | "%"> | undefined, PaddingSchema>;
2925
- readonly left: PropertyConfig<Dimension<"mm" | "pt" | "px" | "%"> | undefined, PaddingSchema>;
2926
- readonly justifyContent: PropertyConfig<HorizontalAlign | undefined, AlignmentSchema>;
2927
- readonly alignItems: PropertyConfig<VerticalAlign | undefined, AlignmentSchema>;
2928
- };
2929
-
2930
- export declare function useGridCalc(paper: Paper, grid: Grid, dpi?: number): {
2931
- paperPx: PaperPx;
2932
- gridPosPx: GridPosPx;
2933
- getColIndex: (px: number) => number;
2934
- getRowIndex: (px: number) => number;
2935
- getBlockRectPx: (block: Block) => BlockRectPx;
2936
- };
2937
-
2938
- /**
2939
- * インタラクション状態管理Hook
2940
- *
2941
- * @remarks
2942
- * Reducer的なロジックを内包、外部からはシンプルなAPIのみ公開
2943
- *
2944
- * **核心機能**: グリッド変化判定によるドラッグ確定
2945
- * - `mode: 'pressing'` でグリッドをまたいだら → `mode: 'dragging'` に遷移
2946
- * - ピクセル閾値 (5px) は使わない
2947
- *
2948
- * **選択状態**: 外部で管理されるため、このHookでは管理しません
2949
- * - `SELECT/DESELECT`イベントは外部への通知として残されています
2950
- *
2951
- * @param initialState - 初期状態 (オプション)
2952
- * @returns [state, handleChange] - 状態とコールバック
2953
- *
2954
- * @example
2955
- * ```tsx
2956
- * const [state, onChange] = useInteractionState();
2957
- *
2958
- * // ドラッグ開始 (まだpressing)
2959
- * onChange({ type: InteractionEventType.START_PRESS, blockId: 'block-1', startGrid: { col: 0, row: 0 } });
2960
- *
2961
- * // グリッドをまたぐ (自動的にdraggingへ遷移)
2962
- * onChange({ type: InteractionEventType.UPDATE_DRAG, currentGrid: { col: 1, row: 0 } });
2963
- * ```
2964
- */
2965
- export declare function useInteractionState(initialState?: Partial<InteractionState>): readonly [InteractionState, (event: InteractionChangeEvent) => void];
2966
-
2967
- /**
2968
- * 未知の値がFormSchemaかどうかをバリデーションし、型安全に変換
2969
- *
2970
- * @param value - バリデーションする値
2971
- * @returns FormSchema (バリデーション済み)
2972
- * @throws バリデーションエラー時にエラーをスロー
2973
- *
2974
- * @example
2975
- * ```ts
2976
- * const unknownData = JSON.parse(jsonString);
2977
- * const schema = validateSchema(unknownData);
2978
- * ```
2979
- */
2980
- export declare function validateSchema(value: unknown): FormSchema;
2981
-
2982
- /**
2983
- * 未知の値がRecord<string, Value>かどうかをバリデーションし、型安全に変換
2984
- *
2985
- * @param value - バリデーションする値
2986
- * @returns Record<string, Value> (バリデーション済み)
2987
- * @throws バリデーションエラー時にエラーをスロー
2988
- *
2989
- * @example
2990
- * ```ts
2991
- * const unknownData = JSON.parse(jsonString);
2992
- * const values = validateValues(unknownData);
2993
- * ```
2994
- */
2995
- export declare function validateValues(value: unknown): Record<string, Value>;
2996
-
2997
- /**
2998
- * ValidationSchema の実体定義
2999
- */
3000
- export declare const validationDefinition: PluginProperties<ValidationSchema>;
3001
-
3002
- /**
3003
- * バリデーションエラー情報
3004
- */
3005
- export declare interface ValidationError {
3006
- message: string;
3007
- code: string;
3008
- field?: string;
3009
- severity: ValidationSeverity;
3010
- metadata?: Record<string, Value>;
3011
- }
3012
-
3013
- /**
3014
- * バリデーション結果
3015
- */
3016
- export declare interface ValidationResult {
3017
- valid: boolean;
3018
- errors: ValidationError[];
3019
- }
3020
-
3021
- /**
3022
- * バリデーションプロパティのスキーマ
3023
- */
3024
- export declare interface ValidationSchema {
3025
- required?: boolean;
3026
- minLength?: number;
3027
- maxLength?: number;
3028
- pattern?: string;
3029
- }
3030
-
3031
- /**
3032
- * エラーの重大度レベル
3033
- */
3034
- export declare enum ValidationSeverity {
3035
- ERROR = "error",
3036
- WARNING = "warning",
3037
- INFO = "info"
3038
- }
3039
-
3040
- export declare type Value = string | number | boolean | null | undefined | Date | File | Blob | Value[] | readonly Value[] | {
3041
- [key: string]: Value;
3042
- };
3043
-
3044
- export declare enum VerticalAlign {
3045
- top = "flex-start",
3046
- center = "center",
3047
- bottom = "flex-end"
3048
- }
3049
-
3050
- /**
3051
- * Z-INDEX定数
3052
- *
3053
- * 各レイヤーのz-index範囲を定義
3054
- */
3055
- export declare const Z_INDEX: {
3056
- /** グリッド背景(用紙背景) */
3057
- readonly GRID_CANVAS: 10;
3058
- /** 用紙マージン表示(印刷可能範囲) */
3059
- readonly MARGIN_OVERLAY: 20;
3060
- /** グリッド線 */
3061
- readonly GRID_OVERLAY: 30;
3062
- /** 印刷可能領域の境界線 */
3063
- readonly BORDER_OVERLAY: 40;
3064
- /** BlockLayerの最小z-index */
3065
- readonly BLOCK_LAYER_MIN: 100;
3066
- /** BlockLayerの最大z-index */
3067
- readonly BLOCK_LAYER_MAX: 999999;
3068
- /** ブロック間のz-indexステップ(各ブロックは100段階のサブレイヤーを持っている) */
3069
- readonly BLOCK_LAYER_STEP: 100;
3070
- /** エラー枠線 */
3071
- readonly ERROR_BORDER: 1100000;
3072
- /** エラーツールチップ */
3073
- readonly ERROR_TOOLTIP: 1200000;
3074
- /** エラー背景ハイライト */
3075
- readonly ERROR_HIGHLIGHT: 1300000;
3076
- /** 選択中ブロック */
3077
- readonly SELECT_BLOCK: 2000000;
3078
- readonly INTERACTION_LAYER_BASE: 2100000;
3079
- /** ドラッグ中ゴースト */
3080
- readonly BLOCK_GHOST: 2200000;
3081
- /** ホバー枠線 */
3082
- readonly HOVER_OUTLINE: 2300000;
3083
- /** ブロック編集中 */
3084
- readonly EDIT_BLOCK: 2400000;
3085
- /** 選択中ブロック枠線 */
3086
- readonly BLOCK_SELECT_BORDER: 2500000;
3087
- /** ブロックリサイズハンドル */
3088
- readonly BLOCK_HANDLES: 2600000;
3089
- /** グリッドリサイズ中のゴースト線 */
3090
- readonly GRID_GHOST: 2700000;
3091
- /** グリッドリサイズハンドル */
3092
- readonly GRID_HANDLES: 2800000;
3093
- /** 範囲選択矩形 */
3094
- readonly RUBBER_BAND: 2900000;
3095
- /** プロパティパネル(サイドバー) */
3096
- readonly PROPERTY_PANEL: 3100000;
3097
- /** ブロック追加パレット */
3098
- readonly PALETTE: 3200000;
3099
- /** ツールチップ */
3100
- readonly TOOLTIP: 3300000;
3101
- /** ドロップダウン */
3102
- readonly DROPDOWN: 3400000;
3103
- /** コンテキストメニュー */
3104
- readonly CONTEXT_MENU: 3500000;
3105
- /** モーダル */
3106
- readonly MODAL: 3600000;
3107
- /** デバッグ表示 */
3108
- readonly DEBUG: 10000000;
3109
- };
3110
-
3111
- /**
3112
- * Z_INDEX型(型安全性のため)
3113
- */
3114
- export declare type ZIndexValue = (typeof Z_INDEX)[keyof typeof Z_INDEX];
3115
-
3116
- export { }
701
+ /** アクション実行時のフィードバック */
702
+ onActionFeedback?: (feedback: ActionFeedback) => void;
703
+ }
704
+
705
+ /**
706
+ * JSON 文字列をパース・検証して {@link Book} を返す。
707
+ *
708
+ * @throws {@link SyntaxError} JSON が無効な場合
709
+ * @throws {@link Error} Book の構造が不正な場合
710
+ */
711
+ export declare function deserializeBook(json: string): Book;
712
+
713
+ /**
714
+ * JSON 文字列をパース・検証して {@link Page} を返す。
715
+ *
716
+ * @throws {@link SyntaxError} JSON が無効な場合
717
+ * @throws {@link Error} ページの構造が不正な場合
718
+ */
719
+ export declare function deserializePage(json: string): Page;
720
+
721
+ /**
722
+ * JSON 文字列をパース・検証して `Record<string, Value>` を返す。
723
+ *
724
+ * @throws {@link SyntaxError} JSON が無効な場合
725
+ * @throws {@link Error} 値が無効な {@link Value} を含む場合
726
+ */
727
+ export declare function deserializeValues(json: string): Record<string, Value>;
728
+
729
+ /**
730
+ * 数値と単位の組み合わせ。
731
+ */
732
+ export declare interface Dimension<U extends Unit = Unit> {
733
+ /** 数値 */
734
+ value: number;
735
+ /** 単位 */
736
+ unit: U;
737
+ }
738
+
739
+ /**
740
+ * フルエディター用の UI 状態。
741
+ *
742
+ * @remarks
743
+ * - `useNoteContext` が内部で生成し、`NoteContext` に格納する。
744
+ * - `Default*` コンポーネントと `getDefault*` ヘルパー関数はこの状態を参照する。
745
+ */
746
+ export declare interface EditorState {
747
+ /** 選択中のブロック ID 一覧 */
748
+ selectedBlockIds: string[];
749
+ /** 表示中のページインデックス */
750
+ pageIdx: number;
751
+ }
752
+
753
+ /**
754
+ * `id` を持たないページに一意 ID を付与した新しい Book を返す。
755
+ *
756
+ * 保存済み Book の migration に使用する。既に `id` があるページは変更しない。
757
+ */
758
+ export declare function ensurePageIds(book: Book): Book;
759
+
760
+ /**
761
+ * キャンバス上にフローティング表示するウィジェットコンポーネント。
762
+ *
763
+ * タイトルバーをドラッグで移動、右下コーナードラッグでズーム(拡縮)できる。
764
+ *
765
+ * `bindingContext` を省略した場合は `widget.book` をローカル state で管理する。
766
+ */
767
+ export declare function FloatingWidget({ label, widget, extraPlugins, position, isDragging, onTitlePointerDown, onClose, onContainerPointerDown, style, context, }: FloatingWidgetProps): JSX.Element;
768
+
769
+ /**
770
+ * `FloatingWidget` コンポーネントへの props。
771
+ */
772
+ export declare interface FloatingWidgetProps {
773
+ /** タイトルバーに表示するラベル */
774
+ label: string;
775
+ /** 表示するウィジェット(必要なプラグインを内包した {@link WidgetDef}) */
776
+ widget: WidgetDef;
777
+ /** `widget.plugins` に追加で使用するプラグイン(省略可) */
778
+ extraPlugins?: WidgetDef["plugins"];
779
+ /** フローティング位置(position: fixed の left / top) */
780
+ position: {
781
+ x: number;
782
+ y: number;
783
+ };
784
+ /** `useNoteContext` が返すコンテキスト */
785
+ context: NoteContext;
786
+ /** ドラッグ中かどうか(影の強弱・pointer-events の制御に使用) */
787
+ isDragging: boolean;
788
+ /** タイトルバー(ドラッグハンドル)の pointerdown ハンドラ */
789
+ onTitlePointerDown: default_2.PointerEventHandler<HTMLDivElement>;
790
+ /** ✕ボタンが押されたときのコールバック */
791
+ onClose: () => void;
792
+ /** コンテナ全体の pointerdown ハンドラ(省略可) */
793
+ onContainerPointerDown?: () => void;
794
+ /**
795
+ * コンテナの style を上書きする(position, z-index などを変更したい場合に使用)。
796
+ *
797
+ * デフォルト: `position: "fixed"`, z-index: isDragging ? 3750000 : 3700000
798
+ */
799
+ style?: default_2.CSSProperties;
800
+ }
801
+
802
+ /**
803
+ * フォントサイズに使用できる単位の配列。
804
+ */
805
+ declare const FONT_UNITS: readonly ["pt", "px", "mm"];
806
+
807
+ /**
808
+ * ブロック内のフォントスタイルを保持する Props。
809
+ */
810
+ declare interface FontStyleProps {
811
+ /** フォントファミリー */
812
+ fontFamily?: string;
813
+ /** フォントサイズ */
814
+ fontSize?: Dimension<FontUnit>;
815
+ /** 文字色(CSS カラー値) */
816
+ color?: string;
817
+ /** `true` のとき太字 */
818
+ fontWeight?: boolean;
819
+ /** `true` のときイタリック */
820
+ italic?: boolean;
821
+ /** `true` のとき下線 */
822
+ underline?: boolean;
823
+ /** `true` のとき取り消し線 */
824
+ lineThrough?: boolean;
825
+ }
826
+
827
+ /**
828
+ * フォントサイズに使用できる単位。
829
+ */
830
+ declare type FontUnit = (typeof FONT_UNITS)[number];
831
+
832
+ /**
833
+ * `ActionBar` に渡すデフォルト `sections` 配列を返す。
834
+ *
835
+ * @remarks
836
+ * 各要素には `key` が付いているため `filter`/`map` で操作できる。
837
+ *
838
+ * パフォーマンスを要する場合は呼び出し側で `useMemo` を使うこと。
839
+ *
840
+ * @example
841
+ * ```tsx
842
+ * // デフォルトをそのまま使う
843
+ * const sections = useMemo(
844
+ * () => getDefaultActionBarSections({ context }),
845
+ * [context],
846
+ * );
847
+ * <ActionBar sections={sections} />
848
+ *
849
+ * // カスタムセクションを末尾に追加
850
+ * <ActionBar sections={[...sections, <MySection key="custom" />]} />
851
+ * ```
852
+ */
853
+ export declare function getDefaultActionBarSections({ context, onActionFeedback, onPrint, }: GetDefaultActionBarSectionsOptions): ReactNode[];
854
+
855
+ /**
856
+ * `getDefaultActionBarSections` のオプション。
857
+ *
858
+ * @remarks
859
+ * `getDefaultActionBarSections` に渡す引数の型。
860
+ */
861
+ export declare interface GetDefaultActionBarSectionsOptions {
862
+ /** `useNoteContext` が返すコンテキスト */
863
+ context: NoteContext;
864
+ /** アクション実行時のフィードバック(トースト表示など) */
865
+ onActionFeedback?: (feedback: ActionFeedback) => void;
866
+ /**
867
+ * 印刷ボタン押下時のコールバック。
868
+ * 省略時は `printNote(context)` を呼び出してNote内容のみを印刷する。
869
+ * PDF生成など独自の印刷処理を行う場合に上書きする。
870
+ */
871
+ onPrint?: () => void;
872
+ }
873
+
874
+ /**
875
+ * `Sidebar` に渡すデフォルト tabs 配列(ブロック / キャンバス / その他)を返す。
876
+ *
877
+ * @remarks
878
+ * パフォーマンスを要する場合は呼び出し側で `useMemo` を使うこと。
879
+ *
880
+ * @example
881
+ * ```tsx
882
+ * // デフォルトをそのまま使う
883
+ * const tabs = useMemo(
884
+ * () => getDefaultSidebarTabs({ context }),
885
+ * [context],
886
+ * );
887
+ * <Sidebar tabs={tabs} />
888
+ *
889
+ * // カスタムタブを末尾に追加
890
+ * <Sidebar tabs={[...tabs, { value: "custom", label: "カスタム", content: <MyPanel /> }]} />
891
+ *
892
+ * // 特定タブを除外
893
+ * <Sidebar tabs={tabs.filter((t) => t.value !== "other")} />
894
+ * ```
895
+ */
896
+ export declare function getDefaultSidebarTabs({ context, gridSize, onBlockHover, onBlockDragChange, onActionFeedback, }: GetDefaultSidebarTabsOptions): SidebarTab[];
897
+
898
+ /**
899
+ * `getDefaultSidebarTabs` のオプション。
900
+ *
901
+ * @remarks
902
+ * `getDefaultSidebarTabs` に渡す引数の型。
903
+ */
904
+ export declare interface GetDefaultSidebarTabsOptions {
905
+ /** `useNoteContext` が返すコンテキスト */
906
+ context: NoteContext;
907
+ /** グリッドサイズ(LayoutPanel で使用) */
908
+ gridSize?: {
909
+ cols: number;
910
+ rows: number;
911
+ };
912
+ /** ホバー中のブロック ID 通知 */
913
+ onBlockHover?: (id: string | null) => void;
914
+ /** ドラッグ中のブロック ID 通知 */
915
+ onBlockDragChange?: (id: string | null) => void;
916
+ /** アクション実行時のフィードバック */
917
+ onActionFeedback?: (feedback: ActionFeedback) => void;
918
+ }
919
+
920
+ /**
921
+ * ページのグリッド定義。
922
+ *
923
+ * @remarks
924
+ * `cols` / `rows` を省略した列/行は全て 1fr 等分割として扱われる。
925
+ */
926
+ export declare interface Grid {
927
+ /** 列数 */
928
+ colCount: number;
929
+ /** 行数 */
930
+ rowCount: number;
931
+ /** 列のサイズ定義マップ(インデックス → Dimension)。省略時は全列 1fr。 */
932
+ cols?: Record<number, Dimension<GridUnit>>;
933
+ /** 行のサイズ定義マップ(インデックス → Dimension)。省略時は全行 1fr。 */
934
+ rows?: Record<number, Dimension<GridUnit>>;
935
+ }
936
+
937
+ /**
938
+ * グリッドの列・行サイズに使用できる単位の配列。
939
+ */
940
+ declare const GRID_UNITS: readonly ["mm", "cm", "fr", "inch", "pt", "px"];
941
+
942
+ /**
943
+ * グリッド設定 compound widget。
944
+ *
945
+ * @remarks
946
+ * カスタムシェル構築専用。
947
+ *
948
+ * gridRowCountWidget(行数)と gridColCountWidget(列数)を横並びにした
949
+ *
950
+ * 1 × 6 列構成。
951
+ *
952
+ * 列構成:
953
+ * - 列 0 (1fr): 行数ラベル
954
+ * - 列 1 (1fr): 行数 numberInput → `grid.rowCount`
955
+ * - 2 (8mm): 行数 stepper → `grid.rowCount`
956
+ * - 列 3 (1fr): 列数ラベル
957
+ * - 列 4 (1fr): 列数 numberInput → `grid.colCount`
958
+ * - 列 5 (8mm): 列数 stepper `grid.colCount`
959
+ */
960
+ export declare const gridSettingsWidget: WidgetDef;
961
+
962
+ /**
963
+ * グリッドの列・行サイズに使用できる単位(`fr` を含む)。
964
+ */
965
+ export declare type GridUnit = (typeof GRID_UNITS)[number];
966
+
967
+ /**
968
+ * ブロックの表示/非表示を binding 値で制御する条件式。
969
+ *
970
+ * - `string` 指定パスの値が truthy のとき非表示
971
+ *
972
+ * - `{ path, eq }` — 指定パスの値が `eq` と等しいとき非表示
973
+ *
974
+ * - `{ path, neq }` — 指定パスの値が `neq` と等しくないとき非表示
975
+ *
976
+ * `eq` / `neq` は `===` による参照比較を行うため、オブジェクト・配列を指定しても期待通りに動作しない。
977
+ *
978
+ * そのため `Value` からオブジェクト・配列変形を除いた `Exclude<Value, Value[] | readonly Value[] | { [key: string]: Value }>` に制限している。
979
+ */
980
+ declare type HiddenBinding = string | {
981
+ path: string;
982
+ /**
983
+ * `===` で比較するためプリミティブ値のみ有効。
984
+ *
985
+ * `Value` からオブジェクト・配列を除いた型。
986
+ */
987
+ eq: Exclude<Value, Value[] | readonly Value[] | {
988
+ [key: string]: Value;
989
+ }>;
990
+ /** `eq` と同時指定不可 */
991
+ neq?: never;
992
+ } | {
993
+ path: string;
994
+ /**
995
+ * `===` で比較するためプリミティブ値のみ有効。
996
+ *
997
+ * `Value` からオブジェクト・配列を除いた型。
998
+ */
999
+ neq: Exclude<Value, Value[] | readonly Value[] | {
1000
+ [key: string]: Value;
1001
+ }>;
1002
+ /** `neq` と同時指定不可 */
1003
+ eq?: never;
1004
+ };
1005
+
1006
+ /**
1007
+ * デフォルトの履歴操作ボタン widget。
1008
+ *
1009
+ * @remarks
1010
+ * カスタムシェル構築専用。
1011
+ *
1012
+ * `createHistoryWidget()` と等価。
1013
+ */
1014
+ export declare const historyWidget: WidgetDef;
1015
+
1016
+ /**
1017
+ * ブロック内の水平配置。
1018
+ */
1019
+ declare enum HorizontalAlign {
1020
+ left = "left",
1021
+ center = "center",
1022
+ right = "right"
1023
+ }
1024
+
1025
+ /**
1026
+ * テキスト入力の HTML `input[type]` 属性値。バリデーション・キーボードの振る舞いに影響する。
1027
+ */
1028
+ declare enum InputType {
1029
+ text = "text",
1030
+ number = "number",
1031
+ email = "email",
1032
+ tel = "tel",
1033
+ url = "url",
1034
+ date = "date",
1035
+ password = "password"
1036
+ }
1037
+
1038
+ /**
1039
+ * `afterIdx` の直後に新しいページを挿入した新しい Book を返す。
1040
+ */
1041
+ export declare function insertPage(book: Book, afterIdx: number, page: Page): Book;
1042
+
1043
+ /**
1044
+ * Book 形式かどうかを判定する(`pages` がトップレベル)。
1045
+ */
1046
+ export declare function isBook(data: unknown): boolean;
1047
+
1048
+ /**
1049
+ * FormSchema 形式かどうかを判定する(`grid` + `blocks` がトップレベル、`pages` なし)。
1050
+ */
1051
+ export declare function isLegacyFormSchema(data: unknown): boolean;
1052
+
1053
+ /**
1054
+ * 線のスタイル定義(色・幅・種別)。
1055
+ */
1056
+ export declare interface LineStyle {
1057
+ /** CSS カラー値 */
1058
+ color: string;
1059
+ /** 線の幅 */
1060
+ width: Dimension<BorderUnit>;
1061
+ /** 線の種別 */
1062
+ type: LineType;
1063
+ }
1064
+
1065
+ /**
1066
+ * 枠線・区切り線に適用するスタイル種別。
1067
+ */
1068
+ export declare enum LineType {
1069
+ /** 実線 */
1070
+ SOLID = "solid",
1071
+ /** 破線 */
1072
+ DASHED = "dashed",
1073
+ /** 点線 */
1074
+ DOTTED = "dotted"
1075
+ }
1076
+
1077
+ /**
1078
+ * 入力データの形式を自動判定し、適切な移行を実行する。
1079
+ *
1080
+ * - 旧 FormSchema(`grid` + `blocks` がトップレベル) → Book へ構造変換
1081
+ * - Book(`pages` がトップレベル) → 各ページのデータを移行
1082
+ *
1083
+ * @throws {@link Error} 入力データがいずれの形式にも該当しない場合
1084
+ */
1085
+ export declare function migrate(data: unknown, registry?: MigrationPluginRegistry): Book;
1086
+
1087
+ /**
1088
+ * Book の全ページをデータ移行する(形式 B)。
1089
+ *
1090
+ * @throws {@link Error} `notebook` がオブジェクトでない場合
1091
+ */
1092
+ export declare function migrateBook(notebook: unknown, registry?: MigrationPluginRegistry): Book;
1093
+
1094
+ /**
1095
+ * 旧 FormSchema を Book 形式に構造変換する(形式 A)。
1096
+ *
1097
+ * @throws {@link Error} `schema` がオブジェクトでない場合
1098
+ */
1099
+ export declare function migrateFormSchemaToBook(schema: unknown, registry?: MigrationPluginRegistry): Book;
1100
+
1101
+ /**
1102
+ * マイグレーション用のプラグインレジストリ型。
1103
+ *
1104
+ * 各プラグインは `migrateProps` を任意に実装でき、旧プロパティ形式を現形式に変換する契約を持つ。
1105
+ */
1106
+ export declare type MigrationPluginRegistry = Record<string, {
1107
+ migrateProps?: (props: unknown) => Record<string, unknown>;
1108
+ }>;
1109
+
1110
+ /**
1111
+ * ページの順序を変えた新しい Book を返す。
1112
+ *
1113
+ * `from === to` の場合は no-op。
1114
+ */
1115
+ export declare function movePage(book: Book, from: number, to: number): Book;
1116
+
1117
+ /**
1118
+ * `mode` prop で FORM / EDIT / VIEW を切り替えられる統一 Note コンポーネント。
1119
+ *
1120
+ * 内部で `NoteForm` / `NoteEdit` / `NoteView` への薄いラッパーとして機能する。
1121
+ * 印刷は `printNote(context)` で起動できる。
1122
+ */
1123
+ export declare function Note({ context, mode, className, style, showValidation, scale, }: NoteProps): JSX.Element;
1124
+
1125
+ /**
1126
+ * ノートブロックの props 型。Book を内包して入れ子グリッドを実現する。
1127
+ *
1128
+ * @remarks
1129
+ * **Canvas** — 入れ子グリッド構築向けの型。
1130
+ *
1131
+ * 一般的なフォーム構築では直接参照することは少ない。
1132
+ */
1133
+ declare interface NoteBlockProps extends BaseBlockProps {
1134
+ /** ネストして表示する内包 Book。 */
1135
+ book: Book;
1136
+ /** 内包 Book で表示するページインデックス。省略時は 0。 */
1137
+ pageIdx?: number;
1138
+ }
1139
+
1140
+ /**
1141
+ * `useNoteContext` が組み立てるコンテキストオブジェクト。
1142
+ *
1143
+ * Note / ActionBar / Sidebar / DefaultSelectionActionBarOverlay にそのまま渡して使用する。
1144
+ */
1145
+ export declare interface NoteContext {
1146
+ /** Book(用紙設定・ページを含む) */
1147
+ book: Book;
1148
+ /** Book 変更コールバック */
1149
+ onBookChange: OnBookChange;
1150
+ /** ブロックプラグインのレジストリ(`createPluginRegistry` で生成) */
1151
+ pluginRegistry: PluginRegistry;
1152
+ /** Note を包む `position: relative` なコンテナの ref */
1153
+ containerRef: RefObject<HTMLDivElement | null>;
1154
+ /** バインディングパス対応の値読み書きコンテキスト */
1155
+ bindingContext: BindingContext;
1156
+ /** ブロック挿入・移動・削除などのアクションハンドラコンテキスト */
1157
+ actionContext: ActionContext;
1158
+ /** 各ブロックの現在の入力値 */
1159
+ values: Record<string, Value>;
1160
+ /** 入力値が変更されたときのコールバック */
1161
+ onValuesChange?: OnValuesChange;
1162
+ /**
1163
+ * フルエディター用の UI 状態。
1164
+ * DefaultSelectionActionBarOverlay / getDefaultActionBarSections / getDefaultSidebarTabs
1165
+ * はこのフィールドを参照する。
1166
+ */
1167
+ editorState: EditorState;
1168
+ }
1169
+
1170
+ /**
1171
+ * 値入力モード(EDIT モード)専用コンポーネント。
1172
+ *
1173
+ * ブロックの配置・サイズ変更は不可。直接 value を編集できる。
1174
+ * `useNoteContext` で生成した `context` を渡して使用する。
1175
+ *
1176
+ * @remarks 通常は {@link Note} を `mode={NoteMode.EDIT}` で使用する。
1177
+ */
1178
+ export declare const NoteEdit: NamedExoticComponent<NoteEditProps>;
1179
+
1180
+ /**
1181
+ * {@link NoteEdit} の props。
1182
+ */
1183
+ export declare interface NoteEditProps {
1184
+ /** `useNoteContext` が返すコンテキスト。 */
1185
+ context: NoteContext;
1186
+ /** `true` のときバリデーションエラーを表示する(デフォルト: false)。 */
1187
+ showValidation?: boolean;
1188
+ /** 表示倍率(デフォルト: 1)。 */
1189
+ scale?: number;
1190
+ /** ルート要素に追加する className。 */
1191
+ className?: string;
1192
+ }
1193
+
1194
+ /**
1195
+ * テンプレート作成モード(FORM モード)専用コンポーネント。
1196
+ *
1197
+ * ブロックの配置・サイズ変更が可能。ダブルクリックで initValue を編集できる。
1198
+ * `useNoteContext` で生成した `context` を渡す。ActionBar / Sidebar と組み合わせて使用する。
1199
+ *
1200
+ * @remarks 通常は {@link Note} を `mode={NoteMode.FORM}` で使用する。
1201
+ */
1202
+ export declare const NoteForm: default_2.NamedExoticComponent<NoteFormProps>;
1203
+
1204
+ /**
1205
+ * {@link NoteForm} の props。
1206
+ *
1207
+ * テンプレートデザインモード専用。`context` は必須。
1208
+ * `useNoteContext` を使って context を生成し、ActionBar / Sidebar と共に使用する。
1209
+ */
1210
+ export declare interface NoteFormProps {
1211
+ /** `useNoteContext` が返すコンテキスト(必須)。 */
1212
+ context: NoteContext;
1213
+ /** 表示倍率(デフォルト: 1)。 */
1214
+ scale?: number;
1215
+ /** ルート要素に追加する className。 */
1216
+ className?: string;
1217
+ }
1218
+
1219
+ /**
1220
+ * Note の表示・編集モード。
1221
+ */
1222
+ export declare enum NoteMode {
1223
+ /**
1224
+ * ブロックの配置・サイズ変更、グリッド設定、`initValue`(初期値)の設定が可能。
1225
+ *
1226
+ * 入力コントロールは動作するが、値はセッション内のみ保持される(永続化されない)。
1227
+ */
1228
+ FORM = "Form",
1229
+ /**
1230
+ * ブロックの値を入力・編集できる。
1231
+ *
1232
+ * レイアウトや `initValue` は変更不可。
1233
+ */
1234
+ EDIT = "Edit",
1235
+ /**
1236
+ * すべて読み取り専用。入力コントロールは無効。
1237
+ *
1238
+ * `showValidation` によるバリデーション結果の表示が有効。
1239
+ */
1240
+ VIEW = "View"
1241
+ }
1242
+
1243
+ /**
1244
+ * `Note` コンポーネントの props。
1245
+ */
1246
+ export declare type NoteProps = NotePropsBase & {
1247
+ /** 表示モード。 */
1248
+ mode: NoteMode;
1249
+ };
1250
+
1251
+ /* Excluded from this release type: NotePropsBase */
1252
+
1253
+ /**
1254
+ * 閲覧モード(VIEW モード)専用コンポーネント。
1255
+ *
1256
+ * すべて読み取り専用。ブロックの配置変更・値の編集は不可。
1257
+ *
1258
+ * `context` は省略可能。省略した場合、`book` と `values` を渡すだけで静的表示できる。
1259
+ * `context` を渡した場合はバインディング・アクション・ページ選択が有効になる。
1260
+ *
1261
+ * @remarks 通常は {@link Note} を `mode={NoteMode.VIEW}` で使用する。
1262
+ */
1263
+ export declare const NoteView: NamedExoticComponent<NoteViewProps>;
1264
+
1265
+ /**
1266
+ * {@link NoteView} の props。`context` か `book` のどちらか一方が必須。
1267
+ */
1268
+ export declare type NoteViewProps = NoteViewPropsWithContext | NoteViewPropsWithBook;
1269
+
1270
+ /* Excluded from this release type: NoteViewPropsBase */
1271
+
1272
+ /* Excluded from this release type: NoteViewPropsWithBook */
1273
+
1274
+ /* Excluded from this release type: NoteViewPropsWithContext */
1275
+
1276
+ /**
1277
+ * Book 全体の変更通知(ブロック・グリッド・用紙変更を一本で扱う)。
1278
+ *
1279
+ * @remarks
1280
+ * `options.mergeKey` を指定すると、同一キーの連続変更が履歴上でマージされる。
1281
+ * `options.noTimeWindow` を `true` にすると 500ms の時間窓制限なしにマージされる(セッション型用)。
1282
+ * ドラッグ中の連続更新やパネルのキー入力など、Undo を細分化したくない場面で使用する。
1283
+ */
1284
+ declare type OnBookChange = (book: Book, options?: {
1285
+ mergeKey?: string;
1286
+ noTimeWindow?: boolean;
1287
+ }) => void;
1288
+
1289
+ /**
1290
+ * values の変更通知(EDIT モードでの入力値変更)。
1291
+ *
1292
+ * 差分リスト形式で渡される。1 ブロック編集 → 1 要素の配列。
1293
+ * `value` が `undefined` の場合はそのブロックの値を削除する。
1294
+ *
1295
+ * @example
1296
+ * ```tsx
1297
+ * onValuesChange={(changes) => {
1298
+ * setValues(prev => {
1299
+ * const next = { ...prev };
1300
+ * for (const { id, value } of changes) {
1301
+ * if (value === undefined) delete next[id];
1302
+ * else next[id] = value;
1303
+ * }
1304
+ * return next;
1305
+ * });
1306
+ * }}
1307
+ * ```
1308
+ */
1309
+ declare type OnValuesChange = (changes: ValueChange[]) => void;
1310
+
1311
+ /**
1312
+ * パディングに使用できる単位の配列。
1313
+ */
1314
+ declare const PADDING_UNITS: readonly ["mm", "pt", "px", "%"];
1315
+
1316
+ /**
1317
+ * ブロック内の上下左右の余白を保持する Props。
1318
+ */
1319
+ declare interface PaddingProps {
1320
+ top?: Dimension<PaddingUnit>;
1321
+ right?: Dimension<PaddingUnit>;
1322
+ bottom?: Dimension<PaddingUnit>;
1323
+ left?: Dimension<PaddingUnit>;
1324
+ /** 全辺一括モード。`true` のとき `all` が全辺に適用される */
1325
+ bulk?: boolean;
1326
+ /** 全辺共通パディング(`bulk: true` のとき有効) */
1327
+ all?: Dimension<PaddingUnit>;
1328
+ }
1329
+
1330
+ /**
1331
+ * パディングに使用できる単位(`%` を含む)。
1332
+ */
1333
+ declare type PaddingUnit = (typeof PADDING_UNITS)[number];
1334
+
1335
+ /**
1336
+ * 1ページ分のフォームスキーマ。
1337
+ */
1338
+ export declare interface Page {
1339
+ /** ページの一意 ID。保存済み Book に ID がない場合は {@link ensurePageIds} で付与できる */
1340
+ id?: string;
1341
+ /** グリッド設定(スパース形式)。全列・全行が 1fr の場合は colCount / rowCount のみ */
1342
+ grid: Grid;
1343
+ /** 配置されているブロック一覧 */
1344
+ blocks: Block[];
1345
+ /** ブロック種別ごとの共通デフォルト設定。値解決順序は `Block` @remarks を参照 */
1346
+ blockDefaults?: BlockDefaults;
1347
+ /** ページ固有のメタデータ(バージョン・タイトルなど) */
1348
+ metaData?: Record<string, Value>;
1349
+ }
1350
+
1351
+ /**
1352
+ * デフォルトのページナビゲーション widget(ページ数不明の初期状態)。
1353
+ *
1354
+ * @remarks
1355
+ * カスタムシェル構築専用。
1356
+ *
1357
+ * `createPageNavigationWidget({})` と等価。
1358
+ */
1359
+ export declare const pageNavigationWidget: WidgetDef;
1360
+
1361
+ /**
1362
+ * ページに適用する用紙設定(サイズ・マージン・向き)。
1363
+ */
1364
+ export declare interface Paper {
1365
+ /** 用紙サイズ */
1366
+ size: PaperSize;
1367
+ /** 用紙マージン */
1368
+ margin: PaperMargin;
1369
+ /** 用紙の向き。true = 横向き (landscape)、省略/false = 縦向き (portrait) */
1370
+ orientation?: boolean;
1371
+ /**
1372
+ * 幅自動リサイズ。
1373
+ *
1374
+ * `true` のとき、`widthFit` ブロックの実測幅に合わせてキャンバス幅を広げる。
1375
+ */
1376
+ autoWidth?: boolean;
1377
+ /**
1378
+ * 高さ自動リサイズ。
1379
+ *
1380
+ * `true` のとき、`heightFit` ブロックの実測高さに合わせてキャンバス高さを広げる。
1381
+ */
1382
+ autoHeight?: boolean;
1383
+ }
1384
+
1385
+ /**
1386
+ * 用紙サイズに使用できる単位の配列。
1387
+ */
1388
+ declare const PAPER_UNITS: readonly ["mm", "cm", "inch"];
1389
+
1390
+ /**
1391
+ * 用紙四辺のマージン設定。
1392
+ */
1393
+ export declare interface PaperMargin {
1394
+ top: Dimension<PaperUnit>;
1395
+ right: Dimension<PaperUnit>;
1396
+ bottom: Dimension<PaperUnit>;
1397
+ left: Dimension<PaperUnit>;
1398
+ /**
1399
+ * 一括編集フラグ。`true` のとき、`all` フィールドが四辺の共通値として使われる。
1400
+ *
1401
+ * Book に保存されるため、通常の binding パス `margin.bulk` で読み書きできる。
1402
+ */
1403
+ bulk?: boolean;
1404
+ /**
1405
+ * 一括モード時の四辺共通マージン値。`bulk` が `true` のときのみ描画・印刷に使用される。
1406
+ *
1407
+ * binding パス `margin.all.value` / `margin.all.unit` で読み書きできる。
1408
+ */
1409
+ all?: Dimension<PaperUnit>;
1410
+ }
1411
+
1412
+ /**
1413
+ * 用紙設定 compound widget。
1414
+ * @remarks
1415
+ * カスタムシェル構築専用。
1416
+ *
1417
+ * * 3 つの行 widget を NoteBlock として縦に並べた外偵コンテナ。
1418
+ *
1419
+ * - 0(常に表示): PRESET_ORIENTATION_ROW
1420
+ * - 行 1(常に表示): AUTO_RESIZE_ROW
1421
+ * - 行 2(Custom 選択時のみ): DIMENSION_ROW ← 末尾・hiddenBinding で縮小
1422
+ *
1423
+ * binding:
1424
+ * - `paper.size.preset` / `paper.orientation`
1425
+ * - `paper.autoWidth` / `paper.autoHeight`
1426
+ * - `paper.size.width.value` / `.unit` / `paper.size.height.value` / `.unit`
1427
+ */
1428
+ export declare const paperSettingsWidget: WidgetDef;
1429
+
1430
+ /**
1431
+ * 用紙サイズ設定。
1432
+ *
1433
+ * @remarks
1434
+ * `preset` が `CUSTOM` 以外の場合も `width` / `height` には実寸が格納される。
1435
+ */
1436
+ export declare interface PaperSize {
1437
+ /** 選択中のプリセット */
1438
+ preset: PaperSizePreset;
1439
+ /** 幅(物理単位)。`CUSTOM` 時はユーザー指定値。 */
1440
+ width: Dimension<PaperUnit>;
1441
+ /** 高さ(物理単位)。`CUSTOM` 時はユーザー指定値。 */
1442
+ height: Dimension<PaperUnit>;
1443
+ }
1444
+
1445
+ /**
1446
+ * 用紙サイズのプリセット種別。`CUSTOM` 選択時は `PaperSize.width` / `height` が有効になる。
1447
+ */
1448
+ export declare enum PaperSizePreset {
1449
+ A4 = "A4",
1450
+ B5 = "B5",
1451
+ A3 = "A3",
1452
+ LETTER = "Letter",
1453
+ LEGAL = "Legal",
1454
+ CUSTOM = "Custom"
1455
+ }
1456
+
1457
+ /**
1458
+ * 用紙サイズに使用できる単位。
1459
+ */
1460
+ export declare type PaperUnit = (typeof PAPER_UNITS)[number];
1461
+
1462
+ /**
1463
+ * 未検証の値を {@link Book} として検証する。
1464
+ *
1465
+ * @throws {@link Error} `pages` が存在しないまたは空、各ページの構造が不正、`paper` が存在しない場合
1466
+ */
1467
+ export declare function parseBook(value: unknown): Book;
1468
+
1469
+ /**
1470
+ * ブロックのプレースホルダーテキストを保持する Props。
1471
+ */
1472
+ declare interface PlaceholderProps {
1473
+ /** 未入力時に表示するプレースホルダー文字列 */
1474
+ placeholder?: string;
1475
+ }
1476
+
1477
+ /**
1478
+ * `createPluginRegistry` が返す、`block.kind` をキーにしたプラグインレジストリ。
1479
+ *
1480
+ * 未登録の `kind` は `undefined` になるため、アクセス前に存在確認が必要。
1481
+ */
1482
+ export declare type PluginRegistry = Record<string, ResolvedPlugin | undefined>;
1483
+
1484
+ /**
1485
+ * 印刷時の余白設定。各辺に CSS の長さ値(例: `"10mm"`)を指定する。
1486
+ * 省略した辺はブラウザのデフォルト余白が適用される。
1487
+ */
1488
+ export declare interface PrintMargin {
1489
+ top?: string;
1490
+ right?: string;
1491
+ bottom?: string;
1492
+ left?: string;
1493
+ }
1494
+
1495
+ /**
1496
+ * ブックの内容を印刷する。
1497
+ *
1498
+ * `useNoteContext` が返す `context` を渡すだけで、book・values・pluginRegistry を自動で解決して印刷する。
1499
+ *
1500
+ * @example
1501
+ * ```ts
1502
+ * // 印刷ボタンなどから直接呼ぶだけでよい
1503
+ * printNote(context);
1504
+ * ```
1505
+ */
1506
+ export declare function printNote(context: NoteContext, printSettings?: PrintSettings): void;
1507
+
1508
+ /**
1509
+ * 印刷ダイアログへ渡す設定。
1510
+ *
1511
+ * @remarks
1512
+ * - 省略したフィールドはブラウザのデフォルト値に従う。
1513
+ * - `paperSize` に `"Custom"` は指定不可(型レベルで `Exclude` により除外済み)。
1514
+ */
1515
+ export declare interface PrintSettings {
1516
+ /** 印刷する用紙サイズ。省略時は `book.paper.size` を使用。 */
1517
+ paperSize?: Exclude<PaperSizePreset, "Custom">;
1518
+ /** 用紙の向き。true = 横向き (landscape)。省略時は `book.paper.orientation` を使用。 */
1519
+ orientation?: boolean;
1520
+ /** 印刷余白。省略時はブラウザのデフォルト余白。 */
1521
+ margin?: PrintMargin;
1522
+ }
1523
+
1524
+ /**
1525
+ * coreのプロパティカタログに登録する1機能の定義。
1526
+ *
1527
+ * @remarks
1528
+ * `defaultProps` `createPluginRegistry` でプラグイン単位に合成され、実際のブロック描画時は `PropDef.defaultProps` → `page.blockDefaults[kind]` → `block.props` の順でマージされる。
1529
+ *
1530
+ * 後段の値ほど優先される。
1531
+ */
1532
+ declare interface PropDef {
1533
+ /** プロパティの種別 ID。`BlockPlugin.properties` 内で一意になるよう設定する */
1534
+ kind: string;
1535
+ /** このプロパティを持つブロック種別のデフォルト props */
1536
+ defaultProps: Record<string, Value>;
1537
+ /**
1538
+ * カスタム編集UIコンポーネント(省略時はPropertyFieldのビルトインUIにフォールバック)。
1539
+ *
1540
+ * 外部プラグインは独自のエディタUIをここに渡すことができる。 * * `PropertyComponentProps<Value>` を実装することで `readOnly` が正しく受け取れる。
1541
+ */
1542
+ component?: ComponentType<PropertyComponentProps<Value>>;
1543
+ }
1544
+
1545
+ /**
1546
+ * UI コンポーネント(Checkbox, NumberInput 等)の共通 Props 基底型。
1547
+ */
1548
+ declare interface PropertyComponentProps<T> {
1549
+ /** このコンポーネントが編集対象とする現在の値 */
1550
+ value: T;
1551
+ /** 値が変更されたときに呼ばれるコールバック */
1552
+ onChange: (value: T) => void;
1553
+ /**
1554
+ * `true` のとき、ユーザーによる値変更を禁止する。
1555
+ *
1556
+ * カスタムコンポーネントを実装する際は必ずこのフラグを参照してインタラクションを無効化すること。
1557
+ */
1558
+ readOnly?: boolean;
1559
+ }
1560
+
1561
+ /**
1562
+ * 指定インデックスのページを削除した新しい Book を返す。
1563
+ *
1564
+ * 1ページのみの場合は no-op。
1565
+ */
1566
+ export declare function removePage(book: Book, index: number): Book;
1567
+
1568
+ /**
1569
+ * Renderer コンポーネントが受け取る props。
1570
+ */
1571
+ declare interface RendererProps<P = Record<string, Value>, V = Value> {
1572
+ /** ブロック ID */
1573
+ id: string;
1574
+ /** ブロックのプロパティ(プラグイン固有型) */
1575
+ props: P;
1576
+ /** ブロックの値 */
1577
+ value: V;
1578
+ /** 値の変更通知コールバック */
1579
+ onChange: (value: V) => void;
1580
+ /** フォーカス離脱時の値確定通知コールバック(オプション) */
1581
+ onBlur?: (value: V) => void;
1582
+ /**
1583
+ * 読み取り専用フラグ。
1584
+ *
1585
+ * `BlockContainer` が以下のロジックで計算して渡す。
1586
+ *
1587
+ * - EDIT モード: `block.behavior?.readOnly ?? false`
1588
+ *
1589
+ * - FORM / VIEW モード: 常に `true`
1590
+ */
1591
+ readOnly: boolean;
1592
+ /** Note のモード(`EDIT` / `VIEW` / `FORM`) */
1593
+ mode: NoteMode;
1594
+ /** ブロックの描画領域(px)。未設定時は auto として扱う */
1595
+ dimensions?: {
1596
+ widthPx: number;
1597
+ heightPx: number;
1598
+ };
1599
+ /**
1600
+ * ブロック幅の実測値(px)を通知するコールバック。
1601
+ *
1602
+ * `block.behavior.widthFit === true` のブロックに限り `BlockContainer` から渡される。
1603
+ */
1604
+ onMeasureWidth?: (widthPx: number) => void;
1605
+ /**
1606
+ * ブロック高さの実測値(px)を通知するコールバック。
1607
+ *
1608
+ * `block.behavior.heightFit === true` のブロックに限り `BlockContainer` から渡される。
1609
+ */
1610
+ onMeasureHeight?: (heightPx: number) => void;
1611
+ /** `BindingContext`(値の読み書きパス解決)。必要なブロックのみ参照する */
1612
+ bindingContext?: BindingContext;
1613
+ /** `ActionContext`(undo/redo 等のアクション実行)。必要なブロックのみ参照する */
1614
+ actionContext?: ActionContext;
1615
+ /** アクセシビリティラベル。`BlockRenderer` `resolvedPlugin.meta.displayName` を自動セットする */
1616
+ ariaLabel?: string;
1617
+ }
1618
+
1619
+ /**
1620
+ * ブロックの必須入力設定を保持する Props。
1621
+ */
1622
+ declare interface RequiredProps {
1623
+ /** `true` のとき、値が空の場合にバリデーションエラーとなる */
1624
+ required?: boolean;
1625
+ }
1626
+
1627
+ /**
1628
+ * レジストリに登録された解決済みプラグイン。
1629
+ *
1630
+ * @remarks
1631
+ * BlockPlugin<P,V> のジェネリクスを型消去し、Shell/Canvas 層が any なしで扱えるフラットな構造にまとめたもの。
1632
+ *
1633
+ * Renderer の P/V variance 問題は BaseRenderer 型への単一キャストで解決。
1634
+ */
1635
+ declare interface ResolvedPlugin {
1636
+ /** `block.kind` と対応するプラグインの一意識別子 */
1637
+ kind: string;
1638
+ /** UI 表示・アイコン・デフォルトサイズ等のメタ情報 */
1639
+ meta: BlockPluginMeta;
1640
+ /** プロパティパネルに表示するプロパティ定義一覧 */
1641
+ properties: PropDef[];
1642
+ /** プラグインの全 `PropDef.defaultProps` を合成した、このブロック種別のデフォルト props */
1643
+ defaultProps: Record<string, Value>;
1644
+ /**
1645
+ * ブロックを描画する Renderer コンポーネント。
1646
+ *
1647
+ * BlockPlugin<P,V>.Renderer を格納する際、P/V の variance 問題を回避するためベース型にキャストしている。
1648
+ *
1649
+ * 実行時には block.props(解決済み)と value が渡されるため安全。
1650
+ */
1651
+ Renderer: BaseRenderer;
1652
+ /** 旧バージョンの props を現バージョンに変換する。`validateProps` の前に呼ばれる */
1653
+ migrateProps?: (props: unknown) => Record<string, unknown>;
1654
+ /**
1655
+ * ストレージから読み込んだ生の `block.props` をサニタイズして型安全な Props に変換する。
1656
+ *
1657
+ * 省略時は raw オブジェクトをそのまま使用する。
1658
+ */
1659
+ validateProps?: (props: unknown) => Record<string, Value>;
1660
+ /**
1661
+ * 外部 state から読み込んだ生の値をサニタイズする。
1662
+ *
1663
+ * `undefined` を返した場合は `block.initValue`、それもなければ raw 値にフォールバックする。
1664
+ *
1665
+ * フォールバックを指示する場合にのみ `undefined` を使い、`null` は正当な値として返せる。
1666
+ *
1667
+ * 省略時は raw 値をそのまま使用する。
1668
+ */
1669
+ validateValue?: (value: unknown, props: Record<string, Value>) => Value | undefined;
1670
+ }
1671
+
1672
+ /**
1673
+ * セレクトボックスブロックの props 型。
1674
+ */
1675
+ declare type SelectBlockProps = BaseBlockProps & FontStyleProps & PlaceholderProps & RequiredProps & SelectConfigProps;
1676
+
1677
+ /**
1678
+ * セレクトボックスブロックの値型。`null` は未選択状態を表す。
1679
+ */
1680
+ declare type SelectBlockValue = string | null;
1681
+
1682
+ /**
1683
+ * セレクトボックスの選択肢設定 props。
1684
+ */
1685
+ declare interface SelectConfigProps {
1686
+ /** 選択肢と機能設定。 */
1687
+ selectConfig: SelectOptionsConfig;
1688
+ }
1689
+
1690
+ /**
1691
+ * デフォルトの選択操作・削除ボタン widget。
1692
+ *
1693
+ * @remarks
1694
+ * カスタムシェル構築専用。
1695
+ *
1696
+ * `createSelectionDeleteWidget()` と等価。
1697
+ */
1698
+ export declare const selectionDeleteWidget: WidgetDef;
1699
+
1700
+ /**
1701
+ * セレクトボックスの個々の選択肢。
1702
+ */
1703
+ declare interface SelectOption {
1704
+ /** ユーザーに表示するラベル。 */
1705
+ label: string;
1706
+ /** 選択時にブロック値として記録される内部値。 */
1707
+ value: string;
1708
+ /** ラベルに適用する文字色(任意)。 */
1709
+ color?: string;
1710
+ }
1711
+
1712
+ /**
1713
+ * セレクトボックスの選択肢一覧と機能設定。
1714
+ */
1715
+ declare interface SelectOptionsConfig {
1716
+ /** 選択肢の配列。 */
1717
+ options: SelectOption[];
1718
+ /** `true` のとき空白選択(未選択)を許可する。 */
1719
+ allowEmpty?: boolean;
1720
+ }
1721
+
1722
+ /**
1723
+ * セレクトボックスブロックのプラグイン定義。
1724
+ *
1725
+ * `kind: "select"` で登録され、選択肢設定・必須入力・フォントなどの prop まとまりを提供する。
1726
+ */
1727
+ export declare const SelectPlugin: BlockPlugin<SelectBlockProps, SelectBlockValue>;
1728
+
1729
+ /**
1730
+ * JSON シリアライズ可能なプロパティのみを持つオブジェクト型の境界。
1731
+ *
1732
+ * `BlockPlugin<P>` / `Block<P>` の型引数制約として使用し、`P` に関数・クラスインスタンス・DOM 要素など非 serializable な型が混入した場合に型エラーとして検出する。
1733
+ *
1734
+ * オプショナルフィールド(`?`)は `undefined` を許容するため `Value | undefined` としている。
1735
+ */
1736
+ declare type SerializableRecord = Record<string, Value | undefined>;
1737
+
1738
+ /**
1739
+ * {@link Book} を JSON 文字列にシリアライズする。
1740
+ */
1741
+ export declare function serializeBook(book: Book): string;
1742
+
1743
+ /**
1744
+ * {@link Page} を JSON 文字列にシリアライズする。
1745
+ */
1746
+ export declare function serializePage(page: Page): string;
1747
+
1748
+ /**
1749
+ * 指定インデックスのページを置き換えた新しい Book を返す。
1750
+ */
1751
+ export declare function setPage(book: Book, pageIdx: number, page: Page): Book;
1752
+
1753
+ /**
1754
+ * サイドバーコンポーネント。
1755
+ *
1756
+ * @remarks
1757
+ * **Shell** タブシェルのみを提供する純粹なコンテナ。
1758
+ *
1759
+ * タブの内容は `getDefaultSidebarTabs()` で生成してください。
1760
+ */
1761
+ export declare const Sidebar: {
1762
+ ({ tabs, defaultTab, className }: SidebarProps): JSX.Element;
1763
+ displayName: string;
1764
+ };
1765
+
1766
+ /**
1767
+ * サイドバーコンポーネントへの props。
1768
+ */
1769
+ export declare interface SidebarProps {
1770
+ /** タブ定義(必須) */
1771
+ tabs: SidebarTab[];
1772
+ /** デフォルトで選択されるタブの value。未指定時は最初のタブ */
1773
+ defaultTab?: string;
1774
+ /** カスタムクラス名 */
1775
+ className?: string;
1776
+ }
1777
+
1778
+ /**
1779
+ * サイドバーのタブ定義オブジェクト。
1780
+ */
1781
+ export declare interface SidebarTab {
1782
+ /** タブの value(一意な文字列) */
1783
+ value: string;
1784
+ /** タブヘッダーに表示するラベル */
1785
+ label: ReactNode;
1786
+ /** タブのコンテンツ */
1787
+ content: ReactNode;
1788
+ }
1789
+
1790
+ /**
1791
+ * テキスト入力の改行・折り返し・行間隔などのレイアウト挙動 props。
1792
+ */
1793
+ declare interface TextBehaviorProps {
1794
+ /** 行間隔(CSS `line-height` 相当)。デフォルト: 1.2。 */
1795
+ lineHeight?: number;
1796
+ /** `true` のとき複数行入力を許可する。デフォルト: true。 */
1797
+ multiline?: boolean;
1798
+ /** 折り返しの振る舞い(CSS `overflow-wrap` 相当)。 */
1799
+ wordWrap?: WordWrap;
1800
+ /** スペース・改行のレンダリング模式(CSS `white-space` 相当)。 */
1801
+ whiteSpace?: WhiteSpace;
1802
+ }
1803
+
1804
+ /**
1805
+ * テキストブロックの props 型。
1806
+ *
1807
+ * フォント・文字幅返・入力バリデーション・プレースホルダーなどの属性群の共和型。
1808
+ */
1809
+ declare type TextBlockProps = BaseBlockProps & FontStyleProps & PlaceholderProps & RequiredProps & TextBehaviorProps & TextValidationProps;
1810
+
1811
+ /**
1812
+ * テキストブロックの値型。`null` は未入力状態を表す。
1813
+ */
1814
+ declare type TextBlockValue = string | null;
1815
+
1816
+ /**
1817
+ * テキスト入力ブロックのプラグイン定義。
1818
+ *
1819
+ * `kind: "text"` で登録され、フォント・バリデーション・改行・必須入力などの prop まとまりを提供する。
1820
+ */
1821
+ export declare const TextPlugin: BlockPlugin<TextBlockProps, TextBlockValue>;
1822
+
1823
+ /**
1824
+ * テキスト入力の入力タイプ・数値範囲・文字数・パターンなどのバリデーション props。
1825
+ */
1826
+ declare interface TextValidationProps {
1827
+ /** 入力タイプ(`<input type>` 属性)。デフォルト: `text`。 */
1828
+ inputType?: InputType;
1829
+ /** 数値入力の最小値。 */
1830
+ min?: number;
1831
+ /** 数値入力の最大値。 */
1832
+ max?: number;
1833
+ /** 数値入力のステップ幅。 */
1834
+ step?: number;
1835
+ /** 最小文字数。 */
1836
+ minLength?: number;
1837
+ /** 最大文字数。 */
1838
+ maxLength?: number;
1839
+ /** 入力値を検証する正規表現パターン。 */
1840
+ pattern?: string;
1841
+ }
1842
+
1843
+ /**
1844
+ * このパッケージで使用できる全単位。
1845
+ */
1846
+ export declare type Unit = (typeof ALL_UNITS)[number];
1847
+
1848
+ /**
1849
+ * フルエディター(ActionBar + Note + SelectionActionBarOverlay + Sidebar)向けの Context 統合フック。
1850
+ *
1851
+ * `useBookHistory` / `useEditorState` / `useBookBindingContext` / `useBookActionContext`
1852
+ * を組み合わせ、配線済みの `NoteContext` を返す。
1853
+ *
1854
+ * @example
1855
+ * ```tsx
1856
+ * const { context } = useNoteContext({ initialBook, pluginRegistry });
1857
+ * const [mode, setMode] = useState<NoteMode>(NoteMode.FORM);
1858
+ *
1859
+ * <ActionBar sections={getDefaultActionBarSections({ context })} />
1860
+ * <div ref={context.containerRef} style={{ position: "relative" }}>
1861
+ * <Note mode={mode} context={context} />
1862
+ * <DefaultSelectionActionBarOverlay context={context} />
1863
+ * </div>
1864
+ * <Sidebar tabs={getDefaultSidebarTabs({ context })} />
1865
+ * ```
1866
+ */
1867
+ export declare function useNoteContext({ initialBook, pluginRegistry, defaultValues, extra, }: UseNoteContextOptions): UseNoteContextResult;
1868
+
1869
+ /**
1870
+ * {@link useNoteContext} のオプション。
1871
+ */
1872
+ export declare interface UseNoteContextOptions {
1873
+ /**
1874
+ * 初期ブックデータ。
1875
+ *
1876
+ * **マウント時のみ参照される**(React の `useState` 初期値と同じ挙動)。
1877
+ * マウント後に値を変えても内部状態には反映されない。
1878
+ *
1879
+ * そのため、非同期ロード後にデータを渡す場合は、
1880
+ * **ロード完了後にコンポーネントをマウントする**こと。
1881
+ *
1882
+ * @example
1883
+ * ```tsx
1884
+ * // ✅ ロード完了後にマウント
1885
+ * if (!templateData) return <Loading />;
1886
+ * return <MyEditor initialBook={templateData} />;
1887
+ *
1888
+ * // ✅ ドキュメント切り替え時は key でリマウント
1889
+ * return <MyEditor key={documentId} initialBook={loadedBook} />;
1890
+ * ```
1891
+ */
1892
+ initialBook: Book;
1893
+ /** ブロックプラグインのレジストリ(`createPluginRegistry` で生成) */
1894
+ pluginRegistry: PluginRegistry;
1895
+ /**
1896
+ * 各ブロックの初期入力値(省略可)。
1897
+ *
1898
+ * **マウント時のみ参照される**(React の `useState` 初期値と同じ挙動)。
1899
+ * マウント後に値が変わっても内部状態には反映されない。
1900
+ *
1901
+ * そのため、非同期ロード後にデータを渡す場合は、
1902
+ * **ロード完了後にコンポーネントをマウントする**こと。
1903
+ *
1904
+ * @example
1905
+ * ```tsx
1906
+ * // ❌ ダメな例 — フェッチ中は undefined、完了後に変わっても無視される
1907
+ * const { data: savedValues } = useFetch("/api/answers");
1908
+ * const { context } = useNoteContext({ initialBook, pluginRegistry, defaultValues: savedValues });
1909
+ *
1910
+ * // ✅ ロード完了後にマウント
1911
+ * const { data: savedValues } = useFetch("/api/answers");
1912
+ * if (!savedValues) return <Loading />;
1913
+ * return <MyEditor defaultValues={savedValues} />;
1914
+ * ```
1915
+ */
1916
+ defaultValues?: Record<string, Value>;
1917
+ /**
1918
+ * ユーザー定義の追加 BindingContext。
1919
+ * 組み込みパスより優先して参照される。
1920
+ * 詳細は {@link BookBindingContextOptions.extra} を参照。
1921
+ */
1922
+ extra?: BindingContext;
1923
+ }
1924
+
1925
+ /**
1926
+ * {@link useNoteContext} の戻り値。
1927
+ */
1928
+ export declare interface UseNoteContextResult {
1929
+ /** Note / ActionBar / Sidebar / DefaultSelectionActionBarOverlay に渡す context */
1930
+ context: NoteContext;
1931
+ }
1932
+
1933
+ /**
1934
+ * Book 全体の blockId 重複・ページごとのブロック数上限を検証する。
1935
+ *
1936
+ * 問題があれば `ValidationError[]` を返す。空配列は valid。
1937
+ */
1938
+ export declare function validateBook(book: Book): ValidationError[];
1939
+
1940
+ /**
1941
+ * バリデーション結果の1件分。プラグインのバリデーター関数が返す配列の要素型。
1942
+ *
1943
+ * @remarks
1944
+ * `useNoteLayout` が `Record<blockId, ValidationError[]>` として管理する。
1945
+ */
1946
+ export declare interface ValidationError {
1947
+ /** ユーザーに表示するエラーメッセージ */
1948
+ message: string;
1949
+ /** エラー種別を識別するコード(例: `"required"`, `"min_length"`) */
1950
+ code: string;
1951
+ /** エラーに関連するフィールド名。ブロック内の特定フィールドを示す場合に使用。 */
1952
+ field?: string;
1953
+ /** 重大度レベル */
1954
+ severity: ValidationSeverity;
1955
+ /** プラグインが付加する任意のメタデータ */
1956
+ metadata?: Record<string, Value>;
1957
+ }
1958
+
1959
+ /**
1960
+ * バリデーション結果の重大度レベル。
1961
+ */
1962
+ export declare enum ValidationSeverity {
1963
+ /** 修正が必要なエラー */
1964
+ ERROR = "error",
1965
+ /** 推奨される修正があるが続行可能な警告 */
1966
+ WARNING = "warning",
1967
+ /** 参考情報 */
1968
+ INFO = "info"
1969
+ }
1970
+
1971
+ /**
1972
+ * このパッケージで扱う値の型。JSON シリアライズ可能な値のみを表す再帰型。
1973
+ *
1974
+ * ブロックの入力値・バインディング値・スキーマのデフォルト値などに共通して使用される。
1975
+ */
1976
+ export declare type Value = string | number | boolean | null | Value[] | readonly Value[] | {
1977
+ [key: string]: Value;
1978
+ };
1979
+
1980
+ /**
1981
+ * 1 件の値変更を表す。
1982
+ *
1983
+ * @remarks
1984
+ * `value` が `undefined` の場合はそのブロックの値を削除する。
1985
+ */
1986
+ declare type ValueChange = {
1987
+ id: string;
1988
+ value: Value | undefined;
1989
+ };
1990
+
1991
+ /**
1992
+ * ブロック内の垂直配置。
1993
+ */
1994
+ declare enum VerticalAlign {
1995
+ top = "top",
1996
+ center = "center",
1997
+ bottom = "bottom"
1998
+ }
1999
+
2000
+ /**
2001
+ * テキストの改行・スペースのレンダリング模式(CSS `white-space` 相当)。
2002
+ */
2003
+ declare enum WhiteSpace {
2004
+ normal = "normal",
2005
+ nowrap = "nowrap",
2006
+ pre = "pre",
2007
+ preWrap = "pre-wrap",
2008
+ preLine = "pre-line"
2009
+ }
2010
+
2011
+ /**
2012
+ * ウィジェット定義。NoteBlockProps と必要プラグインを一体化した型。
2013
+ *
2014
+ * @remarks
2015
+ * {@link FloatingWidget} に渡すことで、`pluginRegistry` を別途用意する必要がなくなる。
2016
+ *
2017
+ * `plugins` には、このウィジェットを描画するために必要なプラグインをすべて列挙する。
2018
+ *
2019
+ * `FloatingWidget` はこれを元に内部で `PluginRegistry` を構築する。
2020
+ */
2021
+ export declare interface WidgetDef {
2022
+ /** Widget として表示する NoteBlock の初期データ */
2023
+ props: NoteBlockProps;
2024
+ /** このウィジェットを描画するために必要なプラグイン */
2025
+ plugins: readonly AnyBlockPlugin[];
2026
+ }
2027
+
2028
+ /**
2029
+ * テキストの折り返し・改行插入の振る舞い。
2030
+ */
2031
+ declare enum WordWrap {
2032
+ normal = "normal",
2033
+ breakWord = "break-word",
2034
+ breakAll = "break-all"
2035
+ }
2036
+
2037
+ export { }