tinacms 0.0.0-ea9b54c-20241003003029 → 0.0.0-ecea7ac-20241011043815

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist/client.js +1 -1
  2. package/dist/client.mjs +1 -1
  3. package/dist/index.js +1528 -899
  4. package/dist/index.mjs +1496 -863
  5. package/dist/rich-text/index.d.ts +3 -0
  6. package/dist/rich-text/index.js +45 -12
  7. package/dist/rich-text/index.mjs +45 -12
  8. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/fixed-toolbar-buttons.d.ts +0 -4
  9. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +2 -0
  10. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-element.d.ts +11 -0
  11. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +20 -0
  12. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/resizable.d.ts +39 -0
  13. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-cell-element.d.ts +27 -0
  14. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-dropdown-menu.d.ts +3 -0
  15. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-element.d.ts +14 -0
  16. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-row-element.d.ts +13 -0
  17. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/text-area.d.ts +5 -0
  18. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +1 -0
  19. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/custom/mermaid-plugin.d.ts +2 -0
  20. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +4 -2
  21. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +58 -0
  22. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +7 -3
  23. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +1 -1
  24. package/package.json +8 -6
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("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("@radix-ui/react-popover"), require("react-color"), require("color-string"), require("react-dropzone"), require("@radix-ui/react-slot"), 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-separator"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@radix-ui/react-dropdown-menu"), 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", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "@radix-ui/react-popover", "react-color", "color-string", "react-dropzone", "@radix-ui/react-slot", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-separator", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@radix-ui/react-dropdown-menu", "@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));
3
- })(this, function(exports2, zod, React, reactDom, plate, slateReact, plateSlashCommand, cn$1, plateCommon, plateHeading, classVarianceAuthority, lucideReact, react, plateCombobox, plateCodeBlock, MonacoEditor, react$1, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, PopoverPrimitive, pkg$1, pkg, dropzone, reactSlot, clsx, tailwindMerge, cmdk, isHotkey, slate, get, moment, dateFns, plateLink, ToolbarPrimitive, SeparatorPrimitive, TooltipPrimitive, plateParagraph, DropdownMenuPrimitive, 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) => {
@@ -26,13 +26,13 @@ var __publicField = (obj, key, value) => {
26
26
  }
27
27
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
28
28
  const PopoverPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(PopoverPrimitive);
29
+ const DropdownMenuPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(DropdownMenuPrimitive);
30
+ const SeparatorPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(SeparatorPrimitive);
29
31
  const pkg__namespace$1 = /* @__PURE__ */ _interopNamespaceDefault(pkg$1);
30
32
  const pkg__namespace = /* @__PURE__ */ _interopNamespaceDefault(pkg);
31
33
  const dropzone__namespace = /* @__PURE__ */ _interopNamespaceDefault(dropzone);
32
34
  const ToolbarPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(ToolbarPrimitive);
33
- const SeparatorPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(SeparatorPrimitive);
34
35
  const TooltipPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(TooltipPrimitive);
35
- const DropdownMenuPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(DropdownMenuPrimitive);
36
36
  const yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(yup);
37
37
  const ModalProvider = ({ children }) => {
38
38
  const [modalRootContainerRef, setModalRootContainerRef] = React.useState(
@@ -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,170 +905,690 @@ 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
- 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
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);
1021
+ }
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
+ });
1047
+ }
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
+ }
1155
+ }
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");
1170
+ }
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
+ }
1178
+ }
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
+ }
1185
+ }
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
+ }
1194
+ return /* @__PURE__ */ React.createElement(
1195
+ "div",
1196
+ {
1197
+ ...attributes,
1198
+ className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
1199
+ },
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,
1207
+ {
1208
+ items: items2,
1209
+ value: currentItem,
1210
+ defaultQuery: "plaintext",
1211
+ onChange: (item) => plateCommon.setNodes(editor, { lang: item.key })
1212
+ }
1213
+ )), /* @__PURE__ */ React.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React.createElement(
1214
+ MonacoEditor,
1215
+ {
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
+ }
1251
+ }
1252
+ )))
1253
+ );
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,
1261
+ {
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.run();
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, { suppressErrors: false })) {
1368
+ setMermaidError(null);
1369
+ }
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,
1378
+ {
1379
+ className: "w-5 h-5 fill-white cursor-pointer",
1380
+ onClick: () => {
1381
+ setIsEditing(!isEditing);
1382
+ }
1383
+ }
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,
1394
+ {
1395
+ children: "",
1396
+ language: "yaml",
1397
+ ...props,
1398
+ element: node,
1399
+ defaultValue: mermaidConfig,
1400
+ onChangeCallback: (value) => setMermaidConfig(value)
1401
+ }
1402
+ ) : /* @__PURE__ */ React.createElement(MermaidElementWithRef, { config: mermaidConfig })), children, /* @__PURE__ */ React.createElement(ErrorMsg, { error: mermaidError }));
1403
+ }
1404
+ );
1405
+ const RawMarkdown = () => {
1406
+ return /* @__PURE__ */ React.createElement(
1407
+ "svg",
1408
+ {
1409
+ stroke: "currentColor",
1410
+ fill: "currentColor",
1411
+ strokeWidth: 0,
1412
+ role: "img",
1413
+ className: "h-5 w-5",
1414
+ viewBox: "0 0 24 24",
1415
+ height: "1em",
1416
+ width: "1em",
1417
+ xmlns: "http://www.w3.org/2000/svg"
1418
+ },
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" })
1421
+ );
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",
1439
+ {
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
+ )
1445
+ );
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"
1535
+ },
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"
1560
+ }
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",
1575
+ {
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
1058
1592
  },
