@desource/phone-mask-nuxt 1.1.2 → 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/CHANGELOG.md +58 -0
- package/README.md +44 -23
- package/dist/module.d.mts +2 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +12 -3
- package/dist/runtime/shared.d.ts +2 -1
- package/dist/runtime/shared.js +2 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @desource/phone-mask-nuxt
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Core Upgrades:
|
|
8
|
+
- Improved process keydown event handler for browser autocomplete cases
|
|
9
|
+
|
|
10
|
+
- Vue Upgrades:
|
|
11
|
+
- Added new `@desource/phone-mask-vue/core` subpath export (direct core helpers re-export)
|
|
12
|
+
- Root `PMaskHelpers` facade removed from index (helpers now via `/core` to reduce bundle size impact for Vue users)
|
|
13
|
+
- Added `id` and `name` props on `PhoneInput`, passed to underlying `<input>` element for better form integration and accessibility
|
|
14
|
+
- Added autofill style normalization (`-webkit-autofill` / `-moz-autofill`) for better visual consistency
|
|
15
|
+
|
|
16
|
+
- React Upgrades:
|
|
17
|
+
- Added new `@desource/phone-mask-react/core` subpath export (direct core helpers re-export)
|
|
18
|
+
- Root `PMaskHelpers` facade removed from index (helpers now via `/core` to reduce bundle size impact for React users)
|
|
19
|
+
- Added `id` and `name` props on `PhoneInput`, passed to underlying `<input>` element for better form integration and accessibility
|
|
20
|
+
- Added autofill style normalization (`-webkit-autofill` / `-moz-autofill`) for better visual consistency
|
|
21
|
+
- `useCountrySelector`, `useClipboard` internals stabilized (deps/callback consistency improvements)
|
|
22
|
+
- `usePhoneMask` callback dependency tuning for better stability
|
|
23
|
+
|
|
24
|
+
- Svelte Upgrades:
|
|
25
|
+
- Added new `@desource/phone-mask-svelte/core` subpath export (direct core helpers re-export)
|
|
26
|
+
- Root `PMaskHelpers` facade removed from index (helpers now via `/core` to reduce bundle size impact for Svelte users)
|
|
27
|
+
- Added `id` and `name` props on `PhoneInput`, passed to underlying `<input>` element for better form integration and accessibility
|
|
28
|
+
- Added autofill style normalization (`-webkit-autofill` / `-moz-autofill`) for better visual consistency
|
|
29
|
+
|
|
30
|
+
- Nuxt Upgrades:
|
|
31
|
+
- Module options expanded and clarified:
|
|
32
|
+
- `types` (default `true`): auto-import types from packages for TypeScript users
|
|
33
|
+
- `helpers` (default `false`): auto-import core helpers for direct usage in Nuxt apps (optional due to potential bundle size impact)
|
|
34
|
+
- new: `composable` (default `false`): auto-import Vue composable for custom phone mask logic (optional for users who only need more custom solution than the provided component/directive)
|
|
35
|
+
- Default auto-imports now focus on component/directive/types; helpers/composable are opt-in
|
|
36
|
+
- Runtime shared exports updated:
|
|
37
|
+
- `usePhoneMask` (composable) is now a separate export from `phoneMaskDirective` and `PhoneInput` component for more flexible usage patterns
|
|
38
|
+
- `PMaskHelpers` sourced via `@desource/phone-mask-vue/core` for better tree-shaking and bundle size control
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies []:
|
|
43
|
+
- @desource/phone-mask-vue@1.3.0
|
|
44
|
+
|
|
45
|
+
## 1.2.0
|
|
46
|
+
|
|
47
|
+
### Minor Changes
|
|
48
|
+
|
|
49
|
+
- Core Upgrades:
|
|
50
|
+
- Core metadata minification redesigned for better performance and reliability
|
|
51
|
+
- Breaking changes (minor impact):
|
|
52
|
+
- Core mask shape normalized: `mask` is now always `string[]` (no `string | string[]` union) across core types/exports
|
|
53
|
+
- `toArray` removed from all packages
|
|
54
|
+
- Formatter edge case fixed: countries with no mask variants are now handled safely (`maxDigits = 0` path)
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies []:
|
|
59
|
+
- @desource/phone-mask-vue@1.2.0
|
|
60
|
+
|
|
3
61
|
## 1.1.2
|
|
4
62
|
|
|
5
63
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Drop-in Nuxt module with auto-imports, SSR support, and zero configuration.
|
|
|
10
10
|
## ✨ Features
|
|
11
11
|
|
|
12
12
|
- 🎯 **Zero Config** — Works out of the box
|
|
13
|
-
- 🔄 **Auto-imports** —
|
|
13
|
+
- 🔄 **Auto-imports** — Component, directive, and types by default
|
|
14
14
|
- 🌐 **SSR Compatible** — Server-side rendering ready
|
|
15
15
|
- 🎨 **Styleable** — Bring your own styles or use defaults
|
|
16
16
|
- 🔧 **TypeScript** — Fully typed
|
|
@@ -36,7 +36,8 @@ export default defineNuxtConfig({
|
|
|
36
36
|
});
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
That's it! The component and
|
|
39
|
+
That's it! The component, directive, and related mask types are now auto-imported.
|
|
40
|
+
You can additionally enable helper/composable auto-imports via module options.
|
|
40
41
|
|
|
41
42
|
## 📖 Usage
|
|
42
43
|
|
|
@@ -129,8 +130,26 @@ export default defineNuxtConfig({
|
|
|
129
130
|
// Register v-phone-mask directive
|
|
130
131
|
directive: true, // Default: true
|
|
131
132
|
|
|
132
|
-
// Register
|
|
133
|
-
|
|
133
|
+
// Register mask-related TypeScript types
|
|
134
|
+
types: true, // Default: true
|
|
135
|
+
|
|
136
|
+
// Register shared helper namespace + directive helper
|
|
137
|
+
helpers: false, // Default: false
|
|
138
|
+
|
|
139
|
+
// Register usePhoneMask composable
|
|
140
|
+
composable: false // Default: false
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Enable Helpers and Composable Auto-imports
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
export default defineNuxtConfig({
|
|
149
|
+
modules: ['@desource/phone-mask-nuxt'],
|
|
150
|
+
phoneMask: {
|
|
151
|
+
helpers: true,
|
|
152
|
+
composable: true
|
|
134
153
|
}
|
|
135
154
|
});
|
|
136
155
|
```
|
|
@@ -243,7 +262,7 @@ export const useUserStore = defineStore('user', {
|
|
|
243
262
|
|
|
244
263
|
actions: {
|
|
245
264
|
setPhoneDigits(phone: string) {
|
|
246
|
-
this.
|
|
265
|
+
this.phoneDigits = phone;
|
|
247
266
|
},
|
|
248
267
|
|
|
249
268
|
setCountry(id: string) {
|
|
@@ -324,7 +343,7 @@ const phone = ref('');
|
|
|
324
343
|
|
|
325
344
|
## 🎯 Auto-imports
|
|
326
345
|
|
|
327
|
-
|
|
346
|
+
By default (without extra options), Nuxt auto-imports:
|
|
328
347
|
|
|
329
348
|
### Components
|
|
330
349
|
|
|
@@ -334,22 +353,23 @@ The following are automatically imported (until disabled in nuxt.config.ts):
|
|
|
334
353
|
|
|
335
354
|
- `vPhoneMask` — Phone mask directive
|
|
336
355
|
|
|
337
|
-
###
|
|
356
|
+
### Types
|
|
357
|
+
|
|
358
|
+
- `PCountryKey`
|
|
359
|
+
- `PMaskBase`, `PMaskBaseMap`
|
|
360
|
+
- `PMask`, `PMaskMap`
|
|
361
|
+
- `PMaskWithFlag`, `PMaskWithFlagMap`
|
|
362
|
+
- `PMaskFull`, `PMaskFullMap`
|
|
363
|
+
- `PMaskPhoneNumber`
|
|
338
364
|
|
|
339
|
-
|
|
340
|
-
- `PMaskHelpers` — Utility functions for phone masks like:
|
|
341
|
-
- `getFlagEmoji`
|
|
342
|
-
- `countPlaceholders`
|
|
343
|
-
- `formatDigitsWithMap`
|
|
344
|
-
- `pickMaskVariant`
|
|
345
|
-
- `removeCountryCodePrefix`
|
|
346
|
-
- And more...
|
|
365
|
+
Enable `phoneMask.helpers: true` to auto-import:
|
|
347
366
|
|
|
348
|
-
|
|
367
|
+
- `vPhoneMaskSetCountry` — Programmatically set country for directive
|
|
368
|
+
- `PMaskHelpers` — Utility functions from `@desource/phone-mask-vue/core`
|
|
349
369
|
|
|
350
|
-
|
|
370
|
+
Enable `phoneMask.composable: true` to auto-import:
|
|
351
371
|
|
|
352
|
-
|
|
372
|
+
- `usePhoneMask`
|
|
353
373
|
|
|
354
374
|
## 🔄 Migration from Vue Plugin
|
|
355
375
|
|
|
@@ -378,11 +398,12 @@ No changes needed in your components!
|
|
|
378
398
|
|
|
379
399
|
## 📦 What's Included
|
|
380
400
|
|
|
381
|
-
- `PhoneInput` component (auto-imported)
|
|
382
|
-
- `vPhoneMask` directive (auto-imported)
|
|
383
|
-
-
|
|
384
|
-
-
|
|
385
|
-
-
|
|
401
|
+
- `PhoneInput` component (auto-imported by default)
|
|
402
|
+
- `vPhoneMask` directive (auto-imported by default)
|
|
403
|
+
- Mask-related TypeScript types (auto-imported by default)
|
|
404
|
+
- Default styles (auto-imported by default, can be disabled)
|
|
405
|
+
- `vPhoneMaskSetCountry` and `PMaskHelpers` (optional via `phoneMask.helpers`)
|
|
406
|
+
- `usePhoneMask` (optional via `phoneMask.composable`)
|
|
386
407
|
|
|
387
408
|
## 🔗 Related
|
|
388
409
|
|
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -12,7 +12,9 @@ const module$1 = defineNuxtModule({
|
|
|
12
12
|
css: true,
|
|
13
13
|
component: true,
|
|
14
14
|
directive: true,
|
|
15
|
-
|
|
15
|
+
types: true,
|
|
16
|
+
helpers: false,
|
|
17
|
+
composable: false
|
|
16
18
|
},
|
|
17
19
|
async setup(options, nuxt) {
|
|
18
20
|
const { resolve } = createResolver(import.meta.url);
|
|
@@ -26,12 +28,19 @@ const module$1 = defineNuxtModule({
|
|
|
26
28
|
addPlugin(resolve(runtimeDir, "plugin.phone-mask"));
|
|
27
29
|
}
|
|
28
30
|
});
|
|
31
|
+
const shared = resolve(runtimeDir, "shared");
|
|
29
32
|
if (options.helpers) {
|
|
30
|
-
const shared = resolve(runtimeDir, "shared");
|
|
31
33
|
addImports([
|
|
32
34
|
{ name: "vPhoneMaskSetCountry", from: shared },
|
|
33
35
|
{ name: "PMaskHelpers", from: shared },
|
|
34
|
-
{ name: "vPhoneMask", from: shared }
|
|
36
|
+
{ name: "vPhoneMask", from: shared }
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
if (options.composable) {
|
|
40
|
+
addImports({ name: "usePhoneMask", from: shared });
|
|
41
|
+
}
|
|
42
|
+
if (options.types) {
|
|
43
|
+
addImports([
|
|
35
44
|
{ name: "PCountryKey", from: shared, type: true },
|
|
36
45
|
{ name: "PMaskBase", from: shared, type: true },
|
|
37
46
|
{ name: "PMaskBaseMap", from: shared, type: true },
|
package/dist/runtime/shared.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * as PMaskHelpers from '@desource/phone-mask-vue/core';
|
|
2
|
+
export { vPhoneMaskSetCountry, vPhoneMask, usePhoneMask, type PCountryKey, type PMaskBase, type PMaskBaseMap, type PMask, type PMaskMap, type PMaskWithFlag, type PMaskWithFlagMap, type PMaskFull, type PMaskFullMap, type PMaskPhoneNumber } from '@desource/phone-mask-vue';
|
package/dist/runtime/shared.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@desource/phone-mask-nuxt",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "🎯 Zero-config Nuxt module for international phone masking. Powered by @desource/phone-mask with Google libphonenumber sync.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"vue": "^3.4.33"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@desource/phone-mask-vue": "1.
|
|
57
|
+
"@desource/phone-mask-vue": "1.3.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@nuxt/kit": "^4.4.2",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@nuxt/test-utils": "^4.0.0",
|
|
63
63
|
"nuxt": "^4.4.2",
|
|
64
64
|
"vite": "7.3.1",
|
|
65
|
-
"vue": "^3.5.
|
|
65
|
+
"vue": "^3.5.31"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"dev:prepare": "nuxt prepare",
|