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/README.md CHANGED
@@ -10,7 +10,7 @@ A comprehensive, easy-to-use, and high-performance Vue custom directives library
10
10
 
11
11
  ## Features
12
12
 
13
- - 🎯 **Comprehensive** - 33 commonly used directives
13
+ - 🎯 **Comprehensive** - 42 commonly used directives
14
14
  - 🔄 **Vue 2/3 Compatible** - Single codebase supports both Vue 2 and Vue 3
15
15
  - 📦 **Tree-shakable** - Import only what you need
16
16
  - 🔒 **TypeScript** - Full TypeScript support with type definitions
@@ -118,11 +118,14 @@ Vue.directive('click-outside', vClickOutside)
118
118
  | Directive | Description | SSR |
119
119
  |-----------|-------------|-----|
120
120
  | `v-click-outside` | Detect clicks outside an element | ❌ |
121
+ | `v-click-delay` | Delay click execution to prevent double clicks | ✅ |
121
122
  | `v-debounce` | Debounce event handlers | ✅ |
122
123
  | `v-throttle` | Throttle event handlers | ✅ |
123
124
  | `v-long-press` | Detect long press events | ❌ |
124
125
  | `v-hover` | Hover state detection | ❌ |
126
+ | `v-hotkey` | Keyboard shortcut binding | ✅ |
125
127
  | `v-touch` | Touch gesture detection (swipe, pinch, rotate) | ❌ |
128
+ | `v-swipe` | Swipe gesture detection with mouse support | ❌ |
126
129
 
127
130
  ### Form Directives
128
131
 
@@ -134,6 +137,7 @@ Vue.directive('click-outside', vClickOutside)
134
137
  | `v-trim` | Trim input whitespace | ✅ |
135
138
  | `v-money` | Currency format input | ❌ |
136
139
  | `v-number` | Number format input | ❌ |
140
+ | `v-ellipsis` | Text ellipsis overflow | ✅ |
137
141
 
138
142
  ### Format Directives
139
143
 
@@ -160,6 +164,8 @@ Vue.directive('click-outside', vClickOutside)
160
164
  | `v-scroll` | Scroll event handling | ❌ |
161
165
  | `v-infinite-scroll` | Infinite scrolling | ❌ |
162
166
  | `v-sticky` | Sticky positioning | ❌ |
167
+ | `v-pull-refresh` | Pull to refresh functionality | ❌ |
168
+ | `v-virtual-list` | Virtual list for large datasets | ❌ |
163
169
 
164
170
  ### Security Directives
165
171
 
@@ -188,6 +194,9 @@ Vue.directive('click-outside', vClickOutside)
188
194
  |-----------|-------------|-----|
189
195
  | `v-tooltip` | Tooltip component | ❌ |
190
196
  | `v-image-preview` | Image preview with zoom | ❌ |
197
+ | `v-countdown` | Countdown timer display | ✅ |
198
+ | `v-print` | Print element content | ❌ |
199
+ | `v-watermark` | Watermark overlay | ✅ |
191
200
 
192
201
  > ✅ = SSR compatible | ❌ = Not SSR compatible
193
202
 
@@ -530,6 +539,191 @@ Number format input.
530
539
  </template>
