zs_library 0.6.21 → 0.7.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.
Files changed (145) hide show
  1. package/dist/components/desktop/config.d.ts +1 -1
  2. package/dist/components/desktop/context/config/hooks.d.ts +2 -0
  3. package/dist/components/desktop/context-menu/content.d.ts +1 -2
  4. package/dist/components/desktop/context-menu/sub-menu-item.d.ts +1 -1
  5. package/dist/components/desktop/items/item-content.d.ts +9 -0
  6. package/dist/components/desktop/sortable.d.ts +4 -0
  7. package/dist/components/desktop/types.d.ts +7 -7
  8. package/dist/components/index.d.ts +1 -1
  9. package/dist/components/tiptap-editor/simple/components/tiptap-extension/node-background-extension.d.ts +23 -0
  10. package/dist/components/tiptap-editor/simple/components/tiptap-icons/arrow-left-icon.d.ts +3 -0
  11. package/dist/components/tiptap-editor/simple/components/tiptap-icons/blockquote-icon.d.ts +3 -0
  12. package/dist/components/tiptap-editor/simple/components/tiptap-icons/chevron-down-icon.d.ts +3 -0
  13. package/dist/components/tiptap-editor/simple/components/tiptap-icons/close-icon.d.ts +3 -0
  14. package/dist/components/tiptap-editor/simple/components/tiptap-icons/code-block-icon.d.ts +3 -0
  15. package/dist/components/tiptap-editor/simple/components/tiptap-icons/corner-down-left-icon.d.ts +3 -0
  16. package/dist/components/tiptap-editor/simple/components/tiptap-icons/external-link-icon.d.ts +3 -0
  17. package/dist/components/tiptap-editor/simple/components/tiptap-icons/trash-icon.d.ts +3 -0
  18. package/dist/components/tiptap-editor/simple/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.d.ts +2 -0
  19. package/dist/components/tiptap-editor/simple/components/tiptap-node/image-node/image-node-extension.d.ts +21 -0
  20. package/dist/components/tiptap-editor/simple/components/tiptap-node/image-node/image-node.d.ts +3 -0
  21. package/dist/components/tiptap-editor/simple/components/tiptap-node/image-upload-node/image-upload-node-extension.d.ts +64 -0
  22. package/dist/components/tiptap-editor/simple/components/tiptap-node/image-upload-node/image-upload-node.d.ts +68 -0
  23. package/dist/components/tiptap-editor/simple/components/tiptap-node/image-upload-node/index.d.ts +1 -0
  24. package/dist/components/tiptap-editor/simple/components/tiptap-ui/ai-button/ai-button.d.ts +9 -0
  25. package/dist/components/tiptap-editor/simple/components/tiptap-ui/ai-button/index.d.ts +2 -0
  26. package/dist/components/tiptap-editor/simple/components/tiptap-ui/ai-button/use-ai.d.ts +38 -0
  27. package/dist/components/tiptap-editor/simple/components/tiptap-ui/blockquote-button/blockquote-button.d.ts +22 -0
  28. package/dist/components/tiptap-editor/simple/components/tiptap-ui/blockquote-button/index.d.ts +2 -0
  29. package/dist/components/tiptap-editor/simple/components/tiptap-ui/blockquote-button/use-blockquote.d.ts +80 -0
  30. package/dist/components/tiptap-editor/simple/components/tiptap-ui/code-block-button/code-block-button.d.ts +22 -0
  31. package/dist/components/tiptap-editor/simple/components/tiptap-ui/code-block-button/index.d.ts +2 -0
  32. package/dist/components/tiptap-editor/simple/components/tiptap-ui/code-block-button/use-code-block.d.ts +87 -0
  33. package/dist/components/tiptap-editor/simple/components/tiptap-ui/color-highlight-button/color-highlight-button.d.ts +45 -0
  34. package/dist/components/tiptap-editor/simple/components/tiptap-ui/color-highlight-button/index.d.ts +2 -0
  35. package/dist/components/tiptap-editor/simple/components/tiptap-ui/color-highlight-button/use-color-highlight.d.ts +82 -0
  36. package/dist/components/tiptap-editor/simple/components/tiptap-ui/color-highlight-popover/color-highlight-popover.d.ts +25 -0
  37. package/dist/components/tiptap-editor/simple/components/tiptap-ui/color-highlight-popover/index.d.ts +1 -0
  38. package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-button/heading-button.d.ts +23 -0
  39. package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-button/index.d.ts +2 -0
  40. package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-button/use-heading.d.ts +108 -0
  41. package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.d.ts +20 -0
  42. package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-dropdown-menu/index.d.ts +2 -0
  43. package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +73 -0
  44. package/dist/components/tiptap-editor/simple/components/tiptap-ui/image-upload-button/image-upload-button.d.ts +29 -0
  45. package/dist/components/tiptap-editor/simple/components/tiptap-ui/image-upload-button/index.d.ts +2 -0
  46. package/dist/components/tiptap-editor/simple/components/tiptap-ui/image-upload-button/use-image-upload.d.ts +84 -0
  47. package/dist/components/tiptap-editor/simple/components/tiptap-ui/link-popover/index.d.ts +2 -0
  48. package/dist/components/tiptap-editor/simple/components/tiptap-ui/link-popover/link-popover.d.ts +57 -0
  49. package/dist/components/tiptap-editor/simple/components/tiptap-ui/link-popover/use-link-popover.d.ts +117 -0
  50. package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-button/index.d.ts +2 -0
  51. package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-button/list-button.d.ts +23 -0
  52. package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-button/use-list.d.ts +97 -0
  53. package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-dropdown-menu/index.d.ts +1 -0
  54. package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.d.ts +29 -0
  55. package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.d.ts +94 -0
  56. package/dist/components/tiptap-editor/simple/components/tiptap-ui/mark-button/index.d.ts +2 -0
  57. package/dist/components/tiptap-editor/simple/components/tiptap-ui/mark-button/mark-button.d.ts +23 -0
  58. package/dist/components/tiptap-editor/simple/components/tiptap-ui/mark-button/use-mark.d.ts +104 -0
  59. package/dist/components/tiptap-editor/simple/components/tiptap-ui/text-align-button/index.d.ts +2 -0
  60. package/dist/components/tiptap-editor/simple/components/tiptap-ui/text-align-button/text-align-button.d.ts +30 -0
  61. package/dist/components/tiptap-editor/simple/components/tiptap-ui/text-align-button/use-text-align.d.ts +101 -0
  62. package/dist/components/tiptap-editor/simple/components/tiptap-ui/undo-redo-button/index.d.ts +2 -0
  63. package/dist/components/tiptap-editor/simple/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +23 -0
  64. package/dist/components/tiptap-editor/simple/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +90 -0
  65. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/badge/badge.d.ts +8 -0
  66. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/badge/index.d.ts +1 -0
  67. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/button/button.d.ts +14 -0
  68. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/button/index.d.ts +1 -0
  69. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/card/card.d.ts +9 -0
  70. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/card/index.d.ts +1 -0
  71. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +16 -0
  72. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/dropdown-menu/index.d.ts +1 -0
  73. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/input/index.d.ts +1 -0
  74. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/input/input.d.ts +3 -0
  75. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/popover/index.d.ts +1 -0
  76. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/popover/popover.d.ts +6 -0
  77. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/separator/index.d.ts +1 -0
  78. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/separator/separator.d.ts +6 -0
  79. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/spacer/index.d.ts +1 -0
  80. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/spacer/spacer.d.ts +6 -0
  81. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/toolbar/index.d.ts +1 -0
  82. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/toolbar/toolbar.d.ts +8 -0
  83. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/tooltip/index.d.ts +1 -0
  84. package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +28 -0
  85. package/dist/components/tiptap-editor/simple/hooks/use-composed-ref.d.ts +3 -0
  86. package/dist/components/tiptap-editor/simple/hooks/use-cursor-visibility.d.ts +20 -0
  87. package/dist/components/tiptap-editor/simple/hooks/use-element-rect.d.ts +35 -0
  88. package/dist/components/tiptap-editor/simple/hooks/use-is-breakpoint.d.ts +9 -0
  89. package/dist/components/tiptap-editor/simple/hooks/use-menu-navigation.d.ts +52 -0
  90. package/dist/components/tiptap-editor/simple/hooks/use-scrolling.d.ts +8 -0
  91. package/dist/components/tiptap-editor/simple/hooks/use-throttled-callback.d.ts +18 -0
  92. package/dist/components/tiptap-editor/simple/hooks/use-tiptap-editor.d.ts +17 -0
  93. package/dist/components/tiptap-editor/simple/hooks/use-unmount.d.ts +7 -0
  94. package/dist/components/tiptap-editor/simple/hooks/use-window-size.d.ts +35 -0
  95. package/dist/components/tiptap-editor/simple/i18n/en-US.json.d.ts +107 -0
  96. package/dist/components/tiptap-editor/simple/i18n/zh-CN.json.d.ts +107 -0
  97. package/dist/components/tiptap-editor/simple/index.d.ts +28 -0
  98. package/dist/components/tiptap-editor/simple/lib/ai-service.d.ts +15 -0
  99. package/dist/components/tiptap-editor/simple/lib/feature-utils.d.ts +124 -0
  100. package/dist/components/tiptap-editor/simple/lib/image-upload-handler.d.ts +44 -0
  101. package/dist/components/tiptap-editor/simple/lib/tiptap-utils.d.ts +167 -0
  102. package/dist/components/tiptap-editor/simple/simple-editor.d.ts +10 -0
  103. package/dist/components/tiptap-editor/simple/theme-toggle.d.ts +1 -0
  104. package/dist/index.css +1 -1
  105. package/dist/index.d.ts +1 -1
  106. package/dist/index.js +7688 -4797
  107. package/package.json +20 -6
  108. package/dist/components/editor/editor.d.ts +0 -3
  109. package/dist/components/editor/extensions/drag-handle/clipboard-serializer.d.ts +0 -3
  110. package/dist/components/editor/extensions/drag-handle/index.d.ts +0 -26
  111. package/dist/components/editor/generative/ai-completion-command.d.ts +0 -5
  112. package/dist/components/editor/generative/ai-selector-commands.d.ts +0 -5
  113. package/dist/components/editor/generative/ai-selector.d.ts +0 -8
  114. package/dist/components/editor/generative/drag-handle.d.ts +0 -2
  115. package/dist/components/editor/generative/generative-dropdown-menu.d.ts +0 -4
  116. package/dist/components/editor/generative/generative-menu-switch.d.ts +0 -11
  117. package/dist/components/editor/image-upload.d.ts +0 -1
  118. package/dist/components/editor/index.d.ts +0 -13
  119. package/dist/components/editor/lib/colors.d.ts +0 -6
  120. package/dist/components/editor/lib/content.d.ts +0 -4
  121. package/dist/components/editor/lib/nodes.d.ts +0 -9
  122. package/dist/components/editor/lib/url-utils.d.ts +0 -2
  123. package/dist/components/editor/preview.d.ts +0 -7
  124. package/dist/components/editor/selectors/color-selector.d.ts +0 -6
  125. package/dist/components/editor/selectors/link-selector.d.ts +0 -6
  126. package/dist/components/editor/selectors/math-selector.d.ts +0 -1
  127. package/dist/components/editor/selectors/node-selector.d.ts +0 -6
  128. package/dist/components/editor/selectors/text-buttons.d.ts +0 -1
  129. package/dist/components/editor/slash-command.d.ts +0 -8
  130. package/dist/components/editor/type.d.ts +0 -90
  131. package/dist/components/editor/ui/button.d.ts +0 -13
  132. package/dist/components/editor/ui/command.d.ts +0 -81
  133. package/dist/components/editor/ui/dialog.d.ts +0 -19
  134. package/dist/components/editor/ui/dropdown-menu.d.ts +0 -17
  135. package/dist/components/editor/ui/icons/crazy-spinner.d.ts +0 -2
  136. package/dist/components/editor/ui/icons/font-default.d.ts +0 -3
  137. package/dist/components/editor/ui/icons/font-mono.d.ts +0 -3
  138. package/dist/components/editor/ui/icons/font-serif.d.ts +0 -3
  139. package/dist/components/editor/ui/icons/index.d.ts +0 -3
  140. package/dist/components/editor/ui/icons/loading-circle.d.ts +0 -3
  141. package/dist/components/editor/ui/menu.d.ts +0 -1
  142. package/dist/components/editor/ui/popover.d.ts +0 -6
  143. package/dist/components/editor/ui/scroll-area.d.ts +0 -5
  144. package/dist/components/editor/ui/separator.d.ts +0 -4
  145. package/dist/components/editor/ui/tooltip.d.ts +0 -3
