tinacms 0.0.0-bf22bf8-20241004045704 → 0.0.0-c45ac5d-20241213020122

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 (30) hide show
  1. package/dist/admin/types.d.ts +3 -0
  2. package/dist/cache/node-cache.d.ts +1 -0
  3. package/dist/client.js +22 -23
  4. package/dist/client.mjs +3 -7
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +1509 -772
  7. package/dist/index.mjs +1490 -749
  8. package/dist/{node-cache-7fa2452c.mjs → node-cache-4c336858.mjs} +18 -11
  9. package/dist/rich-text/index.d.ts +3 -0
  10. package/dist/rich-text/index.js +45 -12
  11. package/dist/rich-text/index.mjs +45 -12
  12. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/fixed-toolbar-buttons.d.ts +0 -4
  13. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +2 -0
  14. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-element.d.ts +11 -0
  15. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +20 -0
  16. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/resizable.d.ts +39 -0
  17. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-cell-element.d.ts +27 -0
  18. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-dropdown-menu.d.ts +3 -0
  19. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-element.d.ts +14 -0
  20. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-row-element.d.ts +13 -0
  21. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/text-area.d.ts +5 -0
  22. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +1 -0
  23. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/custom/mermaid-plugin.d.ts +2 -0
  24. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +4 -2
  25. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +58 -0
  26. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +7 -3
  27. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +1 -1
  28. package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
  29. package/package.json +28 -27
  30. package/dist/__vite-browser-external-d06ac358.mjs +0 -4
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(
@@ -774,6 +774,22 @@ var __publicField = (obj, key, value) => {
774
774
  );
775
775
  };
776
776
  }
