tinacms 0.0.0-a690e47-20241003005744 → 0.0.0-a6daef4-20250115020754

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 (32) 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 +23 -24
  4. package/dist/client.mjs +4 -8
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +1593 -1030
  7. package/dist/index.mjs +1583 -1016
  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/index.d.ts +4 -1
  13. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/fixed-toolbar-buttons.d.ts +0 -4
  14. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +2 -0
  15. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-element.d.ts +11 -0
  16. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +20 -0
  17. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/resizable.d.ts +39 -0
  18. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-cell-element.d.ts +27 -0
  19. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-dropdown-menu.d.ts +3 -0
  20. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-element.d.ts +14 -0
  21. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-row-element.d.ts +13 -0
  22. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/text-area.d.ts +5 -0
  23. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
  24. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +1 -0
  25. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/custom/mermaid-plugin.d.ts +2 -0
  26. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +4 -2
  27. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +58 -0
  28. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +11 -3
  29. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +3 -3
  30. package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
  31. package/package.json +29 -28
  32. package/dist/__vite-browser-external-d06ac358.mjs +0 -4
package/dist/index.mjs CHANGED
@@ -6,32 +6,38 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  import { z } from "zod";
8
8
  import * as React from "react";
9
- import React__default, { useState, useCallback, createContext, forwardRef, useContext, useEffect, useMemo, startTransition, useRef, createElement, Component } from "react";
10
- import { createPortal, findDOMNode } from "react-dom";
11
- import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createBoldPlugin, createItalicPlugin, createUnderlinePlugin, createCodePlugin, createListPlugin, createIndentPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
12
- import { useSelected, ReactEditor } from "slate-react";
9
+ import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition } from "react";
10
+ import { createPortal } from "react-dom";
11
+ import { withRef, cn as cn$1, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
12
+ import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createBoldPlugin, createItalicPlugin, createUnderlinePlugin, createCodePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
13
+ import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, useMarkToolbarButtonState, useMarkToolbarButton, insertEmptyElement, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
13
14
  import { ELEMENT_SLASH_INPUT, createSlashPlugin } from "@udecode/plate-slash-command";
14
- import { cn as cn$1, withRef, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
15
- import { useComposedRef, useEditorRef, findNodePath, getPointBefore, createPointRef, insertText, moveSelection, PlateElement, toggleNodeType, PlateLeaf, isCollapsed, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, setNodes, isElement, createPluginFactory, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, useMarkToolbarButtonState, useMarkToolbarButton, useEditorState, useEditorSelector, getNodeEntries, collapseSelection, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
16
- import { ELEMENT_H1, ELEMENT_H2, ELEMENT_H3, ELEMENT_H4 as ELEMENT_H4$1, ELEMENT_H5 as ELEMENT_H5$1, ELEMENT_H6 as ELEMENT_H6$1 } from "@udecode/plate-heading";
15
+ import { useSelected, useReadOnly, ReactEditor } from "slate-react";
16
+ import { useCodeBlockElementState, useCodeSyntaxLeaf, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
17
+ import MonacoEditor, { loader, useMonaco } from "@monaco-editor/react";
18
+ import { Combobox, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$3, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
17
19
  import { cva } from "class-variance-authority";
18
- import { Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, ChevronDown, PaintBucket, Quote, Check, ChevronRight, ChevronsUpDown, X, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Search, Settings, Strikethrough, Subscript, Superscript, Table, Text, Underline, Link2Off, Eye, Moon, SunMedium, Twitter } from "lucide-react";
19
- import { useComboboxContext, Combobox, useComboboxStore, ComboboxProvider, Portal, ComboboxPopover, ComboboxItem } from "@ariakit/react";
20
+ import { Eye, SquarePen, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, ChevronDown, PaintBucket, Quote, Check, ChevronRight, ChevronsUpDown, X, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Search, Settings, Strikethrough, Subscript, Superscript, Table, Text, Underline, Link2Off, Moon, SunMedium, Twitter } from "lucide-react";
21
+ import mermaid from "mermaid";
22
+ import { ELEMENT_H1, ELEMENT_H2, ELEMENT_H3, ELEMENT_H4 as ELEMENT_H4$1, ELEMENT_H5 as ELEMENT_H5$1, ELEMENT_H6 as ELEMENT_H6$1 } from "@udecode/plate-heading";
23
+ import { useComboboxContext, Combobox as Combobox$1, useComboboxStore, ComboboxProvider, Portal, ComboboxPopover, ComboboxItem } from "@ariakit/react";
20
24
  import { useHTMLInputCursorState, useComboboxInput, filterWords } from "@udecode/plate-combobox";
21
- import { useCodeSyntaxLeaf, useCodeBlockElementState, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
22
- import MonacoEditor, { loader, useMonaco } from "@monaco-editor/react";
23
- import { Combobox as Combobox$1, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$2, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
25
+ import { useTableCellElementState, useTableCellElement, useTableCellElementResizableState, useTableCellElementResizable, useTableBordersDropdownMenuContentState, useTableMergeState, TableProvider, useTableElementState, useTableElement, mergeTableCells, unmergeTableCells, ELEMENT_TABLE as ELEMENT_TABLE$1, getTableColumnCount, insertTable, deleteTable, insertTableColumn, deleteColumn, insertTableRow, deleteRow } from "@udecode/plate-table";
26
+ import { ResizeHandle as ResizeHandle$1 } from "@udecode/plate-resizable";
27
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
28
+ import { PopoverAnchor } from "@radix-ui/react-popover";
29
+ import { Slot } from "@radix-ui/react-slot";
30
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
31
+ import * as SeparatorPrimitive from "@radix-ui/react-separator";
24
32
  import arrayMutators from "final-form-arrays";
25
33
  import setFieldData from "final-form-set-field-data";
26
34
  import { FORM_ERROR, createForm, getIn } from "final-form";
27
35
  import { Field, Form as Form$1 } from "react-final-form";
28
36
  import PropTypes from "prop-types";
29
37
  import { Droppable, Draggable, DragDropContext } from "react-beautiful-dnd";
30
- import * as PopoverPrimitive from "@radix-ui/react-popover";
31
38
  import * as pkg$1 from "react-color";
32
39
  import * as pkg from "color-string";
33
40
  import * as dropzone from "react-dropzone";
34
- import { Slot } from "@radix-ui/react-slot";
35
41
  import { clsx } from "clsx";
36
42
  import { twMerge } from "tailwind-merge";
37
43
  import { Command as Command$1 } from "cmdk";
@@ -42,10 +48,8 @@ import moment from "moment";
42
48
  import { formatDistanceToNow } from "date-fns";
43
49
  import { useLinkToolbarButtonState, useLinkToolbarButton, useFloatingLinkInsertState, useFloatingLinkInsert, useFloatingLinkEditState, useFloatingLinkEdit, FloatingLinkUrlInput, LinkOpenButton, createLinkPlugin } from "@udecode/plate-link";
44
50
  import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
45
- import * as SeparatorPrimitive from "@radix-ui/react-separator";
46
51
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
47
52
  import { ELEMENT_PARAGRAPH as ELEMENT_PARAGRAPH$1 } from "@udecode/plate-paragraph";
48
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
49
53
  import { ELEMENT_BLOCKQUOTE as ELEMENT_BLOCKQUOTE$1 } from "@udecode/plate-block-quote";
50
54
  import { useFloatingToolbarState, offset, flip, useFloatingToolbar } from "@udecode/plate-floating";
51
55
  import { useWindowWidth } from "@react-hook/window-size";
@@ -797,6 +801,22 @@ function wrapFieldsWithMeta(Field2) {
797
801
  );
798
802
  };
799
803
  }
804
+ function wrapFieldWithNoHeader(Field2) {
805
+ return (props) => {
806
+ return /* @__PURE__ */ React.createElement(
807
+ FieldMeta,
808
+ {
809
+ name: props.input.name,
810
+ label: false,
811
+ description: "",
812
+ error: props.meta.error,
813
+ index: props.index,
814
+ tinaForm: props.tinaForm
815
+ },
816
+ /* @__PURE__ */ React.createElement(Field2, { ...props })
817
+ );
818
+ };
819
+ }
800
820
  function wrapFieldWithError(Field2) {
801
821
  return (props) => {
802
822
  return /* @__PURE__ */ React.createElement(
@@ -869,6 +889,16 @@ const FieldDescription = ({
869
889
  className,
870
890
  ...props
871
891
  }) => {
892
+ if (typeof children === "string") {
893
+ return /* @__PURE__ */ React.createElement(
894
+ "span",
895
+ {
896
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
897
+ ...props,
898
+ dangerouslySetInnerHTML: { __html: children }
899
+ }
900
+ );
901
+ }
872
902
  return /* @__PURE__ */ React.createElement(
873
903
  "span",
874
904
  {
@@ -905,6 +935,20 @@ const useEditorContext = () => {
905
935
  const useTemplates = () => {
906
936
  return React__default.useContext(EditorContext);
907
937
  };
938
+ const BlockquoteElement = withRef(
939
+ ({ children, className, ...props }, ref) => {
940
+ return /* @__PURE__ */ React__default.createElement(
941
+ PlateElement,
942
+ {
943
+ asChild: true,
944
+ className: cn$1("my-1 border-l-2 pl-6 italic", className),
945
+ ref,
946
+ ...props
947
+ },
948
+ /* @__PURE__ */ React__default.createElement("blockquote", null, children)
949
+ );
950
+ }
951
+ );
908
952
  function classNames$1(...classes) {
909
953
  return classes.filter(Boolean).join(" ");
910
954
  }
@@ -914,6 +958,503 @@ const uuid = () => {
914
958
  (c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
915
959
  );
916
960
  };
961
+ function ChevronDownIcon(props, svgRef) {
962
+ return /* @__PURE__ */ React.createElement("svg", Object.assign({
963
+ xmlns: "http://www.w3.org/2000/svg",
964
+ viewBox: "0 0 20 20",
965
+ fill: "currentColor",
966
+ "aria-hidden": "true",
967
+ ref: svgRef
968
+ }, props), /* @__PURE__ */ React.createElement("path", {
969
+ fillRule: "evenodd",
970
+ 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",
971
+ clipRule: "evenodd"
972
+ }));
973
+ }
974
+ const ForwardRef = React.forwardRef(ChevronDownIcon);
975
+ const ChevronDownIcon$1 = ForwardRef;
976
+ const Autocomplete = ({
977
+ value,
978
+ onChange,
979
+ defaultQuery,
980
+ items: items2
981
+ }) => {
982
+ const [query, setQuery] = React__default.useState(defaultQuery ?? "");
983
+ const filteredItems = React__default.useMemo(() => {
984
+ try {
985
+ const reFilter = new RegExp(query, "i");
986
+ const _items = items2.filter((item) => reFilter.test(item.label));
987
+ if (_items.length === 0)
988
+ return items2;
989
+ return _items;
990
+ } catch (err) {
991
+ return items2;
992
+ }
993
+ }, [items2, query]);
994
+ return /* @__PURE__ */ React__default.createElement(
995
+ Combobox,
996
+ {
997
+ value,
998
+ onChange,
999
+ as: "div",
1000
+ className: "relative inline-block text-left z-20"
1001
+ },
1002
+ /* @__PURE__ */ React__default.createElement("div", { className: "mt-1" }, /* @__PURE__ */ React__default.createElement("div", { className: "relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left shadow-md sm:text-sm" }, /* @__PURE__ */ React__default.createElement(
1003
+ ComboboxInput,
1004
+ {
1005
+ 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",
1006
+ displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
1007
+ onChange: (event) => setQuery(event.target.value),
1008
+ onClick: (ev) => ev.stopPropagation()
1009
+ }
1010
+ ), /* @__PURE__ */ React__default.createElement(ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React__default.createElement(
1011
+ ChevronDownIcon$1,
1012
+ {
1013
+ className: "h-5 w-5 text-gray-400",
1014
+ "aria-hidden": "true"
1015
+ }
1016
+ )))),
1017
+ /* @__PURE__ */ React__default.createElement(
1018
+ Transition,
1019
+ {
1020
+ enter: "transition ease-out duration-100",
1021
+ enterFrom: "transform opacity-0 scale-95",
1022
+ enterTo: "transform opacity-100 scale-100",
1023
+ leave: "transition ease-in duration-75",
1024
+ leaveFrom: "transform opacity-100 scale-100",
1025
+ leaveTo: "transform opacity-0 scale-95"
1026
+ },
1027
+ /* @__PURE__ */ React__default.createElement(ComboboxOptions, { className: "origin-top-right absolute right-0 mt-1 w-full max-h-[300px] overflow-y-auto rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, filteredItems.map((item) => /* @__PURE__ */ React__default.createElement(ComboboxOption, { key: item.key, value: item }, ({ focus }) => /* @__PURE__ */ React__default.createElement(
1028
+ "button",
1029
+ {
1030
+ className: classNames$1(
1031
+ focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
1032
+ "block px-4 py-2 text-xs w-full text-right"
1033
+ )
1034
+ },
1035
+ item.render(item)
1036
+ ))))
1037
+ )
1038
+ );
1039
+ };
1040
+ loader.config({
1041
+ paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
1042
+ });
1043
+ let retryCount = 0;
1044
+ const retryFocus = (ref) => {
1045
+ if (ref.current) {
1046
+ ref.current.focus();
1047
+ } else {
1048
+ if (retryCount < 30) {
1049
+ setTimeout(() => {
1050
+ retryCount = retryCount + 1;
1051
+ retryFocus(ref);
1052
+ }, 100);
1053
+ }
1054
+ }
1055
+ };
1056
+ const MINIMUM_HEIGHT = 75;
1057
+ const CodeBlock = ({
1058
+ attributes,
1059
+ editor,
1060
+ element,
1061
+ language: restrictLanguage,
1062
+ onChangeCallback,
1063
+ defaultValue,
1064
+ ...props
1065
+ }) => {
1066
+ const [navigateAway, setNavigateAway] = React__default.useState(null);
1067
+ const monaco = useMonaco();
1068
+ const monacoEditorRef = React__default.useRef(null);
1069
+ const selected = useSelected();
1070
+ const [height, setHeight] = React__default.useState(MINIMUM_HEIGHT);
1071
+ React__default.useEffect(() => {
1072
+ if (selected && isCollapsed(editor.selection)) {
1073
+ retryFocus(monacoEditorRef);
1074
+ }
1075
+ }, [selected, monacoEditorRef.current]);
1076
+ const value = element.value || "";
1077
+ if (typeof value !== "string") {
1078
+ throw new Error("Element must be of type string for code block");
1079
+ }
1080
+ const language = restrictLanguage || element.lang;
1081
+ const id = React__default.useMemo(() => uuid(), []);
1082
+ const languages = React__default.useMemo(() => {
1083
+ const defaultLangSet = { "": "plain text" };
1084
+ if (!monaco)
1085
+ return defaultLangSet;
1086
+ return monaco.languages.getLanguages().reduce((ac, cv) => {
1087
+ if (cv.id === "plaintext")
1088
+ return ac;
1089
+ return { ...ac, [cv.id]: cv.id };
1090
+ }, defaultLangSet);
1091
+ }, [monaco]);
1092
+ React__default.useEffect(() => {
1093
+ if (monaco) {
1094
+ monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
1095
+ monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
1096
+ // disable errors
1097
+ noSemanticValidation: true,
1098
+ noSyntaxValidation: true
1099
+ });
1100
+ }
1101
+ }, [monaco]);
1102
+ const items2 = Object.entries(languages).map(([key, label]) => ({
1103
+ key,
1104
+ label,
1105
+ render: (item) => item.label
1106
+ }));
1107
+ const currentItem = React__default.useMemo(() => {
1108
+ return items2.find((item) => item.key === language) ?? {
1109
+ key: "",
1110
+ label: "Plain Text"
1111
+ };
1112
+ }, [items2, language]);
1113
+ React__default.useEffect(() => {
1114
+ if (navigateAway) {
1115
+ setNavigateAway(null);
1116
+ switch (navigateAway) {
1117
+ case "remove":
1118
+ {
1119
+ focusEditor(editor);
1120
+ setNodes(
1121
+ editor,
1122
+ {
1123
+ type: "p",
1124
+ children: [{ text: "" }],
1125
+ lang: void 0,
1126
+ value: void 0
1127
+ },
1128
+ {
1129
+ match: (n) => {
1130
+ if (isElement(n) && n.type === element.type) {
1131
+ return true;
1132
+ }
1133
+ }
1134
+ }
1135
+ );
1136
+ }
1137
+ break;
1138
+ case "insertNext":
1139
+ {
1140
+ insertNodes(
1141
+ editor,
1142
+ [
1143
+ {
1144
+ type: ELEMENT_DEFAULT,
1145
+ children: [{ text: "" }],
1146
+ lang: void 0,
1147
+ value: void 0
1148
+ }
1149
+ ],
1150
+ { select: true }
1151
+ );
1152
+ focusEditor(editor);
1153
+ }
1154
+ break;
1155
+ case "up":
1156
+ {
1157
+ const path = findNodePath(editor, element);
1158
+ if (!path) {
1159
+ return;
1160
+ }
1161
+ const previousNodePath = getPointBefore(editor, path);
1162
+ if (!previousNodePath) {
1163
+ focusEditor(editor);
1164
+ insertNodes(
1165
+ editor,
1166
+ [
1167
+ {
1168
+ type: ELEMENT_DEFAULT,
1169
+ children: [{ text: "" }],
1170
+ lang: void 0,
1171
+ value: void 0
1172
+ }
1173
+ ],
1174
+ // Insert a new node at the current path, resulting in the code_block
1175
+ // moving down one block
1176
+ { at: path, select: true }
1177
+ );
1178
+ return;
1179
+ }
1180
+ focusEditor(editor, previousNodePath);
1181
+ }
1182
+ break;
1183
+ case "down": {
1184
+ const path = findNodePath(editor, element);
1185
+ if (!path) {
1186
+ return;
1187
+ }
1188
+ const nextNodePath = getPointAfter(editor, path);
1189
+ if (!nextNodePath) {
1190
+ insertNodes(
1191
+ editor,
1192
+ [
1193
+ {
1194
+ type: ELEMENT_DEFAULT,
1195
+ children: [{ text: "" }],
1196
+ lang: void 0,
1197
+ value: void 0
1198
+ }
1199
+ ],
1200
+ { select: true }
1201
+ );
1202
+ focusEditor(editor);
1203
+ } else {
1204
+ focusEditor(editor, nextNodePath);
1205
+ }
1206
+ break;
1207
+ }
1208
+ }
1209
+ }
1210
+ }, [navigateAway]);
1211
+ function handleEditorDidMount(monacoEditor, monaco2) {
1212
+ monacoEditorRef.current = monacoEditor;
1213
+ monacoEditor.onDidContentSizeChange(() => {
1214
+ setHeight(
1215
+ monacoEditor.getContentHeight() > MINIMUM_HEIGHT ? monacoEditor.getContentHeight() : MINIMUM_HEIGHT
1216
+ );
1217
+ monacoEditor.layout();
1218
+ });
1219
+ setNodes(editor, { value: defaultValue, lang: language });
1220
+ monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
1221
+ if (monacoEditor.hasTextFocus()) {
1222
+ setNavigateAway("insertNext");
1223
+ }
1224
+ });
1225
+ monacoEditor.onKeyDown((l) => {
1226
+ if (l.code === "ArrowUp") {
1227
+ const selection = monacoEditor.getSelection();
1228
+ if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
1229
+ setNavigateAway("up");
1230
+ }
1231
+ }
1232
+ if (l.code === "ArrowDown") {
1233
+ const selection = monacoEditor.getSelection();
1234
+ const totalLines = monacoEditor.getModel().getLineCount();
1235
+ if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
1236
+ setNavigateAway("down");
1237
+ }
1238
+ }
1239
+ if (l.code === "Backspace") {
1240
+ const selection = monacoEditor.getSelection();
1241
+ 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) {
1242
+ setNavigateAway("remove");
1243
+ }
1244
+ }
1245
+ });
1246
+ }
1247
+ return /* @__PURE__ */ React__default.createElement(
1248
+ "div",
1249
+ {
1250
+ ...attributes,
1251
+ className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
1252
+ },
1253
+ /* @__PURE__ */ React__default.createElement("style", null, `.monaco-editor .editor-widget {
1254
+ display: none !important;
1255
+ visibility: hidden !important;
1256
+ }`),
1257
+ props.children,
1258
+ /* @__PURE__ */ React__default.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React__default.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React__default.createElement("div", null), /* @__PURE__ */ React__default.createElement(
1259
+ Autocomplete,
1260
+ {
1261
+ items: items2,
1262
+ value: currentItem,
1263
+ defaultQuery: "plaintext",
1264
+ onChange: (item) => setNodes(editor, { lang: item.key })
1265
+ }
1266
+ )), /* @__PURE__ */ React__default.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React__default.createElement(
1267
+ MonacoEditor,
1268
+ {
1269
+ path: id,
1270
+ onMount: handleEditorDidMount,
1271
+ options: {
1272
+ scrollBeyondLastLine: false,
1273
+ // automaticLayout: true,
1274
+ tabSize: 2,
1275
+ disableLayerHinting: true,
1276
+ accessibilitySupport: "off",
1277
+ codeLens: false,
1278
+ wordWrap: "on",
1279
+ minimap: {
1280
+ enabled: false
1281
+ },
1282
+ fontSize: 14,
1283
+ lineHeight: 2,
1284
+ formatOnPaste: true,
1285
+ lineNumbers: "off",
1286
+ formatOnType: true,
1287
+ fixedOverflowWidgets: true,
1288
+ // Takes too much horizontal space for iframe
1289
+ folding: false,
1290
+ renderLineHighlight: "none",
1291
+ scrollbar: {
1292
+ verticalScrollbarSize: 1,
1293
+ horizontalScrollbarSize: 1,
1294
+ // https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
1295
+ alwaysConsumeMouseWheel: false
1296
+ }
1297
+ },
1298
+ language: String(language),
1299
+ value: String(element.value),
1300
+ onChange: (value2) => {
1301
+ onChangeCallback == null ? void 0 : onChangeCallback(value2);
1302
+ setNodes(editor, { value: value2, lang: language });
1303
+ }
1304
+ }
1305
+ )))
1306
+ );
1307
+ };
1308
+ const CodeBlockElement = withRef(
1309
+ ({ className, ...props }, ref) => {
1310
+ const { element } = props;
1311
+ const state = useCodeBlockElementState({ element });
1312
+ return /* @__PURE__ */ React__default.createElement(
1313
+ PlateElement,
1314
+ {
1315
+ className: cn$1("relative py-1", state.className, className),
1316
+ ref,
1317
+ ...props
1318
+ },
1319
+ /* @__PURE__ */ React__default.createElement(CodeBlock, { ...props })
1320
+ );
1321
+ }
1322
+ );
1323
+ const CodeLeaf = withRef(
1324
+ ({ children, className, ...props }, ref) => {
1325
+ return /* @__PURE__ */ React__default.createElement(
1326
+ PlateLeaf,
1327
+ {
1328
+ asChild: true,
1329
+ className: cn$1(
1330
+ "whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
1331
+ className
1332
+ ),
1333
+ ref,
1334
+ ...props
1335
+ },
1336
+ /* @__PURE__ */ React__default.createElement("code", null, children)
1337
+ );
1338
+ }
1339
+ );
1340
+ const CodeLineElement = withRef((props, ref) => /* @__PURE__ */ React__default.createElement(PlateElement, { ref, ...props }));
1341
+ const CodeSyntaxLeaf = withRef(
1342
+ ({ children, ...props }, ref) => {
1343
+ const { leaf } = props;
1344
+ const { tokenProps } = useCodeSyntaxLeaf({ leaf });
1345
+ return /* @__PURE__ */ React__default.createElement(PlateLeaf, { ref, ...props }, /* @__PURE__ */ React__default.createElement("span", { ...tokenProps }, children));
1346
+ }
1347
+ );
1348
+ const listVariants = cva("m-0 ps-6", {
1349
+ variants: {
1350
+ variant: {
1351
+ ol: "list-decimal",
1352
+ ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
1353
+ }
1354
+ }
1355
+ });
1356
+ const ListElementVariants = withVariants(PlateElement, listVariants, [
1357
+ "variant"
1358
+ ]);
1359
+ const ListElement = withRef(
1360
+ ({ children, variant = "ul", ...props }, ref) => {
1361
+ const Component = variant;
1362
+ return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component, null, children));
1363
+ }
1364
+ );
1365
+ const ELEMENT_MERMAID = "mermaid";
1366
+ const createMermaidPlugin = createPluginFactory({
1367
+ isElement: true,
1368
+ isVoid: true,
1369
+ isInline: false,
1370
+ key: ELEMENT_MERMAID
1371
+ });
1372
+ const MermaidElementWithRef = ({ config }) => {
1373
+ const mermaidRef = useRef(null);
1374
+ useEffect(() => {
1375
+ if (mermaidRef.current) {
1376
+ mermaid.initialize({ startOnLoad: true });
1377
+ mermaid.init();
1378
+ }
1379
+ }, [config]);
1380
+ return /* @__PURE__ */ React__default.createElement("div", { contentEditable: false, className: "border-border border-b" }, /* @__PURE__ */ React__default.createElement("div", { ref: mermaidRef }, /* @__PURE__ */ React__default.createElement("pre", { className: "mermaid not-tina-prose" }, config)));
1381
+ };
1382
+ const Bubble = ({ children }) => {
1383
+ return /* @__PURE__ */ React__default.createElement("div", { className: "bg-blue-600 rounded-full p-2 transition-transform duration-200 ease-in-out hover:scale-110" }, children);
1384
+ };
1385
+ const ErrorMsg = ({ error }) => {
1386
+ if (error) {
1387
+ return /* @__PURE__ */ React__default.createElement(
1388
+ "div",
1389
+ {
1390
+ contentEditable: false,
1391
+ className: "font-mono bg-red-600 text-white p-2 rounded-md cursor-default"
1392
+ },
1393
+ error
1394
+ );
1395
+ }
1396
+ return null;
1397
+ };
1398
+ const DEFAULT_MERMAID_CONFIG = `%% This won't render without implementing a rendering engine (e.g. mermaid on npm)
1399
+ flowchart TD
1400
+ id1(this is an example flow diagram)
1401
+ --> id2(modify me to see changes!)
1402
+ id2
1403
+ --> id3(Click the top button to preview the changes)
1404
+ --> id4(Learn about mermaid diagrams - mermaid.js.org)`;
1405
+ const MermaidElement = withRef(
1406
+ ({ children, nodeProps, element, ...props }, ref) => {
1407
+ const [mermaidConfig, setMermaidConfig] = useState(
1408
+ element.value || DEFAULT_MERMAID_CONFIG
1409
+ );
1410
+ const [isEditing, setIsEditing] = useState(
1411
+ mermaidConfig === DEFAULT_MERMAID_CONFIG || false
1412
+ );
1413
+ const [mermaidError, setMermaidError] = useState(null);
1414
+ const node = {
1415
+ type: ELEMENT_MERMAID,
1416
+ value: mermaidConfig,
1417
+ children: [{ type: "text", text: "" }]
1418
+ };
1419
+ useEffect(() => {
1420
+ if (mermaid.parse(mermaidConfig)) {
1421
+ setMermaidError(null);
1422
+ }
1423
+ }, [mermaidConfig]);
1424
+ mermaid.parseError = (err) => {
1425
+ setMermaidError(
1426
+ String(err.message) || "An error occurred while parsing the diagram."
1427
+ );
1428
+ };
1429
+ return /* @__PURE__ */ React__default.createElement(PlateElement, { element, ref, ...props }, /* @__PURE__ */ React__default.createElement("div", { className: "relative group" }, /* @__PURE__ */ React__default.createElement("div", { className: "absolute top-2 right-2 z-10 space-y-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 ease-in-out" }, /* @__PURE__ */ React__default.createElement(Bubble, null, isEditing ? /* @__PURE__ */ React__default.createElement(
1430
+ Eye,
1431
+ {
1432
+ className: "w-5 h-5 fill-white cursor-pointer",
1433
+ onClick: () => {
1434
+ setIsEditing(!isEditing);
1435
+ }
1436
+ }
1437
+ ) : /* @__PURE__ */ React__default.createElement(
1438
+ SquarePen,
1439
+ {
1440
+ className: "w-5 h-5 fill-white cursor-pointer",
1441
+ onClick: () => {
1442
+ setIsEditing(!isEditing);
1443
+ }
1444
+ }
1445
+ ))), isEditing ? /* @__PURE__ */ React__default.createElement(
1446
+ CodeBlock,
1447
+ {
1448
+ children: "",
1449
+ language: "yaml",
1450
+ ...props,
1451
+ element: node,
1452
+ defaultValue: mermaidConfig,
1453
+ onChangeCallback: (value) => setMermaidConfig(value)
1454
+ }
1455
+ ) : /* @__PURE__ */ React__default.createElement(MermaidElementWithRef, { config: mermaidConfig })), children, /* @__PURE__ */ React__default.createElement(ErrorMsg, { error: mermaidError }));
1456
+ }
1457
+ );
917
1458
  const RawMarkdown = () => {
918
1459
  return /* @__PURE__ */ React__default.createElement(
919
1460
  "svg",
@@ -932,6 +1473,29 @@ const RawMarkdown = () => {
932
1473
  /* @__PURE__ */ React__default.createElement("path", { d: "M22.27 19.385H1.73A1.73 1.73 0 010 17.655V6.345a1.73 1.73 0 011.73-1.73h20.54A1.73 1.73 0 0124 6.345v11.308a1.73 1.73 0 01-1.73 1.731zM5.769 15.923v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.46v7.847zM21.232 12h-2.309V8.077h-2.307V12h-2.308l3.461 4.039z" })
933
1474
  );
934
1475
  };
1476
+ const MermaidIcon = () => /* @__PURE__ */ React__default.createElement(
1477
+ "svg",
1478
+ {
1479
+ width: "100%",
1480
+ height: "100%",
1481
+ viewBox: "0 0 491 491",
1482
+ version: "1.1",
1483
+ xmlns: "http://www.w3.org/2000/svg",
1484
+ fillRule: "evenodd",
1485
+ clipRule: "evenodd",
1486
+ strokeLinejoin: "round",
1487
+ strokeMiterlimit: 2
1488
+ },
1489
+ /* @__PURE__ */ React__default.createElement("path", { d: "M490.16,84.61C490.16,37.912 452.248,0 405.55,0L84.61,0C37.912,0 0,37.912 0,84.61L0,405.55C0,452.248 37.912,490.16 84.61,490.16L405.55,490.16C452.248,490.16 490.16,452.248 490.16,405.55L490.16,84.61Z" }),
1490
+ /* @__PURE__ */ React__default.createElement(
1491
+ "path",
1492
+ {
1493
+ 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",
1494
+ fill: "white",
1495
+ fillRule: "nonzero"
1496
+ }
1497
+ )
1498
+ );
935
1499
  const borderAll = (props) => /* @__PURE__ */ React__default.createElement(
936
1500
  "svg",
937
1501
  {
@@ -1016,7 +1580,7 @@ const borderTop = (props) => /* @__PURE__ */ React__default.createElement(
1016
1580
  },
1017
1581
  /* @__PURE__ */ React__default.createElement("path", { d: "M3 6a1 1 0 0 0 2 0 1 1 0 0 1 1-1h12a1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3zm2 5a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-8 1a1 1 0 1 0 0-2 1 1 0 0 1-1-1 1 1 0 1 0-2 0 3 3 0 0 0 3 3zm11-1a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" })
1018
1582
  );
1019
- cva("", {
1583
+ const iconVariants = cva("", {
1020
1584
  variants: {
1021
1585
  variant: {
1022
1586
  toolbar: "size-5",
@@ -1172,6 +1736,7 @@ const Icons = {
1172
1736
  clear: X,
1173
1737
  close: X,
1174
1738
  // code: Code2,
1739
+ paint: PaintBucket,
1175
1740
  codeblock: FileCode,
1176
1741
  color: Baseline,
1177
1742
  column: RectangleVertical,
@@ -1197,6 +1762,7 @@ const Icons = {
1197
1762
  lineHeight: WrapText,
1198
1763
  // link: Link2,
1199
1764
  minus: Minus,
1765
+ mermaid: MermaidIcon,
1200
1766
  more: MoreHorizontal,
1201
1767
  // ol: ListOrdered,
1202
1768
  outdent: Outdent,
@@ -1607,7 +2173,7 @@ const InlineComboboxInput = forwardRef(({ className, ...props }, propRef) => {
1607
2173
  },
1608
2174
  value || "​"
1609
2175
  ), /* @__PURE__ */ React__default.createElement(
1610
- Combobox,
2176
+ Combobox$1,
1611
2177
  {
1612
2178
  autoSelect: true,
1613
2179
  className: cn$1(
@@ -1767,417 +2333,482 @@ const SlashInputElement = withRef(
1767
2333
  );
1768
2334
  }
1769
2335
  );
1770
- const listVariants = cva("m-0 ps-6", {
1771
- variants: {
1772
- variant: {
1773
- ol: "list-decimal",
1774
- ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
1775
- }
1776
- }
1777
- });
1778
- const ListElementVariants = withVariants(PlateElement, listVariants, [
1779
- "variant"
1780
- ]);
1781
- const ListElement = withRef(
1782
- ({ children, variant = "ul", ...props }, ref) => {
1783
- const Component2 = variant;
1784
- return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component2, null, children));
1785
- }
1786
- );
1787
- const BlockquoteElement = withRef(
1788
- ({ children, className, ...props }, ref) => {
1789
- return /* @__PURE__ */ React__default.createElement(
1790
- PlateElement,
1791
- {
1792
- asChild: true,
1793
- className: cn$1("my-1 border-l-2 pl-6 italic", className),
1794
- ref,
1795
- ...props
1796
- },
1797
- /* @__PURE__ */ React__default.createElement("blockquote", null, children)
1798
- );
1799
- }
1800
- );
1801
- const CodeLeaf = withRef(
1802
- ({ children, className, ...props }, ref) => {
1803
- return /* @__PURE__ */ React__default.createElement(
1804
- PlateLeaf,
1805
- {
1806
- asChild: true,
1807
- className: cn$1(
1808
- "whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
1809
- className
1810
- ),
1811
- ref,
1812
- ...props
1813
- },
1814
- /* @__PURE__ */ React__default.createElement("code", null, children)
1815
- );
1816
- }
1817
- );
1818
- const CodeLineElement = withRef((props, ref) => /* @__PURE__ */ React__default.createElement(PlateElement, { ref, ...props }));
1819
- const CodeSyntaxLeaf = withRef(
1820
- ({ children, ...props }, ref) => {
1821
- const { leaf } = props;
1822
- const { tokenProps } = useCodeSyntaxLeaf({ leaf });
1823
- return /* @__PURE__ */ React__default.createElement(PlateLeaf, { ref, ...props }, /* @__PURE__ */ React__default.createElement("span", { ...tokenProps }, children));
1824
- }
1825
- );
1826
- function ChevronDownIcon(props, svgRef) {
1827
- return /* @__PURE__ */ React.createElement("svg", Object.assign({
1828
- xmlns: "http://www.w3.org/2000/svg",
1829
- viewBox: "0 0 20 20",
1830
- fill: "currentColor",
1831
- "aria-hidden": "true",
1832
- ref: svgRef
1833
- }, props), /* @__PURE__ */ React.createElement("path", {
1834
- fillRule: "evenodd",
1835
- 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",
1836
- clipRule: "evenodd"
1837
- }));
1838
- }
1839
- const ForwardRef = React.forwardRef(ChevronDownIcon);
1840
- const ChevronDownIcon$1 = ForwardRef;
1841
- const Autocomplete = ({
1842
- value,
1843
- onChange,
1844
- defaultQuery,
1845
- items: items2
1846
- }) => {
1847
- const [query, setQuery] = React__default.useState(defaultQuery ?? "");
1848
- const filteredItems = React__default.useMemo(() => {
1849
- try {
1850
- const reFilter = new RegExp(query, "i");
1851
- const _items = items2.filter((item) => reFilter.test(item.label));
1852
- if (_items.length === 0)
1853
- return items2;
1854
- return _items;
1855
- } catch (err) {
1856
- return items2;
1857
- }
1858
- }, [items2, query]);
2336
+ const TableCellElement = withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
2337
+ var _a, _b, _c, _d;
2338
+ const { element } = props;
2339
+ const {
2340
+ borders,
2341
+ colIndex,
2342
+ colSpan,
2343
+ hovered,
2344
+ hoveredLeft,
2345
+ isSelectingCell,
2346
+ readOnly,
2347
+ rowIndex,
2348
+ rowSize,
2349
+ selected
2350
+ } = useTableCellElementState();
2351
+ const { props: cellProps } = useTableCellElement({ element: props.element });
2352
+ const resizableState = useTableCellElementResizableState({
2353
+ colIndex,
2354
+ colSpan,
2355
+ rowIndex
2356
+ });
2357
+ const { bottomProps, hiddenLeft, leftProps, rightProps } = useTableCellElementResizable(resizableState);
2358
+ const Cell = isHeader ? "th" : "td";
1859
2359
  return /* @__PURE__ */ React__default.createElement(
1860
- Combobox$1,
2360
+ PlateElement,
1861
2361
  {
1862
- value,
1863
- onChange,
1864
- as: "div",
1865
- className: "relative inline-block text-left z-20"
1866
- },
1867
- /* @__PURE__ */ React__default.createElement("div", { className: "mt-1" }, /* @__PURE__ */ React__default.createElement("div", { className: "relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left shadow-md sm:text-sm" }, /* @__PURE__ */ React__default.createElement(
1868
- ComboboxInput,
1869
- {
1870
- 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",
1871
- displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
1872
- onChange: (event) => setQuery(event.target.value),
1873
- onClick: (ev) => ev.stopPropagation()
2362
+ asChild: true,
2363
+ className: cn$1(
2364
+ "relative h-full overflow-visible border-none bg-background p-0",
2365
+ hideBorder && "before:border-none",
2366
+ element.background ? "bg-[--cellBackground]" : "bg-background",
2367
+ !hideBorder && cn$1(
2368
+ isHeader && "text-left [&_>_*]:m-0",
2369
+ "before:size-full",
2370
+ selected && "before:z-10 before:bg-muted",
2371
+ "before:absolute before:box-border before:select-none before:content-['']",
2372
+ borders && cn$1(
2373
+ ((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
2374
+ ((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
2375
+ ((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
2376
+ ((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
2377
+ )
2378
+ ),
2379
+ className
2380
+ ),
2381
+ ref,
2382
+ ...cellProps,
2383
+ ...props,
2384
+ style: {
2385
+ "--cellBackground": element.background,
2386
+ ...style
1874
2387
  }
1875
- ), /* @__PURE__ */ React__default.createElement(ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React__default.createElement(
1876
- ChevronDownIcon$1,
2388
+ },
2389
+ /* @__PURE__ */ React__default.createElement(Cell, null, /* @__PURE__ */ React__default.createElement(
2390
+ "div",
1877
2391
  {
1878
- className: "h-5 w-5 text-gray-400",
1879
- "aria-hidden": "true"
1880
- }
1881
- )))),
1882
- /* @__PURE__ */ React__default.createElement(
1883
- Transition,
2392
+ className: "relative z-20 box-border h-full px-3 py-2",
2393
+ style: {
2394
+ minHeight: rowSize
2395
+ }
2396
+ },
2397
+ children
2398
+ ), !isSelectingCell && /* @__PURE__ */ React__default.createElement(
2399
+ "div",
1884
2400
  {
1885
- enter: "transition ease-out duration-100",
1886
- enterFrom: "transform opacity-0 scale-95",
1887
- enterTo: "transform opacity-100 scale-100",
1888
- leave: "transition ease-in duration-75",
1889
- leaveFrom: "transform opacity-100 scale-100",
1890
- leaveTo: "transform opacity-0 scale-95"
2401
+ className: "group absolute top-0 size-full select-none",
2402
+ contentEditable: false,
2403
+ suppressContentEditableWarning: true
1891
2404
  },
1892
- /* @__PURE__ */ React__default.createElement(ComboboxOptions, { className: "origin-top-right absolute right-0 mt-1 w-full max-h-[300px] overflow-y-auto rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, filteredItems.map((item) => /* @__PURE__ */ React__default.createElement(ComboboxOption, { key: item.key, value: item }, ({ focus }) => /* @__PURE__ */ React__default.createElement(
1893
- "button",
2405
+ !readOnly && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
2406
+ ResizeHandle$1,
1894
2407
  {
1895
- className: classNames$1(
1896
- focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
1897
- "block px-4 py-2 text-xs w-full text-right"
2408
+ ...rightProps,
2409
+ className: "-top-3 right-[-5px] w-[10px]"
2410
+ }
2411
+ ), /* @__PURE__ */ React__default.createElement(
2412
+ ResizeHandle$1,
2413
+ {
2414
+ ...bottomProps,
2415
+ className: "bottom-[-5px] h-[10px]"
2416
+ }
2417
+ ), !hiddenLeft && /* @__PURE__ */ React__default.createElement(
2418
+ ResizeHandle$1,
2419
+ {
2420
+ ...leftProps,
2421
+ className: "-top-3 left-[-5px] w-[10px]"
2422
+ }
2423
+ ), hovered && /* @__PURE__ */ React__default.createElement(
2424
+ "div",
2425
+ {
2426
+ className: cn$1(
2427
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2428
+ "right-[-1.5px]"
1898
2429
  )
1899
- },
1900
- item.render(item)
1901
- ))))
1902
- )
2430
+ }
2431
+ ), hoveredLeft && /* @__PURE__ */ React__default.createElement(
2432
+ "div",
2433
+ {
2434
+ className: cn$1(
2435
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2436
+ "left-[-1.5px]"
2437
+ )
2438
+ }
2439
+ ))
2440
+ ))
1903
2441
  );
1904
- };
1905
- loader.config({
1906
- paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
1907
2442
  });
1908
- let retryCount = 0;
1909
- const retryFocus = (ref) => {
1910
- if (ref.current) {
1911
- ref.current.focus();
1912
- } else {
1913
- if (retryCount < 30) {
1914
- setTimeout(() => {
1915
- retryCount = retryCount + 1;
1916
- retryFocus(ref);
1917
- }, 100);
1918
- }
1919
- }
1920
- };
1921
- const CodeBlock = ({
1922
- attributes,
1923
- editor,
1924
- element,
1925
- language: restrictLanguage,
1926
- ...props
1927
- }) => {
1928
- const [navigateAway, setNavigateAway] = React__default.useState(null);
1929
- const monaco = useMonaco();
1930
- const monacoEditorRef = React__default.useRef(null);
1931
- const selected = useSelected();
1932
- const [height, setHeight] = React__default.useState(28);
1933
- React__default.useEffect(() => {
1934
- if (selected && isCollapsed(editor.selection)) {
1935
- retryFocus(monacoEditorRef);
2443
+ TableCellElement.displayName = "TableCellElement";
2444
+ const TableCellHeaderElement = withProps(TableCellElement, {
2445
+ isHeader: true
2446
+ });
2447
+ const buttonVariants$1 = cva(
2448
+ "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",
2449
+ {
2450
+ defaultVariants: {
2451
+ size: "default",
2452
+ variant: "default"
2453
+ },
2454
+ variants: {
2455
+ isMenu: {
2456
+ true: "h-auto w-full cursor-pointer justify-start"
2457
+ },
2458
+ size: {
2459
+ default: "h-10 px-4 py-2",
2460
+ icon: "size-10",
2461
+ lg: "h-11 rounded-md px-8",
2462
+ none: "",
2463
+ sm: "h-9 rounded-md px-3",
2464
+ sms: "size-9 rounded-md px-0",
2465
+ xs: "h-8 rounded-md px-3"
2466
+ },
2467
+ variant: {
2468
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
2469
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
2470
+ ghost: "hover:bg-accent hover:text-accent-foreground",
2471
+ inlineLink: "text-base text-primary underline underline-offset-4",
2472
+ link: "text-primary underline-offset-4 hover:underline",
2473
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
2474
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
2475
+ }
1936
2476
  }
1937
- }, [selected, monacoEditorRef.current]);
1938
- const value = element.value || "";
1939
- if (typeof value !== "string") {
1940
- throw new Error("Element must be of type string for code block");
1941
2477
  }
1942
- const language = restrictLanguage || element.lang;
1943
- const id = React__default.useMemo(() => uuid(), []);
1944
- const languages = React__default.useMemo(() => {
1945
- const defaultLangSet = { "": "plain text" };
1946
- if (!monaco)
1947
- return defaultLangSet;
1948
- return monaco.languages.getLanguages().reduce((ac, cv) => {
1949
- if (cv.id === "plaintext")
1950
- return ac;
1951
- return { ...ac, [cv.id]: cv.id };
1952
- }, defaultLangSet);
1953
- }, [monaco]);
1954
- React__default.useEffect(() => {
1955
- if (monaco) {
1956
- monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
1957
- monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
1958
- // disable errors
1959
- noSemanticValidation: true,
1960
- noSyntaxValidation: true
1961
- });
2478
+ );
2479
+ const Button$2 = withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
2480
+ const Comp = asChild ? Slot : "button";
2481
+ return /* @__PURE__ */ React.createElement(
2482
+ Comp,
2483
+ {
2484
+ className: cn$1(buttonVariants$1({ className, isMenu, size, variant })),
2485
+ ref,
2486
+ ...props
1962
2487
  }
1963
- }, [monaco]);
1964
- const items2 = Object.entries(languages).map(([key, label]) => ({
1965
- key,
1966
- label,
1967
- render: (item) => item.label
1968
- }));
1969
- const currentItem = React__default.useMemo(() => {
1970
- return items2.find((item) => item.key === language) ?? {
1971
- key: "",
1972
- label: "Plain Text"
1973
- };
1974
- }, [items2, language]);
1975
- React__default.useEffect(() => {
1976
- if (navigateAway) {
1977
- setNavigateAway(null);
1978
- switch (navigateAway) {
1979
- case "remove":
1980
- {
1981
- focusEditor(editor);
1982
- setNodes(
1983
- editor,
1984
- {
1985
- type: "p",
1986
- children: [{ text: "" }],
1987
- lang: void 0,
1988
- value: void 0
1989
- },
1990
- {
1991
- match: (n) => {
1992
- if (isElement(n) && n.type === element.type) {
1993
- return true;
1994
- }
1995
- }
1996
- }
1997
- );
1998
- }
1999
- break;
2000
- case "insertNext":
2001
- {
2002
- insertNodes(
2003
- editor,
2004
- [
2005
- {
2006
- type: ELEMENT_DEFAULT,
2007
- children: [{ text: "" }],
2008
- lang: void 0,
2009
- value: void 0
2010
- }
2011
- ],
2012
- { select: true }
2013
- );
2014
- focusEditor(editor);
2015
- }
2016
- break;
2017
- case "up":
2018
- {
2019
- const path = findNodePath(editor, element);
2020
- if (!path) {
2021
- return;
2022
- }
2023
- const previousNodePath = getPointBefore(editor, path);
2024
- if (!previousNodePath) {
2025
- focusEditor(editor);
2026
- insertNodes(
2027
- editor,
2028
- [
2029
- {
2030
- type: ELEMENT_DEFAULT,
2031
- children: [{ text: "" }],
2032
- lang: void 0,
2033
- value: void 0
2034
- }
2035
- ],
2036
- // Insert a new node at the current path, resulting in the code_block
2037
- // moving down one block
2038
- { at: path, select: true }
2039
- );
2040
- return;
2041
- }
2042
- focusEditor(editor, previousNodePath);
2043
- }
2044
- break;
2045
- case "down": {
2046
- const path = findNodePath(editor, element);
2047
- if (!path) {
2048
- return;
2049
- }
2050
- const nextNodePath = getPointAfter(editor, path);
2051
- if (!nextNodePath) {
2052
- insertNodes(
2053
- editor,
2054
- [
2055
- {
2056
- type: ELEMENT_DEFAULT,
2057
- children: [{ text: "" }],
2058
- lang: void 0,
2059
- value: void 0
2060
- }
2061
- ],
2062
- { select: true }
2063
- );
2064
- focusEditor(editor);
2065
- } else {
2066
- focusEditor(editor, nextNodePath);
2067
- }
2068
- break;
2069
- }
2488
+ );
2489
+ });
2490
+ const DropdownMenu = DropdownMenuPrimitive.Root;
2491
+ const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
2492
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
2493
+ const DropdownMenuSub = DropdownMenuPrimitive.Sub;
2494
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
2495
+ const DropdownMenuSubTrigger = withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
2496
+ DropdownMenuPrimitive.SubTrigger,
2497
+ {
2498
+ className: cn$1(
2499
+ "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",
2500
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2501
+ inset && "pl-8",
2502
+ className
2503
+ ),
2504
+ ref,
2505
+ ...props
2506
+ },
2507
+ children,
2508
+ /* @__PURE__ */ React__default.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
2509
+ ));
2510
+ const DropdownMenuSubContent = withCn(
2511
+ DropdownMenuPrimitive.SubContent,
2512
+ "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"
2513
+ );
2514
+ const DropdownMenuContentVariants = withProps(DropdownMenuPrimitive.Content, {
2515
+ className: cn$1(
2516
+ "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"
2517
+ ),
2518
+ sideOffset: 4
2519
+ });
2520
+ const DropdownMenuContent = withRef(({ ...props }, ref) => /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.Portal, null, /* @__PURE__ */ React__default.createElement(DropdownMenuContentVariants, { ref, ...props })));
2521
+ const menuItemVariants = cva(
2522
+ cn$1(
2523
+ "relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
2524
+ "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
2525
+ ),
2526
+ {
2527
+ variants: {
2528
+ inset: {
2529
+ true: "pl-8"
2070
2530
  }
2071
2531
  }
2072
- }, [navigateAway]);
2073
- function handleEditorDidMount(monacoEditor, monaco2) {
2074
- monacoEditorRef.current = monacoEditor;
2075
- monacoEditor.onDidContentSizeChange(() => {
2076
- setHeight(monacoEditor.getContentHeight());
2077
- monacoEditor.layout();
2078
- });
2079
- monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
2080
- if (monacoEditor.hasTextFocus()) {
2081
- setNavigateAway("insertNext");
2082
- }
2083
- });
2084
- monacoEditor.onKeyDown((l) => {
2085
- if (l.code === "ArrowUp") {
2086
- const selection = monacoEditor.getSelection();
2087
- if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
2088
- setNavigateAway("up");
2089
- }
2090
- }
2091
- if (l.code === "ArrowDown") {
2092
- const selection = monacoEditor.getSelection();
2093
- const totalLines = monacoEditor.getModel().getLineCount();
2094
- if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
2095
- setNavigateAway("down");
2096
- }
2097
- }
2098
- if (l.code === "Backspace") {
2099
- const selection = monacoEditor.getSelection();
2100
- 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) {
2101
- setNavigateAway("remove");
2102
- }
2532
+ }
2533
+ );
2534
+ const DropdownMenuItem = withVariants(
2535
+ DropdownMenuPrimitive.Item,
2536
+ menuItemVariants,
2537
+ ["inset"]
2538
+ );
2539
+ const DropdownMenuCheckboxItem = withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
2540
+ DropdownMenuPrimitive.CheckboxItem,
2541
+ {
2542
+ className: cn$1(
2543
+ "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",
2544
+ "cursor-pointer",
2545
+ className
2546
+ ),
2547
+ ref,
2548
+ ...props
2549
+ },
2550
+ /* @__PURE__ */ React__default.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
2551
+ children
2552
+ ));
2553
+ const DropdownMenuRadioItem = withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
2554
+ DropdownMenuPrimitive.RadioItem,
2555
+ {
2556
+ className: cn$1(
2557
+ "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",
2558
+ "h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
2559
+ className
2560
+ ),
2561
+ ref,
2562
+ ...props
2563
+ },
2564
+ !hideIcon && /* @__PURE__ */ React__default.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
2565
+ children
2566
+ ));
2567
+ const dropdownMenuLabelVariants = cva(
2568
+ cn$1("select-none px-2 py-1.5 text-sm font-semibold"),
2569
+ {
2570
+ variants: {
2571
+ inset: {
2572
+ true: "pl-8"
2103
2573
  }
2104
- });
2574
+ }
2575
+ }
2576
+ );
2577
+ const DropdownMenuLabel = withVariants(
2578
+ DropdownMenuPrimitive.Label,
2579
+ dropdownMenuLabelVariants,
2580
+ ["inset"]
2581
+ );
2582
+ const DropdownMenuSeparator = withCn(
2583
+ DropdownMenuPrimitive.Separator,
2584
+ "-mx-1 my-1 h-px bg-muted"
2585
+ );
2586
+ withCn(
2587
+ createPrimitiveElement("span"),
2588
+ "ml-auto text-xs tracking-widest opacity-60"
2589
+ );
2590
+ const useOpenState = () => {
2591
+ const [open2, setOpen] = useState(false);
2592
+ const onOpenChange = useCallback(
2593
+ (_value = !open2) => {
2594
+ setOpen(_value);
2595
+ },
2596
+ [open2]
2597
+ );
2598
+ return {
2599
+ onOpenChange,
2600
+ open: open2
2601
+ };
2602
+ };
2603
+ const Popover$2 = PopoverPrimitive.Root;
2604
+ const popoverVariants = cva(
2605
+ "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"
2606
+ );
2607
+ const PopoverContent$1 = withRef(
2608
+ ({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
2609
+ PopoverPrimitive.Content,
2610
+ {
2611
+ align,
2612
+ className: cn$1(popoverVariants(), className),
2613
+ ref,
2614
+ sideOffset,
2615
+ style: { zIndex: 1e3, ...style },
2616
+ ...props
2617
+ }
2618
+ ))
2619
+ );
2620
+ const separatorVariants = cva("shrink-0 bg-border", {
2621
+ defaultVariants: {
2622
+ orientation: "horizontal"
2623
+ },
2624
+ variants: {
2625
+ orientation: {
2626
+ horizontal: "h-px w-full",
2627
+ vertical: "h-full w-px"
2628
+ }
2105
2629
  }
2630
+ });
2631
+ const Separator = withVariants(
2632
+ withProps(SeparatorPrimitive.Root, {
2633
+ decorative: true,
2634
+ orientation: "horizontal"
2635
+ }),
2636
+ separatorVariants
2637
+ );
2638
+ const TableBordersDropdownMenuContent = withRef((props, ref) => {
2639
+ const {
2640
+ getOnSelectTableBorder,
2641
+ hasBottomBorder,
2642
+ hasLeftBorder,
2643
+ hasNoBorders,
2644
+ hasOuterBorders,
2645
+ hasRightBorder,
2646
+ hasTopBorder
2647
+ } = useTableBordersDropdownMenuContentState();
2106
2648
  return /* @__PURE__ */ React__default.createElement(
2107
- "div",
2649
+ DropdownMenuContent,
2108
2650
  {
2109
- ...attributes,
2110
- className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
2651
+ align: "start",
2652
+ className: cn$1("min-w-[220px]"),
2653
+ ref,
2654
+ side: "right",
2655
+ sideOffset: 0,
2656
+ ...props
2111
2657
  },
2112
- /* @__PURE__ */ React__default.createElement("style", null, `.monaco-editor .editor-widget {
2113
- display: none !important;
2114
- visibility: hidden !important;
2115
- }`),
2116
- props.children,
2117
- /* @__PURE__ */ React__default.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React__default.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React__default.createElement("div", null), /* @__PURE__ */ React__default.createElement(
2118
- Autocomplete,
2658
+ /* @__PURE__ */ React__default.createElement(
2659
+ DropdownMenuCheckboxItem,
2119
2660
  {
2120
- items: items2,
2121
- value: currentItem,
2122
- defaultQuery: "plaintext",
2123
- onChange: (item) => setNodes(editor, { lang: item.key })
2124
- }
2125
- )), /* @__PURE__ */ React__default.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React__default.createElement(
2126
- MonacoEditor,
2661
+ checked: hasBottomBorder,
2662
+ onCheckedChange: getOnSelectTableBorder("bottom")
2663
+ },
2664
+ /* @__PURE__ */ React__default.createElement(Icons.borderBottom, { className: iconVariants({ size: "sm" }) }),
2665
+ /* @__PURE__ */ React__default.createElement("div", null, "Bottom Border")
2666
+ ),
2667
+ /* @__PURE__ */ React__default.createElement(
2668
+ DropdownMenuCheckboxItem,
2127
2669
  {
2128
- path: id,
2129
- onMount: handleEditorDidMount,
2130
- options: {
2131
- scrollBeyondLastLine: false,
2132
- // automaticLayout: true,
2133
- tabSize: 2,
2134
- disableLayerHinting: true,
2135
- accessibilitySupport: "off",
2136
- codeLens: false,
2137
- wordWrap: "on",
2138
- minimap: {
2139
- enabled: false
2140
- },
2141
- fontSize: 14,
2142
- lineHeight: 2,
2143
- formatOnPaste: true,
2144
- lineNumbers: "off",
2145
- formatOnType: true,
2146
- fixedOverflowWidgets: true,
2147
- // Takes too much horizontal space for iframe
2148
- folding: false,
2149
- renderLineHighlight: "none",
2150
- scrollbar: {
2151
- verticalScrollbarSize: 1,
2152
- horizontalScrollbarSize: 1,
2153
- // https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
2154
- alwaysConsumeMouseWheel: false
2155
- }
2156
- },
2157
- language: String(language),
2158
- value: String(element.value),
2159
- onChange: (value2) => {
2160
- setNodes(editor, { value: value2, lang: language });
2161
- }
2162
- }
2163
- )))
2670
+ checked: hasTopBorder,
2671
+ onCheckedChange: getOnSelectTableBorder("top")
2672
+ },
2673
+ /* @__PURE__ */ React__default.createElement(Icons.borderTop, { className: iconVariants({ size: "sm" }) }),
2674
+ /* @__PURE__ */ React__default.createElement("div", null, "Top Border")
2675
+ ),
2676
+ /* @__PURE__ */ React__default.createElement(
2677
+ DropdownMenuCheckboxItem,
2678
+ {
2679
+ checked: hasLeftBorder,
2680
+ onCheckedChange: getOnSelectTableBorder("left")
2681
+ },
2682
+ /* @__PURE__ */ React__default.createElement(Icons.borderLeft, { className: iconVariants({ size: "sm" }) }),
2683
+ /* @__PURE__ */ React__default.createElement("div", null, "Left Border")
2684
+ ),
2685
+ /* @__PURE__ */ React__default.createElement(
2686
+ DropdownMenuCheckboxItem,
2687
+ {
2688
+ checked: hasRightBorder,
2689
+ onCheckedChange: getOnSelectTableBorder("right")
2690
+ },
2691
+ /* @__PURE__ */ React__default.createElement(Icons.borderRight, { className: iconVariants({ size: "sm" }) }),
2692
+ /* @__PURE__ */ React__default.createElement("div", null, "Right Border")
2693
+ ),
2694
+ /* @__PURE__ */ React__default.createElement(Separator, null),
2695
+ /* @__PURE__ */ React__default.createElement(
2696
+ DropdownMenuCheckboxItem,
2697
+ {
2698
+ checked: hasNoBorders,
2699
+ onCheckedChange: getOnSelectTableBorder("none")
2700
+ },
2701
+ /* @__PURE__ */ React__default.createElement(Icons.borderNone, { className: iconVariants({ size: "sm" }) }),
2702
+ /* @__PURE__ */ React__default.createElement("div", null, "No Border")
2703
+ ),
2704
+ /* @__PURE__ */ React__default.createElement(
2705
+ DropdownMenuCheckboxItem,
2706
+ {
2707
+ checked: hasOuterBorders,
2708
+ onCheckedChange: getOnSelectTableBorder("outer")
2709
+ },
2710
+ /* @__PURE__ */ React__default.createElement(Icons.borderAll, { className: iconVariants({ size: "sm" }) }),
2711
+ /* @__PURE__ */ React__default.createElement("div", null, "Outside Borders")
2712
+ )
2164
2713
  );
2165
- };
2166
- const CodeBlockElement = withRef(
2167
- ({ className, ...props }, ref) => {
2168
- const { element } = props;
2169
- const state = useCodeBlockElementState({ element });
2170
- return /* @__PURE__ */ React__default.createElement(
2171
- PlateElement,
2714
+ });
2715
+ const TableFloatingToolbar = withRef(
2716
+ ({ children, ...props }, ref) => {
2717
+ const element = useElement();
2718
+ const { props: buttonProps } = useRemoveNodeButton({ element });
2719
+ const selectionCollapsed = useEditorSelector(
2720
+ (editor2) => !isSelectionExpanded(editor2),
2721
+ []
2722
+ );
2723
+ const readOnly = useReadOnly();
2724
+ const selected = useSelected();
2725
+ const editor = useEditorRef();
2726
+ const collapsed = !readOnly && selected && selectionCollapsed;
2727
+ const open2 = !readOnly && selected;
2728
+ const { canMerge, canUnmerge } = useTableMergeState();
2729
+ const mergeContent = canMerge && /* @__PURE__ */ React__default.createElement(
2730
+ Button$2,
2172
2731
  {
2173
- className: cn$1("relative py-1", state.className, className),
2732
+ contentEditable: false,
2733
+ isMenu: true,
2734
+ onClick: () => mergeTableCells(editor),
2735
+ variant: "ghost"
2736
+ },
2737
+ /* @__PURE__ */ React__default.createElement(Icons.combine, { className: "mr-2 size-4" }),
2738
+ "Merge"
2739
+ );
2740
+ const unmergeButton = canUnmerge && /* @__PURE__ */ React__default.createElement(
2741
+ Button$2,
2742
+ {
2743
+ contentEditable: false,
2744
+ isMenu: true,
2745
+ onClick: () => unmergeTableCells(editor),
2746
+ variant: "ghost"
2747
+ },
2748
+ /* @__PURE__ */ React__default.createElement(Icons.ungroup, { className: "mr-2 size-4" }),
2749
+ "Unmerge"
2750
+ );
2751
+ const bordersContent = collapsed && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(Button$2, { isMenu: true, variant: "ghost" }, /* @__PURE__ */ React__default.createElement(Icons.borderAll, { className: "mr-2 size-4" }), "Borders")), /* @__PURE__ */ React__default.createElement(DropdownMenuPortal, null, /* @__PURE__ */ React__default.createElement(TableBordersDropdownMenuContent, null))), /* @__PURE__ */ React__default.createElement(Button$2, { contentEditable: false, isMenu: true, variant: "ghost", ...buttonProps }, /* @__PURE__ */ React__default.createElement(Icons.delete, { className: "mr-2 size-4" }), "Delete"));
2752
+ return /* @__PURE__ */ React__default.createElement(Popover$2, { modal: false, open: open2 }, /* @__PURE__ */ React__default.createElement(PopoverAnchor, { asChild: true }, children), (canMerge || canUnmerge || collapsed) && /* @__PURE__ */ React__default.createElement(
2753
+ PopoverContent$1,
2754
+ {
2755
+ className: cn$1(
2756
+ popoverVariants(),
2757
+ "flex w-[220px] flex-col gap-1 p-1"
2758
+ ),
2759
+ onOpenAutoFocus: (e) => e.preventDefault(),
2174
2760
  ref,
2175
2761
  ...props
2176
2762
  },
2177
- /* @__PURE__ */ React__default.createElement(CodeBlock, { ...props })
2178
- );
2763
+ unmergeButton,
2764
+ mergeContent,
2765
+ bordersContent
2766
+ ));
2179
2767
  }
