@opentiny/tiny-engine-toolbar-lang 2.6.1 → 2.7.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 CHANGED
@@ -1,67 +1,80 @@
1
1
  import "./style.css";
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) {
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 Q(e) {
12
- return y() ? (h(e), !0) : !1;
24
+ function D(e) {
25
+ return P() ? (S(e), !0) : !1;
13
26
  }
14
- function C(e, n = !0) {
15
- I() ? b(e) : n ? e() : w(e);
27
+ function I(e, n = !0) {
28
+ E() ? B(e) : n ? e() : N(e);
16
29
  }
17
- const x = O ? window : void 0;
18
- function k(e, n = !1) {
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(), C(a, n), t;
33
+ return a(), I(a, n), t;
21
34
  }
22
- const A = (e) => {
35
+ const f = (e) => {
23
36
  const {
24
37
  name: n,
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);
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
- s.value && s.value.close(), o.value = !0;
42
+ o.value && o.value.close(), s.value = !0;
30
43
  };
31
- return a.value && C(() => {
32
- i.value = null, s.value = new BroadcastChannel(n), s.value.addEventListener("message", (u) => {
33
- l.value = u.data;
34
- }, { passive: !0 }), s.value.addEventListener("messageerror", (u) => {
35
- i.value = u;
36
- }, { passive: !0 }), s.value.addEventListener("close", () => {
37
- o.value = !0;
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
- }), Q(() => {
52
+ }), D(() => {
40
53
  c();
41
54
  }), {
42
55
  isSupported: a,
43
- channel: s,
44
- data: l,
45
- post: m,
56
+ channel: o,
57
+ data: u,
58
+ post: w,
46
59
  close: c,
47
60
  error: i,
48
- isClosed: o
61
+ isClosed: s
49
62
  };
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;
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
- })(f || (f = {}));
56
- var j = Object.defineProperty, _ = Object.getOwnPropertySymbols, D = Object.prototype.hasOwnProperty, H = Object.prototype.propertyIsEnumerable, g = (e, n, t) => n in e ? j(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, M = (e, n) => {
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
- D.call(n, t) && g(e, t, n[t]);
59
- if (_)
60
- for (var t of _(n))
61
- H.call(n, t) && g(e, t, n[t]);
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 R = {
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
- M({
91
- linear: L
92
- }, R);
93
- const { BROADCAST_CHANNEL: U } = T, W = {
103
+ W({
104
+ linear: A
105
+ }, z);
106
+ const {
107
+ BROADCAST_CHANNEL: C
108
+ } = b, F = {
94
109
  components: {
95
- ToolbarBase: S
110
+ ToolbarBase: d
96
111
  },
97
112
  props: {
98
113
  langChannel: {
99
114
  type: String,
100
- default: U.CanvasLang
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"), { post: t, data: a } = A({ name: e.langChannel });
109
- E(a, () => {
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 o = [
113
- {
114
- value: "zh_CN",
115
- label: "中文"
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
- value: "en_US",
119
- label: "English"
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: o,
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
- }, z = (e, n) => {
163
+ }, G = (e, n) => {
131
164
  const t = e.__vccOpts || e;
132
- for (const [a, o] of n)
133
- t[a] = o;
165
+ for (const [a, s] of n)
166
+ t[a] = s;
134
167
  return t;
135
168
  };
136
- function F(e, n, t, a, o, s) {
137
- const l = B("toolbar-base");
138
- return P(), N(l, {
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 G = /* @__PURE__ */ z(W, [["render", F], ["__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
178
+ const K = /* @__PURE__ */ G(F, [["render", V], ["__scopeId", "data-v-10c1f968"]]), $ = {
179
+ ...k,
180
+ entry: K
159
181
  };
160
182
  export {
161
- Y as default
183
+ $ as default
162
184
  };
163
185
  //# sourceMappingURL=index.js.map