@zuilib/text-editor 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +180 -17
- package/DRAWING_FORMAT.md +23 -21
- package/README.md +486 -68
- package/dist/chunk-32RX4GZF.js +2 -0
- package/dist/chunk-3TZVOXWX.js +16 -0
- package/dist/chunk-5VRVC56Y.js +2 -0
- package/dist/chunk-7Z3CW6Q3.js +2 -0
- package/dist/chunk-A7MCBSAZ.js +2 -0
- package/dist/chunk-AGTPMKLK.js +2 -0
- package/dist/chunk-C7VEINKX.js +2 -0
- package/dist/chunk-LDVPFZCN.js +2 -0
- package/dist/chunk-N5JWZ2VW.js +9 -0
- package/dist/chunk-QKHMJQO3.js +2 -0
- package/dist/chunk-R5PL4Q7X.js +5 -0
- package/dist/chunk-SDICQI2B.js +2 -0
- package/dist/chunk-TGVEPLDM.js +1 -0
- package/dist/chunk-XP3MZRCW.js +2 -0
- package/dist/chunk-XRJNLGI4.js +2 -0
- package/dist/chunk-YFFSTMIR.js +2 -0
- package/dist/chunk-ZXZMYJ7F.js +2 -0
- package/dist/comment-markers-BrrrAdSL.d.ts +27 -0
- package/dist/comments.d.ts +68 -0
- package/dist/comments.js +2 -0
- package/dist/drawing-data-EWzEQ1_i.d.ts +111 -0
- package/dist/drawing-preset-Ag7a7F9h.d.ts +69 -0
- package/dist/drawing.d.ts +7 -0
- package/dist/drawing.js +2 -0
- package/dist/image-node-kR1Zf5kz.d.ts +70 -0
- package/dist/images.d.ts +66 -0
- package/dist/images.js +2 -0
- package/dist/index-A4S7bRwQ.d.ts +425 -0
- package/dist/index.d.ts +36 -1394
- package/dist/index.js +2 -7447
- package/dist/lexical.d.ts +117 -0
- package/dist/lexical.js +2 -0
- package/dist/markdown.d.ts +29 -0
- package/dist/markdown.js +2 -0
- package/dist/mention-node-eSsjUpaE.d.ts +44 -0
- package/dist/mentions-plugin-gio3_XKd.d.ts +74 -0
- package/dist/mentions.d.ts +5 -0
- package/dist/mentions.js +2 -0
- package/dist/mermaid-BwGHjwpk.d.ts +553 -0
- package/dist/paste.d.ts +45 -0
- package/dist/paste.js +2 -0
- package/dist/presets-BtNPH0pa.d.ts +78 -0
- package/dist/styles.css +406 -99
- package/dist/table-grid-D70tNhp2.d.ts +459 -0
- package/package.json +57 -12
- package/dist/index.css +0 -79
package/dist/index.d.ts
CHANGED
|
@@ -1,1396 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
type DrawingShapeType = BoxType | ConnectorType | 'text';
|
|
37
|
-
declare const BOX_TYPES: readonly BoxType[];
|
|
38
|
-
declare const CONNECTOR_TYPES: readonly ConnectorType[];
|
|
39
|
-
declare const SHAPE_TYPES: readonly DrawingShapeType[];
|
|
40
|
-
type Point = Readonly<{
|
|
41
|
-
x: number;
|
|
42
|
-
y: number;
|
|
43
|
-
}>;
|
|
44
|
-
type BindingSide = 'top' | 'right' | 'bottom' | 'left';
|
|
45
|
-
/**
|
|
46
|
-
* Where a connector endpoint attaches to a box.
|
|
47
|
-
*
|
|
48
|
-
* `fixedPoint` is a ratio inside the box's bounding box (`[0,0]` top-left,
|
|
49
|
-
* `[1,1]` bottom-right). Omitted = the box center, which makes the endpoint
|
|
50
|
-
* auto-aim at the other end. `mode: 'inside'` pins the endpoint exactly on
|
|
51
|
-
* the fixed point; the default (`'orbit'`) projects it onto the outline with
|
|
52
|
-
* a small gap.
|
|
53
|
-
*/
|
|
54
|
-
type Binding = Readonly<{
|
|
55
|
-
id: string;
|
|
56
|
-
fixedPoint?: readonly [number, number];
|
|
57
|
-
mode?: 'orbit' | 'inside';
|
|
58
|
-
}>;
|
|
59
|
-
type DrawingShape = Readonly<{
|
|
60
|
-
id: string;
|
|
61
|
-
type: DrawingShapeType;
|
|
62
|
-
/** Top-left corner (boxes/text) or start point (connectors) */
|
|
63
|
-
x: number;
|
|
64
|
-
y: number;
|
|
65
|
-
/** Size (boxes/text) or delta to the end point (connectors) */
|
|
66
|
-
w: number;
|
|
67
|
-
h: number;
|
|
68
|
-
stroke: string;
|
|
69
|
-
fill: string;
|
|
70
|
-
strokeWidth: number;
|
|
71
|
-
/** Standalone text, main (center) content of a box, or connector label */
|
|
72
|
-
text?: string;
|
|
73
|
-
/** Small heading rendered at the top of a box */
|
|
74
|
-
label?: string;
|
|
75
|
-
/** Small line rendered at the bottom of a box */
|
|
76
|
-
footer?: string;
|
|
77
|
-
/** Connector: box the start point is attached to */
|
|
78
|
-
startBinding?: Binding;
|
|
79
|
-
/** Connector: box the end point is attached to */
|
|
80
|
-
endBinding?: Binding;
|
|
81
|
-
/** Arrow: arrowheads on both ends */
|
|
82
|
-
bidirectional?: boolean;
|
|
83
|
-
/** Connector routing: right-angled auto-routed path instead of a straight line */
|
|
84
|
-
routing?: 'elbow';
|
|
85
|
-
/**
|
|
86
|
-
* Elbow override: position of the middle segment as a fraction of the
|
|
87
|
-
* span, applied only when the routed path is a simple three-segment Z.
|
|
88
|
-
*/
|
|
89
|
-
elbow?: number;
|
|
90
|
-
/**
|
|
91
|
-
* Connector: intermediate path points between start and end (absolute
|
|
92
|
-
* canvas coordinates). Takes precedence over `routing`.
|
|
93
|
-
*/
|
|
94
|
-
waypoints?: readonly Point[];
|
|
95
|
-
}>;
|
|
96
|
-
type DrawingData = Readonly<{
|
|
97
|
-
version: 2;
|
|
98
|
-
/**
|
|
99
|
-
* Logical canvas width. When set the drawing is scaled to fit narrower
|
|
100
|
-
* layouts (SVG viewBox); when omitted the canvas is fluid and shapes are
|
|
101
|
-
* in CSS pixels.
|
|
102
|
-
*/
|
|
103
|
-
canvasWidth?: number;
|
|
104
|
-
canvasHeight: number;
|
|
105
|
-
/**
|
|
106
|
-
* Block width: `full` (default) spans the editor; `text` aligns with the
|
|
107
|
-
* text column; `content` fits the shapes' horizontal extent. The editor
|
|
108
|
-
* omits `full` unless it was written explicitly (an insertion default or
|
|
109
|
-
* the source payload); unknown values are dropped.
|
|
110
|
-
*/
|
|
111
|
-
width?: BlockWidth;
|
|
112
|
-
shapes: readonly DrawingShape[];
|
|
113
|
-
}>;
|
|
114
|
-
declare const EMPTY_DRAWING: DrawingData;
|
|
115
|
-
declare const STROKE_COLORS: readonly ["#1e1e1e", "#e03131", "#2f9e44", "#1971c2", "#f08c00", "#7048e8"];
|
|
116
|
-
declare const FILL_COLORS: readonly ["transparent", "#ffc9c9", "#b2f2bb", "#a5d8ff", "#ffec99", "#d0bfff"];
|
|
117
|
-
/** Edge midpoints, used by the ```diagram skeleton's `side` option */
|
|
118
|
-
declare const SIDE_FIXED_POINTS: Record<BindingSide, readonly [number, number]>;
|
|
119
|
-
declare function serializeDrawingData(data: DrawingData): string;
|
|
120
|
-
/**
|
|
121
|
-
* Parse a ```drawing payload. Exactly one format is accepted: version 2 as
|
|
122
|
-
* written by the editor (the ```diagram skeleton is a separate block type,
|
|
123
|
-
* see skeleton.ts). Shapes that fail validation are dropped and a malformed
|
|
124
|
-
* document yields an empty canvas. Never throws.
|
|
125
|
-
*/
|
|
126
|
-
declare function parseDrawingData(json: string): DrawingData;
|
|
127
|
-
declare function normalizeDrawingData(parsed: unknown): DrawingData;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* "Ink" rendering: one confident pen stroke instead of a plotted outline.
|
|
131
|
-
* Every shape's centerline is resampled densely, displaced along its normal
|
|
132
|
-
* by a smooth low-frequency field (two sines, integer frequencies on closed
|
|
133
|
-
* paths so the seam is continuous) and widened by a slowly varying pressure
|
|
134
|
-
* factor. The result is a filled ring path, not an SVG stroke, so the width
|
|
135
|
-
* can breathe along the path. Everything is seeded from the shape id: the
|
|
136
|
-
* same shape draws the same way on every render, undo, export and machine.
|
|
137
|
-
*
|
|
138
|
-
* This is a renderer concern only — the drawing format never sees it.
|
|
139
|
-
*/
|
|
140
|
-
type DrawingStyle = 'clean' | 'ink';
|
|
141
|
-
type InkOptions = Readonly<{
|
|
142
|
-
closed: boolean;
|
|
143
|
-
seed: number;
|
|
144
|
-
/** Nominal stroke width; the pressure factor varies it by ±30 % */
|
|
145
|
-
width: number;
|
|
146
|
-
/** Peak displacement from the geometric path, in px */
|
|
147
|
-
amplitude: number;
|
|
148
|
-
}>;
|
|
149
|
-
type InkStroke = Readonly<{
|
|
150
|
-
/** Filled outline of the stroke (use `fillRule="evenodd"`) */
|
|
151
|
-
ring: string;
|
|
152
|
-
/** Displaced centerline, for fills */
|
|
153
|
-
center: string;
|
|
154
|
-
}>;
|
|
155
|
-
/** FNV-1a: a stable 32-bit seed from a shape id */
|
|
156
|
-
declare function seedFrom(text: string): number;
|
|
157
|
-
/** Wobble amplitude for a shape of the given smallest dimension (px) */
|
|
158
|
-
declare function inkAmplitude(size: number): number;
|
|
159
|
-
/** Fill misregistration for a shape: a seeded 2–3 px offset */
|
|
160
|
-
declare function inkFillOffset(seed: number): Point;
|
|
161
|
-
/** Ink stroke along a polyline (open) or polygon (closed) */
|
|
162
|
-
declare function inkStroke(points: readonly Point[], options: InkOptions): InkStroke;
|
|
163
|
-
/** Rectangle outline with circular corners, as a polygon */
|
|
164
|
-
declare function roundedRectPolygon(r: Readonly<{
|
|
165
|
-
x: number;
|
|
166
|
-
y: number;
|
|
167
|
-
w: number;
|
|
168
|
-
h: number;
|
|
169
|
-
}>, radius: number, segments?: number): Point[];
|
|
170
|
-
/** Polyline with its interior corners rounded (quadratic), as points */
|
|
171
|
-
declare function roundedPolyline(points: readonly Point[], cornerRadius?: number, segments?: number): Point[];
|
|
172
|
-
|
|
173
|
-
type EditorMode = 'edit-raw' | 'edit-md' | 'view';
|
|
174
|
-
|
|
175
|
-
type EditorRootProps = Readonly<{
|
|
176
|
-
value?: string;
|
|
177
|
-
onChange?: (value: string) => void;
|
|
178
|
-
readOnly?: boolean;
|
|
179
|
-
className?: string;
|
|
180
|
-
mode?: EditorMode;
|
|
181
|
-
autoFocus?: boolean;
|
|
182
|
-
/**
|
|
183
|
-
* Text measure: the maximum width of the text column, as a CSS length
|
|
184
|
-
* (`'48rem'` recommended). Text blocks are capped at this width and
|
|
185
|
-
* centred; tables and drawings choose per block whether to align with
|
|
186
|
-
* the column (`text`), span the pane (`full`) or hug their content.
|
|
187
|
-
* Sugar for setting `--zui-text-editor-measure` on the root; the
|
|
188
|
-
* variable can equally be set from a stylesheet. Unset: no measure, every
|
|
189
|
-
* block spans the pane.
|
|
190
|
-
*/
|
|
191
|
-
measure?: string;
|
|
192
|
-
/**
|
|
193
|
-
* Width written into the markdown when the toolbar or
|
|
194
|
-
* `useMarkdownEditor()` inserts a new table / drawing. Only affects
|
|
195
|
-
* insertion — markdown without a width marker always means `full`.
|
|
196
|
-
*/
|
|
197
|
-
defaultBlockWidth?: BlockWidthDefaults;
|
|
198
|
-
/**
|
|
199
|
-
* `clean` (default) draws crisp geometry; `ink` draws every shape as a
|
|
200
|
-
* single pen stroke with pressure and slightly misregistered fills, and
|
|
201
|
-
* sets the casual face (Recursive, if the host loads it).
|
|
202
|
-
*/
|
|
203
|
-
drawingStyle?: DrawingStyle;
|
|
204
|
-
children: ReactNode;
|
|
205
|
-
}>;
|
|
206
|
-
/**
|
|
207
|
-
* Owns the Lexical composer and every non-visual plugin. Anything rendered
|
|
208
|
-
* beneath it (`Content`, `Toolbar`, `Outline`, or your own components using
|
|
209
|
-
* `useMarkdownEditor`) shares the same editor instance.
|
|
210
|
-
*/
|
|
211
|
-
declare function EditorRoot({ value, onChange, readOnly, className, mode, autoFocus, measure, defaultBlockWidth, drawingStyle, children, }: EditorRootProps): ReactElement;
|
|
212
|
-
|
|
213
|
-
type EditorContentProps = Readonly<{
|
|
214
|
-
placeholder?: string;
|
|
215
|
-
/** Allow collapsing sections under their headings (default true) */
|
|
216
|
-
foldable?: boolean;
|
|
217
|
-
/** Sidebars docked next to the content, e.g. `<MarkdownEditor.Outline />` */
|
|
218
|
-
children?: ReactNode;
|
|
219
|
-
}>;
|
|
220
|
-
/**
|
|
221
|
-
* The editable surface. Renders a plain textarea in `edit-raw` mode and the
|
|
222
|
-
* Lexical rich-text surface otherwise.
|
|
223
|
-
*/
|
|
224
|
-
declare function EditorContent({ placeholder, foldable, children, }: EditorContentProps): ReactElement;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Docked, collapsible table-of-contents sidebar. Lists the document's
|
|
228
|
-
* headings (live), scrolls to a heading on click, and highlights the section
|
|
229
|
-
* the viewport is currently in. Pure UI — nothing is added to the document.
|
|
230
|
-
*/
|
|
231
|
-
declare function OutlinePlugin(): ReactElement;
|
|
232
|
-
|
|
233
|
-
/** Cell padding / font size preset */
|
|
234
|
-
type TableDensity = 'compact' | 'comfortable' | 'spacious';
|
|
235
|
-
type TableSettings = Readonly<{
|
|
236
|
-
width: BlockWidth;
|
|
237
|
-
density: TableDensity;
|
|
238
|
-
}>;
|
|
239
|
-
declare const DEFAULT_TABLE_SETTINGS: TableSettings;
|
|
240
|
-
type TableSettingsOptions = Readonly<{
|
|
241
|
-
/** Persist the width even when it is `full` */
|
|
242
|
-
explicitWidth?: boolean;
|
|
243
|
-
}>;
|
|
244
|
-
declare function $getTableSettings(table: TableNode): TableSettings;
|
|
245
|
-
declare function $setTableSettings(table: TableNode, settings: Partial<TableSettings>, options?: TableSettingsOptions): void;
|
|
246
|
-
/** Whether the table's width should be persisted even when it is `full` */
|
|
247
|
-
declare function $isTableWidthExplicit(table: TableNode): boolean;
|
|
248
|
-
declare function $getTableWidth(table: TableNode): BlockWidth;
|
|
249
|
-
declare function $setTableWidth(table: TableNode, width: BlockWidth): void;
|
|
250
|
-
declare function $getTableDensity(table: TableNode): TableDensity;
|
|
251
|
-
declare function $setTableDensity(table: TableNode, density: TableDensity): void;
|
|
252
|
-
/** The table containing the current selection (caret or cell range), if any */
|
|
253
|
-
declare function $getSelectedTable(): TableNode | null;
|
|
254
|
-
/** @deprecated Use `formatTableSettingsMarker({ ...DEFAULT_TABLE_SETTINGS, width: 'content' })` */
|
|
255
|
-
declare const TABLE_WIDTH_MARKER = "<!-- width: content -->";
|
|
256
|
-
/**
|
|
257
|
-
* Settings encoded in a marker line, or null if the text is not a marker.
|
|
258
|
-
* A marker naming a known setting with an unknown value yields that setting
|
|
259
|
-
* omitted (possibly an empty object): the line is still a settings marker.
|
|
260
|
-
*/
|
|
261
|
-
declare function parseTableSettingsMarker(text: string): Partial<TableSettings> | null;
|
|
262
|
-
/**
|
|
263
|
-
* Marker line for the given settings, or null when everything is default.
|
|
264
|
-
* With `explicitWidth` the width is listed even when it is `full`.
|
|
265
|
-
*/
|
|
266
|
-
declare function formatTableSettingsMarker(settings: TableSettings, options?: TableSettingsOptions): string | null;
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Row and column operations for GFM tables. Markdown tables have no merged
|
|
270
|
-
* cells, every row has the same number of cells and there is exactly one
|
|
271
|
-
* header row (the first), so these helpers work on plain indices and keep
|
|
272
|
-
* that shape: a row can't be inserted above the header, deleting the
|
|
273
|
-
* header promotes the row below it, and new cells in the header row are
|
|
274
|
-
* header cells.
|
|
275
|
-
*/
|
|
276
|
-
/** Where the selection sits in its table */
|
|
277
|
-
type TableCellPosition = Readonly<{
|
|
278
|
-
/** Row index of the caret (or of the anchor cell of a cell range) */
|
|
279
|
-
row: number;
|
|
280
|
-
/** Column index of that cell */
|
|
281
|
-
column: number;
|
|
282
|
-
/** Number of rows in the table */
|
|
283
|
-
rows: number;
|
|
284
|
-
/** Number of columns in the table */
|
|
285
|
-
columns: number;
|
|
286
|
-
/** Whether the first row is a header row */
|
|
287
|
-
hasHeader: boolean;
|
|
288
|
-
}>;
|
|
289
|
-
/** The cell containing the selection (caret or the anchor of a cell range) */
|
|
290
|
-
declare function $getSelectedTableCell(): TableCellNode | null;
|
|
291
|
-
/** Where the selection sits in its table, or null outside tables */
|
|
292
|
-
declare function $getTableCellPosition(): TableCellPosition | null;
|
|
293
|
-
/**
|
|
294
|
-
* The row boundaries a new row may be inserted at: `0..rows`, minus `0`
|
|
295
|
-
* when the first row is a header (a table's header is always its first row).
|
|
296
|
-
*/
|
|
297
|
-
declare function insertableRowIndices(position: Pick<TableCellPosition, 'rows' | 'hasHeader'>): number[];
|
|
298
|
-
/** A row can be removed as long as one row stays */
|
|
299
|
-
declare function canDeleteRow(position: Pick<TableCellPosition, 'rows'>): boolean;
|
|
300
|
-
/**
|
|
301
|
-
* Insert an empty row so that it becomes row `index` (`0` = first, `rows`
|
|
302
|
-
* = last). Column header state is copied from the row above; the header
|
|
303
|
-
* row itself is never displaced, so `index` is clamped to `1` when the
|
|
304
|
-
* table has a header. The caret moves into the new row, at `column`.
|
|
305
|
-
*/
|
|
306
|
-
declare function $insertTableRowAt(table: TableNode, index: number, column?: number): TableRowNode;
|
|
307
|
-
/**
|
|
308
|
-
* Remove row `index`. No-op on a single-row table (see `canDeleteRow`).
|
|
309
|
-
* Removing the header row makes the next row the header so the markdown
|
|
310
|
-
* keeps its divider. The caret moves to the row that takes the removed
|
|
311
|
-
* row's place (or the last row), at `column`.
|
|
312
|
-
*/
|
|
313
|
-
declare function $deleteTableRowAt(table: TableNode, index: number, column?: number): boolean;
|
|
314
|
-
/** Insert a row next to the selection's row. Returns the new row, or null outside tables. */
|
|
315
|
-
declare function $insertTableRowNear(table: TableNode, position: 'above' | 'below'): TableRowNode | null;
|
|
316
|
-
/** Remove the selection's row. Returns false when nothing was removed. */
|
|
317
|
-
declare function $deleteSelectedTableRow(table: TableNode): boolean;
|
|
318
|
-
/** The column boundaries a new column may be inserted at: `0..columns` */
|
|
319
|
-
declare function insertableColumnIndices(position: Pick<TableCellPosition, 'columns'>): number[];
|
|
320
|
-
/** A column can be removed as long as one column stays */
|
|
321
|
-
declare function canDeleteColumn(position: Pick<TableCellPosition, 'columns'>): boolean;
|
|
322
|
-
/**
|
|
323
|
-
* Insert an empty column so that it becomes column `index` (`0` = first,
|
|
324
|
-
* `columns` = last). Cells in the header row are header cells. The caret
|
|
325
|
-
* moves into the new column, at `row`.
|
|
326
|
-
*/
|
|
327
|
-
declare function $insertTableColumnAt(table: TableNode, index: number, row?: number): void;
|
|
328
|
-
/**
|
|
329
|
-
* Remove column `index`. No-op on a single-column table (see
|
|
330
|
-
* `canDeleteColumn`). The caret moves to the column that takes the removed
|
|
331
|
-
* column's place (or the last column), at `row`.
|
|
332
|
-
*/
|
|
333
|
-
declare function $deleteTableColumnAt(table: TableNode, index: number, row?: number): boolean;
|
|
334
|
-
/** Insert a column next to the selection's column; no-op outside tables. */
|
|
335
|
-
declare function $insertTableColumnNear(table: TableNode, position: 'before' | 'after'): boolean;
|
|
336
|
-
/** Remove the selection's column. Returns false when nothing was removed. */
|
|
337
|
-
declare function $deleteSelectedTableColumn(table: TableNode): boolean;
|
|
338
|
-
|
|
339
|
-
type MarkdownEditorApi = Readonly<{
|
|
340
|
-
/** The underlying Lexical editor, for dispatching your own commands */
|
|
341
|
-
editor: LexicalEditor;
|
|
342
|
-
/** Text formats active at the current selection */
|
|
343
|
-
activeFormats: ReadonlySet<TextFormatType>;
|
|
344
|
-
toggleFormat: (format: TextFormatType) => void;
|
|
345
|
-
/**
|
|
346
|
-
* Insert a table at the selection. `width` defaults to
|
|
347
|
-
* `defaultBlockWidth.table` (Root prop); when given it is written to the
|
|
348
|
-
* markdown explicitly, even when `full`.
|
|
349
|
-
*/
|
|
350
|
-
insertTable: (options?: {
|
|
351
|
-
rows?: number;
|
|
352
|
-
columns?: number;
|
|
353
|
-
width?: BlockWidth;
|
|
354
|
-
}) => void;
|
|
355
|
-
/**
|
|
356
|
-
* Insert an empty drawing at the selection. `width` defaults to
|
|
357
|
-
* `defaultBlockWidth.drawing` (Root prop); when given it is written to
|
|
358
|
-
* the markdown explicitly, even when `full`.
|
|
359
|
-
*/
|
|
360
|
-
insertDrawing: (options?: {
|
|
361
|
-
width?: BlockWidth;
|
|
362
|
-
}) => void;
|
|
363
|
-
/**
|
|
364
|
-
* Width of the block containing the selection — the focused drawing, or
|
|
365
|
-
* else the table the caret is in; `null` outside both.
|
|
366
|
-
*/
|
|
367
|
-
blockWidth: BlockWidth | null;
|
|
368
|
-
/** Resize that block; no-op when `blockWidth` is `null` */
|
|
369
|
-
setBlockWidth: (width: BlockWidth) => void;
|
|
370
|
-
/**
|
|
371
|
-
* Width of the table containing the selection; `null` outside tables.
|
|
372
|
-
* @deprecated Use `blockWidth`, which also covers drawings.
|
|
373
|
-
*/
|
|
374
|
-
tableWidth: BlockWidth | null;
|
|
375
|
-
/**
|
|
376
|
-
* Resize the table containing the selection; no-op outside tables.
|
|
377
|
-
* @deprecated Use `setBlockWidth`, which also covers drawings.
|
|
378
|
-
*/
|
|
379
|
-
setTableWidth: (width: BlockWidth) => void;
|
|
380
|
-
/** Density of the table containing the selection; `null` outside tables */
|
|
381
|
-
tableDensity: TableDensity | null;
|
|
382
|
-
/** Change the density of the table containing the selection; no-op outside tables */
|
|
383
|
-
setTableDensity: (density: TableDensity) => void;
|
|
384
|
-
/** The selection's cell in its table (row, column, counts, header); `null` outside tables */
|
|
385
|
-
tableCell: TableCellPosition | null;
|
|
386
|
-
/**
|
|
387
|
-
* Insert an empty row next to the selection's row (default `below`) and
|
|
388
|
-
* move the caret into it; no-op outside tables. A row is never inserted
|
|
389
|
-
* above the header row: `above` there inserts right below it.
|
|
390
|
-
*/
|
|
391
|
-
insertTableRow: (position?: 'above' | 'below') => void;
|
|
392
|
-
/**
|
|
393
|
-
* Remove the selection's row; no-op outside tables and on the last
|
|
394
|
-
* remaining row. Deleting the header row makes the next row the header.
|
|
395
|
-
*/
|
|
396
|
-
deleteTableRow: () => void;
|
|
397
|
-
/**
|
|
398
|
-
* Insert an empty column next to the selection's column (default
|
|
399
|
-
* `after`) and move the caret into it; no-op outside tables.
|
|
400
|
-
*/
|
|
401
|
-
insertTableColumn: (position?: 'before' | 'after') => void;
|
|
402
|
-
/** Remove the selection's column; no-op outside tables and on the last remaining column. */
|
|
403
|
-
deleteTableColumn: () => void;
|
|
404
|
-
canUndo: boolean;
|
|
405
|
-
canRedo: boolean;
|
|
406
|
-
undo: () => void;
|
|
407
|
-
redo: () => void;
|
|
408
|
-
}>;
|
|
409
|
-
/**
|
|
410
|
-
* Headless access to the editor. Must be rendered under `MarkdownEditor.Root`
|
|
411
|
-
* (or `MarkdownEditor`). Use it to wire editor actions into your own buttons.
|
|
412
|
-
*/
|
|
413
|
-
declare function useMarkdownEditor(): MarkdownEditorApi;
|
|
414
|
-
|
|
415
|
-
/** Default toolbar groups, handed to a `toolbar` render function */
|
|
416
|
-
type ToolbarItems = Readonly<{
|
|
417
|
-
format: ReactElement;
|
|
418
|
-
insert: ReactElement;
|
|
419
|
-
history: ReactElement;
|
|
420
|
-
}>;
|
|
421
|
-
type Props = Omit<EditorRootProps, 'children'> & Readonly<{
|
|
422
|
-
placeholder?: string;
|
|
423
|
-
/**
|
|
424
|
-
* Toolbar in edit-md mode (default true). Pass a function to customise
|
|
425
|
-
* it: it receives the default groups and returns the toolbar to render.
|
|
426
|
-
*/
|
|
427
|
-
toolbar?: boolean | ((items: ToolbarItems) => ReactNode);
|
|
428
|
-
/** Show a table-of-contents sidebar listing the document's headings */
|
|
429
|
-
outline?: boolean;
|
|
430
|
-
/** Allow collapsing sections under their headings (default true) */
|
|
431
|
-
foldable?: boolean;
|
|
432
|
-
}>;
|
|
433
|
-
/**
|
|
434
|
-
* Toolbar that only shows while the document is editable in `edit-md` mode.
|
|
435
|
-
* Used by `MarkdownEditor` and available as `MarkdownEditor.Toolbar` for
|
|
436
|
-
* compound layouts.
|
|
437
|
-
*/
|
|
438
|
-
declare function EditorToolbar({ children, className, }: Readonly<{
|
|
439
|
-
children?: ReactNode;
|
|
440
|
-
className?: string;
|
|
441
|
-
}>): ReactElement | null;
|
|
442
|
-
declare function MarkdownEditor({ placeholder, toolbar, outline, foldable, ...rootProps }: Props): react_jsx_runtime.JSX.Element;
|
|
443
|
-
declare namespace MarkdownEditor {
|
|
444
|
-
var Root: typeof EditorRoot;
|
|
445
|
-
var Content: typeof EditorContent;
|
|
446
|
-
var Toolbar: typeof EditorToolbar;
|
|
447
|
-
var ToolbarButton: typeof ToolbarButton;
|
|
448
|
-
var ToolbarDivider: typeof ToolbarDivider;
|
|
449
|
-
var FormatButtons: typeof FormatButtons;
|
|
450
|
-
var InsertButtons: typeof InsertButtons;
|
|
451
|
-
var HistoryButtons: typeof HistoryButtons;
|
|
452
|
-
var Outline: typeof OutlinePlugin;
|
|
453
|
-
var useEditor: typeof useMarkdownEditor;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
type ToolbarProps = Readonly<{
|
|
457
|
-
children?: ReactNode;
|
|
458
|
-
className?: string;
|
|
459
|
-
}>;
|
|
460
|
-
/** Toolbar container. Renders the default items when given no children. */
|
|
461
|
-
declare function Toolbar({ children, className }: ToolbarProps): ReactElement;
|
|
462
|
-
declare function ToolbarDivider(): ReactElement;
|
|
463
|
-
type ToolbarButtonProps = Readonly<{
|
|
464
|
-
label: string;
|
|
465
|
-
onClick: () => void;
|
|
466
|
-
/** Icon content — an SVG, emoji, or text. 16px SVGs match the built-ins. */
|
|
467
|
-
children: ReactNode;
|
|
468
|
-
active?: boolean;
|
|
469
|
-
disabled?: boolean;
|
|
470
|
-
className?: string;
|
|
471
|
-
}>;
|
|
472
|
-
/**
|
|
473
|
-
* Button styled like the built-in toolbar buttons. Prevents focus from
|
|
474
|
-
* leaving the editor on click so the selection is preserved.
|
|
475
|
-
*/
|
|
476
|
-
declare function ToolbarButton({ label, onClick, children, active, disabled, className, }: ToolbarButtonProps): ReactElement;
|
|
477
|
-
/** Bold / italic / strikethrough / inline-code buttons */
|
|
478
|
-
declare function FormatButtons(): ReactElement;
|
|
479
|
-
/** Insert-table / insert-drawing buttons */
|
|
480
|
-
declare function InsertButtons(): ReactElement;
|
|
481
|
-
/** Undo / redo buttons */
|
|
482
|
-
declare function HistoryButtons(): ReactElement;
|
|
483
|
-
|
|
484
|
-
type SerializedFrontmatterNode = SerializedElementNode;
|
|
485
|
-
/**
|
|
486
|
-
* A block node holding a document's YAML frontmatter — the metadata section
|
|
487
|
-
* delimited by `---` lines at the very top of a markdown file (as used by
|
|
488
|
-
* Claude skills, static-site generators, etc.).
|
|
489
|
-
*
|
|
490
|
-
* Content is stored as plain TextNode children separated by LineBreakNodes, so
|
|
491
|
-
* `getTextContent()` yields the raw YAML with `\n` line separators — exactly
|
|
492
|
-
* what the FRONTMATTER transformer re-serializes on export.
|
|
493
|
-
*/
|
|
494
|
-
declare class FrontmatterNode extends ElementNode {
|
|
495
|
-
static getType(): string;
|
|
496
|
-
static clone(node: FrontmatterNode): FrontmatterNode;
|
|
497
|
-
constructor(key?: NodeKey);
|
|
498
|
-
createDOM(config: EditorConfig): HTMLElement;
|
|
499
|
-
updateDOM(): boolean;
|
|
500
|
-
static importJSON(_serializedNode: SerializedFrontmatterNode): FrontmatterNode;
|
|
501
|
-
exportJSON(): SerializedFrontmatterNode;
|
|
502
|
-
isInline(): false;
|
|
503
|
-
canBeEmpty(): boolean;
|
|
504
|
-
canIndent(): false;
|
|
505
|
-
}
|
|
506
|
-
declare function $createFrontmatterNode(): FrontmatterNode;
|
|
507
|
-
declare function $isFrontmatterNode(node: LexicalNode | null | undefined): node is FrontmatterNode;
|
|
508
|
-
/**
|
|
509
|
-
* Markdown transformer for a leading YAML frontmatter block:
|
|
510
|
-
*
|
|
511
|
-
* ```
|
|
512
|
-
* ---
|
|
513
|
-
* name: my-skill
|
|
514
|
-
* description: ...
|
|
515
|
-
* ---
|
|
516
|
-
* ```
|
|
517
|
-
*
|
|
518
|
-
* Import only claims the block when it's the very first thing in the document
|
|
519
|
-
* (frontmatter is defined as leading metadata); a `---` fence appearing later
|
|
520
|
-
* falls through to normal handling. Must be ordered before other multiline
|
|
521
|
-
* transformers so its `export` runs first for a FrontmatterNode.
|
|
522
|
-
*/
|
|
523
|
-
declare const FRONTMATTER: MultilineElementTransformer;
|
|
524
|
-
|
|
525
|
-
type SerializedDrawingNode = Spread<{
|
|
526
|
-
data: string;
|
|
527
|
-
}, SerializedLexicalNode>;
|
|
528
|
-
/**
|
|
529
|
-
* A block-level decorator node embedding a vector diagram (cards, connectors,
|
|
530
|
-
* text) edited on a canvas.
|
|
531
|
-
*
|
|
532
|
-
* The drawing is stored as a JSON string and round-trips through markdown as
|
|
533
|
-
* a ```drawing fenced code block, so documents remain plain markdown.
|
|
534
|
-
*/
|
|
535
|
-
declare class DrawingNode extends DecoratorNode<ReactElement> {
|
|
536
|
-
__data: string;
|
|
537
|
-
static getType(): string;
|
|
538
|
-
static clone(node: DrawingNode): DrawingNode;
|
|
539
|
-
constructor(data: string, key?: NodeKey);
|
|
540
|
-
static importJSON(serializedNode: SerializedDrawingNode): DrawingNode;
|
|
541
|
-
exportJSON(): SerializedDrawingNode;
|
|
542
|
-
createDOM(config: EditorConfig): HTMLElement;
|
|
543
|
-
updateDOM(): false;
|
|
544
|
-
exportDOM(): DOMExportOutput;
|
|
545
|
-
static importDOM(): DOMConversionMap | null;
|
|
546
|
-
getData(): DrawingData;
|
|
547
|
-
setData(data: DrawingData): void;
|
|
548
|
-
isInline(): false;
|
|
549
|
-
decorate(_editor: LexicalEditor, _config: EditorConfig): ReactElement;
|
|
550
|
-
}
|
|
551
|
-
declare function $createDrawingNode(data?: string): DrawingNode;
|
|
552
|
-
declare function $isDrawingNode(node: LexicalNode | null | undefined): node is DrawingNode;
|
|
553
|
-
/**
|
|
554
|
-
* Markdown transformer persisting drawings as fenced ```drawing blocks with a
|
|
555
|
-
* JSON payload. Must be ordered before the built-in CODE transformer so it
|
|
556
|
-
* claims the fence first on import.
|
|
557
|
-
*/
|
|
558
|
-
declare const DRAWING: MultilineElementTransformer;
|
|
559
|
-
/**
|
|
560
|
-
* Import-only transformer for ```diagram blocks: a compact skeleton
|
|
561
|
-
* (boxes, connectors by id, auto layout) that expands into a full drawing.
|
|
562
|
-
* Once in the editor the node is a regular drawing and exports as
|
|
563
|
-
* ```drawing, so the expansion is one-way.
|
|
564
|
-
*/
|
|
565
|
-
declare const DIAGRAM: MultilineElementTransformer;
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Markdown transformer for GFM tables. Adapted from the Lexical playground.
|
|
569
|
-
* Rows are matched line-by-line on import and stitched into a single
|
|
570
|
-
* TableNode; the divider row promotes the row above it to a header row.
|
|
571
|
-
* A `<!-- width: text; density: compact -->` settings line directly
|
|
572
|
-
* above the table (see tableSettings.ts) is consumed on import and
|
|
573
|
-
* re-emitted on export.
|
|
574
|
-
*/
|
|
575
|
-
declare const TABLE: ElementTransformer;
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* JSON Schema (draft-07) for the payload of a ```drawing fenced block
|
|
579
|
-
* (format version 2).
|
|
580
|
-
*
|
|
581
|
-
* Use it to validate LLM- or tool-generated drawings before embedding them,
|
|
582
|
-
* or pass it as a structured-output / tool schema so a model is forced to
|
|
583
|
-
* emit valid payloads. Kept in sync with `parseDrawingData` /
|
|
584
|
-
* `normalizeShape` in types.ts; update both together.
|
|
585
|
-
*
|
|
586
|
-
* For generation prefer the ```diagram skeleton
|
|
587
|
-
* (`DRAWING_SKELETON_JSON_SCHEMA`): it needs no coordinates and expands into
|
|
588
|
-
* this format on import.
|
|
589
|
-
*/
|
|
590
|
-
declare const DRAWING_DATA_JSON_SCHEMA: {
|
|
591
|
-
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
592
|
-
readonly title: "DrawingData";
|
|
593
|
-
readonly description: "Vector drawing embedded in markdown as a ```drawing fenced code block (format version 2)";
|
|
594
|
-
readonly type: "object";
|
|
595
|
-
readonly required: readonly ["version", "canvasHeight", "shapes"];
|
|
596
|
-
readonly additionalProperties: false;
|
|
597
|
-
readonly properties: {
|
|
598
|
-
readonly version: {
|
|
599
|
-
readonly const: 2;
|
|
600
|
-
readonly description: "Format version; always 2";
|
|
601
|
-
};
|
|
602
|
-
readonly canvasHeight: {
|
|
603
|
-
readonly type: "number";
|
|
604
|
-
readonly minimum: 80;
|
|
605
|
-
readonly description: "Canvas height in pixels. Make it large enough to contain every shape plus ~20px margin.";
|
|
606
|
-
};
|
|
607
|
-
readonly canvasWidth: {
|
|
608
|
-
readonly type: "number";
|
|
609
|
-
readonly minimum: 120;
|
|
610
|
-
readonly description: "Optional logical canvas width in pixels. When set, the drawing is scaled down to fit narrower layouts (SVG viewBox) so coordinates can assume this width. When omitted the canvas is fluid and coordinates are CSS pixels.";
|
|
611
|
-
};
|
|
612
|
-
readonly width: {
|
|
613
|
-
readonly enum: readonly ["full", "text", "content"];
|
|
614
|
-
readonly description: "Block width: \"full\" (default, omit it) spans the editor; \"text\" aligns the block with the text column (same as \"full\" unless the app sets a text measure); \"content\" fits the shapes' horizontal extent and left-aligns with the text";
|
|
615
|
-
};
|
|
616
|
-
readonly shapes: {
|
|
617
|
-
readonly type: "array";
|
|
618
|
-
readonly items: {
|
|
619
|
-
readonly $ref: "#/definitions/shape";
|
|
620
|
-
};
|
|
621
|
-
readonly description: "Render order: later shapes draw on top";
|
|
622
|
-
};
|
|
623
|
-
};
|
|
624
|
-
readonly definitions: {
|
|
625
|
-
readonly point: {
|
|
626
|
-
readonly type: "object";
|
|
627
|
-
readonly required: readonly ["x", "y"];
|
|
628
|
-
readonly additionalProperties: false;
|
|
629
|
-
readonly properties: {
|
|
630
|
-
readonly x: {
|
|
631
|
-
readonly type: "number";
|
|
632
|
-
readonly description: "Absolute canvas x";
|
|
633
|
-
};
|
|
634
|
-
readonly y: {
|
|
635
|
-
readonly type: "number";
|
|
636
|
-
readonly description: "Absolute canvas y";
|
|
637
|
-
};
|
|
638
|
-
};
|
|
639
|
-
};
|
|
640
|
-
readonly binding: {
|
|
641
|
-
readonly type: "object";
|
|
642
|
-
readonly description: "Where a connector endpoint attaches to a box. Omit fixedPoint to let the endpoint auto-aim from the box center at the other end.";
|
|
643
|
-
readonly required: readonly ["id"];
|
|
644
|
-
readonly additionalProperties: false;
|
|
645
|
-
readonly properties: {
|
|
646
|
-
readonly id: {
|
|
647
|
-
readonly type: "string";
|
|
648
|
-
readonly description: "Id of the box this endpoint is attached to";
|
|
649
|
-
};
|
|
650
|
-
readonly fixedPoint: {
|
|
651
|
-
readonly type: "array";
|
|
652
|
-
readonly items: {
|
|
653
|
-
readonly type: "number";
|
|
654
|
-
readonly minimum: 0;
|
|
655
|
-
readonly maximum: 1;
|
|
656
|
-
};
|
|
657
|
-
readonly minItems: 2;
|
|
658
|
-
readonly maxItems: 2;
|
|
659
|
-
readonly description: "Attach point as a ratio of the box's bounding box: [0,0] top-left, [1,1] bottom-right, [0.5,0] top edge midpoint, [1,0.5] right edge midpoint. Omitted: the endpoint auto-aims from the box center at the other end.";
|
|
660
|
-
};
|
|
661
|
-
readonly mode: {
|
|
662
|
-
readonly enum: readonly ["orbit", "inside"];
|
|
663
|
-
readonly description: "\"orbit\" (default): the endpoint is projected onto the box outline with a 6px gap. \"inside\": the endpoint sits exactly on the fixed point.";
|
|
664
|
-
};
|
|
665
|
-
};
|
|
666
|
-
};
|
|
667
|
-
readonly shape: {
|
|
668
|
-
readonly type: "object";
|
|
669
|
-
readonly required: readonly ["id", "type", "x", "y", "w", "h", "stroke", "fill", "strokeWidth"];
|
|
670
|
-
readonly additionalProperties: false;
|
|
671
|
-
readonly properties: {
|
|
672
|
-
readonly id: {
|
|
673
|
-
readonly type: "string";
|
|
674
|
-
readonly description: "Unique within the drawing; connector bindings reference it";
|
|
675
|
-
};
|
|
676
|
-
readonly type: {
|
|
677
|
-
readonly enum: readonly ["rect", "ellipse", "diamond", "note", "cylinder", "cloud", "queue", "actor", "arrow", "line", "text"];
|
|
678
|
-
readonly description: "Boxes (cards with label/text/footer slots): rect, ellipse, diamond, note (sticky note with a folded corner), cylinder (database), cloud, queue (horizontal cylinder), actor (stick figure; only the text slot, rendered as a name under the figure). Connectors: arrow (head at the end), line. Free-floating annotation: text.";
|
|
679
|
-
};
|
|
680
|
-
readonly x: {
|
|
681
|
-
readonly type: "number";
|
|
682
|
-
readonly description: "Boxes/text: left edge of the bounding box. Connectors: start point x.";
|
|
683
|
-
};
|
|
684
|
-
readonly y: {
|
|
685
|
-
readonly type: "number";
|
|
686
|
-
readonly description: "Boxes/text: top edge of the bounding box. Connectors: start point y.";
|
|
687
|
-
};
|
|
688
|
-
readonly w: {
|
|
689
|
-
readonly type: "number";
|
|
690
|
-
readonly description: "Boxes/text: width (non-negative). Connectors: delta x to the end point (may be negative).";
|
|
691
|
-
};
|
|
692
|
-
readonly h: {
|
|
693
|
-
readonly type: "number";
|
|
694
|
-
readonly description: "Boxes/text: height (non-negative). Connectors: delta y to the end point (may be negative).";
|
|
695
|
-
};
|
|
696
|
-
readonly stroke: {
|
|
697
|
-
readonly type: "string";
|
|
698
|
-
readonly description: "CSS color of the outline (and of any text). Palette: #1e1e1e (default), #e03131 red, #2f9e44 green, #1971c2 blue, #f08c00 orange, #7048e8 purple.";
|
|
699
|
-
};
|
|
700
|
-
readonly fill: {
|
|
701
|
-
readonly type: "string";
|
|
702
|
-
readonly description: "CSS color of the interior; \"transparent\" for none. Palette: #ffc9c9 red, #b2f2bb green, #a5d8ff blue, #ffec99 yellow, #d0bfff purple.";
|
|
703
|
-
};
|
|
704
|
-
readonly strokeWidth: {
|
|
705
|
-
readonly type: "number";
|
|
706
|
-
readonly description: "Outline width; use 2";
|
|
707
|
-
};
|
|
708
|
-
readonly text: {
|
|
709
|
-
readonly type: "string";
|
|
710
|
-
readonly description: "Standalone text content; center content of a box (the name under an actor); midpoint label of a connector";
|
|
711
|
-
};
|
|
712
|
-
readonly label: {
|
|
713
|
-
readonly type: "string";
|
|
714
|
-
readonly description: "Boxes only (not actor): small bold heading at the top";
|
|
715
|
-
};
|
|
716
|
-
readonly footer: {
|
|
717
|
-
readonly type: "string";
|
|
718
|
-
readonly description: "Boxes only (not actor): small dim line at the bottom";
|
|
719
|
-
};
|
|
720
|
-
readonly startBinding: {
|
|
721
|
-
readonly $ref: "#/definitions/binding";
|
|
722
|
-
readonly description: "Connectors only: box the start point attaches to. The editor re-anchors the endpoint onto that box and keeps it attached as the box moves.";
|
|
723
|
-
};
|
|
724
|
-
readonly endBinding: {
|
|
725
|
-
readonly $ref: "#/definitions/binding";
|
|
726
|
-
readonly description: "Connectors only: box the end point attaches to";
|
|
727
|
-
};
|
|
728
|
-
readonly bidirectional: {
|
|
729
|
-
readonly type: "boolean";
|
|
730
|
-
readonly description: "Arrows only: arrowheads on both ends";
|
|
731
|
-
};
|
|
732
|
-
readonly routing: {
|
|
733
|
-
readonly const: "elbow";
|
|
734
|
-
readonly description: "Connectors only: right-angled auto-routed path. It leaves the box perpendicular to the attach side, avoids every box on the canvas and minimises bends. Ignored when waypoints are present.";
|
|
735
|
-
};
|
|
736
|
-
readonly elbow: {
|
|
737
|
-
readonly type: "number";
|
|
738
|
-
readonly minimum: 0;
|
|
739
|
-
readonly maximum: 1;
|
|
740
|
-
readonly description: "Elbow override: position of the middle segment as a fraction of the span. Applied only when the routed path is a simple three-segment Z.";
|
|
741
|
-
};
|
|
742
|
-
readonly waypoints: {
|
|
743
|
-
readonly type: "array";
|
|
744
|
-
readonly items: {
|
|
745
|
-
readonly $ref: "#/definitions/point";
|
|
746
|
-
};
|
|
747
|
-
readonly description: "Connectors only: intermediate path points in canvas coordinates, ordered start to end. Takes precedence over routing.";
|
|
748
|
-
};
|
|
749
|
-
};
|
|
750
|
-
};
|
|
751
|
-
};
|
|
1
|
+
import { M as MarkdownEditorProps, E as EditorRootProps, a as EditorContent, T as ToolbarButton, b as ToolbarDivider, F as FormatButtons, B as BlockButtons, I as InsertButtons, H as HistoryButtons, O as OutlinePlugin, C as CharacterCount } from './table-grid-D70tNhp2.js';
|
|
2
|
+
export { D as DEFAULT_LABELS, c as DEFAULT_TABLE_SETTINGS, d as DeepPartial, e as EditorContentProps, f as EditorFieldProps, g as EditorLabels, h as EditorLabelsInput, i as EditorMode, j as TABLE_WIDTH_MARKER, k as TableCellPosition, l as TableDensity, m as TableSettings, n as TableSettingsOptions, o as Toolbar, p as ToolbarItems, q as canDeleteColumn, r as canDeleteRow, s as formatTableSettingsMarker, t as insertableColumnIndices, u as insertableRowIndices, v as parseTableSettingsMarker, w as resolveLabels, x as useEditorContext, y as useLabels } from './table-grid-D70tNhp2.js';
|
|
3
|
+
export { B as BUILTIN_CODE_LANGUAGES, a as BlockType, C as CODE_TOKEN_TYPES, b as CodeGrammar, c as CodeRule, d as CodeToken, e as CodeTokenType, f as CollapsibleHeadingsLabels, E as EDIT_LINK_COMMAND, M as MarkdownEditorApi, P as PLAIN_LANGUAGE, S as SAFE_LINK_PROTOCOLS, T as TOOLBAR_ITEM_ATTRIBUTE, g as TableColumnShortcutsLabels, h as TableRowShortcutsLabels, i as getCodeLanguages, j as hasCodeLanguage, k as isSafeUrl, r as registerCodeLanguage, l as resolveCodeLanguage, t as tokenizeCode, u as useMarkdownEditor, m as useToolbarKeyboard } from './index-A4S7bRwQ.js';
|
|
4
|
+
export { B as BLOCK_WIDTHS, a as BlockWidth, D as DrawingStyle, N as NewBlockWidths, i as isBlockWidth } from './presets-BtNPH0pa.js';
|
|
5
|
+
import * as react from 'react';
|
|
6
|
+
export { C as COLOR_PRESETS, a as ColorName, D as DRAWING_DATA_JSON_SCHEMA, b as DRAWING_FOCUS_COMMAND, c as DRAWING_SKELETON_JSON_SCHEMA, d as DrawingPlugin, e as DrawingSkeleton, I as INSERT_DRAWING_COMMAND, M as MermaidDirection, f as MermaidOptions, N as NODE_SHAPE_DEFINITIONS, g as NodeShapeDefinition, S as SkeletonBox, h as SkeletonConnector, i as SkeletonEnd, j as SkeletonText, T as TextField, k as createBinding, l as drawingToMermaid, m as expandDrawingSkeleton, n as findNodeShapeAt, o as isDrawingSkeleton, p as parseDrawingSkeleton } from './mermaid-BwGHjwpk.js';
|
|
7
|
+
export { B as Binding, a as BindingSide, C as CONNECTOR_TYPES, b as ConnectorType, D as DrawingData, c as DrawingShape, d as DrawingShapeType, E as EMPTY_DRAWING, F as FILL_COLORS, N as NODE_SHAPE_TYPES, e as NodeShapeType, P as Point, S as SHAPE_TYPES, f as SIDE_FIXED_POINTS, g as STROKE_COLORS, h as deserializeDrawingData, i as isNodeShapeType, n as normalizeDrawingData, s as serializeDrawingData } from './drawing-data-EWzEQ1_i.js';
|
|
8
|
+
export { D as DEFAULT_MENTIONS_LABELS, I as INSERT_MENTION_COMMAND, a as InsertMentionPayload, M as MentionItem, b as MentionMatch, c as MentionRenderState, d as MentionTrigger, e as MentionsLabels, f as MentionsPlugin, g as MentionsPluginProps, h as findMentionMatch } from './mentions-plugin-gio3_XKd.js';
|
|
9
|
+
export { ADD_COMMENT_COMMAND, COMMENTS_THEME, Comment, CommentActions, CommentRange, CommentsLabels, CommentsPlugin, CommentsPluginProps, DEFAULT_COMMENTS_LABELS } from './comments.js';
|
|
10
|
+
export { f as formatCommentMarker, p as parseCommentIds } from './comment-markers-BrrrAdSL.js';
|
|
11
|
+
export { INSERT_IMAGE_COMMAND, ImageButton, ImageError, ImagesPlugin, ImagesPluginProps, InsertImagePayload, UPLOAD_IMAGES_COMMAND, UploadedImage } from './images.js';
|
|
12
|
+
export { D as DEFAULT_IMAGES_LABELS, I as ImagesLabels } from './image-node-kR1Zf5kz.js';
|
|
13
|
+
export { PasteNormalizeOptions, PastePlugin, PastePluginProps, isRichSourceHtml, normalizePastedHtml } from './paste.js';
|
|
14
|
+
import 'lexical';
|
|
15
|
+
import '@lexical/table';
|
|
16
|
+
import '@lexical/rich-text';
|
|
17
|
+
import '@lexical/markdown';
|
|
18
|
+
import '@lexical/mark';
|
|
19
|
+
|
|
20
|
+
declare const MarkdownEditor: {
|
|
21
|
+
({ placeholder, toolbar, outline, collapsible, showCharacterCount, children, ...rootProps }: MarkdownEditorProps): react.ReactElement;
|
|
22
|
+
Root: (props: Omit<EditorRootProps, "preset">) => react.ReactElement;
|
|
23
|
+
Content: typeof EditorContent;
|
|
24
|
+
Toolbar: ({ children, className, }: Readonly<{
|
|
25
|
+
children?: react.ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
}>) => react.ReactElement | null;
|
|
28
|
+
ToolbarButton: typeof ToolbarButton;
|
|
29
|
+
ToolbarDivider: typeof ToolbarDivider;
|
|
30
|
+
FormatButtons: typeof FormatButtons;
|
|
31
|
+
BlockButtons: typeof BlockButtons;
|
|
32
|
+
InsertButtons: typeof InsertButtons;
|
|
33
|
+
HistoryButtons: typeof HistoryButtons;
|
|
34
|
+
Outline: typeof OutlinePlugin;
|
|
35
|
+
CharacterCount: typeof CharacterCount;
|
|
752
36
|
};
|
|
753
37
|
|
|
754
|
-
|
|
755
|
-
x: number;
|
|
756
|
-
y: number;
|
|
757
|
-
w: number;
|
|
758
|
-
h: number;
|
|
759
|
-
}>;
|
|
760
|
-
|
|
761
|
-
declare function boxOutline(box: DrawingShape): Point[];
|
|
762
|
-
/** Topmost box under a point, if any; smaller boxes win over enclosing ones */
|
|
763
|
-
declare function findBoxAt(shapes: readonly DrawingShape[], point: Point, excludeId?: string, tolerance?: number): DrawingShape | null;
|
|
764
|
-
/** The point a binding refers to: its fixed point, or the box center */
|
|
765
|
-
declare function anchorPoint(box: DrawingShape, binding?: Binding): Point;
|
|
766
|
-
/**
|
|
767
|
-
* Fixed point for a drop at `point`: undefined (auto-aim) for drops near
|
|
768
|
-
* the center, otherwise a ratio snapped onto the nearest bounding-box edge.
|
|
769
|
-
*/
|
|
770
|
-
declare function fixedPointFor(box: DrawingShape, point: Point): [number, number] | undefined;
|
|
771
|
-
/**
|
|
772
|
-
* Recompute the endpoints of every bound connector from the current
|
|
773
|
-
* positions of the boxes they're attached to, and drop bindings whose box
|
|
774
|
-
* no longer exists. Idempotent, so it can run after every shape update.
|
|
775
|
-
*/
|
|
776
|
-
declare function resolveBindings(shapes: readonly DrawingShape[]): readonly DrawingShape[];
|
|
777
|
-
/** Attach a freshly drawn connector to the boxes under its endpoints */
|
|
778
|
-
declare function bindEndpoints(shape: DrawingShape, shapes: readonly DrawingShape[]): DrawingShape;
|
|
779
|
-
declare function makeBinding(box: DrawingShape, point: Point): Binding;
|
|
780
|
-
|
|
781
|
-
/** Vertices of a connector's path, start to end */
|
|
782
|
-
declare function connectorPoints(shape: DrawingShape, shapes?: readonly DrawingShape[]): Point[];
|
|
783
|
-
|
|
784
|
-
/**
|
|
785
|
-
* Orthogonal route for an elbow connector: leaves each bound box
|
|
786
|
-
* perpendicular to its attach side, avoids every box on the canvas, and
|
|
787
|
-
* takes the path with the fewest bends (then the shortest). Falls back to
|
|
788
|
-
* a plain L when the grid search fails.
|
|
789
|
-
*/
|
|
790
|
-
declare function routeElbow(shape: DrawingShape, shapes: readonly DrawingShape[]): Point[];
|
|
791
|
-
|
|
792
|
-
type TextField = 'text' | 'label' | 'footer';
|
|
793
|
-
/**
|
|
794
|
-
* Geometry of a box type, kept free of React so the router, bindings,
|
|
795
|
-
* skeleton expansion and exporters can use it without a DOM.
|
|
796
|
-
*/
|
|
797
|
-
type BoxDefinition = Readonly<{
|
|
798
|
-
type: BoxType;
|
|
799
|
-
label: string;
|
|
800
|
-
/** Size used when a shape is created without explicit dimensions */
|
|
801
|
-
defaultSize: Readonly<{
|
|
802
|
-
w: number;
|
|
803
|
-
h: number;
|
|
804
|
-
}>;
|
|
805
|
-
/** Text slots the shape renders (and offers for editing) */
|
|
806
|
-
textSlots: readonly TextField[];
|
|
807
|
-
/** Fill applied when the tool is picked with the default (transparent) fill */
|
|
808
|
-
defaultFill?: string;
|
|
809
|
-
/** Closed outline used for hit-testing and binding endpoints */
|
|
810
|
-
outline: (shape: DrawingShape) => Point[];
|
|
811
|
-
/** Area the text slots lay out in */
|
|
812
|
-
textArea: (shape: DrawingShape) => Rect;
|
|
813
|
-
}>;
|
|
814
|
-
declare const BOX_DEFINITIONS: Record<BoxType, BoxDefinition>;
|
|
815
|
-
|
|
816
|
-
/**
|
|
817
|
-
* Skeleton (intent) layer: a compact, LLM-friendly description of a diagram
|
|
818
|
-
* — boxes, connectors between them and loose texts — that expands into a
|
|
819
|
-
* full `DrawingData` document. Sizes, positions and connector geometry are
|
|
820
|
-
* derived, so a generator only needs to say *what* is on the canvas.
|
|
821
|
-
*/
|
|
822
|
-
|
|
823
|
-
type ColorName = 'plain' | 'black' | 'gray' | 'red' | 'green' | 'blue' | 'orange' | 'purple';
|
|
824
|
-
declare const COLOR_PRESETS: Record<ColorName, {
|
|
825
|
-
stroke: string;
|
|
826
|
-
fill: string;
|
|
827
|
-
}>;
|
|
828
|
-
type SkeletonBox = Readonly<{
|
|
829
|
-
id: string;
|
|
830
|
-
/** Default `'rect'` */
|
|
831
|
-
type?: BoxType;
|
|
832
|
-
label?: string;
|
|
833
|
-
text?: string;
|
|
834
|
-
footer?: string;
|
|
835
|
-
/** Omitted → auto layout */
|
|
836
|
-
x?: number;
|
|
837
|
-
y?: number;
|
|
838
|
-
/** Omitted → measured from the text, never smaller than the type's default size */
|
|
839
|
-
w?: number;
|
|
840
|
-
h?: number;
|
|
841
|
-
/** Preset → stroke + fill (fill only when `fill` isn't given) */
|
|
842
|
-
color?: ColorName;
|
|
843
|
-
stroke?: string;
|
|
844
|
-
fill?: string;
|
|
845
|
-
}>;
|
|
846
|
-
type SkeletonEnd = string | Readonly<{
|
|
847
|
-
id: string;
|
|
848
|
-
side?: BindingSide;
|
|
849
|
-
}>;
|
|
850
|
-
type SkeletonConnector = Readonly<{
|
|
851
|
-
id?: string;
|
|
852
|
-
/** Default `'arrow'` */
|
|
853
|
-
type?: ConnectorType;
|
|
854
|
-
from: SkeletonEnd;
|
|
855
|
-
to: SkeletonEnd;
|
|
856
|
-
text?: string;
|
|
857
|
-
bidirectional?: boolean;
|
|
858
|
-
/** Default `'straight'` */
|
|
859
|
-
routing?: 'elbow' | 'straight';
|
|
860
|
-
color?: ColorName;
|
|
861
|
-
stroke?: string;
|
|
862
|
-
}>;
|
|
863
|
-
type SkeletonText = Readonly<{
|
|
864
|
-
id?: string;
|
|
865
|
-
x: number;
|
|
866
|
-
y: number;
|
|
867
|
-
text: string;
|
|
868
|
-
color?: ColorName;
|
|
869
|
-
stroke?: string;
|
|
870
|
-
}>;
|
|
871
|
-
type DrawingSkeleton = Readonly<{
|
|
872
|
-
/** Auto-layout flow direction, default `'right'` */
|
|
873
|
-
direction?: 'right' | 'down';
|
|
874
|
-
canvasWidth?: number;
|
|
875
|
-
canvasHeight?: number;
|
|
876
|
-
/** Block width of the expanded drawing; omit for `full` */
|
|
877
|
-
width?: BlockWidth;
|
|
878
|
-
boxes: readonly SkeletonBox[];
|
|
879
|
-
connectors?: readonly SkeletonConnector[];
|
|
880
|
-
texts?: readonly SkeletonText[];
|
|
881
|
-
}>;
|
|
882
|
-
/** Structural check: an object with a `boxes` array */
|
|
883
|
-
declare function isDrawingSkeleton(value: unknown): value is DrawingSkeleton;
|
|
884
|
-
/**
|
|
885
|
-
* Parse a skeleton JSON payload into drawing data. Lenient: invalid boxes,
|
|
886
|
-
* connectors and texts are dropped individually, and a malformed document
|
|
887
|
-
* yields an empty canvas. Never throws.
|
|
888
|
-
*/
|
|
889
|
-
declare function parseDrawingSkeleton(json: string): DrawingData;
|
|
890
|
-
declare function expandSkeleton(skeleton: DrawingSkeleton): DrawingData;
|
|
891
|
-
declare const DRAWING_SKELETON_JSON_SCHEMA: {
|
|
892
|
-
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
893
|
-
readonly title: "DrawingSkeleton";
|
|
894
|
-
readonly description: "Compact intent description of a diagram. Boxes are sized from their text and laid out automatically along the connector flow; connectors are drawn between box outlines. Only say what is on the canvas — geometry is derived";
|
|
895
|
-
readonly type: "object";
|
|
896
|
-
readonly required: readonly ["boxes"];
|
|
897
|
-
readonly additionalProperties: false;
|
|
898
|
-
readonly properties: {
|
|
899
|
-
readonly direction: {
|
|
900
|
-
readonly enum: readonly ["right", "down"];
|
|
901
|
-
readonly description: "Auto-layout flow direction. Boxes connected a→b are placed in successive ranks along this axis (\"right\" = columns left to right, \"down\" = rows top to bottom). Default \"right\"";
|
|
902
|
-
};
|
|
903
|
-
readonly canvasWidth: {
|
|
904
|
-
readonly type: "number";
|
|
905
|
-
readonly minimum: 120;
|
|
906
|
-
readonly description: "Logical canvas width in px. Omit for a fluid canvas in CSS pixels";
|
|
907
|
-
};
|
|
908
|
-
readonly canvasHeight: {
|
|
909
|
-
readonly type: "number";
|
|
910
|
-
readonly minimum: 80;
|
|
911
|
-
readonly description: "Canvas height in px. Omit to fit the content";
|
|
912
|
-
};
|
|
913
|
-
readonly width: {
|
|
914
|
-
readonly enum: readonly ["full", "text", "content"];
|
|
915
|
-
readonly description: "Block width: \"text\" aligns the drawing with the text column (same as \"full\" unless the app sets a text measure); \"content\" fits the drawing to its shapes and left-aligns it with the text; omit to span the editor";
|
|
916
|
-
};
|
|
917
|
-
readonly boxes: {
|
|
918
|
-
readonly type: "array";
|
|
919
|
-
readonly items: {
|
|
920
|
-
readonly $ref: "#/definitions/box";
|
|
921
|
-
};
|
|
922
|
-
readonly description: "Card-like shapes carrying up to three text slots. Order is the render order and the stacking order within a layout rank";
|
|
923
|
-
};
|
|
924
|
-
readonly connectors: {
|
|
925
|
-
readonly type: "array";
|
|
926
|
-
readonly items: {
|
|
927
|
-
readonly $ref: "#/definitions/connector";
|
|
928
|
-
};
|
|
929
|
-
readonly description: "Arrows and lines between boxes. Connectors whose from/to id does not match a box are dropped";
|
|
930
|
-
};
|
|
931
|
-
readonly texts: {
|
|
932
|
-
readonly type: "array";
|
|
933
|
-
readonly items: {
|
|
934
|
-
readonly $ref: "#/definitions/text";
|
|
935
|
-
};
|
|
936
|
-
readonly description: "Free-floating annotations not attached to any box. Prefer box slots (label/text/footer) when the text belongs to a box";
|
|
937
|
-
};
|
|
938
|
-
};
|
|
939
|
-
readonly definitions: {
|
|
940
|
-
readonly box: {
|
|
941
|
-
readonly type: "object";
|
|
942
|
-
readonly required: readonly ["id"];
|
|
943
|
-
readonly additionalProperties: false;
|
|
944
|
-
readonly properties: {
|
|
945
|
-
readonly id: {
|
|
946
|
-
readonly type: "string";
|
|
947
|
-
readonly description: "Unique within the drawing; connectors reference it";
|
|
948
|
-
};
|
|
949
|
-
readonly type: {
|
|
950
|
-
readonly enum: readonly BoxType[];
|
|
951
|
-
readonly description: "Shape: rect (default), ellipse, diamond (decision), note (sticky note, yellow by default), cylinder (database), cloud (external system), queue (message queue), actor (stick figure; only the \"text\" slot renders, below the figure)";
|
|
952
|
-
};
|
|
953
|
-
readonly label: {
|
|
954
|
-
readonly type: "string";
|
|
955
|
-
readonly description: "Small bold heading at the top of the box";
|
|
956
|
-
};
|
|
957
|
-
readonly text: {
|
|
958
|
-
readonly type: "string";
|
|
959
|
-
readonly description: "Main content, centered. Wraps automatically; \"\\n\" forces a line break";
|
|
960
|
-
};
|
|
961
|
-
readonly footer: {
|
|
962
|
-
readonly type: "string";
|
|
963
|
-
readonly description: "Small dim line at the bottom of the box";
|
|
964
|
-
};
|
|
965
|
-
readonly x: {
|
|
966
|
-
readonly type: "number";
|
|
967
|
-
readonly description: "Top-left x in px. Omit (with y) to let the layout place the box";
|
|
968
|
-
};
|
|
969
|
-
readonly y: {
|
|
970
|
-
readonly type: "number";
|
|
971
|
-
readonly description: "Top-left y in px. Omit (with x) to let the layout place the box";
|
|
972
|
-
};
|
|
973
|
-
readonly w: {
|
|
974
|
-
readonly type: "number";
|
|
975
|
-
readonly exclusiveMinimum: 0;
|
|
976
|
-
readonly description: "Width in px. Omit to size from the text (never smaller than the type default)";
|
|
977
|
-
};
|
|
978
|
-
readonly h: {
|
|
979
|
-
readonly type: "number";
|
|
980
|
-
readonly exclusiveMinimum: 0;
|
|
981
|
-
readonly description: "Height in px. Omit to size from the text (never smaller than the type default)";
|
|
982
|
-
};
|
|
983
|
-
readonly color: {
|
|
984
|
-
readonly enum: readonly ColorName[];
|
|
985
|
-
readonly description: "Named color preset: outline plus, for boxes, a matching fill. `plain` has no outline and a light fill, `black` is a dark card with light text, `gray` is a dark outline on transparent (the default); the rest pair a colored outline with its pastel fill.";
|
|
986
|
-
};
|
|
987
|
-
readonly stroke: {
|
|
988
|
-
readonly type: "string";
|
|
989
|
-
readonly description: "CSS color of the outline and text; overrides the preset";
|
|
990
|
-
};
|
|
991
|
-
readonly fill: {
|
|
992
|
-
readonly type: "string";
|
|
993
|
-
readonly description: "CSS color of the interior (\"transparent\" for none); overrides the preset";
|
|
994
|
-
};
|
|
995
|
-
};
|
|
996
|
-
};
|
|
997
|
-
readonly connector: {
|
|
998
|
-
readonly type: "object";
|
|
999
|
-
readonly required: readonly ["from", "to"];
|
|
1000
|
-
readonly additionalProperties: false;
|
|
1001
|
-
readonly properties: {
|
|
1002
|
-
readonly id: {
|
|
1003
|
-
readonly type: "string";
|
|
1004
|
-
readonly description: "Optional; generated when omitted";
|
|
1005
|
-
};
|
|
1006
|
-
readonly type: {
|
|
1007
|
-
readonly enum: readonly ConnectorType[];
|
|
1008
|
-
readonly description: "arrow (default; arrowhead at \"to\") or line (no arrowheads)";
|
|
1009
|
-
};
|
|
1010
|
-
readonly from: {
|
|
1011
|
-
readonly oneOf: readonly [{
|
|
1012
|
-
readonly type: "string";
|
|
1013
|
-
readonly description: "Id of a box. The connector attaches to its outline, aimed at the other end";
|
|
1014
|
-
}, {
|
|
1015
|
-
readonly type: "object";
|
|
1016
|
-
readonly required: readonly ["id"];
|
|
1017
|
-
readonly additionalProperties: false;
|
|
1018
|
-
readonly properties: {
|
|
1019
|
-
readonly id: {
|
|
1020
|
-
readonly type: "string";
|
|
1021
|
-
readonly description: "Id of a box";
|
|
1022
|
-
};
|
|
1023
|
-
readonly side: {
|
|
1024
|
-
readonly enum: readonly ["top", "right", "bottom", "left"];
|
|
1025
|
-
readonly description: "Pin the endpoint to the middle of this side of the box instead of auto-aiming";
|
|
1026
|
-
};
|
|
1027
|
-
};
|
|
1028
|
-
}];
|
|
1029
|
-
readonly description: "Box a connector end attaches to: a bare box id, or {id, side} to pick the attach edge";
|
|
1030
|
-
};
|
|
1031
|
-
readonly to: {
|
|
1032
|
-
readonly oneOf: readonly [{
|
|
1033
|
-
readonly type: "string";
|
|
1034
|
-
readonly description: "Id of a box. The connector attaches to its outline, aimed at the other end";
|
|
1035
|
-
}, {
|
|
1036
|
-
readonly type: "object";
|
|
1037
|
-
readonly required: readonly ["id"];
|
|
1038
|
-
readonly additionalProperties: false;
|
|
1039
|
-
readonly properties: {
|
|
1040
|
-
readonly id: {
|
|
1041
|
-
readonly type: "string";
|
|
1042
|
-
readonly description: "Id of a box";
|
|
1043
|
-
};
|
|
1044
|
-
readonly side: {
|
|
1045
|
-
readonly enum: readonly ["top", "right", "bottom", "left"];
|
|
1046
|
-
readonly description: "Pin the endpoint to the middle of this side of the box instead of auto-aiming";
|
|
1047
|
-
};
|
|
1048
|
-
};
|
|
1049
|
-
}];
|
|
1050
|
-
readonly description: "Box a connector end attaches to: a bare box id, or {id, side} to pick the attach edge";
|
|
1051
|
-
};
|
|
1052
|
-
readonly text: {
|
|
1053
|
-
readonly type: "string";
|
|
1054
|
-
readonly description: "Label rendered at the middle of the connector";
|
|
1055
|
-
};
|
|
1056
|
-
readonly bidirectional: {
|
|
1057
|
-
readonly type: "boolean";
|
|
1058
|
-
readonly description: "Arrow only: arrowheads on both ends";
|
|
1059
|
-
};
|
|
1060
|
-
readonly routing: {
|
|
1061
|
-
readonly enum: readonly ["straight", "elbow"];
|
|
1062
|
-
readonly description: "straight (default) draws a direct line; elbow draws a right-angled path routed around the boxes";
|
|
1063
|
-
};
|
|
1064
|
-
readonly color: {
|
|
1065
|
-
readonly enum: readonly ColorName[];
|
|
1066
|
-
readonly description: "Named color preset: outline plus, for boxes, a matching fill. `plain` has no outline and a light fill, `black` is a dark card with light text, `gray` is a dark outline on transparent (the default); the rest pair a colored outline with its pastel fill.";
|
|
1067
|
-
};
|
|
1068
|
-
readonly stroke: {
|
|
1069
|
-
readonly type: "string";
|
|
1070
|
-
readonly description: "CSS color of the line and label; overrides the preset";
|
|
1071
|
-
};
|
|
1072
|
-
};
|
|
1073
|
-
};
|
|
1074
|
-
readonly text: {
|
|
1075
|
-
readonly type: "object";
|
|
1076
|
-
readonly required: readonly ["x", "y", "text"];
|
|
1077
|
-
readonly additionalProperties: false;
|
|
1078
|
-
readonly properties: {
|
|
1079
|
-
readonly id: {
|
|
1080
|
-
readonly type: "string";
|
|
1081
|
-
readonly description: "Optional; generated when omitted";
|
|
1082
|
-
};
|
|
1083
|
-
readonly x: {
|
|
1084
|
-
readonly type: "number";
|
|
1085
|
-
readonly description: "Top-left x of the first line, in px";
|
|
1086
|
-
};
|
|
1087
|
-
readonly y: {
|
|
1088
|
-
readonly type: "number";
|
|
1089
|
-
readonly description: "Top-left y of the first line, in px";
|
|
1090
|
-
};
|
|
1091
|
-
readonly text: {
|
|
1092
|
-
readonly type: "string";
|
|
1093
|
-
readonly description: "Content; \"\\n\" forces a line break";
|
|
1094
|
-
};
|
|
1095
|
-
readonly color: {
|
|
1096
|
-
readonly enum: readonly ColorName[];
|
|
1097
|
-
readonly description: "Named color preset: outline plus, for boxes, a matching fill. `plain` has no outline and a light fill, `black` is a dark card with light text, `gray` is a dark outline on transparent (the default); the rest pair a colored outline with its pastel fill.";
|
|
1098
|
-
};
|
|
1099
|
-
readonly stroke: {
|
|
1100
|
-
readonly type: "string";
|
|
1101
|
-
readonly description: "CSS color of the text; overrides the preset";
|
|
1102
|
-
};
|
|
1103
|
-
};
|
|
1104
|
-
};
|
|
1105
|
-
};
|
|
1106
|
-
};
|
|
1107
|
-
|
|
1108
|
-
type MermaidDirection = 'LR' | 'TD';
|
|
1109
|
-
type MermaidOptions = Readonly<{
|
|
1110
|
-
direction?: MermaidDirection;
|
|
1111
|
-
}>;
|
|
1112
|
-
/**
|
|
1113
|
-
* Export a drawing as a Mermaid `flowchart`. Boxes become nodes (in shape
|
|
1114
|
-
* order), connectors bound at both ends become edges; unbound connectors
|
|
1115
|
-
* are dropped and free text shapes are kept as `%% note:` comments so
|
|
1116
|
-
* nothing is silently lost.
|
|
1117
|
-
*/
|
|
1118
|
-
declare function drawingToMermaid(data: DrawingData, options?: MermaidOptions): string;
|
|
1119
|
-
|
|
1120
|
-
/**
|
|
1121
|
-
* `@lexical/markdown`'s CODE transformer, except that a block whose language
|
|
1122
|
-
* is the highlighter's default (`plain`, assigned to every untagged block)
|
|
1123
|
-
* exports as a bare ``` fence — markdown in, markdown out.
|
|
1124
|
-
*/
|
|
1125
|
-
declare const CODE_BLOCK: MultilineElementTransformer;
|
|
1126
|
-
|
|
1127
|
-
/** The built-in grammars. Importing this module registers them. */
|
|
1128
|
-
declare const BUILTIN_CODE_LANGUAGES: readonly [Readonly<{
|
|
1129
|
-
name: string;
|
|
1130
|
-
aliases?: readonly string[];
|
|
1131
|
-
rules: readonly CodeRule[];
|
|
1132
|
-
keywords?: readonly string[];
|
|
1133
|
-
builtins?: readonly string[];
|
|
1134
|
-
types?: readonly string[];
|
|
1135
|
-
constants?: readonly string[];
|
|
1136
|
-
identifier?: string;
|
|
1137
|
-
caseInsensitive?: boolean;
|
|
1138
|
-
callIsFunction?: boolean;
|
|
1139
|
-
capitalizedIsType?: boolean;
|
|
1140
|
-
}>, Readonly<{
|
|
1141
|
-
name: string;
|
|
1142
|
-
aliases?: readonly string[];
|
|
1143
|
-
rules: readonly CodeRule[];
|
|
1144
|
-
keywords?: readonly string[];
|
|
1145
|
-
builtins?: readonly string[];
|
|
1146
|
-
types?: readonly string[];
|
|
1147
|
-
constants?: readonly string[];
|
|
1148
|
-
identifier?: string;
|
|
1149
|
-
caseInsensitive?: boolean;
|
|
1150
|
-
callIsFunction?: boolean;
|
|
1151
|
-
capitalizedIsType?: boolean;
|
|
1152
|
-
}>, Readonly<{
|
|
1153
|
-
name: string;
|
|
1154
|
-
aliases?: readonly string[];
|
|
1155
|
-
rules: readonly CodeRule[];
|
|
1156
|
-
keywords?: readonly string[];
|
|
1157
|
-
builtins?: readonly string[];
|
|
1158
|
-
types?: readonly string[];
|
|
1159
|
-
constants?: readonly string[];
|
|
1160
|
-
identifier?: string;
|
|
1161
|
-
caseInsensitive?: boolean;
|
|
1162
|
-
callIsFunction?: boolean;
|
|
1163
|
-
capitalizedIsType?: boolean;
|
|
1164
|
-
}>, Readonly<{
|
|
1165
|
-
name: string;
|
|
1166
|
-
aliases?: readonly string[];
|
|
1167
|
-
rules: readonly CodeRule[];
|
|
1168
|
-
keywords?: readonly string[];
|
|
1169
|
-
builtins?: readonly string[];
|
|
1170
|
-
types?: readonly string[];
|
|
1171
|
-
constants?: readonly string[];
|
|
1172
|
-
identifier?: string;
|
|
1173
|
-
caseInsensitive?: boolean;
|
|
1174
|
-
callIsFunction?: boolean;
|
|
1175
|
-
capitalizedIsType?: boolean;
|
|
1176
|
-
}>, Readonly<{
|
|
1177
|
-
name: string;
|
|
1178
|
-
aliases?: readonly string[];
|
|
1179
|
-
rules: readonly CodeRule[];
|
|
1180
|
-
keywords?: readonly string[];
|
|
1181
|
-
builtins?: readonly string[];
|
|
1182
|
-
types?: readonly string[];
|
|
1183
|
-
constants?: readonly string[];
|
|
1184
|
-
identifier?: string;
|
|
1185
|
-
caseInsensitive?: boolean;
|
|
1186
|
-
callIsFunction?: boolean;
|
|
1187
|
-
capitalizedIsType?: boolean;
|
|
1188
|
-
}>, Readonly<{
|
|
1189
|
-
name: string;
|
|
1190
|
-
aliases?: readonly string[];
|
|
1191
|
-
rules: readonly CodeRule[];
|
|
1192
|
-
keywords?: readonly string[];
|
|
1193
|
-
builtins?: readonly string[];
|
|
1194
|
-
types?: readonly string[];
|
|
1195
|
-
constants?: readonly string[];
|
|
1196
|
-
identifier?: string;
|
|
1197
|
-
caseInsensitive?: boolean;
|
|
1198
|
-
callIsFunction?: boolean;
|
|
1199
|
-
capitalizedIsType?: boolean;
|
|
1200
|
-
}>, Readonly<{
|
|
1201
|
-
name: string;
|
|
1202
|
-
aliases?: readonly string[];
|
|
1203
|
-
rules: readonly CodeRule[];
|
|
1204
|
-
keywords?: readonly string[];
|
|
1205
|
-
builtins?: readonly string[];
|
|
1206
|
-
types?: readonly string[];
|
|
1207
|
-
constants?: readonly string[];
|
|
1208
|
-
identifier?: string;
|
|
1209
|
-
caseInsensitive?: boolean;
|
|
1210
|
-
callIsFunction?: boolean;
|
|
1211
|
-
capitalizedIsType?: boolean;
|
|
1212
|
-
}>, Readonly<{
|
|
1213
|
-
name: string;
|
|
1214
|
-
aliases?: readonly string[];
|
|
1215
|
-
rules: readonly CodeRule[];
|
|
1216
|
-
keywords?: readonly string[];
|
|
1217
|
-
builtins?: readonly string[];
|
|
1218
|
-
types?: readonly string[];
|
|
1219
|
-
constants?: readonly string[];
|
|
1220
|
-
identifier?: string;
|
|
1221
|
-
caseInsensitive?: boolean;
|
|
1222
|
-
callIsFunction?: boolean;
|
|
1223
|
-
capitalizedIsType?: boolean;
|
|
1224
|
-
}>, Readonly<{
|
|
1225
|
-
name: string;
|
|
1226
|
-
aliases?: readonly string[];
|
|
1227
|
-
rules: readonly CodeRule[];
|
|
1228
|
-
keywords?: readonly string[];
|
|
1229
|
-
builtins?: readonly string[];
|
|
1230
|
-
types?: readonly string[];
|
|
1231
|
-
constants?: readonly string[];
|
|
1232
|
-
identifier?: string;
|
|
1233
|
-
caseInsensitive?: boolean;
|
|
1234
|
-
callIsFunction?: boolean;
|
|
1235
|
-
capitalizedIsType?: boolean;
|
|
1236
|
-
}>, Readonly<{
|
|
1237
|
-
name: string;
|
|
1238
|
-
aliases?: readonly string[];
|
|
1239
|
-
rules: readonly CodeRule[];
|
|
1240
|
-
keywords?: readonly string[];
|
|
1241
|
-
builtins?: readonly string[];
|
|
1242
|
-
types?: readonly string[];
|
|
1243
|
-
constants?: readonly string[];
|
|
1244
|
-
identifier?: string;
|
|
1245
|
-
caseInsensitive?: boolean;
|
|
1246
|
-
callIsFunction?: boolean;
|
|
1247
|
-
capitalizedIsType?: boolean;
|
|
1248
|
-
}>, Readonly<{
|
|
1249
|
-
name: string;
|
|
1250
|
-
aliases?: readonly string[];
|
|
1251
|
-
rules: readonly CodeRule[];
|
|
1252
|
-
keywords?: readonly string[];
|
|
1253
|
-
builtins?: readonly string[];
|
|
1254
|
-
types?: readonly string[];
|
|
1255
|
-
constants?: readonly string[];
|
|
1256
|
-
identifier?: string;
|
|
1257
|
-
caseInsensitive?: boolean;
|
|
1258
|
-
callIsFunction?: boolean;
|
|
1259
|
-
capitalizedIsType?: boolean;
|
|
1260
|
-
}>, Readonly<{
|
|
1261
|
-
name: string;
|
|
1262
|
-
aliases?: readonly string[];
|
|
1263
|
-
rules: readonly CodeRule[];
|
|
1264
|
-
keywords?: readonly string[];
|
|
1265
|
-
builtins?: readonly string[];
|
|
1266
|
-
types?: readonly string[];
|
|
1267
|
-
constants?: readonly string[];
|
|
1268
|
-
identifier?: string;
|
|
1269
|
-
caseInsensitive?: boolean;
|
|
1270
|
-
callIsFunction?: boolean;
|
|
1271
|
-
capitalizedIsType?: boolean;
|
|
1272
|
-
}>, Readonly<{
|
|
1273
|
-
name: string;
|
|
1274
|
-
aliases?: readonly string[];
|
|
1275
|
-
rules: readonly CodeRule[];
|
|
1276
|
-
keywords?: readonly string[];
|
|
1277
|
-
builtins?: readonly string[];
|
|
1278
|
-
types?: readonly string[];
|
|
1279
|
-
constants?: readonly string[];
|
|
1280
|
-
identifier?: string;
|
|
1281
|
-
caseInsensitive?: boolean;
|
|
1282
|
-
callIsFunction?: boolean;
|
|
1283
|
-
capitalizedIsType?: boolean;
|
|
1284
|
-
}>, Readonly<{
|
|
1285
|
-
name: string;
|
|
1286
|
-
aliases?: readonly string[];
|
|
1287
|
-
rules: readonly CodeRule[];
|
|
1288
|
-
keywords?: readonly string[];
|
|
1289
|
-
builtins?: readonly string[];
|
|
1290
|
-
types?: readonly string[];
|
|
1291
|
-
constants?: readonly string[];
|
|
1292
|
-
identifier?: string;
|
|
1293
|
-
caseInsensitive?: boolean;
|
|
1294
|
-
callIsFunction?: boolean;
|
|
1295
|
-
capitalizedIsType?: boolean;
|
|
1296
|
-
}>, Readonly<{
|
|
1297
|
-
name: string;
|
|
1298
|
-
aliases?: readonly string[];
|
|
1299
|
-
rules: readonly CodeRule[];
|
|
1300
|
-
keywords?: readonly string[];
|
|
1301
|
-
builtins?: readonly string[];
|
|
1302
|
-
types?: readonly string[];
|
|
1303
|
-
constants?: readonly string[];
|
|
1304
|
-
identifier?: string;
|
|
1305
|
-
caseInsensitive?: boolean;
|
|
1306
|
-
callIsFunction?: boolean;
|
|
1307
|
-
capitalizedIsType?: boolean;
|
|
1308
|
-
}>];
|
|
1309
|
-
|
|
1310
|
-
/**
|
|
1311
|
-
* Semantic token vocabulary for code highlighting. Closed on purpose: every
|
|
1312
|
-
* grammar maps its syntax onto these names, and the theme maps each name onto
|
|
1313
|
-
* one class (`zui-token-<type>`) and one color custom property
|
|
1314
|
-
* (`--zui-code-<type>`). Adding a language never adds a color.
|
|
1315
|
-
*/
|
|
1316
|
-
declare const CODE_TOKEN_TYPES: readonly ["comment", "string", "number", "keyword", "builtin", "type", "function", "property", "variable", "constant", "operator", "punctuation", "tag", "attr", "regex", "meta", "inserted", "deleted"];
|
|
1317
|
-
type CodeTokenType = (typeof CODE_TOKEN_TYPES)[number];
|
|
1318
|
-
/** A run of source text. `text` is uncolored (identifiers, whitespace, …). */
|
|
1319
|
-
type CodeToken = Readonly<{
|
|
1320
|
-
type: CodeTokenType | 'text';
|
|
1321
|
-
text: string;
|
|
1322
|
-
}>;
|
|
1323
|
-
/**
|
|
1324
|
-
* One lexer rule: a regular-expression *source* (no flags, no capturing
|
|
1325
|
-
* groups — use `(?:…)`, no backreferences) tried at the current position.
|
|
1326
|
-
* Rules are tried in order; the first one that matches wins.
|
|
1327
|
-
*/
|
|
1328
|
-
type CodeRule = Readonly<{
|
|
1329
|
-
type: CodeTokenType;
|
|
1330
|
-
match: string;
|
|
1331
|
-
}>;
|
|
1332
|
-
/**
|
|
1333
|
-
* A language definition. Pure data: the lexer compiles it once (cached per
|
|
1334
|
-
* object identity) and walks the source with it.
|
|
1335
|
-
*
|
|
1336
|
-
* Identifiers not consumed by a rule are classified by the word lists, then
|
|
1337
|
-
* by the two heuristics, and otherwise left as plain text.
|
|
1338
|
-
*/
|
|
1339
|
-
type CodeGrammar = Readonly<{
|
|
1340
|
-
/** Canonical name, as written after ``` in markdown */
|
|
1341
|
-
name: string;
|
|
1342
|
-
aliases?: readonly string[];
|
|
1343
|
-
rules: readonly CodeRule[];
|
|
1344
|
-
keywords?: readonly string[];
|
|
1345
|
-
builtins?: readonly string[];
|
|
1346
|
-
types?: readonly string[];
|
|
1347
|
-
constants?: readonly string[];
|
|
1348
|
-
/** Regex source for identifiers (default: `[A-Za-z_$][\w$]*`) */
|
|
1349
|
-
identifier?: string;
|
|
1350
|
-
/** Word lists and rules match case-insensitively (SQL) */
|
|
1351
|
-
caseInsensitive?: boolean;
|
|
1352
|
-
/** An identifier directly followed by `(` is a `function` */
|
|
1353
|
-
callIsFunction?: boolean;
|
|
1354
|
-
/**
|
|
1355
|
-
* A Capitalized identifier is a `type`; a SCREAMING_CASE one is a
|
|
1356
|
-
* `constant`
|
|
1357
|
-
*/
|
|
1358
|
-
capitalizedIsType?: boolean;
|
|
1359
|
-
}>;
|
|
1360
|
-
|
|
1361
|
-
/**
|
|
1362
|
-
* Splits `code` into a flat list of tokens covering the whole input, in
|
|
1363
|
-
* order; adjacent tokens of the same type are merged. Never throws on user
|
|
1364
|
-
* input and always makes progress (an empty match counts as no match).
|
|
1365
|
-
*/
|
|
1366
|
-
declare function tokenizeCode(code: string, grammar: CodeGrammar): CodeToken[];
|
|
1367
|
-
|
|
1368
|
-
/**
|
|
1369
|
-
* Language registry: canonical names and aliases, lower-cased, mapped to a
|
|
1370
|
-
* grammar. Unknown names resolve to `plain` (line structure, no colors) so
|
|
1371
|
-
* every fenced block gets the same editing behavior.
|
|
1372
|
-
*/
|
|
1373
|
-
declare const PLAIN_LANGUAGE = "plain";
|
|
1374
|
-
/** Adds (or replaces) a language. Call before the editor mounts. */
|
|
1375
|
-
declare function registerCodeLanguage(grammar: CodeGrammar): void;
|
|
1376
|
-
declare function hasCodeLanguage(name: string): boolean;
|
|
1377
|
-
/** Resolves a fence name (canonical, alias, or `diff-<lang>`) to a grammar. */
|
|
1378
|
-
declare function resolveCodeLanguage(name: string | null | undefined): CodeGrammar;
|
|
1379
|
-
/** Canonical names of every registered language, sorted */
|
|
1380
|
-
declare function getCodeLanguages(): string[];
|
|
1381
|
-
|
|
1382
|
-
type LexicalTokenizer = NonNullable<Parameters<typeof registerCodeHighlighting>[1]>;
|
|
1383
|
-
/**
|
|
1384
|
-
* The tokenizer handed to `@lexical/code`. It never touches Prism: the
|
|
1385
|
-
* registry's grammars produce the tokens, and `$tokenize` turns them into the
|
|
1386
|
-
* flat CodeHighlightNode / LineBreakNode / TabNode structure CodeNode expects.
|
|
1387
|
-
*/
|
|
1388
|
-
declare const codeTokenizer: LexicalTokenizer;
|
|
1389
|
-
/**
|
|
1390
|
-
* Registers syntax highlighting for every CodeNode in the editor, driven by
|
|
1391
|
-
* the language registry. Unknown languages render as plain text with the
|
|
1392
|
-
* same line structure, so editing behaves identically.
|
|
1393
|
-
*/
|
|
1394
|
-
declare function registerCodeBlockHighlighting(editor: LexicalEditor): () => void;
|
|
1395
|
-
|
|
1396
|
-
export { $createDrawingNode, $createFrontmatterNode, $deleteSelectedTableColumn, $deleteSelectedTableRow, $deleteTableColumnAt, $deleteTableRowAt, $getSelectedTable, $getSelectedTableCell, $getTableCellPosition, $getTableDensity, $getTableSettings, $getTableWidth, $insertTableColumnAt, $insertTableColumnNear, $insertTableRowAt, $insertTableRowNear, $isDrawingNode, $isFrontmatterNode, $isTableWidthExplicit, $setTableDensity, $setTableSettings, $setTableWidth, BLOCK_WIDTHS, BOX_DEFINITIONS, BOX_TYPES, BUILTIN_CODE_LANGUAGES, type Binding, type BindingSide, type BlockWidth, type BlockWidthDefaults, type BoxDefinition, type BoxType, CODE_BLOCK, CODE_TOKEN_TYPES, COLOR_PRESETS, CONNECTOR_TYPES, type CodeGrammar, type CodeRule, type CodeToken, type CodeTokenType, type ColorName, type ConnectorType, DEFAULT_TABLE_SETTINGS, DIAGRAM, DRAWING, DRAWING_DATA_JSON_SCHEMA, DRAWING_SKELETON_JSON_SCHEMA, type DrawingData, DrawingNode, type DrawingShape, type DrawingShapeType, type DrawingSkeleton, type DrawingStyle, EMPTY_DRAWING, type EditorContentProps, type EditorMode, type EditorRootProps, FILL_COLORS, FRONTMATTER, FormatButtons, FrontmatterNode, HistoryButtons, type InkOptions, type InkStroke, InsertButtons, MarkdownEditor, type MarkdownEditorApi, type Props as MarkdownEditorProps, type MermaidDirection, type MermaidOptions, PLAIN_LANGUAGE, type Point, SHAPE_TYPES, SIDE_FIXED_POINTS, STROKE_COLORS, type SerializedDrawingNode, type SerializedFrontmatterNode, type SkeletonBox, type SkeletonConnector, type SkeletonEnd, type SkeletonText, TABLE, TABLE_WIDTH_MARKER, type TableCellPosition, type TableDensity, type TableSettings, type TableSettingsOptions, type TextField, Toolbar, ToolbarButton, ToolbarDivider, type ToolbarItems, anchorPoint, bindEndpoints, boxOutline, canDeleteColumn, canDeleteRow, codeTokenizer, connectorPoints, drawingToMermaid, expandSkeleton, findBoxAt, fixedPointFor, formatTableSettingsMarker, getCodeLanguages, hasCodeLanguage, inkAmplitude, inkFillOffset, inkStroke, insertableColumnIndices, insertableRowIndices, isBlockWidth, isDrawingSkeleton, makeBinding, normalizeDrawingData, parseDrawingData, parseDrawingSkeleton, parseTableSettingsMarker, registerCodeBlockHighlighting, registerCodeLanguage, resolveBindings, resolveCodeLanguage, roundedPolyline, roundedRectPolygon, routeElbow, seedFrom, serializeDrawingData, tokenizeCode, useMarkdownEditor };
|
|
38
|
+
export { BlockButtons, CharacterCount, EditorRootProps, FormatButtons, HistoryButtons, InsertButtons, MarkdownEditor, MarkdownEditorProps, ToolbarButton, ToolbarDivider };
|