@surrealdb/ui 1.1.1 → 1.2.1

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 (109) 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/fonts.js +2 -0
  18. package/dist/fonts.js.map +1 -0
  19. package/dist/ui.css +1 -1
  20. package/dist/ui.d.ts +537 -523
  21. package/dist/ui.js +16328 -14682
  22. package/dist/ui.js.map +1 -1
  23. package/package.json +22 -24
  24. package/tests/_setup/e2e-helpers.tsx +169 -0
  25. package/tests/_setup/markdown-classes.ts +3 -0
  26. package/tests/_setup/portable-stories.ts +10 -0
  27. 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
  28. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-renders-a-diagram-for-the-fenced-mermaid-block-1.png +0 -0
  29. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-renders-a-horizontal-rule-as-a-separator-1.png +0 -0
  30. 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
  31. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-shows-blockquote-text-from-the-sample-document-1.png +0 -0
  32. package/tests/e2e/MarkdownEditor/__screenshots__/content-blocks.test.tsx/MarkdownEditor---content-blocks-shows-fenced-TypeScript-sample-code-in-the-document-1.png +0 -0
  33. 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
  34. 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
  35. package/tests/e2e/MarkdownEditor/__screenshots__/edits.test.tsx/MarkdownEditor---edits-reflects-typed-characters-in-the-underlying-document-1.png +0 -0
  36. 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
  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. 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
  47. 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
  48. 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
  49. 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
  50. package/tests/e2e/MarkdownEditor/__screenshots__/media-sizing.test.tsx/MarkdownEditor---media-sizing-matches-MarkdownViewer-image-width-in-the-split-playground-1.png +0 -0
  51. package/tests/e2e/MarkdownEditor/__screenshots__/modes.test.tsx/MarkdownEditor---modes-standalone-MarkdownViewer-is-not-a-CodeMirror-surface-1.png +0 -0
  52. package/tests/e2e/MarkdownEditor/__screenshots__/modes.test.tsx/MarkdownEditor---modes-toggling-the-SegmentedControl-swaps-mode-without-remounting-the-editor-1.png +0 -0
  53. package/tests/e2e/MarkdownEditor/__screenshots__/regressions.test.tsx/MarkdownEditor---regressions-repeated-checkbox-toggles-do-not-duplicate-or-drift-task-markers-1.png +0 -0
  54. 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
  55. 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
  56. 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
  57. 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
  58. 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
  59. 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
  60. package/tests/e2e/MarkdownEditor/__screenshots__/undo-redo.test.tsx/MarkdownEditor---undo-and-redo-restores-undone-document-edits-via-redo-1.png +0 -0
  61. package/tests/e2e/MarkdownEditor/content-blocks.test.tsx +152 -0
  62. package/tests/e2e/MarkdownEditor/edits.test.tsx +111 -0
  63. package/tests/e2e/MarkdownEditor/heading-fold.test.tsx +44 -0
  64. package/tests/e2e/MarkdownEditor/hybrid-widgets.test.tsx +192 -0
  65. package/tests/e2e/MarkdownEditor/jsx-block-content.test.tsx +242 -0
  66. package/tests/e2e/MarkdownEditor/jsx-highlight.test.tsx +68 -0
  67. package/tests/e2e/MarkdownEditor/jsx-inline-badges.test.tsx +59 -0
  68. package/tests/e2e/MarkdownEditor/jsx-selection.test.tsx +43 -0
  69. package/tests/e2e/MarkdownEditor/link-placeholder.test.tsx +67 -0
  70. package/tests/e2e/MarkdownEditor/media-align.test.tsx +57 -0
  71. package/tests/e2e/MarkdownEditor/media-edit.test.tsx +63 -0
  72. package/tests/e2e/MarkdownEditor/media-sizing.test.tsx +123 -0
  73. package/tests/e2e/MarkdownEditor/modes.test.tsx +93 -0
  74. package/tests/e2e/MarkdownEditor/regressions.test.tsx +182 -0
  75. package/tests/e2e/MarkdownEditor/slash-commands.test.tsx +99 -0
  76. package/tests/e2e/MarkdownEditor/table-click.test.tsx +47 -0
  77. package/tests/e2e/MarkdownEditor/table-controls.test.tsx +56 -0
  78. package/tests/e2e/MarkdownEditor/table-format.test.tsx +41 -0
  79. package/tests/e2e/MarkdownEditor/undo-redo.test.tsx +38 -0
  80. package/tests/e2e/MarkdownViewer/__screenshots__/parity.test.tsx/MarkdownViewer---editor-parity-matches-computed-font-size-on-first-heading-1.png +0 -0
  81. package/tests/e2e/MarkdownViewer/__screenshots__/parity.test.tsx/MarkdownViewer---editor-parity-matches-counts-for-shared-structural-classes-1.png +0 -0
  82. package/tests/e2e/MarkdownViewer/__screenshots__/parity.test.tsx/MarkdownViewer---editor-parity-matches-visible-text-between-preview-editor--blurred--and-MarkdownViewer-1.png +0 -0
  83. package/tests/e2e/MarkdownViewer/__screenshots__/render.test.tsx/MarkdownViewer---render-exercises-shared-preview-class-names-without-mounting-CodeMirror-1.png +0 -0
  84. package/tests/e2e/MarkdownViewer/parity.test.tsx +190 -0
  85. package/tests/e2e/MarkdownViewer/render.test.tsx +35 -0
  86. package/tests/unit/Editor/helpers.test.ts +42 -0
  87. package/tests/unit/MarkdownEditor/code-info.test.ts +63 -0
  88. package/tests/unit/MarkdownEditor/decorations.test.ts +488 -0
  89. package/tests/unit/MarkdownEditor/editor-ready.test.ts +36 -0
  90. package/tests/unit/MarkdownEditor/html-descriptors.test.ts +94 -0
  91. package/tests/unit/MarkdownEditor/jsx-attr-scan.test.ts +115 -0
  92. package/tests/unit/MarkdownEditor/jsx-tag-grammar.test.ts +88 -0
  93. package/tests/unit/MarkdownEditor/list-indent.test.ts +95 -0
  94. package/tests/unit/MarkdownEditor/slash-commands.test.ts +213 -0
  95. package/tests/unit/MarkdownEditor/table-format.test.ts +83 -0
  96. package/tests/unit/MarkdownEditor/table.test.ts +119 -0
  97. package/tests/unit/MarkdownEditor/triggers.test.ts +244 -0
  98. package/tests/unit/MarkdownEditor/widget-store.test.ts +105 -0
  99. package/tests/unit/MarkdownViewer/code-title.test.tsx +62 -0
  100. package/tests/unit/MarkdownViewer/features.test.tsx +110 -0
  101. package/tests/unit/MarkdownViewer/headings.test.tsx +40 -0
  102. package/tests/unit/MarkdownViewer/jsx.test.tsx +211 -0
  103. package/tests/unit/MarkdownViewer/list-bullets.test.tsx +49 -0
  104. package/tests/unit/MarkdownViewer/list-code.test.tsx +65 -0
  105. package/tests/unit/MarkdownViewer/renderers.test.tsx +79 -0
  106. package/tests/unit/MarkdownViewer/runnable.test.tsx +69 -0
  107. package/tests/unit/MarkdownViewer/ssr.test.tsx +93 -0
  108. package/dist/yoopta.css +0 -1
  109. /package/dist/{yoopta.d.ts → fonts.d.ts} +0 -0
