@y14e/menu 1.4.0
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/LICENSE +21 -0
- package/README.md +117 -0
- package/dist/index.cjs +3301 -0
- package/dist/index.d.cts +56 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +3299 -0
- package/package.json +57 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Middleware, Placement } from '@floating-ui/dom';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Menu
|
|
5
|
+
* WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
|
|
6
|
+
* Supports checkbox item, radio item, and infinitely nested menus.
|
|
7
|
+
*
|
|
8
|
+
* @version 1.4.0
|
|
9
|
+
* @author Yusuke Kamiyamane
|
|
10
|
+
* @license MIT
|
|
11
|
+
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
12
|
+
* @see {@link https://github.com/y14e/menu}
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
interface MenuOptions {
|
|
16
|
+
readonly animation?: {
|
|
17
|
+
readonly duration?: number;
|
|
18
|
+
};
|
|
19
|
+
readonly delay?: number;
|
|
20
|
+
readonly popover?: {
|
|
21
|
+
readonly menu?: MenuPopoverOptions;
|
|
22
|
+
readonly submenu?: MenuPopoverOptions;
|
|
23
|
+
readonly transformOrigin?: boolean;
|
|
24
|
+
};
|
|
25
|
+
readonly selector?: {
|
|
26
|
+
readonly checkboxItem?: string;
|
|
27
|
+
readonly group?: string;
|
|
28
|
+
readonly item?: string;
|
|
29
|
+
readonly list?: string;
|
|
30
|
+
readonly radioItem?: string;
|
|
31
|
+
readonly trigger?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
interface MenuPopoverOptions {
|
|
35
|
+
readonly arrow?: boolean;
|
|
36
|
+
readonly middleware?: Middleware[];
|
|
37
|
+
readonly placement?: Placement | string;
|
|
38
|
+
}
|
|
39
|
+
interface InternalOptions {
|
|
40
|
+
readonly isSubmenu?: boolean;
|
|
41
|
+
readonly isPortal?: boolean;
|
|
42
|
+
}
|
|
43
|
+
declare class Menu {
|
|
44
|
+
#private;
|
|
45
|
+
static defaults: MenuOptions;
|
|
46
|
+
constructor(root: HTMLElement, options?: MenuOptions);
|
|
47
|
+
/**
|
|
48
|
+
* @internal Internal constructor
|
|
49
|
+
*/
|
|
50
|
+
constructor(root: HTMLElement, options?: MenuOptions, _internal?: InternalOptions);
|
|
51
|
+
open(): void;
|
|
52
|
+
close(): void;
|
|
53
|
+
destroy(force?: boolean): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { type MenuOptions, type MenuPopoverOptions, Menu as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Middleware, Placement } from '@floating-ui/dom';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Menu
|
|
5
|
+
* WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
|
|
6
|
+
* Supports checkbox item, radio item, and infinitely nested menus.
|
|
7
|
+
*
|
|
8
|
+
* @version 1.4.0
|
|
9
|
+
* @author Yusuke Kamiyamane
|
|
10
|
+
* @license MIT
|
|
11
|
+
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
12
|
+
* @see {@link https://github.com/y14e/menu}
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
interface MenuOptions {
|
|
16
|
+
readonly animation?: {
|
|
17
|
+
readonly duration?: number;
|
|
18
|
+
};
|
|
19
|
+
readonly delay?: number;
|
|
20
|
+
readonly popover?: {
|
|
21
|
+
readonly menu?: MenuPopoverOptions;
|
|
22
|
+
readonly submenu?: MenuPopoverOptions;
|
|
23
|
+
readonly transformOrigin?: boolean;
|
|
24
|
+
};
|
|
25
|
+
readonly selector?: {
|
|
26
|
+
readonly checkboxItem?: string;
|
|
27
|
+
readonly group?: string;
|
|
28
|
+
readonly item?: string;
|
|
29
|
+
readonly list?: string;
|
|
30
|
+
readonly radioItem?: string;
|
|
31
|
+
readonly trigger?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
interface MenuPopoverOptions {
|
|
35
|
+
readonly arrow?: boolean;
|
|
36
|
+
readonly middleware?: Middleware[];
|
|
37
|
+
readonly placement?: Placement | string;
|
|
38
|
+
}
|
|
39
|
+
interface InternalOptions {
|
|
40
|
+
readonly isSubmenu?: boolean;
|
|
41
|
+
readonly isPortal?: boolean;
|
|
42
|
+
}
|
|
43
|
+
declare class Menu {
|
|
44
|
+
#private;
|
|
45
|
+
static defaults: MenuOptions;
|
|
46
|
+
constructor(root: HTMLElement, options?: MenuOptions);
|
|
47
|
+
/**
|
|
48
|
+
* @internal Internal constructor
|
|
49
|
+
*/
|
|
50
|
+
constructor(root: HTMLElement, options?: MenuOptions, _internal?: InternalOptions);
|
|
51
|
+
open(): void;
|
|
52
|
+
close(): void;
|
|
53
|
+
destroy(force?: boolean): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { type MenuOptions, type MenuPopoverOptions, Menu as default };
|