@opentiny/tiny-engine-toolbar-view-setting 2.4.0 → 2.5.0-alpha.1
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 +109 -81
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,66 +1,79 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
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) {
|
|
8
21
|
return e;
|
|
9
22
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
23
|
+
function W(e) {
|
|
24
|
+
return N() ? (P(e), !0) : !1;
|
|
12
25
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
26
|
+
function S(e, n = !0) {
|
|
27
|
+
V() ? x(e) : n ? e() : B(e);
|
|
15
28
|
}
|
|
16
|
-
const
|
|
17
|
-
function
|
|
18
|
-
const t =
|
|
19
|
-
return o(),
|
|
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;
|
|
20
33
|
}
|
|
21
|
-
const
|
|
34
|
+
const f = (e) => {
|
|
22
35
|
const {
|
|
23
36
|
name: n,
|
|
24
|
-
window: t =
|
|
25
|
-
} = e, o =
|
|
37
|
+
window: t = j
|
|
38
|
+
} = e, o = G(() => t && "BroadcastChannel" in t), s = u(!1), a = u(), r = u(), i = u(null), T = (l) => {
|
|
26
39
|
a.value && a.value.postMessage(l);
|
|
27
|
-
},
|
|
40
|
+
}, d = () => {
|
|
28
41
|
a.value && a.value.close(), s.value = !0;
|
|
29
42
|
};
|
|
30
|
-
return o.value &&
|
|
43
|
+
return o.value && S(() => {
|
|
31
44
|
i.value = null, a.value = new BroadcastChannel(n), a.value.addEventListener("message", (l) => {
|
|
32
|
-
|
|
45
|
+
r.value = l.data;
|
|
33
46
|
}, { passive: !0 }), a.value.addEventListener("messageerror", (l) => {
|
|
34
47
|
i.value = l;
|
|
35
48
|
}, { passive: !0 }), a.value.addEventListener("close", () => {
|
|
36
49
|
s.value = !0;
|
|
37
50
|
});
|
|
38
|
-
}),
|
|
39
|
-
|
|
51
|
+
}), W(() => {
|
|
52
|
+
d();
|
|
40
53
|
}), {
|
|
41
54
|
isSupported: o,
|
|
42
55
|
channel: a,
|
|
43
|
-
data:
|
|
44
|
-
post:
|
|
45
|
-
close:
|
|
56
|
+
data: r,
|
|
57
|
+
post: T,
|
|
58
|
+
close: d,
|
|
46
59
|
error: i,
|
|
47
60
|
isClosed: s
|
|
48
61
|
};
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
var
|
|
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
|
-
})(
|
|
55
|
-
var
|
|
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
|
-
|
|
58
|
-
if (
|
|
59
|
-
for (var t of
|
|
60
|
-
|
|
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
|
|
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
|
-
|
|
90
|
-
linear:
|
|
91
|
-
},
|
|
92
|
-
const {
|
|
93
|
-
|
|
94
|
-
|
|
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) || "";
|
|
95
111
|
return ["embedded", "standalone"].includes(e) ? e : "embedded";
|
|
96
112
|
}
|
|
97
|
-
function
|
|
98
|
-
localStorage.setItem(
|
|
113
|
+
function C(e) {
|
|
114
|
+
localStorage.setItem(c, e);
|
|
99
115
|
}
|
|
100
|
-
const
|
|
116
|
+
const $ = {
|
|
101
117
|
components: {
|
|
102
|
-
ToolbarBase:
|
|
118
|
+
ToolbarBase: p
|
|
103
119
|
},
|
|
104
120
|
props: {
|
|
105
121
|
options: {
|
|
@@ -108,61 +124,73 @@ const K = {
|
|
|
108
124
|
}
|
|
109
125
|
},
|
|
110
126
|
setup() {
|
|
111
|
-
const e =
|
|
112
|
-
|
|
127
|
+
const e = u(b()), {
|
|
128
|
+
post: n,
|
|
129
|
+
data: t
|
|
130
|
+
} = f({
|
|
131
|
+
name: I.CanvasRouterViewSetting
|
|
132
|
+
});
|
|
133
|
+
A(t, () => {
|
|
113
134
|
e.value = t.value;
|
|
114
135
|
});
|
|
115
|
-
const o = [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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`
|
|
119
151
|
},
|
|
120
|
-
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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: I,
|
|
163
|
+
CANVAS_ROUTER_VIEW_SETTING_VIEW_MODE_KEY: c,
|
|
164
|
+
getCacheValue: b,
|
|
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
|
-
},
|
|
175
|
+
}, q = (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
|
|
143
|
-
const
|
|
144
|
-
return
|
|
181
|
+
function z(e, n, t, o, s, a) {
|
|
182
|
+
const r = k("toolbar-base");
|
|
183
|
+
return R(), L(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
|
|
152
|
-
|
|
153
|
-
|
|
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 J = /* @__PURE__ */ q($, [["render", z]]), ne = {
|
|
191
|
+
...E,
|
|
192
|
+
entry: J
|
|
165
193
|
};
|
|
166
194
|
export {
|
|
167
|
-
|
|
195
|
+
ne as default
|
|
168
196
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-engine-toolbar-view-setting",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0-alpha.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -25,12 +25,13 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"homepage": "https://opentiny.design/tiny-engine",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@opentiny/tiny-engine-common": "2.
|
|
29
|
-
"@opentiny/tiny-engine-
|
|
28
|
+
"@opentiny/tiny-engine-common": "2.5.0-alpha.1",
|
|
29
|
+
"@opentiny/tiny-engine-meta-register": "2.5.0-alpha.1",
|
|
30
|
+
"@opentiny/tiny-engine-utils": "2.5.0-alpha.1",
|
|
30
31
|
"@vueuse/core": "^9.6.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.
|
|
34
|
+
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.1",
|
|
34
35
|
"@vitejs/plugin-vue": "^5.1.2",
|
|
35
36
|
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
|
36
37
|
"vite": "^5.4.2"
|
|
@@ -39,5 +40,5 @@
|
|
|
39
40
|
"@opentiny/vue": "^3.20.0",
|
|
40
41
|
"vue": "^3.4.15"
|
|
41
42
|
},
|
|
42
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "018ca6054f72ee559f0d3ca4dfcbeef4fb411e01"
|
|
43
44
|
}
|