tinacms 0.0.0-c5dad82-20241009225242 → 0.0.0-cff6c6a-20241023044614

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/plate"), require("slate-react"), require("@udecode/plate-slash-command"), require("@udecode/cn"), require("@udecode/plate-common"), require("@udecode/plate-heading"), require("class-variance-authority"), require("lucide-react"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("@radix-ui/react-popover"), require("@udecode/plate-table"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("@udecode/plate-resizable"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("@react-hook/window-size"), require("graphql"), require("graphql-tag"), require("@tinacms/schema-tools"), require("yup"), require("@graphql-inspector/core"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/plate", "slate-react", "@udecode/plate-slash-command", "@udecode/cn", "@udecode/plate-common", "@udecode/plate-heading", "class-variance-authority", "lucide-react", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "@radix-ui/react-popover", "@udecode/plate-table", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "@udecode/plate-resizable", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "@react-hook/window-size", "graphql", "graphql-tag", "@tinacms/schema-tools", "yup", "@graphql-inspector/core", "react-router-dom", "@tinacms/mdx"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
3
- })(this, function(exports2, zod, React, reactDom, plate, slateReact, plateSlashCommand, cn$1, plateCommon, plateHeading, classVarianceAuthority, lucideReact, react, plateCombobox, plateCodeBlock, MonacoEditor, react$1, PopoverPrimitive, plateTable, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, plateResizable, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, windowSize, graphql, gql, schemaTools, yup, core, reactRouterDom, mdx) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("slate-react"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("@react-hook/window-size"), require("graphql"), require("graphql-tag"), require("@tinacms/schema-tools"), require("yup"), require("@graphql-inspector/core"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate", "@udecode/plate-common", "@udecode/plate-slash-command", "slate-react", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "class-variance-authority", "lucide-react", "mermaid", "@udecode/plate-heading", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-table", "@udecode/plate-resizable", "@radix-ui/react-popover", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "@react-hook/window-size", "graphql", "graphql-tag", "@tinacms/schema-tools", "yup", "@graphql-inspector/core", "react-router-dom", "@tinacms/mdx"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
3
+ })(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, slateReact, plateCodeBlock, MonacoEditor, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, windowSize, graphql, gql, schemaTools, yup, core, reactRouterDom, mdx) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => {
@@ -882,6 +882,20 @@ var __publicField = (obj, key, value) => {
882
882
  const useTemplates = () => {
883
883
  return React.useContext(EditorContext);
884
884
  };
885
+ const BlockquoteElement = cn$1.withRef(
886
+ ({ children, className, ...props }, ref) => {
887
+ return /* @__PURE__ */ React.createElement(
888
+ plateCommon.PlateElement,
889
+ {
890
+ asChild: true,
891
+ className: cn$1.cn("my-1 border-l-2 pl-6 italic", className),
892
+ ref,
893
+ ...props
894
+ },
895
+ /* @__PURE__ */ React.createElement("blockquote", null, children)
896
+ );
897
+ }
898
+ );
885
899
  function classNames$1(...classes) {
886
900
  return classes.filter(Boolean).join(" ");
887
901
  }
@@ -891,1270 +905,1492 @@ var __publicField = (obj, key, value) => {
891
905
  (c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
892
906
  );
893
907
  };
894
- const RawMarkdown = () => {
908
+ function ChevronDownIcon(props, svgRef) {
909
+ return /* @__PURE__ */ React__namespace.createElement("svg", Object.assign({
910
+ xmlns: "http://www.w3.org/2000/svg",
911
+ viewBox: "0 0 20 20",
912
+ fill: "currentColor",
913
+ "aria-hidden": "true",
914
+ ref: svgRef
915
+ }, props), /* @__PURE__ */ React__namespace.createElement("path", {
916
+ fillRule: "evenodd",
917
+ 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",
918
+ clipRule: "evenodd"
919
+ }));
920
+ }
921
+ const ForwardRef = React__namespace.forwardRef(ChevronDownIcon);
922
+ const ChevronDownIcon$1 = ForwardRef;
923
+ const Autocomplete = ({
924
+ value,
925
+ onChange,
926
+ defaultQuery,
927
+ items: items2
928
+ }) => {
929
+ const [query, setQuery] = React.useState(defaultQuery ?? "");
930
+ const filteredItems = React.useMemo(() => {
931
+ try {
932
+ const reFilter = new RegExp(query, "i");
933
+ const _items = items2.filter((item) => reFilter.test(item.label));
934
+ if (_items.length === 0)
935
+ return items2;
936
+ return _items;
937
+ } catch (err) {
938
+ return items2;
939
+ }
940
+ }, [items2, query]);
895
941
  return /* @__PURE__ */ React.createElement(
896
- "svg",
942
+ react.Combobox,
897
943
  {
898
- stroke: "currentColor",
899
- fill: "currentColor",
900
- strokeWidth: 0,
901
- role: "img",
902
- className: "h-5 w-5",
903
- viewBox: "0 0 24 24",
904
- height: "1em",
905
- width: "1em",
906
- xmlns: "http://www.w3.org/2000/svg"
944
+ value,
945
+ onChange,
946
+ as: "div",
947
+ className: "relative inline-block text-left z-20"
907
948
  },
908
- /* @__PURE__ */ React.createElement("title", null),
909
- /* @__PURE__ */ React.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" })
949
+ /* @__PURE__ */ React.createElement("div", { className: "mt-1" }, /* @__PURE__ */ React.createElement("div", { className: "relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left shadow-md sm:text-sm" }, /* @__PURE__ */ React.createElement(
950
+ react.ComboboxInput,
951
+ {
952
+ 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",
953
+ displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
954
+ onChange: (event) => setQuery(event.target.value),
955
+ onClick: (ev) => ev.stopPropagation()
956
+ }
957
+ ), /* @__PURE__ */ React.createElement(react.ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React.createElement(
958
+ ChevronDownIcon$1,
959
+ {
960
+ className: "h-5 w-5 text-gray-400",
961
+ "aria-hidden": "true"
962
+ }
963
+ )))),
964
+ /* @__PURE__ */ React.createElement(
965
+ react.Transition,
966
+ {
967
+ enter: "transition ease-out duration-100",
968
+ enterFrom: "transform opacity-0 scale-95",
969
+ enterTo: "transform opacity-100 scale-100",
970
+ leave: "transition ease-in duration-75",
971
+ leaveFrom: "transform opacity-100 scale-100",
972
+ leaveTo: "transform opacity-0 scale-95"
973
+ },
974
+ /* @__PURE__ */ React.createElement(react.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.createElement(react.ComboboxOption, { key: item.key, value: item }, ({ focus }) => /* @__PURE__ */ React.createElement(
975
+ "button",
976
+ {
977
+ className: classNames$1(
978
+ focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
979
+ "block px-4 py-2 text-xs w-full text-right"
980
+ )
981
+ },
982
+ item.render(item)
983
+ ))))
984
+ )
910
985
  );
911
986
  };
912
- const borderAll = (props) => /* @__PURE__ */ React.createElement(
913
- "svg",
914
- {
915
- viewBox: "0 0 24 24",
916
- height: "48",
917
- width: "48",
918
- focusable: "false",
919
- role: "img",
920
- fill: "currentColor",
921
- xmlns: "http://www.w3.org/2000/svg",
922
- ...props
923
- },
924
- /* @__PURE__ */ React.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" })
925
- );
926
- const borderBottom = (props) => /* @__PURE__ */ React.createElement(
927
- "svg",
928
- {
929
- viewBox: "0 0 24 24",
930
- height: "48",
931
- width: "48",
932
- focusable: "false",
933
- role: "img",
934
- fill: "currentColor",
935
- xmlns: "http://www.w3.org/2000/svg",
936
- ...props
937
- },
938
- /* @__PURE__ */ React.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" })
939
- );
940
- const borderLeft = (props) => /* @__PURE__ */ React.createElement(
941
- "svg",
942
- {
943
- viewBox: "0 0 24 24",
944
- height: "48",
945
- width: "48",
946
- focusable: "false",
947
- role: "img",
948
- fill: "currentColor",
949
- xmlns: "http://www.w3.org/2000/svg",
950
- ...props
951
- },
952
- /* @__PURE__ */ React.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" })
953
- );
954
- const borderNone = (props) => /* @__PURE__ */ React.createElement(
955
- "svg",
956
- {
957
- viewBox: "0 0 24 24",
958
- height: "48",
959
- width: "48",
960
- focusable: "false",
961
- role: "img",
962
- fill: "currentColor",
963
- xmlns: "http://www.w3.org/2000/svg",
964
- ...props
965
- },
966
- /* @__PURE__ */ React.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" })
967
- );
968
- const borderRight = (props) => /* @__PURE__ */ React.createElement(
969
- "svg",
970
- {
971
- viewBox: "0 0 24 24",
972
- height: "48",
973
- width: "48",
974
- focusable: "false",
975
- role: "img",
976
- fill: "currentColor",
977
- xmlns: "http://www.w3.org/2000/svg",
978
- ...props
979
- },
980
- /* @__PURE__ */ React.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" })
981
- );
982
- const borderTop = (props) => /* @__PURE__ */ React.createElement(
983
- "svg",
984
- {
985
- viewBox: "0 0 24 24",
986
- height: "48",
987
- width: "48",
988
- focusable: "false",
989
- role: "img",
990
- fill: "currentColor",
991
- xmlns: "http://www.w3.org/2000/svg",
992
- ...props
993
- },
994
- /* @__PURE__ */ React.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" })
995
- );
996
- const iconVariants = classVarianceAuthority.cva("", {
997
- variants: {
998
- variant: {
999
- toolbar: "size-5",
1000
- menuItem: "mr-2 size-5"
1001
- },
1002
- size: {
1003
- sm: "mr-2 size-4",
1004
- md: "mr-2 size-6"
1005
- }
1006
- },
1007
- defaultVariants: {}
987
+ MonacoEditor.loader.config({
988
+ paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
1008
989
  });
1009
- const DoubleColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
1010
- "svg",
1011
- {
1012
- fill: "none",
1013
- height: "16",
1014
- viewBox: "0 0 16 16",
1015
- width: "16",
1016
- xmlns: "http://www.w3.org/2000/svg",
1017
- ...props
1018
- },
1019
- /* @__PURE__ */ React.createElement(
1020
- "path",
1021
- {
1022
- clipRule: "evenodd",
1023
- 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",
1024
- fill: "#595E6F",
1025
- fillRule: "evenodd"
1026
- }
1027
- )
1028
- );
1029
- const ThreeColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
1030
- "svg",
1031
- {
1032
- fill: "none",
1033
- height: "16",
1034
- viewBox: "0 0 16 16",
1035
- width: "16",
1036
- xmlns: "http://www.w3.org/2000/svg",
1037
- ...props
1038
- },
1039
- /* @__PURE__ */ React.createElement(
1040
- "path",
1041
- {
1042
- clipRule: "evenodd",
1043
- 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",
1044
- fill: "#4C5161",
1045
- fillRule: "evenodd"
990
+ let retryCount = 0;
991
+ const retryFocus = (ref) => {
992
+ if (ref.current) {
993
+ ref.current.focus();
994
+ } else {
995
+ if (retryCount < 30) {
996
+ setTimeout(() => {
997
+ retryCount = retryCount + 1;
998
+ retryFocus(ref);
999
+ }, 100);
1046
1000
  }
1047
- )
1048
- );
1049
- const RightSideDoubleColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
1050
- "svg",
1051
- {
1052
- fill: "none",
1053
- height: "16",
1054
- viewBox: "0 0 16 16",
1055
- width: "16",
1056
- xmlns: "http://www.w3.org/2000/svg",
1057
- ...props
1058
- },
1059
- /* @__PURE__ */ React.createElement(
1060
- "path",
1061
- {
1062
- clipRule: "evenodd",
1063
- d: "M11.25 3H13V13H11.25V3ZM10.25 2H11.25H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H11.25H10.25H3C2.44772 14 2 13.5523 2 13V3C2 2.44772 2.44772 2 3 2H10.25ZM10.25 13H3L3 3H10.25V13Z",
1064
- fill: "#595E6F",
1065
- fillRule: "evenodd"
1066
- }
1067
- )
1068
- );
1069
- const LeftSideDoubleColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
1070
- "svg",
1071
- {
1072
- fill: "none",
1073
- height: "16",
1074
- viewBox: "0 0 16 16",
1075
- width: "16",
1076
- xmlns: "http://www.w3.org/2000/svg",
1077
- ...props
1078
- },
1079
- /* @__PURE__ */ React.createElement(
1080
- "path",
1081
- {
1082
- clipRule: "evenodd",
1083
- d: "M5.75 3H13V13H5.75V3ZM4.75 2H5.75H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H5.75H4.75H3C2.44772 14 2 13.5523 2 13V3C2 2.44772 2.44772 2 3 2H4.75ZM4.75 13H3L3 3H4.75V13Z",
1084
- fill: "#595E6F",
1085
- fillRule: "evenodd"
1086
- }
1087
- )
1088
- );
1089
- const DoubleSideDoubleColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
1090
- "svg",
1091
- {
1092
- fill: "none",
1093
- height: "16",
1094
- viewBox: "0 0 16 16",
1095
- width: "16",
1096
- xmlns: "http://www.w3.org/2000/svg",
1097
- ...props
1098
- },
1099
- /* @__PURE__ */ React.createElement(
1100
- "path",
1101
- {
1102
- clipRule: "evenodd",
1103
- d: "M10.25 3H5.75V13H10.25V3ZM10.25 2H5.75H4.75H3C2.44772 2 2 2.44772 2 3V13C2 13.5523 2.44772 14 3 14H4.75H5.75H10.25H11.25H13C13.5523 14 14 13.5523 14 13V3C14 2.44772 13.5523 2 13 2H11.25H10.25ZM11.25 3V13H13V3H11.25ZM3 13H4.75V3H3L3 13Z",
1104
- fill: "#595E6F",
1105
- fillRule: "evenodd"
1106
- }
1107
- )
1108
- );
1109
- const Overflow = (props) => /* @__PURE__ */ React.createElement(
1110
- "svg",
1111
- {
1112
- xmlns: "http://www.w3.org/2000/svg",
1113
- className: "h-5 w-5",
1114
- fill: "none",
1115
- viewBox: "0 0 24 24",
1116
- stroke: "currentColor",
1117
- ...props
1118
- },
1119
- /* @__PURE__ */ React.createElement(
1120
- "path",
1121
- {
1122
- strokeLinecap: "round",
1123
- strokeLinejoin: "round",
1124
- strokeWidth: 2,
1125
- d: "M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"
1126
- }
1127
- )
1128
- );
1129
- const Icons = {
1130
- add: lucideReact.Plus,
1131
- alignCenter: lucideReact.AlignCenter,
1132
- alignJustify: lucideReact.AlignJustify,
1133
- alignLeft: lucideReact.AlignLeft,
1134
- alignRight: lucideReact.AlignRight,
1135
- arrowDown: lucideReact.ChevronDown,
1136
- bg: lucideReact.PaintBucket,
1137
- blockquote: lucideReact.Quote,
1138
- // bold: Bold,
1139
- overflow: Overflow,
1140
- borderAll,
1141
- borderBottom,
1142
- borderLeft,
1143
- borderNone,
1144
- borderRight,
1145
- borderTop,
1146
- check: lucideReact.Check,
1147
- chevronRight: lucideReact.ChevronRight,
1148
- chevronsUpDown: lucideReact.ChevronsUpDown,
1149
- clear: lucideReact.X,
1150
- close: lucideReact.X,
1151
- // code: Code2,
1152
- codeblock: lucideReact.FileCode,
1153
- color: lucideReact.Baseline,
1154
- column: lucideReact.RectangleVertical,
1155
- combine: lucideReact.Combine,
1156
- ungroup: lucideReact.Ungroup,
1157
- comment: lucideReact.MessageSquare,
1158
- commentAdd: lucideReact.MessageSquarePlus,
1159
- delete: lucideReact.Trash,
1160
- dragHandle: lucideReact.GripVertical,
1161
- editing: lucideReact.Edit2,
1162
- emoji: lucideReact.Smile,
1163
- externalLink: lucideReact.ExternalLink,
1164
- h1: lucideReact.Heading1,
1165
- h2: lucideReact.Heading2,
1166
- h3: lucideReact.Heading3,
1167
- h4: lucideReact.Heading4,
1168
- h5: lucideReact.Heading5,
1169
- h6: lucideReact.Heading6,
1170
- // image: Image,
1171
- indent: lucideReact.Indent,
1172
- // italic: Italic,
1173
- kbd: lucideReact.Keyboard,
1174
- lineHeight: lucideReact.WrapText,
1175
- // link: Link2,
1176
- minus: lucideReact.Minus,
1177
- more: lucideReact.MoreHorizontal,
1178
- // ol: ListOrdered,
1179
- outdent: lucideReact.Outdent,
1180
- paragraph: lucideReact.Pilcrow,
1181
- refresh: lucideReact.RotateCcw,
1182
- row: lucideReact.RectangleHorizontal,
1183
- search: lucideReact.Search,
1184
- settings: lucideReact.Settings,
1185
- strikethrough: lucideReact.Strikethrough,
1186
- subscript: lucideReact.Subscript,
1187
- superscript: lucideReact.Superscript,
1188
- table: lucideReact.Table,
1189
- text: lucideReact.Text,
1190
- trash: lucideReact.Trash,
1191
- // ul: List,
1192
- underline: lucideReact.Underline,
1193
- unlink: lucideReact.Link2Off,
1194
- viewing: lucideReact.Eye,
1195
- doubleColumn: DoubleColumnOutlined,
1196
- doubleSideDoubleColumn: DoubleSideDoubleColumnOutlined,
1197
- threeColumn: ThreeColumnOutlined,
1198
- leftSideDoubleColumn: LeftSideDoubleColumnOutlined,
1199
- rightSideDoubleColumn: RightSideDoubleColumnOutlined,
1200
- heading: HeadingIcon,
1201
- link: LinkIcon,
1202
- quote: QuoteIcon,
1203
- image: ImageIcon,
1204
- ul: UnorderedListIcon,
1205
- ol: OrderedListIcon,
1206
- code: CodeIcon,
1207
- codeBlock: CodeBlockIcon,
1208
- bold: BoldIcon,
1209
- italic: ItalicIcon,
1210
- raw: RawMarkdown,
1211
- // www
1212
- gitHub: (props) => /* @__PURE__ */ React.createElement("svg", { viewBox: "0 0 438.549 438.549", ...props }, /* @__PURE__ */ React.createElement(
1213
- "path",
1214
- {
1215
- fill: "currentColor",
1216
- 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"
1001
+ }
1002
+ };
1003
+ const MINIMUM_HEIGHT = 75;
1004
+ const CodeBlock = ({
1005
+ attributes,
1006
+ editor,
1007
+ element,
1008
+ language: restrictLanguage,
1009
+ onChangeCallback,
1010
+ defaultValue,
1011
+ ...props
1012
+ }) => {
1013
+ const [navigateAway, setNavigateAway] = React.useState(null);
1014
+ const monaco = MonacoEditor.useMonaco();
1015
+ const monacoEditorRef = React.useRef(null);
1016
+ const selected = slateReact.useSelected();
1017
+ const [height, setHeight] = React.useState(MINIMUM_HEIGHT);
1018
+ React.useEffect(() => {
1019
+ if (selected && plateCommon.isCollapsed(editor.selection)) {
1020
+ retryFocus(monacoEditorRef);
1217
1021
  }
1218
- )),
1219
- logo: (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React.createElement(
1220
- "path",
1221
- {
1222
- fill: "currentColor",
1223
- 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"
1022
+ }, [selected, monacoEditorRef.current]);
1023
+ const value = element.value || "";
1024
+ if (typeof value !== "string") {
1025
+ throw new Error("Element must be of type string for code block");
1026
+ }
1027
+ const language = restrictLanguage || element.lang;
1028
+ const id = React.useMemo(() => uuid(), []);
1029
+ const languages = React.useMemo(() => {
1030
+ const defaultLangSet = { "": "plain text" };
1031
+ if (!monaco)
1032
+ return defaultLangSet;
1033
+ return monaco.languages.getLanguages().reduce((ac, cv) => {
1034
+ if (cv.id === "plaintext")
1035
+ return ac;
1036
+ return { ...ac, [cv.id]: cv.id };
1037
+ }, defaultLangSet);
1038
+ }, [monaco]);
1039
+ React.useEffect(() => {
1040
+ if (monaco) {
1041
+ monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
1042
+ monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
1043
+ // disable errors
1044
+ noSemanticValidation: true,
1045
+ noSyntaxValidation: true
1046
+ });
1224
1047
  }
1225
- )),
1226
- moon: lucideReact.Moon,
1227
- sun: lucideReact.SunMedium,
1228
- twitter: lucideReact.Twitter
1229
- };
1230
- function UnorderedListIcon(props) {
1231
- const title = props.title || "format list bulleted";
1232
- return /* @__PURE__ */ React.createElement(
1233
- "svg",
1234
- {
1235
- className: "h-5 w-5",
1236
- height: "24",
1237
- width: "24",
1238
- viewBox: "0 0 24 24",
1239
- xmlns: "http://www.w3.org/2000/svg"
1240
- },
1241
- /* @__PURE__ */ React.createElement("title", null, title),
1242
- /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement("path", { d: "M7 5h14v2H7V5z", fill: "currentColor" }), /* @__PURE__ */ React.createElement(
1243
- "path",
1244
- {
1245
- d: "M4 7.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z",
1246
- fill: "currentColor"
1247
- }
1248
- ), /* @__PURE__ */ React.createElement(
1249
- "path",
1250
- {
1251
- 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",
1252
- fill: "currentColor"
1048
+ }, [monaco]);
1049
+ const items2 = Object.entries(languages).map(([key, label]) => ({
1050
+ key,
1051
+ label,
1052
+ render: (item) => item.label
1053
+ }));
1054
+ const currentItem = React.useMemo(() => {
1055
+ return items2.find((item) => item.key === language) ?? {
1056
+ key: "",
1057
+ label: "Plain Text"
1058
+ };
1059
+ }, [items2, language]);
1060
+ React.useEffect(() => {
1061
+ if (navigateAway) {
1062
+ setNavigateAway(null);
1063
+ switch (navigateAway) {
1064
+ case "remove":
1065
+ {
1066
+ plateCommon.focusEditor(editor);
1067
+ plateCommon.setNodes(
1068
+ editor,
1069
+ {
1070
+ type: "p",
1071
+ children: [{ text: "" }],
1072
+ lang: void 0,
1073
+ value: void 0
1074
+ },
1075
+ {
1076
+ match: (n) => {
1077
+ if (plateCommon.isElement(n) && n.type === element.type) {
1078
+ return true;
1079
+ }
1080
+ }
1081
+ }
1082
+ );
1083
+ }
1084
+ break;
1085
+ case "insertNext":
1086
+ {
1087
+ plateCommon.insertNodes(
1088
+ editor,
1089
+ [
1090
+ {
1091
+ type: plateCommon.ELEMENT_DEFAULT,
1092
+ children: [{ text: "" }],
1093
+ lang: void 0,
1094
+ value: void 0
1095
+ }
1096
+ ],
1097
+ { select: true }
1098
+ );
1099
+ plateCommon.focusEditor(editor);
1100
+ }
1101
+ break;
1102
+ case "up":
1103
+ {
1104
+ const path = plateCommon.findNodePath(editor, element);
1105
+ if (!path) {
1106
+ return;
1107
+ }
1108
+ const previousNodePath = plateCommon.getPointBefore(editor, path);
1109
+ if (!previousNodePath) {
1110
+ plateCommon.focusEditor(editor);
1111
+ plateCommon.insertNodes(
1112
+ editor,
1113
+ [
1114
+ {
1115
+ type: plateCommon.ELEMENT_DEFAULT,
1116
+ children: [{ text: "" }],
1117
+ lang: void 0,
1118
+ value: void 0
1119
+ }
1120
+ ],
1121
+ // Insert a new node at the current path, resulting in the code_block
1122
+ // moving down one block
1123
+ { at: path, select: true }
1124
+ );
1125
+ return;
1126
+ }
1127
+ plateCommon.focusEditor(editor, previousNodePath);
1128
+ }
1129
+ break;
1130
+ case "down": {
1131
+ const path = plateCommon.findNodePath(editor, element);
1132
+ if (!path) {
1133
+ return;
1134
+ }
1135
+ const nextNodePath = plateCommon.getPointAfter(editor, path);
1136
+ if (!nextNodePath) {
1137
+ plateCommon.insertNodes(
1138
+ editor,
1139
+ [
1140
+ {
1141
+ type: plateCommon.ELEMENT_DEFAULT,
1142
+ children: [{ text: "" }],
1143
+ lang: void 0,
1144
+ value: void 0
1145
+ }
1146
+ ],
1147
+ { select: true }
1148
+ );
1149
+ plateCommon.focusEditor(editor);
1150
+ } else {
1151
+ plateCommon.focusEditor(editor, nextNodePath);
1152
+ }
1153
+ break;
1154
+ }
1253
1155
  }
1254
- ), /* @__PURE__ */ React.createElement(
1255
- "path",
1256
- {
1257
- d: "M4 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z",
1258
- fill: "currentColor"
1156
+ }
1157
+ }, [navigateAway]);
1158
+ function handleEditorDidMount(monacoEditor, monaco2) {
1159
+ monacoEditorRef.current = monacoEditor;
1160
+ monacoEditor.onDidContentSizeChange(() => {
1161
+ setHeight(
1162
+ monacoEditor.getContentHeight() > MINIMUM_HEIGHT ? monacoEditor.getContentHeight() : MINIMUM_HEIGHT
1163
+ );
1164
+ monacoEditor.layout();
1165
+ });
1166
+ plateCommon.setNodes(editor, { value: defaultValue, lang: language });
1167
+ monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
1168
+ if (monacoEditor.hasTextFocus()) {
1169
+ setNavigateAway("insertNext");
1259
1170
  }
1260
- ))
1261
- );
1262
- }
1263
- function HeadingIcon(props) {
1264
- const title = props.title || "format size";
1265
- return /* @__PURE__ */ React.createElement(
1266
- "svg",
1267
- {
1268
- height: "24",
1269
- width: "24",
1270
- className: "h-5 w-5",
1271
- viewBox: "0 0 24 24",
1272
- xmlns: "http://www.w3.org/2000/svg"
1273
- },
1274
- /* @__PURE__ */ React.createElement("title", null, title),
1275
- /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1276
- "path",
1277
- {
1278
- d: "M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3V9H3v3z",
1279
- fill: "currentColor"
1171
+ });
1172
+ monacoEditor.onKeyDown((l) => {
1173
+ if (l.code === "ArrowUp") {
1174
+ const selection = monacoEditor.getSelection();
1175
+ if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
1176
+ setNavigateAway("up");
1177
+ }
1280
1178
  }
1281
- ))
1282
- );
1283
- }
1284
- function OrderedListIcon(props) {
1285
- const title = props.title || "format list numbered";
1286
- return /* @__PURE__ */ React.createElement(
1287
- "svg",
1288
- {
1289
- className: "h-5 w-5",
1290
- height: "24",
1291
- width: "24",
1292
- viewBox: "0 0 24 24",
1293
- xmlns: "http://www.w3.org/2000/svg"
1294
- },
1295
- /* @__PURE__ */ React.createElement("title", null, title),
1296
- /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1297
- "path",
1298
- {
1299
- d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z",
1300
- fill: "currentColor"
1179
+ if (l.code === "ArrowDown") {
1180
+ const selection = monacoEditor.getSelection();
1181
+ const totalLines = monacoEditor.getModel().getLineCount();
1182
+ if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
1183
+ setNavigateAway("down");
1184
+ }
1301
1185
  }
1302
- ))
1303
- );
1304
- }
1305
- function QuoteIcon(props) {
1306
- const title = props.title || "format quote";
1186
+ if (l.code === "Backspace") {
1187
+ const selection = monacoEditor.getSelection();
1188
+ 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) {
1189
+ setNavigateAway("remove");
1190
+ }
1191
+ }
1192
+ });
1193
+ }
1307
1194
  return /* @__PURE__ */ React.createElement(
1308
- "svg",
1195
+ "div",
1309
1196
  {
1310
- height: "24",
1311
- className: "h-5 w-5",
1312
- width: "24",
1313
- viewBox: "0 0 24 24",
1314
- xmlns: "http://www.w3.org/2000/svg"
1197
+ ...attributes,
1198
+ className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
1315
1199
  },
1316
- /* @__PURE__ */ React.createElement("title", null, title),
1317
- /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1318
- "path",
1200
+ /* @__PURE__ */ React.createElement("style", null, `.monaco-editor .editor-widget {
1201
+ display: none !important;
1202
+ visibility: hidden !important;
1203
+ }`),
1204
+ props.children,
1205
+ /* @__PURE__ */ React.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement(
1206
+ Autocomplete,
1319
1207
  {
1320
- d: "M6 17h3l2-4V7H5v6h3l-2 4zm8 0h3l2-4V7h-6v6h3l-2 4z",
1321
- fill: "currentColor"
1208
+ items: items2,
1209
+ value: currentItem,
1210
+ defaultQuery: "plaintext",
1211
+ onChange: (item) => plateCommon.setNodes(editor, { lang: item.key })
1322
1212
  }
1323
- ))
1324
- );
1325
- }
1326
- function LinkIcon(props) {
1327
- const title = props.title || "insert link";
1328
- return /* @__PURE__ */ React.createElement(
1329
- "svg",
1330
- {
1331
- height: "24",
1332
- className: "h-5 w-5",
1333
- width: "24",
1334
- viewBox: "0 0 24 24",
1335
- xmlns: "http://www.w3.org/2000/svg"
1336
- },
1337
- /* @__PURE__ */ React.createElement("title", null, title),
1338
- /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1339
- "path",
1213
+ )), /* @__PURE__ */ React.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React.createElement(
1214
+ MonacoEditor,
1340
1215
  {
1341
- 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",
1342
- fill: "currentColor"
1216
+ path: id,
1217
+ onMount: handleEditorDidMount,
1218
+ options: {
1219
+ scrollBeyondLastLine: false,
1220
+ // automaticLayout: true,
1221
+ tabSize: 2,
1222
+ disableLayerHinting: true,
1223
+ accessibilitySupport: "off",
1224
+ codeLens: false,
1225
+ wordWrap: "on",
1226
+ minimap: {
1227
+ enabled: false
1228
+ },
1229
+ fontSize: 14,
1230
+ lineHeight: 2,
1231
+ formatOnPaste: true,
1232
+ lineNumbers: "off",
1233
+ formatOnType: true,
1234
+ fixedOverflowWidgets: true,
1235
+ // Takes too much horizontal space for iframe
1236
+ folding: false,
1237
+ renderLineHighlight: "none",
1238
+ scrollbar: {
1239
+ verticalScrollbarSize: 1,
1240
+ horizontalScrollbarSize: 1,
1241
+ // https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
1242
+ alwaysConsumeMouseWheel: false
1243
+ }
1244
+ },
1245
+ language: String(language),
1246
+ value: String(element.value),
1247
+ onChange: (value2) => {
1248
+ onChangeCallback == null ? void 0 : onChangeCallback(value2);
1249
+ plateCommon.setNodes(editor, { value: value2, lang: language });
1250
+ }
1343
1251
  }
1344
- ))
1252
+ )))
1345
1253
  );
