@opentiny/tiny-engine-toolbar-lang 2.4.0 → 2.5.0-alpha.0
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 +102 -80
- package/dist/style.css +1 -1
- package/package.json +5 -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 E } from "@opentiny/tiny-engine-meta-register";
|
|
3
|
+
import { getCurrentInstance as B, onMounted as N, nextTick as P, getCurrentScope as S, onScopeDispose as T, ref as r, watch as L, resolveComponent as x, createBlock as Q, openBlock as k } from "vue";
|
|
4
|
+
import { ToolbarBase as d } from "@opentiny/tiny-engine-common";
|
|
5
|
+
import { constants as b } from "@opentiny/tiny-engine-utils";
|
|
6
|
+
const y = {
|
|
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 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) {
|
|
9
22
|
return e;
|
|
10
23
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
24
|
+
function D(e) {
|
|
25
|
+
return S() ? (T(e), !0) : !1;
|
|
13
26
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
27
|
+
function w(e, n = !0) {
|
|
28
|
+
B() ? N(e) : n ? e() : P(e);
|
|
16
29
|
}
|
|
17
|
-
const
|
|
18
|
-
function
|
|
30
|
+
const j = I ? window : void 0;
|
|
31
|
+
function F(e, n = !1) {
|
|
19
32
|
const t = r(), a = () => t.value = !!e();
|
|
20
|
-
return a(),
|
|
33
|
+
return a(), w(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 = j
|
|
39
|
+
} = e, a = F(() => t && "BroadcastChannel" in t), s = r(!1), o = r(), l = r(), i = r(null), h = (u) => {
|
|
40
|
+
o.value && o.value.postMessage(u);
|
|
28
41
|
}, c = () => {
|
|
29
|
-
|
|
42
|
+
o.value && o.value.close(), s.value = !0;
|
|
30
43
|
};
|
|
31
|
-
return a.value &&
|
|
32
|
-
i.value = null,
|
|
44
|
+
return a.value && w(() => {
|
|
45
|
+
i.value = null, o.value = new BroadcastChannel(n), o.value.addEventListener("message", (u) => {
|
|
33
46
|
l.value = u.data;
|
|
34
|
-
}, { passive: !0 }),
|
|
47
|
+
}, { passive: !0 }), o.value.addEventListener("messageerror", (u) => {
|
|
35
48
|
i.value = u;
|
|
36
|
-
}, { passive: !0 }),
|
|
37
|
-
|
|
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:
|
|
56
|
+
channel: o,
|
|
44
57
|
data: l,
|
|
45
|
-
post:
|
|
58
|
+
post: h,
|
|
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, M = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable, m = (e, n, t) => n in e ? H(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, U = (e, n) => {
|
|
57
70
|
for (var t in n || (n = {}))
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
for (var t of
|
|
61
|
-
|
|
71
|
+
M.call(n, t) && m(e, t, n[t]);
|
|
72
|
+
if (O)
|
|
73
|
+
for (var t of O(n))
|
|
74
|
+
R.call(n, t) && m(e, t, n[t]);
|
|
62
75
|
return e;
|
|
63
76
|
};
|
|
64
|
-
const
|
|
77
|
+
const W = {
|
|
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 M = {
|
|
|
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
|
+
U({
|
|
104
|
+
linear: A
|
|
105
|
+
}, W);
|
|
106
|
+
const {
|
|
107
|
+
BROADCAST_CHANNEL: C
|
|
108
|
+
} = b, z = {
|
|
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,58 +120,65 @@ const { BROADCAST_CHANNEL: R } = T, U = {
|
|
|
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
|
+
L(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 = 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`
|
|
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 l =
|
|
138
|
-
return
|
|
169
|
+
function V(e, n, t, a, s, o) {
|
|
170
|
+
const l = x("toolbar-base");
|
|
171
|
+
return k(), Q(l, {
|
|
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(z, [["render", V], ["__scopeId", "data-v-f5c2b547"]]), Z = {
|
|
179
|
+
...y,
|
|
180
|
+
entry: K
|
|
159
181
|
};
|
|
160
182
|
export {
|
|
161
|
-
|
|
183
|
+
Z as default
|
|
162
184
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.change-lang-box svg[data-v-
|
|
1
|
+
.change-lang-box svg[data-v-f5c2b547]{color:var(--te-toolbars-lang-text-color);width:18px;height:18px}.change-lang-box svg[data-v-f5c2b547]:hover{opacity:.75}.icon[data-v-f5c2b547]{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.
|
|
3
|
+
"version": "2.5.0-alpha.0",
|
|
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.
|
|
29
|
-
"@opentiny/tiny-engine-utils": "2.
|
|
28
|
+
"@opentiny/tiny-engine-common": "2.5.0-alpha.0",
|
|
29
|
+
"@opentiny/tiny-engine-utils": "2.5.0-alpha.0",
|
|
30
30
|
"@vueuse/core": "^9.6.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.
|
|
33
|
+
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.0",
|
|
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": "ae59c82734d79f650c9221cb9702714814b099c8"
|
|
43
43
|
}
|