@intlayer/use-intl 9.0.0-canary.2 → 9.0.0-canary.3

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.
Files changed (53) hide show
  1. package/dist/cjs/{react → client}/IntlProvider.cjs +1 -1
  2. package/dist/cjs/client/IntlProvider.cjs.map +1 -0
  3. package/dist/cjs/{react → client}/helpers.cjs +1 -1
  4. package/dist/cjs/client/helpers.cjs.map +1 -0
  5. package/dist/cjs/client/index.cjs +27 -0
  6. package/dist/cjs/client/index.cjs.map +1 -0
  7. package/dist/cjs/{react → client}/useLocale.cjs +1 -1
  8. package/dist/cjs/client/useLocale.cjs.map +1 -0
  9. package/dist/cjs/{react → client}/useTranslations.cjs +1 -1
  10. package/dist/cjs/client/useTranslations.cjs.map +1 -0
  11. package/dist/cjs/core/initializeConfig.cjs.map +1 -1
  12. package/dist/cjs/index.cjs +14 -14
  13. package/dist/esm/{react → client}/IntlProvider.mjs +1 -1
  14. package/dist/esm/client/IntlProvider.mjs.map +1 -0
  15. package/dist/esm/{react → client}/helpers.mjs +1 -1
  16. package/dist/esm/client/helpers.mjs.map +1 -0
  17. package/dist/esm/{react → client}/index.mjs +3 -3
  18. package/dist/esm/client/index.mjs.map +1 -0
  19. package/dist/esm/{react → client}/useLocale.mjs +1 -1
  20. package/dist/esm/client/useLocale.mjs.map +1 -0
  21. package/dist/esm/{react → client}/useTranslations.mjs +1 -1
  22. package/dist/esm/client/useTranslations.mjs.map +1 -0
  23. package/dist/esm/core/initializeConfig.mjs.map +1 -1
  24. package/dist/esm/index.mjs +6 -6
  25. package/dist/types/{react → client}/IntlProvider.d.ts +2 -2
  26. package/dist/types/client/IntlProvider.d.ts.map +1 -0
  27. package/dist/types/{react → client}/helpers.d.ts +1 -1
  28. package/dist/types/client/helpers.d.ts.map +1 -0
  29. package/dist/types/{react → client}/index.d.ts +3 -3
  30. package/dist/types/client/index.d.ts.map +1 -0
  31. package/dist/types/{react → client}/useLocale.d.ts +1 -1
  32. package/dist/types/client/useLocale.d.ts.map +1 -0
  33. package/dist/types/{react → client}/useTranslations.d.ts +1 -1
  34. package/dist/types/client/useTranslations.d.ts.map +1 -0
  35. package/dist/types/index.d.ts +10 -8
  36. package/dist/types/shared/translateFunctionTypes.d.ts +1 -1
  37. package/package.json +14 -14
  38. package/dist/cjs/react/IntlProvider.cjs.map +0 -1
  39. package/dist/cjs/react/helpers.cjs.map +0 -1
  40. package/dist/cjs/react/index.cjs +0 -27
  41. package/dist/cjs/react/index.cjs.map +0 -1
  42. package/dist/cjs/react/useLocale.cjs.map +0 -1
  43. package/dist/cjs/react/useTranslations.cjs.map +0 -1
  44. package/dist/esm/react/IntlProvider.mjs.map +0 -1
  45. package/dist/esm/react/helpers.mjs.map +0 -1
  46. package/dist/esm/react/index.mjs.map +0 -1
  47. package/dist/esm/react/useLocale.mjs.map +0 -1
  48. package/dist/esm/react/useTranslations.mjs.map +0 -1
  49. package/dist/types/react/IntlProvider.d.ts.map +0 -1
  50. package/dist/types/react/helpers.d.ts.map +0 -1
  51. package/dist/types/react/index.d.ts.map +0 -1
  52. package/dist/types/react/useLocale.d.ts.map +0 -1
  53. package/dist/types/react/useTranslations.d.ts.map +0 -1
@@ -8,7 +8,7 @@ let _intlayer_config_built = require("@intlayer/config/built");
8
8
  let _intlayer_config_colors = require("@intlayer/config/colors");
9
9
  let _intlayer_config_logger = require("@intlayer/config/logger");
10
10
 
