tinacms 0.0.0-8eeb2df-20241010045955 → 0.0.0-a318f2f-20241010063440

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.
package/dist/index.mjs CHANGED
@@ -6,28 +6,29 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  import { z } from "zod";
8
8
  import * as React from "react";
9
- import React__default, { useState, useCallback, createContext, forwardRef, useContext, useEffect, useMemo, startTransition, useRef, createElement, Component } from "react";
9
+ import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition, createElement, Component } from "react";
10
10
  import { createPortal, findDOMNode } from "react-dom";
11
+ import { withRef, cn as cn$1, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
11
12
  import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createBoldPlugin, createItalicPlugin, createUnderlinePlugin, createCodePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
12
- import { useSelected, useReadOnly, ReactEditor } from "slate-react";
13
+ import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, useMarkToolbarButtonState, useMarkToolbarButton, insertEmptyElement, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
13
14
  import { ELEMENT_SLASH_INPUT, createSlashPlugin } from "@udecode/plate-slash-command";
14
- import { cn as cn$1, withRef, withVariants, withCn, withProps, createPrimitiveElement } from "@udecode/cn";
15
- import { useComposedRef, useEditorRef, findNodePath, getPointBefore, createPointRef, insertText, moveSelection, PlateElement, toggleNodeType, PlateLeaf, isCollapsed, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, setNodes, isElement, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, createPluginFactory, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, useMarkToolbarButtonState, useMarkToolbarButton, useEditorState, getNodeEntries, collapseSelection, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
16
- import { ELEMENT_H1, ELEMENT_H2, ELEMENT_H3, ELEMENT_H4 as ELEMENT_H4$1, ELEMENT_H5 as ELEMENT_H5$1, ELEMENT_H6 as ELEMENT_H6$1 } from "@udecode/plate-heading";
15
+ import { useSelected, useReadOnly, ReactEditor } from "slate-react";
16
+ import { useCodeBlockElementState, useCodeSyntaxLeaf, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
17
+ import MonacoEditor, { loader, useMonaco } from "@monaco-editor/react";
18
+ import { Combobox, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$3, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
17
19
  import { cva } from "class-variance-authority";
18
- import { Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, ChevronDown, PaintBucket, Quote, Check, ChevronRight, ChevronsUpDown, X, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Search, Settings, Strikethrough, Subscript, Superscript, Table, Text, Underline, Link2Off, Eye, Moon, SunMedium, Twitter } from "lucide-react";
19
- import { useComboboxContext, Combobox, useComboboxStore, ComboboxProvider, Portal, ComboboxPopover, ComboboxItem } from "@ariakit/react";
20
+ import { Eye, SquarePen, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, ChevronDown, PaintBucket, Quote, Check, ChevronRight, ChevronsUpDown, X, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Search, Settings, Strikethrough, Subscript, Superscript, Table, Text, Underline, Link2Off, Moon, SunMedium, Twitter } from "lucide-react";
21
+ import mermaid from "mermaid";
22
+ import { ELEMENT_H1, ELEMENT_H2, ELEMENT_H3, ELEMENT_H4 as ELEMENT_H4$1, ELEMENT_H5 as ELEMENT_H5$1, ELEMENT_H6 as ELEMENT_H6$1 } from "@udecode/plate-heading";
23
+ import { useComboboxContext, Combobox as Combobox$1, useComboboxStore, ComboboxProvider, Portal, ComboboxPopover, ComboboxItem } from "@ariakit/react";
20
24
  import { useHTMLInputCursorState, useComboboxInput, filterWords } from "@udecode/plate-combobox";
21
- import { useCodeSyntaxLeaf, useCodeBlockElementState, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
22
- import MonacoEditor, { loader, useMonaco } from "@monaco-editor/react";
23
- import { Combobox as Combobox$1, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$3, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
25
+ import { useTableCellElementState, useTableCellElement, useTableCellElementResizableState, useTableCellElementResizable, useTableBordersDropdownMenuContentState, useTableMergeState, TableProvider, useTableElementState, useTableElement, mergeTableCells, unmergeTableCells, ELEMENT_TABLE as ELEMENT_TABLE$1, getTableColumnCount, insertTable, deleteTable, insertTableColumn, deleteColumn, insertTableRow, deleteRow } from "@udecode/plate-table";
26
+ import { ResizeHandle as ResizeHandle$1 } from "@udecode/plate-resizable";
24
27
  import * as PopoverPrimitive from "@radix-ui/react-popover";
25
28
  import { PopoverAnchor } from "@radix-ui/react-popover";
26
- import { useTableBordersDropdownMenuContentState, useTableMergeState, TableProvider, useTableElementState, useTableElement, mergeTableCells, unmergeTableCells, useTableCellElementState, useTableCellElement, useTableCellElementResizableState, useTableCellElementResizable, ELEMENT_TABLE as ELEMENT_TABLE$1, getTableColumnCount, insertTable, deleteTable, insertTableColumn, deleteColumn, insertTableRow, deleteRow } from "@udecode/plate-table";
27
29
  import { Slot } from "@radix-ui/react-slot";
28
30
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
29
31
  import * as SeparatorPrimitive from "@radix-ui/react-separator";
30
- import { ResizeHandle as ResizeHandle$1 } from "@udecode/plate-resizable";
31
32
  import arrayMutators from "final-form-arrays";
32
33
  import setFieldData from "final-form-set-field-data";
33
34
  import { FORM_ERROR, createForm, getIn } from "final-form";
@@ -908,6 +909,20 @@ const useEditorContext = () => {
908
909
  const useTemplates = () => {
909
910
  return React__default.useContext(EditorContext);
910
911
  };
912
+ const BlockquoteElement = withRef(
913
+ ({ children, className, ...props }, ref) => {
914
+ return /* @__PURE__ */ React__default.createElement(
915
+ PlateElement,
916
+ {
917
+ asChild: true,
918
+ className: cn$1("my-1 border-l-2 pl-6 italic", className),
919
+ ref,
920
+ ...props
921
+ },
922
+ /* @__PURE__ */ React__default.createElement("blockquote", null, children)
923
+ );
924
+ }
925
+ );
911
926
  function classNames$1(...classes) {
912
927
  return classes.filter(Boolean).join(" ");
913
928
  }
@@ -917,161 +932,681 @@ const uuid = () => {
917
932
  (c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
918
933
  );
919
934
  };
920
- const RawMarkdown = () => {
935
+ function ChevronDownIcon(props, svgRef) {
936
+ return /* @__PURE__ */ React.createElement("svg", Object.assign({
937
+ xmlns: "http://www.w3.org/2000/svg",
938
+ viewBox: "0 0 20 20",
939
+ fill: "currentColor",
940
+ "aria-hidden": "true",
941
+ ref: svgRef
942
+ }, props), /* @__PURE__ */ React.createElement("path", {
943
+ fillRule: "evenodd",
944
+ d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
945
+ clipRule: "evenodd"
946
+ }));
947
+ }
948
+ const ForwardRef = React.forwardRef(ChevronDownIcon);
949
+ const ChevronDownIcon$1 = ForwardRef;
950
+ const Autocomplete = ({
951
+ value,
952
+ onChange,
953
+ defaultQuery,
954
+ items: items2
955
+ }) => {
956
+ const [query, setQuery] = React__default.useState(defaultQuery ?? "");
957
+ const filteredItems = React__default.useMemo(() => {
958
+ try {
959
+ const reFilter = new RegExp(query, "i");
960
+ const _items = items2.filter((item) => reFilter.test(item.label));
961
+ if (_items.length === 0)
962
+ return items2;
963
+ return _items;
964
+ } catch (err) {
965
+ return items2;
966
+ }
967
+ }, [items2, query]);
921
968
  return /* @__PURE__ */ React__default.createElement(
922
- "svg",
969
+ Combobox,
923
970
  {
924
- stroke: "currentColor",
925
- fill: "currentColor",
926
- strokeWidth: 0,
927
- role: "img",
928
- className: "h-5 w-5",
929
- viewBox: "0 0 24 24",
930
- height: "1em",
931
- width: "1em",
932
- xmlns: "http://www.w3.org/2000/svg"
971
+ value,
972
+ onChange,
973
+ as: "div",
974
+ className: "relative inline-block text-left z-20"
933
975
  },
934
- /* @__PURE__ */ React__default.createElement("title", null),
935
- /* @__PURE__ */ React__default.createElement("path", { d: "M22.27 19.385H1.73A1.73 1.73 0 010 17.655V6.345a1.73 1.73 0 011.73-1.73h20.54A1.73 1.73 0 0124 6.345v11.308a1.73 1.73 0 01-1.73 1.731zM5.769 15.923v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.46v7.847zM21.232 12h-2.309V8.077h-2.307V12h-2.308l3.461 4.039z" })
976
+ /* @__PURE__ */ React__default.createElement("div", { className: "mt-1" }, /* @__PURE__ */ React__default.createElement("div", { className: "relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left shadow-md sm:text-sm" }, /* @__PURE__ */ React__default.createElement(
977
+ ComboboxInput,
978
+ {
979
+ className: "w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 focus:ring-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-teal-300",
980
+ displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
981
+ onChange: (event) => setQuery(event.target.value),
982
+ onClick: (ev) => ev.stopPropagation()
983
+ }
984
+ ), /* @__PURE__ */ React__default.createElement(ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React__default.createElement(
985
+ ChevronDownIcon$1,
986
+ {
987
+ className: "h-5 w-5 text-gray-400",
988
+ "aria-hidden": "true"
989
+ }
990
+ )))),
991
+ /* @__PURE__ */ React__default.createElement(
992
+ Transition,
993
+ {
994
+ enter: "transition ease-out duration-100",
995
+ enterFrom: "transform opacity-0 scale-95",
996
+ enterTo: "transform opacity-100 scale-100",
997
+ leave: "transition ease-in duration-75",
998
+ leaveFrom: "transform opacity-100 scale-100",
999
+ leaveTo: "transform opacity-0 scale-95"
1000
+ },
1001
+ /* @__PURE__ */ React__default.createElement(ComboboxOptions, { className: "origin-top-right absolute right-0 mt-1 w-full max-h-[300px] overflow-y-auto rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, filteredItems.map((item) => /* @__PURE__ */ React__default.createElement(ComboboxOption, { key: item.key, value: item }, ({ focus }) => /* @__PURE__ */ React__default.createElement(
1002
+ "button",
1003
+ {
1004
+ className: classNames$1(
1005
+ focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
1006
+ "block px-4 py-2 text-xs w-full text-right"
1007
+ )
1008
+ },
1009
+ item.render(item)
1010
+ ))))
1011
+ )
936
1012
  );
937
1013
  };
938
- const borderAll = (props) => /* @__PURE__ */ React__default.createElement(
939
- "svg",
940
- {
941
- viewBox: "0 0 24 24",
942
- height: "48",
943
- width: "48",
944
- focusable: "false",
945
- role: "img",
946
- fill: "currentColor",
947
- xmlns: "http://www.w3.org/2000/svg",
948
- ...props
949
- },
950
- /* @__PURE__ */ React__default.createElement("path", { d: "M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6zm10 13h5a1 1 0 0 0 1-1v-5h-6v6zm-2-6H5v5a1 1 0 0 0 1 1h5v-6zm2-2h6V6a1 1 0 0 0-1-1h-5v6zm-2-6H6a1 1 0 0 0-1 1v5h6V5z" })
951
- );
952
- const borderBottom = (props) => /* @__PURE__ */ React__default.createElement(
953
- "svg",
954
- {
955
- viewBox: "0 0 24 24",
956
- height: "48",
957
- width: "48",
958
- focusable: "false",
959
- role: "img",
960
- fill: "currentColor",
961
- xmlns: "http://www.w3.org/2000/svg",
962
- ...props
963
- },
964
- /* @__PURE__ */ React__default.createElement("path", { d: "M13 5a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm-8 6a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm-2 7a1 1 0 1 1 2 0 1 1 0 0 0 1 1h12a1 1 0 0 0 1-1 1 1 0 1 1 2 0 3 3 0 0 1-3 3H6a3 3 0 0 1-3-3zm17-8a1 1 0 0 0-1 1v2a1 1 0 1 0 2 0v-2a1 1 0 0 0-1-1zM7 4a1 1 0 0 0-1-1 3 3 0 0 0-3 3 1 1 0 0 0 2 0 1 1 0 0 1 1-1 1 1 0 0 0 1-1zm11-1a1 1 0 1 0 0 2 1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3z" })
965
- );
966
- const borderLeft = (props) => /* @__PURE__ */ React__default.createElement(
967
- "svg",
968
- {
969
- viewBox: "0 0 24 24",
970
- height: "48",
971
- width: "48",
972
- focusable: "false",
973
- role: "img",
974
- fill: "currentColor",
975
- xmlns: "http://www.w3.org/2000/svg",
976
- ...props
977
- },
978
- /* @__PURE__ */ React__default.createElement("path", { d: "M6 21a1 1 0 1 0 0-2 1 1 0 0 1-1-1V6a1 1 0 0 1 1-1 1 1 0 0 0 0-2 3 3 0 0 0-3 3v12a3 3 0 0 0 3 3zm7-16a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm6 6a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm4-17a1 1 0 1 0 0 2 1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3zm-1 17a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" })
979
- );
980
- const borderNone = (props) => /* @__PURE__ */ React__default.createElement(
981
- "svg",
982
- {
983
- viewBox: "0 0 24 24",
984
- height: "48",
985
- width: "48",
986
- focusable: "false",
987
- role: "img",
988
- fill: "currentColor",
989
- xmlns: "http://www.w3.org/2000/svg",
990
- ...props
991
- },
992
- /* @__PURE__ */ React__default.createElement("path", { d: "M14 4a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-9 7a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-6 10a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zM7 4a1 1 0 0 0-1-1 3 3 0 0 0-3 3 1 1 0 0 0 2 0 1 1 0 0 1 1-1 1 1 0 0 0 1-1zm11-1a1 1 0 1 0 0 2 1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3zM7 20a1 1 0 0 1-1 1 3 3 0 0 1-3-3 1 1 0 1 1 2 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1zm11 1a1 1 0 1 1 0-2 1 1 0 0 0 1-1 1 1 0 1 1 2 0 3 3 0 0 1-3 3z" })
993
- );
994
- const borderRight = (props) => /* @__PURE__ */ React__default.createElement(
995
- "svg",
996
- {
997
- viewBox: "0 0 24 24",
998
- height: "48",
999
- width: "48",
1000
- focusable: "false",
1001
- role: "img",
1002
- fill: "currentColor",
1003
- xmlns: "http://www.w3.org/2000/svg",
1004
- ...props
1005
- },
1006
- /* @__PURE__ */ React__default.createElement("path", { d: "M13 5a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm-8 6a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm9 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zM6 3a1 1 0 0 1 0 2 1 1 0 0 0-1 1 1 1 0 0 1-2 0 3 3 0 0 1 3-3zm1 17a1 1 0 0 1-1 1 3 3 0 0 1-3-3 1 1 0 1 1 2 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1zm11 1a1 1 0 1 1 0-2 1 1 0 0 0 1-1V6a1 1 0 0 0-1-1 1 1 0 1 1 0-2 3 3 0 0 1 3 3v12a3 3 0 0 1-3 3z" })
1007
- );
1008
- const borderTop = (props) => /* @__PURE__ */ React__default.createElement(
1009
- "svg",
1010
- {
1011
- viewBox: "0 0 24 24",
1012
- height: "48",
1013
- width: "48",
1014
- focusable: "false",
1015
- role: "img",
1016
- fill: "currentColor",
1017
- xmlns: "http://www.w3.org/2000/svg",
1018
- ...props
1019
- },
1020
- /* @__PURE__ */ React__default.createElement("path", { d: "M3 6a1 1 0 0 0 2 0 1 1 0 0 1 1-1h12a1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3zm2 5a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-8 1a1 1 0 1 0 0-2 1 1 0 0 1-1-1 1 1 0 1 0-2 0 3 3 0 0 0 3 3zm11-1a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" })
1021
- );
1022
- const iconVariants = cva("", {
1023
- variants: {
1024
- variant: {
1025
- toolbar: "size-5",
1026
- menuItem: "mr-2 size-5"
1027
- },
1028
- size: {
1029
- sm: "mr-2 size-4",
1030
- md: "mr-2 size-6"
1031
- }
1032
- },
1033
- defaultVariants: {}
1014
+ loader.config({
1015
+ paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
1034
1016
  });
1035
- const DoubleColumnOutlined = (props) => /* @__PURE__ */ React__default.createElement(
1036
- "svg",
1037
- {
1038
- fill: "none",
1039
- height: "16",
1040
- viewBox: "0 0 16 16",
1041
- width: "16",
1042
- xmlns: "http://www.w3.org/2000/svg",
1043
- ...props
1044
- },
1045
- /* @__PURE__ */ React__default.createElement(
1046
- "path",
1047
- {
1048
- clipRule: "evenodd",
1049
- d: "M8.5 3H13V13H8.5V3ZM7.5 2H8.5H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H8.5H7.5H3C2.44772 14 2 13.5523 2 13V3C2 2.44772 2.44772 2 3 2H7.5ZM7.5 13H3L3 3H7.5V13Z",
1050
- fill: "#595E6F",
1051
- fillRule: "evenodd"
1052
- }
1053
- )
1054
- );
1055
- const ThreeColumnOutlined = (props) => /* @__PURE__ */ React__default.createElement(
1056
- "svg",
1057
- {
1058
- fill: "none",
1059
- height: "16",
1060
- viewBox: "0 0 16 16",
1061
- width: "16",
1062
- xmlns: "http://www.w3.org/2000/svg",
1063
- ...props
1064
- },
1065
- /* @__PURE__ */ React__default.createElement(
1066
- "path",
1067
- {
1068
- clipRule: "evenodd",
1069
- d: "M9.25 3H6.75V13H9.25V3ZM9.25 2H6.75H5.75H3C2.44772 2 2 2.44772 2 3V13C2 13.5523 2.44772 14 3 14H5.75H6.75H9.25H10.25H13C13.5523 14 14 13.5523 14 13V3C14 2.44772 13.5523 2 13 2H10.25H9.25ZM10.25 3V13H13V3H10.25ZM3 13H5.75V3H3L3 13Z",
1070
- fill: "#4C5161",
1071
- fillRule: "evenodd"
1017
+ let retryCount = 0;
1018
+ const retryFocus = (ref) => {
1019
+ if (ref.current) {
1020
+ ref.current.focus();
1021
+ } else {
1022
+ if (retryCount < 30) {
1023
+ setTimeout(() => {
1024
+ retryCount = retryCount + 1;
1025
+ retryFocus(ref);
1026
+ }, 100);
1072
1027
  }
1073
- )
1074
- );
1028
+ }
1029
+ };
1030
+ const MINIMUM_HEIGHT = 75;
1031
+ const CodeBlock = ({
1032
+ attributes,
1033
+ editor,
1034
+ element,
1035
+ language: restrictLanguage,
1036
+ onChangeCallback,
1037
+ defaultValue,
1038
+ ...props
1039
+ }) => {
1040
+ const [navigateAway, setNavigateAway] = React__default.useState(null);
1041
+ const monaco = useMonaco();
1042
+ const monacoEditorRef = React__default.useRef(null);
1043
+ const selected = useSelected();
1044
+ const [height, setHeight] = React__default.useState(MINIMUM_HEIGHT);
1045
+ React__default.useEffect(() => {
1046
+ if (selected && isCollapsed(editor.selection)) {
1047
+ retryFocus(monacoEditorRef);
1048
+ }
1049
+ }, [selected, monacoEditorRef.current]);
1050
+ const value = element.value || "";
1051
+ if (typeof value !== "string") {
1052
+ throw new Error("Element must be of type string for code block");
1053
+ }
1054
+ const language = restrictLanguage || element.lang;
1055
+ const id = React__default.useMemo(() => uuid(), []);
1056
+ const languages = React__default.useMemo(() => {
1057
+ const defaultLangSet = { "": "plain text" };
1058
+ if (!monaco)
1059
+ return defaultLangSet;
1060
+ return monaco.languages.getLanguages().reduce((ac, cv) => {
1061
+ if (cv.id === "plaintext")
1062
+ return ac;
1063
+ return { ...ac, [cv.id]: cv.id };
1064
+ }, defaultLangSet);
1065
+ }, [monaco]);
1066
+ React__default.useEffect(() => {
1067
+ if (monaco) {
1068
+ monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
1069
+ monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
1070
+ // disable errors
1071
+ noSemanticValidation: true,
1072
+ noSyntaxValidation: true
1073
+ });
1074
+ }
1075
+ }, [monaco]);
1076
+ const items2 = Object.entries(languages).map(([key, label]) => ({
1077
+ key,
1078
+ label,
1079
+ render: (item) => item.label
1080
+ }));
1081
+ const currentItem = React__default.useMemo(() => {
1082
+ return items2.find((item) => item.key === language) ?? {
1083
+ key: "",
1084
+ label: "Plain Text"
1085
+ };
1086
+ }, [items2, language]);
1087
+ React__default.useEffect(() => {
1088
+ if (navigateAway) {
1089
+ setNavigateAway(null);
1090
+ switch (navigateAway) {
1091
+ case "remove":
1092
+ {
1093
+ focusEditor(editor);
1094
+ setNodes(
1095
+ editor,
1096
+ {
1097
+ type: "p",
1098
+ children: [{ text: "" }],
1099
+ lang: void 0,
1100
+ value: void 0
1101
+ },
1102
+ {
1103
+ match: (n) => {
1104
+ if (isElement(n) && n.type === element.type) {
1105
+ return true;
1106
+ }
1107
+ }
1108
+ }
1109
+ );
1110
+ }
1111
+ break;
1112
+ case "insertNext":
1113
+ {
1114
+ insertNodes(
1115
+ editor,
1116
+ [
1117
+ {
1118
+ type: ELEMENT_DEFAULT,
1119
+ children: [{ text: "" }],
1120
+ lang: void 0,
1121
+ value: void 0
1122
+ }
1123
+ ],
1124
+ { select: true }
1125
+ );
1126
+ focusEditor(editor);
1127
+ }
1128
+ break;
1129
+ case "up":
1130
+ {
1131
+ const path = findNodePath(editor, element);
1132
+ if (!path) {
1133
+ return;
1134
+ }
1135
+ const previousNodePath = getPointBefore(editor, path);
1136
+ if (!previousNodePath) {
1137
+ focusEditor(editor);
1138
+ insertNodes(
1139
+ editor,
1140
+ [
1141
+ {
1142
+ type: ELEMENT_DEFAULT,
1143
+ children: [{ text: "" }],
1144
+ lang: void 0,
1145
+ value: void 0
1146
+ }
1147
+ ],
1148
+ // Insert a new node at the current path, resulting in the code_block
1149
+ // moving down one block
1150
+ { at: path, select: true }
1151
+ );
1152
+ return;
1153
+ }
1154
+ focusEditor(editor, previousNodePath);
1155
+ }
1156
+ break;
1157
+ case "down": {
1158
+ const path = findNodePath(editor, element);
1159
+ if (!path) {
1160
+ return;
1161
+ }
1162
+ const nextNodePath = getPointAfter(editor, path);
1163
+ if (!nextNodePath) {
1164
+ insertNodes(
1165
+ editor,
1166
+ [
1167
+ {
1168
+ type: ELEMENT_DEFAULT,
1169
+ children: [{ text: "" }],
1170
+ lang: void 0,
1171
+ value: void 0
1172
+ }
1173
+ ],
1174
+ { select: true }
1175
+ );
1176
+ focusEditor(editor);
1177
+ } else {
1178
+ focusEditor(editor, nextNodePath);
1179
+ }
1180
+ break;
1181
+ }
1182
+ }
1183
+ }
1184
+ }, [navigateAway]);
1185
+ function handleEditorDidMount(monacoEditor, monaco2) {
1186
+ monacoEditorRef.current = monacoEditor;
1187
+ monacoEditor.onDidContentSizeChange(() => {
1188
+ setHeight(
1189
+ monacoEditor.getContentHeight() > MINIMUM_HEIGHT ? monacoEditor.getContentHeight() : MINIMUM_HEIGHT
1190
+ );
1191
+ monacoEditor.layout();
1192
+ });
1193
+ setNodes(editor, { value: defaultValue, lang: language });
1194
+ monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
1195
+ if (monacoEditor.hasTextFocus()) {
1196
+ setNavigateAway("insertNext");
1197
+ }
1198
+ });
1199
+ monacoEditor.onKeyDown((l) => {
1200
+ if (l.code === "ArrowUp") {
1201
+ const selection = monacoEditor.getSelection();
1202
+ if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
1203
+ setNavigateAway("up");
1204
+ }
1205
+ }
1206
+ if (l.code === "ArrowDown") {
1207
+ const selection = monacoEditor.getSelection();
1208
+ const totalLines = monacoEditor.getModel().getLineCount();
1209
+ if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
1210
+ setNavigateAway("down");
1211
+ }
1212
+ }
1213
+ if (l.code === "Backspace") {
1214
+ const selection = monacoEditor.getSelection();
1215
+ if (selection.endColumn === 1 && selection.endLineNumber === 1 && selection.positionColumn === 1 && selection.positionLineNumber === 1 && selection.selectionStartColumn === 1 && selection.selectionStartLineNumber === 1 && selection.startColumn === 1 && selection.startLineNumber === 1) {
1216
+ setNavigateAway("remove");
1217
+ }
1218
+ }
1219
+ });
1220
+ }
1221
+ return /* @__PURE__ */ React__default.createElement(
1222
+ "div",
1223
+ {
1224
+ ...attributes,
1225
+ className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
1226
+ },
1227
+ /* @__PURE__ */ React__default.createElement("style", null, `.monaco-editor .editor-widget {
1228
+ display: none !important;
1229
+ visibility: hidden !important;
1230
+ }`),
1231
+ props.children,
1232
+ /* @__PURE__ */ React__default.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React__default.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React__default.createElement("div", null), /* @__PURE__ */ React__default.createElement(
1233
+ Autocomplete,
1234
+ {
1235
+ items: items2,
1236
+ value: currentItem,
1237
+ defaultQuery: "plaintext",
1238
+ onChange: (item) => setNodes(editor, { lang: item.key })
1239
+ }
1240
+ )), /* @__PURE__ */ React__default.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React__default.createElement(
1241
+ MonacoEditor,
1242
+ {
1243
+ path: id,
1244
+ onMount: handleEditorDidMount,
1245
+ options: {
1246
+ scrollBeyondLastLine: false,
1247
+ // automaticLayout: true,
1248
+ tabSize: 2,
1249
+ disableLayerHinting: true,
1250
+ accessibilitySupport: "off",
1251
+ codeLens: false,
1252
+ wordWrap: "on",
1253
+ minimap: {
1254
+ enabled: false
1255
+ },
1256
+ fontSize: 14,
1257
+ lineHeight: 2,
1258
+ formatOnPaste: true,
1259
+ lineNumbers: "off",
1260
+ formatOnType: true,
1261
+ fixedOverflowWidgets: true,
1262
+ // Takes too much horizontal space for iframe
1263
+ folding: false,
1264
+ renderLineHighlight: "none",
1265
+ scrollbar: {
1266
+ verticalScrollbarSize: 1,
1267
+ horizontalScrollbarSize: 1,
1268
+ // https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
1269
+ alwaysConsumeMouseWheel: false
1270
+ }
1271
+ },
1272
+ language: String(language),
1273
+ value: String(element.value),
1274
+ onChange: (value2) => {
1275
+ onChangeCallback == null ? void 0 : onChangeCallback(value2);
1276
+ setNodes(editor, { value: value2, lang: language });
1277
+ }
1278
+ }
1279
+ )))
1280
+ );
1281
+ };
1282
+ const CodeBlockElement = withRef(
1283
+ ({ className, ...props }, ref) => {
1284
+ const { element } = props;
1285
+ const state = useCodeBlockElementState({ element });
1286
+ return /* @__PURE__ */ React__default.createElement(
1287
+ PlateElement,
1288
+ {
1289
+ className: cn$1("relative py-1", state.className, className),
1290
+ ref,
1291
+ ...props
1292
+ },
1293
+ /* @__PURE__ */ React__default.createElement(CodeBlock, { ...props })
1294
+ );
1295
+ }
1296
+ );
1297
+ const CodeLeaf = withRef(
1298
+ ({ children, className, ...props }, ref) => {
1299
+ return /* @__PURE__ */ React__default.createElement(
1300
+ PlateLeaf,
1301
+ {
1302
+ asChild: true,
1303
+ className: cn$1(
1304
+ "whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
1305
+ className
1306
+ ),
1307
+ ref,
1308
+ ...props
1309
+ },
1310
+ /* @__PURE__ */ React__default.createElement("code", null, children)
1311
+ );
1312
+ }
1313
+ );
1314
+ const CodeLineElement = withRef((props, ref) => /* @__PURE__ */ React__default.createElement(PlateElement, { ref, ...props }));
1315
+ const CodeSyntaxLeaf = withRef(
1316
+ ({ children, ...props }, ref) => {
1317
+ const { leaf } = props;
1318
+ const { tokenProps } = useCodeSyntaxLeaf({ leaf });
1319
+ return /* @__PURE__ */ React__default.createElement(PlateLeaf, { ref, ...props }, /* @__PURE__ */ React__default.createElement("span", { ...tokenProps }, children));
1320
+ }
1321
+ );
1322
+ const listVariants = cva("m-0 ps-6", {
1323
+ variants: {
1324
+ variant: {
1325
+ ol: "list-decimal",
1326
+ ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
1327
+ }
1328
+ }
1329
+ });
1330
+ const ListElementVariants = withVariants(PlateElement, listVariants, [
1331
+ "variant"
1332
+ ]);
1333
+ const ListElement = withRef(
1334
+ ({ children, variant = "ul", ...props }, ref) => {
1335
+ const Component2 = variant;
1336
+ return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component2, null, children));
1337
+ }
1338
+ );
1339
+ const ELEMENT_MERMAID = "mermaid";
1340
+ const createMermaidPlugin = createPluginFactory({
1341
+ isElement: true,
1342
+ isVoid: true,
1343
+ isInline: false,
1344
+ key: ELEMENT_MERMAID
1345
+ });
1346
+ const MermaidElementWithRef = ({ config }) => {
1347
+ const mermaidRef = useRef(null);
1348
+ useEffect(() => {
1349
+ if (mermaidRef.current) {
1350
+ mermaid.initialize({ startOnLoad: true });
1351
+ mermaid.run();
1352
+ }
1353
+ }, [config]);
1354
+ return /* @__PURE__ */ React__default.createElement("div", { contentEditable: false, className: "border-border border-b" }, /* @__PURE__ */ React__default.createElement("div", { ref: mermaidRef }, /* @__PURE__ */ React__default.createElement("pre", { className: "mermaid not-tina-prose" }, config)));
1355
+ };
1356
+ const Bubble = ({ children }) => {
1357
+ return /* @__PURE__ */ React__default.createElement("div", { className: "bg-blue-600 rounded-full p-2 transition-transform duration-200 ease-in-out hover:scale-110" }, children);
1358
+ };
1359
+ const ErrorMsg = ({ error }) => {
1360
+ if (error) {
1361
+ return /* @__PURE__ */ React__default.createElement(
1362
+ "div",
1363
+ {
1364
+ contentEditable: false,
1365
+ className: "font-mono bg-red-600 text-white p-2 rounded-md cursor-default"
1366
+ },
1367
+ error
1368
+ );
1369
+ }
1370
+ return null;
1371
+ };
1372
+ const DEFAULT_MERMAID_CONFIG = `%% This won't render without implementing a rendering engine (e.g. mermaid on npm)
1373
+ flowchart TD
1374
+ id1(this is an example flow diagram)
1375
+ --> id2(modify me to see changes!)
1376
+ id2
1377
+ --> id3(Click the top button to preview the changes)
1378
+ --> id4(Learn about mermaid diagrams @ mermaid.js.org)`;
1379
+ const MermaidElement = withRef(
1380
+ ({ children, nodeProps, element, ...props }, ref) => {
1381
+ const [mermaidConfig, setMermaidConfig] = useState(
1382
+ element.value || DEFAULT_MERMAID_CONFIG
1383
+ );
1384
+ const [isEditing, setIsEditing] = useState(
1385
+ mermaidConfig === DEFAULT_MERMAID_CONFIG || false
1386
+ );
1387
+ const [mermaidError, setMermaidError] = useState(null);
1388
+ const node = {
1389
+ type: ELEMENT_MERMAID,
1390
+ value: mermaidConfig,
1391
+ children: [{ type: "text", text: "" }]
1392
+ };
1393
+ useEffect(() => {
1394
+ if (mermaid.parse(mermaidConfig, { suppressErrors: false })) {
1395
+ setMermaidError(null);
1396
+ }
1397
+ }, [mermaidConfig]);
1398
+ mermaid.parseError = (err) => {
1399
+ setMermaidError(
1400
+ String(err.message) || "An error occurred while parsing the diagram."
1401
+ );
1402
+ };
1403
+ return /* @__PURE__ */ React__default.createElement(PlateElement, { element, ref, ...props }, /* @__PURE__ */ React__default.createElement("div", { className: "relative group" }, /* @__PURE__ */ React__default.createElement("div", { className: "absolute top-2 right-2 z-10 space-y-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 ease-in-out" }, /* @__PURE__ */ React__default.createElement(Bubble, null, isEditing ? /* @__PURE__ */ React__default.createElement(
1404
+ Eye,
1405
+ {
1406
+ className: "w-5 h-5 fill-white cursor-pointer",
1407
+ onClick: () => {
1408
+ setIsEditing(!isEditing);
1409
+ }
1410
+ }
1411
+ ) : /* @__PURE__ */ React__default.createElement(
1412
+ SquarePen,
1413
+ {
1414
+ className: "w-5 h-5 fill-white cursor-pointer",
1415
+ onClick: () => {
1416
+ setIsEditing(!isEditing);
1417
+ }
1418
+ }
1419
+ ))), isEditing ? /* @__PURE__ */ React__default.createElement(
1420
+ CodeBlock,
1421
+ {
1422
+ children: "",
1423
+ language: "yaml",
1424
+ ...props,
1425
+ element: node,
1426
+ defaultValue: mermaidConfig,
1427
+ onChangeCallback: (value) => setMermaidConfig(value)
1428
+ }
1429
+ ) : /* @__PURE__ */ React__default.createElement(MermaidElementWithRef, { config: mermaidConfig })), children, /* @__PURE__ */ React__default.createElement(ErrorMsg, { error: mermaidError }));
1430
+ }
1431
+ );
1432
+ const RawMarkdown = () => {
1433
+ return /* @__PURE__ */ React__default.createElement(
1434
+ "svg",
1435
+ {
1436
+ stroke: "currentColor",
1437
+ fill: "currentColor",
1438
+ strokeWidth: 0,
1439
+ role: "img",
1440
+ className: "h-5 w-5",
1441
+ viewBox: "0 0 24 24",
1442
+ height: "1em",
1443
+ width: "1em",
1444
+ xmlns: "http://www.w3.org/2000/svg"
1445
+ },
1446
+ /* @__PURE__ */ React__default.createElement("title", null),
1447
+ /* @__PURE__ */ React__default.createElement("path", { d: "M22.27 19.385H1.73A1.73 1.73 0 010 17.655V6.345a1.73 1.73 0 011.73-1.73h20.54A1.73 1.73 0 0124 6.345v11.308a1.73 1.73 0 01-1.73 1.731zM5.769 15.923v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.46v7.847zM21.232 12h-2.309V8.077h-2.307V12h-2.308l3.461 4.039z" })
1448
+ );
1449
+ };
1450
+ const MermaidIcon = () => /* @__PURE__ */ React__default.createElement(
1451
+ "svg",
1452
+ {
1453
+ width: "100%",
1454
+ height: "100%",
1455
+ viewBox: "0 0 491 491",
1456
+ version: "1.1",
1457
+ xmlns: "http://www.w3.org/2000/svg",
1458
+ fillRule: "evenodd",
1459
+ clipRule: "evenodd",
1460
+ strokeLinejoin: "round",
1461
+ strokeMiterlimit: 2
1462
+ },
1463
+ /* @__PURE__ */ React__default.createElement("path", { d: "M490.16,84.61C490.16,37.912 452.248,0 405.55,0L84.61,0C37.912,0 0,37.912 0,84.61L0,405.55C0,452.248 37.912,490.16 84.61,490.16L405.55,490.16C452.248,490.16 490.16,452.248 490.16,405.55L490.16,84.61Z" }),
1464
+ /* @__PURE__ */ React__default.createElement(
1465
+ "path",
1466
+ {
1467
+ d: "M407.48,111.18C335.587,108.103 269.573,152.338 245.08,220C220.587,152.338 154.573,108.103 82.68,111.18C80.285,168.229 107.577,222.632 154.74,254.82C178.908,271.419 193.35,298.951 193.27,328.27L193.27,379.13L296.9,379.13L296.9,328.27C296.816,298.953 311.255,271.42 335.42,254.82C382.596,222.644 409.892,168.233 407.48,111.18Z",
1468
+ fill: "white",
1469
+ fillRule: "nonzero"
1470
+ }
1471
+ )
1472
+ );
1473
+ const borderAll = (props) => /* @__PURE__ */ React__default.createElement(
1474
+ "svg",
1475
+ {
1476
+ viewBox: "0 0 24 24",
1477
+ height: "48",
1478
+ width: "48",
1479
+ focusable: "false",
1480
+ role: "img",
1481
+ fill: "currentColor",
1482
+ xmlns: "http://www.w3.org/2000/svg",
1483
+ ...props
1484
+ },
1485
+ /* @__PURE__ */ React__default.createElement("path", { d: "M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6zm10 13h5a1 1 0 0 0 1-1v-5h-6v6zm-2-6H5v5a1 1 0 0 0 1 1h5v-6zm2-2h6V6a1 1 0 0 0-1-1h-5v6zm-2-6H6a1 1 0 0 0-1 1v5h6V5z" })
1486
+ );
1487
+ const borderBottom = (props) => /* @__PURE__ */ React__default.createElement(
1488
+ "svg",
1489
+ {
1490
+ viewBox: "0 0 24 24",
1491
+ height: "48",
1492
+ width: "48",
1493
+ focusable: "false",
1494
+ role: "img",
1495
+ fill: "currentColor",
1496
+ xmlns: "http://www.w3.org/2000/svg",
1497
+ ...props
1498
+ },
1499
+ /* @__PURE__ */ React__default.createElement("path", { d: "M13 5a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm-8 6a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm-2 7a1 1 0 1 1 2 0 1 1 0 0 0 1 1h12a1 1 0 0 0 1-1 1 1 0 1 1 2 0 3 3 0 0 1-3 3H6a3 3 0 0 1-3-3zm17-8a1 1 0 0 0-1 1v2a1 1 0 1 0 2 0v-2a1 1 0 0 0-1-1zM7 4a1 1 0 0 0-1-1 3 3 0 0 0-3 3 1 1 0 0 0 2 0 1 1 0 0 1 1-1 1 1 0 0 0 1-1zm11-1a1 1 0 1 0 0 2 1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3z" })
1500
+ );
1501
+ const borderLeft = (props) => /* @__PURE__ */ React__default.createElement(
1502
+ "svg",
1503
+ {
1504
+ viewBox: "0 0 24 24",
1505
+ height: "48",
1506
+ width: "48",
1507
+ focusable: "false",
1508
+ role: "img",
1509
+ fill: "currentColor",
1510
+ xmlns: "http://www.w3.org/2000/svg",
1511
+ ...props
1512
+ },
1513
+ /* @__PURE__ */ React__default.createElement("path", { d: "M6 21a1 1 0 1 0 0-2 1 1 0 0 1-1-1V6a1 1 0 0 1 1-1 1 1 0 0 0 0-2 3 3 0 0 0-3 3v12a3 3 0 0 0 3 3zm7-16a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm6 6a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm4-17a1 1 0 1 0 0 2 1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3zm-1 17a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" })
1514
+ );
1515
+ const borderNone = (props) => /* @__PURE__ */ React__default.createElement(
1516
+ "svg",
1517
+ {
1518
+ viewBox: "0 0 24 24",
1519
+ height: "48",
1520
+ width: "48",
1521
+ focusable: "false",
1522
+ role: "img",
1523
+ fill: "currentColor",
1524
+ xmlns: "http://www.w3.org/2000/svg",
1525
+ ...props
1526
+ },
1527
+ /* @__PURE__ */ React__default.createElement("path", { d: "M14 4a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-9 7a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-6 10a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zM7 4a1 1 0 0 0-1-1 3 3 0 0 0-3 3 1 1 0 0 0 2 0 1 1 0 0 1 1-1 1 1 0 0 0 1-1zm11-1a1 1 0 1 0 0 2 1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3zM7 20a1 1 0 0 1-1 1 3 3 0 0 1-3-3 1 1 0 1 1 2 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1zm11 1a1 1 0 1 1 0-2 1 1 0 0 0 1-1 1 1 0 1 1 2 0 3 3 0 0 1-3 3z" })
1528
+ );
1529
+ const borderRight = (props) => /* @__PURE__ */ React__default.createElement(
1530
+ "svg",
1531
+ {
1532
+ viewBox: "0 0 24 24",
1533
+ height: "48",
1534
+ width: "48",
1535
+ focusable: "false",
1536
+ role: "img",
1537
+ fill: "currentColor",
1538
+ xmlns: "http://www.w3.org/2000/svg",
1539
+ ...props
1540
+ },
1541
+ /* @__PURE__ */ React__default.createElement("path", { d: "M13 5a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm-8 6a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm9 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zM6 3a1 1 0 0 1 0 2 1 1 0 0 0-1 1 1 1 0 0 1-2 0 3 3 0 0 1 3-3zm1 17a1 1 0 0 1-1 1 3 3 0 0 1-3-3 1 1 0 1 1 2 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1zm11 1a1 1 0 1 1 0-2 1 1 0 0 0 1-1V6a1 1 0 0 0-1-1 1 1 0 1 1 0-2 3 3 0 0 1 3 3v12a3 3 0 0 1-3 3z" })
1542
+ );
1543
+ const borderTop = (props) => /* @__PURE__ */ React__default.createElement(
1544
+ "svg",
1545
+ {
1546
+ viewBox: "0 0 24 24",
1547
+ height: "48",
1548
+ width: "48",
1549
+ focusable: "false",
1550
+ role: "img",
1551
+ fill: "currentColor",
1552
+ xmlns: "http://www.w3.org/2000/svg",
1553
+ ...props
1554
+ },
1555
+ /* @__PURE__ */ React__default.createElement("path", { d: "M3 6a1 1 0 0 0 2 0 1 1 0 0 1 1-1h12a1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3zm2 5a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-8 1a1 1 0 1 0 0-2 1 1 0 0 1-1-1 1 1 0 1 0-2 0 3 3 0 0 0 3 3zm11-1a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" })
1556
+ );
1557
+ const iconVariants = cva("", {
1558
+ variants: {
1559
+ variant: {
1560
+ toolbar: "size-5",
1561
+ menuItem: "mr-2 size-5"
1562
+ },
1563
+ size: {
1564
+ sm: "mr-2 size-4",
1565
+ md: "mr-2 size-6"
1566
+ }
1567
+ },
1568
+ defaultVariants: {}
1569
+ });
1570
+ const DoubleColumnOutlined = (props) => /* @__PURE__ */ React__default.createElement(
1571
+ "svg",
1572
+ {
1573
+ fill: "none",
1574
+ height: "16",
1575
+ viewBox: "0 0 16 16",
1576
+ width: "16",
1577
+ xmlns: "http://www.w3.org/2000/svg",
1578
+ ...props
1579
+ },
1580
+ /* @__PURE__ */ React__default.createElement(
1581
+ "path",
1582
+ {
1583
+ clipRule: "evenodd",
1584
+ d: "M8.5 3H13V13H8.5V3ZM7.5 2H8.5H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H8.5H7.5H3C2.44772 14 2 13.5523 2 13V3C2 2.44772 2.44772 2 3 2H7.5ZM7.5 13H3L3 3H7.5V13Z",
1585
+ fill: "#595E6F",
1586
+ fillRule: "evenodd"
1587
+ }
1588
+ )
1589
+ );
1590
+ const ThreeColumnOutlined = (props) => /* @__PURE__ */ React__default.createElement(
1591
+ "svg",
1592
+ {
1593
+ fill: "none",
1594
+ height: "16",
1595
+ viewBox: "0 0 16 16",
1596
+ width: "16",
1597
+ xmlns: "http://www.w3.org/2000/svg",
1598
+ ...props
1599
+ },
1600
+ /* @__PURE__ */ React__default.createElement(
1601
+ "path",
1602
+ {
1603
+ clipRule: "evenodd",
1604
+ d: "M9.25 3H6.75V13H9.25V3ZM9.25 2H6.75H5.75H3C2.44772 2 2 2.44772 2 3V13C2 13.5523 2.44772 14 3 14H5.75H6.75H9.25H10.25H13C13.5523 14 14 13.5523 14 13V3C14 2.44772 13.5523 2 13 2H10.25H9.25ZM10.25 3V13H13V3H10.25ZM3 13H5.75V3H3L3 13Z",
1605
+ fill: "#4C5161",
1606
+ fillRule: "evenodd"
1607
+ }
1608
+ )
1609
+ );
1075
1610
  const RightSideDoubleColumnOutlined = (props) => /* @__PURE__ */ React__default.createElement(
1076
1611
  "svg",
1077
1612
  {
@@ -1175,6 +1710,7 @@ const Icons = {
1175
1710
  clear: X,
1176
1711
  close: X,
1177
1712
  // code: Code2,
1713
+ paint: PaintBucket,
1178
1714
  codeblock: FileCode,
1179
1715
  color: Baseline,
1180
1716
  column: RectangleVertical,
@@ -1200,6 +1736,7 @@ const Icons = {
1200
1736
  lineHeight: WrapText,
1201
1737
  // link: Link2,
1202
1738
  minus: Minus,
1739
+ mermaid: MermaidIcon,
1203
1740
  more: MoreHorizontal,
1204
1741
  // ol: ListOrdered,
1205
1742
  outdent: Outdent,
@@ -1232,186 +1769,29 @@ const Icons = {
1232
1769
  code: CodeIcon,
1233
1770
  codeBlock: CodeBlockIcon,
1234
1771
  bold: BoldIcon,
1235
- italic: ItalicIcon,
1236
- raw: RawMarkdown,
1237
- // www
1238
- gitHub: (props) => /* @__PURE__ */ React__default.createElement("svg", { viewBox: "0 0 438.549 438.549", ...props }, /* @__PURE__ */ React__default.createElement(
1239
- "path",
1240
- {
1241
- fill: "currentColor",
1242
- d: "M409.132 114.573c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.063-29.408-39.781 0-76.472 9.804-110.063 29.408-33.596 19.605-60.192 46.204-79.8 79.8C9.803 148.168 0 184.854 0 224.63c0 47.78 13.94 90.745 41.827 128.906 27.884 38.164 63.906 64.572 108.063 79.227 5.14.954 8.945.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-.571-.049-5.708-.144-15.417a2549.81 2549.81 0 01-.144-25.406l-6.567 1.136c-4.187.767-9.469 1.092-15.846 1-6.374-.089-12.991-.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-.572-1.335-.098-2.43 1.427-3.289 1.525-.859 4.281-1.276 8.28-1.276l5.708.853c3.807.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136 6.28 0 11.704-.476 16.274-1.423 4.565-.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.068-79.226 27.88-38.161 41.825-81.126 41.825-128.906-.01-39.771-9.818-76.454-29.414-110.049z"
1243
- }
1244
- )),
1245
- logo: (props) => /* @__PURE__ */ React__default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React__default.createElement(
1246
- "path",
1247
- {
1248
- fill: "currentColor",
1249
- d: "M11.572 0c-.176 0-.31.001-.358.007a19.76 19.76 0 0 1-.364.033C7.443.346 4.25 2.185 2.228 5.012a11.875 11.875 0 0 0-2.119 5.243c-.096.659-.108.854-.108 1.747s.012 1.089.108 1.748c.652 4.506 3.86 8.292 8.209 9.695.779.25 1.6.422 2.534.525.363.04 1.935.04 2.299 0 1.611-.178 2.977-.577 4.323-1.264.207-.106.247-.134.219-.158-.02-.013-.9-1.193-1.955-2.62l-1.919-2.592-2.404-3.558a338.739 338.739 0 0 0-2.422-3.556c-.009-.002-.018 1.579-.023 3.51-.007 3.38-.01 3.515-.052 3.595a.426.426 0 0 1-.206.214c-.075.037-.14.044-.495.044H7.81l-.108-.068a.438.438 0 0 1-.157-.171l-.05-.106.006-4.703.007-4.705.072-.092a.645.645 0 0 1 .174-.143c.096-.047.134-.051.54-.051.478 0 .558.018.682.154.035.038 1.337 1.999 2.895 4.361a10760.433 10760.433 0 0 0 4.735 7.17l1.9 2.879.096-.063a12.317 12.317 0 0 0 2.466-2.163 11.944 11.944 0 0 0 2.824-6.134c.096-.66.108-.854.108-1.748 0-.893-.012-1.088-.108-1.747-.652-4.506-3.859-8.292-8.208-9.695a12.597 12.597 0 0 0-2.499-.523A33.119 33.119 0 0 0 11.573 0zm4.069 7.217c.347 0 .408.005.486.047a.473.473 0 0 1 .237.277c.018.06.023 1.365.018 4.304l-.006 4.218-.744-1.14-.746-1.14v-3.066c0-1.982.01-3.097.023-3.15a.478.478 0 0 1 .233-.296c.096-.05.13-.054.5-.054z"
1250
- }
1251
- )),
1252
- moon: Moon,
1253
- sun: SunMedium,
1254
- twitter: Twitter
1255
- };
1256
- function UnorderedListIcon(props) {
1257
- const title = props.title || "format list bulleted";
1258
- return /* @__PURE__ */ React__default.createElement(
1259
- "svg",
1260
- {
1261
- className: "h-5 w-5",
1262
- height: "24",
1263
- width: "24",
1264
- viewBox: "0 0 24 24",
1265
- xmlns: "http://www.w3.org/2000/svg"
1266
- },
1267
- /* @__PURE__ */ React__default.createElement("title", null, title),
1268
- /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement("path", { d: "M7 5h14v2H7V5z", fill: "currentColor" }), /* @__PURE__ */ React__default.createElement(
1269
- "path",
1270
- {
1271
- d: "M4 7.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z",
1272
- fill: "currentColor"
1273
- }
1274
- ), /* @__PURE__ */ React__default.createElement(
1275
- "path",
1276
- {
1277
- d: "M7 11h14v2H7v-2zm0 6h14v2H7v-2zm-3 2.5c.82 0 1.5-.68 1.5-1.5s-.67-1.5-1.5-1.5-1.5.68-1.5 1.5.68 1.5 1.5 1.5z",
1278
- fill: "currentColor"
1279
- }
1280
- ), /* @__PURE__ */ React__default.createElement(
1281
- "path",
1282
- {
1283
- d: "M4 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z",
1284
- fill: "currentColor"
1285
- }
1286
- ))
1287
- );
1288
- }
1289
- function HeadingIcon(props) {
1290
- const title = props.title || "format size";
1291
- return /* @__PURE__ */ React__default.createElement(
1292
- "svg",
1293
- {
1294
- height: "24",
1295
- width: "24",
1296
- className: "h-5 w-5",
1297
- viewBox: "0 0 24 24",
1298
- xmlns: "http://www.w3.org/2000/svg"
1299
- },
1300
- /* @__PURE__ */ React__default.createElement("title", null, title),
1301
- /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1302
- "path",
1303
- {
1304
- d: "M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3V9H3v3z",
1305
- fill: "currentColor"
1306
- }
1307
- ))
1308
- );
1309
- }
1310
- function OrderedListIcon(props) {
1311
- const title = props.title || "format list numbered";
1312
- return /* @__PURE__ */ React__default.createElement(
1313
- "svg",
1314
- {
1315
- className: "h-5 w-5",
1316
- height: "24",
1317
- width: "24",
1318
- viewBox: "0 0 24 24",
1319
- xmlns: "http://www.w3.org/2000/svg"
1320
- },
1321
- /* @__PURE__ */ React__default.createElement("title", null, title),
1322
- /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1323
- "path",
1324
- {
1325
- d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z",
1326
- fill: "currentColor"
1327
- }
1328
- ))
1329
- );
1330
- }
1331
- function QuoteIcon(props) {
1332
- const title = props.title || "format quote";
1333
- return /* @__PURE__ */ React__default.createElement(
1334
- "svg",
1335
- {
1336
- height: "24",
1337
- className: "h-5 w-5",
1338
- width: "24",
1339
- viewBox: "0 0 24 24",
1340
- xmlns: "http://www.w3.org/2000/svg"
1341
- },
1342
- /* @__PURE__ */ React__default.createElement("title", null, title),
1343
- /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1344
- "path",
1345
- {
1346
- d: "M6 17h3l2-4V7H5v6h3l-2 4zm8 0h3l2-4V7h-6v6h3l-2 4z",
1347
- fill: "currentColor"
1348
- }
1349
- ))
1350
- );
1351
- }
1352
- function LinkIcon(props) {
1353
- const title = props.title || "insert link";
1354
- return /* @__PURE__ */ React__default.createElement(
1355
- "svg",
1356
- {
1357
- height: "24",
1358
- className: "h-5 w-5",
1359
- width: "24",
1360
- viewBox: "0 0 24 24",
1361
- xmlns: "http://www.w3.org/2000/svg"
1362
- },
1363
- /* @__PURE__ */ React__default.createElement("title", null, title),
1364
- /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1365
- "path",
1366
- {
1367
- d: "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.71-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z",
1368
- fill: "currentColor"
1369
- }
1370
- ))
1371
- );
1372
- }
1373
- function CodeIcon(props) {
1374
- const title = props.title || "code";
1375
- return /* @__PURE__ */ React__default.createElement(
1376
- "svg",
1772
+ italic: ItalicIcon,
1773
+ raw: RawMarkdown,
1774
+ // www
1775
+ gitHub: (props) => /* @__PURE__ */ React__default.createElement("svg", { viewBox: "0 0 438.549 438.549", ...props }, /* @__PURE__ */ React__default.createElement(
1776
+ "path",
1377
1777
  {
1378
- className: "h-5 w-5",
1379
- height: "24",
1380
- width: "24",
1381
- viewBox: "0 0 24 24",
1382
- xmlns: "http://www.w3.org/2000/svg"
1383
- },
1384
- /* @__PURE__ */ React__default.createElement("title", null, title),
1385
- /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1386
- "path",
1387
- {
1388
- d: "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z",
1389
- fill: "currentColor"
1390
- }
1391
- ))
1392
- );
1393
- }
1394
- function CodeBlockIcon(props) {
1395
- const title = props.title || "code-block";
1396
- return /* @__PURE__ */ React__default.createElement(
1397
- "svg",
1778
+ fill: "currentColor",
1779
+ d: "M409.132 114.573c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.063-29.408-39.781 0-76.472 9.804-110.063 29.408-33.596 19.605-60.192 46.204-79.8 79.8C9.803 148.168 0 184.854 0 224.63c0 47.78 13.94 90.745 41.827 128.906 27.884 38.164 63.906 64.572 108.063 79.227 5.14.954 8.945.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-.571-.049-5.708-.144-15.417a2549.81 2549.81 0 01-.144-25.406l-6.567 1.136c-4.187.767-9.469 1.092-15.846 1-6.374-.089-12.991-.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-.572-1.335-.098-2.43 1.427-3.289 1.525-.859 4.281-1.276 8.28-1.276l5.708.853c3.807.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136 6.28 0 11.704-.476 16.274-1.423 4.565-.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.068-79.226 27.88-38.161 41.825-81.126 41.825-128.906-.01-39.771-9.818-76.454-29.414-110.049z"
1780
+ }
1781
+ )),
1782
+ logo: (props) => /* @__PURE__ */ React__default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React__default.createElement(
1783
+ "path",
1398
1784
  {
1399
- className: "h-5 w-5",
1400
- stroke: "currentColor",
1401
1785
  fill: "currentColor",
1402
- strokeWidth: 0,
1403
- viewBox: "0 0 16 16",
1404
- height: "1em",
1405
- width: "1em",
1406
- xmlns: "http://www.w3.org/2000/svg"
1407
- },
1408
- /* @__PURE__ */ React__default.createElement("title", null, title),
1409
- /* @__PURE__ */ React__default.createElement("path", { d: "M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z" }),
1410
- /* @__PURE__ */ React__default.createElement("path", { d: "M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z" })
1411
- );
1412
- }
1413
- function ImageIcon(props) {
1414
- const title = props.title || "image";
1786
+ d: "M11.572 0c-.176 0-.31.001-.358.007a19.76 19.76 0 0 1-.364.033C7.443.346 4.25 2.185 2.228 5.012a11.875 11.875 0 0 0-2.119 5.243c-.096.659-.108.854-.108 1.747s.012 1.089.108 1.748c.652 4.506 3.86 8.292 8.209 9.695.779.25 1.6.422 2.534.525.363.04 1.935.04 2.299 0 1.611-.178 2.977-.577 4.323-1.264.207-.106.247-.134.219-.158-.02-.013-.9-1.193-1.955-2.62l-1.919-2.592-2.404-3.558a338.739 338.739 0 0 0-2.422-3.556c-.009-.002-.018 1.579-.023 3.51-.007 3.38-.01 3.515-.052 3.595a.426.426 0 0 1-.206.214c-.075.037-.14.044-.495.044H7.81l-.108-.068a.438.438 0 0 1-.157-.171l-.05-.106.006-4.703.007-4.705.072-.092a.645.645 0 0 1 .174-.143c.096-.047.134-.051.54-.051.478 0 .558.018.682.154.035.038 1.337 1.999 2.895 4.361a10760.433 10760.433 0 0 0 4.735 7.17l1.9 2.879.096-.063a12.317 12.317 0 0 0 2.466-2.163 11.944 11.944 0 0 0 2.824-6.134c.096-.66.108-.854.108-1.748 0-.893-.012-1.088-.108-1.747-.652-4.506-3.859-8.292-8.208-9.695a12.597 12.597 0 0 0-2.499-.523A33.119 33.119 0 0 0 11.573 0zm4.069 7.217c.347 0 .408.005.486.047a.473.473 0 0 1 .237.277c.018.06.023 1.365.018 4.304l-.006 4.218-.744-1.14-.746-1.14v-3.066c0-1.982.01-3.097.023-3.15a.478.478 0 0 1 .233-.296c.096-.05.13-.054.5-.054z"
1787
+ }
1788
+ )),
1789
+ moon: Moon,
1790
+ sun: SunMedium,
1791
+ twitter: Twitter
1792
+ };
1793
+ function UnorderedListIcon(props) {
1794
+ const title = props.title || "format list bulleted";
1415
1795
  return /* @__PURE__ */ React__default.createElement(
1416
1796
  "svg",
1417
1797
  {
@@ -1422,765 +1802,622 @@ function ImageIcon(props) {
1422
1802
  xmlns: "http://www.w3.org/2000/svg"
1423
1803
  },
1424
1804
  /* @__PURE__ */ React__default.createElement("title", null, title),
1425
- /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1805
+ /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement("path", { d: "M7 5h14v2H7V5z", fill: "currentColor" }), /* @__PURE__ */ React__default.createElement(
1426
1806
  "path",
1427
1807
  {
1428
- d: "M19 5v14H5V5h14zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z",
1808
+ d: "M4 7.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z",
1429
1809
  fill: "currentColor"
1430
1810
  }
1431
- ))
1432
- );
1433
- }
1434
- function BoldIcon(props) {
1435
- const title = props.title || "format bold";
1436
- return /* @__PURE__ */ React__default.createElement(
1437
- "svg",
1438
- {
1439
- className: "h-5 w-5",
1440
- height: "24",
1441
- width: "24",
1442
- viewBox: "0 0 24 24",
1443
- xmlns: "http://www.w3.org/2000/svg"
1444
- },
1445
- /* @__PURE__ */ React__default.createElement("title", null, title),
1446
- /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1811
+ ), /* @__PURE__ */ React__default.createElement(
1447
1812
  "path",
1448
1813
  {
1449
- d: "M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z",
1814
+ d: "M7 11h14v2H7v-2zm0 6h14v2H7v-2zm-3 2.5c.82 0 1.5-.68 1.5-1.5s-.67-1.5-1.5-1.5-1.5.68-1.5 1.5.68 1.5 1.5 1.5z",
1450
1815
  fill: "currentColor"
1451
1816
  }
1452
- ))
1453
- );
1454
- }
1455
- function ItalicIcon(props) {
1456
- const title = props.title || "format italic";
1457
- return /* @__PURE__ */ React__default.createElement(
1458
- "svg",
1459
- {
1460
- className: "h-5 w-5",
1461
- height: "24",
1462
- width: "24",
1463
- viewBox: "0 0 24 24",
1464
- xmlns: "http://www.w3.org/2000/svg"
1465
- },
1466
- /* @__PURE__ */ React__default.createElement("title", null, title),
1467
- /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1817
+ ), /* @__PURE__ */ React__default.createElement(
1468
1818
  "path",
1469
1819
  {
1470
- d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z",
1820
+ d: "M4 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z",
1471
1821
  fill: "currentColor"
1472
1822
  }
1473
1823
  ))
