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,82 @@
1
+ import { Editor } from '@tiptap/react';
2
+ export declare const COLOR_HIGHLIGHT_SHORTCUT_KEY = "mod+shift+h";
3
+ export declare const HIGHLIGHT_COLORS: {
4
+ label: string;
5
+ value: string;
6
+ border: string;
7
+ }[];
8
+ export type HighlightColor = (typeof HIGHLIGHT_COLORS)[number];
9
+ export type HighlightMode = "mark" | "node";
10
+ /**
11
+ * Configuration for the color highlight functionality
12
+ */
13
+ export interface UseColorHighlightConfig {
14
+ /**
15
+ * The Tiptap editor instance.
16
+ */
17
+ editor?: Editor | null;
18
+ /**
19
+ * The color to apply when toggling the highlight.
20
+ */
21
+ highlightColor?: string;
22
+ /**
23
+ * Optional label to display alongside the icon.
24
+ */
25
+ label?: string;
26
+ /**
27
+ * Whether the button should hide when the mark is not available.
28
+ * @default false
29
+ */
30
+ hideWhenUnavailable?: boolean;
31
+ /**
32
+ * The highlighting mode to use.
33
+ * - "mark": Uses the highlight mark extension (default)
34
+ * - "node": Uses the node background extension
35
+ * @default "mark"
36
+ */
37
+ mode?: HighlightMode;
38
+ /**
39
+ * Called when the highlight is applied.
40
+ */
41
+ onApplied?: ({ color, label, mode }: {
42
+ color: string;
43
+ label: string;
44
+ mode: HighlightMode;
45
+ }) => void;
46
+ }
47
+ export declare function pickHighlightColorsByValue(values: string[]): {
48
+ label: string;
49
+ value: string;
50
+ border: string;
51
+ }[];
52
+ /**
53
+ * Checks if highlight can be applied based on the mode and current editor state
54
+ */
55
+ export declare function canColorHighlight(editor: Editor | null, mode?: HighlightMode): boolean;
56
+ /**
57
+ * Checks if highlight is currently active
58
+ */
59
+ export declare function isColorHighlightActive(editor: Editor | null, highlightColor?: string, mode?: HighlightMode): boolean;
60
+ /**
61
+ * Removes highlight based on the mode
62
+ */
63
+ export declare function removeHighlight(editor: Editor | null, mode?: HighlightMode): boolean;
64
+ /**
65
+ * Determines if the highlight button should be shown
66
+ */
67
+ export declare function shouldShowButton(props: {
68
+ editor: Editor | null;
69
+ hideWhenUnavailable: boolean;
70
+ mode: HighlightMode;
71
+ }): boolean;
72
+ export declare function useColorHighlight(config: UseColorHighlightConfig): {
73
+ isVisible: boolean;
74
+ isActive: boolean;
75
+ handleColorHighlight: () => boolean;
76
+ handleRemoveHighlight: () => boolean;
77
+ canColorHighlight: boolean;
78
+ label: string;
79
+ shortcutKeys: string;
80
+ Icon: import('@remixicon/react').RemixiconComponentType;
81
+ mode: HighlightMode;
82
+ };
@@ -0,0 +1,25 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
3
+ import { HighlightColor, UseColorHighlightConfig } from '../color-highlight-button';
4
+ export interface ColorHighlightPopoverContentProps {
5
+ /**
6
+ * The Tiptap editor instance.
7
+ */
8
+ editor?: Editor | null;
9
+ /**
10
+ * Optional colors to use in the highlight popover.
11
+ * If not provided, defaults to a predefined set of colors.
12
+ */
13
+ colors?: HighlightColor[];
14
+ }
15
+ export interface ColorHighlightPopoverProps extends Omit<ButtonProps, "type">, Pick<UseColorHighlightConfig, "editor" | "hideWhenUnavailable" | "onApplied"> {
16
+ /**
17
+ * Optional colors to use in the highlight popover.
18
+ * If not provided, defaults to a predefined set of colors.
19
+ */
20
+ colors?: HighlightColor[];
21
+ }
22
+ export declare const ColorHighlightPopoverButton: import('react').ForwardRefExoticComponent<ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
23
+ export declare function ColorHighlightPopoverContent({ editor, colors, }: ColorHighlightPopoverContentProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function ColorHighlightPopover({ editor: providedEditor, colors, hideWhenUnavailable, onApplied, ...props }: ColorHighlightPopoverProps): import("react/jsx-runtime").JSX.Element | null;
25
+ export default ColorHighlightPopover;
@@ -0,0 +1 @@
1
+ export * from './color-highlight-popover';
@@ -0,0 +1,23 @@
1
+ import { Level, UseHeadingConfig } from './use-heading';
2
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
3
+ export interface HeadingButtonProps extends Omit<ButtonProps, "type">, UseHeadingConfig {
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 HeadingShortcutBadge({ level, shortcutKeys, }: {
15
+ level: Level;
16
+ shortcutKeys?: string;
17
+ }): import("react/jsx-runtime").JSX.Element;
18
+ /**
19
+ * Button component for toggling heading in a Tiptap editor.
20
+ *
21
+ * For custom button implementations, use the `useHeading` hook instead.
22
+ */
23
+ export declare const HeadingButton: import('react').ForwardRefExoticComponent<HeadingButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,2 @@
1
+ export * from './heading-button';
2
+ export * from './use-heading';
@@ -0,0 +1,108 @@
1
+ import { Editor } from '@tiptap/react';
2
+ export type Level = 1 | 2 | 3 | 4 | 5 | 6;
3
+ /**
4
+ * Configuration for the heading functionality
5
+ */
6
+ export interface UseHeadingConfig {
7
+ /**
8
+ * The Tiptap editor instance.
9
+ */
10
+ editor?: Editor | null;
11
+ /**
12
+ * The heading level.
13
+ */
14
+ level: Level;
15
+ /**
16
+ * Whether the button should hide when heading is not available.
17
+ * @default false
18
+ */
19
+ hideWhenUnavailable?: boolean;
20
+ /**
21
+ * Callback function called after a successful heading toggle.
22
+ */
23
+ onToggled?: () => void;
24
+ }
25
+ export declare const headingIcons: {
26
+ 1: import('@remixicon/react').RemixiconComponentType;
27
+ 2: import('@remixicon/react').RemixiconComponentType;
28
+ 3: import('@remixicon/react').RemixiconComponentType;
29
+ 4: import('@remixicon/react').RemixiconComponentType;
30
+ 5: import('@remixicon/react').RemixiconComponentType;
31
+ 6: import('@remixicon/react').RemixiconComponentType;
32
+ };
33
+ export declare const HEADING_SHORTCUT_KEYS: Record<Level, string>;
34
+ /**
35
+ * Checks if heading can be toggled in the current editor state
36
+ */
37
+ export declare function canToggle(editor: Editor | null, level?: Level, turnInto?: boolean): boolean;
38
+ /**
39
+ * Checks if heading is currently active
40
+ */
41
+ export declare function isHeadingActive(editor: Editor | null, level?: Level | Level[]): boolean;
42
+ /**
43
+ * Toggles heading in the editor
44
+ */
45
+ export declare function toggleHeading(editor: Editor | null, level: Level | Level[]): boolean;
46
+ /**
47
+ * Determines if the heading button should be shown
48
+ */
49
+ export declare function shouldShowButton(props: {
50
+ editor: Editor | null;
51
+ level?: Level | Level[];
52
+ hideWhenUnavailable: boolean;
53
+ }): boolean;
54
+ /**
55
+ * Custom hook that provides heading functionality for Tiptap editor
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * // Simple usage
60
+ * function MySimpleHeadingButton() {
61
+ * const { isVisible, isActive, handleToggle, Icon } = useHeading({ level: 1 })
62
+ *
63
+ * if (!isVisible) return null
64
+ *
65
+ * return (
66
+ * <button
67
+ * onClick={handleToggle}
68
+ * aria-pressed={isActive}
69
+ * >
70
+ * <Icon />
71
+ * Heading 1
72
+ * </button>
73
+ * )
74
+ * }
75
+ *
76
+ * // Advanced usage with configuration
77
+ * function MyAdvancedHeadingButton() {
78
+ * const { isVisible, isActive, handleToggle, label, Icon } = useHeading({
79
+ * level: 2,
80
+ * editor: myEditor,
81
+ * hideWhenUnavailable: true,
82
+ * onToggled: (isActive) => console.log('Heading toggled:', isActive)
83
+ * })
84
+ *
85
+ * if (!isVisible) return null
86
+ *
87
+ * return (
88
+ * <MyButton
89
+ * onClick={handleToggle}
90
+ * aria-label={label}
91
+ * aria-pressed={isActive}
92
+ * >
93
+ * <Icon />
94
+ * Toggle Heading 2
95
+ * </MyButton>
96
+ * )
97
+ * }
98
+ * ```
99
+ */
100
+ export declare function useHeading(config: UseHeadingConfig): {
101
+ isVisible: boolean;
102
+ isActive: boolean;
103
+ handleToggle: () => boolean;
104
+ canToggle: boolean;
105
+ label: string;
106
+ shortcutKeys: string;
107
+ Icon: import('@remixicon/react').RemixiconComponentType;
108
+ };
@@ -0,0 +1,20 @@
1
+ import { UseHeadingDropdownMenuConfig } from './use-heading-dropdown-menu';
2
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
3
+ export interface HeadingDropdownMenuProps extends Omit<ButtonProps, "type">, UseHeadingDropdownMenuConfig {
4
+ /**
5
+ * Whether to render the dropdown menu in a portal
6
+ * @default false
7
+ */
8
+ portal?: boolean;
9
+ /**
10
+ * Callback for when the dropdown opens or closes
11
+ */
12
+ onOpenChange?: (isOpen: boolean) => void;
13
+ }
14
+ /**
15
+ * Dropdown menu component for selecting heading levels in a Tiptap editor.
16
+ *
17
+ * For custom dropdown implementations, use the `useHeadingDropdownMenu` hook instead.
18
+ */
19
+ export declare const HeadingDropdownMenu: import('react').ForwardRefExoticComponent<HeadingDropdownMenuProps & import('react').RefAttributes<HTMLButtonElement>>;
20
+ export default HeadingDropdownMenu;
@@ -0,0 +1,2 @@
1
+ export * from './heading-dropdown-menu';
2
+ export * from './use-heading-dropdown-menu';
@@ -0,0 +1,73 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { Level } from '../heading-button';
3
+ /**
4
+ * Configuration for the heading dropdown menu functionality
5
+ */
6
+ export interface UseHeadingDropdownMenuConfig {
7
+ /**
8
+ * The Tiptap editor instance.
9
+ */
10
+ editor?: Editor | null;
11
+ /**
12
+ * Available heading levels to show in the dropdown
13
+ * @default [1, 2, 3, 4, 5, 6]
14
+ */
15
+ levels?: Level[];
16
+ /**
17
+ * Whether the dropdown should hide when headings are not available.
18
+ * @default false
19
+ */
20
+ hideWhenUnavailable?: boolean;
21
+ }
22
+ /**
23
+ * Gets the currently active heading level from the available levels
24
+ */
25
+ export declare function getActiveHeadingLevel(editor: Editor | null, levels?: Level[]): Level | undefined;
26
+ /**
27
+ * Custom hook that provides heading dropdown menu functionality for Tiptap editor
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * // Simple usage
32
+ * function MyHeadingDropdown() {
33
+ * const {
34
+ * isVisible,
35
+ * activeLevel,
36
+ * isAnyHeadingActive,
37
+ * canToggle,
38
+ * levels,
39
+ * } = useHeadingDropdownMenu()
40
+ *
41
+ * if (!isVisible) return null
42
+ *
43
+ * return (
44
+ * <DropdownMenu>
45
+ * // dropdown content
46
+ * </DropdownMenu>
47
+ * )
48
+ * }
49
+ *
50
+ * // Advanced usage with configuration
51
+ * function MyAdvancedHeadingDropdown() {
52
+ * const {
53
+ * isVisible,
54
+ * activeLevel,
55
+ * } = useHeadingDropdownMenu({
56
+ * editor: myEditor,
57
+ * levels: [1, 2, 3],
58
+ * hideWhenUnavailable: true,
59
+ * })
60
+ *
61
+ * // component implementation
62
+ * }
63
+ * ```
64
+ */
65
+ export declare function useHeadingDropdownMenu(config?: UseHeadingDropdownMenuConfig): {
66
+ isVisible: boolean;
67
+ activeLevel: Level | undefined;
68
+ isActive: boolean;
69
+ canToggle: boolean;
70
+ levels: Level[];
71
+ label: string;
72
+ Icon: import('@remixicon/react').RemixiconComponentType;
73
+ };
@@ -0,0 +1,29 @@
1
+ import { UseImageUploadConfig } from './use-image-upload';
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 ImageUploadButtonProps extends Omit<ButtonProps, "type">, UseImageUploadConfig {
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 ImageShortcutBadge({ shortcutKeys }: {
21
+ shortcutKeys?: string;
22
+ }): import("react/jsx-runtime").JSX.Element;
23
+ /**
24
+ * Button component for uploading/inserting images in a Tiptap editor.
25
+ *
26
+ * For custom button implementations, use the `useImage` hook instead.
27
+ */
28
+ export declare const ImageUploadButton: import('react').ForwardRefExoticComponent<ImageUploadButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
29
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './image-upload-button';
2
+ export * from './use-image-upload';
@@ -0,0 +1,84 @@
1
+ import { Editor } from '@tiptap/react';
2
+ export declare const IMAGE_UPLOAD_SHORTCUT_KEY = "mod+shift+i";
3
+ /**
4
+ * Configuration for the image upload functionality
5
+ */
6
+ export interface UseImageUploadConfig {
7
+ /**
8
+ * The Tiptap editor instance.
9
+ */
10
+ editor?: Editor | null;
11
+ /**
12
+ * Whether the button should hide when insertion is not available.
13
+ * @default false
14
+ */
15
+ hideWhenUnavailable?: boolean;
16
+ /**
17
+ * Callback function called after a successful image insertion.
18
+ */
19
+ onInserted?: () => void;
20
+ }
21
+ /**
22
+ * Checks if image can be inserted in the current editor state
23
+ */
24
+ export declare function canInsertImage(editor: Editor | null): boolean;
25
+ /**
26
+ * Checks if image is currently active
27
+ */
28
+ export declare function isImageActive(editor: Editor | null): boolean;
29
+ /**
30
+ * Inserts an image in the editor
31
+ */
32
+ export declare function insertImage(editor: Editor | null): boolean;
33
+ /**
34
+ * Determines if the image button should be shown
35
+ */
36
+ export declare function shouldShowButton(props: {
37
+ editor: Editor | null;
38
+ hideWhenUnavailable: boolean;
39
+ }): boolean;
40
+ /**
41
+ * Custom hook that provides image functionality for Tiptap editor
42
+ *
43
+ * @example
44
+ * ```tsx
45
+ * // Simple usage - no params needed
46
+ * function MySimpleImageButton() {
47
+ * const { isVisible, handleImage } = useImage()
48
+ *
49
+ * if (!isVisible) return null
50
+ *
51
+ * return <button onClick={handleImage}>Add Image</button>
52
+ * }
53
+ *
54
+ * // Advanced usage with configuration
55
+ * function MyAdvancedImageButton() {
56
+ * const { isVisible, handleImage, label, isActive } = useImage({
57
+ * editor: myEditor,
58
+ * hideWhenUnavailable: true,
59
+ * onInserted: () => console.log('Image inserted!')
60
+ * })
61
+ *
62
+ * if (!isVisible) return null
63
+ *
64
+ * return (
65
+ * <MyButton
66
+ * onClick={handleImage}
67
+ * aria-pressed={isActive}
68
+ * aria-label={label}
69
+ * >
70
+ * Add Image
71
+ * </MyButton>
72
+ * )
73
+ * }
74
+ * ```
75
+ */
76
+ export declare function useImageUpload(config?: UseImageUploadConfig): {
77
+ isVisible: boolean;
78
+ isActive: boolean;
79
+ handleImage: () => boolean;
80
+ canInsert: boolean;
81
+ label: string;
82
+ shortcutKeys: string;
83
+ Icon: import('@remixicon/react').RemixiconComponentType;
84
+ };
@@ -0,0 +1,2 @@
1
+ export * from './link-popover';
2
+ export * from './use-link-popover';
@@ -0,0 +1,57 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { UseLinkPopoverConfig } from './use-link-popover';
3
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
4
+ export interface LinkMainProps {
5
+ /**
6
+ * The URL to set for the link.
7
+ */
8
+ url: string;
9
+ /**
10
+ * Function to update the URL state.
11
+ */
12
+ setUrl: React.Dispatch<React.SetStateAction<string | null>>;
13
+ /**
14
+ * Function to set the link in the editor.
15
+ */
16
+ setLink: () => void;
17
+ /**
18
+ * Function to remove the link from the editor.
19
+ */
20
+ removeLink: () => void;
21
+ /**
22
+ * Function to open the link.
23
+ */
24
+ openLink: () => void;
25
+ /**
26
+ * Whether the link is currently active in the editor.
27
+ */
28
+ isActive: boolean;
29
+ }
30
+ export interface LinkPopoverProps extends Omit<ButtonProps, "type">, UseLinkPopoverConfig {
31
+ /**
32
+ * Callback for when the popover opens or closes.
33
+ */
34
+ onOpenChange?: (isOpen: boolean) => void;
35
+ /**
36
+ * Whether to automatically open the popover when a link is active.
37
+ * @default true
38
+ */
39
+ autoOpenOnLinkActive?: boolean;
40
+ }
41
+ /**
42
+ * Link button component for triggering the link popover
43
+ */
44
+ export declare const LinkButton: import('react').ForwardRefExoticComponent<ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
45
+ /**
46
+ * Link content component for standalone use
47
+ */
48
+ export declare const LinkContent: React.FC<{
49
+ editor?: Editor | null;
50
+ }>;
51
+ /**
52
+ * Link popover component for Tiptap editors.
53
+ *
54
+ * For custom popover implementations, use the `useLinkPopover` hook instead.
55
+ */
56
+ export declare const LinkPopover: import('react').ForwardRefExoticComponent<LinkPopoverProps & import('react').RefAttributes<HTMLButtonElement>>;
57
+ export default LinkPopover;
@@ -0,0 +1,117 @@
1
+ import { Editor } from '@tiptap/react';
2
+ /**
3
+ * Configuration for the link popover functionality
4
+ */
5
+ export interface UseLinkPopoverConfig {
6
+ /**
7
+ * The Tiptap editor instance.
8
+ */
9
+ editor?: Editor | null;
10
+ /**
11
+ * Whether to hide the link popover when not available.
12
+ * @default false
13
+ */
14
+ hideWhenUnavailable?: boolean;
15
+ /**
16
+ * Callback function called when the link is set.
17
+ */
18
+ onSetLink?: () => void;
19
+ }
20
+ /**
21
+ * Configuration for the link handler functionality
22
+ */
23
+ export interface LinkHandlerProps {
24
+ /**
25
+ * The Tiptap editor instance.
26
+ */
27
+ editor: Editor | null;
28
+ /**
29
+ * Callback function called when the link is set.
30
+ */
31
+ onSetLink?: () => void;
32
+ }
33
+ /**
34
+ * Checks if a link can be set in the current editor state
35
+ */
36
+ export declare function canSetLink(editor: Editor | null): boolean;
37
+ /**
38
+ * Checks if a link is currently active in the editor
39
+ */
40
+ export declare function isLinkActive(editor: Editor | null): boolean;
41
+ /**
42
+ * Determines if the link button should be shown
43
+ */
44
+ export declare function shouldShowLinkButton(props: {
45
+ editor: Editor | null;
46
+ hideWhenUnavailable: boolean;
47
+ }): boolean;
48
+ /**
49
+ * Custom hook for handling link operations in a Tiptap editor
50
+ */
51
+ export declare function useLinkHandler(props: LinkHandlerProps): {
52
+ url: string;
53
+ setUrl: import('react').Dispatch<import('react').SetStateAction<string | null>>;
54
+ setLink: () => void;
55
+ removeLink: () => void;
56
+ openLink: (target?: string, features?: string) => void;
57
+ };
58
+ /**
59
+ * Custom hook for link popover state management
60
+ */
61
+ export declare function useLinkState(props: {
62
+ editor: Editor | null;
63
+ hideWhenUnavailable: boolean;
64
+ }): {
65
+ isVisible: boolean;
66
+ canSet: boolean;
67
+ isActive: boolean;
68
+ };
69
+ /**
70
+ * Main hook that provides link popover functionality for Tiptap editor
71
+ *
72
+ * @example
73
+ * ```tsx
74
+ * // Simple usage
75
+ * function MyLinkButton() {
76
+ * const { isVisible, canSet, isActive, Icon, label } = useLinkPopover()
77
+ *
78
+ * if (!isVisible) return null
79
+ *
80
+ * return <button disabled={!canSet}>Link</button>
81
+ * }
82
+ *
83
+ * // Advanced usage with configuration
84
+ * function MyAdvancedLinkButton() {
85
+ * const { isVisible, canSet, isActive, Icon, label } = useLinkPopover({
86
+ * editor: myEditor,
87
+ * hideWhenUnavailable: true,
88
+ * onSetLink: () => console.log('Link set!')
89
+ * })
90
+ *
91
+ * if (!isVisible) return null
92
+ *
93
+ * return (
94
+ * <MyButton
95
+ * disabled={!canSet}
96
+ * aria-label={label}
97
+ * aria-pressed={isActive}
98
+ * >
99
+ * <Icon />
100
+ * {label}
101
+ * </MyButton>
102
+ * )
103
+ * }
104
+ * ```
105
+ */
106
+ export declare function useLinkPopover(config?: UseLinkPopoverConfig): {
107
+ url: string;
108
+ setUrl: import('react').Dispatch<import('react').SetStateAction<string | null>>;
109
+ setLink: () => void;
110
+ removeLink: () => void;
111
+ openLink: (target?: string, features?: string) => void;
112
+ isVisible: boolean;
113
+ canSet: boolean;
114
+ isActive: boolean;
115
+ label: string;
116
+ Icon: import('@remixicon/react').RemixiconComponentType;
117
+ };
@@ -0,0 +1,2 @@
1
+ export * from './list-button';
2
+ export * from './use-list';
@@ -0,0 +1,23 @@
1
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
2
+ import { ListType, UseListConfig } from './use-list';
3
+ export interface ListButtonProps extends Omit<ButtonProps, "type">, UseListConfig {
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 ListShortcutBadge({ type, shortcutKeys, }: {
15
+ type: ListType;
16
+ shortcutKeys?: string;
17
+ }): import("react/jsx-runtime").JSX.Element;
18
+ /**
19
+ * Button component for toggling lists in a Tiptap editor.
20
+ *
21
+ * For custom button implementations, use the `useList` hook instead.
22
+ */
23
+ export declare const ListButton: import('react').ForwardRefExoticComponent<ListButtonProps & import('react').RefAttributes<HTMLButtonElement>>;