777
+ function wrapFieldWithNoHeader(Field) {
778
+ return (props) => {
779
+ return /* @__PURE__ */ React__namespace.createElement(
780
+ FieldMeta,
781
+ {
782
+ name: props.input.name,
783
+ label: false,
784
+ description: "",
785
+ error: props.meta.error,
786
+ index: props.index,
787
+ tinaForm: props.tinaForm
788
+ },
789
+ /* @__PURE__ */ React__namespace.createElement(Field, { ...props })
790
+ );
791
+ };
792
+ }
777
793
  function wrapFieldWithError(Field) {
778
794
  return (props) => {
779
795
  return /* @__PURE__ */ React__namespace.createElement(
@@ -846,6 +862,16 @@ var __publicField = (obj, key, value) => {
846
862
  className,
847
863
  ...props
848
864
  }) => {
865
+ if (typeof children === "string") {
866
+ return /* @__PURE__ */ React__namespace.createElement(
867
+ "span",
868
+ {
869
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
870
+ ...props,
871
+ dangerouslySetInnerHTML: { __html: children }
872
+ }
873
+ );
874
+ }
849
875
  return /* @__PURE__ */ React__namespace.createElement(
850
876
  "span",
851
877
  {
@@ -882,6 +908,20 @@ var __publicField = (obj, key, value) => {
882
908
  const useTemplates = () => {
883
909
  return React.useContext(EditorContext);
884
910
  };
911
+ const BlockquoteElement = cn$1.withRef(
912
+ ({ children, className, ...props }, ref) => {
913
+ return /* @__PURE__ */ React.createElement(
914
+ plateCommon.PlateElement,
915
+ {
916
+ asChild: true,
917
+ className: cn$1.cn("my-1 border-l-2 pl-6 italic", className),
918
+ ref,
919
+ ...props
920
+ },
921
+ /* @__PURE__ */ React.createElement("blockquote", null, children)
922
+ );
923
+ }
924
+ );
885
925
  function classNames$1(...classes) {
886
926
  return classes.filter(Boolean).join(" ");
887
927
  }
@@ -891,6 +931,503 @@ var __publicField = (obj, key, value) => {
891
931
  (c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
892
932
  );
893
933
  };
934
+ function ChevronDownIcon(props, svgRef) {
935
+ return /* @__PURE__ */ React__namespace.createElement("svg", Object.assign({
936
+ xmlns: "http://www.w3.org/2000/svg",
937
+ viewBox: "0 0 20 20",
938
+ fill: "currentColor",
939
+ "aria-hidden": "true",
940
+ ref: svgRef
941
+ }, props), /* @__PURE__ */ React__namespace.createElement("path", {
942
+ fillRule: "evenodd",
943
+ 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",
944
+ clipRule: "evenodd"
945
+ }));
946
+ }
947
+ const ForwardRef = React__namespace.forwardRef(ChevronDownIcon);
948
+ const ChevronDownIcon$1 = ForwardRef;
949
+ const Autocomplete = ({
950
+ value,
951
+ onChange,
952
+ defaultQuery,
953
+ items: items2
954
+ }) => {
955
+ const [query, setQuery] = React.useState(defaultQuery ?? "");
956
+ const filteredItems = React.useMemo(() => {
957
+ try {
958
+ const reFilter = new RegExp(query, "i");
959
+ const _items = items2.filter((item) => reFilter.test(item.label));
960
+ if (_items.length === 0)
961
+ return items2;
962
+ return _items;
963
+ } catch (err) {
964
+ return items2;
965
+ }
966
+ }, [items2, query]);
967
+ return /* @__PURE__ */ React.createElement(
968
+ react.Combobox,
969
+ {
970
+ value,
971
+ onChange,
972
+ as: "div",
973
+ className: "relative inline-block text-left z-20"
974
+ },
975
+ /* @__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(
976
+ react.ComboboxInput,
977
+ {
978
+ 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",
979
+ displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
980
+ onChange: (event) => setQuery(event.target.value),
981
+ onClick: (ev) => ev.stopPropagation()
982
+ }
983
+ ), /* @__PURE__ */ React.createElement(react.ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React.createElement(
984
+ ChevronDownIcon$1,
985
+ {
986
+ className: "h-5 w-5 text-gray-400",
987
+ "aria-hidden": "true"
988
+ }
989
+ )))),
990
+ /* @__PURE__ */ React.createElement(
991
+ react.Transition,
992
+ {
993
+ enter: "transition ease-out duration-100",
994
+ enterFrom: "transform opacity-0 scale-95",
995
+ enterTo: "transform opacity-100 scale-100",
996
+ leave: "transition ease-in duration-75",
997
+ leaveFrom: "transform opacity-100 scale-100",
998
+ leaveTo: "transform opacity-0 scale-95"
999
+ },
1000
+ /* @__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(
1001
+ "button",
1002
+ {
1003
+ className: classNames$1(
1004
+ focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
1005
+ "block px-4 py-2 text-xs w-full text-right"
1006
+ )
1007
+ },
1008
+ item.render(item)
1009
+ ))))
1010
+ )
1011
+ );
1012
+ };
1013
+ MonacoEditor.loader.config({
1014
+ paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
1015
+ });
1016
+ let retryCount = 0;
1017
+ const retryFocus = (ref) => {
1018
+ if (ref.current) {
1019
+ ref.current.focus();
1020
+ } else {
1021
+ if (retryCount < 30) {
1022
+ setTimeout(() => {
1023
+ retryCount = retryCount + 1;
1024
+ retryFocus(ref);
1025
+ }, 100);
1026
+ }
1027
+ }
1028
+ };
1029
+ const MINIMUM_HEIGHT = 75;
1030
+ const CodeBlock = ({
1031
+ attributes,
1032
+ editor,
1033
+ element,
1034
+ language: restrictLanguage,
1035
+ onChangeCallback,
1036
+ defaultValue,
1037
+ ...props
1038
+ }) => {
1039
+ const [navigateAway, setNavigateAway] = React.useState(null);
1040
+ const monaco = MonacoEditor.useMonaco();
1041
+ const monacoEditorRef = React.useRef(null);
1042
+ const selected = slateReact.useSelected();
1043
+ const [height, setHeight] = React.useState(MINIMUM_HEIGHT);
1044
+ React.useEffect(() => {
1045
+ if (selected && plateCommon.isCollapsed(editor.selection)) {
1046
+ retryFocus(monacoEditorRef);
1047
+ }
1048
+ }, [selected, monacoEditorRef.current]);
1049
+ const value = element.value || "";
1050
+ if (typeof value !== "string") {
1051
+ throw new Error("Element must be of type string for code block");
1052
+ }
1053
+ const language = restrictLanguage || element.lang;
1054
+ const id = React.useMemo(() => uuid(), []);
1055
+ const languages = React.useMemo(() => {
1056
+ const defaultLangSet = { "": "plain text" };
1057
+ if (!monaco)
1058
+ return defaultLangSet;
1059
+ return monaco.languages.getLanguages().reduce((ac, cv) => {
1060
+ if (cv.id === "plaintext")
1061
+ return ac;
1062
+ return { ...ac, [cv.id]: cv.id };
1063
+ }, defaultLangSet);
1064
+ }, [monaco]);
1065
+ React.useEffect(() => {
1066
+ if (monaco) {
1067
+ monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
1068
+ monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
1069
+ // disable errors
1070
+ noSemanticValidation: true,
1071
+ noSyntaxValidation: true
1072
+ });
1073
+ }
1074
+ }, [monaco]);
1075
+ const items2 = Object.entries(languages).map(([key, label]) => ({
1076
+ key,
1077
+ label,
1078
+ render: (item) => item.label
1079
+ }));
1080
+ const currentItem = React.useMemo(() => {
1081
+ return items2.find((item) => item.key === language) ?? {
1082
+ key: "",
1083
+ label: "Plain Text"
1084
+ };
1085
+ }, [items2, language]);
1086
+ React.useEffect(() => {
1087
+ if (navigateAway) {
1088
+ setNavigateAway(null);
1089
+ switch (navigateAway) {
1090
+ case "remove":
1091
+ {
1092
+ plateCommon.focusEditor(editor);
1093
+ plateCommon.setNodes(
1094
+ editor,
1095
+ {
1096
+ type: "p",
1097
+ children: [{ text: "" }],
1098
+ lang: void 0,
1099
+ value: void 0
1100
+ },
1101
+ {
1102
+ match: (n) => {
1103
+ if (plateCommon.isElement(n) && n.type === element.type) {
1104
+ return true;
1105
+ }
1106
+ }
1107
+ }
1108
+ );
1109
+ }
1110
+ break;
1111
+ case "insertNext":
1112
+ {
1113
+ plateCommon.insertNodes(
1114
+ editor,
1115
+ [
1116
+ {
1117
+ type: plateCommon.ELEMENT_DEFAULT,
1118
+ children: [{ text: "" }],
1119
+ lang: void 0,
1120
+ value: void 0
1121
+ }
1122
+ ],
1123
+ { select: true }
1124
+ );
1125
+ plateCommon.focusEditor(editor);
1126
+ }
1127
+ break;
1128
+ case "up":
1129
+ {
1130
+ const path = plateCommon.findNodePath(editor, element);
1131
+ if (!path) {
1132
+ return;
1133
+ }
1134
+ const previousNodePath = plateCommon.getPointBefore(editor, path);
1135
+ if (!previousNodePath) {
1136
+ plateCommon.focusEditor(editor);
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
+ // Insert a new node at the current path, resulting in the code_block
1148
+ // moving down one block
1149
+ { at: path, select: true }
1150
+ );
1151
+ return;
1152
+ }
1153
+ plateCommon.focusEditor(editor, previousNodePath);
1154
+ }
1155
+ break;
1156
+ case "down": {
1157
+ const path = plateCommon.findNodePath(editor, element);
1158
+ if (!path) {
1159
+ return;
1160
+ }
1161
+ const nextNodePath = plateCommon.getPointAfter(editor, path);
1162
+ if (!nextNodePath) {
1163
+ plateCommon.insertNodes(
1164
+ editor,
1165
+ [
1166
+ {
1167
+ type: plateCommon.ELEMENT_DEFAULT,
1168
+ children: [{ text: "" }],
1169
+ lang: void 0,
1170
+ value: void 0
1171
+ }
1172
+ ],
1173
+ { select: true }
1174
+ );
1175
+ plateCommon.focusEditor(editor);
1176
+ } else {
1177
+ plateCommon.focusEditor(editor, nextNodePath);
1178
+ }
1179
+ break;
1180
+ }
1181
+ }
1182
+ }
1183
+ }, [navigateAway]);
1184
+ function handleEditorDidMount(monacoEditor, monaco2) {
1185
+ monacoEditorRef.current = monacoEditor;
1186
+ monacoEditor.onDidContentSizeChange(() => {
1187
+ setHeight(
1188
+ monacoEditor.getContentHeight() > MINIMUM_HEIGHT ? monacoEditor.getContentHeight() : MINIMUM_HEIGHT
1189
+ );
1190
+ monacoEditor.layout();
1191
+ });
1192
+ plateCommon.setNodes(editor, { value: defaultValue, lang: language });
1193
+ monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
1194
+ if (monacoEditor.hasTextFocus()) {
1195
+ setNavigateAway("insertNext");
1196
+ }
1197
+ });
1198
+ monacoEditor.onKeyDown((l) => {
1199
+ if (l.code === "ArrowUp") {
1200
+ const selection = monacoEditor.getSelection();
1201
+ if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
1202
+ setNavigateAway("up");
1203
+ }
1204
+ }
1205
+ if (l.code === "ArrowDown") {
1206
+ const selection = monacoEditor.getSelection();
1207
+ const totalLines = monacoEditor.getModel().getLineCount();
1208
+ if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
1209
+ setNavigateAway("down");
1210
+ }
1211
+ }
1212
+ if (l.code === "Backspace") {
1213
+ const selection = monacoEditor.getSelection();
1214
+ 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) {
1215
+ setNavigateAway("remove");
1216
+ }
1217
+ }
1218
+ });
1219
+ }
1220
+ return /* @__PURE__ */ React.createElement(
1221
+ "div",
1222
+ {
1223
+ ...attributes,
1224
+ className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
1225
+ },
1226
+ /* @__PURE__ */ React.createElement("style", null, `.monaco-editor .editor-widget {
1227
+ display: none !important;
1228
+ visibility: hidden !important;
1229
+ }`),
1230
+ props.children,
1231
+ /* @__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(
1232
+ Autocomplete,
1233
+ {
1234
+ items: items2,
1235
+ value: currentItem,
1236
+ defaultQuery: "plaintext",
1237
+ onChange: (item) => plateCommon.setNodes(editor, { lang: item.key })
1238
+ }
1239
+ )), /* @__PURE__ */ React.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React.createElement(
1240
+ MonacoEditor,
1241
+ {
1242
+ path: id,
1243
+ onMount: handleEditorDidMount,
1244
+ options: {
1245
+ scrollBeyondLastLine: false,
1246
+ // automaticLayout: true,
1247
+ tabSize: 2,
1248
+ disableLayerHinting: true,
1249
+ accessibilitySupport: "off",
1250
+ codeLens: false,
1251
+ wordWrap: "on",
1252
+ minimap: {
1253
+ enabled: false
1254
+ },
1255
+ fontSize: 14,
1256
+ lineHeight: 2,
1257
+ formatOnPaste: true,
1258
+ lineNumbers: "off",
1259
+ formatOnType: true,
1260
+ fixedOverflowWidgets: true,
1261
+ // Takes too much horizontal space for iframe
1262
+ folding: false,
1263
+ renderLineHighlight: "none",
1264
+ scrollbar: {
1265
+ verticalScrollbarSize: 1,
1266
+ horizontalScrollbarSize: 1,
1267
+ // https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
1268
+ alwaysConsumeMouseWheel: false
1269
+ }
1270
+ },
1271
+ language: String(language),
1272
+ value: String(element.value),
1273
+ onChange: (value2) => {
1274
+ onChangeCallback == null ? void 0 : onChangeCallback(value2);
1275
+ plateCommon.setNodes(editor, { value: value2, lang: language });
1276
+ }
1277
+ }
1278
+ )))
1279
+ );
1280
+ };
1281
+ const CodeBlockElement = cn$1.withRef(
1282
+ ({ className, ...props }, ref) => {
1283
+ const { element } = props;
1284
+ const state = plateCodeBlock.useCodeBlockElementState({ element });
1285
+ return /* @__PURE__ */ React.createElement(
1286
+ plateCommon.PlateElement,
1287
+ {
1288
+ className: cn$1.cn("relative py-1", state.className, className),
1289
+ ref,
1290
+ ...props
1291
+ },
1292
+ /* @__PURE__ */ React.createElement(CodeBlock, { ...props })
1293
+ );
1294
+ }
1295
+ );
1296
+ const CodeLeaf = cn$1.withRef(
1297
+ ({ children, className, ...props }, ref) => {
1298
+ return /* @__PURE__ */ React.createElement(
1299
+ plateCommon.PlateLeaf,
1300
+ {
1301
+ asChild: true,
1302
+ className: cn$1.cn(
1303
+ "whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
1304
+ className
1305
+ ),
1306
+ ref,
1307
+ ...props
1308
+ },
1309
+ /* @__PURE__ */ React.createElement("code", null, children)
1310
+ );
1311
+ }
1312
+ );
1313
+ const CodeLineElement = cn$1.withRef((props, ref) => /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { ref, ...props }));
1314
+ const CodeSyntaxLeaf = cn$1.withRef(
1315
+ ({ children, ...props }, ref) => {
1316
+ const { leaf } = props;
1317
+ const { tokenProps } = plateCodeBlock.useCodeSyntaxLeaf({ leaf });
1318
+ return /* @__PURE__ */ React.createElement(plateCommon.PlateLeaf, { ref, ...props }, /* @__PURE__ */ React.createElement("span", { ...tokenProps }, children));
1319
+ }
1320
+ );
1321
+ const listVariants = classVarianceAuthority.cva("m-0 ps-6", {
1322
+ variants: {
1323
+ variant: {
1324
+ ol: "list-decimal",
1325
+ ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
1326
+ }
1327
+ }
1328
+ });
1329
+ const ListElementVariants = cn$1.withVariants(plateCommon.PlateElement, listVariants, [
1330
+ "variant"
1331
+ ]);
1332
+ const ListElement = cn$1.withRef(
1333
+ ({ children, variant = "ul", ...props }, ref) => {
1334
+ const Component = variant;
1335
+ return /* @__PURE__ */ React.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React.createElement(Component, null, children));
1336
+ }
1337
+ );
1338
+ const ELEMENT_MERMAID = "mermaid";
1339
+ const createMermaidPlugin = plateCommon.createPluginFactory({
1340
+ isElement: true,
1341
+ isVoid: true,
1342
+ isInline: false,
1343
+ key: ELEMENT_MERMAID
1344
+ });
1345
+ const MermaidElementWithRef = ({ config }) => {
1346
+ const mermaidRef = React.useRef(null);
1347
+ React.useEffect(() => {
1348
+ if (mermaidRef.current) {
1349
+ mermaid.initialize({ startOnLoad: true });
1350
+ mermaid.init();
1351
+ }
1352
+ }, [config]);
1353
+ 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)));
1354
+ };
1355
+ const Bubble = ({ children }) => {
1356
+ return /* @__PURE__ */ React.createElement("div", { className: "bg-blue-600 rounded-full p-2 transition-transform duration-200 ease-in-out hover:scale-110" }, children);
1357
+ };
1358
+ const ErrorMsg = ({ error }) => {
1359
+ if (error) {
1360
+ return /* @__PURE__ */ React.createElement(
1361
+ "div",
1362
+ {
1363
+ contentEditable: false,
1364
+ className: "font-mono bg-red-600 text-white p-2 rounded-md cursor-default"
1365
+ },
1366
+ error
1367
+ );
1368
+ }
1369
+ return null;
1370
+ };
1371
+ const DEFAULT_MERMAID_CONFIG = `%% This won't render without implementing a rendering engine (e.g. mermaid on npm)
1372
+ flowchart TD
1373
+ id1(this is an example flow diagram)
1374
+ --> id2(modify me to see changes!)
1375
+ id2
1376
+ --> id3(Click the top button to preview the changes)
1377
+ --> id4(Learn about mermaid diagrams - mermaid.js.org)`;
1378
+ const MermaidElement = cn$1.withRef(
1379
+ ({ children, nodeProps, element, ...props }, ref) => {
1380
+ const [mermaidConfig, setMermaidConfig] = React.useState(
1381
+ element.value || DEFAULT_MERMAID_CONFIG
1382
+ );
1383
+ const [isEditing, setIsEditing] = React.useState(
1384
+ mermaidConfig === DEFAULT_MERMAID_CONFIG || false
1385
+ );
1386
+ const [mermaidError, setMermaidError] = React.useState(null);
1387
+ const node = {
1388
+ type: ELEMENT_MERMAID,
1389
+ value: mermaidConfig,
1390
+ children: [{ type: "text", text: "" }]
1391
+ };
1392
+ React.useEffect(() => {
1393
+ if (mermaid.parse(mermaidConfig)) {
1394
+ setMermaidError(null);
1395
+ }
1396
+ }, [mermaidConfig]);
1397
+ mermaid.parseError = (err) => {
1398
+ setMermaidError(
1399
+ String(err.message) || "An error occurred while parsing the diagram."
1400
+ );
1401
+ };
1402
+ 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(
1403
+ lucideReact.Eye,
1404
+ {
1405
+ className: "w-5 h-5 fill-white cursor-pointer",
1406
+ onClick: () => {
1407
+ setIsEditing(!isEditing);
1408
+ }
1409
+ }
1410
+ ) : /* @__PURE__ */ React.createElement(
1411
+ lucideReact.SquarePen,
1412
+ {
1413
+ className: "w-5 h-5 fill-white cursor-pointer",
1414
+ onClick: () => {
1415
+ setIsEditing(!isEditing);
1416
+ }
1417
+ }
1418
+ ))), isEditing ? /* @__PURE__ */ React.createElement(
1419
+ CodeBlock,
1420
+ {
1421
+ children: "",
1422
+ language: "yaml",
1423
+ ...props,
1424
+ element: node,
1425
+ defaultValue: mermaidConfig,
1426
+ onChangeCallback: (value) => setMermaidConfig(value)
1427
+ }
1428
+ ) : /* @__PURE__ */ React.createElement(MermaidElementWithRef, { config: mermaidConfig })), children, /* @__PURE__ */ React.createElement(ErrorMsg, { error: mermaidError }));
1429
+ }
1430
+ );
894
1431
  const RawMarkdown = () => {
895
1432
  return /* @__PURE__ */ React.createElement(
896
1433
  "svg",
@@ -909,6 +1446,29 @@ var __publicField = (obj, key, value) => {
909
1446
  /* @__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" })
910
1447
  );
911
1448
  };
1449
+ const MermaidIcon = () => /* @__PURE__ */ React.createElement(
1450
+ "svg",
1451
+ {
1452
+ width: "100%",
1453
+ height: "100%",
1454
+ viewBox: "0 0 491 491",
1455
+ version: "1.1",
1456
+ xmlns: "http://www.w3.org/2000/svg",
1457
+ fillRule: "evenodd",
1458
+ clipRule: "evenodd",
1459
+ strokeLinejoin: "round",
1460
+ strokeMiterlimit: 2
1461
+ },
1462
+ /* @__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" }),
1463
+ /* @__PURE__ */ React.createElement(
1464
+ "path",
1465
+ {
1466
+ 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",
1467
+ fill: "white",
1468
+ fillRule: "nonzero"
1469
+ }
1470
+ )
1471
+ );
912
1472
  const borderAll = (props) => /* @__PURE__ */ React.createElement(
913
1473
  "svg",
914
1474
  {
@@ -993,7 +1553,7 @@ var __publicField = (obj, key, value) => {
993
1553
  },
994
1554
  /* @__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
1555
  );
996
- classVarianceAuthority.cva("", {
1556
+ const iconVariants = classVarianceAuthority.cva("", {
997
1557
  variants: {
998
1558
  variant: {
999
1559
  toolbar: "size-5",
@@ -1149,6 +1709,7 @@ var __publicField = (obj, key, value) => {
1149
1709
  clear: lucideReact.X,
1150
1710
  close: lucideReact.X,
1151
1711
  // code: Code2,
1712
+ paint: lucideReact.PaintBucket,
1152
1713
  codeblock: lucideReact.FileCode,
1153
1714
  color: lucideReact.Baseline,
1154
1715
  column: lucideReact.RectangleVertical,
@@ -1174,6 +1735,7 @@ var __publicField = (obj, key, value) => {
1174
1735
  lineHeight: lucideReact.WrapText,
1175
1736
  // link: Link2,
1176
1737
  minus: lucideReact.Minus,
1738
+ mermaid: MermaidIcon,
1177
1739
  more: lucideReact.MoreHorizontal,
1178
1740
  // ol: ListOrdered,
1179
1741
  outdent: lucideReact.Outdent,
@@ -1548,7 +2110,7 @@ var __publicField = (obj, key, value) => {
1548
2110
  setHasEmpty
1549
2111
  ]
1550
2112
  );
1551
- const store = react.useComboboxStore({
2113
+ const store = react$1.useComboboxStore({
1552
2114
  setValue: (newValue) => React.startTransition(() => setValue(newValue))
1553
2115
  });
1554
2116
  const items2 = store.useState("items");
@@ -1558,7 +2120,7 @@ var __publicField = (obj, key, value) => {
1558
2120
  }
1559
2121
  }, [items2, store]);
1560
2122
  return /* @__PURE__ */ React.createElement("span", { contentEditable: false }, /* @__PURE__ */ React.createElement(
1561
- react.ComboboxProvider,
2123
+ react$1.ComboboxProvider,
1562
2124
  {
1563
2125
  open: (items2.length > 0 || hasEmpty) && (!hideWhenNoValue || value.length > 0),
1564
2126
  store
@@ -1573,7 +2135,7 @@ var __publicField = (obj, key, value) => {
1573
2135
  showTrigger,
1574
2136
  trigger
1575
2137
  } = React.useContext(InlineComboboxContext);
1576
- const store = react.useComboboxContext();
2138
+ const store = react$1.useComboboxContext();
1577
2139
  const value = store.useState("value");
1578
2140
  const ref = plateCommon.useComposedRef(propRef, contextRef);
1579
2141
  return /* @__PURE__ */ React.createElement(React.Fragment, null, showTrigger && trigger, /* @__PURE__ */ React.createElement("span", { className: "relative min-h-[1lh]" }, /* @__PURE__ */ React.createElement(
@@ -1584,7 +2146,7 @@ var __publicField = (obj, key, value) => {
1584
2146
  },
1585
2147
  value || "​"
1586
2148
  ), /* @__PURE__ */ React.createElement(
1587
- react.Combobox,
2149
+ react$1.Combobox,
1588
2150
  {
1589
2151
  autoSelect: true,
1590
2152
  className: cn$1.cn(
@@ -1603,8 +2165,8 @@ var __publicField = (obj, key, value) => {
1603
2165
  className,
1604
2166
  ...props
1605
2167
  }) => {
1606
- return /* @__PURE__ */ React.createElement(react.Portal, null, /* @__PURE__ */ React.createElement(
1607
- react.ComboboxPopover,
2168
+ return /* @__PURE__ */ React.createElement(react$1.Portal, null, /* @__PURE__ */ React.createElement(
2169
+ react$1.ComboboxPopover,
1608
2170
  {
1609
2171
  className: cn$1.cn(
1610
2172
  "z-[9999999] max-h-[288px] w-[300px] overflow-y-auto rounded-md bg-white shadow-md",
@@ -1636,7 +2198,7 @@ var __publicField = (obj, key, value) => {
1636
2198
  }) => {
1637
2199
  const { value } = props;
1638
2200
  const { filter, removeInput } = React.useContext(InlineComboboxContext);
1639
- const store = react.useComboboxContext();
2201
+ const store = react$1.useComboboxContext();
1640
2202
  const search = filter && store.useState("value");
1641
2203
  const visible = React.useMemo(
1642
2204
  () => !filter || filter({ keywords, value }, search),
@@ -1645,7 +2207,7 @@ var __publicField = (obj, key, value) => {
1645
2207
  if (!visible)
1646
2208
  return null;
1647
2209
  return /* @__PURE__ */ React.createElement(
1648
- react.ComboboxItem,
2210
+ react$1.ComboboxItem,
1649
2211
  {
1650
2212
  className: cn$1.cn(comboboxItemVariants(), className),
1651
2213
  onClick: (event) => {
@@ -1661,7 +2223,7 @@ var __publicField = (obj, key, value) => {
1661
2223
  className
1662
2224
  }) => {
1663
2225
  const { setHasEmpty } = React.useContext(InlineComboboxContext);
1664
- const store = react.useComboboxContext();
2226
+ const store = react$1.useComboboxContext();
1665
2227
  const items2 = store.useState("items");
1666
2228
  React.useEffect(() => {
1667
2229
  setHasEmpty(true);
@@ -1744,417 +2306,482 @@ var __publicField = (obj, key, value) => {
1744
2306
  );
1745
2307
  }
1746
2308
  );
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]);
2309
+ const TableCellElement = cn$1.withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
2310
+ var _a, _b, _c, _d;
2311
+ const { element } = props;
2312
+ const {
2313
+ borders,
2314
+ colIndex,
2315
+ colSpan,
2316
+ hovered,
2317
+ hoveredLeft,
2318
+ isSelectingCell,
2319
+ readOnly,
2320
+ rowIndex,
2321
+ rowSize,
2322
+ selected
2323
+ } = plateTable.useTableCellElementState();
2324
+ const { props: cellProps } = plateTable.useTableCellElement({ element: props.element });
2325
+ const resizableState = plateTable.useTableCellElementResizableState({
2326
+ colIndex,
2327
+ colSpan,
2328
+ rowIndex
2329
+ });
2330
+ const { bottomProps, hiddenLeft, leftProps, rightProps } = plateTable.useTableCellElementResizable(resizableState);
2331
+ const Cell = isHeader ? "th" : "td";
1836
2332
  return /* @__PURE__ */ React.createElement(
1837
- react$1.Combobox,
2333
+ plateCommon.PlateElement,
1838
2334
  {
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()
2335
+ asChild: true,
2336
+ className: cn$1.cn(
2337
+ "relative h-full overflow-visible border-none bg-background p-0",
2338
+ hideBorder && "before:border-none",
2339
+ element.background ? "bg-[--cellBackground]" : "bg-background",
2340
+ !hideBorder && cn$1.cn(
2341
+ isHeader && "text-left [&_>_*]:m-0",
2342
+ "before:size-full",
2343
+ selected && "before:z-10 before:bg-muted",
2344
+ "before:absolute before:box-border before:select-none before:content-['']",
2345
+ borders && cn$1.cn(
2346
+ ((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
2347
+ ((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
2348
+ ((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
2349
+ ((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
2350
+ )
2351
+ ),
2352
+ className
2353
+ ),
2354
+ ref,
2355
+ ...cellProps,
2356
+ ...props,
2357
+ style: {
2358
+ "--cellBackground": element.background,
2359
+ ...style
1851
2360
  }
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,
2361
+ },
2362
+ /* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(
2363
+ "div",
1854
2364
  {
1855
- className: "h-5 w-5 text-gray-400",
1856
- "aria-hidden": "true"
1857
- }
1858
- )))),
1859
- /* @__PURE__ */ React.createElement(
1860
- react$1.Transition,
2365
+ className: "relative z-20 box-border h-full px-3 py-2",
2366
+ style: {
2367
+ minHeight: rowSize
2368
+ }
2369
+ },
2370
+ children
2371
+ ), !isSelectingCell && /* @__PURE__ */ React.createElement(
2372
+ "div",
1861
2373
  {
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"
2374
+ className: "group absolute top-0 size-full select-none",
2375
+ contentEditable: false,
2376
+ suppressContentEditableWarning: true
1868
2377
  },
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",
2378
+ !readOnly && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
2379
+ plateResizable.ResizeHandle,
1871
2380
  {
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"
2381
+ ...rightProps,
2382
+ className: "-top-3 right-[-5px] w-[10px]"
2383
+ }
2384
+ ), /* @__PURE__ */ React.createElement(
2385
+ plateResizable.ResizeHandle,
2386
+ {
2387
+ ...bottomProps,
2388
+ className: "bottom-[-5px] h-[10px]"
2389
+ }
2390
+ ), !hiddenLeft && /* @__PURE__ */ React.createElement(
2391
+ plateResizable.ResizeHandle,
2392
+ {
2393
+ ...leftProps,
2394
+ className: "-top-3 left-[-5px] w-[10px]"
2395
+ }
2396
+ ), hovered && /* @__PURE__ */ React.createElement(
2397
+ "div",
2398
+ {
2399
+ className: cn$1.cn(
2400
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2401
+ "right-[-1.5px]"
1875
2402
  )
1876
- },
1877
- item.render(item)
1878
- ))))
1879
- )
2403
+ }
2404
+ ), hoveredLeft && /* @__PURE__ */ React.createElement(
2405
+ "div",
2406
+ {
2407
+ className: cn$1.cn(
2408
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2409
+ "left-[-1.5px]"
2410
+ )
2411
+ }
2412
+ ))
2413
+ ))
1880
2414
  );
1881
- };
1882
- MonacoEditor.loader.config({
1883
- paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
1884
2415
  });
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);
2416
+ TableCellElement.displayName = "TableCellElement";
2417
+ const TableCellHeaderElement = cn$1.withProps(TableCellElement, {
2418
+ isHeader: true
2419
+ });
2420
+ const buttonVariants$1 = classVarianceAuthority.cva(
2421
+ "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",
2422
+ {
2423
+ defaultVariants: {
2424
+ size: "default",
2425
+ variant: "default"
2426
+ },
2427
+ variants: {
2428
+ isMenu: {
2429
+ true: "h-auto w-full cursor-pointer justify-start"
2430
+ },
2431
+ size: {
2432
+ default: "h-10 px-4 py-2",
2433
+ icon: "size-10",
2434
+ lg: "h-11 rounded-md px-8",
2435
+ none: "",
2436
+ sm: "h-9 rounded-md px-3",
2437
+ sms: "size-9 rounded-md px-0",
2438
+ xs: "h-8 rounded-md px-3"
2439
+ },
2440
+ variant: {
2441
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
2442
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
2443
+ ghost: "hover:bg-accent hover:text-accent-foreground",
2444
+ inlineLink: "text-base text-primary underline underline-offset-4",
2445
+ link: "text-primary underline-offset-4 hover:underline",
2446
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
2447
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
2448
+ }
1913
2449
  }
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
2450
  }
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
- });
2451
+ );
2452
+ const Button$2 = cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
2453
+ const Comp = asChild ? reactSlot.Slot : "button";
2454
+ return /* @__PURE__ */ React__namespace.createElement(
2455
+ Comp,
2456
+ {
2457
+ className: cn$1.cn(buttonVariants$1({ className, isMenu, size, variant })),
2458
+ ref,
2459
+ ...props
1939
2460
  }
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
- }
2461
+ );
2462
+ });
2463
+ const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
2464
+ const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
2465
+ const DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
2466
+ const DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
2467
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
2468
+ const DropdownMenuSubTrigger = cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
2469
+ DropdownMenuPrimitive__namespace.SubTrigger,
2470
+ {
2471
+ className: cn$1.cn(
2472
+ "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",
2473
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2474
+ inset && "pl-8",
2475
+ className
2476
+ ),
2477
+ ref,
2478
+ ...props
2479
+ },
2480
+ children,
2481
+ /* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
2482
+ ));
2483
+ const DropdownMenuSubContent = cn$1.withCn(
2484
+ DropdownMenuPrimitive__namespace.SubContent,
2485
+ "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"
2486
+ );
2487
+ const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
2488
+ className: cn$1.cn(
2489
+ "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"
2490
+ ),
2491
+ sideOffset: 4
2492
+ });
2493
+ const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
2494
+ const menuItemVariants = classVarianceAuthority.cva(
2495
+ cn$1.cn(
2496
+ "relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
2497
+ "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
2498
+ ),
2499
+ {
2500
+ variants: {
2501
+ inset: {
2502
+ true: "pl-8"
2047
2503
  }
2048
2504
  }
2049
- }, [navigateAway]);
2050
- function handleEditorDidMount(monacoEditor, monaco2) {
2051
- monacoEditorRef.current = monacoEditor;
2052
- monacoEditor.onDidContentSizeChange(() => {
2053
- setHeight(monacoEditor.getContentHeight());
2054
- monacoEditor.layout();
2055
- });
2056
- monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
2057
- if (monacoEditor.hasTextFocus()) {
2058
- setNavigateAway("insertNext");
2059
- }
2060
- });
2061
- monacoEditor.onKeyDown((l) => {
2062
- if (l.code === "ArrowUp") {
2063
- const selection = monacoEditor.getSelection();
2064
- if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
2065
- setNavigateAway("up");
2066
- }
2067
- }
2068
- if (l.code === "ArrowDown") {
2069
- const selection = monacoEditor.getSelection();
2070
- const totalLines = monacoEditor.getModel().getLineCount();
2071
- if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
2072
- setNavigateAway("down");
2073
- }
2074
- }
2075
- if (l.code === "Backspace") {
2076
- const selection = monacoEditor.getSelection();
2077
- if (selection.endColumn === 1 && selection.endLineNumber === 1 && selection.positionColumn === 1 && selection.positionLineNumber === 1 && selection.selectionStartColumn === 1 && selection.selectionStartLineNumber === 1 && selection.startColumn === 1 && selection.startLineNumber === 1) {
2078
- setNavigateAway("remove");
2079
- }
2505
+ }
2506
+ );
2507
+ const DropdownMenuItem = cn$1.withVariants(
2508
+ DropdownMenuPrimitive__namespace.Item,
2509
+ menuItemVariants,
2510
+ ["inset"]
2511
+ );
2512
+ const DropdownMenuCheckboxItem = cn$1.withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React.createElement(
2513
+ DropdownMenuPrimitive__namespace.CheckboxItem,
2514
+ {
2515
+ className: cn$1.cn(
2516
+ "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",
2517
+ "cursor-pointer",
2518
+ className
2519
+ ),
2520
+ ref,
2521
+ ...props
2522
+ },
2523
+ /* @__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" }))),
2524
+ children
2525
+ ));
2526
+ const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
2527
+ DropdownMenuPrimitive__namespace.RadioItem,
2528
+ {
2529
+ className: cn$1.cn(
2530
+ "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",
2531
+ "h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
2532
+ className
2533
+ ),
2534
+ ref,
2535
+ ...props
2536
+ },
2537
+ !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" }))),
2538
+ children
2539
+ ));
2540
+ const dropdownMenuLabelVariants = classVarianceAuthority.cva(
2541
+ cn$1.cn("select-none px-2 py-1.5 text-sm font-semibold"),
2542
+ {
2543
+ variants: {
2544
+ inset: {
2545
+ true: "pl-8"
2080
2546
  }
2081
- });
2547
+ }
2082
2548
  }
2549
+ );
2550
+ const DropdownMenuLabel = cn$1.withVariants(
2551
+ DropdownMenuPrimitive__namespace.Label,
2552
+ dropdownMenuLabelVariants,
2553
+ ["inset"]
2554
+ );
2555
+ const DropdownMenuSeparator = cn$1.withCn(
2556
+ DropdownMenuPrimitive__namespace.Separator,
2557
+ "-mx-1 my-1 h-px bg-muted"
2558
+ );
2559
+ cn$1.withCn(
2560
+ cn$1.createPrimitiveElement("span"),
2561
+ "ml-auto text-xs tracking-widest opacity-60"
2562
+ );
2563
+ const useOpenState = () => {
2564
+ const [open2, setOpen] = React.useState(false);
2565
+ const onOpenChange = React.useCallback(
2566
+ (_value = !open2) => {
2567
+ setOpen(_value);
2568
+ },
2569
+ [open2]
2570
+ );
2571
+ return {
2572
+ onOpenChange,
2573
+ open: open2
2574
+ };
2575
+ };
2576
+ const Popover$2 = PopoverPrimitive__namespace.Root;
2577
+ const popoverVariants = classVarianceAuthority.cva(
2578
+ "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"
2579
+ );
2580
+ const PopoverContent$1 = cn$1.withRef(
2581
+ ({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
2582
+ PopoverPrimitive__namespace.Content,
2583
+ {
2584
+ align,
2585
+ className: cn$1.cn(popoverVariants(), className),
2586
+ ref,
2587
+ sideOffset,
2588
+ style: { zIndex: 1e3, ...style },
2589
+ ...props
2590
+ }
2591
+ ))
2592
+ );
2593
+ const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
2594
+ defaultVariants: {
2595
+ orientation: "horizontal"
2596
+ },
2597
+ variants: {
2598
+ orientation: {
2599
+ horizontal: "h-px w-full",
2600
+ vertical: "h-full w-px"
2601
+ }
2602
+ }
2603
+ });
2604
+ const Separator = cn$1.withVariants(
2605
+ cn$1.withProps(SeparatorPrimitive__namespace.Root, {
2606
+ decorative: true,
2607
+ orientation: "horizontal"
2608
+ }),
2609
+ separatorVariants
2610
+ );
2611
+ const TableBordersDropdownMenuContent = cn$1.withRef((props, ref) => {
2612
+ const {
2613
+ getOnSelectTableBorder,
2614
+ hasBottomBorder,
2615
+ hasLeftBorder,
2616
+ hasNoBorders,
2617
+ hasOuterBorders,
2618
+ hasRightBorder,
2619
+ hasTopBorder
2620
+ } = plateTable.useTableBordersDropdownMenuContentState();
2083
2621
  return /* @__PURE__ */ React.createElement(
2084
- "div",
2622
+ DropdownMenuContent,
2085
2623
  {
2086
- ...attributes,
2087
- className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
2624
+ align: "start",
2625
+ className: cn$1.cn("min-w-[220px]"),
2626
+ ref,
2627
+ side: "right",
2628
+ sideOffset: 0,
2629
+ ...props
2088
2630
  },
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,
2631
+ /* @__PURE__ */ React.createElement(
2632
+ DropdownMenuCheckboxItem,
2096
2633
  {
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,
2634
+ checked: hasBottomBorder,
2635
+ onCheckedChange: getOnSelectTableBorder("bottom")
2636
+ },
2637
+ /* @__PURE__ */ React.createElement(Icons.borderBottom, { className: iconVariants({ size: "sm" }) }),
2638
+ /* @__PURE__ */ React.createElement("div", null, "Bottom Border")
2639
+ ),
2640
+ /* @__PURE__ */ React.createElement(
2641
+ DropdownMenuCheckboxItem,
2104
2642
  {
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
- )))
2643
+ checked: hasTopBorder,
2644
+ onCheckedChange: getOnSelectTableBorder("top")
2645
+ },
2646
+ /* @__PURE__ */ React.createElement(Icons.borderTop, { className: iconVariants({ size: "sm" }) }),
2647
+ /* @__PURE__ */ React.createElement("div", null, "Top Border")
2648
+ ),
2649
+ /* @__PURE__ */ React.createElement(
2650
+ DropdownMenuCheckboxItem,
2651
+ {
2652
+ checked: hasLeftBorder,
2653
+ onCheckedChange: getOnSelectTableBorder("left")
2654
+ },
2655
+ /* @__PURE__ */ React.createElement(Icons.borderLeft, { className: iconVariants({ size: "sm" }) }),
2656
+ /* @__PURE__ */ React.createElement("div", null, "Left Border")
2657
+ ),
2658
+ /* @__PURE__ */ React.createElement(
2659
+ DropdownMenuCheckboxItem,
2660
+ {
2661
+ checked: hasRightBorder,
2662
+ onCheckedChange: getOnSelectTableBorder("right")
2663
+ },
2664
+ /* @__PURE__ */ React.createElement(Icons.borderRight, { className: iconVariants({ size: "sm" }) }),
2665
+ /* @__PURE__ */ React.createElement("div", null, "Right Border")
2666
+ ),
2667
+ /* @__PURE__ */ React.createElement(Separator, null),
2668
+ /* @__PURE__ */ React.createElement(
2669
+ DropdownMenuCheckboxItem,
2670
+ {
2671
+ checked: hasNoBorders,
2672
+ onCheckedChange: getOnSelectTableBorder("none")
2673
+ },
2674
+ /* @__PURE__ */ React.createElement(Icons.borderNone, { className: iconVariants({ size: "sm" }) }),
2675
+ /* @__PURE__ */ React.createElement("div", null, "No Border")
2676
+ ),
2677
+ /* @__PURE__ */ React.createElement(
2678
+ DropdownMenuCheckboxItem,
2679
+ {
2680
+ checked: hasOuterBorders,
2681
+ onCheckedChange: getOnSelectTableBorder("outer")
2682
+ },
2683
+ /* @__PURE__ */ React.createElement(Icons.borderAll, { className: iconVariants({ size: "sm" }) }),
2684
+ /* @__PURE__ */ React.createElement("div", null, "Outside Borders")
2685
+ )
2141
2686
  );
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,
2687
+ });
2688
+ const TableFloatingToolbar = cn$1.withRef(
2689
+ ({ children, ...props }, ref) => {
2690
+ const element = plateCommon.useElement();
2691
+ const { props: buttonProps } = plateCommon.useRemoveNodeButton({ element });
2692
+ const selectionCollapsed = plateCommon.useEditorSelector(
2693
+ (editor2) => !plateCommon.isSelectionExpanded(editor2),
2694
+ []
2695
+ );
2696
+ const readOnly = slateReact.useReadOnly();
2697
+ const selected = slateReact.useSelected();
2698
+ const editor = plateCommon.useEditorRef();
2699
+ const collapsed = !readOnly && selected && selectionCollapsed;
2700
+ const open2 = !readOnly && selected;
2701
+ const { canMerge, canUnmerge } = plateTable.useTableMergeState();
2702
+ const mergeContent = canMerge && /* @__PURE__ */ React.createElement(
2703
+ Button$2,
2149
2704
  {
2150
- className: cn$1.cn("relative py-1", state.className, className),
2705
+ contentEditable: false,
2706
+ isMenu: true,
2707
+ onClick: () => plateTable.mergeTableCells(editor),
2708
+ variant: "ghost"
2709
+ },
2710
+ /* @__PURE__ */ React.createElement(Icons.combine, { className: "mr-2 size-4" }),
2711
+ "Merge"
2712
+ );
2713
+ const unmergeButton = canUnmerge && /* @__PURE__ */ React.createElement(
2714
+ Button$2,
2715
+ {
2716
+ contentEditable: false,
2717
+ isMenu: true,
2718
+ onClick: () => plateTable.unmergeTableCells(editor),
2719
+ variant: "ghost"
2720
+ },
2721
+ /* @__PURE__ */ React.createElement(Icons.ungroup, { className: "mr-2 size-4" }),
2722
+ "Unmerge"
2723
+ );
2724
+ 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"));
2725
+ return /* @__PURE__ */ React.createElement(Popover$2, { modal: false, open: open2 }, /* @__PURE__ */ React.createElement(PopoverPrimitive.PopoverAnchor, { asChild: true }, children), (canMerge || canUnmerge || collapsed) && /* @__PURE__ */ React.createElement(
2726
+ PopoverContent$1,
2727
+ {
2728
+ className: cn$1.cn(
2729
+ popoverVariants(),
2730
+ "flex w-[220px] flex-col gap-1 p-1"
2731
+ ),
2732
+ onOpenAutoFocus: (e) => e.preventDefault(),
2151
2733
  ref,
2152
2734
  ...props
2153
2735
  },
2154
- /* @__PURE__ */ React.createElement(CodeBlock, { ...props })
2155
- );
2736
+ unmergeButton,
2737
+ mergeContent,
2738
+ bordersContent
2739
+ ));
2156
2740
  }
2157
2741
  );
2742
+ const TableElement = plateCommon.withHOC(
2743
+ plateTable.TableProvider,
2744
+ cn$1.withRef(({ children, className, ...props }, ref) => {
2745
+ const { colSizes, isSelectingCell, marginLeft, minColumnWidth } = plateTable.useTableElementState();
2746
+ const { colGroupProps, props: tableProps } = plateTable.useTableElement();
2747
+ return /* @__PURE__ */ React.createElement(TableFloatingToolbar, null, /* @__PURE__ */ React.createElement("div", { style: { paddingLeft: marginLeft } }, /* @__PURE__ */ React.createElement(
2748
+ plateCommon.PlateElement,
2749
+ {
2750
+ asChild: true,
2751
+ className: cn$1.cn(
2752
+ "my-4 ml-px mr-0 table h-px w-full table-fixed border-collapse",
2753
+ isSelectingCell && "[&_*::selection]:bg-none",
2754
+ className
2755
+ ),
2756
+ ref,
2757
+ ...tableProps,
2758
+ ...props
2759
+ },
2760
+ /* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("colgroup", { ...colGroupProps }, colSizes.map((width, index) => /* @__PURE__ */ React.createElement(
2761
+ "col",
2762
+ {
2763
+ key: index,
2764
+ style: {
2765
+ minWidth: minColumnWidth,
2766
+ width: width || void 0
2767
+ }
2768
+ }
2769
+ ))), /* @__PURE__ */ React.createElement("tbody", { className: "min-w-full" }, children))
2770
+ )));
2771
+ })
2772
+ );
2773
+ const TableRowElement = cn$1.withRef(({ children, hideBorder, ...props }, ref) => {
2774
+ return /* @__PURE__ */ React.createElement(
2775
+ plateCommon.PlateElement,
2776
+ {
2777
+ asChild: true,
2778
+ className: cn$1.cn("h-full", hideBorder && "border-none"),
2779
+ ref,
2780
+ ...props
2781
+ },
2782
+ /* @__PURE__ */ React.createElement("tr", null, children)
2783
+ );
2784
+ });
2158
2785
  const blockClasses = "mt-0.5";
2159
2786
  const headerClasses = "font-normal";
2160
2787
  const Components = () => {
@@ -2260,6 +2887,7 @@ var __publicField = (obj, key, value) => {
2260
2887
  }
2261
2888
  )
2262
2889
  ),
2890
+ [ELEMENT_MERMAID]: MermaidElement,
2263
2891
  [plate.ELEMENT_BLOCKQUOTE]: BlockquoteElement,
2264
2892
  [plate.ELEMENT_CODE_BLOCK]: CodeBlockElement,
2265
2893
  [plate.ELEMENT_CODE_LINE]: CodeLineElement,
@@ -2340,7 +2968,11 @@ var __publicField = (obj, key, value) => {
2340
2968
  children,
2341
2969
  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
2970
  );
2343
- }
2971
+ },
2972
+ [plate.ELEMENT_TABLE]: TableElement,
2973
+ [plate.ELEMENT_TR]: TableRowElement,
2974
+ [plate.ELEMENT_TD]: TableCellElement,
2975
+ [plate.ELEMENT_TH]: TableCellHeaderElement
2344
2976
  };
