1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div :class="$style.root">
<div :class="$style.body">
<slot></slot>
</div>
<div :class="$style.menu">
<i v-if="isAccountOverrided" class="ti ti-user-cog" style="color: var(--MI_THEME-accent); opacity: 0.7;"></i>
<div :class="$style.buttons">
<button class="_button" style="color: var(--MI_THEME-fg)" @click="showMenu"><i class="ti ti-dots"></i></button>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import type { PREF_DEF } from '@/preferences/def.js';
import * as os from '@/os.js';
import { profileManager } from '@/preferences.js';
const props = withDefaults(defineProps<{
k: keyof typeof PREF_DEF;
}>(), {
});
const isAccountOverrided = ref(profileManager.isAccountOverrided(props.k));
function showMenu(ev: MouseEvent) {
const i = window.setInterval(() => {
isAccountOverrided.value = profileManager.isAccountOverrided(props.k);
}, 100);
os.popupMenu(profileManager.getPerPrefMenu(props.k), ev.currentTarget ?? ev.target, {
onClosing: () => {
window.clearInterval(i);
},
});
}
</script>
<style lang="scss" module>
.root {
position: relative;
display: flex;
&:hover {
&::after {
content: '';
position: absolute;
top: -8px;
left: -8px;
width: calc(100% + 16px);
height: calc(100% + 16px);
border-radius: 8px;
background: light-dark(rgba(0, 0, 0, 0.02), rgba(255, 255, 255, 0.02));
pointer-events: none;
}
.menu {
.buttons {
opacity: 0.7;
}
}
}
.body {
flex: 1;
}
.menu {
display: flex;
gap: 8px;
align-items: center;
margin-left: 12px;
font-size: 12px;
padding-left: 8px;
border-left: solid 1px var(--MI_THEME-divider);
&:hover {
.buttons {
opacity: 1;
}
}
.buttons {
opacity: 0.3;
}
}
}
</style>
|