@mdxeditor/editor 0.0.0-development

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 (286) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +28 -0
  3. package/dist/FormatConstants.d.ts +9 -0
  4. package/dist/FormatConstants.js +10 -0
  5. package/dist/MDXEditor.d.ts +92 -0
  6. package/dist/MDXEditor.js +142 -0
  7. package/dist/directive-editors/AdmonitionDirectiveDescriptor.d.ts +17 -0
  8. package/dist/directive-editors/AdmonitionDirectiveDescriptor.js +28 -0
  9. package/dist/directive-editors/GenericDirectiveEditor.d.ts +8 -0
  10. package/dist/directive-editors/GenericDirectiveEditor.js +32 -0
  11. package/dist/exportMarkdownFromLexical.d.ts +133 -0
  12. package/dist/exportMarkdownFromLexical.js +202 -0
  13. package/dist/gurx/index.d.ts +3 -0
  14. package/dist/gurx/react.d.ts +152 -0
  15. package/dist/gurx/react.js +206 -0
  16. package/dist/gurx/realm.d.ts +148 -0
  17. package/dist/gurx/realm.js +489 -0
  18. package/dist/gurx/realmFactory.d.ts +79 -0
  19. package/dist/gurx/realmFactory.js +32 -0
  20. package/dist/icons/add_column.svg.js +5 -0
  21. package/dist/icons/add_photo.svg.js +5 -0
  22. package/dist/icons/add_row.svg.js +5 -0
  23. package/dist/icons/admonition.svg.js +5 -0
  24. package/dist/icons/arrow_drop_down.svg.js +5 -0
  25. package/dist/icons/check.svg.js +5 -0
  26. package/dist/icons/check_small.svg.js +5 -0
  27. package/dist/icons/close.svg.js +5 -0
  28. package/dist/icons/code.svg.js +5 -0
  29. package/dist/icons/code_block.svg.js +5 -0
  30. package/dist/icons/content_copy.svg.js +5 -0
  31. package/dist/icons/delete_big.svg.js +5 -0
  32. package/dist/icons/delete_small.svg.js +5 -0
  33. package/dist/icons/difference.svg.js +5 -0
  34. package/dist/icons/edit.svg.js +5 -0
  35. package/dist/icons/format_align_center.svg.js +5 -0
  36. package/dist/icons/format_align_left.svg.js +5 -0
  37. package/dist/icons/format_align_right.svg.js +5 -0
  38. package/dist/icons/format_bold.svg.js +5 -0
  39. package/dist/icons/format_italic.svg.js +5 -0
  40. package/dist/icons/format_list_bulleted.svg.js +7 -0
  41. package/dist/icons/format_list_checked.svg.js +5 -0
  42. package/dist/icons/format_list_numbered.svg.js +5 -0
  43. package/dist/icons/format_underlined.svg.js +5 -0
  44. package/dist/icons/frontmatter.svg.js +5 -0
  45. package/dist/icons/horizontal_rule.svg.js +5 -0
  46. package/dist/icons/insert_col_left.svg.js +5 -0
  47. package/dist/icons/insert_col_right.svg.js +5 -0
  48. package/dist/icons/insert_row_above.svg.js +5 -0
  49. package/dist/icons/insert_row_below.svg.js +5 -0
  50. package/dist/icons/link.svg.js +5 -0
  51. package/dist/icons/link_off.svg.js +5 -0
  52. package/dist/icons/markdown.svg.js +5 -0
  53. package/dist/icons/more_horiz.svg.js +5 -0
  54. package/dist/icons/more_vert.svg.js +5 -0
  55. package/dist/icons/open_in_new.svg.js +5 -0
  56. package/dist/icons/redo.svg.js +5 -0
  57. package/dist/icons/rich_text.svg.js +5 -0
  58. package/dist/icons/sandpack.svg.js +5 -0
  59. package/dist/icons/settings.svg.js +7 -0
  60. package/dist/icons/table.svg.js +5 -0
  61. package/dist/icons/undo.svg.js +5 -0
  62. package/dist/importMarkdownToLexical.d.ts +91 -0
  63. package/dist/importMarkdownToLexical.js +69 -0
  64. package/dist/index.d.ts +54 -0
  65. package/dist/index.js +175 -0
  66. package/dist/jsx-editors/GenericJsxEditor.d.ts +8 -0
  67. package/dist/jsx-editors/GenericJsxEditor.js +56 -0
  68. package/dist/plugins/codeblock/CodeBlockNode.d.ts +100 -0
  69. package/dist/plugins/codeblock/CodeBlockNode.js +158 -0
  70. package/dist/plugins/codeblock/CodeBlockVisitor.d.ts +4 -0
  71. package/dist/plugins/codeblock/CodeBlockVisitor.js +14 -0
  72. package/dist/plugins/codeblock/MdastCodeVisitor.d.ts +3 -0
  73. package/dist/plugins/codeblock/MdastCodeVisitor.js +16 -0
  74. package/dist/plugins/codeblock/index.d.ts +697 -0
  75. package/dist/plugins/codeblock/index.js +73 -0
  76. package/dist/plugins/codemirror/CodeMirrorEditor.d.ts +3 -0
  77. package/dist/plugins/codemirror/CodeMirrorEditor.js +42 -0
  78. package/dist/plugins/codemirror/index.d.ts +912 -0
  79. package/dist/plugins/codemirror/index.js +62 -0
  80. package/dist/plugins/core/Icon.d.ts +6 -0
  81. package/dist/plugins/core/Icon.js +94 -0
  82. package/dist/plugins/core/LexicalLinebreakVisitor.d.ts +4 -0
  83. package/dist/plugins/core/LexicalLinebreakVisitor.js +10 -0
  84. package/dist/plugins/core/LexicalParagraphVisitor.d.ts +4 -0
  85. package/dist/plugins/core/LexicalParagraphVisitor.js +10 -0
  86. package/dist/plugins/core/LexicalRootVisitor.d.ts +4 -0
  87. package/dist/plugins/core/LexicalRootVisitor.js +10 -0
  88. package/dist/plugins/core/LexicalTextVisitor.d.ts +5 -0
  89. package/dist/plugins/core/LexicalTextVisitor.js +85 -0
  90. package/dist/plugins/core/MdastBreakVisitor.d.ts +3 -0
  91. package/dist/plugins/core/MdastBreakVisitor.js +10 -0
  92. package/dist/plugins/core/MdastFormattingVisitor.d.ts +4 -0
  93. package/dist/plugins/core/MdastFormattingVisitor.js +36 -0
  94. package/dist/plugins/core/MdastInlineCodeVisitor.d.ts +3 -0
  95. package/dist/plugins/core/MdastInlineCodeVisitor.js +27 -0
  96. package/dist/plugins/core/MdastParagraphVisitor.d.ts +3 -0
  97. package/dist/plugins/core/MdastParagraphVisitor.js +15 -0
  98. package/dist/plugins/core/MdastRootVisitor.d.ts +3 -0
  99. package/dist/plugins/core/MdastRootVisitor.js +9 -0
  100. package/dist/plugins/core/MdastTextVisitor.d.ts +3 -0
  101. package/dist/plugins/core/MdastTextVisitor.js +10 -0
  102. package/dist/plugins/core/NestedLexicalEditor.d.ts +92 -0
  103. package/dist/plugins/core/NestedLexicalEditor.js +180 -0
  104. package/dist/plugins/core/PropertyPopover.d.ts +23 -0
  105. package/dist/plugins/core/PropertyPopover.js +39 -0
  106. package/dist/plugins/core/SharedHistoryPlugin.d.ts +2 -0
  107. package/dist/plugins/core/SharedHistoryPlugin.js +10 -0
  108. package/dist/plugins/core/index.d.ts +506 -0
  109. package/dist/plugins/core/index.js +420 -0
  110. package/dist/plugins/core/ui/DownshiftAutoComplete.d.ts +15 -0
  111. package/dist/plugins/core/ui/DownshiftAutoComplete.js +83 -0
  112. package/dist/plugins/core/ui/PopoverUtils.d.ts +4 -0
  113. package/dist/plugins/core/ui/PopoverUtils.js +17 -0
  114. package/dist/plugins/diff-source/DiffSourceWrapper.d.ts +4 -0
  115. package/dist/plugins/diff-source/DiffSourceWrapper.js +11 -0
  116. package/dist/plugins/diff-source/DiffViewer.d.ts +2 -0
  117. package/dist/plugins/diff-source/DiffViewer.js +59 -0
  118. package/dist/plugins/diff-source/SourceEditor.d.ts +4 -0
  119. package/dist/plugins/diff-source/SourceEditor.js +47 -0
  120. package/dist/plugins/diff-source/index.d.ts +635 -0
  121. package/dist/plugins/diff-source/index.js +57 -0
  122. package/dist/plugins/directives/DirectiveNode.d.ts +51 -0
  123. package/dist/plugins/directives/DirectiveNode.js +92 -0
  124. package/dist/plugins/directives/DirectiveVisitor.d.ts +4 -0
  125. package/dist/plugins/directives/DirectiveVisitor.js +10 -0
  126. package/dist/plugins/directives/MdastDirectiveVisitor.d.ts +3 -0
  127. package/dist/plugins/directives/MdastDirectiveVisitor.js +13 -0
  128. package/dist/plugins/directives/index.d.ts +683 -0
  129. package/dist/plugins/directives/index.js +53 -0
  130. package/dist/plugins/frontmatter/FrontmatterEditor.d.ts +6 -0
  131. package/dist/plugins/frontmatter/FrontmatterEditor.js +85 -0
  132. package/dist/plugins/frontmatter/FrontmatterNode.d.ts +35 -0
  133. package/dist/plugins/frontmatter/FrontmatterNode.js +71 -0
  134. package/dist/plugins/frontmatter/LexicalFrontmatterVisitor.d.ts +4 -0
  135. package/dist/plugins/frontmatter/LexicalFrontmatterVisitor.js +10 -0
  136. package/dist/plugins/frontmatter/MdastFrontmatterVisitor.d.ts +3 -0
  137. package/dist/plugins/frontmatter/MdastFrontmatterVisitor.js +10 -0
  138. package/dist/plugins/frontmatter/index.d.ts +627 -0
  139. package/dist/plugins/frontmatter/index.js +76 -0
  140. package/dist/plugins/headings/LexicalHeadingVisitor.d.ts +4 -0
  141. package/dist/plugins/headings/LexicalHeadingVisitor.js +11 -0
  142. package/dist/plugins/headings/MdastHeadingVisitor.d.ts +3 -0
  143. package/dist/plugins/headings/MdastHeadingVisitor.js +10 -0
  144. package/dist/plugins/headings/index.d.ts +617 -0
  145. package/dist/plugins/headings/index.js +69 -0
  146. package/dist/plugins/image/ImageDialog.d.ts +2 -0
  147. package/dist/plugins/image/ImageDialog.js +70 -0
  148. package/dist/plugins/image/ImageEditor.d.ts +10 -0
  149. package/dist/plugins/image/ImageEditor.js +227 -0
  150. package/dist/plugins/image/ImageNode.d.ts +65 -0
  151. package/dist/plugins/image/ImageNode.js +152 -0
  152. package/dist/plugins/image/ImageResizer.d.ts +18 -0
  153. package/dist/plugins/image/ImageResizer.js +214 -0
  154. package/dist/plugins/image/LexicalImageVisitor.d.ts +4 -0
  155. package/dist/plugins/image/LexicalImageVisitor.js +35 -0
  156. package/dist/plugins/image/MdastImageVisitor.d.ts +6 -0
  157. package/dist/plugins/image/MdastImageVisitor.js +87 -0
  158. package/dist/plugins/image/index.d.ts +714 -0
  159. package/dist/plugins/image/index.js +300 -0
  160. package/dist/plugins/jsx/LexicalJsxNode.d.ts +54 -0
  161. package/dist/plugins/jsx/LexicalJsxNode.js +102 -0
  162. package/dist/plugins/jsx/LexicalJsxVisitor.d.ts +4 -0
  163. package/dist/plugins/jsx/LexicalJsxVisitor.js +12 -0
  164. package/dist/plugins/jsx/MdastMdxJsEsmVisitor.d.ts +3 -0
  165. package/dist/plugins/jsx/MdastMdxJsEsmVisitor.js +8 -0
  166. package/dist/plugins/jsx/MdastMdxJsxElementVisitor.d.ts +3 -0
  167. package/dist/plugins/jsx/MdastMdxJsxElementVisitor.js +12 -0
  168. package/dist/plugins/jsx/index.d.ts +688 -0
  169. package/dist/plugins/jsx/index.js +78 -0
  170. package/dist/plugins/link/AutoLinkPlugin.d.ts +9 -0
  171. package/dist/plugins/link/AutoLinkPlugin.js +18 -0
  172. package/dist/plugins/link/LexicalLinkVisitor.d.ts +4 -0
  173. package/dist/plugins/link/LexicalLinkVisitor.js +10 -0
  174. package/dist/plugins/link/MdastLinkVisitor.d.ts +3 -0
  175. package/dist/plugins/link/MdastLinkVisitor.js +14 -0
  176. package/dist/plugins/link/index.d.ts +92 -0
  177. package/dist/plugins/link/index.js +33 -0
  178. package/dist/plugins/link-dialog/LinkDialog.d.ts +16 -0
  179. package/dist/plugins/link-dialog/LinkDialog.js +148 -0
  180. package/dist/plugins/link-dialog/index.d.ts +595 -0
  181. package/dist/plugins/link-dialog/index.js +260 -0
  182. package/dist/plugins/lists/LexicalListItemVisitor.d.ts +4 -0
  183. package/dist/plugins/lists/LexicalListItemVisitor.js +23 -0
  184. package/dist/plugins/lists/LexicalListVisitor.d.ts +4 -0
  185. package/dist/plugins/lists/LexicalListVisitor.js +13 -0
  186. package/dist/plugins/lists/MdastListItemVisitor.d.ts +3 -0
  187. package/dist/plugins/lists/MdastListItemVisitor.js +10 -0
  188. package/dist/plugins/lists/MdastListVisitor.d.ts +3 -0
  189. package/dist/plugins/lists/MdastListVisitor.js +20 -0
  190. package/dist/plugins/lists/index.d.ts +613 -0
  191. package/dist/plugins/lists/index.js +119 -0
  192. package/dist/plugins/markdown-shortcut/index.d.ts +71 -0
  193. package/dist/plugins/markdown-shortcut/index.js +90 -0
  194. package/dist/plugins/quote/LexicalQuoteVisitor.d.ts +4 -0
  195. package/dist/plugins/quote/LexicalQuoteVisitor.js +12 -0
  196. package/dist/plugins/quote/MdastBlockQuoteVisitor.d.ts +3 -0
  197. package/dist/plugins/quote/MdastBlockQuoteVisitor.js +10 -0
  198. package/dist/plugins/quote/index.d.ts +417 -0
  199. package/dist/plugins/quote/index.js +26 -0
  200. package/dist/plugins/sandpack/SandpackEditor.d.ts +7 -0
  201. package/dist/plugins/sandpack/SandpackEditor.js +37 -0
  202. package/dist/plugins/sandpack/index.d.ts +951 -0
  203. package/dist/plugins/sandpack/index.js +93 -0
  204. package/dist/plugins/sandpack/useCodeMirrorRef.d.ts +4 -0
  205. package/dist/plugins/sandpack/useCodeMirrorRef.js +96 -0
  206. package/dist/plugins/table/LexicalTableVisitor.d.ts +4 -0
  207. package/dist/plugins/table/LexicalTableVisitor.js +10 -0
  208. package/dist/plugins/table/MdastTableVisitor.d.ts +3 -0
  209. package/dist/plugins/table/MdastTableVisitor.js +10 -0
  210. package/dist/plugins/table/TableEditor.d.ts +21 -0
  211. package/dist/plugins/table/TableEditor.js +388 -0
  212. package/dist/plugins/table/TableNode.d.ts +52 -0
  213. package/dist/plugins/table/TableNode.js +152 -0
  214. package/dist/plugins/table/index.d.ts +614 -0
  215. package/dist/plugins/table/index.js +69 -0
  216. package/dist/plugins/thematic-break/LexicalThematicBreakVisitor.d.ts +4 -0
  217. package/dist/plugins/thematic-break/LexicalThematicBreakVisitor.js +10 -0
  218. package/dist/plugins/thematic-break/MdastThematicBreakVisitor.d.ts +3 -0
  219. package/dist/plugins/thematic-break/MdastThematicBreakVisitor.js +10 -0
  220. package/dist/plugins/thematic-break/index.d.ts +603 -0
  221. package/dist/plugins/thematic-break/index.js +39 -0
  222. package/dist/plugins/toolbar/components/BlockTypeSelect.d.ts +6 -0
  223. package/dist/plugins/toolbar/components/BlockTypeSelect.js +54 -0
  224. package/dist/plugins/toolbar/components/BoldItalicUnderlineToggles.d.ts +5 -0
  225. package/dist/plugins/toolbar/components/BoldItalicUnderlineToggles.js +33 -0
  226. package/dist/plugins/toolbar/components/ChangeAdmonitionType.d.ts +6 -0
  227. package/dist/plugins/toolbar/components/ChangeAdmonitionType.js +30 -0
  228. package/dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.d.ts +7 -0
  229. package/dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.js +32 -0
  230. package/dist/plugins/toolbar/components/CodeToggle.d.ts +6 -0
  231. package/dist/plugins/toolbar/components/CodeToggle.js +19 -0
  232. package/dist/plugins/toolbar/components/CreateLink.d.ts +6 -0
  233. package/dist/plugins/toolbar/components/CreateLink.js +20 -0
  234. package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.d.ts +18 -0
  235. package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.js +25 -0
  236. package/dist/plugins/toolbar/components/InsertAdmonition.d.ts +6 -0
  237. package/dist/plugins/toolbar/components/InsertAdmonition.js +29 -0
  238. package/dist/plugins/toolbar/components/InsertCodeBlock.d.ts +7 -0
  239. package/dist/plugins/toolbar/components/InsertCodeBlock.js +20 -0
  240. package/dist/plugins/toolbar/components/InsertFrontmatter.d.ts +6 -0
  241. package/dist/plugins/toolbar/components/InsertFrontmatter.js +24 -0
  242. package/dist/plugins/toolbar/components/InsertImage.d.ts +6 -0
  243. package/dist/plugins/toolbar/components/InsertImage.js +14 -0
  244. package/dist/plugins/toolbar/components/InsertSandpack.d.ts +6 -0
  245. package/dist/plugins/toolbar/components/InsertSandpack.js +13 -0
  246. package/dist/plugins/toolbar/components/InsertTable.d.ts +6 -0
  247. package/dist/plugins/toolbar/components/InsertTable.js +20 -0
  248. package/dist/plugins/toolbar/components/InsertThematicBreak.d.ts +6 -0
  249. package/dist/plugins/toolbar/components/InsertThematicBreak.js +11 -0
  250. package/dist/plugins/toolbar/components/KitchenSinkToolbar.d.ts +7 -0
  251. package/dist/plugins/toolbar/components/KitchenSinkToolbar.js +58 -0
  252. package/dist/plugins/toolbar/components/ListsToggle.d.ts +7 -0
  253. package/dist/plugins/toolbar/components/ListsToggle.js +23 -0
  254. package/dist/plugins/toolbar/components/ShowSandpackInfo.d.ts +7 -0
  255. package/dist/plugins/toolbar/components/ShowSandpackInfo.js +31 -0
  256. package/dist/plugins/toolbar/components/UndoRedo.d.ts +5 -0
  257. package/dist/plugins/toolbar/components/UndoRedo.js +58 -0
  258. package/dist/plugins/toolbar/index.d.ts +492 -0
  259. package/dist/plugins/toolbar/index.js +40 -0
  260. package/dist/plugins/toolbar/primitives/DialogButton.d.ts +40 -0
  261. package/dist/plugins/toolbar/primitives/DialogButton.js +114 -0
  262. package/dist/plugins/toolbar/primitives/TooltipWrap.d.ts +8 -0
  263. package/dist/plugins/toolbar/primitives/TooltipWrap.js +12 -0
  264. package/dist/plugins/toolbar/primitives/select.d.ts +50 -0
  265. package/dist/plugins/toolbar/primitives/select.js +55 -0
  266. package/dist/plugins/toolbar/primitives/toolbar.d.ts +163 -0
  267. package/dist/plugins/toolbar/primitives/toolbar.js +115 -0
  268. package/dist/style.css +1715 -0
  269. package/dist/styles/globals.css.js +4 -0
  270. package/dist/styles/lexical-theme.module.css.js +62 -0
  271. package/dist/styles/lexicalTheme.d.ts +2 -0
  272. package/dist/styles/lexicalTheme.js +31 -0
  273. package/dist/styles/ui.module.css.js +308 -0
  274. package/dist/utils/detectMac.d.ts +3 -0
  275. package/dist/utils/detectMac.js +13 -0
  276. package/dist/utils/fp.d.ts +47 -0
  277. package/dist/utils/fp.js +14 -0
  278. package/dist/utils/isPartOftheEditorUI.d.ts +1 -0
  279. package/dist/utils/isPartOftheEditorUI.js +12 -0
  280. package/dist/utils/lexicalHelpers.d.ts +11 -0
  281. package/dist/utils/lexicalHelpers.js +62 -0
  282. package/dist/utils/uuid4.d.ts +1 -0
  283. package/dist/utils/uuid4.js +10 -0
  284. package/dist/utils/voidEmitter.d.ts +14 -0
  285. package/dist/utils/voidEmitter.js +15 -0
  286. package/package.json +435 -0