1474
1824
  );
1475
1825
  }
1476
- function PlusIcon({ className = "" }) {
1826
+ function HeadingIcon(props) {
1827
+ const title = props.title || "format size";
1477
1828
  return /* @__PURE__ */ React__default.createElement(
1478
- "svg",
1479
- {
1480
- xmlns: "http://www.w3.org/2000/svg",
1481
- className: `h-4 w-4 ${className}`,
1482
- viewBox: "0 0 20 20",
1483
- fill: "currentColor"
1484
- },
1485
- /* @__PURE__ */ React__default.createElement(
1486
- "path",
1487
- {
1488
- fillRule: "evenodd",
1489
- d: "M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",
1490
- clipRule: "evenodd"
1491
- }
1492
- )
1493
- );
1494
- }
1495
- const InlineComboboxContext = createContext(
1496
- null
1497
- );
1498
- const defaultFilter = ({ keywords = [], value }, search) => [value, ...keywords].some((keyword) => filterWords(keyword, search));
1499
- const InlineCombobox = ({
1500
- children,
1501
- element,
1502
- filter = defaultFilter,
1503
- hideWhenNoValue = false,
1504
- setValue: setValueProp,
1505
- showTrigger = true,
1506
- trigger,
1507
- value: valueProp
1508
- }) => {
1509
- const editor = useEditorRef();
1510
- const inputRef = React__default.useRef(null);
1511
- const cursorState = useHTMLInputCursorState(inputRef);
1512
- const [valueState, setValueState] = useState("");
1513
- const hasValueProp = valueProp !== void 0;
1514
- const value = hasValueProp ? valueProp : valueState;
1515
- const setValue = useCallback(
1516
- (newValue) => {
1517
- setValueProp == null ? void 0 : setValueProp(newValue);
1518
- if (!hasValueProp) {
1519
- setValueState(newValue);
1520
- }
1521
- },
1522
- [setValueProp, hasValueProp]
1523
- );
1524
- const [insertPoint, setInsertPoint] = useState(null);
1525
- useEffect(() => {
1526
- const path = findNodePath(editor, element);
1527
- if (!path)
1528
- return;
1529
- const point = getPointBefore(editor, path);
1530
- if (!point)
1531
- return;
1532
- const pointRef = createPointRef(editor, point);
1533
- setInsertPoint(pointRef);
1534
- return () => {
1535
- pointRef.unref();
1536
- };
1537
- }, [editor, element]);
1538
- const { props: inputProps, removeInput } = useComboboxInput({
1539
- cancelInputOnBlur: false,
1540
- cursorState,
1541
- onCancelInput: (cause) => {
1542
- if (cause !== "backspace") {
1543
- insertText(editor, trigger + value, {
1544
- at: (insertPoint == null ? void 0 : insertPoint.current) ?? void 0
1545
- });
1546
- }
1547
- if (cause === "arrowLeft" || cause === "arrowRight") {
1548
- moveSelection(editor, {
1549
- distance: 1,
1550
- reverse: cause === "arrowLeft"
1551
- });
1552
- }
1553
- },
1554
- ref: inputRef
1555
- });
1556
- const [hasEmpty, setHasEmpty] = useState(false);
1557
- const contextValue = useMemo(
1558
- () => ({
1559
- filter,
1560
- inputProps,
1561
- inputRef,
1562
- removeInput,
1563
- setHasEmpty,
1564
- showTrigger,
1565
- trigger
1566
- }),
1567
- [
1568
- trigger,
1569
- showTrigger,
1570
- filter,
1571
- inputRef,
1572
- inputProps,
1573
- removeInput,
1574
- setHasEmpty
1575
- ]
1576
- );
1577
- const store = useComboboxStore({
1578
- setValue: (newValue) => startTransition(() => setValue(newValue))
1579
- });
1580
- const items2 = store.useState("items");
1581
- useEffect(() => {
1582
- if (!store.getState().activeId) {
1583
- store.setActiveId(store.first());
1584
- }
1585
- }, [items2, store]);
1586
- return /* @__PURE__ */ React__default.createElement("span", { contentEditable: false }, /* @__PURE__ */ React__default.createElement(
1587
- ComboboxProvider,
1588
- {
1589
- open: (items2.length > 0 || hasEmpty) && (!hideWhenNoValue || value.length > 0),
1590
- store
1591
- },
1592
- /* @__PURE__ */ React__default.createElement(InlineComboboxContext.Provider, { value: contextValue }, children)
1593
- ));
1594
- };
1595
- const InlineComboboxInput = forwardRef(({ className, ...props }, propRef) => {
1596
- const {
1597
- inputProps,
1598
- inputRef: contextRef,
1599
- showTrigger,
1600
- trigger
1601
- } = useContext(InlineComboboxContext);
1602
- const store = useComboboxContext();
1603
- const value = store.useState("value");
1604
- const ref = useComposedRef(propRef, contextRef);
1605
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, showTrigger && trigger, /* @__PURE__ */ React__default.createElement("span", { className: "relative min-h-[1lh]" }, /* @__PURE__ */ React__default.createElement(
1606
- "span",
1607
- {
1608
- "aria-hidden": "true",
1609
- className: "invisible overflow-hidden text-nowrap"
1610
- },
1611
- value || "​"
1612
- ), /* @__PURE__ */ React__default.createElement(
1613
- Combobox,
1614
- {
1615
- autoSelect: true,
1616
- className: cn$1(
1617
- "absolute left-0 top-0 size-full bg-transparent outline-none",
1618
- className
1619
- ),
1620
- ref,
1621
- value,
1622
- ...inputProps,
1623
- ...props
1624
- }
1625
- )));
1626
- });
1627
- InlineComboboxInput.displayName = "InlineComboboxInput";
1628
- const InlineComboboxContent = ({
1629
- className,
1630
- ...props
1631
- }) => {
1632
- return /* @__PURE__ */ React__default.createElement(Portal, null, /* @__PURE__ */ React__default.createElement(
1633
- ComboboxPopover,
1829
+ "svg",
1634
1830
  {
1635
- className: cn$1(
1636
- "z-[9999999] max-h-[288px] w-[300px] overflow-y-auto rounded-md bg-white shadow-md",
1637
- className
1638
- ),
1639
- ...props
1640
- }
1641
- ));
1642
- };
1643
- const comboboxItemVariants = cva(
1644
- "relative flex h-9 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
1645
- {
1646
- defaultVariants: {
1647
- interactive: true
1831
+ height: "24",
1832
+ width: "24",
1833
+ className: "h-5 w-5",
1834
+ viewBox: "0 0 24 24",
1835
+ xmlns: "http://www.w3.org/2000/svg"
1648
1836
  },
1649
- variants: {
1650
- interactive: {
1651
- false: "",
1652
- true: "cursor-pointer transition-colors hover:bg-blue-500 hover:text-black data-[active-item=true]:bg-orange-400 data-[active-item=true]:text-black"
1837
+ /* @__PURE__ */ React__default.createElement("title", null, title),
1838
+ /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1839
+ "path",
1840
+ {
1841
+ d: "M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3V9H3v3z",
1842
+ fill: "currentColor"
1653
1843
  }
1654
- }
1655
- }
1656
- );
1657
- const InlineComboboxItem = ({
1658
- className,
1659
- keywords,
1660
- onClick,
1661
- ...props
1662
- }) => {
1663
- const { value } = props;
1664
- const { filter, removeInput } = useContext(InlineComboboxContext);
1665
- const store = useComboboxContext();
1666
- const search = filter && store.useState("value");
1667
- const visible = useMemo(
1668
- () => !filter || filter({ keywords, value }, search),
1669
- [filter, value, keywords, search]
1844
+ ))
1670
1845
  );