2180
2768
  );
2769
+ const TableElement = withHOC(
2770
+ TableProvider,
2771
+ withRef(({ children, className, ...props }, ref) => {
2772
+ const { colSizes, isSelectingCell, marginLeft, minColumnWidth } = useTableElementState();
2773
+ const { colGroupProps, props: tableProps } = useTableElement();
2774
+ return /* @__PURE__ */ React__default.createElement(TableFloatingToolbar, null, /* @__PURE__ */ React__default.createElement("div", { style: { paddingLeft: marginLeft } }, /* @__PURE__ */ React__default.createElement(
2775
+ PlateElement,
2776
+ {
2777
+ asChild: true,
2778
+ className: cn$1(
2779
+ "my-4 ml-px mr-0 table h-px w-full table-fixed border-collapse",
2780
+ isSelectingCell && "[&_*::selection]:bg-none",
2781
+ className
2782
+ ),
2783
+ ref,
2784
+ ...tableProps,
2785
+ ...props
2786
+ },
2787
+ /* @__PURE__ */ React__default.createElement("table", null, /* @__PURE__ */ React__default.createElement("colgroup", { ...colGroupProps }, colSizes.map((width, index) => /* @__PURE__ */ React__default.createElement(
2788
+ "col",
2789
+ {
2790
+ key: index,
2791
+ style: {
2792
+ minWidth: minColumnWidth,
2793
+ width: width || void 0
2794
+ }
2795
+ }
2796
+ ))), /* @__PURE__ */ React__default.createElement("tbody", { className: "min-w-full" }, children))
2797
+ )));
2798
+ })
2799
+ );
2800
+ const TableRowElement = withRef(({ children, hideBorder, ...props }, ref) => {
2801
+ return /* @__PURE__ */ React__default.createElement(
2802
+ PlateElement,
2803
+ {
2804
+ asChild: true,
2805
+ className: cn$1("h-full", hideBorder && "border-none"),
2806
+ ref,
2807
+ ...props
2808
+ },
2809
+ /* @__PURE__ */ React__default.createElement("tr", null, children)
2810
+ );
2811
+ });
2181
2812
  const blockClasses = "mt-0.5";
