@surrealdb/ui 1.1.1 → 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 (110) 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 +6 -6
  21. package/dist/ui.css +1 -1
  22. package/dist/ui.d.ts +544 -531
  23. package/dist/ui.js +16325 -14683
  24. package/dist/ui.js.map +1 -1
  25. package/package.json +22 -24
  26. package/tests/_setup/e2e-helpers.tsx +169 -0
  27. package/tests/_setup/markdown-classes.ts +3 -0
  28. package/tests/_setup/portable-stories.ts +10 -0
  29. 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
  30. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-renders-a-diagram-for-the-fenced-mermaid-block-1.png +0 -0
  31. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-renders-a-horizontal-rule-as-a-separator-1.png +0 -0
  32. 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
  33. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-shows-blockquote-text-from-the-sample-document-1.png +0 -0
  34. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-shows-fenced-TypeScript-sample-code-in-the-document-1.png +0 -0
  35. 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
  36. 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
  37. package/tests/e2e/MarkdownEditor/__screenshots__/edits.test.tsx/MarkdownEditor---edits-reflects-typed-characters-in-the-underlying-document-1.png +0 -0
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. 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
  47. 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
  48. 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
  49. 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
  50. 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
  51. 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
  52. package/tests/e2e/MarkdownEditor/__screenshots__/media-sizing.test.tsx/MarkdownEditor---media-sizing-matches-MarkdownViewer-image-width-in-the-split-playground-1.png +0 -0
  53. package/tests/e2e/MarkdownEditor/__screenshots__/modes.test.tsx/MarkdownEditor---modes-standalone-MarkdownViewer-is-not-a-CodeMirror-surface-1.png +0 -0
  54. package/tests/e2e/MarkdownEditor/__screenshots__/modes.test.tsx/MarkdownEditor---modes-toggling-the-SegmentedControl-swaps-mode-without-remounting-the-editor-1.png +0 -0
  55. package/tests/e2e/MarkdownEditor/__screenshots__/regressions.test.tsx/MarkdownEditor---regressions-repeated-checkbox-toggles-do-not-duplicate-or-drift-task-markers-1.png +0 -0
  56. 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
  57. 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
  58. 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
  59. 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
  60. 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
  61. 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
  62. package/tests/e2e/MarkdownEditor/__screenshots__/undo-redo.test.tsx/MarkdownEditor---undo-and-redo-restores-undone-document-edits-via-redo-1.png +0 -0
  63. package/tests/e2e/MarkdownEditor/content-blocks.test.tsx +152 -0
  64. package/tests/e2e/MarkdownEditor/edits.test.tsx +111 -0
  65. package/tests/e2e/MarkdownEditor/heading-fold.test.tsx +44 -0
  66. package/tests/e2e/MarkdownEditor/hybrid-widgets.test.tsx +192 -0
  67. package/tests/e2e/MarkdownEditor/jsx-block-content.test.tsx +242 -0
  68. package/tests/e2e/MarkdownEditor/jsx-highlight.test.tsx +68 -0
  69. package/tests/e2e/MarkdownEditor/jsx-inline-badges.test.tsx +59 -0
  70. package/tests/e2e/MarkdownEditor/jsx-selection.test.tsx +43 -0
  71. package/tests/e2e/MarkdownEditor/link-placeholder.test.tsx +67 -0
  72. package/tests/e2e/MarkdownEditor/media-align.test.tsx +57 -0
  73. package/tests/e2e/MarkdownEditor/media-edit.test.tsx +63 -0
  74. package/tests/e2e/MarkdownEditor/media-sizing.test.tsx +123 -0
  75. package/tests/e2e/MarkdownEditor/modes.test.tsx +93 -0
  76. package/tests/e2e/MarkdownEditor/regressions.test.tsx +182 -0
  77. package/tests/e2e/MarkdownEditor/slash-commands.test.tsx +99 -0
  78. package/tests/e2e/MarkdownEditor/table-click.test.tsx +47 -0
  79. package/tests/e2e/MarkdownEditor/table-controls.test.tsx +56 -0
  80. package/tests/e2e/MarkdownEditor/table-format.test.tsx +41 -0
  81. package/tests/e2e/MarkdownEditor/undo-redo.test.tsx +38 -0
  82. package/tests/e2e/MarkdownViewer/__screenshots__/parity.test.tsx/MarkdownViewer---editor-parity-matches-computed-font-size-on-first-heading-1.png +0 -0
  83. package/tests/e2e/MarkdownViewer/__screenshots__/parity.test.tsx/MarkdownViewer---editor-parity-matches-counts-for-shared-structural-classes-1.png +0 -0
  84. package/tests/e2e/MarkdownViewer/__screenshots__/parity.test.tsx/MarkdownViewer---editor-parity-matches-visible-text-between-preview-editor--blurred--and-MarkdownViewer-1.png +0 -0
  85. package/tests/e2e/MarkdownViewer/__screenshots__/render.test.tsx/MarkdownViewer---render-exercises-shared-preview-class-names-without-mounting-CodeMirror-1.png +0 -0
  86. package/tests/e2e/MarkdownViewer/parity.test.tsx +190 -0
  87. package/tests/e2e/MarkdownViewer/render.test.tsx +35 -0
  88. package/tests/unit/Editor/helpers.test.ts +42 -0
  89. package/tests/unit/MarkdownEditor/code-info.test.ts +63 -0
  90. package/tests/unit/MarkdownEditor/decorations.test.ts +488 -0
  91. package/tests/unit/MarkdownEditor/editor-ready.test.ts +36 -0
  92. package/tests/unit/MarkdownEditor/html-descriptors.test.ts +94 -0
  93. package/tests/unit/MarkdownEditor/jsx-attr-scan.test.ts +115 -0
  94. package/tests/unit/MarkdownEditor/jsx-tag-grammar.test.ts +88 -0
  95. package/tests/unit/MarkdownEditor/list-indent.test.ts +95 -0
  96. package/tests/unit/MarkdownEditor/slash-commands.test.ts +213 -0
  97. package/tests/unit/MarkdownEditor/table-format.test.ts +83 -0
  98. package/tests/unit/MarkdownEditor/table.test.ts +119 -0
  99. package/tests/unit/MarkdownEditor/triggers.test.ts +244 -0
  100. package/tests/unit/MarkdownEditor/widget-store.test.ts +105 -0
  101. package/tests/unit/MarkdownViewer/code-title.test.tsx +62 -0
  102. package/tests/unit/MarkdownViewer/features.test.tsx +110 -0
  103. package/tests/unit/MarkdownViewer/headings.test.tsx +40 -0
  104. package/tests/unit/MarkdownViewer/jsx.test.tsx +211 -0
  105. package/tests/unit/MarkdownViewer/list-bullets.test.tsx +49 -0
  106. package/tests/unit/MarkdownViewer/list-code.test.tsx +65 -0
  107. package/tests/unit/MarkdownViewer/renderers.test.tsx +79 -0
  108. package/tests/unit/MarkdownViewer/runnable.test.tsx +69 -0
  109. package/tests/unit/MarkdownViewer/ssr.test.tsx +93 -0
  110. 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;
