directix 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +321 -1
- package/dist/index.cjs +4916 -365
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3000 -1142
- package/dist/index.iife.js +4917 -367
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +2 -2
- package/dist/index.mjs +4909 -358
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentPublicInstance } from 'vue';
|
|
2
2
|
import { Directive } from 'vue';
|
|
3
3
|
import { Plugin as Plugin_2 } from 'vue';
|
|
4
|
+
import { Ref } from 'vue';
|
|
4
5
|
import { VNode } from 'vue';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -14,35 +15,27 @@ export declare function addCleanupVue2(el: Element, fn: () => void): void;
|
|
|
14
15
|
export declare function addCleanupVue3(el: Element, fn: () => void): void;
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* Calculate remaining time
|
|
18
19
|
*/
|
|
19
|
-
export declare
|
|
20
|
+
export declare function calculateTime(remaining: number): CountdownTime;
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* Capitalize text based on options
|
|
23
24
|
*/
|
|
24
|
-
export declare
|
|
25
|
-
/**
|
|
26
|
-
* Whether to capitalize each word or just the first word
|
|
27
|
-
* @default true
|
|
28
|
-
*/
|
|
25
|
+
export declare function capitalizeText(text: string, options?: {
|
|
29
26
|
every?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Words to keep lowercase (articles, prepositions, etc.)
|
|
32
|
-
* @default ['a', 'an', 'the', 'and', 'but', 'or', 'for', 'nor', 'on', 'at', 'to', 'from', 'by']
|
|
33
|
-
*/
|
|
34
27
|
keepLower?: string[];
|
|
35
|
-
|
|
36
|
-
* Whether to transform on input (for input elements)
|
|
37
|
-
* @default true
|
|
38
|
-
*/
|
|
39
|
-
onInput?: boolean;
|
|
40
|
-
}
|
|
28
|
+
}): string;
|
|
41
29
|
|
|
42
30
|
/**
|
|
43
|
-
*
|
|
31
|
+
* Capitalize a single word
|
|
44
32
|
*/
|
|
45
|
-
export declare
|
|
33
|
+
export declare function capitalizeWord(word: string): string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Click delay handler
|
|
37
|
+
*/
|
|
38
|
+
export declare type ClickDelayHandler = (event: MouseEvent | TouchEvent) => void;
|
|
46
39
|
|
|
47
40
|
/**
|
|
48
41
|
* Click outside handler
|
|
@@ -50,159 +43,303 @@ export declare type ClickOutsideBinding = ClickOutsideHandler | ClickOutsideOpti
|
|
|
50
43
|
export declare type ClickOutsideHandler = (event: MouseEvent | TouchEvent) => void;
|
|
51
44
|
|
|
52
45
|
/**
|
|
53
|
-
*
|
|
46
|
+
* Debounced function type for composables
|
|
54
47
|
*/
|
|
55
|
-
export declare interface
|
|
56
|
-
/**
|
|
57
|
-
* Callback when clicking outside
|
|
58
|
-
* @required
|
|
59
|
-
*/
|
|
60
|
-
handler: ClickOutsideHandler;
|
|
48
|
+
export declare interface ComposableDebouncedFunction<T extends (...args: any[]) => any> {
|
|
61
49
|
/**
|
|
62
|
-
*
|
|
50
|
+
* Call the debounced function
|
|
63
51
|
*/
|
|
64
|
-
|
|
52
|
+
(...args: Parameters<T>): void;
|
|
65
53
|
/**
|
|
66
|
-
*
|
|
67
|
-
* @default true
|
|
54
|
+
* Cancel any pending execution
|
|
68
55
|
*/
|
|
69
|
-
|
|
56
|
+
cancel: () => void;
|
|
70
57
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @default ['click']
|
|
58
|
+
* Immediately invoke if pending
|
|
73
59
|
*/
|
|
74
|
-
|
|
60
|
+
flush: () => void;
|
|
75
61
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @default false
|
|
62
|
+
* Check if there is a pending execution
|
|
78
63
|
*/
|
|
79
|
-
|
|
64
|
+
pending: () => boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Throttled function type for composables
|
|
69
|
+
*/
|
|
70
|
+
export declare interface ComposableThrottledFunction<T extends (...args: any[]) => any> {
|
|
80
71
|
/**
|
|
81
|
-
*
|
|
82
|
-
* @default false
|
|
72
|
+
* Call the throttled function
|
|
83
73
|
*/
|
|
84
|
-
|
|
74
|
+
(...args: Parameters<T>): void;
|
|
85
75
|
/**
|
|
86
|
-
*
|
|
87
|
-
* @default false
|
|
76
|
+
* Cancel any pending execution
|
|
88
77
|
*/
|
|
89
|
-
|
|
78
|
+
cancel: () => void;
|
|
90
79
|
}
|
|
91
80
|
|
|
92
81
|
/**
|
|
93
|
-
*
|
|
82
|
+
* Countdown complete callback
|
|
94
83
|
*/
|
|
95
|
-
export declare
|
|
84
|
+
export declare type CountdownCompleteCallback = () => void;
|
|
96
85
|
|
|
97
86
|
/**
|
|
98
|
-
*
|
|
87
|
+
* Countdown format function
|
|
99
88
|
*/
|
|
100
|
-
export declare type
|
|
89
|
+
export declare type CountdownFormatFunction = (time: CountdownTime) => string;
|
|
101
90
|
|
|
102
91
|
/**
|
|
103
|
-
*
|
|
92
|
+
* Countdown tick callback
|
|
104
93
|
*/
|
|
105
|
-
export declare type
|
|
94
|
+
export declare type CountdownTickCallback = (time: CountdownTime) => void;
|
|
106
95
|
|
|
107
96
|
/**
|
|
108
|
-
*
|
|
97
|
+
* Countdown time object
|
|
109
98
|
*/
|
|
110
|
-
export declare interface
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
* Callback on copy success
|
|
118
|
-
*/
|
|
119
|
-
onSuccess?: CopySuccessCallback;
|
|
120
|
-
/**
|
|
121
|
-
* Callback on copy error
|
|
122
|
-
*/
|
|
123
|
-
onError?: CopyErrorCallback;
|
|
124
|
-
/**
|
|
125
|
-
* Tooltip text for the copy button
|
|
126
|
-
*/
|
|
127
|
-
title?: string;
|
|
128
|
-
/**
|
|
129
|
-
* Whether to disable
|
|
130
|
-
* @default false
|
|
131
|
-
*/
|
|
132
|
-
disabled?: boolean;
|
|
99
|
+
export declare interface CountdownTime {
|
|
100
|
+
days: number;
|
|
101
|
+
hours: number;
|
|
102
|
+
minutes: number;
|
|
103
|
+
seconds: number;
|
|
104
|
+
milliseconds: number;
|
|
105
|
+
total: number;
|
|
133
106
|
}
|
|
134
107
|
|
|
135
108
|
/**
|
|
136
|
-
*
|
|
109
|
+
* Create a capitalizing function with preset options
|
|
110
|
+
*
|
|
111
|
+
* @param options - Capitalization options
|
|
112
|
+
* @returns Capitalization function
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* import { createCapitalizer } from 'directix'
|
|
117
|
+
*
|
|
118
|
+
* const titleCase = createCapitalizer({ every: true })
|
|
119
|
+
* const sentenceCase = createCapitalizer({ every: false })
|
|
120
|
+
*
|
|
121
|
+
* titleCase('the quick brown fox') // 'The Quick Brown Fox'
|
|
122
|
+
* sentenceCase('the quick brown fox') // 'The quick brown fox'
|
|
123
|
+
* ```
|
|
137
124
|
*/
|
|
138
|
-
export declare
|
|
125
|
+
export declare function createCapitalizer(options?: {
|
|
126
|
+
every?: boolean;
|
|
127
|
+
keepLower?: string[];
|
|
128
|
+
}): (text: string) => string;
|
|
139
129
|
|
|
140
130
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
131
|
+
* Create a debounced click handler
|
|
132
|
+
*
|
|
133
|
+
* @param handler - Click handler
|
|
134
|
+
* @param delay - Delay in milliseconds
|
|
135
|
+
* @returns Debounced click handler
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* import { createDelayedClick } from 'directix'
|
|
140
|
+
*
|
|
141
|
+
* const delayedSubmit = createDelayedClick(submitForm, 1000)
|
|
142
|
+
*
|
|
143
|
+
* // Use in event handler
|
|
144
|
+
* button.onclick = delayedSubmit
|
|
145
|
+
* ```
|
|
143
146
|
*/
|
|
144
|
-
export declare function
|
|
147
|
+
export declare function createDelayedClick(handler: ClickDelayHandler, delay?: number): (event: MouseEvent | TouchEvent) => void;
|
|
145
148
|
|
|
146
149
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
150
|
+
* Create a lowercase transformation function
|
|
151
|
+
*
|
|
152
|
+
* @param first - Whether to transform only the first character
|
|
153
|
+
* @returns Lowercase transformation function
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* import { createLowercaser } from 'directix'
|
|
158
|
+
*
|
|
159
|
+
* const toLower = createLowercaser()
|
|
160
|
+
* toLower('HELLO') // 'hello'
|
|
161
|
+
*
|
|
162
|
+
* const firstToLower = createLowercaser(true)
|
|
163
|
+
* firstToLower('HELLO') // 'hELLO'
|
|
164
|
+
* ```
|
|
149
165
|
*/
|
|
150
|
-
export declare function
|
|
166
|
+
export declare function createLowercaser(first?: boolean): (text: string) => string;
|
|
151
167
|
|
|
152
168
|
/**
|
|
153
|
-
*
|
|
169
|
+
* Create a money formatter with preset options
|
|
170
|
+
*
|
|
171
|
+
* @param options - Format options
|
|
172
|
+
* @returns Money formatter function
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* import { createMoneyFormatter } from 'directix'
|
|
177
|
+
*
|
|
178
|
+
* const formatEuro = createMoneyFormatter({ symbol: '€', symbolPosition: 'after' })
|
|
179
|
+
* formatEuro(1234.56) // '1,234.56€'
|
|
180
|
+
* ```
|
|
154
181
|
*/
|
|
155
|
-
export declare
|
|
182
|
+
export declare function createMoneyFormatter(options?: {
|
|
183
|
+
symbol?: string;
|
|
184
|
+
symbolPosition?: 'before' | 'after';
|
|
185
|
+
precision?: number;
|
|
186
|
+
separator?: string;
|
|
187
|
+
decimal?: string;
|
|
188
|
+
}): (value: number) => string;
|
|
156
189
|
|
|
157
190
|
/**
|
|
158
|
-
*
|
|
191
|
+
* Create a number formatter with preset options
|
|
192
|
+
*
|
|
193
|
+
* @param options - Format options
|
|
194
|
+
* @returns Number formatter function
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* import { createNumberFormatter } from 'directix'
|
|
199
|
+
*
|
|
200
|
+
* const formatPercent = createNumberFormatter({ suffix: '%', precision: 1 })
|
|
201
|
+
* formatPercent(85.5) // '85.5%'
|
|
202
|
+
* ```
|
|
159
203
|
*/
|
|
160
|
-
export declare
|
|
204
|
+
export declare function createNumberFormatter(options?: {
|
|
205
|
+
precision?: number;
|
|
206
|
+
separator?: string;
|
|
207
|
+
decimal?: string;
|
|
208
|
+
prefix?: string;
|
|
209
|
+
suffix?: string;
|
|
210
|
+
}): (value: number) => string;
|
|
161
211
|
|
|
162
212
|
/**
|
|
163
|
-
*
|
|
213
|
+
* Create a permission checker with shared configuration
|
|
214
|
+
*
|
|
215
|
+
* @param config - Shared configuration
|
|
216
|
+
* @returns Permission checker function
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* import { createPermissionChecker } from 'directix'
|
|
221
|
+
*
|
|
222
|
+
* const checkPermission = createPermissionChecker({
|
|
223
|
+
* getPermissions: () => store.getters.permissions,
|
|
224
|
+
* getRoles: () => store.getters.roles,
|
|
225
|
+
* roleMap: { admin: ['*'], editor: ['read', 'write'] }
|
|
226
|
+
* })
|
|
227
|
+
*
|
|
228
|
+
* // Usage
|
|
229
|
+
* const isAdmin = checkPermission('admin')
|
|
230
|
+
* const canEdit = checkPermission(['read', 'write'], 'every')
|
|
231
|
+
* ```
|
|
164
232
|
*/
|
|
165
|
-
export declare
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
233
|
+
export declare function createPermissionChecker(config: {
|
|
234
|
+
getPermissions: () => string[];
|
|
235
|
+
getRoles?: () => string[];
|
|
236
|
+
roleMap?: Record<string, string[]>;
|
|
237
|
+
}): (value: string | string[], mode?: PermissionMode) => boolean;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Create a trim function with preset options
|
|
241
|
+
*
|
|
242
|
+
* @param position - Trim position
|
|
243
|
+
* @param chars - Custom characters to trim
|
|
244
|
+
* @returns Trim function
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* import { createTrimmer } from 'directix'
|
|
249
|
+
*
|
|
250
|
+
* const trimStart = createTrimmer('start')
|
|
251
|
+
* trimStart(' hello ') // 'hello '
|
|
252
|
+
*
|
|
253
|
+
* const trimAsterisks = createTrimmer('both', '*')
|
|
254
|
+
* trimAsterisks('**hello**') // 'hello'
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
export declare function createTrimmer(position?: TrimPosition, chars?: string): (text: string) => string;
|
|
170
258
|
|
|
171
259
|
/**
|
|
172
|
-
*
|
|
260
|
+
* Create an uppercase transformation function
|
|
261
|
+
*
|
|
262
|
+
* @param first - Whether to transform only the first character
|
|
263
|
+
* @returns Uppercase transformation function
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts
|
|
267
|
+
* import { createUppercaser } from 'directix'
|
|
268
|
+
*
|
|
269
|
+
* const toUpper = createUppercaser()
|
|
270
|
+
* toUpper('hello') // 'HELLO'
|
|
271
|
+
*
|
|
272
|
+
* const firstToUpper = createUppercaser(true)
|
|
273
|
+
* firstToUpper('hello') // 'Hello'
|
|
274
|
+
* ```
|
|
173
275
|
*/
|
|
174
|
-
export declare function
|
|
175
|
-
leading?: boolean;
|
|
176
|
-
trailing?: boolean;
|
|
177
|
-
}): ((...args: Parameters<T>) => void) & {
|
|
178
|
-
cancel: () => void;
|
|
179
|
-
flush: () => void;
|
|
180
|
-
};
|
|
276
|
+
export declare function createUppercaser(first?: boolean): (text: string) => string;
|
|
181
277
|
|
|
182
278
|
/**
|
|
183
|
-
*
|
|
279
|
+
* Vue 2 directive adapter
|
|
280
|
+
* @returns Vue 2 directive object with bind/inserted/update/unbind hooks
|
|
184
281
|
*/
|
|
185
|
-
export declare
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
282
|
+
export declare function createVue2Directive<T, B extends Element>(hooks: DirectiveHooks<T, B>): Record<string, any>;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Vue 3 directive adapter
|
|
286
|
+
* @returns Vue 3 directive object with created/mounted/updated/unmounted hooks
|
|
287
|
+
*/
|
|
288
|
+
export declare function createVue3Directive<T, B extends Element>(hooks: DirectiveHooks<T, B>): Record<string, any>;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Create a simple watermark data URL
|
|
292
|
+
*
|
|
293
|
+
* @param content - Watermark text
|
|
294
|
+
* @param options - Additional options
|
|
295
|
+
* @returns Data URL string
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```ts
|
|
299
|
+
* import { createWatermarkUrl } from 'directix'
|
|
300
|
+
*
|
|
301
|
+
* const url = createWatermarkUrl('Confidential', { fontSize: 20 })
|
|
302
|
+
* // Use as background-image: url(dataUrl)
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
export declare function createWatermarkUrl(content: string | string[], options?: {
|
|
306
|
+
width?: number;
|
|
307
|
+
height?: number;
|
|
308
|
+
fontSize?: number;
|
|
309
|
+
color?: string;
|
|
310
|
+
rotate?: number;
|
|
311
|
+
}): string;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Cross-version directive type (compatible with Vue 2/3)
|
|
315
|
+
*/
|
|
316
|
+
export declare type CrossVersionDirective = Directive | Vue2DirectiveHooks | Vue3DirectiveHooks;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Simple debounce function wrapper
|
|
320
|
+
*
|
|
321
|
+
* @param fn - Function to debounce
|
|
322
|
+
* @param wait - Delay in milliseconds
|
|
323
|
+
* @returns Debounced function with cancel method
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```ts
|
|
327
|
+
* import { debounceFn } from 'directix'
|
|
328
|
+
*
|
|
329
|
+
* const debouncedSave = debounceFn(saveData, 1000)
|
|
330
|
+
*
|
|
331
|
+
* // Call multiple times, only executes once after 1s
|
|
332
|
+
* debouncedSave(data)
|
|
333
|
+
* debouncedSave(newData)
|
|
334
|
+
*
|
|
335
|
+
* // Cancel pending execution
|
|
336
|
+
* debouncedSave.cancel()
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
export declare function debounceFn<T extends (...args: any[]) => any>(fn: T, wait?: number, options?: {
|
|
199
340
|
leading?: boolean;
|
|
200
|
-
/**
|
|
201
|
-
* Whether to invoke after delay ends
|
|
202
|
-
* @default true
|
|
203
|
-
*/
|
|
204
341
|
trailing?: boolean;
|
|
205
|
-
}
|
|
342
|
+
}): ComposableDebouncedFunction<T>;
|
|
206
343
|
|
|
207
344
|
/**
|
|
208
345
|
* Deep clone an object
|
|
@@ -312,1259 +449,2882 @@ export declare const Directix: Plugin_2;
|
|
|
312
449
|
export declare type DraggableAxis = 'x' | 'y' | 'both';
|
|
313
450
|
|
|
314
451
|
/**
|
|
315
|
-
*
|
|
452
|
+
* Format number to money string
|
|
316
453
|
*/
|
|
317
|
-
export declare
|
|
454
|
+
export declare function formatMoney(value: number, options?: {
|
|
455
|
+
precision?: number;
|
|
456
|
+
separator?: string;
|
|
457
|
+
decimal?: string;
|
|
458
|
+
symbol?: string;
|
|
459
|
+
symbolPosition?: 'before' | 'after';
|
|
460
|
+
}): string;
|
|
318
461
|
|
|
319
462
|
/**
|
|
320
|
-
*
|
|
463
|
+
* Format number with options
|
|
321
464
|
*/
|
|
322
|
-
export declare
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
465
|
+
export declare function formatNumber(value: number, options?: {
|
|
466
|
+
precision?: number;
|
|
467
|
+
separator?: string;
|
|
468
|
+
decimal?: string;
|
|
469
|
+
prefix?: string;
|
|
470
|
+
suffix?: string;
|
|
471
|
+
}): string;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Format time to string
|
|
475
|
+
*/
|
|
476
|
+
export declare function formatTime(time: CountdownTime, format: string | CountdownFormatFunction): string;
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Generate unique ID
|
|
480
|
+
*/
|
|
481
|
+
export declare function generateId(prefix?: string): string;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Get nested property value by path
|
|
485
|
+
*/
|
|
486
|
+
export declare function get<T = any>(obj: Record<string, any>, path: string, defaultValue?: T): T;
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Get current Vue version
|
|
490
|
+
*/
|
|
491
|
+
export declare function getVueVersion(): VueVersion;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Hotkey definition
|
|
495
|
+
*/
|
|
496
|
+
export declare interface HotkeyDefinition {
|
|
328
497
|
/**
|
|
329
|
-
*
|
|
330
|
-
* @default false
|
|
498
|
+
* Key combination (e.g., 'ctrl+s', 'alt+shift+a')
|
|
331
499
|
*/
|
|
332
|
-
|
|
500
|
+
key: string;
|
|
333
501
|
/**
|
|
334
|
-
*
|
|
502
|
+
* Handler function
|
|
335
503
|
*/
|
|
336
|
-
|
|
504
|
+
handler: (event: KeyboardEvent) => void;
|
|
337
505
|
/**
|
|
338
|
-
*
|
|
506
|
+
* Whether to prevent default behavior
|
|
507
|
+
* @default true
|
|
339
508
|
*/
|
|
340
|
-
|
|
509
|
+
prevent?: boolean;
|
|
341
510
|
/**
|
|
342
|
-
* Whether
|
|
511
|
+
* Whether to stop propagation
|
|
343
512
|
* @default false
|
|
344
513
|
*/
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* Grid snapping [x, y]
|
|
348
|
-
*/
|
|
349
|
-
grid?: [number, number];
|
|
350
|
-
/**
|
|
351
|
-
* Start drag callback
|
|
352
|
-
*/
|
|
353
|
-
onStart?: (position: {
|
|
354
|
-
x: number;
|
|
355
|
-
y: number;
|
|
356
|
-
}, event: MouseEvent | TouchEvent) => void;
|
|
514
|
+
stop?: boolean;
|
|
357
515
|
/**
|
|
358
|
-
*
|
|
516
|
+
* Whether to trigger on keyup instead of keydown
|
|
517
|
+
* @default false
|
|
359
518
|
*/
|
|
360
|
-
|
|
361
|
-
x: number;
|
|
362
|
-
y: number;
|
|
363
|
-
}, event: MouseEvent | TouchEvent) => void;
|
|
519
|
+
keyup?: boolean;
|
|
364
520
|
/**
|
|
365
|
-
*
|
|
521
|
+
* Whether the hotkey is disabled
|
|
522
|
+
* @default false
|
|
366
523
|
*/
|
|
367
|
-
|
|
368
|
-
x: number;
|
|
369
|
-
y: number;
|
|
370
|
-
}, event: MouseEvent | TouchEvent) => void;
|
|
524
|
+
disabled?: boolean | Ref<boolean>;
|
|
371
525
|
}
|
|
372
526
|
|
|
373
527
|
/**
|
|
374
|
-
*
|
|
528
|
+
* Intersect event handler
|
|
375
529
|
*/
|
|
376
|
-
export declare type
|
|
530
|
+
export declare type IntersectHandler = (entry: IntersectionObserverEntry, observer: IntersectionObserver) => void;
|
|
377
531
|
|
|
378
532
|
/**
|
|
379
|
-
*
|
|
533
|
+
* Check if value is an array
|
|
380
534
|
*/
|
|
381
|
-
declare
|
|
382
|
-
/**
|
|
383
|
-
* Whether to auto focus
|
|
384
|
-
* @default true
|
|
385
|
-
*/
|
|
386
|
-
focus?: boolean;
|
|
387
|
-
/**
|
|
388
|
-
* Whether to refocus when binding value changes
|
|
389
|
-
* @default false
|
|
390
|
-
*/
|
|
391
|
-
refocus?: boolean;
|
|
392
|
-
/**
|
|
393
|
-
* Callback when focused
|
|
394
|
-
*/
|
|
395
|
-
onFocus?: (el: HTMLElement) => void;
|
|
396
|
-
/**
|
|
397
|
-
* Callback when blurred
|
|
398
|
-
*/
|
|
399
|
-
onBlur?: (el: HTMLElement) => void;
|
|
400
|
-
}
|
|
401
|
-
export { FocusOptions_2 as FocusOptions }
|
|
535
|
+
export declare function isArray(value: unknown): value is any[];
|
|
402
536
|
|
|
403
537
|
/**
|
|
404
|
-
*
|
|
538
|
+
* Check if value is a boolean
|
|
405
539
|
*/
|
|
406
|
-
export declare function
|
|
540
|
+
export declare function isBoolean(value: unknown): value is boolean;
|
|
407
541
|
|
|
408
542
|
/**
|
|
409
|
-
*
|
|
543
|
+
* Check if browser environment
|
|
410
544
|
*/
|
|
411
|
-
export declare
|
|
545
|
+
export declare const isBrowser: () => boolean;
|
|
412
546
|
|
|
413
547
|
/**
|
|
414
|
-
*
|
|
548
|
+
* Check if value is empty
|
|
415
549
|
*/
|
|
416
|
-
export declare function
|
|
550
|
+
export declare function isEmpty(value: unknown): boolean;
|
|
417
551
|
|
|
418
552
|
/**
|
|
419
|
-
*
|
|
553
|
+
* Check if value is a function
|
|
420
554
|
*/
|
|
421
|
-
export declare function
|
|
555
|
+
export declare function isFunction(value: unknown): value is (...args: any[]) => any;
|
|
422
556
|
|
|
423
557
|
/**
|
|
424
|
-
*
|
|
558
|
+
* Check if value is a number
|
|
425
559
|
*/
|
|
426
|
-
export declare
|
|
560
|
+
export declare function isNumber(value: unknown): value is number;
|
|
427
561
|
|
|
428
562
|
/**
|
|
429
|
-
*
|
|
563
|
+
* Check if value is an object
|
|
430
564
|
*/
|
|
431
|
-
export declare
|
|
565
|
+
export declare function isObject(value: unknown): value is Record<string, any>;
|
|
432
566
|
|
|
433
567
|
/**
|
|
434
|
-
*
|
|
568
|
+
* Check if value is a Promise
|
|
435
569
|
*/
|
|
436
|
-
export declare
|
|
437
|
-
/**
|
|
438
|
-
* Callback when hover state changes
|
|
439
|
-
*/
|
|
440
|
-
handler?: HoverHandler;
|
|
441
|
-
/**
|
|
442
|
-
* Callback when mouse enters
|
|
443
|
-
*/
|
|
444
|
-
onEnter?: (event: MouseEvent) => void;
|
|
445
|
-
/**
|
|
446
|
-
* Callback when mouse leaves
|
|
447
|
-
*/
|
|
448
|
-
onLeave?: (event: MouseEvent) => void;
|
|
449
|
-
/**
|
|
450
|
-
* CSS class to add when hovering
|
|
451
|
-
* @default 'v-hover'
|
|
452
|
-
*/
|
|
453
|
-
class?: string;
|
|
454
|
-
/**
|
|
455
|
-
* Whether to disable
|
|
456
|
-
* @default false
|
|
457
|
-
*/
|
|
458
|
-
disabled?: boolean;
|
|
459
|
-
/**
|
|
460
|
-
* Delay in milliseconds before triggering enter
|
|
461
|
-
* @default 0
|
|
462
|
-
*/
|
|
463
|
-
enterDelay?: number;
|
|
464
|
-
/**
|
|
465
|
-
* Delay in milliseconds before triggering leave
|
|
466
|
-
* @default 0
|
|
467
|
-
*/
|
|
468
|
-
leaveDelay?: number;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
export declare type ImagePreviewBinding = string | ImagePreviewOptions;
|
|
570
|
+
export declare function isPromise<T = any>(value: unknown): value is Promise<T>;
|
|
472
571
|
|
|
473
572
|
/**
|
|
474
|
-
*
|
|
573
|
+
* Check if server-side rendering
|
|
475
574
|
*/
|
|
476
|
-
export declare
|
|
477
|
-
/** Image source URL */
|
|
478
|
-
src?: string;
|
|
479
|
-
/** Preview image source URL (higher resolution) */
|
|
480
|
-
previewSrc?: string;
|
|
481
|
-
/** Alt text for accessibility */
|
|
482
|
-
alt?: string;
|
|
483
|
-
/** Whether preview is disabled @default false */
|
|
484
|
-
disabled?: boolean;
|
|
485
|
-
/** Close on click outside @default true */
|
|
486
|
-
closeOnClickOutside?: boolean;
|
|
487
|
-
/** Close on escape key @default true */
|
|
488
|
-
closeOnEsc?: boolean;
|
|
489
|
-
/** Show close button @default true */
|
|
490
|
-
showCloseButton?: boolean;
|
|
491
|
-
/** Z-index of the preview overlay @default 9999 */
|
|
492
|
-
zIndex?: number;
|
|
493
|
-
/** Custom class for the preview overlay */
|
|
494
|
-
class?: string;
|
|
495
|
-
/** Enable pinch zoom on mobile @default true */
|
|
496
|
-
enablePinchZoom?: boolean;
|
|
497
|
-
/** Enable double tap to zoom @default true */
|
|
498
|
-
enableDoubleTap?: boolean;
|
|
499
|
-
/** Enable swipe up to close @default true */
|
|
500
|
-
enableSwipeClose?: boolean;
|
|
501
|
-
/** Show zoom indicator @default true */
|
|
502
|
-
showZoomIndicator?: boolean;
|
|
503
|
-
/** Minimum zoom scale @default 0.5 */
|
|
504
|
-
minScale?: number;
|
|
505
|
-
/** Maximum zoom scale @default 5 */
|
|
506
|
-
maxScale?: number;
|
|
507
|
-
/** Callback when preview opens */
|
|
508
|
-
onOpen?: () => void;
|
|
509
|
-
/** Callback when preview closes */
|
|
510
|
-
onClose?: () => void;
|
|
511
|
-
}
|
|
575
|
+
export declare const isSSR: () => boolean;
|
|
512
576
|
|
|
513
577
|
/**
|
|
514
|
-
*
|
|
578
|
+
* Check if value is a string
|
|
515
579
|
*/
|
|
516
|
-
export declare
|
|
580
|
+
export declare function isString(value: unknown): value is string;
|
|
517
581
|
|
|
518
582
|
/**
|
|
519
|
-
*
|
|
583
|
+
* Check if Vue 2 (includes 2.7)
|
|
520
584
|
*/
|
|
521
|
-
export declare
|
|
585
|
+
export declare function isVue2(): boolean;
|
|
522
586
|
|
|
523
587
|
/**
|
|
524
|
-
*
|
|
588
|
+
* Check if Vue 2.7 (has built-in Composition API support)
|
|
525
589
|
*/
|
|
526
|
-
export declare
|
|
527
|
-
/**
|
|
528
|
-
* Handler to call when scrolling to bottom
|
|
529
|
-
* @required
|
|
530
|
-
*/
|
|
531
|
-
handler: InfiniteScrollHandler;
|
|
532
|
-
/**
|
|
533
|
-
* Distance from bottom to trigger load (in pixels)
|
|
534
|
-
* @default 0
|
|
535
|
-
*/
|
|
536
|
-
distance?: number;
|
|
537
|
-
/**
|
|
538
|
-
* Whether to disable
|
|
539
|
-
* @default false
|
|
540
|
-
*/
|
|
541
|
-
disabled?: boolean;
|
|
542
|
-
/**
|
|
543
|
-
* Whether currently loading
|
|
544
|
-
* @default false
|
|
545
|
-
*/
|
|
546
|
-
loading?: boolean;
|
|
547
|
-
/**
|
|
548
|
-
* Whether to use IntersectionObserver (more efficient)
|
|
549
|
-
* @default true
|
|
550
|
-
*/
|
|
551
|
-
useIntersection?: boolean;
|
|
552
|
-
/**
|
|
553
|
-
* Throttle time in milliseconds
|
|
554
|
-
* @default 200
|
|
555
|
-
*/
|
|
556
|
-
throttle?: number;
|
|
557
|
-
/**
|
|
558
|
-
* Custom scroll container
|
|
559
|
-
*/
|
|
560
|
-
container?: string | Element | null;
|
|
561
|
-
/**
|
|
562
|
-
* Callback when load starts
|
|
563
|
-
*/
|
|
564
|
-
onLoadStart?: () => void;
|
|
565
|
-
/**
|
|
566
|
-
* Callback when load completes
|
|
567
|
-
*/
|
|
568
|
-
onLoadEnd?: () => void;
|
|
569
|
-
/**
|
|
570
|
-
* Callback on error
|
|
571
|
-
*/
|
|
572
|
-
onError?: (error: Error) => void;
|
|
573
|
-
}
|
|
590
|
+
export declare function isVue27(): boolean;
|
|
574
591
|
|
|
575
592
|
/**
|
|
576
|
-
*
|
|
593
|
+
* Check if Vue 3
|
|
577
594
|
*/
|
|
578
|
-
export declare
|
|
595
|
+
export declare function isVue3(): boolean;
|
|
579
596
|
|
|
580
597
|
/**
|
|
581
|
-
*
|
|
598
|
+
* Virtual list item size function
|
|
582
599
|
*/
|
|
583
|
-
export declare type
|
|
600
|
+
export declare type ItemSizeFunction = (index: number) => number;
|
|
584
601
|
|
|
585
602
|
/**
|
|
586
|
-
*
|
|
603
|
+
* Transform text to lowercase
|
|
587
604
|
*/
|
|
588
|
-
export declare
|
|
589
|
-
/** Callback when element intersects */
|
|
590
|
-
handler?: IntersectHandler;
|
|
591
|
-
/** Callback when element enters viewport */
|
|
592
|
-
onEnter?: (entry: IntersectionObserverEntry, observer: IntersectionObserver) => void;
|
|
593
|
-
/** Callback when element leaves viewport */
|
|
594
|
-
onLeave?: (entry: IntersectionObserverEntry, observer: IntersectionObserver) => void;
|
|
595
|
-
/** Callback when element changes intersection */
|
|
596
|
-
onChange?: (isIntersecting: boolean, entry: IntersectionObserverEntry) => void;
|
|
597
|
-
/** Root element for intersection @default null (viewport) */
|
|
598
|
-
root?: Element | null;
|
|
599
|
-
/** Margin around the root @default '0px' */
|
|
600
|
-
rootMargin?: string;
|
|
601
|
-
/** Threshold(s) at which to trigger callback @default 0 */
|
|
602
|
-
threshold?: number | number[];
|
|
603
|
-
/** Whether to disable @default false */
|
|
604
|
-
disabled?: boolean;
|
|
605
|
-
/** Whether to trigger only once @default false */
|
|
606
|
-
once?: boolean;
|
|
607
|
-
}
|
|
605
|
+
export declare function lowercaseText(text: string, firstOnly?: boolean): string;
|
|
608
606
|
|
|
609
607
|
/**
|
|
610
|
-
*
|
|
608
|
+
* Parse formatted money string to number
|
|
611
609
|
*/
|
|
612
|
-
export declare function
|
|
610
|
+
export declare function parseMoney(formatted: string, options?: {
|
|
611
|
+
decimal?: string;
|
|
612
|
+
symbol?: string;
|
|
613
|
+
}): number;
|
|
613
614
|
|
|
614
615
|
/**
|
|
615
|
-
*
|
|
616
|
+
* Parse formatted number string to number
|
|
616
617
|
*/
|
|
617
|
-
export declare function
|
|
618
|
+
export declare function parseNumber(formatted: string, options?: {
|
|
619
|
+
decimal?: string;
|
|
620
|
+
prefix?: string;
|
|
621
|
+
suffix?: string;
|
|
622
|
+
}): number;
|
|
618
623
|
|
|
619
624
|
/**
|
|
620
|
-
*
|
|
625
|
+
* Parse target time to timestamp
|
|
621
626
|
*/
|
|
622
|
-
export declare
|
|
627
|
+
export declare function parseTargetTime(target: Date | number | string): number;
|
|
623
628
|
|
|
624
629
|
/**
|
|
625
|
-
*
|
|
630
|
+
* Parse time argument
|
|
631
|
+
* Supports formats: "300" | "300ms" | "1s"
|
|
626
632
|
*/
|
|
627
|
-
export declare function
|
|
633
|
+
export declare function parseTime(arg?: string): number | null;
|
|
628
634
|
|
|
629
635
|
/**
|
|
630
|
-
*
|
|
636
|
+
* Permission check mode
|
|
631
637
|
*/
|
|
632
|
-
export declare
|
|
638
|
+
export declare type PermissionMode = 'some' | 'every';
|
|
633
639
|
|
|
634
640
|
/**
|
|
635
|
-
*
|
|
641
|
+
* Position type
|
|
636
642
|
*/
|
|
637
|
-
export declare
|
|
643
|
+
export declare interface Position {
|
|
644
|
+
x: number;
|
|
645
|
+
y: number;
|
|
646
|
+
}
|
|
638
647
|
|
|
639
648
|
/**
|
|
640
|
-
*
|
|
649
|
+
* Print before callback
|
|
641
650
|
*/
|
|
642
|
-
export declare
|
|
651
|
+
export declare type PrintBeforeCallback = () => boolean | void;
|
|
643
652
|
|
|
644
653
|
/**
|
|
645
|
-
*
|
|
654
|
+
* Print complete callback
|
|
646
655
|
*/
|
|
647
|
-
export declare
|
|
656
|
+
export declare type PrintCompleteCallback = () => void;
|
|
648
657
|
|
|
649
658
|
/**
|
|
650
|
-
*
|
|
659
|
+
* Pull refresh handler
|
|
651
660
|
*/
|
|
652
|
-
export declare
|
|
661
|
+
export declare type PullRefreshHandler = () => Promise<void> | void;
|
|
653
662
|
|
|
654
663
|
/**
|
|
655
|
-
*
|
|
664
|
+
* Pull refresh state
|
|
656
665
|
*/
|
|
657
|
-
export declare
|
|
666
|
+
export declare type PullRefreshState = 'idle' | 'pulling' | 'ready' | 'loading' | 'success' | 'error';
|
|
658
667
|
|
|
659
668
|
/**
|
|
660
|
-
*
|
|
669
|
+
* Quick print function
|
|
670
|
+
*
|
|
671
|
+
* @param target - Element or selector to print
|
|
672
|
+
* @param options - Print options
|
|
673
|
+
*
|
|
674
|
+
* @example
|
|
675
|
+
* ```ts
|
|
676
|
+
* import { quickPrint } from 'directix'
|
|
677
|
+
*
|
|
678
|
+
* // Print element by selector
|
|
679
|
+
* quickPrint('#content', { title: 'My Document' })
|
|
680
|
+
*
|
|
681
|
+
* // Print element directly
|
|
682
|
+
* const el = document.getElementById('content')
|
|
683
|
+
* quickPrint(el)
|
|
684
|
+
* ```
|
|
661
685
|
*/
|
|
662
|
-
export declare function
|
|
686
|
+
export declare function quickPrint(target: string | HTMLElement, options?: UsePrintOptions): Promise<void>;
|
|
663
687
|
|
|
664
688
|
/**
|
|
665
|
-
*
|
|
689
|
+
* Reset Vue version (useful for testing)
|
|
666
690
|
*/
|
|
667
|
-
export declare function
|
|
691
|
+
export declare function resetVueVersion(): void;
|
|
668
692
|
|
|
669
693
|
/**
|
|
670
|
-
*
|
|
694
|
+
* Resize information
|
|
671
695
|
*/
|
|
672
|
-
export declare
|
|
696
|
+
export declare interface ResizeInfo {
|
|
697
|
+
/** New width */
|
|
698
|
+
width: number;
|
|
699
|
+
/** New height */
|
|
700
|
+
height: number;
|
|
701
|
+
/** Content rect */
|
|
702
|
+
contentRect: DOMRectReadOnly;
|
|
703
|
+
}
|
|
673
704
|
|
|
674
705
|
/**
|
|
675
|
-
*
|
|
706
|
+
* Scroll direction
|
|
676
707
|
*/
|
|
677
|
-
export declare type
|
|
708
|
+
export declare type ScrollDirection = -1 | 0 | 1;
|
|
678
709
|
|
|
679
710
|
/**
|
|
680
|
-
*
|
|
711
|
+
* Scroll information
|
|
681
712
|
*/
|
|
682
|
-
export declare interface
|
|
683
|
-
/**
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
/**
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
/**
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
preload?: number;
|
|
700
|
-
/**
|
|
701
|
-
* Callback when image loads successfully
|
|
702
|
-
*/
|
|
703
|
-
onLoad?: (el: HTMLElement) => void;
|
|
704
|
-
/**
|
|
705
|
-
* Callback when image fails to load
|
|
706
|
-
*/
|
|
707
|
-
onError?: (el: HTMLElement, error: Error) => void;
|
|
708
|
-
/**
|
|
709
|
-
* Number of retry attempts
|
|
710
|
-
* @default 1
|
|
711
|
-
*/
|
|
712
|
-
attempt?: number;
|
|
713
|
-
/**
|
|
714
|
-
* Filter function, return false to skip loading
|
|
715
|
-
*/
|
|
716
|
-
filter?: (src: string) => boolean;
|
|
717
|
-
/**
|
|
718
|
-
* Custom IntersectionObserver
|
|
719
|
-
*/
|
|
720
|
-
observer?: IntersectionObserver;
|
|
721
|
-
/**
|
|
722
|
-
* Whether to disable lazy loading
|
|
723
|
-
* @default false
|
|
724
|
-
*/
|
|
725
|
-
disabled?: boolean;
|
|
713
|
+
export declare interface ScrollInfo {
|
|
714
|
+
/** Current scroll left position */
|
|
715
|
+
scrollLeft: number;
|
|
716
|
+
/** Current scroll top position */
|
|
717
|
+
scrollTop: number;
|
|
718
|
+
/** Maximum scroll left */
|
|
719
|
+
scrollLeftMax: number;
|
|
720
|
+
/** Maximum scroll top */
|
|
721
|
+
scrollTopMax: number;
|
|
722
|
+
/** Horizontal scroll progress (0-1) */
|
|
723
|
+
progressX: number;
|
|
724
|
+
/** Vertical scroll progress (0-1) */
|
|
725
|
+
progressY: number;
|
|
726
|
+
/** Direction of horizontal scroll (-1: left, 1: right, 0: none) */
|
|
727
|
+
directionX: ScrollDirection;
|
|
728
|
+
/** Direction of vertical scroll (-1: up, 1: down, 0: none) */
|
|
729
|
+
directionY: ScrollDirection;
|
|
726
730
|
}
|
|
727
731
|
|
|
728
732
|
/**
|
|
729
|
-
*
|
|
733
|
+
* Set nested property value by path
|
|
730
734
|
*/
|
|
731
|
-
export declare
|
|
735
|
+
export declare function set(obj: Record<string, any>, path: string, value: any): void;
|
|
732
736
|
|
|
733
737
|
/**
|
|
734
|
-
*
|
|
738
|
+
* Set Vue version explicitly (for cases where auto-detection fails)
|
|
735
739
|
*/
|
|
736
|
-
export declare
|
|
740
|
+
export declare function setVueVersion(version: VueVersion): void;
|
|
737
741
|
|
|
738
742
|
/**
|
|
739
|
-
*
|
|
743
|
+
* Check if Clipboard API is supported
|
|
740
744
|
*/
|
|
741
|
-
export declare
|
|
742
|
-
/**
|
|
743
|
-
* Loading state
|
|
744
|
-
* @default true
|
|
745
|
-
*/
|
|
746
|
-
value?: boolean;
|
|
747
|
-
/**
|
|
748
|
-
* Loading text to display
|
|
749
|
-
*/
|
|
750
|
-
text?: string;
|
|
751
|
-
/**
|
|
752
|
-
* CSS class for loading overlay
|
|
753
|
-
* @default 'v-loading'
|
|
754
|
-
*/
|
|
755
|
-
loadingClass?: string;
|
|
756
|
-
/**
|
|
757
|
-
* CSS class for loading spinner
|
|
758
|
-
* @default 'v-loading__spinner'
|
|
759
|
-
*/
|
|
760
|
-
spinnerClass?: string;
|
|
761
|
-
/**
|
|
762
|
-
* CSS class for loading text
|
|
763
|
-
* @default 'v-loading__text'
|
|
764
|
-
*/
|
|
765
|
-
textClass?: string;
|
|
766
|
-
/**
|
|
767
|
-
* Custom spinner HTML
|
|
768
|
-
*/
|
|
769
|
-
spinner?: string;
|
|
770
|
-
/**
|
|
771
|
-
* Background color
|
|
772
|
-
* @default 'rgba(255, 255, 255, 0.9)'
|
|
773
|
-
*/
|
|
774
|
-
background?: string;
|
|
775
|
-
/**
|
|
776
|
-
* Whether to lock scroll while loading
|
|
777
|
-
* @default false
|
|
778
|
-
*/
|
|
779
|
-
lock?: boolean;
|
|
780
|
-
/**
|
|
781
|
-
* Whether to disable
|
|
782
|
-
* @default false
|
|
783
|
-
*/
|
|
784
|
-
disabled?: boolean;
|
|
785
|
-
}
|
|
745
|
+
export declare const supportsClipboard: () => boolean;
|
|
786
746
|
|
|
787
747
|
/**
|
|
788
|
-
*
|
|
748
|
+
* Check if IntersectionObserver is supported
|
|
789
749
|
*/
|
|
790
|
-
export declare
|
|
750
|
+
export declare const supportsIntersectionObserver: () => boolean;
|
|
791
751
|
|
|
792
752
|
/**
|
|
793
|
-
*
|
|
753
|
+
* Check if MutationObserver is supported
|
|
794
754
|
*/
|
|
795
|
-
export declare
|
|
755
|
+
export declare const supportsMutationObserver: () => boolean;
|
|
796
756
|
|
|
797
757
|
/**
|
|
798
|
-
*
|
|
758
|
+
* Check if passive event listening is supported
|
|
799
759
|
*/
|
|
800
|
-
export declare
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
760
|
+
export declare const supportsPassive: () => boolean;
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Check if ResizeObserver is supported
|
|
764
|
+
*/
|
|
765
|
+
export declare const supportsResizeObserver: () => boolean;
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Swipe direction
|
|
769
|
+
*/
|
|
770
|
+
export declare type SwipeDirection = 'left' | 'right' | 'up' | 'down';
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Swipe handler type
|
|
774
|
+
*/
|
|
775
|
+
export declare type SwipeHandler = (direction: SwipeDirection, event: Event) => void;
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* Simple throttle function wrapper
|
|
779
|
+
*
|
|
780
|
+
* @param fn - Function to throttle
|
|
781
|
+
* @param wait - Delay in milliseconds
|
|
782
|
+
* @returns Throttled function with cancel method
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* ```ts
|
|
786
|
+
* import { throttleFn } from 'directix'
|
|
787
|
+
*
|
|
788
|
+
* const throttledUpdate = throttleFn(updateData, 1000)
|
|
789
|
+
*
|
|
790
|
+
* // Call multiple times, only executes once per second
|
|
791
|
+
* throttledUpdate(data)
|
|
792
|
+
* throttledUpdate(newData)
|
|
793
|
+
*
|
|
794
|
+
* // Cancel pending execution
|
|
795
|
+
* throttledUpdate.cancel()
|
|
796
|
+
* ```
|
|
797
|
+
*/
|
|
798
|
+
export declare function throttleFn<T extends (...args: any[]) => any>(fn: T, wait?: number, options?: {
|
|
799
|
+
leading?: boolean;
|
|
800
|
+
trailing?: boolean;
|
|
801
|
+
}): ComposableThrottledFunction<T>;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Touch gesture type
|
|
805
|
+
*/
|
|
806
|
+
export declare type TouchGesture = 'swipe' | 'pinch' | 'rotate' | 'tap' | 'longPress';
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Touch gesture event
|
|
810
|
+
*/
|
|
811
|
+
export declare interface TouchGestureEvent {
|
|
812
|
+
type: TouchGesture;
|
|
813
|
+
direction?: 'left' | 'right' | 'up' | 'down';
|
|
814
|
+
distance?: number;
|
|
815
|
+
angle?: number;
|
|
816
|
+
scale?: number;
|
|
817
|
+
rotation?: number;
|
|
818
|
+
center?: {
|
|
819
|
+
x: number;
|
|
820
|
+
y: number;
|
|
821
|
+
};
|
|
822
|
+
event: TouchEvent;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Trim position
|
|
827
|
+
*/
|
|
828
|
+
export declare type TrimPosition = 'start' | 'end' | 'both';
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Trim text based on options
|
|
832
|
+
*/
|
|
833
|
+
export declare function trimText(text: string, position?: TrimPosition, chars?: string): string;
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Utility function to truncate text to a specified length
|
|
837
|
+
*
|
|
838
|
+
* @param text - Text to truncate
|
|
839
|
+
* @param maxLength - Maximum length
|
|
840
|
+
* @param ellipsis - Ellipsis string
|
|
841
|
+
* @returns Truncated text
|
|
842
|
+
*
|
|
843
|
+
* @example
|
|
844
|
+
* ```ts
|
|
845
|
+
* import { truncateText } from 'directix'
|
|
846
|
+
*
|
|
847
|
+
* const short = truncateText('Very long text here', 10)
|
|
848
|
+
* // 'Very l...'
|
|
849
|
+
* ```
|
|
850
|
+
*/
|
|
851
|
+
export declare function truncateText(text: string, maxLength: number, ellipsis?: string): string;
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* Transform text to uppercase
|
|
855
|
+
*/
|
|
856
|
+
export declare function uppercaseText(text: string, firstOnly?: boolean): string;
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* Composable for capitalizing text
|
|
860
|
+
*
|
|
861
|
+
* @param options - Configuration options
|
|
862
|
+
* @returns Capitalized text utilities
|
|
863
|
+
*
|
|
864
|
+
* @example
|
|
865
|
+
* ```vue
|
|
866
|
+
* <script setup>
|
|
867
|
+
* import { ref } from 'vue'
|
|
868
|
+
* import { useCapitalcase } from 'directix'
|
|
869
|
+
*
|
|
870
|
+
* const title = ref('the quick brown fox')
|
|
871
|
+
*
|
|
872
|
+
* const { capitalized } = useCapitalcase({
|
|
873
|
+
* text: title,
|
|
874
|
+
* every: true
|
|
875
|
+
* })
|
|
876
|
+
* // capitalized.value = 'The Quick Brown Fox'
|
|
877
|
+
* </script>
|
|
878
|
+
*
|
|
879
|
+
* <template>
|
|
880
|
+
* <h1>{{ capitalized }}</h1>
|
|
881
|
+
* </template>
|
|
882
|
+
* ```
|
|
883
|
+
*/
|
|
884
|
+
export declare function useCapitalcase(options: UseCapitalcaseOptions): UseCapitalcaseReturn;
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Options for useCapitalcase composable
|
|
888
|
+
*/
|
|
889
|
+
export declare interface UseCapitalcaseOptions {
|
|
890
|
+
/**
|
|
891
|
+
* The text to capitalize
|
|
892
|
+
*/
|
|
893
|
+
text: string | Ref<string>;
|
|
894
|
+
/**
|
|
895
|
+
* Whether to capitalize each word or just the first word
|
|
896
|
+
* @default true
|
|
897
|
+
*/
|
|
898
|
+
every?: boolean | Ref<boolean>;
|
|
899
|
+
/**
|
|
900
|
+
* Words to keep lowercase (articles, prepositions, etc.)
|
|
901
|
+
* @default ['a', 'an', 'the', 'and', 'but', 'or', 'for', 'nor', 'on', 'at', 'to', 'from', 'by']
|
|
902
|
+
*/
|
|
903
|
+
keepLower?: string[] | Ref<string[]>;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Return type for useCapitalcase composable
|
|
908
|
+
*/
|
|
909
|
+
export declare interface UseCapitalcaseReturn {
|
|
910
|
+
/**
|
|
911
|
+
* The capitalized text
|
|
912
|
+
*/
|
|
913
|
+
capitalized: Ref<string>;
|
|
914
|
+
/**
|
|
915
|
+
* Original text
|
|
916
|
+
*/
|
|
917
|
+
original: Ref<string>;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Composable for preventing repeated clicks within a delay period
|
|
922
|
+
*
|
|
923
|
+
* @param options - Configuration options
|
|
924
|
+
* @returns Click delay utilities
|
|
925
|
+
*
|
|
926
|
+
* @example
|
|
927
|
+
* ```vue
|
|
928
|
+
* <script setup>
|
|
929
|
+
* import { useClickDelay } from 'directix'
|
|
930
|
+
*
|
|
931
|
+
* const { click, isPending } = useClickDelay({
|
|
932
|
+
* handler: async (event) => {
|
|
933
|
+
* await submitForm()
|
|
934
|
+
* },
|
|
935
|
+
* delay: 500
|
|
936
|
+
* })
|
|
937
|
+
* </script>
|
|
938
|
+
*
|
|
939
|
+
* <template>
|
|
940
|
+
* <button @click="click" :disabled="isPending">
|
|
941
|
+
* {{ isPending ? 'Processing...' : 'Submit' }}
|
|
942
|
+
* </button>
|
|
943
|
+
* </template>
|
|
944
|
+
* ```
|
|
945
|
+
*/
|
|
946
|
+
export declare function useClickDelay(options: UseClickDelayOptions): UseClickDelayReturn;
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Options for useClickDelay composable
|
|
950
|
+
*/
|
|
951
|
+
export declare interface UseClickDelayOptions {
|
|
952
|
+
/**
|
|
953
|
+
* Click handler
|
|
954
|
+
* @required
|
|
955
|
+
*/
|
|
956
|
+
handler: ClickDelayHandler;
|
|
957
|
+
/**
|
|
958
|
+
* Delay time in milliseconds
|
|
959
|
+
* @default 300
|
|
960
|
+
*/
|
|
961
|
+
delay?: number | Ref<number>;
|
|
811
962
|
/**
|
|
812
963
|
* Whether to disable
|
|
813
964
|
* @default false
|
|
814
965
|
*/
|
|
815
|
-
disabled?: boolean
|
|
966
|
+
disabled?: boolean | Ref<boolean>;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* Return type for useClickDelay composable
|
|
971
|
+
*/
|
|
972
|
+
export declare interface UseClickDelayReturn {
|
|
816
973
|
/**
|
|
817
|
-
*
|
|
818
|
-
* @default 10
|
|
974
|
+
* Whether a click is pending
|
|
819
975
|
*/
|
|
820
|
-
|
|
976
|
+
isPending: Ref<boolean>;
|
|
821
977
|
/**
|
|
822
|
-
*
|
|
978
|
+
* Trigger the click handler with delay protection
|
|
823
979
|
*/
|
|
824
|
-
|
|
980
|
+
click: (event: MouseEvent | TouchEvent) => void;
|
|
825
981
|
/**
|
|
826
|
-
*
|
|
982
|
+
* Manually reset the pending state
|
|
827
983
|
*/
|
|
828
|
-
|
|
984
|
+
reset: () => void;
|
|
829
985
|
/**
|
|
830
|
-
*
|
|
986
|
+
* Cancel any pending timeout
|
|
831
987
|
*/
|
|
832
|
-
|
|
988
|
+
cancel: () => void;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* Composable for detecting clicks outside an element
|
|
993
|
+
*
|
|
994
|
+
* @param options - Configuration options
|
|
995
|
+
* @returns Click outside utilities
|
|
996
|
+
*
|
|
997
|
+
* @example
|
|
998
|
+
* ```vue
|
|
999
|
+
* <script setup>
|
|
1000
|
+
* import { ref } from 'vue'
|
|
1001
|
+
* import { useClickOutside } from 'directix'
|
|
1002
|
+
*
|
|
1003
|
+
* const dropdown = ref(null)
|
|
1004
|
+
* const show = ref(false)
|
|
1005
|
+
*
|
|
1006
|
+
* const { bind } = useClickOutside({
|
|
1007
|
+
* handler: () => show.value = false,
|
|
1008
|
+
* exclude: [() => triggerRef.value]
|
|
1009
|
+
* })
|
|
1010
|
+
*
|
|
1011
|
+
* onMounted(() => bind(dropdown.value))
|
|
1012
|
+
* </script>
|
|
1013
|
+
* ```
|
|
1014
|
+
*/
|
|
1015
|
+
export declare function useClickOutside(options: UseClickOutsideOptions): UseClickOutsideReturn;
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* Options for useClickOutside composable
|
|
1019
|
+
*/
|
|
1020
|
+
export declare interface UseClickOutsideOptions {
|
|
833
1021
|
/**
|
|
834
|
-
*
|
|
835
|
-
* @default 100
|
|
1022
|
+
* Callback when clicking outside
|
|
836
1023
|
*/
|
|
837
|
-
|
|
1024
|
+
handler: ClickOutsideHandler;
|
|
838
1025
|
/**
|
|
839
|
-
*
|
|
1026
|
+
* Excluded element selectors or element references
|
|
1027
|
+
*/
|
|
1028
|
+
exclude?: (string | HTMLElement | (() => HTMLElement | null) | Ref<HTMLElement | null>)[];
|
|
1029
|
+
/**
|
|
1030
|
+
* Whether to use capture mode
|
|
840
1031
|
* @default true
|
|
841
1032
|
*/
|
|
842
|
-
|
|
1033
|
+
capture?: boolean;
|
|
843
1034
|
/**
|
|
844
|
-
*
|
|
1035
|
+
* Event types to listen for
|
|
1036
|
+
* @default ['click']
|
|
1037
|
+
*/
|
|
1038
|
+
events?: ('click' | 'mousedown' | 'mouseup' | 'touchstart' | 'touchend')[];
|
|
1039
|
+
/**
|
|
1040
|
+
* Stop propagation
|
|
845
1041
|
* @default false
|
|
846
1042
|
*/
|
|
847
1043
|
stop?: boolean;
|
|
1044
|
+
/**
|
|
1045
|
+
* Prevent default behavior
|
|
1046
|
+
* @default false
|
|
1047
|
+
*/
|
|
1048
|
+
prevent?: boolean;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* Return type for useClickOutside composable
|
|
1053
|
+
*/
|
|
1054
|
+
export declare interface UseClickOutsideReturn {
|
|
1055
|
+
/**
|
|
1056
|
+
* Bind click outside detection to an element
|
|
1057
|
+
*/
|
|
1058
|
+
bind: (element: HTMLElement) => () => void;
|
|
848
1059
|
}
|
|
849
1060
|
|
|
850
1061
|
/**
|
|
851
|
-
*
|
|
1062
|
+
* Composable for copying text to clipboard
|
|
1063
|
+
*
|
|
1064
|
+
* @param options - Configuration options
|
|
1065
|
+
* @returns Copy utilities
|
|
1066
|
+
*
|
|
1067
|
+
* @example
|
|
1068
|
+
* ```vue
|
|
1069
|
+
* <script setup>
|
|
1070
|
+
* import { useCopy } from 'directix'
|
|
1071
|
+
*
|
|
1072
|
+
* const text = ref('Hello World')
|
|
1073
|
+
* const { copy, copied, isSupported } = useCopy({ source: text })
|
|
1074
|
+
*
|
|
1075
|
+
* // Or use with inline text
|
|
1076
|
+
* const { copy } = useCopy()
|
|
1077
|
+
*
|
|
1078
|
+
* async function handleCopy() {
|
|
1079
|
+
* await copy('Custom text')
|
|
1080
|
+
* }
|
|
1081
|
+
* </script>
|
|
1082
|
+
*
|
|
1083
|
+
* <template>
|
|
1084
|
+
* <button @click="copy()" :disabled="!isSupported">
|
|
1085
|
+
* {{ copied ? 'Copied!' : 'Copy' }}
|
|
1086
|
+
* </button>
|
|
1087
|
+
* </template>
|
|
1088
|
+
* ```
|
|
1089
|
+
*/
|
|
1090
|
+
export declare function useCopy(options?: UseCopyOptions): UseCopyReturn;
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Options for useCopy composable
|
|
852
1094
|
*/
|
|
853
|
-
export declare
|
|
1095
|
+
export declare interface UseCopyOptions {
|
|
1096
|
+
/**
|
|
1097
|
+
* Source text to copy (can be reactive)
|
|
1098
|
+
*/
|
|
1099
|
+
source?: string | Ref<string>;
|
|
1100
|
+
/**
|
|
1101
|
+
* Callback on copy success
|
|
1102
|
+
*/
|
|
1103
|
+
onSuccess?: (text: string) => void;
|
|
1104
|
+
/**
|
|
1105
|
+
* Callback on copy error
|
|
1106
|
+
*/
|
|
1107
|
+
onError?: (error: Error) => void;
|
|
1108
|
+
/**
|
|
1109
|
+
* Time in ms to reset copied state
|
|
1110
|
+
* @default 1500
|
|
1111
|
+
*/
|
|
1112
|
+
copiedTimeout?: number;
|
|
1113
|
+
}
|
|
854
1114
|
|
|
855
1115
|
/**
|
|
856
|
-
*
|
|
1116
|
+
* Return type for useCopy composable
|
|
857
1117
|
*/
|
|
858
|
-
export declare interface
|
|
1118
|
+
export declare interface UseCopyReturn {
|
|
859
1119
|
/**
|
|
860
|
-
*
|
|
861
|
-
* @
|
|
1120
|
+
* Copy function
|
|
1121
|
+
* @param text - Optional text to copy (overrides source)
|
|
862
1122
|
*/
|
|
863
|
-
|
|
1123
|
+
copy: (text?: string) => Promise<boolean>;
|
|
864
1124
|
/**
|
|
865
|
-
*
|
|
866
|
-
|
|
1125
|
+
* Whether the last copy was successful
|
|
1126
|
+
*/
|
|
1127
|
+
copied: Readonly<Ref<boolean>>;
|
|
1128
|
+
/**
|
|
1129
|
+
* Error from the last copy attempt
|
|
1130
|
+
*/
|
|
1131
|
+
error: Readonly<Ref<Error | null>>;
|
|
1132
|
+
/**
|
|
1133
|
+
* Whether clipboard API is supported
|
|
867
1134
|
*/
|
|
868
|
-
|
|
1135
|
+
isSupported: boolean;
|
|
869
1136
|
}
|
|
870
1137
|
|
|
871
|
-
|
|
1138
|
+
/**
|
|
1139
|
+
* Composable for countdown timer functionality
|
|
1140
|
+
*
|
|
1141
|
+
* @param options - Configuration options
|
|
1142
|
+
* @returns Countdown utilities and state
|
|
1143
|
+
*
|
|
1144
|
+
* @example
|
|
1145
|
+
* ```vue
|
|
1146
|
+
* <script setup>
|
|
1147
|
+
* import { useCountdown } from 'directix'
|
|
1148
|
+
*
|
|
1149
|
+
* const targetDate = new Date(Date.now() + 60 * 60 * 1000) // 1 hour from now
|
|
1150
|
+
*
|
|
1151
|
+
* const { formatted, running, completed, pause, resume } = useCountdown({
|
|
1152
|
+
* target: targetDate,
|
|
1153
|
+
* format: 'hh:mm:ss',
|
|
1154
|
+
* onComplete: () => console.log('Done!')
|
|
1155
|
+
* })
|
|
1156
|
+
* </script>
|
|
1157
|
+
*
|
|
1158
|
+
* <template>
|
|
1159
|
+
* <div>
|
|
1160
|
+
* <p>{{ formatted }}</p>
|
|
1161
|
+
* <button @click="pause" v-if="running">Pause</button>
|
|
1162
|
+
* <button @click="resume" v-if="!running && !completed">Resume</button>
|
|
1163
|
+
* </div>
|
|
1164
|
+
* </template>
|
|
1165
|
+
* ```
|
|
1166
|
+
*/
|
|
1167
|
+
export declare function useCountdown(options: UseCountdownOptions): UseCountdownReturn;
|
|
872
1168
|
|
|
873
1169
|
/**
|
|
874
|
-
*
|
|
1170
|
+
* Options for useCountdown composable
|
|
875
1171
|
*/
|
|
876
|
-
export declare interface
|
|
877
|
-
/**
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
|
|
1172
|
+
export declare interface UseCountdownOptions {
|
|
1173
|
+
/**
|
|
1174
|
+
* Target time (Date object, timestamp, or ISO string)
|
|
1175
|
+
* @required
|
|
1176
|
+
*/
|
|
1177
|
+
target: Date | number | string | Ref<Date | number | string>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Format string or custom format function
|
|
1180
|
+
* - 'dd:hh:mm:ss' - Days:Hours:Minutes:Seconds
|
|
1181
|
+
* - 'hh:mm:ss' - Hours:Minutes:Seconds
|
|
1182
|
+
* - 'mm:ss' - Minutes:Seconds
|
|
1183
|
+
* - 'ss' - Seconds only
|
|
1184
|
+
* @default 'hh:mm:ss'
|
|
1185
|
+
*/
|
|
1186
|
+
format?: string | CountdownFormatFunction | Ref<string | CountdownFormatFunction>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Callback when countdown completes
|
|
1189
|
+
*/
|
|
1190
|
+
onComplete?: CountdownCompleteCallback;
|
|
1191
|
+
/**
|
|
1192
|
+
* Callback on each tick
|
|
1193
|
+
*/
|
|
1194
|
+
onTick?: CountdownTickCallback;
|
|
1195
|
+
/**
|
|
1196
|
+
* Update interval in milliseconds
|
|
1197
|
+
* @default 1000
|
|
1198
|
+
*/
|
|
1199
|
+
interval?: number | Ref<number>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Whether to show milliseconds
|
|
1202
|
+
* @default false
|
|
1203
|
+
*/
|
|
1204
|
+
showMilliseconds?: boolean | Ref<boolean>;
|
|
1205
|
+
/**
|
|
1206
|
+
* Whether to auto-start
|
|
1207
|
+
* @default true
|
|
1208
|
+
*/
|
|
1209
|
+
autoStart?: boolean | Ref<boolean>;
|
|
1210
|
+
/**
|
|
1211
|
+
* Custom labels for i18n
|
|
1212
|
+
*/
|
|
1213
|
+
labels?: {
|
|
1214
|
+
days?: string;
|
|
1215
|
+
hours?: string;
|
|
1216
|
+
minutes?: string;
|
|
1217
|
+
seconds?: string;
|
|
1218
|
+
milliseconds?: string;
|
|
1219
|
+
};
|
|
893
1220
|
}
|
|
894
1221
|
|
|
895
|
-
export declare type MoneyBinding = string | MoneyOptions;
|
|
896
|
-
|
|
897
1222
|
/**
|
|
898
|
-
*
|
|
1223
|
+
* Return type for useCountdown composable
|
|
899
1224
|
*/
|
|
900
|
-
export declare interface
|
|
901
|
-
/**
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
1225
|
+
export declare interface UseCountdownReturn {
|
|
1226
|
+
/**
|
|
1227
|
+
* Current countdown time
|
|
1228
|
+
*/
|
|
1229
|
+
time: Ref<CountdownTime>;
|
|
1230
|
+
/**
|
|
1231
|
+
* Formatted time string
|
|
1232
|
+
*/
|
|
1233
|
+
formatted: Ref<string>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Whether countdown is running
|
|
1236
|
+
*/
|
|
1237
|
+
running: Ref<boolean>;
|
|
1238
|
+
/**
|
|
1239
|
+
* Whether countdown is paused
|
|
1240
|
+
*/
|
|
1241
|
+
paused: Ref<boolean>;
|
|
1242
|
+
/**
|
|
1243
|
+
* Whether countdown has completed
|
|
1244
|
+
*/
|
|
1245
|
+
completed: Ref<boolean>;
|
|
1246
|
+
/**
|
|
1247
|
+
* Start the countdown
|
|
1248
|
+
*/
|
|
1249
|
+
start: () => void;
|
|
1250
|
+
/**
|
|
1251
|
+
* Pause the countdown
|
|
1252
|
+
*/
|
|
1253
|
+
pause: () => void;
|
|
1254
|
+
/**
|
|
1255
|
+
* Resume the countdown
|
|
1256
|
+
*/
|
|
1257
|
+
resume: () => void;
|
|
1258
|
+
/**
|
|
1259
|
+
* Reset the countdown
|
|
1260
|
+
*/
|
|
1261
|
+
reset: () => void;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
/**
|
|
1265
|
+
* Composable for debouncing function calls
|
|
1266
|
+
*
|
|
1267
|
+
* @param options - Configuration options
|
|
1268
|
+
* @returns Debounced function utilities
|
|
1269
|
+
*
|
|
1270
|
+
* @example
|
|
1271
|
+
* ```vue
|
|
1272
|
+
* <script setup>
|
|
1273
|
+
* import { ref } from 'vue'
|
|
1274
|
+
* import { useDebounce } from 'directix'
|
|
1275
|
+
*
|
|
1276
|
+
* const searchQuery = ref('')
|
|
1277
|
+
*
|
|
1278
|
+
* const { run: debouncedSearch } = useDebounce({
|
|
1279
|
+
* handler: (query: string) => {
|
|
1280
|
+
* console.log('Searching:', query)
|
|
1281
|
+
* },
|
|
1282
|
+
* wait: 500
|
|
1283
|
+
* })
|
|
1284
|
+
*
|
|
1285
|
+
* // Watch and debounce
|
|
1286
|
+
* watch(searchQuery, (query) => {
|
|
1287
|
+
* debouncedSearch(query)
|
|
1288
|
+
* })
|
|
1289
|
+
* </script>
|
|
1290
|
+
* ```
|
|
1291
|
+
*/
|
|
1292
|
+
export declare function useDebounce<T extends (...args: any[]) => any>(options: UseDebounceOptions<T>): UseDebounceReturn<T>;
|
|
1293
|
+
|
|
1294
|
+
/**
|
|
1295
|
+
* Options for useDebounce composable
|
|
1296
|
+
*/
|
|
1297
|
+
export declare interface UseDebounceOptions<T extends (...args: any[]) => any> {
|
|
1298
|
+
/**
|
|
1299
|
+
* Function to debounce
|
|
1300
|
+
*/
|
|
1301
|
+
handler: T;
|
|
1302
|
+
/**
|
|
1303
|
+
* Delay time in milliseconds
|
|
1304
|
+
* @default 300
|
|
1305
|
+
*/
|
|
1306
|
+
wait?: number | Ref<number>;
|
|
1307
|
+
/**
|
|
1308
|
+
* Whether to invoke immediately before delay starts
|
|
1309
|
+
* @default false
|
|
1310
|
+
*/
|
|
1311
|
+
leading?: boolean | Ref<boolean>;
|
|
1312
|
+
/**
|
|
1313
|
+
* Whether to invoke after delay ends
|
|
1314
|
+
* @default true
|
|
1315
|
+
*/
|
|
1316
|
+
trailing?: boolean | Ref<boolean>;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* Return type for useDebounce composable
|
|
1321
|
+
*/
|
|
1322
|
+
export declare interface UseDebounceReturn<T extends (...args: any[]) => any> {
|
|
1323
|
+
/**
|
|
1324
|
+
* Debounced function
|
|
1325
|
+
*/
|
|
1326
|
+
run: (...args: Parameters<T>) => void;
|
|
1327
|
+
/**
|
|
1328
|
+
* Cancel any pending execution
|
|
1329
|
+
*/
|
|
1330
|
+
cancel: () => void;
|
|
1331
|
+
/**
|
|
1332
|
+
* Immediately invoke if pending
|
|
1333
|
+
*/
|
|
1334
|
+
flush: () => void;
|
|
1335
|
+
/**
|
|
1336
|
+
* Check if there is a pending execution
|
|
1337
|
+
*/
|
|
1338
|
+
pending: () => boolean;
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* Composable for making elements draggable
|
|
1343
|
+
*
|
|
1344
|
+
* @param options - Configuration options
|
|
1345
|
+
* @returns Draggable utilities
|
|
1346
|
+
*
|
|
1347
|
+
* @example
|
|
1348
|
+
* ```vue
|
|
1349
|
+
* <script setup>
|
|
1350
|
+
* import { ref } from 'vue'
|
|
1351
|
+
* import { useDraggable } from 'directix'
|
|
1352
|
+
*
|
|
1353
|
+
* const target = ref(null)
|
|
1354
|
+
* const { position, isDragging, bind } = useDraggable({
|
|
1355
|
+
* constrain: true,
|
|
1356
|
+
* onEnd: (pos) => console.log('Dropped at:', pos)
|
|
1357
|
+
* })
|
|
1358
|
+
*
|
|
1359
|
+
* onMounted(() => bind(target.value))
|
|
1360
|
+
* </script>
|
|
1361
|
+
*
|
|
1362
|
+
* <template>
|
|
1363
|
+
* <div ref="target" :class="{ dragging: isDragging }">
|
|
1364
|
+
* Drag me!
|
|
1365
|
+
* </div>
|
|
1366
|
+
* </template>
|
|
1367
|
+
* ```
|
|
1368
|
+
*/
|
|
1369
|
+
export declare function useDraggable(options?: UseDraggableOptions): UseDraggableReturn;
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Options for useDraggable composable
|
|
1373
|
+
*/
|
|
1374
|
+
export declare interface UseDraggableOptions {
|
|
1375
|
+
/**
|
|
1376
|
+
* Drag axis
|
|
1377
|
+
* @default 'both'
|
|
1378
|
+
*/
|
|
1379
|
+
axis?: DraggableAxis | Ref<DraggableAxis>;
|
|
1380
|
+
/**
|
|
1381
|
+
* Constrain to parent element
|
|
1382
|
+
* @default false
|
|
1383
|
+
*/
|
|
1384
|
+
constrain?: boolean | Ref<boolean>;
|
|
1385
|
+
/**
|
|
1386
|
+
* Boundary element selector or element
|
|
1387
|
+
*/
|
|
1388
|
+
boundary?: string | HTMLElement | (() => HTMLElement | null);
|
|
1389
|
+
/**
|
|
1390
|
+
* Handle element selector
|
|
1391
|
+
*/
|
|
1392
|
+
handle?: string;
|
|
1393
|
+
/**
|
|
1394
|
+
* Grid snapping [x, y]
|
|
1395
|
+
*/
|
|
1396
|
+
grid?: [number, number] | Ref<[number, number]>;
|
|
1397
|
+
/**
|
|
1398
|
+
* Whether dragging is disabled
|
|
1399
|
+
* @default false
|
|
1400
|
+
*/
|
|
1401
|
+
disabled?: boolean | Ref<boolean>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Start drag callback
|
|
1404
|
+
*/
|
|
1405
|
+
onStart?: (position: Position, event: MouseEvent | TouchEvent) => void;
|
|
1406
|
+
/**
|
|
1407
|
+
* Drag callback
|
|
1408
|
+
*/
|
|
1409
|
+
onDrag?: (position: Position, event: MouseEvent | TouchEvent) => void;
|
|
1410
|
+
/**
|
|
1411
|
+
* End drag callback
|
|
1412
|
+
*/
|
|
1413
|
+
onEnd?: (position: Position, event: MouseEvent | TouchEvent) => void;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
/**
|
|
1417
|
+
* Return type for useDraggable composable
|
|
1418
|
+
*/
|
|
1419
|
+
export declare interface UseDraggableReturn {
|
|
1420
|
+
/** Current position */
|
|
1421
|
+
position: Readonly<Ref<Position>>;
|
|
1422
|
+
/** Whether the element is being dragged */
|
|
1423
|
+
isDragging: Readonly<Ref<boolean>>;
|
|
1424
|
+
/** Reset position to origin */
|
|
1425
|
+
reset: () => void;
|
|
1426
|
+
/** Bind draggable behavior to an element */
|
|
1427
|
+
bind: (element: HTMLElement) => () => void;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* Composable for text truncation with ellipsis
|
|
1432
|
+
*
|
|
1433
|
+
* @param options - Configuration options
|
|
1434
|
+
* @returns Truncated text utilities
|
|
1435
|
+
*
|
|
1436
|
+
* @example
|
|
1437
|
+
* ```vue
|
|
1438
|
+
* <script setup>
|
|
1439
|
+
* import { ref } from 'vue'
|
|
1440
|
+
* import { useEllipsis } from 'directix'
|
|
1441
|
+
*
|
|
1442
|
+
* const longText = ref('This is a very long text that needs to be truncated')
|
|
1443
|
+
*
|
|
1444
|
+
* const { truncated, isTruncated } = useEllipsis({
|
|
1445
|
+
* text: longText,
|
|
1446
|
+
* maxWidth: 200,
|
|
1447
|
+
* lines: 1
|
|
1448
|
+
* })
|
|
1449
|
+
* </script>
|
|
1450
|
+
*
|
|
1451
|
+
* <template>
|
|
1452
|
+
* <span :title="isTruncated ? longText : ''">
|
|
1453
|
+
* {{ truncated }}
|
|
1454
|
+
* </span>
|
|
1455
|
+
* </template>
|
|
1456
|
+
* ```
|
|
1457
|
+
*/
|
|
1458
|
+
export declare function useEllipsis(options: UseEllipsisOptions): UseEllipsisReturn;
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* Options for useEllipsis composable
|
|
1462
|
+
*/
|
|
1463
|
+
export declare interface UseEllipsisOptions {
|
|
1464
|
+
/**
|
|
1465
|
+
* The text to potentially truncate
|
|
1466
|
+
*/
|
|
1467
|
+
text: string | Ref<string>;
|
|
1468
|
+
/**
|
|
1469
|
+
* Number of lines to show before truncating
|
|
1470
|
+
* @default 1
|
|
1471
|
+
*/
|
|
1472
|
+
lines?: number | Ref<number>;
|
|
1473
|
+
/**
|
|
1474
|
+
* Custom ellipsis string
|
|
1475
|
+
* @default '...'
|
|
1476
|
+
*/
|
|
1477
|
+
ellipsis?: string | Ref<string>;
|
|
1478
|
+
/**
|
|
1479
|
+
* Maximum width in pixels (0 = no limit)
|
|
1480
|
+
* @default 0
|
|
1481
|
+
*/
|
|
1482
|
+
maxWidth?: number | Ref<number>;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
/**
|
|
1486
|
+
* Return type for useEllipsis composable
|
|
1487
|
+
*/
|
|
1488
|
+
export declare interface UseEllipsisReturn {
|
|
1489
|
+
/**
|
|
1490
|
+
* The truncated text
|
|
1491
|
+
*/
|
|
1492
|
+
truncated: Ref<string>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Whether the text is truncated
|
|
1495
|
+
*/
|
|
1496
|
+
isTruncated: Ref<boolean>;
|
|
1497
|
+
/**
|
|
1498
|
+
* Original text
|
|
1499
|
+
*/
|
|
1500
|
+
original: Ref<string>;
|
|
1501
|
+
/**
|
|
1502
|
+
* Calculate truncation for a given width
|
|
1503
|
+
*/
|
|
1504
|
+
calculateForWidth: (width: number) => string;
|
|
1505
|
+
/**
|
|
1506
|
+
* Check if text would be truncated at given width
|
|
1507
|
+
*/
|
|
1508
|
+
wouldTruncate: (width: number) => boolean;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* Composable for managing element focus
|
|
1513
|
+
*
|
|
1514
|
+
* @param options - Configuration options
|
|
1515
|
+
* @returns Focus utilities
|
|
1516
|
+
*
|
|
1517
|
+
* @example
|
|
1518
|
+
* ```vue
|
|
1519
|
+
* <script setup>
|
|
1520
|
+
* import { ref } from 'vue'
|
|
1521
|
+
* import { useFocus } from 'directix'
|
|
1522
|
+
*
|
|
1523
|
+
* const input = ref(null)
|
|
1524
|
+
* const { isFocused, focus, bind } = useFocus({
|
|
1525
|
+
* onBlur: () => validate()
|
|
1526
|
+
* })
|
|
1527
|
+
*
|
|
1528
|
+
* onMounted(() => bind(input.value))
|
|
1529
|
+
*
|
|
1530
|
+
* // Programmatically focus
|
|
1531
|
+
* function handleButtonClick() {
|
|
1532
|
+
* focus()
|
|
1533
|
+
* }
|
|
1534
|
+
* </script>
|
|
1535
|
+
*
|
|
1536
|
+
* <template>
|
|
1537
|
+
* <input ref="input" />
|
|
1538
|
+
* <button @click="focus">Focus Input</button>
|
|
1539
|
+
* </template>
|
|
1540
|
+
* ```
|
|
1541
|
+
*/
|
|
1542
|
+
export declare function useFocus(options?: UseFocusOptions): UseFocusReturn;
|
|
1543
|
+
|
|
1544
|
+
/**
|
|
1545
|
+
* Options for useFocus composable
|
|
1546
|
+
*/
|
|
1547
|
+
export declare interface UseFocusOptions {
|
|
1548
|
+
/**
|
|
1549
|
+
* Callback when element is focused
|
|
1550
|
+
*/
|
|
1551
|
+
onFocus?: (event: FocusEvent) => void;
|
|
1552
|
+
/**
|
|
1553
|
+
* Callback when element loses focus
|
|
1554
|
+
*/
|
|
1555
|
+
onBlur?: (event: FocusEvent) => void;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
/**
|
|
1559
|
+
* Return type for useFocus composable
|
|
1560
|
+
*/
|
|
1561
|
+
export declare interface UseFocusReturn {
|
|
1562
|
+
/** Whether the element is currently focused */
|
|
1563
|
+
isFocused: Readonly<Ref<boolean>>;
|
|
1564
|
+
/** Focus the element */
|
|
1565
|
+
focus: () => void;
|
|
1566
|
+
/** Blur the element */
|
|
1567
|
+
blur: () => void;
|
|
1568
|
+
/** Bind focus tracking to an element */
|
|
1569
|
+
bind: (element: HTMLElement) => () => void;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* Composable for handling keyboard shortcuts
|
|
1574
|
+
*
|
|
1575
|
+
* @param options - Configuration options
|
|
1576
|
+
* @returns Hotkey utilities
|
|
1577
|
+
*
|
|
1578
|
+
* @example
|
|
1579
|
+
* ```vue
|
|
1580
|
+
* <script setup>
|
|
1581
|
+
* import { useHotkey } from 'directix'
|
|
1582
|
+
*
|
|
1583
|
+
* const { enable, disable, add, remove } = useHotkey({
|
|
1584
|
+
* hotkeys: [
|
|
1585
|
+
* { key: 'ctrl+s', handler: (e) => save() },
|
|
1586
|
+
* { key: 'ctrl+z', handler: (e) => undo() },
|
|
1587
|
+
* ]
|
|
1588
|
+
* })
|
|
1589
|
+
*
|
|
1590
|
+
* // Add dynamic hotkey
|
|
1591
|
+
* add({ key: 'esc', handler: (e) => closeModal() })
|
|
1592
|
+
* </script>
|
|
1593
|
+
* ```
|
|
1594
|
+
*/
|
|
1595
|
+
export declare function useHotkey(options?: UseHotkeyOptions): UseHotkeyReturn;
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* Options for useHotkey composable
|
|
1599
|
+
*/
|
|
1600
|
+
export declare interface UseHotkeyOptions {
|
|
1601
|
+
/**
|
|
1602
|
+
* Single hotkey definition
|
|
1603
|
+
*/
|
|
1604
|
+
hotkey?: HotkeyDefinition;
|
|
1605
|
+
/**
|
|
1606
|
+
* Multiple hotkey definitions
|
|
1607
|
+
*/
|
|
1608
|
+
hotkeys?: HotkeyDefinition[];
|
|
1609
|
+
/**
|
|
1610
|
+
* Target element to bind events (defaults to document)
|
|
1611
|
+
*/
|
|
1612
|
+
target?: HTMLElement | Ref<HTMLElement | null>;
|
|
1613
|
+
/**
|
|
1614
|
+
* Whether to enable the hotkey(s)
|
|
1615
|
+
* @default true
|
|
1616
|
+
*/
|
|
1617
|
+
enabled?: boolean | Ref<boolean>;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* Return type for useHotkey composable
|
|
1622
|
+
*/
|
|
1623
|
+
export declare interface UseHotkeyReturn {
|
|
1624
|
+
/**
|
|
1625
|
+
* Whether the hotkey is currently enabled
|
|
1626
|
+
*/
|
|
1627
|
+
enabled: Ref<boolean>;
|
|
1628
|
+
/**
|
|
1629
|
+
* Enable the hotkey
|
|
1630
|
+
*/
|
|
1631
|
+
enable: () => void;
|
|
1632
|
+
/**
|
|
1633
|
+
* Disable the hotkey
|
|
1634
|
+
*/
|
|
1635
|
+
disable: () => void;
|
|
1636
|
+
/**
|
|
1637
|
+
* Toggle the hotkey
|
|
1638
|
+
*/
|
|
1639
|
+
toggle: () => void;
|
|
1640
|
+
/**
|
|
1641
|
+
* Add a hotkey
|
|
1642
|
+
*/
|
|
1643
|
+
add: (hotkey: HotkeyDefinition) => void;
|
|
1644
|
+
/**
|
|
1645
|
+
* Remove a hotkey by key
|
|
1646
|
+
*/
|
|
1647
|
+
remove: (key: string) => void;
|
|
1648
|
+
/**
|
|
1649
|
+
* Remove all hotkeys
|
|
1650
|
+
*/
|
|
1651
|
+
clear: () => void;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
/**
|
|
1655
|
+
* Composable for tracking hover state
|
|
1656
|
+
*
|
|
1657
|
+
* @param options - Configuration options
|
|
1658
|
+
* @returns Hover utilities
|
|
1659
|
+
*
|
|
1660
|
+
* @example
|
|
1661
|
+
* ```vue
|
|
1662
|
+
* <script setup>
|
|
1663
|
+
* import { ref } from 'vue'
|
|
1664
|
+
* import { useHover } from 'directix'
|
|
1665
|
+
*
|
|
1666
|
+
* const buttonRef = ref()
|
|
1667
|
+
* const { isHovering, bind } = useHover({
|
|
1668
|
+
* onEnter: () => console.log('Mouse entered'),
|
|
1669
|
+
* onLeave: () => console.log('Mouse left'),
|
|
1670
|
+
* enterDelay: 100
|
|
1671
|
+
* })
|
|
1672
|
+
*
|
|
1673
|
+
* onMounted(() => {
|
|
1674
|
+
* const unbind = bind(buttonRef.value)
|
|
1675
|
+
* onUnmounted(unbind)
|
|
1676
|
+
* })
|
|
1677
|
+
* </script>
|
|
1678
|
+
*
|
|
1679
|
+
* <template>
|
|
1680
|
+
* <button ref="buttonRef" :class="{ 'is-hovering': isHovering }">
|
|
1681
|
+
* Hover Me
|
|
1682
|
+
* </button>
|
|
1683
|
+
* </template>
|
|
1684
|
+
* ```
|
|
1685
|
+
*/
|
|
1686
|
+
export declare function useHover(options?: UseHoverOptions): UseHoverReturn;
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* Options for useHover composable
|
|
1690
|
+
*/
|
|
1691
|
+
export declare interface UseHoverOptions {
|
|
1692
|
+
/**
|
|
1693
|
+
* Callback when mouse enters
|
|
1694
|
+
*/
|
|
1695
|
+
onEnter?: (event: MouseEvent) => void;
|
|
1696
|
+
/**
|
|
1697
|
+
* Callback when mouse leaves
|
|
1698
|
+
*/
|
|
1699
|
+
onLeave?: (event: MouseEvent) => void;
|
|
1700
|
+
/**
|
|
1701
|
+
* CSS class to add when hovering
|
|
1702
|
+
*/
|
|
1703
|
+
class?: string;
|
|
1704
|
+
/**
|
|
1705
|
+
* Delay in milliseconds before triggering enter
|
|
1706
|
+
* @default 0
|
|
1707
|
+
*/
|
|
1708
|
+
enterDelay?: number | Ref<number>;
|
|
1709
|
+
/**
|
|
1710
|
+
* Delay in milliseconds before triggering leave
|
|
1711
|
+
* @default 0
|
|
1712
|
+
*/
|
|
1713
|
+
leaveDelay?: number | Ref<number>;
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* Return type for useHover composable
|
|
1718
|
+
*/
|
|
1719
|
+
export declare interface UseHoverReturn {
|
|
1720
|
+
/**
|
|
1721
|
+
* Whether the element is currently being hovered
|
|
1722
|
+
*/
|
|
1723
|
+
isHovering: Readonly<Ref<boolean>>;
|
|
1724
|
+
/**
|
|
1725
|
+
* Bind events to an element
|
|
1726
|
+
*/
|
|
1727
|
+
bind: (element: HTMLElement) => () => void;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
/**
|
|
1731
|
+
* Composable for image preview functionality
|
|
1732
|
+
*
|
|
1733
|
+
* @param options - Configuration options
|
|
1734
|
+
* @returns Image preview utilities
|
|
1735
|
+
*
|
|
1736
|
+
* @example
|
|
1737
|
+
* ```vue
|
|
1738
|
+
* <script setup>
|
|
1739
|
+
* import { ref } from 'vue'
|
|
1740
|
+
* import { useImagePreview } from 'directix'
|
|
1741
|
+
*
|
|
1742
|
+
* const imageRef = ref(null)
|
|
1743
|
+
* const { isOpen, bind, open, close } = useImagePreview()
|
|
1744
|
+
*
|
|
1745
|
+
* onMounted(() => bind(imageRef.value))
|
|
1746
|
+
*
|
|
1747
|
+
* function openCustomImage() {
|
|
1748
|
+
* open('https://example.com/high-res.jpg')
|
|
1749
|
+
* }
|
|
1750
|
+
* </script>
|
|
1751
|
+
*
|
|
1752
|
+
* <template>
|
|
1753
|
+
* <img ref="imageRef" src="thumbnail.jpg" />
|
|
1754
|
+
* </template>
|
|
1755
|
+
* ```
|
|
1756
|
+
*/
|
|
1757
|
+
export declare function useImagePreview(options?: UseImagePreviewOptions): UseImagePreviewReturn;
|
|
1758
|
+
|
|
1759
|
+
/**
|
|
1760
|
+
* Options for useImagePreview composable
|
|
1761
|
+
*/
|
|
1762
|
+
export declare interface UseImagePreviewOptions {
|
|
1763
|
+
/**
|
|
1764
|
+
* Initial image URL to preview
|
|
1765
|
+
*/
|
|
1766
|
+
src?: string | Ref<string>;
|
|
1767
|
+
/**
|
|
1768
|
+
* Close on click outside
|
|
1769
|
+
* @default true
|
|
1770
|
+
*/
|
|
1771
|
+
closeOnClickOutside?: boolean;
|
|
1772
|
+
/**
|
|
1773
|
+
* Close on escape key
|
|
1774
|
+
* @default true
|
|
1775
|
+
*/
|
|
1776
|
+
closeOnEsc?: boolean;
|
|
1777
|
+
/**
|
|
1778
|
+
* Show close button
|
|
1779
|
+
* @default true
|
|
1780
|
+
*/
|
|
1781
|
+
showCloseButton?: boolean;
|
|
1782
|
+
/**
|
|
1783
|
+
* Callback when preview opens
|
|
1784
|
+
*/
|
|
1785
|
+
onOpen?: () => void;
|
|
1786
|
+
/**
|
|
1787
|
+
* Callback when preview closes
|
|
1788
|
+
*/
|
|
1789
|
+
onClose?: () => void;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
/**
|
|
1793
|
+
* Return type for useImagePreview composable
|
|
1794
|
+
*/
|
|
1795
|
+
export declare interface UseImagePreviewReturn {
|
|
1796
|
+
/** Whether the preview is open */
|
|
1797
|
+
isOpen: Readonly<Ref<boolean>>;
|
|
1798
|
+
/** Current image URL */
|
|
1799
|
+
currentSrc: Readonly<Ref<string>>;
|
|
1800
|
+
/** Open preview with an image */
|
|
1801
|
+
open: (src?: string) => void;
|
|
1802
|
+
/** Close preview */
|
|
1803
|
+
close: () => void;
|
|
1804
|
+
/** Bind click-to-preview to an image element */
|
|
1805
|
+
bind: (element: HTMLImageElement) => () => void;
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
/**
|
|
1809
|
+
* Composable for detecting element intersection with viewport
|
|
1810
|
+
*
|
|
1811
|
+
* @param options - Configuration options
|
|
1812
|
+
* @returns Intersection utilities
|
|
1813
|
+
*
|
|
1814
|
+
* @example
|
|
1815
|
+
* ```vue
|
|
1816
|
+
* <script setup>
|
|
1817
|
+
* import { ref } from 'vue'
|
|
1818
|
+
* import { useIntersect } from 'directix'
|
|
1819
|
+
*
|
|
1820
|
+
* const target = ref(null)
|
|
1821
|
+
* const { isIntersecting, bind } = useIntersect({
|
|
1822
|
+
* threshold: 0.5,
|
|
1823
|
+
* onEnter: () => console.log('Entered'),
|
|
1824
|
+
* onLeave: () => console.log('Left')
|
|
1825
|
+
* })
|
|
1826
|
+
*
|
|
1827
|
+
* onMounted(() => bind(target.value))
|
|
1828
|
+
* </script>
|
|
1829
|
+
*
|
|
1830
|
+
* <template>
|
|
1831
|
+
* <div ref="target" :class="{ visible: isIntersecting }">
|
|
1832
|
+
* I'm visible!
|
|
1833
|
+
* </div>
|
|
1834
|
+
* </template>
|
|
1835
|
+
* ```
|
|
1836
|
+
*/
|
|
1837
|
+
export declare function useIntersect(options?: UseIntersectOptions): UseIntersectReturn;
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* Options for useIntersect composable
|
|
1841
|
+
*/
|
|
1842
|
+
export declare interface UseIntersectOptions {
|
|
1843
|
+
/**
|
|
1844
|
+
* Callback when element intersects
|
|
1845
|
+
*/
|
|
1846
|
+
handler?: IntersectHandler;
|
|
1847
|
+
/**
|
|
1848
|
+
* Callback when element enters viewport
|
|
1849
|
+
*/
|
|
1850
|
+
onEnter?: (entry: IntersectionObserverEntry, observer: IntersectionObserver) => void;
|
|
1851
|
+
/**
|
|
1852
|
+
* Callback when element leaves viewport
|
|
1853
|
+
*/
|
|
1854
|
+
onLeave?: (entry: IntersectionObserverEntry, observer: IntersectionObserver) => void;
|
|
1855
|
+
/**
|
|
1856
|
+
* Callback when element changes intersection
|
|
1857
|
+
*/
|
|
1858
|
+
onChange?: (isIntersecting: boolean, entry: IntersectionObserverEntry) => void;
|
|
1859
|
+
/**
|
|
1860
|
+
* Root element for intersection
|
|
1861
|
+
* @default null (viewport)
|
|
1862
|
+
*/
|
|
1863
|
+
root?: Element | null | Ref<Element | null>;
|
|
1864
|
+
/**
|
|
1865
|
+
* Margin around the root
|
|
1866
|
+
* @default '0px'
|
|
1867
|
+
*/
|
|
1868
|
+
rootMargin?: string;
|
|
1869
|
+
/**
|
|
1870
|
+
* Threshold(s) at which to trigger callback
|
|
1871
|
+
* @default 0
|
|
1872
|
+
*/
|
|
1873
|
+
threshold?: number | number[];
|
|
1874
|
+
/**
|
|
1875
|
+
* Whether to trigger only once
|
|
1876
|
+
* @default false
|
|
1877
|
+
*/
|
|
1878
|
+
once?: boolean;
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
/**
|
|
1882
|
+
* Return type for useIntersect composable
|
|
1883
|
+
*/
|
|
1884
|
+
export declare interface UseIntersectReturn {
|
|
1885
|
+
/**
|
|
1886
|
+
* Whether the element is currently intersecting
|
|
1887
|
+
*/
|
|
1888
|
+
isIntersecting: Readonly<Ref<boolean>>;
|
|
1889
|
+
/**
|
|
1890
|
+
* Current intersection ratio
|
|
1891
|
+
*/
|
|
1892
|
+
ratio: Readonly<Ref<number>>;
|
|
1893
|
+
/**
|
|
1894
|
+
* Bind intersection observer to an element
|
|
1895
|
+
*/
|
|
1896
|
+
bind: (element: HTMLElement) => () => void;
|
|
1897
|
+
/**
|
|
1898
|
+
* Stop observing
|
|
1899
|
+
*/
|
|
1900
|
+
stop: () => void;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* Composable for detecting long press gestures
|
|
1905
|
+
*
|
|
1906
|
+
* @param options - Configuration options
|
|
1907
|
+
* @returns Long press utilities
|
|
1908
|
+
*
|
|
1909
|
+
* @example
|
|
1910
|
+
* ```vue
|
|
1911
|
+
* <script setup>
|
|
1912
|
+
* import { useLongPress } from 'directix'
|
|
1913
|
+
*
|
|
1914
|
+
* const { bind, isPressing } = useLongPress({
|
|
1915
|
+
* onTrigger: (event) => {
|
|
1916
|
+
* console.log('Long press triggered!')
|
|
1917
|
+
* },
|
|
1918
|
+
* duration: 800
|
|
1919
|
+
* })
|
|
1920
|
+
*
|
|
1921
|
+
* // Bind to element
|
|
1922
|
+
* const buttonRef = ref()
|
|
1923
|
+
* onMounted(() => {
|
|
1924
|
+
* const unbind = bind(buttonRef.value)
|
|
1925
|
+
* onUnmounted(unbind)
|
|
1926
|
+
* })
|
|
1927
|
+
* </script>
|
|
1928
|
+
*
|
|
1929
|
+
* <template>
|
|
1930
|
+
* <button ref="buttonRef">Long Press Me</button>
|
|
1931
|
+
* </template>
|
|
1932
|
+
* ```
|
|
1933
|
+
*/
|
|
1934
|
+
export declare function useLongPress(options?: UseLongPressOptions): UseLongPressReturn;
|
|
1935
|
+
|
|
1936
|
+
/**
|
|
1937
|
+
* Options for useLongPress composable
|
|
1938
|
+
*/
|
|
1939
|
+
export declare interface UseLongPressOptions {
|
|
1940
|
+
/**
|
|
1941
|
+
* Duration in milliseconds to trigger long press
|
|
1942
|
+
* @default 500
|
|
1943
|
+
*/
|
|
1944
|
+
duration?: number | Ref<number>;
|
|
1945
|
+
/**
|
|
1946
|
+
* Maximum movement distance before canceling
|
|
1947
|
+
* @default 10
|
|
1948
|
+
*/
|
|
1949
|
+
distance?: number | Ref<number>;
|
|
1950
|
+
/**
|
|
1951
|
+
* Callback when long press starts (on mousedown/touchstart)
|
|
1952
|
+
*/
|
|
1953
|
+
onStart?: (event: MouseEvent | TouchEvent) => void;
|
|
1954
|
+
/**
|
|
1955
|
+
* Callback when long press is triggered
|
|
1956
|
+
*/
|
|
1957
|
+
onTrigger?: (event: MouseEvent | TouchEvent) => void;
|
|
1958
|
+
/**
|
|
1959
|
+
* Callback when long press is canceled
|
|
1960
|
+
*/
|
|
1961
|
+
onCancel?: (event: MouseEvent | TouchEvent) => void;
|
|
1962
|
+
/**
|
|
1963
|
+
* Callback on each tick during long press
|
|
1964
|
+
*/
|
|
1965
|
+
onTick?: (remaining: number) => void;
|
|
1966
|
+
/**
|
|
1967
|
+
* Interval for onTick callback in milliseconds
|
|
1968
|
+
* @default 100
|
|
1969
|
+
*/
|
|
1970
|
+
tickInterval?: number;
|
|
1971
|
+
/**
|
|
1972
|
+
* Whether to prevent default behavior
|
|
1973
|
+
* @default true
|
|
1974
|
+
*/
|
|
1975
|
+
prevent?: boolean;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
/**
|
|
1979
|
+
* Return type for useLongPress composable
|
|
1980
|
+
*/
|
|
1981
|
+
export declare interface UseLongPressReturn {
|
|
1982
|
+
/**
|
|
1983
|
+
* Whether a long press is currently in progress
|
|
1984
|
+
*/
|
|
1985
|
+
isPressing: Readonly<Ref<boolean>>;
|
|
1986
|
+
/**
|
|
1987
|
+
* Start long press detection
|
|
1988
|
+
*/
|
|
1989
|
+
start: (event: MouseEvent | TouchEvent) => void;
|
|
1990
|
+
/**
|
|
1991
|
+
* Stop long press detection
|
|
1992
|
+
*/
|
|
1993
|
+
stop: (event: MouseEvent | TouchEvent) => void;
|
|
1994
|
+
/**
|
|
1995
|
+
* Bind events to an element
|
|
1996
|
+
*/
|
|
1997
|
+
bind: (element: HTMLElement) => () => void;
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
/**
|
|
2001
|
+
* Composable for transforming text to lowercase
|
|
2002
|
+
*
|
|
2003
|
+
* @param options - Configuration options
|
|
2004
|
+
* @returns Lowercase text utilities
|
|
2005
|
+
*
|
|
2006
|
+
* @example
|
|
2007
|
+
* ```vue
|
|
2008
|
+
* <script setup>
|
|
2009
|
+
* import { ref } from 'vue'
|
|
2010
|
+
* import { useLowercase } from 'directix'
|
|
2011
|
+
*
|
|
2012
|
+
* const text = ref('HELLO WORLD')
|
|
2013
|
+
*
|
|
2014
|
+
* const { transformed } = useLowercase({ text })
|
|
2015
|
+
* // transformed.value = 'hello world'
|
|
2016
|
+
* </script>
|
|
2017
|
+
*
|
|
2018
|
+
* <template>
|
|
2019
|
+
* <p>{{ transformed }}</p>
|
|
2020
|
+
* </template>
|
|
2021
|
+
* ```
|
|
2022
|
+
*/
|
|
2023
|
+
export declare function useLowercase(options: UseLowercaseOptions): UseLowercaseReturn;
|
|
2024
|
+
|
|
2025
|
+
/**
|
|
2026
|
+
* Options for useLowercase composable
|
|
2027
|
+
*/
|
|
2028
|
+
export declare interface UseLowercaseOptions {
|
|
2029
|
+
/**
|
|
2030
|
+
* The text to transform
|
|
2031
|
+
*/
|
|
2032
|
+
text: string | Ref<string>;
|
|
2033
|
+
/**
|
|
2034
|
+
* Transform only the first character
|
|
2035
|
+
* @default false
|
|
2036
|
+
*/
|
|
2037
|
+
first?: boolean | Ref<boolean>;
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
/**
|
|
2041
|
+
* Return type for useLowercase composable
|
|
2042
|
+
*/
|
|
2043
|
+
export declare interface UseLowercaseReturn {
|
|
2044
|
+
/**
|
|
2045
|
+
* The transformed text
|
|
2046
|
+
*/
|
|
2047
|
+
transformed: Ref<string>;
|
|
2048
|
+
/**
|
|
2049
|
+
* Original text
|
|
2050
|
+
*/
|
|
2051
|
+
original: Ref<string>;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
/**
|
|
2055
|
+
* Composable for formatting numbers as money
|
|
2056
|
+
*
|
|
2057
|
+
* @param options - Configuration options
|
|
2058
|
+
* @returns Money formatting utilities
|
|
2059
|
+
*
|
|
2060
|
+
* @example
|
|
2061
|
+
* ```vue
|
|
2062
|
+
* <script setup>
|
|
2063
|
+
* import { ref } from 'vue'
|
|
2064
|
+
* import { useMoney } from 'directix'
|
|
2065
|
+
*
|
|
2066
|
+
* const price = ref(1234.56)
|
|
2067
|
+
*
|
|
2068
|
+
* const { formatted } = useMoney({
|
|
2069
|
+
* value: price,
|
|
2070
|
+
* symbol: '€',
|
|
2071
|
+
* symbolPosition: 'after'
|
|
2072
|
+
* })
|
|
2073
|
+
* // formatted.value = '1,234.56€'
|
|
2074
|
+
* </script>
|
|
2075
|
+
*
|
|
2076
|
+
* <template>
|
|
2077
|
+
* <span>{{ formatted }}</span>
|
|
2078
|
+
* </template>
|
|
2079
|
+
* ```
|
|
2080
|
+
*/
|
|
2081
|
+
export declare function useMoney(options: UseMoneyOptions): UseMoneyReturn;
|
|
2082
|
+
|
|
2083
|
+
/**
|
|
2084
|
+
* Options for useMoney composable
|
|
2085
|
+
*/
|
|
2086
|
+
export declare interface UseMoneyOptions {
|
|
2087
|
+
/**
|
|
2088
|
+
* The numeric value
|
|
2089
|
+
*/
|
|
2090
|
+
value: number | Ref<number>;
|
|
2091
|
+
/**
|
|
2092
|
+
* Currency symbol
|
|
2093
|
+
* @default '$'
|
|
2094
|
+
*/
|
|
2095
|
+
symbol?: string | Ref<string>;
|
|
2096
|
+
/**
|
|
2097
|
+
* Symbol position
|
|
2098
|
+
* @default 'before'
|
|
2099
|
+
*/
|
|
2100
|
+
symbolPosition?: 'before' | 'after' | Ref<'before' | 'after'>;
|
|
2101
|
+
/**
|
|
2102
|
+
* Number of decimal places
|
|
2103
|
+
* @default 2
|
|
2104
|
+
*/
|
|
2105
|
+
precision?: number | Ref<number>;
|
|
2106
|
+
/**
|
|
2107
|
+
* Thousands separator
|
|
2108
|
+
* @default ','
|
|
2109
|
+
*/
|
|
2110
|
+
separator?: string | Ref<string>;
|
|
2111
|
+
/**
|
|
2112
|
+
* Decimal separator
|
|
2113
|
+
* @default '.'
|
|
2114
|
+
*/
|
|
2115
|
+
decimal?: string | Ref<string>;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* Return type for useMoney composable
|
|
2120
|
+
*/
|
|
2121
|
+
export declare interface UseMoneyReturn {
|
|
2122
|
+
/**
|
|
2123
|
+
* The formatted money string
|
|
2124
|
+
*/
|
|
2125
|
+
formatted: Ref<string>;
|
|
2126
|
+
/**
|
|
2127
|
+
* The numeric value
|
|
2128
|
+
*/
|
|
2129
|
+
value: Ref<number>;
|
|
2130
|
+
/**
|
|
2131
|
+
* Parse a formatted string back to number
|
|
2132
|
+
*/
|
|
2133
|
+
parse: (formatted: string) => number;
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
/**
|
|
2137
|
+
* Composable for formatting numbers
|
|
2138
|
+
*
|
|
2139
|
+
* @param options - Configuration options
|
|
2140
|
+
* @returns Number formatting utilities
|
|
2141
|
+
*
|
|
2142
|
+
* @example
|
|
2143
|
+
* ```vue
|
|
2144
|
+
* <script setup>
|
|
2145
|
+
* import { ref } from 'vue'
|
|
2146
|
+
* import { useNumber } from 'directix'
|
|
2147
|
+
*
|
|
2148
|
+
* const count = ref(1234567)
|
|
2149
|
+
*
|
|
2150
|
+
* const { formatted } = useNumber({
|
|
2151
|
+
* value: count,
|
|
2152
|
+
* precision: 2,
|
|
2153
|
+
* suffix: ' items'
|
|
2154
|
+
* })
|
|
2155
|
+
* // formatted.value = '1,234,567.00 items'
|
|
2156
|
+
* </script>
|
|
2157
|
+
*
|
|
2158
|
+
* <template>
|
|
2159
|
+
* <span>{{ formatted }}</span>
|
|
2160
|
+
* </template>
|
|
2161
|
+
* ```
|
|
2162
|
+
*/
|
|
2163
|
+
export declare function useNumber(options: UseNumberOptions): UseNumberReturn;
|
|
2164
|
+
|
|
2165
|
+
/**
|
|
2166
|
+
* Options for useNumber composable
|
|
2167
|
+
*/
|
|
2168
|
+
export declare interface UseNumberOptions {
|
|
2169
|
+
/**
|
|
2170
|
+
* The numeric value
|
|
2171
|
+
*/
|
|
2172
|
+
value: number | Ref<number>;
|
|
2173
|
+
/**
|
|
2174
|
+
* Number of decimal places
|
|
2175
|
+
* @default 0
|
|
2176
|
+
*/
|
|
2177
|
+
precision?: number | Ref<number>;
|
|
2178
|
+
/**
|
|
2179
|
+
* Thousands separator
|
|
2180
|
+
* @default ','
|
|
2181
|
+
*/
|
|
2182
|
+
separator?: string | Ref<string>;
|
|
2183
|
+
/**
|
|
2184
|
+
* Decimal separator
|
|
2185
|
+
* @default '.'
|
|
2186
|
+
*/
|
|
2187
|
+
decimal?: string | Ref<string>;
|
|
2188
|
+
/**
|
|
2189
|
+
* Prefix string (e.g., '$')
|
|
2190
|
+
*/
|
|
2191
|
+
prefix?: string | Ref<string>;
|
|
2192
|
+
/**
|
|
2193
|
+
* Suffix string (e.g., '%')
|
|
2194
|
+
*/
|
|
2195
|
+
suffix?: string | Ref<string>;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
/**
|
|
2199
|
+
* Return type for useNumber composable
|
|
2200
|
+
*/
|
|
2201
|
+
export declare interface UseNumberReturn {
|
|
2202
|
+
/**
|
|
2203
|
+
* The formatted number string
|
|
2204
|
+
*/
|
|
2205
|
+
formatted: Ref<string>;
|
|
2206
|
+
/**
|
|
2207
|
+
* The numeric value
|
|
2208
|
+
*/
|
|
2209
|
+
value: Ref<number>;
|
|
2210
|
+
/**
|
|
2211
|
+
* Parse a formatted string back to number
|
|
2212
|
+
*/
|
|
2213
|
+
parse: (formatted: string) => number;
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
/**
|
|
2217
|
+
* Composable for checking user permissions
|
|
2218
|
+
*
|
|
2219
|
+
* @param options - Configuration options
|
|
2220
|
+
* @returns Permission utilities
|
|
2221
|
+
*
|
|
2222
|
+
* @example
|
|
2223
|
+
* ```vue
|
|
2224
|
+
* <script setup>
|
|
2225
|
+
* import { usePermission } from 'directix'
|
|
2226
|
+
*
|
|
2227
|
+
* const { granted } = usePermission({
|
|
2228
|
+
* value: 'admin',
|
|
2229
|
+
* getPermissions: () => store.getters.permissions,
|
|
2230
|
+
* getRoles: () => store.getters.roles,
|
|
2231
|
+
* roleMap: { admin: ['*'], editor: ['read', 'write'] }
|
|
2232
|
+
* })
|
|
2233
|
+
* </script>
|
|
2234
|
+
*
|
|
2235
|
+
* <template>
|
|
2236
|
+
* <button v-if="granted">Admin Only Action</button>
|
|
2237
|
+
* </template>
|
|
2238
|
+
* ```
|
|
2239
|
+
*/
|
|
2240
|
+
export declare function usePermission(options: UsePermissionOptions): UsePermissionReturn;
|
|
2241
|
+
|
|
2242
|
+
/**
|
|
2243
|
+
* Options for usePermission composable
|
|
2244
|
+
*/
|
|
2245
|
+
export declare interface UsePermissionOptions {
|
|
2246
|
+
/**
|
|
2247
|
+
* Permission value(s) to check
|
|
2248
|
+
*/
|
|
2249
|
+
value: string | string[] | Ref<string | string[]>;
|
|
2250
|
+
/**
|
|
2251
|
+
* Logic for multiple permissions: 'some' (OR) or 'every' (AND)
|
|
2252
|
+
* @default 'some'
|
|
2253
|
+
*/
|
|
2254
|
+
mode?: PermissionMode | Ref<PermissionMode>;
|
|
2255
|
+
/**
|
|
2256
|
+
* Custom permission check function
|
|
2257
|
+
*/
|
|
2258
|
+
check?: (permission: string | string[], mode: PermissionMode) => boolean;
|
|
2259
|
+
/**
|
|
2260
|
+
* Get current user's permissions
|
|
2261
|
+
*/
|
|
2262
|
+
getPermissions?: () => string[];
|
|
2263
|
+
/**
|
|
2264
|
+
* Get current user's roles
|
|
2265
|
+
*/
|
|
2266
|
+
getRoles?: () => string[];
|
|
2267
|
+
/**
|
|
2268
|
+
* Role to permission mapping
|
|
2269
|
+
*/
|
|
2270
|
+
roleMap?: Record<string, string[]>;
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
/**
|
|
2274
|
+
* Return type for usePermission composable
|
|
2275
|
+
*/
|
|
2276
|
+
export declare interface UsePermissionReturn {
|
|
2277
|
+
/** Whether the permission is granted */
|
|
2278
|
+
granted: Readonly<Ref<boolean>>;
|
|
2279
|
+
/** Re-check permission */
|
|
2280
|
+
recheck: () => void;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
/**
|
|
2284
|
+
* Composable for printing functionality
|
|
2285
|
+
*
|
|
2286
|
+
* @param options - Configuration options
|
|
2287
|
+
* @returns Print utilities
|
|
2288
|
+
*
|
|
2289
|
+
* @example
|
|
2290
|
+
* ```vue
|
|
2291
|
+
* <script setup>
|
|
2292
|
+
* import { usePrint } from 'directix'
|
|
2293
|
+
*
|
|
2294
|
+
* const { isPrinting, print } = usePrint({
|
|
2295
|
+
* title: 'My Document',
|
|
2296
|
+
* onBeforePrint: () => {
|
|
2297
|
+
* console.log('About to print...')
|
|
2298
|
+
* return true
|
|
2299
|
+
* },
|
|
2300
|
+
* onAfterPrint: () => {
|
|
2301
|
+
* console.log('Print complete!')
|
|
2302
|
+
* }
|
|
2303
|
+
* })
|
|
2304
|
+
*
|
|
2305
|
+
* async function handlePrint() {
|
|
2306
|
+
* await print('#content')
|
|
2307
|
+
* }
|
|
2308
|
+
* </script>
|
|
2309
|
+
*
|
|
2310
|
+
* <template>
|
|
2311
|
+
* <div>
|
|
2312
|
+
* <button @click="handlePrint" :disabled="isPrinting">
|
|
2313
|
+
* {{ isPrinting ? 'Printing...' : 'Print' }}
|
|
2314
|
+
* </button>
|
|
2315
|
+
* <div id="content">Content to print</div>
|
|
2316
|
+
* </div>
|
|
2317
|
+
* </template>
|
|
2318
|
+
* ```
|
|
2319
|
+
*/
|
|
2320
|
+
export declare function usePrint(options?: UsePrintOptions): UsePrintReturn;
|
|
2321
|
+
|
|
2322
|
+
/**
|
|
2323
|
+
* Options for usePrint composable
|
|
2324
|
+
*/
|
|
2325
|
+
export declare interface UsePrintOptions {
|
|
2326
|
+
/**
|
|
2327
|
+
* Title for the printed document
|
|
2328
|
+
*/
|
|
2329
|
+
title?: string | Ref<string>;
|
|
2330
|
+
/**
|
|
2331
|
+
* Additional CSS styles to inject
|
|
2332
|
+
*/
|
|
2333
|
+
styles?: string | string[] | Ref<string | string[]>;
|
|
2334
|
+
/**
|
|
2335
|
+
* Additional CSS URLs to include
|
|
2336
|
+
*/
|
|
2337
|
+
cssUrls?: string[] | Ref<string[]>;
|
|
2338
|
+
/**
|
|
2339
|
+
* Callback before printing
|
|
2340
|
+
* Return false to cancel printing
|
|
2341
|
+
*/
|
|
2342
|
+
onBeforePrint?: PrintBeforeCallback;
|
|
2343
|
+
/**
|
|
2344
|
+
* Callback after printing
|
|
2345
|
+
*/
|
|
2346
|
+
onAfterPrint?: PrintCompleteCallback;
|
|
2347
|
+
/**
|
|
2348
|
+
* Whether to print in a new window
|
|
2349
|
+
* @default false
|
|
2350
|
+
*/
|
|
2351
|
+
newWindow?: boolean | Ref<boolean>;
|
|
2352
|
+
/**
|
|
2353
|
+
* Custom class for print container
|
|
2354
|
+
*/
|
|
2355
|
+
printClass?: string | Ref<string>;
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
/**
|
|
2359
|
+
* Return type for usePrint composable
|
|
2360
|
+
*/
|
|
2361
|
+
export declare interface UsePrintReturn {
|
|
2362
|
+
/**
|
|
2363
|
+
* Whether printing is in progress
|
|
2364
|
+
*/
|
|
2365
|
+
isPrinting: Ref<boolean>;
|
|
2366
|
+
/**
|
|
2367
|
+
* Print the specified element or selector
|
|
2368
|
+
*/
|
|
2369
|
+
print: (target?: string | HTMLElement) => Promise<void>;
|
|
2370
|
+
/**
|
|
2371
|
+
* Print the current page
|
|
2372
|
+
*/
|
|
2373
|
+
printPage: () => Promise<void>;
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
/**
|
|
2377
|
+
* Composable for pull to refresh functionality
|
|
2378
|
+
*
|
|
2379
|
+
* @param options - Configuration options
|
|
2380
|
+
* @returns Pull refresh utilities and state
|
|
2381
|
+
*
|
|
2382
|
+
* @example
|
|
2383
|
+
* ```vue
|
|
2384
|
+
* <script setup>
|
|
2385
|
+
* import { usePullRefresh } from 'directix'
|
|
2386
|
+
*
|
|
2387
|
+
* const { state, distance, events, containerRef } = usePullRefresh({
|
|
2388
|
+
* handler: async () => {
|
|
2389
|
+
* await fetchData()
|
|
2390
|
+
* },
|
|
2391
|
+
* distance: 80
|
|
2392
|
+
* })
|
|
2393
|
+
* </script>
|
|
2394
|
+
*
|
|
2395
|
+
* <template>
|
|
2396
|
+
* <div
|
|
2397
|
+
* ref="containerRef"
|
|
2398
|
+
* @touchstart="events.touchstart"
|
|
2399
|
+
* @touchmove="events.touchmove"
|
|
2400
|
+
* @touchend="events.touchend"
|
|
2401
|
+
* >
|
|
2402
|
+
* <div class="indicator" :style="{ transform: `translateY(${distance}px)` }">
|
|
2403
|
+
* {{ state }}
|
|
2404
|
+
* </div>
|
|
2405
|
+
* <slot></slot>
|
|
2406
|
+
* </div>
|
|
2407
|
+
* </template>
|
|
2408
|
+
* ```
|
|
2409
|
+
*/
|
|
2410
|
+
export declare function usePullRefresh(options: UsePullRefreshOptions): UsePullRefreshReturn;
|
|
2411
|
+
|
|
2412
|
+
/**
|
|
2413
|
+
* Options for usePullRefresh composable
|
|
2414
|
+
*/
|
|
2415
|
+
export declare interface UsePullRefreshOptions {
|
|
2416
|
+
/**
|
|
2417
|
+
* Refresh handler
|
|
2418
|
+
* @required
|
|
2419
|
+
*/
|
|
2420
|
+
handler: PullRefreshHandler;
|
|
2421
|
+
/**
|
|
2422
|
+
* Distance threshold to trigger refresh
|
|
2423
|
+
* @default 60
|
|
2424
|
+
*/
|
|
2425
|
+
distance?: number | Ref<number>;
|
|
2426
|
+
/**
|
|
2427
|
+
* Maximum pull distance
|
|
2428
|
+
* @default 100
|
|
2429
|
+
*/
|
|
2430
|
+
maxDistance?: number | Ref<number>;
|
|
2431
|
+
/**
|
|
2432
|
+
* Whether to disable pull to refresh
|
|
2433
|
+
* @default false
|
|
2434
|
+
*/
|
|
2435
|
+
disabled?: boolean | Ref<boolean>;
|
|
2436
|
+
/**
|
|
2437
|
+
* Duration to show success indicator
|
|
2438
|
+
* @default 500
|
|
2439
|
+
*/
|
|
2440
|
+
successDuration?: number | Ref<number>;
|
|
2441
|
+
/**
|
|
2442
|
+
* Duration to show error indicator
|
|
2443
|
+
* @default 1000
|
|
2444
|
+
*/
|
|
2445
|
+
errorDuration?: number | Ref<number>;
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
/**
|
|
2449
|
+
* Return type for usePullRefresh composable
|
|
2450
|
+
*/
|
|
2451
|
+
export declare interface UsePullRefreshReturn {
|
|
2452
|
+
/**
|
|
2453
|
+
* Current pull refresh state
|
|
2454
|
+
*/
|
|
2455
|
+
state: Ref<PullRefreshState>;
|
|
2456
|
+
/**
|
|
2457
|
+
* Current pull distance
|
|
2458
|
+
*/
|
|
2459
|
+
distance: Ref<number>;
|
|
2460
|
+
/**
|
|
2461
|
+
* Whether pull to refresh is currently active
|
|
2462
|
+
*/
|
|
2463
|
+
isPulling: Ref<boolean>;
|
|
2464
|
+
/**
|
|
2465
|
+
* Event handlers to bind to the container element
|
|
2466
|
+
*/
|
|
2467
|
+
events: {
|
|
2468
|
+
touchstart: (e: TouchEvent) => void;
|
|
2469
|
+
touchmove: (e: TouchEvent) => void;
|
|
2470
|
+
touchend: () => void;
|
|
2471
|
+
};
|
|
2472
|
+
/**
|
|
2473
|
+
* Container ref to bind to the scroll container
|
|
2474
|
+
*/
|
|
2475
|
+
containerRef: Ref<HTMLElement | null>;
|
|
2476
|
+
/**
|
|
2477
|
+
* Manually trigger refresh
|
|
2478
|
+
*/
|
|
2479
|
+
refresh: () => Promise<void>;
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
/**
|
|
2483
|
+
* Composable for tracking element resize
|
|
2484
|
+
*
|
|
2485
|
+
* @param options - Configuration options
|
|
2486
|
+
* @returns Resize utilities
|
|
2487
|
+
*
|
|
2488
|
+
* @example
|
|
2489
|
+
* ```vue
|
|
2490
|
+
* <script setup>
|
|
2491
|
+
* import { ref } from 'vue'
|
|
2492
|
+
* import { useResize } from 'directix'
|
|
2493
|
+
*
|
|
2494
|
+
* const target = ref(null)
|
|
2495
|
+
* const { width, height, bind } = useResize({
|
|
2496
|
+
* debounce: 100,
|
|
2497
|
+
* onResize: (info) => console.log('Resized:', info.width, info.height)
|
|
2498
|
+
* })
|
|
2499
|
+
*
|
|
2500
|
+
* onMounted(() => bind(target.value))
|
|
2501
|
+
* </script>
|
|
2502
|
+
*
|
|
2503
|
+
* <template>
|
|
2504
|
+
* <div ref="target">
|
|
2505
|
+
* Size: {{ width }} x {{ height }}
|
|
2506
|
+
* </div>
|
|
2507
|
+
* </template>
|
|
2508
|
+
* ```
|
|
2509
|
+
*/
|
|
2510
|
+
export declare function useResize(options?: UseResizeOptions): UseResizeReturn;
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* Options for useResize composable
|
|
2514
|
+
*/
|
|
2515
|
+
export declare interface UseResizeOptions {
|
|
2516
|
+
/**
|
|
2517
|
+
* Debounce time in milliseconds
|
|
2518
|
+
* @default 0 (no debounce)
|
|
2519
|
+
*/
|
|
2520
|
+
debounce?: number | Ref<number>;
|
|
2521
|
+
/**
|
|
2522
|
+
* Box model to observe
|
|
2523
|
+
* @default 'content-box'
|
|
2524
|
+
*/
|
|
2525
|
+
box?: 'content-box' | 'border-box' | 'device-pixel-content-box';
|
|
2526
|
+
/**
|
|
2527
|
+
* Callback when resize occurs
|
|
2528
|
+
*/
|
|
2529
|
+
onResize?: (info: ResizeInfo) => void;
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
/**
|
|
2533
|
+
* Return type for useResize composable
|
|
2534
|
+
*/
|
|
2535
|
+
export declare interface UseResizeReturn {
|
|
2536
|
+
/** Current width */
|
|
2537
|
+
width: Readonly<Ref<number>>;
|
|
2538
|
+
/** Current height */
|
|
2539
|
+
height: Readonly<Ref<number>>;
|
|
2540
|
+
/** Bind resize observer to an element */
|
|
2541
|
+
bind: (element: HTMLElement) => () => void;
|
|
2542
|
+
/** Stop observing */
|
|
2543
|
+
stop: () => void;
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
/**
|
|
2547
|
+
* Composable for tracking scroll position
|
|
2548
|
+
*
|
|
2549
|
+
* @param options - Configuration options
|
|
2550
|
+
* @returns Scroll utilities
|
|
2551
|
+
*
|
|
2552
|
+
* @example
|
|
2553
|
+
* ```vue
|
|
2554
|
+
* <script setup>
|
|
2555
|
+
* import { ref } from 'vue'
|
|
2556
|
+
* import { useScroll } from 'directix'
|
|
2557
|
+
*
|
|
2558
|
+
* const container = ref(null)
|
|
2559
|
+
* const { scrollTop, progressY, directionY, bind } = useScroll()
|
|
2560
|
+
*
|
|
2561
|
+
* onMounted(() => bind(container.value))
|
|
2562
|
+
* </script>
|
|
2563
|
+
*
|
|
2564
|
+
* <template>
|
|
2565
|
+
* <div ref="container" class="scroll-container">
|
|
2566
|
+
* <div class="progress" :style="{ width: `${progressY * 100}%` }" />
|
|
2567
|
+
* </div>
|
|
2568
|
+
* </template>
|
|
2569
|
+
* ```
|
|
2570
|
+
*/
|
|
2571
|
+
export declare function useScroll(options?: UseScrollOptions): UseScrollReturn;
|
|
2572
|
+
|
|
2573
|
+
/**
|
|
2574
|
+
* Options for useScroll composable
|
|
2575
|
+
*/
|
|
2576
|
+
export declare interface UseScrollOptions {
|
|
2577
|
+
/**
|
|
2578
|
+
* Throttle time in milliseconds
|
|
2579
|
+
* @default 0 (no throttle)
|
|
2580
|
+
*/
|
|
2581
|
+
throttle?: number | Ref<number>;
|
|
2582
|
+
/**
|
|
2583
|
+
* Whether to use passive event listener
|
|
2584
|
+
* @default true
|
|
2585
|
+
*/
|
|
2586
|
+
passive?: boolean;
|
|
905
2587
|
}
|
|
906
2588
|
|
|
907
2589
|
/**
|
|
908
|
-
*
|
|
2590
|
+
* Return type for useScroll composable
|
|
909
2591
|
*/
|
|
910
|
-
export declare
|
|
2592
|
+
export declare interface UseScrollReturn {
|
|
2593
|
+
/** Current scroll left position */
|
|
2594
|
+
scrollLeft: Readonly<Ref<number>>;
|
|
2595
|
+
/** Current scroll top position */
|
|
2596
|
+
scrollTop: Readonly<Ref<number>>;
|
|
2597
|
+
/** Horizontal scroll progress (0-1) */
|
|
2598
|
+
progressX: Readonly<Ref<number>>;
|
|
2599
|
+
/** Vertical scroll progress (0-1) */
|
|
2600
|
+
progressY: Readonly<Ref<number>>;
|
|
2601
|
+
/** Direction of horizontal scroll */
|
|
2602
|
+
directionX: Readonly<Ref<ScrollDirection>>;
|
|
2603
|
+
/** Direction of vertical scroll */
|
|
2604
|
+
directionY: Readonly<Ref<ScrollDirection>>;
|
|
2605
|
+
/** Whether the user is scrolling */
|
|
2606
|
+
isScrolling: Readonly<Ref<boolean>>;
|
|
2607
|
+
/** Scroll info object (reactive) */
|
|
2608
|
+
info: Readonly<Ref<ScrollInfo>>;
|
|
2609
|
+
/** Bind scroll listener to an element */
|
|
2610
|
+
bind: (element?: HTMLElement | Window) => () => void;
|
|
2611
|
+
/** Stop listening */
|
|
2612
|
+
stop: () => void;
|
|
2613
|
+
/** Scroll to a position */
|
|
2614
|
+
scrollTo: (options: {
|
|
2615
|
+
top?: number;
|
|
2616
|
+
left?: number;
|
|
2617
|
+
behavior?: 'auto' | 'smooth';
|
|
2618
|
+
}) => void;
|
|
2619
|
+
}
|
|
911
2620
|
|
|
912
2621
|
/**
|
|
913
|
-
*
|
|
2622
|
+
* Composable for detecting swipe gestures
|
|
2623
|
+
*
|
|
2624
|
+
* @param options - Configuration options
|
|
2625
|
+
* @returns Swipe utilities
|
|
2626
|
+
*
|
|
2627
|
+
* @example
|
|
2628
|
+
* ```vue
|
|
2629
|
+
* <script setup>
|
|
2630
|
+
* import { ref } from 'vue'
|
|
2631
|
+
* import { useSwipe } from 'directix'
|
|
2632
|
+
*
|
|
2633
|
+
* const container = ref(null)
|
|
2634
|
+
* const { direction, bind } = useSwipe({
|
|
2635
|
+
* onLeft: () => nextSlide(),
|
|
2636
|
+
* onRight: () => prevSlide()
|
|
2637
|
+
* })
|
|
2638
|
+
*
|
|
2639
|
+
* onMounted(() => bind(container.value))
|
|
2640
|
+
* </script>
|
|
2641
|
+
*
|
|
2642
|
+
* <template>
|
|
2643
|
+
* <div ref="container">
|
|
2644
|
+
* Swipe me!
|
|
2645
|
+
* </div>
|
|
2646
|
+
* </template>
|
|
2647
|
+
* ```
|
|
914
2648
|
*/
|
|
915
|
-
export declare
|
|
2649
|
+
export declare function useSwipe(options?: UseSwipeOptions): UseSwipeReturn;
|
|
916
2650
|
|
|
917
2651
|
/**
|
|
918
|
-
*
|
|
2652
|
+
* Options for useSwipe composable
|
|
919
2653
|
*/
|
|
920
|
-
export declare interface
|
|
2654
|
+
export declare interface UseSwipeOptions {
|
|
921
2655
|
/**
|
|
922
|
-
*
|
|
923
|
-
* @required
|
|
2656
|
+
* Swipe handler
|
|
924
2657
|
*/
|
|
925
|
-
handler
|
|
2658
|
+
handler?: SwipeHandler;
|
|
926
2659
|
/**
|
|
927
|
-
*
|
|
928
|
-
* @default
|
|
2660
|
+
* Minimum distance to trigger swipe
|
|
2661
|
+
* @default 30
|
|
929
2662
|
*/
|
|
930
|
-
|
|
2663
|
+
threshold?: number | Ref<number>;
|
|
931
2664
|
/**
|
|
932
|
-
*
|
|
2665
|
+
* Maximum time for swipe
|
|
2666
|
+
* @default 500
|
|
2667
|
+
*/
|
|
2668
|
+
maxTime?: number | Ref<number>;
|
|
2669
|
+
/**
|
|
2670
|
+
* Allowed directions
|
|
2671
|
+
* @default ['left', 'right', 'up', 'down']
|
|
933
2672
|
*/
|
|
934
|
-
|
|
2673
|
+
directions?: SwipeDirection[];
|
|
935
2674
|
/**
|
|
936
|
-
* Whether to
|
|
2675
|
+
* Whether to prevent scroll on swipe
|
|
937
2676
|
* @default true
|
|
938
2677
|
*/
|
|
939
|
-
|
|
2678
|
+
preventScrollOnSwipe?: boolean;
|
|
940
2679
|
/**
|
|
941
|
-
* Whether to
|
|
942
|
-
* @default
|
|
2680
|
+
* Whether to enable mouse events
|
|
2681
|
+
* @default true
|
|
943
2682
|
*/
|
|
944
|
-
|
|
2683
|
+
mouse?: boolean;
|
|
945
2684
|
/**
|
|
946
|
-
*
|
|
947
|
-
* @default false
|
|
2685
|
+
* Callback for left swipe
|
|
948
2686
|
*/
|
|
949
|
-
|
|
2687
|
+
onLeft?: () => void;
|
|
950
2688
|
/**
|
|
951
|
-
*
|
|
952
|
-
* @default false
|
|
2689
|
+
* Callback for right swipe
|
|
953
2690
|
*/
|
|
954
|
-
|
|
2691
|
+
onRight?: () => void;
|
|
955
2692
|
/**
|
|
956
|
-
*
|
|
957
|
-
* @default false
|
|
2693
|
+
* Callback for up swipe
|
|
958
2694
|
*/
|
|
959
|
-
|
|
2695
|
+
onUp?: () => void;
|
|
960
2696
|
/**
|
|
961
|
-
*
|
|
962
|
-
* @default false
|
|
2697
|
+
* Callback for down swipe
|
|
963
2698
|
*/
|
|
964
|
-
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
export declare type NumberBinding = number | NumberOptions;
|
|
968
|
-
|
|
969
|
-
/**
|
|
970
|
-
* Shared utilities for number and money formatting directives
|
|
971
|
-
*/
|
|
972
|
-
/**
|
|
973
|
-
* Base options shared by number and money formatting
|
|
974
|
-
*/
|
|
975
|
-
declare interface NumberFormatOptions {
|
|
976
|
-
/** Number of decimal places */
|
|
977
|
-
precision?: number;
|
|
978
|
-
/** Thousands separator */
|
|
979
|
-
separator?: string;
|
|
980
|
-
/** Decimal separator */
|
|
981
|
-
decimal?: string;
|
|
982
|
-
/** Whether to allow negative numbers @default true */
|
|
983
|
-
allowNegative?: boolean;
|
|
984
|
-
/** Minimum value */
|
|
985
|
-
min?: number;
|
|
986
|
-
/** Maximum value */
|
|
987
|
-
max?: number;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
/**
|
|
991
|
-
* Number directive options
|
|
992
|
-
*/
|
|
993
|
-
export declare interface NumberOptions extends NumberFormatOptions {
|
|
994
|
-
/** Prefix string (e.g., '$') */
|
|
995
|
-
prefix?: string;
|
|
996
|
-
/** Suffix string (e.g., '%') */
|
|
997
|
-
suffix?: string;
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
/**
|
|
1001
|
-
* Parse time argument
|
|
1002
|
-
* Supports formats: "300" | "300ms" | "1s"
|
|
1003
|
-
*/
|
|
1004
|
-
export declare function parseTime(arg?: string): number | null;
|
|
1005
|
-
|
|
1006
|
-
/**
|
|
1007
|
-
* Permission action mode
|
|
1008
|
-
*/
|
|
1009
|
-
export declare type PermissionAction = 'remove' | 'disable' | 'hide';
|
|
1010
|
-
|
|
1011
|
-
/**
|
|
1012
|
-
* Directive binding value type
|
|
1013
|
-
*/
|
|
1014
|
-
export declare type PermissionBinding = string | string[] | PermissionOptions;
|
|
1015
|
-
|
|
1016
|
-
/**
|
|
1017
|
-
* Permission configuration
|
|
1018
|
-
*/
|
|
1019
|
-
export declare interface PermissionConfig {
|
|
1020
|
-
/** Get current user's permissions */
|
|
1021
|
-
getPermissions: () => string[];
|
|
1022
|
-
/** Get current user's roles */
|
|
1023
|
-
getRoles?: () => string[];
|
|
1024
|
-
/** Role to permission mapping */
|
|
1025
|
-
roleMap?: Record<string, string[]>;
|
|
2699
|
+
onDown?: () => void;
|
|
1026
2700
|
}
|
|
1027
2701
|
|
|
1028
2702
|
/**
|
|
1029
|
-
*
|
|
1030
|
-
*/
|
|
1031
|
-
declare type PermissionMode = 'some' | 'every';
|
|
1032
|
-
|
|
1033
|
-
/**
|
|
1034
|
-
* Permission directive options
|
|
2703
|
+
* Return type for useSwipe composable
|
|
1035
2704
|
*/
|
|
1036
|
-
export declare interface
|
|
1037
|
-
/**
|
|
1038
|
-
|
|
1039
|
-
/**
|
|
1040
|
-
|
|
1041
|
-
/**
|
|
1042
|
-
|
|
1043
|
-
/**
|
|
1044
|
-
|
|
1045
|
-
/**
|
|
1046
|
-
|
|
2705
|
+
export declare interface UseSwipeReturn {
|
|
2706
|
+
/** Current swipe direction */
|
|
2707
|
+
direction: Readonly<Ref<SwipeDirection | null>>;
|
|
2708
|
+
/** Length of the swipe */
|
|
2709
|
+
lengthX: Readonly<Ref<number>>;
|
|
2710
|
+
/** Length of the swipe */
|
|
2711
|
+
lengthY: Readonly<Ref<number>>;
|
|
2712
|
+
/** Whether a swipe is being performed */
|
|
2713
|
+
isSwiping: Readonly<Ref<boolean>>;
|
|
2714
|
+
/** Bind swipe detection to an element */
|
|
2715
|
+
bind: (element: HTMLElement) => () => void;
|
|
1047
2716
|
}
|
|
1048
2717
|
|
|
1049
2718
|
/**
|
|
1050
|
-
*
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
*
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
*
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
*
|
|
2719
|
+
* Composable for throttling function calls
|
|
2720
|
+
*
|
|
2721
|
+
* @param options - Configuration options
|
|
2722
|
+
* @returns Throttled function utilities
|
|
2723
|
+
*
|
|
2724
|
+
* @example
|
|
2725
|
+
* ```vue
|
|
2726
|
+
* <script setup>
|
|
2727
|
+
* import { ref } from 'vue'
|
|
2728
|
+
* import { useThrottle } from 'directix'
|
|
2729
|
+
*
|
|
2730
|
+
* const { run: throttledScroll } = useThrottle({
|
|
2731
|
+
* handler: (event) => {
|
|
2732
|
+
* console.log('Scroll position:', event.target.scrollTop)
|
|
2733
|
+
* },
|
|
2734
|
+
* wait: 100
|
|
2735
|
+
* })
|
|
2736
|
+
*
|
|
2737
|
+
* // Use in template
|
|
2738
|
+
* // <div @scroll="throttledScroll($event)">...</div>
|
|
2739
|
+
* </script>
|
|
2740
|
+
* ```
|
|
1066
2741
|
*/
|
|
1067
|
-
export declare
|
|
1068
|
-
/** New width */
|
|
1069
|
-
width: number;
|
|
1070
|
-
/** New height */
|
|
1071
|
-
height: number;
|
|
1072
|
-
/** Content rect */
|
|
1073
|
-
contentRect: DOMRectReadOnly;
|
|
1074
|
-
/** Border box size */
|
|
1075
|
-
borderBoxSize: ReadonlyArray<ResizeObserverSize>;
|
|
1076
|
-
/** Content box size */
|
|
1077
|
-
contentBoxSize: ReadonlyArray<ResizeObserverSize>;
|
|
1078
|
-
/** Device pixel content box size */
|
|
1079
|
-
devicePixelContentBoxSize: ReadonlyArray<ResizeObserverSize>;
|
|
1080
|
-
}
|
|
2742
|
+
export declare function useThrottle<T extends (...args: any[]) => any>(options: UseThrottleOptions<T>): UseThrottleReturn<T>;
|
|
1081
2743
|
|
|
1082
2744
|
/**
|
|
1083
|
-
*
|
|
2745
|
+
* Options for useThrottle composable
|
|
1084
2746
|
*/
|
|
1085
|
-
export declare interface
|
|
2747
|
+
export declare interface UseThrottleOptions<T extends (...args: any[]) => any> {
|
|
1086
2748
|
/**
|
|
1087
|
-
*
|
|
1088
|
-
* @required
|
|
2749
|
+
* Function to throttle
|
|
1089
2750
|
*/
|
|
1090
|
-
handler:
|
|
2751
|
+
handler: T;
|
|
1091
2752
|
/**
|
|
1092
|
-
*
|
|
1093
|
-
* @default
|
|
2753
|
+
* Delay time in milliseconds
|
|
2754
|
+
* @default 300
|
|
1094
2755
|
*/
|
|
1095
|
-
|
|
2756
|
+
wait?: number | Ref<number>;
|
|
1096
2757
|
/**
|
|
1097
|
-
* Whether to
|
|
1098
|
-
*
|
|
1099
|
-
* - 'border-box': size of border box
|
|
1100
|
-
* - 'device-pixel-content-box': size in device pixels
|
|
1101
|
-
* @default 'content-box'
|
|
2758
|
+
* Whether to invoke immediately before delay starts
|
|
2759
|
+
* @default true
|
|
1102
2760
|
*/
|
|
1103
|
-
|
|
2761
|
+
leading?: boolean | Ref<boolean>;
|
|
1104
2762
|
/**
|
|
1105
|
-
*
|
|
1106
|
-
* @default
|
|
2763
|
+
* Whether to invoke after delay ends
|
|
2764
|
+
* @default true
|
|
2765
|
+
*/
|
|
2766
|
+
trailing?: boolean | Ref<boolean>;
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
/**
|
|
2770
|
+
* Return type for useThrottle composable
|
|
2771
|
+
*/
|
|
2772
|
+
export declare interface UseThrottleReturn<T extends (...args: any[]) => any> {
|
|
2773
|
+
/**
|
|
2774
|
+
* Throttled function
|
|
1107
2775
|
*/
|
|
1108
|
-
|
|
2776
|
+
run: (...args: Parameters<T>) => void;
|
|
1109
2777
|
/**
|
|
1110
|
-
*
|
|
2778
|
+
* Cancel any pending execution
|
|
1111
2779
|
*/
|
|
1112
|
-
|
|
2780
|
+
cancel: () => void;
|
|
1113
2781
|
}
|
|
1114
2782
|
|
|
1115
2783
|
/**
|
|
1116
|
-
*
|
|
2784
|
+
* Composable for touch gesture detection
|
|
2785
|
+
*
|
|
2786
|
+
* @param options - Configuration options
|
|
2787
|
+
* @returns Touch gesture utilities
|
|
2788
|
+
*
|
|
2789
|
+
* @example
|
|
2790
|
+
* ```vue
|
|
2791
|
+
* <script setup>
|
|
2792
|
+
* import { ref } from 'vue'
|
|
2793
|
+
* import { useTouch } from 'directix'
|
|
2794
|
+
*
|
|
2795
|
+
* const containerRef = ref(null)
|
|
2796
|
+
* const { gesture, bind } = useTouch({
|
|
2797
|
+
* onSwipeLeft: () => nextSlide(),
|
|
2798
|
+
* onSwipeRight: () => prevSlide()
|
|
2799
|
+
* })
|
|
2800
|
+
*
|
|
2801
|
+
* onMounted(() => bind(containerRef.value))
|
|
2802
|
+
* </script>
|
|
2803
|
+
*
|
|
2804
|
+
* <template>
|
|
2805
|
+
* <div ref="containerRef">
|
|
2806
|
+
* Swipe me!
|
|
2807
|
+
* </div>
|
|
2808
|
+
* </template>
|
|
2809
|
+
* ```
|
|
1117
2810
|
*/
|
|
1118
|
-
export declare
|
|
2811
|
+
export declare function useTouch(options?: UseTouchOptions): UseTouchReturn;
|
|
1119
2812
|
|
|
1120
2813
|
/**
|
|
1121
|
-
*
|
|
2814
|
+
* Options for useTouch composable
|
|
1122
2815
|
*/
|
|
1123
|
-
export declare interface
|
|
2816
|
+
export declare interface UseTouchOptions {
|
|
1124
2817
|
/**
|
|
1125
|
-
*
|
|
1126
|
-
* @default 'currentColor'
|
|
2818
|
+
* Callback for swipe gesture
|
|
1127
2819
|
*/
|
|
1128
|
-
|
|
2820
|
+
onSwipe?: (event: TouchGestureEvent) => void;
|
|
1129
2821
|
/**
|
|
1130
|
-
*
|
|
1131
|
-
* @default 600
|
|
2822
|
+
* Callback for swipe left
|
|
1132
2823
|
*/
|
|
1133
|
-
|
|
2824
|
+
onSwipeLeft?: (event: TouchGestureEvent) => void;
|
|
1134
2825
|
/**
|
|
1135
|
-
*
|
|
1136
|
-
* @default false
|
|
2826
|
+
* Callback for swipe right
|
|
1137
2827
|
*/
|
|
1138
|
-
|
|
2828
|
+
onSwipeRight?: (event: TouchGestureEvent) => void;
|
|
1139
2829
|
/**
|
|
1140
|
-
*
|
|
1141
|
-
* @default 0
|
|
2830
|
+
* Callback for swipe up
|
|
1142
2831
|
*/
|
|
1143
|
-
|
|
2832
|
+
onSwipeUp?: (event: TouchGestureEvent) => void;
|
|
1144
2833
|
/**
|
|
1145
|
-
*
|
|
1146
|
-
* @default 2
|
|
2834
|
+
* Callback for swipe down
|
|
1147
2835
|
*/
|
|
1148
|
-
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
/**
|
|
1152
|
-
* Directive binding value type
|
|
1153
|
-
*/
|
|
1154
|
-
export declare type SanitizeBinding = boolean | SanitizeOptions;
|
|
1155
|
-
|
|
1156
|
-
/**
|
|
1157
|
-
* Sanitize handler
|
|
1158
|
-
*/
|
|
1159
|
-
export declare type SanitizeHandler = (value: string) => string;
|
|
1160
|
-
|
|
1161
|
-
/**
|
|
1162
|
-
* Sanitize directive options
|
|
1163
|
-
*/
|
|
1164
|
-
export declare interface SanitizeOptions {
|
|
2836
|
+
onSwipeDown?: (event: TouchGestureEvent) => void;
|
|
1165
2837
|
/**
|
|
1166
|
-
*
|
|
1167
|
-
* @default []
|
|
2838
|
+
* Callback for pinch gesture
|
|
1168
2839
|
*/
|
|
1169
|
-
|
|
2840
|
+
onPinch?: (event: TouchGestureEvent) => void;
|
|
1170
2841
|
/**
|
|
1171
|
-
*
|
|
1172
|
-
* @default []
|
|
2842
|
+
* Callback for rotate gesture
|
|
1173
2843
|
*/
|
|
1174
|
-
|
|
2844
|
+
onRotate?: (event: TouchGestureEvent) => void;
|
|
1175
2845
|
/**
|
|
1176
|
-
*
|
|
1177
|
-
* @default false
|
|
2846
|
+
* Callback for tap gesture
|
|
1178
2847
|
*/
|
|
1179
|
-
|
|
2848
|
+
onTap?: (event: TouchGestureEvent) => void;
|
|
1180
2849
|
/**
|
|
1181
|
-
*
|
|
1182
|
-
* @default false
|
|
2850
|
+
* Callback for long press gesture
|
|
1183
2851
|
*/
|
|
1184
|
-
|
|
2852
|
+
onLongPress?: (event: TouchGestureEvent) => void;
|
|
1185
2853
|
/**
|
|
1186
|
-
*
|
|
1187
|
-
* @default
|
|
2854
|
+
* Swipe threshold distance in pixels
|
|
2855
|
+
* @default 30
|
|
1188
2856
|
*/
|
|
1189
|
-
|
|
2857
|
+
swipeThreshold?: number;
|
|
1190
2858
|
/**
|
|
1191
|
-
*
|
|
1192
|
-
* @default
|
|
2859
|
+
* Long press duration in milliseconds
|
|
2860
|
+
* @default 500
|
|
1193
2861
|
*/
|
|
1194
|
-
|
|
2862
|
+
longPressDuration?: number;
|
|
1195
2863
|
/**
|
|
1196
|
-
*
|
|
2864
|
+
* Tap max duration in milliseconds
|
|
2865
|
+
* @default 250
|
|
1197
2866
|
*/
|
|
1198
|
-
|
|
2867
|
+
tapDuration?: number;
|
|
1199
2868
|
/**
|
|
1200
2869
|
* Whether to disable
|
|
1201
2870
|
* @default false
|
|
1202
2871
|
*/
|
|
1203
|
-
disabled?: boolean
|
|
1204
|
-
/**
|
|
1205
|
-
* Whether to sanitize on update
|
|
1206
|
-
* @default true
|
|
1207
|
-
*/
|
|
1208
|
-
sanitizeOnUpdate?: boolean;
|
|
2872
|
+
disabled?: boolean | Ref<boolean>;
|
|
1209
2873
|
}
|
|
1210
2874
|
|
|
1211
2875
|
/**
|
|
1212
|
-
*
|
|
1213
|
-
*/
|
|
1214
|
-
export declare type ScrollBinding = ScrollHandler | ScrollOptions_2;
|
|
1215
|
-
|
|
1216
|
-
/**
|
|
1217
|
-
* Scroll event handler
|
|
2876
|
+
* Return type for useTouch composable
|
|
1218
2877
|
*/
|
|
1219
|
-
export declare
|
|
2878
|
+
export declare interface UseTouchReturn {
|
|
2879
|
+
/** Current gesture being performed */
|
|
2880
|
+
gesture: Readonly<Ref<TouchGesture | null>>;
|
|
2881
|
+
/** Bind touch events to an element */
|
|
2882
|
+
bind: (element: HTMLElement) => () => void;
|
|
2883
|
+
}
|
|
1220
2884
|
|
|
1221
2885
|
/**
|
|
1222
|
-
*
|
|
2886
|
+
* Composable for trimming text
|
|
2887
|
+
*
|
|
2888
|
+
* @param options - Configuration options
|
|
2889
|
+
* @returns Trimmed text utilities
|
|
2890
|
+
*
|
|
2891
|
+
* @example
|
|
2892
|
+
* ```vue
|
|
2893
|
+
* <script setup>
|
|
2894
|
+
* import { ref } from 'vue'
|
|
2895
|
+
* import { useTrim } from 'directix'
|
|
2896
|
+
*
|
|
2897
|
+
* const text = ref(' hello world ')
|
|
2898
|
+
*
|
|
2899
|
+
* const { trimmed, wasTrimmed } = useTrim({ text })
|
|
2900
|
+
* // trimmed.value = 'hello world'
|
|
2901
|
+
* // wasTrimmed.value = true
|
|
2902
|
+
* </script>
|
|
2903
|
+
*
|
|
2904
|
+
* <template>
|
|
2905
|
+
* <p>{{ trimmed }}</p>
|
|
2906
|
+
* </template>
|
|
2907
|
+
* ```
|
|
1223
2908
|
*/
|
|
1224
|
-
export declare
|
|
1225
|
-
/** Current scroll left position */
|
|
1226
|
-
scrollLeft: number;
|
|
1227
|
-
/** Current scroll top position */
|
|
1228
|
-
scrollTop: number;
|
|
1229
|
-
/** Maximum scroll left */
|
|
1230
|
-
scrollLeftMax: number;
|
|
1231
|
-
/** Maximum scroll top */
|
|
1232
|
-
scrollTopMax: number;
|
|
1233
|
-
/** Horizontal scroll progress (0-1) */
|
|
1234
|
-
progressX: number;
|
|
1235
|
-
/** Vertical scroll progress (0-1) */
|
|
1236
|
-
progressY: number;
|
|
1237
|
-
/** Direction of horizontal scroll (-1: left, 1: right, 0: none) */
|
|
1238
|
-
directionX: -1 | 0 | 1;
|
|
1239
|
-
/** Direction of vertical scroll (-1: up, 1: down, 0: none) */
|
|
1240
|
-
directionY: -1 | 0 | 1;
|
|
1241
|
-
/** Scroll container element or window */
|
|
1242
|
-
container: Element | Window;
|
|
1243
|
-
}
|
|
2909
|
+
export declare function useTrim(options: UseTrimOptions): UseTrimReturn;
|
|
1244
2910
|
|
|
1245
2911
|
/**
|
|
1246
|
-
*
|
|
2912
|
+
* Options for useTrim composable
|
|
1247
2913
|
*/
|
|
1248
|
-
declare interface
|
|
1249
|
-
/**
|
|
1250
|
-
* Scroll event handler
|
|
1251
|
-
* @required
|
|
1252
|
-
*/
|
|
1253
|
-
handler: ScrollHandler;
|
|
1254
|
-
/**
|
|
1255
|
-
* Whether to disable
|
|
1256
|
-
* @default false
|
|
1257
|
-
*/
|
|
1258
|
-
disabled?: boolean;
|
|
2914
|
+
export declare interface UseTrimOptions {
|
|
1259
2915
|
/**
|
|
1260
|
-
*
|
|
1261
|
-
* @default true
|
|
2916
|
+
* The text to trim
|
|
1262
2917
|
*/
|
|
1263
|
-
|
|
2918
|
+
text: string | Ref<string>;
|
|
1264
2919
|
/**
|
|
1265
|
-
*
|
|
1266
|
-
* @default
|
|
2920
|
+
* Trim position
|
|
2921
|
+
* @default 'both'
|
|
1267
2922
|
*/
|
|
1268
|
-
|
|
2923
|
+
position?: TrimPosition | Ref<TrimPosition>;
|
|
1269
2924
|
/**
|
|
1270
|
-
* Custom
|
|
2925
|
+
* Custom characters to trim (in addition to whitespace)
|
|
1271
2926
|
*/
|
|
1272
|
-
|
|
2927
|
+
chars?: string | Ref<string>;
|
|
1273
2928
|
}
|
|
1274
|
-
export { ScrollOptions_2 as ScrollOptions }
|
|
1275
|
-
|
|
1276
|
-
/**
|
|
1277
|
-
* Set nested property value by path
|
|
1278
|
-
*/
|
|
1279
|
-
export declare function set(obj: Record<string, any>, path: string, value: any): void;
|
|
1280
2929
|
|
|
1281
2930
|
/**
|
|
1282
|
-
*
|
|
1283
|
-
*/
|
|
1284
|
-
export declare function setVueVersion(version: VueVersion): void;
|
|
1285
|
-
|
|
1286
|
-
export declare type StickyBinding = boolean | number | StickyOptions;
|
|
1287
|
-
|
|
1288
|
-
/**
|
|
1289
|
-
* Sticky directive options
|
|
2931
|
+
* Return type for useTrim composable
|
|
1290
2932
|
*/
|
|
1291
|
-
export declare interface
|
|
1292
|
-
/**
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
/**
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
/**
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
/** Custom scroll container */
|
|
1305
|
-
container?: string | Element | null;
|
|
2933
|
+
export declare interface UseTrimReturn {
|
|
2934
|
+
/**
|
|
2935
|
+
* The trimmed text
|
|
2936
|
+
*/
|
|
2937
|
+
trimmed: Ref<string>;
|
|
2938
|
+
/**
|
|
2939
|
+
* Original text
|
|
2940
|
+
*/
|
|
2941
|
+
original: Ref<string>;
|
|
2942
|
+
/**
|
|
2943
|
+
* Whether the text was trimmed
|
|
2944
|
+
*/
|
|
2945
|
+
wasTrimmed: Ref<boolean>;
|
|
1306
2946
|
}
|
|
1307
2947
|
|
|
1308
2948
|
/**
|
|
1309
|
-
*
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
*
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
*
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
*
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
*
|
|
1330
|
-
*/
|
|
1331
|
-
export declare const supportsResizeObserver: () => boolean;
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
1334
|
-
* Swipe direction
|
|
2949
|
+
* Composable for transforming text to uppercase
|
|
2950
|
+
*
|
|
2951
|
+
* @param options - Configuration options
|
|
2952
|
+
* @returns Uppercase text utilities
|
|
2953
|
+
*
|
|
2954
|
+
* @example
|
|
2955
|
+
* ```vue
|
|
2956
|
+
* <script setup>
|
|
2957
|
+
* import { ref } from 'vue'
|
|
2958
|
+
* import { useUppercase } from 'directix'
|
|
2959
|
+
*
|
|
2960
|
+
* const text = ref('hello world')
|
|
2961
|
+
*
|
|
2962
|
+
* const { transformed } = useUppercase({ text })
|
|
2963
|
+
* // transformed.value = 'HELLO WORLD'
|
|
2964
|
+
* </script>
|
|
2965
|
+
*
|
|
2966
|
+
* <template>
|
|
2967
|
+
* <p>{{ transformed }}</p>
|
|
2968
|
+
* </template>
|
|
2969
|
+
* ```
|
|
1335
2970
|
*/
|
|
1336
|
-
export declare
|
|
2971
|
+
export declare function useUppercase(options: UseUppercaseOptions): UseUppercaseReturn;
|
|
1337
2972
|
|
|
1338
2973
|
/**
|
|
1339
|
-
*
|
|
2974
|
+
* Options for useUppercase composable
|
|
1340
2975
|
*/
|
|
1341
|
-
export declare
|
|
2976
|
+
export declare interface UseUppercaseOptions {
|
|
2977
|
+
/**
|
|
2978
|
+
* The text to transform
|
|
2979
|
+
*/
|
|
2980
|
+
text: string | Ref<string>;
|
|
2981
|
+
/**
|
|
2982
|
+
* Transform only the first character
|
|
2983
|
+
* @default false
|
|
2984
|
+
*/
|
|
2985
|
+
first?: boolean | Ref<boolean>;
|
|
2986
|
+
}
|
|
1342
2987
|
|
|
1343
2988
|
/**
|
|
1344
|
-
*
|
|
2989
|
+
* Return type for useUppercase composable
|
|
1345
2990
|
*/
|
|
1346
|
-
export declare interface
|
|
1347
|
-
|
|
1348
|
-
|
|
2991
|
+
export declare interface UseUppercaseReturn {
|
|
2992
|
+
/**
|
|
2993
|
+
* The transformed text
|
|
2994
|
+
*/
|
|
2995
|
+
transformed: Ref<string>;
|
|
2996
|
+
/**
|
|
2997
|
+
* Original text
|
|
2998
|
+
*/
|
|
2999
|
+
original: Ref<string>;
|
|
1349
3000
|
}
|
|
1350
3001
|
|
|
1351
3002
|
/**
|
|
1352
|
-
*
|
|
3003
|
+
* Composable for virtual list rendering
|
|
3004
|
+
*
|
|
3005
|
+
* @param options - Configuration options
|
|
3006
|
+
* @returns Virtual list utilities and state
|
|
3007
|
+
*
|
|
3008
|
+
* @example
|
|
3009
|
+
* ```vue
|
|
3010
|
+
* <script setup>
|
|
3011
|
+
* import { ref } from 'vue'
|
|
3012
|
+
* import { useVirtualList } from 'directix'
|
|
3013
|
+
*
|
|
3014
|
+
* const items = ref(Array.from({ length: 10000 }, (_, i) => ({ id: i, name: `Item ${i}` })))
|
|
3015
|
+
*
|
|
3016
|
+
* const {
|
|
3017
|
+
* visibleItems,
|
|
3018
|
+
* totalHeight,
|
|
3019
|
+
* containerRef,
|
|
3020
|
+
* listStyle,
|
|
3021
|
+
* scrollToIndex
|
|
3022
|
+
* } = useVirtualList({
|
|
3023
|
+
* items,
|
|
3024
|
+
* itemSize: 50,
|
|
3025
|
+
* height: 600
|
|
3026
|
+
* })
|
|
3027
|
+
* </script>
|
|
3028
|
+
*
|
|
3029
|
+
* <template>
|
|
3030
|
+
* <div ref="containerRef" :style="listStyle">
|
|
3031
|
+
* <div :style="{ height: totalHeight + 'px', position: 'relative' }">
|
|
3032
|
+
* <div
|
|
3033
|
+
* v-for="{ item, index, style } in visibleItems"
|
|
3034
|
+
* :key="item.id"
|
|
3035
|
+
* :style="style"
|
|
3036
|
+
* >
|
|
3037
|
+
* {{ item.name }}
|
|
3038
|
+
* </div>
|
|
3039
|
+
* </div>
|
|
3040
|
+
* </div>
|
|
3041
|
+
* </template>
|
|
3042
|
+
* ```
|
|
1353
3043
|
*/
|
|
1354
|
-
export declare function
|
|
1355
|
-
leading?: boolean;
|
|
1356
|
-
trailing?: boolean;
|
|
1357
|
-
}): ((...args: Parameters<T>) => void) & {
|
|
1358
|
-
cancel: () => void;
|
|
1359
|
-
};
|
|
3044
|
+
export declare function useVirtualList<T = any>(options: UseVirtualListOptions<T>): UseVirtualListReturn<T>;
|
|
1360
3045
|
|
|
1361
3046
|
/**
|
|
1362
|
-
*
|
|
3047
|
+
* Options for useVirtualList composable
|
|
1363
3048
|
*/
|
|
1364
|
-
export declare interface
|
|
3049
|
+
export declare interface UseVirtualListOptions<T = any> {
|
|
1365
3050
|
/**
|
|
1366
|
-
*
|
|
3051
|
+
* Array of items to render
|
|
3052
|
+
* @required
|
|
1367
3053
|
*/
|
|
1368
|
-
|
|
3054
|
+
items: Ref<T[]> | T[];
|
|
1369
3055
|
/**
|
|
1370
|
-
*
|
|
1371
|
-
*
|
|
3056
|
+
* Height of each item (in pixels)
|
|
3057
|
+
* Can be a fixed number or a function
|
|
3058
|
+
* @default 50
|
|
1372
3059
|
*/
|
|
1373
|
-
|
|
3060
|
+
itemSize?: number | ItemSizeFunction | Ref<number | ItemSizeFunction>;
|
|
1374
3061
|
/**
|
|
1375
|
-
*
|
|
1376
|
-
* @default
|
|
3062
|
+
* Height of the container (in pixels)
|
|
3063
|
+
* @default 400
|
|
1377
3064
|
*/
|
|
1378
|
-
|
|
3065
|
+
height?: number | Ref<number>;
|
|
1379
3066
|
/**
|
|
1380
|
-
*
|
|
1381
|
-
* @default
|
|
3067
|
+
* Number of extra items to render above/below visible area
|
|
3068
|
+
* @default 3
|
|
1382
3069
|
*/
|
|
1383
|
-
|
|
3070
|
+
overscan?: number | Ref<number>;
|
|
3071
|
+
/**
|
|
3072
|
+
* Key field name for items
|
|
3073
|
+
* @default 'id'
|
|
3074
|
+
*/
|
|
3075
|
+
keyField?: string;
|
|
1384
3076
|
}
|
|
1385
3077
|
|
|
1386
|
-
export declare type TooltipBinding = string | TooltipOptions;
|
|
1387
|
-
|
|
1388
3078
|
/**
|
|
1389
|
-
*
|
|
3079
|
+
* Return type for useVirtualList composable
|
|
1390
3080
|
*/
|
|
1391
|
-
export declare interface
|
|
1392
|
-
/**
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
/**
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
/**
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
/**
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
/**
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
/**
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
/**
|
|
1417
|
-
|
|
3081
|
+
export declare interface UseVirtualListReturn<T = any> {
|
|
3082
|
+
/**
|
|
3083
|
+
* Currently visible items
|
|
3084
|
+
*/
|
|
3085
|
+
visibleItems: Ref<VirtualListItem<T>[]>;
|
|
3086
|
+
/**
|
|
3087
|
+
* Total height of the list
|
|
3088
|
+
*/
|
|
3089
|
+
totalHeight: Ref<number>;
|
|
3090
|
+
/**
|
|
3091
|
+
* Current scroll position
|
|
3092
|
+
*/
|
|
3093
|
+
scrollTop: Ref<number>;
|
|
3094
|
+
/**
|
|
3095
|
+
* Start index of visible items
|
|
3096
|
+
*/
|
|
3097
|
+
startIndex: Ref<number>;
|
|
3098
|
+
/**
|
|
3099
|
+
* End index of visible items
|
|
3100
|
+
*/
|
|
3101
|
+
endIndex: Ref<number>;
|
|
3102
|
+
/**
|
|
3103
|
+
* Scroll to a specific index
|
|
3104
|
+
*/
|
|
3105
|
+
scrollToIndex: (index: number) => void;
|
|
3106
|
+
/**
|
|
3107
|
+
* Scroll to a specific position
|
|
3108
|
+
*/
|
|
3109
|
+
scrollTo: (scrollTop: number) => void;
|
|
3110
|
+
/**
|
|
3111
|
+
* Container ref to bind to the scroll container
|
|
3112
|
+
*/
|
|
3113
|
+
containerRef: Ref<HTMLElement | null>;
|
|
3114
|
+
/**
|
|
3115
|
+
* List style for the wrapper element
|
|
3116
|
+
*/
|
|
3117
|
+
listStyle: Ref<{
|
|
3118
|
+
height: string;
|
|
3119
|
+
overflow: string;
|
|
3120
|
+
position: string;
|
|
3121
|
+
}>;
|
|
1418
3122
|
}
|
|
1419
3123
|
|
|
1420
3124
|
/**
|
|
1421
|
-
*
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
*
|
|
3125
|
+
* Composable for controlling element visibility
|
|
3126
|
+
*
|
|
3127
|
+
* @param options - Configuration options
|
|
3128
|
+
* @returns Visibility utilities
|
|
3129
|
+
*
|
|
3130
|
+
* @example
|
|
3131
|
+
* ```vue
|
|
3132
|
+
* <script setup>
|
|
3133
|
+
* import { ref } from 'vue'
|
|
3134
|
+
* import { useVisible } from 'directix'
|
|
3135
|
+
*
|
|
3136
|
+
* const modal = ref(null)
|
|
3137
|
+
* const { visible, show, hide, toggle, bind } = useVisible({
|
|
3138
|
+
* initial: false,
|
|
3139
|
+
* onChange: (v) => console.log('Visible:', v)
|
|
3140
|
+
* })
|
|
3141
|
+
*
|
|
3142
|
+
* onMounted(() => bind(modal.value))
|
|
3143
|
+
* </script>
|
|
3144
|
+
*
|
|
3145
|
+
* <template>
|
|
3146
|
+
* <button @click="toggle">Toggle Modal</button>
|
|
3147
|
+
* <div ref="modal" v-show="visible">Modal Content</div>
|
|
3148
|
+
* </template>
|
|
3149
|
+
* ```
|
|
1427
3150
|
*/
|
|
1428
|
-
export declare
|
|
3151
|
+
export declare function useVisible(options?: UseVisibleOptions): UseVisibleReturn;
|
|
1429
3152
|
|
|
1430
3153
|
/**
|
|
1431
|
-
*
|
|
3154
|
+
* Options for useVisible composable
|
|
1432
3155
|
*/
|
|
1433
|
-
export declare interface
|
|
1434
|
-
/** Minimum swipe distance in pixels @default 30 */
|
|
1435
|
-
swipeThreshold?: number;
|
|
1436
|
-
/** Maximum time for a swipe in milliseconds @default 500 */
|
|
1437
|
-
swipeTimeout?: number;
|
|
1438
|
-
/** Minimum pinch scale change @default 0.1 */
|
|
1439
|
-
pinchThreshold?: number;
|
|
1440
|
-
/** Enable swipe detection @default true */
|
|
1441
|
-
enableSwipe?: boolean;
|
|
1442
|
-
/** Enable pinch detection @default true */
|
|
1443
|
-
enablePinch?: boolean;
|
|
1444
|
-
/** Enable rotate detection @default true */
|
|
1445
|
-
enableRotate?: boolean;
|
|
1446
|
-
/** Enable tap detection @default true */
|
|
1447
|
-
enableTap?: boolean;
|
|
1448
|
-
/** Maximum time for a tap in milliseconds @default 250 */
|
|
1449
|
-
tapTimeout?: number;
|
|
1450
|
-
/** Maximum movement for a tap in pixels @default 10 */
|
|
1451
|
-
tapThreshold?: number;
|
|
1452
|
-
/** Enable long press detection @default true */
|
|
1453
|
-
enableLongPress?: boolean;
|
|
1454
|
-
/** Long press timeout in milliseconds @default 500 */
|
|
1455
|
-
longPressTimeout?: number;
|
|
1456
|
-
/** Enable mouse event simulation for desktop @default true */
|
|
1457
|
-
enableMouse?: boolean;
|
|
1458
|
-
onSwipe?: (direction: SwipeDirection, event: TouchEvent | MouseEvent) => void;
|
|
1459
|
-
onSwipeLeft?: (event: TouchEvent | MouseEvent) => void;
|
|
1460
|
-
onSwipeRight?: (event: TouchEvent | MouseEvent) => void;
|
|
1461
|
-
onSwipeUp?: (event: TouchEvent | MouseEvent) => void;
|
|
1462
|
-
onSwipeDown?: (event: TouchEvent | MouseEvent) => void;
|
|
1463
|
-
onPinch?: (scale: number, event: TouchEvent) => void;
|
|
1464
|
-
onRotate?: (angle: number, event: TouchEvent) => void;
|
|
1465
|
-
onTap?: (event: TouchEvent | MouseEvent) => void;
|
|
1466
|
-
onLongPress?: (event: TouchEvent | MouseEvent) => void;
|
|
1467
|
-
onTouchStart?: (event: TouchEvent | MouseEvent) => void;
|
|
1468
|
-
onTouchMove?: (event: TouchEvent | MouseEvent) => void;
|
|
1469
|
-
onTouchEnd?: (event: TouchEvent | MouseEvent) => void;
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
/**
|
|
1473
|
-
* Directive binding value type
|
|
1474
|
-
*/
|
|
1475
|
-
export declare type TrimBinding = boolean | TrimPosition | TrimOptions;
|
|
1476
|
-
|
|
1477
|
-
/**
|
|
1478
|
-
* Trim directive options
|
|
1479
|
-
*/
|
|
1480
|
-
export declare interface TrimOptions {
|
|
1481
|
-
/**
|
|
1482
|
-
* Trim position
|
|
1483
|
-
* @default 'both'
|
|
1484
|
-
*/
|
|
1485
|
-
position?: TrimPosition;
|
|
3156
|
+
export declare interface UseVisibleOptions {
|
|
1486
3157
|
/**
|
|
1487
|
-
*
|
|
3158
|
+
* Initial visibility
|
|
1488
3159
|
* @default true
|
|
1489
3160
|
*/
|
|
1490
|
-
|
|
3161
|
+
initial?: boolean | Ref<boolean>;
|
|
1491
3162
|
/**
|
|
1492
|
-
* Whether to
|
|
1493
|
-
* @default
|
|
3163
|
+
* Whether to use visibility: hidden instead of display: none
|
|
3164
|
+
* @default false
|
|
1494
3165
|
*/
|
|
1495
|
-
|
|
3166
|
+
useHidden?: boolean;
|
|
1496
3167
|
/**
|
|
1497
|
-
*
|
|
3168
|
+
* Callback when visibility changes
|
|
1498
3169
|
*/
|
|
1499
|
-
|
|
3170
|
+
onChange?: (isVisible: boolean) => void;
|
|
1500
3171
|
}
|
|
1501
3172
|
|
|
1502
3173
|
/**
|
|
1503
|
-
*
|
|
3174
|
+
* Return type for useVisible composable
|
|
1504
3175
|
*/
|
|
1505
|
-
export declare
|
|
3176
|
+
export declare interface UseVisibleReturn {
|
|
3177
|
+
/** Current visibility state */
|
|
3178
|
+
visible: Ref<boolean>;
|
|
3179
|
+
/** Show the element */
|
|
3180
|
+
show: () => void;
|
|
3181
|
+
/** Hide the element */
|
|
3182
|
+
hide: () => void;
|
|
3183
|
+
/** Toggle visibility */
|
|
3184
|
+
toggle: () => void;
|
|
3185
|
+
/** Bind visibility control to an element */
|
|
3186
|
+
bind: (element: HTMLElement) => () => void;
|
|
3187
|
+
}
|
|
1506
3188
|
|
|
1507
3189
|
/**
|
|
1508
|
-
*
|
|
3190
|
+
* Composable for creating watermark overlays
|
|
3191
|
+
*
|
|
3192
|
+
* @param options - Configuration options
|
|
3193
|
+
* @returns Watermark utilities and state
|
|
3194
|
+
*
|
|
3195
|
+
* @example
|
|
3196
|
+
* ```vue
|
|
3197
|
+
* <script setup>
|
|
3198
|
+
* import { useWatermark } from 'directix'
|
|
3199
|
+
*
|
|
3200
|
+
* const { dataUrl, style, disable, enable } = useWatermark({
|
|
3201
|
+
* content: 'Confidential',
|
|
3202
|
+
* fontSize: 20,
|
|
3203
|
+
* color: 'rgba(255, 0, 0, 0.2)'
|
|
3204
|
+
* })
|
|
3205
|
+
* </script>
|
|
3206
|
+
*
|
|
3207
|
+
* <template>
|
|
3208
|
+
* <div class="container">
|
|
3209
|
+
* <div :style="style"></div>
|
|
3210
|
+
* <slot></slot>
|
|
3211
|
+
* </div>
|
|
3212
|
+
* </template>
|
|
3213
|
+
* ```
|
|
1509
3214
|
*/
|
|
1510
|
-
export declare
|
|
3215
|
+
export declare function useWatermark(options: UseWatermarkOptions): UseWatermarkReturn;
|
|
1511
3216
|
|
|
1512
3217
|
/**
|
|
1513
|
-
*
|
|
3218
|
+
* Options for useWatermark composable
|
|
1514
3219
|
*/
|
|
1515
|
-
export declare interface
|
|
3220
|
+
export declare interface UseWatermarkOptions {
|
|
1516
3221
|
/**
|
|
1517
|
-
*
|
|
1518
|
-
* @
|
|
3222
|
+
* Watermark text content
|
|
3223
|
+
* @required
|
|
1519
3224
|
*/
|
|
1520
|
-
|
|
3225
|
+
content: string | string[] | Ref<string | string[]>;
|
|
1521
3226
|
/**
|
|
1522
|
-
*
|
|
1523
|
-
* @default
|
|
3227
|
+
* Width of watermark canvas
|
|
3228
|
+
* @default 300
|
|
1524
3229
|
*/
|
|
1525
|
-
|
|
3230
|
+
width?: number | Ref<number>;
|
|
1526
3231
|
/**
|
|
1527
|
-
*
|
|
1528
|
-
* @default
|
|
3232
|
+
* Height of watermark canvas
|
|
3233
|
+
* @default 200
|
|
3234
|
+
*/
|
|
3235
|
+
height?: number | Ref<number>;
|
|
3236
|
+
/**
|
|
3237
|
+
* Rotation angle in degrees
|
|
3238
|
+
* @default -22
|
|
3239
|
+
*/
|
|
3240
|
+
rotate?: number | Ref<number>;
|
|
3241
|
+
/**
|
|
3242
|
+
* Font size in pixels
|
|
3243
|
+
* @default 16
|
|
3244
|
+
*/
|
|
3245
|
+
fontSize?: number | Ref<number>;
|
|
3246
|
+
/**
|
|
3247
|
+
* Font family
|
|
3248
|
+
* @default 'sans-serif'
|
|
3249
|
+
*/
|
|
3250
|
+
fontFamily?: string | Ref<string>;
|
|
3251
|
+
/**
|
|
3252
|
+
* Font weight
|
|
3253
|
+
* @default 'normal'
|
|
3254
|
+
*/
|
|
3255
|
+
fontWeight?: string | number | Ref<string | number>;
|
|
3256
|
+
/**
|
|
3257
|
+
* Font color
|
|
3258
|
+
* @default 'rgba(128, 128, 128, 0.15)'
|
|
3259
|
+
*/
|
|
3260
|
+
color?: string | Ref<string>;
|
|
3261
|
+
/**
|
|
3262
|
+
* Gap between watermarks in pixels
|
|
3263
|
+
* @default [100, 100]
|
|
3264
|
+
*/
|
|
3265
|
+
gap?: [number, number] | number | Ref<[number, number] | number>;
|
|
3266
|
+
/**
|
|
3267
|
+
* Z-index of watermark layer
|
|
3268
|
+
* @default 9999
|
|
1529
3269
|
*/
|
|
1530
|
-
|
|
3270
|
+
zIndex?: number | Ref<number>;
|
|
1531
3271
|
/**
|
|
1532
|
-
* Whether to
|
|
1533
|
-
* When true, length and position options are ignored
|
|
3272
|
+
* Whether to disable watermark
|
|
1534
3273
|
* @default false
|
|
1535
3274
|
*/
|
|
1536
|
-
|
|
3275
|
+
disabled?: boolean | Ref<boolean>;
|
|
1537
3276
|
/**
|
|
1538
|
-
*
|
|
3277
|
+
* Whether to prevent removal attempts
|
|
1539
3278
|
* @default true
|
|
1540
3279
|
*/
|
|
1541
|
-
|
|
3280
|
+
protect?: boolean | Ref<boolean>;
|
|
1542
3281
|
}
|
|
1543
3282
|
|
|
1544
3283
|
/**
|
|
1545
|
-
*
|
|
1546
|
-
*/
|
|
1547
|
-
export declare type TruncatePosition = 'start' | 'middle' | 'end';
|
|
1548
|
-
|
|
1549
|
-
/**
|
|
1550
|
-
* Directive binding value type
|
|
3284
|
+
* Return type for useWatermark composable
|
|
1551
3285
|
*/
|
|
1552
|
-
export declare
|
|
1553
|
-
|
|
1554
|
-
/**
|
|
1555
|
-
* Uppercase directive options
|
|
1556
|
-
*/
|
|
1557
|
-
export declare interface UppercaseOptions {
|
|
3286
|
+
export declare interface UseWatermarkReturn {
|
|
1558
3287
|
/**
|
|
1559
|
-
*
|
|
1560
|
-
* @default false
|
|
3288
|
+
* Watermark canvas element
|
|
1561
3289
|
*/
|
|
1562
|
-
|
|
3290
|
+
canvas: Ref<HTMLCanvasElement | null>;
|
|
1563
3291
|
/**
|
|
1564
|
-
*
|
|
1565
|
-
|
|
3292
|
+
* Watermark data URL
|
|
3293
|
+
*/
|
|
3294
|
+
dataUrl: Ref<string>;
|
|
3295
|
+
/**
|
|
3296
|
+
* Watermark CSS style object
|
|
3297
|
+
*/
|
|
3298
|
+
style: Ref<{
|
|
3299
|
+
position: string;
|
|
3300
|
+
top: string;
|
|
3301
|
+
left: string;
|
|
3302
|
+
width: string;
|
|
3303
|
+
height: string;
|
|
3304
|
+
pointerEvents: string;
|
|
3305
|
+
zIndex: number;
|
|
3306
|
+
backgroundImage: string;
|
|
3307
|
+
backgroundRepeat: string;
|
|
3308
|
+
backgroundPosition: string;
|
|
3309
|
+
backgroundSize: string;
|
|
3310
|
+
display?: string;
|
|
3311
|
+
}>;
|
|
3312
|
+
/**
|
|
3313
|
+
* Whether watermark is disabled
|
|
3314
|
+
*/
|
|
3315
|
+
disabled: Ref<boolean>;
|
|
3316
|
+
/**
|
|
3317
|
+
* Update watermark options
|
|
1566
3318
|
*/
|
|
1567
|
-
|
|
3319
|
+
update: (options: Partial<UseWatermarkOptions>) => void;
|
|
3320
|
+
/**
|
|
3321
|
+
* Enable watermark
|
|
3322
|
+
*/
|
|
3323
|
+
enable: () => void;
|
|
3324
|
+
/**
|
|
3325
|
+
* Disable watermark
|
|
3326
|
+
*/
|
|
3327
|
+
disable: () => void;
|
|
1568
3328
|
}
|
|
1569
3329
|
|
|
1570
3330
|
/**
|
|
@@ -1584,9 +3344,30 @@ export declare interface UppercaseOptions {
|
|
|
1584
3344
|
* </template>
|
|
1585
3345
|
* ```
|
|
1586
3346
|
*/
|
|
1587
|
-
declare const vCapitalcase: Directive;
|
|
1588
|
-
|
|
1589
|
-
|
|
3347
|
+
export declare const vCapitalcase: Directive;
|
|
3348
|
+
|
|
3349
|
+
/**
|
|
3350
|
+
* v-click-delay directive
|
|
3351
|
+
*
|
|
3352
|
+
* Prevents repeated clicks within a specified time period.
|
|
3353
|
+
*
|
|
3354
|
+
* @example
|
|
3355
|
+
* ```vue
|
|
3356
|
+
* <template>
|
|
3357
|
+
* <!-- Basic usage -->
|
|
3358
|
+
* <button v-click-delay="handleClick">Click Me</button>
|
|
3359
|
+
*
|
|
3360
|
+
* <!-- With delay time -->
|
|
3361
|
+
* <button v-click-delay:500="handleClick">Click Me (500ms)</button>
|
|
3362
|
+
*
|
|
3363
|
+
* <!-- With options -->
|
|
3364
|
+
* <button v-click-delay="{ handler: handleClick, delay: 1000 }">
|
|
3365
|
+
* Click Me (1s)
|
|
3366
|
+
* </button>
|
|
3367
|
+
* </template>
|
|
3368
|
+
* ```
|
|
3369
|
+
*/
|
|
3370
|
+
export declare const vClickDelay: Directive;
|
|
1590
3371
|
|
|
1591
3372
|
/**
|
|
1592
3373
|
* v-click-outside directive
|
|
@@ -1600,9 +3381,7 @@ export { vCapitalcase }
|
|
|
1600
3381
|
* </template>
|
|
1601
3382
|
* ```
|
|
1602
3383
|
*/
|
|
1603
|
-
declare const vClickOutside: Directive;
|
|
1604
|
-
export { vClickOutside as clickOutside }
|
|
1605
|
-
export { vClickOutside }
|
|
3384
|
+
export declare const vClickOutside: Directive;
|
|
1606
3385
|
|
|
1607
3386
|
/**
|
|
1608
3387
|
* v-copy directive
|
|
@@ -1614,9 +3393,38 @@ export { vClickOutside }
|
|
|
1614
3393
|
* </template>
|
|
1615
3394
|
* ```
|
|
1616
3395
|
*/
|
|
1617
|
-
declare const vCopy: Directive;
|
|
1618
|
-
|
|
1619
|
-
|
|
3396
|
+
export declare const vCopy: Directive;
|
|
3397
|
+
|
|
3398
|
+
/**
|
|
3399
|
+
* v-countdown directive
|
|
3400
|
+
*
|
|
3401
|
+
* Displays a countdown timer.
|
|
3402
|
+
*
|
|
3403
|
+
* @example
|
|
3404
|
+
* ```vue
|
|
3405
|
+
* <template>
|
|
3406
|
+
* <!-- Basic usage -->
|
|
3407
|
+
* <span v-countdown="targetDate"></span>
|
|
3408
|
+
*
|
|
3409
|
+
* <!-- With timestamp -->
|
|
3410
|
+
* <span v-countdown="Date.now() + 60000"></span>
|
|
3411
|
+
*
|
|
3412
|
+
* <!-- With options -->
|
|
3413
|
+
* <span v-countdown="{
|
|
3414
|
+
* target: targetDate,
|
|
3415
|
+
* format: 'dd:hh:mm:ss',
|
|
3416
|
+
* onComplete: handleComplete
|
|
3417
|
+
* }"></span>
|
|
3418
|
+
*
|
|
3419
|
+
* <!-- With custom format function -->
|
|
3420
|
+
* <span v-countdown="{
|
|
3421
|
+
* target: targetDate,
|
|
3422
|
+
* format: (time) => `${time.days} days ${time.hours}:${time.minutes}:${time.seconds}`
|
|
3423
|
+
* }"></span>
|
|
3424
|
+
* </template>
|
|
3425
|
+
* ```
|
|
3426
|
+
*/
|
|
3427
|
+
export declare const vCountdown: Directive;
|
|
1620
3428
|
|
|
1621
3429
|
/**
|
|
1622
3430
|
* v-debounce directive
|
|
@@ -1632,9 +3440,7 @@ export { vCopy }
|
|
|
1632
3440
|
* </template>
|
|
1633
3441
|
* ```
|
|
1634
3442
|
*/
|
|
1635
|
-
declare const vDebounce: Directive;
|
|
1636
|
-
export { vDebounce as debounce }
|
|
1637
|
-
export { vDebounce }
|
|
3443
|
+
export declare const vDebounce: Directive;
|
|
1638
3444
|
|
|
1639
3445
|
/**
|
|
1640
3446
|
* v-draggable directive
|
|
@@ -1659,9 +3465,30 @@ export { vDebounce }
|
|
|
1659
3465
|
* </template>
|
|
1660
3466
|
* ```
|
|
1661
3467
|
*/
|
|
1662
|
-
declare const vDraggable: Directive;
|
|
1663
|
-
|
|
1664
|
-
|
|
3468
|
+
export declare const vDraggable: Directive;
|
|
3469
|
+
|
|
3470
|
+
/**
|
|
3471
|
+
* v-ellipsis directive
|
|
3472
|
+
*
|
|
3473
|
+
* Truncates text with ellipsis, supports single and multi-line truncation.
|
|
3474
|
+
*
|
|
3475
|
+
* @example
|
|
3476
|
+
* ```vue
|
|
3477
|
+
* <template>
|
|
3478
|
+
* <!-- Single line ellipsis -->
|
|
3479
|
+
* <p v-ellipsis>Long text here...</p>
|
|
3480
|
+
*
|
|
3481
|
+
* <!-- Multi-line ellipsis (3 lines) -->
|
|
3482
|
+
* <p v-ellipsis="3">Long text here...</p>
|
|
3483
|
+
*
|
|
3484
|
+
* <!-- With options -->
|
|
3485
|
+
* <p v-ellipsis="{ lines: 2, expandable: true }">
|
|
3486
|
+
* Click to expand long text...
|
|
3487
|
+
* </p>
|
|
3488
|
+
* </template>
|
|
3489
|
+
* ```
|
|
3490
|
+
*/
|
|
3491
|
+
export declare const vEllipsis: Directive;
|
|
1665
3492
|
|
|
1666
3493
|
/**
|
|
1667
3494
|
* v-focus directive
|
|
@@ -1674,9 +3501,9 @@ export { vDraggable }
|
|
|
1674
3501
|
* </template>
|
|
1675
3502
|
* ```
|
|
1676
3503
|
*/
|
|
1677
|
-
declare const vFocus: Directive;
|
|
1678
|
-
|
|
1679
|
-
export
|
|
3504
|
+
export declare const vFocus: Directive;
|
|
3505
|
+
|
|
3506
|
+
export declare const vHotkey: Directive;
|
|
1680
3507
|
|
|
1681
3508
|
/**
|
|
1682
3509
|
* v-hover directive
|
|
@@ -1689,9 +3516,7 @@ export { vFocus }
|
|
|
1689
3516
|
* </template>
|
|
1690
3517
|
* ```
|
|
1691
3518
|
*/
|
|
1692
|
-
declare const vHover: Directive;
|
|
1693
|
-
export { vHover as hover }
|
|
1694
|
-
export { vHover }
|
|
3519
|
+
export declare const vHover: Directive;
|
|
1695
3520
|
|
|
1696
3521
|
/**
|
|
1697
3522
|
* v-image-preview directive
|
|
@@ -1710,9 +3535,7 @@ export { vHover }
|
|
|
1710
3535
|
* </template>
|
|
1711
3536
|
* ```
|
|
1712
3537
|
*/
|
|
1713
|
-
declare const vImagePreview: Directive;
|
|
1714
|
-
export { vImagePreview as imagePreview }
|
|
1715
|
-
export { vImagePreview }
|
|
3538
|
+
export declare const vImagePreview: Directive;
|
|
1716
3539
|
|
|
1717
3540
|
/**
|
|
1718
3541
|
* v-infinite-scroll directive
|
|
@@ -1730,9 +3553,7 @@ export { vImagePreview }
|
|
|
1730
3553
|
* </template>
|
|
1731
3554
|
* ```
|
|
1732
3555
|
*/
|
|
1733
|
-
declare const vInfiniteScroll: Directive;
|
|
1734
|
-
export { vInfiniteScroll as infiniteScroll }
|
|
1735
|
-
export { vInfiniteScroll }
|
|
3556
|
+
export declare const vInfiniteScroll: Directive;
|
|
1736
3557
|
|
|
1737
3558
|
/**
|
|
1738
3559
|
* v-intersect directive
|
|
@@ -1744,43 +3565,29 @@ export { vInfiniteScroll }
|
|
|
1744
3565
|
* <div v-intersect="{ threshold: 0.5, once: true }">Trigger once at 50%</div>
|
|
1745
3566
|
* ```
|
|
1746
3567
|
*/
|
|
1747
|
-
declare const vIntersect: Directive;
|
|
1748
|
-
export { vIntersect as intersect }
|
|
1749
|
-
export { vIntersect }
|
|
1750
|
-
|
|
1751
|
-
/**
|
|
1752
|
-
* Directive binding value type
|
|
1753
|
-
*/
|
|
1754
|
-
export declare type VisibleBinding = boolean | VisibleOptions;
|
|
3568
|
+
export declare const vIntersect: Directive;
|
|
1755
3569
|
|
|
1756
3570
|
/**
|
|
1757
|
-
*
|
|
3571
|
+
* Virtual list item info
|
|
1758
3572
|
*/
|
|
1759
|
-
export declare
|
|
1760
|
-
|
|
1761
|
-
/**
|
|
1762
|
-
* Visible directive options
|
|
1763
|
-
*/
|
|
1764
|
-
export declare interface VisibleOptions {
|
|
1765
|
-
/**
|
|
1766
|
-
* Callback when visibility changes
|
|
1767
|
-
*/
|
|
1768
|
-
handler?: VisibleHandler;
|
|
3573
|
+
export declare interface VirtualListItem<T = any> {
|
|
1769
3574
|
/**
|
|
1770
|
-
*
|
|
1771
|
-
* @default false
|
|
3575
|
+
* The item data
|
|
1772
3576
|
*/
|
|
1773
|
-
|
|
3577
|
+
item: T;
|
|
1774
3578
|
/**
|
|
1775
|
-
*
|
|
1776
|
-
* @default false
|
|
3579
|
+
* Index in the original list
|
|
1777
3580
|
*/
|
|
1778
|
-
|
|
3581
|
+
index: number;
|
|
1779
3582
|
/**
|
|
1780
|
-
*
|
|
1781
|
-
* @default true
|
|
3583
|
+
* Computed style for positioning
|
|
1782
3584
|
*/
|
|
1783
|
-
|
|
3585
|
+
style: {
|
|
3586
|
+
position: string;
|
|
3587
|
+
top: string;
|
|
3588
|
+
height: string;
|
|
3589
|
+
width: string;
|
|
3590
|
+
};
|
|
1784
3591
|
}
|
|
1785
3592
|
|
|
1786
3593
|
/**
|
|
@@ -1795,9 +3602,7 @@ export declare interface VisibleOptions {
|
|
|
1795
3602
|
* </template>
|
|
1796
3603
|
* ```
|
|
1797
3604
|
*/
|
|
1798
|
-
declare const vLazy: Directive;
|
|
1799
|
-
export { vLazy as lazy }
|
|
1800
|
-
export { vLazy }
|
|
3605
|
+
export declare const vLazy: Directive;
|
|
1801
3606
|
|
|
1802
3607
|
/**
|
|
1803
3608
|
* v-loading directive
|
|
@@ -1811,9 +3616,7 @@ export { vLazy }
|
|
|
1811
3616
|
* </template>
|
|
1812
3617
|
* ```
|
|
1813
3618
|
*/
|
|
1814
|
-
declare const vLoading: Directive;
|
|
1815
|
-
export { vLoading as loading }
|
|
1816
|
-
export { vLoading }
|
|
3619
|
+
export declare const vLoading: Directive;
|
|
1817
3620
|
|
|
1818
3621
|
/**
|
|
1819
3622
|
* v-long-press directive
|
|
@@ -1826,9 +3629,7 @@ export { vLoading }
|
|
|
1826
3629
|
* </template>
|
|
1827
3630
|
* ```
|
|
1828
3631
|
*/
|
|
1829
|
-
declare const vLongPress: Directive;
|
|
1830
|
-
export { vLongPress as longPress }
|
|
1831
|
-
export { vLongPress }
|
|
3632
|
+
export declare const vLongPress: Directive;
|
|
1832
3633
|
|
|
1833
3634
|
/**
|
|
1834
3635
|
* v-lowercase directive
|
|
@@ -1844,9 +3645,7 @@ export { vLongPress }
|
|
|
1844
3645
|
* </template>
|
|
1845
3646
|
* ```
|
|
1846
3647
|
*/
|
|
1847
|
-
declare const vLowercase: Directive;
|
|
1848
|
-
export { vLowercase as lowercase }
|
|
1849
|
-
export { vLowercase }
|
|
3648
|
+
export declare const vLowercase: Directive;
|
|
1850
3649
|
|
|
1851
3650
|
/**
|
|
1852
3651
|
* v-mask directive
|
|
@@ -1858,13 +3657,9 @@ export { vLowercase }
|
|
|
1858
3657
|
* <input v-mask="{ mask: '##/##/####' }" placeholder="Date" />
|
|
1859
3658
|
* ```
|
|
1860
3659
|
*/
|
|
1861
|
-
declare const vMask: Directive;
|
|
1862
|
-
export { vMask as mask }
|
|
1863
|
-
export { vMask }
|
|
3660
|
+
export declare const vMask: Directive;
|
|
1864
3661
|
|
|
1865
|
-
declare const vMoney: Directive;
|
|
1866
|
-
export { vMoney as money }
|
|
1867
|
-
export { vMoney }
|
|
3662
|
+
export declare const vMoney: Directive;
|
|
1868
3663
|
|
|
1869
3664
|
/**
|
|
1870
3665
|
* v-mutation directive
|
|
@@ -1888,13 +3683,9 @@ export { vMoney }
|
|
|
1888
3683
|
* </script>
|
|
1889
3684
|
* ```
|
|
1890
3685
|
*/
|
|
1891
|
-
declare const vMutation: Directive;
|
|
1892
|
-
export { vMutation as mutation }
|
|
1893
|
-
export { vMutation }
|
|
3686
|
+
export declare const vMutation: Directive;
|
|
1894
3687
|
|
|
1895
|
-
declare const vNumber: Directive;
|
|
1896
|
-
export { vNumber as number }
|
|
1897
|
-
export { vNumber }
|
|
3688
|
+
export declare const vNumber: Directive;
|
|
1898
3689
|
|
|
1899
3690
|
/**
|
|
1900
3691
|
* v-permission directive
|
|
@@ -1922,9 +3713,35 @@ export { vNumber }
|
|
|
1922
3713
|
* </script>
|
|
1923
3714
|
* ```
|
|
1924
3715
|
*/
|
|
1925
|
-
declare const vPermission: Directive;
|
|
1926
|
-
|
|
1927
|
-
|
|
3716
|
+
export declare const vPermission: Directive;
|
|
3717
|
+
|
|
3718
|
+
/**
|
|
3719
|
+
* v-print directive
|
|
3720
|
+
*
|
|
3721
|
+
* Prints the element content when clicked or immediately.
|
|
3722
|
+
*
|
|
3723
|
+
* @example
|
|
3724
|
+
* ```vue
|
|
3725
|
+
* <template>
|
|
3726
|
+
* <!-- Print on click -->
|
|
3727
|
+
* <button v-print>Print Page</button>
|
|
3728
|
+
*
|
|
3729
|
+
* <!-- Print specific element -->
|
|
3730
|
+
* <button v-print="{ target: '#content' }">Print Content</button>
|
|
3731
|
+
*
|
|
3732
|
+
* <!-- Print with custom title -->
|
|
3733
|
+
* <button v-print="{ title: 'My Document', styles: 'body { font-size: 12px }' }">
|
|
3734
|
+
* Print
|
|
3735
|
+
* </button>
|
|
3736
|
+
*
|
|
3737
|
+
* <!-- Print immediately on mount -->
|
|
3738
|
+
* <div v-print="{ immediate: true }">Auto print</div>
|
|
3739
|
+
* </template>
|
|
3740
|
+
* ```
|
|
3741
|
+
*/
|
|
3742
|
+
export declare const vPrint: Directive;
|
|
3743
|
+
|
|
3744
|
+
export declare const vPullRefresh: Directive;
|
|
1928
3745
|
|
|
1929
3746
|
/**
|
|
1930
3747
|
* v-resize directive
|
|
@@ -1937,9 +3754,7 @@ export { vPermission }
|
|
|
1937
3754
|
* </template>
|
|
1938
3755
|
* ```
|
|
1939
3756
|
*/
|
|
1940
|
-
declare const vResize: Directive;
|
|
1941
|
-
export { vResize as resize }
|
|
1942
|
-
export { vResize }
|
|
3757
|
+
export declare const vResize: Directive;
|
|
1943
3758
|
|
|
1944
3759
|
/**
|
|
1945
3760
|
* v-ripple directive
|
|
@@ -1953,9 +3768,7 @@ export { vResize }
|
|
|
1953
3768
|
* </template>
|
|
1954
3769
|
* ```
|
|
1955
3770
|
*/
|
|
1956
|
-
declare const vRipple: Directive;
|
|
1957
|
-
export { vRipple as ripple }
|
|
1958
|
-
export { vRipple }
|
|
3771
|
+
export declare const vRipple: Directive;
|
|
1959
3772
|
|
|
1960
3773
|
/**
|
|
1961
3774
|
* v-sanitize directive
|
|
@@ -1969,9 +3782,7 @@ export { vRipple }
|
|
|
1969
3782
|
* </template>
|
|
1970
3783
|
* ```
|
|
1971
3784
|
*/
|
|
1972
|
-
declare const vSanitize: Directive;
|
|
1973
|
-
export { vSanitize as sanitize }
|
|
1974
|
-
export { vSanitize }
|
|
3785
|
+
export declare const vSanitize: Directive;
|
|
1975
3786
|
|
|
1976
3787
|
/**
|
|
1977
3788
|
* v-scroll directive
|
|
@@ -1984,9 +3795,7 @@ export { vSanitize }
|
|
|
1984
3795
|
* </template>
|
|
1985
3796
|
* ```
|
|
1986
3797
|
*/
|
|
1987
|
-
declare const vScroll: Directive;
|
|
1988
|
-
export { vScroll as scroll }
|
|
1989
|
-
export { vScroll }
|
|
3798
|
+
export declare const vScroll: Directive;
|
|
1990
3799
|
|
|
1991
3800
|
/**
|
|
1992
3801
|
* v-sticky directive
|
|
@@ -1998,9 +3807,9 @@ export { vScroll }
|
|
|
1998
3807
|
* <div v-sticky="{ top: 60, zIndex: 1000 }">Custom sticky</div>
|
|
1999
3808
|
* ```
|
|
2000
3809
|
*/
|
|
2001
|
-
declare const vSticky: Directive;
|
|
2002
|
-
|
|
2003
|
-
export
|
|
3810
|
+
export declare const vSticky: Directive;
|
|
3811
|
+
|
|
3812
|
+
export declare const vSwipe: Directive;
|
|
2004
3813
|
|
|
2005
3814
|
/**
|
|
2006
3815
|
* v-throttle directive
|
|
@@ -2015,17 +3824,11 @@ export { vSticky }
|
|
|
2015
3824
|
* </template>
|
|
2016
3825
|
* ```
|
|
2017
3826
|
*/
|
|
2018
|
-
declare const vThrottle: Directive;
|
|
2019
|
-
export { vThrottle as throttle }
|
|
2020
|
-
export { vThrottle }
|
|
3827
|
+
export declare const vThrottle: Directive;
|
|
2021
3828
|
|
|
2022
|
-
declare const vTooltip: Directive;
|
|
2023
|
-
export { vTooltip as tooltip }
|
|
2024
|
-
export { vTooltip }
|
|
3829
|
+
export declare const vTooltip: Directive;
|
|
2025
3830
|
|
|
2026
|
-
declare const vTouch: Directive;
|
|
2027
|
-
export { vTouch as touch }
|
|
2028
|
-
export { vTouch }
|
|
3831
|
+
export declare const vTouch: Directive;
|
|
2029
3832
|
|
|
2030
3833
|
/**
|
|
2031
3834
|
* v-trim directive
|
|
@@ -2050,9 +3853,7 @@ export { vTouch }
|
|
|
2050
3853
|
* </template>
|
|
2051
3854
|
* ```
|
|
2052
3855
|
*/
|
|
2053
|
-
declare const vTrim: Directive;
|
|
2054
|
-
export { vTrim as trim }
|
|
2055
|
-
export { vTrim }
|
|
3856
|
+
export declare const vTrim: Directive;
|
|
2056
3857
|
|
|
2057
3858
|
/**
|
|
2058
3859
|
* v-truncate directive
|
|
@@ -2071,9 +3872,7 @@ export { vTrim }
|
|
|
2071
3872
|
* </template>
|
|
2072
3873
|
* ```
|
|
2073
3874
|
*/
|
|
2074
|
-
declare const vTruncate: Directive;
|
|
2075
|
-
export { vTruncate as truncate }
|
|
2076
|
-
export { vTruncate }
|
|
3875
|
+
export declare const vTruncate: Directive;
|
|
2077
3876
|
|
|
2078
3877
|
/**
|
|
2079
3878
|
* Vue 2 directive hooks
|
|
@@ -2121,9 +3920,29 @@ export declare type VueVersion = 2 | 2.7 | 3;
|
|
|
2121
3920
|
* </template>
|
|
2122
3921
|
* ```
|
|
2123
3922
|
*/
|
|
2124
|
-
declare const vUppercase: Directive;
|
|
2125
|
-
|
|
2126
|
-
|
|
3923
|
+
export declare const vUppercase: Directive;
|
|
3924
|
+
|
|
3925
|
+
/**
|
|
3926
|
+
* v-virtual-list directive
|
|
3927
|
+
*
|
|
3928
|
+
* Renders a large list efficiently using virtualization.
|
|
3929
|
+
*
|
|
3930
|
+
* @example
|
|
3931
|
+
* ```vue
|
|
3932
|
+
* <template>
|
|
3933
|
+
* <div v-virtual-list="{ items: largeList, itemSize: 50 }"></div>
|
|
3934
|
+
*
|
|
3935
|
+
* <div v-virtual-list="{
|
|
3936
|
+
* items: largeList,
|
|
3937
|
+
* itemSize: (index) => index % 10 === 0 ? 100 : 50,
|
|
3938
|
+
* height: 600,
|
|
3939
|
+
* overscan: 5,
|
|
3940
|
+
* render: (item, index) => `<div class="item">${item.name}</div>`
|
|
3941
|
+
* }"></div>
|
|
3942
|
+
* </template>
|
|
3943
|
+
* ```
|
|
3944
|
+
*/
|
|
3945
|
+
export declare const vVirtualList: Directive;
|
|
2127
3946
|
|
|
2128
3947
|
/**
|
|
2129
3948
|
* v-visible directive
|
|
@@ -2137,8 +3956,47 @@ export { vUppercase }
|
|
|
2137
3956
|
* </template>
|
|
2138
3957
|
* ```
|
|
2139
3958
|
*/
|
|
2140
|
-
declare const vVisible: Directive;
|
|
2141
|
-
|
|
2142
|
-
|
|
3959
|
+
export declare const vVisible: Directive;
|
|
3960
|
+
|
|
3961
|
+
/**
|
|
3962
|
+
* v-watermark directive
|
|
3963
|
+
*
|
|
3964
|
+
* Adds a watermark layer to an element.
|
|
3965
|
+
*
|
|
3966
|
+
* @example
|
|
3967
|
+
* ```vue
|
|
3968
|
+
* <template>
|
|
3969
|
+
* <!-- Simple watermark -->
|
|
3970
|
+
* <div v-watermark="'Confidential'">Protected content</div>
|
|
3971
|
+
*
|
|
3972
|
+
* <!-- Multi-line watermark -->
|
|
3973
|
+
* <div v-watermark="{ content: ['Company Name', 'User: John'] }">
|
|
3974
|
+
* Protected content
|
|
3975
|
+
* </div>
|
|
3976
|
+
*
|
|
3977
|
+
* <!-- Customized watermark -->
|
|
3978
|
+
* <div v-watermark="{
|
|
3979
|
+
* content: 'DRAFT',
|
|
3980
|
+
* fontSize: 24,
|
|
3981
|
+
* color: 'rgba(255, 0, 0, 0.2)',
|
|
3982
|
+
* rotate: -30,
|
|
3983
|
+
* gap: 50
|
|
3984
|
+
* }">
|
|
3985
|
+
* Draft document
|
|
3986
|
+
* </div>
|
|
3987
|
+
* </template>
|
|
3988
|
+
* ```
|
|
3989
|
+
*/
|
|
3990
|
+
export declare const vWatermark: Directive;
|
|
3991
|
+
|
|
3992
|
+
/**
|
|
3993
|
+
* Utility function to check if text would be truncated in a container
|
|
3994
|
+
*
|
|
3995
|
+
* @param text - Text to check
|
|
3996
|
+
* @param containerWidth - Container width in pixels
|
|
3997
|
+
* @param fontSize - Font size in pixels
|
|
3998
|
+
* @returns Whether text would be truncated
|
|
3999
|
+
*/
|
|
4000
|
+
export declare function wouldTextTruncate(text: string, containerWidth: number, fontSize?: number): boolean;
|
|
2143
4001
|
|
|
2144
4002
|
export { }
|