tinacms 0.0.0-b1fe6d2-20241008011354 → 0.0.0-c5dad82-20241009225242

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js 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("slate-react"), require("@udecode/plate-slash-command"), require("@udecode/cn"), require("@udecode/plate-common"), require("@udecode/plate-heading"), require("class-variance-authority"), require("lucide-react"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), 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("@radix-ui/react-popover"), require("react-color"), require("color-string"), require("react-dropzone"), require("@radix-ui/react-slot"), 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-separator"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@radix-ui/react-dropdown-menu"), 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/plate", "slate-react", "@udecode/plate-slash-command", "@udecode/cn", "@udecode/plate-common", "@udecode/plate-heading", "class-variance-authority", "lucide-react", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "@radix-ui/react-popover", "react-color", "color-string", "react-dropzone", "@radix-ui/react-slot", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-separator", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@radix-ui/react-dropdown-menu", "@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));
3
- })(this, function(exports2, zod, React, reactDom, plate, slateReact, plateSlashCommand, cn$1, plateCommon, plateHeading, classVarianceAuthority, lucideReact, react, plateCombobox, plateCodeBlock, MonacoEditor, react$1, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, PopoverPrimitive, pkg$1, pkg, dropzone, reactSlot, clsx, tailwindMerge, cmdk, isHotkey, slate, get, moment, dateFns, plateLink, ToolbarPrimitive, SeparatorPrimitive, TooltipPrimitive, plateParagraph, DropdownMenuPrimitive, plateBlockQuote, plateFloating, windowSize, graphql, gql, schemaTools, yup, core, reactRouterDom, mdx) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/plate"), require("slate-react"), require("@udecode/plate-slash-command"), require("@udecode/cn"), require("@udecode/plate-common"), require("@udecode/plate-heading"), require("class-variance-authority"), require("lucide-react"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("@radix-ui/react-popover"), require("@udecode/plate-table"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("@udecode/plate-resizable"), 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/plate", "slate-react", "@udecode/plate-slash-command", "@udecode/cn", "@udecode/plate-common", "@udecode/plate-heading", "class-variance-authority", "lucide-react", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "@radix-ui/react-popover", "@udecode/plate-table", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "@udecode/plate-resizable", "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));
3
+ })(this, function(exports2, zod, React, reactDom, plate, slateReact, plateSlashCommand, cn$1, plateCommon, plateHeading, classVarianceAuthority, lucideReact, react, plateCombobox, plateCodeBlock, MonacoEditor, react$1, PopoverPrimitive, plateTable, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, plateResizable, 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(
@@ -993,7 +993,7 @@ var __publicField = (obj, key, value) => {
993
993
  },
994
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
995
  );
996
- classVarianceAuthority.cva("", {
996
+ const iconVariants = classVarianceAuthority.cva("", {
997
997
  variants: {
998
998
  variant: {
999
999
  toolbar: "size-5",
@@ -2136,25 +2136,501 @@ var __publicField = (obj, key, value) => {
2136
2136
  onChange: (value2) => {
2137
2137
  plateCommon.setNodes(editor, { value: value2, lang: language });
2138
2138
  }
2139
- }
2140
- )))
2139
+ }
2140
+ )))
2141
+ );
2142
+ };
2143
+ const CodeBlockElement = cn$1.withRef(
2144
+ ({ className, ...props }, ref) => {
2145
+ const { element } = props;
2146
+ const state = plateCodeBlock.useCodeBlockElementState({ element });
2147
+ return /* @__PURE__ */ React.createElement(
2148
+ plateCommon.PlateElement,
2149
+ {
2150
+ className: cn$1.cn("relative py-1", state.className, className),
2151
+ ref,
2152
+ ...props
2153
+ },
2154
+ /* @__PURE__ */ React.createElement(CodeBlock, { ...props })
2155
+ );
2156
+ }
2157
+ );
2158
+ const buttonVariants$1 = classVarianceAuthority.cva(
2159
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
2160
+ {
2161
+ defaultVariants: {
2162
+ size: "default",
2163
+ variant: "default"
2164
+ },
2165
+ variants: {
2166
+ isMenu: {
2167
+ true: "h-auto w-full cursor-pointer justify-start"
2168
+ },
2169
+ size: {
2170
+ default: "h-10 px-4 py-2",
2171
+ icon: "size-10",
2172
+ lg: "h-11 rounded-md px-8",
2173
+ none: "",
2174
+ sm: "h-9 rounded-md px-3",
2175
+ sms: "size-9 rounded-md px-0",
2176
+ xs: "h-8 rounded-md px-3"
2177
+ },
2178
+ variant: {
2179
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
2180
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
2181
+ ghost: "hover:bg-accent hover:text-accent-foreground",
2182
+ inlineLink: "text-base text-primary underline underline-offset-4",
2183
+ link: "text-primary underline-offset-4 hover:underline",
2184
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
2185
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
2186
+ }
2187
+ }
2188
+ }
2189
+ );
2190
+ const Button$2 = cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
2191
+ const Comp = asChild ? reactSlot.Slot : "button";
2192
+ return /* @__PURE__ */ React__namespace.createElement(
2193
+ Comp,
2194
+ {
2195
+ className: cn$1.cn(buttonVariants$1({ className, isMenu, size, variant })),
2196
+ ref,
2197
+ ...props
2198
+ }
2199
+ );
2200
+ });
2201
+ const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
2202
+ const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
2203
+ const DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
2204
+ const DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
2205
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
2206
+ const DropdownMenuSubTrigger = cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
2207
+ DropdownMenuPrimitive__namespace.SubTrigger,
2208
+ {
2209
+ className: cn$1.cn(
2210
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
2211
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2212
+ inset && "pl-8",
2213
+ className
2214
+ ),
2215
+ ref,
2216
+ ...props
2217
+ },
2218
+ children,
2219
+ /* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
2220
+ ));
2221
+ const DropdownMenuSubContent = cn$1.withCn(
2222
+ DropdownMenuPrimitive__namespace.SubContent,
2223
+ "z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
2224
+ );
2225
+ const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
2226
+ className: cn$1.cn(
2227
+ "z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
2228
+ ),
2229
+ sideOffset: 4
2230
+ });
2231
+ const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
2232
+ const menuItemVariants = classVarianceAuthority.cva(
2233
+ cn$1.cn(
2234
+ "relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
2235
+ "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
2236
+ ),
2237
+ {
2238
+ variants: {
2239
+ inset: {
2240
+ true: "pl-8"
2241
+ }
2242
+ }
2243
+ }
2244
+ );
2245
+ const DropdownMenuItem = cn$1.withVariants(
2246
+ DropdownMenuPrimitive__namespace.Item,
2247
+ menuItemVariants,
2248
+ ["inset"]
2249
+ );
2250
+ const DropdownMenuCheckboxItem = cn$1.withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React.createElement(
2251
+ DropdownMenuPrimitive__namespace.CheckboxItem,
2252
+ {
2253
+ className: cn$1.cn(
2254
+ "relative flex select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2255
+ "cursor-pointer",
2256
+ className
2257
+ ),
2258
+ ref,
2259
+ ...props
2260
+ },
2261
+ /* @__PURE__ */ React.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
2262
+ children
2263
+ ));
2264
+ const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
2265
+ DropdownMenuPrimitive__namespace.RadioItem,
2266
+ {
2267
+ className: cn$1.cn(
2268
+ "relative flex select-none items-center rounded-sm pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2269
+ "h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
2270
+ className
2271
+ ),
2272
+ ref,
2273
+ ...props
2274
+ },
2275
+ !hideIcon && /* @__PURE__ */ React.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
2276
+ children
2277
+ ));
2278
+ const dropdownMenuLabelVariants = classVarianceAuthority.cva(
2279
+ cn$1.cn("select-none px-2 py-1.5 text-sm font-semibold"),
2280
+ {
2281
+ variants: {
2282
+ inset: {
2283
+ true: "pl-8"
2284
+ }
2285
+ }
2286
+ }
2287
+ );
2288
+ const DropdownMenuLabel = cn$1.withVariants(
2289
+ DropdownMenuPrimitive__namespace.Label,
2290
+ dropdownMenuLabelVariants,
2291
+ ["inset"]
2292
+ );
2293
+ const DropdownMenuSeparator = cn$1.withCn(
2294
+ DropdownMenuPrimitive__namespace.Separator,
2295
+ "-mx-1 my-1 h-px bg-muted"
2296
+ );
2297
+ cn$1.withCn(
2298
+ cn$1.createPrimitiveElement("span"),
2299
+ "ml-auto text-xs tracking-widest opacity-60"
2300
+ );
2301
+ const useOpenState = () => {
2302
+ const [open2, setOpen] = React.useState(false);
2303
+ const onOpenChange = React.useCallback(
2304
+ (_value = !open2) => {
2305
+ setOpen(_value);
2306
+ },
2307
+ [open2]
2308
+ );
2309
+ return {
2310
+ onOpenChange,
2311
+ open: open2
2312
+ };
2313
+ };
2314
+ const Popover$2 = PopoverPrimitive__namespace.Root;
2315
+ const popoverVariants = classVarianceAuthority.cva(
2316
+ "w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 print:hidden"
2317
+ );
2318
+ const PopoverContent$1 = cn$1.withRef(
2319
+ ({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
2320
+ PopoverPrimitive__namespace.Content,
2321
+ {
2322
+ align,
2323
+ className: cn$1.cn(popoverVariants(), className),
2324
+ ref,
2325
+ sideOffset,
2326
+ style: { zIndex: 1e3, ...style },
2327
+ ...props
2328
+ }
2329
+ ))
2330
+ );
2331
+ const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
2332
+ defaultVariants: {
2333
+ orientation: "horizontal"
2334
+ },
2335
+ variants: {
2336
+ orientation: {
2337
+ horizontal: "h-px w-full",
2338
+ vertical: "h-full w-px"
2339
+ }
2340
+ }
2341
+ });
2342
+ const Separator = cn$1.withVariants(
2343
+ cn$1.withProps(SeparatorPrimitive__namespace.Root, {
2344
+ decorative: true,
2345
+ orientation: "horizontal"
2346
+ }),
2347
+ separatorVariants
2348
+ );
2349
+ const TableBordersDropdownMenuContent = cn$1.withRef((props, ref) => {
2350
+ const {
2351
+ getOnSelectTableBorder,
2352
+ hasBottomBorder,
2353
+ hasLeftBorder,
2354
+ hasNoBorders,
2355
+ hasOuterBorders,
2356
+ hasRightBorder,
2357
+ hasTopBorder
2358
+ } = plateTable.useTableBordersDropdownMenuContentState();
2359
+ return /* @__PURE__ */ React.createElement(
2360
+ DropdownMenuContent,
2361
+ {
2362
+ align: "start",
2363
+ className: cn$1.cn("min-w-[220px]"),
2364
+ ref,
2365
+ side: "right",
2366
+ sideOffset: 0,
2367
+ ...props
2368
+ },
2369
+ /* @__PURE__ */ React.createElement(
2370
+ DropdownMenuCheckboxItem,
2371
+ {
2372
+ checked: hasBottomBorder,
2373
+ onCheckedChange: getOnSelectTableBorder("bottom")
2374
+ },
2375
+ /* @__PURE__ */ React.createElement(Icons.borderBottom, { className: iconVariants({ size: "sm" }) }),
2376
+ /* @__PURE__ */ React.createElement("div", null, "Bottom Border")
2377
+ ),
2378
+ /* @__PURE__ */ React.createElement(
2379
+ DropdownMenuCheckboxItem,
2380
+ {
2381
+ checked: hasTopBorder,
2382
+ onCheckedChange: getOnSelectTableBorder("top")
2383
+ },
2384
+ /* @__PURE__ */ React.createElement(Icons.borderTop, { className: iconVariants({ size: "sm" }) }),
2385
+ /* @__PURE__ */ React.createElement("div", null, "Top Border")
2386
+ ),
2387
+ /* @__PURE__ */ React.createElement(
2388
+ DropdownMenuCheckboxItem,
2389
+ {
2390
+ checked: hasLeftBorder,
2391
+ onCheckedChange: getOnSelectTableBorder("left")
2392
+ },
2393
+ /* @__PURE__ */ React.createElement(Icons.borderLeft, { className: iconVariants({ size: "sm" }) }),
2394
+ /* @__PURE__ */ React.createElement("div", null, "Left Border")
2395
+ ),
2396
+ /* @__PURE__ */ React.createElement(
2397
+ DropdownMenuCheckboxItem,
2398
+ {
2399
+ checked: hasRightBorder,
2400
+ onCheckedChange: getOnSelectTableBorder("right")
2401
+ },
2402
+ /* @__PURE__ */ React.createElement(Icons.borderRight, { className: iconVariants({ size: "sm" }) }),
2403
+ /* @__PURE__ */ React.createElement("div", null, "Right Border")
2404
+ ),
2405
+ /* @__PURE__ */ React.createElement(Separator, null),
2406
+ /* @__PURE__ */ React.createElement(
2407
+ DropdownMenuCheckboxItem,
2408
+ {
2409
+ checked: hasNoBorders,
2410
+ onCheckedChange: getOnSelectTableBorder("none")
2411
+ },
2412
+ /* @__PURE__ */ React.createElement(Icons.borderNone, { className: iconVariants({ size: "sm" }) }),
2413
+ /* @__PURE__ */ React.createElement("div", null, "No Border")
2414
+ ),
2415
+ /* @__PURE__ */ React.createElement(
2416
+ DropdownMenuCheckboxItem,
2417
+ {
2418
+ checked: hasOuterBorders,
2419
+ onCheckedChange: getOnSelectTableBorder("outer")
2420
+ },
2421
+ /* @__PURE__ */ React.createElement(Icons.borderAll, { className: iconVariants({ size: "sm" }) }),
2422
+ /* @__PURE__ */ React.createElement("div", null, "Outside Borders")
2423
+ )
2424
+ );
2425
+ });
2426
+ const TableFloatingToolbar = cn$1.withRef(
2427
+ ({ children, ...props }, ref) => {
2428
+ const element = plateCommon.useElement();
2429
+ const { props: buttonProps } = plateCommon.useRemoveNodeButton({ element });
2430
+ const selectionCollapsed = plateCommon.useEditorSelector(
2431
+ (editor2) => !plateCommon.isSelectionExpanded(editor2),
2432
+ []
2433
+ );
2434
+ const readOnly = slateReact.useReadOnly();
2435
+ const selected = slateReact.useSelected();
2436
+ const editor = plateCommon.useEditorRef();
2437
+ const collapsed = !readOnly && selected && selectionCollapsed;
2438
+ const open2 = !readOnly && selected;
2439
+ const { canMerge, canUnmerge } = plateTable.useTableMergeState();
2440
+ const mergeContent = canMerge && /* @__PURE__ */ React.createElement(
2441
+ Button$2,
2442
+ {
2443
+ contentEditable: false,
2444
+ isMenu: true,
2445
+ onClick: () => plateTable.mergeTableCells(editor),
2446
+ variant: "ghost"
2447
+ },
2448
+ /* @__PURE__ */ React.createElement(Icons.combine, { className: "mr-2 size-4" }),
2449
+ "Merge"
2450
+ );
2451
+ const unmergeButton = canUnmerge && /* @__PURE__ */ React.createElement(
2452
+ Button$2,
2453
+ {
2454
+ contentEditable: false,
2455
+ isMenu: true,
2456
+ onClick: () => plateTable.unmergeTableCells(editor),
2457
+ variant: "ghost"
2458
+ },
2459
+ /* @__PURE__ */ React.createElement(Icons.ungroup, { className: "mr-2 size-4" }),
2460
+ "Unmerge"
2461
+ );
2462
+ const bordersContent = collapsed && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(Button$2, { isMenu: true, variant: "ghost" }, /* @__PURE__ */ React.createElement(Icons.borderAll, { className: "mr-2 size-4" }), "Borders")), /* @__PURE__ */ React.createElement(DropdownMenuPortal, null, /* @__PURE__ */ React.createElement(TableBordersDropdownMenuContent, null))), /* @__PURE__ */ React.createElement(Button$2, { contentEditable: false, isMenu: true, variant: "ghost", ...buttonProps }, /* @__PURE__ */ React.createElement(Icons.delete, { className: "mr-2 size-4" }), "Delete"));
2463
+ return /* @__PURE__ */ React.createElement(Popover$2, { modal: false, open: open2 }, /* @__PURE__ */ React.createElement(PopoverPrimitive.PopoverAnchor, { asChild: true }, children), (canMerge || canUnmerge || collapsed) && /* @__PURE__ */ React.createElement(
2464
+ PopoverContent$1,
2465
+ {
2466
+ className: cn$1.cn(
2467
+ popoverVariants(),
2468
+ "flex w-[220px] flex-col gap-1 p-1"
2469
+ ),
2470
+ onOpenAutoFocus: (e) => e.preventDefault(),
2471
+ ref,
2472
+ ...props
2473
+ },
2474
+ unmergeButton,
2475
+ mergeContent,
2476
+ bordersContent
2477
+ ));
2478
+ }
2479
+ );
2480
+ const TableElement = plateCommon.withHOC(
2481
+ plateTable.TableProvider,
2482
+ cn$1.withRef(({ children, className, ...props }, ref) => {
2483
+ const { colSizes, isSelectingCell, marginLeft, minColumnWidth } = plateTable.useTableElementState();
2484
+ const { colGroupProps, props: tableProps } = plateTable.useTableElement();
2485
+ return /* @__PURE__ */ React.createElement(TableFloatingToolbar, null, /* @__PURE__ */ React.createElement("div", { style: { paddingLeft: marginLeft } }, /* @__PURE__ */ React.createElement(
2486
+ plateCommon.PlateElement,
2487
+ {
2488
+ asChild: true,
2489
+ className: cn$1.cn(
2490
+ "my-4 ml-px mr-0 table h-px w-full table-fixed border-collapse",
2491
+ isSelectingCell && "[&_*::selection]:bg-none",
2492
+ className
2493
+ ),
2494
+ ref,
2495
+ ...tableProps,
2496
+ ...props
2497
+ },
2498
+ /* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("colgroup", { ...colGroupProps }, colSizes.map((width, index) => /* @__PURE__ */ React.createElement(
2499
+ "col",
2500
+ {
2501
+ key: index,
2502
+ style: {
2503
+ minWidth: minColumnWidth,
2504
+ width: width || void 0
2505
+ }
2506
+ }
2507
+ ))), /* @__PURE__ */ React.createElement("tbody", { className: "min-w-full" }, children))
2508
+ )));
2509
+ })
2510
+ );
2511
+ const TableRowElement = cn$1.withRef(({ children, hideBorder, ...props }, ref) => {
2512
+ return /* @__PURE__ */ React.createElement(
2513
+ plateCommon.PlateElement,
2514
+ {
2515
+ asChild: true,
2516
+ className: cn$1.cn("h-full", hideBorder && "border-none"),
2517
+ ref,
2518
+ ...props
2519
+ },
2520
+ /* @__PURE__ */ React.createElement("tr", null, children)
2521
+ );
2522
+ });
2523
+ const TableCellElement = cn$1.withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
2524
+ var _a, _b, _c, _d;
2525
+ const { element } = props;
2526
+ const {
2527
+ borders,
2528
+ colIndex,
2529
+ colSpan,
2530
+ hovered,
2531
+ hoveredLeft,
2532
+ isSelectingCell,
2533
+ readOnly,
2534
+ rowIndex,
2535
+ rowSize,
2536
+ selected
2537
+ } = plateTable.useTableCellElementState();
2538
+ const { props: cellProps } = plateTable.useTableCellElement({ element: props.element });
2539
+ const resizableState = plateTable.useTableCellElementResizableState({
2540
+ colIndex,
2541
+ colSpan,
2542
+ rowIndex
2543
+ });
2544
+ const { bottomProps, hiddenLeft, leftProps, rightProps } = plateTable.useTableCellElementResizable(resizableState);
2545
+ const Cell = isHeader ? "th" : "td";
2546
+ return /* @__PURE__ */ React.createElement(
2547
+ plateCommon.PlateElement,
2548
+ {
2549
+ asChild: true,
2550
+ className: cn$1.cn(
2551
+ "relative h-full overflow-visible border-none bg-background p-0",
2552
+ hideBorder && "before:border-none",
2553
+ element.background ? "bg-[--cellBackground]" : "bg-background",
2554
+ !hideBorder && cn$1.cn(
2555
+ isHeader && "text-left [&_>_*]:m-0",
2556
+ "before:size-full",
2557
+ selected && "before:z-10 before:bg-muted",
2558
+ "before:absolute before:box-border before:select-none before:content-['']",
2559
+ borders && cn$1.cn(
2560
+ ((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
2561
+ ((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
2562
+ ((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
2563
+ ((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
2564
+ )
2565
+ ),
2566
+ className
2567
+ ),
2568
+ ref,
2569
+ ...cellProps,
2570
+ ...props,
2571
+ style: {
2572
+ "--cellBackground": element.background,
2573
+ ...style
2574
+ }
2575
+ },
2576
+ /* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(
2577
+ "div",
2578
+ {
2579
+ className: "relative z-20 box-border h-full px-3 py-2",
2580
+ style: {
2581
+ minHeight: rowSize
2582
+ }
2583
+ },
2584
+ children
2585
+ ), !isSelectingCell && /* @__PURE__ */ React.createElement(
2586
+ "div",
2587
+ {
2588
+ className: "group absolute top-0 size-full select-none",
2589
+ contentEditable: false,
2590
+ suppressContentEditableWarning: true
2591
+ },
2592
+ !readOnly && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
2593
+ plateResizable.ResizeHandle,
2594
+ {
2595
+ ...rightProps,
2596
+ className: "-top-3 right-[-5px] w-[10px]"
2597
+ }
2598
+ ), /* @__PURE__ */ React.createElement(
2599
+ plateResizable.ResizeHandle,
2600
+ {
2601
+ ...bottomProps,
2602
+ className: "bottom-[-5px] h-[10px]"
2603
+ }
2604
+ ), !hiddenLeft && /* @__PURE__ */ React.createElement(
2605
+ plateResizable.ResizeHandle,
2606
+ {
2607
+ ...leftProps,
2608
+ className: "-top-3 left-[-5px] w-[10px]"
2609
+ }
2610
+ ), hovered && /* @__PURE__ */ React.createElement(
2611
+ "div",
2612
+ {
2613
+ className: cn$1.cn(
2614
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2615
+ "right-[-1.5px]"
2616
+ )
2617
+ }
2618
+ ), hoveredLeft && /* @__PURE__ */ React.createElement(
2619
+ "div",
2620
+ {
2621
+ className: cn$1.cn(
2622
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2623
+ "left-[-1.5px]"
2624
+ )
2625
+ }
2626
+ ))
2627
+ ))
2141
2628
  );
2142
- };
2143
- const CodeBlockElement = cn$1.withRef(
2144
- ({ className, ...props }, ref) => {
2145
- const { element } = props;
2146
- const state = plateCodeBlock.useCodeBlockElementState({ element });
2147
- return /* @__PURE__ */ React.createElement(
2148
- plateCommon.PlateElement,
2149
- {
2150
- className: cn$1.cn("relative py-1", state.className, className),
2151
- ref,
2152
- ...props
2153
- },
2154
- /* @__PURE__ */ React.createElement(CodeBlock, { ...props })
2155
- );
2156
- }
2157
- );
2629
+ });
2630
+ TableCellElement.displayName = "TableCellElement";
2631
+ const TableCellHeaderElement = cn$1.withProps(TableCellElement, {
2632
+ isHeader: true
2633
+ });
2158
2634
  const blockClasses = "mt-0.5";
2159
2635
  const headerClasses = "font-normal";
2160
2636
  const Components = () => {
@@ -2340,7 +2816,11 @@ var __publicField = (obj, key, value) => {
2340
2816
  children,
2341
2817
  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
2818
  );
2343
- }
2819
+ },
2820
+ [plate.ELEMENT_TABLE]: TableElement,
2821
+ [plate.ELEMENT_TR]: TableRowElement,
2822
+ [plate.ELEMENT_TD]: TableCellElement,
2823
+ [plate.ELEMENT_TH]: TableCellHeaderElement
2344
2824
  };
