@y14e/menu 1.4.6 → 1.4.8

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/README.md CHANGED
@@ -10,14 +10,16 @@ npm i @y14e/menu
10
10
 
11
11
  ```ts
12
12
  // npm
13
- import Menu from '@y14e/menu@1.4.6';
13
+ import Menu from '@y14e/menu@1.4.8';
14
+ // with middleware
15
+ import Menu, { flip, offset, shift } from '@y14e/menu@1.4.8';
14
16
 
15
17
  // CDNs
16
- import Menu from 'https://esm.sh/@y14e/menu@1.4.6';
18
+ import Menu from 'https://esm.sh/@y14e/menu@1.4.8';
17
19
  // or
18
- import Menu from 'https://cdn.jsdelivr.net/npm/@y14e/menu@1.4.6/+esm';
20
+ import Menu from 'https://cdn.jsdelivr.net/npm/@y14e/menu@1.4.8/+esm';
19
21
  // or
20
- import Menu from 'https://esm.unpkg.com/@y14e/menu@1.4.6';
22
+ import Menu from 'https://esm.unpkg.com/@y14e/menu@1.4.8';
21
23
  ```
22
24
 
23
25
  ## Usage
package/dist/index.cjs CHANGED
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
4
6
  var min = Math.min;
5
7
  var max = Math.max;
@@ -3083,8 +3085,7 @@ var Menu = class _Menu {
3083
3085
  if (!(active instanceof HTMLElement)) {
3084
3086
  return;
3085
3087
  }
3086
- const trigger = this.#externalTrigger ?? this.#triggerElement;
3087
- this.#containsRoot(active) && trigger && trigger.tabIndex >= 0 && trigger.focus();
3088
+ this.#containsRoot(active) && (this.#externalTrigger ?? this.#triggerElement)?.focus();
3088
3089
  }
3089
3090
  #includesRoot(event) {
3090
3091
  const path = event.composedPath();
@@ -3240,7 +3241,7 @@ function isFocusable3(element) {
3240
3241
  * WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
3241
3242
  * Supports checkbox item, radio item, and infinitely nested menus.
3242
3243
  *
3243
- * @version 1.4.6
3244
+ * @version 1.4.8
3244
3245
  * @author Yusuke Kamiyamane
3245
3246
  * @license MIT
3246
3247
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -3349,4 +3350,7 @@ function isFocusable3(element) {
3349
3350
  *)
3350
3351
  */
3351
3352
 
3352
- module.exports = Menu;
3353
+ exports.default = Menu;
3354
+ exports.flip = flip2;
3355
+ exports.offset = offset2;
3356
+ exports.shift = shift2;
package/dist/index.d.cts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { Middleware, Placement } from '@floating-ui/dom';
2
+ export { flip, offset, shift } from '@floating-ui/dom';
2
3
 
3
4
  /**
4
5
  * Menu
5
6
  * WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
6
7
  * Supports checkbox item, radio item, and infinitely nested menus.
7
8
  *
8
- * @version 1.4.6
9
+ * @version 1.4.8
9
10
  * @author Yusuke Kamiyamane
10
11
  * @license MIT
11
12
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { Middleware, Placement } from '@floating-ui/dom';
2
+ export { flip, offset, shift } from '@floating-ui/dom';
2
3
 
3
4
  /**
4
5
  * Menu
5
6
  * WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
6
7
  * Supports checkbox item, radio item, and infinitely nested menus.
7
8
  *
8
- * @version 1.4.6
9
+ * @version 1.4.8
9
10
  * @author Yusuke Kamiyamane
10
11
  * @license MIT
11
12
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -3081,8 +3081,7 @@ var Menu = class _Menu {
3081
3081
  if (!(active instanceof HTMLElement)) {
3082
3082
  return;
3083
3083
  }
3084
- const trigger = this.#externalTrigger ?? this.#triggerElement;
3085
- this.#containsRoot(active) && trigger && trigger.tabIndex >= 0 && trigger.focus();
3084
+ this.#containsRoot(active) && (this.#externalTrigger ?? this.#triggerElement)?.focus();
3086
3085
  }
3087
3086
  #includesRoot(event) {
3088
3087
  const path = event.composedPath();
@@ -3238,7 +3237,7 @@ function isFocusable3(element) {
3238
3237
  * WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
3239
3238
  * Supports checkbox item, radio item, and infinitely nested menus.
3240
3239
  *
3241
- * @version 1.4.6
3240
+ * @version 1.4.8
3242
3241
  * @author Yusuke Kamiyamane
3243
3242
  * @license MIT
3244
3243
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -3347,4 +3346,4 @@ function isFocusable3(element) {
3347
3346
  *)
3348
3347
  */
3349
3348
 
3350
- export { Menu as default };
3349
+ export { Menu as default, flip2 as flip, offset2 as offset, shift2 as shift };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/menu",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",