@y14e/disclosure 2.1.4 → 2.2.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.
@@ -91,81 +91,105 @@ function resolveOptions(options) {
91
91
  }
92
92
 
93
93
  // node_modules/power-focusable/dist/index.js
94
+ function getComposedChildren(node) {
95
+ if (node instanceof ShadowRoot) {
96
+ return [...node.children];
97
+ }
98
+ if (!(node instanceof Element)) {
99
+ return [];
100
+ }
101
+ if (node instanceof HTMLSlotElement) {
102
+ const assigned = node.assignedElements({ flatten: true });
103
+ if (assigned.length) {
104
+ return assigned;
105
+ }
106
+ }
107
+ if (node instanceof HTMLElement && node.shadowRoot?.mode === "open") {
108
+ return [...node.shadowRoot.children];
109
+ }
110
+ return [...node.children];
111
+ }
94
112
  var FOCUSABLE_SELECTOR = ':is(a[href], area[href], button, embed, iframe, input:not([type="hidden" i]), object, select, details > summary:first-of-type, textarea, [contenteditable]:not([contenteditable="false" i]), [controls], [tabindex]):not(:disabled, [hidden], [inert], [tabindex="-1"])';
95
- var FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX = FOCUSABLE_SELECTOR.replace(
96
- /(,\s*)?\[tabindex="-1"\]/g,
97
- ""
98
- );
99
- function getFocusables(container = document.body, options = {}) {
100
- if (!(container instanceof Element)) {
101
- console.warn("Invalid container element. Fallback: <body> element.");
102
- container = document.body;
113
+ var FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX = FOCUSABLE_SELECTOR.replace(/(,\s*)?\[tabindex="-1"\]/g, "");
114
+ function focusElement(element) {
115
+ "focus" in element && typeof element.focus === "function" && element.focus();
116
+ }
117
+ function getActiveElement() {
118
+ let current = document.activeElement;
119
+ while (current?.shadowRoot?.activeElement) {
120
+ current = current.shadowRoot.activeElement;
103
121
  }
104
- const {
105
- composed,
122
+ return current;
123
+ }
124
+ function getTabIndex(element) {
125
+ return "tabIndex" in element ? Number(element.tabIndex) : 0;
126
+ }
127
+ function isDisabled(element) {
128
+ return "disabled" in element && !!element.disabled;
129
+ }
130
+ function isFormControl(element) {
131
+ return ["BUTTON", "INPUT", "SELECT", "TEXTAREA"].includes(element.tagName);
132
+ }
133
+ function isInert(element) {
134
+ return "inert" in element && !!element.inert;
135
+ }
136
+ function isUngroupedRadio(element) {
137
+ return element.type === "radio" && !!element.name;
138
+ }
139
+ function resolveOptions2(options) {
140
+ let {
141
+ anchor = getActiveElement(),
142
+ composed = false,
106
143
  filter,
107
144
  include,
108
- skipNegativeTabIndexCheck,
109
- skipVisibilityCheck
110
- } = resolveOptions2(options);
111
- const candidates = [];
112
- if (!composed && !include) {
113
- for (const match of container.querySelectorAll(
114
- !skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR : FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX
115
- )) {
116
- match && isFocusable(match, {
117
- skipNegativeTabIndexCheck,
118
- skipVisibilityCheck
119
- }) && candidates.push(match);
145
+ skipNegativeTabIndexCheck = false,
146
+ skipVisibilityCheck = false,
147
+ wrap = false
148
+ } = options;
149
+ if (!(anchor instanceof Element)) {
150
+ const active = getActiveElement();
151
+ if (active instanceof Element) {
152
+ console.warn("Invalid anchor element. Fallback: active element.");
153
+ anchor = active;
120
154
  }
121
- } else {
122
- let traverse2 = function(node) {
123
- if (isFocusable(node, {
124
- skipNegativeTabIndexCheck,
125
- skipVisibilityCheck
126
- }) || include?.(node)) {
127
- candidates.push(node);
128
- }
129
- (!composed ? [...node.children] : getComposedChildren(node)).map(
130
- traverse2
131
- );
132
- };
133
- (!composed ? [...container.children] : getComposedChildren(container)).map(
134
- traverse2
135
- );
136
155
  }
137
- return normalizeRadioGroup(
138
- sortByTabIndex(!filter ? candidates : candidates.filter(filter))
139
- );
140
- }
141
- function isFocusable(element, options = {}) {
142
- if (!(element instanceof Element)) {
143
- console.warn("Invalid element");
144
- return false;
156
+ if (typeof composed !== "boolean") {
157
+ console.warn("Invalid composed option. Fallback: false.");
158
+ composed = false;
145
159
  }
146
- const { skipNegativeTabIndexCheck, skipVisibilityCheck } = resolveOptions2(options);
147
- if (element.hasAttribute("hidden") || isInert(element)) {
148
- return false;
160
+ if (filter !== void 0 && typeof filter !== "function") {
161
+ console.warn(
162
+ "Invalid filter function. Fallback: no filter function (undefined)."
163
+ );
164
+ filter = void 0;
149
165
  }
150
- if (!skipNegativeTabIndexCheck && getTabIndex(element) < 0) {
151
- return false;
166
+ if (include !== void 0 && typeof include !== "function") {
167
+ console.warn(
168
+ "Invalid include function. Fallback: no include function (undefined)."
169
+ );
170
+ include = void 0;
152
171
  }
153
- if (!element.matches(
154
- !skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR : FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX
155
- )) {
156
- return false;
172
+ if (typeof skipNegativeTabIndexCheck !== "boolean") {
173
+ console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
174
+ skipNegativeTabIndexCheck = false;
157
175
  }
158
- if (isDisabledDeep(element)) {
159
- return false;
176
+ if (typeof skipVisibilityCheck !== "boolean") {
177
+ console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
178
+ skipVisibilityCheck = false;
160
179
  }
161
- if (!skipVisibilityCheck && !element.checkVisibility({
162
- contentVisibilityAuto: true,
163
- opacityProperty: true,
164
- visibilityProperty: true
165
- })) {
166
- return false;
180
+ if (typeof wrap !== "boolean") {
181
+ console.warn("Invalid wrap option. Fallback: false.");
182
+ wrap = false;
167
183
  }
168
- return true;
184
+ return {
185
+ anchor,
186
+ composed,
187
+ filter,
188
+ include,
189
+ skipNegativeTabIndexCheck,
190
+ skipVisibilityCheck,
191
+ wrap
192
+ };
169
193
  }
170
194
  function isDisabledDeep(element) {
171
195
  let current = element;
@@ -247,107 +271,193 @@ function sortByTabIndex(elements) {
247
271
  }
248
272
  return ordered.sort((a, b) => getTabIndex(a) - getTabIndex(b)).concat(natural);
249
273
  }
250
- function getComposedChildren(node) {
251
- if (node instanceof ShadowRoot) {
252
- return [...node.children];
253
- }
254
- if (!(node instanceof Element)) {
255
- return [];
274
+ function getFocusables(container = document.body, options = {}) {
275
+ if (!(container instanceof Element)) {
276
+ console.warn("Invalid container element. Fallback: <body> element.");
277
+ container = document.body;
256
278
  }
257
- if (node instanceof HTMLSlotElement) {
258
- const assigned = node.assignedElements({ flatten: true });
259
- if (assigned.length) {
260
- return assigned;
279
+ const {
280
+ composed,
281
+ filter,
282
+ include,
283
+ skipNegativeTabIndexCheck,
284
+ skipVisibilityCheck
285
+ } = resolveOptions2(options);
286
+ const candidates = [];
287
+ if (!composed && !include) {
288
+ for (const match of container.querySelectorAll(
289
+ !skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR : FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX
290
+ )) {
291
+ match && isFocusable(match, {
292
+ skipNegativeTabIndexCheck,
293
+ skipVisibilityCheck
294
+ }) && candidates.push(match);
261
295
  }
296
+ } else {
297
+ let traverse2 = function(node) {
298
+ if (isFocusable(node, {
299
+ skipNegativeTabIndexCheck,
300
+ skipVisibilityCheck
301
+ }) || include?.(node)) {
302
+ candidates.push(node);
303
+ }
304
+ (!composed ? [...node.children] : getComposedChildren(node)).map(
305
+ traverse2
306
+ );
307
+ };
308
+ (!composed ? [...container.children] : getComposedChildren(container)).map(
309
+ traverse2
310
+ );
262
311
  }
263
- if (node instanceof HTMLElement && node.shadowRoot?.mode === "open") {
264
- return [...node.shadowRoot.children];
265
- }
266
- return [...node.children];
267
- }
268
- function focusElement(element) {
269
- "focus" in element && typeof element.focus === "function" && element.focus();
312
+ return normalizeRadioGroup(
313
+ sortByTabIndex(!filter ? candidates : candidates.filter(filter))
314
+ );
270
315
  }
271
- function getActiveElement() {
272
- let current = document.activeElement;
273
- while (current?.shadowRoot?.activeElement) {
274
- current = current.shadowRoot.activeElement;
316
+ function isFocusable(element, options = {}) {
317
+ if (!(element instanceof Element)) {
318
+ console.warn("Invalid element");
319
+ return false;
275
320
  }
276
- return current;
277
- }
278
- function getTabIndex(element) {
279
- return "tabIndex" in element ? Number(element.tabIndex) : 0;
280
- }
281
- function isDisabled(element) {
282
- return "disabled" in element && !!element.disabled;
321
+ const { skipNegativeTabIndexCheck, skipVisibilityCheck } = resolveOptions2(options);
322
+ if (element.hasAttribute("hidden") || isInert(element)) {
323
+ return false;
324
+ }
325
+ if (!skipNegativeTabIndexCheck && getTabIndex(element) < 0) {
326
+ return false;
327
+ }
328
+ if (!element.matches(
329
+ !skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR : FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX
330
+ )) {
331
+ return false;
332
+ }
333
+ if (isDisabledDeep(element)) {
334
+ return false;
335
+ }
336
+ if (!skipVisibilityCheck && !element.checkVisibility({
337
+ contentVisibilityAuto: true,
338
+ opacityProperty: true,
339
+ visibilityProperty: true
340
+ })) {
341
+ return false;
342
+ }
343
+ return true;
283
344
  }
284
- function isFormControl(element) {
285
- return ["BUTTON", "INPUT", "SELECT", "TEXTAREA"].includes(element.tagName);
345
+
346
+ // node_modules/@y14e/roving-tabindex/dist/index.js
347
+ function getCellCoords(cell) {
348
+ const { left, top, width, height } = cell.getBoundingClientRect();
349
+ return { x: left + width / 2, y: top + height / 2 };
286
350
  }
287
- function isInert(element) {
288
- return "inert" in element && !!element.inert;
351
+ function getCellsOfActiveRow(cells) {
352
+ const active = getActiveElement();
353
+ if (!(active instanceof Element)) {
354
+ return [];
355
+ }
356
+ const activeRect = active.getBoundingClientRect();
357
+ return cells.filter((cell) => {
358
+ const cellRect = cell.getBoundingClientRect();
359
+ return cellRect.top < activeRect.bottom && cellRect.bottom > activeRect.top;
360
+ });
289
361
  }
290
- function isUngroupedRadio(element) {
291
- return element.type === "radio" && !!element.name;
362
+ function getNextCell(cells, key, wrap) {
363
+ const active = getActiveElement();
364
+ if (!(active instanceof Element)) {
365
+ return null;
366
+ }
367
+ const activeCoords = getCellCoords(active);
368
+ let min = Infinity;
369
+ let result = null;
370
+ for (const cell of cells) {
371
+ if (cell === active) {
372
+ continue;
373
+ }
374
+ const cellCoords = getCellCoords(cell);
375
+ const distances = {
376
+ x: Math.abs(cellCoords.x - activeCoords.x),
377
+ y: Math.abs(cellCoords.y - activeCoords.y)
378
+ };
379
+ if (key === "ArrowUp" && cellCoords.y < activeCoords.y && distances.x < distances.y || key === "ArrowDown" && cellCoords.y > activeCoords.y && distances.x < distances.y) {
380
+ const distance = distances.x ** 2 + distances.y ** 2;
381
+ if (distance < min) {
382
+ min = distance;
383
+ result = cell;
384
+ }
385
+ }
386
+ }
387
+ if (!result && wrap) {
388
+ let max = -Infinity;
389
+ for (const cell of cells) {
390
+ if (cell === active) {
391
+ continue;
392
+ }
393
+ const cellCoords = getCellCoords(cell);
394
+ if (Math.abs(cellCoords.x - activeCoords.x) < cell.getBoundingClientRect().width / 2) {
395
+ const distance = key === "ArrowUp" ? cellCoords.y - activeCoords.y : activeCoords.y - cellCoords.y;
396
+ if (distance > max) {
397
+ max = distance;
398
+ result = cell;
399
+ }
400
+ }
401
+ }
402
+ }
403
+ return result;
292
404
  }
293
- function resolveOptions2(options) {
405
+ var DIRECTIONS = ["both", "grid", "horizontal", "vertical"];
406
+ function resolveOptions3(options) {
294
407
  let {
295
- anchor = getActiveElement(),
296
- composed = false,
297
- filter,
298
- include,
299
- skipNegativeTabIndexCheck = false,
300
- skipVisibilityCheck = false,
408
+ direction = "both",
409
+ navigationOnly = false,
410
+ noMemory = false,
411
+ noStart = false,
412
+ selector = "",
413
+ typeahead = false,
301
414
  wrap = false
302
415
  } = options;
303
- if (!(anchor instanceof Element)) {
304
- const active = getActiveElement();
305
- if (active instanceof Element) {
306
- console.warn("Invalid anchor element. Fallback: active element.");
307
- anchor = active;
308
- }
416
+ if (typeof direction === "string") {
417
+ direction = direction.toLowerCase();
309
418
  }
310
- if (typeof composed !== "boolean") {
311
- console.warn("Invalid composed option. Fallback: false.");
312
- composed = false;
419
+ if (!DIRECTIONS.includes(direction)) {
420
+ console.warn("Invalid direction option. Fallback: 'both'.");
421
+ direction = "both";
313
422
  }
314
- if (filter !== void 0 && typeof filter !== "function") {
315
- console.warn(
316
- "Invalid filter function. Fallback: no filter function (undefined)."
317
- );
318
- filter = void 0;
423
+ if (typeof navigationOnly !== "boolean") {
424
+ console.warn("Invalid navigationOnly option. Fallback: false.");
425
+ navigationOnly = false;
319
426
  }
320
- if (include !== void 0 && typeof include !== "function") {
321
- console.warn(
322
- "Invalid include function. Fallback: no include function (undefined)."
323
- );
324
- include = void 0;
427
+ if (typeof noMemory !== "boolean") {
428
+ console.warn("Invalid noMemory option. Fallback: false.");
429
+ noMemory = false;
325
430
  }
326
- if (typeof skipNegativeTabIndexCheck !== "boolean") {
327
- console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
328
- skipNegativeTabIndexCheck = false;
431
+ if (typeof noStart !== "boolean") {
432
+ console.warn("Invalid noStart option. Fallback: false.");
433
+ noStart = false;
329
434
  }
330
- if (typeof skipVisibilityCheck !== "boolean") {
331
- console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
332
- skipVisibilityCheck = false;
435
+ if (selector !== "") {
436
+ try {
437
+ document.querySelector(selector);
438
+ } catch {
439
+ console.warn("Invalid selector. Fallback: no selector string.");
440
+ selector = "";
441
+ }
442
+ }
443
+ if (typeof typeahead !== "boolean") {
444
+ console.warn("Invalid typeahead option. Fallback: false.");
445
+ typeahead = false;
333
446
  }
334
447
  if (typeof wrap !== "boolean") {
335
448
  console.warn("Invalid wrap option. Fallback: false.");
336
449
  wrap = false;
337
450
  }
338
451
  return {
339
- anchor,
340
- composed,
341
- filter,
342
- include,
343
- skipNegativeTabIndexCheck,
344
- skipVisibilityCheck,
452
+ direction,
453
+ navigationOnly,
454
+ noMemory,
455
+ noStart,
456
+ selector,
457
+ typeahead,
345
458
  wrap
346
459
  };
347
460
  }
348
-
349
- // node_modules/@y14e/roving-tabindex/dist/index.js
350
- var DIRECTIONS = ["both", "grid", "horizontal", "vertical"];
351
461
  function createRovingTabIndex(container, options = {}) {
352
462
  if (!(container instanceof Element)) {
353
463
  console.warn("Invalid container element");
@@ -368,7 +478,7 @@ var RovingTabIndex = class _RovingTabIndex {
368
478
  #isDestroyed = false;
369
479
  constructor(container, options = {}) {
370
480
  this.#container = container;
371
- this.#settings = this.#resolveOptions(options);
481
+ this.#settings = resolveOptions3(options);
372
482
  this.#selectorFilter = this.#createSelectorFilter();
373
483
  this.#initialize();
374
484
  }
@@ -549,20 +659,8 @@ var RovingTabIndex = class _RovingTabIndex {
549
659
  const { selector } = this.#settings;
550
660
  return (element) => !selector || [...this.#container.querySelectorAll(selector)].includes(element);
551
661
  }
552
- #getCellCoords(cell) {
553
- const { left, top, width, height } = cell.getBoundingClientRect();
554
- return { x: left + width / 2, y: top + height / 2 };
555
- }
556
662
  #getCellsOfActiveRow() {
557
- const active = getActiveElement();
558
- if (!(active instanceof Element)) {
559
- return [];
560
- }
561
- const activeRect = active.getBoundingClientRect();
562
- return this.#getFocusables().filter((cell) => {
563
- const cellRect = cell.getBoundingClientRect();
564
- return cellRect.top < activeRect.bottom && cellRect.bottom > activeRect.top;
565
- });
663
+ return getCellsOfActiveRow(this.#getFocusables());
566
664
  }
567
665
  #getFocusables() {
568
666
  return getFocusables(this.#container, {
@@ -573,117 +671,55 @@ var RovingTabIndex = class _RovingTabIndex {
573
671
  });
574
672
  }
575
673
  #getNextCell(key, wrap) {
576
- const cells = this.#getFocusables();
577
- const active = getActiveElement();
578
- if (!(active instanceof Element)) {
579
- return null;
580
- }
581
- const activeCoords = this.#getCellCoords(active);
582
- let min = Infinity;
583
- let result = null;
584
- for (const cell of cells) {
585
- if (cell === active) {
586
- continue;
587
- }
588
- const cellCoords = this.#getCellCoords(cell);
589
- const distances = {
590
- x: Math.abs(cellCoords.x - activeCoords.x),
591
- y: Math.abs(cellCoords.y - activeCoords.y)
592
- };
593
- if (key === "ArrowUp" && cellCoords.y < activeCoords.y && distances.x < distances.y || key === "ArrowDown" && cellCoords.y > activeCoords.y && distances.x < distances.y) {
594
- const distance = distances.x ** 2 + distances.y ** 2;
595
- if (distance < min) {
596
- min = distance;
597
- result = cell;
598
- }
599
- }
600
- }
601
- if (!result && wrap) {
602
- let max = -Infinity;
603
- for (const cell of cells) {
604
- if (cell === active) {
605
- continue;
606
- }
607
- const cellCoords = this.#getCellCoords(cell);
608
- if (Math.abs(cellCoords.x - activeCoords.x) < cell.getBoundingClientRect().width / 2) {
609
- const distance = key === "ArrowUp" ? cellCoords.y - activeCoords.y : activeCoords.y - cellCoords.y;
610
- if (distance > max) {
611
- max = distance;
612
- result = cell;
613
- }
614
- }
615
- }
616
- }
617
- return result;
618
- }
619
- #resolveOptions(options) {
620
- let {
621
- direction = "both",
622
- navigationOnly = false,
623
- noMemory = false,
624
- noStart = false,
625
- selector = "",
626
- typeahead = false,
627
- wrap = false
628
- } = options;
629
- if (typeof direction === "string") {
630
- direction = direction.toLowerCase();
631
- }
632
- if (!DIRECTIONS.includes(direction)) {
633
- console.warn("Invalid direction option. Fallback: 'both'.");
634
- direction = "both";
635
- }
636
- if (typeof navigationOnly !== "boolean") {
637
- console.warn("Invalid navigationOnly option. Fallback: false.");
638
- navigationOnly = false;
639
- }
640
- if (typeof noMemory !== "boolean") {
641
- console.warn("Invalid noMemory option. Fallback: false.");
642
- noMemory = false;
643
- }
644
- if (typeof noStart !== "boolean") {
645
- console.warn("Invalid noStart option. Fallback: false.");
646
- noStart = false;
647
- }
648
- if (selector !== "") {
649
- try {
650
- document.querySelector(selector);
651
- } catch {
652
- console.warn("Invalid selector. Fallback: no selector string.");
653
- selector = "";
654
- }
655
- }
656
- if (typeof typeahead !== "boolean") {
657
- console.warn("Invalid typeahead option. Fallback: false.");
658
- typeahead = false;
659
- }
660
- if (typeof wrap !== "boolean") {
661
- console.warn("Invalid wrap option. Fallback: false.");
662
- wrap = false;
663
- }
664
- return {
665
- direction,
666
- navigationOnly,
667
- noMemory,
668
- noStart,
669
- selector,
670
- typeahead,
671
- wrap
672
- };
674
+ return getNextCell(this.#getFocusables(), key, wrap);
673
675
  }
674
676
  };
675
677
 
678
+ // src/defaults.ts
679
+ var defaults = {
680
+ animation: {
681
+ duration: 300,
682
+ easing: "ease"
683
+ },
684
+ collapsible: true
685
+ };
686
+
687
+ // src/options.ts
688
+ function resolveOptions4(defaults2, source) {
689
+ const merged = {
690
+ ...defaults2,
691
+ ...source,
692
+ animation: { ...defaults2.animation, ...source.animation ?? {} }
693
+ };
694
+ const mergedAnimation = merged.animation;
695
+ const duration = mergedAnimation.duration;
696
+ const defaultAnimation = defaults2.animation;
697
+ if (typeof duration !== "number" || Number.isNaN(duration)) {
698
+ const duration2 = defaultAnimation.duration;
699
+ console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
700
+ mergedAnimation.duration = duration2;
701
+ }
702
+ if (duration < 0) {
703
+ console.warn("Invalid animation duration. Fallback: 0 (ms).");
704
+ mergedAnimation.duration = 0;
705
+ }
706
+ if (!CSS.supports("animation-timing-function", mergedAnimation.easing)) {
707
+ const easing = defaultAnimation.easing;
708
+ console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
709
+ mergedAnimation.easing = easing;
710
+ }
711
+ if (typeof merged.collapsible !== "boolean") {
712
+ const collapsible = defaults2.collapsible;
713
+ console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
714
+ merged.collapsible = collapsible;
715
+ }
716
+ return merged;
717
+ }
718
+
676
719
  // src/index.ts
677
720
  var Disclosure = class _Disclosure {
678
721
  static defaults = {};
679
722
  #rootElement;
680
- #defaults = {
681
- animation: {
682
- duration: 300,
683
- easing: "ease"
684
- },
685
- collapsible: true
686
- };
687
723
  #settings;
688
724
  #detailsElements;
689
725
  #summaryElements;
@@ -703,8 +739,10 @@ var Disclosure = class _Disclosure {
703
739
  return;
704
740
  }
705
741
  this.#rootElement = root;
706
- this.#defaults = this.#resolveOptions(this.#defaults, _Disclosure.defaults);
707
- this.#settings = this.#resolveOptions(this.#defaults, options);
742
+ this.#settings = resolveOptions4(
743
+ resolveOptions4(defaults, _Disclosure.defaults),
744
+ options
745
+ );
708
746
  matchMedia("(prefers-reduced-motion: reduce)").matches && Object.assign(this.#settings.animation, { duration: 0 });
709
747
  const NOT_NESTED = ":not(:scope summary + * *)";
710
748
  this.#detailsElements = [
@@ -927,37 +965,6 @@ var Disclosure = class _Disclosure {
927
965
  #isFocusable(element) {
928
966
  return element.tabIndex >= 0;
929
967
  }
930
- #resolveOptions(target, source) {
931
- const merged = {
932
- ...target,
933
- ...source,
934
- animation: { ...target.animation, ...source.animation ?? {} }
935
- };
936
- const mergedAnimation = merged.animation;
937
- const duration = mergedAnimation.duration;
938
- const defaults = this.#defaults;
939
- const defaultAnimation = defaults.animation;
940
- if (typeof duration !== "number" || Number.isNaN(duration)) {
941
- const duration2 = defaultAnimation.duration;
942
- console.warn(`Invalid animation duration. Fallback: ${duration2} (ms).`);
943
- mergedAnimation.duration = duration2;
944
- }
945
- if (duration < 0) {
946
- console.warn("Invalid animation duration. Fallback: 0 (ms).");
947
- mergedAnimation.duration = 0;
948
- }
949
- if (!CSS.supports("animation-timing-function", mergedAnimation.easing)) {
950
- const easing = defaultAnimation.easing;
951
- console.warn(`Invalid animation easing. Fallback: '${easing}'.`);
952
- mergedAnimation.easing = easing;
953
- }
954
- if (typeof merged.collapsible !== "boolean") {
955
- const collapsible = defaults.collapsible;
956
- console.warn(`Invalid collapsible option. Fallback: ${collapsible}.`);
957
- merged.collapsible = collapsible;
958
- }
959
- return merged;
960
- }
961
968
  async #waitAnimationsFinish() {
962
969
  const promises = [];
963
970
  for (const content of this.#contentElements) {