356
+ /** Default fenced-code renderers keyed by lower-cased info string (e.g. `mermaid`). */
357
+ export declare const DEFAULT_CODE_RENDERERS: Record<string, CodeRenderer>;
460
358
 
461
- export declare const DEFAULT_CODEBLOCK_PROPS: SurrealCodeBlockProps;
359
+ /** Default JSX components for `<PascalCase />` tags in markdown (e.g. `<Since />`, `<Tabs>`). */
360
+ export declare const DEFAULT_COMPONENTS: MarkdownComponents;
462
361
 
463
- export declare const DEFAULT_IMAGE_PROPS: CDNImageProps;
362
+ /** Default mode used when no mode is provided. */
363
+ export declare const DEFAULT_MARKDOWN_MODE: MarkdownEditMode;
464
364
 
465
- export declare const DEFAULT_LINK_PROPS: SurrealLinkProps;
466
-
467
- export declare const DEFAULT_TABLE_PROPS: MantineTableProps;
468
-
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 {
@@ -1005,50 +895,36 @@ export declare const iconWrench: string;
1005
895
 
1006
896
  export declare const iconXml: string;
1007
897
 
1008
- export declare interface ImageNode extends CommonAttrs {
1009
- 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 {
1010
905
  src: string;
1011
- darkSrc?: string;
1012
- alt: string;
906
+ alt?: string;
1013
907
  title?: string;
908
+ darkSrc?: string;
1014
909
  }
1015
910
 
1016
- export declare interface InlineCodeNode extends CommonAttrs {
1017
- type: "inlineCode";
1018
- value: string;
1019
- }
911
+ /**
912
+ * Build a `run` that inserts a callout of the given kind.
913
+ */
914
+ export declare function insertCallout(kind: CalloutKind): CommandAction;
1020
915
 
1021
- 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;
1022
921
 
1023
922
  export declare function isCDNId(query: string): boolean;
1024
923
 
1025
- export declare interface JsxComponentNode extends CommonAttrs {
1026
- type: "jsxComponent";
1027
- name: string;
1028
- attributes: Record<string, AttributeValue>;
1029
- children: AnyNode[];
1030
- position?: NodePosition;
1031
- }
1032
-
1033
- export declare interface JsxExpression {
1034
- type: "expression";
1035
- value: string;
1036
- }
924
+ /** True when the registered component declares `block: true`. */
925
+ export declare function isMarkdownComponentBlock(components: MarkdownComponents | undefined, name: string): boolean;
1037
926
 
1038
- export declare interface JsxExpressionNode extends CommonAttrs {
1039
- type: "jsxExpression";
1040
- value: string;
1041
- position?: NodePosition;
1042
- }
1043
-
1044
- /**
1045
- * Controls how `<Component />` tags and `{expression}` values in markdown are handled.
1046
- *
1047
- * - `"render"` — Evaluate and render JSX normally (default).
1048
- * - `"throw"` — Throw an error when a JSX node is encountered.
1049
- * - `"graceful"` — Render an inline error box instead of the JSX node.
1050
- * - `"omit"` — Silently skip JSX nodes (render nothing).
1051
- */
927
+ /** How `<Component />` tags are handled. */
1052
928
  export declare type JsxMode = "render" | "throw" | "graceful" | "omit";
1053
929
 
1054
930
  export declare function Label({ label, ...props }: LabelProps): ReactNode;
@@ -1057,139 +933,310 @@ export declare interface LabelProps extends Omit<BadgeProps, "children"> {
1057
933
  label: string;
1058
934
  }
1059
935
 
1060
- declare type Language = "csharp" | "rust" | "javascript" | "typescript" | "surrealql" | "json" | "yaml" | "java" | "go" | "python" | "html" | "cli" | "php" | "syntax";
1061
-
1062
- export declare interface LinkNode extends CommonAttrs {
1063
- type: "link";
1064
- url: string;
1065
- title?: string;
1066
- children: InlineNode[];
1067
- }
1068
-
1069
- export declare interface ListItemNode extends CommonAttrs {
1070
- type: "listItem";
1071
- checked?: boolean;
1072
- spread?: boolean;
1073
- children: AnyNode[];
1074
- }
1075
-
1076
- export declare interface ListNode extends CommonAttrs {
1077
- type: "list";
1078
- variant?: "ordered" | "unordered" | "checklist";
1079
- start?: number;
1080
- spread?: boolean;
1081
- children: ListItemNode[];
1082
- }
936
+ declare type Language = "csharp" | "rust" | "javascript" | "typescript" | "surrealql" | "json" | "yaml" | "java" | "go" | "python" | "html" | "cli" | "php" | "markdown" | "syntax";
1083
937
 
1084
938
  /**
1085
939
  * The Mantine theme configurtation
1086
940
  */
1087
941
  export declare const MANTINE_THEME: MantineThemeOverride;
1088
942
 
1089
- export declare const MantineBlockquote: YooptaPlugin<BlockquoteElementMap, Record<string, unknown>>;
1090
-
1091
- export declare const MantineButton: YooptaPlugin<MantineButtonElementMap>;
1092
-
1093
- export declare type MantineButtonElement = SlateElement<"mantine-button", MantineButtonProps>;
1094
-
1095
- export declare type MantineButtonElementMap = {
1096
- "mantine-button": MantineButtonElement;
1097
- };
1098
-
1099
- export declare interface MantineButtonProps {
1100
- nodeType: "void";
1101
- label: string;
1102
- url: string;
1103
- variant: ButtonProps["variant"];
1104
- color: MantineColor;
1105
- size: MantineSize;
1106
- radius: MantineSize;
1107
- 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;
1108
951
  }
1109
952
 
1110
- export declare const MantineCallout: YooptaPlugin<CalloutElementMap, Record<string, unknown>>;
1111
-
1112
- export declare const MantineChecklist: YooptaPlugin<Pick<ListElementMap, "todo-list">, Record<string, unknown>>;
1113
-
1114
- 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;
1115
955
 
1116
- 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>;
1117
958
 
1118
- 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";
1119
967
 
1120
- export declare type MantineTableElementMap = {
1121
- "mantine-table": MantineTableElement;
1122
- };
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>;
1123
976
 
1124
- export declare interface MantineTableProps {
1125
- nodeType: "void";
1126
- rows: string[][];
1127
- withHeaderRow: boolean;
1128
- striped: boolean;
1129
- highlightOnHover: boolean;
1130
- 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[];
1131
1006
  }
1132
1007
 
1133
1008
  /**
1134
- * Main Markdown component that parses markdown and renders it
1135
- * 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.
1136
1012
  */
1137
- export declare function Markdown({ content, renderers, rendererProps, components, scope, }: MarkdownProps): React_2.ReactElement;
1013
+ export declare function markdownEditorReady(): Extension;
1138
1014
 
1139
- 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>;
1140
1021
 
1141
- export declare interface MarkdownProps {
1142
- /**
1143
- * Markdown content to render
1144
- */
1145
- 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;
1146
1031
  /**
1147
- * Override how built-in markdown elements are rendered.
1148
- * 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`.
1149
1034
  */
1150
- renderers?: MarkdownRenderers;
1035
+ withTableFormatter?: boolean;
1151
1036
  /**
1152
- * 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 `{}`.
1153
1040
  */
1154
- 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;
1155
1046
  /**
1156
- * React components available for use as `<Component />` tags in the markdown content.
1157
- * Keys should match PascalCase tag names (e.g. `{ StatusCard, Alert }`).
1047
+ * Optional language resolver for embedded fenced code blocks.
1158
1048
  */
1049
+ resolveCodeLanguage?: (info: string) => Language_2 | undefined;
1050
+ /** JSX/HTML preview widgets (viewer parity). Omit to leave raw source in preview. */
1159
1051
  components?: MarkdownComponents;
1052
+ jsxMode?: JsxMode;
1160
1053
  /**
1161
- * Variable context for evaluating `{expression}` values in JSX attributes
1162
- * 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.
1163
1057
  */
1164
- 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;
1165
1080
  }
1166
1081
 
1167
1082
  /**
1168
- * Extra props forwarded to specific built-in renderers (e.g. code block options).
1083
+ * Document slice compatible with CodeMirror {@link Text} line API.
1084
+ * Used by tree helpers and the viewer renderer.
1169
1085
  */
1170
- export declare interface MarkdownRendererProps {
1171
- code?: Partial<CodeBlockProps>;
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;
1100
+ }
1101
+
1102
+ /**
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`.
1110
+ */
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;
1172
1134
  /**
1173
- * How `<Component />` tags and `{expression}` values are handled.
1174
- *
1175
- * @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.
1176
1139
  */
1177
- 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;
1145
+ }
1146
+
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;
1178
1210
  }