2182
2813
  const headerClasses = "font-normal";
2183
2814
  const Components = () => {
@@ -2283,6 +2914,7 @@ const Components = () => {
2283
2914
  }
2284
2915
  )
2285
2916
  ),
2917
+ [ELEMENT_MERMAID]: MermaidElement,
2286
2918
  [ELEMENT_BLOCKQUOTE]: BlockquoteElement,
2287
2919
  [ELEMENT_CODE_BLOCK]: CodeBlockElement,
2288
2920
  [ELEMENT_CODE_LINE]: CodeLineElement,
@@ -2363,7 +2995,11 @@ const Components = () => {
2363
2995
  children,
2364
2996
  selected && /* @__PURE__ */ React__default.createElement("span", { className: "absolute h-4 -top-2 inset-0 ring-2 ring-blue-100 ring-inset rounded-md z-10 pointer-events-none" })
2365
2997
  );
2366
- }
2998
+ },
2999
+ [ELEMENT_TABLE]: TableElement,
3000
+ [ELEMENT_TR]: TableRowElement,
3001
+ [ELEMENT_TD]: TableCellElement,
3002
+ [ELEMENT_TH]: TableCellHeaderElement
2367
3003
  };
2368
3004
  };
2369
3005
  const createCodeBlockPlugin = createPluginFactory({
@@ -2773,7 +3409,9 @@ class Form {
2773
3409
  {
2774
3410
  type: "string",
2775
3411
  label: "Caption",
2776
- name: [templateName.replace(/\.props$/, ""), "caption"].join("."),
3412
+ name: [templateName.replace(/\.props$/, ""), "caption"].join(
3413
+ "."
3414
+ ),
2777
3415
  component: "text"
2778
3416
  }
2779
3417
  ]
@@ -3041,7 +3679,7 @@ function TinaForm({ form, children }) {
3041
3679
  }));