531
540
  ```
532
541
 
542
+ ### v-click-delay
543
+
544
+ Delay click execution to prevent double clicks.
545
+
546
+ ```vue
547
+ <template>
548
+ <!-- Default: 300ms delay -->
549
+ <button v-click-delay="handleClick">Click me</button>
550
+
551
+ <!-- Custom delay time -->
552
+ <button v-click-delay="{ handler: handleClick, delay: 500 }">500ms delay</button>
553
+ </template>
554
+
555
+ <script setup>
556
+ function handleClick() {
557
+ console.log('Clicked (delayed)')
558
+ }
559
+ </script>
560
+ ```
561
+
562
+ ### v-countdown
563
+
564
+ Countdown timer display.
565
+
566
+ ```vue
567
+ <template>
568
+ <!-- Simple usage -->
569
+ <span v-countdown="{ time: 60 }"></span>
570
+
571
+ <!-- With callbacks -->
572
+ <span v-countdown="{ time: 60, onTick: handleTick, onComplete: handleComplete }"></span>
573
+
574
+ <!-- Custom format -->
575
+ <span v-countdown="{ time: 3600, format: 'mm:ss' }"></span>
576
+ </template>
577
+
578
+ <script setup>
579
+ function handleTick(remaining) {
580
+ console.log('Remaining:', remaining)
581
+ }
582
+
583
+ function handleComplete() {
584
+ console.log('Countdown complete!')
585
+ }
586
+ </script>
587
+ ```
588
+
589
+ ### v-ellipsis
590
+
591
+ Text ellipsis overflow with tooltip.
592
+
593
+ ```vue
594
+ <template>
595
+ <!-- Simple usage -->
596
+ <div v-ellipsis style="width: 200px;">Long text that will be truncated</div>
597
+
598
+ <!-- With custom lines -->
599
+ <div v-ellipsis="{ lines: 2 }">Multi-line text with ellipsis</div>
600
+ </template>
601
+ ```
602
+
603
+ ### v-hotkey
604
+
605
+ Keyboard shortcut binding.
606
+
607
+ ```vue
608
+ <template>
609
+ <!-- Simple usage -->
610
+ <div v-hotkey="{ 'ctrl+s': handleSave, 'ctrl+c': handleCopy }">
611
+ Press Ctrl+S to save
612
+ </div>
613
+
614
+ <!-- With modifiers -->
615
+ <input v-hotkey="{ 'enter': submit, 'escape': cancel }" />
616
+ </template>
617
+
618
+ <script setup>
619
+ function handleSave() {
620
+ console.log('Saving...')
621
+ }
622
+
623
+ function handleCopy() {
624
+ console.log('Copying...')
625
+ }
626
+ </script>
627
+ ```
628
+
629
+ ### v-print
630
+
631
+ Print element content.
632
+
633
+ ```vue
634
+ <template>
635
+ <!-- Simple usage -->
636
+ <button v-print="printRef">Print</button>
637
+ <div ref="printRef">Content to print</div>
638
+
639
+ <!-- Print self -->
640
+ <div v-print="{ self: true }">Click to print this content</div>
641
+ </template>
642
+ ```
643
+
644
+ ### v-pull-refresh
645
+
646
+ Pull to refresh functionality.
647
+
648
+ ```vue
649
+ <template>
650
+ <div v-pull-refresh="handleRefresh" style="height: 400px; overflow: auto;">
651
+ Pull down to refresh
652
+ </div>
653
+
654
+ <!-- With options -->
655
+ <div v-pull-refresh="{ handler: handleRefresh, threshold: 80, disabled: false }">
656
+ Content
657
+ </div>
658
+ </template>
659
+
660
+ <script setup>
661
+ async function handleRefresh() {
662
+ // Fetch new data
663
+ await fetchData()
664
+ }
665
+ </script>
666
+ ```
667
+
668
+ ### v-swipe
669
+
670
+ Swipe gesture detection with mouse support.
671
+
672
+ ```vue
673
+ <template>
674
+ <div v-swipe="handleSwipe" style="height: 200px;">
675
+ Swipe in any direction
676
+ </div>
677
+
678
+ <!-- With options -->
679
+ <div v-swipe="{ onSwipe: handleSwipe, threshold: 50, enableMouse: true }">
680
+ Swipe or drag with mouse
681
+ </div>
682
+ </template>
683
+
684
+ <script setup>
685
+ function handleSwipe(direction) {
686
+ console.log('Swiped:', direction) // 'left', 'right', 'up', 'down'
687
+ }
688
+ </script>
689
+ ```
690
+
691
+ ### v-virtual-list
692
+
693
+ Virtual list for rendering large datasets efficiently.
694
+
695
+ ```vue
696
+ <template>
697
+ <div v-virtual-list="{ items: list, itemSize: 50 }" style="height: 500px;">
698
+ <template #default="{ item, index }">
699
+ <div :key="index">{{ item.name }}</div>
700
+ </template>
701
+ </div>
702
+ </template>
703
+
704
+ <script setup>
705
+ const list = Array.from({ length: 10000 }, (_, i) => ({ id: i, name: `Item ${i}` }))
706
+ </script>
707
+ ```
708
+
709
+ ### v-watermark
710
+
711
+ Watermark overlay.
712
+
713
+ ```vue
714
+ <template>
715
+ <!-- Simple usage -->
716
+ <div v-watermark="'Confidential'" style="width: 100%; height: 400px;">
717
+ Protected content
718
+ </div>
719
+
720
+ <!-- With options -->
721
+ <div v-watermark="{ content: 'Draft', fontSize: 16, color: '#ccc', rotate: -20 }">
722
+ Content with watermark
723
+ </div>
724
+ </template>
725
+ ```
726
+
533
727
  ## API Reference
534
728
 
535
729
  ### DirectiveInstallOptions