pulse-framework 0.1.62__py3-none-any.whl

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 (126) hide show
  1. pulse/__init__.py +1493 -0
  2. pulse/_examples.py +29 -0
  3. pulse/app.py +1086 -0
  4. pulse/channel.py +607 -0
  5. pulse/cli/__init__.py +0 -0
  6. pulse/cli/cmd.py +575 -0
  7. pulse/cli/dependencies.py +181 -0
  8. pulse/cli/folder_lock.py +134 -0
  9. pulse/cli/helpers.py +271 -0
  10. pulse/cli/logging.py +102 -0
  11. pulse/cli/models.py +35 -0
  12. pulse/cli/packages.py +262 -0
  13. pulse/cli/processes.py +292 -0
  14. pulse/cli/secrets.py +39 -0
  15. pulse/cli/uvicorn_log_config.py +87 -0
  16. pulse/code_analysis.py +38 -0
  17. pulse/codegen/__init__.py +0 -0
  18. pulse/codegen/codegen.py +359 -0
  19. pulse/codegen/templates/__init__.py +0 -0
  20. pulse/codegen/templates/layout.py +106 -0
  21. pulse/codegen/templates/route.py +345 -0
  22. pulse/codegen/templates/routes_ts.py +42 -0
  23. pulse/codegen/utils.py +20 -0
  24. pulse/component.py +237 -0
  25. pulse/components/__init__.py +0 -0
  26. pulse/components/for_.py +83 -0
  27. pulse/components/if_.py +86 -0
  28. pulse/components/react_router.py +94 -0
  29. pulse/context.py +108 -0
  30. pulse/cookies.py +322 -0
  31. pulse/decorators.py +344 -0
  32. pulse/dom/__init__.py +0 -0
  33. pulse/dom/elements.py +1024 -0
  34. pulse/dom/events.py +445 -0
  35. pulse/dom/props.py +1250 -0
  36. pulse/dom/svg.py +0 -0
  37. pulse/dom/tags.py +328 -0
  38. pulse/dom/tags.pyi +480 -0
  39. pulse/env.py +178 -0
  40. pulse/form.py +538 -0
  41. pulse/helpers.py +541 -0
  42. pulse/hooks/__init__.py +0 -0
  43. pulse/hooks/core.py +452 -0
  44. pulse/hooks/effects.py +88 -0
  45. pulse/hooks/init.py +668 -0
  46. pulse/hooks/runtime.py +464 -0
  47. pulse/hooks/setup.py +254 -0
  48. pulse/hooks/stable.py +138 -0
  49. pulse/hooks/state.py +192 -0
  50. pulse/js/__init__.py +125 -0
  51. pulse/js/__init__.pyi +115 -0
  52. pulse/js/_types.py +299 -0
  53. pulse/js/array.py +339 -0
  54. pulse/js/console.py +50 -0
  55. pulse/js/date.py +119 -0
  56. pulse/js/document.py +145 -0
  57. pulse/js/error.py +140 -0
  58. pulse/js/json.py +66 -0
  59. pulse/js/map.py +97 -0
  60. pulse/js/math.py +69 -0
  61. pulse/js/navigator.py +79 -0
  62. pulse/js/number.py +57 -0
  63. pulse/js/obj.py +81 -0
  64. pulse/js/object.py +172 -0
  65. pulse/js/promise.py +172 -0
  66. pulse/js/pulse.py +115 -0
  67. pulse/js/react.py +495 -0
  68. pulse/js/regexp.py +57 -0
  69. pulse/js/set.py +124 -0
  70. pulse/js/string.py +38 -0
  71. pulse/js/weakmap.py +53 -0
  72. pulse/js/weakset.py +48 -0
  73. pulse/js/window.py +205 -0
  74. pulse/messages.py +202 -0
  75. pulse/middleware.py +471 -0
  76. pulse/plugin.py +96 -0
  77. pulse/proxy.py +242 -0
  78. pulse/py.typed +0 -0
  79. pulse/queries/__init__.py +0 -0
  80. pulse/queries/client.py +609 -0
  81. pulse/queries/common.py +101 -0
  82. pulse/queries/effect.py +55 -0
  83. pulse/queries/infinite_query.py +1418 -0
  84. pulse/queries/mutation.py +295 -0
  85. pulse/queries/protocol.py +136 -0
  86. pulse/queries/query.py +1314 -0
  87. pulse/queries/store.py +120 -0
  88. pulse/react_component.py +88 -0
  89. pulse/reactive.py +1208 -0
  90. pulse/reactive_extensions.py +1172 -0
  91. pulse/render_session.py +768 -0
  92. pulse/renderer.py +584 -0
  93. pulse/request.py +205 -0
  94. pulse/routing.py +598 -0
  95. pulse/serializer.py +279 -0
  96. pulse/state.py +556 -0
  97. pulse/test_helpers.py +15 -0
  98. pulse/transpiler/__init__.py +111 -0
  99. pulse/transpiler/assets.py +81 -0
  100. pulse/transpiler/builtins.py +1029 -0
  101. pulse/transpiler/dynamic_import.py +130 -0
  102. pulse/transpiler/emit_context.py +49 -0
  103. pulse/transpiler/errors.py +96 -0
  104. pulse/transpiler/function.py +611 -0
  105. pulse/transpiler/id.py +18 -0
  106. pulse/transpiler/imports.py +341 -0
  107. pulse/transpiler/js_module.py +336 -0
  108. pulse/transpiler/modules/__init__.py +33 -0
  109. pulse/transpiler/modules/asyncio.py +57 -0
  110. pulse/transpiler/modules/json.py +24 -0
  111. pulse/transpiler/modules/math.py +265 -0
  112. pulse/transpiler/modules/pulse/__init__.py +5 -0
  113. pulse/transpiler/modules/pulse/tags.py +250 -0
  114. pulse/transpiler/modules/typing.py +63 -0
  115. pulse/transpiler/nodes.py +1987 -0
  116. pulse/transpiler/py_module.py +135 -0
  117. pulse/transpiler/transpiler.py +1100 -0
  118. pulse/transpiler/vdom.py +256 -0
  119. pulse/types/__init__.py +0 -0
  120. pulse/types/event_handler.py +50 -0
  121. pulse/user_session.py +386 -0
  122. pulse/version.py +69 -0
  123. pulse_framework-0.1.62.dist-info/METADATA +198 -0
  124. pulse_framework-0.1.62.dist-info/RECORD +126 -0
  125. pulse_framework-0.1.62.dist-info/WHEEL +4 -0
  126. pulse_framework-0.1.62.dist-info/entry_points.txt +3 -0
