@oscarpalmer/toretto 0.39.2 → 0.41.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/{types/attribute/get.d.ts → dist/attribute/get.d.mts} +6 -3
- package/dist/attribute/{get.js → get.mjs} +2 -2
- package/{types/attribute/index.d.ts → dist/attribute/index.d.mts} +16 -12
- package/dist/attribute/{index.js → index.mjs} +3 -3
- package/{types/attribute/set.d.ts → dist/attribute/set.d.mts} +10 -7
- package/dist/attribute/{set.js → set.mjs} +2 -2
- package/{types/data.d.ts → dist/data.d.mts} +9 -5
- package/dist/{data.js → data.mjs} +4 -4
- package/dist/event/delegation.d.mts +11 -0
- package/dist/event/{delegation.js → delegation.mjs} +8 -8
- package/{types/event/index.d.ts → dist/event/index.d.mts} +12 -8
- package/dist/event/{index.js → index.mjs} +4 -4
- package/{types/find/index.d.ts → dist/find/index.d.mts} +11 -8
- package/dist/find/{index.js → index.mjs} +7 -7
- package/{types/find/relative.d.ts → dist/find/relative.d.mts} +8 -5
- package/{types/focusable.d.ts → dist/focusable.d.mts} +7 -4
- package/dist/{focusable.js → focusable.mjs} +20 -20
- package/dist/html/index.d.mts +42 -0
- package/dist/html/{index.js → index.mjs} +8 -8
- package/dist/html/sanitize.d.mts +5 -0
- package/dist/html/{sanitize.js → sanitize.mjs} +4 -4
- package/{types/index.d.ts → dist/index.d.mts} +157 -128
- package/dist/{toretto.full.js → index.mjs} +78 -173
- package/dist/internal/attribute.d.mts +15 -0
- package/dist/internal/{attribute.js → attribute.mjs} +14 -14
- package/dist/internal/element-value.d.mts +6 -0
- package/dist/internal/{element-value.js → element-value.mjs} +3 -3
- package/dist/internal/get-value.d.mts +7 -0
- package/dist/internal/{get-value.js → get-value.mjs} +1 -1
- package/{types/internal/is.d.ts → dist/internal/is.d.mts} +5 -2
- package/{types/is.d.ts → dist/is.d.mts} +8 -4
- package/dist/{is.js → is.mjs} +2 -2
- package/dist/models.d.mts +33 -0
- package/dist/models.mjs +1 -0
- package/dist/style.d.mts +58 -0
- package/dist/{style.js → style.mjs} +5 -5
- package/dist/touch.d.mts +21 -0
- package/dist/{touch.js → touch.mjs} +1 -1
- package/package.json +60 -63
- package/src/data.ts +1 -1
- package/src/find/index.ts +1 -1
- package/src/internal/attribute.ts +1 -1
- package/dist/index.js +0 -15
- package/dist/models.js +0 -0
- package/types/event/delegation.d.ts +0 -7
- package/types/html/index.d.ts +0 -40
- package/types/html/sanitize.d.ts +0 -2
- package/types/internal/attribute.d.ts +0 -11
- package/types/internal/element-value.d.ts +0 -3
- package/types/internal/get-value.d.ts +0 -4
- package/types/models.d.ts +0 -30
- package/types/style.d.ts +0 -54
- package/types/touch.d.ts +0 -19
- /package/dist/find/{relative.js → relative.mjs} +0 -0
- /package/dist/internal/{is.js → is.mjs} +0 -0
package/dist/style.d.mts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { TextDirection } from "./models.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/style.d.ts
|
|
4
|
+
type StyleToggler = {
|
|
5
|
+
/**
|
|
6
|
+
* Set the provided styles on the element
|
|
7
|
+
*/
|
|
8
|
+
set(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Remove the provided styles from the element _(and sets any previous styles)_
|
|
11
|
+
*/
|
|
12
|
+
remove(): void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Get a style from an element
|
|
16
|
+
* @param element Element to get the style from
|
|
17
|
+
* @param property Style name
|
|
18
|
+
* @param computed Get the computed style? _(defaults to `false`)_
|
|
19
|
+
* @returns Style value
|
|
20
|
+
*/
|
|
21
|
+
declare function getStyle(element: Element, property: keyof CSSStyleDeclaration, computed?: boolean): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Get styles from an element
|
|
24
|
+
* @param element Element to get the styles from
|
|
25
|
+
* @param properties Styles to get
|
|
26
|
+
* @param computed Get the computed styles? _(defaults to `false`)_
|
|
27
|
+
* @returns Style values
|
|
28
|
+
*/
|
|
29
|
+
declare function getStyles<Property extends keyof CSSStyleDeclaration>(element: Element, properties: Property[], computed?: boolean): Record<Property, string | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the text direction of an element
|
|
32
|
+
* @param element Element to get the text direction from
|
|
33
|
+
* @param computed Get the computed text direction? _(defaults to `false`)_
|
|
34
|
+
* @returns Text direction
|
|
35
|
+
*/
|
|
36
|
+
declare function getTextDirection(element: Element, computed?: boolean): TextDirection;
|
|
37
|
+
/**
|
|
38
|
+
* Set a style on an element
|
|
39
|
+
* @param element Element to set the style on
|
|
40
|
+
* @param property Style name
|
|
41
|
+
* @param value Style value
|
|
42
|
+
*/
|
|
43
|
+
declare function setStyle(element: Element, property: keyof CSSStyleDeclaration, value?: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Set styles on an element
|
|
46
|
+
* @param element Element to set the styles on
|
|
47
|
+
* @param styles Styles to set
|
|
48
|
+
*/
|
|
49
|
+
declare function setStyles(element: Element, styles: Partial<CSSStyleDeclaration>): void;
|
|
50
|
+
/**
|
|
51
|
+
* Toggle styles for an element
|
|
52
|
+
* @param element Element to style
|
|
53
|
+
* @param styles Styles to be set or removed
|
|
54
|
+
* @returns Style toggler
|
|
55
|
+
*/
|
|
56
|
+
declare function toggleStyles(element: Element, styles: Partial<CSSStyleDeclaration>): StyleToggler;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { StyleToggler, getStyle, getStyles, getTextDirection, setStyle, setStyles, toggleStyles };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { isHTMLOrSVGElement } from "./internal/is.mjs";
|
|
2
|
+
import { setElementValues, updateElementValue } from "./internal/element-value.mjs";
|
|
3
|
+
import { getStyleValue } from "./internal/get-value.mjs";
|
|
4
4
|
//#region src/style.ts
|
|
5
5
|
/**
|
|
6
6
|
* Get a style from an element
|
|
@@ -99,7 +99,7 @@ function updateStyleProperty(element, key, value) {
|
|
|
99
99
|
this.style[property] = "";
|
|
100
100
|
}, false, false);
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
const ATTRIBUTE_DIRECTION = "dir";
|
|
103
|
+
const EXPRESSION_DIRECTION = /^(ltr|rtl)$/i;
|
|
104
104
|
//#endregion
|
|
105
105
|
export { getStyle, getStyles, getTextDirection, setStyle, setStyles, toggleStyles };
|
package/dist/touch.d.mts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/touch.d.ts
|
|
2
|
+
type SupporsTouch = {
|
|
3
|
+
/**
|
|
4
|
+
* Are touch events supported?
|
|
5
|
+
*/
|
|
6
|
+
readonly value: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Are touch events supported?
|
|
9
|
+
*/
|
|
10
|
+
get(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Re-evaluate if touch events are supported
|
|
13
|
+
*/
|
|
14
|
+
update(): boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Does the device support touch events?
|
|
18
|
+
*/
|
|
19
|
+
declare const supportsTouch: SupporsTouch;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { supportsTouch as default };
|
package/package.json
CHANGED
|
@@ -1,98 +1,95 @@
|
|
|
1
1
|
{
|
|
2
|
+
"name": "@oscarpalmer/toretto",
|
|
3
|
+
"version": "0.41.0",
|
|
4
|
+
"description": "A collection of badass DOM utilities.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dom",
|
|
7
|
+
"html",
|
|
8
|
+
"sanitization",
|
|
9
|
+
"utility"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
2
12
|
"author": {
|
|
3
13
|
"name": "Oscar Palmér",
|
|
4
14
|
"url": "https://oscarpalmer.se"
|
|
5
15
|
},
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"description": "A collection of badass DOM utilities.",
|
|
10
|
-
"devDependencies": {
|
|
11
|
-
"@types/node": "^25.4",
|
|
12
|
-
"@vitest/coverage-istanbul": "^4",
|
|
13
|
-
"dts-bundle-generator": "^9.5",
|
|
14
|
-
"jsdom": "^28.1",
|
|
15
|
-
"oxfmt": "^0.39",
|
|
16
|
-
"oxlint": "^1.54",
|
|
17
|
-
"rolldown": "1.0.0-rc.9",
|
|
18
|
-
"tslib": "^2.8",
|
|
19
|
-
"typescript": "^5.9",
|
|
20
|
-
"vite": "8.0.0-beta.17",
|
|
21
|
-
"vitest": "^4"
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/oscarpalmer/toretto.git"
|
|
22
19
|
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"src"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"module": "dist/index.mjs",
|
|
26
|
+
"types": "dist/index.d.mts",
|
|
23
27
|
"exports": {
|
|
24
28
|
"./package.json": "./package.json",
|
|
25
29
|
".": {
|
|
26
|
-
"types": "./
|
|
27
|
-
"default": "./dist/
|
|
30
|
+
"types": "./dist/index.d.mts",
|
|
31
|
+
"default": "./dist/index.mjs"
|
|
28
32
|
},
|
|
29
33
|
"./attribute": {
|
|
30
|
-
"types": "./
|
|
31
|
-
"default": "./dist/attribute/index.
|
|
34
|
+
"types": "./dist/attribute/index.d.mts",
|
|
35
|
+
"default": "./dist/attribute/index.mjs"
|
|
32
36
|
},
|
|
33
37
|
"./data": {
|
|
34
|
-
"types": "./
|
|
35
|
-
"default": "./dist/data.
|
|
38
|
+
"types": "./dist/data.d.mts",
|
|
39
|
+
"default": "./dist/data.mjs"
|
|
36
40
|
},
|
|
37
41
|
"./event": {
|
|
38
|
-
"types": "./
|
|
39
|
-
"default": "./dist/event/index.
|
|
42
|
+
"types": "./dist/event/index.d.mts",
|
|
43
|
+
"default": "./dist/event/index.mjs"
|
|
40
44
|
},
|
|
41
45
|
"./find": {
|
|
42
|
-
"types": "./
|
|
43
|
-
"default": "./dist/find/index.
|
|
46
|
+
"types": "./dist/find/index.d.mts",
|
|
47
|
+
"default": "./dist/find/index.mjs"
|
|
44
48
|
},
|
|
45
49
|
"./focusable": {
|
|
46
|
-
"types": "./
|
|
47
|
-
"default": "./dist/focusable.
|
|
50
|
+
"types": "./dist/focusable.d.mts",
|
|
51
|
+
"default": "./dist/focusable.mjs"
|
|
48
52
|
},
|
|
49
53
|
"./html": {
|
|
50
|
-
"types": "./
|
|
51
|
-
"default": "./dist/html/index.
|
|
54
|
+
"types": "./dist/html/index.d.mts",
|
|
55
|
+
"default": "./dist/html/index.mjs"
|
|
52
56
|
},
|
|
53
57
|
"./is": {
|
|
54
|
-
"types": "./
|
|
55
|
-
"default": "./dist/is.
|
|
58
|
+
"types": "./dist/is.d.mts",
|
|
59
|
+
"default": "./dist/is.mjs"
|
|
56
60
|
},
|
|
57
61
|
"./models": {
|
|
58
|
-
"types": "./
|
|
62
|
+
"types": "./dist/models.d.mts"
|
|
59
63
|
},
|
|
60
64
|
"./style": {
|
|
61
|
-
"types": "./
|
|
62
|
-
"default": "./dist/style.
|
|
65
|
+
"types": "./dist/style.d.mts",
|
|
66
|
+
"default": "./dist/style.mjs"
|
|
63
67
|
},
|
|
64
68
|
"./touch": {
|
|
65
|
-
"types": "./
|
|
66
|
-
"default": "./dist/touch.
|
|
69
|
+
"types": "./dist/touch.d.mts",
|
|
70
|
+
"default": "./dist/touch.mjs"
|
|
67
71
|
}
|
|
68
72
|
},
|
|
69
|
-
"files": [
|
|
70
|
-
"dist",
|
|
71
|
-
"src",
|
|
72
|
-
"types"
|
|
73
|
-
],
|
|
74
|
-
"keywords": [
|
|
75
|
-
"dom",
|
|
76
|
-
"html",
|
|
77
|
-
"sanitization",
|
|
78
|
-
"utility"
|
|
79
|
-
],
|
|
80
|
-
"license": "MIT",
|
|
81
|
-
"module": "dist/index.js",
|
|
82
|
-
"name": "@oscarpalmer/toretto",
|
|
83
|
-
"repository": {
|
|
84
|
-
"type": "git",
|
|
85
|
-
"url": "git+https://github.com/oscarpalmer/toretto.git"
|
|
86
|
-
},
|
|
87
73
|
"scripts": {
|
|
88
|
-
"build": "
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"test": "npx
|
|
74
|
+
"build": "npx vp pack && npm run tsdown:build",
|
|
75
|
+
"tsdown:build": "npx tsdown -c ./tsdown.config.ts",
|
|
76
|
+
"tsdown:watch": "npx tsdown -c ./tsdown.config.ts --watch",
|
|
77
|
+
"test": "npx vp test run --coverage",
|
|
78
|
+
"test:leak": "npx vp test run --detect-async-leaks --coverage",
|
|
93
79
|
"watch": "npx vite build --watch"
|
|
94
80
|
},
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
|
|
81
|
+
"dependencies": {
|
|
82
|
+
"@oscarpalmer/atoms": "^0.165"
|
|
83
|
+
},
|
|
84
|
+
"devDependencies": {
|
|
85
|
+
"@types/node": "^25.5",
|
|
86
|
+
"@vitest/coverage-istanbul": "^4.1",
|
|
87
|
+
"jsdom": "^28.1",
|
|
88
|
+
"tsdown": "^0.21",
|
|
89
|
+
"typescript": "^5.9",
|
|
90
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
91
|
+
"vite-plus": "latest",
|
|
92
|
+
"vitest": "npm:@voidzero-dev/vite-plus-test@latest"
|
|
93
|
+
},
|
|
94
|
+
"packageManager": "npm@11.11.1"
|
|
98
95
|
}
|
package/src/data.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {PlainObject} from '@oscarpalmer/atoms';
|
|
1
|
+
import type {PlainObject} from '@oscarpalmer/atoms/models';
|
|
2
2
|
import {parse} from '@oscarpalmer/atoms/string';
|
|
3
3
|
import {kebabCase} from '@oscarpalmer/atoms/string/case';
|
|
4
4
|
import {setElementValues, updateElementValue} from './internal/element-value';
|
package/src/find/index.ts
CHANGED
package/dist/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { isEventTarget, isHTMLOrSVGElement } from "./internal/is.js";
|
|
2
|
-
import { getAttribute, getAttributes } from "./attribute/get.js";
|
|
3
|
-
import { isChildNode, isInDocument } from "./is.js";
|
|
4
|
-
import { booleanAttributes } from "./internal/attribute.js";
|
|
5
|
-
import { setAttribute, setAttributes } from "./attribute/set.js";
|
|
6
|
-
import { isBadAttribute, isBooleanAttribute, isEmptyNonBooleanAttribute, isInvalidBooleanAttribute } from "./attribute/index.js";
|
|
7
|
-
import { getData, setData } from "./data.js";
|
|
8
|
-
import { dispatch, getPosition, off, on } from "./event/index.js";
|
|
9
|
-
import { findAncestor, findRelatives, getDistance } from "./find/relative.js";
|
|
10
|
-
import { $ as findElement, $$ as findElements, getElementUnderPointer } from "./find/index.js";
|
|
11
|
-
import { getFocusable, getTabbable, isFocusable, isTabbable } from "./focusable.js";
|
|
12
|
-
import { html, sanitize } from "./html/index.js";
|
|
13
|
-
import supportsTouch from "./touch.js";
|
|
14
|
-
import { getStyle, getStyles, getTextDirection, setStyle, setStyles, toggleStyles } from "./style.js";
|
|
15
|
-
export { findElement as $, findElement, findElements as $$, findElements, booleanAttributes, dispatch, findAncestor, findRelatives, getAttribute, getAttributes, getData, getDistance, getElementUnderPointer, getFocusable, getPosition, getStyle, getStyles, getTabbable, getTextDirection, html, isBadAttribute, isBooleanAttribute, isChildNode, isEmptyNonBooleanAttribute, isEventTarget, isFocusable, isHTMLOrSVGElement, isInDocument, isInvalidBooleanAttribute, isTabbable, off, on, sanitize, setAttribute, setAttributes, setData, setStyle, setStyles, supportsTouch, toggleStyles };
|
package/dist/models.js
DELETED
|
File without changes
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CustomEventListener, RemovableEventListener } from '../models';
|
|
2
|
-
export type EventTargetWithListeners = EventTarget & Partial<{
|
|
3
|
-
[key: string]: Set<EventListener | CustomEventListener>;
|
|
4
|
-
}>;
|
|
5
|
-
export declare function addDelegatedListener(target: EventTargetWithListeners, type: string, name: string, listener: EventListener | CustomEventListener, passive: boolean): RemovableEventListener;
|
|
6
|
-
export declare function getDelegatedName(target: EventTarget, type: string, options: AddEventListenerOptions): string | undefined;
|
|
7
|
-
export declare function removeDelegatedListener(target: EventTargetWithListeners, name: string, listener: EventListener | CustomEventListener): boolean;
|
package/types/html/index.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
type Html = {
|
|
2
|
-
/**
|
|
3
|
-
* Create nodes from an HTML string or a template element
|
|
4
|
-
* @param value HTML string or id for a template element
|
|
5
|
-
* @param options Options for creating nodes
|
|
6
|
-
* @returns Created nodes
|
|
7
|
-
*/
|
|
8
|
-
(value: string, options?: HtmlOptions): Node[];
|
|
9
|
-
/**
|
|
10
|
-
* Create nodes from a template element
|
|
11
|
-
* @param template Template element
|
|
12
|
-
* @param options Options for creating nodes
|
|
13
|
-
* @returns Created nodes
|
|
14
|
-
*/
|
|
15
|
-
(template: HTMLTemplateElement, options?: HtmlOptions): Node[];
|
|
16
|
-
/**
|
|
17
|
-
* Clear cache of template elements
|
|
18
|
-
*/
|
|
19
|
-
clear(): void;
|
|
20
|
-
/**
|
|
21
|
-
* Remove cached template element for an HTML string or id
|
|
22
|
-
* @param template HTML string or id for a template element
|
|
23
|
-
*/
|
|
24
|
-
remove(template: string): void;
|
|
25
|
-
};
|
|
26
|
-
type HtmlOptions = {
|
|
27
|
-
/**
|
|
28
|
-
* Cache template element for the HTML string? _(defaults to `true`)_
|
|
29
|
-
*/
|
|
30
|
-
cache?: boolean;
|
|
31
|
-
};
|
|
32
|
-
declare const html: Html;
|
|
33
|
-
/**
|
|
34
|
-
* Sanitize one or more nodes, recursively
|
|
35
|
-
* @param value Node or nodes to sanitize
|
|
36
|
-
* @param options Sanitization options
|
|
37
|
-
* @returns Sanitized nodes
|
|
38
|
-
*/
|
|
39
|
-
export declare function sanitize(value: Node | Node[]): Node[];
|
|
40
|
-
export { html };
|
package/types/html/sanitize.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Attribute } from '../models';
|
|
2
|
-
export declare function isAttribute(value: unknown): value is Attr | Attribute;
|
|
3
|
-
export declare function _isBadAttribute(first: unknown, second: unknown, decode: boolean): boolean;
|
|
4
|
-
export declare function _isBooleanAttribute(first: unknown, decode: boolean): boolean;
|
|
5
|
-
export declare function _isEmptyNonBooleanAttribute(first: unknown, second: unknown, decode: boolean): boolean;
|
|
6
|
-
export declare function _isInvalidBooleanAttribute(first: unknown, second: unknown, decode: boolean): boolean;
|
|
7
|
-
export declare function updateAttribute(element: Element, name: string, value: unknown, dispatch?: unknown): void;
|
|
8
|
-
/**
|
|
9
|
-
* List of boolean attributes
|
|
10
|
-
*/
|
|
11
|
-
export declare const booleanAttributes: readonly string[];
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare function setElementValue(element: Element, first: unknown, second: unknown, third: unknown, callback: (element: Element, key: string, value: unknown) => void): void;
|
|
2
|
-
export declare function setElementValues(element: Element, first: unknown, second: unknown, third: unknown, callback: (element: Element, key: string, value: unknown, dispatch?: unknown) => void): void;
|
|
3
|
-
export declare function updateElementValue(element: Element, key: string, value: unknown, set: (key: string, value: string) => void, remove: (key: string) => void, isBoolean: boolean, json: boolean): void;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function getBoolean(value: unknown, defaultValue?: boolean): boolean;
|
|
2
|
-
export declare function getAttributeValue(element: Element, name: string, parseValue: boolean): unknown;
|
|
3
|
-
export declare function getStyleValue(element: Element, property: string, computed: boolean): string | undefined;
|
|
4
|
-
export declare const EXPRESSION_DATA_PREFIX: RegExp;
|
package/types/models.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attribute for an element
|
|
3
|
-
*/
|
|
4
|
-
export type Attribute = {
|
|
5
|
-
name: string;
|
|
6
|
-
value: unknown;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Event listener for custom events
|
|
10
|
-
*/
|
|
11
|
-
export type CustomEventListener = (event: CustomEvent) => void;
|
|
12
|
-
/**
|
|
13
|
-
* The position of an event
|
|
14
|
-
*/
|
|
15
|
-
export type EventPosition = {
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Event listener that can be removed
|
|
21
|
-
*/
|
|
22
|
-
export type RemovableEventListener = () => void;
|
|
23
|
-
/**
|
|
24
|
-
* Selector that be searched for
|
|
25
|
-
*/
|
|
26
|
-
export type Selector = string | Node | Node[] | NodeList;
|
|
27
|
-
/**
|
|
28
|
-
* Text direction for an element
|
|
29
|
-
*/
|
|
30
|
-
export type TextDirection = 'ltr' | 'rtl';
|
package/types/style.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { TextDirection } from './models';
|
|
2
|
-
export type StyleToggler = {
|
|
3
|
-
/**
|
|
4
|
-
* Set the provided styles on the element
|
|
5
|
-
*/
|
|
6
|
-
set(): void;
|
|
7
|
-
/**
|
|
8
|
-
* Remove the provided styles from the element _(and sets any previous styles)_
|
|
9
|
-
*/
|
|
10
|
-
remove(): void;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Get a style from an element
|
|
14
|
-
* @param element Element to get the style from
|
|
15
|
-
* @param property Style name
|
|
16
|
-
* @param computed Get the computed style? _(defaults to `false`)_
|
|
17
|
-
* @returns Style value
|
|
18
|
-
*/
|
|
19
|
-
export declare function getStyle(element: Element, property: keyof CSSStyleDeclaration, computed?: boolean): string | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Get styles from an element
|
|
22
|
-
* @param element Element to get the styles from
|
|
23
|
-
* @param properties Styles to get
|
|
24
|
-
* @param computed Get the computed styles? _(defaults to `false`)_
|
|
25
|
-
* @returns Style values
|
|
26
|
-
*/
|
|
27
|
-
export declare function getStyles<Property extends keyof CSSStyleDeclaration>(element: Element, properties: Property[], computed?: boolean): Record<Property, string | undefined>;
|
|
28
|
-
/**
|
|
29
|
-
* Get the text direction of an element
|
|
30
|
-
* @param element Element to get the text direction from
|
|
31
|
-
* @param computed Get the computed text direction? _(defaults to `false`)_
|
|
32
|
-
* @returns Text direction
|
|
33
|
-
*/
|
|
34
|
-
export declare function getTextDirection(element: Element, computed?: boolean): TextDirection;
|
|
35
|
-
/**
|
|
36
|
-
* Set a style on an element
|
|
37
|
-
* @param element Element to set the style on
|
|
38
|
-
* @param property Style name
|
|
39
|
-
* @param value Style value
|
|
40
|
-
*/
|
|
41
|
-
export declare function setStyle(element: Element, property: keyof CSSStyleDeclaration, value?: string): void;
|
|
42
|
-
/**
|
|
43
|
-
* Set styles on an element
|
|
44
|
-
* @param element Element to set the styles on
|
|
45
|
-
* @param styles Styles to set
|
|
46
|
-
*/
|
|
47
|
-
export declare function setStyles(element: Element, styles: Partial<CSSStyleDeclaration>): void;
|
|
48
|
-
/**
|
|
49
|
-
* Toggle styles for an element
|
|
50
|
-
* @param element Element to style
|
|
51
|
-
* @param styles Styles to be set or removed
|
|
52
|
-
* @returns Style toggler
|
|
53
|
-
*/
|
|
54
|
-
export declare function toggleStyles(element: Element, styles: Partial<CSSStyleDeclaration>): StyleToggler;
|
package/types/touch.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
type SupporsTouch = {
|
|
2
|
-
/**
|
|
3
|
-
* Are touch events supported?
|
|
4
|
-
*/
|
|
5
|
-
readonly value: boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Are touch events supported?
|
|
8
|
-
*/
|
|
9
|
-
get(): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Re-evaluate if touch events are supported
|
|
12
|
-
*/
|
|
13
|
-
update(): boolean;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Does the device support touch events?
|
|
17
|
-
*/
|
|
18
|
-
declare const supportsTouch: SupporsTouch;
|
|
19
|
-
export default supportsTouch;
|
|
File without changes
|
|
File without changes
|