@notectl/core 0.0.11 → 1.0.2

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/dist/index.d.ts CHANGED
@@ -18,6 +18,58 @@ export declare interface AddMarkStep {
18
18
  readonly path?: readonly BlockId[];
19
19
  }
20
20
 
21
+ export declare const ALIGNMENT_ICONS: Readonly<Record<BlockAlignment, string>>;
22
+
23
+ declare interface AlignmentConfig {
24
+ /** Which alignments to expose. Defaults to all four. */
25
+ readonly alignments: readonly BlockAlignment[];
26
+ /** Block types that support alignment. Defaults to paragraph + heading + title + subtitle + table_cell + image. */
27
+ readonly alignableTypes: readonly string[];
28
+ /** Per-type default alignment (e.g. `{ image: 'center' }`). Falls back to `'left'`. */
29
+ readonly defaults: Readonly<Record<string, BlockAlignment>>;
30
+ /** When true, a separator is rendered after the toolbar item. */
31
+ readonly separatorAfter?: boolean;
32
+ }
33
+ export { AlignmentConfig }
34
+ export { AlignmentConfig as TextAlignmentConfig }
35
+
36
+ declare class AlignmentPlugin implements Plugin_2 {
37
+ readonly id = "alignment";
38
+ readonly name = "Alignment";
39
+ readonly priority = 90;
40
+ private readonly config;
41
+ private alignableTypes;
42
+ constructor(config?: Partial<AlignmentConfig>);
43
+ init(context: PluginContext): void;
44
+ /**
45
+ * Patches existing NodeSpecs for alignable block types to support the
46
+ * `align` attribute and render it as an inline style. Skips types
47
+ * that already define an `align` attribute in their spec.
48
+ */
49
+ private patchNodeSpecs;
50
+ private registerCommands;
51
+ private registerKeymaps;
52
+ private registerToolbarItem;
53
+ /**
54
+ * Preserves the `align` attribute when other plugins change the block
55
+ * type (e.g. paragraph → heading) via `setBlockType`, which replaces attrs.
56
+ */
57
+ private registerMiddleware;
58
+ /**
59
+ * Gets the selected block, handling both TextSelection and NodeSelection.
60
+ */
61
+ private getSelectedBlock;
62
+ /**
63
+ * Gets the block ID of the selected block, handling both selection types.
64
+ */
65
+ private getSelectedBlockId;
66
+ private setAlignment;
67
+ private isNonDefaultAlignment;
68
+ private isAlignable;
69
+ }
70
+ export { AlignmentPlugin }
71
+ export { AlignmentPlugin as TextAlignmentPlugin }
72
+
21
73
  /** Applies a single step to a document and returns the new document. */
22
74
  export declare function applyStep(doc: Document_2, step: Step): Document_2;
23
75
 
@@ -25,6 +77,10 @@ export declare interface AttrSpec {
25
77
  readonly default?: string | number | boolean;
26
78
  }
27
79
 
80
+ declare type BlockAlignment = 'left' | 'center' | 'right' | 'justify';
81
+ export { BlockAlignment }
82
+ export { BlockAlignment as TextAlignment }
83
+
28
84
  export declare interface BlockAttrs {
29
85
  readonly [key: string]: string | number | boolean;
30
86
  }
@@ -66,6 +122,21 @@ export declare class BlockquotePlugin implements Plugin_2 {
66
122
  private setBlockType;
67
123
  }
68
124
 
125
+ export declare interface BlockTypePickerEntry {
126
+ /** Unique identifier, e.g. 'heading-1', 'footer'. */
127
+ readonly id: string;
128
+ /** Display label shown in the picker, e.g. 'Heading 1'. */
129
+ readonly label: string;
130
+ /** Command to execute when the entry is selected. */
131
+ readonly command: string;
132
+ /** Sort order — lower values appear first. */
133
+ readonly priority: number;
134
+ /** Optional styling for the label in the picker dropdown. */
135
+ readonly style?: PickerEntryStyle;
136
+ /** Returns true when this entry matches the current block type. */
137
+ isActive(state: EditorState): boolean;
138
+ }
139
+
69
140
  export declare interface BoldMark extends Mark {
70
141
  readonly type: MarkTypeName & 'bold';
71
142
  }
