@surrealdb/ui 1.0.70 → 1.0.71

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,61 @@ 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
+ /**
90
+ * Controller interface for interacting with a block editor instance.
91
+ * Created by the `useBlockEditor` hook and passed to the `BlockEditor`
92
+ * component.
93
+ */
94
+ export declare interface BlockEditorController {
95
+ /** Ref to attach to the editor's mount point DOM element. */
96
+ ref: RefObject<HTMLDivElement | null>;
97
+ /** Whether the ProseMirror EditorView has been mounted. */
98
+ mounted: boolean;
99
+ /** Access the underlying ProseMirror EditorView. Throws if not mounted. */
100
+ getEditor: () => EditorView_2;
101
+ /** Convert the current document to a Block[] JSON model. */
102
+ getBlocks: () => Block[];
103
+ /** Find a block by ID, searching recursively through children. */
104
+ getBlock: (id: string) => Block | undefined;
105
+ /** Find the sibling block before the block with the given ID. */
106
+ getPreviousBlock: (id: string) => Block | undefined;
107
+ /** Find the sibling block after the block with the given ID. */
108
+ getNextBlock: (id: string) => Block | undefined;
109
+ /** Append blocks to the end of the document. IDs are generated automatically. */
110
+ appendBlocks: (...blocks: BlockInput[]) => void;
111
+ /** Insert blocks after the block with the given reference ID. IDs are generated automatically. */
112
+ insertBlocks: (referenceId: string, ...blocks: BlockInput[]) => void;
113
+ }
114
+
115
+ export declare const blockHandlePluginKey: PluginKey<BlockHandleState>;
116
+
117
+ declare interface BlockHandleState {
118
+ hoveredBlockPos: number | null;
119
+ hoveredBlockNode: Node_2 | null;
120
+ dropIndicatorPos: number | null;
121
+ }
122
+
123
+ /**
124
+ * Input type for creating blocks via the controller API.
125
+ * Omits `id` since IDs are generated internally.
126
+ */
127
+ export declare type BlockInput = Omit<Block, "id">;
128
+
129
+ export declare type BlockNode = HeadingNode | ParagraphNode | CodeNode | BlockquoteNode | ListNode | TableNode | ThematicBreakNode | DivNode | DetailsNode | ImageNode | CheckNode | RailroadDiagramNode | SurrealistMiniNode | VersionNode | SinceNode | LabelNode | TabsNode;
59
130
 
