vue-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/ContentSelector-BaMG67_z.js +1 -0
- package/dist/ContentSelector-D9fc9D1G.mjs +76 -0
- package/dist/EditedContentRenderer-CXoF8k9R.mjs +25 -0
- package/dist/EditedContentRenderer-S0zWbUak.js +1 -0
- package/dist/cjs/UI/ContentSelector.cjs +1 -1
- package/dist/cjs/client/index.cjs +1 -1
- package/dist/cjs/client/installIntlayer.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/useLocaleStorage.cjs +1 -1
- package/dist/cjs/client/useRewriteURL.cjs +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -1
- package/dist/cjs/editor/EditedContentRenderer.cjs +1 -1
- package/dist/cjs/editor/EditorSelectorRenderer.cjs +1 -1
- package/dist/cjs/editor/communicator.cjs +1 -1
- package/dist/cjs/editor/configuration.cjs +1 -1
- package/dist/cjs/editor/createSharedComposable.cjs +1 -1
- package/dist/cjs/editor/dictionariesRecord.cjs +1 -1
- package/dist/cjs/editor/editedContent.cjs +1 -1
- package/dist/cjs/editor/editorEnabled.cjs +1 -1
- package/dist/cjs/editor/editorLocale.cjs +1 -1
- package/dist/cjs/editor/focusDictionary.cjs +1 -1
- package/dist/cjs/editor/index.cjs +1 -1
- package/dist/cjs/editor/installIntlayerEditor.cjs +1 -1
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs +1 -1
- package/dist/cjs/editor/useCrossFrameState.cjs +1 -1
- package/dist/cjs/editor/useCrossURLPathState.cjs +1 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -1
- package/dist/cjs/editor/useEditor.cjs +1 -1
- package/dist/cjs/editor/useIframeClickInterceptor.cjs +1 -1
- package/dist/cjs/format/index.cjs +1 -1
- package/dist/cjs/format/useCompact.cjs +1 -1
- package/dist/cjs/format/useCurrency.cjs +1 -1
- package/dist/cjs/format/useDate.cjs +1 -1
- package/dist/cjs/format/useIntl.cjs +1 -1
- package/dist/cjs/format/useList.cjs +1 -1
- package/dist/cjs/format/useNumber.cjs +1 -1
- package/dist/cjs/format/usePercentage.cjs +1 -1
- package/dist/cjs/format/useRelativeTime.cjs +1 -1
- package/dist/cjs/format/useUnit.cjs +1 -1
- package/dist/cjs/getDictionary.cjs +1 -1
- package/dist/cjs/getIntlayer.cjs +1 -1
- package/dist/cjs/html/HTMLRenderer.cjs +1 -1
- package/dist/cjs/html/index.cjs +1 -1
- package/dist/cjs/html/installIntlayerHTML.cjs +1 -1
- package/dist/cjs/html/types.cjs +1 -1
- package/dist/cjs/index.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/installIntlayerMarkdown.cjs +1 -1
- package/dist/cjs/markdown/runtime.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/cjs/renderIntlayerNode.cjs +1 -1
- package/dist/communicator-1rnoOTtT.js +1 -0
- package/dist/esm/UI/ContentSelector.mjs +2 -4
- package/dist/esm/client/index.mjs +3 -26
- package/dist/esm/client/installIntlayer.mjs +2 -16
- package/dist/esm/client/useDictionary.mjs +2 -100
- package/dist/esm/client/useDictionaryAsync.mjs +2 -21
- package/dist/esm/client/useDictionaryDynamic.mjs +2 -5
- package/dist/esm/client/useIntlayer.mjs +2 -59
- package/dist/esm/client/useLoadDynamic.mjs +14 -16
- package/dist/esm/client/useLocale.mjs +2 -34
- package/dist/esm/client/useLocaleStorage.mjs +24 -29
- package/dist/esm/client/useRewriteURL.mjs +2 -23
- package/dist/esm/editor/ContentSelectorWrapper.mjs +2 -4
- package/dist/esm/editor/EditedContentRenderer.mjs +2 -4
- package/dist/esm/editor/EditorSelectorRenderer.mjs +43 -38
- package/dist/esm/editor/communicator.mjs +26 -32
- package/dist/esm/editor/configuration.mjs +10 -10
- package/dist/esm/editor/createSharedComposable.mjs +9 -11
- package/dist/esm/editor/dictionariesRecord.mjs +35 -52
- package/dist/esm/editor/editedContent.mjs +41 -63
- package/dist/esm/editor/editorEnabled.mjs +37 -55
- package/dist/esm/editor/editorLocale.mjs +2 -12
- package/dist/esm/editor/focusDictionary.mjs +33 -38
- package/dist/esm/editor/index.mjs +3 -7
- package/dist/esm/editor/installIntlayerEditor.mjs +20 -16
- package/dist/esm/editor/useCrossFrameMessageListener.mjs +28 -28
- package/dist/esm/editor/useCrossFrameState.mjs +51 -43
- package/dist/esm/editor/useCrossURLPathState.mjs +20 -25
- package/dist/esm/editor/useEditedContentRenderer.mjs +9 -17
- package/dist/esm/editor/useEditor.mjs +2 -11
- package/dist/esm/editor/useIframeClickInterceptor.mjs +14 -22
- package/dist/esm/format/index.mjs +10 -20
- package/dist/esm/format/useCompact.mjs +15 -15
- package/dist/esm/format/useCurrency.mjs +15 -15
- package/dist/esm/format/useDate.mjs +15 -15
- package/dist/esm/format/useIntl.mjs +9 -12
- package/dist/esm/format/useList.mjs +15 -15
- package/dist/esm/format/useNumber.mjs +15 -15
- package/dist/esm/format/usePercentage.mjs +14 -14
- package/dist/esm/format/useRelativeTime.mjs +15 -15
- package/dist/esm/format/useUnit.mjs +15 -15
- package/dist/esm/getDictionary.mjs +2 -15
- package/dist/esm/getIntlayer.mjs +2 -15
- package/dist/esm/html/HTMLRenderer.mjs +25 -31
- package/dist/esm/html/index.mjs +3 -11
- package/dist/esm/html/installIntlayerHTML.mjs +23 -33
- package/dist/esm/html/types.mjs +0 -1
- package/dist/esm/index.mjs +12 -69
- package/dist/esm/markdown/MarkdownRenderer.mjs +105 -131
- package/dist/esm/markdown/compiler.mjs +6 -12
- package/dist/esm/markdown/index.mjs +5 -22
- package/dist/esm/markdown/installIntlayerMarkdown.mjs +47 -80
- package/dist/esm/markdown/runtime.mjs +19 -54
- package/dist/esm/plugins.mjs +2 -21
- package/dist/esm/renderIntlayerNode.mjs +33 -47
- package/dist/getDictionary-BE4ZLuzI.mjs +387 -0
- package/dist/getDictionary-DMdOvXMh.js +1 -0
- package/dist/types/getDictionary.d.ts +1 -2
- package/dist/types/getIntlayer.d.ts +1 -2
- package/dist/types/plugins.d.ts +5 -0
- package/package.json +13 -13
- package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-87sjUiJI.js +0 -1
- package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-CR8kSRs9.mjs +0 -73
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-BlN498QG.mjs +0 -36
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-DYN7KHa_.js +0 -1
- package/dist/plugins-Bzptc2vR.js +0 -1
- package/dist/plugins-rixQm8YE.mjs +0 -293
|
@@ -1,48 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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
|
-
use(e) {
|
|
33
|
-
return i({
|
|
34
|
-
value: r.value,
|
|
35
|
-
children: () => n(e),
|
|
36
|
-
additionalProps: a
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
/* called by useIntlayer when the dictionary entry changes */
|
|
40
|
-
__update(e) {
|
|
41
|
-
n = e.render, this.raw = e.raw;
|
|
42
|
-
},
|
|
43
|
-
...a
|
|
44
|
-
}), s(u);
|
|
45
|
-
};
|
|
46
|
-
export {
|
|
47
|
-
i as renderIntlayerNode
|
|
1
|
+
import { markRaw as e, ref as t } from "vue";
|
|
2
|
+
//#region src/renderIntlayerNode.ts
|
|
3
|
+
var n = ({ value: r, children: i, additionalProps: a = {} }) => {
|
|
4
|
+
let o = t(r), s = typeof i == "function" ? (e) => i(e) : () => i, c = (e) => (o.value, s(e)), l = ((e) => c(e));
|
|
5
|
+
return Object.setPrototypeOf(l, String.prototype), Object.assign(l, {
|
|
6
|
+
render: c,
|
|
7
|
+
toString: () => String(o.value ?? ""),
|
|
8
|
+
valueOf: () => o.value,
|
|
9
|
+
[Symbol.toPrimitive]: () => o.value,
|
|
10
|
+
toJSON: () => o.value,
|
|
11
|
+
get raw() {
|
|
12
|
+
return o.value;
|
|
13
|
+
},
|
|
14
|
+
set raw(e) {
|
|
15
|
+
o.value = e;
|
|
16
|
+
},
|
|
17
|
+
get value() {
|
|
18
|
+
return o.value;
|
|
19
|
+
},
|
|
20
|
+
use(e) {
|
|
21
|
+
return n({
|
|
22
|
+
value: o.value,
|
|
23
|
+
children: () => s(e),
|
|
24
|
+
additionalProps: a
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
__update(e) {
|
|
28
|
+
s = e.render, this.raw = e.raw;
|
|
29
|
+
},
|
|
30
|
+
...a
|
|
31
|
+
}), e(l);
|
|
48
32
|
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { n as renderIntlayerNode };
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { t as e } from "./ContentSelector-D9fc9D1G.mjs";
|
|
2
|
+
import { useCommunicator as t } from "./esm/editor/communicator.mjs";
|
|
3
|
+
import { createSharedComposable as n } from "./esm/editor/createSharedComposable.mjs";
|
|
4
|
+
import { useEditorEnabled as r } from "./esm/editor/editorEnabled.mjs";
|
|
5
|
+
import { useCrossFrameState as i } from "./esm/editor/useCrossFrameState.mjs";
|
|
6
|
+
import { useFocusDictionary as a } from "./esm/editor/focusDictionary.mjs";
|
|
7
|
+
import { useConfiguration as o } from "./esm/editor/configuration.mjs";
|
|
8
|
+
import { useDictionariesRecord as s } from "./esm/editor/dictionariesRecord.mjs";
|
|
9
|
+
import { setLocaleInStorage as c } from "./esm/client/useLocaleStorage.mjs";
|
|
10
|
+
import { useCrossURLPathSetter as l } from "./esm/editor/useCrossURLPathState.mjs";
|
|
11
|
+
import { useIframeClickMerger as u } from "./esm/editor/useIframeClickInterceptor.mjs";
|
|
12
|
+
import { installIntlayerEditor as d } from "./esm/editor/installIntlayerEditor.mjs";
|
|
13
|
+
import { useMarkdown as f } from "./esm/markdown/installIntlayerMarkdown.mjs";
|
|
14
|
+
import { renderIntlayerNode as p } from "./esm/renderIntlayerNode.mjs";
|
|
15
|
+
import { conditionPlugin as m, enumerationPlugin as ee, filePlugin as te, genderPlugin as ne, getDictionary as re, getHTML as ie, getIntlayer as ae, nestedPlugin as oe, splitInsertionTemplate as se, translationPlugin as ce } from "@intlayer/core/interpreter";
|
|
16
|
+
import h from "@intlayer/config/built";
|
|
17
|
+
import { getMarkdownMetadata as le } from "@intlayer/core/markdown";
|
|
18
|
+
import { HTML_TAGS as ue } from "@intlayer/core/transpiler";
|
|
19
|
+
import { NodeType as g } from "@intlayer/types/nodeType";
|
|
20
|
+
import { Fragment as _, computed as v, createBlock as de, createElementBlock as fe, defineComponent as y, h as b, inject as x, isRef as S, markRaw as C, openBlock as w, readonly as pe, ref as T, renderSlot as E, shallowRef as D, toValue as O, unref as me, watch as k, withCtx as he } from "vue";
|
|
21
|
+
import { isSameKeyPath as ge } from "@intlayer/core/utils";
|
|
22
|
+
import { MessageKey as A } from "@intlayer/editor";
|
|
23
|
+
import { getRewritePath as _e } from "@intlayer/core/localization";
|
|
24
|
+
//#region src/client/installIntlayer.ts
|
|
25
|
+
var j = Symbol("intlayer"), M = null, N = (e, t = !0) => {
|
|
26
|
+
if (M) return M;
|
|
27
|
+
let { defaultLocale: n } = h.internationalization ?? {}, r = T(e ?? n);
|
|
28
|
+
return M = {
|
|
29
|
+
locale: pe(r),
|
|
30
|
+
setLocale: (e) => {
|
|
31
|
+
r.value = e;
|
|
32
|
+
},
|
|
33
|
+
isCookieEnabled: t
|
|
34
|
+
}, M;
|
|
35
|
+
}, ve = (e, t, n = !0) => {
|
|
36
|
+
let r = N(t, n);
|
|
37
|
+
return e.provide(j, r), d(e, r), e;
|
|
38
|
+
}, P = (e, t) => t.reduce((e, t) => e?.[t], e), F = (e) => typeof e == "object" && !!e, I = (e) => typeof e == "function" || F(e) && ("render" in e || "setup" in e), L = (e) => typeof e == "object" && !!e && "__update" in e && "render" in e && "raw" in e, R = (e) => C(y({
|
|
39
|
+
name: "IntlayerLeaf",
|
|
40
|
+
setup() {
|
|
41
|
+
return () => {
|
|
42
|
+
let t = e();
|
|
43
|
+
return t == null ? null : I(t) ? b(t) : Array.isArray(t) ? b("span", t) : t;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
})), z = (e) => new Proxy({}, {
|
|
47
|
+
get(t, n) {
|
|
48
|
+
let r = e.value;
|
|
49
|
+
if (n === "__v_isRef") return !0;
|
|
50
|
+
if (n === "value") return r ?? "";
|
|
51
|
+
if (n === "$raw") return e;
|
|
52
|
+
if (n === "__v_skip") return !0;
|
|
53
|
+
if (n === "c" || n === "asComponent") return R(() => e.value);
|
|
54
|
+
if (r == null) return n === Symbol.toPrimitive || n === "toString" ? () => "" : void 0;
|
|
55
|
+
let i = r[n];
|
|
56
|
+
return typeof i == "function" ? i.bind(r) : i;
|
|
57
|
+
},
|
|
58
|
+
ownKeys() {
|
|
59
|
+
let t = e.value;
|
|
60
|
+
return typeof t == "object" && t ? Reflect.ownKeys(t) : [];
|
|
61
|
+
},
|
|
62
|
+
getOwnPropertyDescriptor() {
|
|
63
|
+
return {
|
|
64
|
+
enumerable: !0,
|
|
65
|
+
configurable: !0
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}), B = (e, t) => {
|
|
69
|
+
let n = x(j), r = S(n?.locale) ? n.locale : T(n?.locale ?? h.internationalization.defaultLocale), i = v(() => (t === void 0 ? void 0 : O(t)) ?? r.value), a = D({});
|
|
70
|
+
k([() => O(e), () => i.value], ([e, t]) => {
|
|
71
|
+
a.value = $(e, t);
|
|
72
|
+
}, {
|
|
73
|
+
immediate: !0,
|
|
74
|
+
flush: "sync"
|
|
75
|
+
});
|
|
76
|
+
let o = (e) => new Proxy({}, {
|
|
77
|
+
get(t, n, r) {
|
|
78
|
+
if (n === "__v_isRef") return !0;
|
|
79
|
+
let i = v(() => P(a.value, e));
|
|
80
|
+
if (n === "value") return i.value ?? "";
|
|
81
|
+
if (n === "then") return;
|
|
82
|
+
if (n === "c" || n === "asComponent") return R(() => i.value);
|
|
83
|
+
if (n === "$raw") return i;
|
|
84
|
+
if (n === Symbol.toPrimitive) return () => i.value;
|
|
85
|
+
let s = e.concat(n), c = P(a.value, s);
|
|
86
|
+
if (c === void 0 || F(c) && !I(c)) return o(s);
|
|
87
|
+
if (L(c)) return z(v(() => P(a.value, s)));
|
|
88
|
+
let l = v(() => P(a.value, s));
|
|
89
|
+
return new Proxy(l, { get(e, t, n) {
|
|
90
|
+
return t === "value" ? e.value ?? "" : Reflect.get(e, t, n);
|
|
91
|
+
} });
|
|
92
|
+
},
|
|
93
|
+
ownKeys() {
|
|
94
|
+
let t = P(a.value, e);
|
|
95
|
+
return F(t) ? Reflect.ownKeys(t) : [];
|
|
96
|
+
},
|
|
97
|
+
getOwnPropertyDescriptor() {
|
|
98
|
+
return {
|
|
99
|
+
enumerable: !0,
|
|
100
|
+
configurable: !0
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return o([]);
|
|
105
|
+
}, V = async (e, t) => {
|
|
106
|
+
let n = x(j), r = v(() => t ?? n?.locale?.value ?? h?.internationalization.defaultLocale), i = T(await e[r.value]?.());
|
|
107
|
+
return k(() => r.value, async (t) => {
|
|
108
|
+
let n = await e[t]?.();
|
|
109
|
+
n && (i.value = n);
|
|
110
|
+
}), B(i, r);
|
|
111
|
+
}, ye = async (e, t, n) => await V(e, n), H = (e, t) => ae(e, t, Q(t)), be = (e, t) => {
|
|
112
|
+
let n = x(j), r = S(n?.locale) ? n.locale : T(n?.locale ?? h.internationalization.defaultLocale), i = v(() => (t === void 0 ? void 0 : O(t)) ?? r.value), a = D({});
|
|
113
|
+
k([() => O(e), () => i.value], ([e, t]) => {
|
|
114
|
+
a.value = H(e, t);
|
|
115
|
+
}, {
|
|
116
|
+
immediate: !0,
|
|
117
|
+
flush: "sync"
|
|
118
|
+
});
|
|
119
|
+
let o = /* @__PURE__ */ new Map(), s = (e) => {
|
|
120
|
+
let t = e.join(".");
|
|
121
|
+
if (o.has(t)) return o.get(t);
|
|
122
|
+
let n = v(() => P(a.value, e)), r = new Proxy({}, {
|
|
123
|
+
get(t, r, i) {
|
|
124
|
+
if (typeof r == "symbol" || typeof r == "string" && (r.startsWith("__") || r.startsWith("$"))) return r === "__v_isRef" ? !0 : r === "then" ? void 0 : Reflect.get(t, r, i);
|
|
125
|
+
if (r === "value") return n.value ?? "";
|
|
126
|
+
if (r === "c" || r === "asComponent") return R(() => n.value);
|
|
127
|
+
if (r === "$raw") return n;
|
|
128
|
+
if (r === Symbol.toPrimitive) return () => String(n.value ?? "");
|
|
129
|
+
let o = e.concat(r), c = P(a.value, o);
|
|
130
|
+
if (c === void 0 || F(c) && !I(c)) return s(o);
|
|
131
|
+
if (L(c)) return z(v(() => P(a.value, o)));
|
|
132
|
+
let l = v(() => P(a.value, o));
|
|
133
|
+
return new Proxy(l, { get(e, t, n) {
|
|
134
|
+
return t === "value" ? e.value ?? "" : t === "__v_isRef" ? !0 : Reflect.get(e, t, n);
|
|
135
|
+
} });
|
|
136
|
+
},
|
|
137
|
+
ownKeys() {
|
|
138
|
+
let t = P(a.value, e);
|
|
139
|
+
return F(t) ? Reflect.ownKeys(t) : [];
|
|
140
|
+
},
|
|
141
|
+
getOwnPropertyDescriptor() {
|
|
142
|
+
return {
|
|
143
|
+
enumerable: !0,
|
|
144
|
+
configurable: !0
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return o.set(t, r), r;
|
|
149
|
+
};
|
|
150
|
+
return s([]);
|
|
151
|
+
}, U = ({ isCookieEnabled: e, onLocaleChange: t } = {}) => {
|
|
152
|
+
let { defaultLocale: n, locales: r } = h?.internationalization ?? {}, i = x(j);
|
|
153
|
+
return {
|
|
154
|
+
locale: v(() => i?.locale?.value ?? n),
|
|
155
|
+
defaultLocale: n,
|
|
156
|
+
availableLocales: r,
|
|
157
|
+
setLocale: (n) => {
|
|
158
|
+
if (!r?.map(String).includes(n)) {
|
|
159
|
+
console.error(`Locale ${n} is not available`);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
i && i.setLocale(n), c(n, e ?? i?.isCookieEnabled ?? !0), t?.(n);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}, xe = () => {
|
|
166
|
+
let { locale: e } = U(), t = h?.routing?.rewrite;
|
|
167
|
+
k(e, (e) => {
|
|
168
|
+
if (typeof window > "u" || !t) return;
|
|
169
|
+
let n = window.location.pathname, r = _e(n, e, t);
|
|
170
|
+
r && r !== n && window.history.replaceState(window.history.state, "", r + window.location.search + window.location.hash);
|
|
171
|
+
}, { immediate: !0 });
|
|
172
|
+
}, W = n(() => {
|
|
173
|
+
let e = x(j);
|
|
174
|
+
if (!e) throw Error("IntlayerEditor state not found");
|
|
175
|
+
let [t, n] = i(A.INTLAYER_CURRENT_LOCALE);
|
|
176
|
+
return k(e.locale, (e) => {
|
|
177
|
+
n(e);
|
|
178
|
+
}, { immediate: !0 }), e;
|
|
179
|
+
}), G = n(() => {
|
|
180
|
+
o(), r(), a(), u(), l(), W(), s();
|
|
181
|
+
}), Se = {
|
|
182
|
+
key: 1,
|
|
183
|
+
style: { display: "contents" }
|
|
184
|
+
}, K = /* @__PURE__ */ y({
|
|
185
|
+
__name: "ContentSelectorWrapper",
|
|
186
|
+
props: {
|
|
187
|
+
dictionaryKey: {},
|
|
188
|
+
keyPath: {},
|
|
189
|
+
plugins: {},
|
|
190
|
+
locale: {},
|
|
191
|
+
dictionaryPath: {},
|
|
192
|
+
children: {}
|
|
193
|
+
},
|
|
194
|
+
setup(n) {
|
|
195
|
+
let i = n, o = a(), s = r(), c = t();
|
|
196
|
+
G();
|
|
197
|
+
let l = v(() => i.keyPath.filter((e) => e.type !== g.Translation)), u = v(() => o?.focusedContent.value?.dictionaryKey === i.dictionaryKey && (o?.focusedContent.value.keyPath?.length ?? 0) > 0 && ge(o?.focusedContent.value.keyPath ?? [], l.value)), d = () => {
|
|
198
|
+
o?.setFocusedContent({
|
|
199
|
+
dictionaryKey: i.dictionaryKey,
|
|
200
|
+
keyPath: l.value
|
|
201
|
+
});
|
|
202
|
+
}, f = () => {
|
|
203
|
+
c?.postMessage({
|
|
204
|
+
type: `${A.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
|
|
205
|
+
data: {
|
|
206
|
+
dictionaryKey: i.dictionaryKey,
|
|
207
|
+
keyPath: l.value
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}, p = () => {
|
|
211
|
+
c?.postMessage({
|
|
212
|
+
type: `${A.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
|
|
213
|
+
data: null
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
return (t, n) => me(s)?.enabled.value ? (w(), de(e, {
|
|
217
|
+
key: 0,
|
|
218
|
+
onPress: d,
|
|
219
|
+
isSelecting: u.value,
|
|
220
|
+
onHover: f,
|
|
221
|
+
onUnhover: p
|
|
222
|
+
}, {
|
|
223
|
+
default: he(() => [E(t.$slots, "default")]),
|
|
224
|
+
_: 3
|
|
225
|
+
}, 8, ["isSelecting"])) : (w(), fe("span", Se, [E(t.$slots, "default")]));
|
|
226
|
+
}
|
|
227
|
+
}), q = {
|
|
228
|
+
id: "intlayer-node-plugin",
|
|
229
|
+
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
230
|
+
transform: (e, { children: t, ...n }) => {
|
|
231
|
+
let r = (e) => p({
|
|
232
|
+
...n,
|
|
233
|
+
value: e,
|
|
234
|
+
children: h?.editor.enabled ? () => b(K, {
|
|
235
|
+
dictionaryKey: n.dictionaryKey,
|
|
236
|
+
keyPath: n.keyPath
|
|
237
|
+
}, { default: () => typeof e == "function" ? e() : e }) : e
|
|
238
|
+
}), i = r(t);
|
|
239
|
+
if (typeof t != "function") return i;
|
|
240
|
+
let a = (...e) => r(t(...e));
|
|
241
|
+
Object.setPrototypeOf(a, Object.getPrototypeOf(i));
|
|
242
|
+
for (let e of Object.getOwnPropertyNames(i)) {
|
|
243
|
+
let t = Object.getOwnPropertyDescriptor(i, e);
|
|
244
|
+
t && Object.defineProperty(a, e, t);
|
|
245
|
+
}
|
|
246
|
+
for (let e of Object.getOwnPropertySymbols(i)) {
|
|
247
|
+
let t = Object.getOwnPropertyDescriptor(i, e);
|
|
248
|
+
t && Object.defineProperty(a, e, t);
|
|
249
|
+
}
|
|
250
|
+
return C(a);
|
|
251
|
+
}
|
|
252
|
+
}, Ce = (e, t) => {
|
|
253
|
+
let n = /* @__PURE__ */ new Map(), r = {};
|
|
254
|
+
for (let [e, i] of Object.entries(t)) typeof i == "string" || typeof i == "number" ? r[e] = i : (n.set(e, i), r[e] = `__VNODE_${e}__`);
|
|
255
|
+
let i = se(e, r);
|
|
256
|
+
if (n.size > 0) {
|
|
257
|
+
let e = [];
|
|
258
|
+
if (i.isSimple) {
|
|
259
|
+
let t = i.parts, r = 0;
|
|
260
|
+
for (let [i] of n) {
|
|
261
|
+
let a = `__VNODE_${i}__`, o = t.indexOf(a);
|
|
262
|
+
o !== -1 && (o > r && e.push(t.substring(r, o)), e.push(n.get(i)), r = o + a.length);
|
|
263
|
+
}
|
|
264
|
+
return r < t.length && e.push(t.substring(r)), b(_, null, ...e);
|
|
265
|
+
} else return i.parts.forEach((t) => {
|
|
266
|
+
if (typeof t == "string") {
|
|
267
|
+
let r = t;
|
|
268
|
+
for (let [t] of n) {
|
|
269
|
+
let i = `__VNODE_${t}__`, a = r.indexOf(i);
|
|
270
|
+
a !== -1 && (a > 0 && e.push(r.substring(0, a)), e.push(n.get(t)), r = r.substring(a + i.length));
|
|
271
|
+
}
|
|
272
|
+
r.length > 0 && e.push(r);
|
|
273
|
+
} else e.push(t);
|
|
274
|
+
}), b(_, null, ...e);
|
|
275
|
+
}
|
|
276
|
+
return i.isSimple ? i.parts : b(_, null, i.parts);
|
|
277
|
+
}, J = {
|
|
278
|
+
id: "insertion-plugin",
|
|
279
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === g.Insertion,
|
|
280
|
+
transform: (e, t, n) => {
|
|
281
|
+
let r = [...t.keyPath, { type: g.Insertion }], i = e[g.Insertion], a = {
|
|
282
|
+
id: "insertion-string-plugin",
|
|
283
|
+
canHandle: (e) => typeof e == "string",
|
|
284
|
+
transform: (e, n, r) => {
|
|
285
|
+
let i = r(e, {
|
|
286
|
+
...n,
|
|
287
|
+
children: e,
|
|
288
|
+
plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
|
|
289
|
+
});
|
|
290
|
+
return (e) => {
|
|
291
|
+
let a = Ce(i, e);
|
|
292
|
+
return r(a, {
|
|
293
|
+
...n,
|
|
294
|
+
plugins: t.plugins,
|
|
295
|
+
children: a
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
return n(i, {
|
|
301
|
+
...t,
|
|
302
|
+
children: i,
|
|
303
|
+
keyPath: r,
|
|
304
|
+
plugins: [a, ...t.plugins ?? []]
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}, Y = {
|
|
308
|
+
id: "markdown-string-plugin",
|
|
309
|
+
canHandle: (e) => typeof e == "string",
|
|
310
|
+
transform: (e, t, n) => {
|
|
311
|
+
let { plugins: r, ...i } = t, a = n(le(e), {
|
|
312
|
+
plugins: [{
|
|
313
|
+
id: "markdown-metadata-plugin",
|
|
314
|
+
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
315
|
+
transform: (t, n) => p({
|
|
316
|
+
...n,
|
|
317
|
+
value: t,
|
|
318
|
+
children: e
|
|
319
|
+
})
|
|
320
|
+
}],
|
|
321
|
+
dictionaryKey: i.dictionaryKey,
|
|
322
|
+
keyPath: []
|
|
323
|
+
}), o = (n) => p({
|
|
324
|
+
...t,
|
|
325
|
+
value: e,
|
|
326
|
+
children: () => b(K, {
|
|
327
|
+
dictionaryKey: i.dictionaryKey,
|
|
328
|
+
keyPath: i.keyPath
|
|
329
|
+
}, { default: () => {
|
|
330
|
+
let { renderMarkdown: t, components: r } = f();
|
|
331
|
+
return t(e, void 0, {
|
|
332
|
+
...r ?? {},
|
|
333
|
+
...n ?? {}
|
|
334
|
+
});
|
|
335
|
+
} }),
|
|
336
|
+
additionalProps: { metadata: a }
|
|
337
|
+
}), s = o();
|
|
338
|
+
return new Proxy(s, { get(t, n, r) {
|
|
339
|
+
return n === "value" ? e : n === "metadata" ? a : n === "use" ? (e) => o(e) : Reflect.get(t, n, r);
|
|
340
|
+
} });
|
|
341
|
+
}
|
|
342
|
+
}, X = {
|
|
343
|
+
id: "markdown-plugin",
|
|
344
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === g.Markdown,
|
|
345
|
+
transform: (e, t, n) => {
|
|
346
|
+
let r = [...t.keyPath, { type: g.Markdown }], i = e[g.Markdown];
|
|
347
|
+
return n(i, {
|
|
348
|
+
...t,
|
|
349
|
+
children: i,
|
|
350
|
+
keyPath: r,
|
|
351
|
+
plugins: [Y, ...t.plugins ?? []]
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
}, we = (() => {
|
|
355
|
+
let e = {};
|
|
356
|
+
for (let t of ue) e[t] = ({ children: e, ...n }) => b(t, n, e);
|
|
357
|
+
return e;
|
|
358
|
+
})(), Z = {
|
|
359
|
+
id: "html-plugin",
|
|
360
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === g.HTML,
|
|
361
|
+
transform: (e, t) => {
|
|
362
|
+
let n = e[g.HTML];
|
|
363
|
+
e.tags;
|
|
364
|
+
let r = (e) => ie(n, {
|
|
365
|
+
...we,
|
|
366
|
+
...e
|
|
367
|
+
});
|
|
368
|
+
return p({
|
|
369
|
+
...t,
|
|
370
|
+
value: n,
|
|
371
|
+
children: (e) => r(e)
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}, Q = (e, t = !0) => [
|
|
375
|
+
ce(e ?? h.internationalization.defaultLocale, t ? h.internationalization.defaultLocale : void 0),
|
|
376
|
+
ee,
|
|
377
|
+
m,
|
|
378
|
+
oe(e ?? h.internationalization.defaultLocale),
|
|
379
|
+
te,
|
|
380
|
+
ne,
|
|
381
|
+
q,
|
|
382
|
+
J,
|
|
383
|
+
X,
|
|
384
|
+
Z
|
|
385
|
+
], $ = (e, t) => re(e, t, Q(t));
|
|
386
|
+
//#endregion
|
|
387
|
+
export { B as C, ve as E, R as S, N as T, P as _, q as a, L as b, K as c, xe as d, U as f, V as g, ye as h, J as i, G as l, H as m, Q as n, X as o, be as p, Z as r, Y as s, $ as t, W as u, z as v, j as w, F as x, I as y };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./communicator-1rnoOTtT.js`),t=require(`./ContentSelector-BaMG67_z.js`),n=require(`./cjs/editor/createSharedComposable.cjs`),r=require(`./cjs/editor/editorEnabled.cjs`),i=require(`./cjs/editor/useCrossFrameState.cjs`),a=require(`./cjs/editor/focusDictionary.cjs`),o=require(`./cjs/editor/configuration.cjs`),s=require(`./cjs/editor/dictionariesRecord.cjs`),c=require(`./cjs/client/useLocaleStorage.cjs`),l=require(`./cjs/editor/useCrossURLPathState.cjs`),u=require(`./cjs/editor/useIframeClickInterceptor.cjs`),d=require(`./cjs/editor/installIntlayerEditor.cjs`),f=require(`./cjs/markdown/installIntlayerMarkdown.cjs`),p=require(`./cjs/renderIntlayerNode.cjs`);let m=require(`@intlayer/core/interpreter`),h=require(`@intlayer/config/built`);h=e.i(h);let g=require(`@intlayer/core/markdown`),_=require(`@intlayer/core/transpiler`),v=require(`@intlayer/types/nodeType`),y=require(`vue`),b=require(`@intlayer/core/utils`),x=require(`@intlayer/editor`),S=require(`@intlayer/core/localization`);var C=Symbol(`intlayer`),w=null,T=(e,t=!0)=>{if(w)return w;let{defaultLocale:n}=h.default.internationalization??{},r=(0,y.ref)(e??n);return w={locale:(0,y.readonly)(r),setLocale:e=>{r.value=e},isCookieEnabled:t},w},E=(e,t,n=!0)=>{let r=T(t,n);return e.provide(C,r),d.installIntlayerEditor(e,r),e},D=(e,t)=>t.reduce((e,t)=>e?.[t],e),O=e=>typeof e==`object`&&!!e,k=e=>typeof e==`function`||O(e)&&(`render`in e||`setup`in e),A=e=>typeof e==`object`&&!!e&&`__update`in e&&`render`in e&&`raw`in e,j=e=>(0,y.markRaw)((0,y.defineComponent)({name:`IntlayerLeaf`,setup(){return()=>{let t=e();return t==null?null:k(t)?(0,y.h)(t):Array.isArray(t)?(0,y.h)(`span`,t):t}}})),M=e=>new Proxy({},{get(t,n){let r=e.value;if(n===`__v_isRef`)return!0;if(n===`value`)return r??``;if(n===`$raw`)return e;if(n===`__v_skip`)return!0;if(n===`c`||n===`asComponent`)return j(()=>e.value);if(r==null)return n===Symbol.toPrimitive||n===`toString`?()=>``:void 0;let i=r[n];return typeof i==`function`?i.bind(r):i},ownKeys(){let t=e.value;return typeof t==`object`&&t?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}}),N=(e,t)=>{let n=(0,y.inject)(C),r=(0,y.isRef)(n?.locale)?n.locale:(0,y.ref)(n?.locale??h.default.internationalization.defaultLocale),i=(0,y.computed)(()=>(t===void 0?void 0:(0,y.toValue)(t))??r.value),a=(0,y.shallowRef)({});(0,y.watch)([()=>(0,y.toValue)(e),()=>i.value],([e,t])=>{a.value=Q(e,t)},{immediate:!0,flush:`sync`});let o=e=>new Proxy({},{get(t,n,r){if(n===`__v_isRef`)return!0;let i=(0,y.computed)(()=>D(a.value,e));if(n===`value`)return i.value??``;if(n===`then`)return;if(n===`c`||n===`asComponent`)return j(()=>i.value);if(n===`$raw`)return i;if(n===Symbol.toPrimitive)return()=>i.value;let s=e.concat(n),c=D(a.value,s);if(c===void 0||O(c)&&!k(c))return o(s);if(A(c))return M((0,y.computed)(()=>D(a.value,s)));let l=(0,y.computed)(()=>D(a.value,s));return new Proxy(l,{get(e,t,n){return t===`value`?e.value??``:Reflect.get(e,t,n)}})},ownKeys(){let t=D(a.value,e);return O(t)?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return o([])},P=async(e,t)=>{let n=(0,y.inject)(C),r=(0,y.computed)(()=>t??n?.locale?.value??h.default?.internationalization.defaultLocale),i=(0,y.ref)(await e[r.value]?.());return(0,y.watch)(()=>r.value,async t=>{let n=await e[t]?.();n&&(i.value=n)}),N(i,r)},F=async(e,t,n)=>await P(e,n),I=(e,t)=>(0,m.getIntlayer)(e,t,Z(t)),L=(e,t)=>{let n=(0,y.inject)(C),r=(0,y.isRef)(n?.locale)?n.locale:(0,y.ref)(n?.locale??h.default.internationalization.defaultLocale),i=(0,y.computed)(()=>(t===void 0?void 0:(0,y.toValue)(t))??r.value),a=(0,y.shallowRef)({});(0,y.watch)([()=>(0,y.toValue)(e),()=>i.value],([e,t])=>{a.value=I(e,t)},{immediate:!0,flush:`sync`});let o=new Map,s=e=>{let t=e.join(`.`);if(o.has(t))return o.get(t);let n=(0,y.computed)(()=>D(a.value,e)),r=new Proxy({},{get(t,r,i){if(typeof r==`symbol`||typeof r==`string`&&(r.startsWith(`__`)||r.startsWith(`$`)))return r===`__v_isRef`?!0:r===`then`?void 0:Reflect.get(t,r,i);if(r===`value`)return n.value??``;if(r===`c`||r===`asComponent`)return j(()=>n.value);if(r===`$raw`)return n;if(r===Symbol.toPrimitive)return()=>String(n.value??``);let o=e.concat(r),c=D(a.value,o);if(c===void 0||O(c)&&!k(c))return s(o);if(A(c))return M((0,y.computed)(()=>D(a.value,o)));let l=(0,y.computed)(()=>D(a.value,o));return new Proxy(l,{get(e,t,n){return t===`value`?e.value??``:t===`__v_isRef`?!0:Reflect.get(e,t,n)}})},ownKeys(){let t=D(a.value,e);return O(t)?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return o.set(t,r),r};return s([])},R=({isCookieEnabled:e,onLocaleChange:t}={})=>{let{defaultLocale:n,locales:r}=h.default?.internationalization??{},i=(0,y.inject)(C);return{locale:(0,y.computed)(()=>i?.locale?.value??n),defaultLocale:n,availableLocales:r,setLocale:n=>{if(!r?.map(String).includes(n)){console.error(`Locale ${n} is not available`);return}i&&i.setLocale(n),c.setLocaleInStorage(n,e??i?.isCookieEnabled??!0),t?.(n)}}},z=()=>{let{locale:e}=R(),t=h.default?.routing?.rewrite;(0,y.watch)(e,e=>{if(typeof window>`u`||!t)return;let n=window.location.pathname,r=(0,S.getRewritePath)(n,e,t);r&&r!==n&&window.history.replaceState(window.history.state,``,r+window.location.search+window.location.hash)},{immediate:!0})},B=n.createSharedComposable(()=>{let e=(0,y.inject)(C);if(!e)throw Error(`IntlayerEditor state not found`);let[t,n]=i.useCrossFrameState(x.MessageKey.INTLAYER_CURRENT_LOCALE);return(0,y.watch)(e.locale,e=>{n(e)},{immediate:!0}),e}),V=n.createSharedComposable(()=>{o.useConfiguration(),r.useEditorEnabled(),a.useFocusDictionary(),u.useIframeClickMerger(),l.useCrossURLPathSetter(),B(),s.useDictionariesRecord()}),H={key:1,style:{display:`contents`}},U=(0,y.defineComponent)({__name:`ContentSelectorWrapper`,props:{dictionaryKey:{},keyPath:{},plugins:{},locale:{},dictionaryPath:{},children:{}},setup(n){let i=n,o=a.useFocusDictionary(),s=r.useEditorEnabled(),c=e.r();V();let l=(0,y.computed)(()=>i.keyPath.filter(e=>e.type!==v.NodeType.Translation)),u=(0,y.computed)(()=>o?.focusedContent.value?.dictionaryKey===i.dictionaryKey&&(o?.focusedContent.value.keyPath?.length??0)>0&&(0,b.isSameKeyPath)(o?.focusedContent.value.keyPath??[],l.value)),d=()=>{o?.setFocusedContent({dictionaryKey:i.dictionaryKey,keyPath:l.value})},f=()=>{c?.postMessage({type:`${x.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:{dictionaryKey:i.dictionaryKey,keyPath:l.value}})},p=()=>{c?.postMessage({type:`${x.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:null})};return(e,n)=>(0,y.unref)(s)?.enabled.value?((0,y.openBlock)(),(0,y.createBlock)(t.t,{key:0,onPress:d,isSelecting:u.value,onHover:f,onUnhover:p},{default:(0,y.withCtx)(()=>[(0,y.renderSlot)(e.$slots,`default`)]),_:3},8,[`isSelecting`])):((0,y.openBlock)(),(0,y.createElementBlock)(`span`,H,[(0,y.renderSlot)(e.$slots,`default`)]))}}),W={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:t,...n})=>{let r=e=>p.renderIntlayerNode({...n,value:e,children:h.default?.editor.enabled?()=>(0,y.h)(U,{dictionaryKey:n.dictionaryKey,keyPath:n.keyPath},{default:()=>typeof e==`function`?e():e}):e}),i=r(t);if(typeof t!=`function`)return i;let a=(...e)=>r(t(...e));Object.setPrototypeOf(a,Object.getPrototypeOf(i));for(let e of Object.getOwnPropertyNames(i)){let t=Object.getOwnPropertyDescriptor(i,e);t&&Object.defineProperty(a,e,t)}for(let e of Object.getOwnPropertySymbols(i)){let t=Object.getOwnPropertyDescriptor(i,e);t&&Object.defineProperty(a,e,t)}return(0,y.markRaw)(a)}},G=(e,t)=>{let n=new Map,r={};for(let[e,i]of Object.entries(t))typeof i==`string`||typeof i==`number`?r[e]=i:(n.set(e,i),r[e]=`__VNODE_${e}__`);let i=(0,m.splitInsertionTemplate)(e,r);if(n.size>0){let e=[];if(i.isSimple){let t=i.parts,r=0;for(let[i]of n){let a=`__VNODE_${i}__`,o=t.indexOf(a);o!==-1&&(o>r&&e.push(t.substring(r,o)),e.push(n.get(i)),r=o+a.length)}return r<t.length&&e.push(t.substring(r)),(0,y.h)(y.Fragment,null,...e)}else return i.parts.forEach(t=>{if(typeof t==`string`){let r=t;for(let[t]of n){let i=`__VNODE_${t}__`,a=r.indexOf(i);a!==-1&&(a>0&&e.push(r.substring(0,a)),e.push(n.get(t)),r=r.substring(a+i.length))}r.length>0&&e.push(r)}else e.push(t)}),(0,y.h)(y.Fragment,null,...e)}return i.isSimple?i.parts:(0,y.h)(y.Fragment,null,i.parts)},K={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===v.NodeType.Insertion,transform:(e,t,n)=>{let r=[...t.keyPath,{type:v.NodeType.Insertion}],i=e[v.NodeType.Insertion],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,n,r)=>{let i=r(e,{...n,children:e,plugins:[...(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)]});return e=>{let a=G(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}};return n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]})}},q={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,a=n((0,g.getMarkdownMetadata)(e),{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>p.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),o=n=>p.renderIntlayerNode({...t,value:e,children:()=>(0,y.h)(U,{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},{default:()=>{let{renderMarkdown:t,components:r}=f.useMarkdown();return t(e,void 0,{...r??{},...n??{}})}}),additionalProps:{metadata:a}}),s=o();return new Proxy(s,{get(t,n,r){return n===`value`?e:n===`metadata`?a:n===`use`?e=>o(e):Reflect.get(t,n,r)}})}},J={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===v.NodeType.Markdown,transform:(e,t,n)=>{let r=[...t.keyPath,{type:v.NodeType.Markdown}],i=e[v.NodeType.Markdown];return n(i,{...t,children:i,keyPath:r,plugins:[q,...t.plugins??[]]})}},Y=(()=>{let e={};for(let t of _.HTML_TAGS)e[t]=({children:e,...n})=>(0,y.h)(t,n,e);return e})(),X={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===v.NodeType.HTML,transform:(e,t)=>{let n=e[v.NodeType.HTML];e.tags;let r=e=>(0,m.getHTML)(n,{...Y,...e});return p.renderIntlayerNode({...t,value:n,children:e=>r(e)})}},Z=(e,t=!0)=>[(0,m.translationPlugin)(e??h.default.internationalization.defaultLocale,t?h.default.internationalization.defaultLocale:void 0),m.enumerationPlugin,m.conditionPlugin,(0,m.nestedPlugin)(e??h.default.internationalization.defaultLocale),m.filePlugin,m.genderPlugin,W,K,J,X],Q=(e,t)=>(0,m.getDictionary)(e,t,Z(t));Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return k}});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Plugins } from '@intlayer/core/interpreter';
|
|
2
1
|
import { Dictionary } from '@intlayer/types/dictionary';
|
|
3
2
|
import { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
4
3
|
import { DeepTransformContent } from './plugins';
|
|
5
|
-
export declare const getDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L
|
|
4
|
+
export declare const getDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) => DeepTransformContent<T["content"], L>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Plugins } from '@intlayer/core/interpreter';
|
|
2
1
|
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
3
2
|
import { DeepTransformContent } from './plugins';
|
|
4
|
-
export declare const getIntlayer: <T extends DictionaryKeys, L extends LocalesValues = DeclaredLocales>(key: T, locale?: L
|
|
3
|
+
export declare const getIntlayer: <T extends DictionaryKeys, L extends LocalesValues = DeclaredLocales>(key: T, locale?: L) => DeepTransformContent<DictionaryRegistryContent<T>, L>;
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -72,3 +72,8 @@ export type IInterpreterPluginState = Omit<IInterpreterPluginStateCore, 'inserti
|
|
|
72
72
|
vueHtml: true;
|
|
73
73
|
};
|
|
74
74
|
export type DeepTransformContent<T, L extends LocalesValues = DeclaredLocales> = DeepTransformContentCore<T, IInterpreterPluginState, L>;
|
|
75
|
+
/**
|
|
76
|
+
* Get the plugins array for Vue content transformation.
|
|
77
|
+
* This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.
|
|
78
|
+
*/
|
|
79
|
+
export declare const getPlugins: (locale?: LocalesValues, fallback?: boolean) => Plugins[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intlayer",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Vue applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -94,31 +94,31 @@
|
|
|
94
94
|
"typecheck": "vue-tsc --noEmit --project tsconfig.types.json"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@intlayer/api": "8.3.
|
|
98
|
-
"@intlayer/config": "8.3.
|
|
99
|
-
"@intlayer/core": "8.3.
|
|
100
|
-
"@intlayer/editor": "8.3.
|
|
101
|
-
"@intlayer/types": "8.3.
|
|
102
|
-
"@intlayer/unmerged-dictionaries-entry": "8.3.
|
|
97
|
+
"@intlayer/api": "8.3.2",
|
|
98
|
+
"@intlayer/config": "8.3.2",
|
|
99
|
+
"@intlayer/core": "8.3.2",
|
|
100
|
+
"@intlayer/editor": "8.3.2",
|
|
101
|
+
"@intlayer/types": "8.3.2",
|
|
102
|
+
"@intlayer/unmerged-dictionaries-entry": "8.3.2"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@types/node": "25.
|
|
105
|
+
"@types/node": "25.5.0",
|
|
106
106
|
"@utils/ts-config": "1.0.4",
|
|
107
107
|
"@utils/ts-config-types": "1.0.4",
|
|
108
108
|
"@utils/tsdown-config": "1.0.4",
|
|
109
|
-
"@vitejs/plugin-vue": "6.0.
|
|
110
|
-
"ajv": "8.
|
|
109
|
+
"@vitejs/plugin-vue": "6.0.5",
|
|
110
|
+
"ajv": "8.18.0",
|
|
111
111
|
"fast-glob": "3.3.3",
|
|
112
112
|
"rimraf": "6.1.3",
|
|
113
113
|
"tsdown": "0.21.2",
|
|
114
114
|
"typescript": "5.9.3",
|
|
115
|
-
"vite": "
|
|
115
|
+
"vite": "8.0.0",
|
|
116
116
|
"vite-plugin-dts": "4.5.4",
|
|
117
|
-
"vitest": "4.0
|
|
117
|
+
"vitest": "4.1.0",
|
|
118
118
|
"vue-tsc": "3.1.5"
|
|
119
119
|
},
|
|
120
120
|
"peerDependencies": {
|
|
121
|
-
"intlayer": "8.3.
|
|
121
|
+
"intlayer": "8.3.2",
|
|
122
122
|
"vue": ">=3.0.0"
|
|
123
123
|
},
|
|
124
124
|
"peerDependenciesMeta": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),_=250,y=e.defineComponent({__name:"ContentSelector",props:{onClickOutside:{type:Function},pressDuration:{},isSelecting:{type:Boolean}},emits:["click","press","hover","unhover"],setup(m,{emit:h}){const o=m,s=h,i=e.ref(null),t=e.ref(!1),l=e.ref(o.isSelecting??!1),u=e.ref(null),a=e.computed(()=>o.isSelecting??l.value),S=e.computed(()=>{const n=e.useSlots().default?.();return n?.length===1&&typeof n[0].children=="string"}),T=()=>{l.value=!0,s("press")},g=()=>{u.value=setTimeout(()=>{T()},o.pressDuration??_)},r=()=>{u.value&&(clearTimeout(u.value),u.value=null)},c=()=>{r(),g()},d=()=>{t.value&&(t.value=!1,s("unhover")),r()},v=()=>{t.value&&(t.value=!1,s("unhover")),r()},f=n=>{i.value&&!i.value.contains(n.target)&&(l.value=!1,o.onClickOutside?.())},k=n=>{a.value&&(n.preventDefault(),n.stopPropagation())},C=()=>{l.value=!1};return e.onMounted(()=>{document.addEventListener("mousedown",f)}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",f),r()}),(n,p)=>(e.openBlock(),e.createElementBlock("span",{ref_key:"containerRef",ref:i,role:"button",tabindex:"0",onClick:k,onMousedown:c,onMouseup:d,onMouseleave:v,onTouchstart:c,onTouchend:d,onTouchcancel:v,onBlur:C,onMouseenter:p[0]||(p[0]=()=>{t.value=!0,s("hover")}),style:e.normalizeStyle({display:S.value?"inline":"inline-block",cursor:"pointer",userSelect:"none",borderRadius:"0.375rem",outlineWidth:"2px",outlineOffset:"4px",outlineStyle:"solid",outlineColor:a.value||t.value?"inherit":"transparent",transition:"all 100ms 50ms ease-in-out"})},[e.renderSlot(n.$slots,"default")],36))}});exports._sfc_main=y;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { defineComponent as M, ref as u, computed as m, useSlots as _, onMounted as D, onBeforeUnmount as E, openBlock as B, createElementBlock as O, normalizeStyle as R, renderSlot as L } from "vue";
|
|
2
|
-
const P = 250, w = /* @__PURE__ */ M({
|
|
3
|
-
__name: "ContentSelector",
|
|
4
|
-
props: {
|
|
5
|
-
onClickOutside: { type: Function },
|
|
6
|
-
pressDuration: {},
|
|
7
|
-
isSelecting: { type: Boolean }
|
|
8
|
-
},
|
|
9
|
-
emits: ["click", "press", "hover", "unhover"],
|
|
10
|
-
setup(h, { emit: S }) {
|
|
11
|
-
const o = h, t = S, i = u(null), n = u(!1), s = u(o.isSelecting ?? !1), l = u(null), a = m(() => o.isSelecting ?? s.value), T = m(() => {
|
|
12
|
-
const e = _().default?.();
|
|
13
|
-
return e?.length === 1 && typeof e[0].children == "string";
|
|
14
|
-
}), g = () => {
|
|
15
|
-
s.value = !0, t("press");
|
|
16
|
-
}, k = () => {
|
|
17
|
-
l.value = setTimeout(() => {
|
|
18
|
-
g();
|
|
19
|
-
}, o.pressDuration ?? P);
|
|
20
|
-
}, r = () => {
|
|
21
|
-
l.value && (clearTimeout(l.value), l.value = null);
|
|
22
|
-
}, c = () => {
|
|
23
|
-
r(), k();
|
|
24
|
-
}, d = () => {
|
|
25
|
-
n.value && (n.value = !1, t("unhover")), r();
|
|
26
|
-
}, v = () => {
|
|
27
|
-
n.value && (n.value = !1, t("unhover")), r();
|
|
28
|
-
}, p = (e) => {
|
|
29
|
-
i.value && !i.value.contains(e.target) && (s.value = !1, o.onClickOutside?.());
|
|
30
|
-
}, C = (e) => {
|
|
31
|
-
a.value && (e.preventDefault(), e.stopPropagation());
|
|
32
|
-
}, y = () => {
|
|
33
|
-
s.value = !1;
|
|
34
|
-
};
|
|
35
|
-
return D(() => {
|
|
36
|
-
document.addEventListener("mousedown", p);
|
|
37
|
-
}), E(() => {
|
|
38
|
-
document.removeEventListener("mousedown", p), r();
|
|
39
|
-
}), (e, f) => (B(), O("span", {
|
|
40
|
-
ref_key: "containerRef",
|
|
41
|
-
ref: i,
|
|
42
|
-
role: "button",
|
|
43
|
-
tabindex: "0",
|
|
44
|
-
onClick: C,
|
|
45
|
-
onMousedown: c,
|
|
46
|
-
onMouseup: d,
|
|
47
|
-
onMouseleave: v,
|
|
48
|
-
onTouchstart: c,
|
|
49
|
-
onTouchend: d,
|
|
50
|
-
onTouchcancel: v,
|
|
51
|
-
onBlur: y,
|
|
52
|
-
onMouseenter: f[0] || (f[0] = () => {
|
|
53
|
-
n.value = !0, t("hover");
|
|
54
|
-
}),
|
|
55
|
-
style: R({
|
|
56
|
-
display: T.value ? "inline" : "inline-block",
|
|
57
|
-
cursor: "pointer",
|
|
58
|
-
userSelect: "none",
|
|
59
|
-
borderRadius: "0.375rem",
|
|
60
|
-
outlineWidth: "2px",
|
|
61
|
-
outlineOffset: "4px",
|
|
62
|
-
outlineStyle: "solid",
|
|
63
|
-
outlineColor: a.value || n.value ? "inherit" : "transparent",
|
|
64
|
-
transition: "all 100ms 50ms ease-in-out"
|
|
65
|
-
})
|
|
66
|
-
}, [
|
|
67
|
-
L(e.$slots, "default")
|
|
68
|
-
], 36));
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
export {
|
|
72
|
-
w as _
|
|
73
|
-
};
|