angular-intlayer 5.5.4 → 5.5.6

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 (91) hide show
  1. package/dist/cjs/client/dictionary.service.cjs +70 -0
  2. package/dist/cjs/client/dictionary.service.cjs.map +1 -0
  3. package/dist/cjs/client/getBrowserLocale.cjs +34 -0
  4. package/dist/cjs/client/getBrowserLocale.cjs.map +1 -0
  5. package/dist/cjs/client/getDictionary.cjs +43 -0
  6. package/dist/cjs/client/getDictionary.cjs.map +1 -0
  7. package/dist/cjs/client/getLocale.cjs +31 -0
  8. package/dist/cjs/client/getLocale.cjs.map +1 -0
  9. package/dist/cjs/client/index.cjs +47 -0
  10. package/dist/cjs/client/index.cjs.map +1 -0
  11. package/dist/cjs/client/intlayer.service.cjs +43 -0
  12. package/dist/cjs/client/intlayer.service.cjs.map +1 -0
  13. package/dist/cjs/client/locale.service.cjs +66 -0
  14. package/dist/cjs/client/locale.service.cjs.map +1 -0
  15. package/dist/cjs/client/t.cjs +32 -0
  16. package/dist/cjs/client/t.cjs.map +1 -0
  17. package/dist/cjs/getDictionary.cjs +29 -0
  18. package/dist/cjs/getDictionary.cjs.map +1 -0
  19. package/dist/cjs/getIntlayer.cjs +31 -0
  20. package/dist/cjs/getIntlayer.cjs.map +1 -0
  21. package/dist/cjs/index.cjs +10 -4
  22. package/dist/cjs/index.cjs.map +1 -1
  23. package/dist/cjs/markdown/index.cjs +36 -0
  24. package/dist/cjs/markdown/index.cjs.map +1 -0
  25. package/dist/cjs/plugins.cjs +106 -0
  26. package/dist/cjs/plugins.cjs.map +1 -0
  27. package/dist/esm/client/dictionary.service.mjs +46 -0
  28. package/dist/esm/client/dictionary.service.mjs.map +1 -0
  29. package/dist/esm/client/getBrowserLocale.mjs +10 -0
  30. package/dist/esm/client/getBrowserLocale.mjs.map +1 -0
  31. package/dist/esm/client/getDictionary.mjs +25 -0
  32. package/dist/esm/client/getDictionary.mjs.map +1 -0
  33. package/dist/esm/client/getLocale.mjs +7 -0
  34. package/dist/esm/client/getLocale.mjs.map +1 -0
  35. package/dist/esm/client/index.mjs +17 -0
  36. package/dist/esm/client/index.mjs.map +1 -0
  37. package/dist/esm/client/intlayer.service.mjs +19 -0
  38. package/dist/esm/client/intlayer.service.mjs.map +1 -0
  39. package/dist/esm/client/locale.service.mjs +42 -0
  40. package/dist/esm/client/locale.service.mjs.map +1 -0
  41. package/dist/esm/client/t.mjs +8 -0
  42. package/dist/esm/client/t.mjs.map +1 -0
  43. package/dist/esm/getDictionary.mjs +5 -0
  44. package/dist/esm/getDictionary.mjs.map +1 -0
  45. package/dist/esm/getIntlayer.mjs +7 -0
  46. package/dist/esm/getIntlayer.mjs.map +1 -0
  47. package/dist/esm/index.mjs +5 -2
  48. package/dist/esm/index.mjs.map +1 -1
  49. package/dist/esm/markdown/index.mjs +11 -0
  50. package/dist/esm/markdown/index.mjs.map +1 -0
  51. package/dist/esm/plugins.mjs +82 -0
  52. package/dist/esm/plugins.mjs.map +1 -0
  53. package/dist/types/client/dictionary.service.d.ts +21 -0
  54. package/dist/types/client/dictionary.service.d.ts.map +1 -0
  55. package/dist/types/client/getBrowserLocale.d.ts +6 -0
  56. package/dist/types/client/getBrowserLocale.d.ts.map +1 -0
  57. package/dist/types/client/getDictionary.d.ts +8 -0
  58. package/dist/types/client/getDictionary.d.ts.map +1 -0
  59. package/dist/types/client/getLocale.d.ts +7 -0
  60. package/dist/types/client/getLocale.d.ts.map +1 -0
  61. package/dist/types/client/index.d.ts +8 -0
  62. package/dist/types/client/index.d.ts.map +1 -0
  63. package/dist/types/client/intlayer.service.d.ts +8 -0
  64. package/dist/types/client/intlayer.service.d.ts.map +1 -0
  65. package/dist/types/client/locale.service.d.ts +12 -0
  66. package/dist/types/client/locale.service.d.ts.map +1 -0
  67. package/dist/types/client/t.d.ts +8 -0
  68. package/dist/types/client/t.d.ts.map +1 -0
  69. package/dist/types/getDictionary.d.ts +2 -0
  70. package/dist/types/getDictionary.d.ts.map +1 -0
  71. package/dist/types/getIntlayer.d.ts +7 -0
  72. package/dist/types/getIntlayer.d.ts.map +1 -0
  73. package/dist/types/index.d.ts +10 -2
  74. package/dist/types/index.d.ts.map +1 -1
  75. package/dist/types/markdown/index.d.ts +5 -0
  76. package/dist/types/markdown/index.d.ts.map +1 -0
  77. package/dist/types/plugins.d.ts +55 -0
  78. package/dist/types/plugins.d.ts.map +1 -0
  79. package/package.json +10 -8
  80. package/dist/cjs/intlayerMiddlewarePlugin.cjs +0 -224
  81. package/dist/cjs/intlayerMiddlewarePlugin.cjs.map +0 -1
  82. package/dist/cjs/intlayerPlugin.cjs +0 -76
  83. package/dist/cjs/intlayerPlugin.cjs.map +0 -1
  84. package/dist/esm/intlayerMiddlewarePlugin.mjs +0 -200
  85. package/dist/esm/intlayerMiddlewarePlugin.mjs.map +0 -1
  86. package/dist/esm/intlayerPlugin.mjs +0 -52
  87. package/dist/esm/intlayerPlugin.mjs.map +0 -1
  88. package/dist/types/intlayerMiddlewarePlugin.d.ts +0 -6
  89. package/dist/types/intlayerMiddlewarePlugin.d.ts.map +0 -1
  90. package/dist/types/intlayerPlugin.d.ts +0 -16
  91. package/dist/types/intlayerPlugin.d.ts.map +0 -1
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var dictionary_service_exports = {};
20
+ __export(dictionary_service_exports, {
21
+ DictionaryService: () => DictionaryService
22
+ });
23
+ module.exports = __toCommonJS(dictionary_service_exports);
24
+ var import_core = require("@angular/core");
25
+ var import_rxjs = require("rxjs");
26
+ @((0, import_core.Injectable)({
27
+ providedIn: "root"
28
+ }))
29
+ class DictionaryService {
30
+ constructor(localeService) {
31
+ this.localeService = localeService;
32
+ }
33
+ dictionaryCache = /* @__PURE__ */ new Map();
34
+ getDictionary(dictionary, locale) {
35
+ const targetLocale = locale || this.localeService.currentLocale;
36
+ const cacheKey = `${dictionary.id}-${targetLocale}`;
37
+ if (this.dictionaryCache.has(cacheKey)) {
38
+ return this.dictionaryCache.get(cacheKey);
39
+ }
40
+ const result = dictionary.content || dictionary;
41
+ this.dictionaryCache.set(cacheKey, result);
42
+ return result;
43
+ }
44
+ getDictionary$(dictionary) {
45
+ return this.localeService.locale$.pipe(
46
+ (0, import_rxjs.map)((locale) => this.getDictionary(dictionary, locale))
47
+ );
48
+ }
49
+ getDictionaries$(dictionaries) {
50
+ return this.localeService.locale$.pipe(
51
+ (0, import_rxjs.map)(
52
+ (locale) => dictionaries.map((dict) => this.getDictionary(dict, locale))
53
+ )
54
+ );
55
+ }
56
+ clearCache() {
57
+ this.dictionaryCache.clear();
58
+ }
59
+ clearCacheForDictionary(dictionaryId) {
60
+ const keysToDelete = Array.from(this.dictionaryCache.keys()).filter(
61
+ (key) => key.startsWith(`${dictionaryId}-`)
62
+ );
63
+ keysToDelete.forEach((key) => this.dictionaryCache.delete(key));
64
+ }
65
+ }
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ DictionaryService
69
+ });
70
+ //# sourceMappingURL=dictionary.service.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/dictionary.service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport type { Locales } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { Observable, map } from 'rxjs';\nimport { LocaleService } from './locale.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DictionaryService {\n private dictionaryCache = new Map<string, any>();\n\n constructor(private localeService: LocaleService) {}\n\n getDictionary<T extends Dictionary & { id: string }>(\n dictionary: T,\n locale?: Locales\n ): any {\n const targetLocale = locale || this.localeService.currentLocale;\n const cacheKey = `${dictionary.id}-${targetLocale}`;\n\n if (this.dictionaryCache.has(cacheKey)) {\n return this.dictionaryCache.get(cacheKey);\n }\n\n // Use a simpler approach to avoid type complexity\n const result = dictionary.content || dictionary;\n this.dictionaryCache.set(cacheKey, result);\n\n return result;\n }\n\n getDictionary$<T extends Dictionary & { id: string }>(\n dictionary: T\n ): Observable<any> {\n return this.localeService.locale$.pipe(\n map((locale) => this.getDictionary(dictionary, locale))\n );\n }\n\n getDictionaries$(\n dictionaries: (Dictionary & { id: string })[]\n ): Observable<any[]> {\n return this.localeService.locale$.pipe(\n map((locale) =>\n dictionaries.map((dict) => this.getDictionary(dict, locale))\n )\n );\n }\n\n clearCache(): void {\n this.dictionaryCache.clear();\n }\n\n clearCacheForDictionary(dictionaryId: string): void {\n const keysToDelete = Array.from(this.dictionaryCache.keys()).filter((key) =>\n key.startsWith(`${dictionaryId}-`)\n );\n\n keysToDelete.forEach((key) => this.dictionaryCache.delete(key));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2B;AAG3B,kBAAgC;AAGhC,MAAC,wBAAW;AAAA,EACV,YAAY;AACd,CAAC;AACM,MAAM,kBAAkB;AAAA,EAG7B,YAAoB,eAA8B;AAA9B;AAAA,EAA+B;AAAA,EAF3C,kBAAkB,oBAAI,IAAiB;AAAA,EAI/C,cACE,YACA,QACK;AACL,UAAM,eAAe,UAAU,KAAK,cAAc;AAClD,UAAM,WAAW,GAAG,WAAW,EAAE,IAAI,YAAY;AAEjD,QAAI,KAAK,gBAAgB,IAAI,QAAQ,GAAG;AACtC,aAAO,KAAK,gBAAgB,IAAI,QAAQ;AAAA,IAC1C;AAGA,UAAM,SAAS,WAAW,WAAW;AACrC,SAAK,gBAAgB,IAAI,UAAU,MAAM;AAEzC,WAAO;AAAA,EACT;AAAA,EAEA,eACE,YACiB;AACjB,WAAO,KAAK,cAAc,QAAQ;AAAA,UAChC,iBAAI,CAAC,WAAW,KAAK,cAAc,YAAY,MAAM,CAAC;AAAA,IACxD;AAAA,EACF;AAAA,EAEA,iBACE,cACmB;AACnB,WAAO,KAAK,cAAc,QAAQ;AAAA,UAChC;AAAA,QAAI,CAAC,WACH,aAAa,IAAI,CAAC,SAAS,KAAK,cAAc,MAAM,MAAM,CAAC;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AAAA,EAEA,aAAmB;AACjB,SAAK,gBAAgB,MAAM;AAAA,EAC7B;AAAA,EAEA,wBAAwB,cAA4B;AAClD,UAAM,eAAe,MAAM,KAAK,KAAK,gBAAgB,KAAK,CAAC,EAAE;AAAA,MAAO,CAAC,QACnE,IAAI,WAAW,GAAG,YAAY,GAAG;AAAA,IACnC;AAEA,iBAAa,QAAQ,CAAC,QAAQ,KAAK,gBAAgB,OAAO,GAAG,CAAC;AAAA,EAChE;AACF;","names":[]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getBrowserLocale_exports = {};
20
+ __export(getBrowserLocale_exports, {
21
+ getBrowserLocale: () => getBrowserLocale
22
+ });
23
+ module.exports = __toCommonJS(getBrowserLocale_exports);
24
+ const getBrowserLocale = () => {
25
+ if (typeof window !== "undefined" && window.navigator) {
26
+ return window.navigator.language.split("-")[0];
27
+ }
28
+ return void 0;
29
+ };
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ getBrowserLocale
33
+ });
34
+ //# sourceMappingURL=getBrowserLocale.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/getBrowserLocale.ts"],"sourcesContent":["import { Locales } from '@intlayer/config';\n\n/**\n * Get the locale from the browser\n */\nexport const getBrowserLocale = (): Locales | undefined => {\n if (typeof window !== 'undefined' && window.navigator) {\n return window.navigator.language.split('-')[0] as Locales;\n }\n return undefined;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,MAAM,mBAAmB,MAA2B;AACzD,MAAI,OAAO,WAAW,eAAe,OAAO,WAAW;AACrD,WAAO,OAAO,UAAU,SAAS,MAAM,GAAG,EAAE,CAAC;AAAA,EAC/C;AACA,SAAO;AACT;","names":[]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getDictionary_exports = {};
20
+ __export(getDictionary_exports, {
21
+ getDictionary: () => getDictionary
22
+ });
23
+ module.exports = __toCommonJS(getDictionary_exports);
24
+ var import_core = require("@intlayer/core");
25
+ var import_plugins = require('../plugins.cjs');
26
+ const getDictionary = (dictionary, locale, additionalPlugins) => {
27
+ const plugins = [
28
+ import_plugins.intlayerNodePlugins,
29
+ import_plugins.angularTemplatePlugin,
30
+ import_plugins.markdownPlugin,
31
+ ...additionalPlugins ?? []
32
+ ];
33
+ return (0, import_core.getDictionary)(
34
+ dictionary,
35
+ locale,
36
+ plugins
37
+ );
38
+ };
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ getDictionary
42
+ });
43
+ //# sourceMappingURL=getDictionary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/getDictionary.ts"],"sourcesContent":["import type { Locales, LocalesValues } from '@intlayer/config';\nimport {\n type Dictionary,\n type Plugins,\n getDictionary as getDictionaryCore,\n} from '@intlayer/core';\nimport {\n type DeepTransformContent,\n angularTemplatePlugin,\n intlayerNodePlugins,\n markdownPlugin,\n} from '../plugins';\n\n/**\n * Get dictionary content for a specific locale\n */\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = Locales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n angularTemplatePlugin,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore(\n dictionary,\n locale,\n plugins\n ) as any as DeepTransformContent<T['content']>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAIO;AACP,qBAKO;AAKA,MAAM,gBAAgB,CAI3B,YACA,QACA,sBACG;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,qBAAqB,CAAC;AAAA,EAC5B;AAEA,aAAO,YAAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["getDictionaryCore"]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getLocale_exports = {};
20
+ __export(getLocale_exports, {
21
+ getLocale: () => getLocale
22
+ });
23
+ module.exports = __toCommonJS(getLocale_exports);
24
+ const getLocale = () => {
25
+ return "en";
26
+ };
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ getLocale
30
+ });
31
+ //# sourceMappingURL=getLocale.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/getLocale.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config';\n\n/**\n * Get the current locale\n * This is a basic implementation that can be extended with Angular services\n */\nexport const getLocale = (): Locales => {\n // This is a placeholder implementation\n // In a real Angular app, this would likely use a service or injection\n return 'en' as Locales;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,MAAM,YAAY,MAAe;AAGtC,SAAO;AACT;","names":[]}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var client_exports = {};
20
+ __export(client_exports, {
21
+ DictionaryService: () => import_dictionary.DictionaryService,
22
+ IntlayerService: () => import_intlayer.IntlayerService,
23
+ LocaleService: () => import_locale.LocaleService,
24
+ getBrowserLocale: () => import_getBrowserLocale.getBrowserLocale,
25
+ getDictionary: () => import_getDictionary.getDictionary,
26
+ getLocale: () => import_getLocale.getLocale,
27
+ t: () => import_t.t
28
+ });
29
+ module.exports = __toCommonJS(client_exports);
30
+ var import_dictionary = require('./dictionary.service.cjs');
31
+ var import_getBrowserLocale = require('./getBrowserLocale.cjs');
32
+ var import_getDictionary = require('./getDictionary.cjs');
33
+ var import_getLocale = require('./getLocale.cjs');
34
+ var import_intlayer = require('./intlayer.service.cjs');
35
+ var import_locale = require('./locale.service.cjs');
36
+ var import_t = require('./t.cjs');
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ DictionaryService,
40
+ IntlayerService,
41
+ LocaleService,
42
+ getBrowserLocale,
43
+ getDictionary,
44
+ getLocale,
45
+ t
46
+ });
47
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export { DictionaryService } from './dictionary.service';\nexport { getBrowserLocale } from './getBrowserLocale';\nexport { getDictionary } from './getDictionary';\nexport { getLocale } from './getLocale';\nexport { IntlayerService } from './intlayer.service';\nexport { LocaleService } from './locale.service';\nexport { t } from './t';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAkC;AAClC,8BAAiC;AACjC,2BAA8B;AAC9B,uBAA0B;AAC1B,sBAAgC;AAChC,oBAA8B;AAC9B,eAAkB;","names":[]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var intlayer_service_exports = {};
20
+ __export(intlayer_service_exports, {
21
+ IntlayerService: () => IntlayerService
22
+ });
23
+ module.exports = __toCommonJS(intlayer_service_exports);
24
+ var import_core = require("@angular/core");
25
+ var import_rxjs = require("rxjs");
26
+ @((0, import_core.Injectable)({
27
+ providedIn: "root"
28
+ }))
29
+ class IntlayerService {
30
+ localeSubject = new import_rxjs.BehaviorSubject("en");
31
+ locale$ = this.localeSubject.asObservable();
32
+ get currentLocale() {
33
+ return this.localeSubject.value;
34
+ }
35
+ setLocale(locale) {
36
+ this.localeSubject.next(locale);
37
+ }
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ IntlayerService
42
+ });
43
+ //# sourceMappingURL=intlayer.service.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/intlayer.service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport type { Locales } from '@intlayer/config';\nimport { BehaviorSubject } from 'rxjs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class IntlayerService {\n private localeSubject = new BehaviorSubject<Locales>('en' as Locales);\n public locale$ = this.localeSubject.asObservable();\n\n get currentLocale(): Locales {\n return this.localeSubject.value;\n }\n\n setLocale(locale: Locales): void {\n this.localeSubject.next(locale);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2B;AAE3B,kBAAgC;AAEhC,MAAC,wBAAW;AAAA,EACV,YAAY;AACd,CAAC;AACM,MAAM,gBAAgB;AAAA,EACnB,gBAAgB,IAAI,4BAAyB,IAAe;AAAA,EAC7D,UAAU,KAAK,cAAc,aAAa;AAAA,EAEjD,IAAI,gBAAyB;AAC3B,WAAO,KAAK,cAAc;AAAA,EAC5B;AAAA,EAEA,UAAU,QAAuB;AAC/B,SAAK,cAAc,KAAK,MAAM;AAAA,EAChC;AACF;","names":[]}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var locale_service_exports = {};
20
+ __export(locale_service_exports, {
21
+ LocaleService: () => LocaleService
22
+ });
23
+ module.exports = __toCommonJS(locale_service_exports);
24
+ var import_core = require("@angular/core");
25
+ var import_rxjs = require("rxjs");
26
+ var import_getBrowserLocale = require('./getBrowserLocale.cjs');
27
+ @((0, import_core.Injectable)({
28
+ providedIn: "root"
29
+ }))
30
+ class LocaleService {
31
+ localeSubject = new import_rxjs.BehaviorSubject(
32
+ (0, import_getBrowserLocale.getBrowserLocale)() || "en"
33
+ );
34
+ locale$ = this.localeSubject.asObservable();
35
+ constructor() {
36
+ const browserLocale = (0, import_getBrowserLocale.getBrowserLocale)();
37
+ if (browserLocale) {
38
+ this.setLocale(browserLocale);
39
+ }
40
+ }
41
+ get currentLocale() {
42
+ return this.localeSubject.value;
43
+ }
44
+ setLocale(locale) {
45
+ this.localeSubject.next(locale);
46
+ if (typeof localStorage !== "undefined") {
47
+ localStorage.setItem("intlayer-locale", locale);
48
+ }
49
+ }
50
+ getStoredLocale() {
51
+ if (typeof localStorage !== "undefined") {
52
+ return localStorage.getItem("intlayer-locale");
53
+ }
54
+ return null;
55
+ }
56
+ clearStoredLocale() {
57
+ if (typeof localStorage !== "undefined") {
58
+ localStorage.removeItem("intlayer-locale");
59
+ }
60
+ }
61
+ }
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ LocaleService
65
+ });
66
+ //# sourceMappingURL=locale.service.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/locale.service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport type { Locales } from '@intlayer/config';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport { getBrowserLocale } from './getBrowserLocale';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LocaleService {\n private localeSubject = new BehaviorSubject<Locales>(\n getBrowserLocale() || ('en' as Locales)\n );\n\n public locale$: Observable<Locales> = this.localeSubject.asObservable();\n\n constructor() {\n // Initialize with browser locale if available\n const browserLocale = getBrowserLocale();\n if (browserLocale) {\n this.setLocale(browserLocale);\n }\n }\n\n get currentLocale(): Locales {\n return this.localeSubject.value;\n }\n\n setLocale(locale: Locales): void {\n this.localeSubject.next(locale);\n\n // Optionally store in localStorage for persistence\n if (typeof localStorage !== 'undefined') {\n localStorage.setItem('intlayer-locale', locale);\n }\n }\n\n getStoredLocale(): Locales | null {\n if (typeof localStorage !== 'undefined') {\n return localStorage.getItem('intlayer-locale') as Locales;\n }\n return null;\n }\n\n clearStoredLocale(): void {\n if (typeof localStorage !== 'undefined') {\n localStorage.removeItem('intlayer-locale');\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2B;AAE3B,kBAA4C;AAC5C,8BAAiC;AAEjC,MAAC,wBAAW;AAAA,EACV,YAAY;AACd,CAAC;AACM,MAAM,cAAc;AAAA,EACjB,gBAAgB,IAAI;AAAA,QAC1B,0CAAiB,KAAM;AAAA,EACzB;AAAA,EAEO,UAA+B,KAAK,cAAc,aAAa;AAAA,EAEtE,cAAc;AAEZ,UAAM,oBAAgB,0CAAiB;AACvC,QAAI,eAAe;AACjB,WAAK,UAAU,aAAa;AAAA,IAC9B;AAAA,EACF;AAAA,EAEA,IAAI,gBAAyB;AAC3B,WAAO,KAAK,cAAc;AAAA,EAC5B;AAAA,EAEA,UAAU,QAAuB;AAC/B,SAAK,cAAc,KAAK,MAAM;AAG9B,QAAI,OAAO,iBAAiB,aAAa;AACvC,mBAAa,QAAQ,mBAAmB,MAAM;AAAA,IAChD;AAAA,EACF;AAAA,EAEA,kBAAkC;AAChC,QAAI,OAAO,iBAAiB,aAAa;AACvC,aAAO,aAAa,QAAQ,iBAAiB;AAAA,IAC/C;AACA,WAAO;AAAA,EACT;AAAA,EAEA,oBAA0B;AACxB,QAAI,OAAO,iBAAiB,aAAa;AACvC,mBAAa,WAAW,iBAAiB;AAAA,IAC3C;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var t_exports = {};
20
+ __export(t_exports, {
21
+ t: () => t
22
+ });
23
+ module.exports = __toCommonJS(t_exports);
24
+ var import_core = require("@intlayer/core");
25
+ const t = (multilangContent, locale) => {
26
+ return (0, import_core.getTranslation)(multilangContent, locale);
27
+ };
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ t
31
+ });
32
+ //# sourceMappingURL=t.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/t.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config';\nimport { type LanguageContent, getTranslation } from '@intlayer/core';\n\n/**\n * Translation function for Angular applications\n * Returns the translation of the provided multilang content\n */\nexport const t = <Content = string>(\n multilangContent: LanguageContent<Content>,\n locale: Locales\n) => {\n return getTranslation<Content>(multilangContent, locale);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAqD;AAM9C,MAAM,IAAI,CACf,kBACA,WACG;AACH,aAAO,4BAAwB,kBAAkB,MAAM;AACzD;","names":[]}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getDictionary_exports = {};
20
+ __export(getDictionary_exports, {
21
+ getDictionary: () => import_getDictionary.getDictionary
22
+ });
23
+ module.exports = __toCommonJS(getDictionary_exports);
24
+ var import_getDictionary = require('./client/getDictionary.cjs');
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ getDictionary
28
+ });
29
+ //# sourceMappingURL=getDictionary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getDictionary.ts"],"sourcesContent":["export { getDictionary } from './client/getDictionary';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA8B;","names":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getIntlayer_exports = {};
20
+ __export(getIntlayer_exports, {
21
+ getIntlayer: () => getIntlayer
22
+ });
23
+ module.exports = __toCommonJS(getIntlayer_exports);
24
+ const getIntlayer = (dictionary, locale, additionalPlugins) => {
25
+ return dictionary.content || dictionary;
26
+ };
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ getIntlayer
30
+ });
31
+ //# sourceMappingURL=getIntlayer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import type { Locales, LocalesValues } from '@intlayer/config';\nimport type { Dictionary, Plugins } from '@intlayer/core';\n\n/**\n * Function to get the content of a dictionary for Angular applications\n */\nexport const getIntlayer = <\n T extends Dictionary,\n L extends LocalesValues = Locales,\n>(\n dictionary: T,\n locale: L,\n additionalPlugins?: Plugins[]\n): any => {\n // Simplified implementation to avoid type complexity\n return dictionary.content || dictionary;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,MAAM,cAAc,CAIzB,YACA,QACA,sBACQ;AAER,SAAO,WAAW,WAAW;AAC/B;","names":[]}
@@ -15,11 +15,17 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
16
  var index_exports = {};
