@oscarpalmer/toretto 0.26.1 → 0.28.0

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.
@@ -12,12 +12,10 @@ function getSupport() {
12
12
  if ('ontouchstart' in window) {
13
13
  return true;
14
14
  }
15
- if (typeof navigator.maxTouchPoints === 'number' &&
16
- navigator.maxTouchPoints > 0) {
15
+ if (typeof navigator.maxTouchPoints === 'number' && navigator.maxTouchPoints > 0) {
17
16
  return true;
18
17
  }
19
- if (typeof navigator.msMaxTouchPoints ===
20
- 'number' &&
18
+ if (typeof navigator.msMaxTouchPoints === 'number' &&
21
19
  navigator.msMaxTouchPoints > 0) {
22
20
  return true;
23
21
  }
@@ -67,6 +65,7 @@ function compact(array, strict) {
67
65
  function getString(value) {
68
66
  if (typeof value === "string") return value;
69
67
  if (value == null) return "";
68
+ if (typeof value === "function") return getString(value());
70
69
  if (typeof value !== "object") return String(value);
71
70
  const asString = String(value.valueOf?.() ?? value);
72
71
  return asString.startsWith("[object ") ? JSON.stringify(value) : asString;
@@ -84,6 +83,70 @@ function isNullableOrWhitespace(value) {
84
83
  }
85
84
  var EXPRESSION_WHITESPACE = /^\s*$/;
86
85
 
86
+ function camelCase(value) {
87
+ return toCase(value, "", true);
88
+ }
89
+ function capitalize(value) {
90
+ if (typeof value !== "string" || value.length === 0) return "";
91
+ return value.length === 1 ? value.toLocaleUpperCase() : `${value.charAt(0).toLocaleUpperCase()}${value.slice(1).toLocaleLowerCase()}`;
92
+ }
93
+ function kebabCase(value) {
94
+ return toCase(value, "-", false);
95
+ }
96
+ function toCase(value, delimiter, capitalizeAny, capitalizeFirst) {
97
+ if (typeof value !== "string") return "";
98
+ if (value.length < 1) return value;
99
+ const parts = words(value);
100
+ const partsLength = parts.length;
101
+ const result = [];
102
+ for (let partIndex = 0; partIndex < partsLength; partIndex += 1) {
103
+ const items = parts[partIndex].replace(EXPRESSION_ACRONYM, (full, one, two, three) => three === "s" ? full : `${one}-${two}${three}`).replace(EXPRESSION_CAMEL_CASE, "$1-$2").split("-");
104
+ const itemsLength = items.length;
105
+ const partResult = [];
106
+ let itemCount = 0;
107
+ for (let itemIndex = 0; itemIndex < itemsLength; itemIndex += 1) {
108
+ const item = items[itemIndex];
109
+ if (item.length === 0) continue;
110
+ if (!capitalizeAny || itemCount === 0 && partIndex === 0 && true) partResult.push(item.toLocaleLowerCase());
111
+ else partResult.push(capitalize(item));
112
+ itemCount += 1;
113
+ }
114
+ result.push(join(partResult, delimiter));
115
+ }
116
+ return join(result, delimiter);
117
+ }
118
+ var EXPRESSION_CAMEL_CASE = /(\p{Ll})(\p{Lu})/gu;
119
+ var EXPRESSION_ACRONYM = /(\p{Lu}*)(\p{Lu})(\p{Ll}+)/gu;
120
+
121
+ function parse(value, reviver) {
122
+ try {
123
+ return JSON.parse(value, reviver);
124
+ } catch {
125
+ return;
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Is the value an event target?
131
+ * @param value Value to check
132
+ * @returns `true` if it's an event target, otherwise `false`
133
+ */
134
+ function isEventTarget(value) {
135
+ return (typeof value === 'object' &&
136
+ value != null &&
137
+ typeof value.addEventListener === 'function' &&
138
+ typeof value.removeEventListener === 'function' &&
139
+ typeof value.dispatchEvent === 'function');
140
+ }
141
+ /**
142
+ * Is the value an HTML or SVG element?
143
+ * @param value Value to check
144
+ * @returns `true` if it's an HTML or SVG element, otherwise `false`
145
+ */
146
+ function isHTMLOrSVGElement(value) {
147
+ return value instanceof HTMLElement || value instanceof SVGElement;
148
+ }
149
+
87
150
  function isAttribute(value) {
88
151
  return (value instanceof Attr ||
89
152
  (isPlainObject(value) &&
@@ -97,8 +160,7 @@ function isBadAttribute(first, second) {
97
160
  EXPRESSION_VALUE_PREFIX.test(String(attribute.value))), first, second);
98
161
  }
99
162
  function isBooleanAttribute(value) {
100
- return isValidAttribute(attribute => attribute != null &&
101
- booleanAttributes.includes(attribute.name.toLowerCase()), value, '');
163
+ return isValidAttribute(attribute => attribute != null && booleanAttributes.includes(attribute.name.toLowerCase()), value, '');
102
164
  }
103
165
  function isEmptyNonBooleanAttribute(first, second) {
104
166
  return isValidAttribute(attribute => attribute != null &&
@@ -117,6 +179,9 @@ function isInvalidBooleanAttribute(first, second) {
117
179
  return !(normalized.length === 0 || normalized === attribute.name);
118
180
  }, first, second);
119
181
  }
182
+ function isProperty(value) {
183
+ return isPlainObject(value) && typeof value.name === 'string';
184
+ }
120
185
  function isValidAttribute(callback, first, second) {
121
186
  let attribute;
122
187
  if (isAttribute(first)) {
@@ -127,6 +192,51 @@ function isValidAttribute(callback, first, second) {
127
192
  }
128
193
  return callback(attribute);
129
194
  }
195
+ function updateAttribute(element, name, value) {
196
+ const isBoolean = booleanAttributes.includes(name.toLowerCase());
197
+ if (isBoolean) {
198
+ updateProperty(element, name, value);
199
+ }
200
+ if (isBoolean ? value !== true : value == null) {
201
+ element.removeAttribute(name);
202
+ }
203
+ else {
204
+ element.setAttribute(name, isBoolean ? '' : getString(value));
205
+ }
206
+ }
207
+ function updateProperty(element, name, value) {
208
+ const actual = name.toLowerCase();
209
+ element[actual] =
210
+ value === '' || (typeof value === 'string' && value.toLowerCase() === actual) || value === true;
211
+ }
212
+ function updateValue(element, first, second) {
213
+ if (!isHTMLOrSVGElement(element)) {
214
+ return;
215
+ }
216
+ if (isProperty(first)) {
217
+ updateAttribute(element, first.name, first.value);
218
+ }
219
+ else if (typeof first === 'string') {
220
+ updateAttribute(element, first, second);
221
+ }
222
+ }
223
+ function updateValues(element, values) {
224
+ if (!isHTMLOrSVGElement(element)) {
225
+ return;
226
+ }
227
+ const isArray = Array.isArray(values);
228
+ const entries = Object.entries(values);
229
+ const { length } = entries;
230
+ for (let index = 0; index < length; index += 1) {
231
+ const entry = entries[index];
232
+ if (isArray) {
233
+ updateAttribute(element, entry[1].name, entry[1].value);
234
+ }
235
+ else {
236
+ updateAttribute(element, entry[0], entry[1]);
237
+ }
238
+ }
239
+ }
130
240
  //
131
241
  const EXPRESSION_ON_PREFIX = /^on/i;
132
242
  const EXPRESSION_SOURCE_PREFIX = /^(href|src|xlink:href)$/i;
@@ -161,49 +271,6 @@ const booleanAttributes = Object.freeze([
161
271
  'selected',
162
272
  ]);
163
273
 
164
- function camelCase(value) {
165
- return toCase(value, "", true);
166
- }
167
- function capitalize(value) {
168
- if (typeof value !== "string" || value.length === 0) return "";
169
- return value.length === 1 ? value.toLocaleUpperCase() : `${value.charAt(0).toLocaleUpperCase()}${value.slice(1).toLocaleLowerCase()}`;
170
- }
171
- function kebabCase(value) {
172
- return toCase(value, "-", false);
173
- }
174
- function toCase(value, delimiter, capitalizeAny, capitalizeFirst) {
175
- if (typeof value !== "string") return "";
176
- if (value.length < 1) return value;
177
- const parts = words(value);
178
- const partsLength = parts.length;
179
- const result = [];
180
- for (let partIndex = 0; partIndex < partsLength; partIndex += 1) {
181
- const items = parts[partIndex].replace(EXPRESSION_ACRONYM, (full, one, two, three) => three === "s" ? full : `${one}-${two}${three}`).replace(EXPRESSION_CAMEL_CASE, "$1-$2").split("-");
182
- const itemsLength = items.length;
183
- const partResult = [];
184
- let itemCount = 0;
185
- for (let itemIndex = 0; itemIndex < itemsLength; itemIndex += 1) {
186
- const item = items[itemIndex];
187
- if (item.length === 0) continue;
188
- if (!capitalizeAny || itemCount === 0 && partIndex === 0 && true) partResult.push(item.toLocaleLowerCase());
189
- else partResult.push(capitalize(item));
190
- itemCount += 1;
191
- }
192
- result.push(join(partResult, delimiter));
193
- }
194
- return join(result, delimiter);
195
- }
196
- var EXPRESSION_CAMEL_CASE = /(\p{Ll})(\p{Lu})/gu;
197
- var EXPRESSION_ACRONYM = /(\p{Lu}*)(\p{Lu})(\p{Ll}+)/gu;
198
-
199
- function parse(value, reviver) {
200
- try {
201
- return JSON.parse(value, reviver);
202
- } catch {
203
- return;
204
- }
205
- }
206
-
207
274
  function getBoolean(value, defaultValue) {
208
275
  return typeof value === 'boolean' ? value : (defaultValue ?? false);
209
276
  }
@@ -211,41 +278,16 @@ function getAttributeValue(element, name, parseValue) {
211
278
  const normalized = kebabCase(name);
212
279
  const attribute = element.attributes[normalized];
213
280
  const value = attribute instanceof Attr ? attribute.value : undefined;
214
- return EXPRESSION_DATA_PREFIX.test(normalized) &&
215
- typeof value === 'string' &&
216
- parseValue
281
+ return EXPRESSION_DATA_PREFIX.test(normalized) && typeof value === 'string' && parseValue
217
282
  ? (parse(value) ?? value)
218
283
  : value;
219
284
  }
220
285
  function getStyleValue(element, property, computed) {
221
286
  const name = camelCase(property);
222
- return computed
223
- ? getComputedStyle(element)[name]
224
- : element.style[name];
287
+ return computed ? getComputedStyle(element)[name] : element.style[name];
225
288
  }
226
289
  const EXPRESSION_DATA_PREFIX = /^data-/i;
227
290
 
228
- /**
229
- * Is the value an event target?
230
- * @param value Value to check
231
- * @returns `true` if it's an event target, otherwise `false`
232
- */
233
- function isEventTarget(value) {
234
- return (typeof value === 'object' &&
235
- value != null &&
236
- typeof value.addEventListener === 'function' &&
237
- typeof value.removeEventListener === 'function' &&
238
- typeof value.dispatchEvent === 'function');
239
- }
240
- /**
241
- * Is the value an HTML or SVG element?
242
- * @param value Value to check
243
- * @returns `true` if it's an HTML or SVG element, otherwise `false`
244
- */
245
- function isHTMLOrSVGElement(value) {
246
- return value instanceof HTMLElement || value instanceof SVGElement;
247
- }
248
-
249
291
  function getAttribute(element, name, parseValues) {
250
292
  if (isHTMLOrSVGElement(element) && typeof name === 'string') {
251
293
  return getAttributeValue(element, name, parseValues !== false);
@@ -274,73 +316,17 @@ function getAttributes(element, names, parseData) {
274
316
  return attributes;
275
317
  }
276
318
 
277
- function isProperty(value) {
278
- return (isPlainObject(value) && typeof value.name === 'string');
279
- }
280
-
281
- function updateAttribute(element, name, value) {
282
- if (booleanAttributes.includes(name.toLowerCase())) {
283
- updateProperty(element, name, value, false);
284
- }
285
- else if (value == null) {
286
- element.removeAttribute(name);
287
- }
288
- else {
289
- element.setAttribute(name, typeof value === 'string' ? value : getString(value));
290
- }
291
- }
292
- function updateProperty(element, name, value, validate) {
293
- const actual = (validate ?? true) ? name.toLowerCase() : name;
294
- if (actual === 'hidden') {
295
- element.hidden = value === '' || value === true;
296
- }
297
- else {
298
- element[actual] =
299
- value === '' ||
300
- (typeof value === 'string' && value.toLowerCase() === actual) ||
301
- value === true;
302
- }
303
- }
304
- function updateValue(element, first, second, callback) {
305
- if (!isHTMLOrSVGElement(element)) {
306
- return;
307
- }
308
- if (isProperty(first)) {
309
- callback(element, first.name, first.value);
310
- }
311
- else if (typeof first === 'string') {
312
- callback(element, first, second);
313
- }
314
- }
315
- function updateValues(element, values, callback) {
316
- if (!isHTMLOrSVGElement(element)) {
317
- return;
318
- }
319
- const isArray = Array.isArray(values);
320
- const entries = Object.entries(values);
321
- const { length } = entries;
322
- for (let index = 0; index < length; index += 1) {
323
- const entry = entries[index];
324
- if (isArray) {
325
- (callback ?? updateAttribute)(element, entry[1].name, entry[1].value);
326
- }
327
- else {
328
- (callback ?? updateAttribute)(element, entry[0], entry[1]);
329
- }
330
- }
331
- }
332
-
333
319
  function setAttribute(element, first, second) {
334
- updateValue(element, first, second, updateAttribute);
320
+ updateValue(element, first, second);
335
321
  }
336
322
  function setAttributes(element, attributes) {
337
323
  updateValues(element, attributes);
338
324
  }
339
325
  function setProperty(element, first, second) {
340
- updateValue(element, first, second, updateProperty);
326
+ updateValue(element, first, second);
341
327
  }
342
328
  function setProperties(element, properties) {
343
- updateValues(element, properties, updateProperty);
329
+ updateValues(element, properties);
344
330
  }
345
331
 
346
332
  /**
@@ -387,7 +373,6 @@ function setElementValues(element, first, second, callback) {
387
373
  callback(element, first, second);
388
374
  }
389
375
  }
390
- // biome-ignore lint/nursery/useMaxParams: Internal function, so it's fine
391
376
  function updateElementValue(element, key, value, set, remove, json) {
392
377
  if (isNullableOrWhitespace(value)) {
393
378
  remove.call(element, key);
@@ -455,12 +440,12 @@ calculate().then((value) => {
455
440
  });
456
441
 
457
442
  function addDelegatedHandler(document, type, name, passive) {
458
- const listeners = `${name}${LISTENERS_SUFFIX}`;
459
- if (document[listeners] != null) {
460
- document[listeners] += 1;
443
+ const count = `${name}${COUNT_SUFFIX}`;
444
+ if (document[count] != null) {
445
+ document[count] += 1;
461
446
  return;
462
447
  }
463
- document[listeners] = 1;
448
+ document[count] = 1;
464
449
  document.addEventListener(type, passive ? HANDLER_PASSIVE : HANDLER_ACTIVE, {
465
450
  passive,
466
451
  });
@@ -484,16 +469,17 @@ function delegatedEventHandler(event) {
484
469
  for (let index = 0; index < length; index += 1) {
485
470
  const item = items[index];
486
471
  const listeners = item[key];
487
- if (!item.disabled && listeners != null) {
488
- Object.defineProperty(event, 'currentTarget', {
489
- configurable: true,
490
- value: item,
491
- });
492
- for (const listener of listeners) {
493
- listener.call(item, event);
494
- if (event.cancelBubble) {
495
- return;
496
- }
472
+ if (item.disabled || listeners == null) {
473
+ continue;
474
+ }
475
+ Object.defineProperty(event, 'currentTarget', {
476
+ configurable: true,
477
+ value: item,
478
+ });
479
+ for (const listener of listeners) {
480
+ listener.call(item, event);
481
+ if (event.cancelBubble) {
482
+ return;
497
483
  }
498
484
  }
499
485
  }
@@ -508,10 +494,10 @@ function getDelegatedName(target, type, options) {
508
494
  }
509
495
  }
510
496
  function removeDelegatedHandler(document, type, name, passive) {
511
- const listeners = `${name}${LISTENERS_SUFFIX}`;
512
- document[listeners] -= 1;
513
- if (document[listeners] < 1) {
514
- document[listeners] = undefined;
497
+ const count = `${name}${COUNT_SUFFIX}`;
498
+ document[count] -= 1;
499
+ if (document[count] < 1) {
500
+ document[count] = undefined;
515
501
  document.removeEventListener(type, passive ? HANDLER_PASSIVE : HANDLER_ACTIVE);
516
502
  }
517
503
  }
@@ -521,13 +507,14 @@ function removeDelegatedListener(target, type, name, listener, passive) {
521
507
  return false;
522
508
  }
523
509
  handlers.delete(listener);
524
- if (handlers?.size === 0) {
510
+ if (handlers.size === 0) {
525
511
  target[name] = undefined;
526
512
  }
527
513
  removeDelegatedHandler(document, type, name, passive);
528
514
  return true;
529
515
  }
530
516
  //
517
+ const COUNT_SUFFIX = '.count';
531
518
  const EVENT_PREFIX = '@';
532
519
  const EVENT_SUFFIX_ACTIVE = ':active';
533
520
  const EVENT_SUFFIX_PASSIVE = ':passive';
@@ -557,7 +544,6 @@ const EVENT_TYPES = new Set([
557
544
  ]);
558
545
  const HANDLER_ACTIVE = delegatedEventHandler.bind(false);
559
546
  const HANDLER_PASSIVE = delegatedEventHandler.bind(true);
560
- const LISTENERS_SUFFIX = ':listeners';
561
547
 
562
548
  //
563
549
  function createDispatchOptions(options) {
@@ -616,9 +602,7 @@ function getPosition(event) {
616
602
  * @param options Options for event
617
603
  */
618
604
  function off(target, type, listener, options) {
619
- if (!isEventTarget(target) ||
620
- typeof type !== 'string' ||
621
- typeof listener !== 'function') {
605
+ if (!isEventTarget(target) || typeof type !== 'string' || typeof listener !== 'function') {
622
606
  return;
623
607
  }
624
608
  const extended = createEventOptions(options);
@@ -629,9 +613,7 @@ function off(target, type, listener, options) {
629
613
  }
630
614
  }
631
615
  function on(target, type, listener, options) {
632
- if (!isEventTarget(target) ||
633
- typeof type !== 'string' ||
634
- typeof listener !== 'function') {
616
+ if (!isEventTarget(target) || typeof type !== 'string' || typeof listener !== 'function') {
635
617
  return noop;
636
618
  }
637
619
  const extended = createEventOptions(options);
@@ -665,7 +647,7 @@ function getDistanceBetweenElements(origin, target) {
665
647
  }
666
648
  const beforeOrInside = !!(comparison & 2 || comparison & 8);
667
649
  if (beforeOrInside || !!(comparison & 4 || comparison & 16)) {
668
- return (traverse(beforeOrInside ? origin : target, beforeOrInside ? target : origin) ?? -1);
650
+ return traverse(beforeOrInside ? origin : target, beforeOrInside ? target : origin) ?? -1;
669
651
  }
670
652
  }
671
653
  /**
@@ -748,9 +730,7 @@ function findRelatives(origin, selector, context) {
748
730
  }
749
731
  return minimum == null
750
732
  ? []
751
- : distances
752
- .filter(found => found.distance === minimum)
753
- .map(found => found.element);
733
+ : distances.filter(found => found.distance === minimum).map(found => found.element);
754
734
  }
755
735
  function traverse(from, to) {
756
736
  let index = [...to.children].indexOf(from);
@@ -766,7 +746,7 @@ function traverse(from, to) {
766
746
  }
767
747
  const children = [...(parent.children ?? [])];
768
748
  if (children.includes(to)) {
769
- return (distance + Math.abs(children.indexOf(current) - children.indexOf(to)));
749
+ return distance + Math.abs(children.indexOf(current) - children.indexOf(to));
770
750
  }
771
751
  index = children.findIndex(child => child.contains(to));
772
752
  if (index > -1) {
@@ -820,9 +800,7 @@ function findElementOrElementsForSelector(selector, contexts, callback, single)
820
800
  }
821
801
  result.push(...Array.from(value));
822
802
  }
823
- return single
824
- ? null
825
- : result.filter((value, index, array) => array.indexOf(value) === index);
803
+ return single ? null : result.filter((value, index, array) => array.indexOf(value) === index);
826
804
  }
827
805
  function findElementOrElementsFromNodes(array, context, contexts) {
828
806
  const result = [];
@@ -920,8 +898,7 @@ function getTabbable(parent) {
920
898
  function getTabIndex(element) {
921
899
  const tabIndex = element?.tabIndex ?? TABINDEX_DEFAULT;
922
900
  if (tabIndex < TABINDEX_BASE &&
923
- (EXPRESSION_SPECIAL_TABINDEX.test(element.tagName) ||
924
- isEditable(element)) &&
901
+ (EXPRESSION_SPECIAL_TABINDEX.test(element.tagName) || isEditable(element)) &&
925
902
  !hasTabIndex(element)) {
926
903
  return TABINDEX_BASE;
927
904
  }
@@ -952,10 +929,7 @@ function getValidElements(parent, filters, tabbable) {
952
929
  zeroed.push(item.element);
953
930
  }
954
931
  else {
955
- indiced[item.tabIndex] = [
956
- ...(indiced[item.tabIndex] ?? []),
957
- item.element,
958
- ];
932
+ indiced[item.tabIndex] = [...(indiced[item.tabIndex] ?? []), item.element];
959
933
  }
960
934
  }
961
935
  return [...indiced.flat(), ...zeroed];
@@ -964,8 +938,7 @@ function hasTabIndex(element) {
964
938
  return !Number.isNaN(Number.parseInt(element.getAttribute(ATTRIBUTE_TABINDEX), 10));
965
939
  }
966
940
  function isDisabled(item) {
967
- if (EXPRESSION_DISABLEABLE.test(item.element.tagName) &&
968
- isDisabledFromFieldset(item.element)) {
941
+ if (EXPRESSION_DISABLEABLE.test(item.element.tagName) && isDisabledFromFieldset(item.element)) {
969
942
  return true;
970
943
  }
971
944
  return item.element.disabled ?? false;
@@ -979,8 +952,7 @@ function isDisabledFromFieldset(element) {
979
952
  for (let index = 0; index < length; index += 1) {
980
953
  const child = children[index];
981
954
  if (child instanceof HTMLLegendElement) {
982
- return (parent.matches(SELECTOR_FIELDSET_DISABLED) ||
983
- !child.contains(element));
955
+ return parent.matches(SELECTOR_FIELDSET_DISABLED) || !child.contains(element);
984
956
  }
985
957
  }
986
958
  return true;
@@ -998,20 +970,15 @@ function isEditable(element) {
998
970
  * @returns `true` if focusable, otherwise `false`
999
971
  */
1000
972
  function isFocusable(element) {
1001
- return element instanceof Element
1002
- ? isValidElement(element, FILTERS_FOCUSABLE, false)
1003
- : false;
973
+ return element instanceof Element ? isValidElement(element, FILTERS_FOCUSABLE, false) : false;
1004
974
  }
1005
975
  function isHidden(item) {
1006
976
  if ((item.element.hidden ?? false) ||
1007
- (item.element instanceof HTMLInputElement &&
1008
- item.element.type === STYLE_HIDDEN)) {
977
+ (item.element instanceof HTMLInputElement && item.element.type === STYLE_HIDDEN)) {
1009
978
  return true;
1010
979
  }
1011
980
  const isDirectSummary = item.element.matches(SELECTOR_SUMMARY_FIRST);
1012
- const nodeUnderDetails = isDirectSummary
1013
- ? item.element.parentElement
1014
- : item.element;
981
+ const nodeUnderDetails = isDirectSummary ? item.element.parentElement : item.element;
1015
982
  if (nodeUnderDetails?.matches(SELECTOR_DETAILS_CLOSED_CHILDREN) ?? false) {
1016
983
  return true;
1017
984
  }
@@ -1039,9 +1006,7 @@ function isNotTabbableRadio(item) {
1039
1006
  item.element.checked) {
1040
1007
  return false;
1041
1008
  }
1042
- const parent = item.element.form ??
1043
- item.element.getRootNode?.() ??
1044
- item.element.ownerDocument;
1009
+ const parent = item.element.form ?? item.element.getRootNode?.() ?? item.element.ownerDocument;
1045
1010
  const realName = CSS?.escape?.(item.element.name) ?? item.element.name;
1046
1011
  const radios = [
1047
1012
  ...parent.querySelectorAll(`${SELECTOR_RADIO_PREFIX}${realName}${SELECTOR_RADIO_SUFFIX}`),
@@ -1059,9 +1024,7 @@ function isSummarised(item) {
1059
1024
  * @returns `true` if tabbable, otherwise `false`
1060
1025
  */
1061
1026
  function isTabbable(element) {
1062
- return element instanceof Element
1063
- ? isValidElement(element, FILTERS_TABBABLE, true)
1064
- : false;
1027
+ return element instanceof Element ? isValidElement(element, FILTERS_TABBABLE, true) : false;
1065
1028
  }
1066
1029
  function isValidElement(element, filters, tabbable) {
1067
1030
  const item = getItem(element, tabbable);
@@ -1128,8 +1091,7 @@ function sanitizeAttributes(element, attributes, options) {
1128
1091
  if (isBadAttribute(attribute) || isEmptyNonBooleanAttribute(attribute)) {
1129
1092
  element.removeAttribute(attribute.name);
1130
1093
  }
1131
- else if (options.sanitizeBooleanAttributes &&
1132
- isInvalidBooleanAttribute(attribute)) {
1094
+ else if (options.sanitizeBooleanAttributes && isInvalidBooleanAttribute(attribute)) {
1133
1095
  element.setAttribute(attribute.name, '');
1134
1096
  }
1135
1097
  }
@@ -1166,9 +1128,7 @@ function getHtml(value, options) {
1166
1128
  if (typeof value !== 'string' && !(value instanceof HTMLTemplateElement)) {
1167
1129
  return [];
1168
1130
  }
1169
- const template = value instanceof HTMLTemplateElement
1170
- ? value
1171
- : getTemplate(value, options.ignoreCache);
1131
+ const template = value instanceof HTMLTemplateElement ? value : getTemplate(value, options.ignoreCache);
1172
1132
  if (template == null) {
1173
1133
  return [];
1174
1134
  }
@@ -1182,8 +1142,7 @@ function getHtml(value, options) {
1182
1142
  }
1183
1143
  function getOptions(input) {
1184
1144
  const options = isPlainObject(input) ? input : {};
1185
- options.ignoreCache =
1186
- typeof options.ignoreCache === 'boolean' ? options.ignoreCache : false;
1145
+ options.ignoreCache = typeof options.ignoreCache === 'boolean' ? options.ignoreCache : false;
1187
1146
  options.sanitizeBooleanAttributes =
1188
1147
  typeof options.sanitizeBooleanAttributes === 'boolean'
1189
1148
  ? options.sanitizeBooleanAttributes
@@ -1198,13 +1157,8 @@ function getTemplate(value, ignore) {
1198
1157
  if (template != null) {
1199
1158
  return template;
1200
1159
  }
1201
- const element = EXPRESSION_ID.test(value)
1202
- ? document.querySelector(`#${value}`)
1203
- : null;
1204
- template =
1205
- element instanceof HTMLTemplateElement
1206
- ? element
1207
- : createTemplate(value, ignore);
1160
+ const element = EXPRESSION_ID.test(value) ? document.querySelector(`#${value}`) : null;
1161
+ template = element instanceof HTMLTemplateElement ? element : createTemplate(value, ignore);
1208
1162
  return template;
1209
1163
  }
1210
1164
  const html = ((value, options) => {
package/package.json CHANGED
@@ -4,21 +4,21 @@
4
4
  "url": "https://oscarpalmer.se"
5
5
  },
6
6
  "dependencies": {
7
- "@oscarpalmer/atoms": "^0.114"
7
+ "@oscarpalmer/atoms": "^0.115"
8
8
  },
9
9
  "description": "A collection of badass DOM utilities.",
10
10
  "devDependencies": {
11
- "@biomejs/biome": "^2.3",
12
11
  "@rollup/plugin-node-resolve": "^16",
13
12
  "@rollup/plugin-typescript": "^12.3",
14
13
  "@types/node": "^24.10",
15
14
  "@vitest/coverage-istanbul": "^4",
16
- "glob": "^11",
17
15
  "jsdom": "^27.2",
16
+ "oxfmt": "^0.16",
17
+ "oxlint": "^1.31",
18
18
  "rollup": "^4.53",
19
19
  "tslib": "^2.8",
20
20
  "typescript": "^5.9",
21
- "vite": "npm:rolldown-vite@latest",
21
+ "vite": "8.0.0-beta.0",
22
22
  "vitest": "^4"
23
23
  },
24
24
  "exports": {
@@ -93,5 +93,5 @@
93
93
  },
94
94
  "type": "module",
95
95
  "types": "types/index.d.ts",
96
- "version": "0.26.1"
96
+ "version": "0.28.0"
97
97
  }