3042
3680
  }
3043
3681
  function TinaField({
3044
- Component: Component2,
3682
+ Component,
3045
3683
  children,
3046
3684
  ...fieldProps
3047
3685
  }) {
@@ -3049,7 +3687,7 @@ function TinaField({
3049
3687
  if (!isEditing)
3050
3688
  return children || null;
3051
3689
  return /* @__PURE__ */ React.createElement(Field, { ...fieldProps }, ({ input, meta }) => {
3052
- return /* @__PURE__ */ React.createElement(Component2, { input, meta, ...fieldProps });
3690
+ return /* @__PURE__ */ React.createElement(Component, { input, meta, ...fieldProps });
3053
3691
  });
3054
3692
  }
3055
3693
  TinaField.propTypes = {
@@ -3091,7 +3729,7 @@ const Button$1 = ({
3091
3729
  };
3092
3730
  const sizeClasses = {
3093
3731
  small: `text-xs h-8 px-3`,
3094
- medium: `text-sm h-10 px-4`,
3732
+ medium: `text-sm h-10 px-8`,
3095
3733
  custom: ``
3096
3734
  };
3097
3735
  return /* @__PURE__ */ React.createElement(
@@ -3219,7 +3857,7 @@ var _excluded = ["attr", "size", "title"];
3219
3857
  function _objectWithoutProperties(source, excluded) {
3220
3858
  if (source == null)
3221
3859
  return {};
3222
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
3860
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3223
3861
  var key, i;
3224
3862
  if (Object.getOwnPropertySymbols) {
3225
3863
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3234,7 +3872,7 @@ function _objectWithoutProperties(source, excluded) {
3234
3872
  }
3235
3873
  return target;
3236
3874
  }
3237
- function _objectWithoutPropertiesLoose$1(source, excluded) {
3875
+ function _objectWithoutPropertiesLoose(source, excluded) {
3238
3876
  if (source == null)
3239
3877
  return {};
3240
3878
  var target = {};
@@ -4324,7 +4962,28 @@ const NumberInput = ({
4324
4962
  onChange,
4325
4963
  value,
4326
4964
  step
4327
- }) => /* @__PURE__ */ React.createElement(Input, { type: "number", step, value, onChange });
4965
+ }) => /* @__PURE__ */ React.createElement(
4966
+ Input,
4967
+ {
4968
+ type: "number",
4969
+ step,
4970
+ value,
4971
+ onChange: (event) => {
4972
+ const inputValue = event.target.value;
4973
+ const newValue = inputValue === "" ? void 0 : inputValue;
4974
+ if (onChange) {
4975
+ const syntheticEvent = {
4976
+ ...event,
4977
+ target: {
4978
+ ...event.target,
4979
+ value: newValue
4980
+ }
4981
+ };
4982
+ onChange(syntheticEvent);
4983
+ }
4984
+ }
4985
+ }
4986
+ );
4328
4987
  function useCMS() {
4329
4988
  return useCMS$1();
4330
4989
  }
@@ -4433,7 +5092,7 @@ const ImageLoadingIndicator = () => /* @__PURE__ */ React.createElement("div", {
4433
5092
  function cn(...inputs) {
4434
5093
  return twMerge(clsx(inputs));
4435
5094
  }
4436
- const buttonVariants$1 = cva(
5095
+ const buttonVariants = cva(
4437
5096
  "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",
4438
5097
  {
4439
5098
  variants: {
@@ -4459,7 +5118,7 @@ const Button = React.forwardRef(
4459
5118
  return /* @__PURE__ */ React.createElement(
4460
5119
  Comp,
4461
5120
  {
4462
- className: cn(buttonVariants$1({ variant, size, className })),
5121
+ className: cn(buttonVariants({ variant, size, className })),
4463
5122
  ref,
4464
5123
  ...props
4465
5124
  }
@@ -4628,7 +5287,10 @@ const useGetOptionSets = (cms, collections, collectionFilter) => {
4628
5287
  edges: response.collection.documents.edges
4629
5288
  };
4630
5289
  } catch (e) {
4631
- console.error("Unhandle exception:", e);
5290
+ console.error(
5291
+ "Exception thrown while building and running GraphQL query: ",
5292
+ e
5293
+ );
4632
5294
  return {
4633
5295
  collection,
4634
5296
  edges: []
@@ -5122,10 +5784,11 @@ const ItemDeleteButton = ({ onClick, disabled = false }) => {
5122
5784
  return /* @__PURE__ */ React__default.createElement(
5123
5785
  "button",
5124
5786
  {
5125
- 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"}`,
5787
+ type: "button",
5788
+ 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"}`,
5126
5789
  onClick
5127
5790
  },
5128
- /* @__PURE__ */ React__default.createElement(TrashIcon, { className: "fill-current transition-colors ease-out duration-100" })
5791
+ /* @__PURE__ */ React__default.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
5129
5792
  );
5130
5793
  };
5131
5794
  const DragHandle = ({ isDragging }) => {
@@ -5155,7 +5818,7 @@ const BlockSelector = ({
5155
5818
  return template.label ? template.label.toLowerCase().includes(filter.toLowerCase()) || name.toLowerCase().includes(filter.toLowerCase()) : name.toLowerCase().includes(filter.toLowerCase());
5156
5819
  });
5157
5820
  }, [filter]);
5158
- return /* @__PURE__ */ React.createElement(Popover$2, null, ({ open: open2 }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PopoverButton, { as: "span" }, /* @__PURE__ */ React.createElement(
5821
+ return /* @__PURE__ */ React.createElement(Popover$3, null, ({ open: open2 }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PopoverButton, { as: "span" }, /* @__PURE__ */ React.createElement(
5159
5822
  IconButton,
5160
5823
  {
5161
5824
  variant: open2 ? "secondary" : "primary",
@@ -5203,27 +5866,35 @@ const BlockSelector = ({
5203
5866
  ))))
5204
5867
  ))));
5205
5868
  };
5206
- const Group = wrapFieldWithError(({ tinaForm, field }) => {
5207
- const cms = useCMS$1();
5208
- React.useState(false);
5209
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
5210
- Header,
5211
- {
5212
- onClick: () => {
5213
- const state = tinaForm.finalForm.getState();
5214
- if (state.invalid === true) {
5215
- cms.alerts.error("Cannot navigate away from an invalid form.");
5216
- return;
5869
+ const Group = wrapFieldWithNoHeader(
5870
+ ({ tinaForm, field }) => {
5871
+ const cms = useCMS$1();
5872
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
5873
+ Header,
5874
+ {
5875
+ onClick: () => {
5876
+ const state = tinaForm.finalForm.getState();
5877
+ if (state.invalid === true) {
5878
+ cms.alerts.error("Cannot navigate away from an invalid form.");
5879
+ return;
5880
+ }
5881
+ cms.dispatch({
5882
+ type: "forms:set-active-field-name",
5883
+ value: { formId: tinaForm.id, fieldName: field.name }
5884
+ });
5217
5885
  }
5218
- cms.dispatch({
5219
- type: "forms:set-active-field-name",
5220
- value: { formId: tinaForm.id, fieldName: field.name }
5221
- });
5222
- }
5223
- },
5224
- field.label || field.name
5225
- ));
5226
- });
5886
+ },
5887
+ field.label || field.name,
5888
+ field.description && /* @__PURE__ */ React.createElement(
5889
+ "span",
5890
+ {
5891
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
5892
+ dangerouslySetInnerHTML: { __html: field.description }
5893
+ }
5894
+ )
5895
+ ));
5896
+ }
5897
+ );
5227
5898
  const Header = ({ onClick, children }) => {
5228
5899
  return /* @__PURE__ */ React.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React.createElement(
5229
5900
  "button",
@@ -6565,244 +7236,65 @@ function pad(type, value) {
6565
7236
  str = "0" + str;
6566
7237
  return str;
6567
7238
  }
6568
- function _inheritsLoose(subClass, superClass) {
6569
- subClass.prototype = Object.create(superClass.prototype);
6570
- subClass.prototype.constructor = subClass;
6571
- _setPrototypeOf(subClass, superClass);
6572
- }
6573
- function _setPrototypeOf(o, p) {
6574
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
6575
- o2.__proto__ = p2;
6576
- return o2;
6577
- };
6578
- return _setPrototypeOf(o, p);
6579
- }
6580
- function _objectWithoutPropertiesLoose(source, excluded) {
6581
- if (source == null)
6582
- return {};
6583
- var target = {};
6584
- var sourceKeys = Object.keys(source);
6585
- var key, i;
6586
- for (i = 0; i < sourceKeys.length; i++) {
6587
- key = sourceKeys[i];
6588
- if (excluded.indexOf(key) >= 0)
6589
- continue;
6590
- target[key] = source[key];
6591
- }
6592
- return target;
6593
- }
6594
- function _assertThisInitialized(self) {
6595
- if (self === void 0) {
6596
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
6597
- }
6598
- return self;
6599
- }
6600
- function isNodeFound(current, componentNode, ignoreClass) {
6601
- if (current === componentNode) {
6602
- return true;
6603
- }
6604
- if (current.correspondingElement) {
6605
- return current.correspondingElement.classList.contains(ignoreClass);
6606
- }
6607
- return current.classList.contains(ignoreClass);
6608
- }
6609
- function findHighest(current, componentNode, ignoreClass) {
6610
- if (current === componentNode) {
6611
- return true;
7239
+ var useClickAway$1 = {};
7240
+ var util = {};
7241
+ Object.defineProperty(util, "__esModule", { value: true });
7242
+ util.isNavigator = util.isBrowser = util.off = util.on = util.noop = void 0;
7243
+ var noop = function() {
7244
+ };
7245
+ util.noop = noop;
7246
+ function on(obj) {
7247
+ var args = [];
7248
+ for (var _i = 1; _i < arguments.length; _i++) {
7249
+ args[_i - 1] = arguments[_i];
6612
7250
  }
6613
- while (current.parentNode || current.host) {
6614
- if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {
6615
- return true;
6616
- }
6617
- current = current.parentNode || current.host;
7251
+ if (obj && obj.addEventListener) {
7252
+ obj.addEventListener.apply(obj, args);
6618
7253
  }
6619
- return current;
6620
7254
  }
6621
- function clickedScrollbar(evt) {
6622
- return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
6623
- }
6624
- var testPassiveEventSupport = function testPassiveEventSupport2() {
6625
- if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
6626
- return;
7255
+ util.on = on;
7256
+ function off(obj) {
7257
+ var args = [];
7258
+ for (var _i = 1; _i < arguments.length; _i++) {
7259
+ args[_i - 1] = arguments[_i];
6627
7260
  }
6628
- var passive = false;
6629
- var options = Object.defineProperty({}, "passive", {
6630
- get: function get2() {
6631
- passive = true;
6632
- }
6633
- });
6634
- var noop = function noop2() {
6635
- };
6636
- window.addEventListener("testPassiveEventSupport", noop, options);
6637
- window.removeEventListener("testPassiveEventSupport", noop, options);
6638
- return passive;
6639
- };
6640
- function autoInc(seed) {
6641
- if (seed === void 0) {
6642
- seed = 0;
7261
+ if (obj && obj.removeEventListener) {
7262
+ obj.removeEventListener.apply(obj, args);
6643
7263
  }
6644
- return function() {
6645
- return ++seed;
6646
- };
6647
7264
  }
6648
- var uid = autoInc();
6649
- var passiveEventSupport;
6650
- var handlersMap = {};
6651
- var enabledInstances = {};
6652
- var touchEvents = ["touchstart", "touchmove"];
6653
- var IGNORE_CLASS_NAME = "ignore-react-onclickoutside";
6654
- function getEventHandlerOptions(instance, eventName) {
6655
- var handlerOptions = {};
6656
- var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
6657
- if (isTouchEvent && passiveEventSupport) {
6658
- handlerOptions.passive = !instance.props.preventDefault;
6659
- }
6660
- return handlerOptions;
6661
- }
6662
- function onClickOutsideHOC(WrappedComponent, config) {
6663
- var _class, _temp;
6664
- var componentName = WrappedComponent.displayName || WrappedComponent.name || "Component";
6665
- return _temp = _class = /* @__PURE__ */ function(_Component) {
6666
- _inheritsLoose(onClickOutside, _Component);
6667
- function onClickOutside(props) {
6668
- var _this;
6669
- _this = _Component.call(this, props) || this;
6670
- _this.__outsideClickHandler = function(event) {
6671
- if (typeof _this.__clickOutsideHandlerProp === "function") {
6672
- _this.__clickOutsideHandlerProp(event);
6673
- return;
6674
- }
6675
- var instance = _this.getInstance();
6676
- if (typeof instance.props.handleClickOutside === "function") {
6677
- instance.props.handleClickOutside(event);
6678
- return;
6679
- }
6680
- if (typeof instance.handleClickOutside === "function") {
6681
- instance.handleClickOutside(event);
6682
- return;
6683
- }
6684
- throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
6685
- };
6686
- _this.__getComponentNode = function() {
6687
- var instance = _this.getInstance();
6688
- if (config && typeof config.setClickOutsideRef === "function") {
6689
- return config.setClickOutsideRef()(instance);
6690
- }
6691
- if (typeof instance.setClickOutsideRef === "function") {
6692
- return instance.setClickOutsideRef();
6693
- }
6694
- return findDOMNode(instance);
6695
- };
6696
- _this.enableOnClickOutside = function() {
6697
- if (typeof document === "undefined" || enabledInstances[_this._uid]) {
6698
- return;
6699
- }
6700
- if (typeof passiveEventSupport === "undefined") {
6701
- passiveEventSupport = testPassiveEventSupport();
6702
- }
6703
- enabledInstances[_this._uid] = true;
6704
- var events = _this.props.eventTypes;
6705
- if (!events.forEach) {
6706
- events = [events];
6707
- }
6708
- handlersMap[_this._uid] = function(event) {
6709
- if (_this.componentNode === null)
6710
- return;
6711
- if (_this.initTimeStamp > event.timeStamp)
6712
- return;
6713
- if (_this.props.preventDefault) {
6714
- event.preventDefault();
6715
- }
6716
- if (_this.props.stopPropagation) {
6717
- event.stopPropagation();
6718
- }
6719
- if (_this.props.excludeScrollbar && clickedScrollbar(event))
6720
- return;
6721
- var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
6722
- if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
6723
- return;
6724
- }
6725
- _this.__outsideClickHandler(event);
6726
- };
6727
- events.forEach(function(eventName) {
6728
- document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
6729
- });
6730
- };
6731
- _this.disableOnClickOutside = function() {
6732
- delete enabledInstances[_this._uid];
6733
- var fn = handlersMap[_this._uid];
6734
- if (fn && typeof document !== "undefined") {
6735
- var events = _this.props.eventTypes;
6736
- if (!events.forEach) {
6737
- events = [events];
6738
- }
6739
- events.forEach(function(eventName) {
6740
- return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
6741
- });
6742
- delete handlersMap[_this._uid];
6743
- }
6744
- };
6745
- _this.getRef = function(ref) {
6746
- return _this.instanceRef = ref;
6747
- };
6748
- _this._uid = uid();
6749
- _this.initTimeStamp = performance.now();
6750
- return _this;
6751
- }
6752
- var _proto = onClickOutside.prototype;
6753
- _proto.getInstance = function getInstance() {
6754
- if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
6755
- return this;
6756
- }
6757
- var ref = this.instanceRef;
6758
- return ref.getInstance ? ref.getInstance() : ref;
6759
- };
6760
- _proto.componentDidMount = function componentDidMount() {
6761
- if (typeof document === "undefined" || !document.createElement) {
6762
- return;
6763
- }
6764
- var instance = this.getInstance();
6765
- if (config && typeof config.handleClickOutside === "function") {
6766
- this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
6767
- if (typeof this.__clickOutsideHandlerProp !== "function") {
6768
- throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
6769
- }
6770
- }
6771
- this.componentNode = this.__getComponentNode();
6772
- if (this.props.disableOnClickOutside)
6773
- return;
6774
- this.enableOnClickOutside();
6775
- };
6776
- _proto.componentDidUpdate = function componentDidUpdate() {
6777
- this.componentNode = this.__getComponentNode();
6778
- };
6779
- _proto.componentWillUnmount = function componentWillUnmount() {
6780
- this.disableOnClickOutside();
7265
+ util.off = off;
7266
+ util.isBrowser = typeof window !== "undefined";
7267
+ util.isNavigator = typeof navigator !== "undefined";
7268
+ Object.defineProperty(useClickAway$1, "__esModule", { value: true });
7269
+ var react_1 = React__default;
7270
+ var util_1 = util;
7271
+ var defaultEvents = ["mousedown", "touchstart"];
7272
+ var useClickAway = function(ref, onClickAway, events) {
7273
+ if (events === void 0) {
7274
+ events = defaultEvents;
7275
+ }
7276
+ var savedCallback = react_1.useRef(onClickAway);
7277
+ react_1.useEffect(function() {
7278
+ savedCallback.current = onClickAway;
7279
+ }, [onClickAway]);
7280
+ react_1.useEffect(function() {
7281
+ var handler = function(event) {
7282
+ var el = ref.current;
7283
+ el && !el.contains(event.target) && savedCallback.current(event);
6781
7284
  };
6782
- _proto.render = function render() {
6783
- var _this$props = this.props;
6784
- _this$props.excludeScrollbar;
6785
- var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
6786
- if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
6787
- props.ref = this.getRef;
6788
- } else {
6789
- props.wrappedRef = this.getRef;
7285
+ for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
7286
+ var eventName = events_1[_i];
7287
+ util_1.on(document, eventName, handler);
7288
+ }
7289
+ return function() {
7290
+ for (var _i2 = 0, events_2 = events; _i2 < events_2.length; _i2++) {
7291
+ var eventName2 = events_2[_i2];
7292
+ util_1.off(document, eventName2, handler);
6790
7293
  }
6791
- props.disableOnClickOutside = this.disableOnClickOutside;
6792
- props.enableOnClickOutside = this.enableOnClickOutside;
6793
- return createElement(WrappedComponent, props);
6794
7294
  };
6795
- return onClickOutside;
6796
- }(Component), _class.displayName = "OnClickOutside(" + componentName + ")", _class.defaultProps = {
6797
- eventTypes: ["mousedown", "touchstart"],
6798
- excludeScrollbar: config && config.excludeScrollbar || false,
6799
- outsideClickIgnoreClass: IGNORE_CLASS_NAME,
6800
- preventDefault: false,
6801
- stopPropagation: false
6802
- }, _class.getClass = function() {
6803
- return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
6804
- }, _temp;
6805
- }
7295
+ }, [events, ref]);
7296
+ };
7297
+ var _default = useClickAway$1.default = useClickAway;
6806
7298
  const viewModes = {
6807
7299
  YEARS: "years",
6808
7300
  MONTHS: "months",
@@ -7331,22 +7823,13 @@ function log(message, method) {
7331
7823
  }
7332
7824
  con[method]("***react-datetime:" + message);
7333
7825
  }
7334
- class ClickOutBase extends React__default.Component {
7335
- constructor() {
7336
- super(...arguments);
7337
- __publicField(this, "container", React__default.createRef());
7338
- }
7339
- render() {
7340
- return /* @__PURE__ */ React__default.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
7341
- }
7342
- handleClickOutside(e) {
7343
- this.props.onClickOut(e);
7344
- }
7345
- setClickOutsideRef() {
7346
- return this.container.current;
7347
- }
7826
+ function ClickableWrapper({ className, onClickOut, children }) {
7827
+ const containerRef = useRef(null);
7828
+ _default(containerRef, (event) => {
7829
+ onClickOut(event);
7830
+ });
7831
+ return /* @__PURE__ */ React__default.createElement("div", { className, ref: containerRef }, children);
7348
7832
  }
7349
- const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
7350
7833
  const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
7351
7834
  const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
7352
7835
  const format$1 = (val, _name, field) => {
@@ -7389,7 +7872,10 @@ const DateField = wrapFieldsWithMeta(
7389
7872
  ReactDateTimeWithStyles,
7390
7873
  {
7391
7874
  value: input.value,
7392
- onChange: input.onChange,
7875
+ onChange: (value) => {
7876
+ const newValue = value === "" ? void 0 : value;
7877
+ input.onChange(newValue);
7878
+ },
7393
7879
  dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
7394
7880
  timeFormat: timeFormat || false,
7395
7881
  inputProps: { className: textFieldClasses },
@@ -9200,7 +9686,7 @@ class SidebarState {
9200
9686
  }
9201
9687
  }
9202
9688
  function createScreen({
9203
- Component: Component2,
9689
+ Component,
9204
9690
  props,
9205
9691
  ...options
9206
9692
  }) {
@@ -9209,7 +9695,7 @@ function createScreen({
9209
9695
  layout: "popup",
9210
9696
  ...options,
9211
9697
  Component(screenProps) {
9212
- return /* @__PURE__ */ React__default.createElement(Component2, { ...screenProps, ...props });
9698
+ return /* @__PURE__ */ React__default.createElement(Component, { ...screenProps, ...props });
9213
9699
  }
9214
9700
  };
9215
9701
  }
@@ -9720,7 +10206,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
9720
10206
  "Event Log"
9721
10207
  ));
9722
10208
  };
9723
- const version = "2.2.8";
10209
+ const version = "2.6.0";
9724
10210
  const Nav = ({
9725
10211
  isLocalMode,
9726
10212
  className = "",
@@ -12251,15 +12737,14 @@ const FormBuilder = ({
12251
12737
  fields: fieldGroup.fields
12252
12738
  }
12253
12739
  ) : /* @__PURE__ */ React.createElement(NoFieldsPlaceholder, null)
12254
- )), !hideFooter && /* @__PURE__ */ React.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.createElement("div", { className: "flex-1 w-full flex justify-between gap-4 items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React.createElement(
12740
+ )), !hideFooter && /* @__PURE__ */ React.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.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React.createElement(
12255
12741
  ResetForm,
12256
12742
  {
12257
12743
  pristine,
12258
12744
  reset: async () => {
12259
12745
  finalForm.reset();
12260
12746
  await tinaForm.reset();
12261
- },
12262
- style: { flexGrow: 1 }
12747
+ }
12263
12748
  },
12264
12749
  tinaForm.buttons.reset
12265
12750
  ), /* @__PURE__ */ React.createElement(
@@ -12268,8 +12753,7 @@ const FormBuilder = ({
12268
12753
  onClick: safeHandleSubmit,
12269
12754
  disabled: !canSubmit,
12270
12755
  busy: submitting,
12271
- variant: "primary",
12272
- style: { flexGrow: 3 }
12756
+ variant: "primary"
12273
12757
  },
12274
12758
  submitting && /* @__PURE__ */ React.createElement(LoadingDots, null),
12275
12759
  !submitting && tinaForm.buttons.save
@@ -12651,9 +13135,9 @@ const EllipsisIcon = ({ title }) => {
12651
13135
  ));
12652
13136
  };
12653
13137
  const Wrapper$1 = ({ inline, children }) => {
12654
- const Component2 = inline ? "span" : "div";
13138
+ const Component = inline ? "span" : "div";
12655
13139
  return /* @__PURE__ */ React__default.createElement(
12656
- Component2,
13140
+ Component,
12657
13141
  {
12658
13142
  contentEditable: false,
12659
13143
  style: { userSelect: "none" },
@@ -12787,7 +13271,7 @@ const EmbedNestedForm = ({
12787
13271
  );
12788
13272
  };
12789
13273
  const DotMenu = ({ onOpen, onRemove }) => {
12790
- return /* @__PURE__ */ React__default.createElement(Popover$2, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React__default.createElement(
13274
+ return /* @__PURE__ */ React__default.createElement(Popover$3, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React__default.createElement(
12791
13275
  PopoverButton,
12792
13276
  {
12793
13277
  as: "span",
@@ -13227,13 +13711,26 @@ const plugins = [
13227
13711
  createUnderlinePlugin(),
13228
13712
  createCodePlugin(),
13229
13713
  createListPlugin(),
13230
- createIndentPlugin(),
13231
13714
  createIndentListPlugin(),
13232
13715
  createHorizontalRulePlugin(),
13233
13716
  // Allows us to do things like copy/paste, remembering the state of the element (like mdx)
13234
13717
  createNodeIdPlugin(),
13235
- createSlashPlugin()
13718
+ createSlashPlugin(),
13719
+ createTablePlugin()
13236
13720
  ];
13721
+ const unsupportedItemsInTable = /* @__PURE__ */ new Set([
13722
+ "Code Block",
13723
+ "Unordered List",
13724
+ "Ordered List",
13725
+ "Quote",
13726
+ "Mermaid",
13727
+ "Heading 1",
13728
+ "Heading 2",
13729
+ "Heading 3",
13730
+ "Heading 4",
13731
+ "Heading 5",
13732
+ "Heading 6"
13733
+ ]);
13237
13734
  const isNodeActive = (editor, type) => {
13238
13735
  const pluginType = getPluginType(editor, type);
13239
13736
  return !!(editor == null ? void 0 : editor.selection) && someNode(editor, { match: { type: pluginType } });
@@ -13418,24 +13915,6 @@ const Editor = React__default.forwardRef(
13418
13915
  }
13419
13916
  );
13420
13917
  Editor.displayName = "Editor";
13421
- const separatorVariants = cva("shrink-0 bg-border", {
13422
- defaultVariants: {
13423
- orientation: "horizontal"
13424
- },
13425
- variants: {
13426
- orientation: {
13427
- horizontal: "h-px w-full",
13428
- vertical: "h-full w-px"
13429
- }
13430
- }
13431
- });
13432
- const Separator = withVariants(
13433
- withProps(SeparatorPrimitive.Root, {
13434
- decorative: true,
13435
- orientation: "horizontal"
13436
- }),
13437
- separatorVariants
13438
- );
13439
13918
  const TooltipProvider = TooltipPrimitive.Provider;
13440
13919
  const Tooltip = TooltipPrimitive.Root;
13441
13920
  const TooltipTrigger = TooltipPrimitive.Trigger;
@@ -13444,15 +13923,15 @@ const TooltipContent = withCn(
13444
13923
  withProps(TooltipPrimitive.Content, {
13445
13924
  sideOffset: 4
13446
13925
  }),
13447
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
13926
+ "z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
13448
13927
  );
13449
- function withTooltip(Component2) {
13928
+ function withTooltip(Component) {
13450
13929
  return React__default.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
13451
13930
  const [mounted, setMounted] = React__default.useState(false);
13452
13931
  React__default.useEffect(() => {
13453
13932
  setMounted(true);
13454
13933
  }, []);
13455
- const component = /* @__PURE__ */ React__default.createElement(Component2, { ref, ...props });
13934
+ const component = /* @__PURE__ */ React__default.createElement(Component, { ref, ...props });
13456
13935
  if (tooltip && mounted) {
13457
13936
  return /* @__PURE__ */ React__default.createElement(Tooltip, { ...tooltipProps }, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, component), /* @__PURE__ */ React__default.createElement(TooltipPortal, null, /* @__PURE__ */ React__default.createElement(TooltipContent, { ...tooltipContentProps }, tooltip)));
13458
13937
  }
@@ -13570,140 +14049,41 @@ const FixedToolbar = withCn(
13570
14049
  Toolbar,
13571
14050
  "p-1 sticky left-0 top-0 z-50 w-full justify-between overflow-x-auto border border-border bg-background"
13572
14051
  );
13573
- const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
13574
- const state = useMarkToolbarButtonState({ clear, nodeType });
13575
- const { props } = useMarkToolbarButton(state);
13576
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest });
13577
- });
13578
- const IndentListToolbarButton = withRef(({ nodeType = ELEMENT_UL }, ref) => {
13579
- const editor = useEditorState();
13580
- const state = useListToolbarButtonState({ nodeType });
13581
- const { props } = useListToolbarButton(state);
13582
- return /* @__PURE__ */ React__default.createElement(
13583
- ToolbarButton,
13584
- {
13585
- ref,
13586
- tooltip: nodeType === ELEMENT_UL ? "Bulleted List" : "Numbered List",
13587
- ...props,
13588
- onClick: (e) => {
13589
- e.preventDefault();
13590
- e.stopPropagation();
13591
- toggleList(editor, { type: nodeType });
13592
- }
13593
- },
13594
- nodeType === ELEMENT_UL ? /* @__PURE__ */ React__default.createElement(Icons.ul, null) : /* @__PURE__ */ React__default.createElement(Icons.ol, null)
13595
- );
13596
- });
13597
- const DropdownMenu = DropdownMenuPrimitive.Root;
13598
- const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
13599
- const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
13600
- withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
13601
- DropdownMenuPrimitive.SubTrigger,
13602
- {
13603
- className: cn$1(
13604
- "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",
13605
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13606
- inset && "pl-8",
13607
- className
13608
- ),
13609
- ref,
13610
- ...props
13611
- },
13612
- children,
13613
- /* @__PURE__ */ React__default.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
13614
- ));
13615
- withCn(
13616
- DropdownMenuPrimitive.SubContent,
13617
- "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"
13618
- );
13619
- const DropdownMenuContentVariants = withProps(DropdownMenuPrimitive.Content, {
13620
- className: cn$1(
13621
- "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"
13622
- ),
13623
- sideOffset: 4
13624
- });
13625
- const DropdownMenuContent = withRef(({ ...props }, ref) => /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.Portal, null, /* @__PURE__ */ React__default.createElement(DropdownMenuContentVariants, { ref, ...props })));
13626
- const menuItemVariants = cva(
13627
- cn$1(
13628
- "relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
13629
- "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
13630
- ),
13631
- {
13632
- variants: {
13633
- inset: {
13634
- true: "pl-8"
14052
+ const useResize = (ref, callback) => {
14053
+ React__default.useEffect(() => {
14054
+ const resizeObserver = new ResizeObserver((entries) => {
14055
+ for (const entry of entries) {
14056
+ callback(entry);
13635
14057
  }
14058
+ });
14059
+ if (ref.current) {
14060
+ resizeObserver.observe(ref.current);
13636
14061
  }
13637
- }
13638
- );
13639
- const DropdownMenuItem = withVariants(
13640
- DropdownMenuPrimitive.Item,
13641
- menuItemVariants,
13642
- ["inset"]
13643
- );
13644
- withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
13645
- DropdownMenuPrimitive.CheckboxItem,
13646
- {
13647
- className: cn$1(
13648
- "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",
13649
- "cursor-pointer",
13650
- className
13651
- ),
13652
- ref,
13653
- ...props
13654
- },
13655
- /* @__PURE__ */ React__default.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
13656
- children
13657
- ));
13658
- const DropdownMenuRadioItem = withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
13659
- DropdownMenuPrimitive.RadioItem,
13660
- {
13661
- className: cn$1(
13662
- "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",
13663
- "h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
13664
- className
13665
- ),
13666
- ref,
13667
- ...props
13668
- },
13669
- !hideIcon && /* @__PURE__ */ React__default.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
14062
+ return () => resizeObserver.disconnect();
14063
+ }, [ref.current]);
14064
+ };
14065
+ const STANDARD_ICON_WIDTH = 32;
14066
+ const HEADING_ICON_WITH_TEXT = 127;
14067
+ const HEADING_ICON_ONLY = 58;
14068
+ const EMBED_ICON_WIDTH = 78;
14069
+ const CONTAINER_MD_BREAKPOINT = 448;
14070
+ const FLOAT_BUTTON_WIDTH = 25;
14071
+ const HEADING_LABEL = "Headings";
14072
+ const ToolbarContext = createContext(void 0);
14073
+ const ToolbarProvider = ({
14074
+ tinaForm,
14075
+ templates,
14076
+ overrides,
13670
14077
  children
13671
- ));
13672
- const dropdownMenuLabelVariants = cva(
13673
- cn$1("select-none px-2 py-1.5 text-sm font-semibold"),
13674
- {
13675
- variants: {
13676
- inset: {
13677
- true: "pl-8"
13678
- }
13679
- }
14078
+ }) => {
14079
+ return /* @__PURE__ */ React__default.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
14080
+ };
14081
+ const useToolbarContext = () => {
14082
+ const context = useContext(ToolbarContext);
14083
+ if (!context) {
14084
+ throw new Error("useToolbarContext must be used within a ToolbarProvider");
13680
14085
  }
13681
- );
13682
- const DropdownMenuLabel = withVariants(
13683
- DropdownMenuPrimitive.Label,
13684
- dropdownMenuLabelVariants,
13685
- ["inset"]
13686
- );
13687
- const DropdownMenuSeparator = withCn(
13688
- DropdownMenuPrimitive.Separator,
13689
- "-mx-1 my-1 h-px bg-muted"
13690
- );
13691
- withCn(
13692
- createPrimitiveElement("span"),
13693
- "ml-auto text-xs tracking-widest opacity-60"
13694
- );
13695
- const useOpenState = () => {
13696
- const [open2, setOpen] = useState(false);
13697
- const onOpenChange = useCallback(
13698
- (_value = !open2) => {
13699
- setOpen(_value);
13700
- },
13701
- [open2]
13702
- );
13703
- return {
13704
- onOpenChange,
13705
- open: open2
13706
- };
14086
+ return context;
13707
14087
  };
13708
14088
  const items$1 = [
13709
14089
  {
@@ -13769,7 +14149,9 @@ function HeadingsMenu(props) {
13769
14149
  return allNodesMatchInitialNodeType ? initialNodeType : ELEMENT_PARAGRAPH$1;
13770
14150
  }, []);
13771
14151
  const editor = useEditorRef();
14152
+ const editorState = useEditorState();
13772
14153
  const openState = useOpenState();
14154
+ const userInTable = helpers.isNodeActive(editorState, ELEMENT_TABLE$1);
13773
14155
  const selectedItem = items$1.find((item) => item.value === value) ?? defaultItem$1;
13774
14156
  const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
13775
14157
  return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(
@@ -13781,7 +14163,7 @@ function HeadingsMenu(props) {
13781
14163
  tooltip: "Headings"
13782
14164
  },
13783
14165
  /* @__PURE__ */ React__default.createElement(SelectedItemIcon, { className: "size-5" }),
13784
- /* @__PURE__ */ React__default.createElement("span", { className: "hidden 2xl:flex" }, selectedItemLabel)
14166
+ /* @__PURE__ */ React__default.createElement("span", { className: "@md/toolbar:flex hidden" }, selectedItemLabel)
13785
14167
  )), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { align: "start", className: "min-w-0" }, /* @__PURE__ */ React__default.createElement(
13786
14168
  DropdownMenuRadioGroup,
13787
14169
  {
@@ -13793,7 +14175,12 @@ function HeadingsMenu(props) {
13793
14175
  },
13794
14176
  value
13795
14177
  },
13796
- items$1.map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React__default.createElement(
14178
+ items$1.filter((item) => {
14179
+ if (userInTable) {
14180
+ return !unsupportedItemsInTable.has(item.label);
14181
+ }
14182
+ return true;
14183
+ }).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React__default.createElement(
13797
14184
  DropdownMenuRadioItem,
13798
14185
  {
13799
14186
  className: "min-w-[180px]",
@@ -13805,42 +14192,6 @@ function HeadingsMenu(props) {
13805
14192
  ))
13806
14193
  )));
13807
14194
  }
13808
- const LinkToolbarButton = withRef((rest, ref) => {
13809
- const state = useLinkToolbarButtonState();
13810
- const { props } = useLinkToolbarButton(state);
13811
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React__default.createElement(Icons.link, null));
13812
- });
13813
- const useBlockQuoteToolbarButtonState = () => {
13814
- const editor = useEditorState();
13815
- const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_BLOCKQUOTE$1);
13816
- return {
13817
- pressed: isBlockActive()
13818
- };
13819
- };
13820
- const useBlockQuoteToolbarButton = (state) => {
13821
- const editor = useEditorState();
13822
- const onClick = () => {
13823
- toggleNodeType(editor, {
13824
- activeType: ELEMENT_BLOCKQUOTE$1
13825
- });
13826
- };
13827
- const onMouseDown = (e) => {
13828
- e.preventDefault();
13829
- e.stopPropagation();
13830
- };
13831
- return {
13832
- props: {
13833
- onClick,
13834
- onMouseDown,
13835
- pressed: state.pressed
13836
- }
13837
- };
13838
- };
13839
- const QuoteToolbarButton = withRef(({ clear, ...rest }, ref) => {
13840
- const state = useBlockQuoteToolbarButtonState();
13841
- const { props } = useBlockQuoteToolbarButton(state);
13842
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.quote, null));
13843
- });
13844
14195
  const useCodeBlockToolbarButtonState = () => {
13845
14196
  const editor = useEditorState();
13846
14197
  const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_CODE_BLOCK$1);
@@ -13902,6 +14253,116 @@ const ImageToolbarButton = withRef(({ clear, ...rest }, ref) => {
13902
14253
  const { props } = useImageToolbarButton(state);
13903
14254
  return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.image, null));
13904
14255
  });
14256
+ const IndentListToolbarButton = withRef(({ nodeType = ELEMENT_UL }, ref) => {
14257
+ const editor = useEditorState();
14258
+ const state = useListToolbarButtonState({ nodeType });
14259
+ const { props } = useListToolbarButton(state);
14260
+ return /* @__PURE__ */ React__default.createElement(
14261
+ ToolbarButton,
14262
+ {
14263
+ ref,
14264
+ tooltip: nodeType === ELEMENT_UL ? "Bulleted List" : "Numbered List",
14265
+ ...props,
14266
+ onClick: (e) => {
14267
+ e.preventDefault();
14268
+ e.stopPropagation();
14269
+ toggleList(editor, { type: nodeType });
14270
+ }
14271
+ },
14272
+ nodeType === ELEMENT_UL ? /* @__PURE__ */ React__default.createElement(Icons.ul, null) : /* @__PURE__ */ React__default.createElement(Icons.ol, null)
14273
+ );
14274
+ });
14275
+ const LinkToolbarButton = withRef((rest, ref) => {
14276
+ const state = useLinkToolbarButtonState();
14277
+ const { props } = useLinkToolbarButton(state);
14278
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React__default.createElement(Icons.link, null));
14279
+ });
14280
+ const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
14281
+ const state = useMarkToolbarButtonState({ clear, nodeType });
14282
+ const { props } = useMarkToolbarButton(state);
14283
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest });
14284
+ });
14285
+ const useMermaidToolbarButtonState = () => {
14286
+ const editor = useEditorState();
14287
+ const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_MERMAID);
14288
+ return {
14289
+ pressed: isBlockActive()
14290
+ };
14291
+ };
14292
+ const useMermaidToolbarButton = (state) => {
14293
+ const editor = useEditorState();
14294
+ const onClick = () => {
14295
+ insertEmptyElement(editor, ELEMENT_MERMAID, {
14296
+ nextBlock: true,
14297
+ select: true
14298
+ });
14299
+ };
14300
+ const onMouseDown = (e) => {
14301
+ e.preventDefault();
14302
+ e.stopPropagation();
14303
+ };
14304
+ return {
14305
+ props: {
14306
+ onClick,
14307
+ onMouseDown,
14308
+ pressed: state.pressed
14309
+ }
14310
+ };
14311
+ };
14312
+ const MermaidToolbarButton = withRef(({ clear, ...rest }, ref) => {
14313
+ const state = useMermaidToolbarButtonState();
14314
+ const { props } = useMermaidToolbarButton(state);
14315
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Mermaid", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.mermaid, null));
14316
+ });
14317
+ function OverflowMenu({
14318
+ children,
14319
+ ...props
14320
+ }) {
14321
+ const openState = useOpenState();
14322
+ return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(
14323
+ ToolbarButton,
14324
+ {
14325
+ showArrow: false,
14326
+ "data-testid": "rich-text-editor-overflow-menu-button",
14327
+ className: "lg:min-w-[130px]",
14328
+ isDropdown: true,
14329
+ pressed: openState.open,
14330
+ tooltip: "Headings"
14331
+ },
14332
+ /* @__PURE__ */ React__default.createElement(Icons.overflow, { className: "size-5" })
14333
+ )), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
14334
+ }
14335
+ const useBlockQuoteToolbarButtonState = () => {
14336
+ const editor = useEditorState();
14337
+ const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_BLOCKQUOTE$1);
14338
+ return {
14339
+ pressed: isBlockActive()
14340
+ };
14341
+ };
14342
+ const useBlockQuoteToolbarButton = (state) => {
14343
+ const editor = useEditorState();
14344
+ const onClick = () => {
14345
+ toggleNodeType(editor, {
14346
+ activeType: ELEMENT_BLOCKQUOTE$1
14347
+ });
14348
+ };
14349
+ const onMouseDown = (e) => {
14350
+ e.preventDefault();
14351
+ e.stopPropagation();
14352
+ };
14353
+ return {
14354
+ props: {
14355
+ onClick,
14356
+ onMouseDown,
14357
+ pressed: state.pressed
14358
+ }
14359
+ };
14360
+ };
14361
+ const QuoteToolbarButton = withRef(({ clear, ...rest }, ref) => {
14362
+ const state = useBlockQuoteToolbarButtonState();
14363
+ const { props } = useBlockQuoteToolbarButton(state);
14364
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.quote, null));
14365
+ });
13905
14366
  const useRawMarkdownToolbarButton = () => {
13906
14367
  const { setRawMode } = useEditorContext();
13907
14368
  const onMouseDown = (e) => {
@@ -13916,31 +14377,123 @@ const useRawMarkdownToolbarButton = () => {
13916
14377
  };
13917
14378
  const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
13918
14379
  const { props } = useRawMarkdownToolbarButton();
13919
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.raw, null));
14380
+ return /* @__PURE__ */ React__default.createElement(
14381
+ ToolbarButton,
14382
+ {
14383
+ ref,
14384
+ tooltip: "Link",
14385
+ ...rest,
14386
+ ...props,
14387
+ "data-testid": "markdown-button"
14388
+ },
14389
+ /* @__PURE__ */ React__default.createElement(Icons.raw, null)
14390
+ );
13920
14391
  });
