amateras 0.2.0 → 0.4.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/README.md +25 -7
- package/ext/css/README.md +19 -0
- package/ext/css/src/index.ts +395 -322
- package/ext/css/src/lib/colorAssign.ts +6 -0
- package/ext/css/src/lib/colors/amber.ts +25 -0
- package/ext/css/src/lib/colors/blackwhite.ts +13 -0
- package/ext/css/src/lib/colors/blue.ts +25 -0
- package/ext/css/src/lib/colors/cyan.ts +25 -0
- package/ext/css/src/lib/colors/emerald.ts +25 -0
- package/ext/css/src/lib/colors/fuchsia.ts +25 -0
- package/ext/css/src/lib/colors/gray.ts +25 -0
- package/ext/css/src/lib/colors/green.ts +25 -0
- package/ext/css/src/lib/colors/indigo.ts +25 -0
- package/ext/css/src/lib/colors/lime.ts +25 -0
- package/ext/css/src/lib/colors/neutral.ts +25 -0
- package/ext/css/src/lib/colors/orange.ts +25 -0
- package/ext/css/src/lib/colors/pink.ts +25 -0
- package/ext/css/src/lib/colors/purple.ts +25 -0
- package/ext/css/src/lib/colors/red.ts +25 -0
- package/ext/css/src/lib/colors/rose.ts +25 -0
- package/ext/css/src/lib/colors/sky.ts +25 -0
- package/ext/css/src/lib/colors/slate.ts +25 -0
- package/ext/css/src/lib/colors/stone.ts +25 -0
- package/ext/css/src/lib/colors/teal.ts +25 -0
- package/ext/css/src/lib/colors/violet.ts +25 -0
- package/ext/css/src/lib/colors/yellow.ts +25 -0
- package/ext/css/src/lib/colors/zinc.ts +25 -0
- package/ext/css/src/lib/colors.ts +23 -0
- package/ext/css/src/structure/$CSSContainerRule.ts +13 -0
- package/ext/css/src/structure/$CSSKeyframesRule.ts +1 -5
- package/ext/css/src/structure/$CSSMediaRule.ts +3 -23
- package/ext/css/src/structure/$CSSRule.ts +6 -18
- package/ext/css/src/structure/$CSSStyleRule.ts +5 -14
- package/ext/css/src/structure/$CSSVariable.ts +3 -3
- package/ext/html/html.ts +1 -13
- package/ext/html/node/$Anchor.ts +31 -1
- package/ext/html/node/$Image.ts +54 -1
- package/ext/html/node/$Input.ts +154 -1
- package/ext/html/node/$OptGroup.ts +8 -1
- package/ext/html/node/$Option.ts +25 -1
- package/ext/html/node/$Select.ts +61 -1
- package/ext/i18n/README.md +53 -0
- package/ext/i18n/package.json +10 -0
- package/ext/i18n/src/index.ts +54 -0
- package/ext/i18n/src/node/I18nText.ts +35 -0
- package/ext/i18n/src/structure/I18n.ts +40 -0
- package/ext/i18n/src/structure/I18nDictionary.ts +31 -0
- package/ext/markdown/index.ts +123 -0
- package/ext/router/index.ts +13 -4
- package/ext/router/node/Page.ts +1 -0
- package/ext/router/node/Route.ts +4 -3
- package/ext/router/node/Router.ts +62 -17
- package/ext/router/node/RouterAnchor.ts +1 -1
- package/ext/ssr/index.ts +7 -5
- package/ext/ui/lib/VirtualScroll.ts +24 -0
- package/ext/ui/node/Accordian.ts +97 -0
- package/ext/ui/node/Tabs.ts +114 -0
- package/ext/ui/node/Toast.ts +16 -0
- package/ext/ui/node/Waterfall.ts +73 -0
- package/ext/ui/package.json +11 -0
- package/package.json +6 -7
- package/src/core.ts +36 -19
- package/src/global.ts +4 -0
- package/src/lib/assign.ts +12 -12
- package/src/lib/assignHelper.ts +2 -2
- package/src/lib/chain.ts +3 -0
- package/src/lib/debounce.ts +7 -0
- package/src/lib/env.ts +2 -0
- package/src/lib/native.ts +22 -24
- package/src/lib/randomId.ts +1 -1
- package/src/lib/sleep.ts +1 -1
- package/src/node/$Element.ts +301 -35
- package/src/node/$HTMLElement.ts +94 -1
- package/src/node/$Node.ts +148 -54
- package/src/node/$Virtual.ts +58 -0
- package/src/{node/node.ts → node.ts} +2 -4
- package/src/structure/Signal.ts +3 -3
- package/ext/css/src/structure/$CSSKeyframeRule.ts +0 -14
package/src/node/$Element.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Signal } from "#structure/Signal";
|
|
2
2
|
import { $Node } from "#node/$Node";
|
|
3
|
-
import { _Array_from, _instanceof, _Object_assign, _Object_entries, _Object_fromEntries,
|
|
3
|
+
import { _Array_from, _instanceof, _Object_assign, _Object_entries, _Object_fromEntries, isNull, isString, isUndefined } from "#lib/native";
|
|
4
|
+
import { _document } from "#lib/env";
|
|
4
5
|
|
|
5
|
-
export class $Element<Ele extends Element = Element> extends $Node {
|
|
6
|
+
export class $Element<Ele extends Element = Element, EvMap = ElementEventMap> extends $Node {
|
|
6
7
|
declare node: Ele
|
|
7
8
|
constructor(resolver: Ele | string) {
|
|
8
9
|
super(_instanceof(resolver, Element) ? resolver : createNode(resolver) as unknown as Ele)
|
|
@@ -12,72 +13,64 @@ export class $Element<Ele extends Element = Element> extends $Node {
|
|
|
12
13
|
|
|
13
14
|
attr(): {[key: string]: string};
|
|
14
15
|
attr(key: string): string | null;
|
|
15
|
-
attr(obj: {[key: string]: string | number | boolean | Signal<any>}): this;
|
|
16
|
-
attr(resolver?: {[key: string]: string | number | boolean | Signal<any>} | string) {
|
|
17
|
-
if (!arguments.length) return _Object_fromEntries(_Array_from(this.
|
|
18
|
-
if (isString(resolver)) return this.
|
|
16
|
+
attr(obj: {[key: string]: string | number | boolean | Signal<any> | null}): this;
|
|
17
|
+
attr(resolver?: {[key: string]: string | number | boolean | Signal<any> | null} | string) {
|
|
18
|
+
if (!arguments.length) return _Object_fromEntries(_Array_from(this.attributes).map(attr => [attr.name, attr.value]));
|
|
19
|
+
if (isString(resolver)) return this.getAttribute(resolver);
|
|
19
20
|
if (resolver) for (let [key, value] of _Object_entries(resolver)) {
|
|
20
|
-
const set = (value: any) => !isUndefined(value) && this.
|
|
21
|
+
const set = (value: any) => !isUndefined(value) && isNull(value) ? this.removeAttribute(key) : this.setAttribute(key, `${value}`)
|
|
21
22
|
if (_instanceof(value, Signal)) value = value.subscribe(set).value();
|
|
22
23
|
set(value);
|
|
23
24
|
}
|
|
24
25
|
return this;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
class(...token: string[]) {
|
|
28
|
-
this.
|
|
28
|
+
class(...token: (string | null | undefined)[]) {
|
|
29
|
+
this.classList(token.filter(isString).join(' '));
|
|
29
30
|
return this;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
addClass(...token: string[]) {
|
|
33
|
-
this.
|
|
33
|
+
addClass(...token: (string | null | undefined)[]) {
|
|
34
|
+
this.classList().add(...token.filter(isString));
|
|
34
35
|
return this;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
removeClass(...token: string[]) {
|
|
38
|
-
this.
|
|
38
|
+
removeClass(...token: (string | null | undefined)[]) {
|
|
39
|
+
this.classList().remove(...token.filter(isString));
|
|
39
40
|
return this;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
on<K extends keyof EvMap, Ev extends EvMap[K]>(type: K, listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | AddEventListenerOptions) {
|
|
44
|
+
this.addEventListener(type as string, listener as any, options);
|
|
44
45
|
return this;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
this.
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
off<K extends keyof HTMLElementEventMap>(type: K, listener: $EventListener<Ele> | $EventListenerObject<Ele>, options?: boolean | EventListenerOptions) {
|
|
53
|
-
this.node.removeEventListener(type, listener as EventListener, options);
|
|
48
|
+
off<K extends keyof EvMap, Ev extends EvMap[K]>(type: K, listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | EventListenerOptions) {
|
|
49
|
+
this.removeEventListener(type as string, listener as any, options);
|
|
54
50
|
return this;
|
|
55
51
|
}
|
|
56
52
|
|
|
57
|
-
once<K extends keyof
|
|
58
|
-
|
|
59
|
-
this.off(type, handler, options);
|
|
60
|
-
isFunction(listener) ? listener(event as any) : listener.handleEvent(event as any);
|
|
61
|
-
}
|
|
62
|
-
this.on(type, handler, options);
|
|
63
|
-
return this;
|
|
53
|
+
once<K extends keyof EvMap, Ev extends EvMap[K]>(type: K, listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | AddEventListenerOptions) {
|
|
54
|
+
return this.on(type, listener, {once: true})
|
|
64
55
|
}
|
|
65
56
|
|
|
66
57
|
toString() {
|
|
67
|
-
return this.
|
|
58
|
+
return this.outerHTML();
|
|
68
59
|
}
|
|
69
60
|
}
|
|
70
61
|
|
|
71
|
-
export type $Event<E extends Element> =
|
|
72
|
-
export type $EventListener<E extends Element> = (event: $Event<E>) => void;
|
|
73
|
-
export type $EventListenerObject<E extends Element> = { handleEvent(object: $Event<E>): void; }
|
|
62
|
+
export type $Event<E extends $Element, Ev = any> = Ev & {currentTarget: {$: E}};
|
|
63
|
+
export type $EventListener<E extends $Element, Ev> = (event: $Event<E, Ev>) => void;
|
|
64
|
+
export type $EventListenerObject<E extends $Element, Ev> = { handleEvent(object: $Event<E, Ev>): void; }
|
|
74
65
|
|
|
75
66
|
function createNode(nodeName: string) {
|
|
67
|
+
return !_document
|
|
76
68
|
//@ts-expect-error
|
|
77
|
-
|
|
69
|
+
? new Node(nodeName) as unknown as Node & ChildNode
|
|
70
|
+
: _document.createElement(nodeName);
|
|
78
71
|
}
|
|
79
72
|
|
|
80
|
-
export interface $Element<Ele extends Element> {
|
|
73
|
+
export interface $Element<Ele extends Element, EvMap> {
|
|
81
74
|
/** {@link Element.attributes} */
|
|
82
75
|
readonly attributes: NamedNodeMap;
|
|
83
76
|
/** {@link Element.clientHeight} */
|
|
@@ -106,6 +99,131 @@ export interface $Element<Ele extends Element> {
|
|
|
106
99
|
readonly shadowRoot: ShadowRoot | null;
|
|
107
100
|
/** {@link Element.tagName} */
|
|
108
101
|
readonly tagName: string;
|
|
102
|
+
/** {@link Element.nextElementSibling} */
|
|
103
|
+
readonly nextElementSibling: Element | null;
|
|
104
|
+
/** {@link Element.previousElementSibling} */
|
|
105
|
+
readonly previousElementSibling: Element | null;
|
|
106
|
+
/** {@link Element.childElementCount} */
|
|
107
|
+
readonly childElementCount: number;
|
|
108
|
+
/** {@link Element.children} */
|
|
109
|
+
readonly children: HTMLCollection;
|
|
110
|
+
/** {@link Element.firstElementChild} */
|
|
111
|
+
readonly firstElementChild: Element | null;
|
|
112
|
+
/** {@link Element.lastElementChild} */
|
|
113
|
+
readonly lastElementChild: Element | null;
|
|
114
|
+
/** {@link Element.assignedSlot} */
|
|
115
|
+
readonly assignedSlot: HTMLSlotElement | null;
|
|
116
|
+
|
|
117
|
+
/** {@link Element.attachShadow} */
|
|
118
|
+
attachShadow(init: ShadowRootInit): ShadowRoot;
|
|
119
|
+
/** {@link Element.checkVisibility} */
|
|
120
|
+
checkVisibility(options?: CheckVisibilityOptions): boolean;
|
|
121
|
+
/** {@link Element.closest} */
|
|
122
|
+
closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;
|
|
123
|
+
closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;
|
|
124
|
+
closest<K extends keyof MathMLElementTagNameMap>(selector: K): MathMLElementTagNameMap[K] | null;
|
|
125
|
+
closest<E extends Element = Element>(selectors: string): E | null;
|
|
126
|
+
/** {@link Element.computedStyleMap} */
|
|
127
|
+
computedStyleMap(): StylePropertyMapReadOnly;
|
|
128
|
+
/** {@link Element.getAttribute} */
|
|
129
|
+
getAttribute(qualifiedName: string): string | null;
|
|
130
|
+
/** {@link Element.getAttributeNS} */
|
|
131
|
+
getAttributeNS(namespace: string | null, localName: string): string | null;
|
|
132
|
+
/** {@link Element.getAttributeNames} */
|
|
133
|
+
getAttributeNames(): string[];
|
|
134
|
+
/** {@link Element.getAttributeNode} */
|
|
135
|
+
getAttributeNode(qualifiedName: string): Attr | null;
|
|
136
|
+
/** {@link Element.getAttributeNodeNS} */
|
|
137
|
+
getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
|
|
138
|
+
/** {@link Element.getBoundingClientRect} */
|
|
139
|
+
getBoundingClientRect(): DOMRect;
|
|
140
|
+
/** {@link Element.getClientRects} */
|
|
141
|
+
getClientRects(): DOMRectList;
|
|
142
|
+
/** {@link Element.getElementsByClassName} */
|
|
143
|
+
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
|
144
|
+
/** {@link Element.getElementsByTagName} */
|
|
145
|
+
getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
|
|
146
|
+
getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
|
|
147
|
+
getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;
|
|
148
|
+
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
|
|
149
|
+
/** {@link Element.getElementsByTagNameNS} */
|
|
150
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
|
|
151
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
|
|
152
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>;
|
|
153
|
+
getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
|
|
154
|
+
/** {@link Element.getHTML} */
|
|
155
|
+
getHTML(options?: GetHTMLOptions): string;
|
|
156
|
+
/** {@link Element.hasAttribute} */
|
|
157
|
+
hasAttribute(qualifiedName: string): boolean;
|
|
158
|
+
/** {@link Element.hasAttributeNS} */
|
|
159
|
+
hasAttributeNS(namespace: string | null, localName: string): boolean;
|
|
160
|
+
/** {@link Element.hasAttributes} */
|
|
161
|
+
hasAttributes(): boolean;
|
|
162
|
+
/** {@link Element.hasPointerCapture} */
|
|
163
|
+
hasPointerCapture(pointerId: number): boolean;
|
|
164
|
+
/** {@link Element.insertAdjacentElement} */
|
|
165
|
+
insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
|
|
166
|
+
/** {@link Element.insertAdjacentHTML} */
|
|
167
|
+
insertAdjacentHTML(position: InsertPosition, string: string): this;
|
|
168
|
+
/** {@link Element.insertAdjacentText} */
|
|
169
|
+
insertAdjacentText(where: InsertPosition, data: string): this;
|
|
170
|
+
/** {@link Element.matches} */
|
|
171
|
+
matches(selectors: string): boolean;
|
|
172
|
+
/** {@link Element.releasePointerCapture} */
|
|
173
|
+
releasePointerCapture(pointerId: number): this;
|
|
174
|
+
/** {@link Element.removeAttribute} */
|
|
175
|
+
removeAttribute(qualifiedName: string): this;
|
|
176
|
+
/** {@link Element.removeAttributeNS} */
|
|
177
|
+
removeAttributeNS(namespace: string | null, localName: string): this;
|
|
178
|
+
/** {@link Element.removeAttributeNode} */
|
|
179
|
+
removeAttributeNode(attr: Attr): Attr;
|
|
180
|
+
/** {@link Element.requestFullscreen} */
|
|
181
|
+
requestFullscreen(options?: FullscreenOptions): Promise<this>;
|
|
182
|
+
/** {@link Element.requestPointerLock} */
|
|
183
|
+
requestPointerLock(options?: PointerLockOptions): Promise<this>;
|
|
184
|
+
/** {@link Element.scroll} */
|
|
185
|
+
scroll(options?: ScrollToOptions): this;
|
|
186
|
+
scroll(x: number, y: number): this;
|
|
187
|
+
/** {@link Element.scrollBy} */
|
|
188
|
+
scrollBy(options?: ScrollToOptions): this;
|
|
189
|
+
scrollBy(x: number, y: number): this;
|
|
190
|
+
/** {@link Element.scrollIntoView} */
|
|
191
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): this;
|
|
192
|
+
/** {@link Element.scrollTo} */
|
|
193
|
+
scrollTo(options?: ScrollToOptions): this;
|
|
194
|
+
scrollTo(x: number, y: number): this;
|
|
195
|
+
/** {@link Element.setAttribute} */
|
|
196
|
+
setAttribute(qualifiedName: string, value: string): this;
|
|
197
|
+
/** {@link Element.setAttributeNS} */
|
|
198
|
+
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): this;
|
|
199
|
+
/** {@link Element.setAttributeNode} */
|
|
200
|
+
setAttributeNode(attr: Attr): Attr | null;
|
|
201
|
+
/** {@link Element.setAttributeNodeNS} */
|
|
202
|
+
setAttributeNodeNS(attr: Attr): Attr | null;
|
|
203
|
+
/** {@link Element.setHTMLUnsafe} */
|
|
204
|
+
setHTMLUnsafe(html: string): this;
|
|
205
|
+
/** {@link Element.setPointerCapture} */
|
|
206
|
+
setPointerCapture(pointerId: number): this;
|
|
207
|
+
/** {@link Element.toggleAttribute} */
|
|
208
|
+
toggleAttribute(qualifiedName: string, force?: boolean): boolean;
|
|
209
|
+
/** {@link Element.animate} */
|
|
210
|
+
animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation;
|
|
211
|
+
/** {@link Element.getAnimations} */
|
|
212
|
+
getAnimations(options?: GetAnimationsOptions): Animation[];
|
|
213
|
+
/** {@link Element.append} */
|
|
214
|
+
append(...nodes: (Node | string)[]): this;
|
|
215
|
+
/** {@link Element.prepend} */
|
|
216
|
+
prepend(...nodes: (Node | string)[]): this;
|
|
217
|
+
/** {@link Element.querySelector} */
|
|
218
|
+
querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null;
|
|
219
|
+
querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null;
|
|
220
|
+
querySelector<K extends keyof MathMLElementTagNameMap>(selectors: K): MathMLElementTagNameMap[K] | null;
|
|
221
|
+
/** {@link Element.querySelectorAll} */
|
|
222
|
+
querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
|
|
223
|
+
querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
|
|
224
|
+
querySelectorAll<K extends keyof MathMLElementTagNameMap>(selectors: K): NodeListOf<MathMLElementTagNameMap[K]>;
|
|
225
|
+
/** {@link Element.replaceChildren} */
|
|
226
|
+
replaceChildren(...nodes: (Node | string)[]): this;
|
|
109
227
|
|
|
110
228
|
/** {@link Element.classList} */
|
|
111
229
|
classList(): DOMTokenList;
|
|
@@ -134,4 +252,152 @@ export interface $Element<Ele extends Element> {
|
|
|
134
252
|
/** {@link Element.slot} */
|
|
135
253
|
slot(): string;
|
|
136
254
|
slot(slot: $Parameter<string>): this;
|
|
255
|
+
|
|
256
|
+
// ARIAMixin
|
|
257
|
+
/** {@link ARIAMixin.ariaAtomic} */
|
|
258
|
+
ariaAtomic(): string | null;
|
|
259
|
+
ariaAtomic(ariaAtomic: $Parameter<string | null>): this;
|
|
260
|
+
/** {@link ARIAMixin.ariaAutoComplete} */
|
|
261
|
+
ariaAutoComplete(): string | null;
|
|
262
|
+
ariaAutoComplete(ariaAutoComplete: $Parameter<string | null>): this;
|
|
263
|
+
/** {@link ARIAMixin.ariaBrailleLabel} */
|
|
264
|
+
ariaBrailleLabel(): string | null;
|
|
265
|
+
ariaBrailleLabel(ariaBrailleLabel: $Parameter<string | null>): this;
|
|
266
|
+
/** {@link ARIAMixin.ariaBrailleRoleDescription} */
|
|
267
|
+
ariaBrailleRoleDescription(): string | null;
|
|
268
|
+
ariaBrailleRoleDescription(ariaBrailleRoleDescription: $Parameter<string | null>): this;
|
|
269
|
+
/** {@link ARIAMixin.ariaBusy} */
|
|
270
|
+
ariaBusy(): string | null;
|
|
271
|
+
ariaBusy(ariaBusy: $Parameter<string | null>): this;
|
|
272
|
+
/** {@link ARIAMixin.ariaChecked} */
|
|
273
|
+
ariaChecked(): string | null;
|
|
274
|
+
ariaChecked(ariaChecked: $Parameter<string | null>): this;
|
|
275
|
+
/** {@link ARIAMixin.ariaColCount} */
|
|
276
|
+
ariaColCount(): string | null;
|
|
277
|
+
ariaColCount(ariaColCount: $Parameter<string | null>): this;
|
|
278
|
+
/** {@link ARIAMixin.ariaColIndex} */
|
|
279
|
+
ariaColIndex(): string | null;
|
|
280
|
+
ariaColIndex(ariaColIndex: $Parameter<string | null>): this;
|
|
281
|
+
/** {@link ARIAMixin.ariaColIndexText} */
|
|
282
|
+
ariaColIndexText(): string | null;
|
|
283
|
+
ariaColIndexText(ariaColIndexText: $Parameter<string | null>): this;
|
|
284
|
+
/** {@link ARIAMixin.ariaColSpan} */
|
|
285
|
+
ariaColSpan(): string | null;
|
|
286
|
+
ariaColSpan(ariaColSpan: $Parameter<string | null>): this;
|
|
287
|
+
/** {@link ARIAMixin.ariaCurrent} */
|
|
288
|
+
ariaCurrent(): string | null;
|
|
289
|
+
ariaCurrent(ariaCurrent: $Parameter<string | null>): this;
|
|
290
|
+
/** {@link ARIAMixin.ariaDescription} */
|
|
291
|
+
ariaDescription(): string | null;
|
|
292
|
+
ariaDescription(ariaDescription: $Parameter<string | null>): this;
|
|
293
|
+
/** {@link ARIAMixin.ariaDisabled} */
|
|
294
|
+
ariaDisabled(): string | null;
|
|
295
|
+
ariaDisabled(ariaDisabled: $Parameter<string | null>): this;
|
|
296
|
+
/** {@link ARIAMixin.ariaExpanded} */
|
|
297
|
+
ariaExpanded(): string | null;
|
|
298
|
+
ariaExpanded(ariaExpanded: $Parameter<string | null>): this;
|
|
299
|
+
/** {@link ARIAMixin.ariaHasPopup} */
|
|
300
|
+
ariaHasPopup(): string | null;
|
|
301
|
+
ariaHasPopup(ariaHasPopup: $Parameter<string | null>): this;
|
|
302
|
+
/** {@link ARIAMixin.ariaHidden} */
|
|
303
|
+
ariaHidden(): string | null;
|
|
304
|
+
ariaHidden(ariaHidden: $Parameter<string | null>): this;
|
|
305
|
+
/** {@link ARIAMixin.ariaInvalid} */
|
|
306
|
+
ariaInvalid(): string | null;
|
|
307
|
+
ariaInvalid(ariaInvalid: $Parameter<string | null>): this;
|
|
308
|
+
/** {@link ARIAMixin.ariaKeyShortcuts} */
|
|
309
|
+
ariaKeyShortcuts(): string | null;
|
|
310
|
+
ariaKeyShortcuts(ariaKeyShortcuts: $Parameter<string | null>): this;
|
|
311
|
+
/** {@link ARIAMixin.ariaLabel} */
|
|
312
|
+
ariaLabel(): string | null;
|
|
313
|
+
ariaLabel(ariaLabel: $Parameter<string | null>): this;
|
|
314
|
+
/** {@link ARIAMixin.ariaLevel} */
|
|
315
|
+
ariaLevel(): string | null;
|
|
316
|
+
ariaLevel(ariaLevel: $Parameter<string | null>): this;
|
|
317
|
+
/** {@link ARIAMixin.ariaLive} */
|
|
318
|
+
ariaLive(): string | null;
|
|
319
|
+
ariaLive(ariaLive: $Parameter<string | null>): this;
|
|
320
|
+
/** {@link ARIAMixin.ariaModal} */
|
|
321
|
+
ariaModal(): string | null;
|
|
322
|
+
ariaModal(ariaModal: $Parameter<string | null>): this;
|
|
323
|
+
/** {@link ARIAMixin.ariaMultiLine} */
|
|
324
|
+
ariaMultiLine(): string | null;
|
|
325
|
+
ariaMultiLine(ariaMultiLine: $Parameter<string | null>): this;
|
|
326
|
+
/** {@link ARIAMixin.ariaMultiSelectable} */
|
|
327
|
+
ariaMultiSelectable(): string | null;
|
|
328
|
+
ariaMultiSelectable(ariaMultiSelectable: $Parameter<string | null>): this;
|
|
329
|
+
/** {@link ARIAMixin.ariaOrientation} */
|
|
330
|
+
ariaOrientation(): string | null;
|
|
331
|
+
ariaOrientation(ariaOrientation: $Parameter<string | null>): this;
|
|
332
|
+
/** {@link ARIAMixin.ariaPlaceholder} */
|
|
333
|
+
ariaPlaceholder(): string | null;
|
|
334
|
+
ariaPlaceholder(ariaPlaceholder: $Parameter<string | null>): this;
|
|
335
|
+
/** {@link ARIAMixin.ariaPosInSet} */
|
|
336
|
+
ariaPosInSet(): string | null;
|
|
337
|
+
ariaPosInSet(ariaPosInSet: $Parameter<string | null>): this;
|
|
338
|
+
/** {@link ARIAMixin.ariaPressed} */
|
|
339
|
+
ariaPressed(): string | null;
|
|
340
|
+
ariaPressed(ariaPressed: $Parameter<string | null>): this;
|
|
341
|
+
/** {@link ARIAMixin.ariaReadOnly} */
|
|
342
|
+
ariaReadOnly(): string | null;
|
|
343
|
+
ariaReadOnly(ariaReadOnly: $Parameter<string | null>): this;
|
|
344
|
+
/** {@link ARIAMixin.ariaRelevant} */
|
|
345
|
+
ariaRelevant(): string | null;
|
|
346
|
+
ariaRelevant(ariaRelevant: $Parameter<string | null>): this;
|
|
347
|
+
/** {@link ARIAMixin.ariaRequired} */
|
|
348
|
+
ariaRequired(): string | null;
|
|
349
|
+
ariaRequired(ariaRequired: $Parameter<string | null>): this;
|
|
350
|
+
/** {@link ARIAMixin.ariaRoleDescription} */
|
|
351
|
+
ariaRoleDescription(): string | null;
|
|
352
|
+
ariaRoleDescription(ariaRoleDescription: $Parameter<string | null>): this;
|
|
353
|
+
/** {@link ARIAMixin.ariaRowCount} */
|
|
354
|
+
ariaRowCount(): string | null;
|
|
355
|
+
ariaRowCount(ariaRowCount: $Parameter<string | null>): this;
|
|
356
|
+
/** {@link ARIAMixin.ariaRowIndex} */
|
|
357
|
+
ariaRowIndex(): string | null;
|
|
358
|
+
ariaRowIndex(ariaRowIndex: $Parameter<string | null>): this;
|
|
359
|
+
/** {@link ARIAMixin.ariaRowIndexText} */
|
|
360
|
+
ariaRowIndexText(): string | null;
|
|
361
|
+
ariaRowIndexText(ariaRowIndexText: $Parameter<string | null>): this;
|
|
362
|
+
/** {@link ARIAMixin.ariaRowSpan} */
|
|
363
|
+
ariaRowSpan(): string | null;
|
|
364
|
+
ariaRowSpan(ariaRowSpan: $Parameter<string | null>): this;
|
|
365
|
+
/** {@link ARIAMixin.ariaSelected} */
|
|
366
|
+
ariaSelected(): string | null;
|
|
367
|
+
ariaSelected(ariaSelected: $Parameter<string | null>): this;
|
|
368
|
+
/** {@link ARIAMixin.ariaSetSize} */
|
|
369
|
+
ariaSetSize(): string | null;
|
|
370
|
+
ariaSetSize(ariaSetSize: $Parameter<string | null>): this;
|
|
371
|
+
/** {@link ARIAMixin.ariaSort} */
|
|
372
|
+
ariaSort(): string | null;
|
|
373
|
+
ariaSort(ariaSort: $Parameter<string | null>): this;
|
|
374
|
+
/** {@link ARIAMixin.ariaValueMax} */
|
|
375
|
+
ariaValueMax(): string | null;
|
|
376
|
+
ariaValueMax(ariaValueMax: $Parameter<string | null>): this;
|
|
377
|
+
/** {@link ARIAMixin.ariaValueMin} */
|
|
378
|
+
ariaValueMin(): string | null;
|
|
379
|
+
ariaValueMin(ariaValueMin: $Parameter<string | null>): this;
|
|
380
|
+
/** {@link ARIAMixin.ariaValueNow} */
|
|
381
|
+
ariaValueNow(): string | null;
|
|
382
|
+
ariaValueNow(ariaValueNow: $Parameter<string | null>): this;
|
|
383
|
+
/** {@link ARIAMixin.ariaValueText} */
|
|
384
|
+
ariaValueText(): string | null;
|
|
385
|
+
ariaValueText(ariaValueText: $Parameter<string | null>): this;
|
|
386
|
+
/** {@link ARIAMixin.role} */
|
|
387
|
+
role(): string | null;
|
|
388
|
+
role(role: $Parameter<string | null>): this;
|
|
389
|
+
addEventListener<K extends keyof EvMap, Ev extends EvMap[K]>(type: K, listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | AddEventListenerOptions): void;
|
|
390
|
+
addEventListener(type: string, listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | AddEventListenerOptions): void;
|
|
391
|
+
removeEventListener<K extends keyof EvMap, Ev extends EvMap[K]>(type: K, listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | EventListenerOptions): void;
|
|
392
|
+
removeEventListener(type: string, listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | EventListenerOptions): void;
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
on(type: string, listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | AddEventListenerOptions): this;
|
|
396
|
+
on<K extends keyof EvMap, Ev extends EvMap[K]>(type: K, listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | AddEventListenerOptions): this;
|
|
397
|
+
|
|
398
|
+
off(type: string, listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | EventListenerOptions): this;
|
|
399
|
+
off<K extends keyof EvMap, Ev extends EvMap[K]>(type: K, listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | EventListenerOptions): this;
|
|
400
|
+
|
|
401
|
+
once(type: string, listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | AddEventListenerOptions): this;
|
|
402
|
+
once<K extends keyof EvMap, Ev extends EvMap[K]>(type: K, listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | AddEventListenerOptions): this;
|
|
137
403
|
}
|
package/src/node/$HTMLElement.ts
CHANGED
|
@@ -1,7 +1,100 @@
|
|
|
1
|
+
import { _Object_entries, forEach } from "#lib/native";
|
|
1
2
|
import { $Element } from "#node/$Element";
|
|
2
3
|
|
|
3
|
-
export class $HTMLElement<Ele extends HTMLElement = HTMLElement> extends $Element<Ele> {
|
|
4
|
+
export class $HTMLElement<Ele extends HTMLElement = HTMLElement, EvMap = HTMLElementEventMap> extends $Element<Ele, EvMap> {
|
|
4
5
|
constructor(resolver: string | Ele) {
|
|
5
6
|
super(resolver);
|
|
6
7
|
}
|
|
8
|
+
|
|
9
|
+
style(): CSSStyleDeclaration;
|
|
10
|
+
style(style: Partial<CSSStyleDeclarationOptions> | undefined): this
|
|
11
|
+
style(style?: Partial<CSSStyleDeclarationOptions> | undefined) {
|
|
12
|
+
let _style = this.node.style
|
|
13
|
+
if (!arguments.length) return _style
|
|
14
|
+
if (!style) return this;
|
|
15
|
+
forEach(_Object_entries(style), ([key, value]) => _style[key as any] = value ?? '')
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type CSSStyleDeclarationOptions = Omit<CSSStyleDeclaration, 'parentRule' | 'length' | 'getPropertyPriority' | 'getPropertyValue' | 'item' | 'removeProperty' | 'setProperty'>;
|
|
21
|
+
|
|
22
|
+
export interface $HTMLElement<Ele extends HTMLElement = HTMLElement, EvMap = HTMLElementEventMap> extends $Element<Ele, EvMap> {
|
|
23
|
+
/** {@link HTMLElement.accessKeyLabel} */
|
|
24
|
+
readonly accessKeyLabel: string;
|
|
25
|
+
/** {@link HTMLElement.offsetHeight} */
|
|
26
|
+
readonly offsetHeight: number;
|
|
27
|
+
/** {@link HTMLElement.offsetLeft} */
|
|
28
|
+
readonly offsetLeft: number;
|
|
29
|
+
/** {@link HTMLElement.offsetParent} */
|
|
30
|
+
readonly offsetParent: Element | null;
|
|
31
|
+
/** {@link HTMLElement.offsetTop} */
|
|
32
|
+
readonly offsetTop: number;
|
|
33
|
+
/** {@link HTMLElement.offsetWidth} */
|
|
34
|
+
readonly offsetWidth: number;
|
|
35
|
+
/** {@link HTMLElement.isContentEditable} */
|
|
36
|
+
readonly isContentEditable: boolean;
|
|
37
|
+
|
|
38
|
+
/** {@link HTMLElement.attachInternals} */
|
|
39
|
+
attachInternals(): ElementInternals;
|
|
40
|
+
/** {@link HTMLElement.click} */
|
|
41
|
+
click(): this;
|
|
42
|
+
/** {@link HTMLElement.hidePopover} */
|
|
43
|
+
hidePopover(): this;
|
|
44
|
+
/** {@link HTMLElement.showPopover} */
|
|
45
|
+
showPopover(): this;
|
|
46
|
+
/** {@link HTMLElement.togglePopover} */
|
|
47
|
+
togglePopover(options?: boolean): boolean;
|
|
48
|
+
|
|
49
|
+
/** {@link HTMLElement.accessKey} */
|
|
50
|
+
accessKey(): string;
|
|
51
|
+
accessKey(accessKey: $Parameter<string>): this;
|
|
52
|
+
/** {@link HTMLElement.autocapitalize} */
|
|
53
|
+
autocapitalize(): string;
|
|
54
|
+
autocapitalize(autocapitalize: $Parameter<string>): this;
|
|
55
|
+
/** {@link HTMLElement.dir} */
|
|
56
|
+
dir(): string;
|
|
57
|
+
dir(dir: $Parameter<string>): this;
|
|
58
|
+
/** {@link HTMLElement.draggable} */
|
|
59
|
+
draggable(): boolean;
|
|
60
|
+
draggable(draggable: $Parameter<boolean>): this;
|
|
61
|
+
/** {@link HTMLElement.hidden} */
|
|
62
|
+
hidden(): boolean;
|
|
63
|
+
hidden(hidden: $Parameter<boolean>): this;
|
|
64
|
+
/** {@link HTMLElement.inert} */
|
|
65
|
+
inert(): boolean;
|
|
66
|
+
inert(inert: $Parameter<boolean>): this;
|
|
67
|
+
/** {@link HTMLElement.innerText} */
|
|
68
|
+
innerText(): string;
|
|
69
|
+
innerText(innerText: $Parameter<string>): this;
|
|
70
|
+
/** {@link HTMLElement.lang} */
|
|
71
|
+
lang(): string;
|
|
72
|
+
lang(lang: $Parameter<string>): this;
|
|
73
|
+
/** {@link HTMLElement.outerText} */
|
|
74
|
+
outerText(): string;
|
|
75
|
+
outerText(outerText: $Parameter<string>): this;
|
|
76
|
+
/** {@link HTMLElement.popover} */
|
|
77
|
+
popover(): string | null;
|
|
78
|
+
popover(popover: $Parameter<string | null>): this;
|
|
79
|
+
/** {@link HTMLElement.spellcheck} */
|
|
80
|
+
spellcheck(): boolean;
|
|
81
|
+
spellcheck(spellcheck: $Parameter<boolean>): this;
|
|
82
|
+
/** {@link HTMLElement.title} */
|
|
83
|
+
title(): string;
|
|
84
|
+
title(title: $Parameter<string>): this;
|
|
85
|
+
/** {@link HTMLElement.translate} */
|
|
86
|
+
translate(): string;
|
|
87
|
+
translate(translate: $Parameter<boolean>): this;
|
|
88
|
+
/** {@link HTMLElement.writingSuggestions} */
|
|
89
|
+
writingSuggestions(): string;
|
|
90
|
+
writingSuggestions(writingSuggestions: $Parameter<string>): this;
|
|
91
|
+
/** {@link HTMLElement.contentEditable} */
|
|
92
|
+
contentEditable(): string;
|
|
93
|
+
contentEditable(contentEditable: $Parameter<string>): this;
|
|
94
|
+
/** {@link HTMLElement.enterKeyHint} */
|
|
95
|
+
enterKeyHint(): string;
|
|
96
|
+
enterKeyHint(enterKeyHint: $Parameter<string>): this;
|
|
97
|
+
/** {@link HTMLElement.inputMode} */
|
|
98
|
+
inputMode(): string;
|
|
99
|
+
inputMode(inputMode: $Parameter<string>): this;
|
|
7
100
|
}
|