react-intlayer 7.5.0-canary.1 → 7.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/cjs/client/IntlayerProvider.cjs +8 -8
  2. package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
  3. package/dist/cjs/client/format/useCompact.cjs +2 -2
  4. package/dist/cjs/client/format/useCompact.cjs.map +1 -1
  5. package/dist/cjs/client/format/useCurrency.cjs +2 -2
  6. package/dist/cjs/client/format/useCurrency.cjs.map +1 -1
  7. package/dist/cjs/client/format/useDate.cjs +2 -2
  8. package/dist/cjs/client/format/useDate.cjs.map +1 -1
  9. package/dist/cjs/client/format/useList.cjs +2 -2
  10. package/dist/cjs/client/format/useList.cjs.map +1 -1
  11. package/dist/cjs/client/format/useNumber.cjs +2 -2
  12. package/dist/cjs/client/format/useNumber.cjs.map +1 -1
  13. package/dist/cjs/client/format/usePercentage.cjs +2 -2
  14. package/dist/cjs/client/format/usePercentage.cjs.map +1 -1
  15. package/dist/cjs/client/format/useRelativeTime.cjs +2 -2
  16. package/dist/cjs/client/format/useRelativeTime.cjs.map +1 -1
  17. package/dist/cjs/client/format/useUnit.cjs +2 -2
  18. package/dist/cjs/client/format/useUnit.cjs.map +1 -1
  19. package/dist/cjs/client/t.cjs +2 -2
  20. package/dist/cjs/client/t.cjs.map +1 -1
  21. package/dist/cjs/client/useDictionaryAsync.cjs +3 -3
  22. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  23. package/dist/cjs/client/useDictionaryDynamic.cjs +3 -3
  24. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  25. package/dist/cjs/client/useI18n.cjs +2 -2
  26. package/dist/cjs/client/useI18n.cjs.map +1 -1
  27. package/dist/cjs/client/useLocale.cjs +3 -3
  28. package/dist/cjs/client/useLocale.cjs.map +1 -1
  29. package/dist/cjs/client/useLocaleBase.cjs +3 -3
  30. package/dist/cjs/client/useLocaleBase.cjs.map +1 -1
  31. package/dist/cjs/client/useLocaleStorage.cjs +6 -6
  32. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
  33. package/dist/cjs/client/useTraduction.cjs +2 -2
  34. package/dist/cjs/client/useTraduction.cjs.map +1 -1
  35. package/dist/cjs/editor/ContentSelectorWrapper.cjs +10 -10
  36. package/dist/cjs/editor/ContentSelectorWrapper.cjs.map +1 -1
  37. package/dist/cjs/editor/IntlayerEditorProvider.cjs +10 -10
  38. package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
  39. package/dist/cjs/editor/useEditedContentRenderer.cjs +4 -4
  40. package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
  41. package/dist/cjs/getDictionary.cjs +2 -2
  42. package/dist/cjs/getDictionary.cjs.map +1 -1
  43. package/dist/cjs/getIntlayer.cjs +2 -2
  44. package/dist/cjs/getIntlayer.cjs.map +1 -1
  45. package/dist/cjs/markdown/MarkdownRenderer.cjs +5 -5
  46. package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -1
  47. package/dist/cjs/plugins.cjs +6 -6
  48. package/dist/cjs/plugins.cjs.map +1 -1
  49. package/dist/cjs/server/IntlayerServerProvider.cjs +3 -3
  50. package/dist/cjs/server/IntlayerServerProvider.cjs.map +1 -1
  51. package/dist/cjs/server/format/useCompact.cjs +2 -2
  52. package/dist/cjs/server/format/useCompact.cjs.map +1 -1
  53. package/dist/cjs/server/format/useCurrency.cjs +2 -2
  54. package/dist/cjs/server/format/useCurrency.cjs.map +1 -1
  55. package/dist/cjs/server/format/useDate.cjs +2 -2
  56. package/dist/cjs/server/format/useDate.cjs.map +1 -1
  57. package/dist/cjs/server/format/useList.cjs +2 -2
  58. package/dist/cjs/server/format/useList.cjs.map +1 -1
  59. package/dist/cjs/server/format/useNumber.cjs +2 -2
  60. package/dist/cjs/server/format/useNumber.cjs.map +1 -1
  61. package/dist/cjs/server/format/usePercentage.cjs +2 -2
  62. package/dist/cjs/server/format/usePercentage.cjs.map +1 -1
  63. package/dist/cjs/server/format/useRelativeTime.cjs +2 -2
  64. package/dist/cjs/server/format/useRelativeTime.cjs.map +1 -1
  65. package/dist/cjs/server/format/useUnit.cjs +2 -2
  66. package/dist/cjs/server/format/useUnit.cjs.map +1 -1
  67. package/dist/cjs/server/t.cjs +2 -2
  68. package/dist/cjs/server/t.cjs.map +1 -1
  69. package/dist/cjs/server/useDictionaryAsync.cjs +3 -3
  70. package/dist/cjs/server/useDictionaryAsync.cjs.map +1 -1
  71. package/dist/cjs/server/useDictionaryDynamic.cjs +3 -3
  72. package/dist/cjs/server/useDictionaryDynamic.cjs.map +1 -1
  73. package/dist/cjs/server/useLocale.cjs +3 -3
  74. package/dist/cjs/server/useLocale.cjs.map +1 -1
  75. package/dist/types/client/format/useCurrency.d.ts +2 -2
  76. package/dist/types/client/format/useList.d.ts +2 -2
  77. package/dist/types/client/format/useList.d.ts.map +1 -1
  78. package/dist/types/client/format/useNumber.d.ts +2 -2
  79. package/dist/types/client/format/usePercentage.d.ts +2 -2
  80. package/dist/types/client/format/useRelativeTime.d.ts +2 -2
  81. package/dist/types/client/format/useUnit.d.ts +2 -2
  82. package/dist/types/client/useDictionaryDynamic.d.ts +2 -2
  83. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  84. package/dist/types/client/useIntlayer.d.ts +2 -2
  85. package/dist/types/client/useLocaleBase.d.ts +5 -5
  86. package/dist/types/client/useLocaleStorage.d.ts +5 -5
  87. package/dist/types/server/useDictionary.d.ts +2 -2
  88. package/dist/types/server/useDictionaryAsync.d.ts +2 -2
  89. package/dist/types/server/useDictionaryDynamic.d.ts +2 -2
  90. package/dist/types/server/useIntlayer.d.ts +3 -3
  91. package/dist/types/server/useIntlayer.d.ts.map +1 -1
  92. package/package.json +11 -11