1346
- }
1347
- function CodeIcon(props) {
1348
- const title = props.title || "code";
1349
- return /* @__PURE__ */ React.createElement(
1350
- "svg",
1351
- {
1352
- className: "h-5 w-5",
1353
- height: "24",
1354
- width: "24",
1355
- viewBox: "0 0 24 24",
1356
- xmlns: "http://www.w3.org/2000/svg"
1357
- },
1358
- /* @__PURE__ */ React.createElement("title", null, title),
1359
- /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1360
- "path",
1254
+ };
1255
+ const CodeBlockElement = cn$1.withRef(
1256
+ ({ className, ...props }, ref) => {
1257
+ const { element } = props;
1258
+ const state = plateCodeBlock.useCodeBlockElementState({ element });
1259
+ return /* @__PURE__ */ React.createElement(
1260
+ plateCommon.PlateElement,
1361
1261
  {
1362
- 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",
1363
- fill: "currentColor"
1262
+ className: cn$1.cn("relative py-1", state.className, className),
1263
+ ref,
1264
+ ...props
1265
+ },
1266
+ /* @__PURE__ */ React.createElement(CodeBlock, { ...props })
1267
+ );
1268
+ }
1269
+ );
1270
+ const CodeLeaf = cn$1.withRef(
1271
+ ({ children, className, ...props }, ref) => {
1272
+ return /* @__PURE__ */ React.createElement(
1273
+ plateCommon.PlateLeaf,
1274
+ {
1275
+ asChild: true,
1276
+ className: cn$1.cn(
1277
+ "whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
1278
+ className
1279
+ ),
1280
+ ref,
1281
+ ...props
1282
+ },
1283
+ /* @__PURE__ */ React.createElement("code", null, children)
1284
+ );
1285
+ }
1286
+ );
1287
+ const CodeLineElement = cn$1.withRef((props, ref) => /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { ref, ...props }));
1288
+ const CodeSyntaxLeaf = cn$1.withRef(
1289
+ ({ children, ...props }, ref) => {
1290
+ const { leaf } = props;
1291
+ const { tokenProps } = plateCodeBlock.useCodeSyntaxLeaf({ leaf });
1292
+ return /* @__PURE__ */ React.createElement(plateCommon.PlateLeaf, { ref, ...props }, /* @__PURE__ */ React.createElement("span", { ...tokenProps }, children));
1293
+ }
1294
+ );
1295
+ const listVariants = classVarianceAuthority.cva("m-0 ps-6", {
1296
+ variants: {
1297
+ variant: {
1298
+ ol: "list-decimal",
1299
+ ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
1300
+ }
1301
+ }
1302
+ });
1303
+ const ListElementVariants = cn$1.withVariants(plateCommon.PlateElement, listVariants, [
1304
+ "variant"
1305
+ ]);
1306
+ const ListElement = cn$1.withRef(
1307
+ ({ children, variant = "ul", ...props }, ref) => {
1308
+ const Component = variant;
1309
+ return /* @__PURE__ */ React.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React.createElement(Component, null, children));
1310
+ }
1311
+ );
1312
+ const ELEMENT_MERMAID = "mermaid";
1313
+ const createMermaidPlugin = plateCommon.createPluginFactory({
1314
+ isElement: true,
1315
+ isVoid: true,
1316
+ isInline: false,
1317
+ key: ELEMENT_MERMAID
1318
+ });
1319
+ const MermaidElementWithRef = ({ config }) => {
1320
+ const mermaidRef = React.useRef(null);
1321
+ React.useEffect(() => {
1322
+ if (mermaidRef.current) {
1323
+ mermaid.initialize({ startOnLoad: true });
1324
+ mermaid.init();
1325
+ }
1326
+ }, [config]);
1327
+ return /* @__PURE__ */ React.createElement("div", { contentEditable: false, className: "border-border border-b" }, /* @__PURE__ */ React.createElement("div", { ref: mermaidRef }, /* @__PURE__ */ React.createElement("pre", { className: "mermaid not-tina-prose" }, config)));
1328
+ };
1329
+ const Bubble = ({ children }) => {
1330
+ return /* @__PURE__ */ React.createElement("div", { className: "bg-blue-600 rounded-full p-2 transition-transform duration-200 ease-in-out hover:scale-110" }, children);
1331
+ };
1332
+ const ErrorMsg = ({ error }) => {
1333
+ if (error) {
1334
+ return /* @__PURE__ */ React.createElement(
1335
+ "div",
1336
+ {
1337
+ contentEditable: false,
1338
+ className: "font-mono bg-red-600 text-white p-2 rounded-md cursor-default"
1339
+ },
1340
+ error
1341
+ );
1342
+ }
1343
+ return null;
1344
+ };
1345
+ const DEFAULT_MERMAID_CONFIG = `%% This won't render without implementing a rendering engine (e.g. mermaid on npm)
1346
+ flowchart TD
1347
+ id1(this is an example flow diagram)
1348
+ --> id2(modify me to see changes!)
1349
+ id2
1350
+ --> id3(Click the top button to preview the changes)
1351
+ --> id4(Learn about mermaid diagrams - mermaid.js.org)`;
1352
+ const MermaidElement = cn$1.withRef(
1353
+ ({ children, nodeProps, element, ...props }, ref) => {
1354
+ const [mermaidConfig, setMermaidConfig] = React.useState(
1355
+ element.value || DEFAULT_MERMAID_CONFIG
1356
+ );
1357
+ const [isEditing, setIsEditing] = React.useState(
1358
+ mermaidConfig === DEFAULT_MERMAID_CONFIG || false
1359
+ );
1360
+ const [mermaidError, setMermaidError] = React.useState(null);
1361
+ const node = {
1362
+ type: ELEMENT_MERMAID,
1363
+ value: mermaidConfig,
1364
+ children: [{ type: "text", text: "" }]
1365
+ };
1366
+ React.useEffect(() => {
1367
+ if (mermaid.parse(mermaidConfig)) {
1368
+ setMermaidError(null);
1364
1369
  }
1365
- ))
1366
- );
1367
- }
1368
- function CodeBlockIcon(props) {
1369
- const title = props.title || "code-block";
1370
- return /* @__PURE__ */ React.createElement(
1371
- "svg",
1372
- {
1373
- className: "h-5 w-5",
1374
- stroke: "currentColor",
1375
- fill: "currentColor",
1376
- strokeWidth: 0,
1377
- viewBox: "0 0 16 16",
1378
- height: "1em",
1379
- width: "1em",
1380
- xmlns: "http://www.w3.org/2000/svg"
1381
- },
1382
- /* @__PURE__ */ React.createElement("title", null, title),
1383
- /* @__PURE__ */ React.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" }),
1384
- /* @__PURE__ */ React.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" })
1385
- );
1386
- }
1387
- function ImageIcon(props) {
1388
- const title = props.title || "image";
1389
- return /* @__PURE__ */ React.createElement(
1390
- "svg",
1391
- {
1392
- className: "h-5 w-5",
1393
- height: "24",
1394
- width: "24",
1395
- viewBox: "0 0 24 24",
1396
- xmlns: "http://www.w3.org/2000/svg"
1397
- },
1398
- /* @__PURE__ */ React.createElement("title", null, title),
1399
- /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1400
- "path",
1370
+ }, [mermaidConfig]);
1371
+ mermaid.parseError = (err) => {
1372
+ setMermaidError(
1373
+ String(err.message) || "An error occurred while parsing the diagram."
1374
+ );
1375
+ };
1376
+ return /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { element, ref, ...props }, /* @__PURE__ */ React.createElement("div", { className: "relative group" }, /* @__PURE__ */ React.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.createElement(Bubble, null, isEditing ? /* @__PURE__ */ React.createElement(
1377
+ lucideReact.Eye,
1401
1378
  {
1402
- 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",
1403
- fill: "currentColor"
1379
+ className: "w-5 h-5 fill-white cursor-pointer",
1380
+ onClick: () => {
1381
+ setIsEditing(!isEditing);
1382
+ }
1404
1383
  }
1405
- ))
1406
- );
1407
- }
1408
- function BoldIcon(props) {
1409
- const title = props.title || "format bold";
1410
- return /* @__PURE__ */ React.createElement(
1411
- "svg",
1412
- {
1413
- className: "h-5 w-5",
1414
- height: "24",
1415
- width: "24",
1416
- viewBox: "0 0 24 24",
1417
- xmlns: "http://www.w3.org/2000/svg"
1418
- },
1419
- /* @__PURE__ */ React.createElement("title", null, title),
1420
- /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1421
- "path",
1384
+ ) : /* @__PURE__ */ React.createElement(
1385
+ lucideReact.SquarePen,
1386
+ {
1387
+ className: "w-5 h-5 fill-white cursor-pointer",
1388
+ onClick: () => {
1389
+ setIsEditing(!isEditing);
1390
+ }
1391
+ }
1392
+ ))), isEditing ? /* @__PURE__ */ React.createElement(
1393
+ CodeBlock,
1422
1394
  {
1423
- 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",
1424
- fill: "currentColor"
1395
+ children: "",
1396
+ language: "yaml",
1397
+ ...props,
1398
+ element: node,
1399
+ defaultValue: mermaidConfig,
1400
+ onChangeCallback: (value) => setMermaidConfig(value)
1425
1401
  }
1426
- ))
1427
- );
1428
- }
1429
- function ItalicIcon(props) {
1430
- const title = props.title || "format italic";
1402
+ ) : /* @__PURE__ */ React.createElement(MermaidElementWithRef, { config: mermaidConfig })), children, /* @__PURE__ */ React.createElement(ErrorMsg, { error: mermaidError }));
1403
+ }
1404
+ );
1405
+ const RawMarkdown = () => {
1431
1406
  return /* @__PURE__ */ React.createElement(
1432
1407
  "svg",
1433
1408
  {
1409
+ stroke: "currentColor",
1410
+ fill: "currentColor",
1411
+ strokeWidth: 0,
1412
+ role: "img",
1434
1413
  className: "h-5 w-5",
1435
- height: "24",
1436
- width: "24",
1437
1414
  viewBox: "0 0 24 24",
1415
+ height: "1em",
1416
+ width: "1em",
1438
1417
  xmlns: "http://www.w3.org/2000/svg"
1439
1418
  },
1440
- /* @__PURE__ */ React.createElement("title", null, title),
1441
- /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1442
- "path",
1443
- {
1444
- d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z",
1445
- fill: "currentColor"
1446
- }
1447
- ))
1419
+ /* @__PURE__ */ React.createElement("title", null),
1420
+ /* @__PURE__ */ React.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
1421
  );
