2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
2024-02-13 16:59:27 +01:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
<template>
|
2023-04-04 02:38:34 +02:00
|
|
|
<div role="menu">
|
2022-07-17 14:06:33 +02:00
|
|
|
<div
|
|
|
|
ref="itemsEl" v-hotkey="keymap"
|
2023-01-09 22:02:46 +01:00
|
|
|
class="_popup _shadow"
|
|
|
|
:class="[$style.root, { [$style.center]: align === 'center', [$style.asDrawer]: asDrawer }]"
|
2022-07-17 14:06:33 +02:00
|
|
|
:style="{ width: (width && !asDrawer) ? width + 'px' : '', maxHeight: maxHeight ? maxHeight + 'px' : '' }"
|
|
|
|
@contextmenu.self="e => e.preventDefault()"
|
|
|
|
>
|
2024-01-30 11:53:53 +01:00
|
|
|
<template v-for="(item, i) in (items2 ?? [])">
|
2023-12-12 02:26:37 +01:00
|
|
|
<div v-if="item.type === 'divider'" role="separator" :class="$style.divider"></div>
|
2023-04-04 02:38:34 +02:00
|
|
|
<span v-else-if="item.type === 'label'" role="menuitem" :class="[$style.label, $style.item]">
|
2023-12-22 12:41:42 +01:00
|
|
|
<span style="opacity: 0.7;">{{ item.text }}</span>
|
2022-07-17 14:06:33 +02:00
|
|
|
</span>
|
2023-04-04 02:38:34 +02:00
|
|
|
<span v-else-if="item.type === 'pending'" role="menuitem" :tabindex="i" :class="[$style.pending, $style.item]">
|
2022-07-17 14:06:33 +02:00
|
|
|
<span><MkEllipsis/></span>
|
|
|
|
</span>
|
2023-04-04 02:38:34 +02:00
|
|
|
<MkA v-else-if="item.type === 'link'" role="menuitem" :to="item.to" :tabindex="i" class="_button" :class="$style.item" @click.passive="close(true)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
2023-01-09 22:02:46 +01:00
|
|
|
<i v-if="item.icon" class="ti-fw" :class="[$style.icon, item.icon]"></i>
|
2023-01-16 06:18:11 +01:00
|
|
|
<MkAvatar v-if="item.avatar" :user="item.avatar" :class="$style.avatar"/>
|
2023-12-22 12:41:42 +01:00
|
|
|
<div :class="$style.item_content">
|
|
|
|
<span :class="$style.item_content_text">{{ item.text }}</span>
|
|
|
|
<span v-if="item.indicate" :class="$style.indicator"><i class="_indicatorCircle"></i></span>
|
|
|
|
</div>
|
2022-07-17 14:06:33 +02:00
|
|
|
</MkA>
|
2023-04-04 02:38:34 +02:00
|
|
|
<a v-else-if="item.type === 'a'" role="menuitem" :href="item.href" :target="item.target" :download="item.download" :tabindex="i" class="_button" :class="$style.item" @click="close(true)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
2023-01-09 22:02:46 +01:00
|
|
|
<i v-if="item.icon" class="ti-fw" :class="[$style.icon, item.icon]"></i>
|
2023-12-22 12:41:42 +01:00
|
|
|
<div :class="$style.item_content">
|
|
|
|
<span :class="$style.item_content_text">{{ item.text }}</span>
|
|
|
|
<span v-if="item.indicate" :class="$style.indicator"><i class="_indicatorCircle"></i></span>
|
|
|
|
</div>
|
2022-07-17 14:06:33 +02:00
|
|
|
</a>
|
2023-04-04 02:38:34 +02:00
|
|
|
<button v-else-if="item.type === 'user'" role="menuitem" :tabindex="i" class="_button" :class="[$style.item, { [$style.active]: item.active }]" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
2023-02-08 12:07:19 +01:00
|
|
|
<MkAvatar :user="item.user" :class="$style.avatar"/><MkUserName :user="item.user"/>
|
2023-12-22 12:41:42 +01:00
|
|
|
<div v-if="item.indicate" :class="$style.item_content">
|
|
|
|
<span :class="$style.indicator"><i class="_indicatorCircle"></i></span>
|
|
|
|
</div>
|
2022-07-17 14:06:33 +02:00
|
|
|
</button>
|
2023-08-01 08:32:03 +02:00
|
|
|
<button v-else-if="item.type === 'switch'" role="menuitemcheckbox" :tabindex="i" class="_button" :class="[$style.item, $style.switch, { [$style.switchDisabled]: item.disabled } ]" @click="switchItem(item)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
2024-03-30 08:02:03 +01:00
|
|
|
<i v-if="item.icon" class="ti-fw" :class="[$style.icon, item.icon]"></i>
|
|
|
|
<MkSwitchButton v-else :class="$style.switchButton" :checked="item.ref" :disabled="item.disabled" @toggle="switchItem(item)"/>
|
|
|
|
<div :class="$style.item_content">
|
|
|
|
<span :class="[$style.item_content_text, { [$style.switchText]: !item.icon }]">{{ item.text }}</span>
|
|
|
|
<MkSwitchButton v-if="item.icon" :class="[$style.switchButton, $style.caret]" :checked="item.ref" :disabled="item.disabled" @toggle="switchItem(item)"/>
|
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
<button v-else-if="item.type === 'radio'" class="_button" role="menuitem" :tabindex="i" :class="[$style.item, $style.parent, { [$style.childShowing]: childShowingItem === item }]" @mouseenter="preferClick ? null : showRadioOptions(item, $event)" @click="!preferClick ? null : showRadioOptions(item, $event)">
|
|
|
|
<i v-if="item.icon" class="ti-fw" :class="[$style.icon, item.icon]" style="pointer-events: none;"></i>
|
2023-12-22 12:41:42 +01:00
|
|
|
<div :class="$style.item_content">
|
2024-03-30 08:02:03 +01:00
|
|
|
<span :class="$style.item_content_text" style="pointer-events: none;">{{ item.text }}</span>
|
2024-06-21 13:57:35 +02:00
|
|
|
<span :class="$style.caret" style="pointer-events: none;"><i class="ti ti-chevron-right ti-fw"></i></span>
|
2024-03-30 08:02:03 +01:00
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
<button v-else-if="item.type === 'radioOption'" :tabindex="i" class="_button" role="menuitem" :class="[$style.item, { [$style.radioActive]: item.active }]" @click="clicked(item.action, $event, false)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
|
|
|
<div :class="$style.icon">
|
|
|
|
<span :class="[$style.radio, { [$style.radioChecked]: item.active }]"></span>
|
|
|
|
</div>
|
2023-12-22 12:41:42 +01:00
|
|
|
<div :class="$style.item_content">
|
2024-03-30 08:02:03 +01:00
|
|
|
<span :class="$style.item_content_text">{{ item.text }}</span>
|
2023-12-22 12:41:42 +01:00
|
|
|
</div>
|
2023-08-01 08:32:03 +02:00
|
|
|
</button>
|
2023-09-23 05:43:32 +02:00
|
|
|
<button v-else-if="item.type === 'parent'" class="_button" role="menuitem" :tabindex="i" :class="[$style.item, $style.parent, { [$style.childShowing]: childShowingItem === item }]" @mouseenter="preferClick ? null : showChildren(item, $event)" @click="!preferClick ? null : showChildren(item, $event)">
|
2023-09-23 13:35:05 +02:00
|
|
|
<i v-if="item.icon" class="ti-fw" :class="[$style.icon, item.icon]" style="pointer-events: none;"></i>
|
2023-12-22 12:41:42 +01:00
|
|
|
<div :class="$style.item_content">
|
|
|
|
<span :class="$style.item_content_text" style="pointer-events: none;">{{ item.text }}</span>
|
2024-06-21 13:57:35 +02:00
|
|
|
<span :class="$style.caret" style="pointer-events: none;"><i class="ti ti-chevron-right ti-fw"></i></span>
|
2023-12-22 12:41:42 +01:00
|
|
|
</div>
|
2023-09-23 05:43:32 +02:00
|
|
|
</button>
|
2024-01-30 11:53:53 +01:00
|
|
|
<button v-else :tabindex="i" class="_button" role="menuitem" :class="[$style.item, { [$style.danger]: item.danger, [$style.active]: getValue(item.active) }]" :disabled="getValue(item.active)" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
2023-01-09 22:02:46 +01:00
|
|
|
<i v-if="item.icon" class="ti-fw" :class="[$style.icon, item.icon]"></i>
|
2023-01-16 06:18:11 +01:00
|
|
|
<MkAvatar v-if="item.avatar" :user="item.avatar" :class="$style.avatar"/>
|
2023-12-22 12:41:42 +01:00
|
|
|
<div :class="$style.item_content">
|
|
|
|
<span :class="$style.item_content_text">{{ item.text }}</span>
|
|
|
|
<span v-if="item.indicate" :class="$style.indicator"><i class="_indicatorCircle"></i></span>
|
|
|
|
</div>
|
2022-07-17 14:06:33 +02:00
|
|
|
</button>
|
|
|
|
</template>
|
2024-01-30 11:53:53 +01:00
|
|
|
<span v-if="items2 == null || items2.length === 0" :class="[$style.none, $style.item]">
|
2022-07-20 15:24:26 +02:00
|
|
|
<span>{{ i18n.ts.none }}</span>
|
2020-10-17 13:12:00 +02:00
|
|
|
</span>
|
2022-07-17 14:06:33 +02:00
|
|
|
</div>
|
2023-06-01 10:19:46 +02:00
|
|
|
<div v-if="childMenu">
|
2024-01-30 11:53:53 +01:00
|
|
|
<XChild ref="child" :items="childMenu" :targetElement="childTarget!" :rootElement="itemsEl!" showing @actioned="childActioned" @close="close(false)"/>
|
2022-07-17 14:06:33 +02:00
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-08-09 02:08:47 +02:00
|
|
|
<script lang="ts">
|
2024-01-30 11:53:53 +01:00
|
|
|
import { ComputedRef, computed, defineAsyncComponent, isRef, nextTick, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { focusPrev, focusNext } from '@/scripts/focus.js';
|
2023-08-01 08:32:03 +02:00
|
|
|
import MkSwitchButton from '@/components/MkSwitch.button.vue';
|
2024-03-30 08:02:03 +01:00
|
|
|
import { MenuItem, InnerMenuItem, MenuPending, MenuAction, MenuSwitch, MenuRadio, MenuRadioOption, MenuParent } from '@/types/menu.js';
|
2023-09-19 09:37:43 +02:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { isTouchUsing } from '@/scripts/touch.js';
|
2023-08-09 02:08:47 +02:00
|
|
|
|
|
|
|
const childrenCache = new WeakMap<MenuParent, MenuItem[]>();
|
|
|
|
</script>
|
2022-07-20 15:24:26 +02:00
|
|
|
|
2023-08-09 02:08:47 +02:00
|
|
|
<script lang="ts" setup>
|
2022-09-06 11:21:49 +02:00
|
|
|
const XChild = defineAsyncComponent(() => import('./MkMenu.child.vue'));
|
2022-01-30 06:11:52 +01:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
items: MenuItem[];
|
|
|
|
viaKeyboard?: boolean;
|
|
|
|
asDrawer?: boolean;
|
|
|
|
align?: 'center' | string;
|
|
|
|
width?: number;
|
|
|
|
maxHeight?: number;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
2022-07-17 14:06:33 +02:00
|
|
|
(ev: 'close', actioned?: boolean): void;
|
2023-08-09 02:08:47 +02:00
|
|
|
(ev: 'hide'): void;
|
2022-01-30 06:11:52 +01:00
|
|
|
}>();
|
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const itemsEl = shallowRef<HTMLDivElement>();
|
2022-01-30 06:11:52 +01:00
|
|
|
|
2024-01-30 11:53:53 +01:00
|
|
|
const items2 = ref<InnerMenuItem[]>();
|
2022-01-30 06:11:52 +01:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const child = shallowRef<InstanceType<typeof XChild>>();
|
2022-07-17 14:06:33 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const keymap = computed(() => ({
|
2022-01-30 06:11:52 +01:00
|
|
|
'up|k|shift+tab': focusUp,
|
|
|
|
'down|j|tab': focusDown,
|
|
|
|
'esc': close,
|
|
|
|
}));
|
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const childShowingItem = ref<MenuItem | null>();
|
2022-07-17 14:06:33 +02:00
|
|
|
|
2023-08-09 02:08:47 +02:00
|
|
|
let preferClick = isTouchUsing || props.asDrawer;
|
|
|
|
|
2022-01-30 06:11:52 +01:00
|
|
|
watch(() => props.items, () => {
|
2024-01-30 11:53:53 +01:00
|
|
|
const items = [...props.items].filter(item => item !== undefined) as (NonNullable<MenuItem> | MenuPending)[];
|
2022-01-30 06:11:52 +01:00
|
|
|
|
|
|
|
for (let i = 0; i < items.length; i++) {
|
|
|
|
const item = items[i];
|
|
|
|
|
2024-01-30 11:53:53 +01:00
|
|
|
if ('then' in item) { // if item is Promise
|
2022-01-30 06:11:52 +01:00
|
|
|
items[i] = { type: 'pending' };
|
|
|
|
item.then(actualItem => {
|
2024-01-30 11:53:53 +01:00
|
|
|
if (items2.value?.[i]) items2.value[i] = actualItem;
|
2020-10-17 13:12:00 +02:00
|
|
|
});
|
|
|
|
}
|
2022-01-30 06:11:52 +01:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
items2.value = items as InnerMenuItem[];
|
2022-01-30 06:11:52 +01:00
|
|
|
}, {
|
|
|
|
immediate: true,
|
|
|
|
});
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-08-09 02:08:47 +02:00
|
|
|
const childMenu = ref<MenuItem[] | null>();
|
2023-12-07 06:42:09 +01:00
|
|
|
const childTarget = shallowRef<HTMLElement | null>();
|
2022-07-17 14:06:33 +02:00
|
|
|
|
|
|
|
function closeChild() {
|
2023-02-24 12:48:19 +01:00
|
|
|
childMenu.value = null;
|
2023-12-07 06:42:09 +01:00
|
|
|
childShowingItem.value = null;
|
2022-07-17 14:06:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function childActioned() {
|
|
|
|
closeChild();
|
|
|
|
close(true);
|
|
|
|
}
|
|
|
|
|
2023-08-09 02:08:47 +02:00
|
|
|
const onGlobalMousedown = (event: MouseEvent) => {
|
2024-01-30 11:53:53 +01:00
|
|
|
if (childTarget.value && (event.target === childTarget.value || childTarget.value.contains(event.target as Node))) return;
|
2023-12-07 06:42:09 +01:00
|
|
|
if (child.value && child.value.checkHit(event)) return;
|
2022-07-17 14:06:33 +02:00
|
|
|
closeChild();
|
2023-08-09 02:08:47 +02:00
|
|
|
};
|
2022-07-17 14:06:33 +02:00
|
|
|
|
|
|
|
let childCloseTimer: null | number = null;
|
2023-10-29 08:09:20 +01:00
|
|
|
|
2022-07-17 14:06:33 +02:00
|
|
|
function onItemMouseEnter(item) {
|
|
|
|
childCloseTimer = window.setTimeout(() => {
|
|
|
|
closeChild();
|
|
|
|
}, 300);
|
|
|
|
}
|
2023-10-29 08:09:20 +01:00
|
|
|
|
2022-07-17 14:06:33 +02:00
|
|
|
function onItemMouseLeave(item) {
|
|
|
|
if (childCloseTimer) window.clearTimeout(childCloseTimer);
|
|
|
|
}
|
|
|
|
|
2024-03-30 08:02:03 +01:00
|
|
|
async function showRadioOptions(item: MenuRadio, ev: MouseEvent) {
|
|
|
|
const children: MenuItem[] = Object.keys(item.options).map<MenuRadioOption>(key => {
|
|
|
|
const value = item.options[key];
|
|
|
|
return {
|
|
|
|
type: 'radioOption',
|
|
|
|
text: key,
|
|
|
|
action: () => {
|
|
|
|
item.ref = value;
|
|
|
|
},
|
|
|
|
active: computed(() => item.ref === value),
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
if (props.asDrawer) {
|
|
|
|
os.popupMenu(children, ev.currentTarget ?? ev.target).finally(() => {
|
|
|
|
emit('close');
|
|
|
|
});
|
|
|
|
emit('hide');
|
|
|
|
} else {
|
|
|
|
childTarget.value = (ev.currentTarget ?? ev.target) as HTMLElement;
|
|
|
|
childMenu.value = children;
|
|
|
|
childShowingItem.value = item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-01 08:32:03 +02:00
|
|
|
async function showChildren(item: MenuParent, ev: MouseEvent) {
|
2024-01-30 11:53:53 +01:00
|
|
|
const children: MenuItem[] = await (async () => {
|
2023-08-09 02:08:47 +02:00
|
|
|
if (childrenCache.has(item)) {
|
|
|
|
return childrenCache.get(item)!;
|
2023-02-24 12:48:19 +01:00
|
|
|
} else {
|
2023-08-09 02:08:47 +02:00
|
|
|
if (typeof item.children === 'function') {
|
|
|
|
return Promise.resolve(item.children());
|
|
|
|
} else {
|
|
|
|
return item.children;
|
|
|
|
}
|
2023-02-24 12:48:19 +01:00
|
|
|
}
|
2023-08-09 02:08:47 +02:00
|
|
|
})();
|
|
|
|
|
|
|
|
childrenCache.set(item, children);
|
2023-02-24 12:48:19 +01:00
|
|
|
|
2022-07-17 14:06:33 +02:00
|
|
|
if (props.asDrawer) {
|
2023-08-09 02:08:47 +02:00
|
|
|
os.popupMenu(children, ev.currentTarget ?? ev.target).finally(() => {
|
|
|
|
emit('close');
|
|
|
|
});
|
|
|
|
emit('hide');
|
2022-07-17 14:06:33 +02:00
|
|
|
} else {
|
2024-01-30 11:53:53 +01:00
|
|
|
childTarget.value = (ev.currentTarget ?? ev.target) as HTMLElement;
|
2023-08-09 02:08:47 +02:00
|
|
|
// これでもリアクティビティは保たれる
|
|
|
|
childMenu.value = children;
|
2023-12-07 06:42:09 +01:00
|
|
|
childShowingItem.value = item;
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2022-07-17 14:06:33 +02:00
|
|
|
}
|
2022-01-30 06:11:52 +01:00
|
|
|
|
2024-03-30 08:02:03 +01:00
|
|
|
function clicked(fn: MenuAction, ev: MouseEvent, doClose = true) {
|
2022-01-30 06:11:52 +01:00
|
|
|
fn(ev);
|
2024-03-30 08:02:03 +01:00
|
|
|
|
|
|
|
if (!doClose) return;
|
2022-07-17 14:06:33 +02:00
|
|
|
close(true);
|
2022-01-30 06:11:52 +01:00
|
|
|
}
|
|
|
|
|
2022-07-17 14:06:33 +02:00
|
|
|
function close(actioned = false) {
|
|
|
|
emit('close', actioned);
|
2022-01-30 06:11:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function focusUp() {
|
|
|
|
focusPrev(document.activeElement);
|
|
|
|
}
|
|
|
|
|
|
|
|
function focusDown() {
|
|
|
|
focusNext(document.activeElement);
|
|
|
|
}
|
2022-07-17 14:06:33 +02:00
|
|
|
|
2023-08-01 08:32:03 +02:00
|
|
|
function switchItem(item: MenuSwitch & { ref: any }) {
|
2023-12-06 04:07:53 +01:00
|
|
|
if (item.disabled !== undefined && (typeof item.disabled === 'boolean' ? item.disabled : item.disabled.value)) return;
|
2023-08-01 08:32:03 +02:00
|
|
|
item.ref = !item.ref;
|
|
|
|
}
|
|
|
|
|
2024-01-30 11:53:53 +01:00
|
|
|
function getValue<T>(item?: ComputedRef<T> | T) {
|
|
|
|
return isRef(item) ? item.value : item;
|
|
|
|
}
|
|
|
|
|
2022-07-17 14:06:33 +02:00
|
|
|
onMounted(() => {
|
|
|
|
if (props.viaKeyboard) {
|
|
|
|
nextTick(() => {
|
2023-12-07 06:42:09 +01:00
|
|
|
if (itemsEl.value) focusNext(itemsEl.value.children[0], true, false);
|
2022-07-17 14:06:33 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-12-08 05:44:38 +01:00
|
|
|
// TODO: アクティブな要素までスクロール
|
|
|
|
//itemsEl.scrollTo();
|
|
|
|
|
2022-07-17 14:06:33 +02:00
|
|
|
document.addEventListener('mousedown', onGlobalMousedown, { passive: true });
|
|
|
|
});
|
|
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
document.removeEventListener('mousedown', onGlobalMousedown);
|
|
|
|
});
|
2020-10-17 13:12:00 +02:00
|
|
|
</script>
|
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2020-10-17 13:12:00 +02:00
|
|
|
padding: 8px 0;
|
2021-11-28 12:07:37 +01:00
|
|
|
box-sizing: border-box;
|
2023-12-22 12:41:42 +01:00
|
|
|
max-width: 100vw;
|
2021-10-03 08:39:39 +02:00
|
|
|
min-width: 200px;
|
2021-11-05 02:48:37 +01:00
|
|
|
overflow: auto;
|
2021-12-03 04:00:11 +01:00
|
|
|
overscroll-behavior: contain;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2021-10-03 08:39:39 +02:00
|
|
|
&.center {
|
2020-10-17 13:12:00 +02:00
|
|
|
> .item {
|
2021-10-03 08:39:39 +02:00
|
|
|
text-align: center;
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&.asDrawer {
|
2023-01-10 05:50:34 +01:00
|
|
|
padding: 12px 0 max(env(safe-area-inset-bottom, 0px), 12px) 0;
|
2020-10-17 13:12:00 +02:00
|
|
|
width: 100%;
|
2023-10-31 19:44:34 +01:00
|
|
|
border-radius: var(--radius-lg);
|
2023-01-09 22:02:46 +01:00
|
|
|
border-bottom-right-radius: 0;
|
|
|
|
border-bottom-left-radius: 0;
|
2021-10-03 08:39:39 +02:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
> .item {
|
|
|
|
font-size: 1em;
|
|
|
|
padding: 12px 24px;
|
2022-06-05 05:23:57 +02:00
|
|
|
|
|
|
|
&:before {
|
2023-01-09 22:02:46 +01:00
|
|
|
width: calc(100% - 24px);
|
2023-10-31 19:44:34 +01:00
|
|
|
border-radius: var(--radius);
|
2022-06-05 05:23:57 +02:00
|
|
|
}
|
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
> .icon {
|
|
|
|
margin-right: 14px;
|
|
|
|
width: 24px;
|
|
|
|
}
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
> .divider {
|
|
|
|
margin: 12px 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-10-03 08:39:39 +02:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
.item {
|
2023-12-22 12:41:42 +01:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2023-01-09 22:02:46 +01:00
|
|
|
position: relative;
|
|
|
|
padding: 5px 16px;
|
|
|
|
width: 100%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
white-space: nowrap;
|
|
|
|
font-size: 0.9em;
|
|
|
|
line-height: 20px;
|
|
|
|
text-align: left;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
content: "";
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
z-index: -1;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
margin: auto;
|
|
|
|
width: calc(100% - 16px);
|
|
|
|
height: 100%;
|
2023-10-31 19:44:34 +01:00
|
|
|
border-radius: var(--radius-sm);
|
2023-01-09 22:02:46 +01:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&:not(:disabled):hover {
|
|
|
|
color: var(--accent);
|
|
|
|
text-decoration: none;
|
2021-10-03 08:39:39 +02:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&:before {
|
|
|
|
background: var(--accentedBg);
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2023-01-09 22:02:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
&.danger {
|
|
|
|
color: #ff2a2a;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&:hover {
|
|
|
|
color: #fff;
|
2021-10-09 06:12:41 +02:00
|
|
|
|
|
|
|
&:before {
|
2023-01-09 22:02:46 +01:00
|
|
|
background: #ff4242;
|
2021-10-09 06:12:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&:active {
|
|
|
|
color: #fff;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&:before {
|
|
|
|
background: #d42e2e !important;
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
}
|
2023-01-09 22:02:46 +01:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&:active,
|
|
|
|
&.active {
|
|
|
|
color: var(--fgOnAccent) !important;
|
|
|
|
opacity: 1;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&:before {
|
|
|
|
background: var(--accent) !important;
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2023-01-09 22:02:46 +01:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2024-03-30 08:02:03 +01:00
|
|
|
&.radioActive {
|
|
|
|
color: var(--accent) !important;
|
|
|
|
opacity: 1;
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
background-color: var(--accentedBg) !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&:not(:active):focus-visible {
|
|
|
|
box-shadow: 0 0 0 2px var(--focus) inset;
|
|
|
|
}
|
2022-07-17 14:06:33 +02:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&.label {
|
|
|
|
pointer-events: none;
|
|
|
|
font-size: 0.7em;
|
|
|
|
padding-bottom: 4px;
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&.pending {
|
|
|
|
pointer-events: none;
|
|
|
|
opacity: 0.7;
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&.none {
|
|
|
|
pointer-events: none;
|
|
|
|
opacity: 0.7;
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2021-12-16 18:14:40 +01:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&.parent {
|
2023-08-09 02:08:47 +02:00
|
|
|
pointer-events: auto;
|
2023-01-09 22:02:46 +01:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
cursor: default;
|
2021-12-16 18:14:40 +01:00
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
&.childShowing {
|
|
|
|
color: var(--accent);
|
|
|
|
text-decoration: none;
|
2021-12-16 18:14:40 +01:00
|
|
|
|
|
|
|
&:before {
|
2023-01-09 22:02:46 +01:00
|
|
|
background: var(--accentedBg);
|
2021-12-16 18:14:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2023-01-09 22:02:46 +01:00
|
|
|
|
2023-12-22 12:41:42 +01:00
|
|
|
.item_content {
|
|
|
|
width: 100%;
|
|
|
|
max-width: 100vw;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
gap: 8px;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
|
|
|
|
.item_content_text {
|
|
|
|
max-width: calc(100vw - 4rem);
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
2023-08-01 08:32:03 +02:00
|
|
|
.switch {
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
user-select: none;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.switchDisabled {
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
|
|
|
|
|
|
|
.switchButton {
|
|
|
|
margin-left: -2px;
|
2024-03-30 08:02:03 +01:00
|
|
|
--height: 1.35em;
|
2023-08-01 08:32:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.switchText {
|
|
|
|
margin-left: 8px;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
|
|
|
|
.switchInput {
|
|
|
|
position: absolute;
|
|
|
|
width: 0;
|
|
|
|
height: 0;
|
|
|
|
opacity: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
2023-01-09 22:02:46 +01:00
|
|
|
.icon {
|
2023-01-25 11:49:17 +01:00
|
|
|
margin-right: 8px;
|
2023-12-22 12:41:42 +01:00
|
|
|
line-height: 1;
|
2023-01-09 22:02:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.caret {
|
|
|
|
margin-left: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.avatar {
|
|
|
|
margin-right: 5px;
|
|
|
|
width: 20px;
|
|
|
|
height: 20px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.indicator {
|
2023-12-22 12:41:42 +01:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2023-01-09 22:02:46 +01:00
|
|
|
color: var(--indicator);
|
|
|
|
font-size: 12px;
|
2024-01-21 12:26:52 +01:00
|
|
|
animation: global-blink 1s infinite;
|
2023-01-09 22:02:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.divider {
|
|
|
|
margin: 8px 0;
|
|
|
|
border-top: solid 0.5px var(--divider);
|
|
|
|
}
|
2024-03-30 08:02:03 +01:00
|
|
|
|
|
|
|
.radio {
|
|
|
|
display: inline-block;
|
|
|
|
position: relative;
|
|
|
|
width: 1em;
|
|
|
|
height: 1em;
|
|
|
|
vertical-align: -.125em;
|
|
|
|
border-radius: 50%;
|
|
|
|
border: solid 2px var(--divider);
|
|
|
|
background-color: var(--panel);
|
|
|
|
|
|
|
|
&.radioChecked {
|
|
|
|
border-color: var(--accent);
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
content: "";
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
left: 50%;
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
width: 50%;
|
|
|
|
height: 50%;
|
|
|
|
border-radius: 50%;
|
|
|
|
background-color: var(--accent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
</style>
|