1671
- if (!visible)
1672
- return null;
1846
+ }
1847
+ function OrderedListIcon(props) {
1848
+ const title = props.title || "format list numbered";
1673
1849
  return /* @__PURE__ */ React__default.createElement(
1674
- ComboboxItem,
1850
+ "svg",
1675
1851
  {
1676
- className: cn$1(comboboxItemVariants(), className),
1677
- onClick: (event) => {
1678
- removeInput(true);
1679
- onClick == null ? void 0 : onClick(event);
1680
- },
1681
- ...props
1682
- }
1852
+ className: "h-5 w-5",
1853
+ height: "24",
1854
+ width: "24",
1855
+ viewBox: "0 0 24 24",
1856
+ xmlns: "http://www.w3.org/2000/svg"
1857
+ },
1858
+ /* @__PURE__ */ React__default.createElement("title", null, title),
1859
+ /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1860
+ "path",
1861
+ {
1862
+ d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z",
1863
+ fill: "currentColor"
1864
+ }
1865
+ ))
1683
1866
  );
1684
- };
1685
- const InlineComboboxEmpty = ({
1686
- children,
1687
- className
1688
- }) => {
1689
- const { setHasEmpty } = useContext(InlineComboboxContext);
1690
- const store = useComboboxContext();
1691
- const items2 = store.useState("items");
1692
- useEffect(() => {
1693
- setHasEmpty(true);
1694
- return () => {
1695
- setHasEmpty(false);
1696
- };
1697
- }, [setHasEmpty]);
1698
- if (items2.length > 0)
1699
- return null;
1867
+ }
1868
+ function QuoteIcon(props) {
1869
+ const title = props.title || "format quote";
1700
1870
  return /* @__PURE__ */ React__default.createElement(
1701
- "div",
1871
+ "svg",
1702
1872
  {
1703
- className: cn$1(comboboxItemVariants({ interactive: false }), className)
1873
+ height: "24",
1874
+ className: "h-5 w-5",
1875
+ width: "24",
1876
+ viewBox: "0 0 24 24",
1877
+ xmlns: "http://www.w3.org/2000/svg"
1704
1878
  },
1705
- children
1879
+ /* @__PURE__ */ React__default.createElement("title", null, title),
1880
+ /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1881
+ "path",
1882
+ {
1883
+ d: "M6 17h3l2-4V7H5v6h3l-2 4zm8 0h3l2-4V7h-6v6h3l-2 4z",
1884
+ fill: "currentColor"
1885
+ }
1886
+ ))
1706
1887
  );
