@surrealdb/ui 1.0.70 → 1.0.72

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/ui.d.ts CHANGED
@@ -1,28 +1,45 @@
1
1
  import { ActionIconProps } from '@mantine/core';
2
2
  import { AlertProps } from '@mantine/core';
3
+ import { BadgeProps } from '@mantine/core';
3
4
  import { BoxProps } from '@mantine/core';
4
5
  import { ButtonProps } from '@mantine/core';
6
+ import { CodeProps } from '@mantine/core';
5
7
  import { Command } from '@codemirror/view';
8
+ import { Command as Command_2 } from 'prosemirror-state';
6
9
  import { EditorSelection } from '@codemirror/state';
10
+ import { EditorState } from 'prosemirror-state';
7
11
  import { EditorView } from '@codemirror/view';
12
+ import { EditorView as EditorView_2 } from 'prosemirror-view';
8
13
  import { ElementProps } from '@mantine/core';
9
14
  import { Extension } from '@codemirror/state';
10
15
  import { FC } from 'react';
16
+ import { Fragment } from 'prosemirror-model';
17
+ import { GroupProps } from '@mantine/core';
11
18
  import { Highlighter } from '@lezer/highlight';
12
19
  import { HighlightStyle } from '@codemirror/language';
13
20
  import { HTMLAttributes } from 'react';
14
21
  import { ImageProps } from '@mantine/core';
22
+ import { InputRule } from 'prosemirror-inputrules';
15
23
  import { KeyBinding } from '@codemirror/view';
16
24
  import { MantineColor } from '@mantine/core';
17
25
  import { MantineColorScheme } from '@mantine/core';
18
26
  import { MantineFontSize } from '@mantine/core';
19
27
  import { MantineThemeOverride } from '@mantine/core';
28
+ import { MarkSpec } from 'prosemirror-model';
29
+ import { MarkType } from 'prosemirror-model';
30
+ import { Node as Node_2 } from 'prosemirror-model';
31
+ import { NodeSpec } from 'prosemirror-model';
32
+ import { NodeViewConstructor } from 'prosemirror-view';
20
33
  import { PaperProps } from '@mantine/core';
34
+ import { PluginKey } from 'prosemirror-state';
21
35
  import type * as React_2 from 'react';
22
36
  import { ReactNode } from 'react';
23
37
  import { RefObject } from 'react';
38
+ import { ResolvedPos } from 'prosemirror-model';
39
+ import { Schema } from 'prosemirror-model';
24
40
  import { StackProps } from '@mantine/core';
25
41
  import { StateField } from '@codemirror/state';
42
+ import { TabsProps as TabsProps_2 } from '@mantine/core';
26
43
 
27
44
  /**
28
45
  * A keybind used to accept a completion
@@ -46,7 +63,7 @@ export declare const addCursorVerticallyKeymap: readonly KeyBinding[];
46
63
 
47
64
  declare type AnyFn = (...rest: any[]) => any;
48
65
 
49
- export declare type AnyNode = BlockNode | InlineNode | SummaryNode | ListItemNode | TableRowNode | TableCellNode;
66
+ export declare type AnyNode = BlockNode | InlineNode | SummaryNode | ListItemNode | TableRowNode | TableCellNode | TabItemNode;
50
67
 
51
68
  /**
52
69
  * Apply automatic folding to objects/arrays at the specified depth level
@@ -55,7 +72,82 @@ export declare type AnyNode = BlockNode | InlineNode | SummaryNode | ListItemNod
55
72
  */
56
73
  export declare function applyAutoFolding(view: EditorView, autoCollapseDepth: number): void;
57
74
 
58
- export declare type BlockNode = HeadingNode | ParagraphNode | CodeNode | BlockquoteNode | ListNode | TableNode | ThematicBreakNode | DivNode | DetailsNode | ImageNode;
75
+ /**
76
+ * A block in the editor document. Blocks have a stable `id`,
77
+ * a `type` determining their behavior, `props` for type-specific
78
+ * attributes, optional inline `content`, and optional nested
79
+ * `children` blocks.
80
+ */
81
+ export declare interface Block {
82
+ id: string;
83
+ type: BlockType;
84
+ props: Record<string, unknown>;
85
+ content?: InlineContent[];
86
+ children?: Block[];
87
+ }
88
+
89
+ export declare const BlockEditor: FC<BlockEditorProps>;
90
+
91
+ /**
92
+ * Controller interface for interacting with a block editor instance.
93
+ * Created by the `useBlockEditor` hook and passed to the `BlockEditor`
94
+ * component.
95
+ */
96
+ export declare interface BlockEditorController {
97
+ /** Ref to attach to the editor's mount point DOM element. */
98
+ ref: RefObject<HTMLDivElement | null>;
99
+ /** Whether the ProseMirror EditorView has been mounted. */
100
+ mounted: boolean;
101
+ /** Access the underlying ProseMirror EditorView. Throws if not mounted. */
102
+ getEditor: () => EditorView_2;
103
+ /** Convert the current document to a Block[] JSON model. */
104
+ getBlocks: () => Block[];
105
+ /** Find a block by ID, searching recursively through children. */
106
+ getBlock: (id: string) => Block | undefined;
107
+ /** Find the sibling block before the block with the given ID. */
108
+ getPreviousBlock: (id: string) => Block | undefined;
109
+ /** Find the sibling block after the block with the given ID. */
110
+ getNextBlock: (id: string) => Block | undefined;
111
+ /** Append blocks to the end of the document. IDs are generated automatically. */
112
+ appendBlocks: (...blocks: BlockInput[]) => void;
113
+ /** Insert blocks after the block with the given reference ID. IDs are generated automatically. */
114
+ insertBlocks: (referenceId: string, ...blocks: BlockInput[]) => void;
115
+ }
116
+
117
+ export declare interface BlockEditorOptions {
118
+ initialBlocks?: Block[];
119
+ readOnly?: boolean;
120
+ placeholder?: string;
121
+ registry?: BlockTypeRegistry;
122
+ customBlocks?: BlockTypeDefinition[];
123
+ exclude?: string[];
124
+ onChangeBlocks?: (blocks: Block[]) => void;
125
+ }
126
+
127
+ export declare interface BlockEditorProps extends BoxProps {
128
+ controller: BlockEditorController & {
129
+ portalManager: PortalManager;
130
+ };
131
+ autoFocus?: boolean;
132
+ readOnly?: boolean;
133
+ hideGutter?: boolean;
134
+ }
135
+
136
+ export declare const blockHandlePluginKey: PluginKey<BlockHandleState>;
137
+
138
+ declare interface BlockHandleState {
139
+ hoveredBlockPos: number | null;
140
+ hoveredBlockNode: Node_2 | null;
141
+ dropIndicatorPos: number | null;
142
+ }
143
+
144
+ /**
145
+ * Input type for creating blocks via the controller API.
146
+ * Omits `id` since IDs are generated internally.
147
+ */
148
+ export declare type BlockInput = Omit<Block, "id">;
149
+
150
+ export declare type BlockNode = HeadingNode | ParagraphNode | CodeNode | BlockquoteNode | ListNode | TableNode | ThematicBreakNode | DivNode | DetailsNode | ImageNode | CheckNode | RailroadDiagramNode | SurrealistMiniNode | VersionNode | SinceNode | LabelNode | TabsNode;
59
151
 
