@y14e/path-bar 1.0.0 → 1.0.1

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,16 +10,16 @@ npm i @y14e/path-bar
10
10
 
11
11
  ```ts
12
12
  // npm
13
- import PathBar from '@y14e/path-bar@1.0.0';
13
+ import PathBar from '@y14e/path-bar@1.0.1';
14
14
  // with middleware
15
- import PathBar, { flip, offset, shift } from '@y14e/path-bar@1.0.0';
15
+ import PathBar, { flip, offset, shift } from '@y14e/path-bar@1.0.1';
16
16
 
17
17
  // CDNs
18
- import PathBar from 'https://esm.sh/@y14e/path-bar@1.0.0';
18
+ import PathBar from 'https://esm.sh/@y14e/path-bar@1.0.1';
19
19
  // or
20
- import PathBar from 'https://cdn.jsdelivr.net/npm/@y14e/path-bar@1.0.0/+esm';
20
+ import PathBar from 'https://cdn.jsdelivr.net/npm/@y14e/path-bar@1.0.1/+esm';
21
21
  // or
22
- import PathBar from 'https://esm.unpkg.com/@y14e/path-bar@1.0.0';
22
+ import PathBar from 'https://esm.unpkg.com/@y14e/path-bar@1.0.1';
23
23
  ```
24
24
 
25
25
  ## Usage