@@ -0,0 +1,58 @@
1
+ import { mergeRegister } from "@lexical/utils";
2
+ import { CAN_UNDO_COMMAND, COMMAND_PRIORITY_CRITICAL, CAN_REDO_COMMAND, UNDO_COMMAND, REDO_COMMAND } from "lexical";
3
+ import React__default from "react";
4
+ import { IS_APPLE } from "../../../utils/detectMac.js";
5
+ import { corePluginHooks } from "../../core/index.js";
6
+ import { MultipleChoiceToggleGroup } from "../primitives/toolbar.js";
7
+ const UndoRedo = () => {
8
+ const [iconComponentFor] = corePluginHooks.useEmitterValues("iconComponentFor");
9
+ const [activeEditor] = corePluginHooks.useEmitterValues("activeEditor");
10
+ const [canUndo, setCanUndo] = React__default.useState(false);
11
+ const [canRedo, setCanRedo] = React__default.useState(false);
12
+ React__default.useEffect(() => {
13
+ if (activeEditor) {
14
+ return mergeRegister(
15
+ activeEditor.registerCommand(
16
+ CAN_UNDO_COMMAND,
17
+ (payload) => {
18
+ setCanUndo(payload);
19
+ return false;
20
+ },
21
+ COMMAND_PRIORITY_CRITICAL
22
+ ),
23
+ activeEditor.registerCommand(
24
+ CAN_REDO_COMMAND,
25
+ (payload) => {
26
+ setCanRedo(payload);
27
+ return false;
28
+ },
29
+ COMMAND_PRIORITY_CRITICAL
30
+ )
31
+ );
32
+ }
33
+ }, [activeEditor]);
34
+ return /* @__PURE__ */ React__default.createElement(
35
+ MultipleChoiceToggleGroup,
36
+ {
37
+ items: [
38
+ {
39
+ title: IS_APPLE ? "Undo (⌘Z)" : "Undo (Ctrl+Z)",
40
+ disabled: !canUndo,
41
+ contents: iconComponentFor("undo"),
42
+ active: false,
43
+ onChange: () => activeEditor == null ? void 0 : activeEditor.dispatchCommand(UNDO_COMMAND, void 0)
44
+ },
45
+ {
46
+ title: IS_APPLE ? "Redo (⌘Y)" : "Redo (Ctrl+Y)",
47
+ disabled: !canRedo,
48
+ contents: iconComponentFor("redo"),
49
+ active: false,
50
+ onChange: () => activeEditor == null ? void 0 : activeEditor.dispatchCommand(REDO_COMMAND, void 0)
51
+ }
52
+ ]
53
+ }
54
+ );
55
+ };
56
+ export {
57
+ UndoRedo
58
+ };
@@ -0,0 +1,492 @@
1
+ import type { IconKey } from '../core/Icon';
2
+ import type { Options } from 'mdast-util-to-markdown';
3
+ import type { Config } from 'mdast-util-from-markdown/lib';
4
+ import type { Extension } from 'micromark-util-types';
5
+ import type { Content } from 'mdast';
6
+ import type { MdastImportVisitor, LexicalVisitor } from '../..';
7
+ import type { EditorSubscription, EditorInFocus, BlockType } from '../core';
8
+ import type { InitialEditorStateType } from '@lexical/react/LexicalComposer';
9
+ import type { JsxComponentDescriptor } from '../jsx';
10
+ import type { HistoryState } from '@lexical/history';
11
+ import type { LexicalEditor, RangeSelection, Klass, LexicalNode, TextFormatType, ElementNode, DecoratorNode } from 'lexical';
12
+ import type { SystemSpec, Realm, RealmNode, PluginConstructor, TypedRealm, ValueForKey, SystemKeys, ValuesForKeys, SystemDict } from '../../gurx';
13
+ import React from 'react';
14
+ /** @internal */
15
+ export declare const toolbarSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
16
+ activeEditor: RealmNode<LexicalEditor | null>;
17
+ inFocus: RealmNode<boolean>;
18
+ historyState: RealmNode<HistoryState>;
19
+ currentSelection: RealmNode<RangeSelection | null>;
20
+ jsxIsAvailable: RealmNode<boolean>;
21
+ jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
22
+ initialRootEditorState: RealmNode<InitialEditorStateType>;
23
+ rootEditor: RealmNode<LexicalEditor | null>;
24
+ createRootEditorSubscription: RealmNode<EditorSubscription>;
25
+ createActiveEditorSubscription: RealmNode<EditorSubscription>;
26
+ importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
27
+ syntaxExtensions: RealmNode<Extension[]>;
28
+ mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
29
+ usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
30
+ addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
31
+ addLexicalNode: RealmNode<Klass<LexicalNode>>;
32
+ addSyntaxExtension: RealmNode<Extension>;
33
+ addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
34
+ toMarkdownExtensions: RealmNode<Options[]>;
35
+ toMarkdownOptions: RealmNode<Options>;
36
+ addToMarkdownExtension: RealmNode<Options>;
37
+ addExportVisitor: RealmNode<LexicalVisitor>;
38
+ exportVisitors: RealmNode<LexicalVisitor[]>;
39
+ initialMarkdown: RealmNode<string>;
40
+ setMarkdown: RealmNode<string>;
41
+ markdown: RealmNode<string>;
42
+ editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
43
+ contentEditableClassName: RealmNode<string>;
44
+ placeholder: RealmNode<React.ReactNode>;
45
+ autoFocus: RealmNode<boolean | {
46
+ defaultSelection?: "rootStart" | "rootEnd" | undefined;
47
+ preventScroll?: boolean | undefined;
48
+ }>;
49
+ readOnly: RealmNode<boolean>;
50
+ composerChildren: RealmNode<React.ComponentType<{}>[]>;
51
+ addComposerChild: RealmNode<React.ComponentType<{}>>;
52
+ topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
53
+ addTopAreaChild: RealmNode<React.ComponentType<{}>>;
54
+ nestedEditorChildren: RealmNode<React.ComponentType<{}>[]>;
55
+ addNestedEditorChild: RealmNode<React.ComponentType<{}>>;
56
+ editorWrappers: RealmNode<React.ComponentType<{
57
+ children: React.ReactNode;
58
+ }>[]>;
59
+ addEditorWrapper: RealmNode<React.ComponentType<{
60
+ children: React.ReactNode;
61
+ }>>;
62
+ currentFormat: RealmNode<number>;
63
+ editorInFocus: RealmNode<EditorInFocus | null>;
64
+ applyFormat: RealmNode<TextFormatType>;
65
+ currentBlockType: RealmNode<BlockType>;
66
+ applyBlockType: RealmNode<BlockType>;
67
+ convertSelectionToNode: RealmNode<() => ElementNode>;
68
+ insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
69
+ onBlur: RealmNode<FocusEvent>;
70
+ iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
71
+ }>], (r: Realm) => {
72
+ toolbarContents: RealmNode<() => React.ReactNode>;
73
+ }>;
74
+ export declare const
75
+ /** @internal */
76
+ toolbarPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
77
+ activeEditor: RealmNode<LexicalEditor | null>;
78
+ inFocus: RealmNode<boolean>;
79
+ historyState: RealmNode<HistoryState>;
80
+ currentSelection: RealmNode<RangeSelection | null>;
81
+ jsxIsAvailable: RealmNode<boolean>;
82
+ jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
83
+ initialRootEditorState: RealmNode<InitialEditorStateType>;
84
+ rootEditor: RealmNode<LexicalEditor | null>;
85
+ createRootEditorSubscription: RealmNode<EditorSubscription>;
86
+ createActiveEditorSubscription: RealmNode<EditorSubscription>;
87
+ importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
88
+ syntaxExtensions: RealmNode<Extension[]>;
89
+ mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
90
+ usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
91
+ addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
92
+ addLexicalNode: RealmNode<Klass<LexicalNode>>;
93
+ addSyntaxExtension: RealmNode<Extension>;
94
+ addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
95
+ toMarkdownExtensions: RealmNode<Options[]>;
96
+ toMarkdownOptions: RealmNode<Options>;
97
+ addToMarkdownExtension: RealmNode<Options>;
98
+ addExportVisitor: RealmNode<LexicalVisitor>;
99
+ exportVisitors: RealmNode<LexicalVisitor[]>;
100
+ initialMarkdown: RealmNode<string>;
101
+ setMarkdown: RealmNode<string>;
102
+ markdown: RealmNode<string>;
103
+ editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
104
+ contentEditableClassName: RealmNode<string>;
105
+ placeholder: RealmNode<React.ReactNode>;
106
+ autoFocus: RealmNode<boolean | {
107
+ defaultSelection?: "rootStart" | "rootEnd" | undefined;
108
+ preventScroll?: boolean | undefined;
109
+ }>;
110
+ readOnly: RealmNode<boolean>;
111
+ composerChildren: RealmNode<React.ComponentType<{}>[]>;
112
+ addComposerChild: RealmNode<React.ComponentType<{}>>;
113
+ topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
114
+ addTopAreaChild: RealmNode<React.ComponentType<{}>>;
115
+ nestedEditorChildren: RealmNode<React.ComponentType<{}>[]>;
116
+ addNestedEditorChild: RealmNode<React.ComponentType<{}>>;
117
+ editorWrappers: RealmNode<React.ComponentType<{
118
+ children: React.ReactNode;
119
+ }>[]>;
120
+ addEditorWrapper: RealmNode<React.ComponentType<{
121
+ children: React.ReactNode;
122
+ }>>;
123
+ currentFormat: RealmNode<number>;
124
+ editorInFocus: RealmNode<EditorInFocus | null>;
125
+ applyFormat: RealmNode<TextFormatType>;
126
+ currentBlockType: RealmNode<BlockType>;
127
+ applyBlockType: RealmNode<BlockType>;
128
+ convertSelectionToNode: RealmNode<() => ElementNode>;
129
+ insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
130
+ onBlur: RealmNode<FocusEvent>;
131
+ iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
132
+ }>], (r: Realm) => {
133
+ toolbarContents: RealmNode<() => React.ReactNode>;
134
+ }>, {
135
+ toolbarContents: () => React.ReactNode;
136
+ }>,
137
+ /** @internal */
138
+ toolbarPluginHooks: {
139
+ useRealmContext: () => TypedRealm<{
140
+ toolbarContents: RealmNode<() => React.ReactNode>;
141
+ } & {
142
+ activeEditor: RealmNode<LexicalEditor | null>;
143
+ inFocus: RealmNode<boolean>;
144
+ historyState: RealmNode<HistoryState>;
145
+ currentSelection: RealmNode<RangeSelection | null>;
146
+ jsxIsAvailable: RealmNode<boolean>;
147
+ jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
148
+ initialRootEditorState: RealmNode<InitialEditorStateType>;
149
+ rootEditor: RealmNode<LexicalEditor | null>;
150
+ createRootEditorSubscription: RealmNode<EditorSubscription>;
151
+ createActiveEditorSubscription: RealmNode<EditorSubscription>;
152
+ importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
153
+ syntaxExtensions: RealmNode<Extension[]>;
154
+ mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
155
+ usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
156
+ addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
157
+ addLexicalNode: RealmNode<Klass<LexicalNode>>;
158
+ addSyntaxExtension: RealmNode<Extension>;
159
+ addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
160
+ toMarkdownExtensions: RealmNode<Options[]>;
161
+ toMarkdownOptions: RealmNode<Options>;
162
+ addToMarkdownExtension: RealmNode<Options>;
163
+ addExportVisitor: RealmNode<LexicalVisitor>;
164
+ exportVisitors: RealmNode<LexicalVisitor[]>;
165
+ initialMarkdown: RealmNode<string>;
166
+ setMarkdown: RealmNode<string>;
167
+ markdown: RealmNode<string>;
168
+ editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
169
+ contentEditableClassName: RealmNode<string>;
170
+ placeholder: RealmNode<React.ReactNode>;
171
+ autoFocus: RealmNode<boolean | {
172
+ defaultSelection?: "rootStart" | "rootEnd" | undefined;
173
+ preventScroll?: boolean | undefined;
174
+ }>;
175
+ readOnly: RealmNode<boolean>;
176
+ composerChildren: RealmNode<React.ComponentType<{}>[]>;
177
+ addComposerChild: RealmNode<React.ComponentType<{}>>;
178
+ topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
179
+ addTopAreaChild: RealmNode<React.ComponentType<{}>>;
180
+ nestedEditorChildren: RealmNode<React.ComponentType<{}>[]>;
181
+ addNestedEditorChild: RealmNode<React.ComponentType<{}>>;
182
+ editorWrappers: RealmNode<React.ComponentType<{
183
+ children: React.ReactNode;
184
+ }>[]>;
185
+ addEditorWrapper: RealmNode<React.ComponentType<{
186
+ children: React.ReactNode;
187
+ }>>;
188
+ currentFormat: RealmNode<number>;
189
+ editorInFocus: RealmNode<EditorInFocus | null>;
190
+ applyFormat: RealmNode<TextFormatType>;
191
+ currentBlockType: RealmNode<BlockType>;
192
+ applyBlockType: RealmNode<BlockType>;
193
+ convertSelectionToNode: RealmNode<() => ElementNode>;
194
+ insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
195
+ onBlur: RealmNode<FocusEvent>;
196
+ iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
197
+ }>;
198
+ useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "toolbarContents">(key: K, callback: (value: ValueForKey<{
199
+ toolbarContents: RealmNode<() => React.ReactNode>;
200
+ } & {
201
+ activeEditor: RealmNode<LexicalEditor | null>;
202
+ inFocus: RealmNode<boolean>;
203
+ historyState: RealmNode<HistoryState>;
204
+ currentSelection: RealmNode<RangeSelection | null>;
205
+ jsxIsAvailable: RealmNode<boolean>;
206
+ jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
207
+ initialRootEditorState: RealmNode<InitialEditorStateType>;
208
+ rootEditor: RealmNode<LexicalEditor | null>;
209
+ createRootEditorSubscription: RealmNode<EditorSubscription>;
210
+ createActiveEditorSubscription: RealmNode<EditorSubscription>;
211
+ importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
212
+ syntaxExtensions: RealmNode<Extension[]>;
213
+ mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
214
+ usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
215
+ addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
216
+ addLexicalNode: RealmNode<Klass<LexicalNode>>;
217
+ addSyntaxExtension: RealmNode<Extension>;
218
+ addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
219
+ toMarkdownExtensions: RealmNode<Options[]>;
220
+ toMarkdownOptions: RealmNode<Options>;
221
+ addToMarkdownExtension: RealmNode<Options>;
222
+ addExportVisitor: RealmNode<LexicalVisitor>;
223
+ exportVisitors: RealmNode<LexicalVisitor[]>;
224
+ initialMarkdown: RealmNode<string>;
225
+ setMarkdown: RealmNode<string>;
226
+ markdown: RealmNode<string>;
227
+ editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
228
+ contentEditableClassName: RealmNode<string>;
229
+ placeholder: RealmNode<React.ReactNode>;
230
+ autoFocus: RealmNode<boolean | {
231
+ defaultSelection?: "rootStart" | "rootEnd" | undefined;
232
+ preventScroll?: boolean | undefined;
233
+ }>;
234
+ readOnly: RealmNode<boolean>;
235
+ composerChildren: RealmNode<React.ComponentType<{}>[]>;
236
+ addComposerChild: RealmNode<React.ComponentType<{}>>;
237
+ topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
238
+ addTopAreaChild: RealmNode<React.ComponentType<{}>>;
239
+ nestedEditorChildren: RealmNode<React.ComponentType<{}>[]>;
240
+ addNestedEditorChild: RealmNode<React.ComponentType<{}>>;
241
+ editorWrappers: RealmNode<React.ComponentType<{
242
+ children: React.ReactNode;
243
+ }>[]>;
244
+ addEditorWrapper: RealmNode<React.ComponentType<{
245
+ children: React.ReactNode;
246
+ }>>;
247
+ currentFormat: RealmNode<number>;
248
+ editorInFocus: RealmNode<EditorInFocus | null>;
249
+ applyFormat: RealmNode<TextFormatType>;
250
+ currentBlockType: RealmNode<BlockType>;
251
+ applyBlockType: RealmNode<BlockType>;
252
+ convertSelectionToNode: RealmNode<() => ElementNode>;
253
+ insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
254
+ onBlur: RealmNode<FocusEvent>;
255
+ iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
256
+ }, K>) => void) => void;
257
+ useEmitterValues: <K_1 extends SystemKeys<{
258
+ toolbarContents: RealmNode<() => React.ReactNode>;
259
+ } & {
260
+ activeEditor: RealmNode<LexicalEditor | null>;
261
+ inFocus: RealmNode<boolean>;
262
+ historyState: RealmNode<HistoryState>;
263
+ currentSelection: RealmNode<RangeSelection | null>;
264
+ jsxIsAvailable: RealmNode<boolean>;
265
+ jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
266
+ initialRootEditorState: RealmNode<InitialEditorStateType>;
267
+ rootEditor: RealmNode<LexicalEditor | null>;
268
+ createRootEditorSubscription: RealmNode<EditorSubscription>;
269
+ createActiveEditorSubscription: RealmNode<EditorSubscription>;
270
+ importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
271
+ syntaxExtensions: RealmNode<Extension[]>;
272
+ mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
273
+ usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
274
+ addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
275
+ addLexicalNode: RealmNode<Klass<LexicalNode>>;
276
+ addSyntaxExtension: RealmNode<Extension>;
277
+ addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
278
+ toMarkdownExtensions: RealmNode<Options[]>;
279
+ toMarkdownOptions: RealmNode<Options>;
280
+ addToMarkdownExtension: RealmNode<Options>;
281
+ addExportVisitor: RealmNode<LexicalVisitor>;
282
+ exportVisitors: RealmNode<LexicalVisitor[]>;
283
+ initialMarkdown: RealmNode<string>;
284
+ setMarkdown: RealmNode<string>;
285
+ markdown: RealmNode<string>;
286
+ editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
287
+ contentEditableClassName: RealmNode<string>;
288
+ placeholder: RealmNode<React.ReactNode>;
289
+ autoFocus: RealmNode<boolean | {
290
+ defaultSelection?: "rootStart" | "rootEnd" | undefined;
291
+ preventScroll?: boolean | undefined;
292
+ }>;
293
+ readOnly: RealmNode<boolean>;
294
+ composerChildren: RealmNode<React.ComponentType<{}>[]>;
295
+ addComposerChild: RealmNode<React.ComponentType<{}>>;
296
+ topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
297
+ addTopAreaChild: RealmNode<React.ComponentType<{}>>;
298
+ nestedEditorChildren: RealmNode<React.ComponentType<{}>[]>;
299
+ addNestedEditorChild: RealmNode<React.ComponentType<{}>>;
300
+ editorWrappers: RealmNode<React.ComponentType<{
301
+ children: React.ReactNode;
302
+ }>[]>;
303
+ addEditorWrapper: RealmNode<React.ComponentType<{
304
+ children: React.ReactNode;
305
+ }>>;
306
+ currentFormat: RealmNode<number>;
307
+ editorInFocus: RealmNode<EditorInFocus | null>;
308
+ applyFormat: RealmNode<TextFormatType>;
309
+ currentBlockType: RealmNode<BlockType>;
310
+ applyBlockType: RealmNode<BlockType>;
311
+ convertSelectionToNode: RealmNode<() => ElementNode>;
312
+ insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
313
+ onBlur: RealmNode<FocusEvent>;
314
+ iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
315
+ }>>(...keys: K_1) => ValuesForKeys<{
316
+ toolbarContents: RealmNode<() => React.ReactNode>;
317
+ } & {
318
+ activeEditor: RealmNode<LexicalEditor | null>;
319
+ inFocus: RealmNode<boolean>;
320
+ historyState: RealmNode<HistoryState>;
321
+ currentSelection: RealmNode<RangeSelection | null>;
322
+ jsxIsAvailable: RealmNode<boolean>;
323
+ jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
324
+ initialRootEditorState: RealmNode<InitialEditorStateType>;
325
+ rootEditor: RealmNode<LexicalEditor | null>;
326
+ createRootEditorSubscription: RealmNode<EditorSubscription>;
327
+ createActiveEditorSubscription: RealmNode<EditorSubscription>;
328
+ importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
329
+ syntaxExtensions: RealmNode<Extension[]>;
330
+ mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
331
+ usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
332
+ addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
333
+ addLexicalNode: RealmNode<Klass<LexicalNode>>;
334
+ addSyntaxExtension: RealmNode<Extension>;
335
+ addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
336
+ toMarkdownExtensions: RealmNode<Options[]>;
337
+ toMarkdownOptions: RealmNode<Options>;
338
+ addToMarkdownExtension: RealmNode<Options>;
339
+ addExportVisitor: RealmNode<LexicalVisitor>;
340
+ exportVisitors: RealmNode<LexicalVisitor[]>;
341
+ initialMarkdown: RealmNode<string>;
342
+ setMarkdown: RealmNode<string>;
343
+ markdown: RealmNode<string>;
344
+ editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
345
+ contentEditableClassName: RealmNode<string>;
346
+ placeholder: RealmNode<React.ReactNode>;
347
+ autoFocus: RealmNode<boolean | {
348
+ defaultSelection?: "rootStart" | "rootEnd" | undefined;
349
+ preventScroll?: boolean | undefined;
350
+ }>;
351
+ readOnly: RealmNode<boolean>;
352
+ composerChildren: RealmNode<React.ComponentType<{}>[]>;
353
+ addComposerChild: RealmNode<React.ComponentType<{}>>;
354
+ topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
355
+ addTopAreaChild: RealmNode<React.ComponentType<{}>>;
356
+ nestedEditorChildren: RealmNode<React.ComponentType<{}>[]>;
357
+ addNestedEditorChild: RealmNode<React.ComponentType<{}>>;
358
+ editorWrappers: RealmNode<React.ComponentType<{
359
+ children: React.ReactNode;
360
+ }>[]>;
361
+ addEditorWrapper: RealmNode<React.ComponentType<{
362
+ children: React.ReactNode;
363
+ }>>;
364
+ currentFormat: RealmNode<number>;
365
+ editorInFocus: RealmNode<EditorInFocus | null>;
366
+ applyFormat: RealmNode<TextFormatType>;
367
+ currentBlockType: RealmNode<BlockType>;
368
+ applyBlockType: RealmNode<BlockType>;
369
+ convertSelectionToNode: RealmNode<() => ElementNode>;
370
+ insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
371
+ onBlur: RealmNode<FocusEvent>;
372
+ iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
373
+ }, K_1>;
374
+ usePubKeys: () => (values: SystemDict<{
375
+ toolbarContents: RealmNode<() => React.ReactNode>;
376
+ } & {
377
+ activeEditor: RealmNode<LexicalEditor | null>;
378
+ inFocus: RealmNode<boolean>;
379
+ historyState: RealmNode<HistoryState>;
380
+ currentSelection: RealmNode<RangeSelection | null>;
381
+ jsxIsAvailable: RealmNode<boolean>;
382
+ jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
383
+ initialRootEditorState: RealmNode<InitialEditorStateType>;
384
+ rootEditor: RealmNode<LexicalEditor | null>;
385
+ createRootEditorSubscription: RealmNode<EditorSubscription>;
386
+ createActiveEditorSubscription: RealmNode<EditorSubscription>;
387
+ importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
388
+ syntaxExtensions: RealmNode<Extension[]>;
389
+ mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
390
+ usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
391
+ addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
392
+ addLexicalNode: RealmNode<Klass<LexicalNode>>;
393
+ addSyntaxExtension: RealmNode<Extension>;
394
+ addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
395
+ toMarkdownExtensions: RealmNode<Options[]>;
396
+ toMarkdownOptions: RealmNode<Options>;
397
+ addToMarkdownExtension: RealmNode<Options>;
398
+ addExportVisitor: RealmNode<LexicalVisitor>;
399
+ exportVisitors: RealmNode<LexicalVisitor[]>;
400
+ initialMarkdown: RealmNode<string>;
401
+ setMarkdown: RealmNode<string>;
402
+ markdown: RealmNode<string>;
403
+ editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
404
+ contentEditableClassName: RealmNode<string>;
405
+ placeholder: RealmNode<React.ReactNode>;
406
+ autoFocus: RealmNode<boolean | {
407
+ defaultSelection?: "rootStart" | "rootEnd" | undefined;
408
+ preventScroll?: boolean | undefined;
409
+ }>;
410
+ readOnly: RealmNode<boolean>;
411
+ composerChildren: RealmNode<React.ComponentType<{}>[]>;
412
+ addComposerChild: RealmNode<React.ComponentType<{}>>;
413
+ topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
414
+ addTopAreaChild: RealmNode<React.ComponentType<{}>>;
415
+ nestedEditorChildren: RealmNode<React.ComponentType<{}>[]>;
416
+ addNestedEditorChild: RealmNode<React.ComponentType<{}>>;
417
+ editorWrappers: RealmNode<React.ComponentType<{
418
+ children: React.ReactNode;
419
+ }>[]>;
420
+ addEditorWrapper: RealmNode<React.ComponentType<{
421
+ children: React.ReactNode;
422
+ }>>;
423
+ currentFormat: RealmNode<number>;
424
+ editorInFocus: RealmNode<EditorInFocus | null>;
425
+ applyFormat: RealmNode<TextFormatType>;
426
+ currentBlockType: RealmNode<BlockType>;
427
+ applyBlockType: RealmNode<BlockType>;
428
+ convertSelectionToNode: RealmNode<() => ElementNode>;
429
+ insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
430
+ onBlur: RealmNode<FocusEvent>;
431
+ iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
432
+ }>) => void;
433
+ usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "toolbarContents">(key: K_2) => (value: ValueForKey<{
434
+ toolbarContents: RealmNode<() => React.ReactNode>;
435
+ } & {
436
+ activeEditor: RealmNode<LexicalEditor | null>;
437
+ inFocus: RealmNode<boolean>;
438
+ historyState: RealmNode<HistoryState>;
439
+ currentSelection: RealmNode<RangeSelection | null>;
440
+ jsxIsAvailable: RealmNode<boolean>;
441
+ jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
442
+ initialRootEditorState: RealmNode<InitialEditorStateType>;
443
+ rootEditor: RealmNode<LexicalEditor | null>;
444
+ createRootEditorSubscription: RealmNode<EditorSubscription>;
445
+ createActiveEditorSubscription: RealmNode<EditorSubscription>;
446
+ importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
447
+ syntaxExtensions: RealmNode<Extension[]>;
448
+ mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
449
+ usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
450
+ addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
451
+ addLexicalNode: RealmNode<Klass<LexicalNode>>;
452
+ addSyntaxExtension: RealmNode<Extension>;
453
+ addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
454
+ toMarkdownExtensions: RealmNode<Options[]>;
455
+ toMarkdownOptions: RealmNode<Options>;
456
+ addToMarkdownExtension: RealmNode<Options>;
457
+ addExportVisitor: RealmNode<LexicalVisitor>;
458
+ exportVisitors: RealmNode<LexicalVisitor[]>;
459
+ initialMarkdown: RealmNode<string>;
460
+ setMarkdown: RealmNode<string>;
461
+ markdown: RealmNode<string>;
462
+ editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
463
+ contentEditableClassName: RealmNode<string>;
464
+ placeholder: RealmNode<React.ReactNode>;
465
+ autoFocus: RealmNode<boolean | {
466
+ defaultSelection?: "rootStart" | "rootEnd" | undefined;
467
+ preventScroll?: boolean | undefined;
468
+ }>;
469
+ readOnly: RealmNode<boolean>;
470
+ composerChildren: RealmNode<React.ComponentType<{}>[]>;
471
+ addComposerChild: RealmNode<React.ComponentType<{}>>;
472
+ topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
473
+ addTopAreaChild: RealmNode<React.ComponentType<{}>>;
474
+ nestedEditorChildren: RealmNode<React.ComponentType<{}>[]>;
475
+ addNestedEditorChild: RealmNode<React.ComponentType<{}>>;
476
+ editorWrappers: RealmNode<React.ComponentType<{
477
+ children: React.ReactNode;
478
+ }>[]>;
479
+ addEditorWrapper: RealmNode<React.ComponentType<{
480
+ children: React.ReactNode;
481
+ }>>;
482
+ currentFormat: RealmNode<number>;
483
+ editorInFocus: RealmNode<EditorInFocus | null>;
484
+ applyFormat: RealmNode<TextFormatType>;
485
+ currentBlockType: RealmNode<BlockType>;
486
+ applyBlockType: RealmNode<BlockType>;
487
+ convertSelectionToNode: RealmNode<() => ElementNode>;
488
+ insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
489
+ onBlur: RealmNode<FocusEvent>;
490
+ iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
491
+ }, K_2>) => void;
492
+ };
@@ -0,0 +1,40 @@
1
+ import React__default from "react";
2
+ import { coreSystem, corePluginHooks } from "../core/index.js";
3
+ import { Root } from "./primitives/toolbar.js";
4
+ import { system } from "../../gurx/realmFactory.js";
5
+ import { realmPlugin } from "../../gurx/react.js";
6
+ const toolbarSystem = system(
7
+ (r) => {
8
+ const toolbarContents = r.node(() => null);
9
+ return {
10
+ toolbarContents
11
+ };
12
+ },
13
+ [coreSystem]
14
+ );
15
+ const DEFAULT_TOOLBAR_CONTENTS = () => {
16
+ return "This is an empty toolbar. Pass `{toolbarContents: () => { return <>toolbar components</> }}` to the toolbarPlugin to customize it.";
17
+ };
18
+ const [
19
+ /** @internal */
20
+ toolbarPlugin,
21
+ /** @internal */
22
+ toolbarPluginHooks
23
+ ] = realmPlugin({
24
+ id: "toolbar",
25
+ systemSpec: toolbarSystem,
26
+ init: (realm, params) => {
27
+ realm.pubKey("toolbarContents", (params == null ? void 0 : params.toolbarContents) ?? DEFAULT_TOOLBAR_CONTENTS);
28
+ realm.pubKey("addTopAreaChild", ToolbarWrapper);
29
+ }
30
+ });
31
+ const ToolbarWrapper = () => {
32
+ const [toolbarContents] = toolbarPluginHooks.useEmitterValues("toolbarContents");
33
+ const [readOnly] = corePluginHooks.useEmitterValues("readOnly");
34
+ return /* @__PURE__ */ React__default.createElement(Root, { readOnly }, toolbarContents());
35
+ };
36
+ export {
37
+ toolbarPlugin,
38
+ toolbarPluginHooks,
39
+ toolbarSystem
40
+ };
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ /**
3
+ * The properties of the {@link DialogButton} component.
4
+ */
5
+ export interface DialogButtonProps {
6
+ /**
7
+ * The autocomplete suggestions to show in the dialog input.
8
+ */
9
+ autocompleteSuggestions?: string[];
10
+ /**
11
+ * The callback to call when the dialog is submitted. The callback receives the value of the text input as a parameter.
12
+ */
13
+ onSubmit: (value: string) => void;
14
+ /**
15
+ * The title to show in the tooltip of the toolbar button.
16
+ */
17
+ tooltipTitle: string;
18
+ /**
19
+ * The contents of the button. Usually an icon.
20
+ * @example
21
+ * ```tsx
22
+ * <DialogButton buttonContent={<CustomIcon />} />
23
+ * ```
24
+ */
25
+ buttonContent?: React.ReactNode;
26
+ /**
27
+ * The placeholder text to show in the dialog input.
28
+ */
29
+ dialogInputPlaceholder: string;
30
+ /**
31
+ * The title of the submit button.
32
+ */
33
+ submitButtonTitle: string;
34
+ }
35
+ /**
36
+ * Use this primitive to create a toolbar button that opens a dialog with a text input, autocomplete suggestions, and a submit button.
37
+ *
38
+ * See {@link DialogButtonProps} for the properties that can be passed to this component.
39
+ */
40
+ export declare const DialogButton: React.ForwardRefExoticComponent<DialogButtonProps & React.RefAttributes<HTMLButtonElement>>;