1449
- }
1450
- function PlusIcon({ className = "" }) {
1451
- return /* @__PURE__ */ React.createElement(
1452
- "svg",
1422
+ };
1423
+ const MermaidIcon = () => /* @__PURE__ */ React.createElement(
1424
+ "svg",
1425
+ {
1426
+ width: "100%",
1427
+ height: "100%",
1428
+ viewBox: "0 0 491 491",
1429
+ version: "1.1",
1430
+ xmlns: "http://www.w3.org/2000/svg",
1431
+ fillRule: "evenodd",
1432
+ clipRule: "evenodd",
1433
+ strokeLinejoin: "round",
1434
+ strokeMiterlimit: 2
1435
+ },
1436
+ /* @__PURE__ */ React.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" }),
1437
+ /* @__PURE__ */ React.createElement(
1438
+ "path",
1453
1439
  {
1454
- xmlns: "http://www.w3.org/2000/svg",
1455
- className: `h-4 w-4 ${className}`,
1456
- viewBox: "0 0 20 20",
1457
- fill: "currentColor"
1458
- },
1459
- /* @__PURE__ */ React.createElement(
1460
- "path",
1461
- {
1462
- fillRule: "evenodd",
1463
- 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",
1464
- clipRule: "evenodd"
1465
- }
1466
- )
1467
- );
1468
- }
1469
- const InlineComboboxContext = React.createContext(
1470
- null
1440
+ 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",
1441
+ fill: "white",
1442
+ fillRule: "nonzero"
1443
+ }
1444
+ )
1471
1445
  );
1472
- const defaultFilter = ({ keywords = [], value }, search) => [value, ...keywords].some((keyword) => plateCombobox.filterWords(keyword, search));
1473
- const InlineCombobox = ({
1474
- children,
1475
- element,
1476
- filter = defaultFilter,
1477
- hideWhenNoValue = false,
1478
- setValue: setValueProp,
1479
- showTrigger = true,
1480
- trigger,
1481
- value: valueProp
1482
- }) => {
1483
- const editor = plateCommon.useEditorRef();
1484
- const inputRef = React.useRef(null);
1485
- const cursorState = plateCombobox.useHTMLInputCursorState(inputRef);
1486
- const [valueState, setValueState] = React.useState("");
1487
- const hasValueProp = valueProp !== void 0;
1488
- const value = hasValueProp ? valueProp : valueState;
1489
- const setValue = React.useCallback(
1490
- (newValue) => {
1491
- setValueProp == null ? void 0 : setValueProp(newValue);
1492
- if (!hasValueProp) {
1493
- setValueState(newValue);
1494
- }
1495
- },
1496
- [setValueProp, hasValueProp]
1497
- );
1498
- const [insertPoint, setInsertPoint] = React.useState(null);
1499
- React.useEffect(() => {
1500
- const path = plateCommon.findNodePath(editor, element);
1501
- if (!path)
1502
- return;
1503
- const point = plateCommon.getPointBefore(editor, path);
1504
- if (!point)
1505
- return;
1506
- const pointRef = plateCommon.createPointRef(editor, point);
1507
- setInsertPoint(pointRef);
1508
- return () => {
1509
- pointRef.unref();
1510
- };
1511
- }, [editor, element]);
1512
- const { props: inputProps, removeInput } = plateCombobox.useComboboxInput({
1513
- cancelInputOnBlur: false,
1514
- cursorState,
1515
- onCancelInput: (cause) => {
1516
- if (cause !== "backspace") {
1517
- plateCommon.insertText(editor, trigger + value, {
1518
- at: (insertPoint == null ? void 0 : insertPoint.current) ?? void 0
1519
- });
1520
- }
1521
- if (cause === "arrowLeft" || cause === "arrowRight") {
1522
- plateCommon.moveSelection(editor, {
1523
- distance: 1,
1524
- reverse: cause === "arrowLeft"
1525
- });
1526
- }
1446
+ const borderAll = (props) => /* @__PURE__ */ React.createElement(
1447
+ "svg",
1448
+ {
1449
+ viewBox: "0 0 24 24",
1450
+ height: "48",
1451
+ width: "48",
1452
+ focusable: "false",
1453
+ role: "img",
1454
+ fill: "currentColor",
1455
+ xmlns: "http://www.w3.org/2000/svg",
1456
+ ...props
1457
+ },
1458
+ /* @__PURE__ */ React.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" })
1459
+ );
1460
+ const borderBottom = (props) => /* @__PURE__ */ React.createElement(
1461
+ "svg",
1462
+ {
1463
+ viewBox: "0 0 24 24",
1464
+ height: "48",
1465
+ width: "48",
1466
+ focusable: "false",
1467
+ role: "img",
1468
+ fill: "currentColor",
1469
+ xmlns: "http://www.w3.org/2000/svg",
1470
+ ...props
1471
+ },
1472
+ /* @__PURE__ */ React.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" })
1473
+ );
1474
+ const borderLeft = (props) => /* @__PURE__ */ React.createElement(
1475
+ "svg",
1476
+ {
1477
+ viewBox: "0 0 24 24",
1478
+ height: "48",
1479
+ width: "48",
1480
+ focusable: "false",
1481
+ role: "img",
1482
+ fill: "currentColor",
1483
+ xmlns: "http://www.w3.org/2000/svg",
1484
+ ...props
1485
+ },
1486
+ /* @__PURE__ */ React.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" })
1487
+ );
1488
+ const borderNone = (props) => /* @__PURE__ */ React.createElement(
1489
+ "svg",
1490
+ {
1491
+ viewBox: "0 0 24 24",
1492
+ height: "48",
1493
+ width: "48",
1494
+ focusable: "false",
1495
+ role: "img",
1496
+ fill: "currentColor",
1497
+ xmlns: "http://www.w3.org/2000/svg",
1498
+ ...props
1499
+ },
1500
+ /* @__PURE__ */ React.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" })
1501
+ );
1502
+ const borderRight = (props) => /* @__PURE__ */ React.createElement(
1503
+ "svg",
1504
+ {
1505
+ viewBox: "0 0 24 24",
1506
+ height: "48",
1507
+ width: "48",
1508
+ focusable: "false",
1509
+ role: "img",
1510
+ fill: "currentColor",
1511
+ xmlns: "http://www.w3.org/2000/svg",
1512
+ ...props
1513
+ },
1514
+ /* @__PURE__ */ React.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" })
1515
+ );
1516
+ const borderTop = (props) => /* @__PURE__ */ React.createElement(
1517
+ "svg",
1518
+ {
1519
+ viewBox: "0 0 24 24",
1520
+ height: "48",
1521
+ width: "48",
1522
+ focusable: "false",
1523
+ role: "img",
1524
+ fill: "currentColor",
1525
+ xmlns: "http://www.w3.org/2000/svg",
1526
+ ...props
1527
+ },
1528
+ /* @__PURE__ */ React.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" })
1529
+ );
1530
+ const iconVariants = classVarianceAuthority.cva("", {
1531
+ variants: {
1532
+ variant: {
1533
+ toolbar: "size-5",
1534
+ menuItem: "mr-2 size-5"
1527
1535
  },
1528
- ref: inputRef
1529
- });
1530
- const [hasEmpty, setHasEmpty] = React.useState(false);
1531
- const contextValue = React.useMemo(
1532
- () => ({
1533
- filter,
1534
- inputProps,
1535
- inputRef,
1536
- removeInput,
1537
- setHasEmpty,
1538
- showTrigger,
1539
- trigger
1540
- }),
1541
- [
1542
- trigger,
1543
- showTrigger,
1544
- filter,
1545
- inputRef,
1546
- inputProps,
1547
- removeInput,
1548
- setHasEmpty
1549
- ]
1550
- );
1551
- const store = react.useComboboxStore({
1552
- setValue: (newValue) => React.startTransition(() => setValue(newValue))
1553
- });
1554
- const items2 = store.useState("items");
1555
- React.useEffect(() => {
1556
- if (!store.getState().activeId) {
1557
- store.setActiveId(store.first());
1536
+ size: {
1537
+ sm: "mr-2 size-4",
1538
+ md: "mr-2 size-6"
1539
+ }
1540
+ },
1541
+ defaultVariants: {}
1542
+ });
1543
+ const DoubleColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
1544
+ "svg",
1545
+ {
1546
+ fill: "none",
1547
+ height: "16",
1548
+ viewBox: "0 0 16 16",
1549
+ width: "16",
1550
+ xmlns: "http://www.w3.org/2000/svg",
1551
+ ...props
1552
+ },
1553
+ /* @__PURE__ */ React.createElement(
1554
+ "path",
1555
+ {
1556
+ clipRule: "evenodd",
1557
+ 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",
1558
+ fill: "#595E6F",
1559
+ fillRule: "evenodd"
1558
1560
  }
1559
- }, [items2, store]);
1560
- return /* @__PURE__ */ React.createElement("span", { contentEditable: false }, /* @__PURE__ */ React.createElement(
1561
- react.ComboboxProvider,
1561
+ )
1562
+ );
1563
+ const ThreeColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
1564
+ "svg",
1565
+ {
1566
+ fill: "none",
1567
+ height: "16",
1568
+ viewBox: "0 0 16 16",
1569
+ width: "16",
1570
+ xmlns: "http://www.w3.org/2000/svg",
1571
+ ...props
1572
+ },
1573
+ /* @__PURE__ */ React.createElement(
1574
+ "path",
1562
1575
  {
1563
- open: (items2.length > 0 || hasEmpty) && (!hideWhenNoValue || value.length > 0),
1564
- store
1565
- },
1566
- /* @__PURE__ */ React.createElement(InlineComboboxContext.Provider, { value: contextValue }, children)
1567
- ));
1568
- };
1569
- const InlineComboboxInput = React.forwardRef(({ className, ...props }, propRef) => {
1570
- const {
1571
- inputProps,
1572
- inputRef: contextRef,
1573
- showTrigger,
1574
- trigger
1575
- } = React.useContext(InlineComboboxContext);
1576
- const store = react.useComboboxContext();
1577
- const value = store.useState("value");
1578
- const ref = plateCommon.useComposedRef(propRef, contextRef);
1579
- return /* @__PURE__ */ React.createElement(React.Fragment, null, showTrigger && trigger, /* @__PURE__ */ React.createElement("span", { className: "relative min-h-[1lh]" }, /* @__PURE__ */ React.createElement(
1580
- "span",
1576
+ clipRule: "evenodd",
1577
+ 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",
1578
+ fill: "#4C5161",
1579
+ fillRule: "evenodd"
1580
+ }
1581
+ )
1582
+ );
1583
+ const RightSideDoubleColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
1584
+ "svg",
1585
+ {
1586
+ fill: "none",
1587
+ height: "16",
1588
+ viewBox: "0 0 16 16",
1589
+ width: "16",
1590
+ xmlns: "http://www.w3.org/2000/svg",
1591
+ ...props
1592
+ },
1593
+ /* @__PURE__ */ React.createElement(
1594
+ "path",
1581
1595
  {
1582
- "aria-hidden": "true",
1583
- className: "invisible overflow-hidden text-nowrap"
1584
- },
1585
- value || ""
1586
- ), /* @__PURE__ */ React.createElement(
1587
- react.Combobox,
1596
+ clipRule: "evenodd",
1597
+ d: "M11.25 3H13V13H11.25V3ZM10.25 2H11.25H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H11.25H10.25H3C2.44772 14 2 13.5523 2 13V3C2 2.44772 2.44772 2 3 2H10.25ZM10.25 13H3L3 3H10.25V13Z",
1598
+ fill: "#595E6F",
1599
+ fillRule: "evenodd"
1600
+ }
1601
+ )
1602
+ );
1603
+ const LeftSideDoubleColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
1604
+ "svg",
1605
+ {
1606
+ fill: "none",
1607
+ height: "16",
1608
+ viewBox: "0 0 16 16",
1609
+ width: "16",
1610
+ xmlns: "http://www.w3.org/2000/svg",
1611
+ ...props
1612
+ },
1613
+ /* @__PURE__ */ React.createElement(
1614
+ "path",
1588
1615
  {
1589
- autoSelect: true,
1590
- className: cn$1.cn(
1591
- "absolute left-0 top-0 size-full bg-transparent outline-none",
1592
- className
1593
- ),
1594
- ref,
1595
- value,
1596
- ...inputProps,
1597
- ...props
1616
+ clipRule: "evenodd",
1617
+ d: "M5.75 3H13V13H5.75V3ZM4.75 2H5.75H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H5.75H4.75H3C2.44772 14 2 13.5523 2 13V3C2 2.44772 2.44772 2 3 2H4.75ZM4.75 13H3L3 3H4.75V13Z",
1618
+ fill: "#595E6F",
1619
+ fillRule: "evenodd"
1598
1620
  }
1599
- )));
1600
- });
1601
- InlineComboboxInput.displayName = "InlineComboboxInput";
1602
- const InlineComboboxContent = ({
1603
- className,
1604
- ...props
1605
- }) => {
1606
- return /* @__PURE__ */ React.createElement(react.Portal, null, /* @__PURE__ */ React.createElement(
1607
- react.ComboboxPopover,
1621
+ )
1622
+ );
1623
+ const DoubleSideDoubleColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
1624
+ "svg",
1625
+ {
1626
+ fill: "none",
1627
+ height: "16",
1628
+ viewBox: "0 0 16 16",
1629
+ width: "16",
1630
+ xmlns: "http://www.w3.org/2000/svg",
1631
+ ...props
1632
+ },
1633
+ /* @__PURE__ */ React.createElement(
1634
+ "path",
1608
1635
  {
1609
- className: cn$1.cn(
1610
- "z-[9999999] max-h-[288px] w-[300px] overflow-y-auto rounded-md bg-white shadow-md",
1611
- className
1612
- ),
1613
- ...props
1636
+ clipRule: "evenodd",
1637
+ d: "M10.25 3H5.75V13H10.25V3ZM10.25 2H5.75H4.75H3C2.44772 2 2 2.44772 2 3V13C2 13.5523 2.44772 14 3 14H4.75H5.75H10.25H11.25H13C13.5523 14 14 13.5523 14 13V3C14 2.44772 13.5523 2 13 2H11.25H10.25ZM11.25 3V13H13V3H11.25ZM3 13H4.75V3H3L3 13Z",
1638
+ fill: "#595E6F",
1639
+ fillRule: "evenodd"
1614
1640
  }
1615
- ));
1616
- };
1617
- const comboboxItemVariants = classVarianceAuthority.cva(
1618
- "relative flex h-9 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
1641
+ )
1642
+ );
1643
+ const Overflow = (props) => /* @__PURE__ */ React.createElement(
1644
+ "svg",
1619
1645
  {
1620
- defaultVariants: {
1621
- interactive: true
1646
+ xmlns: "http://www.w3.org/2000/svg",
1647
+ className: "h-5 w-5",
1648
+ fill: "none",
1649
+ viewBox: "0 0 24 24",
1650
+ stroke: "currentColor",
1651
+ ...props
1652
+ },
1653
+ /* @__PURE__ */ React.createElement(
1654
+ "path",
1655
+ {
1656
+ strokeLinecap: "round",
1657
+ strokeLinejoin: "round",
1658
+ strokeWidth: 2,
1659
+ d: "M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"
1660
+ }
1661
+ )
1662
+ );
1663
+ const Icons = {
1664
+ add: lucideReact.Plus,
1665
+ alignCenter: lucideReact.AlignCenter,
1666
+ alignJustify: lucideReact.AlignJustify,
1667
+ alignLeft: lucideReact.AlignLeft,
1668
+ alignRight: lucideReact.AlignRight,
1669
+ arrowDown: lucideReact.ChevronDown,
1670
+ bg: lucideReact.PaintBucket,
1671
+ blockquote: lucideReact.Quote,
1672
+ // bold: Bold,
1673
+ overflow: Overflow,
1674
+ borderAll,
1675
+ borderBottom,
1676
+ borderLeft,
1677
+ borderNone,
1678
+ borderRight,
1679
+ borderTop,
1680
+ check: lucideReact.Check,
1681
+ chevronRight: lucideReact.ChevronRight,
1682
+ chevronsUpDown: lucideReact.ChevronsUpDown,
1683
+ clear: lucideReact.X,
1684
+ close: lucideReact.X,
1685
+ // code: Code2,
1686
+ paint: lucideReact.PaintBucket,
1687
+ codeblock: lucideReact.FileCode,
1688
+ color: lucideReact.Baseline,
1689
+ column: lucideReact.RectangleVertical,
1690
+ combine: lucideReact.Combine,
1691
+ ungroup: lucideReact.Ungroup,
1692
+ comment: lucideReact.MessageSquare,
1693
+ commentAdd: lucideReact.MessageSquarePlus,
1694
+ delete: lucideReact.Trash,
1695
+ dragHandle: lucideReact.GripVertical,
1696
+ editing: lucideReact.Edit2,
1697
+ emoji: lucideReact.Smile,
1698
+ externalLink: lucideReact.ExternalLink,
1699
+ h1: lucideReact.Heading1,
1700
+ h2: lucideReact.Heading2,
1701
+ h3: lucideReact.Heading3,
1702
+ h4: lucideReact.Heading4,
1703
+ h5: lucideReact.Heading5,
1704
+ h6: lucideReact.Heading6,
1705
+ // image: Image,
1706
+ indent: lucideReact.Indent,
1707
+ // italic: Italic,
1708
+ kbd: lucideReact.Keyboard,
1709
+ lineHeight: lucideReact.WrapText,
1710
+ // link: Link2,
1711
+ minus: lucideReact.Minus,
1712
+ mermaid: MermaidIcon,
1713
+ more: lucideReact.MoreHorizontal,
1714
+ // ol: ListOrdered,
1715
+ outdent: lucideReact.Outdent,
1716
+ paragraph: lucideReact.Pilcrow,
1717
+ refresh: lucideReact.RotateCcw,
1718
+ row: lucideReact.RectangleHorizontal,
1719
+ search: lucideReact.Search,
1720
+ settings: lucideReact.Settings,
1721
+ strikethrough: lucideReact.Strikethrough,
1722
+ subscript: lucideReact.Subscript,
1723
+ superscript: lucideReact.Superscript,
1724
+ table: lucideReact.Table,
1725
+ text: lucideReact.Text,
1726
+ trash: lucideReact.Trash,
1727
+ // ul: List,
1728
+ underline: lucideReact.Underline,
1729
+ unlink: lucideReact.Link2Off,
1730
+ viewing: lucideReact.Eye,
1731
+ doubleColumn: DoubleColumnOutlined,
1732
+ doubleSideDoubleColumn: DoubleSideDoubleColumnOutlined,
1733
+ threeColumn: ThreeColumnOutlined,
1734
+ leftSideDoubleColumn: LeftSideDoubleColumnOutlined,
1735
+ rightSideDoubleColumn: RightSideDoubleColumnOutlined,
1736
+ heading: HeadingIcon,
1737
+ link: LinkIcon,
1738
+ quote: QuoteIcon,
1739
+ image: ImageIcon,
1740
+ ul: UnorderedListIcon,
1741
+ ol: OrderedListIcon,
1742
+ code: CodeIcon,
1743
+ codeBlock: CodeBlockIcon,
1744
+ bold: BoldIcon,
1745
+ italic: ItalicIcon,
1746
+ raw: RawMarkdown,
1747
+ // www
1748
+ gitHub: (props) => /* @__PURE__ */ React.createElement("svg", { viewBox: "0 0 438.549 438.549", ...props }, /* @__PURE__ */ React.createElement(
1749
+ "path",
1750
+ {
1751
+ fill: "currentColor",
1752
+ 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"
1753
+ }
1754
+ )),
1755
+ logo: (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React.createElement(
1756
+ "path",
1757
+ {
1758
+ fill: "currentColor",
1759
+ 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"
1760
+ }
1761
+ )),
1762
+ moon: lucideReact.Moon,
1763
+ sun: lucideReact.SunMedium,
1764
+ twitter: lucideReact.Twitter
1765
+ };
1766
+ function UnorderedListIcon(props) {
1767
+ const title = props.title || "format list bulleted";
1768
+ return /* @__PURE__ */ React.createElement(
1769
+ "svg",
1770
+ {
1771
+ className: "h-5 w-5",
1772
+ height: "24",
1773
+ width: "24",
1774
+ viewBox: "0 0 24 24",
1775
+ xmlns: "http://www.w3.org/2000/svg"
1622
1776
  },
1623
- variants: {
1624
- interactive: {
1625
- false: "",
1626
- 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"
1777
+ /* @__PURE__ */ React.createElement("title", null, title),
1778
+ /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement("path", { d: "M7 5h14v2H7V5z", fill: "currentColor" }), /* @__PURE__ */ React.createElement(
1779
+ "path",
1780
+ {
1781
+ d: "M4 7.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z",
1782
+ fill: "currentColor"
1627
1783
  }
1628
- }
1629
- }
1630
- );
1631
- const InlineComboboxItem = ({
1632
- className,
1633
- keywords,
1634
- onClick,
1635
- ...props
1636
- }) => {
1637
- const { value } = props;
1638
- const { filter, removeInput } = React.useContext(InlineComboboxContext);
1639
- const store = react.useComboboxContext();
1640
- const search = filter && store.useState("value");
1641
- const visible = React.useMemo(
1642
- () => !filter || filter({ keywords, value }, search),
1643
- [filter, value, keywords, search]
1784
+ ), /* @__PURE__ */ React.createElement(
1785
+ "path",
1786
+ {
1787
+ 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",
1788
+ fill: "currentColor"
1789
+ }
1790
+ ), /* @__PURE__ */ React.createElement(
1791
+ "path",
1792
+ {
1793
+ d: "M4 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z",
1794
+ fill: "currentColor"
1795
+ }
1796
+ ))
1644
1797
  );
1645
- if (!visible)
1646
- return null;
1798
+ }
1799
+ function HeadingIcon(props) {
1800
+ const title = props.title || "format size";
1647
1801
  return /* @__PURE__ */ React.createElement(
1648
- react.ComboboxItem,
1802
+ "svg",
1649
1803
  {
1650
- className: cn$1.cn(comboboxItemVariants(), className),
1651
- onClick: (event) => {
1652
- removeInput(true);
1653
- onClick == null ? void 0 : onClick(event);
1654
- },
1655
- ...props
1656
- }
1804
+ height: "24",
1805
+ width: "24",
1806
+ className: "h-5 w-5",
1807
+ viewBox: "0 0 24 24",
1808
+ xmlns: "http://www.w3.org/2000/svg"
1809
+ },
1810
+ /* @__PURE__ */ React.createElement("title", null, title),
1811
+ /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1812
+ "path",
1813
+ {
1814
+ d: "M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3V9H3v3z",
1815
+ fill: "currentColor"
1816
+ }
1817
+ ))
1657
1818
  );
