tinacms 0.0.0-fe63759-20241004045825 → 0.0.0-feaa40f-20241112045116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/types.d.ts +3 -0
- package/dist/cache/node-cache.d.ts +1 -0
- package/dist/client.js +18 -16
- package/dist/client.mjs +1 -1
- package/dist/index.js +1476 -773
- package/dist/index.mjs +1457 -750
- package/dist/{node-cache-7fa2452c.mjs → node-cache-4c336858.mjs} +18 -11
- package/dist/rich-text/index.d.ts +3 -0
- package/dist/rich-text/index.js +45 -12
- package/dist/rich-text/index.mjs +45 -12
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/fixed-toolbar-buttons.d.ts +0 -4
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +2 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-element.d.ts +11 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +20 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/resizable.d.ts +39 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-cell-element.d.ts +27 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-dropdown-menu.d.ts +3 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-element.d.ts +14 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-row-element.d.ts +13 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/text-area.d.ts +5 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +1 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/custom/mermaid-plugin.d.ts +2 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +4 -2
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +58 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +7 -3
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +1 -1
- package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
- package/package.json +9 -7
- package/dist/__vite-browser-external-d06ac358.mjs +0 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/plate"), require("
|
|
3
|
-
})(this, function(exports2, zod, React, reactDom, plate,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("slate-react"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("@react-hook/window-size"), require("graphql"), require("graphql-tag"), require("@tinacms/schema-tools"), require("yup"), require("@graphql-inspector/core"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate", "@udecode/plate-common", "@udecode/plate-slash-command", "slate-react", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "class-variance-authority", "lucide-react", "mermaid", "@udecode/plate-heading", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-table", "@udecode/plate-resizable", "@radix-ui/react-popover", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "@react-hook/window-size", "graphql", "graphql-tag", "@tinacms/schema-tools", "yup", "@graphql-inspector/core", "react-router-dom", "@tinacms/mdx"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
|
|
3
|
+
})(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, slateReact, plateCodeBlock, MonacoEditor, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, windowSize, graphql, gql, schemaTools, yup, core, reactRouterDom, mdx) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => {
|
|
@@ -26,13 +26,13 @@ var __publicField = (obj, key, value) => {
|
|
|
26
26
|
}
|
|
27
27
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
28
28
|
const PopoverPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(PopoverPrimitive);
|
|
29
|
+
const DropdownMenuPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(DropdownMenuPrimitive);
|
|
30
|
+
const SeparatorPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(SeparatorPrimitive);
|
|
29
31
|
const pkg__namespace$1 = /* @__PURE__ */ _interopNamespaceDefault(pkg$1);
|
|
30
32
|
const pkg__namespace = /* @__PURE__ */ _interopNamespaceDefault(pkg);
|
|
31
33
|
const dropzone__namespace = /* @__PURE__ */ _interopNamespaceDefault(dropzone);
|
|
32
34
|
const ToolbarPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(ToolbarPrimitive);
|
|
33
|
-
const SeparatorPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(SeparatorPrimitive);
|
|
34
35
|
const TooltipPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(TooltipPrimitive);
|
|
35
|
-
const DropdownMenuPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(DropdownMenuPrimitive);
|
|
36
36
|
const yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(yup);
|
|
37
37
|
const ModalProvider = ({ children }) => {
|
|
38
38
|
const [modalRootContainerRef, setModalRootContainerRef] = React.useState(
|
|
@@ -774,6 +774,22 @@ var __publicField = (obj, key, value) => {
|
|
|
774
774
|
);
|
|
775
775
|
};
|
|
776
776
|
}
|
|
777
|
+
function wrapFieldWithNoHeader(Field) {
|
|
778
|
+
return (props) => {
|
|
779
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
780
|
+
FieldMeta,
|
|
781
|
+
{
|
|
782
|
+
name: props.input.name,
|
|
783
|
+
label: false,
|
|
784
|
+
description: "",
|
|
785
|
+
error: props.meta.error,
|
|
786
|
+
index: props.index,
|
|
787
|
+
tinaForm: props.tinaForm
|
|
788
|
+
},
|
|
789
|
+
/* @__PURE__ */ React__namespace.createElement(Field, { ...props })
|
|
790
|
+
);
|
|
791
|
+
};
|
|
792
|
+
}
|
|
777
793
|
function wrapFieldWithError(Field) {
|
|
778
794
|
return (props) => {
|
|
779
795
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -850,9 +866,9 @@ var __publicField = (obj, key, value) => {
|
|
|
850
866
|
"span",
|
|
851
867
|
{
|
|
852
868
|
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
|
|
853
|
-
...props
|
|
854
|
-
|
|
855
|
-
|
|
869
|
+
...props,
|
|
870
|
+
dangerouslySetInnerHTML: { __html: children }
|
|
871
|
+
}
|
|
856
872
|
);
|
|
857
873
|
};
|
|
858
874
|
const FieldError = ({
|
|
@@ -882,6 +898,20 @@ var __publicField = (obj, key, value) => {
|
|
|
882
898
|
const useTemplates = () => {
|
|
883
899
|
return React.useContext(EditorContext);
|
|
884
900
|
};
|
|
901
|
+
const BlockquoteElement = cn$1.withRef(
|
|
902
|
+
({ children, className, ...props }, ref) => {
|
|
903
|
+
return /* @__PURE__ */ React.createElement(
|
|
904
|
+
plateCommon.PlateElement,
|
|
905
|
+
{
|
|
906
|
+
asChild: true,
|
|
907
|
+
className: cn$1.cn("my-1 border-l-2 pl-6 italic", className),
|
|
908
|
+
ref,
|
|
909
|
+
...props
|
|
910
|
+
},
|
|
911
|
+
/* @__PURE__ */ React.createElement("blockquote", null, children)
|
|
912
|
+
);
|
|
913
|
+
}
|
|
914
|
+
);
|
|
885
915
|
function classNames$1(...classes) {
|
|
886
916
|
return classes.filter(Boolean).join(" ");
|
|
887
917
|
}
|
|
@@ -891,6 +921,503 @@ var __publicField = (obj, key, value) => {
|
|
|
891
921
|
(c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
892
922
|
);
|
|
893
923
|
};
|
|
924
|
+
function ChevronDownIcon(props, svgRef) {
|
|
925
|
+
return /* @__PURE__ */ React__namespace.createElement("svg", Object.assign({
|
|
926
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
927
|
+
viewBox: "0 0 20 20",
|
|
928
|
+
fill: "currentColor",
|
|
929
|
+
"aria-hidden": "true",
|
|
930
|
+
ref: svgRef
|
|
931
|
+
}, props), /* @__PURE__ */ React__namespace.createElement("path", {
|
|
932
|
+
fillRule: "evenodd",
|
|
933
|
+
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",
|
|
934
|
+
clipRule: "evenodd"
|
|
935
|
+
}));
|
|
936
|
+
}
|
|
937
|
+
const ForwardRef = React__namespace.forwardRef(ChevronDownIcon);
|
|
938
|
+
const ChevronDownIcon$1 = ForwardRef;
|
|
939
|
+
const Autocomplete = ({
|
|
940
|
+
value,
|
|
941
|
+
onChange,
|
|
942
|
+
defaultQuery,
|
|
943
|
+
items: items2
|
|
944
|
+
}) => {
|
|
945
|
+
const [query, setQuery] = React.useState(defaultQuery ?? "");
|
|
946
|
+
const filteredItems = React.useMemo(() => {
|
|
947
|
+
try {
|
|
948
|
+
const reFilter = new RegExp(query, "i");
|
|
949
|
+
const _items = items2.filter((item) => reFilter.test(item.label));
|
|
950
|
+
if (_items.length === 0)
|
|
951
|
+
return items2;
|
|
952
|
+
return _items;
|
|
953
|
+
} catch (err) {
|
|
954
|
+
return items2;
|
|
955
|
+
}
|
|
956
|
+
}, [items2, query]);
|
|
957
|
+
return /* @__PURE__ */ React.createElement(
|
|
958
|
+
react.Combobox,
|
|
959
|
+
{
|
|
960
|
+
value,
|
|
961
|
+
onChange,
|
|
962
|
+
as: "div",
|
|
963
|
+
className: "relative inline-block text-left z-20"
|
|
964
|
+
},
|
|
965
|
+
/* @__PURE__ */ React.createElement("div", { className: "mt-1" }, /* @__PURE__ */ React.createElement("div", { className: "relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left shadow-md sm:text-sm" }, /* @__PURE__ */ React.createElement(
|
|
966
|
+
react.ComboboxInput,
|
|
967
|
+
{
|
|
968
|
+
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",
|
|
969
|
+
displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
|
|
970
|
+
onChange: (event) => setQuery(event.target.value),
|
|
971
|
+
onClick: (ev) => ev.stopPropagation()
|
|
972
|
+
}
|
|
973
|
+
), /* @__PURE__ */ React.createElement(react.ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React.createElement(
|
|
974
|
+
ChevronDownIcon$1,
|
|
975
|
+
{
|
|
976
|
+
className: "h-5 w-5 text-gray-400",
|
|
977
|
+
"aria-hidden": "true"
|
|
978
|
+
}
|
|
979
|
+
)))),
|
|
980
|
+
/* @__PURE__ */ React.createElement(
|
|
981
|
+
react.Transition,
|
|
982
|
+
{
|
|
983
|
+
enter: "transition ease-out duration-100",
|
|
984
|
+
enterFrom: "transform opacity-0 scale-95",
|
|
985
|
+
enterTo: "transform opacity-100 scale-100",
|
|
986
|
+
leave: "transition ease-in duration-75",
|
|
987
|
+
leaveFrom: "transform opacity-100 scale-100",
|
|
988
|
+
leaveTo: "transform opacity-0 scale-95"
|
|
989
|
+
},
|
|
990
|
+
/* @__PURE__ */ React.createElement(react.ComboboxOptions, { className: "origin-top-right absolute right-0 mt-1 w-full max-h-[300px] overflow-y-auto rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, filteredItems.map((item) => /* @__PURE__ */ React.createElement(react.ComboboxOption, { key: item.key, value: item }, ({ focus }) => /* @__PURE__ */ React.createElement(
|
|
991
|
+
"button",
|
|
992
|
+
{
|
|
993
|
+
className: classNames$1(
|
|
994
|
+
focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
|
|
995
|
+
"block px-4 py-2 text-xs w-full text-right"
|
|
996
|
+
)
|
|
997
|
+
},
|
|
998
|
+
item.render(item)
|
|
999
|
+
))))
|
|
1000
|
+
)
|
|
1001
|
+
);
|
|
1002
|
+
};
|
|
1003
|
+
MonacoEditor.loader.config({
|
|
1004
|
+
paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
|
|
1005
|
+
});
|
|
1006
|
+
let retryCount = 0;
|
|
1007
|
+
const retryFocus = (ref) => {
|
|
1008
|
+
if (ref.current) {
|
|
1009
|
+
ref.current.focus();
|
|
1010
|
+
} else {
|
|
1011
|
+
if (retryCount < 30) {
|
|
1012
|
+
setTimeout(() => {
|
|
1013
|
+
retryCount = retryCount + 1;
|
|
1014
|
+
retryFocus(ref);
|
|
1015
|
+
}, 100);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
const MINIMUM_HEIGHT = 75;
|
|
1020
|
+
const CodeBlock = ({
|
|
1021
|
+
attributes,
|
|
1022
|
+
editor,
|
|
1023
|
+
element,
|
|
1024
|
+
language: restrictLanguage,
|
|
1025
|
+
onChangeCallback,
|
|
1026
|
+
defaultValue,
|
|
1027
|
+
...props
|
|
1028
|
+
}) => {
|
|
1029
|
+
const [navigateAway, setNavigateAway] = React.useState(null);
|
|
1030
|
+
const monaco = MonacoEditor.useMonaco();
|
|
1031
|
+
const monacoEditorRef = React.useRef(null);
|
|
1032
|
+
const selected = slateReact.useSelected();
|
|
1033
|
+
const [height, setHeight] = React.useState(MINIMUM_HEIGHT);
|
|
1034
|
+
React.useEffect(() => {
|
|
1035
|
+
if (selected && plateCommon.isCollapsed(editor.selection)) {
|
|
1036
|
+
retryFocus(monacoEditorRef);
|
|
1037
|
+
}
|
|
1038
|
+
}, [selected, monacoEditorRef.current]);
|
|
1039
|
+
const value = element.value || "";
|
|
1040
|
+
if (typeof value !== "string") {
|
|
1041
|
+
throw new Error("Element must be of type string for code block");
|
|
1042
|
+
}
|
|
1043
|
+
const language = restrictLanguage || element.lang;
|
|
1044
|
+
const id = React.useMemo(() => uuid(), []);
|
|
1045
|
+
const languages = React.useMemo(() => {
|
|
1046
|
+
const defaultLangSet = { "": "plain text" };
|
|
1047
|
+
if (!monaco)
|
|
1048
|
+
return defaultLangSet;
|
|
1049
|
+
return monaco.languages.getLanguages().reduce((ac, cv) => {
|
|
1050
|
+
if (cv.id === "plaintext")
|
|
1051
|
+
return ac;
|
|
1052
|
+
return { ...ac, [cv.id]: cv.id };
|
|
1053
|
+
}, defaultLangSet);
|
|
1054
|
+
}, [monaco]);
|
|
1055
|
+
React.useEffect(() => {
|
|
1056
|
+
if (monaco) {
|
|
1057
|
+
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
1058
|
+
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
1059
|
+
// disable errors
|
|
1060
|
+
noSemanticValidation: true,
|
|
1061
|
+
noSyntaxValidation: true
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
}, [monaco]);
|
|
1065
|
+
const items2 = Object.entries(languages).map(([key, label]) => ({
|
|
1066
|
+
key,
|
|
1067
|
+
label,
|
|
1068
|
+
render: (item) => item.label
|
|
1069
|
+
}));
|
|
1070
|
+
const currentItem = React.useMemo(() => {
|
|
1071
|
+
return items2.find((item) => item.key === language) ?? {
|
|
1072
|
+
key: "",
|
|
1073
|
+
label: "Plain Text"
|
|
1074
|
+
};
|
|
1075
|
+
}, [items2, language]);
|
|
1076
|
+
React.useEffect(() => {
|
|
1077
|
+
if (navigateAway) {
|
|
1078
|
+
setNavigateAway(null);
|
|
1079
|
+
switch (navigateAway) {
|
|
1080
|
+
case "remove":
|
|
1081
|
+
{
|
|
1082
|
+
plateCommon.focusEditor(editor);
|
|
1083
|
+
plateCommon.setNodes(
|
|
1084
|
+
editor,
|
|
1085
|
+
{
|
|
1086
|
+
type: "p",
|
|
1087
|
+
children: [{ text: "" }],
|
|
1088
|
+
lang: void 0,
|
|
1089
|
+
value: void 0
|
|
1090
|
+
},
|
|
1091
|
+
{
|
|
1092
|
+
match: (n) => {
|
|
1093
|
+
if (plateCommon.isElement(n) && n.type === element.type) {
|
|
1094
|
+
return true;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1100
|
+
break;
|
|
1101
|
+
case "insertNext":
|
|
1102
|
+
{
|
|
1103
|
+
plateCommon.insertNodes(
|
|
1104
|
+
editor,
|
|
1105
|
+
[
|
|
1106
|
+
{
|
|
1107
|
+
type: plateCommon.ELEMENT_DEFAULT,
|
|
1108
|
+
children: [{ text: "" }],
|
|
1109
|
+
lang: void 0,
|
|
1110
|
+
value: void 0
|
|
1111
|
+
}
|
|
1112
|
+
],
|
|
1113
|
+
{ select: true }
|
|
1114
|
+
);
|
|
1115
|
+
plateCommon.focusEditor(editor);
|
|
1116
|
+
}
|
|
1117
|
+
break;
|
|
1118
|
+
case "up":
|
|
1119
|
+
{
|
|
1120
|
+
const path = plateCommon.findNodePath(editor, element);
|
|
1121
|
+
if (!path) {
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
const previousNodePath = plateCommon.getPointBefore(editor, path);
|
|
1125
|
+
if (!previousNodePath) {
|
|
1126
|
+
plateCommon.focusEditor(editor);
|
|
1127
|
+
plateCommon.insertNodes(
|
|
1128
|
+
editor,
|
|
1129
|
+
[
|
|
1130
|
+
{
|
|
1131
|
+
type: plateCommon.ELEMENT_DEFAULT,
|
|
1132
|
+
children: [{ text: "" }],
|
|
1133
|
+
lang: void 0,
|
|
1134
|
+
value: void 0
|
|
1135
|
+
}
|
|
1136
|
+
],
|
|
1137
|
+
// Insert a new node at the current path, resulting in the code_block
|
|
1138
|
+
// moving down one block
|
|
1139
|
+
{ at: path, select: true }
|
|
1140
|
+
);
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
plateCommon.focusEditor(editor, previousNodePath);
|
|
1144
|
+
}
|
|
1145
|
+
break;
|
|
1146
|
+
case "down": {
|
|
1147
|
+
const path = plateCommon.findNodePath(editor, element);
|
|
1148
|
+
if (!path) {
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
const nextNodePath = plateCommon.getPointAfter(editor, path);
|
|
1152
|
+
if (!nextNodePath) {
|
|
1153
|
+
plateCommon.insertNodes(
|
|
1154
|
+
editor,
|
|
1155
|
+
[
|
|
1156
|
+
{
|
|
1157
|
+
type: plateCommon.ELEMENT_DEFAULT,
|
|
1158
|
+
children: [{ text: "" }],
|
|
1159
|
+
lang: void 0,
|
|
1160
|
+
value: void 0
|
|
1161
|
+
}
|
|
1162
|
+
],
|
|
1163
|
+
{ select: true }
|
|
1164
|
+
);
|
|
1165
|
+
plateCommon.focusEditor(editor);
|
|
1166
|
+
} else {
|
|
1167
|
+
plateCommon.focusEditor(editor, nextNodePath);
|
|
1168
|
+
}
|
|
1169
|
+
break;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}, [navigateAway]);
|
|
1174
|
+
function handleEditorDidMount(monacoEditor, monaco2) {
|
|
1175
|
+
monacoEditorRef.current = monacoEditor;
|
|
1176
|
+
monacoEditor.onDidContentSizeChange(() => {
|
|
1177
|
+
setHeight(
|
|
1178
|
+
monacoEditor.getContentHeight() > MINIMUM_HEIGHT ? monacoEditor.getContentHeight() : MINIMUM_HEIGHT
|
|
1179
|
+
);
|
|
1180
|
+
monacoEditor.layout();
|
|
1181
|
+
});
|
|
1182
|
+
plateCommon.setNodes(editor, { value: defaultValue, lang: language });
|
|
1183
|
+
monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
|
|
1184
|
+
if (monacoEditor.hasTextFocus()) {
|
|
1185
|
+
setNavigateAway("insertNext");
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
monacoEditor.onKeyDown((l) => {
|
|
1189
|
+
if (l.code === "ArrowUp") {
|
|
1190
|
+
const selection = monacoEditor.getSelection();
|
|
1191
|
+
if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
|
|
1192
|
+
setNavigateAway("up");
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
if (l.code === "ArrowDown") {
|
|
1196
|
+
const selection = monacoEditor.getSelection();
|
|
1197
|
+
const totalLines = monacoEditor.getModel().getLineCount();
|
|
1198
|
+
if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
|
|
1199
|
+
setNavigateAway("down");
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
if (l.code === "Backspace") {
|
|
1203
|
+
const selection = monacoEditor.getSelection();
|
|
1204
|
+
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) {
|
|
1205
|
+
setNavigateAway("remove");
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
return /* @__PURE__ */ React.createElement(
|
|
1211
|
+
"div",
|
|
1212
|
+
{
|
|
1213
|
+
...attributes,
|
|
1214
|
+
className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
|
|
1215
|
+
},
|
|
1216
|
+
/* @__PURE__ */ React.createElement("style", null, `.monaco-editor .editor-widget {
|
|
1217
|
+
display: none !important;
|
|
1218
|
+
visibility: hidden !important;
|
|
1219
|
+
}`),
|
|
1220
|
+
props.children,
|
|
1221
|
+
/* @__PURE__ */ React.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement(
|
|
1222
|
+
Autocomplete,
|
|
1223
|
+
{
|
|
1224
|
+
items: items2,
|
|
1225
|
+
value: currentItem,
|
|
1226
|
+
defaultQuery: "plaintext",
|
|
1227
|
+
onChange: (item) => plateCommon.setNodes(editor, { lang: item.key })
|
|
1228
|
+
}
|
|
1229
|
+
)), /* @__PURE__ */ React.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React.createElement(
|
|
1230
|
+
MonacoEditor,
|
|
1231
|
+
{
|
|
1232
|
+
path: id,
|
|
1233
|
+
onMount: handleEditorDidMount,
|
|
1234
|
+
options: {
|
|
1235
|
+
scrollBeyondLastLine: false,
|
|
1236
|
+
// automaticLayout: true,
|
|
1237
|
+
tabSize: 2,
|
|
1238
|
+
disableLayerHinting: true,
|
|
1239
|
+
accessibilitySupport: "off",
|
|
1240
|
+
codeLens: false,
|
|
1241
|
+
wordWrap: "on",
|
|
1242
|
+
minimap: {
|
|
1243
|
+
enabled: false
|
|
1244
|
+
},
|
|
1245
|
+
fontSize: 14,
|
|
1246
|
+
lineHeight: 2,
|
|
1247
|
+
formatOnPaste: true,
|
|
1248
|
+
lineNumbers: "off",
|
|
1249
|
+
formatOnType: true,
|
|
1250
|
+
fixedOverflowWidgets: true,
|
|
1251
|
+
// Takes too much horizontal space for iframe
|
|
1252
|
+
folding: false,
|
|
1253
|
+
renderLineHighlight: "none",
|
|
1254
|
+
scrollbar: {
|
|
1255
|
+
verticalScrollbarSize: 1,
|
|
1256
|
+
horizontalScrollbarSize: 1,
|
|
1257
|
+
// https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
|
|
1258
|
+
alwaysConsumeMouseWheel: false
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
language: String(language),
|
|
1262
|
+
value: String(element.value),
|
|
1263
|
+
onChange: (value2) => {
|
|
1264
|
+
onChangeCallback == null ? void 0 : onChangeCallback(value2);
|
|
1265
|
+
plateCommon.setNodes(editor, { value: value2, lang: language });
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
)))
|
|
1269
|
+
);
|
|
1270
|
+
};
|
|
1271
|
+
const CodeBlockElement = cn$1.withRef(
|
|
1272
|
+
({ className, ...props }, ref) => {
|
|
1273
|
+
const { element } = props;
|
|
1274
|
+
const state = plateCodeBlock.useCodeBlockElementState({ element });
|
|
1275
|
+
return /* @__PURE__ */ React.createElement(
|
|
1276
|
+
plateCommon.PlateElement,
|
|
1277
|
+
{
|
|
1278
|
+
className: cn$1.cn("relative py-1", state.className, className),
|
|
1279
|
+
ref,
|
|
1280
|
+
...props
|
|
1281
|
+
},
|
|
1282
|
+
/* @__PURE__ */ React.createElement(CodeBlock, { ...props })
|
|
1283
|
+
);
|
|
1284
|
+
}
|
|
1285
|
+
);
|
|
1286
|
+
const CodeLeaf = cn$1.withRef(
|
|
1287
|
+
({ children, className, ...props }, ref) => {
|
|
1288
|
+
return /* @__PURE__ */ React.createElement(
|
|
1289
|
+
plateCommon.PlateLeaf,
|
|
1290
|
+
{
|
|
1291
|
+
asChild: true,
|
|
1292
|
+
className: cn$1.cn(
|
|
1293
|
+
"whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
|
|
1294
|
+
className
|
|
1295
|
+
),
|
|
1296
|
+
ref,
|
|
1297
|
+
...props
|
|
1298
|
+
},
|
|
1299
|
+
/* @__PURE__ */ React.createElement("code", null, children)
|
|
1300
|
+
);
|
|
1301
|
+
}
|
|
1302
|
+
);
|
|
1303
|
+
const CodeLineElement = cn$1.withRef((props, ref) => /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { ref, ...props }));
|
|
1304
|
+
const CodeSyntaxLeaf = cn$1.withRef(
|
|
1305
|
+
({ children, ...props }, ref) => {
|
|
1306
|
+
const { leaf } = props;
|
|
1307
|
+
const { tokenProps } = plateCodeBlock.useCodeSyntaxLeaf({ leaf });
|
|
1308
|
+
return /* @__PURE__ */ React.createElement(plateCommon.PlateLeaf, { ref, ...props }, /* @__PURE__ */ React.createElement("span", { ...tokenProps }, children));
|
|
1309
|
+
}
|
|
1310
|
+
);
|
|
1311
|
+
const listVariants = classVarianceAuthority.cva("m-0 ps-6", {
|
|
1312
|
+
variants: {
|
|
1313
|
+
variant: {
|
|
1314
|
+
ol: "list-decimal",
|
|
1315
|
+
ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
});
|
|
1319
|
+
const ListElementVariants = cn$1.withVariants(plateCommon.PlateElement, listVariants, [
|
|
1320
|
+
"variant"
|
|
1321
|
+
]);
|
|
1322
|
+
const ListElement = cn$1.withRef(
|
|
1323
|
+
({ children, variant = "ul", ...props }, ref) => {
|
|
1324
|
+
const Component = variant;
|
|
1325
|
+
return /* @__PURE__ */ React.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React.createElement(Component, null, children));
|
|
1326
|
+
}
|
|
1327
|
+
);
|
|
1328
|
+
const ELEMENT_MERMAID = "mermaid";
|
|
1329
|
+
const createMermaidPlugin = plateCommon.createPluginFactory({
|
|
1330
|
+
isElement: true,
|
|
1331
|
+
isVoid: true,
|
|
1332
|
+
isInline: false,
|
|
1333
|
+
key: ELEMENT_MERMAID
|
|
1334
|
+
});
|
|
1335
|
+
const MermaidElementWithRef = ({ config }) => {
|
|
1336
|
+
const mermaidRef = React.useRef(null);
|
|
1337
|
+
React.useEffect(() => {
|
|
1338
|
+
if (mermaidRef.current) {
|
|
1339
|
+
mermaid.initialize({ startOnLoad: true });
|
|
1340
|
+
mermaid.init();
|
|
1341
|
+
}
|
|
1342
|
+
}, [config]);
|
|
1343
|
+
return /* @__PURE__ */ React.createElement("div", { contentEditable: false, className: "border-border border-b" }, /* @__PURE__ */ React.createElement("div", { ref: mermaidRef }, /* @__PURE__ */ React.createElement("pre", { className: "mermaid not-tina-prose" }, config)));
|
|
1344
|
+
};
|
|
1345
|
+
const Bubble = ({ children }) => {
|
|
1346
|
+
return /* @__PURE__ */ React.createElement("div", { className: "bg-blue-600 rounded-full p-2 transition-transform duration-200 ease-in-out hover:scale-110" }, children);
|
|
1347
|
+
};
|
|
1348
|
+
const ErrorMsg = ({ error }) => {
|
|
1349
|
+
if (error) {
|
|
1350
|
+
return /* @__PURE__ */ React.createElement(
|
|
1351
|
+
"div",
|
|
1352
|
+
{
|
|
1353
|
+
contentEditable: false,
|
|
1354
|
+
className: "font-mono bg-red-600 text-white p-2 rounded-md cursor-default"
|
|
1355
|
+
},
|
|
1356
|
+
error
|
|
1357
|
+
);
|
|
1358
|
+
}
|
|
1359
|
+
return null;
|
|
1360
|
+
};
|
|
1361
|
+
const DEFAULT_MERMAID_CONFIG = `%% This won't render without implementing a rendering engine (e.g. mermaid on npm)
|
|
1362
|
+
flowchart TD
|
|
1363
|
+
id1(this is an example flow diagram)
|
|
1364
|
+
--> id2(modify me to see changes!)
|
|
1365
|
+
id2
|
|
1366
|
+
--> id3(Click the top button to preview the changes)
|
|
1367
|
+
--> id4(Learn about mermaid diagrams - mermaid.js.org)`;
|
|
1368
|
+
const MermaidElement = cn$1.withRef(
|
|
1369
|
+
({ children, nodeProps, element, ...props }, ref) => {
|
|
1370
|
+
const [mermaidConfig, setMermaidConfig] = React.useState(
|
|
1371
|
+
element.value || DEFAULT_MERMAID_CONFIG
|
|
1372
|
+
);
|
|
1373
|
+
const [isEditing, setIsEditing] = React.useState(
|
|
1374
|
+
mermaidConfig === DEFAULT_MERMAID_CONFIG || false
|
|
1375
|
+
);
|
|
1376
|
+
const [mermaidError, setMermaidError] = React.useState(null);
|
|
1377
|
+
const node = {
|
|
1378
|
+
type: ELEMENT_MERMAID,
|
|
1379
|
+
value: mermaidConfig,
|
|
1380
|
+
children: [{ type: "text", text: "" }]
|
|
1381
|
+
};
|
|
1382
|
+
React.useEffect(() => {
|
|
1383
|
+
if (mermaid.parse(mermaidConfig)) {
|
|
1384
|
+
setMermaidError(null);
|
|
1385
|
+
}
|
|
1386
|
+
}, [mermaidConfig]);
|
|
1387
|
+
mermaid.parseError = (err) => {
|
|
1388
|
+
setMermaidError(
|
|
1389
|
+
String(err.message) || "An error occurred while parsing the diagram."
|
|
1390
|
+
);
|
|
1391
|
+
};
|
|
1392
|
+
return /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { element, ref, ...props }, /* @__PURE__ */ React.createElement("div", { className: "relative group" }, /* @__PURE__ */ React.createElement("div", { className: "absolute top-2 right-2 z-10 space-y-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 ease-in-out" }, /* @__PURE__ */ React.createElement(Bubble, null, isEditing ? /* @__PURE__ */ React.createElement(
|
|
1393
|
+
lucideReact.Eye,
|
|
1394
|
+
{
|
|
1395
|
+
className: "w-5 h-5 fill-white cursor-pointer",
|
|
1396
|
+
onClick: () => {
|
|
1397
|
+
setIsEditing(!isEditing);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
) : /* @__PURE__ */ React.createElement(
|
|
1401
|
+
lucideReact.SquarePen,
|
|
1402
|
+
{
|
|
1403
|
+
className: "w-5 h-5 fill-white cursor-pointer",
|
|
1404
|
+
onClick: () => {
|
|
1405
|
+
setIsEditing(!isEditing);
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
))), isEditing ? /* @__PURE__ */ React.createElement(
|
|
1409
|
+
CodeBlock,
|
|
1410
|
+
{
|
|
1411
|
+
children: "",
|
|
1412
|
+
language: "yaml",
|
|
1413
|
+
...props,
|
|
1414
|
+
element: node,
|
|
1415
|
+
defaultValue: mermaidConfig,
|
|
1416
|
+
onChangeCallback: (value) => setMermaidConfig(value)
|
|
1417
|
+
}
|
|
1418
|
+
) : /* @__PURE__ */ React.createElement(MermaidElementWithRef, { config: mermaidConfig })), children, /* @__PURE__ */ React.createElement(ErrorMsg, { error: mermaidError }));
|
|
1419
|
+
}
|
|
1420
|
+
);
|
|
894
1421
|
const RawMarkdown = () => {
|
|
895
1422
|
return /* @__PURE__ */ React.createElement(
|
|
896
1423
|
"svg",
|
|
@@ -909,6 +1436,29 @@ var __publicField = (obj, key, value) => {
|
|
|
909
1436
|
/* @__PURE__ */ React.createElement("path", { d: "M22.27 19.385H1.73A1.73 1.73 0 010 17.655V6.345a1.73 1.73 0 011.73-1.73h20.54A1.73 1.73 0 0124 6.345v11.308a1.73 1.73 0 01-1.73 1.731zM5.769 15.923v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.46v7.847zM21.232 12h-2.309V8.077h-2.307V12h-2.308l3.461 4.039z" })
|
|
910
1437
|
);
|
|
911
1438
|
};
|
|
1439
|
+
const MermaidIcon = () => /* @__PURE__ */ React.createElement(
|
|
1440
|
+
"svg",
|
|
1441
|
+
{
|
|
1442
|
+
width: "100%",
|
|
1443
|
+
height: "100%",
|
|
1444
|
+
viewBox: "0 0 491 491",
|
|
1445
|
+
version: "1.1",
|
|
1446
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1447
|
+
fillRule: "evenodd",
|
|
1448
|
+
clipRule: "evenodd",
|
|
1449
|
+
strokeLinejoin: "round",
|
|
1450
|
+
strokeMiterlimit: 2
|
|
1451
|
+
},
|
|
1452
|
+
/* @__PURE__ */ React.createElement("path", { d: "M490.16,84.61C490.16,37.912 452.248,0 405.55,0L84.61,0C37.912,0 0,37.912 0,84.61L0,405.55C0,452.248 37.912,490.16 84.61,490.16L405.55,490.16C452.248,490.16 490.16,452.248 490.16,405.55L490.16,84.61Z" }),
|
|
1453
|
+
/* @__PURE__ */ React.createElement(
|
|
1454
|
+
"path",
|
|
1455
|
+
{
|
|
1456
|
+
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",
|
|
1457
|
+
fill: "white",
|
|
1458
|
+
fillRule: "nonzero"
|
|
1459
|
+
}
|
|
1460
|
+
)
|
|
1461
|
+
);
|
|
912
1462
|
const borderAll = (props) => /* @__PURE__ */ React.createElement(
|
|
913
1463
|
"svg",
|
|
914
1464
|
{
|
|
@@ -993,7 +1543,7 @@ var __publicField = (obj, key, value) => {
|
|
|
993
1543
|
},
|
|
994
1544
|
/* @__PURE__ */ React.createElement("path", { d: "M3 6a1 1 0 0 0 2 0 1 1 0 0 1 1-1h12a1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3zm2 5a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-8 1a1 1 0 1 0 0-2 1 1 0 0 1-1-1 1 1 0 1 0-2 0 3 3 0 0 0 3 3zm11-1a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" })
|
|
995
1545
|
);
|
|
996
|
-
classVarianceAuthority.cva("", {
|
|
1546
|
+
const iconVariants = classVarianceAuthority.cva("", {
|
|
997
1547
|
variants: {
|
|
998
1548
|
variant: {
|
|
999
1549
|
toolbar: "size-5",
|
|
@@ -1149,6 +1699,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1149
1699
|
clear: lucideReact.X,
|
|
1150
1700
|
close: lucideReact.X,
|
|
1151
1701
|
// code: Code2,
|
|
1702
|
+
paint: lucideReact.PaintBucket,
|
|
1152
1703
|
codeblock: lucideReact.FileCode,
|
|
1153
1704
|
color: lucideReact.Baseline,
|
|
1154
1705
|
column: lucideReact.RectangleVertical,
|
|
@@ -1174,6 +1725,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1174
1725
|
lineHeight: lucideReact.WrapText,
|
|
1175
1726
|
// link: Link2,
|
|
1176
1727
|
minus: lucideReact.Minus,
|
|
1728
|
+
mermaid: MermaidIcon,
|
|
1177
1729
|
more: lucideReact.MoreHorizontal,
|
|
1178
1730
|
// ol: ListOrdered,
|
|
1179
1731
|
outdent: lucideReact.Outdent,
|
|
@@ -1548,7 +2100,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1548
2100
|
setHasEmpty
|
|
1549
2101
|
]
|
|
1550
2102
|
);
|
|
1551
|
-
const store = react.useComboboxStore({
|
|
2103
|
+
const store = react$1.useComboboxStore({
|
|
1552
2104
|
setValue: (newValue) => React.startTransition(() => setValue(newValue))
|
|
1553
2105
|
});
|
|
1554
2106
|
const items2 = store.useState("items");
|
|
@@ -1558,7 +2110,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1558
2110
|
}
|
|
1559
2111
|
}, [items2, store]);
|
|
1560
2112
|
return /* @__PURE__ */ React.createElement("span", { contentEditable: false }, /* @__PURE__ */ React.createElement(
|
|
1561
|
-
react.ComboboxProvider,
|
|
2113
|
+
react$1.ComboboxProvider,
|
|
1562
2114
|
{
|
|
1563
2115
|
open: (items2.length > 0 || hasEmpty) && (!hideWhenNoValue || value.length > 0),
|
|
1564
2116
|
store
|
|
@@ -1573,7 +2125,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1573
2125
|
showTrigger,
|
|
1574
2126
|
trigger
|
|
1575
2127
|
} = React.useContext(InlineComboboxContext);
|
|
1576
|
-
const store = react.useComboboxContext();
|
|
2128
|
+
const store = react$1.useComboboxContext();
|
|
1577
2129
|
const value = store.useState("value");
|
|
1578
2130
|
const ref = plateCommon.useComposedRef(propRef, contextRef);
|
|
1579
2131
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, showTrigger && trigger, /* @__PURE__ */ React.createElement("span", { className: "relative min-h-[1lh]" }, /* @__PURE__ */ React.createElement(
|
|
@@ -1584,7 +2136,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1584
2136
|
},
|
|
1585
2137
|
value || ""
|
|
1586
2138
|
), /* @__PURE__ */ React.createElement(
|
|
1587
|
-
react.Combobox,
|
|
2139
|
+
react$1.Combobox,
|
|
1588
2140
|
{
|
|
1589
2141
|
autoSelect: true,
|
|
1590
2142
|
className: cn$1.cn(
|
|
@@ -1603,8 +2155,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1603
2155
|
className,
|
|
1604
2156
|
...props
|
|
1605
2157
|
}) => {
|
|
1606
|
-
return /* @__PURE__ */ React.createElement(react.Portal, null, /* @__PURE__ */ React.createElement(
|
|
1607
|
-
react.ComboboxPopover,
|
|
2158
|
+
return /* @__PURE__ */ React.createElement(react$1.Portal, null, /* @__PURE__ */ React.createElement(
|
|
2159
|
+
react$1.ComboboxPopover,
|
|
1608
2160
|
{
|
|
1609
2161
|
className: cn$1.cn(
|
|
1610
2162
|
"z-[9999999] max-h-[288px] w-[300px] overflow-y-auto rounded-md bg-white shadow-md",
|
|
@@ -1636,7 +2188,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1636
2188
|
}) => {
|
|
1637
2189
|
const { value } = props;
|
|
1638
2190
|
const { filter, removeInput } = React.useContext(InlineComboboxContext);
|
|
1639
|
-
const store = react.useComboboxContext();
|
|
2191
|
+
const store = react$1.useComboboxContext();
|
|
1640
2192
|
const search = filter && store.useState("value");
|
|
1641
2193
|
const visible = React.useMemo(
|
|
1642
2194
|
() => !filter || filter({ keywords, value }, search),
|
|
@@ -1645,7 +2197,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1645
2197
|
if (!visible)
|
|
1646
2198
|
return null;
|
|
1647
2199
|
return /* @__PURE__ */ React.createElement(
|
|
1648
|
-
react.ComboboxItem,
|
|
2200
|
+
react$1.ComboboxItem,
|
|
1649
2201
|
{
|
|
1650
2202
|
className: cn$1.cn(comboboxItemVariants(), className),
|
|
1651
2203
|
onClick: (event) => {
|
|
@@ -1661,7 +2213,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1661
2213
|
className
|
|
1662
2214
|
}) => {
|
|
1663
2215
|
const { setHasEmpty } = React.useContext(InlineComboboxContext);
|
|
1664
|
-
const store = react.useComboboxContext();
|
|
2216
|
+
const store = react$1.useComboboxContext();
|
|
1665
2217
|
const items2 = store.useState("items");
|
|
1666
2218
|
React.useEffect(() => {
|
|
1667
2219
|
setHasEmpty(true);
|
|
@@ -1744,417 +2296,482 @@ var __publicField = (obj, key, value) => {
|
|
|
1744
2296
|
);
|
|
1745
2297
|
}
|
|
1746
2298
|
);
|
|
1747
|
-
const
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
className: cn$1.cn("my-1 border-l-2 pl-6 italic", className),
|
|
1771
|
-
ref,
|
|
1772
|
-
...props
|
|
1773
|
-
},
|
|
1774
|
-
/* @__PURE__ */ React.createElement("blockquote", null, children)
|
|
1775
|
-
);
|
|
1776
|
-
}
|
|
1777
|
-
);
|
|
1778
|
-
const CodeLeaf = cn$1.withRef(
|
|
1779
|
-
({ children, className, ...props }, ref) => {
|
|
1780
|
-
return /* @__PURE__ */ React.createElement(
|
|
1781
|
-
plateCommon.PlateLeaf,
|
|
1782
|
-
{
|
|
1783
|
-
asChild: true,
|
|
1784
|
-
className: cn$1.cn(
|
|
1785
|
-
"whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
|
|
1786
|
-
className
|
|
1787
|
-
),
|
|
1788
|
-
ref,
|
|
1789
|
-
...props
|
|
1790
|
-
},
|
|
1791
|
-
/* @__PURE__ */ React.createElement("code", null, children)
|
|
1792
|
-
);
|
|
1793
|
-
}
|
|
1794
|
-
);
|
|
1795
|
-
const CodeLineElement = cn$1.withRef((props, ref) => /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { ref, ...props }));
|
|
1796
|
-
const CodeSyntaxLeaf = cn$1.withRef(
|
|
1797
|
-
({ children, ...props }, ref) => {
|
|
1798
|
-
const { leaf } = props;
|
|
1799
|
-
const { tokenProps } = plateCodeBlock.useCodeSyntaxLeaf({ leaf });
|
|
1800
|
-
return /* @__PURE__ */ React.createElement(plateCommon.PlateLeaf, { ref, ...props }, /* @__PURE__ */ React.createElement("span", { ...tokenProps }, children));
|
|
1801
|
-
}
|
|
1802
|
-
);
|
|
1803
|
-
function ChevronDownIcon(props, svgRef) {
|
|
1804
|
-
return /* @__PURE__ */ React__namespace.createElement("svg", Object.assign({
|
|
1805
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1806
|
-
viewBox: "0 0 20 20",
|
|
1807
|
-
fill: "currentColor",
|
|
1808
|
-
"aria-hidden": "true",
|
|
1809
|
-
ref: svgRef
|
|
1810
|
-
}, props), /* @__PURE__ */ React__namespace.createElement("path", {
|
|
1811
|
-
fillRule: "evenodd",
|
|
1812
|
-
d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
|
|
1813
|
-
clipRule: "evenodd"
|
|
1814
|
-
}));
|
|
1815
|
-
}
|
|
1816
|
-
const ForwardRef = React__namespace.forwardRef(ChevronDownIcon);
|
|
1817
|
-
const ChevronDownIcon$1 = ForwardRef;
|
|
1818
|
-
const Autocomplete = ({
|
|
1819
|
-
value,
|
|
1820
|
-
onChange,
|
|
1821
|
-
defaultQuery,
|
|
1822
|
-
items: items2
|
|
1823
|
-
}) => {
|
|
1824
|
-
const [query, setQuery] = React.useState(defaultQuery ?? "");
|
|
1825
|
-
const filteredItems = React.useMemo(() => {
|
|
1826
|
-
try {
|
|
1827
|
-
const reFilter = new RegExp(query, "i");
|
|
1828
|
-
const _items = items2.filter((item) => reFilter.test(item.label));
|
|
1829
|
-
if (_items.length === 0)
|
|
1830
|
-
return items2;
|
|
1831
|
-
return _items;
|
|
1832
|
-
} catch (err) {
|
|
1833
|
-
return items2;
|
|
1834
|
-
}
|
|
1835
|
-
}, [items2, query]);
|
|
2299
|
+
const TableCellElement = cn$1.withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
|
|
2300
|
+
var _a, _b, _c, _d;
|
|
2301
|
+
const { element } = props;
|
|
2302
|
+
const {
|
|
2303
|
+
borders,
|
|
2304
|
+
colIndex,
|
|
2305
|
+
colSpan,
|
|
2306
|
+
hovered,
|
|
2307
|
+
hoveredLeft,
|
|
2308
|
+
isSelectingCell,
|
|
2309
|
+
readOnly,
|
|
2310
|
+
rowIndex,
|
|
2311
|
+
rowSize,
|
|
2312
|
+
selected
|
|
2313
|
+
} = plateTable.useTableCellElementState();
|
|
2314
|
+
const { props: cellProps } = plateTable.useTableCellElement({ element: props.element });
|
|
2315
|
+
const resizableState = plateTable.useTableCellElementResizableState({
|
|
2316
|
+
colIndex,
|
|
2317
|
+
colSpan,
|
|
2318
|
+
rowIndex
|
|
2319
|
+
});
|
|
2320
|
+
const { bottomProps, hiddenLeft, leftProps, rightProps } = plateTable.useTableCellElementResizable(resizableState);
|
|
2321
|
+
const Cell = isHeader ? "th" : "td";
|
|
1836
2322
|
return /* @__PURE__ */ React.createElement(
|
|
1837
|
-
|
|
2323
|
+
plateCommon.PlateElement,
|
|
1838
2324
|
{
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
2325
|
+
asChild: true,
|
|
2326
|
+
className: cn$1.cn(
|
|
2327
|
+
"relative h-full overflow-visible border-none bg-background p-0",
|
|
2328
|
+
hideBorder && "before:border-none",
|
|
2329
|
+
element.background ? "bg-[--cellBackground]" : "bg-background",
|
|
2330
|
+
!hideBorder && cn$1.cn(
|
|
2331
|
+
isHeader && "text-left [&_>_*]:m-0",
|
|
2332
|
+
"before:size-full",
|
|
2333
|
+
selected && "before:z-10 before:bg-muted",
|
|
2334
|
+
"before:absolute before:box-border before:select-none before:content-['']",
|
|
2335
|
+
borders && cn$1.cn(
|
|
2336
|
+
((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
|
|
2337
|
+
((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
|
|
2338
|
+
((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
|
|
2339
|
+
((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
|
|
2340
|
+
)
|
|
2341
|
+
),
|
|
2342
|
+
className
|
|
2343
|
+
),
|
|
2344
|
+
ref,
|
|
2345
|
+
...cellProps,
|
|
2346
|
+
...props,
|
|
2347
|
+
style: {
|
|
2348
|
+
"--cellBackground": element.background,
|
|
2349
|
+
...style
|
|
1851
2350
|
}
|
|
1852
|
-
|
|
1853
|
-
|
|
2351
|
+
},
|
|
2352
|
+
/* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(
|
|
2353
|
+
"div",
|
|
1854
2354
|
{
|
|
1855
|
-
className: "h-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
2355
|
+
className: "relative z-20 box-border h-full px-3 py-2",
|
|
2356
|
+
style: {
|
|
2357
|
+
minHeight: rowSize
|
|
2358
|
+
}
|
|
2359
|
+
},
|
|
2360
|
+
children
|
|
2361
|
+
), !isSelectingCell && /* @__PURE__ */ React.createElement(
|
|
2362
|
+
"div",
|
|
1861
2363
|
{
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
leave: "transition ease-in duration-75",
|
|
1866
|
-
leaveFrom: "transform opacity-100 scale-100",
|
|
1867
|
-
leaveTo: "transform opacity-0 scale-95"
|
|
2364
|
+
className: "group absolute top-0 size-full select-none",
|
|
2365
|
+
contentEditable: false,
|
|
2366
|
+
suppressContentEditableWarning: true
|
|
1868
2367
|
},
|
|
1869
|
-
|
|
1870
|
-
|
|
2368
|
+
!readOnly && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2369
|
+
plateResizable.ResizeHandle,
|
|
1871
2370
|
{
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
2371
|
+
...rightProps,
|
|
2372
|
+
className: "-top-3 right-[-5px] w-[10px]"
|
|
2373
|
+
}
|
|
2374
|
+
), /* @__PURE__ */ React.createElement(
|
|
2375
|
+
plateResizable.ResizeHandle,
|
|
2376
|
+
{
|
|
2377
|
+
...bottomProps,
|
|
2378
|
+
className: "bottom-[-5px] h-[10px]"
|
|
2379
|
+
}
|
|
2380
|
+
), !hiddenLeft && /* @__PURE__ */ React.createElement(
|
|
2381
|
+
plateResizable.ResizeHandle,
|
|
2382
|
+
{
|
|
2383
|
+
...leftProps,
|
|
2384
|
+
className: "-top-3 left-[-5px] w-[10px]"
|
|
2385
|
+
}
|
|
2386
|
+
), hovered && /* @__PURE__ */ React.createElement(
|
|
2387
|
+
"div",
|
|
2388
|
+
{
|
|
2389
|
+
className: cn$1.cn(
|
|
2390
|
+
"absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
|
|
2391
|
+
"right-[-1.5px]"
|
|
1875
2392
|
)
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
2393
|
+
}
|
|
2394
|
+
), hoveredLeft && /* @__PURE__ */ React.createElement(
|
|
2395
|
+
"div",
|
|
2396
|
+
{
|
|
2397
|
+
className: cn$1.cn(
|
|
2398
|
+
"absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
|
|
2399
|
+
"left-[-1.5px]"
|
|
2400
|
+
)
|
|
2401
|
+
}
|
|
2402
|
+
))
|
|
2403
|
+
))
|
|
1880
2404
|
);
|
|
1881
|
-
};
|
|
1882
|
-
MonacoEditor.loader.config({
|
|
1883
|
-
paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
|
|
1884
2405
|
});
|
|
1885
|
-
|
|
1886
|
-
const
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
2406
|
+
TableCellElement.displayName = "TableCellElement";
|
|
2407
|
+
const TableCellHeaderElement = cn$1.withProps(TableCellElement, {
|
|
2408
|
+
isHeader: true
|
|
2409
|
+
});
|
|
2410
|
+
const buttonVariants$1 = classVarianceAuthority.cva(
|
|
2411
|
+
"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",
|
|
2412
|
+
{
|
|
2413
|
+
defaultVariants: {
|
|
2414
|
+
size: "default",
|
|
2415
|
+
variant: "default"
|
|
2416
|
+
},
|
|
2417
|
+
variants: {
|
|
2418
|
+
isMenu: {
|
|
2419
|
+
true: "h-auto w-full cursor-pointer justify-start"
|
|
2420
|
+
},
|
|
2421
|
+
size: {
|
|
2422
|
+
default: "h-10 px-4 py-2",
|
|
2423
|
+
icon: "size-10",
|
|
2424
|
+
lg: "h-11 rounded-md px-8",
|
|
2425
|
+
none: "",
|
|
2426
|
+
sm: "h-9 rounded-md px-3",
|
|
2427
|
+
sms: "size-9 rounded-md px-0",
|
|
2428
|
+
xs: "h-8 rounded-md px-3"
|
|
2429
|
+
},
|
|
2430
|
+
variant: {
|
|
2431
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
2432
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
2433
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
2434
|
+
inlineLink: "text-base text-primary underline underline-offset-4",
|
|
2435
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
2436
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
2437
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
2438
|
+
}
|
|
1913
2439
|
}
|
|
1914
|
-
}, [selected, monacoEditorRef.current]);
|
|
1915
|
-
const value = element.value || "";
|
|
1916
|
-
if (typeof value !== "string") {
|
|
1917
|
-
throw new Error("Element must be of type string for code block");
|
|
1918
2440
|
}
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
const
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
return { ...ac, [cv.id]: cv.id };
|
|
1929
|
-
}, defaultLangSet);
|
|
1930
|
-
}, [monaco]);
|
|
1931
|
-
React.useEffect(() => {
|
|
1932
|
-
if (monaco) {
|
|
1933
|
-
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
1934
|
-
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
1935
|
-
// disable errors
|
|
1936
|
-
noSemanticValidation: true,
|
|
1937
|
-
noSyntaxValidation: true
|
|
1938
|
-
});
|
|
2441
|
+
);
|
|
2442
|
+
const Button$2 = cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
|
|
2443
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
2444
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
2445
|
+
Comp,
|
|
2446
|
+
{
|
|
2447
|
+
className: cn$1.cn(buttonVariants$1({ className, isMenu, size, variant })),
|
|
2448
|
+
ref,
|
|
2449
|
+
...props
|
|
1939
2450
|
}
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
{
|
|
1983
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
1984
|
-
children: [{ text: "" }],
|
|
1985
|
-
lang: void 0,
|
|
1986
|
-
value: void 0
|
|
1987
|
-
}
|
|
1988
|
-
],
|
|
1989
|
-
{ select: true }
|
|
1990
|
-
);
|
|
1991
|
-
plateCommon.focusEditor(editor);
|
|
1992
|
-
}
|
|
1993
|
-
break;
|
|
1994
|
-
case "up":
|
|
1995
|
-
{
|
|
1996
|
-
const path = plateCommon.findNodePath(editor, element);
|
|
1997
|
-
if (!path) {
|
|
1998
|
-
return;
|
|
1999
|
-
}
|
|
2000
|
-
const previousNodePath = plateCommon.getPointBefore(editor, path);
|
|
2001
|
-
if (!previousNodePath) {
|
|
2002
|
-
plateCommon.focusEditor(editor);
|
|
2003
|
-
plateCommon.insertNodes(
|
|
2004
|
-
editor,
|
|
2005
|
-
[
|
|
2006
|
-
{
|
|
2007
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
2008
|
-
children: [{ text: "" }],
|
|
2009
|
-
lang: void 0,
|
|
2010
|
-
value: void 0
|
|
2011
|
-
}
|
|
2012
|
-
],
|
|
2013
|
-
// Insert a new node at the current path, resulting in the code_block
|
|
2014
|
-
// moving down one block
|
|
2015
|
-
{ at: path, select: true }
|
|
2016
|
-
);
|
|
2017
|
-
return;
|
|
2018
|
-
}
|
|
2019
|
-
plateCommon.focusEditor(editor, previousNodePath);
|
|
2020
|
-
}
|
|
2021
|
-
break;
|
|
2022
|
-
case "down": {
|
|
2023
|
-
const path = plateCommon.findNodePath(editor, element);
|
|
2024
|
-
if (!path) {
|
|
2025
|
-
return;
|
|
2026
|
-
}
|
|
2027
|
-
const nextNodePath = plateCommon.getPointAfter(editor, path);
|
|
2028
|
-
if (!nextNodePath) {
|
|
2029
|
-
plateCommon.insertNodes(
|
|
2030
|
-
editor,
|
|
2031
|
-
[
|
|
2032
|
-
{
|
|
2033
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
2034
|
-
children: [{ text: "" }],
|
|
2035
|
-
lang: void 0,
|
|
2036
|
-
value: void 0
|
|
2037
|
-
}
|
|
2038
|
-
],
|
|
2039
|
-
{ select: true }
|
|
2040
|
-
);
|
|
2041
|
-
plateCommon.focusEditor(editor);
|
|
2042
|
-
} else {
|
|
2043
|
-
plateCommon.focusEditor(editor, nextNodePath);
|
|
2044
|
-
}
|
|
2045
|
-
break;
|
|
2046
|
-
}
|
|
2451
|
+
);
|
|
2452
|
+
});
|
|
2453
|
+
const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
2454
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
2455
|
+
const DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
|
|
2456
|
+
const DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
|
|
2457
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
2458
|
+
const DropdownMenuSubTrigger = cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2459
|
+
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
2460
|
+
{
|
|
2461
|
+
className: cn$1.cn(
|
|
2462
|
+
"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",
|
|
2463
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2464
|
+
inset && "pl-8",
|
|
2465
|
+
className
|
|
2466
|
+
),
|
|
2467
|
+
ref,
|
|
2468
|
+
...props
|
|
2469
|
+
},
|
|
2470
|
+
children,
|
|
2471
|
+
/* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
|
|
2472
|
+
));
|
|
2473
|
+
const DropdownMenuSubContent = cn$1.withCn(
|
|
2474
|
+
DropdownMenuPrimitive__namespace.SubContent,
|
|
2475
|
+
"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"
|
|
2476
|
+
);
|
|
2477
|
+
const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
|
|
2478
|
+
className: cn$1.cn(
|
|
2479
|
+
"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"
|
|
2480
|
+
),
|
|
2481
|
+
sideOffset: 4
|
|
2482
|
+
});
|
|
2483
|
+
const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
|
|
2484
|
+
const menuItemVariants = classVarianceAuthority.cva(
|
|
2485
|
+
cn$1.cn(
|
|
2486
|
+
"relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
2487
|
+
"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
2488
|
+
),
|
|
2489
|
+
{
|
|
2490
|
+
variants: {
|
|
2491
|
+
inset: {
|
|
2492
|
+
true: "pl-8"
|
|
2047
2493
|
}
|
|
2048
2494
|
}
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2495
|
+
}
|
|
2496
|
+
);
|
|
2497
|
+
const DropdownMenuItem = cn$1.withVariants(
|
|
2498
|
+
DropdownMenuPrimitive__namespace.Item,
|
|
2499
|
+
menuItemVariants,
|
|
2500
|
+
["inset"]
|
|
2501
|
+
);
|
|
2502
|
+
const DropdownMenuCheckboxItem = cn$1.withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2503
|
+
DropdownMenuPrimitive__namespace.CheckboxItem,
|
|
2504
|
+
{
|
|
2505
|
+
className: cn$1.cn(
|
|
2506
|
+
"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",
|
|
2507
|
+
"cursor-pointer",
|
|
2508
|
+
className
|
|
2509
|
+
),
|
|
2510
|
+
ref,
|
|
2511
|
+
...props
|
|
2512
|
+
},
|
|
2513
|
+
/* @__PURE__ */ React.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
|
|
2514
|
+
children
|
|
2515
|
+
));
|
|
2516
|
+
const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2517
|
+
DropdownMenuPrimitive__namespace.RadioItem,
|
|
2518
|
+
{
|
|
2519
|
+
className: cn$1.cn(
|
|
2520
|
+
"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",
|
|
2521
|
+
"h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
|
|
2522
|
+
className
|
|
2523
|
+
),
|
|
2524
|
+
ref,
|
|
2525
|
+
...props
|
|
2526
|
+
},
|
|
2527
|
+
!hideIcon && /* @__PURE__ */ React.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
|
|
2528
|
+
children
|
|
2529
|
+
));
|
|
2530
|
+
const dropdownMenuLabelVariants = classVarianceAuthority.cva(
|
|
2531
|
+
cn$1.cn("select-none px-2 py-1.5 text-sm font-semibold"),
|
|
2532
|
+
{
|
|
2533
|
+
variants: {
|
|
2534
|
+
inset: {
|
|
2535
|
+
true: "pl-8"
|
|
2080
2536
|
}
|
|
2081
|
-
}
|
|
2537
|
+
}
|
|
2082
2538
|
}
|
|
2539
|
+
);
|
|
2540
|
+
const DropdownMenuLabel = cn$1.withVariants(
|
|
2541
|
+
DropdownMenuPrimitive__namespace.Label,
|
|
2542
|
+
dropdownMenuLabelVariants,
|
|
2543
|
+
["inset"]
|
|
2544
|
+
);
|
|
2545
|
+
const DropdownMenuSeparator = cn$1.withCn(
|
|
2546
|
+
DropdownMenuPrimitive__namespace.Separator,
|
|
2547
|
+
"-mx-1 my-1 h-px bg-muted"
|
|
2548
|
+
);
|
|
2549
|
+
cn$1.withCn(
|
|
2550
|
+
cn$1.createPrimitiveElement("span"),
|
|
2551
|
+
"ml-auto text-xs tracking-widest opacity-60"
|
|
2552
|
+
);
|
|
2553
|
+
const useOpenState = () => {
|
|
2554
|
+
const [open2, setOpen] = React.useState(false);
|
|
2555
|
+
const onOpenChange = React.useCallback(
|
|
2556
|
+
(_value = !open2) => {
|
|
2557
|
+
setOpen(_value);
|
|
2558
|
+
},
|
|
2559
|
+
[open2]
|
|
2560
|
+
);
|
|
2561
|
+
return {
|
|
2562
|
+
onOpenChange,
|
|
2563
|
+
open: open2
|
|
2564
|
+
};
|
|
2565
|
+
};
|
|
2566
|
+
const Popover$2 = PopoverPrimitive__namespace.Root;
|
|
2567
|
+
const popoverVariants = classVarianceAuthority.cva(
|
|
2568
|
+
"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"
|
|
2569
|
+
);
|
|
2570
|
+
const PopoverContent$1 = cn$1.withRef(
|
|
2571
|
+
({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
|
|
2572
|
+
PopoverPrimitive__namespace.Content,
|
|
2573
|
+
{
|
|
2574
|
+
align,
|
|
2575
|
+
className: cn$1.cn(popoverVariants(), className),
|
|
2576
|
+
ref,
|
|
2577
|
+
sideOffset,
|
|
2578
|
+
style: { zIndex: 1e3, ...style },
|
|
2579
|
+
...props
|
|
2580
|
+
}
|
|
2581
|
+
))
|
|
2582
|
+
);
|
|
2583
|
+
const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
|
|
2584
|
+
defaultVariants: {
|
|
2585
|
+
orientation: "horizontal"
|
|
2586
|
+
},
|
|
2587
|
+
variants: {
|
|
2588
|
+
orientation: {
|
|
2589
|
+
horizontal: "h-px w-full",
|
|
2590
|
+
vertical: "h-full w-px"
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
});
|
|
2594
|
+
const Separator = cn$1.withVariants(
|
|
2595
|
+
cn$1.withProps(SeparatorPrimitive__namespace.Root, {
|
|
2596
|
+
decorative: true,
|
|
2597
|
+
orientation: "horizontal"
|
|
2598
|
+
}),
|
|
2599
|
+
separatorVariants
|
|
2600
|
+
);
|
|
2601
|
+
const TableBordersDropdownMenuContent = cn$1.withRef((props, ref) => {
|
|
2602
|
+
const {
|
|
2603
|
+
getOnSelectTableBorder,
|
|
2604
|
+
hasBottomBorder,
|
|
2605
|
+
hasLeftBorder,
|
|
2606
|
+
hasNoBorders,
|
|
2607
|
+
hasOuterBorders,
|
|
2608
|
+
hasRightBorder,
|
|
2609
|
+
hasTopBorder
|
|
2610
|
+
} = plateTable.useTableBordersDropdownMenuContentState();
|
|
2083
2611
|
return /* @__PURE__ */ React.createElement(
|
|
2084
|
-
|
|
2612
|
+
DropdownMenuContent,
|
|
2085
2613
|
{
|
|
2086
|
-
|
|
2087
|
-
className: "
|
|
2614
|
+
align: "start",
|
|
2615
|
+
className: cn$1.cn("min-w-[220px]"),
|
|
2616
|
+
ref,
|
|
2617
|
+
side: "right",
|
|
2618
|
+
sideOffset: 0,
|
|
2619
|
+
...props
|
|
2088
2620
|
},
|
|
2089
|
-
/* @__PURE__ */ React.createElement(
|
|
2090
|
-
|
|
2091
|
-
visibility: hidden !important;
|
|
2092
|
-
}`),
|
|
2093
|
-
props.children,
|
|
2094
|
-
/* @__PURE__ */ React.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement(
|
|
2095
|
-
Autocomplete,
|
|
2621
|
+
/* @__PURE__ */ React.createElement(
|
|
2622
|
+
DropdownMenuCheckboxItem,
|
|
2096
2623
|
{
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
)
|
|
2103
|
-
|
|
2624
|
+
checked: hasBottomBorder,
|
|
2625
|
+
onCheckedChange: getOnSelectTableBorder("bottom")
|
|
2626
|
+
},
|
|
2627
|
+
/* @__PURE__ */ React.createElement(Icons.borderBottom, { className: iconVariants({ size: "sm" }) }),
|
|
2628
|
+
/* @__PURE__ */ React.createElement("div", null, "Bottom Border")
|
|
2629
|
+
),
|
|
2630
|
+
/* @__PURE__ */ React.createElement(
|
|
2631
|
+
DropdownMenuCheckboxItem,
|
|
2104
2632
|
{
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2633
|
+
checked: hasTopBorder,
|
|
2634
|
+
onCheckedChange: getOnSelectTableBorder("top")
|
|
2635
|
+
},
|
|
2636
|
+
/* @__PURE__ */ React.createElement(Icons.borderTop, { className: iconVariants({ size: "sm" }) }),
|
|
2637
|
+
/* @__PURE__ */ React.createElement("div", null, "Top Border")
|
|
2638
|
+
),
|
|
2639
|
+
/* @__PURE__ */ React.createElement(
|
|
2640
|
+
DropdownMenuCheckboxItem,
|
|
2641
|
+
{
|
|
2642
|
+
checked: hasLeftBorder,
|
|
2643
|
+
onCheckedChange: getOnSelectTableBorder("left")
|
|
2644
|
+
},
|
|
2645
|
+
/* @__PURE__ */ React.createElement(Icons.borderLeft, { className: iconVariants({ size: "sm" }) }),
|
|
2646
|
+
/* @__PURE__ */ React.createElement("div", null, "Left Border")
|
|
2647
|
+
),
|
|
2648
|
+
/* @__PURE__ */ React.createElement(
|
|
2649
|
+
DropdownMenuCheckboxItem,
|
|
2650
|
+
{
|
|
2651
|
+
checked: hasRightBorder,
|
|
2652
|
+
onCheckedChange: getOnSelectTableBorder("right")
|
|
2653
|
+
},
|
|
2654
|
+
/* @__PURE__ */ React.createElement(Icons.borderRight, { className: iconVariants({ size: "sm" }) }),
|
|
2655
|
+
/* @__PURE__ */ React.createElement("div", null, "Right Border")
|
|
2656
|
+
),
|
|
2657
|
+
/* @__PURE__ */ React.createElement(Separator, null),
|
|
2658
|
+
/* @__PURE__ */ React.createElement(
|
|
2659
|
+
DropdownMenuCheckboxItem,
|
|
2660
|
+
{
|
|
2661
|
+
checked: hasNoBorders,
|
|
2662
|
+
onCheckedChange: getOnSelectTableBorder("none")
|
|
2663
|
+
},
|
|
2664
|
+
/* @__PURE__ */ React.createElement(Icons.borderNone, { className: iconVariants({ size: "sm" }) }),
|
|
2665
|
+
/* @__PURE__ */ React.createElement("div", null, "No Border")
|
|
2666
|
+
),
|
|
2667
|
+
/* @__PURE__ */ React.createElement(
|
|
2668
|
+
DropdownMenuCheckboxItem,
|
|
2669
|
+
{
|
|
2670
|
+
checked: hasOuterBorders,
|
|
2671
|
+
onCheckedChange: getOnSelectTableBorder("outer")
|
|
2672
|
+
},
|
|
2673
|
+
/* @__PURE__ */ React.createElement(Icons.borderAll, { className: iconVariants({ size: "sm" }) }),
|
|
2674
|
+
/* @__PURE__ */ React.createElement("div", null, "Outside Borders")
|
|
2675
|
+
)
|
|
2141
2676
|
);
|
|
2142
|
-
};
|
|
2143
|
-
const
|
|
2144
|
-
({
|
|
2145
|
-
const
|
|
2146
|
-
const
|
|
2147
|
-
|
|
2148
|
-
plateCommon.
|
|
2677
|
+
});
|
|
2678
|
+
const TableFloatingToolbar = cn$1.withRef(
|
|
2679
|
+
({ children, ...props }, ref) => {
|
|
2680
|
+
const element = plateCommon.useElement();
|
|
2681
|
+
const { props: buttonProps } = plateCommon.useRemoveNodeButton({ element });
|
|
2682
|
+
const selectionCollapsed = plateCommon.useEditorSelector(
|
|
2683
|
+
(editor2) => !plateCommon.isSelectionExpanded(editor2),
|
|
2684
|
+
[]
|
|
2685
|
+
);
|
|
2686
|
+
const readOnly = slateReact.useReadOnly();
|
|
2687
|
+
const selected = slateReact.useSelected();
|
|
2688
|
+
const editor = plateCommon.useEditorRef();
|
|
2689
|
+
const collapsed = !readOnly && selected && selectionCollapsed;
|
|
2690
|
+
const open2 = !readOnly && selected;
|
|
2691
|
+
const { canMerge, canUnmerge } = plateTable.useTableMergeState();
|
|
2692
|
+
const mergeContent = canMerge && /* @__PURE__ */ React.createElement(
|
|
2693
|
+
Button$2,
|
|
2149
2694
|
{
|
|
2150
|
-
|
|
2695
|
+
contentEditable: false,
|
|
2696
|
+
isMenu: true,
|
|
2697
|
+
onClick: () => plateTable.mergeTableCells(editor),
|
|
2698
|
+
variant: "ghost"
|
|
2699
|
+
},
|
|
2700
|
+
/* @__PURE__ */ React.createElement(Icons.combine, { className: "mr-2 size-4" }),
|
|
2701
|
+
"Merge"
|
|
2702
|
+
);
|
|
2703
|
+
const unmergeButton = canUnmerge && /* @__PURE__ */ React.createElement(
|
|
2704
|
+
Button$2,
|
|
2705
|
+
{
|
|
2706
|
+
contentEditable: false,
|
|
2707
|
+
isMenu: true,
|
|
2708
|
+
onClick: () => plateTable.unmergeTableCells(editor),
|
|
2709
|
+
variant: "ghost"
|
|
2710
|
+
},
|
|
2711
|
+
/* @__PURE__ */ React.createElement(Icons.ungroup, { className: "mr-2 size-4" }),
|
|
2712
|
+
"Unmerge"
|
|
2713
|
+
);
|
|
2714
|
+
const bordersContent = collapsed && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(Button$2, { isMenu: true, variant: "ghost" }, /* @__PURE__ */ React.createElement(Icons.borderAll, { className: "mr-2 size-4" }), "Borders")), /* @__PURE__ */ React.createElement(DropdownMenuPortal, null, /* @__PURE__ */ React.createElement(TableBordersDropdownMenuContent, null))), /* @__PURE__ */ React.createElement(Button$2, { contentEditable: false, isMenu: true, variant: "ghost", ...buttonProps }, /* @__PURE__ */ React.createElement(Icons.delete, { className: "mr-2 size-4" }), "Delete"));
|
|
2715
|
+
return /* @__PURE__ */ React.createElement(Popover$2, { modal: false, open: open2 }, /* @__PURE__ */ React.createElement(PopoverPrimitive.PopoverAnchor, { asChild: true }, children), (canMerge || canUnmerge || collapsed) && /* @__PURE__ */ React.createElement(
|
|
2716
|
+
PopoverContent$1,
|
|
2717
|
+
{
|
|
2718
|
+
className: cn$1.cn(
|
|
2719
|
+
popoverVariants(),
|
|
2720
|
+
"flex w-[220px] flex-col gap-1 p-1"
|
|
2721
|
+
),
|
|
2722
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2151
2723
|
ref,
|
|
2152
2724
|
...props
|
|
2153
2725
|
},
|
|
2154
|
-
|
|
2155
|
-
|
|
2726
|
+
unmergeButton,
|
|
2727
|
+
mergeContent,
|
|
2728
|
+
bordersContent
|
|
2729
|
+
));
|
|
2156
2730
|
}
|
|
2157
2731
|
);
|
|
2732
|
+
const TableElement = plateCommon.withHOC(
|
|
2733
|
+
plateTable.TableProvider,
|
|
2734
|
+
cn$1.withRef(({ children, className, ...props }, ref) => {
|
|
2735
|
+
const { colSizes, isSelectingCell, marginLeft, minColumnWidth } = plateTable.useTableElementState();
|
|
2736
|
+
const { colGroupProps, props: tableProps } = plateTable.useTableElement();
|
|
2737
|
+
return /* @__PURE__ */ React.createElement(TableFloatingToolbar, null, /* @__PURE__ */ React.createElement("div", { style: { paddingLeft: marginLeft } }, /* @__PURE__ */ React.createElement(
|
|
2738
|
+
plateCommon.PlateElement,
|
|
2739
|
+
{
|
|
2740
|
+
asChild: true,
|
|
2741
|
+
className: cn$1.cn(
|
|
2742
|
+
"my-4 ml-px mr-0 table h-px w-full table-fixed border-collapse",
|
|
2743
|
+
isSelectingCell && "[&_*::selection]:bg-none",
|
|
2744
|
+
className
|
|
2745
|
+
),
|
|
2746
|
+
ref,
|
|
2747
|
+
...tableProps,
|
|
2748
|
+
...props
|
|
2749
|
+
},
|
|
2750
|
+
/* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("colgroup", { ...colGroupProps }, colSizes.map((width, index) => /* @__PURE__ */ React.createElement(
|
|
2751
|
+
"col",
|
|
2752
|
+
{
|
|
2753
|
+
key: index,
|
|
2754
|
+
style: {
|
|
2755
|
+
minWidth: minColumnWidth,
|
|
2756
|
+
width: width || void 0
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
))), /* @__PURE__ */ React.createElement("tbody", { className: "min-w-full" }, children))
|
|
2760
|
+
)));
|
|
2761
|
+
})
|
|
2762
|
+
);
|
|
2763
|
+
const TableRowElement = cn$1.withRef(({ children, hideBorder, ...props }, ref) => {
|
|
2764
|
+
return /* @__PURE__ */ React.createElement(
|
|
2765
|
+
plateCommon.PlateElement,
|
|
2766
|
+
{
|
|
2767
|
+
asChild: true,
|
|
2768
|
+
className: cn$1.cn("h-full", hideBorder && "border-none"),
|
|
2769
|
+
ref,
|
|
2770
|
+
...props
|
|
2771
|
+
},
|
|
2772
|
+
/* @__PURE__ */ React.createElement("tr", null, children)
|
|
2773
|
+
);
|
|
2774
|
+
});
|
|
2158
2775
|
const blockClasses = "mt-0.5";
|
|
2159
2776
|
const headerClasses = "font-normal";
|
|
2160
2777
|
const Components = () => {
|
|
@@ -2260,6 +2877,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2260
2877
|
}
|
|
2261
2878
|
)
|
|
2262
2879
|
),
|
|
2880
|
+
[ELEMENT_MERMAID]: MermaidElement,
|
|
2263
2881
|
[plate.ELEMENT_BLOCKQUOTE]: BlockquoteElement,
|
|
2264
2882
|
[plate.ELEMENT_CODE_BLOCK]: CodeBlockElement,
|
|
2265
2883
|
[plate.ELEMENT_CODE_LINE]: CodeLineElement,
|
|
@@ -2340,7 +2958,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2340
2958
|
children,
|
|
2341
2959
|
selected && /* @__PURE__ */ React.createElement("span", { className: "absolute h-4 -top-2 inset-0 ring-2 ring-blue-100 ring-inset rounded-md z-10 pointer-events-none" })
|
|
2342
2960
|
);
|
|
2343
|
-
}
|
|
2961
|
+
},
|
|
2962
|
+
[plate.ELEMENT_TABLE]: TableElement,
|
|
2963
|
+
[plate.ELEMENT_TR]: TableRowElement,
|
|
2964
|
+
[plate.ELEMENT_TD]: TableCellElement,
|
|
2965
|
+
[plate.ELEMENT_TH]: TableCellHeaderElement
|
|
2344
2966
|
};
|
|
2345
2967
|
};
|
|
2346
2968
|
const createCodeBlockPlugin = plateCommon.createPluginFactory({
|
|
@@ -2750,7 +3372,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2750
3372
|
{
|
|
2751
3373
|
type: "string",
|
|
2752
3374
|
label: "Caption",
|
|
2753
|
-
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
3375
|
+
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
3376
|
+
"."
|
|
3377
|
+
),
|
|
2754
3378
|
component: "text"
|
|
2755
3379
|
}
|
|
2756
3380
|
]
|
|
@@ -3068,7 +3692,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3068
3692
|
};
|
|
3069
3693
|
const sizeClasses = {
|
|
3070
3694
|
small: `text-xs h-8 px-3`,
|
|
3071
|
-
medium: `text-sm h-10 px-
|
|
3695
|
+
medium: `text-sm h-10 px-8`,
|
|
3072
3696
|
custom: ``
|
|
3073
3697
|
};
|
|
3074
3698
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -4410,7 +5034,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4410
5034
|
function cn(...inputs) {
|
|
4411
5035
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
4412
5036
|
}
|
|
4413
|
-
const buttonVariants
|
|
5037
|
+
const buttonVariants = classVarianceAuthority.cva(
|
|
4414
5038
|
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
4415
5039
|
{
|
|
4416
5040
|
variants: {
|
|
@@ -4436,7 +5060,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4436
5060
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
4437
5061
|
Comp,
|
|
4438
5062
|
{
|
|
4439
|
-
className: cn(buttonVariants
|
|
5063
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
4440
5064
|
ref,
|
|
4441
5065
|
...props
|
|
4442
5066
|
}
|
|
@@ -5102,10 +5726,11 @@ var __publicField = (obj, key, value) => {
|
|
|
5102
5726
|
return /* @__PURE__ */ React.createElement(
|
|
5103
5727
|
"button",
|
|
5104
5728
|
{
|
|
5105
|
-
|
|
5729
|
+
type: "button",
|
|
5730
|
+
className: `w-8 px-1 py-2.5 flex items-center justify-center text-gray-200 hover:opacity-100 opacity-30 hover:bg-gray-50 ${disabled && "pointer-events-none opacity-30 cursor-not-allowed"}`,
|
|
5106
5731
|
onClick
|
|
5107
5732
|
},
|
|
5108
|
-
/* @__PURE__ */ React.createElement(TrashIcon, { className: "fill-current transition-colors ease-out
|
|
5733
|
+
/* @__PURE__ */ React.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
|
|
5109
5734
|
);
|
|
5110
5735
|
};
|
|
5111
5736
|
const DragHandle = ({ isDragging }) => {
|
|
@@ -5135,7 +5760,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5135
5760
|
return template.label ? template.label.toLowerCase().includes(filter.toLowerCase()) || name.toLowerCase().includes(filter.toLowerCase()) : name.toLowerCase().includes(filter.toLowerCase());
|
|
5136
5761
|
});
|
|
5137
5762
|
}, [filter]);
|
|
5138
|
-
return /* @__PURE__ */ React__namespace.createElement(react
|
|
5763
|
+
return /* @__PURE__ */ React__namespace.createElement(react.Popover, null, ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(react.PopoverButton, { as: "span" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5139
5764
|
IconButton,
|
|
5140
5765
|
{
|
|
5141
5766
|
variant: open2 ? "secondary" : "primary",
|
|
@@ -5144,7 +5769,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5144
5769
|
},
|
|
5145
5770
|
/* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
|
|
5146
5771
|
)), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute -bottom-1 right-0 z-50" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5147
|
-
react
|
|
5772
|
+
react.Transition,
|
|
5148
5773
|
{
|
|
5149
5774
|
enter: "transition duration-150 ease-out",
|
|
5150
5775
|
enterFrom: "transform opacity-0 -translate-y-2",
|
|
@@ -5153,7 +5778,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5153
5778
|
leaveFrom: "transform opacity-100 translate-y-0",
|
|
5154
5779
|
leaveTo: "transform opacity-0 -translate-y-2"
|
|
5155
5780
|
},
|
|
5156
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
5781
|
+
/* @__PURE__ */ React__namespace.createElement(react.PopoverPanel, { className: "relative overflow-hidden rounded-lg shadow-lg bg-white border border-gray-100" }, ({ close: close2 }) => /* @__PURE__ */ React__namespace.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto flex flex-col w-full h-full" }, showFilter && /* @__PURE__ */ React__namespace.createElement("div", { className: "sticky top-0 bg-gray-50 p-2 border-b border-gray-100 z-10" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5157
5782
|
"input",
|
|
5158
5783
|
{
|
|
5159
5784
|
type: "text",
|
|
@@ -5183,27 +5808,35 @@ var __publicField = (obj, key, value) => {
|
|
|
5183
5808
|
))))
|
|
5184
5809
|
))));
|
|
5185
5810
|
};
|
|
5186
|
-
const Group =
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5811
|
+
const Group = wrapFieldWithNoHeader(
|
|
5812
|
+
({ tinaForm, field }) => {
|
|
5813
|
+
const cms = useCMS$1();
|
|
5814
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5815
|
+
Header,
|
|
5816
|
+
{
|
|
5817
|
+
onClick: () => {
|
|
5818
|
+
const state = tinaForm.finalForm.getState();
|
|
5819
|
+
if (state.invalid === true) {
|
|
5820
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
5821
|
+
return;
|
|
5822
|
+
}
|
|
5823
|
+
cms.dispatch({
|
|
5824
|
+
type: "forms:set-active-field-name",
|
|
5825
|
+
value: { formId: tinaForm.id, fieldName: field.name }
|
|
5826
|
+
});
|
|
5197
5827
|
}
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5828
|
+
},
|
|
5829
|
+
field.label || field.name,
|
|
5830
|
+
field.description && /* @__PURE__ */ React__namespace.createElement(
|
|
5831
|
+
"span",
|
|
5832
|
+
{
|
|
5833
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
|
|
5834
|
+
dangerouslySetInnerHTML: { __html: field.description }
|
|
5835
|
+
}
|
|
5836
|
+
)
|
|
5837
|
+
));
|
|
5838
|
+
}
|
|
5839
|
+
);
|
|
5207
5840
|
const Header = ({ onClick, children }) => {
|
|
5208
5841
|
return /* @__PURE__ */ React__namespace.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5209
5842
|
"button",
|
|
@@ -5330,8 +5963,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5330
5963
|
onClick: () => setPickerIsOpen(!pickerIsOpen)
|
|
5331
5964
|
},
|
|
5332
5965
|
/* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
|
|
5333
|
-
), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react
|
|
5334
|
-
react
|
|
5966
|
+
), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: pickerIsOpen }, /* @__PURE__ */ React__namespace.createElement(
|
|
5967
|
+
react.TransitionChild,
|
|
5335
5968
|
{
|
|
5336
5969
|
enter: "transform transition-all ease-out duration-200",
|
|
5337
5970
|
enterFrom: "opacity-0 -translate-x-1/2",
|
|
@@ -5418,14 +6051,14 @@ var __publicField = (obj, key, value) => {
|
|
|
5418
6051
|
};
|
|
5419
6052
|
const BlockGroup = ({ category, templates, close: close2, isLast = false }) => {
|
|
5420
6053
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
5421
|
-
react
|
|
6054
|
+
react.Disclosure,
|
|
5422
6055
|
{
|
|
5423
6056
|
defaultOpen: true,
|
|
5424
6057
|
as: "div",
|
|
5425
6058
|
className: `left-0 right-0 relative`
|
|
5426
6059
|
},
|
|
5427
6060
|
({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5428
|
-
react
|
|
6061
|
+
react.DisclosureButton,
|
|
5429
6062
|
{
|
|
5430
6063
|
className: `relative block group text-left w-full text-base font-bold tracking-wide py-2 truncate ${templates.length === 0 ? `pointer-events-none` : ``} ${!isLast && (!open2 || templates.length === 0) && `border-b border-gray-100`}`
|
|
5431
6064
|
},
|
|
@@ -5443,7 +6076,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5443
6076
|
}
|
|
5444
6077
|
)
|
|
5445
6078
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
5446
|
-
react
|
|
6079
|
+
react.Transition,
|
|
5447
6080
|
{
|
|
5448
6081
|
enter: "transition duration-100 ease-out",
|
|
5449
6082
|
enterFrom: "transform scale-95 opacity-0",
|
|
@@ -5452,7 +6085,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5452
6085
|
leaveFrom: "transform scale-100 opacity-100",
|
|
5453
6086
|
leaveTo: "transform scale-95 opacity-0"
|
|
5454
6087
|
},
|
|
5455
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
6088
|
+
/* @__PURE__ */ React__namespace.createElement(react.DisclosurePanel, null, templates.length > 0 && /* @__PURE__ */ React__namespace.createElement(CardColumns, null, templates.map(([name, template], index) => /* @__PURE__ */ React__namespace.createElement(
|
|
5456
6089
|
BlockCard,
|
|
5457
6090
|
{
|
|
5458
6091
|
key: index,
|
|
@@ -9271,7 +9904,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9271
9904
|
const FormLists = (props) => {
|
|
9272
9905
|
const cms = useCMS();
|
|
9273
9906
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
9274
|
-
react
|
|
9907
|
+
react.Transition,
|
|
9275
9908
|
{
|
|
9276
9909
|
appear: true,
|
|
9277
9910
|
show: true,
|
|
@@ -9700,7 +10333,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9700
10333
|
"Event Log"
|
|
9701
10334
|
));
|
|
9702
10335
|
};
|
|
9703
|
-
const version = "2.
|
|
10336
|
+
const version = "2.4.0";
|
|
9704
10337
|
const Nav = ({
|
|
9705
10338
|
isLocalMode,
|
|
9706
10339
|
className = "",
|
|
@@ -9754,8 +10387,8 @@ var __publicField = (obj, key, value) => {
|
|
|
9754
10387
|
style: { maxWidth: `${sidebarWidth}px` },
|
|
9755
10388
|
...props
|
|
9756
10389
|
},
|
|
9757
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "border-b border-gray-200" }, /* @__PURE__ */ React__namespace.createElement(react
|
|
9758
|
-
react
|
|
10390
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "border-b border-gray-200" }, /* @__PURE__ */ React__namespace.createElement(react.Menu, { as: "div", className: "relative block" }, ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement(
|
|
10391
|
+
react.MenuButton,
|
|
9759
10392
|
{
|
|
9760
10393
|
className: `group w-full px-6 py-3 gap-2 flex justify-between items-center transition-colors duration-150 ease-out ${open2 ? "bg-gray-50" : "bg-transparent"}`
|
|
9761
10394
|
},
|
|
@@ -9778,7 +10411,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9778
10411
|
}
|
|
9779
10412
|
)
|
|
9780
10413
|
), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute bottom-3 right-5 z-50" }, /* @__PURE__ */ React__namespace.createElement(
|
|
9781
|
-
react
|
|
10414
|
+
react.Transition,
|
|
9782
10415
|
{
|
|
9783
10416
|
enter: "transition duration-150 ease-out",
|
|
9784
10417
|
enterFrom: "transform opacity-0 -translate-y-2",
|
|
@@ -9787,7 +10420,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9787
10420
|
leaveFrom: "transform opacity-100 translate-y-0",
|
|
9788
10421
|
leaveTo: "transform opacity-0 -translate-y-2"
|
|
9789
10422
|
},
|
|
9790
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
10423
|
+
/* @__PURE__ */ React__namespace.createElement(react.MenuItems, { className: "bg-white border border-gray-150 rounded-lg shadow-lg flex flex-col items-stretch overflow-hidden" }, /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
|
|
9791
10424
|
"button",
|
|
9792
10425
|
{
|
|
9793
10426
|
className: `text-lg px-4 py-2 first:pt-3 last:pb-3 tracking-wide whitespace-nowrap flex items-center opacity-80 text-gray-600 hover:text-blue-400 hover:bg-gray-50 hover:opacity-100`,
|
|
@@ -9820,7 +10453,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9820
10453
|
},
|
|
9821
10454
|
/* @__PURE__ */ React__namespace.createElement(BiExit, { className: "w-6 h-auto mr-2 text-blue-400" }),
|
|
9822
10455
|
" Log Out"
|
|
9823
|
-
)), /* @__PURE__ */ React__namespace.createElement(react
|
|
10456
|
+
)), /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
|
|
9824
10457
|
WrappedSyncStatus,
|
|
9825
10458
|
{
|
|
9826
10459
|
cms,
|
|
@@ -10166,8 +10799,8 @@ var __publicField = (obj, key, value) => {
|
|
|
10166
10799
|
screen: activeScreen,
|
|
10167
10800
|
close: () => setActiveView(null)
|
|
10168
10801
|
}
|
|
10169
|
-
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react
|
|
10170
|
-
react
|
|
10802
|
+
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10803
|
+
react.TransitionChild,
|
|
10171
10804
|
{
|
|
10172
10805
|
enter: "transform transition-all ease-out duration-300",
|
|
10173
10806
|
enterFrom: "opacity-0 -translate-x-full",
|
|
@@ -10232,7 +10865,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10232
10865
|
))
|
|
10233
10866
|
))
|
|
10234
10867
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
10235
|
-
react
|
|
10868
|
+
react.TransitionChild,
|
|
10236
10869
|
{
|
|
10237
10870
|
enter: "ease-out duration-300",
|
|
10238
10871
|
enterFrom: "opacity-0",
|
|
@@ -12231,15 +12864,14 @@ var __publicField = (obj, key, value) => {
|
|
|
12231
12864
|
fields: fieldGroup.fields
|
|
12232
12865
|
}
|
|
12233
12866
|
) : /* @__PURE__ */ React__namespace.createElement(NoFieldsPlaceholder, null)
|
|
12234
|
-
)), !hideFooter && /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12867
|
+
)), !hideFooter && /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-none w-full h-16 px-12 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React__namespace.createElement(
|
|
12235
12868
|
ResetForm,
|
|
12236
12869
|
{
|
|
12237
12870
|
pristine,
|
|
12238
12871
|
reset: async () => {
|
|
12239
12872
|
finalForm2.reset();
|
|
12240
12873
|
await tinaForm.reset();
|
|
12241
|
-
}
|
|
12242
|
-
style: { flexGrow: 1 }
|
|
12874
|
+
}
|
|
12243
12875
|
},
|
|
12244
12876
|
tinaForm.buttons.reset
|
|
12245
12877
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -12248,8 +12880,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12248
12880
|
onClick: safeHandleSubmit,
|
|
12249
12881
|
disabled: !canSubmit,
|
|
12250
12882
|
busy: submitting,
|
|
12251
|
-
variant: "primary"
|
|
12252
|
-
style: { flexGrow: 3 }
|
|
12883
|
+
variant: "primary"
|
|
12253
12884
|
},
|
|
12254
12885
|
submitting && /* @__PURE__ */ React__namespace.createElement(LoadingDots, null),
|
|
12255
12886
|
!submitting && tinaForm.buttons.save
|
|
@@ -12767,15 +13398,15 @@ var __publicField = (obj, key, value) => {
|
|
|
12767
13398
|
);
|
|
12768
13399
|
};
|
|
12769
13400
|
const DotMenu = ({ onOpen, onRemove }) => {
|
|
12770
|
-
return /* @__PURE__ */ React.createElement(react
|
|
12771
|
-
react
|
|
13401
|
+
return /* @__PURE__ */ React.createElement(react.Popover, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React.createElement(
|
|
13402
|
+
react.PopoverButton,
|
|
12772
13403
|
{
|
|
12773
13404
|
as: "span",
|
|
12774
13405
|
className: "cursor-pointer h-full relative inline-flex items-center px-1 py-0.5 rounded-r-md border border-gray-200 bg-white text-gray-500 hover:bg-gray-50 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500"
|
|
12775
13406
|
},
|
|
12776
13407
|
/* @__PURE__ */ React.createElement(EllipsisIcon, { title: "Open options" })
|
|
12777
13408
|
), /* @__PURE__ */ React.createElement(
|
|
12778
|
-
react
|
|
13409
|
+
react.Transition,
|
|
12779
13410
|
{
|
|
12780
13411
|
enter: "transition ease-out duration-100",
|
|
12781
13412
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -12784,7 +13415,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12784
13415
|
leaveFrom: "transform opacity-100 scale-100",
|
|
12785
13416
|
leaveTo: "transform opacity-0 scale-95"
|
|
12786
13417
|
},
|
|
12787
|
-
/* @__PURE__ */ React.createElement(react
|
|
13418
|
+
/* @__PURE__ */ React.createElement(react.PopoverPanel, { className: "z-30 absolute origin-top-right right-0" }, /* @__PURE__ */ React.createElement("div", { className: "mt-2 -mr-1 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React.createElement("div", { className: "py-1" }, /* @__PURE__ */ React.createElement(
|
|
12788
13419
|
"span",
|
|
12789
13420
|
{
|
|
12790
13421
|
onClick: onOpen,
|
|
@@ -13207,13 +13838,26 @@ var __publicField = (obj, key, value) => {
|
|
|
13207
13838
|
plate.createUnderlinePlugin(),
|
|
13208
13839
|
plate.createCodePlugin(),
|
|
13209
13840
|
plate.createListPlugin(),
|
|
13210
|
-
plate.createIndentPlugin(),
|
|
13211
13841
|
plate.createIndentListPlugin(),
|
|
13212
13842
|
plate.createHorizontalRulePlugin(),
|
|
13213
13843
|
// Allows us to do things like copy/paste, remembering the state of the element (like mdx)
|
|
13214
13844
|
plate.createNodeIdPlugin(),
|
|
13215
|
-
plateSlashCommand.createSlashPlugin()
|
|
13845
|
+
plateSlashCommand.createSlashPlugin(),
|
|
13846
|
+
plate.createTablePlugin()
|
|
13216
13847
|
];
|
|
13848
|
+
const unsupportedItemsInTable = /* @__PURE__ */ new Set([
|
|
13849
|
+
"Code Block",
|
|
13850
|
+
"Unordered List",
|
|
13851
|
+
"Ordered List",
|
|
13852
|
+
"Quote",
|
|
13853
|
+
"Mermaid",
|
|
13854
|
+
"Heading 1",
|
|
13855
|
+
"Heading 2",
|
|
13856
|
+
"Heading 3",
|
|
13857
|
+
"Heading 4",
|
|
13858
|
+
"Heading 5",
|
|
13859
|
+
"Heading 6"
|
|
13860
|
+
]);
|
|
13217
13861
|
const isNodeActive = (editor, type) => {
|
|
13218
13862
|
const pluginType = plateCommon.getPluginType(editor, type);
|
|
13219
13863
|
return !!(editor == null ? void 0 : editor.selection) && plateCommon.someNode(editor, { match: { type: pluginType } });
|
|
@@ -13398,24 +14042,6 @@ var __publicField = (obj, key, value) => {
|
|
|
13398
14042
|
}
|
|
13399
14043
|
);
|
|
13400
14044
|
Editor.displayName = "Editor";
|
|
13401
|
-
const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
|
|
13402
|
-
defaultVariants: {
|
|
13403
|
-
orientation: "horizontal"
|
|
13404
|
-
},
|
|
13405
|
-
variants: {
|
|
13406
|
-
orientation: {
|
|
13407
|
-
horizontal: "h-px w-full",
|
|
13408
|
-
vertical: "h-full w-px"
|
|
13409
|
-
}
|
|
13410
|
-
}
|
|
13411
|
-
});
|
|
13412
|
-
const Separator = cn$1.withVariants(
|
|
13413
|
-
cn$1.withProps(SeparatorPrimitive__namespace.Root, {
|
|
13414
|
-
decorative: true,
|
|
13415
|
-
orientation: "horizontal"
|
|
13416
|
-
}),
|
|
13417
|
-
separatorVariants
|
|
13418
|
-
);
|
|
13419
14045
|
const TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
13420
14046
|
const Tooltip = TooltipPrimitive__namespace.Root;
|
|
13421
14047
|
const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
@@ -13424,7 +14050,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13424
14050
|
cn$1.withProps(TooltipPrimitive__namespace.Content, {
|
|
13425
14051
|
sideOffset: 4
|
|
13426
14052
|
}),
|
|
13427
|
-
"z-
|
|
14053
|
+
"z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
|
|
13428
14054
|
);
|
|
13429
14055
|
function withTooltip(Component) {
|
|
13430
14056
|
return React.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
|
|
@@ -13550,140 +14176,41 @@ var __publicField = (obj, key, value) => {
|
|
|
13550
14176
|
Toolbar,
|
|
13551
14177
|
"p-1 sticky left-0 top-0 z-50 w-full justify-between overflow-x-auto border border-border bg-background"
|
|
13552
14178
|
);
|
|
13553
|
-
const
|
|
13554
|
-
|
|
13555
|
-
|
|
13556
|
-
|
|
13557
|
-
|
|
13558
|
-
const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
|
|
13559
|
-
const editor = plateCommon.useEditorState();
|
|
13560
|
-
const state = plate.useListToolbarButtonState({ nodeType });
|
|
13561
|
-
const { props } = plate.useListToolbarButton(state);
|
|
13562
|
-
return /* @__PURE__ */ React.createElement(
|
|
13563
|
-
ToolbarButton,
|
|
13564
|
-
{
|
|
13565
|
-
ref,
|
|
13566
|
-
tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
13567
|
-
...props,
|
|
13568
|
-
onClick: (e) => {
|
|
13569
|
-
e.preventDefault();
|
|
13570
|
-
e.stopPropagation();
|
|
13571
|
-
plate.toggleList(editor, { type: nodeType });
|
|
13572
|
-
}
|
|
13573
|
-
},
|
|
13574
|
-
nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
|
|
13575
|
-
);
|
|
13576
|
-
});
|
|
13577
|
-
const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
13578
|
-
const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
13579
|
-
const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
13580
|
-
cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
13581
|
-
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
13582
|
-
{
|
|
13583
|
-
className: cn$1.cn(
|
|
13584
|
-
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
13585
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
13586
|
-
inset && "pl-8",
|
|
13587
|
-
className
|
|
13588
|
-
),
|
|
13589
|
-
ref,
|
|
13590
|
-
...props
|
|
13591
|
-
},
|
|
13592
|
-
children,
|
|
13593
|
-
/* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
|
|
13594
|
-
));
|
|
13595
|
-
cn$1.withCn(
|
|
13596
|
-
DropdownMenuPrimitive__namespace.SubContent,
|
|
13597
|
-
"z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
|
|
13598
|
-
);
|
|
13599
|
-
const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
|
|
13600
|
-
className: cn$1.cn(
|
|
13601
|
-
"z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
|
|
13602
|
-
),
|
|
13603
|
-
sideOffset: 4
|
|
13604
|
-
});
|
|
13605
|
-
const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
|
|
13606
|
-
const menuItemVariants = classVarianceAuthority.cva(
|
|
13607
|
-
cn$1.cn(
|
|
13608
|
-
"relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
13609
|
-
"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
13610
|
-
),
|
|
13611
|
-
{
|
|
13612
|
-
variants: {
|
|
13613
|
-
inset: {
|
|
13614
|
-
true: "pl-8"
|
|
14179
|
+
const useResize = (ref, callback) => {
|
|
14180
|
+
React.useEffect(() => {
|
|
14181
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
14182
|
+
for (const entry of entries) {
|
|
14183
|
+
callback(entry);
|
|
13615
14184
|
}
|
|
14185
|
+
});
|
|
14186
|
+
if (ref.current) {
|
|
14187
|
+
resizeObserver.observe(ref.current);
|
|
13616
14188
|
}
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
ref,
|
|
13633
|
-
...props
|
|
13634
|
-
},
|
|
13635
|
-
/* @__PURE__ */ React.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
|
|
13636
|
-
children
|
|
13637
|
-
));
|
|
13638
|
-
const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
13639
|
-
DropdownMenuPrimitive__namespace.RadioItem,
|
|
13640
|
-
{
|
|
13641
|
-
className: cn$1.cn(
|
|
13642
|
-
"relative flex select-none items-center rounded-sm pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
13643
|
-
"h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
|
|
13644
|
-
className
|
|
13645
|
-
),
|
|
13646
|
-
ref,
|
|
13647
|
-
...props
|
|
13648
|
-
},
|
|
13649
|
-
!hideIcon && /* @__PURE__ */ React.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
|
|
14189
|
+
return () => resizeObserver.disconnect();
|
|
14190
|
+
}, [ref.current]);
|
|
14191
|
+
};
|
|
14192
|
+
const STANDARD_ICON_WIDTH = 32;
|
|
14193
|
+
const HEADING_ICON_WITH_TEXT = 127;
|
|
14194
|
+
const HEADING_ICON_ONLY = 58;
|
|
14195
|
+
const EMBED_ICON_WIDTH = 78;
|
|
14196
|
+
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14197
|
+
const FLOAT_BUTTON_WIDTH = 25;
|
|
14198
|
+
const HEADING_LABEL = "Headings";
|
|
14199
|
+
const ToolbarContext = React.createContext(void 0);
|
|
14200
|
+
const ToolbarProvider = ({
|
|
14201
|
+
tinaForm,
|
|
14202
|
+
templates,
|
|
14203
|
+
overrides,
|
|
13650
14204
|
children
|
|
13651
|
-
)
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13656
|
-
|
|
13657
|
-
|
|
13658
|
-
}
|
|
13659
|
-
}
|
|
14205
|
+
}) => {
|
|
14206
|
+
return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
|
|
14207
|
+
};
|
|
14208
|
+
const useToolbarContext = () => {
|
|
14209
|
+
const context = React.useContext(ToolbarContext);
|
|
14210
|
+
if (!context) {
|
|
14211
|
+
throw new Error("useToolbarContext must be used within a ToolbarProvider");
|
|
13660
14212
|
}
|
|
13661
|
-
|
|
13662
|
-
const DropdownMenuLabel = cn$1.withVariants(
|
|
13663
|
-
DropdownMenuPrimitive__namespace.Label,
|
|
13664
|
-
dropdownMenuLabelVariants,
|
|
13665
|
-
["inset"]
|
|
13666
|
-
);
|
|
13667
|
-
const DropdownMenuSeparator = cn$1.withCn(
|
|
13668
|
-
DropdownMenuPrimitive__namespace.Separator,
|
|
13669
|
-
"-mx-1 my-1 h-px bg-muted"
|
|
13670
|
-
);
|
|
13671
|
-
cn$1.withCn(
|
|
13672
|
-
cn$1.createPrimitiveElement("span"),
|
|
13673
|
-
"ml-auto text-xs tracking-widest opacity-60"
|
|
13674
|
-
);
|
|
13675
|
-
const useOpenState = () => {
|
|
13676
|
-
const [open2, setOpen] = React.useState(false);
|
|
13677
|
-
const onOpenChange = React.useCallback(
|
|
13678
|
-
(_value = !open2) => {
|
|
13679
|
-
setOpen(_value);
|
|
13680
|
-
},
|
|
13681
|
-
[open2]
|
|
13682
|
-
);
|
|
13683
|
-
return {
|
|
13684
|
-
onOpenChange,
|
|
13685
|
-
open: open2
|
|
13686
|
-
};
|
|
14213
|
+
return context;
|
|
13687
14214
|
};
|
|
13688
14215
|
const items$1 = [
|
|
13689
14216
|
{
|
|
@@ -13749,7 +14276,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13749
14276
|
return allNodesMatchInitialNodeType ? initialNodeType : plateParagraph.ELEMENT_PARAGRAPH;
|
|
13750
14277
|
}, []);
|
|
13751
14278
|
const editor = plateCommon.useEditorRef();
|
|
14279
|
+
const editorState = plateCommon.useEditorState();
|
|
13752
14280
|
const openState = useOpenState();
|
|
14281
|
+
const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
|
|
13753
14282
|
const selectedItem = items$1.find((item) => item.value === value) ?? defaultItem$1;
|
|
13754
14283
|
const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
|
|
13755
14284
|
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
@@ -13773,7 +14302,12 @@ var __publicField = (obj, key, value) => {
|
|
|
13773
14302
|
},
|
|
13774
14303
|
value
|
|
13775
14304
|
},
|
|
13776
|
-
items$1.
|
|
14305
|
+
items$1.filter((item) => {
|
|
14306
|
+
if (userInTable) {
|
|
14307
|
+
return !unsupportedItemsInTable.has(item.label);
|
|
14308
|
+
}
|
|
14309
|
+
return true;
|
|
14310
|
+
}).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
|
|
13777
14311
|
DropdownMenuRadioItem,
|
|
13778
14312
|
{
|
|
13779
14313
|
className: "min-w-[180px]",
|
|
@@ -13785,42 +14319,6 @@ var __publicField = (obj, key, value) => {
|
|
|
13785
14319
|
))
|
|
13786
14320
|
)));
|
|
13787
14321
|
}
|
|
13788
|
-
const LinkToolbarButton = cn$1.withRef((rest, ref) => {
|
|
13789
|
-
const state = plateLink.useLinkToolbarButtonState();
|
|
13790
|
-
const { props } = plateLink.useLinkToolbarButton(state);
|
|
13791
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
|
|
13792
|
-
});
|
|
13793
|
-
const useBlockQuoteToolbarButtonState = () => {
|
|
13794
|
-
const editor = plateCommon.useEditorState();
|
|
13795
|
-
const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
|
|
13796
|
-
return {
|
|
13797
|
-
pressed: isBlockActive()
|
|
13798
|
-
};
|
|
13799
|
-
};
|
|
13800
|
-
const useBlockQuoteToolbarButton = (state) => {
|
|
13801
|
-
const editor = plateCommon.useEditorState();
|
|
13802
|
-
const onClick = () => {
|
|
13803
|
-
plateCommon.toggleNodeType(editor, {
|
|
13804
|
-
activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
|
|
13805
|
-
});
|
|
13806
|
-
};
|
|
13807
|
-
const onMouseDown = (e) => {
|
|
13808
|
-
e.preventDefault();
|
|
13809
|
-
e.stopPropagation();
|
|
13810
|
-
};
|
|
13811
|
-
return {
|
|
13812
|
-
props: {
|
|
13813
|
-
onClick,
|
|
13814
|
-
onMouseDown,
|
|
13815
|
-
pressed: state.pressed
|
|
13816
|
-
}
|
|
13817
|
-
};
|
|
13818
|
-
};
|
|
13819
|
-
const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
13820
|
-
const state = useBlockQuoteToolbarButtonState();
|
|
13821
|
-
const { props } = useBlockQuoteToolbarButton(state);
|
|
13822
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
|
|
13823
|
-
});
|
|
13824
14322
|
const useCodeBlockToolbarButtonState = () => {
|
|
13825
14323
|
const editor = plateCommon.useEditorState();
|
|
13826
14324
|
const isBlockActive = () => helpers.isNodeActive(editor, plateCodeBlock.ELEMENT_CODE_BLOCK);
|
|
@@ -13882,6 +14380,116 @@ var __publicField = (obj, key, value) => {
|
|
|
13882
14380
|
const { props } = useImageToolbarButton(state);
|
|
13883
14381
|
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
|
|
13884
14382
|
});
|
|
14383
|
+
const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
|
|
14384
|
+
const editor = plateCommon.useEditorState();
|
|
14385
|
+
const state = plate.useListToolbarButtonState({ nodeType });
|
|
14386
|
+
const { props } = plate.useListToolbarButton(state);
|
|
14387
|
+
return /* @__PURE__ */ React.createElement(
|
|
14388
|
+
ToolbarButton,
|
|
14389
|
+
{
|
|
14390
|
+
ref,
|
|
14391
|
+
tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
14392
|
+
...props,
|
|
14393
|
+
onClick: (e) => {
|
|
14394
|
+
e.preventDefault();
|
|
14395
|
+
e.stopPropagation();
|
|
14396
|
+
plate.toggleList(editor, { type: nodeType });
|
|
14397
|
+
}
|
|
14398
|
+
},
|
|
14399
|
+
nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
|
|
14400
|
+
);
|
|
14401
|
+
});
|
|
14402
|
+
const LinkToolbarButton = cn$1.withRef((rest, ref) => {
|
|
14403
|
+
const state = plateLink.useLinkToolbarButtonState();
|
|
14404
|
+
const { props } = plateLink.useLinkToolbarButton(state);
|
|
14405
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
|
|
14406
|
+
});
|
|
14407
|
+
const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14408
|
+
const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
|
|
14409
|
+
const { props } = plateCommon.useMarkToolbarButton(state);
|
|
14410
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
14411
|
+
});
|
|
14412
|
+
const useMermaidToolbarButtonState = () => {
|
|
14413
|
+
const editor = plateCommon.useEditorState();
|
|
14414
|
+
const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_MERMAID);
|
|
14415
|
+
return {
|
|
14416
|
+
pressed: isBlockActive()
|
|
14417
|
+
};
|
|
14418
|
+
};
|
|
14419
|
+
const useMermaidToolbarButton = (state) => {
|
|
14420
|
+
const editor = plateCommon.useEditorState();
|
|
14421
|
+
const onClick = () => {
|
|
14422
|
+
plateCommon.insertEmptyElement(editor, ELEMENT_MERMAID, {
|
|
14423
|
+
nextBlock: true,
|
|
14424
|
+
select: true
|
|
14425
|
+
});
|
|
14426
|
+
};
|
|
14427
|
+
const onMouseDown = (e) => {
|
|
14428
|
+
e.preventDefault();
|
|
14429
|
+
e.stopPropagation();
|
|
14430
|
+
};
|
|
14431
|
+
return {
|
|
14432
|
+
props: {
|
|
14433
|
+
onClick,
|
|
14434
|
+
onMouseDown,
|
|
14435
|
+
pressed: state.pressed
|
|
14436
|
+
}
|
|
14437
|
+
};
|
|
14438
|
+
};
|
|
14439
|
+
const MermaidToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14440
|
+
const state = useMermaidToolbarButtonState();
|
|
14441
|
+
const { props } = useMermaidToolbarButton(state);
|
|
14442
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Mermaid", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.mermaid, null));
|
|
14443
|
+
});
|
|
14444
|
+
function OverflowMenu({
|
|
14445
|
+
children,
|
|
14446
|
+
...props
|
|
14447
|
+
}) {
|
|
14448
|
+
const openState = useOpenState();
|
|
14449
|
+
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
14450
|
+
ToolbarButton,
|
|
14451
|
+
{
|
|
14452
|
+
showArrow: false,
|
|
14453
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14454
|
+
className: "lg:min-w-[130px]",
|
|
14455
|
+
isDropdown: true,
|
|
14456
|
+
pressed: openState.open,
|
|
14457
|
+
tooltip: "Headings"
|
|
14458
|
+
},
|
|
14459
|
+
/* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
|
|
14460
|
+
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
|
|
14461
|
+
}
|
|
14462
|
+
const useBlockQuoteToolbarButtonState = () => {
|
|
14463
|
+
const editor = plateCommon.useEditorState();
|
|
14464
|
+
const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
|
|
14465
|
+
return {
|
|
14466
|
+
pressed: isBlockActive()
|
|
14467
|
+
};
|
|
14468
|
+
};
|
|
14469
|
+
const useBlockQuoteToolbarButton = (state) => {
|
|
14470
|
+
const editor = plateCommon.useEditorState();
|
|
14471
|
+
const onClick = () => {
|
|
14472
|
+
plateCommon.toggleNodeType(editor, {
|
|
14473
|
+
activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
|
|
14474
|
+
});
|
|
14475
|
+
};
|
|
14476
|
+
const onMouseDown = (e) => {
|
|
14477
|
+
e.preventDefault();
|
|
14478
|
+
e.stopPropagation();
|
|
14479
|
+
};
|
|
14480
|
+
return {
|
|
14481
|
+
props: {
|
|
14482
|
+
onClick,
|
|
14483
|
+
onMouseDown,
|
|
14484
|
+
pressed: state.pressed
|
|
14485
|
+
}
|
|
14486
|
+
};
|
|
14487
|
+
};
|
|
14488
|
+
const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14489
|
+
const state = useBlockQuoteToolbarButtonState();
|
|
14490
|
+
const { props } = useBlockQuoteToolbarButton(state);
|
|
14491
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
|
|
14492
|
+
});
|
|
13885
14493
|
const useRawMarkdownToolbarButton = () => {
|
|
13886
14494
|
const { setRawMode } = useEditorContext();
|
|
13887
14495
|
const onMouseDown = (e) => {
|
|
@@ -13896,31 +14504,123 @@ var __publicField = (obj, key, value) => {
|
|
|
13896
14504
|
};
|
|
13897
14505
|
const RawMarkdownToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
13898
14506
|
const { props } = useRawMarkdownToolbarButton();
|
|
13899
|
-
return /* @__PURE__ */ React.createElement(
|
|
14507
|
+
return /* @__PURE__ */ React.createElement(
|
|
14508
|
+
ToolbarButton,
|
|
14509
|
+
{
|
|
14510
|
+
ref,
|
|
14511
|
+
tooltip: "Link",
|
|
14512
|
+
...rest,
|
|
14513
|
+
...props,
|
|
14514
|
+
"data-testid": "markdown-button"
|
|
14515
|
+
},
|
|
14516
|
+
/* @__PURE__ */ React.createElement(Icons.raw, null)
|
|
14517
|
+
);
|
|
13900
14518
|
});
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
14519
|
+
function TableDropdownMenu(props) {
|
|
14520
|
+
const tableSelected = plateCommon.useEditorSelector(
|
|
14521
|
+
(editor2) => plateCommon.someNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } }),
|
|
14522
|
+
[]
|
|
14523
|
+
);
|
|
14524
|
+
const [enableDeleteColumn, enableDeleteRow] = plateCommon.useEditorSelector((editor2) => {
|
|
14525
|
+
const tableNodeEntry = plateCommon.findNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } });
|
|
14526
|
+
if (!tableNodeEntry)
|
|
14527
|
+
return [false, false];
|
|
14528
|
+
const [tableNode] = tableNodeEntry;
|
|
14529
|
+
if (!plateCommon.isElement(tableNode))
|
|
14530
|
+
return [false, false];
|
|
14531
|
+
const columnCount = plateTable.getTableColumnCount(tableNode);
|
|
14532
|
+
const rowCount = tableNode.children.length;
|
|
14533
|
+
return [columnCount > 1, rowCount > 1];
|
|
14534
|
+
}, []);
|
|
14535
|
+
const editor = plateCommon.useEditorRef();
|
|
14536
|
+
const openState = useOpenState();
|
|
14537
|
+
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(ToolbarButton, { isDropdown: true, pressed: openState.open, tooltip: "Table" }, /* @__PURE__ */ React.createElement(Icons.table, null))), /* @__PURE__ */ React.createElement(
|
|
14538
|
+
DropdownMenuContent,
|
|
14539
|
+
{
|
|
14540
|
+
align: "start",
|
|
14541
|
+
className: "flex w-[180px] min-w-0 flex-col gap-0.5"
|
|
14542
|
+
},
|
|
14543
|
+
/* @__PURE__ */ React.createElement(
|
|
14544
|
+
DropdownMenuItem,
|
|
14545
|
+
{
|
|
14546
|
+
className: "min-w-[180px]",
|
|
14547
|
+
disabled: tableSelected,
|
|
14548
|
+
onSelect: () => {
|
|
14549
|
+
plateTable.insertTable(editor);
|
|
14550
|
+
plateCommon.focusEditor(editor);
|
|
14551
|
+
}
|
|
14552
|
+
},
|
|
14553
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14554
|
+
"Insert table"
|
|
14555
|
+
),
|
|
14556
|
+
/* @__PURE__ */ React.createElement(
|
|
14557
|
+
DropdownMenuItem,
|
|
14558
|
+
{
|
|
14559
|
+
className: "min-w-[180px]",
|
|
14560
|
+
disabled: !tableSelected,
|
|
14561
|
+
onSelect: () => {
|
|
14562
|
+
plateTable.deleteTable(editor);
|
|
14563
|
+
plateCommon.focusEditor(editor);
|
|
14564
|
+
}
|
|
14565
|
+
},
|
|
14566
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14567
|
+
"Delete table"
|
|
14568
|
+
),
|
|
14569
|
+
/* @__PURE__ */ React.createElement(DropdownMenuSub, null, /* @__PURE__ */ React.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React.createElement(Icons.column, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React.createElement("span", null, "Column")), /* @__PURE__ */ React.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React.createElement(
|
|
14570
|
+
DropdownMenuItem,
|
|
14571
|
+
{
|
|
14572
|
+
className: "min-w-[180px]",
|
|
14573
|
+
disabled: !tableSelected,
|
|
14574
|
+
onSelect: () => {
|
|
14575
|
+
plateTable.insertTableColumn(editor);
|
|
14576
|
+
plateCommon.focusEditor(editor);
|
|
14577
|
+
}
|
|
14578
|
+
},
|
|
14579
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14580
|
+
"Insert column after"
|
|
14581
|
+
), /* @__PURE__ */ React.createElement(
|
|
14582
|
+
DropdownMenuItem,
|
|
14583
|
+
{
|
|
14584
|
+
className: "min-w-[180px]",
|
|
14585
|
+
disabled: !enableDeleteColumn,
|
|
14586
|
+
onSelect: () => {
|
|
14587
|
+
plateTable.deleteColumn(editor);
|
|
14588
|
+
plateCommon.focusEditor(editor);
|
|
14589
|
+
}
|
|
14590
|
+
},
|
|
14591
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14592
|
+
"Delete column"
|
|
14593
|
+
))),
|
|
14594
|
+
/* @__PURE__ */ React.createElement(DropdownMenuSub, null, /* @__PURE__ */ React.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React.createElement(Icons.row, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React.createElement("span", null, "Row")), /* @__PURE__ */ React.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React.createElement(
|
|
14595
|
+
DropdownMenuItem,
|
|
14596
|
+
{
|
|
14597
|
+
className: "min-w-[180px]",
|
|
14598
|
+
disabled: !tableSelected,
|
|
14599
|
+
onSelect: () => {
|
|
14600
|
+
plateTable.insertTableRow(editor);
|
|
14601
|
+
plateCommon.focusEditor(editor);
|
|
14602
|
+
}
|
|
14603
|
+
},
|
|
14604
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14605
|
+
"Insert row after"
|
|
14606
|
+
), /* @__PURE__ */ React.createElement(
|
|
14607
|
+
DropdownMenuItem,
|
|
14608
|
+
{
|
|
14609
|
+
className: "min-w-[180px]",
|
|
14610
|
+
disabled: !enableDeleteRow,
|
|
14611
|
+
onSelect: () => {
|
|
14612
|
+
plateTable.deleteRow(editor);
|
|
14613
|
+
plateCommon.focusEditor(editor);
|
|
14614
|
+
}
|
|
14615
|
+
},
|
|
14616
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14617
|
+
"Delete row"
|
|
14618
|
+
)))
|
|
14619
|
+
));
|
|
14620
|
+
}
|
|
13917
14621
|
function TemplatesToolbarButton() {
|
|
13918
14622
|
const { templates } = useToolbarContext();
|
|
13919
|
-
const showEmbed = templates.length > 0;
|
|
13920
14623
|
const editor = plateCommon.useEditorState();
|
|
13921
|
-
if (!showEmbed) {
|
|
13922
|
-
return null;
|
|
13923
|
-
}
|
|
13924
14624
|
return /* @__PURE__ */ React.createElement(EmbedButton, { templates, editor });
|
|
13925
14625
|
}
|
|
13926
14626
|
const EmbedButton = ({ editor, templates }) => {
|
|
@@ -13961,100 +14661,112 @@ var __publicField = (obj, key, value) => {
|
|
|
13961
14661
|
template.label || template.name
|
|
13962
14662
|
))));
|
|
13963
14663
|
};
|
|
13964
|
-
const ICON_WIDTH = 32;
|
|
13965
|
-
const EMBED_ICON_WIDTH = 78;
|
|
13966
|
-
const MD_BREAKPOINT = 768;
|
|
13967
|
-
const useResize = (ref, callback) => {
|
|
13968
|
-
React.useEffect(() => {
|
|
13969
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
13970
|
-
for (const entry of entries) {
|
|
13971
|
-
callback(entry);
|
|
13972
|
-
}
|
|
13973
|
-
});
|
|
13974
|
-
if (ref.current) {
|
|
13975
|
-
resizeObserver.observe(ref.current);
|
|
13976
|
-
}
|
|
13977
|
-
return () => resizeObserver.disconnect();
|
|
13978
|
-
}, [ref.current]);
|
|
13979
|
-
};
|
|
13980
|
-
function OverflowMenu({
|
|
13981
|
-
children,
|
|
13982
|
-
...props
|
|
13983
|
-
}) {
|
|
13984
|
-
const openState = useOpenState();
|
|
13985
|
-
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
13986
|
-
ToolbarButton,
|
|
13987
|
-
{
|
|
13988
|
-
showArrow: false,
|
|
13989
|
-
className: "lg:min-w-[130px]",
|
|
13990
|
-
isDropdown: true,
|
|
13991
|
-
pressed: openState.open,
|
|
13992
|
-
tooltip: "Headings"
|
|
13993
|
-
},
|
|
13994
|
-
/* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
|
|
13995
|
-
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
|
|
13996
|
-
}
|
|
13997
14664
|
const toolbarItems = {
|
|
13998
14665
|
heading: {
|
|
13999
|
-
label:
|
|
14666
|
+
label: HEADING_LABEL,
|
|
14667
|
+
width: (paragraphIconExists) => paragraphIconExists ? HEADING_ICON_WITH_TEXT : HEADING_ICON_ONLY,
|
|
14668
|
+
// Dynamically handle width based on paragraph icon
|
|
14000
14669
|
Component: /* @__PURE__ */ React.createElement(ToolbarGroup, { noSeparator: true }, /* @__PURE__ */ React.createElement(HeadingsMenu, null))
|
|
14001
14670
|
},
|
|
14002
14671
|
link: {
|
|
14003
14672
|
label: "Link",
|
|
14673
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14004
14674
|
Component: /* @__PURE__ */ React.createElement(LinkToolbarButton, null)
|
|
14005
14675
|
},
|
|
14006
14676
|
image: {
|
|
14007
14677
|
label: "Image",
|
|
14678
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14008
14679
|
Component: /* @__PURE__ */ React.createElement(ImageToolbarButton, null)
|
|
14009
14680
|
},
|
|
14010
14681
|
quote: {
|
|
14011
14682
|
label: "Quote",
|
|
14683
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14012
14684
|
Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
|
|
14013
14685
|
},
|
|
14014
14686
|
ul: {
|
|
14015
14687
|
label: "Unordered List",
|
|
14688
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14016
14689
|
Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_UL })
|
|
14017
14690
|
},
|
|
14018
14691
|
ol: {
|
|
14019
14692
|
label: "Ordered List",
|
|
14693
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14020
14694
|
Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_OL })
|
|
14021
14695
|
},
|
|
14022
14696
|
bold: {
|
|
14023
14697
|
label: "Bold",
|
|
14698
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14024
14699
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null))
|
|
14025
14700
|
},
|
|
14026
14701
|
italic: {
|
|
14027
14702
|
label: "Italic",
|
|
14703
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14028
14704
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null))
|
|
14029
14705
|
},
|
|
14030
14706
|
code: {
|
|
14031
14707
|
label: "Code",
|
|
14708
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14032
14709
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null))
|
|
14033
14710
|
},
|
|
14034
14711
|
codeBlock: {
|
|
14035
14712
|
label: "Code Block",
|
|
14713
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14036
14714
|
Component: /* @__PURE__ */ React.createElement(CodeBlockToolbarButton, null)
|
|
14037
14715
|
},
|
|
14716
|
+
mermaid: {
|
|
14717
|
+
label: "Mermaid",
|
|
14718
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14719
|
+
Component: /* @__PURE__ */ React.createElement(MermaidToolbarButton, null)
|
|
14720
|
+
},
|
|
14721
|
+
table: {
|
|
14722
|
+
label: "Table",
|
|
14723
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14724
|
+
Component: /* @__PURE__ */ React.createElement(TableDropdownMenu, null)
|
|
14725
|
+
},
|
|
14038
14726
|
raw: {
|
|
14039
14727
|
label: "Raw Markdown",
|
|
14728
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14040
14729
|
Component: /* @__PURE__ */ React.createElement(RawMarkdownToolbarButton, null)
|
|
14041
14730
|
},
|
|
14042
14731
|
embed: {
|
|
14043
14732
|
label: "Templates",
|
|
14733
|
+
width: () => EMBED_ICON_WIDTH,
|
|
14044
14734
|
Component: /* @__PURE__ */ React.createElement(TemplatesToolbarButton, null)
|
|
14045
14735
|
}
|
|
14046
14736
|
};
|
|
14047
14737
|
function FixedToolbarButtons() {
|
|
14048
14738
|
const toolbarRef = React.useRef(null);
|
|
14049
14739
|
const [itemsShown, setItemsShown] = React.useState(11);
|
|
14050
|
-
const { overrides } = useToolbarContext();
|
|
14740
|
+
const { overrides, templates } = useToolbarContext();
|
|
14741
|
+
const showEmbedButton = templates.length > 0;
|
|
14742
|
+
let items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14743
|
+
if (!showEmbedButton) {
|
|
14744
|
+
items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
|
|
14745
|
+
}
|
|
14746
|
+
const editorState = plateCommon.useEditorState();
|
|
14747
|
+
const userInTable = helpers.isNodeActive(editorState, plate.ELEMENT_TABLE);
|
|
14748
|
+
if (userInTable) {
|
|
14749
|
+
items2 = items2.filter((item) => !unsupportedItemsInTable.has(item.label));
|
|
14750
|
+
}
|
|
14051
14751
|
useResize(toolbarRef, (entry) => {
|
|
14052
14752
|
const width = entry.target.getBoundingClientRect().width;
|
|
14053
|
-
const
|
|
14054
|
-
const
|
|
14055
|
-
|
|
14753
|
+
const headingButton = items2.find((item) => item.label === HEADING_LABEL);
|
|
14754
|
+
const headingWidth = headingButton ? headingButton.width(width > CONTAINER_MD_BREAKPOINT) : 0;
|
|
14755
|
+
const availableWidth = width - headingWidth - FLOAT_BUTTON_WIDTH;
|
|
14756
|
+
const { itemFitCount } = items2.reduce(
|
|
14757
|
+
(acc, item) => {
|
|
14758
|
+
if (item.label !== HEADING_LABEL && acc.totalItemsWidth + item.width() <= availableWidth) {
|
|
14759
|
+
return {
|
|
14760
|
+
totalItemsWidth: acc.totalItemsWidth + item.width(),
|
|
14761
|
+
itemFitCount: acc.itemFitCount + 1
|
|
14762
|
+
};
|
|
14763
|
+
}
|
|
14764
|
+
return acc;
|
|
14765
|
+
},
|
|
14766
|
+
{ totalItemsWidth: 0, itemFitCount: 1 }
|
|
14767
|
+
);
|
|
14768
|
+
setItemsShown(itemFitCount);
|
|
14056
14769
|
});
|
|
14057
|
-
const toolbarItemsArray = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14058
14770
|
return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden @container/toolbar", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
|
|
14059
14771
|
"div",
|
|
14060
14772
|
{
|
|
@@ -14063,7 +14775,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14063
14775
|
transform: "translateX(calc(-1px))"
|
|
14064
14776
|
}
|
|
14065
14777
|
},
|
|
14066
|
-
/* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
14778
|
+
/* @__PURE__ */ React.createElement(React.Fragment, null, items2.slice(0, itemsShown).map((item) => /* @__PURE__ */ React.createElement(React.Fragment, { key: item.label }, item.Component)), items2.length > itemsShown && /* @__PURE__ */ React.createElement(OverflowMenu, null, items2.slice(itemsShown).flatMap((c) => /* @__PURE__ */ React.createElement(React.Fragment, { key: c.label }, c.Component))))
|
|
14067
14779
|
));
|
|
14068
14780
|
}
|
|
14069
14781
|
const FloatingToolbar = cn$1.withRef(({ children, state, ...props }, componentRef) => {
|
|
@@ -14178,6 +14890,10 @@ var __publicField = (obj, key, value) => {
|
|
|
14178
14890
|
const openState = useOpenState();
|
|
14179
14891
|
const selectedItem = items.find((item) => item.value === value) ?? defaultItem;
|
|
14180
14892
|
const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
|
|
14893
|
+
const editorState = plateCommon.useEditorState();
|
|
14894
|
+
const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
|
|
14895
|
+
if (userInTable)
|
|
14896
|
+
return null;
|
|
14181
14897
|
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
14182
14898
|
ToolbarButton,
|
|
14183
14899
|
{
|
|
@@ -14219,49 +14935,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14219
14935
|
function FloatingToolbarButtons() {
|
|
14220
14936
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TurnIntoDropdownMenu, null));
|
|
14221
14937
|
}
|
|
14222
|
-
const buttonVariants = classVarianceAuthority.cva(
|
|
14223
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
14224
|
-
{
|
|
14225
|
-
defaultVariants: {
|
|
14226
|
-
size: "default",
|
|
14227
|
-
variant: "default"
|
|
14228
|
-
},
|
|
14229
|
-
variants: {
|
|
14230
|
-
isMenu: {
|
|
14231
|
-
true: "h-auto w-full cursor-pointer justify-start"
|
|
14232
|
-
},
|
|
14233
|
-
size: {
|
|
14234
|
-
default: "h-10 px-4 py-2",
|
|
14235
|
-
icon: "size-10",
|
|
14236
|
-
lg: "h-11 rounded-md px-8",
|
|
14237
|
-
none: "",
|
|
14238
|
-
sm: "h-9 rounded-md px-3",
|
|
14239
|
-
sms: "size-9 rounded-md px-0",
|
|
14240
|
-
xs: "h-8 rounded-md px-3"
|
|
14241
|
-
},
|
|
14242
|
-
variant: {
|
|
14243
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
14244
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
14245
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
14246
|
-
inlineLink: "text-base text-primary underline underline-offset-4",
|
|
14247
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
14248
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
14249
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
14250
|
-
}
|
|
14251
|
-
}
|
|
14252
|
-
}
|
|
14253
|
-
);
|
|
14254
|
-
cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
|
|
14255
|
-
const Comp = asChild ? reactSlot.Slot : "button";
|
|
14256
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
14257
|
-
Comp,
|
|
14258
|
-
{
|
|
14259
|
-
className: cn$1.cn(buttonVariants({ className, isMenu, size, variant })),
|
|
14260
|
-
ref,
|
|
14261
|
-
...props
|
|
14262
|
-
}
|
|
14263
|
-
);
|
|
14264
|
-
});
|
|
14265
14938
|
const inputVariants = classVarianceAuthority.cva(
|
|
14266
14939
|
"flex w-full rounded-md bg-transparent text-sm file:border-0 file:bg-background file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
14267
14940
|
{
|
|
@@ -14282,22 +14955,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14282
14955
|
}
|
|
14283
14956
|
);
|
|
14284
14957
|
cn$1.withVariants("input", inputVariants, ["variant", "h"]);
|
|
14285
|
-
const popoverVariants = classVarianceAuthority.cva(
|
|
14286
|
-
"w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 print:hidden"
|
|
14287
|
-
);
|
|
14288
|
-
cn$1.withRef(
|
|
14289
|
-
({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
|
|
14290
|
-
PopoverPrimitive__namespace.Content,
|
|
14291
|
-
{
|
|
14292
|
-
align,
|
|
14293
|
-
className: cn$1.cn(popoverVariants(), className),
|
|
14294
|
-
ref,
|
|
14295
|
-
sideOffset,
|
|
14296
|
-
style: { zIndex: 1e3, ...style },
|
|
14297
|
-
...props
|
|
14298
|
-
}
|
|
14299
|
-
))
|
|
14300
|
-
);
|
|
14301
14958
|
const floatingOptions = {
|
|
14302
14959
|
middleware: [
|
|
14303
14960
|
plateFloating.offset(12),
|
|
@@ -14357,7 +15014,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14357
15014
|
const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex h-9 items-center gap-1" }, /* @__PURE__ */ React.createElement(
|
|
14358
15015
|
"button",
|
|
14359
15016
|
{
|
|
14360
|
-
className: buttonVariants({ size: "sm", variant: "ghost" }),
|
|
15017
|
+
className: buttonVariants$1({ size: "sm", variant: "ghost" }),
|
|
14361
15018
|
type: "button",
|
|
14362
15019
|
...editButtonProps
|
|
14363
15020
|
},
|
|
@@ -14365,7 +15022,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14365
15022
|
), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
|
|
14366
15023
|
plateLink.LinkOpenButton,
|
|
14367
15024
|
{
|
|
14368
|
-
className: buttonVariants({
|
|
15025
|
+
className: buttonVariants$1({
|
|
14369
15026
|
size: "sms",
|
|
14370
15027
|
variant: "ghost"
|
|
14371
15028
|
})
|
|
@@ -14374,7 +15031,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14374
15031
|
), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
|
|
14375
15032
|
"button",
|
|
14376
15033
|
{
|
|
14377
|
-
className: buttonVariants({
|
|
15034
|
+
className: buttonVariants$1({
|
|
14378
15035
|
size: "sms",
|
|
14379
15036
|
variant: "ghost"
|
|
14380
15037
|
}),
|
|
@@ -14448,6 +15105,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14448
15105
|
createMdxBlockPlugin(),
|
|
14449
15106
|
createMdxInlinePlugin(),
|
|
14450
15107
|
createImgPlugin(),
|
|
15108
|
+
createMermaidPlugin(),
|
|
14451
15109
|
createInvalidMarkdownPlugin(),
|
|
14452
15110
|
plateLink.createLinkPlugin({
|
|
14453
15111
|
options: {
|
|
@@ -29455,6 +30113,7 @@ mutation addPendingDocumentMutation(
|
|
|
29455
30113
|
relativePath
|
|
29456
30114
|
filename
|
|
29457
30115
|
extension
|
|
30116
|
+
hasReferences
|
|
29458
30117
|
}
|
|
29459
30118
|
}
|
|
29460
30119
|
}
|
|
@@ -29546,6 +30205,9 @@ mutation addPendingDocumentMutation(
|
|
|
29546
30205
|
document(collection:$collection, relativePath:$relativePath) {
|
|
29547
30206
|
... on Document {
|
|
29548
30207
|
_values
|
|
30208
|
+
_sys {
|
|
30209
|
+
hasReferences
|
|
30210
|
+
}
|
|
29549
30211
|
}
|
|
29550
30212
|
}
|
|
29551
30213
|
}`;
|
|
@@ -30570,8 +31232,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
30570
31232
|
}
|
|
30571
31233
|
)
|
|
30572
31234
|
}
|
|
30573
|
-
), !renderDesktopNav && /* @__PURE__ */ React.createElement(react
|
|
30574
|
-
react
|
|
31235
|
+
), !renderDesktopNav && /* @__PURE__ */ React.createElement(react.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
|
|
31236
|
+
react.TransitionChild,
|
|
30575
31237
|
{
|
|
30576
31238
|
enter: "transform transition-all ease-out duration-300",
|
|
30577
31239
|
enterFrom: "opacity-0 -translate-x-full",
|
|
@@ -30640,7 +31302,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
30640
31302
|
))
|
|
30641
31303
|
))
|
|
30642
31304
|
), /* @__PURE__ */ React.createElement(
|
|
30643
|
-
react
|
|
31305
|
+
react.TransitionChild,
|
|
30644
31306
|
{
|
|
30645
31307
|
enter: "ease-out duration-300",
|
|
30646
31308
|
enterFrom: "opacity-0",
|
|
@@ -31094,8 +31756,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31094
31756
|
folder,
|
|
31095
31757
|
collectionName
|
|
31096
31758
|
}) => {
|
|
31097
|
-
return /* @__PURE__ */ React.createElement(react
|
|
31098
|
-
react
|
|
31759
|
+
return /* @__PURE__ */ React.createElement(react.Menu, { as: "div", className: "relative inline-block text-left" }, () => /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(react.MenuButton, { className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6" }, "Create New ", /* @__PURE__ */ React.createElement(BiPlus, { className: "w-5 h-full ml-1 opacity-70" }))), /* @__PURE__ */ React.createElement(
|
|
31760
|
+
react.Transition,
|
|
31099
31761
|
{
|
|
31100
31762
|
enter: "transition ease-out duration-100",
|
|
31101
31763
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -31104,7 +31766,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31104
31766
|
leaveFrom: "transform opacity-100 scale-100",
|
|
31105
31767
|
leaveTo: "transform opacity-0 scale-95"
|
|
31106
31768
|
},
|
|
31107
|
-
/* @__PURE__ */ React.createElement(react
|
|
31769
|
+
/* @__PURE__ */ React.createElement(react.MenuItems, { className: "origin-top-right absolute right-0 mt-2 z-menu w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React.createElement("div", { className: "py-1" }, templates.map((template) => /* @__PURE__ */ React.createElement(react.MenuItem, { key: `${template.label}-${template.name}` }, ({ focus }) => /* @__PURE__ */ React.createElement(
|
|
31108
31770
|
reactRouterDom.Link,
|
|
31109
31771
|
{
|
|
31110
31772
|
to: `/${folder.fullyQualifiedName ? [
|
|
@@ -31272,6 +31934,23 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31272
31934
|
DeleteModal,
|
|
31273
31935
|
{
|
|
31274
31936
|
filename: vars.relativePath,
|
|
31937
|
+
checkRefsFunc: async () => {
|
|
31938
|
+
var _a2, _b2;
|
|
31939
|
+
try {
|
|
31940
|
+
const doc = await admin.fetchDocument(
|
|
31941
|
+
collection.name,
|
|
31942
|
+
vars.relativePath,
|
|
31943
|
+
true
|
|
31944
|
+
);
|
|
31945
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31946
|
+
} catch (error) {
|
|
31947
|
+
cms.alerts.error(
|
|
31948
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31949
|
+
);
|
|
31950
|
+
console.error(error);
|
|
31951
|
+
throw error;
|
|
31952
|
+
}
|
|
31953
|
+
},
|
|
31275
31954
|
deleteFunc: async () => {
|
|
31276
31955
|
try {
|
|
31277
31956
|
await admin.deleteDocument(vars);
|
|
@@ -31280,6 +31959,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31280
31959
|
);
|
|
31281
31960
|
reFetchCollection();
|
|
31282
31961
|
} catch (error) {
|
|
31962
|
+
if (error.message.indexOf("has references")) {
|
|
31963
|
+
cms.alerts.error(
|
|
31964
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31965
|
+
);
|
|
31966
|
+
return;
|
|
31967
|
+
}
|
|
31283
31968
|
cms.alerts.warn(
|
|
31284
31969
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31285
31970
|
);
|
|
@@ -31331,6 +32016,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31331
32016
|
cms.alerts.info("Document was successfully renamed");
|
|
31332
32017
|
reFetchCollection();
|
|
31333
32018
|
} catch (error) {
|
|
32019
|
+
if (error.message.indexOf("has references")) {
|
|
32020
|
+
cms.alerts.error(
|
|
32021
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
32022
|
+
);
|
|
32023
|
+
return;
|
|
32024
|
+
}
|
|
31334
32025
|
cms.alerts.warn(
|
|
31335
32026
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31336
32027
|
);
|
|
@@ -31804,8 +32495,19 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31804
32495
|
const NoDocumentsPlaceholder = () => {
|
|
31805
32496
|
return /* @__PURE__ */ React.createElement("div", { className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg" }, /* @__PURE__ */ React.createElement("p", { className: "text-base italic font-medium text-gray-300" }, "No documents found."));
|
|
31806
32497
|
};
|
|
31807
|
-
const DeleteModal = ({
|
|
31808
|
-
|
|
32498
|
+
const DeleteModal = ({
|
|
32499
|
+
close: close2,
|
|
32500
|
+
deleteFunc,
|
|
32501
|
+
checkRefsFunc,
|
|
32502
|
+
filename
|
|
32503
|
+
}) => {
|
|
32504
|
+
const [hasRefs, setHasRefs] = React.useState();
|
|
32505
|
+
React.useEffect(() => {
|
|
32506
|
+
checkRefsFunc().then((result) => {
|
|
32507
|
+
setHasRefs(result);
|
|
32508
|
+
});
|
|
32509
|
+
}, [filename, checkRefsFunc]);
|
|
32510
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?${hasRefs ? " References to this document will also be deleted." : ""}`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
|
|
31809
32511
|
Button$1,
|
|
31810
32512
|
{
|
|
31811
32513
|
style: { flexGrow: 3 },
|
|
@@ -33172,6 +33874,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33172
33874
|
exports2.useScreenPlugin = useScreenPlugin;
|
|
33173
33875
|
exports2.useTinaAuthRedirect = useTinaAuthRedirect;
|
|
33174
33876
|
exports2.wrapFieldWithError = wrapFieldWithError;
|
|
33877
|
+
exports2.wrapFieldWithNoHeader = wrapFieldWithNoHeader;
|
|
33175
33878
|
exports2.wrapFieldsWithMeta = wrapFieldsWithMeta;
|
|
33176
33879
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
33177
33880
|
});
|