svelte-intlayer 5.5.10 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cjs/client/getBrowserLocale.cjs +1 -39
- package/dist/cjs/client/index.cjs +1 -52
- package/dist/cjs/client/intlayerContext.cjs +1 -38
- package/dist/cjs/client/intlayerStore.cjs +1 -42
- package/dist/cjs/client/useDictionary.cjs +1 -39
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -57
- package/dist/cjs/client/useIntlayer.cjs +1 -39
- package/dist/cjs/client/useIntlayerAsync.cjs +1 -63
- package/dist/cjs/client/useLocale.cjs +1 -47
- package/dist/cjs/getDictionary.cjs +1 -43
- package/dist/cjs/getIntlayer.cjs +1 -39
- package/dist/cjs/index.cjs +1 -31
- package/dist/cjs/markdown/index.cjs +1 -39
- package/dist/cjs/plugins.cjs +1 -53
- package/dist/esm/client/getBrowserLocale.mjs +6 -11
- package/dist/esm/client/index.mjs +17 -18
- package/dist/esm/client/intlayerContext.mjs +6 -11
- package/dist/esm/client/intlayerStore.mjs +9 -11
- package/dist/esm/client/useDictionary.mjs +10 -11
- package/dist/esm/client/useDictionaryDynamic.mjs +20 -26
- package/dist/esm/client/useIntlayer.mjs +10 -11
- package/dist/esm/client/useIntlayerAsync.mjs +16 -22
- package/dist/esm/client/useLocale.mjs +15 -19
- package/dist/esm/getDictionary.mjs +13 -20
- package/dist/esm/getIntlayer.mjs +10 -17
- package/dist/esm/index.mjs +30 -6
- package/dist/esm/markdown/index.mjs +6 -10
- package/dist/esm/plugins.mjs +12 -21
- package/dist/types/client/getBrowserLocale.d.ts +1 -1
- package/dist/types/client/intlayerContext.d.ts +1 -1
- package/dist/types/client/intlayerStore.d.ts +3 -3
- package/dist/types/client/useDictionary.d.ts +3 -3
- package/dist/types/client/useDictionaryDynamic.d.ts +3 -3
- package/dist/types/client/useIntlayer.d.ts +4 -4
- package/dist/types/client/useIntlayerAsync.d.ts +4 -4
- package/dist/types/client/useLocale.d.ts +2 -2
- package/dist/types/getDictionary.d.ts +1 -1
- package/dist/types/getIntlayer.d.ts +1 -1
- package/dist/types/plugins.d.ts +1 -1
- package/package.json +21 -18
- package/dist/cjs/client/getBrowserLocale.cjs.map +0 -1
- package/dist/cjs/client/index.cjs.map +0 -1
- package/dist/cjs/client/intlayerContext.cjs.map +0 -1
- package/dist/cjs/client/intlayerStore.cjs.map +0 -1
- package/dist/cjs/client/useDictionary.cjs.map +0 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs.map +0 -1
- package/dist/cjs/client/useIntlayer.cjs.map +0 -1
- package/dist/cjs/client/useIntlayerAsync.cjs.map +0 -1
- package/dist/cjs/client/useLocale.cjs.map +0 -1
- package/dist/cjs/getDictionary.cjs.map +0 -1
- package/dist/cjs/getIntlayer.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/markdown/index.cjs.map +0 -1
- package/dist/cjs/plugins.cjs.map +0 -1
- package/dist/esm/client/getBrowserLocale.mjs.map +0 -1
- package/dist/esm/client/index.mjs.map +0 -1
- package/dist/esm/client/intlayerContext.mjs.map +0 -1
- package/dist/esm/client/intlayerStore.mjs.map +0 -1
- package/dist/esm/client/useDictionary.mjs.map +0 -1
- package/dist/esm/client/useDictionaryDynamic.mjs.map +0 -1
- package/dist/esm/client/useIntlayer.mjs.map +0 -1
- package/dist/esm/client/useIntlayerAsync.mjs.map +0 -1
- package/dist/esm/client/useLocale.mjs.map +0 -1
- package/dist/esm/getDictionary.mjs.map +0 -1
- package/dist/esm/getIntlayer.mjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/markdown/index.mjs.map +0 -1
- package/dist/esm/plugins.mjs.map +0 -1
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -1,53 +1 @@
|
|
|
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 plugins_exports = {};
|
|
20
|
-
__export(plugins_exports, {
|
|
21
|
-
intlayerNodePlugins: () => intlayerNodePlugins,
|
|
22
|
-
markdownPlugin: () => markdownPlugin,
|
|
23
|
-
svelteNodePlugins: () => svelteNodePlugins
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(plugins_exports);
|
|
26
|
-
const svelteNodePlugins = {
|
|
27
|
-
id: "svelte-node-plugin",
|
|
28
|
-
canHandle: (node) => typeof node === "bigint" || typeof node === "string" || typeof node === "number",
|
|
29
|
-
transform: (node, { children, ...rest }) => {
|
|
30
|
-
return children ?? node;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const intlayerNodePlugins = {
|
|
34
|
-
id: "intlayer-node-plugin",
|
|
35
|
-
canHandle: (node) => typeof node === "bigint" || typeof node === "string" || typeof node === "number",
|
|
36
|
-
transform: (node, { children, ...rest }) => {
|
|
37
|
-
return children ?? node;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const markdownPlugin = {
|
|
41
|
-
id: "markdown-plugin",
|
|
42
|
-
canHandle: (node) => typeof node === "string",
|
|
43
|
-
transform: (node, props) => {
|
|
44
|
-
return node;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
-
0 && (module.exports = {
|
|
49
|
-
intlayerNodePlugins,
|
|
50
|
-
markdownPlugin,
|
|
51
|
-
svelteNodePlugins
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=plugins.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r={id:"svelte-node-plugin",canHandle:n=>typeof n=="bigint"||typeof n=="string"||typeof n=="number",transform:(n,{children:e,...t})=>e??n},i={id:"intlayer-node-plugin",canHandle:n=>typeof n=="bigint"||typeof n=="string"||typeof n=="number",transform:(n,{children:e,...t})=>e??n},o={id:"markdown-plugin",canHandle:n=>typeof n=="string",transform:(n,e)=>n};exports.intlayerNodePlugins=i;exports.markdownPlugin=o;exports.svelteNodePlugins=r;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const o = () => {
|
|
2
|
+
var n;
|
|
3
|
+
if (typeof navigator > "u")
|
|
3
4
|
return "en";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (!browserLocale) {
|
|
7
|
-
return "en";
|
|
8
|
-
}
|
|
9
|
-
const languageCode = browserLocale.split("-")[0];
|
|
10
|
-
return languageCode || "en";
|
|
5
|
+
const e = navigator.language || ((n = navigator.languages) == null ? void 0 : n[0]);
|
|
6
|
+
return e && e.split("-")[0] || "en";
|
|
11
7
|
};
|
|
12
8
|
export {
|
|
13
|
-
getBrowserLocale
|
|
9
|
+
o as getBrowserLocale
|
|
14
10
|
};
|
|
15
|
-
//# sourceMappingURL=getBrowserLocale.mjs.map
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { useDictionary } from "./useDictionary.mjs";
|
|
2
|
-
import { useDictionaryDynamic } from "./useDictionaryDynamic.mjs";
|
|
3
|
-
import { useIntlayer } from "./useIntlayer.mjs";
|
|
4
|
-
import { useIntlayerAsync } from "./useIntlayerAsync.mjs";
|
|
5
|
-
import { getIntlayerContext, setIntlayerContext } from "./intlayerContext.mjs";
|
|
6
|
-
import { intlayerStore } from "./intlayerStore.mjs";
|
|
7
|
-
import { getBrowserLocale } from "./getBrowserLocale.mjs";
|
|
8
|
-
import { useLocale } from "./useLocale.mjs";
|
|
1
|
+
import { useDictionary as o } from "./useDictionary.mjs";
|
|
2
|
+
import { useDictionaryDynamic as n } from "./useDictionaryDynamic.mjs";
|
|
3
|
+
import { useIntlayer as x } from "./useIntlayer.mjs";
|
|
4
|
+
import { useIntlayerAsync as y } from "./useIntlayerAsync.mjs";
|
|
5
|
+
import { getIntlayerContext as p, setIntlayerContext as s } from "./intlayerContext.mjs";
|
|
6
|
+
import { intlayerStore as c } from "./intlayerStore.mjs";
|
|
7
|
+
import { getBrowserLocale as u } from "./getBrowserLocale.mjs";
|
|
8
|
+
import { useLocale as D } from "./useLocale.mjs";
|
|
9
9
|
export {
|
|
10
|
-
getBrowserLocale,
|
|
11
|
-
getIntlayerContext,
|
|
12
|
-
intlayerStore,
|
|
13
|
-
setIntlayerContext,
|
|
14
|
-
useDictionary,
|
|
15
|
-
useDictionaryDynamic,
|
|
16
|
-
useIntlayer,
|
|
17
|
-
useIntlayerAsync,
|
|
18
|
-
useLocale
|
|
10
|
+
u as getBrowserLocale,
|
|
11
|
+
p as getIntlayerContext,
|
|
12
|
+
c as intlayerStore,
|
|
13
|
+
s as setIntlayerContext,
|
|
14
|
+
o as useDictionary,
|
|
15
|
+
n as useDictionaryDynamic,
|
|
16
|
+
x as useIntlayer,
|
|
17
|
+
y as useIntlayerAsync,
|
|
18
|
+
D as useLocale
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { getContext, setContext } from "svelte";
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
const getIntlayerContext = () => {
|
|
7
|
-
return getContext(INTLAYER_CONTEXT_KEY);
|
|
8
|
-
};
|
|
1
|
+
import { getContext as n, setContext as o } from "svelte";
|
|
2
|
+
const t = Symbol("intlayer"), s = (e) => {
|
|
3
|
+
o(t, e);
|
|
4
|
+
}, x = () => n(t);
|
|
9
5
|
export {
|
|
10
|
-
getIntlayerContext,
|
|
11
|
-
setIntlayerContext
|
|
6
|
+
x as getIntlayerContext,
|
|
7
|
+
s as setIntlayerContext
|
|
12
8
|
};
|
|
13
|
-
//# sourceMappingURL=intlayerContext.mjs.map
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
const { subscribe, set, update } =
|
|
1
|
+
import { writable as a, derived as c } from "svelte/store";
|
|
2
|
+
const n = () => {
|
|
3
|
+
const { subscribe: t, set: r, update: o } = a({
|
|
4
4
|
locale: "en"
|
|
5
5
|
// Default locale
|
|
6
6
|
});
|
|
7
7
|
return {
|
|
8
|
-
subscribe,
|
|
9
|
-
setLocale: (
|
|
10
|
-
getLocale: () =>
|
|
11
|
-
reset: () =>
|
|
8
|
+
subscribe: t,
|
|
9
|
+
setLocale: (e) => o((l) => ({ ...l, locale: e })),
|
|
10
|
+
getLocale: () => c({ subscribe: t }, (e) => e.locale),
|
|
11
|
+
reset: () => r({ locale: "en" })
|
|
12
12
|
};
|
|
13
|
-
};
|
|
14
|
-
const intlayerStore = createIntlayerStore();
|
|
13
|
+
}, i = n();
|
|
15
14
|
export {
|
|
16
|
-
intlayerStore
|
|
15
|
+
i as intlayerStore
|
|
17
16
|
};
|
|
18
|
-
//# sourceMappingURL=intlayerStore.mjs.map
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { derived } from "svelte/store";
|
|
2
|
-
import { getDictionary } from "../getDictionary.mjs";
|
|
3
|
-
import { getIntlayerContext } from "./intlayerContext.mjs";
|
|
4
|
-
import { intlayerStore } from "./intlayerStore.mjs";
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
return
|
|
8
|
-
const
|
|
9
|
-
return
|
|
1
|
+
import { derived as n } from "svelte/store";
|
|
2
|
+
import { getDictionary as a } from "../getDictionary.mjs";
|
|
3
|
+
import { getIntlayerContext as m } from "./intlayerContext.mjs";
|
|
4
|
+
import { intlayerStore as c } from "./intlayerStore.mjs";
|
|
5
|
+
const y = (t, o) => {
|
|
6
|
+
const r = m();
|
|
7
|
+
return n([c], ([e]) => {
|
|
8
|
+
const i = o ?? (r == null ? void 0 : r.locale) ?? e.locale;
|
|
9
|
+
return a(t, i);
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
|
-
useDictionary
|
|
13
|
+
y as useDictionary
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=useDictionary.mjs.map
|
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getIntlayerContext } from "./intlayerContext.mjs";
|
|
3
|
-
import { intlayerStore } from "./intlayerStore.mjs";
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const loadDictionary = async () => {
|
|
1
|
+
import { writable as s, derived as y } from "svelte/store";
|
|
2
|
+
import { getIntlayerContext as d } from "./intlayerContext.mjs";
|
|
3
|
+
import { intlayerStore as m } from "./intlayerStore.mjs";
|
|
4
|
+
const g = (e, n, a) => {
|
|
5
|
+
const t = d(), r = s(null);
|
|
6
|
+
return y([m], ([i]) => {
|
|
7
|
+
const l = a ?? (t == null ? void 0 : t.locale) ?? i.locale;
|
|
8
|
+
return (async () => {
|
|
10
9
|
try {
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
} else
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} catch (error) {
|
|
10
|
+
const o = e[l];
|
|
11
|
+
if (o) {
|
|
12
|
+
const c = await o();
|
|
13
|
+
r.set(c);
|
|
14
|
+
} else
|
|
15
|
+
r.set(null);
|
|
16
|
+
} catch (o) {
|
|
19
17
|
console.error(
|
|
20
|
-
`Failed to load dictionary for key: ${String(
|
|
21
|
-
|
|
22
|
-
);
|
|
23
|
-
dictionaryStore.set(null);
|
|
18
|
+
`Failed to load dictionary for key: ${String(n)}`,
|
|
19
|
+
o
|
|
20
|
+
), r.set(null);
|
|
24
21
|
}
|
|
25
|
-
};
|
|
26
|
-
loadDictionary();
|
|
27
|
-
return null;
|
|
22
|
+
})(), null;
|
|
28
23
|
});
|
|
29
24
|
};
|
|
30
25
|
export {
|
|
31
|
-
useDictionaryDynamic
|
|
26
|
+
g as useDictionaryDynamic
|
|
32
27
|
};
|
|
33
|
-
//# sourceMappingURL=useDictionaryDynamic.mjs.map
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { derived } from "svelte/store";
|
|
2
|
-
import { getIntlayer } from "../getIntlayer.mjs";
|
|
3
|
-
import { getIntlayerContext } from "./intlayerContext.mjs";
|
|
4
|
-
import { intlayerStore } from "./intlayerStore.mjs";
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
return
|
|
8
|
-
const
|
|
9
|
-
return
|
|
1
|
+
import { derived as n } from "svelte/store";
|
|
2
|
+
import { getIntlayer as a } from "../getIntlayer.mjs";
|
|
3
|
+
import { getIntlayerContext as m } from "./intlayerContext.mjs";
|
|
4
|
+
import { intlayerStore as i } from "./intlayerStore.mjs";
|
|
5
|
+
const y = (t, e) => {
|
|
6
|
+
const r = m();
|
|
7
|
+
return n([i], ([o]) => {
|
|
8
|
+
const l = e ?? (r == null ? void 0 : r.locale) ?? o.locale;
|
|
9
|
+
return a(t, l);
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
|
-
useIntlayer
|
|
13
|
+
y as useIntlayer
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=useIntlayer.mjs.map
|
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getIntlayerContext } from "./intlayerContext.mjs";
|
|
3
|
-
import { intlayerStore } from "./intlayerStore.mjs";
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const loadDictionary = async () => {
|
|
1
|
+
import { writable as i, derived as s } from "svelte/store";
|
|
2
|
+
import { getIntlayerContext as y } from "./intlayerContext.mjs";
|
|
3
|
+
import { intlayerStore as d } from "./intlayerStore.mjs";
|
|
4
|
+
const g = (r, e) => {
|
|
5
|
+
const t = y(), n = i(null);
|
|
6
|
+
return s([d], ([a]) => {
|
|
7
|
+
const c = e ?? (t == null ? void 0 : t.locale) ?? a.locale;
|
|
8
|
+
return (async () => {
|
|
10
9
|
try {
|
|
11
|
-
const { getIntlayerAsync } = await import("@intlayer/core");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} catch (error) {
|
|
10
|
+
const { getIntlayerAsync: o } = await import("@intlayer/core"), l = await o(r, c);
|
|
11
|
+
n.set(l);
|
|
12
|
+
} catch (o) {
|
|
15
13
|
console.error(
|
|
16
|
-
`Failed to load async dictionary for key: ${String(
|
|
17
|
-
|
|
18
|
-
);
|
|
19
|
-
contentStore.set(null);
|
|
14
|
+
`Failed to load async dictionary for key: ${String(r)}`,
|
|
15
|
+
o
|
|
16
|
+
), n.set(null);
|
|
20
17
|
}
|
|
21
|
-
};
|
|
22
|
-
loadDictionary();
|
|
23
|
-
return null;
|
|
18
|
+
})(), null;
|
|
24
19
|
});
|
|
25
20
|
};
|
|
26
21
|
export {
|
|
27
|
-
useIntlayerAsync
|
|
22
|
+
g as useIntlayerAsync
|
|
28
23
|
};
|
|
29
|
-
//# sourceMappingURL=useIntlayerAsync.mjs.map
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import { derived } from "svelte/store";
|
|
2
|
-
import { getIntlayerContext } from "./intlayerContext.mjs";
|
|
3
|
-
import { intlayerStore } from "./intlayerStore.mjs";
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
locale: intlayerStore.getLocale(),
|
|
17
|
-
setLocale: intlayerStore.setLocale
|
|
1
|
+
import { derived as l } from "svelte/store";
|
|
2
|
+
import { getIntlayerContext as r } from "./intlayerContext.mjs";
|
|
3
|
+
import { intlayerStore as o } from "./intlayerStore.mjs";
|
|
4
|
+
const s = () => {
|
|
5
|
+
const e = r();
|
|
6
|
+
return e ? {
|
|
7
|
+
locale: l(
|
|
8
|
+
[o],
|
|
9
|
+
([t]) => e.locale || t.locale
|
|
10
|
+
),
|
|
11
|
+
setLocale: e.setLocale
|
|
12
|
+
} : {
|
|
13
|
+
locale: o.getLocale(),
|
|
14
|
+
setLocale: o.setLocale
|
|
18
15
|
};
|
|
19
16
|
};
|
|
20
17
|
export {
|
|
21
|
-
useLocale
|
|
18
|
+
s as useLocale
|
|
22
19
|
};
|
|
23
|
-
//# sourceMappingURL=useLocale.mjs.map
|
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const getDictionary = (dictionary, locale, additionalPlugins) => {
|
|
10
|
-
const plugins = [
|
|
11
|
-
intlayerNodePlugins,
|
|
12
|
-
svelteNodePlugins,
|
|
13
|
-
markdownPlugin,
|
|
14
|
-
...additionalPlugins ?? []
|
|
1
|
+
import { getDictionary as r } from "@intlayer/core";
|
|
2
|
+
import { intlayerNodePlugins as e, svelteNodePlugins as g, markdownPlugin as s } from "./plugins.mjs";
|
|
3
|
+
const c = (t, i, o) => {
|
|
4
|
+
const n = [
|
|
5
|
+
e,
|
|
6
|
+
g,
|
|
7
|
+
s,
|
|
8
|
+
...o ?? []
|
|
15
9
|
];
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
return r(
|
|
11
|
+
t,
|
|
12
|
+
i,
|
|
13
|
+
n
|
|
20
14
|
);
|
|
21
15
|
};
|
|
22
16
|
export {
|
|
23
|
-
getDictionary
|
|
17
|
+
c as getDictionary
|
|
24
18
|
};
|
|
25
|
-
//# sourceMappingURL=getDictionary.mjs.map
|
package/dist/esm/getIntlayer.mjs
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const getIntlayer = (key, locale, additionalPlugins) => {
|
|
10
|
-
const plugins = [
|
|
11
|
-
intlayerNodePlugins,
|
|
12
|
-
svelteNodePlugins,
|
|
13
|
-
markdownPlugin,
|
|
14
|
-
...additionalPlugins ?? []
|
|
1
|
+
import { getIntlayer as o } from "@intlayer/core";
|
|
2
|
+
import { intlayerNodePlugins as l, svelteNodePlugins as g, markdownPlugin as i } from "./plugins.mjs";
|
|
3
|
+
const m = (t, e, n) => {
|
|
4
|
+
const r = [
|
|
5
|
+
l,
|
|
6
|
+
g,
|
|
7
|
+
i,
|
|
8
|
+
...n ?? []
|
|
15
9
|
];
|
|
16
|
-
return
|
|
10
|
+
return o(t, e, r);
|
|
17
11
|
};
|
|
18
12
|
export {
|
|
19
|
-
getIntlayer
|
|
13
|
+
m as getIntlayer
|
|
20
14
|
};
|
|
21
|
-
//# sourceMappingURL=getIntlayer.mjs.map
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { useDictionary as o } from "./client/useDictionary.mjs";
|
|
2
|
+
import { useDictionaryDynamic as n } from "./client/useDictionaryDynamic.mjs";
|
|
3
|
+
import { useIntlayer as l } from "./client/useIntlayer.mjs";
|
|
4
|
+
import { useIntlayerAsync as x } from "./client/useIntlayerAsync.mjs";
|
|
5
|
+
import { getIntlayerContext as p, setIntlayerContext as s } from "./client/intlayerContext.mjs";
|
|
6
|
+
import { intlayerStore as y } from "./client/intlayerStore.mjs";
|
|
7
|
+
import { getBrowserLocale as c } from "./client/getBrowserLocale.mjs";
|
|
8
|
+
import { useLocale as g } from "./client/useLocale.mjs";
|
|
9
|
+
import { getDictionary as w } from "./getDictionary.mjs";
|
|
10
|
+
import { getIntlayer as k } from "./getIntlayer.mjs";
|
|
11
|
+
import { defaultMarkdownRenderer as C, processMarkdown as L } from "./markdown/index.mjs";
|
|
12
|
+
import { intlayerNodePlugins as N, markdownPlugin as v, svelteNodePlugins as A } from "./plugins.mjs";
|
|
13
|
+
export {
|
|
14
|
+
C as defaultMarkdownRenderer,
|
|
15
|
+
c as getBrowserLocale,
|
|
16
|
+
w as getDictionary,
|
|
17
|
+
k as getIntlayer,
|
|
18
|
+
p as getIntlayerContext,
|
|
19
|
+
N as intlayerNodePlugins,
|
|
20
|
+
y as intlayerStore,
|
|
21
|
+
v as markdownPlugin,
|
|
22
|
+
L as processMarkdown,
|
|
23
|
+
s as setIntlayerContext,
|
|
24
|
+
A as svelteNodePlugins,
|
|
25
|
+
o as useDictionary,
|
|
26
|
+
n as useDictionaryDynamic,
|
|
27
|
+
l as useIntlayer,
|
|
28
|
+
x as useIntlayerAsync,
|
|
29
|
+
g as useLocale
|
|
30
|
+
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
render: processMarkdown,
|
|
6
|
-
configure: (options) => {
|
|
7
|
-
console.log("Configuring markdown renderer with options:", options);
|
|
1
|
+
const e = (r) => r, n = {
|
|
2
|
+
render: e,
|
|
3
|
+
configure: (r) => {
|
|
4
|
+
console.log("Configuring markdown renderer with options:", r);
|
|
8
5
|
}
|
|
9
6
|
};
|
|
10
7
|
export {
|
|
11
|
-
defaultMarkdownRenderer,
|
|
12
|
-
processMarkdown
|
|
8
|
+
n as defaultMarkdownRenderer,
|
|
9
|
+
e as processMarkdown
|
|
13
10
|
};
|
|
14
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e = {
|
|
2
2
|
id: "svelte-node-plugin",
|
|
3
|
-
canHandle: (
|
|
4
|
-
transform: (
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
const intlayerNodePlugins = {
|
|
3
|
+
canHandle: (n) => typeof n == "bigint" || typeof n == "string" || typeof n == "number",
|
|
4
|
+
transform: (n, { children: t, ...r }) => t ?? n
|
|
5
|
+
}, i = {
|
|
9
6
|
id: "intlayer-node-plugin",
|
|
10
|
-
canHandle: (
|
|
11
|
-
transform: (
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const markdownPlugin = {
|
|
7
|
+
canHandle: (n) => typeof n == "bigint" || typeof n == "string" || typeof n == "number",
|
|
8
|
+
transform: (n, { children: t, ...r }) => t ?? n
|
|
9
|
+
}, o = {
|
|
16
10
|
id: "markdown-plugin",
|
|
17
|
-
canHandle: (
|
|
18
|
-
transform: (
|
|
19
|
-
return node;
|
|
20
|
-
}
|
|
11
|
+
canHandle: (n) => typeof n == "string",
|
|
12
|
+
transform: (n, t) => n
|
|
21
13
|
};
|
|
22
14
|
export {
|
|
23
|
-
intlayerNodePlugins,
|
|
24
|
-
markdownPlugin,
|
|
25
|
-
svelteNodePlugins
|
|
15
|
+
i as intlayerNodePlugins,
|
|
16
|
+
o as markdownPlugin,
|
|
17
|
+
e as svelteNodePlugins
|
|
26
18
|
};
|
|
27
|
-
//# sourceMappingURL=plugins.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
import { Readable } from 'svelte/store';
|
|
3
3
|
export interface IntlayerStoreType {
|
|
4
4
|
locale: LocalesValues;
|
|
5
5
|
}
|
|
6
6
|
export declare const intlayerStore: {
|
|
7
|
-
subscribe: (this: void, run: import(
|
|
7
|
+
subscribe: (this: void, run: import('svelte/store').Subscriber<IntlayerStoreType>, invalidate?: () => void) => import('svelte/store').Unsubscriber;
|
|
8
8
|
setLocale: (locale: LocalesValues) => void;
|
|
9
9
|
getLocale: () => Readable<LocalesValues>;
|
|
10
10
|
reset: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
import { Dictionary } from '@intlayer/core';
|
|
3
|
+
import { Readable } from 'svelte/store';
|
|
4
4
|
import { DeepTransformContent } from '../plugins';
|
|
5
5
|
/**
|
|
6
6
|
* Svelte hook that transforms a dictionary and returns reactive content
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
import { Dictionary, DictionaryKeys, LanguageContent } from '@intlayer/core';
|
|
3
|
+
import { Readable } from 'svelte/store';
|
|
4
4
|
/**
|
|
5
5
|
* Svelte hook for handling dynamic dictionary loading
|
|
6
6
|
* @param dictionaryPromise Promise-based dictionary content
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
import { DictionaryKeys } from '@intlayer/core';
|
|
3
|
+
import { Readable } from 'svelte/store';
|
|
4
|
+
import { IntlayerDictionaryTypesConnector } from 'intlayer';
|
|
5
5
|
import { DeepTransformContent } from '../plugins';
|
|
6
6
|
/**
|
|
7
7
|
* Svelte hook that picks one dictionary by its key and returns reactive content
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
import { DictionaryKeys } from '@intlayer/core';
|
|
3
|
+
import { Readable } from 'svelte/store';
|
|
4
|
+
import { IntlayerDictionaryTypesConnector } from 'intlayer';
|
|
5
5
|
import { DeepTransformContent } from '../plugins';
|
|
6
6
|
/**
|
|
7
7
|
* Svelte hook for asynchronous dictionary loading by key
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @returns Readable store with current locale and setter function
|
|
4
4
|
*/
|
|
5
5
|
export declare const useLocale: () => {
|
|
6
|
-
locale: import(
|
|
7
|
-
setLocale: (locale: import(
|
|
6
|
+
locale: import('svelte/store').Readable<import('intlayer').LocalesValues>;
|
|
7
|
+
setLocale: (locale: import('intlayer').LocalesValues) => void;
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=useLocale.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DictionaryKeys, Plugins } from '@intlayer/core';
|
|
2
|
-
import
|
|
2
|
+
import { IntlayerDictionaryTypesConnector, LocalesValues } from 'intlayer';
|
|
3
3
|
import { DeepTransformContent } from './plugins';
|
|
4
4
|
/**
|
|
5
5
|
* Get dictionary content by key for Svelte applications
|