2023-07-27 05:31:52 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-01-30 05:11:52 +00:00
|
|
|
import * as Misskey from 'misskey-js';
|
|
|
|
import { Ref } from 'vue';
|
|
|
|
|
|
|
|
export type MenuAction = (ev: MouseEvent) => void;
|
|
|
|
|
|
|
|
export type MenuDivider = null;
|
|
|
|
export type MenuNull = undefined;
|
|
|
|
export type MenuLabel = { type: 'label', text: string };
|
|
|
|
export type MenuLink = { type: 'link', to: string, text: string, icon?: string, indicate?: boolean, avatar?: Misskey.entities.User };
|
|
|
|
export type MenuA = { type: 'a', href: string, target?: string, download?: string, text: string, icon?: string, indicate?: boolean };
|
|
|
|
export type MenuUser = { type: 'user', user: Misskey.entities.User, active?: boolean, indicate?: boolean, action: MenuAction };
|
|
|
|
export type MenuSwitch = { type: 'switch', ref: Ref<boolean>, text: string, disabled?: boolean };
|
|
|
|
export type MenuButton = { type?: 'button', text: string, icon?: string, indicate?: boolean, danger?: boolean, active?: boolean, avatar?: Misskey.entities.User; action: MenuAction };
|
2022-07-17 12:06:33 +00:00
|
|
|
export type MenuParent = { type: 'parent', text: string, icon?: string, children: OuterMenuItem[] };
|
2022-01-30 05:11:52 +00:00
|
|
|
|
|
|
|
export type MenuPending = { type: 'pending' };
|
|
|
|
|
2022-07-17 12:06:33 +00:00
|
|
|
type OuterMenuItem = MenuDivider | MenuNull | MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuParent;
|
|
|
|
type OuterPromiseMenuItem = Promise<MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuParent>;
|
2022-01-30 05:11:52 +00:00
|
|
|
export type MenuItem = OuterMenuItem | OuterPromiseMenuItem;
|
2022-07-17 12:06:33 +00:00
|
|
|
export type InnerMenuItem = MenuDivider | MenuPending | MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuParent;
|