package/dist/index.cjs CHANGED
@@ -2380,6 +2380,7 @@ function createRovingTabIndex(container, options = {}) {
2380
2380
  navigationOnly = false,
2381
2381
  noMemory = false,
2382
2382
  noStart = false,
2383
+ noStopPropagation = false,
2383
2384
  selector,
2384
2385
  typeahead = false,
2385
2386
  wrap = false
@@ -2400,6 +2401,10 @@ function createRovingTabIndex(container, options = {}) {
2400
2401
  console.warn("Invalid noStart option. Fallback: false.");
2401
2402
  noStart = false;
2402
2403
  }
2404
+ if (typeof noStopPropagation !== "boolean") {
2405
+ console.warn("Invalid noStopPropagation option. Fallback: false.");
2406
+ noStopPropagation = false;
2407
+ }
2403
2408
  if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
2404
2409
  console.warn(
2405
2410
  "Invalid selector. Fallback: all focusable elements (undefined)."
@@ -2414,7 +2419,14 @@ function createRovingTabIndex(container, options = {}) {
2414
2419
  console.warn("Invalid wrap option. Fallback: false.");
2415
2420
  wrap = false;
2416
2421
  }
2417
- const settings = { navigationOnly, noMemory, noStart, typeahead, wrap };
2422
+ const settings = {
2423
+ navigationOnly,
2424
+ noMemory,
2425
+ noStart,
2426
+ noStopPropagation,
2427
+ typeahead,
2428
+ wrap
2429
+ };
2418
2430
  direction && Object.assign(settings, { direction });
2419
2431
  selector && Object.assign(settings, { selector });
2420
2432
  const roving = new RovingTabIndex(container, settings);
@@ -2480,7 +2492,7 @@ var RovingTabIndex = class {
2480
2492
  if (altKey || ctrlKey || metaKey || shiftKey) {
2481
2493
  return;
2482
2494
  }
2483
- const { direction, typeahead, wrap } = this.#options;
2495
+ const { direction, noStopPropagation, typeahead, wrap } = this.#options;
2484
2496
  const isBoth = !direction;
2485
2497
  const isHorizontal = direction === "horizontal";
2486
2498
  if (![
@@ -2502,7 +2514,7 @@ var RovingTabIndex = class {
2502
2514
  return;
2503
2515
  }
2504
2516
  event.preventDefault();
2505
- event.stopPropagation();
2517
+ !noStopPropagation && event.stopPropagation();
2506
2518
  const currentIndex = current.indexOf(active);
2507
2519
  let rawIndex;
2508
2520
  let newIndex = currentIndex;
@@ -2897,6 +2909,7 @@ var Menu = class _Menu {
2897
2909
  direction: "vertical",
2898
2910
  noMemory: true,
2899
2911
  noStart: !!this.#triggerElement,
2912
+ noStopPropagation: true,
2900
2913
  selector: `${item}:not(:scope ${list} *, [data-menu-disabled])`,
2901
2914
  typeahead: true,
2902
2915
  wrap: true
@@ -3600,6 +3613,7 @@ function createRovingTabIndex2(container, options = {}) {
3600
3613
  navigationOnly = false,
3601
3614
  noMemory = false,
3602
3615
  noStart = false,
3616
+ noStopPropagation = false,
3603
3617
  selector,
3604
3618
  typeahead = false,
3605
3619
  wrap = false
@@ -3620,6 +3634,10 @@ function createRovingTabIndex2(container, options = {}) {
3620
3634
  console.warn("Invalid noStart option. Fallback: false.");
3621
3635
  noStart = false;
3622
3636
  }
3637
+ if (typeof noStopPropagation !== "boolean") {
3638
+ console.warn("Invalid noStopPropagation option. Fallback: false.");
3639
+ noStopPropagation = false;
3640
+ }
3623
3641
  if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
3624
3642
  console.warn(
3625
3643
  "Invalid selector. Fallback: all focusable elements (undefined)."
@@ -3634,7 +3652,14 @@ function createRovingTabIndex2(container, options = {}) {
3634
3652
  console.warn("Invalid wrap option. Fallback: false.");
3635
3653
  wrap = false;
3636
3654
  }
3637
- const settings = { navigationOnly, noMemory, noStart, typeahead, wrap };
3655
+ const settings = {
3656
+ navigationOnly,
3657
+ noMemory,
3658
+ noStart,
3659
+ noStopPropagation,
3660
+ typeahead,
3661
+ wrap
3662
+ };
3638
3663
  direction && Object.assign(settings, { direction });
3639
3664
  selector && Object.assign(settings, { selector });
3640
3665
  const roving = new RovingTabIndex2(container, settings);
@@ -3700,7 +3725,7 @@ var RovingTabIndex2 = class {
3700
3725
  if (altKey || ctrlKey || metaKey || shiftKey) {
3701
3726
  return;
3702
3727
  }
3703
- const { direction, typeahead, wrap } = this.#options;
3728
+ const { direction, noStopPropagation, typeahead, wrap } = this.#options;
3704
3729
  const isBoth = !direction;
3705
3730
  const isHorizontal = direction === "horizontal";
3706
3731
  if (![
@@ -3722,7 +3747,7 @@ var RovingTabIndex2 = class {
3722
3747
  return;
3723
3748
  }
3724
3749
  event.preventDefault();
3725
- event.stopPropagation();
3750
+ !noStopPropagation && event.stopPropagation();
3726
3751
  const currentIndex = current.indexOf(active);
3727
3752
  let rawIndex;
3728
3753
  let newIndex = currentIndex;
@@ -4180,6 +4205,7 @@ var PathBar = class _PathBar {
4180
4205
  #rootElement;
4181
4206
  #defaults = {
4182
4207
  animation: { duration: 300 },
4208
+ delay: 200,
4183
4209
  popover: {
4184
4210
  arrow: true,
4185
4211
  middleware: [flip2(), offset2(), shift2()],
@@ -4234,11 +4260,11 @@ var PathBar = class _PathBar {
4234
4260
  console.warn("Missing item elements");
4235
4261
  return;
4236
4262
  }
4237
- this.#linkElements = [
4238
- ...this.#listElement.querySelectorAll(
4239
- `${selector.list} > * > a`
4240
- )
4241
- ];
4263
+ this.#linkElements = [];
4264
+ this.#itemElements.forEach((item) => {
4265
+ const link = item.querySelector("a");
4266
+ link && this.#linkElements.push(link);
4267
+ });
4242
4268
  if (!this.#linkElements.length) {
4243
4269
  console.warn("Missing <a> elements");
4244
4270
  return;
@@ -4276,18 +4302,21 @@ var PathBar = class _PathBar {
4276
4302
  });
4277
4303
  this.#linkElements.forEach((link) => {
4278
4304
  link.addEventListener("keydown", this.#onKeyDown, { signal });
4279
- const menuRoot = link.nextElementSibling;
4280
- if (!(menuRoot instanceof HTMLElement)) {
4305
+ const root = link.closest(this.#settings.selector.item);
4306
+ if (!(root instanceof HTMLElement)) {
4307
+ return;
4308
+ }
4309
+ const { animation, delay, popover, selector } = this.#settings;
4310
+ if (!root.querySelector(selector.menu.trigger)) {
4281
4311
  return;
4282
4312
  }
4283
- const { animation, popover, selector } = this.#settings;
4284
- const menuInstance = new Menu(
4285
- menuRoot,
4286
- { animation, popover: { menu: popover }, selector: selector.menu },
4313
+ const menu = new Menu(
4314
+ root,
4315
+ { animation, delay, popover: { menu: popover }, selector: selector.menu },
4287
4316
  { externalTrigger: link, isMenubar: true }
4288
4317
  );
4289
- this.#bindings.set(link, createBinding(link, menuInstance));
4290
- this.#menus.push(menuInstance);
4318
+ this.#bindings.set(link, createBinding(link, menu));
4319
+ this.#menus.push(menu);
4291
4320
  });
4292
4321
  this.#cleanupRovingTabIndex = createRovingTabIndex2(this.#listElement, {
4293
4322
  direction: "horizontal",
@@ -4384,7 +4413,7 @@ function createBinding(link, menu) {
4384
4413
  * Breadcrumb-style path bar implementation in TypeScript.
4385
4414
  * Supports keyboard navigation, integrated menus, and seamless menu traversal.
4386
4415
  *
4387
- * @version 1.0.0
4416
+ * @version 1.0.1
4388
4417
  * @author Yusuke Kamiyamane
4389
4418
  * @license MIT
4390
4419
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -4398,7 +4427,7 @@ function createBinding(link, menu) {
4398
4427
  * WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
4399
4428
  * Supports checkbox item, radio item, and infinitely nested menus.
4400
4429
  *
4401
- * @version 1.7.1
4430
+ * @version 1.7.2
4402
4431
  * @author Yusuke Kamiyamane
4403
4432
  * @license MIT
4404
4433
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -4473,7 +4502,7 @@ function createBinding(link, menu) {
4473
4502
  * Lightweight roving tabindex utility with fully focus management.
4474
4503
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
4475
4504
  *
4476
- * @version 2.2.0
4505
+ * @version 2.2.1
4477
4506
  * @author Yusuke Kamiyamane
4478
4507
  * @license MIT
4479
4508
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -4513,7 +4542,7 @@ function createBinding(link, menu) {
4513
4542
  * Lightweight roving tabindex utility with fully focus management.
4514
4543
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
4515
4544
  *
4516
- * @version 2.2.0
4545
+ * @version 2.2.1
4517
4546
  * @author Yusuke Kamiyamane
4518
4547
  * @license MIT
4519
4548
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -6,7 +6,7 @@ export { flip, offset, shift } from '@y14e/menu';
6
6
  * Breadcrumb-style path bar implementation in TypeScript.
7
7
  * Supports keyboard navigation, integrated menus, and seamless menu traversal.
8
8
  *
9
- * @version 1.0.0
9
+ * @version 1.0.1
10
10
  * @author Yusuke Kamiyamane
11
11
  * @license MIT
12
12
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -17,6 +17,7 @@ interface PathBarOptions {
17
17
  readonly animation?: {
18
18
  readonly duration?: number;
19
19
  };
20
+ readonly delay?: number;
20
21
  readonly popover?: PathBarPopoverOptions;
21
22
  readonly selector?: {
22
23
  readonly item?: string;
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { flip, offset, shift } from '@y14e/menu';
6
6
  * Breadcrumb-style path bar implementation in TypeScript.
7
7
  * Supports keyboard navigation, integrated menus, and seamless menu traversal.
8
8
  *
9
- * @version 1.0.0
9
+ * @version 1.0.1
10
10
  * @author Yusuke Kamiyamane
11
11
  * @license MIT
12
12
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -17,6 +17,7 @@ interface PathBarOptions {
17
17
  readonly animation?: {
18
18
  readonly duration?: number;
19
19
  };
20
+ readonly delay?: number;
20
21
  readonly popover?: PathBarPopoverOptions;
21
22
  readonly selector?: {
22
23
  readonly item?: string;
package/dist/index.js CHANGED
@@ -2376,6 +2376,7 @@ function createRovingTabIndex(container, options = {}) {
2376
2376
  navigationOnly = false,
2377
2377
  noMemory = false,
2378
2378
  noStart = false,
2379
+ noStopPropagation = false,
2379
2380
  selector,
2380
2381
  typeahead = false,
2381
2382
  wrap = false
@@ -2396,6 +2397,10 @@ function createRovingTabIndex(container, options = {}) {
2396
2397
  console.warn("Invalid noStart option. Fallback: false.");
2397
2398
  noStart = false;
2398
2399
  }
2400
+ if (typeof noStopPropagation !== "boolean") {
2401
+ console.warn("Invalid noStopPropagation option. Fallback: false.");
2402
+ noStopPropagation = false;
2403
+ }
2399
2404
  if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
2400
2405
  console.warn(
2401
2406
  "Invalid selector. Fallback: all focusable elements (undefined)."
@@ -2410,7 +2415,14 @@ function createRovingTabIndex(container, options = {}) {
2410
2415
  console.warn("Invalid wrap option. Fallback: false.");
2411
2416
  wrap = false;
2412
2417
  }
2413
- const settings = { navigationOnly, noMemory, noStart, typeahead, wrap };
2418
+ const settings = {
2419
+ navigationOnly,
2420
+ noMemory,
2421
+ noStart,
2422
+ noStopPropagation,
2423
+ typeahead,
2424
+ wrap
2425
+ };
2414
2426
  direction && Object.assign(settings, { direction });
2415
2427
  selector && Object.assign(settings, { selector });
2416
2428
  const roving = new RovingTabIndex(container, settings);
@@ -2476,7 +2488,7 @@ var RovingTabIndex = class {
2476
2488
  if (altKey || ctrlKey || metaKey || shiftKey) {
2477
2489
  return;
2478
2490
  }
2479
- const { direction, typeahead, wrap } = this.#options;
2491
+ const { direction, noStopPropagation, typeahead, wrap } = this.#options;
2480
2492
  const isBoth = !direction;
2481
2493
  const isHorizontal = direction === "horizontal";
2482
2494
  if (![
@@ -2498,7 +2510,7 @@ var RovingTabIndex = class {
2498
2510
  return;
2499
2511
  }
2500
2512
  event.preventDefault();
2501
- event.stopPropagation();
2513
+ !noStopPropagation && event.stopPropagation();
2502
2514
  const currentIndex = current.indexOf(active);
2503
2515
  let rawIndex;
2504
2516
  let newIndex = currentIndex;
@@ -2893,6 +2905,7 @@ var Menu = class _Menu {
2893
2905
  direction: "vertical",
2894
2906
  noMemory: true,
2895
2907
  noStart: !!this.#triggerElement,
2908
+ noStopPropagation: true,
2896
2909
  selector: `${item}:not(:scope ${list} *, [data-menu-disabled])`,
2897
2910
  typeahead: true,
2898
2911
  wrap: true
@@ -3596,6 +3609,7 @@ function createRovingTabIndex2(container, options = {}) {
3596
3609
  navigationOnly = false,
3597
3610
  noMemory = false,
3598
3611
  noStart = false,
3612
+ noStopPropagation = false,
3599
3613
  selector,
3600
3614
  typeahead = false,
3601
3615
  wrap = false
@@ -3616,6 +3630,10 @@ function createRovingTabIndex2(container, options = {}) {
3616
3630
  console.warn("Invalid noStart option. Fallback: false.");
3617
3631
  noStart = false;
3618
3632
  }
3633
+ if (typeof noStopPropagation !== "boolean") {
3634
+ console.warn("Invalid noStopPropagation option. Fallback: false.");
3635
+ noStopPropagation = false;
3636
+ }
3619
3637
  if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
3620
3638
  console.warn(
3621
3639
  "Invalid selector. Fallback: all focusable elements (undefined)."
@@ -3630,7 +3648,14 @@ function createRovingTabIndex2(container, options = {}) {
3630
3648
  console.warn("Invalid wrap option. Fallback: false.");
3631
3649
  wrap = false;
3632
3650
  }
3633
- const settings = { navigationOnly, noMemory, noStart, typeahead, wrap };
3651
+ const settings = {
3652
+ navigationOnly,
3653
+ noMemory,
3654
+ noStart,
3655
+ noStopPropagation,
3656
+ typeahead,
3657
+ wrap
3658
+ };
3634
3659
  direction && Object.assign(settings, { direction });
3635
3660
  selector && Object.assign(settings, { selector });
3636
3661
  const roving = new RovingTabIndex2(container, settings);
@@ -3696,7 +3721,7 @@ var RovingTabIndex2 = class {
3696
3721
  if (altKey || ctrlKey || metaKey || shiftKey) {
3697
3722
  return;
3698
3723
  }
3699
- const { direction, typeahead, wrap } = this.#options;
3724
+ const { direction, noStopPropagation, typeahead, wrap } = this.#options;
3700
3725
  const isBoth = !direction;
3701
3726
  const isHorizontal = direction === "horizontal";
3702
3727
  if (![
@@ -3718,7 +3743,7 @@ var RovingTabIndex2 = class {
3718
3743
  return;
3719
3744
  }
3720
3745
  event.preventDefault();
3721
- event.stopPropagation();
3746
+ !noStopPropagation && event.stopPropagation();
3722
3747
  const currentIndex = current.indexOf(active);
3723
3748
  let rawIndex;
3724
3749
  let newIndex = currentIndex;
@@ -4176,6 +4201,7 @@ var PathBar = class _PathBar {
4176
4201
  #rootElement;
4177
4202
  #defaults = {
4178
4203
  animation: { duration: 300 },
4204
+ delay: 200,
4179
4205
  popover: {
4180
4206
  arrow: true,
4181
4207
  middleware: [flip2(), offset2(), shift2()],
@@ -4230,11 +4256,11 @@ var PathBar = class _PathBar {
4230
4256
  console.warn("Missing item elements");
4231
4257
  return;
4232
4258
  }
4233
- this.#linkElements = [
4234
- ...this.#listElement.querySelectorAll(
4235
- `${selector.list} > * > a`
4236
- )
4237
- ];
4259
+ this.#linkElements = [];
4260
+ this.#itemElements.forEach((item) => {
4261
+ const link = item.querySelector("a");
4262
+ link && this.#linkElements.push(link);
4263
+ });
4238
4264
  if (!this.#linkElements.length) {
4239
4265
  console.warn("Missing <a> elements");
4240
4266
  return;
@@ -4272,18 +4298,21 @@ var PathBar = class _PathBar {
4272
4298
  });
4273
4299
  this.#linkElements.forEach((link) => {
4274
4300
  link.addEventListener("keydown", this.#onKeyDown, { signal });
4275
- const menuRoot = link.nextElementSibling;
4276
- if (!(menuRoot instanceof HTMLElement)) {
4301
+ const root = link.closest(this.#settings.selector.item);
4302
+ if (!(root instanceof HTMLElement)) {
4303
+ return;
4304
+ }
4305
+ const { animation, delay, popover, selector } = this.#settings;
4306
+ if (!root.querySelector(selector.menu.trigger)) {
4277
4307
  return;
4278
4308
  }
4279
- const { animation, popover, selector } = this.#settings;
4280
- const menuInstance = new Menu(
4281
- menuRoot,
4282
- { animation, popover: { menu: popover }, selector: selector.menu },
4309
+ const menu = new Menu(
4310
+ root,
4311
+ { animation, delay, popover: { menu: popover }, selector: selector.menu },
4283
4312
  { externalTrigger: link, isMenubar: true }
4284
4313
  );
4285
- this.#bindings.set(link, createBinding(link, menuInstance));
4286
- this.#menus.push(menuInstance);
4314
+ this.#bindings.set(link, createBinding(link, menu));
4315
+ this.#menus.push(menu);
4287
4316
  });
4288
4317
  this.#cleanupRovingTabIndex = createRovingTabIndex2(this.#listElement, {
4289
4318
  direction: "horizontal",
@@ -4380,7 +4409,7 @@ function createBinding(link, menu) {
4380
4409
  * Breadcrumb-style path bar implementation in TypeScript.
4381
4410
  * Supports keyboard navigation, integrated menus, and seamless menu traversal.
4382
4411
  *
4383
- * @version 1.0.0
4412
+ * @version 1.0.1
4384
4413
  * @author Yusuke Kamiyamane
4385
4414
  * @license MIT
4386
4415
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -4394,7 +4423,7 @@ function createBinding(link, menu) {
4394
4423
  * WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
4395
4424
  * Supports checkbox item, radio item, and infinitely nested menus.
4396
4425
  *
4397
- * @version 1.7.1
4426
+ * @version 1.7.2
4398
4427
  * @author Yusuke Kamiyamane
4399
4428
  * @license MIT
4400
4429
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -4469,7 +4498,7 @@ function createBinding(link, menu) {
4469
4498
  * Lightweight roving tabindex utility with fully focus management.
4470
4499
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
4471
4500
  *
4472
- * @version 2.2.0
4501
+ * @version 2.2.1
4473
4502
  * @author Yusuke Kamiyamane
4474
4503
  * @license MIT
4475
4504
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -4509,7 +4538,7 @@ function createBinding(link, menu) {
4509
4538
  * Lightweight roving tabindex utility with fully focus management.
4510
4539
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
4511
4540
  *
4512
- * @version 2.2.0
4541
+ * @version 2.2.1
4513
4542
  * @author Yusuke Kamiyamane
4514
4543
  * @license MIT
4515
4544
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/path-bar",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -44,8 +44,8 @@
44
44
  "devDependencies": {
45
45
  "@floating-ui/dom": "^1.7.6",
46
46
  "@y14e/attributes-utils": "^1.1.1",
47
- "@y14e/menu": "^1.7.1",
48
- "@y14e/roving-tabindex": "^2.2.0",
47
+ "@y14e/menu": "^1.7.2",
48
+ "@y14e/roving-tabindex": "^2.2.1",
49
49
  "bun-types": "latest",
50
50
  "power-focusable": "^4.3.2",
51
51
  "tsup": "^8.0.0",