1059
1593
  /* @__PURE__ */ React.createElement(
1060
1594
  "path",
@@ -1149,6 +1683,7 @@ var __publicField = (obj, key, value) => {
1149
1683
  clear: lucideReact.X,
1150
1684
  close: lucideReact.X,
1151
1685
  // code: Code2,
1686
+ paint: lucideReact.PaintBucket,
1152
1687
  codeblock: lucideReact.FileCode,
1153
1688
  color: lucideReact.Baseline,
1154
1689
  column: lucideReact.RectangleVertical,
@@ -1174,6 +1709,7 @@ var __publicField = (obj, key, value) => {
1174
1709
  lineHeight: lucideReact.WrapText,
1175
1710
  // link: Link2,
1176
1711
  minus: lucideReact.Minus,
1712
+ mermaid: MermaidIcon,
1177
1713
  more: lucideReact.MoreHorizontal,
1178
1714
  // ol: ListOrdered,
1179
1715
  outdent: lucideReact.Outdent,
@@ -1548,7 +2084,7 @@ var __publicField = (obj, key, value) => {
1548
2084
  setHasEmpty
1549
2085
  ]
1550
2086
  );
1551
- const store = react.useComboboxStore({
2087
+ const store = react$1.useComboboxStore({
1552
2088
  setValue: (newValue) => React.startTransition(() => setValue(newValue))
1553
2089
  });
1554
2090
  const items2 = store.useState("items");
@@ -1558,7 +2094,7 @@ var __publicField = (obj, key, value) => {
1558
2094
  }
1559
2095
  }, [items2, store]);
1560
2096
  return /* @__PURE__ */ React.createElement("span", { contentEditable: false }, /* @__PURE__ */ React.createElement(
1561
- react.ComboboxProvider,
2097
+ react$1.ComboboxProvider,
1562
2098
  {
1563
2099
  open: (items2.length > 0 || hasEmpty) && (!hideWhenNoValue || value.length > 0),
1564
2100
  store
@@ -1573,7 +2109,7 @@ var __publicField = (obj, key, value) => {
1573
2109
  showTrigger,
1574
2110
  trigger
1575
2111
  } = React.useContext(InlineComboboxContext);
1576
- const store = react.useComboboxContext();
2112
+ const store = react$1.useComboboxContext();
1577
2113
  const value = store.useState("value");
1578
2114
  const ref = plateCommon.useComposedRef(propRef, contextRef);
1579
2115
  return /* @__PURE__ */ React.createElement(React.Fragment, null, showTrigger && trigger, /* @__PURE__ */ React.createElement("span", { className: "relative min-h-[1lh]" }, /* @__PURE__ */ React.createElement(
@@ -1584,7 +2120,7 @@ var __publicField = (obj, key, value) => {
1584
2120
  },
1585
2121
  value || "​"
1586
2122
  ), /* @__PURE__ */ React.createElement(
1587
- react.Combobox,
2123
+ react$1.Combobox,
1588
2124
  {
1589
2125
  autoSelect: true,
1590
2126
  className: cn$1.cn(
@@ -1603,8 +2139,8 @@ var __publicField = (obj, key, value) => {
1603
2139
  className,
1604
2140
  ...props
1605
2141
  }) => {
1606
- return /* @__PURE__ */ React.createElement(react.Portal, null, /* @__PURE__ */ React.createElement(
1607
- react.ComboboxPopover,
2142
+ return /* @__PURE__ */ React.createElement(react$1.Portal, null, /* @__PURE__ */ React.createElement(
2143
+ react$1.ComboboxPopover,
1608
2144
  {
1609
2145
  className: cn$1.cn(
1610
2146
  "z-[9999999] max-h-[288px] w-[300px] overflow-y-auto rounded-md bg-white shadow-md",
@@ -1636,7 +2172,7 @@ var __publicField = (obj, key, value) => {
1636
2172
  }) => {
1637
2173
  const { value } = props;
1638
2174
  const { filter, removeInput } = React.useContext(InlineComboboxContext);
1639
- const store = react.useComboboxContext();
2175
+ const store = react$1.useComboboxContext();
1640
2176
  const search = filter && store.useState("value");
1641
2177
  const visible = React.useMemo(
1642
2178
  () => !filter || filter({ keywords, value }, search),
@@ -1645,7 +2181,7 @@ var __publicField = (obj, key, value) => {
1645
2181
  if (!visible)
1646
2182
  return null;
1647
2183
  return /* @__PURE__ */ React.createElement(
1648
- react.ComboboxItem,
2184
+ react$1.ComboboxItem,
1649
2185
  {
1650
2186
  className: cn$1.cn(comboboxItemVariants(), className),
1651
2187
  onClick: (event) => {
@@ -1661,7 +2197,7 @@ var __publicField = (obj, key, value) => {
1661
2197
  className
1662
2198
  }) => {
1663
2199
  const { setHasEmpty } = React.useContext(InlineComboboxContext);
1664
- const store = react.useComboboxContext();
2200
+ const store = react$1.useComboboxContext();
1665
2201
  const items2 = store.useState("items");
1666
2202
  React.useEffect(() => {
1667
2203
  setHasEmpty(true);
@@ -1744,417 +2280,482 @@ var __publicField = (obj, key, value) => {
1744
2280
  );
1745
2281
  }
1746
2282
  );
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,
1768
- {
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,
1782
- {
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
- }));
1815
- }
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]);
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";
1836
2306
  return /* @__PURE__ */ React.createElement(
1837
- react$1.Combobox,
1838
- {
1839
- value,
1840
- onChange,
1841
- as: "div",
1842
- className: "relative inline-block text-left z-20"
1843
- },
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,
1846
- {
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()
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
1851
2334
  }
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,
2335
+ },
2336
+ /* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(
2337
+ "div",
1854
2338
  {
1855
- className: "h-5 w-5 text-gray-400",
1856
- "aria-hidden": "true"
1857
- }
1858
- )))),
1859
- /* @__PURE__ */ React.createElement(
1860
- react$1.Transition,
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",
1861
2347
  {
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"
2348
+ className: "group absolute top-0 size-full select-none",
2349
+ contentEditable: false,
2350
+ suppressContentEditableWarning: true
1868
2351
  },
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",
2352
+ !readOnly && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
2353
+ plateResizable.ResizeHandle,
1871
2354
  {
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"
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]"
1875
2376
  )
1876
- },
1877
- item.render(item)
1878
- ))))
1879
- )
1880
- );
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);
1895
- }
1896
- }
1897
- };
1898
- const CodeBlock = ({
1899
- attributes,
1900
- editor,
1901
- element,
1902
- language: restrictLanguage,
1903
- ...props
1904
- }) => {
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
2377
  }
2047
- }
2048
- }
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");
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
+ )
2066
2385
  }
2386
+ ))
2387
+ ))
2388
+ );
2389
+ });
2390
+ TableCellElement.displayName = "TableCellElement";
2391
+ const TableCellHeaderElement = cn$1.withProps(TableCellElement, {
2392
+ isHeader: true
2393
+ });
2394
+ const buttonVariants$1 = classVarianceAuthority.cva(
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",
2396
+ {
2397
+ defaultVariants: {
2398
+ size: "default",
2399
+ variant: "default"
2400
+ },
2401
+ variants: {
2402
+ isMenu: {
2403
+ true: "h-auto w-full cursor-pointer justify-start"
2404
+ },
2405
+ size: {
2406
+ default: "h-10 px-4 py-2",
2407
+ icon: "size-10",
2408
+ lg: "h-11 rounded-md px-8",
2409
+ none: "",
2410
+ sm: "h-9 rounded-md px-3",
2411
+ sms: "size-9 rounded-md px-0",
2412
+ xs: "h-8 rounded-md px-3"
2413
+ },
2414
+ variant: {
2415
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
2416
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
2417
+ ghost: "hover:bg-accent hover:text-accent-foreground",
2418
+ inlineLink: "text-base text-primary underline underline-offset-4",
2419
+ link: "text-primary underline-offset-4 hover:underline",
2420
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
2421
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
2067
2422
  }
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
- }
2423
+ }
2424
+ }
2425
+ );
2426
+ const Button$2 = cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
2427
+ const Comp = asChild ? reactSlot.Slot : "button";
2428
+ return /* @__PURE__ */ React__namespace.createElement(
2429
+ Comp,
2430
+ {
2431
+ className: cn$1.cn(buttonVariants$1({ className, isMenu, size, variant })),
2432
+ ref,
2433
+ ...props
2434
+ }
2435
+ );
2436
+ });
2437
+ const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
2438
+ const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
2439
+ const DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
2440
+ const DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
2441
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
2442
+ const DropdownMenuSubTrigger = cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
2443
+ DropdownMenuPrimitive__namespace.SubTrigger,
2444
+ {
2445
+ className: cn$1.cn(
2446
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
2447
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2448
+ inset && "pl-8",
2449
+ className
2450
+ ),
2451
+ ref,
2452
+ ...props
2453
+ },
2454
+ children,
2455
+ /* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
2456
+ ));
2457
+ const DropdownMenuSubContent = cn$1.withCn(
2458
+ DropdownMenuPrimitive__namespace.SubContent,
2459
+ "z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
2460
+ );
2461
+ const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
2462
+ className: cn$1.cn(
2463
+ "z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
2464
+ ),
2465
+ sideOffset: 4
2466
+ });
2467
+ const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
2468
+ const menuItemVariants = classVarianceAuthority.cva(
2469
+ cn$1.cn(
2470
+ "relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
2471
+ "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
2472
+ ),
2473
+ {
2474
+ variants: {
2475
+ inset: {
2476
+ true: "pl-8"
2074
2477
  }
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
- }
2478
+ }
2479
+ }
2480
+ );
2481
+ const DropdownMenuItem = cn$1.withVariants(
2482
+ DropdownMenuPrimitive__namespace.Item,
2483
+ menuItemVariants,
2484
+ ["inset"]
2485
+ );
2486
+ const DropdownMenuCheckboxItem = cn$1.withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React.createElement(
2487
+ DropdownMenuPrimitive__namespace.CheckboxItem,
2488
+ {
2489
+ className: cn$1.cn(
2490
+ "relative flex select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2491
+ "cursor-pointer",
2492
+ className
2493
+ ),
2494
+ ref,
2495
+ ...props
2496
+ },
2497
+ /* @__PURE__ */ React.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
2498
+ children
2499
+ ));
2500
+ const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
2501
+ DropdownMenuPrimitive__namespace.RadioItem,
2502
+ {
2503
+ className: cn$1.cn(
2504
+ "relative flex select-none items-center rounded-sm pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2505
+ "h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
2506
+ className
2507
+ ),
2508
+ ref,
2509
+ ...props
2510
+ },
2511
+ !hideIcon && /* @__PURE__ */ React.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
2512
+ children
2513
+ ));
2514
+ const dropdownMenuLabelVariants = classVarianceAuthority.cva(
2515
+ cn$1.cn("select-none px-2 py-1.5 text-sm font-semibold"),
2516
+ {
2517
+ variants: {
2518
+ inset: {
2519
+ true: "pl-8"
2080
2520
  }
2081
- });
2521
+ }
2522
+ }
2523
+ );
2524
+ const DropdownMenuLabel = cn$1.withVariants(
2525
+ DropdownMenuPrimitive__namespace.Label,
2526
+ dropdownMenuLabelVariants,
2527
+ ["inset"]
2528
+ );
2529
+ const DropdownMenuSeparator = cn$1.withCn(
2530
+ DropdownMenuPrimitive__namespace.Separator,
2531
+ "-mx-1 my-1 h-px bg-muted"
2532
+ );
2533
+ cn$1.withCn(
2534
+ cn$1.createPrimitiveElement("span"),
2535
+ "ml-auto text-xs tracking-widest opacity-60"
2536
+ );
2537
+ const useOpenState = () => {
2538
+ const [open2, setOpen] = React.useState(false);
2539
+ const onOpenChange = React.useCallback(
2540
+ (_value = !open2) => {
2541
+ setOpen(_value);
2542
+ },
2543
+ [open2]
2544
+ );
2545
+ return {
2546
+ onOpenChange,
2547
+ open: open2
2548
+ };
2549
+ };
2550
+ const Popover$2 = PopoverPrimitive__namespace.Root;
2551
+ const popoverVariants = classVarianceAuthority.cva(
2552
+ "w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 print:hidden"
2553
+ );
2554
+ const PopoverContent$1 = cn$1.withRef(
2555
+ ({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
2556
+ PopoverPrimitive__namespace.Content,
2557
+ {
2558
+ align,
2559
+ className: cn$1.cn(popoverVariants(), className),
2560
+ ref,
2561
+ sideOffset,
2562
+ style: { zIndex: 1e3, ...style },
2563
+ ...props
2564
+ }
2565
+ ))
2566
+ );
2567
+ const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
2568
+ defaultVariants: {
2569
+ orientation: "horizontal"
2570
+ },
2571
+ variants: {
2572
+ orientation: {
2573
+ horizontal: "h-px w-full",
2574
+ vertical: "h-full w-px"
2575
+ }
2082
2576
  }