2345
2977
  };
2346
2978
  const createCodeBlockPlugin = plateCommon.createPluginFactory({
@@ -2750,7 +3382,9 @@ var __publicField = (obj, key, value) => {
2750
3382
  {
2751
3383
  type: "string",
2752
3384
  label: "Caption",
2753
- name: [templateName.replace(/\.props$/, ""), "caption"].join("."),
3385
+ name: [templateName.replace(/\.props$/, ""), "caption"].join(
3386
+ "."
3387
+ ),
2754
3388
  component: "text"
2755
3389
  }
2756
3390
  ]
@@ -3068,7 +3702,7 @@ var __publicField = (obj, key, value) => {
3068
3702
  };
3069
3703
  const sizeClasses = {
3070
3704
  small: `text-xs h-8 px-3`,
3071
- medium: `text-sm h-10 px-4`,
3705
+ medium: `text-sm h-10 px-8`,
3072
3706
  custom: ``
3073
3707
  };
3074
3708
  return /* @__PURE__ */ React__namespace.createElement(
@@ -4301,7 +4935,28 @@ var __publicField = (obj, key, value) => {
4301
4935
  onChange,
4302
4936
  value,
4303
4937
  step
4304
- }) => /* @__PURE__ */ React__namespace.createElement(Input, { type: "number", step, value, onChange });
4938
+ }) => /* @__PURE__ */ React__namespace.createElement(
4939
+ Input,
4940
+ {
4941
+ type: "number",
4942
+ step,
4943
+ value,
4944
+ onChange: (event) => {
4945
+ const inputValue = event.target.value;
4946
+ const newValue = inputValue === "" ? void 0 : inputValue;
4947
+ if (onChange) {
4948
+ const syntheticEvent = {
4949
+ ...event,
4950
+ target: {
4951
+ ...event.target,
4952
+ value: newValue
4953
+ }
4954
+ };
4955
+ onChange(syntheticEvent);
4956
+ }
4957
+ }
4958
+ }
4959
+ );
4305
4960
  function useCMS() {
4306
4961
  return useCMS$1();
4307
4962
  }
