@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 CHANGED
@@ -1,80 +1,67 @@
1
1
  import "./style.css";
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) {
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 D(e) {
25
- return S() ? (T(e), !0) : !1;
11
+ function Q(e) {
12
+ return y() ? (h(e), !0) : !1;
26
13
  }
27
- function w(e, n = !0) {
28
- B() ? N(e) : n ? e() : P(e);
14
+ function C(e, n = !0) {
15
+ I() ? b(e) : n ? e() : w(e);
29
16
  }
30
- const j = I ? window : void 0;
31
- function F(e, n = !1) {
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(), w(a, n), t;
20
+ return a(), C(a, n), t;
34
21
  }
35
- const f = (e) => {
22
+ const A = (e) => {
36
23
  const {
37
24
  name: n,
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);
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
- o.value && o.value.close(), s.value = !0;
29
+ s.value && s.value.close(), o.value = !0;
43
30
  };
44
- return a.value && w(() => {
45
- i.value = null, o.value = new BroadcastChannel(n), o.value.addEventListener("message", (u) => {
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 }), o.value.addEventListener("messageerror", (u) => {
34
+ }, { passive: !0 }), s.value.addEventListener("messageerror", (u) => {
48
35
  i.value = u;
49
- }, { passive: !0 }), o.value.addEventListener("close", () => {
50
- s.value = !0;
36
+ }, { passive: !0 }), s.value.addEventListener("close", () => {
37
+ o.value = !0;
51
38
  });
52
- }), D(() => {
39
+ }), Q(() => {
53
40
  c();
54
41
  }), {
55
42
  isSupported: a,
56
- channel: o,
43
+ channel: s,
57
44
  data: l,
58
- post: h,
45
+ post: m,
59
46
  close: c,
60
47
  error: i,
61
- isClosed: s
48
+ isClosed: o
62
49
  };
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;
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
- })(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) => {
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
- 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]);
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 W = {
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
- U({
104
- linear: A
105
- }, W);
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: d
95
+ ToolbarBase: S
111
96
  },
112
97
  props: {
113
98
  langChannel: {
114
99
  type: String,
115
- default: C.CanvasLang
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
- post: t,
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 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`
112
+ const o = [
113
+ {
114
+ value: "zh_CN",
115
+ label: "中文"
143
116
  },
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
- });
117
+ {
118
+ value: "en_US",
119
+ label: "English"
120
+ }
121
+ ];
157
122
  return {
158
- langOptions: s,
123
+ langOptions: o,
159
124
  langVal: n,
160
- changeLang: o
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
- }, G = (e, n) => {
130
+ }, W = (e, n) => {
164
131
  const t = e.__vccOpts || e;
165
- for (const [a, s] of n)
166
- t[a] = s;
132
+ for (const [a, o] of n)
133
+ t[a] = o;
167
134
  return t;
168
135
  };
169
- function V(e, n, t, a, s, o) {
170
- const l = x("toolbar-base");
171
- return k(), Q(l, {
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 K = /* @__PURE__ */ G(z, [["render", V], ["__scopeId", "data-v-f5c2b547"]]), Z = {
179
- ...y,
180
- entry: K
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
- Z as default
161
+ Y as default
184
162
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
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)}
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.0",
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.0",
29
- "@opentiny/tiny-engine-utils": "2.5.0-alpha.0",
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.0",
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": "ae59c82734d79f650c9221cb9702714814b099c8"
42
+ "gitHead": "f5707c379397bffc9a63c50c695f3ee3340ad0c6"
43
43
  }