directix 1.8.0 → 1.9.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
@@ -21,6 +21,139 @@ A comprehensive, easy-to-use, and high-performance Vue custom directives library
21
21
  - ⚡ **Zero Dependencies** - Lightweight with minimal bundle size
22
22
  - 🎨 **Composables** - Every directive has a corresponding composable for Composition API
23
23
  - 🔧 **Utility Exports** - Export `configurePermission`, `getPermissionConfig` and other utilities for advanced usage
24
+ - 🌐 **i18n Support** - Built-in internationalization with Chinese, English, and Japanese translations
25
+ - 🔌 **Plugin System** - Extensible plugin architecture for community contributions
26
+
27
+ ## What's New in v1.9.0
28
+
29
+ ### Internationalization (i18n)
30
+
31
+ Full i18n support for directive messages and documentation.
32
+
33
+ ```typescript
34
+ import { createI18n, setLocale } from 'directix'
35
+
36
+ // Initialize with locale
37
+ createI18n({
38
+ locale: 'en-US',
39
+ fallbackLocale: 'en-US',
40
+ messages: { 'en-US': enUS, 'zh-CN': zhCN, 'ja-JP': jaJP }
41
+ })
42
+
43
+ // Switch locale at runtime
44
+ setLocale('zh-CN')
45
+ ```
46
+
47
+ ### Unified Warning System
48
+
49
+ Improved developer experience with structured error messages.
50
+
51
+ ```typescript
52
+ import { warn, directiveWarn, assertType } from 'directix'
53
+
54
+ // Directive-specific warnings
55
+ directiveWarn('debounce', 'errors.invalid_wait', { wait: 'abc' })
56
+
57
+ // Type assertions
58
+ assertType<number>(value, 'number', 'debounce', 'wait')
59
+ ```
60
+
61
+ ### Plugin System
62
+
63
+ Extensible plugin architecture for community contributions.
64
+
65
+ ```typescript
66
+ import { definePlugin, getPluginManager } from 'directix'
67
+
68
+ const myPlugin = definePlugin({
69
+ meta: { name: 'my-plugin', version: '1.0.0' },
70
+ install(ctx) {
71
+ ctx.registerDirective('my-directive', vMyDirective)
72
+ }
73
+ })
74
+
75
+ getPluginManager().register(myPlugin)
76
+ ```
77
+
78
+ ### Community Plugin Registry
79
+
80
+ Discover and install community plugins programmatically.
81
+
82
+ ```typescript
83
+ import { getPluginRegistry } from 'directix'
84
+
85
+ const registry = getPluginRegistry()
86
+
87
+ // Search plugins
88
+ const results = await registry.search('animation')
89
+
90
+ // Get all plugins
91
+ const plugins = await registry.getAll()
92
+
93
+ // Install a plugin
94
+ await registry.install('directix-animate', manager)
95
+ ```
96
+
97
+ ### Timezone & Locale Utilities
98
+
99
+ Region-specific formatting for dates, numbers, and currencies.
100
+
101
+ ```typescript
102
+ import { getTimezoneInfo, formatDateLocale, formatCurrencyLocale } from 'directix'
103
+
104
+ // Get timezone info
105
+ const tz = getTimezoneInfo() // { id: 'Asia/Shanghai', offset: 8, ... }
106
+
107
+ // Format date by locale
108
+ formatDateLocale(new Date()) // Auto-detects user locale
109
+
110
+ // Format currency
111
+ formatCurrencyLocale(99.99) // '$99.99' (US) or '99,99€' (DE)
112
+ ```
113
+
114
+ ### Vue DevTools Integration
115
+
116
+ Debug directives directly in Vue DevTools.
117
+
118
+ ```typescript
119
+ import { enableDevtools, trackDirective } from 'directix'
120
+
121
+ // Enable DevTools integration
122
+ enableDevtools()
123
+
124
+ // Track directive usage
125
+ trackDirective('debounce', { element: 'input' })
126
+ ```
127
+
128
+ ### Performance Monitoring
129
+
130
+ Measure directive performance with detailed metrics.
131
+
132
+ ```typescript
133
+ import { enablePerformance, getPerformanceReport } from 'directix'
134
+
135
+ // Enable monitoring
136
+ enablePerformance()
137
+
138
+ // Get performance report
139
+ const report = getPerformanceReport()
140
+ // [{ name: 'debounce', mount: { p50: 0.5ms, p95: 1.2ms }, ... }]
141
+ ```
142
+
143
+ ### Scenario Examples
144
+
145
+ 10+ real-world examples demonstrating directive combinations:
146
+
147
+ - **Form Validation** - v-debounce, v-mask, v-trim, v-focus
148
+ - **Permission Management** - v-permission, v-click-outside
149
+ - **Image Gallery** - v-lazy, v-image-preview, v-swipe
150
+ - **Infinite Scroll** - v-infinite-scroll, v-virtual-list, v-loading
151
+ - **Rich Text Editor** - v-sanitize, v-highlight, v-emoji
152
+ - **Gesture Interaction** - v-touch, v-swipe, v-pan, v-pinch
153
+ - **Data Visualization** - v-progress, v-counter, v-countdown
154
+ - **Drag & Sort** - v-draggable, v-intersect
155
+ - **Print & Export** - v-print, v-export
156
+ - **Fullscreen Media** - v-fullscreen, v-lottie
24
157
 
25
158
  ## Online Demo
26
159