@oyat/editor 1.0.7 → 1.1.1

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,12 +1,13 @@
1
1
  import * as React from "react";
2
2
  import React__default from "react";
3
3
  import { PlateElement, useReadOnly, useSelected, useFocused, ParagraphPlugin, PlateLeaf, useEditorPlugin, usePlateState, usePluginOption, BlockPlaceholderPlugin, useEditorRef, useElement, withHOC, useRemoveNodeButton, useEditorSelector, useFocusedLast, toTPlatePlugin, MemoizedChildren, useSelectionFragmentProp, useMarkToolbarButtonState, useMarkToolbarButton, useEditorReadOnly, createPlatePlugin, useEditorId, useEventEditorValue, useFormInputProps, useEditorSelection, createPrimitiveComponent, useEditorMounted, useComposedRef as useComposedRef$1, PlateContent, PlateContainer, PlateView, Plate, usePlateEditor, useElementSelector } from "platejs/react";
4
- import { KEYS, isHotkey, getPluginTypes, NodeApi, PathApi, isSlateString, RangeApi, isType, getPluginByType, ExitBreakPlugin, isUrl, IS_APPLE, nanoid, TextApi, ElementApi, isSlateElement, isSlateEditor, TrailingBlockPlugin } from "platejs";
5
- import { normalizeNodeId } from "platejs";
4
+ import { Plate as Plate2, PlateLeaf as PlateLeaf2, PlateView as PlateView2, toPlatePlugin, usePlateEditor as usePlateEditor2, usePlateViewEditor } from "platejs/react";
5
+ import { KEYS, isHotkey, getPluginTypes, NodeApi, PathApi, isSlateString, RangeApi, isType, getPluginByType, ExitBreakPlugin, isUrl, IS_APPLE, nanoid, TextApi, ElementApi, isSlateElement, isSlateEditor, TrailingBlockPlugin, SlateElement, BaseParagraphPlugin, SlateLeaf } from "platejs";
6
+ import { PlateStatic, createSlateEditor, createSlatePlugin, normalizeNodeId, serializeHtml } from "platejs";
6
7
  import { TextAlignPlugin, FontColorPlugin, FontBackgroundColorPlugin, FontSizePlugin, FontFamilyPlugin, LineHeightPlugin } from "@platejs/basic-styles/react";
7
8
  import { AutoformatPlugin, autoformatSmartQuotes, autoformatPunctuation, autoformatLegal, autoformatLegalHtml, autoformatArrow, autoformatMath } from "@platejs/autoformat";
8
- import { insertEmptyCodeBlock, isLangSupported, formatCodeBlock, insertCodeBlock, toggleCodeBlock } from "@platejs/code-block";
9
- import { toggleList, expandListItemsWithChildren, someList, ListStyleType, isOrderedList } from "@platejs/list";
9
+ import { insertEmptyCodeBlock, isLangSupported, formatCodeBlock, insertCodeBlock, toggleCodeBlock, BaseCodeBlockPlugin, BaseCodeLinePlugin, BaseCodeSyntaxPlugin } from "@platejs/code-block";
10
+ import { toggleList, expandListItemsWithChildren, someList, ListStyleType, isOrderedList, BaseListPlugin } from "@platejs/list";
10
11
  import { H1Plugin, H2Plugin, H3Plugin, H4Plugin, H5Plugin, H6Plugin, BlockquotePlugin, HorizontalRulePlugin, BoldPlugin, ItalicPlugin, UnderlinePlugin, CodePlugin, StrikethroughPlugin, SubscriptPlugin, SuperscriptPlugin, HighlightPlugin, KbdPlugin } from "@platejs/basic-nodes/react";
11
12
  import { cva } from "class-variance-authority";
12
13
  import { clsx } from "clsx";
@@ -14,7 +15,7 @@ import { twMerge } from "tailwind-merge";
14
15
  import { BlockMenuPlugin, BlockSelectionPlugin, BLOCK_CONTEXT_MENU_ID, useBlockSelected, useCursorOverlay, CursorOverlayPlugin } from "@platejs/selection/react";
15
16
  import { AIChatPlugin } from "@platejs/ai/react";
16
17
  import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
17
- import { ChevronRightIcon, CircleIcon, CheckIcon, ChevronDown, SearchIcon, XIcon, MusicIcon, CompassIcon, SmileIcon, LightbulbIcon, LeafIcon, ClockIcon, AppleIcon, FlagIcon, StarIcon, BracesIcon, Check, CopyIcon, GripHorizontal, Trash2Icon, ChevronLeftIcon, ChevronDownIcon, GripVertical, AlignLeftIcon, AlignCenterIcon, AlignRightIcon, AlignJustifyIcon, EraserIcon, PlusIcon, Undo2Icon, Redo2Icon, OutdentIcon, IndentIcon, PilcrowIcon, Heading1Icon, Heading2Icon, Heading3Icon, TableIcon, ListIcon, ListOrderedIcon, ImageIcon, Link2Icon, Link, ListOrdered, List as List$1, LinkIcon, FilmIcon, FileUpIcon, AudioLinesIcon, MoreHorizontalIcon, SuperscriptIcon, SubscriptIcon, Table, Grid3x3Icon, Combine, Ungroup, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Heading4Icon, Heading5Icon, Heading6Icon, BoldIcon, ItalicIcon, UnderlineIcon, StrikethroughIcon, BaselineIcon, PaintBucketIcon, Text, Unlink, ExternalLink, RadicalIcon, CornerDownLeftIcon, FileUp, Loader2Icon, Film, AudioLines, Minus, Plus, Download, X, SparklesIcon, Square, Code2, Quote, TableOfContentsIcon, Columns3Icon, PenToolIcon, CalendarIcon, ArrowUpIcon, PencilIcon, TrashIcon, PencilLineIcon, MessageSquareTextIcon, MessagesSquareIcon, CombineIcon, SquareSplitHorizontalIcon, Grid2X2Icon, ChevronRight } from "lucide-react";
18
+ import { ChevronRightIcon, CircleIcon, CheckIcon, ChevronDown, SearchIcon, XIcon, MusicIcon, CompassIcon, SmileIcon, LightbulbIcon, LeafIcon, ClockIcon, AppleIcon, FlagIcon, StarIcon, BracesIcon, Check, CopyIcon, GripHorizontal, Trash2Icon, ChevronLeftIcon, ChevronDownIcon, GripVertical, AlignLeftIcon, AlignCenterIcon, AlignRightIcon, AlignJustifyIcon, EraserIcon, PlusIcon, Undo2Icon, Redo2Icon, OutdentIcon, IndentIcon, PilcrowIcon, Heading1Icon, Heading2Icon, Heading3Icon, TableIcon, ListIcon, ListOrderedIcon, ImageIcon, Link2Icon, Link, ListOrdered, List as List$2, LinkIcon, FilmIcon, FileUpIcon, AudioLinesIcon, MoreHorizontalIcon, SuperscriptIcon, SubscriptIcon, Table, Grid3x3Icon, Combine, Ungroup, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Heading4Icon, Heading5Icon, Heading6Icon, BoldIcon, ItalicIcon, UnderlineIcon, StrikethroughIcon, BaselineIcon, PaintBucketIcon, Text, Unlink, ExternalLink, RadicalIcon, CornerDownLeftIcon, FileUp, Loader2Icon, Film, AudioLines, Minus, Plus, Download, X, SparklesIcon, Square, Code2, Quote, TableOfContentsIcon, Columns3Icon, PenToolIcon, CalendarIcon, ArrowUpIcon, PencilIcon, TrashIcon, PencilLineIcon, MessageSquareTextIcon, MessagesSquareIcon, CombineIcon, SquareSplitHorizontalIcon, Grid2X2Icon, ChevronRight } from "lucide-react";
18
19
  import { DndPlugin, useDraggable, useDropLine } from "@platejs/dnd";