1707
- };
1708
- const rules = [
1709
- {
1710
- icon: Icons.h1,
1711
- onSelect: (editor) => {
1712
- toggleNodeType(editor, { activeType: ELEMENT_H1 });
1713
- },
1714
- value: "Heading 1"
1715
- },
1716
- {
1717
- icon: Icons.h2,
1718
- onSelect: (editor) => {
1719
- toggleNodeType(editor, { activeType: ELEMENT_H2 });
1720
- },
1721
- value: "Heading 2"
1722
- },
1723
- {
1724
- icon: Icons.h3,
1725
- onSelect: (editor) => {
1726
- toggleNodeType(editor, { activeType: ELEMENT_H3 });
1727
- },
1728
- value: "Heading 3"
1729
- },
1730
- {
1731
- icon: Icons.ul,
1732
- keywords: ["ul", "unordered list"],
1733
- onSelect: (editor) => {
1734
- toggleList(editor, { type: ELEMENT_UL });
1735
- },
1736
- value: "Bulleted list"
1737
- },
1738
- {
1739
- icon: Icons.ol,
1740
- keywords: ["ol", "ordered list"],
1741
- onSelect: (editor) => {
1742
- toggleList(editor, { type: ELEMENT_OL });
1888
+ }
1889
+ function LinkIcon(props) {
1890
+ const title = props.title || "insert link";
1891
+ return /* @__PURE__ */ React__default.createElement(
1892
+ "svg",
1893
+ {
1894
+ height: "24",
1895
+ className: "h-5 w-5",
1896
+ width: "24",
1897
+ viewBox: "0 0 24 24",
1898
+ xmlns: "http://www.w3.org/2000/svg"
1743
1899
  },
1744
- value: "Numbered list"
1745
- }
1746
- ];
1747
- const SlashInputElement = withRef(
1748
- ({ className, ...props }, ref) => {
1749
- const { children, editor, element } = props;
1750
- return /* @__PURE__ */ React__default.createElement(
1751
- PlateElement,
1900
+ /* @__PURE__ */ React__default.createElement("title", null, title),
1901
+ /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1902
+ "path",
1752
1903
  {
1753
- as: "span",
1754
- "data-slate-value": element.value,
1755
- ref,
1756
- ...props
1757
- },
1758
- /* @__PURE__ */ React__default.createElement(InlineCombobox, { element, trigger: "/" }, /* @__PURE__ */ React__default.createElement(InlineComboboxInput, null), /* @__PURE__ */ React__default.createElement(InlineComboboxContent, null, /* @__PURE__ */ React__default.createElement(InlineComboboxEmpty, null, "No matching commands found"), rules.map(({ icon: Icon, keywords, onSelect, value }) => /* @__PURE__ */ React__default.createElement(
1759
- InlineComboboxItem,
1760
- {
1761
- key: value,
1762
- keywords,
1763
- onClick: () => onSelect(editor),
1764
- value
1765
- },
1766
- /* @__PURE__ */ React__default.createElement(Icon, { "aria-hidden": true, className: "mr-2 size-4" }),
1767
- value
1768
- )))),
1769
- children
1770
- );
1771
- }
1772
- );
1773
- const listVariants = cva("m-0 ps-6", {
1774
- variants: {
1775
- variant: {
1776
- ol: "list-decimal",
1777
- ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
1778
- }
1779
- }
1780
- });
1781
- const ListElementVariants = withVariants(PlateElement, listVariants, [
1782
- "variant"
1783
- ]);
1784
- const ListElement = withRef(
1785
- ({ children, variant = "ul", ...props }, ref) => {
1786
- const Component2 = variant;
1787
- return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component2, null, children));
1788
- }
1789
- );
1790
- const BlockquoteElement = withRef(
1791
- ({ children, className, ...props }, ref) => {
1792
- return /* @__PURE__ */ React__default.createElement(
1793
- PlateElement,
1904
+ d: "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.71-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z",
1905
+ fill: "currentColor"
1906
+ }
1907
+ ))
1908
+ );
1909
+ }
1910
+ function CodeIcon(props) {
1911
+ const title = props.title || "code";
1912
+ return /* @__PURE__ */ React__default.createElement(
1913
+ "svg",
1914
+ {
1915
+ className: "h-5 w-5",
1916
+ height: "24",
1917
+ width: "24",
1918
+ viewBox: "0 0 24 24",
1919
+ xmlns: "http://www.w3.org/2000/svg"
1920
+ },
1921
+ /* @__PURE__ */ React__default.createElement("title", null, title),
1922
+ /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1923
+ "path",
1794
1924
  {
1795
- asChild: true,
1796
- className: cn$1("my-1 border-l-2 pl-6 italic", className),
1797
- ref,
1798
- ...props
1799
- },
1800
- /* @__PURE__ */ React__default.createElement("blockquote", null, children)
1801
- );
1802
- }
1803
- );
1804
- const CodeLeaf = withRef(
1805
- ({ children, className, ...props }, ref) => {
1806
- return /* @__PURE__ */ React__default.createElement(
1807
- PlateLeaf,
1925
+ d: "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z",
1926
+ fill: "currentColor"
1927
+ }
1928
+ ))
1929
+ );
1930
+ }
1931
+ function CodeBlockIcon(props) {
1932
+ const title = props.title || "code-block";
1933
+ return /* @__PURE__ */ React__default.createElement(
1934
+ "svg",
1935
+ {
1936
+ className: "h-5 w-5",
1937
+ stroke: "currentColor",
1938
+ fill: "currentColor",
1939
+ strokeWidth: 0,
1940
+ viewBox: "0 0 16 16",
1941
+ height: "1em",
1942
+ width: "1em",
1943
+ xmlns: "http://www.w3.org/2000/svg"
1944
+ },
1945
+ /* @__PURE__ */ React__default.createElement("title", null, title),
1946
+ /* @__PURE__ */ React__default.createElement("path", { d: "M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z" }),
1947
+ /* @__PURE__ */ React__default.createElement("path", { d: "M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z" })
1948
+ );
1949
+ }
1950
+ function ImageIcon(props) {
1951
+ const title = props.title || "image";
1952
+ return /* @__PURE__ */ React__default.createElement(
1953
+ "svg",
1954
+ {
1955
+ className: "h-5 w-5",
1956
+ height: "24",
1957
+ width: "24",
1958
+ viewBox: "0 0 24 24",
1959
+ xmlns: "http://www.w3.org/2000/svg"
1960
+ },
1961
+ /* @__PURE__ */ React__default.createElement("title", null, title),
1962
+ /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1963
+ "path",
1808
1964
  {
1809
- asChild: true,
1810
- className: cn$1(
1811
- "whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
1812
- className
1813
- ),
1814
- ref,
1815
- ...props
1816
- },
1817
- /* @__PURE__ */ React__default.createElement("code", null, children)
1818
- );
1819
- }
1820
- );
1821
- const CodeLineElement = withRef((props, ref) => /* @__PURE__ */ React__default.createElement(PlateElement, { ref, ...props }));
1822
- const CodeSyntaxLeaf = withRef(
1823
- ({ children, ...props }, ref) => {
1824
- const { leaf } = props;
1825
- const { tokenProps } = useCodeSyntaxLeaf({ leaf });
1826
- return /* @__PURE__ */ React__default.createElement(PlateLeaf, { ref, ...props }, /* @__PURE__ */ React__default.createElement("span", { ...tokenProps }, children));
1827
- }
1828
- );
1829
- function ChevronDownIcon(props, svgRef) {
1830
- return /* @__PURE__ */ React.createElement("svg", Object.assign({
1831
- xmlns: "http://www.w3.org/2000/svg",
1832
- viewBox: "0 0 20 20",
1833
- fill: "currentColor",
1834
- "aria-hidden": "true",
1835
- ref: svgRef
1836
- }, props), /* @__PURE__ */ React.createElement("path", {
1837
- fillRule: "evenodd",
1838
- d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
1839
- clipRule: "evenodd"
1840
- }));
1965
+ d: "M19 5v14H5V5h14zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z",
1966
+ fill: "currentColor"
1967
+ }
1968
+ ))
1969
+ );
1841
1970
  }
