vue-directives-pro 1.0.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/LICENSE +21 -0
- package/README.md +273 -0
- package/dist/index.cjs.js +4605 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +1458 -0
- package/dist/index.esm.js +4505 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/nuxt.cjs +27 -0
- package/dist/nuxt.cjs.map +1 -0
- package/dist/nuxt.mjs +22 -0
- package/dist/nuxt.mjs.map +1 -0
- package/dist/runtime/plugin.mjs +6 -0
- package/dist/types/directives/animate-on-scroll.d.ts +19 -0
- package/dist/types/directives/aria.d.ts +20 -0
- package/dist/types/directives/auto-aria-label.d.ts +9 -0
- package/dist/types/directives/auto-layout.d.ts +21 -0
- package/dist/types/directives/auto-poll.d.ts +18 -0
- package/dist/types/directives/auto-submit.d.ts +19 -0
- package/dist/types/directives/autogrow.d.ts +15 -0
- package/dist/types/directives/click-outside.d.ts +11 -0
- package/dist/types/directives/clickable-area.d.ts +14 -0
- package/dist/types/directives/color-mode.d.ts +17 -0
- package/dist/types/directives/copy.d.ts +18 -0
- package/dist/types/directives/count-up.d.ts +21 -0
- package/dist/types/directives/cpu-aware.d.ts +20 -0
- package/dist/types/directives/csp-nonce.d.ts +8 -0
- package/dist/types/directives/cursor-follow.d.ts +21 -0
- package/dist/types/directives/debounce.d.ts +19 -0
- package/dist/types/directives/dom-diff-highlight.d.ts +17 -0
- package/dist/types/directives/drag-scroll.d.ts +18 -0
- package/dist/types/directives/drag-sort.d.ts +22 -0
- package/dist/types/directives/draggable.d.ts +33 -0
- package/dist/types/directives/element-query.d.ts +23 -0
- package/dist/types/directives/enter-submit.d.ts +13 -0
- package/dist/types/directives/escape.d.ts +12 -0
- package/dist/types/directives/feature-flag.d.ts +5 -0
- package/dist/types/directives/focus-trap.d.ts +10 -0
- package/dist/types/directives/focus-visible.d.ts +19 -0
- package/dist/types/directives/focus.d.ts +10 -0
- package/dist/types/directives/format-number.d.ts +14 -0
- package/dist/types/directives/fps-monitor.d.ts +18 -0
- package/dist/types/directives/gesture.d.ts +26 -0
- package/dist/types/directives/highlight.d.ts +20 -0
- package/dist/types/directives/hotkey.d.ts +17 -0
- package/dist/types/directives/hover-class.d.ts +14 -0
- package/dist/types/directives/hydrate-on-visible.d.ts +12 -0
- package/dist/types/directives/idle.d.ts +20 -0
- package/dist/types/directives/in-view.d.ts +20 -0
- package/dist/types/directives/index.d.ts +89 -0
- package/dist/types/directives/intent-hover.d.ts +29 -0
- package/dist/types/directives/intersection.d.ts +14 -0
- package/dist/types/directives/lazy-load.d.ts +20 -0
- package/dist/types/directives/loading.d.ts +20 -0
- package/dist/types/directives/longpress.d.ts +19 -0
- package/dist/types/directives/magnetic.d.ts +20 -0
- package/dist/types/directives/mask.d.ts +19 -0
- package/dist/types/directives/max-length.d.ts +20 -0
- package/dist/types/directives/measure-render.d.ts +13 -0
- package/dist/types/directives/motion.d.ts +20 -0
- package/dist/types/directives/network-aware.d.ts +22 -0
- package/dist/types/directives/numeric.d.ts +19 -0
- package/dist/types/directives/outside-focus.d.ts +9 -0
- package/dist/types/directives/parallax.d.ts +18 -0
- package/dist/types/directives/permission.d.ts +9 -0
- package/dist/types/directives/persist.d.ts +18 -0
- package/dist/types/directives/prefetch.d.ts +13 -0
- package/dist/types/directives/preload-image.d.ts +13 -0
- package/dist/types/directives/press.d.ts +20 -0
- package/dist/types/directives/prevent-double-click.d.ts +13 -0
- package/dist/types/directives/render-if-visible.d.ts +17 -0
- package/dist/types/directives/render-on-idle.d.ts +15 -0
- package/dist/types/directives/resize-observer.d.ts +25 -0
- package/dist/types/directives/ripple.d.ts +18 -0
- package/dist/types/directives/safe-link.d.ts +8 -0
- package/dist/types/directives/sanitize.d.ts +18 -0
- package/dist/types/directives/scroll-progress.d.ts +14 -0
- package/dist/types/directives/scroll-to.d.ts +20 -0
- package/dist/types/directives/select-all.d.ts +7 -0
- package/dist/types/directives/skeleton.d.ts +22 -0
- package/dist/types/directives/smart-click.d.ts +19 -0
- package/dist/types/directives/smart-mount.d.ts +19 -0
- package/dist/types/directives/smart-prefetch.d.ts +20 -0
- package/dist/types/directives/smart-scroll-lock.d.ts +13 -0
- package/dist/types/directives/stagger.d.ts +20 -0
- package/dist/types/directives/sticky.d.ts +20 -0
- package/dist/types/directives/suspend.d.ts +12 -0
- package/dist/types/directives/swipe.d.ts +27 -0
- package/dist/types/directives/sync-broadcast.d.ts +18 -0
- package/dist/types/directives/sync-query.d.ts +13 -0
- package/dist/types/directives/sync-storage.d.ts +19 -0
- package/dist/types/directives/tab-guard.d.ts +12 -0
- package/dist/types/directives/text-transform.d.ts +17 -0
- package/dist/types/directives/throttle.d.ts +20 -0
- package/dist/types/directives/tilt.d.ts +23 -0
- package/dist/types/directives/timeago.d.ts +19 -0
- package/dist/types/directives/tooltip.d.ts +20 -0
- package/dist/types/directives/trim.d.ts +11 -0
- package/dist/types/directives/truncate.d.ts +19 -0
- package/dist/types/directives/trusted-html.d.ts +8 -0
- package/dist/types/directives/validate.d.ts +24 -0
- package/dist/types/directives/virtual-scroll.d.ts +19 -0
- package/dist/types/directives/visible.d.ts +8 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/nuxt.d.ts +5 -0
- package/dist/types/plugin.d.ts +9 -0
- package/package.json +93 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kerolos Zakaria
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# vue-directives-pro
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>86+ Vue 3 & Nuxt 3/4 custom directives</strong><br/>
|
|
5
|
+
Fully typed · Tree-shakable · Plugin or individual imports
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://www.npmjs.com/package/vue-directives-pro"><img src="https://img.shields.io/npm/v/vue-directives-pro.svg?color=42b883" alt="npm version"></a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/vue-directives-pro"><img src="https://img.shields.io/npm/dm/vue-directives-pro.svg?color=42b883" alt="npm downloads"></a>
|
|
11
|
+
<a href="https://github.com/keroloszakaria/vue-directives-pro/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/vue-directives-pro.svg" alt="license"></a>
|
|
12
|
+
<img src="https://img.shields.io/badge/vue-3.2%2B-42b883" alt="vue 3.2+">
|
|
13
|
+
<img src="https://img.shields.io/badge/nuxt-3%20%7C%204-00dc82" alt="nuxt 3 | 4">
|
|
14
|
+
<img src="https://img.shields.io/badge/TypeScript-strict-blue" alt="TypeScript">
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install vue-directives-pro
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn add vue-directives-pro
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add vue-directives-pro
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> **Requirements:** Vue 3.2+
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
### Vue 3 — Register All
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { createApp } from "vue";
|
|
43
|
+
import VueDirectivesPlugin from "vue-directives-pro";
|
|
44
|
+
|
|
45
|
+
const app = createApp(App);
|
|
46
|
+
app.use(VueDirectivesPlugin);
|
|
47
|
+
app.mount("#app");
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Vue 3 — Register Specific Only
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
app.use(VueDirectivesPlugin, {
|
|
54
|
+
directives: ["click-outside", "tooltip", "ripple", "lazy-load"],
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Vue 3 — Individual (Tree-shakable)
|
|
59
|
+
|
|
60
|
+
```vue
|
|
61
|
+
<script setup>
|
|
62
|
+
import { vClickOutside, vTooltip } from "vue-directives-pro";
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<template>
|
|
66
|
+
<div v-click-outside="close">
|
|
67
|
+
<button v-tooltip="'Save'">💾</button>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Nuxt 3 / Nuxt 4
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
// nuxt.config.ts
|
|
76
|
+
export default defineNuxtConfig({
|
|
77
|
+
modules: ["vue-directives-pro/nuxt"],
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
All directives are registered globally — no imports needed. SSR-safe (client-only).
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## All Directives
|
|
86
|
+
|
|
87
|
+
### UI & Interaction
|
|
88
|
+
|
|
89
|
+
| Directive | Description |
|
|
90
|
+
| ------------------------ | ----------------------------------------- |
|
|
91
|
+
| `v-click-outside` | Detect clicks outside an element |
|
|
92
|
+
| `v-longpress` | Trigger handler on long press / hold |
|
|
93
|
+
| `v-press` | Unified press event (mouse + touch) |
|
|
94
|
+
| `v-smart-click` | Debounced click with loading state |
|
|
95
|
+
| `v-prevent-double-click` | Disable button after click for N ms |
|
|
96
|
+
| `v-clickable-area` | Expand clickable area beyond bounds |
|
|
97
|
+
| `v-ripple` | Material Design ripple effect |
|
|
98
|
+
| `v-tooltip` | Show tooltip on hover |
|
|
99
|
+
| `v-hover-class` | Add/remove class on hover |
|
|
100
|
+
| `v-intent-hover` | Hover with intent delay |
|
|
101
|
+
| `v-draggable` | Make element draggable |
|
|
102
|
+
| `v-drag-scroll` | Drag to scroll container |
|
|
103
|
+
| `v-drag-sort` | Drag-and-drop sorting |
|
|
104
|
+
| `v-swipe` | Detect swipe gestures |
|
|
105
|
+
| `v-gesture` | Multi-gesture recognition (pinch, rotate) |
|
|
106
|
+
| `v-hotkey` | Keyboard shortcuts |
|
|
107
|
+
| `v-escape` | Fire callback on Escape key |
|
|
108
|
+
| `v-cursor-follow` | Element follows cursor |
|
|
109
|
+
| `v-magnetic` | Magnetic attraction to cursor |
|
|
110
|
+
|
|
111
|
+
### Form & Input
|
|
112
|
+
|
|
113
|
+
| Directive | Description |
|
|
114
|
+
| ----------------------------- | ---------------------------- |
|
|
115
|
+
| `v-debounce` | Debounce an event handler |
|
|
116
|
+
| `v-throttle` | Throttle an event handler |
|
|
117
|
+
| `v-focus` | Auto-focus on mount |
|
|
118
|
+
| `v-select-all` | Select all text on focus |
|
|
119
|
+
| `v-mask` | Input mask (`###-###-####`) |
|
|
120
|
+
| `v-numeric` | Allow only numeric input |
|
|
121
|
+
| `v-uppercase` / `v-lowercase` | Auto-transform text casing |
|
|
122
|
+
| `v-trim` | Auto-trim whitespace on blur |
|
|
123
|
+
| `v-autogrow` | Auto-resize textarea |
|
|
124
|
+
| `v-max-length` | Visual character counter |
|
|
125
|
+
| `v-validate` | Inline validation rules |
|
|
126
|
+
| `v-enter-submit` | Submit on Enter key |
|
|
127
|
+
| `v-auto-submit` | Auto-submit after delay |
|
|
128
|
+
| `v-format-number` | Format numbers with locale |
|
|
129
|
+
|
|
130
|
+
### Scroll & Viewport
|
|
131
|
+
|
|
132
|
+
| Directive | Description |
|
|
133
|
+
| --------------------- | --------------------------------- |
|
|
134
|
+
| `v-scroll-to` | Smooth scroll to target on click |
|
|
135
|
+
| `v-scroll-progress` | Track scroll progress (0–1) |
|
|
136
|
+
| `v-sticky` | Sticky positioning with offset |
|
|
137
|
+
| `v-parallax` | Parallax scroll effect |
|
|
138
|
+
| `v-in-view` | Callbacks on enter/leave viewport |
|
|
139
|
+
| `v-intersection` | IntersectionObserver wrapper |
|
|
140
|
+
| `v-lazy-load` | Lazy load images |
|
|
141
|
+
| `v-virtual-scroll` | Virtual scrolling for large lists |
|
|
142
|
+
| `v-smart-scroll-lock` | Smart body scroll locking |
|
|
143
|
+
|
|
144
|
+
### Animation & Visual
|
|
145
|
+
|
|
146
|
+
| Directive | Description |
|
|
147
|
+
| --------------------- | ----------------------------------- |
|
|
148
|
+
| `v-animate-on-scroll` | CSS animation on scroll into view |
|
|
149
|
+
| `v-motion` | Declarative enter/leave transitions |
|
|
150
|
+
| `v-stagger` | Staggered children animations |
|
|
151
|
+
| `v-tilt` | 3D tilt hover effect |
|
|
152
|
+
| `v-count-up` | Animated number counting |
|
|
153
|
+
| `v-loading` | Loading overlay / spinner |
|
|
154
|
+
| `v-skeleton` | Skeleton placeholder |
|
|
155
|
+
| `v-visible` | Toggle visibility (keeps layout) |
|
|
156
|
+
| `v-highlight` | Highlight search keywords in text |
|
|
157
|
+
| `v-truncate` | Truncate text with ellipsis |
|
|
158
|
+
| `v-color-mode` | Dark/light mode classes |
|
|
159
|
+
|
|
160
|
+
### Data & State
|
|
161
|
+
|
|
162
|
+
| Directive | Description |
|
|
163
|
+
| ------------------ | ------------------------------------- |
|
|
164
|
+
| `v-copy` | Copy text to clipboard |
|
|
165
|
+
| `v-persist` | Persist element state to storage |
|
|
166
|
+
| `v-sync-query` | Sync input value with URL query |
|
|
167
|
+
| `v-sync-storage` | Sync with localStorage/sessionStorage |
|
|
168
|
+
| `v-sync-broadcast` | Sync across tabs via BroadcastChannel |
|
|
169
|
+
| `v-auto-poll` | Auto-polling with interval |
|
|
170
|
+
| `v-timeago` | Relative time display (auto-updating) |
|
|
171
|
+
|
|
172
|
+
### Accessibility
|
|
173
|
+
|
|
174
|
+
| Directive | Description |
|
|
175
|
+
| ------------------- | ------------------------------------------------- |
|
|
176
|
+
| `v-aria` | Set ARIA attributes declaratively |
|
|
177
|
+
| `v-auto-aria-label` | Auto-generate aria-label from content |
|
|
178
|
+
| `v-focus-trap` | Trap focus within element |
|
|
179
|
+
| `v-focus-visible` | Add focus-visible class |
|
|
180
|
+
| `v-tab-guard` | Guard tab navigation boundaries |
|
|
181
|
+
| `v-safe-link` | Add `rel="noopener noreferrer"` to external links |
|
|
182
|
+
|
|
183
|
+
### Security
|
|
184
|
+
|
|
185
|
+
| Directive | Description |
|
|
186
|
+
| ---------------- | ---------------------------------------- |
|
|
187
|
+
| `v-sanitize` | Sanitize HTML content (XSS protection) |
|
|
188
|
+
| `v-trusted-html` | Render trusted HTML via Trusted Types |
|
|
189
|
+
| `v-csp-nonce` | Apply CSP nonce to inline styles/scripts |
|
|
190
|
+
|
|
191
|
+
### Performance
|
|
192
|
+
|
|
193
|
+
| Directive | Description |
|
|
194
|
+
| ---------------------- | ------------------------------------------ |
|
|
195
|
+
| `v-render-if-visible` | Render only when visible |
|
|
196
|
+
| `v-render-on-idle` | Defer rendering to idle time |
|
|
197
|
+
| `v-suspend` | Lazy render with suspense-like behavior |
|
|
198
|
+
| `v-prefetch` | Prefetch links on hover/visibility |
|
|
199
|
+
| `v-preload-image` | Preload images before display |
|
|
200
|
+
| `v-smart-mount` | Mount based on visibility/idle/interaction |
|
|
201
|
+
| `v-smart-prefetch` | Intelligent prefetching strategy |
|
|
202
|
+
| `v-hydrate-on-visible` | Hydrate component when visible |
|
|
203
|
+
| `v-measure-render` | Measure render performance |
|
|
204
|
+
| `v-fps-monitor` | FPS monitoring overlay |
|
|
205
|
+
|
|
206
|
+
### Layout & Responsive
|
|
207
|
+
|
|
208
|
+
| Directive | Description |
|
|
209
|
+
| ------------------- | ---------------------------------------- |
|
|
210
|
+
| `v-element-query` | Element-level responsive breakpoints |
|
|
211
|
+
| `v-auto-layout` | Auto grid/flex layout via ResizeObserver |
|
|
212
|
+
| `v-resize-observer` | Element resize callback |
|
|
213
|
+
|
|
214
|
+
### Device & Environment
|
|
215
|
+
|
|
216
|
+
| Directive | Description |
|
|
217
|
+
| ----------------- | ------------------------------------ |
|
|
218
|
+
| `v-network-aware` | Adapt to network conditions |
|
|
219
|
+
| `v-cpu-aware` | Reduce animations on low-end devices |
|
|
220
|
+
| `v-idle` | Detect user inactivity |
|
|
221
|
+
| `v-outside-focus` | Detect focus leaving element tree |
|
|
222
|
+
|
|
223
|
+
### Authorization
|
|
224
|
+
|
|
225
|
+
| Directive | Description |
|
|
226
|
+
| ---------------- | ---------------------------- |
|
|
227
|
+
| `v-permission` | Role-based show/hide/disable |
|
|
228
|
+
| `v-feature-flag` | Feature flag toggling |
|
|
229
|
+
|
|
230
|
+
### Debug
|
|
231
|
+
|
|
232
|
+
| Directive | Description |
|
|
233
|
+
| ---------------------- | -------------------------------- |
|
|
234
|
+
| `v-dom-diff-highlight` | Flash highlight on DOM mutations |
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Tree Shaking
|
|
239
|
+
|
|
240
|
+
All directives are individually exported. Bundlers like Vite and Webpack automatically tree-shake unused directives:
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
import { vClickOutside, vCopy } from "vue-directives-pro";
|
|
244
|
+
// Only these two are included in the bundle
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## TypeScript
|
|
250
|
+
|
|
251
|
+
Full TypeScript support. All directives are typed as `ObjectDirective` with proper generics.
|
|
252
|
+
|
|
253
|
+
```ts
|
|
254
|
+
import type { VueDirectivesPluginOptions } from "vue-directives-pro";
|
|
255
|
+
|
|
256
|
+
const options: VueDirectivesPluginOptions = {
|
|
257
|
+
directives: ["click-outside", "tooltip"],
|
|
258
|
+
};
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Documentation
|
|
264
|
+
|
|
265
|
+
Full documentation with usage examples for every directive:
|
|
266
|
+
|
|
267
|
+
**[📖 View Documentation](https://vue-directives-pro.surge.sh)**
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## License
|
|
272
|
+
|
|
273
|
+
[MIT](./LICENSE) © [Kerolos Zakaria](https://github.com/keroloszakaria)
|