@desource/phone-mask-nuxt 1.3.0 β 1.4.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 +36 -0
- package/README.md +86 -1
- package/dist/module.json +1 -1
- package/package.json +6 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @desource/phone-mask-nuxt
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Core Upgrades:
|
|
8
|
+
- Added `@desource/phone-mask/kit` subpath for formatter, handlers, services, utilities, and shared country selector helpers
|
|
9
|
+
- Root `@desource/phone-mask` now focuses on country mask entries/data. Helper, formatter, handler, service, and utility imports should use `@desource/phone-mask/kit`
|
|
10
|
+
- Added shared country selector DOM, positioning, keyboard, and focus helpers used by framework packages
|
|
11
|
+
|
|
12
|
+
- Vue/React/Svelte Upgrades:
|
|
13
|
+
- Rebuilt the country selector dropdown with stable body-rendered fixed positioning using Portal/Teleport patterns
|
|
14
|
+
- Improved dropdown UX across desktop and mobile: viewport-aware above/below placement, body-level rendering, outside-click close, Escape close, focus restore, search keyboard navigation, and empty-results keyboard safety
|
|
15
|
+
- Improved dropdown accessibility semantics by exposing the selector popup as a searchable dialog with listbox options
|
|
16
|
+
- Aligned country selector behavior and tests across React, Vue, and Svelte through shared common/core helpers
|
|
17
|
+
|
|
18
|
+
- React Upgrades:
|
|
19
|
+
- Simplified internal memoization and callback usage where it reduced bundle/runtime overhead without changing behavior
|
|
20
|
+
|
|
21
|
+
- Svelte Upgrades:
|
|
22
|
+
- Cleaned up event listener and attachment typings for newer Svelte/TypeScript tooling
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies []:
|
|
27
|
+
- @desource/phone-mask-vue@1.4.0
|
|
28
|
+
|
|
29
|
+
## 1.3.1
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Core Upgrades:
|
|
34
|
+
- Sync country masks with google-libphonenumber (πΈπ° Slovakia updates)
|
|
35
|
+
|
|
36
|
+
- Updated dependencies []:
|
|
37
|
+
- @desource/phone-mask-vue@1.3.1
|
|
38
|
+
|
|
3
39
|
## 1.3.0
|
|
4
40
|
|
|
5
41
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -110,6 +110,91 @@ const handleChange = (nextPhone: PMaskPhoneNumber) => {
|
|
|
110
110
|
</script>
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
### SSR + Auto-imports in Practice
|
|
114
|
+
|
|
115
|
+
`@desource/phone-mask-nuxt` is SSR-safe: the module config is evaluated on server, while the UI component is registered in client mode.
|
|
116
|
+
|
|
117
|
+
```vue
|
|
118
|
+
<script setup lang="ts">
|
|
119
|
+
const phone = ref('');
|
|
120
|
+
const valid = ref(false);
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<template>
|
|
124
|
+
<!-- Auto-imported: no explicit component import required -->
|
|
125
|
+
<PhoneInput id="phone" name="phone" v-model="phone" country="US" @validation-change="valid = $event" />
|
|
126
|
+
|
|
127
|
+
<p v-if="valid">β Ready to submit</p>
|
|
128
|
+
</template>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Backend Payload (Raw Digits)
|
|
132
|
+
|
|
133
|
+
```vue
|
|
134
|
+
<script setup lang="ts">
|
|
135
|
+
import type { PMaskPhoneNumber } from '#imports';
|
|
136
|
+
|
|
137
|
+
const phoneDigits = ref('');
|
|
138
|
+
|
|
139
|
+
const handlePhoneChange = async (phone: PMaskPhoneNumber) => {
|
|
140
|
+
await $fetch('/api/profile/phone', {
|
|
141
|
+
method: 'POST',
|
|
142
|
+
body: {
|
|
143
|
+
phoneDigits: phone.digits, // unformatted value for backend
|
|
144
|
+
phoneFull: phone.full // optional full number with country code
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<template>
|
|
151
|
+
<PhoneInput v-model="phoneDigits" country="US" @change="handlePhoneChange" />
|
|
152
|
+
</template>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Auto-importing Helpers + Composable
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
// nuxt.config.ts
|
|
159
|
+
export default defineNuxtConfig({
|
|
160
|
+
modules: ['@desource/phone-mask-nuxt'],
|
|
161
|
+
phoneMask: {
|
|
162
|
+
// Disable auto-imported styles, component, and directive if you don't need them
|
|
163
|
+
css: false,
|
|
164
|
+
component: false,
|
|
165
|
+
directive: false,
|
|
166
|
+
// And enable only needed auto-imports
|
|
167
|
+
helpers: true,
|
|
168
|
+
composable: true
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Then use them directly in SFCs without manual imports:
|
|
174
|
+
|
|
175
|
+
```vue
|
|
176
|
+
<script setup lang="ts">
|
|
177
|
+
const value = ref('');
|
|
178
|
+
const selectedCountry = ref('US');
|
|
179
|
+
|
|
180
|
+
const { inputRef, setCountry } = usePhoneMask({
|
|
181
|
+
value,
|
|
182
|
+
onChange: (digits) => (value.value = digits),
|
|
183
|
+
country: selectedCountry
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const setGermany = () => {
|
|
187
|
+
setCountry('DE');
|
|
188
|
+
};
|
|
189
|
+
</script>
|
|
190
|
+
|
|
191
|
+
<template>
|
|
192
|
+
<input ref="inputRef" type="tel" />
|
|
193
|
+
<button @click="setGermany">Use Germany</button>
|
|
194
|
+
<p>Code for DE: {{ PMaskHelpers.MasksMap.DE.code }}</p>
|
|
195
|
+
</template>
|
|
196
|
+
```
|
|
197
|
+
|
|
113
198
|
## βοΈ Configuration
|
|
114
199
|
|
|
115
200
|
### Module Options
|
|
@@ -365,7 +450,7 @@ By default (without extra options), Nuxt auto-imports:
|
|
|
365
450
|
Enable `phoneMask.helpers: true` to auto-import:
|
|
366
451
|
|
|
367
452
|
- `vPhoneMaskSetCountry` β Programmatically set country for directive
|
|
368
|
-
- `PMaskHelpers` β
|
|
453
|
+
- `PMaskHelpers` β Core kit utilities and mask data from `@desource/phone-mask-vue/core`
|
|
369
454
|
|
|
370
455
|
Enable `phoneMask.composable: true` to auto-import:
|
|
371
456
|
|
package/dist/module.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@desource/phone-mask-nuxt",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.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,15 +54,14 @@
|
|
|
54
54
|
"vue": "^3.4.33"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@desource/phone-mask-vue": "1.
|
|
57
|
+
"@desource/phone-mask-vue": "1.4.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@nuxt/kit": "^4.4.
|
|
60
|
+
"@nuxt/kit": "^4.4.4",
|
|
61
61
|
"@nuxt/module-builder": "^1.0.2",
|
|
62
|
-
"@nuxt/test-utils": "^4.0.
|
|
63
|
-
"nuxt": "^4.4.
|
|
64
|
-
"
|
|
65
|
-
"vue": "^3.5.31"
|
|
62
|
+
"@nuxt/test-utils": "^4.0.3",
|
|
63
|
+
"nuxt": "^4.4.4",
|
|
64
|
+
"vue": "^3.5.34"
|
|
66
65
|
},
|
|
67
66
|
"scripts": {
|
|
68
67
|
"dev:prepare": "nuxt prepare",
|