@surrealdb/ui 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/.zed/settings.json +36 -0
  2. package/AGENTS.md +10 -5
  3. package/README.md +30 -0
  4. package/REVIEW.md +1 -1
  5. package/dist/assets/0d2c2f665b0f41ed.woff2 +0 -0
  6. package/dist/assets/12b57c6beacdbca0.woff2 +0 -0
  7. package/dist/assets/23645aad5ccc2b92.woff2 +0 -0
  8. package/dist/assets/8bbfa6e01a9e6a0f.woff2 +0 -0
  9. package/dist/assets/93fc40a807be6880.woff2 +0 -0
  10. package/dist/assets/9c9751ca111e97c2.woff2 +0 -0
  11. package/dist/assets/9ff55a8a9670220d.woff2 +0 -0
  12. package/dist/assets/a865edea076e0166.woff2 +0 -0
  13. package/dist/assets/b921df26851c5aca.woff2 +0 -0
  14. package/dist/assets/c6a3f4e555097159.woff2 +0 -0
  15. package/dist/assets/c6c31cb1350b2544.woff2 +0 -0
  16. package/dist/fonts.css +1 -0
  17. package/dist/{yoopta.d.ts → fonts.d.ts} +6 -6
  18. package/dist/fonts.js +2 -0
  19. package/dist/fonts.js.map +1 -0
  20. package/dist/icons.d.ts +33 -6
  21. package/dist/icons.js +180 -167
  22. package/dist/icons.js.map +1 -1
  23. package/dist/ui.css +1 -1
  24. package/dist/ui.d.ts +570 -531
  25. package/dist/ui.js +16261 -14582
  26. package/dist/ui.js.map +1 -1
  27. package/package.json +22 -24
  28. package/tests/_setup/e2e-helpers.tsx +169 -0
  29. package/tests/_setup/markdown-classes.ts +3 -0
  30. package/tests/_setup/portable-stories.ts +10 -0
  31. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-continues-an-ordered-list-when-Enter-is-pressed-at-the-end-of-a-numbered-line-1.png +0 -0
  32. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-renders-a-diagram-for-the-fenced-mermaid-block-1.png +0 -0
  33. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-renders-a-horizontal-rule-as-a-separator-1.png +0 -0
  34. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-renders-a-read-only-table-preview-when-the-table-block-is-inactive-1.png +0 -0
  35. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-shows-blockquote-text-from-the-sample-document-1.png +0 -0
  36. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-shows-fenced-TypeScript-sample-code-in-the-document-1.png +0 -0
  37. package/tests/e2e/MarkdownEditor/__screenshots__/edits.test.tsx/MarkdownEditor---edits-auto-continues-a-bullet-list-when-Enter-is-pressed-at-the-end-of-a-list-item-1.png +0 -0
  38. package/tests/e2e/MarkdownEditor/__screenshots__/edits.test.tsx/MarkdownEditor---edits-expands-triple-backtick-into-a-fenced-code-block-with-the-caret-on-the-empty-body-line-1.png +0 -0
  39. package/tests/e2e/MarkdownEditor/__screenshots__/edits.test.tsx/MarkdownEditor---edits-reflects-typed-characters-in-the-underlying-document-1.png +0 -0
  40. package/tests/e2e/MarkdownEditor/__screenshots__/heading-fold.test.tsx/MarkdownEditor---heading-folds-viewer--folds-and-unfolds-a-heading-section-via-the-margin-control-1.png +0 -0
  41. package/tests/e2e/MarkdownEditor/__screenshots__/hybrid-widgets.test.tsx/MarkdownEditor---hybrid-widgets-clicking-a-callout-header-focuses-the-editor-and-parks-the-caret-inside-the-callout--REASONING--4--1.png +0 -0
  42. package/tests/e2e/MarkdownEditor/__screenshots__/hybrid-widgets.test.tsx/MarkdownEditor---hybrid-widgets-keeps-list-bullets-consistent-after-hopping-the-caret-across-items-several-times-1.png +0 -0
  43. package/tests/e2e/MarkdownEditor/__screenshots__/hybrid-widgets.test.tsx/MarkdownEditor---hybrid-widgets-reveals-heading-marks-when-the-caret-enters-the-heading-line-and-hides-them-when-it-leaves-1.png +0 -0
  44. package/tests/e2e/MarkdownEditor/__screenshots__/hybrid-widgets.test.tsx/MarkdownEditor---hybrid-widgets-shows-the-right-callout-title-when-moving-focus-between-consecutive-callouts-1.png +0 -0
  45. package/tests/e2e/MarkdownEditor/__screenshots__/hybrid-widgets.test.tsx/MarkdownEditor---preview-widgets-clicking-a-callout-header-focuses-the-editor-with-the-caret-in-that-callout-1.png +0 -0
  46. package/tests/e2e/MarkdownEditor/__screenshots__/hybrid-widgets.test.tsx/MarkdownEditor---preview-widgets-keeps-list-bullets-consistent-after-hopping-the-caret-across-items-several-times-1.png +0 -0
  47. package/tests/e2e/MarkdownEditor/__screenshots__/hybrid-widgets.test.tsx/MarkdownEditor---preview-widgets-shows-the-right-callout-title-when-moving-focus-between-consecutive-callouts-1.png +0 -0
  48. package/tests/e2e/MarkdownEditor/__screenshots__/jsx-block-content.test.tsx/MarkdownEditor---block-JSX-components-clicking-the-edit-source-action-selects-the-component-source-range-1.png +0 -0
  49. package/tests/e2e/MarkdownEditor/__screenshots__/jsx-block-content.test.tsx/MarkdownEditor---block-JSX-components-renders-block-components-via-JsxBlockWidget-with-an-edit-source-action-1.png +0 -0
  50. package/tests/e2e/MarkdownEditor/__screenshots__/jsx-block-content.test.tsx/MarkdownEditor---inline-JSX-rendering-block-content-keeps-multiple-inline-JSX-widgets-on-the-same-line-side-by-side-1.png +0 -0
  51. package/tests/e2e/MarkdownEditor/__screenshots__/jsx-highlight.test.tsx/MarkdownEditor---JSX-attribute-highlighting-does-not-let-the-nested-HTML-parser-mis-highlight-attributes-after-an-expression-1.png +0 -0
  52. package/tests/e2e/MarkdownEditor/__screenshots__/jsx-selection.test.tsx/MarkdownEditor---JSX-selection-reveal-shows-JSX-widget-when-inactive-and-raw-source-when-caret-is-inside-the-tag-1.png +0 -0
  53. package/tests/e2e/MarkdownEditor/__screenshots__/media-sizing.test.tsx/MarkdownEditor---media-sizing-images-and-videos-do-not-exceed-the-editor-content-width-1.png +0 -0
  54. package/tests/e2e/MarkdownEditor/__screenshots__/media-sizing.test.tsx/MarkdownEditor---media-sizing-matches-MarkdownViewer-image-width-in-the-split-playground-1.png +0 -0
  55. package/tests/e2e/MarkdownEditor/__screenshots__/modes.test.tsx/MarkdownEditor---modes-standalone-MarkdownViewer-is-not-a-CodeMirror-surface-1.png +0 -0
  56. package/tests/e2e/MarkdownEditor/__screenshots__/modes.test.tsx/MarkdownEditor---modes-toggling-the-SegmentedControl-swaps-mode-without-remounting-the-editor-1.png +0 -0
  57. package/tests/e2e/MarkdownEditor/__screenshots__/regressions.test.tsx/MarkdownEditor---regressions-repeated-checkbox-toggles-do-not-duplicate-or-drift-task-markers-1.png +0 -0
  58. package/tests/e2e/MarkdownEditor/__screenshots__/regressions.test.tsx/MarkdownEditor---regressions-scroll-position-is-preserved-when-the-document-is-edited--chat-92584463--1.png +0 -0
  59. package/tests/e2e/MarkdownEditor/__screenshots__/regressions.test.tsx/MarkdownEditor---regressions-task-checkbox-toggles-between-checked-and-unchecked-in-the-source-document-1.png +0 -0
  60. package/tests/e2e/MarkdownEditor/__screenshots__/regressions.test.tsx/MarkdownEditor---regressions-toggle-via-checkbox-preserves-task-marker-widgets-visible-from-the-previous-caret-position-1.png +0 -0
  61. package/tests/e2e/MarkdownEditor/__screenshots__/slash-commands.test.tsx/MarkdownEditor---slash-commands-dismisses-on-Escape-and-leaves-the-slash-as-literal-text-1.png +0 -0
  62. package/tests/e2e/MarkdownEditor/__screenshots__/slash-commands.test.tsx/MarkdownEditor---slash-commands-highlights-the-slash-and-shows-an-Enter-command-placeholder-until-text-is-typed-1.png +0 -0
  63. package/tests/e2e/MarkdownEditor/__screenshots__/slash-commands.test.tsx/MarkdownEditor---slash-commands-opens-a-filtered--keyboard-navigable-menu-and-inserts-boilerplate-on-Enter-1.png +0 -0
  64. package/tests/e2e/MarkdownEditor/__screenshots__/undo-redo.test.tsx/MarkdownEditor---undo-and-redo-restores-undone-document-edits-via-redo-1.png +0 -0
  65. package/tests/e2e/MarkdownEditor/content-blocks.test.tsx +152 -0
  66. package/tests/e2e/MarkdownEditor/edits.test.tsx +111 -0
  67. package/tests/e2e/MarkdownEditor/heading-fold.test.tsx +44 -0
  68. package/tests/e2e/MarkdownEditor/hybrid-widgets.test.tsx +192 -0
  69. package/tests/e2e/MarkdownEditor/jsx-block-content.test.tsx +242 -0
  70. package/tests/e2e/MarkdownEditor/jsx-highlight.test.tsx +68 -0
  71. package/tests/e2e/MarkdownEditor/jsx-inline-badges.test.tsx +59 -0
  72. package/tests/e2e/MarkdownEditor/jsx-selection.test.tsx +43 -0
  73. package/tests/e2e/MarkdownEditor/link-placeholder.test.tsx +67 -0
  74. package/tests/e2e/MarkdownEditor/media-align.test.tsx +57 -0
  75. package/tests/e2e/MarkdownEditor/media-edit.test.tsx +63 -0
  76. package/tests/e2e/MarkdownEditor/media-sizing.test.tsx +123 -0
  77. package/tests/e2e/MarkdownEditor/modes.test.tsx +93 -0
  78. package/tests/e2e/MarkdownEditor/regressions.test.tsx +182 -0
  79. package/tests/e2e/MarkdownEditor/slash-commands.test.tsx +99 -0
  80. package/tests/e2e/MarkdownEditor/table-click.test.tsx +47 -0
  81. package/tests/e2e/MarkdownEditor/table-controls.test.tsx +56 -0
  82. package/tests/e2e/MarkdownEditor/table-format.test.tsx +41 -0
  83. package/tests/e2e/MarkdownEditor/undo-redo.test.tsx +38 -0
  84. package/tests/e2e/MarkdownViewer/__screenshots__/parity.test.tsx/MarkdownViewer---editor-parity-matches-computed-font-size-on-first-heading-1.png +0 -0
  85. package/tests/e2e/MarkdownViewer/__screenshots__/parity.test.tsx/MarkdownViewer---editor-parity-matches-counts-for-shared-structural-classes-1.png +0 -0
  86. package/tests/e2e/MarkdownViewer/__screenshots__/parity.test.tsx/MarkdownViewer---editor-parity-matches-visible-text-between-preview-editor--blurred--and-MarkdownViewer-1.png +0 -0
  87. package/tests/e2e/MarkdownViewer/__screenshots__/render.test.tsx/MarkdownViewer---render-exercises-shared-preview-class-names-without-mounting-CodeMirror-1.png +0 -0
  88. package/tests/e2e/MarkdownViewer/parity.test.tsx +190 -0
  89. package/tests/e2e/MarkdownViewer/render.test.tsx +35 -0
  90. package/tests/unit/Editor/helpers.test.ts +42 -0
  91. package/tests/unit/MarkdownEditor/code-info.test.ts +63 -0
  92. package/tests/unit/MarkdownEditor/decorations.test.ts +488 -0
  93. package/tests/unit/MarkdownEditor/editor-ready.test.ts +36 -0
  94. package/tests/unit/MarkdownEditor/html-descriptors.test.ts +94 -0
  95. package/tests/unit/MarkdownEditor/jsx-attr-scan.test.ts +115 -0
  96. package/tests/unit/MarkdownEditor/jsx-tag-grammar.test.ts +88 -0
  97. package/tests/unit/MarkdownEditor/list-indent.test.ts +95 -0
  98. package/tests/unit/MarkdownEditor/slash-commands.test.ts +213 -0
  99. package/tests/unit/MarkdownEditor/table-format.test.ts +83 -0
  100. package/tests/unit/MarkdownEditor/table.test.ts +119 -0
  101. package/tests/unit/MarkdownEditor/triggers.test.ts +244 -0
  102. package/tests/unit/MarkdownEditor/widget-store.test.ts +105 -0
  103. package/tests/unit/MarkdownViewer/code-title.test.tsx +62 -0
  104. package/tests/unit/MarkdownViewer/features.test.tsx +110 -0
  105. package/tests/unit/MarkdownViewer/headings.test.tsx +40 -0
  106. package/tests/unit/MarkdownViewer/jsx.test.tsx +211 -0
  107. package/tests/unit/MarkdownViewer/list-bullets.test.tsx +49 -0
  108. package/tests/unit/MarkdownViewer/list-code.test.tsx +65 -0
  109. package/tests/unit/MarkdownViewer/renderers.test.tsx +79 -0
  110. package/tests/unit/MarkdownViewer/runnable.test.tsx +69 -0
  111. package/tests/unit/MarkdownViewer/ssr.test.tsx +93 -0
  112. package/dist/yoopta.css +0 -1
