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