@y14e/tabs 2.0.11 → 2.0.12
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 +3 -3
- package/dist/index.bundle.cjs +10 -71
- package/dist/index.bundle.js +10 -71
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,11 +13,11 @@ npm i @y14e/tabs
|
|
|
13
13
|
import Tabs from "@y14e/tabs";
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import Tabs from "https://esm.sh/@y14e/tabs@2.0.
|
|
16
|
+
import Tabs from "https://esm.sh/@y14e/tabs@2.0.12";
|
|
17
17
|
// or
|
|
18
|
-
import Tabs from "https://cdn.jsdelivr.net/npm/@y14e/tabs@2.0.
|
|
18
|
+
import Tabs from "https://cdn.jsdelivr.net/npm/@y14e/tabs@2.0.12/+esm";
|
|
19
19
|
// or
|
|
20
|
-
import Tabs from "https://esm.unpkg.com/@y14e/tabs@2.0.
|
|
20
|
+
import Tabs from "https://esm.unpkg.com/@y14e/tabs@2.0.12";
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -368,56 +368,6 @@ var Button = class {
|
|
|
368
368
|
};
|
|
369
369
|
};
|
|
370
370
|
|
|
371
|
-
// node_modules/@y14e/attributes-utils/dist/index.js
|
|
372
|
-
var DEFAULT_PARSER2 = (value) => value.split(/\s+/);
|
|
373
|
-
var DEFAULT_SERIALIZER2 = (tokens) => tokens.join(" ");
|
|
374
|
-
function addTokenToAttribute(element, name, token, options = {}) {
|
|
375
|
-
const value = element.getAttribute(name)?.trim();
|
|
376
|
-
const {
|
|
377
|
-
caseInsensitive = false,
|
|
378
|
-
parse = DEFAULT_PARSER2,
|
|
379
|
-
serialize = DEFAULT_SERIALIZER2
|
|
380
|
-
} = options;
|
|
381
|
-
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
382
|
-
if (caseInsensitive) {
|
|
383
|
-
const lower = token.toLowerCase();
|
|
384
|
-
if (tokens.every((token2) => token2.toLowerCase() !== lower)) {
|
|
385
|
-
tokens.push(token);
|
|
386
|
-
element.setAttribute(name, serialize(tokens));
|
|
387
|
-
}
|
|
388
|
-
} else {
|
|
389
|
-
const set = new Set(tokens);
|
|
390
|
-
set.add(token);
|
|
391
|
-
element.setAttribute(name, serialize([...set]));
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
var snapshots2 = /* @__PURE__ */ new WeakMap();
|
|
395
|
-
function restoreAttributes2(element_or_elements) {
|
|
396
|
-
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
397
|
-
const snapshot = snapshots2.get(element);
|
|
398
|
-
if (!snapshot) {
|
|
399
|
-
continue;
|
|
400
|
-
}
|
|
401
|
-
for (const [name, value] of snapshot.entries()) {
|
|
402
|
-
value === null ? element.removeAttribute(name) : element.setAttribute(name, value);
|
|
403
|
-
}
|
|
404
|
-
snapshots2.delete(element);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
function saveAttributes2(element_or_elements, name_or_names) {
|
|
408
|
-
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
409
|
-
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
410
|
-
let snapshot = snapshots2.get(element);
|
|
411
|
-
if (!snapshot) {
|
|
412
|
-
snapshot = /* @__PURE__ */ new Map();
|
|
413
|
-
snapshots2.set(element, snapshot);
|
|
414
|
-
}
|
|
415
|
-
names.forEach((name) => {
|
|
416
|
-
snapshot.set(name, element.getAttribute(name));
|
|
417
|
-
});
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
|
|
421
371
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
422
372
|
function createRovingTabIndex(container, options = {}) {
|
|
423
373
|
if (!(container instanceof Element)) {
|
|
@@ -509,7 +459,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
509
459
|
this.#controller = null;
|
|
510
460
|
this.#focusables.forEach((focusable) => {
|
|
511
461
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
512
|
-
|
|
462
|
+
restoreAttributes(focusable);
|
|
513
463
|
});
|
|
514
464
|
this.#focusables.clear();
|
|
515
465
|
this.#focusablesByFirstChar.clear();
|
|
@@ -614,7 +564,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
614
564
|
for (const focusable of this.#focusables) {
|
|
615
565
|
if (!current.has(focusable)) {
|
|
616
566
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
617
|
-
|
|
567
|
+
restoreAttributes(focusable);
|
|
618
568
|
this.#focusables.delete(focusable);
|
|
619
569
|
for (const [key, focusables] of this.#focusablesByFirstChar) {
|
|
620
570
|
const index = focusables.indexOf(focusable);
|
|
@@ -636,7 +586,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
636
586
|
this.#focusables.add(focusable);
|
|
637
587
|
_RovingTabIndex.#initialized.add(focusable);
|
|
638
588
|
if (!navigationOnly) {
|
|
639
|
-
|
|
589
|
+
saveAttributes(focusable, "tabindex");
|
|
640
590
|
focusable.setAttribute("tabindex", "-1");
|
|
641
591
|
}
|
|
642
592
|
if (!typeahead) {
|
|
@@ -649,8 +599,8 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
649
599
|
);
|
|
650
600
|
if (char) {
|
|
651
601
|
keys.add(char);
|
|
652
|
-
|
|
653
|
-
|
|
602
|
+
saveAttributes(focusable, "aria-keyshortcuts");
|
|
603
|
+
addAttributeToken(focusable, "aria-keyshortcuts", char, {
|
|
654
604
|
caseInsensitive: true
|
|
655
605
|
});
|
|
656
606
|
}
|
|
@@ -1205,7 +1155,7 @@ var TabsIndicator = class {
|
|
|
1205
1155
|
* Tabs
|
|
1206
1156
|
* WAI-ARIA compliant tabs pattern implementation in TypeScript.
|
|
1207
1157
|
*
|
|
1208
|
-
* @version 2.0.
|
|
1158
|
+
* @version 2.0.12
|
|
1209
1159
|
* @author Yusuke Kamiyamane
|
|
1210
1160
|
* @license MIT
|
|
1211
1161
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1217,7 +1167,7 @@ var TabsIndicator = class {
|
|
|
1217
1167
|
(**
|
|
1218
1168
|
* Attribute Util
|
|
1219
1169
|
*
|
|
1220
|
-
* @version 2.0.
|
|
1170
|
+
* @version 2.0.1
|
|
1221
1171
|
* @author Yusuke Kamiyamane
|
|
1222
1172
|
* @license MIT
|
|
1223
1173
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1230,7 +1180,7 @@ power-focusable/dist/index.js:
|
|
|
1230
1180
|
* High-precision focus management utility with full composed tree support.
|
|
1231
1181
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
1232
1182
|
*
|
|
1233
|
-
* @version 4.3.
|
|
1183
|
+
* @version 4.3.25
|
|
1234
1184
|
* @author Yusuke Kamiyamane
|
|
1235
1185
|
* @license MIT
|
|
1236
1186
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1241,31 +1191,20 @@ power-focusable/dist/index.js:
|
|
|
1241
1191
|
(**
|
|
1242
1192
|
* Button
|
|
1243
1193
|
*
|
|
1244
|
-
* @version 1.0.
|
|
1194
|
+
* @version 1.0.7
|
|
1245
1195
|
* @author Yusuke Kamiyamane
|
|
1246
1196
|
* @license MIT
|
|
1247
1197
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1248
1198
|
* @see {@link https://github.com/y14e/button}
|
|
1249
1199
|
*)
|
|
1250
1200
|
|
|
1251
|
-
@y14e/attributes-utils/dist/index.js:
|
|
1252
|
-
(**
|
|
1253
|
-
* Attributes Utils
|
|
1254
|
-
*
|
|
1255
|
-
* @version 1.1.7
|
|
1256
|
-
* @author Yusuke Kamiyamane
|
|
1257
|
-
* @license MIT
|
|
1258
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1259
|
-
* @see {@link https://github.com/y14e/attributes-utils}
|
|
1260
|
-
*)
|
|
1261
|
-
|
|
1262
1201
|
@y14e/roving-tabindex/dist/index.js:
|
|
1263
1202
|
(**
|
|
1264
1203
|
* Roving Tabindex
|
|
1265
1204
|
* Lightweight roving tabindex utility with fully focus management.
|
|
1266
1205
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
1267
1206
|
*
|
|
1268
|
-
* @version 3.1.
|
|
1207
|
+
* @version 3.1.22
|
|
1269
1208
|
* @author Yusuke Kamiyamane
|
|
1270
1209
|
* @license MIT
|
|
1271
1210
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -366,56 +366,6 @@ var Button = class {
|
|
|
366
366
|
};
|
|
367
367
|
};
|
|
368
368
|
|
|
369
|
-
// node_modules/@y14e/attributes-utils/dist/index.js
|
|
370
|
-
var DEFAULT_PARSER2 = (value) => value.split(/\s+/);
|
|
371
|
-
var DEFAULT_SERIALIZER2 = (tokens) => tokens.join(" ");
|
|
372
|
-
function addTokenToAttribute(element, name, token, options = {}) {
|
|
373
|
-
const value = element.getAttribute(name)?.trim();
|
|
374
|
-
const {
|
|
375
|
-
caseInsensitive = false,
|
|
376
|
-
parse = DEFAULT_PARSER2,
|
|
377
|
-
serialize = DEFAULT_SERIALIZER2
|
|
378
|
-
} = options;
|
|
379
|
-
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
380
|
-
if (caseInsensitive) {
|
|
381
|
-
const lower = token.toLowerCase();
|
|
382
|
-
if (tokens.every((token2) => token2.toLowerCase() !== lower)) {
|
|
383
|
-
tokens.push(token);
|
|
384
|
-
element.setAttribute(name, serialize(tokens));
|
|
385
|
-
}
|
|
386
|
-
} else {
|
|
387
|
-
const set = new Set(tokens);
|
|
388
|
-
set.add(token);
|
|
389
|
-
element.setAttribute(name, serialize([...set]));
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
var snapshots2 = /* @__PURE__ */ new WeakMap();
|
|
393
|
-
function restoreAttributes2(element_or_elements) {
|
|
394
|
-
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
395
|
-
const snapshot = snapshots2.get(element);
|
|
396
|
-
if (!snapshot) {
|
|
397
|
-
continue;
|
|
398
|
-
}
|
|
399
|
-
for (const [name, value] of snapshot.entries()) {
|
|
400
|
-
value === null ? element.removeAttribute(name) : element.setAttribute(name, value);
|
|
401
|
-
}
|
|
402
|
-
snapshots2.delete(element);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
function saveAttributes2(element_or_elements, name_or_names) {
|
|
406
|
-
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
407
|
-
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
408
|
-
let snapshot = snapshots2.get(element);
|
|
409
|
-
if (!snapshot) {
|
|
410
|
-
snapshot = /* @__PURE__ */ new Map();
|
|
411
|
-
snapshots2.set(element, snapshot);
|
|
412
|
-
}
|
|
413
|
-
names.forEach((name) => {
|
|
414
|
-
snapshot.set(name, element.getAttribute(name));
|
|
415
|
-
});
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
|
|
419
369
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
420
370
|
function createRovingTabIndex(container, options = {}) {
|
|
421
371
|
if (!(container instanceof Element)) {
|
|
@@ -507,7 +457,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
507
457
|
this.#controller = null;
|
|
508
458
|
this.#focusables.forEach((focusable) => {
|
|
509
459
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
510
|
-
|
|
460
|
+
restoreAttributes(focusable);
|
|
511
461
|
});
|
|
512
462
|
this.#focusables.clear();
|
|
513
463
|
this.#focusablesByFirstChar.clear();
|
|
@@ -612,7 +562,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
612
562
|
for (const focusable of this.#focusables) {
|
|
613
563
|
if (!current.has(focusable)) {
|
|
614
564
|
_RovingTabIndex.#initialized.delete(focusable);
|
|
615
|
-
|
|
565
|
+
restoreAttributes(focusable);
|
|
616
566
|
this.#focusables.delete(focusable);
|
|
617
567
|
for (const [key, focusables] of this.#focusablesByFirstChar) {
|
|
618
568
|
const index = focusables.indexOf(focusable);
|
|
@@ -634,7 +584,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
634
584
|
this.#focusables.add(focusable);
|
|
635
585
|
_RovingTabIndex.#initialized.add(focusable);
|
|
636
586
|
if (!navigationOnly) {
|
|
637
|
-
|
|
587
|
+
saveAttributes(focusable, "tabindex");
|
|
638
588
|
focusable.setAttribute("tabindex", "-1");
|
|
639
589
|
}
|
|
640
590
|
if (!typeahead) {
|
|
@@ -647,8 +597,8 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
647
597
|
);
|
|
648
598
|
if (char) {
|
|
649
599
|
keys.add(char);
|
|
650
|
-
|
|
651
|
-
|
|
600
|
+
saveAttributes(focusable, "aria-keyshortcuts");
|
|
601
|
+
addAttributeToken(focusable, "aria-keyshortcuts", char, {
|
|
652
602
|
caseInsensitive: true
|
|
653
603
|
});
|
|
654
604
|
}
|
|
@@ -1203,7 +1153,7 @@ var TabsIndicator = class {
|
|
|
1203
1153
|
* Tabs
|
|
1204
1154
|
* WAI-ARIA compliant tabs pattern implementation in TypeScript.
|
|
1205
1155
|
*
|
|
1206
|
-
* @version 2.0.
|
|
1156
|
+
* @version 2.0.12
|
|
1207
1157
|
* @author Yusuke Kamiyamane
|
|
1208
1158
|
* @license MIT
|
|
1209
1159
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1215,7 +1165,7 @@ var TabsIndicator = class {
|
|
|
1215
1165
|
(**
|
|
1216
1166
|
* Attribute Util
|
|
1217
1167
|
*
|
|
1218
|
-
* @version 2.0.
|
|
1168
|
+
* @version 2.0.1
|
|
1219
1169
|
* @author Yusuke Kamiyamane
|
|
1220
1170
|
* @license MIT
|
|
1221
1171
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1228,7 +1178,7 @@ power-focusable/dist/index.js:
|
|
|
1228
1178
|
* High-precision focus management utility with full composed tree support.
|
|
1229
1179
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
1230
1180
|
*
|
|
1231
|
-
* @version 4.3.
|
|
1181
|
+
* @version 4.3.25
|
|
1232
1182
|
* @author Yusuke Kamiyamane
|
|
1233
1183
|
* @license MIT
|
|
1234
1184
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -1239,31 +1189,20 @@ power-focusable/dist/index.js:
|
|
|
1239
1189
|
(**
|
|
1240
1190
|
* Button
|
|
1241
1191
|
*
|
|
1242
|
-
* @version 1.0.
|
|
1192
|
+
* @version 1.0.7
|
|
1243
1193
|
* @author Yusuke Kamiyamane
|
|
1244
1194
|
* @license MIT
|
|
1245
1195
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1246
1196
|
* @see {@link https://github.com/y14e/button}
|
|
1247
1197
|
*)
|
|
1248
1198
|
|
|
1249
|
-
@y14e/attributes-utils/dist/index.js:
|
|
1250
|
-
(**
|
|
1251
|
-
* Attributes Utils
|
|
1252
|
-
*
|
|
1253
|
-
* @version 1.1.7
|
|
1254
|
-
* @author Yusuke Kamiyamane
|
|
1255
|
-
* @license MIT
|
|
1256
|
-
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
1257
|
-
* @see {@link https://github.com/y14e/attributes-utils}
|
|
1258
|
-
*)
|
|
1259
|
-
|
|
1260
1199
|
@y14e/roving-tabindex/dist/index.js:
|
|
1261
1200
|
(**
|
|
1262
1201
|
* Roving Tabindex
|
|
1263
1202
|
* Lightweight roving tabindex utility with fully focus management.
|
|
1264
1203
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
1265
1204
|
*
|
|
1266
|
-
* @version 3.1.
|
|
1205
|
+
* @version 3.1.22
|
|
1267
1206
|
* @author Yusuke Kamiyamane
|
|
1268
1207
|
* @license MIT
|
|
1269
1208
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -546,7 +546,7 @@ var TabsIndicator = class {
|
|
|
546
546
|
* Tabs
|
|
547
547
|
* WAI-ARIA compliant tabs pattern implementation in TypeScript.
|
|
548
548
|
*
|
|
549
|
-
* @version 2.0.
|
|
549
|
+
* @version 2.0.12
|
|
550
550
|
* @author Yusuke Kamiyamane
|
|
551
551
|
* @license MIT
|
|
552
552
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -521,7 +521,7 @@ var TabsIndicator = class {
|
|
|
521
521
|
* Tabs
|
|
522
522
|
* WAI-ARIA compliant tabs pattern implementation in TypeScript.
|
|
523
523
|
*
|
|
524
|
-
* @version 2.0.
|
|
524
|
+
* @version 2.0.12
|
|
525
525
|
* @author Yusuke Kamiyamane
|
|
526
526
|
* @license MIT
|
|
527
527
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/tabs",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.12",
|
|
4
4
|
"description": "WAI-ARIA compliant tabs pattern implementation in TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"node": ">=18"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@y14e/attribute-util": "^2.0.
|
|
54
|
-
"@y14e/button": "^1.0.
|
|
55
|
-
"@y14e/roving-tabindex": "^3.1.
|
|
53
|
+
"@y14e/attribute-util": "^2.0.1",
|
|
54
|
+
"@y14e/button": "^1.0.7",
|
|
55
|
+
"@y14e/roving-tabindex": "^3.1.22"
|
|
56
56
|
}
|
|
57
57
|
}
|