directix 1.1.0 → 1.2.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,12 +10,13 @@ A comprehensive, easy-to-use, and high-performance Vue custom directives library
10
10
 
11
11
  ## Features
12
12
 
13
- - 🎯 **Comprehensive** - 21+ commonly used directives
13
+ - 🎯 **Comprehensive** - 33 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
17
- - 🚀 **SSR Friendly** - 7 directives support SSR out of the box
17
+ - 🚀 **SSR Friendly** - Multiple directives support SSR out of the box
18
18
  - 📦 **Multiple Formats** - ESM, CJS, and IIFE (CDN) formats available
19
+ - ⚡ **Zero Dependencies** - Lightweight with minimal bundle size
19
20
 
20
21
  ## Online Demo
21
22
 
@@ -114,60 +115,81 @@ Vue.directive('click-outside', vClickOutside)
114
115
 
115
116
  ### Event Directives
116
117
 
117
- | Directive | Description | SSR | Status |
118
- |-----------|-------------|-----|--------|
119
- | `v-click-outside` | Detect clicks outside an element | ❌ | ✅ |
120
- | `v-debounce` | Debounce event handlers | ✅ | ✅ |
121
- | `v-throttle` | Throttle event handlers | ✅ | ✅ |
122
- | `v-long-press` | Detect long press events | ❌ | ✅ |
118
+ | Directive | Description | SSR |
119
+ |-----------|-------------|-----|
120
+ | `v-click-outside` | Detect clicks outside an element | ❌ |
121
+ | `v-debounce` | Debounce event handlers | ✅ |
122
+ | `v-throttle` | Throttle event handlers | ✅ |
123
+ | `v-long-press` | Detect long press events | ❌ |
124
+ | `v-hover` | Hover state detection | ❌ |
125
+ | `v-touch` | Touch gesture detection (swipe, pinch, rotate) | ❌ |
123
126
 
124
127
  ### Form Directives
125
128
 
126
- | Directive | Description | SSR | Status |
127
- |-----------|-------------|-----|--------|
128
- | `v-copy` | Copy text to clipboard | ❌ | ✅ |
129
- | `v-focus` | Auto focus an element | ✅ | ✅ |
130
- | `v-mask` | Input masking | ❌ | ✅ |
129
+ | Directive | Description | SSR |
130
+ |-----------|-------------|-----|
131
+ | `v-copy` | Copy text to clipboard | ❌ |
132
+ | `v-focus` | Auto focus an element | ✅ |
133
+ | `v-mask` | Input masking | ❌ |
134
+ | `v-trim` | Trim input whitespace | ✅ |
135
+ | `v-money` | Currency format input | ❌ |
136
+ | `v-number` | Number format input | ❌ |
137
+
138
+ ### Format Directives
139
+
140
+ | Directive | Description | SSR |
141
+ |-----------|-------------|-----|
142
+ | `v-uppercase` | Convert text to uppercase | ✅ |
143
+ | `v-lowercase` | Convert text to lowercase | ✅ |
144
+ | `v-capitalcase` | Capitalize first letter | ✅ |
145
+ | `v-truncate` | Truncate text with ellipsis | ✅ |
131
146
 
132
147
  ### Visibility Directives
133
148
 
134
- | Directive | Description | SSR | Status |
135
- |-----------|-------------|-----|--------|
136
- | `v-lazy` | Lazy load images | ❌ | ✅ |
137
- | `v-intersect` | Detect element intersection | ❌ | ✅ |
138
- | `v-visible` | Control element visibility | ✅ | ✅ |
139
- | `v-loading` | Show loading overlay | ✅ | ✅ |
149
+ | Directive | Description | SSR |
150
+ |-----------|-------------|-----|
151
+ | `v-lazy` | Lazy load images | ❌ |
152
+ | `v-intersect` | Detect element intersection | ❌ |
153
+ | `v-visible` | Control element visibility | ✅ |
154
+ | `v-loading` | Show loading overlay | ✅ |
140
155
 
141
156
  ### Scroll Directives
142
157
 
143
- | Directive | Description | SSR | Status |
144
- |-----------|-------------|-----|--------|
145
- | `v-scroll` | Scroll event handling | ❌ | ✅ |
146
- | `v-infinite-scroll` | Infinite scrolling | ❌ | ✅ |
147
- | `v-sticky` | Sticky positioning | ❌ | ✅ |
158
+ | Directive | Description | SSR |
159
+ |-----------|-------------|-----|
160
+ | `v-scroll` | Scroll event handling | ❌ |
161
+ | `v-infinite-scroll` | Infinite scrolling | ❌ |
162
+ | `v-sticky` | Sticky positioning | ❌ |
148
163
 
149
164
  ### Security Directives
150
165
 
151
- | Directive | Description | SSR | Status |
152
- |-----------|-------------|-----|--------|
153
- | `v-permission` | Permission-based element control | ✅ | ✅ |
154
- | `v-sanitize` | Sanitize HTML content | ✅ | ✅ |
166
+ | Directive | Description | SSR |
167
+ |-----------|-------------|-----|
168
+ | `v-permission` | Permission-based element control | ✅ |
169
+ | `v-sanitize` | Sanitize HTML content | ✅ |
155
170
 
156
171
  ### Effect Directives
157
172
 
