@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.
- package/dist/index.js +81 -109
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,79 +1,66 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
24
|
-
return
|
|
10
|
+
function A(e) {
|
|
11
|
+
return E() ? (h(e), !0) : !1;
|
|
25
12
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
13
|
+
function g(e, n = !0) {
|
|
14
|
+
b() ? C(e) : n ? e() : y(e);
|
|
28
15
|
}
|
|
29
|
-
const
|
|
30
|
-
function
|
|
31
|
-
const t =
|
|
32
|
-
return o(),
|
|
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
|
|
21
|
+
const L = (e) => {
|
|
35
22
|
const {
|
|
36
23
|
name: n,
|
|
37
|
-
window: t =
|
|
38
|
-
} = e, o =
|
|
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
|
-
},
|
|
27
|
+
}, c = () => {
|
|
41
28
|
a.value && a.value.close(), s.value = !0;
|
|
42
29
|
};
|
|
43
|
-
return o.value &&
|
|
30
|
+
return o.value && g(() => {
|
|
44
31
|
i.value = null, a.value = new BroadcastChannel(n), a.value.addEventListener("message", (l) => {
|
|
45
|
-
|
|
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
|
-
}),
|
|
52
|
-
|
|
38
|
+
}), A(() => {
|
|
39
|
+
c();
|
|
53
40
|
}), {
|
|
54
41
|
isSupported: o,
|
|
55
42
|
channel: a,
|
|
56
|
-
data:
|
|
57
|
-
post:
|
|
58
|
-
close:
|
|
43
|
+
data: u,
|
|
44
|
+
post: I,
|
|
45
|
+
close: c,
|
|
59
46
|
error: i,
|
|
60
47
|
isClosed: s
|
|
61
48
|
};
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
var
|
|
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
|
-
})(
|
|
68
|
-
var
|
|
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
|
-
|
|
71
|
-
if (
|
|
72
|
-
for (var t of
|
|
73
|
-
|
|
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
|
|
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
|
-
|
|
103
|
-
linear:
|
|
104
|
-
},
|
|
105
|
-
const {
|
|
106
|
-
|
|
107
|
-
|
|
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
|
|
114
|
-
localStorage.setItem(
|
|
97
|
+
function F(e) {
|
|
98
|
+
localStorage.setItem(m, e);
|
|
115
99
|
}
|
|
116
|
-
const
|
|
100
|
+
const K = {
|
|
117
101
|
components: {
|
|
118
|
-
ToolbarBase:
|
|
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 =
|
|
128
|
-
|
|
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
|
-
|
|
138
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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:
|
|
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
|
-
},
|
|
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
|
|
182
|
-
const
|
|
183
|
-
return
|
|
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
|
|
191
|
-
|
|
192
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
29
|
-
"@opentiny/tiny-engine-utils": "2.5.0-alpha.
|
|
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.
|
|
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": "
|
|
42
|
+
"gitHead": "f5707c379397bffc9a63c50c695f3ee3340ad0c6"
|
|
43
43
|
}
|