preact-intlayer 8.12.4 → 9.0.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/cjs/client/useDictionary.cjs +14 -5
  2. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  3. package/dist/cjs/client/useDictionaryDynamic.cjs +24 -6
  4. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  5. package/dist/cjs/client/useIntlayer.cjs +16 -5
  6. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  7. package/dist/cjs/getDictionary.cjs +8 -1
  8. package/dist/cjs/getDictionary.cjs.map +1 -1
  9. package/dist/cjs/getIntlayer.cjs +8 -1
  10. package/dist/cjs/getIntlayer.cjs.map +1 -1
  11. package/dist/esm/client/useDictionary.mjs +14 -5
  12. package/dist/esm/client/useDictionary.mjs.map +1 -1
  13. package/dist/esm/client/useDictionaryDynamic.mjs +25 -7
  14. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
  15. package/dist/esm/client/useIntlayer.mjs +16 -5
  16. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  17. package/dist/esm/getDictionary.mjs +8 -1
  18. package/dist/esm/getDictionary.mjs.map +1 -1
  19. package/dist/esm/getIntlayer.mjs +8 -1
  20. package/dist/esm/getIntlayer.mjs.map +1 -1
  21. package/dist/types/client/useContent.d.ts +2 -2
  22. package/dist/types/client/useContent.d.ts.map +1 -1
  23. package/dist/types/client/useDictionary.d.ts +6 -4
  24. package/dist/types/client/useDictionary.d.ts.map +1 -1
  25. package/dist/types/client/useDictionaryDynamic.d.ts +11 -7
  26. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  27. package/dist/types/client/useIntlayer.d.ts +12 -5
  28. package/dist/types/client/useIntlayer.d.ts.map +1 -1
  29. package/dist/types/client/useLocaleBase.d.ts +3 -3
  30. package/dist/types/client/useLocaleBase.d.ts.map +1 -1
  31. package/dist/types/client/useLocaleStorage.d.ts +5 -5
  32. package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
  33. package/dist/types/format/useCompact.d.ts +2 -2
  34. package/dist/types/format/useCompact.d.ts.map +1 -1
  35. package/dist/types/format/useCurrency.d.ts +2 -2
  36. package/dist/types/format/useCurrency.d.ts.map +1 -1
  37. package/dist/types/format/useList.d.ts +2 -2
  38. package/dist/types/format/useList.d.ts.map +1 -1
  39. package/dist/types/format/useNumber.d.ts +2 -2
  40. package/dist/types/format/useNumber.d.ts.map +1 -1
  41. package/dist/types/format/usePercentage.d.ts +2 -2
  42. package/dist/types/format/usePercentage.d.ts.map +1 -1
  43. package/dist/types/format/useRelativeTime.d.ts +2 -2
  44. package/dist/types/format/useRelativeTime.d.ts.map +1 -1
  45. package/dist/types/format/useUnit.d.ts +2 -2
  46. package/dist/types/format/useUnit.d.ts.map +1 -1
  47. package/dist/types/getDictionary.d.ts +8 -3
  48. package/dist/types/getDictionary.d.ts.map +1 -1
  49. package/dist/types/getIntlayer.d.ts +7 -2
  50. package/dist/types/getIntlayer.d.ts.map +1 -1
  51. package/dist/types/intlayer/dist/types/index.d.ts +4 -0
  52. package/package.json +8 -8
@@ -3,21 +3,30 @@ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  const require_getDictionary = require('../getDictionary.cjs');
4
4
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
5
5
  let preact_hooks = require("preact/hooks");
6
+ let _intlayer_core_dictionaryManipulator = require("@intlayer/core/dictionaryManipulator");
6
7
 
7
8
  //#region src/client/useDictionary.ts
8
9
  /**
9
- * On the server side, Hook that transform a dictionary and return the content
10
+ * Preact hook that transforms a dictionary (or qualified dictionary group) and
11
+ * returns the content.
10
12
  *
11
- * If the locale is not provided, it will use the locale from the client context
13
+ * If the locale is not provided (directly or through the selector), it will use
14
+ * the locale from the client context.
12
15
  */
