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