1658
- };
1659
- const InlineComboboxEmpty = ({
1660
- children,
1661
- className
1662
- }) => {
1663
- const { setHasEmpty } = React.useContext(InlineComboboxContext);
1664
- const store = react.useComboboxContext();
1665
- const items2 = store.useState("items");
1666
- React.useEffect(() => {
1667
- setHasEmpty(true);
1668
- return () => {
1669
- setHasEmpty(false);
1670
- };
1671
- }, [setHasEmpty]);
1672
- if (items2.length > 0)
1673
- return null;
1819
+ }
1820
+ function OrderedListIcon(props) {
1821
+ const title = props.title || "format list numbered";
1674
1822
  return /* @__PURE__ */ React.createElement(
1675
- "div",
1823
+ "svg",
1676
1824
  {
1677
- className: cn$1.cn(comboboxItemVariants({ interactive: false }), className)
1825
+ className: "h-5 w-5",
1826
+ height: "24",
1827
+ width: "24",
1828
+ viewBox: "0 0 24 24",
1829
+ xmlns: "http://www.w3.org/2000/svg"
1678
1830
  },
1679
- children
1831
+ /* @__PURE__ */ React.createElement("title", null, title),
1832
+ /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1833
+ "path",
1834
+ {
1835
+ d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z",
1836
+ fill: "currentColor"
1837
+ }
1838
+ ))
1680
1839
  );
1681
- };
1682
- const rules = [
1683
- {
1684
- icon: Icons.h1,
1685
- onSelect: (editor) => {
1686
- plateCommon.toggleNodeType(editor, { activeType: plateHeading.ELEMENT_H1 });
1687
- },
1688
- value: "Heading 1"
1689
- },
1690
- {
1691
- icon: Icons.h2,
1692
- onSelect: (editor) => {
1693
- plateCommon.toggleNodeType(editor, { activeType: plateHeading.ELEMENT_H2 });
1694
- },
1695
- value: "Heading 2"
1696
- },
1697
- {
1698
- icon: Icons.h3,
1699
- onSelect: (editor) => {
1700
- plateCommon.toggleNodeType(editor, { activeType: plateHeading.ELEMENT_H3 });
1701
- },
1702
- value: "Heading 3"
1703
- },
1704
- {
1705
- icon: Icons.ul,
1706
- keywords: ["ul", "unordered list"],
1707
- onSelect: (editor) => {
1708
- plate.toggleList(editor, { type: plate.ELEMENT_UL });
1840
+ }
1841
+ function QuoteIcon(props) {
1842
+ const title = props.title || "format quote";
1843
+ return /* @__PURE__ */ React.createElement(
1844
+ "svg",
1845
+ {
1846
+ height: "24",
1847
+ className: "h-5 w-5",
1848
+ width: "24",
1849
+ viewBox: "0 0 24 24",
1850
+ xmlns: "http://www.w3.org/2000/svg"
1709
1851
  },
1710
- value: "Bulleted list"
1711
- },
1712
- {
1713
- icon: Icons.ol,
1714
- keywords: ["ol", "ordered list"],
1715
- onSelect: (editor) => {
1716
- plate.toggleList(editor, { type: plate.ELEMENT_OL });
1852
+ /* @__PURE__ */ React.createElement("title", null, title),
1853
+ /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1854
+ "path",
1855
+ {
1856
+ d: "M6 17h3l2-4V7H5v6h3l-2 4zm8 0h3l2-4V7h-6v6h3l-2 4z",
1857
+ fill: "currentColor"
1858
+ }
1859
+ ))
1860
+ );
1861
+ }
1862
+ function LinkIcon(props) {
1863
+ const title = props.title || "insert link";
1864
+ return /* @__PURE__ */ React.createElement(
1865
+ "svg",
1866
+ {
1867
+ height: "24",
1868
+ className: "h-5 w-5",
1869
+ width: "24",
1870
+ viewBox: "0 0 24 24",
1871
+ xmlns: "http://www.w3.org/2000/svg"
1717
1872
  },
1718
- value: "Numbered list"
1719
- }
1720
- ];
1721
- const SlashInputElement = cn$1.withRef(
1722
- ({ className, ...props }, ref) => {
1723
- const { children, editor, element } = props;
1724
- return /* @__PURE__ */ React.createElement(
1725
- plateCommon.PlateElement,
1873
+ /* @__PURE__ */ React.createElement("title", null, title),
1874
+ /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1875
+ "path",
1726
1876
  {
1727
- as: "span",
1728
- "data-slate-value": element.value,
1729
- ref,
1730
- ...props
1731
- },
1732
- /* @__PURE__ */ React.createElement(InlineCombobox, { element, trigger: "/" }, /* @__PURE__ */ React.createElement(InlineComboboxInput, null), /* @__PURE__ */ React.createElement(InlineComboboxContent, null, /* @__PURE__ */ React.createElement(InlineComboboxEmpty, null, "No matching commands found"), rules.map(({ icon: Icon, keywords, onSelect, value }) => /* @__PURE__ */ React.createElement(
1733
- InlineComboboxItem,
1734
- {
1735
- key: value,
1736
- keywords,
1737
- onClick: () => onSelect(editor),
1738
- value
1739
- },
1740
- /* @__PURE__ */ React.createElement(Icon, { "aria-hidden": true, className: "mr-2 size-4" }),
1741
- value
1742
- )))),
1743
- children
1744
- );
1745
- }
1746
- );
1747
- const listVariants = classVarianceAuthority.cva("m-0 ps-6", {
1748
- variants: {
1749
- variant: {
1750
- ol: "list-decimal",
1751
- ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
1752
- }
1753
- }
1754
- });
1755
- const ListElementVariants = cn$1.withVariants(plateCommon.PlateElement, listVariants, [
1756
- "variant"
1757
- ]);
1758
- const ListElement = cn$1.withRef(
1759
- ({ children, variant = "ul", ...props }, ref) => {
1760
- const Component = variant;
1761
- return /* @__PURE__ */ React.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React.createElement(Component, null, children));
1762
- }
1763
- );
1764
- const BlockquoteElement = cn$1.withRef(
1765
- ({ children, className, ...props }, ref) => {
1766
- return /* @__PURE__ */ React.createElement(
1767
- plateCommon.PlateElement,
1877
+ 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",
1878
+ fill: "currentColor"
1879
+ }
1880
+ ))
1881
+ );
1882
+ }
1883
+ function CodeIcon(props) {
1884
+ const title = props.title || "code";
1885
+ return /* @__PURE__ */ React.createElement(
1886
+ "svg",
1887
+ {
1888
+ className: "h-5 w-5",
1889
+ height: "24",
1890
+ width: "24",
1891
+ viewBox: "0 0 24 24",
1892
+ xmlns: "http://www.w3.org/2000/svg"
1893
+ },
1894
+ /* @__PURE__ */ React.createElement("title", null, title),
1895
+ /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1896
+ "path",
1768
1897
  {
1769
- asChild: true,
1770
- className: cn$1.cn("my-1 border-l-2 pl-6 italic", className),
1771
- ref,
1772
- ...props
1773
- },
1774
- /* @__PURE__ */ React.createElement("blockquote", null, children)
1775
- );
1776
- }
1777
- );
1778
- const CodeLeaf = cn$1.withRef(
1779
- ({ children, className, ...props }, ref) => {
1780
- return /* @__PURE__ */ React.createElement(
1781
- plateCommon.PlateLeaf,
1898
+ 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",
1899
+ fill: "currentColor"
1900
+ }
1901
+ ))
1902
+ );
1903
+ }
1904
+ function CodeBlockIcon(props) {
1905
+ const title = props.title || "code-block";
1906
+ return /* @__PURE__ */ React.createElement(
1907
+ "svg",
1908
+ {
1909
+ className: "h-5 w-5",
1910
+ stroke: "currentColor",
1911
+ fill: "currentColor",
1912
+ strokeWidth: 0,
1913
+ viewBox: "0 0 16 16",
1914
+ height: "1em",
1915
+ width: "1em",
1916
+ xmlns: "http://www.w3.org/2000/svg"
1917
+ },
1918
+ /* @__PURE__ */ React.createElement("title", null, title),
1919
+ /* @__PURE__ */ React.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" }),
1920
+ /* @__PURE__ */ React.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" })
1921
+ );
1922
+ }
1923
+ function ImageIcon(props) {
1924
+ const title = props.title || "image";
1925
+ return /* @__PURE__ */ React.createElement(
1926
+ "svg",
1927
+ {
1928
+ className: "h-5 w-5",
1929
+ height: "24",
1930
+ width: "24",
1931
+ viewBox: "0 0 24 24",
1932
+ xmlns: "http://www.w3.org/2000/svg"
1933
+ },
1934
+ /* @__PURE__ */ React.createElement("title", null, title),
1935
+ /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1936
+ "path",
1782
1937
  {
1783
- asChild: true,
1784
- className: cn$1.cn(
1785
- "whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
1786
- className
1787
- ),
1788
- ref,
1789
- ...props
1790
- },
1791
- /* @__PURE__ */ React.createElement("code", null, children)
1792
- );
1793
- }
1794
- );
1795
- const CodeLineElement = cn$1.withRef((props, ref) => /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { ref, ...props }));
1796
- const CodeSyntaxLeaf = cn$1.withRef(
1797
- ({ children, ...props }, ref) => {
1798
- const { leaf } = props;
1799
- const { tokenProps } = plateCodeBlock.useCodeSyntaxLeaf({ leaf });
1800
- return /* @__PURE__ */ React.createElement(plateCommon.PlateLeaf, { ref, ...props }, /* @__PURE__ */ React.createElement("span", { ...tokenProps }, children));
1801
- }
1802
- );
1803
- function ChevronDownIcon(props, svgRef) {
1804
- return /* @__PURE__ */ React__namespace.createElement("svg", Object.assign({
1805
- xmlns: "http://www.w3.org/2000/svg",
1806
- viewBox: "0 0 20 20",
1807
- fill: "currentColor",
1808
- "aria-hidden": "true",
1809
- ref: svgRef
1810
- }, props), /* @__PURE__ */ React__namespace.createElement("path", {
1811
- fillRule: "evenodd",
1812
- 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",
1813
- clipRule: "evenodd"
1814
- }));
1938
+ 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",
1939
+ fill: "currentColor"
1940
+ }
1941
+ ))
1942
+ );
1815
1943
  }