60
152
  export declare interface BlockquoteNode {
61
153
  type: "blockquote";
@@ -67,6 +159,130 @@ export declare interface BlockquoteNode {
67
159
  noteTitle?: string;
68
160
  }
69
161
 
162
+ export declare const blockquoteSpec: NodeSpec;
163
+
164
+ /** SSR-compatible read-only renderer for Block[] data. */
165
+ export declare const BlockRenderer: FC<BlockRendererComponentProps>;
166
+
167
+ export declare interface BlockRendererComponentProps {
168
+ /** The blocks to render. */
169
+ blocks: Block[];
170
+ /** Registry providing block type definitions with readOnlyRender components. */
171
+ registry?: BlockTypeRegistry;
172
+ /** Root container class name. */
173
+ className?: string;
174
+ }
175
+
176
+ /** Props for custom block renderers used with BlockRenderer. */
177
+ export declare interface BlockRendererProps {
178
+ block: Block;
179
+ inlineContent?: ReactNode;
180
+ children?: ReactNode;
181
+ }
182
+
183
+ /** Props for read-only block rendering. */
184
+ declare interface BlockRendererProps_2 {
185
+ block: Block;
186
+ inlineContent?: ReactNode;
187
+ children?: ReactNode;
188
+ }
189
+
190
+ /** Configuration for creating a block type definition without raw ProseMirror NodeSpec. */
191
+ export declare interface BlockSpecConfig {
192
+ /** Unique block type identifier (hyphenated, e.g. "callout"). */
193
+ type: string;
194
+ /** Map of prop names to their defaults. Generates NodeSpec attrs automatically. */
195
+ propSchema?: Record<string, PropDefault>;
196
+ /** Content model shorthand: "inline" for text, "blocks" for nested blocks, "none" for atoms. */
197
+ content?: "inline" | "blocks" | "none";
198
+ /** React component for rendering this block in the editor. */
199
+ render?: FC<ReactNodeViewProps>;
200
+ /** Slash menu entry for inserting this block. */
201
+ slashMenuItem?: Omit<SlashMenuItem, "type">;
202
+ /** Raw NodeSpec overrides for advanced use cases. Merged after generated spec. */
203
+ nodeSpecOverrides?: Partial<NodeSpec>;
204
+ }
205
+
206
+ /** Convert a Block[] JSON model to a ProseMirror document node. */
207
+ export declare function blocksToDoc(blocks: Block[], schema: Schema): Node_2;
208
+
209
+ /** Convert a single Block to a ProseMirror blockContainer node. */
210
+ export declare function blockToNode(block: Block, schema: Schema): Node_2;
211
+
212
+ /** Identifies the type of a block in the editor document. Extensible via string. */
213
+ export declare type BlockType = "text" | "list-item" | "checklist-item" | "blockquote" | "table" | "table-row" | "table-cell" | "columns" | "column" | "divider" | "collapsible-item" | "code-block" | (string & {});
214
+
215
+ /**
216
+ * Defines a block type that can be registered with a BlockTypeRegistry.
217
+ * Includes the ProseMirror NodeSpec, optional React component for
218
+ * rendering, slash menu entry, input rule, and behavior declarations.
219
+ */
220
+ export declare interface BlockTypeDefinition {
221
+ type: string;
222
+ /** ProseMirror node name. Defaults to `type` if not specified. */
223
+ nodeName?: string;
224
+ nodeSpec: NodeSpec;
225
+ /** React component for rendering this block via NodeView. */
226
+ component?: FC<ReactNodeViewProps>;
227
+ /** Whether the NodeView should be non-editable (atom). */
228
+ atom?: boolean;
229
+ /** Slash menu entries for inserting this block. */
230
+ slashMenuItems?: SlashMenuItem[];
231
+ /** Input rules for markdown-style shortcuts. */
232
+ inputRules?: InputRule[];
233
+ /**
234
+ * Factory to create ProseMirror node(s) when this block is inserted
235
+ * via the slash menu. Returns a blockContainer node.
236
+ */
237
+ createNode?: (schema: Schema) => Node_2;
238
+ /** Declares list-like enter/backspace behavior. */
239
+ listBehavior?: ListBehavior;
240
+ /** When true, the Enter key is not handled (falls through to ProseMirror default). */
241
+ enterPassthrough?: boolean;
242
+ /** Extract Block.props from a ProseMirror node (doc -> JSON conversion). */
243
+ toBlockProps?: (node: Node_2) => Record<string, unknown>;
244
+ /** Convert Block.props to ProseMirror node attrs (JSON -> doc conversion). */
245
+ fromBlockProps?: (props: Record<string, unknown>) => Record<string, unknown>;
246
+ /** Custom logic for converting a Block to a ProseMirror inner node. */
247
+ createInnerNode?: (block: Block, schema: Schema) => Node_2;
248
+ /** Whether this block has inline text content. Auto-detected from nodeSpec if not set. */
249
+ hasInlineContent?: boolean;
250
+ /** Whether this block renders children inside itself (e.g. blockquote, table, columns). */
251
+ isContainerBlock?: boolean;
252
+ /** Label shown in the toolbar's block type dropdown. */
253
+ toolbarLabel?: string | ((node: Node_2) => string);
254
+ /** Options for the toolbar's block type conversion dropdown. */
255
+ toolbarOptions?: {
256
+ label: string;
257
+ attrs?: Record<string, unknown>;
258
+ }[];
259
+ /** React component for rendering this block in read-only mode. */
260
+ readOnlyRender?: FC<BlockRendererProps_2>;
261
+ }
262
+
263
+ /**
264
+ * Registry for block types. Register definitions before
265
+ * passing to `useBlockEditor` so the schema, slash menu, and
266
+ * node views are extended automatically.
267
+ */
268
+ export declare class BlockTypeRegistry {
269
+ private definitions;
270
+ /** Register a block type definition. */
271
+ register(definition: BlockTypeDefinition): void;
272
+ /** Look up a registered definition by block type name. */
273
+ get(type: string): BlockTypeDefinition | undefined;
274
+ /** Look up a registered definition by ProseMirror node name. */
275
+ getByNodeName(nodeName: string): BlockTypeDefinition | undefined;
276
+ /** Return all registered definitions. */
277
+ getAll(): BlockTypeDefinition[];
278
+ /** Collect ProseMirror NodeSpecs from all registered definitions. */
279
+ getNodeSpecs(): Record<string, NodeSpec>;
280
+ /** Collect slash menu items from all registered definitions. */
281
+ getSlashMenuItems(): SlashMenuItem[];
282
+ /** Collect input rules from all registered definitions. */
283
+ getInputRules(): InputRule[];
284
+ }
285
+
70
286
  export declare interface BooleanHandle {
71
287
  open: () => void;
72
288
  close: () => void;
@@ -235,6 +451,37 @@ export declare interface BreakNode {
235
451
  style?: string;
236
452
  }
237
453
 
454
+ /**
455
+ * Build a ProseMirror Schema from the registry's block type definitions.
456
+ * The registry must already have all desired block types registered.
457
+ * Use `customMarks` to add custom mark specs alongside the built-in ones.
458
+ */
459
+ export declare function buildSchema(registry?: BlockTypeRegistry, _exclude?: string[], customMarks?: Record<string, MarkSpec>): Schema;
460
+
461
+ export declare const builtInMarks: Record<string, MarkSpec>;
462
+
463
+ export declare function Check({ children, ...props }: CheckProps): ReactNode;
464
+
465
+ export declare const checklistItemSpec: NodeSpec;
466
+
467
+ export declare interface CheckNode {
468
+ type: "check";
469
+ children: InlineNode[];
470
+ className?: string;
471
+ id?: string;
472
+ style?: string;
473
+ }
474
+
475
+ export declare interface CheckProps extends GroupProps {
476
+ children?: ReactNode;
477
+ }
478
+
479
+ declare interface ChoiceNode {
480
+ type: "Choice";
481
+ default?: number;
482
+ children: RailroadNode[];
483
+ }
484
+
238
485
  export declare function clsx(...args: unknown[]): string;
239
486
 
240
487
  /**
@@ -251,6 +498,8 @@ export declare interface CodeBlockProps extends Omit<PaperProps, "children" | "s
251
498
  withLineNumbers?: boolean;
252
499
  }
253
500
 
501
+ export declare const codeBlockSpec: NodeSpec;
502
+
254
503
  export declare const CodeEditor: FC<CodeEditorProps>;
255
504
 
256
505
  export declare interface CodeEditorProps extends BoxProps {
@@ -272,10 +521,21 @@ export declare interface CodeNode {
272
521
  style?: string;
273
522
  }
274
523
 
524
+ export declare const collapsibleItemSpec: NodeSpec;
525
+
275
526
  export declare type ColorScheme = keyof ThemeConfig;
276
527
 
277
528
  declare type ColorScheme_2 = keyof ThemeConfig_2;
278
529
 
530
+ export declare const columnSpec: NodeSpec;
531
+
532
+ export declare const columnsSpec: NodeSpec;
533
+
534
+ declare interface CommentNode {
535
+ type: "Comment";
536
+ text: string;
537
+ }
538
+
279
539
  /**
280
540
  * Common extensions applied to all CodeMirror editors
281
541
  */
@@ -294,11 +554,57 @@ declare type ComponentMap = {
294
554
  [T in AnyNode["type"]]: ComponentFunction<T>;
295
555
  };
296
556
 
557
+ /**
558
+ * Factory function to create a BlockEditorController from refs.
559
+ * Used internally by `useBlockEditor`.
560
+ */
561
+ export declare function createBlockEditorController(ref: RefObject<HTMLDivElement | null>, editorViewRef: RefObject<EditorView_2 | null>, mountedRef: {
562
+ current: boolean;
563
+ }): BlockEditorController;
564
+
565
+ /**
566
+ * Create a BlockTypeDefinition from a simplified config.
567
+ * Generates `nodeSpec` (including `parseDOM`/`toDOM`) automatically from `propSchema`.
568
+ * The raw `nodeSpec` field on `BlockTypeDefinition` remains available via `nodeSpecOverrides`.
569
+ */
570
+ export declare function createBlockSpec(config: BlockSpecConfig): BlockTypeDefinition;
571
+
297
572
  /**
298
573
  * Create a style highlighter for the given color scheme and syntax theme
299
574
  */
300
575
  export declare function createHighlighter(colorScheme: MantineColorScheme): Highlighter;
301
576
 
577
+ /**
578
+ * Create an InlineContentDefinition from a simplified config.
579
+ * Generates a ProseMirror inline node spec with appropriate attrs and DOM serialization.
580
+ */
581
+ export declare function createInlineContentSpec(config: InlineContentSpecConfig): InlineContentDefinition;
582
+
583
+ export declare function createMarkKeymap(schema: Schema): Record<string, Command_2>;
584
+
585
+ /**
586
+ * Create a ProseMirror NodeViewConstructor that renders a React
587
+ * component via the PortalManager. The component receives
588
+ * `ReactNodeViewProps` and can use `contentRef` to mark its
589
+ * editable content area.
590
+ *
591
+ * **Focus resolution:** When a new NodeView is created and the
592
+ * ProseMirror selection falls inside it, `contentDOM` is already
593
+ * in the DOM tree so ProseMirror can sync its cursor. After React
594
+ * renders the portal, `contentRef` re-parents `contentDOM` and
595
+ * re-syncs the DOM selection automatically.
596
+ *
597
+ * **`data-focus` convention:** For blocks that need custom focus
598
+ * behavior (e.g. atom blocks wrapping a `<CodeEditor>`), add a
599
+ * `data-focus` attribute to the element that should receive DOM
600
+ * focus. After React renders, the NodeView will call `.focus()`
601
+ * on the first `[data-focus]` element if the ProseMirror selection
602
+ * is inside this block.
603
+ */
604
+ export declare function createReactNodeView(Component: FC<ReactNodeViewProps>, options?: {
605
+ contentEditable?: boolean;
606
+ }): NodeViewConstructor;
607
+
302
608
  /**
303
609
  * Create a new serialized editor state from a document string.
304
610
  *
@@ -342,6 +648,14 @@ export declare interface DetailsProps extends Omit<BoxProps, "component" | "chil
342
648
  children: ReactNode;
343
649
  }
344
650
 
651
+ export declare interface DiagramNode {
652
+ type: "Diagram";
653
+ padding?: [number, number, number, number];
654
+ children: RailroadNode[];
655
+ }
656
+
657
+ export declare const dividerSpec: NodeSpec;
658
+
345
659
  export declare interface DivNode {
346
660
  type: "div";
347
661
  children: BlockNode[];
@@ -350,6 +664,9 @@ export declare interface DivNode {
350
664
  style?: string;
351
665
  }
352
666
 
667
+ /** Convert a ProseMirror document node to a Block[] JSON model. */
668
+ export declare function docToBlocks(doc: Node_2): Block[];
669
+
353
670
  export declare interface EditorController {
354
671
  ref: RefObject<HTMLDivElement | null>;
355
672
  mounted: boolean;
@@ -369,6 +686,7 @@ export declare interface EditorOptions {
369
686
  state?: EditorStateSnapshot;
370
687
  readOnly?: boolean;
371
688
  extensions?: Extension;
689
+ language?: Language;
372
690
  lineNumbers?: boolean;
373
691
  onMounted?: (editor: EditorView) => void;
374
692
  onChangeDocument?: (document: string) => void;
@@ -396,6 +714,8 @@ export declare interface EmphasisNode {
396
714
  */
397
715
  export declare function enterNode(state: ParserState, nodeType: string, node: BlockNode | SummaryNode): void;
398
716
 
717
+ export declare function executeSlashCommand(view: EditorView_2, schema: Schema, menuState: SlashMenuState, item: SlashMenuItem): void;
718
+
399
719
  /**
400
720
  * Exit a node (pop from stack and validate)
401
721
  */
@@ -412,6 +732,42 @@ export declare interface ExtractedCode {
412
732
  */
413
733
  export declare function extractTest(input: string): ExtractedCode;
414
734
 
735
+ export declare function filterItems(items: SlashMenuItem[], query: string): SlashMenuItem[];
736
+
737
+ /**
738
+ * Walk up from a resolved position to find the nearest ancestor
739
+ * node matching the given type name.
740
+ *
741
+ * @returns The ancestor's absolute position, depth, and node, or null if not found.
742
+ */
743
+ export declare function findAncestor($pos: ResolvedPos, typeName: string): {
744
+ pos: number;
745
+ depth: number;
746
+ node: Node_2;
747
+ } | null;
748
+
749
+ /** Find the position and node of a blockContainer by its ID attribute. */
750
+ export declare function findBlockPos(doc: Node_2, id: string): {
751
+ pos: number;
752
+ node: Node_2;
753
+ } | undefined;
754
+
755
+ /**
756
+ * Find the nearest blockContainer ancestor's position from a
757
+ * resolved position.
758
+ */
759
+ export declare function findContainerPos($pos: ResolvedPos): number | null;
760
+
761
+ /** Convert a ProseMirror inline Fragment to an InlineContent[] array. */
762
+ export declare function fragmentToInline(fragment: Fragment): InlineContent[];
763
+
764
+ /**
765
+ * Generate a 24-character hex string suitable for use as a
766
+ * stable block identifier. Uses `crypto.getRandomValues` for
767
+ * collision resistance.
768
+ */
769
+ export declare function generateRandomId(): string;
770
+
415
771
  export declare interface HeadingNode {
416
772
  type: "heading";
417
773
  depth: 1 | 2 | 3 | 4 | 5 | 6;
@@ -799,8 +1155,52 @@ export declare interface InlineCodeNode {
799
1155
  style?: string;
800
1156
  }
801
1157
 
1158
+ /** A piece of inline content within a block, either styled text, a link, or custom inline content. */
1159
+ export declare type InlineContent = {
1160
+ type: "text";
1161
+ text: string;
1162
+ styles?: TextStyles;
1163
+ } | {
1164
+ type: "link";
1165
+ href: string;
1166
+ content: InlineContent[];
1167
+ } | {
1168
+ type: string;
1169
+ props: Record<string, unknown>;
1170
+ };
1171
+
1172
+ /** Definition of a custom inline content type. */
1173
+ export declare interface InlineContentDefinition {
1174
+ type: string;
1175
+ nodeSpec: NodeSpec;
1176
+ component: FC<ReactNodeViewProps>;
1177
+ triggerCharacter?: string;
1178
+ }
1179
+
1180
+ /** Configuration for creating a custom inline content type. */
1181
+ export declare interface InlineContentSpecConfig {
1182
+ /** Unique type identifier for this inline content. */
1183
+ type: string;
1184
+ /** Map of prop names to their defaults. */
1185
+ propSchema?: Record<string, InlinePropDefault>;
1186
+ /** Whether this inline content contains styled text ("styled") or not ("none"). */
1187
+ content?: "styled" | "none";
1188
+ /** React component for rendering this inline content. */
1189
+ render: FC<ReactNodeViewProps>;
1190
+ /** Character that triggers a suggestion menu for inserting this inline content (e.g. "@"). */
1191
+ triggerCharacter?: string;
1192
+ }
1193
+
802
1194
  export declare type InlineNode = TextNode | LinkNode | InlineCodeNode | StrongNode | EmphasisNode | BreakNode | ImageNode;
803
1195
 
1196
+ /** Schema for a single inline content prop with a default value. */
1197
+ export declare interface InlinePropDefault {
1198
+ default: string | number | boolean;
1199
+ }
1200
+
1201
+ /** Convert an InlineContent[] array to a ProseMirror inline Fragment. */
1202
+ export declare function inlineToFragment(content: InlineContent[], schema: Schema): Fragment;
1203
+
804
1204
  /**
805
1205
  * Check if a code point is an emoji
806
1206
  * Simplified ranges - merged consecutive ranges
@@ -812,6 +1212,22 @@ export declare function isEmojiCodePoint(code: number): boolean;
812
1212
  */
813
1213
  export declare function isSelfClosingTag(tagName: string): boolean;
814
1214
 
1215
+ export declare function Label({ label, ...props }: LabelProps): ReactNode;
1216
+
1217
+ export declare interface LabelNode {
1218
+ type: "label";
1219
+ label: string;
1220
+ className?: string;
1221
+ id?: string;
1222
+ style?: string;
1223
+ }
1224
+
1225
+ export declare interface LabelProps extends Omit<BadgeProps, "children"> {
1226
+ label: string;
1227
+ }
1228
+
1229
+ declare type Language = "csharp" | "rust" | "javascript" | "typescript" | "surrealql" | "json" | "yaml" | "java" | "go" | "python" | "html" | "cli" | "php" | "syntax";
1230
+
815
1231
  export declare interface LinkNode {
816
1232
  type: "link";
817
1233
  url: string;
@@ -822,6 +1238,14 @@ export declare interface LinkNode {
822
1238
  style?: string;
823
1239
  }
824
1240
 
1241
+ /** Declares list-like enter/backspace behavior for a block type. */
1242
+ export declare interface ListBehavior {
1243
+ /** Create a new sibling node when Enter is pressed. */
1244
+ createSibling: (schema: Schema) => Node_2;
1245
+ /** Text prefix to insert when backspacing an empty item back to text. */
1246
+ backspacePrefix?: string;
1247
+ }
1248
+
825
1249
  export declare interface ListItemNode {
826
1250
  type: "listItem";
827
1251
  checked?: boolean;
@@ -832,6 +1256,8 @@ export declare interface ListItemNode {
832
1256
  style?: string;
833
1257
  }
834
1258
 
1259
+ export declare const listItemSpec: NodeSpec;
1260
+
835
1261
  export declare interface ListNode {
836
1262
  type: "list";
837
1263
  variant?: "ordered" | "unordered" | "checklist";
@@ -848,6 +1274,8 @@ export declare interface ListNode {
848
1274
  */
849
1275
  export declare const MANTINE_THEME: MantineThemeOverride;
850
1276
 
1277
+ export declare function markActive(state: EditorState, type: MarkType): boolean;
1278
+
851
1279
  /**
852
1280
  * Main Markdown component that parses markdown and renders it
853
1281
  * Applies stylesheet and spacing
@@ -870,10 +1298,64 @@ export declare interface MarkdownProps {
870
1298
  componentProps?: MarkdownComponentProps;
871
1299
  }
872
1300
 
1301
+ export declare interface MiniConfig {
1302
+ url?: string;
1303
+ dataset?: "surreal-deal-store-mini" | `/${string}.surql`;
1304
+ setup?: string;
1305
+ query?: string;
1306
+ variables?: string | Record<string, unknown>;
1307
+ theme?: "auto" | "light" | "dark";
1308
+ orientation?: "horizontal" | "vertical";
1309
+ appearance?: "normal" | "compact" | "plain";
1310
+ transparent?: boolean;
1311
+ autorun?: boolean;
1312
+ corners?: string;
1313
+ nonumbers?: boolean;
1314
+ }
1315
+
1316
+ export declare class MiniController {
1317
+ private frameRef;
1318
+ constructor(frameRef: RefObject<HTMLIFrameElement | null>);
1319
+ private get ref();
1320
+ private post;
1321
+ /**
1322
+ * Updates the currently displayed query or variables in the mini
1323
+ */
1324
+ setEditor(options: {
1325
+ query?: string;
1326
+ variables?: string;
1327
+ }): void;
1328
+ /**
1329
+ * Clears the query response
1330
+ */
1331
+ clearResponse(): void;
1332
+ /**
1333
+ * Sets the mini to show either the query or variables editor
1334
+ */
1335
+ setEditorMode(mode: "query" | "variables"): void;
1336
+ /**
1337
+ * Sets the output/result mode to combined, single, graph, table or live
1338
+ */
1339
+ setResultMode(mode: "combined" | "single" | "graph" | "table" | "live"): void;
1340
+ /**
1341
+ * Runs the query with the variables as they are currently set
1342
+ */
1343
+ runQuery(): void;
1344
+ /**
1345
+ * Executes a given query in the background
1346
+ */
1347
+ executeQuery(query: string): void;
1348
+ }
1349
+
873
1350
  declare type NodeOfType<T extends AnyNode["type"]> = Extract<AnyNode, {
874
1351
  type: T;
875
1352
  }>;
876
1353
 
1354
+ declare interface NonTerminalNode {
1355
+ type: "NonTerminal";
1356
+ text: string;
1357
+ }
1358
+
877
1359
  /**
878
1360
  * Note/Callout component with variants: note, important, warning, caution
879
1361
  */
@@ -889,6 +1371,18 @@ export declare interface NoteProps extends Omit<AlertProps, "title" | "children"
889
1371
  children: ReactNode;
890
1372
  }
891
1373
 
1374
+ declare interface OneOrMoreNode {
1375
+ type: "OneOrMore";
1376
+ child: RailroadNode;
1377
+ repeat?: RailroadNode;
1378
+ }
1379
+
1380
+ declare interface OptionalNode {
1381
+ type: "Optional";
1382
+ skip?: boolean;
1383
+ child: RailroadNode;
1384
+ }
1385
+
892
1386
  export declare interface ParagraphNode {
893
1387
  type: "paragraph";
894
1388
  children: InlineNode[];
@@ -906,6 +1400,8 @@ export declare function parseAttributes(attrString: string): Record<string, stri
906
1400
 
907
1401
  export declare function parseBlockquote(state: ParserState): void;
908
1402
 
1403
+ export declare function parseCheckTag(state: ParserState, attrs: Record<string, string>): void;
1404
+
909
1405
  export declare function parseCodeBlock(state: ParserState): void;
910
1406
 
911
1407
  export declare function parseDetailsTag(state: ParserState, attrs: Record<string, string>): void;
@@ -993,6 +1489,8 @@ export declare function parseTableAlignment(line: string): Array<"left" | "right
993
1489
  */
994
1490
  export declare function parseTableRow(line: string, isHeader?: boolean): TableCellNode[];
995
1491
 
1492
+ export declare function parseTabsTag(state: ParserState, attrs: Record<string, string>): void;
1493
+
996
1494
  export declare function parseText(text: string, startIndex: number): {
997
1495
  node: TextNode;
998
1496
  endIndex: number;
@@ -1448,6 +1946,40 @@ export declare const pictoZed: string;
1448
1946
 
1449
1947
  export declare const pictoZoomIn: string;
1450
1948
 
1949
+ declare interface PortalEntry {
1950
+ key: string;
1951
+ component: ReactNode;
1952
+ container: HTMLElement;
1953
+ }
1954
+
1955
+ declare type PortalListener = () => void;
1956
+
1957
+ /**
1958
+ * Manages React portals for ProseMirror NodeViews. Coordinates
1959
+ * between ProseMirror's synchronous DOM lifecycle and React's
1960
+ * async rendering via a portal registry and subscription model.
1961
+ */
1962
+ export declare class PortalManager {
1963
+ private portals;
1964
+ private listeners;
1965
+ private cachedEntries;
1966
+ register(entry: PortalEntry): void;
1967
+ update(key: string, component: ReactNode): void;
1968
+ remove(key: string): void;
1969
+ getEntries(): PortalEntry[];
1970
+ subscribe(listener: PortalListener): () => void;
1971
+ private invalidate;
1972
+ }
1973
+
1974
+ export declare function PortalOutlet({ manager }: {
1975
+ manager: PortalManager;
1976
+ }): ReactNode;
1977
+
1978
+ export declare function PortalProvider({ manager, children, }: {
1979
+ manager: PortalManager;
1980
+ children: ReactNode;
1981
+ }): ReactNode;
1982
+
1451
1983
  /**
1452
1984
  * Process highlight regions in code
1453
1985
  */
@@ -1456,6 +1988,11 @@ export declare function processHighlightRegions(code: string): {
1456
1988
  processedCode: string;
1457
1989
  };
1458
1990
 
1991
+ /** Schema for a single block prop with a default value. */
1992
+ export declare interface PropDefault {
1993
+ default: string | number | boolean;
1994
+ }
1995
+
1459
1996
  /**
1460
1997
  * Validate and process code attributes
1461
1998
  */
@@ -1478,6 +2015,32 @@ export declare function pushImage(attrs: Record<string, string>): ImageNode;
1478
2015
  */
1479
2016
  export declare function pushSummary(attrs: Record<string, string>): SummaryNode;
1480
2017
 
2018
+ export declare function RailroadDiagram({ ast, ...props }: RailroadDiagramProps): ReactNode;
2019
+
2020
+ export declare interface RailroadDiagramNode {
2021
+ type: "railroadDiagram";
2022
+ ast?: DiagramNode;
2023
+ className?: string;
2024
+ id?: string;
2025
+ style?: string;
2026
+ }
2027
+
2028
+ export declare interface RailroadDiagramProps extends BoxProps {
2029
+ ast?: DiagramNode;
2030
+ }
2031
+
2032
+ export declare type RailroadNode = DiagramNode | SequenceNode | TerminalNode | NonTerminalNode | OptionalNode | ChoiceNode | OneOrMoreNode | ZeroOrMoreNode | CommentNode;
2033
+
2034
+ /** Props passed to React components rendered inside ProseMirror NodeViews. */
2035
+ export declare interface ReactNodeViewProps {
2036
+ node: Node_2;
2037
+ view: EditorView_2;
2038
+ getPos: () => number | undefined;
2039
+ contentRef: (element: HTMLElement | null) => void;
2040
+ selected: boolean;
2041
+ updateAttrs: (attrs: Record<string, unknown>) => void;
2042
+ }
2043
+
1481
2044
  /**
1482
2045
  * Read tag name from HTML tag starting at index
1483
2046
  * Returns tag name and end index
@@ -1487,6 +2050,17 @@ export declare function readTagName(text: string, startIndex: number): {
1487
2050
  endIndex: number;
1488
2051
  };
1489
2052
 
2053
+ /**
2054
+ * Register all built-in block type definitions with the registry and
2055
+ * return the fully-built ProseMirror Schema.
2056
+ *
2057
+ * Performs a two-phase bootstrap:
2058
+ * 1. Registers nodeSpecs using a minimal stub schema (no input rules)
2059
+ * 2. Builds the real schema from the registry, then re-registers
2060
+ * definitions with proper input rules that reference real node types.
2061
+ */
2062
+ export declare function registerBuiltInBlocks(registry: BlockTypeRegistry, exclude?: string[]): Schema;
2063
+
1490
2064
  /**
1491
2065
  * Render parsed markdown AST to React elements
1492
2066
  * Direct AST-to-React conversion with component mapping
@@ -1505,11 +2079,18 @@ export declare interface RenderMarkdownProps extends StackProps {
1505
2079
  componentProps?: MarkdownComponentProps;
1506
2080
  }
1507
2081
 
2082
+ export declare function resolveDropPosition(view: EditorView_2, clientY: number): number | null;
2083
+
1508
2084
  export declare interface Root {
1509
2085
  type: "root";
1510
2086
  children: BlockNode[];
1511
2087
  }
1512
2088
 
2089
+ declare interface SequenceNode {
2090
+ type: "Sequence";
2091
+ children: RailroadNode[];
2092
+ }
2093
+
1513
2094
  /**
1514
2095
  * Set the contents of the editor
1515
2096
  *
@@ -1518,6 +2099,44 @@ export declare interface Root {
1518
2099
  */
1519
2100
  export declare function setEditorText(editor: EditorView, text: string): void;
1520
2101
 
2102
+ export declare function Since({ v, prefix, ...props }: SinceProps): ReactNode;
2103
+
2104
+ export declare interface SinceNode {
2105
+ type: "since";
2106
+ v: string;
2107
+ prefix?: string;
2108
+ className?: string;
2109
+ id?: string;
2110
+ style?: string;
2111
+ }
2112
+
2113
+ export declare interface SinceProps extends Omit<BadgeProps, "children"> {
2114
+ v: string;
2115
+ prefix?: string;
2116
+ }
2117
+
2118
+ /** Describes an entry in the slash command menu. */
2119
+ export declare interface SlashMenuItem {
2120
+ type: string;
2121
+ label: string;
2122
+ description?: string;
2123
+ icon?: ReactNode;
2124
+ shortcut?: string;
2125
+ /** Create a ProseMirror blockContainer node for this menu item. */
2126
+ createNode?: (schema: Schema, id: string) => Node_2;
2127
+ }
2128
+
2129
+ export declare const slashMenuPluginKey: PluginKey<SlashMenuState>;
2130
+
2131
+ declare interface SlashMenuState {
2132
+ open: boolean;
2133
+ blockPos: number | null;
2134
+ triggerPos: number;
2135
+ query: string;
2136
+ selectedIndex: number;
2137
+ items: SlashMenuItem[];
2138
+ }
2139
+
1521
2140
  export declare type SortDirection = "asc" | "desc" | undefined;
1522
2141
 
1523
2142
  export declare interface SortHandle<T = DefaultSort> {
@@ -1562,8 +2181,48 @@ export declare interface SummaryProps extends Omit<BoxProps, "component" | "chil
1562
2181
  children: ReactNode;
1563
2182
  }
1564
2183
 
2184
+ export declare function SurrealistMini({ config, frameRef, ...props }: SurrealistMiniProps): ReactNode;
2185
+
2186
+ export declare interface SurrealistMiniNode {
2187
+ type: "surrealistMini";
2188
+ url?: string;
2189
+ dataset?: string;
2190
+ setup?: string;
2191
+ query?: string;
2192
+ variables?: string;
2193
+ theme?: string;
2194
+ orientation?: string;
2195
+ appearance?: string;
2196
+ transparent?: string;
2197
+ autorun?: string;
2198
+ className?: string;
2199
+ id?: string;
2200
+ style?: string;
2201
+ }
2202
+
2203
+ export declare interface SurrealistMiniProps extends BoxProps {
2204
+ config?: MiniConfig;
2205
+ frameRef?: RefObject<HTMLIFrameElement | null>;
2206
+ }
2207
+
1565
2208
  export declare const SYNTAX_THEME_CONFIG: ThemeConfig;
1566
2209
 
2210
+ export declare interface TabItem {
2211
+ label: string;
2212
+ icon?: string;
2213
+ content: ReactNode;
2214
+ }
2215
+
2216
+ export declare interface TabItemNode {
2217
+ type: "tabItem";
2218
+ label: string;
2219
+ icon?: string;
2220
+ children: BlockNode[];
2221
+ className?: string;
2222
+ id?: string;
2223
+ style?: string;
2224
+ }
2225
+
1567
2226
  export declare interface TableCellNode {
1568
2227
  type: "tableCell";
1569
2228
  children: AnyNode[];
@@ -1573,6 +2232,8 @@ export declare interface TableCellNode {
1573
2232
  isHeader: boolean;
1574
2233
  }
1575
2234
 
2235
+ export declare const tableCellSpec: NodeSpec;
2236
+
1576
2237
  export declare interface TableNode {
1577
2238
  type: "table";
1578
2239
  align?: Array<"left" | "right" | "center" | null>;
@@ -1590,6 +2251,33 @@ export declare interface TableRowNode {
1590
2251
  style?: string;
1591
2252
  }
1592
2253
 
2254
+ export declare const tableRowSpec: NodeSpec;
2255
+
2256
+ export declare const tableSpec: NodeSpec;
2257
+
2258
+ export declare function Tabs({ items, syncKey, ...props }: TabsProps): ReactNode;
2259
+
2260
+ export declare interface TabsNode {
2261
+ type: "tabs";
2262
+ syncKey?: string;
2263
+ children: TabItemNode[];
2264
+ className?: string;
2265
+ id?: string;
2266
+ style?: string;
2267
+ }
2268
+
2269
+ export declare interface TabsProps extends Omit<TabsProps_2, "children" | "value" | "onChange"> {
2270
+ items: TabItem[];
2271
+ syncKey?: string;
2272
+ }
2273
+
2274
+ declare interface TerminalNode {
2275
+ type: "Terminal";
2276
+ text: string;
2277
+ }
2278
+
2279
+ export declare const textBlockSpec: NodeSpec;
2280
+
1593
2281
  export declare interface TextNode {
1594
2282
  type: "text";
1595
2283
  value: string;
@@ -1598,6 +2286,15 @@ export declare interface TextNode {
1598
2286
  style?: string;
1599
2287
  }
1600
2288
 
2289
+ /** Rich text style flags applied to inline text content. */
2290
+ export declare interface TextStyles {
2291
+ bold?: boolean;
2292
+ italic?: boolean;
2293
+ underline?: boolean;
2294
+ strikethrough?: boolean;
2295
+ code?: boolean;
2296
+ }
2297
+
1601
2298
  export declare interface ThematicBreakNode {
1602
2299
  type: "thematicBreak";
1603
2300
  className?: string;
@@ -1630,11 +2327,35 @@ export declare interface ThemedImageProps extends ImageProps {
1630
2327
  colorScheme?: "light" | "dark";
1631
2328
  }
1632
2329
 
2330
+ /** Map a camelCase ProseMirror node name to the hyphenated BlockType string. */
2331
+ export declare function toBlockType(nodeName: string): string;
2332
+
2333
+ /** Map a hyphenated BlockType string to the camelCase ProseMirror node name. */
2334
+ export declare function toNodeName(blockType: string): string;
2335
+
2336
+ export declare const toolbarPluginKey: PluginKey<ToolbarState>;
2337
+
2338
+ declare interface ToolbarState {
2339
+ show: boolean;
2340
+ from: number;
2341
+ to: number;
2342
+ }
2343
+
1633
2344
  /**
1634
2345
  * Type-specific visitor function
1635
2346
  */
1636
2347
  export declare type TypeVisitor<T extends AnyNode> = (node: T, index: number | undefined, parent: AnyNode | Root | null) => undefined | boolean | void;
1637
2348
 
2349
+ export declare function useBlockEditor(options?: BlockEditorOptions): BlockEditorController & {
2350
+ portalManager: PortalManager;
2351
+ };
2352
+
2353
+ /**
2354
+ * Create a memoized BlockTypeRegistry from an array of block type definitions.
2355
+ * Definitions should be module-level constants for stable references.
2356
+ */
2357
+ export declare function useBlockRegistry(definitions: BlockTypeDefinition[]): BlockTypeRegistry;
2358
+
1638
2359
  export declare function useEditor(options?: EditorOptions): EditorController;
1639
2360
 
1640
2361
  /**
@@ -1647,6 +2368,8 @@ export declare function useEditor(options?: EditorOptions): EditorController;
1647
2368
  */
1648
2369
  export declare function useLater<T extends unknown[]>(doLater: (...args: T) => unknown): (...args: T) => void;
1649
2370
 
2371
+ export declare function useMiniController(): [RefObject<HTMLIFrameElement | null>, MiniController];
2372
+
1650
2373
  export declare function useSort<T = DefaultSort>(options?: SortOptions<T>): SortHandle<T>;
1651
2374
 
1652
2375
  /**
@@ -1669,6 +2392,20 @@ export declare function useSwitch(initialState?: boolean, callbacks?: {
1669
2392
  onClose?: () => void;
1670
2393
  }): readonly [boolean, BooleanHandle];
1671
2394
 
2395
+ export declare function Version({ version, ...props }: VersionProps): ReactNode;
2396
+
2397
+ export declare interface VersionNode {
2398
+ type: "version";
2399
+ version?: string;
2400
+ className?: string;
2401
+ id?: string;
2402
+ style?: string;
2403
+ }
2404
+
2405
+ export declare interface VersionProps extends CodeProps {
2406
+ version: string;
2407
+ }
2408
+
1672
2409
  /**
1673
2410
  * Visit all nodes in the tree
1674
2411
  */
@@ -1686,15 +2423,14 @@ export declare type Visitor = (node: AnyNode, index: number | undefined, parent:
1686
2423
  */
1687
2424
  export declare const VIVID_THEME: ThemeConfig_2;
1688
2425
 
2426
+ declare interface ZeroOrMoreNode {
2427
+ type: "ZeroOrMore";
2428
+ child: RailroadNode;
2429
+ repeat?: RailroadNode;
2430
+ }
2431
+
1689
2432
  export { }
1690
2433
 
1691
- declare module "@mantine/core" {
1692
- type ExtendedCustomColors = "obsidian" | "slate" | import("@mantine/core").DefaultMantineColor;
1693
- interface MantineThemeColorsOverride {
1694
- colors: Record<ExtendedCustomColors, import("@mantine/core").MantineColorsTuple>;
1695
- }
1696
- }
1697
-
1698
2434
  declare module "@mantine/core" {
1699
2435
  type SurrealVariant = "surreal";
1700
2436
  type SurrealInputVariant = SurrealVariant | "filled";
@@ -1799,6 +2535,13 @@ declare module "@mantine/core" {
1799
2535
  }
1800
2536
  }
1801
2537
 
2538
+ declare module "@mantine/core" {
2539
+ type ExtendedCustomColors = "obsidian" | "slate" | import("@mantine/core").DefaultMantineColor;
2540
+ interface MantineThemeColorsOverride {
2541
+ colors: Record<ExtendedCustomColors, import("@mantine/core").MantineColorsTuple>;
2542
+ }
2543
+ }
2544
+
1802
2545
  declare module "@mantine/core" {
1803
2546
  type ExtendedCustomSizes = import("@mantine/core").DefaultMantineSize | "2xl" | "3xl";
1804
2547
  interface MantineThemeSizesOverride {