@@ -4410,7 +5065,7 @@ var __publicField = (obj, key, value) => {
4410
5065
  function cn(...inputs) {
4411
5066
  return tailwindMerge.twMerge(clsx.clsx(inputs));
4412
5067
  }
4413
- const buttonVariants$1 = classVarianceAuthority.cva(
5068
+ const buttonVariants = classVarianceAuthority.cva(
4414
5069
  "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
5070
  {
4416
5071
  variants: {
@@ -4436,7 +5091,7 @@ var __publicField = (obj, key, value) => {
4436
5091
  return /* @__PURE__ */ React__namespace.createElement(
4437
5092
  Comp,
4438
5093
  {
4439
- className: cn(buttonVariants$1({ variant, size, className })),
5094
+ className: cn(buttonVariants({ variant, size, className })),
4440
5095
  ref,
4441
5096
  ...props
4442
5097
  }
@@ -5102,10 +5757,11 @@ var __publicField = (obj, key, value) => {
5102
5757
  return /* @__PURE__ */ React.createElement(
5103
5758
  "button",
5104
5759
  {
5105
- className: `w-8 px-1 py-2.5 flex items-center justify-center hover:bg-gray-50 text-gray-200 hover:text-red-500 ${disabled && "pointer-events-none opacity-30 cursor-not-allowed"}`,
5760
+ type: "button",
5761
+ className: `w-8 px-1 py-2.5 flex items-center justify-center text-gray-200 hover:opacity-100 opacity-30 hover:bg-gray-50 ${disabled && "pointer-events-none opacity-30 cursor-not-allowed"}`,
5106
5762
  onClick
5107
5763
  },
5108
- /* @__PURE__ */ React.createElement(TrashIcon, { className: "fill-current transition-colors ease-out duration-100" })
5764
+ /* @__PURE__ */ React.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
5109
5765
  );
5110
5766
  };
5111
5767
  const DragHandle = ({ isDragging }) => {
@@ -5135,7 +5791,7 @@ var __publicField = (obj, key, value) => {
5135
5791
  return template.label ? template.label.toLowerCase().includes(filter.toLowerCase()) || name.toLowerCase().includes(filter.toLowerCase()) : name.toLowerCase().includes(filter.toLowerCase());
5136
5792
  });
5137
5793
  }, [filter]);
5138
- 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(
5794
+ 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(
5139
5795
  IconButton,
5140
5796
  {
5141
5797
  variant: open2 ? "secondary" : "primary",
@@ -5144,7 +5800,7 @@ var __publicField = (obj, key, value) => {
5144
5800
  },
5145
5801
  /* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
5146
5802
  )), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute -bottom-1 right-0 z-50" }, /* @__PURE__ */ React__namespace.createElement(
5147
- react$1.Transition,
5803
+ react.Transition,
5148
5804
  {
5149
5805
  enter: "transition duration-150 ease-out",
5150
5806
  enterFrom: "transform opacity-0 -translate-y-2",
@@ -5153,7 +5809,7 @@ var __publicField = (obj, key, value) => {
5153
5809
  leaveFrom: "transform opacity-100 translate-y-0",
5154
5810
  leaveTo: "transform opacity-0 -translate-y-2"
5155
5811
  },
5156
- /* @__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(
5812
+ /* @__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(
5157
5813
  "input",
5158
5814
  {
5159
5815
  type: "text",
@@ -5183,27 +5839,35 @@ var __publicField = (obj, key, value) => {
5183
5839
  ))))
5184
5840
  ))));
5185
5841
  };
5186
- const Group = wrapFieldWithError(({ tinaForm, field }) => {
5187
- const cms = useCMS$1();
5188
- React__namespace.useState(false);
5189
- return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
5190
- Header,
5191
- {
5192
- onClick: () => {
5193
- const state = tinaForm.finalForm.getState();
5194
- if (state.invalid === true) {
5195
- cms.alerts.error("Cannot navigate away from an invalid form.");
5196
- return;
5842
+ const Group = wrapFieldWithNoHeader(
5843
+ ({ tinaForm, field }) => {
5844
+ const cms = useCMS$1();
5845
+ return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
5846
+ Header,
5847
+ {
5848
+ onClick: () => {
5849
+ const state = tinaForm.finalForm.getState();
5850
+ if (state.invalid === true) {
5851
+ cms.alerts.error("Cannot navigate away from an invalid form.");
5852
+ return;
5853
+ }
5854
+ cms.dispatch({
5855
+ type: "forms:set-active-field-name",
5856
+ value: { formId: tinaForm.id, fieldName: field.name }
5857
+ });
5197
5858
  }
5198
- cms.dispatch({
5199
- type: "forms:set-active-field-name",
5200
- value: { formId: tinaForm.id, fieldName: field.name }
5201
- });
5202
- }
5203
- },
5204
- field.label || field.name
5205
- ));
5206
- });
5859
+ },
5860
+ field.label || field.name,
5861
+ field.description && /* @__PURE__ */ React__namespace.createElement(
5862
+ "span",
5863
+ {
5864
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
5865
+ dangerouslySetInnerHTML: { __html: field.description }
5866
+ }
5867
+ )
5868
+ ));
5869
+ }
5870
+ );
5207
5871
  const Header = ({ onClick, children }) => {
5208
5872
  return /* @__PURE__ */ React__namespace.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React__namespace.createElement(
5209
5873
  "button",
@@ -5330,8 +5994,8 @@ var __publicField = (obj, key, value) => {
5330
5994
  onClick: () => setPickerIsOpen(!pickerIsOpen)
5331
5995
  },
5332
5996
  /* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
5333
- ), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react$1.Transition, { show: pickerIsOpen }, /* @__PURE__ */ React__namespace.createElement(
5334
- react$1.TransitionChild,
5997
+ ), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: pickerIsOpen }, /* @__PURE__ */ React__namespace.createElement(
5998
+ react.TransitionChild,
5335
5999
  {
5336
6000
  enter: "transform transition-all ease-out duration-200",
5337
6001
  enterFrom: "opacity-0 -translate-x-1/2",
@@ -5418,14 +6082,14 @@ var __publicField = (obj, key, value) => {
5418
6082
  };
5419
6083
  const BlockGroup = ({ category, templates, close: close2, isLast = false }) => {
5420
6084
  return /* @__PURE__ */ React__namespace.createElement(
5421
- react$1.Disclosure,
6085
+ react.Disclosure,
5422
6086
  {
5423
6087
  defaultOpen: true,
5424
6088
  as: "div",
5425
6089
  className: `left-0 right-0 relative`
5426
6090
  },
5427
6091
  ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
5428
- react$1.DisclosureButton,
6092
+ react.DisclosureButton,
5429
6093
  {
5430
6094
  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`}`
5431
6095
  },
@@ -5443,7 +6107,7 @@ var __publicField = (obj, key, value) => {
5443
6107
  }
5444
6108
  )
5445
6109
  ), /* @__PURE__ */ React__namespace.createElement(
5446
- react$1.Transition,
6110
+ react.Transition,
5447
6111
  {
5448
6112
  enter: "transition duration-100 ease-out",
5449
6113
  enterFrom: "transform scale-95 opacity-0",
@@ -5452,7 +6116,7 @@ var __publicField = (obj, key, value) => {
5452
6116
  leaveFrom: "transform scale-100 opacity-100",
5453
6117
  leaveTo: "transform scale-95 opacity-0"
5454
6118
  },
5455
- /* @__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(
6119
+ /* @__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(
5456
6120
  BlockCard,
5457
6121
  {
5458
6122
  key: index,
@@ -7369,7 +8033,10 @@ var __publicField = (obj, key, value) => {
7369
8033
  ReactDateTimeWithStyles,
7370
8034
  {
7371
8035
  value: input.value,
7372
- onChange: input.onChange,
8036
+ onChange: (value) => {
8037
+ const newValue = value === "" ? void 0 : value;
8038
+ input.onChange(newValue);
8039
+ },
7373
8040
  dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
7374
8041
  timeFormat: timeFormat || false,
7375
8042
  inputProps: { className: textFieldClasses },
@@ -9271,7 +9938,7 @@ var __publicField = (obj, key, value) => {
9271
9938
  const FormLists = (props) => {
9272
9939
  const cms = useCMS();
9273
9940
  return /* @__PURE__ */ React__namespace.createElement(
9274
- react$1.Transition,
9941
+ react.Transition,
9275
9942
  {
9276
9943
  appear: true,
9277
9944
  show: true,
@@ -9700,7 +10367,7 @@ var __publicField = (obj, key, value) => {
9700
10367
  "Event Log"
9701
10368
  ));
9702
10369
  };
9703
- const version = "2.2.8";
10370
+ const version = "2.5.1";
9704
10371
  const Nav = ({
9705
10372
  isLocalMode,
9706
10373
  className = "",
@@ -9754,8 +10421,8 @@ var __publicField = (obj, key, value) => {
9754
10421
  style: { maxWidth: `${sidebarWidth}px` },
9755
10422
  ...props
9756
10423
  },
9757
- /* @__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(
9758
- react$1.MenuButton,
10424
+ /* @__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(
10425
+ react.MenuButton,
9759
10426
  {
9760
10427
  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"}`
9761
10428
  },
@@ -9778,7 +10445,7 @@ var __publicField = (obj, key, value) => {
9778
10445
  }
9779
10446
  )
9780
10447
  ), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute bottom-3 right-5 z-50" }, /* @__PURE__ */ React__namespace.createElement(
9781
- react$1.Transition,
10448
+ react.Transition,
9782
10449
  {
9783
10450
  enter: "transition duration-150 ease-out",
9784
10451
  enterFrom: "transform opacity-0 -translate-y-2",
@@ -9787,7 +10454,7 @@ var __publicField = (obj, key, value) => {
9787
10454
  leaveFrom: "transform opacity-100 translate-y-0",
9788
10455
  leaveTo: "transform opacity-0 -translate-y-2"
9789
10456
  },
9790
- /* @__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(
10457
+ /* @__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(
9791
10458
  "button",
9792
10459
  {
9793
10460
  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`,
@@ -9820,7 +10487,7 @@ var __publicField = (obj, key, value) => {
9820
10487
  },
9821
10488
  /* @__PURE__ */ React__namespace.createElement(BiExit, { className: "w-6 h-auto mr-2 text-blue-400" }),
9822
10489
  " Log Out"
9823
- )), /* @__PURE__ */ React__namespace.createElement(react$1.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
10490
+ )), /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
9824
10491
  WrappedSyncStatus,
9825
10492
  {
9826
10493
  cms,
@@ -10166,8 +10833,8 @@ var __publicField = (obj, key, value) => {
10166
10833
  screen: activeScreen,
10167
10834
  close: () => setActiveView(null)
10168
10835
  }
10169
- )), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react$1.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
10170
- react$1.TransitionChild,
10836
+ )), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
10837
+ react.TransitionChild,
10171
10838
  {
10172
10839
  enter: "transform transition-all ease-out duration-300",
10173
10840
  enterFrom: "opacity-0 -translate-x-full",
@@ -10232,7 +10899,7 @@ var __publicField = (obj, key, value) => {
10232
10899
  ))
10233
10900
  ))
10234
10901
  ), /* @__PURE__ */ React__namespace.createElement(
10235
- react$1.TransitionChild,
10902
+ react.TransitionChild,
10236
10903
  {
10237
10904
  enter: "ease-out duration-300",
10238
10905
  enterFrom: "opacity-0",
@@ -12231,15 +12898,14 @@ var __publicField = (obj, key, value) => {
12231
12898
  fields: fieldGroup.fields
12232
12899
  }
12233
12900
  ) : /* @__PURE__ */ React__namespace.createElement(NoFieldsPlaceholder, null)
12234
- )), !hideFooter && /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-none w-full h-16 px-6 bg-white border-t border-gray-100 flex items-center justify-center" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 w-full flex justify-between gap-4 items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React__namespace.createElement(
12901
+ )), !hideFooter && /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-none w-full h-16 px-12 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React__namespace.createElement(
12235
12902
  ResetForm,
12236
12903
  {
12237
12904
  pristine,
12238
12905
  reset: async () => {
12239
12906
  finalForm2.reset();
12240
12907
  await tinaForm.reset();
12241
- },
12242
- style: { flexGrow: 1 }
12908
+ }
12243
12909
  },
12244
12910
  tinaForm.buttons.reset
12245
12911
  ), /* @__PURE__ */ React__namespace.createElement(
@@ -12248,8 +12914,7 @@ var __publicField = (obj, key, value) => {
12248
12914
  onClick: safeHandleSubmit,
12249
12915
  disabled: !canSubmit,
12250
12916
  busy: submitting,
12251
- variant: "primary",
12252
- style: { flexGrow: 3 }
12917
+ variant: "primary"
12253
12918
  },
12254
12919
  submitting && /* @__PURE__ */ React__namespace.createElement(LoadingDots, null),
12255
12920
  !submitting && tinaForm.buttons.save
@@ -12767,15 +13432,15 @@ var __publicField = (obj, key, value) => {
12767
13432
  );
12768
13433
  };
12769
13434
  const DotMenu = ({ onOpen, onRemove }) => {
12770
- return /* @__PURE__ */ React.createElement(react$1.Popover, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React.createElement(
12771
- react$1.PopoverButton,
13435
+ return /* @__PURE__ */ React.createElement(react.Popover, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React.createElement(
13436
+ react.PopoverButton,
12772
13437
  {
12773
13438
  as: "span",
12774
13439
  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"
12775
13440
  },
12776
13441
  /* @__PURE__ */ React.createElement(EllipsisIcon, { title: "Open options" })
12777
13442
  ), /* @__PURE__ */ React.createElement(
12778
- react$1.Transition,
13443
+ react.Transition,
12779
13444
  {
12780
13445
  enter: "transition ease-out duration-100",
12781
13446
  enterFrom: "transform opacity-0 scale-95",
@@ -12784,7 +13449,7 @@ var __publicField = (obj, key, value) => {
12784
13449
  leaveFrom: "transform opacity-100 scale-100",
12785
13450
  leaveTo: "transform opacity-0 scale-95"
12786
13451
  },
12787
- /* @__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(
13452
+ /* @__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(
12788
13453
  "span",
12789
13454
  {
12790
13455
  onClick: onOpen,
@@ -13207,13 +13872,26 @@ var __publicField = (obj, key, value) => {
13207
13872
  plate.createUnderlinePlugin(),
13208
13873
  plate.createCodePlugin(),
13209
13874
  plate.createListPlugin(),
13210
- plate.createIndentPlugin(),
13211
13875
  plate.createIndentListPlugin(),
13212
13876
  plate.createHorizontalRulePlugin(),
13213
13877
  // Allows us to do things like copy/paste, remembering the state of the element (like mdx)
13214
13878
  plate.createNodeIdPlugin(),
13215
- plateSlashCommand.createSlashPlugin()
13879
+ plateSlashCommand.createSlashPlugin(),
13880
+ plate.createTablePlugin()
13216
13881
  ];
13882
+ const unsupportedItemsInTable = /* @__PURE__ */ new Set([
13883
+ "Code Block",
13884
+ "Unordered List",
13885
+ "Ordered List",
13886
+ "Quote",
13887
+ "Mermaid",
13888
+ "Heading 1",
13889
+ "Heading 2",
13890
+ "Heading 3",
13891
+ "Heading 4",
13892
+ "Heading 5",
13893
+ "Heading 6"
13894
+ ]);
13217
13895
  const isNodeActive = (editor, type) => {
13218
13896
  const pluginType = plateCommon.getPluginType(editor, type);
13219
13897
  return !!(editor == null ? void 0 : editor.selection) && plateCommon.someNode(editor, { match: { type: pluginType } });
@@ -13398,24 +14076,6 @@ var __publicField = (obj, key, value) => {
13398
14076
  }
13399
14077
  );
13400
14078
  Editor.displayName = "Editor";
13401
- const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
13402
- defaultVariants: {
13403
- orientation: "horizontal"
13404
- },
13405
- variants: {
13406
- orientation: {
13407
- horizontal: "h-px w-full",
13408
- vertical: "h-full w-px"
13409
- }
13410
- }
13411
- });
13412
- const Separator = cn$1.withVariants(
13413
- cn$1.withProps(SeparatorPrimitive__namespace.Root, {
13414
- decorative: true,
13415
- orientation: "horizontal"
13416
- }),
13417
- separatorVariants
13418
- );
13419
14079
  const TooltipProvider = TooltipPrimitive__namespace.Provider;
13420
14080
  const Tooltip = TooltipPrimitive__namespace.Root;
13421
14081
  const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
@@ -13424,7 +14084,7 @@ var __publicField = (obj, key, value) => {
13424
14084
  cn$1.withProps(TooltipPrimitive__namespace.Content, {
13425
14085
  sideOffset: 4
13426
14086
  }),
13427
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
14087
+ "z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
13428
14088
  );
13429
14089
  function withTooltip(Component) {
13430
14090
  return React.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
@@ -13550,140 +14210,41 @@ var __publicField = (obj, key, value) => {
13550
14210
  Toolbar,
13551
14211
  "p-1 sticky left-0 top-0 z-50 w-full justify-between overflow-x-auto border border-border bg-background"
13552
14212
  );
13553
- const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
13554
- const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
13555
- const { props } = plateCommon.useMarkToolbarButton(state);
13556
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
13557
- });
13558
- const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
13559
- const editor = plateCommon.useEditorState();
13560
- const state = plate.useListToolbarButtonState({ nodeType });
13561
- const { props } = plate.useListToolbarButton(state);
13562
- return /* @__PURE__ */ React.createElement(
13563
- ToolbarButton,
13564
- {
13565
- ref,
13566
- tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
13567
- ...props,
13568
- onClick: (e) => {
13569
- e.preventDefault();
13570
- e.stopPropagation();
13571
- plate.toggleList(editor, { type: nodeType });
13572
- }
13573
- },
13574
- nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
13575
- );
13576
- });
13577
- const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
13578
- const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
13579
- const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
13580
- cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
13581
- DropdownMenuPrimitive__namespace.SubTrigger,
13582
- {
13583
- className: cn$1.cn(
13584
- "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",
13585
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13586
- inset && "pl-8",
13587
- className
13588
- ),
13589
- ref,
13590
- ...props
13591
- },
13592
- children,
13593
- /* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
13594
- ));
13595
- cn$1.withCn(
13596
- DropdownMenuPrimitive__namespace.SubContent,
13597
- "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"
13598
- );
13599
- const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
13600
- className: cn$1.cn(
13601
- "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"
13602
- ),
13603
- sideOffset: 4
13604
- });
13605
- const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
13606
- const menuItemVariants = classVarianceAuthority.cva(
13607
- cn$1.cn(
13608
- "relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
13609
- "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
13610
- ),
13611
- {
13612
- variants: {
13613
- inset: {
13614
- true: "pl-8"
14213
+ const useResize = (ref, callback) => {
14214
+ React.useEffect(() => {
14215
+ const resizeObserver = new ResizeObserver((entries) => {
14216
+ for (const entry of entries) {
14217
+ callback(entry);
13615
14218
  }
14219
+ });
14220
+ if (ref.current) {
14221
+ resizeObserver.observe(ref.current);
13616
14222
  }
13617
- }
13618
- );
13619
- const DropdownMenuItem = cn$1.withVariants(
13620
- DropdownMenuPrimitive__namespace.Item,
13621
- menuItemVariants,
13622
- ["inset"]
13623
- );
13624
- cn$1.withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React.createElement(
13625
- DropdownMenuPrimitive__namespace.CheckboxItem,
13626
- {
13627
- className: cn$1.cn(
13628
- "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",
13629
- "cursor-pointer",
13630
- className
13631
- ),
13632
- ref,
13633
- ...props
13634
- },
13635
- /* @__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" }))),
13636
- children
13637
- ));
13638
- const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
13639
- DropdownMenuPrimitive__namespace.RadioItem,
13640
- {
13641
- className: cn$1.cn(
13642
- "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",
13643
- "h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
13644
- className
13645
- ),
13646
- ref,
13647
- ...props
13648
- },
13649
- !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" }))),
14223
+ return () => resizeObserver.disconnect();
14224
+ }, [ref.current]);
14225
+ };
14226
+ const STANDARD_ICON_WIDTH = 32;
14227
+ const HEADING_ICON_WITH_TEXT = 127;
14228
+ const HEADING_ICON_ONLY = 58;
14229
+ const EMBED_ICON_WIDTH = 78;
14230
+ const CONTAINER_MD_BREAKPOINT = 448;
14231
+ const FLOAT_BUTTON_WIDTH = 25;
14232
+ const HEADING_LABEL = "Headings";
14233
+ const ToolbarContext = React.createContext(void 0);
14234
+ const ToolbarProvider = ({
14235
+ tinaForm,
14236
+ templates,
14237
+ overrides,
13650
14238
  children
13651
- ));
13652
- const dropdownMenuLabelVariants = classVarianceAuthority.cva(
13653
- cn$1.cn("select-none px-2 py-1.5 text-sm font-semibold"),
13654
- {
13655
- variants: {
13656
- inset: {
13657
- true: "pl-8"
13658
- }
13659
- }
14239
+ }) => {
14240
+ return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
14241
+ };
14242
+ const useToolbarContext = () => {
14243
+ const context = React.useContext(ToolbarContext);
14244
+ if (!context) {
14245
+ throw new Error("useToolbarContext must be used within a ToolbarProvider");
13660
14246
  }
13661
- );
13662
- const DropdownMenuLabel = cn$1.withVariants(
13663
- DropdownMenuPrimitive__namespace.Label,
13664
- dropdownMenuLabelVariants,
13665
- ["inset"]
13666
- );
13667
- const DropdownMenuSeparator = cn$1.withCn(
13668
- DropdownMenuPrimitive__namespace.Separator,
13669
- "-mx-1 my-1 h-px bg-muted"
13670
- );
13671
- cn$1.withCn(
13672
- cn$1.createPrimitiveElement("span"),
13673
- "ml-auto text-xs tracking-widest opacity-60"
13674
- );
13675
- const useOpenState = () => {
13676
- const [open2, setOpen] = React.useState(false);
13677
- const onOpenChange = React.useCallback(
13678
- (_value = !open2) => {
13679
- setOpen(_value);
13680
- },
13681
- [open2]
13682
- );
13683
- return {
13684
- onOpenChange,
13685
- open: open2
13686
- };
14247
+ return context;
13687
14248
  };
13688
14249
  const items$1 = [
13689
14250
  {
@@ -13749,7 +14310,9 @@ var __publicField = (obj, key, value) => {
13749
14310
  return allNodesMatchInitialNodeType ? initialNodeType : plateParagraph.ELEMENT_PARAGRAPH;
13750
14311
  }, []);
13751
14312
  const editor = plateCommon.useEditorRef();
14313
+ const editorState = plateCommon.useEditorState();
13752
14314
  const openState = useOpenState();
14315
+ const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
13753
14316
  const selectedItem = items$1.find((item) => item.value === value) ?? defaultItem$1;
13754
14317
  const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
13755
14318
  return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
@@ -13773,7 +14336,12 @@ var __publicField = (obj, key, value) => {
13773
14336
  },
13774
14337
  value
13775
14338
  },
13776
- items$1.map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
14339
+ items$1.filter((item) => {
14340
+ if (userInTable) {
14341
+ return !unsupportedItemsInTable.has(item.label);
14342
+ }
14343
+ return true;
14344
+ }).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
13777
14345
  DropdownMenuRadioItem,
13778
14346
  {
13779
14347
  className: "min-w-[180px]",
@@ -13785,42 +14353,6 @@ var __publicField = (obj, key, value) => {
13785
14353
  ))
13786
14354
  )));
13787
14355
  }
13788
- const LinkToolbarButton = cn$1.withRef((rest, ref) => {
13789
- const state = plateLink.useLinkToolbarButtonState();
13790
- const { props } = plateLink.useLinkToolbarButton(state);
13791
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
13792
- });
13793
- const useBlockQuoteToolbarButtonState = () => {
13794
- const editor = plateCommon.useEditorState();
13795
- const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
13796
- return {
13797
- pressed: isBlockActive()
13798
- };
13799
- };
13800
- const useBlockQuoteToolbarButton = (state) => {
13801
- const editor = plateCommon.useEditorState();
13802
- const onClick = () => {
13803
- plateCommon.toggleNodeType(editor, {
13804
- activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
13805
- });
13806
- };
13807
- const onMouseDown = (e) => {
13808
- e.preventDefault();
13809
- e.stopPropagation();
13810
- };
13811
- return {
13812
- props: {
13813
- onClick,
13814
- onMouseDown,
13815
- pressed: state.pressed
13816
- }
13817
- };
13818
- };
13819
- const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
13820
- const state = useBlockQuoteToolbarButtonState();
13821
- const { props } = useBlockQuoteToolbarButton(state);
13822
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
13823
- });
13824
14356
  const useCodeBlockToolbarButtonState = () => {
13825
14357
  const editor = plateCommon.useEditorState();
13826
14358
  const isBlockActive = () => helpers.isNodeActive(editor, plateCodeBlock.ELEMENT_CODE_BLOCK);
@@ -13882,6 +14414,116 @@ var __publicField = (obj, key, value) => {
13882
14414
  const { props } = useImageToolbarButton(state);
13883
14415
  return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
13884
14416
  });
14417
+ const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
14418
+ const editor = plateCommon.useEditorState();
14419
+ const state = plate.useListToolbarButtonState({ nodeType });
14420
+ const { props } = plate.useListToolbarButton(state);
14421
+ return /* @__PURE__ */ React.createElement(
14422
+ ToolbarButton,
14423
+ {
14424
+ ref,
14425
+ tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
14426
+ ...props,
14427
+ onClick: (e) => {
14428
+ e.preventDefault();
14429
+ e.stopPropagation();
14430
+ plate.toggleList(editor, { type: nodeType });
14431
+ }
14432
+ },
14433
+ nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
14434
+ );
14435
+ });
14436
+ const LinkToolbarButton = cn$1.withRef((rest, ref) => {
14437
+ const state = plateLink.useLinkToolbarButtonState();
14438
+ const { props } = plateLink.useLinkToolbarButton(state);
14439
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
14440
+ });
14441
+ const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
14442
+ const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
14443
+ const { props } = plateCommon.useMarkToolbarButton(state);
14444
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
14445
+ });
14446
+ const useMermaidToolbarButtonState = () => {
14447
+ const editor = plateCommon.useEditorState();
14448
+ const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_MERMAID);
14449
+ return {
14450
+ pressed: isBlockActive()
14451
+ };
14452
+ };
14453
+ const useMermaidToolbarButton = (state) => {
14454
+ const editor = plateCommon.useEditorState();
14455
+ const onClick = () => {
14456
+ plateCommon.insertEmptyElement(editor, ELEMENT_MERMAID, {
14457
+ nextBlock: true,
14458
+ select: true
14459
+ });
14460
+ };
14461
+ const onMouseDown = (e) => {
14462
+ e.preventDefault();
14463
+ e.stopPropagation();
14464
+ };
14465
+ return {
14466
+ props: {
14467
+ onClick,
14468
+ onMouseDown,
14469
+ pressed: state.pressed
14470
+ }
14471
+ };
14472
+ };
14473
+ const MermaidToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14474
+ const state = useMermaidToolbarButtonState();
14475
+ const { props } = useMermaidToolbarButton(state);
14476
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Mermaid", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.mermaid, null));
14477
+ });
14478
+ function OverflowMenu({
14479
+ children,
14480
+ ...props
14481
+ }) {
14482
+ const openState = useOpenState();
14483
+ return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
14484
+ ToolbarButton,
14485
+ {
14486
+ showArrow: false,
14487
+ "data-testid": "rich-text-editor-overflow-menu-button",
14488
+ className: "lg:min-w-[130px]",
14489
+ isDropdown: true,
14490
+ pressed: openState.open,
14491
+ tooltip: "Headings"
14492
+ },
14493
+ /* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
14494
+ )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
14495
+ }
14496
+ const useBlockQuoteToolbarButtonState = () => {
14497
+ const editor = plateCommon.useEditorState();
14498
+ const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
14499
+ return {
14500
+ pressed: isBlockActive()
14501
+ };
14502
+ };
14503
+ const useBlockQuoteToolbarButton = (state) => {
14504
+ const editor = plateCommon.useEditorState();
14505
+ const onClick = () => {
14506
+ plateCommon.toggleNodeType(editor, {
14507
+ activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
14508
+ });
14509
+ };
14510
+ const onMouseDown = (e) => {
14511
+ e.preventDefault();
14512
+ e.stopPropagation();
14513
+ };
14514
+ return {
14515
+ props: {
14516
+ onClick,
14517
+ onMouseDown,
14518
+ pressed: state.pressed
14519
+ }
14520
+ };
14521
+ };
14522
+ const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14523
+ const state = useBlockQuoteToolbarButtonState();
14524
+ const { props } = useBlockQuoteToolbarButton(state);
14525
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
14526
+ });
13885
14527
  const useRawMarkdownToolbarButton = () => {
13886
14528
  const { setRawMode } = useEditorContext();
13887
14529
  const onMouseDown = (e) => {
@@ -13896,31 +14538,123 @@ var __publicField = (obj, key, value) => {
13896
14538
  };
13897
14539
  const RawMarkdownToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
13898
14540
  const { props } = useRawMarkdownToolbarButton();
13899
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.raw, null));
14541
+ return /* @__PURE__ */ React.createElement(
14542
+ ToolbarButton,
14543
+ {
14544
+ ref,
14545
+ tooltip: "Link",
14546
+ ...rest,
14547
+ ...props,
14548
+ "data-testid": "markdown-button"
14549
+ },
14550
+ /* @__PURE__ */ React.createElement(Icons.raw, null)
14551
+ );
13900
14552
  });
