@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 CHANGED
@@ -1,67 +1,67 @@
1
1
  import "./style.css";
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
- import { Popover as T } from "@opentiny/vue";
4
- import { constants as Q } from "@opentiny/tiny-engine-utils";
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
- function k(e) {
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 M(e) {
11
+ function Q(e) {
12
12
  return I() ? (b(e), !0) : !1;
13
13
  }
14
14
  function C(e, n = !0) {
15
- w() ? N(e) : n ? e() : E(e);
15
+ h() ? w(e) : n ? e() : y(e);
16
16
  }
17
- const A = h ? window : void 0;
18
- function V(e, n = !1) {
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 U = (e) => {
22
+ const A = (e) => {
23
23
  const {
24
24
  name: n,
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;
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
- 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;
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
- }), M(() => {
40
- d();
39
+ }), Q(() => {
40
+ c();
41
41
  }), {
42
42
  isSupported: a,
43
- channel: o,
44
- data: l,
45
- post: c,
46
- close: d,
47
- error: u,
48
- isClosed: s
43
+ channel: s,
44
+ data: u,
45
+ post: m,
46
+ close: c,
47
+ error: i,
48
+ isClosed: o
49
49
  };
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;
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
- })(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) => {
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
- 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]);
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 W = {
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
- R({
91
- linear: k
92
- }, W);
93
- const j = (e, n) => {
90
+ D({
91
+ linear: L
92
+ }, H);
93
+ const M = (e, n) => {
94
94
  const t = e.__vccOpts || e;
95
- for (const [a, s] of n)
96
- t[a] = s;
95
+ for (const [a, o] of n)
96
+ t[a] = o;
97
97
  return t;
98
- }, { BROADCAST_CHANNEL: F } = Q, G = {
98
+ }, { BROADCAST_CHANNEL: R } = T, V = {
99
99
  components: {
100
- TinyPopover: T
100
+ ToolbarBase: P
101
101
  },
102
102
  props: {
103
103
  langChannel: {
104
104
  type: String,
105
- default: F.CanvasLang
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 } = U({ name: e.langChannel });
110
- S(a, () => {
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 s = {
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
- options: o,
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
- }, 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, {
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
- disabled: !0
145
- }, {
146
- reference: x(() => [
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))
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 J = /* @__PURE__ */ j(G, [["render", q], ["__scopeId", "data-v-29565dbb"]]), X = {
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
- align: "right",
166
- icon: "",
167
- collapsed: !0,
168
- splitLine: !0
169
- }, ne = {
170
- ...X,
171
- entry: J
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
- ne as default
162
+ Y as default
175
163
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
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)}
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.2",
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-utils": "2.0.0-alpha.2",
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.2",
32
- "@vitejs/plugin-vue": "^4.2.3",
33
- "@vitejs/plugin-vue-jsx": "^3.1.0",
34
- "vite": "^4.3.7"
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": "695ecd00f21aa39965a9ddb02590ae274f92cd8e"
42
+ "gitHead": "20aba1ffa81a1633feec954e3146586193c18f22"
41
43
  }