@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,445 @@
1
+ /**
2
+ * THIS FILE IS AUTOGENERATED. DO NOT EDIT IT.
3
+ *
4
+ * @generated December 28, 2025 12:26:31
5
+ * @component Img
6
+ * @description
7
+ */
8
+
9
+ export interface ImgProps {
10
+ /**
11
+ * Specifies alternative text to be displayed when the image cannot be rendered.
12
+ */
13
+ alt?: string | null | undefined;
14
+ /**
15
+ * Indicates whether assistive technologies should present the entire region as a whole when changes occur.
16
+ */
17
+ 'aria-atomic'?: 'false' | 'true' | boolean | null | undefined;
18
+ /**
19
+ * References an element that provides additional details about the current element.
20
+ */
21
+ 'aria-details'?: string | null | undefined;
22
+ /**
23
+ * 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
24
+ */
25
+ 'aria-hidden'?: 'false' | 'true' | boolean | null | undefined;
26
+ /**
27
+ * Defines keyboard shortcuts available for the element.
28
+ */
29
+ 'aria-keyshortcuts'?: string | null | undefined;
30
+ /**
31
+ * Defines a string value that labels the current element for assistive technologies.
32
+ */
33
+ 'aria-label'?: string | null | undefined;
34
+ /**
35
+ * Defines how updates to the element should be announced to screen readers.
36
+ */
37
+ 'aria-live'?: 'off' | 'polite' | 'assertive' | null | undefined;
38
+ /**
39
+ * Indicates what content changes should be announced in a live region.
40
+ */
41
+ 'aria-relevant'?: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined;
42
+ /**
43
+ * Provides a human-readable custom role description for assistive technologies.
44
+ */
45
+ 'aria-roledescription'?: string | null | undefined;
46
+ /**
47
+ *
48
+ */
49
+ crossorigin?: 'anonymous' | 'use-credentials' | null | undefined;
50
+ /**
51
+ * Specifies the decoding process applied to the image.
52
+ */
53
+ decoding?: 'async' | 'auto' | 'sync' | null | undefined;
54
+ /**
55
+ * Represents the text direction of the element
56
+ */
57
+ dir?: 'ltr' | 'rtl' | 'auto' | null | undefined;
58
+ /**
59
+ * Indicates whether the element is draggable
60
+ */
61
+ draggable?: boolean | null | undefined;
62
+ /**
63
+ * Specifies the height of the element. The meaning may vary depending on the element type. Accepts integers, pixels (px), and percentages (%).
64
+ */
65
+ height?: string | null | undefined;
66
+ /**
67
+ * Indicates whether the element is hidden
68
+ */
69
+ hidden?: boolean | null | undefined;
70
+ /**
71
+ * Specifies that an area should be part of an image map.
72
+ */
73
+ ismap?: boolean | null | undefined;
74
+ /**
75
+ * Specifies the primary language for the element's content
76
+ */
77
+ lang?: string | null | undefined;
78
+ /**
79
+ * Specifies the referrer policy for fetches initiated by the element.
80
+ */
81
+ 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;
82
+ /**
83
+ * Specifies the sizes of the images or icons for different display/window sizes.
84
+ */
85
+ sizes?: string | null | undefined;
86
+ /**
87
+ * Specifies the URL of the external resource to be embedded or referenced.
88
+ */
89
+ src?: string | null | undefined;
90
+ /**
91
+ * Specifies a set of image candidate URLs and descriptors for responsive images.
92
+ */
93
+ srcset?: string | null | undefined;
94
+ /**
95
+ * Represents the CSS inline style of the element
96
+ */
97
+ style?: string | null | undefined;
98
+ /**
99
+ * Represents a tab order of the element
100
+ */
101
+ tabindex?: number | null | undefined;
102
+ /**
103
+ * Represents a title or tooltip for the element
104
+ */
105
+ title?: string | null | undefined;
106
+ /**
107
+ * Specifies a client-side image map to be used with the element.
108
+ */
109
+ usemap?: string | null | undefined;
110
+ /**
111
+ * Specifies the width of the element. The meaning may vary depending on the element type. Accepts integers, pixels (px), and percentages (%).
112
+ */
113
+ width?: string | null | undefined;
114
+ }
115
+
116
+ /**
117
+ * Img -
118
+ */
119
+ export class Img {
120
+ private element: HTMLElement;
121
+
122
+ constructor(props: ImgProps = {}) {
123
+ this.element = document.createElement('img');
124
+ this.applyProps(props);
125
+ }
126
+
127
+ private applyProps(props: ImgProps): void {
128
+ if (props.alt !== undefined) {
129
+ this.element.setAttribute('alt', String(props.alt));
130
+ }
131
+ if (props['aria-atomic'] !== undefined) {
132
+ this.setAriaAtomic(props['aria-atomic']);
133
+ }
134
+ if (props['aria-details'] !== undefined) {
135
+ this.element.setAttribute('aria-details', String(props['aria-details']));
136
+ }
137
+ if (props['aria-hidden'] !== undefined) {
138
+ this.setAriaHidden(props['aria-hidden']);
139
+ }
140
+ if (props['aria-keyshortcuts'] !== undefined) {
141
+ this.element.setAttribute('aria-keyshortcuts', String(props['aria-keyshortcuts']));
142
+ }
143
+ if (props['aria-label'] !== undefined) {
144
+ this.element.setAttribute('aria-label', String(props['aria-label']));
145
+ }
146
+ if (props['aria-live'] !== undefined) {
147
+ this.setAriaLive(props['aria-live']);
148
+ }
149
+ if (props['aria-relevant'] !== undefined) {
150
+ this.setAriaRelevant(props['aria-relevant']);
151
+ }
152
+ if (props['aria-roledescription'] !== undefined) {
153
+ this.element.setAttribute('aria-roledescription', String(props['aria-roledescription']));
154
+ }
155
+ if (props.crossorigin !== undefined) {
156
+ this.setCrossorigin(props.crossorigin);
157
+ }
158
+ if (props.decoding !== undefined) {
159
+ this.setDecoding(props.decoding);
160
+ }
161
+ if (props.dir !== undefined) {
162
+ this.setDir(props.dir);
163
+ }
164
+ if (props.draggable !== undefined) {
165
+ this.element.setAttribute('draggable', String(props.draggable));
166
+ }
167
+ if (props.height !== undefined) {
168
+ this.element.setAttribute('height', String(props.height));
169
+ }
170
+ if (props.hidden !== undefined) {
171
+ this.element.setAttribute('hidden', String(props.hidden));
172
+ }
173
+ if (props.ismap !== undefined) {
174
+ this.element.setAttribute('ismap', String(props.ismap));
175
+ }
176
+ if (props.lang !== undefined) {
177
+ this.element.setAttribute('lang', String(props.lang));
178
+ }
179
+ if (props.referrerpolicy !== undefined) {
180
+ this.setReferrerpolicy(props.referrerpolicy);
181
+ }
182
+ if (props.sizes !== undefined) {
183
+ this.element.setAttribute('sizes', String(props.sizes));
184
+ }
185
+ if (props.src !== undefined) {
186
+ this.element.setAttribute('src', String(props.src));
187
+ }
188
+ if (props.srcset !== undefined) {
189
+ this.element.setAttribute('srcset', String(props.srcset));
190
+ }
191
+ if (props.style !== undefined) {
192
+ this.element.setAttribute('style', String(props.style));
193
+ }
194
+ if (props.tabindex !== undefined) {
195
+ this.element.setAttribute('tabindex', String(props.tabindex));
196
+ }
197
+ if (props.title !== undefined) {
198
+ this.element.setAttribute('title', String(props.title));
199
+ }
200
+ if (props.usemap !== undefined) {
201
+ this.element.setAttribute('usemap', String(props.usemap));
202
+ }
203
+ if (props.width !== undefined) {
204
+ this.element.setAttribute('width', String(props.width));
205
+ }
206
+ }
207
+
208
+ setAlt(value: string | null | undefined): this {
209
+ if (value === null || value === undefined) {
210
+ this.element.removeAttribute('alt');
211
+ } else {
212
+ this.element.setAttribute('alt', String(value));
213
+ }
214
+ return this;
215
+ }
216
+
217
+ setAriaAtomic(value: 'false' | 'true' | boolean | null | undefined): this {
218
+ if (value === null || value === undefined) {
219
+ this.element.removeAttribute('aria-atomic');
220
+ } else {
221
+ this.element.setAttribute('aria-atomic', String(value));
222
+ }
223
+ return this;
224
+ }
225
+
226
+ setAriaDetails(value: string | null | undefined): this {
227
+ if (value === null || value === undefined) {
228
+ this.element.removeAttribute('aria-details');
229
+ } else {
230
+ this.element.setAttribute('aria-details', String(value));
231
+ }
232
+ return this;
233
+ }
234
+
235
+ setAriaHidden(value: 'false' | 'true' | boolean | null | undefined): this {
236
+ if (value === null || value === undefined) {
237
+ this.element.removeAttribute('aria-hidden');
238
+ } else {
239
+ this.element.setAttribute('aria-hidden', String(value));
240
+ }
241
+ return this;
242
+ }
243
+
244
+ setAriaKeyshortcuts(value: string | null | undefined): this {
245
+ if (value === null || value === undefined) {
246
+ this.element.removeAttribute('aria-keyshortcuts');
247
+ } else {
248
+ this.element.setAttribute('aria-keyshortcuts', String(value));
249
+ }
250
+ return this;
251
+ }
252
+
253
+ setAriaLabel(value: string | null | undefined): this {
254
+ if (value === null || value === undefined) {
255
+ this.element.removeAttribute('aria-label');
256
+ } else {
257
+ this.element.setAttribute('aria-label', String(value));
258
+ }
259
+ return this;
260
+ }
261
+
262
+ setAriaLive(value: 'off' | 'polite' | 'assertive' | null | undefined): this {
263
+ if (value === null || value === undefined) {
264
+ this.element.removeAttribute('aria-live');
265
+ } else {
266
+ this.element.setAttribute('aria-live', String(value));
267
+ }
268
+ return this;
269
+ }
270
+
271
+ setAriaRelevant(value: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined): this {
272
+ if (value === null || value === undefined) {
273
+ this.element.removeAttribute('aria-relevant');
274
+ } else {
275
+ this.element.setAttribute('aria-relevant', String(value));
276
+ }
277
+ return this;
278
+ }
279
+
280
+ setAriaRoledescription(value: string | null | undefined): this {
281
+ if (value === null || value === undefined) {
282
+ this.element.removeAttribute('aria-roledescription');
283
+ } else {
284
+ this.element.setAttribute('aria-roledescription', String(value));
285
+ }
286
+ return this;
287
+ }
288
+
289
+ setCrossorigin(value: 'anonymous' | 'use-credentials' | null | undefined): this {
290
+ if (value === null || value === undefined) {
291
+ this.element.removeAttribute('crossorigin');
292
+ } else {
293
+ this.element.setAttribute('crossorigin', String(value));
294
+ }
295
+ return this;
296
+ }
297
+
298
+ setDecoding(value: 'async' | 'auto' | 'sync' | null | undefined): this {
299
+ if (value === null || value === undefined) {
300
+ this.element.removeAttribute('decoding');
301
+ } else {
302
+ this.element.setAttribute('decoding', String(value));
303
+ }
304
+ return this;
305
+ }
306
+
307
+ setDir(value: 'ltr' | 'rtl' | 'auto' | null | undefined): this {
308
+ if (value === null || value === undefined) {
309
+ this.element.removeAttribute('dir');
310
+ } else {
311
+ this.element.setAttribute('dir', String(value));
312
+ }
313
+ return this;
314
+ }
315
+
316
+ setDraggable(value: boolean | null | undefined): this {
317
+ if (value === true) {
318
+ this.element.setAttribute('draggable', '');
319
+ } else {
320
+ this.element.removeAttribute('draggable');
321
+ }
322
+ return this;
323
+ }
324
+
325
+ setHeight(value: string | null | undefined): this {
326
+ if (value === null || value === undefined) {
327
+ this.element.removeAttribute('height');
328
+ } else {
329
+ this.element.setAttribute('height', String(value));
330
+ }
331
+ return this;
332
+ }
333
+
334
+ setHidden(value: boolean | null | undefined): this {
335
+ if (value === true) {
336
+ this.element.setAttribute('hidden', '');
337
+ } else {
338
+ this.element.removeAttribute('hidden');
339
+ }
340
+ return this;
341
+ }
342
+
343
+ setIsmap(value: boolean | null | undefined): this {
344
+ if (value === true) {
345
+ this.element.setAttribute('ismap', '');
346
+ } else {
347
+ this.element.removeAttribute('ismap');
348
+ }
349
+ return this;
350
+ }
351
+
352
+ setLang(value: string | null | undefined): this {
353
+ if (value === null || value === undefined) {
354
+ this.element.removeAttribute('lang');
355
+ } else {
356
+ this.element.setAttribute('lang', String(value));
357
+ }
358
+ return this;
359
+ }
360
+
361
+ 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 {
362
+ if (value === null || value === undefined) {
363
+ this.element.removeAttribute('referrerpolicy');
364
+ } else {
365
+ this.element.setAttribute('referrerpolicy', String(value));
366
+ }
367
+ return this;
368
+ }
369
+
370
+ setSizes(value: string | null | undefined): this {
371
+ if (value === null || value === undefined) {
372
+ this.element.removeAttribute('sizes');
373
+ } else {
374
+ this.element.setAttribute('sizes', String(value));
375
+ }
376
+ return this;
377
+ }
378
+
379
+ setSrc(value: string | null | undefined): this {
380
+ if (value === null || value === undefined) {
381
+ this.element.removeAttribute('src');
382
+ } else {
383
+ this.element.setAttribute('src', String(value));
384
+ }
385
+ return this;
386
+ }
387
+
388
+ setSrcset(value: string | null | undefined): this {
389
+ if (value === null || value === undefined) {
390
+ this.element.removeAttribute('srcset');
391
+ } else {
392
+ this.element.setAttribute('srcset', 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
+ setUsemap(value: string | null | undefined): this {
425
+ if (value === null || value === undefined) {
426
+ this.element.removeAttribute('usemap');
427
+ } else {
428
+ this.element.setAttribute('usemap', String(value));
429
+ }
430
+ return this;
431
+ }
432
+
433
+ setWidth(value: string | null | undefined): this {
434
+ if (value === null || value === undefined) {
435
+ this.element.removeAttribute('width');
436
+ } else {
437
+ this.element.setAttribute('width', String(value));
438
+ }
439
+ return this;
440
+ }
441
+
442
+ getElement(): HTMLElement {
443
+ return this.element;
444
+ }
445
+ }