13901
- const ToolbarContext = React.createContext(void 0);
13902
- const ToolbarProvider = ({
13903
- tinaForm,
13904
- templates,
13905
- overrides,
13906
- children
13907
- }) => {
13908
- return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
13909
- };
13910
- const useToolbarContext = () => {
13911
- const context = React.useContext(ToolbarContext);
13912
- if (!context) {
13913
- throw new Error("useToolbarContext must be used within a ToolbarProvider");
13914
- }
13915
- return context;
13916
- };
14553
+ function TableDropdownMenu(props) {
14554
+ const tableSelected = plateCommon.useEditorSelector(
14555
+ (editor2) => plateCommon.someNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } }),
14556
+ []
14557
+ );
14558
+ const [enableDeleteColumn, enableDeleteRow] = plateCommon.useEditorSelector((editor2) => {
14559
+ const tableNodeEntry = plateCommon.findNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } });
14560
+ if (!tableNodeEntry)
14561
+ return [false, false];
14562
+ const [tableNode] = tableNodeEntry;
14563
+ if (!plateCommon.isElement(tableNode))
14564
+ return [false, false];
14565
+ const columnCount = plateTable.getTableColumnCount(tableNode);
14566
+ const rowCount = tableNode.children.length;
14567
+ return [columnCount > 1, rowCount > 1];
14568
+ }, []);
14569
+ const editor = plateCommon.useEditorRef();
14570
+ const openState = useOpenState();
14571
+ 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(
14572
+ DropdownMenuContent,
14573
+ {
14574
+ align: "start",
14575
+ className: "flex w-[180px] min-w-0 flex-col gap-0.5"
14576
+ },
14577
+ /* @__PURE__ */ React.createElement(
14578
+ DropdownMenuItem,
14579
+ {
14580
+ className: "min-w-[180px]",
14581
+ disabled: tableSelected,
14582
+ onSelect: () => {
14583
+ plateTable.insertTable(editor);
14584
+ plateCommon.focusEditor(editor);
14585
+ }
14586
+ },
14587
+ /* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14588
+ "Insert table"
14589
+ ),
14590
+ /* @__PURE__ */ React.createElement(
14591
+ DropdownMenuItem,
14592
+ {
14593
+ className: "min-w-[180px]",
14594
+ disabled: !tableSelected,
14595
+ onSelect: () => {
14596
+ plateTable.deleteTable(editor);
14597
+ plateCommon.focusEditor(editor);
14598
+ }
14599
+ },
14600
+ /* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14601
+ "Delete table"
14602
+ ),
14603
+ /* @__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(
14604
+ DropdownMenuItem,
14605
+ {
14606
+ className: "min-w-[180px]",
14607
+ disabled: !tableSelected,
14608
+ onSelect: () => {
14609
+ plateTable.insertTableColumn(editor);
14610
+ plateCommon.focusEditor(editor);
14611
+ }
14612
+ },
14613
+ /* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14614
+ "Insert column after"
14615
+ ), /* @__PURE__ */ React.createElement(
14616
+ DropdownMenuItem,
14617
+ {
14618
+ className: "min-w-[180px]",
14619
+ disabled: !enableDeleteColumn,
14620
+ onSelect: () => {
14621
+ plateTable.deleteColumn(editor);
14622
+ plateCommon.focusEditor(editor);
14623
+ }
14624
+ },
14625
+ /* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14626
+ "Delete column"
14627
+ ))),
14628
+ /* @__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(
14629
+ DropdownMenuItem,
14630
+ {
14631
+ className: "min-w-[180px]",
14632
+ disabled: !tableSelected,
14633
+ onSelect: () => {
14634
+ plateTable.insertTableRow(editor);
14635
+ plateCommon.focusEditor(editor);
14636
+ }
14637
+ },
14638
+ /* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14639
+ "Insert row after"
14640
+ ), /* @__PURE__ */ React.createElement(
14641
+ DropdownMenuItem,
14642
+ {
14643
+ className: "min-w-[180px]",
14644
+ disabled: !enableDeleteRow,
14645
+ onSelect: () => {
14646
+ plateTable.deleteRow(editor);
14647
+ plateCommon.focusEditor(editor);
14648
+ }
14649
+ },
14650
+ /* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14651
+ "Delete row"
14652
+ )))
14653
+ ));
14654
+ }
13917
14655
  function TemplatesToolbarButton() {
13918
14656
  const { templates } = useToolbarContext();
13919
- const showEmbed = templates.length > 0;
13920
14657
  const editor = plateCommon.useEditorState();
13921
- if (!showEmbed) {
13922
- return null;
13923
- }
13924
14658
  return /* @__PURE__ */ React.createElement(EmbedButton, { templates, editor });
13925
14659
  }
13926
14660
  const EmbedButton = ({ editor, templates }) => {
@@ -13961,100 +14695,112 @@ var __publicField = (obj, key, value) => {
13961
14695
  template.label || template.name
13962
14696
  ))));
13963
14697
  };
13964
- const ICON_WIDTH = 32;
13965
- const EMBED_ICON_WIDTH = 78;
13966
- const MD_BREAKPOINT = 768;
13967
- const useResize = (ref, callback) => {
13968
- React.useEffect(() => {
13969
- const resizeObserver = new ResizeObserver((entries) => {
13970
- for (const entry of entries) {
13971
- callback(entry);
13972
- }
13973
- });
13974
- if (ref.current) {
13975
- resizeObserver.observe(ref.current);
13976
- }
13977
- return () => resizeObserver.disconnect();
13978
- }, [ref.current]);
13979
- };
13980
- function OverflowMenu({
13981
- children,
13982
- ...props
13983
- }) {
13984
- const openState = useOpenState();
13985
- return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
13986
- ToolbarButton,
13987
- {
13988
- showArrow: false,
13989
- className: "lg:min-w-[130px]",
13990
- isDropdown: true,
13991
- pressed: openState.open,
13992
- tooltip: "Headings"
13993
- },
13994
- /* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
13995
- )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
13996
- }
13997
14698
  const toolbarItems = {
13998
14699
  heading: {
13999
- label: "Headings",
14700
+ label: HEADING_LABEL,
14701
+ width: (paragraphIconExists) => paragraphIconExists ? HEADING_ICON_WITH_TEXT : HEADING_ICON_ONLY,
14702
+ // Dynamically handle width based on paragraph icon
14000
14703
  Component: /* @__PURE__ */ React.createElement(ToolbarGroup, { noSeparator: true }, /* @__PURE__ */ React.createElement(HeadingsMenu, null))
14001
14704
  },
14002
14705
  link: {
14003
14706
  label: "Link",
14707
+ width: () => STANDARD_ICON_WIDTH,
14004
14708
  Component: /* @__PURE__ */ React.createElement(LinkToolbarButton, null)
14005
14709
  },
14006
14710
  image: {
14007
14711
  label: "Image",
14712
+ width: () => STANDARD_ICON_WIDTH,
14008
14713
  Component: /* @__PURE__ */ React.createElement(ImageToolbarButton, null)
14009
14714
  },
14010
14715
  quote: {
14011
14716
  label: "Quote",
14717
+ width: () => STANDARD_ICON_WIDTH,
14012
14718
  Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
14013
14719
  },
14014
14720
  ul: {
14015
14721
  label: "Unordered List",
14722
+ width: () => STANDARD_ICON_WIDTH,
14016
14723
  Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_UL })
