@opentiny/tiny-engine-toolbar-theme-switch 2.6.1 → 2.7.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 +244 -83
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { getMetaApi as m, META_SERVICE as c, callEntry as T, getMergeMeta as y, defineService as D } from "@opentiny/tiny-engine-meta-register";
|
|
3
|
+
import { resolveComponent as G, createElementBlock as L, openBlock as V, createVNode as H, withCtx as N, createElementVNode as O, Fragment as P, renderList as R, normalizeClass as j, toDisplayString as z, createCommentVNode as q, computed as C, ref as U, reactive as J } from "vue";
|
|
4
|
+
import { ToolbarBase as B, setGlobalMonacoEditorTheme as x } from "@opentiny/tiny-engine-common";
|
|
5
|
+
import { TinyPopover as K, TinyRadioGroup as Q } from "@opentiny/vue";
|
|
6
|
+
const W = {
|
|
7
|
+
id: "engine.toolbars.themeSwitch",
|
|
8
|
+
type: "toolbars",
|
|
9
|
+
title: "themeSwitch",
|
|
10
|
+
options: {
|
|
11
|
+
renderType: "icon"
|
|
12
|
+
}
|
|
13
|
+
}, X = (o, t) => {
|
|
14
|
+
const n = o.__vccOpts || o;
|
|
15
|
+
for (const [e, g] of t)
|
|
16
|
+
n[e] = g;
|
|
17
|
+
return n;
|
|
18
|
+
}, Y = {
|
|
12
19
|
components: {
|
|
13
|
-
ToolbarBase:
|
|
14
|
-
TinyRadioGroup:
|
|
15
|
-
TinyPopover:
|
|
20
|
+
ToolbarBase: B,
|
|
21
|
+
TinyRadioGroup: Q,
|
|
22
|
+
TinyPopover: K
|
|
16
23
|
},
|
|
17
24
|
props: {
|
|
18
25
|
options: {
|
|
@@ -25,43 +32,131 @@ const q = (o, t) => {
|
|
|
25
32
|
}
|
|
26
33
|
},
|
|
27
34
|
setup(o) {
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const {
|
|
36
|
+
getThemeData: t,
|
|
37
|
+
getThemeState: n,
|
|
38
|
+
themeChange: e,
|
|
39
|
+
getTheme: g
|
|
40
|
+
} = m(c.ThemeSwitch), r = n(), l = t(), h = "collapse", b = C(() => {
|
|
41
|
+
const s = {
|
|
42
|
+
...o.options
|
|
43
|
+
};
|
|
44
|
+
return o.position === h && (s.renderType = ""), s;
|
|
45
|
+
}), a = C(() => l.value.map((s) => ({
|
|
46
|
+
...s,
|
|
47
|
+
label: s.type
|
|
48
|
+
}))), _ = C(() => o.position === h ? "" : r.themeLabel), A = C(() => o.position === h ? "" : r.themeIcon), u = U(!1), S = C(() => {
|
|
49
|
+
const s = l.value.filter((F) => ["light", "dark"].includes(F.type)) || [];
|
|
50
|
+
return l.value.length === s.length;
|
|
51
|
+
}), w = T(() => {
|
|
52
|
+
const s = g(r.theme).oppositeTheme;
|
|
53
|
+
e(s);
|
|
54
|
+
}, {
|
|
55
|
+
metaData: {
|
|
56
|
+
id: "engine.toolbars.themeSwitch.Main.toChangeTheme"
|
|
57
|
+
},
|
|
58
|
+
ctx: () => ({
|
|
59
|
+
props: o,
|
|
60
|
+
getThemeData: t,
|
|
61
|
+
getThemeState: n,
|
|
62
|
+
themeChange: e,
|
|
63
|
+
getTheme: g,
|
|
64
|
+
state: r,
|
|
65
|
+
THEME_DATA: l,
|
|
66
|
+
COLLAPSE: h,
|
|
67
|
+
optionsData: b,
|
|
68
|
+
radioThemeList: a,
|
|
69
|
+
baseContent: _,
|
|
70
|
+
baseIcon: A,
|
|
71
|
+
showpopover: u,
|
|
72
|
+
themeShowType: S,
|
|
73
|
+
toChangeTheme: w,
|
|
74
|
+
changeThemeType: M,
|
|
75
|
+
themeItemChange: k,
|
|
76
|
+
ToolbarBase: B,
|
|
77
|
+
getMetaApi: m,
|
|
78
|
+
META_SERVICE: c
|
|
79
|
+
})
|
|
80
|
+
}), M = T(() => {
|
|
81
|
+
o.position !== h && (S.value ? w() : u.value = !0);
|
|
82
|
+
}, {
|
|
83
|
+
metaData: {
|
|
84
|
+
id: "engine.toolbars.themeSwitch.Main.changeThemeType"
|
|
85
|
+
},
|
|
86
|
+
ctx: () => ({
|
|
87
|
+
props: o,
|
|
88
|
+
getThemeData: t,
|
|
89
|
+
getThemeState: n,
|
|
90
|
+
themeChange: e,
|
|
91
|
+
getTheme: g,
|
|
92
|
+
state: r,
|
|
93
|
+
THEME_DATA: l,
|
|
94
|
+
COLLAPSE: h,
|
|
95
|
+
optionsData: b,
|
|
96
|
+
radioThemeList: a,
|
|
97
|
+
baseContent: _,
|
|
98
|
+
baseIcon: A,
|
|
99
|
+
showpopover: u,
|
|
100
|
+
themeShowType: S,
|
|
101
|
+
toChangeTheme: w,
|
|
102
|
+
changeThemeType: M,
|
|
103
|
+
themeItemChange: k,
|
|
104
|
+
ToolbarBase: B,
|
|
105
|
+
getMetaApi: m,
|
|
106
|
+
META_SERVICE: c
|
|
107
|
+
})
|
|
108
|
+
}), k = T((s) => {
|
|
109
|
+
e(s), u.value = !1;
|
|
110
|
+
}, {
|
|
111
|
+
metaData: {
|
|
112
|
+
id: "engine.toolbars.themeSwitch.Main.themeItemChange"
|
|
113
|
+
},
|
|
114
|
+
ctx: () => ({
|
|
115
|
+
props: o,
|
|
116
|
+
getThemeData: t,
|
|
117
|
+
getThemeState: n,
|
|
118
|
+
themeChange: e,
|
|
119
|
+
getTheme: g,
|
|
120
|
+
state: r,
|
|
121
|
+
THEME_DATA: l,
|
|
122
|
+
COLLAPSE: h,
|
|
123
|
+
optionsData: b,
|
|
124
|
+
radioThemeList: a,
|
|
125
|
+
baseContent: _,
|
|
126
|
+
baseIcon: A,
|
|
127
|
+
showpopover: u,
|
|
128
|
+
themeShowType: S,
|
|
129
|
+
toChangeTheme: w,
|
|
130
|
+
changeThemeType: M,
|
|
131
|
+
themeItemChange: k,
|
|
132
|
+
ToolbarBase: B,
|
|
133
|
+
getMetaApi: m,
|
|
134
|
+
META_SERVICE: c
|
|
135
|
+
})
|
|
136
|
+
});
|
|
38
137
|
return {
|
|
39
|
-
THEME_DATA:
|
|
40
|
-
state:
|
|
41
|
-
optionsData:
|
|
138
|
+
THEME_DATA: l,
|
|
139
|
+
state: r,
|
|
140
|
+
optionsData: b,
|
|
42
141
|
radioThemeList: a,
|
|
43
|
-
baseContent:
|
|
44
|
-
baseIcon:
|
|
45
|
-
toChangeTheme:
|
|
142
|
+
baseContent: _,
|
|
143
|
+
baseIcon: A,
|
|
144
|
+
toChangeTheme: w,
|
|
46
145
|
themeChange: e,
|
|
47
|
-
showpopover:
|
|
48
|
-
themeShowType:
|
|
49
|
-
themeItemChange:
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
changeThemeType: () => {
|
|
53
|
-
o.position !== c && (w.value ? I() : y.value = !0);
|
|
54
|
-
}
|
|
146
|
+
showpopover: u,
|
|
147
|
+
themeShowType: S,
|
|
148
|
+
themeItemChange: k,
|
|
149
|
+
changeThemeType: M
|
|
55
150
|
};
|
|
56
151
|
}
|
|
57
|
-
},
|
|
152
|
+
}, Z = { class: "toolbar-theme-switch" }, $ = { class: "theme-list" }, ee = ["onClick"], te = {
|
|
58
153
|
key: 0,
|
|
59
154
|
class: "toolbar-theme-switch-radio"
|
|
60
155
|
};
|
|
61
|
-
function
|
|
62
|
-
const
|
|
63
|
-
return
|
|
64
|
-
|
|
156
|
+
function oe(o, t, n, e, g, r) {
|
|
157
|
+
const l = G("tiny-radio-group"), h = G("toolbar-base"), b = G("tiny-popover");
|
|
158
|
+
return V(), L("div", Z, [
|
|
159
|
+
H(b, {
|
|
65
160
|
width: "130",
|
|
66
161
|
trigger: "manual",
|
|
67
162
|
modelValue: e.showpopover,
|
|
@@ -69,17 +164,17 @@ function Y(o, t, s, e, h, l) {
|
|
|
69
164
|
"visible-arrow": !1,
|
|
70
165
|
"popper-class": "theme-popover"
|
|
71
166
|
}, {
|
|
72
|
-
reference:
|
|
73
|
-
|
|
167
|
+
reference: N(() => [
|
|
168
|
+
H(h, {
|
|
74
169
|
content: e.baseContent,
|
|
75
170
|
icon: e.baseIcon,
|
|
76
171
|
options: e.optionsData,
|
|
77
172
|
onClickApi: e.changeThemeType
|
|
78
173
|
}, {
|
|
79
|
-
default:
|
|
80
|
-
|
|
81
|
-
t[2] || (t[2] =
|
|
82
|
-
|
|
174
|
+
default: N(() => [
|
|
175
|
+
n.position === "collapse" ? (V(), L("div", te, [
|
|
176
|
+
t[2] || (t[2] = O("div", { class: "toolbar-theme-switch-radio-title" }, "主题", -1)),
|
|
177
|
+
H(l, {
|
|
83
178
|
modelValue: e.state.theme,
|
|
84
179
|
"onUpdate:modelValue": t[0] || (t[0] = (a) => e.state.theme = a),
|
|
85
180
|
options: e.radioThemeList,
|
|
@@ -87,63 +182,129 @@ function Y(o, t, s, e, h, l) {
|
|
|
87
182
|
class: "theme-radio-group",
|
|
88
183
|
onChange: e.themeChange
|
|
89
184
|
}, null, 8, ["modelValue", "options", "vertical", "onChange"])
|
|
90
|
-
])) :
|
|
185
|
+
])) : q("", !0)
|
|
91
186
|
]),
|
|
92
187
|
_: 1
|
|
93
188
|
}, 8, ["content", "icon", "options", "onClickApi"])
|
|
94
189
|
]),
|
|
95
|
-
default:
|
|
96
|
-
|
|
97
|
-
(
|
|
190
|
+
default: N(() => [
|
|
191
|
+
O("div", $, [
|
|
192
|
+
(V(!0), L(P, null, R(e.THEME_DATA, (a) => (V(), L("div", {
|
|
98
193
|
key: a.type,
|
|
99
|
-
class:
|
|
100
|
-
onClick: (
|
|
101
|
-
},
|
|
194
|
+
class: j(["theme-item", { active: e.state.theme === a.type }]),
|
|
195
|
+
onClick: (_) => e.themeItemChange(a.type)
|
|
196
|
+
}, z(a.text), 11, ee))), 128))
|
|
102
197
|
])
|
|
103
198
|
]),
|
|
104
199
|
_: 1
|
|
105
200
|
}, 8, ["modelValue"])
|
|
106
201
|
]);
|
|
107
202
|
}
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
title: "themeSwitch",
|
|
112
|
-
options: {
|
|
113
|
-
renderType: "icon"
|
|
114
|
-
}
|
|
115
|
-
}, T = M([]);
|
|
116
|
-
let C = null;
|
|
117
|
-
const i = N({
|
|
203
|
+
const ne = /* @__PURE__ */ X(Y, [["render", oe], ["__scopeId", "data-v-02f0b8b7"]]), p = U([]);
|
|
204
|
+
let v = null;
|
|
205
|
+
const i = J({
|
|
118
206
|
theme: "",
|
|
119
207
|
themeLabel: "",
|
|
120
208
|
themeIcon: ""
|
|
121
|
-
}),
|
|
209
|
+
}), E = T(() => p, {
|
|
210
|
+
metaData: {
|
|
211
|
+
id: "engine.toolbars.themeSwitch.composable-index.getThemeData"
|
|
212
|
+
},
|
|
213
|
+
ctx: () => ({
|
|
214
|
+
defineService: D,
|
|
215
|
+
getMetaApi: m,
|
|
216
|
+
getMergeMeta: y,
|
|
217
|
+
META_SERVICE: c,
|
|
218
|
+
setGlobalMonacoEditorTheme: x,
|
|
219
|
+
THEME_DATA: p,
|
|
220
|
+
DEFAULT_THEME: v,
|
|
221
|
+
themeState: i,
|
|
222
|
+
getThemeData: E,
|
|
223
|
+
getThemeState: I,
|
|
224
|
+
getTheme: d,
|
|
225
|
+
themeChange: f
|
|
226
|
+
})
|
|
227
|
+
}), I = T(() => i, {
|
|
228
|
+
metaData: {
|
|
229
|
+
id: "engine.toolbars.themeSwitch.composable-index.getThemeState"
|
|
230
|
+
},
|
|
231
|
+
ctx: () => ({
|
|
232
|
+
defineService: D,
|
|
233
|
+
getMetaApi: m,
|
|
234
|
+
getMergeMeta: y,
|
|
235
|
+
META_SERVICE: c,
|
|
236
|
+
setGlobalMonacoEditorTheme: x,
|
|
237
|
+
THEME_DATA: p,
|
|
238
|
+
DEFAULT_THEME: v,
|
|
239
|
+
themeState: i,
|
|
240
|
+
getThemeData: E,
|
|
241
|
+
getThemeState: I,
|
|
242
|
+
getTheme: d,
|
|
243
|
+
themeChange: f
|
|
244
|
+
})
|
|
245
|
+
}), d = T((o) => p.value.find((t) => o === t.type) || v, {
|
|
246
|
+
metaData: {
|
|
247
|
+
id: "engine.toolbars.themeSwitch.composable-index.getTheme"
|
|
248
|
+
},
|
|
249
|
+
ctx: () => ({
|
|
250
|
+
defineService: D,
|
|
251
|
+
getMetaApi: m,
|
|
252
|
+
getMergeMeta: y,
|
|
253
|
+
META_SERVICE: c,
|
|
254
|
+
setGlobalMonacoEditorTheme: x,
|
|
255
|
+
THEME_DATA: p,
|
|
256
|
+
DEFAULT_THEME: v,
|
|
257
|
+
themeState: i,
|
|
258
|
+
getThemeData: E,
|
|
259
|
+
getThemeState: I,
|
|
260
|
+
getTheme: d,
|
|
261
|
+
themeChange: f
|
|
262
|
+
})
|
|
263
|
+
}), f = T((o) => {
|
|
122
264
|
var e;
|
|
123
|
-
i.theme =
|
|
124
|
-
const t =
|
|
125
|
-
localStorage.setItem(`tiny-engine-theme-${t}`, i.theme),
|
|
126
|
-
},
|
|
127
|
-
|
|
265
|
+
i.theme = d(o).type, i.themeLabel = d(i.theme).text, i.themeIcon = d(i.theme).icon, document.documentElement.setAttribute("data-theme", i.theme);
|
|
266
|
+
const t = m(c.GlobalService).getBaseInfo().id, n = (e = i.theme) != null && e.includes("dark") ? "vs-dark" : "vs";
|
|
267
|
+
localStorage.setItem(`tiny-engine-theme-${t}`, i.theme), x(n);
|
|
268
|
+
}, {
|
|
269
|
+
metaData: {
|
|
270
|
+
id: "engine.toolbars.themeSwitch.composable-index.themeChange"
|
|
271
|
+
},
|
|
272
|
+
ctx: () => ({
|
|
273
|
+
defineService: D,
|
|
274
|
+
getMetaApi: m,
|
|
275
|
+
getMergeMeta: y,
|
|
276
|
+
META_SERVICE: c,
|
|
277
|
+
setGlobalMonacoEditorTheme: x,
|
|
278
|
+
THEME_DATA: p,
|
|
279
|
+
DEFAULT_THEME: v,
|
|
280
|
+
themeState: i,
|
|
281
|
+
getThemeData: E,
|
|
282
|
+
getThemeState: I,
|
|
283
|
+
getTheme: d,
|
|
284
|
+
themeChange: f
|
|
285
|
+
})
|
|
286
|
+
}), le = D({
|
|
287
|
+
id: c.ThemeSwitch,
|
|
128
288
|
type: "MetaService",
|
|
129
289
|
init: () => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
290
|
+
var n;
|
|
291
|
+
const o = m(c.GlobalService).getBaseInfo().id;
|
|
292
|
+
p.value = ((n = y("engine.config")) == null ? void 0 : n.themesList) || [], v = p.value[0];
|
|
293
|
+
const t = localStorage.getItem(`tiny-engine-theme-${o}`) || y("engine.config").theme || v.type;
|
|
294
|
+
f(t);
|
|
134
295
|
},
|
|
135
296
|
apis: () => ({
|
|
136
|
-
getThemeData:
|
|
137
|
-
getThemeState:
|
|
138
|
-
getTheme:
|
|
139
|
-
themeChange:
|
|
297
|
+
getThemeData: E,
|
|
298
|
+
getThemeState: I,
|
|
299
|
+
getTheme: d,
|
|
300
|
+
themeChange: f
|
|
140
301
|
})
|
|
141
|
-
}),
|
|
142
|
-
|
|
143
|
-
entry:
|
|
302
|
+
}), he = {
|
|
303
|
+
...W,
|
|
304
|
+
entry: ne
|
|
144
305
|
};
|
|
145
306
|
export {
|
|
146
307
|
le as ThemeSwitchService,
|
|
147
|
-
|
|
308
|
+
he as default
|
|
148
309
|
};
|
|
149
310
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/Main.vue","../meta.js","../src/composable/index.ts","../index.ts"],"sourcesContent":["<template>\n <div class=\"toolbar-theme-switch\">\n <tiny-popover\n width=\"130\"\n trigger=\"manual\"\n v-model=\"showpopover\"\n :visible-arrow=\"false\"\n popper-class=\"theme-popover\"\n >\n <div class=\"theme-list\">\n <div\n v-for=\"item in THEME_DATA\"\n :key=\"item.type\"\n :class=\"['theme-item', { active: state.theme === item.type }]\"\n @click=\"themeItemChange(item.type)\"\n >\n {{ item.text }}\n </div>\n </div>\n <template #reference>\n <toolbar-base :content=\"baseContent\" :icon=\"baseIcon\" :options=\"optionsData\" @click-api=\"changeThemeType\">\n <template v-if=\"position === 'collapse'\">\n <div class=\"toolbar-theme-switch-radio\">\n <div class=\"toolbar-theme-switch-radio-title\">主题</div>\n <tiny-radio-group\n v-model=\"state.theme\"\n :options=\"radioThemeList\"\n :vertical=\"themeShowType ? false : true\"\n class=\"theme-radio-group\"\n @change=\"themeChange\"\n >\n </tiny-radio-group>\n </div>\n </template>\n </toolbar-base>\n </template>\n </tiny-popover>\n </div>\n</template>\n\n<script>\nimport { computed, ref } from 'vue'\nimport { ToolbarBase } from '@opentiny/tiny-engine-common'\nimport { TinyRadioGroup, TinyPopover } from '@opentiny/vue'\nimport { getMetaApi, META_SERVICE } from '@opentiny/tiny-engine-meta-register'\n\nexport default {\n components: {\n ToolbarBase,\n TinyRadioGroup,\n TinyPopover\n },\n props: {\n options: {\n type: Object,\n default: () => ({})\n },\n position: {\n type: String,\n default: 'right'\n }\n },\n setup(props) {\n const { getThemeData, getThemeState, themeChange, getTheme } = getMetaApi(META_SERVICE.ThemeSwitch)\n const state = getThemeState()\n const THEME_DATA = getThemeData()\n const COLLAPSE = 'collapse'\n const optionsData = computed(() => {\n const options = { ...props.options }\n if (props.position === COLLAPSE) {\n options.renderType = ''\n }\n\n return options\n })\n const radioThemeList = computed(() => {\n return THEME_DATA.value.map((item) => ({ ...item, label: item.type }))\n })\n const baseContent = computed(() => (props.position === COLLAPSE ? '' : state.themeLabel))\n const baseIcon = computed(() => (props.position === COLLAPSE ? '' : state.themeIcon))\n const showpopover = ref(false)\n\n const themeShowType = computed(() => {\n const filterList = THEME_DATA.value.filter((item) => ['light', 'dark'].includes(item.type)) || []\n return THEME_DATA.value.length === filterList.length\n })\n\n const toChangeTheme = () => {\n const theme = getTheme(state.theme).oppositeTheme\n themeChange(theme)\n }\n\n const changeThemeType = () => {\n if (props.position === COLLAPSE) {\n return\n }\n if (themeShowType.value) {\n toChangeTheme()\n } else {\n showpopover.value = true\n }\n }\n\n const themeItemChange = (theme) => {\n themeChange(theme)\n showpopover.value = false\n }\n\n return {\n THEME_DATA,\n state,\n optionsData,\n radioThemeList,\n baseContent,\n baseIcon,\n toChangeTheme,\n themeChange,\n showpopover,\n themeShowType,\n themeItemChange,\n changeThemeType\n }\n }\n}\n</script>\n<style lang=\"less\" scoped>\n.theme-list {\n .theme-item {\n padding: 4px 16px;\n margin: 0 -16px;\n &:hover {\n background-color: var(--te-toolbar-theme-popover-list-item-bg-color-hover);\n }\n }\n .active {\n background-color: var(--te-toolbar-theme-popover-list-item-bg-color-active);\n }\n}\n</style>\n","export default {\n id: 'engine.toolbars.themeSwitch',\n type: 'toolbars',\n title: 'themeSwitch',\n options: {\n renderType: 'icon'\n }\n}\n","import { reactive, ref } from 'vue'\nimport {\n defineService,\n getMetaApi,\n getMergeMeta,\n META_SERVICE,\n getMergeRegistry\n} from '@opentiny/tiny-engine-meta-register'\nimport { setGlobalMonacoEditorTheme } from '@opentiny/tiny-engine-common'\n\nconst THEME_DATA = ref<any[]>([])\n\nlet DEFAULT_THEME: any = null\n\nconst themeState = reactive({\n theme: '',\n themeLabel: '',\n themeIcon: ''\n})\n\nconst getThemeData = () => THEME_DATA\nconst getThemeState = () => themeState\n\nconst getTheme = (theme: string) => {\n return THEME_DATA.value.find((item) => theme === item.type) || DEFAULT_THEME\n}\n\nconst themeChange = (theme: string) => {\n themeState.theme = getTheme(theme).type\n themeState.themeLabel = getTheme(themeState.theme).text\n themeState.themeIcon = getTheme(themeState.theme).icon\n document.documentElement.setAttribute('data-theme', themeState.theme)\n\n const appId = getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id\n const editorTheme = themeState.theme?.includes('dark') ? 'vs-dark' : 'vs'\n localStorage.setItem(`tiny-engine-theme-${appId}`, themeState.theme)\n setGlobalMonacoEditorTheme(editorTheme)\n}\n\nexport default defineService({\n id: META_SERVICE.ThemeSwitch,\n type: 'MetaService',\n init: () => {\n const appId = getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id\n THEME_DATA.value = getMergeRegistry('themes')\n DEFAULT_THEME = THEME_DATA.value[0]\n const theme =\n localStorage.getItem(`tiny-engine-theme-${appId}`) || getMergeMeta('engine.config').theme || DEFAULT_THEME.type\n themeChange(theme)\n },\n apis: () => ({\n getThemeData,\n getThemeState,\n getTheme,\n themeChange\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'\nimport { default as ThemeSwitchService } from './src/composable'\nimport './src/styles/vars.less'\n\nexport default {\n ...metaData,\n entry\n}\n\nexport { ThemeSwitchService }\n"],"names":["_sfc_main","ToolbarBase","TinyRadioGroup","TinyPopover","props","getThemeData","getThemeState","themeChange","getTheme","getMetaApi","META_SERVICE","state","THEME_DATA","COLLAPSE","optionsData","computed","options","radioThemeList","item","baseContent","baseIcon","showpopover","ref","themeShowType","filterList","toChangeTheme","theme","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","_createVNode","_component_tiny_popover","$setup","$event","_component_toolbar_base","$props","_hoisted_4","_cache","_createElementVNode","_component_tiny_radio_group","_Fragment","_renderList","_toDisplayString","_hoisted_3","metaData","DEFAULT_THEME","themeState","reactive","appId","editorTheme","_a","setGlobalMonacoEditorTheme","index$1","defineService","getMergeRegistry","getMergeMeta","index","entry"],"mappings":";;;;;;;;;;GA8CKA,IAAU;AAAA,EACb,YAAY;AAAA,IACV,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,aAAAC;AAAA;EAEF,OAAO;AAAA,IACL,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS,OAAO,CAAA;AAAA;IAElB,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA;EAEF,MAAMC,GAAO;AACX,UAAM,EAAE,cAAAC,GAAc,eAAAC,GAAe,aAAAC,GAAa,UAAAC,MAAaC,EAAWC,EAAa,WAAW,GAC5FC,IAAQL,EAAa,GACrBM,IAAaP,EAAY,GACzBQ,IAAW,YACXC,IAAcC,EAAS,MAAM;AACjC,YAAMC,IAAU,EAAE,GAAGZ,EAAM,QAAM;AACjC,aAAIA,EAAM,aAAaS,MACrBG,EAAQ,aAAa,KAGhBA;AAAA,KACR,GACKC,IAAiBF,EAAS,MACvBH,EAAW,MAAM,IAAI,CAACM,OAAU,EAAE,GAAGA,GAAM,OAAOA,EAAK,OAAO,CACtE,GACKC,IAAcJ,EAAS,MAAOX,EAAM,aAAaS,IAAW,KAAKF,EAAM,UAAW,GAClFS,IAAWL,EAAS,MAAOX,EAAM,aAAaS,IAAW,KAAKF,EAAM,SAAU,GAC9EU,IAAcC,EAAI,EAAK,GAEvBC,IAAgBR,EAAS,MAAM;AACnC,YAAMS,IAAaZ,EAAW,MAAM,OAAO,CAACM,MAAS,CAAC,SAAS,MAAM,EAAE,SAASA,EAAK,IAAI,CAAC,KAAK,CAAA;AAC/F,aAAON,EAAW,MAAM,WAAWY,EAAW;AAAA,KAC/C,GAEKC,IAAgB,MAAM;AAC1B,YAAMC,IAAQlB,EAASG,EAAM,KAAK,EAAE;AACpC,MAAAJ,EAAYmB,CAAK;A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A2BF,CAAW;AACxC,GAEAG,KAAeC,EAAc;AAAA,EAC3B,IAAI5C,EAAa;AAAA,EACjB,MAAM;AAAA,EACN,MAAM,MAAM;AACV,UAAMuC,IAAQxC,EAAWC,EAAa,aAAa,EAAE,cAAc;AACnE,IAAAE,EAAW,QAAQ2C,EAAiB,QAAQ,GAC5CT,IAAgBlC,EAAW,MAAM,CAAC;AAClC,UAAMc,IACJ,aAAa,QAAQ,qBAAqBuB,CAAK,EAAE,KAAKO,EAAa,eAAe,EAAE,SAASV,EAAc;AAC7G,IAAAvC,EAAYmB,CAAK;AAAA,EAAA;AAAA,EAEnB,MAAM,OAAO;AAAA,IACX,cAAArB;AAAA,IACA,eAAAC;AAAA,IACA,UAAAE;AAAA,IACA,aAAAD;AAAA,EAAA;AAEJ,CAAC,GCvCDkD,KAAe;AAAA,EACb,GAAGZ;AAAA,EACH,OAAAa;AACF;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../meta.js","../index.ts"],"sourcesContent":["export default {\n id: 'engine.toolbars.themeSwitch',\n type: 'toolbars',\n title: 'themeSwitch',\n options: {\n renderType: 'icon'\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'\nimport { default as ThemeSwitchService } from './src/composable'\nimport './src/styles/vars.less'\n\nexport default {\n ...metaData,\n entry\n}\n\nexport { ThemeSwitchService }\n"],"names":["metaData","index","entry"],"mappings":";;;;;AAAA,MAAAA,IAAe;AAAA,EACb,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,IACP,YAAY;AAAA,EAChB;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICUAC,KAAe;AAAA,EACb,GAAGD;AAAA,EACH,OAAAE;AACF;"}
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.theme-list .theme-item[data-v-
|
|
1
|
+
.theme-list .theme-item[data-v-02f0b8b7]{padding:4px 16px;margin:0 -16px}.theme-list .theme-item[data-v-02f0b8b7]:hover{background-color:var(--te-toolbar-theme-popover-list-item-bg-color-hover)}.theme-list .active[data-v-02f0b8b7]{background-color:var(--te-toolbar-theme-popover-list-item-bg-color-active)}.toolbar-theme-switch{--te-toolbar-theme-switch-radio-title: var(--te-common-text-secondary)}.theme-list{--te-toolbar-theme-popover-list-item-bg-color-hover: var(--te-common-bg-container);--te-toolbar-theme-popover-list-item-bg-color-active: var(--te-common-bg-container)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-engine-toolbar-theme-switch",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0-alpha.1",
|
|
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-meta-register": "2.
|
|
30
|
-
"@opentiny/tiny-engine-utils": "2.
|
|
28
|
+
"@opentiny/tiny-engine-common": "2.7.0-alpha.1",
|
|
29
|
+
"@opentiny/tiny-engine-meta-register": "2.7.0-alpha.1",
|
|
30
|
+
"@opentiny/tiny-engine-utils": "2.7.0-alpha.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.
|
|
33
|
+
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.7.0-alpha.1",
|
|
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": "c01029eda7c64a2e9191ec0d861790df9eece7cf"
|
|
43
43
|
}
|