1816
- const ForwardRef = React__namespace.forwardRef(ChevronDownIcon);
1817
- const ChevronDownIcon$1 = ForwardRef;
1818
- const Autocomplete = ({
1819
- value,
1820
- onChange,
1821
- defaultQuery,
1822
- items: items2
1823
- }) => {
1824
- const [query, setQuery] = React.useState(defaultQuery ?? "");
1825
- const filteredItems = React.useMemo(() => {
1826
- try {
1827
- const reFilter = new RegExp(query, "i");
1828
- const _items = items2.filter((item) => reFilter.test(item.label));
1829
- if (_items.length === 0)
1830
- return items2;
1831
- return _items;
1832
- } catch (err) {
1833
- return items2;
1834
- }
1835
- }, [items2, query]);
1944
+ function BoldIcon(props) {
1945
+ const title = props.title || "format bold";
1836
1946
  return /* @__PURE__ */ React.createElement(
1837
- react$1.Combobox,
1947
+ "svg",
1838
1948
  {
1839
- value,
1840
- onChange,
1841
- as: "div",
1842
- className: "relative inline-block text-left z-20"
1949
+ className: "h-5 w-5",
1950
+ height: "24",
1951
+ width: "24",
1952
+ viewBox: "0 0 24 24",
1953
+ xmlns: "http://www.w3.org/2000/svg"
1843
1954
  },
1844
- /* @__PURE__ */ React.createElement("div", { className: "mt-1" }, /* @__PURE__ */ React.createElement("div", { className: "relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left shadow-md sm:text-sm" }, /* @__PURE__ */ React.createElement(
1845
- react$1.ComboboxInput,
1955
+ /* @__PURE__ */ React.createElement("title", null, title),
1956
+ /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1957
+ "path",
1846
1958
  {
1847
- 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",
1848
- displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
1849
- onChange: (event) => setQuery(event.target.value),
1850
- onClick: (ev) => ev.stopPropagation()
1959
+ 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",
1960
+ fill: "currentColor"
1851
1961
  }
1852
- ), /* @__PURE__ */ React.createElement(react$1.ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React.createElement(
1853
- ChevronDownIcon$1,
1962
+ ))
1963
+ );
1964
+ }
1965
+ function ItalicIcon(props) {
1966
+ const title = props.title || "format italic";
1967
+ return /* @__PURE__ */ React.createElement(
1968
+ "svg",
1969
+ {
1970
+ className: "h-5 w-5",
1971
+ height: "24",
1972
+ width: "24",
1973
+ viewBox: "0 0 24 24",
1974
+ xmlns: "http://www.w3.org/2000/svg"
1975
+ },
1976
+ /* @__PURE__ */ React.createElement("title", null, title),
1977
+ /* @__PURE__ */ React.createElement("g", { fill: "none" }, /* @__PURE__ */ React.createElement(
1978
+ "path",
1854
1979
  {
1855
- className: "h-5 w-5 text-gray-400",
1856
- "aria-hidden": "true"
1980
+ d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z",
1981
+ fill: "currentColor"
1857
1982
  }
1858
- )))),
1983
+ ))
1984
+ );
1985
+ }
1986
+ function PlusIcon({ className = "" }) {
1987
+ return /* @__PURE__ */ React.createElement(
1988
+ "svg",
1989
+ {
1990
+ xmlns: "http://www.w3.org/2000/svg",
1991
+ className: `h-4 w-4 ${className}`,
1992
+ viewBox: "0 0 20 20",
1993
+ fill: "currentColor"
1994
+ },
1859
1995
  /* @__PURE__ */ React.createElement(
1860
- react$1.Transition,
1996
+ "path",
1861
1997
  {
1862
- enter: "transition ease-out duration-100",
1863
- enterFrom: "transform opacity-0 scale-95",
1864
- enterTo: "transform opacity-100 scale-100",
1865
- leave: "transition ease-in duration-75",
1866
- leaveFrom: "transform opacity-100 scale-100",
1867
- leaveTo: "transform opacity-0 scale-95"
1868
- },
1869
- /* @__PURE__ */ React.createElement(react$1.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.createElement(react$1.ComboboxOption, { key: item.key, value: item }, ({ focus }) => /* @__PURE__ */ React.createElement(
1870
- "button",
1871
- {
1872
- className: classNames$1(
1873
- focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
1874
- "block px-4 py-2 text-xs w-full text-right"
1875
- )
1876
- },
1877
- item.render(item)
1878
- ))))
1998
+ fillRule: "evenodd",
1999
+ 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",
2000
+ clipRule: "evenodd"
2001
+ }
1879
2002
  )
1880
2003
  );
1881
- };
1882
- MonacoEditor.loader.config({
1883
- paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
1884
- });
1885
- let retryCount = 0;
1886
- const retryFocus = (ref) => {
1887
- if (ref.current) {
1888
- ref.current.focus();
1889
- } else {
1890
- if (retryCount < 30) {
1891
- setTimeout(() => {
1892
- retryCount = retryCount + 1;
1893
- retryFocus(ref);
1894
- }, 100);
2004
+ }
2005
+ const InlineComboboxContext = React.createContext(
2006
+ null
2007
+ );
2008
+ const defaultFilter = ({ keywords = [], value }, search) => [value, ...keywords].some((keyword) => plateCombobox.filterWords(keyword, search));
2009
+ const InlineCombobox = ({
2010
+ children,
2011
+ element,
2012
+ filter = defaultFilter,
2013
+ hideWhenNoValue = false,
2014
+ setValue: setValueProp,
2015
+ showTrigger = true,
2016
+ trigger,
2017
+ value: valueProp
2018
+ }) => {
2019
+ const editor = plateCommon.useEditorRef();
2020
+ const inputRef = React.useRef(null);
2021
+ const cursorState = plateCombobox.useHTMLInputCursorState(inputRef);
2022
+ const [valueState, setValueState] = React.useState("");
2023
+ const hasValueProp = valueProp !== void 0;
2024
+ const value = hasValueProp ? valueProp : valueState;
2025
+ const setValue = React.useCallback(
2026
+ (newValue) => {
2027
+ setValueProp == null ? void 0 : setValueProp(newValue);
2028
+ if (!hasValueProp) {
2029
+ setValueState(newValue);
2030
+ }
2031
+ },
2032
+ [setValueProp, hasValueProp]
2033
+ );
2034
+ const [insertPoint, setInsertPoint] = React.useState(null);
2035
+ React.useEffect(() => {
2036
+ const path = plateCommon.findNodePath(editor, element);
2037
+ if (!path)
2038
+ return;
2039
+ const point = plateCommon.getPointBefore(editor, path);
2040
+ if (!point)
2041
+ return;
2042
+ const pointRef = plateCommon.createPointRef(editor, point);
2043
+ setInsertPoint(pointRef);
2044
+ return () => {
2045
+ pointRef.unref();
2046
+ };
2047
+ }, [editor, element]);
2048
+ const { props: inputProps, removeInput } = plateCombobox.useComboboxInput({
2049
+ cancelInputOnBlur: false,
2050
+ cursorState,
2051
+ onCancelInput: (cause) => {
2052
+ if (cause !== "backspace") {
2053
+ plateCommon.insertText(editor, trigger + value, {
2054
+ at: (insertPoint == null ? void 0 : insertPoint.current) ?? void 0
2055
+ });
2056
+ }
2057
+ if (cause === "arrowLeft" || cause === "arrowRight") {
2058
+ plateCommon.moveSelection(editor, {
2059
+ distance: 1,
2060
+ reverse: cause === "arrowLeft"
2061
+ });
2062
+ }
2063
+ },
2064
+ ref: inputRef
2065
+ });
2066
+ const [hasEmpty, setHasEmpty] = React.useState(false);
2067
+ const contextValue = React.useMemo(
2068
+ () => ({
2069
+ filter,
2070
+ inputProps,
2071
+ inputRef,
2072
+ removeInput,
2073
+ setHasEmpty,
2074
+ showTrigger,
2075
+ trigger
2076
+ }),
2077
+ [
2078
+ trigger,
2079
+ showTrigger,
2080
+ filter,
2081
+ inputRef,
2082
+ inputProps,
2083
+ removeInput,
2084
+ setHasEmpty
2085
+ ]
2086
+ );
2087
+ const store = react$1.useComboboxStore({
2088
+ setValue: (newValue) => React.startTransition(() => setValue(newValue))
2089
+ });
2090
+ const items2 = store.useState("items");
2091
+ React.useEffect(() => {
2092
+ if (!store.getState().activeId) {
2093
+ store.setActiveId(store.first());
1895
2094
  }
1896
- }
2095
+ }, [items2, store]);
2096
+ return /* @__PURE__ */ React.createElement("span", { contentEditable: false }, /* @__PURE__ */ React.createElement(
2097
+ react$1.ComboboxProvider,
2098
+ {
2099
+ open: (items2.length > 0 || hasEmpty) && (!hideWhenNoValue || value.length > 0),
2100
+ store
2101
+ },
2102
+ /* @__PURE__ */ React.createElement(InlineComboboxContext.Provider, { value: contextValue }, children)
2103
+ ));
1897
2104
  };
1898
- const CodeBlock = ({
1899
- attributes,
1900
- editor,
1901
- element,
1902
- language: restrictLanguage,
2105
+ const InlineComboboxInput = React.forwardRef(({ className, ...props }, propRef) => {
2106
+ const {
2107
+ inputProps,
2108
+ inputRef: contextRef,
2109
+ showTrigger,
2110
+ trigger
2111
+ } = React.useContext(InlineComboboxContext);
2112
+ const store = react$1.useComboboxContext();
2113
+ const value = store.useState("value");
2114
+ const ref = plateCommon.useComposedRef(propRef, contextRef);
2115
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, showTrigger && trigger, /* @__PURE__ */ React.createElement("span", { className: "relative min-h-[1lh]" }, /* @__PURE__ */ React.createElement(
2116
+ "span",
2117
+ {
2118
+ "aria-hidden": "true",
2119
+ className: "invisible overflow-hidden text-nowrap"
2120
+ },
2121
+ value || "​"
2122
+ ), /* @__PURE__ */ React.createElement(
2123
+ react$1.Combobox,
2124
+ {
2125
+ autoSelect: true,
2126
+ className: cn$1.cn(
2127
+ "absolute left-0 top-0 size-full bg-transparent outline-none",
2128
+ className
2129
+ ),
2130
+ ref,
2131
+ value,
2132
+ ...inputProps,
2133
+ ...props
2134
+ }
2135
+ )));
2136
+ });
2137
+ InlineComboboxInput.displayName = "InlineComboboxInput";
2138
+ const InlineComboboxContent = ({
2139
+ className,
1903
2140
  ...props
1904
2141
  }) => {
1905
- const [navigateAway, setNavigateAway] = React.useState(null);
1906
- const monaco = MonacoEditor.useMonaco();
1907
- const monacoEditorRef = React.useRef(null);
1908
- const selected = slateReact.useSelected();
1909
- const [height, setHeight] = React.useState(28);
1910
- React.useEffect(() => {
1911
- if (selected && plateCommon.isCollapsed(editor.selection)) {
1912
- retryFocus(monacoEditorRef);
1913
- }
1914
- }, [selected, monacoEditorRef.current]);
1915
- const value = element.value || "";
1916
- if (typeof value !== "string") {
1917
- throw new Error("Element must be of type string for code block");
1918
- }
1919
- const language = restrictLanguage || element.lang;
1920
- const id = React.useMemo(() => uuid(), []);
1921
- const languages = React.useMemo(() => {
1922
- const defaultLangSet = { "": "plain text" };
1923
- if (!monaco)
1924
- return defaultLangSet;
1925
- return monaco.languages.getLanguages().reduce((ac, cv) => {
1926
- if (cv.id === "plaintext")
1927
- return ac;
1928
- return { ...ac, [cv.id]: cv.id };
1929
- }, defaultLangSet);
1930
- }, [monaco]);
1931
- React.useEffect(() => {
1932
- if (monaco) {
1933
- monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
1934
- monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
1935
- // disable errors
1936
- noSemanticValidation: true,
1937
- noSyntaxValidation: true
1938
- });
1939
- }
1940
- }, [monaco]);
1941
- const items2 = Object.entries(languages).map(([key, label]) => ({
1942
- key,
1943
- label,
1944
- render: (item) => item.label
1945
- }));
1946
- const currentItem = React.useMemo(() => {
1947
- return items2.find((item) => item.key === language) ?? {
1948
- key: "",
1949
- label: "Plain Text"
1950
- };
1951
- }, [items2, language]);
1952
- React.useEffect(() => {
1953
- if (navigateAway) {
1954
- setNavigateAway(null);
1955
- switch (navigateAway) {
1956
- case "remove":
1957
- {
1958
- plateCommon.focusEditor(editor);
1959
- plateCommon.setNodes(
1960
- editor,
1961
- {
1962
- type: "p",
1963
- children: [{ text: "" }],
1964
- lang: void 0,
1965
- value: void 0
1966
- },
1967
- {
1968
- match: (n) => {
1969
- if (plateCommon.isElement(n) && n.type === element.type) {
1970
- return true;
1971
- }
1972
- }
1973
- }
1974
- );
1975
- }
1976
- break;
1977
- case "insertNext":
1978
- {
1979
- plateCommon.insertNodes(
1980
- editor,
1981
- [
1982
- {
1983
- type: plateCommon.ELEMENT_DEFAULT,
1984
- children: [{ text: "" }],
1985
- lang: void 0,
1986
- value: void 0
1987
- }
1988
- ],
1989
- { select: true }
1990
- );
1991
- plateCommon.focusEditor(editor);
1992
- }
1993
- break;
1994
- case "up":
1995
- {
1996
- const path = plateCommon.findNodePath(editor, element);
1997
- if (!path) {
1998
- return;
1999
- }
2000
- const previousNodePath = plateCommon.getPointBefore(editor, path);
2001
- if (!previousNodePath) {
2002
- plateCommon.focusEditor(editor);
2003
- plateCommon.insertNodes(
2004
- editor,
2005
- [
2006
- {
2007
- type: plateCommon.ELEMENT_DEFAULT,
2008
- children: [{ text: "" }],
2009
- lang: void 0,
2010
- value: void 0
2011
- }
2012
- ],
2013
- // Insert a new node at the current path, resulting in the code_block
2014
- // moving down one block
2015
- { at: path, select: true }
2016
- );
2017
- return;
2018
- }
2019
- plateCommon.focusEditor(editor, previousNodePath);
2020
- }
2021
- break;
2022
- case "down": {
2023
- const path = plateCommon.findNodePath(editor, element);
2024
- if (!path) {
2025
- return;
2026
- }
2027
- const nextNodePath = plateCommon.getPointAfter(editor, path);
2028
- if (!nextNodePath) {
2029
- plateCommon.insertNodes(
2030
- editor,
2031
- [
2032
- {
2033
- type: plateCommon.ELEMENT_DEFAULT,
2034
- children: [{ text: "" }],
2035
- lang: void 0,
2036
- value: void 0
2037
- }
2038
- ],
2039
- { select: true }
2040
- );
2041
- plateCommon.focusEditor(editor);
2042
- } else {
2043
- plateCommon.focusEditor(editor, nextNodePath);
2044
- }
2045
- break;
2046
- }
2047
- }
2142
+ return /* @__PURE__ */ React.createElement(react$1.Portal, null, /* @__PURE__ */ React.createElement(
2143
+ react$1.ComboboxPopover,
2144
+ {
2145
+ className: cn$1.cn(
2146
+ "z-[9999999] max-h-[288px] w-[300px] overflow-y-auto rounded-md bg-white shadow-md",
2147
+ className
2148
+ ),
2149
+ ...props
2048
2150
  }
2049
- }, [navigateAway]);
2050
- function handleEditorDidMount(monacoEditor, monaco2) {
2051
- monacoEditorRef.current = monacoEditor;
2052
- monacoEditor.onDidContentSizeChange(() => {
2053
- setHeight(monacoEditor.getContentHeight());
2054
- monacoEditor.layout();
2055
- });
2056
- monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
2057
- if (monacoEditor.hasTextFocus()) {
2058
- setNavigateAway("insertNext");
2059
- }
2060
- });
2061
- monacoEditor.onKeyDown((l) => {
2062
- if (l.code === "ArrowUp") {
2063
- const selection = monacoEditor.getSelection();
2064
- if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
2065
- setNavigateAway("up");
2066
- }
2067
- }
2068
- if (l.code === "ArrowDown") {
2069
- const selection = monacoEditor.getSelection();
2070
- const totalLines = monacoEditor.getModel().getLineCount();
2071
- if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
2072
- setNavigateAway("down");
2073
- }
2074
- }
2075
- if (l.code === "Backspace") {
2076
- const selection = monacoEditor.getSelection();
2077
- 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) {
2078
- setNavigateAway("remove");
2079
- }
2151
+ ));
2152
+ };
2153
+ const comboboxItemVariants = classVarianceAuthority.cva(
2154
+ "relative flex h-9 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
2155
+ {
2156
+ defaultVariants: {
2157
+ interactive: true
2158
+ },
2159
+ variants: {
2160
+ interactive: {
2161
+ false: "",
2162
+ 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"
2080
2163
  }
2081
- });
2164
+ }
2082
2165
  }