pulse/dom/elements.py ADDED
@@ -0,0 +1,1024 @@
1
+ # Adapted from MDN Web Docs and @types/react
2
+ # Note: Similar to events, we can only serialize data attributes, not methods or
3
+ # complex objects like NodeList.
4
+
5
+ from typing import Literal, TypeAlias, TypedDict
6
+
7
+
8
+ class Element(TypedDict):
9
+ # Basic properties
10
+ id: str
11
+ className: str
12
+ tagName: str
13
+ localName: str
14
+ clientHeight: float
15
+ clientLeft: float
16
+ clientTop: float
17
+ clientWidth: float
18
+ scrollHeight: float
19
+ scrollLeft: float
20
+ scrollTop: float
21
+ scrollWidth: float
22
+ slot: str
23
+
24
+
25
+ class HTMLOrSVGElement(TypedDict):
26
+ autofocus: bool
27
+ tabIndex: int
28
+ nonce: str | None
29
+ # Not including dataset as it's not useful
30
+
31
+
32
+ class HTMLElementBase(Element, HTMLOrSVGElement):
33
+ accessKey: str
34
+ accessKeyLabel: str | None
35
+ autocapitalize: str
36
+ dir: Literal["", "ltr", "rtl", "auto"]
37
+ draggable: bool
38
+ hidden: bool
39
+ inert: bool
40
+ lang: str
41
+ offsetHeight: float # Read-only layout properties
42
+ offsetLeft: float
43
+ # offset_parent: Element | None # could be complex to serialize
44
+ offsetTop: float
45
+ offsetWidth: float
46
+ popover: str | None
47
+ spellcheck: bool
48
+ title: str
49
+ translate: bool
50
+ writingSuggestions: str
51
+
52
+ # Added properties from ELementContentEditable definition
53
+ contentEditable: str
54
+ enterKeyHint: str
55
+ isContentEditable: bool
56
+ inputMode: str
57
+
58
+ # Not including inner_text and outer_text as those could be heavy
59
+
60
+
61
+ class GenericHTMLElement(HTMLElementBase): ...
62
+
63
+
64
+ class HTMLAnchorElement(HTMLElementBase):
65
+ """Properties specific to <a> elements."""
66
+
67
+ tagName: Literal["a"] # pyright: ignore[reportIncompatibleVariableOverride]
68
+
69
+ hash: str
70
+ host: str
71
+ hostname: str
72
+ href: str
73
+ origin: str
74
+ password: str
75
+ pathname: str
76
+ port: str
77
+ protocol: str
78
+ search: str
79
+ target: str
80
+ download: str
81
+ rel: str
82
+ hreflang: str
83
+ type: str
84
+ username: str
85
+
86
+ # Added properties
87
+ ping: str
88
+ referrerPolicy: Literal[
89
+ "",
90
+ "no-referrer",
91
+ "no-referrer-when-downgrade",
92
+ "origin",
93
+ "origin-when-cross-origin",
94
+ "same-origin",
95
+ "strict-origin",
96
+ "strict-origin-when-cross-origin",
97
+ "unsafe-url",
98
+ ]
99
+ text: str
100
+
101
+
102
+ class HTMLAreaElement(HTMLElementBase):
103
+ """Properties specific to <area> elements."""
104
+
105
+ tagName: Literal["area"] # pyright: ignore[reportIncompatibleVariableOverride]
106
+
107
+ alt: str
108
+ coords: str
109
+ download: str
110
+ hash: str
111
+ host: str
112
+ hostname: str
113
+ href: str
114
+ origin: str
115
+ password: str
116
+ pathname: str
117
+ port: str
118
+ protocol: str
119
+ rel: str
120
+ search: str
121
+ shape: str
122
+ target: str
123
+ username: str
124
+
125
+ # Added properties
126
+ ping: str
127
+ referrerPolicy: Literal[
128
+ "",
129
+ "no-referrer",
130
+ "no-referrer-when-downgrade",
131
+ "origin",
132
+ "origin-when-cross-origin",
133
+ "same-origin",
134
+ "strict-origin",
135
+ "strict-origin-when-cross-origin",
136
+ "unsafe-url",
137
+ ]
138
+
139
+
140
+ class HTMLMediaElement(HTMLElementBase):
141
+ """Properties specific to media elements like <audio> and <video>."""
142
+
143
+ autoplay: bool
144
+ controls: bool
145
+ crossOrigin: Literal["anonymous", "use-credentials"] | None
146
+ currentSrc: str
147
+ currentTime: float
148
+ defaultMuted: bool
149
+ defaultPlaybackRate: float
150
+ duration: float # Read-only, NaN if unavailable
151
+ ended: bool # Read-only
152
+ loop: bool
153
+ muted: bool
154
+ networkState: Literal[
155
+ 0, 1, 2, 3
156
+ ] # NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO_SOURCE
157
+ paused: bool # Read-only
158
+ playbackRate: float
159
+ preload: Literal["none", "metadata", "auto", ""]
160
+ readyState: Literal[0, 1, 2, 3, 4]
161
+ seeking: bool # Read-only
162
+ src: str
163
+ volume: float
164
+ preservesPitch: bool
165
+
166
+
167
+ class HTMLAudioElement(HTMLMediaElement):
168
+ """Specifies <audio> elements. Currently no differing properties from HTMLMediaElement in this subset."""
169
+
170
+ tagName: Literal["audio"] # pyright: ignore[reportIncompatibleVariableOverride]
171
+
172
+
173
+ class HTMLButtonElement(HTMLElementBase):
174
+ """Properties specific to <button> elements."""
175
+
176
+ tagName: Literal["button"] # pyright: ignore[reportIncompatibleVariableOverride]
177
+
178
+ disabled: bool
179
+ name: str
180
+ type: Literal["submit", "reset", "button"]
181
+ value: str
182
+
183
+ # Added form-related attributes
184
+ formAction: str
185
+ formEnctype: str
186
+ formMethod: str
187
+ formNoValidate: bool
188
+ formTarget: str
189
+ popoverTargetAction: str
190
+
191
+
192
+ class HTMLDataElement(HTMLElementBase):
193
+ """Properties specific to <data> elements."""
194
+
195
+ tagName: Literal["data"] # pyright: ignore[reportIncompatibleVariableOverride]
196
+
197
+ value: str
198
+
199
+
200
+ class HTMLEmbedElement(HTMLElementBase):
201
+ """Properties specific to <embed> elements."""
202
+
203
+ tagName: Literal["embed"] # pyright: ignore[reportIncompatibleVariableOverride]
204
+
205
+ height: str
206
+ src: str
207
+ type: str
208
+ width: str
209
+
210
+ # Added deprecated properties
211
+ align: str
212
+ name: str
213
+
214
+
215
+ class HTMLFieldSetElement(HTMLElementBase):
216
+ """Properties specific to <fieldset> elements."""
217
+
218
+ tagName: Literal["fieldset"] # pyright: ignore[reportIncompatibleVariableOverride]
219
+
220
+ disabled: bool
221
+ name: str
222
+ type: str # Generally "fieldset"
223
+
224
+ # Added validation properties
225
+ validationMessage: str
226
+ willValidate: bool
227
+
228
+
229
+ class HTMLFormElement(HTMLElementBase):
230
+ """Properties specific to <form> elements."""
231
+
232
+ tagName: Literal["form"] # pyright: ignore[reportIncompatibleVariableOverride]
233
+
234
+ acceptCharset: str
235
+ action: str
236
+ autocomplete: Literal["on", "off"]
237
+ encoding: str # alias for enctype
238
+ enctype: Literal[
239
+ "application/x-www-form-urlencoded",
240
+ "multipart/form-data",
241
+ "text/plain",
242
+ ]
243
+ length: int # Read-only, number of controls in the form
244
+ method: Literal["get", "post", "dialog"]
245
+ name: str
246
+ noValidate: bool
247
+ target: str
248
+ rel: str
249
+
250
+
251
+ class HTMLIFrameElement(HTMLElementBase):
252
+ """Properties specific to <iframe> elements."""
253
+
254
+ tagName: Literal["iframe"] # pyright: ignore[reportIncompatibleVariableOverride]
255
+
256
+ allow: str
257
+ allowFullscreen: bool
258
+ height: str
259
+ name: str
260
+ referrerPolicy: Literal[
261
+ "no-referrer",
262
+ "no-referrer-when-downgrade",
263
+ "origin",
264
+ "origin-when-cross-origin",
265
+ "same-origin",
266
+ "strict-origin",
267
+ "strict-origin-when-cross-origin",
268
+ "unsafe-url",
269
+ ]
270
+ src: str
271
+ srcdoc: str
272
+ width: str
273
+
274
+ # Added deprecated properties
275
+ align: str
276
+ frameBorder: str
277
+ longDesc: str
278
+ marginHeight: str
279
+ marginWidth: str
280
+ scrolling: str
281
+ sandbox: str
282
+
283
+
284
+ class HTMLImageElement(HTMLElementBase):
285
+ """Properties specific to <img> elements."""
286
+
287
+ tagName: Literal["img"] # pyright: ignore[reportIncompatibleVariableOverride]
288
+
289
+ alt: str
290
+ crossOrigin: Literal["anonymous", "use-credentials"] | None
291
+ decoding: Literal["sync", "async", "auto"]
292
+ height: int
293
+ isMap: bool
294
+ loading: Literal["eager", "lazy"]
295
+ naturalHeight: int # Read-only, intrinsic height
296
+ naturalWidth: int # Read-only, intrinsic width
297
+ referrerPolicy: Literal[
298
+ "no-referrer",
299
+ "no-referrer-when-downgrade",
300
+ "origin",
301
+ "origin-when-cross-origin",
302
+ "same-origin",
303
+ "strict-origin",
304
+ "strict-origin-when-cross-origin",
305
+ "unsafe-url",
306
+ ]
307
+ sizes: str
308
+ src: str
309
+ srcset: str
310
+ useMap: str
311
+ width: int
312
+
313
+ # Added properties (some deprecated)
314
+ align: str
315
+ border: str
316
+ complete: bool
317
+ hspace: int
318
+ longDesc: str
319
+ lowsrc: str
320
+ name: str
321
+ vspace: int
322
+ x: float
323
+ y: float
324
+ fetchPriority: Literal["high", "low", "auto"]
325
+
326
+
327
+ class HTMLInputElement(HTMLElementBase):
328
+ """Properties specific to <input> elements."""
329
+
330
+ tagName: Literal["input"] # pyright: ignore[reportIncompatibleVariableOverride]
331
+
332
+ accept: str
333
+ alt: str
334
+ autocomplete: str
335
+ checked: bool # For checkbox/radio
336
+ defaultChecked: bool
337
+ defaultValue: str
338
+ dirName: str
339
+ disabled: bool
340
+ height: str # Only for type="image"
341
+ indeterminate: bool # For checkbox
342
+ max: str # Works with number, date, range types etc.
343
+ maxLength: int
344
+ min: str
345
+ minLength: int
346
+ multiple: bool # For email, file
347
+ name: str
348
+ pattern: str
349
+ placeholder: str
350
+ readOnly: bool
351
+ required: bool
352
+ selectionDirection: Literal["forward", "backward", "none"] | None
353
+ selectionEnd: int | None
354
+ selectionStart: int | None
355
+ size: int
356
+ src: str # Only for type="image"
357
+ step: str
358
+ type: str # Input type (text, password, checkbox, etc.)
359
+ value: str # Current value
360
+ valueAsNumber: float | None # Parses value as float, NaN if invalid
361
+ width: str # Only for type="image"
362
+
363
+ # Added properties (some deprecated)
364
+ align: str
365
+ capture: str
366
+ formAction: str
367
+ formEnctype: str
368
+ formMethod: str
369
+ formNoValidate: bool
370
+ formTarget: str
371
+ useMap: str
372
+ validationMessage: str
373
+ willValidate: bool
374
+ popoverTargetAction: str
375
+
376
+
377
+ class HTMLLabelElement(HTMLElementBase):
378
+ """Properties specific to <label> elements."""
379
+
380
+ tagName: Literal["label"] # pyright: ignore[reportIncompatibleVariableOverride]
381
+
382
+ htmlFor: str # Corresponds to 'for' attribute
383
+
384
+
385
+ class HTMLLiElement(HTMLElementBase):
386
+ """Properties specific to <li> elements."""
387
+
388
+ tagName: Literal["li"] # pyright: ignore[reportIncompatibleVariableOverride]
389
+
390
+ value: int # Only valid if parent is <ol>
391
+ type: str
392
+
393
+
394
+ class HTMLLinkElement(HTMLElementBase):
395
+ """Properties specific to <link> elements."""
396
+
397
+ tagName: Literal["link"] # pyright: ignore[reportIncompatibleVariableOverride]
398
+
399
+ as_: str # Corresponds to 'as' attribute
400
+ crossOrigin: Literal["anonymous", "use-credentials"] | None
401
+ disabled: bool
402
+ fetchPriority: Literal["high", "low", "auto"]
403
+ href: str
404
+ hreflang: str
405
+ imageSizes: str
406
+ imageSrcset: str
407
+ integrity: str
408
+ media: str
409
+ referrerPolicy: Literal[
410
+ "no-referrer",
411
+ "no-referrer-when-downgrade",
412
+ "origin",
413
+ "origin-when-cross-origin",
414
+ "same-origin",
415
+ "strict-origin",
416
+ "strict-origin-when-cross-origin",
417
+ "unsafe-url",
418
+ ]
419
+ rel: str
420
+ type: str
421
+
422
+ # Added properties (some deprecated)
423
+ charset: str
424
+ rev: str
425
+ target: str
426
+ sizes: str
427
+
428
+
429
+ class HTMLMapElement(HTMLElementBase):
430
+ """Properties specific to <map> elements."""
431
+
432
+ tagName: Literal["map"] # pyright: ignore[reportIncompatibleVariableOverride]
433
+
434
+ name: str
435
+
436
+
437
+ class HTMLMeterElement(HTMLElementBase):
438
+ """Properties specific to <meter> elements."""
439
+
440
+ tagName: Literal["meter"] # pyright: ignore[reportIncompatibleVariableOverride]
441
+
442
+ high: float
443
+ low: float
444
+ max: float
445
+ min: float
446
+ optimum: float
447
+ value: float
448
+
449
+
450
+ class HTMLModElement(HTMLElementBase):
451
+ """Properties specific to <ins> and <del> elements."""
452
+
453
+ tagName: Literal["ins", "del"] # pyright: ignore[reportIncompatibleVariableOverride]
454
+
455
+ cite: str
456
+ dateTime: str # Corresponds to 'datetime' attribute
457
+
458
+
459
+ class HTMLOListElement(HTMLElementBase):
460
+ """Properties specific to <ol> elements."""
461
+
462
+ tagName: Literal["ol"] # pyright: ignore[reportIncompatibleVariableOverride]
463
+
464
+ reversed: bool
465
+ start: int
466
+ type: Literal["1", "a", "A", "i", "I"]
467
+ compact: bool
468
+
469
+
470
+ class HTMLObjectElement(HTMLElementBase):
471
+ """Properties specific to <object> elements."""
472
+
473
+ tagName: Literal["object"] # pyright: ignore[reportIncompatibleVariableOverride]
474
+
475
+ data: str
476
+ # disabled: bool
477
+ height: str
478
+ name: str
479
+ type: str
480
+ useMap: str
481
+ width: str
482
+
483
+ # Added properties (some deprecated)
484
+ align: str
485
+ archive: str
486
+ border: str
487
+ code: str
488
+ codeBase: str
489
+ codeType: str
490
+ declare: bool
491
+ hspace: int
492
+ standby: str
493
+ validationMessage: str
494
+ vspace: int
495
+ willValidate: bool
496
+
497
+
498
+ class HTMLOptGroupElement(HTMLElementBase):
499
+ """Properties specific to <optgroup> elements."""
500
+
501
+ tagName: Literal["optgroup"] # pyright: ignore[reportIncompatibleVariableOverride]
502
+
503
+ disabled: bool
504
+ label: str
505
+
506
+
507
+ class HTMLOptionElement(HTMLElementBase):
508
+ """Properties specific to <option> elements."""
509
+
510
+ tagName: Literal["option"] # pyright: ignore[reportIncompatibleVariableOverride]
511
+
512
+ defaultSelected: bool
513
+ disabled: bool
514
+ index: int # Read-only
515
+ label: str
516
+ selected: bool
517
+ text: str # Text content
518
+ value: str
519
+
520
+
521
+ class HTMLOutputElement(HTMLElementBase):
522
+ """Properties specific to <output> elements."""
523
+
524
+ tagName: Literal["output"] # pyright: ignore[reportIncompatibleVariableOverride]
525
+
526
+ defaultValue: str
527
+ name: str
528
+ type: str # Generally "output"
529
+ value: str
530
+
531
+ # Added properties
532
+ htmlFor: str
533
+ validationMessage: str
534
+ willValidate: bool
535
+
536
+
537
+ class HTMLProgressElement(HTMLElementBase):
538
+ """Properties specific to <progress> elements."""
539
+
540
+ tagName: Literal["progress"] # pyright: ignore[reportIncompatibleVariableOverride]
541
+
542
+ max: float
543
+ position: float # Read-only, -1 if indeterminate
544
+ value: float
545
+
546
+
547
+ class HTMLQuoteElement(HTMLElementBase):
548
+ """Properties specific to <q> and <blockquote> elements."""
549
+
550
+ tagName: Literal["q", "blockquote"] # pyright: ignore[reportIncompatibleVariableOverride]
551
+
552
+ cite: str
553
+
554
+
555
+ class HTMLCiteElement(HTMLElementBase):
556
+ """Properties specific to <cite> elements."""
557
+
558
+ tagName: Literal["cite"] # pyright: ignore[reportIncompatibleVariableOverride]
559
+
560
+
561
+ class HTMLScriptElement(HTMLElementBase):
562
+ """Properties specific to <script> elements."""
563
+
564
+ tagName: Literal["script"] # pyright: ignore[reportIncompatibleVariableOverride]
565
+
566
+ async_: bool # Corresponds to 'async' attribute
567
+ crossOrigin: Literal["anonymous", "use-credentials"] | None
568
+ defer: bool
569
+ fetchPriority: Literal["high", "low", "auto"]
570
+ integrity: str
571
+ noModule: bool
572
+ referrerPolicy: Literal[
573
+ "",
574
+ "no-referrer",
575
+ "no-referrer-when-downgrade",
576
+ "origin",
577
+ "origin-when-cross-origin",
578
+ "same-origin",
579
+ "strict-origin",
580
+ "strict-origin-when-cross-origin",
581
+ "unsafe-url",
582
+ ] # Expanded Literal
583
+ src: str
584
+ text: str # Script content if inline
585
+ type: str
586
+
587
+ # Added deprecated properties
588
+ charset: str
589
+ event: str
590
+ htmlFor: str
591
+
592
+
593
+ class HTMLSelectElement(HTMLElementBase):
594
+ """Properties specific to <select> elements."""
595
+
596
+ tagName: Literal["select"] # pyright: ignore[reportIncompatibleVariableOverride]
597
+
598
+ autocomplete: str
599
+ disabled: bool
600
+ length: int # Read-only, number of options
601
+ multiple: bool
602
+ name: str
603
+ required: bool
604
+ selectedIndex: int
605
+ size: int
606
+ type: Literal["select-one", "select-multiple"] # Read-only
607
+ value: str # Value of the first selected option, or ""
608
+
609
+ # Added validation properties
610
+ validationMessage: str
611
+ willValidate: bool
612
+
613
+
614
+ class HTMLSlotElement(HTMLElementBase):
615
+ """Properties specific to <slot> elements."""
616
+
617
+ tagName: Literal["slot"] # pyright: ignore[reportIncompatibleVariableOverride]
618
+
619
+ name: str
620
+
621
+
622
+ class HTMLSourceElement(HTMLElementBase):
623
+ """Properties specific to <source> elements."""
624
+
625
+ tagName: Literal["source"] # pyright: ignore[reportIncompatibleVariableOverride]
626
+
627
+ height: int
628
+ media: str
629
+ sizes: str
630
+ src: str
631
+ srcset: str
632
+ type: str
633
+ width: int
634
+
635
+
636
+ class HTMLTableCaptionElement(HTMLElementBase):
637
+ """Properties specific to <caption> elements."""
638
+
639
+ tagName: Literal["caption"] # pyright: ignore[reportIncompatibleVariableOverride]
640
+ align: str
641
+
642
+
643
+ class HTMLTableCellElement(HTMLElementBase):
644
+ """Properties specific to <td> and <th> elements."""
645
+
646
+ tagName: Literal["td", "th"] # pyright: ignore[reportIncompatibleVariableOverride]
647
+
648
+ abbr: str
649
+ cellIndex: int # Read-only
650
+ colSpan: int
651
+ headers: str # Corresponds to 'headers' attribute, space-separated list of IDs
652
+ rowSpan: int
653
+ scope: Literal["row", "col", "rowgroup", "colgroup", ""]
654
+
655
+ # Added deprecated properties
656
+ align: str
657
+ axis: str
658
+ bgColor: str
659
+ ch: str
660
+ chOff: str
661
+ height: str
662
+ noWrap: bool
663
+ vAlign: str
664
+ width: str
665
+
666
+
667
+ class HTMLTableColElement(HTMLElementBase):
668
+ """Properties specific to <col> and <colgroup> elements."""
669
+
670
+ tagName: Literal["col", "colgroup"] # pyright: ignore[reportIncompatibleVariableOverride]
671
+
672
+ span: int
673
+
674
+ # Added deprecated properties
675
+ align: str
676
+ ch: str
677
+ chOff: str
678
+ vAlign: str
679
+ width: str
680
+
681
+
682
+ class HTMLTableElement(HTMLElementBase):
683
+ """Properties specific to <table> elements."""
684
+
685
+ tagName: Literal["table"] # pyright: ignore[reportIncompatibleVariableOverride]
686
+
687
+ # caption: Optional[HTMLTableCaptionElement] # Reference, might be tricky
688
+ # t_head: Optional[HTMLTableSectionElement] # Reference
689
+ # t_foot: Optional[HTMLTableSectionElement] # Reference
690
+ # t_bodies: HTMLCollection # Cannot serialize
691
+ # rows: HTMLCollection # Cannot serialize
692
+
693
+ # Added deprecated properties
694
+ align: str
695
+ bgColor: str
696
+ border: str
697
+ cellPadding: str
698
+ cellSpacing: str
699
+ frame: str
700
+ rules: str
701
+ summary: str
702
+ width: str
703
+
704
+
705
+ class HTMLTableRowElement(HTMLElementBase):
706
+ """Properties specific to <tr> elements."""
707
+
708
+ tagName: Literal["tr"] # pyright: ignore[reportIncompatibleVariableOverride]
709
+
710
+ # cells: HTMLCollection # Cannot serialize
711
+ rowIndex: int # Read-only
712
+ sectionRowIndex: int # Read-only
713
+
714
+ # Added deprecated properties
715
+ align: str
716
+ bgColor: str
717
+ ch: str
718
+ chOff: str
719
+ vAlign: str
720
+
721
+
722
+ class HTMLTableSectionElement(HTMLElementBase):
723
+ """Properties specific to <thead>, <tbody>, <tfoot> elements."""
724
+
725
+ tagName: Literal["thead", "tbody", "tfoot"] # pyright: ignore[reportIncompatibleVariableOverride]
726
+
727
+ # rows: HTMLCollection # Cannot serialize
728
+ # Added deprecated properties
729
+ align: str
730
+ ch: str
731
+ chOff: str
732
+ vAlign: str
733
+
734
+
735
+ class HTMLTemplateElement(HTMLElementBase):
736
+ """Properties specific to <template> elements."""
737
+
738
+ tagName: Literal["template"] # pyright: ignore[reportIncompatibleVariableOverride]
739
+
740
+ # content: DocumentFragment # Cannot serialize
741
+ pass
742
+
743
+
744
+ class HTMLTextAreaElement(HTMLElementBase):
745
+ """Properties specific to <textarea> elements."""
746
+
747
+ tagName: Literal["textarea"] # pyright: ignore[reportIncompatibleVariableOverride]
748
+
749
+ autocomplete: str
750
+ cols: int
751
+ defaultValue: str
752
+ dirName: str
753
+ disabled: bool
754
+ maxLength: int
755
+ minLength: int
756
+ name: str
757
+ placeholder: str
758
+ readOnly: bool
759
+ required: bool
760
+ rows: int
761
+ selectionDirection: Literal["forward", "backward", "none"] | None
762
+ selectionEnd: int | None
763
+ selectionStart: int | None
764
+ value: str
765
+ wrap: Literal["soft", "hard", "off"]
766
+
767
+ # Added properties
768
+ textLength: int
769
+ validationMessage: str
770
+ willValidate: bool
771
+
772
+
773
+ class HTMLTimeElement(HTMLElementBase):
774
+ """Properties specific to <time> elements."""
775
+
776
+ tagName: Literal["time"] # pyright: ignore[reportIncompatibleVariableOverride]
777
+
778
+ datetime: str # Corresponds to 'dateTime' attribute
779
+
780
+
781
+ class HTMLTrackElement(HTMLElementBase):
782
+ """Properties specific to <track> elements."""
783
+
784
+ tagName: Literal["track"] # pyright: ignore[reportIncompatibleVariableOverride]
785
+
786
+ default: bool
787
+ kind: Literal["subtitles", "captions", "descriptions", "chapters", "metadata"]
788
+ label: str
789
+ readyState: Literal[0, 1, 2, 3]
790
+ src: str
791
+ srclang: str
792
+ # track: Optional[TextTrack] # Cannot serialize
793
+
794
+
795
+ class HTMLVideoElement(HTMLMediaElement):
796
+ """Properties specific to <video> elements."""
797
+
798
+ tagName: Literal["video"] # pyright: ignore[reportIncompatibleVariableOverride]
799
+
800
+ height: int
801
+ poster: str
802
+ videoHeight: int # Read-only, intrinsic height
803
+ videoWidth: int # Read-only, intrinsic width
804
+ width: int
805
+ playsInline: bool
806
+
807
+
808
+ class HTMLBRElement(HTMLElementBase):
809
+ """Properties specific to <br> elements."""
810
+
811
+ tagName: Literal["br"] # pyright: ignore[reportIncompatibleVariableOverride]
812
+ clear: str
813
+
814
+
815
+ class HTMLBaseElement(HTMLElementBase):
816
+ """Properties specific to <base> elements."""
817
+
818
+ tagName: Literal["base"] # pyright: ignore[reportIncompatibleVariableOverride]
819
+ href: str
820
+ target: str
821
+
822
+
823
+ class HTMLBodyElement(HTMLElementBase):
824
+ """Properties specific to <body> elements."""
825
+
826
+ tagName: Literal["body"] # pyright: ignore[reportIncompatibleVariableOverride]
827
+ aLink: str
828
+ background: str
829
+ bgColor: str
830
+ link: str
831
+ text: str
832
+ vLink: str
833
+
834
+
835
+ class HTMLDListElement(HTMLElementBase):
836
+ """Properties specific to <dl> elements."""
837
+
838
+ tagName: Literal["dl"] # pyright: ignore[reportIncompatibleVariableOverride]
839
+ compact: bool
840
+
841
+
842
+ class HTMLDetailsElement(HTMLElementBase):
843
+ """Properties specific to <details> elements."""
844
+
845
+ tagName: Literal["details"] # pyright: ignore[reportIncompatibleVariableOverride]
846
+ open: bool
847
+
848
+
849
+ class HTMLDialogElement(HTMLElementBase):
850
+ """Properties specific to <dialog> elements."""
851
+
852
+ tagName: Literal["dialog"] # pyright: ignore[reportIncompatibleVariableOverride]
853
+ open: bool
854
+ returnValue: str
855
+
856
+
857
+ class HTMLDivElement(HTMLElementBase):
858
+ """Properties specific to <div> elements."""
859
+
860
+ tagName: Literal["div"] # pyright: ignore[reportIncompatibleVariableOverride]
861
+ align: str
862
+
863
+
864
+ class HTMLHeadElement(HTMLElementBase):
865
+ """Properties specific to <head> elements."""
866
+
867
+ tagName: Literal["head"] # pyright: ignore[reportIncompatibleVariableOverride]
868
+
869
+
870
+ class HTMLHeadingElement(HTMLElementBase):
871
+ """Properties specific to <h1> through <h6> elements."""
872
+
873
+ tagName: Literal["h1", "h2", "h3", "h4", "h5", "h6"] # pyright: ignore[reportIncompatibleVariableOverride]
874
+ align: str
875
+
876
+
877
+ class HTMLHRElement(HTMLElementBase):
878
+ """Properties specific to <hr> elements."""
879
+
880
+ tagName: Literal["hr"] # pyright: ignore[reportIncompatibleVariableOverride]
881
+ align: str
882
+ color: str
883
+ noShade: bool
884
+ size: str
885
+ width: str
886
+
887
+
888
+ class HTMLHtmlElement(HTMLElementBase):
889
+ """Properties specific to <html> elements."""
890
+
891
+ tagName: Literal["html"] # pyright: ignore[reportIncompatibleVariableOverride]
892
+ version: str
893
+
894
+
895
+ class HTMLMenuElement(HTMLElementBase):
896
+ """Properties specific to <menu> elements."""
897
+
898
+ tagName: Literal["menu"] # pyright: ignore[reportIncompatibleVariableOverride]
899
+
900
+
901
+ class HTMLMetaElement(HTMLElementBase):
902
+ """Properties specific to <meta> elements."""
903
+
904
+ tagName: Literal["meta"] # pyright: ignore[reportIncompatibleVariableOverride]
905
+ content: str
906
+ httpEquiv: str
907
+ name: str
908
+ scheme: str
909
+
910
+
911
+ class HTMLParagraphElement(HTMLElementBase):
912
+ """Properties specific to <p> elements."""
913
+
914
+ tagName: Literal["p"] # pyright: ignore[reportIncompatibleVariableOverride]
915
+ align: str
916
+
917
+
918
+ class HTMLPictureElement(HTMLElementBase):
919
+ """Properties specific to <picture> elements."""
920
+
921
+ tagName: Literal["picture"] # pyright: ignore[reportIncompatibleVariableOverride]
922
+
923
+
924
+ class HTMLPreElement(HTMLElementBase):
925
+ """Properties specific to <pre> elements."""
926
+
927
+ tagName: Literal["pre"] # pyright: ignore[reportIncompatibleVariableOverride]
928
+ width: int
929
+
930
+
931
+ class HTMLSpanElement(HTMLElementBase):
932
+ """Properties specific to <span> elements."""
933
+
934
+ tagName: Literal["span"] # pyright: ignore[reportIncompatibleVariableOverride]
935
+ # No additional properties
936
+
937
+
938
+ class HTMLStyleElement(HTMLElementBase):
939
+ """Properties specific to <style> elements."""
940
+
941
+ tagName: Literal["style"] # pyright: ignore[reportIncompatibleVariableOverride]
942
+ media: str
943
+ type: str
944
+ disabled: bool
945
+
946
+
947
+ class HTMLTitleElement(HTMLElementBase):
948
+ """Properties specific to <title> elements."""
949
+
950
+ tagName: Literal["title"] # pyright: ignore[reportIncompatibleVariableOverride]
951
+ text: str
952
+
953
+
954
+ class HTMLUListElement(HTMLElementBase):
955
+ """Properties specific to <ul> elements."""
956
+
957
+ tagName: Literal["ul"] # pyright: ignore[reportIncompatibleVariableOverride]
958
+ compact: bool
959
+ type: str
960
+
961
+
962
+ HTMLElement: TypeAlias = (
963
+ GenericHTMLElement
964
+ | HTMLAnchorElement
965
+ | HTMLAreaElement
966
+ | HTMLAudioElement
967
+ | HTMLBaseElement
968
+ | HTMLBodyElement
969
+ | HTMLBRElement
970
+ | HTMLButtonElement
971
+ | HTMLCiteElement
972
+ | HTMLDataElement
973
+ | HTMLDetailsElement
974
+ | HTMLDialogElement
975
+ | HTMLDivElement
976
+ | HTMLDListElement
977
+ | HTMLEmbedElement
978
+ | HTMLFieldSetElement
979
+ | HTMLFormElement
980
+ | HTMLHeadElement
981
+ | HTMLHeadingElement
982
+ | HTMLHRElement
983
+ | HTMLHtmlElement
984
+ | HTMLIFrameElement
985
+ | HTMLImageElement
986
+ | HTMLInputElement
987
+ | HTMLLabelElement
988
+ | HTMLLiElement
989
+ | HTMLLinkElement
990
+ | HTMLMapElement
991
+ | HTMLMenuElement
992
+ | HTMLMetaElement
993
+ | HTMLMeterElement
994
+ | HTMLModElement
995
+ | HTMLOListElement
996
+ | HTMLObjectElement
997
+ | HTMLOptGroupElement
998
+ | HTMLOptionElement
999
+ | HTMLOutputElement
1000
+ | HTMLParagraphElement
1001
+ | HTMLPictureElement
1002
+ | HTMLPreElement
1003
+ | HTMLProgressElement
1004
+ | HTMLQuoteElement
1005
+ | HTMLScriptElement
1006
+ | HTMLSelectElement
1007
+ | HTMLSlotElement
1008
+ | HTMLSourceElement
1009
+ | HTMLSpanElement
1010
+ | HTMLStyleElement
1011
+ | HTMLTableCaptionElement
1012
+ | HTMLTableCellElement
1013
+ | HTMLTableColElement
1014
+ | HTMLTableElement
1015
+ | HTMLTableRowElement
1016
+ | HTMLTableSectionElement
1017
+ | HTMLTemplateElement
1018
+ | HTMLTextAreaElement
1019
+ | HTMLTimeElement
1020
+ | HTMLTitleElement
1021
+ | HTMLTrackElement
1022
+ | HTMLUListElement
1023
+ | HTMLVideoElement
1024
+ )