@desource/phone-mask-nuxt 1.3.0 β 1.3.1
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 +10 -0
- package/README.md +85 -0
- package/dist/module.json +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @desource/phone-mask-nuxt
|
|
2
2
|
|
|
3
|
+
## 1.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Core Upgrades:
|
|
8
|
+
- Sync country masks with google-libphonenumber (πΈπ° Slovakia updates)
|
|
9
|
+
|
|
10
|
+
- Updated dependencies []:
|
|
11
|
+
- @desource/phone-mask-vue@1.3.1
|
|
12
|
+
|
|
3
13
|
## 1.3.0
|
|
4
14
|
|
|
5
15
|
### 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
|
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.
|
|
3
|
+
"version": "1.3.1",
|
|
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,15 @@
|
|
|
54
54
|
"vue": "^3.4.33"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@desource/phone-mask-vue": "1.3.
|
|
57
|
+
"@desource/phone-mask-vue": "1.3.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@nuxt/kit": "^4.4.2",
|
|
61
61
|
"@nuxt/module-builder": "^1.0.2",
|
|
62
|
-
"@nuxt/test-utils": "^4.0.
|
|
62
|
+
"@nuxt/test-utils": "^4.0.2",
|
|
63
63
|
"nuxt": "^4.4.2",
|
|
64
64
|
"vite": "7.3.1",
|
|
65
|
-
"vue": "^3.5.
|
|
65
|
+
"vue": "^3.5.33"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"dev:prepare": "nuxt prepare",
|