14017
14724
  },
14018
14725
  ol: {
14019
14726
  label: "Ordered List",
14727
+ width: () => STANDARD_ICON_WIDTH,
14020
14728
  Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_OL })
14021
14729
  },
14022
14730
  bold: {
14023
14731
  label: "Bold",
14732
+ width: () => STANDARD_ICON_WIDTH,
14024
14733
  Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null))
14025
14734
  },
14026
14735
  italic: {
14027
14736
  label: "Italic",
14737
+ width: () => STANDARD_ICON_WIDTH,
14028
14738
  Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null))
14029
14739
  },
14030
14740
  code: {
14031
14741
  label: "Code",
14742
+ width: () => STANDARD_ICON_WIDTH,
14032
14743
  Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null))
14033
14744
  },
14034
14745
  codeBlock: {
14035
14746
  label: "Code Block",
14747
+ width: () => STANDARD_ICON_WIDTH,
14036
14748
  Component: /* @__PURE__ */ React.createElement(CodeBlockToolbarButton, null)
14037
14749
  },
14750
+ mermaid: {
14751
+ label: "Mermaid",
14752
+ width: () => STANDARD_ICON_WIDTH,
14753
+ Component: /* @__PURE__ */ React.createElement(MermaidToolbarButton, null)
14754
+ },
14755
+ table: {
14756
+ label: "Table",
14757
+ width: () => STANDARD_ICON_WIDTH,
14758
+ Component: /* @__PURE__ */ React.createElement(TableDropdownMenu, null)
14759
+ },
14038
14760
  raw: {
14039
14761
  label: "Raw Markdown",
14762
+ width: () => STANDARD_ICON_WIDTH,
14040
14763
  Component: /* @__PURE__ */ React.createElement(RawMarkdownToolbarButton, null)
14041
14764
  },
