@mdxeditor/editor 1.9.2 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/MDXEditor.d.ts +5 -0
  2. package/dist/MDXEditor.js +6 -1
  3. package/dist/icons/add_column.svg.js +1 -2
  4. package/dist/icons/add_photo.svg.js +1 -2
  5. package/dist/icons/add_row.svg.js +1 -2
  6. package/dist/icons/{emergency_home.svg.js → admonition.svg.js} +2 -3
  7. package/dist/icons/arrow_drop_down.svg.js +3 -4
  8. package/dist/icons/check.svg.js +1 -2
  9. package/dist/icons/check_small.svg.js +7 -0
  10. package/dist/icons/close.svg.js +1 -2
  11. package/dist/icons/code.svg.js +1 -2
  12. package/dist/icons/content_copy.svg.js +1 -2
  13. package/dist/icons/delete_big.svg.js +7 -0
  14. package/dist/icons/delete_small.svg.js +1 -2
  15. package/dist/icons/difference.svg.js +1 -2
  16. package/dist/icons/edit.svg.js +1 -2
  17. package/dist/icons/extension.svg.js +7 -0
  18. package/dist/icons/format_align_center.svg.js +1 -2
  19. package/dist/icons/format_align_left.svg.js +1 -2
  20. package/dist/icons/format_align_right.svg.js +1 -2
  21. package/dist/icons/format_bold.svg.js +1 -2
  22. package/dist/icons/format_italic.svg.js +1 -2
  23. package/dist/icons/format_list_bulleted.svg.js +1 -2
  24. package/dist/icons/format_list_checked.svg.js +1 -2
  25. package/dist/icons/format_list_numbered.svg.js +1 -2
  26. package/dist/icons/format_underlined.svg.js +1 -2
  27. package/dist/icons/frame_source.svg.js +1 -2
  28. package/dist/icons/frontmatter.svg.js +1 -2
  29. package/dist/icons/horizontal_rule.svg.js +1 -2
  30. package/dist/icons/insert_col_left.svg.js +1 -2
  31. package/dist/icons/insert_col_right.svg.js +1 -2
  32. package/dist/icons/insert_row_above.svg.js +1 -2
  33. package/dist/icons/insert_row_below.svg.js +1 -2
  34. package/dist/icons/link.svg.js +1 -2
  35. package/dist/icons/link_off.svg.js +1 -2
  36. package/dist/icons/markdown.svg.js +1 -2
  37. package/dist/icons/more_horiz.svg.js +1 -2
  38. package/dist/icons/more_vert.svg.js +7 -0
  39. package/dist/icons/open_in_new.svg.js +1 -2
  40. package/dist/icons/redo.svg.js +1 -2
  41. package/dist/icons/rich_text.svg.js +1 -2
  42. package/dist/icons/{deployed_code.svg.js → sandpack.svg.js} +2 -3
  43. package/dist/icons/settings.svg.js +1 -2
  44. package/dist/icons/table.svg.js +1 -2
  45. package/dist/icons/undo.svg.js +1 -2
  46. package/dist/plugins/codeblock/index.d.ts +13 -2
  47. package/dist/plugins/codemirror/index.d.ts +17 -2
  48. package/dist/plugins/core/Icon.d.ts +6 -0
  49. package/dist/plugins/core/Icon.js +96 -0
  50. package/dist/plugins/core/PropertyPopover.js +3 -2
  51. package/dist/plugins/core/index.d.ts +12 -2
  52. package/dist/plugins/core/index.js +7 -2
  53. package/dist/plugins/core/ui/DownshiftAutoComplete.js +3 -2
  54. package/dist/plugins/diff-source/index.d.ts +13 -2
  55. package/dist/plugins/directives/index.d.ts +13 -2
  56. package/dist/plugins/frontmatter/FrontmatterEditor.js +7 -5
  57. package/dist/plugins/frontmatter/index.d.ts +13 -2
  58. package/dist/plugins/headings/index.d.ts +13 -2
  59. package/dist/plugins/image/ImageEditor.js +3 -2
  60. package/dist/plugins/image/index.d.ts +13 -2
  61. package/dist/plugins/jsx/index.d.ts +13 -2
  62. package/dist/plugins/link/index.d.ts +2 -0
  63. package/dist/plugins/link-dialog/LinkDialog.js +11 -14
  64. package/dist/plugins/link-dialog/index.d.ts +11 -2
  65. package/dist/plugins/link-dialog/index.js +0 -6
  66. package/dist/plugins/lists/index.d.ts +13 -2
  67. package/dist/plugins/markdown-shortcut/index.d.ts +2 -0
  68. package/dist/plugins/quote/index.d.ts +10 -2
  69. package/dist/plugins/sandpack/index.d.ts +17 -2
  70. package/dist/plugins/table/TableEditor.js +22 -28
  71. package/dist/plugins/table/index.d.ts +13 -2
  72. package/dist/plugins/thematic-break/index.d.ts +13 -2
  73. package/dist/plugins/toolbar/components/BoldItalicUnderlineToggles.js +4 -6
  74. package/dist/plugins/toolbar/components/CodeToggle.js +2 -3
  75. package/dist/plugins/toolbar/components/CreateLink.js +2 -2
  76. package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.js +4 -6
  77. package/dist/plugins/toolbar/components/InsertAdmonition.js +2 -2
  78. package/dist/plugins/toolbar/components/InsertCodeBlock.js +2 -2
  79. package/dist/plugins/toolbar/components/InsertFrontmatter.js +2 -2
  80. package/dist/plugins/toolbar/components/InsertImage.js +2 -3
  81. package/dist/plugins/toolbar/components/InsertSandpack.js +2 -2
  82. package/dist/plugins/toolbar/components/InsertTable.js +2 -2
  83. package/dist/plugins/toolbar/components/InsertThematicBreak.js +2 -2
  84. package/dist/plugins/toolbar/components/ListsToggle.js +4 -6
  85. package/dist/plugins/toolbar/components/ShowSandpackInfo.js +3 -4
  86. package/dist/plugins/toolbar/components/UndoRedo.js +3 -4
  87. package/dist/plugins/toolbar/index.d.ts +11 -2
  88. package/dist/plugins/toolbar/primitives/DialogButton.js +4 -6
  89. package/dist/plugins/toolbar/primitives/TooltipWrap.js +1 -1
  90. package/dist/plugins/toolbar/primitives/select.js +4 -5
  91. package/dist/style.css +252 -236
  92. package/dist/styles/ui.module.css.js +105 -102
  93. package/package.json +12 -11
  94. package/dist/icons/delete.svg.js +0 -8
