@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.
Files changed (117) hide show
  1. package/README.md +166 -0
  2. package/block/article/article.ts +506 -0
  3. package/block/aside/aside.ts +522 -0
  4. package/block/audio/audio.ts +506 -0
  5. package/block/blockquote/blockquote.ts +522 -0
  6. package/block/body/body.ts +458 -0
  7. package/block/canvas/canvas.ts +538 -0
  8. package/block/caption/caption.ts +506 -0
  9. package/block/colgroup/colgroup.ts +154 -0
  10. package/block/datalist/datalist.ts +506 -0
  11. package/block/dd/dd.ts +506 -0
  12. package/block/del/del.ts +538 -0
  13. package/block/details/details.ts +586 -0
  14. package/block/dialog/dialog.ts +586 -0
  15. package/block/div/div.ts +586 -0
  16. package/block/dl/dl.ts +506 -0
  17. package/block/dt/dt.ts +506 -0
  18. package/block/embed/embed.ts +317 -0
  19. package/block/fieldset/fieldset.ts +570 -0
  20. package/block/figcaption/figcaption.ts +506 -0
  21. package/block/figure/figure.ts +506 -0
  22. package/block/footer/footer.ts +522 -0
  23. package/block/form/form.ts +490 -0
  24. package/block/h1/h1.ts +490 -0
  25. package/block/h2/h2.ts +490 -0
  26. package/block/h3/h3.ts +490 -0
  27. package/block/h4/h4.ts +490 -0
  28. package/block/h5/h5.ts +490 -0
  29. package/block/h6/h6.ts +490 -0
  30. package/block/header/header.ts +298 -0
  31. package/block/hgroup/hgroup.ts +506 -0
  32. package/block/hr/hr.ts +189 -0
  33. package/block/html/html.ts +106 -0
  34. package/block/iframe/iframe.ts +538 -0
  35. package/block/ins/ins.ts +538 -0
  36. package/block/legend/legend.ts +506 -0
  37. package/block/li/li.ts +602 -0
  38. package/block/main/main.ts +538 -0
  39. package/block/map/map.ts +522 -0
  40. package/block/menu/menu.ts +554 -0
  41. package/block/nav/nav.ts +554 -0
  42. package/block/noscript/noscript.ts +282 -0
  43. package/block/object/object.ts +618 -0
  44. package/block/ol/ol.ts +618 -0
  45. package/block/optgroup/optgroup.ts +522 -0
  46. package/block/option/option.ts +618 -0
  47. package/block/p/p.ts +506 -0
  48. package/block/picture/picture.ts +506 -0
  49. package/block/pre/pre.ts +506 -0
  50. package/block/section/section.ts +538 -0
  51. package/block/summary/summary.ts +570 -0
  52. package/block/table/table.ts +570 -0
  53. package/block/tbody/tbody.ts +506 -0
  54. package/block/td/td.ts +666 -0
  55. package/block/template/template.ts +506 -0
  56. package/block/tfoot/tfoot.ts +506 -0
  57. package/block/th/th.ts +682 -0
  58. package/block/thead/thead.ts +506 -0
  59. package/block/tr/tr.ts +682 -0
  60. package/block/ul/ul.ts +570 -0
  61. package/block/video/video.ts +666 -0
  62. package/index.ts +126 -0
  63. package/inline/a/a.ts +682 -0
  64. package/inline/abbr/abbr.ts +490 -0
  65. package/inline/address/address.ts +474 -0
  66. package/inline/b/b.ts +506 -0
  67. package/inline/bdi/bdi.ts +490 -0
  68. package/inline/bdo/bdo.ts +506 -0
  69. package/inline/button/button.ts +826 -0
  70. package/inline/cite/cite.ts +506 -0
  71. package/inline/code/code.ts +506 -0
  72. package/inline/data/data.ts +522 -0
  73. package/inline/dfn/dfn.ts +506 -0
  74. package/inline/em/em.ts +506 -0
  75. package/inline/i/i.ts +506 -0
  76. package/inline/img/img.ts +445 -0
  77. package/inline/input/input.ts +1197 -0
  78. package/inline/kbd/kbd.ts +506 -0
  79. package/inline/label/label.ts +538 -0
  80. package/inline/mark/mark.ts +506 -0
  81. package/inline/meter/meter.ts +554 -0
  82. package/inline/output/output.ts +426 -0
  83. package/inline/progress/progress.ts +490 -0
  84. package/inline/q/q.ts +522 -0
  85. package/inline/rp/rp.ts +506 -0
  86. package/inline/rt/rt.ts +506 -0
  87. package/inline/ruby/ruby.ts +506 -0
  88. package/inline/s/s.ts +506 -0
  89. package/inline/samp/samp.ts +506 -0
  90. package/inline/select/select.ts +810 -0
  91. package/inline/slot/slot.ts +522 -0
  92. package/inline/small/small.ts +506 -0
  93. package/inline/span/span.ts +506 -0
  94. package/inline/strong/strong.ts +506 -0
  95. package/inline/sub/sub.ts +506 -0
  96. package/inline/sup/sup.ts +506 -0
  97. package/inline/svg/svg.ts +618 -0
  98. package/inline/textarea/textarea.ts +874 -0
  99. package/inline/time/time.ts +522 -0
  100. package/inline/u/u.ts +506 -0
  101. package/inline/var/var.ts +506 -0
  102. package/package.json +32 -0
  103. package/tsconfig.json +26 -0
  104. package/void/area/area.ts +397 -0
  105. package/void/base/base.ts +61 -0
  106. package/void/br/br.ts +77 -0
  107. package/void/col/col.ts +77 -0
  108. package/void/head/head.ts +58 -0
  109. package/void/link/link.ts +253 -0
  110. package/void/meta/meta.ts +157 -0
  111. package/void/param/param.ts +93 -0
  112. package/void/script/script.ts +250 -0
  113. package/void/source/source.ts +125 -0
  114. package/void/style/style.ts +154 -0
  115. package/void/title/title.ts +58 -0
  116. package/void/track/track.ts +157 -0
  117. package/void/wbr/wbr.ts +61 -0
