solid-intlayer 9.7.0 → 9.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/analytics/index.cjs +1 -1
- package/dist/cjs/analytics/useAnalytics.cjs +1 -1
- package/dist/cjs/analytics/useConversion.cjs +1 -1
- package/dist/cjs/analytics/useExperiment.cjs +1 -1
- 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/t.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/useTraduction.cjs +1 -1
- package/dist/cjs/format/index.cjs +1 -1
- package/dist/cjs/html/HTMLProvider.cjs +1 -1
- package/dist/cjs/html/HTMLRenderer.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/plugins.cjs +1 -1
- package/dist/esm/IntlayerNode.mjs +1 -2
- package/dist/esm/analytics/AnalyticsProvider.mjs +1 -2
- package/dist/esm/analytics/exposureSink.mjs +1 -2
- package/dist/esm/analytics/index.mjs +3 -3
- package/dist/esm/analytics/useAnalytics.mjs +11 -18
- package/dist/esm/analytics/useConversion.mjs +3 -4
- package/dist/esm/analytics/useExperiment.mjs +4 -5
- package/dist/esm/client/IntlayerProvider.mjs +21 -28
- package/dist/esm/client/getBrowserLocale.mjs +16 -17
- package/dist/esm/client/index.mjs +11 -11
- package/dist/esm/client/t.mjs +5 -6
- package/dist/esm/client/useContent.mjs +1 -2
- package/dist/esm/client/useDictionary.mjs +1 -2
- package/dist/esm/client/useDictionaryAsync.mjs +4 -5
- package/dist/esm/client/useDictionaryDynamic.mjs +20 -21
- package/dist/esm/client/useIntlayer.mjs +1 -2
- package/dist/esm/client/useLoadDynamic.mjs +1 -2
- package/dist/esm/client/useLocale.mjs +6 -11
- package/dist/esm/client/useLocaleBase.mjs +1 -2
- package/dist/esm/client/useLocaleStorage.mjs +1 -2
- package/dist/esm/client/usePathname.mjs +1 -2
- package/dist/esm/client/useRewriteURL.mjs +1 -2
- package/dist/esm/client/useTraduction.mjs +6 -7
- package/dist/esm/editor/ContentSelector.mjs +1 -2
- package/dist/esm/editor/EditorProvider.mjs +1 -2
- package/dist/esm/editor/useEditor.mjs +1 -2
- package/dist/esm/format/index.mjs +10 -10
- package/dist/esm/format/useCompact.mjs +1 -2
- package/dist/esm/format/useCurrency.mjs +1 -2
- package/dist/esm/format/useDate.mjs +1 -2
- package/dist/esm/format/useIntl.mjs +1 -2
- package/dist/esm/format/useList.mjs +1 -2
- package/dist/esm/format/useNumber.mjs +1 -2
- package/dist/esm/format/usePercentage.mjs +1 -2
- package/dist/esm/format/useRelativeTime.mjs +1 -2
- package/dist/esm/format/useUnit.mjs +1 -2
- package/dist/esm/getDictionary.mjs +1 -2
- package/dist/esm/getIntlayer.mjs +1 -2
- package/dist/esm/html/HTMLProvider.mjs +6 -7
- package/dist/esm/html/HTMLRenderer.mjs +7 -8
- package/dist/esm/index.mjs +20 -20
- package/dist/esm/markdown/MarkdownProvider.mjs +17 -18
- package/dist/esm/markdown/MarkdownRenderer.mjs +12 -13
- package/dist/esm/markdown/compiler.mjs +1 -2
- package/dist/esm/markdown/runtime.mjs +1 -2
- package/dist/esm/plugins.mjs +90 -91
- package/dist/esm/proxyKeys.mjs +1 -2
- package/dist/esm/server/index.mjs +1 -2
- package/dist/esm/server/useDictionary.mjs +1 -2
- package/dist/esm/solidElement/renderSolidElement.mjs +1 -2
- package/dist/esm-BnFj8Txc.js +1 -0
- package/dist/{esm-CtrrRmRn.mjs → esm-hfQR-yiQ.mjs} +77 -82
- package/dist/{isEnabled-BbWU6Ox5.mjs → isEnabled-DVKEZ2He.mjs} +1 -2
- package/package.json +13 -13
- package/dist/esm-CXlI80Tk.js +0 -1
|
@@ -1,39 +1,38 @@
|
|
|
1
1
|
import { compileMarkdown as e } from "./compiler.mjs";
|
|
2
2
|
import { MarkdownContext as t, useMarkdown as n } from "./MarkdownProvider.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
3
|
+
import { Suspense as r, createMemo as i, createResource as a, useContext as o } from "solid-js";
|
|
4
|
+
import { createComponent as s } from "solid-js/web";
|
|
5
|
+
import { getContentNodeByKeyPath as c } from "@intlayer/core/dictionaryManipulator";
|
|
6
|
+
import { getMarkdownMetadata as l } from "@intlayer/core/markdown";
|
|
7
|
+
// src/markdown/MarkdownRenderer.tsx
|
|
8
8
|
var u = (t, n = {}) => e(t, n), d = (e = {}) => {
|
|
9
|
-
let n =
|
|
9
|
+
let n = o(t);
|
|
10
10
|
return (t) => n ? n.renderMarkdown(t, {
|
|
11
11
|
forceBlock: e.forceBlock,
|
|
12
12
|
preserveFrontmatter: e.preserveFrontmatter,
|
|
13
13
|
tagfilter: e.tagfilter
|
|
14
14
|
}, e.components, e.wrapper) : u(t, e);
|
|
15
15
|
}, f = (e) => {
|
|
16
|
-
let i =
|
|
16
|
+
let i = o(t), { renderMarkdown: c } = n(), [l] = a(() => [
|
|
17
17
|
e.children,
|
|
18
18
|
e.forceBlock,
|
|
19
19
|
e.preserveFrontmatter,
|
|
20
20
|
e.tagfilter,
|
|
21
21
|
e.components,
|
|
22
22
|
e.wrapper
|
|
23
|
-
], ([e, t, n, r, a,
|
|
23
|
+
], ([e, t, n, r, a, o]) => c(e, {
|
|
24
24
|
forceBlock: t,
|
|
25
25
|
preserveFrontmatter: n,
|
|
26
26
|
tagfilter: r
|
|
27
27
|
}, {
|
|
28
28
|
...i?.components ?? {},
|
|
29
29
|
...a ?? {}
|
|
30
|
-
},
|
|
31
|
-
return r
|
|
30
|
+
}, o));
|
|
31
|
+
return s(r, { get children() {
|
|
32
32
|
return l();
|
|
33
33
|
} });
|
|
34
34
|
}, p = (e) => {
|
|
35
|
-
let t =
|
|
36
|
-
return
|
|
35
|
+
let t = i(() => l(e.children));
|
|
36
|
+
return i(() => c(t(), e.metadataKeyPath))();
|
|
37
37
|
};
|
|
38
|
-
//#endregion
|
|
39
38
|
export { p as MarkdownMetadataRenderer, f as MarkdownRenderer, u as renderMarkdown, d as useMarkdownRenderer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import e from "./runtime.mjs";
|
|
2
|
-
|
|
2
|
+
// src/markdown/compiler.tsx
|
|
3
3
|
var t = async (t = "", n = {}) => {
|
|
4
4
|
let { parseMarkdown: r } = await import("@intlayer/core/markdown"), { components: i, namedCodesToUnicode: a, sanitizer: o, slugify: s, ...c } = n;
|
|
5
5
|
return r(t, {
|
|
@@ -23,5 +23,4 @@ var t = async (t = "", n = {}) => {
|
|
|
23
23
|
slugify: s
|
|
24
24
|
}, c);
|
|
25
25
|
};
|
|
26
|
-
//#endregion
|
|
27
26
|
export { n as compileMarkdown, t as parseMarkdown };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dynamic as e, createComponent as t } from "solid-js/web";
|
|
2
|
-
|
|
2
|
+
// src/markdown/runtime.tsx
|
|
3
3
|
var n = {
|
|
4
4
|
createElement: (n, r, ...i) => t(e, {
|
|
5
5
|
get component() {
|
|
@@ -18,5 +18,4 @@ var n = {
|
|
|
18
18
|
return n;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { n as default, n as solidRuntime };
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { reportExposure as e } from "./analytics/exposureSink.mjs";
|
|
2
2
|
import { renderIntlayerNode as t } from "./IntlayerNode.mjs";
|
|
3
3
|
import { renderSolidElement as n } from "./solidElement/renderSolidElement.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
var T = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null :
|
|
4
|
+
import { editor as r, internationalization as i } from "@intlayer/config/built";
|
|
5
|
+
import { Suspense as a, lazy as o } from "solid-js";
|
|
6
|
+
import { createComponent as s, mergeProps as c } from "solid-js/web";
|
|
7
|
+
import { bindInsertedValues as l, conditionPlugin as u, enumerationPlugin as d, fallbackPlugin as f, filePlugin as p, genderPlugin as m, isInterpolableWrapperNode as h, nestedPlugin as g, pluralPlugin as _, resolveInterpreterLocale as v, selectPlugin as y, splitInsertionTemplate as b, transformInterpolableNode as x, translationPlugin as S } from "@intlayer/core/interpreter";
|
|
8
|
+
import { getMarkdownMetadata as C } from "@intlayer/core/markdown";
|
|
9
|
+
import * as w from "@intlayer/types/nodeType";
|
|
10
|
+
// src/plugins.tsx
|
|
11
|
+
var T = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : o(() => import("./editor/ContentSelector.mjs").then((e) => ({ default: e.ContentSelector }))), E = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? null : import("./markdown/MarkdownRenderer.mjs").then((e) => ({
|
|
12
12
|
MarkdownRenderer: e.MarkdownRenderer,
|
|
13
13
|
MarkdownMetadataRenderer: e.MarkdownMetadataRenderer
|
|
14
14
|
})), D = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? null : import("./html/HTMLRenderer.mjs").then((e) => e.HTMLRenderer);
|
|
@@ -16,22 +16,22 @@ E?.catch(() => {}), D?.catch(() => {});
|
|
|
16
16
|
var O = {
|
|
17
17
|
id: "intlayer-node-plugin",
|
|
18
18
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
19
|
-
transform: (n,
|
|
19
|
+
transform: (n, i) => {
|
|
20
20
|
if (process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
|
|
21
|
-
dictionaryKey:
|
|
22
|
-
keyPath:
|
|
23
|
-
locale:
|
|
21
|
+
dictionaryKey: i.dictionaryKey,
|
|
22
|
+
keyPath: i.keyPath,
|
|
23
|
+
locale: i.locale,
|
|
24
24
|
nodeType: "text"
|
|
25
|
-
}), process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
26
|
-
let { plugins: e, ...n } =
|
|
25
|
+
}), process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled) {
|
|
26
|
+
let { plugins: e, ...n } = i;
|
|
27
27
|
return t({
|
|
28
28
|
value: n.children,
|
|
29
|
-
children:
|
|
29
|
+
children: s(a, {
|
|
30
30
|
get fallback() {
|
|
31
31
|
return n.children;
|
|
32
32
|
},
|
|
33
33
|
get children() {
|
|
34
|
-
return
|
|
34
|
+
return s(T, c(n, { get children() {
|
|
35
35
|
return n.children;
|
|
36
36
|
} }));
|
|
37
37
|
}
|
|
@@ -39,46 +39,46 @@ var O = {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
return t({
|
|
42
|
-
value:
|
|
43
|
-
children:
|
|
42
|
+
value: i.children,
|
|
43
|
+
children: i.children
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
}, k = process.env.INTLAYER_NODE_TYPE_SOLID_NODE === "false" ?
|
|
46
|
+
}, k = process.env.INTLAYER_NODE_TYPE_SOLID_NODE === "false" ? f : {
|
|
47
47
|
id: "solid-node-plugin",
|
|
48
48
|
canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
|
|
49
|
-
transform: (
|
|
50
|
-
dictionaryKey:
|
|
51
|
-
keyPath:
|
|
52
|
-
locale:
|
|
49
|
+
transform: (i, { plugins: o, ...l }) => (process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
|
|
50
|
+
dictionaryKey: l.dictionaryKey,
|
|
51
|
+
keyPath: l.keyPath,
|
|
52
|
+
locale: l.locale,
|
|
53
53
|
nodeType: "solid-node"
|
|
54
54
|
}), t({
|
|
55
|
-
...
|
|
55
|
+
...l,
|
|
56
56
|
value: "[[solid-element]]",
|
|
57
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
57
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, {
|
|
58
58
|
get fallback() {
|
|
59
|
-
return typeof Node < "u" &&
|
|
59
|
+
return typeof Node < "u" && i instanceof Node ? i : n(i);
|
|
60
60
|
},
|
|
61
61
|
get children() {
|
|
62
|
-
return
|
|
63
|
-
return typeof Node < "u" &&
|
|
62
|
+
return s(T, c(l, { get children() {
|
|
63
|
+
return typeof Node < "u" && i instanceof Node ? i : n(i);
|
|
64
64
|
} }));
|
|
65
65
|
}
|
|
66
|
-
}) : typeof Node < "u" &&
|
|
66
|
+
}) : typeof Node < "u" && i instanceof Node ? i : n(i)
|
|
67
67
|
}))
|
|
68
68
|
}, A = (e, t) => {
|
|
69
|
-
let n =
|
|
69
|
+
let n = b(e, t);
|
|
70
70
|
return n.isSimple, n.parts;
|
|
71
|
-
}, j = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ?
|
|
71
|
+
}, j = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? f : {
|
|
72
72
|
id: "insertion-plugin",
|
|
73
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
73
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === w.INSERTION,
|
|
74
74
|
transform: (e, t, n) => {
|
|
75
|
-
let
|
|
75
|
+
let r = [...t.keyPath, { type: w.INSERTION }], i = e[w.INSERTION];
|
|
76
76
|
return (e) => {
|
|
77
|
-
let
|
|
77
|
+
let a = {
|
|
78
78
|
id: "insertion-string-plugin",
|
|
79
|
-
canHandle: (e) => typeof e == "string" ||
|
|
79
|
+
canHandle: (e) => typeof e == "string" || h(e),
|
|
80
80
|
transform: (n, r, i) => {
|
|
81
|
-
if (
|
|
81
|
+
if (h(n)) return x(n, e, r, t.plugins, i);
|
|
82
82
|
let a = A(i(n, {
|
|
83
83
|
...r,
|
|
84
84
|
children: n,
|
|
@@ -90,71 +90,71 @@ var O = {
|
|
|
90
90
|
children: a
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
},
|
|
93
|
+
}, o = n(i, {
|
|
94
94
|
...t,
|
|
95
|
-
children:
|
|
96
|
-
keyPath:
|
|
97
|
-
plugins: [
|
|
95
|
+
children: i,
|
|
96
|
+
keyPath: r,
|
|
97
|
+
plugins: [a, ...t.plugins ?? []]
|
|
98
98
|
});
|
|
99
|
-
return
|
|
99
|
+
return l(i, o, e, !0);
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
}, M =
|
|
102
|
+
}, M = o(() => E.then((e) => ({ default: e.MarkdownRenderer }))), N = o(() => E.then((e) => ({ default: e.MarkdownMetadataRenderer }))), P = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? f : {
|
|
103
103
|
id: "markdown-string-plugin",
|
|
104
104
|
canHandle: (e) => typeof e == "string",
|
|
105
|
-
transform: (e, n,
|
|
106
|
-
let { plugins:
|
|
105
|
+
transform: (e, n, i) => {
|
|
106
|
+
let { plugins: o, ...l } = n, u = i(C(e) ?? {}, {
|
|
107
107
|
plugins: [{
|
|
108
108
|
id: "markdown-metadata-plugin",
|
|
109
109
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
110
|
-
transform: (n,
|
|
111
|
-
...
|
|
110
|
+
transform: (n, i) => t({
|
|
111
|
+
...i,
|
|
112
112
|
value: n,
|
|
113
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
114
|
-
return
|
|
115
|
-
return
|
|
113
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, { get children() {
|
|
114
|
+
return s(T, c(l, { get children() {
|
|
115
|
+
return s(N, c(l, {
|
|
116
116
|
get metadataKeyPath() {
|
|
117
|
-
return
|
|
117
|
+
return i.keyPath;
|
|
118
118
|
},
|
|
119
119
|
children: e
|
|
120
120
|
}));
|
|
121
121
|
} }));
|
|
122
|
-
} }) :
|
|
122
|
+
} }) : s(N, c(l, {
|
|
123
123
|
get metadataKeyPath() {
|
|
124
|
-
return
|
|
124
|
+
return i.keyPath;
|
|
125
125
|
},
|
|
126
126
|
children: e
|
|
127
127
|
}))
|
|
128
128
|
})
|
|
129
129
|
}],
|
|
130
|
-
dictionaryKey:
|
|
130
|
+
dictionaryKey: l.dictionaryKey,
|
|
131
131
|
keyPath: []
|
|
132
|
-
}),
|
|
132
|
+
}), d = (i) => t({
|
|
133
133
|
...n,
|
|
134
134
|
value: e,
|
|
135
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
136
|
-
return
|
|
137
|
-
return
|
|
138
|
-
components:
|
|
135
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, { get children() {
|
|
136
|
+
return s(T, c(l, { get children() {
|
|
137
|
+
return s(M, c(l, {
|
|
138
|
+
components: i,
|
|
139
139
|
children: e
|
|
140
140
|
}));
|
|
141
141
|
} }));
|
|
142
|
-
} }) :
|
|
143
|
-
components:
|
|
142
|
+
} }) : s(M, c(l, {
|
|
143
|
+
components: i,
|
|
144
144
|
children: e
|
|
145
145
|
})),
|
|
146
146
|
additionalProps: {
|
|
147
|
-
metadata:
|
|
148
|
-
use:
|
|
147
|
+
metadata: u,
|
|
148
|
+
use: d
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
|
-
return
|
|
151
|
+
return d();
|
|
152
152
|
}
|
|
153
|
-
}, F = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
153
|
+
}, F = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? f : {
|
|
154
154
|
id: "markdown-plugin",
|
|
155
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
155
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === w.MARKDOWN,
|
|
156
156
|
transform: (e, t, n) => {
|
|
157
|
-
let r = [...t.keyPath, { type:
|
|
157
|
+
let r = [...t.keyPath, { type: w.MARKDOWN }], i = e[w.MARKDOWN];
|
|
158
158
|
return n(i, {
|
|
159
159
|
...t,
|
|
160
160
|
children: i,
|
|
@@ -162,47 +162,46 @@ var O = {
|
|
|
162
162
|
plugins: [P, ...t.plugins ?? []]
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
-
}, I =
|
|
165
|
+
}, I = o(() => D.then((e) => ({ default: e }))), L = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? f : {
|
|
166
166
|
id: "html-plugin",
|
|
167
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
167
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === w.HTML,
|
|
168
168
|
transform: (e, n) => {
|
|
169
|
-
let
|
|
170
|
-
...
|
|
171
|
-
value:
|
|
172
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
173
|
-
return
|
|
174
|
-
return
|
|
175
|
-
html:
|
|
169
|
+
let i = e[w.HTML], { plugins: o, children: l, ...u } = n, d = (e) => t({
|
|
170
|
+
...u,
|
|
171
|
+
value: i,
|
|
172
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, { get children() {
|
|
173
|
+
return s(T, c(u, { get children() {
|
|
174
|
+
return s(I, c(u, {
|
|
175
|
+
html: i,
|
|
176
176
|
components: e
|
|
177
177
|
}));
|
|
178
178
|
} }));
|
|
179
|
-
} }) :
|
|
180
|
-
html:
|
|
179
|
+
} }) : s(I, c(u, {
|
|
180
|
+
html: i,
|
|
181
181
|
components: e
|
|
182
182
|
})),
|
|
183
|
-
additionalProps: { use:
|
|
183
|
+
additionalProps: { use: d }
|
|
184
184
|
});
|
|
185
|
-
return
|
|
185
|
+
return d();
|
|
186
186
|
}
|
|
187
187
|
}, R = /* @__PURE__ */ new Map(), z = (e, t = !0) => {
|
|
188
|
-
let n =
|
|
188
|
+
let n = v(e), r = `${n}_${t}`;
|
|
189
189
|
if (R.has(r)) return R.get(r);
|
|
190
|
-
let
|
|
190
|
+
let a = [
|
|
191
191
|
O,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
s,
|
|
198
|
-
c,
|
|
192
|
+
S(n, t ? i.defaultLocale : void 0),
|
|
193
|
+
d,
|
|
194
|
+
_(n),
|
|
195
|
+
u,
|
|
196
|
+
g(n),
|
|
199
197
|
p,
|
|
198
|
+
m,
|
|
199
|
+
y,
|
|
200
200
|
k,
|
|
201
201
|
j,
|
|
202
202
|
F,
|
|
203
203
|
L
|
|
204
|
-
].filter((e) => e !==
|
|
205
|
-
return R.set(r,
|
|
204
|
+
].filter((e) => e !== f);
|
|
205
|
+
return R.set(r, a), a;
|
|
206
206
|
};
|
|
207
|
-
//#endregion
|
|
208
207
|
export { z as getPlugins, L as htmlPlugin, j as insertionPlugin, O as intlayerNodePlugins, F as markdownPlugin, P as markdownStringPlugin, k as solidNodePlugins };
|
package/dist/esm/proxyKeys.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { e as useDictionary };
|
|
1
|
+
export { useDictionary } from "./useDictionary.mjs";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useDictionary as e } from "../client/useDictionary.mjs";
|
|
2
2
|
import { createResource as t } from "solid-js";
|
|
3
|
-
|
|
3
|
+
// src/server/useDictionary.ts
|
|
4
4
|
var n = (n, r) => (t(() => n, {
|
|
5
5
|
initialValue: n,
|
|
6
6
|
ssrLoadFrom: "initial"
|
|
7
7
|
}), e(n, r));
|
|
8
|
-
//#endregion
|
|
9
8
|
export { n as useDictionary };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dynamic as e } from "solid-js/web";
|
|
2
|
-
|
|
2
|
+
// src/solidElement/renderSolidElement.ts
|
|
3
3
|
var t = (n) => {
|
|
4
4
|
if (typeof n == "string") return n;
|
|
5
5
|
let { type: r, props: i } = ((e) => {
|
|
@@ -29,5 +29,4 @@ var t = (n) => {
|
|
|
29
29
|
children: i.children
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
|
-
//#endregion
|
|
33
32
|
export { t as renderSolidElement };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./isEnabled-CuTKz0YA.js");let t=require("@intlayer/config/built");var n=e=>e.map(e=>e.key===void 0?`*`:String(e.key)).join(`.`),r=e=>({dictionaryKey:e.dictionaryKey,keyPath:n(e.keyPath),locale:e.locale,nodeType:e.nodeType,experimentKey:e.experimentKey,variant:e.variant}),i=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0},a=(e,t,n,r)=>{if(n.length===0)throw Error(`assignVariant requires at least one variant`);if(n.length===1)return n[0];let a=i(`${e}:${t}`)/4294967296;if(!r||r.length!==n.length){let e=Math.floor(a*n.length);return n[Math.min(e,n.length-1)]}let o=r.reduce((e,t)=>e+t,0);if(o<=0)return n[Math.floor(a*n.length)];let s=0,c=a*o;for(let e=0;e<n.length;e++)if(s+=r[e],c<s)return n[e];return n[n.length-1]},o=``,s=e=>[e.url,e.dictionaryKey,e.keyPath,e.locale,e.experimentKey??``,e.variant??``].join(o),c=({max:e})=>{let t=[],n=new Map,r=()=>t.length+n.size,i=()=>{for(;r()>e&&n.size>0;){let e=n.keys().next().value;n.delete(e)}r()>e&&(t=t.slice(r()-e))};return{push:e=>{if(e.type===`content_exposure`){let t=s(e),r=n.get(t);r?(r.count=(r.count??1)+(e.count??1),r.t=e.t):n.set(t,{...e,count:e.count??1})}else t.push(e);return i(),r()},drain:()=>{let e=[...t,...n.values()];return t=[],n.clear(),e},size:r}},l=(e,t)=>t>=1?!0:t<=0?!1:i(e)/4294967295<t,u=`__intlayer_analytics_sid__`,d=()=>{let e=typeof globalThis<`u`?globalThis.crypto:void 0;return e?.randomUUID?e.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`},f=()=>{if(typeof window>`u`||!window.sessionStorage)return d();try{let e=window.sessionStorage.getItem(u);if(e)return e;let t=d();return window.sessionStorage.setItem(u,t),t}catch{return d()}},p=(e,t,{useBeacon:n=!1,token:r}={})=>{try{let i=JSON.stringify(t);return n&&typeof navigator<`u`&&typeof navigator.sendBeacon==`function`?navigator.sendBeacon(e,i):typeof fetch==`function`&&(fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...r?{Authorization:`Bearer ${r}`}:{}},body:i,keepalive:!0,credentials:`omit`,mode:`cors`}).catch(()=>{}),!0)}catch{return!1}},m=e=>{if(typeof window>`u`)return;let t=window.requestIdleCallback;typeof t==`function`?t(()=>e()):setTimeout(e,1)},h=`__intlayer_public_token__`,g=6e4,_=()=>{try{let e=window.sessionStorage?.getItem(h);if(!e)return null;let t=JSON.parse(e);return typeof t?.token!=`string`||typeof t?.expiresAt!=`number`?null:t}catch{return null}},v=e=>{try{window.sessionStorage?.setItem(h,JSON.stringify(e))}catch{}},y=({backendURL:e,clientId:t})=>{let n=`${e.replace(/\/$/,``)}/api/public/token`,r=null,i=null,a=e=>e!==null&&e.expiresAt-g>Date.now(),o=()=>{if(a(r))return r.token;if(typeof window<`u`){let e=_();if(a(e))return r=e,e.token}},s=async()=>{try{let e=await fetch(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({clientId:t}),credentials:`omit`,mode:`cors`});if(!e.ok)return;let i=await e.json(),a=i?.data?.token,o=i?.data?.expiresIn??0;if(!a||o<=0)return;r={token:a,expiresAt:Date.now()+o*1e3},typeof window<`u`&&v(r)}catch{}finally{i=null}};return{getToken:o,prime:()=>{t&&typeof fetch==`function`&&(o()||(i||=s()))}}},b=`intlayer-analytics/1`,x=()=>typeof window>`u`||!window.location?``:window.location.pathname,S=()=>{if(typeof document<`u`&&document.referrer)try{return new URL(document.referrer).host}catch{return}},C=t=>{let n=f(),r=e.r(),i=!r&&l(n,t.sampleRate),o=c({max:t.maxBufferSize}),s=`${t.backendURL.replace(/\/$/,``)}/api/analytics/events`,u=y({backendURL:t.backendURL,clientId:t.clientId}),d=``,h=null,g=!1,_=null,v=null,C=new Set,w=(e=!1)=>{let r=o.drain(),i=u.getToken();for(let a=0;a<r.length;a+=200)p(s,{token:i,clientId:i?void 0:t.clientId,sessionId:n,sdkVersion:b,events:r.slice(a,a+200)},{useBeacon:e,token:i})},T=e=>{o.push(e)>=t.maxBufferSize&&w()},E=e=>{d=e},D=(e={})=>{if(!i)return;let t=e.url??x(),n=e.reason??`initial`;(n!==`route_change`||t!==v)&&(v=t,C=new Set,T({type:`page_view`,t:Date.now(),url:t,locale:e.locale??d,ref:e.ref??S(),vw:e.vw??(typeof window<`u`?window.innerWidth:void 0),vh:e.vh??(typeof window<`u`?window.innerHeight:void 0),reason:n}))},O=e=>{if(!i)return;let t=e.locale??d,n=[e.dictionaryKey,e.keyPath,t,e.experimentKey??``,e.variant??``].join(``);C.has(n)||(C.add(n),T({...e,type:`content_exposure`,t:Date.now(),url:x(),locale:t}))},k=e=>{r||(T({...e,type:`conversion`,t:Date.now(),url:x(),locale:e.locale??d}),w())},A=(e,t,r)=>a(n,e,t,r),j=()=>{if(typeof window>`u`)return;let e=()=>{document.visibilityState===`hidden`&&w(!0)},t=()=>w(!0),n=()=>D({reason:`route_change`});document.addEventListener(`visibilitychange`,e),window.addEventListener(`pagehide`,t,{capture:!0}),window.addEventListener(`popstate`,n);let r=window.history,i=r.pushState,a=function(...e){let t=i.apply(this,e);return D({reason:`route_change`}),t};r.pushState=a,_=()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`pagehide`,t,{capture:!0}),window.removeEventListener(`popstate`,n),r.pushState===a&&(r.pushState=i)}};return{setLocale:E,trackPageView:D,trackContentExposure:O,trackConversion:k,getVariant:A,flush:w,start:()=>{g||r||(g=!0,u.prime(),h=setInterval(w,t.flushInterval),h?.unref?.(),m(j))},stop:()=>{g&&(g=!1,h&&=(clearInterval(h),null),_?.(),_=null,w(!0))}}},w=`__intlayer_analytics_client__`,T=`__intlayer_analytics_ref_count__`,E=()=>typeof window>`u`?null:window[w]??null,D=e=>{typeof window<`u`&&(window[w]=e)},O=()=>{if(typeof window>`u`)return 0;let e=window;return e[T]=(e[T]??0)+1,e[T]},k=()=>{if(typeof window>`u`)return 0;let e=window;return e[T]=Math.max(0,(e[T]??0)-1),e[T]},A=()=>{O();let e=E();if(e)return e;let n=C({backendURL:t.editor?.backendURL??``,clientId:t.editor?.clientId,flushInterval:t.analytics?.flushInterval??2e4,maxBufferSize:500,sampleRate:t.analytics?.sampleRate??1});return D(n),n.start(),n},j=()=>{k()>0||(E()?.stop(),D(null))};exports.buildContentExposure=r,exports.getGlobalAnalyticsClient=E,exports.initAnalyticsClient=A,exports.stopAnalyticsClient=j;
|