19
20
  import { useCalloutEmojiPicker, CalloutPlugin } from "@platejs/callout/react";
20
21
  import { useEmojiDropdownMenuState } from "@platejs/emoji/react";
@@ -32,7 +33,7 @@ import { createLowlight, all } from "lowlight";
32
33
  import { Command as Command$1 } from "cmdk";
33
34
  import "@radix-ui/react-dialog";
34
35
  import { ColumnPlugin, ColumnItemPlugin } from "@platejs/layout/react";
35
- import { setColumns, insertColumnGroup, toggleColumnGroup } from "@platejs/layout";
36
+ import { setColumns, insertColumnGroup, toggleColumnGroup, BaseColumnPlugin, BaseColumnItemPlugin } from "@platejs/layout";
36
37
  import { ResizableProvider, Resizable as Resizable$1, useResizeHandleState, useResizeHandle, useResizableValue } from "@platejs/resizable";
37
38
  import { useComposedRef, createPrimitiveComponent as createPrimitiveComponent$1 } from "@udecode/cn";
38
39
  import { getCommentCount, BaseCommentPlugin, getDraftCommentKey, getCommentKey } from "@platejs/comment";
@@ -44,21 +45,21 @@ import { PlaceholderPlugin, useMediaState, useImagePreviewValue, useFloatingMedi
44
45
  import { DocxPlugin } from "@platejs/docx";
45
46
  import { JuicePlugin } from "@platejs/juice";
46
47
  import { useOutdentButton, useIndentButton, IndentPlugin } from "@platejs/indent/react";
47
- import { insertCallout } from "@platejs/callout";
48
- import { insertDate } from "@platejs/date";
48
+ import { insertCallout, BaseCalloutPlugin } from "@platejs/callout";
49
+ import { insertDate, BaseDatePlugin } from "@platejs/date";
49
50
  import { insertExcalidraw } from "@platejs/excalidraw";
50
51
  import { triggerFloatingLink, useLinkToolbarButtonState, useLinkToolbarButton, useFloatingLinkInsertState, useFloatingLinkInsert, useFloatingLinkEditState, useFloatingLinkEdit, FloatingLinkUrlInput, LinkPlugin } from "@platejs/link/react";
51
- import { insertEquation, insertInlineEquation } from "@platejs/math";
52
- import { insertVideoPlaceholder, insertMedia, insertFilePlaceholder, insertAudioPlaceholder, parseTwitterUrl, parseVideoUrl } from "@platejs/media";
52
+ import { insertEquation, insertInlineEquation, getEquationHtml, BaseInlineEquationPlugin, BaseEquationPlugin } from "@platejs/math";
53
+ import { insertVideoPlaceholder, insertMedia, insertFilePlaceholder, insertAudioPlaceholder, parseTwitterUrl, parseVideoUrl, BaseImagePlugin, BaseVideoPlugin, BaseAudioPlugin, BaseFilePlugin, BaseMediaEmbedPlugin, BasePlaceholderPlugin } from "@platejs/media";
53
54
  import { SuggestionPlugin } from "@platejs/suggestion/react";
54
55
  import { TablePlugin, useTableMergeState, TableProvider, useTableElement, useTableBordersDropdownMenuContentState, useTableCellElement, useTableCellElementResizable, TableRowPlugin, TableCellPlugin, TableCellHeaderPlugin } from "@platejs/table/react";
55
- import { insertToc } from "@platejs/toc";
56
+ import { insertToc, BaseTocPlugin, isHeading } from "@platejs/toc";
56
57
  import { useTodoListElementState, useTodoListElement, ListPlugin } from "@platejs/list/react";
57
58
  import { toast } from "sonner";
58
59
  import { useFilePicker } from "use-file-picker";
59
60
  import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
60
61
  import { useFloatingToolbarState, offset, flip, useFloatingToolbar } from "@platejs/floating";
61
- import { getLinkAttributes } from "@platejs/link";
62
+ import { getLinkAttributes, BaseLinkPlugin } from "@platejs/link";
62
63
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
63
64
  import { MarkdownPlugin, remarkMdx, remarkMention } from "@platejs/markdown";
64
65
  import remarkGfm from "remark-gfm";
@@ -72,7 +73,7 @@ import { generateReactHelpers } from "@uploadthing/react";
72
73
  import { z } from "zod";
73
74
  import ReactPlayer from "react-player";
74
75
  import { MentionPlugin, MentionInputPlugin } from "@platejs/mention/react";
75
- import { getMentionOnSelectItem } from "@platejs/mention";
76
+ import { getMentionOnSelectItem, BaseMentionPlugin } from "@platejs/mention";
76
77
  import { useComboboxContext, Combobox, useComboboxStore, ComboboxProvider, Portal, ComboboxPopover, ComboboxGroup, ComboboxItem, ComboboxGroupLabel } from "@ariakit/react";
77
78
  import { filterWords } from "@platejs/combobox";
78
79
  import { useHTMLInputCursorState, useComboboxInput } from "@platejs/combobox/react";
@@ -81,9 +82,15 @@ import { getTransientSuggestionKey, getSuggestionKey, keyId2SuggestionId, accept
81
82
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
82
83
  import { useCommentId, CommentPlugin } from "@platejs/comment/react";
83
84
  import { differenceInMinutes, differenceInHours, differenceInDays, format } from "date-fns";
84
- import { setCellBackground } from "@platejs/table";
85
+ import { setCellBackground, BaseTablePlugin, BaseTableRowPlugin, BaseTableCellPlugin, BaseTableCellHeaderPlugin } from "@platejs/table";
85
86
  import { useTocElementState, useTocElement, TocPlugin } from "@platejs/toc/react";
86
87
  import { useToggleButtonState, useToggleButton, TogglePlugin } from "@platejs/toggle/react";
88
+ import { BaseTextAlignPlugin, BaseFontColorPlugin, BaseFontBackgroundColorPlugin, BaseFontSizePlugin, BaseFontFamilyPlugin, BaseLineHeightPlugin } from "@platejs/basic-styles";
89
+ import { BaseH1Plugin, BaseH2Plugin, BaseH3Plugin, BaseH4Plugin, BaseH5Plugin, BaseH6Plugin, BaseBlockquotePlugin, BaseHorizontalRulePlugin, BaseBoldPlugin, BaseItalicPlugin, BaseUnderlinePlugin, BaseCodePlugin, BaseStrikethroughPlugin, BaseSubscriptPlugin, BaseSuperscriptPlugin, BaseHighlightPlugin, BaseKbdPlugin } from "@platejs/basic-nodes";
90
+ import { BaseIndentPlugin } from "@platejs/indent";
91
+ import { BaseCaptionPlugin } from "@platejs/caption";
92
+ import { BaseTogglePlugin } from "@platejs/toggle";
93
+ import { computeDiff, withGetFragmentExcludeDiff } from "@platejs/diff";
87
94
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
88
95
  function getDefaultExportFromCjs(x) {
89
96
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -643,7 +650,7 @@ function BlockquoteElement(props) {
643
650
  }
644
651
  );
645
652
  }
646
- const headingVariants = cva("relative mb-1", {
653
+ const headingVariants$1 = cva("relative mb-1", {
647
654
  variants: {
648
655
  variant: {
649
656
  h1: "mt-[1.6em] pb-1 font-heading text-4xl font-bold",
@@ -663,7 +670,7 @@ function HeadingElement({
663
670
  PlateElement,
664
671
  {
665
672
  as: variant,
666
- className: headingVariants({ variant }),
673
+ className: headingVariants$1({ variant }),
667
674
  ...props,
668
675
  children: props.children
669
676
  }
@@ -2633,11 +2640,11 @@ const languages = [
2633
2640
  { label: "XML", value: "xml" },
2634
2641
  { label: "YAML", value: "yaml" }
2635
2642
  ];
2636
- const lowlight = createLowlight(all);
2643
+ const lowlight$1 = createLowlight(all);
2637
2644
  const CodeBlockKit = [
2638
2645
  CodeBlockPlugin.configure({
2639
2646
  node: { component: CodeBlockElement },
2640
- options: { lowlight },
2647
+ options: { lowlight: lowlight$1 },
2641
2648
  shortcuts: { toggle: { keys: "mod+alt+8" } }
2642
2649
  }),
2643
2650
  CodeLinePlugin.withComponent(CodeLineElement),
@@ -5124,7 +5131,7 @@ function BulletedListToolbarButton() {
5124
5131
  });
5125
5132
  },
5126
5133
  "data-state": pressed ? "on" : "off",
5127
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "size-4" })
5134
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(List$2, { className: "size-4" })
5128
5135
  }
5129
5136
  ),
5130
5137
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { open, onOpenChange: setOpen, modal: false, children: [
@@ -6186,21 +6193,21 @@ const FloatingToolbarKit = [
6186
6193
  }
6187
6194
  })
6188
6195
  ];
6189
- const options = {
6196
+ const options$1 = {
6190
6197
  inject: { targetPlugins: [KEYS.p] }
6191
6198
  };
6192
6199
  const FontKit = [
6193
6200
  FontColorPlugin.configure({
6194
6201
  inject: {
6195
- ...options.inject,
6202
+ ...options$1.inject,
6196
6203
  nodeProps: {
6197
6204
  defaultNodeValue: "black"
6198
6205
  }
6199
6206
  }
6200
6207
  }),
6201
- FontBackgroundColorPlugin.configure(options),
6202
- FontSizePlugin.configure(options),
6203
- FontFamilyPlugin.configure(options)
6208
+ FontBackgroundColorPlugin.configure(options$1),
6209
+ FontSizePlugin.configure(options$1),
6210
+ FontFamilyPlugin.configure(options$1)
6204
6211
  ];
6205
6212
  const LineHeightKit = [
6206
6213
  LineHeightPlugin.configure({
@@ -6432,7 +6439,7 @@ function Checkbox({
6432
6439
  }
6433
6440
  );
6434
6441
  }
6435
- const config = {
6442
+ const config$1 = {
6436
6443
  todo: {
6437
6444
  Li: TodoLi,
6438
6445
  Marker: TodoMarker
@@ -6440,11 +6447,11 @@ const config = {
6440
6447
  };
6441
6448
  const BlockList = (props) => {
6442
6449
  if (!props.element.listStyleType) return;
6443
- return (props2) => /* @__PURE__ */ jsxRuntimeExports.jsx(List, { ...props2 });
6450
+ return (props2) => /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { ...props2 });
6444
6451
  };
6445
- function List(props) {
6452
+ function List$1(props) {
6446
6453
  const { listStart, listStyleType } = props.element;
6447
- const { Li, Marker } = config[listStyleType] ?? {};
6454
+ const { Li, Marker } = config$1[listStyleType] ?? {};
6448
6455
  const List2 = isOrderedList(props.element) ? "ol" : "ul";
6449
6456
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6450
6457
  List2,
@@ -11733,7 +11740,7 @@ const TableKit = [
11733
11740
  TableCellPlugin.withComponent(TableCellElement),
11734
11741
  TableCellHeaderPlugin.withComponent(TableCellHeaderElement)
11735
11742
  ];
11736
- const headingItemVariants = cva(
11743
+ const headingItemVariants$1 = cva(
11737
11744
  "block h-auto w-full cursor-pointer truncate rounded-none px-0.5 py-1.5 text-left font-medium text-muted-foreground underline decoration-[0.5px] underline-offset-4 hover:bg-accent hover:text-muted-foreground",
11738
11745
  {
11739
11746
  variants: {
@@ -11754,7 +11761,7 @@ function TocElement(props) {
11754
11761
  Button,
11755
11762
  {
11756
11763
  variant: "ghost",
11757
- className: headingItemVariants({
11764
+ className: headingItemVariants$1({
11758
11765
  depth: item.depth
11759
11766
  }),
11760
11767
  onClick: (e) => btnProps.onClick(e, item, "smooth"),
@@ -11865,9 +11872,783 @@ function PlateEditor({
11865
11872
  }
11866
11873
  ) });
11867
11874
  }
11875
+ const BaseAlignKit = [
11876
+ BaseTextAlignPlugin.configure({
11877
+ inject: {
11878
+ nodeProps: {
11879
+ defaultNodeValue: "start",
11880
+ nodeKey: "align",
11881
+ styleKey: "textAlign",
11882
+ validNodeValues: ["start", "left", "center", "right", "end", "justify"]
11883
+ },
11884
+ targetPlugins: [...KEYS.heading, KEYS.p, KEYS.img, KEYS.mediaEmbed]
11885
+ }
11886
+ })
11887
+ ];
11888
+ function BlockquoteElementStatic(props) {
11889
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
11890
+ SlateElement,
11891
+ {
11892
+ as: "blockquote",
11893
+ className: "my-1 border-l-2 pl-6 italic",
11894
+ ...props
11895
+ }
11896
+ );
11897
+ }
11898
+ const headingVariants = cva("relative mb-1", {
11899
+ variants: {
11900
+ variant: {
11901
+ h1: "mt-[1.6em] pb-1 font-heading text-4xl font-bold",
11902
+ h2: "mt-[1.4em] pb-px font-heading text-2xl font-semibold tracking-tight",
11903
+ h3: "mt-[1em] pb-px font-heading text-xl font-semibold tracking-tight",
11904
+ h4: "mt-[0.75em] font-heading text-lg font-semibold tracking-tight",
11905
+ h5: "mt-[0.75em] text-lg font-semibold tracking-tight",
11906
+ h6: "mt-[0.75em] text-base font-semibold tracking-tight"
11907
+ }
11908
+ }
11909
+ });
11910
+ function HeadingElementStatic({
11911
+ variant = "h1",
11912
+ ...props
11913
+ }) {
11914
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
11915
+ SlateElement,
11916
+ {
11917
+ as: variant,
11918
+ className: headingVariants({ variant }),
11919
+ ...props,
11920
+ children: props.children
11921
+ }
11922
+ );
11923
+ }
11924
+ function H1ElementStatic(props) {
11925
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(HeadingElementStatic, { variant: "h1", ...props });
11926
+ }
11927
+ function H2ElementStatic(props) {
11928
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(HeadingElementStatic, { variant: "h2", ...props });
11929
+ }
11930
+ function H3ElementStatic(props) {
11931
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(HeadingElementStatic, { variant: "h3", ...props });
11932
+ }
11933
+ function H4ElementStatic(props) {
11934
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(HeadingElementStatic, { variant: "h4", ...props });
11935
+ }
11936
+ function H5ElementStatic(props) {
11937
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(HeadingElementStatic, { variant: "h5", ...props });
11938
+ }
11939
+ function H6ElementStatic(props) {
11940
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(HeadingElementStatic, { variant: "h6", ...props });
11941
+ }
11942
+ function HrElementStatic(props) {
11943
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlateElement, { ...props, children: [
11944
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "cursor-text py-6", contentEditable: false, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
11945
+ "hr",
11946
+ {
11947
+ className: cn(
11948
+ "h-0.5 rounded-sm border-none bg-muted bg-clip-content"
11949
+ )
11950
+ }
11951
+ ) }),
11952
+ props.children
11953
+ ] });
11954
+ }
11955
+ function ParagraphElementStatic(props) {
11956
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SlateElement, { ...props, className: cn("m-0 px-0 py-1"), children: props.children });
11957
+ }
11958
+ const BaseBasicBlocksKit = [
11959
+ BaseParagraphPlugin.withComponent(ParagraphElementStatic),
11960
+ BaseH1Plugin.withComponent(H1ElementStatic),
11961
+ BaseH2Plugin.withComponent(H2ElementStatic),
11962
+ BaseH3Plugin.withComponent(H3ElementStatic),
11963
+ BaseH4Plugin.withComponent(H4ElementStatic),
11964
+ BaseH5Plugin.withComponent(H5ElementStatic),
11965
+ BaseH6Plugin.withComponent(H6ElementStatic),
11966
+ BaseBlockquotePlugin.withComponent(BlockquoteElementStatic),
11967
+ BaseHorizontalRulePlugin.withComponent(HrElementStatic)
11968
+ ];
11969
+ function CodeLeafStatic(props) {
11970
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
11971
+ SlateLeaf,
11972
+ {
11973
+ ...props,
11974
+ as: "code",
11975
+ className: "rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm whitespace-pre-wrap",
11976
+ children: props.children
11977
+ }
11978
+ );
11979
+ }
11980
+ function HighlightLeafStatic(props) {
11981
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SlateLeaf, { ...props, as: "mark", className: "bg-highlight/30 text-inherit", children: props.children });
11982
+ }
11983
+ function KbdLeafStatic(props) {
11984
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
11985
+ SlateLeaf,
11986
+ {
11987
+ ...props,
11988
+ as: "kbd",
11989
+ className: "rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-sm shadow-[rgba(255,_255,_255,_0.1)_0px_0.5px_0px_0px_inset,_rgb(248,_249,_250)_0px_1px_5px_0px_inset,_rgb(193,_200,_205)_0px_0px_0px_0.5px,_rgb(193,_200,_205)_0px_2px_1px_-1px,_rgb(193,_200,_205)_0px_1px_0px_0px] dark:shadow-[rgba(255,_255,_255,_0.1)_0px_0.5px_0px_0px_inset,_rgb(26,_29,_30)_0px_1px_5px_0px_inset,_rgb(76,_81,_85)_0px_0px_0px_0.5px,_rgb(76,_81,_85)_0px_2px_1px_-1px,_rgb(76,_81,_85)_0px_1px_0px_0px]",
11990
+ children: props.children
11991
+ }
11992
+ );
11993
+ }
11994
+ const BaseBasicMarksKit = [
11995
+ BaseBoldPlugin,
11996
+ BaseItalicPlugin,
11997
+ BaseUnderlinePlugin,
11998
+ BaseCodePlugin.withComponent(CodeLeafStatic),
11999
+ BaseStrikethroughPlugin,
12000
+ BaseSubscriptPlugin,
12001
+ BaseSuperscriptPlugin,
12002
+ BaseHighlightPlugin.withComponent(HighlightLeafStatic),
12003
+ BaseKbdPlugin.withComponent(KbdLeafStatic)
12004
+ ];
12005
+ function CalloutElementStatic({
12006
+ children,
12007
+ className,
12008
+ ...props
12009
+ }) {
12010
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12011
+ SlateElement,
12012
+ {
12013
+ className: cn("my-1 flex rounded-sm bg-muted p-4 pl-3", className),
12014
+ style: {
12015
+ backgroundColor: props.element.backgroundColor
12016
+ },
12017
+ ...props,
12018
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-full gap-2 rounded-md", children: [
12019
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
12020
+ "div",
12021
+ {
12022
+ className: "size-6 text-[18px] select-none",
12023
+ style: {
12024
+ fontFamily: '"Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", EmojiSymbols'
12025
+ },
12026
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "data-plate-prevent-deserialization": true, children: props.element.icon || "💡" })
12027
+ }
12028
+ ),
12029
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full", children })
12030
+ ] })
12031
+ }
12032
+ );
12033
+ }
12034
+ const BaseCalloutKit = [
12035
+ BaseCalloutPlugin.withComponent(CalloutElementStatic)
12036
+ ];
12037
+ function CodeBlockElementStatic(props) {
12038
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12039
+ SlateElement,
12040
+ {
12041
+ className: "py-1 **:[.hljs-addition]:bg-[#f0fff4] **:[.hljs-addition]:text-[#22863a] dark:**:[.hljs-addition]:bg-[#3c5743] dark:**:[.hljs-addition]:text-[#ceead5] **:[.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable]:text-[#005cc5] dark:**:[.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable]:text-[#6596cf] **:[.hljs-built\\\\\\\\_in,.hljs-symbol]:text-[#e36209] dark:**:[.hljs-built\\\\\\\\_in,.hljs-symbol]:text-[#c3854e] **:[.hljs-bullet]:text-[#735c0f] **:[.hljs-comment,.hljs-code,.hljs-formula]:text-[#6a737d] dark:**:[.hljs-comment,.hljs-code,.hljs-formula]:text-[#6a737d] **:[.hljs-deletion]:bg-[#ffeef0] **:[.hljs-deletion]:text-[#b31d28] dark:**:[.hljs-deletion]:bg-[#473235] dark:**:[.hljs-deletion]:text-[#e7c7cb] **:[.hljs-emphasis]:italic **:[.hljs-keyword,.hljs-doctag,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language\\\\\\\\_]:text-[#d73a49] dark:**:[.hljs-keyword,.hljs-doctag,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language\\\\\\\\_]:text-[#ee6960] **:[.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo]:text-[#22863a] dark:**:[.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo]:text-[#36a84f] **:[.hljs-regexp,.hljs-string,.hljs-meta_.hljs-string]:text-[#032f62] dark:**:[.hljs-regexp,.hljs-string,.hljs-meta_.hljs-string]:text-[#3593ff] **:[.hljs-section]:font-bold **:[.hljs-section]:text-[#005cc5] dark:**:[.hljs-section]:text-[#61a5f2] **:[.hljs-strong]:font-bold **:[.hljs-title,.hljs-title.class\\\\\\\\_,.hljs-title.class\\\\\\\\_.inherited\\\\\\\\_\\\\\\\\_,.hljs-title.function\\\\\\\\_]:text-[#6f42c1] dark:**:[.hljs-title,.hljs-title.class\\\\\\\\_,.hljs-title.class\\\\\\\\_.inherited\\\\\\\\_\\\\\\\\_,.hljs-title.function\\\\\\\\_]:text-[#a77bfa]",
12042
+ ...props,
12043
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative rounded-md bg-muted/50", children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "overflow-x-auto p-8 pr-4 font-mono text-sm leading-[normal] [tab-size:2] print:break-inside-avoid", children: /* @__PURE__ */ jsxRuntimeExports.jsx("code", { children: props.children }) }) })
12044
+ }
12045
+ );
12046
+ }
12047
+ function CodeLineElementStatic(props) {
12048
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SlateElement, { ...props });
12049
+ }
12050
+ function CodeSyntaxLeafStatic(props) {
12051
+ const tokenClassName = props.leaf.className;
12052
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SlateLeaf, { className: tokenClassName, ...props });
12053
+ }
12054
+ const lowlight = createLowlight(all);
12055
+ const BaseCodeBlockKit = [
12056
+ BaseCodeBlockPlugin.configure({
12057
+ node: { component: CodeBlockElementStatic },
12058
+ options: { lowlight }
12059
+ }),
12060
+ BaseCodeLinePlugin.withComponent(CodeLineElementStatic),
12061
+ BaseCodeSyntaxPlugin.withComponent(CodeSyntaxLeafStatic)
12062
+ ];
12063
+ function ColumnElementStatic(props) {
12064
+ const { width } = props.element;
12065
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group/column relative", style: { width: width ?? "100%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
12066
+ SlateElement,
12067
+ {
12068
+ className: "h-full px-2 pt-2 group-first/column:pl-0 group-last/column:pr-0",
12069
+ ...props,
12070
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative h-full border border-transparent p-1.5", children: props.children })
12071
+ }
12072
+ ) });
12073
+ }
12074
+ function ColumnGroupElementStatic(props) {
12075
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SlateElement, { className: "mb-2", ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex size-full rounded", children: props.children }) });
12076
+ }
12077
+ const BaseColumnKit = [
12078
+ BaseColumnPlugin.withComponent(ColumnGroupElementStatic),
12079
+ BaseColumnItemPlugin.withComponent(ColumnElementStatic)
12080
+ ];
12081
+ function CommentLeafStatic(props) {
12082
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12083
+ SlateLeaf,
12084
+ {
12085
+ ...props,
12086
+ className: "border-b-2 border-b-highlight/35 bg-highlight/15",
12087
+ children: props.children
12088
+ }
12089
+ );
12090
+ }
12091
+ const BaseCommentKit = [
12092
+ BaseCommentPlugin.withComponent(CommentLeafStatic)
12093
+ ];
12094
+ function DateElementStatic(props) {
12095
+ const { element } = props;
12096
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlateElement, { className: "inline-block", ...props, children: [
12097
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "w-fit rounded-sm bg-muted px-1 text-muted-foreground", children: element.date ? (() => {
12098
+ const today = /* @__PURE__ */ new Date();
12099
+ const elementDate = new Date(element.date);
12100
+ const isToday = elementDate.getDate() === today.getDate() && elementDate.getMonth() === today.getMonth() && elementDate.getFullYear() === today.getFullYear();
12101
+ const isYesterday = new Date(today.setDate(today.getDate() - 1)).toDateString() === elementDate.toDateString();
12102
+ const isTomorrow = new Date(today.setDate(today.getDate() + 2)).toDateString() === elementDate.toDateString();
12103
+ if (isToday) return "Today";
12104
+ if (isYesterday) return "Yesterday";
12105
+ if (isTomorrow) return "Tomorrow";
12106
+ return elementDate.toLocaleDateString(void 0, {
12107
+ day: "numeric",
12108
+ month: "long",
12109
+ year: "numeric"
12110
+ });
12111
+ })() : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Pick a date" }) }),
12112
+ props.children
12113
+ ] });
12114
+ }
12115
+ const BaseDateKit = [BaseDatePlugin.withComponent(DateElementStatic)];
12116
+ const options = {
12117
+ inject: { targetPlugins: [KEYS.p] }
12118
+ };
12119
+ const BaseFontKit = [
12120
+ BaseFontColorPlugin.configure(options),
12121
+ BaseFontBackgroundColorPlugin.configure(options),
12122
+ BaseFontSizePlugin.configure(options),
12123
+ BaseFontFamilyPlugin.configure(options)
12124
+ ];
12125
+ const BaseLineHeightKit = [
12126
+ BaseLineHeightPlugin.configure({
12127
+ inject: {
12128
+ nodeProps: {
12129
+ defaultNodeValue: 1.5,
12130
+ validNodeValues: [1, 1.2, 1.5, 2, 3]
12131
+ },
12132
+ targetPlugins: [...KEYS.heading, KEYS.p]
12133
+ }
12134
+ })
12135
+ ];
12136
+ function LinkElementStatic(props) {
12137
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12138
+ SlateElement,
12139
+ {
12140
+ ...props,
12141
+ as: "a",
12142
+ className: "font-medium text-primary underline decoration-primary underline-offset-4",
12143
+ attributes: {
12144
+ ...props.attributes,
12145
+ ...getLinkAttributes(props.editor, props.element)
12146
+ },
12147
+ children: props.children
12148
+ }
12149
+ );
12150
+ }
12151
+ const BaseLinkKit = [BaseLinkPlugin.withComponent(LinkElementStatic)];
12152
+ const BaseIndentKit = [
12153
+ BaseIndentPlugin.configure({
12154
+ inject: {
12155
+ targetPlugins: [
12156
+ ...KEYS.heading,
12157
+ KEYS.p,
12158
+ KEYS.blockquote,
12159
+ KEYS.codeBlock,
12160
+ KEYS.toggle
12161
+ ]
12162
+ },
12163
+ options: {
12164
+ offset: 24
12165
+ }
12166
+ })
12167
+ ];
12168
+ const config = {
12169
+ todo: {
12170
+ Li: TodoLiStatic,
12171
+ Marker: TodoMarkerStatic
12172
+ }
12173
+ };
12174
+ const BlockListStatic = (props) => {
12175
+ if (!props.element.listStyleType) return;
12176
+ return (props2) => /* @__PURE__ */ jsxRuntimeExports.jsx(List, { ...props2 });
12177
+ };
12178
+ function List(props) {
12179
+ const { listStart, listStyleType } = props.element;
12180
+ const { Li, Marker } = config[listStyleType] ?? {};
12181
+ const List2 = isOrderedList(props.element) ? "ol" : "ul";
12182
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
12183
+ List2,
12184
+ {
12185
+ className: "relative m-0 p-0",
12186
+ style: { listStyleType },
12187
+ start: listStart,
12188
+ children: [
12189
+ Marker && /* @__PURE__ */ jsxRuntimeExports.jsx(Marker, { ...props }),
12190
+ Li ? /* @__PURE__ */ jsxRuntimeExports.jsx(Li, { ...props }) : /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: props.children })
12191
+ ]
12192
+ }
12193
+ );
12194
+ }
12195
+ function TodoMarkerStatic(props) {
12196
+ const checked = props.element.checked;
12197
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { contentEditable: false, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
12198
+ "button",
12199
+ {
12200
+ className: cn(
12201
+ "peer pointer-events-none absolute top-1 -left-6 size-4 shrink-0 rounded-sm border border-primary bg-background ring-offset-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
12202
+ props.className
12203
+ ),
12204
+ "data-state": checked ? "checked" : "unchecked",
12205
+ type: "button",
12206
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex items-center justify-center text-current"), children: checked && /* @__PURE__ */ jsxRuntimeExports.jsx(CheckIcon, { className: "size-4" }) })
12207
+ }
12208
+ ) });
12209
+ }
12210
+ function TodoLiStatic(props) {
12211
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12212
+ "li",
12213
+ {
12214
+ className: cn(
12215
+ "list-none",
12216
+ props.element.checked && "text-muted-foreground line-through"
12217
+ ),
12218
+ children: props.children
12219
+ }
12220
+ );
12221
+ }
12222
+ const BaseListKit = [
12223
+ ...BaseIndentKit,
12224
+ BaseListPlugin.configure({
12225
+ inject: {
12226
+ targetPlugins: [
12227
+ ...KEYS.heading,
12228
+ KEYS.p,
12229
+ KEYS.blockquote,
12230
+ KEYS.codeBlock,
12231
+ KEYS.toggle
12232
+ ]
12233
+ },
12234
+ render: {
12235
+ belowNodes: BlockListStatic
12236
+ }
12237
+ })
12238
+ ];
12239
+ function EquationElementStatic(props) {
12240
+ const { element } = props;
12241
+ const html = getEquationHtml({
12242
+ element,
12243
+ options: {
12244
+ displayMode: true,
12245
+ errorColor: "#cc0000",
12246
+ fleqn: false,
12247
+ leqno: false,
12248
+ macros: { "\\f": "#1f(#2)" },
12249
+ output: "htmlAndMathml",
12250
+ strict: "warn",
12251
+ throwOnError: false,
12252
+ trust: false
12253
+ }
12254
+ });
12255
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlateElement, { className: "my-1", ...props, children: [
12256
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
12257
+ "div",
12258
+ {
12259
+ className: cn(
12260
+ "group flex items-center justify-center rounded-sm select-none hover:bg-primary/10 data-[selected=true]:bg-primary/10",
12261
+ element.texExpression.length === 0 ? "bg-muted p-3 pr-9" : "px-2 py-1"
12262
+ ),
12263
+ children: element.texExpression.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
12264
+ "span",
12265
+ {
12266
+ dangerouslySetInnerHTML: {
12267
+ __html: html
12268
+ }
12269
+ }
12270
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-7 w-full items-center gap-2 text-sm whitespace-nowrap text-muted-foreground", children: [
12271
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RadicalIcon, { className: "size-6 text-muted-foreground/80" }),
12272
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Add a Tex equation" })
12273
+ ] })
12274
+ }
12275
+ ),
12276
+ props.children
12277
+ ] });
12278
+ }
12279
+ function InlineEquationElementStatic(props) {
12280
+ const html = getEquationHtml({
12281
+ element: props.element,
12282
+ options: {
12283
+ displayMode: true,
12284
+ errorColor: "#cc0000",
12285
+ fleqn: false,
12286
+ leqno: false,
12287
+ macros: { "\\f": "#1f(#2)" },
12288
+ output: "htmlAndMathml",
12289
+ strict: "warn",
12290
+ throwOnError: false,
12291
+ trust: false
12292
+ }
12293
+ });
12294
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
12295
+ SlateElement,
12296
+ {
12297
+ ...props,
12298
+ className: "inline-block rounded-sm select-none [&_.katex-display]:my-0",
12299
+ children: [
12300
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
12301
+ "div",
12302
+ {
12303
+ className: cn(
12304
+ 'after:absolute after:inset-0 after:-top-0.5 after:-left-1 after:z-1 after:h-[calc(100%)+4px] after:w-[calc(100%+8px)] after:rounded-sm after:content-[""]',
12305
+ "h-6",
12306
+ props.element.texExpression.length === 0 && "text-muted-foreground after:bg-neutral-500/10"
12307
+ ),
12308
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
12309
+ "span",
12310
+ {
12311
+ className: cn(
12312
+ props.element.texExpression.length === 0 && "hidden",
12313
+ "font-mono leading-none"
12314
+ ),
12315
+ dangerouslySetInnerHTML: { __html: html }
12316
+ }
12317
+ )
12318
+ }
12319
+ ),
12320
+ props.children
12321
+ ]
12322
+ }
12323
+ );
12324
+ }
12325
+ const BaseMathKit = [
12326
+ BaseInlineEquationPlugin.withComponent(InlineEquationElementStatic),
12327
+ BaseEquationPlugin.withComponent(EquationElementStatic)
12328
+ ];
12329
+ function AudioElementStatic(props) {
12330
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlateElement, { ...props, className: "mb-1", children: [
12331
+ /* @__PURE__ */ jsxRuntimeExports.jsx("figure", { className: "group relative cursor-default", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-16", children: /* @__PURE__ */ jsxRuntimeExports.jsx("audio", { className: "size-full", src: props.element.url, controls: true }) }) }),
12332
+ props.children
12333
+ ] });
12334
+ }
12335
+ function FileElementStatic(props) {
12336
+ const { name, url } = props.element;
12337
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlateElement, { className: "my-px rounded-sm", ...props, children: [
12338
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
12339
+ "a",
12340
+ {
12341
+ className: "group relative m-0 flex cursor-pointer items-center rounded px-0.5 py-[3px] hover:bg-muted",
12342
+ contentEditable: false,
12343
+ download: name,
12344
+ href: url,
12345
+ rel: "noopener noreferrer",
12346
+ role: "button",
12347
+ target: "_blank",
12348
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 p-1", children: [
12349
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FileUp, { className: "size-5" }),
12350
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: name })
12351
+ ] })
12352
+ }
12353
+ ),
12354
+ props.children
12355
+ ] });
12356
+ }
12357
+ function ImageElementStatic(props) {
12358
+ const { align = "center", caption, url, width } = props.element;
12359
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlateElement, { ...props, className: "py-2.5", children: [
12360
+ /* @__PURE__ */ jsxRuntimeExports.jsx("figure", { className: "group relative m-0 inline-block", style: { width }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
12361
+ "div",
12362
+ {
12363
+ className: "relative max-w-full min-w-[92px]",
12364
+ style: { textAlign: align },
12365
+ children: [
12366
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
12367
+ "img",
12368
+ {
12369
+ className: cn(
12370
+ "w-full max-w-full cursor-default object-cover px-0",
12371
+ "rounded-sm"
12372
+ ),
12373
+ alt: props.attributes.alt,
12374
+ src: url
12375
+ }
12376
+ ),
12377
+ caption && /* @__PURE__ */ jsxRuntimeExports.jsx("figcaption", { className: "mx-auto mt-2 h-[24px] max-w-full", children: NodeApi.string(caption[0]) })
12378
+ ]
12379
+ }
12380
+ ) }),
12381
+ props.children
12382
+ ] });
12383
+ }
12384
+ function VideoElementStatic(props) {
12385
+ const { align = "center", caption, url, width } = props.element;
12386
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlateElement, { className: "py-2.5", ...props, children: [
12387
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { textAlign: align }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
12388
+ "figure",
12389
+ {
12390
+ className: "group relative m-0 inline-block cursor-default",
12391
+ style: { width },
12392
+ children: [
12393
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
12394
+ "video",
12395
+ {
12396
+ className: "w-full max-w-full rounded-sm object-cover px-0",
12397
+ src: url,
12398
+ controls: true
12399
+ }
12400
+ ),
12401
+ caption && /* @__PURE__ */ jsxRuntimeExports.jsx("figcaption", { children: NodeApi.string(caption[0]) })
12402
+ ]
12403
+ }
12404
+ ) }),
12405
+ props.children
12406
+ ] });
12407
+ }
12408
+ const BaseMediaKit = [
12409
+ BaseImagePlugin.withComponent(ImageElementStatic),
12410
+ BaseVideoPlugin.withComponent(VideoElementStatic),
12411
+ BaseAudioPlugin.withComponent(AudioElementStatic),
12412
+ BaseFilePlugin.withComponent(FileElementStatic),
12413
+ BaseCaptionPlugin.configure({
12414
+ options: {
12415
+ query: {
12416
+ allow: [KEYS.img, KEYS.video, KEYS.audio, KEYS.file, KEYS.mediaEmbed]
12417
+ }
12418
+ }
12419
+ }),
12420
+ BaseMediaEmbedPlugin,
12421
+ BasePlaceholderPlugin
12422
+ ];
12423
+ function MentionElementStatic(props) {
12424
+ const { prefix } = props;
12425
+ const element = props.element;
12426
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12427
+ SlateElement,
12428
+ {
12429
+ ...props,
12430
+ className: cn(
12431
+ "inline-block rounded-md bg-muted px-1.5 py-0.5 align-baseline text-sm font-medium",
12432
+ element.children[0][KEYS.bold] === true && "font-bold",
12433
+ element.children[0][KEYS.italic] === true && "italic",
12434
+ element.children[0][KEYS.underline] === true && "underline"
12435
+ ),
12436
+ attributes: {
12437
+ ...props.attributes,
12438
+ "data-slate-value": element.value
12439
+ },
12440
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(React.Fragment, { children: [
12441
+ props.children,
12442
+ prefix,
12443
+ element.value
12444
+ ] })
12445
+ }
12446
+ );
12447
+ }
12448
+ const BaseMentionKit = [
12449
+ BaseMentionPlugin.withComponent(MentionElementStatic)
12450
+ ];
12451
+ function SuggestionLeafStatic(props) {
12452
+ const { editor, leaf } = props;
12453
+ const dataList = editor.getApi(BaseSuggestionPlugin).suggestion.dataList(leaf);
12454
+ const hasRemove = dataList.some((data) => data.type === "remove");
12455
+ const diffOperation = { type: hasRemove ? "delete" : "insert" };
12456
+ const Component = { delete: "del", insert: "ins", update: "span" }[diffOperation.type];
12457
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12458
+ SlateLeaf,
12459
+ {
12460
+ ...props,
12461
+ as: Component,
12462
+ className: cn(
12463
+ "border-b-2 border-b-brand/[.24] bg-brand/[.08] text-brand/80 no-underline transition-colors duration-200",
12464
+ hasRemove && "border-b-gray-300 bg-gray-300/25 text-gray-400 line-through"
12465
+ ),
12466
+ children: props.children
12467
+ }
12468
+ );
12469
+ }
12470
+ const BaseSuggestionKit = [
12471
+ BaseSuggestionPlugin.withComponent(SuggestionLeafStatic)
12472
+ ];
12473
+ function TableElementStatic({
12474
+ children,
12475
+ ...props
12476
+ }) {
12477
+ const { disableMarginLeft } = props.editor.getOptions(BaseTablePlugin);
12478
+ const marginLeft = disableMarginLeft ? 0 : props.element.marginLeft;
12479
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12480
+ SlateElement,
12481
+ {
12482
+ ...props,
12483
+ className: "overflow-x-auto py-5",
12484
+ style: { paddingLeft: marginLeft },
12485
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group/table relative w-fit", children: /* @__PURE__ */ jsxRuntimeExports.jsx("table", { className: "mr-0 ml-px table h-px table-fixed border-collapse", children: /* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { className: "min-w-full", children }) }) })
12486
+ }
12487
+ );
12488
+ }
12489
+ function TableRowElementStatic(props) {
12490
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SlateElement, { ...props, as: "tr", className: "h-full", children: props.children });
12491
+ }
12492
+ function TableCellElementStatic({
12493
+ isHeader,
12494
+ ...props
12495
+ }) {
12496
+ const { editor, element } = props;
12497
+ const { api } = editor.getPlugin(BaseTablePlugin);
12498
+ const { minHeight, width } = api.table.getCellSize({ element });
12499
+ const borders = api.table.getCellBorders({ element });
12500
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12501
+ SlateElement,
12502
+ {
12503
+ ...props,
12504
+ as: isHeader ? "th" : "td",
12505
+ className: cn(
12506
+ "h-full overflow-visible border-none bg-background p-0",
12507
+ element.background ? "bg-(--cellBackground)" : "bg-background",
12508
+ isHeader && "text-left font-normal *:m-0",
12509
+ "before:size-full",
12510
+ "before:absolute before:box-border before:content-[''] before:select-none",
12511
+ borders && cn(
12512
+ borders.bottom?.size && `before:border-b before:border-b-border`,
12513
+ borders.right?.size && `before:border-r before:border-r-border`,
12514
+ borders.left?.size && `before:border-l before:border-l-border`,
12515
+ borders.top?.size && `before:border-t before:border-t-border`
12516
+ )
12517
+ ),
12518
+ style: {
12519
+ "--cellBackground": element.background,
12520
+ maxWidth: width || 240,
12521
+ minWidth: width || 120
12522
+ },
12523
+ attributes: {
12524
+ ...props.attributes,
12525
+ colSpan: api.table.getColSpan(element),
12526
+ rowSpan: api.table.getRowSpan(element)
12527
+ },
12528
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
12529
+ "div",
12530
+ {
12531
+ className: "relative z-20 box-border h-full px-4 py-2",
12532
+ style: { minHeight },
12533
+ children: props.children
12534
+ }
12535
+ )
12536
+ }
12537
+ );
12538
+ }
12539
+ function TableCellHeaderElementStatic(props) {
12540
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TableCellElementStatic, { ...props, isHeader: true });
12541
+ }
12542
+ const BaseTableKit = [
12543
+ BaseTablePlugin.withComponent(TableElementStatic),
12544
+ BaseTableRowPlugin.withComponent(TableRowElementStatic),
12545
+ BaseTableCellPlugin.withComponent(TableCellElementStatic),
12546
+ BaseTableCellHeaderPlugin.withComponent(TableCellHeaderElementStatic)
12547
+ ];
12548
+ const headingItemVariants = cva(
12549
+ "block h-auto w-full cursor-pointer truncate rounded-none px-0.5 py-1.5 text-left font-medium text-muted-foreground underline decoration-[0.5px] underline-offset-4 hover:bg-accent hover:text-muted-foreground",
12550
+ {
12551
+ variants: {
12552
+ depth: {
12553
+ 1: "pl-0.5",
12554
+ 2: "pl-[26px]",
12555
+ 3: "pl-[50px]"
12556
+ }
12557
+ }
12558
+ }
12559
+ );
12560
+ function TocElementStatic(props) {
12561
+ const { editor } = props;
12562
+ const headingList = getHeadingList(editor);
12563
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlateElement, { ...props, className: "mb-1 p-0", children: [
12564
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: headingList.length > 0 ? headingList.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
12565
+ Button,
12566
+ {
12567
+ variant: "ghost",
12568
+ className: headingItemVariants({
12569
+ depth: item.depth
12570
+ }),
12571
+ children: item.title
12572
+ },
12573
+ item.title
12574
+ )) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-500", children: "Create a heading to display the table of contents." }) }),
12575
+ props.children
12576
+ ] });
12577
+ }
12578
+ const headingDepth = {
12579
+ h1: 1,
12580
+ h2: 2,
12581
+ h3: 3,
12582
+ h4: 4,
12583
+ h5: 5,
12584
+ h6: 6
12585
+ };
12586
+ const getHeadingList = (editor) => {
12587
+ if (!editor) return [];
12588
+ const options2 = editor.getOptions(BaseTocPlugin);
12589
+ if (options2.queryHeading) {
12590
+ return options2.queryHeading(editor);
12591
+ }
12592
+ const headingList = [];
12593
+ const values = editor.api.nodes({
12594
+ at: [],
12595
+ match: (n) => isHeading(n)
12596
+ });
12597
+ if (!values) return [];
12598
+ Array.from(values, ([node, path]) => {
12599
+ const { type } = node;
12600
+ const title = NodeApi.string(node);
12601
+ const depth = headingDepth[type];
12602
+ const id = node.id;
12603
+ if (title) {
12604
+ headingList.push({ id, depth, path, title, type });
12605
+ }
12606
+ });
12607
+ return headingList;
12608
+ };
12609
+ const BaseTocKit = [BaseTocPlugin.withComponent(TocElementStatic)];
12610
+ function ToggleElementStatic(props) {
12611
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlateElement, { ...props, className: "pl-6", children: [
12612
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
12613
+ "div",
12614
+ {
12615
+ className: "absolute top-0 -left-0.5 size-6 cursor-pointer items-center justify-center rounded-md p-px text-muted-foreground transition-colors select-none hover:bg-accent [&_svg]:size-4",
12616
+ contentEditable: false,
12617
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rotate-0 transition-transform duration-75" })
12618
+ }
12619
+ ),
12620
+ props.children
12621
+ ] });
12622
+ }
12623
+ const BaseToggleKit = [
12624
+ BaseTogglePlugin.withComponent(ToggleElementStatic)
12625
+ ];
12626
+ const BaseEditorKit = [
12627
+ ...BaseBasicBlocksKit,
12628
+ ...BaseCodeBlockKit,
12629
+ ...BaseTableKit,
12630
+ ...BaseToggleKit,
12631
+ ...BaseTocKit,
12632
+ ...BaseMediaKit,
12633
+ ...BaseCalloutKit,
12634
+ ...BaseColumnKit,
12635
+ ...BaseMathKit,
12636
+ ...BaseDateKit,
12637
+ ...BaseLinkKit,
12638
+ ...BaseMentionKit,
12639
+ ...BaseBasicMarksKit,
12640
+ ...BaseFontKit,
12641
+ ...BaseListKit,
12642
+ ...BaseAlignKit,
12643
+ ...BaseLineHeightKit,
12644
+ ...BaseCommentKit,
12645
+ ...BaseSuggestionKit,
12646
+ ...MarkdownKit
12647
+ ];
11868
12648
  export {
11869
12649
  AlignKit,
11870
12650
  AutoformatKit,
12651
+ BaseEditorKit,
11871
12652
  BasicBlocksKit,
11872
12653
  BasicMarksKit,
11873
12654
  BlockMenuKit,
@@ -11895,12 +12676,24 @@ export {
11895
12676
  MathKit,
11896
12677
  MediaKit,
11897
12678
  MentionKit,
12679
+ Plate2 as Plate,
11898
12680
  PlateEditor,
12681
+ PlateLeaf2 as PlateLeaf,
12682
+ PlateStatic,
12683
+ PlateView2 as PlateView,
11899
12684
  SlashKit,
11900
12685
  SuggestionKit,
11901
12686
  TableKit,
11902
12687
  TocKit,
11903
12688
  ToggleKit,
11904
- normalizeNodeId
12689
+ computeDiff,
12690
+ createSlateEditor,
12691
+ createSlatePlugin,
12692
+ normalizeNodeId,
12693
+ serializeHtml,
12694
+ toPlatePlugin,
12695
+ usePlateEditor2 as usePlateEditor,
12696
+ usePlateViewEditor,
12697
+ withGetFragmentExcludeDiff
11905
12698
  };
11906
12699
  //# sourceMappingURL=index.js.map