1842
- const ForwardRef = React.forwardRef(ChevronDownIcon);
1843
- const ChevronDownIcon$1 = ForwardRef;
1844
- const Autocomplete = ({
1845
- value,
1846
- onChange,
1847
- defaultQuery,
1848
- items: items2
1849
- }) => {
1850
- const [query, setQuery] = React__default.useState(defaultQuery ?? "");
1851
- const filteredItems = React__default.useMemo(() => {
1852
- try {
1853
- const reFilter = new RegExp(query, "i");
1854
- const _items = items2.filter((item) => reFilter.test(item.label));
1855
- if (_items.length === 0)
1856
- return items2;
1857
- return _items;
1858
- } catch (err) {
1859
- return items2;
1860
- }
1861
- }, [items2, query]);
1971
+ function BoldIcon(props) {
1972
+ const title = props.title || "format bold";
1862
1973
  return /* @__PURE__ */ React__default.createElement(
1863
- Combobox$1,
1974
+ "svg",
1864
1975
  {
1865
- value,
1866
- onChange,
1867
- as: "div",
1868
- className: "relative inline-block text-left z-20"
1976
+ className: "h-5 w-5",
1977
+ height: "24",
1978
+ width: "24",
1979
+ viewBox: "0 0 24 24",
1980
+ xmlns: "http://www.w3.org/2000/svg"
1869
1981
  },
1870
- /* @__PURE__ */ React__default.createElement("div", { className: "mt-1" }, /* @__PURE__ */ React__default.createElement("div", { className: "relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left shadow-md sm:text-sm" }, /* @__PURE__ */ React__default.createElement(
1871
- ComboboxInput,
1982
+ /* @__PURE__ */ React__default.createElement("title", null, title),
1983
+ /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
1984
+ "path",
1872
1985
  {
1873
- className: "w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 focus:ring-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-teal-300",
1874
- displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
1875
- onChange: (event) => setQuery(event.target.value),
1876
- onClick: (ev) => ev.stopPropagation()
1986
+ d: "M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z",
1987
+ fill: "currentColor"
1877
1988
  }
1878
- ), /* @__PURE__ */ React__default.createElement(ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React__default.createElement(
1879
- ChevronDownIcon$1,
1989
+ ))
1990
+ );
1991
+ }
1992
+ function ItalicIcon(props) {
1993
+ const title = props.title || "format italic";
1994
+ return /* @__PURE__ */ React__default.createElement(
1995
+ "svg",
1996
+ {
1997
+ className: "h-5 w-5",
1998
+ height: "24",
1999
+ width: "24",
2000
+ viewBox: "0 0 24 24",
2001
+ xmlns: "http://www.w3.org/2000/svg"
2002
+ },
2003
+ /* @__PURE__ */ React__default.createElement("title", null, title),
2004
+ /* @__PURE__ */ React__default.createElement("g", { fill: "none" }, /* @__PURE__ */ React__default.createElement(
2005
+ "path",
1880
2006
  {
1881
- className: "h-5 w-5 text-gray-400",
1882
- "aria-hidden": "true"
2007
+ d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z",
2008
+ fill: "currentColor"
1883
2009
  }
1884
- )))),
2010
+ ))
2011
+ );
2012
+ }
2013
+ function PlusIcon({ className = "" }) {
2014
+ return /* @__PURE__ */ React__default.createElement(
2015
+ "svg",
2016
+ {
2017
+ xmlns: "http://www.w3.org/2000/svg",
2018
+ className: `h-4 w-4 ${className}`,
2019
+ viewBox: "0 0 20 20",
2020
+ fill: "currentColor"
2021
+ },
1885
2022
  /* @__PURE__ */ React__default.createElement(
1886
- Transition,
2023
+ "path",
1887
2024
  {
1888
- enter: "transition ease-out duration-100",
1889
- enterFrom: "transform opacity-0 scale-95",
1890
- enterTo: "transform opacity-100 scale-100",
1891
- leave: "transition ease-in duration-75",
1892
- leaveFrom: "transform opacity-100 scale-100",
1893
- leaveTo: "transform opacity-0 scale-95"
1894
- },
1895
- /* @__PURE__ */ React__default.createElement(ComboboxOptions, { className: "origin-top-right absolute right-0 mt-1 w-full max-h-[300px] overflow-y-auto rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, filteredItems.map((item) => /* @__PURE__ */ React__default.createElement(ComboboxOption, { key: item.key, value: item }, ({ focus }) => /* @__PURE__ */ React__default.createElement(
1896
- "button",
1897
- {
1898
- className: classNames$1(
1899
- focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
1900
- "block px-4 py-2 text-xs w-full text-right"
1901
- )
1902
- },
1903
- item.render(item)
1904
- ))))
2025
+ fillRule: "evenodd",
2026
+ d: "M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",
2027
+ clipRule: "evenodd"
2028
+ }
1905
2029
  )