2166
+ );
2167
+ const InlineComboboxItem = ({
2168
+ className,
2169
+ keywords,
2170
+ onClick,
2171
+ ...props
2172
+ }) => {
2173
+ const { value } = props;
2174
+ const { filter, removeInput } = React.useContext(InlineComboboxContext);
2175
+ const store = react$1.useComboboxContext();
2176
+ const search = filter && store.useState("value");
2177
+ const visible = React.useMemo(
2178
+ () => !filter || filter({ keywords, value }, search),
2179
+ [filter, value, keywords, search]
2180
+ );
2181
+ if (!visible)
2182
+ return null;
2183
+ return /* @__PURE__ */ React.createElement(
2184
+ react$1.ComboboxItem,
2185
+ {
2186
+ className: cn$1.cn(comboboxItemVariants(), className),
2187
+ onClick: (event) => {
2188
+ removeInput(true);
2189
+ onClick == null ? void 0 : onClick(event);
2190
+ },
2191
+ ...props
2192
+ }
2193
+ );
2194
+ };
2195
+ const InlineComboboxEmpty = ({
2196
+ children,
2197
+ className
2198
+ }) => {
2199
+ const { setHasEmpty } = React.useContext(InlineComboboxContext);
2200
+ const store = react$1.useComboboxContext();
2201
+ const items2 = store.useState("items");
2202
+ React.useEffect(() => {
2203
+ setHasEmpty(true);
2204
+ return () => {
2205
+ setHasEmpty(false);
2206
+ };
2207
+ }, [setHasEmpty]);
2208
+ if (items2.length > 0)
2209
+ return null;
2083
2210
  return /* @__PURE__ */ React.createElement(
2084
2211
  "div",
2085
2212
  {
2086
- ...attributes,
2087
- className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
2213
+ className: cn$1.cn(comboboxItemVariants({ interactive: false }), className)
2088
2214
  },
2089
- /* @__PURE__ */ React.createElement("style", null, `.monaco-editor .editor-widget {
2090
- display: none !important;
2091
- visibility: hidden !important;
2092
- }`),
2093
- props.children,
2094
- /* @__PURE__ */ React.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement(
2095
- Autocomplete,
2215
+ children
2216
+ );
2217
+ };
2218
+ const rules = [
2219
+ {
2220
+ icon: Icons.h1,
2221
+ onSelect: (editor) => {
2222
+ plateCommon.toggleNodeType(editor, { activeType: plateHeading.ELEMENT_H1 });
2223
+ },
2224
+ value: "Heading 1"
2225
+ },
2226
+ {
2227
+ icon: Icons.h2,
2228
+ onSelect: (editor) => {
2229
+ plateCommon.toggleNodeType(editor, { activeType: plateHeading.ELEMENT_H2 });
2230
+ },
2231
+ value: "Heading 2"
2232
+ },
2233
+ {
2234
+ icon: Icons.h3,
2235
+ onSelect: (editor) => {
2236
+ plateCommon.toggleNodeType(editor, { activeType: plateHeading.ELEMENT_H3 });
2237
+ },
2238
+ value: "Heading 3"
2239
+ },
2240
+ {
2241
+ icon: Icons.ul,
2242
+ keywords: ["ul", "unordered list"],
2243
+ onSelect: (editor) => {
2244
+ plate.toggleList(editor, { type: plate.ELEMENT_UL });
2245
+ },
2246
+ value: "Bulleted list"
2247
+ },
2248
+ {
2249
+ icon: Icons.ol,
2250
+ keywords: ["ol", "ordered list"],
2251
+ onSelect: (editor) => {
2252
+ plate.toggleList(editor, { type: plate.ELEMENT_OL });
2253
+ },
2254
+ value: "Numbered list"
2255
+ }
2256
+ ];
2257
+ const SlashInputElement = cn$1.withRef(
2258
+ ({ className, ...props }, ref) => {
2259
+ const { children, editor, element } = props;
2260
+ return /* @__PURE__ */ React.createElement(
2261
+ plateCommon.PlateElement,
2096
2262
  {
2097
- items: items2,
2098
- value: currentItem,
2099
- defaultQuery: "plaintext",
2100
- onChange: (item) => plateCommon.setNodes(editor, { lang: item.key })
2263
+ as: "span",
2264
+ "data-slate-value": element.value,
2265
+ ref,
2266
+ ...props
2267
+ },
2268
+ /* @__PURE__ */ React.createElement(InlineCombobox, { element, trigger: "/" }, /* @__PURE__ */ React.createElement(InlineComboboxInput, null), /* @__PURE__ */ React.createElement(InlineComboboxContent, null, /* @__PURE__ */ React.createElement(InlineComboboxEmpty, null, "No matching commands found"), rules.map(({ icon: Icon, keywords, onSelect, value }) => /* @__PURE__ */ React.createElement(
2269
+ InlineComboboxItem,
2270
+ {
2271
+ key: value,
2272
+ keywords,
2273
+ onClick: () => onSelect(editor),
2274
+ value
2275
+ },
2276
+ /* @__PURE__ */ React.createElement(Icon, { "aria-hidden": true, className: "mr-2 size-4" }),
2277
+ value
2278
+ )))),
2279
+ children
2280
+ );
2281
+ }
2282
+ );
2283
+ const TableCellElement = cn$1.withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
2284
+ var _a, _b, _c, _d;
2285
+ const { element } = props;
2286
+ const {
2287
+ borders,
2288
+ colIndex,
2289
+ colSpan,
2290
+ hovered,
2291
+ hoveredLeft,
2292
+ isSelectingCell,
2293
+ readOnly,
2294
+ rowIndex,
2295
+ rowSize,
2296
+ selected
2297
+ } = plateTable.useTableCellElementState();
2298
+ const { props: cellProps } = plateTable.useTableCellElement({ element: props.element });
2299
+ const resizableState = plateTable.useTableCellElementResizableState({
2300
+ colIndex,
2301
+ colSpan,
2302
+ rowIndex
2303
+ });
2304
+ const { bottomProps, hiddenLeft, leftProps, rightProps } = plateTable.useTableCellElementResizable(resizableState);
2305
+ const Cell = isHeader ? "th" : "td";
2306
+ return /* @__PURE__ */ React.createElement(
2307
+ plateCommon.PlateElement,
2308
+ {
2309
+ asChild: true,
2310
+ className: cn$1.cn(
2311
+ "relative h-full overflow-visible border-none bg-background p-0",
2312
+ hideBorder && "before:border-none",
2313
+ element.background ? "bg-[--cellBackground]" : "bg-background",
2314
+ !hideBorder && cn$1.cn(
2315
+ isHeader && "text-left [&_>_*]:m-0",
2316
+ "before:size-full",
2317
+ selected && "before:z-10 before:bg-muted",
2318
+ "before:absolute before:box-border before:select-none before:content-['']",
2319
+ borders && cn$1.cn(
2320
+ ((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
2321
+ ((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
2322
+ ((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
2323
+ ((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
2324
+ )
2325
+ ),
2326
+ className
2327
+ ),
2328
+ ref,
2329
+ ...cellProps,
2330
+ ...props,
2331
+ style: {
2332
+ "--cellBackground": element.background,
2333
+ ...style
2101
2334
  }
2102
- )), /* @__PURE__ */ React.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React.createElement(
2103
- MonacoEditor,
2335
+ },
2336
+ /* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(
2337
+ "div",
2104
2338
  {
2105
- path: id,
2106
- onMount: handleEditorDidMount,
2107
- options: {
2108
- scrollBeyondLastLine: false,
2109
- // automaticLayout: true,
2110
- tabSize: 2,
2111
- disableLayerHinting: true,
2112
- accessibilitySupport: "off",
2113
- codeLens: false,
2114
- wordWrap: "on",
2115
- minimap: {
2116
- enabled: false
2117
- },
2118
- fontSize: 14,
2119
- lineHeight: 2,
2120
- formatOnPaste: true,
2121
- lineNumbers: "off",
2122
- formatOnType: true,
2123
- fixedOverflowWidgets: true,
2124
- // Takes too much horizontal space for iframe
2125
- folding: false,
2126
- renderLineHighlight: "none",
2127
- scrollbar: {
2128
- verticalScrollbarSize: 1,
2129
- horizontalScrollbarSize: 1,
2130
- // https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
2131
- alwaysConsumeMouseWheel: false
2132
- }
2133
- },
2134
- language: String(language),
2135
- value: String(element.value),
2136
- onChange: (value2) => {
2137
- plateCommon.setNodes(editor, { value: value2, lang: language });
2339
+ className: "relative z-20 box-border h-full px-3 py-2",
2340
+ style: {
2341
+ minHeight: rowSize
2342
+ }
2343
+ },
2344
+ children
2345
+ ), !isSelectingCell && /* @__PURE__ */ React.createElement(
2346
+ "div",
2347
+ {
2348
+ className: "group absolute top-0 size-full select-none",
2349
+ contentEditable: false,
2350
+ suppressContentEditableWarning: true
2351
+ },
2352
+ !readOnly && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
2353
+ plateResizable.ResizeHandle,
2354
+ {
2355
+ ...rightProps,
2356
+ className: "-top-3 right-[-5px] w-[10px]"
2357
+ }
2358
+ ), /* @__PURE__ */ React.createElement(
2359
+ plateResizable.ResizeHandle,
2360
+ {
2361
+ ...bottomProps,
2362
+ className: "bottom-[-5px] h-[10px]"
2363
+ }
2364
+ ), !hiddenLeft && /* @__PURE__ */ React.createElement(
2365
+ plateResizable.ResizeHandle,
2366
+ {
2367
+ ...leftProps,
2368
+ className: "-top-3 left-[-5px] w-[10px]"
2369
+ }
2370
+ ), hovered && /* @__PURE__ */ React.createElement(
2371
+ "div",
2372
+ {
2373
+ className: cn$1.cn(
2374
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2375
+ "right-[-1.5px]"
2376
+ )
2377
+ }
2378
+ ), hoveredLeft && /* @__PURE__ */ React.createElement(
2379
+ "div",
2380
+ {
2381
+ className: cn$1.cn(
2382
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2383
+ "left-[-1.5px]"
2384
+ )
2138
2385
  }
2139
- }
2140
- )))
2386
+ ))
2387
+ ))
2141
2388
  );
2142
- };
2143
- const CodeBlockElement = cn$1.withRef(
2144
- ({ className, ...props }, ref) => {
2145
- const { element } = props;
2146
- const state = plateCodeBlock.useCodeBlockElementState({ element });
2147
- return /* @__PURE__ */ React.createElement(
2148
- plateCommon.PlateElement,
2149
- {
2150
- className: cn$1.cn("relative py-1", state.className, className),
2151
- ref,
2152
- ...props
2153
- },
2154
- /* @__PURE__ */ React.createElement(CodeBlock, { ...props })
2155
- );
2156
- }
2157
- );
2389
+ });
2390
+ TableCellElement.displayName = "TableCellElement";
2391
+ const TableCellHeaderElement = cn$1.withProps(TableCellElement, {
2392
+ isHeader: true
2393
+ });
2158
2394
  const buttonVariants$1 = classVarianceAuthority.cva(
2159
2395
  "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",
2160
2396
  {
@@ -2520,117 +2756,6 @@ var __publicField = (obj, key, value) => {
2520
2756
  /* @__PURE__ */ React.createElement("tr", null, children)
2521
2757
  );
2522
2758
  });
2523
- const TableCellElement = cn$1.withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
2524
- var _a, _b, _c, _d;
2525
- const { element } = props;
2526
- const {
2527
- borders,
2528
- colIndex,
2529
- colSpan,
2530
- hovered,
2531
- hoveredLeft,
2532
- isSelectingCell,
2533
- readOnly,
2534
- rowIndex,
2535
- rowSize,
2536
- selected
2537
- } = plateTable.useTableCellElementState();
2538
- const { props: cellProps } = plateTable.useTableCellElement({ element: props.element });
2539
- const resizableState = plateTable.useTableCellElementResizableState({
2540
- colIndex,
2541
- colSpan,
2542
- rowIndex
2543
- });
2544
- const { bottomProps, hiddenLeft, leftProps, rightProps } = plateTable.useTableCellElementResizable(resizableState);
2545
- const Cell = isHeader ? "th" : "td";
2546
- return /* @__PURE__ */ React.createElement(
2547
- plateCommon.PlateElement,
2548
- {
2549
- asChild: true,
2550
- className: cn$1.cn(
2551
- "relative h-full overflow-visible border-none bg-background p-0",
2552
- hideBorder && "before:border-none",
2553
- element.background ? "bg-[--cellBackground]" : "bg-background",
2554
- !hideBorder && cn$1.cn(
2555
- isHeader && "text-left [&_>_*]:m-0",
2556
- "before:size-full",
2557
- selected && "before:z-10 before:bg-muted",
2558
- "before:absolute before:box-border before:select-none before:content-['']",
2559
- borders && cn$1.cn(
2560
- ((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
2561
- ((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
2562
- ((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
2563
- ((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
2564
- )
2565
- ),
2566
- className
2567
- ),
2568
- ref,
2569
- ...cellProps,
2570
- ...props,
2571
- style: {
2572
- "--cellBackground": element.background,
2573
- ...style
2574
- }
2575
- },
2576
- /* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(
2577
- "div",
2578
- {
2579
- className: "relative z-20 box-border h-full px-3 py-2",
2580
- style: {
2581
- minHeight: rowSize
2582
- }
2583
- },
2584
- children
2585
- ), !isSelectingCell && /* @__PURE__ */ React.createElement(
2586
- "div",
2587
- {
2588
- className: "group absolute top-0 size-full select-none",
2589
- contentEditable: false,
2590
- suppressContentEditableWarning: true
2591
- },
2592
- !readOnly && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
2593
- plateResizable.ResizeHandle,
2594
- {
2595
- ...rightProps,
2596
- className: "-top-3 right-[-5px] w-[10px]"
2597
- }
2598
- ), /* @__PURE__ */ React.createElement(
2599
- plateResizable.ResizeHandle,
2600
- {
2601
- ...bottomProps,
2602
- className: "bottom-[-5px] h-[10px]"
2603
- }
2604
- ), !hiddenLeft && /* @__PURE__ */ React.createElement(
2605
- plateResizable.ResizeHandle,
2606
- {
2607
- ...leftProps,
2608
- className: "-top-3 left-[-5px] w-[10px]"
2609
- }
2610
- ), hovered && /* @__PURE__ */ React.createElement(
2611
- "div",
2612
- {
2613
- className: cn$1.cn(
2614
- "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2615
- "right-[-1.5px]"
2616
- )
2617
- }
2618
- ), hoveredLeft && /* @__PURE__ */ React.createElement(
2619
- "div",
2620
- {
2621
- className: cn$1.cn(
2622
- "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2623
- "left-[-1.5px]"
2624
- )
2625
- }
2626
- ))
2627
- ))
2628
- );
2629
- });
2630
- TableCellElement.displayName = "TableCellElement";
2631
- const TableCellHeaderElement = cn$1.withProps(TableCellElement, {
2632
- isHeader: true
2633
- });
2634
2759
  const blockClasses = "mt-0.5";
2635
2760
  const headerClasses = "font-normal";
2636
2761
  const Components = () => {
@@ -2736,6 +2861,7 @@ var __publicField = (obj, key, value) => {
2736
2861
  }
2737
2862
  )
2738
2863
  ),
2864
+ [ELEMENT_MERMAID]: MermaidElement,
2739
2865
  [plate.ELEMENT_BLOCKQUOTE]: BlockquoteElement,
2740
2866
  [plate.ELEMENT_CODE_BLOCK]: CodeBlockElement,
2741
2867
  [plate.ELEMENT_CODE_LINE]: CodeLineElement,
@@ -3230,7 +3356,9 @@ var __publicField = (obj, key, value) => {
3230
3356
  {
3231
3357
  type: "string",
3232
3358
  label: "Caption",
3233
- name: [templateName.replace(/\.props$/, ""), "caption"].join("."),
3359
+ name: [templateName.replace(/\.props$/, ""), "caption"].join(
3360
+ "."
3361
+ ),
3234
3362
  component: "text"
3235
3363
  }
3236
3364
  ]
@@ -5615,7 +5743,7 @@ var __publicField = (obj, key, value) => {
5615
5743
  return template.label ? template.label.toLowerCase().includes(filter.toLowerCase()) || name.toLowerCase().includes(filter.toLowerCase()) : name.toLowerCase().includes(filter.toLowerCase());
5616
5744
  });
5617
5745
  }, [filter]);