package/dist/ui.d.ts CHANGED
@@ -1,18 +1,15 @@
1
1
  import { ActionIconProps } from '@mantine/core';
2
2
  import { AlertProps } from '@mantine/core';
3
- import { AnchorProps } from '@mantine/core';
4
3
  import { BadgeProps } from '@mantine/core';
5
- import { BlockquoteElement } from '@yoopta/blockquote';
6
4
  import { BoxProps } from '@mantine/core';
7
5
  import { ButtonProps } from '@mantine/core';
8
- import { CalloutElementMap } from '@yoopta/callout/dist/types';
9
6
  import { CodeProps } from '@mantine/core';
10
7
  import { Command } from '@codemirror/view';
8
+ import { ComponentType } from 'react';
11
9
  import { default as default_2 } from 'github-slugger';
12
- import { DividerElementMap } from '@yoopta/divider/dist/types';
13
10
  import { EditorSelection } from '@codemirror/state';
11
+ import { EditorState } from '@codemirror/state';
14
12
  import { EditorView } from '@codemirror/view';
15
- import { ElementProps } from '@mantine/core';
16
13
  import { Extension } from '@codemirror/state';
17
14
  import { FC } from 'react';
18
15
  import { GroupProps } from '@mantine/core';
@@ -21,7 +18,7 @@ import { HighlightStyle } from '@codemirror/language';
21
18
  import { HTMLAttributes } from 'react';
22
19
  import { ImageProps } from '@mantine/core';
23
20
  import { KeyBinding } from '@codemirror/view';
24
- import { ListElementMap } from '@yoopta/lists/dist/types';
21
+ import { Language as Language_2 } from '@codemirror/language';
25
22
  import { MantineColor } from '@mantine/core';
26
23
  import { MantineColorScheme } from '@mantine/core';
27
24
  import { MantineFontSize } from '@mantine/core';
@@ -29,26 +26,21 @@ import { MantineSize } from '@mantine/core';
29
26
  import { MantineThemeOverride } from '@mantine/core';
30
27
  import { PaperProps } from '@mantine/core';
31
28
  import { PropsWithChildren } from 'react';
32
- import type * as React_2 from 'react';
33
29
  import { ReactElement } from 'react';
34
30
  import { ReactNode } from 'react';
35
31
  import { RefObject } from 'react';
36
32
  import { SelectProps } from '@mantine/core';
37
- import { SlateElement } from '@yoopta/editor';
38
- import { StackProps } from '@mantine/core';
33
+ import { StateEffectType } from '@codemirror/state';
39
34
  import { StateField } from '@codemirror/state';
35
+ import { SyntaxNode } from '@lezer/common';
40
36
  import { TabsListProps } from '@mantine/core';
41
37
  import { TabsProps as TabsProps_2 } from '@mantine/core';
42
38
  import { TabsTabProps } from '@mantine/core';
43
39
  import { TextProps } from '@mantine/core';
44
40
  import { TitleOrder } from '@mantine/core';
45
41
  import { TitleProps } from '@mantine/core';
42
+ import { Tree } from '@lezer/common';
46
43
  import { VideoHTMLAttributes } from 'react';
47
- import { YooEditor } from '@yoopta/editor';
48
- import { YooptaContentValue } from '@yoopta/editor';
49
- import { YooptaMark } from '@yoopta/editor';
50
- import { YooptaOnChangeOptions } from '@yoopta/editor';
51
- import { YooptaPlugin } from '@yoopta/editor';
52
44
 
53
45
  /**
54
46
  * A keybind used to accept a completion
@@ -72,10 +64,6 @@ export declare const addCursorVerticallyKeymap: readonly KeyBinding[];
72
64
 
73
65
  declare type AnyFn = (...rest: any[]) => any;
74
66
 
75
- declare type AnyLanguage = Language | (string & {});
76
-
77
- export declare type AnyNode = BlockNode | InlineNode | SummaryNode | ListItemNode | TableRowNode | TableCellNode;
78
-
79
67
  /**
80
68
  * Apply automatic folding to objects/arrays at the specified depth level
81
69
  * @param view - CodeMirror editor view
@@ -83,56 +71,6 @@ export declare type AnyNode = BlockNode | InlineNode | SummaryNode | ListItemNod
83
71
  */
84
72
  export declare function applyAutoFolding(view: EditorView, autoCollapseDepth: number): void;
85
73
 