14042
14765
  embed: {
14043
14766
  label: "Templates",
14767
+ width: () => EMBED_ICON_WIDTH,
14044
14768
  Component: /* @__PURE__ */ React.createElement(TemplatesToolbarButton, null)
14045
14769
  }
14046
14770
  };
14047
14771
  function FixedToolbarButtons() {
14048
14772
  const toolbarRef = React.useRef(null);
14049
14773
  const [itemsShown, setItemsShown] = React.useState(11);
14050
- const { overrides } = useToolbarContext();
14774
+ const { overrides, templates } = useToolbarContext();
14775
+ const showEmbedButton = templates.length > 0;
14776
+ let items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14777
+ if (!showEmbedButton) {
14778
+ items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
14779
+ }
14780
+ const editorState = plateCommon.useEditorState();
14781
+ const userInTable = helpers.isNodeActive(editorState, plate.ELEMENT_TABLE);
14782
+ if (userInTable) {
14783
+ items2 = items2.filter((item) => !unsupportedItemsInTable.has(item.label));
14784
+ }
14051
14785
  useResize(toolbarRef, (entry) => {
14052
14786
  const width = entry.target.getBoundingClientRect().width;
14053
- const paragraphIconWidth = width < MD_BREAKPOINT ? 58 : 128;
14054
- const itemsShown2 = (width - EMBED_ICON_WIDTH - paragraphIconWidth) / ICON_WIDTH;
14055
- setItemsShown(Math.floor(itemsShown2));
14787
+ const headingButton = items2.find((item) => item.label === HEADING_LABEL);
14788
+ const headingWidth = headingButton ? headingButton.width(width > CONTAINER_MD_BREAKPOINT) : 0;
14789
+ const availableWidth = width - headingWidth - FLOAT_BUTTON_WIDTH;
14790
+ const { itemFitCount } = items2.reduce(
14791
+ (acc, item) => {
14792
+ if (item.label !== HEADING_LABEL && acc.totalItemsWidth + item.width() <= availableWidth) {
14793
+ return {
14794
+ totalItemsWidth: acc.totalItemsWidth + item.width(),
14795
+ itemFitCount: acc.itemFitCount + 1
14796
+ };
14797
+ }
14798
+ return acc;
14799
+ },
14800
+ { totalItemsWidth: 0, itemFitCount: 1 }
14801
+ );
14802
+ setItemsShown(itemFitCount);
14056
14803
  });
14057
- const toolbarItemsArray = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14058
14804
  return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden @container/toolbar", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
14059
14805
  "div",
14060
14806
  {
@@ -14063,7 +14809,7 @@ var __publicField = (obj, key, value) => {
14063
14809
  transform: "translateX(calc(-1px))"
14064
14810
  }
14065
14811
  },
14066
- /* @__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))))
14812
+ /* @__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))))
14067
14813
  ));
14068
14814
  }
14069
14815
  const FloatingToolbar = cn$1.withRef(({ children, state, ...props }, componentRef) => {
@@ -14178,6 +14924,10 @@ var __publicField = (obj, key, value) => {
14178
14924
  const openState = useOpenState();
14179
14925
  const selectedItem = items.find((item) => item.value === value) ?? defaultItem;
14180
14926
  const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
14927
+ const editorState = plateCommon.useEditorState();
14928
+ const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
14929
+ if (userInTable)
14930
+ return null;
14181
14931
  return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
14182
14932
  ToolbarButton,
14183
14933
  {
@@ -14219,49 +14969,6 @@ var __publicField = (obj, key, value) => {
14219
14969
  function FloatingToolbarButtons() {
14220
14970
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TurnIntoDropdownMenu, null));
14221
14971
  }
14222
- const buttonVariants = classVarianceAuthority.cva(
14223
- "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",
14224
- {
14225
- defaultVariants: {
14226
- size: "default",
14227
- variant: "default"
14228
- },
14229
- variants: {
14230
- isMenu: {
14231
- true: "h-auto w-full cursor-pointer justify-start"
14232
- },
14233
- size: {
14234
- default: "h-10 px-4 py-2",
14235
- icon: "size-10",
14236
- lg: "h-11 rounded-md px-8",
14237
- none: "",
14238
- sm: "h-9 rounded-md px-3",
14239
- sms: "size-9 rounded-md px-0",
14240
- xs: "h-8 rounded-md px-3"
14241
- },
14242
- variant: {
14243
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
14244
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
14245
- ghost: "hover:bg-accent hover:text-accent-foreground",
14246
- inlineLink: "text-base text-primary underline underline-offset-4",
14247
- link: "text-primary underline-offset-4 hover:underline",
14248
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
14249
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
14250
- }
14251
- }
14252
- }
14253
- );
14254
- cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
14255
- const Comp = asChild ? reactSlot.Slot : "button";
14256
- return /* @__PURE__ */ React__namespace.createElement(
14257
- Comp,
14258
- {
14259
- className: cn$1.cn(buttonVariants({ className, isMenu, size, variant })),
14260
- ref,
14261
- ...props
14262
- }
14263
- );
14264
- });
14265
14972
  const inputVariants = classVarianceAuthority.cva(
14266
14973
  "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",
14267
14974
  {
@@ -14282,22 +14989,6 @@ var __publicField = (obj, key, value) => {
14282
14989
  }
14283
14990
  );
14284
14991
  cn$1.withVariants("input", inputVariants, ["variant", "h"]);
14285
- const popoverVariants = classVarianceAuthority.cva(
14286
- "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"
14287
- );
14288
- cn$1.withRef(
14289
- ({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
14290
- PopoverPrimitive__namespace.Content,
14291
- {
14292
- align,
14293
- className: cn$1.cn(popoverVariants(), className),
14294
- ref,
14295
- sideOffset,
14296
- style: { zIndex: 1e3, ...style },
14297
- ...props
14298
- }
14299
- ))
14300
- );
14301
14992
  const floatingOptions = {
14302
14993
  middleware: [
14303
14994
  plateFloating.offset(12),
@@ -14357,7 +15048,7 @@ var __publicField = (obj, key, value) => {
14357
15048
  const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex h-9 items-center gap-1" }, /* @__PURE__ */ React.createElement(
14358
15049
  "button",
14359
15050
  {
14360
- className: buttonVariants({ size: "sm", variant: "ghost" }),
15051
+ className: buttonVariants$1({ size: "sm", variant: "ghost" }),
14361
15052
  type: "button",
14362
15053
  ...editButtonProps
14363
15054
  },
@@ -14365,7 +15056,7 @@ var __publicField = (obj, key, value) => {
14365
15056
  ), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
14366
15057
  plateLink.LinkOpenButton,
14367
15058
  {
14368
- className: buttonVariants({
15059
+ className: buttonVariants$1({
14369
15060
  size: "sms",
14370
15061
  variant: "ghost"
14371
15062
  })
@@ -14374,7 +15065,7 @@ var __publicField = (obj, key, value) => {
14374
15065
  ), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
14375
15066
  "button",
14376
15067
  {
14377
- className: buttonVariants({
15068
+ className: buttonVariants$1({
14378
15069
  size: "sms",
14379
15070
  variant: "ghost"
14380
15071
  }),
@@ -14448,6 +15139,7 @@ var __publicField = (obj, key, value) => {
14448
15139
  createMdxBlockPlugin(),
14449
15140
  createMdxInlinePlugin(),
14450
15141
  createImgPlugin(),
15142
+ createMermaidPlugin(),
14451
15143
  createInvalidMarkdownPlugin(),
14452
15144
  plateLink.createLinkPlugin({
14453
15145
  options: {
@@ -29455,6 +30147,7 @@ mutation addPendingDocumentMutation(
29455
30147
  relativePath
29456
30148
  filename
29457
30149
  extension
30150
+ hasReferences
29458
30151
  }
29459
30152
  }
29460
30153
  }
@@ -29546,6 +30239,9 @@ mutation addPendingDocumentMutation(
29546
30239
  document(collection:$collection, relativePath:$relativePath) {
29547
30240
  ... on Document {
29548
30241
  _values
30242
+ _sys {
30243
+ hasReferences
30244
+ }
29549
30245
  }
29550
30246
  }
29551
30247
  }`;
@@ -30570,8 +31266,8 @@ This will work when developing locally but NOT when deployed to production.
30570
31266
  }
30571
31267
  )
30572
31268
  }
30573
- ), !renderDesktopNav && /* @__PURE__ */ React.createElement(react$1.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
30574
- react$1.TransitionChild,
31269
+ ), !renderDesktopNav && /* @__PURE__ */ React.createElement(react.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
31270
+ react.TransitionChild,
30575
31271
  {
30576
31272
  enter: "transform transition-all ease-out duration-300",
30577
31273
  enterFrom: "opacity-0 -translate-x-full",
@@ -30640,7 +31336,7 @@ This will work when developing locally but NOT when deployed to production.
30640
31336
  ))
30641
31337
  ))
30642
31338
  ), /* @__PURE__ */ React.createElement(
30643
- react$1.TransitionChild,
31339
+ react.TransitionChild,
30644
31340
  {
30645
31341
  enter: "ease-out duration-300",
30646
31342
  enterFrom: "opacity-0",
@@ -31094,8 +31790,8 @@ This will work when developing locally but NOT when deployed to production.
31094
31790
  folder,
31095
31791
  collectionName
31096
31792
  }) => {
31097
- 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(
31098
- react$1.Transition,
31793
+ 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(
31794
+ react.Transition,
31099
31795
  {
31100
31796
  enter: "transition ease-out duration-100",
31101
31797
  enterFrom: "transform opacity-0 scale-95",
@@ -31104,7 +31800,7 @@ This will work when developing locally but NOT when deployed to production.
31104
31800
  leaveFrom: "transform opacity-100 scale-100",
31105
31801
  leaveTo: "transform opacity-0 scale-95"
31106
31802
  },
31107
- /* @__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(
31803
+ /* @__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(
31108
31804
  reactRouterDom.Link,
31109
31805
  {
31110
31806
  to: `/${folder.fullyQualifiedName ? [
@@ -31272,6 +31968,23 @@ This will work when developing locally but NOT when deployed to production.
31272
31968
  DeleteModal,
31273
31969
  {
31274
31970
  filename: vars.relativePath,
31971
+ checkRefsFunc: async () => {
31972
+ var _a2, _b2;
31973
+ try {
31974
+ const doc = await admin.fetchDocument(
31975
+ collection.name,
31976
+ vars.relativePath,
31977
+ true
31978
+ );
31979
+ return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
31980
+ } catch (error) {
31981
+ cms.alerts.error(
31982
+ "Document was not found, ask a developer for help or check the console for an error message"
31983
+ );
31984
+ console.error(error);
31985
+ throw error;
31986
+ }
31987
+ },
31275
31988
  deleteFunc: async () => {
31276
31989
  try {
31277
31990
  await admin.deleteDocument(vars);
@@ -31280,6 +31993,12 @@ This will work when developing locally but NOT when deployed to production.
31280
31993
  );
31281
31994
  reFetchCollection();
31282
31995
  } catch (error) {
31996
+ if (error.message.indexOf("has references")) {
31997
+ cms.alerts.error(
31998
+ error.message.split("\n ").filter(Boolean)[1]
31999
+ );
32000
+ return;
32001
+ }
31283
32002
  cms.alerts.warn(
31284
32003
  "Document was not deleted, ask a developer for help or check the console for an error message"
31285
32004
  );
@@ -31331,6 +32050,12 @@ This will work when developing locally but NOT when deployed to production.
31331
32050
  cms.alerts.info("Document was successfully renamed");
31332
32051
  reFetchCollection();
31333
32052
  } catch (error) {
32053
+ if (error.message.indexOf("has references")) {
32054
+ cms.alerts.error(
32055
+ error.message.split("\n ").filter(Boolean)[1]
32056
+ );
32057
+ return;
32058
+ }
31334
32059
  cms.alerts.warn(
31335
32060
  "Document was not renamed, ask a developer for help or check the console for an error message"
31336
32061
  );
@@ -31804,8 +32529,19 @@ This will work when developing locally but NOT when deployed to production.
31804
32529
  const NoDocumentsPlaceholder = () => {
31805
32530
  return /* @__PURE__ */ React.createElement("div", { className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg" }, /* @__PURE__ */ React.createElement("p", { className: "text-base italic font-medium text-gray-300" }, "No documents found."));
31806
32531
  };
31807
- const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
31808
- return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
32532
+ const DeleteModal = ({
32533
+ close: close2,
32534
+ deleteFunc,
32535
+ checkRefsFunc,
32536
+ filename
32537
+ }) => {
32538
+ const [hasRefs, setHasRefs] = React.useState();
32539
+ React.useEffect(() => {
32540
+ checkRefsFunc().then((result) => {
32541
+ setHasRefs(result);
32542
+ });
32543
+ }, [filename, checkRefsFunc]);
32544
+ return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?${hasRefs ? " References to this document will also be deleted." : ""}`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
31809
32545
  Button$1,
31810
32546
  {
31811
32547
  style: { flexGrow: 3 },
@@ -33172,6 +33908,7 @@ This will work when developing locally but NOT when deployed to production.
33172
33908
  exports2.useScreenPlugin = useScreenPlugin;
33173
33909
  exports2.useTinaAuthRedirect = useTinaAuthRedirect;
33174
33910
  exports2.wrapFieldWithError = wrapFieldWithError;
33911
+ exports2.wrapFieldWithNoHeader = wrapFieldWithNoHeader;
33175
33912
  exports2.wrapFieldsWithMeta = wrapFieldsWithMeta;
33176
33913
  Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
33177
33914
  });