@@ -10,8 +10,6 @@ import type { OptionValue } from '@/types/option-value.js';
1010
1111type ComponentProps < T extends Component > = { [ K in keyof CP < T > ] : MaybeRef < CP < T > [ K ] > } ;
1212
13- type MenuRadioOptionsDef = Record < string , OptionValue > ;
14-
1513type Text = string | ComputedRef < string > ;
1614
1715export type MenuAction = ( ev : PointerEvent ) => void ;
@@ -32,6 +30,12 @@ interface MenuBase {
3230 type : string ;
3331}
3432
33+ interface TextMenuBase extends MenuBase {
34+ text : Text ;
35+ caption ?: Text | null | undefined | ComputedRef < null | undefined > ;
36+ icon ?: string ;
37+ }
38+
3539export interface MenuDivider extends MenuBase {
3640 type : 'divider' ;
3741}
@@ -42,24 +46,18 @@ export interface MenuLabel extends MenuBase {
4246 caption ?: Text | null | undefined | ComputedRef < null | undefined > ;
4347}
4448
45- export interface MenuLink extends MenuBase {
49+ export interface MenuLink extends TextMenuBase {
4650 type : 'link' ;
4751 to : string ;
48- text : Text ;
49- caption ?: Text | null | undefined | ComputedRef < null | undefined > ;
50- icon ?: string ;
5152 indicate ?: boolean ;
5253 avatar ?: Misskey . entities . User ;
5354}
5455
55- export interface MenuA extends MenuBase {
56+ export interface MenuA extends TextMenuBase {
5657 type : 'a' ;
5758 href : string ;
5859 target ?: string ;
5960 download ?: string ;
60- text : Text ;
61- caption ?: Text | null | undefined | ComputedRef < null | undefined > ;
62- icon ?: string ;
6361 indicate ?: boolean ;
6462}
6563
@@ -71,22 +69,19 @@ export interface MenuUser extends MenuBase {
7169 action : MenuAction ;
7270}
7371
74- export interface MenuSwitch extends MenuBase {
72+ export interface MenuSwitch extends TextMenuBase {
7573 type : 'switch' ;
7674 ref : Ref < boolean > ;
77- text : Text ;
78- caption ?: Text | null | undefined | ComputedRef < null | undefined > ;
79- icon ?: string ;
8075 disabled ?: boolean | Ref < boolean > ;
8176}
8277
83- export interface MenuRadio extends MenuBase {
78+ export interface MenuRadio extends TextMenuBase {
8479 type : 'radio' ;
85- text : Text ;
86- caption ?: Text | null | undefined | ComputedRef < null | undefined > ;
87- icon ? : string ;
88- ref : Ref < MenuRadioOptionsDef [ keyof MenuRadioOptionsDef ] > ;
89- options : MenuRadioOptionsDef ;
80+ ref : Ref < OptionValue > ;
81+ options : {
82+ label : string ;
83+ value : OptionValue ;
84+ } [ ] ;
9085 disabled ?: boolean | Ref < boolean > ;
9186}
9287
@@ -104,11 +99,8 @@ export interface MenuComponent<T extends Component = any> extends MenuBase {
10499 props ?: ComponentProps < T > ;
105100}
106101
107- export interface MenuParent extends MenuBase {
102+ export interface MenuParent extends TextMenuBase {
108103 type : 'parent' ;
109- text : Text ;
110- caption ?: Text | null | undefined | ComputedRef < null | undefined > ;
111- icon ?: string ;
112104 children : MenuItem [ ] | ( ( ) => Promise < MenuItem [ ] > | MenuItem [ ] ) ;
113105}
114106
0 commit comments