react-intlayer 5.7.7 → 5.8.0-canary.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 +1 -1
- package/dist/cjs/client/format/index.cjs +50 -0
- package/dist/cjs/client/format/index.cjs.map +1 -0
- package/dist/cjs/client/format/useCompact.cjs +42 -0
- package/dist/cjs/client/format/useCompact.cjs.map +1 -0
- package/dist/cjs/client/format/useCurrency.cjs +42 -0
- package/dist/cjs/client/format/useCurrency.cjs.map +1 -0
- package/dist/cjs/client/format/useDate.cjs +39 -0
- package/dist/cjs/client/format/useDate.cjs.map +1 -0
- package/dist/cjs/client/format/useList.cjs +42 -0
- package/dist/cjs/client/format/useList.cjs.map +1 -0
- package/dist/cjs/client/format/useNumber.cjs +42 -0
- package/dist/cjs/client/format/useNumber.cjs.map +1 -0
- package/dist/cjs/client/format/usePercentage.cjs +42 -0
- package/dist/cjs/client/format/usePercentage.cjs.map +1 -0
- package/dist/cjs/client/format/useRelativeTime.cjs +42 -0
- package/dist/cjs/client/format/useRelativeTime.cjs.map +1 -0
- package/dist/cjs/client/format/useUnit.cjs +42 -0
- package/dist/cjs/client/format/useUnit.cjs.map +1 -0
- package/dist/cjs/client/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +29 -18
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/server/format/index.cjs +50 -0
- package/dist/cjs/server/format/index.cjs.map +1 -0
- package/dist/cjs/server/format/useCompact.cjs +38 -0
- package/dist/cjs/server/format/useCompact.cjs.map +1 -0
- package/dist/cjs/server/format/useCurrency.cjs +38 -0
- package/dist/cjs/server/format/useCurrency.cjs.map +1 -0
- package/dist/cjs/server/format/useDate.cjs +38 -0
- package/dist/cjs/server/format/useDate.cjs.map +1 -0
- package/dist/cjs/server/format/useList.cjs +38 -0
- package/dist/cjs/server/format/useList.cjs.map +1 -0
- package/dist/cjs/server/format/useNumber.cjs +38 -0
- package/dist/cjs/server/format/useNumber.cjs.map +1 -0
- package/dist/cjs/server/format/usePercentage.cjs +38 -0
- package/dist/cjs/server/format/usePercentage.cjs.map +1 -0
- package/dist/cjs/server/format/useRelativeTime.cjs +38 -0
- package/dist/cjs/server/format/useRelativeTime.cjs.map +1 -0
- package/dist/cjs/server/format/useUnit.cjs +38 -0
- package/dist/cjs/server/format/useUnit.cjs.map +1 -0
- package/dist/esm/client/format/index.mjs +19 -0
- package/dist/esm/client/format/index.mjs.map +1 -0
- package/dist/esm/client/format/useCompact.mjs +18 -0
- package/dist/esm/client/format/useCompact.mjs.map +1 -0
- package/dist/esm/client/format/useCurrency.mjs +18 -0
- package/dist/esm/client/format/useCurrency.mjs.map +1 -0
- package/dist/esm/client/format/useDate.mjs +15 -0
- package/dist/esm/client/format/useDate.mjs.map +1 -0
- package/dist/esm/client/format/useList.mjs +18 -0
- package/dist/esm/client/format/useList.mjs.map +1 -0
- package/dist/esm/client/format/useNumber.mjs +18 -0
- package/dist/esm/client/format/useNumber.mjs.map +1 -0
- package/dist/esm/client/format/usePercentage.mjs +18 -0
- package/dist/esm/client/format/usePercentage.mjs.map +1 -0
- package/dist/esm/client/format/useRelativeTime.mjs +18 -0
- package/dist/esm/client/format/useRelativeTime.mjs.map +1 -0
- package/dist/esm/client/format/useUnit.mjs +18 -0
- package/dist/esm/client/format/useUnit.mjs.map +1 -0
- package/dist/esm/client/index.mjs.map +1 -1
- package/dist/esm/index.mjs +14 -12
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/server/format/index.mjs +19 -0
- package/dist/esm/server/format/index.mjs.map +1 -0
- package/dist/esm/server/format/useCompact.mjs +14 -0
- package/dist/esm/server/format/useCompact.mjs.map +1 -0
- package/dist/esm/server/format/useCurrency.mjs +14 -0
- package/dist/esm/server/format/useCurrency.mjs.map +1 -0
- package/dist/esm/server/format/useDate.mjs +14 -0
- package/dist/esm/server/format/useDate.mjs.map +1 -0
- package/dist/esm/server/format/useList.mjs +14 -0
- package/dist/esm/server/format/useList.mjs.map +1 -0
- package/dist/esm/server/format/useNumber.mjs +14 -0
- package/dist/esm/server/format/useNumber.mjs.map +1 -0
- package/dist/esm/server/format/usePercentage.mjs +14 -0
- package/dist/esm/server/format/usePercentage.mjs.map +1 -0
- package/dist/esm/server/format/useRelativeTime.mjs +14 -0
- package/dist/esm/server/format/useRelativeTime.mjs.map +1 -0
- package/dist/esm/server/format/useUnit.mjs +14 -0
- package/dist/esm/server/format/useUnit.mjs.map +1 -0
- package/dist/types/client/format/index.d.ts +9 -0
- package/dist/types/client/format/index.d.ts.map +1 -0
- package/dist/types/client/format/useCompact.d.ts +14 -0
- package/dist/types/client/format/useCompact.d.ts.map +1 -0
- package/dist/types/client/format/useCurrency.d.ts +28 -0
- package/dist/types/client/format/useCurrency.d.ts.map +1 -0
- package/dist/types/client/format/useDate.d.ts +29 -0
- package/dist/types/client/format/useDate.d.ts.map +1 -0
- package/dist/types/client/format/useList.d.ts +25 -0
- package/dist/types/client/format/useList.d.ts.map +1 -0
- package/dist/types/client/format/useNumber.d.ts +26 -0
- package/dist/types/client/format/useNumber.d.ts.map +1 -0
- package/dist/types/client/format/usePercentage.d.ts +22 -0
- package/dist/types/client/format/usePercentage.d.ts.map +1 -0
- package/dist/types/client/format/useRelativeTime.d.ts +23 -0
- package/dist/types/client/format/useRelativeTime.d.ts.map +1 -0
- package/dist/types/client/format/useUnit.d.ts +21 -0
- package/dist/types/client/format/useUnit.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +6 -0
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +12 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/server/format/index.d.ts +9 -0
- package/dist/types/server/format/index.d.ts.map +1 -0
- package/dist/types/server/format/useCompact.d.ts +13 -0
- package/dist/types/server/format/useCompact.d.ts.map +1 -0
- package/dist/types/server/format/useCurrency.d.ts +24 -0
- package/dist/types/server/format/useCurrency.d.ts.map +1 -0
- package/dist/types/server/format/useDate.d.ts +29 -0
- package/dist/types/server/format/useDate.d.ts.map +1 -0
- package/dist/types/server/format/useList.d.ts +21 -0
- package/dist/types/server/format/useList.d.ts.map +1 -0
- package/dist/types/server/format/useNumber.d.ts +25 -0
- package/dist/types/server/format/useNumber.d.ts.map +1 -0
- package/dist/types/server/format/usePercentage.d.ts +21 -0
- package/dist/types/server/format/usePercentage.d.ts.map +1 -0
- package/dist/types/server/format/useRelativeTime.d.ts +21 -0
- package/dist/types/server/format/useRelativeTime.d.ts.map +1 -0
- package/dist/types/server/format/useUnit.d.ts +20 -0
- package/dist/types/server/format/useUnit.d.ts.map +1 -0
- package/package.json +28 -18
package/README.md
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var format_exports = {};
|
|
20
|
+
__export(format_exports, {
|
|
21
|
+
useCompact: () => import_useCompact.useCompact,
|
|
22
|
+
useCurrency: () => import_useCurrency.useCurrency,
|
|
23
|
+
useDate: () => import_useDate.useDate,
|
|
24
|
+
useList: () => import_useList.useList,
|
|
25
|
+
useNumber: () => import_useNumber.useNumber,
|
|
26
|
+
usePercentage: () => import_usePercentage.usePercentage,
|
|
27
|
+
useRelativeTime: () => import_useRelativeTime.useRelativeTime,
|
|
28
|
+
useUnit: () => import_useUnit.useUnit
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(format_exports);
|
|
31
|
+
var import_useCompact = require('./useCompact.cjs');
|
|
32
|
+
var import_useCurrency = require('./useCurrency.cjs');
|
|
33
|
+
var import_useDate = require('./useDate.cjs');
|
|
34
|
+
var import_useList = require('./useList.cjs');
|
|
35
|
+
var import_useNumber = require('./useNumber.cjs');
|
|
36
|
+
var import_usePercentage = require('./usePercentage.cjs');
|
|
37
|
+
var import_useRelativeTime = require('./useRelativeTime.cjs');
|
|
38
|
+
var import_useUnit = require('./useUnit.cjs');
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
useCompact,
|
|
42
|
+
useCurrency,
|
|
43
|
+
useDate,
|
|
44
|
+
useList,
|
|
45
|
+
useNumber,
|
|
46
|
+
usePercentage,
|
|
47
|
+
useRelativeTime,
|
|
48
|
+
useUnit
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/format/index.ts"],"sourcesContent":["export { useCompact } from './useCompact';\nexport { useCurrency } from './useCurrency';\nexport { useDate } from './useDate';\nexport { useList } from './useList';\nexport { useNumber } from './useNumber';\nexport { usePercentage } from './usePercentage';\nexport { useRelativeTime } from './useRelativeTime';\nexport { useUnit } from './useUnit';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA2B;AAC3B,yBAA4B;AAC5B,qBAAwB;AACxB,qBAAwB;AACxB,uBAA0B;AAC1B,2BAA8B;AAC9B,6BAAgC;AAChC,qBAAwB;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var useCompact_exports = {};
|
|
21
|
+
__export(useCompact_exports, {
|
|
22
|
+
useCompact: () => useCompact
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useCompact_exports);
|
|
25
|
+
var import_core = require("@intlayer/core");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_IntlayerProvider = require('../IntlayerProvider.cjs');
|
|
28
|
+
const useCompact = () => {
|
|
29
|
+
const { locale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
|
|
30
|
+
return (0, import_react.useCallback)(
|
|
31
|
+
(...args) => (0, import_core.compact)(args[0], {
|
|
32
|
+
...args[1],
|
|
33
|
+
locale: args[1]?.locale ?? locale
|
|
34
|
+
}),
|
|
35
|
+
[locale]
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
useCompact
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=useCompact.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/format/useCompact.ts"],"sourcesContent":["'use client';\n\nimport { compact } from '@intlayer/core';\nimport { useCallback, useContext } from 'react';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a compact number formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatCompact = useCompact();\n * formatCompact(1500); // \"1.5K\"\n * ```\n */\nexport const useCompact = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAwB;AACxB,mBAAwC;AACxC,8BAAsC;AAY/B,MAAM,aAAa,MAAM;AAC9B,QAAM,EAAE,OAAO,QAAI,yBAAW,6CAAqB;AAEnD,aAAO;AAAA,IACL,IAAI,aACF,qBAAQ,KAAK,CAAC,GAAG;AAAA,MACf,GAAG,KAAK,CAAC;AAAA,MACT,QAAQ,KAAK,CAAC,GAAG,UAAU;AAAA,IAC7B,CAAC;AAAA,IACH,CAAC,MAAM;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var useCurrency_exports = {};
|
|
21
|
+
__export(useCurrency_exports, {
|
|
22
|
+
useCurrency: () => useCurrency
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useCurrency_exports);
|
|
25
|
+
var import_core = require("@intlayer/core");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_IntlayerProvider = require('../IntlayerProvider.cjs');
|
|
28
|
+
const useCurrency = () => {
|
|
29
|
+
const { locale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
|
|
30
|
+
return (0, import_react.useCallback)(
|
|
31
|
+
(...args) => (0, import_core.currency)(args[0], {
|
|
32
|
+
...args[1],
|
|
33
|
+
locale: args[1]?.locale ?? locale
|
|
34
|
+
}),
|
|
35
|
+
[locale]
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
useCurrency
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=useCurrency.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/format/useCurrency.ts"],"sourcesContent":["'use client';\n\nimport { currency } from '@intlayer/core';\nimport { useCallback, useContext } from 'react';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a currency formatter\n * bound to the current application locale.\n *\n * @returns {(value: string | number, options?: CurrencyProps) => string}\n * A function to format numbers into localized currency strings.\n *\n * @example\n * ```tsx\n * const formatCurrency = useCurrency();\n *\n * formatCurrency(1500, { currency: \"USD\" });\n * // \"$1,500.00\"\n *\n * formatCurrency(1500, { currency: \"EUR\", locale: \"de-DE\" });\n * // \"1.500,00 €\"\n *\n * formatCurrency(9876543.21, {\n * currency: \"JPY\",\n * fractionDigits: 0,\n * });\n * // \"¥9,876,543\"\n * ```\n */\nexport const useCurrency = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAyB;AACzB,mBAAwC;AACxC,8BAAsC;AA0B/B,MAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,OAAO,QAAI,yBAAW,6CAAqB;AAEnD,aAAO;AAAA,IACL,IAAI,aACF,sBAAS,KAAK,CAAC,GAAG;AAAA,MAChB,GAAG,KAAK,CAAC;AAAA,MACT,QAAQ,KAAK,CAAC,GAAG,UAAU;AAAA,IAC7B,CAAC;AAAA,IACH,CAAC,MAAM;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var useDate_exports = {};
|
|
21
|
+
__export(useDate_exports, {
|
|
22
|
+
useDate: () => useDate
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useDate_exports);
|
|
25
|
+
var import_core = require("@intlayer/core");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_IntlayerProvider = require('../IntlayerProvider.cjs');
|
|
28
|
+
const useDate = () => {
|
|
29
|
+
const { locale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
|
|
30
|
+
return (...args) => (0, import_core.date)(args[0], {
|
|
31
|
+
...args[1],
|
|
32
|
+
locale: args[1]?.locale ?? locale
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
useDate
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=useDate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/format/useDate.ts"],"sourcesContent":["'use client';\n\nimport { date } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a localized date/time formatter\n * bound to the current application locale.\n *\n * @returns {(date: Date | string | number, options?: DateProps) => string}\n * A function to format dates or timestamps into localized date/time strings.\n *\n * @example\n * ```tsx\n * const formatDate = useDate();\n *\n * formatDate(new Date(\"2025-01-01\"));\n * // \"Jan 1, 2025\"\n *\n * formatDate(\"2025-01-01T15:30:00Z\", {\n * dateStyle: \"full\",\n * timeStyle: \"short\",\n * });\n * // \"Wednesday, January 1, 2025 at 3:30 PM\"\n *\n * formatDate(1735689600000, { locale: \"fr-FR\", dateStyle: \"long\" });\n * // \"1 janvier 2025\"\n * ```\n *\n * @see createDate\n */\nexport const useDate = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return (...args: Parameters<typeof date>) =>\n date(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAqB;AACrB,mBAA2B;AAC3B,8BAAsC;AA4B/B,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,OAAO,QAAI,yBAAW,6CAAqB;AAEnD,SAAO,IAAI,aACT,kBAAK,KAAK,CAAC,GAAG;AAAA,IACZ,GAAG,KAAK,CAAC;AAAA,IACT,QAAQ,KAAK,CAAC,GAAG,UAAU;AAAA,EAC7B,CAAC;AACL;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var useList_exports = {};
|
|
21
|
+
__export(useList_exports, {
|
|
22
|
+
useList: () => useList
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useList_exports);
|
|
25
|
+
var import_core = require("@intlayer/core");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_IntlayerProvider = require('../IntlayerProvider.cjs');
|
|
28
|
+
const useList = () => {
|
|
29
|
+
const { locale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
|
|
30
|
+
return (0, import_react.useCallback)(
|
|
31
|
+
(...args) => (0, import_core.list)(args[0], {
|
|
32
|
+
...args[1],
|
|
33
|
+
locale: args[1]?.locale ?? locale
|
|
34
|
+
}),
|
|
35
|
+
[locale]
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
useList
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=useList.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/format/useList.ts"],"sourcesContent":["'use client';\n\nimport { list } from '@intlayer/core';\nimport { useCallback, useContext } from 'react';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a list formatter\n * bound to the current application locale.\n *\n * @returns {(values: (string | number)[], options?: ListProps) => string}\n * A function to format arrays into localized list strings.\n *\n * @example\n * ```tsx\n * const formatList = useList();\n *\n * formatList(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * formatList(['red', 'green', 'blue'], { type: 'disjunction' });\n * // \"red, green, or blue\"\n *\n * formatList([1, 2, 3], { type: 'unit', locale: 'de-DE' });\n * // \"1, 2 und 3\"\n * ```\n */\nexport const useList = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAqB;AACrB,mBAAwC;AACxC,8BAAsC;AAuB/B,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,OAAO,QAAI,yBAAW,6CAAqB;AAEnD,aAAO;AAAA,IACL,IAAI,aACF,kBAAK,KAAK,CAAC,GAAG;AAAA,MACZ,GAAG,KAAK,CAAC;AAAA,MACT,QAAQ,KAAK,CAAC,GAAG,UAAU;AAAA,IAC7B,CAAC;AAAA,IACH,CAAC,MAAM;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var useNumber_exports = {};
|
|
21
|
+
__export(useNumber_exports, {
|
|
22
|
+
useNumber: () => useNumber
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useNumber_exports);
|
|
25
|
+
var import_core = require("@intlayer/core");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_IntlayerProvider = require('../IntlayerProvider.cjs');
|
|
28
|
+
const useNumber = () => {
|
|
29
|
+
const { locale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
|
|
30
|
+
return (0, import_react.useCallback)(
|
|
31
|
+
(...args) => (0, import_core.number)(args[0], {
|
|
32
|
+
...args[1],
|
|
33
|
+
locale: args[1]?.locale ?? locale
|
|
34
|
+
}),
|
|
35
|
+
[locale]
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
useNumber
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=useNumber.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/format/useNumber.ts"],"sourcesContent":["'use client';\n\nimport { number } from '@intlayer/core';\nimport { useCallback, useContext } from 'react';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a localized number formatter.\n *\n * Uses the current locale from {@link useLocaleBase} and returns\n * a function that can be used to format numbers consistently\n * according to the user's locale.\n *\n * @example\n * ```tsx\n * const formatNumber = useNumber();\n *\n * formatNumber(12345);\n * // e.g. \"12,345\" (en-US)\n * // e.g. \"12 345\" (fr-FR)\n *\n * formatNumber(0.75, { style: \"percent\" });\n * // e.g. \"75%\"\n * ```\n *\n * @returns {(value: string | number, options?: import(\"../createNumber\").NumberProps) => string}\n * A number formatting function bound to the active locale.\n */\nexport const useNumber = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAuB;AACvB,mBAAwC;AACxC,8BAAsC;AAwB/B,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,OAAO,QAAI,yBAAW,6CAAqB;AAEnD,aAAO;AAAA,IACL,IAAI,aACF,oBAAO,KAAK,CAAC,GAAG;AAAA,MACd,GAAG,KAAK,CAAC;AAAA,MACT,QAAQ,KAAK,CAAC,GAAG,UAAU;AAAA,IAC7B,CAAC;AAAA,IACH,CAAC,MAAM;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var usePercentage_exports = {};
|
|
21
|
+
__export(usePercentage_exports, {
|
|
22
|
+
usePercentage: () => usePercentage
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(usePercentage_exports);
|
|
25
|
+
var import_core = require("@intlayer/core");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_IntlayerProvider = require('../IntlayerProvider.cjs');
|
|
28
|
+
const usePercentage = () => {
|
|
29
|
+
const { locale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
|
|
30
|
+
return (0, import_react.useCallback)(
|
|
31
|
+
(...args) => (0, import_core.percentage)(args[0], {
|
|
32
|
+
...args[1],
|
|
33
|
+
locale: args[1]?.locale ?? locale
|
|
34
|
+
}),
|
|
35
|
+
[locale]
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
usePercentage
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=usePercentage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/format/usePercentage.ts"],"sourcesContent":["'use client';\n\nimport { percentage } from '@intlayer/core';\nimport { useCallback, useContext } from 'react';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React hook to provide a percentage formatter function\n * based on the current application locale.\n *\n * This hook retrieves the active locale using {@link useLocaleBase}\n * and memoizes a `createPercentage` instance for that locale.\n *\n * @example\n * ```tsx\n * const formatPercentage = usePercentage();\n *\n * const result = formatPercentage(0.875, { maximumFractionDigits: 1 });\n * // \"87.5%\" (depending on locale)\n * ```\n *\n * @returns {(value: string | number, options?: Omit<PercentageOptions, \"value\">) => string}\n * A function that formats numbers or numeric strings into localized percentages.\n */\nexport const usePercentage = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAA2B;AAC3B,mBAAwC;AACxC,8BAAsC;AAoB/B,MAAM,gBAAgB,MAAM;AACjC,QAAM,EAAE,OAAO,QAAI,yBAAW,6CAAqB;AAEnD,aAAO;AAAA,IACL,IAAI,aACF,wBAAW,KAAK,CAAC,GAAG;AAAA,MAClB,GAAG,KAAK,CAAC;AAAA,MACT,QAAQ,KAAK,CAAC,GAAG,UAAU;AAAA,IAC7B,CAAC;AAAA,IACH,CAAC,MAAM;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var useRelativeTime_exports = {};
|
|
21
|
+
__export(useRelativeTime_exports, {
|
|
22
|
+
useRelativeTime: () => useRelativeTime
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useRelativeTime_exports);
|
|
25
|
+
var import_core = require("@intlayer/core");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_IntlayerProvider = require('../IntlayerProvider.cjs');
|
|
28
|
+
const useRelativeTime = () => {
|
|
29
|
+
const { locale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
|
|
30
|
+
return (0, import_react.useCallback)(
|
|
31
|
+
(...args) => (0, import_core.relativeTime)(args[0], args[1], {
|
|
32
|
+
...args[2],
|
|
33
|
+
locale: args[2]?.locale ?? locale
|
|
34
|
+
}),
|
|
35
|
+
[locale]
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
useRelativeTime
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=useRelativeTime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/format/useRelativeTime.ts"],"sourcesContent":["'use client';\n\nimport { relativeTime } from '@intlayer/core';\nimport { useCallback, useContext } from 'react';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * Client-side React hook for accessing a localized relative time formatter.\n *\n * This hook:\n * - Reads the current locale from {@link useLocaleBase}.\n * - Creates a new relative time formatter with {@link createRelativeTime}.\n * - Returns a function that can format time differences into localized strings.\n *\n * Example:\n * ```tsx\n * const relativeTime = useRelativeTime();\n * const formatted = relativeTime(new Date(\"2024-08-01\"), new Date());\n * // e.g., \"2 weeks ago\"\n * ```\n *\n * @returns {ReturnType<typeof createRelativeTime>} A relative time formatting function\n * bound to the current client locale.\n */\nexport const useRelativeTime = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof relativeTime>) =>\n relativeTime(args[0], args[1], {\n ...args[2],\n locale: args[2]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAA6B;AAC7B,mBAAwC;AACxC,8BAAsC;AAoB/B,MAAM,kBAAkB,MAAM;AACnC,QAAM,EAAE,OAAO,QAAI,yBAAW,6CAAqB;AAEnD,aAAO;AAAA,IACL,IAAI,aACF,0BAAa,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG;AAAA,MAC7B,GAAG,KAAK,CAAC;AAAA,MACT,QAAQ,KAAK,CAAC,GAAG,UAAU;AAAA,IAC7B,CAAC;AAAA,IACH,CAAC,MAAM;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var useUnit_exports = {};
|
|
21
|
+
__export(useUnit_exports, {
|
|
22
|
+
useUnit: () => useUnit
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useUnit_exports);
|
|
25
|
+
var import_core = require("@intlayer/core");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_IntlayerProvider = require('../IntlayerProvider.cjs');
|
|
28
|
+
const useUnit = () => {
|
|
29
|
+
const { locale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
|
|
30
|
+
return (0, import_react.useCallback)(
|
|
31
|
+
(...args) => (0, import_core.units)(args[0], {
|
|
32
|
+
...args[1],
|
|
33
|
+
locale: args[1]?.locale ?? locale
|
|
34
|
+
}),
|
|
35
|
+
[locale]
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
useUnit
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=useUnit.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/format/useUnit.ts"],"sourcesContent":["'use client';\n\nimport { units } from '@intlayer/core';\nimport { useCallback, useContext } from 'react';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React hook that provides a unit formatting function\n * based on the current locale from {@link useLocaleBase}.\n *\n * This hook wraps {@link createUnit} to return a formatter\n * that can convert values into human-readable localized units\n * (e.g., \"10 km\", \"5 lbs\").\n *\n * @example\n * ```tsx\n * const formatUnit = useUnit();\n * const distance = formatUnit(10, { unit: \"kilometer\" });\n * // \"10 km\" (depending on locale)\n * ```\n *\n * @returns {Function} A unit formatting function that accepts a value and optional formatting options.\n */\nexport const useUnit = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof units>) =>\n units(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAsB;AACtB,mBAAwC;AACxC,8BAAsC;AAmB/B,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,OAAO,QAAI,yBAAW,6CAAqB;AAEnD,aAAO;AAAA,IACL,IAAI,aACF,mBAAM,KAAK,CAAC,GAAG;AAAA,MACb,GAAG,KAAK,CAAC;AAAA,MACT,QAAQ,KAAK,CAAC,GAAG,UAAU;AAAA,IAC7B,CAAC;AAAA,IACH,CAAC,MAAM;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["/**\n * Client-side exports for internal package use.\n *\n * Note: This file is used by other packages that import from 'react-intlayer/client'.\n * The main package index.ts imports directly from individual files to avoid circular dependencies.\n */\n\nexport { getBrowserLocale } from './getBrowserLocale';\nexport {\n IntlayerClientContext,\n IntlayerProvider,\n IntlayerProviderContent,\n useIntlayerContext,\n type IntlayerProviderProps,\n} from './IntlayerProvider';\nexport { t } from './t';\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryAsync } from './useDictionaryAsync';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useI18n } from './useI18n';\nexport { useIntlayer } from './useIntlayer';\nexport { useLoadDynamic } from './useLoadDynamic';\nexport { useLocale } from './useLocale';\nexport { useLocaleBase } from './useLocaleBase';\nexport {\n localeCookie,\n setLocaleCookie,\n useLocaleCookie,\n} from './useLocaleCookie';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,8BAAiC;AACjC,8BAMO;AACP,eAAkB;AAClB,2BAA8B;AAC9B,gCAAmC;AACnC,kCAAqC;AACrC,qBAAwB;AACxB,yBAA4B;AAC5B,4BAA+B;AAC/B,uBAA0B;AAC1B,2BAA8B;AAC9B,6BAIO;","names":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -18,27 +18,38 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var index_exports = {};
|
|
20
20
|
__export(index_exports, {
|
|
21
|
-
IntlayerClientContext: () =>
|
|
22
|
-
IntlayerProvider: () =>
|
|
23
|
-
IntlayerProviderContent: () =>
|
|
21
|
+
IntlayerClientContext: () => import_IntlayerProvider.IntlayerClientContext,
|
|
22
|
+
IntlayerProvider: () => import_IntlayerProvider.IntlayerProvider,
|
|
23
|
+
IntlayerProviderContent: () => import_IntlayerProvider.IntlayerProviderContent,
|
|
24
24
|
MarkdownProvider: () => import_markdown.MarkdownProvider,
|
|
25
|
-
getBrowserLocale: () =>
|
|
26
|
-
localeCookie: () =>
|
|
27
|
-
setLocaleCookie: () =>
|
|
28
|
-
t: () =>
|
|
29
|
-
useDictionary: () =>
|
|
30
|
-
useDictionaryAsync: () =>
|
|
31
|
-
useDictionaryDynamic: () =>
|
|
32
|
-
useI18n: () =>
|
|
33
|
-
useIntlayer: () =>
|
|
34
|
-
useIntlayerContext: () =>
|
|
35
|
-
useLoadDynamic: () =>
|
|
36
|
-
useLocale: () =>
|
|
37
|
-
useLocaleBase: () =>
|
|
38
|
-
useLocaleCookie: () =>
|
|
25
|
+
getBrowserLocale: () => import_getBrowserLocale.getBrowserLocale,
|
|
26
|
+
localeCookie: () => import_useLocaleCookie.localeCookie,
|
|
27
|
+
setLocaleCookie: () => import_useLocaleCookie.setLocaleCookie,
|
|
28
|
+
t: () => import_t.t,
|
|
29
|
+
useDictionary: () => import_useDictionary.useDictionary,
|
|
30
|
+
useDictionaryAsync: () => import_useDictionaryAsync.useDictionaryAsync,
|
|
31
|
+
useDictionaryDynamic: () => import_useDictionaryDynamic.useDictionaryDynamic,
|
|
32
|
+
useI18n: () => import_useI18n.useI18n,
|
|
33
|
+
useIntlayer: () => import_useIntlayer.useIntlayer,
|
|
34
|
+
useIntlayerContext: () => import_IntlayerProvider.useIntlayerContext,
|
|
35
|
+
useLoadDynamic: () => import_useLoadDynamic.useLoadDynamic,
|
|
36
|
+
useLocale: () => import_useLocale.useLocale,
|
|
37
|
+
useLocaleBase: () => import_useLocaleBase.useLocaleBase,
|
|
38
|
+
useLocaleCookie: () => import_useLocaleCookie.useLocaleCookie
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(index_exports);
|
|
41
|
-
var
|
|
41
|
+
var import_getBrowserLocale = require('./client/getBrowserLocale.cjs');
|
|
42
|
+
var import_IntlayerProvider = require('./client/IntlayerProvider.cjs');
|
|
43
|
+
var import_t = require('./client/t.cjs');
|
|
44
|
+
var import_useDictionary = require('./client/useDictionary.cjs');
|
|
45
|
+
var import_useDictionaryAsync = require('./client/useDictionaryAsync.cjs');
|
|
46
|
+
var import_useDictionaryDynamic = require('./client/useDictionaryDynamic.cjs');
|
|
47
|
+
var import_useI18n = require('./client/useI18n.cjs');
|
|
48
|
+
var import_useIntlayer = require('./client/useIntlayer.cjs');
|
|
49
|
+
var import_useLoadDynamic = require('./client/useLoadDynamic.cjs');
|
|
50
|
+
var import_useLocale = require('./client/useLocale.cjs');
|
|
51
|
+
var import_useLocaleBase = require('./client/useLocaleBase.cjs');
|
|
52
|
+
var import_useLocaleCookie = require('./client/useLocaleCookie.cjs');
|
|
42
53
|
var import_markdown = require('./markdown/index.cjs');
|
|
43
54
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
55
|
0 && (module.exports = {
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { IInterpreterPluginReact } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T> {}\n}\n\nexport {\n
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { IInterpreterPluginReact } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T> {}\n}\n\n// Import directly from individual files to avoid circular dependency issues\nexport { getBrowserLocale } from './client/getBrowserLocale';\nexport {\n IntlayerClientContext,\n IntlayerProvider,\n IntlayerProviderContent,\n useIntlayerContext,\n type IntlayerProviderProps,\n} from './client/IntlayerProvider';\nexport { t } from './client/t';\nexport { useDictionary } from './client/useDictionary';\nexport { useDictionaryAsync } from './client/useDictionaryAsync';\nexport { useDictionaryDynamic } from './client/useDictionaryDynamic';\nexport { useI18n } from './client/useI18n';\nexport { useIntlayer } from './client/useIntlayer';\nexport { useLoadDynamic } from './client/useLoadDynamic';\nexport { useLocale } from './client/useLocale';\nexport { useLocaleBase } from './client/useLocaleBase';\nexport {\n localeCookie,\n setLocaleCookie,\n useLocaleCookie,\n} from './client/useLocaleCookie';\n\nexport { type IntlayerNode } from './IntlayerNode';\nexport { MarkdownProvider } from './markdown/index';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,8BAAiC;AACjC,8BAMO;AACP,eAAkB;AAClB,2BAA8B;AAC9B,gCAAmC;AACnC,kCAAqC;AACrC,qBAAwB;AACxB,yBAA4B;AAC5B,4BAA+B;AAC/B,uBAA0B;AAC1B,2BAA8B;AAC9B,6BAIO;AAGP,sBAAiC;","names":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var format_exports = {};
|
|
20
|
+
__export(format_exports, {
|
|
21
|
+
useCompact: () => import_useCompact.useCompact,
|
|
22
|
+
useCurrency: () => import_useCurrency.useCurrency,
|
|
23
|
+
useDate: () => import_useDate.useDate,
|
|
24
|
+
useList: () => import_useList.useList,
|
|
25
|
+
useNumber: () => import_useNumber.useNumber,
|
|
26
|
+
usePercentage: () => import_usePercentage.usePercentage,
|
|
27
|
+
useRelativeTime: () => import_useRelativeTime.useRelativeTime,
|
|
28
|
+
useUnit: () => import_useUnit.useUnit
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(format_exports);
|
|
31
|
+
var import_useCompact = require('./useCompact.cjs');
|
|
32
|
+
var import_useCurrency = require('./useCurrency.cjs');
|
|
33
|
+
var import_useDate = require('./useDate.cjs');
|
|
34
|
+
var import_useList = require('./useList.cjs');
|
|
35
|
+
var import_useNumber = require('./useNumber.cjs');
|
|
36
|
+
var import_usePercentage = require('./usePercentage.cjs');
|
|
37
|
+
var import_useRelativeTime = require('./useRelativeTime.cjs');
|
|
38
|
+
var import_useUnit = require('./useUnit.cjs');
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
useCompact,
|
|
42
|
+
useCurrency,
|
|
43
|
+
useDate,
|
|
44
|
+
useList,
|
|
45
|
+
useNumber,
|
|
46
|
+
usePercentage,
|
|
47
|
+
useRelativeTime,
|
|
48
|
+
useUnit
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/server/format/index.ts"],"sourcesContent":["export { useCompact } from './useCompact';\nexport { useCurrency } from './useCurrency';\nexport { useDate } from './useDate';\nexport { useList } from './useList';\nexport { useNumber } from './useNumber';\nexport { usePercentage } from './usePercentage';\nexport { useRelativeTime } from './useRelativeTime';\nexport { useUnit } from './useUnit';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA2B;AAC3B,yBAA4B;AAC5B,qBAAwB;AACxB,qBAAwB;AACxB,uBAA0B;AAC1B,2BAA8B;AAC9B,6BAAgC;AAChC,qBAAwB;","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useCompact_exports = {};
|
|
20
|
+
__export(useCompact_exports, {
|
|
21
|
+
useCompact: () => useCompact
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useCompact_exports);
|
|
24
|
+
var import_core = require("@intlayer/core");
|
|
25
|
+
var import_IntlayerServerProvider = require('../IntlayerServerProvider.cjs');
|
|
26
|
+
var import_serverContext = require('../serverContext.cjs');
|
|
27
|
+
const useCompact = () => {
|
|
28
|
+
const locale = (0, import_serverContext.getServerContext)(import_IntlayerServerProvider.IntlayerServerContext);
|
|
29
|
+
return (...args) => (0, import_core.compact)(args[0], {
|
|
30
|
+
...args[1],
|
|
31
|
+
locale: args[1]?.locale ?? locale
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
useCompact
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=useCompact.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/server/format/useCompact.ts"],"sourcesContent":["import { type LocalesValues } from '@intlayer/config/client';\nimport { compact } from '@intlayer/core';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React client hook that provides a compact number formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatCompact = useCompact();\n * formatCompact(1500); // \"1.5K\"\n * ```\n */\nexport const useCompact = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAwB;AACxB,oCAAsC;AACtC,2BAAiC;AAY1B,MAAM,aAAa,MAAM;AAC9B,QAAM,aAAS,uCAAgC,mDAAqB;AAEpE,SAAO,IAAI,aACT,qBAAQ,KAAK,CAAC,GAAG;AAAA,IACf,GAAG,KAAK,CAAC;AAAA,IACT,QAAQ,KAAK,CAAC,GAAG,UAAU;AAAA,EAC7B,CAAC;AACL;","names":[]}
|