@@ -0,0 +1,826 @@
1
+ /**
2
+ * THIS FILE IS AUTOGENERATED. DO NOT EDIT IT.
3
+ *
4
+ * @generated December 28, 2025 12:26:31
5
+ * @component Button
6
+ * @description
7
+ */
8
+
9
+ export interface ButtonProps {
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
+ * 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
+ * Defines the checked state for checkboxes, radio buttons, or toggle switches.
28
+ */
29
+ 'aria-checked'?: 'false' | 'true' | 'mixed' | 'undefined' | boolean | null | undefined;
30
+ /**
31
+ * Identifies the element(s) whose contents or presence are controlled by this element. Value is a list of IDs separated by a space
32
+ */
33
+ 'aria-controls'?: string | null | undefined;
34
+ /**
35
+ * Indicates the current item within a container or set of related elements.
36
+ */
37
+ 'aria-current'?: 'false' | 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | boolean | null | undefined;
38
+ /**
39
+ * Identifies the element(s) that describes the object. Value is a list of IDs separated by a space
40
+ */
41
+ 'aria-describedby'?: string | null | undefined;
42
+ /**
43
+ * References an element that provides additional details about the current element.
44
+ */
45
+ 'aria-details'?: string | null | undefined;
46
+ /**
47
+ * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
48
+ */
49
+ 'aria-disabled'?: 'false' | 'true' | boolean | null | undefined;
50
+ /**
51
+ * Indicates whether a collapsible UI element is expanded (true) or collapsed (false).
52
+ */
53
+ 'aria-expanded'?: 'false' | 'true' | 'undefined' | boolean | null | undefined;
54
+ /**
55
+ * Indicates that an element has an associated popup menu, listbox, tree, grid, or dialog.
56
+ */
57
+ 'aria-haspopup'?: 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | boolean | null | undefined;
58
+ /**
59
+ * Defines keyboard shortcuts available for the element.
60
+ */
61
+ 'aria-keyshortcuts'?: string | null | undefined;
62
+ /**
63
+ * Defines a string value that labels the current element for assistive technologies.
64
+ */
65
+ 'aria-label'?: string | null | undefined;
66
+ /**
67
+ * Identifies the element(s) that labels the current element. Value is a list of IDs separated by a space
68
+ */
69
+ 'aria-labelledby'?: string | null | undefined;
70
+ /**
71
+ * Defines how updates to the element should be announced to screen readers.
72
+ */
73
+ 'aria-live'?: 'off' | 'polite' | 'assertive' | null | undefined;
74
+ /**
75
+ * Indicates whether a toggle button is pressed (true, false, or mixed).
76
+ */
77
+ 'aria-pressed'?: 'false' | 'true' | 'mixed' | 'undefined' | boolean | null | undefined;
78
+ /**
79
+ * Indicates what content changes should be announced in a live region.
80
+ */
81
+ 'aria-relevant'?: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined;
82
+ /**
83
+ * Provides a human-readable custom role description for assistive technologies.
84
+ */
85
+ 'aria-roledescription'?: string | null | undefined;
86
+ /**
87
+ * Represents the autocapitalize behavior of the element
88
+ */
89
+ autocapitalize?: 'none' | 'sentences' | 'words' | 'characters' | null | undefined;
90
+ /**
91
+ * Specifies controls whether autocorrection of editable text is enabled for spelling and/or punctuation errors. Default is on.
92
+ */
93
+ autocorrect?: 'off' | 'on' | null | undefined;
94
+ /**
95
+ * Indicates whether the element is hidden
96
+ */
97
+ autofocus?: boolean | null | undefined;
98
+ /**
99
+ * Specifies the action to be performed on an element controlled via commandfor attribute. Supports dialog operations (show-modal, close, request-close), popover operations (show-popover, hide-popover, toggle-popover), and custom commands prefixed with "--". Provides declarative element control without JavaScript. Element-specific to button element.
100
+ */
101
+ command?: string | null | undefined;
102
+ /**
103
+ * Turns the button into a command button by specifying the ID of the element to control. Works with the command attribute to define the action. A more general version of popovertarget. Enables declarative control of interactive elements. Element-specific to button element.
104
+ */
105
+ commandfor?: string | null | undefined;
106
+ /**
107
+ * Indicates whether the element can be edited in place
108
+ */
109
+ contenteditable?: 'true' | 'false' | 'inherit' | boolean | null | undefined;
110
+ /**
111
+ * Represents the text direction of the element
112
+ */
113
+ dir?: 'ltr' | 'rtl' | 'auto' | null | undefined;
114
+ /**
115
+ * When present, it specifies that an input element should be disabled.
116
+ */
117
+ disabled?: boolean | null | undefined;
118
+ /**
119
+ * Indicates whether the element is draggable
120
+ */
121
+ draggable?: boolean | null | undefined;
122
+ /**
123
+ * Associates the button with a form element by ID. Allows buttons to be associated with forms anywhere in the document, not just inside a form element. Can override ancestor form association. Element-specific to button, input, object, select, textarea, and fieldset.
124
+ */
125
+ form?: string | null | undefined;
126
+ /**
127
+ * The URL that processes the form submission. Overrides the action attribute of the button's form owner. Only applies to submit buttons. Element-specific to button and input elements with type submit or image.
128
+ */
129
+ formaction?: string | null | undefined;
130
+ /**
131
+ * Specifies how form data should be encoded when submitting to the server. Only for submit buttons. Overrides the form's enctype attribute. Element-specific to button and input elements with type submit or image.
132
+ */
133
+ formenctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain' | null | undefined;
134
+ /**
135
+ * Specifies the HTTP method to use when submitting the form. Only for submit buttons. Overrides the form's method attribute. Use "post" for sensitive data, "get" for idempotent operations, "dialog" to close dialog without submission. Element-specific to button and input elements with type submit or image.
136
+ */
137
+ formmethod?: 'get' | 'post' | 'dialog' | null | undefined;
138
+ /**
139
+ * When present, specifies that the form should not be validated when submitted. Only applies to submit buttons. Overrides the form's novalidate attribute. Element-specific to button and input elements with type submit or image.
140
+ */
141
+ formnovalidate?: boolean | null | undefined;
142
+ /**
143
+ *
144
+ */
145
+ formtarget?: '_self' | '_blank' | '_parent' | '_top' | string | null | undefined;
146
+ /**
147
+ * Indicates whether the element is hidden
148
+ */
149
+ hidden?: boolean | null | undefined;
150
+ /**
151
+ * 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
152
+ */
153
+ inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'email' | 'tel' | 'url' | 'search' | null | undefined;
154
+ /**
155
+ * Specifies the primary language for the element's content
156
+ */
157
+ lang?: string | null | undefined;
158
+ /**
159
+ * Specifies the name associated with the element. The meaning may vary depending on the context.
160
+ */
161
+ name?: string | null | undefined;
162
+ /**
163
+ * Turns the button into a popover control by specifying the ID of the popover element to control. Creates implicit aria-details and aria-expanded relationships, establishes anchor positioning reference, and improves accessibility. Part of the Popover API. Element-specific to button and input elements.
164
+ */
165
+ popovertarget?: string | null | undefined;
166
+ /**
167
+ * Specifies the action to perform on the popover element controlled by popovertarget. "show" displays a hidden popover, "hide" hides a visible popover, "toggle" (default) switches between states. Part of the Popover API. Element-specific to button and input elements.
168
+ */
169
+ popovertargetaction?: 'show' | 'hide' | 'toggle' | null | undefined;
170
+ /**
171
+ * Defines the semantic purpose of an element for assistive technologies.
172
+ */
173
+ 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;
174
+ /**
175
+ * Represents a slot in a shadow DOM
176
+ */
177
+ slot?: string | null | undefined;
178
+ /**
179
+ * Represents the spellchecking behavior of the element
180
+ */
181
+ spellcheck?: 'true' | 'false' | boolean | null | undefined;
182
+ /**
183
+ * Represents the CSS inline style of the element
184
+ */
185
+ style?: string | null | undefined;
186
+ /**
187
+ * Represents a tab order of the element
188
+ */
189
+ tabindex?: number | null | undefined;
190
+ /**
191
+ * Represents a title or tooltip for the element
192
+ */
193
+ title?: string | null | undefined;
194
+ /**
195
+ * used to tell user agents whether the content should be translated.
196
+ */
197
+ translate?: 'yes' | 'no' | null | undefined;
198
+ /**
199
+ * Specifies the type of the button.
200
+ */
201
+ type?: 'submit' | 'reset' | 'button' | null | undefined;
202
+ /**
203
+ * Specifies the value associated with the element. The meaning and usage may vary depending on the element type.
204
+ */
205
+ value?: string | null | undefined;
206
+ }
207
+
208
+ /**
209
+ * Button -
210
+ */
211
+ export class Button {
212
+ private element: HTMLElement;
213
+
214
+ constructor(props: ButtonProps = {}) {
215
+ this.element = document.createElement('button');
216
+ this.applyProps(props);
217
+ }
218
+
219
+ private applyProps(props: ButtonProps): void {
220
+ if (props.children !== undefined) {
221
+ this.setChildren(props.children);
222
+ }
223
+ if (props.accesskey !== undefined) {
224
+ this.element.setAttribute('accesskey', String(props.accesskey));
225
+ }
226
+ if (props['aria-atomic'] !== undefined) {
227
+ this.setAriaAtomic(props['aria-atomic']);
228
+ }
229
+ if (props['aria-busy'] !== undefined) {
230
+ this.setAriaBusy(props['aria-busy']);
231
+ }
232
+ if (props['aria-checked'] !== undefined) {
233
+ this.setAriaChecked(props['aria-checked']);
234
+ }
235
+ if (props['aria-controls'] !== undefined) {
236
+ this.element.setAttribute('aria-controls', String(props['aria-controls']));
237
+ }
238
+ if (props['aria-current'] !== undefined) {
239
+ this.setAriaCurrent(props['aria-current']);
240
+ }
241
+ if (props['aria-describedby'] !== undefined) {
242
+ this.element.setAttribute('aria-describedby', String(props['aria-describedby']));
243
+ }
244
+ if (props['aria-details'] !== undefined) {
245
+ this.element.setAttribute('aria-details', String(props['aria-details']));
246
+ }
247
+ if (props['aria-disabled'] !== undefined) {
248
+ this.setAriaDisabled(props['aria-disabled']);
249
+ }
250
+ if (props['aria-expanded'] !== undefined) {
251
+ this.setAriaExpanded(props['aria-expanded']);
252
+ }
253
+ if (props['aria-haspopup'] !== undefined) {
254
+ this.setAriaHaspopup(props['aria-haspopup']);
255
+ }
256
+ if (props['aria-keyshortcuts'] !== undefined) {
257
+ this.element.setAttribute('aria-keyshortcuts', String(props['aria-keyshortcuts']));
258
+ }
259
+ if (props['aria-label'] !== undefined) {
260
+ this.element.setAttribute('aria-label', String(props['aria-label']));
261
+ }
262
+ if (props['aria-labelledby'] !== undefined) {
263
+ this.element.setAttribute('aria-labelledby', String(props['aria-labelledby']));
264
+ }
265
+ if (props['aria-live'] !== undefined) {
266
+ this.setAriaLive(props['aria-live']);
267
+ }
268
+ if (props['aria-pressed'] !== undefined) {
269
+ this.setAriaPressed(props['aria-pressed']);
270
+ }
271
+ if (props['aria-relevant'] !== undefined) {
272
+ this.setAriaRelevant(props['aria-relevant']);
273
+ }
274
+ if (props['aria-roledescription'] !== undefined) {
275
+ this.element.setAttribute('aria-roledescription', String(props['aria-roledescription']));
276
+ }
277
+ if (props.autocapitalize !== undefined) {
278
+ this.setAutocapitalize(props.autocapitalize);
279
+ }
280
+ if (props.autocorrect !== undefined) {
281
+ this.setAutocorrect(props.autocorrect);
282
+ }
283
+ if (props.autofocus !== undefined) {
284
+ this.element.setAttribute('autofocus', String(props.autofocus));
285
+ }
286
+ if (props.command !== undefined) {
287
+ this.element.setAttribute('command', String(props.command));
288
+ }
289
+ if (props.commandfor !== undefined) {
290
+ this.element.setAttribute('commandfor', String(props.commandfor));
291
+ }
292
+ if (props.contenteditable !== undefined) {
293
+ this.setContenteditable(props.contenteditable);
294
+ }
295
+ if (props.dir !== undefined) {
296
+ this.setDir(props.dir);
297
+ }
298
+ if (props.disabled !== undefined) {
299
+ this.element.setAttribute('disabled', String(props.disabled));
300
+ }
301
+ if (props.draggable !== undefined) {
302
+ this.element.setAttribute('draggable', String(props.draggable));
303
+ }
304
+ if (props.form !== undefined) {
305
+ this.element.setAttribute('form', String(props.form));
306
+ }
307
+ if (props.formaction !== undefined) {
308
+ this.element.setAttribute('formaction', String(props.formaction));
309
+ }
310
+ if (props.formenctype !== undefined) {
311
+ this.setFormenctype(props.formenctype);
312
+ }
313
+ if (props.formmethod !== undefined) {
314
+ this.setFormmethod(props.formmethod);
315
+ }
316
+ if (props.formnovalidate !== undefined) {
317
+ this.element.setAttribute('formnovalidate', String(props.formnovalidate));
318
+ }
319
+ if (props.formtarget !== undefined) {
320
+ this.setFormtarget(props.formtarget);
321
+ }
322
+ if (props.hidden !== undefined) {
323
+ this.element.setAttribute('hidden', String(props.hidden));
324
+ }
325
+ if (props.inputmode !== undefined) {
326
+ this.setInputmode(props.inputmode);
327
+ }
328
+ if (props.lang !== undefined) {
329
+ this.element.setAttribute('lang', String(props.lang));
330
+ }
331
+ if (props.name !== undefined) {
332
+ this.element.setAttribute('name', String(props.name));
333
+ }
334
+ if (props.popovertarget !== undefined) {
335
+ this.element.setAttribute('popovertarget', String(props.popovertarget));
336
+ }
337
+ if (props.popovertargetaction !== undefined) {
338
+ this.setPopovertargetaction(props.popovertargetaction);
339
+ }
340
+ if (props.role !== undefined) {
341
+ this.setRole(props.role);
342
+ }
343
+ if (props.slot !== undefined) {
344
+ this.element.setAttribute('slot', String(props.slot));
345
+ }
346
+ if (props.spellcheck !== undefined) {
347
+ this.setSpellcheck(props.spellcheck);
348
+ }
349
+ if (props.style !== undefined) {
350
+ this.element.setAttribute('style', String(props.style));
351
+ }
352
+ if (props.tabindex !== undefined) {
353
+ this.element.setAttribute('tabindex', String(props.tabindex));
354
+ }
355
+ if (props.title !== undefined) {
356
+ this.element.setAttribute('title', String(props.title));
357
+ }
358
+ if (props.translate !== undefined) {
359
+ this.setTranslate(props.translate);
360
+ }
361
+ if (props.type !== undefined) {
362
+ this.setType(props.type);
363
+ }
364
+ if (props.value !== undefined) {
365
+ this.element.setAttribute('value', String(props.value));
366
+ }
367
+ }
368
+
369
+ setAccesskey(value: string | null | undefined): this {
370
+ if (value === null || value === undefined) {
371
+ this.element.removeAttribute('accesskey');
372
+ } else {
373
+ this.element.setAttribute('accesskey', String(value));
374
+ }
375
+ return this;
376
+ }
377
+
378
+ setAriaAtomic(value: 'false' | 'true' | boolean | null | undefined): this {
379
+ if (value === null || value === undefined) {
380
+ this.element.removeAttribute('aria-atomic');
381
+ } else {
382
+ this.element.setAttribute('aria-atomic', String(value));
383
+ }
384
+ return this;
385
+ }
386
+
387
+ setAriaBusy(value: 'true' | 'false' | boolean | null | undefined): this {
388
+ if (value === null || value === undefined) {
389
+ this.element.removeAttribute('aria-busy');
390
+ } else {
391
+ this.element.setAttribute('aria-busy', String(value));
392
+ }
393
+ return this;
394
+ }
395
+
396
+ setAriaChecked(value: 'false' | 'true' | 'mixed' | 'undefined' | boolean | null | undefined): this {
397
+ if (value === null || value === undefined) {
398
+ this.element.removeAttribute('aria-checked');
399
+ } else {
400
+ this.element.setAttribute('aria-checked', String(value));
401
+ }
402
+ return this;
403
+ }
404
+
405
+ setAriaControls(value: string | null | undefined): this {
406
+ if (value === null || value === undefined) {
407
+ this.element.removeAttribute('aria-controls');
408
+ } else {
409
+ this.element.setAttribute('aria-controls', String(value));
410
+ }
411
+ return this;
412
+ }
413
+
414
+ setAriaCurrent(value: 'false' | 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | boolean | null | undefined): this {
415
+ if (value === null || value === undefined) {
416
+ this.element.removeAttribute('aria-current');
417
+ } else {
418
+ this.element.setAttribute('aria-current', String(value));
419
+ }
420
+ return this;
421
+ }
422
+
423
+ setAriaDescribedby(value: string | null | undefined): this {
424
+ if (value === null || value === undefined) {
425
+ this.element.removeAttribute('aria-describedby');
426
+ } else {
427
+ this.element.setAttribute('aria-describedby', String(value));
428
+ }
429
+ return this;
430
+ }
431
+
432
+ setAriaDetails(value: string | null | undefined): this {
433
+ if (value === null || value === undefined) {
434
+ this.element.removeAttribute('aria-details');
435
+ } else {
436
+ this.element.setAttribute('aria-details', String(value));
437
+ }
438
+ return this;
439
+ }
440
+
441
+ setAriaDisabled(value: 'false' | 'true' | boolean | null | undefined): this {
442
+ if (value === null || value === undefined) {
443
+ this.element.removeAttribute('aria-disabled');
444
+ } else {
445
+ this.element.setAttribute('aria-disabled', String(value));
446
+ }
447
+ return this;
448
+ }
449
+
450
+ setAriaExpanded(value: 'false' | 'true' | 'undefined' | boolean | null | undefined): this {
451
+ if (value === null || value === undefined) {
452
+ this.element.removeAttribute('aria-expanded');
453
+ } else {
454
+ this.element.setAttribute('aria-expanded', String(value));
455
+ }
456
+ return this;
457
+ }
458
+
459
+ setAriaHaspopup(value: 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | boolean | null | undefined): this {
460
+ if (value === null || value === undefined) {
461
+ this.element.removeAttribute('aria-haspopup');
462
+ } else {
463
+ this.element.setAttribute('aria-haspopup', String(value));
464
+ }
465
+ return this;
466
+ }
467
+
468
+ setAriaKeyshortcuts(value: string | null | undefined): this {
469
+ if (value === null || value === undefined) {
470
+ this.element.removeAttribute('aria-keyshortcuts');
471
+ } else {
472
+ this.element.setAttribute('aria-keyshortcuts', String(value));
473
+ }
474
+ return this;
475
+ }
476
+
477
+ setAriaLabel(value: string | null | undefined): this {
478
+ if (value === null || value === undefined) {
479
+ this.element.removeAttribute('aria-label');
480
+ } else {
481
+ this.element.setAttribute('aria-label', String(value));
482
+ }
483
+ return this;
484
+ }
485
+
486
+ setAriaLabelledby(value: string | null | undefined): this {
487
+ if (value === null || value === undefined) {
488
+ this.element.removeAttribute('aria-labelledby');
489
+ } else {
490
+ this.element.setAttribute('aria-labelledby', String(value));
491
+ }
492
+ return this;
493
+ }
494
+
495
+ setAriaLive(value: 'off' | 'polite' | 'assertive' | null | undefined): this {
496
+ if (value === null || value === undefined) {
497
+ this.element.removeAttribute('aria-live');
498
+ } else {
499
+ this.element.setAttribute('aria-live', String(value));
500
+ }
501
+ return this;
502
+ }
503
+
504
+ setAriaPressed(value: 'false' | 'true' | 'mixed' | 'undefined' | boolean | null | undefined): this {
505
+ if (value === null || value === undefined) {
506
+ this.element.removeAttribute('aria-pressed');
507
+ } else {
508
+ this.element.setAttribute('aria-pressed', String(value));
509
+ }
510
+ return this;
511
+ }
512
+
513
+ setAriaRelevant(value: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined): this {
514
+ if (value === null || value === undefined) {
515
+ this.element.removeAttribute('aria-relevant');
516
+ } else {
517
+ this.element.setAttribute('aria-relevant', String(value));
518
+ }
519
+ return this;
520
+ }
521
+
522
+ setAriaRoledescription(value: string | null | undefined): this {
523
+ if (value === null || value === undefined) {
524
+ this.element.removeAttribute('aria-roledescription');
525
+ } else {
526
+ this.element.setAttribute('aria-roledescription', String(value));
527
+ }
528
+ return this;
529
+ }
530
+
531
+ setAutocapitalize(value: 'none' | 'sentences' | 'words' | 'characters' | null | undefined): this {
532
+ if (value === null || value === undefined) {
533
+ this.element.removeAttribute('autocapitalize');
534
+ } else {
535
+ this.element.setAttribute('autocapitalize', String(value));
536
+ }
537
+ return this;
538
+ }
539
+
540
+ setAutocorrect(value: 'off' | 'on' | null | undefined): this {
541
+ if (value === null || value === undefined) {
542
+ this.element.removeAttribute('autocorrect');
543
+ } else {
544
+ this.element.setAttribute('autocorrect', String(value));
545
+ }
546
+ return this;
547
+ }
548
+
549
+ setAutofocus(value: boolean | null | undefined): this {
550
+ if (value === true) {
551
+ this.element.setAttribute('autofocus', '');
552
+ } else {
553
+ this.element.removeAttribute('autofocus');
554
+ }
555
+ return this;
556
+ }
557
+
558
+ setCommand(value: string | null | undefined): this {
559
+ if (value === null || value === undefined) {
560
+ this.element.removeAttribute('command');
561
+ } else {
562
+ this.element.setAttribute('command', String(value));
563
+ }
564
+ return this;
565
+ }
566
+
567
+ setCommandfor(value: string | null | undefined): this {
568
+ if (value === null || value === undefined) {
569
+ this.element.removeAttribute('commandfor');
570
+ } else {
571
+ this.element.setAttribute('commandfor', String(value));
572
+ }
573
+ return this;
574
+ }
575
+
576
+ setContenteditable(value: 'true' | 'false' | 'inherit' | boolean | null | undefined): this {
577
+ if (value === null || value === undefined) {
578
+ this.element.removeAttribute('contenteditable');
579
+ } else {
580
+ this.element.setAttribute('contenteditable', String(value));
581
+ }
582
+ return this;
583
+ }
584
+
585
+ setDir(value: 'ltr' | 'rtl' | 'auto' | null | undefined): this {
586
+ if (value === null || value === undefined) {
587
+ this.element.removeAttribute('dir');
588
+ } else {
589
+ this.element.setAttribute('dir', String(value));
590
+ }
591
+ return this;
592
+ }
593
+
594
+ setDisabled(value: boolean | null | undefined): this {
595
+ if (value === true) {
596
+ this.element.setAttribute('disabled', '');
597
+ } else {
598
+ this.element.removeAttribute('disabled');
599
+ }
600
+ return this;
601
+ }
602
+
603
+ setDraggable(value: boolean | null | undefined): this {
604
+ if (value === true) {
605
+ this.element.setAttribute('draggable', '');
606
+ } else {
607
+ this.element.removeAttribute('draggable');
608
+ }
609
+ return this;
610
+ }
611
+
612
+ setForm(value: string | null | undefined): this {
613
+ if (value === null || value === undefined) {
614
+ this.element.removeAttribute('form');
615
+ } else {
616
+ this.element.setAttribute('form', String(value));
617
+ }
618
+ return this;
619
+ }
620
+
621
+ setFormaction(value: string | null | undefined): this {
622
+ if (value === null || value === undefined) {
623
+ this.element.removeAttribute('formaction');
624
+ } else {
625
+ this.element.setAttribute('formaction', String(value));
626
+ }
627
+ return this;
628
+ }
629
+
630
+ setFormenctype(value: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain' | null | undefined): this {
631
+ if (value === null || value === undefined) {
632
+ this.element.removeAttribute('formenctype');
633
+ } else {
634
+ this.element.setAttribute('formenctype', String(value));
635
+ }
636
+ return this;
637
+ }
638
+
639
+ setFormmethod(value: 'get' | 'post' | 'dialog' | null | undefined): this {
640
+ if (value === null || value === undefined) {
641
+ this.element.removeAttribute('formmethod');
642
+ } else {
643
+ this.element.setAttribute('formmethod', String(value));
644
+ }
645
+ return this;
646
+ }
647
+
648
+ setFormnovalidate(value: boolean | null | undefined): this {
649
+ if (value === true) {
650
+ this.element.setAttribute('formnovalidate', '');
651
+ } else {
652
+ this.element.removeAttribute('formnovalidate');
653
+ }
654
+ return this;
655
+ }
656
+
657
+ setFormtarget(value: '_self' | '_blank' | '_parent' | '_top' | string | null | undefined): this {
658
+ if (value === null || value === undefined) {
659
+ this.element.removeAttribute('formtarget');
660
+ } else {
661
+ this.element.setAttribute('formtarget', String(value));
662
+ }
663
+ return this;
664
+ }
665
+
666
+ setHidden(value: boolean | null | undefined): this {
667
+ if (value === true) {
668
+ this.element.setAttribute('hidden', '');
669
+ } else {
670
+ this.element.removeAttribute('hidden');
671
+ }
672
+ return this;
673
+ }
674
+
675
+ setInputmode(value: 'none' | 'text' | 'decimal' | 'numeric' | 'email' | 'tel' | 'url' | 'search' | null | undefined): this {
676
+ if (value === null || value === undefined) {
677
+ this.element.removeAttribute('inputmode');
678
+ } else {
679
+ this.element.setAttribute('inputmode', String(value));
680
+ }
681
+ return this;
682
+ }
683
+
684
+ setLang(value: string | null | undefined): this {
685
+ if (value === null || value === undefined) {
686
+ this.element.removeAttribute('lang');
687
+ } else {
688
+ this.element.setAttribute('lang', String(value));
689
+ }
690
+ return this;
691
+ }
692
+
693
+ setName(value: string | null | undefined): this {
694
+ if (value === null || value === undefined) {
695
+ this.element.removeAttribute('name');
696
+ } else {
697
+ this.element.setAttribute('name', String(value));
698
+ }
699
+ return this;
700
+ }
701
+
702
+ setPopovertarget(value: string | null | undefined): this {
703
+ if (value === null || value === undefined) {
704
+ this.element.removeAttribute('popovertarget');
705
+ } else {
706
+ this.element.setAttribute('popovertarget', String(value));
707
+ }
708
+ return this;
709
+ }
710
+
711
+ setPopovertargetaction(value: 'show' | 'hide' | 'toggle' | null | undefined): this {
712
+ if (value === null || value === undefined) {
713
+ this.element.removeAttribute('popovertargetaction');
714
+ } else {
715
+ this.element.setAttribute('popovertargetaction', String(value));
716
+ }
717
+ return this;
718
+ }
719
+
720
+ 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 {
721
+ if (value === null || value === undefined) {
722
+ this.element.removeAttribute('role');
723
+ } else {
724
+ this.element.setAttribute('role', String(value));
725
+ }
726
+ return this;
727
+ }
728
+
729
+ setSlot(value: string | null | undefined): this {
730
+ if (value === null || value === undefined) {
731
+ this.element.removeAttribute('slot');
732
+ } else {
733
+ this.element.setAttribute('slot', String(value));
734
+ }
735
+ return this;
736
+ }
737
+
738
+ setSpellcheck(value: 'true' | 'false' | boolean | null | undefined): this {
739
+ if (value === null || value === undefined) {
740
+ this.element.removeAttribute('spellcheck');
741
+ } else {
742
+ this.element.setAttribute('spellcheck', String(value));
743
+ }
744
+ return this;
745
+ }
746
+
747
+ setStyle(value: string | null | undefined): this {
748
+ if (value === null || value === undefined) {
749
+ this.element.removeAttribute('style');
750
+ } else {
751
+ this.element.setAttribute('style', String(value));
752
+ }
753
+ return this;
754
+ }
755
+
756
+ setTabindex(value: number | null | undefined): this {
757
+ if (value === null || value === undefined) {
758
+ this.element.removeAttribute('tabindex');
759
+ } else {
760
+ this.element.setAttribute('tabindex', String(value));
761
+ }
762
+ return this;
763
+ }
764
+
765
+ setTitle(value: string | null | undefined): this {
766
+ if (value === null || value === undefined) {
767
+ this.element.removeAttribute('title');
768
+ } else {
769
+ this.element.setAttribute('title', String(value));
770
+ }
771
+ return this;
772
+ }
773
+
774
+ setTranslate(value: 'yes' | 'no' | null | undefined): this {
775
+ if (value === null || value === undefined) {
776
+ this.element.removeAttribute('translate');
777
+ } else {
778
+ this.element.setAttribute('translate', String(value));
779
+ }
780
+ return this;
781
+ }
782
+
783
+ setType(value: 'submit' | 'reset' | 'button' | null | undefined): this {
784
+ if (value === null || value === undefined) {
785
+ this.element.removeAttribute('type');
786
+ } else {
787
+ this.element.setAttribute('type', String(value));
788
+ }
789
+ return this;
790
+ }
791
+
792
+ setValue(value: string | null | undefined): this {
793
+ if (value === null || value === undefined) {
794
+ this.element.removeAttribute('value');
795
+ } else {
796
+ this.element.setAttribute('value', String(value));
797
+ }
798
+ return this;
799
+ }
800
+
801
+ setChildren(children: string | HTMLElement | (string | HTMLElement)[]): this {
802
+ // Clear existing children
803
+ while (this.element.firstChild) {
804
+ this.element.removeChild(this.element.firstChild);
805
+ }
806
+
807
+ if (typeof children === 'string') {
808
+ this.element.textContent = children;
809
+ } else if (Array.isArray(children)) {
810
+ children.forEach(child => {
811
+ if (typeof child === 'string') {
812
+ this.element.appendChild(document.createTextNode(child));
813
+ } else {
814
+ this.element.appendChild(child);
815
+ }
816
+ });
817
+ } else {
818
+ this.element.appendChild(children);
819
+ }
820
+ return this;
821
+ }
822
+
823
+ getElement(): HTMLElement {
824
+ return this.element;
825
+ }
826
+ }