11
- //#region src/react/IntlProvider.tsx
11
+ //#region src/client/IntlProvider.tsx
12
12
  /**
13
13
  * Drop-in for use-intl's `IntlProvider`.
14
14
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlProvider.cjs","names":["CYAN","IntlayerProvider"],"sources":["../../../src/client/IntlProvider.tsx"],"sourcesContent":["'use client';\n\nimport { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { ComponentProps } from 'react';\nimport { IntlayerProvider } from 'react-intlayer';\nimport type { IntlProvider as _IntlProvider } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `IntlProvider`.\n *\n * Wraps Intlayer's `IntlayerProvider`, seeding the client locale from the\n * `locale` prop. `messages`, `formats`, `now`, `timeZone`, `onError`, and\n * `getMessageFallback` are accepted for API compatibility but have no effect —\n * Intlayer uses its own compiled dictionaries.\n */\nexport const IntlProvider: typeof _IntlProvider = ({\n locale,\n children,\n messages: _messages,\n formats: _formats,\n now: _now,\n timeZone: _timeZone,\n onError: _onError,\n getMessageFallback: _getMessageFallback,\n}) => {\n if (\n process.env.NODE_ENV === 'development' &&\n typeof _messages !== 'undefined'\n ) {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('IntlProvider', CYAN)} do not pass the messages prop with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n // `key={locale}` re-seeds the client locale context when the locale changes,\n // so consumers re-render in the new language.\n return (\n <IntlayerProvider key={String(locale)} locale={locale as LocalesValues}>\n {children}\n </IntlayerProvider>\n );\n};\n\n/**\n * Props accepted by {@link IntlProvider}. `messages` is deprecated — Intlayer\n * loads content from compiled dictionaries automatically.\n */\nexport type IntlProviderProps = Omit<\n ComponentProps<typeof _IntlProvider>,\n 'messages' | 'locale'\n> & {\n /**\n * @deprecated has no use case with intlayer. Messages are loaded\n * automatically under the hood for bundle optimization reason.\n */\n messages?: never;\n /** The active locale. */\n locale: LocalesValues;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,MAAa,gBAAsC,EACjD,QACA,UACA,UAAU,WACV,SAAS,UACT,KAAK,MACL,UAAU,WACV,SAAS,UACT,oBAAoB,0BAChB;AACJ,KACE,QAAQ,IAAI,aAAa,iBACzB,OAAO,cAAc,YAGrB,2CAD+B,EAAE,iCAAK,CAC7B,CACP,yCAAY,gBAAgBA,6BAAK,CAAC,+HACnC;AAKH,QACE,2CAACC,iCAAD;EAA+C;EAC5C;EACgB,EAFI,OAAO,OAAO,CAElB"}
@@ -8,7 +8,7 @@ let _intlayer_config_built = require("@intlayer/config/built");
8
8
  let _intlayer_config_colors = require("@intlayer/config/colors");
9
9
  let _intlayer_config_logger = require("@intlayer/config/logger");
10
10
 
11
- //#region src/react/helpers.ts
11
+ //#region src/client/helpers.ts
12
12
  /**
13
13
  * Drop-in for use-intl's `useNow`.
14
14
  * Returns the current `Date`. The `updateInterval` option is ignored.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.cjs","names":["CYAN","buildIntlFormatter"],"sources":["../../../src/client/helpers.ts"],"sourcesContent":["'use client';\n\nimport { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { useLocale as useLocaleIntlayer } from 'react-intlayer';\nimport type {\n useFormatter as _useFormatter,\n useMessages as _useMessages,\n useNow as _useNow,\n useTimeZone as _useTimeZone,\n} from 'use-intl';\nimport { buildIntlFormatter } from '../shared/intlFormatter';\n\n/**\n * Drop-in for use-intl's `useNow`.\n * Returns the current `Date`. The `updateInterval` option is ignored.\n */\nexport const useNow: typeof _useNow = () => new Date();\n\n/**\n * Drop-in for use-intl's `useTimeZone`.\n * Returns the system time zone resolved from `Intl.DateTimeFormat`.\n */\nexport const useTimeZone: typeof _useTimeZone = () =>\n Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n/**\n * Drop-in for use-intl's `useMessages`.\n *\n * @deprecated useMessages has no use case with intlayer.\n * Messages are loaded automatically under the hood.\n * @returns An empty object.\n */\nexport const useMessages: typeof _useMessages = () => {\n if (process.env.NODE_ENV === 'development') {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('useMessages', CYAN)} has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n return {} as ReturnType<typeof _useMessages>;\n};\n\n/**\n * Drop-in for use-intl's `useFormatter`.\n * Returns locale-aware formatters backed by the native `Intl.*` APIs:\n * `dateTime`, `number`, `dateTimeRange`, `relativeTime`, `list`, and\n * `displayName`.\n */\nexport const useFormatter: typeof _useFormatter = () => {\n const { locale } = useLocaleIntlayer();\n return buildIntlFormatter((locale as string) ?? 'en');\n};\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAa,+BAA+B,IAAI,MAAM;;;;;AAMtD,MAAa,oBACX,KAAK,gBAAgB,CAAC,iBAAiB,CAAC;;;;;;;;AAS1C,MAAa,oBAAyC;AACpD,KAAI,QAAQ,IAAI,aAAa,cAE3B,2CAD+B,EAAE,iCAAK,CAC7B,CACP,yCAAY,eAAeA,6BAAK,CAAC,iHAClC;AAGH,QAAO,EAAE;;;;;;;;AASX,MAAa,qBAA2C;CACtD,MAAM,EAAE,0CAA8B;AACtC,QAAOC,gDAAoB,UAAqB,KAAK"}
@@ -0,0 +1,27 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_useDictionaryDynamic = require('../useDictionaryDynamic.cjs');
3
+ const require_useDictionary = require('../useDictionary.cjs');
4
+ const require_client_helpers = require('./helpers.cjs');
5
+ const require_client_IntlProvider = require('./IntlProvider.cjs');
6
+ const require_client_useLocale = require('./useLocale.cjs');
7
+ const require_client_useTranslations = require('./useTranslations.cjs');
8
+
9
+ //#region src/client/index.ts
10
+ /**
11
+ * @internal Private use-intl export, kept so aliased `_useExtracted` imports
12
+ * resolve. Not part of the supported public surface.
13
+ */
14
+ const _useExtracted = () => ({});
15
+
16
+ //#endregion
17
+ exports.IntlProvider = require_client_IntlProvider.IntlProvider;
18
+ exports._useExtracted = _useExtracted;
19
+ exports.useDictionary = require_useDictionary.useDictionary;
20
+ exports.useDictionaryDynamic = require_useDictionaryDynamic.useDictionaryDynamic;
21
+ exports.useFormatter = require_client_helpers.useFormatter;
22
+ exports.useLocale = require_client_useLocale.useLocale;
23
+ exports.useMessages = require_client_helpers.useMessages;
24
+ exports.useNow = require_client_helpers.useNow;
25
+ exports.useTimeZone = require_client_helpers.useTimeZone;
26
+ exports.useTranslations = require_client_useTranslations.useTranslations;
27
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../../src/client/index.ts"],"sourcesContent":["export { useDictionary } from '../useDictionary';\nexport { useDictionaryDynamic } from '../useDictionaryDynamic';\nexport { useFormatter, useMessages, useNow, useTimeZone } from './helpers';\nexport { IntlProvider, type IntlProviderProps } from './IntlProvider';\nexport { useLocale } from './useLocale';\nexport { useTranslations } from './useTranslations';\n\n/**\n * @internal Private use-intl export, kept so aliased `_useExtracted` imports\n * resolve. Not part of the supported public surface.\n */\nexport const _useExtracted = (): Record<string, never> => ({});\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,uBAA8C,EAAE"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
5
5
  let react_intlayer = require("react-intlayer");
6
6
 
7
- //#region src/react/useLocale.ts
7
+ //#region src/client/useLocale.ts
8
8
  /**
9
9
  * Drop-in for use-intl's `useLocale`.
10
10
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocale.cjs","names":[],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport { useLocale as useLocaleIntlayer } from 'react-intlayer';\nimport type { useLocale as _useLocale } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `useLocale`.\n *\n * Returns the active locale string from Intlayer's client context.\n */\nexport const useLocale: typeof _useLocale = () => {\n const { locale } = useLocaleIntlayer();\n return locale as ReturnType<typeof _useLocale>;\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,kBAAqC;CAChD,MAAM,EAAE,0CAA8B;AACtC,QAAO"}
@@ -6,7 +6,7 @@ const require_shared_namespaceTranslator = require('../shared/namespaceTranslato
6
6
  let react_intlayer = require("react-intlayer");
7
7
  let react = require("react");
8
8
 
9
- //#region src/react/useTranslations.ts
9
+ //#region src/client/useTranslations.ts
10
10
  /**
11
11
  * Drop-in for use-intl's `useTranslations`.
12
12
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTranslations.cjs","names":["IntlayerClientContext","createNamespaceTranslator"],"sources":["../../../src/client/useTranslations.ts"],"sourcesContent":["'use client';\n\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from 'react-intlayer';\nimport { createNamespaceTranslator } from '../shared/namespaceTranslator';\nimport type {\n LooseTranslateFunction,\n TranslateFunction,\n} from '../shared/translateFunctionTypes';\n\n/**\n * Overload set for {@link useTranslations}:\n *\n * 1. A bare dictionary key → fully-typed `t()` (autocompleted dot-paths).\n * 2. A nested namespace `'dictionary.sub.scope'` → `t()` accepts relative\n * `string` paths, matching use-intl's scoped-namespace behaviour.\n * 3. No namespace → root scope; the first segment of each key designates\n * the dictionary (`t('about.title')`).\n */\ntype UseTranslations = {\n <N extends DictionaryKeys>(namespace: N): TranslateFunction<N>;\n (namespace: `${string}.${string}`): LooseTranslateFunction;\n (): LooseTranslateFunction;\n};\n\n/**\n * Drop-in for use-intl's `useTranslations`.\n *\n * Messages support ICU MessageFormat syntax: simple arguments (`{name}`),\n * plural (`{count, plural, one {…} other {…}}`, `#`), select, and formatted\n * arguments (`{value, number}`). Rich text is available through `t.rich()`\n * and `t.markup()`.\n *\n * @example\n * ```tsx\n * const t = useTranslations('about');\n * t('counter.label'); // ✓ typed\n * t('items', { count: 3 }); // ICU plural\n *\n * // Scoped to a nested object (use-intl idiom)\n * const t = useTranslations('about.counter');\n * t('label'); // resolves about → counter.label\n *\n * // Rich text\n * t.rich('terms', { link: (chunks) => <a href=\"/terms\">{chunks}</a> });\n * ```\n */\nexport const useTranslations = ((namespace?: string) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n return useMemo(\n () => createNamespaceTranslator(currentLocale as LocalesValues, namespace),\n [currentLocale, namespace]\n );\n}) as UseTranslations;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAa,oBAAoB,cAAuB;CACtD,MAAM,EAAE,QAAQ,wCAA6BA,qCAAsB,IAAI,EAAE;AAEzE,iCACQC,6DAA0B,eAAgC,UAAU,EAC1E,CAAC,eAAe,UAAU,CAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"initializeConfig.cjs","names":[],"sources":["../../../src/core/initializeConfig.ts"],"sourcesContent":["import type { initializeConfig as _initializeConfig } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `initializeConfig`.\n *\n * Enhances an incoming config with defaults. With intlayer, `messages` and\n * `formats` are not consumed at runtime (content comes from compiled\n * dictionaries) but the shape is preserved so callers keep type-checking.\n */\nexport const initializeConfig: typeof _initializeConfig = ({\n formats,\n getMessageFallback,\n messages,\n onError,\n ...rest\n}) => {\n const finalOnError = onError ?? ((error) => error);\n const finalGetMessageFallback =\n getMessageFallback ?? (({ key, namespace }) => [namespace, key]\n .filter(Boolean)\n .join('.'));\n\n return {\n ...rest,\n formats: formats || undefined,\n messages: messages || undefined,\n onError: finalOnError,\n getMessageFallback: finalGetMessageFallback,\n };\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,oBAA8C,EACzD,SACA,oBACA,UACA,SACA,GAAG,WACC;CACJ,MAAM,eAAe,aAAa,UAAU;CAC5C,MAAM,0BACJ,wBAAwB,EAAE,KAAK,gBAAgB,CAAC,WAAW,IAAI,CAC5D,OAAO,QAAQ,CACf,KAAK,IAAI;AAEd,QAAO;EACL,GAAG;EACH,SAAS,WAAW;EACpB,UAAU,YAAY;EACtB,SAAS;EACT,oBAAoB;EACrB"}
1
+ {"version":3,"file":"initializeConfig.cjs","names":[],"sources":["../../../src/core/initializeConfig.ts"],"sourcesContent":["import type { initializeConfig as _initializeConfig } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `initializeConfig`.\n *\n * Enhances an incoming config with defaults. With intlayer, `messages` and\n * `formats` are not consumed at runtime (content comes from compiled\n * dictionaries) but the shape is preserved so callers keep type-checking.\n */\nexport const initializeConfig: typeof _initializeConfig = ({\n formats,\n getMessageFallback,\n messages,\n onError,\n ...rest\n}) => {\n const finalOnError = onError ?? ((error) => error);\n const finalGetMessageFallback =\n getMessageFallback ??\n (({ key, namespace }) => [namespace, key].filter(Boolean).join('.'));\n\n return {\n ...rest,\n formats: formats || undefined,\n messages: messages || undefined,\n onError: finalOnError,\n getMessageFallback: finalGetMessageFallback,\n };\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,oBAA8C,EACzD,SACA,oBACA,UACA,SACA,GAAG,WACC;CACJ,MAAM,eAAe,aAAa,UAAU;CAC5C,MAAM,0BACJ,wBACE,EAAE,KAAK,gBAAgB,CAAC,WAAW,IAAI,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;AAErE,QAAO;EACL,GAAG;EACH,SAAS,WAAW;EACpB,UAAU,YAAY;EACtB,SAAS;EACT,oBAAoB;EACrB"}
@@ -1,30 +1,30 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_useDictionaryDynamic = require('./useDictionaryDynamic.cjs');
3
+ const require_useDictionary = require('./useDictionary.cjs');
4
+ const require_client_helpers = require('./client/helpers.cjs');
5
+ const require_client_IntlProvider = require('./client/IntlProvider.cjs');
6
+ const require_client_useLocale = require('./client/useLocale.cjs');
7
+ const require_client_useTranslations = require('./client/useTranslations.cjs');
8
+ const require_client_index = require('./client/index.cjs');
3
9
  const require_core_createFormatter = require('./core/createFormatter.cjs');
4
10
  const require_core_createTranslator = require('./core/createTranslator.cjs');
5
11
  const require_core_errors = require('./core/errors.cjs');
6
12
  const require_core_hasLocale = require('./core/hasLocale.cjs');
7
13
  const require_core_initializeConfig = require('./core/initializeConfig.cjs');
8
- const require_react_IntlProvider = require('./react/IntlProvider.cjs');
9
- const require_react_helpers = require('./react/helpers.cjs');
10
- const require_react_useLocale = require('./react/useLocale.cjs');
11
- const require_react_useTranslations = require('./react/useTranslations.cjs');
12
- const require_useDictionary = require('./useDictionary.cjs');
13
- const require_react_index = require('./react/index.cjs');
14
14
 
15
15
  exports.IntlError = require_core_errors.IntlError;
16
16
  exports.IntlErrorCode = require_core_errors.IntlErrorCode;
17
- exports.IntlProvider = require_react_IntlProvider.IntlProvider;
18
- exports._useExtracted = require_react_index._useExtracted;
17
+ exports.IntlProvider = require_client_IntlProvider.IntlProvider;
18
+ exports._useExtracted = require_client_index._useExtracted;
19
19
  exports.createFormatter = require_core_createFormatter.createFormatter;
20
20
  exports.createTranslator = require_core_createTranslator.createTranslator;
21
21
  exports.hasLocale = require_core_hasLocale.hasLocale;
22
22
  exports.initializeConfig = require_core_initializeConfig.initializeConfig;
23
23
  exports.useDictionary = require_useDictionary.useDictionary;
24
24
  exports.useDictionaryDynamic = require_useDictionaryDynamic.useDictionaryDynamic;
25
- exports.useFormatter = require_react_helpers.useFormatter;
26
- exports.useLocale = require_react_useLocale.useLocale;
27
- exports.useMessages = require_react_helpers.useMessages;
28
- exports.useNow = require_react_helpers.useNow;
29
- exports.useTimeZone = require_react_helpers.useTimeZone;
30
- exports.useTranslations = require_react_useTranslations.useTranslations;
25
+ exports.useFormatter = require_client_helpers.useFormatter;
26
+ exports.useLocale = require_client_useLocale.useLocale;
27
+ exports.useMessages = require_client_helpers.useMessages;
28
+ exports.useNow = require_client_helpers.useNow;
29
+ exports.useTimeZone = require_client_helpers.useTimeZone;
30
+ exports.useTranslations = require_client_useTranslations.useTranslations;
@@ -6,7 +6,7 @@ import { log } from "@intlayer/config/built";
6
6
  import { CYAN } from "@intlayer/config/colors";
7
7
  import { colorize, getAppLogger } from "@intlayer/config/logger";
8
8
 
9
- //#region src/react/IntlProvider.tsx
9
+ //#region src/client/IntlProvider.tsx
10
10
  /**
11
11
  * Drop-in for use-intl's `IntlProvider`.
12
12
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlProvider.mjs","names":[],"sources":["../../../src/client/IntlProvider.tsx"],"sourcesContent":["'use client';\n\nimport { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { ComponentProps } from 'react';\nimport { IntlayerProvider } from 'react-intlayer';\nimport type { IntlProvider as _IntlProvider } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `IntlProvider`.\n *\n * Wraps Intlayer's `IntlayerProvider`, seeding the client locale from the\n * `locale` prop. `messages`, `formats`, `now`, `timeZone`, `onError`, and\n * `getMessageFallback` are accepted for API compatibility but have no effect —\n * Intlayer uses its own compiled dictionaries.\n */\nexport const IntlProvider: typeof _IntlProvider = ({\n locale,\n children,\n messages: _messages,\n formats: _formats,\n now: _now,\n timeZone: _timeZone,\n onError: _onError,\n getMessageFallback: _getMessageFallback,\n}) => {\n if (\n process.env.NODE_ENV === 'development' &&\n typeof _messages !== 'undefined'\n ) {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('IntlProvider', CYAN)} do not pass the messages prop with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n // `key={locale}` re-seeds the client locale context when the locale changes,\n // so consumers re-render in the new language.\n return (\n <IntlayerProvider key={String(locale)} locale={locale as LocalesValues}>\n {children}\n </IntlayerProvider>\n );\n};\n\n/**\n * Props accepted by {@link IntlProvider}. `messages` is deprecated — Intlayer\n * loads content from compiled dictionaries automatically.\n */\nexport type IntlProviderProps = Omit<\n ComponentProps<typeof _IntlProvider>,\n 'messages' | 'locale'\n> & {\n /**\n * @deprecated has no use case with intlayer. Messages are loaded\n * automatically under the hood for bundle optimization reason.\n */\n messages?: never;\n /** The active locale. */\n locale: LocalesValues;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAa,gBAAsC,EACjD,QACA,UACA,UAAU,WACV,SAAS,UACT,KAAK,MACL,UAAU,WACV,SAAS,UACT,oBAAoB,0BAChB;AACJ,KAEE,OAAO,cAAc,YAGrB,CADkB,aAAa,EAAE,KAAK,CAC7B,CACP,GAAG,SAAS,gBAAgB,KAAK,CAAC,+HACnC;AAKH,QACE,oBAAC,kBAAD;EAA+C;EAC5C;EACgB,EAFI,OAAO,OAAO,CAElB"}
@@ -6,7 +6,7 @@ import { log } from "@intlayer/config/built";
6
6
  import { CYAN } from "@intlayer/config/colors";
7
7
  import { colorize, getAppLogger } from "@intlayer/config/logger";
8
8
 
9
- //#region src/react/helpers.ts
9
+ //#region src/client/helpers.ts
10
10
  /**
11
11
  * Drop-in for use-intl's `useNow`.
12
12
  * Returns the current `Date`. The `updateInterval` option is ignored.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.mjs","names":["useLocaleIntlayer"],"sources":["../../../src/client/helpers.ts"],"sourcesContent":["'use client';\n\nimport { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { useLocale as useLocaleIntlayer } from 'react-intlayer';\nimport type {\n useFormatter as _useFormatter,\n useMessages as _useMessages,\n useNow as _useNow,\n useTimeZone as _useTimeZone,\n} from 'use-intl';\nimport { buildIntlFormatter } from '../shared/intlFormatter';\n\n/**\n * Drop-in for use-intl's `useNow`.\n * Returns the current `Date`. The `updateInterval` option is ignored.\n */\nexport const useNow: typeof _useNow = () => new Date();\n\n/**\n * Drop-in for use-intl's `useTimeZone`.\n * Returns the system time zone resolved from `Intl.DateTimeFormat`.\n */\nexport const useTimeZone: typeof _useTimeZone = () =>\n Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n/**\n * Drop-in for use-intl's `useMessages`.\n *\n * @deprecated useMessages has no use case with intlayer.\n * Messages are loaded automatically under the hood.\n * @returns An empty object.\n */\nexport const useMessages: typeof _useMessages = () => {\n if (process.env.NODE_ENV === 'development') {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('useMessages', CYAN)} has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n return {} as ReturnType<typeof _useMessages>;\n};\n\n/**\n * Drop-in for use-intl's `useFormatter`.\n * Returns locale-aware formatters backed by the native `Intl.*` APIs:\n * `dateTime`, `number`, `dateTimeRange`, `relativeTime`, `list`, and\n * `displayName`.\n */\nexport const useFormatter: typeof _useFormatter = () => {\n const { locale } = useLocaleIntlayer();\n return buildIntlFormatter((locale as string) ?? 'en');\n};\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAa,+BAA+B,IAAI,MAAM;;;;;AAMtD,MAAa,oBACX,KAAK,gBAAgB,CAAC,iBAAiB,CAAC;;;;;;;;AAS1C,MAAa,oBAAyC;AAGlD,CADkB,aAAa,EAAE,KAAK,CAC7B,CACP,GAAG,SAAS,eAAe,KAAK,CAAC,iHAClC;AAGH,QAAO,EAAE;;;;;;;;AASX,MAAa,qBAA2C;CACtD,MAAM,EAAE,WAAWA,WAAmB;AACtC,QAAO,mBAAoB,UAAqB,KAAK"}
@@ -1,11 +1,11 @@
1
1
  import { useDictionaryDynamic } from "../useDictionaryDynamic.mjs";
2
- import { IntlProvider } from "./IntlProvider.mjs";
2
+ import { useDictionary } from "../useDictionary.mjs";
3
3
  import { useFormatter, useMessages, useNow, useTimeZone } from "./helpers.mjs";
4
+ import { IntlProvider } from "./IntlProvider.mjs";
4
5
  import { useLocale } from "./useLocale.mjs";
5
6
  import { useTranslations } from "./useTranslations.mjs";
6
- import { useDictionary } from "../useDictionary.mjs";
7
7
 
8
- //#region src/react/index.ts
8
+ //#region src/client/index.ts
9
9
  /**
10
10
  * @internal Private use-intl export, kept so aliased `_useExtracted` imports
11
11
  * resolve. Not part of the supported public surface.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/client/index.ts"],"sourcesContent":["export { useDictionary } from '../useDictionary';\nexport { useDictionaryDynamic } from '../useDictionaryDynamic';\nexport { useFormatter, useMessages, useNow, useTimeZone } from './helpers';\nexport { IntlProvider, type IntlProviderProps } from './IntlProvider';\nexport { useLocale } from './useLocale';\nexport { useTranslations } from './useTranslations';\n\n/**\n * @internal Private use-intl export, kept so aliased `_useExtracted` imports\n * resolve. Not part of the supported public surface.\n */\nexport const _useExtracted = (): Record<string, never> => ({});\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,uBAA8C,EAAE"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { useLocale as useLocale$1 } from "react-intlayer";
4
4
 
5
- //#region src/react/useLocale.ts
5
+ //#region src/client/useLocale.ts
6
6
  /**
7
7
  * Drop-in for use-intl's `useLocale`.
8
8
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocale.mjs","names":["useLocaleIntlayer"],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport { useLocale as useLocaleIntlayer } from 'react-intlayer';\nimport type { useLocale as _useLocale } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `useLocale`.\n *\n * Returns the active locale string from Intlayer's client context.\n */\nexport const useLocale: typeof _useLocale = () => {\n const { locale } = useLocaleIntlayer();\n return locale as ReturnType<typeof _useLocale>;\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAa,kBAAqC;CAChD,MAAM,EAAE,WAAWA,aAAmB;AACtC,QAAO"}
@@ -4,7 +4,7 @@ import { createNamespaceTranslator } from "../shared/namespaceTranslator.mjs";
4
4
  import { IntlayerClientContext } from "react-intlayer";
5
5
  import { useContext, useMemo } from "react";
6
6
 
7
- //#region src/react/useTranslations.ts
7
+ //#region src/client/useTranslations.ts
8
8
  /**
9
9
  * Drop-in for use-intl's `useTranslations`.
10
10
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTranslations.mjs","names":[],"sources":["../../../src/client/useTranslations.ts"],"sourcesContent":["'use client';\n\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from 'react-intlayer';\nimport { createNamespaceTranslator } from '../shared/namespaceTranslator';\nimport type {\n LooseTranslateFunction,\n TranslateFunction,\n} from '../shared/translateFunctionTypes';\n\n/**\n * Overload set for {@link useTranslations}:\n *\n * 1. A bare dictionary key → fully-typed `t()` (autocompleted dot-paths).\n * 2. A nested namespace `'dictionary.sub.scope'` → `t()` accepts relative\n * `string` paths, matching use-intl's scoped-namespace behaviour.\n * 3. No namespace → root scope; the first segment of each key designates\n * the dictionary (`t('about.title')`).\n */\ntype UseTranslations = {\n <N extends DictionaryKeys>(namespace: N): TranslateFunction<N>;\n (namespace: `${string}.${string}`): LooseTranslateFunction;\n (): LooseTranslateFunction;\n};\n\n/**\n * Drop-in for use-intl's `useTranslations`.\n *\n * Messages support ICU MessageFormat syntax: simple arguments (`{name}`),\n * plural (`{count, plural, one {…} other {…}}`, `#`), select, and formatted\n * arguments (`{value, number}`). Rich text is available through `t.rich()`\n * and `t.markup()`.\n *\n * @example\n * ```tsx\n * const t = useTranslations('about');\n * t('counter.label'); // ✓ typed\n * t('items', { count: 3 }); // ICU plural\n *\n * // Scoped to a nested object (use-intl idiom)\n * const t = useTranslations('about.counter');\n * t('label'); // resolves about → counter.label\n *\n * // Rich text\n * t.rich('terms', { link: (chunks) => <a href=\"/terms\">{chunks}</a> });\n * ```\n */\nexport const useTranslations = ((namespace?: string) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n return useMemo(\n () => createNamespaceTranslator(currentLocale as LocalesValues, namespace),\n [currentLocale, namespace]\n );\n}) as UseTranslations;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAa,oBAAoB,cAAuB;CACtD,MAAM,EAAE,QAAQ,kBAAkB,WAAW,sBAAsB,IAAI,EAAE;AAEzE,QAAO,cACC,0BAA0B,eAAgC,UAAU,EAC1E,CAAC,eAAe,UAAU,CAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"initializeConfig.mjs","names":[],"sources":["../../../src/core/initializeConfig.ts"],"sourcesContent":["import type { initializeConfig as _initializeConfig } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `initializeConfig`.\n *\n * Enhances an incoming config with defaults. With intlayer, `messages` and\n * `formats` are not consumed at runtime (content comes from compiled\n * dictionaries) but the shape is preserved so callers keep type-checking.\n */\nexport const initializeConfig: typeof _initializeConfig = ({\n formats,\n getMessageFallback,\n messages,\n onError,\n ...rest\n}) => {\n const finalOnError = onError ?? ((error) => error);\n const finalGetMessageFallback =\n getMessageFallback ?? (({ key, namespace }) => [namespace, key]\n .filter(Boolean)\n .join('.'));\n\n return {\n ...rest,\n formats: formats || undefined,\n messages: messages || undefined,\n onError: finalOnError,\n getMessageFallback: finalGetMessageFallback,\n };\n};\n"],"mappings":";;;;;;;;AASA,MAAa,oBAA8C,EACzD,SACA,oBACA,UACA,SACA,GAAG,WACC;CACJ,MAAM,eAAe,aAAa,UAAU;CAC5C,MAAM,0BACJ,wBAAwB,EAAE,KAAK,gBAAgB,CAAC,WAAW,IAAI,CAC5D,OAAO,QAAQ,CACf,KAAK,IAAI;AAEd,QAAO;EACL,GAAG;EACH,SAAS,WAAW;EACpB,UAAU,YAAY;EACtB,SAAS;EACT,oBAAoB;EACrB"}
1
+ {"version":3,"file":"initializeConfig.mjs","names":[],"sources":["../../../src/core/initializeConfig.ts"],"sourcesContent":["import type { initializeConfig as _initializeConfig } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `initializeConfig`.\n *\n * Enhances an incoming config with defaults. With intlayer, `messages` and\n * `formats` are not consumed at runtime (content comes from compiled\n * dictionaries) but the shape is preserved so callers keep type-checking.\n */\nexport const initializeConfig: typeof _initializeConfig = ({\n formats,\n getMessageFallback,\n messages,\n onError,\n ...rest\n}) => {\n const finalOnError = onError ?? ((error) => error);\n const finalGetMessageFallback =\n getMessageFallback ??\n (({ key, namespace }) => [namespace, key].filter(Boolean).join('.'));\n\n return {\n ...rest,\n formats: formats || undefined,\n messages: messages || undefined,\n onError: finalOnError,\n getMessageFallback: finalGetMessageFallback,\n };\n};\n"],"mappings":";;;;;;;;AASA,MAAa,oBAA8C,EACzD,SACA,oBACA,UACA,SACA,GAAG,WACC;CACJ,MAAM,eAAe,aAAa,UAAU;CAC5C,MAAM,0BACJ,wBACE,EAAE,KAAK,gBAAgB,CAAC,WAAW,IAAI,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;AAErE,QAAO;EACL,GAAG;EACH,SAAS,WAAW;EACpB,UAAU,YAAY;EACtB,SAAS;EACT,oBAAoB;EACrB"}
@@ -1,14 +1,14 @@
1
1
  import { useDictionaryDynamic } from "./useDictionaryDynamic.mjs";
2
+ import { useDictionary } from "./useDictionary.mjs";
3
+ import { useFormatter, useMessages, useNow, useTimeZone } from "./client/helpers.mjs";
4
+ import { IntlProvider } from "./client/IntlProvider.mjs";
5
+ import { useLocale } from "./client/useLocale.mjs";
6
+ import { useTranslations } from "./client/useTranslations.mjs";
7
+ import { _useExtracted } from "./client/index.mjs";
2
8
  import { createFormatter } from "./core/createFormatter.mjs";
3
9
  import { createTranslator } from "./core/createTranslator.mjs";
4
10
  import { IntlError, IntlErrorCode } from "./core/errors.mjs";
5
11
  import { hasLocale } from "./core/hasLocale.mjs";
6
12
  import { initializeConfig } from "./core/initializeConfig.mjs";
7
- import { IntlProvider } from "./react/IntlProvider.mjs";
8
- import { useFormatter, useMessages, useNow, useTimeZone } from "./react/helpers.mjs";
9
- import { useLocale } from "./react/useLocale.mjs";
10
- import { useTranslations } from "./react/useTranslations.mjs";
11
- import { useDictionary } from "./useDictionary.mjs";
12
- import { _useExtracted } from "./react/index.mjs";
13
13
 
14
14
  export { IntlError, IntlErrorCode, IntlProvider, _useExtracted, createFormatter, createTranslator, hasLocale, initializeConfig, useDictionary, useDictionaryDynamic, useFormatter, useLocale, useMessages, useNow, useTimeZone, useTranslations };
@@ -1,8 +1,8 @@
1
- import { IntlProvider as IntlProvider$1 } from "use-intl";
2
1
  import { LocalesValues } from "@intlayer/types/module_augmentation";
3
2
  import { ComponentProps } from "react";
3
+ import { IntlProvider as IntlProvider$1 } from "use-intl";
4
4
 
5
- //#region src/react/IntlProvider.d.ts
5
+ //#region src/client/IntlProvider.d.ts
6
6
  /**
7
7
  * Drop-in for use-intl's `IntlProvider`.
8
8
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlProvider.d.ts","names":[],"sources":["../../../src/client/IntlProvider.tsx"],"mappings":";;;;;;;AAkBA;;;;;AAiCA;cAjCa,YAAA,SAAqB,cAAA;;;;;KAiCtB,iBAAA,GAAoB,IAAA,CAC9B,cAAA,QAAsB,cAAA;EASD;;;;EAFrB,QAAA;EAEA,MAAA,EAAQ,aAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
  import { useFormatter as useFormatter$1, useMessages as useMessages$1, useNow as useNow$1, useTimeZone as useTimeZone$1 } from "use-intl";
2
2
 
3
- //#region src/react/helpers.d.ts
3
+ //#region src/client/helpers.d.ts
4
4
  /**
5
5
  * Drop-in for use-intl's `useNow`.
6
6
  * Returns the current `Date`. The `updateInterval` option is ignored.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","names":[],"sources":["../../../src/client/helpers.ts"],"mappings":";;;;;AAkBA;;cAAa,MAAA,SAAe,QAAA;;;AAM5B;;cAAa,WAAA,SAAoB,aAAA;;;AAUjC;;;;;cAAa,WAAA,SAAoB,aAAA;;;;;;;cAiBpB,YAAA,SAAqB,cAAA"}
@@ -1,11 +1,11 @@
1
1
  import { IntlProvider, IntlProviderProps } from "./IntlProvider.js";
2
2
  import { useFormatter, useMessages, useNow, useTimeZone } from "./helpers.js";
3
- import { useLocale } from "./useLocale.js";
4
- import { useTranslations } from "./useTranslations.js";
5
3
  import { useDictionary } from "../useDictionary.js";
6
4
  import { useDictionaryDynamic } from "../useDictionaryDynamic.js";
5
+ import { useLocale } from "./useLocale.js";
6
+ import { useTranslations } from "./useTranslations.js";
7
7
 
8
- //#region src/react/index.d.ts
8
+ //#region src/client/index.d.ts
9
9
  /**
10
10
  * @internal Private use-intl export, kept so aliased `_useExtracted` imports
11
11
  * resolve. Not part of the supported public surface.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/client/index.ts"],"mappings":";;;;;;;;;;AAWA;;cAAa,aAAA,QAAoB,MAAA"}
@@ -1,6 +1,6 @@
1
1
  import { useLocale as useLocale$1 } from "use-intl";
2
2
 
3
- //#region src/react/useLocale.d.ts
3
+ //#region src/client/useLocale.d.ts
4
4
  /**
5
5
  * Drop-in for use-intl's `useLocale`.
6
6
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/client/useLocale.ts"],"mappings":";;;;;AAUA;;;cAAa,SAAA,SAAkB,WAAA"}
@@ -1,7 +1,7 @@
1
1
  import { LooseTranslateFunction, TranslateFunction } from "../shared/translateFunctionTypes.js";
2
2
  import { DictionaryKeys } from "@intlayer/types/module_augmentation";
3
3
 
4
- //#region src/react/useTranslations.d.ts
4
+ //#region src/client/useTranslations.d.ts
5
5
  /**
6
6
  * Overload set for {@link useTranslations}:
7
7
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTranslations.d.ts","names":[],"sources":["../../../src/client/useTranslations.ts"],"mappings":";;;;;;AAY0C;;;;;;;KAWrC,eAAA;EAAA,WACQ,cAAA,EAAgB,SAAA,EAAW,CAAA,GAAI,iBAAA,CAAkB,CAAA;EAAA,CAC3D,SAAA,0BAAmC,sBAAA;EAAA,IAChC,sBAAA;AAAA;;;;;;;;;;;AAyBN;;;;;;;;;;;;cAAa,eAAA,EAOP,eAAA"}
@@ -1,14 +1,16 @@
1
+ import { IntlProvider, IntlProviderProps } from "./client/IntlProvider.js";
2
+ import { useFormatter, useMessages, useNow, useTimeZone } from "./client/helpers.js";
3
+ import { useDictionary } from "./useDictionary.js";
4
+ import { useDictionaryDynamic } from "./useDictionaryDynamic.js";
5
+ import { useLocale } from "./client/useLocale.js";
6
+ import { MarkupChunkRenderer, RichChunkRenderer } from "./shared/namespaceTranslator.js";
7
+ import { LooseTranslateFunction, TranslateFunction } from "./shared/translateFunctionTypes.js";
8
+ import { useTranslations } from "./client/useTranslations.js";
9
+ import { _useExtracted } from "./client/index.js";
1
10
  import { createFormatter } from "./core/createFormatter.js";
2
11
  import { CreateTranslatorConfig, createTranslator } from "./core/createTranslator.js";
3
12
  import { IntlError, IntlErrorCode } from "./core/errors.js";
4
13
  import { hasLocale } from "./core/hasLocale.js";
5
14
  import { initializeConfig } from "./core/initializeConfig.js";
6
15
  import { AbstractIntlMessages, AppConfig, DateTimeFormatOptions, Formats, ICUArgs, ICUTags, IntlConfig, Locale, MarkupTagsFunction, MarkupTranslationValues, MessageKeys, Messages, NamespaceKeys, NestedKeyOf, NestedValueOf, NumberFormatOptions, RelativeTimeFormatOptions, RichTagsFunction, RichTranslationValues, Timezone, TranslationValues } from "./core/types.js";
7
- import { IntlProvider, IntlProviderProps } from "./react/IntlProvider.js";
8
- import { useFormatter, useMessages, useNow, useTimeZone } from "./react/helpers.js";
9
- import { useLocale } from "./react/useLocale.js";
10
- import { useTranslations } from "./react/useTranslations.js";
11
- import { useDictionary } from "./useDictionary.js";
12
- import { useDictionaryDynamic } from "./useDictionaryDynamic.js";
13
- import { _useExtracted } from "./react/index.js";
14
- export { AbstractIntlMessages, AppConfig, CreateTranslatorConfig, DateTimeFormatOptions, Formats, ICUArgs, ICUTags, IntlConfig, IntlError, IntlErrorCode, IntlProvider, IntlProviderProps, Locale, MarkupTagsFunction, MarkupTranslationValues, MessageKeys, Messages, NamespaceKeys, NestedKeyOf, NestedValueOf, NumberFormatOptions, RelativeTimeFormatOptions, RichTagsFunction, RichTranslationValues, Timezone, TranslationValues, _useExtracted, createFormatter, createTranslator, hasLocale, initializeConfig, useDictionary, useDictionaryDynamic, useFormatter, useLocale, useMessages, useNow, useTimeZone, useTranslations };
16
+ export { AbstractIntlMessages, AppConfig, CreateTranslatorConfig, DateTimeFormatOptions, Formats, ICUArgs, ICUTags, IntlConfig, IntlError, IntlErrorCode, IntlProvider, IntlProviderProps, Locale, type LooseTranslateFunction, type MarkupChunkRenderer, MarkupTagsFunction, MarkupTranslationValues, MessageKeys, Messages, NamespaceKeys, NestedKeyOf, NestedValueOf, NumberFormatOptions, RelativeTimeFormatOptions, type RichChunkRenderer, RichTagsFunction, RichTranslationValues, Timezone, type TranslateFunction, TranslationValues, _useExtracted, createFormatter, createTranslator, hasLocale, initializeConfig, useDictionary, useDictionaryDynamic, useFormatter, useLocale, useMessages, useNow, useTimeZone, useTranslations };
@@ -1,7 +1,7 @@
1
1
  import { MarkupChunkRenderer, RichChunkRenderer } from "./namespaceTranslator.js";
2
2
  import { DictionaryKeys } from "@intlayer/types/module_augmentation";
3
- import { ValidDotPathsFor } from "@intlayer/core/transpiler";
4
3
  import { ReactNode } from "react";
4
+ import { ValidDotPathsFor } from "@intlayer/core/transpiler";
5
5
 
6
6
  //#region src/shared/translateFunctionTypes.d.ts
7
7
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/use-intl",
3
- "version": "9.0.0-canary.2",
3
+ "version": "9.0.0-canary.3",
4
4
  "private": false,
5
5
  "description": "use-intl API adapter for intlayer — useTranslations, useLocale, useFormatter, IntlProvider, createTranslator backed by react-intlayer",
6
6
  "keywords": [
@@ -44,9 +44,9 @@
44
44
  "import": "./dist/esm/core/index.mjs"
45
45
  },
46
46
  "./react": {
47
- "types": "./dist/types/react/index.d.ts",
48
- "require": "./dist/cjs/react/index.cjs",
49
- "import": "./dist/esm/react/index.mjs"
47
+ "types": "./dist/types/client/index.d.ts",
48
+ "require": "./dist/cjs/client/index.cjs",
49
+ "import": "./dist/esm/client/index.mjs"
50
50
  },
51
51
  "./plugin": {
52
52
  "types": "./dist/types/plugin/index.d.ts",
@@ -64,7 +64,7 @@
64
64
  "./dist/types/core/index.d.ts"
65
65
  ],
66
66
  "react": [
67
- "./dist/types/react/index.d.ts"
67
+ "./dist/types/client/index.d.ts"
68
68
  ],
69
69
  "plugin": [
70
70
  "./dist/types/plugin/index.d.ts"
@@ -93,13 +93,13 @@
93
93
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
94
94
  },
95
95
  "dependencies": {
96
- "@intlayer/chokidar": "9.0.0-canary.2",
97
- "@intlayer/config": "9.0.0-canary.2",
98
- "@intlayer/core": "9.0.0-canary.2",
99
- "@intlayer/dictionaries-entry": "9.0.0-canary.2",
100
- "@intlayer/types": "9.0.0-canary.2",
101
- "react-intlayer": "9.0.0-canary.2",
102
- "vite-intlayer": "9.0.0-canary.2"
96
+ "@intlayer/chokidar": "9.0.0-canary.3",
97
+ "@intlayer/config": "9.0.0-canary.3",
98
+ "@intlayer/core": "9.0.0-canary.3",
99
+ "@intlayer/dictionaries-entry": "9.0.0-canary.3",
100
+ "@intlayer/types": "9.0.0-canary.3",
101
+ "react-intlayer": "9.0.0-canary.3",
102
+ "vite-intlayer": "9.0.0-canary.3"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@types/node": "25.9.3",
@@ -107,11 +107,11 @@
107
107
  "@utils/ts-config": "1.0.4",
108
108
  "@utils/ts-config-types": "1.0.4",
109
109
  "@utils/tsdown-config": "1.0.4",
110
- "use-intl": "4.13.0",
111
110
  "rimraf": "6.1.3",
112
111
  "tsdown": "0.21.10",
113
112
  "typescript": "6.0.3",
114
- "vite": "7.1.12",
113
+ "use-intl": "4.13.0",
114
+ "vite": "8.0.16",
115
115
  "vitest": "4.1.9"
116
116
  },
117
117
  "peerDependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"IntlProvider.cjs","names":["CYAN","IntlayerProvider"],"sources":["../../../src/react/IntlProvider.tsx"],"sourcesContent":["'use client';\n\nimport { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { IntlayerProvider } from 'react-intlayer';\nimport type { ComponentProps } from 'react';\nimport type { IntlProvider as _IntlProvider } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `IntlProvider`.\n *\n * Wraps Intlayer's `IntlayerProvider`, seeding the client locale from the\n * `locale` prop. `messages`, `formats`, `now`, `timeZone`, `onError`, and\n * `getMessageFallback` are accepted for API compatibility but have no effect —\n * Intlayer uses its own compiled dictionaries.\n */\nexport const IntlProvider: typeof _IntlProvider = ({\n locale,\n children,\n messages: _messages,\n formats: _formats,\n now: _now,\n timeZone: _timeZone,\n onError: _onError,\n getMessageFallback: _getMessageFallback,\n}) => {\n if (\n process.env.NODE_ENV === 'development' &&\n typeof _messages !== 'undefined'\n ) {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('IntlProvider', CYAN)} do not pass the messages prop with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n // `key={locale}` re-seeds the client locale context when the locale changes,\n // so consumers re-render in the new language.\n return (\n <IntlayerProvider\n key={String(locale)}\n locale={locale as LocalesValues}\n >\n {children}\n </IntlayerProvider>\n );\n};\n\n/**\n * Props accepted by {@link IntlProvider}. `messages` is deprecated — Intlayer\n * loads content from compiled dictionaries automatically.\n */\nexport type IntlProviderProps = Omit<\n ComponentProps<typeof _IntlProvider>,\n 'messages' | 'locale'\n> & {\n /**\n * @deprecated has no use case with intlayer. Messages are loaded\n * automatically under the hood for bundle optimization reason.\n */\n messages?: never;\n /** The active locale. */\n locale: LocalesValues;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,MAAa,gBAAsC,EACjD,QACA,UACA,UAAU,WACV,SAAS,UACT,KAAK,MACL,UAAU,WACV,SAAS,UACT,oBAAoB,0BAChB;AACJ,KACE,QAAQ,IAAI,aAAa,iBACzB,OAAO,cAAc,YAGrB,2CAD+B,EAAE,iCAAK,CAC7B,CACP,yCAAY,gBAAgBA,6BAAK,CAAC,+HACnC;AAKH,QACE,2CAACC,iCAAD;EAEU;EAEP;EACgB,EAJZ,OAAO,OAAO,CAIF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.cjs","names":["CYAN","buildIntlFormatter"],"sources":["../../../src/react/helpers.ts"],"sourcesContent":["'use client';\n\nimport { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { useLocale as useLocaleIntlayer } from 'react-intlayer';\nimport type {\n useFormatter as _useFormatter,\n useMessages as _useMessages,\n useNow as _useNow,\n useTimeZone as _useTimeZone,\n} from 'use-intl';\nimport { buildIntlFormatter } from '../shared/intlFormatter';\n\n/**\n * Drop-in for use-intl's `useNow`.\n * Returns the current `Date`. The `updateInterval` option is ignored.\n */\nexport const useNow: typeof _useNow = () => new Date();\n\n/**\n * Drop-in for use-intl's `useTimeZone`.\n * Returns the system time zone resolved from `Intl.DateTimeFormat`.\n */\nexport const useTimeZone: typeof _useTimeZone = () =>\n Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n/**\n * Drop-in for use-intl's `useMessages`.\n *\n * @deprecated useMessages has no use case with intlayer.\n * Messages are loaded automatically under the hood.\n * @returns An empty object.\n */\nexport const useMessages: typeof _useMessages = () => {\n if (process.env.NODE_ENV === 'development') {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('useMessages', CYAN)} has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n return {} as ReturnType<typeof _useMessages>;\n};\n\n/**\n * Drop-in for use-intl's `useFormatter`.\n * Returns locale-aware formatters backed by the native `Intl.*` APIs:\n * `dateTime`, `number`, `dateTimeRange`, `relativeTime`, `list`, and\n * `displayName`.\n */\nexport const useFormatter: typeof _useFormatter = () => {\n const { locale } = useLocaleIntlayer();\n return buildIntlFormatter((locale as string) ?? 'en');\n};\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAa,+BAA+B,IAAI,MAAM;;;;;AAMtD,MAAa,oBACX,KAAK,gBAAgB,CAAC,iBAAiB,CAAC;;;;;;;;AAS1C,MAAa,oBAAyC;AACpD,KAAI,QAAQ,IAAI,aAAa,cAE3B,2CAD+B,EAAE,iCAAK,CAC7B,CACP,yCAAY,eAAeA,6BAAK,CAAC,iHAClC;AAGH,QAAO,EAAE;;;;;;;;AASX,MAAa,qBAA2C;CACtD,MAAM,EAAE,0CAA8B;AACtC,QAAOC,gDAAoB,UAAqB,KAAK"}
@@ -1,27 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_useDictionaryDynamic = require('../useDictionaryDynamic.cjs');
3
- const require_react_IntlProvider = require('./IntlProvider.cjs');
4
- const require_react_helpers = require('./helpers.cjs');
5
- const require_react_useLocale = require('./useLocale.cjs');
6
- const require_react_useTranslations = require('./useTranslations.cjs');
7
- const require_useDictionary = require('../useDictionary.cjs');
8
-
9
- //#region src/react/index.ts
10
- /**
11
- * @internal Private use-intl export, kept so aliased `_useExtracted` imports
12
- * resolve. Not part of the supported public surface.
13
- */
14
- const _useExtracted = () => ({});
15
-
16
- //#endregion
17
- exports.IntlProvider = require_react_IntlProvider.IntlProvider;
18
- exports._useExtracted = _useExtracted;
19
- exports.useDictionary = require_useDictionary.useDictionary;
20
- exports.useDictionaryDynamic = require_useDictionaryDynamic.useDictionaryDynamic;
21
- exports.useFormatter = require_react_helpers.useFormatter;
22
- exports.useLocale = require_react_useLocale.useLocale;
23
- exports.useMessages = require_react_helpers.useMessages;
24
- exports.useNow = require_react_helpers.useNow;
25
- exports.useTimeZone = require_react_helpers.useTimeZone;
26
- exports.useTranslations = require_react_useTranslations.useTranslations;
27
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../../../src/react/index.ts"],"sourcesContent":["export { IntlProvider, type IntlProviderProps } from './IntlProvider';\nexport { useFormatter, useMessages, useNow, useTimeZone } from './helpers';\nexport { useLocale } from './useLocale';\nexport { useTranslations } from './useTranslations';\nexport { useDictionary } from '../useDictionary';\nexport { useDictionaryDynamic } from '../useDictionaryDynamic';\n\n/**\n * @internal Private use-intl export, kept so aliased `_useExtracted` imports\n * resolve. Not part of the supported public surface.\n */\nexport const _useExtracted = (): Record<string, never> => ({});\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,uBAA8C,EAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLocale.cjs","names":[],"sources":["../../../src/react/useLocale.ts"],"sourcesContent":["'use client';\n\nimport { useLocale as useLocaleIntlayer } from 'react-intlayer';\nimport type { useLocale as _useLocale } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `useLocale`.\n *\n * Returns the active locale string from Intlayer's client context.\n */\nexport const useLocale: typeof _useLocale = () => {\n const { locale } = useLocaleIntlayer();\n return locale as ReturnType<typeof _useLocale>;\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,kBAAqC;CAChD,MAAM,EAAE,0CAA8B;AACtC,QAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTranslations.cjs","names":["IntlayerClientContext","createNamespaceTranslator"],"sources":["../../../src/react/useTranslations.ts"],"sourcesContent":["'use client';\n\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { IntlayerClientContext } from 'react-intlayer';\nimport { useContext, useMemo } from 'react';\nimport { createNamespaceTranslator } from '../shared/namespaceTranslator';\nimport type {\n LooseTranslateFunction,\n TranslateFunction,\n} from '../shared/translateFunctionTypes';\n\n/**\n * Overload set for {@link useTranslations}:\n *\n * 1. A bare dictionary key → fully-typed `t()` (autocompleted dot-paths).\n * 2. A nested namespace `'dictionary.sub.scope'` → `t()` accepts relative\n * `string` paths, matching use-intl's scoped-namespace behaviour.\n * 3. No namespace → root scope; the first segment of each key designates\n * the dictionary (`t('about.title')`).\n */\ntype UseTranslations = {\n <N extends DictionaryKeys>(namespace: N): TranslateFunction<N>;\n (namespace: `${string}.${string}`): LooseTranslateFunction;\n (): LooseTranslateFunction;\n};\n\n/**\n * Drop-in for use-intl's `useTranslations`.\n *\n * Messages support ICU MessageFormat syntax: simple arguments (`{name}`),\n * plural (`{count, plural, one {…} other {…}}`, `#`), select, and formatted\n * arguments (`{value, number}`). Rich text is available through `t.rich()`\n * and `t.markup()`.\n *\n * @example\n * ```tsx\n * const t = useTranslations('about');\n * t('counter.label'); // ✓ typed\n * t('items', { count: 3 }); // ICU plural\n *\n * // Scoped to a nested object (use-intl idiom)\n * const t = useTranslations('about.counter');\n * t('label'); // resolves about → counter.label\n *\n * // Rich text\n * t.rich('terms', { link: (chunks) => <a href=\"/terms\">{chunks}</a> });\n * ```\n */\nexport const useTranslations = ((namespace?: string) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n return useMemo(\n () => createNamespaceTranslator(currentLocale as LocalesValues, namespace),\n [currentLocale, namespace]\n );\n}) as UseTranslations;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAa,oBAAoB,cAAuB;CACtD,MAAM,EAAE,QAAQ,wCAA6BA,qCAAsB,IAAI,EAAE;AAEzE,iCACQC,6DAA0B,eAAgC,UAAU,EAC1E,CAAC,eAAe,UAAU,CAC3B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IntlProvider.mjs","names":[],"sources":["../../../src/react/IntlProvider.tsx"],"sourcesContent":["'use client';\n\nimport { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { IntlayerProvider } from 'react-intlayer';\nimport type { ComponentProps } from 'react';\nimport type { IntlProvider as _IntlProvider } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `IntlProvider`.\n *\n * Wraps Intlayer's `IntlayerProvider`, seeding the client locale from the\n * `locale` prop. `messages`, `formats`, `now`, `timeZone`, `onError`, and\n * `getMessageFallback` are accepted for API compatibility but have no effect —\n * Intlayer uses its own compiled dictionaries.\n */\nexport const IntlProvider: typeof _IntlProvider = ({\n locale,\n children,\n messages: _messages,\n formats: _formats,\n now: _now,\n timeZone: _timeZone,\n onError: _onError,\n getMessageFallback: _getMessageFallback,\n}) => {\n if (\n process.env.NODE_ENV === 'development' &&\n typeof _messages !== 'undefined'\n ) {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('IntlProvider', CYAN)} do not pass the messages prop with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n // `key={locale}` re-seeds the client locale context when the locale changes,\n // so consumers re-render in the new language.\n return (\n <IntlayerProvider\n key={String(locale)}\n locale={locale as LocalesValues}\n >\n {children}\n </IntlayerProvider>\n );\n};\n\n/**\n * Props accepted by {@link IntlProvider}. `messages` is deprecated — Intlayer\n * loads content from compiled dictionaries automatically.\n */\nexport type IntlProviderProps = Omit<\n ComponentProps<typeof _IntlProvider>,\n 'messages' | 'locale'\n> & {\n /**\n * @deprecated has no use case with intlayer. Messages are loaded\n * automatically under the hood for bundle optimization reason.\n */\n messages?: never;\n /** The active locale. */\n locale: LocalesValues;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAa,gBAAsC,EACjD,QACA,UACA,UAAU,WACV,SAAS,UACT,KAAK,MACL,UAAU,WACV,SAAS,UACT,oBAAoB,0BAChB;AACJ,KAEE,OAAO,cAAc,YAGrB,CADkB,aAAa,EAAE,KAAK,CAC7B,CACP,GAAG,SAAS,gBAAgB,KAAK,CAAC,+HACnC;AAKH,QACE,oBAAC,kBAAD;EAEU;EAEP;EACgB,EAJZ,OAAO,OAAO,CAIF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.mjs","names":["useLocaleIntlayer"],"sources":["../../../src/react/helpers.ts"],"sourcesContent":["'use client';\n\nimport { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { useLocale as useLocaleIntlayer } from 'react-intlayer';\nimport type {\n useFormatter as _useFormatter,\n useMessages as _useMessages,\n useNow as _useNow,\n useTimeZone as _useTimeZone,\n} from 'use-intl';\nimport { buildIntlFormatter } from '../shared/intlFormatter';\n\n/**\n * Drop-in for use-intl's `useNow`.\n * Returns the current `Date`. The `updateInterval` option is ignored.\n */\nexport const useNow: typeof _useNow = () => new Date();\n\n/**\n * Drop-in for use-intl's `useTimeZone`.\n * Returns the system time zone resolved from `Intl.DateTimeFormat`.\n */\nexport const useTimeZone: typeof _useTimeZone = () =>\n Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n/**\n * Drop-in for use-intl's `useMessages`.\n *\n * @deprecated useMessages has no use case with intlayer.\n * Messages are loaded automatically under the hood.\n * @returns An empty object.\n */\nexport const useMessages: typeof _useMessages = () => {\n if (process.env.NODE_ENV === 'development') {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('useMessages', CYAN)} has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n return {} as ReturnType<typeof _useMessages>;\n};\n\n/**\n * Drop-in for use-intl's `useFormatter`.\n * Returns locale-aware formatters backed by the native `Intl.*` APIs:\n * `dateTime`, `number`, `dateTimeRange`, `relativeTime`, `list`, and\n * `displayName`.\n */\nexport const useFormatter: typeof _useFormatter = () => {\n const { locale } = useLocaleIntlayer();\n return buildIntlFormatter((locale as string) ?? 'en');\n};\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAa,+BAA+B,IAAI,MAAM;;;;;AAMtD,MAAa,oBACX,KAAK,gBAAgB,CAAC,iBAAiB,CAAC;;;;;;;;AAS1C,MAAa,oBAAyC;AAGlD,CADkB,aAAa,EAAE,KAAK,CAC7B,CACP,GAAG,SAAS,eAAe,KAAK,CAAC,iHAClC;AAGH,QAAO,EAAE;;;;;;;;AASX,MAAa,qBAA2C;CACtD,MAAM,EAAE,WAAWA,WAAmB;AACtC,QAAO,mBAAoB,UAAqB,KAAK"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/react/index.ts"],"sourcesContent":["export { IntlProvider, type IntlProviderProps } from './IntlProvider';\nexport { useFormatter, useMessages, useNow, useTimeZone } from './helpers';\nexport { useLocale } from './useLocale';\nexport { useTranslations } from './useTranslations';\nexport { useDictionary } from '../useDictionary';\nexport { useDictionaryDynamic } from '../useDictionaryDynamic';\n\n/**\n * @internal Private use-intl export, kept so aliased `_useExtracted` imports\n * resolve. Not part of the supported public surface.\n */\nexport const _useExtracted = (): Record<string, never> => ({});\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,uBAA8C,EAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLocale.mjs","names":["useLocaleIntlayer"],"sources":["../../../src/react/useLocale.ts"],"sourcesContent":["'use client';\n\nimport { useLocale as useLocaleIntlayer } from 'react-intlayer';\nimport type { useLocale as _useLocale } from 'use-intl';\n\n/**\n * Drop-in for use-intl's `useLocale`.\n *\n * Returns the active locale string from Intlayer's client context.\n */\nexport const useLocale: typeof _useLocale = () => {\n const { locale } = useLocaleIntlayer();\n return locale as ReturnType<typeof _useLocale>;\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAa,kBAAqC;CAChD,MAAM,EAAE,WAAWA,aAAmB;AACtC,QAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTranslations.mjs","names":[],"sources":["../../../src/react/useTranslations.ts"],"sourcesContent":["'use client';\n\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { IntlayerClientContext } from 'react-intlayer';\nimport { useContext, useMemo } from 'react';\nimport { createNamespaceTranslator } from '../shared/namespaceTranslator';\nimport type {\n LooseTranslateFunction,\n TranslateFunction,\n} from '../shared/translateFunctionTypes';\n\n/**\n * Overload set for {@link useTranslations}:\n *\n * 1. A bare dictionary key → fully-typed `t()` (autocompleted dot-paths).\n * 2. A nested namespace `'dictionary.sub.scope'` → `t()` accepts relative\n * `string` paths, matching use-intl's scoped-namespace behaviour.\n * 3. No namespace → root scope; the first segment of each key designates\n * the dictionary (`t('about.title')`).\n */\ntype UseTranslations = {\n <N extends DictionaryKeys>(namespace: N): TranslateFunction<N>;\n (namespace: `${string}.${string}`): LooseTranslateFunction;\n (): LooseTranslateFunction;\n};\n\n/**\n * Drop-in for use-intl's `useTranslations`.\n *\n * Messages support ICU MessageFormat syntax: simple arguments (`{name}`),\n * plural (`{count, plural, one {…} other {…}}`, `#`), select, and formatted\n * arguments (`{value, number}`). Rich text is available through `t.rich()`\n * and `t.markup()`.\n *\n * @example\n * ```tsx\n * const t = useTranslations('about');\n * t('counter.label'); // ✓ typed\n * t('items', { count: 3 }); // ICU plural\n *\n * // Scoped to a nested object (use-intl idiom)\n * const t = useTranslations('about.counter');\n * t('label'); // resolves about → counter.label\n *\n * // Rich text\n * t.rich('terms', { link: (chunks) => <a href=\"/terms\">{chunks}</a> });\n * ```\n */\nexport const useTranslations = ((namespace?: string) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n return useMemo(\n () => createNamespaceTranslator(currentLocale as LocalesValues, namespace),\n [currentLocale, namespace]\n );\n}) as UseTranslations;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAa,oBAAoB,cAAuB;CACtD,MAAM,EAAE,QAAQ,kBAAkB,WAAW,sBAAsB,IAAI,EAAE;AAEzE,QAAO,cACC,0BAA0B,eAAgC,UAAU,EAC1E,CAAC,eAAe,UAAU,CAC3B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IntlProvider.d.ts","names":[],"sources":["../../../src/react/IntlProvider.tsx"],"mappings":";;;;;;;AAkBA;;;;;AAoCA;cApCa,YAAA,SAAqB,cAAA;;;;;KAoCtB,iBAAA,GAAoB,IAAA,CAC9B,cAAA,QAAsB,cAAA;EASD;;;;EAFrB,QAAA;EAEA,MAAA,EAAQ,aAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.d.ts","names":[],"sources":["../../../src/react/helpers.ts"],"mappings":";;;;;AAkBA;;cAAa,MAAA,SAAe,QAAA;;;AAM5B;;cAAa,WAAA,SAAoB,aAAA;;;AAUjC;;;;;cAAa,WAAA,SAAoB,aAAA;;;;;;;cAiBpB,YAAA,SAAqB,cAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/react/index.ts"],"mappings":";;;;;;;;;;AAWA;;cAAa,aAAA,QAAoB,MAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/react/useLocale.ts"],"mappings":";;;;;AAUA;;;cAAa,SAAA,SAAkB,WAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTranslations.d.ts","names":[],"sources":["../../../src/react/useTranslations.ts"],"mappings":";;;;;;AAY0C;;;;;;;KAWrC,eAAA;EAAA,WACQ,cAAA,EAAgB,SAAA,EAAW,CAAA,GAAI,iBAAA,CAAkB,CAAA;EAAA,CAC3D,SAAA,0BAAmC,sBAAA;EAAA,IAChC,sBAAA;AAAA;;;;;;;;;;;AAyBN;;;;;;;;;;;;cAAa,eAAA,EAOP,eAAA"}