@y14e/disclosure 2.0.12 → 2.0.14
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 +125 -96
- package/dist/index.bundle.js +125 -96
- package/dist/index.cjs +4 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,11 +13,11 @@ npm i @y14e/disclosure
|
|
|
13
13
|
import { Disclosure } from "@y14e/disclosure";
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import { Disclosure } from "https://esm.sh/@y14e/disclosure@2.0.
|
|
16
|
+
import { Disclosure } from "https://esm.sh/@y14e/disclosure@2.0.14";
|
|
17
17
|
// or
|
|
18
|
-
import { Disclosure } from "https://cdn.jsdelivr.net/npm/@y14e/disclosure@2.0.
|
|
18
|
+
import { Disclosure } from "https://cdn.jsdelivr.net/npm/@y14e/disclosure@2.0.14/+esm";
|
|
19
19
|
// or
|
|
20
|
-
import { Disclosure } from "https://esm.unpkg.com/@y14e/disclosure@2.0.
|
|
20
|
+
import { Disclosure } from "https://esm.unpkg.com/@y14e/disclosure@2.0.14";
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -53,8 +53,10 @@ function isValid(element, name, token) {
|
|
|
53
53
|
console.warn("Invalid element");
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
try {
|
|
57
|
+
document.createElement("div").setAttribute(name, "");
|
|
58
|
+
} catch {
|
|
59
|
+
console.warn(`Invalid attribute name: '${name}'`);
|
|
58
60
|
return false;
|
|
59
61
|
}
|
|
60
62
|
if (typeof token !== "string" || !token.trim()) {
|
|
@@ -99,37 +101,13 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
99
101
|
console.warn("Invalid container element. Fallback: <body> element.");
|
|
100
102
|
container = document.body;
|
|
101
103
|
}
|
|
102
|
-
|
|
103
|
-
composed
|
|
104
|
+
const {
|
|
105
|
+
composed,
|
|
104
106
|
filter,
|
|
105
107
|
include,
|
|
106
|
-
skipNegativeTabIndexCheck
|
|
107
|
-
skipVisibilityCheck
|
|
108
|
-
} = options;
|
|
109
|
-
if (typeof composed !== "boolean") {
|
|
110
|
-
console.warn("Invalid composed option. Fallback: false.");
|
|
111
|
-
composed = false;
|
|
112
|
-
}
|
|
113
|
-
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
114
|
-
console.warn(
|
|
115
|
-
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
116
|
-
);
|
|
117
|
-
filter = void 0;
|
|
118
|
-
}
|
|
119
|
-
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
120
|
-
console.warn(
|
|
121
|
-
"Invalid include function. Fallback: no include function (undefined)."
|
|
122
|
-
);
|
|
123
|
-
include = void 0;
|
|
124
|
-
}
|
|
125
|
-
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
126
|
-
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
127
|
-
skipNegativeTabIndexCheck = false;
|
|
128
|
-
}
|
|
129
|
-
if (typeof skipVisibilityCheck !== "boolean") {
|
|
130
|
-
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
131
|
-
skipVisibilityCheck = false;
|
|
132
|
-
}
|
|
108
|
+
skipNegativeTabIndexCheck,
|
|
109
|
+
skipVisibilityCheck
|
|
110
|
+
} = resolveOptions2(options);
|
|
133
111
|
const candidates = [];
|
|
134
112
|
if (composed || include) {
|
|
135
113
|
let traverse2 = function(node) {
|
|
@@ -173,15 +151,7 @@ function isFocusable(element, options = {}) {
|
|
|
173
151
|
console.warn("Invalid element");
|
|
174
152
|
return false;
|
|
175
153
|
}
|
|
176
|
-
|
|
177
|
-
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
178
|
-
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
179
|
-
skipNegativeTabIndexCheck = false;
|
|
180
|
-
}
|
|
181
|
-
if (typeof skipVisibilityCheck !== "boolean") {
|
|
182
|
-
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
183
|
-
skipVisibilityCheck = false;
|
|
184
|
-
}
|
|
154
|
+
const { skipNegativeTabIndexCheck, skipVisibilityCheck } = resolveOptions2(options);
|
|
185
155
|
if (element.hasAttribute("hidden") || isInert(element)) {
|
|
186
156
|
return false;
|
|
187
157
|
}
|
|
@@ -356,6 +326,61 @@ function isInert(element) {
|
|
|
356
326
|
function isUngroupedRadio(element) {
|
|
357
327
|
return element.type === "radio" && !!element.name;
|
|
358
328
|
}
|
|
329
|
+
function resolveOptions2(options) {
|
|
330
|
+
let {
|
|
331
|
+
anchor = getActiveElement(),
|
|
332
|
+
composed = false,
|
|
333
|
+
filter,
|
|
334
|
+
include,
|
|
335
|
+
skipNegativeTabIndexCheck = false,
|
|
336
|
+
skipVisibilityCheck = false,
|
|
337
|
+
wrap = false
|
|
338
|
+
} = options;
|
|
339
|
+
if (!(anchor instanceof Element)) {
|
|
340
|
+
const active = getActiveElement();
|
|
341
|
+
if (active instanceof Element) {
|
|
342
|
+
console.warn("Invalid anchor element. Fallback: active element.");
|
|
343
|
+
anchor = active;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (typeof composed !== "boolean") {
|
|
347
|
+
console.warn("Invalid composed option. Fallback: false.");
|
|
348
|
+
composed = false;
|
|
349
|
+
}
|
|
350
|
+
if (filter !== void 0 && typeof filter !== "function") {
|
|
351
|
+
console.warn(
|
|
352
|
+
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
353
|
+
);
|
|
354
|
+
filter = void 0;
|
|
355
|
+
}
|
|
356
|
+
if (include !== void 0 && typeof include !== "function") {
|
|
357
|
+
console.warn(
|
|
358
|
+
"Invalid include function. Fallback: no include function (undefined)."
|
|
359
|
+
);
|
|
360
|
+
include = void 0;
|
|
361
|
+
}
|
|
362
|
+
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
363
|
+
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
364
|
+
skipNegativeTabIndexCheck = false;
|
|
365
|
+
}
|
|
366
|
+
if (typeof skipVisibilityCheck !== "boolean") {
|
|
367
|
+
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
368
|
+
skipVisibilityCheck = false;
|
|
369
|
+
}
|
|
370
|
+
if (typeof wrap !== "boolean") {
|
|
371
|
+
console.warn("Invalid wrap option. Fallback: false.");
|
|
372
|
+
wrap = false;
|
|
373
|
+
}
|
|
374
|
+
return {
|
|
375
|
+
anchor,
|
|
376
|
+
composed,
|
|
377
|
+
filter,
|
|
378
|
+
include,
|
|
379
|
+
skipNegativeTabIndexCheck,
|
|
380
|
+
skipVisibilityCheck,
|
|
381
|
+
wrap
|
|
382
|
+
};
|
|
383
|
+
}
|
|
359
384
|
|
|
360
385
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
361
386
|
function createRovingTabIndex(container, options = {}) {
|
|
@@ -378,56 +403,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
378
403
|
#isDestroyed = false;
|
|
379
404
|
constructor(container, options = {}) {
|
|
380
405
|
this.#container = container;
|
|
381
|
-
|
|
382
|
-
direction = "both",
|
|
383
|
-
navigationOnly = false,
|
|
384
|
-
noMemory = false,
|
|
385
|
-
noStart = false,
|
|
386
|
-
selector = "",
|
|
387
|
-
typeahead = false,
|
|
388
|
-
wrap = false
|
|
389
|
-
} = options;
|
|
390
|
-
if (!["both", "horizontal", "vertical"].includes(direction)) {
|
|
391
|
-
console.warn("Invalid direction option. Fallback: 'both'.");
|
|
392
|
-
direction = "both";
|
|
393
|
-
}
|
|
394
|
-
if (typeof navigationOnly !== "boolean") {
|
|
395
|
-
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
396
|
-
navigationOnly = false;
|
|
397
|
-
}
|
|
398
|
-
if (typeof noMemory !== "boolean") {
|
|
399
|
-
console.warn("Invalid noMemory option. Fallback: false.");
|
|
400
|
-
noMemory = false;
|
|
401
|
-
}
|
|
402
|
-
if (typeof noStart !== "boolean") {
|
|
403
|
-
console.warn("Invalid noStart option. Fallback: false.");
|
|
404
|
-
noStart = false;
|
|
405
|
-
}
|
|
406
|
-
if (selector !== "") {
|
|
407
|
-
try {
|
|
408
|
-
document.querySelector(selector);
|
|
409
|
-
} catch {
|
|
410
|
-
console.warn("Invalid selector. Fallback: no selector string.");
|
|
411
|
-
selector = "";
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
if (typeof typeahead !== "boolean") {
|
|
415
|
-
console.warn("Invalid typeahead option. Fallback: false.");
|
|
416
|
-
typeahead = false;
|
|
417
|
-
}
|
|
418
|
-
if (typeof wrap !== "boolean") {
|
|
419
|
-
console.warn("Invalid wrap option. Fallback: false.");
|
|
420
|
-
wrap = false;
|
|
421
|
-
}
|
|
422
|
-
this.#settings = {
|
|
423
|
-
direction,
|
|
424
|
-
navigationOnly,
|
|
425
|
-
noMemory,
|
|
426
|
-
noStart,
|
|
427
|
-
selector,
|
|
428
|
-
typeahead,
|
|
429
|
-
wrap
|
|
430
|
-
};
|
|
406
|
+
this.#settings = this.#resolveOptions(options);
|
|
431
407
|
this.#selectorFilter = this.#createSelectorFilter();
|
|
432
408
|
this.#initialize();
|
|
433
409
|
}
|
|
@@ -615,6 +591,58 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
615
591
|
skipVisibilityCheck: true
|
|
616
592
|
});
|
|
617
593
|
}
|
|
594
|
+
#resolveOptions(options) {
|
|
595
|
+
let {
|
|
596
|
+
direction = "both",
|
|
597
|
+
navigationOnly = false,
|
|
598
|
+
noMemory = false,
|
|
599
|
+
noStart = false,
|
|
600
|
+
selector = "",
|
|
601
|
+
typeahead = false,
|
|
602
|
+
wrap = false
|
|
603
|
+
} = options;
|
|
604
|
+
if (!["both", "horizontal", "vertical"].includes(direction)) {
|
|
605
|
+
console.warn("Invalid direction option. Fallback: 'both'.");
|
|
606
|
+
direction = "both";
|
|
607
|
+
}
|
|
608
|
+
if (typeof navigationOnly !== "boolean") {
|
|
609
|
+
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
610
|
+
navigationOnly = false;
|
|
611
|
+
}
|
|
612
|
+
if (typeof noMemory !== "boolean") {
|
|
613
|
+
console.warn("Invalid noMemory option. Fallback: false.");
|
|
614
|
+
noMemory = false;
|
|
615
|
+
}
|
|
616
|
+
if (typeof noStart !== "boolean") {
|
|
617
|
+
console.warn("Invalid noStart option. Fallback: false.");
|
|
618
|
+
noStart = false;
|
|
619
|
+
}
|
|
620
|
+
if (selector !== "") {
|
|
621
|
+
try {
|
|
622
|
+
document.querySelector(selector);
|
|
623
|
+
} catch {
|
|
624
|
+
console.warn("Invalid selector. Fallback: no selector string.");
|
|
625
|
+
selector = "";
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (typeof typeahead !== "boolean") {
|
|
629
|
+
console.warn("Invalid typeahead option. Fallback: false.");
|
|
630
|
+
typeahead = false;
|
|
631
|
+
}
|
|
632
|
+
if (typeof wrap !== "boolean") {
|
|
633
|
+
console.warn("Invalid wrap option. Fallback: false.");
|
|
634
|
+
wrap = false;
|
|
635
|
+
}
|
|
636
|
+
return {
|
|
637
|
+
direction,
|
|
638
|
+
navigationOnly,
|
|
639
|
+
noMemory,
|
|
640
|
+
noStart,
|
|
641
|
+
selector,
|
|
642
|
+
typeahead,
|
|
643
|
+
wrap
|
|
644
|
+
};
|
|
645
|
+
}
|
|
618
646
|
};
|
|
619
647
|
|
|
620
648
|
// src/index.ts
|
|
@@ -879,7 +907,8 @@ var Disclosure = class _Disclosure {
|
|
|
879
907
|
};
|
|
880
908
|
const mergedAnimation = merged.animation;
|
|
881
909
|
const duration = mergedAnimation.duration;
|
|
882
|
-
const
|
|
910
|
+
const defaults = this.#defaults;
|
|
911
|
+
const defaultAnimation = defaults.animation;
|
|
883
912
|
if (typeof duration !== "number" || Number.isNaN(duration)) {
|
|
884
913
|
const duration2 = defaultAnimation.duration;
|
|
885
914
|
console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
|
|
@@ -895,7 +924,7 @@ var Disclosure = class _Disclosure {
|
|
|
895
924
|
mergedAnimation.easing = easing;
|
|
896
925
|
}
|
|
897
926
|
if (typeof merged.collapsible !== "boolean") {
|
|
898
|
-
const collapsible =
|
|
927
|
+
const collapsible = defaults.collapsible;
|
|
899
928
|
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
900
929
|
merged.collapsible = collapsible;
|
|
901
930
|
}
|
|
@@ -920,7 +949,7 @@ function waitAnimationFinish(animation) {
|
|
|
920
949
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
921
950
|
* Using the <details> and <summary> element.
|
|
922
951
|
*
|
|
923
|
-
* @version 2.0.
|
|
952
|
+
* @version 2.0.14
|
|
924
953
|
* @author Yusuke Kamiyamane
|
|
925
954
|
* @license MIT
|
|
926
955
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -932,7 +961,7 @@ function waitAnimationFinish(animation) {
|
|
|
932
961
|
(**
|
|
933
962
|
* Attribute Utils
|
|
934
963
|
*
|
|
935
|
-
* @version 2.0.
|
|
964
|
+
* @version 2.0.8
|
|
936
965
|
* @author Yusuke Kamiyamane
|
|
937
966
|
* @license MIT
|
|
938
967
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -945,7 +974,7 @@ power-focusable/dist/index.js:
|
|
|
945
974
|
* High-precision focus management utility with full composed tree support.
|
|
946
975
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
947
976
|
*
|
|
948
|
-
* @version 4.3.
|
|
977
|
+
* @version 4.3.29
|
|
949
978
|
* @author Yusuke Kamiyamane
|
|
950
979
|
* @license MIT
|
|
951
980
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -958,7 +987,7 @@ power-focusable/dist/index.js:
|
|
|
958
987
|
* Lightweight roving tabindex utility with fully focus management.
|
|
959
988
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
960
989
|
*
|
|
961
|
-
* @version 3.1.
|
|
990
|
+
* @version 3.1.27
|
|
962
991
|
* @author Yusuke Kamiyamane
|
|
963
992
|
* @license MIT
|
|
964
993
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -51,8 +51,10 @@ function isValid(element, name, token) {
|
|
|
51
51
|
console.warn("Invalid element");
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
try {
|
|
55
|
+
document.createElement("div").setAttribute(name, "");
|
|
56
|
+
} catch {
|
|
57
|
+
console.warn(`Invalid attribute name: '${name}'`);
|
|
56
58
|
return false;
|
|
57
59
|
}
|
|
58
60
|
if (typeof token !== "string" || !token.trim()) {
|
|
@@ -97,37 +99,13 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
97
99
|
console.warn("Invalid container element. Fallback: <body> element.");
|
|
98
100
|
container = document.body;
|
|
99
101
|
}
|
|
100
|
-
|
|
101
|
-
composed
|
|
102
|
+
const {
|
|
103
|
+
composed,
|
|
102
104
|
filter,
|
|
103
105
|
include,
|
|
104
|
-
skipNegativeTabIndexCheck
|
|
105
|
-
skipVisibilityCheck
|
|
106
|
-
} = options;
|
|
107
|
-
if (typeof composed !== "boolean") {
|
|
108
|
-
console.warn("Invalid composed option. Fallback: false.");
|
|
109
|
-
composed = false;
|
|
110
|
-
}
|
|
111
|
-
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
112
|
-
console.warn(
|
|
113
|
-
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
114
|
-
);
|
|
115
|
-
filter = void 0;
|
|
116
|
-
}
|
|
117
|
-
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
118
|
-
console.warn(
|
|
119
|
-
"Invalid include function. Fallback: no include function (undefined)."
|
|
120
|
-
);
|
|
121
|
-
include = void 0;
|
|
122
|
-
}
|
|
123
|
-
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
124
|
-
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
125
|
-
skipNegativeTabIndexCheck = false;
|
|
126
|
-
}
|
|
127
|
-
if (typeof skipVisibilityCheck !== "boolean") {
|
|
128
|
-
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
129
|
-
skipVisibilityCheck = false;
|
|
130
|
-
}
|
|
106
|
+
skipNegativeTabIndexCheck,
|
|
107
|
+
skipVisibilityCheck
|
|
108
|
+
} = resolveOptions2(options);
|
|
131
109
|
const candidates = [];
|
|
132
110
|
if (composed || include) {
|
|
133
111
|
let traverse2 = function(node) {
|
|
@@ -171,15 +149,7 @@ function isFocusable(element, options = {}) {
|
|
|
171
149
|
console.warn("Invalid element");
|
|
172
150
|
return false;
|
|
173
151
|
}
|
|
174
|
-
|
|
175
|
-
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
176
|
-
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
177
|
-
skipNegativeTabIndexCheck = false;
|
|
178
|
-
}
|
|
179
|
-
if (typeof skipVisibilityCheck !== "boolean") {
|
|
180
|
-
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
181
|
-
skipVisibilityCheck = false;
|
|
182
|
-
}
|
|
152
|
+
const { skipNegativeTabIndexCheck, skipVisibilityCheck } = resolveOptions2(options);
|
|
183
153
|
if (element.hasAttribute("hidden") || isInert(element)) {
|
|
184
154
|
return false;
|
|
185
155
|
}
|
|
@@ -354,6 +324,61 @@ function isInert(element) {
|
|
|
354
324
|
function isUngroupedRadio(element) {
|
|
355
325
|
return element.type === "radio" && !!element.name;
|
|
356
326
|
}
|
|
327
|
+
function resolveOptions2(options) {
|
|
328
|
+
let {
|
|
329
|
+
anchor = getActiveElement(),
|
|
330
|
+
composed = false,
|
|
331
|
+
filter,
|
|
332
|
+
include,
|
|
333
|
+
skipNegativeTabIndexCheck = false,
|
|
334
|
+
skipVisibilityCheck = false,
|
|
335
|
+
wrap = false
|
|
336
|
+
} = options;
|
|
337
|
+
if (!(anchor instanceof Element)) {
|
|
338
|
+
const active = getActiveElement();
|
|
339
|
+
if (active instanceof Element) {
|
|
340
|
+
console.warn("Invalid anchor element. Fallback: active element.");
|
|
341
|
+
anchor = active;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (typeof composed !== "boolean") {
|
|
345
|
+
console.warn("Invalid composed option. Fallback: false.");
|
|
346
|
+
composed = false;
|
|
347
|
+
}
|
|
348
|
+
if (filter !== void 0 && typeof filter !== "function") {
|
|
349
|
+
console.warn(
|
|
350
|
+
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
351
|
+
);
|
|
352
|
+
filter = void 0;
|
|
353
|
+
}
|
|
354
|
+
if (include !== void 0 && typeof include !== "function") {
|
|
355
|
+
console.warn(
|
|
356
|
+
"Invalid include function. Fallback: no include function (undefined)."
|
|
357
|
+
);
|
|
358
|
+
include = void 0;
|
|
359
|
+
}
|
|
360
|
+
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
361
|
+
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
362
|
+
skipNegativeTabIndexCheck = false;
|
|
363
|
+
}
|
|
364
|
+
if (typeof skipVisibilityCheck !== "boolean") {
|
|
365
|
+
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
366
|
+
skipVisibilityCheck = false;
|
|
367
|
+
}
|
|
368
|
+
if (typeof wrap !== "boolean") {
|
|
369
|
+
console.warn("Invalid wrap option. Fallback: false.");
|
|
370
|
+
wrap = false;
|
|
371
|
+
}
|
|
372
|
+
return {
|
|
373
|
+
anchor,
|
|
374
|
+
composed,
|
|
375
|
+
filter,
|
|
376
|
+
include,
|
|
377
|
+
skipNegativeTabIndexCheck,
|
|
378
|
+
skipVisibilityCheck,
|
|
379
|
+
wrap
|
|
380
|
+
};
|
|
381
|
+
}
|
|
357
382
|
|
|
358
383
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
359
384
|
function createRovingTabIndex(container, options = {}) {
|
|
@@ -376,56 +401,7 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
376
401
|
#isDestroyed = false;
|
|
377
402
|
constructor(container, options = {}) {
|
|
378
403
|
this.#container = container;
|
|
379
|
-
|
|
380
|
-
direction = "both",
|
|
381
|
-
navigationOnly = false,
|
|
382
|
-
noMemory = false,
|
|
383
|
-
noStart = false,
|
|
384
|
-
selector = "",
|
|
385
|
-
typeahead = false,
|
|
386
|
-
wrap = false
|
|
387
|
-
} = options;
|
|
388
|
-
if (!["both", "horizontal", "vertical"].includes(direction)) {
|
|
389
|
-
console.warn("Invalid direction option. Fallback: 'both'.");
|
|
390
|
-
direction = "both";
|
|
391
|
-
}
|
|
392
|
-
if (typeof navigationOnly !== "boolean") {
|
|
393
|
-
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
394
|
-
navigationOnly = false;
|
|
395
|
-
}
|
|
396
|
-
if (typeof noMemory !== "boolean") {
|
|
397
|
-
console.warn("Invalid noMemory option. Fallback: false.");
|
|
398
|
-
noMemory = false;
|
|
399
|
-
}
|
|
400
|
-
if (typeof noStart !== "boolean") {
|
|
401
|
-
console.warn("Invalid noStart option. Fallback: false.");
|
|
402
|
-
noStart = false;
|
|
403
|
-
}
|
|
404
|
-
if (selector !== "") {
|
|
405
|
-
try {
|
|
406
|
-
document.querySelector(selector);
|
|
407
|
-
} catch {
|
|
408
|
-
console.warn("Invalid selector. Fallback: no selector string.");
|
|
409
|
-
selector = "";
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
if (typeof typeahead !== "boolean") {
|
|
413
|
-
console.warn("Invalid typeahead option. Fallback: false.");
|
|
414
|
-
typeahead = false;
|
|
415
|
-
}
|
|
416
|
-
if (typeof wrap !== "boolean") {
|
|
417
|
-
console.warn("Invalid wrap option. Fallback: false.");
|
|
418
|
-
wrap = false;
|
|
419
|
-
}
|
|
420
|
-
this.#settings = {
|
|
421
|
-
direction,
|
|
422
|
-
navigationOnly,
|
|
423
|
-
noMemory,
|
|
424
|
-
noStart,
|
|
425
|
-
selector,
|
|
426
|
-
typeahead,
|
|
427
|
-
wrap
|
|
428
|
-
};
|
|
404
|
+
this.#settings = this.#resolveOptions(options);
|
|
429
405
|
this.#selectorFilter = this.#createSelectorFilter();
|
|
430
406
|
this.#initialize();
|
|
431
407
|
}
|
|
@@ -613,6 +589,58 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
613
589
|
skipVisibilityCheck: true
|
|
614
590
|
});
|
|
615
591
|
}
|
|
592
|
+
#resolveOptions(options) {
|
|
593
|
+
let {
|
|
594
|
+
direction = "both",
|
|
595
|
+
navigationOnly = false,
|
|
596
|
+
noMemory = false,
|
|
597
|
+
noStart = false,
|
|
598
|
+
selector = "",
|
|
599
|
+
typeahead = false,
|
|
600
|
+
wrap = false
|
|
601
|
+
} = options;
|
|
602
|
+
if (!["both", "horizontal", "vertical"].includes(direction)) {
|
|
603
|
+
console.warn("Invalid direction option. Fallback: 'both'.");
|
|
604
|
+
direction = "both";
|
|
605
|
+
}
|
|
606
|
+
if (typeof navigationOnly !== "boolean") {
|
|
607
|
+
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
608
|
+
navigationOnly = false;
|
|
609
|
+
}
|
|
610
|
+
if (typeof noMemory !== "boolean") {
|
|
611
|
+
console.warn("Invalid noMemory option. Fallback: false.");
|
|
612
|
+
noMemory = false;
|
|
613
|
+
}
|
|
614
|
+
if (typeof noStart !== "boolean") {
|
|
615
|
+
console.warn("Invalid noStart option. Fallback: false.");
|
|
616
|
+
noStart = false;
|
|
617
|
+
}
|
|
618
|
+
if (selector !== "") {
|
|
619
|
+
try {
|
|
620
|
+
document.querySelector(selector);
|
|
621
|
+
} catch {
|
|
622
|
+
console.warn("Invalid selector. Fallback: no selector string.");
|
|
623
|
+
selector = "";
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
if (typeof typeahead !== "boolean") {
|
|
627
|
+
console.warn("Invalid typeahead option. Fallback: false.");
|
|
628
|
+
typeahead = false;
|
|
629
|
+
}
|
|
630
|
+
if (typeof wrap !== "boolean") {
|
|
631
|
+
console.warn("Invalid wrap option. Fallback: false.");
|
|
632
|
+
wrap = false;
|
|
633
|
+
}
|
|
634
|
+
return {
|
|
635
|
+
direction,
|
|
636
|
+
navigationOnly,
|
|
637
|
+
noMemory,
|
|
638
|
+
noStart,
|
|
639
|
+
selector,
|
|
640
|
+
typeahead,
|
|
641
|
+
wrap
|
|
642
|
+
};
|
|
643
|
+
}
|
|
616
644
|
};
|
|
617
645
|
|
|
618
646
|
// src/index.ts
|
|
@@ -877,7 +905,8 @@ var Disclosure = class _Disclosure {
|
|
|
877
905
|
};
|
|
878
906
|
const mergedAnimation = merged.animation;
|
|
879
907
|
const duration = mergedAnimation.duration;
|
|
880
|
-
const
|
|
908
|
+
const defaults = this.#defaults;
|
|
909
|
+
const defaultAnimation = defaults.animation;
|
|
881
910
|
if (typeof duration !== "number" || Number.isNaN(duration)) {
|
|
882
911
|
const duration2 = defaultAnimation.duration;
|
|
883
912
|
console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
|
|
@@ -893,7 +922,7 @@ var Disclosure = class _Disclosure {
|
|
|
893
922
|
mergedAnimation.easing = easing;
|
|
894
923
|
}
|
|
895
924
|
if (typeof merged.collapsible !== "boolean") {
|
|
896
|
-
const collapsible =
|
|
925
|
+
const collapsible = defaults.collapsible;
|
|
897
926
|
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
898
927
|
merged.collapsible = collapsible;
|
|
899
928
|
}
|
|
@@ -918,7 +947,7 @@ function waitAnimationFinish(animation) {
|
|
|
918
947
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
919
948
|
* Using the <details> and <summary> element.
|
|
920
949
|
*
|
|
921
|
-
* @version 2.0.
|
|
950
|
+
* @version 2.0.14
|
|
922
951
|
* @author Yusuke Kamiyamane
|
|
923
952
|
* @license MIT
|
|
924
953
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -930,7 +959,7 @@ function waitAnimationFinish(animation) {
|
|
|
930
959
|
(**
|
|
931
960
|
* Attribute Utils
|
|
932
961
|
*
|
|
933
|
-
* @version 2.0.
|
|
962
|
+
* @version 2.0.8
|
|
934
963
|
* @author Yusuke Kamiyamane
|
|
935
964
|
* @license MIT
|
|
936
965
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -943,7 +972,7 @@ power-focusable/dist/index.js:
|
|
|
943
972
|
* High-precision focus management utility with full composed tree support.
|
|
944
973
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
945
974
|
*
|
|
946
|
-
* @version 4.3.
|
|
975
|
+
* @version 4.3.29
|
|
947
976
|
* @author Yusuke Kamiyamane
|
|
948
977
|
* @license MIT
|
|
949
978
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -956,7 +985,7 @@ power-focusable/dist/index.js:
|
|
|
956
985
|
* Lightweight roving tabindex utility with fully focus management.
|
|
957
986
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
958
987
|
*
|
|
959
|
-
* @version 3.1.
|
|
988
|
+
* @version 3.1.27
|
|
960
989
|
* @author Yusuke Kamiyamane
|
|
961
990
|
* @license MIT
|
|
962
991
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -285,7 +285,8 @@ var Disclosure = class _Disclosure {
|
|
|
285
285
|
};
|
|
286
286
|
const mergedAnimation = merged.animation;
|
|
287
287
|
const duration = mergedAnimation.duration;
|
|
288
|
-
const
|
|
288
|
+
const defaults = this.#defaults;
|
|
289
|
+
const defaultAnimation = defaults.animation;
|
|
289
290
|
if (typeof duration !== "number" || Number.isNaN(duration)) {
|
|
290
291
|
const duration2 = defaultAnimation.duration;
|
|
291
292
|
console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
|
|
@@ -301,7 +302,7 @@ var Disclosure = class _Disclosure {
|
|
|
301
302
|
mergedAnimation.easing = easing;
|
|
302
303
|
}
|
|
303
304
|
if (typeof merged.collapsible !== "boolean") {
|
|
304
|
-
const collapsible =
|
|
305
|
+
const collapsible = defaults.collapsible;
|
|
305
306
|
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
306
307
|
merged.collapsible = collapsible;
|
|
307
308
|
}
|
|
@@ -326,7 +327,7 @@ function waitAnimationFinish(animation) {
|
|
|
326
327
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
327
328
|
* Using the <details> and <summary> element.
|
|
328
329
|
*
|
|
329
|
-
* @version 2.0.
|
|
330
|
+
* @version 2.0.14
|
|
330
331
|
* @author Yusuke Kamiyamane
|
|
331
332
|
* @license MIT
|
|
332
333
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -263,7 +263,8 @@ var Disclosure = class _Disclosure {
|
|
|
263
263
|
};
|
|
264
264
|
const mergedAnimation = merged.animation;
|
|
265
265
|
const duration = mergedAnimation.duration;
|
|
266
|
-
const
|
|
266
|
+
const defaults = this.#defaults;
|
|
267
|
+
const defaultAnimation = defaults.animation;
|
|
267
268
|
if (typeof duration !== "number" || Number.isNaN(duration)) {
|
|
268
269
|
const duration2 = defaultAnimation.duration;
|
|
269
270
|
console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
|
|
@@ -279,7 +280,7 @@ var Disclosure = class _Disclosure {
|
|
|
279
280
|
mergedAnimation.easing = easing;
|
|
280
281
|
}
|
|
281
282
|
if (typeof merged.collapsible !== "boolean") {
|
|
282
|
-
const collapsible =
|
|
283
|
+
const collapsible = defaults.collapsible;
|
|
283
284
|
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
284
285
|
merged.collapsible = collapsible;
|
|
285
286
|
}
|
|
@@ -304,7 +305,7 @@ function waitAnimationFinish(animation) {
|
|
|
304
305
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
305
306
|
* Using the <details> and <summary> element.
|
|
306
307
|
*
|
|
307
|
-
* @version 2.0.
|
|
308
|
+
* @version 2.0.14
|
|
308
309
|
* @author Yusuke Kamiyamane
|
|
309
310
|
* @license MIT
|
|
310
311
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/disclosure",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"esbuild": true
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@y14e/attribute-utils": "^2.0.
|
|
58
|
-
"@y14e/roving-tabindex": "^3.1.
|
|
57
|
+
"@y14e/attribute-utils": "^2.0.8",
|
|
58
|
+
"@y14e/roving-tabindex": "^3.1.27"
|
|
59
59
|
}
|
|
60
60
|
}
|