@wecode-team/we0-cms 1.1.33 → 1.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/dist/components/tiptap-extension/node-background-extension.d.ts +23 -0
  2. package/dist/components/tiptap-icons/align-center-icon.d.ts +3 -0
  3. package/dist/components/tiptap-icons/align-justify-icon.d.ts +3 -0
  4. package/dist/components/tiptap-icons/align-left-icon.d.ts +3 -0
  5. package/dist/components/tiptap-icons/align-right-icon.d.ts +3 -0
  6. package/dist/components/tiptap-icons/arrow-left-icon.d.ts +3 -0
  7. package/dist/components/tiptap-icons/ban-icon.d.ts +3 -0
  8. package/dist/components/tiptap-icons/blockquote-icon.d.ts +3 -0
  9. package/dist/components/tiptap-icons/bold-icon.d.ts +3 -0
  10. package/dist/components/tiptap-icons/check-icon.d.ts +3 -0
  11. package/dist/components/tiptap-icons/chevron-down-icon.d.ts +3 -0
  12. package/dist/components/tiptap-icons/close-icon.d.ts +3 -0
  13. package/dist/components/tiptap-icons/code-block-icon.d.ts +3 -0
  14. package/dist/components/tiptap-icons/code2-icon.d.ts +3 -0
  15. package/dist/components/tiptap-icons/corner-down-left-icon.d.ts +3 -0
  16. package/dist/components/tiptap-icons/external-link-icon.d.ts +3 -0
  17. package/dist/components/tiptap-icons/heading-five-icon.d.ts +3 -0
  18. package/dist/components/tiptap-icons/heading-four-icon.d.ts +3 -0
  19. package/dist/components/tiptap-icons/heading-icon.d.ts +3 -0
  20. package/dist/components/tiptap-icons/heading-one-icon.d.ts +3 -0
  21. package/dist/components/tiptap-icons/heading-six-icon.d.ts +3 -0
  22. package/dist/components/tiptap-icons/heading-three-icon.d.ts +3 -0
  23. package/dist/components/tiptap-icons/heading-two-icon.d.ts +3 -0
  24. package/dist/components/tiptap-icons/highlighter-icon.d.ts +3 -0
  25. package/dist/components/tiptap-icons/image-plus-icon.d.ts +3 -0
  26. package/dist/components/tiptap-icons/italic-icon.d.ts +3 -0
  27. package/dist/components/tiptap-icons/link-icon.d.ts +3 -0
  28. package/dist/components/tiptap-icons/list-icon.d.ts +3 -0
  29. package/dist/components/tiptap-icons/list-ordered-icon.d.ts +3 -0
  30. package/dist/components/tiptap-icons/list-todo-icon.d.ts +3 -0
  31. package/dist/components/tiptap-icons/moon-star-icon.d.ts +3 -0
  32. package/dist/components/tiptap-icons/redo2-icon.d.ts +3 -0
  33. package/dist/components/tiptap-icons/strike-icon.d.ts +3 -0
  34. package/dist/components/tiptap-icons/subscript-icon.d.ts +3 -0
  35. package/dist/components/tiptap-icons/sun-icon.d.ts +3 -0
  36. package/dist/components/tiptap-icons/superscript-icon.d.ts +3 -0
  37. package/dist/components/tiptap-icons/trash-icon.d.ts +3 -0
  38. package/dist/components/tiptap-icons/underline-icon.d.ts +3 -0
  39. package/dist/components/tiptap-icons/undo2-icon.d.ts +3 -0
  40. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.d.ts +2 -0
  41. package/dist/components/tiptap-node/image-upload-node/image-upload-node-extension.d.ts +58 -0
  42. package/dist/components/tiptap-node/image-upload-node/image-upload-node.d.ts +69 -0
  43. package/dist/components/tiptap-node/image-upload-node/index.d.ts +1 -0
  44. package/dist/components/tiptap-templates/simple/simple-editor.d.ts +19 -0
  45. package/dist/components/tiptap-templates/simple/theme-toggle.d.ts +1 -0
  46. package/dist/components/tiptap-ui/blockquote-button/blockquote-button.d.ts +22 -0
  47. package/dist/components/tiptap-ui/blockquote-button/index.d.ts +2 -0
  48. package/dist/components/tiptap-ui/blockquote-button/use-blockquote.d.ts +80 -0
  49. package/dist/components/tiptap-ui/code-block-button/code-block-button.d.ts +22 -0
  50. package/dist/components/tiptap-ui/code-block-button/index.d.ts +2 -0
  51. package/dist/components/tiptap-ui/code-block-button/use-code-block.d.ts +87 -0
  52. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.d.ts +46 -0
  53. package/dist/components/tiptap-ui/color-highlight-button/index.d.ts +2 -0
  54. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.d.ts +93 -0
  55. package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.d.ts +35 -0
  56. package/dist/components/tiptap-ui/color-highlight-popover/index.d.ts +1 -0
  57. package/dist/components/tiptap-ui/heading-button/heading-button.d.ts +23 -0
  58. package/dist/components/tiptap-ui/heading-button/index.d.ts +2 -0
  59. package/dist/components/tiptap-ui/heading-button/use-heading.d.ts +108 -0
  60. package/dist/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.d.ts +19 -0
  61. package/dist/components/tiptap-ui/heading-dropdown-menu/index.d.ts +2 -0
  62. package/dist/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +73 -0
  63. package/dist/components/tiptap-ui/image-upload-button/image-upload-button.d.ts +29 -0
  64. package/dist/components/tiptap-ui/image-upload-button/index.d.ts +2 -0
  65. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.d.ts +84 -0
  66. package/dist/components/tiptap-ui/link-popover/index.d.ts +2 -0
  67. package/dist/components/tiptap-ui/link-popover/link-popover.d.ts +58 -0
  68. package/dist/components/tiptap-ui/link-popover/use-link-popover.d.ts +117 -0
  69. package/dist/components/tiptap-ui/list-button/index.d.ts +2 -0
  70. package/dist/components/tiptap-ui/list-button/list-button.d.ts +23 -0
  71. package/dist/components/tiptap-ui/list-button/use-list.d.ts +97 -0
  72. package/dist/components/tiptap-ui/list-dropdown-menu/index.d.ts +1 -0
  73. package/dist/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.d.ts +28 -0
  74. package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.d.ts +90 -0
  75. package/dist/components/tiptap-ui/mark-button/index.d.ts +2 -0
  76. package/dist/components/tiptap-ui/mark-button/mark-button.d.ts +23 -0
  77. package/dist/components/tiptap-ui/mark-button/use-mark.d.ts +104 -0
  78. package/dist/components/tiptap-ui/text-align-button/index.d.ts +2 -0
  79. package/dist/components/tiptap-ui/text-align-button/text-align-button.d.ts +30 -0
  80. package/dist/components/tiptap-ui/text-align-button/use-text-align.d.ts +102 -0
  81. package/dist/components/tiptap-ui/undo-redo-button/index.d.ts +2 -0
  82. package/dist/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +23 -0
  83. package/dist/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +90 -0
  84. package/dist/components/tiptap-ui-primitive/badge/badge.d.ts +11 -0
  85. package/dist/components/tiptap-ui-primitive/badge/index.d.ts +1 -0
  86. package/dist/components/tiptap-ui-primitive/button/button.d.ts +16 -0
  87. package/dist/components/tiptap-ui-primitive/button/index.d.ts +1 -0
  88. package/dist/components/tiptap-ui-primitive/button-group/button-group.d.ts +11 -0
  89. package/dist/components/tiptap-ui-primitive/button-group/index.d.ts +1 -0
  90. package/dist/components/tiptap-ui-primitive/card/card.d.ts +10 -0
  91. package/dist/components/tiptap-ui-primitive/card/index.d.ts +1 -0
  92. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +29 -0
  93. package/dist/components/tiptap-ui-primitive/dropdown-menu/index.d.ts +1 -0
  94. package/dist/components/tiptap-ui-primitive/input/index.d.ts +1 -0
  95. package/dist/components/tiptap-ui-primitive/input/input.d.ts +3 -0
  96. package/dist/components/tiptap-ui-primitive/popover/index.d.ts +1 -0
  97. package/dist/components/tiptap-ui-primitive/popover/popover.d.ts +6 -0
  98. package/dist/components/tiptap-ui-primitive/separator/index.d.ts +1 -0
  99. package/dist/components/tiptap-ui-primitive/separator/separator.d.ts +6 -0
  100. package/dist/components/tiptap-ui-primitive/spacer/index.d.ts +1 -0
  101. package/dist/components/tiptap-ui-primitive/spacer/spacer.d.ts +5 -0
  102. package/dist/components/tiptap-ui-primitive/toolbar/index.d.ts +1 -0
  103. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.d.ts +9 -0
  104. package/dist/components/tiptap-ui-primitive/tooltip/index.d.ts +1 -0
  105. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +29 -0
  106. package/dist/hooks/use-composed-ref.d.ts +3 -0
  107. package/dist/hooks/use-cursor-visibility.d.ts +20 -0
  108. package/dist/hooks/use-element-rect.d.ts +35 -0
  109. package/dist/hooks/use-is-breakpoint.d.ts +9 -0
  110. package/dist/hooks/use-menu-navigation.d.ts +52 -0
  111. package/dist/hooks/use-scrolling.d.ts +8 -0
  112. package/dist/hooks/use-throttled-callback.d.ts +18 -0
  113. package/dist/hooks/use-tiptap-editor.d.ts +6 -0
  114. package/dist/hooks/use-unmount.d.ts +7 -0
  115. package/dist/hooks/use-window-size.d.ts +35 -0
  116. package/dist/index.css +2 -2
  117. package/dist/index.esm.js +11 -5
  118. package/dist/index.esm.js.map +1 -1
  119. package/dist/index.js +11 -5
  120. package/dist/index.js.map +1 -1
  121. package/dist/lib/tiptap-utils.d.ts +173 -0
  122. package/package.json +1 -1