2345
2825
  };
2346
2826
  const createCodeBlockPlugin = plateCommon.createPluginFactory({
@@ -4410,7 +4890,7 @@ var __publicField = (obj, key, value) => {
4410
4890
  function cn(...inputs) {
4411
4891
  return tailwindMerge.twMerge(clsx.clsx(inputs));
4412
4892
  }
4413
- const buttonVariants$1 = classVarianceAuthority.cva(
4893
+ const buttonVariants = classVarianceAuthority.cva(
4414
4894
  "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
4895
  {
4416
4896
  variants: {
@@ -4436,7 +4916,7 @@ var __publicField = (obj, key, value) => {
4436
4916
  return /* @__PURE__ */ React__namespace.createElement(
4437
4917
  Comp,
4438
4918
  {
4439
- className: cn(buttonVariants$1({ variant, size, className })),
4919
+ className: cn(buttonVariants({ variant, size, className })),
4440
4920
  ref,
4441
4921
  ...props
4442
4922
  }
@@ -9700,7 +10180,7 @@ var __publicField = (obj, key, value) => {
9700
10180
  "Event Log"
9701
10181
  ));
9702
10182
  };
9703
- const version = "2.2.8";
10183
+ const version = "2.2.9";
9704
10184
  const Nav = ({
9705
10185
  isLocalMode,
9706
10186
  className = "",
@@ -13207,13 +13687,25 @@ var __publicField = (obj, key, value) => {
13207
13687
  plate.createUnderlinePlugin(),
13208
13688
  plate.createCodePlugin(),
13209
13689
  plate.createListPlugin(),
13210
- plate.createIndentPlugin(),
13211
13690
  plate.createIndentListPlugin(),
13212
13691
  plate.createHorizontalRulePlugin(),
13213
13692
  // Allows us to do things like copy/paste, remembering the state of the element (like mdx)
13214
13693
  plate.createNodeIdPlugin(),
13215
- plateSlashCommand.createSlashPlugin()
13694
+ plateSlashCommand.createSlashPlugin(),
13695
+ plate.createTablePlugin()
13216
13696
  ];
13697
+ const unsupportedItemsInTable = /* @__PURE__ */ new Set([
13698
+ "Code Block",
13699
+ "Unordered List",
13700
+ "Ordered List",
13701
+ "Quote",
13702
+ "Heading 1",
13703
+ "Heading 2",
13704
+ "Heading 3",
13705
+ "Heading 4",
13706
+ "Heading 5",
13707
+ "Heading 6"
13708
+ ]);
13217
13709
  const isNodeActive = (editor, type) => {
13218
13710
  const pluginType = plateCommon.getPluginType(editor, type);
13219
13711
  return !!(editor == null ? void 0 : editor.selection) && plateCommon.someNode(editor, { match: { type: pluginType } });
@@ -13398,24 +13890,6 @@ var __publicField = (obj, key, value) => {
13398
13890
  }
13399
13891
  );
13400
13892
  Editor.displayName = "Editor";
13401
- const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
13402
- defaultVariants: {
13403
- orientation: "horizontal"
13404
- },
13405
- variants: {
13406
- orientation: {
13407
- horizontal: "h-px w-full",
13408
- vertical: "h-full w-px"
13409
- }
13410
- }
13411
- });
13412
- const Separator = cn$1.withVariants(
13413
- cn$1.withProps(SeparatorPrimitive__namespace.Root, {
13414
- decorative: true,
13415
- orientation: "horizontal"
13416
- }),
13417
- separatorVariants
13418
- );
13419
13893
  const TooltipProvider = TooltipPrimitive__namespace.Provider;
13420
13894
  const Tooltip = TooltipPrimitive__namespace.Root;
13421
13895
  const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
@@ -13574,117 +14048,6 @@ var __publicField = (obj, key, value) => {
13574
14048
  nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
13575
14049
  );
13576
14050
  });
13577
- const DropdownMenu = DropdownMenuPrimitive__namespace.Root;
13578
- const DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
13579
- const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
13580
- cn$1.withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React.createElement(
13581
- DropdownMenuPrimitive__namespace.SubTrigger,
13582
- {
13583
- className: cn$1.cn(
13584
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
13585
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13586
- inset && "pl-8",
13587
- className
13588
- ),
13589
- ref,
13590
- ...props
13591
- },
13592
- children,
13593
- /* @__PURE__ */ React.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
13594
- ));
13595
- cn$1.withCn(
13596
- DropdownMenuPrimitive__namespace.SubContent,
13597
- "z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
13598
- );
13599
- const DropdownMenuContentVariants = cn$1.withProps(DropdownMenuPrimitive__namespace.Content, {
13600
- className: cn$1.cn(
13601
- "z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
13602
- ),
13603
- sideOffset: 4
13604
- });
13605
- const DropdownMenuContent = cn$1.withRef(({ ...props }, ref) => /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenuContentVariants, { ref, ...props })));
13606
- const menuItemVariants = classVarianceAuthority.cva(
13607
- cn$1.cn(
13608
- "relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
13609
- "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
13610
- ),
13611
- {
13612
- variants: {
13613
- inset: {
13614
- true: "pl-8"
13615
- }
13616
- }
13617
- }
13618
- );
13619
- const DropdownMenuItem = cn$1.withVariants(
13620
- DropdownMenuPrimitive__namespace.Item,
13621
- menuItemVariants,
13622
- ["inset"]
13623
- );
13624
- cn$1.withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React.createElement(
13625
- DropdownMenuPrimitive__namespace.CheckboxItem,
13626
- {
13627
- className: cn$1.cn(
13628
- "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",
13629
- "cursor-pointer",
13630
- className
13631
- ),
13632
- ref,
13633
- ...props
13634
- },
13635
- /* @__PURE__ */ React.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
13636
- children
13637
- ));
13638
- const DropdownMenuRadioItem = cn$1.withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React.createElement(
13639
- DropdownMenuPrimitive__namespace.RadioItem,
13640
- {
13641
- className: cn$1.cn(
13642
- "relative flex select-none items-center rounded-sm pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13643
- "h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
13644
- className
13645
- ),
13646
- ref,
13647
- ...props
13648
- },
13649
- !hideIcon && /* @__PURE__ */ React.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React.createElement(Icons.check, { className: "size-4" }))),
13650
- children
13651
- ));
13652
- const dropdownMenuLabelVariants = classVarianceAuthority.cva(
13653
- cn$1.cn("select-none px-2 py-1.5 text-sm font-semibold"),
13654
- {
13655
- variants: {
13656
- inset: {
13657
- true: "pl-8"
13658
- }
13659
- }
13660
- }
13661
- );
13662
- const DropdownMenuLabel = cn$1.withVariants(
13663
- DropdownMenuPrimitive__namespace.Label,
13664
- dropdownMenuLabelVariants,
13665
- ["inset"]
13666
- );
13667
- const DropdownMenuSeparator = cn$1.withCn(
13668
- DropdownMenuPrimitive__namespace.Separator,
13669
- "-mx-1 my-1 h-px bg-muted"
13670
- );
13671
- cn$1.withCn(
13672
- cn$1.createPrimitiveElement("span"),
13673
- "ml-auto text-xs tracking-widest opacity-60"
13674
- );
13675
- const useOpenState = () => {
13676
- const [open2, setOpen] = React.useState(false);
13677
- const onOpenChange = React.useCallback(
13678
- (_value = !open2) => {
13679
- setOpen(_value);
13680
- },
13681
- [open2]
13682
- );
13683
- return {
13684
- onOpenChange,
13685
- open: open2
13686
- };
13687
- };
13688
14051
  const items$1 = [
13689
14052
  {
13690
14053
  description: "Paragraph",
@@ -13749,7 +14112,9 @@ var __publicField = (obj, key, value) => {
13749
14112
  return allNodesMatchInitialNodeType ? initialNodeType : plateParagraph.ELEMENT_PARAGRAPH;
13750
14113
  }, []);
13751
14114
  const editor = plateCommon.useEditorRef();
14115
+ const editorState = plateCommon.useEditorState();
13752
14116
  const openState = useOpenState();
14117
+ const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
13753
14118
  const selectedItem = items$1.find((item) => item.value === value) ?? defaultItem$1;
13754
14119
  const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
13755
14120
  return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
@@ -13773,7 +14138,12 @@ var __publicField = (obj, key, value) => {
13773
14138
  },
13774
14139
  value
13775
14140
  },
