solid-intlayer 6.1.6-canary.0 → 7.0.0-canary.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/cjs/client/IntlayerProvider.cjs +1 -1
- package/dist/cjs/client/getBrowserLocale.cjs +1 -1
- package/dist/cjs/client/index.cjs +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/client/useLocaleStorage.cjs +1 -0
- package/dist/cjs/client/useTraduction.cjs +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -1
- package/dist/cjs/editor/contexts/CommunicatorContext.cjs +1 -1
- package/dist/cjs/editor/contexts/EditedContentContext.cjs +1 -1
- package/dist/cjs/editor/contexts/useCrossFrameMessageListener.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/cjs/solidElement/renderSolidElement.cjs +1 -1
- package/dist/esm/client/IntlayerProvider.mjs +9 -9
- package/dist/esm/client/getBrowserLocale.mjs +80 -84
- package/dist/esm/client/index.mjs +21 -18
- package/dist/esm/client/useDictionaryAsync.mjs +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs +2 -2
- package/dist/esm/client/useLocale.mjs +19 -13
- package/dist/esm/client/useLocaleStorage.mjs +25 -0
- package/dist/esm/client/useTraduction.mjs +10 -6
- package/dist/esm/editor/ContentSelectorWrapper.mjs +2 -2
- package/dist/esm/editor/contexts/CommunicatorContext.mjs +10 -10
- package/dist/esm/editor/contexts/EditedContentContext.mjs +92 -83
- package/dist/esm/editor/contexts/useCrossFrameMessageListener.mjs +8 -8
- package/dist/esm/getDictionary.mjs +1 -5
- package/dist/esm/index.mjs +26 -23
- package/dist/esm/plugins.mjs +25 -24
- package/dist/esm/solidElement/renderSolidElement.mjs +1 -1
- package/dist/types/IntlayerNode.d.ts +0 -1
- package/dist/types/UI/ContentSelector.d.ts +0 -1
- package/dist/types/client/IntlayerProvider.d.ts +3 -2
- package/dist/types/client/getBrowserLocale.d.ts +16 -12
- package/dist/types/client/index.d.ts +2 -3
- package/dist/types/client/t.d.ts +2 -4
- package/dist/types/client/useContent.d.ts +4 -5
- package/dist/types/client/useDictionary.d.ts +4 -4
- package/dist/types/client/useDictionaryAsync.d.ts +2 -4
- package/dist/types/client/useDictionaryDynamic.d.ts +2 -4
- package/dist/types/client/useIntlayer.d.ts +3 -5
- package/dist/types/client/useLoadDynamic.d.ts +0 -1
- package/dist/types/client/useLocale.d.ts +9 -8
- package/dist/types/client/useLocaleBase.d.ts +9 -7
- package/dist/types/client/useLocaleStorage.d.ts +39 -0
- package/dist/types/client/useTraduction.d.ts +2 -3
- package/dist/types/editor/ContentSelectorWrapper.d.ts +0 -1
- package/dist/types/editor/IntlayerEditorProvider.d.ts +0 -1
- package/dist/types/editor/contexts/CommunicatorContext.d.ts +0 -1
- package/dist/types/editor/contexts/ConfigurationContext.d.ts +1 -2
- package/dist/types/editor/contexts/DictionariesRecordContext.d.ts +1 -2
- package/dist/types/editor/contexts/EditedContentContext.d.ts +3 -4
- package/dist/types/editor/contexts/EditorEnabledContext.d.ts +0 -1
- package/dist/types/editor/contexts/EditorProvider.d.ts +0 -1
- package/dist/types/editor/contexts/FocusDictionaryContext.d.ts +1 -2
- package/dist/types/editor/contexts/index.d.ts +0 -1
- package/dist/types/editor/contexts/useCrossFrameMessageListener.d.ts +1 -2
- package/dist/types/editor/contexts/useCrossFrameState.d.ts +0 -1
- package/dist/types/editor/contexts/useCrossURLPathState.d.ts +0 -1
- package/dist/types/editor/contexts/useIframeClickInterceptor.d.ts +0 -1
- package/dist/types/editor/index.d.ts +0 -1
- package/dist/types/editor/useEditedContentRenderer.d.ts +2 -4
- package/dist/types/getDictionary.d.ts +3 -4
- package/dist/types/getIntlayer.d.ts +3 -4
- package/dist/types/index.d.ts +3 -4
- package/dist/types/markdown/MarkdownProvider.d.ts +1 -2
- package/dist/types/markdown/MarkdownRenderer.d.ts +1 -3
- package/dist/types/markdown/index.d.ts +0 -1
- package/dist/types/plugins.d.ts +3 -3
- package/dist/types/solidElement/renderSolidElement.d.ts +0 -1
- package/package.json +44 -46
- package/LICENSE +0 -202
- package/dist/cjs/client/useLocaleCookie.cjs +0 -1
- package/dist/esm/client/useLocaleCookie.mjs +0 -19
- package/dist/types/IntlayerNode.d.ts.map +0 -1
- package/dist/types/UI/ContentSelector.d.ts.map +0 -1
- package/dist/types/client/IntlayerProvider.d.ts.map +0 -1
- package/dist/types/client/getBrowserLocale.d.ts.map +0 -1
- package/dist/types/client/index.d.ts.map +0 -1
- package/dist/types/client/t.d.ts.map +0 -1
- package/dist/types/client/useContent.d.ts.map +0 -1
- package/dist/types/client/useDictionary.d.ts.map +0 -1
- package/dist/types/client/useDictionaryAsync.d.ts.map +0 -1
- package/dist/types/client/useDictionaryDynamic.d.ts.map +0 -1
- package/dist/types/client/useIntlayer.d.ts.map +0 -1
- package/dist/types/client/useLoadDynamic.d.ts.map +0 -1
- package/dist/types/client/useLocale.d.ts.map +0 -1
- package/dist/types/client/useLocaleBase.d.ts.map +0 -1
- package/dist/types/client/useLocaleCookie.d.ts +0 -17
- package/dist/types/client/useLocaleCookie.d.ts.map +0 -1
- package/dist/types/client/useTraduction.d.ts.map +0 -1
- package/dist/types/editor/ContentSelectorWrapper.d.ts.map +0 -1
- package/dist/types/editor/IntlayerEditorProvider.d.ts.map +0 -1
- package/dist/types/editor/contexts/CommunicatorContext.d.ts.map +0 -1
- package/dist/types/editor/contexts/ConfigurationContext.d.ts.map +0 -1
- package/dist/types/editor/contexts/DictionariesRecordContext.d.ts.map +0 -1
- package/dist/types/editor/contexts/EditedContentContext.d.ts.map +0 -1
- package/dist/types/editor/contexts/EditorEnabledContext.d.ts.map +0 -1
- package/dist/types/editor/contexts/EditorProvider.d.ts.map +0 -1
- package/dist/types/editor/contexts/FocusDictionaryContext.d.ts.map +0 -1
- package/dist/types/editor/contexts/index.d.ts.map +0 -1
- package/dist/types/editor/contexts/useCrossFrameMessageListener.d.ts.map +0 -1
- package/dist/types/editor/contexts/useCrossFrameState.d.ts.map +0 -1
- package/dist/types/editor/contexts/useCrossURLPathState.d.ts.map +0 -1
- package/dist/types/editor/contexts/useIframeClickInterceptor.d.ts.map +0 -1
- package/dist/types/editor/index.d.ts.map +0 -1
- package/dist/types/editor/useEditedContentRenderer.d.ts.map +0 -1
- package/dist/types/getDictionary.d.ts.map +0 -1
- package/dist/types/getIntlayer.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/markdown/MarkdownProvider.d.ts.map +0 -1
- package/dist/types/markdown/MarkdownRenderer.d.ts.map +0 -1
- package/dist/types/markdown/index.d.ts.map +0 -1
- package/dist/types/plugins.d.ts.map +0 -1
- package/dist/types/solidElement/renderSolidElement.d.ts.map +0 -1
|
@@ -1,143 +1,152 @@
|
|
|
1
|
-
import { getContentNodeByKeyPath as
|
|
2
|
-
import { MessageKey as
|
|
1
|
+
import { getContentNodeByKeyPath as E, renameContentNodeByKeyPath as k, editDictionaryByKeyPath as B } from "@intlayer/core";
|
|
2
|
+
import { MessageKey as m } from "@intlayer/editor";
|
|
3
3
|
import { createContext as h, useContext as T, createComponent as g } from "solid-js";
|
|
4
4
|
import { useDictionariesRecord as H } from "./DictionariesRecordContext.mjs";
|
|
5
5
|
import { useCrossFrameMessageListener as _ } from "./useCrossFrameMessageListener.mjs";
|
|
6
|
-
import { useCrossFrameState as
|
|
7
|
-
const x = h(void 0), J = (
|
|
6
|
+
import { useCrossFrameState as W } from "./useCrossFrameState.mjs";
|
|
7
|
+
const x = h(void 0), J = (C) => _(`${m.INTLAYER_EDITED_CONTENT_CHANGED}/post`, C), Q = (C) => _(`${m.INTLAYER_EDITED_CONTENT_CHANGED}/get`, C), A = h(void 0), U = (C) => {
|
|
8
8
|
const {
|
|
9
|
-
localeDictionaries:
|
|
10
|
-
} = H(), [
|
|
9
|
+
localeDictionaries: u
|
|
10
|
+
} = H(), [N, c] = W(m.INTLAYER_EDITED_CONTENT_CHANGED), p = (t) => {
|
|
11
11
|
if (typeof t == "function")
|
|
12
|
-
|
|
13
|
-
const
|
|
12
|
+
c((n) => {
|
|
13
|
+
const e = n?.[Object.keys(n || {})[0]], s = t(e);
|
|
14
14
|
return {
|
|
15
|
-
...
|
|
16
|
-
[
|
|
15
|
+
...n,
|
|
16
|
+
[s.key]: s
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
else {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
...
|
|
23
|
-
[
|
|
20
|
+
const n = t;
|
|
21
|
+
c((e) => ({
|
|
22
|
+
...e,
|
|
23
|
+
[n.key]: n
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
...
|
|
26
|
+
}, I = (t, n) => {
|
|
27
|
+
c((e) => ({
|
|
28
|
+
...e,
|
|
29
29
|
[t]: {
|
|
30
|
-
...
|
|
31
|
-
content:
|
|
30
|
+
...e?.[t],
|
|
31
|
+
content: n
|
|
32
32
|
}
|
|
33
33
|
}));
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
let
|
|
38
|
-
if (!
|
|
39
|
-
let
|
|
40
|
-
const
|
|
41
|
-
let
|
|
42
|
-
for (; typeof
|
|
43
|
-
|
|
44
|
-
...
|
|
45
|
-
key:
|
|
34
|
+
}, P = (t, n, e = [], s = !0) => {
|
|
35
|
+
c((i) => {
|
|
36
|
+
const o = u[t]?.content, d = structuredClone(i?.[t]?.content ?? o);
|
|
37
|
+
let r = e;
|
|
38
|
+
if (!s) {
|
|
39
|
+
let f = 0;
|
|
40
|
+
const j = e.slice(0, -1), l = e[e.length - 1];
|
|
41
|
+
let D = l.key;
|
|
42
|
+
for (; typeof E(d, r) < "u"; )
|
|
43
|
+
f++, D = f === 0 ? l.key : `${l.key} (${f})`, r = [...j, {
|
|
44
|
+
...l,
|
|
45
|
+
key: D
|
|
46
46
|
}];
|
|
47
47
|
}
|
|
48
|
-
const
|
|
48
|
+
const a = B(d, r, n);
|
|
49
49
|
return {
|
|
50
|
-
...
|
|
50
|
+
...i,
|
|
51
51
|
[t]: {
|
|
52
|
-
...
|
|
53
|
-
content:
|
|
52
|
+
...i?.[t],
|
|
53
|
+
content: a
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
});
|
|
57
|
-
}, w = (t,
|
|
58
|
-
|
|
59
|
-
const
|
|
57
|
+
}, w = (t, n, e = []) => {
|
|
58
|
+
c((s) => {
|
|
59
|
+
const i = u[t]?.content, o = structuredClone(s?.[t]?.content ?? i), d = k(o, n, e);
|
|
60
60
|
return {
|
|
61
|
-
...
|
|
61
|
+
...s,
|
|
62
62
|
[t]: {
|
|
63
|
-
...
|
|
64
|
-
content:
|
|
63
|
+
...s?.[t],
|
|
64
|
+
content: d
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
67
|
});
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
const
|
|
73
|
-
|
|
68
|
+
}, L = (t, n) => {
|
|
69
|
+
c((e) => {
|
|
70
|
+
const s = u[t]?.content, i = structuredClone(e?.[t]?.content ?? s), o = structuredClone(i), d = n.slice(0, -1), r = n[n.length - 1]?.key;
|
|
71
|
+
if (r) {
|
|
72
|
+
const a = E(o, d);
|
|
73
|
+
a && typeof a == "object" && r in a && delete a[r];
|
|
74
74
|
}
|
|
75
75
|
return {
|
|
76
|
-
...
|
|
76
|
+
...e,
|
|
77
77
|
[t]: {
|
|
78
|
-
...
|
|
79
|
-
content:
|
|
78
|
+
...e?.[t],
|
|
79
|
+
content: o
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
});
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
...
|
|
83
|
+
}, S = (t) => {
|
|
84
|
+
c((n) => {
|
|
85
|
+
const e = {
|
|
86
|
+
...n
|
|
87
87
|
};
|
|
88
|
-
return delete
|
|
88
|
+
return delete e[t], e;
|
|
89
89
|
});
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
...
|
|
90
|
+
}, $ = (t) => {
|
|
91
|
+
c((n) => ({
|
|
92
|
+
...n,
|
|
93
93
|
[t]: {
|
|
94
|
-
...
|
|
94
|
+
...n?.[t],
|
|
95
95
|
content: {}
|
|
96
96
|
}
|
|
97
97
|
}));
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
},
|
|
101
|
-
const
|
|
102
|
-
|
|
98
|
+
}, b = () => {
|
|
99
|
+
c({});
|
|
100
|
+
}, F = (t, n) => {
|
|
101
|
+
const e = N();
|
|
102
|
+
if (!e) return;
|
|
103
|
+
if (t.includes(":local:") || t.includes(":remote:")) {
|
|
104
|
+
const o = e?.[t]?.content ?? {};
|
|
105
|
+
return E(o, n);
|
|
106
|
+
}
|
|
107
|
+
const i = Object.keys(e).filter((o) => o.startsWith(`${t}:`));
|
|
108
|
+
for (const o of i) {
|
|
109
|
+
const d = e?.[o]?.content ?? {}, r = E(d, n);
|
|
110
|
+
if (r) return r;
|
|
111
|
+
}
|
|
112
|
+
}, G = {
|
|
113
|
+
editedContent: N()
|
|
103
114
|
}, R = {
|
|
104
|
-
|
|
105
|
-
}, $ = {
|
|
106
|
-
setEditedContentState: s,
|
|
115
|
+
setEditedContentState: c,
|
|
107
116
|
setEditedDictionary: p,
|
|
108
|
-
setEditedContent:
|
|
109
|
-
addEditedContent:
|
|
117
|
+
setEditedContent: I,
|
|
118
|
+
addEditedContent: P,
|
|
110
119
|
renameEditedContent: w,
|
|
111
|
-
removeEditedContent:
|
|
112
|
-
restoreEditedContent:
|
|
113
|
-
clearEditedDictionaryContent:
|
|
114
|
-
clearEditedContent:
|
|
115
|
-
getEditedContentValue:
|
|
120
|
+
removeEditedContent: L,
|
|
121
|
+
restoreEditedContent: S,
|
|
122
|
+
clearEditedDictionaryContent: $,
|
|
123
|
+
clearEditedContent: b,
|
|
124
|
+
getEditedContentValue: F
|
|
116
125
|
};
|
|
117
126
|
return g(x.Provider, {
|
|
118
|
-
value:
|
|
127
|
+
value: G,
|
|
119
128
|
get children() {
|
|
120
129
|
return g(A.Provider, {
|
|
121
|
-
value:
|
|
130
|
+
value: R,
|
|
122
131
|
get children() {
|
|
123
|
-
return
|
|
132
|
+
return C.children;
|
|
124
133
|
}
|
|
125
134
|
});
|
|
126
135
|
}
|
|
127
136
|
});
|
|
128
|
-
},
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
137
|
+
}, Y = () => T(A), X = () => {
|
|
138
|
+
const C = Y(), u = T(x);
|
|
139
|
+
if (!u)
|
|
131
140
|
throw new Error("useEditedContent must be used within a EditedContentProvider");
|
|
132
141
|
return {
|
|
133
|
-
...
|
|
134
|
-
...
|
|
142
|
+
...u,
|
|
143
|
+
...C
|
|
135
144
|
};
|
|
136
145
|
};
|
|
137
146
|
export {
|
|
138
147
|
U as EditedContentProvider,
|
|
139
148
|
X as useEditedContent,
|
|
140
|
-
|
|
149
|
+
Y as useEditedContentActions,
|
|
141
150
|
Q as useGetEditedContentState,
|
|
142
151
|
J as usePostEditedContentState
|
|
143
152
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { compareUrls as c } from "@intlayer/editor";
|
|
2
2
|
import { onMount as f, onCleanup as g } from "solid-js";
|
|
3
3
|
import { useCommunicator as w } from "./CommunicatorContext.mjs";
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
4
|
+
const h = (r, o) => {
|
|
5
|
+
const n = w();
|
|
6
|
+
if (!n)
|
|
7
7
|
throw new Error("useCrossFrameMessageListener must be used within a CommunicatorProvider");
|
|
8
8
|
const {
|
|
9
9
|
allowedOrigins: s,
|
|
10
10
|
postMessage: i,
|
|
11
|
-
senderId:
|
|
12
|
-
} =
|
|
11
|
+
senderId: t
|
|
12
|
+
} = n;
|
|
13
13
|
return f(() => {
|
|
14
14
|
if (o) {
|
|
15
15
|
const e = (a) => {
|
|
@@ -18,7 +18,7 @@ const v = (r, o, l) => {
|
|
|
18
18
|
data: d,
|
|
19
19
|
senderId: p
|
|
20
20
|
} = a.data;
|
|
21
|
-
m === r && p !==
|
|
21
|
+
m === r && p !== t && (typeof s > "u" || s?.some((u) => c(u, a.origin)) || s?.includes("*")) && o(d);
|
|
22
22
|
};
|
|
23
23
|
window.addEventListener("message", e), g(() => window.removeEventListener("message", e));
|
|
24
24
|
}
|
|
@@ -26,10 +26,10 @@ const v = (r, o, l) => {
|
|
|
26
26
|
i({
|
|
27
27
|
type: r,
|
|
28
28
|
data: e,
|
|
29
|
-
senderId:
|
|
29
|
+
senderId: t
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
export {
|
|
34
|
-
|
|
34
|
+
h as useCrossFrameMessageListener
|
|
35
35
|
};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { getBrowserLocale as s } from "./client/getBrowserLocale.mjs";
|
|
2
|
-
import { IntlayerClientContext as f, IntlayerProvider as y, IntlayerProviderContent as u, useIntlayerContext as
|
|
3
|
-
import { t as
|
|
4
|
-
import { useDictionary as
|
|
5
|
-
import { useDictionaryAsync as
|
|
6
|
-
import { useDictionaryDynamic as
|
|
7
|
-
import { useIntlayer as
|
|
8
|
-
import { useLoadDynamic as
|
|
9
|
-
import { useLocale as
|
|
10
|
-
import { useLocaleBase as
|
|
11
|
-
import { localeCookie as E, setLocaleCookie as F,
|
|
12
|
-
import { MarkdownProvider as
|
|
2
|
+
import { IntlayerClientContext as f, IntlayerProvider as y, IntlayerProviderContent as u, useIntlayerContext as L } from "./client/IntlayerProvider.mjs";
|
|
3
|
+
import { t as I } from "./client/t.mjs";
|
|
4
|
+
import { useDictionary as D } from "./client/useDictionary.mjs";
|
|
5
|
+
import { useDictionaryAsync as k } from "./client/useDictionaryAsync.mjs";
|
|
6
|
+
import { useDictionaryDynamic as P } from "./client/useDictionaryDynamic.mjs";
|
|
7
|
+
import { useIntlayer as w } from "./client/useIntlayer.mjs";
|
|
8
|
+
import { useLoadDynamic as A } from "./client/useLoadDynamic.mjs";
|
|
9
|
+
import { useLocale as b } from "./client/useLocale.mjs";
|
|
10
|
+
import { useLocaleBase as j } from "./client/useLocaleBase.mjs";
|
|
11
|
+
import { localeCookie as z, localeInStorage as E, setLocaleCookie as F, setLocaleInStorage as G, useLocaleCookie as H, useLocaleStorage as J } from "./client/useLocaleStorage.mjs";
|
|
12
|
+
import { MarkdownProvider as N } from "./markdown/MarkdownProvider.mjs";
|
|
13
13
|
import "@intlayer/core";
|
|
14
14
|
import "@intlayer/editor";
|
|
15
15
|
import "./editor/contexts/ConfigurationContext.mjs";
|
|
@@ -23,18 +23,21 @@ export {
|
|
|
23
23
|
f as IntlayerClientContext,
|
|
24
24
|
y as IntlayerProvider,
|
|
25
25
|
u as IntlayerProviderContent,
|
|
26
|
-
|
|
26
|
+
N as MarkdownProvider,
|
|
27
27
|
s as getBrowserLocale,
|
|
28
|
-
|
|
28
|
+
z as localeCookie,
|
|
29
|
+
E as localeInStorage,
|
|
29
30
|
F as setLocaleCookie,
|
|
30
|
-
|
|
31
|
-
I as
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
G as setLocaleInStorage,
|
|
32
|
+
I as t,
|
|
33
|
+
D as useDictionary,
|
|
34
|
+
k as useDictionaryAsync,
|
|
35
|
+
P as useDictionaryDynamic,
|
|
36
|
+
w as useIntlayer,
|
|
37
|
+
L as useIntlayerContext,
|
|
38
|
+
A as useLoadDynamic,
|
|
39
|
+
b as useLocale,
|
|
40
|
+
j as useLocaleBase,
|
|
41
|
+
H as useLocaleCookie,
|
|
42
|
+
J as useLocaleStorage
|
|
40
43
|
};
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { getMarkdownMetadata as p
|
|
2
|
-
import {
|
|
3
|
-
import { ContentSelectorRenderer as
|
|
1
|
+
import { getMarkdownMetadata as p } from "@intlayer/core";
|
|
2
|
+
import { NodeType as u } from "@intlayer/types";
|
|
3
|
+
import { ContentSelectorRenderer as d } from "./editor/ContentSelectorWrapper.mjs";
|
|
4
4
|
import { EditedContentRenderer as y } from "./editor/useEditedContentRenderer.mjs";
|
|
5
|
+
import { renderIntlayerNode as l } from "./IntlayerNode.mjs";
|
|
5
6
|
import "./markdown/MarkdownProvider.mjs";
|
|
6
7
|
import { MarkdownRenderer as f, MarkdownMetadataRenderer as h } from "./markdown/MarkdownRenderer.mjs";
|
|
7
8
|
import { renderSolidElement as k } from "./solidElement/renderSolidElement.mjs";
|
|
8
9
|
import { createComponent as o, mergeProps as i } from "solid-js";
|
|
9
|
-
const
|
|
10
|
+
const E = {
|
|
10
11
|
id: "intlayer-node-plugin",
|
|
11
12
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
12
13
|
transform: (e, {
|
|
13
14
|
plugins: t,
|
|
14
15
|
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
15
16
|
...n
|
|
16
|
-
}) =>
|
|
17
|
+
}) => l({
|
|
17
18
|
...n,
|
|
18
19
|
value: n.children,
|
|
19
|
-
children: o(
|
|
20
|
+
children: o(d, i(n, {
|
|
20
21
|
get children() {
|
|
21
22
|
return o(y, i(n, {
|
|
22
23
|
get children() {
|
|
@@ -26,17 +27,17 @@ const C = {
|
|
|
26
27
|
}
|
|
27
28
|
}))
|
|
28
29
|
})
|
|
29
|
-
},
|
|
30
|
+
}, j = {
|
|
30
31
|
id: "solid-node-plugin",
|
|
31
32
|
canHandle: (e) => typeof e == "object" && typeof e.props < "u",
|
|
32
33
|
transform: (e, {
|
|
33
34
|
plugins: t,
|
|
34
35
|
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
35
36
|
...n
|
|
36
|
-
}) =>
|
|
37
|
+
}) => l({
|
|
37
38
|
...n,
|
|
38
39
|
value: "[[solid-element]]",
|
|
39
|
-
children: o(
|
|
40
|
+
children: o(d, i(n, {
|
|
40
41
|
get children() {
|
|
41
42
|
return k(e);
|
|
42
43
|
}
|
|
@@ -47,21 +48,21 @@ const C = {
|
|
|
47
48
|
canHandle: (e) => typeof e == "string",
|
|
48
49
|
transform: (e, t, n) => {
|
|
49
50
|
const {
|
|
50
|
-
plugins:
|
|
51
|
+
plugins: m,
|
|
51
52
|
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
52
53
|
...r
|
|
53
54
|
} = t, s = p(e), g = n(s, {
|
|
54
55
|
plugins: [{
|
|
55
56
|
id: "markdown-metadata-plugin",
|
|
56
57
|
canHandle: (a) => typeof a == "string" || typeof a == "number" || typeof a == "boolean" || !a,
|
|
57
|
-
transform: (a,
|
|
58
|
-
...
|
|
58
|
+
transform: (a, c) => l({
|
|
59
|
+
...c,
|
|
59
60
|
value: a,
|
|
60
|
-
children: o(
|
|
61
|
+
children: o(d, i(r, {
|
|
61
62
|
get children() {
|
|
62
63
|
return o(h, i(r, {
|
|
63
64
|
get metadataKeyPath() {
|
|
64
|
-
return
|
|
65
|
+
return c.keyPath;
|
|
65
66
|
},
|
|
66
67
|
children: e
|
|
67
68
|
}));
|
|
@@ -72,10 +73,10 @@ const C = {
|
|
|
72
73
|
dictionaryKey: r.dictionaryKey,
|
|
73
74
|
keyPath: []
|
|
74
75
|
});
|
|
75
|
-
return
|
|
76
|
+
return l({
|
|
76
77
|
...t,
|
|
77
78
|
value: e,
|
|
78
|
-
children: o(
|
|
79
|
+
children: o(d, i(r, {
|
|
79
80
|
get children() {
|
|
80
81
|
return o(f, i(r, {
|
|
81
82
|
children: e
|
|
@@ -87,21 +88,21 @@ const C = {
|
|
|
87
88
|
}
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
|
-
},
|
|
91
|
+
}, T = {
|
|
91
92
|
id: "markdown-plugin",
|
|
92
93
|
canHandle: (e) => typeof e == "object" && e?.nodeType === u.Markdown,
|
|
93
94
|
transform: (e, t, n) => {
|
|
94
|
-
const
|
|
95
|
+
const m = [...t.keyPath, {
|
|
95
96
|
type: u.Markdown
|
|
96
97
|
}], r = e[u.Markdown];
|
|
97
98
|
return n(r, {
|
|
98
99
|
...t,
|
|
99
100
|
children: r,
|
|
100
|
-
keyPath:
|
|
101
|
+
keyPath: m,
|
|
101
102
|
plugins: [P, ...t.plugins ?? []]
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
|
-
},
|
|
105
|
+
}, x = {
|
|
105
106
|
translation: !0,
|
|
106
107
|
enumeration: !0,
|
|
107
108
|
condition: !0,
|
|
@@ -112,9 +113,9 @@ const C = {
|
|
|
112
113
|
markdown: !0
|
|
113
114
|
};
|
|
114
115
|
export {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
x as interpreterPluginsEnabledState,
|
|
117
|
+
E as intlayerNodePlugins,
|
|
118
|
+
T as markdownPlugin,
|
|
118
119
|
P as markdownStringPlugin,
|
|
119
|
-
|
|
120
|
+
j as solidNodePlugins
|
|
120
121
|
};
|
|
@@ -12,4 +12,3 @@ type RenderIntlayerNodeProps<T> = ParentProps<{
|
|
|
12
12
|
}>;
|
|
13
13
|
export declare const renderIntlayerNode: <T extends number | string | boolean | undefined | null>({ children, value, additionalProps, }: RenderIntlayerNodeProps<T>) => IntlayerNode<T>;
|
|
14
14
|
export {};
|
|
15
|
-
//# sourceMappingURL=IntlayerNode.d.ts.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { LocalesValues } from '@intlayer/
|
|
1
|
+
import { LocalesValues } from '@intlayer/types';
|
|
2
2
|
import { Component, ParentProps } from 'solid-js';
|
|
3
3
|
type IntlayerValue = {
|
|
4
4
|
locale: () => LocalesValues;
|
|
5
5
|
setLocale: (newLocale: LocalesValues) => void;
|
|
6
6
|
disableEditor?: boolean;
|
|
7
|
+
isCookieEnabled?: boolean;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* Context that store the current locale on the client side
|
|
@@ -18,6 +19,7 @@ export type IntlayerProviderProps = ParentProps<{
|
|
|
18
19
|
defaultLocale?: LocalesValues;
|
|
19
20
|
setLocale?: (locale: LocalesValues) => void;
|
|
20
21
|
disableEditor?: boolean;
|
|
22
|
+
isCookieEnabled?: boolean;
|
|
21
23
|
}>;
|
|
22
24
|
/**
|
|
23
25
|
* Provider that store the current locale on the client side
|
|
@@ -25,4 +27,3 @@ export type IntlayerProviderProps = ParentProps<{
|
|
|
25
27
|
export declare const IntlayerProviderContent: Component<IntlayerProviderProps>;
|
|
26
28
|
export declare const IntlayerProvider: Component<IntlayerProviderProps>;
|
|
27
29
|
export {};
|
|
28
|
-
//# sourceMappingURL=IntlayerProvider.d.ts.map
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Locale } from '@intlayer/types';
|
|
2
2
|
export declare enum LanguageDetector {
|
|
3
3
|
Querystring = "querystring",
|
|
4
|
-
|
|
5
|
-
LocalStorage = "localStorage",
|
|
6
|
-
SessionStorage = "sessionStorage",
|
|
4
|
+
Storage = "storage",
|
|
7
5
|
Navigator = "navigator",
|
|
8
6
|
HtmlTag = "htmlTag"
|
|
9
7
|
}
|
|
10
8
|
type LanguageDetectorOptions = {
|
|
11
9
|
order?: LanguageDetector[];
|
|
12
10
|
lookupQuerystring?: string;
|
|
13
|
-
lookupCookie?: string;
|
|
14
|
-
lookupLocalStorage?: string;
|
|
15
|
-
lookupSessionStorage?: string;
|
|
16
|
-
excludeCacheFor?: string[];
|
|
17
11
|
htmlTag?: HTMLElement | null;
|
|
18
12
|
};
|
|
19
13
|
/**
|
|
20
|
-
* Core language detector function
|
|
21
|
-
*
|
|
14
|
+
* Core language detector function for browser environments.
|
|
15
|
+
*
|
|
16
|
+
* Detects the user's preferred locale by checking multiple sources in order:
|
|
17
|
+
* 1. Query string parameter
|
|
18
|
+
* 2. Storage (cookies, localStorage, sessionStorage) - uses getLocaleFromStorage
|
|
19
|
+
* 3. Navigator languages - uses localeDetector
|
|
20
|
+
* 4. HTML lang attribute - uses localeDetector
|
|
21
|
+
*
|
|
22
|
+
* @param userOptions - Optional configuration for detection order and lookup keys
|
|
23
|
+
* @returns The detected locale or the default locale
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const locale = getBrowserLocale({ order: [LanguageDetector.Storage, LanguageDetector.Navigator] });
|
|
22
27
|
*/
|
|
23
|
-
export declare const getBrowserLocale: (userOptions?: LanguageDetectorOptions | undefined) =>
|
|
28
|
+
export declare const getBrowserLocale: (userOptions?: LanguageDetectorOptions | undefined) => Locale;
|
|
24
29
|
export {};
|
|
25
|
-
//# sourceMappingURL=getBrowserLocale.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { getBrowserLocale } from './getBrowserLocale';
|
|
2
|
-
export { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent,
|
|
2
|
+
export { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, useIntlayerContext, } from './IntlayerProvider';
|
|
3
3
|
export { t } from './t';
|
|
4
4
|
export { useDictionary } from './useDictionary';
|
|
5
5
|
export { useDictionaryAsync } from './useDictionaryAsync';
|
|
@@ -8,5 +8,4 @@ export { useIntlayer } from './useIntlayer';
|
|
|
8
8
|
export { useLoadDynamic } from './useLoadDynamic';
|
|
9
9
|
export { useLocale } from './useLocale';
|
|
10
10
|
export { useLocaleBase } from './useLocaleBase';
|
|
11
|
-
export { localeCookie, setLocaleCookie, useLocaleCookie, } from './
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
11
|
+
export { localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage, } from './useLocaleStorage';
|
package/dist/types/client/t.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LanguageContent } from '@intlayer/core';
|
|
1
|
+
import { LocalesValues, StrictModeLocaleMap } from '@intlayer/types';
|
|
3
2
|
/**
|
|
4
3
|
* On the client side, this function returns the translation of the provided multilang content.
|
|
5
4
|
*
|
|
6
5
|
* If the locale is not provided, it will use the locale from the client context
|
|
7
6
|
*/
|
|
8
|
-
export declare const t: <Content = string>(multilangContent:
|
|
9
|
-
//# sourceMappingURL=t.d.ts.map
|
|
7
|
+
export declare const t: <Content = string>(multilangContent: StrictModeLocaleMap<Content>, locale?: LocalesValues) => Content;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StrictModeLocaleMap } from '@intlayer/types';
|
|
2
2
|
/**
|
|
3
3
|
* On the client side, hook to get the translation content based on the locale
|
|
4
4
|
*/
|
|
5
|
-
export declare const useContent: <Content>(languageContent:
|
|
6
|
-
locale:
|
|
5
|
+
export declare const useContent: <Content>(languageContent: StrictModeLocaleMap<Content>) => {
|
|
6
|
+
locale: import('intlayer').Locale;
|
|
7
7
|
content: Content;
|
|
8
|
-
t: <Content_1 = string>(languageContent:
|
|
8
|
+
t: <Content_1 = string>(languageContent: StrictModeLocaleMap<Content_1>) => Content_1;
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=useContent.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LocalesValues } from '@intlayer/
|
|
2
|
-
import {
|
|
1
|
+
import { DeclaredLocales, Dictionary, LocalesValues } from '@intlayer/types';
|
|
2
|
+
import { Accessor } from 'solid-js';
|
|
3
|
+
import { DeepTransformContent } from '../plugins';
|
|
3
4
|
/**
|
|
4
5
|
* On the client side, Hook that transform a dictionary and return the content
|
|
5
6
|
*
|
|
6
7
|
* If the locale is not provided, it will use the locale from the client context
|
|
7
8
|
*/
|
|
8
|
-
export declare const useDictionary: <T extends Dictionary>(dictionary: T, locale?:
|
|
9
|
-
//# sourceMappingURL=useDictionary.d.ts.map
|
|
9
|
+
export declare const useDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) => Accessor<DeepTransformContent<T["content"], L>>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { LocalesValues } from '@intlayer/
|
|
2
|
-
import { Dictionary, LanguageContent } from '@intlayer/core';
|
|
1
|
+
import { DeclaredLocales, Dictionary, LocalesValues, StrictModeLocaleMap } from '@intlayer/types';
|
|
3
2
|
/**
|
|
4
3
|
* On the server side, Hook that transform a dictionary and return the content
|
|
5
4
|
*
|
|
6
5
|
* If the locale is not provided, it will use the locale from the client context
|
|
7
6
|
*/
|
|
8
|
-
export declare const useDictionaryAsync: <T extends Dictionary>(dictionaryPromise:
|
|
9
|
-
//# sourceMappingURL=useDictionaryAsync.d.ts.map
|
|
7
|
+
export declare const useDictionaryAsync: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: L) => Promise<import('solid-js').Accessor<import('@intlayer/core').DeepTransformContent<T["content"], import('../plugins').IInterpreterPluginState, L>>>;
|