tinacms 2.2.8 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +1 -1
- package/dist/client.mjs +1 -1
- package/dist/index.js +1553 -901
- package/dist/index.mjs +1522 -866
- package/dist/rich-text/index.d.ts +3 -0
- package/dist/rich-text/index.js +45 -12
- package/dist/rich-text/index.mjs +45 -12
- package/dist/toolkit/fields/components/reference/index.d.ts +1 -28
- package/dist/toolkit/fields/components/reference/model/reference-field-props.d.ts +2 -0
- package/dist/toolkit/fields/components/reference/utils/fetch-options-query-builder.d.ts +5 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/fixed-toolbar-buttons.d.ts +0 -4
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +2 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-element.d.ts +11 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +20 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/resizable.d.ts +39 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-cell-element.d.ts +27 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-dropdown-menu.d.ts +3 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-element.d.ts +14 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-row-element.d.ts +13 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/text-area.d.ts +5 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +1 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/custom/mermaid-plugin.d.ts +2 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +4 -2
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +58 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +7 -3
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +1 -1
- package/dist/toolkit/fields/plugins/reference-field-plugin.d.ts +2 -2
- package/package.json +8 -6
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,690 @@ 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
|
-
viewBox: "0 0 24 24",
|
|
916
|
-
height: "48",
|
|
917
|
-
width: "48",
|
|
918
|
-
focusable: "false",
|
|
919
|
-
role: "img",
|
|
920
|
-
fill: "currentColor",
|
|
921
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
922
|
-
...props
|
|
923
|
-
},
|
|
924
|
-
/* @__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" })
|
|
925
|
-
);
|
|
926
|
-
const borderBottom = (props) => /* @__PURE__ */ React.createElement(
|
|
927
|
-
"svg",
|
|
928
|
-
{
|
|
929
|
-
viewBox: "0 0 24 24",
|
|
930
|
-
height: "48",
|
|
931
|
-
width: "48",
|
|
932
|
-
focusable: "false",
|
|
933
|
-
role: "img",
|
|
934
|
-
fill: "currentColor",
|
|
935
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
936
|
-
...props
|
|
937
|
-
},
|
|
938
|
-
/* @__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" })
|
|
939
|
-
);
|
|
940
|
-
const borderLeft = (props) => /* @__PURE__ */ React.createElement(
|
|
941
|
-
"svg",
|
|
942
|
-
{
|
|
943
|
-
viewBox: "0 0 24 24",
|
|
944
|
-
height: "48",
|
|
945
|
-
width: "48",
|
|
946
|
-
focusable: "false",
|
|
947
|
-
role: "img",
|
|
948
|
-
fill: "currentColor",
|
|
949
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
950
|
-
...props
|
|
951
|
-
},
|
|
952
|
-
/* @__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" })
|
|
953
|
-
);
|
|
954
|
-
const borderNone = (props) => /* @__PURE__ */ React.createElement(
|
|
955
|
-
"svg",
|
|
956
|
-
{
|
|
957
|
-
viewBox: "0 0 24 24",
|
|
958
|
-
height: "48",
|
|
959
|
-
width: "48",
|
|
960
|
-
focusable: "false",
|
|
961
|
-
role: "img",
|
|
962
|
-
fill: "currentColor",
|
|
963
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
964
|
-
...props
|
|
965
|
-
},
|
|
966
|
-
/* @__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" })
|
|
967
|
-
);
|
|
968
|
-
const borderRight = (props) => /* @__PURE__ */ React.createElement(
|
|
969
|
-
"svg",
|
|
970
|
-
{
|
|
971
|
-
viewBox: "0 0 24 24",
|
|
972
|
-
height: "48",
|
|
973
|
-
width: "48",
|
|
974
|
-
focusable: "false",
|
|
975
|
-
role: "img",
|
|
976
|
-
fill: "currentColor",
|
|
977
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
978
|
-
...props
|
|
979
|
-
},
|
|
980
|
-
/* @__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" })
|
|
981
|
-
);
|
|
982
|
-
const borderTop = (props) => /* @__PURE__ */ React.createElement(
|
|
983
|
-
"svg",
|
|
984
|
-
{
|
|
985
|
-
viewBox: "0 0 24 24",
|
|
986
|
-
height: "48",
|
|
987
|
-
width: "48",
|
|
988
|
-
focusable: "false",
|
|
989
|
-
role: "img",
|
|
990
|
-
fill: "currentColor",
|
|
991
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
992
|
-
...props
|
|
993
|
-
},
|
|
994
|
-
/* @__PURE__ */ React.createElement("path", { d: "M3 6a1 1 0 0 0 2 0 1 1 0 0 1 1-1h12a1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3zm2 5a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-8 1a1 1 0 1 0 0-2 1 1 0 0 1-1-1 1 1 0 1 0-2 0 3 3 0 0 0 3 3zm11-1a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" })
|
|
995
|
-
);
|
|
996
|
-
classVarianceAuthority.cva("", {
|
|
997
|
-
variants: {
|
|
998
|
-
variant: {
|
|
999
|
-
toolbar: "size-5",
|
|
1000
|
-
menuItem: "mr-2 size-5"
|
|
1001
|
-
},
|
|
1002
|
-
size: {
|
|
1003
|
-
sm: "mr-2 size-4",
|
|
1004
|
-
md: "mr-2 size-6"
|
|
1005
|
-
}
|
|
1006
|
-
},
|
|
1007
|
-
defaultVariants: {}
|
|
987
|
+
MonacoEditor.loader.config({
|
|
988
|
+
paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
|
|
1008
989
|
});
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
{
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
/* @__PURE__ */ React.createElement(
|
|
1020
|
-
"path",
|
|
1021
|
-
{
|
|
1022
|
-
clipRule: "evenodd",
|
|
1023
|
-
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",
|
|
1024
|
-
fill: "#595E6F",
|
|
1025
|
-
fillRule: "evenodd"
|
|
1026
|
-
}
|
|
1027
|
-
)
|
|
1028
|
-
);
|
|
1029
|
-
const ThreeColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
|
|
1030
|
-
"svg",
|
|
1031
|
-
{
|
|
1032
|
-
fill: "none",
|
|
1033
|
-
height: "16",
|
|
1034
|
-
viewBox: "0 0 16 16",
|
|
1035
|
-
width: "16",
|
|
1036
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1037
|
-
...props
|
|
1038
|
-
},
|
|
1039
|
-
/* @__PURE__ */ React.createElement(
|
|
1040
|
-
"path",
|
|
1041
|
-
{
|
|
1042
|
-
clipRule: "evenodd",
|
|
1043
|
-
d: "M9.25 3H6.75V13H9.25V3ZM9.25 2H6.75H5.75H3C2.44772 2 2 2.44772 2 3V13C2 13.5523 2.44772 14 3 14H5.75H6.75H9.25H10.25H13C13.5523 14 14 13.5523 14 13V3C14 2.44772 13.5523 2 13 2H10.25H9.25ZM10.25 3V13H13V3H10.25ZM3 13H5.75V3H3L3 13Z",
|
|
1044
|
-
fill: "#4C5161",
|
|
1045
|
-
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);
|
|
1046
1000
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
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.init();
|
|
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)) {
|
|
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",
|
|
1569
|
+
width: "16",
|
|
1570
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1571
|
+
...props
|
|
1572
|
+
},
|
|
1573
|
+
/* @__PURE__ */ React.createElement(
|
|
1574
|
+
"path",
|
|
1575
|
+
{
|
|
1576
|
+
clipRule: "evenodd",
|
|
1577
|
+
d: "M9.25 3H6.75V13H9.25V3ZM9.25 2H6.75H5.75H3C2.44772 2 2 2.44772 2 3V13C2 13.5523 2.44772 14 3 14H5.75H6.75H9.25H10.25H13C13.5523 14 14 13.5523 14 13V3C14 2.44772 13.5523 2 13 2H10.25H9.25ZM10.25 3V13H13V3H10.25ZM3 13H5.75V3H3L3 13Z",
|
|
1578
|
+
fill: "#4C5161",
|
|
1579
|
+
fillRule: "evenodd"
|
|
1580
|
+
}
|
|
1581
|
+
)
|
|
1582
|
+
);
|
|
1583
|
+
const RightSideDoubleColumnOutlined = (props) => /* @__PURE__ */ React.createElement(
|
|
1584
|
+
"svg",
|
|
1585
|
+
{
|
|
1586
|
+
fill: "none",
|
|
1587
|
+
height: "16",
|
|
1588
|
+
viewBox: "0 0 16 16",
|
|
1589
|
+
width: "16",
|
|
1590
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1591
|
+
...props
|
|
1058
1592
|
},
|
|
1059
1593
|
/* @__PURE__ */ React.createElement(
|
|
1060
1594
|
"path",
|
|
@@ -1149,6 +1683,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1149
1683
|
clear: lucideReact.X,
|
|
1150
1684
|
close: lucideReact.X,
|
|
1151
1685
|
// code: Code2,
|
|
1686
|
+
paint: lucideReact.PaintBucket,
|
|
1152
1687
|
codeblock: lucideReact.FileCode,
|
|
1153
1688
|
color: lucideReact.Baseline,
|
|
1154
1689
|
column: lucideReact.RectangleVertical,
|
|
@@ -1174,6 +1709,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1174
1709
|
lineHeight: lucideReact.WrapText,
|
|
1175
1710
|
// link: Link2,
|
|
1176
1711
|
minus: lucideReact.Minus,
|
|
1712
|
+
mermaid: MermaidIcon,
|
|
1177
1713
|
more: lucideReact.MoreHorizontal,
|
|
1178
1714
|
// ol: ListOrdered,
|
|
1179
1715
|
outdent: lucideReact.Outdent,
|
|
@@ -1548,7 +2084,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1548
2084
|
setHasEmpty
|
|
1549
2085
|
]
|
|
1550
2086
|
);
|
|
1551
|
-
const store = react.useComboboxStore({
|
|
2087
|
+
const store = react$1.useComboboxStore({
|
|
1552
2088
|
setValue: (newValue) => React.startTransition(() => setValue(newValue))
|
|
1553
2089
|
});
|
|
1554
2090
|
const items2 = store.useState("items");
|
|
@@ -1558,7 +2094,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1558
2094
|
}
|
|
1559
2095
|
}, [items2, store]);
|
|
1560
2096
|
return /* @__PURE__ */ React.createElement("span", { contentEditable: false }, /* @__PURE__ */ React.createElement(
|
|
1561
|
-
react.ComboboxProvider,
|
|
2097
|
+
react$1.ComboboxProvider,
|
|
1562
2098
|
{
|
|
1563
2099
|
open: (items2.length > 0 || hasEmpty) && (!hideWhenNoValue || value.length > 0),
|
|
1564
2100
|
store
|
|
@@ -1573,7 +2109,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1573
2109
|
showTrigger,
|
|
1574
2110
|
trigger
|
|
1575
2111
|
} = React.useContext(InlineComboboxContext);
|
|
1576
|
-
const store = react.useComboboxContext();
|
|
2112
|
+
const store = react$1.useComboboxContext();
|
|
1577
2113
|
const value = store.useState("value");
|
|
1578
2114
|
const ref = plateCommon.useComposedRef(propRef, contextRef);
|
|
1579
2115
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, showTrigger && trigger, /* @__PURE__ */ React.createElement("span", { className: "relative min-h-[1lh]" }, /* @__PURE__ */ React.createElement(
|
|
@@ -1584,7 +2120,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1584
2120
|
},
|
|
1585
2121
|
value || ""
|
|
1586
2122
|
), /* @__PURE__ */ React.createElement(
|
|
1587
|
-
react.Combobox,
|
|
2123
|
+
react$1.Combobox,
|
|
1588
2124
|
{
|
|
1589
2125
|
autoSelect: true,
|
|
1590
2126
|
className: cn$1.cn(
|
|
@@ -1603,8 +2139,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1603
2139
|
className,
|
|
1604
2140
|
...props
|
|
1605
2141
|
}) => {
|
|
1606
|
-
return /* @__PURE__ */ React.createElement(react.Portal, null, /* @__PURE__ */ React.createElement(
|
|
1607
|
-
react.ComboboxPopover,
|
|
2142
|
+
return /* @__PURE__ */ React.createElement(react$1.Portal, null, /* @__PURE__ */ React.createElement(
|
|
2143
|
+
react$1.ComboboxPopover,
|
|
1608
2144
|
{
|
|
1609
2145
|
className: cn$1.cn(
|
|
1610
2146
|
"z-[9999999] max-h-[288px] w-[300px] overflow-y-auto rounded-md bg-white shadow-md",
|
|
@@ -1636,7 +2172,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1636
2172
|
}) => {
|
|
1637
2173
|
const { value } = props;
|
|
1638
2174
|
const { filter, removeInput } = React.useContext(InlineComboboxContext);
|
|
1639
|
-
const store = react.useComboboxContext();
|
|
2175
|
+
const store = react$1.useComboboxContext();
|
|
1640
2176
|
const search = filter && store.useState("value");
|
|
1641
2177
|
const visible = React.useMemo(
|
|
1642
2178
|
() => !filter || filter({ keywords, value }, search),
|
|
@@ -1645,7 +2181,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1645
2181
|
if (!visible)
|
|
1646
2182
|
return null;
|
|
1647
2183
|
return /* @__PURE__ */ React.createElement(
|
|
1648
|
-
react.ComboboxItem,
|
|
2184
|
+
react$1.ComboboxItem,
|
|
1649
2185
|
{
|
|
1650
2186
|
className: cn$1.cn(comboboxItemVariants(), className),
|
|
1651
2187
|
onClick: (event) => {
|
|
@@ -1661,7 +2197,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1661
2197
|
className
|
|
1662
2198
|
}) => {
|
|
1663
2199
|
const { setHasEmpty } = React.useContext(InlineComboboxContext);
|
|
1664
|
-
const store = react.useComboboxContext();
|
|
2200
|
+
const store = react$1.useComboboxContext();
|
|
1665
2201
|
const items2 = store.useState("items");
|
|
1666
2202
|
React.useEffect(() => {
|
|
1667
2203
|
setHasEmpty(true);
|
|
@@ -1744,417 +2280,482 @@ var __publicField = (obj, key, value) => {
|
|
|
1744
2280
|
);
|
|
1745
2281
|
}
|
|
1746
2282
|
);
|
|
1747
|
-
const
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
className: cn$1.cn("my-1 border-l-2 pl-6 italic", className),
|
|
1771
|
-
ref,
|
|
1772
|
-
...props
|
|
1773
|
-
},
|
|
1774
|
-
/* @__PURE__ */ React.createElement("blockquote", null, children)
|
|
1775
|
-
);
|
|
1776
|
-
}
|
|
1777
|
-
);
|
|
1778
|
-
const CodeLeaf = cn$1.withRef(
|
|
1779
|
-
({ children, className, ...props }, ref) => {
|
|
1780
|
-
return /* @__PURE__ */ React.createElement(
|
|
1781
|
-
plateCommon.PlateLeaf,
|
|
1782
|
-
{
|
|
1783
|
-
asChild: true,
|
|
1784
|
-
className: cn$1.cn(
|
|
1785
|
-
"whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
|
|
1786
|
-
className
|
|
1787
|
-
),
|
|
1788
|
-
ref,
|
|
1789
|
-
...props
|
|
1790
|
-
},
|
|
1791
|
-
/* @__PURE__ */ React.createElement("code", null, children)
|
|
1792
|
-
);
|
|
1793
|
-
}
|
|
1794
|
-
);
|
|
1795
|
-
const CodeLineElement = cn$1.withRef((props, ref) => /* @__PURE__ */ React.createElement(plateCommon.PlateElement, { ref, ...props }));
|
|
1796
|
-
const CodeSyntaxLeaf = cn$1.withRef(
|
|
1797
|
-
({ children, ...props }, ref) => {
|
|
1798
|
-
const { leaf } = props;
|
|
1799
|
-
const { tokenProps } = plateCodeBlock.useCodeSyntaxLeaf({ leaf });
|
|
1800
|
-
return /* @__PURE__ */ React.createElement(plateCommon.PlateLeaf, { ref, ...props }, /* @__PURE__ */ React.createElement("span", { ...tokenProps }, children));
|
|
1801
|
-
}
|
|
1802
|
-
);
|
|
1803
|
-
function ChevronDownIcon(props, svgRef) {
|
|
1804
|
-
return /* @__PURE__ */ React__namespace.createElement("svg", Object.assign({
|
|
1805
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1806
|
-
viewBox: "0 0 20 20",
|
|
1807
|
-
fill: "currentColor",
|
|
1808
|
-
"aria-hidden": "true",
|
|
1809
|
-
ref: svgRef
|
|
1810
|
-
}, props), /* @__PURE__ */ React__namespace.createElement("path", {
|
|
1811
|
-
fillRule: "evenodd",
|
|
1812
|
-
d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
|
|
1813
|
-
clipRule: "evenodd"
|
|
1814
|
-
}));
|
|
1815
|
-
}
|
|
1816
|
-
const ForwardRef = React__namespace.forwardRef(ChevronDownIcon);
|
|
1817
|
-
const ChevronDownIcon$1 = ForwardRef;
|
|
1818
|
-
const Autocomplete = ({
|
|
1819
|
-
value,
|
|
1820
|
-
onChange,
|
|
1821
|
-
defaultQuery,
|
|
1822
|
-
items: items2
|
|
1823
|
-
}) => {
|
|
1824
|
-
const [query, setQuery] = React.useState(defaultQuery ?? "");
|
|
1825
|
-
const filteredItems = React.useMemo(() => {
|
|
1826
|
-
try {
|
|
1827
|
-
const reFilter = new RegExp(query, "i");
|
|
1828
|
-
const _items = items2.filter((item) => reFilter.test(item.label));
|
|
1829
|
-
if (_items.length === 0)
|
|
1830
|
-
return items2;
|
|
1831
|
-
return _items;
|
|
1832
|
-
} catch (err) {
|
|
1833
|
-
return items2;
|
|
1834
|
-
}
|
|
1835
|
-
}, [items2, query]);
|
|
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";
|
|
1836
2306
|
return /* @__PURE__ */ React.createElement(
|
|
1837
|
-
|
|
2307
|
+
plateCommon.PlateElement,
|
|
1838
2308
|
{
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
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
|
|
1851
2334
|
}
|
|
1852
|
-
|
|
1853
|
-
|
|
2335
|
+
},
|
|
2336
|
+
/* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(
|
|
2337
|
+
"div",
|
|
1854
2338
|
{
|
|
1855
|
-
className: "h-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
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",
|
|
1861
2347
|
{
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
leave: "transition ease-in duration-75",
|
|
1866
|
-
leaveFrom: "transform opacity-100 scale-100",
|
|
1867
|
-
leaveTo: "transform opacity-0 scale-95"
|
|
2348
|
+
className: "group absolute top-0 size-full select-none",
|
|
2349
|
+
contentEditable: false,
|
|
2350
|
+
suppressContentEditableWarning: true
|
|
1868
2351
|
},
|
|
1869
|
-
|
|
1870
|
-
|
|
2352
|
+
!readOnly && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2353
|
+
plateResizable.ResizeHandle,
|
|
1871
2354
|
{
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
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]"
|
|
1875
2376
|
)
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
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
|
+
))
|
|
1880
2388
|
);
|
|
1881
|
-
};
|
|
1882
|
-
MonacoEditor.loader.config({
|
|
1883
|
-
paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
|
|
1884
2389
|
});
|
|
1885
|
-
|
|
1886
|
-
const
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
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
|
+
}
|
|
1913
2423
|
}
|
|
1914
|
-
}, [selected, monacoEditorRef.current]);
|
|
1915
|
-
const value = element.value || "";
|
|
1916
|
-
if (typeof value !== "string") {
|
|
1917
|
-
throw new Error("Element must be of type string for code block");
|
|
1918
2424
|
}
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
const
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
return { ...ac, [cv.id]: cv.id };
|
|
1929
|
-
}, defaultLangSet);
|
|
1930
|
-
}, [monaco]);
|
|
1931
|
-
React.useEffect(() => {
|
|
1932
|
-
if (monaco) {
|
|
1933
|
-
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
1934
|
-
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
1935
|
-
// disable errors
|
|
1936
|
-
noSemanticValidation: true,
|
|
1937
|
-
noSyntaxValidation: true
|
|
1938
|
-
});
|
|
2425
|
+
);
|
|
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
|
|
1939
2434
|
}
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
{
|
|
1983
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
1984
|
-
children: [{ text: "" }],
|
|
1985
|
-
lang: void 0,
|
|
1986
|
-
value: void 0
|
|
1987
|
-
}
|
|
1988
|
-
],
|
|
1989
|
-
{ select: true }
|
|
1990
|
-
);
|
|
1991
|
-
plateCommon.focusEditor(editor);
|
|
1992
|
-
}
|
|
1993
|
-
break;
|
|
1994
|
-
case "up":
|
|
1995
|
-
{
|
|
1996
|
-
const path = plateCommon.findNodePath(editor, element);
|
|
1997
|
-
if (!path) {
|
|
1998
|
-
return;
|
|
1999
|
-
}
|
|
2000
|
-
const previousNodePath = plateCommon.getPointBefore(editor, path);
|
|
2001
|
-
if (!previousNodePath) {
|
|
2002
|
-
plateCommon.focusEditor(editor);
|
|
2003
|
-
plateCommon.insertNodes(
|
|
2004
|
-
editor,
|
|
2005
|
-
[
|
|
2006
|
-
{
|
|
2007
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
2008
|
-
children: [{ text: "" }],
|
|
2009
|
-
lang: void 0,
|
|
2010
|
-
value: void 0
|
|
2011
|
-
}
|
|
2012
|
-
],
|
|
2013
|
-
// Insert a new node at the current path, resulting in the code_block
|
|
2014
|
-
// moving down one block
|
|
2015
|
-
{ at: path, select: true }
|
|
2016
|
-
);
|
|
2017
|
-
return;
|
|
2018
|
-
}
|
|
2019
|
-
plateCommon.focusEditor(editor, previousNodePath);
|
|
2020
|
-
}
|
|
2021
|
-
break;
|
|
2022
|
-
case "down": {
|
|
2023
|
-
const path = plateCommon.findNodePath(editor, element);
|
|
2024
|
-
if (!path) {
|
|
2025
|
-
return;
|
|
2026
|
-
}
|
|
2027
|
-
const nextNodePath = plateCommon.getPointAfter(editor, path);
|
|
2028
|
-
if (!nextNodePath) {
|
|
2029
|
-
plateCommon.insertNodes(
|
|
2030
|
-
editor,
|
|
2031
|
-
[
|
|
2032
|
-
{
|
|
2033
|
-
type: plateCommon.ELEMENT_DEFAULT,
|
|
2034
|
-
children: [{ text: "" }],
|
|
2035
|
-
lang: void 0,
|
|
2036
|
-
value: void 0
|
|
2037
|
-
}
|
|
2038
|
-
],
|
|
2039
|
-
{ select: true }
|
|
2040
|
-
);
|
|
2041
|
-
plateCommon.focusEditor(editor);
|
|
2042
|
-
} else {
|
|
2043
|
-
plateCommon.focusEditor(editor, nextNodePath);
|
|
2044
|
-
}
|
|
2045
|
-
break;
|
|
2046
|
-
}
|
|
2435
|
+
);
|
|
2436
|
+
});
|
|
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"
|
|
2047
2477
|
}
|
|
2048
2478
|
}
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
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"
|
|
2080
2520
|
}
|
|
2081
|
-
}
|
|
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
|
+
);
|
|
2545
|
+
return {
|
|
2546
|
+
onOpenChange,
|
|
2547
|
+
open: open2
|
|
2548
|
+
};
|
|
2549
|
+
};
|
|
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
|
|
2564
|
+
}
|
|
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
|
+
}
|
|
2082
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();
|
|
2083
2595
|
return /* @__PURE__ */ React.createElement(
|
|
2084
|
-
|
|
2596
|
+
DropdownMenuContent,
|
|
2085
2597
|
{
|
|
2086
|
-
|
|
2087
|
-
className: "
|
|
2598
|
+
align: "start",
|
|
2599
|
+
className: cn$1.cn("min-w-[220px]"),
|
|
2600
|
+
ref,
|
|
2601
|
+
side: "right",
|
|
2602
|
+
sideOffset: 0,
|
|
2603
|
+
...props
|
|
2088
2604
|
},
|
|
2089
|
-
/* @__PURE__ */ React.createElement(
|
|
2090
|
-
|
|
2091
|
-
visibility: hidden !important;
|
|
2092
|
-
}`),
|
|
2093
|
-
props.children,
|
|
2094
|
-
/* @__PURE__ */ React.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement(
|
|
2095
|
-
Autocomplete,
|
|
2605
|
+
/* @__PURE__ */ React.createElement(
|
|
2606
|
+
DropdownMenuCheckboxItem,
|
|
2096
2607
|
{
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
)
|
|
2103
|
-
|
|
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,
|
|
2104
2616
|
{
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
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
|
+
)
|
|
2141
2660
|
);
|
|
2142
|
-
};
|
|
2143
|
-
const
|
|
2144
|
-
({
|
|
2145
|
-
const
|
|
2146
|
-
const
|
|
2147
|
-
|
|
2148
|
-
plateCommon.
|
|
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,
|
|
2678
|
+
{
|
|
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,
|
|
2689
|
+
{
|
|
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,
|
|
2149
2701
|
{
|
|
2150
|
-
className: cn$1.cn(
|
|
2702
|
+
className: cn$1.cn(
|
|
2703
|
+
popoverVariants(),
|
|
2704
|
+
"flex w-[220px] flex-col gap-1 p-1"
|
|
2705
|
+
),
|
|
2706
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2151
2707
|
ref,
|
|
2152
2708
|
...props
|
|
2153
2709
|
},
|
|
2154
|
-
|
|
2155
|
-
|
|
2710
|
+
unmergeButton,
|
|
2711
|
+
mergeContent,
|
|
2712
|
+
bordersContent
|
|
2713
|
+
));
|
|
2156
2714
|
}
|
|
2157
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
|
+
});
|
|
2158
2759
|
const blockClasses = "mt-0.5";
|
|
2159
2760
|
const headerClasses = "font-normal";
|
|
2160
2761
|
const Components = () => {
|
|
@@ -2260,6 +2861,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2260
2861
|
}
|
|
2261
2862
|
)
|
|
2262
2863
|
),
|
|
2864
|
+
[ELEMENT_MERMAID]: MermaidElement,
|
|
2263
2865
|
[plate.ELEMENT_BLOCKQUOTE]: BlockquoteElement,
|
|
2264
2866
|
[plate.ELEMENT_CODE_BLOCK]: CodeBlockElement,
|
|
2265
2867
|
[plate.ELEMENT_CODE_LINE]: CodeLineElement,
|
|
@@ -2340,7 +2942,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2340
2942
|
children,
|
|
2341
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" })
|
|
2342
2944
|
);
|
|
2343
|
-
}
|
|
2945
|
+
},
|
|
2946
|
+
[plate.ELEMENT_TABLE]: TableElement,
|
|
2947
|
+
[plate.ELEMENT_TR]: TableRowElement,
|
|
2948
|
+
[plate.ELEMENT_TD]: TableCellElement,
|
|
2949
|
+
[plate.ELEMENT_TH]: TableCellHeaderElement
|
|
2344
2950
|
};
|
|
2345
2951
|
};
|
|
2346
2952
|
const createCodeBlockPlugin = plateCommon.createPluginFactory({
|
|
@@ -2750,7 +3356,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2750
3356
|
{
|
|
2751
3357
|
type: "string",
|
|
2752
3358
|
label: "Caption",
|
|
2753
|
-
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
3359
|
+
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
3360
|
+
"."
|
|
3361
|
+
),
|
|
2754
3362
|
component: "text"
|
|
2755
3363
|
}
|
|
2756
3364
|
]
|
|
@@ -4410,7 +5018,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4410
5018
|
function cn(...inputs) {
|
|
4411
5019
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
4412
5020
|
}
|
|
4413
|
-
const buttonVariants
|
|
5021
|
+
const buttonVariants = classVarianceAuthority.cva(
|
|
4414
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",
|
|
4415
5023
|
{
|
|
4416
5024
|
variants: {
|
|
@@ -4436,7 +5044,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4436
5044
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
4437
5045
|
Comp,
|
|
4438
5046
|
{
|
|
4439
|
-
className: cn(buttonVariants
|
|
5047
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
4440
5048
|
ref,
|
|
4441
5049
|
...props
|
|
4442
5050
|
}
|
|
@@ -4549,19 +5157,32 @@ var __publicField = (obj, key, value) => {
|
|
|
4549
5157
|
}
|
|
4550
5158
|
)));
|
|
4551
5159
|
PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
|
|
4552
|
-
const
|
|
5160
|
+
const filterQueryBuilder = (fieldFilterConfig, collection) => {
|
|
5161
|
+
return {
|
|
5162
|
+
[collection]: Object.entries(fieldFilterConfig).reduce(
|
|
5163
|
+
(acc, [key, value]) => {
|
|
5164
|
+
acc[key] = { in: value };
|
|
5165
|
+
return acc;
|
|
5166
|
+
},
|
|
5167
|
+
{}
|
|
5168
|
+
)
|
|
5169
|
+
};
|
|
5170
|
+
};
|
|
5171
|
+
const useGetOptionSets = (cms, collections, collectionFilter) => {
|
|
4553
5172
|
const [optionSets, setOptionSets] = React__namespace.useState([]);
|
|
4554
5173
|
const [loading, setLoading] = React__namespace.useState(true);
|
|
4555
5174
|
React__namespace.useEffect(() => {
|
|
4556
5175
|
const fetchOptionSets = async () => {
|
|
5176
|
+
const filters = typeof collectionFilter === "function" ? collectionFilter() : collectionFilter;
|
|
4557
5177
|
const optionSets2 = await Promise.all(
|
|
4558
5178
|
collections.map(async (collection) => {
|
|
4559
5179
|
try {
|
|
5180
|
+
const filter = (filters == null ? void 0 : filters[collection]) ? filterQueryBuilder(filters[collection], collection) : {};
|
|
4560
5181
|
const response = await cms.api.tina.request(
|
|
4561
5182
|
`#graphql
|
|
4562
|
-
query ($collection: String
|
|
5183
|
+
query ($collection: String!, $filter: DocumentFilter) {
|
|
4563
5184
|
collection(collection: $collection) {
|
|
4564
|
-
documents(first: -1) {
|
|
5185
|
+
documents(first: -1, filter: $filter) {
|
|
4565
5186
|
edges {
|
|
4566
5187
|
node {
|
|
4567
5188
|
...on Node {
|
|
@@ -4580,13 +5201,22 @@ var __publicField = (obj, key, value) => {
|
|
|
4580
5201
|
}
|
|
4581
5202
|
}
|
|
4582
5203
|
`,
|
|
4583
|
-
{
|
|
5204
|
+
{
|
|
5205
|
+
variables: {
|
|
5206
|
+
collection,
|
|
5207
|
+
filter
|
|
5208
|
+
}
|
|
5209
|
+
}
|
|
4584
5210
|
);
|
|
4585
5211
|
return {
|
|
4586
5212
|
collection,
|
|
4587
5213
|
edges: response.collection.documents.edges
|
|
4588
5214
|
};
|
|
4589
5215
|
} catch (e) {
|
|
5216
|
+
console.error(
|
|
5217
|
+
"Exception thrown while building and running GraphQL query: ",
|
|
5218
|
+
e
|
|
5219
|
+
);
|
|
4590
5220
|
return {
|
|
4591
5221
|
collection,
|
|
4592
5222
|
edges: []
|
|
@@ -4620,7 +5250,11 @@ var __publicField = (obj, key, value) => {
|
|
|
4620
5250
|
const [open2, setOpen] = React__namespace.useState(false);
|
|
4621
5251
|
const [value, setValue] = React__namespace.useState(input.value);
|
|
4622
5252
|
const [displayText, setDisplayText] = React__namespace.useState(null);
|
|
4623
|
-
const { optionSets, loading } = useGetOptionSets(
|
|
5253
|
+
const { optionSets, loading } = useGetOptionSets(
|
|
5254
|
+
cms,
|
|
5255
|
+
field.collections,
|
|
5256
|
+
field.collectionFilter
|
|
5257
|
+
);
|
|
4624
5258
|
const [filteredOptionsList, setFilteredOptionsList] = React__namespace.useState(optionSets);
|
|
4625
5259
|
React__namespace.useEffect(() => {
|
|
4626
5260
|
setDisplayText(getFilename(optionSets, value));
|
|
@@ -5109,7 +5743,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5109
5743
|
return template.label ? template.label.toLowerCase().includes(filter.toLowerCase()) || name.toLowerCase().includes(filter.toLowerCase()) : name.toLowerCase().includes(filter.toLowerCase());
|
|
5110
5744
|
});
|
|
5111
5745
|
}, [filter]);
|
|
5112
|
-
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(
|
|
5113
5747
|
IconButton,
|
|
5114
5748
|
{
|
|
5115
5749
|
variant: open2 ? "secondary" : "primary",
|
|
@@ -5118,7 +5752,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5118
5752
|
},
|
|
5119
5753
|
/* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
|
|
5120
5754
|
)), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute -bottom-1 right-0 z-50" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5121
|
-
react
|
|
5755
|
+
react.Transition,
|
|
5122
5756
|
{
|
|
5123
5757
|
enter: "transition duration-150 ease-out",
|
|
5124
5758
|
enterFrom: "transform opacity-0 -translate-y-2",
|
|
@@ -5127,7 +5761,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5127
5761
|
leaveFrom: "transform opacity-100 translate-y-0",
|
|
5128
5762
|
leaveTo: "transform opacity-0 -translate-y-2"
|
|
5129
5763
|
},
|
|
5130
|
-
/* @__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(
|
|
5131
5765
|
"input",
|
|
5132
5766
|
{
|
|
5133
5767
|
type: "text",
|
|
@@ -5304,8 +5938,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5304
5938
|
onClick: () => setPickerIsOpen(!pickerIsOpen)
|
|
5305
5939
|
},
|
|
5306
5940
|
/* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
|
|
5307
|
-
), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react
|
|
5308
|
-
react
|
|
5941
|
+
), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: pickerIsOpen }, /* @__PURE__ */ React__namespace.createElement(
|
|
5942
|
+
react.TransitionChild,
|
|
5309
5943
|
{
|
|
5310
5944
|
enter: "transform transition-all ease-out duration-200",
|
|
5311
5945
|
enterFrom: "opacity-0 -translate-x-1/2",
|
|
@@ -5392,14 +6026,14 @@ var __publicField = (obj, key, value) => {
|
|
|
5392
6026
|
};
|
|
5393
6027
|
const BlockGroup = ({ category, templates, close: close2, isLast = false }) => {
|
|
5394
6028
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
5395
|
-
react
|
|
6029
|
+
react.Disclosure,
|
|
5396
6030
|
{
|
|
5397
6031
|
defaultOpen: true,
|
|
5398
6032
|
as: "div",
|
|
5399
6033
|
className: `left-0 right-0 relative`
|
|
5400
6034
|
},
|
|
5401
6035
|
({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5402
|
-
react
|
|
6036
|
+
react.DisclosureButton,
|
|
5403
6037
|
{
|
|
5404
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`}`
|
|
5405
6039
|
},
|
|
@@ -5417,7 +6051,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5417
6051
|
}
|
|
5418
6052
|
)
|
|
5419
6053
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
5420
|
-
react
|
|
6054
|
+
react.Transition,
|
|
5421
6055
|
{
|
|
5422
6056
|
enter: "transition duration-100 ease-out",
|
|
5423
6057
|
enterFrom: "transform scale-95 opacity-0",
|
|
@@ -5426,7 +6060,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5426
6060
|
leaveFrom: "transform scale-100 opacity-100",
|
|
5427
6061
|
leaveTo: "transform scale-95 opacity-0"
|
|
5428
6062
|
},
|
|
5429
|
-
/* @__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(
|
|
5430
6064
|
BlockCard,
|
|
5431
6065
|
{
|
|
5432
6066
|
key: index,
|
|
@@ -9245,7 +9879,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9245
9879
|
const FormLists = (props) => {
|
|
9246
9880
|
const cms = useCMS();
|
|
9247
9881
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
9248
|
-
react
|
|
9882
|
+
react.Transition,
|
|
9249
9883
|
{
|
|
9250
9884
|
appear: true,
|
|
9251
9885
|
show: true,
|
|
@@ -9674,7 +10308,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9674
10308
|
"Event Log"
|
|
9675
10309
|
));
|
|
9676
10310
|
};
|
|
9677
|
-
const version = "2.
|
|
10311
|
+
const version = "2.3.0";
|
|
9678
10312
|
const Nav = ({
|
|
9679
10313
|
isLocalMode,
|
|
9680
10314
|
className = "",
|
|
@@ -9728,8 +10362,8 @@ var __publicField = (obj, key, value) => {
|
|
|
9728
10362
|
style: { maxWidth: `${sidebarWidth}px` },
|
|
9729
10363
|
...props
|
|
9730
10364
|
},
|
|
9731
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "border-b border-gray-200" }, /* @__PURE__ */ React__namespace.createElement(react
|
|
9732
|
-
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,
|
|
9733
10367
|
{
|
|
9734
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"}`
|
|
9735
10369
|
},
|
|
@@ -9752,7 +10386,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9752
10386
|
}
|
|
9753
10387
|
)
|
|
9754
10388
|
), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute bottom-3 right-5 z-50" }, /* @__PURE__ */ React__namespace.createElement(
|
|
9755
|
-
react
|
|
10389
|
+
react.Transition,
|
|
9756
10390
|
{
|
|
9757
10391
|
enter: "transition duration-150 ease-out",
|
|
9758
10392
|
enterFrom: "transform opacity-0 -translate-y-2",
|
|
@@ -9761,7 +10395,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9761
10395
|
leaveFrom: "transform opacity-100 translate-y-0",
|
|
9762
10396
|
leaveTo: "transform opacity-0 -translate-y-2"
|
|
9763
10397
|
},
|
|
9764
|
-
/* @__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(
|
|
9765
10399
|
"button",
|
|
9766
10400
|
{
|
|
9767
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`,
|
|
@@ -9794,7 +10428,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9794
10428
|
},
|
|
9795
10429
|
/* @__PURE__ */ React__namespace.createElement(BiExit, { className: "w-6 h-auto mr-2 text-blue-400" }),
|
|
9796
10430
|
" Log Out"
|
|
9797
|
-
)), /* @__PURE__ */ React__namespace.createElement(react
|
|
10431
|
+
)), /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
|
|
9798
10432
|
WrappedSyncStatus,
|
|
9799
10433
|
{
|
|
9800
10434
|
cms,
|
|
@@ -10140,8 +10774,8 @@ var __publicField = (obj, key, value) => {
|
|
|
10140
10774
|
screen: activeScreen,
|
|
10141
10775
|
close: () => setActiveView(null)
|
|
10142
10776
|
}
|
|
10143
|
-
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react
|
|
10144
|
-
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,
|
|
10145
10779
|
{
|
|
10146
10780
|
enter: "transform transition-all ease-out duration-300",
|
|
10147
10781
|
enterFrom: "opacity-0 -translate-x-full",
|
|
@@ -10206,7 +10840,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10206
10840
|
))
|
|
10207
10841
|
))
|
|
10208
10842
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
10209
|
-
react
|
|
10843
|
+
react.TransitionChild,
|
|
10210
10844
|
{
|
|
10211
10845
|
enter: "ease-out duration-300",
|
|
10212
10846
|
enterFrom: "opacity-0",
|
|
@@ -12741,15 +13375,15 @@ var __publicField = (obj, key, value) => {
|
|
|
12741
13375
|
);
|
|
12742
13376
|
};
|
|
12743
13377
|
const DotMenu = ({ onOpen, onRemove }) => {
|
|
12744
|
-
return /* @__PURE__ */ React.createElement(react
|
|
12745
|
-
react
|
|
13378
|
+
return /* @__PURE__ */ React.createElement(react.Popover, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React.createElement(
|
|
13379
|
+
react.PopoverButton,
|
|
12746
13380
|
{
|
|
12747
13381
|
as: "span",
|
|
12748
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"
|
|
12749
13383
|
},
|
|
12750
13384
|
/* @__PURE__ */ React.createElement(EllipsisIcon, { title: "Open options" })
|
|
12751
13385
|
), /* @__PURE__ */ React.createElement(
|
|
12752
|
-
react
|
|
13386
|
+
react.Transition,
|
|
12753
13387
|
{
|
|
12754
13388
|
enter: "transition ease-out duration-100",
|
|
12755
13389
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -12758,7 +13392,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12758
13392
|
leaveFrom: "transform opacity-100 scale-100",
|
|
12759
13393
|
leaveTo: "transform opacity-0 scale-95"
|
|
12760
13394
|
},
|
|
12761
|
-
/* @__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(
|
|
12762
13396
|
"span",
|
|
12763
13397
|
{
|
|
12764
13398
|
onClick: onOpen,
|
|
@@ -13181,13 +13815,26 @@ var __publicField = (obj, key, value) => {
|
|
|
13181
13815
|
plate.createUnderlinePlugin(),
|
|
13182
13816
|
plate.createCodePlugin(),
|
|
13183
13817
|
plate.createListPlugin(),
|
|
13184
|
-
plate.createIndentPlugin(),
|
|
13185
13818
|
plate.createIndentListPlugin(),
|
|
13186
13819
|
plate.createHorizontalRulePlugin(),
|
|
13187
13820
|
// Allows us to do things like copy/paste, remembering the state of the element (like mdx)
|
|
13188
13821
|
plate.createNodeIdPlugin(),
|
|
13189
|
-
plateSlashCommand.createSlashPlugin()
|
|
13822
|
+
plateSlashCommand.createSlashPlugin(),
|
|
13823
|
+
plate.createTablePlugin()
|
|
13190
13824
|
];
|
|
13825
|
+
const unsupportedItemsInTable = /* @__PURE__ */ new Set([
|
|
13826
|
+
"Code Block",
|
|
13827
|
+
"Unordered List",
|
|
13828
|
+
"Ordered List",
|
|
13829
|
+
"Quote",
|
|
13830
|
+
"Mermaid",
|
|
13831
|
+
"Heading 1",
|
|
13832
|
+
"Heading 2",
|
|
13833
|
+
"Heading 3",
|
|
13834
|
+
"Heading 4",
|
|
13835
|
+
"Heading 5",
|
|
13836
|
+
"Heading 6"
|
|
13837
|
+
]);
|
|
13191
13838
|
const isNodeActive = (editor, type) => {
|
|
13192
13839
|
const pluginType = plateCommon.getPluginType(editor, type);
|
|
13193
13840
|
return !!(editor == null ? void 0 : editor.selection) && plateCommon.someNode(editor, { match: { type: pluginType } });
|
|
@@ -13372,24 +14019,6 @@ var __publicField = (obj, key, value) => {
|
|
|
13372
14019
|
}
|
|
13373
14020
|
);
|
|
13374
14021
|
Editor.displayName = "Editor";
|
|
13375
|
-
const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
|
|
13376
|
-
defaultVariants: {
|
|
13377
|
-
orientation: "horizontal"
|
|
13378
|
-
},
|
|
13379
|
-
variants: {
|
|
13380
|
-
orientation: {
|
|
13381
|
-
horizontal: "h-px w-full",
|
|
13382
|
-
vertical: "h-full w-px"
|
|
13383
|
-
}
|
|
13384
|
-
}
|
|
13385
|
-
});
|
|
13386
|
-
const Separator = cn$1.withVariants(
|
|
13387
|
-
cn$1.withProps(SeparatorPrimitive__namespace.Root, {
|
|
13388
|
-
decorative: true,
|
|
13389
|
-
orientation: "horizontal"
|
|
13390
|
-
}),
|
|
13391
|
-
separatorVariants
|
|
13392
|
-
);
|
|
13393
14022
|
const TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
13394
14023
|
const Tooltip = TooltipPrimitive__namespace.Root;
|
|
13395
14024
|
const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
@@ -13398,7 +14027,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13398
14027
|
cn$1.withProps(TooltipPrimitive__namespace.Content, {
|
|
13399
14028
|
sideOffset: 4
|
|
13400
14029
|
}),
|
|
13401
|
-
"z-
|
|
14030
|
+
"z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
|
|
13402
14031
|
);
|
|
13403
14032
|
function withTooltip(Component) {
|
|
13404
14033
|
return React.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
|
|
@@ -13524,140 +14153,41 @@ var __publicField = (obj, key, value) => {
|
|
|
13524
14153
|
Toolbar,
|
|
13525
14154
|
"p-1 sticky left-0 top-0 z-50 w-full justify-between overflow-x-auto border border-border bg-background"
|
|
13526
14155
|
);
|
|
13527
|
-
const
|
|
13528
|
-
|
|
13529
|
-
|
|
13530
|
-
|
|
13531
|
-
|
|
13532
|
-
const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
|
|
13533
|
-
const editor = plateCommon.useEditorState();
|
|
13534
|
-
const state = plate.useListToolbarButtonState({ nodeType });
|
|
13535
|
-
const { props } = plate.useListToolbarButton(state);
|
|
13536
|
-
return /* @__PURE__ */ React.createElement(
|
|
13537
|
-
ToolbarButton,
|
|
13538
|
-
{
|
|
13539
|
-
ref,
|
|
13540
|
-
tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
13541
|
-
...props,
|
|
13542
|
-
onClick: (e) => {
|
|
13543
|
-
e.preventDefault();
|
|
13544
|
-
e.stopPropagation();
|
|
13545
|
-
plate.toggleList(editor, { type: nodeType });
|
|
13546
|
-
}
|
|
13547
|
-
},
|
|
13548
|
-
nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
|
|
13549
|
-
);
|
|
13550
|
-
});
|
|
13551
|
-
const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
13552
|
-
const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
13553
|
-
const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
13554
|
-
cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
13555
|
-
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
13556
|
-
{
|
|
13557
|
-
className: cn$1.cn(
|
|
13558
|
-
"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",
|
|
13559
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
13560
|
-
inset && "pl-8",
|
|
13561
|
-
className
|
|
13562
|
-
),
|
|
13563
|
-
ref,
|
|
13564
|
-
...props
|
|
13565
|
-
},
|
|
13566
|
-
children,
|
|
13567
|
-
/* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
|
|
13568
|
-
));
|
|
13569
|
-
cn$1.withCn(
|
|
13570
|
-
DropdownMenuPrimitive__namespace.SubContent,
|
|
13571
|
-
"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"
|
|
13572
|
-
);
|
|
13573
|
-
const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
|
|
13574
|
-
className: cn$1.cn(
|
|
13575
|
-
"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"
|
|
13576
|
-
),
|
|
13577
|
-
sideOffset: 4
|
|
13578
|
-
});
|
|
13579
|
-
const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
|
|
13580
|
-
const menuItemVariants = classVarianceAuthority.cva(
|
|
13581
|
-
cn$1.cn(
|
|
13582
|
-
"relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
13583
|
-
"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
13584
|
-
),
|
|
13585
|
-
{
|
|
13586
|
-
variants: {
|
|
13587
|
-
inset: {
|
|
13588
|
-
true: "pl-8"
|
|
14156
|
+
const useResize = (ref, callback) => {
|
|
14157
|
+
React.useEffect(() => {
|
|
14158
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
14159
|
+
for (const entry of entries) {
|
|
14160
|
+
callback(entry);
|
|
13589
14161
|
}
|
|
14162
|
+
});
|
|
14163
|
+
if (ref.current) {
|
|
14164
|
+
resizeObserver.observe(ref.current);
|
|
13590
14165
|
}
|
|
13591
|
-
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
|
|
13597
|
-
|
|
13598
|
-
|
|
13599
|
-
|
|
13600
|
-
|
|
13601
|
-
|
|
13602
|
-
|
|
13603
|
-
|
|
13604
|
-
|
|
13605
|
-
|
|
13606
|
-
ref,
|
|
13607
|
-
...props
|
|
13608
|
-
},
|
|
13609
|
-
/* @__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" }))),
|
|
13610
|
-
children
|
|
13611
|
-
));
|
|
13612
|
-
const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
13613
|
-
DropdownMenuPrimitive__namespace.RadioItem,
|
|
13614
|
-
{
|
|
13615
|
-
className: cn$1.cn(
|
|
13616
|
-
"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",
|
|
13617
|
-
"h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
|
|
13618
|
-
className
|
|
13619
|
-
),
|
|
13620
|
-
ref,
|
|
13621
|
-
...props
|
|
13622
|
-
},
|
|
13623
|
-
!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" }))),
|
|
14166
|
+
return () => resizeObserver.disconnect();
|
|
14167
|
+
}, [ref.current]);
|
|
14168
|
+
};
|
|
14169
|
+
const STANDARD_ICON_WIDTH = 32;
|
|
14170
|
+
const HEADING_ICON_WITH_TEXT = 127;
|
|
14171
|
+
const HEADING_ICON_ONLY = 58;
|
|
14172
|
+
const EMBED_ICON_WIDTH = 78;
|
|
14173
|
+
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14174
|
+
const FLOAT_BUTTON_WIDTH = 25;
|
|
14175
|
+
const HEADING_LABEL = "Headings";
|
|
14176
|
+
const ToolbarContext = React.createContext(void 0);
|
|
14177
|
+
const ToolbarProvider = ({
|
|
14178
|
+
tinaForm,
|
|
14179
|
+
templates,
|
|
14180
|
+
overrides,
|
|
13624
14181
|
children
|
|
13625
|
-
)
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
}
|
|
13633
|
-
}
|
|
14182
|
+
}) => {
|
|
14183
|
+
return /* @__PURE__ */ React.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
|
|
14184
|
+
};
|
|
14185
|
+
const useToolbarContext = () => {
|
|
14186
|
+
const context = React.useContext(ToolbarContext);
|
|
14187
|
+
if (!context) {
|
|
14188
|
+
throw new Error("useToolbarContext must be used within a ToolbarProvider");
|
|
13634
14189
|
}
|
|
13635
|
-
|
|
13636
|
-
const DropdownMenuLabel = cn$1.withVariants(
|
|
13637
|
-
DropdownMenuPrimitive__namespace.Label,
|
|
13638
|
-
dropdownMenuLabelVariants,
|
|
13639
|
-
["inset"]
|
|
13640
|
-
);
|
|
13641
|
-
const DropdownMenuSeparator = cn$1.withCn(
|
|
13642
|
-
DropdownMenuPrimitive__namespace.Separator,
|
|
13643
|
-
"-mx-1 my-1 h-px bg-muted"
|
|
13644
|
-
);
|
|
13645
|
-
cn$1.withCn(
|
|
13646
|
-
cn$1.createPrimitiveElement("span"),
|
|
13647
|
-
"ml-auto text-xs tracking-widest opacity-60"
|
|
13648
|
-
);
|
|
13649
|
-
const useOpenState = () => {
|
|
13650
|
-
const [open2, setOpen] = React.useState(false);
|
|
13651
|
-
const onOpenChange = React.useCallback(
|
|
13652
|
-
(_value = !open2) => {
|
|
13653
|
-
setOpen(_value);
|
|
13654
|
-
},
|
|
13655
|
-
[open2]
|
|
13656
|
-
);
|
|
13657
|
-
return {
|
|
13658
|
-
onOpenChange,
|
|
13659
|
-
open: open2
|
|
13660
|
-
};
|
|
14190
|
+
return context;
|
|
13661
14191
|
};
|
|
13662
14192
|
const items$1 = [
|
|
13663
14193
|
{
|
|
@@ -13723,7 +14253,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13723
14253
|
return allNodesMatchInitialNodeType ? initialNodeType : plateParagraph.ELEMENT_PARAGRAPH;
|
|
13724
14254
|
}, []);
|
|
13725
14255
|
const editor = plateCommon.useEditorRef();
|
|
14256
|
+
const editorState = plateCommon.useEditorState();
|
|
13726
14257
|
const openState = useOpenState();
|
|
14258
|
+
const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
|
|
13727
14259
|
const selectedItem = items$1.find((item) => item.value === value) ?? defaultItem$1;
|
|
13728
14260
|
const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
|
|
13729
14261
|
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
@@ -13735,7 +14267,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13735
14267
|
tooltip: "Headings"
|
|
13736
14268
|
},
|
|
13737
14269
|
/* @__PURE__ */ React.createElement(SelectedItemIcon, { className: "size-5" }),
|
|
13738
|
-
/* @__PURE__ */ React.createElement("span", { className: "
|
|
14270
|
+
/* @__PURE__ */ React.createElement("span", { className: "@md/toolbar:flex hidden" }, selectedItemLabel)
|
|
13739
14271
|
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0" }, /* @__PURE__ */ React.createElement(
|
|
13740
14272
|
DropdownMenuRadioGroup,
|
|
13741
14273
|
{
|
|
@@ -13747,7 +14279,12 @@ var __publicField = (obj, key, value) => {
|
|
|
13747
14279
|
},
|
|
13748
14280
|
value
|
|
13749
14281
|
},
|
|
13750
|
-
items$1.
|
|
14282
|
+
items$1.filter((item) => {
|
|
14283
|
+
if (userInTable) {
|
|
14284
|
+
return !unsupportedItemsInTable.has(item.label);
|
|
14285
|
+
}
|
|
14286
|
+
return true;
|
|
14287
|
+
}).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
|
|
13751
14288
|
DropdownMenuRadioItem,
|
|
13752
14289
|
{
|
|
13753
14290
|
className: "min-w-[180px]",
|
|
@@ -13758,43 +14295,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13758
14295
|
label
|
|
13759
14296
|
))
|
|
13760
14297
|
)));
|
|
13761
|
-
}
|
|
13762
|
-
const LinkToolbarButton = cn$1.withRef((rest, ref) => {
|
|
13763
|
-
const state = plateLink.useLinkToolbarButtonState();
|
|
13764
|
-
const { props } = plateLink.useLinkToolbarButton(state);
|
|
13765
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
|
|
13766
|
-
});
|
|
13767
|
-
const useBlockQuoteToolbarButtonState = () => {
|
|
13768
|
-
const editor = plateCommon.useEditorState();
|
|
13769
|
-
const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
|
|
13770
|
-
return {
|
|
13771
|
-
pressed: isBlockActive()
|
|
13772
|
-
};
|
|
13773
|
-
};
|
|
13774
|
-
const useBlockQuoteToolbarButton = (state) => {
|
|
13775
|
-
const editor = plateCommon.useEditorState();
|
|
13776
|
-
const onClick = () => {
|
|
13777
|
-
plateCommon.toggleNodeType(editor, {
|
|
13778
|
-
activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
|
|
13779
|
-
});
|
|
13780
|
-
};
|
|
13781
|
-
const onMouseDown = (e) => {
|
|
13782
|
-
e.preventDefault();
|
|
13783
|
-
e.stopPropagation();
|
|
13784
|
-
};
|
|
13785
|
-
return {
|
|
13786
|
-
props: {
|
|
13787
|
-
onClick,
|
|
13788
|
-
onMouseDown,
|
|
13789
|
-
pressed: state.pressed
|
|
13790
|
-
}
|
|
13791
|
-
};
|
|
13792
|
-
};
|
|
13793
|
-
const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
13794
|
-
const state = useBlockQuoteToolbarButtonState();
|
|
13795
|
-
const { props } = useBlockQuoteToolbarButton(state);
|
|
13796
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
|
|
13797
|
-
});
|
|
14298
|
+
}
|
|
13798
14299
|
const useCodeBlockToolbarButtonState = () => {
|
|
13799
14300
|
const editor = plateCommon.useEditorState();
|
|
13800
14301
|
const isBlockActive = () => helpers.isNodeActive(editor, plateCodeBlock.ELEMENT_CODE_BLOCK);
|
|
@@ -13856,6 +14357,115 @@ var __publicField = (obj, key, value) => {
|
|
|
13856
14357
|
const { props } = useImageToolbarButton(state);
|
|
13857
14358
|
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
|
|
13858
14359
|
});
|
|
14360
|
+
const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
|
|
14361
|
+
const editor = plateCommon.useEditorState();
|
|
14362
|
+
const state = plate.useListToolbarButtonState({ nodeType });
|
|
14363
|
+
const { props } = plate.useListToolbarButton(state);
|
|
14364
|
+
return /* @__PURE__ */ React.createElement(
|
|
14365
|
+
ToolbarButton,
|
|
14366
|
+
{
|
|
14367
|
+
ref,
|
|
14368
|
+
tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
14369
|
+
...props,
|
|
14370
|
+
onClick: (e) => {
|
|
14371
|
+
e.preventDefault();
|
|
14372
|
+
e.stopPropagation();
|
|
14373
|
+
plate.toggleList(editor, { type: nodeType });
|
|
14374
|
+
}
|
|
14375
|
+
},
|
|
14376
|
+
nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
|
|
14377
|
+
);
|
|
14378
|
+
});
|
|
14379
|
+
const LinkToolbarButton = cn$1.withRef((rest, ref) => {
|
|
14380
|
+
const state = plateLink.useLinkToolbarButtonState();
|
|
14381
|
+
const { props } = plateLink.useLinkToolbarButton(state);
|
|
14382
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
|
|
14383
|
+
});
|
|
14384
|
+
const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14385
|
+
const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
|
|
14386
|
+
const { props } = plateCommon.useMarkToolbarButton(state);
|
|
14387
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
14388
|
+
});
|
|
14389
|
+
const useMermaidToolbarButtonState = () => {
|
|
14390
|
+
const editor = plateCommon.useEditorState();
|
|
14391
|
+
const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_MERMAID);
|
|
14392
|
+
return {
|
|
14393
|
+
pressed: isBlockActive()
|
|
14394
|
+
};
|
|
14395
|
+
};
|
|
14396
|
+
const useMermaidToolbarButton = (state) => {
|
|
14397
|
+
const editor = plateCommon.useEditorState();
|
|
14398
|
+
const onClick = () => {
|
|
14399
|
+
plateCommon.insertEmptyElement(editor, ELEMENT_MERMAID, {
|
|
14400
|
+
nextBlock: true,
|
|
14401
|
+
select: true
|
|
14402
|
+
});
|
|
14403
|
+
};
|
|
14404
|
+
const onMouseDown = (e) => {
|
|
14405
|
+
e.preventDefault();
|
|
14406
|
+
e.stopPropagation();
|
|
14407
|
+
};
|
|
14408
|
+
return {
|
|
14409
|
+
props: {
|
|
14410
|
+
onClick,
|
|
14411
|
+
onMouseDown,
|
|
14412
|
+
pressed: state.pressed
|
|
14413
|
+
}
|
|
14414
|
+
};
|
|
14415
|
+
};
|
|
14416
|
+
const MermaidToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14417
|
+
const state = useMermaidToolbarButtonState();
|
|
14418
|
+
const { props } = useMermaidToolbarButton(state);
|
|
14419
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Mermaid", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.mermaid, null));
|
|
14420
|
+
});
|
|
14421
|
+
function OverflowMenu({
|
|
14422
|
+
children,
|
|
14423
|
+
...props
|
|
14424
|
+
}) {
|
|
14425
|
+
const openState = useOpenState();
|
|
14426
|
+
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
14427
|
+
ToolbarButton,
|
|
14428
|
+
{
|
|
14429
|
+
showArrow: false,
|
|
14430
|
+
className: "lg:min-w-[130px]",
|
|
14431
|
+
isDropdown: true,
|
|
14432
|
+
pressed: openState.open,
|
|
14433
|
+
tooltip: "Headings"
|
|
14434
|
+
},
|
|
14435
|
+
/* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
|
|
14436
|
+
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
|
|
14437
|
+
}
|
|
14438
|
+
const useBlockQuoteToolbarButtonState = () => {
|
|
14439
|
+
const editor = plateCommon.useEditorState();
|
|
14440
|
+
const isBlockActive = () => helpers.isNodeActive(editor, plateBlockQuote.ELEMENT_BLOCKQUOTE);
|
|
14441
|
+
return {
|
|
14442
|
+
pressed: isBlockActive()
|
|
14443
|
+
};
|
|
14444
|
+
};
|
|
14445
|
+
const useBlockQuoteToolbarButton = (state) => {
|
|
14446
|
+
const editor = plateCommon.useEditorState();
|
|
14447
|
+
const onClick = () => {
|
|
14448
|
+
plateCommon.toggleNodeType(editor, {
|
|
14449
|
+
activeType: plateBlockQuote.ELEMENT_BLOCKQUOTE
|
|
14450
|
+
});
|
|
14451
|
+
};
|
|
14452
|
+
const onMouseDown = (e) => {
|
|
14453
|
+
e.preventDefault();
|
|
14454
|
+
e.stopPropagation();
|
|
14455
|
+
};
|
|
14456
|
+
return {
|
|
14457
|
+
props: {
|
|
14458
|
+
onClick,
|
|
14459
|
+
onMouseDown,
|
|
14460
|
+
pressed: state.pressed
|
|
14461
|
+
}
|
|
14462
|
+
};
|
|
14463
|
+
};
|
|
14464
|
+
const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14465
|
+
const state = useBlockQuoteToolbarButtonState();
|
|
14466
|
+
const { props } = useBlockQuoteToolbarButton(state);
|
|
14467
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
|
|
14468
|
+
});
|
|
13859
14469
|
const useRawMarkdownToolbarButton = () => {
|
|
13860
14470
|
const { setRawMode } = useEditorContext();
|
|
13861
14471
|
const onMouseDown = (e) => {
|
|
@@ -13872,29 +14482,111 @@ var __publicField = (obj, key, value) => {
|
|
|
13872
14482
|
const { props } = useRawMarkdownToolbarButton();
|
|
13873
14483
|
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.raw, null));
|
|
13874
14484
|
});
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13878
|
-
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
14485
|
+
function TableDropdownMenu(props) {
|
|
14486
|
+
const tableSelected = plateCommon.useEditorSelector(
|
|
14487
|
+
(editor2) => plateCommon.someNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } }),
|
|
14488
|
+
[]
|
|
14489
|
+
);
|
|
14490
|
+
const [enableDeleteColumn, enableDeleteRow] = plateCommon.useEditorSelector((editor2) => {
|
|
14491
|
+
const tableNodeEntry = plateCommon.findNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } });
|
|
14492
|
+
if (!tableNodeEntry)
|
|
14493
|
+
return [false, false];
|
|
14494
|
+
const [tableNode] = tableNodeEntry;
|
|
14495
|
+
if (!plateCommon.isElement(tableNode))
|
|
14496
|
+
return [false, false];
|
|
14497
|
+
const columnCount = plateTable.getTableColumnCount(tableNode);
|
|
14498
|
+
const rowCount = tableNode.children.length;
|
|
14499
|
+
return [columnCount > 1, rowCount > 1];
|
|
14500
|
+
}, []);
|
|
14501
|
+
const editor = plateCommon.useEditorRef();
|
|
14502
|
+
const openState = useOpenState();
|
|
14503
|
+
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(
|
|
14504
|
+
DropdownMenuContent,
|
|
14505
|
+
{
|
|
14506
|
+
align: "start",
|
|
14507
|
+
className: "flex w-[180px] min-w-0 flex-col gap-0.5"
|
|
14508
|
+
},
|
|
14509
|
+
/* @__PURE__ */ React.createElement(
|
|
14510
|
+
DropdownMenuItem,
|
|
14511
|
+
{
|
|
14512
|
+
className: "min-w-[180px]",
|
|
14513
|
+
disabled: tableSelected,
|
|
14514
|
+
onSelect: () => {
|
|
14515
|
+
plateTable.insertTable(editor);
|
|
14516
|
+
plateCommon.focusEditor(editor);
|
|
14517
|
+
}
|
|
14518
|
+
},
|
|
14519
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14520
|
+
"Insert table"
|
|
14521
|
+
),
|
|
14522
|
+
/* @__PURE__ */ React.createElement(
|
|
14523
|
+
DropdownMenuItem,
|
|
14524
|
+
{
|
|
14525
|
+
className: "min-w-[180px]",
|
|
14526
|
+
disabled: !tableSelected,
|
|
14527
|
+
onSelect: () => {
|
|
14528
|
+
plateTable.deleteTable(editor);
|
|
14529
|
+
plateCommon.focusEditor(editor);
|
|
14530
|
+
}
|
|
14531
|
+
},
|
|
14532
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14533
|
+
"Delete table"
|
|
14534
|
+
),
|
|
14535
|
+
/* @__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(
|
|
14536
|
+
DropdownMenuItem,
|
|
14537
|
+
{
|
|
14538
|
+
className: "min-w-[180px]",
|
|
14539
|
+
disabled: !tableSelected,
|
|
14540
|
+
onSelect: () => {
|
|
14541
|
+
plateTable.insertTableColumn(editor);
|
|
14542
|
+
plateCommon.focusEditor(editor);
|
|
14543
|
+
}
|
|
14544
|
+
},
|
|
14545
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14546
|
+
"Insert column after"
|
|
14547
|
+
), /* @__PURE__ */ React.createElement(
|
|
14548
|
+
DropdownMenuItem,
|
|
14549
|
+
{
|
|
14550
|
+
className: "min-w-[180px]",
|
|
14551
|
+
disabled: !enableDeleteColumn,
|
|
14552
|
+
onSelect: () => {
|
|
14553
|
+
plateTable.deleteColumn(editor);
|
|
14554
|
+
plateCommon.focusEditor(editor);
|
|
14555
|
+
}
|
|
14556
|
+
},
|
|
14557
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14558
|
+
"Delete column"
|
|
14559
|
+
))),
|
|
14560
|
+
/* @__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(
|
|
14561
|
+
DropdownMenuItem,
|
|
14562
|
+
{
|
|
14563
|
+
className: "min-w-[180px]",
|
|
14564
|
+
disabled: !tableSelected,
|
|
14565
|
+
onSelect: () => {
|
|
14566
|
+
plateTable.insertTableRow(editor);
|
|
14567
|
+
plateCommon.focusEditor(editor);
|
|
14568
|
+
}
|
|
14569
|
+
},
|
|
14570
|
+
/* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14571
|
+
"Insert row after"
|
|
14572
|
+
), /* @__PURE__ */ React.createElement(
|
|
14573
|
+
DropdownMenuItem,
|
|
14574
|
+
{
|
|
14575
|
+
className: "min-w-[180px]",
|
|
14576
|
+
disabled: !enableDeleteRow,
|
|
14577
|
+
onSelect: () => {
|
|
14578
|
+
plateTable.deleteRow(editor);
|
|
14579
|
+
plateCommon.focusEditor(editor);
|
|
14580
|
+
}
|
|
14581
|
+
},
|
|
14582
|
+
/* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14583
|
+
"Delete row"
|
|
14584
|
+
)))
|
|
14585
|
+
));
|
|
14586
|
+
}
|
|
13891
14587
|
function TemplatesToolbarButton() {
|
|
13892
14588
|
const { templates } = useToolbarContext();
|
|
13893
|
-
const showEmbed = templates.length > 0;
|
|
13894
14589
|
const editor = plateCommon.useEditorState();
|
|
13895
|
-
if (!showEmbed) {
|
|
13896
|
-
return null;
|
|
13897
|
-
}
|
|
13898
14590
|
return /* @__PURE__ */ React.createElement(EmbedButton, { templates, editor });
|
|
13899
14591
|
}
|
|
13900
14592
|
const EmbedButton = ({ editor, templates }) => {
|
|
@@ -13935,99 +14627,113 @@ var __publicField = (obj, key, value) => {
|
|
|
13935
14627
|
template.label || template.name
|
|
13936
14628
|
))));
|
|
13937
14629
|
};
|
|
13938
|
-
const ICON_WIDTH = 32;
|
|
13939
|
-
const EMBED_ICON_WIDTH = 78;
|
|
13940
|
-
const useResize = (ref, callback) => {
|
|
13941
|
-
React.useEffect(() => {
|
|
13942
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
13943
|
-
for (const entry of entries) {
|
|
13944
|
-
callback(entry);
|
|
13945
|
-
}
|
|
13946
|
-
});
|
|
13947
|
-
if (ref.current) {
|
|
13948
|
-
resizeObserver.observe(ref.current);
|
|
13949
|
-
}
|
|
13950
|
-
return () => resizeObserver.disconnect();
|
|
13951
|
-
}, [ref.current]);
|
|
13952
|
-
};
|
|
13953
|
-
function OverflowMenu({
|
|
13954
|
-
children,
|
|
13955
|
-
...props
|
|
13956
|
-
}) {
|
|
13957
|
-
const openState = useOpenState();
|
|
13958
|
-
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
13959
|
-
ToolbarButton,
|
|
13960
|
-
{
|
|
13961
|
-
showArrow: false,
|
|
13962
|
-
className: "lg:min-w-[130px]",
|
|
13963
|
-
isDropdown: true,
|
|
13964
|
-
pressed: openState.open,
|
|
13965
|
-
tooltip: "Headings"
|
|
13966
|
-
},
|
|
13967
|
-
/* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
|
|
13968
|
-
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
|
|
13969
|
-
}
|
|
13970
14630
|
const toolbarItems = {
|
|
13971
14631
|
heading: {
|
|
13972
|
-
label:
|
|
14632
|
+
label: HEADING_LABEL,
|
|
14633
|
+
width: (paragraphIconExists) => paragraphIconExists ? HEADING_ICON_WITH_TEXT : HEADING_ICON_ONLY,
|
|
14634
|
+
// Dynamically handle width based on paragraph icon
|
|
13973
14635
|
Component: /* @__PURE__ */ React.createElement(ToolbarGroup, { noSeparator: true }, /* @__PURE__ */ React.createElement(HeadingsMenu, null))
|
|
13974
14636
|
},
|
|
13975
14637
|
link: {
|
|
13976
14638
|
label: "Link",
|
|
14639
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
13977
14640
|
Component: /* @__PURE__ */ React.createElement(LinkToolbarButton, null)
|
|
13978
14641
|
},
|
|
13979
14642
|
image: {
|
|
13980
14643
|
label: "Image",
|
|
14644
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
13981
14645
|
Component: /* @__PURE__ */ React.createElement(ImageToolbarButton, null)
|
|
13982
14646
|
},
|
|
13983
14647
|
quote: {
|
|
13984
14648
|
label: "Quote",
|
|
14649
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
13985
14650
|
Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
|
|
13986
14651
|
},
|
|
13987
14652
|
ul: {
|
|
13988
14653
|
label: "Unordered List",
|
|
14654
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
13989
14655
|
Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_UL })
|
|
13990
14656
|
},
|
|
13991
14657
|
ol: {
|
|
13992
14658
|
label: "Ordered List",
|
|
14659
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
13993
14660
|
Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_OL })
|
|
13994
14661
|
},
|
|
13995
14662
|
bold: {
|
|
13996
14663
|
label: "Bold",
|
|
14664
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
13997
14665
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null))
|
|
13998
14666
|
},
|
|
13999
14667
|
italic: {
|
|
14000
14668
|
label: "Italic",
|
|
14669
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14001
14670
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null))
|
|
14002
14671
|
},
|
|
14003
14672
|
code: {
|
|
14004
14673
|
label: "Code",
|
|
14674
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14005
14675
|
Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null))
|
|
14006
14676
|
},
|
|
14007
14677
|
codeBlock: {
|
|
14008
14678
|
label: "Code Block",
|
|
14679
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14009
14680
|
Component: /* @__PURE__ */ React.createElement(CodeBlockToolbarButton, null)
|
|
14010
14681
|
},
|
|
14682
|
+
mermaid: {
|
|
14683
|
+
label: "Mermaid",
|
|
14684
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14685
|
+
Component: /* @__PURE__ */ React.createElement(MermaidToolbarButton, null)
|
|
14686
|
+
},
|
|
14687
|
+
table: {
|
|
14688
|
+
label: "Table",
|
|
14689
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14690
|
+
Component: /* @__PURE__ */ React.createElement(TableDropdownMenu, null)
|
|
14691
|
+
},
|
|
14011
14692
|
raw: {
|
|
14012
14693
|
label: "Raw Markdown",
|
|
14694
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14013
14695
|
Component: /* @__PURE__ */ React.createElement(RawMarkdownToolbarButton, null)
|
|
14014
14696
|
},
|
|
14015
14697
|
embed: {
|
|
14016
14698
|
label: "Templates",
|
|
14699
|
+
width: () => EMBED_ICON_WIDTH,
|
|
14017
14700
|
Component: /* @__PURE__ */ React.createElement(TemplatesToolbarButton, null)
|
|
14018
14701
|
}
|
|
14019
14702
|
};
|
|
14020
14703
|
function FixedToolbarButtons() {
|
|
14021
14704
|
const toolbarRef = React.useRef(null);
|
|
14022
14705
|
const [itemsShown, setItemsShown] = React.useState(11);
|
|
14023
|
-
const { overrides } = useToolbarContext();
|
|
14706
|
+
const { overrides, templates } = useToolbarContext();
|
|
14707
|
+
const showEmbedButton = templates.length > 0;
|
|
14708
|
+
let items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14709
|
+
if (!showEmbedButton) {
|
|
14710
|
+
items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
|
|
14711
|
+
}
|
|
14712
|
+
const editorState = plateCommon.useEditorState();
|
|
14713
|
+
const userInTable = helpers.isNodeActive(editorState, plate.ELEMENT_TABLE);
|
|
14714
|
+
if (userInTable) {
|
|
14715
|
+
items2 = items2.filter((item) => !unsupportedItemsInTable.has(item.label));
|
|
14716
|
+
}
|
|
14024
14717
|
useResize(toolbarRef, (entry) => {
|
|
14025
14718
|
const width = entry.target.getBoundingClientRect().width;
|
|
14026
|
-
const
|
|
14027
|
-
|
|
14719
|
+
const headingButton = items2.find((item) => item.label === HEADING_LABEL);
|
|
14720
|
+
const headingWidth = headingButton ? headingButton.width(width > CONTAINER_MD_BREAKPOINT) : 0;
|
|
14721
|
+
const availableWidth = width - headingWidth - FLOAT_BUTTON_WIDTH;
|
|
14722
|
+
const { itemFitCount } = items2.reduce(
|
|
14723
|
+
(acc, item) => {
|
|
14724
|
+
if (item.label !== HEADING_LABEL && acc.totalItemsWidth + item.width() <= availableWidth) {
|
|
14725
|
+
return {
|
|
14726
|
+
totalItemsWidth: acc.totalItemsWidth + item.width(),
|
|
14727
|
+
itemFitCount: acc.itemFitCount + 1
|
|
14728
|
+
};
|
|
14729
|
+
}
|
|
14730
|
+
return acc;
|
|
14731
|
+
},
|
|
14732
|
+
{ totalItemsWidth: 0, itemFitCount: 1 }
|
|
14733
|
+
);
|
|
14734
|
+
setItemsShown(itemFitCount);
|
|
14028
14735
|
});
|
|
14029
|
-
|
|
14030
|
-
return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
|
|
14736
|
+
return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden @container/toolbar", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
|
|
14031
14737
|
"div",
|
|
14032
14738
|
{
|
|
14033
14739
|
className: "flex",
|
|
@@ -14035,7 +14741,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14035
14741
|
transform: "translateX(calc(-1px))"
|
|
14036
14742
|
}
|
|
14037
14743
|
},
|
|
14038
|
-
/* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
14744
|
+
/* @__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))))
|
|
14039
14745
|
));
|
|
14040
14746
|
}
|
|
14041
14747
|
const FloatingToolbar = cn$1.withRef(({ children, state, ...props }, componentRef) => {
|
|
@@ -14150,6 +14856,10 @@ var __publicField = (obj, key, value) => {
|
|
|
14150
14856
|
const openState = useOpenState();
|
|
14151
14857
|
const selectedItem = items.find((item) => item.value === value) ?? defaultItem;
|
|
14152
14858
|
const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
|
|
14859
|
+
const editorState = plateCommon.useEditorState();
|
|
14860
|
+
const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
|
|
14861
|
+
if (userInTable)
|
|
14862
|
+
return null;
|
|
14153
14863
|
return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
14154
14864
|
ToolbarButton,
|
|
14155
14865
|
{
|
|
@@ -14191,49 +14901,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14191
14901
|
function FloatingToolbarButtons() {
|
|
14192
14902
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TurnIntoDropdownMenu, null));
|
|
14193
14903
|
}
|
|
14194
|
-
const buttonVariants = classVarianceAuthority.cva(
|
|
14195
|
-
"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",
|
|
14196
|
-
{
|
|
14197
|
-
defaultVariants: {
|
|
14198
|
-
size: "default",
|
|
14199
|
-
variant: "default"
|
|
14200
|
-
},
|
|
14201
|
-
variants: {
|
|
14202
|
-
isMenu: {
|
|
14203
|
-
true: "h-auto w-full cursor-pointer justify-start"
|
|
14204
|
-
},
|
|
14205
|
-
size: {
|
|
14206
|
-
default: "h-10 px-4 py-2",
|
|
14207
|
-
icon: "size-10",
|
|
14208
|
-
lg: "h-11 rounded-md px-8",
|
|
14209
|
-
none: "",
|
|
14210
|
-
sm: "h-9 rounded-md px-3",
|
|
14211
|
-
sms: "size-9 rounded-md px-0",
|
|
14212
|
-
xs: "h-8 rounded-md px-3"
|
|
14213
|
-
},
|
|
14214
|
-
variant: {
|
|
14215
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
14216
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
14217
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
14218
|
-
inlineLink: "text-base text-primary underline underline-offset-4",
|
|
14219
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
14220
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
14221
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
14222
|
-
}
|
|
14223
|
-
}
|
|
14224
|
-
}
|
|
14225
|
-
);
|
|
14226
|
-
cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
|
|
14227
|
-
const Comp = asChild ? reactSlot.Slot : "button";
|
|
14228
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
14229
|
-
Comp,
|
|
14230
|
-
{
|
|
14231
|
-
className: cn$1.cn(buttonVariants({ className, isMenu, size, variant })),
|
|
14232
|
-
ref,
|
|
14233
|
-
...props
|
|
14234
|
-
}
|
|
14235
|
-
);
|
|
14236
|
-
});
|
|
14237
14904
|
const inputVariants = classVarianceAuthority.cva(
|
|
14238
14905
|
"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",
|
|
14239
14906
|
{
|
|
@@ -14254,22 +14921,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14254
14921
|
}
|
|
14255
14922
|
);
|
|
14256
14923
|
cn$1.withVariants("input", inputVariants, ["variant", "h"]);
|
|
14257
|
-
const popoverVariants = classVarianceAuthority.cva(
|
|
14258
|
-
"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"
|
|
14259
|
-
);
|
|
14260
|
-
cn$1.withRef(
|
|
14261
|
-
({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
|
|
14262
|
-
PopoverPrimitive__namespace.Content,
|
|
14263
|
-
{
|
|
14264
|
-
align,
|
|
14265
|
-
className: cn$1.cn(popoverVariants(), className),
|
|
14266
|
-
ref,
|
|
14267
|
-
sideOffset,
|
|
14268
|
-
style: { zIndex: 1e3, ...style },
|
|
14269
|
-
...props
|
|
14270
|
-
}
|
|
14271
|
-
))
|
|
14272
|
-
);
|
|
14273
14924
|
const floatingOptions = {
|
|
14274
14925
|
middleware: [
|
|
14275
14926
|
plateFloating.offset(12),
|
|
@@ -14329,7 +14980,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14329
14980
|
const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex h-9 items-center gap-1" }, /* @__PURE__ */ React.createElement(
|
|
14330
14981
|
"button",
|
|
14331
14982
|
{
|
|
14332
|
-
className: buttonVariants({ size: "sm", variant: "ghost" }),
|
|
14983
|
+
className: buttonVariants$1({ size: "sm", variant: "ghost" }),
|
|
14333
14984
|
type: "button",
|
|
14334
14985
|
...editButtonProps
|
|
14335
14986
|
},
|
|
@@ -14337,7 +14988,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14337
14988
|
), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
|
|
14338
14989
|
plateLink.LinkOpenButton,
|
|
14339
14990
|
{
|
|
14340
|
-
className: buttonVariants({
|
|
14991
|
+
className: buttonVariants$1({
|
|
14341
14992
|
size: "sms",
|
|
14342
14993
|
variant: "ghost"
|
|
14343
14994
|
})
|
|
@@ -14346,7 +14997,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14346
14997
|
), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
|
|
14347
14998
|
"button",
|
|
14348
14999
|
{
|
|
14349
|
-
className: buttonVariants({
|
|
15000
|
+
className: buttonVariants$1({
|
|
14350
15001
|
size: "sms",
|
|
14351
15002
|
variant: "ghost"
|
|
14352
15003
|
}),
|
|
@@ -14420,6 +15071,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14420
15071
|
createMdxBlockPlugin(),
|
|
14421
15072
|
createMdxInlinePlugin(),
|
|
14422
15073
|
createImgPlugin(),
|
|
15074
|
+
createMermaidPlugin(),
|
|
14423
15075
|
createInvalidMarkdownPlugin(),
|
|
14424
15076
|
plateLink.createLinkPlugin({
|
|
14425
15077
|
options: {
|
|
@@ -30542,8 +31194,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
30542
31194
|
}
|
|
30543
31195
|
)
|
|
30544
31196
|
}
|
|
30545
|
-
), !renderDesktopNav && /* @__PURE__ */ React.createElement(react
|
|
30546
|
-
react
|
|
31197
|
+
), !renderDesktopNav && /* @__PURE__ */ React.createElement(react.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
|
|
31198
|
+
react.TransitionChild,
|
|
30547
31199
|
{
|
|
30548
31200
|
enter: "transform transition-all ease-out duration-300",
|
|
30549
31201
|
enterFrom: "opacity-0 -translate-x-full",
|
|
@@ -30612,7 +31264,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
30612
31264
|
))
|
|
30613
31265
|
))
|
|
30614
31266
|
), /* @__PURE__ */ React.createElement(
|
|
30615
|
-
react
|
|
31267
|
+
react.TransitionChild,
|
|
30616
31268
|
{
|
|
30617
31269
|
enter: "ease-out duration-300",
|
|
30618
31270
|
enterFrom: "opacity-0",
|
|
@@ -31066,8 +31718,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31066
31718
|
folder,
|
|
31067
31719
|
collectionName
|
|
31068
31720
|
}) => {
|
|
31069
|
-
return /* @__PURE__ */ React.createElement(react
|
|
31070
|
-
react
|
|
31721
|
+
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(
|
|
31722
|
+
react.Transition,
|
|
31071
31723
|
{
|
|
31072
31724
|
enter: "transition ease-out duration-100",
|
|
31073
31725
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -31076,7 +31728,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31076
31728
|
leaveFrom: "transform opacity-100 scale-100",
|
|
31077
31729
|
leaveTo: "transform opacity-0 scale-95"
|
|
31078
31730
|
},
|
|
31079
|
-
/* @__PURE__ */ React.createElement(react
|
|
31731
|
+
/* @__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(
|
|
31080
31732
|
reactRouterDom.Link,
|
|
31081
31733
|
{
|
|
31082
31734
|
to: `/${folder.fullyQualifiedName ? [
|