13921
- const ToolbarContext = createContext(void 0);
13922
- const ToolbarProvider = ({
13923
- tinaForm,
13924
- templates,
13925
- overrides,
13926
- children
13927
- }) => {
13928
- return /* @__PURE__ */ React__default.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
13929
- };
13930
- const useToolbarContext = () => {
13931
- const context = useContext(ToolbarContext);
13932
- if (!context) {
13933
- throw new Error("useToolbarContext must be used within a ToolbarProvider");
13934
- }
13935
- return context;
13936
- };
14392
+ function TableDropdownMenu(props) {
14393
+ const tableSelected = useEditorSelector(
14394
+ (editor2) => someNode(editor2, { match: { type: ELEMENT_TABLE$1 } }),
14395
+ []
14396
+ );
14397
+ const [enableDeleteColumn, enableDeleteRow] = useEditorSelector((editor2) => {
14398
+ const tableNodeEntry = findNode(editor2, { match: { type: ELEMENT_TABLE$1 } });
14399
+ if (!tableNodeEntry)
14400
+ return [false, false];
14401
+ const [tableNode] = tableNodeEntry;
14402
+ if (!isElement(tableNode))
14403
+ return [false, false];
14404
+ const columnCount = getTableColumnCount(tableNode);
14405
+ const rowCount = tableNode.children.length;
14406
+ return [columnCount > 1, rowCount > 1];
14407
+ }, []);
14408
+ const editor = useEditorRef();
14409
+ const openState = useOpenState();
14410
+ return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(ToolbarButton, { isDropdown: true, pressed: openState.open, tooltip: "Table" }, /* @__PURE__ */ React__default.createElement(Icons.table, null))), /* @__PURE__ */ React__default.createElement(
14411
+ DropdownMenuContent,
14412
+ {
14413
+ align: "start",
14414
+ className: "flex w-[180px] min-w-0 flex-col gap-0.5"
14415
+ },
14416
+ /* @__PURE__ */ React__default.createElement(
14417
+ DropdownMenuItem,
14418
+ {
14419
+ className: "min-w-[180px]",
14420
+ disabled: tableSelected,
14421
+ onSelect: () => {
14422
+ insertTable(editor);
14423
+ focusEditor(editor);
14424
+ }
14425
+ },
14426
+ /* @__PURE__ */ React__default.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14427
+ "Insert table"
14428
+ ),
14429
+ /* @__PURE__ */ React__default.createElement(
14430
+ DropdownMenuItem,
14431
+ {
14432
+ className: "min-w-[180px]",
14433
+ disabled: !tableSelected,
14434
+ onSelect: () => {
14435
+ deleteTable(editor);
14436
+ focusEditor(editor);
14437
+ }
14438
+ },
14439
+ /* @__PURE__ */ React__default.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14440
+ "Delete table"
14441
+ ),
14442
+ /* @__PURE__ */ React__default.createElement(DropdownMenuSub, null, /* @__PURE__ */ React__default.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React__default.createElement(Icons.column, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React__default.createElement("span", null, "Column")), /* @__PURE__ */ React__default.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React__default.createElement(
14443
+ DropdownMenuItem,
14444
+ {
14445
+ className: "min-w-[180px]",
14446
+ disabled: !tableSelected,
14447
+ onSelect: () => {
14448
+ insertTableColumn(editor);
14449
+ focusEditor(editor);
14450
+ }
14451
+ },
14452
+ /* @__PURE__ */ React__default.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14453
+ "Insert column after"
14454
+ ), /* @__PURE__ */ React__default.createElement(
14455
+ DropdownMenuItem,
14456
+ {
14457
+ className: "min-w-[180px]",
14458
+ disabled: !enableDeleteColumn,
14459
+ onSelect: () => {
14460
+ deleteColumn(editor);
14461
+ focusEditor(editor);
14462
+ }
14463
+ },
14464
+ /* @__PURE__ */ React__default.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14465
+ "Delete column"
14466
+ ))),
14467
+ /* @__PURE__ */ React__default.createElement(DropdownMenuSub, null, /* @__PURE__ */ React__default.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React__default.createElement(Icons.row, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React__default.createElement("span", null, "Row")), /* @__PURE__ */ React__default.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React__default.createElement(
14468
+ DropdownMenuItem,
14469
+ {
14470
+ className: "min-w-[180px]",
14471
+ disabled: !tableSelected,
14472
+ onSelect: () => {
14473
+ insertTableRow(editor);
14474
+ focusEditor(editor);
14475
+ }
14476
+ },
14477
+ /* @__PURE__ */ React__default.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14478
+ "Insert row after"
14479
+ ), /* @__PURE__ */ React__default.createElement(
14480
+ DropdownMenuItem,
14481
+ {
14482
+ className: "min-w-[180px]",
14483
+ disabled: !enableDeleteRow,
14484
+ onSelect: () => {
14485
+ deleteRow(editor);
14486
+ focusEditor(editor);
14487
+ }
14488
+ },
14489
+ /* @__PURE__ */ React__default.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14490
+ "Delete row"
14491
+ )))
14492
+ ));
14493
+ }
13937
14494
  function TemplatesToolbarButton() {
13938
14495
  const { templates } = useToolbarContext();
13939
- const showEmbed = templates.length > 0;
13940
14496
  const editor = useEditorState();
13941
- if (!showEmbed) {
13942
- return null;
13943
- }
13944
14497
  return /* @__PURE__ */ React__default.createElement(EmbedButton, { templates, editor });
13945
14498
  }