@@ -5,28 +5,17 @@ import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin.js";
5
5
  import * as RadixPopover from "@radix-ui/react-popover";
6
6
  import { $createParagraphNode, createEditor, $getRoot, KEY_TAB_COMMAND, COMMAND_PRIORITY_CRITICAL, FOCUS_COMMAND, COMMAND_PRIORITY_LOW, KEY_ENTER_COMMAND, BLUR_COMMAND } from "lexical";
7
7
  import React__default from "react";
8
- import { lexicalTheme } from "../../styles/lexicalTheme.js";
9
8
  import { exportLexicalTreeToMdast } from "../../exportMarkdownFromLexical.js";
10
9
  import { importMdastTreeToLexical } from "../../importMarkdownToLexical.js";
11
- import AddColumnIcon from "../../icons/add_column.svg.js";
12
- import AddRowIcon from "../../icons/add_row.svg.js";
13
- import DeleteSmallIcon from "../../icons/delete_small.svg.js";
14
- import AlignCenterIcon from "../../icons/format_align_center.svg.js";
15
- import AlignLeftIcon from "../../icons/format_align_left.svg.js";
16
- import AlignRightIcon from "../../icons/format_align_right.svg.js";
17
- import InsertColLeftIcon from "../../icons/insert_col_left.svg.js";
18
- import InsertColRightIcon from "../../icons/insert_col_right.svg.js";
19
- import InsertRowAboveIcon from "../../icons/insert_row_above.svg.js";
20
- import InsertRowBelowIcon from "../../icons/insert_row_below.svg.js";
21
- import MoreHorizIcon from "../../icons/more_horiz.svg.js";
10
+ import { lexicalTheme } from "../../styles/lexicalTheme.js";
11
+ import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin.js";
12
+ import { mergeRegister } from "@lexical/utils";
22
13
  import * as RadixToolbar from "@radix-ui/react-toolbar";
23
14
  import classNames from "classnames";
24
15
  import styles from "../../styles/ui.module.css.js";
25
- import { corePluginHooks } from "../core/index.js";
26
- import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin.js";
27
- import { mergeRegister } from "@lexical/utils";
28
16
  import { isPartOftheEditorUI } from "../../utils/isPartOftheEditorUI.js";
29
17
  import { uuidv4 } from "../../utils/uuid4.js";
