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