1906
2030
  );
1907
- };
1908
- loader.config({
1909
- paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
1910
- });
1911
- let retryCount = 0;
1912
- const retryFocus = (ref) => {
1913
- if (ref.current) {
1914
- ref.current.focus();
1915
- } else {
1916
- if (retryCount < 30) {
1917
- setTimeout(() => {
1918
- retryCount = retryCount + 1;
1919
- retryFocus(ref);
1920
- }, 100);
2031
+ }
2032
+ const InlineComboboxContext = createContext(
2033
+ null
2034
+ );
2035
+ const defaultFilter = ({ keywords = [], value }, search) => [value, ...keywords].some((keyword) => filterWords(keyword, search));
2036
+ const InlineCombobox = ({
2037
+ children,
2038
+ element,
2039
+ filter = defaultFilter,
2040
+ hideWhenNoValue = false,
2041
+ setValue: setValueProp,
2042
+ showTrigger = true,
2043
+ trigger,
2044
+ value: valueProp
2045
+ }) => {
2046
+ const editor = useEditorRef();
2047
+ const inputRef = React__default.useRef(null);
2048
+ const cursorState = useHTMLInputCursorState(inputRef);
2049
+ const [valueState, setValueState] = useState("");
2050
+ const hasValueProp = valueProp !== void 0;
2051
+ const value = hasValueProp ? valueProp : valueState;
2052
+ const setValue = useCallback(
2053
+ (newValue) => {
2054
+ setValueProp == null ? void 0 : setValueProp(newValue);
2055
+ if (!hasValueProp) {
2056
+ setValueState(newValue);
2057
+ }
2058
+ },
2059
+ [setValueProp, hasValueProp]
2060
+ );
2061
+ const [insertPoint, setInsertPoint] = useState(null);
2062
+ useEffect(() => {
2063
+ const path = findNodePath(editor, element);
2064
+ if (!path)
2065
+ return;
2066
+ const point = getPointBefore(editor, path);
2067
+ if (!point)
2068
+ return;
2069
+ const pointRef = createPointRef(editor, point);
2070
+ setInsertPoint(pointRef);
2071
+ return () => {
2072
+ pointRef.unref();
2073
+ };
2074
+ }, [editor, element]);
2075
+ const { props: inputProps, removeInput } = useComboboxInput({
2076
+ cancelInputOnBlur: false,
2077
+ cursorState,
2078
+ onCancelInput: (cause) => {
2079
+ if (cause !== "backspace") {
2080
+ insertText(editor, trigger + value, {
2081
+ at: (insertPoint == null ? void 0 : insertPoint.current) ?? void 0
2082
+ });
2083
+ }
2084
+ if (cause === "arrowLeft" || cause === "arrowRight") {
2085
+ moveSelection(editor, {
2086
+ distance: 1,
2087
+ reverse: cause === "arrowLeft"
2088
+ });
2089
+ }
2090
+ },
2091
+ ref: inputRef
2092
+ });
2093
+ const [hasEmpty, setHasEmpty] = useState(false);
2094
+ const contextValue = useMemo(
2095
+ () => ({
2096
+ filter,
2097
+ inputProps,
2098
+ inputRef,
2099
+ removeInput,
2100
+ setHasEmpty,
2101
+ showTrigger,
2102
+ trigger
2103
+ }),
2104
+ [
2105
+ trigger,
2106
+ showTrigger,
2107
+ filter,
2108
+ inputRef,
2109
+ inputProps,
2110
+ removeInput,
2111
+ setHasEmpty
2112
+ ]
2113
+ );
2114
+ const store = useComboboxStore({
2115
+ setValue: (newValue) => startTransition(() => setValue(newValue))
2116
+ });
2117
+ const items2 = store.useState("items");
2118
+ useEffect(() => {
2119
+ if (!store.getState().activeId) {
2120
+ store.setActiveId(store.first());
1921
2121
  }
1922
- }
2122
+ }, [items2, store]);
2123
+ return /* @__PURE__ */ React__default.createElement("span", { contentEditable: false }, /* @__PURE__ */ React__default.createElement(
2124
+ ComboboxProvider,
2125
+ {
2126
+ open: (items2.length > 0 || hasEmpty) && (!hideWhenNoValue || value.length > 0),
2127
+ store
2128
+ },
2129
+ /* @__PURE__ */ React__default.createElement(InlineComboboxContext.Provider, { value: contextValue }, children)
2130
+ ));
1923
2131
  };
1924
- const CodeBlock = ({
1925
- attributes,
1926
- editor,
1927
- element,
1928
- language: restrictLanguage,
2132
+ const InlineComboboxInput = forwardRef(({ className, ...props }, propRef) => {
2133
+ const {
2134
+ inputProps,
2135
+ inputRef: contextRef,
2136
+ showTrigger,
2137
+ trigger
2138
+ } = useContext(InlineComboboxContext);
2139
+ const store = useComboboxContext();
2140
+ const value = store.useState("value");
2141
+ const ref = useComposedRef(propRef, contextRef);
2142
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, showTrigger && trigger, /* @__PURE__ */ React__default.createElement("span", { className: "relative min-h-[1lh]" }, /* @__PURE__ */ React__default.createElement(
2143
+ "span",
2144
+ {
2145
+ "aria-hidden": "true",
2146
+ className: "invisible overflow-hidden text-nowrap"
2147
+ },
2148
+ value || "​"
2149
+ ), /* @__PURE__ */ React__default.createElement(
2150
+ Combobox$1,
2151
+ {
2152
+ autoSelect: true,
2153
+ className: cn$1(
2154
+ "absolute left-0 top-0 size-full bg-transparent outline-none",
2155
+ className
2156
+ ),
2157
+ ref,
2158
+ value,
2159
+ ...inputProps,
2160
+ ...props
2161
+ }
2162
+ )));
2163
+ });
2164
+ InlineComboboxInput.displayName = "InlineComboboxInput";
2165
+ const InlineComboboxContent = ({
2166
+ className,
1929
2167
  ...props
1930
2168
  }) => {
1931
- const [navigateAway, setNavigateAway] = React__default.useState(null);
1932
- const monaco = useMonaco();
1933
- const monacoEditorRef = React__default.useRef(null);
1934
- const selected = useSelected();
1935
- const [height, setHeight] = React__default.useState(28);
1936
- React__default.useEffect(() => {
1937
- if (selected && isCollapsed(editor.selection)) {
1938
- retryFocus(monacoEditorRef);
1939
- }
1940
- }, [selected, monacoEditorRef.current]);
1941
- const value = element.value || "";
1942
- if (typeof value !== "string") {
1943
- throw new Error("Element must be of type string for code block");
1944
- }
1945
- const language = restrictLanguage || element.lang;
1946
- const id = React__default.useMemo(() => uuid(), []);
1947
- const languages = React__default.useMemo(() => {
1948
- const defaultLangSet = { "": "plain text" };
1949
- if (!monaco)
1950
- return defaultLangSet;
1951
- return monaco.languages.getLanguages().reduce((ac, cv) => {
1952
- if (cv.id === "plaintext")
1953
- return ac;
1954
- return { ...ac, [cv.id]: cv.id };
1955
- }, defaultLangSet);
1956
- }, [monaco]);
1957
- React__default.useEffect(() => {
1958
- if (monaco) {
1959
- monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
1960
- monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
1961
- // disable errors
1962
- noSemanticValidation: true,
1963
- noSyntaxValidation: true
1964
- });
1965
- }
1966
- }, [monaco]);
1967
- const items2 = Object.entries(languages).map(([key, label]) => ({
1968
- key,
1969
- label,
1970
- render: (item) => item.label
1971
- }));
1972
- const currentItem = React__default.useMemo(() => {
1973
- return items2.find((item) => item.key === language) ?? {
1974
- key: "",
1975
- label: "Plain Text"
1976
- };
1977
- }, [items2, language]);
1978
- React__default.useEffect(() => {
1979
- if (navigateAway) {
1980
- setNavigateAway(null);
1981
- switch (navigateAway) {
1982
- case "remove":
1983
- {
1984
- focusEditor(editor);
1985
- setNodes(
1986
- editor,
1987
- {
1988
- type: "p",
1989
- children: [{ text: "" }],
1990
- lang: void 0,
1991
- value: void 0
1992
- },
1993
- {
1994
- match: (n) => {
1995
- if (isElement(n) && n.type === element.type) {
1996
- return true;
1997
- }
1998
- }
1999
- }
2000
- );
2001
- }
2002
- break;
2003
- case "insertNext":
2004
- {
2005
- insertNodes(
2006
- editor,
2007
- [
2008
- {
2009
- type: ELEMENT_DEFAULT,
2010
- children: [{ text: "" }],
2011
- lang: void 0,
2012
- value: void 0
2013
- }
2014
- ],
2015
- { select: true }
2016
- );
2017
- focusEditor(editor);
2018
- }
2019
- break;
2020
- case "up":
2021
- {
2022
- const path = findNodePath(editor, element);
2023
- if (!path) {
2024
- return;
2025
- }
2026
- const previousNodePath = getPointBefore(editor, path);
2027
- if (!previousNodePath) {
2028
- focusEditor(editor);
2029
- insertNodes(
2030
- editor,
2031
- [
2032
- {
2033
- type: ELEMENT_DEFAULT,
2034
- children: [{ text: "" }],
2035
- lang: void 0,
2036
- value: void 0
2037
- }
2038
- ],
2039
- // Insert a new node at the current path, resulting in the code_block
2040
- // moving down one block
2041
- { at: path, select: true }
2042
- );
2043
- return;
2044
- }
2045
- focusEditor(editor, previousNodePath);
2046
- }
2047
- break;
2048
- case "down": {
2049
- const path = findNodePath(editor, element);
2050
- if (!path) {
2051
- return;
2052
- }
2053
- const nextNodePath = getPointAfter(editor, path);
2054
- if (!nextNodePath) {
2055
- insertNodes(
2056
- editor,
2057
- [
2058
- {
2059
- type: ELEMENT_DEFAULT,
2060
- children: [{ text: "" }],
2061
- lang: void 0,
2062
- value: void 0
2063
- }
2064
- ],
2065
- { select: true }
2066
- );
2067
- focusEditor(editor);
2068
- } else {
2069
- focusEditor(editor, nextNodePath);
2070
- }
2071
- break;
2072
- }
2073
- }
2169
+ return /* @__PURE__ */ React__default.createElement(Portal, null, /* @__PURE__ */ React__default.createElement(
2170
+ ComboboxPopover,
2171
+ {
2172
+ className: cn$1(
2173
+ "z-[9999999] max-h-[288px] w-[300px] overflow-y-auto rounded-md bg-white shadow-md",
2174
+ className
2175
+ ),
2176
+ ...props
2074
2177
  }
2075
- }, [navigateAway]);
2076
- function handleEditorDidMount(monacoEditor, monaco2) {
2077
- monacoEditorRef.current = monacoEditor;
2078
- monacoEditor.onDidContentSizeChange(() => {
2079
- setHeight(monacoEditor.getContentHeight());
2080
- monacoEditor.layout();
2081
- });
2082
- monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
2083
- if (monacoEditor.hasTextFocus()) {
2084
- setNavigateAway("insertNext");
2085
- }
2086
- });
2087
- monacoEditor.onKeyDown((l) => {
2088
- if (l.code === "ArrowUp") {
2089
- const selection = monacoEditor.getSelection();
2090
- if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
2091
- setNavigateAway("up");
2092
- }
2093
- }
2094
- if (l.code === "ArrowDown") {
2095
- const selection = monacoEditor.getSelection();
2096
- const totalLines = monacoEditor.getModel().getLineCount();
2097
- if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
2098
- setNavigateAway("down");
2099
- }
2100
- }
2101
- if (l.code === "Backspace") {
2102
- const selection = monacoEditor.getSelection();
2103
- if (selection.endColumn === 1 && selection.endLineNumber === 1 && selection.positionColumn === 1 && selection.positionLineNumber === 1 && selection.selectionStartColumn === 1 && selection.selectionStartLineNumber === 1 && selection.startColumn === 1 && selection.startLineNumber === 1) {
2104
- setNavigateAway("remove");
2105
- }
2178
+ ));
2179
+ };
2180
+ const comboboxItemVariants = cva(
2181
+ "relative flex h-9 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
2182
+ {
2183
+ defaultVariants: {
2184
+ interactive: true
2185
+ },
2186
+ variants: {
2187
+ interactive: {
2188
+ false: "",
2189
+ true: "cursor-pointer transition-colors hover:bg-blue-500 hover:text-black data-[active-item=true]:bg-orange-400 data-[active-item=true]:text-black"
2106
2190
  }
2107
- });
2191
+ }
2108
2192
  }
2193
+ );
2194
+ const InlineComboboxItem = ({
2195
+ className,
2196
+ keywords,
2197
+ onClick,
2198
+ ...props
2199
+ }) => {
2200
+ const { value } = props;
2201
+ const { filter, removeInput } = useContext(InlineComboboxContext);
2202
+ const store = useComboboxContext();
2203
+ const search = filter && store.useState("value");
2204
+ const visible = useMemo(
2205
+ () => !filter || filter({ keywords, value }, search),
2206
+ [filter, value, keywords, search]
2207
+ );
2208
+ if (!visible)
2209
+ return null;
2210
+ return /* @__PURE__ */ React__default.createElement(
2211
+ ComboboxItem,
2212
+ {
2213
+ className: cn$1(comboboxItemVariants(), className),
2214
+ onClick: (event) => {
2215
+ removeInput(true);
2216
+ onClick == null ? void 0 : onClick(event);
2217
+ },
2218
+ ...props
2219
+ }
2220
+ );
2221
+ };
2222
+ const InlineComboboxEmpty = ({
2223
+ children,
2224
+ className
2225
+ }) => {
2226
+ const { setHasEmpty } = useContext(InlineComboboxContext);
2227
+ const store = useComboboxContext();
2228
+ const items2 = store.useState("items");
2229
+ useEffect(() => {
2230
+ setHasEmpty(true);
2231
+ return () => {
2232
+ setHasEmpty(false);
2233
+ };
2234
+ }, [setHasEmpty]);
2235
+ if (items2.length > 0)
2236
+ return null;
2109
2237
  return /* @__PURE__ */ React__default.createElement(
2110
2238
  "div",
2111
2239
  {
2112
- ...attributes,
2113
- className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
2240
+ className: cn$1(comboboxItemVariants({ interactive: false }), className)
2114
2241
  },
2115
- /* @__PURE__ */ React__default.createElement("style", null, `.monaco-editor .editor-widget {
2116
- display: none !important;
2117
- visibility: hidden !important;
2118
- }`),
2119
- props.children,
2120
- /* @__PURE__ */ React__default.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React__default.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React__default.createElement("div", null), /* @__PURE__ */ React__default.createElement(
2121
- Autocomplete,
2122
- {
2123
- items: items2,
2124
- value: currentItem,
2125
- defaultQuery: "plaintext",
2126
- onChange: (item) => setNodes(editor, { lang: item.key })
2127
- }
2128
- )), /* @__PURE__ */ React__default.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React__default.createElement(
2129
- MonacoEditor,
2130
- {
2131
- path: id,
2132
- onMount: handleEditorDidMount,
2133
- options: {
2134
- scrollBeyondLastLine: false,
2135
- // automaticLayout: true,
2136
- tabSize: 2,
2137
- disableLayerHinting: true,
2138
- accessibilitySupport: "off",
2139
- codeLens: false,
2140
- wordWrap: "on",
2141
- minimap: {
2142
- enabled: false
2143
- },
2144
- fontSize: 14,
2145
- lineHeight: 2,
2146
- formatOnPaste: true,
2147
- lineNumbers: "off",
2148
- formatOnType: true,
2149
- fixedOverflowWidgets: true,
2150
- // Takes too much horizontal space for iframe
2151
- folding: false,
2152
- renderLineHighlight: "none",
2153
- scrollbar: {
2154
- verticalScrollbarSize: 1,
2155
- horizontalScrollbarSize: 1,
2156
- // https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
2157
- alwaysConsumeMouseWheel: false
2158
- }
2159
- },
2160
- language: String(language),
2161
- value: String(element.value),
2162
- onChange: (value2) => {
2163
- setNodes(editor, { value: value2, lang: language });
2164
- }
2165
- }
2166
- )))
2242
+ children
2167
2243
  );