18
+ import { corePluginHooks } from "../core/index.js";
30
19
  const AlignToTailwindClassMap = {
31
20
  center: styles.centeredCell,
32
21
  left: styles.leftAlignedCell,
@@ -34,6 +23,7 @@ const AlignToTailwindClassMap = {
34
23
  };
35
24
  const TableEditor = ({ mdastNode, parentEditor, lexicalTable }) => {
36
25
  const [activeCell, setActiveCell] = React__default.useState(null);
26
+ const [iconComponentFor, readOnly] = corePluginHooks.useEmitterValues("iconComponentFor", "readOnly");
37
27
  const getCellKey = React__default.useMemo(() => {
38
28
  const cellKeyMap = /* @__PURE__ */ new WeakMap();
39
29
  return (cell) => {
@@ -130,7 +120,7 @@ const TableEditor = ({ mdastNode, parentEditor, lexicalTable }) => {
130
120
  const currentColumnAlign = align[colIndex] || "left";
131
121
  const className = AlignToTailwindClassMap[currentColumnAlign];
132
122
  return /* @__PURE__ */ React__default.createElement("col", { key: colIndex, className });
133
- }), /* @__PURE__ */ React__default.createElement("col", null)), /* @__PURE__ */ React__default.createElement("thead", null, /* @__PURE__ */ React__default.createElement("tr", null, /* @__PURE__ */ React__default.createElement("th", { className: styles.tableToolsColumn, "data-tool-cell": true }, /* @__PURE__ */ React__default.createElement(
123
+ }), /* @__PURE__ */ React__default.createElement("col", null)), readOnly || /* @__PURE__ */ React__default.createElement("thead", null, /* @__PURE__ */ React__default.createElement("tr", null, /* @__PURE__ */ React__default.createElement("th", { className: styles.tableToolsColumn, "data-tool-cell": true }, /* @__PURE__ */ React__default.createElement(
134
124
  "button",
135
125
  {
136
126
  className: styles.iconButton,
@@ -144,7 +134,7 @@ const TableEditor = ({ mdastNode, parentEditor, lexicalTable }) => {
144
134
  });
145
135
  }
146
136
  },
147
- /* @__PURE__ */ React__default.createElement(DeleteSmallIcon, null)
137
+ iconComponentFor("delete_small")
148
138
  )), Array.from({ length: mdastNode.children[0].children.length }, (_, colIndex) => {
149
139
  return /* @__PURE__ */ React__default.createElement("th", { key: colIndex, "data-tool-cell": true }, /* @__PURE__ */ React__default.createElement(
150
140
  ColumnEditor,
@@ -160,7 +150,7 @@ const TableEditor = ({ mdastNode, parentEditor, lexicalTable }) => {
160
150
  }
161
151
  ));
162
152
  }), /* @__PURE__ */ React__default.createElement("th", { className: styles.tableToolsColumn }))), /* @__PURE__ */ React__default.createElement("tbody", null, mdastNode.children.map((row, rowIndex) => {
163
- return /* @__PURE__ */ React__default.createElement("tr", { key: rowIndex }, /* @__PURE__ */ React__default.createElement("td", { className: styles.toolCell, "data-tool-cell": true }, /* @__PURE__ */ React__default.createElement(RowEditor, { ...{ setActiveCellWithBoundaries, parentEditor, rowIndex, highlightedCoordinates, lexicalTable } })), row.children.map((mdastCell, colIndex) => {
153
+ return /* @__PURE__ */ React__default.createElement("tr", { key: rowIndex }, readOnly || /* @__PURE__ */ React__default.createElement("td", { className: styles.toolCell, "data-tool-cell": true }, /* @__PURE__ */ React__default.createElement(RowEditor, { ...{ setActiveCellWithBoundaries, parentEditor, rowIndex, highlightedCoordinates, lexicalTable } })), row.children.map((mdastCell, colIndex) => {
164
154
  var _a;
165
155
  return /* @__PURE__ */ React__default.createElement(
166
156
  Cell,
@@ -174,12 +164,12 @@ const TableEditor = ({ mdastNode, parentEditor, lexicalTable }) => {
174
164
  colIndex,
175
165
  lexicalTable,
176
166
  parentEditor,
177
- activeCell
167
+ activeCell: readOnly ? [-1, -1] : activeCell
178
168
  }
179
169
  }
180
170
  );
181
- }), rowIndex === 0 && /* @__PURE__ */ React__default.createElement("th", { rowSpan: lexicalTable.getRowCount(), "data-tool-cell": true }, /* @__PURE__ */ React__default.createElement("button", { type: "button", className: styles.addColumnButton, onClick: addColumnToRight }, /* @__PURE__ */ React__default.createElement(AddColumnIcon, null))));
182
- })), /* @__PURE__ */ React__default.createElement("tfoot", null, /* @__PURE__ */ React__default.createElement("tr", null, /* @__PURE__ */ React__default.createElement("th", null), /* @__PURE__ */ React__default.createElement("th", { colSpan: lexicalTable.getColCount() }, /* @__PURE__ */ React__default.createElement("button", { type: "button", className: styles.addRowButton, onClick: addRowToBottom }, /* @__PURE__ */ React__default.createElement(AddRowIcon, null))), /* @__PURE__ */ React__default.createElement("th", null))));
171
+ }), readOnly || rowIndex === 0 && /* @__PURE__ */ React__default.createElement("th", { rowSpan: lexicalTable.getRowCount(), "data-tool-cell": true }, /* @__PURE__ */ React__default.createElement("button", { type: "button", className: styles.addColumnButton, onClick: addColumnToRight }, iconComponentFor("add_column"))));
172
+ })), readOnly || /* @__PURE__ */ React__default.createElement("tfoot", null, /* @__PURE__ */ React__default.createElement("tr", null, /* @__PURE__ */ React__default.createElement("th", null), /* @__PURE__ */ React__default.createElement("th", { colSpan: lexicalTable.getColCount() }, /* @__PURE__ */ React__default.createElement("button", { type: "button", className: styles.addRowButton, onClick: addRowToBottom }, iconComponentFor("add_row"))), /* @__PURE__ */ React__default.createElement("th", null))));
183
173
  };
184
174
  const Cell = ({ align, ...props }) => {
185
175
  const { activeCell, setActiveCell } = props;
@@ -295,6 +285,7 @@ const ColumnEditor = ({
295
285
  setActiveCellWithBoundaries
296
286
  }) => {
297
287
  const [editorRootElementRef] = corePluginHooks.useEmitterValues("editorRootElementRef");
288
+ const [iconComponentFor] = corePluginHooks.useEmitterValues("iconComponentFor");
298
289
  const insertColumnAt = React__default.useCallback(
299
290
  (colIndex2) => {
300
291
  parentEditor.update(() => {
@@ -327,7 +318,7 @@ const ColumnEditor = ({
327
318
  "data-active": highlightedCoordinates[0] === colIndex + 1,
328
319
  title: "Column menu"
329
320
  },
330
- /* @__PURE__ */ React__default.createElement(MoreHorizIcon, null)
321
+ iconComponentFor("more_horiz")
331
322
  ), /* @__PURE__ */ React__default.createElement(RadixPopover.Portal, { container: editorRootElementRef == null ? void 0 : editorRootElementRef.current }, /* @__PURE__ */ React__default.createElement(
332
323
  RadixPopover.PopoverContent,
333
324
  {
@@ -347,10 +338,11 @@ const ColumnEditor = ({
347
338
  type: "single",
348
339
  "aria-label": "Text alignment"
349
340
  },
350
- /* @__PURE__ */ React__default.createElement(RadixToolbar.ToggleItem, { value: "left", title: "Align left" }, /* @__PURE__ */ React__default.createElement(AlignLeftIcon, null)),
351
- /* @__PURE__ */ React__default.createElement(RadixToolbar.ToggleItem, { value: "center", title: "Align center" }, /* @__PURE__ */ React__default.createElement(AlignCenterIcon, null)),
352
- /* @__PURE__ */ React__default.createElement(RadixToolbar.ToggleItem, { value: "right", title: "Align right" }, /* @__PURE__ */ React__default.createElement(AlignRightIcon, null))
353
- ), /* @__PURE__ */ React__default.createElement(RadixToolbar.Separator, null), /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: insertColumnAt.bind(null, colIndex), title: "Insert a column to the left of this one" }, /* @__PURE__ */ React__default.createElement(InsertColLeftIcon, null)), /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: insertColumnAt.bind(null, colIndex + 1), title: "Insert a column to the right of this one" }, /* @__PURE__ */ React__default.createElement(InsertColRightIcon, null)), /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: deleteColumnAt.bind(null, colIndex), title: "Delete this column" }, /* @__PURE__ */ React__default.createElement(DeleteSmallIcon, null)))
341
+ /* @__PURE__ */ React__default.createElement(RadixToolbar.ToggleItem, { value: "left", title: "Align left" }, iconComponentFor("format_align_left")),
342
+ /* @__PURE__ */ React__default.createElement(RadixToolbar.ToggleItem, { value: "center", title: "Align center" }, iconComponentFor("format_align_center")),
343
+ /* @__PURE__ */ React__default.createElement(RadixToolbar.ToggleItem, { value: "right", title: "Align right" }, iconComponentFor("format_align_right"))
344
+ ), /* @__PURE__ */ React__default.createElement(RadixToolbar.Separator, null), /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: insertColumnAt.bind(null, colIndex), title: "Insert a column to the left of this one" }, iconComponentFor("insert_col_left")), /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: insertColumnAt.bind(null, colIndex + 1), title: "Insert a column to the right of this one" }, iconComponentFor("insert_col_right")), /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: deleteColumnAt.bind(null, colIndex), title: "Delete this column" }, iconComponentFor("delete_small"))),
345
+ /* @__PURE__ */ React__default.createElement(RadixPopover.Arrow, { className: styles.popoverArrow })
354
346
  )));