13776
- items$1.map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
14141
+ items$1.filter((item) => {
14142
+ if (userInTable) {
14143
+ return !unsupportedItemsInTable.has(item.label);
14144
+ }
14145
+ return true;
14146
+ }).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React.createElement(
13777
14147
  DropdownMenuRadioItem,
13778
14148
  {
13779
14149
  className: "min-w-[180px]",
@@ -13993,6 +14363,108 @@ var __publicField = (obj, key, value) => {
13993
14363
  /* @__PURE__ */ React.createElement(Icons.overflow, { className: "size-5" })
13994
14364
  )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
13995
14365
  }
14366
+ function TableDropdownMenu(props) {
14367
+ const tableSelected = plateCommon.useEditorSelector(
14368
+ (editor2) => plateCommon.someNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } }),
14369
+ []
14370
+ );
14371
+ const [enableDeleteColumn, enableDeleteRow] = plateCommon.useEditorSelector((editor2) => {
14372
+ const tableNodeEntry = plateCommon.findNode(editor2, { match: { type: plateTable.ELEMENT_TABLE } });
14373
+ if (!tableNodeEntry)
14374
+ return [false, false];
14375
+ const [tableNode] = tableNodeEntry;
14376
+ if (!plateCommon.isElement(tableNode))
14377
+ return [false, false];
14378
+ const columnCount = plateTable.getTableColumnCount(tableNode);
14379
+ const rowCount = tableNode.children.length;
14380
+ return [columnCount > 1, rowCount > 1];
14381
+ }, []);
14382
+ const editor = plateCommon.useEditorRef();
14383
+ const openState = useOpenState();
14384
+ 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(
14385
+ DropdownMenuContent,
14386
+ {
14387
+ align: "start",
14388
+ className: "flex w-[180px] min-w-0 flex-col gap-0.5"
14389
+ },
14390
+ /* @__PURE__ */ React.createElement(
14391
+ DropdownMenuItem,
14392
+ {
14393
+ className: "min-w-[180px]",
14394
+ disabled: tableSelected,
14395
+ onSelect: () => {
14396
+ plateTable.insertTable(editor);
14397
+ plateCommon.focusEditor(editor);
14398
+ }
14399
+ },
14400
+ /* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14401
+ "Insert table"
14402
+ ),
14403
+ /* @__PURE__ */ React.createElement(
14404
+ DropdownMenuItem,
14405
+ {
14406
+ className: "min-w-[180px]",
14407
+ disabled: !tableSelected,
14408
+ onSelect: () => {
14409
+ plateTable.deleteTable(editor);
14410
+ plateCommon.focusEditor(editor);
14411
+ }
14412
+ },
14413
+ /* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14414
+ "Delete table"
14415
+ ),
14416
+ /* @__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(
14417
+ DropdownMenuItem,
14418
+ {
14419
+ className: "min-w-[180px]",
14420
+ disabled: !tableSelected,
14421
+ onSelect: () => {
14422
+ plateTable.insertTableColumn(editor);
14423
+ plateCommon.focusEditor(editor);
14424
+ }
14425
+ },
14426
+ /* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14427
+ "Insert column after"
14428
+ ), /* @__PURE__ */ React.createElement(
14429
+ DropdownMenuItem,
14430
+ {
14431
+ className: "min-w-[180px]",
14432
+ disabled: !enableDeleteColumn,
14433
+ onSelect: () => {
14434
+ plateTable.deleteColumn(editor);
14435
+ plateCommon.focusEditor(editor);
14436
+ }
14437
+ },
14438
+ /* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14439
+ "Delete column"
14440
+ ))),
14441
+ /* @__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(
14442
+ DropdownMenuItem,
14443
+ {
14444
+ className: "min-w-[180px]",
14445
+ disabled: !tableSelected,
14446
+ onSelect: () => {
14447
+ plateTable.insertTableRow(editor);
14448
+ plateCommon.focusEditor(editor);
14449
+ }
14450
+ },
14451
+ /* @__PURE__ */ React.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14452
+ "Insert row after"
14453
+ ), /* @__PURE__ */ React.createElement(
14454
+ DropdownMenuItem,
14455
+ {
14456
+ className: "min-w-[180px]",
14457
+ disabled: !enableDeleteRow,
14458
+ onSelect: () => {
14459
+ plateTable.deleteRow(editor);
14460
+ plateCommon.focusEditor(editor);
14461
+ }
14462
+ },
14463
+ /* @__PURE__ */ React.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14464
+ "Delete row"
14465
+ )))
14466
+ ));
14467
+ }
13996
14468
  const toolbarItems = {
13997
14469
  heading: {
13998
14470
  label: "Headings",
@@ -14034,6 +14506,10 @@ var __publicField = (obj, key, value) => {
14034
14506
  label: "Code Block",
14035
14507
  Component: /* @__PURE__ */ React.createElement(CodeBlockToolbarButton, null)
14036
14508
  },
14509
+ table: {
14510
+ label: "Table",
14511
+ Component: /* @__PURE__ */ React.createElement(TableDropdownMenu, null)
14512
+ },
14037
14513
  raw: {
14038
14514
  label: "Raw Markdown",
14039
14515
  Component: /* @__PURE__ */ React.createElement(RawMarkdownToolbarButton, null)
@@ -14052,7 +14528,14 @@ var __publicField = (obj, key, value) => {
14052
14528
  const itemsShown2 = (width - EMBED_ICON_WIDTH) / ICON_WIDTH;
14053
14529
  setItemsShown(Math.floor(itemsShown2));
14054
14530
  });
14055
- const toolbarItemsArray = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14531
+ let toolbarItemsArray = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14532
+ const editorState = plateCommon.useEditorState();
14533
+ const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
14534
+ if (userInTable) {
14535
+ toolbarItemsArray = toolbarItemsArray.filter(
14536
+ (item) => !unsupportedItemsInTable.has(item.label)
14537
+ );
14538
+ }
14056
14539
  return /* @__PURE__ */ React.createElement("div", { className: "w-full overflow-hidden", ref: toolbarRef }, /* @__PURE__ */ React.createElement(
14057
14540
  "div",
14058
14541
  {
@@ -14061,7 +14544,7 @@ var __publicField = (obj, key, value) => {
14061
14544
  transform: "translateX(calc(-1px))"
14062
14545
  }
14063
14546
  },
14064
- /* @__PURE__ */ React.createElement(React.Fragment, null, toolbarItemsArray.slice(0, itemsShown).map((item, index) => /* @__PURE__ */ React.createElement(React.Fragment, { key: item.label }, item.Component)), toolbarItemsArray.length > itemsShown && /* @__PURE__ */ React.createElement(OverflowMenu, null, toolbarItemsArray.slice(itemsShown).flatMap((c) => /* @__PURE__ */ React.createElement(React.Fragment, { key: c.label }, c.Component))))
14547
+ /* @__PURE__ */ React.createElement(React.Fragment, null, toolbarItemsArray.slice(0, itemsShown).map((item, _) => /* @__PURE__ */ React.createElement(React.Fragment, { key: item.label }, item.Component)), toolbarItemsArray.length > itemsShown && /* @__PURE__ */ React.createElement(OverflowMenu, null, toolbarItemsArray.slice(itemsShown).flatMap((c) => /* @__PURE__ */ React.createElement(React.Fragment, { key: c.label }, c.Component))))
14065
14548
  ));
14066
14549
  }
14067
14550
  const FloatingToolbar = cn$1.withRef(({ children, state, ...props }, componentRef) => {
@@ -14176,6 +14659,10 @@ var __publicField = (obj, key, value) => {
14176
14659
  const openState = useOpenState();
14177
14660
  const selectedItem = items.find((item) => item.value === value) ?? defaultItem;
14178
14661
  const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
14662
+ const editorState = plateCommon.useEditorState();
14663
+ const userInTable = helpers.isNodeActive(editorState, plateTable.ELEMENT_TABLE);
14664
+ if (userInTable)
14665
+ return null;
14179
14666
  return /* @__PURE__ */ React.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
14180
14667
  ToolbarButton,
14181
14668
  {
@@ -14217,49 +14704,6 @@ var __publicField = (obj, key, value) => {
14217
14704
  function FloatingToolbarButtons() {
14218
14705
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TurnIntoDropdownMenu, null));
14219
14706
  }
14220
- const buttonVariants = classVarianceAuthority.cva(
14221
- "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
14222
- {
14223
- defaultVariants: {
14224
- size: "default",
14225
- variant: "default"
14226
- },
14227
- variants: {
14228
- isMenu: {
14229
- true: "h-auto w-full cursor-pointer justify-start"
14230
- },
14231
- size: {
14232
- default: "h-10 px-4 py-2",
14233
- icon: "size-10",
14234
- lg: "h-11 rounded-md px-8",
14235
- none: "",
14236
- sm: "h-9 rounded-md px-3",
14237
- sms: "size-9 rounded-md px-0",
14238
- xs: "h-8 rounded-md px-3"
14239
- },
14240
- variant: {
14241
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
14242
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
14243
- ghost: "hover:bg-accent hover:text-accent-foreground",
14244
- inlineLink: "text-base text-primary underline underline-offset-4",
14245
- link: "text-primary underline-offset-4 hover:underline",
14246
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
14247
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
14248
- }
14249
- }
14250
- }
14251
- );
14252
- cn$1.withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
14253
- const Comp = asChild ? reactSlot.Slot : "button";
14254
- return /* @__PURE__ */ React__namespace.createElement(
14255
- Comp,
14256
- {
14257
- className: cn$1.cn(buttonVariants({ className, isMenu, size, variant })),
14258
- ref,
14259
- ...props
14260
- }
14261
- );
14262
- });
14263
14707
  const inputVariants = classVarianceAuthority.cva(
14264
14708
  "flex w-full rounded-md bg-transparent text-sm file:border-0 file:bg-background file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
14265
14709
  {
@@ -14280,22 +14724,6 @@ var __publicField = (obj, key, value) => {
14280
14724
  }
14281
14725
  );
14282
14726
  cn$1.withVariants("input", inputVariants, ["variant", "h"]);
14283
- const popoverVariants = classVarianceAuthority.cva(
14284
- "w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 print:hidden"
14285
- );
14286
- cn$1.withRef(
14287
- ({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
14288
- PopoverPrimitive__namespace.Content,
14289
- {
14290
- align,
14291
- className: cn$1.cn(popoverVariants(), className),
14292
- ref,
14293
- sideOffset,
14294
- style: { zIndex: 1e3, ...style },
14295
- ...props
14296
- }
14297
- ))
14298
- );
14299
14727
  const floatingOptions = {
14300
14728
  middleware: [
14301
14729
  plateFloating.offset(12),
@@ -14355,7 +14783,7 @@ var __publicField = (obj, key, value) => {
14355
14783
  const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex h-9 items-center gap-1" }, /* @__PURE__ */ React.createElement(
14356
14784
  "button",
14357
14785
  {
14358
- className: buttonVariants({ size: "sm", variant: "ghost" }),
14786
+ className: buttonVariants$1({ size: "sm", variant: "ghost" }),
14359
14787
  type: "button",
14360
14788
  ...editButtonProps
14361
14789
  },
@@ -14363,7 +14791,7 @@ var __publicField = (obj, key, value) => {
14363
14791
  ), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
14364
14792
  plateLink.LinkOpenButton,
14365
14793
  {
14366
- className: buttonVariants({
14794
+ className: buttonVariants$1({
14367
14795
  size: "sms",
14368
14796
  variant: "ghost"
14369
14797
  })
@@ -14372,7 +14800,7 @@ var __publicField = (obj, key, value) => {
14372
14800
  ), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
14373
14801
  "button",
14374
14802
  {
14375
- className: buttonVariants({
14803
+ className: buttonVariants$1({
14376
14804
  size: "sms",
14377
14805
  variant: "ghost"
14378
14806
  }),