@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,554 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOGENERATED. DO NOT EDIT IT.
|
|
3
|
+
*
|
|
4
|
+
* @generated December 28, 2025 12:26:31
|
|
5
|
+
* @component Meter
|
|
6
|
+
* @description
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface MeterProps {
|
|
10
|
+
/**
|
|
11
|
+
* Child content or elements
|
|
12
|
+
*/
|
|
13
|
+
children?: string | HTMLElement | (string | HTMLElement)[];
|
|
14
|
+
/**
|
|
15
|
+
* specifies a shortcut key (or keys) to activate or focus an element
|
|
16
|
+
*/
|
|
17
|
+
accesskey?: string | 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
|
+
* References an element that provides additional details about the current element.
|
|
24
|
+
*/
|
|
25
|
+
'aria-details'?: string | null | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Defines keyboard shortcuts available for the element.
|
|
28
|
+
*/
|
|
29
|
+
'aria-keyshortcuts'?: string | null | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Defines how updates to the element should be announced to screen readers.
|
|
32
|
+
*/
|
|
33
|
+
'aria-live'?: 'off' | 'polite' | 'assertive' | null | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Indicates what content changes should be announced in a live region.
|
|
36
|
+
*/
|
|
37
|
+
'aria-relevant'?: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Provides a human-readable custom role description for assistive technologies.
|
|
40
|
+
*/
|
|
41
|
+
'aria-roledescription'?: string | null | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Defines the maximum value for a range input.
|
|
44
|
+
*/
|
|
45
|
+
'aria-valuemax'?: number | null | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Defines the minimum value for a range input.
|
|
48
|
+
*/
|
|
49
|
+
'aria-valuemin'?: number | null | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Specifies the current value for a range input.
|
|
52
|
+
*/
|
|
53
|
+
'aria-valuenow'?: number | null | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Provides a human-readable representation of the current value.
|
|
56
|
+
*/
|
|
57
|
+
'aria-valuetext'?: string | null | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Represents the autocapitalize behavior of the element
|
|
60
|
+
*/
|
|
61
|
+
autocapitalize?: 'none' | 'sentences' | 'words' | 'characters' | null | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Indicates whether the element is hidden
|
|
64
|
+
*/
|
|
65
|
+
autofocus?: boolean | null | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Indicates whether the element can be edited in place
|
|
68
|
+
*/
|
|
69
|
+
contenteditable?: 'true' | 'false' | 'inherit' | boolean | null | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Represents the text direction of the element
|
|
72
|
+
*/
|
|
73
|
+
dir?: 'ltr' | 'rtl' | 'auto' | null | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Indicates whether the element is draggable
|
|
76
|
+
*/
|
|
77
|
+
draggable?: boolean | null | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Indicates whether the element is hidden
|
|
80
|
+
*/
|
|
81
|
+
hidden?: boolean | null | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Specifies the high value for a range input or a meter element.
|
|
84
|
+
*/
|
|
85
|
+
high?: string | null | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* used to specify the data entry mode for an input. It helps guide on-screen keyboards (especially on mobile devices) to show the appropriate layout for the expected input type
|
|
88
|
+
*/
|
|
89
|
+
inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'email' | 'tel' | 'url' | 'search' | null | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Specifies the primary language for the element's content
|
|
92
|
+
*/
|
|
93
|
+
lang?: string | null | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Specifies the low value for a range input.
|
|
96
|
+
*/
|
|
97
|
+
low?: string | null | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Specifies the maximum value for an input element, meter, or progress element.
|
|
100
|
+
*/
|
|
101
|
+
max?: number | null | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Specifies the minimum value for an input element or a meter element.
|
|
104
|
+
*/
|
|
105
|
+
min?: string | null | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Specifies the optimal value for a gauge or progress element.
|
|
108
|
+
*/
|
|
109
|
+
optimum?: string | null | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Represents a slot in a shadow DOM
|
|
112
|
+
*/
|
|
113
|
+
slot?: string | null | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Represents the spellchecking behavior of the element
|
|
116
|
+
*/
|
|
117
|
+
spellcheck?: 'true' | 'false' | boolean | 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
|
+
* used to tell user agents whether the content should be translated.
|
|
132
|
+
*/
|
|
133
|
+
translate?: 'yes' | 'no' | null | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Specifies the value associated with the element. The meaning and usage may vary depending on the element type.
|
|
136
|
+
*/
|
|
137
|
+
value?: string | null | undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Meter -
|
|
142
|
+
*/
|
|
143
|
+
export class Meter {
|
|
144
|
+
private element: HTMLElement;
|
|
145
|
+
|
|
146
|
+
constructor(props: MeterProps = {}) {
|
|
147
|
+
this.element = document.createElement('meter');
|
|
148
|
+
this.applyProps(props);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private applyProps(props: MeterProps): void {
|
|
152
|
+
if (props.children !== undefined) {
|
|
153
|
+
this.setChildren(props.children);
|
|
154
|
+
}
|
|
155
|
+
if (props.accesskey !== undefined) {
|
|
156
|
+
this.element.setAttribute('accesskey', String(props.accesskey));
|
|
157
|
+
}
|
|
158
|
+
if (props['aria-atomic'] !== undefined) {
|
|
159
|
+
this.setAriaAtomic(props['aria-atomic']);
|
|
160
|
+
}
|
|
161
|
+
if (props['aria-details'] !== undefined) {
|
|
162
|
+
this.element.setAttribute('aria-details', String(props['aria-details']));
|
|
163
|
+
}
|
|
164
|
+
if (props['aria-keyshortcuts'] !== undefined) {
|
|
165
|
+
this.element.setAttribute('aria-keyshortcuts', String(props['aria-keyshortcuts']));
|
|
166
|
+
}
|
|
167
|
+
if (props['aria-live'] !== undefined) {
|
|
168
|
+
this.setAriaLive(props['aria-live']);
|
|
169
|
+
}
|
|
170
|
+
if (props['aria-relevant'] !== undefined) {
|
|
171
|
+
this.setAriaRelevant(props['aria-relevant']);
|
|
172
|
+
}
|
|
173
|
+
if (props['aria-roledescription'] !== undefined) {
|
|
174
|
+
this.element.setAttribute('aria-roledescription', String(props['aria-roledescription']));
|
|
175
|
+
}
|
|
176
|
+
if (props['aria-valuemax'] !== undefined) {
|
|
177
|
+
this.element.setAttribute('aria-valuemax', String(props['aria-valuemax']));
|
|
178
|
+
}
|
|
179
|
+
if (props['aria-valuemin'] !== undefined) {
|
|
180
|
+
this.element.setAttribute('aria-valuemin', String(props['aria-valuemin']));
|
|
181
|
+
}
|
|
182
|
+
if (props['aria-valuenow'] !== undefined) {
|
|
183
|
+
this.element.setAttribute('aria-valuenow', String(props['aria-valuenow']));
|
|
184
|
+
}
|
|
185
|
+
if (props['aria-valuetext'] !== undefined) {
|
|
186
|
+
this.element.setAttribute('aria-valuetext', String(props['aria-valuetext']));
|
|
187
|
+
}
|
|
188
|
+
if (props.autocapitalize !== undefined) {
|
|
189
|
+
this.setAutocapitalize(props.autocapitalize);
|
|
190
|
+
}
|
|
191
|
+
if (props.autofocus !== undefined) {
|
|
192
|
+
this.element.setAttribute('autofocus', String(props.autofocus));
|
|
193
|
+
}
|
|
194
|
+
if (props.contenteditable !== undefined) {
|
|
195
|
+
this.setContenteditable(props.contenteditable);
|
|
196
|
+
}
|
|
197
|
+
if (props.dir !== undefined) {
|
|
198
|
+
this.setDir(props.dir);
|
|
199
|
+
}
|
|
200
|
+
if (props.draggable !== undefined) {
|
|
201
|
+
this.element.setAttribute('draggable', String(props.draggable));
|
|
202
|
+
}
|
|
203
|
+
if (props.hidden !== undefined) {
|
|
204
|
+
this.element.setAttribute('hidden', String(props.hidden));
|
|
205
|
+
}
|
|
206
|
+
if (props.high !== undefined) {
|
|
207
|
+
this.element.setAttribute('high', String(props.high));
|
|
208
|
+
}
|
|
209
|
+
if (props.inputmode !== undefined) {
|
|
210
|
+
this.setInputmode(props.inputmode);
|
|
211
|
+
}
|
|
212
|
+
if (props.lang !== undefined) {
|
|
213
|
+
this.element.setAttribute('lang', String(props.lang));
|
|
214
|
+
}
|
|
215
|
+
if (props.low !== undefined) {
|
|
216
|
+
this.element.setAttribute('low', String(props.low));
|
|
217
|
+
}
|
|
218
|
+
if (props.max !== undefined) {
|
|
219
|
+
this.element.setAttribute('max', String(props.max));
|
|
220
|
+
}
|
|
221
|
+
if (props.min !== undefined) {
|
|
222
|
+
this.element.setAttribute('min', String(props.min));
|
|
223
|
+
}
|
|
224
|
+
if (props.optimum !== undefined) {
|
|
225
|
+
this.element.setAttribute('optimum', String(props.optimum));
|
|
226
|
+
}
|
|
227
|
+
if (props.slot !== undefined) {
|
|
228
|
+
this.element.setAttribute('slot', String(props.slot));
|
|
229
|
+
}
|
|
230
|
+
if (props.spellcheck !== undefined) {
|
|
231
|
+
this.setSpellcheck(props.spellcheck);
|
|
232
|
+
}
|
|
233
|
+
if (props.style !== undefined) {
|
|
234
|
+
this.element.setAttribute('style', String(props.style));
|
|
235
|
+
}
|
|
236
|
+
if (props.tabindex !== undefined) {
|
|
237
|
+
this.element.setAttribute('tabindex', String(props.tabindex));
|
|
238
|
+
}
|
|
239
|
+
if (props.title !== undefined) {
|
|
240
|
+
this.element.setAttribute('title', String(props.title));
|
|
241
|
+
}
|
|
242
|
+
if (props.translate !== undefined) {
|
|
243
|
+
this.setTranslate(props.translate);
|
|
244
|
+
}
|
|
245
|
+
if (props.value !== undefined) {
|
|
246
|
+
this.element.setAttribute('value', String(props.value));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
setAccesskey(value: string | null | undefined): this {
|
|
251
|
+
if (value === null || value === undefined) {
|
|
252
|
+
this.element.removeAttribute('accesskey');
|
|
253
|
+
} else {
|
|
254
|
+
this.element.setAttribute('accesskey', String(value));
|
|
255
|
+
}
|
|
256
|
+
return this;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
setAriaAtomic(value: 'false' | 'true' | boolean | null | undefined): this {
|
|
260
|
+
if (value === null || value === undefined) {
|
|
261
|
+
this.element.removeAttribute('aria-atomic');
|
|
262
|
+
} else {
|
|
263
|
+
this.element.setAttribute('aria-atomic', String(value));
|
|
264
|
+
}
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
setAriaDetails(value: string | null | undefined): this {
|
|
269
|
+
if (value === null || value === undefined) {
|
|
270
|
+
this.element.removeAttribute('aria-details');
|
|
271
|
+
} else {
|
|
272
|
+
this.element.setAttribute('aria-details', String(value));
|
|
273
|
+
}
|
|
274
|
+
return this;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
setAriaKeyshortcuts(value: string | null | undefined): this {
|
|
278
|
+
if (value === null || value === undefined) {
|
|
279
|
+
this.element.removeAttribute('aria-keyshortcuts');
|
|
280
|
+
} else {
|
|
281
|
+
this.element.setAttribute('aria-keyshortcuts', String(value));
|
|
282
|
+
}
|
|
283
|
+
return this;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
setAriaLive(value: 'off' | 'polite' | 'assertive' | null | undefined): this {
|
|
287
|
+
if (value === null || value === undefined) {
|
|
288
|
+
this.element.removeAttribute('aria-live');
|
|
289
|
+
} else {
|
|
290
|
+
this.element.setAttribute('aria-live', String(value));
|
|
291
|
+
}
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
setAriaRelevant(value: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined): this {
|
|
296
|
+
if (value === null || value === undefined) {
|
|
297
|
+
this.element.removeAttribute('aria-relevant');
|
|
298
|
+
} else {
|
|
299
|
+
this.element.setAttribute('aria-relevant', String(value));
|
|
300
|
+
}
|
|
301
|
+
return this;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
setAriaRoledescription(value: string | null | undefined): this {
|
|
305
|
+
if (value === null || value === undefined) {
|
|
306
|
+
this.element.removeAttribute('aria-roledescription');
|
|
307
|
+
} else {
|
|
308
|
+
this.element.setAttribute('aria-roledescription', String(value));
|
|
309
|
+
}
|
|
310
|
+
return this;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
setAriaValuemax(value: number | null | undefined): this {
|
|
314
|
+
if (value === null || value === undefined) {
|
|
315
|
+
this.element.removeAttribute('aria-valuemax');
|
|
316
|
+
} else {
|
|
317
|
+
this.element.setAttribute('aria-valuemax', String(value));
|
|
318
|
+
}
|
|
319
|
+
return this;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
setAriaValuemin(value: number | null | undefined): this {
|
|
323
|
+
if (value === null || value === undefined) {
|
|
324
|
+
this.element.removeAttribute('aria-valuemin');
|
|
325
|
+
} else {
|
|
326
|
+
this.element.setAttribute('aria-valuemin', String(value));
|
|
327
|
+
}
|
|
328
|
+
return this;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
setAriaValuenow(value: number | null | undefined): this {
|
|
332
|
+
if (value === null || value === undefined) {
|
|
333
|
+
this.element.removeAttribute('aria-valuenow');
|
|
334
|
+
} else {
|
|
335
|
+
this.element.setAttribute('aria-valuenow', String(value));
|
|
336
|
+
}
|
|
337
|
+
return this;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
setAriaValuetext(value: string | null | undefined): this {
|
|
341
|
+
if (value === null || value === undefined) {
|
|
342
|
+
this.element.removeAttribute('aria-valuetext');
|
|
343
|
+
} else {
|
|
344
|
+
this.element.setAttribute('aria-valuetext', String(value));
|
|
345
|
+
}
|
|
346
|
+
return this;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
setAutocapitalize(value: 'none' | 'sentences' | 'words' | 'characters' | null | undefined): this {
|
|
350
|
+
if (value === null || value === undefined) {
|
|
351
|
+
this.element.removeAttribute('autocapitalize');
|
|
352
|
+
} else {
|
|
353
|
+
this.element.setAttribute('autocapitalize', String(value));
|
|
354
|
+
}
|
|
355
|
+
return this;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
setAutofocus(value: boolean | null | undefined): this {
|
|
359
|
+
if (value === true) {
|
|
360
|
+
this.element.setAttribute('autofocus', '');
|
|
361
|
+
} else {
|
|
362
|
+
this.element.removeAttribute('autofocus');
|
|
363
|
+
}
|
|
364
|
+
return this;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
setContenteditable(value: 'true' | 'false' | 'inherit' | boolean | null | undefined): this {
|
|
368
|
+
if (value === null || value === undefined) {
|
|
369
|
+
this.element.removeAttribute('contenteditable');
|
|
370
|
+
} else {
|
|
371
|
+
this.element.setAttribute('contenteditable', String(value));
|
|
372
|
+
}
|
|
373
|
+
return this;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
setDir(value: 'ltr' | 'rtl' | 'auto' | null | undefined): this {
|
|
377
|
+
if (value === null || value === undefined) {
|
|
378
|
+
this.element.removeAttribute('dir');
|
|
379
|
+
} else {
|
|
380
|
+
this.element.setAttribute('dir', String(value));
|
|
381
|
+
}
|
|
382
|
+
return this;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
setDraggable(value: boolean | null | undefined): this {
|
|
386
|
+
if (value === true) {
|
|
387
|
+
this.element.setAttribute('draggable', '');
|
|
388
|
+
} else {
|
|
389
|
+
this.element.removeAttribute('draggable');
|
|
390
|
+
}
|
|
391
|
+
return this;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
setHidden(value: boolean | null | undefined): this {
|
|
395
|
+
if (value === true) {
|
|
396
|
+
this.element.setAttribute('hidden', '');
|
|
397
|
+
} else {
|
|
398
|
+
this.element.removeAttribute('hidden');
|
|
399
|
+
}
|
|
400
|
+
return this;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
setHigh(value: string | null | undefined): this {
|
|
404
|
+
if (value === null || value === undefined) {
|
|
405
|
+
this.element.removeAttribute('high');
|
|
406
|
+
} else {
|
|
407
|
+
this.element.setAttribute('high', String(value));
|
|
408
|
+
}
|
|
409
|
+
return this;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
setInputmode(value: 'none' | 'text' | 'decimal' | 'numeric' | 'email' | 'tel' | 'url' | 'search' | null | undefined): this {
|
|
413
|
+
if (value === null || value === undefined) {
|
|
414
|
+
this.element.removeAttribute('inputmode');
|
|
415
|
+
} else {
|
|
416
|
+
this.element.setAttribute('inputmode', String(value));
|
|
417
|
+
}
|
|
418
|
+
return this;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
setLang(value: string | null | undefined): this {
|
|
422
|
+
if (value === null || value === undefined) {
|
|
423
|
+
this.element.removeAttribute('lang');
|
|
424
|
+
} else {
|
|
425
|
+
this.element.setAttribute('lang', String(value));
|
|
426
|
+
}
|
|
427
|
+
return this;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
setLow(value: string | null | undefined): this {
|
|
431
|
+
if (value === null || value === undefined) {
|
|
432
|
+
this.element.removeAttribute('low');
|
|
433
|
+
} else {
|
|
434
|
+
this.element.setAttribute('low', String(value));
|
|
435
|
+
}
|
|
436
|
+
return this;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
setMax(value: number | null | undefined): this {
|
|
440
|
+
if (value === null || value === undefined) {
|
|
441
|
+
this.element.removeAttribute('max');
|
|
442
|
+
} else {
|
|
443
|
+
this.element.setAttribute('max', String(value));
|
|
444
|
+
}
|
|
445
|
+
return this;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
setMin(value: string | null | undefined): this {
|
|
449
|
+
if (value === null || value === undefined) {
|
|
450
|
+
this.element.removeAttribute('min');
|
|
451
|
+
} else {
|
|
452
|
+
this.element.setAttribute('min', String(value));
|
|
453
|
+
}
|
|
454
|
+
return this;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
setOptimum(value: string | null | undefined): this {
|
|
458
|
+
if (value === null || value === undefined) {
|
|
459
|
+
this.element.removeAttribute('optimum');
|
|
460
|
+
} else {
|
|
461
|
+
this.element.setAttribute('optimum', String(value));
|
|
462
|
+
}
|
|
463
|
+
return this;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
setSlot(value: string | null | undefined): this {
|
|
467
|
+
if (value === null || value === undefined) {
|
|
468
|
+
this.element.removeAttribute('slot');
|
|
469
|
+
} else {
|
|
470
|
+
this.element.setAttribute('slot', String(value));
|
|
471
|
+
}
|
|
472
|
+
return this;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
setSpellcheck(value: 'true' | 'false' | boolean | null | undefined): this {
|
|
476
|
+
if (value === null || value === undefined) {
|
|
477
|
+
this.element.removeAttribute('spellcheck');
|
|
478
|
+
} else {
|
|
479
|
+
this.element.setAttribute('spellcheck', String(value));
|
|
480
|
+
}
|
|
481
|
+
return this;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
setStyle(value: string | null | undefined): this {
|
|
485
|
+
if (value === null || value === undefined) {
|
|
486
|
+
this.element.removeAttribute('style');
|
|
487
|
+
} else {
|
|
488
|
+
this.element.setAttribute('style', String(value));
|
|
489
|
+
}
|
|
490
|
+
return this;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
setTabindex(value: number | null | undefined): this {
|
|
494
|
+
if (value === null || value === undefined) {
|
|
495
|
+
this.element.removeAttribute('tabindex');
|
|
496
|
+
} else {
|
|
497
|
+
this.element.setAttribute('tabindex', String(value));
|
|
498
|
+
}
|
|
499
|
+
return this;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
setTitle(value: string | null | undefined): this {
|
|
503
|
+
if (value === null || value === undefined) {
|
|
504
|
+
this.element.removeAttribute('title');
|
|
505
|
+
} else {
|
|
506
|
+
this.element.setAttribute('title', String(value));
|
|
507
|
+
}
|
|
508
|
+
return this;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
setTranslate(value: 'yes' | 'no' | null | undefined): this {
|
|
512
|
+
if (value === null || value === undefined) {
|
|
513
|
+
this.element.removeAttribute('translate');
|
|
514
|
+
} else {
|
|
515
|
+
this.element.setAttribute('translate', String(value));
|
|
516
|
+
}
|
|
517
|
+
return this;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
setValue(value: string | null | undefined): this {
|
|
521
|
+
if (value === null || value === undefined) {
|
|
522
|
+
this.element.removeAttribute('value');
|
|
523
|
+
} else {
|
|
524
|
+
this.element.setAttribute('value', String(value));
|
|
525
|
+
}
|
|
526
|
+
return this;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
setChildren(children: string | HTMLElement | (string | HTMLElement)[]): this {
|
|
530
|
+
// Clear existing children
|
|
531
|
+
while (this.element.firstChild) {
|
|
532
|
+
this.element.removeChild(this.element.firstChild);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (typeof children === 'string') {
|
|
536
|
+
this.element.textContent = children;
|
|
537
|
+
} else if (Array.isArray(children)) {
|
|
538
|
+
children.forEach(child => {
|
|
539
|
+
if (typeof child === 'string') {
|
|
540
|
+
this.element.appendChild(document.createTextNode(child));
|
|
541
|
+
} else {
|
|
542
|
+
this.element.appendChild(child);
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
} else {
|
|
546
|
+
this.element.appendChild(children);
|
|
547
|
+
}
|
|
548
|
+
return this;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
getElement(): HTMLElement {
|
|
552
|
+
return this.element;
|
|
553
|
+
}
|
|
554
|
+
}
|