@opentiny/tiny-engine-toolbar-lang 1.0.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 +161 -0
- package/dist/style.css +1 -0
- package/package.json +26 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import "./style.css";
|
|
2
|
+
import { getCurrentScope as C, onScopeDispose as w, getCurrentInstance as I, onMounted as b, nextTick as E, ref as r, watch as N, resolveComponent as p, openBlock as P, createBlock as S, withCtx as x, createElementVNode as B, createVNode as L } from "vue";
|
|
3
|
+
import { Popover as T } from "@opentiny/vue";
|
|
4
|
+
import { constants as Q } from "@opentiny/tiny-engine-utils";
|
|
5
|
+
var d;
|
|
6
|
+
const m = typeof window < "u";
|
|
7
|
+
m && ((d = window == null ? void 0 : window.navigator) != null && d.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
8
|
+
function k(e) {
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
function A(e) {
|
|
12
|
+
return C() ? (w(e), !0) : !1;
|
|
13
|
+
}
|
|
14
|
+
function h(e, n = !0) {
|
|
15
|
+
I() ? b(e) : n ? e() : E(e);
|
|
16
|
+
}
|
|
17
|
+
const V = m ? window : void 0;
|
|
18
|
+
function M(e, n = !1) {
|
|
19
|
+
const t = r(), a = () => t.value = !!e();
|
|
20
|
+
return a(), h(a, n), t;
|
|
21
|
+
}
|
|
22
|
+
const H = (e) => {
|
|
23
|
+
const {
|
|
24
|
+
name: n,
|
|
25
|
+
window: t = V
|
|
26
|
+
} = e, a = M(() => t && "BroadcastChannel" in t), o = r(!1), s = r(), c = r(), l = r(null), y = (u) => {
|
|
27
|
+
s.value && s.value.postMessage(u);
|
|
28
|
+
}, i = () => {
|
|
29
|
+
s.value && s.value.close(), o.value = !0;
|
|
30
|
+
};
|
|
31
|
+
return a.value && h(() => {
|
|
32
|
+
l.value = null, s.value = new BroadcastChannel(n), s.value.addEventListener("message", (u) => {
|
|
33
|
+
c.value = u.data;
|
|
34
|
+
}, { passive: !0 }), s.value.addEventListener("messageerror", (u) => {
|
|
35
|
+
l.value = u;
|
|
36
|
+
}, { passive: !0 }), s.value.addEventListener("close", () => {
|
|
37
|
+
o.value = !0;
|
|
38
|
+
});
|
|
39
|
+
}), A(() => {
|
|
40
|
+
i();
|
|
41
|
+
}), {
|
|
42
|
+
isSupported: a,
|
|
43
|
+
channel: s,
|
|
44
|
+
data: c,
|
|
45
|
+
post: y,
|
|
46
|
+
close: i,
|
|
47
|
+
error: l,
|
|
48
|
+
isClosed: o
|
|
49
|
+
};
|
|
50
|
+
}, v = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, _ = "__vueuse_ssr_handlers__";
|
|
51
|
+
v[_] = v[_] || {};
|
|
52
|
+
var f;
|
|
53
|
+
(function(e) {
|
|
54
|
+
e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
|
|
55
|
+
})(f || (f = {}));
|
|
56
|
+
var R = Object.defineProperty, g = Object.getOwnPropertySymbols, U = Object.prototype.hasOwnProperty, W = Object.prototype.propertyIsEnumerable, O = (e, n, t) => n in e ? R(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, j = (e, n) => {
|
|
57
|
+
for (var t in n || (n = {}))
|
|
58
|
+
U.call(n, t) && O(e, t, n[t]);
|
|
59
|
+
if (g)
|
|
60
|
+
for (var t of g(n))
|
|
61
|
+
W.call(n, t) && O(e, t, n[t]);
|
|
62
|
+
return e;
|
|
63
|
+
};
|
|
64
|
+
const z = {
|
|
65
|
+
easeInSine: [0.12, 0, 0.39, 0],
|
|
66
|
+
easeOutSine: [0.61, 1, 0.88, 1],
|
|
67
|
+
easeInOutSine: [0.37, 0, 0.63, 1],
|
|
68
|
+
easeInQuad: [0.11, 0, 0.5, 0],
|
|
69
|
+
easeOutQuad: [0.5, 1, 0.89, 1],
|
|
70
|
+
easeInOutQuad: [0.45, 0, 0.55, 1],
|
|
71
|
+
easeInCubic: [0.32, 0, 0.67, 0],
|
|
72
|
+
easeOutCubic: [0.33, 1, 0.68, 1],
|
|
73
|
+
easeInOutCubic: [0.65, 0, 0.35, 1],
|
|
74
|
+
easeInQuart: [0.5, 0, 0.75, 0],
|
|
75
|
+
easeOutQuart: [0.25, 1, 0.5, 1],
|
|
76
|
+
easeInOutQuart: [0.76, 0, 0.24, 1],
|
|
77
|
+
easeInQuint: [0.64, 0, 0.78, 0],
|
|
78
|
+
easeOutQuint: [0.22, 1, 0.36, 1],
|
|
79
|
+
easeInOutQuint: [0.83, 0, 0.17, 1],
|
|
80
|
+
easeInExpo: [0.7, 0, 0.84, 0],
|
|
81
|
+
easeOutExpo: [0.16, 1, 0.3, 1],
|
|
82
|
+
easeInOutExpo: [0.87, 0, 0.13, 1],
|
|
83
|
+
easeInCirc: [0.55, 0, 1, 0.45],
|
|
84
|
+
easeOutCirc: [0, 0.55, 0.45, 1],
|
|
85
|
+
easeInOutCirc: [0.85, 0, 0.15, 1],
|
|
86
|
+
easeInBack: [0.36, 0, 0.66, -0.56],
|
|
87
|
+
easeOutBack: [0.34, 1.56, 0.64, 1],
|
|
88
|
+
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
|
89
|
+
};
|
|
90
|
+
j({
|
|
91
|
+
linear: k
|
|
92
|
+
}, z);
|
|
93
|
+
const D = (e, n) => {
|
|
94
|
+
const t = e.__vccOpts || e;
|
|
95
|
+
for (const [a, o] of n)
|
|
96
|
+
t[a] = o;
|
|
97
|
+
return t;
|
|
98
|
+
}, { BROADCAST_CHANNEL: F } = Q, G = {
|
|
99
|
+
components: {
|
|
100
|
+
TinyPopover: T
|
|
101
|
+
},
|
|
102
|
+
props: {
|
|
103
|
+
langChannel: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: F.CanvasLang
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
setup(e) {
|
|
109
|
+
const n = r("zh_CN"), { post: t, data: a } = H({ name: e.langChannel });
|
|
110
|
+
N(a, () => {
|
|
111
|
+
n.value = a.value;
|
|
112
|
+
});
|
|
113
|
+
const o = [
|
|
114
|
+
{
|
|
115
|
+
value: "zh_CN",
|
|
116
|
+
label: "中文"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
value: "en_US",
|
|
120
|
+
label: "English"
|
|
121
|
+
}
|
|
122
|
+
];
|
|
123
|
+
return {
|
|
124
|
+
options: o,
|
|
125
|
+
langVal: n,
|
|
126
|
+
changeLang: () => {
|
|
127
|
+
n.value = n.value === o[0].value ? o[1].value : o[0].value, t(n.value);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}, K = { class: "icon" };
|
|
132
|
+
function $(e, n, t, a, o, s) {
|
|
133
|
+
const c = p("svg-icon"), l = p("tiny-popover");
|
|
134
|
+
return P(), S(l, {
|
|
135
|
+
trigger: "hover",
|
|
136
|
+
"open-delay": 1e3,
|
|
137
|
+
"popper-class": "toolbar-right-popover",
|
|
138
|
+
"append-to-body": "",
|
|
139
|
+
content: "画布中英文切换"
|
|
140
|
+
}, {
|
|
141
|
+
reference: x(() => [
|
|
142
|
+
B("span", K, [
|
|
143
|
+
L(c, {
|
|
144
|
+
name: a.langVal === a.options[0].value ? "cn" : "en",
|
|
145
|
+
onClick: a.changeLang
|
|
146
|
+
}, null, 8, ["name", "onClick"])
|
|
147
|
+
])
|
|
148
|
+
]),
|
|
149
|
+
_: 1
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const q = /* @__PURE__ */ D(G, [["render", $], ["__scopeId", "data-v-a2e440c1"]]), ee = {
|
|
153
|
+
id: "lang",
|
|
154
|
+
title: "lang",
|
|
155
|
+
icon: "",
|
|
156
|
+
align: "right",
|
|
157
|
+
component: q
|
|
158
|
+
};
|
|
159
|
+
export {
|
|
160
|
+
ee as default
|
|
161
|
+
};
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.change-lang-box svg[data-v-a2e440c1]{color:var(--ti-lowcode-toolbar-title-color);width:18px;height:18px}.change-lang-box svg[data-v-a2e440c1]:hover{opacity:.75}.icon[data-v-a2e440c1]{color:var(--ti-lowcode-toolbar-title-color)}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentiny/tiny-engine-toolbar-lang",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "vite build"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"module": "dist/index.js",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@opentiny/tiny-engine-utils": "^1.0.0",
|
|
17
|
+
"@opentiny/vue": "^3.8.0",
|
|
18
|
+
"@vueuse/core": "^9.6.0",
|
|
19
|
+
"vue": "3.2.45"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@vitejs/plugin-vue": "^4.2.3",
|
|
23
|
+
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
|
24
|
+
"vite": "^4.3.7"
|
|
25
|
+
}
|
|
26
|
+
}
|