2577
+ });
2578
+ const Separator = cn$1.withVariants(
2579
+ cn$1.withProps(SeparatorPrimitive__namespace.Root, {
2580
+ decorative: true,
2581
+ orientation: "horizontal"
2582
+ }),
2583
+ separatorVariants
2584
+ );
2585
+ const TableBordersDropdownMenuContent = cn$1.withRef((props, ref) => {
2586
+ const {
2587
+ getOnSelectTableBorder,
2588
+ hasBottomBorder,
2589
+ hasLeftBorder,
2590
+ hasNoBorders,
2591
+ hasOuterBorders,
2592
+ hasRightBorder,
2593
+ hasTopBorder
2594
+ } = plateTable.useTableBordersDropdownMenuContentState();
2083
2595
  return /* @__PURE__ */ React.createElement(
2084
- "div",
2596
+ DropdownMenuContent,
2085
2597
  {
2086
- ...attributes,
2087
- className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
2598
+ align: "start",
2599
+ className: cn$1.cn("min-w-[220px]"),
2600
+ ref,
2601
+ side: "right",
2602
+ sideOffset: 0,
2603
+ ...props
2088
2604
  },
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,
2605
+ /* @__PURE__ */ React.createElement(
2606
+ DropdownMenuCheckboxItem,
2096
2607
  {
2097
- items: items2,
2098
- value: currentItem,
2099
- defaultQuery: "plaintext",
2100
- onChange: (item) => plateCommon.setNodes(editor, { lang: item.key })
2101
- }
2102
- )), /* @__PURE__ */ React.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React.createElement(
2103
- MonacoEditor,
2608
+ checked: hasBottomBorder,
2609
+ onCheckedChange: getOnSelectTableBorder("bottom")
2610
+ },
2611
+ /* @__PURE__ */ React.createElement(Icons.borderBottom, { className: iconVariants({ size: "sm" }) }),
2612
+ /* @__PURE__ */ React.createElement("div", null, "Bottom Border")
2613
+ ),
2614
+ /* @__PURE__ */ React.createElement(
2615
+ DropdownMenuCheckboxItem,
2104
2616
  {
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 });
2138
- }
2139
- }
2140
- )))
2617
+ checked: hasTopBorder,
2618
+ onCheckedChange: getOnSelectTableBorder("top")
2619
+ },
2620
+ /* @__PURE__ */ React.createElement(Icons.borderTop, { className: iconVariants({ size: "sm" }) }),
2621
+ /* @__PURE__ */ React.createElement("div", null, "Top Border")
2622
+ ),
2623
+ /* @__PURE__ */ React.createElement(
2624
+ DropdownMenuCheckboxItem,
2625
+ {
2626
+ checked: hasLeftBorder,
2627
+ onCheckedChange: getOnSelectTableBorder("left")
2628
+ },
2629
+ /* @__PURE__ */ React.createElement(Icons.borderLeft, { className: iconVariants({ size: "sm" }) }),
2630
+ /* @__PURE__ */ React.createElement("div", null, "Left Border")
2631
+ ),
2632
+ /* @__PURE__ */ React.createElement(
2633
+ DropdownMenuCheckboxItem,
2634
+ {
2635
+ checked: hasRightBorder,
2636
+ onCheckedChange: getOnSelectTableBorder("right")
2637
+ },
2638
+ /* @__PURE__ */ React.createElement(Icons.borderRight, { className: iconVariants({ size: "sm" }) }),
2639
+ /* @__PURE__ */ React.createElement("div", null, "Right Border")
2640
+ ),
2641
+ /* @__PURE__ */ React.createElement(Separator, null),
2642
+ /* @__PURE__ */ React.createElement(
2643
+ DropdownMenuCheckboxItem,
2644
+ {
2645
+ checked: hasNoBorders,
2646
+ onCheckedChange: getOnSelectTableBorder("none")
2647
+ },
2648
+ /* @__PURE__ */ React.createElement(Icons.borderNone, { className: iconVariants({ size: "sm" }) }),
2649
+ /* @__PURE__ */ React.createElement("div", null, "No Border")
2650
+ ),
2651
+ /* @__PURE__ */ React.createElement(
2652
+ DropdownMenuCheckboxItem,
2653
+ {
2654
+ checked: hasOuterBorders,
2655
+ onCheckedChange: getOnSelectTableBorder("outer")
2656
+ },
2657
+ /* @__PURE__ */ React.createElement(Icons.borderAll, { className: iconVariants({ size: "sm" }) }),
2658
+ /* @__PURE__ */ React.createElement("div", null, "Outside Borders")
2659
+ )
2141
2660
  );
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,
2661
+ });
2662
+ const TableFloatingToolbar = cn$1.withRef(
2663
+ ({ children, ...props }, ref) => {
2664
+ const element = plateCommon.useElement();
2665
+ const { props: buttonProps } = plateCommon.useRemoveNodeButton({ element });
2666
+ const selectionCollapsed = plateCommon.useEditorSelector(
2667
+ (editor2) => !plateCommon.isSelectionExpanded(editor2),
2668
+ []
2669
+ );
2670
+ const readOnly = slateReact.useReadOnly();
2671
+ const selected = slateReact.useSelected();
2672
+ const editor = plateCommon.useEditorRef();
2673
+ const collapsed = !readOnly && selected && selectionCollapsed;
2674
+ const open2 = !readOnly && selected;
2675
+ const { canMerge, canUnmerge } = plateTable.useTableMergeState();
2676
+ const mergeContent = canMerge && /* @__PURE__ */ React.createElement(
2677
+ Button$2,
2149
2678
  {
2150
- className: cn$1.cn("relative py-1", state.className, className),
2679
+ contentEditable: false,
2680
+ isMenu: true,
2681
+ onClick: () => plateTable.mergeTableCells(editor),
2682
+ variant: "ghost"
2683
+ },
2684
+ /* @__PURE__ */ React.createElement(Icons.combine, { className: "mr-2 size-4" }),
2685
+ "Merge"
2686
+ );
2687
+ const unmergeButton = canUnmerge && /* @__PURE__ */ React.createElement(
2688
+ Button$2,
2689
+ {
2690
+ contentEditable: false,
2691
+ isMenu: true,
2692
+ onClick: () => plateTable.unmergeTableCells(editor),
2693
+ variant: "ghost"
2694
+ },
2695
+ /* @__PURE__ */ React.createElement(Icons.ungroup, { className: "mr-2 size-4" }),
2696
+ "Unmerge"
2697
+ );
2698
+ const bordersContent = collapsed && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(Button$2, { isMenu: true, variant: "ghost" }, /* @__PURE__ */ React.createElement(Icons.borderAll, { className: "mr-2 size-4" }), "Borders")), /* @__PURE__ */ React.createElement(DropdownMenuPortal, null, /* @__PURE__ */ React.createElement(TableBordersDropdownMenuContent, null))), /* @__PURE__ */ React.createElement(Button$2, { contentEditable: false, isMenu: true, variant: "ghost", ...buttonProps }, /* @__PURE__ */ React.createElement(Icons.delete, { className: "mr-2 size-4" }), "Delete"));
2699
+ return /* @__PURE__ */ React.createElement(Popover$2, { modal: false, open: open2 }, /* @__PURE__ */ React.createElement(PopoverPrimitive.PopoverAnchor, { asChild: true }, children), (canMerge || canUnmerge || collapsed) && /* @__PURE__ */ React.createElement(
2700
+ PopoverContent$1,
2701
+ {
2702
+ className: cn$1.cn(
2703
+ popoverVariants(),
2704
+ "flex w-[220px] flex-col gap-1 p-1"
2705
+ ),
2706
+ onOpenAutoFocus: (e) => e.preventDefault(),
2151
2707
  ref,
2152
2708
  ...props
2153
2709
  },
2154
- /* @__PURE__ */ React.createElement(CodeBlock, { ...props })
2155
- );
2710
+ unmergeButton,
2711
+ mergeContent,
2712
+ bordersContent
2713
+ ));
2156
2714
  }
2157
2715
  );
2716
+ const TableElement = plateCommon.withHOC(
2717
+ plateTable.TableProvider,
2718
+ cn$1.withRef(({ children, className, ...props }, ref) => {
2719
+ const { colSizes, isSelectingCell, marginLeft, minColumnWidth } = plateTable.useTableElementState();
2720
+ const { colGroupProps, props: tableProps } = plateTable.useTableElement();
2721
+ return /* @__PURE__ */ React.createElement(TableFloatingToolbar, null, /* @__PURE__ */ React.createElement("div", { style: { paddingLeft: marginLeft } }, /* @__PURE__ */ React.createElement(
2722
+ plateCommon.PlateElement,
2723
+ {
2724
+ asChild: true,
2725
+ className: cn$1.cn(
2726
+ "my-4 ml-px mr-0 table h-px w-full table-fixed border-collapse",
2727
+ isSelectingCell && "[&_*::selection]:bg-none",
2728
+ className
2729
+ ),
2730
+ ref,
2731
+ ...tableProps,
2732
+ ...props
2733
+ },
2734
+ /* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("colgroup", { ...colGroupProps }, colSizes.map((width, index) => /* @__PURE__ */ React.createElement(
2735
+ "col",
2736
+ {
2737
+ key: index,
2738
+ style: {
2739
+ minWidth: minColumnWidth,
2740
+ width: width || void 0
2741
+ }
2742
+ }
2743
+ ))), /* @__PURE__ */ React.createElement("tbody", { className: "min-w-full" }, children))
2744
+ )));
2745
+ })
2746
+ );
2747
+ const TableRowElement = cn$1.withRef(({ children, hideBorder, ...props }, ref) => {
2748
+ return /* @__PURE__ */ React.createElement(
2749
+ plateCommon.PlateElement,
2750
+ {
2751
+ asChild: true,
2752
+ className: cn$1.cn("h-full", hideBorder && "border-none"),
2753
+ ref,
2754
+ ...props
2755
+ },
2756
+ /* @__PURE__ */ React.createElement("tr", null, children)
2757
+ );
2758
+ });
2158
2759
  const blockClasses = "mt-0.5";