package/dist/ui.d.ts CHANGED
@@ -1,16 +1,14 @@
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
13
  import { ElementProps } from '@mantine/core';
16
14
  import { Extension } from '@codemirror/state';
@@ -21,7 +19,7 @@ import { HighlightStyle } from '@codemirror/language';
21
19
  import { HTMLAttributes } from 'react';
22
20
  import { ImageProps } from '@mantine/core';
23
21
  import { KeyBinding } from '@codemirror/view';
24
- import { ListElementMap } from '@yoopta/lists/dist/types';
22
+ import { Language as Language_2 } from '@codemirror/language';
25
23
  import { MantineColor } from '@mantine/core';
26
24
  import { MantineColorScheme } from '@mantine/core';
27
25
  import { MantineFontSize } from '@mantine/core';
@@ -29,26 +27,21 @@ import { MantineSize } from '@mantine/core';
29
27
  import { MantineThemeOverride } from '@mantine/core';
30
28
  import { PaperProps } from '@mantine/core';
31
29
  import { PropsWithChildren } from 'react';
32
- import type * as React_2 from 'react';
33
30
  import { ReactElement } from 'react';
34
31
  import { ReactNode } from 'react';
35
32
  import { RefObject } from 'react';
36
33
  import { SelectProps } from '@mantine/core';
37
- import { SlateElement } from '@yoopta/editor';
38
- import { StackProps } from '@mantine/core';
34
+ import { StateEffectType } from '@codemirror/state';
39
35
  import { StateField } from '@codemirror/state';
36
+ import { SyntaxNode } from '@lezer/common';
40
37
  import { TabsListProps } from '@mantine/core';
41
38
  import { TabsProps as TabsProps_2 } from '@mantine/core';
42
39
  import { TabsTabProps } from '@mantine/core';
43
40
  import { TextProps } from '@mantine/core';
44
41
  import { TitleOrder } from '@mantine/core';
45
42
  import { TitleProps } from '@mantine/core';
43
+ import { Tree } from '@lezer/common';
46
44
  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
45
 
53
46
  /**
54
47
  * A keybind used to accept a completion
@@ -72,10 +65,6 @@ export declare const addCursorVerticallyKeymap: readonly KeyBinding[];
72
65
 
73
66
  declare type AnyFn = (...rest: any[]) => any;
74
67
 
75
- declare type AnyLanguage = Language | (string & {});
76
-
77
- export declare type AnyNode = BlockNode | InlineNode | SummaryNode | ListItemNode | TableRowNode | TableCellNode;
78
-
79
68
  /**
80
69
  * Apply automatic folding to objects/arrays at the specified depth level
81
70
  * @param view - CodeMirror editor view
@@ -83,56 +72,6 @@ export declare type AnyNode = BlockNode | InlineNode | SummaryNode | ListItemNod
83
72
  */
84
73
  export declare function applyAutoFolding(view: EditorView, autoCollapseDepth: number): void;
