@oscarpalmer/toretto 0.47.1 → 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):
|
|
31
|
+
declare function getRole(element: Element): string | undefined;
|
|
32
32
|
/**
|
|
33
33
|
* Set an _ARIA_ attribute on an element
|
|
34
34
|
*
|
|
@@ -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:
|
|
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):
|
|
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):
|
|
98
|
+
declare function getRole(element: Element): string | undefined;
|
|
99
99
|
/**
|
|
100
100
|
* Set an _ARIA_ attribute on an element
|
|
101
101
|
*
|
|
@@ -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:
|
|
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):
|
|
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
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):
|
|
76
|
+
export function getRole(element: Element): string | undefined {
|
|
77
77
|
if (element instanceof Element) {
|
|
78
78
|
return element.getAttribute('role') ?? undefined;
|
|
79
79
|
}
|
|
@@ -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:
|
|
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):
|
|
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') {
|