13946
14499
  const EmbedButton = ({ editor, templates }) => {
@@ -13981,99 +14534,118 @@ const EmbedButton = ({ editor, templates }) => {
13981
14534
  template.label || template.name
13982
14535
  ))));
13983
14536
  };
13984
- const ICON_WIDTH = 32;
13985
- const EMBED_ICON_WIDTH = 78;
13986
- const useResize = (ref, callback) => {
13987
- React__default.useEffect(() => {
13988
- const resizeObserver = new ResizeObserver((entries) => {
13989
- for (const entry of entries) {
13990
- callback(entry);
13991
- }
13992
- });
13993
- if (ref.current) {
13994
- resizeObserver.observe(ref.current);
13995
- }
13996
- return () => resizeObserver.disconnect();
13997
- }, [ref.current]);
13998
- };
13999
- function OverflowMenu({
14000
- children,
14001
- ...props
14002
- }) {
14003
- const openState = useOpenState();
14004
- return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(
14005
- ToolbarButton,
14006
- {
14007
- showArrow: false,
14008
- className: "lg:min-w-[130px]",
14009
- isDropdown: true,
14010
- pressed: openState.open,
14011
- tooltip: "Headings"
14012
- },
14013
- /* @__PURE__ */ React__default.createElement(Icons.overflow, { className: "size-5" })
14014
- )), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
14015
- }
14016
14537
  const toolbarItems = {
14017
14538
  heading: {
14018
- label: "Headings",
14539
+ label: HEADING_LABEL,
14540
+ width: (paragraphIconExists) => paragraphIconExists ? HEADING_ICON_WITH_TEXT : HEADING_ICON_ONLY,
14541
+ // Dynamically handle width based on paragraph icon
14019
14542
  Component: /* @__PURE__ */ React__default.createElement(ToolbarGroup, { noSeparator: true }, /* @__PURE__ */ React__default.createElement(HeadingsMenu, null))
14020
14543
  },
14021
14544
  link: {
14022
14545
  label: "Link",
14546
+ width: () => STANDARD_ICON_WIDTH,
14023
14547
  Component: /* @__PURE__ */ React__default.createElement(LinkToolbarButton, null)
14024
14548
  },
14025
14549
  image: {
14026
14550
  label: "Image",
14551
+ width: () => STANDARD_ICON_WIDTH,
14027
14552
  Component: /* @__PURE__ */ React__default.createElement(ImageToolbarButton, null)
14028
14553
  },
14029
14554
  quote: {
14030
14555
  label: "Quote",
14556
+ width: () => STANDARD_ICON_WIDTH,
14031
14557
  Component: /* @__PURE__ */ React__default.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
14032
14558
  },
14033
14559
  ul: {
14034
14560
  label: "Unordered List",
14561
+ width: () => STANDARD_ICON_WIDTH,
14035
14562
  Component: /* @__PURE__ */ React__default.createElement(IndentListToolbarButton, { nodeType: ELEMENT_UL })
14036
14563
  },
14037
14564
  ol: {
14038
14565
  label: "Ordered List",
14566
+ width: () => STANDARD_ICON_WIDTH,
14039
14567
  Component: /* @__PURE__ */ React__default.createElement(IndentListToolbarButton, { nodeType: ELEMENT_OL })
14040
14568
  },
14041
14569
  bold: {
14042
14570
  label: "Bold",
14571
+ width: () => STANDARD_ICON_WIDTH,
14043
14572
  Component: /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: MARK_BOLD }, /* @__PURE__ */ React__default.createElement(Icons.bold, null))
