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,3 @@
1
+ declare function Input({ className, type, ...props }: React.ComponentProps<"input">): import("react/jsx-runtime").JSX.Element;
2
+ declare function InputGroup({ className, children, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
3
+ export { Input, InputGroup };
@@ -0,0 +1,6 @@
1
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
2
+ declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
3
+ declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
4
+ declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
5
+ declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): import("react/jsx-runtime").JSX.Element;
6
+ export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
@@ -0,0 +1,6 @@
1
+ export type Orientation = "horizontal" | "vertical";
2
+ export interface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ orientation?: Orientation;
4
+ decorative?: boolean;
5
+ }
6
+ export declare const Separator: import('react').ForwardRefExoticComponent<SeparatorProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,6 @@
1
+ export type SpacerOrientation = "horizontal" | "vertical";
2
+ export interface SpacerProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ orientation?: SpacerOrientation;
4
+ size?: string | number;
5
+ }
6
+ export declare function Spacer({ orientation, size, style, ...props }: SpacerProps): import("react/jsx-runtime").JSX.Element;
@@ -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,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-runtime").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,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 '@tiptap/react';
2
+ export interface CursorVisibilityOptions {
3
+ /**
4
+ * The Tiptap editor instance
5
+ */
6
+ editor?: Editor | null;
7
+ /**
8
+ * Reference to the toolbar element that may obscure the cursor
9
+ */
10
+ overlayHeight?: number;
11
+ }
12
+ /**
13
+ * Custom hook that ensures the cursor remains visible when typing in a Tiptap editor.
14
+ * Automatically scrolls the window when the cursor would be hidden by the toolbar.
15
+ *
16
+ * @param options.editor The Tiptap editor instance
17
+ * @param options.overlayHeight Toolbar height to account for
18
+ * @returns The bounding rect of the body
19
+ */
20
+ export declare function useCursorVisibility({ editor, overlayHeight }: CursorVisibilityOptions): import('./use-element-rect').RectState;
@@ -0,0 +1,35 @@
1
+ export type RectState = Omit<DOMRect, "toJSON">;
2
+ export interface ElementRectOptions {
3
+ /**
4
+ * The element to track. Can be an Element, ref, or selector string.
5
+ * Defaults to document.body if not provided.
6
+ */
7
+ element?: Element | React.RefObject<Element> | string | null;
8
+ /**
9
+ * Whether to enable rect tracking
10
+ */
11
+ enabled?: boolean;
12
+ /**
13
+ * Throttle delay in milliseconds for rect updates
14
+ */
15
+ throttleMs?: number;
16
+ /**
17
+ * Whether to use ResizeObserver for more accurate tracking
18
+ */
19
+ useResizeObserver?: boolean;
20
+ }
21
+ /**
22
+ * Custom hook that tracks an element's bounding rectangle and updates on resize, scroll, etc.
23
+ *
24
+ * @param options Configuration options for element rect tracking
25
+ * @returns The current bounding rectangle of the element
26
+ */
27
+ export declare function useElementRect({ element, enabled, throttleMs, useResizeObserver, }?: ElementRectOptions): RectState;
28
+ /**
29
+ * Convenience hook for tracking document.body rect
30
+ */
31
+ export declare function useBodyRect(options?: Omit<ElementRectOptions, "element">): RectState;
32
+ /**
33
+ * Convenience hook for tracking a ref element's rect
34
+ */
35
+ export declare function useRefRect<T extends Element>(ref: React.RefObject<T>, options?: Omit<ElementRectOptions, "element">): RectState;
@@ -0,0 +1,9 @@
1
+ type BreakpointMode = "min" | "max";
2
+ /**
3
+ * Hook to detect whether the current viewport matches a given breakpoint rule.
4
+ * Example:
5
+ * useIsBreakpoint("max", 768) // true when width < 768
6
+ * useIsBreakpoint("min", 1024) // true when width >= 1024
7
+ */
8
+ export declare function useIsBreakpoint(mode?: BreakpointMode, breakpoint?: number): boolean;
9
+ export {};
@@ -0,0 +1,52 @@
1
+ import { Editor } from '@tiptap/react';
2
+ type Orientation = "horizontal" | "vertical" | "both";
3
+ interface MenuNavigationOptions<T> {
4
+ /**
5
+ * The Tiptap editor instance, if using with a Tiptap editor.
6
+ */
7
+ editor?: Editor | null;
8
+ /**
9
+ * Reference to the container element for handling keyboard events.
10
+ */
11
+ containerRef?: React.RefObject<HTMLElement | null>;
12
+ /**
13
+ * Search query that affects the selected item.
14
+ */
15
+ query?: string;
16
+ /**
17
+ * Array of items to navigate through.
18
+ */
19
+ items: T[];
20
+ /**
21
+ * Callback fired when an item is selected.
22
+ */
23
+ onSelect?: (item: T) => void;
24
+ /**
25
+ * Callback fired when the menu should close.
26
+ */
27
+ onClose?: () => void;
28
+ /**
29
+ * The navigation orientation of the menu.
30
+ * @default "vertical"
31
+ */
32
+ orientation?: Orientation;
33
+ /**
34
+ * Whether to automatically select the first item when the menu opens.
35
+ * @default true
36
+ */
37
+ autoSelectFirstItem?: boolean;
38
+ }
39
+ /**
40
+ * Hook that implements keyboard navigation for dropdown menus and command palettes.
41
+ *
42
+ * Handles arrow keys, tab, home/end, enter for selection, and escape to close.
43
+ * Works with both Tiptap editors and regular DOM elements.
44
+ *
45
+ * @param options - Configuration options for the menu navigation
46
+ * @returns Object containing the selected index and a setter function
47
+ */
48
+ export declare function useMenuNavigation<T>({ editor, containerRef, query, items, onSelect, onClose, orientation, autoSelectFirstItem, }: MenuNavigationOptions<T>): {
49
+ selectedIndex: number | undefined;
50
+ setSelectedIndex: import('react').Dispatch<import('react').SetStateAction<number>>;
51
+ };
52
+ export {};
@@ -0,0 +1,8 @@
1
+ import { RefObject } from 'react';
2
+ type ScrollTarget = RefObject<HTMLElement> | Window | null | undefined;
3
+ interface UseScrollingOptions {
4
+ debounce?: number;
5
+ fallbackToDocument?: boolean;
6
+ }
7
+ export declare function useScrolling(target?: ScrollTarget, options?: UseScrollingOptions): boolean;
8
+ export {};
@@ -0,0 +1,18 @@
1
+ interface ThrottleSettings {
2
+ leading?: boolean | undefined;
3
+ trailing?: boolean | undefined;
4
+ }
5
+ /**
6
+ * A hook that returns a throttled callback function.
7
+ *
8
+ * @param fn The function to throttle
9
+ * @param wait The time in ms to wait before calling the function
10
+ * @param dependencies The dependencies to watch for changes
11
+ * @param options The throttle options
12
+ */
13
+ export declare function useThrottledCallback<T extends (...args: any[]) => any>(fn: T, wait?: number, dependencies?: React.DependencyList, options?: ThrottleSettings): {
14
+ (this: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T>;
15
+ cancel: () => void;
16
+ flush: () => void;
17
+ };
18
+ export default useThrottledCallback;
@@ -0,0 +1,17 @@
1
+ import { Editor } from '@tiptap/react';
2
+ /**
3
+ * Hook that provides access to a Tiptap editor instance.
4
+ *
5
+ * Accepts an optional editor instance directly, or falls back to retrieving
6
+ * the editor from the Tiptap context if available. This allows components
7
+ * to work both when given an editor directly and when used within a Tiptap
8
+ * editor context.
9
+ *
10
+ * @param providedEditor - Optional editor instance to use instead of the context editor
11
+ * @returns The provided editor or the editor from context, whichever is available
12
+ */
13
+ export declare function useTiptapEditor(providedEditor?: Editor | null): {
14
+ editor: Editor | null;
15
+ editorState?: Editor["state"];
16
+ canCommand?: Editor["can"];
17
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hook that executes a callback when the component unmounts.
3
+ *
4
+ * @param callback Function to be called on component unmount
5
+ */
6
+ export declare const useUnmount: (callback: (...args: Array<any>) => any) => void;
7
+ export default useUnmount;
@@ -0,0 +1,35 @@
1
+ export interface WindowSizeState {
2
+ /**
3
+ * The width of the window's visual viewport in pixels.
4
+ */
5
+ width: number;
6
+ /**
7
+ * The height of the window's visual viewport in pixels.
8
+ */
9
+ height: number;
10
+ /**
11
+ * The distance from the top of the visual viewport to the top of the layout viewport.
12
+ * Particularly useful for handling mobile keyboard appearance.
13
+ */
14
+ offsetTop: number;
15
+ /**
16
+ * The distance from the left of the visual viewport to the left of the layout viewport.
17
+ */
18
+ offsetLeft: number;
19
+ /**
20
+ * The scale factor of the visual viewport.
21
+ * This is useful for scaling elements based on the current zoom level.
22
+ */
23
+ scale: number;
24
+ }
25
+ /**
26
+ * Hook that tracks the window's visual viewport dimensions, position, and provides
27
+ * a CSS transform for positioning elements.
28
+ *
29
+ * Uses the Visual Viewport API to get accurate measurements, especially important
30
+ * for mobile devices where virtual keyboards can change the visible area.
31
+ * Only updates state when values actually change to optimize performance.
32
+ *
33
+ * @returns An object containing viewport properties and a CSS transform string
34
+ */
35
+ export declare function useWindowSize(): WindowSizeState;
@@ -0,0 +1,107 @@
1
+ declare const _default: {
2
+ "editor": {
3
+ "contentAriaLabel": "Main content area, start typing to enter text."
4
+ },
5
+ "toolbar": {
6
+ "add": "Add",
7
+ "undo": "Undo",
8
+ "redo": "Redo",
9
+ "heading": {
10
+ "label": "Heading",
11
+ "level": "Heading {{level}}"
12
+ },
13
+ "list": {
14
+ "label": "List",
15
+ "bullet": "Bullet List",
16
+ "ordered": "Ordered List",
17
+ "task": "Task List"
18
+ },
19
+ "blockquote": "Blockquote",
20
+ "codeBlock": "Code Block",
21
+ "marks": {
22
+ "bold": "Bold",
23
+ "italic": "Italic",
24
+ "strike": "Strike",
25
+ "code": "Code",
26
+ "underline": "Underline",
27
+ "superscript": "Superscript",
28
+ "subscript": "Subscript"
29
+ },
30
+ "highlight": {
31
+ "label": "Highlight",
32
+ "toggle": "Toggle highlight ({{color}})",
33
+ "remove": "Remove highlight",
34
+ "colors": {
35
+ "default": "Default background",
36
+ "gray": "Gray background",
37
+ "brown": "Brown background",
38
+ "orange": "Orange background",
39
+ "yellow": "Yellow background",
40
+ "green": "Green background",
41
+ "blue": "Blue background",
42
+ "purple": "Purple background",
43
+ "pink": "Pink background",
44
+ "red": "Red background"
45
+ }
46
+ },
47
+ "link": {
48
+ "label": "Link",
49
+ "placeholder": "Paste a link...",
50
+ "apply": "Apply link",
51
+ "open": "Open in new window",
52
+ "remove": "Remove link"
53
+ },
54
+ "align": {
55
+ "left": "Align left",
56
+ "center": "Align center",
57
+ "right": "Align right",
58
+ "justify": "Align justify"
59
+ },
60
+ "image": {
61
+ "label": "Add image"
62
+ },
63
+ "ai": {
64
+ "label": "AI Assistant",
65
+ "placeholder": "Ask AI to write something...",
66
+ "apiKeyPlaceholder": "sk-...",
67
+ "generate": "Generate",
68
+ "generating": "Generating...",
69
+ "insert": "Insert",
70
+ "replace": "Replace Selection",
71
+ "apiKeyLabel": "API Key (DeepSeek)",
72
+ "promptLabel": "Prompt",
73
+ "error": "Failed to generate content",
74
+ "optimizeSelection": "Selection Context: {{text}}",
75
+ "isWriting": "AI is writing",
76
+ "refinePlaceholder": "Tell AI what else needs to be changed...",
77
+ "tryAgain": "Try again",
78
+ "discard": "Discard",
79
+ "apply": "Apply",
80
+ "presets": {
81
+ "edit": "Edit",
82
+ "improve": "Improve writing",
83
+ "fix": "Fix spelling & grammar",
84
+ "shorter": "Make shorter",
85
+ "longer": "Make longer"
86
+ }
87
+ }
88
+ },
89
+ "imageUpload": {
90
+ "clickToUpload": "Click to upload",
91
+ "dragAndDrop": "or drag and drop",
92
+ "limitInfo": "Maximum {{limit}} file(s), {{size}}MB each.",
93
+ "uploading": "Uploading {{count}} files",
94
+ "clearAll": "Clear All",
95
+ "errors": {
96
+ "tooLarge": "File size exceeds maximum allowed ({{size}}MB)",
97
+ "limitExceeded": "Maximum {{limit}} files allowed",
98
+ "noFile": "No file selected",
99
+ "noFiles": "No files to upload",
100
+ "uploadFailed": "Upload failed",
101
+ "noUrl": "Upload failed: No URL returned"
102
+ }
103
+ }
104
+ }
105
+ ;
106
+
107
+ export default _default;
@@ -0,0 +1,107 @@
1
+ declare const _default: {
2
+ "editor": {
3
+ "contentAriaLabel": "主要内容区域,开始输入文字。"
4
+ },
5
+ "toolbar": {
6
+ "add": "添加",
7
+ "undo": "撤销",
8
+ "redo": "重做",
9
+ "heading": {
10
+ "label": "标题",
11
+ "level": "标题 {{level}}"
12
+ },
13
+ "list": {
14
+ "label": "列表",
15
+ "bullet": "无序列表",
16
+ "ordered": "有序列表",
17
+ "task": "任务列表"
18
+ },
19
+ "blockquote": "引用",
20
+ "codeBlock": "代码块",
21
+ "marks": {
22
+ "bold": "粗体",
23
+ "italic": "斜体",
24
+ "strike": "删除线",
25
+ "code": "行内代码",
26
+ "underline": "下划线",
27
+ "superscript": "上标",
28
+ "subscript": "下标"
29
+ },
30
+ "highlight": {
31
+ "label": "高亮",
32
+ "toggle": "切换高亮 ({{color}})",
33
+ "remove": "移除高亮",
34
+ "colors": {
35
+ "default": "默认背景",
36
+ "gray": "灰色背景",
37
+ "brown": "棕色背景",
38
+ "orange": "橙色背景",
39
+ "yellow": "黄色背景",
40
+ "green": "绿色背景",
41
+ "blue": "蓝色背景",
42
+ "purple": "紫色背景",
43
+ "pink": "粉色背景",
44
+ "red": "红色背景"
45
+ }
46
+ },
47
+ "link": {
48
+ "label": "链接",
49
+ "placeholder": "粘贴链接...",
50
+ "apply": "应用链接",
51
+ "open": "在新窗口打开",
52
+ "remove": "移除链接"
53
+ },
54
+ "align": {
55
+ "left": "左对齐",
56
+ "center": "居中对齐",
57
+ "right": "右对齐",
58
+ "justify": "两端对齐"
59
+ },
60
+ "image": {
61
+ "label": "添加图片"
62
+ },
63
+ "ai": {
64
+ "label": "AI 助手",
65
+ "placeholder": "让 AI 写点什么...",
66
+ "apiKeyPlaceholder": "sk-...",
67
+ "generate": "生成",
68
+ "generating": "生成中...",
69
+ "insert": "插入",
70
+ "replace": "替换选中内容",
71
+ "apiKeyLabel": "API Key (DeepSeek)",
72
+ "promptLabel": "提示词",
73
+ "error": "生成失败",
74
+ "optimizeSelection": "选中内容: {{text}}",
75
+ "isWriting": "AI 正在写作",
76
+ "refinePlaceholder": "告诉 AI 还需要修改什么...",
77
+ "tryAgain": "重试",
78
+ "discard": "放弃",
79
+ "apply": "应用",
80
+ "presets": {
81
+ "edit": "编辑",
82
+ "improve": "润色",
83
+ "fix": "修复拼写和语法",
84
+ "shorter": "缩短",
85
+ "longer": "扩写"
86
+ }
87
+ }
88
+ },
89
+ "imageUpload": {
90
+ "clickToUpload": "点击上传",
91
+ "dragAndDrop": "或拖拽上传",
92
+ "limitInfo": "最多 {{limit}} 个文件,每个 {{size}}MB。",
93
+ "uploading": "正在上传 {{count}} 个文件",
94
+ "clearAll": "全部清除",
95
+ "errors": {
96
+ "tooLarge": "文件大小超过限制 ({{size}}MB)",
97
+ "limitExceeded": "最多允许 {{limit}} 个文件",
98
+ "noFile": "未选择文件",
99
+ "noFiles": "没有可上传的文件",
100
+ "uploadFailed": "上传失败",
101
+ "noUrl": "上传失败:未返回 URL"
102
+ }
103
+ }
104
+ }
105
+ ;
106
+
107
+ export default _default;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Simple Tiptap Editor
3
+ *
4
+ * A pre-configured Tiptap editor component with a simple toolbar and essential extensions.
5
+ * Includes support for:
6
+ * - Basic text formatting (Bold, Italic, Strike, Underline, etc.)
7
+ * - Headings (H1-H6)
8
+ * - Lists (Bullet, Ordered, Task)
9
+ * - Code blocks
10
+ * - Blockquotes
11
+ * - Links
12
+ * - Images (Upload & Display)
13
+ * - Text alignment
14
+ * - Undo/Redo
15
+ *
16
+ * @component
17
+ * @example
18
+ * ```tsx
19
+ * import SimpleEditor from "@/components/tiptap-editor/simple";
20
+ *
21
+ * function MyEditor() {
22
+ * return (
23
+ * <SimpleEditor />
24
+ * );
25
+ * }
26
+ * ```
27
+ */
28
+ export { SimpleEditor as default, SimpleEditor } from './simple-editor';
@@ -0,0 +1,15 @@
1
+ export interface AiCompletionOptions {
2
+ prompt: string;
3
+ systemPrompt?: string;
4
+ context?: string;
5
+ apiKey?: string;
6
+ baseUrl?: string;
7
+ model?: string;
8
+ onUpdate?: (text: string) => void;
9
+ signal?: AbortSignal;
10
+ headers?: Record<string, string>;
11
+ params?: Record<string, string>;
12
+ body?: Record<string, unknown>;
13
+ request?: (options: AiCompletionOptions) => Promise<string>;
14
+ }
15
+ export declare const generateAiContent: (options: AiCompletionOptions) => Promise<string>;