@y14e/tabs 1.5.2 → 1.5.3

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,14 @@ npm i @y14e/tabs
10
10
 
11
11
  ```ts
12
12
  // npm
13
- import Tabs from '@y14e/tabs';
13
+ import Tabs from '@y14e/tabs@1.5.3';
14
14
 
15
15
  // CDNs
16
- import Tabs from 'https://esm.sh/@y14e/tabs'
16
+ import Tabs from 'https://esm.sh/@y14e/tabs@1.5.3';
17
17
  // or
18
- import Tabs from 'https://cdn.jsdelivr.net/npm/@y14e/tabs/+esm';
18
+ import Tabs from 'https://cdn.jsdelivr.net/npm/@y14e/tabs@1.5.3/+esm';
19
19
  // or
20
- import Tabs from 'https://unpkg.com/@y14e/tabs/dist/index.js';
20
+ import Tabs from 'https://esm.unpkg.com/@y14e/tabs@1.5.3';
21
21
  ```
22
22
 
23
23
  ## Usage
package/dist/index.cjs CHANGED
@@ -428,13 +428,14 @@ function createRovingTabIndex(container, options = {}) {
428
428
  console.warn("Invalid wrap option. Fallback: false.");
429
429
  wrap = false;
430
430
  }
431
- const roving = new RovingTabIndex(container, {
432
- direction,
433
- navigationOnly,
434
- selector,
435
- typeahead,
436
- wrap
437
- });
431
+ const settings = { navigationOnly, typeahead, wrap };
432
+ if (direction !== void 0) {
433
+ Object.assign(settings, { direction });
434
+ }
435
+ if (selector !== void 0) {
436
+ Object.assign(settings, { selector });
437
+ }
438
+ const roving = new RovingTabIndex(container, settings);
438
439
  return () => roving.destroy();
439
440
  }