@@ -0,0 +1,97 @@
1
+ import { Editor } from '@tiptap/react';
2
+ export type ListType = "bulletList" | "orderedList" | "taskList";
3
+ /**
4
+ * Configuration for the list functionality
5
+ */
6
+ export interface UseListConfig {
7
+ /**
8
+ * The Tiptap editor instance.
9
+ */
10
+ editor?: Editor | null;
11
+ /**
12
+ * The type of list to toggle.
13
+ */
14
+ type: ListType;
15
+ /**
16
+ * Whether the button should hide when list is not available.
17
+ * @default false
18
+ */
19
+ hideWhenUnavailable?: boolean;
20
+ /**
21
+ * Callback function called after a successful toggle.
22
+ */
23
+ onToggled?: () => void;
24
+ }
25
+ export declare const listIcons: {
26
+ bulletList: import('@remixicon/react').RemixiconComponentType;
27
+ orderedList: import('@remixicon/react').RemixiconComponentType;
28
+ taskList: import('@remixicon/react').RemixiconComponentType;
29
+ };
30
+ export declare const listLabels: Record<ListType, string>;
31
+ export declare const LIST_SHORTCUT_KEYS: Record<ListType, string>;
32
+ /**
33
+ * Checks if a list can be toggled in the current editor state
34
+ */
35
+ export declare function canToggleList(editor: Editor | null, type: ListType, turnInto?: boolean): boolean;
36
+ /**
37
+ * Checks if list is currently active
38
+ */
39
+ export declare function isListActive(editor: Editor | null, type: ListType): boolean;
40
+ /**
41
+ * Toggles list in the editor
42
+ */
43
+ export declare function toggleList(editor: Editor | null, type: ListType): boolean;
44
+ /**
45
+ * Determines if the list button should be shown
46
+ */
47
+ export declare function shouldShowButton(props: {
48
+ editor: Editor | null;
49
+ type: ListType;
50
+ hideWhenUnavailable: boolean;
51
+ }): boolean;
52
+ /**
53
+ * Custom hook that provides list functionality for Tiptap editor
54
+ *
55
+ * @example
56
+ * ```tsx
57
+ * // Simple usage
58
+ * function MySimpleListButton() {
59
+ * const { isVisible, handleToggle, isActive } = useList({ type: "bulletList" })
60
+ *
61
+ * if (!isVisible) return null
62
+ *
63
+ * return <button onClick={handleToggle}>Bullet List</button>
64
+ * }
65
+ *
66
+ * // Advanced usage with configuration
67
+ * function MyAdvancedListButton() {
68
+ * const { isVisible, handleToggle, label, isActive } = useList({
69
+ * type: "orderedList",
70
+ * editor: myEditor,
71
+ * hideWhenUnavailable: true,
72
+ * onToggled: () => console.log('List toggled!')
73
+ * })
74
+ *
75
+ * if (!isVisible) return null
76
+ *
77
+ * return (
78
+ * <MyButton
79
+ * onClick={handleToggle}
80
+ * aria-label={label}
81
+ * aria-pressed={isActive}
82
+ * >
83
+ * Toggle List
84
+ * </MyButton>
85
+ * )
86
+ * }
87
+ * ```
88
+ */
89
+ export declare function useList(config: UseListConfig): {
90
+ isVisible: boolean;
91
+ isActive: boolean;
92
+ handleToggle: () => boolean;
93
+ canToggle: boolean;
94
+ label: string;
95
+ shortcutKeys: string;
96
+ Icon: import('@remixicon/react').RemixiconComponentType;
97
+ };
@@ -0,0 +1 @@
1
+ export * from './list-dropdown-menu';
@@ -0,0 +1,29 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { ListType } from '../list-button';
3
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
4
+ export interface ListDropdownMenuProps extends Omit<ButtonProps, "type"> {
5
+ /**
6
+ * The Tiptap editor instance.
7
+ */
8
+ editor?: Editor;
9
+ /**
10
+ * The list types to display in the dropdown.
11
+ */
12
+ types?: ListType[];
13
+ /**
14
+ * Whether the dropdown should be hidden when no list types are available
15
+ * @default false
16
+ */
17
+ hideWhenUnavailable?: boolean;
18
+ /**
19
+ * Callback for when the dropdown opens or closes
20
+ */
21
+ onOpenChange?: (isOpen: boolean) => void;
22
+ /**
23
+ * Whether to render the dropdown menu in a portal
24
+ * @default false
25
+ */
26
+ portal?: boolean;
27
+ }
28
+ export declare function ListDropdownMenu({ editor: providedEditor, types, hideWhenUnavailable, onOpenChange, portal, ...props }: ListDropdownMenuProps): import("react/jsx-runtime").JSX.Element | null;
29
+ export default ListDropdownMenu;
@@ -0,0 +1,94 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { ListType } from '../list-button';
3
+ /**
4
+ * Configuration for the list dropdown menu functionality
5
+ */
6
+ export interface UseListDropdownMenuConfig {
7
+ /**
8
+ * The Tiptap editor instance.
9
+ */
10
+ editor?: Editor | null;
11
+ /**
12
+ * The list types to display in the dropdown.
13
+ * @default ["bulletList", "orderedList", "taskList"]
14
+ */
15
+ types?: ListType[];
16
+ /**
17
+ * Whether the dropdown should be hidden when no list types are available
18
+ * @default false
19
+ */
20
+ hideWhenUnavailable?: boolean;
21
+ }
22
+ export interface ListOption {
23
+ label: string;
24
+ type: ListType;
25
+ icon: React.ElementType;
26
+ }
27
+ export declare const listOptions: ListOption[];
28
+ export declare function canToggleAnyList(editor: Editor | null, listTypes: ListType[]): boolean;
29
+ export declare function isAnyListActive(editor: Editor | null, listTypes: ListType[]): boolean;
30
+ export declare function getFilteredListOptions(availableTypes: ListType[]): typeof listOptions;
31
+ export declare function shouldShowListDropdown(params: {
32
+ editor: Editor | null;
33
+ listTypes: ListType[];
34
+ hideWhenUnavailable: boolean;
35
+ listInSchema: boolean;
36
+ canToggleAny: boolean;
37
+ }): boolean;
38
+ /**
39
+ * Gets the currently active list type from the available types
40
+ */
41
+ export declare function getActiveListType(editor: Editor | null, availableTypes: ListType[]): ListType | undefined;
42
+ /**
43
+ * Custom hook that provides list dropdown menu functionality for Tiptap editor
44
+ *
45
+ * @example
46
+ * ```tsx
47
+ * // Simple usage
48
+ * function MyListDropdown() {
49
+ * const {
50
+ * isVisible,
51
+ * activeType,
52
+ * isAnyActive,
53
+ * canToggleAny,
54
+ * filteredLists,
55
+ * } = useListDropdownMenu()
56
+ *
57
+ * if (!isVisible) return null
58
+ *
59
+ * return (
60
+ * <DropdownMenu>
61
+ * // dropdown content
62
+ * </DropdownMenu>
63
+ * )
64
+ * }
65
+ *
66
+ * // Advanced usage with configuration
67
+ * function MyAdvancedListDropdown() {
68
+ * const {
69
+ * isVisible,
70
+ * activeType,
71
+ * } = useListDropdownMenu({
72
+ * editor: myEditor,
73
+ * types: ["bulletList", "orderedList"],
74
+ * hideWhenUnavailable: true,
75
+ * })
76
+ *
77
+ * // component implementation
78
+ * }
79
+ * ```
80
+ */
81
+ export declare function useListDropdownMenu(config?: UseListDropdownMenuConfig): {
82
+ isVisible: boolean;
83
+ activeType: ListType | undefined;
84
+ isActive: boolean;
85
+ canToggle: boolean;
86
+ types: ListType[];
87
+ filteredLists: {
88
+ label: string;
89
+ type: ListType;
90
+ icon: React.ElementType;
91
+ }[];
92
+ label: string;
93
+ Icon: import('@remixicon/react').RemixiconComponentType;
94
+ };
@@ -0,0 +1,2 @@
1
+ export * from './mark-button';
2
+ export * from './use-mark';
@@ -0,0 +1,23 @@
1
+ import { Mark, UseMarkConfig } from './use-mark';
2
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
3
+ export interface MarkButtonProps extends Omit<ButtonProps, "type">, UseMarkConfig {
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 MarkShortcutBadge({ type, shortcutKeys, }: {
15
+ type: Mark;
16
+ shortcutKeys?: string;
17
+ }): import("react/jsx-runtime").JSX.Element;
18
+ /**
19
+ * Button component for toggling marks in a Tiptap editor.
20
+ *
21
+ * For custom button implementations, use the `useMark` hook instead.
22
+ */
23
+ export declare const MarkButton: import('react').ForwardRefExoticComponent<MarkButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,104 @@
1
+ import { Editor } from '@tiptap/react';
2
+ export type Mark = "bold" | "italic" | "strike" | "code" | "underline" | "superscript" | "subscript";
3
+ /**
4
+ * Configuration for the mark functionality
5
+ */
6
+ export interface UseMarkConfig {
7
+ /**
8
+ * The Tiptap editor instance.
9
+ */
10
+ editor?: Editor | null;
11
+ /**
12
+ * The type of mark to toggle
13
+ */
14
+ type: Mark;
15
+ /**
16
+ * Whether the button should hide when mark is not available.
17
+ * @default false
18
+ */
19
+ hideWhenUnavailable?: boolean;
20
+ /**
21
+ * Callback function called after a successful mark toggle.
22
+ */
23
+ onToggled?: () => void;
24
+ }
25
+ export declare const markIcons: {
26
+ bold: import('@remixicon/react').RemixiconComponentType;
27
+ italic: import('@remixicon/react').RemixiconComponentType;
28
+ underline: import('@remixicon/react').RemixiconComponentType;
29
+ strike: import('@remixicon/react').RemixiconComponentType;
30
+ code: import('@remixicon/react').RemixiconComponentType;
31
+ superscript: import('@remixicon/react').RemixiconComponentType;
32
+ subscript: import('@remixicon/react').RemixiconComponentType;
33
+ };
34
+ export declare const MARK_SHORTCUT_KEYS: Record<Mark, string>;
35
+ /**
36
+ * Checks if a mark can be toggled in the current editor state
37
+ */
38
+ export declare function canToggleMark(editor: Editor | null, type: Mark): boolean;
39
+ /**
40
+ * Checks if a mark is currently active
41
+ */
42
+ export declare function isMarkActive(editor: Editor | null, type: Mark): boolean;
43
+ /**
44
+ * Toggles a mark in the editor
45
+ */
46
+ export declare function toggleMark(editor: Editor | null, type: Mark): boolean;
47
+ /**
48
+ * Determines if the mark button should be shown
49
+ */
50
+ export declare function shouldShowButton(props: {
51
+ editor: Editor | null;
52
+ type: Mark;
53
+ hideWhenUnavailable: boolean;
54
+ }): boolean;
55
+ /**
56
+ * Gets the formatted mark name
57
+ */
58
+ export declare function getFormattedMarkName(type: Mark): string;
59
+ /**
60
+ * Custom hook that provides mark functionality for Tiptap editor
61
+ *
62
+ * @example
63
+ * ```tsx
64
+ * // Simple usage
65
+ * function MySimpleBoldButton() {
66
+ * const { isVisible, handleMark } = useMark({ type: "bold" })
67
+ *
68
+ * if (!isVisible) return null
69
+ *
70
+ * return <button onClick={handleMark}>Bold</button>
71
+ * }
72
+ *
73
+ * // Advanced usage with configuration
74
+ * function MyAdvancedItalicButton() {
75
+ * const { isVisible, handleMark, label, isActive } = useMark({
76
+ * editor: myEditor,
77
+ * type: "italic",
78
+ * hideWhenUnavailable: true,
79
+ * onToggled: () => console.log('Mark toggled!')
80
+ * })
81
+ *
82
+ * if (!isVisible) return null
83
+ *
84
+ * return (
85
+ * <MyButton
86
+ * onClick={handleMark}
87
+ * aria-pressed={isActive}
88
+ * aria-label={label}
89
+ * >
90
+ * Italic
91
+ * </MyButton>
92
+ * )
93
+ * }
94
+ * ```
95
+ */
96
+ export declare function useMark(config: UseMarkConfig): {
97
+ isVisible: boolean;
98
+ isActive: boolean;
99
+ handleMark: () => boolean;
100
+ canToggle: boolean;
101
+ label: string;
102
+ shortcutKeys: string;
103
+ Icon: import('@remixicon/react').RemixiconComponentType;
104
+ };
@@ -0,0 +1,2 @@
1
+ export * from './text-align-button';
2
+ export * from './use-text-align';
@@ -0,0 +1,30 @@
1
+ import { TextAlign, UseTextAlignConfig } from './use-text-align';
2
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
3
+ type IconProps = React.SVGProps<SVGSVGElement>;
4
+ type IconComponent = ({ className, ...props }: IconProps) => React.ReactElement;
5
+ export interface TextAlignButtonProps extends Omit<ButtonProps, "type">, UseTextAlignConfig {
6
+ /**
7
+ * Optional text to display alongside the icon.
8
+ */
9
+ text?: string;
10
+ /**
11
+ * Optional show shortcut keys in the button.
12
+ * @default false
13
+ */
14
+ showShortcut?: boolean;
15
+ /**
16
+ * Optional custom icon component to render instead of the default.
17
+ */
18
+ icon?: React.MemoExoticComponent<IconComponent> | React.FC<IconProps>;
19
+ }
20
+ export declare function TextAlignShortcutBadge({ align, shortcutKeys, }: {
21
+ align: TextAlign;
22
+ shortcutKeys?: string;
23
+ }): import("react/jsx-runtime").JSX.Element;
24
+ /**
25
+ * Button component for setting text alignment in a Tiptap editor.
26
+ *
27
+ * For custom button implementations, use the `useTextAlign` hook instead.
28
+ */
29
+ export declare const TextAlignButton: import('react').ForwardRefExoticComponent<TextAlignButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
30
+ export {};
@@ -0,0 +1,101 @@
1
+ import { ChainedCommands, Editor } from '@tiptap/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 Tiptap 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('@remixicon/react').RemixiconComponentType;
28
+ center: import('@remixicon/react').RemixiconComponentType;
29
+ right: import('@remixicon/react').RemixiconComponentType;
30
+ justify: import('@remixicon/react').RemixiconComponentType;
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 Tiptap 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('@remixicon/react').RemixiconComponentType;
101
+ };
@@ -0,0 +1,2 @@
1
+ export * from './undo-redo-button';
2
+ export * from './use-undo-redo';
@@ -0,0 +1,23 @@
1
+ import { UndoRedoAction, UseUndoRedoConfig } from './use-undo-redo';
2
+ import { ButtonProps } from '../../tiptap-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-runtime").JSX.Element;
18
+ /**
19
+ * Button component for triggering undo/redo actions in a Tiptap 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 '@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('@remixicon/react').RemixiconComponentType;
29
+ redo: import('@remixicon/react').RemixiconComponentType;
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('@remixicon/react').RemixiconComponentType;
90
+ };
@@ -0,0 +1,8 @@
1
+ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
2
+ variant?: "ghost" | "white" | "gray" | "green" | "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,14 @@
1
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
2
+ className?: string;
3
+ showTooltip?: boolean;
4
+ tooltip?: React.ReactNode;
5
+ shortcutKeys?: string;
6
+ }
7
+ export declare const ShortcutDisplay: React.FC<{
8
+ shortcuts: string[];
9
+ }>;
10
+ export declare const Button: import('react').ForwardRefExoticComponent<ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
11
+ export declare const ButtonGroup: import('react').ForwardRefExoticComponent<Omit<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & {
12
+ orientation?: "horizontal" | "vertical";
13
+ }, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
14
+ export default Button;
@@ -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,16 @@
1
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
2
+ declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
3
+ declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
4
+ declare const DropdownMenuTrigger: import('react').ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuTriggerProps & import('react').RefAttributes<HTMLButtonElement>, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
5
+ declare const DropdownMenuGroup: import('react').ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & import('react').RefAttributes<HTMLDivElement>>;
6
+ declare const DropdownMenuSub: import('react').FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
7
+ declare const DropdownMenuRadioGroup: import('react').ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & import('react').RefAttributes<HTMLDivElement>>;
8
+ declare const DropdownMenuItem: import('react').ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuItemProps & import('react').RefAttributes<HTMLDivElement>>;
9
+ declare const DropdownMenuSubTrigger: import('react').ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & import('react').RefAttributes<HTMLDivElement>>;
10
+ declare const DropdownMenuSubContent: import('react').ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
11
+ portal?: boolean | React.ComponentProps<typeof DropdownMenuPortal>;
12
+ } & import('react').RefAttributes<HTMLDivElement>>;
13
+ declare const DropdownMenuContent: import('react').ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
14
+ portal?: boolean;
15
+ } & import('react').RefAttributes<HTMLDivElement>>;
16
+ export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuGroup, DropdownMenuSub, DropdownMenuPortal, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };