@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.
- package/README.md +518 -81
- package/dist/PalettePanel-CtXsH6Cb.js +5137 -0
- package/dist/PalettePanel-CtXsH6Cb.js.map +1 -0
- package/dist/PalettePanel-Dipvtj7D.cjs +9 -0
- package/dist/PalettePanel-Dipvtj7D.cjs.map +1 -0
- package/dist/PalettePanel.css +1 -0
- package/dist/canvas.cjs +1 -0
- package/dist/canvas.cjs.map +1 -0
- package/dist/canvas.mjs +354 -0
- package/dist/canvas.mjs.map +1 -0
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +3 -1
- package/dist/index.css.d.ts +2 -0
- package/dist/index.mjs +1424 -6891
- package/dist/index.mjs.map +1 -1
- package/dist/paperSettingsWidget-DgDoBA0P.js +5137 -0
- package/dist/paperSettingsWidget-DgDoBA0P.js.map +1 -0
- package/dist/paperSettingsWidget-sLJsIUxS.cjs +2 -0
- package/dist/paperSettingsWidget-sLJsIUxS.cjs.map +1 -0
- package/dist/paperSettingsWidget.css +1 -0
- package/dist/shell.cjs +1 -0
- package/dist/shell.cjs.map +1 -0
- package/dist/shell.mjs +65 -0
- package/dist/shell.mjs.map +1 -0
- package/dist/sidebarPortal-C06y4JSP.js +723 -0
- package/dist/sidebarPortal-C06y4JSP.js.map +1 -0
- package/dist/sidebarPortal-C3HszQyp.cjs +1 -0
- package/dist/sidebarPortal-C3HszQyp.cjs.map +1 -0
- package/dist/src/canvas.d.ts +2523 -0
- package/dist/src/index.d.ts +1801 -2880
- package/dist/src/shell.d.ts +1982 -0
- package/package.json +21 -8
- package/dist/index.js +0 -70
- package/dist/index.js.map +0 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @
|
|
43
|
-
*
|
|
17
|
+
* アクションバーコンポーネント。
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* **Shell** — `sections` 配列でセクションを渡すと区切り線を自動挿入して横並びにレンダリングする。
|
|
21
|
+
*
|
|
22
|
+
* デフォルトの `sections` は `getDefaultActionBarSections()` で取得できる。
|
|
44
23
|
*/
|
|
45
|
-
export declare
|
|
24
|
+
export declare const ActionBar: {
|
|
25
|
+
({ sections, className, style, }: ActionBarProps): JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
46
28
|
|
|
47
29
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @param value 検証する値
|
|
50
|
-
* @param name 値の名前(エラーメッセージに含まれる)
|
|
51
|
-
* @throws {Error} 値が0以下の場合
|
|
30
|
+
* アクションバーコンポーネントへの props。
|
|
52
31
|
*/
|
|
53
|
-
export declare
|
|
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
|
-
*
|
|
58
|
-
* @
|
|
59
|
-
*
|
|
60
|
-
* @param name 値の名前(エラーメッセージに含まれる)
|
|
61
|
-
* @throws {Error} 値が範囲外の場合
|
|
48
|
+
* 登録済みアクションの実行および有効判定インターフェース。
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* button ブロックのクリック時に呼び出される。
|
|
62
52
|
*/
|
|
63
|
-
export declare
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
*
|
|
81
|
-
* - グリッド座標(論理座標)で位置を管理
|
|
82
|
-
* - 画面サイズやDPIに依存しない
|
|
83
|
-
* - FormSchema.blocks の要素型
|
|
64
|
+
* `ActionBar` / `CanvasActionSection` に渡す `onActionFeedback` の引数型。
|
|
84
65
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
|
106
|
-
readOnly?: boolean;
|
|
107
|
-
}
|
|
78
|
+
export declare function addPage(book: Book): Book;
|
|
108
79
|
|
|
109
80
|
/**
|
|
110
|
-
*
|
|
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
|
-
|
|
83
|
+
declare interface AlignmentProps {
|
|
84
|
+
/** 水平配置 */
|
|
85
|
+
horizontal?: HorizontalAlign;
|
|
86
|
+
/** 垂直配置 */
|
|
87
|
+
vertical?: VerticalAlign;
|
|
88
|
+
}
|
|
123
89
|
|
|
124
90
|
/**
|
|
125
|
-
*
|
|
91
|
+
* 全単位の配列。
|
|
126
92
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
*
|
|
98
|
+
* フォーム構築に最低限必要な標準プラグインのリスト。
|
|
99
|
+
*
|
|
100
|
+
* `CheckboxPlugin` / `SelectPlugin` / `TextPlugin` の3つを含む。
|
|
139
101
|
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
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
|
|
111
|
+
export declare const BASE_PLUGINS: readonly [BlockPlugin<CheckboxBlockProps, boolean>, BlockPlugin<SelectBlockProps, SelectBlockValue>, BlockPlugin<TextBlockProps, TextBlockValue>];
|
|
146
112
|
|
|
147
113
|
/**
|
|
148
|
-
*
|
|
114
|
+
* 全ブロックに共通して存在する基底プロパティ。
|
|
115
|
+
*
|
|
116
|
+
* コンテナが alignment / padding を CSS に変換し、Renderer は意識しない。
|
|
149
117
|
*/
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
-
|
|
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
|
|
206
|
-
/**
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
-
*
|
|
214
|
-
*
|
|
215
|
-
* レイアウト編集時にブロックの境界を可視化するガイド線コンポーネント
|
|
216
|
-
* - formモードでのみ使用される
|
|
217
|
-
* - block.style?.borderが未設定のブロックに表示
|
|
218
|
-
* - pointer-events: none (クリックイベント透過)
|
|
148
|
+
* book 内のブロックを表すインターフェース。
|
|
219
149
|
*
|
|
220
150
|
* @remarks
|
|
221
|
-
* -
|
|
222
|
-
*
|
|
223
|
-
* -
|
|
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
|
|
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
|
-
*
|
|
195
|
+
* ブロックの動作設定。
|
|
196
|
+
*
|
|
197
|
+
* @remarks
|
|
198
|
+
* キーが存在する(`true`)場合に有効、`undefined` の場合は無効として扱う。
|
|
229
199
|
*/
|
|
230
|
-
export declare interface
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
|
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
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
-
* @
|
|
291
|
-
*
|
|
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
|
-
|
|
285
|
+
declare interface BlockPlugin<P extends BaseBlockProps = BaseBlockProps, V = Value> {
|
|
286
|
+
/** プラグインの一意識別子。`block.kind` と対応する */
|
|
294
287
|
kind: string;
|
|
288
|
+
/** UI表示・アイコン・デフォルトサイズ等のメタ情報 */
|
|
295
289
|
meta: BlockPluginMeta;
|
|
296
|
-
|
|
297
|
-
|
|
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
|
-
|
|
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
|
-
|
|
347
|
+
declare interface BlockPluginMeta {
|
|
348
|
+
/** UIに表示されるブロック名 */
|
|
306
349
|
displayName: string;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
-
*
|
|
365
|
-
*
|
|
366
|
-
* @remarks
|
|
367
|
-
* すべてのプラグインのRendererコンポーネントは、
|
|
368
|
-
* forwardRefを使用してこのインターフェースを実装する必要があります。
|
|
377
|
+
* Rendererが forwardRef で外部に公開するインターフェース。
|
|
369
378
|
*/
|
|
370
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
* -
|
|
453
|
-
* -
|
|
454
|
-
* -
|
|
407
|
+
* - `pages` は最低1ページ必須(タプル型で空配列を禁止)
|
|
408
|
+
* - `Page.id` はオプション。index による識別がベースだが、並び替え・外部同期には `id` を利用する
|
|
409
|
+
* - `block.id` はブック全体でユニークであること
|
|
410
|
+
* - `paper` はブック全体で共通(全ページ同一の用紙設定を維持する)
|
|
455
411
|
*/
|
|
456
|
-
export declare interface
|
|
457
|
-
/**
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
424
|
+
declare const BORDER_UNITS: readonly ["px", "pt", "mm"];
|
|
545
425
|
|
|
546
426
|
/**
|
|
547
|
-
*
|
|
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
|
-
*
|
|
446
|
+
* 組み込みアクション ID のユニオン型。
|
|
589
447
|
*
|
|
590
|
-
*
|
|
591
|
-
*
|
|
592
|
-
* @param deltaPx - ピクセル単位での変更量
|
|
593
|
-
* @param totalContentPx - コンテンツ全体のサイズ(px)
|
|
594
|
-
* @returns 更新されたDimension配列
|
|
448
|
+
* `ActionContext.execute` / `ActionContext.isEnabled` の引数に指定したとき IDE の補完候補として表示される。
|
|
449
|
+
* カスタムアクション ID は任意の `string` として渡せる。
|
|
595
450
|
*/
|
|
596
|
-
export declare
|
|
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
|
-
*
|
|
606
|
-
* - グリッド範囲外にははみ出さない
|
|
607
|
-
* - 左端・上端を超える場合は自動的にクランプ
|
|
457
|
+
* カスタムシェル構築専用。
|
|
608
458
|
*
|
|
609
|
-
*
|
|
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
|
|
461
|
+
export declare const canvasActionsWidget: WidgetDef;
|
|
623
462
|
|
|
624
463
|
/**
|
|
625
|
-
*
|
|
626
|
-
* キャンバス設定の統合パネル
|
|
627
|
-
* - PaperSizePanel: 用紙サイズ設定
|
|
628
|
-
* - MarginPanel: マージン設定
|
|
629
|
-
* - GridSizePanel: グリッドサイズ設定
|
|
630
|
-
* - BlockOrderPanel: ブロック順序設定
|
|
464
|
+
* チェックボックスブロックの props 型。
|
|
631
465
|
*/
|
|
632
|
-
|
|
633
|
-
({ schema, onSchemaChange }: CanvasPanelProps): JSX.Element;
|
|
634
|
-
displayName: string;
|
|
635
|
-
};
|
|
466
|
+
declare type CheckboxBlockProps = BaseBlockProps & RequiredProps & CheckboxStyleProps;
|
|
636
467
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
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
|
|
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
|
-
|
|
653
|
-
|
|
654
|
-
|
|
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
|
-
*
|
|
659
|
-
* ★修正: boolean | undefined にして未設定を許容する
|
|
501
|
+
* チェックボックスの外観カスタマイズ props。
|
|
660
502
|
*/
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
503
|
+
declare interface CheckboxStyleProps {
|
|
504
|
+
/** 外観カスタマイズ設定。 */
|
|
505
|
+
styleConfig?: CheckboxStyleConfig;
|
|
664
506
|
}
|
|
665
507
|
|
|
666
508
|
/**
|
|
667
|
-
*
|
|
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
|
-
*
|
|
517
|
+
* カスタムシェル構築専用。
|
|
907
518
|
*
|
|
908
|
-
*
|
|
909
|
-
* @param position グリッド上の配置情報
|
|
910
|
-
* @param overrideProps プロパティの上書き(オプション)
|
|
911
|
-
* @returns 新しい Block オブジェクト
|
|
519
|
+
* `createClipboardWidget()` と等価。
|
|
912
520
|
*/
|
|
913
|
-
export declare
|
|
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
|
-
*
|
|
524
|
+
* ブロックの一意 ID を生成する。
|
|
922
525
|
*
|
|
923
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
1313
|
-
* @returns 基底z-index(ブロックはbase ~ base+9を使用可能)
|
|
548
|
+
* 3 列 × 1 行: [コピー][貼付][複製]
|
|
1314
549
|
*
|
|
1315
|
-
*
|
|
1316
|
-
* ```ts
|
|
1317
|
-
* getBlockZIndex(0); // 100
|
|
1318
|
-
* getBlockZIndex(1); // 200
|
|
1319
|
-
* getBlockZIndex(10); // 1100
|
|
1320
|
-
* ```
|
|
550
|
+
* `idPrefix` でブロック ID プレフィックスを変更できる。
|
|
1321
551
|
*/
|
|
1322
|
-
export declare function
|
|
552
|
+
export declare function createClipboardWidget(idPrefix?: string): WidgetDef;
|
|
1323
553
|
|
|
1324
554
|
/**
|
|
1325
|
-
*
|
|
1326
|
-
* 値がバラバラの場合は undefined を返す
|
|
555
|
+
* 操作履歴(アンドゥ・リドゥ)ボタン widget を生成するファクトリ関数。
|
|
1327
556
|
*
|
|
1328
|
-
* @
|
|
1329
|
-
*
|
|
1330
|
-
* @returns 全ブロックで共通の値、または値が異なる場合は undefined
|
|
1331
|
-
*
|
|
1332
|
-
* @example
|
|
1333
|
-
* ```ts
|
|
1334
|
-
* // propsの値を取得
|
|
1335
|
-
* const textValue = getCommonValue(blocks, "props.text");
|
|
557
|
+
* @remarks
|
|
558
|
+
* カスタムシェル構築専用。
|
|
1336
559
|
*
|
|
1337
|
-
*
|
|
1338
|
-
* const xPos = getCommonValue<number>(blocks, "layout.x");
|
|
560
|
+
* 2 列 × 1 行: [元に戻す][やり直し]
|
|
1339
561
|
*
|
|
1340
|
-
*
|
|
1341
|
-
* const bgColor = getCommonValue(blocks, "style.backgroundColor");
|
|
1342
|
-
* ```
|
|
562
|
+
* `idPrefix` でブロック ID プレフィックスを変更できる。
|
|
1343
563
|
*/
|
|
1344
|
-
export declare function
|
|
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
|
-
*
|
|
1354
|
-
* @returns 現在のモード
|
|
1355
|
-
*/
|
|
1356
|
-
export declare function getInteractionMode(state: InteractionState): InteractionMode;
|
|
1357
|
-
|
|
1358
|
-
/**
|
|
1359
|
-
* サポートされる最大ブロック数を取得
|
|
572
|
+
* 7 列 × 1 行の NoteBlock プリセット:
|
|
1360
573
|
*
|
|
1361
|
-
*
|
|
574
|
+
* [prev][current][separator][total][next][add][delete]
|
|
1362
575
|
*
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1365
|
-
*
|
|
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
|
|
1379
|
-
|
|
1380
|
-
|
|
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
|
-
*
|
|
586
|
+
* プラグインの配列から `kind` をキーとしたレジストリを生成する。
|
|
1387
587
|
*
|
|
1388
|
-
*
|
|
1389
|
-
* @param subIndex - サブレイヤーのオフセット (0-99)
|
|
1390
|
-
* @returns サブレイヤーのz-index
|
|
588
|
+
* 各プラグインの `properties` から `defaultProps` を合成し、`Renderer` をベース型に正規化した `ResolvedPlugin` を返す。
|
|
1391
589
|
*
|
|
1392
590
|
* @example
|
|
1393
591
|
* ```ts
|
|
1394
|
-
* const
|
|
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
|
|
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
|
-
*
|
|
1413
|
-
*
|
|
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
|
-
|
|
603
|
+
Renderer: ForwardRefExoticComponent<never>;
|
|
1424
604
|
/**
|
|
1425
|
-
*
|
|
1426
|
-
* NoteFormのonPointerEnterから呼ばれる
|
|
605
|
+
* `never[]` rest 型により、任意の引数型の関数が代入可。
|
|
1427
606
|
*
|
|
1428
|
-
*
|
|
607
|
+
* 非関数値は型エラーになる。
|
|
1429
608
|
*/
|
|
1430
|
-
|
|
609
|
+
migrateProps?: (...args: never[]) => unknown;
|
|
1431
610
|
/**
|
|
1432
|
-
*
|
|
1433
|
-
* (現在は使用していないが、将来的なデバッグ用に実装)
|
|
611
|
+
* `never[]` rest 型により、任意の引数型の関数が代入可。
|
|
1434
612
|
*
|
|
1435
|
-
*
|
|
1436
|
-
* @returns アンサブスクライブ関数
|
|
613
|
+
* 非関数値は型エラーになる。
|
|
1437
614
|
*/
|
|
1438
|
-
|
|
615
|
+
validateProps?: (...args: never[]) => unknown;
|
|
1439
616
|
/**
|
|
1440
|
-
*
|
|
617
|
+
* `never[]` rest 型により、任意の引数型の関数が代入可。
|
|
618
|
+
*
|
|
619
|
+
* 非関数値は型エラーになる。
|
|
1441
620
|
*/
|
|
1442
|
-
|
|
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
|
|
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
|
-
|
|
636
|
+
/**
|
|
637
|
+
* デフォルト Book(1ページ・空スキーマ)。
|
|
638
|
+
*/
|
|
639
|
+
export declare const DEFAULT_BOOK: Book;
|
|
1456
640
|
|
|
1457
641
|
/**
|
|
1458
|
-
*
|
|
1459
|
-
*
|
|
1460
|
-
* 用紙背景を描画するコンポーネント
|
|
1461
|
-
* - z-index: 0 (GridLayerの最下層)
|
|
1462
|
-
* - pointer-events: none (クリックイベント透過)
|
|
1463
|
-
* - 白い用紙背景を表示
|
|
642
|
+
* デフォルトグリッド。A4 縦置き時にセルがほぼ正方形になるよう、
|
|
643
|
+
* 列数 20・行数 28 に設定。
|
|
1464
644
|
*/
|
|
1465
|
-
export declare const
|
|
645
|
+
export declare const DEFAULT_GRID: Grid;
|
|
1466
646
|
|
|
1467
647
|
/**
|
|
1468
|
-
*
|
|
648
|
+
* デフォルトフォームスキーマ(空ページ)。
|
|
1469
649
|
*/
|
|
1470
|
-
export declare
|
|
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
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
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
|
-
|
|
657
|
+
/**
|
|
658
|
+
* デフォルトマージン。四辺すべて 10 mm。
|
|
659
|
+
*/
|
|
660
|
+
export declare const DEFAULT_PAPER_MARGIN: PaperMargin;
|
|
1487
661
|
|
|
1488
662
|
/**
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
* グリッド線と線の間に寸法(値と単位)を表示します。
|
|
1492
|
-
* ダブルクリックで単位編集UIを表示します。
|
|
663
|
+
* 各プリセットのデフォルト寸法定義。
|
|
1493
664
|
*/
|
|
1494
|
-
export declare const
|
|
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
|
-
*
|
|
668
|
+
* `getDefaultSelectionActionBarItems` + `SelectionActionBar` をキャンバス上に浮かせて表示するオーバーレイ。
|
|
1521
669
|
*
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
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
|
-
* <
|
|
1531
|
-
*
|
|
1532
|
-
*
|
|
1533
|
-
*
|
|
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
|
|
681
|
+
export declare const DefaultSelectionActionBarOverlay: {
|
|
682
|
+
({ context, gridSize, isDragging, zIndex, onActionFeedback, }: DefaultSelectionActionBarOverlayProps): JSX.Element;
|
|
683
|
+
displayName: string;
|
|
684
|
+
};
|
|
1547
685
|
|
|
1548
686
|
/**
|
|
1549
|
-
*
|
|
687
|
+
* `DefaultSelectionActionBarOverlay` コンポーネントへの props。
|
|
1550
688
|
*/
|
|
1551
|
-
export declare interface
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
*
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
}
|
|
1985
|
-
|
|
1986
|
-
export declare function
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
export declare
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
}
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
export declare
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
/**
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
/**
|
|
2331
|
-
|
|
2332
|
-
*/
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
/**
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
/**
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
*/
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
*/
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
export declare
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
/**
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
export declare interface
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
*
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
*/
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
export declare
|
|
2742
|
-
|
|
2743
|
-
/**
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
/**
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
/**
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
export declare
|
|
3001
|
-
|
|
3002
|
-
/**
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
export declare
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
/**
|
|
3032
|
-
|
|
3033
|
-
*/
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
export declare
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
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 { }
|