@@ -5,17 +5,17 @@ const require_editor_IntlayerEditorProvider = require('../editor/IntlayerEditorP
5
5
  const require_client_useLocaleStorage = require('./useLocaleStorage.cjs');
6
6
  let react = require("react");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
- let __intlayer_core = require("@intlayer/core");
9
- let __intlayer_editor_react = require("@intlayer/editor-react");
10
- let __intlayer_config_built = require("@intlayer/config/built");
11
- __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
8
+ let _intlayer_core = require("@intlayer/core");
9
+ let _intlayer_editor_react = require("@intlayer/editor-react");
10
+ let _intlayer_config_built = require("@intlayer/config/built");
11
+ _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
12
12
 
13
13
  //#region src/client/IntlayerProvider.tsx
14
14
  /**
15
15
  * Context that store the current locale on the client side
16
16
  */
17
17
  const IntlayerClientContext = (0, react.createContext)({
18
- locale: require_client_useLocaleStorage.localeInStorage ?? __intlayer_config_built.default?.internationalization?.defaultLocale,
18
+ locale: require_client_useLocaleStorage.localeInStorage ?? _intlayer_config_built.default?.internationalization?.defaultLocale,
19
19
  setLocale: () => null,
20
20
  isCookieEnabled: true,
21
21
  disableEditor: false
@@ -28,10 +28,10 @@ const useIntlayerContext = () => (0, react.useContext)(IntlayerClientContext);
28
28
  * Provider that store the current locale on the client side
29
29
  */
30
30
  const IntlayerProviderContent = ({ locale: localeProp, defaultLocale: defaultLocaleProp, children, setLocale: setLocaleProp, disableEditor, isCookieEnabled }) => {
31
- const { internationalization } = __intlayer_config_built.default ?? {};
31
+ const { internationalization } = _intlayer_config_built.default ?? {};
32
32
  const { defaultLocale: defaultLocaleConfig, locales: availableLocales } = internationalization ?? {};
33
33
  const defaultLocale = localeProp ?? require_client_useLocaleStorage.localeInStorage ?? defaultLocaleProp ?? defaultLocaleConfig;
34
- const [currentLocale, setCurrentLocale] = (0, __intlayer_editor_react.useCrossFrameState)(__intlayer_editor_react.MessageKey.INTLAYER_CURRENT_LOCALE, defaultLocale);
34
+ const [currentLocale, setCurrentLocale] = (0, _intlayer_editor_react.useCrossFrameState)(_intlayer_editor_react.MessageKey.INTLAYER_CURRENT_LOCALE, defaultLocale);
35
35
  const setLocaleBase = (newLocale) => {
36
36
  if (currentLocale.toString() === newLocale.toString()) return;
37
37
  if (!availableLocales?.map(String).includes(newLocale)) {
@@ -42,7 +42,7 @@ const IntlayerProviderContent = ({ locale: localeProp, defaultLocale: defaultLoc
42
42
  require_client_useLocaleStorage.setLocaleInStorage(newLocale, isCookieEnabled);
43
43
  };
44
44
  const setLocale = setLocaleProp ?? setLocaleBase;
45
- const resolvedLocale = (0, __intlayer_core.localeResolver)(localeProp ?? currentLocale);
45
+ const resolvedLocale = (0, _intlayer_core.localeResolver)(localeProp ?? currentLocale);
46
46
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IntlayerClientContext.Provider, {
47
47
  value: {
48
48
  locale: resolvedLocale,
@@ -1 +1 @@
1
- {"version":3,"file":"IntlayerProvider.cjs","names":["localeInStorage","configuration","IntlayerProviderContent: FC<IntlayerProviderProps>","MessageKey","IntlayerProvider: FC<IntlayerProviderProps>","IntlayerEditorProvider"],"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport { localeResolver } from '@intlayer/core';\nimport { MessageKey, useCrossFrameState } from '@intlayer/editor-react';\nimport type { LocalesValues } from '@intlayer/types';\nimport {\n createContext,\n type FC,\n type PropsWithChildren,\n useContext,\n} from 'react';\nimport { IntlayerEditorProvider } from '../editor/IntlayerEditorProvider';\nimport { localeInStorage, setLocaleInStorage } from './useLocaleStorage';\n\ntype IntlayerValue = {\n locale: LocalesValues;\n setLocale: (newLocale: LocalesValues) => void;\n disableEditor?: boolean;\n isCookieEnabled?: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeInStorage ?? configuration?.internationalization?.defaultLocale,\n setLocale: () => null,\n isCookieEnabled: true,\n disableEditor: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = PropsWithChildren<{\n locale?: LocalesValues;\n defaultLocale?: LocalesValues;\n setLocale?: (locale: LocalesValues) => void;\n disableEditor?: boolean;\n isCookieEnabled?: boolean;\n}>;\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerProviderContent: FC<IntlayerProviderProps> = ({\n locale: localeProp,\n defaultLocale: defaultLocaleProp,\n children,\n setLocale: setLocaleProp,\n disableEditor,\n isCookieEnabled,\n}) => {\n const { internationalization } = configuration ?? {};\n const { defaultLocale: defaultLocaleConfig, locales: availableLocales } =\n internationalization ?? {};\n\n const defaultLocale =\n localeProp ?? localeInStorage ?? defaultLocaleProp ?? defaultLocaleConfig;\n\n const [currentLocale, setCurrentLocale] = useCrossFrameState(\n MessageKey.INTLAYER_CURRENT_LOCALE,\n defaultLocale\n );\n\n const setLocaleBase = (newLocale: LocalesValues) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleInStorage(newLocale, isCookieEnabled); // Optionally set cookie for persistence\n };\n\n const setLocale = setLocaleProp ?? setLocaleBase;\n\n const resolvedLocale = localeResolver(localeProp ?? currentLocale);\n\n return (\n <IntlayerClientContext.Provider\n value={{\n locale: resolvedLocale,\n setLocale,\n disableEditor,\n }}\n >\n {children}\n </IntlayerClientContext.Provider>\n );\n};\n\nexport const IntlayerProvider: FC<IntlayerProviderProps> = (props) => (\n <IntlayerEditorProvider>\n <IntlayerProviderContent {...props} />\n </IntlayerEditorProvider>\n);\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAa,iDAAqD;CAChE,QAAQA,mDAAmBC,iCAAe,sBAAsB;CAChE,iBAAiB;CACjB,iBAAiB;CACjB,eAAe;CAChB,CAAC;;;;AAKF,MAAa,iDAAsC,sBAAsB;;;;AAazE,MAAaC,2BAAsD,EACjE,QAAQ,YACR,eAAe,mBACf,UACA,WAAW,eACX,eACA,sBACI;CACJ,MAAM,EAAE,yBAAyBD,mCAAiB,EAAE;CACpD,MAAM,EAAE,eAAe,qBAAqB,SAAS,qBACnD,wBAAwB,EAAE;CAE5B,MAAM,gBACJ,cAAcD,mDAAmB,qBAAqB;CAExD,MAAM,CAAC,eAAe,oEACpBG,mCAAW,yBACX,cACD;CAED,MAAM,iBAAiB,cAA6B;AAClD,MAAI,cAAc,UAAU,KAAK,UAAU,UAAU,CAAE;AAEvD,MAAI,CAAC,kBAAkB,IAAI,OAAO,CAAC,SAAS,UAAU,EAAE;AACtD,WAAQ,MAAM,UAAU,UAAU,mBAAmB;AACrD;;AAGF,mBAAiB,UAAU;AAC3B,qDAAmB,WAAW,gBAAgB;;CAGhD,MAAM,YAAY,iBAAiB;CAEnC,MAAM,qDAAgC,cAAc,cAAc;AAElE,QACE,2CAAC,sBAAsB;EACrB,OAAO;GACL,QAAQ;GACR;GACA;GACD;EAEA;GAC8B;;AAIrC,MAAaC,oBAA+C,UAC1D,2CAACC,0EACC,2CAAC,2BAAwB,GAAI,QAAS,GACf"}
1
+ {"version":3,"file":"IntlayerProvider.cjs","names":["localeInStorage","configuration","IntlayerProviderContent: FC<IntlayerProviderProps>","MessageKey","IntlayerProvider: FC<IntlayerProviderProps>","IntlayerEditorProvider"],"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport { localeResolver } from '@intlayer/core';\nimport { MessageKey, useCrossFrameState } from '@intlayer/editor-react';\nimport type { LocalesValues } from '@intlayer/types';\nimport {\n createContext,\n type FC,\n type PropsWithChildren,\n useContext,\n} from 'react';\nimport { IntlayerEditorProvider } from '../editor/IntlayerEditorProvider';\nimport { localeInStorage, setLocaleInStorage } from './useLocaleStorage';\n\ntype IntlayerValue = {\n locale: LocalesValues;\n setLocale: (newLocale: LocalesValues) => void;\n disableEditor?: boolean;\n isCookieEnabled?: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeInStorage ?? configuration?.internationalization?.defaultLocale,\n setLocale: () => null,\n isCookieEnabled: true,\n disableEditor: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = PropsWithChildren<{\n locale?: LocalesValues;\n defaultLocale?: LocalesValues;\n setLocale?: (locale: LocalesValues) => void;\n disableEditor?: boolean;\n isCookieEnabled?: boolean;\n}>;\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerProviderContent: FC<IntlayerProviderProps> = ({\n locale: localeProp,\n defaultLocale: defaultLocaleProp,\n children,\n setLocale: setLocaleProp,\n disableEditor,\n isCookieEnabled,\n}) => {\n const { internationalization } = configuration ?? {};\n const { defaultLocale: defaultLocaleConfig, locales: availableLocales } =\n internationalization ?? {};\n\n const defaultLocale =\n localeProp ?? localeInStorage ?? defaultLocaleProp ?? defaultLocaleConfig;\n\n const [currentLocale, setCurrentLocale] = useCrossFrameState(\n MessageKey.INTLAYER_CURRENT_LOCALE,\n defaultLocale\n );\n\n const setLocaleBase = (newLocale: LocalesValues) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleInStorage(newLocale, isCookieEnabled); // Optionally set cookie for persistence\n };\n\n const setLocale = setLocaleProp ?? setLocaleBase;\n\n const resolvedLocale = localeResolver(localeProp ?? currentLocale);\n\n return (\n <IntlayerClientContext.Provider\n value={{\n locale: resolvedLocale,\n setLocale,\n disableEditor,\n }}\n >\n {children}\n </IntlayerClientContext.Provider>\n );\n};\n\nexport const IntlayerProvider: FC<IntlayerProviderProps> = (props) => (\n <IntlayerEditorProvider>\n <IntlayerProviderContent {...props} />\n </IntlayerEditorProvider>\n);\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAa,iDAAqD;CAChE,QAAQA,mDAAmBC,gCAAe,sBAAsB;CAChE,iBAAiB;CACjB,iBAAiB;CACjB,eAAe;CAChB,CAAC;;;;AAKF,MAAa,iDAAsC,sBAAsB;;;;AAazE,MAAaC,2BAAsD,EACjE,QAAQ,YACR,eAAe,mBACf,UACA,WAAW,eACX,eACA,sBACI;CACJ,MAAM,EAAE,yBAAyBD,kCAAiB,EAAE;CACpD,MAAM,EAAE,eAAe,qBAAqB,SAAS,qBACnD,wBAAwB,EAAE;CAE5B,MAAM,gBACJ,cAAcD,mDAAmB,qBAAqB;CAExD,MAAM,CAAC,eAAe,mEACpBG,kCAAW,yBACX,cACD;CAED,MAAM,iBAAiB,cAA6B;AAClD,MAAI,cAAc,UAAU,KAAK,UAAU,UAAU,CAAE;AAEvD,MAAI,CAAC,kBAAkB,IAAI,OAAO,CAAC,SAAS,UAAU,EAAE;AACtD,WAAQ,MAAM,UAAU,UAAU,mBAAmB;AACrD;;AAGF,mBAAiB,UAAU;AAC3B,qDAAmB,WAAW,gBAAgB;;CAGhD,MAAM,YAAY,iBAAiB;CAEnC,MAAM,oDAAgC,cAAc,cAAc;AAElE,QACE,2CAAC,sBAAsB;EACrB,OAAO;GACL,QAAQ;GACR;GACA;GACD;EAEA;GAC8B;;AAIrC,MAAaC,oBAA+C,UAC1D,2CAACC,0EACC,2CAAC,2BAAwB,GAAI,QAAS,GACf"}
@@ -3,7 +3,7 @@
3
3
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('../IntlayerProvider.cjs');
5
5
  let react = require("react");
6
- let __intlayer_core = require("@intlayer/core");
6
+ let _intlayer_core = require("@intlayer/core");
7
7
 
8
8
  //#region src/client/format/useCompact.ts
9
9
  /**
@@ -18,7 +18,7 @@ let __intlayer_core = require("@intlayer/core");
18
18
  */
19
19
  const useCompact = () => {
20
20
  const { locale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
21
- return (0, react.useCallback)((...args) => (0, __intlayer_core.compact)(args[0], {
21
+ return (0, react.useCallback)((...args) => (0, _intlayer_core.compact)(args[0], {
22
22
  ...args[1],
23
23
  locale: args[1]?.locale ?? locale
24
24
  }), [locale]);
@@ -1 +1 @@
1
- {"version":3,"file":"useCompact.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;AAgBA,MAAa,mBAAmB;CAC9B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,sCACM,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useCompact.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;AAgBA,MAAa,mBAAmB;CAC9B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,qCACM,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
@@ -3,7 +3,7 @@
3
3
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('../IntlayerProvider.cjs');
5
5
  let react = require("react");
6
- let __intlayer_core = require("@intlayer/core");
6
+ let _intlayer_core = require("@intlayer/core");
7
7
 
8
8
  //#region src/client/format/useCurrency.ts
9
9
  /**
@@ -32,7 +32,7 @@ let __intlayer_core = require("@intlayer/core");
32
32
  */
33
33
  const useCurrency = () => {
34
34
  const { locale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
35
- return (0, react.useCallback)((...args) => (0, __intlayer_core.currency)(args[0], {
35
+ return (0, react.useCallback)((...args) => (0, _intlayer_core.currency)(args[0], {
36
36
  ...args[1],
37
37
  locale: args[1]?.locale ?? locale
38
38
  }), [locale]);
@@ -1 +1 @@
1
- {"version":3,"file":"useCurrency.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,oBAAoB;CAC/B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,uCACO,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useCurrency.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,oBAAoB;CAC/B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,sCACO,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
@@ -3,7 +3,7 @@
3
3
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('../IntlayerProvider.cjs');
5
5
  let react = require("react");
6
- let __intlayer_core = require("@intlayer/core");
6
+ let _intlayer_core = require("@intlayer/core");
7
7
 
8
8
  //#region src/client/format/useDate.ts
9
9
  /**
@@ -34,7 +34,7 @@ let __intlayer_core = require("@intlayer/core");
34
34
  */
35
35
  const useDate = () => {
36
36
  const { locale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
37
- return (...args) => (0, __intlayer_core.date)(args[0], {
37
+ return (...args) => (0, _intlayer_core.date)(args[0], {
38
38
  ...args[1],
39
39
  locale: args[1]?.locale ?? locale
40
40
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useDate.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,SAAQ,GAAG,mCACJ,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
1
+ {"version":3,"file":"useDate.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,SAAQ,GAAG,kCACJ,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
@@ -3,7 +3,7 @@
3
3
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('../IntlayerProvider.cjs');
5
5
  let react = require("react");
6
- let __intlayer_core = require("@intlayer/core");
6
+ let _intlayer_core = require("@intlayer/core");
7
7
 
8
8
  //#region src/client/format/useList.ts
9
9
  /**
@@ -29,7 +29,7 @@ let __intlayer_core = require("@intlayer/core");
29
29
  */
30
30
  const useList = () => {
31
31
  const { locale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
32
- return (0, react.useCallback)((...args) => (0, __intlayer_core.list)(args[0], {
32
+ return (0, react.useCallback)((...args) => (0, _intlayer_core.list)(args[0], {
33
33
  ...args[1],
34
34
  locale: args[1]?.locale ?? locale
35
35
  }), [locale]);
@@ -1 +1 @@
1
- {"version":3,"file":"useList.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,mCACG,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useList.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,kCACG,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
@@ -3,7 +3,7 @@
3
3
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('../IntlayerProvider.cjs');
5
5
  let react = require("react");
6
- let __intlayer_core = require("@intlayer/core");
6
+ let _intlayer_core = require("@intlayer/core");
7
7
 
8
8
  //#region src/client/format/useNumber.ts
9
9
  /**
@@ -30,7 +30,7 @@ let __intlayer_core = require("@intlayer/core");
30
30
  */
31
31
  const useNumber = () => {
32
32
  const { locale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
33
- return (0, react.useCallback)((...args) => (0, __intlayer_core.number)(args[0], {
33
+ return (0, react.useCallback)((...args) => (0, _intlayer_core.number)(args[0], {
34
34
  ...args[1],
35
35
  locale: args[1]?.locale ?? locale
36
36
  }), [locale]);
@@ -1 +1 @@
1
- {"version":3,"file":"useNumber.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,kBAAkB;CAC7B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,qCACK,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useNumber.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,kBAAkB;CAC7B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,oCACK,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
@@ -3,7 +3,7 @@
3
3
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('../IntlayerProvider.cjs');
5
5
  let react = require("react");
6
- let __intlayer_core = require("@intlayer/core");
6
+ let _intlayer_core = require("@intlayer/core");
7
7
 
8
8
  //#region src/client/format/usePercentage.ts
9
9
  /**
@@ -26,7 +26,7 @@ let __intlayer_core = require("@intlayer/core");
26
26
  */
27
27
  const usePercentage = () => {
28
28
  const { locale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
29
- return (0, react.useCallback)((...args) => (0, __intlayer_core.percentage)(args[0], {
29
+ return (0, react.useCallback)((...args) => (0, _intlayer_core.percentage)(args[0], {
30
30
  ...args[1],
31
31
  locale: args[1]?.locale ?? locale
32
32
  }), [locale]);
@@ -1 +1 @@
1
- {"version":3,"file":"usePercentage.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,sBAAsB;CACjC,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,yCACS,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"usePercentage.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,sBAAsB;CACjC,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,wCACS,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
@@ -3,7 +3,7 @@
3
3
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('../IntlayerProvider.cjs');
5
5
  let react = require("react");
6
- let __intlayer_core = require("@intlayer/core");
6
+ let _intlayer_core = require("@intlayer/core");
7
7
 
8
8
  //#region src/client/format/useRelativeTime.ts
9
9
  /**
@@ -26,7 +26,7 @@ let __intlayer_core = require("@intlayer/core");
26
26
  */
27
27
  const useRelativeTime = () => {
28
28
  const { locale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
29
- return (0, react.useCallback)((...args) => (0, __intlayer_core.relativeTime)(args[0], args[1], {
29
+ return (0, react.useCallback)((...args) => (0, _intlayer_core.relativeTime)(args[0], args[1], {
30
30
  ...args[2],
31
31
  locale: args[2]?.locale ?? locale
32
32
  }), [locale]);
@@ -1 +1 @@
1
- {"version":3,"file":"useRelativeTime.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,wBAAwB;CACnC,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,2CACW,KAAK,IAAI,KAAK,IAAI;EAC7B,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useRelativeTime.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,wBAAwB;CACnC,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,0CACW,KAAK,IAAI,KAAK,IAAI;EAC7B,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
@@ -3,7 +3,7 @@
3
3
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('../IntlayerProvider.cjs');
5
5
  let react = require("react");
6
- let __intlayer_core = require("@intlayer/core");
6
+ let _intlayer_core = require("@intlayer/core");
7
7
 
8
8
  //#region src/client/format/useUnit.ts
9
9
  /**
@@ -25,7 +25,7 @@ let __intlayer_core = require("@intlayer/core");
25
25
  */
26
26
  const useUnit = () => {
27
27
  const { locale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
28
- return (0, react.useCallback)((...args) => (0, __intlayer_core.units)(args[0], {
28
+ return (0, react.useCallback)((...args) => (0, _intlayer_core.units)(args[0], {
29
29
  ...args[1],
30
30
  locale: args[1]?.locale ?? locale
31
31
  }), [locale]);
@@ -1 +1 @@
1
- {"version":3,"file":"useUnit.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,oCACI,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
1
+ {"version":3,"file":"useUnit.cjs","names":["IntlayerClientContext"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,gCACG,GAAG,mCACI,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
@@ -3,7 +3,7 @@
3
3
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
5
5
  let react = require("react");
6
- let __intlayer_core = require("@intlayer/core");
6
+ let _intlayer_core = require("@intlayer/core");
7
7
 
8
8
  //#region src/client/t.ts
9
9
  /**
@@ -13,7 +13,7 @@ let __intlayer_core = require("@intlayer/core");
13
13
  */
14
14
  const t = (multilangContent, locale) => {
15
15
  const { locale: currentLocale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
16
- return (0, __intlayer_core.getTranslation)(multilangContent, locale ?? currentLocale);
16
+ return (0, _intlayer_core.getTranslation)(multilangContent, locale ?? currentLocale);
17
17
  };
18
18
 
19
19
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"t.cjs","names":["IntlayerClientContext"],"sources":["../../../src/client/t.ts"],"sourcesContent":["'use client';\n\nimport { getTranslation } from '@intlayer/core';\nimport type { LocalesValues, StrictModeLocaleMap } from '@intlayer/types';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, this function returns the translation of the provided multilang content.\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const t = <Content = string>(\n multilangContent: StrictModeLocaleMap<Content>,\n locale?: LocalesValues\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = locale ?? currentLocale;\n\n return getTranslation<Content>(multilangContent, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,KACX,kBACA,WACG;CACH,MAAM,EAAE,QAAQ,wCAA6BA,sDAAsB;AAGnE,4CAA+B,kBAFV,UAAU,cAE+B"}
1
+ {"version":3,"file":"t.cjs","names":["IntlayerClientContext"],"sources":["../../../src/client/t.ts"],"sourcesContent":["'use client';\n\nimport { getTranslation } from '@intlayer/core';\nimport type { LocalesValues, StrictModeLocaleMap } from '@intlayer/types';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, this function returns the translation of the provided multilang content.\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const t = <Content = string>(\n multilangContent: StrictModeLocaleMap<Content>,\n locale?: LocalesValues\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = locale ?? currentLocale;\n\n return getTranslation<Content>(multilangContent, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,KACX,kBACA,WACG;CACH,MAAM,EAAE,QAAQ,wCAA6BA,sDAAsB;AAGnE,2CAA+B,kBAFV,UAAU,cAE+B"}
@@ -4,8 +4,8 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
5
5
  const require_client_useDictionary = require('./useDictionary.cjs');
6
6
  let react = require("react");
7
- let __intlayer_config_built = require("@intlayer/config/built");
8
- __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
7
+ let _intlayer_config_built = require("@intlayer/config/built");
8
+ _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
9
9
 
10
10
  //#region src/client/useDictionaryAsync.ts
11
11
  /**
@@ -15,7 +15,7 @@ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_bui
15
15
  */
16
16
  const useDictionaryAsync = async (dictionaryPromise, locale) => {
17
17
  const { locale: currentLocale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
18
- const localeTarget = (0, react.useMemo)(() => locale ?? currentLocale ?? __intlayer_config_built.default?.internationalization.defaultLocale, [currentLocale, locale]);
18
+ const localeTarget = (0, react.useMemo)(() => locale ?? currentLocale ?? _intlayer_config_built.default?.internationalization.defaultLocale, [currentLocale, locale]);
19
19
  return require_client_useDictionary.useDictionary(await (0, react.useMemo)(async () => await dictionaryPromise[localeTarget]?.(), [dictionaryPromise, localeTarget]), localeTarget);
20
20
  };
21
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryAsync.cjs","names":["IntlayerClientContext","configuration","useDictionary"],"sources":["../../../src/client/useDictionaryAsync.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n Dictionary,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryAsync = async <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n locale?: L\n): Promise<T> => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n\n const localeTarget = useMemo(\n () =>\n locale ??\n currentLocale ??\n configuration?.internationalization.defaultLocale,\n [currentLocale, locale]\n );\n\n const dictionary = await useMemo(\n async () =>\n (await dictionaryPromise[\n localeTarget as keyof typeof dictionaryPromise\n ]?.()) as T,\n [dictionaryPromise, localeTarget]\n );\n\n return useDictionary<T, L>(dictionary, localeTarget as L) as any;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAa,qBAAqB,OAIhC,mBACA,WACe;CACf,MAAM,EAAE,QAAQ,wCAA6BA,sDAAsB;CAEnE,MAAM,wCAEF,UACA,iBACAC,iCAAe,qBAAqB,eACtC,CAAC,eAAe,OAAO,CACxB;AAUD,QAAOC,2CARY,yBACjB,YACG,MAAM,kBACL,iBACG,EACP,CAAC,mBAAmB,aAAa,CAClC,EAEsC,aAAkB"}
1
+ {"version":3,"file":"useDictionaryAsync.cjs","names":["IntlayerClientContext","configuration","useDictionary"],"sources":["../../../src/client/useDictionaryAsync.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n Dictionary,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryAsync = async <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n locale?: L\n): Promise<T> => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n\n const localeTarget = useMemo(\n () =>\n locale ??\n currentLocale ??\n configuration?.internationalization.defaultLocale,\n [currentLocale, locale]\n );\n\n const dictionary = await useMemo(\n async () =>\n (await dictionaryPromise[\n localeTarget as keyof typeof dictionaryPromise\n ]?.()) as T,\n [dictionaryPromise, localeTarget]\n );\n\n return useDictionary<T, L>(dictionary, localeTarget as L) as any;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAa,qBAAqB,OAIhC,mBACA,WACe;CACf,MAAM,EAAE,QAAQ,wCAA6BA,sDAAsB;CAEnE,MAAM,wCAEF,UACA,iBACAC,gCAAe,qBAAqB,eACtC,CAAC,eAAe,OAAO,CACxB;AAUD,QAAOC,2CARY,yBACjB,YACG,MAAM,kBACL,iBACG,EACP,CAAC,mBAAmB,aAAa,CAClC,EAEsC,aAAkB"}
@@ -5,8 +5,8 @@ const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
5
5
  const require_client_useDictionary = require('./useDictionary.cjs');
6
6
  const require_client_useLoadDynamic = require('./useLoadDynamic.cjs');
7
7
  let react = require("react");
8
- let __intlayer_config_built = require("@intlayer/config/built");
9
- __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
8
+ let _intlayer_config_built = require("@intlayer/config/built");
9
+ _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
10
10
 
11
11
  //#region src/client/useDictionaryDynamic.ts
12
12
  /**
@@ -16,7 +16,7 @@ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_bui
16
16
  */
17
17
  const useDictionaryDynamic = (dictionaryPromise, key, locale) => {
18
18
  const { locale: currentLocale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
19
- const localeTarget = (0, react.useMemo)(() => locale ?? currentLocale ?? __intlayer_config_built.default?.internationalization.defaultLocale, [currentLocale, locale]);
19
+ const localeTarget = (0, react.useMemo)(() => locale ?? currentLocale ?? _intlayer_config_built.default?.internationalization.defaultLocale, [currentLocale, locale]);
20
20
  return require_client_useDictionary.useDictionary(require_client_useLoadDynamic.useLoadDynamic(`${String(key)}.${localeTarget}`, dictionaryPromise[localeTarget]?.()), localeTarget);
21
21
  };
22
22
 
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.cjs","names":["IntlayerClientContext","configuration","useDictionary","useLoadDynamic"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type {\n Dictionary,\n DictionaryKeys,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = useMemo(\n () =>\n locale ??\n currentLocale ??\n configuration?.internationalization.defaultLocale,\n [currentLocale, locale]\n );\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget}`,\n (dictionaryPromise as any)[localeTarget]?.()\n ) as T;\n\n return useDictionary(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAa,wBAIX,mBACA,KACA,WACG;CACH,MAAM,EAAE,QAAQ,wCAA6BA,sDAAsB;CACnE,MAAM,wCAEF,UACA,iBACAC,iCAAe,qBAAqB,eACtC,CAAC,eAAe,OAAO,CACxB;AAOD,QAAOC,2CALYC,6CACjB,GAAG,OAAO,IAAI,CAAC,GAAG,gBACjB,kBAA0B,iBAAiB,CAC7C,EAEgC,aAAa"}
1
+ {"version":3,"file":"useDictionaryDynamic.cjs","names":["IntlayerClientContext","configuration","useDictionary","useLoadDynamic"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type {\n Dictionary,\n DictionaryKeys,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = useMemo(\n () =>\n locale ??\n currentLocale ??\n configuration?.internationalization.defaultLocale,\n [currentLocale, locale]\n );\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget}`,\n (dictionaryPromise as any)[localeTarget]?.()\n ) as T;\n\n return useDictionary(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAa,wBAIX,mBACA,KACA,WACG;CACH,MAAM,EAAE,QAAQ,wCAA6BA,sDAAsB;CACnE,MAAM,wCAEF,UACA,iBACAC,gCAAe,qBAAqB,eACtC,CAAC,eAAe,OAAO,CACxB;AAOD,QAAOC,2CALYC,6CACjB,GAAG,OAAO,IAAI,CAAC,GAAG,gBACjB,kBAA0B,iBAAiB,CAC7C,EAEgC,aAAa"}
@@ -3,7 +3,7 @@
3
3
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
5
5
  let react = require("react");
6
- let __intlayer_core = require("@intlayer/core");
6
+ let _intlayer_core = require("@intlayer/core");
7
7
 
8
8
  //#region src/client/useI18n.ts
9
9
  /**
@@ -26,7 +26,7 @@ let __intlayer_core = require("@intlayer/core");
26
26
  const useI18n = (namespace, locale) => {
27
27
  const { locale: currentLocale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
28
28
  const localeTarget = (0, react.useMemo)(() => locale ?? currentLocale, [currentLocale, locale]);
29
- const dictionaryContent = (0, react.useMemo)(() => (0, __intlayer_core.getIntlayer)(namespace, localeTarget), [namespace, localeTarget]);
29
+ const dictionaryContent = (0, react.useMemo)(() => (0, _intlayer_core.getIntlayer)(namespace, localeTarget), [namespace, localeTarget]);
30
30
  const t = (path) => {
31
31
  if (!path) return dictionaryContent;
32
32
  const pathArray = path.split(".");
@@ -1 +1 @@
1
- {"version":3,"file":"useI18n.cjs","names":["IntlayerClientContext","dictionaryContent: DeepTransformContent<DictionaryRegistryContent<T>>","current: any"],"sources":["../../../src/client/useI18n.ts"],"sourcesContent":["'use client';\n\nimport { getIntlayer, type ValidDotPathsFor } from '@intlayer/core';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n GetSubPath,\n LocalesValues,\n} from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport type { DeepTransformContent } from '../plugins';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * Hook that provides a translation function `t()` for accessing nested content by key.\n * This hook mimics the pattern found in libraries like i18next, next-intl, and vue-i18n.\n *\n * @param namespace - The dictionary key to scope translations to\n * @param locale - Optional locale override. If not provided, uses the current context locale\n * @returns A translation function `t(key)` that returns the translated content for the given key\n *\n * @example\n * ```tsx\n * const t = useI18n('IndexPage');\n * const title = t('title'); // Returns translated string for 'IndexPage.title'\n * const nestedContent = t('section.subtitle'); // Returns 'IndexPage.section.subtitle'\n * // For attributes like `aria-label`, use `.value` to get the plain string\n * const ariaLabel = t('button.ariaLabel').value; // 'Close modal'\n * ```\n */\nexport const useI18n = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n namespace: T,\n locale?: L\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = useMemo(\n () => locale ?? currentLocale,\n [currentLocale, locale]\n );\n\n // Get the dictionary content for the namespace\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const dictionaryContent: DeepTransformContent<DictionaryRegistryContent<T>> =\n useMemo(\n () => getIntlayer<T, L>(namespace, localeTarget as L),\n [namespace, localeTarget]\n );\n\n // Return the translation function\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const t = <P extends ValidDotPathsFor<T>>(\n path: P\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n ): GetSubPath<DeepTransformContent<DictionaryRegistryContent<T>>, P> => {\n if (!path) {\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n return dictionaryContent as any;\n }\n\n const pathArray = (path as string).split('.');\n let current: any = dictionaryContent;\n\n for (const key of pathArray) {\n current = current?.[key];\n if (current === undefined) {\n // Return the whole dictionary as fallback if path is not found\n return dictionaryContent as any;\n }\n }\n\n return current;\n };\n\n return t;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,WAIX,WACA,WACG;CACH,MAAM,EAAE,QAAQ,wCAA6BA,sDAAsB;CACnE,MAAM,wCACE,UAAU,eAChB,CAAC,eAAe,OAAO,CACxB;CAID,MAAMC,8EAEsB,WAAW,aAAkB,EACrD,CAAC,WAAW,aAAa,CAC1B;CAIH,MAAM,KACJ,SAEsE;AACtE,MAAI,CAAC,KAEH,QAAO;EAGT,MAAM,YAAa,KAAgB,MAAM,IAAI;EAC7C,IAAIC,UAAe;AAEnB,OAAK,MAAM,OAAO,WAAW;AAC3B,aAAU,UAAU;AACpB,OAAI,YAAY,OAEd,QAAO;;AAIX,SAAO;;AAGT,QAAO"}
1
+ {"version":3,"file":"useI18n.cjs","names":["IntlayerClientContext","dictionaryContent: DeepTransformContent<DictionaryRegistryContent<T>>","current: any"],"sources":["../../../src/client/useI18n.ts"],"sourcesContent":["'use client';\n\nimport { getIntlayer, type ValidDotPathsFor } from '@intlayer/core';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n GetSubPath,\n LocalesValues,\n} from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport type { DeepTransformContent } from '../plugins';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * Hook that provides a translation function `t()` for accessing nested content by key.\n * This hook mimics the pattern found in libraries like i18next, next-intl, and vue-i18n.\n *\n * @param namespace - The dictionary key to scope translations to\n * @param locale - Optional locale override. If not provided, uses the current context locale\n * @returns A translation function `t(key)` that returns the translated content for the given key\n *\n * @example\n * ```tsx\n * const t = useI18n('IndexPage');\n * const title = t('title'); // Returns translated string for 'IndexPage.title'\n * const nestedContent = t('section.subtitle'); // Returns 'IndexPage.section.subtitle'\n * // For attributes like `aria-label`, use `.value` to get the plain string\n * const ariaLabel = t('button.ariaLabel').value; // 'Close modal'\n * ```\n */\nexport const useI18n = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n namespace: T,\n locale?: L\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = useMemo(\n () => locale ?? currentLocale,\n [currentLocale, locale]\n );\n\n // Get the dictionary content for the namespace\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const dictionaryContent: DeepTransformContent<DictionaryRegistryContent<T>> =\n useMemo(\n () => getIntlayer<T, L>(namespace, localeTarget as L),\n [namespace, localeTarget]\n );\n\n // Return the translation function\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const t = <P extends ValidDotPathsFor<T>>(\n path: P\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n ): GetSubPath<DeepTransformContent<DictionaryRegistryContent<T>>, P> => {\n if (!path) {\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n return dictionaryContent as any;\n }\n\n const pathArray = (path as string).split('.');\n let current: any = dictionaryContent;\n\n for (const key of pathArray) {\n current = current?.[key];\n if (current === undefined) {\n // Return the whole dictionary as fallback if path is not found\n return dictionaryContent as any;\n }\n }\n\n return current;\n };\n\n return t;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,WAIX,WACA,WACG;CACH,MAAM,EAAE,QAAQ,wCAA6BA,sDAAsB;CACnE,MAAM,wCACE,UAAU,eAChB,CAAC,eAAe,OAAO,CACxB;CAID,MAAMC,6EAEsB,WAAW,aAAkB,EACrD,CAAC,WAAW,aAAa,CAC1B;CAIH,MAAM,KACJ,SAEsE;AACtE,MAAI,CAAC,KAEH,QAAO;EAGT,MAAM,YAAa,KAAgB,MAAM,IAAI;EAC7C,IAAIC,UAAe;AAEnB,OAAK,MAAM,OAAO,WAAW;AAC3B,aAAU,UAAU;AACpB,OAAI,YAAY,OAEd,QAAO;;AAIX,SAAO;;AAGT,QAAO"}
@@ -4,15 +4,15 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_useLocaleStorage = require('./useLocaleStorage.cjs');
5
5
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
6
6
  let react = require("react");
7
- let __intlayer_config_built = require("@intlayer/config/built");
8
- __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
7
+ let _intlayer_config_built = require("@intlayer/config/built");
8
+ _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
9
9
 
10
10
  //#region src/client/useLocale.ts
11
11
  /**
12
12
  * On the client side, hook to get the current locale and all related fields
13
13
  */
14
14
  const useLocale = ({ isCookieEnabled, onLocaleChange } = {}) => {
15
- const { defaultLocale, locales: availableLocales } = __intlayer_config_built.default?.internationalization ?? {};
15
+ const { defaultLocale, locales: availableLocales } = _intlayer_config_built.default?.internationalization ?? {};
16
16
  const { locale, setLocale: setLocaleState, isCookieEnabled: isCookieEnabledContext } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
17
17
  return {
18
18
  locale,
@@ -1 +1 @@
1
- {"version":3,"file":"useLocale.cjs","names":["configuration","IntlayerClientContext","locale"],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type { DeclaredLocales, LocalesValues } from '@intlayer/types';\nimport { useCallback, useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\ntype UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: LocalesValues) => void;\n};\n\ntype UseLocaleResult = {\n locale: DeclaredLocales;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n};\n\n/**\n * On the client side, hook to get the current locale and all related fields\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: UseLocaleProps = {}): UseLocaleResult => {\n const { defaultLocale, locales: availableLocales } =\n configuration?.internationalization ?? {};\n\n const {\n locale,\n setLocale: setLocaleState,\n isCookieEnabled: isCookieEnabledContext,\n } = useContext(IntlayerClientContext);\n\n const setLocale = useCallback(\n (locale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(locale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setLocaleState(locale);\n setLocaleInStorage(\n locale,\n isCookieEnabled ?? isCookieEnabledContext ?? true\n );\n onLocaleChange?.(locale);\n },\n [availableLocales, onLocaleChange, setLocaleState]\n );\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n } as UseLocaleResult;\n};\n"],"mappings":";;;;;;;;;;;;;AAuBA,MAAa,aAAa,EACxB,iBACA,mBACkB,EAAE,KAAsB;CAC1C,MAAM,EAAE,eAAe,SAAS,qBAC9BA,iCAAe,wBAAwB,EAAE;CAE3C,MAAM,EACJ,QACA,WAAW,gBACX,iBAAiB,iDACJC,sDAAsB;AAmBrC,QAAO;EACL;EACA;EACA;EACA,mCApBC,aAA0B;AACzB,OAAI,CAAC,kBAAkB,IAAI,OAAO,CAAC,SAASC,SAAO,EAAE;AACnD,YAAQ,MAAM,UAAUA,SAAO,mBAAmB;AAClD;;AAGF,kBAAeA,SAAO;AACtB,sDACEA,UACA,mBAAmB,0BAA0B,KAC9C;AACD,oBAAiBA,SAAO;KAE1B;GAAC;GAAkB;GAAgB;GAAe,CACnD;EAOA"}
1
+ {"version":3,"file":"useLocale.cjs","names":["configuration","IntlayerClientContext","locale"],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type { DeclaredLocales, LocalesValues } from '@intlayer/types';\nimport { useCallback, useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\ntype UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: LocalesValues) => void;\n};\n\ntype UseLocaleResult = {\n locale: DeclaredLocales;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n};\n\n/**\n * On the client side, hook to get the current locale and all related fields\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: UseLocaleProps = {}): UseLocaleResult => {\n const { defaultLocale, locales: availableLocales } =\n configuration?.internationalization ?? {};\n\n const {\n locale,\n setLocale: setLocaleState,\n isCookieEnabled: isCookieEnabledContext,\n } = useContext(IntlayerClientContext);\n\n const setLocale = useCallback(\n (locale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(locale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setLocaleState(locale);\n setLocaleInStorage(\n locale,\n isCookieEnabled ?? isCookieEnabledContext ?? true\n );\n onLocaleChange?.(locale);\n },\n [availableLocales, onLocaleChange, setLocaleState]\n );\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n } as UseLocaleResult;\n};\n"],"mappings":";;;;;;;;;;;;;AAuBA,MAAa,aAAa,EACxB,iBACA,mBACkB,EAAE,KAAsB;CAC1C,MAAM,EAAE,eAAe,SAAS,qBAC9BA,gCAAe,wBAAwB,EAAE;CAE3C,MAAM,EACJ,QACA,WAAW,gBACX,iBAAiB,iDACJC,sDAAsB;AAmBrC,QAAO;EACL;EACA;EACA;EACA,mCApBC,aAA0B;AACzB,OAAI,CAAC,kBAAkB,IAAI,OAAO,CAAC,SAASC,SAAO,EAAE;AACnD,YAAQ,MAAM,UAAUA,SAAO,mBAAmB;AAClD;;AAGF,kBAAeA,SAAO;AACtB,sDACEA,UACA,mBAAmB,0BAA0B,KAC9C;AACD,oBAAiBA,SAAO;KAE1B;GAAC;GAAkB;GAAgB;GAAe,CACnD;EAOA"}
@@ -3,11 +3,11 @@
3
3
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
4
4
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
5
5
  let react = require("react");
6
- let __intlayer_config_built = require("@intlayer/config/built");
7
- __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
6
+ let _intlayer_config_built = require("@intlayer/config/built");
7
+ _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
8
8
 
9
9
  //#region src/client/useLocaleBase.ts
10
- const { defaultLocale, locales: availableLocales } = __intlayer_config_built.default.internationalization;
10
+ const { defaultLocale, locales: availableLocales } = _intlayer_config_built.default.internationalization;
11
11
  /**
12
12
  * On the client side, hook to get the current locale and all related fields
13
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleBase.cjs","names":["configuration","IntlayerClientContext"],"sources":["../../../src/client/useLocaleBase.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\nconst { defaultLocale, locales: availableLocales } =\n configuration.internationalization;\n\n/**\n * On the client side, hook to get the current locale and all related fields\n */\nexport const useLocaleBase = () => {\n const { locale, setLocale } = useContext(IntlayerClientContext);\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n };\n};\n"],"mappings":";;;;;;;;;AAMA,MAAM,EAAE,eAAe,SAAS,qBAC9BA,gCAAc;;;;AAKhB,MAAa,sBAAsB;CACjC,MAAM,EAAE,QAAQ,oCAAyBC,sDAAsB;AAE/D,QAAO;EACL;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"useLocaleBase.cjs","names":["configuration","IntlayerClientContext"],"sources":["../../../src/client/useLocaleBase.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\nconst { defaultLocale, locales: availableLocales } =\n configuration.internationalization;\n\n/**\n * On the client side, hook to get the current locale and all related fields\n */\nexport const useLocaleBase = () => {\n const { locale, setLocale } = useContext(IntlayerClientContext);\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n };\n};\n"],"mappings":";;;;;;;;;AAMA,MAAM,EAAE,eAAe,SAAS,qBAC9BA,+BAAc;;;;AAKhB,MAAa,sBAAsB;CACjC,MAAM,EAAE,QAAQ,oCAAyBC,sDAAsB;AAE/D,QAAO;EACL;EACA;EACA;EACA;EACD"}
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  let react = require("react");
3
- let __intlayer_core = require("@intlayer/core");
3
+ let _intlayer_core = require("@intlayer/core");
4
4
 
5
5
  //#region src/client/useLocaleStorage.ts
6
6
  /**
@@ -9,7 +9,7 @@ let __intlayer_core = require("@intlayer/core");
9
9
  /**
10
10
  * Get the locale cookie
11
11
  */
12
- const localeInStorage = (0, __intlayer_core.getLocaleFromStorage)(__intlayer_core.localeStorageOptions);
12
+ const localeInStorage = (0, _intlayer_core.getLocaleFromStorage)(_intlayer_core.localeStorageOptions);
13
13
  /**
14
14
  * @deprecated Use localeInStorage instead
15
15
  *
@@ -19,8 +19,8 @@ const localeCookie = localeInStorage;
19
19
  /**
20
20
  * Set the locale cookie
21
21
  */
22
- const setLocaleInStorage = (locale, isCookieEnabled) => (0, __intlayer_core.setLocaleInStorage)(locale, {
23
- ...__intlayer_core.localeStorageOptions,
22
+ const setLocaleInStorage = (locale, isCookieEnabled) => (0, _intlayer_core.setLocaleInStorage)(locale, {
23
+ ..._intlayer_core.localeStorageOptions,
24
24
  isCookieEnabled
25
25
  });
26
26
  /**
@@ -32,8 +32,8 @@ const setLocaleCookie = setLocaleInStorage;
32
32
  /**
33
33
  * Hook that provides the locale cookie and a function to set it
34
34
  */
35
- const useLocaleStorage = (isCookieEnabled) => (0, react.useMemo)(() => (0, __intlayer_core.LocaleStorage)({
36
- ...__intlayer_core.localeStorageOptions,
35
+ const useLocaleStorage = (isCookieEnabled) => (0, react.useMemo)(() => (0, _intlayer_core.LocaleStorage)({
36
+ ..._intlayer_core.localeStorageOptions,
37
37
  isCookieEnabled
38
38
  }), [isCookieEnabled]);
39
39
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleStorage.cjs","names":["localeStorageOptions"],"sources":["../../../src/client/useLocaleStorage.ts"],"sourcesContent":["import {\n getLocaleFromStorage,\n LocaleStorage,\n localeStorageOptions,\n setLocaleInStorage as setLocaleInStorageCore,\n} from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { useMemo } from 'react';\n\n/**\n * Get the locale cookie\n */\n/**\n * Get the locale cookie\n */\nexport const localeInStorage = getLocaleFromStorage(localeStorageOptions);\n/**\n * @deprecated Use localeInStorage instead\n *\n * Get the locale cookie\n */\nexport const localeCookie = localeInStorage;\n\n/**\n * Set the locale cookie\n */\nexport const setLocaleInStorage = (\n locale: LocalesValues,\n isCookieEnabled?: boolean\n) =>\n setLocaleInStorageCore(locale, {\n ...localeStorageOptions,\n isCookieEnabled,\n });\n\n/**\n * @deprecated Use setLocaleInStorage instead\n *\n * Set the locale cookie\n */\nexport const setLocaleCookie = setLocaleInStorage;\n\n/**\n * Hook that provides the locale cookie and a function to set it\n */\nexport const useLocaleStorage = (isCookieEnabled?: boolean) =>\n useMemo(\n () =>\n LocaleStorage({\n ...localeStorageOptions,\n isCookieEnabled,\n }),\n [isCookieEnabled]\n );\n\n/**\n * @deprecated Use useLocaleStorage instead\n *\n * For GDPR compliance, use useLocaleStorage instead\n *\n * Hook that provides the locale cookie and a function to set it\n */\nexport const useLocaleCookie = (isCookieEnabled?: boolean) => {\n const storage = useLocaleStorage(isCookieEnabled);\n\n return {\n localeCookie: storage.getLocale(),\n setLocaleCookie: storage.setLocale,\n };\n};\n"],"mappings":";;;;;;;;;;;AAeA,MAAa,4DAAuCA,qCAAqB;;;;;;AAMzE,MAAa,eAAe;;;;AAK5B,MAAa,sBACX,QACA,4DAEuB,QAAQ;CAC7B,GAAGA;CACH;CACD,CAAC;;;;;;AAOJ,MAAa,kBAAkB;;;;AAK/B,MAAa,oBAAoB,gFAGb;CACZ,GAAGA;CACH;CACD,CAAC,EACJ,CAAC,gBAAgB,CAClB;;;;;;;;AASH,MAAa,mBAAmB,oBAA8B;CAC5D,MAAM,UAAU,iBAAiB,gBAAgB;AAEjD,QAAO;EACL,cAAc,QAAQ,WAAW;EACjC,iBAAiB,QAAQ;EAC1B"}
1
+ {"version":3,"file":"useLocaleStorage.cjs","names":["localeStorageOptions"],"sources":["../../../src/client/useLocaleStorage.ts"],"sourcesContent":["import {\n getLocaleFromStorage,\n LocaleStorage,\n localeStorageOptions,\n setLocaleInStorage as setLocaleInStorageCore,\n} from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { useMemo } from 'react';\n\n/**\n * Get the locale cookie\n */\n/**\n * Get the locale cookie\n */\nexport const localeInStorage = getLocaleFromStorage(localeStorageOptions);\n/**\n * @deprecated Use localeInStorage instead\n *\n * Get the locale cookie\n */\nexport const localeCookie = localeInStorage;\n\n/**\n * Set the locale cookie\n */\nexport const setLocaleInStorage = (\n locale: LocalesValues,\n isCookieEnabled?: boolean\n) =>\n setLocaleInStorageCore(locale, {\n ...localeStorageOptions,\n isCookieEnabled,\n });\n\n/**\n * @deprecated Use setLocaleInStorage instead\n *\n * Set the locale cookie\n */\nexport const setLocaleCookie = setLocaleInStorage;\n\n/**\n * Hook that provides the locale cookie and a function to set it\n */\nexport const useLocaleStorage = (isCookieEnabled?: boolean) =>\n useMemo(\n () =>\n LocaleStorage({\n ...localeStorageOptions,\n isCookieEnabled,\n }),\n [isCookieEnabled]\n );\n\n/**\n * @deprecated Use useLocaleStorage instead\n *\n * For GDPR compliance, use useLocaleStorage instead\n *\n * Hook that provides the locale cookie and a function to set it\n */\nexport const useLocaleCookie = (isCookieEnabled?: boolean) => {\n const storage = useLocaleStorage(isCookieEnabled);\n\n return {\n localeCookie: storage.getLocale(),\n setLocaleCookie: storage.setLocale,\n };\n};\n"],"mappings":";;;;;;;;;;;AAeA,MAAa,2DAAuCA,oCAAqB;;;;;;AAMzE,MAAa,eAAe;;;;AAK5B,MAAa,sBACX,QACA,2DAEuB,QAAQ;CAC7B,GAAGA;CACH;CACD,CAAC;;;;;;AAOJ,MAAa,kBAAkB;;;;AAK/B,MAAa,oBAAoB,+EAGb;CACZ,GAAGA;CACH;CACD,CAAC,EACJ,CAAC,gBAAgB,CAClB;;;;;;;;AASH,MAAa,mBAAmB,oBAA8B;CAC5D,MAAM,UAAU,iBAAiB,gBAAgB;AAEjD,QAAO;EACL,cAAc,QAAQ,WAAW;EACjC,iBAAiB,QAAQ;EAC1B"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
3
3
  let react = require("react");
4
- let __intlayer_core = require("@intlayer/core");
4
+ let _intlayer_core = require("@intlayer/core");
5
5
 
6
6
  //#region src/client/useTraduction.ts
7
7
  /**
@@ -27,7 +27,7 @@ let __intlayer_core = require("@intlayer/core");
27
27
  */
28
28
  const useTranslation = (languageContent) => {
29
29
  const { locale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
30
- return (0, react.useMemo)(() => (0, __intlayer_core.getTranslation)(languageContent, locale), [languageContent, locale]);
30
+ return (0, react.useMemo)(() => (0, _intlayer_core.getTranslation)(languageContent, locale), [languageContent, locale]);
31
31
  };
32
32
 
33
33
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useTraduction.cjs","names":["IntlayerClientContext"],"sources":["../../../src/client/useTraduction.ts"],"sourcesContent":["import { getTranslation } from '@intlayer/core';\nimport type { StrictModeLocaleMap } from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its id and return the content.\n *\n * If not locale found, it will return the content related to the default locale.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * ```tsx\n * const content = useTranslation<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * }, 'fr');\n * // 'Bonjour'\n * ```\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const useTranslation = <Content = string>(\n languageContent: StrictModeLocaleMap<Content>\n): Content => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useMemo(\n () => getTranslation(languageContent, locale),\n [languageContent, locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBACX,oBACY;CACZ,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,qEACuB,iBAAiB,OAAO,EAC7C,CAAC,iBAAiB,OAAO,CAC1B"}
1
+ {"version":3,"file":"useTraduction.cjs","names":["IntlayerClientContext"],"sources":["../../../src/client/useTraduction.ts"],"sourcesContent":["import { getTranslation } from '@intlayer/core';\nimport type { StrictModeLocaleMap } from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its id and return the content.\n *\n * If not locale found, it will return the content related to the default locale.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * ```tsx\n * const content = useTranslation<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * }, 'fr');\n * // 'Bonjour'\n * ```\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const useTranslation = <Content = string>(\n languageContent: StrictModeLocaleMap<Content>\n): Content => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useMemo(\n () => getTranslation(languageContent, locale),\n [languageContent, locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBACX,oBACY;CACZ,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,oEACuB,iBAAiB,OAAO,EAC7C,CAAC,iBAAiB,OAAO,CAC1B"}