2168
2244
  };
2169
- const CodeBlockElement = withRef(
2245
+ const rules = [
2246
+ {
2247
+ icon: Icons.h1,
2248
+ onSelect: (editor) => {
2249
+ toggleNodeType(editor, { activeType: ELEMENT_H1 });
2250
+ },
2251
+ value: "Heading 1"
2252
+ },
2253
+ {
2254
+ icon: Icons.h2,
2255
+ onSelect: (editor) => {
2256
+ toggleNodeType(editor, { activeType: ELEMENT_H2 });
2257
+ },
2258
+ value: "Heading 2"
2259
+ },
2260
+ {
2261
+ icon: Icons.h3,
2262
+ onSelect: (editor) => {
2263
+ toggleNodeType(editor, { activeType: ELEMENT_H3 });
2264
+ },
2265
+ value: "Heading 3"
2266
+ },
2267
+ {
2268
+ icon: Icons.ul,
2269
+ keywords: ["ul", "unordered list"],
2270
+ onSelect: (editor) => {
2271
+ toggleList(editor, { type: ELEMENT_UL });
2272
+ },
2273
+ value: "Bulleted list"
2274
+ },
2275
+ {
2276
+ icon: Icons.ol,
2277
+ keywords: ["ol", "ordered list"],
2278
+ onSelect: (editor) => {
2279
+ toggleList(editor, { type: ELEMENT_OL });
2280
+ },
2281
+ value: "Numbered list"
2282
+ }
2283
+ ];
2284
+ const SlashInputElement = withRef(
2170
2285
  ({ className, ...props }, ref) => {
2171
- const { element } = props;
2172
- const state = useCodeBlockElementState({ element });
2286
+ const { children, editor, element } = props;
2173
2287
  return /* @__PURE__ */ React__default.createElement(
2174
2288
  PlateElement,
2175
2289
  {
2176
- className: cn$1("relative py-1", state.className, className),
2290
+ as: "span",
2291
+ "data-slate-value": element.value,
2177
2292
  ref,
2178
2293
  ...props
2179
2294
  },
2180
- /* @__PURE__ */ React__default.createElement(CodeBlock, { ...props })
2295
+ /* @__PURE__ */ React__default.createElement(InlineCombobox, { element, trigger: "/" }, /* @__PURE__ */ React__default.createElement(InlineComboboxInput, null), /* @__PURE__ */ React__default.createElement(InlineComboboxContent, null, /* @__PURE__ */ React__default.createElement(InlineComboboxEmpty, null, "No matching commands found"), rules.map(({ icon: Icon, keywords, onSelect, value }) => /* @__PURE__ */ React__default.createElement(
2296
+ InlineComboboxItem,
2297
+ {
2298
+ key: value,
2299
+ keywords,
2300
+ onClick: () => onSelect(editor),
2301
+ value
2302
+ },
2303
+ /* @__PURE__ */ React__default.createElement(Icon, { "aria-hidden": true, className: "mr-2 size-4" }),
2304
+ value
2305
+ )))),
2306
+ children
2181
2307
  );
2182
2308
  }
2183
2309
  );
2310
+ const TableCellElement = withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
2311
+ var _a, _b, _c, _d;
2312
+ const { element } = props;
2313
+ const {
2314
+ borders,
2315
+ colIndex,
2316
+ colSpan,
2317
+ hovered,
2318
+ hoveredLeft,
2319
+ isSelectingCell,
2320
+ readOnly,
2321
+ rowIndex,
2322
+ rowSize,
2323
+ selected
2324
+ } = useTableCellElementState();
2325
+ const { props: cellProps } = useTableCellElement({ element: props.element });
2326
+ const resizableState = useTableCellElementResizableState({
2327
+ colIndex,
2328
+ colSpan,
2329
+ rowIndex
2330
+ });
2331
+ const { bottomProps, hiddenLeft, leftProps, rightProps } = useTableCellElementResizable(resizableState);
2332
+ const Cell = isHeader ? "th" : "td";
2333
+ return /* @__PURE__ */ React__default.createElement(
2334
+ PlateElement,
2335
+ {
2336
+ asChild: true,
2337
+ className: cn$1(
2338
+ "relative h-full overflow-visible border-none bg-background p-0",
2339
+ hideBorder && "before:border-none",
2340
+ element.background ? "bg-[--cellBackground]" : "bg-background",
2341
+ !hideBorder && cn$1(
2342
+ isHeader && "text-left [&_>_*]:m-0",
2343
+ "before:size-full",
2344
+ selected && "before:z-10 before:bg-muted",
2345
+ "before:absolute before:box-border before:select-none before:content-['']",
2346
+ borders && cn$1(
2347
+ ((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
2348
+ ((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
2349
+ ((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
2350
+ ((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
2351
+ )
2352
+ ),
2353
+ className
2354
+ ),
2355
+ ref,
2356
+ ...cellProps,
2357
+ ...props,
2358
+ style: {
2359
+ "--cellBackground": element.background,
2360
+ ...style
2361
+ }
2362
+ },
2363
+ /* @__PURE__ */ React__default.createElement(Cell, null, /* @__PURE__ */ React__default.createElement(
2364
+ "div",
2365
+ {
2366
+ className: "relative z-20 box-border h-full px-3 py-2",
2367
+ style: {
2368
+ minHeight: rowSize
2369
+ }
2370
+ },
2371
+ children
2372
+ ), !isSelectingCell && /* @__PURE__ */ React__default.createElement(
2373
+ "div",
2374
+ {
2375
+ className: "group absolute top-0 size-full select-none",
2376
+ contentEditable: false,
2377
+ suppressContentEditableWarning: true
2378
+ },
2379
+ !readOnly && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
2380
+ ResizeHandle$1,
2381
+ {
2382
+ ...rightProps,
2383
+ className: "-top-3 right-[-5px] w-[10px]"
2384
+ }
2385
+ ), /* @__PURE__ */ React__default.createElement(
2386
+ ResizeHandle$1,
2387
+ {
2388
+ ...bottomProps,
2389
+ className: "bottom-[-5px] h-[10px]"
2390
+ }
2391
+ ), !hiddenLeft && /* @__PURE__ */ React__default.createElement(
2392
+ ResizeHandle$1,
2393
+ {
2394
+ ...leftProps,
2395
+ className: "-top-3 left-[-5px] w-[10px]"
2396
+ }
2397
+ ), hovered && /* @__PURE__ */ React__default.createElement(
2398
+ "div",
2399
+ {
2400
+ className: cn$1(
2401
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2402
+ "right-[-1.5px]"
2403
+ )
2404
+ }
2405
+ ), hoveredLeft && /* @__PURE__ */ React__default.createElement(
2406
+ "div",
2407
+ {
2408
+ className: cn$1(
2409
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2410
+ "left-[-1.5px]"
2411
+ )
2412
+ }
2413
+ ))
2414
+ ))
2415
+ );
2416
+ });
2417
+ TableCellElement.displayName = "TableCellElement";
2418
+ const TableCellHeaderElement = withProps(TableCellElement, {
2419
+ isHeader: true
2420
+ });
2184
2421
  const buttonVariants$1 = cva(
2185
2422
  "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
2186
2423
  {
@@ -2546,117 +2783,6 @@ const TableRowElement = withRef(({ children, hideBorder, ...props }, ref) => {
2546
2783
  /* @__PURE__ */ React__default.createElement("tr", null, children)
2547
2784
  );
2548
2785
  });
2549
- const TableCellElement = withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
2550
- var _a, _b, _c, _d;
2551
- const { element } = props;
2552
- const {
2553
- borders,
2554
- colIndex,
2555
- colSpan,
2556
- hovered,
2557
- hoveredLeft,
2558
- isSelectingCell,
2559
- readOnly,
2560
- rowIndex,
2561
- rowSize,
2562
- selected
2563
- } = useTableCellElementState();
2564
- const { props: cellProps } = useTableCellElement({ element: props.element });
2565
- const resizableState = useTableCellElementResizableState({
2566
- colIndex,
2567
- colSpan,
2568
- rowIndex
2569
- });
2570
- const { bottomProps, hiddenLeft, leftProps, rightProps } = useTableCellElementResizable(resizableState);
2571
- const Cell = isHeader ? "th" : "td";
2572
- return /* @__PURE__ */ React__default.createElement(
2573
- PlateElement,
2574
- {
2575
- asChild: true,
2576
- className: cn$1(
2577
- "relative h-full overflow-visible border-none bg-background p-0",
2578
- hideBorder && "before:border-none",
2579
- element.background ? "bg-[--cellBackground]" : "bg-background",
2580
- !hideBorder && cn$1(
2581
- isHeader && "text-left [&_>_*]:m-0",
2582
- "before:size-full",
2583
- selected && "before:z-10 before:bg-muted",
2584
- "before:absolute before:box-border before:select-none before:content-['']",
2585
- borders && cn$1(
2586
- ((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
2587
- ((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
2588
- ((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
2589
- ((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
2590
- )
2591
- ),
2592
- className
2593
- ),
2594
- ref,
2595
- ...cellProps,
2596
- ...props,
2597
- style: {
2598
- "--cellBackground": element.background,
2599
- ...style
2600
- }
2601
- },
2602
- /* @__PURE__ */ React__default.createElement(Cell, null, /* @__PURE__ */ React__default.createElement(
2603
- "div",
2604
- {
2605
- className: "relative z-20 box-border h-full px-3 py-2",
2606
- style: {
2607
- minHeight: rowSize
2608
- }
2609
- },
2610
- children
2611
- ), !isSelectingCell && /* @__PURE__ */ React__default.createElement(
2612
- "div",
2613
- {
2614
- className: "group absolute top-0 size-full select-none",
2615
- contentEditable: false,
2616
- suppressContentEditableWarning: true
2617
- },
2618
- !readOnly && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
2619
- ResizeHandle$1,
2620
- {
2621
- ...rightProps,
2622
- className: "-top-3 right-[-5px] w-[10px]"
2623
- }
2624
- ), /* @__PURE__ */ React__default.createElement(
2625
- ResizeHandle$1,
2626
- {
2627
- ...bottomProps,
2628
- className: "bottom-[-5px] h-[10px]"
2629
- }
2630
- ), !hiddenLeft && /* @__PURE__ */ React__default.createElement(
2631
- ResizeHandle$1,
2632
- {
2633
- ...leftProps,
2634
- className: "-top-3 left-[-5px] w-[10px]"
2635
- }
2636
- ), hovered && /* @__PURE__ */ React__default.createElement(
2637
- "div",
2638
- {
2639
- className: cn$1(
2640
- "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2641
- "right-[-1.5px]"
2642
- )
2643
- }
2644
- ), hoveredLeft && /* @__PURE__ */ React__default.createElement(
2645
- "div",
2646
- {
2647
- className: cn$1(
2648
- "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2649
- "left-[-1.5px]"
2650
- )
2651
- }
2652
- ))
2653
- ))
2654
- );
2655
- });
2656
- TableCellElement.displayName = "TableCellElement";
2657
- const TableCellHeaderElement = withProps(TableCellElement, {
2658
- isHeader: true
2659
- });
2660
2786
  const blockClasses = "mt-0.5";
2661
2787
  const headerClasses = "font-normal";
2662
2788
  const Components = () => {
@@ -2762,6 +2888,7 @@ const Components = () => {
2762
2888
  }
2763
2889
  )
2764
2890
  ),
2891
+ [ELEMENT_MERMAID]: MermaidElement,
2765
2892
  [ELEMENT_BLOCKQUOTE]: BlockquoteElement,
2766
2893
  [ELEMENT_CODE_BLOCK]: CodeBlockElement,
2767
2894
  [ELEMENT_CODE_LINE]: CodeLineElement,
@@ -3256,7 +3383,9 @@ class Form {
3256
3383
  {
3257
3384
  type: "string",
3258
3385
  label: "Caption",
3259
- name: [templateName.replace(/\.props$/, ""), "caption"].join("."),
3386
+ name: [templateName.replace(/\.props$/, ""), "caption"].join(
3387
+ "."
3388
+ ),
3260
3389
  component: "text"
3261
3390
  }
3262
3391
  ]
@@ -13924,7 +14053,7 @@ const TooltipContent = withCn(
13924
14053
  withProps(TooltipPrimitive.Content, {
13925
14054
  sideOffset: 4
13926
14055
  }),
13927
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
14056
+ "z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
13928
14057
  );
13929
14058
  function withTooltip(Component2) {
13930
14059
  return React__default.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
@@ -14050,30 +14179,42 @@ const FixedToolbar = withCn(
14050
14179
  Toolbar,
14051
14180
  "p-1 sticky left-0 top-0 z-50 w-full justify-between overflow-x-auto border border-border bg-background"
14052
14181
  );
14053
- const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
14054
- const state = useMarkToolbarButtonState({ clear, nodeType });
14055
- const { props } = useMarkToolbarButton(state);
14056
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest });
14057
- });
14058
- const IndentListToolbarButton = withRef(({ nodeType = ELEMENT_UL }, ref) => {
14059
- const editor = useEditorState();
14060
- const state = useListToolbarButtonState({ nodeType });
14061
- const { props } = useListToolbarButton(state);
14062
- return /* @__PURE__ */ React__default.createElement(
14063
- ToolbarButton,
14064
- {
14065
- ref,
14066
- tooltip: nodeType === ELEMENT_UL ? "Bulleted List" : "Numbered List",
14067
- ...props,
14068
- onClick: (e) => {
14069
- e.preventDefault();
14070
- e.stopPropagation();
14071
- toggleList(editor, { type: nodeType });
14182
+ const useResize = (ref, callback) => {
14183
+ React__default.useEffect(() => {
14184
+ const resizeObserver = new ResizeObserver((entries) => {
14185
+ for (const entry of entries) {
14186
+ callback(entry);
14072
14187
  }
14073
- },
14074
- nodeType === ELEMENT_UL ? /* @__PURE__ */ React__default.createElement(Icons.ul, null) : /* @__PURE__ */ React__default.createElement(Icons.ol, null)
14075
- );
14076
- });
14188
+ });
14189
+ if (ref.current) {
14190
+ resizeObserver.observe(ref.current);
14191
+ }
14192
+ return () => resizeObserver.disconnect();
14193
+ }, [ref.current]);
14194
+ };
14195
+ const STANDARD_ICON_WIDTH = 32;
14196
+ const HEADING_ICON_WITH_TEXT = 127;
14197
+ const HEADING_ICON_ONLY = 58;
14198
+ const EMBED_ICON_WIDTH = 78;
14199
+ const CONTAINER_MD_BREAKPOINT = 448;
14200
+ const FLOAT_BUTTON_WIDTH = 25;
14201
+ const HEADING_LABEL = "Headings";
14202
+ const ToolbarContext = createContext(void 0);
14203
+ const ToolbarProvider = ({
14204
+ tinaForm,
14205
+ templates,
14206
+ overrides,
14207
+ children
14208
+ }) => {
14209
+ return /* @__PURE__ */ React__default.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
14210
+ };
14211
+ const useToolbarContext = () => {
14212
+ const context = useContext(ToolbarContext);
14213
+ if (!context) {
14214
+ throw new Error("useToolbarContext must be used within a ToolbarProvider");
14215
+ }
14216
+ return context;
14217
+ };
14077
14218
  const items$1 = [
14078
14219
  {
14079
14220
  description: "Paragraph",
@@ -14146,77 +14287,41 @@ function HeadingsMenu(props) {
14146
14287
  return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(
14147
14288
  ToolbarButton,
14148
14289
  {
14149
- showArrow: true,
14150
- isDropdown: true,
14151
- pressed: openState.open,
14152
- tooltip: "Headings"
14153
- },
14154
- /* @__PURE__ */ React__default.createElement(SelectedItemIcon, { className: "size-5" }),
14155
- /* @__PURE__ */ React__default.createElement("span", { className: "@md/toolbar:flex hidden" }, selectedItemLabel)
14156
- )), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { align: "start", className: "min-w-0" }, /* @__PURE__ */ React__default.createElement(
14157
- DropdownMenuRadioGroup,
14158
- {
14159
- className: "flex flex-col gap-0.5",
14160
- onValueChange: (type) => {
14161
- toggleNodeType(editor, { activeType: type });
14162
- collapseSelection(editor);
14163
- focusEditor(editor);
14164
- },
14165
- value
14166
- },
14167
- items$1.filter((item) => {
14168
- if (userInTable) {
14169
- return !unsupportedItemsInTable.has(item.label);
14170
- }
14171
- return true;
14172
- }).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React__default.createElement(
14173
- DropdownMenuRadioItem,
14174
- {
14175
- className: "min-w-[180px]",
14176
- key: itemValue,
14177
- value: itemValue
14178
- },
14179
- /* @__PURE__ */ React__default.createElement(Icon, { className: "mr-2 size-5" }),
14180
- label
14181
- ))
14182
- )));
14183
- }
14184
- const LinkToolbarButton = withRef((rest, ref) => {
14185
- const state = useLinkToolbarButtonState();
14186
- const { props } = useLinkToolbarButton(state);
14187
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React__default.createElement(Icons.link, null));
14188
- });
14189
- const useBlockQuoteToolbarButtonState = () => {
14190
- const editor = useEditorState();
14191
- const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_BLOCKQUOTE$1);
14192
- return {
14193
- pressed: isBlockActive()
14194
- };
14195
- };
14196
- const useBlockQuoteToolbarButton = (state) => {
14197
- const editor = useEditorState();
14198
- const onClick = () => {
14199
- toggleNodeType(editor, {
14200
- activeType: ELEMENT_BLOCKQUOTE$1
14201
- });
14202
- };
14203
- const onMouseDown = (e) => {
14204
- e.preventDefault();
14205
- e.stopPropagation();
14206
- };
14207
- return {
14208
- props: {
14209
- onClick,
14210
- onMouseDown,
14211
- pressed: state.pressed
14212
- }
14213
- };
14214
- };
14215
- const QuoteToolbarButton = withRef(({ clear, ...rest }, ref) => {
14216
- const state = useBlockQuoteToolbarButtonState();
14217
- const { props } = useBlockQuoteToolbarButton(state);
14218
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.quote, null));
14219
- });
14290
+ showArrow: true,
14291
+ isDropdown: true,
14292
+ pressed: openState.open,
14293
+ tooltip: "Headings"
14294
+ },
14295
+ /* @__PURE__ */ React__default.createElement(SelectedItemIcon, { className: "size-5" }),
14296
+ /* @__PURE__ */ React__default.createElement("span", { className: "@md/toolbar:flex hidden" }, selectedItemLabel)
14297
+ )), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { align: "start", className: "min-w-0" }, /* @__PURE__ */ React__default.createElement(
14298
+ DropdownMenuRadioGroup,
14299
+ {
14300
+ className: "flex flex-col gap-0.5",
14301
+ onValueChange: (type) => {
14302
+ toggleNodeType(editor, { activeType: type });
14303
+ collapseSelection(editor);
14304
+ focusEditor(editor);
14305
+ },
14306
+ value
14307
+ },
14308
+ items$1.filter((item) => {
14309
+ if (userInTable) {
14310
+ return !unsupportedItemsInTable.has(item.label);
14311
+ }
14312
+ return true;
14313
+ }).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React__default.createElement(
14314
+ DropdownMenuRadioItem,
14315
+ {
14316
+ className: "min-w-[180px]",
14317
+ key: itemValue,
14318
+ value: itemValue
14319
+ },
14320
+ /* @__PURE__ */ React__default.createElement(Icon, { className: "mr-2 size-5" }),
14321
+ label
14322
+ ))
14323
+ )));
14324
+ }
14220
14325
  const useCodeBlockToolbarButtonState = () => {
14221
14326
  const editor = useEditorState();
14222
14327
  const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_CODE_BLOCK$1);
