angular-intlayer 9.0.0-canary.0 → 9.0.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionary.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs.map +1 -1
- package/dist/esm/client/useDictionary.mjs +1 -1
- package/dist/esm/client/useDictionary.mjs.map +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
- package/dist/esm/client/useIntlayer.mjs +1 -1
- package/dist/esm/client/useIntlayer.mjs.map +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +5 -5
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
- package/dist/types/format/useCompact.d.ts +2 -2
- package/dist/types/format/useCompact.d.ts.map +1 -1
- package/dist/types/format/useCurrency.d.ts +2 -2
- package/dist/types/format/useCurrency.d.ts.map +1 -1
- package/dist/types/format/useDate.d.ts +2 -2
- package/dist/types/format/useDate.d.ts.map +1 -1
- package/dist/types/format/useList.d.ts +2 -2
- package/dist/types/format/useList.d.ts.map +1 -1
- package/dist/types/format/useNumber.d.ts +2 -2
- package/dist/types/format/useNumber.d.ts.map +1 -1
- package/dist/types/format/usePercentage.d.ts +2 -2
- package/dist/types/format/usePercentage.d.ts.map +1 -1
- package/dist/types/format/useRelativeTime.d.ts +2 -2
- package/dist/types/format/useRelativeTime.d.ts.map +1 -1
- package/dist/types/format/useUnit.d.ts +2 -2
- package/dist/types/format/useUnit.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/types/intlayer/dist/types/index.d.ts +0 -4
|
@@ -11,7 +11,7 @@ let _angular_core = require("@angular/core");
|
|
|
11
11
|
*/
|
|
12
12
|
const useDictionary = (dictionary, localeOrSelector) => {
|
|
13
13
|
const intlayer = (0, _angular_core.inject)(require_client_intlayerToken.INTLAYER_TOKEN);
|
|
14
|
-
const isSelector = typeof localeOrSelector === "object" && localeOrSelector !== null;
|
|
14
|
+
const isSelector = process.env["INTLAYER_DICTIONARY_SELECTOR"] !== "false" && typeof localeOrSelector === "object" && localeOrSelector !== null;
|
|
15
15
|
return (0, _angular_core.computed)(() => {
|
|
16
16
|
const currentLocale = intlayer?.locale();
|
|
17
17
|
if (isSelector) return require_getDictionary.getDictionary(dictionary, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.cjs","names":["INTLAYER_TOKEN","getDictionary"],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\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 { getDictionary } from '../getDictionary';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/**\n * Angular hook that transforms a dictionary (or qualified dictionary group)\n * and returns its reactive content for the given locale or selector.\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): Signal<\n DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n >\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const isSelector =\n typeof localeOrSelector === 'object'
|
|
1
|
+
{"version":3,"file":"useDictionary.cjs","names":["INTLAYER_TOKEN","getDictionary"],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\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 { getDictionary } from '../getDictionary';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/**\n * Angular hook that transforms a dictionary (or qualified dictionary group)\n * and returns its reactive content for the given locale or selector.\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): Signal<\n DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n >\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const isSelector =\n process.env['INTLAYER_DICTIONARY_SELECTOR'] !== 'false' &&\n typeof localeOrSelector === 'object' &&\n localeOrSelector !== null;\n\n /** a *stable* reactive dictionary object */\n const content = computed(() => {\n const currentLocale = intlayer?.locale();\n\n if (isSelector) {\n return getDictionary(dictionary, {\n ...localeOrSelector,\n locale: localeOrSelector.locale ?? currentLocale,\n } as A) as any;\n }\n\n return getDictionary(\n dictionary,\n (localeOrSelector ?? currentLocale) as A\n ) as any;\n });\n\n return content; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;;;;;AAqBA,MAAa,iBAMX,YACA,qBAMG;CACH,MAAM,qCAAoCA,4CAAe;CAEzD,MAAM,aACJ,QAAQ,IAAI,oCAAoC,WAChD,OAAO,qBAAqB,YAC5B,qBAAqB;AAmBvB,0CAhB+B;EAC7B,MAAM,gBAAgB,UAAU,QAAQ;AAExC,MAAI,WACF,QAAOC,oCAAc,YAAY;GAC/B,GAAG;GACH,QAAQ,iBAAiB,UAAU;GACpC,CAAM;AAGT,SAAOA,oCACL,YACC,oBAAoB,cACtB;GAGW"}
|
|
@@ -24,7 +24,7 @@ let _intlayer_core_dictionaryManipulator = require("@intlayer/core/dictionaryMan
|
|
|
24
24
|
*/
|
|
25
25
|
const useDictionaryDynamic = (dictionaryPromise, key, localeOrSelector) => {
|
|
26
26
|
const intlayer = (0, _angular_core.inject)(require_client_intlayerToken.INTLAYER_TOKEN);
|
|
27
|
-
if ((0, _intlayer_core_dictionaryManipulator.isQualifiedDynamicLoaderMap)(dictionaryPromise)) {
|
|
27
|
+
if (process.env["INTLAYER_DICTIONARY_SELECTOR"] !== "false" && (0, _intlayer_core_dictionaryManipulator.isQualifiedDynamicLoaderMap)(dictionaryPromise)) {
|
|
28
28
|
const { locale: selectorLocale, selector } = (0, _intlayer_core_dictionaryManipulator.parseDictionarySelector)(localeOrSelector);
|
|
29
29
|
const localeTarget = selectorLocale ?? intlayer?.locale() ?? _intlayer_config_built.internationalization.defaultLocale;
|
|
30
30
|
const container = (0, _angular_core.signal)(void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.cjs","names":["INTLAYER_TOKEN","internationalization","getDictionary","useDictionary","useLoadDynamic"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject, signal } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport {\n isQualifiedDynamicLoaderMap,\n parseDictionarySelector,\n type QualifiedDynamicLoaderMap,\n resolveQualifiedDynamicContentAsync,\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 { getDictionary } from '../getDictionary';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * Lazily loads a dictionary (plain or qualified) and returns its reactive\n * content.\n *\n * For a qualified loader map (collection / variant / meta record, possibly\n * combined), only the chunk(s) the selector targets are loaded. For a plain\n * loader map, the locale chunk is loaded.\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 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 intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n if (isQualifiedDynamicLoaderMap(dictionaryPromise)) {\n const { locale: selectorLocale, selector } =\n parseDictionarySelector<LocalesValues>(localeOrSelector);\n\n const localeTarget =\n selectorLocale ??\n intlayer?.locale() ??\n internationalization.defaultLocale;\n\n const container = signal<unknown>(undefined);\n\n resolveQualifiedDynamicContentAsync({\n loaderMap: dictionaryPromise,\n key: String(key),\n locale: localeTarget,\n selector,\n transform: (dictionary) => getDictionary(dictionary, localeTarget),\n }).then((resolved) => container.set(resolved));\n\n return computed(() => container() as any);\n }\n\n const locale =\n typeof localeOrSelector === 'string'\n ? (localeOrSelector as LocalesValues)\n : undefined;\n\n const localeTarget = computed(\n () => locale ?? intlayer?.locale() ?? internationalization.defaultLocale\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() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,qCAAoCA,4CAAe;AAEzD,
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.cjs","names":["INTLAYER_TOKEN","internationalization","getDictionary","useDictionary","useLoadDynamic"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject, signal } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport {\n isQualifiedDynamicLoaderMap,\n parseDictionarySelector,\n type QualifiedDynamicLoaderMap,\n resolveQualifiedDynamicContentAsync,\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 { getDictionary } from '../getDictionary';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * Lazily loads a dictionary (plain or qualified) and returns its reactive\n * content.\n *\n * For a qualified loader map (collection / variant / meta record, possibly\n * combined), only the chunk(s) the selector targets are loaded. For a plain\n * loader map, the locale chunk is loaded.\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 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 intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n if (\n process.env['INTLAYER_DICTIONARY_SELECTOR'] !== 'false' &&\n isQualifiedDynamicLoaderMap(dictionaryPromise)\n ) {\n const { locale: selectorLocale, selector } =\n parseDictionarySelector<LocalesValues>(localeOrSelector);\n\n const localeTarget =\n selectorLocale ??\n intlayer?.locale() ??\n internationalization.defaultLocale;\n\n const container = signal<unknown>(undefined);\n\n resolveQualifiedDynamicContentAsync({\n loaderMap: dictionaryPromise,\n key: String(key),\n locale: localeTarget,\n selector,\n transform: (dictionary) => getDictionary(dictionary, localeTarget),\n }).then((resolved) => container.set(resolved));\n\n return computed(() => container() as any);\n }\n\n const locale =\n typeof localeOrSelector === 'string'\n ? (localeOrSelector as LocalesValues)\n : undefined;\n\n const localeTarget = computed(\n () => locale ?? intlayer?.locale() ?? internationalization.defaultLocale\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() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,qCAAoCA,4CAAe;AAEzD,KACE,QAAQ,IAAI,oCAAoC,iFACpB,kBAAkB,EAC9C;EACA,MAAM,EAAE,QAAQ,gBAAgB,+EACS,iBAAiB;EAE1D,MAAM,eACJ,kBACA,UAAU,QAAQ,IAClBC,4CAAqB;EAEvB,MAAM,sCAA4B,OAAU;AAE5C,gFAAoC;GAClC,WAAW;GACX,KAAK,OAAO,IAAI;GAChB,QAAQ;GACR;GACA,YAAY,eAAeC,oCAAc,YAAY,aAAa;GACnE,CAAC,CAAC,MAAM,aAAa,UAAU,IAAI,SAAS,CAAC;AAE9C,2CAAsB,WAAW,CAAQ;;CAG3C,MAAM,SACJ,OAAO,qBAAqB,WACvB,mBACD;CAEN,MAAM,iDACE,UAAU,UAAU,QAAQ,IAAID,4CAAqB,cAC5D;AAOD,QAAOE,2CALYC,6CACjB,GAAG,OAAO,IAAI,CAAC,GAAG,cAAc,IAC/B,kBAA0B,cAAc,KAAK,CAGjB,EAAE,cAAc,CAAQ"}
|
|
@@ -34,7 +34,7 @@ const isUpdatableNode = (val) => !!val && typeof val === "object" && typeof val.
|
|
|
34
34
|
*/
|
|
35
35
|
const useIntlayer = (key, localeOrSelector) => {
|
|
36
36
|
const intlayer = (0, _angular_core.inject)(require_client_intlayerToken.INTLAYER_TOKEN);
|
|
37
|
-
const isSelector = typeof localeOrSelector === "object" && localeOrSelector !== null;
|
|
37
|
+
const isSelector = process.env["INTLAYER_DICTIONARY_SELECTOR"] !== "false" && typeof localeOrSelector === "object" && localeOrSelector !== null;
|
|
38
38
|
return (0, _angular_core.computed)(() => {
|
|
39
39
|
const currentLocale = intlayer.locale();
|
|
40
40
|
if (isSelector) return require_getIntlayer.getIntlayer(key, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayer.cjs","names":["INTLAYER_TOKEN","getIntlayer"],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\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 { getIntlayer } from '../getIntlayer';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/** guard utility - true only for objects generated by `renderIntlayerNode()` */\nexport const isUpdatableNode = (\n val: unknown\n): val is { __update: (n: unknown) => void } =>\n !!val &&\n typeof val === 'object' &&\n typeof (val as any).__update === 'function';\n\n/**\n * Angular hook that picks one dictionary by its key and returns its reactive content.\n *\n * It utilizes Angular signals to provide deep reactivity, ensuring your components\n * update automatically when the locale changes.\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 * ```ts\n * import { Component } from '@angular/core';\n * import { useIntlayer } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-my-component',\n * template: `<div>{{ content().myField.value }}</div>`,\n * })\n * export class MyComponent {\n * content = useIntlayer('my-dictionary-key');\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): Signal<\n DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN)!;\n\n const isSelector =\n typeof localeOrSelector === 'object'
|
|
1
|
+
{"version":3,"file":"useIntlayer.cjs","names":["INTLAYER_TOKEN","getIntlayer"],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\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 { getIntlayer } from '../getIntlayer';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/** guard utility - true only for objects generated by `renderIntlayerNode()` */\nexport const isUpdatableNode = (\n val: unknown\n): val is { __update: (n: unknown) => void } =>\n !!val &&\n typeof val === 'object' &&\n typeof (val as any).__update === 'function';\n\n/**\n * Angular hook that picks one dictionary by its key and returns its reactive content.\n *\n * It utilizes Angular signals to provide deep reactivity, ensuring your components\n * update automatically when the locale changes.\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 * ```ts\n * import { Component } from '@angular/core';\n * import { useIntlayer } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-my-component',\n * template: `<div>{{ content().myField.value }}</div>`,\n * })\n * export class MyComponent {\n * content = useIntlayer('my-dictionary-key');\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): Signal<\n DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN)!;\n\n const isSelector =\n process.env['INTLAYER_DICTIONARY_SELECTOR'] !== 'false' &&\n typeof localeOrSelector === 'object' &&\n localeOrSelector !== null;\n\n /** a *stable* reactive dictionary object */\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const content = computed(() => {\n const currentLocale = intlayer.locale();\n\n if (isSelector) {\n return getIntlayer(key, {\n ...localeOrSelector,\n locale: localeOrSelector.locale ?? currentLocale,\n } as A) as any;\n }\n\n return getIntlayer(key, (localeOrSelector ?? currentLocale) as A) as any;\n });\n\n return content; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;;AAeA,MAAa,mBACX,QAEA,CAAC,CAAC,OACF,OAAO,QAAQ,YACf,OAAQ,IAAY,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BnC,MAAa,eAIX,KACA,qBAGG;CACH,MAAM,qCAAoCA,4CAAe;CAEzD,MAAM,aACJ,QAAQ,IAAI,oCAAoC,WAChD,OAAO,qBAAqB,YAC5B,qBAAqB;AAiBvB,0CAb+B;EAC7B,MAAM,gBAAgB,SAAS,QAAQ;AAEvC,MAAI,WACF,QAAOC,gCAAY,KAAK;GACtB,GAAG;GACH,QAAQ,iBAAiB,UAAU;GACpC,CAAM;AAGT,SAAOA,gCAAY,KAAM,oBAAoB,cAAoB;GAGrD"}
|
|
@@ -9,7 +9,7 @@ import { computed, inject } from "@angular/core";
|
|
|
9
9
|
*/
|
|
10
10
|
const useDictionary = (dictionary, localeOrSelector) => {
|
|
11
11
|
const intlayer = inject(INTLAYER_TOKEN);
|
|
12
|
-
const isSelector = typeof localeOrSelector === "object" && localeOrSelector !== null;
|
|
12
|
+
const isSelector = process.env["INTLAYER_DICTIONARY_SELECTOR"] !== "false" && typeof localeOrSelector === "object" && localeOrSelector !== null;
|
|
13
13
|
return computed(() => {
|
|
14
14
|
const currentLocale = intlayer?.locale();
|
|
15
15
|
if (isSelector) return getDictionary(dictionary, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.mjs","names":[],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\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 { getDictionary } from '../getDictionary';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/**\n * Angular hook that transforms a dictionary (or qualified dictionary group)\n * and returns its reactive content for the given locale or selector.\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): Signal<\n DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n >\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const isSelector =\n typeof localeOrSelector === 'object'
|
|
1
|
+
{"version":3,"file":"useDictionary.mjs","names":[],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\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 { getDictionary } from '../getDictionary';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/**\n * Angular hook that transforms a dictionary (or qualified dictionary group)\n * and returns its reactive content for the given locale or selector.\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): Signal<\n DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n >\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const isSelector =\n process.env['INTLAYER_DICTIONARY_SELECTOR'] !== 'false' &&\n typeof localeOrSelector === 'object' &&\n localeOrSelector !== null;\n\n /** a *stable* reactive dictionary object */\n const content = computed(() => {\n const currentLocale = intlayer?.locale();\n\n if (isSelector) {\n return getDictionary(dictionary, {\n ...localeOrSelector,\n locale: localeOrSelector.locale ?? currentLocale,\n } as A) as any;\n }\n\n return getDictionary(\n dictionary,\n (localeOrSelector ?? currentLocale) as A\n ) as any;\n });\n\n return content; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAa,iBAMX,YACA,qBAMG;CACH,MAAM,WAAW,OAAyB,eAAe;CAEzD,MAAM,aACJ,QAAQ,IAAI,oCAAoC,WAChD,OAAO,qBAAqB,YAC5B,qBAAqB;AAmBvB,QAhBgB,eAAe;EAC7B,MAAM,gBAAgB,UAAU,QAAQ;AAExC,MAAI,WACF,QAAO,cAAc,YAAY;GAC/B,GAAG;GACH,QAAQ,iBAAiB,UAAU;GACpC,CAAM;AAGT,SAAO,cACL,YACC,oBAAoB,cACtB;GAGW"}
|
|
@@ -22,7 +22,7 @@ import { isQualifiedDynamicLoaderMap, parseDictionarySelector, resolveQualifiedD
|
|
|
22
22
|
*/
|
|
23
23
|
const useDictionaryDynamic = (dictionaryPromise, key, localeOrSelector) => {
|
|
24
24
|
const intlayer = inject(INTLAYER_TOKEN);
|
|
25
|
-
if (isQualifiedDynamicLoaderMap(dictionaryPromise)) {
|
|
25
|
+
if (process.env["INTLAYER_DICTIONARY_SELECTOR"] !== "false" && isQualifiedDynamicLoaderMap(dictionaryPromise)) {
|
|
26
26
|
const { locale: selectorLocale, selector } = parseDictionarySelector(localeOrSelector);
|
|
27
27
|
const localeTarget = selectorLocale ?? intlayer?.locale() ?? internationalization.defaultLocale;
|
|
28
28
|
const container = signal(void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.mjs","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject, signal } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport {\n isQualifiedDynamicLoaderMap,\n parseDictionarySelector,\n type QualifiedDynamicLoaderMap,\n resolveQualifiedDynamicContentAsync,\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 { getDictionary } from '../getDictionary';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * Lazily loads a dictionary (plain or qualified) and returns its reactive\n * content.\n *\n * For a qualified loader map (collection / variant / meta record, possibly\n * combined), only the chunk(s) the selector targets are loaded. For a plain\n * loader map, the locale chunk is loaded.\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 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 intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n if (isQualifiedDynamicLoaderMap(dictionaryPromise)) {\n const { locale: selectorLocale, selector } =\n parseDictionarySelector<LocalesValues>(localeOrSelector);\n\n const localeTarget =\n selectorLocale ??\n intlayer?.locale() ??\n internationalization.defaultLocale;\n\n const container = signal<unknown>(undefined);\n\n resolveQualifiedDynamicContentAsync({\n loaderMap: dictionaryPromise,\n key: String(key),\n locale: localeTarget,\n selector,\n transform: (dictionary) => getDictionary(dictionary, localeTarget),\n }).then((resolved) => container.set(resolved));\n\n return computed(() => container() as any);\n }\n\n const locale =\n typeof localeOrSelector === 'string'\n ? (localeOrSelector as LocalesValues)\n : undefined;\n\n const localeTarget = computed(\n () => locale ?? intlayer?.locale() ?? internationalization.defaultLocale\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() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,WAAW,OAAyB,eAAe;AAEzD,
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.mjs","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject, signal } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport {\n isQualifiedDynamicLoaderMap,\n parseDictionarySelector,\n type QualifiedDynamicLoaderMap,\n resolveQualifiedDynamicContentAsync,\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 { getDictionary } from '../getDictionary';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * Lazily loads a dictionary (plain or qualified) and returns its reactive\n * content.\n *\n * For a qualified loader map (collection / variant / meta record, possibly\n * combined), only the chunk(s) the selector targets are loaded. For a plain\n * loader map, the locale chunk is loaded.\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 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 intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n if (\n process.env['INTLAYER_DICTIONARY_SELECTOR'] !== 'false' &&\n isQualifiedDynamicLoaderMap(dictionaryPromise)\n ) {\n const { locale: selectorLocale, selector } =\n parseDictionarySelector<LocalesValues>(localeOrSelector);\n\n const localeTarget =\n selectorLocale ??\n intlayer?.locale() ??\n internationalization.defaultLocale;\n\n const container = signal<unknown>(undefined);\n\n resolveQualifiedDynamicContentAsync({\n loaderMap: dictionaryPromise,\n key: String(key),\n locale: localeTarget,\n selector,\n transform: (dictionary) => getDictionary(dictionary, localeTarget),\n }).then((resolved) => container.set(resolved));\n\n return computed(() => container() as any);\n }\n\n const locale =\n typeof localeOrSelector === 'string'\n ? (localeOrSelector as LocalesValues)\n : undefined;\n\n const localeTarget = computed(\n () => locale ?? intlayer?.locale() ?? internationalization.defaultLocale\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() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,WAAW,OAAyB,eAAe;AAEzD,KACE,QAAQ,IAAI,oCAAoC,WAChD,4BAA4B,kBAAkB,EAC9C;EACA,MAAM,EAAE,QAAQ,gBAAgB,aAC9B,wBAAuC,iBAAiB;EAE1D,MAAM,eACJ,kBACA,UAAU,QAAQ,IAClB,qBAAqB;EAEvB,MAAM,YAAY,OAAgB,OAAU;AAE5C,sCAAoC;GAClC,WAAW;GACX,KAAK,OAAO,IAAI;GAChB,QAAQ;GACR;GACA,YAAY,eAAe,cAAc,YAAY,aAAa;GACnE,CAAC,CAAC,MAAM,aAAa,UAAU,IAAI,SAAS,CAAC;AAE9C,SAAO,eAAe,WAAW,CAAQ;;CAG3C,MAAM,SACJ,OAAO,qBAAqB,WACvB,mBACD;CAEN,MAAM,eAAe,eACb,UAAU,UAAU,QAAQ,IAAI,qBAAqB,cAC5D;AAOD,QAAO,cALY,eACjB,GAAG,OAAO,IAAI,CAAC,GAAG,cAAc,IAC/B,kBAA0B,cAAc,KAAK,CAGjB,EAAE,cAAc,CAAQ"}
|
|
@@ -32,7 +32,7 @@ const isUpdatableNode = (val) => !!val && typeof val === "object" && typeof val.
|
|
|
32
32
|
*/
|
|
33
33
|
const useIntlayer = (key, localeOrSelector) => {
|
|
34
34
|
const intlayer = inject(INTLAYER_TOKEN);
|
|
35
|
-
const isSelector = typeof localeOrSelector === "object" && localeOrSelector !== null;
|
|
35
|
+
const isSelector = process.env["INTLAYER_DICTIONARY_SELECTOR"] !== "false" && typeof localeOrSelector === "object" && localeOrSelector !== null;
|
|
36
36
|
return computed(() => {
|
|
37
37
|
const currentLocale = intlayer.locale();
|
|
38
38
|
if (isSelector) return getIntlayer(key, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayer.mjs","names":[],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\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 { getIntlayer } from '../getIntlayer';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/** guard utility - true only for objects generated by `renderIntlayerNode()` */\nexport const isUpdatableNode = (\n val: unknown\n): val is { __update: (n: unknown) => void } =>\n !!val &&\n typeof val === 'object' &&\n typeof (val as any).__update === 'function';\n\n/**\n * Angular hook that picks one dictionary by its key and returns its reactive content.\n *\n * It utilizes Angular signals to provide deep reactivity, ensuring your components\n * update automatically when the locale changes.\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 * ```ts\n * import { Component } from '@angular/core';\n * import { useIntlayer } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-my-component',\n * template: `<div>{{ content().myField.value }}</div>`,\n * })\n * export class MyComponent {\n * content = useIntlayer('my-dictionary-key');\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): Signal<\n DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN)!;\n\n const isSelector =\n typeof localeOrSelector === 'object'
|
|
1
|
+
{"version":3,"file":"useIntlayer.mjs","names":[],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\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 { getIntlayer } from '../getIntlayer';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/** guard utility - true only for objects generated by `renderIntlayerNode()` */\nexport const isUpdatableNode = (\n val: unknown\n): val is { __update: (n: unknown) => void } =>\n !!val &&\n typeof val === 'object' &&\n typeof (val as any).__update === 'function';\n\n/**\n * Angular hook that picks one dictionary by its key and returns its reactive content.\n *\n * It utilizes Angular signals to provide deep reactivity, ensuring your components\n * update automatically when the locale changes.\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 * ```ts\n * import { Component } from '@angular/core';\n * import { useIntlayer } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-my-component',\n * template: `<div>{{ content().myField.value }}</div>`,\n * })\n * export class MyComponent {\n * content = useIntlayer('my-dictionary-key');\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): Signal<\n DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN)!;\n\n const isSelector =\n process.env['INTLAYER_DICTIONARY_SELECTOR'] !== 'false' &&\n typeof localeOrSelector === 'object' &&\n localeOrSelector !== null;\n\n /** a *stable* reactive dictionary object */\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const content = computed(() => {\n const currentLocale = intlayer.locale();\n\n if (isSelector) {\n return getIntlayer(key, {\n ...localeOrSelector,\n locale: localeOrSelector.locale ?? currentLocale,\n } as A) as any;\n }\n\n return getIntlayer(key, (localeOrSelector ?? currentLocale) as A) as any;\n });\n\n return content; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;AAeA,MAAa,mBACX,QAEA,CAAC,CAAC,OACF,OAAO,QAAQ,YACf,OAAQ,IAAY,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BnC,MAAa,eAIX,KACA,qBAGG;CACH,MAAM,WAAW,OAAyB,eAAe;CAEzD,MAAM,aACJ,QAAQ,IAAI,oCAAoC,WAChD,OAAO,qBAAqB,YAC5B,qBAAqB;AAiBvB,QAbgB,eAAe;EAC7B,MAAM,gBAAgB,SAAS,QAAQ;AAEvC,MAAI,WACF,QAAO,YAAY,KAAK;GACtB,GAAG;GACH,QAAQ,iBAAiB,UAAU;GACpC,CAAM;AAGT,SAAO,YAAY,KAAM,oBAAoB,cAAoB;GAGrD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Locale } from "../intlayer/dist/types/index.js";
|
|
2
1
|
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
|
/**
|
|
@@ -8,13 +8,13 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
|
8
8
|
/**
|
|
9
9
|
* Get the locale cookie
|
|
10
10
|
*/
|
|
11
|
-
declare const localeInStorage: Locale;
|
|
11
|
+
declare const localeInStorage: _$_intlayer_types0.Locale;
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated Use localeInStorage instead
|
|
14
14
|
*
|
|
15
15
|
* Get the locale cookie
|
|
16
16
|
*/
|
|
17
|
-
declare const localeCookie: Locale;
|
|
17
|
+
declare const localeCookie: _$_intlayer_types0.Locale;
|
|
18
18
|
/**
|
|
19
19
|
* Set the locale cookie
|
|
20
20
|
*/
|
|
@@ -29,7 +29,7 @@ declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: boolean)
|
|
|
29
29
|
* Hook that provides the locale storage and a function to set it
|
|
30
30
|
*/
|
|
31
31
|
declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
32
|
-
getLocale: () => Locale;
|
|
32
|
+
getLocale: () => _$_intlayer_types0.Locale;
|
|
33
33
|
setLocale: (locale: LocalesValues) => void;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
@@ -40,7 +40,7 @@ declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
|
40
40
|
* Hook that provides the locale cookie and a function to set it
|
|
41
41
|
*/
|
|
42
42
|
declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
43
|
-
localeCookie: Locale;
|
|
43
|
+
localeCookie: _$_intlayer_types0.Locale;
|
|
44
44
|
setLocaleCookie: (locale: LocalesValues) => void;
|
|
45
45
|
};
|
|
46
46
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;AAcA;;;AAAA,cAAa,eAAA,EAAkE,MAAA;;
|
|
1
|
+
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;AAcA;;;AAAA,cAAa,eAAA,EAAkE,kBAAA,CAAnD,MAAA;;AAM5B;;;;cAAa,YAAA,EAA8B,kBAAA,CAAlB,MAAA;AAKzB;;;AAAA,cAAa,kBAAA,GACX,MAAA,EAAQ,aAAA,EACR,eAAA;;;;;;cAYW,eAAA,GAAe,MAAA,EAblB,aAAA,EAAa,eAAA;;;;cAkBV,gBAAA,GAAoB,eAAA;mBAI7B,kBAAA,CAAA,MAAA;sBAAA,aAAA;AAAA;;AAJJ;;;;;;cAaa,eAAA,GAAmB,eAAA;gBAO/B,kBAAA,CAAA,MAAA;4BAAA,aAAA;AAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
1
|
import * as _$_angular_core0 from "@angular/core";
|
|
2
|
+
import * as _$_intlayer_types0 from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/format/useCompact.d.ts
|
|
5
5
|
declare const useCompact: () => _$_angular_core0.Signal<(value: string | number, options?: Intl.NumberFormatOptions & {
|
|
6
|
-
locale?: LocalesValues;
|
|
6
|
+
locale?: _$_intlayer_types0.LocalesValues;
|
|
7
7
|
}) => string>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { useCompact };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;;;cAIa,UAAA,yBAAU,MAAA,EAAA,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;;;cAIa,UAAA,yBAAU,MAAA,EAAA,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,kBAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
1
|
import * as _$_angular_core0 from "@angular/core";
|
|
2
|
+
import * as _$_intlayer_types0 from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/format/useCurrency.d.ts
|
|
5
5
|
declare const useCurrency: () => _$_angular_core0.Signal<(value: string | number, options?: Intl.NumberFormatOptions & {
|
|
6
|
-
locale?: LocalesValues;
|
|
6
|
+
locale?: _$_intlayer_types0.LocalesValues;
|
|
7
7
|
}) => string>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { useCurrency };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;;;cAIa,WAAA,yBAAW,MAAA,EAAA,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;;;cAIa,WAAA,yBAAW,MAAA,EAAA,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,kBAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
1
|
import * as _$_angular_core0 from "@angular/core";
|
|
2
|
+
import * as _$_intlayer_types0 from "@intlayer/types";
|
|
3
3
|
import * as _$_intlayer_core_formatters0 from "@intlayer/core/formatters";
|
|
4
4
|
|
|
5
5
|
//#region src/format/useDate.d.ts
|
|
@@ -7,7 +7,7 @@ import * as _$_intlayer_core_formatters0 from "@intlayer/core/formatters";
|
|
|
7
7
|
* Angular client hook that provides a localized date/time formatter.
|
|
8
8
|
*/
|
|
9
9
|
declare const useDate: () => _$_angular_core0.Signal<(date: string | number | Date, options?: (Intl.DateTimeFormatOptions & {
|
|
10
|
-
locale?: LocalesValues;
|
|
10
|
+
locale?: _$_intlayer_types0.LocalesValues;
|
|
11
11
|
}) | _$_intlayer_core_formatters0.DateTimePreset) => string>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { useDate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDate.d.ts","names":[],"sources":["../../../src/format/useDate.ts"],"mappings":";;;;;;;;cAOa,OAAA,yBAAO,MAAA,EAAA,IAAA,oBAAA,IAAA,EAAA,OAAA,IAAA,IAAA,CAAA,qBAAA;WAAA,aAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"useDate.d.ts","names":[],"sources":["../../../src/format/useDate.ts"],"mappings":";;;;;;;;cAOa,OAAA,yBAAO,MAAA,EAAA,IAAA,oBAAA,IAAA,EAAA,OAAA,IAAA,IAAA,CAAA,qBAAA;WAAA,kBAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
1
|
import * as _$_angular_core0 from "@angular/core";
|
|
2
|
+
import * as _$_intlayer_types0 from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/format/useList.d.ts
|
|
5
5
|
declare const useList: () => _$_angular_core0.Signal<(values: (string | number)[], options?: {
|
|
@@ -7,7 +7,7 @@ declare const useList: () => _$_angular_core0.Signal<(values: (string | number)[
|
|
|
7
7
|
type?: "conjunction" | "disjunction" | "unit";
|
|
8
8
|
style?: "long" | "short" | "narrow";
|
|
9
9
|
} & {
|
|
10
|
-
locale?: LocalesValues;
|
|
10
|
+
locale?: _$_intlayer_types0.LocalesValues;
|
|
11
11
|
}) => string>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { useList };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;;;cAIa,OAAA,QAWZ,gBAAA,CAXmB,MAAA,EAAA,MAAA,uBAAA,OAAA;;;;;WAWnB,aAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;;;cAIa,OAAA,QAWZ,gBAAA,CAXmB,MAAA,EAAA,MAAA,uBAAA,OAAA;;;;;WAWnB,kBAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
1
|
import * as _$_angular_core0 from "@angular/core";
|
|
2
|
+
import * as _$_intlayer_types0 from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/format/useNumber.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Angular client hook that provides a localized number formatter.
|
|
7
7
|
*/
|
|
8
8
|
declare const useNumber: () => _$_angular_core0.Signal<(value: string | number, args_1?: Intl.NumberFormatOptions & {
|
|
9
|
-
locale?: LocalesValues;
|
|
9
|
+
locale?: _$_intlayer_types0.LocalesValues;
|
|
10
10
|
}) => string>;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { useNumber };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;;;cAOa,SAAA,yBAAS,MAAA,EAAA,KAAA,mBAAA,MAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;;;cAOa,SAAA,yBAAS,MAAA,EAAA,KAAA,mBAAA,MAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,kBAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
1
|
import * as _$_angular_core0 from "@angular/core";
|
|
2
|
+
import * as _$_intlayer_types0 from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/format/usePercentage.d.ts
|
|
5
5
|
declare const usePercentage: () => _$_angular_core0.Signal<(value: string | number, args_1?: Intl.NumberFormatOptions & {
|
|
6
|
-
locale?: LocalesValues;
|
|
6
|
+
locale?: _$_intlayer_types0.LocalesValues;
|
|
7
7
|
}) => string>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { usePercentage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;;;cAIa,aAAA,yBAAa,MAAA,EAAA,KAAA,mBAAA,MAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;;;cAIa,aAAA,yBAAa,MAAA,EAAA,KAAA,mBAAA,MAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,kBAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
1
|
import * as _$_angular_core0 from "@angular/core";
|
|
2
|
+
import * as _$_intlayer_types0 from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/format/useRelativeTime.d.ts
|
|
5
5
|
declare const useRelativeTime: () => _$_angular_core0.Signal<(from: string | number | Date, to?: string | number | Date, options?: Intl.RelativeTimeFormatOptions & {
|
|
6
|
-
locale?: LocalesValues;
|
|
6
|
+
locale?: _$_intlayer_types0.LocalesValues;
|
|
7
7
|
unit?: Intl.RelativeTimeFormatUnit;
|
|
8
8
|
}) => string>;
|
|
9
9
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;;;cAIa,eAAA,yBAAe,MAAA,EAAA,IAAA,oBAAA,IAAA,EAAA,EAAA,qBAAA,IAAA,EAAA,OAAA,GAAA,IAAA,CAAA,yBAAA;WAAA,aAAA"}
|
|
1
|
+
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;;;cAIa,eAAA,yBAAe,MAAA,EAAA,IAAA,oBAAA,IAAA,EAAA,EAAA,qBAAA,IAAA,EAAA,OAAA,GAAA,IAAA,CAAA,yBAAA;WAAA,kBAAA,CAAA,aAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
1
|
import * as _$_angular_core0 from "@angular/core";
|
|
2
|
+
import * as _$_intlayer_types0 from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/format/useUnit.d.ts
|
|
5
5
|
declare const useUnit: () => _$_angular_core0.Signal<(value: string | number, options?: Intl.NumberFormatOptions & {
|
|
6
|
-
locale?: LocalesValues;
|
|
6
|
+
locale?: _$_intlayer_types0.LocalesValues;
|
|
7
7
|
}) => string>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { useUnit };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;;;cAIa,OAAA,yBAAO,MAAA,EAAA,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;;;cAIa,OAAA,yBAAO,MAAA,EAAA,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,kBAAA,CAAA,aAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angular-intlayer",
|
|
3
|
-
"version": "9.0.0-canary.
|
|
3
|
+
"version": "9.0.0-canary.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Angular applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -118,13 +118,13 @@
|
|
|
118
118
|
"dependencies": {
|
|
119
119
|
"@babel/plugin-syntax-import-attributes": "7.28.6",
|
|
120
120
|
"@babel/preset-env": "7.29.2",
|
|
121
|
-
"@intlayer/chokidar": "9.0.0-canary.
|
|
122
|
-
"@intlayer/config": "9.0.0-canary.
|
|
123
|
-
"@intlayer/core": "9.0.0-canary.
|
|
124
|
-
"@intlayer/dictionaries-entry": "9.0.0-canary.
|
|
125
|
-
"@intlayer/editor": "9.0.0-canary.
|
|
126
|
-
"@intlayer/types": "9.0.0-canary.
|
|
127
|
-
"@intlayer/webpack": "9.0.0-canary.
|
|
121
|
+
"@intlayer/chokidar": "9.0.0-canary.2",
|
|
122
|
+
"@intlayer/config": "9.0.0-canary.2",
|
|
123
|
+
"@intlayer/core": "9.0.0-canary.2",
|
|
124
|
+
"@intlayer/dictionaries-entry": "9.0.0-canary.2",
|
|
125
|
+
"@intlayer/editor": "9.0.0-canary.2",
|
|
126
|
+
"@intlayer/types": "9.0.0-canary.2",
|
|
127
|
+
"@intlayer/webpack": "9.0.0-canary.2",
|
|
128
128
|
"babel-loader": "10.1.1",
|
|
129
129
|
"defu": "6.1.7"
|
|
130
130
|
},
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"rimraf": "6.1.3",
|
|
139
139
|
"tsdown": "0.21.10",
|
|
140
140
|
"typescript": "6.0.3",
|
|
141
|
-
"vitest": "4.1.
|
|
141
|
+
"vitest": "4.1.9"
|
|
142
142
|
},
|
|
143
143
|
"peerDependencies": {
|
|
144
144
|
"@angular/common": ">=15",
|