@innoviatech/lexical-text-editor 2.0.7 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +390 -288
- package/dist/components/AlignmentSelectionList.js +19 -0
- package/dist/components/ColorPicker.js +30 -0
- package/dist/components/ContentPreview.js +11 -0
- package/dist/components/DisplayControls.d.ts +16 -0
- package/dist/components/DropdownList.js +18 -0
- package/dist/components/FindReplaceModal.d.ts +11 -0
- package/dist/components/FindReplaceModal.js +120 -0
- package/dist/components/FontSelectionList.d.ts +17 -0
- package/dist/components/FontSelectionList.js +17 -0
- package/dist/components/HeadingSelectionList.js +19 -0
- package/dist/components/ImageComponent.js +111 -0
- package/dist/components/InsertDropdownList.js +17 -0
- package/dist/components/LexicalTextEditor.d.ts +10 -0
- package/dist/components/LexicalTextEditor.js +128 -0
- package/dist/components/LinkModal.js +47 -0
- package/dist/components/Separator.js +4 -0
- package/dist/components/SourceView.d.ts +13 -0
- package/dist/components/SourceView.js +50 -0
- package/dist/components/StatusBar.d.ts +14 -0
- package/dist/components/StatusBar.js +30 -0
- package/dist/components/ToolbarOverflowModal.d.ts +15 -0
- package/dist/components/common/Dialog.js +27 -0
- package/dist/components/common/Popover.d.ts +10 -1
- package/dist/components/common/Popover.js +37 -0
- package/dist/components/common/Tooltip.d.ts +7 -0
- package/dist/components/common/Tooltip.js +20 -0
- package/dist/components/ui/button.js +35 -0
- package/dist/components/ui/command.js +33 -0
- package/dist/components/ui/dialog.js +35 -0
- package/dist/components/ui/input.js +6 -0
- package/dist/components/ui/popover.js +16 -0
- package/dist/components/ui/scroll-area.js +12 -0
- package/dist/components/ui/tooltip.js +16 -0
- package/dist/constants/index.d.ts +23 -1
- package/dist/constants/index.js +224 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical-editor.css +1 -1
- package/dist/lib/utils.js +5 -0
- package/dist/nodes/ExtendedTextNode.js +140 -0
- package/dist/nodes/ImageNode.js +149 -0
- package/dist/nodes/VideoNode.js +80 -0
- package/dist/nodes/YoutubeNode.js +64 -0
- package/dist/plugins/CodeBlockPlugin.d.ts +1 -0
- package/dist/plugins/CodeBlockPlugin.js +88 -0
- package/dist/plugins/ColorPlugin.js +47 -0
- package/dist/plugins/CustomOnChangePlugin.js +33 -0
- package/dist/plugins/FontFamilyPlugin.d.ts +1 -0
- package/dist/plugins/FontFamilyPlugin.js +53 -0
- package/dist/plugins/FontSizePlugin.d.ts +1 -0
- package/dist/plugins/FontSizePlugin.js +48 -0
- package/dist/plugins/ImagePlugin.js +91 -0
- package/dist/plugins/ListPlugin.js +44 -0
- package/dist/plugins/TablePlugin.d.ts +1 -0
- package/dist/plugins/TablePlugin.js +92 -0
- package/dist/plugins/ToolbarPlugin.d.ts +13 -1
- package/dist/plugins/ToolbarPlugin.js +381 -0
- package/dist/plugins/VideoPlugin.js +49 -0
- package/dist/plugins/YoutubePlugin.js +30 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/editor_screenshot.png +0 -0
- package/package.json +11 -4
- package/googlebd703883f12c69e4.html +0 -1
- package/rollup.config.js +0 -55
- package/src/components/AlignmentSelectionList.tsx +0 -61
- package/src/components/ColorPicker.tsx +0 -66
- package/src/components/ContentPreview.tsx +0 -51
- package/src/components/DropdownList.tsx +0 -57
- package/src/components/HeadingSelectionList.tsx +0 -61
- package/src/components/ImageComponent.tsx +0 -206
- package/src/components/InsertDropdownList.tsx +0 -36
- package/src/components/LexicalTextEditor.tsx +0 -119
- package/src/components/LinkModal.tsx +0 -127
- package/src/components/Separator.tsx +0 -7
- package/src/components/common/Dialog.tsx +0 -47
- package/src/components/common/Popover.tsx +0 -87
- package/src/components/common/Tooltip.tsx +0 -43
- package/src/components/ui/button.tsx +0 -58
- package/src/components/ui/command.tsx +0 -183
- package/src/components/ui/dialog.tsx +0 -142
- package/src/components/ui/input.tsx +0 -21
- package/src/components/ui/popover.tsx +0 -46
- package/src/components/ui/scroll-area.tsx +0 -56
- package/src/components/ui/tooltip.tsx +0 -59
- package/src/constants/index.tsx +0 -177
- package/src/index.ts +0 -6
- package/src/lib/utils.ts +0 -6
- package/src/nodes/ExtendedTextNode.tsx +0 -174
- package/src/nodes/ImageNode.tsx +0 -232
- package/src/nodes/VideoNode.tsx +0 -134
- package/src/nodes/YoutubeNode.tsx +0 -101
- package/src/plugins/ColorPlugin.tsx +0 -85
- package/src/plugins/CustomOnChangePlugin.tsx +0 -50
- package/src/plugins/ImagePlugin.tsx +0 -189
- package/src/plugins/ListPlugin.tsx +0 -58
- package/src/plugins/ToolbarPlugin.tsx +0 -500
- package/src/plugins/VideoPlugin.tsx +0 -100
- package/src/plugins/YoutubePlugin.tsx +0 -83
- package/src/styles/lexical-editor.css +0 -1053
- package/src/types/global.d.ts +0 -34
- package/src/types/other.d.ts +0 -11
- package/src/types/react-icons.d.ts +0 -11
- package/tailwind.config.js +0 -10
- package/tsconfig.json +0 -32
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
|
+
import { $generateHtmlFromNodes, $generateNodesFromDOM } from "@lexical/html";
|
|
4
|
+
import { $getRoot, $insertNodes } from "lexical";
|
|
5
|
+
import { useEffect, useRef, useState } from "react";
|
|
6
|
+
import { MdCheck } from "react-icons/md";
|
|
7
|
+
import TooltipX from "./common/Tooltip";
|
|
8
|
+
/**
|
|
9
|
+
* Raw HTML editing mode. The ContentEditable stays mounted (hidden) so the
|
|
10
|
+
* editor state is preserved. Edited HTML is imported into the editor state
|
|
11
|
+
* only on demand (Update / Done / toolbar toggle) — never per keystroke, so
|
|
12
|
+
* undo history is not flooded and partially typed markup is not parsed.
|
|
13
|
+
*/
|
|
14
|
+
export default function SourceView({ applyRef, onExit }) {
|
|
15
|
+
const [editor] = useLexicalComposerContext();
|
|
16
|
+
const [html, setHtml] = useState(() => editor.getEditorState().read(() => $generateHtmlFromNodes(editor)));
|
|
17
|
+
const lastImportedRef = useRef(html);
|
|
18
|
+
const importHtml = (value) => {
|
|
19
|
+
if (value === lastImportedRef.current)
|
|
20
|
+
return;
|
|
21
|
+
editor.update(() => {
|
|
22
|
+
const root = $getRoot();
|
|
23
|
+
root.clear();
|
|
24
|
+
// Reset selection inside the emptied root so $insertNodes cannot
|
|
25
|
+
// resolve a stale selection pointing at removed nodes.
|
|
26
|
+
root.selectEnd();
|
|
27
|
+
if (value) {
|
|
28
|
+
const dom = new DOMParser().parseFromString(value, "text/html");
|
|
29
|
+
const nodes = $generateNodesFromDOM(editor, dom);
|
|
30
|
+
if (nodes.length > 0) {
|
|
31
|
+
$insertNodes(nodes);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
lastImportedRef.current = value;
|
|
36
|
+
};
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
applyRef.current = () => {
|
|
39
|
+
importHtml(html);
|
|
40
|
+
onExit();
|
|
41
|
+
};
|
|
42
|
+
return () => {
|
|
43
|
+
applyRef.current = null;
|
|
44
|
+
};
|
|
45
|
+
}, [applyRef, html, onExit, editor]);
|
|
46
|
+
return (_jsxs("div", { className: "lexical-source-view", children: [_jsx("textarea", { className: "lexical-source-textarea", value: html, onChange: (e) => setHtml(e.target.value), "aria-label": "HTML source", spellCheck: false }), _jsxs("div", { className: "lexical-source-actions", children: [_jsx(TooltipX, { content: "Apply HTML to the editor", direction: "top", children: _jsxs("button", { type: "button", className: "lexical-btn heading-trigger toolbar", onClick: () => importHtml(html), children: [_jsx(MdCheck, { size: 16 }), _jsx("span", { className: "label", children: "Update" })] }) }), _jsx("button", { type: "button", className: "lexical-btn heading-trigger toolbar", onClick: () => {
|
|
47
|
+
importHtml(html);
|
|
48
|
+
onExit();
|
|
49
|
+
}, children: "Done" })] })] }));
|
|
50
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
interface StatusBarProps {
|
|
3
|
+
showWordCount?: boolean;
|
|
4
|
+
showCharCount?: boolean;
|
|
5
|
+
/** Optional right-aligned slot (e.g. display switchers) */
|
|
6
|
+
rightSlot?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Live word / character count computed from the editor state text.
|
|
10
|
+
* Decorator nodes (images, video embeds) contribute no text, matching
|
|
11
|
+
* conventional word-count behavior.
|
|
12
|
+
*/
|
|
13
|
+
export default function StatusBar({ showWordCount, showCharCount, rightSlot }: StatusBarProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
|
+
import { $getRoot } from "lexical";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
/**
|
|
6
|
+
* Live word / character count computed from the editor state text.
|
|
7
|
+
* Decorator nodes (images, video embeds) contribute no text, matching
|
|
8
|
+
* conventional word-count behavior.
|
|
9
|
+
*/
|
|
10
|
+
export default function StatusBar({ showWordCount = true, showCharCount = true }) {
|
|
11
|
+
const [editor] = useLexicalComposerContext();
|
|
12
|
+
const [counts, setCounts] = useState({ words: 0, chars: 0 });
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const compute = (editorState) => {
|
|
15
|
+
editorState.read(() => {
|
|
16
|
+
const text = $getRoot().getTextContent();
|
|
17
|
+
const trimmed = text.trim();
|
|
18
|
+
setCounts({
|
|
19
|
+
words: trimmed ? trimmed.split(/\s+/).length : 0,
|
|
20
|
+
chars: text.length,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
compute(editor.getEditorState());
|
|
25
|
+
return editor.registerUpdateListener(({ editorState }) => {
|
|
26
|
+
compute(editorState);
|
|
27
|
+
});
|
|
28
|
+
}, [editor]);
|
|
29
|
+
return (_jsxs("div", { className: "lexical-status-bar", children: [showWordCount && _jsxs("span", { children: [counts.words, " words"] }), showCharCount && _jsxs("span", { children: [counts.chars, " characters"] })] }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode, type RefObject } from "react";
|
|
2
|
+
interface ToolbarOverflowModalProps {
|
|
3
|
+
/** Ref of the ellipsis toggle — clicks on it are ignored so the button's own onClick handles toggling. */
|
|
4
|
+
anchorRef: RefObject<HTMLButtonElement | null>;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Dropdown panel hosting the toolbar tools that no longer fit inline.
|
|
10
|
+
* Anchored below the toolbar's right edge (under the "..." button), no
|
|
11
|
+
* overlay — closes on Escape or outside click. Tools stay mounted here (not
|
|
12
|
+
* duplicated inline) so plugin listeners are never registered twice.
|
|
13
|
+
*/
|
|
14
|
+
export default function ToolbarOverflowModal({ anchorRef, onClose, children }: ToolbarOverflowModalProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
export default function RawDialog({ open, onClose, forPreview = false, children }) {
|
|
4
|
+
const dialogRef = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (!open)
|
|
7
|
+
return;
|
|
8
|
+
const handleOutsideClick = (e) => {
|
|
9
|
+
if (dialogRef.current && !dialogRef.current.contains(e.target)) {
|
|
10
|
+
onClose();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const handleEsc = (e) => {
|
|
14
|
+
if (e.key === "Escape")
|
|
15
|
+
onClose();
|
|
16
|
+
};
|
|
17
|
+
document.addEventListener("mousedown", handleOutsideClick);
|
|
18
|
+
document.addEventListener("keydown", handleEsc);
|
|
19
|
+
return () => {
|
|
20
|
+
document.removeEventListener("mousedown", handleOutsideClick);
|
|
21
|
+
document.removeEventListener("keydown", handleEsc);
|
|
22
|
+
};
|
|
23
|
+
}, [open, onClose]);
|
|
24
|
+
if (!open)
|
|
25
|
+
return null;
|
|
26
|
+
return (_jsx("div", { className: "lexical-text-editor-dialog lte-dialog-overlay", children: _jsxs("div", { ref: dialogRef, className: `lte-dialog ${forPreview ? 'preview' : ''}`, children: [_jsx("button", { type: "button", className: "lte-dialog-close", onClick: onClose, children: "\u00D7" }), children] }) }));
|
|
27
|
+
}
|
|
@@ -16,6 +16,15 @@ interface PopoverContentProps {
|
|
|
16
16
|
onClose: () => void;
|
|
17
17
|
children: React.ReactNode;
|
|
18
18
|
contentRef: React.RefObject<HTMLDivElement | null>;
|
|
19
|
+
triggerRef?: React.RefObject<HTMLDivElement | null>;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Renders the popover panel portaled to <body> with fixed positioning,
|
|
23
|
+
* because annotating inline (absolute inside the trigger's wrapper) makes it
|
|
24
|
+
* vanish: the toolbar row is a scroll container (`overflow-x auto /
|
|
25
|
+
* overflow-y hidden`) in every single-row variant, and clipping of that
|
|
26
|
+
* kind cannot be escaped with pure CSS. The outside-mousedown close logic
|
|
27
|
+
* in `Popover` is document-level, so it keeps working with the portal.
|
|
28
|
+
*/
|
|
29
|
+
export declare function PopoverContent({ open, align, children, contentRef, triggerRef, }: PopoverContentProps): React.ReactPortal;
|
|
21
30
|
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useRef, cloneElement } from "react";
|
|
3
|
+
export function Popover({ open, onOpenChange, children }) {
|
|
4
|
+
const triggerRef = useRef(null);
|
|
5
|
+
const contentRef = useRef(null);
|
|
6
|
+
// Close on outside click
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
function handleClick(e) {
|
|
9
|
+
if (!triggerRef.current?.contains(e.target) &&
|
|
10
|
+
!contentRef.current?.contains(e.target)) {
|
|
11
|
+
onOpenChange(false);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (open)
|
|
15
|
+
document.addEventListener("mousedown", handleClick);
|
|
16
|
+
return () => document.removeEventListener("mousedown", handleClick);
|
|
17
|
+
}, [open, onOpenChange]);
|
|
18
|
+
return (_jsx("div", { className: "popover-root", children: React.Children.map(children, (child) => {
|
|
19
|
+
if (!child || typeof child !== "object")
|
|
20
|
+
return child;
|
|
21
|
+
if (child.type === PopoverTrigger) {
|
|
22
|
+
return cloneElement(child, { triggerRef });
|
|
23
|
+
}
|
|
24
|
+
if (child.type === PopoverContent) {
|
|
25
|
+
return cloneElement(child, { contentRef });
|
|
26
|
+
}
|
|
27
|
+
return child;
|
|
28
|
+
}) }));
|
|
29
|
+
}
|
|
30
|
+
export function PopoverTrigger({ children, triggerRef }) {
|
|
31
|
+
return (_jsx("div", { className: "popover-trigger", ref: triggerRef, children: children }));
|
|
32
|
+
}
|
|
33
|
+
export function PopoverContent({ open, align = "start", children, contentRef, }) {
|
|
34
|
+
if (!open)
|
|
35
|
+
return null;
|
|
36
|
+
return (_jsx("div", { ref: contentRef, className: `popover-content align-${align}`, children: children }));
|
|
37
|
+
}
|
|
@@ -6,5 +6,12 @@ interface TooltipProps {
|
|
|
6
6
|
delay?: number;
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Hover tooltip. The tip is portaled to <body> and positioned `fixed`,
|
|
11
|
+
* because annotating inline (absolute inside the hovered wrapper) makes it
|
|
12
|
+
* vanish: the toolbar row (and other scroll containers) clip with
|
|
13
|
+
* `overflow: hidden/auto`, and a CSS-only workaround is impossible
|
|
14
|
+
* (visible+auto clipping overflow can't be combined).
|
|
15
|
+
*/
|
|
9
16
|
declare const TooltipX: React.FC<TooltipProps>;
|
|
10
17
|
export default TooltipX;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef } from "react";
|
|
3
|
+
import '../../styles/lexical-editor.css';
|
|
4
|
+
const TooltipX = ({ content, direction = "top", delay = 400, children }) => {
|
|
5
|
+
const [active, setActive] = useState(false);
|
|
6
|
+
const timeout = useRef(null); // <-- browser setTimeout returns number
|
|
7
|
+
const showTip = () => {
|
|
8
|
+
timeout.current = window.setTimeout(() => {
|
|
9
|
+
setActive(true);
|
|
10
|
+
}, delay);
|
|
11
|
+
};
|
|
12
|
+
const hideTip = () => {
|
|
13
|
+
if (timeout.current) {
|
|
14
|
+
clearTimeout(timeout.current);
|
|
15
|
+
}
|
|
16
|
+
setActive(false);
|
|
17
|
+
};
|
|
18
|
+
return (_jsxs("div", { className: "Lexical-Tooltip-Wrapper", onMouseEnter: showTip, onMouseLeave: hideTip, children: [children, active && (_jsx("div", { className: `Lexical-Tooltip-Tip ${direction}`, children: content }))] }));
|
|
19
|
+
};
|
|
20
|
+
export default TooltipX;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
const buttonVariants = cva("cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
10
|
+
toolbar: "bg-transparent hover:bg-slate-100/80 text-gray-600",
|
|
11
|
+
toolbarActive: "bg-slate-100 text-gray-900 ",
|
|
12
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90",
|
|
13
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
14
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
15
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
16
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-2",
|
|
20
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
21
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
22
|
+
icon: "size-9",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: "default",
|
|
27
|
+
size: "default",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
31
|
+
const Comp = asChild ? Slot : "button";
|
|
32
|
+
return (_jsx(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
|
|
33
|
+
});
|
|
34
|
+
Button.displayName = "Button";
|
|
35
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
3
|
+
import { SearchIcon } from "lucide-react";
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "./dialog";
|
|
6
|
+
function Command({ className, ...props }) {
|
|
7
|
+
return (_jsx(CommandPrimitive, { "data-slot": "command", className: cn("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md", className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
function CommandDialog({ title = "Command Palette", description = "Search for a command to run...", children, className, showCloseButton = true, ...props }) {
|
|
10
|
+
return (_jsxs(Dialog, { ...props, children: [_jsxs(DialogHeader, { className: "sr-only", children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: description })] }), _jsx(DialogContent, { className: cn("overflow-hidden p-0", className), showCloseButton: showCloseButton, children: _jsx(Command, { className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children: children }) })] }));
|
|
11
|
+
}
|
|
12
|
+
function CommandInput({ className, ...props }) {
|
|
13
|
+
return (_jsxs("div", { "data-slot": "command-input-wrapper", className: "flex h-9 items-center gap-2 border-b px-3", children: [_jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }), _jsx(CommandPrimitive.Input, { "data-slot": "command-input", className: cn("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className), ...props })] }));
|
|
14
|
+
}
|
|
15
|
+
function CommandList({ className, ...props }) {
|
|
16
|
+
return (_jsx(CommandPrimitive.List, { "data-slot": "command-list", className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className), ...props }));
|
|
17
|
+
}
|
|
18
|
+
function CommandEmpty({ ...props }) {
|
|
19
|
+
return (_jsx(CommandPrimitive.Empty, { "data-slot": "command-empty", className: "py-6 text-center text-sm", ...props }));
|
|
20
|
+
}
|
|
21
|
+
function CommandGroup({ className, ...props }) {
|
|
22
|
+
return (_jsx(CommandPrimitive.Group, { "data-slot": "command-group", className: cn("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium", className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
function CommandSeparator({ className, ...props }) {
|
|
25
|
+
return (_jsx(CommandPrimitive.Separator, { "data-slot": "command-separator", className: cn("bg-border -mx-1 h-px", className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
function CommandItem({ className, ...props }) {
|
|
28
|
+
return (_jsx(CommandPrimitive.Item, { "data-slot": "command-item", className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function CommandShortcut({ className, ...props }) {
|
|
31
|
+
return (_jsx("span", { "data-slot": "command-shortcut", className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
import { XIcon } from "lucide-react";
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
function Dialog({ ...props }) {
|
|
6
|
+
return _jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
7
|
+
}
|
|
8
|
+
function DialogTrigger({ ...props }) {
|
|
9
|
+
return _jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
10
|
+
}
|
|
11
|
+
function DialogPortal({ ...props }) {
|
|
12
|
+
return _jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
13
|
+
}
|
|
14
|
+
function DialogClose({ ...props }) {
|
|
15
|
+
return _jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
16
|
+
}
|
|
17
|
+
function DialogOverlay({ className, ...props }) {
|
|
18
|
+
return (_jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className), ...props }));
|
|
19
|
+
}
|
|
20
|
+
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
21
|
+
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", "aria-describedby": "", className: cn("bg-[#ffffff] 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", className), ...props, children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
22
|
+
}
|
|
23
|
+
function DialogHeader({ className, ...props }) {
|
|
24
|
+
return (_jsx("div", { "data-slot": "dialog-header", className: cn("flex flex-col gap-2 text-center sm:text-left", className), ...props }));
|
|
25
|
+
}
|
|
26
|
+
function DialogFooter({ className, ...props }) {
|
|
27
|
+
return (_jsx("div", { "data-slot": "dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props }));
|
|
28
|
+
}
|
|
29
|
+
function DialogTitle({ className, ...props }) {
|
|
30
|
+
return (_jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn("text-lg leading-none font-semibold", className), ...props }));
|
|
31
|
+
}
|
|
32
|
+
function DialogDescription({ className, ...props }) {
|
|
33
|
+
return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn("text-muted-foreground text-sm", className), ...props }));
|
|
34
|
+
}
|
|
35
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
function Input({ className, type, ...props }) {
|
|
4
|
+
return (_jsx("input", { type: type, "data-slot": "input", className: cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className), ...props }));
|
|
5
|
+
}
|
|
6
|
+
export { Input };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
function Popover({ ...props }) {
|
|
5
|
+
return _jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
6
|
+
}
|
|
7
|
+
function PopoverTrigger({ ...props }) {
|
|
8
|
+
return _jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
9
|
+
}
|
|
10
|
+
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
11
|
+
return (_jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: cn("bg-[#ffffff] text-popover-foreground 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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", className), ...props }) }));
|
|
12
|
+
}
|
|
13
|
+
function PopoverAnchor({ ...props }) {
|
|
14
|
+
return _jsx(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
|
|
15
|
+
}
|
|
16
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
function ScrollArea({ className, children, ...props }) {
|
|
5
|
+
return (_jsxs(ScrollAreaPrimitive.Root, { "data-slot": "scroll-area", className: cn("relative", className), ...props, children: [_jsx(ScrollAreaPrimitive.Viewport, { "data-slot": "scroll-area-viewport", className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1", children: children }), _jsx(ScrollBar, {}), _jsx(ScrollAreaPrimitive.Corner, {})] }));
|
|
6
|
+
}
|
|
7
|
+
function ScrollBar({ className, orientation = "vertical", ...props }) {
|
|
8
|
+
return (_jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, { "data-slot": "scroll-area-scrollbar", orientation: orientation, className: cn("flex touch-none p-px transition-colors select-none", orientation === "vertical" &&
|
|
9
|
+
"h-full w-2.5 border-l border-l-transparent", orientation === "horizontal" &&
|
|
10
|
+
"h-2.5 flex-col border-t border-t-transparent", className), ...props, children: _jsx(ScrollAreaPrimitive.ScrollAreaThumb, { "data-slot": "scroll-area-thumb", className: "bg-border relative flex-1 rounded-full" }) }));
|
|
11
|
+
}
|
|
12
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
5
|
+
return (_jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delayDuration: delayDuration, ...props }));
|
|
6
|
+
}
|
|
7
|
+
function Tooltip({ ...props }) {
|
|
8
|
+
return (_jsx(TooltipProvider, { children: _jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) }));
|
|
9
|
+
}
|
|
10
|
+
function TooltipTrigger({ ...props }) {
|
|
11
|
+
return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
12
|
+
}
|
|
13
|
+
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
14
|
+
return (_jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance", className), ...props, children: [children, _jsx(TooltipPrimitive.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })] }) }));
|
|
15
|
+
}
|
|
16
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -18,7 +18,16 @@ export declare enum RichTextAction {
|
|
|
18
18
|
JustifyAlign = "justifyAlign",
|
|
19
19
|
Divider = "divider",
|
|
20
20
|
Undo = "undo",
|
|
21
|
-
Redo = "redo"
|
|
21
|
+
Redo = "redo",
|
|
22
|
+
ClearFormatting = "clearFormatting",
|
|
23
|
+
CodeBlock = "codeBlock",
|
|
24
|
+
HorizontalRule = "horizontalRule",
|
|
25
|
+
Indent = "indent",
|
|
26
|
+
Outdent = "outdent",
|
|
27
|
+
Table = "table",
|
|
28
|
+
FindReplace = "findReplace",
|
|
29
|
+
SourceView = "sourceView",
|
|
30
|
+
Fullscreen = "fullscreen"
|
|
22
31
|
}
|
|
23
32
|
export declare enum HeadingAction {
|
|
24
33
|
Normal = "normal",
|
|
@@ -63,9 +72,22 @@ export declare const RICH_ALIGNMENT_OPTIONS: {
|
|
|
63
72
|
icon: import("react/jsx-runtime").JSX.Element;
|
|
64
73
|
label: string;
|
|
65
74
|
}[];
|
|
75
|
+
export declare const RICH_BLOCK_OPTIONS: ({
|
|
76
|
+
id: RichTextAction;
|
|
77
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
78
|
+
label: string;
|
|
79
|
+
} | {
|
|
80
|
+
id: RichTextAction;
|
|
81
|
+
icon?: undefined;
|
|
82
|
+
label?: undefined;
|
|
83
|
+
})[];
|
|
66
84
|
export declare const LOW_PRIORIRTY = 1;
|
|
67
85
|
export declare const HEADINGS: {
|
|
68
86
|
id: string;
|
|
69
87
|
label: string;
|
|
70
88
|
icon: import("react/jsx-runtime").JSX.Element;
|
|
71
89
|
}[];
|
|
90
|
+
export declare const CODE_BLOCK_LANGUAGES: {
|
|
91
|
+
id: string;
|
|
92
|
+
label: string;
|
|
93
|
+
}[];
|