5618
- return /* @__PURE__ */ React__namespace.createElement(react$1.Popover, null, ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(react$1.PopoverButton, { as: "span" }, /* @__PURE__ */ React__namespace.createElement(
5746
+ return /* @__PURE__ */ React__namespace.createElement(react.Popover, null, ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(react.PopoverButton, { as: "span" }, /* @__PURE__ */ React__namespace.createElement(
5619
5747
  IconButton,
5620
5748
  {
5621
5749
  variant: open2 ? "secondary" : "primary",
@@ -5624,7 +5752,7 @@ var __publicField = (obj, key, value) => {
5624
5752
  },
5625
5753
  /* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
5626
5754
  )), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute -bottom-1 right-0 z-50" }, /* @__PURE__ */ React__namespace.createElement(
5627
- react$1.Transition,
5755
+ react.Transition,
5628
5756
  {
5629
5757
  enter: "transition duration-150 ease-out",
5630
5758
  enterFrom: "transform opacity-0 -translate-y-2",
@@ -5633,7 +5761,7 @@ var __publicField = (obj, key, value) => {
5633
5761
  leaveFrom: "transform opacity-100 translate-y-0",
5634
5762
  leaveTo: "transform opacity-0 -translate-y-2"
5635
5763
  },
5636
- /* @__PURE__ */ React__namespace.createElement(react$1.PopoverPanel, { className: "relative overflow-hidden rounded-lg shadow-lg bg-white border border-gray-100" }, ({ close: close2 }) => /* @__PURE__ */ React__namespace.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto flex flex-col w-full h-full" }, showFilter && /* @__PURE__ */ React__namespace.createElement("div", { className: "sticky top-0 bg-gray-50 p-2 border-b border-gray-100 z-10" }, /* @__PURE__ */ React__namespace.createElement(
5764
+ /* @__PURE__ */ React__namespace.createElement(react.PopoverPanel, { className: "relative overflow-hidden rounded-lg shadow-lg bg-white border border-gray-100" }, ({ close: close2 }) => /* @__PURE__ */ React__namespace.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto flex flex-col w-full h-full" }, showFilter && /* @__PURE__ */ React__namespace.createElement("div", { className: "sticky top-0 bg-gray-50 p-2 border-b border-gray-100 z-10" }, /* @__PURE__ */ React__namespace.createElement(
5637
5765
  "input",
5638
5766
  {
5639
5767
  type: "text",
@@ -5810,8 +5938,8 @@ var __publicField = (obj, key, value) => {
5810
5938
  onClick: () => setPickerIsOpen(!pickerIsOpen)
5811
5939
  },
5812
5940
  /* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
5813
- ), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react$1.Transition, { show: pickerIsOpen }, /* @__PURE__ */ React__namespace.createElement(
5814
- react$1.TransitionChild,
5941
+ ), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: pickerIsOpen }, /* @__PURE__ */ React__namespace.createElement(
5942
+ react.TransitionChild,
5815
5943
  {
5816
5944
  enter: "transform transition-all ease-out duration-200",
5817
5945
  enterFrom: "opacity-0 -translate-x-1/2",
@@ -5898,14 +6026,14 @@ var __publicField = (obj, key, value) => {
5898
6026
  };
5899
6027
  const BlockGroup = ({ category, templates, close: close2, isLast = false }) => {
5900
6028
  return /* @__PURE__ */ React__namespace.createElement(
5901
- react$1.Disclosure,
6029
+ react.Disclosure,
5902
6030
  {
5903
6031
  defaultOpen: true,
5904
6032
  as: "div",
5905
6033
  className: `left-0 right-0 relative`
5906
6034
  },
5907
6035
  ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
5908
- react$1.DisclosureButton,
6036
+ react.DisclosureButton,
5909
6037
  {
5910
6038
  className: `relative block group text-left w-full text-base font-bold tracking-wide py-2 truncate ${templates.length === 0 ? `pointer-events-none` : ``} ${!isLast && (!open2 || templates.length === 0) && `border-b border-gray-100`}`
5911
6039
  },
@@ -5923,7 +6051,7 @@ var __publicField = (obj, key, value) => {
5923
6051
  }
5924
6052
  )
5925
6053
  ), /* @__PURE__ */ React__namespace.createElement(
5926
- react$1.Transition,
6054
+ react.Transition,
5927
6055
  {
5928
6056
  enter: "transition duration-100 ease-out",
5929
6057
  enterFrom: "transform scale-95 opacity-0",
@@ -5932,7 +6060,7 @@ var __publicField = (obj, key, value) => {
5932
6060
  leaveFrom: "transform scale-100 opacity-100",
5933
6061
  leaveTo: "transform scale-95 opacity-0"
5934
6062
  },
5935
- /* @__PURE__ */ React__namespace.createElement(react$1.DisclosurePanel, null, templates.length > 0 && /* @__PURE__ */ React__namespace.createElement(CardColumns, null, templates.map(([name, template], index) => /* @__PURE__ */ React__namespace.createElement(
6063
+ /* @__PURE__ */ React__namespace.createElement(react.DisclosurePanel, null, templates.length > 0 && /* @__PURE__ */ React__namespace.createElement(CardColumns, null, templates.map(([name, template], index) => /* @__PURE__ */ React__namespace.createElement(
5936
6064
  BlockCard,
5937
6065
  {
5938
6066
  key: index,
@@ -9751,7 +9879,7 @@ var __publicField = (obj, key, value) => {
9751
9879
  const FormLists = (props) => {
9752
9880
  const cms = useCMS();
9753
9881
  return /* @__PURE__ */ React__namespace.createElement(
9754
- react$1.Transition,
9882
+ react.Transition,
9755
9883
  {
9756
9884
  appear: true,
9757
9885
  show: true,
@@ -10180,7 +10308,7 @@ var __publicField = (obj, key, value) => {
10180
10308
  "Event Log"
10181
10309
  ));
10182
10310
  };
10183
- const version = "2.2.9";
10311
+ const version = "2.3.0";
10184
10312
  const Nav = ({
10185
10313
  isLocalMode,
10186
10314
  className = "",
@@ -10234,8 +10362,8 @@ var __publicField = (obj, key, value) => {
10234
10362
  style: { maxWidth: `${sidebarWidth}px` },
10235
10363
  ...props
10236
10364
  },
10237
- /* @__PURE__ */ React__namespace.createElement("div", { className: "border-b border-gray-200" }, /* @__PURE__ */ React__namespace.createElement(react$1.Menu, { as: "div", className: "relative block" }, ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement(
10238
- react$1.MenuButton,
10365
+ /* @__PURE__ */ React__namespace.createElement("div", { className: "border-b border-gray-200" }, /* @__PURE__ */ React__namespace.createElement(react.Menu, { as: "div", className: "relative block" }, ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement(
10366
+ react.MenuButton,
10239
10367
  {
10240
10368
  className: `group w-full px-6 py-3 gap-2 flex justify-between items-center transition-colors duration-150 ease-out ${open2 ? "bg-gray-50" : "bg-transparent"}`
10241
10369
  },
@@ -10258,7 +10386,7 @@ var __publicField = (obj, key, value) => {
10258
10386
  }
10259
10387
  )
10260
10388
  ), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute bottom-3 right-5 z-50" }, /* @__PURE__ */ React__namespace.createElement(
10261
- react$1.Transition,
10389
+ react.Transition,
10262
10390
  {
10263
10391
  enter: "transition duration-150 ease-out",
10264
10392
  enterFrom: "transform opacity-0 -translate-y-2",
@@ -10267,7 +10395,7 @@ var __publicField = (obj, key, value) => {
10267
10395
  leaveFrom: "transform opacity-100 translate-y-0",
10268
10396
  leaveTo: "transform opacity-0 -translate-y-2"
10269
10397
  },
10270
- /* @__PURE__ */ React__namespace.createElement(react$1.MenuItems, { className: "bg-white border border-gray-150 rounded-lg shadow-lg flex flex-col items-stretch overflow-hidden" }, /* @__PURE__ */ React__namespace.createElement(react$1.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
10398
+ /* @__PURE__ */ React__namespace.createElement(react.MenuItems, { className: "bg-white border border-gray-150 rounded-lg shadow-lg flex flex-col items-stretch overflow-hidden" }, /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
10271
10399
  "button",
10272
10400
  {
10273
10401
  className: `text-lg px-4 py-2 first:pt-3 last:pb-3 tracking-wide whitespace-nowrap flex items-center opacity-80 text-gray-600 hover:text-blue-400 hover:bg-gray-50 hover:opacity-100`,
@@ -10300,7 +10428,7 @@ var __publicField = (obj, key, value) => {
10300
10428
  },
10301
10429
  /* @__PURE__ */ React__namespace.createElement(BiExit, { className: "w-6 h-auto mr-2 text-blue-400" }),
10302
10430
  " Log Out"
10303
- )), /* @__PURE__ */ React__namespace.createElement(react$1.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
10431
+ )), /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
10304
10432
  WrappedSyncStatus,
10305
10433
  {
10306
10434
  cms,
@@ -10646,8 +10774,8 @@ var __publicField = (obj, key, value) => {
10646
10774
  screen: activeScreen,
10647
10775
  close: () => setActiveView(null)
10648
10776
  }
10649
- )), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react$1.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
10650
- react$1.TransitionChild,
10777
+ )), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
10778
+ react.TransitionChild,
10651
10779
  {
10652
10780
  enter: "transform transition-all ease-out duration-300",
10653
10781
  enterFrom: "opacity-0 -translate-x-full",
@@ -10712,7 +10840,7 @@ var __publicField = (obj, key, value) => {
10712
10840
  ))
10713
10841
  ))
10714
10842
  ), /* @__PURE__ */ React__namespace.createElement(
10715
- react$1.TransitionChild,
10843
+ react.TransitionChild,
10716
10844
  {
10717
10845
  enter: "ease-out duration-300",
10718
10846
  enterFrom: "opacity-0",
@@ -13247,15 +13375,15 @@ var __publicField = (obj, key, value) => {
13247
13375
  );
13248
13376
  };
13249
13377
  const DotMenu = ({ onOpen, onRemove }) => {
13250
- return /* @__PURE__ */ React.createElement(react$1.Popover, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React.createElement(
13251
- react$1.PopoverButton,
13378
+ return /* @__PURE__ */ React.createElement(react.Popover, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React.createElement(
13379
+ react.PopoverButton,
13252
13380
  {
13253
13381
  as: "span",
13254
13382
  className: "cursor-pointer h-full relative inline-flex items-center px-1 py-0.5 rounded-r-md border border-gray-200 bg-white text-gray-500 hover:bg-gray-50 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500"
13255
13383
  },
13256
13384
  /* @__PURE__ */ React.createElement(EllipsisIcon, { title: "Open options" })
13257
13385
  ), /* @__PURE__ */ React.createElement(
13258
- react$1.Transition,
13386
+ react.Transition,
13259
13387
  {
13260
13388
  enter: "transition ease-out duration-100",
13261
13389
  enterFrom: "transform opacity-0 scale-95",
@@ -13264,7 +13392,7 @@ var __publicField = (obj, key, value) => {
13264
13392
  leaveFrom: "transform opacity-100 scale-100",
13265
13393
  leaveTo: "transform opacity-0 scale-95"
13266
13394
  },
13267
- /* @__PURE__ */ React.createElement(react$1.PopoverPanel, { className: "z-30 absolute origin-top-right right-0" }, /* @__PURE__ */ React.createElement("div", { className: "mt-2 -mr-1 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React.createElement("div", { className: "py-1" }, /* @__PURE__ */ React.createElement(
13395
+ /* @__PURE__ */ React.createElement(react.PopoverPanel, { className: "z-30 absolute origin-top-right right-0" }, /* @__PURE__ */ React.createElement("div", { className: "mt-2 -mr-1 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React.createElement("div", { className: "py-1" }, /* @__PURE__ */ React.createElement(
13268
13396
  "span",
13269
13397
  {
13270
13398
  onClick: onOpen,
@@ -13699,6 +13827,7 @@ var __publicField = (obj, key, value) => {
13699
13827
  "Unordered List",
13700
13828
  "Ordered List",
13701
13829
  "Quote",
13830
+ "Mermaid",
13702
13831
  "Heading 1",
13703
13832
  "Heading 2",
13704
13833
  "Heading 3",
@@ -13898,7 +14027,7 @@ var __publicField = (obj, key, value) => {
13898
14027
  cn$1.withProps(TooltipPrimitive__namespace.Content, {
13899
14028
  sideOffset: 4
13900
14029
  }),
13901
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
14030
+ "z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
13902
14031
  );
13903
14032
  function withTooltip(Component) {
13904
14033
  return React.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
@@ -14024,30 +14153,42 @@ var __publicField = (obj, key, value) => {
14024
14153
  Toolbar,
14025
14154
  "p-1 sticky left-0 top-0 z-50 w-full justify-between overflow-x-auto border border-border bg-background"
14026
14155
  );
14027
- const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
14028
- const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
14029
- const { props } = plateCommon.useMarkToolbarButton(state);
14030
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
14031
- });
14032
- const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
14033
- const editor = plateCommon.useEditorState();
14034
- const state = plate.useListToolbarButtonState({ nodeType });
14035
- const { props } = plate.useListToolbarButton(state);
14036
- return /* @__PURE__ */ React.createElement(
14037
- ToolbarButton,
14038
- {
14039
- ref,
14040
- tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
14041
- ...props,
14042
- onClick: (e) => {
14043
- e.preventDefault();
14044
- e.stopPropagation();
14045
- plate.toggleList(editor, { type: nodeType });
14156
+ const useResize = (ref, callback) => {
14157
+ React.useEffect(() => {
14158
+ const resizeObserver = new ResizeObserver((entries) => {
14159
+ for (const entry of entries) {
14160
+ callback(entry);
14046
14161
  }
14047
- },
14048
- nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
14049
- );
14050
- });
14162
+ });
14163
+ if (ref.current) {
14164
+ resizeObserver.observe(ref.current);
14165
+ }
14166
+ return () => resizeObserver.disconnect();
14167
+ }, [ref.current]);
14168
+ };
14169
+ const STANDARD_ICON_WIDTH = 32;
14170
+ const HEADING_ICON_WITH_TEXT = 127;
14171
+ const HEADING_ICON_ONLY = 58;
14172
+ const EMBED_ICON_WIDTH = 78;
14173
+ const CONTAINER_MD_BREAKPOINT = 448;
14174
+ const FLOAT_BUTTON_WIDTH = 25;
14175
+ const HEADING_LABEL = "Headings";
14176
+ const ToolbarContext = React.createContext(void 0);
14177
+ const ToolbarProvider = ({
14178
+ tinaForm,
14179
+ templates,
14180
+ overrides,
14181
+ children
14182
+ }) => {
14183
+ return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
14184
+ };
14185
+ const useToolbarContext = () => {
14186
+ const context = React.useContext(ToolbarContext);
14187
+ if (!context) {
14188
+ throw new Error("useToolbarContext must be used within a ToolbarProvider");
14189
+ }
14190
+ return context;
14191
+ };
14051
14192
  const items$1 = [
14052
14193
  {
14053
14194
  description: "Paragraph",
@@ -14126,71 +14267,35 @@ var __publicField = (obj, key, value) => {
14126
14267
  tooltip: "Headings"
14127
14268
  },
14128
14269
  /* @__PURE__ */ React.createElement(SelectedItemIcon, { className: "size-5" }),
14129
- /* @__PURE__ */ React.createElement("span", { className: "hidden 2xl:flex" }, selectedItemLabel)
14270
+ /* @__PURE__ */ React.createElement("span", { className: "@md/toolbar:flex hidden" }, selectedItemLabel)
14130
14271
  )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0" }, /* @__PURE__ */ React.createElement(
14131
14272
  DropdownMenuRadioGroup,
14132
14273
  {
14133
- className: "flex flex-col gap-0.5",
14134
- onValueChange: (type) => {
14135
- plateCommon.toggleNodeType(editor, { activeType: type });
14136
- plateCommon.collapseSelection(editor);
14137
- plateCommon.focusEditor(editor);
14138
- },
14139
- value
14140
- },
14141
- items$1.filter((item) => {
14142
- if (userInTable) {
14143
- return !unsupportedItemsInTable.has(item.label);
14144
- }
14145
- return true;
14146
- }).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
14147
- DropdownMenuRadioItem,
14148
- {
14149
- className: "min-w-[180px]",
14150
- key: itemValue,
14151
- value: itemValue
14152
- },
14153
- /* @__PURE__ */ React.createElement(Icon, { className: "mr-2 size-5" }),
14154
- label
14155
- ))
14156
- )));
14157
- }
14158
- const LinkToolbarButton = cn$1.withRef((rest, ref) => {
14159
- const state = plateLink.useLinkToolbarButtonState();
14160
- const { props } = plateLink.useLinkToolbarButton(state);
14161
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
14162
- });
14163
- const useBlockQuoteToolbarButtonState = () => {
14164
- const editor = plateCommon.useEditorState();
14165
- const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
14166
- return {
14167
- pressed: isBlockActive()
14168
- };
14169
- };
14170
- const useBlockQuoteToolbarButton = (state) => {
14171
- const editor = plateCommon.useEditorState();
14172
- const onClick = () => {
14173
- plateCommon.toggleNodeType(editor, {
14174
- activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
14175
- });
14176
- };
14177
- const onMouseDown = (e) => {
14178
- e.preventDefault();
14179
- e.stopPropagation();
14180
- };
14181
- return {
14182
- props: {
14183
- onClick,
14184
- onMouseDown,
14185
- pressed: state.pressed
14186
- }
14187
- };
14188
- };
14189
- const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14190
- const state = useBlockQuoteToolbarButtonState();
14191
- const { props } = useBlockQuoteToolbarButton(state);
14192
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
14193
- });
14274
+ className: "flex flex-col gap-0.5",
14275
+ onValueChange: (type) => {
14276
+ plateCommon.toggleNodeType(editor, { activeType: type });
14277
+ plateCommon.collapseSelection(editor);
14278
+ plateCommon.focusEditor(editor);
14279
+ },
14280
+ value
14281
+ },
14282
+ items$1.filter((item) => {
14283
+ if (userInTable) {
14284
+ return !unsupportedItemsInTable.has(item.label);
14285
+ }
14286
+ return true;
14287
+ }).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
14288
+ DropdownMenuRadioItem,
14289
+ {
14290
+ className: "min-w-[180px]",
14291
+ key: itemValue,
14292
+ value: itemValue
14293
+ },
14294
+ /* @__PURE__ */ React.createElement(Icon, { className: "mr-2 size-5" }),
14295
+ label
14296
+ ))
14297
+ )));
14298
+ }
14194
14299
  const useCodeBlockToolbarButtonState = () => {
14195
14300
  const editor = plateCommon.useEditorState();
14196
14301
  const isBlockActive = () => helpers.isNodeActive(editor, plateCodeBlock.ELEMENT_CODE_BLOCK);
@@ -14252,100 +14357,67 @@ var __publicField = (obj, key, value) => {
14252
14357
  const { props } = useImageToolbarButton(state);
14253
14358
  return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
14254
14359
  });
14255
- const useRawMarkdownToolbarButton = () => {
14256
- const { setRawMode } = useEditorContext();
14360
+ const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
14361
+ const editor = plateCommon.useEditorState();
14362
+ const state = plate.useListToolbarButtonState({ nodeType });
14363
+ const { props } = plate.useListToolbarButton(state);
14364
+ return /* @__PURE__ */ React.createElement(
14365
+ ToolbarButton,
14366
+ {
14367
+ ref,
14368
+ tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
14369
+ ...props,
14370
+ onClick: (e) => {
14371
+ e.preventDefault();
14372
+ e.stopPropagation();
14373
+ plate.toggleList(editor, { type: nodeType });
14374
+ }
14375
+ },
14376
+ nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
14377
+ );
14378
+ });
14379
+ const LinkToolbarButton = cn$1.withRef((rest, ref) => {
14380
+ const state = plateLink.useLinkToolbarButtonState();
14381
+ const { props } = plateLink.useLinkToolbarButton(state);
14382
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
14383
+ });
14384
+ const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
14385
+ const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
14386
+ const { props } = plateCommon.useMarkToolbarButton(state);
14387
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
14388
+ });
14389
+ const useMermaidToolbarButtonState = () => {
14390
+ const editor = plateCommon.useEditorState();
14391
+ const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_MERMAID);
14392
+ return {
14393
+ pressed: isBlockActive()
14394
+ };
14395
+ };
14396
+ const useMermaidToolbarButton = (state) => {
14397
+ const editor = plateCommon.useEditorState();
14398
+ const onClick = () => {
14399
+ plateCommon.insertEmptyElement(editor, ELEMENT_MERMAID, {
14400
+ nextBlock: true,
14401
+ select: true
14402
+ });
14403
+ };
14257
14404
  const onMouseDown = (e) => {
14258
- setRawMode(true);
14405
+ e.preventDefault();
14406
+ e.stopPropagation();
14259
14407
  };
14260
14408
  return {
14261
14409
  props: {
14410
+ onClick,
14262
14411
  onMouseDown,
14263
- pressed: false
14412
+ pressed: state.pressed
14264
14413
  }
14265
14414
  };
14266
14415
  };
14267
- const RawMarkdownToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14268
- const { props } = useRawMarkdownToolbarButton();
14269
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.raw, null));
14416
+ const MermaidToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14417
+ const state = useMermaidToolbarButtonState();
14418
+ const { props } = useMermaidToolbarButton(state);
14419
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Mermaid", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.mermaid, null));
14270
14420
  });
14271
- const ToolbarContext = React.createContext(void 0);
14272
- const ToolbarProvider = ({
14273
- tinaForm,
14274
- templates,
14275
- overrides,
14276
- children
14277
- }) => {
14278
- return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
14279
- };
14280
- const useToolbarContext = () => {
14281
- const context = React.useContext(ToolbarContext);
14282
- if (!context) {
14283
- throw new Error("useToolbarContext must be used within a ToolbarProvider");
14284
- }
14285
- return context;
14286
- };
14287
- function TemplatesToolbarButton() {
14288
- const { templates } = useToolbarContext();
14289
- const showEmbed = templates.length > 0;
14290
- const editor = plateCommon.useEditorState();
14291
- if (!showEmbed) {
14292
- return null;
14293
- }
14294
- return /* @__PURE__ */ React.createElement(EmbedButton, { templates, editor });
14295
- }
14296
- const EmbedButton = ({ editor, templates }) => {
14297
- const [open2, setOpen] = React.useState(false);
14298
- const [filteredTemplates, setFilteredTemplates] = React.useState(templates);
14299
- const filterChange = (e) => {
14300
- const filterText = e.target.value.toLowerCase();
14301
- setFilteredTemplates(
14302
- templates.filter(
14303
- (template) => template.name.toLowerCase().includes(filterText)
14304
- )
14305
- );
14306
- };
14307
- return /* @__PURE__ */ React.createElement(DropdownMenu, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React.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.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React.createElement(
14308
- PlusIcon,
14309
- {
14310
- className: `origin-center transition-all ease-out duration-150 ${open2 ? "rotate-45" : ""}`
14311
- }
14312
- )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { className: "max-h-48 overflow-y-auto" }, templates.length > 10 && /* @__PURE__ */ React.createElement(
14313
- "input",
14314
- {
14315
- type: "text",
14316
- placeholder: "Filter templates...",
14317
- className: "w-full p-2 border border-gray-300 rounded-md",
14318
- onChange: filterChange
14319
- }
14320
- ), /* @__PURE__ */ React.createElement(DropdownMenuSeparator, null), filteredTemplates.map((template) => /* @__PURE__ */ React.createElement(
14321
- DropdownMenuItem,
14322
- {
14323
- key: template.name,
14324
- onMouseDown: (e) => {
14325
- e.preventDefault();
14326
- close();
14327
- insertMDX(editor, template);
14328
- },
14329
- className: ""
14330
- },
14331
- template.label || template.name
14332
- ))));
14333
- };
14334
- const ICON_WIDTH = 32;
14335
- const EMBED_ICON_WIDTH = 78;
14336
- const useResize = (ref, callback) => {
14337
- React.useEffect(() => {
14338
- const resizeObserver = new ResizeObserver((entries) => {
14339
- for (const entry of entries) {
14340
- callback(entry);
14341
- }
14342
- });
14343
- if (ref.current) {
14344
- resizeObserver.observe(ref.current);
14345
- }
14346
- return () => resizeObserver.disconnect();
14347
- }, [ref.current]);
14348
- };
14349
14421
  function OverflowMenu({
14350
14422
  children,
14351
14423
  ...props
@@ -14363,6 +14435,53 @@ var __publicField = (obj, key, value) => {
14363
14435
  /* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
14364
14436
  )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
14365
14437
  }
14438
+ const useBlockQuoteToolbarButtonState = () => {
14439
+ const editor = plateCommon.useEditorState();
14440
+ const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
14441
+ return {
14442
+ pressed: isBlockActive()
14443
+ };
14444
+ };
14445
+ const useBlockQuoteToolbarButton = (state) => {
14446
+ const editor = plateCommon.useEditorState();
14447
+ const onClick = () => {
14448
+ plateCommon.toggleNodeType(editor, {
14449
+ activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
14450
+ });
14451
+ };
14452
+ const onMouseDown = (e) => {
14453
+ e.preventDefault();
14454
+ e.stopPropagation();
14455
+ };
14456
+ return {
14457
+ props: {
14458
+ onClick,
14459
+ onMouseDown,
14460
+ pressed: state.pressed
14461
+ }
14462
+ };
14463
+ };
14464
+ const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14465
+ const state = useBlockQuoteToolbarButtonState();
14466
+ const { props } = useBlockQuoteToolbarButton(state);
14467
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
14468
+ });
14469
+ const useRawMarkdownToolbarButton = () => {
14470
+ const { setRawMode } = useEditorContext();
14471
+ const onMouseDown = (e) => {
14472
+ setRawMode(true);
14473
+ };
14474
+ return {
14475
+ props: {
14476
+ onMouseDown,
14477
+ pressed: false
14478
+ }
14479
+ };
14480
+ };
14481
+ const RawMarkdownToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14482
+ const { props } = useRawMarkdownToolbarButton();
14483
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.raw, null));
14484
+ });
14366
14485
  function TableDropdownMenu(props) {
14367
14486
  const tableSelected = plateCommon.useEditorSelector(
14368
14487
  (editor2) => plateCommon.someNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } }),
@@ -14465,78 +14584,156 @@ var __publicField = (obj, key, value) => {
14465
14584
  )))
14466
14585
  ));
14467
14586
  }
14587
+ function TemplatesToolbarButton() {
14588
+ const { templates } = useToolbarContext();
14589
+ const editor = plateCommon.useEditorState();
14590
+ return /* @__PURE__ */ React.createElement(EmbedButton, { templates, editor });
14591
+ }
14592
+ const EmbedButton = ({ editor, templates }) => {
14593
+ const [open2, setOpen] = React.useState(false);
14594
+ const [filteredTemplates, setFilteredTemplates] = React.useState(templates);
14595
+ const filterChange = (e) => {
14596
+ const filterText = e.target.value.toLowerCase();
14597
+ setFilteredTemplates(
14598
+ templates.filter(
14599
+ (template) => template.name.toLowerCase().includes(filterText)
14600
+ )
14601
+ );
14602
+ };
14603
+ return /* @__PURE__ */ React.createElement(DropdownMenu, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React.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.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React.createElement(
14604
+ PlusIcon,
14605
+ {
14606
+ className: `origin-center transition-all ease-out duration-150 ${open2 ? "rotate-45" : ""}`
14607
+ }
14608
+ )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { className: "max-h-48 overflow-y-auto" }, templates.length > 10 && /* @__PURE__ */ React.createElement(
14609
+ "input",
14610
+ {
14611
+ type: "text",
14612
+ placeholder: "Filter templates...",
14613
+ className: "w-full p-2 border border-gray-300 rounded-md",
14614
+ onChange: filterChange
14615
+ }
14616
+ ), /* @__PURE__ */ React.createElement(DropdownMenuSeparator, null), filteredTemplates.map((template) => /* @__PURE__ */ React.createElement(
14617
+ DropdownMenuItem,
14618
+ {
14619
+ key: template.name,
14620
+ onMouseDown: (e) => {
14621
+ e.preventDefault();
14622
+ close();
14623
+ insertMDX(editor, template);
14624
+ },
14625
+ className: ""
14626
+ },
14627
+ template.label || template.name
14628
+ ))));
14629
+ };
14468
14630
  const toolbarItems = {
14469
14631
  heading: {
14470
- label: "Headings",
14632
+ label: HEADING_LABEL,
14633
+ width: (paragraphIconExists) => paragraphIconExists ? HEADING_ICON_WITH_TEXT : HEADING_ICON_ONLY,
14634
+ // Dynamically handle width based on paragraph icon
14471
14635
  Component: /* @__PURE__ */ React.createElement(ToolbarGroup, { noSeparator: true }, /* @__PURE__ */ React.createElement(HeadingsMenu, null))
14472
14636
  },
14473
14637
  link: {
14474
14638
  label: "Link",
14639
+ width: () => STANDARD_ICON_WIDTH,
14475
14640
  Component: /* @__PURE__ */ React.createElement(LinkToolbarButton, null)
14476
14641
  },
14477
14642
  image: {
14478
14643
  label: "Image",
14644
+ width: () => STANDARD_ICON_WIDTH,
14479
14645
  Component: /* @__PURE__ */ React.createElement(ImageToolbarButton, null)
14480
14646
  },
14481
14647
  quote: {
14482
14648
  label: "Quote",
14649
+ width: () => STANDARD_ICON_WIDTH,
14483
14650
  Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
14484
14651
  },
14485
14652
  ul: {
14486
14653
  label: "Unordered List",
14654
+ width: () => STANDARD_ICON_WIDTH,
14487
14655
  Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_UL })
14488
14656
  },
14489
14657
  ol: {
14490
14658
  label: "Ordered List",
14659
+ width: () => STANDARD_ICON_WIDTH,
14491
14660
  Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_OL })
14492
14661
  },
14493
14662
  bold: {
14494
14663
  label: "Bold",
14664
+ width: () => STANDARD_ICON_WIDTH,
14495
14665
  Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null))
14496
14666
  },
14497
14667
  italic: {
14498
14668
  label: "Italic",
14669
+ width: () => STANDARD_ICON_WIDTH,
14499
14670
  Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null))
14500
14671
  },
14501
14672
  code: {
14502
14673
  label: "Code",
14674
+ width: () => STANDARD_ICON_WIDTH,
14503
14675
  Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null))
14504
14676
  },
14505
14677
  codeBlock: {
14506
14678
  label: "Code Block",
14679
+ width: () => STANDARD_ICON_WIDTH,
14507
14680
  Component: /* @__PURE__ */ React.createElement(CodeBlockToolbarButton, null)
14508
14681
  },
14682
+ mermaid: {
14683
+ label: "Mermaid",
14684
+ width: () => STANDARD_ICON_WIDTH,
14685
+ Component: /* @__PURE__ */ React.createElement(MermaidToolbarButton, null)
14686
+ },
14509
14687
  table: {
14510
14688
  label: "Table",
14689
+ width: () => STANDARD_ICON_WIDTH,
14511
14690
  Component: /* @__PURE__ */ React.createElement(TableDropdownMenu, null)
14512
14691
  },
14513
14692
  raw: {
14514
14693
  label: "Raw Markdown",
14694
+ width: () => STANDARD_ICON_WIDTH,
14515
14695
  Component: /* @__PURE__ */ React.createElement(RawMarkdownToolbarButton, null)
14516
14696
  },
14517
14697
  embed: {
14518
14698
  label: "Templates",
14699
+ width: () => EMBED_ICON_WIDTH,
14519
14700
  Component: /* @__PURE__ */ React.createElement(TemplatesToolbarButton, null)
14520
14701
  }
14521
14702
  };
14522
14703
  function FixedToolbarButtons() {
14523
14704
  const toolbarRef = React.useRef(null);
14524
14705
  const [itemsShown, setItemsShown] = React.useState(11);
14525
- const { overrides } = useToolbarContext();
14526
- useResize(toolbarRef, (entry) => {
14527
- const width = entry.target.getBoundingClientRect().width;
14528
- const itemsShown2 = (width - EMBED_ICON_WIDTH) / ICON_WIDTH;
14529
- setItemsShown(Math.floor(itemsShown2));
14530
- });
14531
- let toolbarItemsArray = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14706
+ const { overrides, templates } = useToolbarContext();
14707
+ const showEmbedButton = templates.length > 0;
14708
+ let items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14709
+ if (!showEmbedButton) {
14710
+ items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
14711
+ }
14532
14712
  const editorState = plateCommon.useEditorState();
14533
- const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
14713
+ const userInTable = helpers.isNodeActive(editorState, plate.ELEMENT_TABLE);
14534
14714
  if (userInTable) {
14535
- toolbarItemsArray = toolbarItemsArray.filter(
14536
- (item) => !unsupportedItemsInTable.has(item.label)
14537
- );
14715
+ items2 = items2.filter((item) => !unsupportedItemsInTable.has(item.label));
14538
14716
  }
14539
- return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
14717
+ useResize(toolbarRef, (entry) => {
14718
+ const width = entry.target.getBoundingClientRect().width;
14719
+ const headingButton = items2.find((item) => item.label === HEADING_LABEL);
14720
+ const headingWidth = headingButton ? headingButton.width(width > CONTAINER_MD_BREAKPOINT) : 0;
14721
+ const availableWidth = width - headingWidth - FLOAT_BUTTON_WIDTH;
14722
+ const { itemFitCount } = items2.reduce(
14723
+ (acc, item) => {
14724
+ if (item.label !== HEADING_LABEL && acc.totalItemsWidth + item.width() <= availableWidth) {
14725
+ return {
14726
+ totalItemsWidth: acc.totalItemsWidth + item.width(),
14727
+ itemFitCount: acc.itemFitCount + 1
14728
+ };
14729
+ }
14730
+ return acc;
14731
+ },
14732
+ { totalItemsWidth: 0, itemFitCount: 1 }
14733
+ );
14734
+ setItemsShown(itemFitCount);
14735
+ });
14736
+ return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden @container/toolbar", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
14540
14737
  "div",
14541
14738
  {
14542
14739
  className: "flex",
@@ -14544,7 +14741,7 @@ var __publicField = (obj, key, value) => {
14544
14741
  transform: "translateX(calc(-1px))"
14545
14742
  }
14546
14743
  },
14547
- /* @__PURE__ */ React.createElement(React.Fragment, null, toolbarItemsArray.slice(0, itemsShown).map((item, _) => /* @__PURE__ */ React.createElement(React.Fragment, { key: item.label }, item.Component)), toolbarItemsArray.length > itemsShown && /* @__PURE__ */ React.createElement(OverflowMenu, null, toolbarItemsArray.slice(itemsShown).flatMap((c) => /* @__PURE__ */ React.createElement(React.Fragment, { key: c.label }, c.Component))))
14744
+ /* @__PURE__ */ React.createElement(React.Fragment, null, items2.slice(0, itemsShown).map((item) => /* @__PURE__ */ React.createElement(React.Fragment, { key: item.label }, item.Component)), items2.length > itemsShown && /* @__PURE__ */ React.createElement(OverflowMenu, null, items2.slice(itemsShown).flatMap((c) => /* @__PURE__ */ React.createElement(React.Fragment, { key: c.label }, c.Component))))
14548
14745
  ));
14549
14746
  }
14550
14747
  const FloatingToolbar = cn$1.withRef(({ children, state, ...props }, componentRef) => {
@@ -14874,6 +15071,7 @@ var __publicField = (obj, key, value) => {
14874
15071
  createMdxBlockPlugin(),
14875
15072
  createMdxInlinePlugin(),
14876
15073
  createImgPlugin(),
15074
+ createMermaidPlugin(),
14877
15075
  createInvalidMarkdownPlugin(),
14878
15076
  plateLink.createLinkPlugin({
14879
15077
  options: {
@@ -30996,8 +31194,8 @@ This will work when developing locally but NOT when deployed to production.
30996
31194
  }
30997
31195
  )
30998
31196
  }
30999
- ), !renderDesktopNav && /* @__PURE__ */ React.createElement(react$1.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
31000
- react$1.TransitionChild,
31197
+ ), !renderDesktopNav && /* @__PURE__ */ React.createElement(react.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
31198
+ react.TransitionChild,
31001
31199
  {
31002
31200
  enter: "transform transition-all ease-out duration-300",
31003
31201
  enterFrom: "opacity-0 -translate-x-full",
@@ -31066,7 +31264,7 @@ This will work when developing locally but NOT when deployed to production.
31066
31264
  ))
31067
31265
  ))
31068
31266
  ), /* @__PURE__ */ React.createElement(
31069
- react$1.TransitionChild,
31267
+ react.TransitionChild,
31070
31268
  {
31071
31269
  enter: "ease-out duration-300",
31072
31270
  enterFrom: "opacity-0",
@@ -31520,8 +31718,8 @@ This will work when developing locally but NOT when deployed to production.
31520
31718
  folder,
31521
31719
  collectionName
31522
31720
  }) => {
31523
- return /* @__PURE__ */ React.createElement(react$1.Menu, { as: "div", className: "relative inline-block text-left" }, () => /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(react$1.MenuButton, { className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6" }, "Create New ", /* @__PURE__ */ React.createElement(BiPlus, { className: "w-5 h-full ml-1 opacity-70" }))), /* @__PURE__ */ React.createElement(
31524
- react$1.Transition,
31721
+ return /* @__PURE__ */ React.createElement(react.Menu, { as: "div", className: "relative inline-block text-left" }, () => /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(react.MenuButton, { className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6" }, "Create New ", /* @__PURE__ */ React.createElement(BiPlus, { className: "w-5 h-full ml-1 opacity-70" }))), /* @__PURE__ */ React.createElement(
31722
+ react.Transition,
31525
31723
  {
31526
31724
  enter: "transition ease-out duration-100",
31527
31725
  enterFrom: "transform opacity-0 scale-95",
@@ -31530,7 +31728,7 @@ This will work when developing locally but NOT when deployed to production.
31530
31728
  leaveFrom: "transform opacity-100 scale-100",
31531
31729
  leaveTo: "transform opacity-0 scale-95"
31532
31730
  },
31533
- /* @__PURE__ */ React.createElement(react$1.MenuItems, { className: "origin-top-right absolute right-0 mt-2 z-menu w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React.createElement("div", { className: "py-1" }, templates.map((template) => /* @__PURE__ */ React.createElement(react$1.MenuItem, { key: `${template.label}-${template.name}` }, ({ focus }) => /* @__PURE__ */ React.createElement(
31731
+ /* @__PURE__ */ React.createElement(react.MenuItems, { className: "origin-top-right absolute right-0 mt-2 z-menu w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React.createElement("div", { className: "py-1" }, templates.map((template) => /* @__PURE__ */ React.createElement(react.MenuItem, { key: `${template.label}-${template.name}` }, ({ focus }) => /* @__PURE__ */ React.createElement(
31534
31732
  reactRouterDom.Link,
31535
31733
  {
31536
31734
  to: `/${folder.fullyQualifiedName ? [