17
17
  module.exports = __toCommonJS(index_exports);
18
- __reExport(index_exports, require('./intlayerPlugin.cjs'), module.exports);
19
- __reExport(index_exports, require('./intlayerMiddlewarePlugin.cjs'), module.exports);
18
+ __reExport(index_exports, require('./client/index.cjs'), module.exports);
19
+ __reExport(index_exports, require('./getDictionary.cjs'), module.exports);
20
+ __reExport(index_exports, require('./getIntlayer.cjs'), module.exports);
21
+ __reExport(index_exports, require('./markdown/index.cjs'), module.exports);
22
+ __reExport(index_exports, require('./plugins.cjs'), module.exports);
20
23
  // Annotate the CommonJS export names for ESM import in node:
21
24
  0 && (module.exports = {
22
- ...require('./intlayerPlugin.cjs'),
23
- ...require('./intlayerMiddlewarePlugin.cjs')
25
+ ...require('./client/index.cjs'),
26
+ ...require('./getDictionary.cjs'),
27
+ ...require('./getIntlayer.cjs'),
28
+ ...require('./markdown/index.cjs'),
29
+ ...require('./plugins.cjs')
24
30
  });
25
31
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './intlayerPlugin';\nexport * from './intlayerMiddlewarePlugin';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,6BAAd;AACA,0BAAc,uCADd;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { IInterpreterPluginAngular } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginAngular<T> {}\n}\n\nexport * from './client';\nexport * from './getDictionary';\nexport * from './getIntlayer';\nexport * from './markdown';\nexport * from './plugins';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAMA,0BAAc,qBANd;AAOA,0BAAc,4BAPd;AAQA,0BAAc,0BARd;AASA,0BAAc,uBATd;AAUA,0BAAc,sBAVd;","names":[]}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var markdown_exports = {};
20
+ __export(markdown_exports, {
21
+ MarkdownModule: () => MarkdownModule,
22
+ renderMarkdown: () => renderMarkdown
23
+ });
24
+ module.exports = __toCommonJS(markdown_exports);
25
+ const renderMarkdown = (content) => {
26
+ return content;
27
+ };
28
+ const MarkdownModule = {
29
+ renderMarkdown
30
+ };
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ MarkdownModule,
34
+ renderMarkdown
35
+ });
36
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/markdown/index.ts"],"sourcesContent":["// Basic markdown support for Angular\n// This could be extended with Angular-specific markdown components\n\nexport const renderMarkdown = (content: string): string => {\n // Basic implementation - in a real app this might use a markdown library\n return content;\n};\n\nexport const MarkdownModule = {\n renderMarkdown,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,iBAAiB,CAAC,YAA4B;AAEzD,SAAO;AACT;AAEO,MAAM,iBAAiB;AAAA,EAC5B;AACF;","names":[]}