planet-editor 0.1.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/LICENSE +24 -0
- package/README.md +129 -0
- package/THIRD-PARTY-LICENSES.md +76 -0
- package/dist/lib/components/planet-extension/node-background-extension.d.ts +23 -0
- package/dist/lib/components/planet-extension/search-extension.d.ts +39 -0
- package/dist/lib/components/planet-icons/align-center-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/align-justify-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/align-left-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/align-right-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/arrow-left-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/ban-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/blockquote-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/bold-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/check-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/chevron-down-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/close-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/code-block-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/code2-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/corner-down-left-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/external-link-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/heading-five-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/heading-four-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/heading-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/heading-one-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/heading-six-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/heading-three-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/heading-two-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/highlighter-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/image-plus-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/italic-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/line-numbers-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/link-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/list-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/list-ordered-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/list-todo-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/moon-star-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/redo2-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/search-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/strike-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/subscript-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/sun-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/superscript-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/table-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/trash-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/underline-icon.d.ts +3 -0
- package/dist/lib/components/planet-icons/undo2-icon.d.ts +3 -0
- package/dist/lib/components/planet-node/horizontal-rule-node/horizontal-rule-node-extension.d.ts +2 -0
- package/dist/lib/components/planet-node/image-node/resizable-image-extension.d.ts +10 -0
- package/dist/lib/components/planet-node/image-node/resizable-image-node-view.d.ts +7 -0
- package/dist/lib/components/planet-node/image-upload-node/image-upload-node-extension.d.ts +58 -0
- package/dist/lib/components/planet-node/image-upload-node/image-upload-node.d.ts +68 -0
- package/dist/lib/components/planet-node/image-upload-node/index.d.ts +1 -0
- package/dist/lib/components/planet-templates/simple/data/content.json.d.ts +479 -0
- package/dist/lib/components/planet-templates/simple/simple-editor.d.ts +31 -0
- package/dist/lib/components/planet-templates/simple/theme-toggle.d.ts +1 -0
- package/dist/lib/components/planet-ui/blockquote-button/blockquote-button.d.ts +22 -0
- package/dist/lib/components/planet-ui/blockquote-button/index.d.ts +2 -0
- package/dist/lib/components/planet-ui/blockquote-button/use-blockquote.d.ts +80 -0
- package/dist/lib/components/planet-ui/code-block-button/code-block-button.d.ts +22 -0
- package/dist/lib/components/planet-ui/code-block-button/index.d.ts +2 -0
- package/dist/lib/components/planet-ui/code-block-button/use-code-block.d.ts +87 -0
- package/dist/lib/components/planet-ui/color-highlight-button/color-highlight-button.d.ts +45 -0
- package/dist/lib/components/planet-ui/color-highlight-button/index.d.ts +2 -0
- package/dist/lib/components/planet-ui/color-highlight-button/use-color-highlight.d.ts +93 -0
- package/dist/lib/components/planet-ui/color-highlight-popover/color-highlight-popover.d.ts +35 -0
- package/dist/lib/components/planet-ui/color-highlight-popover/index.d.ts +1 -0
- package/dist/lib/components/planet-ui/font-size-dropdown-menu/font-size-dropdown-menu.d.ts +10 -0
- package/dist/lib/components/planet-ui/font-size-dropdown-menu/index.d.ts +1 -0
- package/dist/lib/components/planet-ui/heading-button/heading-button.d.ts +23 -0
- package/dist/lib/components/planet-ui/heading-button/index.d.ts +2 -0
- package/dist/lib/components/planet-ui/heading-button/use-heading.d.ts +108 -0
- package/dist/lib/components/planet-ui/heading-dropdown-menu/heading-dropdown-menu.d.ts +19 -0
- package/dist/lib/components/planet-ui/heading-dropdown-menu/index.d.ts +2 -0
- package/dist/lib/components/planet-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +73 -0
- package/dist/lib/components/planet-ui/image-upload-button/image-upload-button.d.ts +29 -0
- package/dist/lib/components/planet-ui/image-upload-button/index.d.ts +2 -0
- package/dist/lib/components/planet-ui/image-upload-button/use-image-upload.d.ts +84 -0
- package/dist/lib/components/planet-ui/link-popover/index.d.ts +2 -0
- package/dist/lib/components/planet-ui/link-popover/link-popover.d.ts +57 -0
- package/dist/lib/components/planet-ui/link-popover/use-link-popover.d.ts +117 -0
- package/dist/lib/components/planet-ui/list-button/index.d.ts +2 -0
- package/dist/lib/components/planet-ui/list-button/list-button.d.ts +23 -0
- package/dist/lib/components/planet-ui/list-button/use-list.d.ts +97 -0
- package/dist/lib/components/planet-ui/list-dropdown-menu/index.d.ts +1 -0
- package/dist/lib/components/planet-ui/list-dropdown-menu/list-dropdown-menu.d.ts +28 -0
- package/dist/lib/components/planet-ui/list-dropdown-menu/use-list-dropdown-menu.d.ts +90 -0
- package/dist/lib/components/planet-ui/mark-button/index.d.ts +2 -0
- package/dist/lib/components/planet-ui/mark-button/mark-button.d.ts +23 -0
- package/dist/lib/components/planet-ui/mark-button/use-mark.d.ts +104 -0
- package/dist/lib/components/planet-ui/search-bar/index.d.ts +1 -0
- package/dist/lib/components/planet-ui/search-bar/search-bar.d.ts +11 -0
- package/dist/lib/components/planet-ui/table-dropdown-menu/index.d.ts +1 -0
- package/dist/lib/components/planet-ui/table-dropdown-menu/table-dropdown-menu.d.ts +11 -0
- package/dist/lib/components/planet-ui/text-align-button/index.d.ts +2 -0
- package/dist/lib/components/planet-ui/text-align-button/text-align-button.d.ts +30 -0
- package/dist/lib/components/planet-ui/text-align-button/use-text-align.d.ts +101 -0
- package/dist/lib/components/planet-ui/undo-redo-button/index.d.ts +2 -0
- package/dist/lib/components/planet-ui/undo-redo-button/undo-redo-button.d.ts +23 -0
- package/dist/lib/components/planet-ui/undo-redo-button/use-undo-redo.d.ts +90 -0
- package/dist/lib/components/planet-ui-primitive/badge/badge.d.ts +8 -0
- package/dist/lib/components/planet-ui-primitive/badge/index.d.ts +1 -0
- package/dist/lib/components/planet-ui-primitive/button/button.d.ts +14 -0
- package/dist/lib/components/planet-ui-primitive/button/index.d.ts +1 -0
- package/dist/lib/components/planet-ui-primitive/button-group/button-group.d.ts +10 -0
- package/dist/lib/components/planet-ui-primitive/button-group/index.d.ts +1 -0
- package/dist/lib/components/planet-ui-primitive/card/card.d.ts +9 -0
- package/dist/lib/components/planet-ui-primitive/card/index.d.ts +1 -0
- package/dist/lib/components/planet-ui-primitive/dropdown-menu/dropdown-menu.d.ts +28 -0
- package/dist/lib/components/planet-ui-primitive/dropdown-menu/index.d.ts +1 -0
- package/dist/lib/components/planet-ui-primitive/input/index.d.ts +1 -0
- package/dist/lib/components/planet-ui-primitive/input/input.d.ts +2 -0
- package/dist/lib/components/planet-ui-primitive/popover/index.d.ts +1 -0
- package/dist/lib/components/planet-ui-primitive/popover/popover.d.ts +5 -0
- package/dist/lib/components/planet-ui-primitive/separator/index.d.ts +1 -0
- package/dist/lib/components/planet-ui-primitive/separator/separator.d.ts +5 -0
- package/dist/lib/components/planet-ui-primitive/spacer/index.d.ts +1 -0
- package/dist/lib/components/planet-ui-primitive/spacer/spacer.d.ts +5 -0
- package/dist/lib/components/planet-ui-primitive/toolbar/index.d.ts +1 -0
- package/dist/lib/components/planet-ui-primitive/toolbar/toolbar.d.ts +8 -0
- package/dist/lib/components/planet-ui-primitive/tooltip/index.d.ts +1 -0
- package/dist/lib/components/planet-ui-primitive/tooltip/tooltip.d.ts +28 -0
- package/dist/lib/favicon.svg +1 -0
- package/dist/lib/hooks/use-composed-ref.d.ts +3 -0
- package/dist/lib/hooks/use-cursor-visibility.d.ts +20 -0
- package/dist/lib/hooks/use-element-rect.d.ts +35 -0
- package/dist/lib/hooks/use-is-breakpoint.d.ts +9 -0
- package/dist/lib/hooks/use-line-numbers.d.ts +15 -0
- package/dist/lib/hooks/use-menu-navigation.d.ts +52 -0
- package/dist/lib/hooks/use-planet-editor.d.ts +6 -0
- package/dist/lib/hooks/use-scrolling.d.ts +8 -0
- package/dist/lib/hooks/use-throttled-callback.d.ts +18 -0
- package/dist/lib/hooks/use-unmount.d.ts +7 -0
- package/dist/lib/hooks/use-window-size.d.ts +35 -0
- package/dist/lib/icons.svg +24 -0
- package/dist/lib/images/planet-ui-placeholder-image.svg +10 -0
- package/dist/lib/index.js +5102 -0
- package/dist/lib/lib/index.d.ts +2 -0
- package/dist/lib/lib/planet-utils.d.ts +173 -0
- package/dist/lib/lib/upload.d.ts +10 -0
- package/dist/lib/styles.css +2 -0
- package/dist/web-component/favicon.svg +1 -0
- package/dist/web-component/icons.svg +24 -0
- package/dist/web-component/images/planet-ui-placeholder-image.svg +10 -0
- package/dist/web-component/planet-editor.css +2 -0
- package/dist/web-component/planet-editor.html +224 -0
- package/dist/web-component/planet-editor.js +203 -0
- package/package.json +101 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ChainedCommands, Editor } from '../../../planet-core/react';
|
|
2
|
+
export type TextAlign = "left" | "center" | "right" | "justify";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the text align functionality
|
|
5
|
+
*/
|
|
6
|
+
export interface UseTextAlignConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The Planet editor instance.
|
|
9
|
+
*/
|
|
10
|
+
editor?: Editor | null;
|
|
11
|
+
/**
|
|
12
|
+
* The text alignment to apply.
|
|
13
|
+
*/
|
|
14
|
+
align: TextAlign;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the button should hide when alignment is not available.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
hideWhenUnavailable?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Callback function called after a successful alignment change.
|
|
22
|
+
*/
|
|
23
|
+
onAligned?: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const TEXT_ALIGN_SHORTCUT_KEYS: Record<TextAlign, string>;
|
|
26
|
+
export declare const textAlignIcons: {
|
|
27
|
+
left: import('react').MemoExoticComponent<({ className, ...props }: Omit<import('react').SVGProps<SVGSVGElement>, "ref">) => import("react").JSX.Element>;
|
|
28
|
+
center: import('react').MemoExoticComponent<({ className, ...props }: Omit<import('react').SVGProps<SVGSVGElement>, "ref">) => import("react").JSX.Element>;
|
|
29
|
+
right: import('react').MemoExoticComponent<({ className, ...props }: Omit<import('react').SVGProps<SVGSVGElement>, "ref">) => import("react").JSX.Element>;
|
|
30
|
+
justify: import('react').MemoExoticComponent<({ className, ...props }: Omit<import('react').SVGProps<SVGSVGElement>, "ref">) => import("react").JSX.Element>;
|
|
31
|
+
};
|
|
32
|
+
export declare const textAlignLabels: Record<TextAlign, string>;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if text alignment can be performed in the current editor state
|
|
35
|
+
*/
|
|
36
|
+
export declare function canSetTextAlign(editor: Editor | null, align: TextAlign): boolean;
|
|
37
|
+
export declare function hasSetTextAlign(commands: ChainedCommands): commands is ChainedCommands & {
|
|
38
|
+
setTextAlign: (align: TextAlign) => ChainedCommands;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Checks if the text alignment is currently active
|
|
42
|
+
*/
|
|
43
|
+
export declare function isTextAlignActive(editor: Editor | null, align: TextAlign): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Sets text alignment in the editor
|
|
46
|
+
*/
|
|
47
|
+
export declare function setTextAlign(editor: Editor | null, align: TextAlign): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Determines if the text align button should be shown
|
|
50
|
+
*/
|
|
51
|
+
export declare function shouldShowButton(props: {
|
|
52
|
+
editor: Editor | null;
|
|
53
|
+
hideWhenUnavailable: boolean;
|
|
54
|
+
align: TextAlign;
|
|
55
|
+
}): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Custom hook that provides text align functionality for Planet editor
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* // Simple usage
|
|
62
|
+
* function MySimpleAlignButton() {
|
|
63
|
+
* const { isVisible, handleTextAlign } = useTextAlign({ align: "center" })
|
|
64
|
+
*
|
|
65
|
+
* if (!isVisible) return null
|
|
66
|
+
*
|
|
67
|
+
* return <button onClick={handleTextAlign}>Align Center</button>
|
|
68
|
+
* }
|
|
69
|
+
*
|
|
70
|
+
* // Advanced usage with configuration
|
|
71
|
+
* function MyAdvancedAlignButton() {
|
|
72
|
+
* const { isVisible, handleTextAlign, label, isActive } = useTextAlign({
|
|
73
|
+
* editor: myEditor,
|
|
74
|
+
* align: "right",
|
|
75
|
+
* hideWhenUnavailable: true,
|
|
76
|
+
* onAligned: () => console.log('Text aligned!')
|
|
77
|
+
* })
|
|
78
|
+
*
|
|
79
|
+
* if (!isVisible) return null
|
|
80
|
+
*
|
|
81
|
+
* return (
|
|
82
|
+
* <MyButton
|
|
83
|
+
* onClick={handleTextAlign}
|
|
84
|
+
* aria-pressed={isActive}
|
|
85
|
+
* aria-label={label}
|
|
86
|
+
* >
|
|
87
|
+
* Align Right
|
|
88
|
+
* </MyButton>
|
|
89
|
+
* )
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function useTextAlign(config: UseTextAlignConfig): {
|
|
94
|
+
isVisible: boolean;
|
|
95
|
+
isActive: boolean;
|
|
96
|
+
handleTextAlign: () => boolean;
|
|
97
|
+
canAlign: boolean;
|
|
98
|
+
label: string;
|
|
99
|
+
shortcutKeys: string;
|
|
100
|
+
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> | 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>;
|
|
101
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { UndoRedoAction, UseUndoRedoConfig } from '.';
|
|
2
|
+
import { ButtonProps } from '../../planet-ui-primitive/button';
|
|
3
|
+
export interface UndoRedoButtonProps extends Omit<ButtonProps, "type">, UseUndoRedoConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Optional text to display alongside the icon.
|
|
6
|
+
*/
|
|
7
|
+
text?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional show shortcut keys in the button.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
showShortcut?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function HistoryShortcutBadge({ action, shortcutKeys, }: {
|
|
15
|
+
action: UndoRedoAction;
|
|
16
|
+
shortcutKeys?: string;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Button component for triggering undo/redo actions in a Planet editor.
|
|
20
|
+
*
|
|
21
|
+
* For custom button implementations, use the `useHistory` hook instead.
|
|
22
|
+
*/
|
|
23
|
+
export declare const UndoRedoButton: import('react').ForwardRefExoticComponent<UndoRedoButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Editor } from '../../../planet-core/react';
|
|
2
|
+
export type UndoRedoAction = "undo" | "redo";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the history functionality
|
|
5
|
+
*/
|
|
6
|
+
export interface UseUndoRedoConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The Planet 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 Planet 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,8 @@
|
|
|
1
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
variant?: "ghost" | "white" | "gray" | "green" | "yellow" | "default";
|
|
3
|
+
size?: "default" | "small";
|
|
4
|
+
appearance?: "default" | "subdued" | "emphasized";
|
|
5
|
+
trimText?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const Badge: import('react').ForwardRefExoticComponent<BadgeProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export default Badge;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './badge';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ButtonVariant = "ghost" | "primary";
|
|
2
|
+
export type ButtonSize = "small" | "default" | "large";
|
|
3
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
showTooltip?: boolean;
|
|
5
|
+
tooltip?: React.ReactNode;
|
|
6
|
+
shortcutKeys?: string;
|
|
7
|
+
variant?: ButtonVariant;
|
|
8
|
+
size?: ButtonSize;
|
|
9
|
+
}
|
|
10
|
+
export declare const ShortcutDisplay: React.FC<{
|
|
11
|
+
shortcuts: string[];
|
|
12
|
+
}>;
|
|
13
|
+
export declare const Button: import('react').ForwardRefExoticComponent<ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
export default Button;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { Separator } from '../separator';
|
|
4
|
+
declare const buttonGroupVariants: (props?: ({
|
|
5
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): import("react").JSX.Element;
|
|
8
|
+
declare function ButtonGroupText({ className, render, ...props }: useRender.ComponentProps<"div">): import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
|
|
9
|
+
declare function ButtonGroupSeparator({ className, orientation, ...props }: React.ComponentProps<typeof Separator>): import("react").JSX.Element;
|
|
10
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button-group';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const Card: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
2
|
+
declare const CardHeader: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const CardBody: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const CardItemGroup: import('react').ForwardRefExoticComponent<Omit<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
orientation?: "horizontal" | "vertical";
|
|
6
|
+
}, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const CardGroupLabel: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const CardFooter: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export { Card, CardHeader, CardFooter, CardBody, CardItemGroup, CardGroupLabel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './card';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2
|
+
declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): import("react").JSX.Element;
|
|
3
|
+
declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): import("react").JSX.Element;
|
|
4
|
+
declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): import("react").JSX.Element;
|
|
5
|
+
declare function DropdownMenuContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): import("react").JSX.Element;
|
|
6
|
+
declare function DropdownMenuGroup({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): import("react").JSX.Element;
|
|
7
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
8
|
+
inset?: boolean;
|
|
9
|
+
variant?: "default" | "destructive";
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & {
|
|
12
|
+
inset?: boolean;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): import("react").JSX.Element;
|
|
15
|
+
declare function DropdownMenuRadioItem({ className, children, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {
|
|
16
|
+
inset?: boolean;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
19
|
+
inset?: boolean;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): import("react").JSX.Element;
|
|
22
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): import("react").JSX.Element;
|
|
23
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): import("react").JSX.Element;
|
|
24
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
25
|
+
inset?: boolean;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react").JSX.Element;
|
|
28
|
+
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,5 @@
|
|
|
1
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
2
|
+
declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): import("react").JSX.Element;
|
|
3
|
+
declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): import("react").JSX.Element;
|
|
4
|
+
declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): import("react").JSX.Element;
|
|
5
|
+
export { Popover, PopoverTrigger, PopoverContent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './separator';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './spacer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './toolbar';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type BaseProps = React.HTMLAttributes<HTMLDivElement>;
|
|
2
|
+
interface ToolbarProps extends BaseProps {
|
|
3
|
+
variant?: "floating" | "fixed";
|
|
4
|
+
}
|
|
5
|
+
export declare const Toolbar: import('react').ForwardRefExoticComponent<ToolbarProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare const ToolbarGroup: import('react').ForwardRefExoticComponent<BaseProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export declare const ToolbarSeparator: import('react').ForwardRefExoticComponent<BaseProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tooltip';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FloatingPortal, Placement } from '@floating-ui/react';
|
|
2
|
+
interface TooltipProviderProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
initialOpen?: boolean;
|
|
5
|
+
placement?: Placement;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
delay?: number;
|
|
9
|
+
closeDelay?: number;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
useDelayGroup?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface TooltipTriggerProps extends Omit<React.HTMLProps<HTMLElement>, "ref"> {
|
|
14
|
+
asChild?: boolean;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
interface TooltipContentProps extends Omit<React.HTMLProps<HTMLDivElement>, "ref"> {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
portal?: boolean;
|
|
20
|
+
portalProps?: Omit<React.ComponentProps<typeof FloatingPortal>, "children">;
|
|
21
|
+
}
|
|
22
|
+
export declare function Tooltip({ children, ...props }: TooltipProviderProps): import("react").JSX.Element;
|
|
23
|
+
export declare namespace Tooltip {
|
|
24
|
+
var displayName: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const TooltipTrigger: import('react').ForwardRefExoticComponent<TooltipTriggerProps & import('react').RefAttributes<HTMLElement>>;
|
|
27
|
+
export declare const TooltipContent: import('react').ForwardRefExoticComponent<TooltipContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="46" fill="none" viewBox="0 0 48 46"><path fill="#863bff" d="M25.946 44.938c-.664.845-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.287c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.497 0-3.578-1.842-3.578H1.237c-.92 0-1.456-1.04-.92-1.788L10.013.474c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.579 1.842 3.579h11.377c.943 0 1.473 1.088.89 1.83L25.947 44.94z" style="fill:#863bff;fill:color(display-p3 .5252 .23 1);fill-opacity:1"/><mask id="a" width="48" height="46" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#000" d="M25.842 44.938c-.664.844-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.183c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.498 0-3.579-1.842-3.579H1.133c-.92 0-1.456-1.04-.92-1.787L9.91.473c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.578 1.842 3.578h11.377c.943 0 1.473 1.088.89 1.832L25.843 44.94z" style="fill:#000;fill-opacity:1"/></mask><g mask="url(#a)"><g filter="url(#b)"><ellipse cx="5.508" cy="14.704" fill="#ede6ff" rx="5.508" ry="14.704" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -4.47 31.516)"/></g><g filter="url(#c)"><ellipse cx="10.399" cy="29.851" fill="#ede6ff" rx="10.399" ry="29.851" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -39.328 7.883)"/></g><g filter="url(#d)"><ellipse cx="5.508" cy="30.487" fill="#7e14ff" rx="5.508" ry="30.487" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -25.913 -14.639)scale(1 -1)"/></g><g filter="url(#e)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -32.644 -3.334)scale(1 -1)"/></g><g filter="url(#f)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -34.34 30.47)"/></g><g filter="url(#g)"><ellipse cx="14.072" cy="22.078" fill="#ede6ff" rx="14.072" ry="22.078" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="rotate(93.35 24.506 48.493)scale(-1 1)"/></g><g filter="url(#h)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#i)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#j)"><ellipse cx=".387" cy="8.972" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(39.51 .387 8.972)"/></g><g filter="url(#k)"><ellipse cx="47.523" cy="-6.092" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 47.523 -6.092)"/></g><g filter="url(#l)"><ellipse cx="41.412" cy="6.333" fill="#47bfff" rx="5.971" ry="9.665" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 41.412 6.333)"/></g><g filter="url(#m)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#n)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#o)"><ellipse cx="35.651" cy="29.907" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 35.651 29.907)"/></g><g filter="url(#p)"><ellipse cx="38.418" cy="32.4" fill="#47bfff" rx="5.971" ry="15.297" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 38.418 32.4)"/></g></g><defs><filter id="b" width="60.045" height="41.654" x="-19.77" y="16.149" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="c" width="90.34" height="51.437" x="-54.613" y="-7.533" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="d" width="79.355" height="29.4" x="-49.64" y="2.03" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="e" width="79.579" height="29.4" x="-45.045" y="20.029" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="f" width="79.579" height="29.4" x="-43.513" y="21.178" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="g" width="74.749" height="58.852" x="15.756" y="-17.901" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="h" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="i" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="j" width="56.045" height="63.649" x="-27.636" y="-22.853" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="k" width="54.814" height="64.646" x="20.116" y="-38.415" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="l" width="33.541" height="35.313" x="24.641" y="-11.323" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="m" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="n" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="o" width="54.814" height="64.646" x="8.244" y="-2.416" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="p" width="39.409" height="43.623" x="18.713" y="10.588" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter></defs></svg>
|
|
@@ -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 { Editor } from '../planet-core/react';
|
|
2
|
+
export interface CursorVisibilityOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The Planet 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 Planet editor.
|
|
14
|
+
* Automatically scrolls the window when the cursor would be hidden by the toolbar.
|
|
15
|
+
*
|
|
16
|
+
* @param options.editor The Planet 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('./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,15 @@
|
|
|
1
|
+
import { Editor } from '../planet-core/core';
|
|
2
|
+
/**
|
|
3
|
+
* Measures the vertical position of every *visual* line in the editor (so a
|
|
4
|
+
* wrapped paragraph yields one number per wrapped row, not one per block) and
|
|
5
|
+
* returns the tops to render in a left gutter.
|
|
6
|
+
*
|
|
7
|
+
* Pure measurement via Range.getClientRects(); re-runs on edit, resize, and
|
|
8
|
+
* font load. Returns a ref to attach to the positioned wrapper, the line tops
|
|
9
|
+
* (relative to that wrapper), and the editor's left edge within it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useLineNumbers(editor: Editor | null, enabled: boolean): {
|
|
12
|
+
wrapperRef: import('react').RefObject<HTMLDivElement | null>;
|
|
13
|
+
tops: number[];
|
|
14
|
+
left: number;
|
|
15
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Editor } from '../planet-core/react';
|
|
2
|
+
type Orientation = "horizontal" | "vertical" | "both";
|
|
3
|
+
interface MenuNavigationOptions<T> {
|
|
4
|
+
/**
|
|
5
|
+
* The Planet editor instance, if using with a Planet 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 Planet 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 { 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;
|