355
347
  };
356
348
  const RowEditor = ({
@@ -361,6 +353,7 @@ const RowEditor = ({
361
353
  setActiveCellWithBoundaries
362
354
  }) => {
363
355
  const [editorRootElementRef] = corePluginHooks.useEmitterValues("editorRootElementRef");
356
+ const [iconComponentFor] = corePluginHooks.useEmitterValues("iconComponentFor");
364
357
  const insertRowAt = React__default.useCallback(
365
358
  (rowIndex2) => {
366
359
  parentEditor.update(() => {
@@ -378,7 +371,7 @@ const RowEditor = ({
378
371
  },
379
372
  [parentEditor, lexicalTable]
380
373
  );
381
- return /* @__PURE__ */ React__default.createElement(RadixPopover.Root, null, /* @__PURE__ */ React__default.createElement(RadixPopover.PopoverTrigger, { className: styles.tableColumnEditorTrigger, "data-active": highlightedCoordinates[1] === rowIndex }, /* @__PURE__ */ React__default.createElement(MoreHorizIcon, null)), /* @__PURE__ */ React__default.createElement(RadixPopover.Portal, { container: editorRootElementRef == null ? void 0 : editorRootElementRef.current }, /* @__PURE__ */ React__default.createElement(
374
+ return /* @__PURE__ */ React__default.createElement(RadixPopover.Root, null, /* @__PURE__ */ React__default.createElement(RadixPopover.PopoverTrigger, { className: styles.tableColumnEditorTrigger, "data-active": highlightedCoordinates[1] === rowIndex }, iconComponentFor("more_horiz")), /* @__PURE__ */ React__default.createElement(RadixPopover.Portal, { container: editorRootElementRef == null ? void 0 : editorRootElementRef.current }, /* @__PURE__ */ React__default.createElement(
382
375
  RadixPopover.PopoverContent,
383
376
  {
384
377
  className: classNames(styles.tableColumnEditorPopoverContent),
@@ -386,7 +379,8 @@ const RowEditor = ({
386
379
  sideOffset: 5,
387
380
  side: "bottom"
388
381
  },
389
- /* @__PURE__ */ React__default.createElement(RadixToolbar.Root, { className: styles.tableColumnEditorToolbar }, /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: insertRowAt.bind(null, rowIndex), title: "Insert a row above this one" }, /* @__PURE__ */ React__default.createElement(InsertRowAboveIcon, null)), /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: insertRowAt.bind(null, rowIndex + 1), title: "Insert a row below this one" }, /* @__PURE__ */ React__default.createElement(InsertRowBelowIcon, null)), /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: deleteRowAt.bind(null, rowIndex), title: "Delete this row" }, /* @__PURE__ */ React__default.createElement(DeleteSmallIcon, null)))
382
+ /* @__PURE__ */ React__default.createElement(RadixToolbar.Root, { className: styles.tableColumnEditorToolbar }, /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: insertRowAt.bind(null, rowIndex), title: "Insert a row above this one" }, iconComponentFor("insert_row_above")), /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: insertRowAt.bind(null, rowIndex + 1), title: "Insert a row below this one" }, iconComponentFor("insert_row_below")), /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { onClick: deleteRowAt.bind(null, rowIndex), title: "Delete this row" }, iconComponentFor("delete_small"))),
383
+ /* @__PURE__ */ React__default.createElement(RadixPopover.Arrow, { className: styles.popoverArrow })
390
384
  )));
391
385
  };
392
386
  export {
@@ -1,3 +1,4 @@
1
+ import type { IconKey } from '../core/Icon';
1
2
  import type { RefObject, ReactNode, ComponentType } from 'react';
2
3
  import type { Options } from 'mdast-util-to-markdown';
3
4
  import type { Config } from 'mdast-util-from-markdown/lib';
@@ -77,6 +78,7 @@ export declare const tableSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
77
78
  convertSelectionToNode: RealmNode<() => ElementNode>;
78
79
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
79
80
  onBlur: RealmNode<FocusEvent>;
81
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
80
82
  }>], (r: Realm, [{ insertDecoratorNode }]: [{
81
83
  activeEditor: RealmNode<LexicalEditor | null>;
82
84
  inFocus: RealmNode<boolean>;
@@ -132,6 +134,7 @@ export declare const tableSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
132
134
  convertSelectionToNode: RealmNode<() => ElementNode>;
133
135
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
134
136
  onBlur: RealmNode<FocusEvent>;
137
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
135
138
  }]) => {
136
139
  insertTable: RealmNode<InsertTablePayload>;
137
140
  }>;
