directix 1.2.0 → 1.3.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/dist/index.d.ts CHANGED
@@ -39,6 +39,47 @@ export declare interface CapitalcaseOptions {
39
39
  onInput?: boolean;
40
40
  }
41
41
 
42
+ /**
43
+ * Directive binding value type
44
+ */
45
+ export declare type ClickDelayBinding = ClickDelayHandler | ClickDelayOptions;
46
+
47
+ /**
48
+ * Click delay handler
49
+ */
50
+ export declare type ClickDelayHandler = (event: MouseEvent | TouchEvent) => void;
51
+
52
+ /**
53
+ * Click delay directive options
54
+ */
55
+ export declare interface ClickDelayOptions {
56
+ /**
57
+ * Click handler
58
+ * @required
59
+ */
60
+ handler: ClickDelayHandler;
61
+ /**
62
+ * Delay time in milliseconds
63
+ * @default 300
64
+ */
65
+ delay?: number;
66
+ /**
67
+ * Whether to disable
68
+ * @default false
69
+ */
70
+ disabled?: boolean;
71
+ /**
72
+ * CSS class to add during delay
73
+ * @default 'v-click-delay--pending'
74
+ */
75
+ pendingClass?: string;
76
+ /**
77
+ * Whether to show visual feedback
78
+ * @default true
79
+ */
80
+ feedback?: boolean;
81
+ }
82
+
42
83
  /**
43
84
  * Directive binding value type
44
85
  */
