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