2159
2760
  const headerClasses = "font-normal";
2160
2761
  const Components = () => {
@@ -2260,6 +2861,7 @@ var __publicField = (obj, key, value) => {
2260
2861
  }
2261
2862
  )
2262
2863
  ),
2864
+ [ELEMENT_MERMAID]: MermaidElement,
2263
2865
  [plate.ELEMENT_BLOCKQUOTE]: BlockquoteElement,
2264
2866
  [plate.ELEMENT_CODE_BLOCK]: CodeBlockElement,
2265
2867
  [plate.ELEMENT_CODE_LINE]: CodeLineElement,
@@ -2340,7 +2942,11 @@ var __publicField = (obj, key, value) => {
2340
2942
  children,
2341
2943
  selected && /* @__PURE__ */ React.createElement("span", { className: "absolute h-4 -top-2 inset-0 ring-2 ring-blue-100 ring-inset rounded-md z-10 pointer-events-none" })
2342
2944
  );
2343
- }
2945
+ },
2946
+ [plate.ELEMENT_TABLE]: TableElement,
2947
+ [plate.ELEMENT_TR]: TableRowElement,
2948
+ [plate.ELEMENT_TD]: TableCellElement,
2949
+ [plate.ELEMENT_TH]: TableCellHeaderElement
2344
2950
  };
2345
2951
  };