@@ -14278,101 +14383,67 @@ const ImageToolbarButton = withRef(({ clear, ...rest }, ref) => {
14278
14383
  const { props } = useImageToolbarButton(state);
14279
14384
  return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.image, null));
14280
14385
  });
14281
- const useRawMarkdownToolbarButton = () => {
14282
- const { setRawMode } = useEditorContext();
14386
+ const IndentListToolbarButton = withRef(({ nodeType = ELEMENT_UL }, ref) => {
14387
+ const editor = useEditorState();
14388
+ const state = useListToolbarButtonState({ nodeType });
14389
+ const { props } = useListToolbarButton(state);
14390
+ return /* @__PURE__ */ React__default.createElement(
14391
+ ToolbarButton,
14392
+ {
14393
+ ref,
14394
+ tooltip: nodeType === ELEMENT_UL ? "Bulleted List" : "Numbered List",
14395
+ ...props,
14396
+ onClick: (e) => {
14397
+ e.preventDefault();
14398
+ e.stopPropagation();
14399
+ toggleList(editor, { type: nodeType });
14400
+ }
14401
+ },
14402
+ nodeType === ELEMENT_UL ? /* @__PURE__ */ React__default.createElement(Icons.ul, null) : /* @__PURE__ */ React__default.createElement(Icons.ol, null)
14403
+ );
14404
+ });
14405
+ const LinkToolbarButton = withRef((rest, ref) => {
14406
+ const state = useLinkToolbarButtonState();
14407
+ const { props } = useLinkToolbarButton(state);
14408
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React__default.createElement(Icons.link, null));
14409
+ });
14410
+ const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
14411
+ const state = useMarkToolbarButtonState({ clear, nodeType });
14412
+ const { props } = useMarkToolbarButton(state);
14413
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest });
14414
+ });
14415
+ const useMermaidToolbarButtonState = () => {
14416
+ const editor = useEditorState();
14417
+ const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_MERMAID);
14418
+ return {
14419
+ pressed: isBlockActive()
14420
+ };
14421
+ };
14422
+ const useMermaidToolbarButton = (state) => {
14423
+ const editor = useEditorState();
14424
+ const onClick = () => {
14425
+ insertEmptyElement(editor, ELEMENT_MERMAID, {
14426
+ nextBlock: true,
14427
+ select: true
14428
+ });
14429
+ };
14283
14430
  const onMouseDown = (e) => {
14284
- setRawMode(true);
14431
+ e.preventDefault();
14432
+ e.stopPropagation();
14285
14433
  };
14286
14434
  return {
14287
14435
  props: {
14436
+ onClick,
14288
14437
  onMouseDown,
14289
- pressed: false
14438
+ pressed: state.pressed
14290
14439
  }
14291
14440
  };
14292
14441
  };
14293
- const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
14294
- const { props } = useRawMarkdownToolbarButton();
14295
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.raw, null));
14442
+ const MermaidToolbarButton = withRef(({ clear, ...rest }, ref) => {
14443
+ const state = useMermaidToolbarButtonState();
14444
+ const { props } = useMermaidToolbarButton(state);
14445
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Mermaid", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.mermaid, null));
14296
14446
  });
14297
- const ToolbarContext = createContext(void 0);
14298
- const ToolbarProvider = ({
14299
- tinaForm,
14300
- templates,
14301
- overrides,
14302
- children
14303
- }) => {
14304
- return /* @__PURE__ */ React__default.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
14305
- };
14306
- const useToolbarContext = () => {
14307
- const context = useContext(ToolbarContext);
14308
- if (!context) {
14309
- throw new Error("useToolbarContext must be used within a ToolbarProvider");
14310
- }
14311
- return context;
14312
- };
14313
- function TemplatesToolbarButton() {
14314
- const { templates } = useToolbarContext();
14315
- const editor = useEditorState();
14316
- return /* @__PURE__ */ React__default.createElement(EmbedButton, { templates, editor });
14317
- }
14318
- const EmbedButton = ({ editor, templates }) => {
14319
- const [open2, setOpen] = useState(false);
14320
- const [filteredTemplates, setFilteredTemplates] = useState(templates);
14321
- const filterChange = (e) => {
14322
- const filterText = e.target.value.toLowerCase();
14323
- setFilteredTemplates(
14324
- templates.filter(
14325
- (template) => template.name.toLowerCase().includes(filterText)
14326
- )
14327
- );
14328
- };
14329
- return /* @__PURE__ */ React__default.createElement(DropdownMenu, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { className: "inline-flex items-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-5 h-9 px-2 bg-transparent hover:bg-muted hover:text-muted-foreground aria-checked:bg-accent aria-checked:text-accent-foreground my-1 justify-between pr-1" }, /* @__PURE__ */ React__default.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React__default.createElement(
14330
- PlusIcon,
14331
- {
14332
- className: `origin-center transition-all ease-out duration-150 ${open2 ? "rotate-45" : ""}`
14333
- }
14334
- )), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { className: "max-h-48 overflow-y-auto" }, templates.length > 10 && /* @__PURE__ */ React__default.createElement(
14335
- "input",
14336
- {
14337
- type: "text",
14338
- placeholder: "Filter templates...",
14339
- className: "w-full p-2 border border-gray-300 rounded-md",
14340
- onChange: filterChange
14341
- }
14342
- ), /* @__PURE__ */ React__default.createElement(DropdownMenuSeparator, null), filteredTemplates.map((template) => /* @__PURE__ */ React__default.createElement(
14343
- DropdownMenuItem,
14344
- {
14345
- key: template.name,
14346
- onMouseDown: (e) => {
14347
- e.preventDefault();
14348
- close();
14349
- insertMDX(editor, template);
14350
- },
14351
- className: ""
14352
- },
14353
- template.label || template.name
14354
- ))));
14355
- };
14356
- const STANDARD_ICON_WIDTH = 32;
14357
- const HEADING_ICON_WITH_TEXT = 127;
14358
- const HEADING_ICON_ONLY = 58;
14359
- const EMBED_ICON_WIDTH = 78;
14360
- const CONTAINER_MD_BREAKPOINT = 448;
14361
- const FLOAT_BUTTON_WIDTH = 25;
14362
- const HEADING_LABEL = "Headings";
14363
- const useResize = (ref, callback) => {
14364
- React__default.useEffect(() => {
14365
- const resizeObserver = new ResizeObserver((entries) => {
14366
- for (const entry of entries) {
14367
- callback(entry);
14368
- }
14369
- });
14370
- if (ref.current) {
14371
- resizeObserver.observe(ref.current);
14372
- }
14373
- return () => resizeObserver.disconnect();
14374
- }, [ref.current]);
14375
- };
14376
14447
  function OverflowMenu({
14377
14448
  children,
14378
14449
  ...props
@@ -14390,6 +14461,53 @@ function OverflowMenu({
14390
14461
  /* @__PURE__ */ React__default.createElement(Icons.overflow, { className: "size-5" })
14391
14462
  )), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
14392
14463
  }
14464
+ const useBlockQuoteToolbarButtonState = () => {
14465
+ const editor = useEditorState();
14466
+ const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_BLOCKQUOTE$1);
14467
+ return {
14468
+ pressed: isBlockActive()
14469
+ };
14470
+ };
14471
+ const useBlockQuoteToolbarButton = (state) => {
14472
+ const editor = useEditorState();
14473
+ const onClick = () => {
14474
+ toggleNodeType(editor, {
14475
+ activeType: ELEMENT_BLOCKQUOTE$1
14476
+ });
14477
+ };
14478
+ const onMouseDown = (e) => {
14479
+ e.preventDefault();
14480
+ e.stopPropagation();
14481
+ };
14482
+ return {
14483
+ props: {
14484
+ onClick,
14485
+ onMouseDown,
14486
+ pressed: state.pressed
14487
+ }
14488
+ };
14489
+ };
14490
+ const QuoteToolbarButton = withRef(({ clear, ...rest }, ref) => {
14491
+ const state = useBlockQuoteToolbarButtonState();
14492
+ const { props } = useBlockQuoteToolbarButton(state);
14493
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.quote, null));
14494
+ });
14495
+ const useRawMarkdownToolbarButton = () => {
14496
+ const { setRawMode } = useEditorContext();
14497
+ const onMouseDown = (e) => {
14498
+ setRawMode(true);
14499
+ };
14500
+ return {
14501
+ props: {
14502
+ onMouseDown,
14503
+ pressed: false
14504
+ }
14505
+ };
14506
+ };
14507
+ const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
14508
+ const { props } = useRawMarkdownToolbarButton();
14509
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.raw, null));
14510
+ });
14393
14511
  function TableDropdownMenu(props) {
14394
14512
  const tableSelected = useEditorSelector(
14395
14513
  (editor2) => someNode(editor2, { match: { type: ELEMENT_TABLE$1 } }),
@@ -14492,6 +14610,49 @@ function TableDropdownMenu(props) {
14492
14610
  )))
14493
14611
  ));
14494
14612
  }
14613
+ function TemplatesToolbarButton() {
14614
+ const { templates } = useToolbarContext();
14615
+ const editor = useEditorState();
14616
+ return /* @__PURE__ */ React__default.createElement(EmbedButton, { templates, editor });
14617
+ }
14618
+ const EmbedButton = ({ editor, templates }) => {
14619
+ const [open2, setOpen] = useState(false);
14620
+ const [filteredTemplates, setFilteredTemplates] = useState(templates);
14621
+ const filterChange = (e) => {
14622
+ const filterText = e.target.value.toLowerCase();
14623
+ setFilteredTemplates(
14624
+ templates.filter(
14625
+ (template) => template.name.toLowerCase().includes(filterText)
14626
+ )
14627
+ );
14628
+ };
14629
+ return /* @__PURE__ */ React__default.createElement(DropdownMenu, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { className: "inline-flex items-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-5 h-9 px-2 bg-transparent hover:bg-muted hover:text-muted-foreground aria-checked:bg-accent aria-checked:text-accent-foreground my-1 justify-between pr-1" }, /* @__PURE__ */ React__default.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React__default.createElement(
14630
+ PlusIcon,
14631
+ {
14632
+ className: `origin-center transition-all ease-out duration-150 ${open2 ? "rotate-45" : ""}`
14633
+ }
14634
+ )), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { className: "max-h-48 overflow-y-auto" }, templates.length > 10 && /* @__PURE__ */ React__default.createElement(
14635
+ "input",
14636
+ {
14637
+ type: "text",
14638
+ placeholder: "Filter templates...",
14639
+ className: "w-full p-2 border border-gray-300 rounded-md",
14640
+ onChange: filterChange
14641
+ }
14642
+ ), /* @__PURE__ */ React__default.createElement(DropdownMenuSeparator, null), filteredTemplates.map((template) => /* @__PURE__ */ React__default.createElement(
14643
+ DropdownMenuItem,
14644
+ {
14645
+ key: template.name,
14646
+ onMouseDown: (e) => {
14647
+ e.preventDefault();
14648
+ close();
14649
+ insertMDX(editor, template);
14650
+ },
14651
+ className: ""
14652
+ },
14653
+ template.label || template.name
14654
+ ))));
14655
+ };
14495
14656
  const toolbarItems = {
14496
14657
  heading: {
14497
14658
  label: HEADING_LABEL,
@@ -14544,6 +14705,11 @@ const toolbarItems = {
14544
14705
  width: () => STANDARD_ICON_WIDTH,
14545
14706
  Component: /* @__PURE__ */ React__default.createElement(CodeBlockToolbarButton, null)
14546
14707
  },
14708
+ mermaid: {
14709
+ label: "Mermaid",
14710
+ width: () => STANDARD_ICON_WIDTH,
14711
+ Component: /* @__PURE__ */ React__default.createElement(MermaidToolbarButton, null)
14712
+ },
14547
14713
  table: {
14548
14714
  label: "Table",
14549
14715
  width: () => STANDARD_ICON_WIDTH,
@@ -14931,6 +15097,7 @@ const RichEditor = (props) => {
14931
15097
  createMdxBlockPlugin(),
14932
15098
  createMdxInlinePlugin(),
14933
15099
  createImgPlugin(),
15100
+ createMermaidPlugin(),
14934
15101
  createInvalidMarkdownPlugin(),
14935
15102
  createLinkPlugin({
14936
15103
  options: {