@opentiny/tiny-engine-toolbar-lang 2.6.1 → 2.7.0-alpha.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/index.js +105 -83
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,67 +1,80 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { callEntry as h } from "@opentiny/tiny-engine-meta-register";
|
|
3
|
+
import { getCurrentInstance as E, onMounted as B, nextTick as N, getCurrentScope as P, onScopeDispose as S, ref as r, watch as T, resolveComponent as L, createBlock as x, openBlock as Q } from "vue";
|
|
4
|
+
import { ToolbarBase as d } from "@opentiny/tiny-engine-common";
|
|
5
|
+
import { constants as b } from "@opentiny/tiny-engine-utils";
|
|
6
|
+
const k = {
|
|
7
|
+
id: "engine.toolbars.lang",
|
|
8
|
+
type: "toolbars",
|
|
9
|
+
title: "lang",
|
|
10
|
+
options: {
|
|
11
|
+
icon: {
|
|
12
|
+
default: "cn-en"
|
|
13
|
+
},
|
|
14
|
+
renderType: "icon",
|
|
15
|
+
collapsed: !0
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var p;
|
|
19
|
+
const y = typeof window < "u";
|
|
20
|
+
y && ((p = window == null ? void 0 : window.navigator) != null && p.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
21
|
+
function A(e) {
|
|
9
22
|
return e;
|
|
10
23
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
24
|
+
function D(e) {
|
|
25
|
+
return P() ? (S(e), !0) : !1;
|
|
13
26
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
27
|
+
function I(e, n = !0) {
|
|
28
|
+
E() ? B(e) : n ? e() : N(e);
|
|
16
29
|
}
|
|
17
|
-
const
|
|
18
|
-
function
|
|
30
|
+
const M = y ? window : void 0;
|
|
31
|
+
function j(e, n = !1) {
|
|
19
32
|
const t = r(), a = () => t.value = !!e();
|
|
20
|
-
return a(),
|
|
33
|
+
return a(), I(a, n), t;
|
|
21
34
|
}
|
|
22
|
-
const
|
|
35
|
+
const f = (e) => {
|
|
23
36
|
const {
|
|
24
37
|
name: n,
|
|
25
|
-
window: t =
|
|
26
|
-
} = e, a =
|
|
27
|
-
|
|
38
|
+
window: t = M
|
|
39
|
+
} = e, a = j(() => t && "BroadcastChannel" in t), s = r(!1), o = r(), u = r(), i = r(null), w = (l) => {
|
|
40
|
+
o.value && o.value.postMessage(l);
|
|
28
41
|
}, c = () => {
|
|
29
|
-
|
|
42
|
+
o.value && o.value.close(), s.value = !0;
|
|
30
43
|
};
|
|
31
|
-
return a.value &&
|
|
32
|
-
i.value = null,
|
|
33
|
-
|
|
34
|
-
}, { passive: !0 }),
|
|
35
|
-
i.value =
|
|
36
|
-
}, { passive: !0 }),
|
|
37
|
-
|
|
44
|
+
return a.value && I(() => {
|
|
45
|
+
i.value = null, o.value = new BroadcastChannel(n), o.value.addEventListener("message", (l) => {
|
|
46
|
+
u.value = l.data;
|
|
47
|
+
}, { passive: !0 }), o.value.addEventListener("messageerror", (l) => {
|
|
48
|
+
i.value = l;
|
|
49
|
+
}, { passive: !0 }), o.value.addEventListener("close", () => {
|
|
50
|
+
s.value = !0;
|
|
38
51
|
});
|
|
39
|
-
}),
|
|
52
|
+
}), D(() => {
|
|
40
53
|
c();
|
|
41
54
|
}), {
|
|
42
55
|
isSupported: a,
|
|
43
|
-
channel:
|
|
44
|
-
data:
|
|
45
|
-
post:
|
|
56
|
+
channel: o,
|
|
57
|
+
data: u,
|
|
58
|
+
post: w,
|
|
46
59
|
close: c,
|
|
47
60
|
error: i,
|
|
48
|
-
isClosed:
|
|
61
|
+
isClosed: s
|
|
49
62
|
};
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
var
|
|
63
|
+
}, v = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, _ = "__vueuse_ssr_handlers__";
|
|
64
|
+
v[_] = v[_] || {};
|
|
65
|
+
var g;
|
|
53
66
|
(function(e) {
|
|
54
67
|
e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
|
|
55
|
-
})(
|
|
56
|
-
var
|
|
68
|
+
})(g || (g = {}));
|
|
69
|
+
var H = Object.defineProperty, O = Object.getOwnPropertySymbols, R = Object.prototype.hasOwnProperty, U = Object.prototype.propertyIsEnumerable, m = (e, n, t) => n in e ? H(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, W = (e, n) => {
|
|
57
70
|
for (var t in n || (n = {}))
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
for (var t of
|
|
61
|
-
|
|
71
|
+
R.call(n, t) && m(e, t, n[t]);
|
|
72
|
+
if (O)
|
|
73
|
+
for (var t of O(n))
|
|
74
|
+
U.call(n, t) && m(e, t, n[t]);
|
|
62
75
|
return e;
|
|
63
76
|
};
|
|
64
|
-
const
|
|
77
|
+
const z = {
|
|
65
78
|
easeInSine: [0.12, 0, 0.39, 0],
|
|
66
79
|
easeOutSine: [0.61, 1, 0.88, 1],
|
|
67
80
|
easeInOutSine: [0.37, 0, 0.63, 1],
|
|
@@ -87,17 +100,19 @@ const R = {
|
|
|
87
100
|
easeOutBack: [0.34, 1.56, 0.64, 1],
|
|
88
101
|
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
|
89
102
|
};
|
|
90
|
-
|
|
91
|
-
linear:
|
|
92
|
-
},
|
|
93
|
-
const {
|
|
103
|
+
W({
|
|
104
|
+
linear: A
|
|
105
|
+
}, z);
|
|
106
|
+
const {
|
|
107
|
+
BROADCAST_CHANNEL: C
|
|
108
|
+
} = b, F = {
|
|
94
109
|
components: {
|
|
95
|
-
ToolbarBase:
|
|
110
|
+
ToolbarBase: d
|
|
96
111
|
},
|
|
97
112
|
props: {
|
|
98
113
|
langChannel: {
|
|
99
114
|
type: String,
|
|
100
|
-
default:
|
|
115
|
+
default: C.CanvasLang
|
|
101
116
|
},
|
|
102
117
|
options: {
|
|
103
118
|
type: Object,
|
|
@@ -105,59 +120,66 @@ const { BROADCAST_CHANNEL: U } = T, W = {
|
|
|
105
120
|
}
|
|
106
121
|
},
|
|
107
122
|
setup(e) {
|
|
108
|
-
const n = r("zh_CN"), {
|
|
109
|
-
|
|
123
|
+
const n = r("zh_CN"), {
|
|
124
|
+
post: t,
|
|
125
|
+
data: a
|
|
126
|
+
} = f({
|
|
127
|
+
name: e.langChannel
|
|
128
|
+
});
|
|
129
|
+
T(a, () => {
|
|
110
130
|
n.value = a.value;
|
|
111
131
|
});
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
132
|
+
const s = [{
|
|
133
|
+
value: "zh_CN",
|
|
134
|
+
label: "中文"
|
|
135
|
+
}, {
|
|
136
|
+
value: "en_US",
|
|
137
|
+
label: "English"
|
|
138
|
+
}], o = h(() => {
|
|
139
|
+
n.value = n.value === s[0].value ? s[1].value : s[0].value, t(n.value);
|
|
140
|
+
}, {
|
|
141
|
+
metaData: {
|
|
142
|
+
id: "engine.toolbars.lang.Main.changeLang"
|
|
116
143
|
},
|
|
117
|
-
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
144
|
+
ctx: () => ({
|
|
145
|
+
props: e,
|
|
146
|
+
langVal: n,
|
|
147
|
+
post: t,
|
|
148
|
+
data: a,
|
|
149
|
+
langOptions: s,
|
|
150
|
+
changeLang: o,
|
|
151
|
+
useBroadcastChannel: f,
|
|
152
|
+
ToolbarBase: d,
|
|
153
|
+
constants: b,
|
|
154
|
+
BROADCAST_CHANNEL: C
|
|
155
|
+
})
|
|
156
|
+
});
|
|
122
157
|
return {
|
|
123
|
-
langOptions:
|
|
158
|
+
langOptions: s,
|
|
124
159
|
langVal: n,
|
|
125
|
-
changeLang:
|
|
126
|
-
n.value = n.value === o[0].value ? o[1].value : o[0].value, t(n.value);
|
|
127
|
-
}
|
|
160
|
+
changeLang: o
|
|
128
161
|
};
|
|
129
162
|
}
|
|
130
|
-
},
|
|
163
|
+
}, G = (e, n) => {
|
|
131
164
|
const t = e.__vccOpts || e;
|
|
132
|
-
for (const [a,
|
|
133
|
-
t[a] =
|
|
165
|
+
for (const [a, s] of n)
|
|
166
|
+
t[a] = s;
|
|
134
167
|
return t;
|
|
135
168
|
};
|
|
136
|
-
function
|
|
137
|
-
const
|
|
138
|
-
return
|
|
169
|
+
function V(e, n, t, a, s, o) {
|
|
170
|
+
const u = L("toolbar-base");
|
|
171
|
+
return Q(), x(u, {
|
|
139
172
|
content: "中英文切换",
|
|
140
173
|
icon: t.options.icon.default || t.options.icon,
|
|
141
174
|
options: t.options,
|
|
142
175
|
onClickApi: a.changeLang
|
|
143
176
|
}, null, 8, ["icon", "options", "onClickApi"]);
|
|
144
177
|
}
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
title: "lang",
|
|
149
|
-
options: {
|
|
150
|
-
icon: {
|
|
151
|
-
default: "cn-en"
|
|
152
|
-
},
|
|
153
|
-
renderType: "icon",
|
|
154
|
-
collapsed: !0
|
|
155
|
-
}
|
|
156
|
-
}, Y = {
|
|
157
|
-
...V,
|
|
158
|
-
entry: G
|
|
178
|
+
const K = /* @__PURE__ */ G(F, [["render", V], ["__scopeId", "data-v-10c1f968"]]), $ = {
|
|
179
|
+
...k,
|
|
180
|
+
entry: K
|
|
159
181
|
};
|
|
160
182
|
export {
|
|
161
|
-
|
|
183
|
+
$ as default
|
|
162
184
|
};
|
|
163
185
|
//# sourceMappingURL=index.js.map
|