@@ -192,6 +195,7 @@ tablePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
192
195
  convertSelectionToNode: RealmNode<() => ElementNode>;
193
196
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
194
197
  onBlur: RealmNode<FocusEvent>;
198
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
195
199
  }>], (r: Realm, [{ insertDecoratorNode }]: [{
196
200
  activeEditor: RealmNode<LexicalEditor | null>;
197
201
  inFocus: RealmNode<boolean>;
@@ -247,6 +251,7 @@ tablePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
247
251
  convertSelectionToNode: RealmNode<() => ElementNode>;
248
252
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
249
253
  onBlur: RealmNode<FocusEvent>;
254
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
250
255
  }]) => {
251
256
  insertTable: RealmNode<InsertTablePayload>;
252
257
  }>, object>,
@@ -309,8 +314,9 @@ tablePluginHooks: {
309
314
  convertSelectionToNode: RealmNode<() => ElementNode>;
310
315
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
311
316
  onBlur: RealmNode<FocusEvent>;
317
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
312
318
  }>;
313
- 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" | "insertTable">(key: K, callback: (value: ValueForKey<{
319
+ 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" | "insertTable">(key: K, callback: (value: ValueForKey<{
314
320
  insertTable: RealmNode<InsertTablePayload>;
315
321
  } & {
316
322
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -367,6 +373,7 @@ tablePluginHooks: {
367
373
  convertSelectionToNode: RealmNode<() => ElementNode>;
368
374
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
369
375
  onBlur: RealmNode<FocusEvent>;
376
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
370
377
  }, K>) => void) => void;
371
378
  useEmitterValues: <K_1 extends SystemKeys<{
372
379
  insertTable: RealmNode<InsertTablePayload>;
@@ -425,6 +432,7 @@ tablePluginHooks: {
425
432
  convertSelectionToNode: RealmNode<() => ElementNode>;
426
433
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
427
434
  onBlur: RealmNode<FocusEvent>;
435
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
428
436
  }>>(...keys: K_1) => ValuesForKeys<{
429
437
  insertTable: RealmNode<InsertTablePayload>;
430
438
  } & {
@@ -482,6 +490,7 @@ tablePluginHooks: {
482
490
  convertSelectionToNode: RealmNode<() => ElementNode>;
483
491
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
484
492
  onBlur: RealmNode<FocusEvent>;
493
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
485
494
  }, K_1>;
486
495
  usePubKeys: () => (values: SystemDict<{
487
496
  insertTable: RealmNode<InsertTablePayload>;
@@ -540,8 +549,9 @@ tablePluginHooks: {
540
549
  convertSelectionToNode: RealmNode<() => ElementNode>;
541
550
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
542
551
  onBlur: RealmNode<FocusEvent>;
552
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
543
553
  }>) => void;
544
- 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" | "insertTable">(key: K_2) => (value: ValueForKey<{
554
+ 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" | "insertTable">(key: K_2) => (value: ValueForKey<{
545
555
  insertTable: RealmNode<InsertTablePayload>;
546
556
  } & {
547
557
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -598,6 +608,7 @@ tablePluginHooks: {
598
608
  convertSelectionToNode: RealmNode<() => ElementNode>;
599
609
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
600
610
  onBlur: RealmNode<FocusEvent>;
611
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
601
612
  }, K_2>) => void;
602
613
  };
603
614
  export {};
@@ -1,3 +1,4 @@
1
+ import type { IconKey } from '../core/Icon';
1
2
  import type { RefObject, ReactNode, ComponentType } from 'react';
2
3
  import type { Options } from 'mdast-util-to-markdown';
3
4
  import type { Config } from 'mdast-util-from-markdown/lib';
@@ -67,6 +68,7 @@ export declare const thematicBreakSystem: SystemSpec<[SystemSpec<[], (r: Realm)
67
68
  convertSelectionToNode: RealmNode<() => ElementNode>;
68
69
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
69
70
  onBlur: RealmNode<FocusEvent>;
71
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
70
72
  }>], (r: Realm, [{ activeEditor }]: [{
71
73
  activeEditor: RealmNode<LexicalEditor | null>;
72
74
  inFocus: RealmNode<boolean>;
@@ -122,6 +124,7 @@ export declare const thematicBreakSystem: SystemSpec<[SystemSpec<[], (r: Realm)
122
124
  convertSelectionToNode: RealmNode<() => ElementNode>;
123
125
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
124
126
  onBlur: RealmNode<FocusEvent>;
127
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
125
128
  }]) => {
126
129
  insertThematicBreak: RealmNode<true>;
127
130
  }>;
@@ -182,6 +185,7 @@ thematicBreakPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) =>
182
185
  convertSelectionToNode: RealmNode<() => ElementNode>;
183
186
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
184
187
  onBlur: RealmNode<FocusEvent>;
188
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
185
189
  }>], (r: Realm, [{ activeEditor }]: [{
186
190
  activeEditor: RealmNode<LexicalEditor | null>;
187
191
  inFocus: RealmNode<boolean>;
@@ -237,6 +241,7 @@ thematicBreakPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) =>
237
241
  convertSelectionToNode: RealmNode<() => ElementNode>;
238
242
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
239
243
  onBlur: RealmNode<FocusEvent>;
244
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
240
245
  }]) => {
241
246
  insertThematicBreak: RealmNode<true>;
242
247
  }>, object>,
@@ -299,8 +304,9 @@ thematicBreakPluginHooks: {
299
304
  convertSelectionToNode: RealmNode<() => ElementNode>;
300
305
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
301
306
  onBlur: RealmNode<FocusEvent>;
307
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
302
308
  }>;
303
- 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" | "insertThematicBreak">(key: K, callback: (value: ValueForKey<{
309
+ 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" | "insertThematicBreak">(key: K, callback: (value: ValueForKey<{
304
310
  insertThematicBreak: RealmNode<true>;
