use-mask-input 3.10.0 → 3.10.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/dist/antd.cjs +12 -12
- package/dist/antd.js +1 -1
- package/dist/chunk-PMBRAXS4.cjs +5876 -0
- package/dist/chunk-PMBRAXS4.cjs.map +1 -0
- package/dist/chunk-XSTQDKDU.js +5866 -0
- package/dist/chunk-XSTQDKDU.js.map +1 -0
- package/dist/index.cjs +27 -27
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/antd/useMaskInputAntd.spec.tsx +2 -2
- package/src/api/useHookFormMask.spec.ts +2 -2
- package/src/api/useMaskInput.spec.tsx +2 -2
- package/src/api/withHookFormMask.spec.ts +2 -2
- package/src/api/withMask.spec.ts +2 -2
- package/src/api/withMask.ts +1 -1
- package/src/api/withTanStackFormMask.spec.ts +2 -2
- package/src/core/inputmask.spec.ts +21 -0
- package/src/core/inputmask.ts +10 -0
- package/src/core/maskEngine.spec.ts +2 -2
- package/src/core/maskEngine.ts +2 -2
- package/src/utils/maskHelpers.ts +5 -3
- package/dist/chunk-DTC7JTZP.cjs +0 -3925
- package/dist/chunk-DTC7JTZP.cjs.map +0 -1
- package/dist/chunk-TVCNC3TP.js +0 -3915
- package/dist/chunk-TVCNC3TP.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
## [3.6.0](https://github.com/eduardoborges/use-mask-input/compare/3.5.2...3.6.0) (2026-01-13)
|
|
2
2
|
|
|
3
|
+
## 3.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 135a733: Import Inputmask from its ESM source modules instead of the default UMD entrypoint. This keeps the existing APIs and bundled dependency behavior while avoiding the legacy Inputmask build in published artifacts.
|
|
8
|
+
|
|
9
|
+
In a Next.js reproduction using `use-mask-input/antd`, the Inputmask client chunk dropped from 125.13 kB to 92.84 kB raw, 36.75 kB to 28.89 kB gzip, and 31.86 kB to 25.91 kB brotli. That is a final reduction of 32.29 kB raw, 7.86 kB gzip, and 5.96 kB brotli for the affected client chunk.
|
|
10
|
+
|
|
11
|
+
The modern build no longer includes the legacy UMD/polyfill patterns reported by Lighthouse, including `String.prototype.includes`, `Array.prototype.includes`, `Object.entries =`, `Cannot call a class as a function`, and `inputmask/dist/inputmask.js`.
|
|
12
|
+
|
|
3
13
|
## 3.10.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/dist/antd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPMBRAXS4_cjs = require('./chunk-PMBRAXS4.cjs');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
|
|
6
6
|
function useHookFormMaskAntd(registerFn) {
|
|
@@ -10,11 +10,11 @@ function useHookFormMaskAntd(registerFn) {
|
|
|
10
10
|
if (!registerFn) throw new Error("registerFn is required");
|
|
11
11
|
const registerReturn = registerFn(fieldName, options);
|
|
12
12
|
const { ref } = registerReturn;
|
|
13
|
-
const cacheKey =
|
|
13
|
+
const cacheKey = chunkPMBRAXS4_cjs.makeMaskCacheKey(fieldName, mask);
|
|
14
14
|
if (!refCache.has(cacheKey)) {
|
|
15
15
|
const refWithMask = (inputRef) => {
|
|
16
|
-
const element = inputRef ?
|
|
17
|
-
if (element)
|
|
16
|
+
const element = inputRef ? chunkPMBRAXS4_cjs.resolveInputRef(inputRef.input) : null;
|
|
17
|
+
if (element) chunkPMBRAXS4_cjs.applyMaskToElement(element, mask, options);
|
|
18
18
|
if (ref) ref(element);
|
|
19
19
|
};
|
|
20
20
|
refCache.set(cacheKey, refWithMask);
|
|
@@ -23,7 +23,7 @@ function useHookFormMaskAntd(registerFn) {
|
|
|
23
23
|
...registerReturn,
|
|
24
24
|
ref: refCache.get(cacheKey)
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
chunkPMBRAXS4_cjs.setPrevRef(result, ref);
|
|
27
27
|
return result;
|
|
28
28
|
};
|
|
29
29
|
}, [registerFn]);
|
|
@@ -34,7 +34,7 @@ function useMaskInputAntd(props) {
|
|
|
34
34
|
const maskRef = react.useRef(mask);
|
|
35
35
|
const optionsRef = react.useRef(options);
|
|
36
36
|
const maskedElementRef = react.useRef(null);
|
|
37
|
-
const unmaskedValue = react.useCallback(() =>
|
|
37
|
+
const unmaskedValue = react.useCallback(() => chunkPMBRAXS4_cjs.getUnmaskedValue(ref.current), []);
|
|
38
38
|
maskRef.current = mask;
|
|
39
39
|
optionsRef.current = options;
|
|
40
40
|
const refCallback = react.useCallback((input) => {
|
|
@@ -42,22 +42,22 @@ function useMaskInputAntd(props) {
|
|
|
42
42
|
ref.current = null;
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
ref.current =
|
|
45
|
+
ref.current = chunkPMBRAXS4_cjs.resolveInputRef(input.input);
|
|
46
46
|
if (ref.current && ref.current !== maskedElementRef.current) {
|
|
47
|
-
|
|
47
|
+
chunkPMBRAXS4_cjs.withMask(maskRef.current, optionsRef.current)(ref.current);
|
|
48
48
|
maskedElementRef.current = ref.current;
|
|
49
49
|
}
|
|
50
50
|
}, []);
|
|
51
51
|
react.useEffect(() => {
|
|
52
|
-
if (
|
|
52
|
+
if (chunkPMBRAXS4_cjs.isServer_default || !ref.current || !register) return;
|
|
53
53
|
register(ref.current);
|
|
54
54
|
}, [register]);
|
|
55
|
-
if (
|
|
55
|
+
if (chunkPMBRAXS4_cjs.isServer_default) {
|
|
56
56
|
const noop = (() => {
|
|
57
57
|
});
|
|
58
|
-
return
|
|
58
|
+
return chunkPMBRAXS4_cjs.setUnmaskedValue(noop, () => "");
|
|
59
59
|
}
|
|
60
|
-
return
|
|
60
|
+
return chunkPMBRAXS4_cjs.setUnmaskedValue(refCallback, unmaskedValue);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
exports.useHookFormMaskAntd = useHookFormMaskAntd;
|
package/dist/antd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makeMaskCacheKey, setPrevRef, getUnmaskedValue, resolveInputRef, withMask, isServer_default, setUnmaskedValue, applyMaskToElement } from './chunk-
|
|
1
|
+
import { makeMaskCacheKey, setPrevRef, getUnmaskedValue, resolveInputRef, withMask, isServer_default, setUnmaskedValue, applyMaskToElement } from './chunk-XSTQDKDU.js';
|
|
2
2
|
import { useMemo, useRef, useCallback, useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
function useHookFormMaskAntd(registerFn) {
|