@mdxeditor/editor 0.0.1 → 0.0.5-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 (302) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +15 -75
  3. package/dist/FormatConstants.d.ts +9 -0
  4. package/dist/FormatConstants.js +10 -0
  5. package/dist/MDXEditor.d.ts +103 -0
  6. package/dist/MDXEditor.js +144 -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 +138 -0
  12. package/dist/exportMarkdownFromLexical.js +239 -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/content_copy.svg.js +5 -0
  30. package/dist/icons/delete_big.svg.js +5 -0
  31. package/dist/icons/delete_small.svg.js +5 -0
  32. package/dist/icons/difference.svg.js +5 -0
  33. package/dist/icons/edit.svg.js +5 -0
  34. package/dist/icons/extension.svg.js +7 -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 +5 -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/frame_source.svg.js +5 -0
  45. package/dist/icons/frontmatter.svg.js +5 -0
  46. package/dist/icons/horizontal_rule.svg.js +5 -0
  47. package/dist/icons/insert_col_left.svg.js +5 -0
  48. package/dist/icons/insert_col_right.svg.js +5 -0
  49. package/dist/icons/insert_row_above.svg.js +5 -0
  50. package/dist/icons/insert_row_below.svg.js +5 -0
  51. package/dist/icons/link.svg.js +5 -0
  52. package/dist/icons/link_off.svg.js +5 -0
  53. package/dist/icons/markdown.svg.js +5 -0
  54. package/dist/icons/more_horiz.svg.js +5 -0
  55. package/dist/icons/more_vert.svg.js +5 -0
  56. package/dist/icons/open_in_new.svg.js +5 -0
  57. package/dist/icons/redo.svg.js +5 -0
  58. package/dist/icons/rich_text.svg.js +5 -0
  59. package/dist/icons/sandpack.svg.js +5 -0
  60. package/dist/icons/settings.svg.js +5 -0
  61. package/dist/icons/table.svg.js +5 -0
  62. package/dist/icons/undo.svg.js +5 -0
  63. package/dist/importMarkdownToLexical.d.ts +101 -0
  64. package/dist/importMarkdownToLexical.js +93 -0
  65. package/dist/index.d.ts +62 -726
  66. package/dist/index.js +207 -4501
  67. package/dist/jsx-editors/GenericJsxEditor.d.ts +8 -0
  68. package/dist/jsx-editors/GenericJsxEditor.js +56 -0
  69. package/dist/plugins/codeblock/CodeBlockNode.d.ts +100 -0
  70. package/dist/plugins/codeblock/CodeBlockNode.js +158 -0
  71. package/dist/plugins/codeblock/CodeBlockVisitor.d.ts +4 -0
  72. package/dist/plugins/codeblock/CodeBlockVisitor.js +14 -0
  73. package/dist/plugins/codeblock/MdastCodeVisitor.d.ts +3 -0
  74. package/dist/plugins/codeblock/MdastCodeVisitor.js +16 -0
  75. package/dist/plugins/codeblock/index.d.ts +787 -0
  76. package/dist/plugins/codeblock/index.js +73 -0
  77. package/dist/plugins/codemirror/CodeMirrorEditor.d.ts +3 -0
  78. package/dist/plugins/codemirror/CodeMirrorEditor.js +42 -0
  79. package/dist/plugins/codemirror/index.d.ts +1038 -0
  80. package/dist/plugins/codemirror/index.js +62 -0
  81. package/dist/plugins/core/GenericHTMLNode.d.ts +38 -0
  82. package/dist/plugins/core/GenericHTMLNode.js +117 -0
  83. package/dist/plugins/core/Icon.d.ts +6 -0
  84. package/dist/plugins/core/Icon.js +96 -0
  85. package/dist/plugins/core/LexicalGenericHTMLNodeVisitor.d.ts +4 -0
  86. package/dist/plugins/core/LexicalGenericHTMLNodeVisitor.js +15 -0
  87. package/dist/plugins/core/LexicalLinebreakVisitor.d.ts +4 -0
  88. package/dist/plugins/core/LexicalLinebreakVisitor.js +10 -0
  89. package/dist/plugins/core/LexicalParagraphVisitor.d.ts +4 -0
  90. package/dist/plugins/core/LexicalParagraphVisitor.js +10 -0
  91. package/dist/plugins/core/LexicalRootVisitor.d.ts +4 -0
  92. package/dist/plugins/core/LexicalRootVisitor.js +10 -0
  93. package/dist/plugins/core/LexicalTextVisitor.d.ts +5 -0
  94. package/dist/plugins/core/LexicalTextVisitor.js +102 -0
  95. package/dist/plugins/core/MdastBreakVisitor.d.ts +3 -0
  96. package/dist/plugins/core/MdastBreakVisitor.js +10 -0
  97. package/dist/plugins/core/MdastFormattingVisitor.d.ts +4 -0
  98. package/dist/plugins/core/MdastFormattingVisitor.js +36 -0
  99. package/dist/plugins/core/MdastHTMLNode.d.ts +13 -0
  100. package/dist/plugins/core/MdastHTMLNode.js +122 -0
  101. package/dist/plugins/core/MdastHTMLVisitor.d.ts +3 -0
  102. package/dist/plugins/core/MdastHTMLVisitor.js +12 -0
  103. package/dist/plugins/core/MdastInlineCodeVisitor.d.ts +3 -0
  104. package/dist/plugins/core/MdastInlineCodeVisitor.js +27 -0
  105. package/dist/plugins/core/MdastParagraphVisitor.d.ts +3 -0
  106. package/dist/plugins/core/MdastParagraphVisitor.js +15 -0
  107. package/dist/plugins/core/MdastRootVisitor.d.ts +3 -0
  108. package/dist/plugins/core/MdastRootVisitor.js +9 -0
  109. package/dist/plugins/core/MdastTextVisitor.d.ts +3 -0
  110. package/dist/plugins/core/MdastTextVisitor.js +10 -0
  111. package/dist/plugins/core/NestedLexicalEditor.d.ts +92 -0
  112. package/dist/plugins/core/NestedLexicalEditor.js +185 -0
  113. package/dist/plugins/core/PropertyPopover.d.ts +23 -0
  114. package/dist/plugins/core/PropertyPopover.js +39 -0
  115. package/dist/plugins/core/SharedHistoryPlugin.d.ts +2 -0
  116. package/dist/plugins/core/SharedHistoryPlugin.js +10 -0
  117. package/dist/plugins/core/index.d.ts +583 -0
  118. package/dist/plugins/core/index.js +490 -0
  119. package/dist/plugins/core/ui/DownshiftAutoComplete.d.ts +15 -0
  120. package/dist/plugins/core/ui/DownshiftAutoComplete.js +83 -0
  121. package/dist/plugins/core/ui/PopoverUtils.d.ts +4 -0
  122. package/dist/plugins/core/ui/PopoverUtils.js +17 -0
  123. package/dist/plugins/diff-source/DiffSourceWrapper.d.ts +4 -0
  124. package/dist/plugins/diff-source/DiffSourceWrapper.js +14 -0
  125. package/dist/plugins/diff-source/DiffViewer.d.ts +2 -0
  126. package/dist/plugins/diff-source/DiffViewer.js +59 -0
  127. package/dist/plugins/diff-source/SourceEditor.d.ts +4 -0
  128. package/dist/plugins/diff-source/SourceEditor.js +53 -0
  129. package/dist/plugins/diff-source/index.d.ts +725 -0
  130. package/dist/plugins/diff-source/index.js +56 -0
  131. package/dist/plugins/directives/DirectiveNode.d.ts +51 -0
  132. package/dist/plugins/directives/DirectiveNode.js +92 -0
  133. package/dist/plugins/directives/DirectiveVisitor.d.ts +4 -0
  134. package/dist/plugins/directives/DirectiveVisitor.js +10 -0
  135. package/dist/plugins/directives/MdastDirectiveVisitor.d.ts +3 -0
  136. package/dist/plugins/directives/MdastDirectiveVisitor.js +13 -0
  137. package/dist/plugins/directives/index.d.ts +773 -0
  138. package/dist/plugins/directives/index.js +53 -0
  139. package/dist/plugins/frontmatter/FrontmatterEditor.d.ts +6 -0
  140. package/dist/plugins/frontmatter/FrontmatterEditor.js +85 -0
  141. package/dist/plugins/frontmatter/FrontmatterNode.d.ts +35 -0
  142. package/dist/plugins/frontmatter/FrontmatterNode.js +71 -0
  143. package/dist/plugins/frontmatter/LexicalFrontmatterVisitor.d.ts +4 -0
  144. package/dist/plugins/frontmatter/LexicalFrontmatterVisitor.js +10 -0
  145. package/dist/plugins/frontmatter/MdastFrontmatterVisitor.d.ts +3 -0
  146. package/dist/plugins/frontmatter/MdastFrontmatterVisitor.js +10 -0
  147. package/dist/plugins/frontmatter/index.d.ts +717 -0
  148. package/dist/plugins/frontmatter/index.js +76 -0
  149. package/dist/plugins/headings/LexicalHeadingVisitor.d.ts +4 -0
  150. package/dist/plugins/headings/LexicalHeadingVisitor.js +11 -0
  151. package/dist/plugins/headings/MdastHeadingVisitor.d.ts +3 -0
  152. package/dist/plugins/headings/MdastHeadingVisitor.js +10 -0
  153. package/dist/plugins/headings/index.d.ts +707 -0
  154. package/dist/plugins/headings/index.js +69 -0
  155. package/dist/plugins/image/ImageDialog.d.ts +2 -0
  156. package/dist/plugins/image/ImageDialog.js +70 -0
  157. package/dist/plugins/image/ImageEditor.d.ts +10 -0
  158. package/dist/plugins/image/ImageEditor.js +227 -0
  159. package/dist/plugins/image/ImageNode.d.ts +65 -0
  160. package/dist/plugins/image/ImageNode.js +152 -0
  161. package/dist/plugins/image/ImageResizer.d.ts +18 -0
  162. package/dist/plugins/image/ImageResizer.js +214 -0
  163. package/dist/plugins/image/LexicalImageVisitor.d.ts +4 -0
  164. package/dist/plugins/image/LexicalImageVisitor.js +35 -0
  165. package/dist/plugins/image/MdastImageVisitor.d.ts +6 -0
  166. package/dist/plugins/image/MdastImageVisitor.js +87 -0
  167. package/dist/plugins/image/index.d.ts +804 -0
  168. package/dist/plugins/image/index.js +300 -0
  169. package/dist/plugins/jsx/LexicalJsxNode.d.ts +54 -0
  170. package/dist/plugins/jsx/LexicalJsxNode.js +102 -0
  171. package/dist/plugins/jsx/LexicalJsxVisitor.d.ts +4 -0
  172. package/dist/plugins/jsx/LexicalJsxVisitor.js +24 -0
  173. package/dist/plugins/jsx/MdastMdxJsEsmVisitor.d.ts +3 -0
  174. package/dist/plugins/jsx/MdastMdxJsEsmVisitor.js +8 -0
  175. package/dist/plugins/jsx/MdastMdxJsxElementVisitor.d.ts +3 -0
  176. package/dist/plugins/jsx/MdastMdxJsxElementVisitor.js +12 -0
  177. package/dist/plugins/jsx/index.d.ts +779 -0
  178. package/dist/plugins/jsx/index.js +82 -0
  179. package/dist/plugins/link/AutoLinkPlugin.d.ts +9 -0
  180. package/dist/plugins/link/AutoLinkPlugin.js +18 -0
  181. package/dist/plugins/link/LexicalLinkVisitor.d.ts +4 -0
  182. package/dist/plugins/link/LexicalLinkVisitor.js +10 -0
  183. package/dist/plugins/link/MdastLinkVisitor.d.ts +3 -0
  184. package/dist/plugins/link/MdastLinkVisitor.js +14 -0
  185. package/dist/plugins/link/index.d.ts +101 -0
  186. package/dist/plugins/link/index.js +33 -0
  187. package/dist/plugins/link-dialog/LinkDialog.d.ts +16 -0
  188. package/dist/plugins/link-dialog/LinkDialog.js +148 -0
  189. package/dist/plugins/link-dialog/index.d.ts +669 -0
  190. package/dist/plugins/link-dialog/index.js +254 -0
  191. package/dist/plugins/lists/LexicalListItemVisitor.d.ts +4 -0
  192. package/dist/plugins/lists/LexicalListItemVisitor.js +23 -0
  193. package/dist/plugins/lists/LexicalListVisitor.d.ts +4 -0
  194. package/dist/plugins/lists/LexicalListVisitor.js +13 -0
  195. package/dist/plugins/lists/MdastListItemVisitor.d.ts +3 -0
  196. package/dist/plugins/lists/MdastListItemVisitor.js +10 -0
  197. package/dist/plugins/lists/MdastListVisitor.d.ts +3 -0
  198. package/dist/plugins/lists/MdastListVisitor.js +20 -0
  199. package/dist/plugins/lists/index.d.ts +703 -0
  200. package/dist/plugins/lists/index.js +122 -0
  201. package/dist/plugins/markdown-shortcut/index.d.ts +80 -0
  202. package/dist/plugins/markdown-shortcut/index.js +90 -0
  203. package/dist/plugins/quote/LexicalQuoteVisitor.d.ts +4 -0
  204. package/dist/plugins/quote/LexicalQuoteVisitor.js +12 -0
  205. package/dist/plugins/quote/MdastBlockQuoteVisitor.d.ts +3 -0
  206. package/dist/plugins/quote/MdastBlockQuoteVisitor.js +10 -0
  207. package/dist/plugins/quote/index.d.ts +480 -0
  208. package/dist/plugins/quote/index.js +26 -0
  209. package/dist/plugins/sandpack/SandpackEditor.d.ts +7 -0
  210. package/dist/plugins/sandpack/SandpackEditor.js +37 -0
  211. package/dist/plugins/sandpack/index.d.ts +1077 -0
  212. package/dist/plugins/sandpack/index.js +93 -0
  213. package/dist/plugins/sandpack/useCodeMirrorRef.d.ts +4 -0
  214. package/dist/plugins/sandpack/useCodeMirrorRef.js +96 -0
  215. package/dist/plugins/table/LexicalTableVisitor.d.ts +4 -0
  216. package/dist/plugins/table/LexicalTableVisitor.js +10 -0
  217. package/dist/plugins/table/MdastTableVisitor.d.ts +3 -0
  218. package/dist/plugins/table/MdastTableVisitor.js +10 -0
  219. package/dist/plugins/table/TableEditor.d.ts +21 -0
  220. package/dist/plugins/table/TableEditor.js +388 -0
  221. package/dist/plugins/table/TableNode.d.ts +52 -0
  222. package/dist/plugins/table/TableNode.js +152 -0
  223. package/dist/plugins/table/index.d.ts +704 -0
  224. package/dist/plugins/table/index.js +69 -0
  225. package/dist/plugins/thematic-break/LexicalThematicBreakVisitor.d.ts +4 -0
  226. package/dist/plugins/thematic-break/LexicalThematicBreakVisitor.js +10 -0
  227. package/dist/plugins/thematic-break/MdastThematicBreakVisitor.d.ts +3 -0
  228. package/dist/plugins/thematic-break/MdastThematicBreakVisitor.js +10 -0
  229. package/dist/plugins/thematic-break/index.d.ts +693 -0
  230. package/dist/plugins/thematic-break/index.js +39 -0
  231. package/dist/plugins/toolbar/components/BlockTypeSelect.d.ts +6 -0
  232. package/dist/plugins/toolbar/components/BlockTypeSelect.js +54 -0
  233. package/dist/plugins/toolbar/components/BoldItalicUnderlineToggles.d.ts +5 -0
  234. package/dist/plugins/toolbar/components/BoldItalicUnderlineToggles.js +33 -0
  235. package/dist/plugins/toolbar/components/ChangeAdmonitionType.d.ts +6 -0
  236. package/dist/plugins/toolbar/components/ChangeAdmonitionType.js +30 -0
  237. package/dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.d.ts +7 -0
  238. package/dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.js +32 -0
  239. package/dist/plugins/toolbar/components/CodeToggle.d.ts +6 -0
  240. package/dist/plugins/toolbar/components/CodeToggle.js +19 -0
  241. package/dist/plugins/toolbar/components/CreateLink.d.ts +6 -0
  242. package/dist/plugins/toolbar/components/CreateLink.js +20 -0
  243. package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.d.ts +18 -0
  244. package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.js +25 -0
  245. package/dist/plugins/toolbar/components/InsertAdmonition.d.ts +6 -0
  246. package/dist/plugins/toolbar/components/InsertAdmonition.js +29 -0
  247. package/dist/plugins/toolbar/components/InsertCodeBlock.d.ts +7 -0
  248. package/dist/plugins/toolbar/components/InsertCodeBlock.js +20 -0
  249. package/dist/plugins/toolbar/components/InsertFrontmatter.d.ts +6 -0
  250. package/dist/plugins/toolbar/components/InsertFrontmatter.js +24 -0
  251. package/dist/plugins/toolbar/components/InsertImage.d.ts +6 -0
  252. package/dist/plugins/toolbar/components/InsertImage.js +14 -0
  253. package/dist/plugins/toolbar/components/InsertSandpack.d.ts +6 -0
  254. package/dist/plugins/toolbar/components/InsertSandpack.js +13 -0
  255. package/dist/plugins/toolbar/components/InsertTable.d.ts +6 -0
  256. package/dist/plugins/toolbar/components/InsertTable.js +20 -0
  257. package/dist/plugins/toolbar/components/InsertThematicBreak.d.ts +6 -0
  258. package/dist/plugins/toolbar/components/InsertThematicBreak.js +11 -0
  259. package/dist/plugins/toolbar/components/KitchenSinkToolbar.d.ts +7 -0
  260. package/dist/plugins/toolbar/components/KitchenSinkToolbar.js +58 -0
  261. package/dist/plugins/toolbar/components/ListsToggle.d.ts +7 -0
  262. package/dist/plugins/toolbar/components/ListsToggle.js +23 -0
  263. package/dist/plugins/toolbar/components/ShowSandpackInfo.d.ts +7 -0
  264. package/dist/plugins/toolbar/components/ShowSandpackInfo.js +31 -0
  265. package/dist/plugins/toolbar/components/UndoRedo.d.ts +5 -0
  266. package/dist/plugins/toolbar/components/UndoRedo.js +58 -0
  267. package/dist/plugins/toolbar/index.d.ts +564 -0
  268. package/dist/plugins/toolbar/index.js +40 -0
  269. package/dist/plugins/toolbar/primitives/DialogButton.d.ts +40 -0
  270. package/dist/plugins/toolbar/primitives/DialogButton.js +114 -0
  271. package/dist/plugins/toolbar/primitives/TooltipWrap.d.ts +8 -0
  272. package/dist/plugins/toolbar/primitives/TooltipWrap.js +12 -0
  273. package/dist/plugins/toolbar/primitives/select.d.ts +50 -0
  274. package/dist/plugins/toolbar/primitives/select.js +55 -0
  275. package/dist/plugins/toolbar/primitives/toolbar.d.ts +163 -0
  276. package/dist/plugins/toolbar/primitives/toolbar.js +115 -0
  277. package/dist/style.css +1093 -288
  278. package/dist/styles/globals.css.js +4 -0
  279. package/dist/styles/lexical-theme.module.css.js +62 -0
  280. package/dist/styles/lexicalTheme.d.ts +2 -0
  281. package/dist/styles/lexicalTheme.js +31 -0
  282. package/dist/styles/ui.module.css.js +311 -0
  283. package/dist/utils/detectMac.d.ts +3 -0
  284. package/dist/utils/detectMac.js +13 -0
  285. package/dist/utils/fp.d.ts +47 -0
  286. package/dist/utils/fp.js +44 -0
  287. package/dist/utils/isPartOftheEditorUI.d.ts +1 -0
  288. package/dist/utils/isPartOftheEditorUI.js +12 -0
  289. package/dist/utils/lexicalHelpers.d.ts +11 -0
  290. package/dist/utils/lexicalHelpers.js +80 -0
  291. package/dist/utils/makeHslTransparent.d.ts +1 -0
  292. package/dist/utils/makeHslTransparent.js +6 -0
  293. package/dist/utils/mergeStyleAttributes.d.ts +1 -0
  294. package/dist/utils/mergeStyleAttributes.js +22 -0
  295. package/dist/utils/uuid4.d.ts +1 -0
  296. package/dist/utils/uuid4.js +10 -0
  297. package/dist/utils/voidEmitter.d.ts +14 -0
  298. package/dist/utils/voidEmitter.js +15 -0
  299. package/dist/utils/whitespaceConversion.d.ts +2 -0
  300. package/dist/utils/whitespaceConversion.js +9 -0
  301. package/package.json +326 -39
  302. package/dist/index.cjs +0 -1