86
- export declare type AttributeValue = string | JsxExpression | true;
87
-
88
- export declare const BlockEditor: FC<BlockEditorProps>;
89
-
90
- export declare interface BlockEditorProps {
91
- editor: YooEditor;
92
- placeholder?: string;
93
- autoFocus?: boolean;
94
- readOnly?: boolean;
95
- className?: string;
96
- onChange?: (value: YooptaContentValue, options: YooptaOnChangeOptions) => void;
97
- children?: ReactNode;
98
- }
99
-
100
- export declare type BlockNode = HeadingNode | ParagraphNode | CodeNode | BlockquoteNode | ListNode | TableNode | ThematicBreakNode | DivNode | DetailsNode | ImageNode | JsxComponentNode;
101
-
102
- export declare type BlockOptionsComponent = FC<{
103
- blockId: string;
104
- }>;
105
-
106
- export declare const BlockOptionsContext: React.Context<BlockOptionsContextValue>;
107
-
108
- export declare interface BlockOptionsContextValue {
109
- headingLinks?: boolean;
110
- checkable?: boolean;
111
- }
112
-
113
- export declare const BlockOptionsProvider: React.Provider<BlockOptionsContextValue>;
114
-
115
- declare type BlockquoteElementMap = {
116
- blockquote: BlockquoteElement;
117
- };
118
-
119
- export declare interface BlockquoteNode extends CommonAttrs {
120
- type: "blockquote";
121
- children: BlockNode[];
122
- noteKind?: NoteKind;
123
- noteTitle?: string;
124
- }
125
-
126
- export declare const BlockRenderer: FC<BlockRendererProps>;
127
-
128
- export declare interface BlockRendererProps {
129
- value: YooptaContentValue;
130
- marks?: YooptaMark<any>[];
131
- plugins?: YooptaPlugin<Record<string, SlateElement>, Record<string, unknown>>[];
132
- blockOptions?: BlockOptionsContextValue;
133
- className?: string;
134
- }
135
-
136
74
  export declare interface BooleanHandle {
137
75
  open: () => void;
138
76
  close: () => void;
@@ -294,50 +232,18 @@ export declare const brandYaacomm: string;
294
232
 
295
233
  export declare const brandYouTube: string;
296
234
 
297
- export declare const BreadcrumbButton: FC<ButtonProps & ElementProps<"button">>;
235
+ export declare const BreadcrumbButton: FC<ButtonProps>;
298
236
 
299
- export declare interface BreakNode extends CommonAttrs {
300
- type: "break";
301
- }
237
+ /**
238
+ * GitHub-flavoured markdown alert kinds (`> [!kind]`, see GitHub docs).
239
+ * Other spellings in source are normalised onto this set.
240
+ */
241
+ declare type CalloutKind = "note" | "tip" | "important" | "warning" | "caution";
302
242
 
303
243
  export declare const CDN_ID_PATTERN: RegExp;
304
244
 
305
245
  export declare const CDN_URL_PATTERN: RegExp;
306
246
 
307
- export declare const CDNImage: YooptaPlugin<CDNImageElementMap>;
308
-
309
- export declare type CDNImageElement = SlateElement<"cdn-image", CDNImageProps>;
310
-
311
- export declare type CDNImageElementMap = {
312
- "cdn-image": CDNImageElement;
313
- };
314
-
315
- export declare interface CDNImageProps {
316
- nodeType: "void";
317
- code: string;
318
- alt: string;
319
- }
320
-
321
- export declare const CDNVideo: YooptaPlugin<CDNVideoElementMap>;
322
-
323
- export declare type CDNVideoElement = SlateElement<"cdn-video", CDNVideoProps>;
324
-
325
- export declare type CDNVideoElementMap = {
326
- "cdn-video": CDNVideoElement;
327
- };
328
-
329
- export declare type CDNVideoFormat = "mp4" | "webm" | "mov";
330
-
331
- export declare interface CDNVideoProps {
332
- nodeType: "void";
333
- code: string;
334
- format: CDNVideoFormat;
335
- loop: boolean;
336
- autoplay: boolean;
337
- muted: boolean;
338
- controls: boolean;
339
- }
340
-
341
247
  export declare function Check({ children, ...props }: CheckProps): ReactNode;
342
248
 
343
249
  export declare interface CheckProps extends GroupProps {
@@ -376,31 +282,28 @@ export declare interface CodeEditorProps extends BoxProps {
376
282
  ref?: RefObject<EditorView>;
377
283
  }
378
284
 
379
- export declare interface CodeNode extends CommonAttrs {
380
- type: "code";
381
- value: string;
382
- lang?: string;
383
- title?: string;
384
- runnable?: string;
385
- }
285
+ /** React component keyed by lower-cased fenced-code info string. */
286
+ export declare type CodeRenderer = ComponentType<CodeRendererProps>;
386
287
 
387
- export declare const COLOR_OPTIONS: OptionItem[];
288
+ /** Props for a custom fenced-code-block renderer (inactive block / viewer). */
289
+ export declare interface CodeRendererProps {
290
+ /** The code body verbatim (CodeText slice, fences excluded). */
291
+ code: string;
292
+ /** The (lower-cased) info string from the opening fence, e.g. `mermaid`. */
293
+ language: string;
294
+ }
388
295
 
389
296
  export declare type ColorScheme = keyof ThemeConfig;
390
297
 
391
298
  declare type ColorScheme_2 = keyof ThemeConfig_2;
392
299
 
300
+ declare type CommandAction = (view: EditorView, range: SlashCommandRange) => void;
301
+
393
302
  declare interface CommentNode {
394
303
  type: "Comment";
395
304
  text: string;
396
305
  }
397
306
 
398
- export declare interface CommonAttrs {
399
- className?: AttributeValue;
400
- id?: AttributeValue;
401
- style?: AttributeValue;
402
- }
403
-
404
307
  /**
405
308
  * Common extensions applied to all CodeMirror editors
406
309
  */
@@ -444,31 +347,26 @@ export declare function createSerializedState(doc: string): EditorStateSnapshot;
444
347
  */
445
348
  export declare function createStyleHighlighter(theme: ThemeConfig_2, colorScheme: ColorScheme_2): Highlighter;
446
349
 
447
- export declare const CUSTOM_BLOCKS: Set<string>;
448
-
449
350
  /**
450
351
  * A custom variant of the history keymap that uses
451
352
  * the Mod key instead of the Ctrl key
452
353
  */
453
354
  export declare const customHistoryKeymap: readonly KeyBinding[];
454
355
 
455
- export declare const DEFAULT_BLOCK_MARKS: YooptaMark<any>[];
456
-
457
- export declare const DEFAULT_BLOCK_PLUGINS: YooptaPlugin<Record<string, SlateElement>, Record<string, unknown>>[];
458
-
459
- export declare const DEFAULT_BUTTON_PROPS: MantineButtonProps;
460
-
461
- export declare const DEFAULT_CODEBLOCK_PROPS: SurrealCodeBlockProps;
462
-
463
- export declare const DEFAULT_IMAGE_PROPS: CDNImageProps;
356
+ /** Default fenced-code renderers keyed by lower-cased info string (e.g. `mermaid`). */
357
+ export declare const DEFAULT_CODE_RENDERERS: Record<string, CodeRenderer>;
464
358
 
465
- export declare const DEFAULT_LINK_PROPS: SurrealLinkProps;
359
+ /** Default JSX components for `<PascalCase />` tags in markdown (e.g. `<Since />`, `<Tabs>`). */
360
+ export declare const DEFAULT_COMPONENTS: MarkdownComponents;
466
361
 
467
- export declare const DEFAULT_TABLE_PROPS: MantineTableProps;
362
+ /** Default mode used when no mode is provided. */
363
+ export declare const DEFAULT_MARKDOWN_MODE: MarkdownEditMode;
468
364
 
469
- export declare const DEFAULT_VIDEO_EMBED_PROPS: VideoEmbedProps;
470
-
471
- export declare const DEFAULT_VIDEO_PROPS: CDNVideoProps;
365
+ /**
366
+ * Built-in slash commands for the Markdown editor. Consumers can override or
367
+ * extend this set via the `commands` prop on `MarkdownEditor`.
368
+ */
369
+ export declare const DEFAULT_SLASH_COMMANDS: readonly SlashCommand[];
472
370
 
473
371
  export declare type DefaultSort = {
474
372
  [key: string]: unknown;
@@ -482,11 +380,6 @@ export declare const Details: FC<DetailsProps> & {
482
380
  Summary: FC<SummaryProps>;
483
381
  };
484
382
 
485
- export declare interface DetailsNode extends CommonAttrs {
486
- type: "details";
487
- children: Array<SummaryNode | BlockNode>;
488
- }
489
-
490
383
  export declare interface DetailsProps extends Omit<BoxProps, "component" | "children"> {
491
384
  children: ReactNode;
492
385
  }
@@ -497,11 +390,6 @@ export declare interface DiagramNode {
497
390
  children: RailroadNode[];
498
391
  }
499
392
 
500
- export declare interface DivNode extends CommonAttrs {
501
- type: "div";
502
- children: BlockNode[];
503
- }
504
-
505
393
  declare type DynamicNode<T> = ReactNode | ((value: T) => ReactNode);
506
394
 
507
395
  export declare interface EditorController {
@@ -538,11 +426,6 @@ export declare type EditorStateSnapshot = Record<string, unknown>;
538
426
  */
539
427
  export declare function editorTheme(theme: ThemeConfig_2, colorScheme: MantineColorScheme): Extension;
540
428
 
541
- export declare interface EmphasisNode extends CommonAttrs {
542
- type: "emphasis";
543
- children: InlineNode[];
544
- }
545
-
546
429
  export declare function extractCdnId(query: string): string | undefined;
547
430
 
548
431
  export declare interface ExtractedCode {
@@ -551,12 +434,15 @@ export declare interface ExtractedCode {
551
434
  }
552
435
 
553
436
  /**
554
- * Extract headers from a Markdown AST
555
- *
556
- * @param ast - The Markdown AST
557
- * @returns An array of headings
437
+ * Extract headings from a Lezer markdown tree (SSR-safe).
438
+ * Walks the full tree and collects plain inline text (no markdown delimiters).
558
439
  */
559
- export declare function extractHeaders(ast: Root): Heading[];
440
+ export declare function extractHeadings(tree: Tree, source: MarkdownSource, opts?: ExtractHeadingsOptions): Heading[];
441
+
442
+ export declare interface ExtractHeadingsOptions {
443
+ /** Heading depths to include. Default: `[2, 3]`. */
444
+ depths?: ReadonlyArray<1 | 2 | 3 | 4 | 5 | 6>;
445
+ }
560
446
 
561
447
  /**
562
448
  * Extract test code from block comments at the start.
@@ -564,7 +450,8 @@ export declare function extractHeaders(ast: Root): Heading[];
564
450
  */
565
451
  export declare function extractTest(input: string): ExtractedCode;
566
452
 
567
- export declare const FontLinks: FC;
453
+ /** Case-insensitive filter over command titles and keywords. */
454
+ export declare function filterSlashCommands(commands: readonly SlashCommand[], query: string): SlashCommand[];
568
455
 
569
456
  /**
570
457
  * Generate a 24-character hex string suitable for use as a
@@ -573,41 +460,44 @@ export declare const FontLinks: FC;
573
460
  */
574
461
  export declare function generateRandomId(): string;
575
462
 
576
- export declare function getBlockOptionsComponent(blockType: string): BlockOptionsComponent | undefined;
577
-
578
463
  export declare function getCDNImageURL(imageId: string | undefined, width?: number, quality?: number): string | undefined;
579
464
 
580
465
  export declare function getCDNVideoURL(videoId: string | undefined, format?: "mp4" | "webm" | "mov", controls?: boolean): string | undefined;
581
466
 
582
- export declare function Header({ order, kicker, description, kickerProps, titleProps, descriptionProps, children, ...boxProps }: PropsWithChildren<HeaderProps>): ReactElement;
467
+ /** Read whether the markdown editor has completed its initial paint. */
468
+ export declare function getMarkdownEditorReady(state: EditorState): boolean;
583
469
 
584
- export declare interface HeaderProps extends BoxProps {
585
- /** The kicker text to display above the title */
586
- kicker?: ReactNode;
587
- /** Heading order (1-6), controls `font-size` when `size` is not set on the title. @default `1` */
588
- order?: TitleOrder;
589
- /** A description text to display below the title */
590
- description?: string;
591
- /** Props to pass to the kicker component */
592
- kickerProps?: TextProps;
593
- /** Props to pass to the title component */
594
- titleProps?: TitleProps;
595
- /** Props to pass to the description component */
596
- descriptionProps?: TextProps;
597
- }
470
+ /**
471
+ * Read the current markdown mode from an {@link EditorState}.
472
+ */
473
+ export declare function getMarkdownMode(state: EditorState): MarkdownEditMode;
598
474
 
599
- export declare interface Heading {
475
+ /** A document heading with slug id, plain text, and depth. */
476
+ declare interface Heading {
600
477
  id: string;
601
478
  text: string;
602
479
  depth: 1 | 2 | 3 | 4 | 5 | 6;
603
480
  }
604
481
 
605
- export declare interface HeadingNode extends CommonAttrs {
606
- type: "heading";
607
- depth: 1 | 2 | 3 | 4 | 5 | 6;
608
- children: InlineNode[];
482
+ /** Source range of `{#custom-id}` suffix when present. */
483
+ export declare function headingCustomIdSuffixRange(node: SyntaxNode, source: MarkdownSource): {
484
+ from: number;
485
+ to: number;
486
+ } | undefined;
487
+
488
+ /** Heading title source bounds (after `HeaderMark`, trailing newlines and `{#id}` trimmed). */
489
+ export declare interface HeadingTitleBounds {
490
+ titleFrom: number;
491
+ /** End of title line, excluding trailing newlines. */
492
+ titleTo: number;
493
+ /** End of visible title (excludes `{#id}` suffix when present). */
494
+ visibleTo: number;
495
+ /** Custom id from `{#id}` suffix when present. */
496
+ customId?: string;
609
497
  }
610
498
 
499
+ export declare function headingTitleBounds(node: SyntaxNode, source: MarkdownSource): HeadingTitleBounds;
500
+
611
501
  export declare const Highlighting: FC<HighlightingProps>;
612
502
 
613
503
  export declare interface HighlightingProps extends BoxProps {
@@ -639,14 +529,24 @@ export declare const iconAlert: string;
639
529
 
640
530
  export declare const iconAPI: string;
641
531
 
532
+ export declare const iconArrowDown: string;
533
+
642
534
  export declare const iconArrowDownFat: string;
643
535
 
536
+ export declare const iconArrowEnter: string;
537
+
644
538
  export declare const iconArrowLeft: string;
645
539
 
646
540
  export declare const iconArrowLeftFat: string;
647
541
 
542
+ export declare const iconArrowRight: string;
543
+
544
+ export declare const iconArrowUp: string;
545
+
648
546
  export declare const iconArrowUpRight: string;
649
547
 
548
+ export declare const iconAtom: string;
549
+
650
550
  export declare const iconAuth: string;
651
551
 
652
552
  export declare const iconAuthKeyhole: string;
@@ -657,6 +557,8 @@ export declare const iconBalance: string;
657
557
 
658
558
  export declare const iconBook: string;
659
559
 
560
+ export declare const iconBookmark: string;
561
+
660
562
  export declare const iconBraces: string;
661
563
 
662
564
  export declare const iconBrandBluesky: string;
@@ -689,6 +591,8 @@ export declare const iconBug: string;
689
591
 
690
592
  export declare const iconBullhorn: string;
691
593
 
594
+ export declare const iconBusiness: string;
595
+
692
596
  export declare const iconCalculator: string;
693
597
 
694
598
  export declare const iconCancel: string;
@@ -757,6 +661,8 @@ export declare const iconDesigner: string;
757
661
 
758
662
  export declare const iconDiscord: string;
759
663
 
664
+ export declare const iconDistributedStorage: string;
665
+
760
666
  export declare const iconDollar: string;
761
667
 
762
668
  export declare const iconDotsVertical: string;
@@ -819,6 +725,8 @@ export declare const iconIndex: string;
819
725
 
820
726
  export declare const iconInfo: string;
821
727
 
728
+ export declare const iconIntegration: string;
729
+
822
730
  export declare const iconJSON: string;
823
731
 
824
732
  export declare const iconKey: string;
@@ -841,6 +749,8 @@ export declare const iconMarker: string;
841
749
 
842
750
  export declare const iconMaximize: string;
843
751
 
752
+ export declare const iconMCP: string;
753
+
844
754
  export declare const iconMemory: string;
845
755
 
846
756
  export declare const iconMinimize: string;
@@ -859,6 +769,8 @@ export declare const iconNamespace: string;
859
769
 
860
770
  export declare const iconNewspaper: string;
861
771
 
772
+ export declare const iconOffice: string;
773
+
862
774
  export declare const iconOpen: string;
863
775
 
864
776
  export declare const iconOpenFolder: string;
@@ -877,6 +789,8 @@ export declare const iconPinOff: string;
877
789
 
878
790
  export declare const iconPlay: string;
879
791
 
792
+ export declare const iconPlugin: string;
793
+
880
794
  export declare const iconPlus: string;
881
795
 
882
796
  export declare const iconPower: string;
@@ -935,6 +849,8 @@ export declare const iconSun: string;
935
849
 
936
850
  export declare const iconSurreal: string;
937
851
 
852
+ export declare const iconSurrealism: string;
853
+
938
854
  export declare const iconSurrealist: string;
939
855
 
940
856
  export declare const iconTable: string;
@@ -979,50 +895,36 @@ export declare const iconWrench: string;
979
895
 
980
896
  export declare const iconXml: string;
981
897
 
982
- export declare interface ImageNode extends CommonAttrs {
983
- type: "image";
898
+ /** Any object intersected with a stable string `id`. */
899
+ export declare type Identified<T = object, I = string> = T & {
900
+ id: I;
901
+ };
902
+
903
+ /** Normalised image descriptor for viewer renderers and `onImage` callbacks. */
904
+ export declare interface ImageDescriptor {
984
905
  src: string;
985
- darkSrc?: string;
986
- alt: string;
906
+ alt?: string;
987
907
  title?: string;
908
+ darkSrc?: string;
988
909
  }
989
910
 
990
- export declare interface InlineCodeNode extends CommonAttrs {
991
- type: "inlineCode";
992
- value: string;
993
- }
911
+ /**
912
+ * Build a `run` that inserts a callout of the given kind.
913
+ */
914
+ export declare function insertCallout(kind: CalloutKind): CommandAction;
994
915
 
995
- export declare type InlineNode = TextNode | LinkNode | InlineCodeNode | StrongNode | EmphasisNode | SuperscriptNode | SubscriptNode | BreakNode | SpanNode | ImageNode | JsxExpressionNode | JsxComponentNode;
916
+ /**
917
+ * Build a `run` that inserts the given markdown and positions the caret at the end of the inserted text,
918
+ * or at the given offset.
919
+ */
920
+ export declare function insertMarkdown(insert: string, caretOffset?: number): CommandAction;
996
921
 
997
922
  export declare function isCDNId(query: string): boolean;
998
923
 
999
- export declare interface JsxComponentNode extends CommonAttrs {
1000
- type: "jsxComponent";
1001
- name: string;
1002
- attributes: Record<string, AttributeValue>;
1003
- children: AnyNode[];
1004
- position?: NodePosition;
1005
- }
924
+ /** True when the registered component declares `block: true`. */
925
+ export declare function isMarkdownComponentBlock(components: MarkdownComponents | undefined, name: string): boolean;
1006
926
 
1007
- export declare interface JsxExpression {
1008
- type: "expression";
1009
- value: string;
1010
- }
1011
-
1012
- export declare interface JsxExpressionNode extends CommonAttrs {
1013
- type: "jsxExpression";
1014
- value: string;
1015
- position?: NodePosition;
1016
- }
1017
-
1018
- /**
1019
- * Controls how `<Component />` tags and `{expression}` values in markdown are handled.
1020
- *
1021
- * - `"render"` — Evaluate and render JSX normally (default).
1022
- * - `"throw"` — Throw an error when a JSX node is encountered.
1023
- * - `"graceful"` — Render an inline error box instead of the JSX node.
1024
- * - `"omit"` — Silently skip JSX nodes (render nothing).
1025
- */
927
+ /** How `<Component />` tags are handled. */
1026
928
  export declare type JsxMode = "render" | "throw" | "graceful" | "omit";
1027
929
 
1028
930
  export declare function Label({ label, ...props }: LabelProps): ReactNode;
@@ -1031,139 +933,310 @@ export declare interface LabelProps extends Omit<BadgeProps, "children"> {
1031
933
  label: string;
1032
934
  }
1033
935
 
1034
- declare type Language = "csharp" | "rust" | "javascript" | "typescript" | "surrealql" | "json" | "yaml" | "java" | "go" | "python" | "html" | "cli" | "php" | "syntax";
1035
-
1036
- export declare interface LinkNode extends CommonAttrs {
1037
- type: "link";
1038
- url: string;
1039
- title?: string;
1040
- children: InlineNode[];
1041
- }
1042
-
1043
- export declare interface ListItemNode extends CommonAttrs {
1044
- type: "listItem";
1045
- checked?: boolean;
1046
- spread?: boolean;
1047
- children: AnyNode[];
1048
- }
1049
-
1050
- export declare interface ListNode extends CommonAttrs {
1051
- type: "list";
1052
- variant?: "ordered" | "unordered" | "checklist";
1053
- start?: number;
1054
- spread?: boolean;
1055
- children: ListItemNode[];
1056
- }
936
+ declare type Language = "csharp" | "rust" | "javascript" | "typescript" | "surrealql" | "json" | "yaml" | "java" | "go" | "python" | "html" | "cli" | "php" | "markdown" | "syntax";
1057
937
 
1058
938
  /**
1059
939
  * The Mantine theme configurtation
1060
940
  */
1061
941
  export declare const MANTINE_THEME: MantineThemeOverride;
1062
942
 
1063
- export declare const MantineBlockquote: YooptaPlugin<BlockquoteElementMap, Record<string, unknown>>;
1064
-
1065
- export declare const MantineButton: YooptaPlugin<MantineButtonElementMap>;
1066
-
1067
- export declare type MantineButtonElement = SlateElement<"mantine-button", MantineButtonProps>;
1068
-
1069
- export declare type MantineButtonElementMap = {
1070
- "mantine-button": MantineButtonElement;
1071
- };
1072
-
1073
- export declare interface MantineButtonProps {
1074
- nodeType: "void";
1075
- label: string;
1076
- url: string;
1077
- variant: ButtonProps["variant"];
1078
- color: MantineColor;
1079
- size: MantineSize;
1080
- radius: MantineSize;
1081
- fullWidth: boolean;
943
+ /**
944
+ * Configuration for a single `<Component />` registered in {@link MarkdownComponents}.
945
+ * Set `block: true` to opt into the block-rendering path (own line, hover
946
+ * outline, edit-source action) instead of the default inline-widget path.
947
+ */
948
+ export declare interface MarkdownComponentConfig {
949
+ component: ComponentType<any>;
950
+ block?: boolean;
1082
951
  }
1083
952
 
1084
- export declare const MantineCallout: YooptaPlugin<CalloutElementMap, Record<string, unknown>>;
1085
-
1086
- export declare const MantineChecklist: YooptaPlugin<Pick<ListElementMap, "todo-list">, Record<string, unknown>>;
1087
-
1088
- export declare const MantineDivider: YooptaPlugin<DividerElementMap, Record<string, unknown>>;
953
+ /** A registered component is either a bare React component (inline) or a config object. */
954
+ export declare type MarkdownComponentDef = ComponentType<any> | MarkdownComponentConfig;
1089
955
 
1090
- export declare const MantineTable: YooptaPlugin<MantineTableElementMap>;
956
+ /** Map of PascalCase JSX tag names to viewer/editor component registrations. */
957
+ export declare type MarkdownComponents = Record<string, MarkdownComponentDef>;
1091
958
 
1092
- export declare type MantineTableElement = SlateElement<"mantine-table", MantineTableProps>;
959
+ /**
960
+ * Rendering mode of the markdown editor.
961
+ *
962
+ * - `source` renders raw markdown syntax with subtle styling.
963
+ * - `preview` shows source markup only on the active line/block;
964
+ * other content is rendered visually.
965
+ */
966
+ export declare type MarkdownEditMode = "source" | "preview";
1093
967
 
1094
- export declare type MantineTableElementMap = {
1095
- "mantine-table": MantineTableElement;
1096
- };
968
+ /**
969
+ * High-level Markdown editor primitive that wires together the
970
+ * `CodeEditor` shell, the live preview extension, the widget store and
971
+ * the React portal host.
972
+ *
973
+ * See {@link MarkdownViewer} for a Markdown viewer equivalent.
974
+ */
975
+ export declare const MarkdownEditor: FC<MarkdownEditorProps>;
1097
976
 
1098
- export declare interface MantineTableProps {
1099
- nodeType: "void";
1100
- rows: string[][];
1101
- withHeaderRow: boolean;
1102
- striped: boolean;
1103
- highlightOnHover: boolean;
1104
- caption: string;
977
+ export declare interface MarkdownEditorProps extends Omit<EditorOptions, "language" | "extensions">, Omit<BoxProps, "onChange"> {
978
+ /** `source` or `preview` (live preview). Defaults to `preview`. */
979
+ mode?: MarkdownEditMode;
980
+ /** Additional CodeMirror extensions to layer on top of the live preview. */
981
+ extensions?: Extension;
982
+ /** GFM table preview widgets in preview mode. Defaults to `true`. */
983
+ tables?: boolean;
984
+ /**
985
+ * Auto-format GFM table source while editing: align columns and pad cells
986
+ * with trailing spaces. Defaults to `false`.
987
+ */
988
+ withTableFormatter?: boolean;
989
+ /** React components for `<PascalCase />` tags (preview widgets). */
990
+ components?: MarkdownComponents;
991
+ /** How unsupported JSX is handled in preview. Default `render` (uses {@link DEFAULT_COMPONENTS}). */
992
+ jsxMode?: JsxMode;
993
+ /** Auto-focus the editor on mount. */
994
+ autoFocus?: boolean;
995
+ /**
996
+ * Custom per-language renderers for fenced code blocks. Keys are the
997
+ * lower-cased fenced-code info string (e.g. `mermaid`). When the block
998
+ * is inactive, a matching renderer fully replaces the source. Defaults
999
+ * to `{ mermaid: MermaidCodeRenderer }`; pass `{}` to disable.
1000
+ */
1001
+ codeRenderers?: Record<string, CodeRenderer>;
1002
+ /** Enable the slash command palette. Defaults to `true`. */
1003
+ slashCommands?: boolean;
1004
+ /** Override the slash command set. Defaults to {@link DEFAULT_SLASH_COMMANDS}. */
1005
+ commands?: readonly SlashCommand[];
1105
1006
  }
1106
1007
 
1107
1008
  /**
1108
- * Main Markdown component that parses markdown and renders it
1109
- * Applies stylesheet and spacing
1009
+ * Marks the editor ready after the first animation frame so mount-time decoration
1010
+ * classes do not trigger CSS transitions. Exposes {@link markdownEditorReadyField}
1011
+ * and `data-markdown-ready` on the editor root.
1110
1012
  */
1111
- export declare function Markdown({ content, renderers, rendererProps, components, scope, }: MarkdownProps): React_2.ReactElement;
1013
+ export declare function markdownEditorReady(): Extension;
1112
1014
 
1113
- declare type MarkdownComponents = Record<string, React.ComponentType<any>>;
1015
+ /**
1016
+ * Whether the markdown editor has completed its initial paint. CSS transitions
1017
+ * and similar effects should be gated on this so decoration classes do not
1018
+ * animate from their pre-decoration computed values on mount.
1019
+ */
1020
+ export declare const markdownEditorReadyField: StateField<boolean>;
1114
1021
 
1115
- export declare interface MarkdownProps {
1116
- /**
1117
- * Markdown content to render
1118
- */
1119
- content: string;
1022
+ /**
1023
+ * Live preview stack: language (optional), mode field, folding, decorations, theme.
1024
+ */
1025
+ export declare function markdownLivePreview(opts: MarkdownLivePreviewOptions): Extension;
1026
+
1027
+ /** Options for {@link markdownLivePreview}. */
1028
+ export declare interface MarkdownLivePreviewOptions {
1029
+ /** GFM table preview widgets in preview mode. Defaults to `true`. */
1030
+ tables?: boolean;
1120
1031
  /**
1121
- * Override how built-in markdown elements are rendered.
1122
- * Keys are AST node types (`"heading"`, `"code"`, `"table"`, etc.).
1032
+ * Auto-format GFM table source on edit: align columns, pad cells with
1033
+ * trailing spaces, and normalise the delimiter row. Defaults to `false`.
1123
1034
  */
1124
- renderers?: MarkdownRenderers;
1035
+ withTableFormatter?: boolean;
1125
1036
  /**
1126
- * Extra props forwarded to specific built-in renderers (e.g. code block options).
1037
+ * Per-language renderers used when a fenced code block is inactive (preview
1038
+ * unfocused / caret outside the block). Keys are the lower-cased fenced-code
1039
+ * info string (e.g. `mermaid`). Defaults to `{}`.
1127
1040
  */
1128
- rendererProps?: MarkdownRendererProps;
1041
+ codeRenderers?: Record<string, CodeRenderer>;
1042
+ /** Required widget store, typically returned by `useMarkdownWidgetStore()`. */
1043
+ widgetStore: WidgetStore;
1044
+ /** Whether to install the markdown language alongside the live preview. */
1045
+ includeLanguage?: boolean;
1129
1046
  /**
1130
- * React components available for use as `<Component />` tags in the markdown content.
1131
- * Keys should match PascalCase tag names (e.g. `{ StatusCard, Alert }`).
1047
+ * Optional language resolver for embedded fenced code blocks.
1132
1048
  */
1049
+ resolveCodeLanguage?: (info: string) => Language_2 | undefined;
1050
+ /** JSX/HTML preview widgets (viewer parity). Omit to leave raw source in preview. */
1133
1051
  components?: MarkdownComponents;
1052
+ jsxMode?: JsxMode;
1134
1053
  /**
1135
- * Variable context for evaluating `{expression}` values in JSX attributes
1136
- * and inline expressions (e.g. `{ userName: "Alice", count: 42 }`).
1054
+ * Slash command palette. Pass a store (from `useSlashStore()`) to enable
1055
+ * the slash (`/`) command menu. Render `<SlashCommandMenu>` with the
1056
+ * same store. Omit to disable.
1137
1057
  */
1138
- scope?: Record<string, unknown>;
1058
+ slash?: {
1059
+ store: SlashStore;
1060
+ };
1061
+ }
1062
+
1063
+ /**
1064
+ * State field tracking the current {@link MarkdownEditMode}.
1065
+ */
1066
+ export declare const markdownModeField: StateField<MarkdownEditMode>;
1067
+
1068
+ /**
1069
+ * Bundles the slash session {@link slashSessionField} with a `ViewPlugin` that
1070
+ * mirrors the active session and caret into the given {@link SlashStore}, which
1071
+ * the React menu reads via `useSyncExternalStore`. Anchor coordinates are
1072
+ * measured by the React component — `coordsAtPos` cannot run during an update.
1073
+ */
1074
+ export declare function markdownSlashCommands(options: MarkdownSlashCommandsOptions): Extension;
1075
+
1076
+ /** Options for {@link markdownSlashCommands}. */
1077
+ export declare interface MarkdownSlashCommandsOptions {
1078
+ /** Store bridging the session to the React `<SlashCommandMenu>`. */
1079
+ store: SlashStore;
1080
+ }
1081
+
1082
+ /**
1083
+ * Document slice compatible with CodeMirror {@link Text} line API.
1084
+ * Used by tree helpers and the viewer renderer.
1085
+ */
1086
+ export declare interface MarkdownSource {
1087
+ readonly length: number;
1088
+ slice(from: number, to: number): string;
1089
+ lineAt(pos: number): {
1090
+ from: number;
1091
+ to: number;
1092
+ number: number;
1093
+ };
1094
+ line(n: number): {
1095
+ from: number;
1096
+ to: number;
1097
+ number: number;
1098
+ };
1099
+ readonly lineCount: number;
1139
1100
  }
1140
1101
 
1141
1102
  /**
1142
- * Extra props forwarded to specific built-in renderers (e.g. code block options).
1103
+ * Build a {@link MarkdownSource} from raw markdown (SSR-safe).
1104
+ */
1105
+ export declare function markdownSourceFromString(source: string): MarkdownSource;
1106
+
1107
+ /**
1108
+ * Editor base theme for the markdown live preview. Cursor / scroller rules and
1109
+ * editor-only chrome; shared surface styles live in `markdown.module.scss`.
1143
1110
  */
1144
- export declare interface MarkdownRendererProps {
1145
- code?: Partial<CodeBlockProps>;
1111
+ export declare function markdownTheme(): Extension;
1112
+
1113
+ /**
1114
+ * High-level Markdown viewer primitive that renders a Markdown structure
1115
+ * as a React tree.
1116
+ *
1117
+ * See {@link MarkdownEditor} for a Markdown editor equivalent.
1118
+ */
1119
+ export declare const MarkdownViewer: FC<MarkdownViewerProps>;
1120
+
1121
+ export declare interface MarkdownViewerProps extends BoxProps {
1122
+ /** Markdown source string. Ignored when `tree` is provided. */
1123
+ content?: string;
1124
+ /** Pre-parsed tree and markdown source. */
1125
+ tree?: MarkdownViewerTreeInput;
1126
+ /** Collapse consecutive blank lines into a single line break. Defaults to `true`. */
1127
+ collapseBlankLines?: boolean;
1128
+ /** Override built-in element renderers. */
1129
+ renderers?: MarkdownViewerRenderers;
1130
+ /** Rewrite image URLs before render (e.g. CDN resolution). */
1131
+ onImage?: (node: ImageDescriptor) => ImageDescriptor;
1132
+ /** Add slug IDs and hover anchor links on headings. */
1133
+ autoLink?: boolean;
1146
1134
  /**
1147
- * How `<Component />` tags and `{expression}` values are handled.
1148
- *
1149
- * @default "render"
1135
+ * Custom per-language renderers for fenced code blocks. Keys are the
1136
+ * lower-cased fenced-code info string (e.g. `mermaid`). When the block
1137
+ * is inactive, a matching renderer fully replaces the source. Defaults
1138
+ * to `{ mermaid: MermaidCodeRenderer }`; pass `{}` to disable.
1150
1139
  */
1151
- jsx?: JsxMode;
1140
+ codeRenderers?: Record<string, CodeRenderer>;
1141
+ /** React components for `<PascalCase />` tags. */
1142
+ components?: MarkdownComponents;
1143
+ /** How unsupported JSX is handled. Default `render` (uses {@link DEFAULT_COMPONENTS}). */
1144
+ jsxMode?: JsxMode;
1152
1145
  }
1153
1146
 
1154
- declare type MarkdownRenderers = Partial<RendererMap>;
1147
+ /**
1148
+ * Optional per-node React render overrides for {@link MarkdownViewer}.
1149
+ * `listItem` and `strikethrough` are reserved for a future release and are not
1150
+ * consulted by the current viewer pipeline.
1151
+ */
1152
+ export declare type MarkdownViewerRenderers = Partial<{
1153
+ heading: (props: {
1154
+ children: ReactNode;
1155
+ level: number;
1156
+ id?: string;
1157
+ }) => ReactNode;
1158
+ paragraph: (props: {
1159
+ children: ReactNode;
1160
+ }) => ReactNode;
1161
+ link: (props: {
1162
+ href: string;
1163
+ title?: string;
1164
+ children: ReactNode;
1165
+ }) => ReactNode;
1166
+ list: (props: {
1167
+ ordered: boolean;
1168
+ children: ReactNode;
1169
+ }) => ReactNode;
1170
+ listItem: (props: {
1171
+ children: ReactNode;
1172
+ checked?: boolean;
1173
+ }) => ReactNode;
1174
+ blockquote: (props: {
1175
+ children: ReactNode;
1176
+ }) => ReactNode;
1177
+ code: (props: {
1178
+ value: string;
1179
+ lang?: string;
1180
+ title?: string;
1181
+ runnable?: string;
1182
+ }) => ReactNode;
1183
+ inlineCode: (props: {
1184
+ value: string;
1185
+ }) => ReactNode;
1186
+ table: (props: {
1187
+ children: ReactNode;
1188
+ }) => ReactNode;
1189
+ thematicBreak: () => ReactNode;
1190
+ image: (props: ImageDescriptor) => ReactNode;
1191
+ strong: (props: {
1192
+ children: ReactNode;
1193
+ }) => ReactNode;
1194
+ emphasis: (props: {
1195
+ children: ReactNode;
1196
+ }) => ReactNode;
1197
+ strikethrough: (props: {
1198
+ children: ReactNode;
1199
+ }) => ReactNode;
1200
+ jsxComponent: (props: {
1201
+ name: string;
1202
+ children: ReactNode;
1203
+ attributes: Record<string, unknown>;
1204
+ }) => ReactNode;
1205
+ }>;
1206
+
1207
+ export declare interface MarkdownViewerTreeInput {
1208
+ tree: Tree;
1209
+ source: MarkdownSource;
1210
+ }
1211
+
1212
+ /**
1213
+ * React component that renders a portal for every widget registered in the
1214
+ * given {@link WidgetStore}. Mount this once per editor (the
1215
+ * `MarkdownEditor` primitive does this for you), inside the
1216
+ * `MantineProvider` tree so widgets inherit theme and other context.
1217
+ *
1218
+ * The component renders no DOM of its own — only invisible portal targets
1219
+ * that hand off to the host elements created by `WidgetType.toDOM()`.
1220
+ */
1221
+ export declare const MarkdownWidgetPortals: FC<MarkdownWidgetPortalsProps>;
1155
1222
 
1156
- export declare interface MDXProvidedComponents {
1157
- Check: typeof Check;
1158
- Label: typeof Label;
1159
- RailroadDiagram: typeof RailroadDiagram;
1160
- Since: typeof Since;
1161
- SurrealistMini: typeof SurrealistMini;
1162
- TabItem: typeof TabItem_2;
1163
- Tabs: typeof Tabs_2;
1164
- Version: typeof Version;
1223
+ export declare interface MarkdownWidgetPortalsProps {
1224
+ /** The store to read widget entries from. */
1225
+ store: WidgetStore;
1165
1226
  }
1166
1227
 
1228
+ /** Merge default JSX components with caller overrides (caller wins on key clash). */
1229
+ export declare function mergeMarkdownComponents(components?: MarkdownComponents): MarkdownComponents;
1230
+
1231
+ /**
1232
+ * Standalone {@link CodeRenderer} for fenced code blocks whose info string
1233
+ * is `mermaid`. Lazy-loads the `mermaid` module the first time it mounts so
1234
+ * consumers only pay the bundle cost when actually using diagrams. Renders
1235
+ * inside a Mantine `Center` while loading and replaces it with the SVG once
1236
+ * available.
1237
+ */
1238
+ export declare const MermaidCodeRenderer: CodeRenderer;
1239
+
1167
1240
  export declare interface MiniConfig {
1168
1241
  url?: string;
1169
1242
  dataset?: "surreal-deal-store-mini" | `/${string}.surql`;
@@ -1213,17 +1286,6 @@ export declare class MiniController {
1213
1286
  executeQuery(query: string): void;
1214
1287
  }
1215
1288
 
1216
- declare type NodeOfType<T extends AnyNode["type"]> = Extract<AnyNode, {
1217
- type: T;
1218
- }>;
1219
-
1220
- export declare interface NodePosition {
1221
- start: number;
1222
- end: number;
1223
- }
1224
-
1225
- export declare const NON_TEXT_BLOCKS: Set<string>;
1226
-
1227
1289
  declare interface NonTerminalNode {
1228
1290
  type: "NonTerminal";
1229
1291
  text: string;
@@ -1256,29 +1318,21 @@ declare interface OptionalNode {
1256
1318
  child: RailroadNode;
1257
1319
  }
1258
1320
 
1259
- declare type OptionItem = {
1260
- label: string;
1261
- value: string;
1262
- };
1263
-
1264
- export declare interface ParagraphNode extends CommonAttrs {
1265
- type: "paragraph";
1266
- children: InlineNode[];
1321
+ declare interface ParsedHeadingTitle {
1322
+ /** Visible title text (custom id suffix removed). */
1323
+ text: string;
1324
+ /** Custom id from `{#id}` when present. */
1325
+ customId?: string;
1267
1326
  }
1268
1327
 
1328
+ /** Split plain heading text into visible title and optional `{#id}` suffix. */
1329
+ export declare function parseHeadingTitleText(plain: string): ParsedHeadingTitle;
1330
+
1269
1331
  /**
1270
- * Parse markdown string to AST
1332
+ * Parse markdown into a Lezer syntax tree using the same grammar as CodeMirror.
1333
+ * Safe in SSR: no {@link EditorState} or DOM.
1271
1334
  */
1272
- export declare function parseMarkdown(markdown: string): Root;
1273
-
1274
- export declare interface ParserState {
1275
- lines: string[];
1276
- currentIndex: number;
1277
- stack: string[];
1278
- root: BlockNode[];
1279
- currentContainer: BlockNode[];
1280
- slugger: default_2;
1281
- }
1335
+ export declare function parseMarkdownTree(source: string): Tree;
1282
1336
 
1283
1337
  export declare const picto2106: string;
1284
1338
 
@@ -1744,56 +1798,11 @@ export declare interface RailroadDiagramProps extends BoxProps {
1744
1798
 
1745
1799
  export declare type RailroadNode = DiagramNode | SequenceNode | TerminalNode | NonTerminalNode | OptionalNode | ChoiceNode | OneOrMoreNode | ZeroOrMoreNode | CommentNode;
1746
1800
 
1747
- export declare function registerBlockOptions(blockType: string, component: BlockOptionsComponent): void;
1748
-
1749
- export declare type RendererFunction<T extends AnyNode["type"]> = NodeOfType<T> extends {
1750
- children: unknown[];
1751
- } ? (props: {
1752
- node: NodeOfType<T>;
1753
- children: ReactNode;
1754
- }) => ReactNode : (props: {
1755
- node: NodeOfType<T>;
1756
- }) => ReactNode;
1757
-
1758
- /**
1759
- * Maps each AST node type to its renderer function.
1760
- */
1761
- export declare type RendererMap = {
1762
- [T in AnyNode["type"]]: RendererFunction<T>;
1763
- };
1801
+ /** Resolve heading `id` from `{#custom}` suffix or slugged plain title. */
1802
+ export declare function resolveHeadingId(node: SyntaxNode, source: MarkdownSource, slugger: default_2): string | undefined;
1764
1803
 
1765
- /**
1766
- * Render parsed markdown AST to React elements
1767
- * Direct AST-to-React conversion with component mapping
1768
- */
1769
- export declare function RenderMarkdown({ ast, renderers, rendererProps, components, scope, ...props }: RenderMarkdownProps): React_2.ReactElement | null;
1770
-
1771
- export declare interface RenderMarkdownProps extends StackProps {
1772
- /**
1773
- * Parsed markdown AST to render
1774
- */
1775
- ast: Root;
1776
- /**
1777
- * Override how built-in markdown elements are rendered.
1778
- * Keys are AST node types (`"heading"`, `"code"`, `"table"`, etc.).
1779
- * Each renderer receives the typed AST node and its children.
1780
- */
1781
- renderers?: MarkdownRenderers;
1782
- /**
1783
- * Extra props forwarded to specific built-in renderers (e.g. code block options).
1784
- */
1785
- rendererProps?: MarkdownRendererProps;
1786
- /**
1787
- * React components available for use as `<Component />` tags in the markdown content.
1788
- * Keys should match PascalCase tag names (e.g. `{ StatusCard, Alert }`).
1789
- */
1790
- components?: MarkdownComponents;
1791
- /**
1792
- * Variable context for evaluating `{expression}` values in JSX attributes
1793
- * and inline expressions (e.g. `{ userName: "Alice", count: 42 }`).
1794
- */
1795
- scope?: Record<string, unknown>;
1796
- }
1804
+ /** Normalise a component registration into its `{ component, block }` form. */
1805
+ export declare function resolveMarkdownComponent(def: MarkdownComponentDef | undefined): MarkdownComponentConfig | undefined;
1797
1806
 
1798
1807
  export declare interface ResponsiveTabItem {
1799
1808
  value: string;
@@ -1817,9 +1826,21 @@ export declare interface ResponsiveTabsProps extends Omit<TabsProps_2, "children
1817
1826
  selectProps?: Omit<SelectProps, "data" | "value" | "defaultValue" | "onChange">;
1818
1827
  }
1819
1828
 
1820
- export declare interface Root {
1821
- type: "root";
1822
- children: BlockNode[];
1829
+ export declare function SectionTitle({ order, kicker, description, kickerProps, titleProps, descriptionProps, children, ...boxProps }: PropsWithChildren<SectionTitle>): ReactElement;
1830
+
1831
+ export declare interface SectionTitle extends BoxProps {
1832
+ /** The kicker text to display above the title */
1833
+ kicker?: ReactNode;
1834
+ /** Heading order (1-6), controls `font-size` when `size` is not set on the title. @default `1` */
1835
+ order?: TitleOrder;
1836
+ /** A description text to display below the title */
1837
+ description?: string;
1838
+ /** Props to pass to the kicker component */
1839
+ kickerProps?: TextProps;
1840
+ /** Props to pass to the title component */
1841
+ titleProps?: TitleProps;
1842
+ /** Props to pass to the description component */
1843
+ descriptionProps?: TextProps;
1823
1844
  }
1824
1845
 
1825
1846
  declare interface SequenceNode {
@@ -1828,13 +1849,18 @@ declare interface SequenceNode {
1828
1849
  }
1829
1850
 
1830
1851
  /**
1831
- * Set the contents of the editor
1832
- *
1833
- * @param editor The editor to set the text of
1834
- * @param text The text to set the editor to
1852
+ * Replace the entire document. External/programmatic sync must not pollute the
1853
+ * undo stack (see CodeMirror controlled-editor guidance).
1835
1854
  */
1836
1855
  export declare function setEditorText(editor: EditorView, text: string): void;
1837
1856
 
1857
+ export declare const setMarkdownEditorReady: StateEffectType<boolean>;
1858
+
1859
+ /**
1860
+ * State effect used to swap the active markdown rendering mode.
1861
+ */
1862
+ export declare const setMarkdownMode: StateEffectType<MarkdownEditMode>;
1863
+
1838
1864
  export declare function Since({ v, prefix, ...props }: SinceProps): ReactNode;
1839
1865
 
1840
1866
  export declare interface SinceProps extends Omit<BadgeProps, "children"> {
@@ -1842,7 +1868,89 @@ export declare interface SinceProps extends Omit<BadgeProps, "children"> {
1842
1868
  prefix?: string;
1843
1869
  }
1844
1870
 
1845
- export declare const SIZE_OPTIONS: OptionItem[];
1871
+ /**
1872
+ * A single slash command. `run` receives the live editor and the range
1873
+ * covering the `/query` text to replace with boilerplate.
1874
+ */
1875
+ export declare interface SlashCommand {
1876
+ /** Stable id used for filtering keys and keyboard navigation. */
1877
+ readonly id: string;
1878
+ /** Primary label shown in the menu. */
1879
+ readonly title: string;
1880
+ /** Extra terms matched against the query (besides the title). */
1881
+ readonly keywords?: readonly string[];
1882
+ /** Optional group heading; commands sharing a category are shown together. */
1883
+ readonly category?: string;
1884
+ /** React node for the leading icon. */
1885
+ readonly icon?: ReactNode;
1886
+ /** Apply the command — typically replaces `range` with markdown. */
1887
+ readonly run: CommandAction;
1888
+ }
1889
+
1890
+ /**
1891
+ * Renders the slash command palette. Reads the active session
1892
+ * from the {@link SlashStore}, filters {@link SlashCommand}s by the typed
1893
+ * query and shows a Mantine `Menu` anchored to the caret. The editor keeps DOM
1894
+ * focus; navigation/selection keys are intercepted in the capture phase so
1895
+ * arrows move the highlight and `Enter` runs the command instead of editing
1896
+ * the document.
1897
+ *
1898
+ * Mount once per editor inside the `MantineProvider` tree, alongside
1899
+ * `MarkdownWidgetPortals`.
1900
+ */
1901
+ export declare const SlashCommandMenu: FC<SlashCommandMenuProps>;
1902
+
1903
+ export declare interface SlashCommandMenuProps {
1904
+ /** Store fed by `markdownSlashCommands` (see {@link useSlashStore}). */
1905
+ store: SlashStore;
1906
+ /** Accessor for the live editor view (e.g. `controller.getEditor`). */
1907
+ getEditor: () => EditorView;
1908
+ /** Commands to offer. Defaults to {@link DEFAULT_SLASH_COMMANDS}. */
1909
+ commands?: readonly SlashCommand[];
1910
+ }
1911
+
1912
+ /** Document range a command replaces: `from` = slash position, `to` = caret. */
1913
+ export declare interface SlashCommandRange {
1914
+ readonly from: number;
1915
+ readonly to: number;
1916
+ }
1917
+
1918
+ /** Viewport coordinates of the slash anchor (from `view.coordsAtPos`). */
1919
+ export declare interface SlashCoords {
1920
+ readonly left: number;
1921
+ readonly top: number;
1922
+ readonly right: number;
1923
+ readonly bottom: number;
1924
+ }
1925
+
1926
+ /** Active slash session: the slash position and the query typed after it. */
1927
+ export declare interface SlashSession {
1928
+ /** Document position of the triggering `/`. */
1929
+ readonly from: number;
1930
+ /** Text between the slash and the caret (excludes the slash itself). */
1931
+ readonly query: string;
1932
+ }
1933
+
1934
+ /**
1935
+ * Snapshot the React menu reads: the active session and caret. Anchor
1936
+ * coordinates are measured in React (not here) because `coordsAtPos` cannot be
1937
+ * called during a CodeMirror update.
1938
+ */
1939
+ export declare interface SlashState {
1940
+ readonly session: SlashSession;
1941
+ /** Caret position (end of the `/query` range). */
1942
+ readonly to: number;
1943
+ }
1944
+
1945
+ /**
1946
+ * CM write-side ↔ React read-side bridge for the slash palette, mirroring the
1947
+ * widget `WidgetStore`. `null` snapshot means no active session.
1948
+ */
1949
+ export declare interface SlashStore {
1950
+ setState(state: SlashState | null): void;
1951
+ subscribe(listener: () => void): () => void;
1952
+ getSnapshot(): SlashState | null;
1953
+ }
1846
1954
 
1847
1955
  export declare type SortDirection = "asc" | "desc" | undefined;
1848
1956
 
@@ -1859,11 +1967,6 @@ export declare interface SortOptions<T = DefaultSort> {
1859
1967
 
1860
1968
  export declare const Spacer: FC<BoxProps>;
1861
1969
 
1862
- export declare interface SpanNode extends CommonAttrs {
1863
- type: "span";
1864
- children: InlineNode[];
1865
- }
1866
-
1867
1970
  export declare function Spinner({ size, color, className, title, ...props }: SpinnerProps): ReactNode;
1868
1971
 
1869
1972
  export declare interface SpinnerProps extends BoxProps {
@@ -1876,53 +1979,17 @@ export declare type StateFields = {
1876
1979
  [prop: string]: StateField<any>;
1877
1980
  };
1878
1981
 
1879
- export declare interface StrongNode extends CommonAttrs {
1880
- type: "strong";
1881
- children: InlineNode[];
1882
- }
1883
-
1884
- declare interface SubscriptNode extends CommonAttrs {
1885
- type: "subscript";
1886
- children: InlineNode[];
1887
- }
1888
-
1889
1982
  /**
1890
1983
  * Suggest completions at the start of each line
1891
1984
  */
1892
1985
  export declare const suggestCompletions: Command;
1893
1986
 
1894
- export declare interface SummaryNode extends CommonAttrs {
1895
- type: "summary";
1896
- children: InlineNode[];
1897
- }
1898
-
1899
1987
  export declare interface SummaryProps extends Omit<BoxProps, "component" | "children"> {
1900
1988
  children: ReactNode;
1901
1989
  }
1902
1990
 
1903
- declare interface SuperscriptNode extends CommonAttrs {
1904
- type: "superscript";
1905
- children: InlineNode[];
1906
- }
1907
-
1908
1991
  export declare const SURREAL_CDN_BASE = "https://cdn.surrealdb.com";
1909
1992
 
1910
- export declare const SurrealCodeBlock: YooptaPlugin<SurrealCodeBlockElementMap>;
1911
-
1912
- export declare type SurrealCodeBlockElement = SlateElement<"surreal-codeblock", SurrealCodeBlockProps>;
1913
-
1914
- export declare type SurrealCodeBlockElementMap = {
1915
- "surreal-codeblock": SurrealCodeBlockElement;
1916
- };
1917
-
1918
- export declare interface SurrealCodeBlockProps {
1919
- nodeType: "void";
1920
- code: string;
1921
- language: AnyLanguage;
1922
- title: string;
1923
- withLineNumbers: boolean;
1924
- }
1925
-
1926
1993
  export declare function SurrealistMini({ config, frameRef, ...props }: SurrealistMiniProps): ReactNode;
1927
1994
 
1928
1995
  export declare interface SurrealistMiniProps extends BoxProps {
@@ -1930,22 +1997,6 @@ export declare interface SurrealistMiniProps extends BoxProps {
1930
1997
  frameRef?: RefObject<HTMLIFrameElement | null>;
1931
1998
  }
1932
1999
 
1933
- export declare const SurrealLink: YooptaPlugin<SurrealLinkElementMap>;
1934
-
1935
- export declare type SurrealLinkElement = SlateElement<"surreal-link", SurrealLinkProps>;
1936
-
1937
- export declare type SurrealLinkElementMap = {
1938
- "surreal-link": SurrealLinkElement;
1939
- };
1940
-
1941
- export declare interface SurrealLinkProps {
1942
- nodeType: "inline";
1943
- url: string;
1944
- variant?: AnchorProps["variant"];
1945
- target?: string;
1946
- rel?: string;
1947
- }
1948
-
1949
2000
  export declare const SYNTAX_THEME_CONFIG: ThemeConfig;
1950
2001
 
1951
2002
  export declare interface TabItem {
@@ -1954,42 +2005,8 @@ export declare interface TabItem {
1954
2005
  content: ReactNode;
1955
2006
  }
1956
2007
 
1957
- declare function TabItem_2({ children, className, id, style }: Record<string, unknown>): ReactNode;
1958
-
1959
- export declare interface TabItemNode extends CommonAttrs {
1960
- type: "tabItem";
1961
- label: string;
1962
- icon?: string;
1963
- children: BlockNode[];
1964
- }
1965
-
1966
- export declare interface TableCellNode extends CommonAttrs {
1967
- type: "tableCell";
1968
- children: AnyNode[];
1969
- isHeader: boolean;
1970
- }
1971
-
1972
- export declare interface TableNode extends CommonAttrs {
1973
- type: "table";
1974
- align?: Array<"left" | "right" | "center" | null>;
1975
- children: TableRowNode[];
1976
- }
1977
-
1978
- export declare interface TableRowNode extends CommonAttrs {
1979
- type: "tableRow";
1980
- children: TableCellNode[];
1981
- }
1982
-
1983
2008
  export declare function Tabs({ items, syncKey, ...props }: TabsProps): ReactNode;
1984
2009
 
1985
- declare function Tabs_2({ syncKey, children, className, id, style, }: Record<string, unknown>): ReactNode;
1986
-
1987
- export declare interface TabsNode extends CommonAttrs {
1988
- type: "tabs";
1989
- syncKey?: string;
1990
- children: TabItemNode[];
1991
- }
1992
-
1993
2010
  export declare interface TabsProps extends Omit<TabsProps_2, "children" | "value" | "onChange"> {
1994
2011
  items: TabItem[];
1995
2012
  syncKey?: string;
@@ -2000,15 +2017,6 @@ declare interface TerminalNode {
2000
2017
  text: string;
2001
2018
  }
2002
2019
 
2003
- export declare interface TextNode extends CommonAttrs {
2004
- type: "text";
2005
- value: string;
2006
- }
2007
-
2008
- export declare interface ThematicBreakNode extends CommonAttrs {
2009
- type: "thematicBreak";
2010
- }
2011
-
2012
2020
  export declare type ThemeConfig = {
2013
2021
  light: HighlightStyle;
2014
2022
  dark: HighlightStyle;
@@ -2029,12 +2037,13 @@ export declare interface ThemedImageProps extends ImageProps {
2029
2037
  darkSrc?: string;
2030
2038
  }
2031
2039
 
2032
- /**
2033
- * Type-specific visitor function
2034
- */
2035
- export declare type TypeVisitor<T extends AnyNode> = (node: T, index: number | undefined, parent: AnyNode | Root | null) => undefined | boolean | void;
2036
-
2037
- export declare function useBlockOptions(): BlockOptionsContextValue;
2040
+ /** Trim `{#id}` from the end of a heading source range (returns new exclusive `titleTo`). */
2041
+ export declare function trimCustomHeadingIdFromRange(source: {
2042
+ slice(from: number, to: number): string;
2043
+ }, titleFrom: number, titleTo: number): {
2044
+ titleTo: number;
2045
+ customId?: string;
2046
+ };
2038
2047
 
2039
2048
  /**
2040
2049
  * Returns a function which can be used to trigger a confirmation dialog
@@ -2043,6 +2052,19 @@ export declare function useConfirmation<T = void>(options: ConfirmOptions<T>): (
2043
2052
 
2044
2053
  export declare function useEditor(options?: EditorOptions): EditorController;
2045
2054
 
2055
+ /**
2056
+ * Keyboard navigation over a flat list of identified items. Returns a
2057
+ * `keydown` handler and the currently active item id.
2058
+ *
2059
+ * The handler responds to `ArrowUp`/`ArrowDown` (and `Tab`/`Shift+Tab`) to
2060
+ * move the active item, and `Enter` to submit it. The active element is
2061
+ * scrolled into view via the `[data-navigation-item-id="…"]` attribute, which
2062
+ * rendered items should carry.
2063
+ *
2064
+ * Ported from `surrealist/src/hooks/keys.ts`.
2065
+ */
2066
+ export declare function useKeyNavigation<T extends Identified>(items: T[], onSubmit?: (item: T) => void, initial?: string): readonly [(e: React.KeyboardEvent) => void, string];
2067
+
2046
2068
  /**
2047
2069
  * Trigger a new render and invoke the passed function
2048
2070
  * during this next call. Useful when you require the component
@@ -2053,8 +2075,22 @@ export declare function useEditor(options?: EditorOptions): EditorController;
2053
2075
  */
2054
2076
  export declare function useLater<T extends unknown[]>(doLater: (...args: T) => unknown): (...args: T) => void;
2055
2077
 
2078
+ /**
2079
+ * Hook returning a stable {@link WidgetStore} reference for the lifetime of
2080
+ * the calling component. Pair with {@link MarkdownWidgetPortals} and pass
2081
+ * the same store into `markdownLivePreview({ widgetStore })`.
2082
+ */
2083
+ export declare function useMarkdownWidgetStore(): WidgetStore;
2084
+
2056
2085
  export declare function useMiniController(): [RefObject<HTMLIFrameElement | null>, MiniController];
2057
2086
 
2087
+ /**
2088
+ * Hook returning a stable {@link SlashStore} for the lifetime of the calling
2089
+ * component. Pair with {@link SlashCommandMenu} and pass the same store into
2090
+ * `markdownLivePreview({ slash: { store } })`.
2091
+ */
2092
+ export declare function useSlashStore(): SlashStore;
2093
+
2058
2094
  export declare function useSort<T = DefaultSort>(options?: SortOptions<T>): SortHandle<T>;
2059
2095
 
2060
2096
  /**
@@ -2077,8 +2113,6 @@ export declare function useSwitch(initialState?: boolean, callbacks?: {
2077
2113
  onClose?: () => void;
2078
2114
  }): readonly [boolean, BooleanHandle];
2079
2115
 
2080
- export declare const VARIANT_OPTIONS: OptionItem[];
2081
-
2082
2116
  export declare function Version({ version, ...props }: VersionProps): ReactNode;
2083
2117
 
2084
2118
  export declare interface VersionProps extends CodeProps {
@@ -2087,19 +2121,6 @@ export declare interface VersionProps extends CodeProps {
2087
2121
 
2088
2122
  export declare type VideoControlsPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
2089
2123
 
2090
- export declare const VideoEmbed: YooptaPlugin<VideoEmbedElementMap>;
2091
-
2092
- export declare type VideoEmbedElement = SlateElement<"video-embed", VideoEmbedProps>;
2093
-
2094
- export declare type VideoEmbedElementMap = {
2095
- "video-embed": VideoEmbedElement;
2096
- };
2097
-
2098
- export declare interface VideoEmbedProps {
2099
- nodeType: "void";
2100
- url: string;
2101
- }
2102
-
2103
2124
  export declare const VideoPlayer: FC<VideoPlayerProps>;
2104
2125
 
2105
2126
  export declare interface VideoPlayerProps extends BoxProps {
@@ -2114,21 +2135,39 @@ export declare interface VideoPlayerProps extends BoxProps {
2114
2135
  }
2115
2136
 
2116
2137
  /**
2117
- * Visit all nodes in the tree
2138
+ * The default UI Kit editor theme
2118
2139
  */
2119
- export declare function visit(tree: Root | AnyNode, visitor: Visitor): void;
2120
-
2121
- export declare function visit<T extends AnyNode["type"]>(tree: Root | AnyNode, nodeType: T, visitor: TypeVisitor<NodeOfType<T>>): void;
2140
+ export declare const VIVID_THEME: ThemeConfig_2;
2122
2141
 
2123
2142
  /**
2124
- * Generic visitor function
2143
+ * Registered widget host + render closure for `createPortal`. Map identity uses `portalKey`, not `id`.
2125
2144
  */
2126
- export declare type Visitor = (node: AnyNode, index: number | undefined, parent: AnyNode | Root | null) => undefined | boolean | void;
2145
+ declare interface WidgetEntry {
2146
+ /** Opaque key for this mount; survives logical id reuse across rebuilds. */
2147
+ readonly portalKey: number;
2148
+ /** Debug-oriented `kind:from-to`; not a store key. */
2149
+ readonly id: string;
2150
+ readonly host: HTMLElement;
2151
+ readonly render: () => ReactNode;
2152
+ }
2127
2153
 
2128
2154
  /**
2129
- * The default UI Kit editor theme
2155
+ * CM write-side React read-side (`useSyncExternalStore` in `markdown-widget-portals.tsx`).
2130
2156
  */
2131
- export declare const VIVID_THEME: ThemeConfig_2;
2157
+ declare interface WidgetStore {
2158
+ register(entry: WidgetEntry): void;
2159
+ /** Unregister only when the host still maps to `expectedPortalKey` (avoids stale destroys after host reuse). */
2160
+ unregisterHost(host: HTMLElement, expectedPortalKey?: number): void;
2161
+ /**
2162
+ * Replace render closure when `updateDOM` runs with same `portalKey` but new captured state.
2163
+ */
2164
+ update(portalKey: number, render: () => ReactNode): void;
2165
+ /** True after {@link register} for this key. */
2166
+ hasPortalKey(portalKey: number): boolean;
2167
+ subscribe(listener: () => void): () => void;
2168
+ /** Returns a stable, frozen snapshot of all currently registered widgets. */
2169
+ getSnapshot(): readonly WidgetEntry[];
2170
+ }
2132
2171
 
2133
2172
  declare interface ZeroOrMoreNode {
2134
2173
  type: "ZeroOrMore";
@@ -2258,15 +2297,15 @@ declare module "@mantine/core" {
2258
2297
  }
2259
2298
 
2260
2299
  declare module "@mantine/core" {
2261
- type ExtendedCustomColors = "obsidian" | "slate" | import("@mantine/core").DefaultMantineColor;
2262
- interface MantineThemeColorsOverride {
2263
- colors: Record<ExtendedCustomColors, import("@mantine/core").MantineColorsTuple>;
2300
+ type ExtendedCustomSizes = import("@mantine/core").DefaultMantineSize | "2xl" | "3xl";
2301
+ interface MantineThemeSizesOverride {
2302
+ spacing: Record<ExtendedCustomSizes, string>;
2264
2303
  }
2265
2304
  }
2266
2305
 
2267
2306
  declare module "@mantine/core" {
2268
- type ExtendedCustomSizes = import("@mantine/core").DefaultMantineSize | "2xl" | "3xl";
2269
- interface MantineThemeSizesOverride {
2270
- spacing: Record<ExtendedCustomSizes, string>;
2307
+ type ExtendedCustomColors = "obsidian" | "slate" | import("@mantine/core").DefaultMantineColor;
2308
+ interface MantineThemeColorsOverride {
2309
+ colors: Record<ExtendedCustomColors, import("@mantine/core").MantineColorsTuple>;
2271
2310
  }
2272
2311
  }