tinacms 0.0.0-a690e47-20241003005744 → 0.0.0-a6daef4-20250115020754
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/types.d.ts +3 -0
- package/dist/cache/node-cache.d.ts +1 -0
- package/dist/client.js +23 -24
- package/dist/client.mjs +4 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1593 -1030
- package/dist/index.mjs +1583 -1016
- package/dist/{node-cache-7fa2452c.mjs → node-cache-4c336858.mjs} +18 -11
- package/dist/rich-text/index.d.ts +3 -0
- package/dist/rich-text/index.js +45 -12
- package/dist/rich-text/index.mjs +45 -12
- package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +4 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/fixed-toolbar-buttons.d.ts +0 -4
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +2 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-element.d.ts +11 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +20 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/resizable.d.ts +39 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-cell-element.d.ts +27 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-dropdown-menu.d.ts +3 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-element.d.ts +14 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-row-element.d.ts +13 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/text-area.d.ts +5 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +1 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/custom/mermaid-plugin.d.ts +2 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +4 -2
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +58 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +11 -3
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +3 -3
- package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
- package/package.json +29 -28
- package/dist/__vite-browser-external-d06ac358.mjs +0 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/plate"), require("
|
|
3
|
-
})(this, function(exports2, zod, React, reactDom, plate,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("slate-react"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("@react-hook/window-size"), require("graphql"), require("graphql-tag"), require("@tinacms/schema-tools"), require("yup"), require("@graphql-inspector/core"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate", "@udecode/plate-common", "@udecode/plate-slash-command", "slate-react", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "class-variance-authority", "lucide-react", "mermaid", "@udecode/plate-heading", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-table", "@udecode/plate-resizable", "@radix-ui/react-popover", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "@react-hook/window-size", "graphql", "graphql-tag", "@tinacms/schema-tools", "yup", "@graphql-inspector/core", "react-router-dom", "@tinacms/mdx"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
|
|
3
|
+
})(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, slateReact, plateCodeBlock, MonacoEditor, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, windowSize, graphql, gql, schemaTools, yup, core, reactRouterDom, mdx) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => {
|
|
@@ -26,13 +26,13 @@ var __publicField = (obj, key, value) => {
|
|
|
26
26
|
}
|
|
27
27
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
28
28
|
const PopoverPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(PopoverPrimitive);
|
|
29
|
+
const DropdownMenuPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(DropdownMenuPrimitive);
|
|
30
|
+
const SeparatorPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(SeparatorPrimitive);
|
|
29
31
|
const pkg__namespace$1 = /* @__PURE__ */ _interopNamespaceDefault(pkg$1);
|
|
30
32
|
const pkg__namespace = /* @__PURE__ */ _interopNamespaceDefault(pkg);
|
|
31
33
|
const dropzone__namespace = /* @__PURE__ */ _interopNamespaceDefault(dropzone);
|
|
32
34
|
const ToolbarPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(ToolbarPrimitive);
|
|
33
|
-
const SeparatorPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(SeparatorPrimitive);
|
|
34
35
|
const TooltipPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(TooltipPrimitive);
|
|
35
|
-
const DropdownMenuPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(DropdownMenuPrimitive);
|
|
36
36
|
const yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(yup);
|
|
37
37
|
const ModalProvider = ({ children }) => {
|
|
38
38
|
const [modalRootContainerRef, setModalRootContainerRef] = React.useState(
|
|
@@ -774,6 +774,22 @@ var __publicField = (obj, key, value) => {
|
|
|
774
774
|
);
|
|
775
775
|
};
|
|
776
776
|
}
|
|
777
|
+
function wrapFieldWithNoHeader(Field) {
|
|
778
|
+
return (props) => {
|
|
779
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
780
|
+
FieldMeta,
|
|
781
|
+
{
|
|
782
|
+
name: props.input.name,
|
|
783
|
+
label: false,
|
|
784
|
+
description: "",
|
|
785
|
+
error: props.meta.error,
|
|
786
|
+
index: props.index,
|
|
787
|
+
tinaForm: props.tinaForm
|
|
788
|
+
},
|
|
789
|
+
/* @__PURE__ */ React__namespace.createElement(Field, { ...props })
|
|
790
|
+
);
|
|
791
|
+
};
|
|
792
|
+
}
|
|
777
793
|
function wrapFieldWithError(Field) {
|
|
778
794
|
return (props) => {
|
|
779
795
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -846,6 +862,16 @@ var __publicField = (obj, key, value) => {
|
|
|
846
862
|
className,
|
|
847
863
|
...props
|
|
848
864
|
}) => {
|
|
865
|
+
if (typeof children === "string") {
|
|
866
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
867
|
+
"span",
|
|
868
|
+
{
|
|
869
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
|
|
870
|
+
...props,
|
|
871
|
+
dangerouslySetInnerHTML: { __html: children }
|
|
872
|
+
}
|
|
873
|
+
);
|
|
874
|
+
}
|
|
849
875
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
850
876
|
"span",
|
|
851
877
|
{
|
|
@@ -882,6 +908,20 @@ var __publicField = (obj, key, value) => {
|
|
|
882
908
|
const useTemplates = () => {
|
|
883
909
|
return React.useContext(EditorContext);
|
|
884
910
|
};
|
|
911
|
+
const BlockquoteElement = cn$1.withRef(
|
|
912
|
+
({ children, className, ...props }, ref) => {
|
|
913
|
+
return /* @__PURE__ */ React.createElement(
|
|
914
|
+
plateCommon.PlateElement,
|
|
915
|
+
{
|
|
916
|
+
asChild: true,
|
|
917
|
+
className: cn$1.cn("my-1 border-l-2 pl-6 italic", className),
|
|
918
|
+
ref,
|
|
919
|
+
...props
|
|
920
|
+
},
|
|
921
|
+
/* @__PURE__ */ React.createElement("blockquote", null, children)
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
);
|
|
885
925
|
function classNames$1(...classes) {
|
|
886
926
|
return classes.filter(Boolean).join(" ");
|
|
887
927
|
}
|
|
@@ -891,6 +931,503 @@ var __publicField = (obj, key, value) => {
|
|
|
891
931
|
(c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
892
932
|
);
|
|
893
933
|
};
|
|
934
|
+
function ChevronDownIcon(props, svgRef) {
|
|
935
|
+
return /* @__PURE__ */ React__namespace.createElement("svg", Object.assign({
|
|
936
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
937
|
+
viewBox: "0 0 20 20",
|
|
938
|
+
fill: "currentColor",
|
|
939
|
+
"aria-hidden": "true",
|
|
940
|
+
ref: svgRef
|
|
941
|
+
}, props), /* @__PURE__ */ React__namespace.createElement("path", {
|
|
942
|
+
fillRule: "evenodd",
|
|
943
|
+
d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
|
|
944
|
+
clipRule: "evenodd"
|
|
945
|
+
}));
|
|
946
|
+
}
|
|
947
|
+
const ForwardRef = React__namespace.forwardRef(ChevronDownIcon);
|
|
948
|
+
const ChevronDownIcon$1 = ForwardRef;
|
|
949
|
+
const Autocomplete = ({
|
|
950
|
+
value,
|
|
951
|
+
onChange,
|
|
952
|
+
defaultQuery,
|
|
953
|
+
items: items2
|
|
954
|
+
}) => {
|
|
955
|
+
const [query, setQuery] = React.useState(defaultQuery ?? "");
|
|
956
|
+
const filteredItems = React.useMemo(() => {
|
|
957
|
+
try {
|
|
958
|
+
const reFilter = new RegExp(query, "i");
|
|
959
|
+
const _items = items2.filter((item) => reFilter.test(item.label));
|
|
960
|
+
if (_items.length === 0)
|
|
961
|
+
return items2;
|
|
962
|
+
return _items;
|
|
963
|
+
} catch (err) {
|
|
964
|
+
return items2;
|
|
965
|
+
}
|
|
966
|
+
}, [items2, query]);
|
|
967
|
+
return /* @__PURE__ */ React.createElement(
|
|
968
|
+
react.Combobox,
|
|
969
|
+
{
|
|
970
|
+
value,
|
|
971
|
+
onChange,
|
|
972
|
+
as: "div",
|
|
973
|
+
className: "relative inline-block text-left z-20"
|
|
974
|
+
},
|
|
975
|
+
/* @__PURE__ */ React.createElement("div", { className: "mt-1" }, /* @__PURE__ */ React.createElement("div", { className: "relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left shadow-md sm:text-sm" }, /* @__PURE__ */ React.createElement(
|
|
976
|
+
react.ComboboxInput,
|
|
977
|
+
{
|
|
978
|
+
className: "w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 focus:ring-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-teal-300",
|
|
979
|
+
displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
|
|
980
|
+
onChange: (event) => setQuery(event.target.value),
|
|
981
|
+
onClick: (ev) => ev.stopPropagation()
|
|
982
|
+
}
|
|
983
|
+
), /* @__PURE__ */ React.createElement(react.ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React.createElement(
|
|
984
|
+
ChevronDownIcon$1,
|
|
985
|
+
{
|
|
986
|
+
className: "h-5 w-5 text-gray-400",
|
|
987
|
+
"aria-hidden": "true"
|
|
988
|
+
}
|
|
989
|
+
)))),
|
|
990
|
+
/* @__PURE__ */ React.createElement(
|
|
991
|
+
react.Transition,
|
|
992
|
+
{
|
|
993
|
+
enter: "transition ease-out duration-100",
|
|
994
|
+
enterFrom: "transform opacity-0 scale-95",
|
|
995
|
+
enterTo: "transform opacity-100 scale-100",
|
|
996
|
+
leave: "transition ease-in duration-75",
|
|
997
|
+
leaveFrom: "transform opacity-100 scale-100",
|
|
998
|
+
leaveTo: "transform opacity-0 scale-95"
|
|
999
|
+
},
|
|
1000
|
+
/* @__PURE__ */ React.createElement(react.ComboboxOptions, { className: "origin-top-right absolute right-0 mt-1 w-full max-h-[300px] overflow-y-auto rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, filteredItems.map((item) => /* @__PURE__ */ React.createElement(react.ComboboxOption, { key: item.key, value: item }, ({ focus }) => /* @__PURE__ */ React.createElement(
|
|
1001
|
+
"button",
|
|
1002
|
+
{
|
|
1003
|
+
className: classNames$1(
|
|
1004
|
+
focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
|
|
1005
|
+
"block px-4 py-2 text-xs w-full text-right"
|
|
1006
|
+
)
|
|
1007
|
+
},
|
|
1008
|
+
item.render(item)
|
|
1009
|
+
))))
|
|
1010
|
+
)
|
|
1011
|
+
);
|
|
1012
|
+
};
|
|
1013
|
+
MonacoEditor.loader.config({
|
|
1014
|
+
paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
|
|
1015
|
+
});
|
|
1016
|
+
let retryCount = 0;
|
|
1017
|
+
const retryFocus = (ref) => {
|
|
1018
|
+
if (ref.current) {
|
|
1019
|
+
ref.current.focus();
|
|
1020
|
+
} else {
|
|
1021
|
+
if (retryCount < 30) {
|
|
1022
|
+
setTimeout(() => {
|
|
1023
|
+
retryCount = retryCount + 1;
|
|
1024
|
+
retryFocus(ref);
|
|
1025
|
+
}, 100);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
const MINIMUM_HEIGHT = 75;
|
|
1030
|
+
const CodeBlock = ({
|
|
1031
|
+
attributes,
|
|
1032
|
+
editor,
|
|
1033
|
+
element,
|
|
1034
|
+
language: restrictLanguage,
|
|
1035
|
+
onChangeCallback,
|
|
1036
|
+
defaultValue,
|
|
1037
|
+
...props
|
|
1038
|
+
}) => {
|
|
1039
|
+
const [navigateAway, setNavigateAway] = React.useState(null);
|
|
1040
|
+
const monaco = MonacoEditor.useMonaco();
|
|
1041
|
+
const monacoEditorRef = React.useRef(null);
|
|
1042
|
+
const selected = slateReact.useSelected();
|
|
1043
|
+
const [height, setHeight] = React.useState(MINIMUM_HEIGHT);
|
|
1044
|
+
React.useEffect(() => {
|
|
1045
|
+
if (selected && plateCommon.isCollapsed(editor.selection)) {
|
|
1046
|
+
retryFocus(monacoEditorRef);
|
|
1047
|
+
}
|
|
1048
|
+
}, [selected, monacoEditorRef.current]);
|
|
1049
|
+
const value = element.value || "";
|
|
1050
|
+
if (typeof value !== "string") {
|
|
1051
|
+
throw new Error("Element must be of type string for code block");
|
|
1052
|
+
}
|
|
1053
|
+
const language = restrictLanguage || element.lang;
|
|
1054
|
+
const id = React.useMemo(() => uuid(), []);
|
|
1055
|
+
const languages = React.useMemo(() => {
|
|
1056
|
+
const defaultLangSet = { "": "plain text" };
|
|
1057
|
+
if (!monaco)
|
|
1058
|
+
return defaultLangSet;
|
|
1059
|
+
return monaco.languages.getLanguages().reduce((ac, cv) => {
|
|
1060
|
+
if (cv.id === "plaintext")
|
|
1061
|
+
return ac;
|
|
1062
|
+
return { ...ac, [cv.id]: cv.id };
|
|
1063
|
+
}, defaultLangSet);
|
|
1064
|
+
}, [monaco]);
|
|
1065
|
+
React.useEffect(() => {
|
|
1066
|
+
if (monaco) {
|
|
1067
|
+
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
1068
|
+
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
1069
|
+
// disable errors
|
|
1070
|
+
noSemanticValidation: true,
|
|
1071
|
+
noSyntaxValidation: true
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
}, [monaco]);
|
|
1075
|
+
const items2 = Object.entries(languages).map(([key, label]) => ({
|
|
1076
|
+
key,
|
|
1077
|
+
label,
|
|
1078
|
+
render: (item) => item.label
|
|
1079
|
+
}));
|
|
1080
|
+
const currentItem = React.useMemo(() => {
|
|
1081
|
+
return items2.find((item) => item.key === language) ?? {
|
|
1082
|
+
key: "",
|
|
1083
|
+
label: "Plain Text"
|
|
1084
|
+
};
|
|
1085
|
+
}, [items2, language]);
|
|
1086
|
+
React.useEffect(() => {
|
|
1087
|
+
if (navigateAway) {
|
|
1088
|
+
setNavigateAway(null);
|
|
1089
|
+
switch (navigateAway) {
|
|
1090
|
+
case "remove":
|
|
1091
|
+
{
|
|
1092
|
+
plateCommon.focusEditor(editor);
|
|
1093
|
+
plateCommon.setNodes(
|
|
1094
|
+
editor,
|
|
1095
|
+
{
|
|
1096
|
+
type: "p",
|
|
1097
|
+
children: [{ text: "" }],
|
|
1098
|
+
lang: void 0,
|
|
1099
|
+
value: void 0
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
match: (n) => {
|
|
1103
|
+
if (plateCommon.isElement(n) && n.type === element.type) {
|
|
1104
|
+
return true;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
break;
|
|
1111
|
+
case "insertNext":
|
|
1112
|
+
{
|
|
1113
|
+
plateCommon.insertNodes(
|
|
1114
|
+
editor,
|
|
1115
|
+
[
|
|
1116
|
+
{
|
|
1117
|
+
type: plateCommon.ELEMENT_DEFAULT,
|
|
1118
|
+
children: [{ text: "" }],
|
|
1119
|
+
lang: void 0,
|
|
1120
|
+
value: void 0
|
|
1121
|
+
}
|
|
1122
|
+
],
|
|
1123
|
+
{ select: true }
|
|
1124
|
+
);
|
|
1125
|
+
plateCommon.focusEditor(editor);
|
|
1126
|
+
}
|
|
1127
|
+
break;
|
|
1128
|
+
case "up":
|
|
1129
|
+
{
|
|
1130
|
+
const path = plateCommon.findNodePath(editor, element);
|
|
1131
|
+
if (!path) {
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
const previousNodePath = plateCommon.getPointBefore(editor, path);
|
|
1135
|
+
if (!previousNodePath) {
|
|
1136
|
+
plateCommon.focusEditor(editor);
|
|
1137
|
+
plateCommon.insertNodes(
|
|
1138
|
+
editor,
|
|
1139
|
+
[
|
|
1140
|
+
{
|
|
1141
|
+
type: plateCommon.ELEMENT_DEFAULT,
|
|
1142
|
+
children: [{ text: "" }],
|
|
1143
|
+
lang: void 0,
|
|
1144
|
+
value: void 0
|
|
1145
|
+
}
|
|
1146
|
+
],
|
|
1147
|
+
// Insert a new node at the current path, resulting in the code_block
|
|
1148
|
+
// moving down one block
|
|
1149
|
+
{ at: path, select: true }
|
|
1150
|
+
);
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
plateCommon.focusEditor(editor, previousNodePath);
|
|
1154
|
+
}
|
|
1155
|
+
break;
|
|
1156
|
+
case "down": {
|
|
1157
|
+
const path = plateCommon.findNodePath(editor, element);
|
|
1158
|
+
if (!path) {
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
const nextNodePath = plateCommon.getPointAfter(editor, path);
|
|
1162
|
+
if (!nextNodePath) {
|
|
1163
|
+
plateCommon.insertNodes(
|
|
1164
|
+
editor,
|
|
1165
|
+
[
|
|
1166
|
+
{
|
|
1167
|
+
type: plateCommon.ELEMENT_DEFAULT,
|
|
1168
|
+
children: [{ text: "" }],
|
|
1169
|
+
lang: void 0,
|
|
1170
|
+
value: void 0
|
|
1171
|
+
}
|
|
1172
|
+
],
|
|
1173
|
+
{ select: true }
|
|
1174
|
+
);
|
|
1175
|
+
plateCommon.focusEditor(editor);
|
|
1176
|
+
} else {
|
|
1177
|
+
plateCommon.focusEditor(editor, nextNodePath);
|
|
1178
|
+
}
|
|
1179
|
+
break;
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}, [navigateAway]);
|
|
1184
|
+
function handleEditorDidMount(monacoEditor, monaco2) {
|
|
1185
|
+
monacoEditorRef.current = monacoEditor;
|
|
1186
|
+
monacoEditor.onDidContentSizeChange(() => {
|
|
1187
|
+
setHeight(
|
|
1188
|
+
monacoEditor.getContentHeight() > MINIMUM_HEIGHT ? monacoEditor.getContentHeight() : MINIMUM_HEIGHT
|
|
1189
|
+
);
|
|
1190
|
+
monacoEditor.layout();
|
|
1191
|
+
});
|
|
1192
|
+
plateCommon.setNodes(editor, { value: defaultValue, lang: language });
|
|
1193
|
+
monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
|
|
1194
|
+
if (monacoEditor.hasTextFocus()) {
|
|
1195
|
+
setNavigateAway("insertNext");
|
|
1196
|
+
}
|
|
1197
|
+
});
|
|
1198
|
+
monacoEditor.onKeyDown((l) => {
|
|
1199
|
+
if (l.code === "ArrowUp") {
|
|
1200
|
+
const selection = monacoEditor.getSelection();
|
|
1201
|
+
if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
|
|
1202
|
+
setNavigateAway("up");
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
if (l.code === "ArrowDown") {
|
|
1206
|
+
const selection = monacoEditor.getSelection();
|
|
1207
|
+
const totalLines = monacoEditor.getModel().getLineCount();
|
|
1208
|
+
if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
|
|
1209
|
+
setNavigateAway("down");
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
if (l.code === "Backspace") {
|
|
1213
|
+
const selection = monacoEditor.getSelection();
|
|
1214
|
+
if (selection.endColumn === 1 && selection.endLineNumber === 1 && selection.positionColumn === 1 && selection.positionLineNumber === 1 && selection.selectionStartColumn === 1 && selection.selectionStartLineNumber === 1 && selection.startColumn === 1 && selection.startLineNumber === 1) {
|
|
1215
|
+
setNavigateAway("remove");
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
return /* @__PURE__ */ React.createElement(
|
|
1221
|
+
"div",
|
|
1222
|
+
{
|
|
1223
|
+
...attributes,
|
|
1224
|
+
className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
|
|
1225
|
+
},
|
|
1226
|
+
/* @__PURE__ */ React.createElement("style", null, `.monaco-editor .editor-widget {
|
|
1227
|
+
display: none !important;
|
|
1228
|
+
visibility: hidden !important;
|
|
1229
|
+
}`),
|
|
1230
|
+
props.children,
|
|
1231
|
+
/* @__PURE__ */ React.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement(
|
|
1232
|
+
Autocomplete,
|
|
1233
|
+
{
|
|
1234
|
+
items: items2,
|
|
1235
|
+
value: currentItem,
|
|
1236
|
+
defaultQuery: "plaintext",
|
|
1237
|
+
onChange: (item) => plateCommon.setNodes(editor, { lang: item.key })
|
|
1238
|
+
}
|
|
1239
|
+
)), /* @__PURE__ */ React.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React.createElement(
|
|
1240
|
+
MonacoEditor,
|
|
1241
|
+
{
|
|
1242
|
+
path: id,
|
|
1243
|
+
onMount: handleEditorDidMount,
|
|
1244
|
+
options: {
|
|
1245
|
+
scrollBeyondLastLine: false,
|
|
1246
|
+
// automaticLayout: true,
|
|
1247
|
+
tabSize: 2,
|
|
1248
|
+
disableLayerHinting: true,
|
|
1249
|
+
accessibilitySupport: "off",
|
|
1250
|
+
codeLens: false,
|
|
1251
|
+
wordWrap: "on",
|
|
1252
|
+
minimap: {
|
|
1253
|
+
enabled: false
|
|
1254
|
+
},
|
|
1255
|
+
fontSize: 14,
|
|
1256
|
+
lineHeight: 2,
|
|
1257
|
+
formatOnPaste: true,
|
|
1258
|
+
lineNumbers: "off",
|
|
1259
|
+
formatOnType: true,
|
|
1260
|
+
fixedOverflowWidgets: true,
|
|
1261
|
+
// Takes too much horizontal space for iframe
|
|
1262
|
+
folding: false,
|
|
1263
|
+
renderLineHighlight: "none",
|
|
1264
|
+
scrollbar: {
|
|
1265
|
+
verticalScrollbarSize: 1,
|
|
1266
|
+
horizontalScrollbarSize: 1,
|
|
1267
|
+
// https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
|
|
1268
|
+
alwaysConsumeMouseWheel: false
|
|
1269
|
+
}
|
|
1270
|
+
},
|
|
1271
|
+
language: String(language),
|
|
1272
|
+
value: String(element.value),
|
|
1273
|
+
onChange: (value2) => {
|
|
1274
|
+
onChangeCallback == null ? void 0 : onChangeCallback(value2);
|
|
1275
|
+
plateCommon.setNodes(editor, { value: value2, lang: language });
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
)))
|
|
1279
|
+
);
|
|
1280
|
+
};
|
|
1281
|
+
const CodeBlockElement = cn$1.withRef(
|
|
1282
|
+
({ className, ...props }, ref) => {
|
|
1283
|
+
const { element } = props;
|
|
1284
|
+
const state = plateCodeBlock.useCodeBlockElementState({ element });
|
|
1285
|
+
return /* @__PURE__ */ React.createElement(
|
|
1286
|
+
plateCommon.PlateElement,
|
|
1287
|
+
{
|
|
1288
|
+
className: cn$1.cn("relative py-1", state.className, className),
|
|
1289
|
+
ref,
|
|
1290
|
+
...props
|
|
1291
|
+
},
|
|
1292
|
+
/* @__PURE__ */ React.createElement(CodeBlock, { ...props })
|
|
1293
|
+
);
|
|
1294
|
+
}
|
|
1295
|
+
);
|
|
1296
|
+
const CodeLeaf = cn$1.withRef(
|
|
1297
|
+
({ children, className, ...props }, ref) => {
|
|
1298
|
+
return /* @__PURE__ */ React.createElement(
|
|
1299
|
+
plateCommon.PlateLeaf,
|
|
1300
|
+
{
|
|
1301
|
+
asChild: true,
|
|
1302
|
+
className: cn$1.cn(
|
|
1303
|
+
"whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
|
|
1304
|
+
className
|
|
1305
|
+
),
|
|
1306
|
+
ref,
|
|
1307
|
+
...props
|
|
1308
|
+
},
|
|
1309
|
+
/* @__PURE__ */ React.createElement("code", null, children)
|
|
1310
|
+
);
|
|
1311
|
+
}
|
|
1312
|
+
);
|
|
1313
|
+
const CodeLineElement = cn$1.withRef((props, ref) => /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { ref, ...props }));
|
|
1314
|
+
const CodeSyntaxLeaf = cn$1.withRef(
|
|
1315
|
+
({ children, ...props }, ref) => {
|
|
1316
|
+
const { leaf } = props;
|
|
1317
|
+
const { tokenProps } = plateCodeBlock.useCodeSyntaxLeaf({ leaf });
|
|
1318
|
+
return /* @__PURE__ */ React.createElement(plateCommon.PlateLeaf, { ref, ...props }, /* @__PURE__ */ React.createElement("span", { ...tokenProps }, children));
|
|
1319
|
+
}
|
|
1320
|
+
);
|
|
1321
|
+
const listVariants = classVarianceAuthority.cva("m-0 ps-6", {
|
|
1322
|
+
variants: {
|
|
1323
|
+
variant: {
|
|
1324
|
+
ol: "list-decimal",
|
|
1325
|
+
ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
});
|
|
1329
|
+
const ListElementVariants = cn$1.withVariants(plateCommon.PlateElement, listVariants, [
|
|
1330
|
+
"variant"
|
|
1331
|
+
]);
|
|
1332
|
+
const ListElement = cn$1.withRef(
|
|
1333
|
+
({ children, variant = "ul", ...props }, ref) => {
|
|
1334
|
+
const Component = variant;
|
|
1335
|
+
return /* @__PURE__ */ React.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React.createElement(Component, null, children));
|
|
1336
|
+
}
|
|
1337
|
+
);
|
|
1338
|
+
const ELEMENT_MERMAID = "mermaid";
|
|
1339
|
+
const createMermaidPlugin = plateCommon.createPluginFactory({
|
|
1340
|
+
isElement: true,
|
|
1341
|
+
isVoid: true,
|
|
1342
|
+
isInline: false,
|
|
1343
|
+
key: ELEMENT_MERMAID
|
|
1344
|
+
});
|
|
1345
|
+
const MermaidElementWithRef = ({ config }) => {
|
|
1346
|
+
const mermaidRef = React.useRef(null);
|
|
1347
|
+
React.useEffect(() => {
|
|
1348
|
+
if (mermaidRef.current) {
|
|
1349
|
+
mermaid.initialize({ startOnLoad: true });
|
|
1350
|
+
mermaid.init();
|
|
1351
|
+
}
|
|
1352
|
+
}, [config]);
|
|
1353
|
+
return /* @__PURE__ */ React.createElement("div", { contentEditable: false, className: "border-border border-b" }, /* @__PURE__ */ React.createElement("div", { ref: mermaidRef }, /* @__PURE__ */ React.createElement("pre", { className: "mermaid not-tina-prose" }, config)));
|
|
1354
|
+
};
|
|
1355
|
+
const Bubble = ({ children }) => {
|
|
1356
|
+
return /* @__PURE__ */ React.createElement("div", { className: "bg-blue-600 rounded-full p-2 transition-transform duration-200 ease-in-out hover:scale-110" }, children);
|
|
1357
|
+
};
|
|
1358
|
+
const ErrorMsg = ({ error }) => {
|
|
1359
|
+
if (error) {
|
|
1360
|
+
return /* @__PURE__ */ React.createElement(
|
|
1361
|
+
"div",
|
|
1362
|
+
{
|
|
1363
|
+
contentEditable: false,
|
|
1364
|
+
className: "font-mono bg-red-600 text-white p-2 rounded-md cursor-default"
|
|
1365
|
+
},
|
|
1366
|
+
error
|
|
1367
|
+
);
|
|
1368
|
+
}
|
|
1369
|
+
return null;
|
|
1370
|
+
};
|
|
1371
|
+
const DEFAULT_MERMAID_CONFIG = `%% This won't render without implementing a rendering engine (e.g. mermaid on npm)
|
|
1372
|
+
flowchart TD
|
|
1373
|
+
id1(this is an example flow diagram)
|
|
1374
|
+
--> id2(modify me to see changes!)
|
|
1375
|
+
id2
|
|
1376
|
+
--> id3(Click the top button to preview the changes)
|
|
1377
|
+
--> id4(Learn about mermaid diagrams - mermaid.js.org)`;
|
|
1378
|
+
const MermaidElement = cn$1.withRef(
|
|
1379
|
+
({ children, nodeProps, element, ...props }, ref) => {
|
|
1380
|
+
const [mermaidConfig, setMermaidConfig] = React.useState(
|
|
1381
|
+
element.value || DEFAULT_MERMAID_CONFIG
|
|
1382
|
+
);
|
|
1383
|
+
const [isEditing, setIsEditing] = React.useState(
|
|
1384
|
+
mermaidConfig === DEFAULT_MERMAID_CONFIG || false
|
|
1385
|
+
);
|
|
1386
|
+
const [mermaidError, setMermaidError] = React.useState(null);
|
|
1387
|
+
const node = {
|
|
1388
|
+
type: ELEMENT_MERMAID,
|
|
1389
|
+
value: mermaidConfig,
|
|
1390
|
+
children: [{ type: "text", text: "" }]
|
|
1391
|
+
};
|
|
1392
|
+
React.useEffect(() => {
|
|
1393
|
+
if (mermaid.parse(mermaidConfig)) {
|
|
1394
|
+
setMermaidError(null);
|
|
1395
|
+
}
|
|
1396
|
+
}, [mermaidConfig]);
|
|
1397
|
+
mermaid.parseError = (err) => {
|
|
1398
|
+
setMermaidError(
|
|
1399
|
+
String(err.message) || "An error occurred while parsing the diagram."
|
|
1400
|
+
);
|
|
1401
|
+
};
|
|
1402
|
+
return /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { element, ref, ...props }, /* @__PURE__ */ React.createElement("div", { className: "relative group" }, /* @__PURE__ */ React.createElement("div", { className: "absolute top-2 right-2 z-10 space-y-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 ease-in-out" }, /* @__PURE__ */ React.createElement(Bubble, null, isEditing ? /* @__PURE__ */ React.createElement(
|
|
1403
|
+
lucideReact.Eye,
|
|
1404
|
+
{
|
|
1405
|
+
className: "w-5 h-5 fill-white cursor-pointer",
|
|
1406
|
+
onClick: () => {
|
|
1407
|
+
setIsEditing(!isEditing);
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
) : /* @__PURE__ */ React.createElement(
|
|
1411
|
+
lucideReact.SquarePen,
|
|
1412
|
+
{
|
|
1413
|
+
className: "w-5 h-5 fill-white cursor-pointer",
|
|
1414
|
+
onClick: () => {
|
|
1415
|
+
setIsEditing(!isEditing);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
))), isEditing ? /* @__PURE__ */ React.createElement(
|
|
1419
|
+
CodeBlock,
|
|
1420
|
+
{
|
|
1421
|
+
children: "",
|
|
1422
|
+
language: "yaml",
|
|
1423
|
+
...props,
|
|
1424
|
+
element: node,
|
|
1425
|
+
defaultValue: mermaidConfig,
|
|
1426
|
+
onChangeCallback: (value) => setMermaidConfig(value)
|
|
1427
|
+
}
|
|
1428
|
+
) : /* @__PURE__ */ React.createElement(MermaidElementWithRef, { config: mermaidConfig })), children, /* @__PURE__ */ React.createElement(ErrorMsg, { error: mermaidError }));
|
|
1429
|
+
}
|
|
1430
|
+
);
|
|
894
1431
|
const RawMarkdown = () => {
|
|
895
1432
|
return /* @__PURE__ */ React.createElement(
|
|
896
1433
|
"svg",
|
|
@@ -909,6 +1446,29 @@ var __publicField = (obj, key, value) => {
|
|
|
909
1446
|
/* @__PURE__ */ React.createElement("path", { d: "M22.27 19.385H1.73A1.73 1.73 0 010 17.655V6.345a1.73 1.73 0 011.73-1.73h20.54A1.73 1.73 0 0124 6.345v11.308a1.73 1.73 0 01-1.73 1.731zM5.769 15.923v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.46v7.847zM21.232 12h-2.309V8.077h-2.307V12h-2.308l3.461 4.039z" })
|
|
910
1447
|
);
|
|
911
1448
|
};
|
|
1449
|
+
const MermaidIcon = () => /* @__PURE__ */ React.createElement(
|
|
1450
|
+
"svg",
|
|
1451
|
+
{
|
|
1452
|
+
width: "100%",
|
|
1453
|
+
height: "100%",
|
|
1454
|
+
viewBox: "0 0 491 491",
|
|
1455
|
+
version: "1.1",
|
|
1456
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1457
|
+
fillRule: "evenodd",
|
|
1458
|
+
clipRule: "evenodd",
|
|
1459
|
+
strokeLinejoin: "round",
|
|
1460
|
+
strokeMiterlimit: 2
|
|
1461
|
+
},
|
|
1462
|
+
/* @__PURE__ */ React.createElement("path", { d: "M490.16,84.61C490.16,37.912 452.248,0 405.55,0L84.61,0C37.912,0 0,37.912 0,84.61L0,405.55C0,452.248 37.912,490.16 84.61,490.16L405.55,490.16C452.248,490.16 490.16,452.248 490.16,405.55L490.16,84.61Z" }),
|
|
1463
|
+
/* @__PURE__ */ React.createElement(
|
|
1464
|
+
"path",
|
|
1465
|
+
{
|
|
1466
|
+
d: "M407.48,111.18C335.587,108.103 269.573,152.338 245.08,220C220.587,152.338 154.573,108.103 82.68,111.18C80.285,168.229 107.577,222.632 154.74,254.82C178.908,271.419 193.35,298.951 193.27,328.27L193.27,379.13L296.9,379.13L296.9,328.27C296.816,298.953 311.255,271.42 335.42,254.82C382.596,222.644 409.892,168.233 407.48,111.18Z",
|
|
1467
|
+
fill: "white",
|
|
1468
|
+
fillRule: "nonzero"
|
|
1469
|
+
}
|
|
1470
|
+
)
|
|
1471
|
+
);
|
|
912
1472
|
const borderAll = (props) => /* @__PURE__ */ React.createElement(
|
|
913
1473
|
"svg",
|
|
914
1474
|
{
|
|
@@ -993,7 +1553,7 @@ var __publicField = (obj, key, value) => {
|
|
|
993
1553
|
},
|
|
994
1554
|
/* @__PURE__ */ React.createElement("path", { d: "M3 6a1 1 0 0 0 2 0 1 1 0 0 1 1-1h12a1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3zm2 5a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-8 1a1 1 0 1 0 0-2 1 1 0 0 1-1-1 1 1 0 1 0-2 0 3 3 0 0 0 3 3zm11-1a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" })
|
|
995
1555
|
);
|
|
996
|
-
classVarianceAuthority.cva("", {
|
|
1556
|
+
const iconVariants = classVarianceAuthority.cva("", {
|
|
997
1557
|
variants: {
|
|
998
1558
|
variant: {
|
|
999
1559
|
toolbar: "size-5",
|
|
@@ -1149,6 +1709,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1149
1709
|
clear: lucideReact.X,
|
|
1150
1710
|
close: lucideReact.X,
|
|
1151
1711
|
// code: Code2,
|
|
1712
|
+
paint: lucideReact.PaintBucket,
|
|
1152
1713
|
codeblock: lucideReact.FileCode,
|
|
1153
1714
|
color: lucideReact.Baseline,
|
|
1154
1715
|
column: lucideReact.RectangleVertical,
|
|
@@ -1174,6 +1735,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1174
1735
|
lineHeight: lucideReact.WrapText,
|
|
1175
1736
|
// link: Link2,
|
|
1176
1737
|
minus: lucideReact.Minus,
|
|
1738
|
+
mermaid: MermaidIcon,
|
|
1177
1739
|
more: lucideReact.MoreHorizontal,
|
|
1178
1740
|
// ol: ListOrdered,
|
|
1179
1741
|
outdent: lucideReact.Outdent,
|
|
@@ -1548,7 +2110,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1548
2110
|
setHasEmpty
|
|
1549
2111
|
]
|
|
1550
2112
|
);
|
|
1551
|
-
const store = react.useComboboxStore({
|
|
2113
|
+
const store = react$1.useComboboxStore({
|
|
1552
2114
|
setValue: (newValue) => React.startTransition(() => setValue(newValue))
|
|
1553
2115
|
});
|
|
1554
2116
|
const items2 = store.useState("items");
|
|
@@ -1558,7 +2120,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1558
2120
|
}
|
|
1559
2121
|
}, [items2, store]);
|
|
1560
2122
|
return /* @__PURE__ */ React.createElement("span", { contentEditable: false }, /* @__PURE__ */ React.createElement(
|
|
1561
|
-
react.ComboboxProvider,
|
|
2123
|
+
react$1.ComboboxProvider,
|
|
1562
2124
|
{
|
|
1563
2125
|
open: (items2.length > 0 || hasEmpty) && (!hideWhenNoValue || value.length > 0),
|
|
1564
2126
|
store
|
|
@@ -1573,7 +2135,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1573
2135
|
showTrigger,
|
|
1574
2136
|
trigger
|
|
1575
2137
|
} = React.useContext(InlineComboboxContext);
|
|
1576
|
-
const store = react.useComboboxContext();
|
|
2138
|
+
const store = react$1.useComboboxContext();
|
|
1577
2139
|
const value = store.useState("value");
|
|
1578
2140
|
const ref = plateCommon.useComposedRef(propRef, contextRef);
|
|
1579
2141
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, showTrigger && trigger, /* @__PURE__ */ React.createElement("span", { className: "relative min-h-[1lh]" }, /* @__PURE__ */ React.createElement(
|
|
@@ -1584,7 +2146,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1584
2146
|
},
|
|
1585
2147
|
value || ""
|
|
1586
2148
|
), /* @__PURE__ */ React.createElement(
|
|
1587
|
-
react.Combobox,
|
|
2149
|
+
react$1.Combobox,
|
|
1588
2150
|
{
|
|
1589
2151
|
autoSelect: true,
|
|
1590
2152
|
className: cn$1.cn(
|
|
@@ -1603,8 +2165,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1603
2165
|
className,
|
|
1604
2166
|
...props
|
|
1605
2167
|
}) => {
|
|
1606
|
-
return /* @__PURE__ */ React.createElement(react.Portal, null, /* @__PURE__ */ React.createElement(
|
|
1607
|
-
react.ComboboxPopover,
|
|
2168
|
+
return /* @__PURE__ */ React.createElement(react$1.Portal, null, /* @__PURE__ */ React.createElement(
|
|
2169
|
+
react$1.ComboboxPopover,
|
|
1608
2170
|
{
|
|
1609
2171
|
className: cn$1.cn(
|
|
1610
2172
|
"z-[9999999] max-h-[288px] w-[300px] overflow-y-auto rounded-md bg-white shadow-md",
|
|
@@ -1636,7 +2198,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1636
2198
|
}) => {
|
|
1637
2199
|
const { value } = props;
|
|
1638
2200
|
const { filter, removeInput } = React.useContext(InlineComboboxContext);
|
|
1639
|
-
const store = react.useComboboxContext();
|
|
2201
|
+
const store = react$1.useComboboxContext();
|
|
1640
2202
|
const search = filter && store.useState("value");
|
|
1641
2203
|
const visible = React.useMemo(
|
|
1642
2204
|
() => !filter || filter({ keywords, value }, search),
|
|
@@ -1645,7 +2207,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1645
2207
|
if (!visible)
|
|
1646
2208
|
return null;
|
|
1647
2209
|
return /* @__PURE__ */ React.createElement(
|
|
1648
|
-
react.ComboboxItem,
|
|
2210
|
+
react$1.ComboboxItem,
|
|
1649
2211
|
{
|
|
1650
2212
|
className: cn$1.cn(comboboxItemVariants(), className),
|
|
1651
2213
|
onClick: (event) => {
|
|
@@ -1661,7 +2223,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1661
2223
|
className
|
|
1662
2224
|
}) => {
|
|
1663
2225
|
const { setHasEmpty } = React.useContext(InlineComboboxContext);
|
|
1664
|
-
const store = react.useComboboxContext();
|
|
2226
|
+
const store = react$1.useComboboxContext();
|
|
1665
2227
|
const items2 = store.useState("items");
|
|
1666
2228
|
React.useEffect(() => {
|
|
1667
2229
|
setHasEmpty(true);
|
|
@@ -1744,417 +2306,482 @@ var __publicField = (obj, key, value) => {
|
|
|
1744
2306
|
);
|
|
1745
2307
|
}
|
|
1746
2308
|
);
|
|
1747
|
-
const
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
className: cn$1.cn("my-1 border-l-2 pl-6 italic", className),
|
|
1771
|
-
ref,
|
|
1772
|
-
...props
|
|
1773
|
-
},
|
|
1774
|
-
/* @__PURE__ */ React.createElement("blockquote", null, children)
|
|
1775
|
-
);
|
|
1776
|
-
}
|
|
1777
|
-
);
|
|
1778
|
-
const CodeLeaf = cn$1.withRef(
|
|
1779
|
-
({ children, className, ...props }, ref) => {
|
|
1780
|
-
return /* @__PURE__ */ React.createElement(
|
|
1781
|
-
plateCommon.PlateLeaf,
|
|
1782
|
-
{
|
|
1783
|
-
asChild: true,
|
|
1784
|
-
className: cn$1.cn(
|
|
1785
|
-
"whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
|
|
1786
|
-
className
|
|
1787
|
-
),
|
|
1788
|
-
ref,
|
|
1789
|
-
...props
|
|
1790
|
-
},
|
|
1791
|
-
/* @__PURE__ */ React.createElement("code", null, children)
|
|
1792
|
-
);
|
|
1793
|
-
}
|
|
1794
|
-
);
|
|
1795
|
-
const CodeLineElement = cn$1.withRef((props, ref) => /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { ref, ...props }));
|
|
1796
|
-
const CodeSyntaxLeaf = cn$1.withRef(
|
|
1797
|
-
({ children, ...props }, ref) => {
|
|
1798
|
-
const { leaf } = props;
|
|
1799
|
-
const { tokenProps } = plateCodeBlock.useCodeSyntaxLeaf({ leaf });
|
|
1800
|
-
return /* @__PURE__ */ React.createElement(plateCommon.PlateLeaf, { ref, ...props }, /* @__PURE__ */ React.createElement("span", { ...tokenProps }, children));
|
|
1801
|
-
}
|
|
1802
|
-
);
|
|
1803
|
-
function ChevronDownIcon(props, svgRef) {
|
|
1804
|
-
return /* @__PURE__ */ React__namespace.createElement("svg", Object.assign({
|
|
1805
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1806
|
-
viewBox: "0 0 20 20",
|
|
1807
|
-
fill: "currentColor",
|
|
1808
|
-
"aria-hidden": "true",
|
|
1809
|
-
ref: svgRef
|
|
1810
|
-
}, props), /* @__PURE__ */ React__namespace.createElement("path", {
|
|
1811
|
-
fillRule: "evenodd",
|
|
1812
|
-
d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
|
|
1813
|
-
clipRule: "evenodd"
|
|
1814
|
-
}));
|
|
1815
|
-
}
|
|
1816
|
-
const ForwardRef = React__namespace.forwardRef(ChevronDownIcon);
|
|
1817
|
-
const ChevronDownIcon$1 = ForwardRef;
|
|
1818
|
-
const Autocomplete = ({
|
|
1819
|
-
value,
|
|
1820
|
-
onChange,
|
|
1821
|
-
defaultQuery,
|
|
1822
|
-
items: items2
|
|
1823
|
-
}) => {
|
|
1824
|
-
const [query, setQuery] = React.useState(defaultQuery ?? "");
|
|
1825
|
-
const filteredItems = React.useMemo(() => {
|
|
1826
|
-
try {
|
|
1827
|
-
const reFilter = new RegExp(query, "i");
|
|
1828
|
-
const _items = items2.filter((item) => reFilter.test(item.label));
|
|
1829
|
-
if (_items.length === 0)
|
|
1830
|
-
return items2;
|
|
1831
|
-
return _items;
|
|
1832
|
-
} catch (err) {
|
|
1833
|
-
return items2;
|
|
1834
|
-
}
|
|
1835
|
-
}, [items2, query]);
|
|
2309
|
+
const TableCellElement = cn$1.withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
|
|
2310
|
+
var _a, _b, _c, _d;
|
|
2311
|
+
const { element } = props;
|
|
2312
|
+
const {
|
|
2313
|
+
borders,
|
|
2314
|
+
colIndex,
|
|
2315
|
+
colSpan,
|
|
2316
|
+
hovered,
|
|
2317
|
+
hoveredLeft,
|
|
2318
|
+
isSelectingCell,
|
|
2319
|
+
readOnly,
|
|
2320
|
+
rowIndex,
|
|
2321
|
+
rowSize,
|
|
2322
|
+
selected
|
|
2323
|
+
} = plateTable.useTableCellElementState();
|
|
2324
|
+
const { props: cellProps } = plateTable.useTableCellElement({ element: props.element });
|
|
2325
|
+
const resizableState = plateTable.useTableCellElementResizableState({
|
|
2326
|
+
colIndex,
|
|
2327
|
+
colSpan,
|
|
2328
|
+
rowIndex
|
|
2329
|
+
});
|
|
2330
|
+
const { bottomProps, hiddenLeft, leftProps, rightProps } = plateTable.useTableCellElementResizable(resizableState);
|
|
2331
|
+
const Cell = isHeader ? "th" : "td";
|
|
1836
2332
|
return /* @__PURE__ */ React.createElement(
|
|
1837
|
-
|
|
2333
|
+
plateCommon.PlateElement,
|
|
1838
2334
|
{
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
2335
|
+
asChild: true,
|
|
2336
|
+
className: cn$1.cn(
|
|
2337
|
+
"relative h-full overflow-visible border-none bg-background p-0",
|
|
2338
|
+
hideBorder && "before:border-none",
|
|
2339
|
+
element.background ? "bg-[--cellBackground]" : "bg-background",
|
|
2340
|
+
!hideBorder && cn$1.cn(
|
|
2341
|
+
isHeader && "text-left [&_>_*]:m-0",
|
|
2342
|
+
"before:size-full",
|
|
2343
|
+
selected && "before:z-10 before:bg-muted",
|
|
2344
|
+
"before:absolute before:box-border before:select-none before:content-['']",
|
|
2345
|
+
borders && cn$1.cn(
|
|
2346
|
+
((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
|
|
2347
|
+
((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
|
|
2348
|
+
((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
|
|
2349
|
+
((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
|
|
2350
|
+
)
|
|
2351
|
+
),
|
|
2352
|
+
className
|
|
2353
|
+
),
|
|
2354
|
+
ref,
|
|
2355
|
+
...cellProps,
|
|
2356
|
+
...props,
|
|
2357
|
+
style: {
|
|
2358
|
+
"--cellBackground": element.background,
|
|
2359
|
+
...style
|
|
1851
2360
|
}
|
|
1852
|
-
|
|
1853
|
-
|
|
2361
|
+
},
|
|
2362
|
+
/* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(
|
|
2363
|
+
"div",
|
|
1854
2364
|
{
|
|
1855
|
-
className: "h-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
2365
|
+
className: "relative z-20 box-border h-full px-3 py-2",
|
|
2366
|
+
style: {
|
|
2367
|
+
minHeight: rowSize
|
|
2368
|
+
}
|
|
2369
|
+
},
|
|
2370
|
+
children
|
|
2371
|
+
), !isSelectingCell && /* @__PURE__ */ React.createElement(
|
|
2372
|
+
"div",
|
|
1861
2373
|
{
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
leave: "transition ease-in duration-75",
|
|
1866
|
-
leaveFrom: "transform opacity-100 scale-100",
|
|
1867
|
-
leaveTo: "transform opacity-0 scale-95"
|
|
2374
|
+
className: "group absolute top-0 size-full select-none",
|
|
2375
|
+
contentEditable: false,
|
|
2376
|
+
suppressContentEditableWarning: true
|
|
1868
2377
|
},
|
|
1869
|
-
|
|
1870
|
-
|
|
2378
|
+
!readOnly && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2379
|
+
plateResizable.ResizeHandle,
|
|
1871
2380
|
{
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
2381
|
+
...rightProps,
|
|
2382
|
+
className: "-top-3 right-[-5px] w-[10px]"
|
|
2383
|
+
}
|
|
2384
|
+
), /* @__PURE__ */ React.createElement(
|
|
2385
|
+
plateResizable.ResizeHandle,
|
|
2386
|
+
{
|
|
2387
|
+
...bottomProps,
|
|
2388
|
+
className: "bottom-[-5px] h-[10px]"
|
|
2389
|
+
}
|
|
2390
|
+
), !hiddenLeft && /* @__PURE__ */ React.createElement(
|
|
2391
|
+
plateResizable.ResizeHandle,
|
|
2392
|
+
{
|
|
2393
|
+
...leftProps,
|
|
2394
|
+
className: "-top-3 left-[-5px] w-[10px]"
|
|
2395
|
+
}
|
|
2396
|
+
), hovered && /* @__PURE__ */ React.createElement(
|
|
2397
|
+
"div",
|
|
2398
|
+
{
|
|
2399
|
+
className: cn$1.cn(
|
|
2400
|
+
"absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
|
|
2401
|
+
"right-[-1.5px]"
|
|
1875
2402
|
)
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
2403
|
+
}
|
|
2404
|
+
), hoveredLeft && /* @__PURE__ */ React.createElement(
|
|
2405
|
+
"div",
|
|
2406
|
+
{
|
|
2407
|
+
className: cn$1.cn(
|
|
2408
|
+
"absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
|
|
2409
|
+
"left-[-1.5px]"
|
|
2410
|
+
)
|
|
2411
|
+
}
|
|
2412
|
+
))
|
|
2413
|
+
))
|
|
1880
2414
|
);
|
|
1881
|
-
};
|
|
1882
|
-
MonacoEditor.loader.config({
|
|
1883
|
-
paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
|
|
1884
2415
|
});
|
|
1885
|
-
|
|
1886
|
-
const
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
2416
|
+
TableCellElement.displayName = "TableCellElement";
|
|
2417
|
+
const TableCellHeaderElement = cn$1.withProps(TableCellElement, {
|
|
2418
|
+
isHeader: true
|
|
2419
|
+
});
|
|
2420
|
+
const buttonVariants$1 = classVarianceAuthority.cva(
|
|
2421
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
2422
|
+
{
|
|
2423
|
+
defaultVariants: {
|
|
2424
|
+
size: "default",
|
|
2425
|
+
variant: "default"
|
|
2426
|
+
},
|
|
2427
|
+
variants: {
|
|
2428
|
+
isMenu: {
|
|
2429
|
+
true: "h-auto w-full cursor-pointer justify-start"
|
|
2430
|
+
},
|
|
2431
|
+
size: {
|
|
2432
|
+
default: "h-10 px-4 py-2",
|
|
2433
|
+
icon: "size-10",
|
|
2434
|
+
lg: "h-11 rounded-md px-8",
|
|
2435
|
+
none: "",
|
|
2436
|
+
sm: "h-9 rounded-md px-3",
|
|
2437
|
+
sms: "size-9 rounded-md px-0",
|
|
2438
|
+
xs: "h-8 rounded-md px-3"
|
|
2439
|
+
},
|
|
2440
|
+
variant: {
|
|
2441
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
2442
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
2443
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
2444
|
+
inlineLink: "text-base text-primary underline underline-offset-4",
|
|
2445
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
2446
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
2447
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
2448
|
+
}
|
|
1913
2449
|
}
|
|
1914
|
-
}, [selected, monacoEditorRef.current]);
|
|
1915
|
-
const value = element.value || "";
|
|
1916
|
-
if (typeof value !== "string") {
|
|
1917
|
-
throw new Error("Element must be of type string for code block");
|
|
1918
2450
|
}
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
const
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
return { ...ac, [cv.id]: cv.id };
|
|
1929
|
-
}, defaultLangSet);
|
|
1930
|
-
}, [monaco]);
|
|
1931
|
-
React.useEffect(() => {
|
|
1932
|
-
if (monaco) {
|
|
1933
|
-
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
1934
|
-
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
1935
|
-
// disable errors
|
|
1936
|
-
noSemanticValidation: true,
|
|
1937
|
-
noSyntaxValidation: true
|
|
1938
|
-
});
|
|
2451
|
+
);
|
|
2452
|
+
const Button$2 = cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
|
|
2453
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
2454
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
2455
|
+
Comp,
|
|
2456
|
+
{
|
|
2457
|
+
className: cn$1.cn(buttonVariants$1({ className, isMenu, size, variant })),
|
|
2458
|
+
ref,
|
|
2459
|
+
...props
|
|
1939
2460
|
}
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
{
|
|
1983
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
1984
|
-
children: [{ text: "" }],
|
|
1985
|
-
lang: void 0,
|
|
1986
|
-
value: void 0
|
|
1987
|
-
}
|
|
1988
|
-
],
|
|
1989
|
-
{ select: true }
|
|
1990
|
-
);
|
|
1991
|
-
plateCommon.focusEditor(editor);
|
|
1992
|
-
}
|
|
1993
|
-
break;
|
|
1994
|
-
case "up":
|
|
1995
|
-
{
|
|
1996
|
-
const path = plateCommon.findNodePath(editor, element);
|
|
1997
|
-
if (!path) {
|
|
1998
|
-
return;
|
|
1999
|
-
}
|
|
2000
|
-
const previousNodePath = plateCommon.getPointBefore(editor, path);
|
|
2001
|
-
if (!previousNodePath) {
|
|
2002
|
-
plateCommon.focusEditor(editor);
|
|
2003
|
-
plateCommon.insertNodes(
|
|
2004
|
-
editor,
|
|
2005
|
-
[
|
|
2006
|
-
{
|
|
2007
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
2008
|
-
children: [{ text: "" }],
|
|
2009
|
-
lang: void 0,
|
|
2010
|
-
value: void 0
|
|
2011
|
-
}
|
|
2012
|
-
],
|
|
2013
|
-
// Insert a new node at the current path, resulting in the code_block
|
|
2014
|
-
// moving down one block
|
|
2015
|
-
{ at: path, select: true }
|
|
2016
|
-
);
|
|
2017
|
-
return;
|
|
2018
|
-
}
|
|
2019
|
-
plateCommon.focusEditor(editor, previousNodePath);
|
|
2020
|
-
}
|
|
2021
|
-
break;
|
|
2022
|
-
case "down": {
|
|
2023
|
-
const path = plateCommon.findNodePath(editor, element);
|
|
2024
|
-
if (!path) {
|
|
2025
|
-
return;
|
|
2026
|
-
}
|
|
2027
|
-
const nextNodePath = plateCommon.getPointAfter(editor, path);
|
|
2028
|
-
if (!nextNodePath) {
|
|
2029
|
-
plateCommon.insertNodes(
|
|
2030
|
-
editor,
|
|
2031
|
-
[
|
|
2032
|
-
{
|
|
2033
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
2034
|
-
children: [{ text: "" }],
|
|
2035
|
-
lang: void 0,
|
|
2036
|
-
value: void 0
|
|
2037
|
-
}
|
|
2038
|
-
],
|
|
2039
|
-
{ select: true }
|
|
2040
|
-
);
|
|
2041
|
-
plateCommon.focusEditor(editor);
|
|
2042
|
-
} else {
|
|
2043
|
-
plateCommon.focusEditor(editor, nextNodePath);
|
|
2044
|
-
}
|
|
2045
|
-
break;
|
|
2046
|
-
}
|
|
2461
|
+
);
|
|
2462
|
+
});
|
|
2463
|
+
const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
2464
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
2465
|
+
const DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
|
|
2466
|
+
const DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
|
|
2467
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
2468
|
+
const DropdownMenuSubTrigger = cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2469
|
+
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
2470
|
+
{
|
|
2471
|
+
className: cn$1.cn(
|
|
2472
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
2473
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2474
|
+
inset && "pl-8",
|
|
2475
|
+
className
|
|
2476
|
+
),
|
|
2477
|
+
ref,
|
|
2478
|
+
...props
|
|
2479
|
+
},
|
|
2480
|
+
children,
|
|
2481
|
+
/* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
|
|
2482
|
+
));
|
|
2483
|
+
const DropdownMenuSubContent = cn$1.withCn(
|
|
2484
|
+
DropdownMenuPrimitive__namespace.SubContent,
|
|
2485
|
+
"z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
|
|
2486
|
+
);
|
|
2487
|
+
const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
|
|
2488
|
+
className: cn$1.cn(
|
|
2489
|
+
"z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
|
|
2490
|
+
),
|
|
2491
|
+
sideOffset: 4
|
|
2492
|
+
});
|
|
2493
|
+
const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
|
|
2494
|
+
const menuItemVariants = classVarianceAuthority.cva(
|
|
2495
|
+
cn$1.cn(
|
|
2496
|
+
"relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
2497
|
+
"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
2498
|
+
),
|
|
2499
|
+
{
|
|
2500
|
+
variants: {
|
|
2501
|
+
inset: {
|
|
2502
|
+
true: "pl-8"
|
|
2047
2503
|
}
|
|
2048
2504
|
}
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2505
|
+
}
|
|
2506
|
+
);
|
|
2507
|
+
const DropdownMenuItem = cn$1.withVariants(
|
|
2508
|
+
DropdownMenuPrimitive__namespace.Item,
|
|
2509
|
+
menuItemVariants,
|
|
2510
|
+
["inset"]
|
|
2511
|
+
);
|
|
2512
|
+
const DropdownMenuCheckboxItem = cn$1.withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2513
|
+
DropdownMenuPrimitive__namespace.CheckboxItem,
|
|
2514
|
+
{
|
|
2515
|
+
className: cn$1.cn(
|
|
2516
|
+
"relative flex select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2517
|
+
"cursor-pointer",
|
|
2518
|
+
className
|
|
2519
|
+
),
|
|
2520
|
+
ref,
|
|
2521
|
+
...props
|
|
2522
|
+
},
|
|
2523
|
+
/* @__PURE__ */ React.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
|
|
2524
|
+
children
|
|
2525
|
+
));
|
|
2526
|
+
const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2527
|
+
DropdownMenuPrimitive__namespace.RadioItem,
|
|
2528
|
+
{
|
|
2529
|
+
className: cn$1.cn(
|
|
2530
|
+
"relative flex select-none items-center rounded-sm pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2531
|
+
"h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
|
|
2532
|
+
className
|
|
2533
|
+
),
|
|
2534
|
+
ref,
|
|
2535
|
+
...props
|
|
2536
|
+
},
|
|
2537
|
+
!hideIcon && /* @__PURE__ */ React.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
|
|
2538
|
+
children
|
|
2539
|
+
));
|
|
2540
|
+
const dropdownMenuLabelVariants = classVarianceAuthority.cva(
|
|
2541
|
+
cn$1.cn("select-none px-2 py-1.5 text-sm font-semibold"),
|
|
2542
|
+
{
|
|
2543
|
+
variants: {
|
|
2544
|
+
inset: {
|
|
2545
|
+
true: "pl-8"
|
|
2080
2546
|
}
|
|
2081
|
-
}
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
);
|
|
2550
|
+
const DropdownMenuLabel = cn$1.withVariants(
|
|
2551
|
+
DropdownMenuPrimitive__namespace.Label,
|
|
2552
|
+
dropdownMenuLabelVariants,
|
|
2553
|
+
["inset"]
|
|
2554
|
+
);
|
|
2555
|
+
const DropdownMenuSeparator = cn$1.withCn(
|
|
2556
|
+
DropdownMenuPrimitive__namespace.Separator,
|
|
2557
|
+
"-mx-1 my-1 h-px bg-muted"
|
|
2558
|
+
);
|
|
2559
|
+
cn$1.withCn(
|
|
2560
|
+
cn$1.createPrimitiveElement("span"),
|
|
2561
|
+
"ml-auto text-xs tracking-widest opacity-60"
|
|
2562
|
+
);
|
|
2563
|
+
const useOpenState = () => {
|
|
2564
|
+
const [open2, setOpen] = React.useState(false);
|
|
2565
|
+
const onOpenChange = React.useCallback(
|
|
2566
|
+
(_value = !open2) => {
|
|
2567
|
+
setOpen(_value);
|
|
2568
|
+
},
|
|
2569
|
+
[open2]
|
|
2570
|
+
);
|
|
2571
|
+
return {
|
|
2572
|
+
onOpenChange,
|
|
2573
|
+
open: open2
|
|
2574
|
+
};
|
|
2575
|
+
};
|
|
2576
|
+
const Popover$2 = PopoverPrimitive__namespace.Root;
|
|
2577
|
+
const popoverVariants = classVarianceAuthority.cva(
|
|
2578
|
+
"w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 print:hidden"
|
|
2579
|
+
);
|
|
2580
|
+
const PopoverContent$1 = cn$1.withRef(
|
|
2581
|
+
({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
|
|
2582
|
+
PopoverPrimitive__namespace.Content,
|
|
2583
|
+
{
|
|
2584
|
+
align,
|
|
2585
|
+
className: cn$1.cn(popoverVariants(), className),
|
|
2586
|
+
ref,
|
|
2587
|
+
sideOffset,
|
|
2588
|
+
style: { zIndex: 1e3, ...style },
|
|
2589
|
+
...props
|
|
2590
|
+
}
|
|
2591
|
+
))
|
|
2592
|
+
);
|
|
2593
|
+
const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
|
|
2594
|
+
defaultVariants: {
|
|
2595
|
+
orientation: "horizontal"
|
|
2596
|
+
},
|
|
2597
|
+
variants: {
|
|
2598
|
+
orientation: {
|
|
2599
|
+
horizontal: "h-px w-full",
|
|
2600
|
+
vertical: "h-full w-px"
|
|
2601
|
+
}
|
|
2082
2602
|
}
|
|
2603
|
+
});
|
|
2604
|
+
const Separator = cn$1.withVariants(
|
|
2605
|
+
cn$1.withProps(SeparatorPrimitive__namespace.Root, {
|
|
2606
|
+
decorative: true,
|
|
2607
|
+
orientation: "horizontal"
|
|
2608
|
+
}),
|
|
2609
|
+
separatorVariants
|
|
2610
|
+
);
|
|
2611
|
+
const TableBordersDropdownMenuContent = cn$1.withRef((props, ref) => {
|
|
2612
|
+
const {
|
|
2613
|
+
getOnSelectTableBorder,
|
|
2614
|
+
hasBottomBorder,
|
|
2615
|
+
hasLeftBorder,
|
|
2616
|
+
hasNoBorders,
|
|
2617
|
+
hasOuterBorders,
|
|
2618
|
+
hasRightBorder,
|
|
2619
|
+
hasTopBorder
|
|
2620
|
+
} = plateTable.useTableBordersDropdownMenuContentState();
|
|
2083
2621
|
return /* @__PURE__ */ React.createElement(
|
|
2084
|
-
|
|
2622
|
+
DropdownMenuContent,
|
|
2085
2623
|
{
|
|
2086
|
-
|
|
2087
|
-
className: "
|
|
2624
|
+
align: "start",
|
|
2625
|
+
className: cn$1.cn("min-w-[220px]"),
|
|
2626
|
+
ref,
|
|
2627
|
+
side: "right",
|
|
2628
|
+
sideOffset: 0,
|
|
2629
|
+
...props
|
|
2088
2630
|
},
|
|
2089
|
-
/* @__PURE__ */ React.createElement(
|
|
2090
|
-
|
|
2091
|
-
visibility: hidden !important;
|
|
2092
|
-
}`),
|
|
2093
|
-
props.children,
|
|
2094
|
-
/* @__PURE__ */ React.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement(
|
|
2095
|
-
Autocomplete,
|
|
2631
|
+
/* @__PURE__ */ React.createElement(
|
|
2632
|
+
DropdownMenuCheckboxItem,
|
|
2096
2633
|
{
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
)
|
|
2103
|
-
|
|
2634
|
+
checked: hasBottomBorder,
|
|
2635
|
+
onCheckedChange: getOnSelectTableBorder("bottom")
|
|
2636
|
+
},
|
|
2637
|
+
/* @__PURE__ */ React.createElement(Icons.borderBottom, { className: iconVariants({ size: "sm" }) }),
|
|
2638
|
+
/* @__PURE__ */ React.createElement("div", null, "Bottom Border")
|
|
2639
|
+
),
|
|
2640
|
+
/* @__PURE__ */ React.createElement(
|
|
2641
|
+
DropdownMenuCheckboxItem,
|
|
2104
2642
|
{
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2643
|
+
checked: hasTopBorder,
|
|
2644
|
+
onCheckedChange: getOnSelectTableBorder("top")
|
|
2645
|
+
},
|
|
2646
|
+
/* @__PURE__ */ React.createElement(Icons.borderTop, { className: iconVariants({ size: "sm" }) }),
|
|
2647
|
+
/* @__PURE__ */ React.createElement("div", null, "Top Border")
|
|
2648
|
+
),
|
|
2649
|
+
/* @__PURE__ */ React.createElement(
|
|
2650
|
+
DropdownMenuCheckboxItem,
|
|
2651
|
+
{
|
|
2652
|
+
checked: hasLeftBorder,
|
|
2653
|
+
onCheckedChange: getOnSelectTableBorder("left")
|
|
2654
|
+
},
|
|
2655
|
+
/* @__PURE__ */ React.createElement(Icons.borderLeft, { className: iconVariants({ size: "sm" }) }),
|
|
2656
|
+
/* @__PURE__ */ React.createElement("div", null, "Left Border")
|
|
2657
|
+
),
|
|
2658
|
+
/* @__PURE__ */ React.createElement(
|
|
2659
|
+
DropdownMenuCheckboxItem,
|
|
2660
|
+
{
|
|
2661
|
+
checked: hasRightBorder,
|
|
2662
|
+
onCheckedChange: getOnSelectTableBorder("right")
|
|
2663
|
+
},
|
|
2664
|
+
/* @__PURE__ */ React.createElement(Icons.borderRight, { className: iconVariants({ size: "sm" }) }),
|
|
2665
|
+
/* @__PURE__ */ React.createElement("div", null, "Right Border")
|
|
2666
|
+
),
|
|
2667
|
+
/* @__PURE__ */ React.createElement(Separator, null),
|
|
2668
|
+
/* @__PURE__ */ React.createElement(
|
|
2669
|
+
DropdownMenuCheckboxItem,
|
|
2670
|
+
{
|
|
2671
|
+
checked: hasNoBorders,
|
|
2672
|
+
onCheckedChange: getOnSelectTableBorder("none")
|
|
2673
|
+
},
|
|
2674
|
+
/* @__PURE__ */ React.createElement(Icons.borderNone, { className: iconVariants({ size: "sm" }) }),
|
|
2675
|
+
/* @__PURE__ */ React.createElement("div", null, "No Border")
|
|
2676
|
+
),
|
|
2677
|
+
/* @__PURE__ */ React.createElement(
|
|
2678
|
+
DropdownMenuCheckboxItem,
|
|
2679
|
+
{
|
|
2680
|
+
checked: hasOuterBorders,
|
|
2681
|
+
onCheckedChange: getOnSelectTableBorder("outer")
|
|
2682
|
+
},
|
|
2683
|
+
/* @__PURE__ */ React.createElement(Icons.borderAll, { className: iconVariants({ size: "sm" }) }),
|
|
2684
|
+
/* @__PURE__ */ React.createElement("div", null, "Outside Borders")
|
|
2685
|
+
)
|
|
2141
2686
|
);
|
|
2142
|
-
};
|
|
2143
|
-
const
|
|
2144
|
-
({
|
|
2145
|
-
const
|
|
2146
|
-
const
|
|
2147
|
-
|
|
2148
|
-
plateCommon.
|
|
2687
|
+
});
|
|
2688
|
+
const TableFloatingToolbar = cn$1.withRef(
|
|
2689
|
+
({ children, ...props }, ref) => {
|
|
2690
|
+
const element = plateCommon.useElement();
|
|
2691
|
+
const { props: buttonProps } = plateCommon.useRemoveNodeButton({ element });
|
|
2692
|
+
const selectionCollapsed = plateCommon.useEditorSelector(
|
|
2693
|
+
(editor2) => !plateCommon.isSelectionExpanded(editor2),
|
|
2694
|
+
[]
|
|
2695
|
+
);
|
|
2696
|
+
const readOnly = slateReact.useReadOnly();
|
|
2697
|
+
const selected = slateReact.useSelected();
|
|
2698
|
+
const editor = plateCommon.useEditorRef();
|
|
2699
|
+
const collapsed = !readOnly && selected && selectionCollapsed;
|
|
2700
|
+
const open2 = !readOnly && selected;
|
|
2701
|
+
const { canMerge, canUnmerge } = plateTable.useTableMergeState();
|
|
2702
|
+
const mergeContent = canMerge && /* @__PURE__ */ React.createElement(
|
|
2703
|
+
Button$2,
|
|
2149
2704
|
{
|
|
2150
|
-
|
|
2705
|
+
contentEditable: false,
|
|
2706
|
+
isMenu: true,
|
|
2707
|
+
onClick: () => plateTable.mergeTableCells(editor),
|
|
2708
|
+
variant: "ghost"
|
|
2709
|
+
},
|
|
2710
|
+
/* @__PURE__ */ React.createElement(Icons.combine, { className: "mr-2 size-4" }),
|
|
2711
|
+
"Merge"
|
|
2712
|
+
);
|
|
2713
|
+
const unmergeButton = canUnmerge && /* @__PURE__ */ React.createElement(
|
|
2714
|
+
Button$2,
|
|
2715
|
+
{
|
|
2716
|
+
contentEditable: false,
|
|
2717
|
+
isMenu: true,
|
|
2718
|
+
onClick: () => plateTable.unmergeTableCells(editor),
|
|
2719
|
+
variant: "ghost"
|
|
2720
|
+
},
|
|
2721
|
+
/* @__PURE__ */ React.createElement(Icons.ungroup, { className: "mr-2 size-4" }),
|
|
2722
|
+
"Unmerge"
|
|
2723
|
+
);
|
|
2724
|
+
const bordersContent = collapsed && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(Button$2, { isMenu: true, variant: "ghost" }, /* @__PURE__ */ React.createElement(Icons.borderAll, { className: "mr-2 size-4" }), "Borders")), /* @__PURE__ */ React.createElement(DropdownMenuPortal, null, /* @__PURE__ */ React.createElement(TableBordersDropdownMenuContent, null))), /* @__PURE__ */ React.createElement(Button$2, { contentEditable: false, isMenu: true, variant: "ghost", ...buttonProps }, /* @__PURE__ */ React.createElement(Icons.delete, { className: "mr-2 size-4" }), "Delete"));
|
|
2725
|
+
return /* @__PURE__ */ React.createElement(Popover$2, { modal: false, open: open2 }, /* @__PURE__ */ React.createElement(PopoverPrimitive.PopoverAnchor, { asChild: true }, children), (canMerge || canUnmerge || collapsed) && /* @__PURE__ */ React.createElement(
|
|
2726
|
+
PopoverContent$1,
|
|
2727
|
+
{
|
|
2728
|
+
className: cn$1.cn(
|
|
2729
|
+
popoverVariants(),
|
|
2730
|
+
"flex w-[220px] flex-col gap-1 p-1"
|
|
2731
|
+
),
|
|
2732
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2151
2733
|
ref,
|
|
2152
2734
|
...props
|
|
2153
2735
|
},
|
|
2154
|
-
|
|
2155
|
-
|
|
2736
|
+
unmergeButton,
|
|
2737
|
+
mergeContent,
|
|
2738
|
+
bordersContent
|
|
2739
|
+
));
|
|
2156
2740
|
}
|
|
2157
2741
|
);
|
|
2742
|
+
const TableElement = plateCommon.withHOC(
|
|
2743
|
+
plateTable.TableProvider,
|
|
2744
|
+
cn$1.withRef(({ children, className, ...props }, ref) => {
|
|
2745
|
+
const { colSizes, isSelectingCell, marginLeft, minColumnWidth } = plateTable.useTableElementState();
|
|
2746
|
+
const { colGroupProps, props: tableProps } = plateTable.useTableElement();
|
|
2747
|
+
return /* @__PURE__ */ React.createElement(TableFloatingToolbar, null, /* @__PURE__ */ React.createElement("div", { style: { paddingLeft: marginLeft } }, /* @__PURE__ */ React.createElement(
|
|
2748
|
+
plateCommon.PlateElement,
|
|
2749
|
+
{
|
|
2750
|
+
asChild: true,
|
|
2751
|
+
className: cn$1.cn(
|
|
2752
|
+
"my-4 ml-px mr-0 table h-px w-full table-fixed border-collapse",
|
|
2753
|
+
isSelectingCell && "[&_*::selection]:bg-none",
|
|
2754
|
+
className
|
|
2755
|
+
),
|
|
2756
|
+
ref,
|
|
2757
|
+
...tableProps,
|
|
2758
|
+
...props
|
|
2759
|
+
},
|
|
2760
|
+
/* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("colgroup", { ...colGroupProps }, colSizes.map((width, index) => /* @__PURE__ */ React.createElement(
|
|
2761
|
+
"col",
|
|
2762
|
+
{
|
|
2763
|
+
key: index,
|
|
2764
|
+
style: {
|
|
2765
|
+
minWidth: minColumnWidth,
|
|
2766
|
+
width: width || void 0
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
))), /* @__PURE__ */ React.createElement("tbody", { className: "min-w-full" }, children))
|
|
2770
|
+
)));
|
|
2771
|
+
})
|
|
2772
|
+
);
|
|
2773
|
+
const TableRowElement = cn$1.withRef(({ children, hideBorder, ...props }, ref) => {
|
|
2774
|
+
return /* @__PURE__ */ React.createElement(
|
|
2775
|
+
plateCommon.PlateElement,
|
|
2776
|
+
{
|
|
2777
|
+
asChild: true,
|
|
2778
|
+
className: cn$1.cn("h-full", hideBorder && "border-none"),
|
|
2779
|
+
ref,
|
|
2780
|
+
...props
|
|
2781
|
+
},
|
|
2782
|
+
/* @__PURE__ */ React.createElement("tr", null, children)
|
|
2783
|
+
);
|
|
2784
|
+
});
|
|
2158
2785
|
const blockClasses = "mt-0.5";
|
|
2159
2786
|
const headerClasses = "font-normal";
|
|
2160
2787
|
const Components = () => {
|
|
@@ -2260,6 +2887,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2260
2887
|
}
|
|
2261
2888
|
)
|
|
2262
2889
|
),
|
|
2890
|
+
[ELEMENT_MERMAID]: MermaidElement,
|
|
2263
2891
|
[plate.ELEMENT_BLOCKQUOTE]: BlockquoteElement,
|
|
2264
2892
|
[plate.ELEMENT_CODE_BLOCK]: CodeBlockElement,
|
|
2265
2893
|
[plate.ELEMENT_CODE_LINE]: CodeLineElement,
|
|
@@ -2340,7 +2968,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2340
2968
|
children,
|
|
2341
2969
|
selected && /* @__PURE__ */ React.createElement("span", { className: "absolute h-4 -top-2 inset-0 ring-2 ring-blue-100 ring-inset rounded-md z-10 pointer-events-none" })
|
|
2342
2970
|
);
|
|
2343
|
-
}
|
|
2971
|
+
},
|
|
2972
|
+
[plate.ELEMENT_TABLE]: TableElement,
|
|
2973
|
+
[plate.ELEMENT_TR]: TableRowElement,
|
|
2974
|
+
[plate.ELEMENT_TD]: TableCellElement,
|
|
2975
|
+
[plate.ELEMENT_TH]: TableCellHeaderElement
|
|
2344
2976
|
};
|
|
2345
2977
|
};
|
|
2346
2978
|
const createCodeBlockPlugin = plateCommon.createPluginFactory({
|
|
@@ -2750,7 +3382,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2750
3382
|
{
|
|
2751
3383
|
type: "string",
|
|
2752
3384
|
label: "Caption",
|
|
2753
|
-
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
3385
|
+
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
3386
|
+
"."
|
|
3387
|
+
),
|
|
2754
3388
|
component: "text"
|
|
2755
3389
|
}
|
|
2756
3390
|
]
|
|
@@ -3068,7 +3702,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3068
3702
|
};
|
|
3069
3703
|
const sizeClasses = {
|
|
3070
3704
|
small: `text-xs h-8 px-3`,
|
|
3071
|
-
medium: `text-sm h-10 px-
|
|
3705
|
+
medium: `text-sm h-10 px-8`,
|
|
3072
3706
|
custom: ``
|
|
3073
3707
|
};
|
|
3074
3708
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -3196,7 +3830,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3196
3830
|
function _objectWithoutProperties(source, excluded) {
|
|
3197
3831
|
if (source == null)
|
|
3198
3832
|
return {};
|
|
3199
|
-
var target = _objectWithoutPropertiesLoose
|
|
3833
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
3200
3834
|
var key, i;
|
|
3201
3835
|
if (Object.getOwnPropertySymbols) {
|
|
3202
3836
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
@@ -3211,7 +3845,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3211
3845
|
}
|
|
3212
3846
|
return target;
|
|
3213
3847
|
}
|
|
3214
|
-
function _objectWithoutPropertiesLoose
|
|
3848
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
3215
3849
|
if (source == null)
|
|
3216
3850
|
return {};
|
|
3217
3851
|
var target = {};
|
|
@@ -4301,7 +4935,28 @@ var __publicField = (obj, key, value) => {
|
|
|
4301
4935
|
onChange,
|
|
4302
4936
|
value,
|
|
4303
4937
|
step
|
|
4304
|
-
}) => /* @__PURE__ */ React__namespace.createElement(
|
|
4938
|
+
}) => /* @__PURE__ */ React__namespace.createElement(
|
|
4939
|
+
Input,
|
|
4940
|
+
{
|
|
4941
|
+
type: "number",
|
|
4942
|
+
step,
|
|
4943
|
+
value,
|
|
4944
|
+
onChange: (event) => {
|
|
4945
|
+
const inputValue = event.target.value;
|
|
4946
|
+
const newValue = inputValue === "" ? void 0 : inputValue;
|
|
4947
|
+
if (onChange) {
|
|
4948
|
+
const syntheticEvent = {
|
|
4949
|
+
...event,
|
|
4950
|
+
target: {
|
|
4951
|
+
...event.target,
|
|
4952
|
+
value: newValue
|
|
4953
|
+
}
|
|
4954
|
+
};
|
|
4955
|
+
onChange(syntheticEvent);
|
|
4956
|
+
}
|
|
4957
|
+
}
|
|
4958
|
+
}
|
|
4959
|
+
);
|
|
4305
4960
|
function useCMS() {
|
|
4306
4961
|
return useCMS$1();
|
|
4307
4962
|
}
|
|
@@ -4410,7 +5065,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4410
5065
|
function cn(...inputs) {
|
|
4411
5066
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
4412
5067
|
}
|
|
4413
|
-
const buttonVariants
|
|
5068
|
+
const buttonVariants = classVarianceAuthority.cva(
|
|
4414
5069
|
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
4415
5070
|
{
|
|
4416
5071
|
variants: {
|
|
@@ -4436,7 +5091,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4436
5091
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
4437
5092
|
Comp,
|
|
4438
5093
|
{
|
|
4439
|
-
className: cn(buttonVariants
|
|
5094
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
4440
5095
|
ref,
|
|
4441
5096
|
...props
|
|
4442
5097
|
}
|
|
@@ -4605,7 +5260,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4605
5260
|
edges: response.collection.documents.edges
|
|
4606
5261
|
};
|
|
4607
5262
|
} catch (e) {
|
|
4608
|
-
console.error(
|
|
5263
|
+
console.error(
|
|
5264
|
+
"Exception thrown while building and running GraphQL query: ",
|
|
5265
|
+
e
|
|
5266
|
+
);
|
|
4609
5267
|
return {
|
|
4610
5268
|
collection,
|
|
4611
5269
|
edges: []
|
|
@@ -5099,10 +5757,11 @@ var __publicField = (obj, key, value) => {
|
|
|
5099
5757
|
return /* @__PURE__ */ React.createElement(
|
|
5100
5758
|
"button",
|
|
5101
5759
|
{
|
|
5102
|
-
|
|
5760
|
+
type: "button",
|
|
5761
|
+
className: `w-8 px-1 py-2.5 flex items-center justify-center text-gray-200 hover:opacity-100 opacity-30 hover:bg-gray-50 ${disabled && "pointer-events-none opacity-30 cursor-not-allowed"}`,
|
|
5103
5762
|
onClick
|
|
5104
5763
|
},
|
|
5105
|
-
/* @__PURE__ */ React.createElement(TrashIcon, { className: "fill-current transition-colors ease-out
|
|
5764
|
+
/* @__PURE__ */ React.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
|
|
5106
5765
|
);
|
|
5107
5766
|
};
|
|
5108
5767
|
const DragHandle = ({ isDragging }) => {
|
|
@@ -5132,7 +5791,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5132
5791
|
return template.label ? template.label.toLowerCase().includes(filter.toLowerCase()) || name.toLowerCase().includes(filter.toLowerCase()) : name.toLowerCase().includes(filter.toLowerCase());
|
|
5133
5792
|
});
|
|
5134
5793
|
}, [filter]);
|
|
5135
|
-
return /* @__PURE__ */ React__namespace.createElement(react
|
|
5794
|
+
return /* @__PURE__ */ React__namespace.createElement(react.Popover, null, ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(react.PopoverButton, { as: "span" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5136
5795
|
IconButton,
|
|
5137
5796
|
{
|
|
5138
5797
|
variant: open2 ? "secondary" : "primary",
|
|
@@ -5141,7 +5800,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5141
5800
|
},
|
|
5142
5801
|
/* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
|
|
5143
5802
|
)), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute -bottom-1 right-0 z-50" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5144
|
-
react
|
|
5803
|
+
react.Transition,
|
|
5145
5804
|
{
|
|
5146
5805
|
enter: "transition duration-150 ease-out",
|
|
5147
5806
|
enterFrom: "transform opacity-0 -translate-y-2",
|
|
@@ -5150,7 +5809,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5150
5809
|
leaveFrom: "transform opacity-100 translate-y-0",
|
|
5151
5810
|
leaveTo: "transform opacity-0 -translate-y-2"
|
|
5152
5811
|
},
|
|
5153
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
5812
|
+
/* @__PURE__ */ React__namespace.createElement(react.PopoverPanel, { className: "relative overflow-hidden rounded-lg shadow-lg bg-white border border-gray-100" }, ({ close: close2 }) => /* @__PURE__ */ React__namespace.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto flex flex-col w-full h-full" }, showFilter && /* @__PURE__ */ React__namespace.createElement("div", { className: "sticky top-0 bg-gray-50 p-2 border-b border-gray-100 z-10" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5154
5813
|
"input",
|
|
5155
5814
|
{
|
|
5156
5815
|
type: "text",
|
|
@@ -5180,27 +5839,35 @@ var __publicField = (obj, key, value) => {
|
|
|
5180
5839
|
))))
|
|
5181
5840
|
))));
|
|
5182
5841
|
};
|
|
5183
|
-
const Group =
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5842
|
+
const Group = wrapFieldWithNoHeader(
|
|
5843
|
+
({ tinaForm, field }) => {
|
|
5844
|
+
const cms = useCMS$1();
|
|
5845
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5846
|
+
Header,
|
|
5847
|
+
{
|
|
5848
|
+
onClick: () => {
|
|
5849
|
+
const state = tinaForm.finalForm.getState();
|
|
5850
|
+
if (state.invalid === true) {
|
|
5851
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
5852
|
+
return;
|
|
5853
|
+
}
|
|
5854
|
+
cms.dispatch({
|
|
5855
|
+
type: "forms:set-active-field-name",
|
|
5856
|
+
value: { formId: tinaForm.id, fieldName: field.name }
|
|
5857
|
+
});
|
|
5194
5858
|
}
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5859
|
+
},
|
|
5860
|
+
field.label || field.name,
|
|
5861
|
+
field.description && /* @__PURE__ */ React__namespace.createElement(
|
|
5862
|
+
"span",
|
|
5863
|
+
{
|
|
5864
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
|
|
5865
|
+
dangerouslySetInnerHTML: { __html: field.description }
|
|
5866
|
+
}
|
|
5867
|
+
)
|
|
5868
|
+
));
|
|
5869
|
+
}
|
|
5870
|
+
);
|
|
5204
5871
|
const Header = ({ onClick, children }) => {
|
|
5205
5872
|
return /* @__PURE__ */ React__namespace.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5206
5873
|
"button",
|
|
@@ -5327,8 +5994,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5327
5994
|
onClick: () => setPickerIsOpen(!pickerIsOpen)
|
|
5328
5995
|
},
|
|
5329
5996
|
/* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
|
|
5330
|
-
), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react
|
|
5331
|
-
react
|
|
5997
|
+
), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: pickerIsOpen }, /* @__PURE__ */ React__namespace.createElement(
|
|
5998
|
+
react.TransitionChild,
|
|
5332
5999
|
{
|
|
5333
6000
|
enter: "transform transition-all ease-out duration-200",
|
|
5334
6001
|
enterFrom: "opacity-0 -translate-x-1/2",
|
|
@@ -5415,14 +6082,14 @@ var __publicField = (obj, key, value) => {
|
|
|
5415
6082
|
};
|
|
5416
6083
|
const BlockGroup = ({ category, templates, close: close2, isLast = false }) => {
|
|
5417
6084
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
5418
|
-
react
|
|
6085
|
+
react.Disclosure,
|
|
5419
6086
|
{
|
|
5420
6087
|
defaultOpen: true,
|
|
5421
6088
|
as: "div",
|
|
5422
6089
|
className: `left-0 right-0 relative`
|
|
5423
6090
|
},
|
|
5424
6091
|
({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5425
|
-
react
|
|
6092
|
+
react.DisclosureButton,
|
|
5426
6093
|
{
|
|
5427
6094
|
className: `relative block group text-left w-full text-base font-bold tracking-wide py-2 truncate ${templates.length === 0 ? `pointer-events-none` : ``} ${!isLast && (!open2 || templates.length === 0) && `border-b border-gray-100`}`
|
|
5428
6095
|
},
|
|
@@ -5440,7 +6107,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5440
6107
|
}
|
|
5441
6108
|
)
|
|
5442
6109
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
5443
|
-
react
|
|
6110
|
+
react.Transition,
|
|
5444
6111
|
{
|
|
5445
6112
|
enter: "transition duration-100 ease-out",
|
|
5446
6113
|
enterFrom: "transform scale-95 opacity-0",
|
|
@@ -5449,7 +6116,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5449
6116
|
leaveFrom: "transform scale-100 opacity-100",
|
|
5450
6117
|
leaveTo: "transform scale-95 opacity-0"
|
|
5451
6118
|
},
|
|
5452
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
6119
|
+
/* @__PURE__ */ React__namespace.createElement(react.DisclosurePanel, null, templates.length > 0 && /* @__PURE__ */ React__namespace.createElement(CardColumns, null, templates.map(([name, template], index) => /* @__PURE__ */ React__namespace.createElement(
|
|
5453
6120
|
BlockCard,
|
|
5454
6121
|
{
|
|
5455
6122
|
key: index,
|
|
@@ -6542,244 +7209,65 @@ var __publicField = (obj, key, value) => {
|
|
|
6542
7209
|
str = "0" + str;
|
|
6543
7210
|
return str;
|
|
6544
7211
|
}
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
}
|
|
6557
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
6558
|
-
if (source == null)
|
|
6559
|
-
return {};
|
|
6560
|
-
var target = {};
|
|
6561
|
-
var sourceKeys = Object.keys(source);
|
|
6562
|
-
var key, i;
|
|
6563
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
6564
|
-
key = sourceKeys[i];
|
|
6565
|
-
if (excluded.indexOf(key) >= 0)
|
|
6566
|
-
continue;
|
|
6567
|
-
target[key] = source[key];
|
|
6568
|
-
}
|
|
6569
|
-
return target;
|
|
6570
|
-
}
|
|
6571
|
-
function _assertThisInitialized(self2) {
|
|
6572
|
-
if (self2 === void 0) {
|
|
6573
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
6574
|
-
}
|
|
6575
|
-
return self2;
|
|
6576
|
-
}
|
|
6577
|
-
function isNodeFound(current, componentNode, ignoreClass) {
|
|
6578
|
-
if (current === componentNode) {
|
|
6579
|
-
return true;
|
|
6580
|
-
}
|
|
6581
|
-
if (current.correspondingElement) {
|
|
6582
|
-
return current.correspondingElement.classList.contains(ignoreClass);
|
|
6583
|
-
}
|
|
6584
|
-
return current.classList.contains(ignoreClass);
|
|
6585
|
-
}
|
|
6586
|
-
function findHighest(current, componentNode, ignoreClass) {
|
|
6587
|
-
if (current === componentNode) {
|
|
6588
|
-
return true;
|
|
7212
|
+
var useClickAway$1 = {};
|
|
7213
|
+
var util = {};
|
|
7214
|
+
Object.defineProperty(util, "__esModule", { value: true });
|
|
7215
|
+
util.isNavigator = util.isBrowser = util.off = util.on = util.noop = void 0;
|
|
7216
|
+
var noop = function() {
|
|
7217
|
+
};
|
|
7218
|
+
util.noop = noop;
|
|
7219
|
+
function on(obj) {
|
|
7220
|
+
var args = [];
|
|
7221
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7222
|
+
args[_i - 1] = arguments[_i];
|
|
6589
7223
|
}
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
return true;
|
|
6593
|
-
}
|
|
6594
|
-
current = current.parentNode || current.host;
|
|
7224
|
+
if (obj && obj.addEventListener) {
|
|
7225
|
+
obj.addEventListener.apply(obj, args);
|
|
6595
7226
|
}
|
|
6596
|
-
return current;
|
|
6597
7227
|
}
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
return;
|
|
7228
|
+
util.on = on;
|
|
7229
|
+
function off(obj) {
|
|
7230
|
+
var args = [];
|
|
7231
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7232
|
+
args[_i - 1] = arguments[_i];
|
|
6604
7233
|
}
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
get: function get2() {
|
|
6608
|
-
passive = true;
|
|
6609
|
-
}
|
|
6610
|
-
});
|
|
6611
|
-
var noop = function noop2() {
|
|
6612
|
-
};
|
|
6613
|
-
window.addEventListener("testPassiveEventSupport", noop, options);
|
|
6614
|
-
window.removeEventListener("testPassiveEventSupport", noop, options);
|
|
6615
|
-
return passive;
|
|
6616
|
-
};
|
|
6617
|
-
function autoInc(seed) {
|
|
6618
|
-
if (seed === void 0) {
|
|
6619
|
-
seed = 0;
|
|
7234
|
+
if (obj && obj.removeEventListener) {
|
|
7235
|
+
obj.removeEventListener.apply(obj, args);
|
|
6620
7236
|
}
|
|
6621
|
-
return function() {
|
|
6622
|
-
return ++seed;
|
|
6623
|
-
};
|
|
6624
7237
|
}
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
var
|
|
6630
|
-
var
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
function onClickOutside(props) {
|
|
6645
|
-
var _this;
|
|
6646
|
-
_this = _Component.call(this, props) || this;
|
|
6647
|
-
_this.__outsideClickHandler = function(event) {
|
|
6648
|
-
if (typeof _this.__clickOutsideHandlerProp === "function") {
|
|
6649
|
-
_this.__clickOutsideHandlerProp(event);
|
|
6650
|
-
return;
|
|
6651
|
-
}
|
|
6652
|
-
var instance = _this.getInstance();
|
|
6653
|
-
if (typeof instance.props.handleClickOutside === "function") {
|
|
6654
|
-
instance.props.handleClickOutside(event);
|
|
6655
|
-
return;
|
|
6656
|
-
}
|
|
6657
|
-
if (typeof instance.handleClickOutside === "function") {
|
|
6658
|
-
instance.handleClickOutside(event);
|
|
6659
|
-
return;
|
|
6660
|
-
}
|
|
6661
|
-
throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
|
|
6662
|
-
};
|
|
6663
|
-
_this.__getComponentNode = function() {
|
|
6664
|
-
var instance = _this.getInstance();
|
|
6665
|
-
if (config && typeof config.setClickOutsideRef === "function") {
|
|
6666
|
-
return config.setClickOutsideRef()(instance);
|
|
6667
|
-
}
|
|
6668
|
-
if (typeof instance.setClickOutsideRef === "function") {
|
|
6669
|
-
return instance.setClickOutsideRef();
|
|
6670
|
-
}
|
|
6671
|
-
return reactDom.findDOMNode(instance);
|
|
6672
|
-
};
|
|
6673
|
-
_this.enableOnClickOutside = function() {
|
|
6674
|
-
if (typeof document === "undefined" || enabledInstances[_this._uid]) {
|
|
6675
|
-
return;
|
|
6676
|
-
}
|
|
6677
|
-
if (typeof passiveEventSupport === "undefined") {
|
|
6678
|
-
passiveEventSupport = testPassiveEventSupport();
|
|
6679
|
-
}
|
|
6680
|
-
enabledInstances[_this._uid] = true;
|
|
6681
|
-
var events = _this.props.eventTypes;
|
|
6682
|
-
if (!events.forEach) {
|
|
6683
|
-
events = [events];
|
|
6684
|
-
}
|
|
6685
|
-
handlersMap[_this._uid] = function(event) {
|
|
6686
|
-
if (_this.componentNode === null)
|
|
6687
|
-
return;
|
|
6688
|
-
if (_this.initTimeStamp > event.timeStamp)
|
|
6689
|
-
return;
|
|
6690
|
-
if (_this.props.preventDefault) {
|
|
6691
|
-
event.preventDefault();
|
|
6692
|
-
}
|
|
6693
|
-
if (_this.props.stopPropagation) {
|
|
6694
|
-
event.stopPropagation();
|
|
6695
|
-
}
|
|
6696
|
-
if (_this.props.excludeScrollbar && clickedScrollbar(event))
|
|
6697
|
-
return;
|
|
6698
|
-
var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
|
|
6699
|
-
if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
|
|
6700
|
-
return;
|
|
6701
|
-
}
|
|
6702
|
-
_this.__outsideClickHandler(event);
|
|
6703
|
-
};
|
|
6704
|
-
events.forEach(function(eventName) {
|
|
6705
|
-
document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
|
|
6706
|
-
});
|
|
6707
|
-
};
|
|
6708
|
-
_this.disableOnClickOutside = function() {
|
|
6709
|
-
delete enabledInstances[_this._uid];
|
|
6710
|
-
var fn = handlersMap[_this._uid];
|
|
6711
|
-
if (fn && typeof document !== "undefined") {
|
|
6712
|
-
var events = _this.props.eventTypes;
|
|
6713
|
-
if (!events.forEach) {
|
|
6714
|
-
events = [events];
|
|
6715
|
-
}
|
|
6716
|
-
events.forEach(function(eventName) {
|
|
6717
|
-
return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
|
|
6718
|
-
});
|
|
6719
|
-
delete handlersMap[_this._uid];
|
|
6720
|
-
}
|
|
6721
|
-
};
|
|
6722
|
-
_this.getRef = function(ref) {
|
|
6723
|
-
return _this.instanceRef = ref;
|
|
6724
|
-
};
|
|
6725
|
-
_this._uid = uid();
|
|
6726
|
-
_this.initTimeStamp = performance.now();
|
|
6727
|
-
return _this;
|
|
6728
|
-
}
|
|
6729
|
-
var _proto = onClickOutside.prototype;
|
|
6730
|
-
_proto.getInstance = function getInstance() {
|
|
6731
|
-
if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
|
|
6732
|
-
return this;
|
|
6733
|
-
}
|
|
6734
|
-
var ref = this.instanceRef;
|
|
6735
|
-
return ref.getInstance ? ref.getInstance() : ref;
|
|
6736
|
-
};
|
|
6737
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
6738
|
-
if (typeof document === "undefined" || !document.createElement) {
|
|
6739
|
-
return;
|
|
6740
|
-
}
|
|
6741
|
-
var instance = this.getInstance();
|
|
6742
|
-
if (config && typeof config.handleClickOutside === "function") {
|
|
6743
|
-
this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
|
|
6744
|
-
if (typeof this.__clickOutsideHandlerProp !== "function") {
|
|
6745
|
-
throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
|
|
6746
|
-
}
|
|
6747
|
-
}
|
|
6748
|
-
this.componentNode = this.__getComponentNode();
|
|
6749
|
-
if (this.props.disableOnClickOutside)
|
|
6750
|
-
return;
|
|
6751
|
-
this.enableOnClickOutside();
|
|
6752
|
-
};
|
|
6753
|
-
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
6754
|
-
this.componentNode = this.__getComponentNode();
|
|
6755
|
-
};
|
|
6756
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
6757
|
-
this.disableOnClickOutside();
|
|
7238
|
+
util.off = off;
|
|
7239
|
+
util.isBrowser = typeof window !== "undefined";
|
|
7240
|
+
util.isNavigator = typeof navigator !== "undefined";
|
|
7241
|
+
Object.defineProperty(useClickAway$1, "__esModule", { value: true });
|
|
7242
|
+
var react_1 = React;
|
|
7243
|
+
var util_1 = util;
|
|
7244
|
+
var defaultEvents = ["mousedown", "touchstart"];
|
|
7245
|
+
var useClickAway = function(ref, onClickAway, events) {
|
|
7246
|
+
if (events === void 0) {
|
|
7247
|
+
events = defaultEvents;
|
|
7248
|
+
}
|
|
7249
|
+
var savedCallback = react_1.useRef(onClickAway);
|
|
7250
|
+
react_1.useEffect(function() {
|
|
7251
|
+
savedCallback.current = onClickAway;
|
|
7252
|
+
}, [onClickAway]);
|
|
7253
|
+
react_1.useEffect(function() {
|
|
7254
|
+
var handler = function(event) {
|
|
7255
|
+
var el = ref.current;
|
|
7256
|
+
el && !el.contains(event.target) && savedCallback.current(event);
|
|
6758
7257
|
};
|
|
6759
|
-
|
|
6760
|
-
var
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
7258
|
+
for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
|
|
7259
|
+
var eventName = events_1[_i];
|
|
7260
|
+
util_1.on(document, eventName, handler);
|
|
7261
|
+
}
|
|
7262
|
+
return function() {
|
|
7263
|
+
for (var _i2 = 0, events_2 = events; _i2 < events_2.length; _i2++) {
|
|
7264
|
+
var eventName2 = events_2[_i2];
|
|
7265
|
+
util_1.off(document, eventName2, handler);
|
|
6767
7266
|
}
|
|
6768
|
-
props.disableOnClickOutside = this.disableOnClickOutside;
|
|
6769
|
-
props.enableOnClickOutside = this.enableOnClickOutside;
|
|
6770
|
-
return React.createElement(WrappedComponent, props);
|
|
6771
7267
|
};
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
excludeScrollbar: config && config.excludeScrollbar || false,
|
|
6776
|
-
outsideClickIgnoreClass: IGNORE_CLASS_NAME,
|
|
6777
|
-
preventDefault: false,
|
|
6778
|
-
stopPropagation: false
|
|
6779
|
-
}, _class.getClass = function() {
|
|
6780
|
-
return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
|
|
6781
|
-
}, _temp;
|
|
6782
|
-
}
|
|
7268
|
+
}, [events, ref]);
|
|
7269
|
+
};
|
|
7270
|
+
var _default = useClickAway$1.default = useClickAway;
|
|
6783
7271
|
const viewModes = {
|
|
6784
7272
|
YEARS: "years",
|
|
6785
7273
|
MONTHS: "months",
|
|
@@ -7308,22 +7796,13 @@ var __publicField = (obj, key, value) => {
|
|
|
7308
7796
|
}
|
|
7309
7797
|
con[method]("***react-datetime:" + message);
|
|
7310
7798
|
}
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
}
|
|
7316
|
-
|
|
7317
|
-
return /* @__PURE__ */ React.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
|
|
7318
|
-
}
|
|
7319
|
-
handleClickOutside(e) {
|
|
7320
|
-
this.props.onClickOut(e);
|
|
7321
|
-
}
|
|
7322
|
-
setClickOutsideRef() {
|
|
7323
|
-
return this.container.current;
|
|
7324
|
-
}
|
|
7799
|
+
function ClickableWrapper({ className, onClickOut, children }) {
|
|
7800
|
+
const containerRef = React.useRef(null);
|
|
7801
|
+
_default(containerRef, (event) => {
|
|
7802
|
+
onClickOut(event);
|
|
7803
|
+
});
|
|
7804
|
+
return /* @__PURE__ */ React.createElement("div", { className, ref: containerRef }, children);
|
|
7325
7805
|
}
|
|
7326
|
-
const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
|
|
7327
7806
|
const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
|
|
7328
7807
|
const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
|
|
7329
7808
|
const format$1 = (val, _name, field) => {
|
|
@@ -7366,7 +7845,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7366
7845
|
ReactDateTimeWithStyles,
|
|
7367
7846
|
{
|
|
7368
7847
|
value: input.value,
|
|
7369
|
-
onChange:
|
|
7848
|
+
onChange: (value) => {
|
|
7849
|
+
const newValue = value === "" ? void 0 : value;
|
|
7850
|
+
input.onChange(newValue);
|
|
7851
|
+
},
|
|
7370
7852
|
dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
|
|
7371
7853
|
timeFormat: timeFormat || false,
|
|
7372
7854
|
inputProps: { className: textFieldClasses },
|
|
@@ -9268,7 +9750,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9268
9750
|
const FormLists = (props) => {
|
|
9269
9751
|
const cms = useCMS();
|
|
9270
9752
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
9271
|
-
react
|
|
9753
|
+
react.Transition,
|
|
9272
9754
|
{
|
|
9273
9755
|
appear: true,
|
|
9274
9756
|
show: true,
|
|
@@ -9697,7 +10179,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9697
10179
|
"Event Log"
|
|
9698
10180
|
));
|
|
9699
10181
|
};
|
|
9700
|
-
const version = "2.
|
|
10182
|
+
const version = "2.6.0";
|
|
9701
10183
|
const Nav = ({
|
|
9702
10184
|
isLocalMode,
|
|
9703
10185
|
className = "",
|
|
@@ -9751,8 +10233,8 @@ var __publicField = (obj, key, value) => {
|
|
|
9751
10233
|
style: { maxWidth: `${sidebarWidth}px` },
|
|
9752
10234
|
...props
|
|
9753
10235
|
},
|
|
9754
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "border-b border-gray-200" }, /* @__PURE__ */ React__namespace.createElement(react
|
|
9755
|
-
react
|
|
10236
|
+
/* @__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(
|
|
10237
|
+
react.MenuButton,
|
|
9756
10238
|
{
|
|
9757
10239
|
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"}`
|
|
9758
10240
|
},
|
|
@@ -9775,7 +10257,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9775
10257
|
}
|
|
9776
10258
|
)
|
|
9777
10259
|
), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute bottom-3 right-5 z-50" }, /* @__PURE__ */ React__namespace.createElement(
|
|
9778
|
-
react
|
|
10260
|
+
react.Transition,
|
|
9779
10261
|
{
|
|
9780
10262
|
enter: "transition duration-150 ease-out",
|
|
9781
10263
|
enterFrom: "transform opacity-0 -translate-y-2",
|
|
@@ -9784,7 +10266,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9784
10266
|
leaveFrom: "transform opacity-100 translate-y-0",
|
|
9785
10267
|
leaveTo: "transform opacity-0 -translate-y-2"
|
|
9786
10268
|
},
|
|
9787
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
10269
|
+
/* @__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(
|
|
9788
10270
|
"button",
|
|
9789
10271
|
{
|
|
9790
10272
|
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`,
|
|
@@ -9817,7 +10299,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9817
10299
|
},
|
|
9818
10300
|
/* @__PURE__ */ React__namespace.createElement(BiExit, { className: "w-6 h-auto mr-2 text-blue-400" }),
|
|
9819
10301
|
" Log Out"
|
|
9820
|
-
)), /* @__PURE__ */ React__namespace.createElement(react
|
|
10302
|
+
)), /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
|
|
9821
10303
|
WrappedSyncStatus,
|
|
9822
10304
|
{
|
|
9823
10305
|
cms,
|
|
@@ -10163,8 +10645,8 @@ var __publicField = (obj, key, value) => {
|
|
|
10163
10645
|
screen: activeScreen,
|
|
10164
10646
|
close: () => setActiveView(null)
|
|
10165
10647
|
}
|
|
10166
|
-
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react
|
|
10167
|
-
react
|
|
10648
|
+
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10649
|
+
react.TransitionChild,
|
|
10168
10650
|
{
|
|
10169
10651
|
enter: "transform transition-all ease-out duration-300",
|
|
10170
10652
|
enterFrom: "opacity-0 -translate-x-full",
|
|
@@ -10229,7 +10711,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10229
10711
|
))
|
|
10230
10712
|
))
|
|
10231
10713
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
10232
|
-
react
|
|
10714
|
+
react.TransitionChild,
|
|
10233
10715
|
{
|
|
10234
10716
|
enter: "ease-out duration-300",
|
|
10235
10717
|
enterFrom: "opacity-0",
|
|
@@ -12228,15 +12710,14 @@ var __publicField = (obj, key, value) => {
|
|
|
12228
12710
|
fields: fieldGroup.fields
|
|
12229
12711
|
}
|
|
12230
12712
|
) : /* @__PURE__ */ React__namespace.createElement(NoFieldsPlaceholder, null)
|
|
12231
|
-
)), !hideFooter && /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12713
|
+
)), !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(
|
|
12232
12714
|
ResetForm,
|
|
12233
12715
|
{
|
|
12234
12716
|
pristine,
|
|
12235
12717
|
reset: async () => {
|
|
12236
12718
|
finalForm2.reset();
|
|
12237
12719
|
await tinaForm.reset();
|
|
12238
|
-
}
|
|
12239
|
-
style: { flexGrow: 1 }
|
|
12720
|
+
}
|
|
12240
12721
|
},
|
|
12241
12722
|
tinaForm.buttons.reset
|
|
12242
12723
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -12245,8 +12726,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12245
12726
|
onClick: safeHandleSubmit,
|
|
12246
12727
|
disabled: !canSubmit,
|
|
12247
12728
|
busy: submitting,
|
|
12248
|
-
variant: "primary"
|
|
12249
|
-
style: { flexGrow: 3 }
|
|
12729
|
+
variant: "primary"
|
|
12250
12730
|
},
|
|
12251
12731
|
submitting && /* @__PURE__ */ React__namespace.createElement(LoadingDots, null),
|
|
12252
12732
|
!submitting && tinaForm.buttons.save
|
|
@@ -12764,15 +13244,15 @@ var __publicField = (obj, key, value) => {
|
|
|
12764
13244
|
);
|
|
12765
13245
|
};
|
|
12766
13246
|
const DotMenu = ({ onOpen, onRemove }) => {
|
|
12767
|
-
return /* @__PURE__ */ React.createElement(react
|
|
12768
|
-
react
|
|
13247
|
+
return /* @__PURE__ */ React.createElement(react.Popover, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React.createElement(
|
|
13248
|
+
react.PopoverButton,
|
|
12769
13249
|
{
|
|
12770
13250
|
as: "span",
|
|
12771
13251
|
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"
|
|
12772
13252
|
},
|
|
12773
13253
|
/* @__PURE__ */ React.createElement(EllipsisIcon, { title: "Open options" })
|
|
12774
13254
|
), /* @__PURE__ */ React.createElement(
|
|
12775
|
-
react
|
|
13255
|
+
react.Transition,
|
|
12776
13256
|
{
|
|
12777
13257
|
enter: "transition ease-out duration-100",
|
|
12778
13258
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -12781,7 +13261,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12781
13261
|
leaveFrom: "transform opacity-100 scale-100",
|
|
12782
13262
|
leaveTo: "transform opacity-0 scale-95"
|
|
12783
13263
|
},
|
|
12784
|
-
/* @__PURE__ */ React.createElement(react
|
|
13264
|
+
/* @__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(
|
|
12785
13265
|
"span",
|
|
12786
13266
|
{
|
|
12787
13267
|
onClick: onOpen,
|
|
@@ -13204,13 +13684,26 @@ var __publicField = (obj, key, value) => {
|
|
|
13204
13684
|
plate.createUnderlinePlugin(),
|
|
13205
13685
|
plate.createCodePlugin(),
|
|
13206
13686
|
plate.createListPlugin(),
|
|
13207
|
-
plate.createIndentPlugin(),
|
|
13208
13687
|
plate.createIndentListPlugin(),
|
|
13209
13688
|
plate.createHorizontalRulePlugin(),
|
|
13210
13689
|
// Allows us to do things like copy/paste, remembering the state of the element (like mdx)
|
|
13211
13690
|
plate.createNodeIdPlugin(),
|
|
13212
|
-
plateSlashCommand.createSlashPlugin()
|
|
13691
|
+
plateSlashCommand.createSlashPlugin(),
|
|
13692
|
+
plate.createTablePlugin()
|
|
13213
13693
|
];
|
|
13694
|
+
const unsupportedItemsInTable = /* @__PURE__ */ new Set([
|
|
13695
|
+
"Code Block",
|
|
13696
|
+
"Unordered List",
|
|
13697
|
+
"Ordered List",
|
|
13698
|
+
"Quote",
|
|
13699
|
+
"Mermaid",
|
|
13700
|
+
"Heading 1",
|
|
13701
|
+
"Heading 2",
|
|
13702
|
+
"Heading 3",
|
|
13703
|
+
"Heading 4",
|
|
13704
|
+
"Heading 5",
|
|
13705
|
+
"Heading 6"
|
|
13706
|
+
]);
|
|
13214
13707
|
const isNodeActive = (editor, type) => {
|
|
13215
13708
|
const pluginType = plateCommon.getPluginType(editor, type);
|
|
13216
13709
|
return !!(editor == null ? void 0 : editor.selection) && plateCommon.someNode(editor, { match: { type: pluginType } });
|
|
@@ -13395,24 +13888,6 @@ var __publicField = (obj, key, value) => {
|
|
|
13395
13888
|
}
|
|
13396
13889
|
);
|
|
13397
13890
|
Editor.displayName = "Editor";
|
|
13398
|
-
const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
|
|
13399
|
-
defaultVariants: {
|
|
13400
|
-
orientation: "horizontal"
|
|
13401
|
-
},
|
|
13402
|
-
variants: {
|
|
13403
|
-
orientation: {
|
|
13404
|
-
horizontal: "h-px w-full",
|
|
13405
|
-
vertical: "h-full w-px"
|
|
13406
|
-
}
|
|
13407
|
-
}
|
|
13408
|
-
});
|
|
13409
|
-
const Separator = cn$1.withVariants(
|
|
13410
|
-
cn$1.withProps(SeparatorPrimitive__namespace.Root, {
|
|
13411
|
-
decorative: true,
|
|
13412
|
-
orientation: "horizontal"
|
|
13413
|
-
}),
|
|
13414
|
-
separatorVariants
|
|
13415
|
-
);
|
|
13416
13891
|
const TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
13417
13892
|
const Tooltip = TooltipPrimitive__namespace.Root;
|
|
13418
13893
|
const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
@@ -13421,7 +13896,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13421
13896
|
cn$1.withProps(TooltipPrimitive__namespace.Content, {
|
|
13422
13897
|
sideOffset: 4
|
|
13423
13898
|
}),
|
|
13424
|
-
"z-
|
|
13899
|
+
"z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
|
|
13425
13900
|
);
|
|
13426
13901
|
function withTooltip(Component) {
|
|
13427
13902
|
return React.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
|
|
@@ -13547,140 +14022,41 @@ var __publicField = (obj, key, value) => {
|
|
|
13547
14022
|
Toolbar,
|
|
13548
14023
|
"p-1 sticky left-0 top-0 z-50 w-full justify-between overflow-x-auto border border-border bg-background"
|
|
13549
14024
|
);
|
|
13550
|
-
const
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13554
|
-
|
|
13555
|
-
const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
|
|
13556
|
-
const editor = plateCommon.useEditorState();
|
|
13557
|
-
const state = plate.useListToolbarButtonState({ nodeType });
|
|
13558
|
-
const { props } = plate.useListToolbarButton(state);
|
|
13559
|
-
return /* @__PURE__ */ React.createElement(
|
|
13560
|
-
ToolbarButton,
|
|
13561
|
-
{
|
|
13562
|
-
ref,
|
|
13563
|
-
tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
13564
|
-
...props,
|
|
13565
|
-
onClick: (e) => {
|
|
13566
|
-
e.preventDefault();
|
|
13567
|
-
e.stopPropagation();
|
|
13568
|
-
plate.toggleList(editor, { type: nodeType });
|
|
13569
|
-
}
|
|
13570
|
-
},
|
|
13571
|
-
nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
|
|
13572
|
-
);
|
|
13573
|
-
});
|
|
13574
|
-
const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
13575
|
-
const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
13576
|
-
const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
13577
|
-
cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
13578
|
-
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
13579
|
-
{
|
|
13580
|
-
className: cn$1.cn(
|
|
13581
|
-
"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",
|
|
13582
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
13583
|
-
inset && "pl-8",
|
|
13584
|
-
className
|
|
13585
|
-
),
|
|
13586
|
-
ref,
|
|
13587
|
-
...props
|
|
13588
|
-
},
|
|
13589
|
-
children,
|
|
13590
|
-
/* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
|
|
13591
|
-
));
|
|
13592
|
-
cn$1.withCn(
|
|
13593
|
-
DropdownMenuPrimitive__namespace.SubContent,
|
|
13594
|
-
"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"
|
|
13595
|
-
);
|
|
13596
|
-
const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
|
|
13597
|
-
className: cn$1.cn(
|
|
13598
|
-
"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"
|
|
13599
|
-
),
|
|
13600
|
-
sideOffset: 4
|
|
13601
|
-
});
|
|
13602
|
-
const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
|
|
13603
|
-
const menuItemVariants = classVarianceAuthority.cva(
|
|
13604
|
-
cn$1.cn(
|
|
13605
|
-
"relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
13606
|
-
"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
13607
|
-
),
|
|
13608
|
-
{
|
|
13609
|
-
variants: {
|
|
13610
|
-
inset: {
|
|
13611
|
-
true: "pl-8"
|
|
14025
|
+
const useResize = (ref, callback) => {
|
|
14026
|
+
React.useEffect(() => {
|
|
14027
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
14028
|
+
for (const entry of entries) {
|
|
14029
|
+
callback(entry);
|
|
13612
14030
|
}
|
|
14031
|
+
});
|
|
14032
|
+
if (ref.current) {
|
|
14033
|
+
resizeObserver.observe(ref.current);
|
|
13613
14034
|
}
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
ref,
|
|
13630
|
-
...props
|
|
13631
|
-
},
|
|
13632
|
-
/* @__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" }))),
|
|
13633
|
-
children
|
|
13634
|
-
));
|
|
13635
|
-
const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
13636
|
-
DropdownMenuPrimitive__namespace.RadioItem,
|
|
13637
|
-
{
|
|
13638
|
-
className: cn$1.cn(
|
|
13639
|
-
"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",
|
|
13640
|
-
"h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
|
|
13641
|
-
className
|
|
13642
|
-
),
|
|
13643
|
-
ref,
|
|
13644
|
-
...props
|
|
13645
|
-
},
|
|
13646
|
-
!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" }))),
|
|
14035
|
+
return () => resizeObserver.disconnect();
|
|
14036
|
+
}, [ref.current]);
|
|
14037
|
+
};
|
|
14038
|
+
const STANDARD_ICON_WIDTH = 32;
|
|
14039
|
+
const HEADING_ICON_WITH_TEXT = 127;
|
|
14040
|
+
const HEADING_ICON_ONLY = 58;
|
|
14041
|
+
const EMBED_ICON_WIDTH = 78;
|
|
14042
|
+
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14043
|
+
const FLOAT_BUTTON_WIDTH = 25;
|
|
14044
|
+
const HEADING_LABEL = "Headings";
|
|
14045
|
+
const ToolbarContext = React.createContext(void 0);
|
|
14046
|
+
const ToolbarProvider = ({
|
|
14047
|
+
tinaForm,
|
|
14048
|
+
templates,
|
|
14049
|
+
overrides,
|
|
13647
14050
|
children
|
|
13648
|
-
)
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
}
|
|
13656
|
-
}
|
|
14051
|
+
}) => {
|
|
14052
|
+
return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
|
|
14053
|
+
};
|
|
14054
|
+
const useToolbarContext = () => {
|
|
14055
|
+
const context = React.useContext(ToolbarContext);
|
|
14056
|
+
if (!context) {
|
|
14057
|
+
throw new Error("useToolbarContext must be used within a ToolbarProvider");
|
|
13657
14058
|
}
|
|
13658
|
-
|
|
13659
|
-
const DropdownMenuLabel = cn$1.withVariants(
|
|
13660
|
-
DropdownMenuPrimitive__namespace.Label,
|
|
13661
|
-
dropdownMenuLabelVariants,
|
|
13662
|
-
["inset"]
|
|
13663
|
-
);
|
|
13664
|
-
const DropdownMenuSeparator = cn$1.withCn(
|
|
13665
|
-
DropdownMenuPrimitive__namespace.Separator,
|
|
13666
|
-
"-mx-1 my-1 h-px bg-muted"
|
|
13667
|
-
);
|
|
13668
|
-
cn$1.withCn(
|
|
13669
|
-
cn$1.createPrimitiveElement("span"),
|
|
13670
|
-
"ml-auto text-xs tracking-widest opacity-60"
|
|
13671
|
-
);
|
|
13672
|
-
const useOpenState = () => {
|
|
13673
|
-
const [open2, setOpen] = React.useState(false);
|
|
13674
|
-
const onOpenChange = React.useCallback(
|
|
13675
|
-
(_value = !open2) => {
|
|
13676
|
-
setOpen(_value);
|
|
13677
|
-
},
|
|
13678
|
-
[open2]
|
|
13679
|
-
);
|
|
13680
|
-
return {
|
|
13681
|
-
onOpenChange,
|
|
13682
|
-
open: open2
|
|
13683
|
-
};
|
|
14059
|
+
return context;
|
|
13684
14060
|
};
|
|
13685
14061
|
const items$1 = [
|
|
13686
14062
|
{
|
|
@@ -13746,7 +14122,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13746
14122
|
return allNodesMatchInitialNodeType ? initialNodeType : plateParagraph.ELEMENT_PARAGRAPH;
|
|
13747
14123
|
}, []);
|
|
13748
14124
|
const editor = plateCommon.useEditorRef();
|
|
14125
|
+
const editorState = plateCommon.useEditorState();
|
|
13749
14126
|
const openState = useOpenState();
|
|
14127
|
+
const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
|
|
13750
14128
|
const selectedItem = items$1.find((item) => item.value === value) ?? defaultItem$1;
|
|
13751
14129
|
const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
|
|
13752
14130
|
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
@@ -13758,7 +14136,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13758
14136
|
tooltip: "Headings"
|
|
13759
14137
|
},
|
|
13760
14138
|
/* @__PURE__ */ React.createElement(SelectedItemIcon, { className: "size-5" }),
|
|
13761
|
-
/* @__PURE__ */ React.createElement("span", { className: "
|
|
14139
|
+
/* @__PURE__ */ React.createElement("span", { className: "@md/toolbar:flex hidden" }, selectedItemLabel)
|
|
13762
14140
|
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0" }, /* @__PURE__ */ React.createElement(
|
|
13763
14141
|
DropdownMenuRadioGroup,
|
|
13764
14142
|
{
|
|
@@ -13770,7 +14148,12 @@ var __publicField = (obj, key, value) => {
|
|
|
13770
14148
|
},
|
|
13771
14149
|
value
|
|
13772
14150
|
},
|
|
13773
|
-
items$1.
|
|
14151
|
+
items$1.filter((item) => {
|
|
14152
|
+
if (userInTable) {
|
|
14153
|
+
return !unsupportedItemsInTable.has(item.label);
|
|
14154
|
+
}
|
|
14155
|
+
return true;
|
|
14156
|
+
}).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
|
|
13774
14157
|
DropdownMenuRadioItem,
|
|
13775
14158
|
{
|
|
13776
14159
|
className: "min-w-[180px]",
|
|
@@ -13782,42 +14165,6 @@ var __publicField = (obj, key, value) => {
|
|
|
13782
14165
|
))
|
|
13783
14166
|
)));
|
|
13784
14167
|
}
|
|
13785
|
-
const LinkToolbarButton = cn$1.withRef((rest, ref) => {
|
|
13786
|
-
const state = plateLink.useLinkToolbarButtonState();
|
|
13787
|
-
const { props } = plateLink.useLinkToolbarButton(state);
|
|
13788
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
|
|
13789
|
-
});
|
|
13790
|
-
const useBlockQuoteToolbarButtonState = () => {
|
|
13791
|
-
const editor = plateCommon.useEditorState();
|
|
13792
|
-
const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
|
|
13793
|
-
return {
|
|
13794
|
-
pressed: isBlockActive()
|
|
13795
|
-
};
|
|
13796
|
-
};
|
|
13797
|
-
const useBlockQuoteToolbarButton = (state) => {
|
|
13798
|
-
const editor = plateCommon.useEditorState();
|
|
13799
|
-
const onClick = () => {
|
|
13800
|
-
plateCommon.toggleNodeType(editor, {
|
|
13801
|
-
activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
|
|
13802
|
-
});
|
|
13803
|
-
};
|
|
13804
|
-
const onMouseDown = (e) => {
|
|
13805
|
-
e.preventDefault();
|
|
13806
|
-
e.stopPropagation();
|
|
13807
|
-
};
|
|
13808
|
-
return {
|
|
13809
|
-
props: {
|
|
13810
|
-
onClick,
|
|
13811
|
-
onMouseDown,
|
|
13812
|
-
pressed: state.pressed
|
|
13813
|
-
}
|
|
13814
|
-
};
|
|
13815
|
-
};
|
|
13816
|
-
const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
13817
|
-
const state = useBlockQuoteToolbarButtonState();
|
|
13818
|
-
const { props } = useBlockQuoteToolbarButton(state);
|
|
13819
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
|
|
13820
|
-
});
|
|
13821
14168
|
const useCodeBlockToolbarButtonState = () => {
|
|
13822
14169
|
const editor = plateCommon.useEditorState();
|
|
13823
14170
|
const isBlockActive = () => helpers.isNodeActive(editor, plateCodeBlock.ELEMENT_CODE_BLOCK);
|
|
@@ -13879,6 +14226,116 @@ var __publicField = (obj, key, value) => {
|
|
|
13879
14226
|
const { props } = useImageToolbarButton(state);
|
|
13880
14227
|
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
|
|
13881
14228
|
});
|
|
14229
|
+
const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
|
|
14230
|
+
const editor = plateCommon.useEditorState();
|
|
14231
|
+
const state = plate.useListToolbarButtonState({ nodeType });
|
|
14232
|
+
const { props } = plate.useListToolbarButton(state);
|
|
14233
|
+
return /* @__PURE__ */ React.createElement(
|
|
14234
|
+
ToolbarButton,
|
|
14235
|
+
{
|
|
14236
|
+
ref,
|
|
14237
|
+
tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
14238
|
+
...props,
|
|
14239
|
+
onClick: (e) => {
|
|
14240
|
+
e.preventDefault();
|
|
14241
|
+
e.stopPropagation();
|
|
14242
|
+
plate.toggleList(editor, { type: nodeType });
|
|
14243
|
+
}
|
|
14244
|
+
},
|
|
14245
|
+
nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
|
|
14246
|
+
);
|
|
14247
|
+
});
|
|
14248
|
+
const LinkToolbarButton = cn$1.withRef((rest, ref) => {
|
|
14249
|
+
const state = plateLink.useLinkToolbarButtonState();
|
|
14250
|
+
const { props } = plateLink.useLinkToolbarButton(state);
|
|
14251
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
|
|
14252
|
+
});
|
|
14253
|
+
const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14254
|
+
const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
|
|
14255
|
+
const { props } = plateCommon.useMarkToolbarButton(state);
|
|
14256
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
14257
|
+
});
|
|
14258
|
+
const useMermaidToolbarButtonState = () => {
|
|
14259
|
+
const editor = plateCommon.useEditorState();
|
|
14260
|
+
const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_MERMAID);
|
|
14261
|
+
return {
|
|
14262
|
+
pressed: isBlockActive()
|
|
14263
|
+
};
|
|
14264
|
+
};
|
|
14265
|
+
const useMermaidToolbarButton = (state) => {
|
|
14266
|
+
const editor = plateCommon.useEditorState();
|
|
14267
|
+
const onClick = () => {
|
|
14268
|
+
plateCommon.insertEmptyElement(editor, ELEMENT_MERMAID, {
|
|
14269
|
+
nextBlock: true,
|
|
14270
|
+
select: true
|
|
14271
|
+
});
|
|
14272
|
+
};
|
|
14273
|
+
const onMouseDown = (e) => {
|
|
14274
|
+
e.preventDefault();
|
|
14275
|
+
e.stopPropagation();
|
|
14276
|
+
};
|
|
14277
|
+
return {
|
|
14278
|
+
props: {
|
|
14279
|
+
onClick,
|
|
14280
|
+
onMouseDown,
|
|
14281
|
+
pressed: state.pressed
|
|
14282
|
+
}
|
|
14283
|
+
};
|
|
14284
|
+
};
|
|
14285
|
+
const MermaidToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14286
|
+
const state = useMermaidToolbarButtonState();
|
|
14287
|
+
const { props } = useMermaidToolbarButton(state);
|
|
14288
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Mermaid", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.mermaid, null));
|
|
14289
|
+
});
|
|
14290
|
+
function OverflowMenu({
|
|
14291
|
+
children,
|
|
14292
|
+
...props
|
|
14293
|
+
}) {
|
|
14294
|
+
const openState = useOpenState();
|
|
14295
|
+
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
14296
|
+
ToolbarButton,
|
|
14297
|
+
{
|
|
14298
|
+
showArrow: false,
|
|
14299
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14300
|
+
className: "lg:min-w-[130px]",
|
|
14301
|
+
isDropdown: true,
|
|
14302
|
+
pressed: openState.open,
|
|
14303
|
+
tooltip: "Headings"
|
|
14304
|
+
},
|
|
14305
|
+
/* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
|
|
14306
|
+
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
|
|
14307
|
+
}
|
|
14308
|
+
const useBlockQuoteToolbarButtonState = () => {
|
|
14309
|
+
const editor = plateCommon.useEditorState();
|
|
14310
|
+
const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
|
|
14311
|
+
return {
|
|
14312
|
+
pressed: isBlockActive()
|
|
14313
|
+
};
|
|
14314
|
+
};
|
|
14315
|
+
const useBlockQuoteToolbarButton = (state) => {
|
|
14316
|
+
const editor = plateCommon.useEditorState();
|
|
14317
|
+
const onClick = () => {
|
|
14318
|
+
plateCommon.toggleNodeType(editor, {
|
|
14319
|
+
activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
|
|
14320
|
+
});
|
|
14321
|
+
};
|
|
14322
|
+
const onMouseDown = (e) => {
|
|
14323
|
+
e.preventDefault();
|
|
14324
|
+
e.stopPropagation();
|
|
14325
|
+
};
|
|
14326
|
+
return {
|
|
14327
|
+
props: {
|
|
14328
|
+
onClick,
|
|
14329
|
+
onMouseDown,
|
|
14330
|
+
pressed: state.pressed
|
|
14331
|
+
}
|
|
14332
|
+
};
|
|
14333
|
+
};
|
|
14334
|
+
const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14335
|
+
const state = useBlockQuoteToolbarButtonState();
|
|
14336
|
+
const { props } = useBlockQuoteToolbarButton(state);
|
|
14337
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
|
|
14338
|
+
});
|
|
13882
14339
|
const useRawMarkdownToolbarButton = () => {
|
|
13883
14340
|
const { setRawMode } = useEditorContext();
|
|
13884
14341
|
const onMouseDown = (e) => {
|
|
@@ -13893,31 +14350,123 @@ var __publicField = (obj, key, value) => {
|
|
|
13893
14350
|
};
|
|
13894
14351
|
const RawMarkdownToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
13895
14352
|
const { props } = useRawMarkdownToolbarButton();
|
|
13896
|
-
return /* @__PURE__ */ React.createElement(
|
|
14353
|
+
return /* @__PURE__ */ React.createElement(
|
|
14354
|
+
ToolbarButton,
|
|
14355
|
+
{
|
|
14356
|
+
ref,
|
|
14357
|
+
tooltip: "Link",
|
|
14358
|
+
...rest,
|
|
14359
|
+
...props,
|
|
14360
|
+
"data-testid": "markdown-button"
|
|
14361
|
+
},
|
|
14362
|
+
/* @__PURE__ */ React.createElement(Icons.raw, null)
|
|
14363
|
+
);
|
|
13897
14364
|
});
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
14365
|
+
function TableDropdownMenu(props) {
|
|
14366
|
+
const tableSelected = plateCommon.useEditorSelector(
|
|
14367
|
+
(editor2) => plateCommon.someNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } }),
|
|
14368
|
+
[]
|
|
14369
|
+
);
|
|
14370
|
+
const [enableDeleteColumn, enableDeleteRow] = plateCommon.useEditorSelector((editor2) => {
|
|
14371
|
+
const tableNodeEntry = plateCommon.findNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } });
|
|
14372
|
+
if (!tableNodeEntry)
|
|
14373
|
+
return [false, false];
|
|
14374
|
+
const [tableNode] = tableNodeEntry;
|
|
14375
|
+
if (!plateCommon.isElement(tableNode))
|
|
14376
|
+
return [false, false];
|
|
14377
|
+
const columnCount = plateTable.getTableColumnCount(tableNode);
|
|
14378
|
+
const rowCount = tableNode.children.length;
|
|
14379
|
+
return [columnCount > 1, rowCount > 1];
|
|
14380
|
+
}, []);
|
|
14381
|
+
const editor = plateCommon.useEditorRef();
|
|
14382
|
+
const openState = useOpenState();
|
|
14383
|
+
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(ToolbarButton, { isDropdown: true, pressed: openState.open, tooltip: "Table" }, /* @__PURE__ */ React.createElement(Icons.table, null))), /* @__PURE__ */ React.createElement(
|
|
14384
|
+
DropdownMenuContent,
|
|
14385
|
+
{
|
|
14386
|
+
align: "start",
|
|
14387
|
+
className: "flex w-[180px] min-w-0 flex-col gap-0.5"
|
|
14388
|
+
},
|
|
14389
|
+
/* @__PURE__ */ React.createElement(
|
|
14390
|
+
DropdownMenuItem,
|
|
14391
|
+
{
|
|
14392
|
+
className: "min-w-[180px]",
|
|
14393
|
+
disabled: tableSelected,
|
|
14394
|
+
onSelect: () => {
|
|
14395
|
+
plateTable.insertTable(editor);
|
|
14396
|
+
plateCommon.focusEditor(editor);
|
|
14397
|
+
}
|
|
14398
|
+
},
|
|
14399
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14400
|
+
"Insert table"
|
|
14401
|
+
),
|
|
14402
|
+
/* @__PURE__ */ React.createElement(
|
|
14403
|
+
DropdownMenuItem,
|
|
14404
|
+
{
|
|
14405
|
+
className: "min-w-[180px]",
|
|
14406
|
+
disabled: !tableSelected,
|
|
14407
|
+
onSelect: () => {
|
|
14408
|
+
plateTable.deleteTable(editor);
|
|
14409
|
+
plateCommon.focusEditor(editor);
|
|
14410
|
+
}
|
|
14411
|
+
},
|
|
14412
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14413
|
+
"Delete table"
|
|
14414
|
+
),
|
|
14415
|
+
/* @__PURE__ */ React.createElement(DropdownMenuSub, null, /* @__PURE__ */ React.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React.createElement(Icons.column, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React.createElement("span", null, "Column")), /* @__PURE__ */ React.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React.createElement(
|
|
14416
|
+
DropdownMenuItem,
|
|
14417
|
+
{
|
|
14418
|
+
className: "min-w-[180px]",
|
|
14419
|
+
disabled: !tableSelected,
|
|
14420
|
+
onSelect: () => {
|
|
14421
|
+
plateTable.insertTableColumn(editor);
|
|
14422
|
+
plateCommon.focusEditor(editor);
|
|
14423
|
+
}
|
|
14424
|
+
},
|
|
14425
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14426
|
+
"Insert column after"
|
|
14427
|
+
), /* @__PURE__ */ React.createElement(
|
|
14428
|
+
DropdownMenuItem,
|
|
14429
|
+
{
|
|
14430
|
+
className: "min-w-[180px]",
|
|
14431
|
+
disabled: !enableDeleteColumn,
|
|
14432
|
+
onSelect: () => {
|
|
14433
|
+
plateTable.deleteColumn(editor);
|
|
14434
|
+
plateCommon.focusEditor(editor);
|
|
14435
|
+
}
|
|
14436
|
+
},
|
|
14437
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14438
|
+
"Delete column"
|
|
14439
|
+
))),
|
|
14440
|
+
/* @__PURE__ */ React.createElement(DropdownMenuSub, null, /* @__PURE__ */ React.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React.createElement(Icons.row, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React.createElement("span", null, "Row")), /* @__PURE__ */ React.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React.createElement(
|
|
14441
|
+
DropdownMenuItem,
|
|
14442
|
+
{
|
|
14443
|
+
className: "min-w-[180px]",
|
|
14444
|
+
disabled: !tableSelected,
|
|
14445
|
+
onSelect: () => {
|
|
14446
|
+
plateTable.insertTableRow(editor);
|
|
14447
|
+
plateCommon.focusEditor(editor);
|
|
14448
|
+
}
|
|
14449
|
+
},
|
|
14450
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14451
|
+
"Insert row after"
|
|
14452
|
+
), /* @__PURE__ */ React.createElement(
|
|
14453
|
+
DropdownMenuItem,
|
|
14454
|
+
{
|
|
14455
|
+
className: "min-w-[180px]",
|
|
14456
|
+
disabled: !enableDeleteRow,
|
|
14457
|
+
onSelect: () => {
|
|
14458
|
+
plateTable.deleteRow(editor);
|
|
14459
|
+
plateCommon.focusEditor(editor);
|
|
14460
|
+
}
|
|
14461
|
+
},
|
|
14462
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14463
|
+
"Delete row"
|
|
14464
|
+
)))
|
|
14465
|
+
));
|
|
14466
|
+
}
|
|
13914
14467
|
function TemplatesToolbarButton() {
|
|
13915
14468
|
const { templates } = useToolbarContext();
|
|
13916
|
-
const showEmbed = templates.length > 0;
|
|
13917
14469
|
const editor = plateCommon.useEditorState();
|
|
13918
|
-
if (!showEmbed) {
|
|
13919
|
-
return null;
|
|
13920
|
-
}
|
|
13921
14470
|
return /* @__PURE__ */ React.createElement(EmbedButton, { templates, editor });
|
|
13922
14471
|
}
|
|
13923
14472
|
const EmbedButton = ({ editor, templates }) => {
|
|
@@ -13958,99 +14507,118 @@ var __publicField = (obj, key, value) => {
|
|
|
13958
14507
|
template.label || template.name
|
|
13959
14508
|
))));
|
|
13960
14509
|
};
|
|
13961
|
-
const ICON_WIDTH = 32;
|
|
13962
|
-
const EMBED_ICON_WIDTH = 78;
|
|
13963
|
-
const useResize = (ref, callback) => {
|
|
13964
|
-
React.useEffect(() => {
|
|
13965
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
13966
|
-
for (const entry of entries) {
|
|
13967
|
-
callback(entry);
|
|
13968
|
-
}
|
|
13969
|
-
});
|
|
13970
|
-
if (ref.current) {
|
|
13971
|
-
resizeObserver.observe(ref.current);
|
|
13972
|
-
}
|
|
13973
|
-
return () => resizeObserver.disconnect();
|
|
13974
|
-
}, [ref.current]);
|
|
13975
|
-
};
|
|
13976
|
-
function OverflowMenu({
|
|
13977
|
-
children,
|
|
13978
|
-
...props
|
|
13979
|
-
}) {
|
|
13980
|
-
const openState = useOpenState();
|
|
13981
|
-
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
13982
|
-
ToolbarButton,
|
|
13983
|
-
{
|
|
13984
|
-
showArrow: false,
|
|
13985
|
-
className: "lg:min-w-[130px]",
|
|
13986
|
-
isDropdown: true,
|
|
13987
|
-
pressed: openState.open,
|
|
13988
|
-
tooltip: "Headings"
|
|
13989
|
-
},
|
|
13990
|
-
/* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
|
|
13991
|
-
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
|
|
13992
|
-
}
|
|
13993
14510
|
const toolbarItems = {
|
|
13994
14511
|
heading: {
|
|
13995
|
-
label:
|
|
14512
|
+
label: HEADING_LABEL,
|
|
14513
|
+
width: (paragraphIconExists) => paragraphIconExists ? HEADING_ICON_WITH_TEXT : HEADING_ICON_ONLY,
|
|
14514
|
+
// Dynamically handle width based on paragraph icon
|
|
13996
14515
|
Component: /* @__PURE__ */ React.createElement(ToolbarGroup, { noSeparator: true }, /* @__PURE__ */ React.createElement(HeadingsMenu, null))
|
|
13997
14516
|
},
|
|
13998
14517
|
link: {
|
|
13999
14518
|
label: "Link",
|
|
14519
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14000
14520
|
Component: /* @__PURE__ */ React.createElement(LinkToolbarButton, null)
|
|
14001
14521
|
},
|
|
14002
14522
|
image: {
|
|
14003
14523
|
label: "Image",
|
|
14524
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14004
14525
|
Component: /* @__PURE__ */ React.createElement(ImageToolbarButton, null)
|
|
14005
14526
|
},
|
|
14006
14527
|
quote: {
|
|
14007
14528
|
label: "Quote",
|
|
14529
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14008
14530
|
Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
|
|
14009
14531
|
},
|
|
14010
14532
|
ul: {
|
|
14011
14533
|
label: "Unordered List",
|
|
14534
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14012
14535
|
Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_UL })
|
|
14013
14536
|
},
|
|
14014
14537
|
ol: {
|
|
14015
14538
|
label: "Ordered List",
|
|
14539
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14016
14540
|
Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_OL })
|
|
14017
14541
|
},
|
|
14018
14542
|
bold: {
|
|
14019
14543
|
label: "Bold",
|
|
14544
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14020
14545
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null))
|
|
14021
14546
|
},
|
|
14022
14547
|
italic: {
|
|
14023
14548
|
label: "Italic",
|
|
14549
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14024
14550
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null))
|
|
14025
14551
|
},
|
|
14026
14552
|
code: {
|
|
14027
14553
|
label: "Code",
|
|
14554
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14028
14555
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null))
|
|
14029
14556
|
},
|
|
14030
14557
|
codeBlock: {
|
|
14031
14558
|
label: "Code Block",
|
|
14559
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14032
14560
|
Component: /* @__PURE__ */ React.createElement(CodeBlockToolbarButton, null)
|
|
14033
14561
|
},
|
|
14562
|
+
mermaid: {
|
|
14563
|
+
label: "Mermaid",
|
|
14564
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14565
|
+
Component: /* @__PURE__ */ React.createElement(MermaidToolbarButton, null)
|
|
14566
|
+
},
|
|
14567
|
+
table: {
|
|
14568
|
+
label: "Table",
|
|
14569
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14570
|
+
Component: /* @__PURE__ */ React.createElement(TableDropdownMenu, null)
|
|
14571
|
+
},
|
|
14034
14572
|
raw: {
|
|
14035
14573
|
label: "Raw Markdown",
|
|
14574
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14036
14575
|
Component: /* @__PURE__ */ React.createElement(RawMarkdownToolbarButton, null)
|
|
14037
14576
|
},
|
|
14038
14577
|
embed: {
|
|
14039
14578
|
label: "Templates",
|
|
14579
|
+
width: () => EMBED_ICON_WIDTH,
|
|
14040
14580
|
Component: /* @__PURE__ */ React.createElement(TemplatesToolbarButton, null)
|
|
14041
14581
|
}
|
|
14042
14582
|
};
|
|
14043
14583
|
function FixedToolbarButtons() {
|
|
14044
14584
|
const toolbarRef = React.useRef(null);
|
|
14045
14585
|
const [itemsShown, setItemsShown] = React.useState(11);
|
|
14046
|
-
const { overrides } = useToolbarContext();
|
|
14586
|
+
const { overrides, templates } = useToolbarContext();
|
|
14587
|
+
const showEmbedButton = templates.length > 0;
|
|
14588
|
+
let items2 = [];
|
|
14589
|
+
if (Array.isArray(overrides)) {
|
|
14590
|
+
items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14591
|
+
} else {
|
|
14592
|
+
items2 = (overrides == null ? void 0 : overrides.toolbar) === void 0 ? Object.values(toolbarItems) : overrides.toolbar.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14593
|
+
}
|
|
14594
|
+
if (!showEmbedButton) {
|
|
14595
|
+
items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
|
|
14596
|
+
}
|
|
14597
|
+
const editorState = plateCommon.useEditorState();
|
|
14598
|
+
const userInTable = helpers.isNodeActive(editorState, plate.ELEMENT_TABLE);
|
|
14599
|
+
if (userInTable) {
|
|
14600
|
+
items2 = items2.filter((item) => !unsupportedItemsInTable.has(item.label));
|
|
14601
|
+
}
|
|
14047
14602
|
useResize(toolbarRef, (entry) => {
|
|
14048
14603
|
const width = entry.target.getBoundingClientRect().width;
|
|
14049
|
-
const
|
|
14050
|
-
|
|
14604
|
+
const headingButton = items2.find((item) => item.label === HEADING_LABEL);
|
|
14605
|
+
const headingWidth = headingButton ? headingButton.width(width > CONTAINER_MD_BREAKPOINT) : 0;
|
|
14606
|
+
const availableWidth = width - headingWidth - FLOAT_BUTTON_WIDTH;
|
|
14607
|
+
const { itemFitCount } = items2.reduce(
|
|
14608
|
+
(acc, item) => {
|
|
14609
|
+
if (item.label !== HEADING_LABEL && acc.totalItemsWidth + item.width() <= availableWidth) {
|
|
14610
|
+
return {
|
|
14611
|
+
totalItemsWidth: acc.totalItemsWidth + item.width(),
|
|
14612
|
+
itemFitCount: acc.itemFitCount + 1
|
|
14613
|
+
};
|
|
14614
|
+
}
|
|
14615
|
+
return acc;
|
|
14616
|
+
},
|
|
14617
|
+
{ totalItemsWidth: 0, itemFitCount: 1 }
|
|
14618
|
+
);
|
|
14619
|
+
setItemsShown(itemFitCount);
|
|
14051
14620
|
});
|
|
14052
|
-
|
|
14053
|
-
return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
|
|
14621
|
+
return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden @container/toolbar", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
|
|
14054
14622
|
"div",
|
|
14055
14623
|
{
|
|
14056
14624
|
className: "flex",
|
|
@@ -14058,7 +14626,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14058
14626
|
transform: "translateX(calc(-1px))"
|
|
14059
14627
|
}
|
|
14060
14628
|
},
|
|
14061
|
-
/* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
14629
|
+
/* @__PURE__ */ React.createElement(React.Fragment, null, items2.slice(0, itemsShown).map((item) => /* @__PURE__ */ React.createElement(React.Fragment, { key: item.label }, item.Component)), items2.length > itemsShown && /* @__PURE__ */ React.createElement(OverflowMenu, null, items2.slice(itemsShown).flatMap((c) => /* @__PURE__ */ React.createElement(React.Fragment, { key: c.label }, c.Component))))
|
|
14062
14630
|
));
|
|
14063
14631
|
}
|
|
14064
14632
|
const FloatingToolbar = cn$1.withRef(({ children, state, ...props }, componentRef) => {
|
|
@@ -14173,6 +14741,10 @@ var __publicField = (obj, key, value) => {
|
|
|
14173
14741
|
const openState = useOpenState();
|
|
14174
14742
|
const selectedItem = items.find((item) => item.value === value) ?? defaultItem;
|
|
14175
14743
|
const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
|
|
14744
|
+
const editorState = plateCommon.useEditorState();
|
|
14745
|
+
const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
|
|
14746
|
+
if (userInTable)
|
|
14747
|
+
return null;
|
|
14176
14748
|
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
14177
14749
|
ToolbarButton,
|
|
14178
14750
|
{
|
|
@@ -14214,49 +14786,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14214
14786
|
function FloatingToolbarButtons() {
|
|
14215
14787
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TurnIntoDropdownMenu, null));
|
|
14216
14788
|
}
|
|
14217
|
-
const buttonVariants = classVarianceAuthority.cva(
|
|
14218
|
-
"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",
|
|
14219
|
-
{
|
|
14220
|
-
defaultVariants: {
|
|
14221
|
-
size: "default",
|
|
14222
|
-
variant: "default"
|
|
14223
|
-
},
|
|
14224
|
-
variants: {
|
|
14225
|
-
isMenu: {
|
|
14226
|
-
true: "h-auto w-full cursor-pointer justify-start"
|
|
14227
|
-
},
|
|
14228
|
-
size: {
|
|
14229
|
-
default: "h-10 px-4 py-2",
|
|
14230
|
-
icon: "size-10",
|
|
14231
|
-
lg: "h-11 rounded-md px-8",
|
|
14232
|
-
none: "",
|
|
14233
|
-
sm: "h-9 rounded-md px-3",
|
|
14234
|
-
sms: "size-9 rounded-md px-0",
|
|
14235
|
-
xs: "h-8 rounded-md px-3"
|
|
14236
|
-
},
|
|
14237
|
-
variant: {
|
|
14238
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
14239
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
14240
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
14241
|
-
inlineLink: "text-base text-primary underline underline-offset-4",
|
|
14242
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
14243
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
14244
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
14245
|
-
}
|
|
14246
|
-
}
|
|
14247
|
-
}
|
|
14248
|
-
);
|
|
14249
|
-
cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
|
|
14250
|
-
const Comp = asChild ? reactSlot.Slot : "button";
|
|
14251
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
14252
|
-
Comp,
|
|
14253
|
-
{
|
|
14254
|
-
className: cn$1.cn(buttonVariants({ className, isMenu, size, variant })),
|
|
14255
|
-
ref,
|
|
14256
|
-
...props
|
|
14257
|
-
}
|
|
14258
|
-
);
|
|
14259
|
-
});
|
|
14260
14789
|
const inputVariants = classVarianceAuthority.cva(
|
|
14261
14790
|
"flex w-full rounded-md bg-transparent text-sm file:border-0 file:bg-background file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
14262
14791
|
{
|
|
@@ -14277,22 +14806,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14277
14806
|
}
|
|
14278
14807
|
);
|
|
14279
14808
|
cn$1.withVariants("input", inputVariants, ["variant", "h"]);
|
|
14280
|
-
const popoverVariants = classVarianceAuthority.cva(
|
|
14281
|
-
"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"
|
|
14282
|
-
);
|
|
14283
|
-
cn$1.withRef(
|
|
14284
|
-
({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
|
|
14285
|
-
PopoverPrimitive__namespace.Content,
|
|
14286
|
-
{
|
|
14287
|
-
align,
|
|
14288
|
-
className: cn$1.cn(popoverVariants(), className),
|
|
14289
|
-
ref,
|
|
14290
|
-
sideOffset,
|
|
14291
|
-
style: { zIndex: 1e3, ...style },
|
|
14292
|
-
...props
|
|
14293
|
-
}
|
|
14294
|
-
))
|
|
14295
|
-
);
|
|
14296
14809
|
const floatingOptions = {
|
|
14297
14810
|
middleware: [
|
|
14298
14811
|
plateFloating.offset(12),
|
|
@@ -14352,7 +14865,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14352
14865
|
const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex h-9 items-center gap-1" }, /* @__PURE__ */ React.createElement(
|
|
14353
14866
|
"button",
|
|
14354
14867
|
{
|
|
14355
|
-
className: buttonVariants({ size: "sm", variant: "ghost" }),
|
|
14868
|
+
className: buttonVariants$1({ size: "sm", variant: "ghost" }),
|
|
14356
14869
|
type: "button",
|
|
14357
14870
|
...editButtonProps
|
|
14358
14871
|
},
|
|
@@ -14360,7 +14873,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14360
14873
|
), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
|
|
14361
14874
|
plateLink.LinkOpenButton,
|
|
14362
14875
|
{
|
|
14363
|
-
className: buttonVariants({
|
|
14876
|
+
className: buttonVariants$1({
|
|
14364
14877
|
size: "sms",
|
|
14365
14878
|
variant: "ghost"
|
|
14366
14879
|
})
|
|
@@ -14369,7 +14882,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14369
14882
|
), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
|
|
14370
14883
|
"button",
|
|
14371
14884
|
{
|
|
14372
|
-
className: buttonVariants({
|
|
14885
|
+
className: buttonVariants$1({
|
|
14373
14886
|
size: "sms",
|
|
14374
14887
|
variant: "ghost"
|
|
14375
14888
|
}),
|
|
@@ -14405,6 +14918,9 @@ var __publicField = (obj, key, value) => {
|
|
|
14405
14918
|
if (typeof string !== "string") {
|
|
14406
14919
|
return false;
|
|
14407
14920
|
}
|
|
14921
|
+
if (string.startsWith("#")) {
|
|
14922
|
+
return true;
|
|
14923
|
+
}
|
|
14408
14924
|
const generalMatch = string.match(protocolAndDomainRE);
|
|
14409
14925
|
const emailLinkMatch = string.match(emailLintRE);
|
|
14410
14926
|
const localUrlMatch = string.match(localUrlRE);
|
|
@@ -14426,12 +14942,12 @@ var __publicField = (obj, key, value) => {
|
|
|
14426
14942
|
}
|
|
14427
14943
|
return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
|
|
14428
14944
|
};
|
|
14429
|
-
const RichEditor = (
|
|
14945
|
+
const RichEditor = ({ input, tinaForm, field }) => {
|
|
14430
14946
|
var _a;
|
|
14431
14947
|
const initialValue = React.useMemo(
|
|
14432
14948
|
() => {
|
|
14433
14949
|
var _a2, _b;
|
|
14434
|
-
return ((_b = (_a2 =
|
|
14950
|
+
return ((_b = (_a2 = input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
|
|
14435
14951
|
},
|
|
14436
14952
|
[]
|
|
14437
14953
|
);
|
|
@@ -14443,6 +14959,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14443
14959
|
createMdxBlockPlugin(),
|
|
14444
14960
|
createMdxInlinePlugin(),
|
|
14445
14961
|
createImgPlugin(),
|
|
14962
|
+
createMermaidPlugin(),
|
|
14446
14963
|
createInvalidMarkdownPlugin(),
|
|
14447
14964
|
plateLink.createLinkPlugin({
|
|
14448
14965
|
options: {
|
|
@@ -14458,7 +14975,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14458
14975
|
),
|
|
14459
14976
|
[]
|
|
14460
14977
|
);
|
|
14461
|
-
const tempId = [
|
|
14978
|
+
const tempId = [tinaForm.id, input.name].join(".");
|
|
14462
14979
|
const id = React.useMemo(() => uuid() + tempId, [tempId]);
|
|
14463
14980
|
const ref = React.useRef(null);
|
|
14464
14981
|
React.useEffect(() => {
|
|
@@ -14468,13 +14985,13 @@ var __publicField = (obj, key, value) => {
|
|
|
14468
14985
|
const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
|
|
14469
14986
|
'[role="textbox"]'
|
|
14470
14987
|
);
|
|
14471
|
-
if (
|
|
14988
|
+
if (field.experimental_focusIntent && plateElement) {
|
|
14472
14989
|
if (plateElement)
|
|
14473
14990
|
plateElement.focus();
|
|
14474
14991
|
}
|
|
14475
14992
|
}, 100);
|
|
14476
14993
|
}
|
|
14477
|
-
}, [
|
|
14994
|
+
}, [field.experimental_focusIntent, ref]);
|
|
14478
14995
|
return /* @__PURE__ */ React.createElement("div", { ref }, /* @__PURE__ */ React.createElement(
|
|
14479
14996
|
plateCommon.Plate,
|
|
14480
14997
|
{
|
|
@@ -14482,21 +14999,22 @@ var __publicField = (obj, key, value) => {
|
|
|
14482
14999
|
initialValue,
|
|
14483
15000
|
plugins: plugins$2,
|
|
14484
15001
|
onChange: (value) => {
|
|
14485
|
-
|
|
15002
|
+
input.onChange({
|
|
14486
15003
|
type: "root",
|
|
14487
|
-
children: value
|
|
15004
|
+
children: value,
|
|
15005
|
+
embedCode: input.value.embedCode
|
|
14488
15006
|
});
|
|
14489
15007
|
}
|
|
14490
15008
|
},
|
|
14491
15009
|
/* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(
|
|
14492
15010
|
ToolbarProvider,
|
|
14493
15011
|
{
|
|
14494
|
-
tinaForm
|
|
14495
|
-
templates:
|
|
14496
|
-
overrides: (
|
|
15012
|
+
tinaForm,
|
|
15013
|
+
templates: field.templates,
|
|
15014
|
+
overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
|
|
14497
15015
|
},
|
|
14498
15016
|
/* @__PURE__ */ React.createElement(FixedToolbar, null, /* @__PURE__ */ React.createElement(FixedToolbarButtons, null)),
|
|
14499
|
-
/* @__PURE__ */ React.createElement(FloatingToolbar, null, /* @__PURE__ */ React.createElement(FloatingToolbarButtons, null))
|
|
15017
|
+
((_a = field == null ? void 0 : field.overrides) == null ? void 0 : _a.showFloatingToolbar) !== false ? /* @__PURE__ */ React.createElement(FloatingToolbar, null, /* @__PURE__ */ React.createElement(FloatingToolbarButtons, null)) : null
|
|
14500
15018
|
), /* @__PURE__ */ React.createElement(Editor, null))
|
|
14501
15019
|
));
|
|
14502
15020
|
};
|
|
@@ -29450,6 +29968,7 @@ mutation addPendingDocumentMutation(
|
|
|
29450
29968
|
relativePath
|
|
29451
29969
|
filename
|
|
29452
29970
|
extension
|
|
29971
|
+
hasReferences
|
|
29453
29972
|
}
|
|
29454
29973
|
}
|
|
29455
29974
|
}
|
|
@@ -29541,6 +30060,9 @@ mutation addPendingDocumentMutation(
|
|
|
29541
30060
|
document(collection:$collection, relativePath:$relativePath) {
|
|
29542
30061
|
... on Document {
|
|
29543
30062
|
_values
|
|
30063
|
+
_sys {
|
|
30064
|
+
hasReferences
|
|
30065
|
+
}
|
|
29544
30066
|
}
|
|
29545
30067
|
}
|
|
29546
30068
|
}`;
|
|
@@ -30565,8 +31087,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
30565
31087
|
}
|
|
30566
31088
|
)
|
|
30567
31089
|
}
|
|
30568
|
-
), !renderDesktopNav && /* @__PURE__ */ React.createElement(react
|
|
30569
|
-
react
|
|
31090
|
+
), !renderDesktopNav && /* @__PURE__ */ React.createElement(react.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
|
|
31091
|
+
react.TransitionChild,
|
|
30570
31092
|
{
|
|
30571
31093
|
enter: "transform transition-all ease-out duration-300",
|
|
30572
31094
|
enterFrom: "opacity-0 -translate-x-full",
|
|
@@ -30635,7 +31157,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
30635
31157
|
))
|
|
30636
31158
|
))
|
|
30637
31159
|
), /* @__PURE__ */ React.createElement(
|
|
30638
|
-
react
|
|
31160
|
+
react.TransitionChild,
|
|
30639
31161
|
{
|
|
30640
31162
|
enter: "ease-out duration-300",
|
|
30641
31163
|
enterFrom: "opacity-0",
|
|
@@ -31089,8 +31611,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31089
31611
|
folder,
|
|
31090
31612
|
collectionName
|
|
31091
31613
|
}) => {
|
|
31092
|
-
return /* @__PURE__ */ React.createElement(react
|
|
31093
|
-
react
|
|
31614
|
+
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(
|
|
31615
|
+
react.Transition,
|
|
31094
31616
|
{
|
|
31095
31617
|
enter: "transition ease-out duration-100",
|
|
31096
31618
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -31099,7 +31621,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31099
31621
|
leaveFrom: "transform opacity-100 scale-100",
|
|
31100
31622
|
leaveTo: "transform opacity-0 scale-95"
|
|
31101
31623
|
},
|
|
31102
|
-
/* @__PURE__ */ React.createElement(react
|
|
31624
|
+
/* @__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(
|
|
31103
31625
|
reactRouterDom.Link,
|
|
31104
31626
|
{
|
|
31105
31627
|
to: `/${folder.fullyQualifiedName ? [
|
|
@@ -31267,6 +31789,23 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31267
31789
|
DeleteModal,
|
|
31268
31790
|
{
|
|
31269
31791
|
filename: vars.relativePath,
|
|
31792
|
+
checkRefsFunc: async () => {
|
|
31793
|
+
var _a2, _b2;
|
|
31794
|
+
try {
|
|
31795
|
+
const doc = await admin.fetchDocument(
|
|
31796
|
+
collection.name,
|
|
31797
|
+
vars.relativePath,
|
|
31798
|
+
true
|
|
31799
|
+
);
|
|
31800
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31801
|
+
} catch (error) {
|
|
31802
|
+
cms.alerts.error(
|
|
31803
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31804
|
+
);
|
|
31805
|
+
console.error(error);
|
|
31806
|
+
throw error;
|
|
31807
|
+
}
|
|
31808
|
+
},
|
|
31270
31809
|
deleteFunc: async () => {
|
|
31271
31810
|
try {
|
|
31272
31811
|
await admin.deleteDocument(vars);
|
|
@@ -31275,6 +31814,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31275
31814
|
);
|
|
31276
31815
|
reFetchCollection();
|
|
31277
31816
|
} catch (error) {
|
|
31817
|
+
if (error.message.indexOf("has references")) {
|
|
31818
|
+
cms.alerts.error(
|
|
31819
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31820
|
+
);
|
|
31821
|
+
return;
|
|
31822
|
+
}
|
|
31278
31823
|
cms.alerts.warn(
|
|
31279
31824
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31280
31825
|
);
|
|
@@ -31326,6 +31871,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31326
31871
|
cms.alerts.info("Document was successfully renamed");
|
|
31327
31872
|
reFetchCollection();
|
|
31328
31873
|
} catch (error) {
|
|
31874
|
+
if (error.message.indexOf("has references")) {
|
|
31875
|
+
cms.alerts.error(
|
|
31876
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31877
|
+
);
|
|
31878
|
+
return;
|
|
31879
|
+
}
|
|
31329
31880
|
cms.alerts.warn(
|
|
31330
31881
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31331
31882
|
);
|
|
@@ -31799,8 +32350,19 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31799
32350
|
const NoDocumentsPlaceholder = () => {
|
|
31800
32351
|
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."));
|
|
31801
32352
|
};
|
|
31802
|
-
const DeleteModal = ({
|
|
31803
|
-
|
|
32353
|
+
const DeleteModal = ({
|
|
32354
|
+
close: close2,
|
|
32355
|
+
deleteFunc,
|
|
32356
|
+
checkRefsFunc,
|
|
32357
|
+
filename
|
|
32358
|
+
}) => {
|
|
32359
|
+
const [hasRefs, setHasRefs] = React.useState();
|
|
32360
|
+
React.useEffect(() => {
|
|
32361
|
+
checkRefsFunc().then((result) => {
|
|
32362
|
+
setHasRefs(result);
|
|
32363
|
+
});
|
|
32364
|
+
}, [filename, checkRefsFunc]);
|
|
32365
|
+
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(
|
|
31804
32366
|
Button$1,
|
|
31805
32367
|
{
|
|
31806
32368
|
style: { flexGrow: 3 },
|
|
@@ -33167,6 +33729,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33167
33729
|
exports2.useScreenPlugin = useScreenPlugin;
|
|
33168
33730
|
exports2.useTinaAuthRedirect = useTinaAuthRedirect;
|
|
33169
33731
|
exports2.wrapFieldWithError = wrapFieldWithError;
|
|
33732
|
+
exports2.wrapFieldWithNoHeader = wrapFieldWithNoHeader;
|
|
33170
33733
|
exports2.wrapFieldsWithMeta = wrapFieldsWithMeta;
|
|
33171
33734
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
33172
33735
|
});
|