@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,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOGENERATED. DO NOT EDIT IT.
|
|
3
|
+
*
|
|
4
|
+
* @generated December 28, 2025 12:26:31
|
|
5
|
+
* @component Header
|
|
6
|
+
* @description
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface HeaderProps {
|
|
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
|
+
* Defines a string value that labels the current element for assistive technologies.
|
|
20
|
+
*/
|
|
21
|
+
'aria-label'?: string | null | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Represents the autocapitalize behavior of the element
|
|
24
|
+
*/
|
|
25
|
+
autocapitalize?: 'none' | 'sentences' | 'words' | 'characters' | null | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Indicates whether the element is hidden
|
|
28
|
+
*/
|
|
29
|
+
autofocus?: boolean | null | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Indicates whether the element can be edited in place
|
|
32
|
+
*/
|
|
33
|
+
contenteditable?: 'true' | 'false' | 'inherit' | boolean | null | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Represents the text direction of the element
|
|
36
|
+
*/
|
|
37
|
+
dir?: 'ltr' | 'rtl' | 'auto' | null | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Indicates whether the element is draggable
|
|
40
|
+
*/
|
|
41
|
+
draggable?: boolean | null | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Indicates whether the element is hidden
|
|
44
|
+
*/
|
|
45
|
+
hidden?: boolean | null | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* 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
|
|
48
|
+
*/
|
|
49
|
+
inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'email' | 'tel' | 'url' | 'search' | null | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Specifies the primary language for the element's content
|
|
52
|
+
*/
|
|
53
|
+
lang?: string | null | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Represents the spellchecking behavior of the element
|
|
56
|
+
*/
|
|
57
|
+
spellcheck?: 'true' | 'false' | boolean | null | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Represents the CSS inline style of the element
|
|
60
|
+
*/
|
|
61
|
+
style?: string | null | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Represents a tab order of the element
|
|
64
|
+
*/
|
|
65
|
+
tabindex?: number | null | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Represents a title or tooltip for the element
|
|
68
|
+
*/
|
|
69
|
+
title?: string | null | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* used to tell user agents whether the content should be translated.
|
|
72
|
+
*/
|
|
73
|
+
translate?: 'yes' | 'no' | null | undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Header -
|
|
78
|
+
*/
|
|
79
|
+
export class Header {
|
|
80
|
+
private element: HTMLElement;
|
|
81
|
+
|
|
82
|
+
constructor(props: HeaderProps = {}) {
|
|
83
|
+
this.element = document.createElement('header');
|
|
84
|
+
this.applyProps(props);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private applyProps(props: HeaderProps): void {
|
|
88
|
+
if (props.children !== undefined) {
|
|
89
|
+
this.setChildren(props.children);
|
|
90
|
+
}
|
|
91
|
+
if (props.accesskey !== undefined) {
|
|
92
|
+
this.element.setAttribute('accesskey', String(props.accesskey));
|
|
93
|
+
}
|
|
94
|
+
if (props['aria-label'] !== undefined) {
|
|
95
|
+
this.element.setAttribute('aria-label', String(props['aria-label']));
|
|
96
|
+
}
|
|
97
|
+
if (props.autocapitalize !== undefined) {
|
|
98
|
+
this.setAutocapitalize(props.autocapitalize);
|
|
99
|
+
}
|
|
100
|
+
if (props.autofocus !== undefined) {
|
|
101
|
+
this.element.setAttribute('autofocus', String(props.autofocus));
|
|
102
|
+
}
|
|
103
|
+
if (props.contenteditable !== undefined) {
|
|
104
|
+
this.setContenteditable(props.contenteditable);
|
|
105
|
+
}
|
|
106
|
+
if (props.dir !== undefined) {
|
|
107
|
+
this.setDir(props.dir);
|
|
108
|
+
}
|
|
109
|
+
if (props.draggable !== undefined) {
|
|
110
|
+
this.element.setAttribute('draggable', String(props.draggable));
|
|
111
|
+
}
|
|
112
|
+
if (props.hidden !== undefined) {
|
|
113
|
+
this.element.setAttribute('hidden', String(props.hidden));
|
|
114
|
+
}
|
|
115
|
+
if (props.inputmode !== undefined) {
|
|
116
|
+
this.setInputmode(props.inputmode);
|
|
117
|
+
}
|
|
118
|
+
if (props.lang !== undefined) {
|
|
119
|
+
this.element.setAttribute('lang', String(props.lang));
|
|
120
|
+
}
|
|
121
|
+
if (props.spellcheck !== undefined) {
|
|
122
|
+
this.setSpellcheck(props.spellcheck);
|
|
123
|
+
}
|
|
124
|
+
if (props.style !== undefined) {
|
|
125
|
+
this.element.setAttribute('style', String(props.style));
|
|
126
|
+
}
|
|
127
|
+
if (props.tabindex !== undefined) {
|
|
128
|
+
this.element.setAttribute('tabindex', String(props.tabindex));
|
|
129
|
+
}
|
|
130
|
+
if (props.title !== undefined) {
|
|
131
|
+
this.element.setAttribute('title', String(props.title));
|
|
132
|
+
}
|
|
133
|
+
if (props.translate !== undefined) {
|
|
134
|
+
this.setTranslate(props.translate);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
setAccesskey(value: string | null | undefined): this {
|
|
139
|
+
if (value === null || value === undefined) {
|
|
140
|
+
this.element.removeAttribute('accesskey');
|
|
141
|
+
} else {
|
|
142
|
+
this.element.setAttribute('accesskey', String(value));
|
|
143
|
+
}
|
|
144
|
+
return this;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
setAriaLabel(value: string | null | undefined): this {
|
|
148
|
+
if (value === null || value === undefined) {
|
|
149
|
+
this.element.removeAttribute('aria-label');
|
|
150
|
+
} else {
|
|
151
|
+
this.element.setAttribute('aria-label', String(value));
|
|
152
|
+
}
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
setAutocapitalize(value: 'none' | 'sentences' | 'words' | 'characters' | null | undefined): this {
|
|
157
|
+
if (value === null || value === undefined) {
|
|
158
|
+
this.element.removeAttribute('autocapitalize');
|
|
159
|
+
} else {
|
|
160
|
+
this.element.setAttribute('autocapitalize', String(value));
|
|
161
|
+
}
|
|
162
|
+
return this;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
setAutofocus(value: boolean | null | undefined): this {
|
|
166
|
+
if (value === true) {
|
|
167
|
+
this.element.setAttribute('autofocus', '');
|
|
168
|
+
} else {
|
|
169
|
+
this.element.removeAttribute('autofocus');
|
|
170
|
+
}
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
setContenteditable(value: 'true' | 'false' | 'inherit' | boolean | null | undefined): this {
|
|
175
|
+
if (value === null || value === undefined) {
|
|
176
|
+
this.element.removeAttribute('contenteditable');
|
|
177
|
+
} else {
|
|
178
|
+
this.element.setAttribute('contenteditable', String(value));
|
|
179
|
+
}
|
|
180
|
+
return this;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
setDir(value: 'ltr' | 'rtl' | 'auto' | null | undefined): this {
|
|
184
|
+
if (value === null || value === undefined) {
|
|
185
|
+
this.element.removeAttribute('dir');
|
|
186
|
+
} else {
|
|
187
|
+
this.element.setAttribute('dir', String(value));
|
|
188
|
+
}
|
|
189
|
+
return this;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
setDraggable(value: boolean | null | undefined): this {
|
|
193
|
+
if (value === true) {
|
|
194
|
+
this.element.setAttribute('draggable', '');
|
|
195
|
+
} else {
|
|
196
|
+
this.element.removeAttribute('draggable');
|
|
197
|
+
}
|
|
198
|
+
return this;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
setHidden(value: boolean | null | undefined): this {
|
|
202
|
+
if (value === true) {
|
|
203
|
+
this.element.setAttribute('hidden', '');
|
|
204
|
+
} else {
|
|
205
|
+
this.element.removeAttribute('hidden');
|
|
206
|
+
}
|
|
207
|
+
return this;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
setInputmode(value: 'none' | 'text' | 'decimal' | 'numeric' | 'email' | 'tel' | 'url' | 'search' | null | undefined): this {
|
|
211
|
+
if (value === null || value === undefined) {
|
|
212
|
+
this.element.removeAttribute('inputmode');
|
|
213
|
+
} else {
|
|
214
|
+
this.element.setAttribute('inputmode', String(value));
|
|
215
|
+
}
|
|
216
|
+
return this;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
setLang(value: string | null | undefined): this {
|
|
220
|
+
if (value === null || value === undefined) {
|
|
221
|
+
this.element.removeAttribute('lang');
|
|
222
|
+
} else {
|
|
223
|
+
this.element.setAttribute('lang', String(value));
|
|
224
|
+
}
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
setSpellcheck(value: 'true' | 'false' | boolean | null | undefined): this {
|
|
229
|
+
if (value === null || value === undefined) {
|
|
230
|
+
this.element.removeAttribute('spellcheck');
|
|
231
|
+
} else {
|
|
232
|
+
this.element.setAttribute('spellcheck', String(value));
|
|
233
|
+
}
|
|
234
|
+
return this;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
setStyle(value: string | null | undefined): this {
|
|
238
|
+
if (value === null || value === undefined) {
|
|
239
|
+
this.element.removeAttribute('style');
|
|
240
|
+
} else {
|
|
241
|
+
this.element.setAttribute('style', String(value));
|
|
242
|
+
}
|
|
243
|
+
return this;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
setTabindex(value: number | null | undefined): this {
|
|
247
|
+
if (value === null || value === undefined) {
|
|
248
|
+
this.element.removeAttribute('tabindex');
|
|
249
|
+
} else {
|
|
250
|
+
this.element.setAttribute('tabindex', String(value));
|
|
251
|
+
}
|
|
252
|
+
return this;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
setTitle(value: string | null | undefined): this {
|
|
256
|
+
if (value === null || value === undefined) {
|
|
257
|
+
this.element.removeAttribute('title');
|
|
258
|
+
} else {
|
|
259
|
+
this.element.setAttribute('title', String(value));
|
|
260
|
+
}
|
|
261
|
+
return this;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
setTranslate(value: 'yes' | 'no' | null | undefined): this {
|
|
265
|
+
if (value === null || value === undefined) {
|
|
266
|
+
this.element.removeAttribute('translate');
|
|
267
|
+
} else {
|
|
268
|
+
this.element.setAttribute('translate', String(value));
|
|
269
|
+
}
|
|
270
|
+
return this;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
setChildren(children: string | HTMLElement | (string | HTMLElement)[]): this {
|
|
274
|
+
// Clear existing children
|
|
275
|
+
while (this.element.firstChild) {
|
|
276
|
+
this.element.removeChild(this.element.firstChild);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (typeof children === 'string') {
|
|
280
|
+
this.element.textContent = children;
|
|
281
|
+
} else if (Array.isArray(children)) {
|
|
282
|
+
children.forEach(child => {
|
|
283
|
+
if (typeof child === 'string') {
|
|
284
|
+
this.element.appendChild(document.createTextNode(child));
|
|
285
|
+
} else {
|
|
286
|
+
this.element.appendChild(child);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
} else {
|
|
290
|
+
this.element.appendChild(children);
|
|
291
|
+
}
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
getElement(): HTMLElement {
|
|
296
|
+
return this.element;
|
|
297
|
+
}
|
|
298
|
+
}
|