@oscarpalmer/toretto 0.47.0 → 0.47.2

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/aria.d.mts CHANGED
@@ -28,7 +28,7 @@ declare function getAria<Attribute extends AnyAriaAttribute>(element: Element, a
28
28
  * @param element Element to get role from
29
29
  * @returns Element role _(or `undefined`)_
30
30
  */
31
- declare function getRole(element: Element): unknown;
31
+ declare function getRole(element: Element): string | undefined;
32
32
  /**
33
33
  * Set an _ARIA_ attribute on an element
34
34
  *
@@ -38,7 +38,7 @@ declare function getRole(element: Element): unknown;
38
38
  * @param attribute _ARIA_ attribute to set
39
39
  * @param value _ARIA_ attribute value
40
40
  */
41
- declare function setAria(element: Element, attribute: AnyAriaAttribute, value?: string): void;
41
+ declare function setAria(element: Element, attribute: AnyAriaAttribute, value?: unknown): void;
42
42
  /**
43
43
  * Set one or more _ARIA_ attributes on an element
44
44
  *
@@ -1,5 +1,4 @@
1
1
  //#region src/attribute/get.attribute.d.ts
2
- type DataPrefixedName = `data-${string}`;
3
2
  /**
4
3
  * Get the value of a specific attribute from an element
5
4
  *
@@ -8,7 +7,7 @@ type DataPrefixedName = `data-${string}`;
8
7
  * @param parse Parse value? _(defaults to `true`)_
9
8
  * @returns Attribute value _(or `undefined`)_
10
9
  */
11
- declare function getAttribute(element: Element, name: DataPrefixedName, parse?: boolean): unknown;
10
+ declare function getAttribute(element: Element, name: `data-${string}`, parse?: boolean): unknown;
12
11
  /**
13
12
  * Get the value of a specific attribute from an element
14
13
  *
@@ -16,7 +15,7 @@ declare function getAttribute(element: Element, name: DataPrefixedName, parse?:
16
15
  * @param name Attribute name
17
16
  * @returns Attribute value _(or `undefined`)_
18
17
  */
19
- declare function getAttribute(element: Element, name: string): unknown;
18
+ declare function getAttribute(element: Element, name: string): string | undefined;
20
19
  /**
21
20
  * Get specific attributes from an element
22
21
  *
package/dist/index.d.mts CHANGED
@@ -95,7 +95,7 @@ declare function getAria<Attribute extends AnyAriaAttribute>(element: Element, a
95
95
  * @param element Element to get role from
96
96
  * @returns Element role _(or `undefined`)_
97
97
  */
98
- declare function getRole(element: Element): unknown;
98
+ declare function getRole(element: Element): string | undefined;
99
99
  /**
100
100
  * Set an _ARIA_ attribute on an element
101
101
  *
@@ -105,7 +105,7 @@ declare function getRole(element: Element): unknown;
105
105
  * @param attribute _ARIA_ attribute to set
106
106
  * @param value _ARIA_ attribute value
107
107
  */
108
- declare function setAria(element: Element, attribute: AnyAriaAttribute, value?: string): void;
108
+ declare function setAria(element: Element, attribute: AnyAriaAttribute, value?: unknown): void;
109
109
  /**
110
110
  * Set one or more _ARIA_ attributes on an element
111
111
  *
@@ -139,7 +139,6 @@ declare function setRole(element: Element, role?: AriaRole): void;
139
139
  declare const booleanAttributes: readonly string[];
140
140
  //#endregion
141
141
  //#region src/attribute/get.attribute.d.ts
142
- type DataPrefixedName = `data-${string}`;
143
142
  /**
144
143
  * Get the value of a specific attribute from an element
145
144
  *
@@ -148,7 +147,7 @@ type DataPrefixedName = `data-${string}`;
148
147
  * @param parse Parse value? _(defaults to `true`)_
149
148
  * @returns Attribute value _(or `undefined`)_
150
149
  */
151
- declare function getAttribute(element: Element, name: DataPrefixedName, parse?: boolean): unknown;
150
+ declare function getAttribute(element: Element, name: `data-${string}`, parse?: boolean): unknown;
152
151
  /**
153
152
  * Get the value of a specific attribute from an element
154
153
  *
@@ -156,7 +155,7 @@ declare function getAttribute(element: Element, name: DataPrefixedName, parse?:
156
155
  * @param name Attribute name
157
156
  * @returns Attribute value _(or `undefined`)_
158
157
  */
159
- declare function getAttribute(element: Element, name: string): unknown;
158
+ declare function getAttribute(element: Element, name: string): string | undefined;
160
159
  /**
161
160
  * Get specific attributes from an element
162
161
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscarpalmer/toretto",
3
- "version": "0.47.0",
3
+ "version": "0.47.2",
4
4
  "description": "A collection of badass DOM utilities.",
5
5
  "keywords": [
6
6
  "dom",
package/src/aria.ts CHANGED
@@ -73,7 +73,7 @@ function getName(value: string): string {
73
73
  * @param element Element to get role from
74
74
  * @returns Element role _(or `undefined`)_
75
75
  */
76
- export function getRole(element: Element): unknown {
76
+ export function getRole(element: Element): string | undefined {
77
77
  if (element instanceof Element) {
78
78
  return element.getAttribute('role') ?? undefined;
79
79
  }
@@ -88,7 +88,7 @@ export function getRole(element: Element): unknown {
88
88
  * @param attribute _ARIA_ attribute to set
89
89
  * @param value _ARIA_ attribute value
90
90
  */
91
- export function setAria(element: Element, attribute: AnyAriaAttribute, value?: string): void;
91
+ export function setAria(element: Element, attribute: AnyAriaAttribute, value?: unknown): void;
92
92
 
93
93
  /**
94
94
  * Set one or more _ARIA_ attributes on an element
@@ -1,12 +1,6 @@
1
1
  import {kebabCase} from '@oscarpalmer/atoms/string/case';
2
2
  import {getAttributeValue} from '../internal/get-value';
3
3
 
4
- // #region Types
5
-
6
- type DataPrefixedName = `data-${string}`;
7
-
8
- // #endregion
9
-
10
4
  // #region Functions
11
5
 
12
6
  /**
@@ -17,7 +11,7 @@ type DataPrefixedName = `data-${string}`;
17
11
  * @param parse Parse value? _(defaults to `true`)_
18
12
  * @returns Attribute value _(or `undefined`)_
19
13
  */
20
- export function getAttribute(element: Element, name: DataPrefixedName, parse?: boolean): unknown;
14
+ export function getAttribute(element: Element, name: `data-${string}`, parse?: boolean): unknown;
21
15
 
22
16
  /**
23
17
  * Get the value of a specific attribute from an element
@@ -26,7 +20,7 @@ export function getAttribute(element: Element, name: DataPrefixedName, parse?: b
26
20
  * @param name Attribute name
27
21
  * @returns Attribute value _(or `undefined`)_
28
22
  */
29
- export function getAttribute(element: Element, name: string): unknown;
23
+ export function getAttribute(element: Element, name: string): string | undefined;
30
24
 
31
25
  export function getAttribute(element: Element, name: string, parseValues?: boolean): unknown {
32
26
  if (element instanceof Element && typeof name === 'string') {