@oscarpalmer/toretto 0.47.3 → 0.49.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.
package/dist/index.mjs CHANGED
@@ -627,7 +627,10 @@ function getAria(element, value) {
627
627
  return arias;
628
628
  }
629
629
  function getAriaValue(element, attribute) {
630
- return element.getAttribute(getName$1(attribute)) ?? void 0;
630
+ const name = getName$1(attribute);
631
+ const value = element.getAttribute(name) ?? void 0;
632
+ if (ariaBooleanAttributesSet.has(name) && typeof value === "string" && EXPRESSION_BOOLEAN.test(value)) return value.toLowerCase() === "true";
633
+ return value;
631
634
  }
632
635
  function getName$1(value) {
633
636
  return EXPRESSION_ARIA_PREFIX.test(value) ? value : `${ATTRIBUTE_ARIA_PREFIX}${value}`;
@@ -656,10 +659,39 @@ function setRole(element, role) {
656
659
  else element.removeAttribute("role");
657
660
  }
658
661
  function updateAriaAttribute(element, key, value) {
659
- updateElementValue(element, getName$1(key), value, element.setAttribute, element.removeAttribute, false, false);
662
+ const name = getName$1(key);
663
+ let actual = value;
664
+ if (ariaBooleanAttributesSet.has(name) && typeof value === "string" && EXPRESSION_BOOLEAN.test(value)) actual = value.toLowerCase() === "true";
665
+ updateElementValue(element, name, actual, element.setAttribute, element.removeAttribute, false, false);
660
666
  }
661
667
  const ATTRIBUTE_ARIA_PREFIX = "aria-";
662
668
  const EXPRESSION_ARIA_PREFIX = /^aria-/i;
669
+ const EXPRESSION_BOOLEAN = /^(true|false)$/i;
670
+ /**
671
+ * List of _ARIA_ attributes that can be treated as boolean values
672
+ */
673
+ const ariaBooleanAttributes = Object.freeze([
674
+ "aria-atomic",
675
+ "aria-busy",
676
+ "aria-checked",
677
+ "aria-current",
678
+ "aria-disabled",
679
+ "aria-expanded",
680
+ "aria-haspopup",
681
+ "aria-hidden",
682
+ "aria-invalid",
683
+ "aria-modal",
684
+ "aria-multiline",
685
+ "aria-multiselectable",
686
+ "aria-pressed",
687
+ "aria-readonly",
688
+ "aria-required",
689
+ "aria-selected"
690
+ ]);
691
+ /**
692
+ * Set of _ARIA_ attributes that can be treated as boolean values
693
+ */
694
+ const ariaBooleanAttributesSet = new Set(ariaBooleanAttributes);
663
695
  //#endregion
664
696
  //#region src/internal/get-value.ts
665
697
  function getBoolean(value, defaultValue) {
@@ -722,6 +754,36 @@ function isInvalidBooleanAttribute(first, second) {
722
754
  return _isInvalidBooleanAttribute(first, second, true);
723
755
  }
724
756
  //#endregion
757
+ //#region src/data.ts
758
+ function getData(element, keys, parseValues) {
759
+ if (!(element instanceof Element)) return;
760
+ const noParse = parseValues === false;
761
+ if (typeof keys === "string") {
762
+ const value = element.dataset[camelCase(keys)];
763
+ if (value === void 0) return;
764
+ return noParse ? value : parse(value);
765
+ }
766
+ const { length } = keys;
767
+ const data = {};
768
+ for (let index = 0; index < length; index += 1) {
769
+ const key = keys[index];
770
+ const value = element.dataset[camelCase(key)];
771
+ if (value == null) data[key] = void 0;
772
+ else data[key] = noParse ? value : parse(value);
773
+ }
774
+ return data;
775
+ }
776
+ function getName(original) {
777
+ return `${ATTRIBUTE_DATA_PREFIX}${kebabCase(original.replace(EXPRESSION_DATA_PREFIX, ""))}`;
778
+ }
779
+ function setData(element, first, second) {
780
+ setElementValues(element, first, second, null, updateDataAttribute);
781
+ }
782
+ function updateDataAttribute(element, key, value) {
783
+ updateElementValue(element, getName(key), value, element.setAttribute, element.removeAttribute, false, true);
784
+ }
785
+ const ATTRIBUTE_DATA_PREFIX = "data-";
786
+ //#endregion
725
787
  //#region src/property/get.property.ts
726
788
  /**
727
789
  * Get the values of one or more properties on an element
@@ -786,28 +848,28 @@ function setPropertyValue(element, property, value, dispatch) {
786
848
  * Get a style from an element
787
849
  *
788
850
  * @param element Element to get the style from
789
- * @param property Style name
851
+ * @param name Style name
790
852
  * @param computed Get the computed style? _(defaults to `false`)_
791
853
  * @returns Style value
792
854
  */
793
- function getStyle(element, property, computed) {
794
- if (element instanceof Element && typeof property === "string") return getStyleValue(element, property, computed === true);
855
+ function getStyle(element, name, computed) {
856
+ if (element instanceof Element && typeof name === "string") return getStyleValue(element, name, computed === true);
795
857
  }
796
858
  /**
797
859
  * Get styles from an element
798
860
  *
799
861
  * @param element Element to get the styles from
800
- * @param properties Styles to get
862
+ * @param names Styles to get
801
863
  * @param computed Get the computed styles? _(defaults to `false`)_
802
864
  * @returns Style values
803
865
  */
804
- function getStyles(element, properties, computed) {
866
+ function getStyles(element, names, computed) {
805
867
  const styles = {};
806
- if (!(element instanceof Element && Array.isArray(properties))) return styles;
807
- const { length } = properties;
868
+ if (!(element instanceof Element && Array.isArray(names))) return styles;
869
+ const { length } = names;
808
870
  for (let index = 0; index < length; index += 1) {
809
- const property = properties[index];
810
- if (typeof property === "string") styles[property] = getStyleValue(element, property, computed === true);
871
+ const name = names[index];
872
+ if (typeof name === "string") styles[name] = getStyleValue(element, name, computed === true);
811
873
  }
812
874
  return styles;
813
875
  }
@@ -823,11 +885,11 @@ function getTextDirection(node) {
823
885
  * Set a style on an element
824
886
  *
825
887
  * @param element Element to set the style on
826
- * @param property Style name
888
+ * @param name Style name
827
889
  * @param value Style value
828
890
  */
829
- function setStyle(element, property, value) {
830
- setElementValues(element, property, value, null, updateStyleProperty, true);
891
+ function setStyle(element, name, value) {
892
+ setElementValues(element, name, value, null, updateStyleProperty, true);
831
893
  }
832
894
  /**
833
895
  * Set styles on an element
@@ -873,12 +935,12 @@ function toggleStyles(element, styles) {
873
935
  };
874
936
  }
875
937
  function updateStyleProperty(element, key, value) {
876
- updateElementValue(element, key, value, function(property, style) {
877
- if (property.startsWith(VARIABLE_PREFIX)) this.style.setProperty(property, getString(style));
878
- else this.style[property] = getString(style);
879
- }, function(property) {
880
- if (property.startsWith(VARIABLE_PREFIX)) this.style.removeProperty(property);
881
- else this.style[property] = "";
938
+ updateElementValue(element, key, value, function(name, style) {
939
+ if (name.startsWith(VARIABLE_PREFIX)) this.style.setProperty(name, getString(style));
940
+ else this.style[name] = getString(style);
941
+ }, function(name) {
942
+ if (name.startsWith(VARIABLE_PREFIX)) this.style.removeProperty(name);
943
+ else this.style[name] = "";
882
944
  if (this.getAttribute(ATTRIBUTE_STYLE) === "") this.removeAttribute(ATTRIBUTE_STYLE);
883
945
  }, false, false);
884
946
  }
@@ -889,45 +951,28 @@ const PROPERTY_DIRECTION = "direction";
889
951
  const VARIABLE_PREFIX = "--";
890
952
  //#endregion
891
953
  //#region src/create.ts
892
- function createElement(tag, properties, attributes, styles) {
954
+ function createElement(tag, values) {
893
955
  if (typeof tag !== "string") throw new TypeError(MESSAGE);
894
956
  const element = document.createElement(tag);
895
- if (properties != null) setProperties(element, properties);
896
- if (attributes != null) setAttributes(element, attributes);
897
- if (styles != null) setStyles(element, styles);
957
+ const { aria, attribute, data, property, style } = getElementValues(values);
958
+ setAria(element, aria ?? {});
959
+ setAttributes(element, attribute ?? {});
960
+ setData(element, data ?? {});
961
+ setProperties(element, property ?? {});
962
+ setStyles(element, style ?? {});
898
963
  return element;
899
964
  }
900
- const MESSAGE = "Tag name must be a string";
901
- //#endregion
902
- //#region src/data.ts
903
- function getData(element, keys, parseValues) {
904
- if (!(element instanceof Element)) return;
905
- const noParse = parseValues === false;
906
- if (typeof keys === "string") {
907
- const value = element.dataset[camelCase(keys)];
908
- if (value === void 0) return;
909
- return noParse ? value : parse(value);
910
- }
911
- const { length } = keys;
912
- const data = {};
913
- for (let index = 0; index < length; index += 1) {
914
- const key = keys[index];
915
- const value = element.dataset[camelCase(key)];
916
- if (value == null) data[key] = void 0;
917
- else data[key] = noParse ? value : parse(value);
918
- }
919
- return data;
920
- }
921
- function getName(original) {
922
- return `${ATTRIBUTE_DATA_PREFIX}${kebabCase(original.replace(EXPRESSION_DATA_PREFIX, ""))}`;
923
- }
924
- function setData(element, first, second) {
925
- setElementValues(element, first, second, null, updateDataAttribute);
926
- }
927
- function updateDataAttribute(element, key, value) {
928
- updateElementValue(element, getName(key), value, element.setAttribute, element.removeAttribute, false, true);
965
+ function getElementValues(input) {
966
+ if (!isPlainObject(input)) return {};
967
+ return {
968
+ aria: isPlainObject(input.aria) ? input.aria : void 0,
969
+ attribute: isPlainObject(input.attribute) ? input.attribute : void 0,
970
+ data: isPlainObject(input.data) ? input.data : void 0,
971
+ property: isPlainObject(input.property) ? input.property : void 0,
972
+ style: isPlainObject(input.style) ? input.style : void 0
973
+ };
929
974
  }
930
- const ATTRIBUTE_DATA_PREFIX = "data-";
975
+ const MESSAGE = "Tag name must be a string";
931
976
  //#endregion
932
977
  //#region node_modules/@oscarpalmer/atoms/dist/internal/function/misc.mjs
933
978
  /**
@@ -1049,7 +1094,10 @@ function createEventOptions(options) {
1049
1094
  };
1050
1095
  }
1051
1096
  function dispatch(target, type, options) {
1052
- if (isEventTarget(target) && typeof type === "string") target.dispatchEvent(createEvent(type, options));
1097
+ if (!isEventTarget(target) || typeof type !== "string") return;
1098
+ const event = createEvent(type, options);
1099
+ target.dispatchEvent(event);
1100
+ return event;
1053
1101
  }
1054
1102
  /**
1055
1103
  * Get the X- and Y-coordinates from a pointer event
@@ -1670,4 +1718,4 @@ const CHILD_NODE_TYPES = /* @__PURE__ */ new Set([
1670
1718
  Node.DOCUMENT_TYPE_NODE
1671
1719
  ]);
1672
1720
  //#endregion
1673
- export { findElement as $, findElement, findElements as $$, findElements, booleanAttributes, createElement, dispatch, findAncestor, findRelatives, getAria, getAttribute, getAttributes, getData, getDistance, getElementFromPosition, getElementUnderPointer, getFocusable, getPosition, getProperties, getProperty, getRole, getStyle, getStyles, getTabbable, getTextDirection, html, isBadAttribute, isBooleanAttribute, isChildNode, isEventPosition, isEventTarget, isFocusable, isHTMLOrSVGElement, isInDocument, isInputElement, isInvalidBooleanAttribute, isTabbable, off, on, sanitize, setAria, setAttribute, setAttributes, setData, setProperties, setProperty, setRole, setStyle, setStyles, supportsTouch, toggleStyles };
1721
+ export { findElement as $, findElement, findElements as $$, findElements, ariaBooleanAttributes, ariaBooleanAttributesSet, booleanAttributes, createElement, dispatch, findAncestor, findRelatives, getAria, getAttribute, getAttributes, getData, getDistance, getElementFromPosition, getElementUnderPointer, getFocusable, getPosition, getProperties, getProperty, getRole, getStyle, getStyles, getTabbable, getTextDirection, html, isBadAttribute, isBooleanAttribute, isChildNode, isEventPosition, isEventTarget, isFocusable, isHTMLOrSVGElement, isInDocument, isInputElement, isInvalidBooleanAttribute, isTabbable, off, on, sanitize, setAria, setAttribute, setAttributes, setData, setProperties, setProperty, setRole, setStyle, setStyles, supportsTouch, toggleStyles };
@@ -1,5 +1,4 @@
1
1
  import { Attribute } from "../models.mjs";
2
-
3
2
  //#region src/internal/attribute.d.ts
4
3
  declare function isAttribute(value: unknown): value is Attr | Attribute;
5
4
  declare function _isBadAttribute(first: unknown, second: unknown, decode: boolean): boolean;
@@ -1,5 +1,4 @@
1
1
  import { EventPosition } from "@oscarpalmer/atoms/models";
2
-
3
2
  //#region src/internal/is.d.ts
4
3
  /**
5
4
  * Is the value an event position?
package/dist/is.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { isEventPosition, isEventTarget, isHTMLOrSVGElement, isInputElement } from "./internal/is.mjs";
2
-
3
2
  //#region src/is.d.ts
4
3
  /**
5
4
  * Is the value a child node?
package/dist/models.d.mts CHANGED
@@ -1,4 +1,12 @@
1
1
  //#region src/models.d.ts
2
+ /**
3
+ * Any _ARIA_ attribute for an element _(both prefixed and unprefixed)_
4
+ */
5
+ type AnyAriaAttribute = AriaAttribute | AriaAttributeUnprefixed;
6
+ /**
7
+ * Any _ARIA_ attribute for an element that can be set to a boolean value _(both prefixed and unprefixed)_
8
+ */
9
+ type AnyAriaBooleanAttribute = AriaBooleanAttribute | AriaBooleanAttributeUnprefixed;
2
10
  /**
3
11
  * _ARIA_ attribute for an element
4
12
  *
@@ -10,8 +18,16 @@ type AriaAttribute = keyof AriaAttributes;
10
18
  *
11
19
  * _(https://www.w3.org/TR/wai-aria-1.3/#aria-attributes)_
12
20
  */
13
- type AriaAttributeUnprefixed = keyof { [Key in AriaAttribute as Key extends `aria-${infer Name}` ? Name : never]: string | null };
14
- type AriaAttributes = { [Key in keyof ARIAMixin as NormalizedName<Key>]: string | null };
21
+ type AriaAttributeUnprefixed = keyof { [Key in AriaAttribute as Key extends `aria-${infer Name}` ? Name : never]: unknown; };
22
+ type AriaAttributes = { [Key in keyof ARIAMixin as NormalizedName<Key>]: unknown; };
23
+ /**
24
+ * _ARIA_ attribute for an element that can be set to a boolean value
25
+ */
26
+ type AriaBooleanAttribute = 'aria-atomic' | 'aria-busy' | 'aria-checked' | 'aria-current' | 'aria-disabled' | 'aria-expanded' | 'aria-haspopup' | 'aria-hidden' | 'aria-invalid' | 'aria-modal' | 'aria-multiline' | 'aria-multiselectable' | 'aria-pressed' | 'aria-readonly' | 'aria-required' | 'aria-selected';
27
+ /**
28
+ * _ARIA_ attribute for an element that can be set to a boolean value, without the `aria-` prefix
29
+ */
30
+ type AriaBooleanAttributeUnprefixed = keyof { [Key in AriaBooleanAttribute as Key extends `aria-${infer Name}` ? Name : never]: string | null; };
15
31
  type NormalizedName<Key extends string> = Key extends `aria${infer Name}` ? Name extends `${infer Part}Element` ? `aria-${Lowercase<Part>}` : Name extends `${infer Part}Elements` ? `aria-${Lowercase<Part>}` : `aria-${Lowercase<Name>}` : never;
16
32
  /**
17
33
  * _ARIA_ role for an element
@@ -26,6 +42,18 @@ type Attribute = {
26
42
  name: string;
27
43
  value: unknown;
28
44
  };
45
+ /**
46
+ * CSS styles for an element
47
+ */
48
+ type CSSStyles = Record<keyof CSSStyleDeclaration, unknown>;
49
+ /**
50
+ * CSSS values for an element _(both styles and variables)_
51
+ */
52
+ type CSSValues = CSSVariables & CSSStyles;
53
+ /**
54
+ * CSS variables for an element
55
+ */
56
+ type CSSVariables<Value extends Record<string, unknown> = Record<string, unknown>> = { [Property in keyof Value as `--${string & Property}`]?: unknown; };
29
57
  /**
30
58
  * Event listener for custom events
31
59
  */
@@ -43,4 +71,4 @@ type Selector = string | Node | Node[] | NodeList;
43
71
  */
44
72
  type TextDirection = 'ltr' | 'rtl';
45
73
  //#endregion
46
- export { AriaAttribute, AriaAttributeUnprefixed, AriaRole, Attribute, CustomEventListener, RemovableEventListener, Selector, TextDirection };
74
+ export { AnyAriaAttribute, AnyAriaBooleanAttribute, AriaAttribute, AriaAttributeUnprefixed, AriaBooleanAttribute, AriaBooleanAttributeUnprefixed, AriaRole, Attribute, CSSStyles, CSSValues, CSSVariables, CustomEventListener, RemovableEventListener, Selector, TextDirection };
@@ -1,7 +1,6 @@
1
1
  import { Primitive } from "@oscarpalmer/atoms/models";
2
-
3
2
  //#region src/property/get.property.d.ts
4
- type GetProperties<Target extends Element> = { [Property in keyof Target as Target[Property] extends Primitive ? Property : never]?: Target[Property] };
3
+ type GetProperties<Target extends Element> = { [Property in keyof Target as Target[Property] extends Primitive ? Property : never]?: Target[Property]; };
5
4
  /**
6
5
  * Get the values of one or more properties on an element
7
6
  *
@@ -1,9 +1,8 @@
1
1
  import { DispatchedAttributeName } from "../attribute/set.attribute.mjs";
2
2
  import { Primitive } from "@oscarpalmer/atoms/models";
3
-
4
3
  //#region src/property/set.property.d.ts
5
4
  type DispatchedPropertyValue<Target extends Element, Property extends DispatchedAttributeName> = Property extends keyof SetProperties<Target> ? SetProperties<Target>[Property] : never;
6
- type SetProperties<Target extends Element> = { [Property in keyof Target as Target[Property] extends Primitive ? Property : never]?: Target[Property] };
5
+ type SetProperties<Target extends Element> = { [Property in keyof Target as Target[Property] extends Primitive ? Property : never]?: Target[Property]; };
7
6
  /**
8
7
  * Set the values of one or more properties on an element
9
8
  *
package/dist/style.d.mts CHANGED
@@ -1,7 +1,5 @@
1
- import { TextDirection } from "./models.mjs";
2
-
1
+ import { CSSValues, TextDirection } from "./models.mjs";
3
2
  //#region src/style.d.ts
4
- type CSSStyleValues = Variables & CSSStyleDeclaration;
5
3
  type StyleToggler = {
6
4
  /**
7
5
  * Set the provided styles on the element
@@ -12,26 +10,24 @@ type StyleToggler = {
12
10
  */
13
11
  remove(): void;
14
12
  };
15
- type Styles = Partial<Record<keyof CSSStyleValues, unknown>>;
16
- type Variables<Value extends Record<string, string | undefined> = Record<string, string | undefined>> = { [property in keyof Value as `--${string & property}`]?: string | undefined };
17
13
  /**
18
14
  * Get a style from an element
19
15
  *
20
16
  * @param element Element to get the style from
21
- * @param property Style name
17
+ * @param name Style name
22
18
  * @param computed Get the computed style? _(defaults to `false`)_
23
19
  * @returns Style value
24
20
  */
25
- declare function getStyle(element: Element, property: keyof CSSStyleValues, computed?: boolean): string | undefined;
21
+ declare function getStyle(element: Element, name: keyof CSSValues, computed?: boolean): string | undefined;
26
22
  /**
27
23
  * Get styles from an element
28
24
  *
29
25
  * @param element Element to get the styles from
30
- * @param properties Styles to get
26
+ * @param names Styles to get
31
27
  * @param computed Get the computed styles? _(defaults to `false`)_
32
28
  * @returns Style values
33
29
  */
34
- declare function getStyles<Property extends keyof CSSStyleValues>(element: Element, properties: Property[], computed?: boolean): Record<Property, string | undefined>;
30
+ declare function getStyles<Name extends keyof CSSValues>(element: Element, names: Name[], computed?: boolean): Record<Name, string | undefined>;
35
31
  /**
36
32
  * Get the text direction of a node or element _(or document, if element is invalid)_
37
33
  *
@@ -49,17 +45,17 @@ declare function getTextDirection(): TextDirection;
49
45
  * Set a style on an element
50
46
  *
51
47
  * @param element Element to set the style on
52
- * @param property Style name
48
+ * @param name Style name
53
49
  * @param value Style value
54
50
  */
55
- declare function setStyle(element: Element, property: keyof CSSStyleValues, value?: unknown): void;
51
+ declare function setStyle(element: Element, name: keyof CSSValues, value?: unknown): void;
56
52
  /**
57
53
  * Set styles on an element
58
54
  *
59
55
  * @param element Element to set the styles on
60
56
  * @param styles Styles to set
61
57
  */
62
- declare function setStyles(element: Element, styles: Styles): void;
58
+ declare function setStyles(element: Element, styles: Partial<CSSValues>): void;
63
59
  /**
64
60
  * Toggle styles for an element
65
61
  *
@@ -67,6 +63,6 @@ declare function setStyles(element: Element, styles: Styles): void;
67
63
  * @param styles Styles to be set or removed
68
64
  * @returns Style toggler
69
65
  */
70
- declare function toggleStyles(element: Element, styles: Styles): StyleToggler;
66
+ declare function toggleStyles(element: Element, styles: Partial<CSSValues>): StyleToggler;
71
67
  //#endregion
72
68
  export { StyleToggler, getStyle, getStyles, getTextDirection, setStyle, setStyles, toggleStyles };
package/dist/style.mjs CHANGED
@@ -6,28 +6,28 @@ import { getString } from "@oscarpalmer/atoms/string";
6
6
  * Get a style from an element
7
7
  *
8
8
  * @param element Element to get the style from
9
- * @param property Style name
9
+ * @param name Style name
10
10
  * @param computed Get the computed style? _(defaults to `false`)_
11
11
  * @returns Style value
12
12
  */
13
- function getStyle(element, property, computed) {
14
- if (element instanceof Element && typeof property === "string") return getStyleValue(element, property, computed === true);
13
+ function getStyle(element, name, computed) {
14
+ if (element instanceof Element && typeof name === "string") return getStyleValue(element, name, computed === true);
15
15
  }
16
16
  /**
17
17
  * Get styles from an element
18
18
  *
19
19
  * @param element Element to get the styles from
20
- * @param properties Styles to get
20
+ * @param names Styles to get
21
21
  * @param computed Get the computed styles? _(defaults to `false`)_
22
22
  * @returns Style values
23
23
  */
24
- function getStyles(element, properties, computed) {
24
+ function getStyles(element, names, computed) {
25
25
  const styles = {};
26
- if (!(element instanceof Element && Array.isArray(properties))) return styles;
27
- const { length } = properties;
26
+ if (!(element instanceof Element && Array.isArray(names))) return styles;
27
+ const { length } = names;
28
28
  for (let index = 0; index < length; index += 1) {
29
- const property = properties[index];
30
- if (typeof property === "string") styles[property] = getStyleValue(element, property, computed === true);
29
+ const name = names[index];
30
+ if (typeof name === "string") styles[name] = getStyleValue(element, name, computed === true);
31
31
  }
32
32
  return styles;
33
33
  }
@@ -43,11 +43,11 @@ function getTextDirection(node) {
43
43
  * Set a style on an element
44
44
  *
45
45
  * @param element Element to set the style on
46
- * @param property Style name
46
+ * @param name Style name
47
47
  * @param value Style value
48
48
  */
49
- function setStyle(element, property, value) {
50
- setElementValues(element, property, value, null, updateStyleProperty, true);
49
+ function setStyle(element, name, value) {
50
+ setElementValues(element, name, value, null, updateStyleProperty, true);
51
51
  }
52
52
  /**
53
53
  * Set styles on an element
@@ -93,12 +93,12 @@ function toggleStyles(element, styles) {
93
93
  };
94
94
  }
95
95
  function updateStyleProperty(element, key, value) {
96
- updateElementValue(element, key, value, function(property, style) {
97
- if (property.startsWith(VARIABLE_PREFIX)) this.style.setProperty(property, getString(style));
98
- else this.style[property] = getString(style);
99
- }, function(property) {
100
- if (property.startsWith(VARIABLE_PREFIX)) this.style.removeProperty(property);
101
- else this.style[property] = "";
96
+ updateElementValue(element, key, value, function(name, style) {
97
+ if (name.startsWith(VARIABLE_PREFIX)) this.style.setProperty(name, getString(style));
98
+ else this.style[name] = getString(style);
99
+ }, function(name) {
100
+ if (name.startsWith(VARIABLE_PREFIX)) this.style.removeProperty(name);
101
+ else this.style[name] = "";
102
102
  if (this.getAttribute(ATTRIBUTE_STYLE) === "") this.removeAttribute(ATTRIBUTE_STYLE);
103
103
  }, false, false);
104
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscarpalmer/toretto",
3
- "version": "0.47.3",
3
+ "version": "0.49.0",
4
4
  "description": "A collection of badass DOM utilities.",
5
5
  "keywords": [
6
6
  "dom",
@@ -93,10 +93,10 @@
93
93
  "@oscarpalmer/atoms": "^0.188.1"
94
94
  },
95
95
  "devDependencies": {
96
- "@oxlint/plugins": "^1.73",
96
+ "@oxlint/plugins": "^1.76",
97
97
  "@types/node": "^26.1",
98
98
  "@vitest/coverage-istanbul": "^4.1",
99
- "jsdom": "^29.1",
99
+ "jsdom": "^30",
100
100
  "tsdown": "^0.22",
101
101
  "typescript": "^6",
102
102
  "vite": "npm:@voidzero-dev/vite-plus-core@latest",