solid-intlayer 8.3.1 → 8.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-C91j1N6u.js +1 -0
- package/dist/cjs/IntlayerNode.cjs +1 -1
- package/dist/cjs/UI/ContentSelector.cjs +1 -1
- package/dist/cjs/client/IntlayerProvider.cjs +1 -1
- package/dist/cjs/client/format/useIntl.cjs +1 -1
- package/dist/cjs/client/getBrowserLocale.cjs +1 -1
- package/dist/cjs/client/index.cjs +1 -1
- package/dist/cjs/client/t.cjs +1 -1
- package/dist/cjs/client/useContent.cjs +1 -1
- package/dist/cjs/client/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/cjs/client/useLoadDynamic.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/client/useLocaleBase.cjs +1 -1
- package/dist/cjs/client/useLocaleStorage.cjs +1 -1
- package/dist/cjs/client/useRewriteURL.cjs +1 -1
- package/dist/cjs/client/useTraduction.cjs +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -1
- package/dist/cjs/editor/IntlayerEditorProvider.cjs +1 -1
- package/dist/cjs/editor/contexts/CommunicatorContext.cjs +1 -1
- package/dist/cjs/editor/contexts/ConfigurationContext.cjs +1 -1
- package/dist/cjs/editor/contexts/DictionariesRecordContext.cjs +1 -1
- package/dist/cjs/editor/contexts/EditedContentContext.cjs +1 -1
- package/dist/cjs/editor/contexts/EditorEnabledContext.cjs +1 -1
- package/dist/cjs/editor/contexts/EditorProvider.cjs +1 -1
- package/dist/cjs/editor/contexts/FocusDictionaryContext.cjs +1 -1
- package/dist/cjs/editor/contexts/index.cjs +1 -1
- package/dist/cjs/editor/contexts/useCrossFrameMessageListener.cjs +1 -1
- package/dist/cjs/editor/contexts/useCrossFrameState.cjs +1 -1
- package/dist/cjs/editor/contexts/useCrossURLPathState.cjs +1 -1
- package/dist/cjs/editor/contexts/useIframeClickInterceptor.cjs +1 -1
- package/dist/cjs/editor/index.cjs +1 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -1
- package/dist/cjs/getDictionary.cjs +1 -1
- package/dist/cjs/getIntlayer.cjs +1 -1
- package/dist/cjs/html/HTMLProvider.cjs +1 -1
- package/dist/cjs/html/HTMLRenderer.cjs +1 -1
- package/dist/cjs/html/index.cjs +1 -1
- package/dist/cjs/html/types.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/markdown/MarkdownProvider.cjs +1 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
- package/dist/cjs/markdown/compiler.cjs +1 -1
- package/dist/cjs/markdown/index.cjs +1 -1
- package/dist/cjs/markdown/runtime.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/cjs/solidElement/renderSolidElement.cjs +1 -1
- package/dist/esm/IntlayerNode.mjs +9 -17
- package/dist/esm/UI/ContentSelector.mjs +57 -56
- package/dist/esm/client/IntlayerProvider.mjs +56 -66
- package/dist/esm/client/format/useIntl.mjs +8 -11
- package/dist/esm/client/getBrowserLocale.mjs +79 -95
- package/dist/esm/client/index.mjs +11 -36
- package/dist/esm/client/t.mjs +9 -9
- package/dist/esm/client/useContent.mjs +12 -12
- package/dist/esm/client/useDictionary.mjs +2 -13
- package/dist/esm/client/useDictionaryAsync.mjs +2 -11
- package/dist/esm/client/useDictionaryDynamic.mjs +2 -15
- package/dist/esm/client/useIntlayer.mjs +2 -13
- package/dist/esm/client/useLoadDynamic.mjs +15 -21
- package/dist/esm/client/useLocale.mjs +23 -36
- package/dist/esm/client/useLocaleBase.mjs +14 -18
- package/dist/esm/client/useLocaleStorage.mjs +18 -25
- package/dist/esm/client/useRewriteURL.mjs +14 -18
- package/dist/esm/client/useTraduction.mjs +9 -12
- package/dist/esm/editor/ContentSelectorWrapper.mjs +2 -24
- package/dist/esm/editor/IntlayerEditorProvider.mjs +36 -58
- package/dist/esm/editor/contexts/CommunicatorContext.mjs +29 -28
- package/dist/esm/editor/contexts/ConfigurationContext.mjs +18 -20
- package/dist/esm/editor/contexts/DictionariesRecordContext.mjs +39 -44
- package/dist/esm/editor/contexts/EditedContentContext.mjs +135 -154
- package/dist/esm/editor/contexts/EditorEnabledContext.mjs +19 -27
- package/dist/esm/editor/contexts/EditorProvider.mjs +68 -80
- package/dist/esm/editor/contexts/FocusDictionaryContext.mjs +41 -47
- package/dist/esm/editor/contexts/index.mjs +11 -38
- package/dist/esm/editor/contexts/useCrossFrameMessageListener.mjs +30 -34
- package/dist/esm/editor/contexts/useCrossFrameState.mjs +44 -56
- package/dist/esm/editor/contexts/useCrossURLPathState.mjs +23 -24
- package/dist/esm/editor/contexts/useIframeClickInterceptor.mjs +17 -18
- package/dist/esm/editor/index.mjs +2 -4
- package/dist/esm/editor/useEditedContentRenderer.mjs +15 -28
- package/dist/esm/getDictionary.mjs +2 -16
- package/dist/esm/getIntlayer.mjs +2 -16
- package/dist/esm/html/HTMLProvider.mjs +12 -15
- package/dist/esm/html/HTMLRenderer.mjs +28 -51
- package/dist/esm/html/index.mjs +3 -10
- package/dist/esm/html/types.mjs +0 -1
- package/dist/esm/index.mjs +17 -54
- package/dist/esm/markdown/MarkdownProvider.mjs +33 -41
- package/dist/esm/markdown/MarkdownRenderer.mjs +36 -41
- package/dist/esm/markdown/compiler.mjs +6 -8
- package/dist/esm/markdown/index.mjs +5 -17
- package/dist/esm/markdown/runtime.mjs +21 -40
- package/dist/esm/plugins.mjs +2 -20
- package/dist/esm/solidElement/renderSolidElement.mjs +32 -29
- package/dist/getDictionary-DKdSGWHu.mjs +188 -0
- package/dist/getDictionary-DxYuk0_0.js +1 -0
- package/dist/types/IntlayerNode.d.ts +1 -2
- package/dist/types/client/useDictionary.d.ts +1 -1
- package/dist/types/getDictionary.d.ts +1 -2
- package/dist/types/getIntlayer.d.ts +1 -2
- package/dist/types/plugins.d.ts +15 -10
- package/package.json +11 -11
- package/dist/plugins-FXnYVZH5.mjs +0 -229
- package/dist/plugins-lDhO98Wy.js +0 -1
|
@@ -1,57 +1,58 @@
|
|
|
1
|
-
import { delegateEvents as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
transition: "all 100ms 50ms ease-in-out"
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}, t), !1, !0), L(e, () => t.children), e;
|
|
52
|
-
})();
|
|
53
|
-
};
|
|
54
|
-
p(["keyup", "click", "mousedown", "mouseup", "touchstart", "touchend"]);
|
|
55
|
-
export {
|
|
56
|
-
x as ContentSelector
|
|
1
|
+
import { delegateEvents as e, insert as t, mergeProps as n, spread as r, template as i, use as a } from "solid-js/web";
|
|
2
|
+
import { createEffect as o, createSignal as s, onCleanup as c } from "solid-js";
|
|
3
|
+
//#region src/UI/ContentSelector.tsx
|
|
4
|
+
var l = /* @__PURE__ */ i("<span role=button tabindex=0>"), u = 250, d = (e) => {
|
|
5
|
+
let i, [d, f] = s(!1), [p, m] = s(e.isSelecting), h = null, g = typeof e.children == "string", _ = () => {
|
|
6
|
+
m(!0), e.onPress();
|
|
7
|
+
}, v = () => {
|
|
8
|
+
h = setTimeout(() => {
|
|
9
|
+
_();
|
|
10
|
+
}, e.pressDuration ?? u);
|
|
11
|
+
}, y = () => {
|
|
12
|
+
h &&= (clearTimeout(h), null);
|
|
13
|
+
}, b = () => {
|
|
14
|
+
y(), v();
|
|
15
|
+
}, x = () => {
|
|
16
|
+
f(!0), e.onHover?.();
|
|
17
|
+
}, S = () => {
|
|
18
|
+
f(!1), y();
|
|
19
|
+
}, C = (t) => {
|
|
20
|
+
i && !i.contains(t.target) && (m(!1), e.onClickOutside?.());
|
|
21
|
+
};
|
|
22
|
+
o(() => {
|
|
23
|
+
document.addEventListener("mousedown", C), c(() => {
|
|
24
|
+
document.removeEventListener("mousedown", C), y();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
let w = (e) => {
|
|
28
|
+
p() && (e.preventDefault(), e.stopPropagation());
|
|
29
|
+
}, T = () => {
|
|
30
|
+
m(!1);
|
|
31
|
+
};
|
|
32
|
+
return (() => {
|
|
33
|
+
var o = l(), s = i;
|
|
34
|
+
return typeof s == "function" ? a(s, o) : i = o, o.addEventListener("mouseenter", x), o.addEventListener("blur", T), o.addEventListener("touchcancel", S), o.$$touchend = S, o.$$touchstart = b, o.addEventListener("mouseleave", S), o.$$mouseup = S, o.$$mousedown = b, o.$$click = w, o.$$keyup = () => null, r(o, n({ get style() {
|
|
35
|
+
return {
|
|
36
|
+
display: g ? "inline" : "inline-block",
|
|
37
|
+
cursor: "pointer",
|
|
38
|
+
"user-select": "none",
|
|
39
|
+
"border-radius": "0.375rem",
|
|
40
|
+
"outline-width": "2px",
|
|
41
|
+
"outline-offset": "4px",
|
|
42
|
+
"outline-style": "solid",
|
|
43
|
+
"outline-color": e.isSelecting || p() || d() ? "inherit" : "transparent",
|
|
44
|
+
transition: "all 100ms 50ms ease-in-out"
|
|
45
|
+
};
|
|
46
|
+
} }, e), !1, !0), t(o, () => e.children), o;
|
|
47
|
+
})();
|
|
57
48
|
};
|
|
49
|
+
e([
|
|
50
|
+
"keyup",
|
|
51
|
+
"click",
|
|
52
|
+
"mousedown",
|
|
53
|
+
"mouseup",
|
|
54
|
+
"touchstart",
|
|
55
|
+
"touchend"
|
|
56
|
+
]);
|
|
57
|
+
//#endregion
|
|
58
|
+
export { d as ContentSelector };
|
|
@@ -1,66 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
get children() {
|
|
58
|
-
return n(x, t);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
export {
|
|
62
|
-
f as IntlayerClientContext,
|
|
63
|
-
p as IntlayerProvider,
|
|
64
|
-
x as IntlayerProviderContent,
|
|
65
|
-
k as useIntlayerContext
|
|
66
|
-
};
|
|
1
|
+
import { IntlayerEditorProvider as e } from "../editor/IntlayerEditorProvider.mjs";
|
|
2
|
+
import { localeCookie as t, setLocaleInStorage as n } from "./useLocaleStorage.mjs";
|
|
3
|
+
import { createComponent as r } from "solid-js/web";
|
|
4
|
+
import i from "@intlayer/config/built";
|
|
5
|
+
import { createContext as a, createEffect as o, createSignal as s, useContext as c } from "solid-js";
|
|
6
|
+
import { localeResolver as l } from "@intlayer/core/localization";
|
|
7
|
+
//#region src/client/IntlayerProvider.tsx
|
|
8
|
+
var u = a({
|
|
9
|
+
locale: () => t ?? i?.internationalization?.defaultLocale,
|
|
10
|
+
setLocale: () => null,
|
|
11
|
+
disableEditor: !1
|
|
12
|
+
}), d = () => c(u), f = (e) => {
|
|
13
|
+
let { internationalization: a } = i ?? {}, { defaultLocale: c, locales: d } = a ?? {}, [f, p] = s(e.locale ?? t ?? e.defaultLocale ?? c);
|
|
14
|
+
o(() => {
|
|
15
|
+
if (typeof window < "u") {
|
|
16
|
+
let e = (e) => {
|
|
17
|
+
if (e.data?.type === "INTLAYER_LOCALE_CHANGE") {
|
|
18
|
+
let t = e.data.locale;
|
|
19
|
+
d?.includes(t) && p(t);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
23
|
+
}
|
|
24
|
+
}), o(() => {
|
|
25
|
+
let e = f();
|
|
26
|
+
typeof window < "u" && window.postMessage({
|
|
27
|
+
type: "INTLAYER_LOCALE_CHANGE",
|
|
28
|
+
locale: e
|
|
29
|
+
}, "*");
|
|
30
|
+
});
|
|
31
|
+
let m = e.setLocale ?? ((t) => {
|
|
32
|
+
if (f().toString() !== t.toString()) {
|
|
33
|
+
if (!d?.map(String).includes(t)) {
|
|
34
|
+
console.error(`Locale ${t} is not available`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
p(t), n(t, e.isCookieEnabled);
|
|
38
|
+
}
|
|
39
|
+
}), h = () => l(e.locale ?? f());
|
|
40
|
+
return r(u.Provider, {
|
|
41
|
+
get value() {
|
|
42
|
+
return {
|
|
43
|
+
locale: h,
|
|
44
|
+
setLocale: m,
|
|
45
|
+
disableEditor: e.disableEditor
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
get children() {
|
|
49
|
+
return e.children;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}, p = (t) => r(e, { get children() {
|
|
53
|
+
return r(f, t);
|
|
54
|
+
} });
|
|
55
|
+
//#endregion
|
|
56
|
+
export { u as IntlayerClientContext, p as IntlayerProvider, f as IntlayerProviderContent, d as useIntlayerContext };
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import { IntlayerClientContext as e } from "../IntlayerProvider.mjs";
|
|
2
|
+
import { createMemo as t, useContext as n } from "solid-js";
|
|
1
3
|
import { bindIntl as r } from "@intlayer/core/formatters";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return c(() => {
|
|
7
|
-
const o = t ?? e.locale();
|
|
8
|
-
return r(o);
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
u as useIntl
|
|
4
|
+
//#region src/client/format/useIntl.ts
|
|
5
|
+
var i = (i) => {
|
|
6
|
+
let a = n(e);
|
|
7
|
+
return t(() => r(i ?? a.locale()));
|
|
13
8
|
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { i as useIntl };
|
|
@@ -1,96 +1,80 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import * as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
internationalization: r
|
|
79
|
-
} = s;
|
|
80
|
-
for (const l of a) {
|
|
81
|
-
const c = o[l];
|
|
82
|
-
if (c && r.locales.includes(c))
|
|
83
|
-
return c;
|
|
84
|
-
}
|
|
85
|
-
return r?.defaultLocale ?? p.ENGLISH;
|
|
86
|
-
}, q = (o = {}) => {
|
|
87
|
-
const a = {
|
|
88
|
-
...h(),
|
|
89
|
-
...o
|
|
90
|
-
}, r = y(a.order ?? [], a);
|
|
91
|
-
return w(r, a.order ?? []);
|
|
92
|
-
};
|
|
93
|
-
export {
|
|
94
|
-
v as LanguageDetector,
|
|
95
|
-
q as getBrowserLocale
|
|
1
|
+
import e from "@intlayer/config/built";
|
|
2
|
+
import { getLocaleFromStorage as t } from "@intlayer/core/utils";
|
|
3
|
+
import { localeDetector as n } from "@intlayer/core/localization";
|
|
4
|
+
import * as r from "@intlayer/types/locales";
|
|
5
|
+
//#region src/client/getBrowserLocale.tsx
|
|
6
|
+
var i = /* @__PURE__ */ function(e) {
|
|
7
|
+
return e.Querystring = "querystring", e.Storage = "storage", e.Navigator = "navigator", e.HtmlTag = "htmlTag", e;
|
|
8
|
+
}({}), a = () => ({
|
|
9
|
+
order: [
|
|
10
|
+
i.Querystring,
|
|
11
|
+
i.Storage,
|
|
12
|
+
i.Navigator,
|
|
13
|
+
i.HtmlTag
|
|
14
|
+
],
|
|
15
|
+
lookupQuerystring: "locale",
|
|
16
|
+
htmlTag: typeof document < "u" ? document.documentElement : null
|
|
17
|
+
}), o = (r, a) => {
|
|
18
|
+
let o = {}, s = () => {
|
|
19
|
+
if (typeof window > "u") return;
|
|
20
|
+
let e = window.location.search || "", t = new URLSearchParams(e).get(a.lookupQuerystring ?? "");
|
|
21
|
+
t && (o[i.Querystring] = t);
|
|
22
|
+
}, c = () => {
|
|
23
|
+
if (typeof window > "u") return;
|
|
24
|
+
let e = t({
|
|
25
|
+
getCookie: (e) => {
|
|
26
|
+
try {
|
|
27
|
+
let t = document.cookie.split(";"), n = `${e}=`, r = t.find((e) => e.trim().startsWith(n));
|
|
28
|
+
if (r) return r.split("=")[1].trim();
|
|
29
|
+
} catch {}
|
|
30
|
+
},
|
|
31
|
+
getSessionStorage: (e) => {
|
|
32
|
+
try {
|
|
33
|
+
return window.sessionStorage.getItem(e) ?? void 0;
|
|
34
|
+
} catch {}
|
|
35
|
+
},
|
|
36
|
+
getLocaleStorage: (e) => {
|
|
37
|
+
try {
|
|
38
|
+
return window.localStorage.getItem(e) ?? void 0;
|
|
39
|
+
} catch {}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
e && (o[i.Storage] = e);
|
|
43
|
+
}, l = () => {
|
|
44
|
+
if (typeof navigator > "u") return;
|
|
45
|
+
let { internationalization: t } = e, r = navigator.languages ?? [navigator.language], a = n({ "accept-language": r.join(",") }, t.locales, t.defaultLocale);
|
|
46
|
+
a && (o[i.Navigator] = a);
|
|
47
|
+
}, u = () => {
|
|
48
|
+
let t = a.htmlTag;
|
|
49
|
+
if (t && typeof t.getAttribute == "function") {
|
|
50
|
+
let r = t.getAttribute("lang");
|
|
51
|
+
if (r) {
|
|
52
|
+
let { internationalization: t } = e, a = n({ "accept-language": r }, t.locales, t.defaultLocale);
|
|
53
|
+
o[i.HtmlTag] = a;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, d = {
|
|
57
|
+
[i.Querystring]: s,
|
|
58
|
+
[i.Storage]: c,
|
|
59
|
+
[i.Navigator]: l,
|
|
60
|
+
[i.HtmlTag]: u
|
|
61
|
+
};
|
|
62
|
+
return r.forEach((e) => {
|
|
63
|
+
d[e]?.();
|
|
64
|
+
}), o;
|
|
65
|
+
}, s = (t, n) => {
|
|
66
|
+
let { internationalization: i } = e;
|
|
67
|
+
for (let e of n) {
|
|
68
|
+
let n = t[e];
|
|
69
|
+
if (n && i.locales.includes(n)) return n;
|
|
70
|
+
}
|
|
71
|
+
return i?.defaultLocale ?? r.ENGLISH;
|
|
72
|
+
}, c = (e = {}) => {
|
|
73
|
+
let t = {
|
|
74
|
+
...a(),
|
|
75
|
+
...e
|
|
76
|
+
};
|
|
77
|
+
return s(o(t.order ?? [], t), t.order ?? []);
|
|
96
78
|
};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { i as LanguageDetector, c as getBrowserLocale };
|
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import { localeCookie as P, localeInStorage as R, setLocaleCookie as A, setLocaleInStorage as U, useLocaleCookie as b, useLocaleStorage as h } from "./useLocaleStorage.mjs";
|
|
13
|
-
import { useRewriteURL as q } from "./useRewriteURL.mjs";
|
|
14
|
-
export {
|
|
15
|
-
l as IntlayerClientContext,
|
|
16
|
-
s as IntlayerProvider,
|
|
17
|
-
c as IntlayerProviderContent,
|
|
18
|
-
a as getBrowserLocale,
|
|
19
|
-
P as localeCookie,
|
|
20
|
-
R as localeInStorage,
|
|
21
|
-
A as setLocaleCookie,
|
|
22
|
-
U as setLocaleInStorage,
|
|
23
|
-
x as t,
|
|
24
|
-
p as useDictionary,
|
|
25
|
-
y as useDictionaryAsync,
|
|
26
|
-
I as useDictionaryDynamic,
|
|
27
|
-
r as useIntl,
|
|
28
|
-
D as useIntlayer,
|
|
29
|
-
i as useIntlayerContext,
|
|
30
|
-
d as useLoadDynamic,
|
|
31
|
-
S as useLocale,
|
|
32
|
-
w as useLocaleBase,
|
|
33
|
-
b as useLocaleCookie,
|
|
34
|
-
h as useLocaleStorage,
|
|
35
|
-
q as useRewriteURL
|
|
36
|
-
};
|
|
1
|
+
import { localeCookie as e, localeInStorage as t, setLocaleCookie as n, setLocaleInStorage as r, useLocaleCookie as i, useLocaleStorage as a } from "./useLocaleStorage.mjs";
|
|
2
|
+
import { IntlayerClientContext as o, IntlayerProvider as s, IntlayerProviderContent as c, useIntlayerContext as l } from "./IntlayerProvider.mjs";
|
|
3
|
+
import { useIntl as u } from "./format/useIntl.mjs";
|
|
4
|
+
import { getBrowserLocale as d } from "./getBrowserLocale.mjs";
|
|
5
|
+
import { t as f } from "./t.mjs";
|
|
6
|
+
import { f as p, m, p as h, u as g } from "../../getDictionary-DKdSGWHu.mjs";
|
|
7
|
+
import { useLoadDynamic as _ } from "./useLoadDynamic.mjs";
|
|
8
|
+
import { useLocale as v } from "./useLocale.mjs";
|
|
9
|
+
import { useLocaleBase as y } from "./useLocaleBase.mjs";
|
|
10
|
+
import { useRewriteURL as b } from "./useRewriteURL.mjs";
|
|
11
|
+
export { o as IntlayerClientContext, s as IntlayerProvider, c as IntlayerProviderContent, d as getBrowserLocale, e as localeCookie, t as localeInStorage, n as setLocaleCookie, r as setLocaleInStorage, f as t, m as useDictionary, h as useDictionaryAsync, p as useDictionaryDynamic, u as useIntl, g as useIntlayer, l as useIntlayerContext, _ as useLoadDynamic, v as useLocale, y as useLocaleBase, i as useLocaleCookie, a as useLocaleStorage, b as useRewriteURL };
|
package/dist/esm/client/t.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
f as t
|
|
1
|
+
import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
|
|
2
|
+
import { getTranslation as t } from "@intlayer/core/interpreter";
|
|
3
|
+
import { useContext as n } from "solid-js";
|
|
4
|
+
//#region src/client/t.ts
|
|
5
|
+
var r = (r, i) => {
|
|
6
|
+
let { locale: a } = n(e);
|
|
7
|
+
return t(r, i ?? (typeof a == "function" ? a() : a));
|
|
10
8
|
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { r as t };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useLocaleBase as
|
|
2
|
-
import { useTranslation as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
a as useContent
|
|
1
|
+
import { useLocaleBase as e } from "./useLocaleBase.mjs";
|
|
2
|
+
import { useTranslation as t } from "./useTraduction.mjs";
|
|
3
|
+
//#region src/client/useContent.ts
|
|
4
|
+
var n = (n) => {
|
|
5
|
+
let { locale: r } = e();
|
|
6
|
+
return {
|
|
7
|
+
locale: r,
|
|
8
|
+
content: t(n),
|
|
9
|
+
t
|
|
10
|
+
};
|
|
13
11
|
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as useContent };
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { IntlayerClientContext as a } from "./IntlayerProvider.mjs";
|
|
4
|
-
const p = (t, o) => {
|
|
5
|
-
const e = n(a);
|
|
6
|
-
return c(() => {
|
|
7
|
-
const r = o ?? e?.locale?.();
|
|
8
|
-
return i(t, r);
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
p as useDictionary
|
|
13
|
-
};
|
|
1
|
+
import { m as e } from "../../getDictionary-DKdSGWHu.mjs";
|
|
2
|
+
export { e as useDictionary };
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { IntlayerClientContext as l } from "./IntlayerProvider.mjs";
|
|
4
|
-
import { useDictionary as s } from "./useDictionary.mjs";
|
|
5
|
-
const p = async (o, n) => {
|
|
6
|
-
const { locale: r } = c(l), a = i?.internationalization.defaultLocale, t = n ?? r() ?? a, e = await o[t]?.();
|
|
7
|
-
return s(e, t);
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
p as useDictionaryAsync
|
|
11
|
-
};
|
|
1
|
+
import { p as e } from "../../getDictionary-DKdSGWHu.mjs";
|
|
2
|
+
export { e as useDictionaryAsync };
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { IntlayerClientContext as m } from "./IntlayerProvider.mjs";
|
|
4
|
-
import { useDictionary as s } from "./useDictionary.mjs";
|
|
5
|
-
import { useLoadDynamic as u } from "./useLoadDynamic.mjs";
|
|
6
|
-
const L = (t, n, r) => {
|
|
7
|
-
const { locale: i } = l(m) ?? {}, e = c?.internationalization.defaultLocale, o = r ?? i?.() ?? e, a = u(
|
|
8
|
-
`${String(n)}.${o}`,
|
|
9
|
-
t[o]?.()
|
|
10
|
-
);
|
|
11
|
-
return s(a, o);
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
L as useDictionaryDynamic
|
|
15
|
-
};
|
|
1
|
+
import { f as e } from "../../getDictionary-DKdSGWHu.mjs";
|
|
2
|
+
export { e as useDictionaryDynamic };
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { IntlayerClientContext as a } from "./IntlayerProvider.mjs";
|
|
4
|
-
const p = (t, e) => {
|
|
5
|
-
const o = n(a);
|
|
6
|
-
return c(() => {
|
|
7
|
-
const r = o?.locale();
|
|
8
|
-
return l(t, e ?? r);
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
p as useIntlayer
|
|
13
|
-
};
|
|
1
|
+
import { u as e } from "../../getDictionary-DKdSGWHu.mjs";
|
|
2
|
+
export { e as useIntlayer };
|