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.mjs CHANGED
@@ -8,11 +8,11 @@ import { z } from "zod";
8
8
  import * as React from "react";
9
9
  import React__default, { useState, useCallback, createContext, forwardRef, useContext, useEffect, useMemo, startTransition, useRef, createElement, Component } from "react";
10
10
  import { createPortal, findDOMNode } from "react-dom";
11
- import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createBoldPlugin, createItalicPlugin, createUnderlinePlugin, createCodePlugin, createListPlugin, createIndentPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
12
- import { useSelected, ReactEditor } from "slate-react";
11
+ import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createBoldPlugin, createItalicPlugin, createUnderlinePlugin, createCodePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
12
+ import { useSelected, useReadOnly, ReactEditor } from "slate-react";
13
13
  import { ELEMENT_SLASH_INPUT, createSlashPlugin } from "@udecode/plate-slash-command";
14
- import { cn as cn$1, withRef, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
15
- import { useComposedRef, useEditorRef, findNodePath, getPointBefore, createPointRef, insertText, moveSelection, PlateElement, toggleNodeType, PlateLeaf, isCollapsed, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, setNodes, isElement, createPluginFactory, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, useMarkToolbarButtonState, useMarkToolbarButton, useEditorState, useEditorSelector, getNodeEntries, collapseSelection, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
14
+ import { cn as cn$1, withRef, withVariants, withCn, withProps, createPrimitiveElement } from "@udecode/cn";
15
+ import { useComposedRef, useEditorRef, findNodePath, getPointBefore, createPointRef, insertText, moveSelection, PlateElement, toggleNodeType, PlateLeaf, isCollapsed, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, setNodes, isElement, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, createPluginFactory, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, useMarkToolbarButtonState, useMarkToolbarButton, useEditorState, getNodeEntries, collapseSelection, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
16
16
  import { ELEMENT_H1, ELEMENT_H2, ELEMENT_H3, ELEMENT_H4 as ELEMENT_H4$1, ELEMENT_H5 as ELEMENT_H5$1, ELEMENT_H6 as ELEMENT_H6$1 } from "@udecode/plate-heading";
17
17
  import { cva } from "class-variance-authority";
18
18
  import { Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, ChevronDown, PaintBucket, Quote, Check, ChevronRight, ChevronsUpDown, X, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Search, Settings, Strikethrough, Subscript, Superscript, Table, Text, Underline, Link2Off, Eye, Moon, SunMedium, Twitter } from "lucide-react";
@@ -20,18 +20,23 @@ import { useComboboxContext, Combobox, useComboboxStore, ComboboxProvider, Porta
20
20
  import { useHTMLInputCursorState, useComboboxInput, filterWords } from "@udecode/plate-combobox";
21
21
  import { useCodeSyntaxLeaf, useCodeBlockElementState, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
22
22
  import MonacoEditor, { loader, useMonaco } from "@monaco-editor/react";
23
- import { Combobox as Combobox$1, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$2, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
23
+ import { Combobox as Combobox$1, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$3, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
24
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
25
+ import { PopoverAnchor } from "@radix-ui/react-popover";
26
+ import { useTableBordersDropdownMenuContentState, useTableMergeState, TableProvider, useTableElementState, useTableElement, mergeTableCells, unmergeTableCells, useTableCellElementState, useTableCellElement, useTableCellElementResizableState, useTableCellElementResizable, ELEMENT_TABLE as ELEMENT_TABLE$1, getTableColumnCount, insertTable, deleteTable, insertTableColumn, deleteColumn, insertTableRow, deleteRow } from "@udecode/plate-table";
27
+ import { Slot } from "@radix-ui/react-slot";
28
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
29
+ import * as SeparatorPrimitive from "@radix-ui/react-separator";
30
+ import { ResizeHandle as ResizeHandle$1 } from "@udecode/plate-resizable";
24
31
  import arrayMutators from "final-form-arrays";
25
32
  import setFieldData from "final-form-set-field-data";
26
33
  import { FORM_ERROR, createForm, getIn } from "final-form";
27
34
  import { Field, Form as Form$1 } from "react-final-form";
28
35
  import PropTypes from "prop-types";
29
36
  import { Droppable, Draggable, DragDropContext } from "react-beautiful-dnd";
30
- import * as PopoverPrimitive from "@radix-ui/react-popover";
31
37
  import * as pkg$1 from "react-color";
32
38
  import * as pkg from "color-string";
33
39
  import * as dropzone from "react-dropzone";
34
- import { Slot } from "@radix-ui/react-slot";
35
40
  import { clsx } from "clsx";
36
41
  import { twMerge } from "tailwind-merge";
37
42
  import { Command as Command$1 } from "cmdk";
@@ -42,10 +47,8 @@ import moment from "moment";
42
47
  import { formatDistanceToNow } from "date-fns";
43
48
  import { useLinkToolbarButtonState, useLinkToolbarButton, useFloatingLinkInsertState, useFloatingLinkInsert, useFloatingLinkEditState, useFloatingLinkEdit, FloatingLinkUrlInput, LinkOpenButton, createLinkPlugin } from "@udecode/plate-link";
44
49
  import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
45
- import * as SeparatorPrimitive from "@radix-ui/react-separator";
46
50
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
47
51
  import { ELEMENT_PARAGRAPH as ELEMENT_PARAGRAPH$1 } from "@udecode/plate-paragraph";
48
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
49
52
  import { ELEMENT_BLOCKQUOTE as ELEMENT_BLOCKQUOTE$1 } from "@udecode/plate-block-quote";
50
53
  import { useFloatingToolbarState, offset, flip, useFloatingToolbar } from "@udecode/plate-floating";
51
54
  import { useWindowWidth } from "@react-hook/window-size";
@@ -1016,7 +1019,7 @@ const borderTop = (props) => /* @__PURE__ */ React__default.createElement(
1016
1019
  },
1017
1020
  /* @__PURE__ */ React__default.createElement("path", { d: "M3 6a1 1 0 0 0 2 0 1 1 0 0 1 1-1h12a1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3zm2 5a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-8 1a1 1 0 1 0 0-2 1 1 0 0 1-1-1 1 1 0 1 0-2 0 3 3 0 0 0 3 3zm11-1a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" })
1018
1021
  );
1019
- cva("", {
1022
+ const iconVariants = cva("", {
1020
1023
  variants: {
1021
1024
  variant: {
1022
1025
  toolbar: "size-5",
@@ -2159,25 +2162,501 @@ const CodeBlock = ({
2159
2162
  onChange: (value2) => {
2160
2163
  setNodes(editor, { value: value2, lang: language });
2161
2164
  }
2162
- }
2163
- )))
2165
+ }
2166
+ )))
2167
+ );
2168
+ };
2169
+ const CodeBlockElement = withRef(
2170
+ ({ className, ...props }, ref) => {
2171
+ const { element } = props;
2172
+ const state = useCodeBlockElementState({ element });
2173
+ return /* @__PURE__ */ React__default.createElement(
2174
+ PlateElement,
2175
+ {
2176
+ className: cn$1("relative py-1", state.className, className),
2177
+ ref,
2178
+ ...props
2179
+ },
2180
+ /* @__PURE__ */ React__default.createElement(CodeBlock, { ...props })
2181
+ );
2182
+ }
2183
+ );
2184
+ const buttonVariants$1 = cva(
2185
+ "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",
2186
+ {
2187
+ defaultVariants: {
2188
+ size: "default",
2189
+ variant: "default"
2190
+ },
2191
+ variants: {
2192
+ isMenu: {
2193
+ true: "h-auto w-full cursor-pointer justify-start"
2194
+ },
2195
+ size: {
2196
+ default: "h-10 px-4 py-2",
2197
+ icon: "size-10",
2198
+ lg: "h-11 rounded-md px-8",
2199
+ none: "",
2200
+ sm: "h-9 rounded-md px-3",
2201
+ sms: "size-9 rounded-md px-0",
2202
+ xs: "h-8 rounded-md px-3"
2203
+ },
2204
+ variant: {
2205
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
2206
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
2207
+ ghost: "hover:bg-accent hover:text-accent-foreground",
2208
+ inlineLink: "text-base text-primary underline underline-offset-4",
2209
+ link: "text-primary underline-offset-4 hover:underline",
2210
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
2211
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
2212
+ }
2213
+ }
2214
+ }
2215
+ );
2216
+ const Button$2 = withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
2217
+ const Comp = asChild ? Slot : "button";
2218
+ return /* @__PURE__ */ React.createElement(
2219
+ Comp,
2220
+ {
2221
+ className: cn$1(buttonVariants$1({ className, isMenu, size, variant })),
2222
+ ref,
2223
+ ...props
2224
+ }
2225
+ );
2226
+ });
2227
+ const DropdownMenu = DropdownMenuPrimitive.Root;
2228
+ const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
2229
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
2230
+ const DropdownMenuSub = DropdownMenuPrimitive.Sub;
2231
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
2232
+ const DropdownMenuSubTrigger = withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
2233
+ DropdownMenuPrimitive.SubTrigger,
2234
+ {
2235
+ className: cn$1(
2236
+ "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",
2237
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2238
+ inset && "pl-8",
2239
+ className
2240
+ ),
2241
+ ref,
2242
+ ...props
2243
+ },
2244
+ children,
2245
+ /* @__PURE__ */ React__default.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
2246
+ ));
2247
+ const DropdownMenuSubContent = withCn(
2248
+ DropdownMenuPrimitive.SubContent,
2249
+ "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"
2250
+ );
2251
+ const DropdownMenuContentVariants = withProps(DropdownMenuPrimitive.Content, {
2252
+ className: cn$1(
2253
+ "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"
2254
+ ),
2255
+ sideOffset: 4
2256
+ });
2257
+ const DropdownMenuContent = withRef(({ ...props }, ref) => /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.Portal, null, /* @__PURE__ */ React__default.createElement(DropdownMenuContentVariants, { ref, ...props })));
2258
+ const menuItemVariants = cva(
2259
+ cn$1(
2260
+ "relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
2261
+ "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
2262
+ ),
2263
+ {
2264
+ variants: {
2265
+ inset: {
2266
+ true: "pl-8"
2267
+ }
2268
+ }
2269
+ }
2270
+ );
2271
+ const DropdownMenuItem = withVariants(
2272
+ DropdownMenuPrimitive.Item,
2273
+ menuItemVariants,
2274
+ ["inset"]
2275
+ );
2276
+ const DropdownMenuCheckboxItem = withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
2277
+ DropdownMenuPrimitive.CheckboxItem,
2278
+ {
2279
+ className: cn$1(
2280
+ "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",
2281
+ "cursor-pointer",
2282
+ className
2283
+ ),
2284
+ ref,
2285
+ ...props
2286
+ },
2287
+ /* @__PURE__ */ React__default.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
2288
+ children
2289
+ ));
2290
+ const DropdownMenuRadioItem = withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
2291
+ DropdownMenuPrimitive.RadioItem,
2292
+ {
2293
+ className: cn$1(
2294
+ "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",
2295
+ "h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
2296
+ className
2297
+ ),
2298
+ ref,
2299
+ ...props
2300
+ },
2301
+ !hideIcon && /* @__PURE__ */ React__default.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
2302
+ children
2303
+ ));
2304
+ const dropdownMenuLabelVariants = cva(
2305
+ cn$1("select-none px-2 py-1.5 text-sm font-semibold"),
2306
+ {
2307
+ variants: {
2308
+ inset: {
2309
+ true: "pl-8"
2310
+ }
2311
+ }
2312
+ }
2313
+ );
2314
+ const DropdownMenuLabel = withVariants(
2315
+ DropdownMenuPrimitive.Label,
2316
+ dropdownMenuLabelVariants,
2317
+ ["inset"]
2318
+ );
2319
+ const DropdownMenuSeparator = withCn(
2320
+ DropdownMenuPrimitive.Separator,
2321
+ "-mx-1 my-1 h-px bg-muted"
2322
+ );
2323
+ withCn(
2324
+ createPrimitiveElement("span"),
2325
+ "ml-auto text-xs tracking-widest opacity-60"
2326
+ );
2327
+ const useOpenState = () => {
2328
+ const [open2, setOpen] = useState(false);
2329
+ const onOpenChange = useCallback(
2330
+ (_value = !open2) => {
2331
+ setOpen(_value);
2332
+ },
2333
+ [open2]
2334
+ );
2335
+ return {
2336
+ onOpenChange,
2337
+ open: open2
2338
+ };
2339
+ };
2340
+ const Popover$2 = PopoverPrimitive.Root;
2341
+ const popoverVariants = cva(
2342
+ "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"
2343
+ );
2344
+ const PopoverContent$1 = withRef(
2345
+ ({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
2346
+ PopoverPrimitive.Content,
2347
+ {
2348
+ align,
2349
+ className: cn$1(popoverVariants(), className),
2350
+ ref,
2351
+ sideOffset,
2352
+ style: { zIndex: 1e3, ...style },
2353
+ ...props
2354
+ }
2355
+ ))
2356
+ );
2357
+ const separatorVariants = cva("shrink-0 bg-border", {
2358
+ defaultVariants: {
2359
+ orientation: "horizontal"
2360
+ },
2361
+ variants: {
2362
+ orientation: {
2363
+ horizontal: "h-px w-full",
2364
+ vertical: "h-full w-px"
2365
+ }
2366
+ }
2367
+ });
2368
+ const Separator = withVariants(
2369
+ withProps(SeparatorPrimitive.Root, {
2370
+ decorative: true,
2371
+ orientation: "horizontal"
2372
+ }),
2373
+ separatorVariants
2374
+ );
2375
+ const TableBordersDropdownMenuContent = withRef((props, ref) => {
2376
+ const {
2377
+ getOnSelectTableBorder,
2378
+ hasBottomBorder,
2379
+ hasLeftBorder,
2380
+ hasNoBorders,
2381
+ hasOuterBorders,
2382
+ hasRightBorder,
2383
+ hasTopBorder
2384
+ } = useTableBordersDropdownMenuContentState();
2385
+ return /* @__PURE__ */ React__default.createElement(
2386
+ DropdownMenuContent,
2387
+ {
2388
+ align: "start",
2389
+ className: cn$1("min-w-[220px]"),
2390
+ ref,
2391
+ side: "right",
2392
+ sideOffset: 0,
2393
+ ...props
2394
+ },
2395
+ /* @__PURE__ */ React__default.createElement(
2396
+ DropdownMenuCheckboxItem,
2397
+ {
2398
+ checked: hasBottomBorder,
2399
+ onCheckedChange: getOnSelectTableBorder("bottom")
2400
+ },
2401
+ /* @__PURE__ */ React__default.createElement(Icons.borderBottom, { className: iconVariants({ size: "sm" }) }),
2402
+ /* @__PURE__ */ React__default.createElement("div", null, "Bottom Border")
2403
+ ),
2404
+ /* @__PURE__ */ React__default.createElement(
2405
+ DropdownMenuCheckboxItem,
2406
+ {
2407
+ checked: hasTopBorder,
2408
+ onCheckedChange: getOnSelectTableBorder("top")
2409
+ },
2410
+ /* @__PURE__ */ React__default.createElement(Icons.borderTop, { className: iconVariants({ size: "sm" }) }),
2411
+ /* @__PURE__ */ React__default.createElement("div", null, "Top Border")
2412
+ ),
2413
+ /* @__PURE__ */ React__default.createElement(
2414
+ DropdownMenuCheckboxItem,
2415
+ {
2416
+ checked: hasLeftBorder,
2417
+ onCheckedChange: getOnSelectTableBorder("left")
2418
+ },
2419
+ /* @__PURE__ */ React__default.createElement(Icons.borderLeft, { className: iconVariants({ size: "sm" }) }),
2420
+ /* @__PURE__ */ React__default.createElement("div", null, "Left Border")
2421
+ ),
2422
+ /* @__PURE__ */ React__default.createElement(
2423
+ DropdownMenuCheckboxItem,
2424
+ {
2425
+ checked: hasRightBorder,
2426
+ onCheckedChange: getOnSelectTableBorder("right")
2427
+ },
2428
+ /* @__PURE__ */ React__default.createElement(Icons.borderRight, { className: iconVariants({ size: "sm" }) }),
2429
+ /* @__PURE__ */ React__default.createElement("div", null, "Right Border")
2430
+ ),
2431
+ /* @__PURE__ */ React__default.createElement(Separator, null),
2432
+ /* @__PURE__ */ React__default.createElement(
2433
+ DropdownMenuCheckboxItem,
2434
+ {
2435
+ checked: hasNoBorders,
2436
+ onCheckedChange: getOnSelectTableBorder("none")
2437
+ },
2438
+ /* @__PURE__ */ React__default.createElement(Icons.borderNone, { className: iconVariants({ size: "sm" }) }),
2439
+ /* @__PURE__ */ React__default.createElement("div", null, "No Border")
2440
+ ),
2441
+ /* @__PURE__ */ React__default.createElement(
2442
+ DropdownMenuCheckboxItem,
2443
+ {
2444
+ checked: hasOuterBorders,
2445
+ onCheckedChange: getOnSelectTableBorder("outer")
2446
+ },
2447
+ /* @__PURE__ */ React__default.createElement(Icons.borderAll, { className: iconVariants({ size: "sm" }) }),
2448
+ /* @__PURE__ */ React__default.createElement("div", null, "Outside Borders")
2449
+ )
2450
+ );
2451
+ });
2452
+ const TableFloatingToolbar = withRef(
2453
+ ({ children, ...props }, ref) => {
2454
+ const element = useElement();
2455
+ const { props: buttonProps } = useRemoveNodeButton({ element });
2456
+ const selectionCollapsed = useEditorSelector(
2457
+ (editor2) => !isSelectionExpanded(editor2),
2458
+ []
2459
+ );
2460
+ const readOnly = useReadOnly();
2461
+ const selected = useSelected();
2462
+ const editor = useEditorRef();
2463
+ const collapsed = !readOnly && selected && selectionCollapsed;
2464
+ const open2 = !readOnly && selected;
2465
+ const { canMerge, canUnmerge } = useTableMergeState();
2466
+ const mergeContent = canMerge && /* @__PURE__ */ React__default.createElement(
2467
+ Button$2,
2468
+ {
2469
+ contentEditable: false,
2470
+ isMenu: true,
2471
+ onClick: () => mergeTableCells(editor),
2472
+ variant: "ghost"
2473
+ },
2474
+ /* @__PURE__ */ React__default.createElement(Icons.combine, { className: "mr-2 size-4" }),
2475
+ "Merge"
2476
+ );
2477
+ const unmergeButton = canUnmerge && /* @__PURE__ */ React__default.createElement(
2478
+ Button$2,
2479
+ {
2480
+ contentEditable: false,
2481
+ isMenu: true,
2482
+ onClick: () => unmergeTableCells(editor),
2483
+ variant: "ghost"
2484
+ },
2485
+ /* @__PURE__ */ React__default.createElement(Icons.ungroup, { className: "mr-2 size-4" }),
2486
+ "Unmerge"
2487
+ );
2488
+ const bordersContent = collapsed && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(Button$2, { isMenu: true, variant: "ghost" }, /* @__PURE__ */ React__default.createElement(Icons.borderAll, { className: "mr-2 size-4" }), "Borders")), /* @__PURE__ */ React__default.createElement(DropdownMenuPortal, null, /* @__PURE__ */ React__default.createElement(TableBordersDropdownMenuContent, null))), /* @__PURE__ */ React__default.createElement(Button$2, { contentEditable: false, isMenu: true, variant: "ghost", ...buttonProps }, /* @__PURE__ */ React__default.createElement(Icons.delete, { className: "mr-2 size-4" }), "Delete"));
2489
+ return /* @__PURE__ */ React__default.createElement(Popover$2, { modal: false, open: open2 }, /* @__PURE__ */ React__default.createElement(PopoverAnchor, { asChild: true }, children), (canMerge || canUnmerge || collapsed) && /* @__PURE__ */ React__default.createElement(
2490
+ PopoverContent$1,
2491
+ {
2492
+ className: cn$1(
2493
+ popoverVariants(),
2494
+ "flex w-[220px] flex-col gap-1 p-1"
2495
+ ),
2496
+ onOpenAutoFocus: (e) => e.preventDefault(),
2497
+ ref,
2498
+ ...props
2499
+ },
2500
+ unmergeButton,
2501
+ mergeContent,
2502
+ bordersContent
2503
+ ));
2504
+ }
2505
+ );
2506
+ const TableElement = withHOC(
2507
+ TableProvider,
2508
+ withRef(({ children, className, ...props }, ref) => {
2509
+ const { colSizes, isSelectingCell, marginLeft, minColumnWidth } = useTableElementState();
2510
+ const { colGroupProps, props: tableProps } = useTableElement();
2511
+ return /* @__PURE__ */ React__default.createElement(TableFloatingToolbar, null, /* @__PURE__ */ React__default.createElement("div", { style: { paddingLeft: marginLeft } }, /* @__PURE__ */ React__default.createElement(
2512
+ PlateElement,
2513
+ {
2514
+ asChild: true,
2515
+ className: cn$1(
2516
+ "my-4 ml-px mr-0 table h-px w-full table-fixed border-collapse",
2517
+ isSelectingCell && "[&_*::selection]:bg-none",
2518
+ className
2519
+ ),
2520
+ ref,
2521
+ ...tableProps,
2522
+ ...props
2523
+ },
2524
+ /* @__PURE__ */ React__default.createElement("table", null, /* @__PURE__ */ React__default.createElement("colgroup", { ...colGroupProps }, colSizes.map((width, index) => /* @__PURE__ */ React__default.createElement(
2525
+ "col",
2526
+ {
2527
+ key: index,
2528
+ style: {
2529
+ minWidth: minColumnWidth,
2530
+ width: width || void 0
2531
+ }
2532
+ }
2533
+ ))), /* @__PURE__ */ React__default.createElement("tbody", { className: "min-w-full" }, children))
2534
+ )));
2535
+ })
2536
+ );
2537
+ const TableRowElement = withRef(({ children, hideBorder, ...props }, ref) => {
2538
+ return /* @__PURE__ */ React__default.createElement(
2539
+ PlateElement,
2540
+ {
2541
+ asChild: true,
2542
+ className: cn$1("h-full", hideBorder && "border-none"),
2543
+ ref,
2544
+ ...props
2545
+ },
2546
+ /* @__PURE__ */ React__default.createElement("tr", null, children)
2547
+ );
2548
+ });
2549
+ const TableCellElement = withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
2550
+ var _a, _b, _c, _d;
2551
+ const { element } = props;
2552
+ const {
2553
+ borders,
2554
+ colIndex,
2555
+ colSpan,
2556
+ hovered,
2557
+ hoveredLeft,
2558
+ isSelectingCell,
2559
+ readOnly,
2560
+ rowIndex,
2561
+ rowSize,
2562
+ selected
2563
+ } = useTableCellElementState();
2564
+ const { props: cellProps } = useTableCellElement({ element: props.element });
2565
+ const resizableState = useTableCellElementResizableState({
2566
+ colIndex,
2567
+ colSpan,
2568
+ rowIndex
2569
+ });
2570
+ const { bottomProps, hiddenLeft, leftProps, rightProps } = useTableCellElementResizable(resizableState);
2571
+ const Cell = isHeader ? "th" : "td";
2572
+ return /* @__PURE__ */ React__default.createElement(
2573
+ PlateElement,
2574
+ {
2575
+ asChild: true,
2576
+ className: cn$1(
2577
+ "relative h-full overflow-visible border-none bg-background p-0",
2578
+ hideBorder && "before:border-none",
2579
+ element.background ? "bg-[--cellBackground]" : "bg-background",
2580
+ !hideBorder && cn$1(
2581
+ isHeader && "text-left [&_>_*]:m-0",
2582
+ "before:size-full",
2583
+ selected && "before:z-10 before:bg-muted",
2584
+ "before:absolute before:box-border before:select-none before:content-['']",
2585
+ borders && cn$1(
2586
+ ((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
2587
+ ((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
2588
+ ((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
2589
+ ((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
2590
+ )
2591
+ ),
2592
+ className
2593
+ ),
2594
+ ref,
2595
+ ...cellProps,
2596
+ ...props,
2597
+ style: {
2598
+ "--cellBackground": element.background,
2599
+ ...style
2600
+ }
2601
+ },
2602
+ /* @__PURE__ */ React__default.createElement(Cell, null, /* @__PURE__ */ React__default.createElement(
2603
+ "div",
2604
+ {
2605
+ className: "relative z-20 box-border h-full px-3 py-2",
2606
+ style: {
2607
+ minHeight: rowSize
2608
+ }
2609
+ },
2610
+ children
2611
+ ), !isSelectingCell && /* @__PURE__ */ React__default.createElement(
2612
+ "div",
2613
+ {
2614
+ className: "group absolute top-0 size-full select-none",
2615
+ contentEditable: false,
2616
+ suppressContentEditableWarning: true
2617
+ },
2618
+ !readOnly && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
2619
+ ResizeHandle$1,
2620
+ {
2621
+ ...rightProps,
2622
+ className: "-top-3 right-[-5px] w-[10px]"
2623
+ }
2624
+ ), /* @__PURE__ */ React__default.createElement(
2625
+ ResizeHandle$1,
2626
+ {
2627
+ ...bottomProps,
2628
+ className: "bottom-[-5px] h-[10px]"
2629
+ }
2630
+ ), !hiddenLeft && /* @__PURE__ */ React__default.createElement(
2631
+ ResizeHandle$1,
2632
+ {
2633
+ ...leftProps,
2634
+ className: "-top-3 left-[-5px] w-[10px]"
2635
+ }
2636
+ ), hovered && /* @__PURE__ */ React__default.createElement(
2637
+ "div",
2638
+ {
2639
+ className: cn$1(
2640
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2641
+ "right-[-1.5px]"
2642
+ )
2643
+ }
2644
+ ), hoveredLeft && /* @__PURE__ */ React__default.createElement(
2645
+ "div",
2646
+ {
2647
+ className: cn$1(
2648
+ "absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
2649
+ "left-[-1.5px]"
2650
+ )
2651
+ }
2652
+ ))
2653
+ ))
2164
2654
  );
2165
- };
2166
- const CodeBlockElement = withRef(
2167
- ({ className, ...props }, ref) => {
2168
- const { element } = props;
2169
- const state = useCodeBlockElementState({ element });
2170
- return /* @__PURE__ */ React__default.createElement(
2171
- PlateElement,
2172
- {
2173
- className: cn$1("relative py-1", state.className, className),
2174
- ref,
2175
- ...props
2176
- },
2177
- /* @__PURE__ */ React__default.createElement(CodeBlock, { ...props })
2178
- );
2179
- }
2180
- );
2655
+ });
2656
+ TableCellElement.displayName = "TableCellElement";
2657
+ const TableCellHeaderElement = withProps(TableCellElement, {
2658
+ isHeader: true
2659
+ });
2181
2660
  const blockClasses = "mt-0.5";
2182
2661
  const headerClasses = "font-normal";
2183
2662
  const Components = () => {
@@ -2363,7 +2842,11 @@ const Components = () => {
2363
2842
  children,
2364
2843
  selected && /* @__PURE__ */ React__default.createElement("span", { className: "absolute h-4 -top-2 inset-0 ring-2 ring-blue-100 ring-inset rounded-md z-10 pointer-events-none" })
2365
2844
  );
2366
- }
2845
+ },
2846
+ [ELEMENT_TABLE]: TableElement,
2847
+ [ELEMENT_TR]: TableRowElement,
2848
+ [ELEMENT_TD]: TableCellElement,
2849
+ [ELEMENT_TH]: TableCellHeaderElement
2367
2850
  };
2368
2851
  };
