@wecode-team/we0-cms 1.1.33 → 1.1.34
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/components/tiptap-extension/node-background-extension.d.ts +23 -0
- package/dist/components/tiptap-icons/align-center-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-justify-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-left-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-right-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/arrow-left-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/ban-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/blockquote-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/bold-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/check-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/chevron-down-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/close-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/code-block-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/code2-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/corner-down-left-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/external-link-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-five-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-four-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-one-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-six-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-three-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-two-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/highlighter-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/image-plus-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/italic-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/link-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/list-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/list-ordered-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/list-todo-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/moon-star-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/redo2-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/strike-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/subscript-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/sun-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/superscript-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/trash-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/underline-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/undo2-icon.d.ts +3 -0
- package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.d.ts +2 -0
- package/dist/components/tiptap-node/image-upload-node/image-upload-node-extension.d.ts +58 -0
- package/dist/components/tiptap-node/image-upload-node/image-upload-node.d.ts +69 -0
- package/dist/components/tiptap-node/image-upload-node/index.d.ts +1 -0
- package/dist/components/tiptap-templates/simple/simple-editor.d.ts +19 -0
- package/dist/components/tiptap-templates/simple/theme-toggle.d.ts +1 -0
- package/dist/components/tiptap-ui/blockquote-button/blockquote-button.d.ts +22 -0
- package/dist/components/tiptap-ui/blockquote-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/blockquote-button/use-blockquote.d.ts +80 -0
- package/dist/components/tiptap-ui/code-block-button/code-block-button.d.ts +22 -0
- package/dist/components/tiptap-ui/code-block-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/code-block-button/use-code-block.d.ts +87 -0
- package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.d.ts +46 -0
- package/dist/components/tiptap-ui/color-highlight-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.d.ts +93 -0
- package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.d.ts +35 -0
- package/dist/components/tiptap-ui/color-highlight-popover/index.d.ts +1 -0
- package/dist/components/tiptap-ui/heading-button/heading-button.d.ts +23 -0
- package/dist/components/tiptap-ui/heading-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/heading-button/use-heading.d.ts +108 -0
- package/dist/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.d.ts +19 -0
- package/dist/components/tiptap-ui/heading-dropdown-menu/index.d.ts +2 -0
- package/dist/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +73 -0
- package/dist/components/tiptap-ui/image-upload-button/image-upload-button.d.ts +29 -0
- package/dist/components/tiptap-ui/image-upload-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/image-upload-button/use-image-upload.d.ts +84 -0
- package/dist/components/tiptap-ui/link-popover/index.d.ts +2 -0
- package/dist/components/tiptap-ui/link-popover/link-popover.d.ts +58 -0
- package/dist/components/tiptap-ui/link-popover/use-link-popover.d.ts +117 -0
- package/dist/components/tiptap-ui/list-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/list-button/list-button.d.ts +23 -0
- package/dist/components/tiptap-ui/list-button/use-list.d.ts +97 -0
- package/dist/components/tiptap-ui/list-dropdown-menu/index.d.ts +1 -0
- package/dist/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.d.ts +28 -0
- package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.d.ts +90 -0
- package/dist/components/tiptap-ui/mark-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/mark-button/mark-button.d.ts +23 -0
- package/dist/components/tiptap-ui/mark-button/use-mark.d.ts +104 -0
- package/dist/components/tiptap-ui/text-align-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/text-align-button/text-align-button.d.ts +30 -0
- package/dist/components/tiptap-ui/text-align-button/use-text-align.d.ts +102 -0
- package/dist/components/tiptap-ui/undo-redo-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +23 -0
- package/dist/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +90 -0
- package/dist/components/tiptap-ui-primitive/badge/badge.d.ts +11 -0
- package/dist/components/tiptap-ui-primitive/badge/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/button/button.d.ts +16 -0
- package/dist/components/tiptap-ui-primitive/button/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/button-group/button-group.d.ts +11 -0
- package/dist/components/tiptap-ui-primitive/button-group/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/card/card.d.ts +10 -0
- package/dist/components/tiptap-ui-primitive/card/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +29 -0
- package/dist/components/tiptap-ui-primitive/dropdown-menu/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/input/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/input/input.d.ts +3 -0
- package/dist/components/tiptap-ui-primitive/popover/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/popover/popover.d.ts +6 -0
- package/dist/components/tiptap-ui-primitive/separator/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/separator/separator.d.ts +6 -0
- package/dist/components/tiptap-ui-primitive/spacer/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/spacer/spacer.d.ts +5 -0
- package/dist/components/tiptap-ui-primitive/toolbar/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/toolbar/toolbar.d.ts +9 -0
- package/dist/components/tiptap-ui-primitive/tooltip/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +29 -0
- package/dist/hooks/use-composed-ref.d.ts +3 -0
- package/dist/hooks/use-cursor-visibility.d.ts +20 -0
- package/dist/hooks/use-element-rect.d.ts +35 -0
- package/dist/hooks/use-is-breakpoint.d.ts +9 -0
- package/dist/hooks/use-menu-navigation.d.ts +52 -0
- package/dist/hooks/use-scrolling.d.ts +8 -0
- package/dist/hooks/use-throttled-callback.d.ts +18 -0
- package/dist/hooks/use-tiptap-editor.d.ts +6 -0
- package/dist/hooks/use-unmount.d.ts +7 -0
- package/dist/hooks/use-window-size.d.ts +35 -0
- package/dist/index.css +2 -2
- package/dist/index.esm.js +11 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/tiptap-utils.d.ts +173 -0
- package/package.json +1 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type Editor } from "@tiptap/react";
|
|
2
|
+
export type UndoRedoAction = "undo" | "redo";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the history functionality
|
|
5
|
+
*/
|
|
6
|
+
export interface UseUndoRedoConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The Tiptap editor instance.
|
|
9
|
+
*/
|
|
10
|
+
editor?: Editor | null;
|
|
11
|
+
/**
|
|
12
|
+
* The history action to perform (undo or redo).
|
|
13
|
+
*/
|
|
14
|
+
action: UndoRedoAction;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the button should hide when action is not available.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
hideWhenUnavailable?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Callback function called after a successful action execution.
|
|
22
|
+
*/
|
|
23
|
+
onExecuted?: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const UNDO_REDO_SHORTCUT_KEYS: Record<UndoRedoAction, string>;
|
|
26
|
+
export declare const historyActionLabels: Record<UndoRedoAction, string>;
|
|
27
|
+
export declare const historyIcons: {
|
|
28
|
+
undo: import("react").MemoExoticComponent<({ className, ...props }: Omit<import("react").SVGProps<SVGSVGElement>, "ref">) => import("react").JSX.Element>;
|
|
29
|
+
redo: import("react").MemoExoticComponent<({ className, ...props }: Omit<import("react").SVGProps<SVGSVGElement>, "ref">) => import("react").JSX.Element>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a history action can be executed
|
|
33
|
+
*/
|
|
34
|
+
export declare function canExecuteUndoRedoAction(editor: Editor | null, action: UndoRedoAction): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Executes a history action on the editor
|
|
37
|
+
*/
|
|
38
|
+
export declare function executeUndoRedoAction(editor: Editor | null, action: UndoRedoAction): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Determines if the history button should be shown
|
|
41
|
+
*/
|
|
42
|
+
export declare function shouldShowButton(props: {
|
|
43
|
+
editor: Editor | null;
|
|
44
|
+
hideWhenUnavailable: boolean;
|
|
45
|
+
action: UndoRedoAction;
|
|
46
|
+
}): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Custom hook that provides history functionality for Tiptap editor
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // Simple usage
|
|
53
|
+
* function MySimpleUndoButton() {
|
|
54
|
+
* const { isVisible, handleAction } = useHistory({ action: "undo" })
|
|
55
|
+
*
|
|
56
|
+
* if (!isVisible) return null
|
|
57
|
+
*
|
|
58
|
+
* return <button onClick={handleAction}>Undo</button>
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* // Advanced usage with configuration
|
|
62
|
+
* function MyAdvancedRedoButton() {
|
|
63
|
+
* const { isVisible, handleAction, label } = useHistory({
|
|
64
|
+
* editor: myEditor,
|
|
65
|
+
* action: "redo",
|
|
66
|
+
* hideWhenUnavailable: true,
|
|
67
|
+
* onExecuted: () => console.log('Action executed!')
|
|
68
|
+
* })
|
|
69
|
+
*
|
|
70
|
+
* if (!isVisible) return null
|
|
71
|
+
*
|
|
72
|
+
* return (
|
|
73
|
+
* <MyButton
|
|
74
|
+
* onClick={handleAction}
|
|
75
|
+
* aria-label={label}
|
|
76
|
+
* >
|
|
77
|
+
* Redo
|
|
78
|
+
* </MyButton>
|
|
79
|
+
* )
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function useUndoRedo(config: UseUndoRedoConfig): {
|
|
84
|
+
isVisible: boolean;
|
|
85
|
+
handleAction: () => boolean;
|
|
86
|
+
canExecute: boolean;
|
|
87
|
+
label: string;
|
|
88
|
+
shortcutKeys: string;
|
|
89
|
+
Icon: import("react").MemoExoticComponent<({ className, ...props }: Omit<import("react").SVGProps<SVGSVGElement>, "ref">) => import("react").JSX.Element> | import("react").MemoExoticComponent<({ className, ...props }: Omit<import("react").SVGProps<SVGSVGElement>, "ref">) => import("react").JSX.Element>;
|
|
90
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "@/components/tiptap-ui-primitive/badge/badge-colors.scss";
|
|
2
|
+
import "@/components/tiptap-ui-primitive/badge/badge-group.scss";
|
|
3
|
+
import "@/components/tiptap-ui-primitive/badge/badge.scss";
|
|
4
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
variant?: "ghost" | "white" | "gray" | "green" | "yellow" | "default";
|
|
6
|
+
size?: "default" | "small";
|
|
7
|
+
appearance?: "default" | "subdued" | "emphasized";
|
|
8
|
+
trimText?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export default Badge;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./badge";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "@/components/tiptap-ui-primitive/button/button-colors.scss";
|
|
2
|
+
import "@/components/tiptap-ui-primitive/button/button.scss";
|
|
3
|
+
export type ButtonVariant = "ghost" | "primary";
|
|
4
|
+
export type ButtonSize = "small" | "default" | "large";
|
|
5
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
showTooltip?: boolean;
|
|
7
|
+
tooltip?: React.ReactNode;
|
|
8
|
+
shortcutKeys?: string;
|
|
9
|
+
variant?: ButtonVariant;
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
}
|
|
12
|
+
export declare const ShortcutDisplay: React.FC<{
|
|
13
|
+
shortcuts: string[];
|
|
14
|
+
}>;
|
|
15
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
export default Button;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./button";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Separator } from "@/components/tiptap-ui-primitive/separator";
|
|
4
|
+
import "./button-group.scss";
|
|
5
|
+
declare const buttonGroupVariants: (props?: ({
|
|
6
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): import("react").JSX.Element;
|
|
9
|
+
declare function ButtonGroupText({ className, render, ...props }: useRender.ComponentProps<"div">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
10
|
+
declare function ButtonGroupSeparator({ className, orientation, ...props }: React.ComponentProps<typeof Separator>): import("react").JSX.Element;
|
|
11
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./button-group";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "@/components/tiptap-ui-primitive/card/card.scss";
|
|
2
|
+
declare const Card: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const CardHeader: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const CardBody: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const CardItemGroup: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
orientation?: "horizontal" | "vertical";
|
|
7
|
+
}, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const CardGroupLabel: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const CardFooter: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export { Card, CardHeader, CardFooter, CardBody, CardItemGroup, CardGroupLabel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./card";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2
|
+
import "@/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.scss";
|
|
3
|
+
declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): import("react").JSX.Element;
|
|
4
|
+
declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): import("react").JSX.Element;
|
|
5
|
+
declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): import("react").JSX.Element;
|
|
6
|
+
declare function DropdownMenuContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): import("react").JSX.Element;
|
|
7
|
+
declare function DropdownMenuGroup({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): import("react").JSX.Element;
|
|
8
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
9
|
+
inset?: boolean;
|
|
10
|
+
variant?: "default" | "destructive";
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & {
|
|
13
|
+
inset?: boolean;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): import("react").JSX.Element;
|
|
16
|
+
declare function DropdownMenuRadioItem({ className, children, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {
|
|
17
|
+
inset?: boolean;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
20
|
+
inset?: boolean;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): import("react").JSX.Element;
|
|
23
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): import("react").JSX.Element;
|
|
24
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): import("react").JSX.Element;
|
|
25
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
26
|
+
inset?: boolean;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react").JSX.Element;
|
|
29
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dropdown-menu";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./input";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./popover";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
2
|
+
import "@/components/tiptap-ui-primitive/popover/popover.scss";
|
|
3
|
+
declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): import("react").JSX.Element;
|
|
4
|
+
declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): import("react").JSX.Element;
|
|
5
|
+
declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): import("react").JSX.Element;
|
|
6
|
+
export { Popover, PopoverTrigger, PopoverContent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./separator";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "@/components/tiptap-ui-primitive/separator/separator.scss";
|
|
2
|
+
export type Orientation = "horizontal" | "vertical";
|
|
3
|
+
export declare function Separator({ decorative, orientation, className, ...props }: React.ComponentProps<"div"> & {
|
|
4
|
+
orientation?: Orientation;
|
|
5
|
+
decorative?: boolean;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./spacer";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./toolbar";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "@/components/tiptap-ui-primitive/toolbar/toolbar.scss";
|
|
2
|
+
type BaseProps = React.HTMLAttributes<HTMLDivElement>;
|
|
3
|
+
interface ToolbarProps extends BaseProps {
|
|
4
|
+
variant?: "floating" | "fixed";
|
|
5
|
+
}
|
|
6
|
+
export declare const Toolbar: import("react").ForwardRefExoticComponent<ToolbarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export declare const ToolbarGroup: import("react").ForwardRefExoticComponent<BaseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export declare const ToolbarSeparator: import("react").ForwardRefExoticComponent<BaseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tooltip";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FloatingPortal, type Placement } from "@floating-ui/react";
|
|
2
|
+
import "@/components/tiptap-ui-primitive/tooltip/tooltip.scss";
|
|
3
|
+
interface TooltipProviderProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
initialOpen?: boolean;
|
|
6
|
+
placement?: Placement;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
delay?: number;
|
|
10
|
+
closeDelay?: number;
|
|
11
|
+
timeout?: number;
|
|
12
|
+
useDelayGroup?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface TooltipTriggerProps extends Omit<React.HTMLProps<HTMLElement>, "ref"> {
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
interface TooltipContentProps extends Omit<React.HTMLProps<HTMLDivElement>, "ref"> {
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
portal?: boolean;
|
|
21
|
+
portalProps?: Omit<React.ComponentProps<typeof FloatingPortal>, "children">;
|
|
22
|
+
}
|
|
23
|
+
export declare function Tooltip({ children, ...props }: TooltipProviderProps): import("react").JSX.Element;
|
|
24
|
+
export declare namespace Tooltip {
|
|
25
|
+
var displayName: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const TooltipTrigger: import("react").ForwardRefExoticComponent<TooltipTriggerProps & import("react").RefAttributes<HTMLElement>>;
|
|
28
|
+
export declare const TooltipContent: import("react").ForwardRefExoticComponent<TooltipContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
type UserRef<T> = ((instance: T | null) => void) | React.RefObject<T | null> | null | undefined;
|
|
2
|
+
export declare const useComposedRef: <T extends HTMLElement>(libRef: React.RefObject<T | null>, userRef: UserRef<T>) => (instance: T | null) => void;
|
|
3
|
+
export default useComposedRef;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/react";
|
|
2
|
+
export interface CursorVisibilityOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The Tiptap editor instance
|
|
5
|
+
*/
|
|
6
|
+
editor?: Editor | null;
|
|
7
|
+
/**
|
|
8
|
+
* Reference to the toolbar element that may obscure the cursor
|
|
9
|
+
*/
|
|
10
|
+
overlayHeight?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Custom hook that ensures the cursor remains visible when typing in a Tiptap editor.
|
|
14
|
+
* Automatically scrolls the window when the cursor would be hidden by the toolbar.
|
|
15
|
+
*
|
|
16
|
+
* @param options.editor The Tiptap editor instance
|
|
17
|
+
* @param options.overlayHeight Toolbar height to account for
|
|
18
|
+
* @returns The bounding rect of the body
|
|
19
|
+
*/
|
|
20
|
+
export declare function useCursorVisibility({ editor, overlayHeight, }: CursorVisibilityOptions): import("@/hooks/use-element-rect").RectState;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type RectState = Omit<DOMRect, "toJSON">;
|
|
2
|
+
export interface ElementRectOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The element to track. Can be an Element, ref, or selector string.
|
|
5
|
+
* Defaults to document.body if not provided.
|
|
6
|
+
*/
|
|
7
|
+
element?: Element | React.RefObject<Element> | string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to enable rect tracking
|
|
10
|
+
*/
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Throttle delay in milliseconds for rect updates
|
|
14
|
+
*/
|
|
15
|
+
throttleMs?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to use ResizeObserver for more accurate tracking
|
|
18
|
+
*/
|
|
19
|
+
useResizeObserver?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Custom hook that tracks an element's bounding rectangle and updates on resize, scroll, etc.
|
|
23
|
+
*
|
|
24
|
+
* @param options Configuration options for element rect tracking
|
|
25
|
+
* @returns The current bounding rectangle of the element
|
|
26
|
+
*/
|
|
27
|
+
export declare function useElementRect({ element, enabled, throttleMs, useResizeObserver, }?: ElementRectOptions): RectState;
|
|
28
|
+
/**
|
|
29
|
+
* Convenience hook for tracking document.body rect
|
|
30
|
+
*/
|
|
31
|
+
export declare function useBodyRect(options?: Omit<ElementRectOptions, "element">): RectState;
|
|
32
|
+
/**
|
|
33
|
+
* Convenience hook for tracking a ref element's rect
|
|
34
|
+
*/
|
|
35
|
+
export declare function useRefRect<T extends Element>(ref: React.RefObject<T>, options?: Omit<ElementRectOptions, "element">): RectState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type BreakpointMode = "min" | "max";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to detect whether the current viewport matches a given breakpoint rule.
|
|
4
|
+
* Example:
|
|
5
|
+
* useIsBreakpoint("max", 768) // true when width < 768
|
|
6
|
+
* useIsBreakpoint("min", 1024) // true when width >= 1024
|
|
7
|
+
*/
|
|
8
|
+
export declare function useIsBreakpoint(mode?: BreakpointMode, breakpoint?: number): boolean;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/react";
|
|
2
|
+
type Orientation = "horizontal" | "vertical" | "both";
|
|
3
|
+
interface MenuNavigationOptions<T> {
|
|
4
|
+
/**
|
|
5
|
+
* The Tiptap editor instance, if using with a Tiptap editor.
|
|
6
|
+
*/
|
|
7
|
+
editor?: Editor | null;
|
|
8
|
+
/**
|
|
9
|
+
* Reference to the container element for handling keyboard events.
|
|
10
|
+
*/
|
|
11
|
+
containerRef?: React.RefObject<HTMLElement | null>;
|
|
12
|
+
/**
|
|
13
|
+
* Search query that affects the selected item.
|
|
14
|
+
*/
|
|
15
|
+
query?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Array of items to navigate through.
|
|
18
|
+
*/
|
|
19
|
+
items: T[];
|
|
20
|
+
/**
|
|
21
|
+
* Callback fired when an item is selected.
|
|
22
|
+
*/
|
|
23
|
+
onSelect?: (item: T) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Callback fired when the menu should close.
|
|
26
|
+
*/
|
|
27
|
+
onClose?: () => void;
|
|
28
|
+
/**
|
|
29
|
+
* The navigation orientation of the menu.
|
|
30
|
+
* @default "vertical"
|
|
31
|
+
*/
|
|
32
|
+
orientation?: Orientation;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to automatically select the first item when the menu opens.
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
autoSelectFirstItem?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Hook that implements keyboard navigation for dropdown menus and command palettes.
|
|
41
|
+
*
|
|
42
|
+
* Handles arrow keys, tab, home/end, enter for selection, and escape to close.
|
|
43
|
+
* Works with both Tiptap editors and regular DOM elements.
|
|
44
|
+
*
|
|
45
|
+
* @param options - Configuration options for the menu navigation
|
|
46
|
+
* @returns Object containing the selected index and a setter function
|
|
47
|
+
*/
|
|
48
|
+
export declare function useMenuNavigation<T>({ editor, containerRef, query, items, onSelect, onClose, orientation, autoSelectFirstItem, }: MenuNavigationOptions<T>): {
|
|
49
|
+
selectedIndex: number | undefined;
|
|
50
|
+
setSelectedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
51
|
+
};
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
|
+
type ScrollTarget = RefObject<HTMLElement> | Window | null | undefined;
|
|
3
|
+
interface UseScrollingOptions {
|
|
4
|
+
debounce?: number;
|
|
5
|
+
fallbackToDocument?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function useScrolling(target?: ScrollTarget, options?: UseScrollingOptions): boolean;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface ThrottleSettings {
|
|
2
|
+
leading?: boolean | undefined;
|
|
3
|
+
trailing?: boolean | undefined;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A hook that returns a throttled callback function.
|
|
7
|
+
*
|
|
8
|
+
* @param fn The function to throttle
|
|
9
|
+
* @param wait The time in ms to wait before calling the function
|
|
10
|
+
* @param dependencies The dependencies to watch for changes
|
|
11
|
+
* @param options The throttle options
|
|
12
|
+
*/
|
|
13
|
+
export declare function useThrottledCallback<T extends (...args: any[]) => any>(fn: T, wait?: number, dependencies?: React.DependencyList, options?: ThrottleSettings): {
|
|
14
|
+
(this: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T>;
|
|
15
|
+
cancel: () => void;
|
|
16
|
+
flush: () => void;
|
|
17
|
+
};
|
|
18
|
+
export default useThrottledCallback;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface WindowSizeState {
|
|
2
|
+
/**
|
|
3
|
+
* The width of the window's visual viewport in pixels.
|
|
4
|
+
*/
|
|
5
|
+
width: number;
|
|
6
|
+
/**
|
|
7
|
+
* The height of the window's visual viewport in pixels.
|
|
8
|
+
*/
|
|
9
|
+
height: number;
|
|
10
|
+
/**
|
|
11
|
+
* The distance from the top of the visual viewport to the top of the layout viewport.
|
|
12
|
+
* Particularly useful for handling mobile keyboard appearance.
|
|
13
|
+
*/
|
|
14
|
+
offsetTop: number;
|
|
15
|
+
/**
|
|
16
|
+
* The distance from the left of the visual viewport to the left of the layout viewport.
|
|
17
|
+
*/
|
|
18
|
+
offsetLeft: number;
|
|
19
|
+
/**
|
|
20
|
+
* The scale factor of the visual viewport.
|
|
21
|
+
* This is useful for scaling elements based on the current zoom level.
|
|
22
|
+
*/
|
|
23
|
+
scale: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Hook that tracks the window's visual viewport dimensions, position, and provides
|
|
27
|
+
* a CSS transform for positioning elements.
|
|
28
|
+
*
|
|
29
|
+
* Uses the Visual Viewport API to get accurate measurements, especially important
|
|
30
|
+
* for mobile devices where virtual keyboards can change the visible area.
|
|
31
|
+
* Only updates state when values actually change to optimize performance.
|
|
32
|
+
*
|
|
33
|
+
* @returns An object containing viewport properties and a CSS transform string
|
|
34
|
+
*/
|
|
35
|
+
export declare function useWindowSize(): WindowSizeState;
|