@oscarpalmer/toretto 0.39.1 → 0.40.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.
Files changed (54) hide show
  1. package/{types/attribute/get.d.ts → dist/attribute/get.d.mts} +6 -3
  2. package/dist/attribute/{get.js → get.mjs} +2 -2
  3. package/{types/attribute/index.d.ts → dist/attribute/index.d.mts} +16 -12
  4. package/dist/attribute/{index.js → index.mjs} +3 -3
  5. package/{types/attribute/set.d.ts → dist/attribute/set.d.mts} +10 -7
  6. package/dist/attribute/{set.js → set.mjs} +2 -2
  7. package/{types/data.d.ts → dist/data.d.mts} +9 -5
  8. package/dist/{data.js → data.mjs} +4 -4
  9. package/dist/event/delegation.d.mts +11 -0
  10. package/dist/event/{delegation.js → delegation.mjs} +8 -8
  11. package/{types/event/index.d.ts → dist/event/index.d.mts} +12 -8
  12. package/dist/event/{index.js → index.mjs} +4 -4
  13. package/{types/find/index.d.ts → dist/find/index.d.mts} +11 -8
  14. package/dist/find/{index.js → index.mjs} +7 -7
  15. package/{types/find/relative.d.ts → dist/find/relative.d.mts} +8 -5
  16. package/{types/focusable.d.ts → dist/focusable.d.mts} +7 -4
  17. package/dist/{focusable.js → focusable.mjs} +20 -20
  18. package/dist/html/index.d.mts +42 -0
  19. package/dist/html/{index.js → index.mjs} +8 -8
  20. package/dist/html/sanitize.d.mts +5 -0
  21. package/dist/html/{sanitize.js → sanitize.mjs} +4 -4
  22. package/dist/index.d.mts +531 -0
  23. package/dist/{toretto.full.js → index.mjs} +116 -24
  24. package/dist/internal/attribute.d.mts +15 -0
  25. package/dist/internal/{attribute.js → attribute.mjs} +14 -14
  26. package/dist/internal/element-value.d.mts +6 -0
  27. package/dist/internal/{element-value.js → element-value.mjs} +3 -3
  28. package/dist/internal/get-value.d.mts +7 -0
  29. package/dist/internal/{get-value.js → get-value.mjs} +1 -1
  30. package/{types/internal/is.d.ts → dist/internal/is.d.mts} +5 -2
  31. package/{types/is.d.ts → dist/is.d.mts} +8 -4
  32. package/dist/{is.js → is.mjs} +2 -2
  33. package/dist/models.d.mts +33 -0
  34. package/dist/models.mjs +1 -0
  35. package/dist/style.d.mts +58 -0
  36. package/dist/{style.js → style.mjs} +5 -5
  37. package/dist/touch.d.mts +21 -0
  38. package/dist/{touch.js → touch.mjs} +1 -1
  39. package/package.json +60 -63
  40. package/src/index.ts +5 -0
  41. package/dist/index.js +0 -12
  42. package/dist/models.js +0 -0
  43. package/types/event/delegation.d.ts +0 -7
  44. package/types/html/index.d.ts +0 -40
  45. package/types/html/sanitize.d.ts +0 -2
  46. package/types/index.d.ts +0 -428
  47. package/types/internal/attribute.d.ts +0 -11
  48. package/types/internal/element-value.d.ts +0 -3
  49. package/types/internal/get-value.d.ts +0 -4
  50. package/types/models.d.ts +0 -30
  51. package/types/style.d.ts +0 -54
  52. package/types/touch.d.ts +0 -19
  53. /package/dist/find/{relative.js → relative.mjs} +0 -0
  54. /package/dist/internal/{is.js → is.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { sanitizeNodes } from "./sanitize.js";
1
+ import { sanitizeNodes } from "./sanitize.mjs";
2
2
  import { isPlainObject } from "@oscarpalmer/atoms/is";
3
3
  //#region src/html/index.ts
4
4
  function createHtml(value) {
@@ -38,7 +38,7 @@ function getTemplate(value, options) {
38
38
  const element = EXPRESSION_ID.test(value) ? document.querySelector(`#${value}`) : null;
39
39
  return createTemplate(element instanceof HTMLTemplateElement ? element : value, options);
40
40
  }
41
- var html = ((value, options) => {
41
+ const html = ((value, options) => {
42
42
  return getNodes(value, getOptions(options));
43
43
  });
44
44
  html.clear = () => {
@@ -64,11 +64,11 @@ html.remove = (template) => {
64
64
  function sanitize(value) {
65
65
  return sanitizeNodes(Array.isArray(value) ? value : [value], 0);
66
66
  }
67
- var EXPRESSION_ID = /^[a-z][\w-]*$/i;
68
- var PARSE_TYPE_HTML = "text/html";
69
- var TEMPLATE_TAG = "template";
70
- var TEMPORARY_ELEMENT = "<toretto-temporary></toretto-temporary>";
71
- var parser;
72
- var templates = {};
67
+ const EXPRESSION_ID = /^[a-z][\w-]*$/i;
68
+ const PARSE_TYPE_HTML = "text/html";
69
+ const TEMPLATE_TAG = "template";
70
+ const TEMPORARY_ELEMENT = "<toretto-temporary></toretto-temporary>";
71
+ let parser;
72
+ let templates = {};
73
73
  //#endregion
74
74
  export { html, sanitize };
@@ -0,0 +1,5 @@
1
+ //#region src/html/sanitize.d.ts
2
+ declare function sanitizeAttributes(element: Element, attributes: Attr[]): void;
3
+ declare function sanitizeNodes(nodes: Node[], depth: number): Node[];
4
+ //#endregion
5
+ export { sanitizeAttributes, sanitizeNodes };
@@ -1,5 +1,5 @@
1
- import { _isBadAttribute, _isEmptyNonBooleanAttribute, _isInvalidBooleanAttribute } from "../internal/attribute.js";
2
- import { setAttribute } from "../attribute/set.js";
1
+ import { _isBadAttribute, _isEmptyNonBooleanAttribute, _isInvalidBooleanAttribute } from "../internal/attribute.mjs";
2
+ import { setAttribute } from "../attribute/set.mjs";
3
3
  //#region src/html/sanitize.ts
4
4
  function handleElement(element, depth) {
5
5
  if (depth === 0) {
@@ -56,7 +56,7 @@ function sanitizeNodes(nodes, depth) {
56
56
  }
57
57
  return nodes;
58
58
  }
59
- var COMMENT_HARMFUL = /<[/\w]/g;
60
- var REMOVE_SELECTOR = "script, toretto-temporary";
59
+ const COMMENT_HARMFUL = /<[/\w]/g;
60
+ const REMOVE_SELECTOR = "script, toretto-temporary";
61
61
  //#endregion
62
62
  export { sanitizeAttributes, sanitizeNodes };
@@ -0,0 +1,531 @@
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
+ //#region src/models.d.ts
22
+ /**
23
+ * Attribute for an element
24
+ */
25
+ type Attribute = {
26
+ name: string;
27
+ value: unknown;
28
+ };
29
+ /**
30
+ * Event listener for custom events
31
+ */
32
+ type CustomEventListener = (event: CustomEvent) => void;
33
+ /**
34
+ * The position of an event
35
+ */
36
+ type EventPosition = {
37
+ x: number;
38
+ y: number;
39
+ };
40
+ /**
41
+ * Event listener that can be removed
42
+ */
43
+ type RemovableEventListener = () => void;
44
+ /**
45
+ * Selector that be searched for
46
+ */
47
+ type Selector = string | Node | Node[] | NodeList;
48
+ /**
49
+ * Text direction for an element
50
+ */
51
+ type TextDirection = 'ltr' | 'rtl';
52
+ //#endregion
53
+ //#region src/internal/attribute.d.ts
54
+ /**
55
+ * List of boolean attributes
56
+ */
57
+ declare const booleanAttributes: readonly string[];
58
+ //#endregion
59
+ //#region src/attribute/get.d.ts
60
+ /**
61
+ * Get the value of a specific attribute from an element
62
+ * @param element Element to get attribute from
63
+ * @param name Attribute name
64
+ * @param parse Parse value? _(defaults to `true`)_
65
+ * @returns Attribute value _(or `undefined`)_
66
+ */
67
+ declare function getAttribute(element: Element, name: `data-${string}`, parse?: boolean): unknown;
68
+ /**
69
+ * Get the value of a specific attribute from an element
70
+ * @param element Element to get attribute from
71
+ * @param name Attribute name
72
+ * @returns Attribute value _(or `undefined`)_
73
+ */
74
+ declare function getAttribute(element: Element, name: string): unknown;
75
+ /**
76
+ * Get specific attributes from an element
77
+ * @param element Element to get attributes from
78
+ * @param names Attribute names
79
+ * @param parseData Parse data values? _(defaults to `true`)_
80
+ * @returns Object of named attributes
81
+ */
82
+ declare function getAttributes<Key extends string>(element: Element, names: Key[], parseData?: boolean): Record<Key, unknown>;
83
+ //#endregion
84
+ //#region src/attribute/set.d.ts
85
+ type DispatchedAttribute = 'checked' | 'open' | 'value';
86
+ /**
87
+ * Set an attribute on an element
88
+ *
89
+ * _(Or remove it, if value is `null` or `undefined`)_
90
+ * @param element Element for attribute
91
+ * @param name Attribute name
92
+ * @param value Attribute value
93
+ * @param dispatch Dispatch event for attribute? _(defaults to `true`)_
94
+ */
95
+ declare function setAttribute<Name extends DispatchedAttribute>(element: Element, name: Name, value?: unknown, dispatch?: boolean): void;
96
+ /**
97
+ * Set an attribute on an element
98
+ *
99
+ * _(Or remove it, if value is `null` or `undefined`)_
100
+ * @param element Element for attribute
101
+ * @param name Attribute name
102
+ * @param value Attribute value
103
+ */
104
+ declare function setAttribute(element: Element, name: string, value?: unknown): void;
105
+ /**
106
+ * Set an attribute on an element
107
+ *
108
+ * _(Or remove it, if value is `null` or `undefined`)_
109
+ * @param element Element for attribute
110
+ * @param attribute Attribute to set
111
+ * @param dispatch Dispatch event for attribute? _(defaults to `true`)_
112
+ */
113
+ declare function setAttribute(element: Element, attribute: Attr | Attribute, dispatch?: boolean): void;
114
+ /**
115
+ * Set one or more attributes on an element
116
+ *
117
+ * _(Or remove them, if their value is `null` or `undefined`)_
118
+ * @param element Element for attributes
119
+ * @param attributes Attributes to set
120
+ * @param dispatch Dispatch events for relevant attributes? _(defaults to `true`)_
121
+ */
122
+ declare function setAttributes(element: Element, attributes: Array<Attr | Attribute>, dispatch?: boolean): void;
123
+ /**
124
+ * Set one or more attributes on an element
125
+ *
126
+ * _(Or remove them, if their value is `null` or `undefined`)_
127
+ * @param element Element for attributes
128
+ * @param attributes Attributes to set
129
+ * @param dispatch Dispatch events for relevant attributes? _(defaults to `true`)_
130
+ */
131
+ declare function setAttributes(element: Element, attributes: Record<string, unknown>, dispatch?: boolean): void;
132
+ //#endregion
133
+ //#region src/attribute/index.d.ts
134
+ /**
135
+ * Is the attribute considered bad and potentially harmful?
136
+ * @param attribute Attribute to check
137
+ * @returns `true` if attribute is considered bad
138
+ */
139
+ declare function isBadAttribute(attribute: Attr | Attribute): boolean;
140
+ /**
141
+ * Is the attribute considered bad and potentially harmful?
142
+ * @param name Attribute name
143
+ * @param value Attribute value
144
+ * @returns `true` if attribute is considered bad
145
+ */
146
+ declare function isBadAttribute(name: string, value: string): boolean;
147
+ /**
148
+ * Is the attribute a boolean attribute?
149
+ * @param name Attribute to check
150
+ * @returns `true` if attribute is a boolean attribute
151
+ */
152
+ declare function isBooleanAttribute(attribute: Attr | Attribute): boolean;
153
+ /**
154
+ * Is the attribute a boolean attribute?
155
+ * @param name Attribute name
156
+ * @returns `true` if attribute is a boolean attribute
157
+ */
158
+ declare function isBooleanAttribute(name: string): boolean;
159
+ /**
160
+ * Is the attribute empty and not a boolean attribute?
161
+ * @param attribute Attribute to check
162
+ * @returns `true` if attribute is empty and not a boolean attribute
163
+ */
164
+ declare function isEmptyNonBooleanAttribute(attribute: Attr | Attribute): boolean;
165
+ /**
166
+ * Is the attribute empty and not a boolean attribute?
167
+ * @param name Attribute name
168
+ * @param value Attribute value
169
+ * @returns `true` if attribute is empty and not a boolean attribute
170
+ */
171
+ declare function isEmptyNonBooleanAttribute(name: string, value: string): boolean;
172
+ /**
173
+ * Is the attribute an invalid boolean attribute?
174
+ *
175
+ * _(I.e., its value is not empty or the same as its name)_
176
+ * @param attribute Attribute to check
177
+ * @returns `true` if attribute is an invalid boolean attribute
178
+ */
179
+ declare function isInvalidBooleanAttribute(attribute: Attr | Attribute): boolean;
180
+ /**
181
+ * Is the attribute an invalid boolean attribute?
182
+ *
183
+ * _(I.e., its value is not empty or the same as its name)_
184
+ * @param name Attribute name
185
+ * @param value Attribute value
186
+ * @returns `true` if attribute is an invalid boolean attribute
187
+ */
188
+ declare function isInvalidBooleanAttribute(name: string, value: string): boolean;
189
+ //#endregion
190
+ //#region node_modules/@oscarpalmer/atoms/dist/index.d.mts
191
+ /**
192
+ * A generic object
193
+ */
194
+ type PlainObject = Record<PropertyKey, unknown>;
195
+ /**
196
+ * A primitive value
197
+ *
198
+ * _(Thanks, type-fest!)_
199
+ */
200
+ //#endregion
201
+ //#region src/data.d.ts
202
+ /**
203
+ * Get a keyed data value from an element
204
+ * @param element Element to get data from
205
+ * @param key Data key
206
+ * @param parse Parse values? _(defaults to `true`)_
207
+ * @returns Data value
208
+ */
209
+ declare function getData(element: Element, key: string, parse?: boolean): unknown;
210
+ /**
211
+ * Get keyed data values from an element
212
+ * @param element Element to get data from
213
+ * @param keys Keys of the data values to get
214
+ * @param parse Parse values? _(defaults to `true`)_
215
+ * @returns Keyed data values
216
+ */
217
+ declare function getData<Key extends string>(element: Element, keys: Key[], parse?: boolean): Record<Key, unknown>;
218
+ /**
219
+ * Set data values on an element
220
+ * @param element Element to set data on
221
+ * @param data Data to set
222
+ */
223
+ declare function setData(element: Element, data: PlainObject): void;
224
+ /**
225
+ * Set a data value on an element
226
+ * @param element Element to set data on
227
+ * @param key Data key
228
+ * @param value Data value
229
+ */
230
+ declare function setData(element: Element, key: string, value: unknown): void;
231
+ //#endregion
232
+ //#region src/event/index.d.ts
233
+ /**
234
+ * Dispatch an event for a target
235
+ * @param target Event target
236
+ * @param type Type of event
237
+ * @param options Options for event _(bubbles and is cancelable by default)_
238
+ */
239
+ declare function dispatch<Type extends keyof HTMLElementEventMap>(target: EventTarget, type: Type, options?: CustomEventInit): void;
240
+ /**
241
+ * Dispatch an event for a target
242
+ * @param target Event target
243
+ * @param type Type of event
244
+ * @param options Options for event _(bubbles and is cancelable by default)_
245
+ */
246
+ declare function dispatch(target: EventTarget, type: string, options?: CustomEventInit): void;
247
+ /**
248
+ * Get the X- and Y-coordinates from a pointer event
249
+ * @param event Pointer event
250
+ * @returns X- and Y-coordinates
251
+ */
252
+ declare function getPosition(event: MouseEvent | TouchEvent): EventPosition | undefined;
253
+ /**
254
+ * Remove an event listener
255
+ * @param target Event target
256
+ * @param type Type of event
257
+ * @param listener Event listener
258
+ * @param options Options for event
259
+ */
260
+ declare function off(target: EventTarget, type: keyof HTMLElementEventMap, listener: EventListener | CustomEventListener, options?: EventListenerOptions): void;
261
+ /**
262
+ * Remove an event listener
263
+ * @param target Event target
264
+ * @param type Type of event
265
+ * @param listener Event listener
266
+ * @param options Options for event
267
+ */
268
+ declare function off(target: EventTarget, type: string, listener: EventListener | CustomEventListener, options?: EventListenerOptions): void;
269
+ /**
270
+ * Add an event listener
271
+ * @param target Event target
272
+ * @param type Type of event
273
+ * @param listener Event listener
274
+ * @param options Options for event _(passive by default)_
275
+ */
276
+ declare function on<Type extends keyof HTMLElementEventMap>(target: EventTarget, type: Type, listener: (event: HTMLElementEventMap[Type]) => void, options?: AddEventListenerOptions): RemovableEventListener;
277
+ /**
278
+ * Add an event listener
279
+ * @param target Event target
280
+ * @param type Type of event
281
+ * @param listener Event listener
282
+ * @param options Options for event _(passive by default)_
283
+ */
284
+ declare function on(target: EventTarget, type: string, listener: EventListener | CustomEventListener, options?: AddEventListenerOptions): RemovableEventListener;
285
+ //#endregion
286
+ //#region src/find/relative.d.ts
287
+ /**
288
+ * Find the closest ancestor element that matches the tag name
289
+ *
290
+ * - If no match is found, `null` is returned
291
+ * - _(If you want to search upwards, downwards, and sideways, use {@link findRelatives})_
292
+ * @param origin Origin to start from
293
+ * @param tagName Tag name to match
294
+ * @returns Found ancestor or `null`
295
+ */
296
+ declare function findAncestor<TagName extends keyof HTMLElementTagNameMap>(origin: Element | Event | EventTarget, tagName: TagName): HTMLElementTagNameMap[TagName] | null;
297
+ /**
298
+ * Find the closest ancestor element that matches the selector _(string or callback)_
299
+ *
300
+ * - If no match is found, `null` is returned
301
+ * - _(If you want to search upwards, downwards, and sideways, use {@link findRelatives})_
302
+ * @param origin Origin to start from
303
+ * @param selector Selector to match
304
+ * @returns Found ancestor or `null`
305
+ */
306
+ declare function findAncestor(origin: Element | Event | EventTarget, selector: string | ((element: Element) => boolean)): Element | null;
307
+ /**
308
+ * Finds the closest elements to the origin element that matches the tag name
309
+ *
310
+ * Traverses up, down, and sideways in the _DOM_-tree. _(If you only want to traverse up, use {@link findAncestor})_
311
+ * @param origin Element to start from
312
+ * @param tagName Tag name to match
313
+ * @param context Context to search within
314
+ * @returns Found elements
315
+ */
316
+ declare function findRelatives<TagName extends keyof HTMLElementTagNameMap>(origin: Element, tagName: TagName, context?: Document | Element): HTMLElementTagNameMap[TagName][];
317
+ /**
318
+ * Finds the closest elements to the origin element that matches the selector
319
+ *
320
+ * Traverses up, down, and sideways in the _DOM_-tree. _(If you only want to traverse up, use {@link findAncestor})_
321
+ * @param origin Element to start from
322
+ * @param selector Selector to match
323
+ * @param context Context to search within
324
+ * @returns Found elements
325
+ */
326
+ declare function findRelatives(origin: Element, selector: string, context?: Document | Element): Element[];
327
+ /**
328
+ * Get the distance between two elements _(i.e., the amount of nodes of between them)_
329
+ * @param origin Origin element
330
+ * @param target Target element
331
+ * @returns Distance between elements, or `-1` if distance cannot be calculated
332
+ */
333
+ declare function getDistance(origin: Element, target: Element): number;
334
+ //#endregion
335
+ //#region src/find/index.d.ts
336
+ /**
337
+ * Find the first element that matches the tag name
338
+ * @param tagName Tag name of element to find
339
+ * @param context Context to search within _(defaults to `document`)_
340
+ * @returns Found element or `null`
341
+ */
342
+ declare function findElement<TagName extends keyof HTMLElementTagNameMap>(tagName: TagName, context?: Selector | null): HTMLElementTagNameMap[TagName] | null;
343
+ /**
344
+ * Find the first element that matches the selector
345
+ * @param selector Selector to find element for
346
+ * @param context Context to search within _(defaults to `document`)_
347
+ * @returns Found element or `null`
348
+ */
349
+ declare function findElement(selector: string, context?: Selector | null): Element | null;
350
+ /**
351
+ * Find elements that match the selector
352
+ * @param tagName tagName to find elements for
353
+ * @param context Context to search within _(defaults to `document`)_
354
+ * @returns Found elements
355
+ */
356
+ declare function findElements(tagName: keyof HTMLElementTagNameMap, context?: Selector | null): HTMLElementTagNameMap[typeof tagName][];
357
+ /**
358
+ * Find elements that match the selector
359
+ * @param selector Selector to find elements for
360
+ * @param context Context to search within _(defaults to `document`)_
361
+ * @returns Found elements
362
+ */
363
+ declare function findElements(selector: Selector, context?: Selector | null): Element[];
364
+ /**
365
+ * Get the most specific element under the pointer
366
+ *
367
+ * - Ignores elements with `pointer-events: none` and `visibility: hidden`
368
+ * - _(If `skipIgnore` is `true`, no elements are ignored)_
369
+ * @param skipIgnore Skip ignored elements?
370
+ * @returns Found element or `null`
371
+ */
372
+ declare function getElementUnderPointer(skipIgnore?: boolean): Element | null;
373
+ //#endregion
374
+ //#region src/focusable.d.ts
375
+ /**
376
+ * Get a list of focusable elements within a parent element
377
+ * @param parent Parent element
378
+ * @returns Focusable elements
379
+ */
380
+ declare function getFocusable(parent: Element): Element[];
381
+ /**
382
+ * Get a list of tabbable elements within a parent element
383
+ * @param parent Parent element
384
+ * @returns Tabbable elements
385
+ */
386
+ declare function getTabbable(parent: Element): Element[];
387
+ /**
388
+ * Is the element focusable?
389
+ * @param element Element to check
390
+ * @returns `true` if focusable, otherwise `false`
391
+ */
392
+ declare function isFocusable(element: Element): boolean;
393
+ /**
394
+ * Is the element tabbable?
395
+ * @param element Element to check
396
+ * @returns `true` if tabbable, otherwise `false`
397
+ */
398
+ declare function isTabbable(element: Element): boolean;
399
+ //#endregion
400
+ //#region src/html/index.d.ts
401
+ type Html = {
402
+ /**
403
+ * Create nodes from an HTML string or a template element
404
+ * @param value HTML string or id for a template element
405
+ * @param options Options for creating nodes
406
+ * @returns Created nodes
407
+ */
408
+ (value: string, options?: HtmlOptions): Node[];
409
+ /**
410
+ * Create nodes from a template element
411
+ * @param template Template element
412
+ * @param options Options for creating nodes
413
+ * @returns Created nodes
414
+ */
415
+ (template: HTMLTemplateElement, options?: HtmlOptions): Node[];
416
+ /**
417
+ * Clear cache of template elements
418
+ */
419
+ clear(): void;
420
+ /**
421
+ * Remove cached template element for an HTML string or id
422
+ * @param template HTML string or id for a template element
423
+ */
424
+ remove(template: string): void;
425
+ };
426
+ type HtmlOptions = {
427
+ /**
428
+ * Cache template element for the HTML string? _(defaults to `true`)_
429
+ */
430
+ cache?: boolean;
431
+ };
432
+ declare const html: Html;
433
+ /**
434
+ * Sanitize one or more nodes, recursively
435
+ * @param value Node or nodes to sanitize
436
+ * @param options Sanitization options
437
+ * @returns Sanitized nodes
438
+ */
439
+ declare function sanitize(value: Node | Node[]): Node[];
440
+ //#endregion
441
+ //#region src/internal/is.d.ts
442
+ /**
443
+ * Is the value an event target?
444
+ * @param value Value to check
445
+ * @returns `true` if it's an event target, otherwise `false`
446
+ */
447
+ declare function isEventTarget(value: unknown): value is EventTarget;
448
+ /**
449
+ * Is the value an HTML or SVG element?
450
+ * @param value Value to check
451
+ * @returns `true` if it's an HTML or SVG element, otherwise `false`
452
+ */
453
+ declare function isHTMLOrSVGElement(value: unknown): value is HTMLElement | SVGElement;
454
+ //#endregion
455
+ //#region src/is.d.ts
456
+ /**
457
+ * Is the value a child node?
458
+ * @param value Value to check
459
+ * @returns `true` if it's a child node, otherwise `false`
460
+ */
461
+ declare function isChildNode(value: unknown): value is ChildNode;
462
+ /**
463
+ * Is the node inside a document?
464
+ * @param node Node to check
465
+ * @returns `true` if it's inside a document, otherwise `false`
466
+ */
467
+ declare function isInDocument(node: Node): boolean;
468
+ /**
469
+ * Is the node inside a specific document?
470
+ * @param node Node to check
471
+ * @param document Document to check within
472
+ * @returns `true` if it's inside the document, otherwise `false`
473
+ */
474
+ declare function isInDocument(node: Node, document: Document): boolean;
475
+ //#endregion
476
+ //#region src/style.d.ts
477
+ type StyleToggler = {
478
+ /**
479
+ * Set the provided styles on the element
480
+ */
481
+ set(): void;
482
+ /**
483
+ * Remove the provided styles from the element _(and sets any previous styles)_
484
+ */
485
+ remove(): void;
486
+ };
487
+ /**
488
+ * Get a style from an element
489
+ * @param element Element to get the style from
490
+ * @param property Style name
491
+ * @param computed Get the computed style? _(defaults to `false`)_
492
+ * @returns Style value
493
+ */
494
+ declare function getStyle(element: Element, property: keyof CSSStyleDeclaration, computed?: boolean): string | undefined;
495
+ /**
496
+ * Get styles from an element
497
+ * @param element Element to get the styles from
498
+ * @param properties Styles to get
499
+ * @param computed Get the computed styles? _(defaults to `false`)_
500
+ * @returns Style values
501
+ */
502
+ declare function getStyles<Property extends keyof CSSStyleDeclaration>(element: Element, properties: Property[], computed?: boolean): Record<Property, string | undefined>;
503
+ /**
504
+ * Get the text direction of an element
505
+ * @param element Element to get the text direction from
506
+ * @param computed Get the computed text direction? _(defaults to `false`)_
507
+ * @returns Text direction
508
+ */
509
+ declare function getTextDirection(element: Element, computed?: boolean): TextDirection;
510
+ /**
511
+ * Set a style on an element
512
+ * @param element Element to set the style on
513
+ * @param property Style name
514
+ * @param value Style value
515
+ */
516
+ declare function setStyle(element: Element, property: keyof CSSStyleDeclaration, value?: string): void;
517
+ /**
518
+ * Set styles on an element
519
+ * @param element Element to set the styles on
520
+ * @param styles Styles to set
521
+ */
522
+ declare function setStyles(element: Element, styles: Partial<CSSStyleDeclaration>): void;
523
+ /**
524
+ * Toggle styles for an element
525
+ * @param element Element to style
526
+ * @param styles Styles to be set or removed
527
+ * @returns Style toggler
528
+ */
529
+ declare function toggleStyles(element: Element, styles: Partial<CSSStyleDeclaration>): StyleToggler;
530
+ //#endregion
531
+ export { findElement as $, findElement, findElements as $$, findElements, Attribute, CustomEventListener, EventPosition, RemovableEventListener, Selector, StyleToggler, TextDirection, 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 };