@@ -0,0 +1,39 @@
1
+ import { coreSystem } from "../core/index.js";
2
+ import { MdastThematicBreakVisitor } from "./MdastThematicBreakVisitor.js";
3
+ import { LexicalThematicBreakVisitor } from "./LexicalThematicBreakVisitor.js";
4
+ import { INSERT_HORIZONTAL_RULE_COMMAND, HorizontalRuleNode } from "@lexical/react/LexicalHorizontalRuleNode.js";
5
+ import { HorizontalRulePlugin } from "@lexical/react/LexicalHorizontalRulePlugin.js";
6
+ import { system } from "../../gurx/realmFactory.js";
7
+ import { realmPlugin } from "../../gurx/react.js";
8
+ const thematicBreakSystem = system(
9
+ (r, [{ activeEditor }]) => {
10
+ const insertThematicBreak = r.node();
11
+ r.sub(r.pipe(insertThematicBreak, r.o.withLatestFrom(activeEditor)), ([, theEditor]) => {
12
+ theEditor == null ? void 0 : theEditor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, void 0);
13
+ });
14
+ return {
15
+ insertThematicBreak
16
+ };
17
+ },
18
+ [coreSystem]
19
+ );
20
+ const [
21
+ /** @internal */
22
+ thematicBreakPlugin,
23
+ /** @internal */
24
+ thematicBreakPluginHooks
25
+ ] = realmPlugin({
26
+ id: "thematic-break",
27
+ systemSpec: thematicBreakSystem,
28
+ init: (realm) => {
29
+ realm.pubKey("addImportVisitor", MdastThematicBreakVisitor);
30
+ realm.pubKey("addLexicalNode", HorizontalRuleNode);
31
+ realm.pubKey("addExportVisitor", LexicalThematicBreakVisitor);
32
+ realm.pubKey("addComposerChild", HorizontalRulePlugin);
33
+ }
34
+ });
35
+ export {
36
+ thematicBreakPlugin,
37
+ thematicBreakPluginHooks,
38
+ thematicBreakSystem
39
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar component that allows the user to change the block type of the current selection.
4
+ * Supports paragraphs, headings and block quotes.
5
+ */
6
+ export declare const BlockTypeSelect: () => React.JSX.Element | null;
@@ -0,0 +1,54 @@
1
+ import { $createHeadingNode, $createQuoteNode } from "@lexical/rich-text";
2
+ import { $createParagraphNode } from "lexical";
3
+ import React__default from "react";
4
+ import { corePluginHooks } from "../../core/index.js";
5
+ import { Select } from "../primitives/select.js";
6
+ import { headingsPluginHooks } from "../../headings/index.js";
7
+ import { useHasPlugin } from "../../../gurx/react.js";
8
+ const BlockTypeSelect = () => {
9
+ const convertSelectionToNode = corePluginHooks.usePublisher("convertSelectionToNode");
10
+ const [currentBlockType] = corePluginHooks.useEmitterValues("currentBlockType");
11
+ const hasQuote = useHasPlugin("quote");
12
+ const hasHeadings = useHasPlugin("headings");
13
+ if (!hasQuote && !hasHeadings) {
14
+ return null;
15
+ }
16
+ const items = [{ label: "Paragraph", value: "paragraph" }];
17
+ if (hasQuote) {
18
+ items.push({ label: "Quote", value: "quote" });
19
+ }
20
+ if (hasHeadings) {
21
+ const [allowedHeadingLevels] = headingsPluginHooks.useEmitterValues("allowedHeadingLevels");
22
+ items.push(...allowedHeadingLevels.map((n) => ({ label: `Heading ${n}`, value: `h${n}` })));
23
+ }
24
+ return /* @__PURE__ */ React__default.createElement(
25
+ Select,
26
+ {
27
+ value: currentBlockType,
28
+ onChange: (blockType) => {
29
+ switch (blockType) {
30
+ case "quote":
31
+ convertSelectionToNode(() => $createQuoteNode());
32
+ break;
33
+ case "paragraph":
34
+ convertSelectionToNode(() => $createParagraphNode());
35
+ break;
36
+ default:
37
+ if (blockType == "")
38
+ ;
39
+ else if (blockType.startsWith("h")) {
40
+ convertSelectionToNode(() => $createHeadingNode(blockType));
41
+ } else {
42
+ throw new Error(`Unknown block type: ${blockType}`);
43
+ }
44
+ }
45
+ },
46
+ triggerTitle: "Select block type",
47
+ placeholder: "Block type",
48
+ items
49
+ }
50
+ );
51
+ };
52
+ export {
53
+ BlockTypeSelect
54
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar component that lets the user toggle bold, italic and underline formatting.
4
+ */
5
+ export declare const BoldItalicUnderlineToggles: React.FC;
@@ -0,0 +1,33 @@
1
+ import React__default from "react";
2
+ import { corePluginHooks } from "../../core/index.js";
3
+ import { IS_BOLD, IS_ITALIC, IS_UNDERLINE } from "../../../FormatConstants.js";
4
+ import { MultipleChoiceToggleGroup } from "../primitives/toolbar.js";
5
+ const BoldItalicUnderlineToggles = () => {
6
+ const [currentFormat] = corePluginHooks.useEmitterValues("currentFormat");
7
+ const applyFormat = corePluginHooks.usePublisher("applyFormat");
8
+ const boldIsOn = (currentFormat & IS_BOLD) !== 0;
9
+ const italicIsOn = (currentFormat & IS_ITALIC) !== 0;
10
+ const underlineIsOn = (currentFormat & IS_UNDERLINE) !== 0;
11
+ const boldTitle = boldIsOn ? "Remove bold" : "Bold";
12
+ const italicTitle = italicIsOn ? "Remove italic" : "Italic";
13
+ const underlineTitle = underlineIsOn ? "Remove underline" : "Underline";
14
+ const [iconComponentFor] = corePluginHooks.useEmitterValues("iconComponentFor");
15
+ return /* @__PURE__ */ React__default.createElement(
16
+ MultipleChoiceToggleGroup,
17
+ {
18
+ items: [
19
+ { title: boldTitle, contents: iconComponentFor("format_bold"), active: boldIsOn, onChange: applyFormat.bind(null, "bold") },
20
+ { title: italicTitle, contents: iconComponentFor("format_italic"), active: italicIsOn, onChange: applyFormat.bind(null, "italic") },
21
+ {
22
+ title: underlineTitle,
23
+ contents: /* @__PURE__ */ React__default.createElement("div", { style: { transform: "translateY(2px)" } }, iconComponentFor("format_underlined")),
24
+ active: underlineIsOn,
25
+ onChange: applyFormat.bind(null, "underline")
26
+ }
27
+ ]
28
+ }
29
+ );
30
+ };
31
+ export {
32
+ BoldItalicUnderlineToggles
33
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * A component that allows the user to change the admonition type of the current selection.
4
+ * For this component to work, you must pass the {@link AdmonitionDirectiveDescriptor} to the `directivesPlugin` `directiveDescriptors` parameter.
5
+ */
6
+ export declare const ChangeAdmonitionType: () => React.JSX.Element;
@@ -0,0 +1,30 @@
1
+ import React__default from "react";
2
+ import { corePluginHooks } from "../../core/index.js";
3
+ import { Select } from "../primitives/select.js";
4
+ import { ADMONITION_TYPES } from "../../../directive-editors/AdmonitionDirectiveDescriptor.js";
5
+ const ChangeAdmonitionType = () => {
6
+ const [editorInFocus, rootEditor] = corePluginHooks.useEmitterValues("editorInFocus", "rootEditor");
7
+ const admonitionNode = editorInFocus.rootNode;
8
+ return /* @__PURE__ */ React__default.createElement(
9
+ Select,
10
+ {
11
+ value: admonitionNode.getMdastNode().name,
12
+ onChange: (name) => {
13
+ rootEditor == null ? void 0 : rootEditor.update(() => {
14
+ admonitionNode.setMdastNode({ ...admonitionNode.getMdastNode(), name });
15
+ setTimeout(() => {
16
+ rootEditor == null ? void 0 : rootEditor.update(() => {
17
+ admonitionNode.getLatest().select();
18
+ });
19
+ }, 80);
20
+ });
21
+ },
22
+ triggerTitle: "Select admonition type",
23
+ placeholder: "Admonition type",
24
+ items: ADMONITION_TYPES.map((type) => ({ label: type.replace(/^./, (l) => l.toUpperCase()), value: type }))
25
+ }
26
+ );
27
+ };
28
+ export {
29
+ ChangeAdmonitionType
30
+ };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /**
3
+ * A component that allows the user to change the code block language of the current selection.
4
+ * For this component to work, you must enable the `codeMirrorPlugin` for the editor.
5
+ * See {@link ConditionalContents} for an example on how to display the dropdown only when a code block is in focus.
6
+ */
7
+ export declare const ChangeCodeMirrorLanguage: () => React.JSX.Element;
@@ -0,0 +1,32 @@
1
+ import React__default from "react";
2
+ import { corePluginHooks } from "../../core/index.js";
3
+ import { Select } from "../primitives/select.js";
4
+ import { codeMirrorHooks } from "../../codemirror/index.js";
5
+ import styles from "../../../styles/ui.module.css.js";
6
+ const ChangeCodeMirrorLanguage = () => {
7
+ const [editorInFocus, theEditor] = corePluginHooks.useEmitterValues("editorInFocus", "activeEditor");
8
+ const codeBlockNode = editorInFocus.rootNode;
9
+ const [codeBlockLanguages] = codeMirrorHooks.useEmitterValues("codeBlockLanguages");
10
+ return /* @__PURE__ */ React__default.createElement("div", { className: styles.selectWithLabel }, /* @__PURE__ */ React__default.createElement("label", null, "Code block language:"), /* @__PURE__ */ React__default.createElement(
11
+ Select,
12
+ {
13
+ value: codeBlockNode.getLanguage(),
14
+ onChange: (language) => {
15
+ theEditor == null ? void 0 : theEditor.update(() => {
16
+ codeBlockNode.setLanguage(language);
17
+ setTimeout(() => {
18
+ theEditor == null ? void 0 : theEditor.update(() => {
19
+ codeBlockNode.getLatest().select();
20
+ });
21
+ });
22
+ });
23
+ },
24
+ triggerTitle: "Select code block language",
25
+ placeholder: "Code block language",
26
+ items: Object.entries(codeBlockLanguages).map(([value, label]) => ({ value, label }))
27
+ }
28
+ ));
29
+ };
30
+ export {
31
+ ChangeCodeMirrorLanguage
32
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar component that lets the user toggle code formatting.
4
+ * Use for inline `code` elements (like variables, methods, etc).
5
+ */
6
+ export declare const CodeToggle: React.FC;
@@ -0,0 +1,19 @@
1
+ import React__default from "react";
2
+ import { IS_CODE } from "../../../FormatConstants.js";
3
+ import { corePluginHooks } from "../../core/index.js";
4
+ import { MultipleChoiceToggleGroup } from "../primitives/toolbar.js";
5
+ const CodeToggle = () => {
6
+ const [currentFormat, iconComponentFor] = corePluginHooks.useEmitterValues("currentFormat", "iconComponentFor");
7
+ const applyFormat = corePluginHooks.usePublisher("applyFormat");
8
+ const codeIsOn = (currentFormat & IS_CODE) !== 0;
9
+ const title = codeIsOn ? "Remove code format" : "Inline code format";
10
+ return /* @__PURE__ */ React__default.createElement(
11
+ MultipleChoiceToggleGroup,
12
+ {
13
+ items: [{ title, contents: iconComponentFor("code"), active: codeIsOn, onChange: applyFormat.bind(null, "code") }]
14
+ }
15
+ );
16
+ };
17
+ export {
18
+ CodeToggle
19
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar component that opens the link edit dialog.
4
+ * For this component to work, you must include the `linkDialogPlugin`.
5
+ */
6
+ export declare const CreateLink: () => React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ import React__default from "react";
2
+ import { ButtonWithTooltip } from "../primitives/toolbar.js";
3
+ import { linkDialogPluginHooks } from "../../link-dialog/index.js";
4
+ const CreateLink = () => {
5
+ const openLinkDialog = linkDialogPluginHooks.usePublisher("openLinkEditDialog");
6
+ const [iconComponentFor] = linkDialogPluginHooks.useEmitterValues("iconComponentFor");
7
+ return /* @__PURE__ */ React__default.createElement(
8
+ ButtonWithTooltip,
9
+ {
10
+ title: "Create link",
11
+ onClick: (_) => {
12
+ openLinkDialog(true);
13
+ }
14
+ },
15
+ iconComponentFor("link")
16
+ );
17
+ };
18
+ export {
19
+ CreateLink
20
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ /**
3
+ * A wrapper element for the toolbar contents that lets the user toggle between rich text, diff and source mode.
4
+ * Put the rich text toolbar contents as children of this component.
5
+ * For this component to work, you must include the `diffSourcePlugin`.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <MDXEditor markdown='Hello world'
10
+ * plugins={[toolbarPlugin({
11
+ * toolbarContents: () => ( <> <DiffSourceToggleWrapper><UndoRedo /><BoldItalicUnderlineToggles /></DiffSourceToggleWrapper></>)
12
+ * }), diffSourcePlugin()]}
13
+ * />
14
+ * ```
15
+ */
16
+ export declare const DiffSourceToggleWrapper: React.FC<{
17
+ children: React.ReactNode;
18
+ }>;
@@ -0,0 +1,25 @@
1
+ import React__default from "react";
2
+ import { diffSourcePluginHooks } from "../../diff-source/index.js";
3
+ import { SingleChoiceToggleGroup } from "../primitives/toolbar.js";
4
+ import styles from "../../../styles/ui.module.css.js";
5
+ const DiffSourceToggleWrapper = ({ children }) => {
6
+ const [viewMode] = diffSourcePluginHooks.useEmitterValues("viewMode");
7
+ const changeViewMode = diffSourcePluginHooks.usePublisher("viewMode");
8
+ const [iconComponentFor] = diffSourcePluginHooks.useEmitterValues("iconComponentFor");
9
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, viewMode === "rich-text" ? children : viewMode === "diff" ? /* @__PURE__ */ React__default.createElement("span", { className: styles.toolbarTitleMode }, "Diff mode") : /* @__PURE__ */ React__default.createElement("span", { className: styles.toolbarTitleMode }, "Source mode"), /* @__PURE__ */ React__default.createElement("div", { style: { marginLeft: "auto", pointerEvents: "auto", opacity: 1 } }, /* @__PURE__ */ React__default.createElement(
10
+ SingleChoiceToggleGroup,
11
+ {
12
+ className: styles.diffSourceToggle,
13
+ value: viewMode,
14
+ items: [
15
+ { title: "Rich text", contents: iconComponentFor("rich_text"), value: "rich-text" },
16
+ { title: "Diff mode", contents: iconComponentFor("difference"), value: "diff" },
17
+ { title: "Source", contents: iconComponentFor("markdown"), value: "source" }
18
+ ],
19
+ onChange: (value) => changeViewMode(value || "rich-text")
20
+ }
21
+ )));
22
+ };
23
+ export {
24
+ DiffSourceToggleWrapper
25
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar dropdown button that allows the user to insert admonitions.
4
+ * For this to work, you need to have the `directives` plugin enabled with the {@link AdmonitionDirectiveDescriptor} configured.
5
+ */
6
+ export declare const InsertAdmonition: () => React.JSX.Element;
@@ -0,0 +1,29 @@
1
+ import React__default from "react";
2
+ import { ButtonOrDropdownButton } from "../primitives/toolbar.js";
3
+ import { directivesPluginHooks } from "../../directives/index.js";
4
+ import { ADMONITION_TYPES } from "../../../directive-editors/AdmonitionDirectiveDescriptor.js";
5
+ const InsertAdmonition = () => {
6
+ const insertDirective = directivesPluginHooks.usePublisher("insertDirective");
7
+ const [iconComponentFor] = directivesPluginHooks.useEmitterValues("iconComponentFor");
8
+ const items = React__default.useMemo(
9
+ () => ADMONITION_TYPES.map((type) => ({ value: type, label: type.replace(/^./, (l) => l.toUpperCase()) })),
10
+ []
11
+ );
12
+ return /* @__PURE__ */ React__default.createElement(
13
+ ButtonOrDropdownButton,
14
+ {
15
+ title: "Insert admonition",
16
+ onChoose: (admonitionName) => {
17
+ insertDirective({
18
+ type: "containerDirective",
19
+ name: admonitionName
20
+ });
21
+ },
22
+ items
23
+ },
24
+ iconComponentFor("admonition")
25
+ );
26
+ };
27
+ export {
28
+ InsertAdmonition
29
+ };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar button that allows the user to insert a fenced code block.
4
+ * Once the code block is focused, you can construct a special code block toolbar for it, using the {@link ConditionalContents} primitive.
5
+ * See the {@link ConditionalContents} documentation for an example.
6
+ */
7
+ export declare const InsertCodeBlock: React.FC;
@@ -0,0 +1,20 @@
1
+ import React__default from "react";
2
+ import { ButtonWithTooltip } from "../primitives/toolbar.js";
3
+ import { codeBlockPluginHooks } from "../../codeblock/index.js";
4
+ const InsertCodeBlock = () => {
5
+ const insertCodeBlock = codeBlockPluginHooks.usePublisher("insertCodeBlock");
6
+ const [iconComponentFor] = codeBlockPluginHooks.useEmitterValues("iconComponentFor");
7
+ return /* @__PURE__ */ React__default.createElement(
8
+ ButtonWithTooltip,
9
+ {
10
+ title: "Insert code block",
11
+ onClick: () => {
12
+ insertCodeBlock({});
13
+ }
14
+ },
15
+ iconComponentFor("frame_source")
16
+ );
17
+ };
18
+ export {
19
+ InsertCodeBlock
20
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar button that allows the user to insert a {@link https://jekyllrb.com/docs/front-matter/ | front-matter} editor (if one is not already present).
4
+ * For this to work, you need to have the `frontmatterPlugin` plugin enabled.
5
+ */
6
+ export declare const InsertFrontmatter: React.FC;
@@ -0,0 +1,24 @@
1
+ import React__default from "react";
2
+ import { ButtonWithTooltip } from "../primitives/toolbar.js";
3
+ import { frontmatterPluginHooks } from "../../frontmatter/index.js";
4
+ import styles from "../../../styles/ui.module.css.js";
5
+ import classNames from "classnames";
6
+ const InsertFrontmatter = () => {
7
+ const insertFrontmatter = frontmatterPluginHooks.usePublisher("insertFrontmatter");
8
+ const [hasFrontmatter] = frontmatterPluginHooks.useEmitterValues("hasFrontmatter");
9
+ const [iconComponentFor] = frontmatterPluginHooks.useEmitterValues("iconComponentFor");
10
+ return /* @__PURE__ */ React__default.createElement(
11
+ ButtonWithTooltip,
12
+ {
13
+ title: hasFrontmatter ? "Edit frontmatter" : "Insert frontmatter",
14
+ className: classNames({
15
+ [styles.activeToolbarButton]: hasFrontmatter
16
+ }),
17
+ onClick: insertFrontmatter.bind(null, true)
18
+ },
19
+ iconComponentFor("frontmatter")
20
+ );
21
+ };
22
+ export {
23
+ InsertFrontmatter
24
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar button that allows the user to insert an image from an URL.
4
+ * For the button to work, you need to have the `imagePlugin` plugin enabled.
5
+ */
6
+ export declare const InsertImage: React.ForwardRefExoticComponent<Omit<Record<string, never>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,14 @@
1
+ import React__default from "react";
2
+ import { imagePluginHooks } from "../../image/index.js";
3
+ import * as RadixToolbar from "@radix-ui/react-toolbar";
4
+ import styles from "../../../styles/ui.module.css.js";
5
+ import { corePluginHooks } from "../../core/index.js";
6
+ import { TooltipWrap } from "../primitives/TooltipWrap.js";
7
+ const InsertImage = React__default.forwardRef((_, forwardedRef) => {
8
+ const openNewImageDialog = imagePluginHooks.usePublisher("openNewImageDialog");
9
+ const [readOnly, iconComponentFor] = corePluginHooks.useEmitterValues("readOnly", "iconComponentFor");
10
+ return /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { className: styles.toolbarButton, ref: forwardedRef, disabled: readOnly, onClick: () => openNewImageDialog(true) }, /* @__PURE__ */ React__default.createElement(TooltipWrap, { title: "Insert image" }, iconComponentFor("add_photo")));
11
+ });
12
+ export {
13
+ InsertImage
14
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * A dropdown button that allows the user to insert a live code block into the editor. The dropdown offers a list of presets that are defined in the sandpack plugin config.
4
+ * For this to work, you need to have the `sandpackPlugin` installed.
5
+ */
6
+ export declare const InsertSandpack: () => React.JSX.Element;
@@ -0,0 +1,13 @@
1
+ import React__default from "react";
2
+ import { ButtonOrDropdownButton } from "../primitives/toolbar.js";
3
+ import { sandpackPluginHooks } from "../../sandpack/index.js";
4
+ const InsertSandpack = () => {
5
+ const [sandpackConfig] = sandpackPluginHooks.useEmitterValues("sandpackConfig");
6
+ const insertSandpack = sandpackPluginHooks.usePublisher("insertSandpack");
7
+ const items = React__default.useMemo(() => sandpackConfig.presets.map((preset) => ({ value: preset.name, label: preset.label })), [sandpackConfig]);
8
+ const [iconComponentFor] = sandpackPluginHooks.useEmitterValues("iconComponentFor");
9
+ return /* @__PURE__ */ React__default.createElement(ButtonOrDropdownButton, { title: "Insert Sandpack", onChoose: insertSandpack, items }, iconComponentFor("sandpack"));
10
+ };
11
+ export {
12
+ InsertSandpack
13
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar button that allows the user to insert a table.
4
+ * For this button to work, you need to have the `tablePlugin` plugin enabled.
5
+ */
6
+ export declare const InsertTable: React.FC;
@@ -0,0 +1,20 @@
1
+ import { ButtonWithTooltip } from "../primitives/toolbar.js";
2
+ import React__default from "react";
3
+ import { tablePluginHooks } from "../../table/index.js";
4
+ const InsertTable = () => {
5
+ const [iconComponentFor] = tablePluginHooks.useEmitterValues("iconComponentFor");
6
+ const insertTable = tablePluginHooks.usePublisher("insertTable");
7
+ return /* @__PURE__ */ React__default.createElement(
8
+ ButtonWithTooltip,
9
+ {
10
+ title: "Insert table",
11
+ onClick: () => {
12
+ insertTable({ rows: 3, columns: 3 });
13
+ }
14
+ },
15
+ iconComponentFor("table")
16
+ );
17
+ };
18
+ export {
19
+ InsertTable
20
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar button that allows the user to insert a thematic break (rendered as an HR HTML element).
4
+ * For this button to work, you need to have the `thematicBreakPlugin` plugin enabled.
5
+ */
6
+ export declare const InsertThematicBreak: React.FC;
@@ -0,0 +1,11 @@
1
+ import React__default from "react";
2
+ import { thematicBreakPluginHooks } from "../../thematic-break/index.js";
3
+ import { ButtonWithTooltip } from "../primitives/toolbar.js";
4
+ const InsertThematicBreak = () => {
5
+ const insertThematicBreak = thematicBreakPluginHooks.usePublisher("insertThematicBreak");
6
+ const [iconComponentFor] = thematicBreakPluginHooks.useEmitterValues("iconComponentFor");
7
+ return /* @__PURE__ */ React__default.createElement(ButtonWithTooltip, { title: "Insert thematic break", onClick: insertThematicBreak.bind(null, true) }, iconComponentFor("horizontal_rule"));
8
+ };
9
+ export {
10
+ InsertThematicBreak
11
+ };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar component that includes all toolbar components.
4
+ * Notice that some of the buttons will work only if you have the corresponding plugin enabled, so you should use it only for testing purposes.
5
+ * You'll probably want to create your own toolbar component that includes only the buttons that you need.
6
+ */
7
+ export declare const KitchenSinkToolbar: React.FC;
@@ -0,0 +1,58 @@
1
+ import React__default from "react";
2
+ import { ConditionalContents, Separator } from "../primitives/toolbar.js";
3
+ import { BlockTypeSelect } from "./BlockTypeSelect.js";
4
+ import { BoldItalicUnderlineToggles } from "./BoldItalicUnderlineToggles.js";
5
+ import { ChangeAdmonitionType } from "./ChangeAdmonitionType.js";
6
+ import { ChangeCodeMirrorLanguage } from "./ChangeCodeMirrorLanguage.js";
7
+ import { CodeToggle } from "./CodeToggle.js";
8
+ import { DiffSourceToggleWrapper } from "./DiffSourceToggleWrapper.js";
9
+ import { InsertAdmonition } from "./InsertAdmonition.js";
10
+ import { InsertCodeBlock } from "./InsertCodeBlock.js";
11
+ import { InsertFrontmatter } from "./InsertFrontmatter.js";
12
+ import { InsertImage } from "./InsertImage.js";
13
+ import { InsertSandpack } from "./InsertSandpack.js";
14
+ import { InsertTable } from "./InsertTable.js";
15
+ import { InsertThematicBreak } from "./InsertThematicBreak.js";
16
+ import { ListsToggle } from "./ListsToggle.js";
17
+ import { ShowSandpackInfo } from "./ShowSandpackInfo.js";
18
+ import { UndoRedo } from "./UndoRedo.js";
19
+ import { CreateLink } from "./CreateLink.js";
20
+ function whenInAdmonition(editorInFocus) {
21
+ const node = editorInFocus == null ? void 0 : editorInFocus.rootNode;
22
+ if (!node || node.getType() !== "directive") {
23
+ return false;
24
+ }
25
+ return ["note", "tip", "danger", "info", "caution"].includes(node.getMdastNode().name);
26
+ }
27
+ const KitchenSinkToolbar = () => {
28
+ return /* @__PURE__ */ React__default.createElement(DiffSourceToggleWrapper, null, /* @__PURE__ */ React__default.createElement(
29
+ ConditionalContents,
30
+ {
31
+ options: [
32
+ { when: (editor) => (editor == null ? void 0 : editor.editorType) === "codeblock", contents: () => /* @__PURE__ */ React__default.createElement(ChangeCodeMirrorLanguage, null) },
33
+ { when: (editor) => (editor == null ? void 0 : editor.editorType) === "sandpack", contents: () => /* @__PURE__ */ React__default.createElement(ShowSandpackInfo, null) },
34
+ {
35
+ fallback: () => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(UndoRedo, null), /* @__PURE__ */ React__default.createElement(Separator, null), /* @__PURE__ */ React__default.createElement(BoldItalicUnderlineToggles, null), /* @__PURE__ */ React__default.createElement(CodeToggle, null), /* @__PURE__ */ React__default.createElement(Separator, null), /* @__PURE__ */ React__default.createElement(ListsToggle, null), /* @__PURE__ */ React__default.createElement(Separator, null), /* @__PURE__ */ React__default.createElement(
36
+ ConditionalContents,
37
+ {
38
+ options: [{ when: whenInAdmonition, contents: () => /* @__PURE__ */ React__default.createElement(ChangeAdmonitionType, null) }, { fallback: () => /* @__PURE__ */ React__default.createElement(BlockTypeSelect, null) }]
39
+ }
40
+ ), /* @__PURE__ */ React__default.createElement(Separator, null), /* @__PURE__ */ React__default.createElement(CreateLink, null), /* @__PURE__ */ React__default.createElement(InsertImage, null), /* @__PURE__ */ React__default.createElement(Separator, null), /* @__PURE__ */ React__default.createElement(InsertTable, null), /* @__PURE__ */ React__default.createElement(InsertThematicBreak, null), /* @__PURE__ */ React__default.createElement(Separator, null), /* @__PURE__ */ React__default.createElement(InsertCodeBlock, null), /* @__PURE__ */ React__default.createElement(InsertSandpack, null), /* @__PURE__ */ React__default.createElement(
41
+ ConditionalContents,
42
+ {
43
+ options: [
44
+ {
45
+ when: (editorInFocus) => !whenInAdmonition(editorInFocus),
46
+ contents: () => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Separator, null), /* @__PURE__ */ React__default.createElement(InsertAdmonition, null))
47
+ }
48
+ ]
49
+ }
50
+ ), /* @__PURE__ */ React__default.createElement(Separator, null), /* @__PURE__ */ React__default.createElement(InsertFrontmatter, null))
51
+ }
52
+ ]
53
+ }
54
+ ));
55
+ };
56
+ export {
57
+ KitchenSinkToolbar
58
+ };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /**
3
+ * A toolbar toggle that allows the user to toggle between bulleted and numbered lists.
4
+ * Pressing the selected button will convert the current list to the other type. Pressing it again will remove the list.
5
+ * For this button to work, you need to have the `listsPlugin` plugin enabled.
6
+ */
7
+ export declare const ListsToggle: React.FC;
@@ -0,0 +1,23 @@
1
+ import React__default from "react";
2
+ import { listsPluginHooks } from "../../lists/index.js";
3
+ import { SingleChoiceToggleGroup } from "../primitives/toolbar.js";
4
+ const ListsToggle = () => {
5
+ const [currentListType] = listsPluginHooks.useEmitterValues("currentListType");
6
+ const applyListType = listsPluginHooks.usePublisher("applyListType");
7
+ const [iconComponentFor] = listsPluginHooks.useEmitterValues("iconComponentFor");
8
+ return /* @__PURE__ */ React__default.createElement(
9
+ SingleChoiceToggleGroup,
10
+ {
11
+ value: currentListType || "",
12
+ items: [
13
+ { title: "Bulleted list", contents: iconComponentFor("format_list_bulleted"), value: "bullet" },
14
+ { title: "Numbered list", contents: iconComponentFor("format_list_numbered"), value: "number" },
15
+ { title: "Check list", contents: iconComponentFor("format_list_checked"), value: "check" }
16
+ ],
17
+ onChange: applyListType
18
+ }
19
+ );
20
+ };
21
+ export {
22
+ ListsToggle
23
+ };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /**
3
+ * A component that displays the focused live code block's name.
4
+ * For this component to work, you must enable the `sandpackPlugin` for the editor.
5
+ * See {@link ConditionalContents} for an example on how to display the dropdown only when a sandpack editor is in focus.
6
+ */
7
+ export declare const ShowSandpackInfo: () => React.JSX.Element;