14044
14573
  },
14045
14574
  italic: {
14046
14575
  label: "Italic",
14576
+ width: () => STANDARD_ICON_WIDTH,
14047
14577
  Component: /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: MARK_ITALIC }, /* @__PURE__ */ React__default.createElement(Icons.italic, null))
14048
14578
  },
14049
14579
  code: {
14050
14580
  label: "Code",
14581
+ width: () => STANDARD_ICON_WIDTH,
14051
14582
  Component: /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: MARK_CODE }, /* @__PURE__ */ React__default.createElement(Icons.code, null))
14052
14583
  },
14053
14584
  codeBlock: {
14054
14585
  label: "Code Block",
14586
+ width: () => STANDARD_ICON_WIDTH,
14055
14587
  Component: /* @__PURE__ */ React__default.createElement(CodeBlockToolbarButton, null)
14056
14588
  },
14589
+ mermaid: {
14590
+ label: "Mermaid",
14591
+ width: () => STANDARD_ICON_WIDTH,
14592
+ Component: /* @__PURE__ */ React__default.createElement(MermaidToolbarButton, null)
14593
+ },
14594
+ table: {
14595
+ label: "Table",
14596
+ width: () => STANDARD_ICON_WIDTH,
14597
+ Component: /* @__PURE__ */ React__default.createElement(TableDropdownMenu, null)
14598
+ },
14057
14599
  raw: {
14058
14600
  label: "Raw Markdown",
14601
+ width: () => STANDARD_ICON_WIDTH,
14059
14602
  Component: /* @__PURE__ */ React__default.createElement(RawMarkdownToolbarButton, null)
14060
14603
  },
