svelte-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 (97) hide show
  1. package/dist/cjs/client/getBrowserLocale.cjs +39 -0
  2. package/dist/cjs/client/getBrowserLocale.cjs.map +1 -0
  3. package/dist/cjs/client/index.cjs +52 -0
  4. package/dist/cjs/client/index.cjs.map +1 -0
  5. package/dist/cjs/client/intlayerContext.cjs +38 -0
  6. package/dist/cjs/client/intlayerContext.cjs.map +1 -0
  7. package/dist/cjs/client/intlayerStore.cjs +42 -0
  8. package/dist/cjs/client/intlayerStore.cjs.map +1 -0
  9. package/dist/cjs/client/useDictionary.cjs +39 -0
  10. package/dist/cjs/client/useDictionary.cjs.map +1 -0
  11. package/dist/cjs/client/useDictionaryDynamic.cjs +57 -0
  12. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -0
  13. package/dist/cjs/client/useIntlayer.cjs +39 -0
  14. package/dist/cjs/client/useIntlayer.cjs.map +1 -0
  15. package/dist/cjs/client/useIntlayerAsync.cjs +63 -0
  16. package/dist/cjs/client/useIntlayerAsync.cjs.map +1 -0
  17. package/dist/cjs/client/useLocale.cjs +47 -0
  18. package/dist/cjs/client/useLocale.cjs.map +1 -0
  19. package/dist/cjs/getDictionary.cjs +43 -0
  20. package/dist/cjs/getDictionary.cjs.map +1 -0
  21. package/dist/cjs/getIntlayer.cjs +39 -0
  22. package/dist/cjs/getIntlayer.cjs.map +1 -0
  23. package/dist/cjs/index.cjs +10 -4
  24. package/dist/cjs/index.cjs.map +1 -1
  25. package/dist/cjs/markdown/index.cjs +39 -0
  26. package/dist/cjs/markdown/index.cjs.map +1 -0
  27. package/dist/cjs/plugins.cjs +53 -0
  28. package/dist/cjs/plugins.cjs.map +1 -0
  29. package/dist/esm/client/getBrowserLocale.mjs +15 -0
  30. package/dist/esm/client/getBrowserLocale.mjs.map +1 -0
  31. package/dist/esm/client/index.mjs +20 -0
  32. package/dist/esm/client/index.mjs.map +1 -0
  33. package/dist/esm/client/intlayerContext.mjs +13 -0
  34. package/dist/esm/client/intlayerContext.mjs.map +1 -0
  35. package/dist/esm/client/intlayerStore.mjs +18 -0
  36. package/dist/esm/client/intlayerStore.mjs.map +1 -0
  37. package/dist/esm/client/useDictionary.mjs +15 -0
  38. package/dist/esm/client/useDictionary.mjs.map +1 -0
  39. package/dist/esm/client/useDictionaryDynamic.mjs +33 -0
  40. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -0
  41. package/dist/esm/client/useIntlayer.mjs +15 -0
  42. package/dist/esm/client/useIntlayer.mjs.map +1 -0
  43. package/dist/esm/client/useIntlayerAsync.mjs +29 -0
  44. package/dist/esm/client/useIntlayerAsync.mjs.map +1 -0
  45. package/dist/esm/client/useLocale.mjs +23 -0
  46. package/dist/esm/client/useLocale.mjs.map +1 -0
  47. package/dist/esm/getDictionary.mjs +25 -0
  48. package/dist/esm/getDictionary.mjs.map +1 -0
  49. package/dist/esm/getIntlayer.mjs +21 -0
  50. package/dist/esm/getIntlayer.mjs.map +1 -0
  51. package/dist/esm/index.mjs +5 -2
  52. package/dist/esm/index.mjs.map +1 -1
  53. package/dist/esm/markdown/index.mjs +14 -0
  54. package/dist/esm/markdown/index.mjs.map +1 -0
  55. package/dist/esm/plugins.mjs +27 -0
  56. package/dist/esm/plugins.mjs.map +1 -0
  57. package/dist/types/client/getBrowserLocale.d.ts +7 -0
  58. package/dist/types/client/getBrowserLocale.d.ts.map +1 -0
  59. package/dist/types/client/index.d.ts +10 -0
  60. package/dist/types/client/index.d.ts.map +1 -0
  61. package/dist/types/client/intlayerContext.d.ts +8 -0
  62. package/dist/types/client/intlayerContext.d.ts.map +1 -0
  63. package/dist/types/client/intlayerStore.d.ts +12 -0
  64. package/dist/types/client/intlayerStore.d.ts.map +1 -0
  65. package/dist/types/client/useDictionary.d.ts +12 -0
  66. package/dist/types/client/useDictionary.d.ts.map +1 -0
  67. package/dist/types/client/useDictionaryDynamic.d.ts +12 -0
  68. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -0
  69. package/dist/types/client/useIntlayer.d.ts +13 -0
  70. package/dist/types/client/useIntlayer.d.ts.map +1 -0
  71. package/dist/types/client/useIntlayerAsync.d.ts +13 -0
  72. package/dist/types/client/useIntlayerAsync.d.ts.map +1 -0
  73. package/dist/types/client/useLocale.d.ts +9 -0
  74. package/dist/types/client/useLocale.d.ts.map +1 -0
  75. package/dist/types/getDictionary.d.ts +12 -0
  76. package/dist/types/getDictionary.d.ts.map +1 -0
  77. package/dist/types/getIntlayer.d.ts +12 -0
  78. package/dist/types/getIntlayer.d.ts.map +1 -0
  79. package/dist/types/index.d.ts +10 -2
  80. package/dist/types/index.d.ts.map +1 -1
  81. package/dist/types/markdown/index.d.ts +28 -0
  82. package/dist/types/markdown/index.d.ts.map +1 -0
  83. package/dist/types/plugins.d.ts +32 -0
  84. package/dist/types/plugins.d.ts.map +1 -0
  85. package/package.json +12 -9
  86. package/dist/cjs/intlayerMiddlewarePlugin.cjs +0 -224
  87. package/dist/cjs/intlayerMiddlewarePlugin.cjs.map +0 -1
  88. package/dist/cjs/intlayerPlugin.cjs +0 -76
  89. package/dist/cjs/intlayerPlugin.cjs.map +0 -1
  90. package/dist/esm/intlayerMiddlewarePlugin.mjs +0 -200
  91. package/dist/esm/intlayerMiddlewarePlugin.mjs.map +0 -1
  92. package/dist/esm/intlayerPlugin.mjs +0 -52
  93. package/dist/esm/intlayerPlugin.mjs.map +0 -1
  94. package/dist/types/intlayerMiddlewarePlugin.d.ts +0 -6
  95. package/dist/types/intlayerMiddlewarePlugin.d.ts.map +0 -1
  96. package/dist/types/intlayerPlugin.d.ts +0 -16
  97. package/dist/types/intlayerPlugin.d.ts.map +0 -1