@@ -0,0 +1,173 @@
1
+ import type { Node as PMNode } from "@tiptap/pm/model";
2
+ import type { Transaction } from "@tiptap/pm/state";
3
+ import { Selection } from "@tiptap/pm/state";
4
+ import { type Editor, type NodeWithPos } from "@tiptap/react";
5
+ export declare const MAX_FILE_SIZE: number;
6
+ export declare const MAC_SYMBOLS: Record<string, string>;
7
+ export declare const SR_ONLY: {
8
+ readonly position: "absolute";
9
+ readonly width: "1px";
10
+ readonly height: "1px";
11
+ readonly padding: 0;
12
+ readonly margin: "-1px";
13
+ readonly overflow: "hidden";
14
+ readonly clip: "rect(0, 0, 0, 0)";
15
+ readonly whiteSpace: "nowrap";
16
+ readonly borderWidth: 0;
17
+ };
18
+ export declare function cn(...classes: (string | boolean | undefined | null)[]): string;
19
+ /**
20
+ * Determines if the current platform is macOS
21
+ * @returns boolean indicating if the current platform is Mac
22
+ */
23
+ export declare function isMac(): boolean;
24
+ /**
25
+ * Formats a shortcut key based on the platform (Mac or non-Mac)
26
+ * @param key - The key to format (e.g., "ctrl", "alt", "shift")
27
+ * @param isMac - Boolean indicating if the platform is Mac
28
+ * @param capitalize - Whether to capitalize the key (default: true)
29
+ * @returns Formatted shortcut key symbol
30
+ */
31
+ export declare const formatShortcutKey: (key: string, isMac: boolean, capitalize?: boolean) => string;
32
+ /**
33
+ * Parses a shortcut key string into an array of formatted key symbols
34
+ * @param shortcutKeys - The string of shortcut keys (e.g., "ctrl-alt-shift")
35
+ * @param delimiter - The delimiter used to split the keys (default: "-")
36
+ * @param capitalize - Whether to capitalize the keys (default: true)
37
+ * @returns Array of formatted shortcut key symbols
38
+ */
39
+ export declare const parseShortcutKeys: (props: {
40
+ shortcutKeys: string | undefined;
41
+ delimiter?: string;
42
+ capitalize?: boolean;
43
+ }) => string[];
44
+ /**
45
+ * Checks if a mark exists in the editor schema
46
+ * @param markName - The name of the mark to check
47
+ * @param editor - The editor instance
48
+ * @returns boolean indicating if the mark exists in the schema
49
+ */
50
+ export declare const isMarkInSchema: (markName: string, editor: Editor | null) => boolean;
51
+ /**
52
+ * Checks if a node exists in the editor schema
53
+ * @param nodeName - The name of the node to check
54
+ * @param editor - The editor instance
55
+ * @returns boolean indicating if the node exists in the schema
56
+ */
57
+ export declare const isNodeInSchema: (nodeName: string, editor: Editor | null) => boolean;
58
+ /**
59
+ * Moves the focus to the next node in the editor
60
+ * @param editor - The editor instance
61
+ * @returns boolean indicating if the focus was moved
62
+ */
63
+ export declare function focusNextNode(editor: Editor): boolean;
64
+ /**
65
+ * Checks if a value is a valid number (not null, undefined, or NaN)
66
+ * @param value - The value to check
67
+ * @returns boolean indicating if the value is a valid number
68
+ */
69
+ export declare function isValidPosition(pos: number | null | undefined): pos is number;
70
+ /**
71
+ * Checks if one or more extensions are registered in the Tiptap editor.
72
+ * @param editor - The Tiptap editor instance
73
+ * @param extensionNames - A single extension name or an array of names to check
74
+ * @returns True if at least one of the extensions is available, false otherwise
75
+ */
76
+ export declare function isExtensionAvailable(editor: Editor | null, extensionNames: string | string[]): boolean;
77
+ /**
78
+ * Finds a node at the specified position with error handling
79
+ * @param editor The Tiptap editor instance
80
+ * @param position The position in the document to find the node
81
+ * @returns The node at the specified position, or null if not found
82
+ */
83
+ export declare function findNodeAtPosition(editor: Editor, position: number): PMNode | null;
84
+ /**
85
+ * Finds the position and instance of a node in the document
86
+ * @param props Object containing editor, node (optional), and nodePos (optional)
87
+ * @param props.editor The Tiptap editor instance
88
+ * @param props.node The node to find (optional if nodePos is provided)
89
+ * @param props.nodePos The position of the node to find (optional if node is provided)
90
+ * @returns An object with the position and node, or null if not found
91
+ */
92
+ export declare function findNodePosition(props: {
93
+ editor: Editor | null;
94
+ node?: PMNode | null;
95
+ nodePos?: number | null;
96
+ }): {
97
+ pos: number;
98
+ node: PMNode;
99
+ } | null;
100
+ /**
101
+ * Determines whether the current selection contains a node whose type matches
102
+ * any of the provided node type names.
103
+ * @param editor Tiptap editor instance
104
+ * @param nodeTypeNames List of node type names to match against
105
+ * @param checkAncestorNodes Whether to check ancestor node types up the depth chain
106
+ */
107
+ export declare function isNodeTypeSelected(editor: Editor | null, nodeTypeNames?: string[], checkAncestorNodes?: boolean): boolean;
108
+ /**
109
+ * Check whether the current selection is fully within nodes
110
+ * whose type names are in the provided `types` list.
111
+ *
112
+ * - NodeSelection → checks the selected node.
113
+ * - Text/AllSelection → ensures all textblocks within [from, to) are allowed.
114
+ */
115
+ export declare function selectionWithinConvertibleTypes(editor: Editor, types?: string[]): boolean;
116
+ /**
117
+ * Handles image upload with progress tracking and abort capability
118
+ * @param file The file to upload
119
+ * @param onProgress Optional callback for tracking upload progress
120
+ * @param abortSignal Optional AbortSignal for cancelling the upload
121
+ * @returns Promise resolving to the URL of the uploaded image
122
+ */
123
+ export declare const handleImageUpload: (file: File, onProgress?: (event: {
124
+ progress: number;
125
+ }) => void, abortSignal?: AbortSignal) => Promise<string>;
126
+ type ProtocolOptions = {
127
+ /**
128
+ * The protocol scheme to be registered.
129
+ * @default '''
130
+ * @example 'ftp'
131
+ * @example 'git'
132
+ */
133
+ scheme: string;
134
+ /**
135
+ * If enabled, it allows optional slashes after the protocol.
136
+ * @default false
137
+ * @example true
138
+ */
139
+ optionalSlashes?: boolean;
140
+ };
141
+ type ProtocolConfig = Array<ProtocolOptions | string>;
142
+ export declare function isAllowedUri(uri: string | undefined, protocols?: ProtocolConfig): true | RegExpMatchArray | null;
143
+ export declare function sanitizeUrl(inputUrl: string, baseUrl: string, protocols?: ProtocolConfig): string;
144
+ /**
145
+ * Update a single attribute on multiple nodes.
146
+ *
147
+ * @param tr - The transaction to mutate
148
+ * @param targets - Array of { node, pos }
149
+ * @param attrName - Attribute key to update
150
+ * @param next - New value OR updater function receiving previous value
151
+ * Pass `undefined` to remove the attribute.
152
+ * @returns true if at least one node was updated, false otherwise
153
+ */
154
+ export declare function updateNodesAttr<A extends string = string, V = unknown>(tr: Transaction, targets: readonly NodeWithPos[], attrName: A, next: V | ((prev: V | undefined) => V | undefined)): boolean;
155
+ /**
156
+ * Selects the entire content of the current block node if the selection is empty.
157
+ * If the selection is not empty, it does nothing.
158
+ * @param editor The Tiptap editor instance
159
+ */
160
+ export declare function selectCurrentBlockContent(editor: Editor): void;
161
+ /**
162
+ * Retrieves all nodes of specified types from the current selection.
163
+ * @param selection The current editor selection
164
+ * @param allowedNodeTypes An array of node type names to look for (e.g., ["image", "table"])
165
+ * @returns An array of objects containing the node and its position
166
+ */
167
+ export declare function getSelectedNodesOfType(selection: Selection, allowedNodeTypes: string[]): NodeWithPos[];
168
+ /**
169
+ * Clamps a value between min and max bounds
170
+ */
171
+ export declare function clamp(value: number, min: number, max: number): number;
172
+ export declare function getSelectedBlockNodes(editor: Editor): PMNode[];
173
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wecode-team/we0-cms",
3
- "version": "1.1.33",
3
+ "version": "1.1.34",
4
4
  "description": "A CMS component for React applications with shadcn/ui",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",