13
- const useDictionary = (dictionary, locale) => {
16
+ const useDictionary = (dictionary, localeOrSelector) => {
14
17
  const { locale: currentLocale } = (0, preact_hooks.useContext)(require_client_IntlayerProvider.IntlayerClientContext) ?? {};
18
+ const isSelector = typeof localeOrSelector === "object" && localeOrSelector !== null;
19
+ const localeOrSelectorIdentity = isSelector ? `${localeOrSelector.locale ?? ""}|${(0, _intlayer_core_dictionaryManipulator.getDictionarySelectorCacheKey)(localeOrSelector)}` : localeOrSelector;
15
20
  return (0, preact_hooks.useMemo)(() => {
16
- return require_getDictionary.getDictionary(dictionary, locale ?? currentLocale);
21
+ if (isSelector) return require_getDictionary.getDictionary(dictionary, {
22
+ ...localeOrSelector,
23
+ locale: localeOrSelector.locale ?? currentLocale
24
+ });
25
+ return require_getDictionary.getDictionary(dictionary, localeOrSelector ?? currentLocale);
17
26
  }, [
18
27
  dictionary.key,
19
28
  currentLocale,
20
- locale
29
+ localeOrSelectorIdentity
21
30
  ]);
22
31
  };
23
32
 
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionary.cjs","names":["IntlayerClientContext","getDictionary"],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { getDictionary } from '../getDictionary';\nimport { IntlayerClientContext } from './IntlayerProvider';\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 useDictionary = <\n const T extends Dictionary,\n const L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n return useMemo(() => {\n const localeTarget = locale ?? currentLocale;\n\n return getDictionary<T, L>(dictionary, localeTarget as L);\n }, [dictionary.key, currentLocale, locale]);\n};\n"],"mappings":";;;;;;;;;;;;AAcA,MAAa,iBAIX,YACA,WACG;CACH,MAAM,EAAE,QAAQ,+CAA6BA,sDAAsB,IAAI,EAAE;AAEzE,wCAAqB;AAGnB,SAAOC,oCAAoB,YAFN,UAAU,cAE0B;IACxD;EAAC,WAAW;EAAK;EAAe;EAAO,CAAC"}
1
+ {"version":3,"file":"useDictionary.cjs","names":["IntlayerClientContext","getDictionary"],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { getDictionarySelectorCacheKey } from '@intlayer/core/dictionaryManipulator';\nimport type {\n Dictionary,\n DictionarySelector,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { getDictionary } from '../getDictionary';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * Preact hook that transforms a dictionary (or qualified dictionary group) and\n * returns the content.\n *\n * If the locale is not provided (directly or through the selector), it will use\n * the locale from the client context.\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends\n | LocalesValues\n | DictionarySelectorForGroup<T> = DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n const isSelector =\n typeof localeOrSelector === 'object' && localeOrSelector !== null;\n\n // Stable identity of the second argument for memoization\n const localeOrSelectorIdentity = isSelector\n ? `${localeOrSelector.locale ?? ''}|${getDictionarySelectorCacheKey(localeOrSelector)}`\n : localeOrSelector;\n\n return useMemo(() => {\n if (isSelector) {\n return getDictionary(dictionary, {\n ...localeOrSelector,\n locale: localeOrSelector.locale ?? currentLocale,\n } as A);\n }\n\n const localeTarget = (localeOrSelector ?? currentLocale) as A;\n\n return getDictionary<T, A>(dictionary, localeTarget);\n }, [dictionary.key, currentLocale, localeOrSelectorIdentity]);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,MAAa,iBAMX,YACA,qBACG;CACH,MAAM,EAAE,QAAQ,+CAA6BA,sDAAsB,IAAI,EAAE;CAEzE,MAAM,aACJ,OAAO,qBAAqB,YAAY,qBAAqB;CAG/D,MAAM,2BAA2B,aAC7B,GAAG,iBAAiB,UAAU,GAAG,2EAAiC,iBAAiB,KACnF;AAEJ,wCAAqB;AACnB,MAAI,WACF,QAAOC,oCAAc,YAAY;GAC/B,GAAG;GACH,QAAQ,iBAAiB,UAAU;GACpC,CAAM;AAKT,SAAOA,oCAAoB,YAFL,oBAAoB,cAEU;IACnD;EAAC,WAAW;EAAK;EAAe;EAAyB,CAAC"}
@@ -1,20 +1,38 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  const require_client_useLoadDynamic = require('./useLoadDynamic.cjs');
4
+ const require_getDictionary = require('../getDictionary.cjs');
4
5
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
5
- const require_client_useDictionary = require('./useDictionary.cjs');
6
+ let _intlayer_config_built = require("@intlayer/config/built");
6
7
  let preact_hooks = require("preact/hooks");
8
+ let _intlayer_core_dictionaryManipulator = require("@intlayer/core/dictionaryManipulator");
7
9
 
8
10
  //#region src/client/useDictionaryDynamic.ts
9
11
  /**
10
- * On the server side, Hook that transform a dictionary and return the content
12
+ * Preact hook that lazily loads a dictionary and returns its content.
11
13
  *
12
- * If the locale is not provided, it will use the locale from the client context
14
+ * The dictionary entry is either a plain dynamic loader map
15
+ * (`locale → loader`) or a qualified one (`locale → …qualifier → loader`,
16
+ * tagged with the qualifier dimensions). For qualified maps, only the chunk(s)
17
+ * the selector targets are loaded.
18
+ *
19
+ * If the locale is not provided (directly or through the selector), the client
20
+ * context locale is used.
13
21
  */
14
- const useDictionaryDynamic = (dictionaryPromise, key, locale) => {
22
+ const useDictionaryDynamic = (dictionaryPromise, key, localeOrSelector) => {
15
23
  const { locale: currentLocale } = (0, preact_hooks.useContext)(require_client_IntlayerProvider.IntlayerClientContext) ?? {};
16
- const localeTarget = (0, preact_hooks.useMemo)(() => locale ?? currentLocale, [currentLocale, locale]);
17
- return require_client_useDictionary.useDictionary(require_client_useLoadDynamic.useLoadDynamic(`${String(key)}.${localeTarget}`, dictionaryPromise[localeTarget]?.()), localeTarget);
24
+ const { locale: selectorLocale, selector } = (0, _intlayer_core_dictionaryManipulator.parseDictionarySelector)(localeOrSelector);
25
+ const localeTarget = selectorLocale ?? currentLocale ?? _intlayer_config_built.internationalization.defaultLocale;
26
+ if ((0, _intlayer_core_dictionaryManipulator.isQualifiedDynamicLoaderMap)(dictionaryPromise)) return (0, _intlayer_core_dictionaryManipulator.resolveQualifiedDynamicContent)({
27
+ loaderMap: dictionaryPromise,
28
+ key: String(key),
29
+ locale: localeTarget,
30
+ selector,
31
+ loadChunk: (cacheKey, promise) => require_client_useLoadDynamic.useLoadDynamic(cacheKey, promise),
32
+ transform: (dictionary) => require_getDictionary.getDictionary(dictionary, localeTarget)
33
+ });
34
+ const plainLoaders = dictionaryPromise;
35
+ return require_getDictionary.getDictionary(require_client_useLoadDynamic.useLoadDynamic(`${String(key)}.${localeTarget}`, plainLoaders[localeTarget]?.()), localeTarget);
18
36
  };
19
37
 
20
38
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.cjs","names":["IntlayerClientContext","useDictionary","useLoadDynamic"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DictionaryKeys,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\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 const T extends Dictionary,\n const 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 () => locale ?? currentLocale,\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":";;;;;;;;;;;;;AAgBA,MAAa,wBAIX,mBACA,KACA,WACG;CACH,MAAM,EAAE,QAAQ,+CAA6BA,sDAAsB,IAAI,EAAE;CACzE,MAAM,+CACE,UAAU,eAChB,CAAC,eAAe,OAAO,CACxB;AAOD,QAAOC,2CALYC,6CACjB,GAAG,OAAO,IAAI,CAAC,GAAG,gBACjB,kBAA0B,iBAAiB,CAGf,EAAE,aAAa"}
1
+ {"version":3,"file":"useDictionaryDynamic.cjs","names":["IntlayerClientContext","internationalization","loadDynamicChunk","getDictionary"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport {\n isQualifiedDynamicLoaderMap,\n parseDictionarySelector,\n type QualifiedDynamicLoaderMap,\n resolveQualifiedDynamicContent,\n} from '@intlayer/core/dictionaryManipulator';\nimport type {\n Dictionary,\n DictionarySelector,\n} from '@intlayer/types/dictionary';\nimport type {\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> = LocalesValues,\n>(\n dictionaryPromise:\n | StrictModeLocaleMap<() => Promise<T>>\n | QualifiedDynamicLoaderMap,\n key: K,\n localeOrSelector?: A\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n const { locale: selectorLocale, selector } =\n parseDictionarySelector<LocalesValues>(localeOrSelector);\n\n const localeTarget =\n selectorLocale ?? currentLocale ?? internationalization.defaultLocale;\n\n if (isQualifiedDynamicLoaderMap(dictionaryPromise)) {\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":";;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,EAAE,QAAQ,+CAA6BA,sDAAsB,IAAI,EAAE;CAEzE,MAAM,EAAE,QAAQ,gBAAgB,+EACS,iBAAiB;CAE1D,MAAM,eACJ,kBAAkB,iBAAiBC,4CAAqB;AAE1D,2EAAgC,kBAAkB,CAChD,iFAAsC;EACpC,WAAW;EACX,KAAK,OAAO,IAAI;EAChB,QAAQ;EACR;EACA,YAAY,UAAU,YAAYC,6CAAiB,UAAU,QAAQ;EACrE,YAAY,eAAeC,oCAAc,YAAY,aAAa;EACnE,CAAC;CAGJ,MAAM,eAAe;AASrB,QAAOA,oCALYD,6CACjB,GAAG,OAAO,IAAI,CAAC,GAAG,gBAClB,aAAa,iBAA8C,CAG9B,EAAE,aAAa"}
@@ -3,15 +3,20 @@ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  const require_getIntlayer = require('../getIntlayer.cjs');
4
4
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
5
5
  let preact_hooks = require("preact/hooks");
6
+ let _intlayer_core_dictionaryManipulator = require("@intlayer/core/dictionaryManipulator");
6
7
 
7
8
  //#region src/client/useIntlayer.ts
8
9
  /**
9
10
  * Preact hook that picks one dictionary by its key and returns its content.
10
11
  *
11
- * If the locale is not provided, it will use the locale from the client context.
12
+ * The second argument is either a locale or a selector object:
13
+ * - `{ item: 2 }` — collection item (omit `item` to get every item as array)
14
+ * - `{ variant: 'black-friday' }` — named variant (omit for the `default` one)
15
+ * - `{ id: 'prod_abc', ...metaFields }` — meta record
16
+ * - `locale` composes with any selector and overrides the context locale
12
17
  *
13
18
  * @param key - The unique key of the dictionary to retrieve.
14
- * @param locale - Optional locale to override the current context locale.
19
+ * @param localeOrSelector - Optional locale or selector.
15
20
  * @returns The transformed dictionary content.
16
21
  *
17
22
  * @example
@@ -20,19 +25,25 @@ let preact_hooks = require("preact/hooks");
20
25
  *
21
26
  * const MyComponent = () => {
22
27
  * const content = useIntlayer('my-dictionary-key');
28
+ * const faq2 = useIntlayer('faq', { item: 2 });
23
29
  *
24
30
  * return <div>{content.myField.value}</div>;
25
31
  * };
26
32
  * ```
27
33
  */
28
- const useIntlayer = (key, locale) => {
34
+ const useIntlayer = (key, localeOrSelector) => {
29
35
  const { locale: currentLocale } = (0, preact_hooks.useContext)(require_client_IntlayerProvider.IntlayerClientContext) ?? {};
36
+ const isSelector = typeof localeOrSelector === "object" && localeOrSelector !== null;
30
37
  return (0, preact_hooks.useMemo)(() => {
31
- return require_getIntlayer.getIntlayer(key, locale ?? currentLocale);
38
+ if (isSelector) return require_getIntlayer.getIntlayer(key, {
39
+ ...localeOrSelector,
40
+ locale: localeOrSelector.locale ?? currentLocale
41
+ });
42
+ return require_getIntlayer.getIntlayer(key, localeOrSelector ?? currentLocale);
32
43
  }, [
33
44
  key,
34
45
  currentLocale,
35
- locale
46
+ isSelector ? `${localeOrSelector.locale ?? ""}|${(0, _intlayer_core_dictionaryManipulator.getDictionarySelectorCacheKey)(localeOrSelector)}` : localeOrSelector
36
47
  ]);
37
48
  };
38
49
 
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayer.cjs","names":["IntlayerClientContext","getIntlayer"],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import type {\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { getIntlayer } from '../getIntlayer';\nimport type { DeepTransformContent } from '../plugins';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * Preact hook that picks one dictionary by its key and returns its content.\n *\n * If the locale is not provided, it will use the locale from the client context.\n *\n * @param key - The unique key of the dictionary to retrieve.\n * @param locale - Optional locale to override the current context locale.\n * @returns The transformed dictionary content.\n *\n * @example\n * ```tsx\n * import { useIntlayer } from 'preact-intlayer';\n *\n * const MyComponent = () => {\n * const content = useIntlayer('my-dictionary-key');\n *\n * return <div>{content.myField.value}</div>;\n * };\n * ```\n */\nexport const useIntlayer = <\n const T extends DictionaryKeys,\n const L extends LocalesValues,\n>(\n key: T,\n locale?: L\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n return useMemo(() => {\n const localeTarget = locale ?? currentLocale;\n\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n return getIntlayer<T, L>(key, localeTarget as L) as DeepTransformContent<\n DictionaryRegistryContent<T>\n >;\n }, [key, currentLocale, locale]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,eAIX,KACA,WACG;CACH,MAAM,EAAE,QAAQ,+CAA6BA,sDAAsB,IAAI,EAAE;AAEzE,wCAAqB;AAInB,SAAOC,gCAAkB,KAHJ,UAAU,cAGiB;IAG/C;EAAC;EAAK;EAAe;EAAO,CAAC"}
1
+ {"version":3,"file":"useIntlayer.cjs","names":["IntlayerClientContext","getIntlayer"],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { getDictionarySelectorCacheKey } from '@intlayer/core/dictionaryManipulator';\nimport type { DictionarySelector } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionarySelectorForKey,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { getIntlayer } from '../getIntlayer';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * Preact hook that picks one dictionary by its key and returns its content.\n *\n * The second argument is either a locale or a selector object:\n * - `{ item: 2 }` — collection item (omit `item` to get every item as array)\n * - `{ variant: 'black-friday' }` — named variant (omit for the `default` one)\n * - `{ id: 'prod_abc', ...metaFields }` — meta record\n * - `locale` composes with any selector and overrides the context locale\n *\n * @param key - The unique key of the dictionary to retrieve.\n * @param localeOrSelector - Optional locale or selector.\n * @returns The transformed dictionary content.\n *\n * @example\n * ```tsx\n * import { useIntlayer } from 'preact-intlayer';\n *\n * const MyComponent = () => {\n * const content = useIntlayer('my-dictionary-key');\n * const faq2 = useIntlayer('faq', { item: 2 });\n *\n * return <div>{content.myField.value}</div>;\n * };\n * ```\n */\nexport const useIntlayer = <\n const T extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales,\n>(\n key: T,\n localeOrSelector?: A\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n const isSelector =\n typeof localeOrSelector === 'object' && localeOrSelector !== null;\n\n // Stable identity of the second argument for memoization\n const localeOrSelectorIdentity = isSelector\n ? `${localeOrSelector.locale ?? ''}|${getDictionarySelectorCacheKey(localeOrSelector)}`\n : localeOrSelector;\n\n return useMemo(() => {\n if (isSelector) {\n return getIntlayer(key, {\n ...localeOrSelector,\n locale: localeOrSelector.locale ?? currentLocale,\n } as A);\n }\n\n const localeTarget = (localeOrSelector ?? currentLocale) as A;\n\n return getIntlayer<T, A>(key, localeTarget);\n }, [key, currentLocale, localeOrSelectorIdentity]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,eAIX,KACA,qBACG;CACH,MAAM,EAAE,QAAQ,+CAA6BA,sDAAsB,IAAI,EAAE;CAEzE,MAAM,aACJ,OAAO,qBAAqB,YAAY,qBAAqB;AAO/D,wCAAqB;AACnB,MAAI,WACF,QAAOC,gCAAY,KAAK;GACtB,GAAG;GACH,QAAQ,iBAAiB,UAAU;GACpC,CAAM;AAKT,SAAOA,gCAAkB,KAFH,oBAAoB,cAEC;IAC1C;EAAC;EAAK;EAfwB,aAC7B,GAAG,iBAAiB,UAAU,GAAG,2EAAiC,iBAAiB,KACnF;EAa6C,CAAC"}
@@ -4,7 +4,14 @@ const require_plugins = require('./plugins.cjs');
4
4
  let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
5
5
 
6
6
  //#region src/getDictionary.ts
7
- const getDictionary = (dictionary, locale) => (0, _intlayer_core_interpreter.getDictionary)(dictionary, locale, require_plugins.getPlugins(locale));
7
+ /**
8
+ * Transforms a dictionary (or qualified dictionary group) and returns its
9
+ * content for the given locale or selector (`{ item }`, `{ variant }`,
10
+ * `{ id, ...meta }`, optionally combined with `locale`).
11
+ */
12
+ const getDictionary = (dictionary, localeOrSelector) => {
13
+ return (0, _intlayer_core_interpreter.getDictionary)(dictionary, localeOrSelector, require_plugins.getPlugins(typeof localeOrSelector === "object" && localeOrSelector !== null ? localeOrSelector.locale : localeOrSelector));
14
+ };
8
15
 
9
16
  //#endregion
10
17
  exports.getDictionary = getDictionary;
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.cjs","names":["getPlugins"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import { getDictionary as getDictionaryCore } from '@intlayer/core/interpreter';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\nexport const getDictionary = <\n const T extends Dictionary,\n const L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L\n): DeepTransformContent<T['content']> =>\n getDictionaryCore<T, L>(dictionary, locale, getPlugins(locale)) as any;\n"],"mappings":";;;;;;AAQA,MAAa,iBAIX,YACA,yDAEwB,YAAY,QAAQA,2BAAW,OAAO,CAAC"}
1
+ {"version":3,"file":"getDictionary.cjs","names":["getPlugins"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import { getDictionary as getDictionaryCore } from '@intlayer/core/interpreter';\nimport type {\n Dictionary,\n DictionarySelector,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\n/**\n * Transforms a dictionary (or qualified dictionary group) and returns its\n * content for the given locale or selector (`{ item }`, `{ variant }`,\n * `{ id, ...meta }`, optionally combined with `locale`).\n */\nexport const getDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends\n | LocalesValues\n | DictionarySelectorForGroup<T> = DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n): DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n> => {\n const locale = (\n typeof localeOrSelector === 'object' && localeOrSelector !== null\n ? localeOrSelector.locale\n : localeOrSelector\n ) as LocalesValues | undefined;\n\n return getDictionaryCore(\n dictionary,\n localeOrSelector,\n getPlugins(locale)\n ) as any;\n};\n"],"mappings":";;;;;;;;;;;AAoBA,MAAa,iBAMX,YACA,qBAIG;AAOH,sDACE,YACA,kBACAA,2BARA,OAAO,qBAAqB,YAAY,qBAAqB,OACzD,iBAAiB,SACjB,iBAMc,CACnB"}
@@ -4,7 +4,14 @@ const require_plugins = require('./plugins.cjs');
4
4
  let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
5
5
 
6
6
  //#region src/getIntlayer.ts
7
- const getIntlayer = (key, locale) => (0, _intlayer_core_interpreter.getIntlayer)(key, locale, require_plugins.getPlugins(locale));
7
+ /**
8
+ * Picks one dictionary by its key and returns its content for the given
9
+ * locale or selector (`{ item }`, `{ variant }`, `{ id, ...meta }`,
10
+ * optionally combined with `locale`).
11
+ */
12
+ const getIntlayer = (key, localeOrSelector) => {
13
+ return (0, _intlayer_core_interpreter.getIntlayer)(key, localeOrSelector, require_plugins.getPlugins(typeof localeOrSelector === "object" && localeOrSelector !== null ? localeOrSelector.locale : localeOrSelector));
14
+ };
8
15
 
9
16
  //#endregion
10
17
  exports.getIntlayer = getIntlayer;
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.cjs","names":["getPlugins"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore } from '@intlayer/core/interpreter';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\nexport const getIntlayer = <\n const T extends DictionaryKeys,\n const L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L\n) =>\n getIntlayerCore<T, L>(\n key,\n locale,\n getPlugins(locale)\n ) as DeepTransformContent<DictionaryRegistryContent<T>>;\n"],"mappings":";;;;;;AASA,MAAa,eAIX,KACA,uDAGE,KACA,QACAA,2BAAW,OAAO,CACnB"}
1
+ {"version":3,"file":"getIntlayer.cjs","names":["getPlugins"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore } from '@intlayer/core/interpreter';\nimport type { DictionarySelector } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryResult,\n DictionarySelectorForKey,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\n/**\n * Picks one dictionary by its key and returns its content for the given\n * locale or selector (`{ item }`, `{ variant }`, `{ id, ...meta }`,\n * optionally combined with `locale`).\n */\nexport const getIntlayer = <\n const T extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales,\n>(\n key: T,\n localeOrSelector?: A\n): DeepTransformContent<\n DictionaryRegistryResult<T, A>,\n ExtractSelectorLocale<A>\n> => {\n const locale = (\n typeof localeOrSelector === 'object' && localeOrSelector !== null\n ? localeOrSelector.locale\n : localeOrSelector\n ) as LocalesValues | undefined;\n\n return getIntlayerCore(key, localeOrSelector, getPlugins(locale)) as any;\n};\n"],"mappings":";;;;;;;;;;;AAiBA,MAAa,eAIX,KACA,qBAIG;AAOH,oDAAuB,KAAK,kBAAkBA,2BAL5C,OAAO,qBAAqB,YAAY,qBAAqB,OACzD,iBAAiB,SACjB,iBAG0D,CAAC"}
@@ -1,21 +1,30 @@
1
1
  import { getDictionary } from "../getDictionary.mjs";
2
2
  import { IntlayerClientContext } from "./IntlayerProvider.mjs";
3
3
  import { useContext, useMemo } from "preact/hooks";
4
+ import { getDictionarySelectorCacheKey } from "@intlayer/core/dictionaryManipulator";
4
5
 
5
6
  //#region src/client/useDictionary.ts
6
7
  /**
7
- * On the server side, Hook that transform a dictionary and return the content
8
+ * Preact hook that transforms a dictionary (or qualified dictionary group) and
9
+ * returns the content.
8
10
  *
9
- * If the locale is not provided, it will use the locale from the client context
11
+ * If the locale is not provided (directly or through the selector), it will use
12
+ * the locale from the client context.
10
13
  */
11
- const useDictionary = (dictionary, locale) => {
14
+ const useDictionary = (dictionary, localeOrSelector) => {
12
15
  const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};
16
+ const isSelector = typeof localeOrSelector === "object" && localeOrSelector !== null;
17
+ const localeOrSelectorIdentity = isSelector ? `${localeOrSelector.locale ?? ""}|${getDictionarySelectorCacheKey(localeOrSelector)}` : localeOrSelector;
13
18
  return useMemo(() => {
14
- return getDictionary(dictionary, locale ?? currentLocale);
19
+ if (isSelector) return getDictionary(dictionary, {
20
+ ...localeOrSelector,
21
+ locale: localeOrSelector.locale ?? currentLocale
22
+ });
23
+ return getDictionary(dictionary, localeOrSelector ?? currentLocale);
15
24
  }, [
16
25
  dictionary.key,
17
26
  currentLocale,
18
- locale
27
+ localeOrSelectorIdentity
19
28
  ]);
20
29
  };
21
30
 
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionary.mjs","names":[],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { getDictionary } from '../getDictionary';\nimport { IntlayerClientContext } from './IntlayerProvider';\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 useDictionary = <\n const T extends Dictionary,\n const L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n return useMemo(() => {\n const localeTarget = locale ?? currentLocale;\n\n return getDictionary<T, L>(dictionary, localeTarget as L);\n }, [dictionary.key, currentLocale, locale]);\n};\n"],"mappings":";;;;;;;;;;AAcA,MAAa,iBAIX,YACA,WACG;CACH,MAAM,EAAE,QAAQ,kBAAkB,WAAW,sBAAsB,IAAI,EAAE;AAEzE,QAAO,cAAc;AAGnB,SAAO,cAAoB,YAFN,UAAU,cAE0B;IACxD;EAAC,WAAW;EAAK;EAAe;EAAO,CAAC"}
1
+ {"version":3,"file":"useDictionary.mjs","names":[],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { getDictionarySelectorCacheKey } from '@intlayer/core/dictionaryManipulator';\nimport type {\n Dictionary,\n DictionarySelector,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { getDictionary } from '../getDictionary';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * Preact hook that transforms a dictionary (or qualified dictionary group) and\n * returns the content.\n *\n * If the locale is not provided (directly or through the selector), it will use\n * the locale from the client context.\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends\n | LocalesValues\n | DictionarySelectorForGroup<T> = DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n const isSelector =\n typeof localeOrSelector === 'object' && localeOrSelector !== null;\n\n // Stable identity of the second argument for memoization\n const localeOrSelectorIdentity = isSelector\n ? `${localeOrSelector.locale ?? ''}|${getDictionarySelectorCacheKey(localeOrSelector)}`\n : localeOrSelector;\n\n return useMemo(() => {\n if (isSelector) {\n return getDictionary(dictionary, {\n ...localeOrSelector,\n locale: localeOrSelector.locale ?? currentLocale,\n } as A);\n }\n\n const localeTarget = (localeOrSelector ?? currentLocale) as A;\n\n return getDictionary<T, A>(dictionary, localeTarget);\n }, [dictionary.key, currentLocale, localeOrSelectorIdentity]);\n};\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAa,iBAMX,YACA,qBACG;CACH,MAAM,EAAE,QAAQ,kBAAkB,WAAW,sBAAsB,IAAI,EAAE;CAEzE,MAAM,aACJ,OAAO,qBAAqB,YAAY,qBAAqB;CAG/D,MAAM,2BAA2B,aAC7B,GAAG,iBAAiB,UAAU,GAAG,GAAG,8BAA8B,iBAAiB,KACnF;AAEJ,QAAO,cAAc;AACnB,MAAI,WACF,QAAO,cAAc,YAAY;GAC/B,GAAG;GACH,QAAQ,iBAAiB,UAAU;GACpC,CAAM;AAKT,SAAO,cAAoB,YAFL,oBAAoB,cAEU;IACnD;EAAC,WAAW;EAAK;EAAe;EAAyB,CAAC"}
@@ -1,18 +1,36 @@
1
1
  import { useLoadDynamic } from "./useLoadDynamic.mjs";
2
+ import { getDictionary } from "../getDictionary.mjs";
2
3
  import { IntlayerClientContext } from "./IntlayerProvider.mjs";
3
- import { useDictionary } from "./useDictionary.mjs";
4
- import { useContext, useMemo } from "preact/hooks";
4
+ import { internationalization } from "@intlayer/config/built";
5
+ import { useContext } from "preact/hooks";
6
+ import { isQualifiedDynamicLoaderMap, parseDictionarySelector, resolveQualifiedDynamicContent } from "@intlayer/core/dictionaryManipulator";
5
7
 
6
8
  //#region src/client/useDictionaryDynamic.ts
7
9
  /**
8
- * On the server side, Hook that transform a dictionary and return the content
10
+ * Preact hook that lazily loads a dictionary and returns its content.
9
11
  *
10
- * If the locale is not provided, it will use the locale from the client context
12
+ * The dictionary entry is either a plain dynamic loader map
13
+ * (`locale → loader`) or a qualified one (`locale → …qualifier → loader`,
14
+ * tagged with the qualifier dimensions). For qualified maps, only the chunk(s)
15
+ * the selector targets are loaded.
16
+ *
17
+ * If the locale is not provided (directly or through the selector), the client
18
+ * context locale is used.
11
19
  */
12
- const useDictionaryDynamic = (dictionaryPromise, key, locale) => {
20
+ const useDictionaryDynamic = (dictionaryPromise, key, localeOrSelector) => {
13
21
  const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};
14
- const localeTarget = useMemo(() => locale ?? currentLocale, [currentLocale, locale]);
15
- return useDictionary(useLoadDynamic(`${String(key)}.${localeTarget}`, dictionaryPromise[localeTarget]?.()), localeTarget);
22
+ const { locale: selectorLocale, selector } = parseDictionarySelector(localeOrSelector);
23
+ const localeTarget = selectorLocale ?? currentLocale ?? internationalization.defaultLocale;
24
+ if (isQualifiedDynamicLoaderMap(dictionaryPromise)) return resolveQualifiedDynamicContent({
25
+ loaderMap: dictionaryPromise,
26
+ key: String(key),
27
+ locale: localeTarget,
28
+ selector,
29
+ loadChunk: (cacheKey, promise) => useLoadDynamic(cacheKey, promise),
30
+ transform: (dictionary) => getDictionary(dictionary, localeTarget)
31
+ });
32
+ const plainLoaders = dictionaryPromise;
33
+ return getDictionary(useLoadDynamic(`${String(key)}.${localeTarget}`, plainLoaders[localeTarget]?.()), localeTarget);
16
34
  };
17
35
 
18
36
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.mjs","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DictionaryKeys,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\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 const T extends Dictionary,\n const 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 () => locale ?? currentLocale,\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":";;;;;;;;;;;AAgBA,MAAa,wBAIX,mBACA,KACA,WACG;CACH,MAAM,EAAE,QAAQ,kBAAkB,WAAW,sBAAsB,IAAI,EAAE;CACzE,MAAM,eAAe,cACb,UAAU,eAChB,CAAC,eAAe,OAAO,CACxB;AAOD,QAAO,cALY,eACjB,GAAG,OAAO,IAAI,CAAC,GAAG,gBACjB,kBAA0B,iBAAiB,CAGf,EAAE,aAAa"}
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 resolveQualifiedDynamicContent,\n} from '@intlayer/core/dictionaryManipulator';\nimport type {\n Dictionary,\n DictionarySelector,\n} from '@intlayer/types/dictionary';\nimport type {\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> = LocalesValues,\n>(\n dictionaryPromise:\n | StrictModeLocaleMap<() => Promise<T>>\n | QualifiedDynamicLoaderMap,\n key: K,\n localeOrSelector?: A\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n const { locale: selectorLocale, selector } =\n parseDictionarySelector<LocalesValues>(localeOrSelector);\n\n const localeTarget =\n selectorLocale ?? currentLocale ?? internationalization.defaultLocale;\n\n if (isQualifiedDynamicLoaderMap(dictionaryPromise)) {\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":";;;;;;;;;;;;;;;;;;;AAmCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,EAAE,QAAQ,kBAAkB,WAAW,sBAAsB,IAAI,EAAE;CAEzE,MAAM,EAAE,QAAQ,gBAAgB,aAC9B,wBAAuC,iBAAiB;CAE1D,MAAM,eACJ,kBAAkB,iBAAiB,qBAAqB;AAE1D,KAAI,4BAA4B,kBAAkB,CAChD,QAAO,+BAA+B;EACpC,WAAW;EACX,KAAK,OAAO,IAAI;EAChB,QAAQ;EACR;EACA,YAAY,UAAU,YAAYA,eAAiB,UAAU,QAAQ;EACrE,YAAY,eAAe,cAAc,YAAY,aAAa;EACnE,CAAC;CAGJ,MAAM,eAAe;AASrB,QAAO,cALYA,eACjB,GAAG,OAAO,IAAI,CAAC,GAAG,gBAClB,aAAa,iBAA8C,CAG9B,EAAE,aAAa"}
@@ -1,15 +1,20 @@
1
1
  import { getIntlayer } from "../getIntlayer.mjs";
2
2
  import { IntlayerClientContext } from "./IntlayerProvider.mjs";
3
3
  import { useContext, useMemo } from "preact/hooks";
4
+ import { getDictionarySelectorCacheKey } from "@intlayer/core/dictionaryManipulator";
4
5
 
5
6
  //#region src/client/useIntlayer.ts
6
7
  /**
7
8
  * Preact hook that picks one dictionary by its key and returns its content.
8
9
  *
9
- * If the locale is not provided, it will use the locale from the client context.
10
+ * The second argument is either a locale or a selector object:
11
+ * - `{ item: 2 }` — collection item (omit `item` to get every item as array)
12
+ * - `{ variant: 'black-friday' }` — named variant (omit for the `default` one)
13
+ * - `{ id: 'prod_abc', ...metaFields }` — meta record
14
+ * - `locale` composes with any selector and overrides the context locale
10
15
  *
11
16
  * @param key - The unique key of the dictionary to retrieve.
12
- * @param locale - Optional locale to override the current context locale.
17
+ * @param localeOrSelector - Optional locale or selector.
13
18
  * @returns The transformed dictionary content.
14
19
  *
15
20
  * @example
@@ -18,19 +23,25 @@ import { useContext, useMemo } from "preact/hooks";
18
23
  *
19
24
  * const MyComponent = () => {
20
25
  * const content = useIntlayer('my-dictionary-key');
26
+ * const faq2 = useIntlayer('faq', { item: 2 });
21
27
  *
22
28
  * return <div>{content.myField.value}</div>;
23
29
  * };
24
30
  * ```
25
31
  */
26
- const useIntlayer = (key, locale) => {
32
+ const useIntlayer = (key, localeOrSelector) => {
27
33
  const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};
34
+ const isSelector = typeof localeOrSelector === "object" && localeOrSelector !== null;
28
35
  return useMemo(() => {
29
- return getIntlayer(key, locale ?? currentLocale);
36
+ if (isSelector) return getIntlayer(key, {
37
+ ...localeOrSelector,
38
+ locale: localeOrSelector.locale ?? currentLocale
39
+ });
40
+ return getIntlayer(key, localeOrSelector ?? currentLocale);
30
41
  }, [
31
42
  key,
32
43
  currentLocale,
33
- locale
44
+ isSelector ? `${localeOrSelector.locale ?? ""}|${getDictionarySelectorCacheKey(localeOrSelector)}` : localeOrSelector
34
45
  ]);
35
46
  };
36
47
 
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayer.mjs","names":[],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import type {\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { getIntlayer } from '../getIntlayer';\nimport type { DeepTransformContent } from '../plugins';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * Preact hook that picks one dictionary by its key and returns its content.\n *\n * If the locale is not provided, it will use the locale from the client context.\n *\n * @param key - The unique key of the dictionary to retrieve.\n * @param locale - Optional locale to override the current context locale.\n * @returns The transformed dictionary content.\n *\n * @example\n * ```tsx\n * import { useIntlayer } from 'preact-intlayer';\n *\n * const MyComponent = () => {\n * const content = useIntlayer('my-dictionary-key');\n *\n * return <div>{content.myField.value}</div>;\n * };\n * ```\n */\nexport const useIntlayer = <\n const T extends DictionaryKeys,\n const L extends LocalesValues,\n>(\n key: T,\n locale?: L\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n return useMemo(() => {\n const localeTarget = locale ?? currentLocale;\n\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n return getIntlayer<T, L>(key, localeTarget as L) as DeepTransformContent<\n DictionaryRegistryContent<T>\n >;\n }, [key, currentLocale, locale]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,eAIX,KACA,WACG;CACH,MAAM,EAAE,QAAQ,kBAAkB,WAAW,sBAAsB,IAAI,EAAE;AAEzE,QAAO,cAAc;AAInB,SAAO,YAAkB,KAHJ,UAAU,cAGiB;IAG/C;EAAC;EAAK;EAAe;EAAO,CAAC"}
1
+ {"version":3,"file":"useIntlayer.mjs","names":[],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { getDictionarySelectorCacheKey } from '@intlayer/core/dictionaryManipulator';\nimport type { DictionarySelector } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionarySelectorForKey,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { getIntlayer } from '../getIntlayer';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * Preact hook that picks one dictionary by its key and returns its content.\n *\n * The second argument is either a locale or a selector object:\n * - `{ item: 2 }` — collection item (omit `item` to get every item as array)\n * - `{ variant: 'black-friday' }` — named variant (omit for the `default` one)\n * - `{ id: 'prod_abc', ...metaFields }` — meta record\n * - `locale` composes with any selector and overrides the context locale\n *\n * @param key - The unique key of the dictionary to retrieve.\n * @param localeOrSelector - Optional locale or selector.\n * @returns The transformed dictionary content.\n *\n * @example\n * ```tsx\n * import { useIntlayer } from 'preact-intlayer';\n *\n * const MyComponent = () => {\n * const content = useIntlayer('my-dictionary-key');\n * const faq2 = useIntlayer('faq', { item: 2 });\n *\n * return <div>{content.myField.value}</div>;\n * };\n * ```\n */\nexport const useIntlayer = <\n const T extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales,\n>(\n key: T,\n localeOrSelector?: A\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext) ?? {};\n\n const isSelector =\n typeof localeOrSelector === 'object' && localeOrSelector !== null;\n\n // Stable identity of the second argument for memoization\n const localeOrSelectorIdentity = isSelector\n ? `${localeOrSelector.locale ?? ''}|${getDictionarySelectorCacheKey(localeOrSelector)}`\n : localeOrSelector;\n\n return useMemo(() => {\n if (isSelector) {\n return getIntlayer(key, {\n ...localeOrSelector,\n locale: localeOrSelector.locale ?? currentLocale,\n } as A);\n }\n\n const localeTarget = (localeOrSelector ?? currentLocale) as A;\n\n return getIntlayer<T, A>(key, localeTarget);\n }, [key, currentLocale, localeOrSelectorIdentity]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,eAIX,KACA,qBACG;CACH,MAAM,EAAE,QAAQ,kBAAkB,WAAW,sBAAsB,IAAI,EAAE;CAEzE,MAAM,aACJ,OAAO,qBAAqB,YAAY,qBAAqB;AAO/D,QAAO,cAAc;AACnB,MAAI,WACF,QAAO,YAAY,KAAK;GACtB,GAAG;GACH,QAAQ,iBAAiB,UAAU;GACpC,CAAM;AAKT,SAAO,YAAkB,KAFH,oBAAoB,cAEC;IAC1C;EAAC;EAAK;EAfwB,aAC7B,GAAG,iBAAiB,UAAU,GAAG,GAAG,8BAA8B,iBAAiB,KACnF;EAa6C,CAAC"}
@@ -2,7 +2,14 @@ import { getPlugins } from "./plugins.mjs";
2
2
  import { getDictionary as getDictionary$1 } from "@intlayer/core/interpreter";
3
3
 
4
4
  //#region src/getDictionary.ts
5
- const getDictionary = (dictionary, locale) => getDictionary$1(dictionary, locale, getPlugins(locale));
5
+ /**
6
+ * Transforms a dictionary (or qualified dictionary group) and returns its
7
+ * content for the given locale or selector (`{ item }`, `{ variant }`,
8
+ * `{ id, ...meta }`, optionally combined with `locale`).
9
+ */
10
+ const getDictionary = (dictionary, localeOrSelector) => {
11
+ return getDictionary$1(dictionary, localeOrSelector, getPlugins(typeof localeOrSelector === "object" && localeOrSelector !== null ? localeOrSelector.locale : localeOrSelector));
12
+ };
6
13
 
7
14
  //#endregion
8
15
  export { getDictionary };
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.mjs","names":["getDictionaryCore"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import { getDictionary as getDictionaryCore } from '@intlayer/core/interpreter';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\nexport const getDictionary = <\n const T extends Dictionary,\n const L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L\n): DeepTransformContent<T['content']> =>\n getDictionaryCore<T, L>(dictionary, locale, getPlugins(locale)) as any;\n"],"mappings":";;;;AAQA,MAAa,iBAIX,YACA,WAEAA,gBAAwB,YAAY,QAAQ,WAAW,OAAO,CAAC"}
1
+ {"version":3,"file":"getDictionary.mjs","names":["getDictionaryCore"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import { getDictionary as getDictionaryCore } from '@intlayer/core/interpreter';\nimport type {\n Dictionary,\n DictionarySelector,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\n/**\n * Transforms a dictionary (or qualified dictionary group) and returns its\n * content for the given locale or selector (`{ item }`, `{ variant }`,\n * `{ id, ...meta }`, optionally combined with `locale`).\n */\nexport const getDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends\n | LocalesValues\n | DictionarySelectorForGroup<T> = DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n): DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n> => {\n const locale = (\n typeof localeOrSelector === 'object' && localeOrSelector !== null\n ? localeOrSelector.locale\n : localeOrSelector\n ) as LocalesValues | undefined;\n\n return getDictionaryCore(\n dictionary,\n localeOrSelector,\n getPlugins(locale)\n ) as any;\n};\n"],"mappings":";;;;;;;;;AAoBA,MAAa,iBAMX,YACA,qBAIG;AAOH,QAAOA,gBACL,YACA,kBACA,WARA,OAAO,qBAAqB,YAAY,qBAAqB,OACzD,iBAAiB,SACjB,iBAMc,CACnB"}
@@ -2,7 +2,14 @@ import { getPlugins } from "./plugins.mjs";
2
2
  import { getIntlayer as getIntlayer$1 } from "@intlayer/core/interpreter";
3
3
 
4
4
  //#region src/getIntlayer.ts
5
- const getIntlayer = (key, locale) => getIntlayer$1(key, locale, getPlugins(locale));
5
+ /**
6
+ * Picks one dictionary by its key and returns its content for the given
7
+ * locale or selector (`{ item }`, `{ variant }`, `{ id, ...meta }`,
8
+ * optionally combined with `locale`).
9
+ */
10
+ const getIntlayer = (key, localeOrSelector) => {
11
+ return getIntlayer$1(key, localeOrSelector, getPlugins(typeof localeOrSelector === "object" && localeOrSelector !== null ? localeOrSelector.locale : localeOrSelector));
12
+ };
6
13
 
7
14
  //#endregion
8
15
  export { getIntlayer };
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.mjs","names":["getIntlayerCore"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore } from '@intlayer/core/interpreter';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\nexport const getIntlayer = <\n const T extends DictionaryKeys,\n const L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L\n) =>\n getIntlayerCore<T, L>(\n key,\n locale,\n getPlugins(locale)\n ) as DeepTransformContent<DictionaryRegistryContent<T>>;\n"],"mappings":";;;;AASA,MAAa,eAIX,KACA,WAEAA,cACE,KACA,QACA,WAAW,OAAO,CACnB"}
1
+ {"version":3,"file":"getIntlayer.mjs","names":["getIntlayerCore"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore } from '@intlayer/core/interpreter';\nimport type { DictionarySelector } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryResult,\n DictionarySelectorForKey,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\n/**\n * Picks one dictionary by its key and returns its content for the given\n * locale or selector (`{ item }`, `{ variant }`, `{ id, ...meta }`,\n * optionally combined with `locale`).\n */\nexport const getIntlayer = <\n const T extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales,\n>(\n key: T,\n localeOrSelector?: A\n): DeepTransformContent<\n DictionaryRegistryResult<T, A>,\n ExtractSelectorLocale<A>\n> => {\n const locale = (\n typeof localeOrSelector === 'object' && localeOrSelector !== null\n ? localeOrSelector.locale\n : localeOrSelector\n ) as LocalesValues | undefined;\n\n return getIntlayerCore(key, localeOrSelector, getPlugins(locale)) as any;\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAa,eAIX,KACA,qBAIG;AAOH,QAAOA,cAAgB,KAAK,kBAAkB,WAL5C,OAAO,qBAAqB,YAAY,qBAAqB,OACzD,iBAAiB,SACjB,iBAG0D,CAAC"}
@@ -1,12 +1,12 @@
1
+ import { LocalesValues as LocalesValues$1 } from "../intlayer/dist/types/index.js";
1
2
  import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
2
- import * as _$_intlayer_types0 from "@intlayer/types";
3
3
 
4
4
  //#region src/client/useContent.d.ts
5
5
  /**
6
6
  * On the client side, hook to get the translation content based on the locale
7
7
  */
8
8
  declare const useContent: <Content>(languageContent: StrictModeLocaleMap<Content>) => {
9
- locale: _$_intlayer_types0.LocalesValues;
9
+ locale: LocalesValues$1;
10
10
  content: Content;
11
11
  t: <Content_1 = string>(languageContent: StrictModeLocaleMap<Content_1>) => Content_1;
12
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useContent.d.ts","names":[],"sources":["../../../src/client/useContent.ts"],"mappings":";;;;;;;cAOa,UAAA,YACX,eAAA,EAAiB,mBAAA,CAAoB,OAAA;UAAD,kBAAA,CAAA,aAAA"}
1
+ {"version":3,"file":"useContent.d.ts","names":[],"sources":["../../../src/client/useContent.ts"],"mappings":";;;;;;;cAOa,UAAA,YACX,eAAA,EAAiB,mBAAA,CAAoB,OAAA;UAAD,eAAA"}
@@ -2,15 +2,17 @@ import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins
2
2
  import * as _$_intlayer_core_interpreter0 from "@intlayer/core/interpreter";
3
3
  import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
4
4
  import * as _$_intlayer_types0 from "@intlayer/types";
5
- import { Dictionary } from "@intlayer/types/dictionary";
5
+ import { Dictionary, DictionarySelectorForGroup, QualifiedDictionaryGroup } from "@intlayer/types/dictionary";
6
6
 
7
7
  //#region src/client/useDictionary.d.ts
8
8
  /**
9
- * On the server side, Hook that transform a dictionary and return the content
9
+ * Preact hook that transforms a dictionary (or qualified dictionary group) and
10
+ * returns the content.
10
11
  *
11
- * If the locale is not provided, it will use the locale from the client context
12
+ * If the locale is not provided (directly or through the selector), it will use
13
+ * the locale from the client context.
12
14
  */
13
- declare const useDictionary: <const T extends Dictionary, const L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) => _$_intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1, _$_intlayer_types0.Locale>;
15
+ declare const useDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: T, localeOrSelector?: A) => _$_intlayer_core_interpreter0.DeepTransformContent<_$_intlayer_types0.ResolveQualifiedDictionaryContent<T, A>, IInterpreterPluginState$1, _$_intlayer_types0.ExtractSelectorLocale<A>>;
14
16
  //#endregion
15
17
  export { useDictionary };
16
18
  //# sourceMappingURL=useDictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../src/client/useDictionary.ts"],"mappings":";;;;;;;;;;;;cAca,aAAA,mBACK,UAAA,kBACA,aAAA,GAAgB,eAAA,EAEhC,UAAA,EAAY,CAAA,EACZ,MAAA,GAAS,CAAA,KAAC,6BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,kBAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../src/client/useDictionary.ts"],"mappings":";;;;;;;;;;;;AAsBA;;cAAa,aAAA,mBACK,UAAA,GAAa,wBAAA,kBAEzB,aAAA,GACA,0BAAA,CAA2B,CAAA,IAAK,eAAA,EAEpC,UAAA,EAAY,CAAA,EACZ,gBAAA,GAAmB,CAAA,KAAC,6BAAA,CAAA,oBAAA,CAAA,kBAAA,CAAA,iCAAA,CAAA,CAAA,EAAA,CAAA,GAAA,yBAAA,EAAA,kBAAA,CAAA,qBAAA,CAAA,CAAA"}
@@ -1,16 +1,20 @@
1
- import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
2
- import * as _$_intlayer_core_interpreter0 from "@intlayer/core/interpreter";
3
- import { DictionaryKeys, LocalesValues, StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
4
- import * as _$_intlayer_types0 from "@intlayer/types";
1
+ import { DictionaryKeys, DictionarySelectorForKey, LocalesValues, StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
5
2
  import { Dictionary } from "@intlayer/types/dictionary";
3
+ import { QualifiedDynamicLoaderMap } from "@intlayer/core/dictionaryManipulator";
6
4
 
7
5
  //#region src/client/useDictionaryDynamic.d.ts
8
6
  /**
9
- * On the server side, Hook that transform a dictionary and return the content
7
+ * Preact hook that lazily loads a dictionary and returns its content.
10
8
  *
11
- * If the locale is not provided, it will use the locale from the client context
9
+ * The dictionary entry is either a plain dynamic loader map
10
+ * (`locale → loader`) or a qualified one (`locale → …qualifier → loader`,
11
+ * tagged with the qualifier dimensions). For qualified maps, only the chunk(s)
12
+ * the selector targets are loaded.
13
+ *
14
+ * If the locale is not provided (directly or through the selector), the client
15
+ * context locale is used.
12
16
  */
13
- declare const useDictionaryDynamic: <const T extends Dictionary, const K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => _$_intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1, _$_intlayer_types0.Locale>;
17
+ declare const useDictionaryDynamic: <const T extends Dictionary, const K extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<K> = LocalesValues>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>> | QualifiedDynamicLoaderMap, key: K, localeOrSelector?: A) => any;
14
18
  //#endregion
15
19
  export { useDictionaryDynamic };
16
20
  //# sourceMappingURL=useDictionaryDynamic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;cAgBa,oBAAA,mBACK,UAAA,kBACA,cAAA,EAEhB,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,aAAA,KAAa,6BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,kBAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;AAmCA;;;;;;;;;cAAa,oBAAA,mBACK,UAAA,kBACA,cAAA,kBACA,aAAA,GAAgB,wBAAA,CAAyB,CAAA,IAAK,aAAA,EAE9D,iBAAA,EACI,mBAAA,OAA0B,OAAA,CAAQ,CAAA,KAClC,yBAAA,EACJ,GAAA,EAAK,CAAA,EACL,gBAAA,GAAmB,CAAA"}
@@ -1,14 +1,20 @@
1
- import { DeepTransformContent } from "../plugins.js";
2
- import { DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intlayer/types/module_augmentation";
1
+ import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
2
+ import * as _$_intlayer_core_interpreter0 from "@intlayer/core/interpreter";
3
+ import { DeclaredLocales, DictionaryKeys, DictionarySelectorForKey, LocalesValues } from "@intlayer/types/module_augmentation";
4
+ import * as _$_intlayer_types0 from "@intlayer/types";
3
5
 
4
6
  //#region src/client/useIntlayer.d.ts
5
7
  /**
6
8
  * Preact hook that picks one dictionary by its key and returns its content.
7
9
  *
8
- * If the locale is not provided, it will use the locale from the client context.
10
+ * The second argument is either a locale or a selector object:
11
+ * - `{ item: 2 }` — collection item (omit `item` to get every item as array)
12
+ * - `{ variant: 'black-friday' }` — named variant (omit for the `default` one)
13
+ * - `{ id: 'prod_abc', ...metaFields }` — meta record
14
+ * - `locale` composes with any selector and overrides the context locale
9
15
  *
10
16
  * @param key - The unique key of the dictionary to retrieve.
11
- * @param locale - Optional locale to override the current context locale.
17
+ * @param localeOrSelector - Optional locale or selector.
12
18
  * @returns The transformed dictionary content.
13
19
  *
14
20
  * @example
@@ -17,12 +23,13 @@ import { DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intla
17
23
  *
18
24
  * const MyComponent = () => {
19
25
  * const content = useIntlayer('my-dictionary-key');
26
+ * const faq2 = useIntlayer('faq', { item: 2 });
20
27
  *
21
28
  * return <div>{content.myField.value}</div>;
22
29
  * };
23
30
  * ```
24
31
  */
25
- declare const useIntlayer: <const T extends DictionaryKeys, const L extends LocalesValues>(key: T, locale?: L) => DeepTransformContent<DictionaryRegistryContent<T>>;
32
+ declare const useIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => _$_intlayer_core_interpreter0.DeepTransformContent<_$_intlayer_types0.DictionaryRegistryResult<T, A>, IInterpreterPluginState$1, _$_intlayer_types0.ExtractSelectorLocale<A>>;
26
33
  //#endregion
27
34
  export { useIntlayer };
28
35
  //# sourceMappingURL=useIntlayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayer.d.ts","names":[],"sources":["../../../src/client/useIntlayer.ts"],"mappings":";;;;;;AA8BA;;;;;;;;;;;;;;;;;;cAAa,WAAA,mBACK,cAAA,kBACA,aAAA,EAEhB,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,KAAC,oBAAA,CAAA,yBAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"useIntlayer.d.ts","names":[],"sources":["../../../src/client/useIntlayer.ts"],"mappings":";;;;;;;;;;;AAqCA;;;;;;;;;;;;;;;;;;;;cAAa,WAAA,mBACK,cAAA,kBACA,aAAA,GAAgB,wBAAA,CAAyB,CAAA,IAAK,eAAA,EAE9D,GAAA,EAAK,CAAA,EACL,gBAAA,GAAmB,CAAA,KAAC,6BAAA,CAAA,oBAAA,CAAA,kBAAA,CAAA,wBAAA,CAAA,CAAA,EAAA,CAAA,GAAA,yBAAA,EAAA,kBAAA,CAAA,qBAAA,CAAA,CAAA"}
@@ -1,14 +1,14 @@
1
- import * as _$_intlayer_types0 from "@intlayer/types";
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
2
2
 
3
3
  //#region src/client/useLocaleBase.d.ts
4
4
  /**
5
5
  * On the client side, hook to get the current locale and all related fields
6
6
  */
7
7
  declare const useLocaleBase: () => {
8
- locale: _$_intlayer_types0.LocalesValues;
8
+ locale: LocalesValues;
9
9
  defaultLocale: any;
10
10
  availableLocales: any;
11
- setLocale: (newLocale: _$_intlayer_types0.LocalesValues) => void;
11
+ setLocale: (newLocale: LocalesValues) => void;
12
12
  };
13
13
  //#endregion
14
14
  export { useLocaleBase };
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleBase.d.ts","names":[],"sources":["../../../src/client/useLocaleBase.ts"],"mappings":";;;;;;cASa,aAAA;UASZ,kBAAA,CAAA,aAAA;;;yBAAA,kBAAA,CAAA,aAAA;AAAA"}
1
+ {"version":3,"file":"useLocaleBase.d.ts","names":[],"sources":["../../../src/client/useLocaleBase.ts"],"mappings":";;;;;;cASa,aAAA;UASZ,aAAA;;;yBAAA,aAAA;AAAA"}
@@ -1,17 +1,17 @@
1
+ import { Locale } from "../intlayer/dist/types/index.js";
1
2
  import { LocalesValues } from "@intlayer/types/module_augmentation";
2
- import * as _$_intlayer_types0 from "@intlayer/types";
3
3
 
4
4
  //#region src/client/useLocaleStorage.d.ts
5
5
  /**
6
6
  * Get the locale cookie
7
7
  */
8
- declare const localeInStorage: _$_intlayer_types0.Locale;
8
+ declare const localeInStorage: Locale;
9
9
  /**
10
10
  * @deprecated Use localeInStorage instead
11
11
  *
12
12
  * Get the locale cookie
13
13
  */
14
- declare const localeCookie: _$_intlayer_types0.Locale;
14
+ declare const localeCookie: Locale;
15
15
  /**
16
16
  * Set the locale cookie
17
17
  */
@@ -26,7 +26,7 @@ declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: boolean)
26
26
  * Hook that provides the locale storage and a function to set it
27
27
  */
28
28
  declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
29
- getLocale: () => _$_intlayer_types0.Locale;
29
+ getLocale: () => Locale;
30
30
  setLocale: (locale: LocalesValues) => void;
31
31
  };
32
32
  /**
@@ -37,7 +37,7 @@ declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
37
37
  * Hook that provides the locale cookie and a function to set it
38
38
  */
39
39
  declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
40
- getLocale: () => _$_intlayer_types0.Locale;
40
+ getLocale: () => Locale;
41
41
  setLocale: (locale: LocalesValues) => void;
42
42
  };
43
43
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;cAYa,eAAA,EAAkE,kBAAA,CAAnD,MAAA;;;;;AAM5B;cAAa,YAAA,EAA8B,kBAAA,CAAlB,MAAA;;;;cAKZ,kBAAA,GACX,MAAA,EAAQ,aAAA,EACR,eAAA;;;;;;cAYW,eAAA,GAAe,MAAA,EAblB,aAAA,EAAa,eAAA;;;AAavB;cAKa,gBAAA,GAAoB,eAAA;mBAQ9B,kBAAA,CAAA,MAAA;sBAAA,aAAA;AAAA;;;;;AARH;;;cAiBa,eAAA,GAAe,eAAA;mBAAmB,kBAAA,CAAA,MAAA;sBAAA,aAAA;AAAA"}
1
+ {"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;cAYa,eAAA,EAAkE,MAAA;;;;;AAM/E;cAAa,YAAA,EAA8B,MAAA;;;;cAK9B,kBAAA,GACX,MAAA,EAAQ,aAAA,EACR,eAAA;;;;;;cAYW,eAAA,GAAe,MAAA,EAblB,aAAA,EAAa,eAAA;;;AAavB;cAKa,gBAAA,GAAoB,eAAA;mBAQ9B,MAAA;sBAAA,aAAA;AAAA;;;;;AARH;;;cAiBa,eAAA,GAAe,eAAA;mBAAmB,MAAA;sBAAA,aAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import * as _$_intlayer_types0 from "@intlayer/types";
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
2
2
 
3
3
  //#region src/format/useCompact.d.ts
4
4
  /**
@@ -12,7 +12,7 @@ import * as _$_intlayer_types0 from "@intlayer/types";
12
12
  * ```
13
13
  */
14
14
  declare const useCompact: () => (value: string | number, options?: Intl.NumberFormatOptions & {
15
- locale?: _$_intlayer_types0.LocalesValues;
15
+ locale?: LocalesValues;
16
16
  }) => string;
17
17
  //#endregion
18
18
  export { useCompact };
@@ -1 +1 @@
1
- {"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;;;;;AAcA;;;;;;;cAAa,UAAA,SAAU,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,kBAAA,CAAA,aAAA;AAAA"}
1
+ {"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;;;;;AAcA;;;;;;;cAAa,UAAA,SAAU,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import * as _$_intlayer_types0 from "@intlayer/types";
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
2
2
 
3
3
  //#region src/format/useCurrency.d.ts
4
4
  /**
@@ -26,7 +26,7 @@ import * as _$_intlayer_types0 from "@intlayer/types";
26
26
  * ```
27
27
  */
28
28
  declare const useCurrency: () => (value: string | number, options?: Intl.NumberFormatOptions & {
29
- locale?: _$_intlayer_types0.LocalesValues;
29
+ locale?: LocalesValues;
30
30
  }) => string;
31
31
  //#endregion
32
32
  export { useCurrency };
@@ -1 +1 @@
1
- {"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;;;;;AA4BA;;;;;;;;;;;;;;;;;;;;;cAAa,WAAA,SAAW,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,kBAAA,CAAA,aAAA;AAAA"}
1
+ {"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;;;;;AA4BA;;;;;;;;;;;;;;;;;;;;;cAAa,WAAA,SAAW,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import * as _$_intlayer_types0 from "@intlayer/types";
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
2
2
 
3
3
  //#region src/format/useList.d.ts
4
4
  /**
@@ -27,7 +27,7 @@ declare const useList: () => (values: (string | number)[], options?: {
27
27
  type?: "conjunction" | "disjunction" | "unit";
28
28
  style?: "long" | "short" | "narrow";
29
29
  } & {
30
- locale?: _$_intlayer_types0.LocalesValues;
30
+ locale?: LocalesValues;
31
31
  }) => string;
32
32
  //#endregion
33
33
  export { useList };
@@ -1 +1 @@
1
- {"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;;;;;AAyBA;;;;;;;;;;;;;;;;;;cAAa,OAAA,SAAO,MAAA,uBAAA,OAAA;;;;;WAWnB,kBAAA,CAAA,aAAA;AAAA"}
1
+ {"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;;;;;AAyBA;;;;;;;;;;;;;;;;;;cAAa,OAAA,SAAO,MAAA,uBAAA,OAAA;;;;;WAWnB,aAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import * as _$_intlayer_types0 from "@intlayer/types";
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
2
2
 
3
3
  //#region src/format/useNumber.d.ts
4
4
  /**
@@ -24,7 +24,7 @@ import * as _$_intlayer_types0 from "@intlayer/types";
24
24
  * A number formatting function bound to the active locale.
25
25
  */
26
26
  declare const useNumber: () => (value: string | number, args_1?: Intl.NumberFormatOptions & {
27
- locale?: _$_intlayer_types0.LocalesValues;
27
+ locale?: LocalesValues;
28
28
  }) => string;
29
29
  //#endregion
30
30
  export { useNumber };
@@ -1 +1 @@
1
- {"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;;AA0BA;;;;;;;;;;;;;;;;;;;cAAa,SAAA,SAAS,KAAA,mBAAA,MAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,kBAAA,CAAA,aAAA;AAAA"}
1
+ {"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;;AA0BA;;;;;;;;;;;;;;;;;;;cAAa,SAAA,SAAS,KAAA,mBAAA,MAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import * as _$_intlayer_types0 from "@intlayer/types";
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
2
2
 
3
3
  //#region src/format/usePercentage.d.ts
4
4
  /**
@@ -20,7 +20,7 @@ import * as _$_intlayer_types0 from "@intlayer/types";
20
20
  * A function that formats numbers or numeric strings into localized percentages.
21
21
  */
22
22
  declare const usePercentage: () => (value: string | number, args_1?: Intl.NumberFormatOptions & {
23
- locale?: _$_intlayer_types0.LocalesValues;
23
+ locale?: LocalesValues;
24
24
  }) => string;
25
25
  //#endregion
26
26
  export { usePercentage };
@@ -1 +1 @@
1
- {"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;;cAAa,aAAA,SAAa,KAAA,mBAAA,MAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,kBAAA,CAAA,aAAA;AAAA"}
1
+ {"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;;cAAa,aAAA,SAAa,KAAA,mBAAA,MAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import * as _$_intlayer_types0 from "@intlayer/types";
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
2
2
 
3
3
  //#region src/format/useRelativeTime.d.ts
4
4
  /**
@@ -20,7 +20,7 @@ import * as _$_intlayer_types0 from "@intlayer/types";
20
20
  * bound to the current client locale.
21
21
  */
22
22
  declare const useRelativeTime: () => (from: string | number | Date, to?: string | number | Date, options?: Intl.RelativeTimeFormatOptions & {
23
- locale?: _$_intlayer_types0.LocalesValues;
23
+ locale?: LocalesValues;
24
24
  unit?: Intl.RelativeTimeFormatUnit;
25
25
  }) => string;
26
26
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;;cAAa,eAAA,SAAe,IAAA,oBAAA,IAAA,EAAA,EAAA,qBAAA,IAAA,EAAA,OAAA,GAAA,IAAA,CAAA,yBAAA;WAAA,kBAAA,CAAA,aAAA"}
1
+ {"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;;cAAa,eAAA,SAAe,IAAA,oBAAA,IAAA,EAAA,EAAA,qBAAA,IAAA,EAAA,OAAA,GAAA,IAAA,CAAA,yBAAA;WAAA,aAAA"}
@@ -1,4 +1,4 @@
1
- import * as _$_intlayer_types0 from "@intlayer/types";
1
+ import { LocalesValues } from "../intlayer/dist/types/index.js";
2
2
 
3
3
  //#region src/format/useUnit.d.ts
4
4
  /**
@@ -19,7 +19,7 @@ import * as _$_intlayer_types0 from "@intlayer/types";
19
19
  * @returns {Function} A unit formatting function that accepts a value and optional formatting options.
20
20
  */
21
21
  declare const useUnit: () => (value: string | number, options?: Intl.NumberFormatOptions & {
22
- locale?: _$_intlayer_types0.LocalesValues;
22
+ locale?: LocalesValues;
23
23
  }) => string;
24
24
  //#endregion
25
25
  export { useUnit };
@@ -1 +1 @@
1
- {"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;;;;;AAqBA;;;;;;;;;;;;;;cAAa,OAAA,SAAO,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,kBAAA,CAAA,aAAA;AAAA"}
1
+ {"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;;;;;AAqBA;;;;;;;;;;;;;;cAAa,OAAA,SAAO,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
@@ -1,9 +1,14 @@
1
1
  import { DeepTransformContent } from "./plugins.js";
2
- import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
3
- import { Dictionary } from "@intlayer/types/dictionary";
2
+ import { DeclaredLocales, ExtractSelectorLocale, LocalesValues } from "@intlayer/types/module_augmentation";
3
+ import { Dictionary, DictionarySelectorForGroup, QualifiedDictionaryGroup, ResolveQualifiedDictionaryContent } from "@intlayer/types/dictionary";
4
4
 
5
5
  //#region src/getDictionary.d.ts
6
- declare const getDictionary: <const T extends Dictionary, const L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) => DeepTransformContent<T["content"]>;
6
+ /**
7
+ * Transforms a dictionary (or qualified dictionary group) and returns its
8
+ * content for the given locale or selector (`{ item }`, `{ variant }`,
9
+ * `{ id, ...meta }`, optionally combined with `locale`).
10
+ */
11
+ declare const getDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: T, localeOrSelector?: A) => DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>;
7
12
  //#endregion
8
13
  export { getDictionary };
9
14
  //# sourceMappingURL=getDictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../src/getDictionary.ts"],"mappings":";;;;;cAQa,aAAA,mBACK,UAAA,kBACA,aAAA,GAAgB,eAAA,EAEhC,UAAA,EAAY,CAAA,EACZ,MAAA,GAAS,CAAA,KACR,oBAAA,CAAqB,CAAA"}
1
+ {"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../src/getDictionary.ts"],"mappings":";;;;;;;AAoBA;;;cAAa,aAAA,mBACK,UAAA,GAAa,wBAAA,kBAEzB,aAAA,GACA,0BAAA,CAA2B,CAAA,IAAK,eAAA,EAEpC,UAAA,EAAY,CAAA,EACZ,gBAAA,GAAmB,CAAA,KAClB,oBAAA,CACD,iCAAA,CAAkC,CAAA,EAAG,CAAA,GACrC,qBAAA,CAAsB,CAAA"}
@@ -1,8 +1,13 @@
1
1
  import { DeepTransformContent } from "./plugins.js";
2
- import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intlayer/types/module_augmentation";
2
+ import { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, DictionarySelectorForKey, ExtractSelectorLocale, LocalesValues } from "@intlayer/types/module_augmentation";
3
3
 
4
4
  //#region src/getIntlayer.d.ts
5
- declare const getIntlayer: <const T extends DictionaryKeys, const L extends LocalesValues = DeclaredLocales>(key: T, locale?: L) => DeepTransformContent<DictionaryRegistryContent<T>>;
5
+ /**
6
+ * Picks one dictionary by its key and returns its content for the given
7
+ * locale or selector (`{ item }`, `{ variant }`, `{ id, ...meta }`,
8
+ * optionally combined with `locale`).
9
+ */
10
+ declare const getIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>;
6
11
  //#endregion
7
12
  export { getIntlayer };
8
13
  //# sourceMappingURL=getIntlayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../src/getIntlayer.ts"],"mappings":";;;;cASa,WAAA,mBACK,cAAA,kBACA,aAAA,GAAgB,eAAA,EAEhC,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,KAMJ,oBAAA,CAAqB,yBAAA,CAA0B,CAAA"}
1
+ {"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../src/getIntlayer.ts"],"mappings":";;;;;;AAiBA;;;cAAa,WAAA,mBACK,cAAA,kBACA,aAAA,GAAgB,wBAAA,CAAyB,CAAA,IAAK,eAAA,EAE9D,GAAA,EAAK,CAAA,EACL,gBAAA,GAAmB,CAAA,KAClB,oBAAA,CACD,wBAAA,CAAyB,CAAA,EAAG,CAAA,GAC5B,qBAAA,CAAsB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { LocalesValues as LocalesValues$1 } from "@intlayer/types/module_augmentation";
2
+ import { Locale as Locale$1 } from "@intlayer/types/allLocales";
3
+ import { Dictionary } from "@intlayer/types/dictionary";
4
+ export { type Locale$1 as Locale, type LocalesValues$1 as LocalesValues };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "preact-intlayer",
3
- "version": "8.12.4",
3
+ "version": "9.0.0-canary.0",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Preact applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -100,15 +100,15 @@
100
100
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
101
101
  },
102
102
  "dependencies": {
103
- "@intlayer/api": "8.12.4",
104
- "@intlayer/chokidar": "8.12.4",
105
- "@intlayer/config": "8.12.4",
106
- "@intlayer/core": "8.12.4",
107
- "@intlayer/editor": "8.12.4",
108
- "@intlayer/types": "8.12.4"
103
+ "@intlayer/api": "9.0.0-canary.0",
104
+ "@intlayer/chokidar": "9.0.0-canary.0",
105
+ "@intlayer/config": "9.0.0-canary.0",
106
+ "@intlayer/core": "9.0.0-canary.0",
107
+ "@intlayer/editor": "9.0.0-canary.0",
108
+ "@intlayer/types": "9.0.0-canary.0"
109
109
  },
110
110
  "devDependencies": {
111
- "@types/node": "25.9.2",
111
+ "@types/node": "25.9.3",
112
112
  "@utils/ts-config": "1.0.4",
113
113
  "@utils/ts-config-types": "1.0.4",
114
114
  "@utils/tsdown-config": "1.0.4",