@magnet-js/common 0.1.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/LICENSE +21 -0
- package/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +57 -0
- package/esm/common.d.ts +80 -0
- package/esm/common.d.ts.map +1 -0
- package/esm/common.js +22 -0
- package/esm/dom/aria.d.ts +266 -0
- package/esm/dom/aria.d.ts.map +1 -0
- package/esm/dom/aria.js +87 -0
- package/esm/dom/globalAttributes.d.ts +95 -0
- package/esm/dom/globalAttributes.d.ts.map +1 -0
- package/esm/dom/globalAttributes.js +1 -0
- package/esm/dom/html.d.ts +1008 -0
- package/esm/dom/html.d.ts.map +1 -0
- package/esm/dom/html.js +84 -0
- package/esm/dom/mathML.d.ts +213 -0
- package/esm/dom/mathML.d.ts.map +1 -0
- package/esm/dom/mathML.js +47 -0
- package/esm/dom/shadowable.d.ts +24 -0
- package/esm/dom/shadowable.d.ts.map +1 -0
- package/esm/dom/shadowable.js +31 -0
- package/esm/dom/svg.d.ts +884 -0
- package/esm/dom/svg.d.ts.map +1 -0
- package/esm/dom/svg.js +61 -0
- package/esm/mod.d.ts +8 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +7 -0
- package/esm/package.json +3 -0
- package/package.json +23 -0
- package/script/_dnt.shims.d.ts +2 -0
- package/script/_dnt.shims.d.ts.map +1 -0
- package/script/_dnt.shims.js +60 -0
- package/script/common.d.ts +80 -0
- package/script/common.d.ts.map +1 -0
- package/script/common.js +53 -0
- package/script/dom/aria.d.ts +266 -0
- package/script/dom/aria.d.ts.map +1 -0
- package/script/dom/aria.js +91 -0
- package/script/dom/globalAttributes.d.ts +95 -0
- package/script/dom/globalAttributes.d.ts.map +1 -0
- package/script/dom/globalAttributes.js +2 -0
- package/script/dom/html.d.ts +1008 -0
- package/script/dom/html.d.ts.map +1 -0
- package/script/dom/html.js +90 -0
- package/script/dom/mathML.d.ts +213 -0
- package/script/dom/mathML.d.ts.map +1 -0
- package/script/dom/mathML.js +53 -0
- package/script/dom/shadowable.d.ts +24 -0
- package/script/dom/shadowable.d.ts.map +1 -0
- package/script/dom/shadowable.js +35 -0
- package/script/dom/svg.d.ts +884 -0
- package/script/dom/svg.d.ts.map +1 -0
- package/script/dom/svg.js +67 -0
- package/script/mod.d.ts +8 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +23 -0
- package/script/package.json +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Fernando G. Vilar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const dntGlobals = {};
|
|
2
|
+
export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
3
|
+
function createMergeProxy(baseObj, extObj) {
|
|
4
|
+
return new Proxy(baseObj, {
|
|
5
|
+
get(_target, prop, _receiver) {
|
|
6
|
+
if (prop in extObj) {
|
|
7
|
+
return extObj[prop];
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return baseObj[prop];
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
set(_target, prop, value) {
|
|
14
|
+
if (prop in extObj) {
|
|
15
|
+
delete extObj[prop];
|
|
16
|
+
}
|
|
17
|
+
baseObj[prop] = value;
|
|
18
|
+
return true;
|
|
19
|
+
},
|
|
20
|
+
deleteProperty(_target, prop) {
|
|
21
|
+
let success = false;
|
|
22
|
+
if (prop in extObj) {
|
|
23
|
+
delete extObj[prop];
|
|
24
|
+
success = true;
|
|
25
|
+
}
|
|
26
|
+
if (prop in baseObj) {
|
|
27
|
+
delete baseObj[prop];
|
|
28
|
+
success = true;
|
|
29
|
+
}
|
|
30
|
+
return success;
|
|
31
|
+
},
|
|
32
|
+
ownKeys(_target) {
|
|
33
|
+
const baseKeys = Reflect.ownKeys(baseObj);
|
|
34
|
+
const extKeys = Reflect.ownKeys(extObj);
|
|
35
|
+
const extKeysSet = new Set(extKeys);
|
|
36
|
+
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
37
|
+
},
|
|
38
|
+
defineProperty(_target, prop, desc) {
|
|
39
|
+
if (prop in extObj) {
|
|
40
|
+
delete extObj[prop];
|
|
41
|
+
}
|
|
42
|
+
Reflect.defineProperty(baseObj, prop, desc);
|
|
43
|
+
return true;
|
|
44
|
+
},
|
|
45
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
46
|
+
if (prop in extObj) {
|
|
47
|
+
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
has(_target, prop) {
|
|
54
|
+
return prop in extObj || prop in baseObj;
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
package/esm/common.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Falsy } from "@std/assert";
|
|
2
|
+
/** Either a read-only or writable reactive signal. */
|
|
3
|
+
export type AnySignal<T> = Computed<T> | State<T>;
|
|
4
|
+
/** Disposes a subscription, effect, or other resource. */
|
|
5
|
+
export interface Cleanup {
|
|
6
|
+
(): unknown | void;
|
|
7
|
+
}
|
|
8
|
+
/** Reactive value that can be read synchronously. */
|
|
9
|
+
export interface Computed<T> {
|
|
10
|
+
get(): T;
|
|
11
|
+
}
|
|
12
|
+
/** Creates a reactive value derived from other signals. */
|
|
13
|
+
export interface Compute {
|
|
14
|
+
<T>(computer: () => T, options?: SignalOptions<T>): Computed<T>;
|
|
15
|
+
}
|
|
16
|
+
/** Plain object whose values all share the same type and keys are strings. */
|
|
17
|
+
export type Dict<T> = Record<string, T>;
|
|
18
|
+
/** Runs a side-effect whenever its reactive dependencies change. */
|
|
19
|
+
export interface Effect {
|
|
20
|
+
(callback: EffectCallback): Cleanup;
|
|
21
|
+
}
|
|
22
|
+
/** Body of a reactive effect; may return a cleanup function. */
|
|
23
|
+
export interface EffectCallback {
|
|
24
|
+
(): Maybe<Cleanup>;
|
|
25
|
+
}
|
|
26
|
+
/** Determines whether an unknown value is a signal. */
|
|
27
|
+
export interface IsSignal {
|
|
28
|
+
(value: unknown): value is AnySignal<unknown>;
|
|
29
|
+
}
|
|
30
|
+
export type Letter = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
|
|
31
|
+
/** Value that may be missing or void. */
|
|
32
|
+
export type Maybe<T> = T | null | undefined | void;
|
|
33
|
+
/** Single value or a list of the same value. */
|
|
34
|
+
export type MaybeArray<T> = T | T[];
|
|
35
|
+
/** Plain value or a reactive wrapper of that value. */
|
|
36
|
+
export type MaybeComputed<T> = T | Computed<T>;
|
|
37
|
+
/** Plain value or a recursive array of the same value. */
|
|
38
|
+
export type MaybeNestedArray<T> = T | NestedArray<T>;
|
|
39
|
+
/** Plain value or a recursive array of reactive values. */
|
|
40
|
+
export type MaybeNestedSignals<T> = MaybeSignal<T> | MaybeNestedSignals<T>[];
|
|
41
|
+
/** Plain value or any reactive wrapper of that value. */
|
|
42
|
+
export type MaybeSignal<T> = T | AnySignal<T>;
|
|
43
|
+
/** Array that may contain more arrays of the same item type. */
|
|
44
|
+
export type NestedArray<T> = (T | NestedArray<T>)[];
|
|
45
|
+
/** Complete signal implementation exposed as a single dependency. */
|
|
46
|
+
export interface SignalAPI {
|
|
47
|
+
isSignal: IsSignal;
|
|
48
|
+
effect: Effect;
|
|
49
|
+
state: Store;
|
|
50
|
+
computed: Compute;
|
|
51
|
+
/** Synchronously drains any pending reactive effects. */
|
|
52
|
+
flush: () => void;
|
|
53
|
+
}
|
|
54
|
+
/** Customizes how a signal compares new values to previous ones. */
|
|
55
|
+
export interface SignalOptions<T> {
|
|
56
|
+
equals?: (this: AnySignal<T>, v1: T, v2: T) => boolean;
|
|
57
|
+
}
|
|
58
|
+
/** Reactive value that can be read and updated. */
|
|
59
|
+
export interface State<T> extends Computed<T> {
|
|
60
|
+
set(v: T): unknown;
|
|
61
|
+
}
|
|
62
|
+
/** Creates a reactive, writable value. */
|
|
63
|
+
export interface Store {
|
|
64
|
+
<T>(initialValue: T, options?: SignalOptions<T>): State<T>;
|
|
65
|
+
}
|
|
66
|
+
export declare const XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
67
|
+
export declare const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
68
|
+
export declare const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
69
|
+
/** Detects whether the current environment has a DOM. */
|
|
70
|
+
export declare const browser: () => boolean;
|
|
71
|
+
/** Creates a dictionary object with no inherited properties. */
|
|
72
|
+
export declare const createEmpty: <T = object>() => T;
|
|
73
|
+
/** Checks whether a value is an array. */
|
|
74
|
+
export declare const isArray: <T>(value: unknown) => value is T[];
|
|
75
|
+
/** Checks whether a value is callable. */
|
|
76
|
+
export declare const isFunction: (value: unknown) => value is (...args: unknown[]) => unknown;
|
|
77
|
+
/** Checks whether a value is a string. */
|
|
78
|
+
export declare const isString: (value: unknown) => value is string;
|
|
79
|
+
export type { Falsy };
|
|
80
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,sDAAsD;AACtD,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAElD,0DAA0D;AAC1D,MAAM,WAAW,OAAO;IACtB,IAAI,OAAO,GAAG,IAAI,CAAC;CACpB;AAED,qDAAqD;AACrD,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,GAAG,IAAI,CAAC,CAAC;CACV;AAED,2DAA2D;AAC3D,MAAM,WAAW,OAAO;IACtB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;CACjE;AAED,8EAA8E;AAC9E,MAAM,MAA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O,KAAG,KAAK,IAAI,CAAC,EAChC,CAAC;AAEvB,0CAA0C;AAC1C,eAAO,MAAM,UAAU,UACd,OAAO,KACb,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAsC,CAAC;AAE3E,0CAA0C;AAC1C,eAAO,MAAM,QAAQ,UAAW,OAAO,KAAG,KAAK,IAAI,MACxB,CAAC;AAE5B,YAAY,EAAE,KAAK,EAAE,CAAC"}
|
package/esm/common.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as dntShim from "./_dnt.shims.js";
|
|
2
|
+
export const XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
3
|
+
export const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
4
|
+
export const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
5
|
+
/** Detects whether the current environment has a DOM. */
|
|
6
|
+
export const browser = () => {
|
|
7
|
+
try {
|
|
8
|
+
const { document } = dntShim.dntGlobalThis;
|
|
9
|
+
return typeof document?.createElement === "function";
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/** Creates a dictionary object with no inherited properties. */
|
|
16
|
+
export const createEmpty = () => Object.create(null);
|
|
17
|
+
/** Checks whether a value is an array. */
|
|
18
|
+
export const isArray = (value) => Array.isArray(value);
|
|
19
|
+
/** Checks whether a value is callable. */
|
|
20
|
+
export const isFunction = (value) => typeof value === "function";
|
|
21
|
+
/** Checks whether a value is a string. */
|
|
22
|
+
export const isString = (value) => typeof value === "string";
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import type { MaybeSignal } from "../common.js";
|
|
2
|
+
import type { Absent } from "./globalAttributes.js";
|
|
3
|
+
/**
|
|
4
|
+
* WAI-ARIA attributes that can be applied to HTML elements.
|
|
5
|
+
*
|
|
6
|
+
* Each property maps to a kebab-case (except for `role`) ARIA attribute.
|
|
7
|
+
* Values may be the attribute's allowed token, a boolean-ish string, `false`
|
|
8
|
+
* to explicitly remove the attribute, or omitted/`null`/`undefined`
|
|
9
|
+
* to leave it unset.
|
|
10
|
+
*
|
|
11
|
+
* @see https://www.w3.org/TR/wai-aria/#states_and_properties
|
|
12
|
+
*/
|
|
13
|
+
export interface AriaAttributes {
|
|
14
|
+
/**
|
|
15
|
+
* Identifies the currently active element when DOM focus is on a composite widget, textbox,
|
|
16
|
+
* group, or application.
|
|
17
|
+
*/
|
|
18
|
+
"aria-activedescendant"?: MaybeSignal<string | Absent>;
|
|
19
|
+
/**
|
|
20
|
+
* Indicates whether assistive technologies will present all, or only parts of, the changed
|
|
21
|
+
* region based on the change notifications defined by the aria-relevant attribute.
|
|
22
|
+
*/
|
|
23
|
+
"aria-atomic"?: MaybeSignal<"false" | "true" | Absent>;
|
|
24
|
+
/**
|
|
25
|
+
* Defines a string value that labels the current element, which is intended to be converted
|
|
26
|
+
* into Braille.
|
|
27
|
+
*/
|
|
28
|
+
"aria-braillelabel"?: MaybeSignal<string | Absent>;
|
|
29
|
+
/**
|
|
30
|
+
* Defines a human-readable, author-localized abbreviated description for the role of an
|
|
31
|
+
* element intended to be converted into Braille.
|
|
32
|
+
*/
|
|
33
|
+
"aria-brailleroledescription"?: MaybeSignal<string | Absent>;
|
|
34
|
+
/**
|
|
35
|
+
* Indicates whether inputting text could trigger display of one or more predictions of the
|
|
36
|
+
* user's intended value for an input and specifies how predictions would be presented if they
|
|
37
|
+
* are made.
|
|
38
|
+
*/
|
|
39
|
+
"aria-autocomplete"?: MaybeSignal<"none" | "inline" | "list" | "both" | Absent>;
|
|
40
|
+
/**
|
|
41
|
+
* Indicates an element is being modified and that assistive technologies MAY want to wait until
|
|
42
|
+
* the modifications are complete before exposing them to the user.
|
|
43
|
+
*/
|
|
44
|
+
"aria-busy"?: MaybeSignal<"false" | "true" | Absent>;
|
|
45
|
+
/**
|
|
46
|
+
* Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
|
|
47
|
+
*/
|
|
48
|
+
"aria-checked"?: MaybeSignal<"false" | "mixed" | "true" | Absent>;
|
|
49
|
+
/**
|
|
50
|
+
* Defines the total number of columns in a table, grid, or treegrid.
|
|
51
|
+
*/
|
|
52
|
+
"aria-colcount"?: MaybeSignal<number | Absent>;
|
|
53
|
+
/**
|
|
54
|
+
* Defines an element's column index or position with respect to the total number of columns
|
|
55
|
+
* within a table, grid, or treegrid.
|
|
56
|
+
*/
|
|
57
|
+
"aria-colindex"?: MaybeSignal<number | Absent>;
|
|
58
|
+
/** Defines a human-readable text alternative of the numeric aria-colindex. */
|
|
59
|
+
"aria-colindextext"?: MaybeSignal<string | Absent>;
|
|
60
|
+
/**
|
|
61
|
+
* Defines the number of columns spanned by a cell or gridcell within a table, grid, or
|
|
62
|
+
* treegrid.
|
|
63
|
+
*/
|
|
64
|
+
"aria-colspan"?: MaybeSignal<number | Absent>;
|
|
65
|
+
/**
|
|
66
|
+
* Identifies the element (or elements) whose contents or presence are controlled by the current
|
|
67
|
+
* element.
|
|
68
|
+
*/
|
|
69
|
+
"aria-controls"?: MaybeSignal<string | Absent>;
|
|
70
|
+
/**
|
|
71
|
+
* Indicates the element that represents the current item within a container or set of related
|
|
72
|
+
* elements.
|
|
73
|
+
*/
|
|
74
|
+
"aria-current"?: MaybeSignal<"false" | "true" | "page" | "step" | "location" | "date" | "time" | Absent>;
|
|
75
|
+
/**
|
|
76
|
+
* Identifies the element (or elements) that describes the object.
|
|
77
|
+
*/
|
|
78
|
+
"aria-describedby"?: MaybeSignal<string | Absent>;
|
|
79
|
+
/**
|
|
80
|
+
* Defines a string value that describes or annotates the current element.
|
|
81
|
+
*/
|
|
82
|
+
"aria-description"?: MaybeSignal<string | Absent>;
|
|
83
|
+
/**
|
|
84
|
+
* Identifies the element that provides a detailed, extended description for the object.
|
|
85
|
+
*/
|
|
86
|
+
"aria-details"?: MaybeSignal<string | Absent>;
|
|
87
|
+
/**
|
|
88
|
+
* Indicates that the element is perceivable but disabled, so it is not editable or otherwise
|
|
89
|
+
* operable.
|
|
90
|
+
*/
|
|
91
|
+
"aria-disabled"?: MaybeSignal<"false" | "true" | Absent>;
|
|
92
|
+
/**
|
|
93
|
+
* Indicates what functions can be performed when a dragged object is released on the drop
|
|
94
|
+
* target.
|
|
95
|
+
*
|
|
96
|
+
* @deprecated in ARIA 1.1
|
|
97
|
+
*/
|
|
98
|
+
"aria-dropeffect"?: MaybeSignal<"none" | "copy" | "execute" | "link" | "move" | "popup" | Absent>;
|
|
99
|
+
/**
|
|
100
|
+
* Identifies the element that provides an error message for the object.
|
|
101
|
+
*/
|
|
102
|
+
"aria-errormessage"?: MaybeSignal<string | Absent>;
|
|
103
|
+
/**
|
|
104
|
+
* Indicates whether the element, or another grouping element it controls, is currently expanded
|
|
105
|
+
* or collapsed.
|
|
106
|
+
*/
|
|
107
|
+
"aria-expanded"?: MaybeSignal<"false" | "true" | Absent>;
|
|
108
|
+
/**
|
|
109
|
+
* Identifies the next element (or elements) in an alternate reading order of content which, at
|
|
110
|
+
* the user's discretion, allows assistive technology to override the general default of reading
|
|
111
|
+
* in document source order.
|
|
112
|
+
*/
|
|
113
|
+
"aria-flowto"?: MaybeSignal<string | Absent>;
|
|
114
|
+
/**
|
|
115
|
+
* Indicates an element's "grabbed" state in a drag-and-drop operation.
|
|
116
|
+
*
|
|
117
|
+
* @deprecated in ARIA 1.1
|
|
118
|
+
*/
|
|
119
|
+
"aria-grabbed"?: MaybeSignal<"false" | "true" | Absent>;
|
|
120
|
+
/**
|
|
121
|
+
* Indicates the availability and type of interactive popup element, such as menu or dialog,
|
|
122
|
+
* that can be triggered by an element.
|
|
123
|
+
*/
|
|
124
|
+
"aria-haspopup"?: MaybeSignal<"false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | Absent>;
|
|
125
|
+
/**
|
|
126
|
+
* Indicates whether the element is exposed to an accessibility API.
|
|
127
|
+
*/
|
|
128
|
+
"aria-hidden"?: MaybeSignal<"false" | "true" | Absent>;
|
|
129
|
+
/**
|
|
130
|
+
* Indicates the entered value does not conform to the format expected by the application.
|
|
131
|
+
*/
|
|
132
|
+
"aria-invalid"?: MaybeSignal<"false" | "true" | "grammar" | "spelling" | Absent>;
|
|
133
|
+
/**
|
|
134
|
+
* Indicates keyboard shortcuts that an author has implemented to activate or give focus to an
|
|
135
|
+
* element.
|
|
136
|
+
*/
|
|
137
|
+
"aria-keyshortcuts"?: MaybeSignal<string | Absent>;
|
|
138
|
+
/**
|
|
139
|
+
* Defines a string value that labels the current element.
|
|
140
|
+
*/
|
|
141
|
+
"aria-label"?: MaybeSignal<string | Absent>;
|
|
142
|
+
/**
|
|
143
|
+
* Identifies the element (or elements) that labels the current element.
|
|
144
|
+
*/
|
|
145
|
+
"aria-labelledby"?: MaybeSignal<string | Absent>;
|
|
146
|
+
/** Defines the hierarchical level of an element within a structure. */
|
|
147
|
+
"aria-level"?: MaybeSignal<number | Absent>;
|
|
148
|
+
/**
|
|
149
|
+
* Indicates that an element will be updated, and describes the types of updates the user
|
|
150
|
+
* agents, assistive technologies, and user can expect from the live region.
|
|
151
|
+
*/
|
|
152
|
+
"aria-live"?: MaybeSignal<"off" | "assertive" | "polite" | Absent>;
|
|
153
|
+
/** Indicates whether an element is modal when displayed. */
|
|
154
|
+
"aria-modal"?: MaybeSignal<"false" | "true" | Absent>;
|
|
155
|
+
/** Indicates whether a text box accepts multiple lines of input or only a single line. */
|
|
156
|
+
"aria-multiline"?: MaybeSignal<"false" | "true" | Absent>;
|
|
157
|
+
/**
|
|
158
|
+
* Indicates that the user may select more than one item from the current selectable
|
|
159
|
+
* descendants.
|
|
160
|
+
*/
|
|
161
|
+
"aria-multiselectable"?: MaybeSignal<"false" | "true" | Absent>;
|
|
162
|
+
/** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */
|
|
163
|
+
"aria-orientation"?: MaybeSignal<"horizontal" | "vertical" | "undefined" | Absent>;
|
|
164
|
+
/**
|
|
165
|
+
* Identifies an element (or elements) in order to define a visual, functional, or contextual
|
|
166
|
+
* parent/child relationship between DOM elements where the DOM hierarchy cannot be used to
|
|
167
|
+
* represent the relationship.
|
|
168
|
+
*/
|
|
169
|
+
"aria-owns"?: MaybeSignal<string | Absent>;
|
|
170
|
+
/**
|
|
171
|
+
* Defines a short hint (a word or short phrase) intended to aid the user with data entry when
|
|
172
|
+
* the control has no value.
|
|
173
|
+
*/
|
|
174
|
+
"aria-placeholder"?: MaybeSignal<string | Absent>;
|
|
175
|
+
/**
|
|
176
|
+
* Defines an element's number or position in the current set of listitems or treeitems.
|
|
177
|
+
*/
|
|
178
|
+
"aria-posinset"?: MaybeSignal<number | Absent>;
|
|
179
|
+
/**
|
|
180
|
+
* Indicates the current "pressed" state of toggle buttons.
|
|
181
|
+
*/
|
|
182
|
+
"aria-pressed"?: MaybeSignal<"false" | "mixed" | "true" | Absent>;
|
|
183
|
+
/**
|
|
184
|
+
* Indicates that the element is not editable, but is otherwise operable.
|
|
185
|
+
*/
|
|
186
|
+
"aria-readonly"?: MaybeSignal<"false" | "true" | Absent>;
|
|
187
|
+
/**
|
|
188
|
+
* Indicates what notifications the user agent will trigger when the accessibility tree within a
|
|
189
|
+
* live region is modified.
|
|
190
|
+
*
|
|
191
|
+
* Valid `aria-relevant` values: a space-separated token list, or the shorthand `all`.
|
|
192
|
+
*
|
|
193
|
+
* @see https://www.w3.org/TR/wai-aria/#aria-relevant
|
|
194
|
+
*/
|
|
195
|
+
"aria-relevant"?: MaybeSignal<"all" | `additions${"" | ` removals${"" | " text"}` | ` text${"" | " removals"}`}` | `removals${"" | ` additions${"" | " text"}` | ` text${"" | " additions"}`}` | `text${"" | ` removals${"" | " additions"}` | ` additions${"" | " removals"}`}` | ("additions" | "removals" | "text")[] | Absent>;
|
|
196
|
+
/** Indicates that user input is required on the element before a form may be submitted. */
|
|
197
|
+
"aria-required"?: MaybeSignal<"false" | "true" | Absent>;
|
|
198
|
+
/** Defines a human-readable, author-localized description for the role of an element. */
|
|
199
|
+
"aria-roledescription"?: MaybeSignal<string | Absent>;
|
|
200
|
+
/**
|
|
201
|
+
* Defines the total number of rows in a table, grid, or treegrid.
|
|
202
|
+
*/
|
|
203
|
+
"aria-rowcount"?: MaybeSignal<number | Absent>;
|
|
204
|
+
/**
|
|
205
|
+
* Defines an element's row index or position with respect to the total number of rows within a
|
|
206
|
+
* table, grid, or treegrid.
|
|
207
|
+
*/
|
|
208
|
+
"aria-rowindex"?: MaybeSignal<number | Absent>;
|
|
209
|
+
/** Defines a human-readable text alternative of aria-rowindex. */
|
|
210
|
+
"aria-rowindextext"?: MaybeSignal<number | string | Absent>;
|
|
211
|
+
/**
|
|
212
|
+
* Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
|
|
213
|
+
*/
|
|
214
|
+
"aria-rowspan"?: MaybeSignal<number | Absent>;
|
|
215
|
+
/**
|
|
216
|
+
* Indicates the current "selected" state of various widgets.
|
|
217
|
+
*/
|
|
218
|
+
"aria-selected"?: MaybeSignal<"false" | "true" | Absent>;
|
|
219
|
+
/**
|
|
220
|
+
* Defines the number of items in the current set of `listitems` or `treeitems`.
|
|
221
|
+
*/
|
|
222
|
+
"aria-setsize"?: MaybeSignal<number | Absent>;
|
|
223
|
+
/** Indicates if items in a table or grid are sorted in ascending or descending order. */
|
|
224
|
+
"aria-sort"?: MaybeSignal<"none" | "ascending" | "descending" | "other" | Absent>;
|
|
225
|
+
/** Defines the maximum allowed value for a range widget. */
|
|
226
|
+
"aria-valuemax"?: MaybeSignal<number | Absent>;
|
|
227
|
+
/** Defines the minimum allowed value for a range widget. */
|
|
228
|
+
"aria-valuemin"?: MaybeSignal<number | Absent>;
|
|
229
|
+
/**
|
|
230
|
+
* Defines the current value for a range widget.
|
|
231
|
+
*/
|
|
232
|
+
"aria-valuenow"?: MaybeSignal<number | Absent>;
|
|
233
|
+
/** Defines the human readable text alternative of aria-valuenow for a range widget. */
|
|
234
|
+
"aria-valuetext"?: MaybeSignal<string | Absent>;
|
|
235
|
+
/** Defines an explicit role for the element. */
|
|
236
|
+
role?: MaybeSignal<AriaRole | Absent>;
|
|
237
|
+
}
|
|
238
|
+
/** Union of all supported ARIA attribute names. */
|
|
239
|
+
export type AriaAttributeKey = keyof AriaAttributes;
|
|
240
|
+
/**
|
|
241
|
+
* ARIA attributes that are allowed on elements where naming is prohibited.
|
|
242
|
+
*
|
|
243
|
+
* This excludes `aria-label` and `aria-labelledby` because those attributes
|
|
244
|
+
* provide an accessible name, which must not be used on purely presentational
|
|
245
|
+
* or otherwise naming-prohibited elements.
|
|
246
|
+
*/
|
|
247
|
+
export type NamingNotAllowed = Exclude<AriaAttributeKey, "aria-label" | "aria-labelledby">;
|
|
248
|
+
/**
|
|
249
|
+
* Canonical list of WAI-ARIA roles defined in the specification.
|
|
250
|
+
*
|
|
251
|
+
* The array is declared `as const` so its elements can be used to derive the
|
|
252
|
+
* {@link AriaRole} string literal type.
|
|
253
|
+
*
|
|
254
|
+
* @see https://www.w3.org/TR/wai-aria/#role_definitions
|
|
255
|
+
*/
|
|
256
|
+
export declare const ARIA_ROLES: readonly ["alert", "alertdialog", "application", "article", "banner", "button", "cell", "checkbox", "columnheader", "combobox", "complementary", "contentinfo", "definition", "dialog", "directory", "document", "feed", "figure", "form", "grid", "gridcell", "group", "heading", "img", "link", "list", "listbox", "listitem", "log", "main", "marquee", "math", "menu", "menubar", "menuitem", "menuitemcheckbox", "menuitemradio", "meter", "navigation", "none", "note", "option", "presentation", "progressbar", "radio", "radiogroup", "region", "row", "rowgroup", "rowheader", "scrollbar", "search", "searchbox", "separator", "slider", "spinbutton", "status", "switch", "tab", "table", "tablist", "tabpanel", "term", "textbox", "timer", "toolbar", "tooltip", "tree", "treegrid", "treeitem"];
|
|
257
|
+
/** Any single role name from the WAI-ARIA role definitions. */
|
|
258
|
+
export type AriaRole = (typeof ARIA_ROLES)[number];
|
|
259
|
+
/**
|
|
260
|
+
* Determines whether a value is one of the known ARIA roles.
|
|
261
|
+
*
|
|
262
|
+
* @param role - The value to check.
|
|
263
|
+
* @returns `true` if `role` is a valid ARIA role.
|
|
264
|
+
*/
|
|
265
|
+
export declare const isAriaRole: (role: unknown) => role is AriaRole;
|
|
266
|
+
//# sourceMappingURL=aria.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aria.d.ts","sourceRoot":"","sources":["../../src/dom/aria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,uBAAuB,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACvD;;;OAGG;IACH,aAAa,CAAC,EAAE,WAAW,CAAC,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;IACvD;;;OAGG;IACH,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACnD;;;OAGG;IACH,6BAA6B,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7D;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,WAAW,CAC/B,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAC7C,CAAC;IACF;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;IACrD;;OAEG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;IAClE;;OAEG;IACH,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC/C;;;OAGG;IACH,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC/C,8EAA8E;I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ARIA roles defined in the specification.
|
|
3
|
+
*
|
|
4
|
+
* The array is declared `as const` so its elements can be used to derive the
|
|
5
|
+
* {@link AriaRole} string literal type.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.w3.org/TR/wai-aria/#role_definitions
|
|
8
|
+
*/
|
|
9
|
+
export const ARIA_ROLES = [
|
|
10
|
+
"alert",
|
|
11
|
+
"alertdialog",
|
|
12
|
+
"application",
|
|
13
|
+
"article",
|
|
14
|
+
"banner",
|
|
15
|
+
"button",
|
|
16
|
+
"cell",
|
|
17
|
+
"checkbox",
|
|
18
|
+
"columnheader",
|
|
19
|
+
"combobox",
|
|
20
|
+
"complementary",
|
|
21
|
+
"contentinfo",
|
|
22
|
+
"definition",
|
|
23
|
+
"dialog",
|
|
24
|
+
"directory",
|
|
25
|
+
"document",
|
|
26
|
+
"feed",
|
|
27
|
+
"figure",
|
|
28
|
+
"form",
|
|
29
|
+
"grid",
|
|
30
|
+
"gridcell",
|
|
31
|
+
"group",
|
|
32
|
+
"heading",
|
|
33
|
+
"img",
|
|
34
|
+
"link",
|
|
35
|
+
"list",
|
|
36
|
+
"listbox",
|
|
37
|
+
"listitem",
|
|
38
|
+
"log",
|
|
39
|
+
"main",
|
|
40
|
+
"marquee",
|
|
41
|
+
"math",
|
|
42
|
+
"menu",
|
|
43
|
+
"menubar",
|
|
44
|
+
"menuitem",
|
|
45
|
+
"menuitemcheckbox",
|
|
46
|
+
"menuitemradio",
|
|
47
|
+
"meter",
|
|
48
|
+
"navigation",
|
|
49
|
+
"none",
|
|
50
|
+
"note",
|
|
51
|
+
"option",
|
|
52
|
+
"presentation",
|
|
53
|
+
"progressbar",
|
|
54
|
+
"radio",
|
|
55
|
+
"radiogroup",
|
|
56
|
+
"region",
|
|
57
|
+
"row",
|
|
58
|
+
"rowgroup",
|
|
59
|
+
"rowheader",
|
|
60
|
+
"scrollbar",
|
|
61
|
+
"search",
|
|
62
|
+
"searchbox",
|
|
63
|
+
"separator",
|
|
64
|
+
"slider",
|
|
65
|
+
"spinbutton",
|
|
66
|
+
"status",
|
|
67
|
+
"switch",
|
|
68
|
+
"tab",
|
|
69
|
+
"table",
|
|
70
|
+
"tablist",
|
|
71
|
+
"tabpanel",
|
|
72
|
+
"term",
|
|
73
|
+
"textbox",
|
|
74
|
+
"timer",
|
|
75
|
+
"toolbar",
|
|
76
|
+
"tooltip",
|
|
77
|
+
"tree",
|
|
78
|
+
"treegrid",
|
|
79
|
+
"treeitem",
|
|
80
|
+
];
|
|
81
|
+
/**
|
|
82
|
+
* Determines whether a value is one of the known ARIA roles.
|
|
83
|
+
*
|
|
84
|
+
* @param role - The value to check.
|
|
85
|
+
* @returns `true` if `role` is a valid ARIA role.
|
|
86
|
+
*/
|
|
87
|
+
export const isAriaRole = (role) => ARIA_ROLES.includes(role);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Cleanup, Letter, Maybe, MaybeArray, MaybeSignal } from "../common.js";
|
|
2
|
+
export type Absent = false | null | undefined;
|
|
3
|
+
export interface Action<T> {
|
|
4
|
+
(element: T, connected: boolean): Maybe<Cleanup>;
|
|
5
|
+
}
|
|
6
|
+
/** Valid tag name for a custom HTML element. */
|
|
7
|
+
export type CustomElementName = `${Letter}${Lowercase<string>}-${Letter}${Lowercase<string>}`;
|
|
8
|
+
/** Data attribute name. */
|
|
9
|
+
export type DataAttribute = `data-${string}`;
|
|
10
|
+
export type EventListenerKey = `on${keyof GlobalEventHandlersEventMap}`;
|
|
11
|
+
export interface Listener<T, E> {
|
|
12
|
+
(this: T, event: E): unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface ListenerObject<E> extends AddEventListenerOptions {
|
|
15
|
+
handleEvent(event: E): unknown;
|
|
16
|
+
prevent?: boolean;
|
|
17
|
+
stop?: boolean;
|
|
18
|
+
stopImmediate?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export type EventHandler<T, E> = string | Listener<T, E> | ListenerObject<E> | Absent;
|
|
21
|
+
export type Listeners<T> = {
|
|
22
|
+
[K in keyof GlobalEventHandlersEventMap as `on${K}`]?: MaybeSignal<MaybeArray<EventHandler<T, GlobalEventHandlersEventMap[K]>>>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* HTML global attributes shared by all elements.
|
|
26
|
+
*
|
|
27
|
+
* @see https://html.spec.whatwg.org/multipage/dom.html#global-attributes
|
|
28
|
+
*/
|
|
29
|
+
export interface HTMLGlobalAttributes<T> extends Listeners<T> {
|
|
30
|
+
/** Keyboard shortcut(s) to activate or focus the element. */
|
|
31
|
+
accesskey?: MaybeSignal<string | Absent>;
|
|
32
|
+
/** Controls whether and how text input is automatically capitalized. */
|
|
33
|
+
autocapitalize?: MaybeSignal<"none" | "off" | "on" | "sentences" | "words" | "characters" | Absent>;
|
|
34
|
+
/** Controls whether and how text input is automatically corrected. */
|
|
35
|
+
autocorrect?: MaybeSignal<"" | "on" | "off" | boolean | Absent>;
|
|
36
|
+
/** Focuses the element automatically when the document is loaded. */
|
|
37
|
+
autofocus?: MaybeSignal<"" | boolean | Absent>;
|
|
38
|
+
/** CSS classes to apply to the element; may be a single string or a list. */
|
|
39
|
+
class?: MaybeSignal<string[] | string | Absent>;
|
|
40
|
+
/** Indicates whether the element's content is editable. */
|
|
41
|
+
contenteditable?: MaybeSignal<"" | "true" | "false" | "inherit" | "plaintext-only" | boolean | Absent>;
|
|
42
|
+
/** Custom `data-*` attributes. */
|
|
43
|
+
[k: DataAttribute]: MaybeSignal<(string | number | bigint | Absent)[] | string | bigint | number | Absent>;
|
|
44
|
+
/** Text directionality of the element's content. */
|
|
45
|
+
dir?: MaybeSignal<"ltr" | "rtl" | "auto" | Absent>;
|
|
46
|
+
/** Whether the element is draggable. */
|
|
47
|
+
draggable?: MaybeSignal<"true" | "false" | Absent>;
|
|
48
|
+
/** Hint for the action label of the Enter key on virtual keyboards. */
|
|
49
|
+
enterkeyhint?: MaybeSignal<"enter" | "done" | "go" | "next" | "previous" | "search" | "send" | Absent>;
|
|
50
|
+
/** Hides the element from the accessibility tree and rendering. */
|
|
51
|
+
hidden?: MaybeSignal<"" | "hidden" | "until-found" | boolean | Absent>;
|
|
52
|
+
/** Unique identifier for the element within the document. */
|
|
53
|
+
id?: MaybeSignal<string | Absent>;
|
|
54
|
+
/** Makes the element and its descendants inert to user input and accessibility. */
|
|
55
|
+
inert?: MaybeSignal<"" | boolean | Absent>;
|
|
56
|
+
/** Hint for selecting a virtual keyboard layout. */
|
|
57
|
+
inputmode?: MaybeSignal<"none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url" | Absent>;
|
|
58
|
+
/** Customized built-in element type name for the `is` attribute. */
|
|
59
|
+
is?: MaybeSignal<CustomElementName | Absent>;
|
|
60
|
+
/** Global identifier of the element's microdata item. */
|
|
61
|
+
itemid?: MaybeSignal<string | Absent>;
|
|
62
|
+
/** Names of the element's microdata properties. */
|
|
63
|
+
itemprop?: MaybeSignal<string | Absent>;
|
|
64
|
+
/** IDs of elements that supply additional microdata property values. */
|
|
65
|
+
itemref?: MaybeSignal<string | Absent>;
|
|
66
|
+
/** Creates a microdata item with the element as its scope. */
|
|
67
|
+
itemscope?: MaybeSignal<"" | boolean | Absent>;
|
|
68
|
+
/** URLs identifying the type(s) of the microdata item. */
|
|
69
|
+
itemtype?: MaybeSignal<string | Absent>;
|
|
70
|
+
/** Language of the element's content. */
|
|
71
|
+
lang?: MaybeSignal<string | Absent>;
|
|
72
|
+
/** Cryptographic nonce for inline style or script content. */
|
|
73
|
+
nonce?: MaybeSignal<string | Absent>;
|
|
74
|
+
/** Names of the element's exportable shadow parts. */
|
|
75
|
+
part?: MaybeSignal<string | Absent>;
|
|
76
|
+
/** Turns the element into a popover control. */
|
|
77
|
+
popover?: MaybeSignal<"auto" | "hint" | "manual" | Absent>;
|
|
78
|
+
/** Name of the shadow DOM slot the element is assigned to. */
|
|
79
|
+
slot?: MaybeSignal<string | Absent>;
|
|
80
|
+
/** Whether the element's content is checked for spelling errors. */
|
|
81
|
+
spellcheck?: MaybeSignal<"" | "true" | "false" | boolean | Absent>;
|
|
82
|
+
/** Inline CSS styles for the element. */
|
|
83
|
+
style?: MaybeSignal<string | Absent>;
|
|
84
|
+
/** Whether the element is focusable and its relative tab order. */
|
|
85
|
+
tabindex?: MaybeSignal<"" | "0" | "-1" | number | boolean | Absent>;
|
|
86
|
+
/** Advisory information displayed as a tooltip. */
|
|
87
|
+
title?: MaybeSignal<string | Absent>;
|
|
88
|
+
/** Whether the element's translatable attributes and text nodes should be translated. */
|
|
89
|
+
translate?: MaybeSignal<"" | "yes" | "no" | boolean | Absent>;
|
|
90
|
+
/** Controls whether virtual keyboards appear when the element is focused. */
|
|
91
|
+
virtualkeyboardpolicy?: MaybeSignal<"" | "auto" | "manual" | boolean | Absent>;
|
|
92
|
+
/** Whether the browser may offer writing suggestions for the element. */
|
|
93
|
+
writingsuggestions?: MaybeSignal<"false" | "true" | Absent>;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=globalAttributes.d.ts.map
|