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