@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,458 @@
1
+ /**
2
+ * THIS FILE IS AUTOGENERATED. DO NOT EDIT IT.
3
+ *
4
+ * @generated December 28, 2025 12:26:31
5
+ * @component Body
6
+ * @description
7
+ */
8
+
9
+ export interface BodyProps {
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
+ * Represents the text direction of the element
20
+ */
21
+ dir?: 'ltr' | 'rtl' | 'auto' | null | undefined;
22
+ /**
23
+ * Indicates whether the element is draggable
24
+ */
25
+ draggable?: boolean | null | undefined;
26
+ /**
27
+ * Indicates whether the element is hidden
28
+ */
29
+ hidden?: boolean | null | undefined;
30
+ /**
31
+ * Specifies the primary language for the element's content
32
+ */
33
+ lang?: string | null | undefined;
34
+ /**
35
+ * Fires after the associated document has started printing or the print preview has been closed.
36
+ */
37
+ onafterprint?: string | null | undefined;
38
+ /**
39
+ * Fires before the associated document is printed or previewed for printing.
40
+ */
41
+ onbeforeprint?: string | null | undefined;
42
+ /**
43
+ * Fires before the user navigates away from the page.
44
+ */
45
+ onbeforeunload?: string | null | undefined;
46
+ /**
47
+ * Fires when the fragment identifier part of the URL changes.
48
+ */
49
+ onhashchange?: string | null | undefined;
50
+ /**
51
+ * Fires when the user changes the preferred language of the user interface.
52
+ */
53
+ onlanguagechange?: string | null | undefined;
54
+ /**
55
+ * Fires when a message is received from a different browsing context (e.g., an iframe).
56
+ */
57
+ onmessage?: string | null | undefined;
58
+ /**
59
+ * Fires when an error occurs while receiving a message from a different browsing context.
60
+ */
61
+ onmessageerror?: string | null | undefined;
62
+ /**
63
+ * Fires when the browser goes offline.
64
+ */
65
+ onoffline?: string | null | undefined;
66
+ /**
67
+ * Fires when the browser goes online.
68
+ */
69
+ ononline?: string | null | undefined;
70
+ /**
71
+ * Fires when the user navigates away from a page.
72
+ */
73
+ onpagehide?: string | null | undefined;
74
+ /**
75
+ * Fires when the user navigates to a page.
76
+ */
77
+ onpageshow?: string | null | undefined;
78
+ /**
79
+ * Fires when the user navigates through the history by clicking the browser's Back or Forward buttons.
80
+ */
81
+ onpopstate?: string | null | undefined;
82
+ /**
83
+ * Fires when a Promise is rejected and the rejection is handled by a Promise handler (e.g., catch).
84
+ */
85
+ onrejectionhandled?: string | null | undefined;
86
+ /**
87
+ * Fires when a storage area (e.g., localStorage or sessionStorage) changes.
88
+ */
89
+ onstorage?: string | null | undefined;
90
+ /**
91
+ * Fires when a Promise is rejected but there is no rejection handler (e.g., catch).
92
+ */
93
+ onunhandledrejection?: string | null | undefined;
94
+ /**
95
+ * Fires when the user is navigating away from the page (similar to onbeforeunload).
96
+ */
97
+ onunload?: string | null | undefined;
98
+ /**
99
+ * Represents the CSS inline style of the element
100
+ */
101
+ style?: string | null | undefined;
102
+ /**
103
+ * Represents a tab order of the element
104
+ */
105
+ tabindex?: number | null | undefined;
106
+ /**
107
+ * Represents a title or tooltip for the element
108
+ */
109
+ title?: string | null | undefined;
110
+ /**
111
+ * used to tell user agents whether the content should be translated.
112
+ */
113
+ translate?: 'yes' | 'no' | null | undefined;
114
+ }
115
+
116
+ /**
117
+ * Body -
118
+ */
119
+ export class Body {
120
+ private element: HTMLElement;
121
+
122
+ constructor(props: BodyProps = {}) {
123
+ this.element = document.createElement('body');
124
+ this.applyProps(props);
125
+ }
126
+
127
+ private applyProps(props: BodyProps): void {
128
+ if (props.children !== undefined) {
129
+ this.setChildren(props.children);
130
+ }
131
+ if (props.accesskey !== undefined) {
132
+ this.element.setAttribute('accesskey', String(props.accesskey));
133
+ }
134
+ if (props.dir !== undefined) {
135
+ this.setDir(props.dir);
136
+ }
137
+ if (props.draggable !== undefined) {
138
+ this.element.setAttribute('draggable', String(props.draggable));
139
+ }
140
+ if (props.hidden !== undefined) {
141
+ this.element.setAttribute('hidden', String(props.hidden));
142
+ }
143
+ if (props.lang !== undefined) {
144
+ this.element.setAttribute('lang', String(props.lang));
145
+ }
146
+ if (props.onafterprint !== undefined) {
147
+ this.element.setAttribute('onafterprint', String(props.onafterprint));
148
+ }
149
+ if (props.onbeforeprint !== undefined) {
150
+ this.element.setAttribute('onbeforeprint', String(props.onbeforeprint));
151
+ }
152
+ if (props.onbeforeunload !== undefined) {
153
+ this.element.setAttribute('onbeforeunload', String(props.onbeforeunload));
154
+ }
155
+ if (props.onhashchange !== undefined) {
156
+ this.element.setAttribute('onhashchange', String(props.onhashchange));
157
+ }
158
+ if (props.onlanguagechange !== undefined) {
159
+ this.element.setAttribute('onlanguagechange', String(props.onlanguagechange));
160
+ }
161
+ if (props.onmessage !== undefined) {
162
+ this.element.setAttribute('onmessage', String(props.onmessage));
163
+ }
164
+ if (props.onmessageerror !== undefined) {
165
+ this.element.setAttribute('onmessageerror', String(props.onmessageerror));
166
+ }
167
+ if (props.onoffline !== undefined) {
168
+ this.element.setAttribute('onoffline', String(props.onoffline));
169
+ }
170
+ if (props.ononline !== undefined) {
171
+ this.element.setAttribute('ononline', String(props.ononline));
172
+ }
173
+ if (props.onpagehide !== undefined) {
174
+ this.element.setAttribute('onpagehide', String(props.onpagehide));
175
+ }
176
+ if (props.onpageshow !== undefined) {
177
+ this.element.setAttribute('onpageshow', String(props.onpageshow));
178
+ }
179
+ if (props.onpopstate !== undefined) {
180
+ this.element.setAttribute('onpopstate', String(props.onpopstate));
181
+ }
182
+ if (props.onrejectionhandled !== undefined) {
183
+ this.element.setAttribute('onrejectionhandled', String(props.onrejectionhandled));
184
+ }
185
+ if (props.onstorage !== undefined) {
186
+ this.element.setAttribute('onstorage', String(props.onstorage));
187
+ }
188
+ if (props.onunhandledrejection !== undefined) {
189
+ this.element.setAttribute('onunhandledrejection', String(props.onunhandledrejection));
190
+ }
191
+ if (props.onunload !== undefined) {
192
+ this.element.setAttribute('onunload', String(props.onunload));
193
+ }
194
+ if (props.style !== undefined) {
195
+ this.element.setAttribute('style', String(props.style));
196
+ }
197
+ if (props.tabindex !== undefined) {
198
+ this.element.setAttribute('tabindex', String(props.tabindex));
199
+ }
200
+ if (props.title !== undefined) {
201
+ this.element.setAttribute('title', String(props.title));
202
+ }
203
+ if (props.translate !== undefined) {
204
+ this.setTranslate(props.translate);
205
+ }
206
+ }
207
+
208
+ setAccesskey(value: string | null | undefined): this {
209
+ if (value === null || value === undefined) {
210
+ this.element.removeAttribute('accesskey');
211
+ } else {
212
+ this.element.setAttribute('accesskey', String(value));
213
+ }
214
+ return this;
215
+ }
216
+
217
+ setDir(value: 'ltr' | 'rtl' | 'auto' | null | undefined): this {
218
+ if (value === null || value === undefined) {
219
+ this.element.removeAttribute('dir');
220
+ } else {
221
+ this.element.setAttribute('dir', String(value));
222
+ }
223
+ return this;
224
+ }
225
+
226
+ setDraggable(value: boolean | null | undefined): this {
227
+ if (value === true) {
228
+ this.element.setAttribute('draggable', '');
229
+ } else {
230
+ this.element.removeAttribute('draggable');
231
+ }
232
+ return this;
233
+ }
234
+
235
+ setHidden(value: boolean | null | undefined): this {
236
+ if (value === true) {
237
+ this.element.setAttribute('hidden', '');
238
+ } else {
239
+ this.element.removeAttribute('hidden');
240
+ }
241
+ return this;
242
+ }
243
+
244
+ setLang(value: string | null | undefined): this {
245
+ if (value === null || value === undefined) {
246
+ this.element.removeAttribute('lang');
247
+ } else {
248
+ this.element.setAttribute('lang', String(value));
249
+ }
250
+ return this;
251
+ }
252
+
253
+ setOnafterprint(value: string | null | undefined): this {
254
+ if (value === null || value === undefined) {
255
+ this.element.removeAttribute('onafterprint');
256
+ } else {
257
+ this.element.setAttribute('onafterprint', String(value));
258
+ }
259
+ return this;
260
+ }
261
+
262
+ setOnbeforeprint(value: string | null | undefined): this {
263
+ if (value === null || value === undefined) {
264
+ this.element.removeAttribute('onbeforeprint');
265
+ } else {
266
+ this.element.setAttribute('onbeforeprint', String(value));
267
+ }
268
+ return this;
269
+ }
270
+
271
+ setOnbeforeunload(value: string | null | undefined): this {
272
+ if (value === null || value === undefined) {
273
+ this.element.removeAttribute('onbeforeunload');
274
+ } else {
275
+ this.element.setAttribute('onbeforeunload', String(value));
276
+ }
277
+ return this;
278
+ }
279
+
280
+ setOnhashchange(value: string | null | undefined): this {
281
+ if (value === null || value === undefined) {
282
+ this.element.removeAttribute('onhashchange');
283
+ } else {
284
+ this.element.setAttribute('onhashchange', String(value));
285
+ }
286
+ return this;
287
+ }
288
+
289
+ setOnlanguagechange(value: string | null | undefined): this {
290
+ if (value === null || value === undefined) {
291
+ this.element.removeAttribute('onlanguagechange');
292
+ } else {
293
+ this.element.setAttribute('onlanguagechange', String(value));
294
+ }
295
+ return this;
296
+ }
297
+
298
+ setOnmessage(value: string | null | undefined): this {
299
+ if (value === null || value === undefined) {
300
+ this.element.removeAttribute('onmessage');
301
+ } else {
302
+ this.element.setAttribute('onmessage', String(value));
303
+ }
304
+ return this;
305
+ }
306
+
307
+ setOnmessageerror(value: string | null | undefined): this {
308
+ if (value === null || value === undefined) {
309
+ this.element.removeAttribute('onmessageerror');
310
+ } else {
311
+ this.element.setAttribute('onmessageerror', String(value));
312
+ }
313
+ return this;
314
+ }
315
+
316
+ setOnoffline(value: string | null | undefined): this {
317
+ if (value === null || value === undefined) {
318
+ this.element.removeAttribute('onoffline');
319
+ } else {
320
+ this.element.setAttribute('onoffline', String(value));
321
+ }
322
+ return this;
323
+ }
324
+
325
+ setOnonline(value: string | null | undefined): this {
326
+ if (value === null || value === undefined) {
327
+ this.element.removeAttribute('ononline');
328
+ } else {
329
+ this.element.setAttribute('ononline', String(value));
330
+ }
331
+ return this;
332
+ }
333
+
334
+ setOnpagehide(value: string | null | undefined): this {
335
+ if (value === null || value === undefined) {
336
+ this.element.removeAttribute('onpagehide');
337
+ } else {
338
+ this.element.setAttribute('onpagehide', String(value));
339
+ }
340
+ return this;
341
+ }
342
+
343
+ setOnpageshow(value: string | null | undefined): this {
344
+ if (value === null || value === undefined) {
345
+ this.element.removeAttribute('onpageshow');
346
+ } else {
347
+ this.element.setAttribute('onpageshow', String(value));
348
+ }
349
+ return this;
350
+ }
351
+
352
+ setOnpopstate(value: string | null | undefined): this {
353
+ if (value === null || value === undefined) {
354
+ this.element.removeAttribute('onpopstate');
355
+ } else {
356
+ this.element.setAttribute('onpopstate', String(value));
357
+ }
358
+ return this;
359
+ }
360
+
361
+ setOnrejectionhandled(value: string | null | undefined): this {
362
+ if (value === null || value === undefined) {
363
+ this.element.removeAttribute('onrejectionhandled');
364
+ } else {
365
+ this.element.setAttribute('onrejectionhandled', String(value));
366
+ }
367
+ return this;
368
+ }
369
+
370
+ setOnstorage(value: string | null | undefined): this {
371
+ if (value === null || value === undefined) {
372
+ this.element.removeAttribute('onstorage');
373
+ } else {
374
+ this.element.setAttribute('onstorage', String(value));
375
+ }
376
+ return this;
377
+ }
378
+
379
+ setOnunhandledrejection(value: string | null | undefined): this {
380
+ if (value === null || value === undefined) {
381
+ this.element.removeAttribute('onunhandledrejection');
382
+ } else {
383
+ this.element.setAttribute('onunhandledrejection', String(value));
384
+ }
385
+ return this;
386
+ }
387
+
388
+ setOnunload(value: string | null | undefined): this {
389
+ if (value === null || value === undefined) {
390
+ this.element.removeAttribute('onunload');
391
+ } else {
392
+ this.element.setAttribute('onunload', String(value));
393
+ }
394
+ return this;
395
+ }
396
+
397
+ setStyle(value: string | null | undefined): this {
398
+ if (value === null || value === undefined) {
399
+ this.element.removeAttribute('style');
400
+ } else {
401
+ this.element.setAttribute('style', String(value));
402
+ }
403
+ return this;
404
+ }
405
+
406
+ setTabindex(value: number | null | undefined): this {
407
+ if (value === null || value === undefined) {
408
+ this.element.removeAttribute('tabindex');
409
+ } else {
410
+ this.element.setAttribute('tabindex', String(value));
411
+ }
412
+ return this;
413
+ }
414
+
415
+ setTitle(value: string | null | undefined): this {
416
+ if (value === null || value === undefined) {
417
+ this.element.removeAttribute('title');
418
+ } else {
419
+ this.element.setAttribute('title', String(value));
420
+ }
421
+ return this;
422
+ }
423
+
424
+ setTranslate(value: 'yes' | 'no' | null | undefined): this {
425
+ if (value === null || value === undefined) {
426
+ this.element.removeAttribute('translate');
427
+ } else {
428
+ this.element.setAttribute('translate', String(value));
429
+ }
430
+ return this;
431
+ }
432
+
433
+ setChildren(children: string | HTMLElement | (string | HTMLElement)[]): this {
434
+ // Clear existing children
435
+ while (this.element.firstChild) {
436
+ this.element.removeChild(this.element.firstChild);
437
+ }
438
+
439
+ if (typeof children === 'string') {
440
+ this.element.textContent = children;
441
+ } else if (Array.isArray(children)) {
442
+ children.forEach(child => {
443
+ if (typeof child === 'string') {
444
+ this.element.appendChild(document.createTextNode(child));
445
+ } else {
446
+ this.element.appendChild(child);
447
+ }
448
+ });
449
+ } else {
450
+ this.element.appendChild(children);
451
+ }
452
+ return this;
453
+ }
454
+
455
+ getElement(): HTMLElement {
456
+ return this.element;
457
+ }
458
+ }