@y14e/disclosure-css 2.0.6 → 2.0.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 +3 -3
- package/dist/index.bundle.cjs +18 -20
- package/dist/index.bundle.js +18 -20
- package/dist/index.cjs +12 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,11 +13,11 @@ npm i @y14e/disclosure-css
|
|
|
13
13
|
import { Disclosure } from "@y14e/disclosure-css";
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import { Disclosure } from "https://esm.sh/@y14e/disclosure-css@2.0.
|
|
16
|
+
import { Disclosure } from "https://esm.sh/@y14e/disclosure-css@2.0.8";
|
|
17
17
|
// or
|
|
18
|
-
import { Disclosure } from "https://cdn.jsdelivr.net/npm/@y14e/disclosure-css@2.0.
|
|
18
|
+
import { Disclosure } from "https://cdn.jsdelivr.net/npm/@y14e/disclosure-css@2.0.8/+esm";
|
|
19
19
|
// or
|
|
20
|
-
import { Disclosure } from "https://esm.unpkg.com/@y14e/disclosure-css@2.0.
|
|
20
|
+
import { Disclosure } from "https://esm.unpkg.com/@y14e/disclosure-css@2.0.8";
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// node_modules/@y14e/attribute-
|
|
3
|
+
// node_modules/@y14e/attribute-utils/dist/index.js
|
|
4
4
|
var DEFAULT_PARSER = (value) => value.split(/\s+/);
|
|
5
5
|
var DEFAULT_SERIALIZER = (tokens) => tokens.join(" ");
|
|
6
6
|
function addAttributeToken(element, name, token, options = {}) {
|
|
@@ -366,17 +366,9 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
366
366
|
noStart = false;
|
|
367
367
|
}
|
|
368
368
|
if (selector !== "") {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
} else {
|
|
373
|
-
try {
|
|
374
|
-
this.#container.querySelector(selector);
|
|
375
|
-
} catch {
|
|
376
|
-
hasError = true;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
if (hasError) {
|
|
369
|
+
try {
|
|
370
|
+
document.querySelector(selector);
|
|
371
|
+
} catch {
|
|
380
372
|
console.warn("Invalid selector. Fallback: no selector string.");
|
|
381
373
|
selector = "";
|
|
382
374
|
}
|
|
@@ -740,7 +732,13 @@ var Disclosure = class _Disclosure {
|
|
|
740
732
|
return element.tabIndex >= 0;
|
|
741
733
|
}
|
|
742
734
|
#mergeOptions(target, source) {
|
|
743
|
-
|
|
735
|
+
const merged = { ...target, ...source };
|
|
736
|
+
if (typeof merged.collapsible !== "boolean") {
|
|
737
|
+
const collapsible = this.#defaults.collapsible;
|
|
738
|
+
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
739
|
+
merged.collapsible = collapsible;
|
|
740
|
+
}
|
|
741
|
+
return merged;
|
|
744
742
|
}
|
|
745
743
|
};
|
|
746
744
|
/**
|
|
@@ -748,7 +746,7 @@ var Disclosure = class _Disclosure {
|
|
|
748
746
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
749
747
|
* Using the <details> and <summary> element.
|
|
750
748
|
*
|
|
751
|
-
* @version 2.0.
|
|
749
|
+
* @version 2.0.8
|
|
752
750
|
* @author Yusuke Kamiyamane
|
|
753
751
|
* @license MIT
|
|
754
752
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -756,15 +754,15 @@ var Disclosure = class _Disclosure {
|
|
|
756
754
|
*/
|
|
757
755
|
/*! Bundled license information:
|
|
758
756
|
|
|
759
|
-
@y14e/attribute-
|
|
757
|
+
@y14e/attribute-utils/dist/index.js:
|
|
760
758
|
(**
|
|
761
|
-
* Attribute
|
|
759
|
+
* Attribute Utils
|
|
762
760
|
*
|
|
763
|
-
* @version 2.0.
|
|
761
|
+
* @version 2.0.5
|
|
764
762
|
* @author Yusuke Kamiyamane
|
|
765
763
|
* @license MIT
|
|
766
764
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
767
|
-
* @see {@link https://github.com/y14e/attribute-
|
|
765
|
+
* @see {@link https://github.com/y14e/attribute-utils}
|
|
768
766
|
*)
|
|
769
767
|
|
|
770
768
|
power-focusable/dist/index.js:
|
|
@@ -773,7 +771,7 @@ power-focusable/dist/index.js:
|
|
|
773
771
|
* High-precision focus management utility with full composed tree support.
|
|
774
772
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
775
773
|
*
|
|
776
|
-
* @version 4.3.
|
|
774
|
+
* @version 4.3.28
|
|
777
775
|
* @author Yusuke Kamiyamane
|
|
778
776
|
* @license MIT
|
|
779
777
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -786,7 +784,7 @@ power-focusable/dist/index.js:
|
|
|
786
784
|
* Lightweight roving tabindex utility with fully focus management.
|
|
787
785
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
788
786
|
*
|
|
789
|
-
* @version 3.1.
|
|
787
|
+
* @version 3.1.25
|
|
790
788
|
* @author Yusuke Kamiyamane
|
|
791
789
|
* @license MIT
|
|
792
790
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/@y14e/attribute-
|
|
1
|
+
// node_modules/@y14e/attribute-utils/dist/index.js
|
|
2
2
|
var DEFAULT_PARSER = (value) => value.split(/\s+/);
|
|
3
3
|
var DEFAULT_SERIALIZER = (tokens) => tokens.join(" ");
|
|
4
4
|
function addAttributeToken(element, name, token, options = {}) {
|
|
@@ -364,17 +364,9 @@ var RovingTabIndex = class _RovingTabIndex {
|
|
|
364
364
|
noStart = false;
|
|
365
365
|
}
|
|
366
366
|
if (selector !== "") {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
} else {
|
|
371
|
-
try {
|
|
372
|
-
this.#container.querySelector(selector);
|
|
373
|
-
} catch {
|
|
374
|
-
hasError = true;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
if (hasError) {
|
|
367
|
+
try {
|
|
368
|
+
document.querySelector(selector);
|
|
369
|
+
} catch {
|
|
378
370
|
console.warn("Invalid selector. Fallback: no selector string.");
|
|
379
371
|
selector = "";
|
|
380
372
|
}
|
|
@@ -738,7 +730,13 @@ var Disclosure = class _Disclosure {
|
|
|
738
730
|
return element.tabIndex >= 0;
|
|
739
731
|
}
|
|
740
732
|
#mergeOptions(target, source) {
|
|
741
|
-
|
|
733
|
+
const merged = { ...target, ...source };
|
|
734
|
+
if (typeof merged.collapsible !== "boolean") {
|
|
735
|
+
const collapsible = this.#defaults.collapsible;
|
|
736
|
+
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
737
|
+
merged.collapsible = collapsible;
|
|
738
|
+
}
|
|
739
|
+
return merged;
|
|
742
740
|
}
|
|
743
741
|
};
|
|
744
742
|
/**
|
|
@@ -746,7 +744,7 @@ var Disclosure = class _Disclosure {
|
|
|
746
744
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
747
745
|
* Using the <details> and <summary> element.
|
|
748
746
|
*
|
|
749
|
-
* @version 2.0.
|
|
747
|
+
* @version 2.0.8
|
|
750
748
|
* @author Yusuke Kamiyamane
|
|
751
749
|
* @license MIT
|
|
752
750
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -754,15 +752,15 @@ var Disclosure = class _Disclosure {
|
|
|
754
752
|
*/
|
|
755
753
|
/*! Bundled license information:
|
|
756
754
|
|
|
757
|
-
@y14e/attribute-
|
|
755
|
+
@y14e/attribute-utils/dist/index.js:
|
|
758
756
|
(**
|
|
759
|
-
* Attribute
|
|
757
|
+
* Attribute Utils
|
|
760
758
|
*
|
|
761
|
-
* @version 2.0.
|
|
759
|
+
* @version 2.0.5
|
|
762
760
|
* @author Yusuke Kamiyamane
|
|
763
761
|
* @license MIT
|
|
764
762
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
765
|
-
* @see {@link https://github.com/y14e/attribute-
|
|
763
|
+
* @see {@link https://github.com/y14e/attribute-utils}
|
|
766
764
|
*)
|
|
767
765
|
|
|
768
766
|
power-focusable/dist/index.js:
|
|
@@ -771,7 +769,7 @@ power-focusable/dist/index.js:
|
|
|
771
769
|
* High-precision focus management utility with full composed tree support.
|
|
772
770
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
773
771
|
*
|
|
774
|
-
* @version 4.3.
|
|
772
|
+
* @version 4.3.28
|
|
775
773
|
* @author Yusuke Kamiyamane
|
|
776
774
|
* @license MIT
|
|
777
775
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -784,7 +782,7 @@ power-focusable/dist/index.js:
|
|
|
784
782
|
* Lightweight roving tabindex utility with fully focus management.
|
|
785
783
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
786
784
|
*
|
|
787
|
-
* @version 3.1.
|
|
785
|
+
* @version 3.1.25
|
|
788
786
|
* @author Yusuke Kamiyamane
|
|
789
787
|
* @license MIT
|
|
790
788
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var utils = require('@y14e/attribute-utils');
|
|
4
4
|
var rovingTabindex = require('@y14e/roving-tabindex');
|
|
5
5
|
|
|
6
6
|
function _interopNamespace(e) {
|
|
@@ -21,7 +21,7 @@ function _interopNamespace(e) {
|
|
|
21
21
|
return Object.freeze(n);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var utils__namespace = /*#__PURE__*/_interopNamespace(utils);
|
|
25
25
|
|
|
26
26
|
// src/index.ts
|
|
27
27
|
var Disclosure = class _Disclosure {
|
|
@@ -108,7 +108,7 @@ var Disclosure = class _Disclosure {
|
|
|
108
108
|
this.#cleanupRovingTabIndex?.();
|
|
109
109
|
this.#cleanupRovingTabIndex = null;
|
|
110
110
|
this.#detailsElements.length = 0;
|
|
111
|
-
|
|
111
|
+
utils__namespace.restoreAttributes(this.#summaryElements);
|
|
112
112
|
this.#summaryElements.length = 0;
|
|
113
113
|
this.#contentElements.length = 0;
|
|
114
114
|
this.#rootElement.removeAttribute("data-disclosure-initialized");
|
|
@@ -124,7 +124,7 @@ var Disclosure = class _Disclosure {
|
|
|
124
124
|
this.#toggle(details, true);
|
|
125
125
|
}
|
|
126
126
|
#initialize() {
|
|
127
|
-
|
|
127
|
+
utils__namespace.saveAttributes(this.#summaryElements, [
|
|
128
128
|
"aria-disabled",
|
|
129
129
|
"style",
|
|
130
130
|
"tabindex"
|
|
@@ -176,7 +176,13 @@ var Disclosure = class _Disclosure {
|
|
|
176
176
|
return element.tabIndex >= 0;
|
|
177
177
|
}
|
|
178
178
|
#mergeOptions(target, source) {
|
|
179
|
-
|
|
179
|
+
const merged = { ...target, ...source };
|
|
180
|
+
if (typeof merged.collapsible !== "boolean") {
|
|
181
|
+
const collapsible = this.#defaults.collapsible;
|
|
182
|
+
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
183
|
+
merged.collapsible = collapsible;
|
|
184
|
+
}
|
|
185
|
+
return merged;
|
|
180
186
|
}
|
|
181
187
|
};
|
|
182
188
|
/**
|
|
@@ -184,7 +190,7 @@ var Disclosure = class _Disclosure {
|
|
|
184
190
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
185
191
|
* Using the <details> and <summary> element.
|
|
186
192
|
*
|
|
187
|
-
* @version 2.0.
|
|
193
|
+
* @version 2.0.8
|
|
188
194
|
* @author Yusuke Kamiyamane
|
|
189
195
|
* @license MIT
|
|
190
196
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as utils from '@y14e/attribute-utils';
|
|
2
2
|
import { createRovingTabIndex } from '@y14e/roving-tabindex';
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
@@ -86,7 +86,7 @@ var Disclosure = class _Disclosure {
|
|
|
86
86
|
this.#cleanupRovingTabIndex?.();
|
|
87
87
|
this.#cleanupRovingTabIndex = null;
|
|
88
88
|
this.#detailsElements.length = 0;
|
|
89
|
-
|
|
89
|
+
utils.restoreAttributes(this.#summaryElements);
|
|
90
90
|
this.#summaryElements.length = 0;
|
|
91
91
|
this.#contentElements.length = 0;
|
|
92
92
|
this.#rootElement.removeAttribute("data-disclosure-initialized");
|
|
@@ -102,7 +102,7 @@ var Disclosure = class _Disclosure {
|
|
|
102
102
|
this.#toggle(details, true);
|
|
103
103
|
}
|
|
104
104
|
#initialize() {
|
|
105
|
-
|
|
105
|
+
utils.saveAttributes(this.#summaryElements, [
|
|
106
106
|
"aria-disabled",
|
|
107
107
|
"style",
|
|
108
108
|
"tabindex"
|
|
@@ -154,7 +154,13 @@ var Disclosure = class _Disclosure {
|
|
|
154
154
|
return element.tabIndex >= 0;
|
|
155
155
|
}
|
|
156
156
|
#mergeOptions(target, source) {
|
|
157
|
-
|
|
157
|
+
const merged = { ...target, ...source };
|
|
158
|
+
if (typeof merged.collapsible !== "boolean") {
|
|
159
|
+
const collapsible = this.#defaults.collapsible;
|
|
160
|
+
console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
|
|
161
|
+
merged.collapsible = collapsible;
|
|
162
|
+
}
|
|
163
|
+
return merged;
|
|
158
164
|
}
|
|
159
165
|
};
|
|
160
166
|
/**
|
|
@@ -162,7 +168,7 @@ var Disclosure = class _Disclosure {
|
|
|
162
168
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
163
169
|
* Using the <details> and <summary> element.
|
|
164
170
|
*
|
|
165
|
-
* @version 2.0.
|
|
171
|
+
* @version 2.0.8
|
|
166
172
|
* @author Yusuke Kamiyamane
|
|
167
173
|
* @license MIT
|
|
168
174
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/disclosure-css",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
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-
|
|
58
|
-
"@y14e/roving-tabindex": "^3.1.
|
|
57
|
+
"@y14e/attribute-utils": "^2.0.5",
|
|
58
|
+
"@y14e/roving-tabindex": "^3.1.25"
|
|
59
59
|
}
|
|
60
60
|
}
|