tinacms 0.0.0-e0ddb8c-20241004065742 → 0.0.0-ecea7ac-20241011043815
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/index.js +1724 -1275
- package/dist/index.mjs +1698 -1246
- package/dist/rich-text/index.js +42 -11
- package/dist/rich-text/index.mjs +42 -11
- 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/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/plugins/core/common.d.ts +1 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +48 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +7 -3
- package/package.json +7 -6
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/hooks/use-mermaid-element.d.ts +0 -3
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(
|
|
@@ -882,6 +882,20 @@ var __publicField = (obj, key, value) => {
|
|
|
882
882
|
const useTemplates = () => {
|
|
883
883
|
return React.useContext(EditorContext);
|
|
884
884
|
};
|
|
885
|
+
const BlockquoteElement = cn$1.withRef(
|
|
886
|
+
({ children, className, ...props }, ref) => {
|
|
887
|
+
return /* @__PURE__ */ React.createElement(
|
|
888
|
+
plateCommon.PlateElement,
|
|
889
|
+
{
|
|
890
|
+
asChild: true,
|
|
891
|
+
className: cn$1.cn("my-1 border-l-2 pl-6 italic", className),
|
|
892
|
+
ref,
|
|
893
|
+
...props
|
|
894
|
+
},
|
|
895
|
+
/* @__PURE__ */ React.createElement("blockquote", null, children)
|
|
896
|
+
);
|
|
897
|
+
}
|
|
898
|
+
);
|
|
885
899
|
function classNames$1(...classes) {
|
|
886
900
|
return classes.filter(Boolean).join(" ");
|
|
887
901
|
}
|
|
@@ -891,170 +905,667 @@ var __publicField = (obj, key, value) => {
|
|
|
891
905
|
(c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
892
906
|
);
|
|
893
907
|
};
|
|
894
|
-
|
|
908
|
+
function ChevronDownIcon(props, svgRef) {
|
|
909
|
+
return /* @__PURE__ */ React__namespace.createElement("svg", Object.assign({
|
|
910
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
911
|
+
viewBox: "0 0 20 20",
|
|
912
|
+
fill: "currentColor",
|
|
913
|
+
"aria-hidden": "true",
|
|
914
|
+
ref: svgRef
|
|
915
|
+
}, props), /* @__PURE__ */ React__namespace.createElement("path", {
|
|
916
|
+
fillRule: "evenodd",
|
|
917
|
+
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",
|
|
918
|
+
clipRule: "evenodd"
|
|
919
|
+
}));
|
|
920
|
+
}
|
|
921
|
+
const ForwardRef = React__namespace.forwardRef(ChevronDownIcon);
|
|
922
|
+
const ChevronDownIcon$1 = ForwardRef;
|
|
923
|
+
const Autocomplete = ({
|
|
924
|
+
value,
|
|
925
|
+
onChange,
|
|
926
|
+
defaultQuery,
|
|
927
|
+
items: items2
|
|
928
|
+
}) => {
|
|
929
|
+
const [query, setQuery] = React.useState(defaultQuery ?? "");
|
|
930
|
+
const filteredItems = React.useMemo(() => {
|
|
931
|
+
try {
|
|
932
|
+
const reFilter = new RegExp(query, "i");
|
|
933
|
+
const _items = items2.filter((item) => reFilter.test(item.label));
|
|
934
|
+
if (_items.length === 0)
|
|
935
|
+
return items2;
|
|
936
|
+
return _items;
|
|
937
|
+
} catch (err) {
|
|
938
|
+
return items2;
|
|
939
|
+
}
|
|
940
|
+
}, [items2, query]);
|
|
895
941
|
return /* @__PURE__ */ React.createElement(
|
|
896
|
-
|
|
942
|
+
react.Combobox,
|
|
897
943
|
{
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
className: "h-5 w-5",
|
|
903
|
-
viewBox: "0 0 24 24",
|
|
904
|
-
height: "1em",
|
|
905
|
-
width: "1em",
|
|
906
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
944
|
+
value,
|
|
945
|
+
onChange,
|
|
946
|
+
as: "div",
|
|
947
|
+
className: "relative inline-block text-left z-20"
|
|
907
948
|
},
|
|
908
|
-
/* @__PURE__ */ React.createElement("
|
|
909
|
-
|
|
949
|
+
/* @__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(
|
|
950
|
+
react.ComboboxInput,
|
|
951
|
+
{
|
|
952
|
+
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",
|
|
953
|
+
displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
|
|
954
|
+
onChange: (event) => setQuery(event.target.value),
|
|
955
|
+
onClick: (ev) => ev.stopPropagation()
|
|
956
|
+
}
|
|
957
|
+
), /* @__PURE__ */ React.createElement(react.ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React.createElement(
|
|
958
|
+
ChevronDownIcon$1,
|
|
959
|
+
{
|
|
960
|
+
className: "h-5 w-5 text-gray-400",
|
|
961
|
+
"aria-hidden": "true"
|
|
962
|
+
}
|
|
963
|
+
)))),
|
|
964
|
+
/* @__PURE__ */ React.createElement(
|
|
965
|
+
react.Transition,
|
|
966
|
+
{
|
|
967
|
+
enter: "transition ease-out duration-100",
|
|
968
|
+
enterFrom: "transform opacity-0 scale-95",
|
|
969
|
+
enterTo: "transform opacity-100 scale-100",
|
|
970
|
+
leave: "transition ease-in duration-75",
|
|
971
|
+
leaveFrom: "transform opacity-100 scale-100",
|
|
972
|
+
leaveTo: "transform opacity-0 scale-95"
|
|
973
|
+
},
|
|
974
|
+
/* @__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(
|
|
975
|
+
"button",
|
|
976
|
+
{
|
|
977
|
+
className: classNames$1(
|
|
978
|
+
focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
|
|
979
|
+
"block px-4 py-2 text-xs w-full text-right"
|
|
980
|
+
)
|
|
981
|
+
},
|
|
982
|
+
item.render(item)
|
|
983
|
+
))))
|
|
984
|
+
)
|
|
910
985
|
);
|
|
911
986
|
};
|
|
912
|
-
|
|
913
|
-
"
|
|
914
|
-
{
|
|
915
|
-
width: "100%",
|
|
916
|
-
height: "100%",
|
|
917
|
-
viewBox: "0 0 491 491",
|
|
918
|
-
version: "1.1",
|
|
919
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
920
|
-
fillRule: "evenodd",
|
|
921
|
-
clipRule: "evenodd",
|
|
922
|
-
strokeLinejoin: "round",
|
|
923
|
-
strokeMiterlimit: 2
|
|
924
|
-
},
|
|
925
|
-
/* @__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" }),
|
|
926
|
-
/* @__PURE__ */ React.createElement(
|
|
927
|
-
"path",
|
|
928
|
-
{
|
|
929
|
-
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",
|
|
930
|
-
fill: "white",
|
|
931
|
-
fillRule: "nonzero"
|
|
932
|
-
}
|
|
933
|
-
)
|
|
934
|
-
);
|
|
935
|
-
const borderAll = (props) => /* @__PURE__ */ React.createElement(
|
|
936
|
-
"svg",
|
|
937
|
-
{
|
|
938
|
-
viewBox: "0 0 24 24",
|
|
939
|
-
height: "48",
|
|
940
|
-
width: "48",
|
|
941
|
-
focusable: "false",
|
|
942
|
-
role: "img",
|
|
943
|
-
fill: "currentColor",
|
|
944
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
945
|
-
...props
|
|
946
|
-
},
|
|
947
|
-
/* @__PURE__ */ React.createElement("path", { d: "M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6zm10 13h5a1 1 0 0 0 1-1v-5h-6v6zm-2-6H5v5a1 1 0 0 0 1 1h5v-6zm2-2h6V6a1 1 0 0 0-1-1h-5v6zm-2-6H6a1 1 0 0 0-1 1v5h6V5z" })
|
|
948
|
-
);
|
|
949
|
-
const borderBottom = (props) => /* @__PURE__ */ React.createElement(
|
|
950
|
-
"svg",
|
|
951
|
-
{
|
|
952
|
-
viewBox: "0 0 24 24",
|
|
953
|
-
height: "48",
|
|
954
|
-
width: "48",
|
|
955
|
-
focusable: "false",
|
|
956
|
-
role: "img",
|
|
957
|
-
fill: "currentColor",
|
|
958
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
959
|
-
...props
|
|
960
|
-
},
|
|
961
|
-
/* @__PURE__ */ React.createElement("path", { d: "M13 5a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm-8 6a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm-2 7a1 1 0 1 1 2 0 1 1 0 0 0 1 1h12a1 1 0 0 0 1-1 1 1 0 1 1 2 0 3 3 0 0 1-3 3H6a3 3 0 0 1-3-3zm17-8a1 1 0 0 0-1 1v2a1 1 0 1 0 2 0v-2a1 1 0 0 0-1-1zM7 4a1 1 0 0 0-1-1 3 3 0 0 0-3 3 1 1 0 0 0 2 0 1 1 0 0 1 1-1 1 1 0 0 0 1-1zm11-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-3z" })
|
|
962
|
-
);
|
|
963
|
-
const borderLeft = (props) => /* @__PURE__ */ React.createElement(
|
|
964
|
-
"svg",
|
|
965
|
-
{
|
|
966
|
-
viewBox: "0 0 24 24",
|
|
967
|
-
height: "48",
|
|
968
|
-
width: "48",
|
|
969
|
-
focusable: "false",
|
|
970
|
-
role: "img",
|
|
971
|
-
fill: "currentColor",
|
|
972
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
973
|
-
...props
|
|
974
|
-
},
|
|
975
|
-
/* @__PURE__ */ React.createElement("path", { d: "M6 21a1 1 0 1 0 0-2 1 1 0 0 1-1-1V6a1 1 0 0 1 1-1 1 1 0 0 0 0-2 3 3 0 0 0-3 3v12a3 3 0 0 0 3 3zm7-16a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm6 6a1 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 1zm4-17a1 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-3zm-1 17a1 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" })
|
|
976
|
-
);
|
|
977
|
-
const borderNone = (props) => /* @__PURE__ */ React.createElement(
|
|
978
|
-
"svg",
|
|
979
|
-
{
|
|
980
|
-
viewBox: "0 0 24 24",
|
|
981
|
-
height: "48",
|
|
982
|
-
width: "48",
|
|
983
|
-
focusable: "false",
|
|
984
|
-
role: "img",
|
|
985
|
-
fill: "currentColor",
|
|
986
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
987
|
-
...props
|
|
988
|
-
},
|
|
989
|
-
/* @__PURE__ */ React.createElement("path", { d: "M14 4a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-9 7a1 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-6 10a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zM7 4a1 1 0 0 0-1-1 3 3 0 0 0-3 3 1 1 0 0 0 2 0 1 1 0 0 1 1-1 1 1 0 0 0 1-1zm11-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-3zM7 20a1 1 0 0 1-1 1 3 3 0 0 1-3-3 1 1 0 1 1 2 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1zm11 1a1 1 0 1 1 0-2 1 1 0 0 0 1-1 1 1 0 1 1 2 0 3 3 0 0 1-3 3z" })
|
|
990
|
-
);
|
|
991
|
-
const borderRight = (props) => /* @__PURE__ */ React.createElement(
|
|
992
|
-
"svg",
|
|
993
|
-
{
|
|
994
|
-
viewBox: "0 0 24 24",
|
|
995
|
-
height: "48",
|
|
996
|
-
width: "48",
|
|
997
|
-
focusable: "false",
|
|
998
|
-
role: "img",
|
|
999
|
-
fill: "currentColor",
|
|
1000
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1001
|
-
...props
|
|
1002
|
-
},
|
|
1003
|
-
/* @__PURE__ */ React.createElement("path", { d: "M13 5a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm-8 6a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm9 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zM6 3a1 1 0 0 1 0 2 1 1 0 0 0-1 1 1 1 0 0 1-2 0 3 3 0 0 1 3-3zm1 17a1 1 0 0 1-1 1 3 3 0 0 1-3-3 1 1 0 1 1 2 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1zm11 1a1 1 0 1 1 0-2 1 1 0 0 0 1-1V6a1 1 0 0 0-1-1 1 1 0 1 1 0-2 3 3 0 0 1 3 3v12a3 3 0 0 1-3 3z" })
|
|
1004
|
-
);
|
|
1005
|
-
const borderTop = (props) => /* @__PURE__ */ React.createElement(
|
|
1006
|
-
"svg",
|
|
1007
|
-
{
|
|
1008
|
-
viewBox: "0 0 24 24",
|
|
1009
|
-
height: "48",
|
|
1010
|
-
width: "48",
|
|
1011
|
-
focusable: "false",
|
|
1012
|
-
role: "img",
|
|
1013
|
-
fill: "currentColor",
|
|
1014
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1015
|
-
...props
|
|
1016
|
-
},
|
|
1017
|
-
/* @__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" })
|
|
1018
|
-
);
|
|
1019
|
-
classVarianceAuthority.cva("", {
|
|
1020
|
-
variants: {
|
|
1021
|
-
variant: {
|
|
1022
|
-
toolbar: "size-5",
|
|
1023
|
-
menuItem: "mr-2 size-5"
|
|
1024
|
-
},
|
|
1025
|
-
size: {
|
|
1026
|
-
sm: "mr-2 size-4",
|
|
1027
|
-
md: "mr-2 size-6"
|
|
1028
|
-
}
|
|
1029
|
-
},
|
|
1030
|
-
defaultVariants: {}
|
|
987
|
+
MonacoEditor.loader.config({
|
|
988
|
+
paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
|
|
1031
989
|
});
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
{
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
/* @__PURE__ */ React.createElement(
|
|
1043
|
-
"path",
|
|
1044
|
-
{
|
|
1045
|
-
clipRule: "evenodd",
|
|
1046
|
-
d: "M8.5 3H13V13H8.5V3ZM7.5 2H8.5H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H8.5H7.5H3C2.44772 14 2 13.5523 2 13V3C2 2.44772 2.44772 2 3 2H7.5ZM7.5 13H3L3 3H7.5V13Z",
|
|
1047
|
-
fill: "#595E6F",
|
|
1048
|
-
fillRule: "evenodd"
|
|
990
|
+
let retryCount = 0;
|
|
991
|
+
const retryFocus = (ref) => {
|
|
992
|
+
if (ref.current) {
|
|
993
|
+
ref.current.focus();
|
|
994
|
+
} else {
|
|
995
|
+
if (retryCount < 30) {
|
|
996
|
+
setTimeout(() => {
|
|
997
|
+
retryCount = retryCount + 1;
|
|
998
|
+
retryFocus(ref);
|
|
999
|
+
}, 100);
|
|
1049
1000
|
}
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
const MINIMUM_HEIGHT = 75;
|
|
1004
|
+
const CodeBlock = ({
|
|
1005
|
+
attributes,
|
|
1006
|
+
editor,
|
|
1007
|
+
element,
|
|
1008
|
+
language: restrictLanguage,
|
|
1009
|
+
onChangeCallback,
|
|
1010
|
+
defaultValue,
|
|
1011
|
+
...props
|
|
1012
|
+
}) => {
|
|
1013
|
+
const [navigateAway, setNavigateAway] = React.useState(null);
|
|
1014
|
+
const monaco = MonacoEditor.useMonaco();
|
|
1015
|
+
const monacoEditorRef = React.useRef(null);
|
|
1016
|
+
const selected = slateReact.useSelected();
|
|
1017
|
+
const [height, setHeight] = React.useState(MINIMUM_HEIGHT);
|
|
1018
|
+
React.useEffect(() => {
|
|
1019
|
+
if (selected && plateCommon.isCollapsed(editor.selection)) {
|
|
1020
|
+
retryFocus(monacoEditorRef);
|
|
1021
|
+
}
|
|
1022
|
+
}, [selected, monacoEditorRef.current]);
|
|
1023
|
+
const value = element.value || "";
|
|
1024
|
+
if (typeof value !== "string") {
|
|
1025
|
+
throw new Error("Element must be of type string for code block");
|
|
1026
|
+
}
|
|
1027
|
+
const language = restrictLanguage || element.lang;
|
|
1028
|
+
const id = React.useMemo(() => uuid(), []);
|
|
1029
|
+
const languages = React.useMemo(() => {
|
|
1030
|
+
const defaultLangSet = { "": "plain text" };
|
|
1031
|
+
if (!monaco)
|
|
1032
|
+
return defaultLangSet;
|
|
1033
|
+
return monaco.languages.getLanguages().reduce((ac, cv) => {
|
|
1034
|
+
if (cv.id === "plaintext")
|
|
1035
|
+
return ac;
|
|
1036
|
+
return { ...ac, [cv.id]: cv.id };
|
|
1037
|
+
}, defaultLangSet);
|
|
1038
|
+
}, [monaco]);
|
|
1039
|
+
React.useEffect(() => {
|
|
1040
|
+
if (monaco) {
|
|
1041
|
+
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
1042
|
+
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
1043
|
+
// disable errors
|
|
1044
|
+
noSemanticValidation: true,
|
|
1045
|
+
noSyntaxValidation: true
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
}, [monaco]);
|
|
1049
|
+
const items2 = Object.entries(languages).map(([key, label]) => ({
|
|
1050
|
+
key,
|
|
1051
|
+
label,
|
|
1052
|
+
render: (item) => item.label
|
|
1053
|
+
}));
|
|
1054
|
+
const currentItem = React.useMemo(() => {
|
|
1055
|
+
return items2.find((item) => item.key === language) ?? {
|
|
1056
|
+
key: "",
|
|
1057
|
+
label: "Plain Text"
|
|
1058
|
+
};
|
|
1059
|
+
}, [items2, language]);
|
|
1060
|
+
React.useEffect(() => {
|
|
1061
|
+
if (navigateAway) {
|
|
1062
|
+
setNavigateAway(null);
|
|
1063
|
+
switch (navigateAway) {
|
|
1064
|
+
case "remove":
|
|
1065
|
+
{
|
|
1066
|
+
plateCommon.focusEditor(editor);
|
|
1067
|
+
plateCommon.setNodes(
|
|
1068
|
+
editor,
|
|
1069
|
+
{
|
|
1070
|
+
type: "p",
|
|
1071
|
+
children: [{ text: "" }],
|
|
1072
|
+
lang: void 0,
|
|
1073
|
+
value: void 0
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
match: (n) => {
|
|
1077
|
+
if (plateCommon.isElement(n) && n.type === element.type) {
|
|
1078
|
+
return true;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
break;
|
|
1085
|
+
case "insertNext":
|
|
1086
|
+
{
|
|
1087
|
+
plateCommon.insertNodes(
|
|
1088
|
+
editor,
|
|
1089
|
+
[
|
|
1090
|
+
{
|
|
1091
|
+
type: plateCommon.ELEMENT_DEFAULT,
|
|
1092
|
+
children: [{ text: "" }],
|
|
1093
|
+
lang: void 0,
|
|
1094
|
+
value: void 0
|
|
1095
|
+
}
|
|
1096
|
+
],
|
|
1097
|
+
{ select: true }
|
|
1098
|
+
);
|
|
1099
|
+
plateCommon.focusEditor(editor);
|
|
1100
|
+
}
|
|
1101
|
+
break;
|
|
1102
|
+
case "up":
|
|
1103
|
+
{
|
|
1104
|
+
const path = plateCommon.findNodePath(editor, element);
|
|
1105
|
+
if (!path) {
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
const previousNodePath = plateCommon.getPointBefore(editor, path);
|
|
1109
|
+
if (!previousNodePath) {
|
|
1110
|
+
plateCommon.focusEditor(editor);
|
|
1111
|
+
plateCommon.insertNodes(
|
|
1112
|
+
editor,
|
|
1113
|
+
[
|
|
1114
|
+
{
|
|
1115
|
+
type: plateCommon.ELEMENT_DEFAULT,
|
|
1116
|
+
children: [{ text: "" }],
|
|
1117
|
+
lang: void 0,
|
|
1118
|
+
value: void 0
|
|
1119
|
+
}
|
|
1120
|
+
],
|
|
1121
|
+
// Insert a new node at the current path, resulting in the code_block
|
|
1122
|
+
// moving down one block
|
|
1123
|
+
{ at: path, select: true }
|
|
1124
|
+
);
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
plateCommon.focusEditor(editor, previousNodePath);
|
|
1128
|
+
}
|
|
1129
|
+
break;
|
|
1130
|
+
case "down": {
|
|
1131
|
+
const path = plateCommon.findNodePath(editor, element);
|
|
1132
|
+
if (!path) {
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
const nextNodePath = plateCommon.getPointAfter(editor, path);
|
|
1136
|
+
if (!nextNodePath) {
|
|
1137
|
+
plateCommon.insertNodes(
|
|
1138
|
+
editor,
|
|
1139
|
+
[
|
|
1140
|
+
{
|
|
1141
|
+
type: plateCommon.ELEMENT_DEFAULT,
|
|
1142
|
+
children: [{ text: "" }],
|
|
1143
|
+
lang: void 0,
|
|
1144
|
+
value: void 0
|
|
1145
|
+
}
|
|
1146
|
+
],
|
|
1147
|
+
{ select: true }
|
|
1148
|
+
);
|
|
1149
|
+
plateCommon.focusEditor(editor);
|
|
1150
|
+
} else {
|
|
1151
|
+
plateCommon.focusEditor(editor, nextNodePath);
|
|
1152
|
+
}
|
|
1153
|
+
break;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}, [navigateAway]);
|
|
1158
|
+
function handleEditorDidMount(monacoEditor, monaco2) {
|
|
1159
|
+
monacoEditorRef.current = monacoEditor;
|
|
1160
|
+
monacoEditor.onDidContentSizeChange(() => {
|
|
1161
|
+
setHeight(
|
|
1162
|
+
monacoEditor.getContentHeight() > MINIMUM_HEIGHT ? monacoEditor.getContentHeight() : MINIMUM_HEIGHT
|
|
1163
|
+
);
|
|
1164
|
+
monacoEditor.layout();
|
|
1165
|
+
});
|
|
1166
|
+
plateCommon.setNodes(editor, { value: defaultValue, lang: language });
|
|
1167
|
+
monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
|
|
1168
|
+
if (monacoEditor.hasTextFocus()) {
|
|
1169
|
+
setNavigateAway("insertNext");
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1172
|
+
monacoEditor.onKeyDown((l) => {
|
|
1173
|
+
if (l.code === "ArrowUp") {
|
|
1174
|
+
const selection = monacoEditor.getSelection();
|
|
1175
|
+
if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
|
|
1176
|
+
setNavigateAway("up");
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
if (l.code === "ArrowDown") {
|
|
1180
|
+
const selection = monacoEditor.getSelection();
|
|
1181
|
+
const totalLines = monacoEditor.getModel().getLineCount();
|
|
1182
|
+
if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
|
|
1183
|
+
setNavigateAway("down");
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
if (l.code === "Backspace") {
|
|
1187
|
+
const selection = monacoEditor.getSelection();
|
|
1188
|
+
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) {
|
|
1189
|
+
setNavigateAway("remove");
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
return /* @__PURE__ */ React.createElement(
|
|
1195
|
+
"div",
|
|
1196
|
+
{
|
|
1197
|
+
...attributes,
|
|
1198
|
+
className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
|
|
1199
|
+
},
|
|
1200
|
+
/* @__PURE__ */ React.createElement("style", null, `.monaco-editor .editor-widget {
|
|
1201
|
+
display: none !important;
|
|
1202
|
+
visibility: hidden !important;
|
|
1203
|
+
}`),
|
|
1204
|
+
props.children,
|
|
1205
|
+
/* @__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(
|
|
1206
|
+
Autocomplete,
|
|
1207
|
+
{
|
|
1208
|
+
items: items2,
|
|
1209
|
+
value: currentItem,
|
|
1210
|
+
defaultQuery: "plaintext",
|
|
1211
|
+
onChange: (item) => plateCommon.setNodes(editor, { lang: item.key })
|
|
1212
|
+
}
|
|
1213
|
+
)), /* @__PURE__ */ React.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React.createElement(
|
|
1214
|
+
MonacoEditor,
|
|
1215
|
+
{
|
|
1216
|
+
path: id,
|
|
1217
|
+
onMount: handleEditorDidMount,
|
|
1218
|
+
options: {
|
|
1219
|
+
scrollBeyondLastLine: false,
|
|
1220
|
+
// automaticLayout: true,
|
|
1221
|
+
tabSize: 2,
|
|
1222
|
+
disableLayerHinting: true,
|
|
1223
|
+
accessibilitySupport: "off",
|
|
1224
|
+
codeLens: false,
|
|
1225
|
+
wordWrap: "on",
|
|
1226
|
+
minimap: {
|
|
1227
|
+
enabled: false
|
|
1228
|
+
},
|
|
1229
|
+
fontSize: 14,
|
|
1230
|
+
lineHeight: 2,
|
|
1231
|
+
formatOnPaste: true,
|
|
1232
|
+
lineNumbers: "off",
|
|
1233
|
+
formatOnType: true,
|
|
1234
|
+
fixedOverflowWidgets: true,
|
|
1235
|
+
// Takes too much horizontal space for iframe
|
|
1236
|
+
folding: false,
|
|
1237
|
+
renderLineHighlight: "none",
|
|
1238
|
+
scrollbar: {
|
|
1239
|
+
verticalScrollbarSize: 1,
|
|
1240
|
+
horizontalScrollbarSize: 1,
|
|
1241
|
+
// https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
|
|
1242
|
+
alwaysConsumeMouseWheel: false
|
|
1243
|
+
}
|
|
1244
|
+
},
|
|
1245
|
+
language: String(language),
|
|
1246
|
+
value: String(element.value),
|
|
1247
|
+
onChange: (value2) => {
|
|
1248
|
+
onChangeCallback == null ? void 0 : onChangeCallback(value2);
|
|
1249
|
+
plateCommon.setNodes(editor, { value: value2, lang: language });
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
)))
|
|
1253
|
+
);
|
|
1254
|
+
};
|
|
1255
|
+
const CodeBlockElement = cn$1.withRef(
|
|
1256
|
+
({ className, ...props }, ref) => {
|
|
1257
|
+
const { element } = props;
|
|
1258
|
+
const state = plateCodeBlock.useCodeBlockElementState({ element });
|
|
1259
|
+
return /* @__PURE__ */ React.createElement(
|
|
1260
|
+
plateCommon.PlateElement,
|
|
1261
|
+
{
|
|
1262
|
+
className: cn$1.cn("relative py-1", state.className, className),
|
|
1263
|
+
ref,
|
|
1264
|
+
...props
|
|
1265
|
+
},
|
|
1266
|
+
/* @__PURE__ */ React.createElement(CodeBlock, { ...props })
|
|
1267
|
+
);
|
|
1268
|
+
}
|
|
1269
|
+
);
|
|
1270
|
+
const CodeLeaf = cn$1.withRef(
|
|
1271
|
+
({ children, className, ...props }, ref) => {
|
|
1272
|
+
return /* @__PURE__ */ React.createElement(
|
|
1273
|
+
plateCommon.PlateLeaf,
|
|
1274
|
+
{
|
|
1275
|
+
asChild: true,
|
|
1276
|
+
className: cn$1.cn(
|
|
1277
|
+
"whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
|
|
1278
|
+
className
|
|
1279
|
+
),
|
|
1280
|
+
ref,
|
|
1281
|
+
...props
|
|
1282
|
+
},
|
|
1283
|
+
/* @__PURE__ */ React.createElement("code", null, children)
|
|
1284
|
+
);
|
|
1285
|
+
}
|
|
1286
|
+
);
|
|
1287
|
+
const CodeLineElement = cn$1.withRef((props, ref) => /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { ref, ...props }));
|
|
1288
|
+
const CodeSyntaxLeaf = cn$1.withRef(
|
|
1289
|
+
({ children, ...props }, ref) => {
|
|
1290
|
+
const { leaf } = props;
|
|
1291
|
+
const { tokenProps } = plateCodeBlock.useCodeSyntaxLeaf({ leaf });
|
|
1292
|
+
return /* @__PURE__ */ React.createElement(plateCommon.PlateLeaf, { ref, ...props }, /* @__PURE__ */ React.createElement("span", { ...tokenProps }, children));
|
|
1293
|
+
}
|
|
1294
|
+
);
|
|
1295
|
+
const listVariants = classVarianceAuthority.cva("m-0 ps-6", {
|
|
1296
|
+
variants: {
|
|
1297
|
+
variant: {
|
|
1298
|
+
ol: "list-decimal",
|
|
1299
|
+
ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
const ListElementVariants = cn$1.withVariants(plateCommon.PlateElement, listVariants, [
|
|
1304
|
+
"variant"
|
|
1305
|
+
]);
|
|
1306
|
+
const ListElement = cn$1.withRef(
|
|
1307
|
+
({ children, variant = "ul", ...props }, ref) => {
|
|
1308
|
+
const Component = variant;
|
|
1309
|
+
return /* @__PURE__ */ React.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React.createElement(Component, null, children));
|
|
1310
|
+
}
|
|
1311
|
+
);
|
|
1312
|
+
const ELEMENT_MERMAID = "mermaid";
|
|
1313
|
+
const createMermaidPlugin = plateCommon.createPluginFactory({
|
|
1314
|
+
isElement: true,
|
|
1315
|
+
isVoid: true,
|
|
1316
|
+
isInline: false,
|
|
1317
|
+
key: ELEMENT_MERMAID
|
|
1318
|
+
});
|
|
1319
|
+
const MermaidElementWithRef = ({ config }) => {
|
|
1320
|
+
const mermaidRef = React.useRef(null);
|
|
1321
|
+
React.useEffect(() => {
|
|
1322
|
+
if (mermaidRef.current) {
|
|
1323
|
+
mermaid.initialize({ startOnLoad: true });
|
|
1324
|
+
mermaid.run();
|
|
1325
|
+
}
|
|
1326
|
+
}, [config]);
|
|
1327
|
+
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)));
|
|
1328
|
+
};
|
|
1329
|
+
const Bubble = ({ children }) => {
|
|
1330
|
+
return /* @__PURE__ */ React.createElement("div", { className: "bg-blue-600 rounded-full p-2 transition-transform duration-200 ease-in-out hover:scale-110" }, children);
|
|
1331
|
+
};
|
|
1332
|
+
const ErrorMsg = ({ error }) => {
|
|
1333
|
+
if (error) {
|
|
1334
|
+
return /* @__PURE__ */ React.createElement(
|
|
1335
|
+
"div",
|
|
1336
|
+
{
|
|
1337
|
+
contentEditable: false,
|
|
1338
|
+
className: "font-mono bg-red-600 text-white p-2 rounded-md cursor-default"
|
|
1339
|
+
},
|
|
1340
|
+
error
|
|
1341
|
+
);
|
|
1342
|
+
}
|
|
1343
|
+
return null;
|
|
1344
|
+
};
|
|
1345
|
+
const DEFAULT_MERMAID_CONFIG = `%% This won't render without implementing a rendering engine (e.g. mermaid on npm)
|
|
1346
|
+
flowchart TD
|
|
1347
|
+
id1(this is an example flow diagram)
|
|
1348
|
+
--> id2(modify me to see changes!)
|
|
1349
|
+
id2
|
|
1350
|
+
--> id3(Click the top button to preview the changes)
|
|
1351
|
+
--> id4(Learn about mermaid diagrams @ mermaid.js.org)`;
|
|
1352
|
+
const MermaidElement = cn$1.withRef(
|
|
1353
|
+
({ children, nodeProps, element, ...props }, ref) => {
|
|
1354
|
+
const [mermaidConfig, setMermaidConfig] = React.useState(
|
|
1355
|
+
element.value || DEFAULT_MERMAID_CONFIG
|
|
1356
|
+
);
|
|
1357
|
+
const [isEditing, setIsEditing] = React.useState(
|
|
1358
|
+
mermaidConfig === DEFAULT_MERMAID_CONFIG || false
|
|
1359
|
+
);
|
|
1360
|
+
const [mermaidError, setMermaidError] = React.useState(null);
|
|
1361
|
+
const node = {
|
|
1362
|
+
type: ELEMENT_MERMAID,
|
|
1363
|
+
value: mermaidConfig,
|
|
1364
|
+
children: [{ type: "text", text: "" }]
|
|
1365
|
+
};
|
|
1366
|
+
React.useEffect(() => {
|
|
1367
|
+
if (mermaid.parse(mermaidConfig, { suppressErrors: false })) {
|
|
1368
|
+
setMermaidError(null);
|
|
1369
|
+
}
|
|
1370
|
+
}, [mermaidConfig]);
|
|
1371
|
+
mermaid.parseError = (err) => {
|
|
1372
|
+
setMermaidError(
|
|
1373
|
+
String(err.message) || "An error occurred while parsing the diagram."
|
|
1374
|
+
);
|
|
1375
|
+
};
|
|
1376
|
+
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(
|
|
1377
|
+
lucideReact.Eye,
|
|
1378
|
+
{
|
|
1379
|
+
className: "w-5 h-5 fill-white cursor-pointer",
|
|
1380
|
+
onClick: () => {
|
|
1381
|
+
setIsEditing(!isEditing);
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
) : /* @__PURE__ */ React.createElement(
|
|
1385
|
+
lucideReact.SquarePen,
|
|
1386
|
+
{
|
|
1387
|
+
className: "w-5 h-5 fill-white cursor-pointer",
|
|
1388
|
+
onClick: () => {
|
|
1389
|
+
setIsEditing(!isEditing);
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
))), isEditing ? /* @__PURE__ */ React.createElement(
|
|
1393
|
+
CodeBlock,
|
|
1394
|
+
{
|
|
1395
|
+
children: "",
|
|
1396
|
+
language: "yaml",
|
|
1397
|
+
...props,
|
|
1398
|
+
element: node,
|
|
1399
|
+
defaultValue: mermaidConfig,
|
|
1400
|
+
onChangeCallback: (value) => setMermaidConfig(value)
|
|
1401
|
+
}
|
|
1402
|
+
) : /* @__PURE__ */ React.createElement(MermaidElementWithRef, { config: mermaidConfig })), children, /* @__PURE__ */ React.createElement(ErrorMsg, { error: mermaidError }));
|
|
1403
|
+
}
|
|
1404
|
+
);
|
|
1405
|
+
const RawMarkdown = () => {
|
|
1406
|
+
return /* @__PURE__ */ React.createElement(
|
|
1407
|
+
"svg",
|
|
1408
|
+
{
|
|
1409
|
+
stroke: "currentColor",
|
|
1410
|
+
fill: "currentColor",
|
|
1411
|
+
strokeWidth: 0,
|
|
1412
|
+
role: "img",
|
|
1413
|
+
className: "h-5 w-5",
|
|
1414
|
+
viewBox: "0 0 24 24",
|
|
1415
|
+
height: "1em",
|
|
1416
|
+
width: "1em",
|
|
1417
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1418
|
+
},
|
|
1419
|
+
/* @__PURE__ */ React.createElement("title", null),
|
|
1420
|
+
/* @__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" })
|
|
1421
|
+
);
|
|
1422
|
+
};
|
|
1423
|
+
const MermaidIcon = () => /* @__PURE__ */ React.createElement(
|
|
1424
|
+
"svg",
|
|
1425
|
+
{
|
|
1426
|
+
width: "100%",
|
|
1427
|
+
height: "100%",
|
|
1428
|
+
viewBox: "0 0 491 491",
|
|
1429
|
+
version: "1.1",
|
|
1430
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1431
|
+
fillRule: "evenodd",
|
|
1432
|
+
clipRule: "evenodd",
|
|
1433
|
+
strokeLinejoin: "round",
|
|
1434
|
+
strokeMiterlimit: 2
|
|
1435
|
+
},
|
|
1436
|
+
/* @__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" }),
|
|
1437
|
+
/* @__PURE__ */ React.createElement(
|
|
1438
|
+
"path",
|
|
1439
|
+
{
|
|
1440
|
+
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",
|
|
1441
|
+
fill: "white",
|
|
1442
|
+
fillRule: "nonzero"
|
|
1443
|
+
}
|
|
1444
|
+
)
|
|
1445
|
+
);
|
|
1446
|
+
const borderAll = (props) => /* @__PURE__ */ React.createElement(
|
|
1447
|
+
"svg",
|
|
1448
|
+
{
|
|
1449
|
+
viewBox: "0 0 24 24",
|
|
1450
|
+
height: "48",
|
|
1451
|
+
width: "48",
|
|
1452
|
+
focusable: "false",
|
|
1453
|
+
role: "img",
|
|
1454
|
+
fill: "currentColor",
|
|
1455
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1456
|
+
...props
|
|
1457
|
+
},
|
|
1458
|
+
/* @__PURE__ */ React.createElement("path", { d: "M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6zm10 13h5a1 1 0 0 0 1-1v-5h-6v6zm-2-6H5v5a1 1 0 0 0 1 1h5v-6zm2-2h6V6a1 1 0 0 0-1-1h-5v6zm-2-6H6a1 1 0 0 0-1 1v5h6V5z" })
|
|
1459
|
+
);
|
|
1460
|
+
const borderBottom = (props) => /* @__PURE__ */ React.createElement(
|
|
1461
|
+
"svg",
|
|
1462
|
+
{
|
|
1463
|
+
viewBox: "0 0 24 24",
|
|
1464
|
+
height: "48",
|
|
1465
|
+
width: "48",
|
|
1466
|
+
focusable: "false",
|
|
1467
|
+
role: "img",
|
|
1468
|
+
fill: "currentColor",
|
|
1469
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1470
|
+
...props
|
|
1471
|
+
},
|
|
1472
|
+
/* @__PURE__ */ React.createElement("path", { d: "M13 5a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm-8 6a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm-2 7a1 1 0 1 1 2 0 1 1 0 0 0 1 1h12a1 1 0 0 0 1-1 1 1 0 1 1 2 0 3 3 0 0 1-3 3H6a3 3 0 0 1-3-3zm17-8a1 1 0 0 0-1 1v2a1 1 0 1 0 2 0v-2a1 1 0 0 0-1-1zM7 4a1 1 0 0 0-1-1 3 3 0 0 0-3 3 1 1 0 0 0 2 0 1 1 0 0 1 1-1 1 1 0 0 0 1-1zm11-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-3z" })
|
|
1473
|
+
);
|
|
1474
|
+
const borderLeft = (props) => /* @__PURE__ */ React.createElement(
|
|
1475
|
+
"svg",
|
|
1476
|
+
{
|
|
1477
|
+
viewBox: "0 0 24 24",
|
|
1478
|
+
height: "48",
|
|
1479
|
+
width: "48",
|
|
1480
|
+
focusable: "false",
|
|
1481
|
+
role: "img",
|
|
1482
|
+
fill: "currentColor",
|
|
1483
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1484
|
+
...props
|
|
1485
|
+
},
|
|
1486
|
+
/* @__PURE__ */ React.createElement("path", { d: "M6 21a1 1 0 1 0 0-2 1 1 0 0 1-1-1V6a1 1 0 0 1 1-1 1 1 0 0 0 0-2 3 3 0 0 0-3 3v12a3 3 0 0 0 3 3zm7-16a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm6 6a1 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 1zm4-17a1 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-3zm-1 17a1 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" })
|
|
1487
|
+
);
|
|
1488
|
+
const borderNone = (props) => /* @__PURE__ */ React.createElement(
|
|
1489
|
+
"svg",
|
|
1490
|
+
{
|
|
1491
|
+
viewBox: "0 0 24 24",
|
|
1492
|
+
height: "48",
|
|
1493
|
+
width: "48",
|
|
1494
|
+
focusable: "false",
|
|
1495
|
+
role: "img",
|
|
1496
|
+
fill: "currentColor",
|
|
1497
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1498
|
+
...props
|
|
1499
|
+
},
|
|
1500
|
+
/* @__PURE__ */ React.createElement("path", { d: "M14 4a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-9 7a1 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-6 10a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zM7 4a1 1 0 0 0-1-1 3 3 0 0 0-3 3 1 1 0 0 0 2 0 1 1 0 0 1 1-1 1 1 0 0 0 1-1zm11-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-3zM7 20a1 1 0 0 1-1 1 3 3 0 0 1-3-3 1 1 0 1 1 2 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1zm11 1a1 1 0 1 1 0-2 1 1 0 0 0 1-1 1 1 0 1 1 2 0 3 3 0 0 1-3 3z" })
|
|
1501
|
+
);
|
|
1502
|
+
const borderRight = (props) => /* @__PURE__ */ React.createElement(
|
|
1503
|
+
"svg",
|
|
1504
|
+
{
|
|
1505
|
+
viewBox: "0 0 24 24",
|
|
1506
|
+
height: "48",
|
|
1507
|
+
width: "48",
|
|
1508
|
+
focusable: "false",
|
|
1509
|
+
role: "img",
|
|
1510
|
+
fill: "currentColor",
|
|
1511
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1512
|
+
...props
|
|
1513
|
+
},
|
|
1514
|
+
/* @__PURE__ */ React.createElement("path", { d: "M13 5a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm-8 6a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm9 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zM6 3a1 1 0 0 1 0 2 1 1 0 0 0-1 1 1 1 0 0 1-2 0 3 3 0 0 1 3-3zm1 17a1 1 0 0 1-1 1 3 3 0 0 1-3-3 1 1 0 1 1 2 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1zm11 1a1 1 0 1 1 0-2 1 1 0 0 0 1-1V6a1 1 0 0 0-1-1 1 1 0 1 1 0-2 3 3 0 0 1 3 3v12a3 3 0 0 1-3 3z" })
|
|
1515
|
+
);
|
|
1516
|
+
const borderTop = (props) => /* @__PURE__ */ React.createElement(
|
|
1517
|
+
"svg",
|
|
1518
|
+
{
|
|
1519
|
+
viewBox: "0 0 24 24",
|
|
1520
|
+
height: "48",
|
|
1521
|
+
width: "48",
|
|
1522
|
+
focusable: "false",
|
|
1523
|
+
role: "img",
|
|
1524
|
+
fill: "currentColor",
|
|
1525
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1526
|
+
...props
|
|
1527
|
+
},
|
|
1528
|
+
/* @__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" })
|
|
1529
|
+
);
|
|
1530
|
+
const iconVariants = classVarianceAuthority.cva("", {
|
|
1531
|
+
variants: {
|
|
1532
|
+
variant: {
|
|
1533
|
+
toolbar: "size-5",
|
|
1534
|
+
menuItem: "mr-2 size-5"
|
|
1535
|
+
},
|
|
1536
|
+
size: {
|
|
1537
|
+
sm: "mr-2 size-4",
|
|
1538
|
+
md: "mr-2 size-6"
|
|
1539
|
+
}
|
|
1540
|
+
},
|
|
1541
|
+
defaultVariants: {}
|
|
1542
|
+
});
|
|
1543
|
+
const DoubleColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
|
|
1544
|
+
"svg",
|
|
1545
|
+
{
|
|
1546
|
+
fill: "none",
|
|
1547
|
+
height: "16",
|
|
1548
|
+
viewBox: "0 0 16 16",
|
|
1549
|
+
width: "16",
|
|
1550
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1551
|
+
...props
|
|
1552
|
+
},
|
|
1553
|
+
/* @__PURE__ */ React.createElement(
|
|
1554
|
+
"path",
|
|
1555
|
+
{
|
|
1556
|
+
clipRule: "evenodd",
|
|
1557
|
+
d: "M8.5 3H13V13H8.5V3ZM7.5 2H8.5H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H8.5H7.5H3C2.44772 14 2 13.5523 2 13V3C2 2.44772 2.44772 2 3 2H7.5ZM7.5 13H3L3 3H7.5V13Z",
|
|
1558
|
+
fill: "#595E6F",
|
|
1559
|
+
fillRule: "evenodd"
|
|
1560
|
+
}
|
|
1561
|
+
)
|
|
1562
|
+
);
|
|
1563
|
+
const ThreeColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
|
|
1564
|
+
"svg",
|
|
1565
|
+
{
|
|
1566
|
+
fill: "none",
|
|
1567
|
+
height: "16",
|
|
1568
|
+
viewBox: "0 0 16 16",
|
|
1058
1569
|
width: "16",
|
|
1059
1570
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1060
1571
|
...props
|
|
@@ -1478,819 +1989,773 @@ var __publicField = (obj, key, value) => {
|
|
|
1478
1989
|
{
|
|
1479
1990
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1480
1991
|
className: `h-4 w-4 ${className}`,
|
|
1481
|
-
viewBox: "0 0 20 20",
|
|
1482
|
-
fill: "currentColor"
|
|
1483
|
-
},
|
|
1484
|
-
/* @__PURE__ */ React.createElement(
|
|
1485
|
-
"path",
|
|
1486
|
-
{
|
|
1487
|
-
fillRule: "evenodd",
|
|
1488
|
-
d: "M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",
|
|
1489
|
-
clipRule: "evenodd"
|
|
1490
|
-
}
|
|
1491
|
-
)
|
|
1492
|
-
);
|
|
1493
|
-
}
|
|
1494
|
-
const InlineComboboxContext = React.createContext(
|
|
1495
|
-
null
|
|
1496
|
-
);
|
|
1497
|
-
const defaultFilter = ({ keywords = [], value }, search) => [value, ...keywords].some((keyword) => plateCombobox.filterWords(keyword, search));
|
|
1498
|
-
const InlineCombobox = ({
|
|
1499
|
-
children,
|
|
1500
|
-
element,
|
|
1501
|
-
filter = defaultFilter,
|
|
1502
|
-
hideWhenNoValue = false,
|
|
1503
|
-
setValue: setValueProp,
|
|
1504
|
-
showTrigger = true,
|
|
1505
|
-
trigger,
|
|
1506
|
-
value: valueProp
|
|
1507
|
-
}) => {
|
|
1508
|
-
const editor = plateCommon.useEditorRef();
|
|
1509
|
-
const inputRef = React.useRef(null);
|
|
1510
|
-
const cursorState = plateCombobox.useHTMLInputCursorState(inputRef);
|
|
1511
|
-
const [valueState, setValueState] = React.useState("");
|
|
1512
|
-
const hasValueProp = valueProp !== void 0;
|
|
1513
|
-
const value = hasValueProp ? valueProp : valueState;
|
|
1514
|
-
const setValue = React.useCallback(
|
|
1515
|
-
(newValue) => {
|
|
1516
|
-
setValueProp == null ? void 0 : setValueProp(newValue);
|
|
1517
|
-
if (!hasValueProp) {
|
|
1518
|
-
setValueState(newValue);
|
|
1519
|
-
}
|
|
1520
|
-
},
|
|
1521
|
-
[setValueProp, hasValueProp]
|
|
1522
|
-
);
|
|
1523
|
-
const [insertPoint, setInsertPoint] = React.useState(null);
|
|
1524
|
-
React.useEffect(() => {
|
|
1525
|
-
const path = plateCommon.findNodePath(editor, element);
|
|
1526
|
-
if (!path)
|
|
1527
|
-
return;
|
|
1528
|
-
const point = plateCommon.getPointBefore(editor, path);
|
|
1529
|
-
if (!point)
|
|
1530
|
-
return;
|
|
1531
|
-
const pointRef = plateCommon.createPointRef(editor, point);
|
|
1532
|
-
setInsertPoint(pointRef);
|
|
1533
|
-
return () => {
|
|
1534
|
-
pointRef.unref();
|
|
1535
|
-
};
|
|
1536
|
-
}, [editor, element]);
|
|
1537
|
-
const { props: inputProps, removeInput } = plateCombobox.useComboboxInput({
|
|
1538
|
-
cancelInputOnBlur: false,
|
|
1539
|
-
cursorState,
|
|
1540
|
-
onCancelInput: (cause) => {
|
|
1541
|
-
if (cause !== "backspace") {
|
|
1542
|
-
plateCommon.insertText(editor, trigger + value, {
|
|
1543
|
-
at: (insertPoint == null ? void 0 : insertPoint.current) ?? void 0
|
|
1544
|
-
});
|
|
1545
|
-
}
|
|
1546
|
-
if (cause === "arrowLeft" || cause === "arrowRight") {
|
|
1547
|
-
plateCommon.moveSelection(editor, {
|
|
1548
|
-
distance: 1,
|
|
1549
|
-
reverse: cause === "arrowLeft"
|
|
1550
|
-
});
|
|
1551
|
-
}
|
|
1552
|
-
},
|
|
1553
|
-
ref: inputRef
|
|
1554
|
-
});
|
|
1555
|
-
const [hasEmpty, setHasEmpty] = React.useState(false);
|
|
1556
|
-
const contextValue = React.useMemo(
|
|
1557
|
-
() => ({
|
|
1558
|
-
filter,
|
|
1559
|
-
inputProps,
|
|
1560
|
-
inputRef,
|
|
1561
|
-
removeInput,
|
|
1562
|
-
setHasEmpty,
|
|
1563
|
-
showTrigger,
|
|
1564
|
-
trigger
|
|
1565
|
-
}),
|
|
1566
|
-
[
|
|
1567
|
-
trigger,
|
|
1568
|
-
showTrigger,
|
|
1569
|
-
filter,
|
|
1570
|
-
inputRef,
|
|
1571
|
-
inputProps,
|
|
1572
|
-
removeInput,
|
|
1573
|
-
setHasEmpty
|
|
1574
|
-
]
|
|
1575
|
-
);
|
|
1576
|
-
const store = react.useComboboxStore({
|
|
1577
|
-
setValue: (newValue) => React.startTransition(() => setValue(newValue))
|
|
1578
|
-
});
|
|
1579
|
-
const items2 = store.useState("items");
|
|
1580
|
-
React.useEffect(() => {
|
|
1581
|
-
if (!store.getState().activeId) {
|
|
1582
|
-
store.setActiveId(store.first());
|
|
1583
|
-
}
|
|
1584
|
-
}, [items2, store]);
|
|
1585
|
-
return /* @__PURE__ */ React.createElement("span", { contentEditable: false }, /* @__PURE__ */ React.createElement(
|
|
1586
|
-
react.ComboboxProvider,
|
|
1587
|
-
{
|
|
1588
|
-
open: (items2.length > 0 || hasEmpty) && (!hideWhenNoValue || value.length > 0),
|
|
1589
|
-
store
|
|
1590
|
-
},
|
|
1591
|
-
/* @__PURE__ */ React.createElement(InlineComboboxContext.Provider, { value: contextValue }, children)
|
|
1592
|
-
));
|
|
1593
|
-
};
|
|
1594
|
-
const InlineComboboxInput = React.forwardRef(({ className, ...props }, propRef) => {
|
|
1595
|
-
const {
|
|
1596
|
-
inputProps,
|
|
1597
|
-
inputRef: contextRef,
|
|
1598
|
-
showTrigger,
|
|
1599
|
-
trigger
|
|
1600
|
-
} = React.useContext(InlineComboboxContext);
|
|
1601
|
-
const store = react.useComboboxContext();
|
|
1602
|
-
const value = store.useState("value");
|
|
1603
|
-
const ref = plateCommon.useComposedRef(propRef, contextRef);
|
|
1604
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, showTrigger && trigger, /* @__PURE__ */ React.createElement("span", { className: "relative min-h-[1lh]" }, /* @__PURE__ */ React.createElement(
|
|
1605
|
-
"span",
|
|
1606
|
-
{
|
|
1607
|
-
"aria-hidden": "true",
|
|
1608
|
-
className: "invisible overflow-hidden text-nowrap"
|
|
1609
|
-
},
|
|
1610
|
-
value || ""
|
|
1611
|
-
), /* @__PURE__ */ React.createElement(
|
|
1612
|
-
react.Combobox,
|
|
1613
|
-
{
|
|
1614
|
-
autoSelect: true,
|
|
1615
|
-
className: cn$1.cn(
|
|
1616
|
-
"absolute left-0 top-0 size-full bg-transparent outline-none",
|
|
1617
|
-
className
|
|
1618
|
-
),
|
|
1619
|
-
ref,
|
|
1620
|
-
value,
|
|
1621
|
-
...inputProps,
|
|
1622
|
-
...props
|
|
1623
|
-
}
|
|
1624
|
-
)));
|
|
1625
|
-
});
|
|
1626
|
-
InlineComboboxInput.displayName = "InlineComboboxInput";
|
|
1627
|
-
const InlineComboboxContent = ({
|
|
1628
|
-
className,
|
|
1629
|
-
...props
|
|
1630
|
-
}) => {
|
|
1631
|
-
return /* @__PURE__ */ React.createElement(react.Portal, null, /* @__PURE__ */ React.createElement(
|
|
1632
|
-
react.ComboboxPopover,
|
|
1633
|
-
{
|
|
1634
|
-
className: cn$1.cn(
|
|
1635
|
-
"z-[9999999] max-h-[288px] w-[300px] overflow-y-auto rounded-md bg-white shadow-md",
|
|
1636
|
-
className
|
|
1637
|
-
),
|
|
1638
|
-
...props
|
|
1639
|
-
}
|
|
1640
|
-
));
|
|
1641
|
-
};
|
|
1642
|
-
const comboboxItemVariants = classVarianceAuthority.cva(
|
|
1643
|
-
"relative flex h-9 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
1644
|
-
{
|
|
1645
|
-
defaultVariants: {
|
|
1646
|
-
interactive: true
|
|
1647
|
-
},
|
|
1648
|
-
variants: {
|
|
1649
|
-
interactive: {
|
|
1650
|
-
false: "",
|
|
1651
|
-
true: "cursor-pointer transition-colors hover:bg-blue-500 hover:text-black data-[active-item=true]:bg-orange-400 data-[active-item=true]:text-black"
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
);
|
|
1656
|
-
const InlineComboboxItem = ({
|
|
1657
|
-
className,
|
|
1658
|
-
keywords,
|
|
1659
|
-
onClick,
|
|
1660
|
-
...props
|
|
1661
|
-
}) => {
|
|
1662
|
-
const { value } = props;
|
|
1663
|
-
const { filter, removeInput } = React.useContext(InlineComboboxContext);
|
|
1664
|
-
const store = react.useComboboxContext();
|
|
1665
|
-
const search = filter && store.useState("value");
|
|
1666
|
-
const visible = React.useMemo(
|
|
1667
|
-
() => !filter || filter({ keywords, value }, search),
|
|
1668
|
-
[filter, value, keywords, search]
|
|
1669
|
-
);
|
|
1670
|
-
if (!visible)
|
|
1671
|
-
return null;
|
|
1672
|
-
return /* @__PURE__ */ React.createElement(
|
|
1673
|
-
react.ComboboxItem,
|
|
1674
|
-
{
|
|
1675
|
-
className: cn$1.cn(comboboxItemVariants(), className),
|
|
1676
|
-
onClick: (event) => {
|
|
1677
|
-
removeInput(true);
|
|
1678
|
-
onClick == null ? void 0 : onClick(event);
|
|
1679
|
-
},
|
|
1680
|
-
...props
|
|
1681
|
-
}
|
|
1992
|
+
viewBox: "0 0 20 20",
|
|
1993
|
+
fill: "currentColor"
|
|
1994
|
+
},
|
|
1995
|
+
/* @__PURE__ */ React.createElement(
|
|
1996
|
+
"path",
|
|
1997
|
+
{
|
|
1998
|
+
fillRule: "evenodd",
|
|
1999
|
+
d: "M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",
|
|
2000
|
+
clipRule: "evenodd"
|
|
2001
|
+
}
|
|
2002
|
+
)
|
|
1682
2003
|
);
|
|
1683
|
-
}
|
|
1684
|
-
const
|
|
2004
|
+
}
|
|
2005
|
+
const InlineComboboxContext = React.createContext(
|
|
2006
|
+
null
|
|
2007
|
+
);
|
|
2008
|
+
const defaultFilter = ({ keywords = [], value }, search) => [value, ...keywords].some((keyword) => plateCombobox.filterWords(keyword, search));
|
|
2009
|
+
const InlineCombobox = ({
|
|
1685
2010
|
children,
|
|
1686
|
-
|
|
2011
|
+
element,
|
|
2012
|
+
filter = defaultFilter,
|
|
2013
|
+
hideWhenNoValue = false,
|
|
2014
|
+
setValue: setValueProp,
|
|
2015
|
+
showTrigger = true,
|
|
2016
|
+
trigger,
|
|
2017
|
+
value: valueProp
|
|
1687
2018
|
}) => {
|
|
1688
|
-
const
|
|
1689
|
-
const
|
|
1690
|
-
const
|
|
2019
|
+
const editor = plateCommon.useEditorRef();
|
|
2020
|
+
const inputRef = React.useRef(null);
|
|
2021
|
+
const cursorState = plateCombobox.useHTMLInputCursorState(inputRef);
|
|
2022
|
+
const [valueState, setValueState] = React.useState("");
|
|
2023
|
+
const hasValueProp = valueProp !== void 0;
|
|
2024
|
+
const value = hasValueProp ? valueProp : valueState;
|
|
2025
|
+
const setValue = React.useCallback(
|
|
2026
|
+
(newValue) => {
|
|
2027
|
+
setValueProp == null ? void 0 : setValueProp(newValue);
|
|
2028
|
+
if (!hasValueProp) {
|
|
2029
|
+
setValueState(newValue);
|
|
2030
|
+
}
|
|
2031
|
+
},
|
|
2032
|
+
[setValueProp, hasValueProp]
|
|
2033
|
+
);
|
|
2034
|
+
const [insertPoint, setInsertPoint] = React.useState(null);
|
|
1691
2035
|
React.useEffect(() => {
|
|
1692
|
-
|
|
2036
|
+
const path = plateCommon.findNodePath(editor, element);
|
|
2037
|
+
if (!path)
|
|
2038
|
+
return;
|
|
2039
|
+
const point = plateCommon.getPointBefore(editor, path);
|
|
2040
|
+
if (!point)
|
|
2041
|
+
return;
|
|
2042
|
+
const pointRef = plateCommon.createPointRef(editor, point);
|
|
2043
|
+
setInsertPoint(pointRef);
|
|
1693
2044
|
return () => {
|
|
1694
|
-
|
|
2045
|
+
pointRef.unref();
|
|
1695
2046
|
};
|
|
1696
|
-
}, [
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
},
|
|
1713
|
-
value: "Heading 1"
|
|
1714
|
-
},
|
|
1715
|
-
{
|
|
1716
|
-
icon: Icons.h2,
|
|
1717
|
-
onSelect: (editor) => {
|
|
1718
|
-
plateCommon.toggleNodeType(editor, { activeType: plateHeading.ELEMENT_H2 });
|
|
1719
|
-
},
|
|
1720
|
-
value: "Heading 2"
|
|
1721
|
-
},
|
|
1722
|
-
{
|
|
1723
|
-
icon: Icons.h3,
|
|
1724
|
-
onSelect: (editor) => {
|
|
1725
|
-
plateCommon.toggleNodeType(editor, { activeType: plateHeading.ELEMENT_H3 });
|
|
1726
|
-
},
|
|
1727
|
-
value: "Heading 3"
|
|
1728
|
-
},
|
|
1729
|
-
{
|
|
1730
|
-
icon: Icons.ul,
|
|
1731
|
-
keywords: ["ul", "unordered list"],
|
|
1732
|
-
onSelect: (editor) => {
|
|
1733
|
-
plate.toggleList(editor, { type: plate.ELEMENT_UL });
|
|
1734
|
-
},
|
|
1735
|
-
value: "Bulleted list"
|
|
1736
|
-
},
|
|
1737
|
-
{
|
|
1738
|
-
icon: Icons.ol,
|
|
1739
|
-
keywords: ["ol", "ordered list"],
|
|
1740
|
-
onSelect: (editor) => {
|
|
1741
|
-
plate.toggleList(editor, { type: plate.ELEMENT_OL });
|
|
2047
|
+
}, [editor, element]);
|
|
2048
|
+
const { props: inputProps, removeInput } = plateCombobox.useComboboxInput({
|
|
2049
|
+
cancelInputOnBlur: false,
|
|
2050
|
+
cursorState,
|
|
2051
|
+
onCancelInput: (cause) => {
|
|
2052
|
+
if (cause !== "backspace") {
|
|
2053
|
+
plateCommon.insertText(editor, trigger + value, {
|
|
2054
|
+
at: (insertPoint == null ? void 0 : insertPoint.current) ?? void 0
|
|
2055
|
+
});
|
|
2056
|
+
}
|
|
2057
|
+
if (cause === "arrowLeft" || cause === "arrowRight") {
|
|
2058
|
+
plateCommon.moveSelection(editor, {
|
|
2059
|
+
distance: 1,
|
|
2060
|
+
reverse: cause === "arrowLeft"
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
1742
2063
|
},
|
|
1743
|
-
|
|
1744
|
-
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
variants: {
|
|
1774
|
-
variant: {
|
|
1775
|
-
ol: "list-decimal",
|
|
1776
|
-
ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
});
|
|
1780
|
-
const ListElementVariants = cn$1.withVariants(plateCommon.PlateElement, listVariants, [
|
|
1781
|
-
"variant"
|
|
1782
|
-
]);
|
|
1783
|
-
const ListElement = cn$1.withRef(
|
|
1784
|
-
({ children, variant = "ul", ...props }, ref) => {
|
|
1785
|
-
const Component = variant;
|
|
1786
|
-
return /* @__PURE__ */ React.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React.createElement(Component, null, children));
|
|
1787
|
-
}
|
|
1788
|
-
);
|
|
1789
|
-
const BlockquoteElement = cn$1.withRef(
|
|
1790
|
-
({ children, className, ...props }, ref) => {
|
|
1791
|
-
return /* @__PURE__ */ React.createElement(
|
|
1792
|
-
plateCommon.PlateElement,
|
|
1793
|
-
{
|
|
1794
|
-
asChild: true,
|
|
1795
|
-
className: cn$1.cn("my-1 border-l-2 pl-6 italic", className),
|
|
1796
|
-
ref,
|
|
1797
|
-
...props
|
|
1798
|
-
},
|
|
1799
|
-
/* @__PURE__ */ React.createElement("blockquote", null, children)
|
|
1800
|
-
);
|
|
1801
|
-
}
|
|
1802
|
-
);
|
|
1803
|
-
const CodeLeaf = cn$1.withRef(
|
|
1804
|
-
({ children, className, ...props }, ref) => {
|
|
1805
|
-
return /* @__PURE__ */ React.createElement(
|
|
1806
|
-
plateCommon.PlateLeaf,
|
|
1807
|
-
{
|
|
1808
|
-
asChild: true,
|
|
1809
|
-
className: cn$1.cn(
|
|
1810
|
-
"whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
|
|
1811
|
-
className
|
|
1812
|
-
),
|
|
1813
|
-
ref,
|
|
1814
|
-
...props
|
|
1815
|
-
},
|
|
1816
|
-
/* @__PURE__ */ React.createElement("code", null, children)
|
|
1817
|
-
);
|
|
1818
|
-
}
|
|
1819
|
-
);
|
|
1820
|
-
const CodeLineElement = cn$1.withRef((props, ref) => /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { ref, ...props }));
|
|
1821
|
-
const CodeSyntaxLeaf = cn$1.withRef(
|
|
1822
|
-
({ children, ...props }, ref) => {
|
|
1823
|
-
const { leaf } = props;
|
|
1824
|
-
const { tokenProps } = plateCodeBlock.useCodeSyntaxLeaf({ leaf });
|
|
1825
|
-
return /* @__PURE__ */ React.createElement(plateCommon.PlateLeaf, { ref, ...props }, /* @__PURE__ */ React.createElement("span", { ...tokenProps }, children));
|
|
1826
|
-
}
|
|
1827
|
-
);
|
|
1828
|
-
function ChevronDownIcon(props, svgRef) {
|
|
1829
|
-
return /* @__PURE__ */ React__namespace.createElement("svg", Object.assign({
|
|
1830
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1831
|
-
viewBox: "0 0 20 20",
|
|
1832
|
-
fill: "currentColor",
|
|
1833
|
-
"aria-hidden": "true",
|
|
1834
|
-
ref: svgRef
|
|
1835
|
-
}, props), /* @__PURE__ */ React__namespace.createElement("path", {
|
|
1836
|
-
fillRule: "evenodd",
|
|
1837
|
-
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",
|
|
1838
|
-
clipRule: "evenodd"
|
|
1839
|
-
}));
|
|
1840
|
-
}
|
|
1841
|
-
const ForwardRef = React__namespace.forwardRef(ChevronDownIcon);
|
|
1842
|
-
const ChevronDownIcon$1 = ForwardRef;
|
|
1843
|
-
const Autocomplete = ({
|
|
1844
|
-
value,
|
|
1845
|
-
onChange,
|
|
1846
|
-
defaultQuery,
|
|
1847
|
-
items: items2
|
|
1848
|
-
}) => {
|
|
1849
|
-
const [query, setQuery] = React.useState(defaultQuery ?? "");
|
|
1850
|
-
const filteredItems = React.useMemo(() => {
|
|
1851
|
-
try {
|
|
1852
|
-
const reFilter = new RegExp(query, "i");
|
|
1853
|
-
const _items = items2.filter((item) => reFilter.test(item.label));
|
|
1854
|
-
if (_items.length === 0)
|
|
1855
|
-
return items2;
|
|
1856
|
-
return _items;
|
|
1857
|
-
} catch (err) {
|
|
1858
|
-
return items2;
|
|
2064
|
+
ref: inputRef
|
|
2065
|
+
});
|
|
2066
|
+
const [hasEmpty, setHasEmpty] = React.useState(false);
|
|
2067
|
+
const contextValue = React.useMemo(
|
|
2068
|
+
() => ({
|
|
2069
|
+
filter,
|
|
2070
|
+
inputProps,
|
|
2071
|
+
inputRef,
|
|
2072
|
+
removeInput,
|
|
2073
|
+
setHasEmpty,
|
|
2074
|
+
showTrigger,
|
|
2075
|
+
trigger
|
|
2076
|
+
}),
|
|
2077
|
+
[
|
|
2078
|
+
trigger,
|
|
2079
|
+
showTrigger,
|
|
2080
|
+
filter,
|
|
2081
|
+
inputRef,
|
|
2082
|
+
inputProps,
|
|
2083
|
+
removeInput,
|
|
2084
|
+
setHasEmpty
|
|
2085
|
+
]
|
|
2086
|
+
);
|
|
2087
|
+
const store = react$1.useComboboxStore({
|
|
2088
|
+
setValue: (newValue) => React.startTransition(() => setValue(newValue))
|
|
2089
|
+
});
|
|
2090
|
+
const items2 = store.useState("items");
|
|
2091
|
+
React.useEffect(() => {
|
|
2092
|
+
if (!store.getState().activeId) {
|
|
2093
|
+
store.setActiveId(store.first());
|
|
1859
2094
|
}
|
|
1860
|
-
}, [items2,
|
|
1861
|
-
return /* @__PURE__ */ React.createElement(
|
|
1862
|
-
react$1.
|
|
2095
|
+
}, [items2, store]);
|
|
2096
|
+
return /* @__PURE__ */ React.createElement("span", { contentEditable: false }, /* @__PURE__ */ React.createElement(
|
|
2097
|
+
react$1.ComboboxProvider,
|
|
1863
2098
|
{
|
|
1864
|
-
value,
|
|
1865
|
-
|
|
1866
|
-
as: "div",
|
|
1867
|
-
className: "relative inline-block text-left z-20"
|
|
2099
|
+
open: (items2.length > 0 || hasEmpty) && (!hideWhenNoValue || value.length > 0),
|
|
2100
|
+
store
|
|
1868
2101
|
},
|
|
1869
|
-
/* @__PURE__ */ React.createElement(
|
|
1870
|
-
|
|
1871
|
-
{
|
|
1872
|
-
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",
|
|
1873
|
-
displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
|
|
1874
|
-
onChange: (event) => setQuery(event.target.value),
|
|
1875
|
-
onClick: (ev) => ev.stopPropagation()
|
|
1876
|
-
}
|
|
1877
|
-
), /* @__PURE__ */ React.createElement(react$1.ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React.createElement(
|
|
1878
|
-
ChevronDownIcon$1,
|
|
1879
|
-
{
|
|
1880
|
-
className: "h-5 w-5 text-gray-400",
|
|
1881
|
-
"aria-hidden": "true"
|
|
1882
|
-
}
|
|
1883
|
-
)))),
|
|
1884
|
-
/* @__PURE__ */ React.createElement(
|
|
1885
|
-
react$1.Transition,
|
|
1886
|
-
{
|
|
1887
|
-
enter: "transition ease-out duration-100",
|
|
1888
|
-
enterFrom: "transform opacity-0 scale-95",
|
|
1889
|
-
enterTo: "transform opacity-100 scale-100",
|
|
1890
|
-
leave: "transition ease-in duration-75",
|
|
1891
|
-
leaveFrom: "transform opacity-100 scale-100",
|
|
1892
|
-
leaveTo: "transform opacity-0 scale-95"
|
|
1893
|
-
},
|
|
1894
|
-
/* @__PURE__ */ React.createElement(react$1.ComboboxOptions, { className: "origin-top-right absolute right-0 mt-1 w-full max-h-[300px] overflow-y-auto rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, filteredItems.map((item) => /* @__PURE__ */ React.createElement(react$1.ComboboxOption, { key: item.key, value: item }, ({ focus }) => /* @__PURE__ */ React.createElement(
|
|
1895
|
-
"button",
|
|
1896
|
-
{
|
|
1897
|
-
className: classNames$1(
|
|
1898
|
-
focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
|
|
1899
|
-
"block px-4 py-2 text-xs w-full text-right"
|
|
1900
|
-
)
|
|
1901
|
-
},
|
|
1902
|
-
item.render(item)
|
|
1903
|
-
))))
|
|
1904
|
-
)
|
|
1905
|
-
);
|
|
2102
|
+
/* @__PURE__ */ React.createElement(InlineComboboxContext.Provider, { value: contextValue }, children)
|
|
2103
|
+
));
|
|
1906
2104
|
};
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
2105
|
+
const InlineComboboxInput = React.forwardRef(({ className, ...props }, propRef) => {
|
|
2106
|
+
const {
|
|
2107
|
+
inputProps,
|
|
2108
|
+
inputRef: contextRef,
|
|
2109
|
+
showTrigger,
|
|
2110
|
+
trigger
|
|
2111
|
+
} = React.useContext(InlineComboboxContext);
|
|
2112
|
+
const store = react$1.useComboboxContext();
|
|
2113
|
+
const value = store.useState("value");
|
|
2114
|
+
const ref = plateCommon.useComposedRef(propRef, contextRef);
|
|
2115
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, showTrigger && trigger, /* @__PURE__ */ React.createElement("span", { className: "relative min-h-[1lh]" }, /* @__PURE__ */ React.createElement(
|
|
2116
|
+
"span",
|
|
2117
|
+
{
|
|
2118
|
+
"aria-hidden": "true",
|
|
2119
|
+
className: "invisible overflow-hidden text-nowrap"
|
|
2120
|
+
},
|
|
2121
|
+
value || ""
|
|
2122
|
+
), /* @__PURE__ */ React.createElement(
|
|
2123
|
+
react$1.Combobox,
|
|
2124
|
+
{
|
|
2125
|
+
autoSelect: true,
|
|
2126
|
+
className: cn$1.cn(
|
|
2127
|
+
"absolute left-0 top-0 size-full bg-transparent outline-none",
|
|
2128
|
+
className
|
|
2129
|
+
),
|
|
2130
|
+
ref,
|
|
2131
|
+
value,
|
|
2132
|
+
...inputProps,
|
|
2133
|
+
...props
|
|
1920
2134
|
}
|
|
1921
|
-
|
|
1922
|
-
};
|
|
1923
|
-
|
|
1924
|
-
const
|
|
1925
|
-
|
|
1926
|
-
editor,
|
|
1927
|
-
element,
|
|
1928
|
-
language: restrictLanguage,
|
|
1929
|
-
onChangeCallback,
|
|
1930
|
-
defaultValue,
|
|
2135
|
+
)));
|
|
2136
|
+
});
|
|
2137
|
+
InlineComboboxInput.displayName = "InlineComboboxInput";
|
|
2138
|
+
const InlineComboboxContent = ({
|
|
2139
|
+
className,
|
|
1931
2140
|
...props
|
|
1932
2141
|
}) => {
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
}
|
|
1942
|
-
}, [selected, monacoEditorRef.current]);
|
|
1943
|
-
const value = element.value || "";
|
|
1944
|
-
if (typeof value !== "string") {
|
|
1945
|
-
throw new Error("Element must be of type string for code block");
|
|
1946
|
-
}
|
|
1947
|
-
const language = restrictLanguage || element.lang;
|
|
1948
|
-
const id = React.useMemo(() => uuid(), []);
|
|
1949
|
-
const languages = React.useMemo(() => {
|
|
1950
|
-
const defaultLangSet = { "": "plain text" };
|
|
1951
|
-
if (!monaco)
|
|
1952
|
-
return defaultLangSet;
|
|
1953
|
-
return monaco.languages.getLanguages().reduce((ac, cv) => {
|
|
1954
|
-
if (cv.id === "plaintext")
|
|
1955
|
-
return ac;
|
|
1956
|
-
return { ...ac, [cv.id]: cv.id };
|
|
1957
|
-
}, defaultLangSet);
|
|
1958
|
-
}, [monaco]);
|
|
1959
|
-
React.useEffect(() => {
|
|
1960
|
-
if (monaco) {
|
|
1961
|
-
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
1962
|
-
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
1963
|
-
// disable errors
|
|
1964
|
-
noSemanticValidation: true,
|
|
1965
|
-
noSyntaxValidation: true
|
|
1966
|
-
});
|
|
1967
|
-
}
|
|
1968
|
-
}, [monaco]);
|
|
1969
|
-
const items2 = Object.entries(languages).map(([key, label]) => ({
|
|
1970
|
-
key,
|
|
1971
|
-
label,
|
|
1972
|
-
render: (item) => item.label
|
|
1973
|
-
}));
|
|
1974
|
-
const currentItem = React.useMemo(() => {
|
|
1975
|
-
return items2.find((item) => item.key === language) ?? {
|
|
1976
|
-
key: "",
|
|
1977
|
-
label: "Plain Text"
|
|
1978
|
-
};
|
|
1979
|
-
}, [items2, language]);
|
|
1980
|
-
React.useEffect(() => {
|
|
1981
|
-
if (navigateAway) {
|
|
1982
|
-
setNavigateAway(null);
|
|
1983
|
-
switch (navigateAway) {
|
|
1984
|
-
case "remove":
|
|
1985
|
-
{
|
|
1986
|
-
plateCommon.focusEditor(editor);
|
|
1987
|
-
plateCommon.setNodes(
|
|
1988
|
-
editor,
|
|
1989
|
-
{
|
|
1990
|
-
type: "p",
|
|
1991
|
-
children: [{ text: "" }],
|
|
1992
|
-
lang: void 0,
|
|
1993
|
-
value: void 0
|
|
1994
|
-
},
|
|
1995
|
-
{
|
|
1996
|
-
match: (n) => {
|
|
1997
|
-
if (plateCommon.isElement(n) && n.type === element.type) {
|
|
1998
|
-
return true;
|
|
1999
|
-
}
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
);
|
|
2003
|
-
}
|
|
2004
|
-
break;
|
|
2005
|
-
case "insertNext":
|
|
2006
|
-
{
|
|
2007
|
-
plateCommon.insertNodes(
|
|
2008
|
-
editor,
|
|
2009
|
-
[
|
|
2010
|
-
{
|
|
2011
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
2012
|
-
children: [{ text: "" }],
|
|
2013
|
-
lang: void 0,
|
|
2014
|
-
value: void 0
|
|
2015
|
-
}
|
|
2016
|
-
],
|
|
2017
|
-
{ select: true }
|
|
2018
|
-
);
|
|
2019
|
-
plateCommon.focusEditor(editor);
|
|
2020
|
-
}
|
|
2021
|
-
break;
|
|
2022
|
-
case "up":
|
|
2023
|
-
{
|
|
2024
|
-
const path = plateCommon.findNodePath(editor, element);
|
|
2025
|
-
if (!path) {
|
|
2026
|
-
return;
|
|
2027
|
-
}
|
|
2028
|
-
const previousNodePath = plateCommon.getPointBefore(editor, path);
|
|
2029
|
-
if (!previousNodePath) {
|
|
2030
|
-
plateCommon.focusEditor(editor);
|
|
2031
|
-
plateCommon.insertNodes(
|
|
2032
|
-
editor,
|
|
2033
|
-
[
|
|
2034
|
-
{
|
|
2035
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
2036
|
-
children: [{ text: "" }],
|
|
2037
|
-
lang: void 0,
|
|
2038
|
-
value: void 0
|
|
2039
|
-
}
|
|
2040
|
-
],
|
|
2041
|
-
// Insert a new node at the current path, resulting in the code_block
|
|
2042
|
-
// moving down one block
|
|
2043
|
-
{ at: path, select: true }
|
|
2044
|
-
);
|
|
2045
|
-
return;
|
|
2046
|
-
}
|
|
2047
|
-
plateCommon.focusEditor(editor, previousNodePath);
|
|
2048
|
-
}
|
|
2049
|
-
break;
|
|
2050
|
-
case "down": {
|
|
2051
|
-
const path = plateCommon.findNodePath(editor, element);
|
|
2052
|
-
if (!path) {
|
|
2053
|
-
return;
|
|
2054
|
-
}
|
|
2055
|
-
const nextNodePath = plateCommon.getPointAfter(editor, path);
|
|
2056
|
-
if (!nextNodePath) {
|
|
2057
|
-
plateCommon.insertNodes(
|
|
2058
|
-
editor,
|
|
2059
|
-
[
|
|
2060
|
-
{
|
|
2061
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
2062
|
-
children: [{ text: "" }],
|
|
2063
|
-
lang: void 0,
|
|
2064
|
-
value: void 0
|
|
2065
|
-
}
|
|
2066
|
-
],
|
|
2067
|
-
{ select: true }
|
|
2068
|
-
);
|
|
2069
|
-
plateCommon.focusEditor(editor);
|
|
2070
|
-
} else {
|
|
2071
|
-
plateCommon.focusEditor(editor, nextNodePath);
|
|
2072
|
-
}
|
|
2073
|
-
break;
|
|
2074
|
-
}
|
|
2075
|
-
}
|
|
2142
|
+
return /* @__PURE__ */ React.createElement(react$1.Portal, null, /* @__PURE__ */ React.createElement(
|
|
2143
|
+
react$1.ComboboxPopover,
|
|
2144
|
+
{
|
|
2145
|
+
className: cn$1.cn(
|
|
2146
|
+
"z-[9999999] max-h-[288px] w-[300px] overflow-y-auto rounded-md bg-white shadow-md",
|
|
2147
|
+
className
|
|
2148
|
+
),
|
|
2149
|
+
...props
|
|
2076
2150
|
}
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
setNavigateAway("insertNext");
|
|
2090
|
-
}
|
|
2091
|
-
});
|
|
2092
|
-
monacoEditor.onKeyDown((l) => {
|
|
2093
|
-
if (l.code === "ArrowUp") {
|
|
2094
|
-
const selection = monacoEditor.getSelection();
|
|
2095
|
-
if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
|
|
2096
|
-
setNavigateAway("up");
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
|
-
if (l.code === "ArrowDown") {
|
|
2100
|
-
const selection = monacoEditor.getSelection();
|
|
2101
|
-
const totalLines = monacoEditor.getModel().getLineCount();
|
|
2102
|
-
if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
|
|
2103
|
-
setNavigateAway("down");
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
if (l.code === "Backspace") {
|
|
2107
|
-
const selection = monacoEditor.getSelection();
|
|
2108
|
-
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) {
|
|
2109
|
-
setNavigateAway("remove");
|
|
2110
|
-
}
|
|
2151
|
+
));
|
|
2152
|
+
};
|
|
2153
|
+
const comboboxItemVariants = classVarianceAuthority.cva(
|
|
2154
|
+
"relative flex h-9 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
2155
|
+
{
|
|
2156
|
+
defaultVariants: {
|
|
2157
|
+
interactive: true
|
|
2158
|
+
},
|
|
2159
|
+
variants: {
|
|
2160
|
+
interactive: {
|
|
2161
|
+
false: "",
|
|
2162
|
+
true: "cursor-pointer transition-colors hover:bg-blue-500 hover:text-black data-[active-item=true]:bg-orange-400 data-[active-item=true]:text-black"
|
|
2111
2163
|
}
|
|
2112
|
-
}
|
|
2164
|
+
}
|
|
2113
2165
|
}
|
|
2166
|
+
);
|
|
2167
|
+
const InlineComboboxItem = ({
|
|
2168
|
+
className,
|
|
2169
|
+
keywords,
|
|
2170
|
+
onClick,
|
|
2171
|
+
...props
|
|
2172
|
+
}) => {
|
|
2173
|
+
const { value } = props;
|
|
2174
|
+
const { filter, removeInput } = React.useContext(InlineComboboxContext);
|
|
2175
|
+
const store = react$1.useComboboxContext();
|
|
2176
|
+
const search = filter && store.useState("value");
|
|
2177
|
+
const visible = React.useMemo(
|
|
2178
|
+
() => !filter || filter({ keywords, value }, search),
|
|
2179
|
+
[filter, value, keywords, search]
|
|
2180
|
+
);
|
|
2181
|
+
if (!visible)
|
|
2182
|
+
return null;
|
|
2183
|
+
return /* @__PURE__ */ React.createElement(
|
|
2184
|
+
react$1.ComboboxItem,
|
|
2185
|
+
{
|
|
2186
|
+
className: cn$1.cn(comboboxItemVariants(), className),
|
|
2187
|
+
onClick: (event) => {
|
|
2188
|
+
removeInput(true);
|
|
2189
|
+
onClick == null ? void 0 : onClick(event);
|
|
2190
|
+
},
|
|
2191
|
+
...props
|
|
2192
|
+
}
|
|
2193
|
+
);
|
|
2194
|
+
};
|
|
2195
|
+
const InlineComboboxEmpty = ({
|
|
2196
|
+
children,
|
|
2197
|
+
className
|
|
2198
|
+
}) => {
|
|
2199
|
+
const { setHasEmpty } = React.useContext(InlineComboboxContext);
|
|
2200
|
+
const store = react$1.useComboboxContext();
|
|
2201
|
+
const items2 = store.useState("items");
|
|
2202
|
+
React.useEffect(() => {
|
|
2203
|
+
setHasEmpty(true);
|
|
2204
|
+
return () => {
|
|
2205
|
+
setHasEmpty(false);
|
|
2206
|
+
};
|
|
2207
|
+
}, [setHasEmpty]);
|
|
2208
|
+
if (items2.length > 0)
|
|
2209
|
+
return null;
|
|
2114
2210
|
return /* @__PURE__ */ React.createElement(
|
|
2115
2211
|
"div",
|
|
2116
2212
|
{
|
|
2117
|
-
|
|
2118
|
-
className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
|
|
2213
|
+
className: cn$1.cn(comboboxItemVariants({ interactive: false }), className)
|
|
2119
2214
|
},
|
|
2120
|
-
|
|
2121
|
-
display: none !important;
|
|
2122
|
-
visibility: hidden !important;
|
|
2123
|
-
}`),
|
|
2124
|
-
props.children,
|
|
2125
|
-
/* @__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(
|
|
2126
|
-
Autocomplete,
|
|
2127
|
-
{
|
|
2128
|
-
items: items2,
|
|
2129
|
-
value: currentItem,
|
|
2130
|
-
defaultQuery: "plaintext",
|
|
2131
|
-
onChange: (item) => plateCommon.setNodes(editor, { lang: item.key })
|
|
2132
|
-
}
|
|
2133
|
-
)), /* @__PURE__ */ React.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React.createElement(
|
|
2134
|
-
MonacoEditor,
|
|
2135
|
-
{
|
|
2136
|
-
path: id,
|
|
2137
|
-
onMount: handleEditorDidMount,
|
|
2138
|
-
options: {
|
|
2139
|
-
scrollBeyondLastLine: false,
|
|
2140
|
-
// automaticLayout: true,
|
|
2141
|
-
tabSize: 2,
|
|
2142
|
-
disableLayerHinting: true,
|
|
2143
|
-
accessibilitySupport: "off",
|
|
2144
|
-
codeLens: false,
|
|
2145
|
-
wordWrap: "on",
|
|
2146
|
-
minimap: {
|
|
2147
|
-
enabled: false
|
|
2148
|
-
},
|
|
2149
|
-
fontSize: 14,
|
|
2150
|
-
lineHeight: 2,
|
|
2151
|
-
formatOnPaste: true,
|
|
2152
|
-
lineNumbers: "off",
|
|
2153
|
-
formatOnType: true,
|
|
2154
|
-
fixedOverflowWidgets: true,
|
|
2155
|
-
// Takes too much horizontal space for iframe
|
|
2156
|
-
folding: false,
|
|
2157
|
-
renderLineHighlight: "none",
|
|
2158
|
-
scrollbar: {
|
|
2159
|
-
verticalScrollbarSize: 1,
|
|
2160
|
-
horizontalScrollbarSize: 1,
|
|
2161
|
-
// https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
|
|
2162
|
-
alwaysConsumeMouseWheel: false
|
|
2163
|
-
}
|
|
2164
|
-
},
|
|
2165
|
-
language: String(language),
|
|
2166
|
-
value: String(element.value),
|
|
2167
|
-
onChange: (value2) => {
|
|
2168
|
-
onChangeCallback == null ? void 0 : onChangeCallback(value2);
|
|
2169
|
-
plateCommon.setNodes(editor, { value: value2, lang: language });
|
|
2170
|
-
}
|
|
2171
|
-
}
|
|
2172
|
-
)))
|
|
2215
|
+
children
|
|
2173
2216
|
);
|
|
2174
2217
|
};
|
|
2175
|
-
const
|
|
2218
|
+
const rules = [
|
|
2219
|
+
{
|
|
2220
|
+
icon: Icons.h1,
|
|
2221
|
+
onSelect: (editor) => {
|
|
2222
|
+
plateCommon.toggleNodeType(editor, { activeType: plateHeading.ELEMENT_H1 });
|
|
2223
|
+
},
|
|
2224
|
+
value: "Heading 1"
|
|
2225
|
+
},
|
|
2226
|
+
{
|
|
2227
|
+
icon: Icons.h2,
|
|
2228
|
+
onSelect: (editor) => {
|
|
2229
|
+
plateCommon.toggleNodeType(editor, { activeType: plateHeading.ELEMENT_H2 });
|
|
2230
|
+
},
|
|
2231
|
+
value: "Heading 2"
|
|
2232
|
+
},
|
|
2233
|
+
{
|
|
2234
|
+
icon: Icons.h3,
|
|
2235
|
+
onSelect: (editor) => {
|
|
2236
|
+
plateCommon.toggleNodeType(editor, { activeType: plateHeading.ELEMENT_H3 });
|
|
2237
|
+
},
|
|
2238
|
+
value: "Heading 3"
|
|
2239
|
+
},
|
|
2240
|
+
{
|
|
2241
|
+
icon: Icons.ul,
|
|
2242
|
+
keywords: ["ul", "unordered list"],
|
|
2243
|
+
onSelect: (editor) => {
|
|
2244
|
+
plate.toggleList(editor, { type: plate.ELEMENT_UL });
|
|
2245
|
+
},
|
|
2246
|
+
value: "Bulleted list"
|
|
2247
|
+
},
|
|
2248
|
+
{
|
|
2249
|
+
icon: Icons.ol,
|
|
2250
|
+
keywords: ["ol", "ordered list"],
|
|
2251
|
+
onSelect: (editor) => {
|
|
2252
|
+
plate.toggleList(editor, { type: plate.ELEMENT_OL });
|
|
2253
|
+
},
|
|
2254
|
+
value: "Numbered list"
|
|
2255
|
+
}
|
|
2256
|
+
];
|
|
2257
|
+
const SlashInputElement = cn$1.withRef(
|
|
2176
2258
|
({ className, ...props }, ref) => {
|
|
2177
|
-
const { element } = props;
|
|
2178
|
-
const state = plateCodeBlock.useCodeBlockElementState({ element });
|
|
2259
|
+
const { children, editor, element } = props;
|
|
2179
2260
|
return /* @__PURE__ */ React.createElement(
|
|
2180
2261
|
plateCommon.PlateElement,
|
|
2181
2262
|
{
|
|
2182
|
-
|
|
2263
|
+
as: "span",
|
|
2264
|
+
"data-slate-value": element.value,
|
|
2183
2265
|
ref,
|
|
2184
2266
|
...props
|
|
2185
2267
|
},
|
|
2186
|
-
/* @__PURE__ */ React.createElement(
|
|
2187
|
-
|
|
2268
|
+
/* @__PURE__ */ React.createElement(InlineCombobox, { element, trigger: "/" }, /* @__PURE__ */ React.createElement(InlineComboboxInput, null), /* @__PURE__ */ React.createElement(InlineComboboxContent, null, /* @__PURE__ */ React.createElement(InlineComboboxEmpty, null, "No matching commands found"), rules.map(({ icon: Icon, keywords, onSelect, value }) => /* @__PURE__ */ React.createElement(
|
|
2269
|
+
InlineComboboxItem,
|
|
2270
|
+
{
|
|
2271
|
+
key: value,
|
|
2272
|
+
keywords,
|
|
2273
|
+
onClick: () => onSelect(editor),
|
|
2274
|
+
value
|
|
2275
|
+
},
|
|
2276
|
+
/* @__PURE__ */ React.createElement(Icon, { "aria-hidden": true, className: "mr-2 size-4" }),
|
|
2277
|
+
value
|
|
2278
|
+
)))),
|
|
2279
|
+
children
|
|
2280
|
+
);
|
|
2281
|
+
}
|
|
2282
|
+
);
|
|
2283
|
+
const TableCellElement = cn$1.withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
|
|
2284
|
+
var _a, _b, _c, _d;
|
|
2285
|
+
const { element } = props;
|
|
2286
|
+
const {
|
|
2287
|
+
borders,
|
|
2288
|
+
colIndex,
|
|
2289
|
+
colSpan,
|
|
2290
|
+
hovered,
|
|
2291
|
+
hoveredLeft,
|
|
2292
|
+
isSelectingCell,
|
|
2293
|
+
readOnly,
|
|
2294
|
+
rowIndex,
|
|
2295
|
+
rowSize,
|
|
2296
|
+
selected
|
|
2297
|
+
} = plateTable.useTableCellElementState();
|
|
2298
|
+
const { props: cellProps } = plateTable.useTableCellElement({ element: props.element });
|
|
2299
|
+
const resizableState = plateTable.useTableCellElementResizableState({
|
|
2300
|
+
colIndex,
|
|
2301
|
+
colSpan,
|
|
2302
|
+
rowIndex
|
|
2303
|
+
});
|
|
2304
|
+
const { bottomProps, hiddenLeft, leftProps, rightProps } = plateTable.useTableCellElementResizable(resizableState);
|
|
2305
|
+
const Cell = isHeader ? "th" : "td";
|
|
2306
|
+
return /* @__PURE__ */ React.createElement(
|
|
2307
|
+
plateCommon.PlateElement,
|
|
2308
|
+
{
|
|
2309
|
+
asChild: true,
|
|
2310
|
+
className: cn$1.cn(
|
|
2311
|
+
"relative h-full overflow-visible border-none bg-background p-0",
|
|
2312
|
+
hideBorder && "before:border-none",
|
|
2313
|
+
element.background ? "bg-[--cellBackground]" : "bg-background",
|
|
2314
|
+
!hideBorder && cn$1.cn(
|
|
2315
|
+
isHeader && "text-left [&_>_*]:m-0",
|
|
2316
|
+
"before:size-full",
|
|
2317
|
+
selected && "before:z-10 before:bg-muted",
|
|
2318
|
+
"before:absolute before:box-border before:select-none before:content-['']",
|
|
2319
|
+
borders && cn$1.cn(
|
|
2320
|
+
((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
|
|
2321
|
+
((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
|
|
2322
|
+
((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
|
|
2323
|
+
((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
|
|
2324
|
+
)
|
|
2325
|
+
),
|
|
2326
|
+
className
|
|
2327
|
+
),
|
|
2328
|
+
ref,
|
|
2329
|
+
...cellProps,
|
|
2330
|
+
...props,
|
|
2331
|
+
style: {
|
|
2332
|
+
"--cellBackground": element.background,
|
|
2333
|
+
...style
|
|
2334
|
+
}
|
|
2335
|
+
},
|
|
2336
|
+
/* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(
|
|
2337
|
+
"div",
|
|
2338
|
+
{
|
|
2339
|
+
className: "relative z-20 box-border h-full px-3 py-2",
|
|
2340
|
+
style: {
|
|
2341
|
+
minHeight: rowSize
|
|
2342
|
+
}
|
|
2343
|
+
},
|
|
2344
|
+
children
|
|
2345
|
+
), !isSelectingCell && /* @__PURE__ */ React.createElement(
|
|
2346
|
+
"div",
|
|
2347
|
+
{
|
|
2348
|
+
className: "group absolute top-0 size-full select-none",
|
|
2349
|
+
contentEditable: false,
|
|
2350
|
+
suppressContentEditableWarning: true
|
|
2351
|
+
},
|
|
2352
|
+
!readOnly && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2353
|
+
plateResizable.ResizeHandle,
|
|
2354
|
+
{
|
|
2355
|
+
...rightProps,
|
|
2356
|
+
className: "-top-3 right-[-5px] w-[10px]"
|
|
2357
|
+
}
|
|
2358
|
+
), /* @__PURE__ */ React.createElement(
|
|
2359
|
+
plateResizable.ResizeHandle,
|
|
2360
|
+
{
|
|
2361
|
+
...bottomProps,
|
|
2362
|
+
className: "bottom-[-5px] h-[10px]"
|
|
2363
|
+
}
|
|
2364
|
+
), !hiddenLeft && /* @__PURE__ */ React.createElement(
|
|
2365
|
+
plateResizable.ResizeHandle,
|
|
2366
|
+
{
|
|
2367
|
+
...leftProps,
|
|
2368
|
+
className: "-top-3 left-[-5px] w-[10px]"
|
|
2369
|
+
}
|
|
2370
|
+
), hovered && /* @__PURE__ */ React.createElement(
|
|
2371
|
+
"div",
|
|
2372
|
+
{
|
|
2373
|
+
className: cn$1.cn(
|
|
2374
|
+
"absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
|
|
2375
|
+
"right-[-1.5px]"
|
|
2376
|
+
)
|
|
2377
|
+
}
|
|
2378
|
+
), hoveredLeft && /* @__PURE__ */ React.createElement(
|
|
2379
|
+
"div",
|
|
2380
|
+
{
|
|
2381
|
+
className: cn$1.cn(
|
|
2382
|
+
"absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
|
|
2383
|
+
"left-[-1.5px]"
|
|
2384
|
+
)
|
|
2385
|
+
}
|
|
2386
|
+
))
|
|
2387
|
+
))
|
|
2388
|
+
);
|
|
2389
|
+
});
|
|
2390
|
+
TableCellElement.displayName = "TableCellElement";
|
|
2391
|
+
const TableCellHeaderElement = cn$1.withProps(TableCellElement, {
|
|
2392
|
+
isHeader: true
|
|
2393
|
+
});
|
|
2394
|
+
const buttonVariants$1 = classVarianceAuthority.cva(
|
|
2395
|
+
"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",
|
|
2396
|
+
{
|
|
2397
|
+
defaultVariants: {
|
|
2398
|
+
size: "default",
|
|
2399
|
+
variant: "default"
|
|
2400
|
+
},
|
|
2401
|
+
variants: {
|
|
2402
|
+
isMenu: {
|
|
2403
|
+
true: "h-auto w-full cursor-pointer justify-start"
|
|
2404
|
+
},
|
|
2405
|
+
size: {
|
|
2406
|
+
default: "h-10 px-4 py-2",
|
|
2407
|
+
icon: "size-10",
|
|
2408
|
+
lg: "h-11 rounded-md px-8",
|
|
2409
|
+
none: "",
|
|
2410
|
+
sm: "h-9 rounded-md px-3",
|
|
2411
|
+
sms: "size-9 rounded-md px-0",
|
|
2412
|
+
xs: "h-8 rounded-md px-3"
|
|
2413
|
+
},
|
|
2414
|
+
variant: {
|
|
2415
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
2416
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
2417
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
2418
|
+
inlineLink: "text-base text-primary underline underline-offset-4",
|
|
2419
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
2420
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
2421
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2188
2424
|
}
|
|
2189
2425
|
);
|
|
2190
|
-
const
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2426
|
+
const Button$2 = cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
|
|
2427
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
2428
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
2429
|
+
Comp,
|
|
2430
|
+
{
|
|
2431
|
+
className: cn$1.cn(buttonVariants$1({ className, isMenu, size, variant })),
|
|
2432
|
+
ref,
|
|
2433
|
+
...props
|
|
2434
|
+
}
|
|
2435
|
+
);
|
|
2196
2436
|
});
|
|
2197
|
-
const
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2437
|
+
const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
2438
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
2439
|
+
const DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
|
|
2440
|
+
const DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
|
|
2441
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
2442
|
+
const DropdownMenuSubTrigger = cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2443
|
+
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
2444
|
+
{
|
|
2445
|
+
className: cn$1.cn(
|
|
2446
|
+
"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",
|
|
2447
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2448
|
+
inset && "pl-8",
|
|
2449
|
+
className
|
|
2450
|
+
),
|
|
2451
|
+
ref,
|
|
2452
|
+
...props
|
|
2453
|
+
},
|
|
2454
|
+
children,
|
|
2455
|
+
/* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
|
|
2456
|
+
));
|
|
2457
|
+
const DropdownMenuSubContent = cn$1.withCn(
|
|
2458
|
+
DropdownMenuPrimitive__namespace.SubContent,
|
|
2459
|
+
"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"
|
|
2460
|
+
);
|
|
2461
|
+
const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
|
|
2462
|
+
className: cn$1.cn(
|
|
2463
|
+
"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"
|
|
2464
|
+
),
|
|
2465
|
+
sideOffset: 4
|
|
2466
|
+
});
|
|
2467
|
+
const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
|
|
2468
|
+
const menuItemVariants = classVarianceAuthority.cva(
|
|
2469
|
+
cn$1.cn(
|
|
2470
|
+
"relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
2471
|
+
"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
2472
|
+
),
|
|
2473
|
+
{
|
|
2474
|
+
variants: {
|
|
2475
|
+
inset: {
|
|
2476
|
+
true: "pl-8"
|
|
2477
|
+
}
|
|
2203
2478
|
}
|
|
2204
|
-
}
|
|
2479
|
+
}
|
|
2480
|
+
);
|
|
2481
|
+
const DropdownMenuItem = cn$1.withVariants(
|
|
2482
|
+
DropdownMenuPrimitive__namespace.Item,
|
|
2483
|
+
menuItemVariants,
|
|
2484
|
+
["inset"]
|
|
2485
|
+
);
|
|
2486
|
+
const DropdownMenuCheckboxItem = cn$1.withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2487
|
+
DropdownMenuPrimitive__namespace.CheckboxItem,
|
|
2488
|
+
{
|
|
2489
|
+
className: cn$1.cn(
|
|
2490
|
+
"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",
|
|
2491
|
+
"cursor-pointer",
|
|
2492
|
+
className
|
|
2493
|
+
),
|
|
2494
|
+
ref,
|
|
2495
|
+
...props
|
|
2496
|
+
},
|
|
2497
|
+
/* @__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" }))),
|
|
2498
|
+
children
|
|
2499
|
+
));
|
|
2500
|
+
const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
2501
|
+
DropdownMenuPrimitive__namespace.RadioItem,
|
|
2502
|
+
{
|
|
2503
|
+
className: cn$1.cn(
|
|
2504
|
+
"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",
|
|
2505
|
+
"h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
|
|
2506
|
+
className
|
|
2507
|
+
),
|
|
2508
|
+
ref,
|
|
2509
|
+
...props
|
|
2510
|
+
},
|
|
2511
|
+
!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" }))),
|
|
2512
|
+
children
|
|
2513
|
+
));
|
|
2514
|
+
const dropdownMenuLabelVariants = classVarianceAuthority.cva(
|
|
2515
|
+
cn$1.cn("select-none px-2 py-1.5 text-sm font-semibold"),
|
|
2516
|
+
{
|
|
2517
|
+
variants: {
|
|
2518
|
+
inset: {
|
|
2519
|
+
true: "pl-8"
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
);
|
|
2524
|
+
const DropdownMenuLabel = cn$1.withVariants(
|
|
2525
|
+
DropdownMenuPrimitive__namespace.Label,
|
|
2526
|
+
dropdownMenuLabelVariants,
|
|
2527
|
+
["inset"]
|
|
2528
|
+
);
|
|
2529
|
+
const DropdownMenuSeparator = cn$1.withCn(
|
|
2530
|
+
DropdownMenuPrimitive__namespace.Separator,
|
|
2531
|
+
"-mx-1 my-1 h-px bg-muted"
|
|
2532
|
+
);
|
|
2533
|
+
cn$1.withCn(
|
|
2534
|
+
cn$1.createPrimitiveElement("span"),
|
|
2535
|
+
"ml-auto text-xs tracking-widest opacity-60"
|
|
2536
|
+
);
|
|
2537
|
+
const useOpenState = () => {
|
|
2538
|
+
const [open2, setOpen] = React.useState(false);
|
|
2539
|
+
const onOpenChange = React.useCallback(
|
|
2540
|
+
(_value = !open2) => {
|
|
2541
|
+
setOpen(_value);
|
|
2542
|
+
},
|
|
2543
|
+
[open2]
|
|
2544
|
+
);
|
|
2205
2545
|
return {
|
|
2206
|
-
|
|
2546
|
+
onOpenChange,
|
|
2547
|
+
open: open2
|
|
2207
2548
|
};
|
|
2208
2549
|
};
|
|
2209
|
-
const
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
}
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2550
|
+
const Popover$2 = PopoverPrimitive__namespace.Root;
|
|
2551
|
+
const popoverVariants = classVarianceAuthority.cva(
|
|
2552
|
+
"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"
|
|
2553
|
+
);
|
|
2554
|
+
const PopoverContent$1 = cn$1.withRef(
|
|
2555
|
+
({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
|
|
2556
|
+
PopoverPrimitive__namespace.Content,
|
|
2557
|
+
{
|
|
2558
|
+
align,
|
|
2559
|
+
className: cn$1.cn(popoverVariants(), className),
|
|
2560
|
+
ref,
|
|
2561
|
+
sideOffset,
|
|
2562
|
+
style: { zIndex: 1e3, ...style },
|
|
2563
|
+
...props
|
|
2219
2564
|
}
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2565
|
+
))
|
|
2566
|
+
);
|
|
2567
|
+
const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
|
|
2568
|
+
defaultVariants: {
|
|
2569
|
+
orientation: "horizontal"
|
|
2570
|
+
},
|
|
2571
|
+
variants: {
|
|
2572
|
+
orientation: {
|
|
2573
|
+
horizontal: "h-px w-full",
|
|
2574
|
+
vertical: "h-full w-px"
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
});
|
|
2578
|
+
const Separator = cn$1.withVariants(
|
|
2579
|
+
cn$1.withProps(SeparatorPrimitive__namespace.Root, {
|
|
2580
|
+
decorative: true,
|
|
2581
|
+
orientation: "horizontal"
|
|
2582
|
+
}),
|
|
2583
|
+
separatorVariants
|
|
2584
|
+
);
|
|
2585
|
+
const TableBordersDropdownMenuContent = cn$1.withRef((props, ref) => {
|
|
2586
|
+
const {
|
|
2587
|
+
getOnSelectTableBorder,
|
|
2588
|
+
hasBottomBorder,
|
|
2589
|
+
hasLeftBorder,
|
|
2590
|
+
hasNoBorders,
|
|
2591
|
+
hasOuterBorders,
|
|
2592
|
+
hasRightBorder,
|
|
2593
|
+
hasTopBorder
|
|
2594
|
+
} = plateTable.useTableBordersDropdownMenuContentState();
|
|
2595
|
+
return /* @__PURE__ */ React.createElement(
|
|
2596
|
+
DropdownMenuContent,
|
|
2223
2597
|
{
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2598
|
+
align: "start",
|
|
2599
|
+
className: cn$1.cn("min-w-[220px]"),
|
|
2600
|
+
ref,
|
|
2601
|
+
side: "right",
|
|
2602
|
+
sideOffset: 0,
|
|
2603
|
+
...props
|
|
2227
2604
|
},
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
};
|
|
2231
|
-
const MermaidElementWithRef = ({ config, lightMode }) => {
|
|
2232
|
-
const { mermaidRef } = useMermaidElement();
|
|
2233
|
-
return /* @__PURE__ */ React.createElement("div", { contentEditable: false, className: "border-border border-b" }, /* @__PURE__ */ React.createElement("div", { ref: mermaidRef }, /* @__PURE__ */ React.createElement("pre", { className: `${lightMode} mermaid` }, config)));
|
|
2234
|
-
};
|
|
2235
|
-
const Bubble = ({ children }) => {
|
|
2236
|
-
return /* @__PURE__ */ React.createElement("div", { className: "bg-blue-600 rounded-full p-2 transition-transform duration-200 ease-in-out hover:scale-110" }, children);
|
|
2237
|
-
};
|
|
2238
|
-
const DEFAULT_MERMAID_CONFIG = `%% This won't render without implementing a rendering engine <TODO: Link to tina docs>
|
|
2239
|
-
flowchart TD
|
|
2240
|
-
id1(this is an example flow diagram)
|
|
2241
|
-
--> id2(modify me to see changes!)
|
|
2242
|
-
id2
|
|
2243
|
-
--> id3(Click the top button to preview the changes)
|
|
2244
|
-
--> id4(Learn about mermaid diagrams @ mermaid.js.org)`;
|
|
2245
|
-
const MermaidElement = cn$1.withRef(
|
|
2246
|
-
({ children, nodeProps, element, ...props }, ref) => {
|
|
2247
|
-
const [mermaidConfig, setMermaidConfig] = React.useState(
|
|
2248
|
-
element.value || DEFAULT_MERMAID_CONFIG
|
|
2249
|
-
);
|
|
2250
|
-
const [isEditing, setIsEditing] = React.useState(
|
|
2251
|
-
mermaidConfig === DEFAULT_MERMAID_CONFIG || false
|
|
2252
|
-
);
|
|
2253
|
-
const [lightModeClass, setLightModeClass] = React.useState("");
|
|
2254
|
-
const node = {
|
|
2255
|
-
type: ELEMENT_MERMAID,
|
|
2256
|
-
value: mermaidConfig,
|
|
2257
|
-
children: [{ type: "text", text: "" }]
|
|
2258
|
-
};
|
|
2259
|
-
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(
|
|
2260
|
-
lucideReact.Eye,
|
|
2605
|
+
/* @__PURE__ */ React.createElement(
|
|
2606
|
+
DropdownMenuCheckboxItem,
|
|
2261
2607
|
{
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
)
|
|
2268
|
-
|
|
2608
|
+
checked: hasBottomBorder,
|
|
2609
|
+
onCheckedChange: getOnSelectTableBorder("bottom")
|
|
2610
|
+
},
|
|
2611
|
+
/* @__PURE__ */ React.createElement(Icons.borderBottom, { className: iconVariants({ size: "sm" }) }),
|
|
2612
|
+
/* @__PURE__ */ React.createElement("div", null, "Bottom Border")
|
|
2613
|
+
),
|
|
2614
|
+
/* @__PURE__ */ React.createElement(
|
|
2615
|
+
DropdownMenuCheckboxItem,
|
|
2616
|
+
{
|
|
2617
|
+
checked: hasTopBorder,
|
|
2618
|
+
onCheckedChange: getOnSelectTableBorder("top")
|
|
2619
|
+
},
|
|
2620
|
+
/* @__PURE__ */ React.createElement(Icons.borderTop, { className: iconVariants({ size: "sm" }) }),
|
|
2621
|
+
/* @__PURE__ */ React.createElement("div", null, "Top Border")
|
|
2622
|
+
),
|
|
2623
|
+
/* @__PURE__ */ React.createElement(
|
|
2624
|
+
DropdownMenuCheckboxItem,
|
|
2625
|
+
{
|
|
2626
|
+
checked: hasLeftBorder,
|
|
2627
|
+
onCheckedChange: getOnSelectTableBorder("left")
|
|
2628
|
+
},
|
|
2629
|
+
/* @__PURE__ */ React.createElement(Icons.borderLeft, { className: iconVariants({ size: "sm" }) }),
|
|
2630
|
+
/* @__PURE__ */ React.createElement("div", null, "Left Border")
|
|
2631
|
+
),
|
|
2632
|
+
/* @__PURE__ */ React.createElement(
|
|
2633
|
+
DropdownMenuCheckboxItem,
|
|
2634
|
+
{
|
|
2635
|
+
checked: hasRightBorder,
|
|
2636
|
+
onCheckedChange: getOnSelectTableBorder("right")
|
|
2637
|
+
},
|
|
2638
|
+
/* @__PURE__ */ React.createElement(Icons.borderRight, { className: iconVariants({ size: "sm" }) }),
|
|
2639
|
+
/* @__PURE__ */ React.createElement("div", null, "Right Border")
|
|
2640
|
+
),
|
|
2641
|
+
/* @__PURE__ */ React.createElement(Separator, null),
|
|
2642
|
+
/* @__PURE__ */ React.createElement(
|
|
2643
|
+
DropdownMenuCheckboxItem,
|
|
2644
|
+
{
|
|
2645
|
+
checked: hasNoBorders,
|
|
2646
|
+
onCheckedChange: getOnSelectTableBorder("none")
|
|
2647
|
+
},
|
|
2648
|
+
/* @__PURE__ */ React.createElement(Icons.borderNone, { className: iconVariants({ size: "sm" }) }),
|
|
2649
|
+
/* @__PURE__ */ React.createElement("div", null, "No Border")
|
|
2650
|
+
),
|
|
2651
|
+
/* @__PURE__ */ React.createElement(
|
|
2652
|
+
DropdownMenuCheckboxItem,
|
|
2653
|
+
{
|
|
2654
|
+
checked: hasOuterBorders,
|
|
2655
|
+
onCheckedChange: getOnSelectTableBorder("outer")
|
|
2656
|
+
},
|
|
2657
|
+
/* @__PURE__ */ React.createElement(Icons.borderAll, { className: iconVariants({ size: "sm" }) }),
|
|
2658
|
+
/* @__PURE__ */ React.createElement("div", null, "Outside Borders")
|
|
2659
|
+
)
|
|
2660
|
+
);
|
|
2661
|
+
});
|
|
2662
|
+
const TableFloatingToolbar = cn$1.withRef(
|
|
2663
|
+
({ children, ...props }, ref) => {
|
|
2664
|
+
const element = plateCommon.useElement();
|
|
2665
|
+
const { props: buttonProps } = plateCommon.useRemoveNodeButton({ element });
|
|
2666
|
+
const selectionCollapsed = plateCommon.useEditorSelector(
|
|
2667
|
+
(editor2) => !plateCommon.isSelectionExpanded(editor2),
|
|
2668
|
+
[]
|
|
2669
|
+
);
|
|
2670
|
+
const readOnly = slateReact.useReadOnly();
|
|
2671
|
+
const selected = slateReact.useSelected();
|
|
2672
|
+
const editor = plateCommon.useEditorRef();
|
|
2673
|
+
const collapsed = !readOnly && selected && selectionCollapsed;
|
|
2674
|
+
const open2 = !readOnly && selected;
|
|
2675
|
+
const { canMerge, canUnmerge } = plateTable.useTableMergeState();
|
|
2676
|
+
const mergeContent = canMerge && /* @__PURE__ */ React.createElement(
|
|
2677
|
+
Button$2,
|
|
2269
2678
|
{
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
}
|
|
2275
|
-
|
|
2276
|
-
|
|
2679
|
+
contentEditable: false,
|
|
2680
|
+
isMenu: true,
|
|
2681
|
+
onClick: () => plateTable.mergeTableCells(editor),
|
|
2682
|
+
variant: "ghost"
|
|
2683
|
+
},
|
|
2684
|
+
/* @__PURE__ */ React.createElement(Icons.combine, { className: "mr-2 size-4" }),
|
|
2685
|
+
"Merge"
|
|
2686
|
+
);
|
|
2687
|
+
const unmergeButton = canUnmerge && /* @__PURE__ */ React.createElement(
|
|
2688
|
+
Button$2,
|
|
2277
2689
|
{
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
)
|
|
2286
|
-
|
|
2690
|
+
contentEditable: false,
|
|
2691
|
+
isMenu: true,
|
|
2692
|
+
onClick: () => plateTable.unmergeTableCells(editor),
|
|
2693
|
+
variant: "ghost"
|
|
2694
|
+
},
|
|
2695
|
+
/* @__PURE__ */ React.createElement(Icons.ungroup, { className: "mr-2 size-4" }),
|
|
2696
|
+
"Unmerge"
|
|
2697
|
+
);
|
|
2698
|
+
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"));
|
|
2699
|
+
return /* @__PURE__ */ React.createElement(Popover$2, { modal: false, open: open2 }, /* @__PURE__ */ React.createElement(PopoverPrimitive.PopoverAnchor, { asChild: true }, children), (canMerge || canUnmerge || collapsed) && /* @__PURE__ */ React.createElement(
|
|
2700
|
+
PopoverContent$1,
|
|
2287
2701
|
{
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2702
|
+
className: cn$1.cn(
|
|
2703
|
+
popoverVariants(),
|
|
2704
|
+
"flex w-[220px] flex-col gap-1 p-1"
|
|
2705
|
+
),
|
|
2706
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2707
|
+
ref,
|
|
2708
|
+
...props
|
|
2709
|
+
},
|
|
2710
|
+
unmergeButton,
|
|
2711
|
+
mergeContent,
|
|
2712
|
+
bordersContent
|
|
2713
|
+
));
|
|
2292
2714
|
}
|
|
2293
2715
|
);
|
|
2716
|
+
const TableElement = plateCommon.withHOC(
|
|
2717
|
+
plateTable.TableProvider,
|
|
2718
|
+
cn$1.withRef(({ children, className, ...props }, ref) => {
|
|
2719
|
+
const { colSizes, isSelectingCell, marginLeft, minColumnWidth } = plateTable.useTableElementState();
|
|
2720
|
+
const { colGroupProps, props: tableProps } = plateTable.useTableElement();
|
|
2721
|
+
return /* @__PURE__ */ React.createElement(TableFloatingToolbar, null, /* @__PURE__ */ React.createElement("div", { style: { paddingLeft: marginLeft } }, /* @__PURE__ */ React.createElement(
|
|
2722
|
+
plateCommon.PlateElement,
|
|
2723
|
+
{
|
|
2724
|
+
asChild: true,
|
|
2725
|
+
className: cn$1.cn(
|
|
2726
|
+
"my-4 ml-px mr-0 table h-px w-full table-fixed border-collapse",
|
|
2727
|
+
isSelectingCell && "[&_*::selection]:bg-none",
|
|
2728
|
+
className
|
|
2729
|
+
),
|
|
2730
|
+
ref,
|
|
2731
|
+
...tableProps,
|
|
2732
|
+
...props
|
|
2733
|
+
},
|
|
2734
|
+
/* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("colgroup", { ...colGroupProps }, colSizes.map((width, index) => /* @__PURE__ */ React.createElement(
|
|
2735
|
+
"col",
|
|
2736
|
+
{
|
|
2737
|
+
key: index,
|
|
2738
|
+
style: {
|
|
2739
|
+
minWidth: minColumnWidth,
|
|
2740
|
+
width: width || void 0
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
))), /* @__PURE__ */ React.createElement("tbody", { className: "min-w-full" }, children))
|
|
2744
|
+
)));
|
|
2745
|
+
})
|
|
2746
|
+
);
|
|
2747
|
+
const TableRowElement = cn$1.withRef(({ children, hideBorder, ...props }, ref) => {
|
|
2748
|
+
return /* @__PURE__ */ React.createElement(
|
|
2749
|
+
plateCommon.PlateElement,
|
|
2750
|
+
{
|
|
2751
|
+
asChild: true,
|
|
2752
|
+
className: cn$1.cn("h-full", hideBorder && "border-none"),
|
|
2753
|
+
ref,
|
|
2754
|
+
...props
|
|
2755
|
+
},
|
|
2756
|
+
/* @__PURE__ */ React.createElement("tr", null, children)
|
|
2757
|
+
);
|
|
2758
|
+
});
|
|
2294
2759
|
const blockClasses = "mt-0.5";
|
|
2295
2760
|
const headerClasses = "font-normal";
|
|
2296
2761
|
const Components = () => {
|
|
@@ -2477,7 +2942,11 @@ flowchart TD
|
|
|
2477
2942
|
children,
|
|
2478
2943
|
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" })
|
|
2479
2944
|
);
|
|
2480
|
-
}
|
|
2945
|
+
},
|
|
2946
|
+
[plate.ELEMENT_TABLE]: TableElement,
|
|
2947
|
+
[plate.ELEMENT_TR]: TableRowElement,
|
|
2948
|
+
[plate.ELEMENT_TD]: TableCellElement,
|
|
2949
|
+
[plate.ELEMENT_TH]: TableCellHeaderElement
|
|
2481
2950
|
};
|
|
2482
2951
|
};
|
|
2483
2952
|
const createCodeBlockPlugin = plateCommon.createPluginFactory({
|
|
@@ -4549,7 +5018,7 @@ flowchart TD
|
|
|
4549
5018
|
function cn(...inputs) {
|
|
4550
5019
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
4551
5020
|
}
|
|
4552
|
-
const buttonVariants
|
|
5021
|
+
const buttonVariants = classVarianceAuthority.cva(
|
|
4553
5022
|
"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",
|
|
4554
5023
|
{
|
|
4555
5024
|
variants: {
|
|
@@ -4575,7 +5044,7 @@ flowchart TD
|
|
|
4575
5044
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
4576
5045
|
Comp,
|
|
4577
5046
|
{
|
|
4578
|
-
className: cn(buttonVariants
|
|
5047
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
4579
5048
|
ref,
|
|
4580
5049
|
...props
|
|
4581
5050
|
}
|
|
@@ -5274,7 +5743,7 @@ flowchart TD
|
|
|
5274
5743
|
return template.label ? template.label.toLowerCase().includes(filter.toLowerCase()) || name.toLowerCase().includes(filter.toLowerCase()) : name.toLowerCase().includes(filter.toLowerCase());
|
|
5275
5744
|
});
|
|
5276
5745
|
}, [filter]);
|
|
5277
|
-
return /* @__PURE__ */ React__namespace.createElement(react
|
|
5746
|
+
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(
|
|
5278
5747
|
IconButton,
|
|
5279
5748
|
{
|
|
5280
5749
|
variant: open2 ? "secondary" : "primary",
|
|
@@ -5283,7 +5752,7 @@ flowchart TD
|
|
|
5283
5752
|
},
|
|
5284
5753
|
/* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
|
|
5285
5754
|
)), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute -bottom-1 right-0 z-50" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5286
|
-
react
|
|
5755
|
+
react.Transition,
|
|
5287
5756
|
{
|
|
5288
5757
|
enter: "transition duration-150 ease-out",
|
|
5289
5758
|
enterFrom: "transform opacity-0 -translate-y-2",
|
|
@@ -5292,7 +5761,7 @@ flowchart TD
|
|
|
5292
5761
|
leaveFrom: "transform opacity-100 translate-y-0",
|
|
5293
5762
|
leaveTo: "transform opacity-0 -translate-y-2"
|
|
5294
5763
|
},
|
|
5295
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
5764
|
+
/* @__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(
|
|
5296
5765
|
"input",
|
|
5297
5766
|
{
|
|
5298
5767
|
type: "text",
|
|
@@ -5469,8 +5938,8 @@ flowchart TD
|
|
|
5469
5938
|
onClick: () => setPickerIsOpen(!pickerIsOpen)
|
|
5470
5939
|
},
|
|
5471
5940
|
/* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
|
|
5472
|
-
), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react
|
|
5473
|
-
react
|
|
5941
|
+
), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: pickerIsOpen }, /* @__PURE__ */ React__namespace.createElement(
|
|
5942
|
+
react.TransitionChild,
|
|
5474
5943
|
{
|
|
5475
5944
|
enter: "transform transition-all ease-out duration-200",
|
|
5476
5945
|
enterFrom: "opacity-0 -translate-x-1/2",
|
|
@@ -5557,14 +6026,14 @@ flowchart TD
|
|
|
5557
6026
|
};
|
|
5558
6027
|
const BlockGroup = ({ category, templates, close: close2, isLast = false }) => {
|
|
5559
6028
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
5560
|
-
react
|
|
6029
|
+
react.Disclosure,
|
|
5561
6030
|
{
|
|
5562
6031
|
defaultOpen: true,
|
|
5563
6032
|
as: "div",
|
|
5564
6033
|
className: `left-0 right-0 relative`
|
|
5565
6034
|
},
|
|
5566
6035
|
({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5567
|
-
react
|
|
6036
|
+
react.DisclosureButton,
|
|
5568
6037
|
{
|
|
5569
6038
|
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`}`
|
|
5570
6039
|
},
|
|
@@ -5582,7 +6051,7 @@ flowchart TD
|
|
|
5582
6051
|
}
|
|
5583
6052
|
)
|
|
5584
6053
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
5585
|
-
react
|
|
6054
|
+
react.Transition,
|
|
5586
6055
|
{
|
|
5587
6056
|
enter: "transition duration-100 ease-out",
|
|
5588
6057
|
enterFrom: "transform scale-95 opacity-0",
|
|
@@ -5591,7 +6060,7 @@ flowchart TD
|
|
|
5591
6060
|
leaveFrom: "transform scale-100 opacity-100",
|
|
5592
6061
|
leaveTo: "transform scale-95 opacity-0"
|
|
5593
6062
|
},
|
|
5594
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
6063
|
+
/* @__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(
|
|
5595
6064
|
BlockCard,
|
|
5596
6065
|
{
|
|
5597
6066
|
key: index,
|
|
@@ -9410,7 +9879,7 @@ flowchart TD
|
|
|
9410
9879
|
const FormLists = (props) => {
|
|
9411
9880
|
const cms = useCMS();
|
|
9412
9881
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
9413
|
-
react
|
|
9882
|
+
react.Transition,
|
|
9414
9883
|
{
|
|
9415
9884
|
appear: true,
|
|
9416
9885
|
show: true,
|
|
@@ -9839,7 +10308,7 @@ flowchart TD
|
|
|
9839
10308
|
"Event Log"
|
|
9840
10309
|
));
|
|
9841
10310
|
};
|
|
9842
|
-
const version = "2.2.
|
|
10311
|
+
const version = "2.2.9";
|
|
9843
10312
|
const Nav = ({
|
|
9844
10313
|
isLocalMode,
|
|
9845
10314
|
className = "",
|
|
@@ -9893,8 +10362,8 @@ flowchart TD
|
|
|
9893
10362
|
style: { maxWidth: `${sidebarWidth}px` },
|
|
9894
10363
|
...props
|
|
9895
10364
|
},
|
|
9896
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "border-b border-gray-200" }, /* @__PURE__ */ React__namespace.createElement(react
|
|
9897
|
-
react
|
|
10365
|
+
/* @__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(
|
|
10366
|
+
react.MenuButton,
|
|
9898
10367
|
{
|
|
9899
10368
|
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"}`
|
|
9900
10369
|
},
|
|
@@ -9917,7 +10386,7 @@ flowchart TD
|
|
|
9917
10386
|
}
|
|
9918
10387
|
)
|
|
9919
10388
|
), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute bottom-3 right-5 z-50" }, /* @__PURE__ */ React__namespace.createElement(
|
|
9920
|
-
react
|
|
10389
|
+
react.Transition,
|
|
9921
10390
|
{
|
|
9922
10391
|
enter: "transition duration-150 ease-out",
|
|
9923
10392
|
enterFrom: "transform opacity-0 -translate-y-2",
|
|
@@ -9926,7 +10395,7 @@ flowchart TD
|
|
|
9926
10395
|
leaveFrom: "transform opacity-100 translate-y-0",
|
|
9927
10396
|
leaveTo: "transform opacity-0 -translate-y-2"
|
|
9928
10397
|
},
|
|
9929
|
-
/* @__PURE__ */ React__namespace.createElement(react
|
|
10398
|
+
/* @__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(
|
|
9930
10399
|
"button",
|
|
9931
10400
|
{
|
|
9932
10401
|
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`,
|
|
@@ -9959,7 +10428,7 @@ flowchart TD
|
|
|
9959
10428
|
},
|
|
9960
10429
|
/* @__PURE__ */ React__namespace.createElement(BiExit, { className: "w-6 h-auto mr-2 text-blue-400" }),
|
|
9961
10430
|
" Log Out"
|
|
9962
|
-
)), /* @__PURE__ */ React__namespace.createElement(react
|
|
10431
|
+
)), /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
|
|
9963
10432
|
WrappedSyncStatus,
|
|
9964
10433
|
{
|
|
9965
10434
|
cms,
|
|
@@ -10305,8 +10774,8 @@ flowchart TD
|
|
|
10305
10774
|
screen: activeScreen,
|
|
10306
10775
|
close: () => setActiveView(null)
|
|
10307
10776
|
}
|
|
10308
|
-
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react
|
|
10309
|
-
react
|
|
10777
|
+
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10778
|
+
react.TransitionChild,
|
|
10310
10779
|
{
|
|
10311
10780
|
enter: "transform transition-all ease-out duration-300",
|
|
10312
10781
|
enterFrom: "opacity-0 -translate-x-full",
|
|
@@ -10371,7 +10840,7 @@ flowchart TD
|
|
|
10371
10840
|
))
|
|
10372
10841
|
))
|
|
10373
10842
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
10374
|
-
react
|
|
10843
|
+
react.TransitionChild,
|
|
10375
10844
|
{
|
|
10376
10845
|
enter: "ease-out duration-300",
|
|
10377
10846
|
enterFrom: "opacity-0",
|
|
@@ -12906,15 +13375,15 @@ flowchart TD
|
|
|
12906
13375
|
);
|
|
12907
13376
|
};
|
|
12908
13377
|
const DotMenu = ({ onOpen, onRemove }) => {
|
|
12909
|
-
return /* @__PURE__ */ React.createElement(react
|
|
12910
|
-
react
|
|
13378
|
+
return /* @__PURE__ */ React.createElement(react.Popover, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React.createElement(
|
|
13379
|
+
react.PopoverButton,
|
|
12911
13380
|
{
|
|
12912
13381
|
as: "span",
|
|
12913
13382
|
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"
|
|
12914
13383
|
},
|
|
12915
13384
|
/* @__PURE__ */ React.createElement(EllipsisIcon, { title: "Open options" })
|
|
12916
13385
|
), /* @__PURE__ */ React.createElement(
|
|
12917
|
-
react
|
|
13386
|
+
react.Transition,
|
|
12918
13387
|
{
|
|
12919
13388
|
enter: "transition ease-out duration-100",
|
|
12920
13389
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -12923,7 +13392,7 @@ flowchart TD
|
|
|
12923
13392
|
leaveFrom: "transform opacity-100 scale-100",
|
|
12924
13393
|
leaveTo: "transform opacity-0 scale-95"
|
|
12925
13394
|
},
|
|
12926
|
-
/* @__PURE__ */ React.createElement(react
|
|
13395
|
+
/* @__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(
|
|
12927
13396
|
"span",
|
|
12928
13397
|
{
|
|
12929
13398
|
onClick: onOpen,
|
|
@@ -13346,13 +13815,25 @@ flowchart TD
|
|
|
13346
13815
|
plate.createUnderlinePlugin(),
|
|
13347
13816
|
plate.createCodePlugin(),
|
|
13348
13817
|
plate.createListPlugin(),
|
|
13349
|
-
plate.createIndentPlugin(),
|
|
13350
13818
|
plate.createIndentListPlugin(),
|
|
13351
13819
|
plate.createHorizontalRulePlugin(),
|
|
13352
13820
|
// Allows us to do things like copy/paste, remembering the state of the element (like mdx)
|
|
13353
13821
|
plate.createNodeIdPlugin(),
|
|
13354
|
-
plateSlashCommand.createSlashPlugin()
|
|
13822
|
+
plateSlashCommand.createSlashPlugin(),
|
|
13823
|
+
plate.createTablePlugin()
|
|
13355
13824
|
];
|
|
13825
|
+
const unsupportedItemsInTable = /* @__PURE__ */ new Set([
|
|
13826
|
+
"Code Block",
|
|
13827
|
+
"Unordered List",
|
|
13828
|
+
"Ordered List",
|
|
13829
|
+
"Quote",
|
|
13830
|
+
"Heading 1",
|
|
13831
|
+
"Heading 2",
|
|
13832
|
+
"Heading 3",
|
|
13833
|
+
"Heading 4",
|
|
13834
|
+
"Heading 5",
|
|
13835
|
+
"Heading 6"
|
|
13836
|
+
]);
|
|
13356
13837
|
const isNodeActive = (editor, type) => {
|
|
13357
13838
|
const pluginType = plateCommon.getPluginType(editor, type);
|
|
13358
13839
|
return !!(editor == null ? void 0 : editor.selection) && plateCommon.someNode(editor, { match: { type: pluginType } });
|
|
@@ -13537,24 +14018,6 @@ flowchart TD
|
|
|
13537
14018
|
}
|
|
13538
14019
|
);
|
|
13539
14020
|
Editor.displayName = "Editor";
|
|
13540
|
-
const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
|
|
13541
|
-
defaultVariants: {
|
|
13542
|
-
orientation: "horizontal"
|
|
13543
|
-
},
|
|
13544
|
-
variants: {
|
|
13545
|
-
orientation: {
|
|
13546
|
-
horizontal: "h-px w-full",
|
|
13547
|
-
vertical: "h-full w-px"
|
|
13548
|
-
}
|
|
13549
|
-
}
|
|
13550
|
-
});
|
|
13551
|
-
const Separator = cn$1.withVariants(
|
|
13552
|
-
cn$1.withProps(SeparatorPrimitive__namespace.Root, {
|
|
13553
|
-
decorative: true,
|
|
13554
|
-
orientation: "horizontal"
|
|
13555
|
-
}),
|
|
13556
|
-
separatorVariants
|
|
13557
|
-
);
|
|
13558
14021
|
const TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
13559
14022
|
const Tooltip = TooltipPrimitive__namespace.Root;
|
|
13560
14023
|
const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
@@ -13689,140 +14152,41 @@ flowchart TD
|
|
|
13689
14152
|
Toolbar,
|
|
13690
14153
|
"p-1 sticky left-0 top-0 z-50 w-full justify-between overflow-x-auto border border-border bg-background"
|
|
13691
14154
|
);
|
|
13692
|
-
const
|
|
13693
|
-
|
|
13694
|
-
|
|
13695
|
-
|
|
13696
|
-
|
|
13697
|
-
const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
|
|
13698
|
-
const editor = plateCommon.useEditorState();
|
|
13699
|
-
const state = plate.useListToolbarButtonState({ nodeType });
|
|
13700
|
-
const { props } = plate.useListToolbarButton(state);
|
|
13701
|
-
return /* @__PURE__ */ React.createElement(
|
|
13702
|
-
ToolbarButton,
|
|
13703
|
-
{
|
|
13704
|
-
ref,
|
|
13705
|
-
tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
13706
|
-
...props,
|
|
13707
|
-
onClick: (e) => {
|
|
13708
|
-
e.preventDefault();
|
|
13709
|
-
e.stopPropagation();
|
|
13710
|
-
plate.toggleList(editor, { type: nodeType });
|
|
13711
|
-
}
|
|
13712
|
-
},
|
|
13713
|
-
nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
|
|
13714
|
-
);
|
|
13715
|
-
});
|
|
13716
|
-
const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
13717
|
-
const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
13718
|
-
const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
13719
|
-
cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
13720
|
-
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
13721
|
-
{
|
|
13722
|
-
className: cn$1.cn(
|
|
13723
|
-
"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",
|
|
13724
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
13725
|
-
inset && "pl-8",
|
|
13726
|
-
className
|
|
13727
|
-
),
|
|
13728
|
-
ref,
|
|
13729
|
-
...props
|
|
13730
|
-
},
|
|
13731
|
-
children,
|
|
13732
|
-
/* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
|
|
13733
|
-
));
|
|
13734
|
-
cn$1.withCn(
|
|
13735
|
-
DropdownMenuPrimitive__namespace.SubContent,
|
|
13736
|
-
"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"
|
|
13737
|
-
);
|
|
13738
|
-
const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
|
|
13739
|
-
className: cn$1.cn(
|
|
13740
|
-
"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"
|
|
13741
|
-
),
|
|
13742
|
-
sideOffset: 4
|
|
13743
|
-
});
|
|
13744
|
-
const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
|
|
13745
|
-
const menuItemVariants = classVarianceAuthority.cva(
|
|
13746
|
-
cn$1.cn(
|
|
13747
|
-
"relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
13748
|
-
"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
13749
|
-
),
|
|
13750
|
-
{
|
|
13751
|
-
variants: {
|
|
13752
|
-
inset: {
|
|
13753
|
-
true: "pl-8"
|
|
14155
|
+
const useResize = (ref, callback) => {
|
|
14156
|
+
React.useEffect(() => {
|
|
14157
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
14158
|
+
for (const entry of entries) {
|
|
14159
|
+
callback(entry);
|
|
13754
14160
|
}
|
|
14161
|
+
});
|
|
14162
|
+
if (ref.current) {
|
|
14163
|
+
resizeObserver.observe(ref.current);
|
|
13755
14164
|
}
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
13761
|
-
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
ref,
|
|
13772
|
-
...props
|
|
13773
|
-
},
|
|
13774
|
-
/* @__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" }))),
|
|
13775
|
-
children
|
|
13776
|
-
));
|
|
13777
|
-
const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
13778
|
-
DropdownMenuPrimitive__namespace.RadioItem,
|
|
13779
|
-
{
|
|
13780
|
-
className: cn$1.cn(
|
|
13781
|
-
"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",
|
|
13782
|
-
"h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
|
|
13783
|
-
className
|
|
13784
|
-
),
|
|
13785
|
-
ref,
|
|
13786
|
-
...props
|
|
13787
|
-
},
|
|
13788
|
-
!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" }))),
|
|
14165
|
+
return () => resizeObserver.disconnect();
|
|
14166
|
+
}, [ref.current]);
|
|
14167
|
+
};
|
|
14168
|
+
const STANDARD_ICON_WIDTH = 32;
|
|
14169
|
+
const HEADING_ICON_WITH_TEXT = 127;
|
|
14170
|
+
const HEADING_ICON_ONLY = 58;
|
|
14171
|
+
const EMBED_ICON_WIDTH = 78;
|
|
14172
|
+
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14173
|
+
const FLOAT_BUTTON_WIDTH = 25;
|
|
14174
|
+
const HEADING_LABEL = "Headings";
|
|
14175
|
+
const ToolbarContext = React.createContext(void 0);
|
|
14176
|
+
const ToolbarProvider = ({
|
|
14177
|
+
tinaForm,
|
|
14178
|
+
templates,
|
|
14179
|
+
overrides,
|
|
13789
14180
|
children
|
|
13790
|
-
)
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
}
|
|
13798
|
-
}
|
|
14181
|
+
}) => {
|
|
14182
|
+
return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
|
|
14183
|
+
};
|
|
14184
|
+
const useToolbarContext = () => {
|
|
14185
|
+
const context = React.useContext(ToolbarContext);
|
|
14186
|
+
if (!context) {
|
|
14187
|
+
throw new Error("useToolbarContext must be used within a ToolbarProvider");
|
|
13799
14188
|
}
|
|
13800
|
-
|
|
13801
|
-
const DropdownMenuLabel = cn$1.withVariants(
|
|
13802
|
-
DropdownMenuPrimitive__namespace.Label,
|
|
13803
|
-
dropdownMenuLabelVariants,
|
|
13804
|
-
["inset"]
|
|
13805
|
-
);
|
|
13806
|
-
const DropdownMenuSeparator = cn$1.withCn(
|
|
13807
|
-
DropdownMenuPrimitive__namespace.Separator,
|
|
13808
|
-
"-mx-1 my-1 h-px bg-muted"
|
|
13809
|
-
);
|
|
13810
|
-
cn$1.withCn(
|
|
13811
|
-
cn$1.createPrimitiveElement("span"),
|
|
13812
|
-
"ml-auto text-xs tracking-widest opacity-60"
|
|
13813
|
-
);
|
|
13814
|
-
const useOpenState = () => {
|
|
13815
|
-
const [open2, setOpen] = React.useState(false);
|
|
13816
|
-
const onOpenChange = React.useCallback(
|
|
13817
|
-
(_value = !open2) => {
|
|
13818
|
-
setOpen(_value);
|
|
13819
|
-
},
|
|
13820
|
-
[open2]
|
|
13821
|
-
);
|
|
13822
|
-
return {
|
|
13823
|
-
onOpenChange,
|
|
13824
|
-
open: open2
|
|
13825
|
-
};
|
|
14189
|
+
return context;
|
|
13826
14190
|
};
|
|
13827
14191
|
const items$1 = [
|
|
13828
14192
|
{
|
|
@@ -13888,7 +14252,9 @@ flowchart TD
|
|
|
13888
14252
|
return allNodesMatchInitialNodeType ? initialNodeType : plateParagraph.ELEMENT_PARAGRAPH;
|
|
13889
14253
|
}, []);
|
|
13890
14254
|
const editor = plateCommon.useEditorRef();
|
|
14255
|
+
const editorState = plateCommon.useEditorState();
|
|
13891
14256
|
const openState = useOpenState();
|
|
14257
|
+
const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
|
|
13892
14258
|
const selectedItem = items$1.find((item) => item.value === value) ?? defaultItem$1;
|
|
13893
14259
|
const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
|
|
13894
14260
|
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
@@ -13900,7 +14266,7 @@ flowchart TD
|
|
|
13900
14266
|
tooltip: "Headings"
|
|
13901
14267
|
},
|
|
13902
14268
|
/* @__PURE__ */ React.createElement(SelectedItemIcon, { className: "size-5" }),
|
|
13903
|
-
/* @__PURE__ */ React.createElement("span", { className: "
|
|
14269
|
+
/* @__PURE__ */ React.createElement("span", { className: "@md/toolbar:flex hidden" }, selectedItemLabel)
|
|
13904
14270
|
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0" }, /* @__PURE__ */ React.createElement(
|
|
13905
14271
|
DropdownMenuRadioGroup,
|
|
13906
14272
|
{
|
|
@@ -13912,7 +14278,12 @@ flowchart TD
|
|
|
13912
14278
|
},
|
|
13913
14279
|
value
|
|
13914
14280
|
},
|
|
13915
|
-
items$1.
|
|
14281
|
+
items$1.filter((item) => {
|
|
14282
|
+
if (userInTable) {
|
|
14283
|
+
return !unsupportedItemsInTable.has(item.label);
|
|
14284
|
+
}
|
|
14285
|
+
return true;
|
|
14286
|
+
}).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
|
|
13916
14287
|
DropdownMenuRadioItem,
|
|
13917
14288
|
{
|
|
13918
14289
|
className: "min-w-[180px]",
|
|
@@ -13924,24 +14295,17 @@ flowchart TD
|
|
|
13924
14295
|
))
|
|
13925
14296
|
)));
|
|
13926
14297
|
}
|
|
13927
|
-
const
|
|
13928
|
-
const state = plateLink.useLinkToolbarButtonState();
|
|
13929
|
-
const { props } = plateLink.useLinkToolbarButton(state);
|
|
13930
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
|
|
13931
|
-
});
|
|
13932
|
-
const useBlockQuoteToolbarButtonState = () => {
|
|
14298
|
+
const useCodeBlockToolbarButtonState = () => {
|
|
13933
14299
|
const editor = plateCommon.useEditorState();
|
|
13934
|
-
const isBlockActive = () => helpers.isNodeActive(editor,
|
|
14300
|
+
const isBlockActive = () => helpers.isNodeActive(editor, plateCodeBlock.ELEMENT_CODE_BLOCK);
|
|
13935
14301
|
return {
|
|
13936
14302
|
pressed: isBlockActive()
|
|
13937
14303
|
};
|
|
13938
14304
|
};
|
|
13939
|
-
const
|
|
14305
|
+
const useCodeBlockToolbarButton = (state) => {
|
|
13940
14306
|
const editor = plateCommon.useEditorState();
|
|
13941
14307
|
const onClick = () => {
|
|
13942
|
-
|
|
13943
|
-
activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
|
|
13944
|
-
});
|
|
14308
|
+
insertEmptyCodeBlock(editor);
|
|
13945
14309
|
};
|
|
13946
14310
|
const onMouseDown = (e) => {
|
|
13947
14311
|
e.preventDefault();
|
|
@@ -13955,39 +14319,71 @@ flowchart TD
|
|
|
13955
14319
|
}
|
|
13956
14320
|
};
|
|
13957
14321
|
};
|
|
13958
|
-
const
|
|
13959
|
-
const state =
|
|
13960
|
-
const { props } =
|
|
13961
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.
|
|
14322
|
+
const CodeBlockToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14323
|
+
const state = useCodeBlockToolbarButtonState();
|
|
14324
|
+
const { props } = useCodeBlockToolbarButton(state);
|
|
14325
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.codeBlock, null));
|
|
13962
14326
|
});
|
|
13963
|
-
const
|
|
14327
|
+
const useImageToolbarButtonState = () => {
|
|
13964
14328
|
const editor = plateCommon.useEditorState();
|
|
13965
|
-
const isBlockActive = () => helpers.isNodeActive(editor,
|
|
14329
|
+
const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_IMG);
|
|
13966
14330
|
return {
|
|
13967
14331
|
pressed: isBlockActive()
|
|
13968
14332
|
};
|
|
13969
14333
|
};
|
|
13970
|
-
const
|
|
14334
|
+
const useImageToolbarButton = (state) => {
|
|
13971
14335
|
const editor = plateCommon.useEditorState();
|
|
13972
|
-
const
|
|
13973
|
-
insertEmptyCodeBlock(editor);
|
|
13974
|
-
};
|
|
14336
|
+
const cms = useCMS$1();
|
|
13975
14337
|
const onMouseDown = (e) => {
|
|
13976
14338
|
e.preventDefault();
|
|
13977
|
-
|
|
14339
|
+
cms.media.open({
|
|
14340
|
+
allowDelete: true,
|
|
14341
|
+
directory: "",
|
|
14342
|
+
onSelect: (media) => {
|
|
14343
|
+
insertImg(editor, media);
|
|
14344
|
+
}
|
|
14345
|
+
});
|
|
13978
14346
|
};
|
|
13979
14347
|
return {
|
|
13980
14348
|
props: {
|
|
13981
|
-
onClick,
|
|
13982
14349
|
onMouseDown,
|
|
13983
14350
|
pressed: state.pressed
|
|
13984
14351
|
}
|
|
13985
14352
|
};
|
|
13986
14353
|
};
|
|
13987
|
-
const
|
|
13988
|
-
const state =
|
|
13989
|
-
const { props } =
|
|
13990
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.
|
|
14354
|
+
const ImageToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14355
|
+
const state = useImageToolbarButtonState();
|
|
14356
|
+
const { props } = useImageToolbarButton(state);
|
|
14357
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
|
|
14358
|
+
});
|
|
14359
|
+
const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
|
|
14360
|
+
const editor = plateCommon.useEditorState();
|
|
14361
|
+
const state = plate.useListToolbarButtonState({ nodeType });
|
|
14362
|
+
const { props } = plate.useListToolbarButton(state);
|
|
14363
|
+
return /* @__PURE__ */ React.createElement(
|
|
14364
|
+
ToolbarButton,
|
|
14365
|
+
{
|
|
14366
|
+
ref,
|
|
14367
|
+
tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
14368
|
+
...props,
|
|
14369
|
+
onClick: (e) => {
|
|
14370
|
+
e.preventDefault();
|
|
14371
|
+
e.stopPropagation();
|
|
14372
|
+
plate.toggleList(editor, { type: nodeType });
|
|
14373
|
+
}
|
|
14374
|
+
},
|
|
14375
|
+
nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
|
|
14376
|
+
);
|
|
14377
|
+
});
|
|
14378
|
+
const LinkToolbarButton = cn$1.withRef((rest, ref) => {
|
|
14379
|
+
const state = plateLink.useLinkToolbarButtonState();
|
|
14380
|
+
const { props } = plateLink.useLinkToolbarButton(state);
|
|
14381
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
|
|
14382
|
+
});
|
|
14383
|
+
const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14384
|
+
const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
|
|
14385
|
+
const { props } = plateCommon.useMarkToolbarButton(state);
|
|
14386
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
13991
14387
|
});
|
|
13992
14388
|
const useMermaidToolbarButtonState = () => {
|
|
13993
14389
|
const editor = plateCommon.useEditorState();
|
|
@@ -14021,37 +14417,53 @@ flowchart TD
|
|
|
14021
14417
|
const { props } = useMermaidToolbarButton(state);
|
|
14022
14418
|
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Mermaid", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.mermaid, null));
|
|
14023
14419
|
});
|
|
14024
|
-
|
|
14420
|
+
function OverflowMenu({
|
|
14421
|
+
children,
|
|
14422
|
+
...props
|
|
14423
|
+
}) {
|
|
14424
|
+
const openState = useOpenState();
|
|
14425
|
+
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
14426
|
+
ToolbarButton,
|
|
14427
|
+
{
|
|
14428
|
+
showArrow: false,
|
|
14429
|
+
className: "lg:min-w-[130px]",
|
|
14430
|
+
isDropdown: true,
|
|
14431
|
+
pressed: openState.open,
|
|
14432
|
+
tooltip: "Headings"
|
|
14433
|
+
},
|
|
14434
|
+
/* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
|
|
14435
|
+
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
|
|
14436
|
+
}
|
|
14437
|
+
const useBlockQuoteToolbarButtonState = () => {
|
|
14025
14438
|
const editor = plateCommon.useEditorState();
|
|
14026
|
-
const isBlockActive = () => helpers.isNodeActive(editor,
|
|
14439
|
+
const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
|
|
14027
14440
|
return {
|
|
14028
14441
|
pressed: isBlockActive()
|
|
14029
14442
|
};
|
|
14030
14443
|
};
|
|
14031
|
-
const
|
|
14444
|
+
const useBlockQuoteToolbarButton = (state) => {
|
|
14032
14445
|
const editor = plateCommon.useEditorState();
|
|
14033
|
-
const
|
|
14446
|
+
const onClick = () => {
|
|
14447
|
+
plateCommon.toggleNodeType(editor, {
|
|
14448
|
+
activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
|
|
14449
|
+
});
|
|
14450
|
+
};
|
|
14034
14451
|
const onMouseDown = (e) => {
|
|
14035
14452
|
e.preventDefault();
|
|
14036
|
-
|
|
14037
|
-
allowDelete: true,
|
|
14038
|
-
directory: "",
|
|
14039
|
-
onSelect: (media) => {
|
|
14040
|
-
insertImg(editor, media);
|
|
14041
|
-
}
|
|
14042
|
-
});
|
|
14453
|
+
e.stopPropagation();
|
|
14043
14454
|
};
|
|
14044
14455
|
return {
|
|
14045
14456
|
props: {
|
|
14457
|
+
onClick,
|
|
14046
14458
|
onMouseDown,
|
|
14047
14459
|
pressed: state.pressed
|
|
14048
14460
|
}
|
|
14049
14461
|
};
|
|
14050
14462
|
};
|
|
14051
|
-
const
|
|
14052
|
-
const state =
|
|
14053
|
-
const { props } =
|
|
14054
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.
|
|
14463
|
+
const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14464
|
+
const state = useBlockQuoteToolbarButtonState();
|
|
14465
|
+
const { props } = useBlockQuoteToolbarButton(state);
|
|
14466
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
|
|
14055
14467
|
});
|
|
14056
14468
|
const useRawMarkdownToolbarButton = () => {
|
|
14057
14469
|
const { setRawMode } = useEditorContext();
|
|
@@ -14069,29 +14481,111 @@ flowchart TD
|
|
|
14069
14481
|
const { props } = useRawMarkdownToolbarButton();
|
|
14070
14482
|
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.raw, null));
|
|
14071
14483
|
});
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14484
|
+
function TableDropdownMenu(props) {
|
|
14485
|
+
const tableSelected = plateCommon.useEditorSelector(
|
|
14486
|
+
(editor2) => plateCommon.someNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } }),
|
|
14487
|
+
[]
|
|
14488
|
+
);
|
|
14489
|
+
const [enableDeleteColumn, enableDeleteRow] = plateCommon.useEditorSelector((editor2) => {
|
|
14490
|
+
const tableNodeEntry = plateCommon.findNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } });
|
|
14491
|
+
if (!tableNodeEntry)
|
|
14492
|
+
return [false, false];
|
|
14493
|
+
const [tableNode] = tableNodeEntry;
|
|
14494
|
+
if (!plateCommon.isElement(tableNode))
|
|
14495
|
+
return [false, false];
|
|
14496
|
+
const columnCount = plateTable.getTableColumnCount(tableNode);
|
|
14497
|
+
const rowCount = tableNode.children.length;
|
|
14498
|
+
return [columnCount > 1, rowCount > 1];
|
|
14499
|
+
}, []);
|
|
14500
|
+
const editor = plateCommon.useEditorRef();
|
|
14501
|
+
const openState = useOpenState();
|
|
14502
|
+
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(
|
|
14503
|
+
DropdownMenuContent,
|
|
14504
|
+
{
|
|
14505
|
+
align: "start",
|
|
14506
|
+
className: "flex w-[180px] min-w-0 flex-col gap-0.5"
|
|
14507
|
+
},
|
|
14508
|
+
/* @__PURE__ */ React.createElement(
|
|
14509
|
+
DropdownMenuItem,
|
|
14510
|
+
{
|
|
14511
|
+
className: "min-w-[180px]",
|
|
14512
|
+
disabled: tableSelected,
|
|
14513
|
+
onSelect: () => {
|
|
14514
|
+
plateTable.insertTable(editor);
|
|
14515
|
+
plateCommon.focusEditor(editor);
|
|
14516
|
+
}
|
|
14517
|
+
},
|
|
14518
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14519
|
+
"Insert table"
|
|
14520
|
+
),
|
|
14521
|
+
/* @__PURE__ */ React.createElement(
|
|
14522
|
+
DropdownMenuItem,
|
|
14523
|
+
{
|
|
14524
|
+
className: "min-w-[180px]",
|
|
14525
|
+
disabled: !tableSelected,
|
|
14526
|
+
onSelect: () => {
|
|
14527
|
+
plateTable.deleteTable(editor);
|
|
14528
|
+
plateCommon.focusEditor(editor);
|
|
14529
|
+
}
|
|
14530
|
+
},
|
|
14531
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14532
|
+
"Delete table"
|
|
14533
|
+
),
|
|
14534
|
+
/* @__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(
|
|
14535
|
+
DropdownMenuItem,
|
|
14536
|
+
{
|
|
14537
|
+
className: "min-w-[180px]",
|
|
14538
|
+
disabled: !tableSelected,
|
|
14539
|
+
onSelect: () => {
|
|
14540
|
+
plateTable.insertTableColumn(editor);
|
|
14541
|
+
plateCommon.focusEditor(editor);
|
|
14542
|
+
}
|
|
14543
|
+
},
|
|
14544
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14545
|
+
"Insert column after"
|
|
14546
|
+
), /* @__PURE__ */ React.createElement(
|
|
14547
|
+
DropdownMenuItem,
|
|
14548
|
+
{
|
|
14549
|
+
className: "min-w-[180px]",
|
|
14550
|
+
disabled: !enableDeleteColumn,
|
|
14551
|
+
onSelect: () => {
|
|
14552
|
+
plateTable.deleteColumn(editor);
|
|
14553
|
+
plateCommon.focusEditor(editor);
|
|
14554
|
+
}
|
|
14555
|
+
},
|
|
14556
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14557
|
+
"Delete column"
|
|
14558
|
+
))),
|
|
14559
|
+
/* @__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(
|
|
14560
|
+
DropdownMenuItem,
|
|
14561
|
+
{
|
|
14562
|
+
className: "min-w-[180px]",
|
|
14563
|
+
disabled: !tableSelected,
|
|
14564
|
+
onSelect: () => {
|
|
14565
|
+
plateTable.insertTableRow(editor);
|
|
14566
|
+
plateCommon.focusEditor(editor);
|
|
14567
|
+
}
|
|
14568
|
+
},
|
|
14569
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14570
|
+
"Insert row after"
|
|
14571
|
+
), /* @__PURE__ */ React.createElement(
|
|
14572
|
+
DropdownMenuItem,
|
|
14573
|
+
{
|
|
14574
|
+
className: "min-w-[180px]",
|
|
14575
|
+
disabled: !enableDeleteRow,
|
|
14576
|
+
onSelect: () => {
|
|
14577
|
+
plateTable.deleteRow(editor);
|
|
14578
|
+
plateCommon.focusEditor(editor);
|
|
14579
|
+
}
|
|
14580
|
+
},
|
|
14581
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14582
|
+
"Delete row"
|
|
14583
|
+
)))
|
|
14584
|
+
));
|
|
14585
|
+
}
|
|
14088
14586
|
function TemplatesToolbarButton() {
|
|
14089
14587
|
const { templates } = useToolbarContext();
|
|
14090
|
-
const showEmbed = templates.length > 0;
|
|
14091
14588
|
const editor = plateCommon.useEditorState();
|
|
14092
|
-
if (!showEmbed) {
|
|
14093
|
-
return null;
|
|
14094
|
-
}
|
|
14095
14589
|
return /* @__PURE__ */ React.createElement(EmbedButton, { templates, editor });
|
|
14096
14590
|
}
|
|
14097
14591
|
const EmbedButton = ({ editor, templates }) => {
|
|
@@ -14132,103 +14626,113 @@ flowchart TD
|
|
|
14132
14626
|
template.label || template.name
|
|
14133
14627
|
))));
|
|
14134
14628
|
};
|
|
14135
|
-
const ICON_WIDTH = 32;
|
|
14136
|
-
const EMBED_ICON_WIDTH = 78;
|
|
14137
|
-
const useResize = (ref, callback) => {
|
|
14138
|
-
React.useEffect(() => {
|
|
14139
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
14140
|
-
for (const entry of entries) {
|
|
14141
|
-
callback(entry);
|
|
14142
|
-
}
|
|
14143
|
-
});
|
|
14144
|
-
if (ref.current) {
|
|
14145
|
-
resizeObserver.observe(ref.current);
|
|
14146
|
-
}
|
|
14147
|
-
return () => resizeObserver.disconnect();
|
|
14148
|
-
}, [ref.current]);
|
|
14149
|
-
};
|
|
14150
|
-
function OverflowMenu({
|
|
14151
|
-
children,
|
|
14152
|
-
...props
|
|
14153
|
-
}) {
|
|
14154
|
-
const openState = useOpenState();
|
|
14155
|
-
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
14156
|
-
ToolbarButton,
|
|
14157
|
-
{
|
|
14158
|
-
showArrow: false,
|
|
14159
|
-
className: "lg:min-w-[130px]",
|
|
14160
|
-
isDropdown: true,
|
|
14161
|
-
pressed: openState.open,
|
|
14162
|
-
tooltip: "Headings"
|
|
14163
|
-
},
|
|
14164
|
-
/* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
|
|
14165
|
-
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
|
|
14166
|
-
}
|
|
14167
14629
|
const toolbarItems = {
|
|
14168
14630
|
heading: {
|
|
14169
|
-
label:
|
|
14631
|
+
label: HEADING_LABEL,
|
|
14632
|
+
width: (paragraphIconExists) => paragraphIconExists ? HEADING_ICON_WITH_TEXT : HEADING_ICON_ONLY,
|
|
14633
|
+
// Dynamically handle width based on paragraph icon
|
|
14170
14634
|
Component: /* @__PURE__ */ React.createElement(ToolbarGroup, { noSeparator: true }, /* @__PURE__ */ React.createElement(HeadingsMenu, null))
|
|
14171
14635
|
},
|
|
14172
14636
|
link: {
|
|
14173
14637
|
label: "Link",
|
|
14638
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14174
14639
|
Component: /* @__PURE__ */ React.createElement(LinkToolbarButton, null)
|
|
14175
14640
|
},
|
|
14176
14641
|
image: {
|
|
14177
14642
|
label: "Image",
|
|
14643
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14178
14644
|
Component: /* @__PURE__ */ React.createElement(ImageToolbarButton, null)
|
|
14179
14645
|
},
|
|
14180
14646
|
quote: {
|
|
14181
14647
|
label: "Quote",
|
|
14648
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14182
14649
|
Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
|
|
14183
14650
|
},
|
|
14184
14651
|
ul: {
|
|
14185
14652
|
label: "Unordered List",
|
|
14653
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14186
14654
|
Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_UL })
|
|
14187
14655
|
},
|
|
14188
14656
|
ol: {
|
|
14189
14657
|
label: "Ordered List",
|
|
14658
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14190
14659
|
Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_OL })
|
|
14191
14660
|
},
|
|
14192
14661
|
bold: {
|
|
14193
14662
|
label: "Bold",
|
|
14663
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14194
14664
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null))
|
|
14195
14665
|
},
|
|
14196
14666
|
italic: {
|
|
14197
14667
|
label: "Italic",
|
|
14668
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14198
14669
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null))
|
|
14199
14670
|
},
|
|
14200
14671
|
code: {
|
|
14201
14672
|
label: "Code",
|
|
14673
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14202
14674
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null))
|
|
14203
14675
|
},
|
|
14204
14676
|
codeBlock: {
|
|
14205
14677
|
label: "Code Block",
|
|
14678
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14206
14679
|
Component: /* @__PURE__ */ React.createElement(CodeBlockToolbarButton, null)
|
|
14207
14680
|
},
|
|
14208
14681
|
mermaid: {
|
|
14209
14682
|
label: "Mermaid",
|
|
14683
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14210
14684
|
Component: /* @__PURE__ */ React.createElement(MermaidToolbarButton, null)
|
|
14211
14685
|
},
|
|
14686
|
+
table: {
|
|
14687
|
+
label: "Table",
|
|
14688
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14689
|
+
Component: /* @__PURE__ */ React.createElement(TableDropdownMenu, null)
|
|
14690
|
+
},
|
|
14212
14691
|
raw: {
|
|
14213
14692
|
label: "Raw Markdown",
|
|
14693
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14214
14694
|
Component: /* @__PURE__ */ React.createElement(RawMarkdownToolbarButton, null)
|
|
14215
14695
|
},
|
|
14216
14696
|
embed: {
|
|
14217
14697
|
label: "Templates",
|
|
14698
|
+
width: () => EMBED_ICON_WIDTH,
|
|
14218
14699
|
Component: /* @__PURE__ */ React.createElement(TemplatesToolbarButton, null)
|
|
14219
14700
|
}
|
|
14220
14701
|
};
|
|
14221
14702
|
function FixedToolbarButtons() {
|
|
14222
14703
|
const toolbarRef = React.useRef(null);
|
|
14223
14704
|
const [itemsShown, setItemsShown] = React.useState(11);
|
|
14224
|
-
const { overrides } = useToolbarContext();
|
|
14705
|
+
const { overrides, templates } = useToolbarContext();
|
|
14706
|
+
const showEmbedButton = templates.length > 0;
|
|
14707
|
+
let items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14708
|
+
if (!showEmbedButton) {
|
|
14709
|
+
items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
|
|
14710
|
+
}
|
|
14711
|
+
const editorState = plateCommon.useEditorState();
|
|
14712
|
+
const userInTable = helpers.isNodeActive(editorState, plate.ELEMENT_TABLE);
|
|
14713
|
+
if (userInTable) {
|
|
14714
|
+
items2 = items2.filter((item) => !unsupportedItemsInTable.has(item.label));
|
|
14715
|
+
}
|
|
14225
14716
|
useResize(toolbarRef, (entry) => {
|
|
14226
14717
|
const width = entry.target.getBoundingClientRect().width;
|
|
14227
|
-
const
|
|
14228
|
-
|
|
14718
|
+
const headingButton = items2.find((item) => item.label === HEADING_LABEL);
|
|
14719
|
+
const headingWidth = headingButton ? headingButton.width(width > CONTAINER_MD_BREAKPOINT) : 0;
|
|
14720
|
+
const availableWidth = width - headingWidth - FLOAT_BUTTON_WIDTH;
|
|
14721
|
+
const { itemFitCount } = items2.reduce(
|
|
14722
|
+
(acc, item) => {
|
|
14723
|
+
if (item.label !== HEADING_LABEL && acc.totalItemsWidth + item.width() <= availableWidth) {
|
|
14724
|
+
return {
|
|
14725
|
+
totalItemsWidth: acc.totalItemsWidth + item.width(),
|
|
14726
|
+
itemFitCount: acc.itemFitCount + 1
|
|
14727
|
+
};
|
|
14728
|
+
}
|
|
14729
|
+
return acc;
|
|
14730
|
+
},
|
|
14731
|
+
{ totalItemsWidth: 0, itemFitCount: 1 }
|
|
14732
|
+
);
|
|
14733
|
+
setItemsShown(itemFitCount);
|
|
14229
14734
|
});
|
|
14230
|
-
|
|
14231
|
-
return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
|
|
14735
|
+
return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden @container/toolbar", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
|
|
14232
14736
|
"div",
|
|
14233
14737
|
{
|
|
14234
14738
|
className: "flex",
|
|
@@ -14236,7 +14740,7 @@ flowchart TD
|
|
|
14236
14740
|
transform: "translateX(calc(-1px))"
|
|
14237
14741
|
}
|
|
14238
14742
|
},
|
|
14239
|
-
/* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
14743
|
+
/* @__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))))
|
|
14240
14744
|
));
|
|
14241
14745
|
}
|
|
14242
14746
|
const FloatingToolbar = cn$1.withRef(({ children, state, ...props }, componentRef) => {
|
|
@@ -14351,6 +14855,10 @@ flowchart TD
|
|
|
14351
14855
|
const openState = useOpenState();
|
|
14352
14856
|
const selectedItem = items.find((item) => item.value === value) ?? defaultItem;
|
|
14353
14857
|
const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
|
|
14858
|
+
const editorState = plateCommon.useEditorState();
|
|
14859
|
+
const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
|
|
14860
|
+
if (userInTable)
|
|
14861
|
+
return null;
|
|
14354
14862
|
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
14355
14863
|
ToolbarButton,
|
|
14356
14864
|
{
|
|
@@ -14392,49 +14900,6 @@ flowchart TD
|
|
|
14392
14900
|
function FloatingToolbarButtons() {
|
|
14393
14901
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TurnIntoDropdownMenu, null));
|
|
14394
14902
|
}
|
|
14395
|
-
const buttonVariants = classVarianceAuthority.cva(
|
|
14396
|
-
"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",
|
|
14397
|
-
{
|
|
14398
|
-
defaultVariants: {
|
|
14399
|
-
size: "default",
|
|
14400
|
-
variant: "default"
|
|
14401
|
-
},
|
|
14402
|
-
variants: {
|
|
14403
|
-
isMenu: {
|
|
14404
|
-
true: "h-auto w-full cursor-pointer justify-start"
|
|
14405
|
-
},
|
|
14406
|
-
size: {
|
|
14407
|
-
default: "h-10 px-4 py-2",
|
|
14408
|
-
icon: "size-10",
|
|
14409
|
-
lg: "h-11 rounded-md px-8",
|
|
14410
|
-
none: "",
|
|
14411
|
-
sm: "h-9 rounded-md px-3",
|
|
14412
|
-
sms: "size-9 rounded-md px-0",
|
|
14413
|
-
xs: "h-8 rounded-md px-3"
|
|
14414
|
-
},
|
|
14415
|
-
variant: {
|
|
14416
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
14417
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
14418
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
14419
|
-
inlineLink: "text-base text-primary underline underline-offset-4",
|
|
14420
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
14421
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
14422
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
14423
|
-
}
|
|
14424
|
-
}
|
|
14425
|
-
}
|
|
14426
|
-
);
|
|
14427
|
-
cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
|
|
14428
|
-
const Comp = asChild ? reactSlot.Slot : "button";
|
|
14429
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
14430
|
-
Comp,
|
|
14431
|
-
{
|
|
14432
|
-
className: cn$1.cn(buttonVariants({ className, isMenu, size, variant })),
|
|
14433
|
-
ref,
|
|
14434
|
-
...props
|
|
14435
|
-
}
|
|
14436
|
-
);
|
|
14437
|
-
});
|
|
14438
14903
|
const inputVariants = classVarianceAuthority.cva(
|
|
14439
14904
|
"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",
|
|
14440
14905
|
{
|
|
@@ -14455,22 +14920,6 @@ flowchart TD
|
|
|
14455
14920
|
}
|
|
14456
14921
|
);
|
|
14457
14922
|
cn$1.withVariants("input", inputVariants, ["variant", "h"]);
|
|
14458
|
-
const popoverVariants = classVarianceAuthority.cva(
|
|
14459
|
-
"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"
|
|
14460
|
-
);
|
|
14461
|
-
cn$1.withRef(
|
|
14462
|
-
({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
|
|
14463
|
-
PopoverPrimitive__namespace.Content,
|
|
14464
|
-
{
|
|
14465
|
-
align,
|
|
14466
|
-
className: cn$1.cn(popoverVariants(), className),
|
|
14467
|
-
ref,
|
|
14468
|
-
sideOffset,
|
|
14469
|
-
style: { zIndex: 1e3, ...style },
|
|
14470
|
-
...props
|
|
14471
|
-
}
|
|
14472
|
-
))
|
|
14473
|
-
);
|
|
14474
14923
|
const floatingOptions = {
|
|
14475
14924
|
middleware: [
|
|
14476
14925
|
plateFloating.offset(12),
|
|
@@ -14530,7 +14979,7 @@ flowchart TD
|
|
|
14530
14979
|
const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex h-9 items-center gap-1" }, /* @__PURE__ */ React.createElement(
|
|
14531
14980
|
"button",
|
|
14532
14981
|
{
|
|
14533
|
-
className: buttonVariants({ size: "sm", variant: "ghost" }),
|
|
14982
|
+
className: buttonVariants$1({ size: "sm", variant: "ghost" }),
|
|
14534
14983
|
type: "button",
|
|
14535
14984
|
...editButtonProps
|
|
14536
14985
|
},
|
|
@@ -14538,7 +14987,7 @@ flowchart TD
|
|
|
14538
14987
|
), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
|
|
14539
14988
|
plateLink.LinkOpenButton,
|
|
14540
14989
|
{
|
|
14541
|
-
className: buttonVariants({
|
|
14990
|
+
className: buttonVariants$1({
|
|
14542
14991
|
size: "sms",
|
|
14543
14992
|
variant: "ghost"
|
|
14544
14993
|
})
|
|
@@ -14547,7 +14996,7 @@ flowchart TD
|
|
|
14547
14996
|
), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
|
|
14548
14997
|
"button",
|
|
14549
14998
|
{
|
|
14550
|
-
className: buttonVariants({
|
|
14999
|
+
className: buttonVariants$1({
|
|
14551
15000
|
size: "sms",
|
|
14552
15001
|
variant: "ghost"
|
|
14553
15002
|
}),
|
|
@@ -30744,8 +31193,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
30744
31193
|
}
|
|
30745
31194
|
)
|
|
30746
31195
|
}
|
|
30747
|
-
), !renderDesktopNav && /* @__PURE__ */ React.createElement(react
|
|
30748
|
-
react
|
|
31196
|
+
), !renderDesktopNav && /* @__PURE__ */ React.createElement(react.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
|
|
31197
|
+
react.TransitionChild,
|
|
30749
31198
|
{
|
|
30750
31199
|
enter: "transform transition-all ease-out duration-300",
|
|
30751
31200
|
enterFrom: "opacity-0 -translate-x-full",
|
|
@@ -30814,7 +31263,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
30814
31263
|
))
|
|
30815
31264
|
))
|
|
30816
31265
|
), /* @__PURE__ */ React.createElement(
|
|
30817
|
-
react
|
|
31266
|
+
react.TransitionChild,
|
|
30818
31267
|
{
|
|
30819
31268
|
enter: "ease-out duration-300",
|
|
30820
31269
|
enterFrom: "opacity-0",
|
|
@@ -31268,8 +31717,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31268
31717
|
folder,
|
|
31269
31718
|
collectionName
|
|
31270
31719
|
}) => {
|
|
31271
|
-
return /* @__PURE__ */ React.createElement(react
|
|
31272
|
-
react
|
|
31720
|
+
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(
|
|
31721
|
+
react.Transition,
|
|
31273
31722
|
{
|
|
31274
31723
|
enter: "transition ease-out duration-100",
|
|
31275
31724
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -31278,7 +31727,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31278
31727
|
leaveFrom: "transform opacity-100 scale-100",
|
|
31279
31728
|
leaveTo: "transform opacity-0 scale-95"
|
|
31280
31729
|
},
|
|
31281
|
-
/* @__PURE__ */ React.createElement(react
|
|
31730
|
+
/* @__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(
|
|
31282
31731
|
reactRouterDom.Link,
|
|
31283
31732
|
{
|
|
31284
31733
|
to: `/${folder.fullyQualifiedName ? [
|