85
74
 
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
75
  export declare interface BooleanHandle {
137
76
  open: () => void;
138
77
  close: () => void;
@@ -296,48 +235,16 @@ export declare const brandYouTube: string;
296
235
 
297
236
  export declare const BreadcrumbButton: FC<ButtonProps & ElementProps<"button">>;
298
237
 
299
- export declare interface BreakNode extends CommonAttrs {
300
- type: "break";
301
- }
238
+ /**
239
+ * GitHub-flavoured markdown alert kinds (`> [!kind]`, see GitHub docs).
240
+ * Other spellings in source are normalised onto this set.
241
+ */
242
+ declare type CalloutKind = "note" | "tip" | "important" | "warning" | "caution";
302
243
 
303
244
  export declare const CDN_ID_PATTERN: RegExp;
304
245
 
305
246
  export declare const CDN_URL_PATTERN: RegExp;
306
247
 
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
248
  export declare function Check({ children, ...props }: CheckProps): ReactNode;
342
249
 
343
250
  export declare interface CheckProps extends GroupProps {
@@ -376,31 +283,28 @@ export declare interface CodeEditorProps extends BoxProps {
376
283
  ref?: RefObject<EditorView>;
377
284
  }
378
285
 
379
- export declare interface CodeNode extends CommonAttrs {
380
- type: "code";
381
- value: string;
382
- lang?: string;
383
- title?: string;
384
- runnable?: string;
385
- }
286
+ /** React component keyed by lower-cased fenced-code info string. */
287
+ export declare type CodeRenderer = ComponentType<CodeRendererProps>;
386
288
 
387
- export declare const COLOR_OPTIONS: OptionItem[];
289
+ /** Props for a custom fenced-code-block renderer (inactive block / viewer). */
290
+ export declare interface CodeRendererProps {
291
+ /** The code body verbatim (CodeText slice, fences excluded). */
292
+ code: string;
293
+ /** The (lower-cased) info string from the opening fence, e.g. `mermaid`. */
294
+ language: string;
295
+ }
388
296
 
389
297
  export declare type ColorScheme = keyof ThemeConfig;
390
298
 
391
299
  declare type ColorScheme_2 = keyof ThemeConfig_2;
392
300
 
301
+ declare type CommandAction = (view: EditorView, range: SlashCommandRange) => void;
302
+
393
303
  declare interface CommentNode {
394
304
  type: "Comment";
395
305
  text: string;
396
306
  }
397
307
 
398
- export declare interface CommonAttrs {
399
- className?: AttributeValue;
400
- id?: AttributeValue;
401
- style?: AttributeValue;
402
- }
403
-
404
308
  /**
405
309
  * Common extensions applied to all CodeMirror editors
406
310
  */
@@ -444,31 +348,26 @@ export declare function createSerializedState(doc: string): EditorStateSnapshot;
444
348
  */
445
349
  export declare function createStyleHighlighter(theme: ThemeConfig_2, colorScheme: ColorScheme_2): Highlighter;
446
350
 
447
- export declare const CUSTOM_BLOCKS: Set<string>;
448
-
449
351
  /**
450
352
  * A custom variant of the history keymap that uses
451
353
  * the Mod key instead of the Ctrl key
452
354
  */
453
355
  export declare const customHistoryKeymap: readonly KeyBinding[];
454
356
 
455
- export declare const DEFAULT_BLOCK_MARKS: YooptaMark<any>[];
456
-
457
- export declare const DEFAULT_BLOCK_PLUGINS: YooptaPlugin<Record<string, SlateElement>, Record<string, unknown>>[];
357
+ /** Default fenced-code renderers keyed by lower-cased info string (e.g. `mermaid`). */
358
+ export declare const DEFAULT_CODE_RENDERERS: Record<string, CodeRenderer>;
458
359
 
459
- export declare const DEFAULT_BUTTON_PROPS: MantineButtonProps;
360
+ /** Default JSX components for `<PascalCase />` tags in markdown (e.g. `<Since />`, `<Tabs>`). */
361
+ export declare const DEFAULT_COMPONENTS: MarkdownComponents;
460
362
 
461
- export declare const DEFAULT_CODEBLOCK_PROPS: SurrealCodeBlockProps;
363
+ /** Default mode used when no mode is provided. */
364
+ export declare const DEFAULT_MARKDOWN_MODE: MarkdownEditMode;
462
365
 
463
- export declare const DEFAULT_IMAGE_PROPS: CDNImageProps;
464
-
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;
366
+ /**
367
+ * Built-in slash commands for the Markdown editor. Consumers can override or
368
+ * extend this set via the `commands` prop on `MarkdownEditor`.
369
+ */
370
+ export declare const DEFAULT_SLASH_COMMANDS: readonly SlashCommand[];
472
371
 
473
372
  export declare type DefaultSort = {
474
373
  [key: string]: unknown;
@@ -482,11 +381,6 @@ export declare const Details: FC<DetailsProps> & {
482
381
  Summary: FC<SummaryProps>;
483
382
  };
484
383
 
485
- export declare interface DetailsNode extends CommonAttrs {
486
- type: "details";
487
- children: Array<SummaryNode | BlockNode>;
488
- }
489
-
490
384
  export declare interface DetailsProps extends Omit<BoxProps, "component" | "children"> {
491
385
  children: ReactNode;
492
386
  }
@@ -497,11 +391,6 @@ export declare interface DiagramNode {
497
391
  children: RailroadNode[];
498
392
  }
499
393
 
500
- export declare interface DivNode extends CommonAttrs {
501
- type: "div";
502
- children: BlockNode[];
503
- }
504
-
505
394
  declare type DynamicNode<T> = ReactNode | ((value: T) => ReactNode);
506
395
 
507
396
  export declare interface EditorController {
@@ -538,11 +427,6 @@ export declare type EditorStateSnapshot = Record<string, unknown>;
538
427
  */
539
428
  export declare function editorTheme(theme: ThemeConfig_2, colorScheme: MantineColorScheme): Extension;
540
429
 
541
- export declare interface EmphasisNode extends CommonAttrs {
542
- type: "emphasis";
543
- children: InlineNode[];
544
- }
545
-
546
430
  export declare function extractCdnId(query: string): string | undefined;
547
431
 
548
432
  export declare interface ExtractedCode {
@@ -551,12 +435,15 @@ export declare interface ExtractedCode {
551
435
  }
552
436
 
553
437
  /**
554
- * Extract headers from a Markdown AST
555
- *
556
- * @param ast - The Markdown AST
557
- * @returns An array of headings
438
+ * Extract headings from a Lezer markdown tree (SSR-safe).
439
+ * Walks the full tree and collects plain inline text (no markdown delimiters).
558
440
  */
559
- export declare function extractHeaders(ast: Root): Heading[];
441
+ export declare function extractHeadings(tree: Tree, source: MarkdownSource, opts?: ExtractHeadingsOptions): Heading[];
442
+
443
+ export declare interface ExtractHeadingsOptions {
444
+ /** Heading depths to include. Default: `[2, 3]`. */
445
+ depths?: ReadonlyArray<1 | 2 | 3 | 4 | 5 | 6>;
446
+ }
560
447
 
561
448
  /**
562
449
  * Extract test code from block comments at the start.
@@ -564,7 +451,8 @@ export declare function extractHeaders(ast: Root): Heading[];
564
451
  */
565
452
  export declare function extractTest(input: string): ExtractedCode;
566
453
 
567
- export declare const FontLinks: FC;
454
+ /** Case-insensitive filter over command titles and keywords. */
455
+ export declare function filterSlashCommands(commands: readonly SlashCommand[], query: string): SlashCommand[];
568
456
 
569
457
  /**
570
458
  * Generate a 24-character hex string suitable for use as a
@@ -573,41 +461,44 @@ export declare const FontLinks: FC;
573
461
  */
574
462
  export declare function generateRandomId(): string;
575
463
 
576
- export declare function getBlockOptionsComponent(blockType: string): BlockOptionsComponent | undefined;
577
-
578
464
  export declare function getCDNImageURL(imageId: string | undefined, width?: number, quality?: number): string | undefined;
579
465
 
580
466
  export declare function getCDNVideoURL(videoId: string | undefined, format?: "mp4" | "webm" | "mov", controls?: boolean): string | undefined;
581
467
 
582
- export declare function Header({ order, kicker, description, kickerProps, titleProps, descriptionProps, children, ...boxProps }: PropsWithChildren<HeaderProps>): ReactElement;
468
+ /** Read whether the markdown editor has completed its initial paint. */
469
+ export declare function getMarkdownEditorReady(state: EditorState): boolean;
583
470
 
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
- }
471
+ /**
472
+ * Read the current markdown mode from an {@link EditorState}.
473
+ */
474
+ export declare function getMarkdownMode(state: EditorState): MarkdownEditMode;
598
475
 
599
- export declare interface Heading {
476
+ /** A document heading with slug id, plain text, and depth. */
477
+ declare interface Heading {
600
478
  id: string;
601
479
  text: string;
602
480
  depth: 1 | 2 | 3 | 4 | 5 | 6;
603
481
  }
604
482
 
605
- export declare interface HeadingNode extends CommonAttrs {
606
- type: "heading";
607
- depth: 1 | 2 | 3 | 4 | 5 | 6;
608
- children: InlineNode[];
483
+ /** Source range of `{#custom-id}` suffix when present. */
484
+ export declare function headingCustomIdSuffixRange(node: SyntaxNode, source: MarkdownSource): {
485
+ from: number;
486
+ to: number;
487
+ } | undefined;
488
+
489
+ /** Heading title source bounds (after `HeaderMark`, trailing newlines and `{#id}` trimmed). */
490
+ export declare interface HeadingTitleBounds {
491
+ titleFrom: number;
492
+ /** End of title line, excluding trailing newlines. */
493
+ titleTo: number;
494
+ /** End of visible title (excludes `{#id}` suffix when present). */
495
+ visibleTo: number;
496
+ /** Custom id from `{#id}` suffix when present. */
497
+ customId?: string;
609
498
  }
610
499
 
500
+ export declare function headingTitleBounds(node: SyntaxNode, source: MarkdownSource): HeadingTitleBounds;
501
+
611
502
  export declare const Highlighting: FC<HighlightingProps>;
612
503
 
613
504
  export declare interface HighlightingProps extends BoxProps {
@@ -1005,50 +896,36 @@ export declare const iconWrench: string;
1005
896
 
1006
897
  export declare const iconXml: string;
1007
898
 
1008
- export declare interface ImageNode extends CommonAttrs {
1009
- type: "image";
899
+ /** Any object intersected with a stable string `id`. */
900
+ export declare type Identified<T = object, I = string> = T & {
901
+ id: I;
902
+ };
903
+
904
+ /** Normalised image descriptor for viewer renderers and `onImage` callbacks. */
905
+ export declare interface ImageDescriptor {
1010
906
  src: string;
1011
- darkSrc?: string;
1012
- alt: string;
907
+ alt?: string;
1013
908
  title?: string;
909
+ darkSrc?: string;
1014
910
  }
1015
911
 
1016
- export declare interface InlineCodeNode extends CommonAttrs {
1017
- type: "inlineCode";
1018
- value: string;
1019
- }
912
+ /**
913
+ * Build a `run` that inserts a callout of the given kind.
914
+ */
915
+ export declare function insertCallout(kind: CalloutKind): CommandAction;
1020
916
 
1021
- export declare type InlineNode = TextNode | LinkNode | InlineCodeNode | StrongNode | EmphasisNode | SuperscriptNode | SubscriptNode | BreakNode | SpanNode | ImageNode | JsxExpressionNode | JsxComponentNode;
917
+ /**
918
+ * Build a `run` that inserts the given markdown and positions the caret at the end of the inserted text,
919
+ * or at the given offset.
920
+ */
921
+ export declare function insertMarkdown(insert: string, caretOffset?: number): CommandAction;
1022
922
 
1023
923
  export declare function isCDNId(query: string): boolean;
1024
924
 
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
- }
1037
-
1038
- export declare interface JsxExpressionNode extends CommonAttrs {
1039
- type: "jsxExpression";
1040
- value: string;
1041
- position?: NodePosition;
1042
- }
925
+ /** True when the registered component declares `block: true`. */
926
+ export declare function isMarkdownComponentBlock(components: MarkdownComponents | undefined, name: string): boolean;
1043
927
 
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
- */
928
+ /** How `<Component />` tags are handled. */
1052
929
  export declare type JsxMode = "render" | "throw" | "graceful" | "omit";
1053
930
 
1054
931
  export declare function Label({ label, ...props }: LabelProps): ReactNode;
@@ -1057,139 +934,310 @@ export declare interface LabelProps extends Omit<BadgeProps, "children"> {
1057
934
  label: string;
1058
935
  }
1059
936
 
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
- }
937
+ declare type Language = "csharp" | "rust" | "javascript" | "typescript" | "surrealql" | "json" | "yaml" | "java" | "go" | "python" | "html" | "cli" | "php" | "markdown" | "syntax";
1083
938
 
1084
939
  /**
1085
940
  * The Mantine theme configurtation
1086
941
  */
1087
942
  export declare const MANTINE_THEME: MantineThemeOverride;
1088
943
 
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;
944
+ /**
945
+ * Configuration for a single `<Component />` registered in {@link MarkdownComponents}.
946
+ * Set `block: true` to opt into the block-rendering path (own line, hover
947
+ * outline, edit-source action) instead of the default inline-widget path.
948
+ */
949
+ export declare interface MarkdownComponentConfig {
950
+ component: ComponentType<any>;
951
+ block?: boolean;
1108
952
  }
1109
953
 
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>>;
954
+ /** A registered component is either a bare React component (inline) or a config object. */
955
+ export declare type MarkdownComponentDef = ComponentType<any> | MarkdownComponentConfig;
1115
956
 
1116
- export declare const MantineTable: YooptaPlugin<MantineTableElementMap>;
957
+ /** Map of PascalCase JSX tag names to viewer/editor component registrations. */
958
+ export declare type MarkdownComponents = Record<string, MarkdownComponentDef>;
1117
959
 
1118
- export declare type MantineTableElement = SlateElement<"mantine-table", MantineTableProps>;
960
+ /**
961
+ * Rendering mode of the markdown editor.
962
+ *
963
+ * - `source` renders raw markdown syntax with subtle styling.
964
+ * - `preview` shows source markup only on the active line/block;
965
+ * other content is rendered visually.
966
+ */
967
+ export declare type MarkdownEditMode = "source" | "preview";
1119
968
 
1120
- export declare type MantineTableElementMap = {
1121
- "mantine-table": MantineTableElement;
1122
- };
969
+ /**
970
+ * High-level Markdown editor primitive that wires together the
971
+ * `CodeEditor` shell, the live preview extension, the widget store and
972
+ * the React portal host.
973
+ *
974
+ * See {@link MarkdownViewer} for a Markdown viewer equivalent.
975
+ */
976
+ export declare const MarkdownEditor: FC<MarkdownEditorProps>;
1123
977
 
1124
- export declare interface MantineTableProps {
1125
- nodeType: "void";
1126
- rows: string[][];
1127
- withHeaderRow: boolean;
1128
- striped: boolean;
1129
- highlightOnHover: boolean;
1130
- caption: string;
978
+ export declare interface MarkdownEditorProps extends Omit<EditorOptions, "language" | "extensions">, Omit<BoxProps, "onChange"> {
979
+ /** `source` or `preview` (live preview). Defaults to `preview`. */
980
+ mode?: MarkdownEditMode;
981
+ /** Additional CodeMirror extensions to layer on top of the live preview. */
982
+ extensions?: Extension;
983
+ /** GFM table preview widgets in preview mode. Defaults to `true`. */
984
+ tables?: boolean;
985
+ /**
986
+ * Auto-format GFM table source while editing: align columns and pad cells
987
+ * with trailing spaces. Defaults to `false`.
988
+ */
989
+ withTableFormatter?: boolean;
990
+ /** React components for `<PascalCase />` tags (preview widgets). */
991
+ components?: MarkdownComponents;
992
+ /** How unsupported JSX is handled in preview. Default `render` (uses {@link DEFAULT_COMPONENTS}). */
993
+ jsxMode?: JsxMode;
994
+ /** Auto-focus the editor on mount. */
995
+ autoFocus?: boolean;
996
+ /**
997
+ * Custom per-language renderers for fenced code blocks. Keys are the
998
+ * lower-cased fenced-code info string (e.g. `mermaid`). When the block
999
+ * is inactive, a matching renderer fully replaces the source. Defaults
1000
+ * to `{ mermaid: MermaidCodeRenderer }`; pass `{}` to disable.
1001
+ */
1002
+ codeRenderers?: Record<string, CodeRenderer>;
1003
+ /** Enable the slash command palette. Defaults to `true`. */
1004
+ slashCommands?: boolean;
1005
+ /** Override the slash command set. Defaults to {@link DEFAULT_SLASH_COMMANDS}. */
1006
+ commands?: readonly SlashCommand[];
1131
1007
  }
1132
1008
 
1133
1009
  /**
1134
- * Main Markdown component that parses markdown and renders it
1135
- * Applies stylesheet and spacing
1010
+ * Marks the editor ready after the first animation frame so mount-time decoration
1011
+ * classes do not trigger CSS transitions. Exposes {@link markdownEditorReadyField}
1012
+ * and `data-markdown-ready` on the editor root.
1013
+ */
1014
+ export declare function markdownEditorReady(): Extension;
1015
+
1016
+ /**
1017
+ * Whether the markdown editor has completed its initial paint. CSS transitions
1018
+ * and similar effects should be gated on this so decoration classes do not
1019
+ * animate from their pre-decoration computed values on mount.
1136
1020
  */
1137
- export declare function Markdown({ content, renderers, rendererProps, components, scope, }: MarkdownProps): React_2.ReactElement;
1021
+ export declare const markdownEditorReadyField: StateField<boolean>;
1138
1022
 
1139
- declare type MarkdownComponents = Record<string, React.ComponentType<any>>;
1023
+ /**
1024
+ * Live preview stack: language (optional), mode field, folding, decorations, theme.
1025
+ */
1026
+ export declare function markdownLivePreview(opts: MarkdownLivePreviewOptions): Extension;
1140
1027
 
1141
- export declare interface MarkdownProps {
1142
- /**
1143
- * Markdown content to render
1144
- */
1145
- content: string;
1028
+ /** Options for {@link markdownLivePreview}. */
1029
+ export declare interface MarkdownLivePreviewOptions {
1030
+ /** GFM table preview widgets in preview mode. Defaults to `true`. */
1031
+ tables?: boolean;
1146
1032
  /**
1147
- * Override how built-in markdown elements are rendered.
1148
- * Keys are AST node types (`"heading"`, `"code"`, `"table"`, etc.).
1033
+ * Auto-format GFM table source on edit: align columns, pad cells with
1034
+ * trailing spaces, and normalise the delimiter row. Defaults to `false`.
1149
1035
  */
1150
- renderers?: MarkdownRenderers;
1036
+ withTableFormatter?: boolean;
1151
1037
  /**
1152
- * Extra props forwarded to specific built-in renderers (e.g. code block options).
1038
+ * Per-language renderers used when a fenced code block is inactive (preview
1039
+ * unfocused / caret outside the block). Keys are the lower-cased fenced-code
1040
+ * info string (e.g. `mermaid`). Defaults to `{}`.
1153
1041
  */
1154
- rendererProps?: MarkdownRendererProps;
1042
+ codeRenderers?: Record<string, CodeRenderer>;
1043
+ /** Required widget store, typically returned by `useMarkdownWidgetStore()`. */
1044
+ widgetStore: WidgetStore;
1045
+ /** Whether to install the markdown language alongside the live preview. */
1046
+ includeLanguage?: boolean;
1155
1047
  /**
1156
- * React components available for use as `<Component />` tags in the markdown content.
1157
- * Keys should match PascalCase tag names (e.g. `{ StatusCard, Alert }`).
1048
+ * Optional language resolver for embedded fenced code blocks.
1158
1049
  */
1050
+ resolveCodeLanguage?: (info: string) => Language_2 | undefined;
1051
+ /** JSX/HTML preview widgets (viewer parity). Omit to leave raw source in preview. */
1159
1052
  components?: MarkdownComponents;
1053
+ jsxMode?: JsxMode;
1160
1054
  /**
1161
- * Variable context for evaluating `{expression}` values in JSX attributes
1162
- * and inline expressions (e.g. `{ userName: "Alice", count: 42 }`).
1055
+ * Slash command palette. Pass a store (from `useSlashStore()`) to enable
1056
+ * the slash (`/`) command menu. Render `<SlashCommandMenu>` with the
1057
+ * same store. Omit to disable.
1163
1058
  */
1164
- scope?: Record<string, unknown>;
1059
+ slash?: {
1060
+ store: SlashStore;
1061
+ };
1165
1062
  }
1166
1063
 
1167
1064
  /**
1168
- * Extra props forwarded to specific built-in renderers (e.g. code block options).
1065
+ * State field tracking the current {@link MarkdownEditMode}.
1169
1066
  */
1170
- export declare interface MarkdownRendererProps {
1171
- code?: Partial<CodeBlockProps>;
1067
+ export declare const markdownModeField: StateField<MarkdownEditMode>;
1068
+
1069
+ /**
1070
+ * Bundles the slash session {@link slashSessionField} with a `ViewPlugin` that
1071
+ * mirrors the active session and caret into the given {@link SlashStore}, which
1072
+ * the React menu reads via `useSyncExternalStore`. Anchor coordinates are
1073
+ * measured by the React component — `coordsAtPos` cannot run during an update.
1074
+ */
1075
+ export declare function markdownSlashCommands(options: MarkdownSlashCommandsOptions): Extension;
1076
+
1077
+ /** Options for {@link markdownSlashCommands}. */
1078
+ export declare interface MarkdownSlashCommandsOptions {
1079
+ /** Store bridging the session to the React `<SlashCommandMenu>`. */
1080
+ store: SlashStore;
1081
+ }
1082
+
1083
+ /**
1084
+ * Document slice compatible with CodeMirror {@link Text} line API.
1085
+ * Used by tree helpers and the viewer renderer.
1086
+ */
1087
+ export declare interface MarkdownSource {
1088
+ readonly length: number;
1089
+ slice(from: number, to: number): string;
1090
+ lineAt(pos: number): {
1091
+ from: number;
1092
+ to: number;
1093
+ number: number;
1094
+ };
1095
+ line(n: number): {
1096
+ from: number;
1097
+ to: number;
1098
+ number: number;
1099
+ };
1100
+ readonly lineCount: number;
1101
+ }
1102
+
1103
+ /**
1104
+ * Build a {@link MarkdownSource} from raw markdown (SSR-safe).
1105
+ */
1106
+ export declare function markdownSourceFromString(source: string): MarkdownSource;
1107
+
1108
+ /**
1109
+ * Editor base theme for the markdown live preview. Cursor / scroller rules and
1110
+ * editor-only chrome; shared surface styles live in `markdown.module.scss`.
1111
+ */
1112
+ export declare function markdownTheme(): Extension;
1113
+
1114
+ /**
1115
+ * High-level Markdown viewer primitive that renders a Markdown structure
1116
+ * as a React tree.
1117
+ *
1118
+ * See {@link MarkdownEditor} for a Markdown editor equivalent.
1119
+ */
1120
+ export declare const MarkdownViewer: FC<MarkdownViewerProps>;
1121
+
1122
+ export declare interface MarkdownViewerProps extends BoxProps {
1123
+ /** Markdown source string. Ignored when `tree` is provided. */
1124
+ content?: string;
1125
+ /** Pre-parsed tree and markdown source. */
1126
+ tree?: MarkdownViewerTreeInput;
1127
+ /** Collapse consecutive blank lines into a single line break. Defaults to `true`. */
1128
+ collapseBlankLines?: boolean;
1129
+ /** Override built-in element renderers. */
1130
+ renderers?: MarkdownViewerRenderers;
1131
+ /** Rewrite image URLs before render (e.g. CDN resolution). */
1132
+ onImage?: (node: ImageDescriptor) => ImageDescriptor;
1133
+ /** Add slug IDs and hover anchor links on headings. */
1134
+ autoLink?: boolean;
1172
1135
  /**
1173
- * How `<Component />` tags and `{expression}` values are handled.
1174
- *
1175
- * @default "render"
1136
+ * Custom per-language renderers for fenced code blocks. Keys are the
1137
+ * lower-cased fenced-code info string (e.g. `mermaid`). When the block
1138
+ * is inactive, a matching renderer fully replaces the source. Defaults
1139
+ * to `{ mermaid: MermaidCodeRenderer }`; pass `{}` to disable.
1176
1140
  */
1177
- jsx?: JsxMode;
1141
+ codeRenderers?: Record<string, CodeRenderer>;
1142
+ /** React components for `<PascalCase />` tags. */
1143
+ components?: MarkdownComponents;
1144
+ /** How unsupported JSX is handled. Default `render` (uses {@link DEFAULT_COMPONENTS}). */
1145
+ jsxMode?: JsxMode;
1178
1146
  }
1179
1147
 
1180
- declare type MarkdownRenderers = Partial<RendererMap>;
1148
+ /**
1149
+ * Optional per-node React render overrides for {@link MarkdownViewer}.
1150
+ * `listItem` and `strikethrough` are reserved for a future release and are not
1151
+ * consulted by the current viewer pipeline.
1152
+ */
1153
+ export declare type MarkdownViewerRenderers = Partial<{
1154
+ heading: (props: {
1155
+ children: ReactNode;
1156
+ level: number;
1157
+ id?: string;
1158
+ }) => ReactNode;
1159
+ paragraph: (props: {
1160
+ children: ReactNode;
1161
+ }) => ReactNode;
1162
+ link: (props: {
1163
+ href: string;
1164
+ title?: string;
1165
+ children: ReactNode;
1166
+ }) => ReactNode;
1167
+ list: (props: {
1168
+ ordered: boolean;
1169
+ children: ReactNode;
1170
+ }) => ReactNode;
1171
+ listItem: (props: {
1172
+ children: ReactNode;
1173
+ checked?: boolean;
1174
+ }) => ReactNode;
1175
+ blockquote: (props: {
1176
+ children: ReactNode;
1177
+ }) => ReactNode;
1178
+ code: (props: {
1179
+ value: string;
1180
+ lang?: string;
1181
+ title?: string;
1182
+ runnable?: string;
1183
+ }) => ReactNode;
1184
+ inlineCode: (props: {
1185
+ value: string;
1186
+ }) => ReactNode;
1187
+ table: (props: {
1188
+ children: ReactNode;
1189
+ }) => ReactNode;
1190
+ thematicBreak: () => ReactNode;
1191
+ image: (props: ImageDescriptor) => ReactNode;
1192
+ strong: (props: {
1193
+ children: ReactNode;
1194
+ }) => ReactNode;
1195
+ emphasis: (props: {
1196
+ children: ReactNode;
1197
+ }) => ReactNode;
1198
+ strikethrough: (props: {
1199
+ children: ReactNode;
1200
+ }) => ReactNode;
1201
+ jsxComponent: (props: {
1202
+ name: string;
1203
+ children: ReactNode;
1204
+ attributes: Record<string, unknown>;
1205
+ }) => ReactNode;
1206
+ }>;
1181
1207
 
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;
1208
+ export declare interface MarkdownViewerTreeInput {
1209
+ tree: Tree;
1210
+ source: MarkdownSource;
1191
1211
  }
1192
1212
 
1213
+ /**
1214
+ * React component that renders a portal for every widget registered in the
1215
+ * given {@link WidgetStore}. Mount this once per editor (the
1216
+ * `MarkdownEditor` primitive does this for you), inside the
1217
+ * `MantineProvider` tree so widgets inherit theme and other context.
1218
+ *
1219
+ * The component renders no DOM of its own — only invisible portal targets
1220
+ * that hand off to the host elements created by `WidgetType.toDOM()`.
1221
+ */
1222
+ export declare const MarkdownWidgetPortals: FC<MarkdownWidgetPortalsProps>;
1223
+
1224
+ export declare interface MarkdownWidgetPortalsProps {
1225
+ /** The store to read widget entries from. */
1226
+ store: WidgetStore;
1227
+ }
1228
+
1229
+ /** Merge default JSX components with caller overrides (caller wins on key clash). */
1230
+ export declare function mergeMarkdownComponents(components?: MarkdownComponents): MarkdownComponents;
1231
+
1232
+ /**
1233
+ * Standalone {@link CodeRenderer} for fenced code blocks whose info string
1234
+ * is `mermaid`. Lazy-loads the `mermaid` module the first time it mounts so
1235
+ * consumers only pay the bundle cost when actually using diagrams. Renders
1236
+ * inside a Mantine `Center` while loading and replaces it with the SVG once
1237
+ * available.
1238
+ */
1239
+ export declare const MermaidCodeRenderer: CodeRenderer;
1240
+
1193
1241
  export declare interface MiniConfig {
1194
1242
  url?: string;
1195
1243
  dataset?: "surreal-deal-store-mini" | `/${string}.surql`;
@@ -1239,17 +1287,6 @@ export declare class MiniController {
1239
1287
  executeQuery(query: string): void;
1240
1288
  }
1241
1289
 
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
1290
  declare interface NonTerminalNode {
1254
1291
  type: "NonTerminal";
1255
1292
  text: string;
@@ -1282,29 +1319,21 @@ declare interface OptionalNode {
1282
1319
  child: RailroadNode;
1283
1320
  }
1284
1321
 
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[];
1322
+ declare interface ParsedHeadingTitle {
1323
+ /** Visible title text (custom id suffix removed). */
1324
+ text: string;
1325
+ /** Custom id from `{#id}` when present. */
1326
+ customId?: string;
1293
1327
  }
1294
1328
 
1329
+ /** Split plain heading text into visible title and optional `{#id}` suffix. */
1330
+ export declare function parseHeadingTitleText(plain: string): ParsedHeadingTitle;
1331
+
1295
1332
  /**
1296
- * Parse markdown string to AST
1333
+ * Parse markdown into a Lezer syntax tree using the same grammar as CodeMirror.
1334
+ * Safe in SSR: no {@link EditorState} or DOM.
1297
1335
  */
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
- }
1336
+ export declare function parseMarkdownTree(source: string): Tree;
1308
1337
 
1309
1338
  export declare const picto2106: string;
1310
1339
 
@@ -1770,56 +1799,11 @@ export declare interface RailroadDiagramProps extends BoxProps {
1770
1799
 
1771
1800
  export declare type RailroadNode = DiagramNode | SequenceNode | TerminalNode | NonTerminalNode | OptionalNode | ChoiceNode | OneOrMoreNode | ZeroOrMoreNode | CommentNode;
1772
1801
 
1773
- export declare function registerBlockOptions(blockType: string, component: BlockOptionsComponent): void;
1802
+ /** Resolve heading `id` from `{#custom}` suffix or slugged plain title. */
1803
+ export declare function resolveHeadingId(node: SyntaxNode, source: MarkdownSource, slugger: default_2): string | undefined;
1774
1804
 
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
- }
1805
+ /** Normalise a component registration into its `{ component, block }` form. */
1806
+ export declare function resolveMarkdownComponent(def: MarkdownComponentDef | undefined): MarkdownComponentConfig | undefined;
1823
1807
 
1824
1808
  export declare interface ResponsiveTabItem {
1825
1809
  value: string;
@@ -1843,9 +1827,21 @@ export declare interface ResponsiveTabsProps extends Omit<TabsProps_2, "children
1843
1827
  selectProps?: Omit<SelectProps, "data" | "value" | "defaultValue" | "onChange">;
1844
1828
  }
1845
1829
 
1846
- export declare interface Root {
1847
- type: "root";
1848
- children: BlockNode[];
1830
+ export declare function SectionTitle({ order, kicker, description, kickerProps, titleProps, descriptionProps, children, ...boxProps }: PropsWithChildren<SectionTitle>): ReactElement;
1831
+
1832
+ export declare interface SectionTitle extends BoxProps {
1833
+ /** The kicker text to display above the title */
1834
+ kicker?: ReactNode;
1835
+ /** Heading order (1-6), controls `font-size` when `size` is not set on the title. @default `1` */
1836
+ order?: TitleOrder;
1837
+ /** A description text to display below the title */
1838
+ description?: string;
1839
+ /** Props to pass to the kicker component */
1840
+ kickerProps?: TextProps;
1841
+ /** Props to pass to the title component */
1842
+ titleProps?: TitleProps;
1843
+ /** Props to pass to the description component */
1844
+ descriptionProps?: TextProps;
1849
1845
  }
1850
1846
 
1851
1847
  declare interface SequenceNode {
@@ -1854,13 +1850,18 @@ declare interface SequenceNode {
1854
1850
  }
1855
1851
 
1856
1852
  /**
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
1853
+ * Replace the entire document. External/programmatic sync must not pollute the
1854
+ * undo stack (see CodeMirror controlled-editor guidance).
1861
1855
  */
1862
1856
  export declare function setEditorText(editor: EditorView, text: string): void;
1863
1857
 
1858
+ export declare const setMarkdownEditorReady: StateEffectType<boolean>;
1859
+
1860
+ /**
1861
+ * State effect used to swap the active markdown rendering mode.
1862
+ */
1863
+ export declare const setMarkdownMode: StateEffectType<MarkdownEditMode>;
1864
+
1864
1865
  export declare function Since({ v, prefix, ...props }: SinceProps): ReactNode;
1865
1866
 
1866
1867
  export declare interface SinceProps extends Omit<BadgeProps, "children"> {
@@ -1868,7 +1869,89 @@ export declare interface SinceProps extends Omit<BadgeProps, "children"> {
1868
1869
  prefix?: string;
1869
1870
  }
1870
1871
 
1871
- export declare const SIZE_OPTIONS: OptionItem[];
1872
+ /**
1873
+ * A single slash command. `run` receives the live editor and the range
1874
+ * covering the `/query` text to replace with boilerplate.
1875
+ */
1876
+ export declare interface SlashCommand {
1877
+ /** Stable id used for filtering keys and keyboard navigation. */
1878
+ readonly id: string;
1879
+ /** Primary label shown in the menu. */
1880
+ readonly title: string;
1881
+ /** Extra terms matched against the query (besides the title). */
1882
+ readonly keywords?: readonly string[];
1883
+ /** Optional group heading; commands sharing a category are shown together. */
1884
+ readonly category?: string;
1885
+ /** React node for the leading icon. */
1886
+ readonly icon?: ReactNode;
1887
+ /** Apply the command — typically replaces `range` with markdown. */
1888
+ readonly run: CommandAction;
1889
+ }
1890
+
1891
+ /**
1892
+ * Renders the slash command palette. Reads the active session
1893
+ * from the {@link SlashStore}, filters {@link SlashCommand}s by the typed
1894
+ * query and shows a Mantine `Menu` anchored to the caret. The editor keeps DOM
1895
+ * focus; navigation/selection keys are intercepted in the capture phase so
1896
+ * arrows move the highlight and `Enter` runs the command instead of editing
1897
+ * the document.
1898
+ *
1899
+ * Mount once per editor inside the `MantineProvider` tree, alongside
1900
+ * `MarkdownWidgetPortals`.
1901
+ */
1902
+ export declare const SlashCommandMenu: FC<SlashCommandMenuProps>;
1903
+
1904
+ export declare interface SlashCommandMenuProps {
1905
+ /** Store fed by `markdownSlashCommands` (see {@link useSlashStore}). */
1906
+ store: SlashStore;
1907
+ /** Accessor for the live editor view (e.g. `controller.getEditor`). */
1908
+ getEditor: () => EditorView;
1909
+ /** Commands to offer. Defaults to {@link DEFAULT_SLASH_COMMANDS}. */
1910
+ commands?: readonly SlashCommand[];
1911
+ }
1912
+
1913
+ /** Document range a command replaces: `from` = slash position, `to` = caret. */
1914
+ export declare interface SlashCommandRange {
1915
+ readonly from: number;
1916
+ readonly to: number;
1917
+ }
1918
+
1919
+ /** Viewport coordinates of the slash anchor (from `view.coordsAtPos`). */
1920
+ export declare interface SlashCoords {
1921
+ readonly left: number;
1922
+ readonly top: number;
1923
+ readonly right: number;
1924
+ readonly bottom: number;
1925
+ }
1926
+
1927
+ /** Active slash session: the slash position and the query typed after it. */
1928
+ export declare interface SlashSession {
1929
+ /** Document position of the triggering `/`. */
1930
+ readonly from: number;
1931
+ /** Text between the slash and the caret (excludes the slash itself). */
1932
+ readonly query: string;
1933
+ }
1934
+
1935
+ /**
1936
+ * Snapshot the React menu reads: the active session and caret. Anchor
1937
+ * coordinates are measured in React (not here) because `coordsAtPos` cannot be
1938
+ * called during a CodeMirror update.
1939
+ */
1940
+ export declare interface SlashState {
1941
+ readonly session: SlashSession;
1942
+ /** Caret position (end of the `/query` range). */
1943
+ readonly to: number;
1944
+ }
1945
+
1946
+ /**
1947
+ * CM write-side ↔ React read-side bridge for the slash palette, mirroring the
1948
+ * widget `WidgetStore`. `null` snapshot means no active session.
1949
+ */
1950
+ export declare interface SlashStore {
1951
+ setState(state: SlashState | null): void;
1952
+ subscribe(listener: () => void): () => void;
1953
+ getSnapshot(): SlashState | null;
1954
+ }
1872
1955
 
1873
1956
  export declare type SortDirection = "asc" | "desc" | undefined;
1874
1957
 
@@ -1885,11 +1968,6 @@ export declare interface SortOptions<T = DefaultSort> {
1885
1968
 
1886
1969
  export declare const Spacer: FC<BoxProps>;
1887
1970
 
1888
- export declare interface SpanNode extends CommonAttrs {
1889
- type: "span";
1890
- children: InlineNode[];
1891
- }
1892
-
1893
1971
  export declare function Spinner({ size, color, className, title, ...props }: SpinnerProps): ReactNode;
1894
1972
 
1895
1973
  export declare interface SpinnerProps extends BoxProps {
@@ -1902,53 +1980,17 @@ export declare type StateFields = {
1902
1980
  [prop: string]: StateField<any>;
1903
1981
  };
1904
1982
 
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
1983
  /**
1916
1984
  * Suggest completions at the start of each line
1917
1985
  */
1918
1986
  export declare const suggestCompletions: Command;
1919
1987
 
1920
- export declare interface SummaryNode extends CommonAttrs {
1921
- type: "summary";
1922
- children: InlineNode[];
1923
- }
1924
-
1925
1988
  export declare interface SummaryProps extends Omit<BoxProps, "component" | "children"> {
1926
1989
  children: ReactNode;
1927
1990
  }
1928
1991
 
1929
- declare interface SuperscriptNode extends CommonAttrs {
1930
- type: "superscript";
1931
- children: InlineNode[];
1932
- }
1933
-
1934
1992
  export declare const SURREAL_CDN_BASE = "https://cdn.surrealdb.com";
1935
1993
 
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
1994
  export declare function SurrealistMini({ config, frameRef, ...props }: SurrealistMiniProps): ReactNode;
1953
1995
 
1954
1996
  export declare interface SurrealistMiniProps extends BoxProps {
@@ -1956,22 +1998,6 @@ export declare interface SurrealistMiniProps extends BoxProps {
1956
1998
  frameRef?: RefObject<HTMLIFrameElement | null>;
1957
1999
  }
1958
2000
 
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
2001
  export declare const SYNTAX_THEME_CONFIG: ThemeConfig;
1976
2002
 
1977
2003
  export declare interface TabItem {
@@ -1980,42 +2006,8 @@ export declare interface TabItem {
1980
2006
  content: ReactNode;
1981
2007
  }
1982
2008
 
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
2009
  export declare function Tabs({ items, syncKey, ...props }: TabsProps): ReactNode;
2010
2010
 
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
2011
  export declare interface TabsProps extends Omit<TabsProps_2, "children" | "value" | "onChange"> {
2020
2012
  items: TabItem[];
2021
2013
  syncKey?: string;
@@ -2026,15 +2018,6 @@ declare interface TerminalNode {
2026
2018
  text: string;
2027
2019
  }
2028
2020
 
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
2021
  export declare type ThemeConfig = {
2039
2022
  light: HighlightStyle;
2040
2023
  dark: HighlightStyle;
@@ -2055,12 +2038,13 @@ export declare interface ThemedImageProps extends ImageProps {
2055
2038
  darkSrc?: string;
2056
2039
  }
2057
2040
 
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;
2041
+ /** Trim `{#id}` from the end of a heading source range (returns new exclusive `titleTo`). */
2042
+ export declare function trimCustomHeadingIdFromRange(source: {
2043
+ slice(from: number, to: number): string;
2044
+ }, titleFrom: number, titleTo: number): {
2045
+ titleTo: number;
2046
+ customId?: string;
2047
+ };
2064
2048
 
2065
2049
  /**
2066
2050
  * Returns a function which can be used to trigger a confirmation dialog
@@ -2069,6 +2053,19 @@ export declare function useConfirmation<T = void>(options: ConfirmOptions<T>): (
2069
2053
 
2070
2054
  export declare function useEditor(options?: EditorOptions): EditorController;
2071
2055
 
2056
+ /**
2057
+ * Keyboard navigation over a flat list of identified items. Returns a
2058
+ * `keydown` handler and the currently active item id.
2059
+ *
2060
+ * The handler responds to `ArrowUp`/`ArrowDown` (and `Tab`/`Shift+Tab`) to
2061
+ * move the active item, and `Enter` to submit it. The active element is
2062
+ * scrolled into view via the `[data-navigation-item-id="…"]` attribute, which
2063
+ * rendered items should carry.
2064
+ *
2065
+ * Ported from `surrealist/src/hooks/keys.ts`.
2066
+ */
2067
+ export declare function useKeyNavigation<T extends Identified>(items: T[], onSubmit?: (item: T) => void, initial?: string): readonly [(e: React.KeyboardEvent) => void, string];
2068
+
2072
2069
  /**
2073
2070
  * Trigger a new render and invoke the passed function
2074
2071
  * during this next call. Useful when you require the component
@@ -2079,8 +2076,22 @@ export declare function useEditor(options?: EditorOptions): EditorController;
2079
2076
  */
2080
2077
  export declare function useLater<T extends unknown[]>(doLater: (...args: T) => unknown): (...args: T) => void;
2081
2078
 
2079
+ /**
2080
+ * Hook returning a stable {@link WidgetStore} reference for the lifetime of
2081
+ * the calling component. Pair with {@link MarkdownWidgetPortals} and pass
2082
+ * the same store into `markdownLivePreview({ widgetStore })`.
2083
+ */
2084
+ export declare function useMarkdownWidgetStore(): WidgetStore;
2085
+
2082
2086
  export declare function useMiniController(): [RefObject<HTMLIFrameElement | null>, MiniController];
2083
2087
 
2088
+ /**
2089
+ * Hook returning a stable {@link SlashStore} for the lifetime of the calling
2090
+ * component. Pair with {@link SlashCommandMenu} and pass the same store into
2091
+ * `markdownLivePreview({ slash: { store } })`.
2092
+ */
2093
+ export declare function useSlashStore(): SlashStore;
2094
+
2084
2095
  export declare function useSort<T = DefaultSort>(options?: SortOptions<T>): SortHandle<T>;
2085
2096
 
2086
2097
  /**
@@ -2103,8 +2114,6 @@ export declare function useSwitch(initialState?: boolean, callbacks?: {
2103
2114
  onClose?: () => void;
2104
2115
  }): readonly [boolean, BooleanHandle];
2105
2116
 
2106
- export declare const VARIANT_OPTIONS: OptionItem[];
2107
-
2108
2117
  export declare function Version({ version, ...props }: VersionProps): ReactNode;
2109
2118
 
2110
2119
  export declare interface VersionProps extends CodeProps {
@@ -2113,19 +2122,6 @@ export declare interface VersionProps extends CodeProps {
2113
2122
 
2114
2123
  export declare type VideoControlsPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
2115
2124
 
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
2125
  export declare const VideoPlayer: FC<VideoPlayerProps>;
2130
2126
 
2131
2127
  export declare interface VideoPlayerProps extends BoxProps {
@@ -2140,21 +2136,39 @@ export declare interface VideoPlayerProps extends BoxProps {
2140
2136
  }
2141
2137
 
2142
2138
  /**
2143
- * Visit all nodes in the tree
2139
+ * The default UI Kit editor theme
2144
2140
  */
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;
2141
+ export declare const VIVID_THEME: ThemeConfig_2;
2148
2142
 
2149
2143
  /**
2150
- * Generic visitor function
2144
+ * Registered widget host + render closure for `createPortal`. Map identity uses `portalKey`, not `id`.
2151
2145
  */
2152
- export declare type Visitor = (node: AnyNode, index: number | undefined, parent: AnyNode | Root | null) => undefined | boolean | void;
2146
+ declare interface WidgetEntry {
2147
+ /** Opaque key for this mount; survives logical id reuse across rebuilds. */
2148
+ readonly portalKey: number;
2149
+ /** Debug-oriented `kind:from-to`; not a store key. */
2150
+ readonly id: string;
2151
+ readonly host: HTMLElement;
2152
+ readonly render: () => ReactNode;
2153
+ }
2153
2154
 
2154
2155
  /**
2155
- * The default UI Kit editor theme
2156
+ * CM write-side React read-side (`useSyncExternalStore` in `markdown-widget-portals.tsx`).
2156
2157
  */
2157
- export declare const VIVID_THEME: ThemeConfig_2;
2158
+ declare interface WidgetStore {
2159
+ register(entry: WidgetEntry): void;
2160
+ /** Unregister only when the host still maps to `expectedPortalKey` (avoids stale destroys after host reuse). */
2161
+ unregisterHost(host: HTMLElement, expectedPortalKey?: number): void;
2162
+ /**
2163
+ * Replace render closure when `updateDOM` runs with same `portalKey` but new captured state.
2164
+ */
2165
+ update(portalKey: number, render: () => ReactNode): void;
2166
+ /** True after {@link register} for this key. */
2167
+ hasPortalKey(portalKey: number): boolean;
2168
+ subscribe(listener: () => void): () => void;
2169
+ /** Returns a stable, frozen snapshot of all currently registered widgets. */
2170
+ getSnapshot(): readonly WidgetEntry[];
2171
+ }
2158
2172
 
2159
2173
  declare interface ZeroOrMoreNode {
2160
2174
  type: "ZeroOrMore";