60
131
  export declare interface BlockquoteNode {
61
132
  type: "blockquote";
@@ -67,6 +138,111 @@ export declare interface BlockquoteNode {
67
138
  noteTitle?: string;
68
139
  }
69
140
 
141
+ export declare const blockquoteSpec: NodeSpec;
142
+
143
+ /** Props for read-only block rendering. */
144
+ export declare interface BlockRendererProps {
145
+ block: Block;
146
+ inlineContent?: ReactNode;
147
+ children?: ReactNode;
148
+ }
149
+
150
+ /** Configuration for creating a block type definition without raw ProseMirror NodeSpec. */
151
+ export declare interface BlockSpecConfig {
152
+ /** Unique block type identifier (hyphenated, e.g. "callout"). */
153
+ type: string;
154
+ /** Map of prop names to their defaults. Generates NodeSpec attrs automatically. */
155
+ propSchema?: Record<string, PropDefault>;
156
+ /** Content model shorthand: "inline" for text, "blocks" for nested blocks, "none" for atoms. */
157
+ content?: "inline" | "blocks" | "none";
158
+ /** React component for rendering this block in the editor. */
159
+ render?: FC<ReactNodeViewProps>;
160
+ /** Slash menu entry for inserting this block. */
161
+ slashMenuItem?: Omit<SlashMenuItem, "type">;
162
+ /** Raw NodeSpec overrides for advanced use cases. Merged after generated spec. */
163
+ nodeSpecOverrides?: Partial<NodeSpec>;
164
+ }
165
+
166
+ /** Convert a Block[] JSON model to a ProseMirror document node. */
167
+ export declare function blocksToDoc(blocks: Block[], schema: Schema): Node_2;
168
+
169
+ /** Convert a single Block to a ProseMirror blockContainer node. */
170
+ export declare function blockToNode(block: Block, schema: Schema): Node_2;
171
+
172
+ /** Identifies the type of a block in the editor document. Extensible via string. */
173
+ export declare type BlockType = "text" | "list-item" | "checklist-item" | "blockquote" | "table" | "table-row" | "table-cell" | "columns" | "column" | "divider" | "collapsible-item" | "code-block" | (string & {});
174
+
175
+ /**
176
+ * Defines a block type that can be registered with a BlockTypeRegistry.
177
+ * Includes the ProseMirror NodeSpec, optional React component for
178
+ * rendering, slash menu entry, input rule, and behavior declarations.
179
+ */
180
+ export declare interface BlockTypeDefinition {
181
+ type: string;
182
+ /** ProseMirror node name. Defaults to `type` if not specified. */
183
+ nodeName?: string;
184
+ nodeSpec: NodeSpec;
185
+ /** React component for rendering this block via NodeView. */
186
+ component?: FC<ReactNodeViewProps>;
187
+ /** Whether the NodeView should be non-editable (atom). */
188
+ atom?: boolean;
189
+ /** Slash menu entries for inserting this block. */
190
+ slashMenuItems?: SlashMenuItem[];
191
+ /** Input rules for markdown-style shortcuts. */
192
+ inputRules?: InputRule[];
193
+ /**
194
+ * Factory to create ProseMirror node(s) when this block is inserted
195
+ * via the slash menu. Returns a blockContainer node.
196
+ */
197
+ createNode?: (schema: Schema) => Node_2;
198
+ /** Declares list-like enter/backspace behavior. */
199
+ listBehavior?: ListBehavior;
200
+ /** When true, the Enter key is not handled (falls through to ProseMirror default). */
201
+ enterPassthrough?: boolean;
202
+ /** Extract Block.props from a ProseMirror node (doc -> JSON conversion). */
203
+ toBlockProps?: (node: Node_2) => Record<string, unknown>;
204
+ /** Convert Block.props to ProseMirror node attrs (JSON -> doc conversion). */
205
+ fromBlockProps?: (props: Record<string, unknown>) => Record<string, unknown>;
206
+ /** Custom logic for converting a Block to a ProseMirror inner node. */
207
+ createInnerNode?: (block: Block, schema: Schema) => Node_2;
208
+ /** Whether this block has inline text content. Auto-detected from nodeSpec if not set. */
209
+ hasInlineContent?: boolean;
210
+ /** Whether this block renders children inside itself (e.g. blockquote, table, columns). */
211
+ isContainerBlock?: boolean;
212
+ /** Label shown in the toolbar's block type dropdown. */
213
+ toolbarLabel?: string | ((node: Node_2) => string);
214
+ /** Options for the toolbar's block type conversion dropdown. */
215
+ toolbarOptions?: {
216
+ label: string;
217
+ attrs?: Record<string, unknown>;
218
+ }[];
219
+ /** React component for rendering this block in read-only mode. */
220
+ readOnlyRender?: FC<BlockRendererProps>;
221
+ }
222
+
223
+ /**
224
+ * Registry for block types. Register definitions before
225
+ * passing to `useBlockEditor` so the schema, slash menu, and
226
+ * node views are extended automatically.
227
+ */
228
+ export declare class BlockTypeRegistry {
229
+ private definitions;
230
+ /** Register a block type definition. */
231
+ register(definition: BlockTypeDefinition): void;
232
+ /** Look up a registered definition by block type name. */
233
+ get(type: string): BlockTypeDefinition | undefined;
234
+ /** Look up a registered definition by ProseMirror node name. */
235
+ getByNodeName(nodeName: string): BlockTypeDefinition | undefined;
236
+ /** Return all registered definitions. */
237
+ getAll(): BlockTypeDefinition[];
238
+ /** Collect ProseMirror NodeSpecs from all registered definitions. */
239
+ getNodeSpecs(): Record<string, NodeSpec>;
240
+ /** Collect slash menu items from all registered definitions. */
241
+ getSlashMenuItems(): SlashMenuItem[];
242
+ /** Collect input rules from all registered definitions. */
243
+ getInputRules(): InputRule[];
244
+ }
245
+
70
246
  export declare interface BooleanHandle {
71
247
  open: () => void;
72
248
  close: () => void;
@@ -235,6 +411,37 @@ export declare interface BreakNode {
235
411
  style?: string;
236
412
  }
237
413
 
414
+ /**
415
+ * Build a ProseMirror Schema from the registry's block type definitions.
416
+ * The registry must already have all desired block types registered.
417
+ * Use `customMarks` to add custom mark specs alongside the built-in ones.
418
+ */
419
+ export declare function buildSchema(registry?: BlockTypeRegistry, _exclude?: string[], customMarks?: Record<string, MarkSpec>): Schema;
420
+
421
+ export declare const builtInMarks: Record<string, MarkSpec>;
422
+
423
+ export declare function Check({ children, ...props }: CheckProps): ReactNode;
424
+
425
+ export declare const checklistItemSpec: NodeSpec;
426
+
427
+ export declare interface CheckNode {
428
+ type: "check";
429
+ children: InlineNode[];
430
+ className?: string;
431
+ id?: string;
432
+ style?: string;
433
+ }
434
+
435
+ export declare interface CheckProps extends GroupProps {
436
+ children?: ReactNode;
437
+ }
438
+
439
+ declare interface ChoiceNode {
440
+ type: "Choice";
441
+ default?: number;
442
+ children: RailroadNode[];
443
+ }
444
+
238
445
  export declare function clsx(...args: unknown[]): string;
239
446
 
240
447
  /**
@@ -251,6 +458,8 @@ export declare interface CodeBlockProps extends Omit<PaperProps, "children" | "s
251
458
  withLineNumbers?: boolean;
252
459
  }
253
460
 
461
+ export declare const codeBlockSpec: NodeSpec;
462
+
254
463
  export declare const CodeEditor: FC<CodeEditorProps>;
255
464
 
256
465
  export declare interface CodeEditorProps extends BoxProps {
@@ -272,10 +481,21 @@ export declare interface CodeNode {
272
481
  style?: string;
273
482
  }
274
483
 
484
+ export declare const collapsibleItemSpec: NodeSpec;
485
+
275
486
  export declare type ColorScheme = keyof ThemeConfig;
276
487
 
277
488
  declare type ColorScheme_2 = keyof ThemeConfig_2;
278
489
 
490
+ export declare const columnSpec: NodeSpec;
491
+
492
+ export declare const columnsSpec: NodeSpec;
493
+
494
+ declare interface CommentNode {
495
+ type: "Comment";
496
+ text: string;
497
+ }
498
+
279
499
  /**
280
500
  * Common extensions applied to all CodeMirror editors
281
501
  */
@@ -294,11 +514,57 @@ declare type ComponentMap = {
294
514
  [T in AnyNode["type"]]: ComponentFunction<T>;
295
515
  };
296
516
 
517
+ /**
518
+ * Factory function to create a BlockEditorController from refs.
519
+ * Used internally by `useBlockEditor`.
520
+ */
521
+ export declare function createBlockEditorController(ref: RefObject<HTMLDivElement | null>, editorViewRef: RefObject<EditorView_2 | null>, mountedRef: {
522
+ current: boolean;
523
+ }): BlockEditorController;
524
+
525
+ /**
526
+ * Create a BlockTypeDefinition from a simplified config.
527
+ * Generates `nodeSpec` (including `parseDOM`/`toDOM`) automatically from `propSchema`.
528
+ * The raw `nodeSpec` field on `BlockTypeDefinition` remains available via `nodeSpecOverrides`.
529
+ */
530
+ export declare function createBlockSpec(config: BlockSpecConfig): BlockTypeDefinition;
531
+
297
532
  /**
298
533
  * Create a style highlighter for the given color scheme and syntax theme
299
534
  */
300
535
  export declare function createHighlighter(colorScheme: MantineColorScheme): Highlighter;
301
536
 
537
+ /**
538
+ * Create an InlineContentDefinition from a simplified config.
539
+ * Generates a ProseMirror inline node spec with appropriate attrs and DOM serialization.
540
+ */
541
+ export declare function createInlineContentSpec(config: InlineContentSpecConfig): InlineContentDefinition;
542
+
543
+ export declare function createMarkKeymap(schema: Schema): Record<string, Command_2>;
544
+
545
+ /**
546
+ * Create a ProseMirror NodeViewConstructor that renders a React
547
+ * component via the PortalManager. The component receives
548
+ * `ReactNodeViewProps` and can use `contentRef` to mark its
549
+ * editable content area.
550
+ *
551
+ * **Focus resolution:** When a new NodeView is created and the
552
+ * ProseMirror selection falls inside it, `contentDOM` is already
553
+ * in the DOM tree so ProseMirror can sync its cursor. After React
554
+ * renders the portal, `contentRef` re-parents `contentDOM` and
555
+ * re-syncs the DOM selection automatically.
556
+ *
557
+ * **`data-focus` convention:** For blocks that need custom focus
558
+ * behavior (e.g. atom blocks wrapping a `<CodeEditor>`), add a
559
+ * `data-focus` attribute to the element that should receive DOM
560
+ * focus. After React renders, the NodeView will call `.focus()`
561
+ * on the first `[data-focus]` element if the ProseMirror selection
562
+ * is inside this block.
563
+ */
564
+ export declare function createReactNodeView(Component: FC<ReactNodeViewProps>, options?: {
565
+ contentEditable?: boolean;
566
+ }): NodeViewConstructor;
567
+
302
568
  /**
303
569
  * Create a new serialized editor state from a document string.
304
570
  *
@@ -342,6 +608,14 @@ export declare interface DetailsProps extends Omit<BoxProps, "component" | "chil
342
608
  children: ReactNode;
343
609
  }
344
610
 
611
+ export declare interface DiagramNode {
612
+ type: "Diagram";
613
+ padding?: [number, number, number, number];
614
+ children: RailroadNode[];
615
+ }
616
+
617
+ export declare const dividerSpec: NodeSpec;
618
+
345
619
  export declare interface DivNode {
346
620
  type: "div";
347
621
  children: BlockNode[];
@@ -350,6 +624,9 @@ export declare interface DivNode {
350
624
  style?: string;
351
625
  }
352
626
 
627
+ /** Convert a ProseMirror document node to a Block[] JSON model. */
628
+ export declare function docToBlocks(doc: Node_2): Block[];
629
+
353
630
  export declare interface EditorController {
354
631
  ref: RefObject<HTMLDivElement | null>;
355
632
  mounted: boolean;
@@ -369,6 +646,7 @@ export declare interface EditorOptions {
369
646
  state?: EditorStateSnapshot;
370
647
  readOnly?: boolean;
371
648
  extensions?: Extension;
649
+ language?: Language;
372
650
  lineNumbers?: boolean;
373
651
  onMounted?: (editor: EditorView) => void;
374
652
  onChangeDocument?: (document: string) => void;
@@ -396,6 +674,8 @@ export declare interface EmphasisNode {
396
674
  */
397
675
  export declare function enterNode(state: ParserState, nodeType: string, node: BlockNode | SummaryNode): void;
398
676
 
677
+ export declare function executeSlashCommand(view: EditorView_2, schema: Schema, menuState: SlashMenuState, item: SlashMenuItem): void;
678
+
399
679
  /**
400
680
  * Exit a node (pop from stack and validate)
401
681
  */
@@ -412,6 +692,42 @@ export declare interface ExtractedCode {
412
692
  */
413
693
  export declare function extractTest(input: string): ExtractedCode;
414
694
 
695
+ export declare function filterItems(items: SlashMenuItem[], query: string): SlashMenuItem[];
696
+
697
+ /**
698
+ * Walk up from a resolved position to find the nearest ancestor
699
+ * node matching the given type name.
700
+ *
701
+ * @returns The ancestor's absolute position, depth, and node, or null if not found.
702
+ */
703
+ export declare function findAncestor($pos: ResolvedPos, typeName: string): {
704
+ pos: number;
705
+ depth: number;
706
+ node: Node_2;
707
+ } | null;
708
+
709
+ /** Find the position and node of a blockContainer by its ID attribute. */
710
+ export declare function findBlockPos(doc: Node_2, id: string): {
711
+ pos: number;
712
+ node: Node_2;
713
+ } | undefined;
714
+
715
+ /**
716
+ * Find the nearest blockContainer ancestor's position from a
717
+ * resolved position.
718
+ */
719
+ export declare function findContainerPos($pos: ResolvedPos): number | null;
720
+
721
+ /** Convert a ProseMirror inline Fragment to an InlineContent[] array. */
722
+ export declare function fragmentToInline(fragment: Fragment): InlineContent[];
723
+
724
+ /**
725
+ * Generate a 24-character hex string suitable for use as a
726
+ * stable block identifier. Uses `crypto.getRandomValues` for
727
+ * collision resistance.
728
+ */
729
+ export declare function generateRandomId(): string;
730
+
415
731
  export declare interface HeadingNode {
416
732
  type: "heading";
417
733
  depth: 1 | 2 | 3 | 4 | 5 | 6;
@@ -799,8 +1115,52 @@ export declare interface InlineCodeNode {
799
1115
  style?: string;
800
1116
  }
801
1117
 
1118
+ /** A piece of inline content within a block, either styled text, a link, or custom inline content. */
1119
+ export declare type InlineContent = {
1120
+ type: "text";
1121
+ text: string;
1122
+ styles?: TextStyles;
1123
+ } | {
1124
+ type: "link";
1125
+ href: string;
1126
+ content: InlineContent[];
1127
+ } | {
1128
+ type: string;
1129
+ props: Record<string, unknown>;
1130
+ };
1131
+
1132
+ /** Definition of a custom inline content type. */
1133
+ export declare interface InlineContentDefinition {
1134
+ type: string;
1135
+ nodeSpec: NodeSpec;
1136
+ component: FC<ReactNodeViewProps>;
1137
+ triggerCharacter?: string;
1138
+ }
1139
+
1140
+ /** Configuration for creating a custom inline content type. */
1141
+ export declare interface InlineContentSpecConfig {
1142
+ /** Unique type identifier for this inline content. */
1143
+ type: string;
1144
+ /** Map of prop names to their defaults. */
1145
+ propSchema?: Record<string, InlinePropDefault>;
1146
+ /** Whether this inline content contains styled text ("styled") or not ("none"). */
1147
+ content?: "styled" | "none";
1148
+ /** React component for rendering this inline content. */
1149
+ render: FC<ReactNodeViewProps>;
1150
+ /** Character that triggers a suggestion menu for inserting this inline content (e.g. "@"). */
1151
+ triggerCharacter?: string;
1152
+ }
1153
+
802
1154
  export declare type InlineNode = TextNode | LinkNode | InlineCodeNode | StrongNode | EmphasisNode | BreakNode | ImageNode;
803
1155
 
1156
+ /** Schema for a single inline content prop with a default value. */
1157
+ export declare interface InlinePropDefault {
1158
+ default: string | number | boolean;
1159
+ }
1160
+
1161
+ /** Convert an InlineContent[] array to a ProseMirror inline Fragment. */
1162
+ export declare function inlineToFragment(content: InlineContent[], schema: Schema): Fragment;
1163
+
804
1164
  /**
805
1165
  * Check if a code point is an emoji
806
1166
  * Simplified ranges - merged consecutive ranges
@@ -812,6 +1172,22 @@ export declare function isEmojiCodePoint(code: number): boolean;
812
1172
  */
813
1173
  export declare function isSelfClosingTag(tagName: string): boolean;
814
1174
 
1175
+ export declare function Label({ label, ...props }: LabelProps): ReactNode;
1176
+
1177
+ export declare interface LabelNode {
1178
+ type: "label";
1179
+ label: string;
1180
+ className?: string;
1181
+ id?: string;
1182
+ style?: string;
1183
+ }
1184
+
1185
+ export declare interface LabelProps extends Omit<BadgeProps, "children"> {
1186
+ label: string;
1187
+ }
1188
+
1189
+ declare type Language = "csharp" | "rust" | "javascript" | "typescript" | "surrealql" | "json" | "yaml" | "java" | "go" | "python" | "html" | "cli" | "php" | "syntax";
1190
+
815
1191
  export declare interface LinkNode {
816
1192
  type: "link";
817
1193
  url: string;
@@ -822,6 +1198,14 @@ export declare interface LinkNode {
822
1198
  style?: string;
823
1199
  }
824
1200
 
1201
+ /** Declares list-like enter/backspace behavior for a block type. */
1202
+ export declare interface ListBehavior {
1203
+ /** Create a new sibling node when Enter is pressed. */
1204
+ createSibling: (schema: Schema) => Node_2;
1205
+ /** Text prefix to insert when backspacing an empty item back to text. */
1206
+ backspacePrefix?: string;
1207
+ }
1208
+
825
1209
  export declare interface ListItemNode {
826
1210
  type: "listItem";
827
1211
  checked?: boolean;
@@ -832,6 +1216,8 @@ export declare interface ListItemNode {
832
1216
  style?: string;
833
1217
  }
834
1218
 
1219
+ export declare const listItemSpec: NodeSpec;
1220
+
835
1221
  export declare interface ListNode {
836
1222
  type: "list";
837
1223
  variant?: "ordered" | "unordered" | "checklist";
@@ -848,6 +1234,8 @@ export declare interface ListNode {
848
1234
  */
849
1235
  export declare const MANTINE_THEME: MantineThemeOverride;
850
1236
 
1237
+ export declare function markActive(state: EditorState, type: MarkType): boolean;
1238
+
851
1239
  /**
852
1240
  * Main Markdown component that parses markdown and renders it
853
1241
  * Applies stylesheet and spacing
@@ -870,10 +1258,64 @@ export declare interface MarkdownProps {
870
1258
  componentProps?: MarkdownComponentProps;
871
1259
  }
872
1260
 
1261
+ export declare interface MiniConfig {
1262
+ url?: string;
1263
+ dataset?: "surreal-deal-store-mini" | `/${string}.surql`;
1264
+ setup?: string;
1265
+ query?: string;
1266
+ variables?: string | Record<string, unknown>;
1267
+ theme?: "auto" | "light" | "dark";
1268
+ orientation?: "horizontal" | "vertical";
1269
+ appearance?: "normal" | "compact" | "plain";
1270
+ transparent?: boolean;
1271
+ autorun?: boolean;
1272
+ corners?: string;
1273
+ nonumbers?: boolean;
1274
+ }
1275
+
1276
+ export declare class MiniController {
1277
+ private frameRef;
1278
+ constructor(frameRef: RefObject<HTMLIFrameElement | null>);
1279
+ private get ref();
1280
+ private post;
1281
+ /**
1282
+ * Updates the currently displayed query or variables in the mini
1283
+ */
1284
+ setEditor(options: {
1285
+ query?: string;
1286
+ variables?: string;
1287
+ }): void;
1288
+ /**
1289
+ * Clears the query response
1290
+ */
1291
+ clearResponse(): void;
1292
+ /**
1293
+ * Sets the mini to show either the query or variables editor
1294
+ */
1295
+ setEditorMode(mode: "query" | "variables"): void;
1296
+ /**
1297
+ * Sets the output/result mode to combined, single, graph, table or live
1298
+ */
1299
+ setResultMode(mode: "combined" | "single" | "graph" | "table" | "live"): void;
1300
+ /**
1301
+ * Runs the query with the variables as they are currently set
1302
+ */
1303
+ runQuery(): void;
1304
+ /**
1305
+ * Executes a given query in the background
1306
+ */
1307
+ executeQuery(query: string): void;
1308
+ }
1309
+
873
1310
  declare type NodeOfType<T extends AnyNode["type"]> = Extract<AnyNode, {
874
1311
  type: T;
875
1312
  }>;
876
1313
 
1314
+ declare interface NonTerminalNode {
1315
+ type: "NonTerminal";
1316
+ text: string;
1317
+ }
1318
+
877
1319
  /**
878
1320
  * Note/Callout component with variants: note, important, warning, caution
879
1321
  */
@@ -889,6 +1331,18 @@ export declare interface NoteProps extends Omit<AlertProps, "title" | "children"
889
1331
  children: ReactNode;
890
1332
  }
891
1333
 
1334
+ declare interface OneOrMoreNode {
1335
+ type: "OneOrMore";
1336
+ child: RailroadNode;
1337
+ repeat?: RailroadNode;
1338
+ }
1339
+
1340
+ declare interface OptionalNode {
1341
+ type: "Optional";
1342
+ skip?: boolean;
1343
+ child: RailroadNode;
1344
+ }
1345
+
892
1346
  export declare interface ParagraphNode {
893
1347
  type: "paragraph";
894
1348
  children: InlineNode[];
@@ -906,6 +1360,8 @@ export declare function parseAttributes(attrString: string): Record<string, stri
906
1360
 
907
1361
  export declare function parseBlockquote(state: ParserState): void;
908
1362
 
1363
+ export declare function parseCheckTag(state: ParserState, attrs: Record<string, string>): void;
1364
+
909
1365
  export declare function parseCodeBlock(state: ParserState): void;
910
1366
 
911
1367
  export declare function parseDetailsTag(state: ParserState, attrs: Record<string, string>): void;
@@ -993,6 +1449,8 @@ export declare function parseTableAlignment(line: string): Array<"left" | "right
993
1449
  */
994
1450
  export declare function parseTableRow(line: string, isHeader?: boolean): TableCellNode[];
995
1451
 
1452
+ export declare function parseTabsTag(state: ParserState, attrs: Record<string, string>): void;
1453
+
996
1454
  export declare function parseText(text: string, startIndex: number): {
997
1455
  node: TextNode;
998
1456
  endIndex: number;
@@ -1448,6 +1906,40 @@ export declare const pictoZed: string;
1448
1906
 
1449
1907
  export declare const pictoZoomIn: string;
1450
1908
 
1909
+ declare interface PortalEntry {
1910
+ key: string;
1911
+ component: ReactNode;
1912
+ container: HTMLElement;
1913
+ }
1914
+
1915
+ declare type PortalListener = () => void;
1916
+
1917
+ /**
1918
+ * Manages React portals for ProseMirror NodeViews. Coordinates
1919
+ * between ProseMirror's synchronous DOM lifecycle and React's
1920
+ * async rendering via a portal registry and subscription model.
1921
+ */
1922
+ export declare class PortalManager {
1923
+ private portals;
1924
+ private listeners;
1925
+ private cachedEntries;
1926
+ register(entry: PortalEntry): void;
1927
+ update(key: string, component: ReactNode): void;
1928
+ remove(key: string): void;
1929
+ getEntries(): PortalEntry[];
1930
+ subscribe(listener: PortalListener): () => void;
1931
+ private invalidate;
1932
+ }
1933
+
1934
+ export declare function PortalOutlet({ manager }: {
1935
+ manager: PortalManager;
1936
+ }): ReactNode;
1937
+
1938
+ export declare function PortalProvider({ manager, children, }: {
1939
+ manager: PortalManager;
1940
+ children: ReactNode;
1941
+ }): ReactNode;
1942
+
1451
1943
  /**
1452
1944
  * Process highlight regions in code
1453
1945
  */
@@ -1456,6 +1948,11 @@ export declare function processHighlightRegions(code: string): {
1456
1948
  processedCode: string;
1457
1949
  };
1458
1950
 
1951
+ /** Schema for a single block prop with a default value. */
1952
+ export declare interface PropDefault {
1953
+ default: string | number | boolean;
1954
+ }
1955
+
1459
1956
  /**
1460
1957
  * Validate and process code attributes
1461
1958
  */
@@ -1478,6 +1975,32 @@ export declare function pushImage(attrs: Record<string, string>): ImageNode;
1478
1975
  */
1479
1976
  export declare function pushSummary(attrs: Record<string, string>): SummaryNode;
1480
1977
 
1978
+ export declare function RailroadDiagram({ ast, ...props }: RailroadDiagramProps): ReactNode;
1979
+
1980
+ export declare interface RailroadDiagramNode {
1981
+ type: "railroadDiagram";
1982
+ ast?: DiagramNode;
1983
+ className?: string;
1984
+ id?: string;
1985
+ style?: string;
1986
+ }
1987
+
1988
+ export declare interface RailroadDiagramProps extends BoxProps {
1989
+ ast?: DiagramNode;
1990
+ }
1991
+
1992
+ export declare type RailroadNode = DiagramNode | SequenceNode | TerminalNode | NonTerminalNode | OptionalNode | ChoiceNode | OneOrMoreNode | ZeroOrMoreNode | CommentNode;
1993
+
1994
+ /** Props passed to React components rendered inside ProseMirror NodeViews. */
1995
+ export declare interface ReactNodeViewProps {
1996
+ node: Node_2;
1997
+ view: EditorView_2;
1998
+ getPos: () => number | undefined;
1999
+ contentRef: (element: HTMLElement | null) => void;
2000
+ selected: boolean;
2001
+ updateAttrs: (attrs: Record<string, unknown>) => void;
2002
+ }
2003
+
1481
2004
  /**
1482
2005
  * Read tag name from HTML tag starting at index
1483
2006
  * Returns tag name and end index
@@ -1487,6 +2010,17 @@ export declare function readTagName(text: string, startIndex: number): {
1487
2010
  endIndex: number;
1488
2011
  };
1489
2012
 
2013
+ /**
2014
+ * Register all built-in block type definitions with the registry and
2015
+ * return the fully-built ProseMirror Schema.
2016
+ *
2017
+ * Performs a two-phase bootstrap:
2018
+ * 1. Registers nodeSpecs using a minimal stub schema (no input rules)
2019
+ * 2. Builds the real schema from the registry, then re-registers
2020
+ * definitions with proper input rules that reference real node types.
2021
+ */
2022
+ export declare function registerBuiltInBlocks(registry: BlockTypeRegistry, exclude?: string[]): Schema;
2023
+
1490
2024
  /**
1491
2025
  * Render parsed markdown AST to React elements
1492
2026
  * Direct AST-to-React conversion with component mapping
@@ -1505,11 +2039,18 @@ export declare interface RenderMarkdownProps extends StackProps {
1505
2039
  componentProps?: MarkdownComponentProps;
1506
2040
  }
1507
2041
 
2042
+ export declare function resolveDropPosition(view: EditorView_2, clientY: number): number | null;
2043
+
1508
2044
  export declare interface Root {
1509
2045
  type: "root";
1510
2046
  children: BlockNode[];
1511
2047
  }
1512
2048
 
2049
+ declare interface SequenceNode {
2050
+ type: "Sequence";
2051
+ children: RailroadNode[];
2052
+ }
2053
+
1513
2054
  /**
1514
2055
  * Set the contents of the editor
1515
2056
  *
@@ -1518,6 +2059,44 @@ export declare interface Root {
1518
2059
  */
1519
2060
  export declare function setEditorText(editor: EditorView, text: string): void;
1520
2061
 
2062
+ export declare function Since({ v, prefix, ...props }: SinceProps): ReactNode;
2063
+
2064
+ export declare interface SinceNode {
2065
+ type: "since";
2066
+ v: string;
2067
+ prefix?: string;
2068
+ className?: string;
2069
+ id?: string;
2070
+ style?: string;
2071
+ }
2072
+
2073
+ export declare interface SinceProps extends Omit<BadgeProps, "children"> {
2074
+ v: string;
2075
+ prefix?: string;
2076
+ }
2077
+
2078
+ /** Describes an entry in the slash command menu. */
2079
+ export declare interface SlashMenuItem {
2080
+ type: string;
2081
+ label: string;
2082
+ description?: string;
2083
+ icon?: ReactNode;
2084
+ shortcut?: string;
2085
+ /** Create a ProseMirror blockContainer node for this menu item. */
2086
+ createNode?: (schema: Schema, id: string) => Node_2;
2087
+ }
2088
+
2089
+ export declare const slashMenuPluginKey: PluginKey<SlashMenuState>;
2090
+
2091
+ declare interface SlashMenuState {
2092
+ open: boolean;
2093
+ blockPos: number | null;
2094
+ triggerPos: number;
2095
+ query: string;
2096
+ selectedIndex: number;
2097
+ items: SlashMenuItem[];
2098
+ }
2099
+
1521
2100
  export declare type SortDirection = "asc" | "desc" | undefined;
1522
2101
 
1523
2102
  export declare interface SortHandle<T = DefaultSort> {
@@ -1562,8 +2141,48 @@ export declare interface SummaryProps extends Omit<BoxProps, "component" | "chil
1562
2141
  children: ReactNode;
1563
2142
  }
1564
2143
 
2144
+ export declare function SurrealistMini({ config, frameRef, ...props }: SurrealistMiniProps): ReactNode;
2145
+
2146
+ export declare interface SurrealistMiniNode {
2147
+ type: "surrealistMini";
2148
+ url?: string;
2149
+ dataset?: string;
2150
+ setup?: string;
2151
+ query?: string;
2152
+ variables?: string;
2153
+ theme?: string;
2154
+ orientation?: string;
2155
+ appearance?: string;
2156
+ transparent?: string;
2157
+ autorun?: string;
2158
+ className?: string;
2159
+ id?: string;
2160
+ style?: string;
2161
+ }
2162
+
2163
+ export declare interface SurrealistMiniProps extends BoxProps {
2164
+ config?: MiniConfig;
2165
+ frameRef?: RefObject<HTMLIFrameElement | null>;
2166
+ }
2167
+
1565
2168
  export declare const SYNTAX_THEME_CONFIG: ThemeConfig;
1566
2169
 
2170
+ export declare interface TabItem {
2171
+ label: string;
2172
+ icon?: string;
2173
+ content: ReactNode;
2174
+ }
2175
+
2176
+ export declare interface TabItemNode {
2177
+ type: "tabItem";
2178
+ label: string;
2179
+ icon?: string;
2180
+ children: BlockNode[];
2181
+ className?: string;
2182
+ id?: string;
2183
+ style?: string;
2184
+ }
2185
+
1567
2186
  export declare interface TableCellNode {
1568
2187
  type: "tableCell";
1569
2188
  children: AnyNode[];
@@ -1573,6 +2192,8 @@ export declare interface TableCellNode {
1573
2192
  isHeader: boolean;
1574
2193
  }
1575
2194
 
2195
+ export declare const tableCellSpec: NodeSpec;
2196
+
1576
2197
  export declare interface TableNode {
1577
2198
  type: "table";
1578
2199
  align?: Array<"left" | "right" | "center" | null>;
@@ -1590,6 +2211,33 @@ export declare interface TableRowNode {
1590
2211
  style?: string;
1591
2212
  }
1592
2213
 
2214
+ export declare const tableRowSpec: NodeSpec;
2215
+
2216
+ export declare const tableSpec: NodeSpec;
2217
+
2218
+ export declare function Tabs({ items, syncKey, ...props }: TabsProps): ReactNode;
2219
+
2220
+ export declare interface TabsNode {
2221
+ type: "tabs";
2222
+ syncKey?: string;
2223
+ children: TabItemNode[];
2224
+ className?: string;
2225
+ id?: string;
2226
+ style?: string;
2227
+ }
2228
+
2229
+ export declare interface TabsProps extends Omit<TabsProps_2, "children" | "value" | "onChange"> {
2230
+ items: TabItem[];
2231
+ syncKey?: string;
2232
+ }
2233
+
2234
+ declare interface TerminalNode {
2235
+ type: "Terminal";
2236
+ text: string;
2237
+ }
2238
+
2239
+ export declare const textBlockSpec: NodeSpec;
2240
+
1593
2241
  export declare interface TextNode {
1594
2242
  type: "text";
1595
2243
  value: string;
@@ -1598,6 +2246,15 @@ export declare interface TextNode {
1598
2246
  style?: string;
1599
2247
  }
1600
2248
 
2249
+ /** Rich text style flags applied to inline text content. */
2250
+ export declare interface TextStyles {
2251
+ bold?: boolean;
2252
+ italic?: boolean;
2253
+ underline?: boolean;
2254
+ strikethrough?: boolean;
2255
+ code?: boolean;
2256
+ }
2257
+
1601
2258
  export declare interface ThematicBreakNode {
1602
2259
  type: "thematicBreak";
1603
2260
  className?: string;
@@ -1630,6 +2287,20 @@ export declare interface ThemedImageProps extends ImageProps {
1630
2287
  colorScheme?: "light" | "dark";
1631
2288
  }
1632
2289
 
2290
+ /** Map a camelCase ProseMirror node name to the hyphenated BlockType string. */
2291
+ export declare function toBlockType(nodeName: string): string;
2292
+
2293
+ /** Map a hyphenated BlockType string to the camelCase ProseMirror node name. */
2294
+ export declare function toNodeName(blockType: string): string;
2295
+
2296
+ export declare const toolbarPluginKey: PluginKey<ToolbarState>;
2297
+
2298
+ declare interface ToolbarState {
2299
+ show: boolean;
2300
+ from: number;
2301
+ to: number;
2302
+ }
2303
+
1633
2304
  /**
1634
2305
  * Type-specific visitor function
1635
2306
  */
@@ -1647,6 +2318,8 @@ export declare function useEditor(options?: EditorOptions): EditorController;
1647
2318
  */
1648
2319
  export declare function useLater<T extends unknown[]>(doLater: (...args: T) => unknown): (...args: T) => void;
1649
2320
 
2321
+ export declare function useMiniController(): [RefObject<HTMLIFrameElement | null>, MiniController];
2322
+
1650
2323
  export declare function useSort<T = DefaultSort>(options?: SortOptions<T>): SortHandle<T>;
1651
2324
 
1652
2325
  /**
@@ -1669,6 +2342,20 @@ export declare function useSwitch(initialState?: boolean, callbacks?: {
1669
2342
  onClose?: () => void;
1670
2343
  }): readonly [boolean, BooleanHandle];
1671
2344
 
2345
+ export declare function Version({ version, ...props }: VersionProps): ReactNode;
2346
+
2347
+ export declare interface VersionNode {
2348
+ type: "version";
2349
+ version?: string;
2350
+ className?: string;
2351
+ id?: string;
2352
+ style?: string;
2353
+ }
2354
+
2355
+ export declare interface VersionProps extends CodeProps {
2356
+ version: string;
2357
+ }
2358
+
1672
2359
  /**
1673
2360
  * Visit all nodes in the tree
1674
2361
  */
@@ -1686,15 +2373,14 @@ export declare type Visitor = (node: AnyNode, index: number | undefined, parent:
1686
2373
  */
1687
2374
  export declare const VIVID_THEME: ThemeConfig_2;
1688
2375
 
2376
+ declare interface ZeroOrMoreNode {
2377
+ type: "ZeroOrMore";
2378
+ child: RailroadNode;
2379
+ repeat?: RailroadNode;
2380
+ }
2381
+
1689
2382
  export { }
1690
2383
 
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
2384
  declare module "@mantine/core" {
1699
2385
  type SurrealVariant = "surreal";
1700
2386
  type SurrealInputVariant = SurrealVariant | "filled";
@@ -1799,6 +2485,13 @@ declare module "@mantine/core" {
1799
2485
  }
1800
2486
  }
1801
2487
 
2488
+ declare module "@mantine/core" {
2489
+ type ExtendedCustomColors = "obsidian" | "slate" | import("@mantine/core").DefaultMantineColor;
2490
+ interface MantineThemeColorsOverride {
2491
+ colors: Record<ExtendedCustomColors, import("@mantine/core").MantineColorsTuple>;
2492
+ }
2493
+ }
2494
+
1802
2495
  declare module "@mantine/core" {
1803
2496
  type ExtendedCustomSizes = import("@mantine/core").DefaultMantineSize | "2xl" | "3xl";
1804
2497
  interface MantineThemeSizesOverride {