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