@@ -0,0 +1,39 @@
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 navigator === "undefined") {
26
+ return "en";
27
+ }
28
+ const browserLocale = navigator.language || navigator.languages?.[0];
29
+ if (!browserLocale) {
30
+ return "en";
31
+ }
32
+ const languageCode = browserLocale.split("-")[0];
33
+ return languageCode || "en";
34
+ };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ getBrowserLocale
38
+ });
39
+ //# sourceMappingURL=getBrowserLocale.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/getBrowserLocale.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\n\n/**\n * Gets the user's preferred locale from browser settings\n * @returns The detected browser locale or 'en' as fallback\n */\nexport const getBrowserLocale = (): LocalesValues => {\n if (typeof navigator === 'undefined') {\n return 'en' as LocalesValues;\n }\n\n // Get the first preferred language\n const browserLocale = navigator.language || navigator.languages?.[0];\n\n if (!browserLocale) {\n return 'en' as LocalesValues;\n }\n\n // Extract language code (e.g., 'en-US' -> 'en')\n const languageCode = browserLocale.split('-')[0];\n\n return (languageCode || 'en') as LocalesValues;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,MAAM,mBAAmB,MAAqB;AACnD,MAAI,OAAO,cAAc,aAAa;AACpC,WAAO;AAAA,EACT;AAGA,QAAM,gBAAgB,UAAU,YAAY,UAAU,YAAY,CAAC;AAEnE,MAAI,CAAC,eAAe;AAClB,WAAO;AAAA,EACT;AAGA,QAAM,eAAe,cAAc,MAAM,GAAG,EAAE,CAAC;AAE/C,SAAQ,gBAAgB;AAC1B;","names":[]}
@@ -0,0 +1,52 @@
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
+ getBrowserLocale: () => import_getBrowserLocale.getBrowserLocale,
22
+ getIntlayerContext: () => import_intlayerContext.getIntlayerContext,
23
+ intlayerStore: () => import_intlayerStore.intlayerStore,
24
+ setIntlayerContext: () => import_intlayerContext.setIntlayerContext,
25
+ useDictionary: () => import_useDictionary.useDictionary,
26
+ useDictionaryDynamic: () => import_useDictionaryDynamic.useDictionaryDynamic,
27
+ useIntlayer: () => import_useIntlayer.useIntlayer,
28
+ useIntlayerAsync: () => import_useIntlayerAsync.useIntlayerAsync,
29
+ useLocale: () => import_useLocale.useLocale
30
+ });
31
+ module.exports = __toCommonJS(client_exports);
32
+ var import_useDictionary = require('./useDictionary.cjs');
33
+ var import_useDictionaryDynamic = require('./useDictionaryDynamic.cjs');
34
+ var import_useIntlayer = require('./useIntlayer.cjs');
35
+ var import_useIntlayerAsync = require('./useIntlayerAsync.cjs');
36
+ var import_intlayerContext = require('./intlayerContext.cjs');
37
+ var import_intlayerStore = require('./intlayerStore.cjs');
38
+ var import_getBrowserLocale = require('./getBrowserLocale.cjs');
39
+ var import_useLocale = require('./useLocale.cjs');
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ getBrowserLocale,
43
+ getIntlayerContext,
44
+ intlayerStore,
45
+ setIntlayerContext,
46
+ useDictionary,
47
+ useDictionaryDynamic,
48
+ useIntlayer,
49
+ useIntlayerAsync,
50
+ useLocale
51
+ });
52
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["// Export all client-side functionality for Svelte applications\n\n// Core hooks\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useIntlayer } from './useIntlayer';\nexport { useIntlayerAsync } from './useIntlayerAsync';\n\n// Context and providers\nexport { getIntlayerContext, setIntlayerContext } from './intlayerContext';\nexport { intlayerStore } from './intlayerStore';\n\n// Locale management\nexport { getBrowserLocale } from './getBrowserLocale';\nexport { useLocale } from './useLocale';\n\n// Type exports\nexport type { IntlayerStoreType } from './intlayerStore';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,2BAA8B;AAC9B,kCAAqC;AACrC,yBAA4B;AAC5B,8BAAiC;AAGjC,6BAAuD;AACvD,2BAA8B;AAG9B,8BAAiC;AACjC,uBAA0B;","names":[]}
@@ -0,0 +1,38 @@
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 intlayerContext_exports = {};
20
+ __export(intlayerContext_exports, {
21
+ getIntlayerContext: () => getIntlayerContext,
22
+ setIntlayerContext: () => setIntlayerContext
23
+ });
24
+ module.exports = __toCommonJS(intlayerContext_exports);
25
+ var import_svelte = require("svelte");
26
+ const INTLAYER_CONTEXT_KEY = Symbol("intlayer");
27
+ const setIntlayerContext = (context) => {
28
+ (0, import_svelte.setContext)(INTLAYER_CONTEXT_KEY, context);
29
+ };
30
+ const getIntlayerContext = () => {
31
+ return (0, import_svelte.getContext)(INTLAYER_CONTEXT_KEY);
32
+ };
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ getIntlayerContext,
36
+ setIntlayerContext
37
+ });
38
+ //# sourceMappingURL=intlayerContext.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/intlayerContext.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { getContext, setContext } from 'svelte';\n\nexport interface IntlayerContextType {\n locale: LocalesValues;\n setLocale: (locale: LocalesValues) => void;\n}\n\nconst INTLAYER_CONTEXT_KEY = Symbol('intlayer');\n\nexport const setIntlayerContext = (context: IntlayerContextType) => {\n setContext(INTLAYER_CONTEXT_KEY, context);\n};\n\nexport const getIntlayerContext = (): IntlayerContextType | undefined => {\n return getContext(INTLAYER_CONTEXT_KEY);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAuC;AAOvC,MAAM,uBAAuB,OAAO,UAAU;AAEvC,MAAM,qBAAqB,CAAC,YAAiC;AAClE,gCAAW,sBAAsB,OAAO;AAC1C;AAEO,MAAM,qBAAqB,MAAuC;AACvE,aAAO,0BAAW,oBAAoB;AACxC;","names":[]}
@@ -0,0 +1,42 @@
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 intlayerStore_exports = {};
20
+ __export(intlayerStore_exports, {
21
+ intlayerStore: () => intlayerStore
22
+ });
23
+ module.exports = __toCommonJS(intlayerStore_exports);
24
+ var import_store = require("svelte/store");
25
+ const createIntlayerStore = () => {
26
+ const { subscribe, set, update } = (0, import_store.writable)({
27
+ locale: "en"
28
+ // Default locale
29
+ });
30
+ return {
31
+ subscribe,
32
+ setLocale: (locale) => update((store) => ({ ...store, locale })),
33
+ getLocale: () => (0, import_store.derived)({ subscribe }, ($store) => $store.locale),
34
+ reset: () => set({ locale: "en" })
35
+ };
36
+ };
37
+ const intlayerStore = createIntlayerStore();
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ intlayerStore
41
+ });
42
+ //# sourceMappingURL=intlayerStore.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/intlayerStore.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { derived, writable, type Readable, type Writable } from 'svelte/store';\n\nexport interface IntlayerStoreType {\n locale: LocalesValues;\n}\n\n// Create the main intlayer store\nconst createIntlayerStore = () => {\n const { subscribe, set, update }: Writable<IntlayerStoreType> = writable({\n locale: 'en' as LocalesValues, // Default locale\n });\n\n return {\n subscribe,\n setLocale: (locale: LocalesValues) =>\n update((store) => ({ ...store, locale })),\n getLocale: (): Readable<LocalesValues> =>\n derived({ subscribe }, ($store) => $store.locale),\n reset: () => set({ locale: 'en' as LocalesValues }),\n };\n};\n\nexport const intlayerStore = createIntlayerStore();\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAgE;AAOhE,MAAM,sBAAsB,MAAM;AAChC,QAAM,EAAE,WAAW,KAAK,OAAO,QAAiC,uBAAS;AAAA,IACvE,QAAQ;AAAA;AAAA,EACV,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA,WAAW,CAAC,WACV,OAAO,CAAC,WAAW,EAAE,GAAG,OAAO,OAAO,EAAE;AAAA,IAC1C,WAAW,UACT,sBAAQ,EAAE,UAAU,GAAG,CAAC,WAAW,OAAO,MAAM;AAAA,IAClD,OAAO,MAAM,IAAI,EAAE,QAAQ,KAAsB,CAAC;AAAA,EACpD;AACF;AAEO,MAAM,gBAAgB,oBAAoB;","names":[]}
@@ -0,0 +1,39 @@
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 useDictionary_exports = {};
20
+ __export(useDictionary_exports, {
21
+ useDictionary: () => useDictionary
22
+ });
23
+ module.exports = __toCommonJS(useDictionary_exports);
24
+ var import_store = require("svelte/store");
25
+ var import_getDictionary = require('../getDictionary.cjs');
26
+ var import_intlayerContext = require('./intlayerContext.cjs');
27
+ var import_intlayerStore = require('./intlayerStore.cjs');
28
+ const useDictionary = (dictionary, locale) => {
29
+ const context = (0, import_intlayerContext.getIntlayerContext)();
30
+ return (0, import_store.derived)([import_intlayerStore.intlayerStore], ([$store]) => {
31
+ const targetLocale = locale ?? context?.locale ?? $store.locale;
32
+ return (0, import_getDictionary.getDictionary)(dictionary, targetLocale);
33
+ });
34
+ };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ useDictionary
38
+ });
39
+ //# sourceMappingURL=useDictionary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { type Dictionary } from '@intlayer/core';\nimport { derived, type Readable } from 'svelte/store';\nimport { getDictionary } from '../getDictionary';\nimport { DeepTransformContent } from '../plugins';\nimport { getIntlayerContext } from './intlayerContext';\nimport { intlayerStore } from './intlayerStore';\n\n/**\n * Svelte hook that transforms a dictionary and returns reactive content\n * @param dictionary The dictionary to transform\n * @param locale The target locale (optional, uses context or store locale)\n * @returns Reactive store with transformed dictionary content\n */\nexport const useDictionary = <T extends Dictionary>(\n dictionary: T,\n locale?: LocalesValues\n): Readable<DeepTransformContent<T['content']>> => {\n const context = getIntlayerContext();\n\n // Create a derived store that reactively updates when locale changes\n return derived([intlayerStore], ([$store]) => {\n const targetLocale = locale ?? context?.locale ?? $store.locale;\n return getDictionary<T, LocalesValues>(dictionary, targetLocale);\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAuC;AACvC,2BAA8B;AAE9B,6BAAmC;AACnC,2BAA8B;AAQvB,MAAM,gBAAgB,CAC3B,YACA,WACiD;AACjD,QAAM,cAAU,2CAAmB;AAGnC,aAAO,sBAAQ,CAAC,kCAAa,GAAG,CAAC,CAAC,MAAM,MAAM;AAC5C,UAAM,eAAe,UAAU,SAAS,UAAU,OAAO;AACzD,eAAO,oCAAgC,YAAY,YAAY;AAAA,EACjE,CAAC;AACH;","names":[]}
@@ -0,0 +1,57 @@
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 useDictionaryDynamic_exports = {};
20
+ __export(useDictionaryDynamic_exports, {
21
+ useDictionaryDynamic: () => useDictionaryDynamic
22
+ });
23
+ module.exports = __toCommonJS(useDictionaryDynamic_exports);
24
+ var import_store = require("svelte/store");
25
+ var import_intlayerContext = require('./intlayerContext.cjs');
26
+ var import_intlayerStore = require('./intlayerStore.cjs');
27
+ const useDictionaryDynamic = (dictionaryPromise, key, locale) => {
28
+ const context = (0, import_intlayerContext.getIntlayerContext)();
29
+ const dictionaryStore = (0, import_store.writable)(null);
30
+ return (0, import_store.derived)([import_intlayerStore.intlayerStore], ([$store]) => {
31
+ const targetLocale = locale ?? context?.locale ?? $store.locale;
32
+ const loadDictionary = async () => {
33
+ try {
34
+ const dictionaryLoader = dictionaryPromise[targetLocale];
35
+ if (dictionaryLoader) {
36
+ const loadedDictionary = await dictionaryLoader();
37
+ dictionaryStore.set(loadedDictionary);
38
+ } else {
39
+ dictionaryStore.set(null);
40
+ }
41
+ } catch (error) {
42
+ console.error(
43
+ `Failed to load dictionary for key: ${String(key)}`,
44
+ error
45
+ );
46
+ dictionaryStore.set(null);
47
+ }
48
+ };
49
+ loadDictionary();
50
+ return null;
51
+ });
52
+ };
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ useDictionaryDynamic
56
+ });
57
+ //# sourceMappingURL=useDictionaryDynamic.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport type {\n Dictionary,\n DictionaryKeys,\n LanguageContent,\n} from '@intlayer/core';\nimport { derived, writable, type Readable } from 'svelte/store';\nimport { getIntlayerContext } from './intlayerContext';\nimport { intlayerStore } from './intlayerStore';\n\n/**\n * Svelte hook for handling dynamic dictionary loading\n * @param dictionaryPromise Promise-based dictionary content\n * @param key Dictionary key for caching\n * @param locale Target locale (optional)\n * @returns Reactive store with loaded dictionary content\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n): Readable<T | null> => {\n const context = getIntlayerContext();\n const dictionaryStore = writable<T | null>(null);\n\n // Create a derived store that loads the dictionary when locale changes\n return derived([intlayerStore], ([$store]) => {\n const targetLocale = locale ?? context?.locale ?? $store.locale;\n\n // Load dictionary for the target locale asynchronously\n const loadDictionary = async () => {\n try {\n const dictionaryLoader = dictionaryPromise[targetLocale];\n if (dictionaryLoader) {\n const loadedDictionary = await dictionaryLoader();\n dictionaryStore.set(loadedDictionary);\n } else {\n dictionaryStore.set(null);\n }\n } catch (error) {\n console.error(\n `Failed to load dictionary for key: ${String(key)}`,\n error\n );\n dictionaryStore.set(null);\n }\n };\n\n loadDictionary();\n\n // Return the current state, actual loading happens asynchronously\n return null;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,mBAAiD;AACjD,6BAAmC;AACnC,2BAA8B;AASvB,MAAM,uBAAuB,CAIlC,mBACA,KACA,WACuB;AACvB,QAAM,cAAU,2CAAmB;AACnC,QAAM,sBAAkB,uBAAmB,IAAI;AAG/C,aAAO,sBAAQ,CAAC,kCAAa,GAAG,CAAC,CAAC,MAAM,MAAM;AAC5C,UAAM,eAAe,UAAU,SAAS,UAAU,OAAO;AAGzD,UAAM,iBAAiB,YAAY;AACjC,UAAI;AACF,cAAM,mBAAmB,kBAAkB,YAAY;AACvD,YAAI,kBAAkB;AACpB,gBAAM,mBAAmB,MAAM,iBAAiB;AAChD,0BAAgB,IAAI,gBAAgB;AAAA,QACtC,OAAO;AACL,0BAAgB,IAAI,IAAI;AAAA,QAC1B;AAAA,MACF,SAAS,OAAO;AACd,gBAAQ;AAAA,UACN,sCAAsC,OAAO,GAAG,CAAC;AAAA,UACjD;AAAA,QACF;AACA,wBAAgB,IAAI,IAAI;AAAA,MAC1B;AAAA,IACF;AAEA,mBAAe;AAGf,WAAO;AAAA,EACT,CAAC;AACH;","names":[]}
@@ -0,0 +1,39 @@
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 useIntlayer_exports = {};
20
+ __export(useIntlayer_exports, {
21
+ useIntlayer: () => useIntlayer
22
+ });
23
+ module.exports = __toCommonJS(useIntlayer_exports);
24
+ var import_store = require("svelte/store");
25
+ var import_getIntlayer = require('../getIntlayer.cjs');
26
+ var import_intlayerContext = require('./intlayerContext.cjs');
27
+ var import_intlayerStore = require('./intlayerStore.cjs');
28
+ const useIntlayer = (key, locale) => {
29
+ const context = (0, import_intlayerContext.getIntlayerContext)();
30
+ return (0, import_store.derived)([import_intlayerStore.intlayerStore], ([$store]) => {
31
+ const targetLocale = locale ?? context?.locale ?? $store.locale;
32
+ return (0, import_getIntlayer.getIntlayer)(key, targetLocale);
33
+ });
34
+ };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ useIntlayer
38
+ });
39
+ //# sourceMappingURL=useIntlayer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport type { DictionaryKeys } from '@intlayer/core';\nimport { derived, type Readable } from 'svelte/store';\n// @ts-ignore intlayer declared for module augmentation\nimport type { IntlayerDictionaryTypesConnector } from 'intlayer';\nimport { getIntlayer } from '../getIntlayer';\nimport { DeepTransformContent } from '../plugins';\nimport { getIntlayerContext } from './intlayerContext';\nimport { intlayerStore } from './intlayerStore';\n\n/**\n * Svelte hook that picks one dictionary by its key and returns reactive content\n * @param key The dictionary key to retrieve\n * @param locale The target locale (optional, uses context or store locale)\n * @returns Reactive store with transformed dictionary content\n */\nexport const useIntlayer = <T extends DictionaryKeys>(\n key: T,\n locale?: LocalesValues\n): Readable<\n DeepTransformContent<IntlayerDictionaryTypesConnector[T]['content']>\n> => {\n const context = getIntlayerContext();\n\n // Create a derived store that reactively updates when locale changes\n return derived([intlayerStore], ([$store]) => {\n const targetLocale = locale ?? context?.locale ?? $store.locale;\n return getIntlayer(key, targetLocale);\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAuC;AAGvC,yBAA4B;AAE5B,6BAAmC;AACnC,2BAA8B;AAQvB,MAAM,cAAc,CACzB,KACA,WAGG;AACH,QAAM,cAAU,2CAAmB;AAGnC,aAAO,sBAAQ,CAAC,kCAAa,GAAG,CAAC,CAAC,MAAM,MAAM;AAC5C,UAAM,eAAe,UAAU,SAAS,UAAU,OAAO;AACzD,eAAO,gCAAY,KAAK,YAAY;AAAA,EACtC,CAAC;AACH;","names":[]}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var useIntlayerAsync_exports = {};
30
+ __export(useIntlayerAsync_exports, {
31
+ useIntlayerAsync: () => useIntlayerAsync
32
+ });
33
+ module.exports = __toCommonJS(useIntlayerAsync_exports);
34
+ var import_store = require("svelte/store");
35
+ var import_intlayerContext = require('./intlayerContext.cjs');
36
+ var import_intlayerStore = require('./intlayerStore.cjs');
37
+ const useIntlayerAsync = (key, locale) => {
38
+ const context = (0, import_intlayerContext.getIntlayerContext)();
39
+ const contentStore = (0, import_store.writable)(null);
40
+ return (0, import_store.derived)([import_intlayerStore.intlayerStore], ([$store]) => {
41
+ const targetLocale = locale ?? context?.locale ?? $store.locale;
42
+ const loadDictionary = async () => {
43
+ try {
44
+ const { getIntlayerAsync } = await import("@intlayer/core");
45
+ const content = await getIntlayerAsync(key, targetLocale);
46
+ contentStore.set(content);
47
+ } catch (error) {
48
+ console.error(
49
+ `Failed to load async dictionary for key: ${String(key)}`,
50
+ error
51
+ );
52
+ contentStore.set(null);
53
+ }
54
+ };
55
+ loadDictionary();
56
+ return null;
57
+ });
58
+ };
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ useIntlayerAsync
62
+ });
63
+ //# sourceMappingURL=useIntlayerAsync.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/useIntlayerAsync.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport type { DictionaryKeys } from '@intlayer/core';\nimport { derived, writable, type Readable } from 'svelte/store';\n// @ts-ignore intlayer declared for module augmentation\nimport type { IntlayerDictionaryTypesConnector } from 'intlayer';\nimport { DeepTransformContent } from '../plugins';\nimport { getIntlayerContext } from './intlayerContext';\nimport { intlayerStore } from './intlayerStore';\n\n/**\n * Svelte hook for asynchronous dictionary loading by key\n * @param key The dictionary key to retrieve\n * @param locale Target locale (optional)\n * @returns Reactive store with loaded dictionary content\n */\nexport const useIntlayerAsync = <T extends DictionaryKeys>(\n key: T,\n locale?: LocalesValues\n): Readable<DeepTransformContent<\n IntlayerDictionaryTypesConnector[T]['content']\n> | null> => {\n const context = getIntlayerContext();\n const contentStore = writable<DeepTransformContent<\n IntlayerDictionaryTypesConnector[T]['content']\n > | null>(null);\n\n // Create a derived store that loads the dictionary when locale changes\n return derived([intlayerStore], ([$store]) => {\n const targetLocale = locale ?? context?.locale ?? $store.locale;\n\n // Load dictionary asynchronously\n const loadDictionary = async () => {\n try {\n // This would typically use getIntlayerAsync from core\n // For now, we'll simulate async loading\n const { getIntlayerAsync } = await import('@intlayer/core');\n const content = await getIntlayerAsync(key, targetLocale);\n contentStore.set(content);\n } catch (error) {\n console.error(\n `Failed to load async dictionary for key: ${String(key)}`,\n error\n );\n contentStore.set(null);\n }\n };\n\n loadDictionary();\n\n // Return the current state, actual loading happens asynchronously\n return null;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAiD;AAIjD,6BAAmC;AACnC,2BAA8B;AAQvB,MAAM,mBAAmB,CAC9B,KACA,WAGW;AACX,QAAM,cAAU,2CAAmB;AACnC,QAAM,mBAAe,uBAEX,IAAI;AAGd,aAAO,sBAAQ,CAAC,kCAAa,GAAG,CAAC,CAAC,MAAM,MAAM;AAC5C,UAAM,eAAe,UAAU,SAAS,UAAU,OAAO;AAGzD,UAAM,iBAAiB,YAAY;AACjC,UAAI;AAGF,cAAM,EAAE,iBAAiB,IAAI,MAAM,OAAO,gBAAgB;AAC1D,cAAM,UAAU,MAAM,iBAAiB,KAAK,YAAY;AACxD,qBAAa,IAAI,OAAO;AAAA,MAC1B,SAAS,OAAO;AACd,gBAAQ;AAAA,UACN,4CAA4C,OAAO,GAAG,CAAC;AAAA,UACvD;AAAA,QACF;AACA,qBAAa,IAAI,IAAI;AAAA,MACvB;AAAA,IACF;AAEA,mBAAe;AAGf,WAAO;AAAA,EACT,CAAC;AACH;","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 useLocale_exports = {};
20
+ __export(useLocale_exports, {
21
+ useLocale: () => useLocale
22
+ });
23
+ module.exports = __toCommonJS(useLocale_exports);
24
+ var import_store = require("svelte/store");
25
+ var import_intlayerContext = require('./intlayerContext.cjs');
26
+ var import_intlayerStore = require('./intlayerStore.cjs');
27
+ const useLocale = () => {
28
+ const context = (0, import_intlayerContext.getIntlayerContext)();
29
+ if (context) {
30
+ return {
31
+ locale: (0, import_store.derived)(
32
+ [import_intlayerStore.intlayerStore],
33
+ ([$store]) => context.locale || $store.locale
34
+ ),
35
+ setLocale: context.setLocale
36
+ };
37
+ }
38
+ return {
39
+ locale: import_intlayerStore.intlayerStore.getLocale(),
40
+ setLocale: import_intlayerStore.intlayerStore.setLocale
41
+ };
42
+ };
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ useLocale
46
+ });
47
+ //# sourceMappingURL=useLocale.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { derived } from 'svelte/store';\nimport { getIntlayerContext } from './intlayerContext';\nimport { intlayerStore } from './intlayerStore';\n\n/**\n * Hook to get and set the current locale in Svelte applications\n * @returns Readable store with current locale and setter function\n */\nexport const useLocale = () => {\n const context = getIntlayerContext();\n\n if (context) {\n // Use context if available\n return {\n locale: derived(\n [intlayerStore],\n ([$store]) => context.locale || $store.locale\n ),\n setLocale: context.setLocale,\n };\n }\n\n // Fallback to global store\n return {\n locale: intlayerStore.getLocale(),\n setLocale: intlayerStore.setLocale,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwB;AACxB,6BAAmC;AACnC,2BAA8B;AAMvB,MAAM,YAAY,MAAM;AAC7B,QAAM,cAAU,2CAAmB;AAEnC,MAAI,SAAS;AAEX,WAAO;AAAA,MACL,YAAQ;AAAA,QACN,CAAC,kCAAa;AAAA,QACd,CAAC,CAAC,MAAM,MAAM,QAAQ,UAAU,OAAO;AAAA,MACzC;AAAA,MACA,WAAW,QAAQ;AAAA,IACrB;AAAA,EACF;AAGA,SAAO;AAAA,IACL,QAAQ,mCAAc,UAAU;AAAA,IAChC,WAAW,mCAAc;AAAA,EAC3B;AACF;","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.svelteNodePlugins,
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/getDictionary.ts"],"sourcesContent":["import type { Locales, LocalesValues } from '@intlayer/config/client';\nimport {\n Dictionary,\n Plugins,\n getDictionary as getDictionaryCore,\n} from '@intlayer/core';\nimport {\n DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n svelteNodePlugins,\n} from './plugins';\n\n/**\n * Get dictionary content for a specific locale in Svelte applications\n * @param dictionary The dictionary object to transform\n * @param locale The target locale (optional, defaults to current locale)\n * @param additionalPlugins Additional transformation plugins\n * @returns Transformed dictionary content optimized for Svelte\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 svelteNodePlugins,\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;AASA,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,39 @@
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
+ var import_core = require("@intlayer/core");
25
+ var import_plugins = require('./plugins.cjs');
26
+ const getIntlayer = (key, locale, additionalPlugins) => {
27
+ const plugins = [
28
+ import_plugins.intlayerNodePlugins,
29
+ import_plugins.svelteNodePlugins,
30
+ import_plugins.markdownPlugin,
31
+ ...additionalPlugins ?? []
32
+ ];
33
+ return (0, import_core.getIntlayer)(key, locale, plugins);
34
+ };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ getIntlayer
38
+ });
39
+ //# sourceMappingURL=getIntlayer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import {\n DictionaryKeys,\n getIntlayer as getIntlayerCore,\n Plugins,\n} from '@intlayer/core';\n// @ts-ignore intlayer declared for module augmentation\nimport type { IntlayerDictionaryTypesConnector, LocalesValues } from 'intlayer';\nimport {\n DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n svelteNodePlugins,\n} from './plugins';\n\n/**\n * Get dictionary content by key for Svelte applications\n * @param key The dictionary key to retrieve\n * @param locale The target locale (optional)\n * @param additionalPlugins Additional transformation plugins\n * @returns Transformed dictionary content optimized for Svelte\n */\nexport const getIntlayer = <T extends DictionaryKeys, L extends LocalesValues>(\n key: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n svelteNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getIntlayerCore(key, locale, plugins) as any as DeepTransformContent<\n IntlayerDictionaryTypesConnector[T]['content']\n >;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAIO;AAGP,qBAKO;AASA,MAAM,cAAc,CACzB,KACA,QACA,sBACG;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,qBAAqB,CAAC;AAAA,EAC5B;AAEA,aAAO,YAAAA,aAAgB,KAAK,QAAQ,OAAO;AAG7C;","names":["getIntlayerCore"]}
@@ -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 { IInterpreterPluginSvelte } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginSvelte<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,39 @@
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
+ defaultMarkdownRenderer: () => defaultMarkdownRenderer,
22
+ processMarkdown: () => processMarkdown
23
+ });
24
+ module.exports = __toCommonJS(markdown_exports);
25
+ const processMarkdown = (content) => {
26
+ return content;
27
+ };
28
+ const defaultMarkdownRenderer = {
29
+ render: processMarkdown,
30
+ configure: (options) => {
31
+ console.log("Configuring markdown renderer with options:", options);
32
+ }
33
+ };
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ defaultMarkdownRenderer,
37
+ processMarkdown
38
+ });
39
+ //# sourceMappingURL=index.cjs.map