@@ -93,6 +164,151 @@ export declare interface CellRange {
93
164
  declare type ChildNode_2 = TextNode | InlineNode | BlockNode;
94
165
  export { ChildNode_2 as ChildNode }
95
166
 
167
+ export declare class ClipboardHandler {
168
+ private readonly element;
169
+ private readonly getState;
170
+ private readonly dispatch;
171
+ private readonly schemaRegistry?;
172
+ private readonly syncSelection?;
173
+ private readonly handleCopy;
174
+ private readonly handleCut;
175
+ constructor(element: HTMLElement, options: ClipboardHandlerOptions);
176
+ private onCopy;
177
+ private onCut;
178
+ private writeNodeSelectionToClipboard;
179
+ private writeTextSelectionToClipboard;
180
+ /** Serializes a range of inline content within a block to an HTML string. */
181
+ private serializeBlockRangeToHTML;
182
+ /** Wraps escaped text in mark HTML tags using MarkSpec.toHTMLString when available. */
183
+ private serializeTextWithMarks;
184
+ destroy(): void;
185
+ }
186
+
187
+ declare interface ClipboardHandlerOptions {
188
+ readonly getState: GetStateFn;
189
+ readonly dispatch: DispatchFn;
190
+ readonly schemaRegistry?: SchemaRegistry;
191
+ /** Force-sync DOM selection to state (selectionchange may fire async). */
192
+ readonly syncSelection?: () => void;
193
+ }
194
+
195
+ export declare const CODE_BLOCK_SERVICE_KEY: ServiceKey<CodeBlockService>;
196
+
197
+ export declare interface CodeBlockConfig {
198
+ readonly highlighter?: SyntaxHighlighter;
199
+ readonly defaultLanguage?: string;
200
+ readonly useSpaces?: boolean;
201
+ readonly spaceCount?: number;
202
+ readonly showCopyButton?: boolean;
203
+ readonly separatorAfter?: boolean;
204
+ /** Default body background color (overrides --notectl-code-block-bg). */
205
+ readonly background?: string;
206
+ /** Default header background color (overrides --notectl-code-block-header-bg). */
207
+ readonly headerBackground?: string;
208
+ /** Default text color (overrides --notectl-code-block-color). */
209
+ readonly textColor?: string;
210
+ /** Default header/label text color (overrides --notectl-code-block-header-color). */
211
+ readonly headerColor?: string;
212
+ /** Customize keyboard bindings for code block actions. */
213
+ readonly keymap?: CodeBlockKeymap;
214
+ }
215
+
216
+ /**
217
+ * Configurable keyboard bindings for CodeBlockPlugin actions.
218
+ * Omit a slot to use the default; set to `null` to disable the binding.
219
+ *
220
+ * Key descriptor format: `'Mod-Enter'`, `'Mod-Shift-M'`, etc.
221
+ * `Mod` resolves to Cmd on macOS, Ctrl on Windows/Linux.
222
+ */
223
+ export declare interface CodeBlockKeymap {
224
+ /**
225
+ * Insert a new paragraph below the code block and move the cursor there.
226
+ * @default 'Mod-Enter'
227
+ */
228
+ readonly insertAfter?: string | null;
229
+ /**
230
+ * Toggle the current block between code block and paragraph.
231
+ * @default 'Mod-Shift-M'
232
+ */
233
+ readonly toggle?: string | null;
234
+ }
235
+
236
+ export declare class CodeBlockPlugin implements Plugin_2 {
237
+ readonly id = "code-block";
238
+ readonly name = "Code Block";
239
+ readonly priority = 36;
240
+ private readonly config;
241
+ private readonly resolvedKeymap;
242
+ private context;
243
+ constructor(config?: Partial<CodeBlockConfig>);
244
+ init(context: PluginContext): void;
245
+ destroy(): void;
246
+ onStateChange(oldState: EditorState, newState: EditorState, _tr: Transaction): void;
247
+ decorations(state: EditorState): DecorationSet;
248
+ private registerNodeSpec;
249
+ private registerNodeView;
250
+ private registerCommands;
251
+ private registerKeymaps;
252
+ private registerInputRule;
253
+ private registerToolbarItem;
254
+ private registerMiddleware;
255
+ private registerService;
256
+ private patchTableCellContent;
257
+ /**
258
+ * Handles Backspace at the start of a code block.
259
+ * Converts the code block back to a paragraph, preserving text.
260
+ */
261
+ private handleBackspace;
262
+ private handleEnter;
263
+ private handleTab;
264
+ private handleShiftTab;
265
+ private handleEscape;
266
+ /**
267
+ * Handles ArrowDown at the last line of a code block.
268
+ * Exits to the next block or creates a paragraph below.
269
+ */
270
+ private handleArrowDown;
271
+ /**
272
+ * Handles ArrowUp at the first line of a code block.
273
+ * Exits to the previous block.
274
+ */
275
+ private handleArrowUp;
276
+ /**
277
+ * Handles ArrowRight at the end of a code block.
278
+ * Exits to the next block or creates a paragraph below.
279
+ */
280
+ private handleArrowRight;
281
+ /**
282
+ * Handles ArrowLeft at the start of a code block.
283
+ * Exits to the previous block at end.
284
+ */
285
+ private handleArrowLeft;
286
+ /**
287
+ * Handles Mod+Enter: always creates a paragraph below and moves cursor there.
288
+ */
289
+ private handleModEnter;
290
+ private setBlockFocused;
291
+ private toggleCodeBlock;
292
+ private insertCodeBlock;
293
+ private exitOnDoubleEnter;
294
+ private insertParagraphAfter;
295
+ private setAttr;
296
+ /**
297
+ * Strips all marks from a block's inline content.
298
+ * Used when converting to code_block so no formatting carries over.
299
+ */
300
+ private stripAllMarks;
301
+ }
302
+
303
+ export declare interface CodeBlockService {
304
+ setLanguage(blockId: BlockId, language: string): void;
305
+ getLanguage(blockId: BlockId): string;
306
+ setBackground(blockId: BlockId, color: string): void;
307
+ getBackground(blockId: BlockId): string;
308
+ isCodeBlock(blockId: BlockId): boolean;
309
+ getSupportedLanguages(): readonly string[];
310
+ }
311
+
96
312
  export declare interface CommandEntry {
97
313
  readonly name: string;
98
314
  readonly handler: CommandHandler;
@@ -154,6 +370,15 @@ export declare function createSelection(anchor: Position, head: Position): Selec
154
370
  /** Creates a new {@link TextNode}. */
155
371
  export declare function createTextNode(text: string, marks?: readonly Mark[]): TextNode;
156
372
 
373
+ /** Creates a custom theme by extending a base theme with partial overrides. */
374
+ export declare function createTheme(base: Theme, overrides: PartialTheme): Theme;
375
+
376
+ /** Creates a CSSStyleSheet populated with theme CSS variables. */
377
+ export declare function createThemeStyleSheet(theme: Theme): CSSStyleSheet;
378
+
379
+ /** Built-in dark theme. */
380
+ export declare const DARK_THEME: Theme;
381
+
157
382
  export declare type Decoration = InlineDecoration | NodeDecoration | WidgetDecoration;
158
383
 
159
384
  export declare interface DecorationAttrs {
@@ -228,6 +453,8 @@ export declare interface DeleteTextStep {
228
453
  readonly path?: readonly BlockId[];
229
454
  }
230
455
 
456
+ declare type DispatchFn = (tr: Transaction) => void;
457
+
231
458
  declare interface Document_2 {
232
459
  readonly children: readonly BlockNode[];
233
460
  }
@@ -502,6 +729,9 @@ export declare class FontSizePlugin implements Plugin_2 {
502
729
  */
503
730
  export declare function formatShortcut(binding: string): string;
504
731
 
732
+ /** Generates CSS text with all theme custom properties on :host. */
733
+ export declare function generateThemeCSS(theme: Theme): string;
734
+
505
735
  /** Returns only the BlockNode children of a block. */
506
736
  export declare function getBlockChildren(node: BlockNode): readonly BlockNode[];
507
737
 
@@ -527,6 +757,8 @@ export declare function getContentAtOffset(block: BlockNode, offset: number): {
527
757
  /** Returns the inline content children (TextNode | InlineNode) of a block. */
528
758
  export declare function getInlineChildren(node: BlockNode): readonly (TextNode | InlineNode)[];
529
759
 
760
+ declare type GetStateFn = () => EditorState;
761
+
530
762
  /** Returns only the TextNode children of a block. */
531
763
  export declare function getTextChildren(node: BlockNode): readonly TextNode[];
532
764
 
@@ -536,6 +768,16 @@ export declare interface GridPickerConfig {
536
768
  onSelect(rows: number, cols: number): void;
537
769
  }
538
770
 
771
+ export declare class HardBreakPlugin implements Plugin_2 {
772
+ readonly id = "hard-break";
773
+ readonly name = "Hard Break";
774
+ readonly priority = 10;
775
+ init(context: PluginContext): void;
776
+ private registerInlineNodeSpec;
777
+ private registerCommands;
778
+ private registerKeymap;
779
+ }
780
+
539
781
  /** Returns true if the mark set contains a mark of the given type. */
540
782
  export declare function hasMark(marks: readonly Mark[], markType: MarkTypeName): boolean;
541
783
 
@@ -563,12 +805,21 @@ export declare class HeadingPlugin implements Plugin_2 {
563
805
  private registerCommands;
564
806
  private registerKeymaps;
565
807
  private registerInputRules;
808
+ private registerPickerEntries;
566
809
  private registerToolbarItem;
567
810
  private updateComboLabel;
568
811
  private getActiveLabel;
569
812
  private dismissPopup;
570
813
  private renderHeadingPopup;
571
814
  private createPickerItem;
815
+ private static readonly HEADING_TYPES;
816
+ /**
817
+ * Handles Enter inside a heading block.
818
+ * Empty heading → convert to paragraph.
819
+ * Cursor at end → split and convert new block to paragraph.
820
+ * Cursor in middle → normal split (both stay heading).
821
+ */
822
+ private handleEnter;
572
823
  /**
573
824
  * Toggles between a special block type (title/subtitle) and paragraph.
574
825
  * If the block is already that type, resets to paragraph.
@@ -682,6 +933,55 @@ export declare class HorizontalRulePlugin implements Plugin_2 {
682
933
  private insertHorizontalRule;
683
934
  }
684
935
 
936
+ export declare const IMAGE_UPLOAD_SERVICE: ServiceKey<ImageUploadService>;
937
+
938
+ export declare interface ImageAttrs {
939
+ readonly src: string;
940
+ readonly alt: string;
941
+ readonly width?: number;
942
+ readonly height?: number;
943
+ readonly align: 'left' | 'center' | 'right';
944
+ }
945
+
946
+ export declare class ImagePlugin implements Plugin_2 {
947
+ readonly id = "image";
948
+ readonly name = "Image";
949
+ readonly priority = 45;
950
+ private readonly config;
951
+ private readonly uploadStates;
952
+ private readonly blobUrls;
953
+ constructor(config?: Partial<ImagePluginConfig>);
954
+ init(context: PluginContext): void;
955
+ destroy(): void;
956
+ onStateChange(_oldState: EditorState, newState: EditorState, _tr: Transaction): void;
957
+ private registerNodeSpec;
958
+ private registerNodeView;
959
+ private registerFileHandler;
960
+ private handleFileInsert;
961
+ private uploadFile;
962
+ private registerToolbarItem;
963
+ private renderImagePopup;
964
+ private isAcceptedType;
965
+ }
966
+
967
+ export declare interface ImagePluginConfig {
968
+ readonly maxWidth: number;
969
+ readonly maxFileSize: number;
970
+ readonly acceptedTypes: readonly string[];
971
+ readonly resizable: boolean;
972
+ readonly separatorAfter?: boolean;
973
+ }
974
+
975
+ export declare interface ImageUploadResult {
976
+ readonly url: string;
977
+ readonly width?: number;
978
+ readonly height?: number;
979
+ }
980
+
981
+ export declare interface ImageUploadService {
982
+ upload(file: File): Promise<ImageUploadResult>;
983
+ }
984
+
685
985
  export declare interface InlineDecoration {
686
986
  readonly type: 'inline';
687
987
  readonly blockId: BlockId;
@@ -735,6 +1035,9 @@ export declare interface InputRule {
735
1035
  handler(state: EditorState, match: RegExpMatchArray, start: number, end: number): Transaction | null;
736
1036
  }
737
1037
 
1038
+ /** Inserts a hard line break (InlineNode) at the current cursor position. */
1039
+ export declare function insertHardBreakCommand(state: EditorState): Transaction | null;
1040
+
738
1041
  export declare interface InsertInlineNodeStep {
739
1042
  readonly type: 'insertInlineNode';
740
1043
  readonly blockId: BlockId;
@@ -847,6 +1150,9 @@ export declare type Keymap = Readonly<Record<string, KeymapHandler>>;
847
1150
  */
848
1151
  export declare type KeymapHandler = () => boolean;
849
1152
 
1153
+ /** Built-in light theme. */
1154
+ export declare const LIGHT_THEME: Theme;
1155
+
850
1156
  export declare interface LinkConfig {
851
1157
  /** Whether to add rel="noopener noreferrer" and target="_blank" by default. */
852
1158
  readonly openInNewTab: boolean;
@@ -983,7 +1289,7 @@ export declare function navigateArrowIntoVoid(state: EditorState, direction: 'le
983
1289
  /** Plugins augment this interface to register typed node attributes. */
984
1290
  export declare interface NodeAttrRegistry {
985
1291
  paragraph: {
986
- textAlign?: TextAlignment;
1292
+ align?: BlockAlignment;
987
1293
  };
988
1294
  }
989
1295
 
@@ -1035,6 +1341,14 @@ export declare interface NodeSpec<T extends string = string> {
1035
1341
  readonly parseHTML?: readonly ParseRule[];
1036
1342
  /** Tags and attributes this spec needs through DOMPurify sanitization. */
1037
1343
  readonly sanitize?: SanitizeConfig;
1344
+ /**
1345
+ * If provided, the Reconciler groups consecutive blocks with the same
1346
+ * wrapper key into a shared wrapper element. Useful for semantic list
1347
+ * wrappers (`<ul>`, `<ol>`) around `<li>` block elements.
1348
+ */
1349
+ wrapper?(node: Omit<BlockNode, 'attrs'> & {
1350
+ readonly attrs: NodeAttrsFor<T>;
1351
+ }): WrapperSpec;
1038
1352
  }
1039
1353
 
1040
1354
  /** @deprecated Use {@link NodeTypeName} for new code. */
@@ -1081,6 +1395,9 @@ export declare class NotectlEditor extends HTMLElement {
1081
1395
  private readonly readyPromise;
1082
1396
  private initialized;
1083
1397
  private preInitPlugins;
1398
+ private themeStyleSheet;
1399
+ private systemThemeQuery;
1400
+ private systemThemeHandler;
1084
1401
  constructor();
1085
1402
  static get observedAttributes(): string[];
1086
1403
  connectedCallback(): void;
@@ -1134,8 +1451,18 @@ export declare class NotectlEditor extends HTMLElement {
1134
1451
  whenReady(): Promise<void>;
1135
1452
  /** Updates configuration at runtime. */
1136
1453
  configure(config: Partial<NotectlEditorConfig>): void;
1454
+ /** Changes the theme at runtime. */
1455
+ setTheme(theme: ThemePreset | Theme): void;
1456
+ /** Returns the current theme setting. */
1457
+ getTheme(): ThemePreset | Theme;
1137
1458
  /** Cleans up the editor. Awaiting ensures async plugin teardown completes. */
1138
1459
  destroy(): Promise<void>;
1460
+ /** Applies a theme. Called during init() and on runtime changes. */
1461
+ private applyTheme;
1462
+ private setThemeStyleSheet;
1463
+ private setupSystemThemeListener;
1464
+ private cleanupSystemThemeListener;
1465
+ private getSystemTheme;
1139
1466
  /**
1140
1467
  * Processes the declarative `toolbar` config: registers a ToolbarPlugin
1141
1468
  * with layout groups, then registers all plugins from the toolbar groups.
@@ -1149,7 +1476,7 @@ export declare class NotectlEditor extends HTMLElement {
1149
1476
  private emit;
1150
1477
  private onStateChange;
1151
1478
  private updateEmptyState;
1152
- private announceFormatChange;
1479
+ private announceStateChange;
1153
1480
  private replaceState;
1154
1481
  private serializeBlock;
1155
1482
  private serializeInlineContent;
@@ -1174,6 +1501,8 @@ export declare interface NotectlEditorConfig {
1174
1501
  readonly?: boolean;
1175
1502
  autofocus?: boolean;
1176
1503
  maxHistoryDepth?: number;
1504
+ /** Theme preset or custom Theme object. Defaults to ThemePreset.Light. */
1505
+ theme?: ThemePreset | Theme;
1177
1506
  }
1178
1507
 
1179
1508
  /**
@@ -1187,6 +1516,20 @@ export declare interface ParseRule {
1187
1516
  readonly priority?: number;
1188
1517
  }
1189
1518
 
1519
+ /** Partial custom theme — deeply partial for creating overrides. */
1520
+ export declare interface PartialTheme {
1521
+ readonly name: string;
1522
+ readonly primitives?: Partial<ThemePrimitives>;
1523
+ readonly toolbar?: Partial<ThemeToolbar>;
1524
+ readonly codeBlock?: Partial<ThemeCodeBlock>;
1525
+ readonly tooltip?: Partial<ThemeTooltip>;
1526
+ }
1527
+
1528
+ export declare interface PickerEntryStyle {
1529
+ readonly fontSize: string;
1530
+ readonly fontWeight: string;
1531
+ }
1532
+
1190
1533
  declare interface Plugin_2<TConfig extends Record<string, unknown> = Record<string, unknown>> {
1191
1534
  readonly id: string;
1192
1535
  readonly name: string;
@@ -1229,7 +1572,10 @@ export declare interface PluginContext {
1229
1572
  registerToolbarItem(item: ToolbarItem): void;
1230
1573
  registerInlineNodeSpec<T extends string>(spec: InlineNodeSpec<T>): void;
1231
1574
  registerFileHandler(pattern: string, handler: FileHandler): void;
1575
+ registerBlockTypePickerEntry(entry: BlockTypePickerEntry): void;
1232
1576
  getSchemaRegistry(): SchemaRegistry;
1577
+ /** Pushes a screen reader announcement via the editor's aria-live region. */
1578
+ announce(text: string): void;
1233
1579
  }
1234
1580
 
1235
1581
  export declare interface PluginEventBus {
@@ -1298,6 +1644,8 @@ export declare interface PluginManagerInitOptions {
1298
1644
  dispatch(transaction: Transaction): void;
1299
1645
  getContainer(): HTMLElement;
1300
1646
  getPluginContainer(position: 'top' | 'bottom'): HTMLElement;
1647
+ /** Pushes a screen reader announcement via the editor's aria-live region. */
1648
+ announce?(text: string): void;
1301
1649
  /** Called after all plugin init() calls complete, before onReady(). */
1302
1650
  onBeforeReady?(): void | Promise<void>;
1303
1651
  }
@@ -1353,6 +1701,9 @@ export declare function resolveParentByPath(doc: Document_2, path: readonly stri
1353
1701
  index: number;
1354
1702
  } | undefined;
1355
1703
 
1704
+ /** Resolves a ThemePreset string or Theme object to a full Theme. */
1705
+ export declare function resolveTheme(theme: ThemePreset | Theme): Theme;
1706
+
1356
1707
  /**
1357
1708
  * SanitizeConfig: declares which HTML tags and attributes a spec needs
1358
1709
  * to survive DOMPurify sanitization.
@@ -1382,6 +1733,7 @@ export declare class SchemaRegistry {
1382
1733
  private readonly _toolbarItems;
1383
1734
  private readonly _toolbarItemPluginMap;
1384
1735
  private readonly _fileHandlers;
1736
+ private readonly _blockTypePickerEntries;
1385
1737
  registerNodeSpec<T extends string>(spec: NodeSpec<T>): void;
1386
1738
  getNodeSpec(type: string): NodeSpec | undefined;
1387
1739
  removeNodeSpec(type: string): void;
@@ -1412,6 +1764,9 @@ export declare class SchemaRegistry {
1412
1764
  getFileHandlers(): readonly FileHandlerEntry[];
1413
1765
  matchFileHandlers(mimeType: string): FileHandler[];
1414
1766
  removeFileHandler(handler: FileHandler): void;
1767
+ registerBlockTypePickerEntry(entry: BlockTypePickerEntry): void;
1768
+ getBlockTypePickerEntries(): readonly BlockTypePickerEntry[];
1769
+ removeBlockTypePickerEntry(id: string): void;
1415
1770
  /** Returns all NodeSpec parseHTML rules, sorted by priority descending. */
1416
1771
  getBlockParseRules(): readonly {
1417
1772
  readonly rule: ParseRule;
@@ -1578,6 +1933,17 @@ export declare interface SuperSubToolbarConfig {
1578
1933
  readonly subscript?: boolean;
1579
1934
  }
1580
1935
 
1936
+ export declare interface SyntaxHighlighter {
1937
+ tokenize(code: string, language: string): readonly SyntaxToken[];
1938
+ getSupportedLanguages(): readonly string[];
1939
+ }
1940
+
1941
+ export declare interface SyntaxToken {
1942
+ readonly from: number;
1943
+ readonly to: number;
1944
+ readonly type: string;
1945
+ }
1946
+
1581
1947
  export declare interface TableConfig {
1582
1948
  /** Maximum rows in grid picker. Defaults to 8. */
1583
1949
  readonly maxPickerRows?: number;
@@ -1627,43 +1993,6 @@ export declare interface TableSelectionService {
1627
1993
 
1628
1994
  export declare const TableSelectionServiceKey: ServiceKey<TableSelectionService>;
1629
1995
 
1630
- export declare type TextAlignment = 'left' | 'center' | 'right' | 'justify';
1631
-
1632
- export declare interface TextAlignmentConfig {
1633
- /** Which alignments to expose. Defaults to all four. */
1634
- readonly alignments: readonly TextAlignment[];
1635
- /** Block types that support alignment. Defaults to paragraph + heading. */
1636
- readonly alignableTypes: readonly string[];
1637
- /** When true, a separator is rendered after the toolbar item. */
1638
- readonly separatorAfter?: boolean;
1639
- }
1640
-
1641
- export declare class TextAlignmentPlugin implements Plugin_2 {
1642
- readonly id = "text-alignment";
1643
- readonly name = "Text Alignment";
1644
- readonly priority = 90;
1645
- private readonly config;
1646
- private alignableTypes;
1647
- constructor(config?: Partial<TextAlignmentConfig>);
1648
- init(context: PluginContext): void;
1649
- /**
1650
- * Patches existing NodeSpecs for alignable block types to support the
1651
- * `textAlign` attribute and render it as an inline style.
1652
- */
1653
- private patchNodeSpecs;
1654
- private registerCommands;
1655
- private registerKeymaps;
1656
- private registerToolbarItem;
1657
- /**
1658
- * Preserves the `textAlign` attribute when other plugins change the block
1659
- * type (e.g. paragraph → heading) via `setBlockType`, which replaces attrs.
1660
- */
1661
- private registerMiddleware;
1662
- private setAlignment;
1663
- private isNonDefaultAlignment;
1664
- private isAlignable;
1665
- }
1666
-
1667
1996
  export declare interface TextColorConfig {
1668
1997
  /**
1669
1998
  * Restricts the color picker to a specific set of hex colors.
@@ -1740,6 +2069,69 @@ export declare interface TextSegment {
1740
2069
  readonly marks: readonly Mark[];
1741
2070
  }
1742
2071
 
2072
+ /** Full theme definition. */
2073
+ export declare interface Theme {
2074
+ readonly name: string;
2075
+ readonly primitives: ThemePrimitives;
2076
+ readonly toolbar?: Partial<ThemeToolbar>;
2077
+ readonly codeBlock?: Partial<ThemeCodeBlock>;
2078
+ readonly tooltip?: Partial<ThemeTooltip>;
2079
+ }
2080
+
2081
+ /** Component-level code block overrides. */
2082
+ export declare interface ThemeCodeBlock {
2083
+ readonly background: string;
2084
+ readonly foreground: string;
2085
+ readonly headerBackground: string;
2086
+ readonly headerForeground: string;
2087
+ readonly headerBorder: string;
2088
+ }
2089
+
2090
+ /** Built-in theme presets. */
2091
+ export declare const ThemePreset: {
2092
+ readonly Light: "light";
2093
+ readonly Dark: "dark";
2094
+ readonly System: "system";
2095
+ };
2096
+
2097
+ export declare type ThemePreset = (typeof ThemePreset)[keyof typeof ThemePreset];
2098
+
2099
+ /**
2100
+ * Theme token types, built-in themes, and theme creation helpers.
2101
+ */
2102
+ /** Primitive color palette a theme defines. */
2103
+ export declare interface ThemePrimitives {
2104
+ readonly background: string;
2105
+ readonly foreground: string;
2106
+ readonly mutedForeground: string;
2107
+ readonly border: string;
2108
+ readonly borderFocus: string;
2109
+ readonly primary: string;
2110
+ readonly primaryForeground: string;
2111
+ readonly primaryMuted: string;
2112
+ readonly surfaceRaised: string;
2113
+ readonly surfaceOverlay: string;
2114
+ readonly hoverBackground: string;
2115
+ readonly activeBackground: string;
2116
+ readonly danger: string;
2117
+ readonly dangerMuted: string;
2118
+ readonly success: string;
2119
+ readonly shadow: string;
2120
+ readonly focusRing: string;
2121
+ }
2122
+
2123
+ /** Component-level toolbar overrides. */
2124
+ export declare interface ThemeToolbar {
2125
+ readonly background: string;
2126
+ readonly borderColor: string;
2127
+ }
2128
+
2129
+ /** Component-level tooltip overrides. */
2130
+ export declare interface ThemeTooltip {
2131
+ readonly background: string;
2132
+ readonly foreground: string;
2133
+ }
2134
+
1743
2135
  export declare function toggleBold(state: EditorState, features?: FeatureConfig): Transaction | null;
1744
2136
 
1745
2137
  export declare function toggleItalic(state: EditorState, features?: FeatureConfig): Transaction | null;
@@ -1811,37 +2203,38 @@ export declare class ToolbarPlugin implements Plugin_2 {
1811
2203
  private context;
1812
2204
  private toolbarElement;
1813
2205
  private buttons;
1814
- private activePopup;
1815
- private closePopupHandler;
1816
2206
  private readonly hiddenItems;
1817
- private tooltipElement;
1818
- private tooltipTimer;
1819
2207
  private readonly layoutConfig;
2208
+ private focusedIndex;
2209
+ private tooltip;
2210
+ private popupController;
1820
2211
  constructor(layoutConfig?: ToolbarLayoutConfig);
1821
2212
  init(context: PluginContext): void;
1822
2213
  onReady(): void;
1823
2214
  destroy(): void;
1824
2215
  onStateChange(_oldState: EditorState, newState: EditorState, _tr: Transaction): void;
1825
2216
  onConfigure(config: PluginConfig): void;
1826
- private createTooltipElement;
1827
- private showTooltip;
1828
- private hideTooltip;
1829
2217
  private createToolbarElement;
1830
2218
  private renderItems;
2219
+ private initRovingTabindex;
2220
+ private setRovingFocus;
2221
+ /** Returns the active element, respecting shadow DOM boundaries. */
2222
+ private getActiveElement;
2223
+ private syncFocusedIndex;
2224
+ private handleToolbarKeydown;
2225
+ /** Activates a toolbar button (shared between mouse click and keyboard). */
2226
+ private activateButton;
1831
2227
  private renderItemsByLayout;
1832
2228
  private renderItemsByPriority;
1833
2229
  private createButton;
1834
- private activePopupButton;
1835
- private togglePopup;
1836
- private closePopup;
1837
- private renderGridPicker;
1838
- private renderDropdown;
1839
2230
  private updateButtonStates;
1840
2231
  }
1841
2232
 
1842
2233
  export declare interface ToolbarServiceAPI {
1843
2234
  /** Re-reads isActive/isEnabled from state and updates all buttons. */
1844
2235
  refresh(): void;
2236
+ /** Closes the currently open popup, if any. */
2237
+ closePopup(): void;
1845
2238
  }
1846
2239
 
1847
2240
  export declare const ToolbarServiceKey: ServiceKey<ToolbarServiceAPI>;
@@ -1914,6 +2307,7 @@ export declare class TransactionBuilder {
1914
2307
  export declare interface TransactionMetadata {
1915
2308
  readonly origin: TransactionOrigin;
1916
2309
  readonly timestamp: number;
2310
+ readonly historyDirection?: 'undo' | 'redo';
1917
2311
  }
1918
2312
 
1919
2313
  export declare type TransactionMiddleware = (tr: Transaction, state: EditorState, next: MiddlewareNext) => void;
@@ -1951,4 +2345,16 @@ export declare function widgetDecoration(blockId: BlockId, offset: number, toDOM
1951
2345
  readonly key?: string;
1952
2346
  }): WidgetDecoration;
1953
2347
 
2348
+ /** Describes a wrapper element that groups consecutive blocks of the same kind. */
2349
+ export declare interface WrapperSpec {
2350
+ /** The HTML tag for the wrapper element (e.g., 'ul', 'ol'). */
2351
+ readonly tag: string;
2352
+ /** A key to group consecutive blocks. Blocks with the same key share a wrapper. */
2353
+ readonly key: string;
2354
+ /** Optional CSS class for the wrapper element. */
2355
+ readonly className?: string;
2356
+ /** Optional attributes for the wrapper element. */
2357
+ readonly attrs?: Readonly<Record<string, string>>;
2358
+ }
2359
+
1954
2360
  export { }