2369
2852
  const createCodeBlockPlugin = createPluginFactory({
@@ -4433,7 +4916,7 @@ const ImageLoadingIndicator = () => /* @__PURE__ */ React.createElement("div", {
4433
4916
  function cn(...inputs) {
4434
4917
  return twMerge(clsx(inputs));
4435
4918
  }
4436
- const buttonVariants$1 = cva(
4919
+ const buttonVariants = cva(
4437
4920
  "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",
4438
4921
  {
4439
4922
  variants: {
@@ -4459,7 +4942,7 @@ const Button = React.forwardRef(
4459
4942
  return /* @__PURE__ */ React.createElement(
4460
4943
  Comp,
4461
4944
  {
4462
- className: cn(buttonVariants$1({ variant, size, className })),
4945
+ className: cn(buttonVariants({ variant, size, className })),
4463
4946
  ref,
4464
4947
  ...props
4465
4948
  }
@@ -5158,7 +5641,7 @@ const BlockSelector = ({
5158
5641
  return template.label ? template.label.toLowerCase().includes(filter.toLowerCase()) || name.toLowerCase().includes(filter.toLowerCase()) : name.toLowerCase().includes(filter.toLowerCase());
5159
5642
  });
5160
5643
  }, [filter]);
5161
- return /* @__PURE__ */ React.createElement(Popover$2, null, ({ open: open2 }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PopoverButton, { as: "span" }, /* @__PURE__ */ React.createElement(
5644
+ return /* @__PURE__ */ React.createElement(Popover$3, null, ({ open: open2 }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PopoverButton, { as: "span" }, /* @__PURE__ */ React.createElement(
5162
5645
  IconButton,
5163
5646
  {
5164
5647
  variant: open2 ? "secondary" : "primary",
@@ -9723,7 +10206,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
9723
10206
  "Event Log"
9724
10207
  ));
9725
10208
  };
9726
- const version = "2.2.8";
10209
+ const version = "2.2.9";
9727
10210
  const Nav = ({
9728
10211
  isLocalMode,
9729
10212
  className = "",
@@ -12790,7 +13273,7 @@ const EmbedNestedForm = ({
12790
13273
  );
12791
13274
  };
12792
13275
  const DotMenu = ({ onOpen, onRemove }) => {
12793
- return /* @__PURE__ */ React__default.createElement(Popover$2, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React__default.createElement(
13276
+ return /* @__PURE__ */ React__default.createElement(Popover$3, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React__default.createElement(
12794
13277
  PopoverButton,
12795
13278
  {
12796
13279
  as: "span",
@@ -13230,13 +13713,25 @@ const plugins = [
13230
13713
  createUnderlinePlugin(),
13231
13714
  createCodePlugin(),
13232
13715
  createListPlugin(),
13233
- createIndentPlugin(),
13234
13716
  createIndentListPlugin(),
13235
13717
  createHorizontalRulePlugin(),
13236
13718
  // Allows us to do things like copy/paste, remembering the state of the element (like mdx)
13237
13719
  createNodeIdPlugin(),
13238
- createSlashPlugin()
13720
+ createSlashPlugin(),
13721
+ createTablePlugin()
13239
13722
  ];
13723
+ const unsupportedItemsInTable = /* @__PURE__ */ new Set([
13724
+ "Code Block",
13725
+ "Unordered List",
13726
+ "Ordered List",
13727
+ "Quote",
13728
+ "Heading 1",
13729
+ "Heading 2",
13730
+ "Heading 3",
13731
+ "Heading 4",
13732
+ "Heading 5",
13733
+ "Heading 6"
13734
+ ]);
13240
13735
  const isNodeActive = (editor, type) => {
13241
13736
  const pluginType = getPluginType(editor, type);
13242
13737
  return !!(editor == null ? void 0 : editor.selection) && someNode(editor, { match: { type: pluginType } });
@@ -13421,24 +13916,6 @@ const Editor = React__default.forwardRef(
13421
13916
  }
13422
13917
  );
13423
13918
  Editor.displayName = "Editor";
13424
- const separatorVariants = cva("shrink-0 bg-border", {
13425
- defaultVariants: {
13426
- orientation: "horizontal"
13427
- },
13428
- variants: {
13429
- orientation: {
13430
- horizontal: "h-px w-full",
13431
- vertical: "h-full w-px"
13432
- }
13433
- }
13434
- });
13435
- const Separator = withVariants(
13436
- withProps(SeparatorPrimitive.Root, {
13437
- decorative: true,
13438
- orientation: "horizontal"
13439
- }),
13440
- separatorVariants
13441
- );
13442
13919
  const TooltipProvider = TooltipPrimitive.Provider;
13443
13920
  const Tooltip = TooltipPrimitive.Root;
13444
13921
  const TooltipTrigger = TooltipPrimitive.Trigger;
@@ -13597,117 +14074,6 @@ const IndentListToolbarButton = withRef(({ nodeType = ELEMENT_UL }, ref) => {
13597
14074
  nodeType === ELEMENT_UL ? /* @__PURE__ */ React__default.createElement(Icons.ul, null) : /* @__PURE__ */ React__default.createElement(Icons.ol, null)
13598
14075
  );
13599
14076
  });
13600
- const DropdownMenu = DropdownMenuPrimitive.Root;
13601
- const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
13602
- const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
13603
- withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
13604
- DropdownMenuPrimitive.SubTrigger,
13605
- {
13606
- className: cn$1(
13607
- "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",
13608
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13609
- inset && "pl-8",
13610
- className
13611
- ),
13612
- ref,
13613
- ...props
13614
- },
13615
- children,
13616
- /* @__PURE__ */ React__default.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
13617
- ));
13618
- withCn(
13619
- DropdownMenuPrimitive.SubContent,
13620
- "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"
13621
- );
13622
- const DropdownMenuContentVariants = withProps(DropdownMenuPrimitive.Content, {
13623
- className: cn$1(
13624
- "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"
13625
- ),
13626
- sideOffset: 4
13627
- });
13628
- const DropdownMenuContent = withRef(({ ...props }, ref) => /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.Portal, null, /* @__PURE__ */ React__default.createElement(DropdownMenuContentVariants, { ref, ...props })));
13629
- const menuItemVariants = cva(
13630
- cn$1(
13631
- "relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
13632
- "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
13633
- ),
13634
- {
13635
- variants: {
13636
- inset: {
13637
- true: "pl-8"
13638
- }
13639
- }
13640
- }
13641
- );
13642
- const DropdownMenuItem = withVariants(
13643
- DropdownMenuPrimitive.Item,
13644
- menuItemVariants,
13645
- ["inset"]
13646
- );
13647
- withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
13648
- DropdownMenuPrimitive.CheckboxItem,
13649
- {
13650
- className: cn$1(
13651
- "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",
13652
- "cursor-pointer",
13653
- className
13654
- ),
13655
- ref,
13656
- ...props
13657
- },
13658
- /* @__PURE__ */ React__default.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
13659
- children
13660
- ));
13661
- const DropdownMenuRadioItem = withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
13662
- DropdownMenuPrimitive.RadioItem,
13663
- {
13664
- className: cn$1(
13665
- "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",
13666
- "h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
13667
- className
13668
- ),
13669
- ref,
13670
- ...props
13671
- },
13672
- !hideIcon && /* @__PURE__ */ React__default.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
13673
- children
13674
- ));
13675
- const dropdownMenuLabelVariants = cva(
13676
- cn$1("select-none px-2 py-1.5 text-sm font-semibold"),
13677
- {
13678
- variants: {
13679
- inset: {
13680
- true: "pl-8"
13681
- }
13682
- }
13683
- }
13684
- );
13685
- const DropdownMenuLabel = withVariants(
13686
- DropdownMenuPrimitive.Label,
13687
- dropdownMenuLabelVariants,
13688
- ["inset"]
13689
- );
13690
- const DropdownMenuSeparator = withCn(
13691
- DropdownMenuPrimitive.Separator,
13692
- "-mx-1 my-1 h-px bg-muted"
13693
- );
13694
- withCn(
13695
- createPrimitiveElement("span"),
13696
- "ml-auto text-xs tracking-widest opacity-60"
13697
- );
13698
- const useOpenState = () => {
13699
- const [open2, setOpen] = useState(false);
13700
- const onOpenChange = useCallback(
13701
- (_value = !open2) => {
13702
- setOpen(_value);
13703
- },
13704
- [open2]
13705
- );
13706
- return {
13707
- onOpenChange,
13708
- open: open2
13709
- };
13710
- };
13711
14077
  const items$1 = [
13712
14078
  {
13713
14079
  description: "Paragraph",
@@ -13772,7 +14138,9 @@ function HeadingsMenu(props) {
13772
14138
  return allNodesMatchInitialNodeType ? initialNodeType : ELEMENT_PARAGRAPH$1;
13773
14139
  }, []);
13774
14140
  const editor = useEditorRef();
14141
+ const editorState = useEditorState();
13775
14142
  const openState = useOpenState();
14143
+ const userInTable = helpers.isNodeActive(editorState, ELEMENT_TABLE$1);
13776
14144
  const selectedItem = items$1.find((item) => item.value === value) ?? defaultItem$1;
13777
14145
  const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
13778
14146
  return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(
@@ -13796,7 +14164,12 @@ function HeadingsMenu(props) {
13796
14164
  },
13797
14165
  value
13798
14166
  },
13799
- items$1.map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React__default.createElement(
14167
+ items$1.filter((item) => {
14168
+ if (userInTable) {
14169
+ return !unsupportedItemsInTable.has(item.label);
14170
+ }
14171
+ return true;
14172
+ }).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React__default.createElement(
13800
14173
  DropdownMenuRadioItem,
13801
14174
  {
13802
14175
  className: "min-w-[180px]",
@@ -14016,6 +14389,108 @@ function OverflowMenu({
14016
14389
  /* @__PURE__ */ React__default.createElement(Icons.overflow, { className: "size-5" })
14017
14390
  )), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
14018
14391
  }
14392
+ function TableDropdownMenu(props) {
14393
+ const tableSelected = useEditorSelector(
14394
+ (editor2) => someNode(editor2, { match: { type: ELEMENT_TABLE$1 } }),
14395
+ []
14396
+ );
14397
+ const [enableDeleteColumn, enableDeleteRow] = useEditorSelector((editor2) => {
14398
+ const tableNodeEntry = findNode(editor2, { match: { type: ELEMENT_TABLE$1 } });
14399
+ if (!tableNodeEntry)
14400
+ return [false, false];
14401
+ const [tableNode] = tableNodeEntry;
14402
+ if (!isElement(tableNode))
14403
+ return [false, false];
14404
+ const columnCount = getTableColumnCount(tableNode);
14405
+ const rowCount = tableNode.children.length;
14406
+ return [columnCount > 1, rowCount > 1];
14407
+ }, []);
14408
+ const editor = useEditorRef();
14409
+ const openState = useOpenState();
14410
+ return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(ToolbarButton, { isDropdown: true, pressed: openState.open, tooltip: "Table" }, /* @__PURE__ */ React__default.createElement(Icons.table, null))), /* @__PURE__ */ React__default.createElement(
14411
+ DropdownMenuContent,
14412
+ {
14413
+ align: "start",
14414
+ className: "flex w-[180px] min-w-0 flex-col gap-0.5"
14415
+ },
14416
+ /* @__PURE__ */ React__default.createElement(
14417
+ DropdownMenuItem,
14418
+ {
14419
+ className: "min-w-[180px]",
14420
+ disabled: tableSelected,
14421
+ onSelect: () => {
14422
+ insertTable(editor);
14423
+ focusEditor(editor);
14424
+ }
14425
+ },
14426
+ /* @__PURE__ */ React__default.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14427
+ "Insert table"
14428
+ ),
14429
+ /* @__PURE__ */ React__default.createElement(
14430
+ DropdownMenuItem,
14431
+ {
14432
+ className: "min-w-[180px]",
14433
+ disabled: !tableSelected,
14434
+ onSelect: () => {
14435
+ deleteTable(editor);
14436
+ focusEditor(editor);
14437
+ }
14438
+ },
14439
+ /* @__PURE__ */ React__default.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14440
+ "Delete table"
14441
+ ),
14442
+ /* @__PURE__ */ React__default.createElement(DropdownMenuSub, null, /* @__PURE__ */ React__default.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React__default.createElement(Icons.column, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React__default.createElement("span", null, "Column")), /* @__PURE__ */ React__default.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React__default.createElement(
14443
+ DropdownMenuItem,
14444
+ {
14445
+ className: "min-w-[180px]",
14446
+ disabled: !tableSelected,
14447
+ onSelect: () => {
14448
+ insertTableColumn(editor);
14449
+ focusEditor(editor);
14450
+ }
14451
+ },
14452
+ /* @__PURE__ */ React__default.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14453
+ "Insert column after"
14454
+ ), /* @__PURE__ */ React__default.createElement(
14455
+ DropdownMenuItem,
14456
+ {
14457
+ className: "min-w-[180px]",
14458
+ disabled: !enableDeleteColumn,
14459
+ onSelect: () => {
14460
+ deleteColumn(editor);
14461
+ focusEditor(editor);
14462
+ }
14463
+ },
14464
+ /* @__PURE__ */ React__default.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14465
+ "Delete column"
14466
+ ))),
14467
+ /* @__PURE__ */ React__default.createElement(DropdownMenuSub, null, /* @__PURE__ */ React__default.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React__default.createElement(Icons.row, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React__default.createElement("span", null, "Row")), /* @__PURE__ */ React__default.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React__default.createElement(
14468
+ DropdownMenuItem,
14469
+ {
14470
+ className: "min-w-[180px]",
14471
+ disabled: !tableSelected,
14472
+ onSelect: () => {
14473
+ insertTableRow(editor);
14474
+ focusEditor(editor);
14475
+ }
14476
+ },
14477
+ /* @__PURE__ */ React__default.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
14478
+ "Insert row after"
14479
+ ), /* @__PURE__ */ React__default.createElement(
14480
+ DropdownMenuItem,
14481
+ {
14482
+ className: "min-w-[180px]",
14483
+ disabled: !enableDeleteRow,
14484
+ onSelect: () => {
14485
+ deleteRow(editor);
14486
+ focusEditor(editor);
14487
+ }
14488
+ },
14489
+ /* @__PURE__ */ React__default.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
14490
+ "Delete row"
14491
+ )))
14492
+ ));
14493
+ }
14019
14494
  const toolbarItems = {
14020
14495
  heading: {
14021
14496
  label: "Headings",
@@ -14057,6 +14532,10 @@ const toolbarItems = {
14057
14532
  label: "Code Block",
14058
14533
  Component: /* @__PURE__ */ React__default.createElement(CodeBlockToolbarButton, null)
14059
14534
  },
14535
+ table: {
14536
+ label: "Table",
14537
+ Component: /* @__PURE__ */ React__default.createElement(TableDropdownMenu, null)
14538
+ },
14060
14539
  raw: {
14061
14540
  label: "Raw Markdown",
14062
14541
  Component: /* @__PURE__ */ React__default.createElement(RawMarkdownToolbarButton, null)
@@ -14075,7 +14554,14 @@ function FixedToolbarButtons() {
14075
14554
  const itemsShown2 = (width - EMBED_ICON_WIDTH) / ICON_WIDTH;
14076
14555
  setItemsShown(Math.floor(itemsShown2));
14077
14556
  });
14078
- const toolbarItemsArray = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14557
+ let toolbarItemsArray = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14558
+ const editorState = useEditorState();
14559
+ const userInTable = helpers.isNodeActive(editorState, ELEMENT_TABLE$1);
14560
+ if (userInTable) {
14561
+ toolbarItemsArray = toolbarItemsArray.filter(
14562
+ (item) => !unsupportedItemsInTable.has(item.label)
14563
+ );
14564
+ }
14079
14565
  return /* @__PURE__ */ React__default.createElement("div", { className: "w-full overflow-hidden", ref: toolbarRef }, /* @__PURE__ */ React__default.createElement(
14080
14566
  "div",
14081
14567
  {
@@ -14084,7 +14570,7 @@ function FixedToolbarButtons() {
14084
14570
  transform: "translateX(calc(-1px))"
14085
14571
  }
14086
14572
  },
14087
- /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, toolbarItemsArray.slice(0, itemsShown).map((item, index) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: item.label }, item.Component)), toolbarItemsArray.length > itemsShown && /* @__PURE__ */ React__default.createElement(OverflowMenu, null, toolbarItemsArray.slice(itemsShown).flatMap((c) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: c.label }, c.Component))))
14573
+ /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, toolbarItemsArray.slice(0, itemsShown).map((item, _) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: item.label }, item.Component)), toolbarItemsArray.length > itemsShown && /* @__PURE__ */ React__default.createElement(OverflowMenu, null, toolbarItemsArray.slice(itemsShown).flatMap((c) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: c.label }, c.Component))))
14088
14574
  ));
14089
14575
  }
14090
14576
  const FloatingToolbar = withRef(({ children, state, ...props }, componentRef) => {
@@ -14199,6 +14685,10 @@ function TurnIntoDropdownMenu(props) {
14199
14685
  const openState = useOpenState();
14200
14686
  const selectedItem = items.find((item) => item.value === value) ?? defaultItem;
14201
14687
  const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
14688
+ const editorState = useEditorState();
14689
+ const userInTable = helpers.isNodeActive(editorState, ELEMENT_TABLE$1);
14690
+ if (userInTable)
14691
+ return null;
14202
14692
  return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(
14203
14693
  ToolbarButton,
14204
14694
  {
@@ -14240,49 +14730,6 @@ function TurnIntoDropdownMenu(props) {
14240
14730
  function FloatingToolbarButtons() {
14241
14731
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(TurnIntoDropdownMenu, null));
14242
14732
  }
14243
- const buttonVariants = cva(
14244
- "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",
14245
- {
14246
- defaultVariants: {
14247
- size: "default",
14248
- variant: "default"
14249
- },
14250
- variants: {
14251
- isMenu: {
14252
- true: "h-auto w-full cursor-pointer justify-start"
14253
- },
14254
- size: {
14255
- default: "h-10 px-4 py-2",
14256
- icon: "size-10",
14257
- lg: "h-11 rounded-md px-8",
14258
- none: "",
14259
- sm: "h-9 rounded-md px-3",
14260
- sms: "size-9 rounded-md px-0",
14261
- xs: "h-8 rounded-md px-3"
14262
- },
14263
- variant: {
14264
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
14265
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
14266
- ghost: "hover:bg-accent hover:text-accent-foreground",
14267
- inlineLink: "text-base text-primary underline underline-offset-4",
14268
- link: "text-primary underline-offset-4 hover:underline",
14269
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
14270
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
14271
- }
14272
- }
14273
- }
14274
- );
14275
- withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
14276
- const Comp = asChild ? Slot : "button";
14277
- return /* @__PURE__ */ React.createElement(
14278
- Comp,
14279
- {
14280
- className: cn$1(buttonVariants({ className, isMenu, size, variant })),
14281
- ref,
14282
- ...props
14283
- }
14284
- );
14285
- });
14286
14733
  const inputVariants = cva(
14287
14734
  "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",
14288
14735
  {
@@ -14303,22 +14750,6 @@ const inputVariants = cva(
14303
14750
  }
14304
14751
  );
14305
14752
  withVariants("input", inputVariants, ["variant", "h"]);
14306
- const popoverVariants = cva(
14307
- "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"
14308
- );
14309
- withRef(
14310
- ({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
14311
- PopoverPrimitive.Content,
14312
- {
14313
- align,
14314
- className: cn$1(popoverVariants(), className),
14315
- ref,
14316
- sideOffset,
14317
- style: { zIndex: 1e3, ...style },
14318
- ...props
14319
- }
14320
- ))
14321
- );
14322
14753
  const floatingOptions = {
14323
14754
  middleware: [
14324
14755
  offset(12),
@@ -14378,7 +14809,7 @@ function LinkFloatingToolbar({ state }) {
14378
14809
  const editContent = editState.isEditing ? input : /* @__PURE__ */ React__default.createElement("div", { className: "box-content flex h-9 items-center gap-1" }, /* @__PURE__ */ React__default.createElement(
14379
14810
  "button",
14380
14811
  {
14381
- className: buttonVariants({ size: "sm", variant: "ghost" }),
14812
+ className: buttonVariants$1({ size: "sm", variant: "ghost" }),
14382
14813
  type: "button",
14383
14814
  ...editButtonProps
14384
14815
  },
@@ -14386,7 +14817,7 @@ function LinkFloatingToolbar({ state }) {
14386
14817
  ), /* @__PURE__ */ React__default.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React__default.createElement(
14387
14818
  LinkOpenButton,
14388
14819
  {
14389
- className: buttonVariants({
14820
+ className: buttonVariants$1({
14390
14821
  size: "sms",
14391
14822
  variant: "ghost"
14392
14823
  })
@@ -14395,7 +14826,7 @@ function LinkFloatingToolbar({ state }) {
14395
14826
  ), /* @__PURE__ */ React__default.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React__default.createElement(
14396
14827
  "button",
14397
14828
  {
14398
- className: buttonVariants({
14829
+ className: buttonVariants$1({
14399
14830
  size: "sms",
14400
14831
  variant: "ghost"
14401
14832
  }),