@@ -137,6 +178,91 @@ export declare interface CopyOptions {
137
178
  */
138
179
  export declare type CopySuccessCallback = (text: string) => void;
139
180
 
181
+ /**
182
+ * Directive binding value type
183
+ */
184
+ export declare type CountdownBinding = CountdownOptions | Date | number | string;
185
+
186
+ /**
187
+ * Countdown complete callback
188
+ */
189
+ export declare type CountdownCompleteCallback = () => void;
190
+
191
+ /**
192
+ * Countdown format function
193
+ */
194
+ export declare type CountdownFormatFunction = (time: CountdownTime) => string;
195
+
196
+ /**
197
+ * Countdown directive options
198
+ */
199
+ export declare interface CountdownOptions {
200
+ /**
201
+ * Target time (Date object, timestamp, or ISO string)
202
+ * @required
203
+ */
204
+ target: Date | number | string;
205
+ /**
206
+ * Format string or custom format function
207
+ * - 'dd:hh:mm:ss' - Days:Hours:Minutes:Seconds
208
+ * - 'hh:mm:ss' - Hours:Minutes:Seconds
209
+ * - 'mm:ss' - Minutes:Seconds
210
+ * - 'ss' - Seconds only
211
+ * @default 'hh:mm:ss'
212
+ */
213
+ format?: string | CountdownFormatFunction;
214
+ /**
215
+ * Callback when countdown completes
216
+ */
217
+ onComplete?: CountdownCompleteCallback;
218
+ /**
219
+ * Callback on each tick
220
+ */
221
+ onTick?: CountdownTickCallback;
222
+ /**
223
+ * Update interval in milliseconds
224
+ * @default 1000
225
+ */
226
+ interval?: number;
227
+ /**
228
+ * Whether to show milliseconds
229
+ * @default false
230
+ */
231
+ showMilliseconds?: boolean;
232
+ /**
233
+ * Whether to auto-start
234
+ * @default true
235
+ */
236
+ autoStart?: boolean;
237
+ /**
238
+ * Custom labels for i18n
239
+ */
240
+ labels?: {
241
+ days?: string;
242
+ hours?: string;
243
+ minutes?: string;
244
+ seconds?: string;
245
+ milliseconds?: string;
246
+ };
247
+ }
248
+
249
+ /**
250
+ * Countdown tick callback
251
+ */
252
+ export declare type CountdownTickCallback = (time: CountdownTime) => void;
253
+
254
+ /**
255
+ * Countdown time object
256
+ */
257
+ export declare interface CountdownTime {
258
+ days: number;
259
+ hours: number;
260
+ minutes: number;
261
+ seconds: number;
262
+ milliseconds: number;
263
+ total: number;
264
+ }
265
+
140
266
  /**
141
267
  * Vue 2 directive adapter
142
268
  * @returns Vue 2 directive object with bind/inserted/update/unbind hooks
@@ -370,6 +496,40 @@ export declare interface DraggableOptions {
370
496
  }, event: MouseEvent | TouchEvent) => void;
371
497
  }
372
498
 
499
+ /**
500
+ * Directive binding value type
501
+ */
502
+ export declare type EllipsisBinding = number | EllipsisOptions;
503
+
504
+ /**
505
+ * Ellipsis directive options
506
+ */
507
+ export declare interface EllipsisOptions {
508
+ /**
509
+ * Number of lines to show before truncating
510
+ * @default 1
511
+ */
512
+ lines?: number;
513
+ /**
514
+ * Custom ellipsis string
515
+ * @default '...'
516
+ */
517
+ ellipsis?: string;
518
+ /**
519
+ * Whether to expand on click
520
+ * @default false
521
+ */
522
+ expandable?: boolean;
523
+ /**
524
+ * Title attribute behavior
525
+ * - 'auto': Show full text as title only when truncated
526
+ * - 'always': Always show full text as title
527
+ * - 'none': Don't show title
528
+ * @default 'auto'
529
+ */
530
+ titleBehavior?: 'auto' | 'always' | 'none';
531
+ }
532
+
373
533
  /**
374
534
  * Directive binding value type
375
535
  */
@@ -420,6 +580,20 @@ export declare function getPermissionConfig(): PermissionConfig | null;
420
580
  */
421
581
  export declare function getVueVersion(): VueVersion;
422
582
 
583
+ export declare type HotkeyBinding = HotkeyHandler | HotkeyDefinition | HotkeyDefinition[] | Record<string, HotkeyHandler | HotkeyDefinition>;
584
+
585
+ export declare interface HotkeyDefinition {
586
+ key: string;
587
+ modifiers?: ModifierKey[];
588
+ handler: HotkeyHandler;
589
+ prevent?: boolean;
590
+ stop?: boolean;
591
+ disabled?: boolean;
592
+ global?: boolean;
593
+ }
594
+
595
+ export declare type HotkeyHandler = (event: KeyboardEvent) => void;
596
+
423
597
  /**
424
598
  * Directive binding value type
425
599
  */
@@ -671,6 +845,11 @@ export declare function isVue27(): boolean;
671
845
  */
672
846
  export declare function isVue3(): boolean;
673
847
 
848
+ /**
849
+ * Virtual list item size function
850
+ */
851
+ export declare type ItemSizeFunction = (index: number) => number;
852
+
674
853
  /**
675
854
  * Directive binding value type
676
855
  */
@@ -892,6 +1071,8 @@ export declare interface MaskOptions {
892
1071
  onComplete?: (value: string) => void;
893
1072
  }
894
1073
 
1074
+ export declare type ModifierKey = 'ctrl' | 'alt' | 'shift' | 'meta';
1075
+
895
1076
  export declare type MoneyBinding = string | MoneyOptions;
896
1077
 
897
1078
  /**
@@ -1046,6 +1227,91 @@ export declare interface PermissionOptions {
1046
1227
  onChange?: (hasPermission: boolean) => void;
1047
1228
  }
1048
1229
 
1230
+ /**
1231
+ * Print before callback
1232
+ */
1233
+ export declare type PrintBeforeCallback = () => boolean | void;
1234
+
1235
+ /**
1236
+ * Directive binding value type
1237
+ */
1238
+ export declare type PrintBinding = PrintOptions | boolean;
1239
+
1240
+ /**
1241
+ * Print complete callback
1242
+ */
1243
+ export declare type PrintCompleteCallback = () => void;
1244
+
1245
+ /**
1246
+ * Print directive options
1247
+ */
1248
+ export declare interface PrintOptions {
1249
+ /**
1250
+ * Title for the printed document
1251
+ */
1252
+ title?: string;
1253
+ /**
1254
+ * Additional CSS styles to inject
1255
+ */
1256
+ styles?: string | string[];
1257
+ /**
1258
+ * Additional CSS URLs to include
1259
+ */
1260
+ cssUrls?: string[];
1261
+ /**
1262
+ * Callback before printing
1263
+ * Return false to cancel printing
1264
+ */
1265
+ onBeforePrint?: PrintBeforeCallback;
1266
+ /**
1267
+ * Callback after printing
1268
+ */
1269
+ onAfterPrint?: PrintCompleteCallback;
1270
+ /**
1271
+ * Whether to print immediately on mount
1272
+ * @default false
1273
+ */
1274
+ immediate?: boolean;
1275
+ /**
1276
+ * Print target selector
1277
+ * If not specified, prints the element itself
1278
+ */
1279
+ target?: string;
1280
+ /**
1281
+ * Whether to print in a new window
1282
+ * @default false
1283
+ */
1284
+ newWindow?: boolean;
1285
+ /**
1286
+ * Custom class for print container
1287
+ */
1288
+ printClass?: string;
1289
+ }
1290
+
1291
+ export declare type PullRefreshBinding = PullRefreshHandler | PullRefreshOptions;
1292
+
1293
+ export declare type PullRefreshHandler = () => Promise<void> | void;
1294
+
1295
+ export declare interface PullRefreshOptions {
1296
+ handler: PullRefreshHandler;
1297
+ distance?: number;
1298
+ maxDistance?: number;
1299
+ disabled?: boolean;
1300
+ indicator?: {
1301
+ idle?: string;
1302
+ pulling?: string;
1303
+ ready?: string;
1304
+ loading?: string;
1305
+ success?: string;
1306
+ error?: string;
1307
+ };
1308
+ successDuration?: number;
1309
+ errorDuration?: number;
1310
+ onStateChange?: (state: PullRefreshState) => void;
1311
+ }
1312
+
1313
+ export declare type PullRefreshState = 'idle' | 'pulling' | 'ready' | 'loading' | 'success' | 'error';
1314
+
1049
1315
  /**
1050
1316
  * Reset Vue version (useful for testing)
1051
1317
  */
@@ -1330,10 +1596,30 @@ export declare const supportsPassive: () => boolean;
1330
1596
  */
1331
1597
  export declare const supportsResizeObserver: () => boolean;
1332
1598
 
1599
+ export declare type SwipeBinding = SwipeHandler | SwipeOptions;
1600
+
1601
+ export declare type SwipeDirection = 'left' | 'right' | 'up' | 'down';
1602
+
1333
1603
  /**
1334
1604
  * Swipe direction
1335
1605
  */
1336
- export declare type SwipeDirection = 'left' | 'right' | 'up' | 'down';
1606
+ declare type SwipeDirection_2 = 'left' | 'right' | 'up' | 'down';
1607
+
1608
+ export declare type SwipeHandler = (direction: SwipeDirection, event: Event) => void;
1609
+
1610
+ export declare interface SwipeOptions {
1611
+ handler?: SwipeHandler;
1612
+ threshold?: number;
1613
+ maxTime?: number;
1614
+ directions?: SwipeDirection[];
1615
+ preventScrollOnSwipe?: boolean;
1616
+ disabled?: boolean;
1617
+ mouse?: boolean;
1618
+ onLeft?: () => void;
1619
+ onRight?: () => void;
1620
+ onUp?: () => void;
1621
+ onDown?: () => void;
1622
+ }
1337
1623
 
1338
1624
  /**
1339
1625
  * Directive binding value type
@@ -1455,7 +1741,7 @@ export declare interface TouchOptions {
1455
1741
  longPressTimeout?: number;
1456
1742
  /** Enable mouse event simulation for desktop @default true */
1457
1743
  enableMouse?: boolean;
1458
- onSwipe?: (direction: SwipeDirection, event: TouchEvent | MouseEvent) => void;
1744
+ onSwipe?: (direction: SwipeDirection_2, event: TouchEvent | MouseEvent) => void;
1459
1745
  onSwipeLeft?: (event: TouchEvent | MouseEvent) => void;
1460
1746
  onSwipeRight?: (event: TouchEvent | MouseEvent) => void;
1461
1747
  onSwipeUp?: (event: TouchEvent | MouseEvent) => void;
@@ -1588,6 +1874,31 @@ declare const vCapitalcase: Directive;
1588
1874
  export { vCapitalcase as capitalcase }
1589
1875
  export { vCapitalcase }
1590
1876
 
1877
+ /**
1878
+ * v-click-delay directive
1879
+ *
1880
+ * Prevents repeated clicks within a specified time period.
1881
+ *
1882
+ * @example
1883
+ * ```vue
1884
+ * <template>
1885
+ * <!-- Basic usage -->
1886
+ * <button v-click-delay="handleClick">Click Me</button>
1887
+ *
1888
+ * <!-- With delay time -->
1889
+ * <button v-click-delay:500="handleClick">Click Me (500ms)</button>
1890
+ *
1891
+ * <!-- With options -->
1892
+ * <button v-click-delay="{ handler: handleClick, delay: 1000 }">
1893
+ * Click Me (1s)
1894
+ * </button>
1895
+ * </template>
1896
+ * ```
1897
+ */
1898
+ declare const vClickDelay: Directive;
1899
+ export { vClickDelay as clickDelay }
1900
+ export { vClickDelay }
1901
+
1591
1902
  /**
1592
1903
  * v-click-outside directive
1593
1904
  *
@@ -1618,6 +1929,39 @@ declare const vCopy: Directive;
1618
1929
  export { vCopy as copy }
1619
1930
  export { vCopy }
1620
1931
 
1932
+ /**
1933
+ * v-countdown directive
1934
+ *
1935
+ * Displays a countdown timer.
1936
+ *
1937
+ * @example
1938
+ * ```vue
1939
+ * <template>
1940
+ * <!-- Basic usage -->
1941
+ * <span v-countdown="targetDate"></span>
1942
+ *
1943
+ * <!-- With timestamp -->
1944
+ * <span v-countdown="Date.now() + 60000"></span>
1945
+ *
1946
+ * <!-- With options -->
1947
+ * <span v-countdown="{
1948
+ * target: targetDate,
1949
+ * format: 'dd:hh:mm:ss',
1950
+ * onComplete: handleComplete
1951
+ * }"></span>
1952
+ *
1953
+ * <!-- With custom format function -->
1954
+ * <span v-countdown="{
1955
+ * target: targetDate,
1956
+ * format: (time) => `${time.days} days ${time.hours}:${time.minutes}:${time.seconds}`
1957
+ * }"></span>
1958
+ * </template>
1959
+ * ```
1960
+ */
1961
+ declare const vCountdown: Directive;
1962
+ export { vCountdown as countdown }
1963
+ export { vCountdown }
1964
+
1621
1965
  /**
1622
1966
  * v-debounce directive
1623
1967
  *
@@ -1663,6 +2007,31 @@ declare const vDraggable: Directive;
1663
2007
  export { vDraggable as draggable }
1664
2008
  export { vDraggable }
1665
2009
 
2010
+ /**
2011
+ * v-ellipsis directive
2012
+ *
2013
+ * Truncates text with ellipsis, supports single and multi-line truncation.
2014
+ *
2015
+ * @example
2016
+ * ```vue
2017
+ * <template>
2018
+ * <!-- Single line ellipsis -->
2019
+ * <p v-ellipsis>Long text here...</p>
2020
+ *
2021
+ * <!-- Multi-line ellipsis (3 lines) -->
2022
+ * <p v-ellipsis="3">Long text here...</p>
2023
+ *
2024
+ * <!-- With options -->
2025
+ * <p v-ellipsis="{ lines: 2, expandable: true }">
2026
+ * Click to expand long text...
2027
+ * </p>
2028
+ * </template>
2029
+ * ```
2030
+ */
2031
+ declare const vEllipsis: Directive;
2032
+ export { vEllipsis as ellipsis }
2033
+ export { vEllipsis }
2034
+
1666
2035
  /**
1667
2036
  * v-focus directive
1668
2037
  *
@@ -1678,6 +2047,10 @@ declare const vFocus: Directive;
1678
2047
  export { vFocus as focus }
1679
2048
  export { vFocus }
1680
2049
 
2050
+ declare const vHotkey: Directive;
2051
+ export { vHotkey as hotkey }
2052
+ export { vHotkey }
2053
+
1681
2054
  /**
1682
2055
  * v-hover directive
1683
2056
  *
@@ -1748,6 +2121,60 @@ declare const vIntersect: Directive;
1748
2121
  export { vIntersect as intersect }
1749
2122
  export { vIntersect }
1750
2123
 
2124
+ /**
2125
+ * Directive binding value type
2126
+ */
2127
+ export declare type VirtualListBinding<T = any> = VirtualListOptions<T> | T[];
2128
+
2129
+ /**
2130
+ * Virtual list directive options
2131
+ */
2132
+ export declare interface VirtualListOptions<T = any> {
2133
+ /**
2134
+ * Array of items to render
2135
+ * @required
2136
+ */
2137
+ items: T[];
2138
+ /**
2139
+ * Height of each item (in pixels)
2140
+ * Can be a fixed number or a function
2141
+ * @default 50
2142
+ */
2143
+ itemSize?: number | ItemSizeFunction;
2144
+ /**
2145
+ * Height of the container (in pixels)
2146
+ * @default 400
2147
+ */
2148
+ height?: number | string;
2149
+ /**
2150
+ * Number of extra items to render above/below visible area
2151
+ * @default 3
2152
+ */
2153
+ overscan?: number;
2154
+ /**
2155
+ * Custom render function
2156
+ */
2157
+ render?: VirtualListRenderFunction;
2158
+ /**
2159
+ * Key field name for items
2160
+ * @default 'id'
2161
+ */
2162
+ keyField?: string;
2163
+ /**
2164
+ * Callback when scroll position changes
2165
+ */
2166
+ onScroll?: (scrollTop: number) => void;
2167
+ /**
2168
+ * Callback when visible range changes
2169
+ */
2170
+ onVisibleChange?: (startIndex: number, endIndex: number) => void;
2171
+ }
2172
+
2173
+ /**
2174
+ * Virtual list render function
2175
+ */
2176
+ export declare type VirtualListRenderFunction = (item: any, index: number) => string;
2177
+
1751
2178
  /**
1752
2179
  * Directive binding value type
1753
2180
  */
@@ -1926,6 +2353,38 @@ declare const vPermission: Directive;
1926
2353
  export { vPermission as permission }
1927
2354
  export { vPermission }
1928
2355
 
2356
+ /**
2357
+ * v-print directive
2358
+ *
2359
+ * Prints the element content when clicked or immediately.
2360
+ *
2361
+ * @example
2362
+ * ```vue
2363
+ * <template>
2364
+ * <!-- Print on click -->
2365
+ * <button v-print>Print Page</button>
2366
+ *
2367
+ * <!-- Print specific element -->
2368
+ * <button v-print="{ target: '#content' }">Print Content</button>
2369
+ *
2370
+ * <!-- Print with custom title -->
2371
+ * <button v-print="{ title: 'My Document', styles: 'body { font-size: 12px }' }">
2372
+ * Print
2373
+ * </button>
2374
+ *
2375
+ * <!-- Print immediately on mount -->
2376
+ * <div v-print="{ immediate: true }">Auto print</div>
2377
+ * </template>
2378
+ * ```
2379
+ */
2380
+ declare const vPrint: Directive;
2381
+ export { vPrint as print }
2382
+ export { vPrint }
2383
+
2384
+ declare const vPullRefresh: Directive;
2385
+ export { vPullRefresh as pullRefresh }
2386
+ export { vPullRefresh }
2387
+
1929
2388
  /**
1930
2389
  * v-resize directive
1931
2390
  *
@@ -2002,6 +2461,10 @@ declare const vSticky: Directive;
2002
2461
  export { vSticky as sticky }
2003
2462
  export { vSticky }
2004
2463
 
2464
+ declare const vSwipe: Directive;
2465
+ export { vSwipe as swipe }
2466
+ export { vSwipe }
2467
+
2005
2468
  /**
2006
2469
  * v-throttle directive
2007
2470
  *
@@ -2125,6 +2588,30 @@ declare const vUppercase: Directive;
2125
2588
  export { vUppercase as uppercase }
2126
2589
  export { vUppercase }
2127
2590
 
2591
+ /**
2592
+ * v-virtual-list directive
2593
+ *
2594
+ * Renders a large list efficiently using virtualization.
2595
+ *
2596
+ * @example
2597
+ * ```vue
2598
+ * <template>
2599
+ * <div v-virtual-list="{ items: largeList, itemSize: 50 }"></div>
2600
+ *
2601
+ * <div v-virtual-list="{
2602
+ * items: largeList,
2603
+ * itemSize: (index) => index % 10 === 0 ? 100 : 50,
2604
+ * height: 600,
2605
+ * overscan: 5,
2606
+ * render: (item, index) => `<div class="item">${item.name}</div>`
2607
+ * }"></div>
2608
+ * </template>
2609
+ * ```
2610
+ */
2611
+ declare const vVirtualList: Directive;
2612
+ export { vVirtualList }
2613
+ export { vVirtualList as virtualList }
2614
+
2128
2615
  /**
2129
2616
  * v-visible directive
2130
2617
  *
@@ -2141,4 +2628,108 @@ declare const vVisible: Directive;
2141
2628
  export { vVisible }
2142
2629
  export { vVisible as visible }
2143
2630
 
2631
+ /**
2632
+ * v-watermark directive
2633
+ *
2634
+ * Adds a watermark layer to an element.
2635
+ *
2636
+ * @example
2637
+ * ```vue
2638
+ * <template>
2639
+ * <!-- Simple watermark -->
2640
+ * <div v-watermark="'Confidential'">Protected content</div>
2641
+ *
2642
+ * <!-- Multi-line watermark -->
2643
+ * <div v-watermark="{ content: ['Company Name', 'User: John'] }">
2644
+ * Protected content
2645
+ * </div>
2646
+ *
2647
+ * <!-- Customized watermark -->
2648
+ * <div v-watermark="{
2649
+ * content: 'DRAFT',
2650
+ * fontSize: 24,
2651
+ * color: 'rgba(255, 0, 0, 0.2)',
2652
+ * rotate: -30,
2653
+ * gap: 50
2654
+ * }">
2655
+ * Draft document
2656
+ * </div>
2657
+ * </template>
2658
+ * ```
2659
+ */
2660
+ declare const vWatermark: Directive;
2661
+ export { vWatermark }
2662
+ export { vWatermark as watermark }
2663
+
2664
+ /**
2665
+ * Directive binding value type
2666
+ */
2667
+ export declare type WatermarkBinding = string | WatermarkOptions;
2668
+
2669
+ /**
2670
+ * Watermark options
2671
+ */
2672
+ export declare interface WatermarkOptions {
2673
+ /**
2674
+ * Watermark text content
2675
+ * @required
2676
+ */
2677
+ content: string | string[];
2678
+ /**
2679
+ * Width of watermark canvas
2680
+ * @default 300
2681
+ */
2682
+ width?: number;
2683
+ /**
2684
+ * Height of watermark canvas
2685
+ * @default 200
2686
+ */
2687
+ height?: number;
2688
+ /**
2689
+ * Rotation angle in degrees
2690
+ * @default -22
2691
+ */
2692
+ rotate?: number;
2693
+ /**
2694
+ * Font size in pixels
2695
+ * @default 16
2696
+ */
2697
+ fontSize?: number;
2698
+ /**
2699
+ * Font family
2700
+ * @default 'sans-serif'
2701
+ */
2702
+ fontFamily?: string;
2703
+ /**
2704
+ * Font weight
2705
+ * @default 'normal'
2706
+ */
2707
+ fontWeight?: string | number;
2708
+ /**
2709
+ * Font color
2710
+ * @default 'rgba(128, 128, 128, 0.15)'
2711
+ */
2712
+ color?: string;
2713
+ /**
2714
+ * Gap between watermarks in pixels
2715
+ * @default [100, 100]
2716
+ */
2717
+ gap?: [number, number] | number;
2718
+ /**
2719
+ * Z-index of watermark layer
2720
+ * @default 9999
2721
+ */
2722
+ zIndex?: number;
2723
+ /**
2724
+ * Whether to disable watermark (for dynamic control)
2725
+ * @default false
2726
+ */
2727
+ disabled?: boolean;
2728
+ /**
2729
+ * Whether to prevent removal attempts
2730
+ * @default true
2731
+ */
2732
+ protect?: boolean;
2733
+ }
2734
+
2144
2735
  export { }