158
- | Directive | Description | SSR | Status |
159
- |-----------|-------------|-----|--------|
160
- | `v-hover` | Hover state detection | ❌ | ✅ |
161
- | `v-ripple` | Material design ripple effect | ❌ | ✅ |
173
+ | Directive | Description | SSR |
174
+ |-----------|-------------|-----|
175
+ | `v-ripple` | Material design ripple effect | ❌ |
176
+ | `v-draggable` | Make elements draggable | ❌ |
162
177
 
163
178
  ### Observer Directives
164
179
 
165
- | Directive | Description | SSR | Status |
166
- |-----------|-------------|-----|--------|
167
- | `v-resize` | Element resize observer | ❌ | ✅ |
168
- | `v-mutation` | DOM mutation observer | ❌ | ✅ |
180
+ | Directive | Description | SSR |
181
+ |-----------|-------------|-----|
182
+ | `v-resize` | Element resize observer | ❌ |
183
+ | `v-mutation` | DOM mutation observer | ❌ |
184
+
185
+ ### UI Directives
169
186
 
170
- > = Available | ❌ = Not SSR compatible
187
+ | Directive | Description | SSR |
188
+ |-----------|-------------|-----|
189
+ | `v-tooltip` | Tooltip component | ❌ |
190
+ | `v-image-preview` | Image preview with zoom | ❌ |
191
+
192
+ > ✅ = SSR compatible | ❌ = Not SSR compatible
171
193
 
172
194
  ## Usage Examples
173
195
 
@@ -382,6 +404,132 @@ Sanitize HTML content to prevent XSS attacks.
382
404
  </template>
383
405
  ```
384
406
 
407
+ ### v-tooltip
408
+
409
+ Display tooltips on hover or click.
410
+
411
+ ```vue
412
+ <template>
413
+ <!-- Simple usage -->
414
+ <button v-tooltip="'Tooltip content'">Hover me</button>
415
+
416
+ <!-- With options -->
417
+ <button v-tooltip="{ content: 'Tooltip', placement: 'bottom', trigger: 'click' }">
418
+ Click me
419
+ </button>
420
+ </template>
421
+ ```
422
+
423
+ ### v-image-preview
424
+
425
+ Preview images with zoom and gesture support.
426
+
427
+ ```vue
428
+ <template>
429
+ <!-- Simple usage -->
430
+ <img v-image-preview src="thumbnail.jpg" data-preview="full.jpg" />
431
+
432
+ <!-- With options -->
433
+ <img v-image-preview="{ src: 'thumbnail.jpg', previewSrc: 'full.jpg', enablePinchZoom: true }" />
434
+ </template>
435
+ ```
436
+
437
+ ### v-draggable
438
+
439
+ Make elements draggable.
440
+
441
+ ```vue
442
+ <template>
443
+ <!-- Simple usage -->
444
+ <div v-draggable>Drag me</div>
445
+
446
+ <!-- With constraints -->
447
+ <div v-draggable="{ axis: 'x', bounds: 'parent' }">Horizontal drag only</div>
448
+ </template>
449
+ ```
450
+
451
+ ### v-uppercase / v-lowercase / v-capitalcase
452
+
453
+ Transform text case.
454
+
455
+ ```vue
456
+ <template>
457
+ <input v-uppercase placeholder="Auto uppercase" />
458
+ <input v-lowercase placeholder="Auto lowercase" />
459
+ <input v-capitalcase placeholder="Capitalize first letter" />
460
+ </template>
461
+ ```
462
+
463
+ ### v-truncate
464
+
465
+ Truncate text with ellipsis.
466
+
467
+ ```vue
468
+ <template>
469
+ <!-- Simple usage -->
470
+ <p v-truncate="50">Long text here...</p>
471
+
472
+ <!-- With options -->
473
+ <p v-truncate="{ length: 100, suffix: '...', position: 'end' }">Long text...</p>
474
+ </template>
475
+ ```
476
+
477
+ ### v-touch
478
+
479
+ Detect touch gestures.
480
+
481
+ ```vue
482
+ <template>
483
+ <div v-touch="{ onSwipe: handleSwipe, onPinch: handlePinch }">
484
+ Swipe or pinch here
485
+ </div>
486
+ </template>
487
+
488
+ <script setup>
489
+ function handleSwipe(direction) {
490
+ console.log('Swiped:', direction) // 'left', 'right', 'up', 'down'
491
+ }
492
+
493
+ function handlePinch(scale) {
494
+ console.log('Pinched:', scale)
495
+ }
496
+ </script>
497
+ ```
498
+
499
+ ### v-trim
500
+
501
+ Trim input whitespace.
502
+
503
+ ```vue
504
+ <template>
505
+ <!-- Trim on blur (default) -->
506
+ <input v-trim />
507
+
508
+ <!-- Trim on input -->
509
+ <input v-trim="{ position: 'both', event: 'input' }" />
510
+ </template>
511
+ ```
512
+
513
+ ### v-money
514
+
515
+ Currency format input.
516
+
517
+ ```vue
518
+ <template>
519
+ <input v-money="{ prefix: '$', precision: 2 }" placeholder="Enter amount" />
520
+ </template>
521
+ ```
522
+
523
+ ### v-number
524
+
525
+ Number format input.
526
+
527
+ ```vue
528
+ <template>
529
+ <input v-number="{ precision: 2, min: 0, max: 100 }" placeholder="Enter number" />
530
+ </template>
531
+ ```
532
+
385
533
  ## API Reference
386
534
 
387
535
  ### DirectiveInstallOptions