2346
2952
  const createCodeBlockPlugin = plateCommon.createPluginFactory({
@@ -2750,7 +3356,9 @@ var __publicField = (obj, key, value) => {
2750
3356
  {
2751
3357
  type: "string",
2752
3358
  label: "Caption",
2753
- name: [templateName.replace(/\.props$/, ""), "caption"].join("."),
3359
+ name: [templateName.replace(/\.props$/, ""), "caption"].join(
3360
+ "."
3361
+ ),
2754
3362
  component: "text"
2755
3363
  }
2756
3364
  ]
@@ -4410,7 +5018,7 @@ var __publicField = (obj, key, value) => {
4410
5018
  function cn(...inputs) {
4411
5019
  return tailwindMerge.twMerge(clsx.clsx(inputs));
4412
5020
  }
4413
- const buttonVariants$1 = classVarianceAuthority.cva(
5021
+ const buttonVariants = classVarianceAuthority.cva(
4414
5022
  "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",
4415
5023
  {
4416
5024
  variants: {
@@ -4436,7 +5044,7 @@ var __publicField = (obj, key, value) => {
4436
5044
  return /* @__PURE__ */ React__namespace.createElement(
4437
5045
  Comp,
4438
5046
  {
4439
- className: cn(buttonVariants$1({ variant, size, className })),
5047
+ className: cn(buttonVariants({ variant, size, className })),
4440
5048
  ref,
4441
5049
  ...props
4442
5050
  }
@@ -4605,6 +5213,10 @@ var __publicField = (obj, key, value) => {
4605
5213
  edges: response.collection.documents.edges
4606
5214
  };
4607
5215
  } catch (e) {
5216
+ console.error(
5217
+ "Exception thrown while building and running GraphQL query: ",
5218
+ e
5219
+ );
4608
5220
  return {
4609
5221
  collection,
4610
5222
  edges: []
@@ -5131,7 +5743,7 @@ var __publicField = (obj, key, value) => {
5131
5743
  return template.label ? template.label.toLowerCase().includes(filter.toLowerCase()) || name.toLowerCase().includes(filter.toLowerCase()) : name.toLowerCase().includes(filter.toLowerCase());
5132
5744
  });
5133
5745
  }, [filter]);
5134
- 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(
5135
5747
  IconButton,
5136
5748
  {
5137
5749
  variant: open2 ? "secondary" : "primary",
@@ -5140,7 +5752,7 @@ var __publicField = (obj, key, value) => {
5140
5752
  },
5141
5753
  /* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
5142
5754
  )), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute -bottom-1 right-0 z-50" }, /* @__PURE__ */ React__namespace.createElement(
5143
- react$1.Transition,
5755
+ react.Transition,
5144
5756
  {
5145
5757
  enter: "transition duration-150 ease-out",
5146
5758
  enterFrom: "transform opacity-0 -translate-y-2",
@@ -5149,7 +5761,7 @@ var __publicField = (obj, key, value) => {
5149
5761
  leaveFrom: "transform opacity-100 translate-y-0",
5150
5762
  leaveTo: "transform opacity-0 -translate-y-2"
5151
5763
  },
5152
- /* @__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(
5153
5765
  "input",
5154
5766
  {
5155
5767
  type: "text",
@@ -5326,8 +5938,8 @@ var __publicField = (obj, key, value) => {
5326
5938
  onClick: () => setPickerIsOpen(!pickerIsOpen)
5327
5939
  },
5328
5940
  /* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
5329
- ), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react$1.Transition, { show: pickerIsOpen }, /* @__PURE__ */ React__namespace.createElement(
5330
- 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,
5331
5943
  {
5332
5944
  enter: "transform transition-all ease-out duration-200",
5333
5945
  enterFrom: "opacity-0 -translate-x-1/2",
@@ -5414,14 +6026,14 @@ var __publicField = (obj, key, value) => {
5414
6026
  };
5415
6027
  const BlockGroup = ({ category, templates, close: close2, isLast = false }) => {
5416
6028
  return /* @__PURE__ */ React__namespace.createElement(
5417
- react$1.Disclosure,
6029
+ react.Disclosure,
5418
6030
  {
5419
6031
  defaultOpen: true,
5420
6032
  as: "div",
5421
6033
  className: `left-0 right-0 relative`
5422
6034
  },
5423
6035
  ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
5424
- react$1.DisclosureButton,
6036
+ react.DisclosureButton,
5425
6037
  {
5426
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`}`
5427
6039
  },
@@ -5439,7 +6051,7 @@ var __publicField = (obj, key, value) => {
5439
6051
  }
5440
6052
  )
5441
6053
  ), /* @__PURE__ */ React__namespace.createElement(
5442
- react$1.Transition,
6054
+ react.Transition,
5443
6055
  {
5444
6056
  enter: "transition duration-100 ease-out",
5445
6057
  enterFrom: "transform scale-95 opacity-0",
@@ -5448,7 +6060,7 @@ var __publicField = (obj, key, value) => {
5448
6060
  leaveFrom: "transform scale-100 opacity-100",
5449
6061
  leaveTo: "transform scale-95 opacity-0"
5450
6062
  },
5451
- /* @__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(
5452
6064
  BlockCard,
5453
6065
  {
5454
6066
  key: index,
@@ -9267,7 +9879,7 @@ var __publicField = (obj, key, value) => {
9267
9879
  const FormLists = (props) => {
9268
9880
  const cms = useCMS();
9269
9881
  return /* @__PURE__ */ React__namespace.createElement(
9270
- react$1.Transition,
9882
+ react.Transition,
9271
9883
  {
9272
9884
  appear: true,
9273
9885
  show: true,
@@ -9696,7 +10308,7 @@ var __publicField = (obj, key, value) => {
9696
10308
  "Event Log"
9697
10309
  ));
9698
10310
  };
9699
- const version = "2.2.8";
10311
+ const version = "2.2.9";
9700
10312
  const Nav = ({
9701
10313
  isLocalMode,
9702
10314
  className = "",
@@ -9750,8 +10362,8 @@ var __publicField = (obj, key, value) => {
9750
10362
  style: { maxWidth: `${sidebarWidth}px` },
9751
10363
  ...props
9752
10364
  },
9753
- /* @__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(
9754
- 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,
9755
10367
  {
9756
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"}`
9757
10369
  },
@@ -9774,7 +10386,7 @@ var __publicField = (obj, key, value) => {
9774
10386
  }
9775
10387
  )
9776
10388
  ), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute bottom-3 right-5 z-50" }, /* @__PURE__ */ React__namespace.createElement(
9777
- react$1.Transition,
10389
+ react.Transition,
9778
10390
  {
9779
10391
  enter: "transition duration-150 ease-out",
9780
10392
  enterFrom: "transform opacity-0 -translate-y-2",
@@ -9783,7 +10395,7 @@ var __publicField = (obj, key, value) => {
9783
10395
  leaveFrom: "transform opacity-100 translate-y-0",
9784
10396
  leaveTo: "transform opacity-0 -translate-y-2"
9785
10397
  },
9786
- /* @__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(
9787
10399
  "button",
9788
10400
  {
9789
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`,
@@ -9816,7 +10428,7 @@ var __publicField = (obj, key, value) => {
9816
10428
  },
9817
10429
  /* @__PURE__ */ React__namespace.createElement(BiExit, { className: "w-6 h-auto mr-2 text-blue-400" }),
9818
10430
  " Log Out"
9819
- )), /* @__PURE__ */ React__namespace.createElement(react$1.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
10431
+ )), /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
9820
10432
  WrappedSyncStatus,
9821
10433
  {
9822
10434
  cms,
@@ -10162,8 +10774,8 @@ var __publicField = (obj, key, value) => {
10162
10774
  screen: activeScreen,
10163
10775
  close: () => setActiveView(null)
10164
10776
  }
10165
- )), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react$1.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
10166
- 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,
10167
10779
  {
10168
10780
  enter: "transform transition-all ease-out duration-300",
10169
10781
  enterFrom: "opacity-0 -translate-x-full",
@@ -10228,7 +10840,7 @@ var __publicField = (obj, key, value) => {
10228
10840
  ))
10229
10841
  ))
10230
10842
  ), /* @__PURE__ */ React__namespace.createElement(
10231
- react$1.TransitionChild,
10843
+ react.TransitionChild,
10232
10844
  {
10233
10845
  enter: "ease-out duration-300",
10234
10846
  enterFrom: "opacity-0",
@@ -12763,15 +13375,15 @@ var __publicField = (obj, key, value) => {
12763
13375
  );
12764
13376
  };
12765
13377
  const DotMenu = ({ onOpen, onRemove }) => {
12766
- return /* @__PURE__ */ React.createElement(react$1.Popover, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React.createElement(
12767
- react$1.PopoverButton,
13378
+ return /* @__PURE__ */ React.createElement(react.Popover, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React.createElement(
13379
+ react.PopoverButton,
12768
13380
  {
12769
13381
  as: "span",
12770
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"
12771
13383
  },
12772
13384
  /* @__PURE__ */ React.createElement(EllipsisIcon, { title: "Open options" })
12773
13385
  ), /* @__PURE__ */ React.createElement(
12774
- react$1.Transition,
13386
+ react.Transition,
12775
13387
  {
12776
13388
  enter: "transition ease-out duration-100",
12777
13389
  enterFrom: "transform opacity-0 scale-95",
@@ -12780,7 +13392,7 @@ var __publicField = (obj, key, value) => {
12780
13392
  leaveFrom: "transform opacity-100 scale-100",
12781
13393
  leaveTo: "transform opacity-0 scale-95"
12782
13394
  },
12783
- /* @__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(
12784
13396
  "span",
12785
13397
  {
12786
13398
  onClick: onOpen,
@@ -13203,13 +13815,25 @@ var __publicField = (obj, key, value) => {
13203
13815
  plate.createUnderlinePlugin(),
13204
13816
  plate.createCodePlugin(),
13205
13817
  plate.createListPlugin(),
13206
- plate.createIndentPlugin(),
13207
13818
  plate.createIndentListPlugin(),
13208
13819
  plate.createHorizontalRulePlugin(),
13209
13820
  // Allows us to do things like copy/paste, remembering the state of the element (like mdx)
13210
13821
  plate.createNodeIdPlugin(),
13211
- plateSlashCommand.createSlashPlugin()
13822
+ plateSlashCommand.createSlashPlugin(),
13823
+ plate.createTablePlugin()
13212
13824
  ];
13825
+ const unsupportedItemsInTable = /* @__PURE__ */ new Set([
13826
+ "Code Block",
13827
+ "Unordered List",
13828
+ "Ordered List",
13829
+ "Quote",
13830
+ "Heading 1",
13831
+ "Heading 2",
13832
+ "Heading 3",
13833
+ "Heading 4",
13834
+ "Heading 5",
13835
+ "Heading 6"
13836
+ ]);
13213
13837
  const isNodeActive = (editor, type) => {
13214
13838
  const pluginType = plateCommon.getPluginType(editor, type);
13215
13839
  return !!(editor == null ? void 0 : editor.selection) && plateCommon.someNode(editor, { match: { type: pluginType } });
@@ -13394,24 +14018,6 @@ var __publicField = (obj, key, value) => {
13394
14018
  }
13395
14019
  );
13396
14020
  Editor.displayName = "Editor";
13397
- const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
13398
- defaultVariants: {
13399
- orientation: "horizontal"
13400
- },
13401
- variants: {
13402
- orientation: {
13403
- horizontal: "h-px w-full",
13404
- vertical: "h-full w-px"
13405
- }
13406
- }
13407
- });
13408
- const Separator = cn$1.withVariants(
13409
- cn$1.withProps(SeparatorPrimitive__namespace.Root, {
13410
- decorative: true,
13411
- orientation: "horizontal"
13412
- }),
13413
- separatorVariants
13414
- );
13415
14021
  const TooltipProvider = TooltipPrimitive__namespace.Provider;
13416
14022
  const Tooltip = TooltipPrimitive__namespace.Root;
13417
14023
  const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
@@ -13420,7 +14026,7 @@ var __publicField = (obj, key, value) => {
13420
14026
  cn$1.withProps(TooltipPrimitive__namespace.Content, {
13421
14027
  sideOffset: 4
13422
14028
  }),
13423
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
14029
+ "z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
13424
14030
  );
13425
14031
  function withTooltip(Component) {
13426
14032
  return React.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
@@ -13546,140 +14152,41 @@ var __publicField = (obj, key, value) => {
13546
14152
  Toolbar,
13547
14153
  "p-1 sticky left-0 top-0 z-50 w-full justify-between overflow-x-auto border border-border bg-background"
13548
14154
  );
13549
- const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
13550
- const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
13551
- const { props } = plateCommon.useMarkToolbarButton(state);
13552
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
13553
- });
13554
- const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
13555
- const editor = plateCommon.useEditorState();
13556
- const state = plate.useListToolbarButtonState({ nodeType });
13557
- const { props } = plate.useListToolbarButton(state);
13558
- return /* @__PURE__ */ React.createElement(
13559
- ToolbarButton,
13560
- {
13561
- ref,
13562
- tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
13563
- ...props,
13564
- onClick: (e) => {
13565
- e.preventDefault();
13566
- e.stopPropagation();
13567
- plate.toggleList(editor, { type: nodeType });
13568
- }
13569
- },
13570
- nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
13571
- );
13572
- });
13573
- const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
13574
- const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
13575
- const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
13576
- cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
13577
- DropdownMenuPrimitive__namespace.SubTrigger,
13578
- {
13579
- className: cn$1.cn(
13580
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
13581
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13582
- inset && "pl-8",
13583
- className
13584
- ),
13585
- ref,
13586
- ...props
13587
- },
13588
- children,
13589
- /* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
13590
- ));
13591
- cn$1.withCn(
13592
- DropdownMenuPrimitive__namespace.SubContent,
13593
- "z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
13594
- );
13595
- const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
13596
- className: cn$1.cn(
13597
- "z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
13598
- ),
13599
- sideOffset: 4
13600
- });
13601
- const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
13602
- const menuItemVariants = classVarianceAuthority.cva(
13603
- cn$1.cn(
13604
- "relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
13605
- "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
13606
- ),
13607
- {
13608
- variants: {
13609
- inset: {
13610
- true: "pl-8"
14155
+ const useResize = (ref, callback) => {
14156
+ React.useEffect(() => {
14157
+ const resizeObserver = new ResizeObserver((entries) => {
14158
+ for (const entry of entries) {
14159
+ callback(entry);
13611
14160
  }
14161
+ });
14162
+ if (ref.current) {
14163
+ resizeObserver.observe(ref.current);
13612
14164
  }
13613
- }
13614
- );
13615
- const DropdownMenuItem = cn$1.withVariants(
13616
- DropdownMenuPrimitive__namespace.Item,
13617
- menuItemVariants,
13618
- ["inset"]
13619
- );
13620
- cn$1.withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React.createElement(
13621
- DropdownMenuPrimitive__namespace.CheckboxItem,
13622
- {
13623
- className: cn$1.cn(
13624
- "relative flex select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13625
- "cursor-pointer",
13626
- className
13627
- ),
13628
- ref,
13629
- ...props
13630
- },
13631
- /* @__PURE__ */ React.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
13632
- children
13633
- ));
13634
- const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
13635
- DropdownMenuPrimitive__namespace.RadioItem,
13636
- {
13637
- className: cn$1.cn(
13638
- "relative flex select-none items-center rounded-sm pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13639
- "h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
13640
- className
13641
- ),
13642
- ref,
13643
- ...props
13644
- },
13645
- !hideIcon && /* @__PURE__ */ React.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
14165
+ return () => resizeObserver.disconnect();
14166
+ }, [ref.current]);
14167
+ };
14168
+ const STANDARD_ICON_WIDTH = 32;
14169
+ const HEADING_ICON_WITH_TEXT = 127;
14170
+ const HEADING_ICON_ONLY = 58;
14171
+ const EMBED_ICON_WIDTH = 78;
14172
+ const CONTAINER_MD_BREAKPOINT = 448;
14173
+ const FLOAT_BUTTON_WIDTH = 25;
14174
+ const HEADING_LABEL = "Headings";
14175
+ const ToolbarContext = React.createContext(void 0);
14176
+ const ToolbarProvider = ({
14177
+ tinaForm,
14178
+ templates,
14179
+ overrides,
13646
14180
  children
13647
- ));
13648
- const dropdownMenuLabelVariants = classVarianceAuthority.cva(
13649
- cn$1.cn("select-none px-2 py-1.5 text-sm font-semibold"),
13650
- {
13651
- variants: {
13652
- inset: {
13653
- true: "pl-8"
13654
- }
13655
- }
14181
+ }) => {
14182
+ return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
14183
+ };
14184
+ const useToolbarContext = () => {
14185
+ const context = React.useContext(ToolbarContext);
14186
+ if (!context) {
14187
+ throw new Error("useToolbarContext must be used within a ToolbarProvider");
13656
14188
  }
13657
- );
13658
- const DropdownMenuLabel = cn$1.withVariants(
13659
- DropdownMenuPrimitive__namespace.Label,
13660
- dropdownMenuLabelVariants,
13661
- ["inset"]
13662
- );
13663
- const DropdownMenuSeparator = cn$1.withCn(
13664
- DropdownMenuPrimitive__namespace.Separator,
13665
- "-mx-1 my-1 h-px bg-muted"
13666
- );
13667
- cn$1.withCn(
13668
- cn$1.createPrimitiveElement("span"),
13669
- "ml-auto text-xs tracking-widest opacity-60"
13670
- );
13671
- const useOpenState = () => {
13672
- const [open2, setOpen] = React.useState(false);
13673
- const onOpenChange = React.useCallback(
13674
- (_value = !open2) => {
13675
- setOpen(_value);
13676
- },
13677
- [open2]
13678
- );
13679
- return {
13680
- onOpenChange,
13681
- open: open2
13682
- };
14189
+ return context;
13683
14190
  };
13684
14191
  const items$1 = [
13685
14192
  {
@@ -13745,7 +14252,9 @@ var __publicField = (obj, key, value) => {
13745
14252
  return allNodesMatchInitialNodeType ? initialNodeType : plateParagraph.ELEMENT_PARAGRAPH;
13746
14253
  }, []);
13747
14254
  const editor = plateCommon.useEditorRef();
14255
+ const editorState = plateCommon.useEditorState();
13748
14256
  const openState = useOpenState();
14257
+ const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
13749
14258
  const selectedItem = items$1.find((item) => item.value === value) ?? defaultItem$1;
13750
14259
  const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
13751
14260
  return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
@@ -13757,7 +14266,7 @@ var __publicField = (obj, key, value) => {
13757
14266
  tooltip: "Headings"
13758
14267
  },
13759
14268
  /* @__PURE__ */ React.createElement(SelectedItemIcon, { className: "size-5" }),
13760
- /* @__PURE__ */ React.createElement("span", { className: "hidden 2xl:flex" }, selectedItemLabel)
14269
+ /* @__PURE__ */ React.createElement("span", { className: "@md/toolbar:flex hidden" }, selectedItemLabel)
13761
14270
  )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0" }, /* @__PURE__ */ React.createElement(
13762
14271
  DropdownMenuRadioGroup,
13763
14272
  {
@@ -13769,7 +14278,12 @@ var __publicField = (obj, key, value) => {
13769
14278
  },
13770
14279
  value
13771
14280
  },
13772
- items$1.map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
14281
+ items$1.filter((item) => {
14282
+ if (userInTable) {
14283
+ return !unsupportedItemsInTable.has(item.label);
14284
+ }
14285
+ return true;
14286
+ }).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
13773
14287
  DropdownMenuRadioItem,
13774
14288
  {
13775
14289
  className: "min-w-[180px]",
@@ -13781,42 +14295,6 @@ var __publicField = (obj, key, value) => {
13781
14295
  ))
13782
14296
  )));
13783
14297
  }
13784
- const LinkToolbarButton = cn$1.withRef((rest, ref) => {
13785
- const state = plateLink.useLinkToolbarButtonState();
13786
- const { props } = plateLink.useLinkToolbarButton(state);
13787
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
13788
- });
13789
- const useBlockQuoteToolbarButtonState = () => {
13790
- const editor = plateCommon.useEditorState();
13791
- const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
13792
- return {
13793
- pressed: isBlockActive()
13794
- };
13795
- };
13796
- const useBlockQuoteToolbarButton = (state) => {
13797
- const editor = plateCommon.useEditorState();
13798
- const onClick = () => {
13799
- plateCommon.toggleNodeType(editor, {
13800
- activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
13801
- });
13802
- };
13803
- const onMouseDown = (e) => {
13804
- e.preventDefault();
13805
- e.stopPropagation();
13806
- };
13807
- return {
13808
- props: {
13809
- onClick,
13810
- onMouseDown,
13811
- pressed: state.pressed
13812
- }
13813
- };
13814
- };
13815
- const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
13816
- const state = useBlockQuoteToolbarButtonState();
13817
- const { props } = useBlockQuoteToolbarButton(state);
13818
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
13819
- });
13820
14298
  const useCodeBlockToolbarButtonState = () => {
13821
14299
  const editor = plateCommon.useEditorState();
13822
14300
  const isBlockActive = () => helpers.isNodeActive(editor, plateCodeBlock.ELEMENT_CODE_BLOCK);
@@ -13878,6 +14356,115 @@ var __publicField = (obj, key, value) => {
13878
14356
  const { props } = useImageToolbarButton(state);
13879
14357
  return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
13880
14358
  });
14359
+ const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
14360
+ const editor = plateCommon.useEditorState();
14361
+ const state = plate.useListToolbarButtonState({ nodeType });
14362
+ const { props } = plate.useListToolbarButton(state);
14363
+ return /* @__PURE__ */ React.createElement(
14364
+ ToolbarButton,
14365
+ {
14366
+ ref,
14367
+ tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
14368
+ ...props,
14369
+ onClick: (e) => {
14370
+ e.preventDefault();
14371
+ e.stopPropagation();
14372
+ plate.toggleList(editor, { type: nodeType });
14373
+ }
14374
+ },
14375
+ nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
14376
+ );
14377
+ });
14378
+ const LinkToolbarButton = cn$1.withRef((rest, ref) => {
14379
+ const state = plateLink.useLinkToolbarButtonState();
14380
+ const { props } = plateLink.useLinkToolbarButton(state);
14381
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
14382
+ });
14383
+ const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
14384
+ const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
14385
+ const { props } = plateCommon.useMarkToolbarButton(state);
14386
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
14387
+ });
14388
+ const useMermaidToolbarButtonState = () => {
14389
+ const editor = plateCommon.useEditorState();
14390
+ const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_MERMAID);
14391
+ return {
14392
+ pressed: isBlockActive()
14393
+ };
14394
+ };
14395
+ const useMermaidToolbarButton = (state) => {
14396
+ const editor = plateCommon.useEditorState();
14397
+ const onClick = () => {
14398
+ plateCommon.insertEmptyElement(editor, ELEMENT_MERMAID, {
14399
+ nextBlock: true,
14400
+ select: true
14401
+ });
14402
+ };
14403
+ const onMouseDown = (e) => {
14404
+ e.preventDefault();
14405
+ e.stopPropagation();
14406
+ };
14407
+ return {
14408
+ props: {
14409
+ onClick,
14410
+ onMouseDown,
14411
+ pressed: state.pressed
14412
+ }
14413
+ };
14414
+ };
14415
+ const MermaidToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14416
+ const state = useMermaidToolbarButtonState();
14417
+ const { props } = useMermaidToolbarButton(state);
14418
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Mermaid", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.mermaid, null));
14419
+ });
14420
+ function OverflowMenu({
14421
+ children,
14422
+ ...props
14423
+ }) {
14424
+ const openState = useOpenState();
14425
+ return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
14426
+ ToolbarButton,
14427
+ {
14428
+ showArrow: false,
14429
+ className: "lg:min-w-[130px]",
14430
+ isDropdown: true,
14431
+ pressed: openState.open,
14432
+ tooltip: "Headings"
14433
+ },
14434
+ /* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
14435
+ )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
14436
+ }
14437
+ const useBlockQuoteToolbarButtonState = () => {
14438
+ const editor = plateCommon.useEditorState();
14439
+ const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
14440
+ return {
14441
+ pressed: isBlockActive()
14442
+ };
14443
+ };
14444
+ const useBlockQuoteToolbarButton = (state) => {
14445
+ const editor = plateCommon.useEditorState();
14446
+ const onClick = () => {
14447
+ plateCommon.toggleNodeType(editor, {
14448
+ activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
14449
+ });
14450
+ };
14451
+ const onMouseDown = (e) => {
14452
+ e.preventDefault();
14453
+ e.stopPropagation();
14454
+ };
14455
+ return {
14456
+ props: {
14457
+ onClick,
14458
+ onMouseDown,
14459
+ pressed: state.pressed
14460
+ }
14461
+ };
14462
+ };
14463
+ const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14464
+ const state = useBlockQuoteToolbarButtonState();
14465
+ const { props } = useBlockQuoteToolbarButton(state);
14466
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
14467
+ });
13881
14468
  const useRawMarkdownToolbarButton = () => {
13882
14469
  const { setRawMode } = useEditorContext();
13883
14470
  const onMouseDown = (e) => {
@@ -13894,29 +14481,111 @@ var __publicField = (obj, key, value) => {
13894
14481
  const { props } = useRawMarkdownToolbarButton();
13895
14482
  return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.raw, null));
13896
14483
  });
13897
- const ToolbarContext = React.createContext(void 0);
13898
- const ToolbarProvider = ({
13899
- tinaForm,
13900
- templates,
13901
- overrides,
13902
- children
13903
- }) => {
13904
- return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
13905
- };
13906
- const useToolbarContext = () => {
13907
- const context = React.useContext(ToolbarContext);
13908
- if (!context) {
13909
- throw new Error("useToolbarContext must be used within a ToolbarProvider");
13910
- }
13911
- return context;
13912
- };
14484
+ function TableDropdownMenu(props) {
14485
+ const tableSelected = plateCommon.useEditorSelector(
14486
+ (editor2) => plateCommon.someNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } }),
14487
+ []
14488
+ );
14489
+ const [enableDeleteColumn, enableDeleteRow] = plateCommon.useEditorSelector((editor2) => {
14490
+ const tableNodeEntry = plateCommon.findNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } });
14491
+ if (!tableNodeEntry)
14492
+ return [false, false];
14493
+ const [tableNode] = tableNodeEntry;
14494
+ if (!plateCommon.isElement(tableNode))
14495
+ return [false, false];
14496
+ const columnCount = plateTable.getTableColumnCount(tableNode);
14497
+ const rowCount = tableNode.children.length;
14498
+ return [columnCount > 1, rowCount > 1];
14499
+ }, []);
14500
+ const editor = plateCommon.useEditorRef();
14501
+ const openState = useOpenState();
14502
+ return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(ToolbarButton, { isDropdown: true, pressed: openState.open, tooltip: "Table" }, /* @__PURE__ */ React.createElement(Icons.table, null))), /* @__PURE__ */ React.createElement(
14503
+ DropdownMenuContent,
14504
+ {
14505
+ align: "start",
14506
+ className: "flex w-[180px] min-w-0 flex-col gap-0.5"
14507
+ },
14508
+ /* @__PURE__ */ React.createElement(
14509
+ DropdownMenuItem,
14510
+ {
14511
+ className: "min-w-[180px]",
14512
+ disabled: tableSelected,
14513
+ onSelect: () => {
14514
+ plateTable.insertTable(editor);
14515
+ plateCommon.focusEditor(editor);
14516
+ }
14517
+ },
14518
+ /* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14519
+ "Insert table"
14520
+ ),
14521
+ /* @__PURE__ */ React.createElement(
14522
+ DropdownMenuItem,
14523
+ {
14524
+ className: "min-w-[180px]",
14525
+ disabled: !tableSelected,
14526
+ onSelect: () => {
14527
+ plateTable.deleteTable(editor);
14528
+ plateCommon.focusEditor(editor);
14529
+ }
14530
+ },
14531
+ /* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14532
+ "Delete table"
14533
+ ),
14534
+ /* @__PURE__ */ React.createElement(DropdownMenuSub, null, /* @__PURE__ */ React.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React.createElement(Icons.column, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React.createElement("span", null, "Column")), /* @__PURE__ */ React.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React.createElement(
14535
+ DropdownMenuItem,
14536
+ {
14537
+ className: "min-w-[180px]",
14538
+ disabled: !tableSelected,
14539
+ onSelect: () => {
14540
+ plateTable.insertTableColumn(editor);
14541
+ plateCommon.focusEditor(editor);
14542
+ }
14543
+ },
14544
+ /* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14545
+ "Insert column after"
14546
+ ), /* @__PURE__ */ React.createElement(
14547
+ DropdownMenuItem,
14548
+ {
14549
+ className: "min-w-[180px]",
14550
+ disabled: !enableDeleteColumn,
14551
+ onSelect: () => {
14552
+ plateTable.deleteColumn(editor);
14553
+ plateCommon.focusEditor(editor);
14554
+ }
14555
+ },
14556
+ /* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14557
+ "Delete column"
14558
+ ))),
14559
+ /* @__PURE__ */ React.createElement(DropdownMenuSub, null, /* @__PURE__ */ React.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React.createElement(Icons.row, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React.createElement("span", null, "Row")), /* @__PURE__ */ React.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React.createElement(
14560
+ DropdownMenuItem,
14561
+ {
14562
+ className: "min-w-[180px]",
14563
+ disabled: !tableSelected,
14564
+ onSelect: () => {
14565
+ plateTable.insertTableRow(editor);
14566
+ plateCommon.focusEditor(editor);
14567
+ }
14568
+ },
14569
+ /* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14570
+ "Insert row after"
14571
+ ), /* @__PURE__ */ React.createElement(
14572
+ DropdownMenuItem,
14573
+ {
14574
+ className: "min-w-[180px]",
14575
+ disabled: !enableDeleteRow,
14576
+ onSelect: () => {
14577
+ plateTable.deleteRow(editor);
14578
+ plateCommon.focusEditor(editor);
14579
+ }
14580
+ },
14581
+ /* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14582
+ "Delete row"
14583
+ )))
14584
+ ));
14585
+ }
13913
14586
  function TemplatesToolbarButton() {
13914
14587
  const { templates } = useToolbarContext();
13915
- const showEmbed = templates.length > 0;
13916
14588
  const editor = plateCommon.useEditorState();
13917
- if (!showEmbed) {
13918
- return null;
13919
- }
13920
14589
  return /* @__PURE__ */ React.createElement(EmbedButton, { templates, editor });
13921
14590
  }
13922
14591
  const EmbedButton = ({ editor, templates }) => {
@@ -13957,99 +14626,113 @@ var __publicField = (obj, key, value) => {
13957
14626
  template.label || template.name
13958
14627
  ))));
13959
14628
  };
13960
- const ICON_WIDTH = 32;
13961
- const EMBED_ICON_WIDTH = 78;
13962
- const useResize = (ref, callback) => {
13963
- React.useEffect(() => {
13964
- const resizeObserver = new ResizeObserver((entries) => {
13965
- for (const entry of entries) {
13966
- callback(entry);
13967
- }
13968
- });
13969
- if (ref.current) {
13970
- resizeObserver.observe(ref.current);
13971
- }
13972
- return () => resizeObserver.disconnect();
13973
- }, [ref.current]);
13974
- };
13975
- function OverflowMenu({
13976
- children,
13977
- ...props
13978
- }) {
13979
- const openState = useOpenState();
13980
- return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
13981
- ToolbarButton,
13982
- {
13983
- showArrow: false,
13984
- className: "lg:min-w-[130px]",
13985
- isDropdown: true,
13986
- pressed: openState.open,
13987
- tooltip: "Headings"
13988
- },
13989
- /* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
13990
- )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
13991
- }
13992
14629
  const toolbarItems = {
13993
14630
  heading: {
13994
- label: "Headings",
14631
+ label: HEADING_LABEL,
14632
+ width: (paragraphIconExists) => paragraphIconExists ? HEADING_ICON_WITH_TEXT : HEADING_ICON_ONLY,
14633
+ // Dynamically handle width based on paragraph icon
13995
14634
  Component: /* @__PURE__ */ React.createElement(ToolbarGroup, { noSeparator: true }, /* @__PURE__ */ React.createElement(HeadingsMenu, null))
13996
14635
  },
13997
14636
  link: {
13998
14637
  label: "Link",
14638
+ width: () => STANDARD_ICON_WIDTH,
13999
14639
  Component: /* @__PURE__ */ React.createElement(LinkToolbarButton, null)
14000
14640
  },
14001
14641
  image: {
14002
14642
  label: "Image",
14643
+ width: () => STANDARD_ICON_WIDTH,
14003
14644
  Component: /* @__PURE__ */ React.createElement(ImageToolbarButton, null)
14004
14645
  },
14005
14646
  quote: {
14006
14647
  label: "Quote",
14648
+ width: () => STANDARD_ICON_WIDTH,
14007
14649
  Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
14008
14650
  },
14009
14651
  ul: {
14010
14652
  label: "Unordered List",
14653
+ width: () => STANDARD_ICON_WIDTH,
14011
14654
  Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_UL })
14012
14655
  },
14013
14656
  ol: {
14014
14657
  label: "Ordered List",
14658
+ width: () => STANDARD_ICON_WIDTH,
14015
14659
  Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_OL })
14016
14660
  },
14017
14661
  bold: {
14018
14662
  label: "Bold",
14663
+ width: () => STANDARD_ICON_WIDTH,
14019
14664
  Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null))
