@oscarpalmer/toretto 0.27.0 → 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.
@@ -27,7 +27,6 @@ export function setElementValues(
27
27
  }
28
28
  }
29
29
 
30
- // biome-ignore lint/nursery/useMaxParams: Internal function, so it's fine
31
30
  export function updateElementValue(
32
31
  element: HTMLOrSVGElement,
33
32
  key: string,
@@ -14,9 +14,7 @@ export function getAttributeValue(
14
14
  const attribute = element.attributes[normalized as keyof NamedNodeMap];
15
15
  const value = attribute instanceof Attr ? attribute.value : undefined;
16
16
 
17
- return EXPRESSION_DATA_PREFIX.test(normalized) &&
18
- typeof value === 'string' &&
19
- parseValue
17
+ return EXPRESSION_DATA_PREFIX.test(normalized) && typeof value === 'string' && parseValue
20
18
  ? (parse(value) ?? value)
21
19
  : value;
22
20
  }
@@ -28,9 +26,7 @@ export function getStyleValue(
28
26
  ): string | undefined {
29
27
  const name = camelCase(property);
30
28
 
31
- return computed
32
- ? getComputedStyle(element)[name as never]
33
- : element.style[name as never];
29
+ return computed ? getComputedStyle(element)[name as never] : element.style[name as never];
34
30
  }
35
31
 
36
32
  export const EXPRESSION_DATA_PREFIX = /^data-/i;
@@ -1,9 +1,5 @@
1
1
  import {isPlainObject} from '@oscarpalmer/atoms/is';
2
- import {
3
- isBadAttribute,
4
- isEmptyNonBooleanAttribute,
5
- isInvalidBooleanAttribute,
6
- } from './attribute';
2
+ import {isBadAttribute, isEmptyNonBooleanAttribute, isInvalidBooleanAttribute} from './attribute';
7
3
 
8
4
  //
9
5
 
@@ -31,11 +27,7 @@ export function getSanitizeOptions(input?: SanitizeOptions): Options {
31
27
  return options as Options;
32
28
  }
33
29
 
34
- export function sanitizeAttributes(
35
- element: Element,
36
- attributes: Attr[],
37
- options: Options,
38
- ): void {
30
+ export function sanitizeAttributes(element: Element, attributes: Attr[], options: Options): void {
39
31
  const {length} = attributes;
40
32
 
41
33
  for (let index = 0; index < length; index += 1) {
@@ -43,10 +35,7 @@ export function sanitizeAttributes(
43
35
 
44
36
  if (isBadAttribute(attribute) || isEmptyNonBooleanAttribute(attribute)) {
45
37
  element.removeAttribute(attribute.name);
46
- } else if (
47
- options.sanitizeBooleanAttributes &&
48
- isInvalidBooleanAttribute(attribute)
49
- ) {
38
+ } else if (options.sanitizeBooleanAttributes && isInvalidBooleanAttribute(attribute)) {
50
39
  element.setAttribute(attribute.name, '');
51
40
  }
52
41
  }
package/src/is.ts CHANGED
@@ -48,4 +48,4 @@ const CHILD_NODE_TYPES: Set<number> = new Set([
48
48
 
49
49
  //
50
50
 
51
- export {isEventTarget, isHTMLOrSVGElement} from './internal/is'
51
+ export {isEventTarget, isHTMLOrSVGElement} from './internal/is';
package/src/style.ts CHANGED
@@ -57,11 +57,7 @@ export function getStyles<Property extends keyof CSSStyleDeclaration>(
57
57
  const property = properties[index];
58
58
 
59
59
  if (typeof property === 'string') {
60
- styles[property] = getStyleValue(
61
- element,
62
- property,
63
- computed === true,
64
- ) as never;
60
+ styles[property] = getStyleValue(element, property, computed === true) as never;
65
61
  }
66
62
  }
67
63
 
@@ -74,10 +70,7 @@ export function getStyles<Property extends keyof CSSStyleDeclaration>(
74
70
  * @param computed Get the computed text direction? _(defaults to `false`)_
75
71
  * @returns Text direction
76
72
  */
77
- export function getTextDirection(
78
- element: HTMLOrSVGElement,
79
- computed?: boolean,
80
- ): TextDirection {
73
+ export function getTextDirection(element: HTMLOrSVGElement, computed?: boolean): TextDirection {
81
74
  if (!(element instanceof Element)) {
82
75
  return undefined as never;
83
76
  }
@@ -112,10 +105,7 @@ export function setStyle(
112
105
  * @param element Element to set the styles on
113
106
  * @param styles Styles to set
114
107
  */
115
- export function setStyles(
116
- element: HTMLOrSVGElement,
117
- styles: Partial<CSSStyleDeclaration>,
118
- ): void {
108
+ export function setStyles(element: HTMLOrSVGElement, styles: Partial<CSSStyleDeclaration>): void {
119
109
  setElementValues(element, styles as never, null, updateStyleProperty);
120
110
  }
121
111
 
@@ -170,11 +160,7 @@ export function toggleStyles(
170
160
  };
171
161
  }
172
162
 
173
- function updateStyleProperty(
174
- element: HTMLOrSVGElement,
175
- key: string,
176
- value: unknown,
177
- ): void {
163
+ function updateStyleProperty(element: HTMLOrSVGElement, key: string, value: unknown): void {
178
164
  updateElementValue(
179
165
  element,
180
166
  key,
package/src/touch.ts CHANGED
@@ -36,16 +36,12 @@ function getSupport(): boolean {
36
36
  return true;
37
37
  }
38
38
 
39
- if (
40
- typeof navigator.maxTouchPoints === 'number' &&
41
- navigator.maxTouchPoints > 0
42
- ) {
39
+ if (typeof navigator.maxTouchPoints === 'number' && navigator.maxTouchPoints > 0) {
43
40
  return true;
44
41
  }
45
42
 
46
43
  if (
47
- typeof (navigator as NavigatorWithMsMaxTouchPoints).msMaxTouchPoints ===
48
- 'number' &&
44
+ typeof (navigator as NavigatorWithMsMaxTouchPoints).msMaxTouchPoints === 'number' &&
49
45
  (navigator as NavigatorWithMsMaxTouchPoints).msMaxTouchPoints > 0
50
46
  ) {
51
47
  return true;