1179
1211
 
1180
- declare type MarkdownRenderers = Partial<RendererMap>;
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>;
1181
1222
 
1182
- export declare interface MDXProvidedComponents {
1183
- Check: typeof Check;
1184
- Label: typeof Label;
1185
- RailroadDiagram: typeof RailroadDiagram;
1186
- Since: typeof Since;
1187
- SurrealistMini: typeof SurrealistMini;
1188
- TabItem: typeof TabItem_2;
1189
- Tabs: typeof Tabs_2;
1190
- Version: typeof Version;
1223
+ export declare interface MarkdownWidgetPortalsProps {
1224
+ /** The store to read widget entries from. */
1225
+ store: WidgetStore;
1191
1226
  }
1192
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
+
1193
1240
  export declare interface MiniConfig {
1194
1241
  url?: string;
1195
1242
  dataset?: "surreal-deal-store-mini" | `/${string}.surql`;
@@ -1239,17 +1286,6 @@ export declare class MiniController {
1239
1286
  executeQuery(query: string): void;
1240
1287
  }
1241
1288
 
1242
- declare type NodeOfType<T extends AnyNode["type"]> = Extract<AnyNode, {
1243
- type: T;
1244
- }>;
1245
-
1246
- export declare interface NodePosition {
1247
- start: number;
1248
- end: number;
1249
- }
1250
-
1251
- export declare const NON_TEXT_BLOCKS: Set<string>;
1252
-
1253
1289
  declare interface NonTerminalNode {
1254
1290
  type: "NonTerminal";
1255
1291
  text: string;
@@ -1282,29 +1318,21 @@ declare interface OptionalNode {
1282
1318
  child: RailroadNode;
1283
1319
  }
1284
1320
 
1285
- declare type OptionItem = {
1286
- label: string;
1287
- value: string;
1288
- };
1289
-
1290
- export declare interface ParagraphNode extends CommonAttrs {
1291
- type: "paragraph";
1292
- 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;
1293
1326
  }
1294
1327
 
1328
+ /** Split plain heading text into visible title and optional `{#id}` suffix. */
1329
+ export declare function parseHeadingTitleText(plain: string): ParsedHeadingTitle;
1330
+
1295
1331
  /**
1296
- * 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.
1297
1334
  */
1298
- export declare function parseMarkdown(markdown: string): Root;
1299
-
1300
- export declare interface ParserState {
1301
- lines: string[];
1302
- currentIndex: number;
1303
- stack: string[];
1304
- root: BlockNode[];
1305
- currentContainer: BlockNode[];
1306
- slugger: default_2;
1307
- }
1335
+ export declare function parseMarkdownTree(source: string): Tree;
1308
1336
 
1309
1337
  export declare const picto2106: string;
1310
1338
 
@@ -1770,56 +1798,11 @@ export declare interface RailroadDiagramProps extends BoxProps {
1770
1798
 
1771
1799
  export declare type RailroadNode = DiagramNode | SequenceNode | TerminalNode | NonTerminalNode | OptionalNode | ChoiceNode | OneOrMoreNode | ZeroOrMoreNode | CommentNode;
1772
1800
 
1773
- export declare function registerBlockOptions(blockType: string, component: BlockOptionsComponent): void;
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;
1774
1803
 
1775
- export declare type RendererFunction<T extends AnyNode["type"]> = NodeOfType<T> extends {
1776
- children: unknown[];
1777
- } ? (props: {
1778
- node: NodeOfType<T>;
1779
- children: ReactNode;
1780
- }) => ReactNode : (props: {
1781
- node: NodeOfType<T>;
1782
- }) => ReactNode;
1783
-
1784
- /**
1785
- * Maps each AST node type to its renderer function.
1786
- */
1787
- export declare type RendererMap = {
1788
- [T in AnyNode["type"]]: RendererFunction<T>;
1789
- };
1790
-
1791
- /**
1792
- * Render parsed markdown AST to React elements
1793
- * Direct AST-to-React conversion with component mapping
1794
- */
1795
- export declare function RenderMarkdown({ ast, renderers, rendererProps, components, scope, ...props }: RenderMarkdownProps): React_2.ReactElement | null;
1796
-
1797
- export declare interface RenderMarkdownProps extends StackProps {
1798
- /**
1799
- * Parsed markdown AST to render
1800
- */
1801
- ast: Root;
1802
- /**
1803
- * Override how built-in markdown elements are rendered.
1804
- * Keys are AST node types (`"heading"`, `"code"`, `"table"`, etc.).
1805
- * Each renderer receives the typed AST node and its children.
1806
- */
1807
- renderers?: MarkdownRenderers;
1808
- /**
1809
- * Extra props forwarded to specific built-in renderers (e.g. code block options).
1810
- */
1811
- rendererProps?: MarkdownRendererProps;
1812
- /**
1813
- * React components available for use as `<Component />` tags in the markdown content.
1814
- * Keys should match PascalCase tag names (e.g. `{ StatusCard, Alert }`).
1815
- */
1816
- components?: MarkdownComponents;
1817
- /**
1818
- * Variable context for evaluating `{expression}` values in JSX attributes
1819
- * and inline expressions (e.g. `{ userName: "Alice", count: 42 }`).
1820
- */
1821
- scope?: Record<string, unknown>;
1822
- }
1804
+ /** Normalise a component registration into its `{ component, block }` form. */
1805
+ export declare function resolveMarkdownComponent(def: MarkdownComponentDef | undefined): MarkdownComponentConfig | undefined;
1823
1806
 
1824
1807
  export declare interface ResponsiveTabItem {
1825
1808
  value: string;
@@ -1843,9 +1826,21 @@ export declare interface ResponsiveTabsProps extends Omit<TabsProps_2, "children
1843
1826
  selectProps?: Omit<SelectProps, "data" | "value" | "defaultValue" | "onChange">;
1844
1827
  }
1845
1828
 
1846
- export declare interface Root {
1847
- type: "root";
1848
- 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;
1849
1844
  }
1850
1845
 
1851
1846
  declare interface SequenceNode {
@@ -1854,13 +1849,18 @@ declare interface SequenceNode {
1854
1849
  }
1855
1850
 
1856
1851
  /**
1857
- * Set the contents of the editor
1858
- *
1859
- * @param editor The editor to set the text of
1860
- * @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).
1861
1854
  */
1862
1855
  export declare function setEditorText(editor: EditorView, text: string): void;
1863
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
+
1864
1864
  export declare function Since({ v, prefix, ...props }: SinceProps): ReactNode;
1865
1865
 
1866
1866
  export declare interface SinceProps extends Omit<BadgeProps, "children"> {
@@ -1868,7 +1868,89 @@ export declare interface SinceProps extends Omit<BadgeProps, "children"> {
1868
1868
  prefix?: string;
1869
1869
  }
1870
1870
 
1871
- 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
+ }
1872
1954
 
1873
1955
  export declare type SortDirection = "asc" | "desc" | undefined;
1874
1956
 
@@ -1885,11 +1967,6 @@ export declare interface SortOptions<T = DefaultSort> {
1885
1967
 
1886
1968
  export declare const Spacer: FC<BoxProps>;
1887
1969
 
1888
- export declare interface SpanNode extends CommonAttrs {
1889
- type: "span";
1890
- children: InlineNode[];
1891
- }
1892
-
1893
1970
  export declare function Spinner({ size, color, className, title, ...props }: SpinnerProps): ReactNode;
1894
1971
 
1895
1972
  export declare interface SpinnerProps extends BoxProps {
@@ -1902,53 +1979,17 @@ export declare type StateFields = {
1902
1979
  [prop: string]: StateField<any>;
1903
1980
  };
1904
1981
 
1905
- export declare interface StrongNode extends CommonAttrs {
1906
- type: "strong";
1907
- children: InlineNode[];
1908
- }
1909
-
1910
- declare interface SubscriptNode extends CommonAttrs {
1911
- type: "subscript";
1912
- children: InlineNode[];
1913
- }
1914
-
1915
1982
  /**
1916
1983
  * Suggest completions at the start of each line
1917
1984
  */
1918
1985
  export declare const suggestCompletions: Command;
1919
1986
 
1920
- export declare interface SummaryNode extends CommonAttrs {
1921
- type: "summary";
1922
- children: InlineNode[];
1923
- }
1924
-
1925
1987
  export declare interface SummaryProps extends Omit<BoxProps, "component" | "children"> {
1926
1988
  children: ReactNode;
1927
1989
  }
1928
1990
 
1929
- declare interface SuperscriptNode extends CommonAttrs {
1930
- type: "superscript";
1931
- children: InlineNode[];
1932
- }
1933
-
1934
1991
  export declare const SURREAL_CDN_BASE = "https://cdn.surrealdb.com";
1935
1992
 
1936
- export declare const SurrealCodeBlock: YooptaPlugin<SurrealCodeBlockElementMap>;
1937
-
1938
- export declare type SurrealCodeBlockElement = SlateElement<"surreal-codeblock", SurrealCodeBlockProps>;
1939
-
1940
- export declare type SurrealCodeBlockElementMap = {
1941
- "surreal-codeblock": SurrealCodeBlockElement;
1942
- };
1943
-
1944
- export declare interface SurrealCodeBlockProps {
1945
- nodeType: "void";
1946
- code: string;
1947
- language: AnyLanguage;
1948
- title: string;
1949
- withLineNumbers: boolean;
1950
- }
1951
-
1952
1993
  export declare function SurrealistMini({ config, frameRef, ...props }: SurrealistMiniProps): ReactNode;
1953
1994
 
1954
1995
  export declare interface SurrealistMiniProps extends BoxProps {
@@ -1956,22 +1997,6 @@ export declare interface SurrealistMiniProps extends BoxProps {
1956
1997
  frameRef?: RefObject<HTMLIFrameElement | null>;
1957
1998
  }
1958
1999
 
1959
- export declare const SurrealLink: YooptaPlugin<SurrealLinkElementMap>;
1960
-
1961
- export declare type SurrealLinkElement = SlateElement<"surreal-link", SurrealLinkProps>;
1962
-
1963
- export declare type SurrealLinkElementMap = {
1964
- "surreal-link": SurrealLinkElement;
1965
- };
1966
-
1967
- export declare interface SurrealLinkProps {
1968
- nodeType: "inline";
1969
- url: string;
1970
- variant?: AnchorProps["variant"];
1971
- target?: string;
1972
- rel?: string;
1973
- }
1974
-
1975
2000
  export declare const SYNTAX_THEME_CONFIG: ThemeConfig;
1976
2001
 
1977
2002
  export declare interface TabItem {
@@ -1980,42 +2005,8 @@ export declare interface TabItem {
1980
2005
  content: ReactNode;
1981
2006
  }
1982
2007
 
1983
- declare function TabItem_2({ children, className, id, style }: Record<string, unknown>): ReactNode;
1984
-
1985
- export declare interface TabItemNode extends CommonAttrs {
1986
- type: "tabItem";
1987
- label: string;
1988
- icon?: string;
1989
- children: BlockNode[];
1990
- }
1991
-
1992
- export declare interface TableCellNode extends CommonAttrs {
1993
- type: "tableCell";
1994
- children: AnyNode[];
1995
- isHeader: boolean;
1996
- }
1997
-
1998
- export declare interface TableNode extends CommonAttrs {
1999
- type: "table";
2000
- align?: Array<"left" | "right" | "center" | null>;
2001
- children: TableRowNode[];
2002
- }
2003
-
2004
- export declare interface TableRowNode extends CommonAttrs {
2005
- type: "tableRow";
2006
- children: TableCellNode[];
2007
- }
2008
-
2009
2008
  export declare function Tabs({ items, syncKey, ...props }: TabsProps): ReactNode;
2010
2009
 
2011
- declare function Tabs_2({ syncKey, children, className, id, style, }: Record<string, unknown>): ReactNode;
2012
-
2013
- export declare interface TabsNode extends CommonAttrs {
2014
- type: "tabs";
2015
- syncKey?: string;
2016
- children: TabItemNode[];
2017
- }
2018
-
2019
2010
  export declare interface TabsProps extends Omit<TabsProps_2, "children" | "value" | "onChange"> {
2020
2011
  items: TabItem[];
2021
2012
  syncKey?: string;
@@ -2026,15 +2017,6 @@ declare interface TerminalNode {
2026
2017
  text: string;
2027
2018
  }
2028
2019
 
2029
- export declare interface TextNode extends CommonAttrs {
2030
- type: "text";
2031
- value: string;
2032
- }
2033
-
2034
- export declare interface ThematicBreakNode extends CommonAttrs {
2035
- type: "thematicBreak";
2036
- }
2037
-
2038
2020
  export declare type ThemeConfig = {
2039
2021
  light: HighlightStyle;
2040
2022
  dark: HighlightStyle;
@@ -2055,12 +2037,13 @@ export declare interface ThemedImageProps extends ImageProps {
2055
2037
  darkSrc?: string;
2056
2038
  }
2057
2039
 
2058
- /**
2059
- * Type-specific visitor function
2060
- */
2061
- export declare type TypeVisitor<T extends AnyNode> = (node: T, index: number | undefined, parent: AnyNode | Root | null) => undefined | boolean | void;
2062
-
2063
- 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
+ };
2064
2047
 
2065
2048
  /**
2066
2049
  * Returns a function which can be used to trigger a confirmation dialog
@@ -2069,6 +2052,19 @@ export declare function useConfirmation<T = void>(options: ConfirmOptions<T>): (
2069
2052
 
2070
2053
  export declare function useEditor(options?: EditorOptions): EditorController;
2071
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
+
2072
2068
  /**
2073
2069
  * Trigger a new render and invoke the passed function
2074
2070
  * during this next call. Useful when you require the component
@@ -2079,8 +2075,22 @@ export declare function useEditor(options?: EditorOptions): EditorController;
2079
2075
  */
2080
2076
  export declare function useLater<T extends unknown[]>(doLater: (...args: T) => unknown): (...args: T) => void;
2081
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
+
2082
2085
  export declare function useMiniController(): [RefObject<HTMLIFrameElement | null>, MiniController];
2083
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
+
2084
2094
  export declare function useSort<T = DefaultSort>(options?: SortOptions<T>): SortHandle<T>;
2085
2095
 
2086
2096
  /**
@@ -2103,8 +2113,6 @@ export declare function useSwitch(initialState?: boolean, callbacks?: {
2103
2113
  onClose?: () => void;
2104
2114
  }): readonly [boolean, BooleanHandle];
2105
2115
 
2106
- export declare const VARIANT_OPTIONS: OptionItem[];
2107
-
2108
2116
  export declare function Version({ version, ...props }: VersionProps): ReactNode;
2109
2117
 
2110
2118
  export declare interface VersionProps extends CodeProps {
@@ -2113,19 +2121,6 @@ export declare interface VersionProps extends CodeProps {
2113
2121
 
2114
2122
  export declare type VideoControlsPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
2115
2123
 
2116
- export declare const VideoEmbed: YooptaPlugin<VideoEmbedElementMap>;
2117
-
2118
- export declare type VideoEmbedElement = SlateElement<"video-embed", VideoEmbedProps>;
2119
-
2120
- export declare type VideoEmbedElementMap = {
2121
- "video-embed": VideoEmbedElement;
2122
- };
2123
-
2124
- export declare interface VideoEmbedProps {
2125
- nodeType: "void";
2126
- url: string;
2127
- }
2128
-
2129
2124
  export declare const VideoPlayer: FC<VideoPlayerProps>;
2130
2125
 
2131
2126
  export declare interface VideoPlayerProps extends BoxProps {
@@ -2140,21 +2135,39 @@ export declare interface VideoPlayerProps extends BoxProps {
2140
2135
  }
2141
2136
 
2142
2137
  /**
2143
- * Visit all nodes in the tree
2138
+ * The default UI Kit editor theme
2144
2139
  */
2145
- export declare function visit(tree: Root | AnyNode, visitor: Visitor): void;
2146
-
2147
- 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;
2148
2141
 
2149
2142
  /**
2150
- * Generic visitor function
2143
+ * Registered widget host + render closure for `createPortal`. Map identity uses `portalKey`, not `id`.
2151
2144
  */
2152
- 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
+ }
2153
2153
 
2154
2154
  /**
2155
- * The default UI Kit editor theme
2155
+ * CM write-side React read-side (`useSyncExternalStore` in `markdown-widget-portals.tsx`).
2156
2156
  */
2157
- 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
+ }
2158
2171
 
2159
2172
  declare interface ZeroOrMoreNode {
2160
2173
  type: "ZeroOrMore";
@@ -2284,15 +2297,15 @@ declare module "@mantine/core" {
2284
2297
  }
2285
2298
 
2286
2299
  declare module "@mantine/core" {
2287
- type ExtendedCustomColors = "obsidian" | "slate" | import("@mantine/core").DefaultMantineColor;
2288
- interface MantineThemeColorsOverride {
2289
- colors: Record<ExtendedCustomColors, import("@mantine/core").MantineColorsTuple>;
2300
+ type ExtendedCustomSizes = import("@mantine/core").DefaultMantineSize | "2xl" | "3xl";
2301
+ interface MantineThemeSizesOverride {
2302
+ spacing: Record<ExtendedCustomSizes, string>;
2290
2303
  }
2291
2304
  }
2292
2305
 
2293
2306
  declare module "@mantine/core" {
2294
- type ExtendedCustomSizes = import("@mantine/core").DefaultMantineSize | "2xl" | "3xl";
2295
- interface MantineThemeSizesOverride {
2296
- spacing: Record<ExtendedCustomSizes, string>;
2307
+ type ExtendedCustomColors = "obsidian" | "slate" | import("@mantine/core").DefaultMantineColor;
2308
+ interface MantineThemeColorsOverride {
2309
+ colors: Record<ExtendedCustomColors, import("@mantine/core").MantineColorsTuple>;
2297
2310
  }
2298
2311
  }