preact-intlayer 9.3.2 → 9.3.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.
@@ -38,6 +38,8 @@ const useDictionaryDynamic = (dictionaryPromise, key, localeOrSelector) => {
38
38
  loadChunk: (cacheKey, promise) => require_client_useLoadDynamic.useLoadDynamic(cacheKey, promise),
39
39
  transform: (dictionary) => require_getDictionary.getDictionary(dictionary, localeTarget)
40
40
  });
41
+ const preloadedDictionary = (0, _intlayer_core_dictionaryManipulator.getPreloadedDictionary)(dictionaryPromise, localeTarget);
42
+ if (preloadedDictionary) return require_getDictionary.getDictionary(preloadedDictionary, localeTarget);
41
43
  const plainLoaders = dictionaryPromise;
42
44
  const dictionary = require_client_useLoadDynamic.useLoadDynamic(`${String(key)}.${localeTarget}`, plainLoaders[localeTarget]?.());
43
45
  return require_getDictionary.getDictionary(dictionary, localeTarget);
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.cjs","names":["useContext","IntlayerClientContext","parseDictionarySelector","resolveDictionaryArgument","internationalization","isQualifiedDynamicLoaderMap","resolveQualifiedDynamicContent","loadDynamicChunk","getDictionary"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport {\n isQualifiedDynamicLoaderMap,\n parseDictionarySelector,\n type QualifiedDynamicLoaderMap,\n resolveDictionaryArgument,\n resolveQualifiedDynamicContent,\n} from '@intlayer/core/dictionaryManipulator';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionarySelectorForKey,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { useContext } from 'preact/hooks';\nimport { getDictionary } from '../getDictionary';\nimport { IntlayerClientContext } from './IntlayerProvider';\n// `useLoadDynamic` is a suspender cache, not a hook — aliased to a non-hook\n// name so it can be invoked in loops / conditionally (collection chunks).\nimport { useLoadDynamic as loadDynamicChunk } from './useLoadDynamic';\n\n/**\n * Preact hook that lazily loads a dictionary and returns its content.\n *\n * The dictionary entry is either a plain dynamic loader map\n * (`locale → loader`) or a qualified one (`locale → …qualifier → loader`,\n * tagged with the qualifier dimensions). For qualified maps, only the chunk(s)\n * the selector targets are loaded.\n *\n * If the locale is not provided (directly or through the selector), the client\n * context locale is used.\n */\nexport const useDictionaryDynamic = <\n const T extends Dictionary,\n const K extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<K> = DeclaredLocales,\n>(\n dictionaryPromise:\n | StrictModeLocaleMap<() => Promise<T>>\n | QualifiedDynamicLoaderMap,\n key: K,\n localeOrSelector?: A\n) => {\n const { locale: currentLocale, variant: contextVariant } =\n useContext(IntlayerClientContext) ?? {};\n\n const { locale: selectorLocale, selector } =\n process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false'\n ? parseDictionarySelector<LocalesValues>(\n // Layers the provider's ambient variant under the call-site argument\n // before the chunk walk, so only the targeted chunk is loaded.\n resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: currentLocale,\n contextVariant,\n dictionaryKey: String(key),\n })\n )\n : {\n locale: localeOrSelector as LocalesValues | undefined,\n selector: undefined,\n };\n\n const localeTarget =\n selectorLocale ?? currentLocale ?? internationalization.defaultLocale;\n\n if (\n process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false' &&\n isQualifiedDynamicLoaderMap(dictionaryPromise)\n ) {\n return resolveQualifiedDynamicContent({\n loaderMap: dictionaryPromise,\n key: String(key),\n locale: localeTarget,\n selector,\n loadChunk: (cacheKey, promise) => loadDynamicChunk(cacheKey, promise),\n transform: (dictionary) => getDictionary(dictionary, localeTarget),\n });\n }\n\n const plainLoaders = dictionaryPromise as StrictModeLocaleMap<\n () => Promise<T>\n >;\n\n const dictionary = loadDynamicChunk<T>(\n `${String(key)}.${localeTarget}`,\n plainLoaders[localeTarget as keyof typeof plainLoaders]?.() as Promise<T>\n );\n\n return getDictionary(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,EAAE,QAAQ,eAAe,SAAS,uBACtCA,yBAAWC,qDAAqB,KAAK,CAAC;CAExC,MAAM,EAAE,QAAQ,gBAAgB,aAC9B,QAAQ,IAAI,iCAAiC,cACzCC,kEAGEC,gEAA0B;EACxB;EACA,eAAe;EACf;EACA,eAAe,OAAO,GAAG;CAC3B,CAAC,CACH,IACA;EACE,QAAQ;EACR,UAAU;CACZ;CAEN,MAAM,eACJ,kBAAkB,iBAAiBC,4CAAqB;CAE1D,IACE,QAAQ,IAAI,iCAAiC,eAC7CC,kEAA4B,iBAAiB,GAE7C,WAAOC,qEAA+B;EACpC,WAAW;EACX,KAAK,OAAO,GAAG;EACf,QAAQ;EACR;EACA,YAAY,UAAU,YAAYC,6CAAiB,UAAU,OAAO;EACpE,YAAY,eAAeC,oCAAc,YAAY,YAAY;CACnE,CAAC;CAGH,MAAM,eAAe;CAIrB,MAAM,aAAaD,6CACjB,GAAG,OAAO,GAAG,EAAE,GAAG,gBAClB,aAAa,aAA0C,GAAG,CAC5D;CAEA,OAAOC,oCAAc,YAAY,YAAY;AAC/C"}
1
+ {"version":3,"file":"useDictionaryDynamic.cjs","names":["useContext","IntlayerClientContext","parseDictionarySelector","resolveDictionaryArgument","internationalization","isQualifiedDynamicLoaderMap","resolveQualifiedDynamicContent","loadDynamicChunk","getDictionary","getPreloadedDictionary"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport {\n getPreloadedDictionary,\n isQualifiedDynamicLoaderMap,\n parseDictionarySelector,\n type QualifiedDynamicLoaderMap,\n resolveDictionaryArgument,\n resolveQualifiedDynamicContent,\n} from '@intlayer/core/dictionaryManipulator';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionarySelectorForKey,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { useContext } from 'preact/hooks';\nimport { getDictionary } from '../getDictionary';\nimport { IntlayerClientContext } from './IntlayerProvider';\n// `useLoadDynamic` is a suspender cache, not a hook — aliased to a non-hook\n// name so it can be invoked in loops / conditionally (collection chunks).\nimport { useLoadDynamic as loadDynamicChunk } from './useLoadDynamic';\n\n/**\n * Preact hook that lazily loads a dictionary and returns its content.\n *\n * The dictionary entry is either a plain dynamic loader map\n * (`locale → loader`) or a qualified one (`locale → …qualifier → loader`,\n * tagged with the qualifier dimensions). For qualified maps, only the chunk(s)\n * the selector targets are loaded.\n *\n * If the locale is not provided (directly or through the selector), the client\n * context locale is used.\n */\nexport const useDictionaryDynamic = <\n const T extends Dictionary,\n const K extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<K> = DeclaredLocales,\n>(\n dictionaryPromise:\n | StrictModeLocaleMap<() => Promise<T>>\n | QualifiedDynamicLoaderMap,\n key: K,\n localeOrSelector?: A\n) => {\n const { locale: currentLocale, variant: contextVariant } =\n useContext(IntlayerClientContext) ?? {};\n\n const { locale: selectorLocale, selector } =\n process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false'\n ? parseDictionarySelector<LocalesValues>(\n // Layers the provider's ambient variant under the call-site argument\n // before the chunk walk, so only the targeted chunk is loaded.\n resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: currentLocale,\n contextVariant,\n dictionaryKey: String(key),\n })\n )\n : {\n locale: localeOrSelector as LocalesValues | undefined,\n selector: undefined,\n };\n\n const localeTarget =\n selectorLocale ?? currentLocale ?? internationalization.defaultLocale;\n\n if (\n process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false' &&\n isQualifiedDynamicLoaderMap(dictionaryPromise)\n ) {\n return resolveQualifiedDynamicContent({\n loaderMap: dictionaryPromise,\n key: String(key),\n locale: localeTarget,\n selector,\n loadChunk: (cacheKey, promise) => loadDynamicChunk(cacheKey, promise),\n transform: (dictionary) => getDictionary(dictionary, localeTarget),\n });\n }\n\n // A build-tool plugin may have started this locale's chunk while the entry\n // point itself was evaluating, in which case the content is already here and\n // reading it must not go through the suspender — see `getPreloadedDictionary`.\n const preloadedDictionary = getPreloadedDictionary(\n dictionaryPromise,\n localeTarget\n );\n if (preloadedDictionary) {\n return getDictionary(preloadedDictionary as T, localeTarget);\n }\n\n const plainLoaders = dictionaryPromise as StrictModeLocaleMap<\n () => Promise<T>\n >;\n\n const dictionary = loadDynamicChunk<T>(\n `${String(key)}.${localeTarget}`,\n plainLoaders[localeTarget as keyof typeof plainLoaders]?.() as Promise<T>\n );\n\n return getDictionary(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,EAAE,QAAQ,eAAe,SAAS,uBACtCA,yBAAWC,qDAAqB,KAAK,CAAC;CAExC,MAAM,EAAE,QAAQ,gBAAgB,aAC9B,QAAQ,IAAI,iCAAiC,cACzCC,kEAGEC,gEAA0B;EACxB;EACA,eAAe;EACf;EACA,eAAe,OAAO,GAAG;CAC3B,CAAC,CACH,IACA;EACE,QAAQ;EACR,UAAU;CACZ;CAEN,MAAM,eACJ,kBAAkB,iBAAiBC,4CAAqB;CAE1D,IACE,QAAQ,IAAI,iCAAiC,eAC7CC,kEAA4B,iBAAiB,GAE7C,WAAOC,qEAA+B;EACpC,WAAW;EACX,KAAK,OAAO,GAAG;EACf,QAAQ;EACR;EACA,YAAY,UAAU,YAAYC,6CAAiB,UAAU,OAAO;EACpE,YAAY,eAAeC,oCAAc,YAAY,YAAY;CACnE,CAAC;CAMH,MAAM,0BAAsBC,6DAC1B,mBACA,YACF;CACA,IAAI,qBACF,OAAOD,oCAAc,qBAA0B,YAAY;CAG7D,MAAM,eAAe;CAIrB,MAAM,aAAaD,6CACjB,GAAG,OAAO,GAAG,EAAE,GAAG,gBAClB,aAAa,aAA0C,GAAG,CAC5D;CAEA,OAAOC,oCAAc,YAAY,YAAY;AAC/C"}
@@ -3,7 +3,7 @@ import { IntlayerClientContext } from "./IntlayerProvider.mjs";
3
3
  import { useLoadDynamic } from "./useLoadDynamic.mjs";
4
4
  import { internationalization } from "@intlayer/config/built";
5
5
  import { useContext } from "preact/hooks";
6
- import { isQualifiedDynamicLoaderMap, parseDictionarySelector, resolveDictionaryArgument, resolveQualifiedDynamicContent } from "@intlayer/core/dictionaryManipulator";
6
+ import { getPreloadedDictionary, isQualifiedDynamicLoaderMap, parseDictionarySelector, resolveDictionaryArgument, resolveQualifiedDynamicContent } from "@intlayer/core/dictionaryManipulator";
7
7
 
8
8
  //#region src/client/useDictionaryDynamic.ts
9
9
  /**
@@ -37,6 +37,8 @@ const useDictionaryDynamic = (dictionaryPromise, key, localeOrSelector) => {
37
37
  loadChunk: (cacheKey, promise) => useLoadDynamic(cacheKey, promise),
38
38
  transform: (dictionary) => getDictionary(dictionary, localeTarget)
39
39
  });
40
+ const preloadedDictionary = getPreloadedDictionary(dictionaryPromise, localeTarget);
41
+ if (preloadedDictionary) return getDictionary(preloadedDictionary, localeTarget);
40
42
  const plainLoaders = dictionaryPromise;
41
43
  const dictionary = useLoadDynamic(`${String(key)}.${localeTarget}`, plainLoaders[localeTarget]?.());
42
44
  return getDictionary(dictionary, localeTarget);
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.mjs","names":["loadDynamicChunk"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport {\n isQualifiedDynamicLoaderMap,\n parseDictionarySelector,\n type QualifiedDynamicLoaderMap,\n resolveDictionaryArgument,\n resolveQualifiedDynamicContent,\n} from '@intlayer/core/dictionaryManipulator';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionarySelectorForKey,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { useContext } from 'preact/hooks';\nimport { getDictionary } from '../getDictionary';\nimport { IntlayerClientContext } from './IntlayerProvider';\n// `useLoadDynamic` is a suspender cache, not a hook — aliased to a non-hook\n// name so it can be invoked in loops / conditionally (collection chunks).\nimport { useLoadDynamic as loadDynamicChunk } from './useLoadDynamic';\n\n/**\n * Preact hook that lazily loads a dictionary and returns its content.\n *\n * The dictionary entry is either a plain dynamic loader map\n * (`locale → loader`) or a qualified one (`locale → …qualifier → loader`,\n * tagged with the qualifier dimensions). For qualified maps, only the chunk(s)\n * the selector targets are loaded.\n *\n * If the locale is not provided (directly or through the selector), the client\n * context locale is used.\n */\nexport const useDictionaryDynamic = <\n const T extends Dictionary,\n const K extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<K> = DeclaredLocales,\n>(\n dictionaryPromise:\n | StrictModeLocaleMap<() => Promise<T>>\n | QualifiedDynamicLoaderMap,\n key: K,\n localeOrSelector?: A\n) => {\n const { locale: currentLocale, variant: contextVariant } =\n useContext(IntlayerClientContext) ?? {};\n\n const { locale: selectorLocale, selector } =\n process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false'\n ? parseDictionarySelector<LocalesValues>(\n // Layers the provider's ambient variant under the call-site argument\n // before the chunk walk, so only the targeted chunk is loaded.\n resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: currentLocale,\n contextVariant,\n dictionaryKey: String(key),\n })\n )\n : {\n locale: localeOrSelector as LocalesValues | undefined,\n selector: undefined,\n };\n\n const localeTarget =\n selectorLocale ?? currentLocale ?? internationalization.defaultLocale;\n\n if (\n process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false' &&\n isQualifiedDynamicLoaderMap(dictionaryPromise)\n ) {\n return resolveQualifiedDynamicContent({\n loaderMap: dictionaryPromise,\n key: String(key),\n locale: localeTarget,\n selector,\n loadChunk: (cacheKey, promise) => loadDynamicChunk(cacheKey, promise),\n transform: (dictionary) => getDictionary(dictionary, localeTarget),\n });\n }\n\n const plainLoaders = dictionaryPromise as StrictModeLocaleMap<\n () => Promise<T>\n >;\n\n const dictionary = loadDynamicChunk<T>(\n `${String(key)}.${localeTarget}`,\n plainLoaders[localeTarget as keyof typeof plainLoaders]?.() as Promise<T>\n );\n\n return getDictionary(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,EAAE,QAAQ,eAAe,SAAS,mBACtC,WAAW,qBAAqB,KAAK,CAAC;CAExC,MAAM,EAAE,QAAQ,gBAAgB,aAC9B,QAAQ,IAAI,iCAAiC,UACzC,wBAGE,0BAA0B;EACxB;EACA,eAAe;EACf;EACA,eAAe,OAAO,GAAG;CAC3B,CAAC,CACH,IACA;EACE,QAAQ;EACR,UAAU;CACZ;CAEN,MAAM,eACJ,kBAAkB,iBAAiB,qBAAqB;CAE1D,IACE,QAAQ,IAAI,iCAAiC,WAC7C,4BAA4B,iBAAiB,GAE7C,OAAO,+BAA+B;EACpC,WAAW;EACX,KAAK,OAAO,GAAG;EACf,QAAQ;EACR;EACA,YAAY,UAAU,YAAYA,eAAiB,UAAU,OAAO;EACpE,YAAY,eAAe,cAAc,YAAY,YAAY;CACnE,CAAC;CAGH,MAAM,eAAe;CAIrB,MAAM,aAAaA,eACjB,GAAG,OAAO,GAAG,EAAE,GAAG,gBAClB,aAAa,aAA0C,GAAG,CAC5D;CAEA,OAAO,cAAc,YAAY,YAAY;AAC/C"}
1
+ {"version":3,"file":"useDictionaryDynamic.mjs","names":["loadDynamicChunk"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport {\n getPreloadedDictionary,\n isQualifiedDynamicLoaderMap,\n parseDictionarySelector,\n type QualifiedDynamicLoaderMap,\n resolveDictionaryArgument,\n resolveQualifiedDynamicContent,\n} from '@intlayer/core/dictionaryManipulator';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionarySelectorForKey,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { useContext } from 'preact/hooks';\nimport { getDictionary } from '../getDictionary';\nimport { IntlayerClientContext } from './IntlayerProvider';\n// `useLoadDynamic` is a suspender cache, not a hook — aliased to a non-hook\n// name so it can be invoked in loops / conditionally (collection chunks).\nimport { useLoadDynamic as loadDynamicChunk } from './useLoadDynamic';\n\n/**\n * Preact hook that lazily loads a dictionary and returns its content.\n *\n * The dictionary entry is either a plain dynamic loader map\n * (`locale → loader`) or a qualified one (`locale → …qualifier → loader`,\n * tagged with the qualifier dimensions). For qualified maps, only the chunk(s)\n * the selector targets are loaded.\n *\n * If the locale is not provided (directly or through the selector), the client\n * context locale is used.\n */\nexport const useDictionaryDynamic = <\n const T extends Dictionary,\n const K extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<K> = DeclaredLocales,\n>(\n dictionaryPromise:\n | StrictModeLocaleMap<() => Promise<T>>\n | QualifiedDynamicLoaderMap,\n key: K,\n localeOrSelector?: A\n) => {\n const { locale: currentLocale, variant: contextVariant } =\n useContext(IntlayerClientContext) ?? {};\n\n const { locale: selectorLocale, selector } =\n process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false'\n ? parseDictionarySelector<LocalesValues>(\n // Layers the provider's ambient variant under the call-site argument\n // before the chunk walk, so only the targeted chunk is loaded.\n resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: currentLocale,\n contextVariant,\n dictionaryKey: String(key),\n })\n )\n : {\n locale: localeOrSelector as LocalesValues | undefined,\n selector: undefined,\n };\n\n const localeTarget =\n selectorLocale ?? currentLocale ?? internationalization.defaultLocale;\n\n if (\n process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false' &&\n isQualifiedDynamicLoaderMap(dictionaryPromise)\n ) {\n return resolveQualifiedDynamicContent({\n loaderMap: dictionaryPromise,\n key: String(key),\n locale: localeTarget,\n selector,\n loadChunk: (cacheKey, promise) => loadDynamicChunk(cacheKey, promise),\n transform: (dictionary) => getDictionary(dictionary, localeTarget),\n });\n }\n\n // A build-tool plugin may have started this locale's chunk while the entry\n // point itself was evaluating, in which case the content is already here and\n // reading it must not go through the suspender — see `getPreloadedDictionary`.\n const preloadedDictionary = getPreloadedDictionary(\n dictionaryPromise,\n localeTarget\n );\n if (preloadedDictionary) {\n return getDictionary(preloadedDictionary as T, localeTarget);\n }\n\n const plainLoaders = dictionaryPromise as StrictModeLocaleMap<\n () => Promise<T>\n >;\n\n const dictionary = loadDynamicChunk<T>(\n `${String(key)}.${localeTarget}`,\n plainLoaders[localeTarget as keyof typeof plainLoaders]?.() as Promise<T>\n );\n\n return getDictionary(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,EAAE,QAAQ,eAAe,SAAS,mBACtC,WAAW,qBAAqB,KAAK,CAAC;CAExC,MAAM,EAAE,QAAQ,gBAAgB,aAC9B,QAAQ,IAAI,iCAAiC,UACzC,wBAGE,0BAA0B;EACxB;EACA,eAAe;EACf;EACA,eAAe,OAAO,GAAG;CAC3B,CAAC,CACH,IACA;EACE,QAAQ;EACR,UAAU;CACZ;CAEN,MAAM,eACJ,kBAAkB,iBAAiB,qBAAqB;CAE1D,IACE,QAAQ,IAAI,iCAAiC,WAC7C,4BAA4B,iBAAiB,GAE7C,OAAO,+BAA+B;EACpC,WAAW;EACX,KAAK,OAAO,GAAG;EACf,QAAQ;EACR;EACA,YAAY,UAAU,YAAYA,eAAiB,UAAU,OAAO;EACpE,YAAY,eAAe,cAAc,YAAY,YAAY;CACnE,CAAC;CAMH,MAAM,sBAAsB,uBAC1B,mBACA,YACF;CACA,IAAI,qBACF,OAAO,cAAc,qBAA0B,YAAY;CAG7D,MAAM,eAAe;CAIrB,MAAM,aAAaA,eACjB,GAAG,OAAO,GAAG,EAAE,GAAG,gBAClB,aAAa,aAA0C,GAAG,CAC5D;CAEA,OAAO,cAAc,YAAY,YAAY;AAC/C"}
@@ -1,3 +1,4 @@
1
+ import { LocalesValues as LocalesValues$1 } from "../intlayer/dist/types/index.js";
1
2
  import { useTranslation } from "./useTraduction.js";
2
3
  import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
3
4
  //#region src/client/useContent.d.ts
@@ -5,7 +6,7 @@ import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
5
6
  * On the client side, hook to get the translation content based on the locale
6
7
  */
7
8
  declare const useContent: <Content>(languageContent: StrictModeLocaleMap<Content>) => {
8
- locale: import("@intlayer/types").LocalesValues;
9
+ locale: LocalesValues$1;
9
10
  content: Content;
10
11
  t: typeof useTranslation;
11
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useContent.d.ts","names":[],"sources":["../../../src/client/useContent.ts"],"mappings":";;;;;;cAOa,aAAc,SAAO,iBACf,oBAAoB"}
1
+ {"version":3,"file":"useContent.d.ts","names":[],"sources":["../../../src/client/useContent.ts"],"mappings":";;;;;;;cAOa,aAAc,SAAO,iBACf,oBAAoB;UAApB"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;;;;cAkCa,6BACL,UAAU,kBACV,UAAU,sBACV,UAAU,gBAAgB,yBAAyB,KAAK,iBAAe,mBAGzE,0BAA0B,QAAQ,MAClC,2BAAyB,KACxB,GAAC,mBACa"}
1
+ {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;;;;cAmCa,6BACL,UAAU,kBACV,UAAU,sBACV,UAAU,gBAAgB,yBAAyB,KAAK,iBAAe,mBAGzE,0BAA0B,QAAQ,MAClC,2BAAyB,KACxB,GAAC,mBACa"}
@@ -1,12 +1,13 @@
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
1
2
  //#region src/client/useLocaleBase.d.ts
2
3
  /**
3
4
  * On the client side, hook to get the current locale and all related fields
4
5
  */
5
6
  declare const useLocaleBase: () => {
6
- locale: import("@intlayer/types").LocalesValues;
7
+ locale: LocalesValues;
7
8
  defaultLocale: any;
8
9
  availableLocales: any;
9
- setLocale: (newLocale: import("@intlayer/types").LocalesValues) => void;
10
+ setLocale: (newLocale: LocalesValues) => void;
10
11
  };
11
12
  //#endregion
12
13
  export { useLocaleBase };
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleBase.d.ts","names":[],"sources":["../../../src/client/useLocaleBase.ts"],"mappings":";;;;cASa"}
1
+ {"version":3,"file":"useLocaleBase.d.ts","names":[],"sources":["../../../src/client/useLocaleBase.ts"],"mappings":";;;;;cASa;UAAA;;;yBAAA"}
@@ -1,15 +1,16 @@
1
+ import { Locale } from "../intlayer/dist/types/index.js";
1
2
  import { LocalesValues } from "@intlayer/types/module_augmentation";
2
3
  //#region src/client/useLocaleStorage.d.ts
3
4
  /**
4
5
  * Get the locale cookie
5
6
  */
6
- declare const localeInStorage: import("@intlayer/types").Locale;
7
+ declare const localeInStorage: Locale;
7
8
  /**
8
9
  * @deprecated Use localeInStorage instead
9
10
  *
10
11
  * Get the locale cookie
11
12
  */
12
- declare const localeCookie: import("@intlayer/types").Locale;
13
+ declare const localeCookie: Locale;
13
14
  /**
14
15
  * Set the locale cookie
15
16
  */
@@ -24,7 +25,7 @@ declare const setLocaleCookie: typeof setLocaleInStorage;
24
25
  * Hook that provides the locale storage and a function to set it
25
26
  */
26
27
  declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
27
- getLocale: () => import("@intlayer/types").Locale;
28
+ getLocale: () => Locale;
28
29
  setLocale: (locale: LocalesValues) => void;
29
30
  };
30
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;cAYa,2CAAe;;;;;;cAMf,wCAAY;;;;cAKZ,qBAAkB,QACrB,eAAa;;;;;;cAaV,wBAAe;;;;cAKf,mBAAgB;;sBAAhB;;;;;;;;;cAiBA,wBAAe"}
1
+ {"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;cAYa,iBAAA;;;;;;cAMA,cAAA;;;;cAKA,qBAAkB,QACrB,eAAa;;;;;;cAaV,wBAAe;;;;cAKf,mBAAgB;mBAAhB;sBAAA;;;;;;;;;cAiBA,wBAAe"}
@@ -1,3 +1,4 @@
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
1
2
  //#region src/format/useCompact.d.ts
2
3
  /**
3
4
  * React client hook that provides a compact number formatter
@@ -10,7 +11,7 @@
10
11
  * ```
11
12
  */
12
13
  declare const useCompact: () => (value: string | number, options?: Intl.NumberFormatOptions & {
13
- locale?: import("@intlayer/types").LocalesValues;
14
+ locale?: LocalesValues;
14
15
  }) => string;
15
16
  //#endregion
16
17
  export { useCompact };
@@ -1 +1 @@
1
- {"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;;;;;;;;;;cAca,mBAAU,wBAAA,UAAA,KAAA"}
1
+ {"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;;;;;;;;;;;cAca,mBAAU,wBAAA,UAAA,KAAA;WAAA"}
@@ -1,3 +1,4 @@
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
1
2
  //#region src/format/useCurrency.d.ts
2
3
  /**
3
4
  * React client hook that provides a currency formatter
@@ -24,7 +25,7 @@
24
25
  * ```
25
26
  */
26
27
  declare const useCurrency: () => (value: string | number, options?: Intl.NumberFormatOptions & {
27
- locale?: import("@intlayer/types").LocalesValues;
28
+ locale?: LocalesValues;
28
29
  }) => string;
29
30
  //#endregion
30
31
  export { useCurrency };
@@ -1 +1 @@
1
- {"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;cA4Ba,oBAAW,wBAAA,UAAA,KAAA"}
1
+ {"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;cA4Ba,oBAAW,wBAAA,UAAA,KAAA;WAAA"}
@@ -1,3 +1,4 @@
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
1
2
  //#region src/format/useList.d.ts
2
3
  /**
3
4
  * React client hook that provides a list formatter
@@ -25,7 +26,7 @@ declare const useList: () => (values: (string | number)[], options?: {
25
26
  type?: 'conjunction' | 'disjunction' | 'unit';
26
27
  style?: 'long' | 'short' | 'narrow';
27
28
  } & {
28
- locale?: import("@intlayer/types").LocalesValues;
29
+ locale?: LocalesValues;
29
30
  }) => string;
30
31
  //#endregion
31
32
  export { useList };
@@ -1 +1 @@
1
- {"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;cAyBa,gBAAO,6BAAA"}
1
+ {"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;cAyBa,gBAAO,6BAAA;;;;;WAAP"}
@@ -1,3 +1,4 @@
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
1
2
  //#region src/format/useNumber.d.ts
2
3
  /**
3
4
  * React client hook that provides a localized number formatter.
@@ -22,7 +23,7 @@
22
23
  * A number formatting function bound to the active locale.
23
24
  */
24
25
  declare const useNumber: () => (value: string | number, args_1?: Intl.NumberFormatOptions & {
25
- locale?: import("@intlayer/types").LocalesValues;
26
+ locale?: LocalesValues;
26
27
  }) => string;
27
28
  //#endregion
28
29
  export { useNumber };
@@ -1 +1 @@
1
- {"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;cA0Ba,kBAAS,wBAAA,SAAA,KAAA"}
1
+ {"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;cA0Ba,kBAAS,wBAAA,SAAA,KAAA;WAAA"}
@@ -1,3 +1,4 @@
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
1
2
  //#region src/format/usePercentage.d.ts
2
3
  /**
3
4
  * React hook to provide a percentage formatter function
@@ -18,7 +19,7 @@
18
19
  * A function that formats numbers or numeric strings into localized percentages.
19
20
  */
20
21
  declare const usePercentage: () => (value: string | number, args_1?: Intl.NumberFormatOptions & {
21
- locale?: import("@intlayer/types").LocalesValues;
22
+ locale?: LocalesValues;
22
23
  }) => string;
23
24
  //#endregion
24
25
  export { usePercentage };
@@ -1 +1 @@
1
- {"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;;;;;;;;;;;;;;;;;;cAsBa,sBAAa,wBAAA,SAAA,KAAA"}
1
+ {"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;cAsBa,sBAAa,wBAAA,SAAA,KAAA;WAAA"}
@@ -1,3 +1,4 @@
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
1
2
  //#region src/format/useRelativeTime.d.ts
2
3
  /**
3
4
  * Client-side React hook for accessing a localized relative time formatter.
@@ -18,7 +19,7 @@
18
19
  * bound to the current client locale.
19
20
  */
20
21
  declare const useRelativeTime: () => (from: string | number | Date, to?: string | number | Date, options?: Intl.RelativeTimeFormatOptions & {
21
- locale?: import("@intlayer/types").LocalesValues;
22
+ locale?: LocalesValues;
22
23
  unit?: Intl.RelativeTimeFormatUnit;
23
24
  }) => string;
24
25
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;;;;;;;;;;;;;;;;;;cAsBa,wBAAe,wBAAA,MAAA,uBAAA,MAAA,UAAA,KAAA"}
1
+ {"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;cAsBa,wBAAe,wBAAA,MAAA,uBAAA,MAAA,UAAA,KAAA;WAAA"}
@@ -1,3 +1,4 @@
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
1
2
  //#region src/format/useUnit.d.ts
2
3
  /**
3
4
  * React hook that provides a unit formatting function
@@ -17,7 +18,7 @@
17
18
  * @returns {Function} A unit formatting function that accepts a value and optional formatting options.
18
19
  */
19
20
  declare const useUnit: () => (value: string | number, options?: Intl.NumberFormatOptions & {
20
- locale?: import("@intlayer/types").LocalesValues;
21
+ locale?: LocalesValues;
21
22
  }) => string;
22
23
  //#endregion
23
24
  export { useUnit };
@@ -1 +1 @@
1
- {"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAqBa,gBAAO,wBAAA,UAAA,KAAA"}
1
+ {"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;;;;;;;;;;;;;;;;;;cAqBa,gBAAO,wBAAA,UAAA,KAAA;WAAA"}
@@ -0,0 +1,14 @@
1
+ import "@intlayer/core/interpreter";
2
+ import { LocalesValues as LocalesValues$1 } from "@intlayer/types/module_augmentation";
3
+ import { Locale as Locale$1 } from "@intlayer/types/allLocales";
4
+ import "@intlayer/core/transpiler";
5
+ import { Dictionary } from "@intlayer/types/dictionary";
6
+ import "@intlayer/types/config";
7
+ import "@intlayer/types/locales";
8
+ import "@intlayer/config/built";
9
+ import "@intlayer/core/file";
10
+ import "@intlayer/core/formatters";
11
+ import "@intlayer/core/localization";
12
+ import "@intlayer/core/markdown";
13
+ import "@intlayer/core/utils";
14
+ export type { Locale$1 as Locale, LocalesValues$1 as LocalesValues };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "preact-intlayer",
3
- "version": "9.3.2",
3
+ "version": "9.3.3",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Preact applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -101,11 +101,11 @@
101
101
  },
102
102
  "dependencies": {
103
103
  "@intlayer/api": "9.3.2",
104
- "@intlayer/config": "9.3.2",
105
- "@intlayer/core": "9.3.2",
106
- "@intlayer/editor": "9.3.2",
104
+ "@intlayer/config": "9.3.3",
105
+ "@intlayer/core": "9.3.3",
106
+ "@intlayer/editor": "9.3.3",
107
107
  "@intlayer/engine": "9.3.2",
108
- "@intlayer/types": "9.3.2"
108
+ "@intlayer/types": "9.3.3"
109
109
  },
110
110
  "devDependencies": {
111
111
  "@types/node": "26.2.0",
@@ -116,13 +116,13 @@
116
116
  "rimraf": "6.1.3",
117
117
  "tsdown": "0.22.14",
118
118
  "typescript": "7.0.2",
119
- "vitest": "4.1.10"
119
+ "vitest": "4.1.11"
120
120
  },
121
121
  "peerDependencies": {
122
122
  "preact": ">=8.0.0"
123
123
  },
124
124
  "optionalDependencies": {
125
- "@intlayer/analytics": "9.3.2"
125
+ "@intlayer/analytics": "9.3.3"
126
126
  },
127
127
  "engines": {
128
128
  "node": ">=14.18"