@typesafe-html5/typescript 0.2.58
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 +166 -0
- package/block/article/article.ts +506 -0
- package/block/aside/aside.ts +522 -0
- package/block/audio/audio.ts +506 -0
- package/block/blockquote/blockquote.ts +522 -0
- package/block/body/body.ts +458 -0
- package/block/canvas/canvas.ts +538 -0
- package/block/caption/caption.ts +506 -0
- package/block/colgroup/colgroup.ts +154 -0
- package/block/datalist/datalist.ts +506 -0
- package/block/dd/dd.ts +506 -0
- package/block/del/del.ts +538 -0
- package/block/details/details.ts +586 -0
- package/block/dialog/dialog.ts +586 -0
- package/block/div/div.ts +586 -0
- package/block/dl/dl.ts +506 -0
- package/block/dt/dt.ts +506 -0
- package/block/embed/embed.ts +317 -0
- package/block/fieldset/fieldset.ts +570 -0
- package/block/figcaption/figcaption.ts +506 -0
- package/block/figure/figure.ts +506 -0
- package/block/footer/footer.ts +522 -0
- package/block/form/form.ts +490 -0
- package/block/h1/h1.ts +490 -0
- package/block/h2/h2.ts +490 -0
- package/block/h3/h3.ts +490 -0
- package/block/h4/h4.ts +490 -0
- package/block/h5/h5.ts +490 -0
- package/block/h6/h6.ts +490 -0
- package/block/header/header.ts +298 -0
- package/block/hgroup/hgroup.ts +506 -0
- package/block/hr/hr.ts +189 -0
- package/block/html/html.ts +106 -0
- package/block/iframe/iframe.ts +538 -0
- package/block/ins/ins.ts +538 -0
- package/block/legend/legend.ts +506 -0
- package/block/li/li.ts +602 -0
- package/block/main/main.ts +538 -0
- package/block/map/map.ts +522 -0
- package/block/menu/menu.ts +554 -0
- package/block/nav/nav.ts +554 -0
- package/block/noscript/noscript.ts +282 -0
- package/block/object/object.ts +618 -0
- package/block/ol/ol.ts +618 -0
- package/block/optgroup/optgroup.ts +522 -0
- package/block/option/option.ts +618 -0
- package/block/p/p.ts +506 -0
- package/block/picture/picture.ts +506 -0
- package/block/pre/pre.ts +506 -0
- package/block/section/section.ts +538 -0
- package/block/summary/summary.ts +570 -0
- package/block/table/table.ts +570 -0
- package/block/tbody/tbody.ts +506 -0
- package/block/td/td.ts +666 -0
- package/block/template/template.ts +506 -0
- package/block/tfoot/tfoot.ts +506 -0
- package/block/th/th.ts +682 -0
- package/block/thead/thead.ts +506 -0
- package/block/tr/tr.ts +682 -0
- package/block/ul/ul.ts +570 -0
- package/block/video/video.ts +666 -0
- package/index.ts +126 -0
- package/inline/a/a.ts +682 -0
- package/inline/abbr/abbr.ts +490 -0
- package/inline/address/address.ts +474 -0
- package/inline/b/b.ts +506 -0
- package/inline/bdi/bdi.ts +490 -0
- package/inline/bdo/bdo.ts +506 -0
- package/inline/button/button.ts +826 -0
- package/inline/cite/cite.ts +506 -0
- package/inline/code/code.ts +506 -0
- package/inline/data/data.ts +522 -0
- package/inline/dfn/dfn.ts +506 -0
- package/inline/em/em.ts +506 -0
- package/inline/i/i.ts +506 -0
- package/inline/img/img.ts +445 -0
- package/inline/input/input.ts +1197 -0
- package/inline/kbd/kbd.ts +506 -0
- package/inline/label/label.ts +538 -0
- package/inline/mark/mark.ts +506 -0
- package/inline/meter/meter.ts +554 -0
- package/inline/output/output.ts +426 -0
- package/inline/progress/progress.ts +490 -0
- package/inline/q/q.ts +522 -0
- package/inline/rp/rp.ts +506 -0
- package/inline/rt/rt.ts +506 -0
- package/inline/ruby/ruby.ts +506 -0
- package/inline/s/s.ts +506 -0
- package/inline/samp/samp.ts +506 -0
- package/inline/select/select.ts +810 -0
- package/inline/slot/slot.ts +522 -0
- package/inline/small/small.ts +506 -0
- package/inline/span/span.ts +506 -0
- package/inline/strong/strong.ts +506 -0
- package/inline/sub/sub.ts +506 -0
- package/inline/sup/sup.ts +506 -0
- package/inline/svg/svg.ts +618 -0
- package/inline/textarea/textarea.ts +874 -0
- package/inline/time/time.ts +522 -0
- package/inline/u/u.ts +506 -0
- package/inline/var/var.ts +506 -0
- package/package.json +32 -0
- package/tsconfig.json +26 -0
- package/void/area/area.ts +397 -0
- package/void/base/base.ts +61 -0
- package/void/br/br.ts +77 -0
- package/void/col/col.ts +77 -0
- package/void/head/head.ts +58 -0
- package/void/link/link.ts +253 -0
- package/void/meta/meta.ts +157 -0
- package/void/param/param.ts +93 -0
- package/void/script/script.ts +250 -0
- package/void/source/source.ts +125 -0
- package/void/style/style.ts +154 -0
- package/void/title/title.ts +58 -0
- package/void/track/track.ts +157 -0
- package/void/wbr/wbr.ts +61 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOGENERATED. DO NOT EDIT IT.
|
|
3
|
+
*
|
|
4
|
+
* @generated December 28, 2025 12:26:31
|
|
5
|
+
* @component Html
|
|
6
|
+
* @description
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface HtmlProps {
|
|
10
|
+
/**
|
|
11
|
+
* Child content or elements
|
|
12
|
+
*/
|
|
13
|
+
children?: string | HTMLElement | (string | HTMLElement)[];
|
|
14
|
+
/**
|
|
15
|
+
* Represents the text direction of the element
|
|
16
|
+
*/
|
|
17
|
+
dir?: 'ltr' | 'rtl' | 'auto' | null | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Specifies the primary language for the element's content
|
|
20
|
+
*/
|
|
21
|
+
lang?: string | null | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Specifies the address of the document's cache manifest.
|
|
24
|
+
*/
|
|
25
|
+
manifest?: string | null | undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Html -
|
|
30
|
+
*/
|
|
31
|
+
export class Html {
|
|
32
|
+
private element: HTMLElement;
|
|
33
|
+
|
|
34
|
+
constructor(props: HtmlProps = {}) {
|
|
35
|
+
this.element = document.createElement('html');
|
|
36
|
+
this.applyProps(props);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private applyProps(props: HtmlProps): void {
|
|
40
|
+
if (props.children !== undefined) {
|
|
41
|
+
this.setChildren(props.children);
|
|
42
|
+
}
|
|
43
|
+
if (props.dir !== undefined) {
|
|
44
|
+
this.setDir(props.dir);
|
|
45
|
+
}
|
|
46
|
+
if (props.lang !== undefined) {
|
|
47
|
+
this.element.setAttribute('lang', String(props.lang));
|
|
48
|
+
}
|
|
49
|
+
if (props.manifest !== undefined) {
|
|
50
|
+
this.element.setAttribute('manifest', String(props.manifest));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
setDir(value: 'ltr' | 'rtl' | 'auto' | null | undefined): this {
|
|
55
|
+
if (value === null || value === undefined) {
|
|
56
|
+
this.element.removeAttribute('dir');
|
|
57
|
+
} else {
|
|
58
|
+
this.element.setAttribute('dir', String(value));
|
|
59
|
+
}
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
setLang(value: string | null | undefined): this {
|
|
64
|
+
if (value === null || value === undefined) {
|
|
65
|
+
this.element.removeAttribute('lang');
|
|
66
|
+
} else {
|
|
67
|
+
this.element.setAttribute('lang', String(value));
|
|
68
|
+
}
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
setManifest(value: string | null | undefined): this {
|
|
73
|
+
if (value === null || value === undefined) {
|
|
74
|
+
this.element.removeAttribute('manifest');
|
|
75
|
+
} else {
|
|
76
|
+
this.element.setAttribute('manifest', String(value));
|
|
77
|
+
}
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setChildren(children: string | HTMLElement | (string | HTMLElement)[]): this {
|
|
82
|
+
// Clear existing children
|
|
83
|
+
while (this.element.firstChild) {
|
|
84
|
+
this.element.removeChild(this.element.firstChild);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (typeof children === 'string') {
|
|
88
|
+
this.element.textContent = children;
|
|
89
|
+
} else if (Array.isArray(children)) {
|
|
90
|
+
children.forEach(child => {
|
|
91
|
+
if (typeof child === 'string') {
|
|
92
|
+
this.element.appendChild(document.createTextNode(child));
|
|
93
|
+
} else {
|
|
94
|
+
this.element.appendChild(child);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
this.element.appendChild(children);
|
|
99
|
+
}
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
getElement(): HTMLElement {
|
|
104
|
+
return this.element;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOGENERATED. DO NOT EDIT IT.
|
|
3
|
+
*
|
|
4
|
+
* @generated December 28, 2025 12:26:31
|
|
5
|
+
* @component Iframe
|
|
6
|
+
* @description
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface IframeProps {
|
|
10
|
+
/**
|
|
11
|
+
* Child content or elements
|
|
12
|
+
*/
|
|
13
|
+
children?: string | HTMLElement | (string | HTMLElement)[];
|
|
14
|
+
/**
|
|
15
|
+
* Enables the iframe to be displayed in fullscreen mode.
|
|
16
|
+
*/
|
|
17
|
+
allowfullscreen?: boolean | null | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Indicates whether assistive technologies should present the entire region as a whole when changes occur.
|
|
20
|
+
*/
|
|
21
|
+
'aria-atomic'?: 'false' | 'true' | boolean | null | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* The aria-busy attribute is used to indicate whether an element is currently busy or not.
|
|
24
|
+
*/
|
|
25
|
+
'aria-busy'?: 'true' | 'false' | boolean | null | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Identifies the element(s) whose contents or presence are controlled by this element. Value is a list of IDs separated by a space
|
|
28
|
+
*/
|
|
29
|
+
'aria-controls'?: string | null | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Identifies the element(s) that describes the object. Value is a list of IDs separated by a space
|
|
32
|
+
*/
|
|
33
|
+
'aria-describedby'?: string | null | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* References an element that provides additional details about the current element.
|
|
36
|
+
*/
|
|
37
|
+
'aria-details'?: string | null | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Indicates whether the element is exposed to an accessibility API. Use with caution on interactive elements. Set to true only on decorative elements such as icons, or when nav isnt visible
|
|
40
|
+
*/
|
|
41
|
+
'aria-hidden'?: 'false' | 'true' | boolean | null | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Defines keyboard shortcuts available for the element.
|
|
44
|
+
*/
|
|
45
|
+
'aria-keyshortcuts'?: string | null | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Defines a string value that labels the current element for assistive technologies.
|
|
48
|
+
*/
|
|
49
|
+
'aria-label'?: string | null | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Identifies the element(s) that labels the current element. Value is a list of IDs separated by a space
|
|
52
|
+
*/
|
|
53
|
+
'aria-labelledby'?: string | null | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Defines how updates to the element should be announced to screen readers.
|
|
56
|
+
*/
|
|
57
|
+
'aria-live'?: 'off' | 'polite' | 'assertive' | null | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Indicates what content changes should be announced in a live region.
|
|
60
|
+
*/
|
|
61
|
+
'aria-relevant'?: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Provides a human-readable custom role description for assistive technologies.
|
|
64
|
+
*/
|
|
65
|
+
'aria-roledescription'?: string | null | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Represents the text direction of the element
|
|
68
|
+
*/
|
|
69
|
+
dir?: 'ltr' | 'rtl' | 'auto' | null | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Specifies the height of the element. The meaning may vary depending on the element type. Accepts integers, pixels (px), and percentages (%).
|
|
72
|
+
*/
|
|
73
|
+
height?: string | null | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Indicates whether the element is hidden
|
|
76
|
+
*/
|
|
77
|
+
hidden?: boolean | null | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Specifies the primary language for the element's content
|
|
80
|
+
*/
|
|
81
|
+
lang?: string | null | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Specifies the name associated with the element. The meaning may vary depending on the context.
|
|
84
|
+
*/
|
|
85
|
+
name?: string | null | undefined;
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
89
|
+
popover?: 'auto' | 'hint' | 'manual' | null | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Specifies the referrer policy for fetches initiated by the element.
|
|
92
|
+
*/
|
|
93
|
+
referrerpolicy?: 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url' | null | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Defines the semantic purpose of an element for assistive technologies.
|
|
96
|
+
*/
|
|
97
|
+
role?: 'alert' | 'application' | 'article' | 'banner' | 'button' | 'checkbox' | 'complementary' | 'contentinfo' | 'dialog' | 'form' | 'grid' | 'group' | 'heading' | 'img' | 'link' | 'list' | 'listbox' | 'listitem' | 'main' | 'menu' | 'menubar' | 'menuitem' | 'navigation' | 'none' | 'presentation' | 'radio' | 'region' | 'search' | 'status' | 'tab' | 'tablist' | 'tabpanel' | 'textbox' | 'toolbar' | 'tooltip' | null | undefined;
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
*/
|
|
101
|
+
sandbox?: string | null | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* When present, it specifies that the iframe should look like it is a part of the containing document (no borders or scrollbars).
|
|
104
|
+
*/
|
|
105
|
+
seamless?: boolean | null | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Represents a slot in a shadow DOM
|
|
108
|
+
*/
|
|
109
|
+
slot?: string | null | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Specifies the URL of the external resource to be embedded or referenced.
|
|
112
|
+
*/
|
|
113
|
+
src?: string | null | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* The value of srcdoc is a string containing HTML markup, which the browser will display as the content of the iframe.
|
|
116
|
+
*/
|
|
117
|
+
srcdoc?: string | null | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* Represents the CSS inline style of the element
|
|
120
|
+
*/
|
|
121
|
+
style?: string | null | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Represents a tab order of the element
|
|
124
|
+
*/
|
|
125
|
+
tabindex?: number | null | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Represents a title or tooltip for the element
|
|
128
|
+
*/
|
|
129
|
+
title?: string | null | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Specifies the width of the element. The meaning may vary depending on the element type. Accepts integers, pixels (px), and percentages (%).
|
|
132
|
+
*/
|
|
133
|
+
width?: string | null | undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Iframe -
|
|
138
|
+
*/
|
|
139
|
+
export class Iframe {
|
|
140
|
+
private element: HTMLElement;
|
|
141
|
+
|
|
142
|
+
constructor(props: IframeProps = {}) {
|
|
143
|
+
this.element = document.createElement('iframe');
|
|
144
|
+
this.applyProps(props);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private applyProps(props: IframeProps): void {
|
|
148
|
+
if (props.children !== undefined) {
|
|
149
|
+
this.setChildren(props.children);
|
|
150
|
+
}
|
|
151
|
+
if (props.allowfullscreen !== undefined) {
|
|
152
|
+
this.element.setAttribute('allowfullscreen', String(props.allowfullscreen));
|
|
153
|
+
}
|
|
154
|
+
if (props['aria-atomic'] !== undefined) {
|
|
155
|
+
this.setAriaAtomic(props['aria-atomic']);
|
|
156
|
+
}
|
|
157
|
+
if (props['aria-busy'] !== undefined) {
|
|
158
|
+
this.setAriaBusy(props['aria-busy']);
|
|
159
|
+
}
|
|
160
|
+
if (props['aria-controls'] !== undefined) {
|
|
161
|
+
this.element.setAttribute('aria-controls', String(props['aria-controls']));
|
|
162
|
+
}
|
|
163
|
+
if (props['aria-describedby'] !== undefined) {
|
|
164
|
+
this.element.setAttribute('aria-describedby', String(props['aria-describedby']));
|
|
165
|
+
}
|
|
166
|
+
if (props['aria-details'] !== undefined) {
|
|
167
|
+
this.element.setAttribute('aria-details', String(props['aria-details']));
|
|
168
|
+
}
|
|
169
|
+
if (props['aria-hidden'] !== undefined) {
|
|
170
|
+
this.setAriaHidden(props['aria-hidden']);
|
|
171
|
+
}
|
|
172
|
+
if (props['aria-keyshortcuts'] !== undefined) {
|
|
173
|
+
this.element.setAttribute('aria-keyshortcuts', String(props['aria-keyshortcuts']));
|
|
174
|
+
}
|
|
175
|
+
if (props['aria-label'] !== undefined) {
|
|
176
|
+
this.element.setAttribute('aria-label', String(props['aria-label']));
|
|
177
|
+
}
|
|
178
|
+
if (props['aria-labelledby'] !== undefined) {
|
|
179
|
+
this.element.setAttribute('aria-labelledby', String(props['aria-labelledby']));
|
|
180
|
+
}
|
|
181
|
+
if (props['aria-live'] !== undefined) {
|
|
182
|
+
this.setAriaLive(props['aria-live']);
|
|
183
|
+
}
|
|
184
|
+
if (props['aria-relevant'] !== undefined) {
|
|
185
|
+
this.setAriaRelevant(props['aria-relevant']);
|
|
186
|
+
}
|
|
187
|
+
if (props['aria-roledescription'] !== undefined) {
|
|
188
|
+
this.element.setAttribute('aria-roledescription', String(props['aria-roledescription']));
|
|
189
|
+
}
|
|
190
|
+
if (props.dir !== undefined) {
|
|
191
|
+
this.setDir(props.dir);
|
|
192
|
+
}
|
|
193
|
+
if (props.height !== undefined) {
|
|
194
|
+
this.element.setAttribute('height', String(props.height));
|
|
195
|
+
}
|
|
196
|
+
if (props.hidden !== undefined) {
|
|
197
|
+
this.element.setAttribute('hidden', String(props.hidden));
|
|
198
|
+
}
|
|
199
|
+
if (props.lang !== undefined) {
|
|
200
|
+
this.element.setAttribute('lang', String(props.lang));
|
|
201
|
+
}
|
|
202
|
+
if (props.name !== undefined) {
|
|
203
|
+
this.element.setAttribute('name', String(props.name));
|
|
204
|
+
}
|
|
205
|
+
if (props.popover !== undefined) {
|
|
206
|
+
this.setPopover(props.popover);
|
|
207
|
+
}
|
|
208
|
+
if (props.referrerpolicy !== undefined) {
|
|
209
|
+
this.setReferrerpolicy(props.referrerpolicy);
|
|
210
|
+
}
|
|
211
|
+
if (props.role !== undefined) {
|
|
212
|
+
this.setRole(props.role);
|
|
213
|
+
}
|
|
214
|
+
if (props.sandbox !== undefined) {
|
|
215
|
+
this.element.setAttribute('sandbox', String(props.sandbox));
|
|
216
|
+
}
|
|
217
|
+
if (props.seamless !== undefined) {
|
|
218
|
+
this.element.setAttribute('seamless', String(props.seamless));
|
|
219
|
+
}
|
|
220
|
+
if (props.slot !== undefined) {
|
|
221
|
+
this.element.setAttribute('slot', String(props.slot));
|
|
222
|
+
}
|
|
223
|
+
if (props.src !== undefined) {
|
|
224
|
+
this.element.setAttribute('src', String(props.src));
|
|
225
|
+
}
|
|
226
|
+
if (props.srcdoc !== undefined) {
|
|
227
|
+
this.element.setAttribute('srcdoc', String(props.srcdoc));
|
|
228
|
+
}
|
|
229
|
+
if (props.style !== undefined) {
|
|
230
|
+
this.element.setAttribute('style', String(props.style));
|
|
231
|
+
}
|
|
232
|
+
if (props.tabindex !== undefined) {
|
|
233
|
+
this.element.setAttribute('tabindex', String(props.tabindex));
|
|
234
|
+
}
|
|
235
|
+
if (props.title !== undefined) {
|
|
236
|
+
this.element.setAttribute('title', String(props.title));
|
|
237
|
+
}
|
|
238
|
+
if (props.width !== undefined) {
|
|
239
|
+
this.element.setAttribute('width', String(props.width));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
setAllowfullscreen(value: boolean | null | undefined): this {
|
|
244
|
+
if (value === true) {
|
|
245
|
+
this.element.setAttribute('allowfullscreen', '');
|
|
246
|
+
} else {
|
|
247
|
+
this.element.removeAttribute('allowfullscreen');
|
|
248
|
+
}
|
|
249
|
+
return this;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
setAriaAtomic(value: 'false' | 'true' | boolean | null | undefined): this {
|
|
253
|
+
if (value === null || value === undefined) {
|
|
254
|
+
this.element.removeAttribute('aria-atomic');
|
|
255
|
+
} else {
|
|
256
|
+
this.element.setAttribute('aria-atomic', String(value));
|
|
257
|
+
}
|
|
258
|
+
return this;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
setAriaBusy(value: 'true' | 'false' | boolean | null | undefined): this {
|
|
262
|
+
if (value === null || value === undefined) {
|
|
263
|
+
this.element.removeAttribute('aria-busy');
|
|
264
|
+
} else {
|
|
265
|
+
this.element.setAttribute('aria-busy', String(value));
|
|
266
|
+
}
|
|
267
|
+
return this;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
setAriaControls(value: string | null | undefined): this {
|
|
271
|
+
if (value === null || value === undefined) {
|
|
272
|
+
this.element.removeAttribute('aria-controls');
|
|
273
|
+
} else {
|
|
274
|
+
this.element.setAttribute('aria-controls', String(value));
|
|
275
|
+
}
|
|
276
|
+
return this;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
setAriaDescribedby(value: string | null | undefined): this {
|
|
280
|
+
if (value === null || value === undefined) {
|
|
281
|
+
this.element.removeAttribute('aria-describedby');
|
|
282
|
+
} else {
|
|
283
|
+
this.element.setAttribute('aria-describedby', String(value));
|
|
284
|
+
}
|
|
285
|
+
return this;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
setAriaDetails(value: string | null | undefined): this {
|
|
289
|
+
if (value === null || value === undefined) {
|
|
290
|
+
this.element.removeAttribute('aria-details');
|
|
291
|
+
} else {
|
|
292
|
+
this.element.setAttribute('aria-details', String(value));
|
|
293
|
+
}
|
|
294
|
+
return this;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
setAriaHidden(value: 'false' | 'true' | boolean | null | undefined): this {
|
|
298
|
+
if (value === null || value === undefined) {
|
|
299
|
+
this.element.removeAttribute('aria-hidden');
|
|
300
|
+
} else {
|
|
301
|
+
this.element.setAttribute('aria-hidden', String(value));
|
|
302
|
+
}
|
|
303
|
+
return this;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
setAriaKeyshortcuts(value: string | null | undefined): this {
|
|
307
|
+
if (value === null || value === undefined) {
|
|
308
|
+
this.element.removeAttribute('aria-keyshortcuts');
|
|
309
|
+
} else {
|
|
310
|
+
this.element.setAttribute('aria-keyshortcuts', String(value));
|
|
311
|
+
}
|
|
312
|
+
return this;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
setAriaLabel(value: string | null | undefined): this {
|
|
316
|
+
if (value === null || value === undefined) {
|
|
317
|
+
this.element.removeAttribute('aria-label');
|
|
318
|
+
} else {
|
|
319
|
+
this.element.setAttribute('aria-label', String(value));
|
|
320
|
+
}
|
|
321
|
+
return this;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
setAriaLabelledby(value: string | null | undefined): this {
|
|
325
|
+
if (value === null || value === undefined) {
|
|
326
|
+
this.element.removeAttribute('aria-labelledby');
|
|
327
|
+
} else {
|
|
328
|
+
this.element.setAttribute('aria-labelledby', String(value));
|
|
329
|
+
}
|
|
330
|
+
return this;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
setAriaLive(value: 'off' | 'polite' | 'assertive' | null | undefined): this {
|
|
334
|
+
if (value === null || value === undefined) {
|
|
335
|
+
this.element.removeAttribute('aria-live');
|
|
336
|
+
} else {
|
|
337
|
+
this.element.setAttribute('aria-live', String(value));
|
|
338
|
+
}
|
|
339
|
+
return this;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
setAriaRelevant(value: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined): this {
|
|
343
|
+
if (value === null || value === undefined) {
|
|
344
|
+
this.element.removeAttribute('aria-relevant');
|
|
345
|
+
} else {
|
|
346
|
+
this.element.setAttribute('aria-relevant', String(value));
|
|
347
|
+
}
|
|
348
|
+
return this;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
setAriaRoledescription(value: string | null | undefined): this {
|
|
352
|
+
if (value === null || value === undefined) {
|
|
353
|
+
this.element.removeAttribute('aria-roledescription');
|
|
354
|
+
} else {
|
|
355
|
+
this.element.setAttribute('aria-roledescription', String(value));
|
|
356
|
+
}
|
|
357
|
+
return this;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
setDir(value: 'ltr' | 'rtl' | 'auto' | null | undefined): this {
|
|
361
|
+
if (value === null || value === undefined) {
|
|
362
|
+
this.element.removeAttribute('dir');
|
|
363
|
+
} else {
|
|
364
|
+
this.element.setAttribute('dir', String(value));
|
|
365
|
+
}
|
|
366
|
+
return this;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
setHeight(value: string | null | undefined): this {
|
|
370
|
+
if (value === null || value === undefined) {
|
|
371
|
+
this.element.removeAttribute('height');
|
|
372
|
+
} else {
|
|
373
|
+
this.element.setAttribute('height', String(value));
|
|
374
|
+
}
|
|
375
|
+
return this;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
setHidden(value: boolean | null | undefined): this {
|
|
379
|
+
if (value === true) {
|
|
380
|
+
this.element.setAttribute('hidden', '');
|
|
381
|
+
} else {
|
|
382
|
+
this.element.removeAttribute('hidden');
|
|
383
|
+
}
|
|
384
|
+
return this;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
setLang(value: string | null | undefined): this {
|
|
388
|
+
if (value === null || value === undefined) {
|
|
389
|
+
this.element.removeAttribute('lang');
|
|
390
|
+
} else {
|
|
391
|
+
this.element.setAttribute('lang', String(value));
|
|
392
|
+
}
|
|
393
|
+
return this;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
setName(value: string | null | undefined): this {
|
|
397
|
+
if (value === null || value === undefined) {
|
|
398
|
+
this.element.removeAttribute('name');
|
|
399
|
+
} else {
|
|
400
|
+
this.element.setAttribute('name', String(value));
|
|
401
|
+
}
|
|
402
|
+
return this;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
setPopover(value: 'auto' | 'hint' | 'manual' | null | undefined): this {
|
|
406
|
+
if (value === null || value === undefined) {
|
|
407
|
+
this.element.removeAttribute('popover');
|
|
408
|
+
} else {
|
|
409
|
+
this.element.setAttribute('popover', String(value));
|
|
410
|
+
}
|
|
411
|
+
return this;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
setReferrerpolicy(value: 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url' | null | undefined): this {
|
|
415
|
+
if (value === null || value === undefined) {
|
|
416
|
+
this.element.removeAttribute('referrerpolicy');
|
|
417
|
+
} else {
|
|
418
|
+
this.element.setAttribute('referrerpolicy', String(value));
|
|
419
|
+
}
|
|
420
|
+
return this;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
setRole(value: 'alert' | 'application' | 'article' | 'banner' | 'button' | 'checkbox' | 'complementary' | 'contentinfo' | 'dialog' | 'form' | 'grid' | 'group' | 'heading' | 'img' | 'link' | 'list' | 'listbox' | 'listitem' | 'main' | 'menu' | 'menubar' | 'menuitem' | 'navigation' | 'none' | 'presentation' | 'radio' | 'region' | 'search' | 'status' | 'tab' | 'tablist' | 'tabpanel' | 'textbox' | 'toolbar' | 'tooltip' | null | undefined): this {
|
|
424
|
+
if (value === null || value === undefined) {
|
|
425
|
+
this.element.removeAttribute('role');
|
|
426
|
+
} else {
|
|
427
|
+
this.element.setAttribute('role', String(value));
|
|
428
|
+
}
|
|
429
|
+
return this;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
setSandbox(value: string | null | undefined): this {
|
|
433
|
+
if (value === null || value === undefined) {
|
|
434
|
+
this.element.removeAttribute('sandbox');
|
|
435
|
+
} else {
|
|
436
|
+
this.element.setAttribute('sandbox', String(value));
|
|
437
|
+
}
|
|
438
|
+
return this;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
setSeamless(value: boolean | null | undefined): this {
|
|
442
|
+
if (value === true) {
|
|
443
|
+
this.element.setAttribute('seamless', '');
|
|
444
|
+
} else {
|
|
445
|
+
this.element.removeAttribute('seamless');
|
|
446
|
+
}
|
|
447
|
+
return this;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
setSlot(value: string | null | undefined): this {
|
|
451
|
+
if (value === null || value === undefined) {
|
|
452
|
+
this.element.removeAttribute('slot');
|
|
453
|
+
} else {
|
|
454
|
+
this.element.setAttribute('slot', String(value));
|
|
455
|
+
}
|
|
456
|
+
return this;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
setSrc(value: string | null | undefined): this {
|
|
460
|
+
if (value === null || value === undefined) {
|
|
461
|
+
this.element.removeAttribute('src');
|
|
462
|
+
} else {
|
|
463
|
+
this.element.setAttribute('src', String(value));
|
|
464
|
+
}
|
|
465
|
+
return this;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
setSrcdoc(value: string | null | undefined): this {
|
|
469
|
+
if (value === null || value === undefined) {
|
|
470
|
+
this.element.removeAttribute('srcdoc');
|
|
471
|
+
} else {
|
|
472
|
+
this.element.setAttribute('srcdoc', String(value));
|
|
473
|
+
}
|
|
474
|
+
return this;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
setStyle(value: string | null | undefined): this {
|
|
478
|
+
if (value === null || value === undefined) {
|
|
479
|
+
this.element.removeAttribute('style');
|
|
480
|
+
} else {
|
|
481
|
+
this.element.setAttribute('style', String(value));
|
|
482
|
+
}
|
|
483
|
+
return this;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
setTabindex(value: number | null | undefined): this {
|
|
487
|
+
if (value === null || value === undefined) {
|
|
488
|
+
this.element.removeAttribute('tabindex');
|
|
489
|
+
} else {
|
|
490
|
+
this.element.setAttribute('tabindex', String(value));
|
|
491
|
+
}
|
|
492
|
+
return this;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
setTitle(value: string | null | undefined): this {
|
|
496
|
+
if (value === null || value === undefined) {
|
|
497
|
+
this.element.removeAttribute('title');
|
|
498
|
+
} else {
|
|
499
|
+
this.element.setAttribute('title', String(value));
|
|
500
|
+
}
|
|
501
|
+
return this;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
setWidth(value: string | null | undefined): this {
|
|
505
|
+
if (value === null || value === undefined) {
|
|
506
|
+
this.element.removeAttribute('width');
|
|
507
|
+
} else {
|
|
508
|
+
this.element.setAttribute('width', String(value));
|
|
509
|
+
}
|
|
510
|
+
return this;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
setChildren(children: string | HTMLElement | (string | HTMLElement)[]): this {
|
|
514
|
+
// Clear existing children
|
|
515
|
+
while (this.element.firstChild) {
|
|
516
|
+
this.element.removeChild(this.element.firstChild);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
if (typeof children === 'string') {
|
|
520
|
+
this.element.textContent = children;
|
|
521
|
+
} else if (Array.isArray(children)) {
|
|
522
|
+
children.forEach(child => {
|
|
523
|
+
if (typeof child === 'string') {
|
|
524
|
+
this.element.appendChild(document.createTextNode(child));
|
|
525
|
+
} else {
|
|
526
|
+
this.element.appendChild(child);
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
} else {
|
|
530
|
+
this.element.appendChild(children);
|
|
531
|
+
}
|
|
532
|
+
return this;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
getElement(): HTMLElement {
|
|
536
|
+
return this.element;
|
|
537
|
+
}
|
|
538
|
+
}
|