14061
14604
  embed: {
14062
14605
  label: "Templates",
14606
+ width: () => EMBED_ICON_WIDTH,
14063
14607
  Component: /* @__PURE__ */ React__default.createElement(TemplatesToolbarButton, null)
14064
14608
  }
14065
14609
  };
14066
14610
  function FixedToolbarButtons() {
14067
14611
  const toolbarRef = React__default.useRef(null);
14068
14612
  const [itemsShown, setItemsShown] = React__default.useState(11);
14069
- const { overrides } = useToolbarContext();
14613
+ const { overrides, templates } = useToolbarContext();
14614
+ const showEmbedButton = templates.length > 0;
14615
+ let items2 = [];
14616
+ if (Array.isArray(overrides)) {
14617
+ items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14618
+ } else {
14619
+ items2 = (overrides == null ? void 0 : overrides.toolbar) === void 0 ? Object.values(toolbarItems) : overrides.toolbar.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14620
+ }
14621
+ if (!showEmbedButton) {
14622
+ items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
14623
+ }
14624
+ const editorState = useEditorState();
14625
+ const userInTable = helpers.isNodeActive(editorState, ELEMENT_TABLE);
14626
+ if (userInTable) {
14627
+ items2 = items2.filter((item) => !unsupportedItemsInTable.has(item.label));
14628
+ }
14070
14629
  useResize(toolbarRef, (entry) => {
14071
14630
  const width = entry.target.getBoundingClientRect().width;
14072
- const itemsShown2 = (width - EMBED_ICON_WIDTH) / ICON_WIDTH;
14073
- setItemsShown(Math.floor(itemsShown2));
14631
+ const headingButton = items2.find((item) => item.label === HEADING_LABEL);
14632
+ const headingWidth = headingButton ? headingButton.width(width > CONTAINER_MD_BREAKPOINT) : 0;
14633
+ const availableWidth = width - headingWidth - FLOAT_BUTTON_WIDTH;
14634
+ const { itemFitCount } = items2.reduce(
14635
+ (acc, item) => {
14636
+ if (item.label !== HEADING_LABEL && acc.totalItemsWidth + item.width() <= availableWidth) {
14637
+ return {
14638
+ totalItemsWidth: acc.totalItemsWidth + item.width(),
14639
+ itemFitCount: acc.itemFitCount + 1
14640
+ };
14641
+ }
14642
+ return acc;
14643
+ },
14644
+ { totalItemsWidth: 0, itemFitCount: 1 }
14645
+ );
14646
+ setItemsShown(itemFitCount);
14074
14647
  });
14075
- const toolbarItemsArray = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14076
- return /* @__PURE__ */ React__default.createElement("div", { className: "w-full overflow-hidden", ref: toolbarRef }, /* @__PURE__ */ React__default.createElement(
14648
+ return /* @__PURE__ */ React__default.createElement("div", { className: "w-full overflow-hidden @container/toolbar", ref: toolbarRef }, /* @__PURE__ */ React__default.createElement(
14077
14649
  "div",
14078
14650
  {
14079
14651
  className: "flex",
@@ -14081,7 +14653,7 @@ function FixedToolbarButtons() {
14081
14653
  transform: "translateX(calc(-1px))"
14082
14654
  }
14083
14655
  },
14084
- /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, toolbarItemsArray.slice(0, itemsShown).map((item, index) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: item.label }, item.Component)), toolbarItemsArray.length > itemsShown && /* @__PURE__ */ React__default.createElement(OverflowMenu, null, toolbarItemsArray.slice(itemsShown).flatMap((c) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: c.label }, c.Component))))
14656
+ /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, items2.slice(0, itemsShown).map((item) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: item.label }, item.Component)), items2.length > itemsShown && /* @__PURE__ */ React__default.createElement(OverflowMenu, null, items2.slice(itemsShown).flatMap((c) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: c.label }, c.Component))))
14085
14657
  ));
14086
14658
  }
14087
14659
  const FloatingToolbar = withRef(({ children, state, ...props }, componentRef) => {
@@ -14196,6 +14768,10 @@ function TurnIntoDropdownMenu(props) {
14196
14768
  const openState = useOpenState();
14197
14769
  const selectedItem = items.find((item) => item.value === value) ?? defaultItem;
14198
14770
  const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
14771
+ const editorState = useEditorState();
14772
+ const userInTable = helpers.isNodeActive(editorState, ELEMENT_TABLE$1);
14773
+ if (userInTable)
14774
+ return null;
14199
14775
  return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(
14200
14776
  ToolbarButton,
14201
14777
  {
@@ -14237,49 +14813,6 @@ function TurnIntoDropdownMenu(props) {
14237
14813
  function FloatingToolbarButtons() {
14238
14814
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(TurnIntoDropdownMenu, null));
14239
14815
  }
14240
- const buttonVariants = cva(
14241
- "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",
14242
- {
14243
- defaultVariants: {
14244
- size: "default",
14245
- variant: "default"
14246
- },
14247
- variants: {
14248
- isMenu: {
14249
- true: "h-auto w-full cursor-pointer justify-start"
14250
- },
14251
- size: {
14252
- default: "h-10 px-4 py-2",
14253
- icon: "size-10",
14254
- lg: "h-11 rounded-md px-8",
14255
- none: "",
14256
- sm: "h-9 rounded-md px-3",
14257
- sms: "size-9 rounded-md px-0",
14258
- xs: "h-8 rounded-md px-3"
14259
- },
14260
- variant: {
14261
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
14262
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
14263
- ghost: "hover:bg-accent hover:text-accent-foreground",
14264
- inlineLink: "text-base text-primary underline underline-offset-4",
14265
- link: "text-primary underline-offset-4 hover:underline",
14266
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
14267
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
14268
- }
14269
- }
14270
- }
14271
- );
14272
- withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
14273
- const Comp = asChild ? Slot : "button";
14274
- return /* @__PURE__ */ React.createElement(
14275
- Comp,
14276
- {
14277
- className: cn$1(buttonVariants({ className, isMenu, size, variant })),
14278
- ref,
14279
- ...props
14280
- }
14281
- );
14282
- });
14283
14816
  const inputVariants = cva(
14284
14817
  "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",
14285
14818
  {
@@ -14300,22 +14833,6 @@ const inputVariants = cva(
14300
14833
  }
14301
14834
  );
14302
14835
  withVariants("input", inputVariants, ["variant", "h"]);
14303
- const popoverVariants = cva(
14304
- "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"
14305
- );
14306
- withRef(
14307
- ({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
14308
- PopoverPrimitive.Content,
14309
- {
14310
- align,
14311
- className: cn$1(popoverVariants(), className),
14312
- ref,
14313
- sideOffset,
14314
- style: { zIndex: 1e3, ...style },
14315
- ...props
14316
- }
14317
- ))
14318
- );
14319
14836
  const floatingOptions = {
14320
14837
  middleware: [
14321
14838
  offset(12),
@@ -14375,7 +14892,7 @@ function LinkFloatingToolbar({ state }) {
14375
14892
  const editContent = editState.isEditing ? input : /* @__PURE__ */ React__default.createElement("div", { className: "box-content flex h-9 items-center gap-1" }, /* @__PURE__ */ React__default.createElement(
14376
14893
  "button",
14377
14894
  {
14378
- className: buttonVariants({ size: "sm", variant: "ghost" }),
14895
+ className: buttonVariants$1({ size: "sm", variant: "ghost" }),
14379
14896
  type: "button",
14380
14897
  ...editButtonProps
14381
14898
  },
@@ -14383,7 +14900,7 @@ function LinkFloatingToolbar({ state }) {
14383
14900
  ), /* @__PURE__ */ React__default.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React__default.createElement(
14384
14901
  LinkOpenButton,
14385
14902
  {
14386
- className: buttonVariants({
14903
+ className: buttonVariants$1({
14387
14904
  size: "sms",
14388
14905
  variant: "ghost"
14389
14906
  })
@@ -14392,7 +14909,7 @@ function LinkFloatingToolbar({ state }) {
14392
14909
  ), /* @__PURE__ */ React__default.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React__default.createElement(
14393
14910
  "button",
14394
14911
  {
14395
- className: buttonVariants({
14912
+ className: buttonVariants$1({
14396
14913
  size: "sms",
14397
14914
  variant: "ghost"
14398
14915
  }),
@@ -14428,6 +14945,9 @@ const isUrl = (string) => {
14428
14945
  if (typeof string !== "string") {
14429
14946
  return false;
14430
14947
  }
14948
+ if (string.startsWith("#")) {
14949
+ return true;
14950
+ }
14431
14951
  const generalMatch = string.match(protocolAndDomainRE);
14432
14952
  const emailLinkMatch = string.match(emailLintRE);
14433
14953
  const localUrlMatch = string.match(localUrlRE);
@@ -14449,12 +14969,12 @@ const isUrl = (string) => {
14449
14969
  }
14450
14970
  return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
14451
14971
  };
14452
- const RichEditor = (props) => {
14972
+ const RichEditor = ({ input, tinaForm, field }) => {
14453
14973
  var _a;
14454
14974
  const initialValue = React__default.useMemo(
14455
14975
  () => {
14456
14976
  var _a2, _b;
14457
- return ((_b = (_a2 = props.input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? props.input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
14977
+ return ((_b = (_a2 = input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
14458
14978
  },
14459
14979
  []
14460
14980
  );
@@ -14466,6 +14986,7 @@ const RichEditor = (props) => {
14466
14986
  createMdxBlockPlugin(),
14467
14987
  createMdxInlinePlugin(),
14468
14988
  createImgPlugin(),
14989
+ createMermaidPlugin(),
14469
14990
  createInvalidMarkdownPlugin(),
14470
14991
  createLinkPlugin({
14471
14992
  options: {
@@ -14481,7 +15002,7 @@ const RichEditor = (props) => {
14481
15002
  ),
14482
15003
  []
14483
15004
  );
14484
- const tempId = [props.tinaForm.id, props.input.name].join(".");
15005
+ const tempId = [tinaForm.id, input.name].join(".");
14485
15006
  const id = React__default.useMemo(() => uuid() + tempId, [tempId]);
14486
15007
  const ref = React__default.useRef(null);
14487
15008
  React__default.useEffect(() => {
@@ -14491,13 +15012,13 @@ const RichEditor = (props) => {
14491
15012
  const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
14492
15013
  '[role="textbox"]'
14493
15014
  );
14494
- if (props.field.experimental_focusIntent && plateElement) {
15015
+ if (field.experimental_focusIntent && plateElement) {
14495
15016
  if (plateElement)
14496
15017
  plateElement.focus();
14497
15018
  }
14498
15019
  }, 100);
14499
15020
  }
14500
- }, [props.field.experimental_focusIntent, ref]);
15021
+ }, [field.experimental_focusIntent, ref]);
14501
15022
  return /* @__PURE__ */ React__default.createElement("div", { ref }, /* @__PURE__ */ React__default.createElement(
14502
15023
  Plate,
14503
15024
  {
@@ -14505,21 +15026,22 @@ const RichEditor = (props) => {
14505
15026
  initialValue,
14506
15027
  plugins: plugins$2,
14507
15028
  onChange: (value) => {
14508
- props.input.onChange({
15029
+ input.onChange({
14509
15030
  type: "root",
14510
- children: value
15031
+ children: value,
15032
+ embedCode: input.value.embedCode
14511
15033
  });
14512
15034
  }
14513
15035
  },
14514
15036
  /* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(
14515
15037
  ToolbarProvider,
14516
15038
  {
14517
- tinaForm: props.tinaForm,
14518
- templates: props.field.templates,
14519
- overrides: (_a = props.field) == null ? void 0 : _a.toolbarOverride
15039
+ tinaForm,
15040
+ templates: field.templates,
15041
+ overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
14520
15042
  },
14521
15043
  /* @__PURE__ */ React__default.createElement(FixedToolbar, null, /* @__PURE__ */ React__default.createElement(FixedToolbarButtons, null)),
14522
- /* @__PURE__ */ React__default.createElement(FloatingToolbar, null, /* @__PURE__ */ React__default.createElement(FloatingToolbarButtons, null))
15044
+ ((_a = field == null ? void 0 : field.overrides) == null ? void 0 : _a.showFloatingToolbar) !== false ? /* @__PURE__ */ React__default.createElement(FloatingToolbar, null, /* @__PURE__ */ React__default.createElement(FloatingToolbarButtons, null)) : null
14523
15045
  ), /* @__PURE__ */ React__default.createElement(Editor, null))
14524
15046
  ));
14525
15047
  };
@@ -29473,6 +29995,7 @@ class TinaAdminApi {
29473
29995
  relativePath
29474
29996
  filename
29475
29997
  extension
29998
+ hasReferences
29476
29999
  }
29477
30000
  }
29478
30001
  }
@@ -29564,6 +30087,9 @@ class TinaAdminApi {
29564
30087
  document(collection:$collection, relativePath:$relativePath) {
29565
30088
  ... on Document {
29566
30089
  _values
30090
+ _sys {
30091
+ hasReferences
30092
+ }
29567
30093
  }
29568
30094
  }
29569
30095
  }`;
@@ -31290,6 +31816,23 @@ const CollectionListPage = () => {
31290
31816
  DeleteModal,
31291
31817
  {
31292
31818
  filename: vars.relativePath,
31819
+ checkRefsFunc: async () => {
31820
+ var _a2, _b2;
31821
+ try {
31822
+ const doc = await admin.fetchDocument(
31823
+ collection.name,
31824
+ vars.relativePath,
31825
+ true
31826
+ );
31827
+ return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
31828
+ } catch (error) {
31829
+ cms.alerts.error(
31830
+ "Document was not found, ask a developer for help or check the console for an error message"
31831
+ );
31832
+ console.error(error);
31833
+ throw error;
31834
+ }
31835
+ },
31293
31836
  deleteFunc: async () => {
31294
31837
  try {
31295
31838
  await admin.deleteDocument(vars);
@@ -31298,6 +31841,12 @@ const CollectionListPage = () => {
31298
31841
  );
31299
31842
  reFetchCollection();
31300
31843
  } catch (error) {
31844
+ if (error.message.indexOf("has references")) {
31845
+ cms.alerts.error(
31846
+ error.message.split("\n ").filter(Boolean)[1]
31847
+ );
31848
+ return;
31849
+ }
31301
31850
  cms.alerts.warn(
31302
31851
  "Document was not deleted, ask a developer for help or check the console for an error message"
31303
31852
  );
@@ -31349,6 +31898,12 @@ const CollectionListPage = () => {
31349
31898
  cms.alerts.info("Document was successfully renamed");
31350
31899
  reFetchCollection();
31351
31900
  } catch (error) {
31901
+ if (error.message.indexOf("has references")) {
31902
+ cms.alerts.error(
31903
+ error.message.split("\n ").filter(Boolean)[1]
31904
+ );
31905
+ return;
31906
+ }
31352
31907
  cms.alerts.warn(
31353
31908
  "Document was not renamed, ask a developer for help or check the console for an error message"
31354
31909
  );
@@ -31822,8 +32377,19 @@ const Breadcrumb = ({ folder, navigate, collectionName }) => {
31822
32377
  const NoDocumentsPlaceholder = () => {
31823
32378
  return /* @__PURE__ */ React__default.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__default.createElement("p", { className: "text-base italic font-medium text-gray-300" }, "No documents found."));
31824
32379
  };
31825
- const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
31826
- return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__default.createElement("p", null, `Are you sure you want to delete ${filename}?`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React__default.createElement(
32380
+ const DeleteModal = ({
32381
+ close: close2,
32382
+ deleteFunc,
32383
+ checkRefsFunc,
32384
+ filename
32385
+ }) => {
32386
+ const [hasRefs, setHasRefs] = React__default.useState();
32387
+ useEffect(() => {
32388
+ checkRefsFunc().then((result) => {
32389
+ setHasRefs(result);
32390
+ });
32391
+ }, [filename, checkRefsFunc]);
32392
+ return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__default.createElement("p", null, `Are you sure you want to delete ${filename}?${hasRefs ? " References to this document will also be deleted." : ""}`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React__default.createElement(
31827
32393
  Button$1,
31828
32394
  {
31829
32395
  style: { flexGrow: 3 },
@@ -33185,5 +33751,6 @@ export {
33185
33751
  useScreenPlugin,
33186
33752
  useTinaAuthRedirect,
33187
33753
  wrapFieldWithError,
33754
+ wrapFieldWithNoHeader,
33188
33755
  wrapFieldsWithMeta
33189
33756
  };