14020
14665
  },
14021
14666
  italic: {
14022
14667
  label: "Italic",
14668
+ width: () => STANDARD_ICON_WIDTH,
14023
14669
  Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null))
14024
14670
  },
14025
14671
  code: {
14026
14672
  label: "Code",
14673
+ width: () => STANDARD_ICON_WIDTH,
14027
14674
  Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null))
14028
14675
  },
14029
14676
  codeBlock: {
14030
14677
  label: "Code Block",
14678
+ width: () => STANDARD_ICON_WIDTH,
14031
14679
  Component: /* @__PURE__ */ React.createElement(CodeBlockToolbarButton, null)
14032
14680
  },
14681
+ mermaid: {
14682
+ label: "Mermaid",
14683
+ width: () => STANDARD_ICON_WIDTH,
14684
+ Component: /* @__PURE__ */ React.createElement(MermaidToolbarButton, null)
14685
+ },
14686
+ table: {
14687
+ label: "Table",
14688
+ width: () => STANDARD_ICON_WIDTH,
14689
+ Component: /* @__PURE__ */ React.createElement(TableDropdownMenu, null)
14690
+ },
14033
14691
  raw: {
14034
14692
  label: "Raw Markdown",
14693
+ width: () => STANDARD_ICON_WIDTH,
14035
14694
  Component: /* @__PURE__ */ React.createElement(RawMarkdownToolbarButton, null)
14036
14695
  },