440
441
  var RovingTabIndex = class {
@@ -476,8 +477,8 @@ var RovingTabIndex = class {
476
477
  if (!event.composedPath().includes(this.#container)) {
477
478
  return;
478
479
  }
479
- const { key, altKey, ctrlKey, metaKey } = event;
480
- if (altKey || ctrlKey || metaKey) {
480
+ const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
481
+ if (altKey || ctrlKey || metaKey || shiftKey) {
481
482
  return;
482
483
  }
483
484
  const { direction, typeahead, wrap } = this.#options;
@@ -540,14 +541,7 @@ var RovingTabIndex = class {
540
541
  focusElement(focusable);
541
542
  };
542
543
  #update(active) {
543
- const current = /* @__PURE__ */ new Set([
544
- ...this.#getFocusables(),
545
- ...getFocusables(this.#container, {
546
- composed: true,
547
- filter: this.#selectorFilter,
548
- skipNegativeTabIndexCheck: !this.#options.navigationOnly
549
- })
550
- ]);
544
+ const current = new Set(this.#getFocusables());
551
545
  for (const focusable of this.#focusables) {
552
546
  if (current.has(focusable)) {
553
547
  continue;
@@ -974,14 +968,14 @@ var Tabs = class _Tabs {
974
968
  signal
975
969
  });
976
970
  });
971
+ const options = { selector: this.#settings.selector.tab, wrap: true };
977
972
  this.#listElements.forEach((list) => {
978
- this.#cleanupsRovingTabIndex.push(
979
- createRovingTabIndex(list, {
980
- direction: list.ariaOrientation === "undefined" ? void 0 : this.#settings.vertical ? "vertical" : "horizontal",
981
- selector: this.#settings.selector.tab,
982
- wrap: true
983
- })
984
- );
973
+ if (list.ariaOrientation !== "undefined") {
974
+ Object.assign(options, {
975
+ direction: this.#settings.vertical ? "vertical" : "horizontal"
976
+ });
977
+ }
978
+ this.#cleanupsRovingTabIndex.push(createRovingTabIndex(list, options));
985
979
  list.querySelectorAll(this.#settings.selector.tab).forEach((tab) => {
986
980
  tab.setAttribute(
987
981
  "tabindex",
@@ -1149,7 +1143,7 @@ function isFocusable2(element) {
1149
1143
  * Tabs
1150
1144
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
1151
1145
  *
1152
- * @version 1.5.1
1146
+ * @version 1.5.3
1153
1147
  * @author Yusuke Kamiyamane
1154
1148
  * @license MIT
1155
1149
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1161,7 +1155,7 @@ function isFocusable2(element) {
1161
1155
  (**
1162
1156
  * Attributes Utils
1163
1157
  *
1164
- * @version 1.0.5
1158
+ * @version 1.1.0
1165
1159
  * @author Yusuke Kamiyamane
1166
1160
  * @license MIT
1167
1161
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1185,7 +1179,7 @@ function isFocusable2(element) {
1185
1179
  * Lightweight roving tabindex utility with fully focus management.
1186
1180
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
1187
1181
  *
1188
- * @version 2.0.0
1182
+ * @version 2.0.3
1189
1183
  * @author Yusuke Kamiyamane
1190
1184
  * @license MIT
1191
1185
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1197,7 +1191,7 @@ function isFocusable2(element) {
1197
1191
  (**
1198
1192
  * Attributes Utils
1199
1193
  *
1200
- * @version 1.0.5
1194
+ * @version 1.1.0
1201
1195
  * @author Yusuke Kamiyamane
1202
1196
  * @license MIT
1203
1197
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1210,7 +1204,7 @@ function isFocusable2(element) {
1210
1204
  * High-precision focus management utility with full composed tree support.
1211
1205
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
1212
1206
  *
1213
- * @version 4.3.0
1207
+ * @version 4.3.1
1214
1208
  * @author Yusuke Kamiyamane
1215
1209
  * @license MIT
1216
1210
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Tabs
3
3
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
4
4
  *
5
- * @version 1.5.1
5
+ * @version 1.5.3
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Tabs
3
3
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
4
4
  *
5
- * @version 1.5.1
5
+ * @version 1.5.3
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -426,13 +426,14 @@ function createRovingTabIndex(container, options = {}) {
426
426
  console.warn("Invalid wrap option. Fallback: false.");
427
427
  wrap = false;
428
428
  }
429
- const roving = new RovingTabIndex(container, {
430
- direction,
431
- navigationOnly,
432
- selector,
433
- typeahead,
434
- wrap
435
- });
429
+ const settings = { navigationOnly, typeahead, wrap };
430
+ if (direction !== void 0) {
431
+ Object.assign(settings, { direction });
432
+ }
433
+ if (selector !== void 0) {
434
+ Object.assign(settings, { selector });
435
+ }
436
+ const roving = new RovingTabIndex(container, settings);
436
437
  return () => roving.destroy();
437
438
  }
438
439
  var RovingTabIndex = class {
@@ -474,8 +475,8 @@ var RovingTabIndex = class {
474
475
  if (!event.composedPath().includes(this.#container)) {
475
476
  return;
476
477
  }
477
- const { key, altKey, ctrlKey, metaKey } = event;
478
- if (altKey || ctrlKey || metaKey) {
478
+ const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
479
+ if (altKey || ctrlKey || metaKey || shiftKey) {
479
480
  return;
480
481
  }
481
482
  const { direction, typeahead, wrap } = this.#options;
@@ -538,14 +539,7 @@ var RovingTabIndex = class {
538
539
  focusElement(focusable);
539
540
  };
540
541
  #update(active) {
541
- const current = /* @__PURE__ */ new Set([
542
- ...this.#getFocusables(),
543
- ...getFocusables(this.#container, {
544
- composed: true,
545
- filter: this.#selectorFilter,
546
- skipNegativeTabIndexCheck: !this.#options.navigationOnly
547
- })
548
- ]);
542
+ const current = new Set(this.#getFocusables());
549
543
  for (const focusable of this.#focusables) {
550
544
  if (current.has(focusable)) {
551
545
  continue;
@@ -972,14 +966,14 @@ var Tabs = class _Tabs {
972
966
  signal
973
967
  });
974
968
  });
969
+ const options = { selector: this.#settings.selector.tab, wrap: true };
975
970
  this.#listElements.forEach((list) => {
976
- this.#cleanupsRovingTabIndex.push(
977
- createRovingTabIndex(list, {
978
- direction: list.ariaOrientation === "undefined" ? void 0 : this.#settings.vertical ? "vertical" : "horizontal",
979
- selector: this.#settings.selector.tab,
980
- wrap: true
981
- })
982
- );
971
+ if (list.ariaOrientation !== "undefined") {
972
+ Object.assign(options, {
973
+ direction: this.#settings.vertical ? "vertical" : "horizontal"
974
+ });
975
+ }
976
+ this.#cleanupsRovingTabIndex.push(createRovingTabIndex(list, options));
983
977
  list.querySelectorAll(this.#settings.selector.tab).forEach((tab) => {
984
978
  tab.setAttribute(
985
979
  "tabindex",
@@ -1147,7 +1141,7 @@ function isFocusable2(element) {
1147
1141
  * Tabs
1148
1142
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
1149
1143
  *
1150
- * @version 1.5.1
1144
+ * @version 1.5.3
1151
1145
  * @author Yusuke Kamiyamane
1152
1146
  * @license MIT
1153
1147
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1159,7 +1153,7 @@ function isFocusable2(element) {
1159
1153
  (**
1160
1154
  * Attributes Utils
1161
1155
  *
1162
- * @version 1.0.5
1156
+ * @version 1.1.0
1163
1157
  * @author Yusuke Kamiyamane
1164
1158
  * @license MIT
1165
1159
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1183,7 +1177,7 @@ function isFocusable2(element) {
1183
1177
  * Lightweight roving tabindex utility with fully focus management.
1184
1178
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
1185
1179
  *
1186
- * @version 2.0.0
1180
+ * @version 2.0.3
1187
1181
  * @author Yusuke Kamiyamane
1188
1182
  * @license MIT
1189
1183
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1195,7 +1189,7 @@ function isFocusable2(element) {
1195
1189
  (**
1196
1190
  * Attributes Utils
1197
1191
  *
1198
- * @version 1.0.5
1192
+ * @version 1.1.0
1199
1193
  * @author Yusuke Kamiyamane
1200
1194
  * @license MIT
1201
1195
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1208,7 +1202,7 @@ function isFocusable2(element) {
1208
1202
  * High-precision focus management utility with full composed tree support.
1209
1203
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
1210
1204
  *
1211
- * @version 4.3.0
1205
+ * @version 4.3.1
1212
1206
  * @author Yusuke Kamiyamane
1213
1207
  * @license MIT
1214
1208
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/tabs",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "WAI-ARIA compliant tabs pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -42,9 +42,9 @@
42
42
  },
43
43
  "homepage": "https://github.com/y14e/tabs#readme",
44
44
  "devDependencies": {
45
- "@y14e/attributes-utils": "^1.0.5",
45
+ "@y14e/attributes-utils": "^1.1.0",
46
46
  "@y14e/button": "^1.0.0",
47
- "@y14e/roving-tabindex": "^2.0.0",
47
+ "@y14e/roving-tabindex": "^2.0.3",
48
48
  "bun-types": "latest",
49
49
  "tsup": "^8.0.0",
50
50
  "typescript": "^5.6.0",