svelte-intlayer 5.6.0 → 5.7.1
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/index.cjs +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/client/index.mjs +17 -15
- package/dist/esm/client/useDictionaryAsync.mjs +27 -0
- package/dist/esm/index.mjs +27 -25
- package/dist/types/client/index.d.ts +1 -0
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/client/useDictionaryAsync.d.ts +12 -0
- package/dist/types/client/useDictionaryAsync.d.ts.map +1 -0
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./useDictionary.cjs"),n=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./useDictionary.cjs"),n=require("./useDictionaryAsync.cjs"),r=require("./useDictionaryDynamic.cjs"),i=require("./useIntlayer.cjs"),c=require("./useIntlayerAsync.cjs"),e=require("./intlayerContext.cjs"),s=require("./intlayerStore.cjs"),o=require("./getBrowserLocale.cjs"),a=require("./useLocale.cjs");exports.useDictionary=t.useDictionary;exports.useDictionaryAsync=n.useDictionaryAsync;exports.useDictionaryDynamic=r.useDictionaryDynamic;exports.useIntlayer=i.useIntlayer;exports.useIntlayerAsync=c.useIntlayerAsync;exports.getIntlayerContext=e.getIntlayerContext;exports.setIntlayerContext=e.setIntlayerContext;exports.intlayerStore=s.intlayerStore;exports.getBrowserLocale=o.getBrowserLocale;exports.useLocale=a.useLocale;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("svelte/store"),s=require("./intlayerContext.cjs"),y=require("./intlayerStore.cjs"),d=async(i,c)=>{const e=s.getIntlayerContext(),r=n.writable(null);return n.derived([y.intlayerStore],([a])=>{const o=c??(e==null?void 0:e.locale)??a.locale;return(async()=>{try{const t=i[o];if(t){const l=await t();r.set(l)}else r.set(null)}catch(t){console.error(`Failed to load dictionary for key: ${String(o)}`,t),r.set(null)}})(),null})};exports.useDictionaryAsync=d;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./client/useDictionary.cjs"),i=require("./client/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./client/useDictionary.cjs"),i=require("./client/useDictionaryAsync.cjs"),o=require("./client/useDictionaryDynamic.cjs"),s=require("./client/useIntlayer.cjs"),c=require("./client/useIntlayerAsync.cjs"),t=require("./client/intlayerContext.cjs"),a=require("./client/intlayerStore.cjs"),l=require("./client/getBrowserLocale.cjs"),u=require("./client/useLocale.cjs"),y=require("./getDictionary.cjs"),g=require("./getIntlayer.cjs"),n=require("./markdown/index.cjs"),e=require("./plugins.cjs");exports.useDictionary=r.useDictionary;exports.useDictionaryAsync=i.useDictionaryAsync;exports.useDictionaryDynamic=o.useDictionaryDynamic;exports.useIntlayer=s.useIntlayer;exports.useIntlayerAsync=c.useIntlayerAsync;exports.getIntlayerContext=t.getIntlayerContext;exports.setIntlayerContext=t.setIntlayerContext;exports.intlayerStore=a.intlayerStore;exports.getBrowserLocale=l.getBrowserLocale;exports.useLocale=u.useLocale;exports.getDictionary=y.getDictionary;exports.getIntlayer=g.getIntlayer;exports.defaultMarkdownRenderer=n.defaultMarkdownRenderer;exports.processMarkdown=n.processMarkdown;exports.intlayerNodePlugins=e.intlayerNodePlugins;exports.markdownPlugin=e.markdownPlugin;exports.svelteNodePlugins=e.svelteNodePlugins;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { useDictionary as o } from "./useDictionary.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { useDictionaryAsync as n } from "./useDictionaryAsync.mjs";
|
|
3
|
+
import { useDictionaryDynamic as x } from "./useDictionaryDynamic.mjs";
|
|
4
|
+
import { useIntlayer as m } from "./useIntlayer.mjs";
|
|
5
|
+
import { useIntlayerAsync as f } from "./useIntlayerAsync.mjs";
|
|
6
|
+
import { getIntlayerContext as c, setIntlayerContext as i } from "./intlayerContext.mjs";
|
|
7
|
+
import { intlayerStore as u } from "./intlayerStore.mjs";
|
|
8
|
+
import { getBrowserLocale as I } from "./getBrowserLocale.mjs";
|
|
9
|
+
import { useLocale as A } from "./useLocale.mjs";
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
I as getBrowserLocale,
|
|
12
|
+
c as getIntlayerContext,
|
|
13
|
+
u as intlayerStore,
|
|
14
|
+
i as setIntlayerContext,
|
|
14
15
|
o as useDictionary,
|
|
15
|
-
n as
|
|
16
|
-
x as
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
n as useDictionaryAsync,
|
|
17
|
+
x as useDictionaryDynamic,
|
|
18
|
+
m as useIntlayer,
|
|
19
|
+
f as useIntlayerAsync,
|
|
20
|
+
A as useLocale
|
|
19
21
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { writable as c, derived as s } from "svelte/store";
|
|
2
|
+
import { getIntlayerContext as y } from "./intlayerContext.mjs";
|
|
3
|
+
import { intlayerStore as d } from "./intlayerStore.mjs";
|
|
4
|
+
const D = async (n, a) => {
|
|
5
|
+
const t = y(), r = c(null);
|
|
6
|
+
return s([d], ([i]) => {
|
|
7
|
+
const e = a ?? (t == null ? void 0 : t.locale) ?? i.locale;
|
|
8
|
+
return (async () => {
|
|
9
|
+
try {
|
|
10
|
+
const o = n[e];
|
|
11
|
+
if (o) {
|
|
12
|
+
const l = await o();
|
|
13
|
+
r.set(l);
|
|
14
|
+
} else
|
|
15
|
+
r.set(null);
|
|
16
|
+
} catch (o) {
|
|
17
|
+
console.error(
|
|
18
|
+
`Failed to load dictionary for key: ${String(e)}`,
|
|
19
|
+
o
|
|
20
|
+
), r.set(null);
|
|
21
|
+
}
|
|
22
|
+
})(), null;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
D as useDictionaryAsync
|
|
27
|
+
};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import { useDictionary as o } from "./client/useDictionary.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
2
|
+
import { useDictionaryAsync as n } from "./client/useDictionaryAsync.mjs";
|
|
3
|
+
import { useDictionaryDynamic as m } from "./client/useDictionaryDynamic.mjs";
|
|
4
|
+
import { useIntlayer as x } from "./client/useIntlayer.mjs";
|
|
5
|
+
import { useIntlayerAsync as i } from "./client/useIntlayerAsync.mjs";
|
|
6
|
+
import { getIntlayerContext as p, setIntlayerContext as y } from "./client/intlayerContext.mjs";
|
|
7
|
+
import { intlayerStore as u } from "./client/intlayerStore.mjs";
|
|
8
|
+
import { getBrowserLocale as g } from "./client/getBrowserLocale.mjs";
|
|
9
|
+
import { useLocale as I } from "./client/useLocale.mjs";
|
|
10
|
+
import { getDictionary as k } from "./getDictionary.mjs";
|
|
11
|
+
import { getIntlayer as A } from "./getIntlayer.mjs";
|
|
12
|
+
import { defaultMarkdownRenderer as L, processMarkdown as M } from "./markdown/index.mjs";
|
|
13
|
+
import { intlayerNodePlugins as v, markdownPlugin as B, svelteNodePlugins as R } from "./plugins.mjs";
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
L as defaultMarkdownRenderer,
|
|
16
|
+
g as getBrowserLocale,
|
|
17
|
+
k as getDictionary,
|
|
18
|
+
A as getIntlayer,
|
|
18
19
|
p as getIntlayerContext,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
v as intlayerNodePlugins,
|
|
21
|
+
u as intlayerStore,
|
|
22
|
+
B as markdownPlugin,
|
|
23
|
+
M as processMarkdown,
|
|
24
|
+
y as setIntlayerContext,
|
|
25
|
+
R as svelteNodePlugins,
|
|
25
26
|
o as useDictionary,
|
|
26
|
-
n as
|
|
27
|
-
|
|
28
|
-
x as
|
|
29
|
-
|
|
27
|
+
n as useDictionaryAsync,
|
|
28
|
+
m as useDictionaryDynamic,
|
|
29
|
+
x as useIntlayer,
|
|
30
|
+
i as useIntlayerAsync,
|
|
31
|
+
I as useLocale
|
|
30
32
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useDictionary } from './useDictionary';
|
|
2
|
+
export { useDictionaryAsync } from './useDictionaryAsync';
|
|
2
3
|
export { useDictionaryDynamic } from './useDictionaryDynamic';
|
|
3
4
|
export { useIntlayer } from './useIntlayer';
|
|
4
5
|
export { useIntlayerAsync } from './useIntlayerAsync';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
import { Dictionary, LanguageContent } from '@intlayer/core';
|
|
3
|
+
import { Readable } from 'svelte/store';
|
|
4
|
+
/**
|
|
5
|
+
* Svelte hook for handling dynamic dictionary loading
|
|
6
|
+
* @param dictionaryPromise Promise-based dictionary content
|
|
7
|
+
* @param key Dictionary key for caching
|
|
8
|
+
* @param locale Target locale (optional)
|
|
9
|
+
* @returns Reactive store with loaded dictionary content
|
|
10
|
+
*/
|
|
11
|
+
export declare const useDictionaryAsync: <T extends Dictionary>(dictionaryPromise: LanguageContent<() => Promise<T>>, locale?: LocalesValues) => Promise<Readable<T | null>>;
|
|
12
|
+
//# sourceMappingURL=useDictionaryAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionaryAsync.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionaryAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIhE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAU,CAAC,SAAS,UAAU,EAC3D,mBAAmB,eAAe,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EACpD,SAAS,aAAa,KACrB,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,CAgC5B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-intlayer",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Svelte applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"js-cookie": "^3.0.5",
|
|
61
|
-
"@intlayer/
|
|
62
|
-
"@intlayer/
|
|
63
|
-
"@intlayer/
|
|
64
|
-
"@intlayer/
|
|
61
|
+
"@intlayer/api": "5.7.1",
|
|
62
|
+
"@intlayer/config": "5.7.1",
|
|
63
|
+
"@intlayer/core": "5.7.1",
|
|
64
|
+
"@intlayer/editor": "5.7.1"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@sveltejs/vite-plugin-svelte": "^5.1.0",
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"svelte": ">=5.0.0",
|
|
86
|
-
"@intlayer/
|
|
87
|
-
"@intlayer/
|
|
88
|
-
"@intlayer/
|
|
89
|
-
"@intlayer/
|
|
86
|
+
"@intlayer/config": "5.7.1",
|
|
87
|
+
"@intlayer/api": "5.7.1",
|
|
88
|
+
"@intlayer/core": "5.7.1",
|
|
89
|
+
"@intlayer/editor": "5.7.1"
|
|
90
90
|
},
|
|
91
91
|
"engines": {
|
|
92
92
|
"node": ">=14.18"
|