@opentiny/tiny-engine-toolbar-view-setting 2.5.0 → 2.6.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 +29 -115
- package/dist/index.js.map +1 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,105 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
w
|
|
7
|
-
|
|
8
|
-
return e;
|
|
9
|
-
}
|
|
10
|
-
function A(e) {
|
|
11
|
-
return E() ? (h(e), !0) : !1;
|
|
12
|
-
}
|
|
13
|
-
function g(e, n = !0) {
|
|
14
|
-
b() ? C(e) : n ? e() : y(e);
|
|
15
|
-
}
|
|
16
|
-
const Q = w ? window : void 0;
|
|
17
|
-
function k(e, n = !1) {
|
|
18
|
-
const t = u(), o = () => t.value = !!e();
|
|
19
|
-
return o(), g(o, n), t;
|
|
20
|
-
}
|
|
21
|
-
const L = (e) => {
|
|
22
|
-
const {
|
|
23
|
-
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 = () => {
|
|
28
|
-
a.value && a.value.close(), s.value = !0;
|
|
29
|
-
};
|
|
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;
|
|
35
|
-
}, { passive: !0 }), a.value.addEventListener("close", () => {
|
|
36
|
-
s.value = !0;
|
|
37
|
-
});
|
|
38
|
-
}), A(() => {
|
|
39
|
-
c();
|
|
40
|
-
}), {
|
|
41
|
-
isSupported: o,
|
|
42
|
-
channel: a,
|
|
43
|
-
data: r,
|
|
44
|
-
post: I,
|
|
45
|
-
close: c,
|
|
46
|
-
error: i,
|
|
47
|
-
isClosed: s
|
|
48
|
-
};
|
|
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;
|
|
52
|
-
(function(e) {
|
|
53
|
-
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) => {
|
|
56
|
-
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]);
|
|
61
|
-
return e;
|
|
62
|
-
};
|
|
63
|
-
const G = {
|
|
64
|
-
easeInSine: [0.12, 0, 0.39, 0],
|
|
65
|
-
easeOutSine: [0.61, 1, 0.88, 1],
|
|
66
|
-
easeInOutSine: [0.37, 0, 0.63, 1],
|
|
67
|
-
easeInQuad: [0.11, 0, 0.5, 0],
|
|
68
|
-
easeOutQuad: [0.5, 1, 0.89, 1],
|
|
69
|
-
easeInOutQuad: [0.45, 0, 0.55, 1],
|
|
70
|
-
easeInCubic: [0.32, 0, 0.67, 0],
|
|
71
|
-
easeOutCubic: [0.33, 1, 0.68, 1],
|
|
72
|
-
easeInOutCubic: [0.65, 0, 0.35, 1],
|
|
73
|
-
easeInQuart: [0.5, 0, 0.75, 0],
|
|
74
|
-
easeOutQuart: [0.25, 1, 0.5, 1],
|
|
75
|
-
easeInOutQuart: [0.76, 0, 0.24, 1],
|
|
76
|
-
easeInQuint: [0.64, 0, 0.78, 0],
|
|
77
|
-
easeOutQuint: [0.22, 1, 0.36, 1],
|
|
78
|
-
easeInOutQuint: [0.83, 0, 0.17, 1],
|
|
79
|
-
easeInExpo: [0.7, 0, 0.84, 0],
|
|
80
|
-
easeOutExpo: [0.16, 1, 0.3, 1],
|
|
81
|
-
easeInOutExpo: [0.87, 0, 0.13, 1],
|
|
82
|
-
easeInCirc: [0.55, 0, 1, 0.45],
|
|
83
|
-
easeOutCirc: [0, 0.55, 0.45, 1],
|
|
84
|
-
easeInOutCirc: [0.85, 0, 0.15, 1],
|
|
85
|
-
easeInBack: [0.36, 0, 0.66, -0.56],
|
|
86
|
-
easeOutBack: [0.34, 1.56, 0.64, 1],
|
|
87
|
-
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
|
88
|
-
};
|
|
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) || "";
|
|
1
|
+
import { ref as s, watch as r, computed as d, resolveComponent as u, createBlock as p, openBlock as v } from "vue";
|
|
2
|
+
import { useBroadcastChannel as m } from "@vueuse/core";
|
|
3
|
+
import { ToolbarBase as _ } from "@opentiny/tiny-engine-common";
|
|
4
|
+
import { constants as f } from "@opentiny/tiny-engine-utils";
|
|
5
|
+
const { BROADCAST_CHANNEL: b, CANVAS_ROUTER_VIEW_SETTING_VIEW_MODE_KEY: i } = f;
|
|
6
|
+
function w() {
|
|
7
|
+
const e = localStorage.getItem(i) || "";
|
|
95
8
|
return ["embedded", "standalone"].includes(e) ? e : "embedded";
|
|
96
9
|
}
|
|
97
|
-
function
|
|
98
|
-
localStorage.setItem(
|
|
10
|
+
function g(e) {
|
|
11
|
+
localStorage.setItem(i, e);
|
|
99
12
|
}
|
|
100
|
-
const
|
|
13
|
+
const V = {
|
|
101
14
|
components: {
|
|
102
|
-
ToolbarBase:
|
|
15
|
+
ToolbarBase: _
|
|
103
16
|
},
|
|
104
17
|
props: {
|
|
105
18
|
options: {
|
|
@@ -108,8 +21,8 @@ const K = {
|
|
|
108
21
|
}
|
|
109
22
|
},
|
|
110
23
|
setup() {
|
|
111
|
-
const e =
|
|
112
|
-
|
|
24
|
+
const e = s(w()), { post: n, data: t } = m({ name: b.CanvasRouterViewSetting });
|
|
25
|
+
r(t, () => {
|
|
113
26
|
e.value = t.value;
|
|
114
27
|
});
|
|
115
28
|
const o = [
|
|
@@ -121,34 +34,34 @@ const K = {
|
|
|
121
34
|
value: "standalone",
|
|
122
35
|
label: "单页视图"
|
|
123
36
|
}
|
|
124
|
-
],
|
|
125
|
-
() => o.find(({ value:
|
|
37
|
+
], a = d(
|
|
38
|
+
() => o.find(({ value: c }) => c !== e.value) || o[1]
|
|
126
39
|
);
|
|
127
40
|
return {
|
|
128
41
|
viewModeOptions: o,
|
|
129
42
|
viewMode: e,
|
|
130
43
|
changeViewMode: () => {
|
|
131
|
-
e.value = e.value === o[0].value ? o[1].value : o[0].value,
|
|
44
|
+
e.value = e.value === o[0].value ? o[1].value : o[0].value, g(e.value), n({ viewMode: e.value });
|
|
132
45
|
},
|
|
133
|
-
nextViewMode:
|
|
46
|
+
nextViewMode: a
|
|
134
47
|
};
|
|
135
48
|
}
|
|
136
|
-
},
|
|
49
|
+
}, C = (e, n) => {
|
|
137
50
|
const t = e.__vccOpts || e;
|
|
138
|
-
for (const [o,
|
|
139
|
-
t[o] =
|
|
51
|
+
for (const [o, a] of n)
|
|
52
|
+
t[o] = a;
|
|
140
53
|
return t;
|
|
141
54
|
};
|
|
142
|
-
function
|
|
143
|
-
const
|
|
144
|
-
return
|
|
55
|
+
function M(e, n, t, o, a, l) {
|
|
56
|
+
const c = u("toolbar-base");
|
|
57
|
+
return v(), p(c, {
|
|
145
58
|
content: `切换到${o.nextViewMode.label}`,
|
|
146
59
|
icon: t.options.icon.default || t.options.icon,
|
|
147
60
|
options: t.options,
|
|
148
61
|
onClickApi: o.changeViewMode
|
|
149
62
|
}, null, 8, ["content", "icon", "options", "onClickApi"]);
|
|
150
63
|
}
|
|
151
|
-
const
|
|
64
|
+
const h = /* @__PURE__ */ C(V, [["render", M]]), S = {
|
|
152
65
|
id: "engine.toolbars.viewSetting",
|
|
153
66
|
type: "toolbars",
|
|
154
67
|
title: "viewSetting",
|
|
@@ -159,10 +72,11 @@ const z = /* @__PURE__ */ Y(K, [["render", q]]), J = {
|
|
|
159
72
|
renderType: "icon",
|
|
160
73
|
collapsed: !0
|
|
161
74
|
}
|
|
162
|
-
},
|
|
163
|
-
...
|
|
164
|
-
entry:
|
|
75
|
+
}, T = {
|
|
76
|
+
...S,
|
|
77
|
+
entry: h
|
|
165
78
|
};
|
|
166
79
|
export {
|
|
167
|
-
|
|
80
|
+
T as default
|
|
168
81
|
};
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/Main.vue","../meta.js","../index.ts"],"sourcesContent":["<template>\n <toolbar-base\n :content=\"`切换到${nextViewMode.label}`\"\n :icon=\"options.icon.default || options.icon\"\n :options=\"options\"\n @click-api=\"changeViewMode\"\n >\n </toolbar-base>\n</template>\n\n<script lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\nimport { useBroadcastChannel } from '@vueuse/core'\nimport { ToolbarBase } from '@opentiny/tiny-engine-common'\n\nimport { constants } from '@opentiny/tiny-engine-utils'\n\nconst { BROADCAST_CHANNEL, CANVAS_ROUTER_VIEW_SETTING_VIEW_MODE_KEY } = constants\n\nfunction getCacheValue() {\n const value = localStorage.getItem(CANVAS_ROUTER_VIEW_SETTING_VIEW_MODE_KEY) || ''\n if (!['embedded', 'standalone'].includes(value)) {\n return 'embedded'\n }\n return value\n}\nfunction setCacheValue(value: string) {\n localStorage.setItem(CANVAS_ROUTER_VIEW_SETTING_VIEW_MODE_KEY, value)\n}\n\nexport default {\n components: {\n ToolbarBase\n },\n props: {\n options: {\n type: Object,\n default: () => ({})\n }\n },\n setup() {\n const viewMode = ref(getCacheValue())\n const { post, data } = useBroadcastChannel({ name: BROADCAST_CHANNEL.CanvasRouterViewSetting })\n watch(data, () => {\n viewMode.value = data.value\n })\n\n const viewModeOptions = [\n {\n value: 'embedded',\n label: '嵌套视图'\n },\n {\n value: 'standalone',\n label: '单页视图'\n }\n ]\n\n const nextViewMode = computed(\n () => viewModeOptions.find(({ value }) => value !== viewMode.value) || viewModeOptions[1]\n )\n\n const changeViewMode = () => {\n viewMode.value = viewMode.value === viewModeOptions[0].value ? viewModeOptions[1].value : viewModeOptions[0].value\n setCacheValue(viewMode.value)\n post({ viewMode: viewMode.value })\n }\n return {\n viewModeOptions,\n viewMode,\n changeViewMode,\n nextViewMode\n }\n }\n}\n</script>\n","export default {\n id: 'engine.toolbars.viewSetting',\n type: 'toolbars',\n title: 'viewSetting',\n options: {\n icon: {\n default: 'routerview'\n },\n renderType: 'icon',\n collapsed: true\n }\n}\n","/**\n * Copyright (c) 2023 - present TinyEngine Authors.\n * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.\n *\n * Use of this source code is governed by an MIT-style license.\n *\n * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,\n * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR\n * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.\n *\n */\n\nimport entry from './src/Main.vue'\nimport metaData from './meta'\n\nexport default {\n ...metaData,\n entry\n}\n"],"names":["BROADCAST_CHANNEL","CANVAS_ROUTER_VIEW_SETTING_VIEW_MODE_KEY","constants","getCacheValue","value","setCacheValue","_sfc_main","ToolbarBase","viewMode","ref","post","data","useBroadcastChannel","watch","viewModeOptions","nextViewMode","computed","_createBlock","_component_toolbar_base","$setup","$props","metaData","index","entry"],"mappings":";;;;AAiBA,MAAM,EAAE,mBAAAA,GAAmB,0CAAAC,EAAA,IAA6CC;AAExE,SAASC,IAAgB;AACvB,QAAMC,IAAQ,aAAa,QAAQH,CAAwC,KAAK;AAChF,SAAK,CAAC,YAAY,YAAY,EAAE,SAASG,CAAK,IAGvCA,IAFE;AAGX;AACA,SAASC,EAAcD,GAAe;AACvB,eAAA,QAAQH,GAA0CG,CAAK;AACtE;AAEA,MAAeE,IAAA;AAAA,EACb,YAAY;AAAA,IACV,aAAAC;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS,OAAO,CAAC;AAAA,IAAA;AAAA,EAErB;AAAA,EACA,QAAQ;AACA,UAAAC,IAAWC,EAAIN,GAAe,GAC9B,EAAE,MAAAO,GAAM,MAAAC,MAASC,EAAoB,EAAE,MAAMZ,EAAkB,yBAAyB;AAC9F,IAAAa,EAAMF,GAAM,MAAM;AAChB,MAAAH,EAAS,QAAQG,EAAK;AAAA,IAAA,CACvB;AAED,UAAMG,IAAkB;AAAA,MACtB;AAAA,QACE,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,OAAO;AAAA,MAAA;AAAA,IAEX,GAEMC,IAAeC;AAAA,MACnB,MAAMF,EAAgB,KAAK,CAAC,EAAE,OAAAV,EAAA,MAAYA,MAAUI,EAAS,KAAK,KAAKM,EAAgB,CAAC;AAAA,IAC1F;AAOO,WAAA;AAAA,MACL,iBAAAA;AAAA,MACA,UAAAN;AAAA,MACA,gBARqB,MAAM;AAC3B,QAAAA,EAAS,QAAQA,EAAS,UAAUM,EAAgB,CAAC,EAAE,QAAQA,EAAgB,CAAC,EAAE,QAAQA,EAAgB,CAAC,EAAE,OAC7GT,EAAcG,EAAS,KAAK,GAC5BE,EAAK,EAAE,UAAUF,EAAS,MAAA,CAAO;AAAA,MACnC;AAAA,MAKE,cAAAO;AAAA,IACF;AAAA,EAAA;AAEJ;;;;;;;;cAzEEE,EAMeC,GAAA;AAAA,IALZ,SAAO,MAAQC,EAAA,aAAa,KAAK;AAAA,IACjC,MAAMC,EAAA,QAAQ,KAAK,WAAWA,EAAQ,QAAA;AAAA,IACtC,SAASA,EAAA;AAAA,IACT,YAAWD,EAAA;AAAA,EAAA,GAAA,MAAA,GAAA,CAAA,WAAA,QAAA,WAAA,YAAA,CAAA;;iDCLDE,IAAA;AAAA,EACb,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,SAAS;AAAA,IACV;AAAA,IACD,YAAY;AAAA,IACZ,WAAW;AAAA,EACf;AACA,GCIeC,IAAA;AAAA,EACb,GAAGD;AAAA,EACH,OAAAE;AACF;"}
|
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.6.0-alpha.0",
|
|
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.
|
|
29
|
-
"@opentiny/tiny-engine-utils": "2.
|
|
28
|
+
"@opentiny/tiny-engine-common": "2.6.0-alpha.0",
|
|
29
|
+
"@opentiny/tiny-engine-utils": "2.6.0-alpha.0",
|
|
30
30
|
"@vueuse/core": "^9.6.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.
|
|
33
|
+
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.6.0-alpha.0",
|
|
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": "91ddb45772ee61d827b3ae02a97d3dc9cd599029"
|
|
43
43
|
}
|