@opentiny/tiny-engine-toolbar-view-setting 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.
Files changed (2) hide show
  1. package/dist/index.js +81 -109
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1,79 +1,66 @@
1
- import { callEntry as M } from "@opentiny/tiny-engine-meta-register";
2
- import { getCurrentInstance as V, onMounted as x, nextTick as B, getCurrentScope as N, onScopeDispose as P, ref as u, watch as A, computed as Q, resolveComponent as k, createBlock as L, openBlock as R } from "vue";
3
- import { ToolbarBase as p } from "@opentiny/tiny-engine-common";
4
- import { constants as y } from "@opentiny/tiny-engine-utils";
5
- const E = {
6
- id: "engine.toolbars.viewSetting",
7
- type: "toolbars",
8
- title: "viewSetting",
9
- options: {
10
- icon: {
11
- default: "routerview"
12
- },
13
- renderType: "icon",
14
- collapsed: !0
15
- }
16
- };
17
- var v;
18
- const h = typeof window < "u";
19
- h && ((v = window == null ? void 0 : window.navigator) != null && v.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
20
- function D(e) {
1
+ import { getCurrentInstance as b, onMounted as C, nextTick as y, getCurrentScope as E, onScopeDispose as h, ref as r, watch as S, computed as T, resolveComponent as M, createBlock as V, openBlock as B } from "vue";
2
+ import { ToolbarBase as N } from "@opentiny/tiny-engine-common";
3
+ import { constants as P } from "@opentiny/tiny-engine-utils";
4
+ var d;
5
+ const w = typeof window < "u";
6
+ w && ((d = window == null ? void 0 : window.navigator) != null && d.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
7
+ function x(e) {
21
8
  return e;
22
9
  }
23
- function W(e) {
24
- return N() ? (P(e), !0) : !1;
10
+ function A(e) {
11
+ return E() ? (h(e), !0) : !1;
25
12
  }
26
- function S(e, n = !0) {
27
- V() ? x(e) : n ? e() : B(e);
13
+ function g(e, n = !0) {
14
+ b() ? C(e) : n ? e() : y(e);
28
15
  }
29
- const j = h ? window : void 0;
30
- function G(e, n = !1) {
31
- const t = u(), o = () => t.value = !!e();
32
- return o(), S(o, n), t;
16
+ const Q = w ? window : void 0;
17
+ function k(e, n = !1) {
18
+ const t = r(), o = () => t.value = !!e();
19
+ return o(), g(o, n), t;
33
20
  }
34
- const f = (e) => {
21
+ const L = (e) => {
35
22
  const {
36
23
  name: n,
37
- window: t = j
38
- } = e, o = G(() => t && "BroadcastChannel" in t), s = u(!1), a = u(), r = u(), i = u(null), T = (l) => {
24
+ window: t = Q
25
+ } = e, o = k(() => t && "BroadcastChannel" in t), s = r(!1), a = r(), u = r(), i = r(null), I = (l) => {
39
26
  a.value && a.value.postMessage(l);
40
- }, d = () => {
27
+ }, c = () => {
41
28
  a.value && a.value.close(), s.value = !0;
42
29
  };
43
- return o.value && S(() => {
30
+ return o.value && g(() => {
44
31
  i.value = null, a.value = new BroadcastChannel(n), a.value.addEventListener("message", (l) => {
45
- r.value = l.data;
32
+ u.value = l.data;
46
33
  }, { passive: !0 }), a.value.addEventListener("messageerror", (l) => {
47
34
  i.value = l;
48
35
  }, { passive: !0 }), a.value.addEventListener("close", () => {
49
36
  s.value = !0;
50
37
  });
51
- }), W(() => {
52
- d();
38
+ }), A(() => {
39
+ c();
53
40
  }), {
54
41
  isSupported: o,
55
42
  channel: a,
56
- data: r,
57
- post: T,
58
- close: d,
43
+ data: u,
44
+ post: I,
45
+ close: c,
59
46
  error: i,
60
47
  isClosed: s
61
48
  };
62
- }, _ = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, O = "__vueuse_ssr_handlers__";
63
- _[O] = _[O] || {};
64
- var w;
49
+ }, p = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, v = "__vueuse_ssr_handlers__";
50
+ p[v] = p[v] || {};
51
+ var f;
65
52
  (function(e) {
66
53
  e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
67
- })(w || (w = {}));
68
- var H = Object.defineProperty, g = Object.getOwnPropertySymbols, U = Object.prototype.hasOwnProperty, F = Object.prototype.propertyIsEnumerable, m = (e, n, t) => n in e ? H(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, K = (e, n) => {
54
+ })(f || (f = {}));
55
+ var R = Object.defineProperty, _ = Object.getOwnPropertySymbols, W = Object.prototype.hasOwnProperty, D = 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) => {
69
56
  for (var t in n || (n = {}))
70
- U.call(n, t) && m(e, t, n[t]);
71
- if (g)
72
- for (var t of g(n))
73
- F.call(n, t) && m(e, t, n[t]);
57
+ W.call(n, t) && O(e, t, n[t]);
58
+ if (_)
59
+ for (var t of _(n))
60
+ D.call(n, t) && O(e, t, n[t]);
74
61
  return e;
75
62
  };
76
- const Y = {
63
+ const G = {
77
64
  easeInSine: [0.12, 0, 0.39, 0],
78
65
  easeOutSine: [0.61, 1, 0.88, 1],
79
66
  easeInOutSine: [0.37, 0, 0.63, 1],
@@ -99,23 +86,20 @@ const Y = {
99
86
  easeOutBack: [0.34, 1.56, 0.64, 1],
100
87
  easeInOutBack: [0.68, -0.6, 0.32, 1.6]
101
88
  };
102
- K({
103
- linear: D
104
- }, Y);
105
- const {
106
- BROADCAST_CHANNEL: I,
107
- CANVAS_ROUTER_VIEW_SETTING_VIEW_MODE_KEY: c
108
- } = y;
109
- function b() {
110
- const e = localStorage.getItem(c) || "";
89
+ j({
90
+ linear: x
91
+ }, G);
92
+ const { BROADCAST_CHANNEL: H, CANVAS_ROUTER_VIEW_SETTING_VIEW_MODE_KEY: m } = P;
93
+ function U() {
94
+ const e = localStorage.getItem(m) || "";
111
95
  return ["embedded", "standalone"].includes(e) ? e : "embedded";
112
96
  }
113
- function C(e) {
114
- localStorage.setItem(c, e);
97
+ function F(e) {
98
+ localStorage.setItem(m, e);
115
99
  }
116
- const $ = {
100
+ const K = {
117
101
  components: {
118
- ToolbarBase: p
102
+ ToolbarBase: N
119
103
  },
120
104
  props: {
121
105
  options: {
@@ -124,73 +108,61 @@ const $ = {
124
108
  }
125
109
  },
126
110
  setup() {
127
- const e = u(b()), {
128
- post: n,
129
- data: t
130
- } = f({
131
- name: I.CanvasRouterViewSetting
132
- });
133
- A(t, () => {
111
+ const e = r(U()), { post: n, data: t } = L({ name: H.CanvasRouterViewSetting });
112
+ S(t, () => {
134
113
  e.value = t.value;
135
114
  });
136
- const o = [{
137
- value: "embedded",
138
- label: "嵌套视图"
139
- }, {
140
- value: "standalone",
141
- label: "单页视图"
142
- }], s = Q(() => o.find(({
143
- value: r
144
- }) => r !== e.value) || o[1]), a = M(() => {
145
- e.value = e.value === o[0].value ? o[1].value : o[0].value, C(e.value), n({
146
- viewMode: e.value
147
- });
148
- }, {
149
- metaData: {
150
- id: `${E.id}.changeViewMode`
115
+ const o = [
116
+ {
117
+ value: "embedded",
118
+ label: "嵌套视图"
151
119
  },
152
- ctx: () => ({
153
- viewMode: e,
154
- post: n,
155
- data: t,
156
- viewModeOptions: o,
157
- nextViewMode: s,
158
- changeViewMode: a,
159
- useBroadcastChannel: f,
160
- ToolbarBase: p,
161
- constants: y,
162
- BROADCAST_CHANNEL: I,
163
- CANVAS_ROUTER_VIEW_SETTING_VIEW_MODE_KEY: c,
164
- getCacheValue: b,
165
- setCacheValue: C
166
- })
167
- });
120
+ {
121
+ value: "standalone",
122
+ label: "单页视图"
123
+ }
124
+ ], s = T(
125
+ () => o.find(({ value: u }) => u !== e.value) || o[1]
126
+ );
168
127
  return {
169
128
  viewModeOptions: o,
170
129
  viewMode: e,
171
- changeViewMode: a,
130
+ changeViewMode: () => {
131
+ e.value = e.value === o[0].value ? o[1].value : o[0].value, F(e.value), n({ viewMode: e.value });
132
+ },
172
133
  nextViewMode: s
173
134
  };
174
135
  }
175
- }, q = (e, n) => {
136
+ }, Y = (e, n) => {
176
137
  const t = e.__vccOpts || e;
177
138
  for (const [o, s] of n)
178
139
  t[o] = s;
179
140
  return t;
180
141
  };
181
- function z(e, n, t, o, s, a) {
182
- const r = k("toolbar-base");
183
- return R(), L(r, {
142
+ function q(e, n, t, o, s, a) {
143
+ const u = M("toolbar-base");
144
+ return B(), V(u, {
184
145
  content: `切换到${o.nextViewMode.label}`,
185
146
  icon: t.options.icon.default || t.options.icon,
186
147
  options: t.options,
187
148
  onClickApi: o.changeViewMode
188
149
  }, null, 8, ["content", "icon", "options", "onClickApi"]);
189
150
  }
190
- const J = /* @__PURE__ */ q($, [["render", z]]), ne = {
191
- ...E,
192
- entry: J
151
+ const z = /* @__PURE__ */ Y(K, [["render", q]]), J = {
152
+ id: "engine.toolbars.viewSetting",
153
+ type: "toolbars",
154
+ title: "viewSetting",
155
+ options: {
156
+ icon: {
157
+ default: "routerview"
158
+ },
159
+ renderType: "icon",
160
+ collapsed: !0
161
+ }
162
+ }, ee = {
163
+ ...J,
164
+ entry: z
193
165
  };
194
166
  export {
195
- ne as default
167
+ ee as default
196
168
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-view-setting",
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
  }