14037
14696
  embed: {
14038
14697
  label: "Templates",
14698
+ width: () => EMBED_ICON_WIDTH,
14039
14699
  Component: /* @__PURE__ */ React.createElement(TemplatesToolbarButton, null)
14040
14700
  }
14041
14701
  };
14042
14702
  function FixedToolbarButtons() {
14043
14703
  const toolbarRef = React.useRef(null);
14044
14704
  const [itemsShown, setItemsShown] = React.useState(11);
14045
- const { overrides } = useToolbarContext();
14705
+ const { overrides, templates } = useToolbarContext();
14706
+ const showEmbedButton = templates.length > 0;
14707
+ let items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14708
+ if (!showEmbedButton) {
14709
+ items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
14710
+ }
14711
+ const editorState = plateCommon.useEditorState();
14712
+ const userInTable = helpers.isNodeActive(editorState, plate.ELEMENT_TABLE);
14713
+ if (userInTable) {
14714
+ items2 = items2.filter((item) => !unsupportedItemsInTable.has(item.label));
14715
+ }
14046
14716
  useResize(toolbarRef, (entry) => {
14047
14717
  const width = entry.target.getBoundingClientRect().width;
14048
- const itemsShown2 = (width - EMBED_ICON_WIDTH) / ICON_WIDTH;
14049
- setItemsShown(Math.floor(itemsShown2));
14718
+ const headingButton = items2.find((item) => item.label === HEADING_LABEL);
14719
+ const headingWidth = headingButton ? headingButton.width(width > CONTAINER_MD_BREAKPOINT) : 0;
14720
+ const availableWidth = width - headingWidth - FLOAT_BUTTON_WIDTH;
14721
+ const { itemFitCount } = items2.reduce(
14722
+ (acc, item) => {
14723
+ if (item.label !== HEADING_LABEL && acc.totalItemsWidth + item.width() <= availableWidth) {
14724
+ return {
14725
+ totalItemsWidth: acc.totalItemsWidth + item.width(),
14726
+ itemFitCount: acc.itemFitCount + 1
14727
+ };
14728
+ }
14729
+ return acc;
14730
+ },
14731
+ { totalItemsWidth: 0, itemFitCount: 1 }
14732
+ );
14733
+ setItemsShown(itemFitCount);
14050
14734
  });
14051
- const toolbarItemsArray = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14052
- return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
14735
+ return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden @container/toolbar", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
14053
14736
  "div",
14054
14737
  {
14055
14738
  className: "flex",
@@ -14057,7 +14740,7 @@ var __publicField = (obj, key, value) => {
14057
14740
  transform: "translateX(calc(-1px))"
14058
14741
  }
14059
14742
  },
14060
- /* @__PURE__ */ React.createElement(React.Fragment, null, toolbarItemsArray.slice(0, itemsShown).map((item, index) => /* @__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))))
14743
+ /* @__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))))
14061
14744
  ));
14062
14745
  }
14063
14746
  const FloatingToolbar = cn$1.withRef(({ children, state, ...props }, componentRef) => {
@@ -14172,6 +14855,10 @@ var __publicField = (obj, key, value) => {
14172
14855
  const openState = useOpenState();
14173
14856
  const selectedItem = items.find((item) => item.value === value) ?? defaultItem;
14174
14857
  const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
14858
+ const editorState = plateCommon.useEditorState();
14859
+ const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
14860
+ if (userInTable)
14861
+ return null;
14175
14862
  return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
14176
14863
  ToolbarButton,
14177
14864
  {
@@ -14213,49 +14900,6 @@ var __publicField = (obj, key, value) => {
14213
14900
  function FloatingToolbarButtons() {
14214
14901
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TurnIntoDropdownMenu, null));
14215
14902
  }
14216
- const buttonVariants = classVarianceAuthority.cva(
14217
- "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",
14218
- {
14219
- defaultVariants: {
14220
- size: "default",
14221
- variant: "default"
14222
- },
14223
- variants: {
14224
- isMenu: {
14225
- true: "h-auto w-full cursor-pointer justify-start"
14226
- },
14227
- size: {
14228
- default: "h-10 px-4 py-2",
14229
- icon: "size-10",
14230
- lg: "h-11 rounded-md px-8",
14231
- none: "",
14232
- sm: "h-9 rounded-md px-3",
14233
- sms: "size-9 rounded-md px-0",
14234
- xs: "h-8 rounded-md px-3"
14235
- },
14236
- variant: {
14237
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
14238
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
14239
- ghost: "hover:bg-accent hover:text-accent-foreground",
14240
- inlineLink: "text-base text-primary underline underline-offset-4",
14241
- link: "text-primary underline-offset-4 hover:underline",
14242
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
14243
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
14244
- }
14245
- }
14246
- }
14247
- );
14248
- cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
14249
- const Comp = asChild ? reactSlot.Slot : "button";
14250
- return /* @__PURE__ */ React__namespace.createElement(
14251
- Comp,
14252
- {
14253
- className: cn$1.cn(buttonVariants({ className, isMenu, size, variant })),
14254
- ref,
14255
- ...props
14256
- }
14257
- );
14258
- });
14259
14903
  const inputVariants = classVarianceAuthority.cva(
14260
14904
  "flex w-full rounded-md bg-transparent text-sm file:border-0 file:bg-background file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
14261
14905
  {
@@ -14276,22 +14920,6 @@ var __publicField = (obj, key, value) => {
14276
14920
  }
14277
14921
  );
14278
14922
  cn$1.withVariants("input", inputVariants, ["variant", "h"]);
14279
- const popoverVariants = classVarianceAuthority.cva(
14280
- "w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 print:hidden"
14281
- );
14282
- cn$1.withRef(
14283
- ({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
14284
- PopoverPrimitive__namespace.Content,
14285
- {
14286
- align,
14287
- className: cn$1.cn(popoverVariants(), className),
14288
- ref,
14289
- sideOffset,
14290
- style: { zIndex: 1e3, ...style },
14291
- ...props
14292
- }
14293
- ))
14294
- );
14295
14923
  const floatingOptions = {
14296
14924
  middleware: [
14297
14925
  plateFloating.offset(12),
@@ -14351,7 +14979,7 @@ var __publicField = (obj, key, value) => {
14351
14979
  const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex h-9 items-center gap-1" }, /* @__PURE__ */ React.createElement(
14352
14980
  "button",
14353
14981
  {
14354
- className: buttonVariants({ size: "sm", variant: "ghost" }),
14982
+ className: buttonVariants$1({ size: "sm", variant: "ghost" }),
14355
14983
  type: "button",
14356
14984
  ...editButtonProps
14357
14985
  },
@@ -14359,7 +14987,7 @@ var __publicField = (obj, key, value) => {
14359
14987
  ), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
14360
14988
  plateLink.LinkOpenButton,
14361
14989
  {
14362
- className: buttonVariants({
14990
+ className: buttonVariants$1({
14363
14991
  size: "sms",
14364
14992
  variant: "ghost"
14365
14993
  })
@@ -14368,7 +14996,7 @@ var __publicField = (obj, key, value) => {
14368
14996
  ), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
14369
14997
  "button",
14370
14998
  {
14371
- className: buttonVariants({
14999
+ className: buttonVariants$1({
14372
15000
  size: "sms",
14373
15001
  variant: "ghost"
14374
15002
  }),
@@ -14442,6 +15070,7 @@ var __publicField = (obj, key, value) => {
14442
15070
  createMdxBlockPlugin(),
14443
15071
  createMdxInlinePlugin(),
14444
15072
  createImgPlugin(),
15073
+ createMermaidPlugin(),
14445
15074
  createInvalidMarkdownPlugin(),
14446
15075
  plateLink.createLinkPlugin({
14447
15076
  options: {
@@ -30564,8 +31193,8 @@ This will work when developing locally but NOT when deployed to production.
30564
31193
  }
30565
31194
  )
30566
31195
  }
30567
- ), !renderDesktopNav && /* @__PURE__ */ React.createElement(react$1.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
30568
- react$1.TransitionChild,
31196
+ ), !renderDesktopNav && /* @__PURE__ */ React.createElement(react.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
31197
+ react.TransitionChild,
30569
31198
  {
30570
31199
  enter: "transform transition-all ease-out duration-300",
30571
31200
  enterFrom: "opacity-0 -translate-x-full",
@@ -30634,7 +31263,7 @@ This will work when developing locally but NOT when deployed to production.
30634
31263
  ))
30635
31264
  ))
30636
31265
  ), /* @__PURE__ */ React.createElement(
30637
- react$1.TransitionChild,
31266
+ react.TransitionChild,
30638
31267
  {
30639
31268
  enter: "ease-out duration-300",
30640
31269
  enterFrom: "opacity-0",
@@ -31088,8 +31717,8 @@ This will work when developing locally but NOT when deployed to production.
31088
31717
  folder,
31089
31718
  collectionName
31090
31719
  }) => {
31091
- 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(
31092
- react$1.Transition,
31720
+ 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(
31721
+ react.Transition,
31093
31722
  {
31094
31723
  enter: "transition ease-out duration-100",
31095
31724
  enterFrom: "transform opacity-0 scale-95",
@@ -31098,7 +31727,7 @@ This will work when developing locally but NOT when deployed to production.
31098
31727
  leaveFrom: "transform opacity-100 scale-100",
31099
31728
  leaveTo: "transform opacity-0 scale-95"
31100
31729
  },
31101
- /* @__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(
31730
+ /* @__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(
31102
31731
  reactRouterDom.Link,
31103
31732
  {
31104
31733
  to: `/${folder.fullyQualifiedName ? [