305
311
  } & {
306
312
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -357,6 +363,7 @@ thematicBreakPluginHooks: {
357
363
  convertSelectionToNode: RealmNode<() => ElementNode>;
358
364
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
359
365
  onBlur: RealmNode<FocusEvent>;
366
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
360
367
  }, K>) => void) => void;
361
368
  useEmitterValues: <K_1 extends SystemKeys<{
362
369
  insertThematicBreak: RealmNode<true>;
@@ -415,6 +422,7 @@ thematicBreakPluginHooks: {
415
422
  convertSelectionToNode: RealmNode<() => ElementNode>;
416
423
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
417
424
  onBlur: RealmNode<FocusEvent>;
425
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
418
426
  }>>(...keys: K_1) => ValuesForKeys<{
419
427
  insertThematicBreak: RealmNode<true>;
420
428
  } & {
@@ -472,6 +480,7 @@ thematicBreakPluginHooks: {
472
480
  convertSelectionToNode: RealmNode<() => ElementNode>;
473
481
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
474
482
  onBlur: RealmNode<FocusEvent>;
483
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
475
484
  }, K_1>;
476
485
  usePubKeys: () => (values: SystemDict<{
477
486
  insertThematicBreak: RealmNode<true>;
@@ -530,8 +539,9 @@ thematicBreakPluginHooks: {
530
539
  convertSelectionToNode: RealmNode<() => ElementNode>;
531
540
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
532
541
  onBlur: RealmNode<FocusEvent>;
542
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
533
543
  }>) => void;
534
- 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" | "insertThematicBreak">(key: K_2) => (value: ValueForKey<{
544
+ 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" | "insertThematicBreak">(key: K_2) => (value: ValueForKey<{
535
545
  insertThematicBreak: RealmNode<true>;
536
546
  } & {
537
547
  activeEditor: RealmNode<LexicalEditor | null>;
@@ -588,5 +598,6 @@ thematicBreakPluginHooks: {
588
598
  convertSelectionToNode: RealmNode<() => ElementNode>;
589
599
  insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
590
600
  onBlur: RealmNode<FocusEvent>;
601
+ iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
591
602
  }, K_2>) => void;
592
603
  };
@@ -2,9 +2,6 @@ import React__default from "react";
2
2
  import { corePluginHooks } from "../../core/index.js";
3
3
  import { IS_BOLD, IS_ITALIC, IS_UNDERLINE } from "../../../FormatConstants.js";
4
4
  import { MultipleChoiceToggleGroup } from "../primitives/toolbar.js";
5
- import BoldIcon from "../../../icons/format_bold.svg.js";
6
- import ItalicIcon from "../../../icons/format_italic.svg.js";
7
- import UnderlinedIcon from "../../../icons/format_underlined.svg.js";
8
5
  const BoldItalicUnderlineToggles = () => {
9
6
  const [currentFormat] = corePluginHooks.useEmitterValues("currentFormat");
10
7
  const applyFormat = corePluginHooks.usePublisher("applyFormat");
@@ -14,15 +11,16 @@ const BoldItalicUnderlineToggles = () => {
14
11
  const boldTitle = boldIsOn ? "Remove bold" : "Bold";
15
12
  const italicTitle = italicIsOn ? "Remove italic" : "Italic";
16
13
  const underlineTitle = underlineIsOn ? "Remove underline" : "Underline";
14
+ const [iconComponentFor] = corePluginHooks.useEmitterValues("iconComponentFor");
17
15
  return /* @__PURE__ */ React__default.createElement(
18
16
  MultipleChoiceToggleGroup,
19
17
  {
20
18
  items: [
21
- { title: boldTitle, contents: /* @__PURE__ */ React__default.createElement(BoldIcon, null), active: boldIsOn, onChange: applyFormat.bind(null, "bold") },
22
- { title: italicTitle, contents: /* @__PURE__ */ React__default.createElement(ItalicIcon, null), active: italicIsOn, onChange: applyFormat.bind(null, "italic") },
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") },
23
21
  {
24
22
  title: underlineTitle,
25
- contents: /* @__PURE__ */ React__default.createElement(UnderlinedIcon, { style: { transform: "translateY(2px)" } }),
23
+ contents: /* @__PURE__ */ React__default.createElement("div", { style: { transform: "translateY(2px)" } }, iconComponentFor("format_underlined")),
26
24
  active: underlineIsOn,
27
25
  onChange: applyFormat.bind(null, "underline")
28
26
  }
@@ -1,17 +1,16 @@
1
1
  import React__default from "react";
2
2
  import { IS_CODE } from "../../../FormatConstants.js";
3
- import CodeIcon from "../../../icons/code.svg.js";
4
3
  import { corePluginHooks } from "../../core/index.js";
5
4
  import { MultipleChoiceToggleGroup } from "../primitives/toolbar.js";
6
5
  const CodeToggle = () => {
7
- const [currentFormat] = corePluginHooks.useEmitterValues("currentFormat");
6
+ const [currentFormat, iconComponentFor] = corePluginHooks.useEmitterValues("currentFormat", "iconComponentFor");
8
7
  const applyFormat = corePluginHooks.usePublisher("applyFormat");
9
8
  const codeIsOn = (currentFormat & IS_CODE) !== 0;
10
9
  const title = codeIsOn ? "Remove code format" : "Inline code format";
11
10
  return /* @__PURE__ */ React__default.createElement(
12
11
  MultipleChoiceToggleGroup,
13
12
  {
14
- items: [{ title, contents: /* @__PURE__ */ React__default.createElement(CodeIcon, null), active: codeIsOn, onChange: applyFormat.bind(null, "code") }]
13
+ items: [{ title, contents: iconComponentFor("code"), active: codeIsOn, onChange: applyFormat.bind(null, "code") }]
15
14
  }
16
15
  );
17
16
  };
@@ -1,9 +1,9 @@
1
1
  import React__default from "react";
2
2
  import { ButtonWithTooltip } from "../primitives/toolbar.js";
3
- import LinkIcon from "../../../icons/link.svg.js";
4
3
  import { linkDialogPluginHooks } from "../../link-dialog/index.js";
5
4
  const CreateLink = () => {
6
5
  const openLinkDialog = linkDialogPluginHooks.usePublisher("openLinkEditDialog");
6
+ const [iconComponentFor] = linkDialogPluginHooks.useEmitterValues("iconComponentFor");
7
7
  return /* @__PURE__ */ React__default.createElement(
8
8
  ButtonWithTooltip,
9
9
  {
@@ -12,7 +12,7 @@ const CreateLink = () => {
12
12
  openLinkDialog(true);
13
13
  }
14
14
  },
15
- /* @__PURE__ */ React__default.createElement(LinkIcon, null)
15
+ iconComponentFor("link")
16
16
  );
17
17
  };
18
18
  export {
@@ -1,22 +1,20 @@
1
1
  import React__default from "react";
2
2
  import { diffSourcePluginHooks } from "../../diff-source/index.js";
3
3
  import { SingleChoiceToggleGroup } from "../primitives/toolbar.js";
4
- import RichTextIcon from "../../../icons/rich_text.svg.js";
5
- import DiffIcon from "../../../icons/difference.svg.js";
6
- import SourceIcon from "../../../icons/markdown.svg.js";
7
4
  import styles from "../../../styles/ui.module.css.js";
8
5
  const DiffSourceToggleWrapper = ({ children }) => {
9
6
  const [viewMode] = diffSourcePluginHooks.useEmitterValues("viewMode");
10
7
  const changeViewMode = diffSourcePluginHooks.usePublisher("viewMode");
8
+ const [iconComponentFor] = diffSourcePluginHooks.useEmitterValues("iconComponentFor");
11
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(
12
10
  SingleChoiceToggleGroup,
13
11
  {
14
12
  className: styles.diffSourceToggle,
15
13
  value: viewMode,
16
14
  items: [
17
- { title: "Rich text", contents: /* @__PURE__ */ React__default.createElement(RichTextIcon, null), value: "rich-text" },
18
- { title: "Diff mode", contents: /* @__PURE__ */ React__default.createElement(DiffIcon, null), value: "diff" },
19
- { title: "Source", contents: /* @__PURE__ */ React__default.createElement(SourceIcon, null), value: "source" }
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" }
20
18
  ],
21
19
  onChange: (value) => changeViewMode(value || "rich-text")
22
20
  }
@@ -1,10 +1,10 @@
1
1
  import React__default from "react";
2
2
  import { ButtonOrDropdownButton } from "../primitives/toolbar.js";
3
- import AdmonitionIcon from "../../../icons/emergency_home.svg.js";
4
3
  import { directivesPluginHooks } from "../../directives/index.js";
5
4
  import { ADMONITION_TYPES } from "../../../directive-editors/AdmonitionDirectiveDescriptor.js";
6
5
  const InsertAdmonition = () => {
7
6
  const insertDirective = directivesPluginHooks.usePublisher("insertDirective");
7
+ const [iconComponentFor] = directivesPluginHooks.useEmitterValues("iconComponentFor");
8
8
  const items = React__default.useMemo(
9
9
  () => ADMONITION_TYPES.map((type) => ({ value: type, label: type.replace(/^./, (l) => l.toUpperCase()) })),
10
10
  []
@@ -21,7 +21,7 @@ const InsertAdmonition = () => {
21
21
  },
22
22
  items
23
23
  },
24
- /* @__PURE__ */ React__default.createElement(AdmonitionIcon, null)
24
+ iconComponentFor("admonition")
25
25
  );
26
26
  };
27
27
  export {
@@ -1,9 +1,9 @@
1
1
  import React__default from "react";
2
2
  import { ButtonWithTooltip } from "../primitives/toolbar.js";
3
- import FrameSourceIcon from "../../../icons/frame_source.svg.js";
4
3
  import { codeBlockPluginHooks } from "../../codeblock/index.js";
5
4
  const InsertCodeBlock = () => {
6
5
  const insertCodeBlock = codeBlockPluginHooks.usePublisher("insertCodeBlock");
6
+ const [iconComponentFor] = codeBlockPluginHooks.useEmitterValues("iconComponentFor");
7
7
  return /* @__PURE__ */ React__default.createElement(
8
8
  ButtonWithTooltip,
9
9
  {
@@ -12,7 +12,7 @@ const InsertCodeBlock = () => {
12
12
  insertCodeBlock({});
13
13
  }
14
14
  },
15
- /* @__PURE__ */ React__default.createElement(FrameSourceIcon, null)
15
+ iconComponentFor("frame_source")
16
16
  );
17
17
  };
18
18
  export {
@@ -1,12 +1,12 @@
1
1
  import React__default from "react";
2
2
  import { ButtonWithTooltip } from "../primitives/toolbar.js";
3
- import FrontmatterIcon from "../../../icons/frontmatter.svg.js";
4
3
  import { frontmatterPluginHooks } from "../../frontmatter/index.js";
5
4
  import styles from "../../../styles/ui.module.css.js";
6
5
  import classNames from "classnames";
7
6
  const InsertFrontmatter = () => {
8
7
  const insertFrontmatter = frontmatterPluginHooks.usePublisher("insertFrontmatter");
9
8
  const [hasFrontmatter] = frontmatterPluginHooks.useEmitterValues("hasFrontmatter");
9
+ const [iconComponentFor] = frontmatterPluginHooks.useEmitterValues("iconComponentFor");
10
10
  return /* @__PURE__ */ React__default.createElement(
11
11
  ButtonWithTooltip,
12
12
  {
@@ -16,7 +16,7 @@ const InsertFrontmatter = () => {
16
16
  }),
17
17
  onClick: insertFrontmatter.bind(null, true)
18
18
  },
19
- /* @__PURE__ */ React__default.createElement(FrontmatterIcon, null)
19
+ iconComponentFor("frontmatter")
20
20
  );
21
21
  };
22
22
  export {
@@ -1,14 +1,13 @@
1
1
  import React__default from "react";
2
2
  import { imagePluginHooks } from "../../image/index.js";
3
3
  import * as RadixToolbar from "@radix-ui/react-toolbar";
4
- import AddPhotoIcon from "../../../icons/add_photo.svg.js";
5
4
  import styles from "../../../styles/ui.module.css.js";
6
5
  import { corePluginHooks } from "../../core/index.js";
7
6
  import { TooltipWrap } from "../primitives/TooltipWrap.js";
8
7
  const InsertImage = React__default.forwardRef((_, forwardedRef) => {
9
8
  const openNewImageDialog = imagePluginHooks.usePublisher("openNewImageDialog");
10
- const [readOnly] = corePluginHooks.useEmitterValues("readOnly");
11
- 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" }, /* @__PURE__ */ React__default.createElement(AddPhotoIcon, null)));
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")));
12
11
  });
13
12
  export {
14
13
  InsertImage
@@ -1,12 +1,12 @@
1
1
  import React__default from "react";
2
2
  import { ButtonOrDropdownButton } from "../primitives/toolbar.js";
3
- import LiveCodeIcon from "../../../icons/deployed_code.svg.js";
4
3
  import { sandpackPluginHooks } from "../../sandpack/index.js";
5
4
  const InsertSandpack = () => {
6
5
  const [sandpackConfig] = sandpackPluginHooks.useEmitterValues("sandpackConfig");
7
6
  const insertSandpack = sandpackPluginHooks.usePublisher("insertSandpack");
8
7
  const items = React__default.useMemo(() => sandpackConfig.presets.map((preset) => ({ value: preset.name, label: preset.label })), [sandpackConfig]);
9
- return /* @__PURE__ */ React__default.createElement(ButtonOrDropdownButton, { title: "Insert Sandpack", onChoose: insertSandpack, items }, /* @__PURE__ */ React__default.createElement(LiveCodeIcon, null));
8
+ const [iconComponentFor] = sandpackPluginHooks.useEmitterValues("iconComponentFor");
9
+ return /* @__PURE__ */ React__default.createElement(ButtonOrDropdownButton, { title: "Insert Sandpack", onChoose: insertSandpack, items }, iconComponentFor("sandpack"));
10
10
  };
11
11
  export {
12
12
  InsertSandpack
@@ -1,8 +1,8 @@
1
1
  import { ButtonWithTooltip } from "../primitives/toolbar.js";
2
2
  import React__default from "react";
3
3
  import { tablePluginHooks } from "../../table/index.js";
4
- import TableIcon from "../../../icons/table.svg.js";
5
4
  const InsertTable = () => {
5
+ const [iconComponentFor] = tablePluginHooks.useEmitterValues("iconComponentFor");
6
6
  const insertTable = tablePluginHooks.usePublisher("insertTable");
7
7
  return /* @__PURE__ */ React__default.createElement(
8
8
  ButtonWithTooltip,
@@ -12,7 +12,7 @@ const InsertTable = () => {
12
12
  insertTable({ rows: 3, columns: 3 });
13
13
  }
14
14
  },
15
- /* @__PURE__ */ React__default.createElement(TableIcon, null)
15
+ iconComponentFor("table")
16
16
  );
17
17
  };
18
18
  export {
@@ -1,10 +1,10 @@
1
1
  import React__default from "react";
2
2
  import { thematicBreakPluginHooks } from "../../thematic-break/index.js";
3
3
  import { ButtonWithTooltip } from "../primitives/toolbar.js";
4
- import HorizontalRuleIcon from "../../../icons/horizontal_rule.svg.js";
5
4
  const InsertThematicBreak = () => {
6
5
  const insertThematicBreak = thematicBreakPluginHooks.usePublisher("insertThematicBreak");
7
- return /* @__PURE__ */ React__default.createElement(ButtonWithTooltip, { title: "Insert thematic break", onClick: insertThematicBreak.bind(null, true) }, /* @__PURE__ */ React__default.createElement(HorizontalRuleIcon, null));
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
8
  };
9
9
  export {
10
10
  InsertThematicBreak
@@ -1,20 +1,18 @@
1
1
  import React__default from "react";
2
- import BulletedListIcon from "../../../icons/format_list_bulleted.svg.js";
3
- import NumberedListIcon from "../../../icons/format_list_numbered.svg.js";
4
- import CheckedListIcon from "../../../icons/format_list_checked.svg.js";
5
2
  import { listsPluginHooks } from "../../lists/index.js";
6
3
  import { SingleChoiceToggleGroup } from "../primitives/toolbar.js";
7
4
  const ListsToggle = () => {
8
5
  const [currentListType] = listsPluginHooks.useEmitterValues("currentListType");
9
6
  const applyListType = listsPluginHooks.usePublisher("applyListType");
7
+ const [iconComponentFor] = listsPluginHooks.useEmitterValues("iconComponentFor");
10
8
  return /* @__PURE__ */ React__default.createElement(
11
9
  SingleChoiceToggleGroup,
12
10
  {
13
11
  value: currentListType || "",
14
12
  items: [
15
- { title: "Bulleted list", contents: /* @__PURE__ */ React__default.createElement(BulletedListIcon, null), value: "bullet" },
16
- { title: "Numbered list", contents: /* @__PURE__ */ React__default.createElement(NumberedListIcon, null), value: "number" },
17
- { title: "Check list", contents: /* @__PURE__ */ React__default.createElement(CheckedListIcon, null), value: "check" }
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" }
18
16
  ],
19
17
  onChange: applyListType
20
18
  }