tinacms 0.0.0-8eeb2df-20241010045955 → 0.0.0-97d38ab-20241104224426
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 +1239 -994
- package/dist/index.mjs +1214 -968
- 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 +3 -1
- package/dist/rich-text/index.mjs +3 -1
- 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/text-area.d.ts +5 -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 +10 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +1 -1
- 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 +6 -5
- 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) => {
|
|
@@ -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
|
{
|
|
@@ -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,782 +2296,6 @@ var __publicField = (obj, key, value) => {
|
|
|
1744
2296
|
);
|
|
1745
2297
|
}
|
|
1746
2298
|
);
|
|
1747
|
-
const listVariants = classVarianceAuthority.cva("m-0 ps-6", {
|
|
1748
|
-
variants: {
|
|
1749
|
-
variant: {
|
|
1750
|
-
ol: "list-decimal",
|
|
1751
|
-
ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
});
|
|
1755
|
-
const ListElementVariants = cn$1.withVariants(plateCommon.PlateElement, listVariants, [
|
|
1756
|
-
"variant"
|
|
1757
|
-
]);
|
|
1758
|
-
const ListElement = cn$1.withRef(
|
|
1759
|
-
({ children, variant = "ul", ...props }, ref) => {
|
|
1760
|
-
const Component = variant;
|
|
1761
|
-
return /* @__PURE__ */ React.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React.createElement(Component, null, children));
|
|
1762
|
-
}
|
|
1763
|
-
);
|
|
1764
|
-
const BlockquoteElement = cn$1.withRef(
|
|
1765
|
-
({ children, className, ...props }, ref) => {
|
|
1766
|
-
return /* @__PURE__ */ React.createElement(
|
|
1767
|
-
plateCommon.PlateElement,
|
|
1768
|
-
{
|
|
1769
|
-
asChild: true,
|
|
1770
|
-
className: cn$1.cn("my-1 border-l-2 pl-6 italic", className),
|
|
1771
|
-
ref,
|
|
1772
|
-
...props
|
|
1773
|
-
},
|
|
1774
|
-
/* @__PURE__ */ React.createElement("blockquote", null, children)
|
|
1775
|
-
);
|
|
1776
|
-
}
|
|
1777
|
-
);
|
|
1778
|
-
const CodeLeaf = cn$1.withRef(
|
|
1779
|
-
({ children, className, ...props }, ref) => {
|
|
1780
|
-
return /* @__PURE__ */ React.createElement(
|
|
1781
|
-
plateCommon.PlateLeaf,
|
|
1782
|
-
{
|
|
1783
|
-
asChild: true,
|
|
1784
|
-
className: cn$1.cn(
|
|
1785
|
-
"whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
|
|
1786
|
-
className
|
|
1787
|
-
),
|
|
1788
|
-
ref,
|
|
1789
|
-
...props
|
|
1790
|
-
},
|
|
1791
|
-
/* @__PURE__ */ React.createElement("code", null, children)
|
|
1792
|
-
);
|
|
1793
|
-
}
|
|
1794
|
-
);
|
|
1795
|
-
const CodeLineElement = cn$1.withRef((props, ref) => /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { ref, ...props }));
|
|
1796
|
-
const CodeSyntaxLeaf = cn$1.withRef(
|
|
1797
|
-
({ children, ...props }, ref) => {
|
|
1798
|
-
const { leaf } = props;
|
|
1799
|
-
const { tokenProps } = plateCodeBlock.useCodeSyntaxLeaf({ leaf });
|
|
1800
|
-
return /* @__PURE__ */ React.createElement(plateCommon.PlateLeaf, { ref, ...props }, /* @__PURE__ */ React.createElement("span", { ...tokenProps }, children));
|
|
1801
|
-
}
|
|
1802
|
-
);
|
|
1803
|
-
function ChevronDownIcon(props, svgRef) {
|
|
1804
|
-
return /* @__PURE__ */ React__namespace.createElement("svg", Object.assign({
|
|
1805
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1806
|
-
viewBox: "0 0 20 20",
|
|
1807
|
-
fill: "currentColor",
|
|
1808
|
-
"aria-hidden": "true",
|
|
1809
|
-
ref: svgRef
|
|
1810
|
-
}, props), /* @__PURE__ */ React__namespace.createElement("path", {
|
|
1811
|
-
fillRule: "evenodd",
|
|
1812
|
-
d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
|
|
1813
|
-
clipRule: "evenodd"
|
|
1814
|
-
}));
|
|
1815
|
-
}
|
|
1816
|
-
const ForwardRef = React__namespace.forwardRef(ChevronDownIcon);
|
|
1817
|
-
const ChevronDownIcon$1 = ForwardRef;
|
|
1818
|
-
const Autocomplete = ({
|
|
1819
|
-
value,
|
|
1820
|
-
onChange,
|
|
1821
|
-
defaultQuery,
|
|
1822
|
-
items: items2
|
|
1823
|
-
}) => {
|
|
1824
|
-
const [query, setQuery] = React.useState(defaultQuery ?? "");
|
|
1825
|
-
const filteredItems = React.useMemo(() => {
|
|
1826
|
-
try {
|
|
1827
|
-
const reFilter = new RegExp(query, "i");
|
|
1828
|
-
const _items = items2.filter((item) => reFilter.test(item.label));
|
|
1829
|
-
if (_items.length === 0)
|
|
1830
|
-
return items2;
|
|
1831
|
-
return _items;
|
|
1832
|
-
} catch (err) {
|
|
1833
|
-
return items2;
|
|
1834
|
-
}
|
|
1835
|
-
}, [items2, query]);
|
|
1836
|
-
return /* @__PURE__ */ React.createElement(
|
|
1837
|
-
react$1.Combobox,
|
|
1838
|
-
{
|
|
1839
|
-
value,
|
|
1840
|
-
onChange,
|
|
1841
|
-
as: "div",
|
|
1842
|
-
className: "relative inline-block text-left z-20"
|
|
1843
|
-
},
|
|
1844
|
-
/* @__PURE__ */ React.createElement("div", { className: "mt-1" }, /* @__PURE__ */ React.createElement("div", { className: "relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left shadow-md sm:text-sm" }, /* @__PURE__ */ React.createElement(
|
|
1845
|
-
react$1.ComboboxInput,
|
|
1846
|
-
{
|
|
1847
|
-
className: "w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 focus:ring-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-teal-300",
|
|
1848
|
-
displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
|
|
1849
|
-
onChange: (event) => setQuery(event.target.value),
|
|
1850
|
-
onClick: (ev) => ev.stopPropagation()
|
|
1851
|
-
}
|
|
1852
|
-
), /* @__PURE__ */ React.createElement(react$1.ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React.createElement(
|
|
1853
|
-
ChevronDownIcon$1,
|
|
1854
|
-
{
|
|
1855
|
-
className: "h-5 w-5 text-gray-400",
|
|
1856
|
-
"aria-hidden": "true"
|
|
1857
|
-
}
|
|
1858
|
-
)))),
|
|
1859
|
-
/* @__PURE__ */ React.createElement(
|
|
1860
|
-
react$1.Transition,
|
|
1861
|
-
{
|
|
1862
|
-
enter: "transition ease-out duration-100",
|
|
1863
|
-
enterFrom: "transform opacity-0 scale-95",
|
|
1864
|
-
enterTo: "transform opacity-100 scale-100",
|
|
1865
|
-
leave: "transition ease-in duration-75",
|
|
1866
|
-
leaveFrom: "transform opacity-100 scale-100",
|
|
1867
|
-
leaveTo: "transform opacity-0 scale-95"
|
|
1868
|
-
},
|
|
1869
|
-
/* @__PURE__ */ React.createElement(react$1.ComboboxOptions, { className: "origin-top-right absolute right-0 mt-1 w-full max-h-[300px] overflow-y-auto rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, filteredItems.map((item) => /* @__PURE__ */ React.createElement(react$1.ComboboxOption, { key: item.key, value: item }, ({ focus }) => /* @__PURE__ */ React.createElement(
|
|
1870
|
-
"button",
|
|
1871
|
-
{
|
|
1872
|
-
className: classNames$1(
|
|
1873
|
-
focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
|
|
1874
|
-
"block px-4 py-2 text-xs w-full text-right"
|
|
1875
|
-
)
|
|
1876
|
-
},
|
|
1877
|
-
item.render(item)
|
|
1878
|
-
))))
|
|
1879
|
-
)
|
|
1880
|
-
);
|
|
1881
|
-
};
|
|
1882
|
-
MonacoEditor.loader.config({
|
|
1883
|
-
paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
|
|
1884
|
-
});
|
|
1885
|
-
let retryCount = 0;
|
|
1886
|
-
const retryFocus = (ref) => {
|
|
1887
|
-
if (ref.current) {
|
|
1888
|
-
ref.current.focus();
|
|
1889
|
-
} else {
|
|
1890
|
-
if (retryCount < 30) {
|
|
1891
|
-
setTimeout(() => {
|
|
1892
|
-
retryCount = retryCount + 1;
|
|
1893
|
-
retryFocus(ref);
|
|
1894
|
-
}, 100);
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
};
|
|
1898
|
-
const CodeBlock = ({
|
|
1899
|
-
attributes,
|
|
1900
|
-
editor,
|
|
1901
|
-
element,
|
|
1902
|
-
language: restrictLanguage,
|
|
1903
|
-
...props
|
|
1904
|
-
}) => {
|
|
1905
|
-
const [navigateAway, setNavigateAway] = React.useState(null);
|
|
1906
|
-
const monaco = MonacoEditor.useMonaco();
|
|
1907
|
-
const monacoEditorRef = React.useRef(null);
|
|
1908
|
-
const selected = slateReact.useSelected();
|
|
1909
|
-
const [height, setHeight] = React.useState(28);
|
|
1910
|
-
React.useEffect(() => {
|
|
1911
|
-
if (selected && plateCommon.isCollapsed(editor.selection)) {
|
|
1912
|
-
retryFocus(monacoEditorRef);
|
|
1913
|
-
}
|
|
1914
|
-
}, [selected, monacoEditorRef.current]);
|
|
1915
|
-
const value = element.value || "";
|
|
1916
|
-
if (typeof value !== "string") {
|
|
1917
|
-
throw new Error("Element must be of type string for code block");
|
|
1918
|
-
}
|
|
1919
|
-
const language = restrictLanguage || element.lang;
|
|
1920
|
-
const id = React.useMemo(() => uuid(), []);
|
|
1921
|
-
const languages = React.useMemo(() => {
|
|
1922
|
-
const defaultLangSet = { "": "plain text" };
|
|
1923
|
-
if (!monaco)
|
|
1924
|
-
return defaultLangSet;
|
|
1925
|
-
return monaco.languages.getLanguages().reduce((ac, cv) => {
|
|
1926
|
-
if (cv.id === "plaintext")
|
|
1927
|
-
return ac;
|
|
1928
|
-
return { ...ac, [cv.id]: cv.id };
|
|
1929
|
-
}, defaultLangSet);
|
|
1930
|
-
}, [monaco]);
|
|
1931
|
-
React.useEffect(() => {
|
|
1932
|
-
if (monaco) {
|
|
1933
|
-
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
1934
|
-
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
1935
|
-
// disable errors
|
|
1936
|
-
noSemanticValidation: true,
|
|
1937
|
-
noSyntaxValidation: true
|
|
1938
|
-
});
|
|
1939
|
-
}
|
|
1940
|
-
}, [monaco]);
|
|
1941
|
-
const items2 = Object.entries(languages).map(([key, label]) => ({
|
|
1942
|
-
key,
|
|
1943
|
-
label,
|
|
1944
|
-
render: (item) => item.label
|
|
1945
|
-
}));
|
|
1946
|
-
const currentItem = React.useMemo(() => {
|
|
1947
|
-
return items2.find((item) => item.key === language) ?? {
|
|
1948
|
-
key: "",
|
|
1949
|
-
label: "Plain Text"
|
|
1950
|
-
};
|
|
1951
|
-
}, [items2, language]);
|
|
1952
|
-
React.useEffect(() => {
|
|
1953
|
-
if (navigateAway) {
|
|
1954
|
-
setNavigateAway(null);
|
|
1955
|
-
switch (navigateAway) {
|
|
1956
|
-
case "remove":
|
|
1957
|
-
{
|
|
1958
|
-
plateCommon.focusEditor(editor);
|
|
1959
|
-
plateCommon.setNodes(
|
|
1960
|
-
editor,
|
|
1961
|
-
{
|
|
1962
|
-
type: "p",
|
|
1963
|
-
children: [{ text: "" }],
|
|
1964
|
-
lang: void 0,
|
|
1965
|
-
value: void 0
|
|
1966
|
-
},
|
|
1967
|
-
{
|
|
1968
|
-
match: (n) => {
|
|
1969
|
-
if (plateCommon.isElement(n) && n.type === element.type) {
|
|
1970
|
-
return true;
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
}
|
|
1974
|
-
);
|
|
1975
|
-
}
|
|
1976
|
-
break;
|
|
1977
|
-
case "insertNext":
|
|
1978
|
-
{
|
|
1979
|
-
plateCommon.insertNodes(
|
|
1980
|
-
editor,
|
|
1981
|
-
[
|
|
1982
|
-
{
|
|
1983
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
1984
|
-
children: [{ text: "" }],
|
|
1985
|
-
lang: void 0,
|
|
1986
|
-
value: void 0
|
|
1987
|
-
}
|
|
1988
|
-
],
|
|
1989
|
-
{ select: true }
|
|
1990
|
-
);
|
|
1991
|
-
plateCommon.focusEditor(editor);
|
|
1992
|
-
}
|
|
1993
|
-
break;
|
|
1994
|
-
case "up":
|
|
1995
|
-
{
|
|
1996
|
-
const path = plateCommon.findNodePath(editor, element);
|
|
1997
|
-
if (!path) {
|
|
1998
|
-
return;
|
|
1999
|
-
}
|
|
2000
|
-
const previousNodePath = plateCommon.getPointBefore(editor, path);
|
|
2001
|
-
if (!previousNodePath) {
|
|
2002
|
-
plateCommon.focusEditor(editor);
|
|
2003
|
-
plateCommon.insertNodes(
|
|
2004
|
-
editor,
|
|
2005
|
-
[
|
|
2006
|
-
{
|
|
2007
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
2008
|
-
children: [{ text: "" }],
|
|
2009
|
-
lang: void 0,
|
|
2010
|
-
value: void 0
|
|
2011
|
-
}
|
|
2012
|
-
],
|
|
2013
|
-
// Insert a new node at the current path, resulting in the code_block
|
|
2014
|
-
// moving down one block
|
|
2015
|
-
{ at: path, select: true }
|
|
2016
|
-
);
|
|
2017
|
-
return;
|
|
2018
|
-
}
|
|
2019
|
-
plateCommon.focusEditor(editor, previousNodePath);
|
|
2020
|
-
}
|
|
2021
|
-
break;
|
|
2022
|
-
case "down": {
|
|
2023
|
-
const path = plateCommon.findNodePath(editor, element);
|
|
2024
|
-
if (!path) {
|
|
2025
|
-
return;
|
|
2026
|
-
}
|
|
2027
|
-
const nextNodePath = plateCommon.getPointAfter(editor, path);
|
|
2028
|
-
if (!nextNodePath) {
|
|
2029
|
-
plateCommon.insertNodes(
|
|
2030
|
-
editor,
|
|
2031
|
-
[
|
|
2032
|
-
{
|
|
2033
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
2034
|
-
children: [{ text: "" }],
|
|
2035
|
-
lang: void 0,
|
|
2036
|
-
value: void 0
|
|
2037
|
-
}
|
|
2038
|
-
],
|
|
2039
|
-
{ select: true }
|
|
2040
|
-
);
|
|
2041
|
-
plateCommon.focusEditor(editor);
|
|
2042
|
-
} else {
|
|
2043
|
-
plateCommon.focusEditor(editor, nextNodePath);
|
|
2044
|
-
}
|
|
2045
|
-
break;
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
}, [navigateAway]);
|
|
2050
|
-
function handleEditorDidMount(monacoEditor, monaco2) {
|
|
2051
|
-
monacoEditorRef.current = monacoEditor;
|
|
2052
|
-
monacoEditor.onDidContentSizeChange(() => {
|
|
2053
|
-
setHeight(monacoEditor.getContentHeight());
|
|
2054
|
-
monacoEditor.layout();
|
|
2055
|
-
});
|
|
2056
|
-
monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
|
|
2057
|
-
if (monacoEditor.hasTextFocus()) {
|
|
2058
|
-
setNavigateAway("insertNext");
|
|
2059
|
-
}
|
|
2060
|
-
});
|
|
2061
|
-
monacoEditor.onKeyDown((l) => {
|
|
2062
|
-
if (l.code === "ArrowUp") {
|
|
2063
|
-
const selection = monacoEditor.getSelection();
|
|
2064
|
-
if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
|
|
2065
|
-
setNavigateAway("up");
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
if (l.code === "ArrowDown") {
|
|
2069
|
-
const selection = monacoEditor.getSelection();
|
|
2070
|
-
const totalLines = monacoEditor.getModel().getLineCount();
|
|
2071
|
-
if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
|
|
2072
|
-
setNavigateAway("down");
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
if (l.code === "Backspace") {
|
|
2076
|
-
const selection = monacoEditor.getSelection();
|
|
2077
|
-
if (selection.endColumn === 1 && selection.endLineNumber === 1 && selection.positionColumn === 1 && selection.positionLineNumber === 1 && selection.selectionStartColumn === 1 && selection.selectionStartLineNumber === 1 && selection.startColumn === 1 && selection.startLineNumber === 1) {
|
|
2078
|
-
setNavigateAway("remove");
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
});
|
|
2082
|
-
}
|
|
2083
|
-
return /* @__PURE__ */ React.createElement(
|
|
2084
|
-
"div",
|
|
2085
|
-
{
|
|
2086
|
-
...attributes,
|
|
2087
|
-
className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
|
|
2088
|
-
},
|
|
2089
|
-
/* @__PURE__ */ React.createElement("style", null, `.monaco-editor .editor-widget {
|
|
2090
|
-
display: none !important;
|
|
2091
|
-
visibility: hidden !important;
|
|
2092
|
-
}`),
|
|
2093
|
-
props.children,
|
|
2094
|
-
/* @__PURE__ */ React.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement(
|
|
2095
|
-
Autocomplete,
|
|
2096
|
-
{
|
|
2097
|
-
items: items2,
|
|
2098
|
-
value: currentItem,
|
|
2099
|
-
defaultQuery: "plaintext",
|
|
2100
|
-
onChange: (item) => plateCommon.setNodes(editor, { lang: item.key })
|
|
2101
|
-
}
|
|
2102
|
-
)), /* @__PURE__ */ React.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React.createElement(
|
|
2103
|
-
MonacoEditor,
|
|
2104
|
-
{
|
|
2105
|
-
path: id,
|
|
2106
|
-
onMount: handleEditorDidMount,
|
|
2107
|
-
options: {
|
|
2108
|
-
scrollBeyondLastLine: false,
|
|
2109
|
-
// automaticLayout: true,
|
|
2110
|
-
tabSize: 2,
|
|
2111
|
-
disableLayerHinting: true,
|
|
2112
|
-
accessibilitySupport: "off",
|
|
2113
|
-
codeLens: false,
|
|
2114
|
-
wordWrap: "on",
|
|
2115
|
-
minimap: {
|
|
2116
|
-
enabled: false
|
|
2117
|
-
},
|
|
2118
|
-
fontSize: 14,
|
|
2119
|
-
lineHeight: 2,
|
|
2120
|
-
formatOnPaste: true,
|
|
2121
|
-
lineNumbers: "off",
|
|
2122
|
-
formatOnType: true,
|
|
2123
|
-
fixedOverflowWidgets: true,
|
|
2124
|
-
// Takes too much horizontal space for iframe
|
|
2125
|
-
folding: false,
|
|
2126
|
-
renderLineHighlight: "none",
|
|
2127
|
-
scrollbar: {
|
|
2128
|
-
verticalScrollbarSize: 1,
|
|
2129
|
-
horizontalScrollbarSize: 1,
|
|
2130
|
-
// https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
|
|
2131
|
-
alwaysConsumeMouseWheel: false
|
|
2132
|
-
}
|
|
2133
|
-
},
|
|
2134
|
-
language: String(language),
|
|
2135
|
-
value: String(element.value),
|
|
2136
|
-
onChange: (value2) => {
|
|
2137
|
-
plateCommon.setNodes(editor, { value: value2, lang: language });
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
)))
|
|
2141
|
-
);
|
|
2142
|
-
};
|
|
2143
|
-
const CodeBlockElement = cn$1.withRef(
|
|
2144
|
-
({ className, ...props }, ref) => {
|
|
2145
|
-
const { element } = props;
|
|
2146
|
-
const state = plateCodeBlock.useCodeBlockElementState({ element });
|
|
2147
|
-
return /* @__PURE__ */ React.createElement(
|
|
2148
|
-
plateCommon.PlateElement,
|
|
2149
|
-
{
|
|
2150
|
-
className: cn$1.cn("relative py-1", state.className, className),
|
|
2151
|
-
ref,
|
|
2152
|
-
...props
|
|
2153
|
-
},
|
|
2154
|
-
/* @__PURE__ */ React.createElement(CodeBlock, { ...props })
|
|
2155
|
-
);
|
|
2156
|
-
}
|
|
2157
|
-
);
|
|
2158
|
-
const buttonVariants$1 = classVarianceAuthority.cva(
|
|
2159
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
2160
|
-
{
|
|
2161
|
-
defaultVariants: {
|
|
2162
|
-
size: "default",
|
|
2163
|
-
variant: "default"
|
|
2164
|
-
},
|
|
2165
|
-
variants: {
|
|
2166
|
-
isMenu: {
|
|
2167
|
-
true: "h-auto w-full cursor-pointer justify-start"
|
|
2168
|
-
},
|
|
2169
|
-
size: {
|
|
2170
|
-
default: "h-10 px-4 py-2",
|
|
2171
|
-
icon: "size-10",
|
|
2172
|
-
lg: "h-11 rounded-md px-8",
|
|
2173
|
-
none: "",
|
|
2174
|
-
sm: "h-9 rounded-md px-3",
|
|
2175
|
-
sms: "size-9 rounded-md px-0",
|
|
2176
|
-
xs: "h-8 rounded-md px-3"
|
|
2177
|
-
},
|
|
2178
|
-
variant: {
|
|
2179
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
2180
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
2181
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
2182
|
-
inlineLink: "text-base text-primary underline underline-offset-4",
|
|
2183
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
2184
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
2185
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
}
|
|
2189
|
-
);
|
|
2190
|
-
const Button$2 = cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
|
|
2191
|
-
const Comp = asChild ? reactSlot.Slot : "button";
|
|
2192
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
2193
|
-
Comp,
|
|
2194
|
-
{
|
|
2195
|
-
className: cn$1.cn(buttonVariants$1({ className, isMenu, size, variant })),
|
|
2196
|
-
ref,
|
|
2197
|
-
...props
|
|
2198
|
-
}
|
|
2199
|
-
);
|
|
2200
|
-
});
|
|
2201
|
-
const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
2202
|
-
const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
2203
|
-
const DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
|
|
2204
|
-
const DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
|
|
2205
|
-
const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
2206
|
-
const DropdownMenuSubTrigger = cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2207
|
-
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
2208
|
-
{
|
|
2209
|
-
className: cn$1.cn(
|
|
2210
|
-
"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",
|
|
2211
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2212
|
-
inset && "pl-8",
|
|
2213
|
-
className
|
|
2214
|
-
),
|
|
2215
|
-
ref,
|
|
2216
|
-
...props
|
|
2217
|
-
},
|
|
2218
|
-
children,
|
|
2219
|
-
/* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
|
|
2220
|
-
));
|
|
2221
|
-
const DropdownMenuSubContent = cn$1.withCn(
|
|
2222
|
-
DropdownMenuPrimitive__namespace.SubContent,
|
|
2223
|
-
"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"
|
|
2224
|
-
);
|
|
2225
|
-
const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
|
|
2226
|
-
className: cn$1.cn(
|
|
2227
|
-
"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"
|
|
2228
|
-
),
|
|
2229
|
-
sideOffset: 4
|
|
2230
|
-
});
|
|
2231
|
-
const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
|
|
2232
|
-
const menuItemVariants = classVarianceAuthority.cva(
|
|
2233
|
-
cn$1.cn(
|
|
2234
|
-
"relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
2235
|
-
"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
2236
|
-
),
|
|
2237
|
-
{
|
|
2238
|
-
variants: {
|
|
2239
|
-
inset: {
|
|
2240
|
-
true: "pl-8"
|
|
2241
|
-
}
|
|
2242
|
-
}
|
|
2243
|
-
}
|
|
2244
|
-
);
|
|
2245
|
-
const DropdownMenuItem = cn$1.withVariants(
|
|
2246
|
-
DropdownMenuPrimitive__namespace.Item,
|
|
2247
|
-
menuItemVariants,
|
|
2248
|
-
["inset"]
|
|
2249
|
-
);
|
|
2250
|
-
const DropdownMenuCheckboxItem = cn$1.withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2251
|
-
DropdownMenuPrimitive__namespace.CheckboxItem,
|
|
2252
|
-
{
|
|
2253
|
-
className: cn$1.cn(
|
|
2254
|
-
"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",
|
|
2255
|
-
"cursor-pointer",
|
|
2256
|
-
className
|
|
2257
|
-
),
|
|
2258
|
-
ref,
|
|
2259
|
-
...props
|
|
2260
|
-
},
|
|
2261
|
-
/* @__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" }))),
|
|
2262
|
-
children
|
|
2263
|
-
));
|
|
2264
|
-
const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2265
|
-
DropdownMenuPrimitive__namespace.RadioItem,
|
|
2266
|
-
{
|
|
2267
|
-
className: cn$1.cn(
|
|
2268
|
-
"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",
|
|
2269
|
-
"h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
|
|
2270
|
-
className
|
|
2271
|
-
),
|
|
2272
|
-
ref,
|
|
2273
|
-
...props
|
|
2274
|
-
},
|
|
2275
|
-
!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" }))),
|
|
2276
|
-
children
|
|
2277
|
-
));
|
|
2278
|
-
const dropdownMenuLabelVariants = classVarianceAuthority.cva(
|
|
2279
|
-
cn$1.cn("select-none px-2 py-1.5 text-sm font-semibold"),
|
|
2280
|
-
{
|
|
2281
|
-
variants: {
|
|
2282
|
-
inset: {
|
|
2283
|
-
true: "pl-8"
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
}
|
|
2287
|
-
);
|
|
2288
|
-
const DropdownMenuLabel = cn$1.withVariants(
|
|
2289
|
-
DropdownMenuPrimitive__namespace.Label,
|
|
2290
|
-
dropdownMenuLabelVariants,
|
|
2291
|
-
["inset"]
|
|
2292
|
-
);
|
|
2293
|
-
const DropdownMenuSeparator = cn$1.withCn(
|
|
2294
|
-
DropdownMenuPrimitive__namespace.Separator,
|
|
2295
|
-
"-mx-1 my-1 h-px bg-muted"
|
|
2296
|
-
);
|
|
2297
|
-
cn$1.withCn(
|
|
2298
|
-
cn$1.createPrimitiveElement("span"),
|
|
2299
|
-
"ml-auto text-xs tracking-widest opacity-60"
|
|
2300
|
-
);
|
|
2301
|
-
const useOpenState = () => {
|
|
2302
|
-
const [open2, setOpen] = React.useState(false);
|
|
2303
|
-
const onOpenChange = React.useCallback(
|
|
2304
|
-
(_value = !open2) => {
|
|
2305
|
-
setOpen(_value);
|
|
2306
|
-
},
|
|
2307
|
-
[open2]
|
|
2308
|
-
);
|
|
2309
|
-
return {
|
|
2310
|
-
onOpenChange,
|
|
2311
|
-
open: open2
|
|
2312
|
-
};
|
|
2313
|
-
};
|
|
2314
|
-
const Popover$2 = PopoverPrimitive__namespace.Root;
|
|
2315
|
-
const popoverVariants = classVarianceAuthority.cva(
|
|
2316
|
-
"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"
|
|
2317
|
-
);
|
|
2318
|
-
const PopoverContent$1 = cn$1.withRef(
|
|
2319
|
-
({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
|
|
2320
|
-
PopoverPrimitive__namespace.Content,
|
|
2321
|
-
{
|
|
2322
|
-
align,
|
|
2323
|
-
className: cn$1.cn(popoverVariants(), className),
|
|
2324
|
-
ref,
|
|
2325
|
-
sideOffset,
|
|
2326
|
-
style: { zIndex: 1e3, ...style },
|
|
2327
|
-
...props
|
|
2328
|
-
}
|
|
2329
|
-
))
|
|
2330
|
-
);
|
|
2331
|
-
const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
|
|
2332
|
-
defaultVariants: {
|
|
2333
|
-
orientation: "horizontal"
|
|
2334
|
-
},
|
|
2335
|
-
variants: {
|
|
2336
|
-
orientation: {
|
|
2337
|
-
horizontal: "h-px w-full",
|
|
2338
|
-
vertical: "h-full w-px"
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
});
|
|
2342
|
-
const Separator = cn$1.withVariants(
|
|
2343
|
-
cn$1.withProps(SeparatorPrimitive__namespace.Root, {
|
|
2344
|
-
decorative: true,
|
|
2345
|
-
orientation: "horizontal"
|
|
2346
|
-
}),
|
|
2347
|
-
separatorVariants
|
|
2348
|
-
);
|
|
2349
|
-
const TableBordersDropdownMenuContent = cn$1.withRef((props, ref) => {
|
|
2350
|
-
const {
|
|
2351
|
-
getOnSelectTableBorder,
|
|
2352
|
-
hasBottomBorder,
|
|
2353
|
-
hasLeftBorder,
|
|
2354
|
-
hasNoBorders,
|
|
2355
|
-
hasOuterBorders,
|
|
2356
|
-
hasRightBorder,
|
|
2357
|
-
hasTopBorder
|
|
2358
|
-
} = plateTable.useTableBordersDropdownMenuContentState();
|
|
2359
|
-
return /* @__PURE__ */ React.createElement(
|
|
2360
|
-
DropdownMenuContent,
|
|
2361
|
-
{
|
|
2362
|
-
align: "start",
|
|
2363
|
-
className: cn$1.cn("min-w-[220px]"),
|
|
2364
|
-
ref,
|
|
2365
|
-
side: "right",
|
|
2366
|
-
sideOffset: 0,
|
|
2367
|
-
...props
|
|
2368
|
-
},
|
|
2369
|
-
/* @__PURE__ */ React.createElement(
|
|
2370
|
-
DropdownMenuCheckboxItem,
|
|
2371
|
-
{
|
|
2372
|
-
checked: hasBottomBorder,
|
|
2373
|
-
onCheckedChange: getOnSelectTableBorder("bottom")
|
|
2374
|
-
},
|
|
2375
|
-
/* @__PURE__ */ React.createElement(Icons.borderBottom, { className: iconVariants({ size: "sm" }) }),
|
|
2376
|
-
/* @__PURE__ */ React.createElement("div", null, "Bottom Border")
|
|
2377
|
-
),
|
|
2378
|
-
/* @__PURE__ */ React.createElement(
|
|
2379
|
-
DropdownMenuCheckboxItem,
|
|
2380
|
-
{
|
|
2381
|
-
checked: hasTopBorder,
|
|
2382
|
-
onCheckedChange: getOnSelectTableBorder("top")
|
|
2383
|
-
},
|
|
2384
|
-
/* @__PURE__ */ React.createElement(Icons.borderTop, { className: iconVariants({ size: "sm" }) }),
|
|
2385
|
-
/* @__PURE__ */ React.createElement("div", null, "Top Border")
|
|
2386
|
-
),
|
|
2387
|
-
/* @__PURE__ */ React.createElement(
|
|
2388
|
-
DropdownMenuCheckboxItem,
|
|
2389
|
-
{
|
|
2390
|
-
checked: hasLeftBorder,
|
|
2391
|
-
onCheckedChange: getOnSelectTableBorder("left")
|
|
2392
|
-
},
|
|
2393
|
-
/* @__PURE__ */ React.createElement(Icons.borderLeft, { className: iconVariants({ size: "sm" }) }),
|
|
2394
|
-
/* @__PURE__ */ React.createElement("div", null, "Left Border")
|
|
2395
|
-
),
|
|
2396
|
-
/* @__PURE__ */ React.createElement(
|
|
2397
|
-
DropdownMenuCheckboxItem,
|
|
2398
|
-
{
|
|
2399
|
-
checked: hasRightBorder,
|
|
2400
|
-
onCheckedChange: getOnSelectTableBorder("right")
|
|
2401
|
-
},
|
|
2402
|
-
/* @__PURE__ */ React.createElement(Icons.borderRight, { className: iconVariants({ size: "sm" }) }),
|
|
2403
|
-
/* @__PURE__ */ React.createElement("div", null, "Right Border")
|
|
2404
|
-
),
|
|
2405
|
-
/* @__PURE__ */ React.createElement(Separator, null),
|
|
2406
|
-
/* @__PURE__ */ React.createElement(
|
|
2407
|
-
DropdownMenuCheckboxItem,
|
|
2408
|
-
{
|
|
2409
|
-
checked: hasNoBorders,
|
|
2410
|
-
onCheckedChange: getOnSelectTableBorder("none")
|
|
2411
|
-
},
|
|
2412
|
-
/* @__PURE__ */ React.createElement(Icons.borderNone, { className: iconVariants({ size: "sm" }) }),
|
|
2413
|
-
/* @__PURE__ */ React.createElement("div", null, "No Border")
|
|
2414
|
-
),
|
|
2415
|
-
/* @__PURE__ */ React.createElement(
|
|
2416
|
-
DropdownMenuCheckboxItem,
|
|
2417
|
-
{
|
|
2418
|
-
checked: hasOuterBorders,
|
|
2419
|
-
onCheckedChange: getOnSelectTableBorder("outer")
|
|
2420
|
-
},
|
|
2421
|
-
/* @__PURE__ */ React.createElement(Icons.borderAll, { className: iconVariants({ size: "sm" }) }),
|
|
2422
|
-
/* @__PURE__ */ React.createElement("div", null, "Outside Borders")
|
|
2423
|
-
)
|
|
2424
|
-
);
|
|
2425
|
-
});
|
|
2426
|
-
const TableFloatingToolbar = cn$1.withRef(
|
|
2427
|
-
({ children, ...props }, ref) => {
|
|
2428
|
-
const element = plateCommon.useElement();
|
|
2429
|
-
const { props: buttonProps } = plateCommon.useRemoveNodeButton({ element });
|
|
2430
|
-
const selectionCollapsed = plateCommon.useEditorSelector(
|
|
2431
|
-
(editor2) => !plateCommon.isSelectionExpanded(editor2),
|
|
2432
|
-
[]
|
|
2433
|
-
);
|
|
2434
|
-
const readOnly = slateReact.useReadOnly();
|
|
2435
|
-
const selected = slateReact.useSelected();
|
|
2436
|
-
const editor = plateCommon.useEditorRef();
|
|
2437
|
-
const collapsed = !readOnly && selected && selectionCollapsed;
|
|
2438
|
-
const open2 = !readOnly && selected;
|
|
2439
|
-
const { canMerge, canUnmerge } = plateTable.useTableMergeState();
|
|
2440
|
-
const mergeContent = canMerge && /* @__PURE__ */ React.createElement(
|
|
2441
|
-
Button$2,
|
|
2442
|
-
{
|
|
2443
|
-
contentEditable: false,
|
|
2444
|
-
isMenu: true,
|
|
2445
|
-
onClick: () => plateTable.mergeTableCells(editor),
|
|
2446
|
-
variant: "ghost"
|
|
2447
|
-
},
|
|
2448
|
-
/* @__PURE__ */ React.createElement(Icons.combine, { className: "mr-2 size-4" }),
|
|
2449
|
-
"Merge"
|
|
2450
|
-
);
|
|
2451
|
-
const unmergeButton = canUnmerge && /* @__PURE__ */ React.createElement(
|
|
2452
|
-
Button$2,
|
|
2453
|
-
{
|
|
2454
|
-
contentEditable: false,
|
|
2455
|
-
isMenu: true,
|
|
2456
|
-
onClick: () => plateTable.unmergeTableCells(editor),
|
|
2457
|
-
variant: "ghost"
|
|
2458
|
-
},
|
|
2459
|
-
/* @__PURE__ */ React.createElement(Icons.ungroup, { className: "mr-2 size-4" }),
|
|
2460
|
-
"Unmerge"
|
|
2461
|
-
);
|
|
2462
|
-
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"));
|
|
2463
|
-
return /* @__PURE__ */ React.createElement(Popover$2, { modal: false, open: open2 }, /* @__PURE__ */ React.createElement(PopoverPrimitive.PopoverAnchor, { asChild: true }, children), (canMerge || canUnmerge || collapsed) && /* @__PURE__ */ React.createElement(
|
|
2464
|
-
PopoverContent$1,
|
|
2465
|
-
{
|
|
2466
|
-
className: cn$1.cn(
|
|
2467
|
-
popoverVariants(),
|
|
2468
|
-
"flex w-[220px] flex-col gap-1 p-1"
|
|
2469
|
-
),
|
|
2470
|
-
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2471
|
-
ref,
|
|
2472
|
-
...props
|
|
2473
|
-
},
|
|
2474
|
-
unmergeButton,
|
|
2475
|
-
mergeContent,
|
|
2476
|
-
bordersContent
|
|
2477
|
-
));
|
|
2478
|
-
}
|
|
2479
|
-
);
|
|
2480
|
-
const TableElement = plateCommon.withHOC(
|
|
2481
|
-
plateTable.TableProvider,
|
|
2482
|
-
cn$1.withRef(({ children, className, ...props }, ref) => {
|
|
2483
|
-
const { colSizes, isSelectingCell, marginLeft, minColumnWidth } = plateTable.useTableElementState();
|
|
2484
|
-
const { colGroupProps, props: tableProps } = plateTable.useTableElement();
|
|
2485
|
-
return /* @__PURE__ */ React.createElement(TableFloatingToolbar, null, /* @__PURE__ */ React.createElement("div", { style: { paddingLeft: marginLeft } }, /* @__PURE__ */ React.createElement(
|
|
2486
|
-
plateCommon.PlateElement,
|
|
2487
|
-
{
|
|
2488
|
-
asChild: true,
|
|
2489
|
-
className: cn$1.cn(
|
|
2490
|
-
"my-4 ml-px mr-0 table h-px w-full table-fixed border-collapse",
|
|
2491
|
-
isSelectingCell && "[&_*::selection]:bg-none",
|
|
2492
|
-
className
|
|
2493
|
-
),
|
|
2494
|
-
ref,
|
|
2495
|
-
...tableProps,
|
|
2496
|
-
...props
|
|
2497
|
-
},
|
|
2498
|
-
/* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("colgroup", { ...colGroupProps }, colSizes.map((width, index) => /* @__PURE__ */ React.createElement(
|
|
2499
|
-
"col",
|
|
2500
|
-
{
|
|
2501
|
-
key: index,
|
|
2502
|
-
style: {
|
|
2503
|
-
minWidth: minColumnWidth,
|
|
2504
|
-
width: width || void 0
|
|
2505
|
-
}
|
|
2506
|
-
}
|
|
2507
|
-
))), /* @__PURE__ */ React.createElement("tbody", { className: "min-w-full" }, children))
|
|
2508
|
-
)));
|
|
2509
|
-
})
|
|
2510
|
-
);
|
|
2511
|
-
const TableRowElement = cn$1.withRef(({ children, hideBorder, ...props }, ref) => {
|
|
2512
|
-
return /* @__PURE__ */ React.createElement(
|
|
2513
|
-
plateCommon.PlateElement,
|
|
2514
|
-
{
|
|
2515
|
-
asChild: true,
|
|
2516
|
-
className: cn$1.cn("h-full", hideBorder && "border-none"),
|
|
2517
|
-
ref,
|
|
2518
|
-
...props
|
|
2519
|
-
},
|
|
2520
|
-
/* @__PURE__ */ React.createElement("tr", null, children)
|
|
2521
|
-
);
|
|
2522
|
-
});
|
|
2523
2299
|
const TableCellElement = cn$1.withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
|
|
2524
2300
|
var _a, _b, _c, _d;
|
|
2525
2301
|
const { element } = props;
|
|
@@ -2631,6 +2407,371 @@ var __publicField = (obj, key, value) => {
|
|
|
2631
2407
|
const TableCellHeaderElement = cn$1.withProps(TableCellElement, {
|
|
2632
2408
|
isHeader: true
|
|
2633
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
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
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
|
|
2450
|
+
}
|
|
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"
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
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"
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
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();
|
|
2611
|
+
return /* @__PURE__ */ React.createElement(
|
|
2612
|
+
DropdownMenuContent,
|
|
2613
|
+
{
|
|
2614
|
+
align: "start",
|
|
2615
|
+
className: cn$1.cn("min-w-[220px]"),
|
|
2616
|
+
ref,
|
|
2617
|
+
side: "right",
|
|
2618
|
+
sideOffset: 0,
|
|
2619
|
+
...props
|
|
2620
|
+
},
|
|
2621
|
+
/* @__PURE__ */ React.createElement(
|
|
2622
|
+
DropdownMenuCheckboxItem,
|
|
2623
|
+
{
|
|
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,
|
|
2632
|
+
{
|
|
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
|
+
)
|
|
2676
|
+
);
|
|
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,
|
|
2694
|
+
{
|
|
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(),
|
|
2723
|
+
ref,
|
|
2724
|
+
...props
|
|
2725
|
+
},
|
|
2726
|
+
unmergeButton,
|
|
2727
|
+
mergeContent,
|
|
2728
|
+
bordersContent
|
|
2729
|
+
));
|
|
2730
|
+
}
|
|
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
|
+
});
|
|
2634
2775
|
const blockClasses = "mt-0.5";
|
|
2635
2776
|
const headerClasses = "font-normal";
|
|
2636
2777
|
const Components = () => {
|
|
@@ -2736,6 +2877,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2736
2877
|
}
|
|
2737
2878
|
)
|
|
2738
2879
|
),
|
|
2880
|
+
[ELEMENT_MERMAID]: MermaidElement,
|
|
2739
2881
|
[plate.ELEMENT_BLOCKQUOTE]: BlockquoteElement,
|
|
2740
2882
|
[plate.ELEMENT_CODE_BLOCK]: CodeBlockElement,
|
|
2741
2883
|
[plate.ELEMENT_CODE_LINE]: CodeLineElement,
|
|
@@ -3230,7 +3372,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3230
3372
|
{
|
|
3231
3373
|
type: "string",
|
|
3232
3374
|
label: "Caption",
|
|
3233
|
-
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
3375
|
+
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
3376
|
+
"."
|
|
3377
|
+
),
|
|
3234
3378
|
component: "text"
|
|
3235
3379
|
}
|
|
3236
3380
|
]
|
|
@@ -3548,7 +3692,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3548
3692
|
};
|
|
3549
3693
|
const sizeClasses = {
|
|
3550
3694
|
small: `text-xs h-8 px-3`,
|
|
3551
|
-
medium: `text-sm h-10 px-
|
|
3695
|
+
medium: `text-sm h-10 px-8`,
|
|
3552
3696
|
custom: ``
|
|
3553
3697
|
};
|
|
3554
3698
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -5615,7 +5759,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5615
5759
|
return template.label ? template.label.toLowerCase().includes(filter.toLowerCase()) || name.toLowerCase().includes(filter.toLowerCase()) : name.toLowerCase().includes(filter.toLowerCase());
|
|
5616
5760
|
});
|
|
5617
5761
|
}, [filter]);
|
|
5618
|
-
return /* @__PURE__ */ React__namespace.createElement(react
|
|
5762
|
+
return /* @__PURE__ */ React__namespace.createElement(react.Popover, null, ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(react.PopoverButton, { as: "span" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5619
5763
|
IconButton,
|
|
5620
5764
|
{
|
|
5621
5765
|
variant: open2 ? "secondary" : "primary",
|
|
@@ -5624,7 +5768,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5624
5768
|
},
|
|
5625
5769
|
/* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
|
|
5626
5770
|
)), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute -bottom-1 right-0 z-50" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5627
|
-
react
|
|
5771
|
+
react.Transition,
|
|
5628
5772
|
{
|
|
5629
5773
|
enter: "transition duration-150 ease-out",
|
|
5630
5774
|
enterFrom: "transform opacity-0 -translate-y-2",
|
|
@@ -5633,7 +5777,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5633
5777
|
leaveFrom: "transform opacity-100 translate-y-0",
|
|
5634
5778
|
leaveTo: "transform opacity-0 -translate-y-2"
|
|
5635
5779
|
},
|
|
5636
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
5780
|
+
/* @__PURE__ */ React__namespace.createElement(react.PopoverPanel, { className: "relative overflow-hidden rounded-lg shadow-lg bg-white border border-gray-100" }, ({ close: close2 }) => /* @__PURE__ */ React__namespace.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto flex flex-col w-full h-full" }, showFilter && /* @__PURE__ */ React__namespace.createElement("div", { className: "sticky top-0 bg-gray-50 p-2 border-b border-gray-100 z-10" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5637
5781
|
"input",
|
|
5638
5782
|
{
|
|
5639
5783
|
type: "text",
|
|
@@ -5663,27 +5807,35 @@ var __publicField = (obj, key, value) => {
|
|
|
5663
5807
|
))))
|
|
5664
5808
|
))));
|
|
5665
5809
|
};
|
|
5666
|
-
const Group =
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5810
|
+
const Group = wrapFieldWithNoHeader(
|
|
5811
|
+
({ tinaForm, field }) => {
|
|
5812
|
+
const cms = useCMS$1();
|
|
5813
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5814
|
+
Header,
|
|
5815
|
+
{
|
|
5816
|
+
onClick: () => {
|
|
5817
|
+
const state = tinaForm.finalForm.getState();
|
|
5818
|
+
if (state.invalid === true) {
|
|
5819
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
5820
|
+
return;
|
|
5821
|
+
}
|
|
5822
|
+
cms.dispatch({
|
|
5823
|
+
type: "forms:set-active-field-name",
|
|
5824
|
+
value: { formId: tinaForm.id, fieldName: field.name }
|
|
5825
|
+
});
|
|
5677
5826
|
}
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5827
|
+
},
|
|
5828
|
+
field.label || field.name,
|
|
5829
|
+
field.description && /* @__PURE__ */ React__namespace.createElement(
|
|
5830
|
+
"span",
|
|
5831
|
+
{
|
|
5832
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
|
|
5833
|
+
dangerouslySetInnerHTML: { __html: field.description }
|
|
5834
|
+
}
|
|
5835
|
+
)
|
|
5836
|
+
));
|
|
5837
|
+
}
|
|
5838
|
+
);
|
|
5687
5839
|
const Header = ({ onClick, children }) => {
|
|
5688
5840
|
return /* @__PURE__ */ React__namespace.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5689
5841
|
"button",
|
|
@@ -5810,8 +5962,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5810
5962
|
onClick: () => setPickerIsOpen(!pickerIsOpen)
|
|
5811
5963
|
},
|
|
5812
5964
|
/* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
|
|
5813
|
-
), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react
|
|
5814
|
-
react
|
|
5965
|
+
), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: pickerIsOpen }, /* @__PURE__ */ React__namespace.createElement(
|
|
5966
|
+
react.TransitionChild,
|
|
5815
5967
|
{
|
|
5816
5968
|
enter: "transform transition-all ease-out duration-200",
|
|
5817
5969
|
enterFrom: "opacity-0 -translate-x-1/2",
|
|
@@ -5898,14 +6050,14 @@ var __publicField = (obj, key, value) => {
|
|
|
5898
6050
|
};
|
|
5899
6051
|
const BlockGroup = ({ category, templates, close: close2, isLast = false }) => {
|
|
5900
6052
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
5901
|
-
react
|
|
6053
|
+
react.Disclosure,
|
|
5902
6054
|
{
|
|
5903
6055
|
defaultOpen: true,
|
|
5904
6056
|
as: "div",
|
|
5905
6057
|
className: `left-0 right-0 relative`
|
|
5906
6058
|
},
|
|
5907
6059
|
({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5908
|
-
react
|
|
6060
|
+
react.DisclosureButton,
|
|
5909
6061
|
{
|
|
5910
6062
|
className: `relative block group text-left w-full text-base font-bold tracking-wide py-2 truncate ${templates.length === 0 ? `pointer-events-none` : ``} ${!isLast && (!open2 || templates.length === 0) && `border-b border-gray-100`}`
|
|
5911
6063
|
},
|
|
@@ -5923,7 +6075,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5923
6075
|
}
|
|
5924
6076
|
)
|
|
5925
6077
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
5926
|
-
react
|
|
6078
|
+
react.Transition,
|
|
5927
6079
|
{
|
|
5928
6080
|
enter: "transition duration-100 ease-out",
|
|
5929
6081
|
enterFrom: "transform scale-95 opacity-0",
|
|
@@ -5932,7 +6084,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5932
6084
|
leaveFrom: "transform scale-100 opacity-100",
|
|
5933
6085
|
leaveTo: "transform scale-95 opacity-0"
|
|
5934
6086
|
},
|
|
5935
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
6087
|
+
/* @__PURE__ */ React__namespace.createElement(react.DisclosurePanel, null, templates.length > 0 && /* @__PURE__ */ React__namespace.createElement(CardColumns, null, templates.map(([name, template], index) => /* @__PURE__ */ React__namespace.createElement(
|
|
5936
6088
|
BlockCard,
|
|
5937
6089
|
{
|
|
5938
6090
|
key: index,
|
|
@@ -9751,7 +9903,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9751
9903
|
const FormLists = (props) => {
|
|
9752
9904
|
const cms = useCMS();
|
|
9753
9905
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
9754
|
-
react
|
|
9906
|
+
react.Transition,
|
|
9755
9907
|
{
|
|
9756
9908
|
appear: true,
|
|
9757
9909
|
show: true,
|
|
@@ -10180,7 +10332,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10180
10332
|
"Event Log"
|
|
10181
10333
|
));
|
|
10182
10334
|
};
|
|
10183
|
-
const version = "2.
|
|
10335
|
+
const version = "2.4.0";
|
|
10184
10336
|
const Nav = ({
|
|
10185
10337
|
isLocalMode,
|
|
10186
10338
|
className = "",
|
|
@@ -10234,8 +10386,8 @@ var __publicField = (obj, key, value) => {
|
|
|
10234
10386
|
style: { maxWidth: `${sidebarWidth}px` },
|
|
10235
10387
|
...props
|
|
10236
10388
|
},
|
|
10237
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "border-b border-gray-200" }, /* @__PURE__ */ React__namespace.createElement(react
|
|
10238
|
-
react
|
|
10389
|
+
/* @__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(
|
|
10390
|
+
react.MenuButton,
|
|
10239
10391
|
{
|
|
10240
10392
|
className: `group w-full px-6 py-3 gap-2 flex justify-between items-center transition-colors duration-150 ease-out ${open2 ? "bg-gray-50" : "bg-transparent"}`
|
|
10241
10393
|
},
|
|
@@ -10258,7 +10410,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10258
10410
|
}
|
|
10259
10411
|
)
|
|
10260
10412
|
), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute bottom-3 right-5 z-50" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10261
|
-
react
|
|
10413
|
+
react.Transition,
|
|
10262
10414
|
{
|
|
10263
10415
|
enter: "transition duration-150 ease-out",
|
|
10264
10416
|
enterFrom: "transform opacity-0 -translate-y-2",
|
|
@@ -10267,7 +10419,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10267
10419
|
leaveFrom: "transform opacity-100 translate-y-0",
|
|
10268
10420
|
leaveTo: "transform opacity-0 -translate-y-2"
|
|
10269
10421
|
},
|
|
10270
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
10422
|
+
/* @__PURE__ */ React__namespace.createElement(react.MenuItems, { className: "bg-white border border-gray-150 rounded-lg shadow-lg flex flex-col items-stretch overflow-hidden" }, /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
|
|
10271
10423
|
"button",
|
|
10272
10424
|
{
|
|
10273
10425
|
className: `text-lg px-4 py-2 first:pt-3 last:pb-3 tracking-wide whitespace-nowrap flex items-center opacity-80 text-gray-600 hover:text-blue-400 hover:bg-gray-50 hover:opacity-100`,
|
|
@@ -10300,7 +10452,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10300
10452
|
},
|
|
10301
10453
|
/* @__PURE__ */ React__namespace.createElement(BiExit, { className: "w-6 h-auto mr-2 text-blue-400" }),
|
|
10302
10454
|
" Log Out"
|
|
10303
|
-
)), /* @__PURE__ */ React__namespace.createElement(react
|
|
10455
|
+
)), /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
|
|
10304
10456
|
WrappedSyncStatus,
|
|
10305
10457
|
{
|
|
10306
10458
|
cms,
|
|
@@ -10646,8 +10798,8 @@ var __publicField = (obj, key, value) => {
|
|
|
10646
10798
|
screen: activeScreen,
|
|
10647
10799
|
close: () => setActiveView(null)
|
|
10648
10800
|
}
|
|
10649
|
-
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react
|
|
10650
|
-
react
|
|
10801
|
+
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10802
|
+
react.TransitionChild,
|
|
10651
10803
|
{
|
|
10652
10804
|
enter: "transform transition-all ease-out duration-300",
|
|
10653
10805
|
enterFrom: "opacity-0 -translate-x-full",
|
|
@@ -10712,7 +10864,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10712
10864
|
))
|
|
10713
10865
|
))
|
|
10714
10866
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
10715
|
-
react
|
|
10867
|
+
react.TransitionChild,
|
|
10716
10868
|
{
|
|
10717
10869
|
enter: "ease-out duration-300",
|
|
10718
10870
|
enterFrom: "opacity-0",
|
|
@@ -12711,15 +12863,14 @@ var __publicField = (obj, key, value) => {
|
|
|
12711
12863
|
fields: fieldGroup.fields
|
|
12712
12864
|
}
|
|
12713
12865
|
) : /* @__PURE__ */ React__namespace.createElement(NoFieldsPlaceholder, null)
|
|
12714
|
-
)), !hideFooter && /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12866
|
+
)), !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(
|
|
12715
12867
|
ResetForm,
|
|
12716
12868
|
{
|
|
12717
12869
|
pristine,
|
|
12718
12870
|
reset: async () => {
|
|
12719
12871
|
finalForm2.reset();
|
|
12720
12872
|
await tinaForm.reset();
|
|
12721
|
-
}
|
|
12722
|
-
style: { flexGrow: 1 }
|
|
12873
|
+
}
|
|
12723
12874
|
},
|
|
12724
12875
|
tinaForm.buttons.reset
|
|
12725
12876
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -12728,8 +12879,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12728
12879
|
onClick: safeHandleSubmit,
|
|
12729
12880
|
disabled: !canSubmit,
|
|
12730
12881
|
busy: submitting,
|
|
12731
|
-
variant: "primary"
|
|
12732
|
-
style: { flexGrow: 3 }
|
|
12882
|
+
variant: "primary"
|
|
12733
12883
|
},
|
|
12734
12884
|
submitting && /* @__PURE__ */ React__namespace.createElement(LoadingDots, null),
|
|
12735
12885
|
!submitting && tinaForm.buttons.save
|
|
@@ -13247,15 +13397,15 @@ var __publicField = (obj, key, value) => {
|
|
|
13247
13397
|
);
|
|
13248
13398
|
};
|
|
13249
13399
|
const DotMenu = ({ onOpen, onRemove }) => {
|
|
13250
|
-
return /* @__PURE__ */ React.createElement(react
|
|
13251
|
-
react
|
|
13400
|
+
return /* @__PURE__ */ React.createElement(react.Popover, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React.createElement(
|
|
13401
|
+
react.PopoverButton,
|
|
13252
13402
|
{
|
|
13253
13403
|
as: "span",
|
|
13254
13404
|
className: "cursor-pointer h-full relative inline-flex items-center px-1 py-0.5 rounded-r-md border border-gray-200 bg-white text-gray-500 hover:bg-gray-50 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500"
|
|
13255
13405
|
},
|
|
13256
13406
|
/* @__PURE__ */ React.createElement(EllipsisIcon, { title: "Open options" })
|
|
13257
13407
|
), /* @__PURE__ */ React.createElement(
|
|
13258
|
-
react
|
|
13408
|
+
react.Transition,
|
|
13259
13409
|
{
|
|
13260
13410
|
enter: "transition ease-out duration-100",
|
|
13261
13411
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -13264,7 +13414,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13264
13414
|
leaveFrom: "transform opacity-100 scale-100",
|
|
13265
13415
|
leaveTo: "transform opacity-0 scale-95"
|
|
13266
13416
|
},
|
|
13267
|
-
/* @__PURE__ */ React.createElement(react
|
|
13417
|
+
/* @__PURE__ */ React.createElement(react.PopoverPanel, { className: "z-30 absolute origin-top-right right-0" }, /* @__PURE__ */ React.createElement("div", { className: "mt-2 -mr-1 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React.createElement("div", { className: "py-1" }, /* @__PURE__ */ React.createElement(
|
|
13268
13418
|
"span",
|
|
13269
13419
|
{
|
|
13270
13420
|
onClick: onOpen,
|
|
@@ -13699,6 +13849,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13699
13849
|
"Unordered List",
|
|
13700
13850
|
"Ordered List",
|
|
13701
13851
|
"Quote",
|
|
13852
|
+
"Mermaid",
|
|
13702
13853
|
"Heading 1",
|
|
13703
13854
|
"Heading 2",
|
|
13704
13855
|
"Heading 3",
|
|
@@ -13898,7 +14049,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13898
14049
|
cn$1.withProps(TooltipPrimitive__namespace.Content, {
|
|
13899
14050
|
sideOffset: 4
|
|
13900
14051
|
}),
|
|
13901
|
-
"z-
|
|
14052
|
+
"z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
|
|
13902
14053
|
);
|
|
13903
14054
|
function withTooltip(Component) {
|
|
13904
14055
|
return React.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
|
|
@@ -14024,30 +14175,42 @@ var __publicField = (obj, key, value) => {
|
|
|
14024
14175
|
Toolbar,
|
|
14025
14176
|
"p-1 sticky left-0 top-0 z-50 w-full justify-between overflow-x-auto border border-border bg-background"
|
|
14026
14177
|
);
|
|
14027
|
-
const
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
|
|
14033
|
-
const editor = plateCommon.useEditorState();
|
|
14034
|
-
const state = plate.useListToolbarButtonState({ nodeType });
|
|
14035
|
-
const { props } = plate.useListToolbarButton(state);
|
|
14036
|
-
return /* @__PURE__ */ React.createElement(
|
|
14037
|
-
ToolbarButton,
|
|
14038
|
-
{
|
|
14039
|
-
ref,
|
|
14040
|
-
tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
14041
|
-
...props,
|
|
14042
|
-
onClick: (e) => {
|
|
14043
|
-
e.preventDefault();
|
|
14044
|
-
e.stopPropagation();
|
|
14045
|
-
plate.toggleList(editor, { type: nodeType });
|
|
14178
|
+
const useResize = (ref, callback) => {
|
|
14179
|
+
React.useEffect(() => {
|
|
14180
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
14181
|
+
for (const entry of entries) {
|
|
14182
|
+
callback(entry);
|
|
14046
14183
|
}
|
|
14047
|
-
}
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14184
|
+
});
|
|
14185
|
+
if (ref.current) {
|
|
14186
|
+
resizeObserver.observe(ref.current);
|
|
14187
|
+
}
|
|
14188
|
+
return () => resizeObserver.disconnect();
|
|
14189
|
+
}, [ref.current]);
|
|
14190
|
+
};
|
|
14191
|
+
const STANDARD_ICON_WIDTH = 32;
|
|
14192
|
+
const HEADING_ICON_WITH_TEXT = 127;
|
|
14193
|
+
const HEADING_ICON_ONLY = 58;
|
|
14194
|
+
const EMBED_ICON_WIDTH = 78;
|
|
14195
|
+
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14196
|
+
const FLOAT_BUTTON_WIDTH = 25;
|
|
14197
|
+
const HEADING_LABEL = "Headings";
|
|
14198
|
+
const ToolbarContext = React.createContext(void 0);
|
|
14199
|
+
const ToolbarProvider = ({
|
|
14200
|
+
tinaForm,
|
|
14201
|
+
templates,
|
|
14202
|
+
overrides,
|
|
14203
|
+
children
|
|
14204
|
+
}) => {
|
|
14205
|
+
return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
|
|
14206
|
+
};
|
|
14207
|
+
const useToolbarContext = () => {
|
|
14208
|
+
const context = React.useContext(ToolbarContext);
|
|
14209
|
+
if (!context) {
|
|
14210
|
+
throw new Error("useToolbarContext must be used within a ToolbarProvider");
|
|
14211
|
+
}
|
|
14212
|
+
return context;
|
|
14213
|
+
};
|
|
14051
14214
|
const items$1 = [
|
|
14052
14215
|
{
|
|
14053
14216
|
description: "Paragraph",
|
|
@@ -14155,42 +14318,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14155
14318
|
))
|
|
14156
14319
|
)));
|
|
14157
14320
|
}
|
|
14158
|
-
const LinkToolbarButton = cn$1.withRef((rest, ref) => {
|
|
14159
|
-
const state = plateLink.useLinkToolbarButtonState();
|
|
14160
|
-
const { props } = plateLink.useLinkToolbarButton(state);
|
|
14161
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
|
|
14162
|
-
});
|
|
14163
|
-
const useBlockQuoteToolbarButtonState = () => {
|
|
14164
|
-
const editor = plateCommon.useEditorState();
|
|
14165
|
-
const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
|
|
14166
|
-
return {
|
|
14167
|
-
pressed: isBlockActive()
|
|
14168
|
-
};
|
|
14169
|
-
};
|
|
14170
|
-
const useBlockQuoteToolbarButton = (state) => {
|
|
14171
|
-
const editor = plateCommon.useEditorState();
|
|
14172
|
-
const onClick = () => {
|
|
14173
|
-
plateCommon.toggleNodeType(editor, {
|
|
14174
|
-
activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
|
|
14175
|
-
});
|
|
14176
|
-
};
|
|
14177
|
-
const onMouseDown = (e) => {
|
|
14178
|
-
e.preventDefault();
|
|
14179
|
-
e.stopPropagation();
|
|
14180
|
-
};
|
|
14181
|
-
return {
|
|
14182
|
-
props: {
|
|
14183
|
-
onClick,
|
|
14184
|
-
onMouseDown,
|
|
14185
|
-
pressed: state.pressed
|
|
14186
|
-
}
|
|
14187
|
-
};
|
|
14188
|
-
};
|
|
14189
|
-
const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14190
|
-
const state = useBlockQuoteToolbarButtonState();
|
|
14191
|
-
const { props } = useBlockQuoteToolbarButton(state);
|
|
14192
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
|
|
14193
|
-
});
|
|
14194
14321
|
const useCodeBlockToolbarButtonState = () => {
|
|
14195
14322
|
const editor = plateCommon.useEditorState();
|
|
14196
14323
|
const isBlockActive = () => helpers.isNodeActive(editor, plateCodeBlock.ELEMENT_CODE_BLOCK);
|
|
@@ -14252,101 +14379,67 @@ var __publicField = (obj, key, value) => {
|
|
|
14252
14379
|
const { props } = useImageToolbarButton(state);
|
|
14253
14380
|
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
|
|
14254
14381
|
});
|
|
14255
|
-
const
|
|
14256
|
-
const
|
|
14382
|
+
const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
|
|
14383
|
+
const editor = plateCommon.useEditorState();
|
|
14384
|
+
const state = plate.useListToolbarButtonState({ nodeType });
|
|
14385
|
+
const { props } = plate.useListToolbarButton(state);
|
|
14386
|
+
return /* @__PURE__ */ React.createElement(
|
|
14387
|
+
ToolbarButton,
|
|
14388
|
+
{
|
|
14389
|
+
ref,
|
|
14390
|
+
tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
14391
|
+
...props,
|
|
14392
|
+
onClick: (e) => {
|
|
14393
|
+
e.preventDefault();
|
|
14394
|
+
e.stopPropagation();
|
|
14395
|
+
plate.toggleList(editor, { type: nodeType });
|
|
14396
|
+
}
|
|
14397
|
+
},
|
|
14398
|
+
nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
|
|
14399
|
+
);
|
|
14400
|
+
});
|
|
14401
|
+
const LinkToolbarButton = cn$1.withRef((rest, ref) => {
|
|
14402
|
+
const state = plateLink.useLinkToolbarButtonState();
|
|
14403
|
+
const { props } = plateLink.useLinkToolbarButton(state);
|
|
14404
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
|
|
14405
|
+
});
|
|
14406
|
+
const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14407
|
+
const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
|
|
14408
|
+
const { props } = plateCommon.useMarkToolbarButton(state);
|
|
14409
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
14410
|
+
});
|
|
14411
|
+
const useMermaidToolbarButtonState = () => {
|
|
14412
|
+
const editor = plateCommon.useEditorState();
|
|
14413
|
+
const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_MERMAID);
|
|
14414
|
+
return {
|
|
14415
|
+
pressed: isBlockActive()
|
|
14416
|
+
};
|
|
14417
|
+
};
|
|
14418
|
+
const useMermaidToolbarButton = (state) => {
|
|
14419
|
+
const editor = plateCommon.useEditorState();
|
|
14420
|
+
const onClick = () => {
|
|
14421
|
+
plateCommon.insertEmptyElement(editor, ELEMENT_MERMAID, {
|
|
14422
|
+
nextBlock: true,
|
|
14423
|
+
select: true
|
|
14424
|
+
});
|
|
14425
|
+
};
|
|
14257
14426
|
const onMouseDown = (e) => {
|
|
14258
|
-
|
|
14427
|
+
e.preventDefault();
|
|
14428
|
+
e.stopPropagation();
|
|
14259
14429
|
};
|
|
14260
14430
|
return {
|
|
14261
14431
|
props: {
|
|
14432
|
+
onClick,
|
|
14262
14433
|
onMouseDown,
|
|
14263
|
-
pressed:
|
|
14434
|
+
pressed: state.pressed
|
|
14264
14435
|
}
|
|
14265
14436
|
};
|
|
14266
14437
|
};
|
|
14267
|
-
const
|
|
14268
|
-
const
|
|
14269
|
-
|
|
14438
|
+
const MermaidToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14439
|
+
const state = useMermaidToolbarButtonState();
|
|
14440
|
+
const { props } = useMermaidToolbarButton(state);
|
|
14441
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Mermaid", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.mermaid, null));
|
|
14270
14442
|
});
|
|
14271
|
-
const ToolbarContext = React.createContext(void 0);
|
|
14272
|
-
const ToolbarProvider = ({
|
|
14273
|
-
tinaForm,
|
|
14274
|
-
templates,
|
|
14275
|
-
overrides,
|
|
14276
|
-
children
|
|
14277
|
-
}) => {
|
|
14278
|
-
return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
|
|
14279
|
-
};
|
|
14280
|
-
const useToolbarContext = () => {
|
|
14281
|
-
const context = React.useContext(ToolbarContext);
|
|
14282
|
-
if (!context) {
|
|
14283
|
-
throw new Error("useToolbarContext must be used within a ToolbarProvider");
|
|
14284
|
-
}
|
|
14285
|
-
return context;
|
|
14286
|
-
};
|
|
14287
|
-
function TemplatesToolbarButton() {
|
|
14288
|
-
const { templates } = useToolbarContext();
|
|
14289
|
-
const editor = plateCommon.useEditorState();
|
|
14290
|
-
return /* @__PURE__ */ React.createElement(EmbedButton, { templates, editor });
|
|
14291
|
-
}
|
|
14292
|
-
const EmbedButton = ({ editor, templates }) => {
|
|
14293
|
-
const [open2, setOpen] = React.useState(false);
|
|
14294
|
-
const [filteredTemplates, setFilteredTemplates] = React.useState(templates);
|
|
14295
|
-
const filterChange = (e) => {
|
|
14296
|
-
const filterText = e.target.value.toLowerCase();
|
|
14297
|
-
setFilteredTemplates(
|
|
14298
|
-
templates.filter(
|
|
14299
|
-
(template) => template.name.toLowerCase().includes(filterText)
|
|
14300
|
-
)
|
|
14301
|
-
);
|
|
14302
|
-
};
|
|
14303
|
-
return /* @__PURE__ */ React.createElement(DropdownMenu, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { className: "inline-flex items-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-5 h-9 px-2 bg-transparent hover:bg-muted hover:text-muted-foreground aria-checked:bg-accent aria-checked:text-accent-foreground my-1 justify-between pr-1" }, /* @__PURE__ */ React.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React.createElement(
|
|
14304
|
-
PlusIcon,
|
|
14305
|
-
{
|
|
14306
|
-
className: `origin-center transition-all ease-out duration-150 ${open2 ? "rotate-45" : ""}`
|
|
14307
|
-
}
|
|
14308
|
-
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { className: "max-h-48 overflow-y-auto" }, templates.length > 10 && /* @__PURE__ */ React.createElement(
|
|
14309
|
-
"input",
|
|
14310
|
-
{
|
|
14311
|
-
type: "text",
|
|
14312
|
-
placeholder: "Filter templates...",
|
|
14313
|
-
className: "w-full p-2 border border-gray-300 rounded-md",
|
|
14314
|
-
onChange: filterChange
|
|
14315
|
-
}
|
|
14316
|
-
), /* @__PURE__ */ React.createElement(DropdownMenuSeparator, null), filteredTemplates.map((template) => /* @__PURE__ */ React.createElement(
|
|
14317
|
-
DropdownMenuItem,
|
|
14318
|
-
{
|
|
14319
|
-
key: template.name,
|
|
14320
|
-
onMouseDown: (e) => {
|
|
14321
|
-
e.preventDefault();
|
|
14322
|
-
close();
|
|
14323
|
-
insertMDX(editor, template);
|
|
14324
|
-
},
|
|
14325
|
-
className: ""
|
|
14326
|
-
},
|
|
14327
|
-
template.label || template.name
|
|
14328
|
-
))));
|
|
14329
|
-
};
|
|
14330
|
-
const STANDARD_ICON_WIDTH = 32;
|
|
14331
|
-
const HEADING_ICON_WITH_TEXT = 127;
|
|
14332
|
-
const HEADING_ICON_ONLY = 58;
|
|
14333
|
-
const EMBED_ICON_WIDTH = 78;
|
|
14334
|
-
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14335
|
-
const FLOAT_BUTTON_WIDTH = 25;
|
|
14336
|
-
const HEADING_LABEL = "Headings";
|
|
14337
|
-
const useResize = (ref, callback) => {
|
|
14338
|
-
React.useEffect(() => {
|
|
14339
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
14340
|
-
for (const entry of entries) {
|
|
14341
|
-
callback(entry);
|
|
14342
|
-
}
|
|
14343
|
-
});
|
|
14344
|
-
if (ref.current) {
|
|
14345
|
-
resizeObserver.observe(ref.current);
|
|
14346
|
-
}
|
|
14347
|
-
return () => resizeObserver.disconnect();
|
|
14348
|
-
}, [ref.current]);
|
|
14349
|
-
};
|
|
14350
14443
|
function OverflowMenu({
|
|
14351
14444
|
children,
|
|
14352
14445
|
...props
|
|
@@ -14356,6 +14449,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14356
14449
|
ToolbarButton,
|
|
14357
14450
|
{
|
|
14358
14451
|
showArrow: false,
|
|
14452
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14359
14453
|
className: "lg:min-w-[130px]",
|
|
14360
14454
|
isDropdown: true,
|
|
14361
14455
|
pressed: openState.open,
|
|
@@ -14364,6 +14458,63 @@ var __publicField = (obj, key, value) => {
|
|
|
14364
14458
|
/* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
|
|
14365
14459
|
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
|
|
14366
14460
|
}
|
|
14461
|
+
const useBlockQuoteToolbarButtonState = () => {
|
|
14462
|
+
const editor = plateCommon.useEditorState();
|
|
14463
|
+
const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
|
|
14464
|
+
return {
|
|
14465
|
+
pressed: isBlockActive()
|
|
14466
|
+
};
|
|
14467
|
+
};
|
|
14468
|
+
const useBlockQuoteToolbarButton = (state) => {
|
|
14469
|
+
const editor = plateCommon.useEditorState();
|
|
14470
|
+
const onClick = () => {
|
|
14471
|
+
plateCommon.toggleNodeType(editor, {
|
|
14472
|
+
activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
|
|
14473
|
+
});
|
|
14474
|
+
};
|
|
14475
|
+
const onMouseDown = (e) => {
|
|
14476
|
+
e.preventDefault();
|
|
14477
|
+
e.stopPropagation();
|
|
14478
|
+
};
|
|
14479
|
+
return {
|
|
14480
|
+
props: {
|
|
14481
|
+
onClick,
|
|
14482
|
+
onMouseDown,
|
|
14483
|
+
pressed: state.pressed
|
|
14484
|
+
}
|
|
14485
|
+
};
|
|
14486
|
+
};
|
|
14487
|
+
const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14488
|
+
const state = useBlockQuoteToolbarButtonState();
|
|
14489
|
+
const { props } = useBlockQuoteToolbarButton(state);
|
|
14490
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
|
|
14491
|
+
});
|
|
14492
|
+
const useRawMarkdownToolbarButton = () => {
|
|
14493
|
+
const { setRawMode } = useEditorContext();
|
|
14494
|
+
const onMouseDown = (e) => {
|
|
14495
|
+
setRawMode(true);
|
|
14496
|
+
};
|
|
14497
|
+
return {
|
|
14498
|
+
props: {
|
|
14499
|
+
onMouseDown,
|
|
14500
|
+
pressed: false
|
|
14501
|
+
}
|
|
14502
|
+
};
|
|
14503
|
+
};
|
|
14504
|
+
const RawMarkdownToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14505
|
+
const { props } = useRawMarkdownToolbarButton();
|
|
14506
|
+
return /* @__PURE__ */ React.createElement(
|
|
14507
|
+
ToolbarButton,
|
|
14508
|
+
{
|
|
14509
|
+
ref,
|
|
14510
|
+
tooltip: "Link",
|
|
14511
|
+
...rest,
|
|
14512
|
+
...props,
|
|
14513
|
+
"data-testid": "markdown-button"
|
|
14514
|
+
},
|
|
14515
|
+
/* @__PURE__ */ React.createElement(Icons.raw, null)
|
|
14516
|
+
);
|
|
14517
|
+
});
|
|
14367
14518
|
function TableDropdownMenu(props) {
|
|
14368
14519
|
const tableSelected = plateCommon.useEditorSelector(
|
|
14369
14520
|
(editor2) => plateCommon.someNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } }),
|
|
@@ -14466,6 +14617,49 @@ var __publicField = (obj, key, value) => {
|
|
|
14466
14617
|
)))
|
|
14467
14618
|
));
|
|
14468
14619
|
}
|
|
14620
|
+
function TemplatesToolbarButton() {
|
|
14621
|
+
const { templates } = useToolbarContext();
|
|
14622
|
+
const editor = plateCommon.useEditorState();
|
|
14623
|
+
return /* @__PURE__ */ React.createElement(EmbedButton, { templates, editor });
|
|
14624
|
+
}
|
|
14625
|
+
const EmbedButton = ({ editor, templates }) => {
|
|
14626
|
+
const [open2, setOpen] = React.useState(false);
|
|
14627
|
+
const [filteredTemplates, setFilteredTemplates] = React.useState(templates);
|
|
14628
|
+
const filterChange = (e) => {
|
|
14629
|
+
const filterText = e.target.value.toLowerCase();
|
|
14630
|
+
setFilteredTemplates(
|
|
14631
|
+
templates.filter(
|
|
14632
|
+
(template) => template.name.toLowerCase().includes(filterText)
|
|
14633
|
+
)
|
|
14634
|
+
);
|
|
14635
|
+
};
|
|
14636
|
+
return /* @__PURE__ */ React.createElement(DropdownMenu, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { className: "inline-flex items-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-5 h-9 px-2 bg-transparent hover:bg-muted hover:text-muted-foreground aria-checked:bg-accent aria-checked:text-accent-foreground my-1 justify-between pr-1" }, /* @__PURE__ */ React.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React.createElement(
|
|
14637
|
+
PlusIcon,
|
|
14638
|
+
{
|
|
14639
|
+
className: `origin-center transition-all ease-out duration-150 ${open2 ? "rotate-45" : ""}`
|
|
14640
|
+
}
|
|
14641
|
+
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { className: "max-h-48 overflow-y-auto" }, templates.length > 10 && /* @__PURE__ */ React.createElement(
|
|
14642
|
+
"input",
|
|
14643
|
+
{
|
|
14644
|
+
type: "text",
|
|
14645
|
+
placeholder: "Filter templates...",
|
|
14646
|
+
className: "w-full p-2 border border-gray-300 rounded-md",
|
|
14647
|
+
onChange: filterChange
|
|
14648
|
+
}
|
|
14649
|
+
), /* @__PURE__ */ React.createElement(DropdownMenuSeparator, null), filteredTemplates.map((template) => /* @__PURE__ */ React.createElement(
|
|
14650
|
+
DropdownMenuItem,
|
|
14651
|
+
{
|
|
14652
|
+
key: template.name,
|
|
14653
|
+
onMouseDown: (e) => {
|
|
14654
|
+
e.preventDefault();
|
|
14655
|
+
close();
|
|
14656
|
+
insertMDX(editor, template);
|
|
14657
|
+
},
|
|
14658
|
+
className: ""
|
|
14659
|
+
},
|
|
14660
|
+
template.label || template.name
|
|
14661
|
+
))));
|
|
14662
|
+
};
|
|
14469
14663
|
const toolbarItems = {
|
|
14470
14664
|
heading: {
|
|
14471
14665
|
label: HEADING_LABEL,
|
|
@@ -14518,6 +14712,11 @@ var __publicField = (obj, key, value) => {
|
|
|
14518
14712
|
width: () => STANDARD_ICON_WIDTH,
|
|
14519
14713
|
Component: /* @__PURE__ */ React.createElement(CodeBlockToolbarButton, null)
|
|
14520
14714
|
},
|
|
14715
|
+
mermaid: {
|
|
14716
|
+
label: "Mermaid",
|
|
14717
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14718
|
+
Component: /* @__PURE__ */ React.createElement(MermaidToolbarButton, null)
|
|
14719
|
+
},
|
|
14521
14720
|
table: {
|
|
14522
14721
|
label: "Table",
|
|
14523
14722
|
width: () => STANDARD_ICON_WIDTH,
|
|
@@ -14905,6 +15104,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14905
15104
|
createMdxBlockPlugin(),
|
|
14906
15105
|
createMdxInlinePlugin(),
|
|
14907
15106
|
createImgPlugin(),
|
|
15107
|
+
createMermaidPlugin(),
|
|
14908
15108
|
createInvalidMarkdownPlugin(),
|
|
14909
15109
|
plateLink.createLinkPlugin({
|
|
14910
15110
|
options: {
|
|
@@ -29912,6 +30112,7 @@ mutation addPendingDocumentMutation(
|
|
|
29912
30112
|
relativePath
|
|
29913
30113
|
filename
|
|
29914
30114
|
extension
|
|
30115
|
+
hasReferences
|
|
29915
30116
|
}
|
|
29916
30117
|
}
|
|
29917
30118
|
}
|
|
@@ -30003,6 +30204,9 @@ mutation addPendingDocumentMutation(
|
|
|
30003
30204
|
document(collection:$collection, relativePath:$relativePath) {
|
|
30004
30205
|
... on Document {
|
|
30005
30206
|
_values
|
|
30207
|
+
_sys {
|
|
30208
|
+
hasReferences
|
|
30209
|
+
}
|
|
30006
30210
|
}
|
|
30007
30211
|
}
|
|
30008
30212
|
}`;
|
|
@@ -31027,8 +31231,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31027
31231
|
}
|
|
31028
31232
|
)
|
|
31029
31233
|
}
|
|
31030
|
-
), !renderDesktopNav && /* @__PURE__ */ React.createElement(react
|
|
31031
|
-
react
|
|
31234
|
+
), !renderDesktopNav && /* @__PURE__ */ React.createElement(react.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
|
|
31235
|
+
react.TransitionChild,
|
|
31032
31236
|
{
|
|
31033
31237
|
enter: "transform transition-all ease-out duration-300",
|
|
31034
31238
|
enterFrom: "opacity-0 -translate-x-full",
|
|
@@ -31097,7 +31301,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31097
31301
|
))
|
|
31098
31302
|
))
|
|
31099
31303
|
), /* @__PURE__ */ React.createElement(
|
|
31100
|
-
react
|
|
31304
|
+
react.TransitionChild,
|
|
31101
31305
|
{
|
|
31102
31306
|
enter: "ease-out duration-300",
|
|
31103
31307
|
enterFrom: "opacity-0",
|
|
@@ -31551,8 +31755,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31551
31755
|
folder,
|
|
31552
31756
|
collectionName
|
|
31553
31757
|
}) => {
|
|
31554
|
-
return /* @__PURE__ */ React.createElement(react
|
|
31555
|
-
react
|
|
31758
|
+
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(
|
|
31759
|
+
react.Transition,
|
|
31556
31760
|
{
|
|
31557
31761
|
enter: "transition ease-out duration-100",
|
|
31558
31762
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -31561,7 +31765,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31561
31765
|
leaveFrom: "transform opacity-100 scale-100",
|
|
31562
31766
|
leaveTo: "transform opacity-0 scale-95"
|
|
31563
31767
|
},
|
|
31564
|
-
/* @__PURE__ */ React.createElement(react
|
|
31768
|
+
/* @__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(
|
|
31565
31769
|
reactRouterDom.Link,
|
|
31566
31770
|
{
|
|
31567
31771
|
to: `/${folder.fullyQualifiedName ? [
|
|
@@ -31729,6 +31933,23 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31729
31933
|
DeleteModal,
|
|
31730
31934
|
{
|
|
31731
31935
|
filename: vars.relativePath,
|
|
31936
|
+
checkRefsFunc: async () => {
|
|
31937
|
+
var _a2, _b2;
|
|
31938
|
+
try {
|
|
31939
|
+
const doc = await admin.fetchDocument(
|
|
31940
|
+
collection.name,
|
|
31941
|
+
vars.relativePath,
|
|
31942
|
+
true
|
|
31943
|
+
);
|
|
31944
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31945
|
+
} catch (error) {
|
|
31946
|
+
cms.alerts.error(
|
|
31947
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31948
|
+
);
|
|
31949
|
+
console.error(error);
|
|
31950
|
+
throw error;
|
|
31951
|
+
}
|
|
31952
|
+
},
|
|
31732
31953
|
deleteFunc: async () => {
|
|
31733
31954
|
try {
|
|
31734
31955
|
await admin.deleteDocument(vars);
|
|
@@ -31737,6 +31958,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31737
31958
|
);
|
|
31738
31959
|
reFetchCollection();
|
|
31739
31960
|
} catch (error) {
|
|
31961
|
+
if (error.message.indexOf("has references")) {
|
|
31962
|
+
cms.alerts.error(
|
|
31963
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31964
|
+
);
|
|
31965
|
+
return;
|
|
31966
|
+
}
|
|
31740
31967
|
cms.alerts.warn(
|
|
31741
31968
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31742
31969
|
);
|
|
@@ -31788,6 +32015,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31788
32015
|
cms.alerts.info("Document was successfully renamed");
|
|
31789
32016
|
reFetchCollection();
|
|
31790
32017
|
} catch (error) {
|
|
32018
|
+
if (error.message.indexOf("has references")) {
|
|
32019
|
+
cms.alerts.error(
|
|
32020
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
32021
|
+
);
|
|
32022
|
+
return;
|
|
32023
|
+
}
|
|
31791
32024
|
cms.alerts.warn(
|
|
31792
32025
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31793
32026
|
);
|
|
@@ -32261,8 +32494,19 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32261
32494
|
const NoDocumentsPlaceholder = () => {
|
|
32262
32495
|
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."));
|
|
32263
32496
|
};
|
|
32264
|
-
const DeleteModal = ({
|
|
32265
|
-
|
|
32497
|
+
const DeleteModal = ({
|
|
32498
|
+
close: close2,
|
|
32499
|
+
deleteFunc,
|
|
32500
|
+
checkRefsFunc,
|
|
32501
|
+
filename
|
|
32502
|
+
}) => {
|
|
32503
|
+
const [hasRefs, setHasRefs] = React.useState();
|
|
32504
|
+
React.useEffect(() => {
|
|
32505
|
+
checkRefsFunc().then((result) => {
|
|
32506
|
+
setHasRefs(result);
|
|
32507
|
+
});
|
|
32508
|
+
}, [filename, checkRefsFunc]);
|
|
32509
|
+
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(
|
|
32266
32510
|
Button$1,
|
|
32267
32511
|
{
|
|
32268
32512
|
style: { flexGrow: 3 },
|
|
@@ -33629,6 +33873,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33629
33873
|
exports2.useScreenPlugin = useScreenPlugin;
|
|
33630
33874
|
exports2.useTinaAuthRedirect = useTinaAuthRedirect;
|
|
33631
33875
|
exports2.wrapFieldWithError = wrapFieldWithError;
|
|
33876
|
+
exports2.wrapFieldWithNoHeader = wrapFieldWithNoHeader;
|
|
33632
33877
|
exports2.wrapFieldsWithMeta = wrapFieldsWithMeta;
|
|
33633
33878
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
33634
33879
|
});
|