@pyscript/core 0.4.55 → 0.5.0-rc1
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/dist/{codemirror-uEsvwGeX.js → codemirror-ZWX__zRS.js} +2 -2
- package/dist/{codemirror-uEsvwGeX.js.map → codemirror-ZWX__zRS.js.map} +1 -1
- package/dist/{codemirror_commands-BjErX5JV.js → codemirror_commands-BvofQ4B2.js} +2 -2
- package/dist/{codemirror_commands-BjErX5JV.js.map → codemirror_commands-BvofQ4B2.js.map} +1 -1
- package/dist/{codemirror_lang-python-rjOo-iGF.js → codemirror_lang-python-CAjFAwEr.js} +2 -2
- package/dist/{codemirror_lang-python-rjOo-iGF.js.map → codemirror_lang-python-CAjFAwEr.js.map} +1 -1
- package/dist/{codemirror_language-oTnz5LmX.js → codemirror_language-BzugrQDC.js} +2 -2
- package/dist/{codemirror_language-oTnz5LmX.js.map → codemirror_language-BzugrQDC.js.map} +1 -1
- package/dist/codemirror_view-DrrFKRyn.js +2 -0
- package/dist/codemirror_view-DrrFKRyn.js.map +1 -0
- package/dist/core-jHCq6GXZ.js +2 -0
- package/dist/core-jHCq6GXZ.js.map +1 -0
- package/dist/core.js +1 -1
- package/dist/{deprecations-manager-BsD6IG0e.js → deprecations-manager-JLWNpJ-L.js} +2 -2
- package/dist/{deprecations-manager-BsD6IG0e.js.map → deprecations-manager-JLWNpJ-L.js.map} +1 -1
- package/dist/{error-BwsFl_vB.js → error-BZdmXuMQ.js} +2 -2
- package/dist/{error-BwsFl_vB.js.map → error-BZdmXuMQ.js.map} +1 -1
- package/dist/{index-DvH26nkT.js → index-YJCpGJSa.js} +2 -2
- package/dist/{index-DvH26nkT.js.map → index-YJCpGJSa.js.map} +1 -1
- package/dist/{mpy-Cq6_SATz.js → mpy-CA-8GLzg.js} +2 -2
- package/dist/mpy-CA-8GLzg.js.map +1 -0
- package/dist/{py-editor-CO1XYgQ3.js → py-editor-BFwOcA7b.js} +2 -2
- package/dist/{py-editor-CO1XYgQ3.js.map → py-editor-BFwOcA7b.js.map} +1 -1
- package/dist/{py-terminal-7BWBB6VM.js → py-terminal-GLATgrHP.js} +2 -2
- package/dist/{py-terminal-7BWBB6VM.js.map → py-terminal-GLATgrHP.js.map} +1 -1
- package/dist/{py-Dpy4_-ky.js → py-tfDQPNNm.js} +2 -2
- package/dist/{py-Dpy4_-ky.js.map → py-tfDQPNNm.js.map} +1 -1
- package/dist/{zip-BxogYCy6.js → zip-CGWtiqjJ.js} +2 -2
- package/dist/zip-CGWtiqjJ.js.map +1 -0
- package/package.json +8 -8
- package/src/plugins/py-terminal/mpy.js +6 -5
- package/src/stdlib/pyscript/event_handling.py +13 -12
- package/src/stdlib/pyscript/magic_js.py +4 -12
- package/src/stdlib/pyscript/web/__init__.py +21 -4
- package/src/stdlib/pyscript/web/elements.py +919 -724
- package/src/stdlib/pyscript.js +4 -15
- package/types/core.d.ts +1 -1
- package/types/stdlib/pyscript.d.ts +0 -11
- package/dist/codemirror_view-CH_aW-qU.js +0 -2
- package/dist/codemirror_view-CH_aW-qU.js.map +0 -1
- package/dist/core-Di0g8mUD.js +0 -3
- package/dist/core-Di0g8mUD.js.map +0 -1
- package/dist/mpy-Cq6_SATz.js.map +0 -1
- package/dist/zip-BxogYCy6.js.map +0 -1
- package/dist.zip +0 -0
- package/src/stdlib/pyscript/web/dom.py +0 -21
- package/src/stdlib/pyscript/web/media.py +0 -95
- package/src/stdlib/pyweb/__init__.py +0 -2
- package/src/stdlib/pyweb/media.py +0 -95
- package/src/stdlib/pyweb/pydom.py +0 -569
- package/src/stdlib/pyweb/ui/__init__.py +0 -1
- package/src/stdlib/pyweb/ui/elements.py +0 -947
@@ -1,947 +0,0 @@
|
|
1
|
-
import inspect
|
2
|
-
import sys
|
3
|
-
|
4
|
-
from pyscript import document, when, window
|
5
|
-
from pyweb import JSProperty, pydom
|
6
|
-
|
7
|
-
#: A flag to show if MicroPython is the current Python interpreter.
|
8
|
-
is_micropython = "MicroPython" in sys.version
|
9
|
-
|
10
|
-
|
11
|
-
def getmembers_static(cls):
|
12
|
-
"""Cross-interpreter implementation of inspect.getmembers_static."""
|
13
|
-
|
14
|
-
if is_micropython: # pragma: no cover
|
15
|
-
return [(name, getattr(cls, name)) for name, _ in inspect.getmembers(cls)]
|
16
|
-
|
17
|
-
return inspect.getmembers_static(cls)
|
18
|
-
|
19
|
-
|
20
|
-
class ElementBase(pydom.Element):
|
21
|
-
tag = "div"
|
22
|
-
|
23
|
-
# GLOBAL ATTRIBUTES
|
24
|
-
# These are attribute that all elements have (this list is a subset of the official one)
|
25
|
-
# We are trying to capture the most used ones
|
26
|
-
accesskey = JSProperty("accesskey")
|
27
|
-
autofocus = JSProperty("autofocus")
|
28
|
-
autocapitalize = JSProperty("autocapitalize")
|
29
|
-
className = JSProperty("className")
|
30
|
-
contenteditable = JSProperty("contenteditable")
|
31
|
-
draggable = JSProperty("draggable")
|
32
|
-
enterkeyhint = JSProperty("enterkeyhint")
|
33
|
-
hidden = JSProperty("hidden")
|
34
|
-
id = JSProperty("id")
|
35
|
-
lang = JSProperty("lang")
|
36
|
-
nonce = JSProperty("nonce")
|
37
|
-
part = JSProperty("part")
|
38
|
-
popover = JSProperty("popover")
|
39
|
-
slot = JSProperty("slot")
|
40
|
-
spellcheck = JSProperty("spellcheck")
|
41
|
-
tabindex = JSProperty("tabindex")
|
42
|
-
title = JSProperty("title")
|
43
|
-
translate = JSProperty("translate")
|
44
|
-
virtualkeyboardpolicy = JSProperty("virtualkeyboardpolicy")
|
45
|
-
|
46
|
-
def __init__(self, style=None, **kwargs):
|
47
|
-
super().__init__(document.createElement(self.tag))
|
48
|
-
|
49
|
-
# set all the style properties provided in input
|
50
|
-
if isinstance(style, dict):
|
51
|
-
for key, value in style.items():
|
52
|
-
self.style[key] = value
|
53
|
-
elif style is None:
|
54
|
-
pass
|
55
|
-
else:
|
56
|
-
raise ValueError(
|
57
|
-
f"Style should be a dictionary, received {style} (type {type(style)}) instead."
|
58
|
-
)
|
59
|
-
|
60
|
-
# IMPORTANT!!! This is used to auto-harvest all input arguments and set them as properties
|
61
|
-
self._init_properties(**kwargs)
|
62
|
-
|
63
|
-
def _init_properties(self, **kwargs):
|
64
|
-
"""Set all the properties (of type JSProperties) provided in input as properties
|
65
|
-
of the class instance.
|
66
|
-
|
67
|
-
Args:
|
68
|
-
**kwargs: The properties to set
|
69
|
-
"""
|
70
|
-
# Look at all the properties of the class and see if they were provided in kwargs
|
71
|
-
for attr_name, attr in getmembers_static(self.__class__):
|
72
|
-
# For each one, actually check if it is a property of the class and set it
|
73
|
-
if isinstance(attr, JSProperty) and attr_name in kwargs:
|
74
|
-
try:
|
75
|
-
setattr(self, attr_name, kwargs[attr_name])
|
76
|
-
except Exception as e:
|
77
|
-
print(f"Error setting {attr_name} to {kwargs[attr_name]}: {e}")
|
78
|
-
raise
|
79
|
-
|
80
|
-
|
81
|
-
class TextElementBase(ElementBase):
|
82
|
-
def __init__(self, content=None, style=None, **kwargs):
|
83
|
-
super().__init__(style=style, **kwargs)
|
84
|
-
|
85
|
-
# If it's an element, append the element
|
86
|
-
if isinstance(content, pydom.Element):
|
87
|
-
self.append(content)
|
88
|
-
# If it's a list of elements
|
89
|
-
elif isinstance(content, list):
|
90
|
-
for item in content:
|
91
|
-
self.append(item)
|
92
|
-
# If the content wasn't set just ignore
|
93
|
-
elif content is None:
|
94
|
-
pass
|
95
|
-
else:
|
96
|
-
# Otherwise, set content as the html of the element
|
97
|
-
self.html = content
|
98
|
-
|
99
|
-
|
100
|
-
# IMPORTANT: For all HTML components defined below, we are not mapping all
|
101
|
-
# available attributes, just the global and the most common ones.
|
102
|
-
# If you need to access a specific attribute, you can always use the `_js.<attribute>`
|
103
|
-
class a(TextElementBase):
|
104
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a"""
|
105
|
-
|
106
|
-
tag = "a"
|
107
|
-
|
108
|
-
download = JSProperty("download")
|
109
|
-
href = JSProperty("href")
|
110
|
-
referrerpolicy = JSProperty("referrerpolicy")
|
111
|
-
rel = JSProperty("rel")
|
112
|
-
target = JSProperty("target")
|
113
|
-
type = JSProperty("type")
|
114
|
-
|
115
|
-
|
116
|
-
class abbr(TextElementBase):
|
117
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/abbr"""
|
118
|
-
|
119
|
-
tag = "abbr"
|
120
|
-
|
121
|
-
|
122
|
-
class address(TextElementBase):
|
123
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/address"""
|
124
|
-
|
125
|
-
tag = "address"
|
126
|
-
|
127
|
-
|
128
|
-
class area(ElementBase):
|
129
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/area"""
|
130
|
-
|
131
|
-
tag = "area"
|
132
|
-
|
133
|
-
alt = JSProperty("alt")
|
134
|
-
coords = JSProperty("coords")
|
135
|
-
download = JSProperty("download")
|
136
|
-
href = JSProperty("href")
|
137
|
-
ping = JSProperty("ping")
|
138
|
-
referrerpolicy = JSProperty("referrerpolicy")
|
139
|
-
rel = JSProperty("rel")
|
140
|
-
shape = JSProperty("shape")
|
141
|
-
target = JSProperty("target")
|
142
|
-
|
143
|
-
|
144
|
-
class article(TextElementBase):
|
145
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article"""
|
146
|
-
|
147
|
-
tag = "article"
|
148
|
-
|
149
|
-
|
150
|
-
class aside(TextElementBase):
|
151
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside"""
|
152
|
-
|
153
|
-
tag = "aside"
|
154
|
-
|
155
|
-
|
156
|
-
class audio(ElementBase):
|
157
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio"""
|
158
|
-
|
159
|
-
tag = "audio"
|
160
|
-
|
161
|
-
autoplay = JSProperty("autoplay")
|
162
|
-
controls = JSProperty("controls")
|
163
|
-
controlslist = JSProperty("controlslist")
|
164
|
-
crossorigin = JSProperty("crossorigin")
|
165
|
-
disableremoteplayback = JSProperty("disableremoteplayback")
|
166
|
-
loop = JSProperty("loop")
|
167
|
-
muted = JSProperty("muted")
|
168
|
-
preload = JSProperty("preload")
|
169
|
-
src = JSProperty("src")
|
170
|
-
|
171
|
-
|
172
|
-
class b(TextElementBase):
|
173
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/b"""
|
174
|
-
|
175
|
-
tag = "b"
|
176
|
-
|
177
|
-
|
178
|
-
class blockquote(TextElementBase):
|
179
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote"""
|
180
|
-
|
181
|
-
tag = "blockquote"
|
182
|
-
|
183
|
-
cite = JSProperty("cite")
|
184
|
-
|
185
|
-
|
186
|
-
class br(ElementBase):
|
187
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br"""
|
188
|
-
|
189
|
-
tag = "br"
|
190
|
-
|
191
|
-
|
192
|
-
class button(TextElementBase):
|
193
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button"""
|
194
|
-
|
195
|
-
tag = "button"
|
196
|
-
|
197
|
-
autofocus = JSProperty("autofocus")
|
198
|
-
disabled = JSProperty("disabled")
|
199
|
-
form = JSProperty("form")
|
200
|
-
formaction = JSProperty("formaction")
|
201
|
-
formenctype = JSProperty("formenctype")
|
202
|
-
formmethod = JSProperty("formmethod")
|
203
|
-
formnovalidate = JSProperty("formnovalidate")
|
204
|
-
formtarget = JSProperty("formtarget")
|
205
|
-
name = JSProperty("name")
|
206
|
-
type = JSProperty("type")
|
207
|
-
value = JSProperty("value")
|
208
|
-
|
209
|
-
|
210
|
-
class canvas(TextElementBase):
|
211
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas"""
|
212
|
-
|
213
|
-
tag = "canvas"
|
214
|
-
|
215
|
-
height = JSProperty("height")
|
216
|
-
width = JSProperty("width")
|
217
|
-
|
218
|
-
|
219
|
-
class caption(TextElementBase):
|
220
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption"""
|
221
|
-
|
222
|
-
tag = "caption"
|
223
|
-
|
224
|
-
|
225
|
-
class cite(TextElementBase):
|
226
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite"""
|
227
|
-
|
228
|
-
tag = "cite"
|
229
|
-
|
230
|
-
|
231
|
-
class code(TextElementBase):
|
232
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code"""
|
233
|
-
|
234
|
-
tag = "code"
|
235
|
-
|
236
|
-
|
237
|
-
class data(TextElementBase):
|
238
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data"""
|
239
|
-
|
240
|
-
tag = "data"
|
241
|
-
|
242
|
-
value = JSProperty("value")
|
243
|
-
|
244
|
-
|
245
|
-
class datalist(TextElementBase):
|
246
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist"""
|
247
|
-
|
248
|
-
tag = "datalist"
|
249
|
-
|
250
|
-
|
251
|
-
class dd(TextElementBase):
|
252
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dd"""
|
253
|
-
|
254
|
-
tag = "dd"
|
255
|
-
|
256
|
-
|
257
|
-
class del_(TextElementBase):
|
258
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/del"""
|
259
|
-
|
260
|
-
tag = "del"
|
261
|
-
|
262
|
-
cite = JSProperty("cite")
|
263
|
-
datetime = JSProperty("datetime")
|
264
|
-
|
265
|
-
|
266
|
-
class details(TextElementBase):
|
267
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details"""
|
268
|
-
|
269
|
-
tag = "details"
|
270
|
-
|
271
|
-
open = JSProperty("open")
|
272
|
-
|
273
|
-
|
274
|
-
class dialog(TextElementBase):
|
275
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog"""
|
276
|
-
|
277
|
-
tag = "dialog"
|
278
|
-
|
279
|
-
open = JSProperty("open")
|
280
|
-
|
281
|
-
|
282
|
-
class div(TextElementBase):
|
283
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div"""
|
284
|
-
|
285
|
-
tag = "div"
|
286
|
-
|
287
|
-
|
288
|
-
class dl(TextElementBase):
|
289
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl"""
|
290
|
-
|
291
|
-
tag = "dl"
|
292
|
-
|
293
|
-
value = JSProperty("value")
|
294
|
-
|
295
|
-
|
296
|
-
class dt(TextElementBase):
|
297
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dt"""
|
298
|
-
|
299
|
-
tag = "dt"
|
300
|
-
|
301
|
-
|
302
|
-
class em(TextElementBase):
|
303
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em"""
|
304
|
-
|
305
|
-
tag = "em"
|
306
|
-
|
307
|
-
|
308
|
-
class embed(TextElementBase):
|
309
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed"""
|
310
|
-
|
311
|
-
tag = "embed"
|
312
|
-
|
313
|
-
height = JSProperty("height")
|
314
|
-
src = JSProperty("src")
|
315
|
-
type = JSProperty("type")
|
316
|
-
width = JSProperty("width")
|
317
|
-
|
318
|
-
|
319
|
-
class fieldset(TextElementBase):
|
320
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset"""
|
321
|
-
|
322
|
-
tag = "fieldset"
|
323
|
-
|
324
|
-
disabled = JSProperty("disabled")
|
325
|
-
form = JSProperty("form")
|
326
|
-
name = JSProperty("name")
|
327
|
-
|
328
|
-
|
329
|
-
class figcaption(TextElementBase):
|
330
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption"""
|
331
|
-
|
332
|
-
tag = "figcaption"
|
333
|
-
|
334
|
-
|
335
|
-
class figure(TextElementBase):
|
336
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure"""
|
337
|
-
|
338
|
-
tag = "figure"
|
339
|
-
|
340
|
-
|
341
|
-
class footer(TextElementBase):
|
342
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/footer"""
|
343
|
-
|
344
|
-
tag = "footer"
|
345
|
-
|
346
|
-
|
347
|
-
class form(TextElementBase):
|
348
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form"""
|
349
|
-
|
350
|
-
tag = "form"
|
351
|
-
|
352
|
-
accept_charset = JSProperty("accept-charset")
|
353
|
-
action = JSProperty("action")
|
354
|
-
autocapitalize = JSProperty("autocapitalize")
|
355
|
-
autocomplete = JSProperty("autocomplete")
|
356
|
-
enctype = JSProperty("enctype")
|
357
|
-
name = JSProperty("name")
|
358
|
-
method = JSProperty("method")
|
359
|
-
nonvalidate = JSProperty("nonvalidate")
|
360
|
-
rel = JSProperty("rel")
|
361
|
-
target = JSProperty("target")
|
362
|
-
|
363
|
-
|
364
|
-
class h1(TextElementBase):
|
365
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h1"""
|
366
|
-
|
367
|
-
tag = "h1"
|
368
|
-
|
369
|
-
|
370
|
-
class h2(TextElementBase):
|
371
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h2"""
|
372
|
-
|
373
|
-
tag = "h2"
|
374
|
-
|
375
|
-
|
376
|
-
class h3(TextElementBase):
|
377
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h3"""
|
378
|
-
|
379
|
-
tag = "h3"
|
380
|
-
|
381
|
-
|
382
|
-
class h4(TextElementBase):
|
383
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h4"""
|
384
|
-
|
385
|
-
tag = "h4"
|
386
|
-
|
387
|
-
|
388
|
-
class h5(TextElementBase):
|
389
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h5"""
|
390
|
-
|
391
|
-
tag = "h5"
|
392
|
-
|
393
|
-
|
394
|
-
class h6(TextElementBase):
|
395
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h6"""
|
396
|
-
|
397
|
-
tag = "h6"
|
398
|
-
|
399
|
-
|
400
|
-
class header(TextElementBase):
|
401
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header"""
|
402
|
-
|
403
|
-
tag = "header"
|
404
|
-
|
405
|
-
|
406
|
-
class hgroup(TextElementBase):
|
407
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hgroup"""
|
408
|
-
|
409
|
-
tag = "hgroup"
|
410
|
-
|
411
|
-
|
412
|
-
class hr(TextElementBase):
|
413
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr"""
|
414
|
-
|
415
|
-
tag = "hr"
|
416
|
-
|
417
|
-
|
418
|
-
class i(TextElementBase):
|
419
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/i"""
|
420
|
-
|
421
|
-
tag = "i"
|
422
|
-
|
423
|
-
|
424
|
-
class iframe(TextElementBase):
|
425
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe"""
|
426
|
-
|
427
|
-
tag = "iframe"
|
428
|
-
|
429
|
-
allow = JSProperty("allow")
|
430
|
-
allowfullscreen = JSProperty("allowfullscreen")
|
431
|
-
height = JSProperty("height")
|
432
|
-
loading = JSProperty("loading")
|
433
|
-
name = JSProperty("name")
|
434
|
-
referrerpolicy = JSProperty("referrerpolicy")
|
435
|
-
sandbox = JSProperty("sandbox")
|
436
|
-
src = JSProperty("src")
|
437
|
-
srcdoc = JSProperty("srcdoc")
|
438
|
-
width = JSProperty("width")
|
439
|
-
|
440
|
-
|
441
|
-
class img(ElementBase):
|
442
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img"""
|
443
|
-
|
444
|
-
tag = "img"
|
445
|
-
|
446
|
-
alt = JSProperty("alt")
|
447
|
-
crossorigin = JSProperty("crossorigin")
|
448
|
-
decoding = JSProperty("decoding")
|
449
|
-
fetchpriority = JSProperty("fetchpriority")
|
450
|
-
height = JSProperty("height")
|
451
|
-
ismap = JSProperty("ismap")
|
452
|
-
loading = JSProperty("loading")
|
453
|
-
referrerpolicy = JSProperty("referrerpolicy")
|
454
|
-
sizes = JSProperty("sizes")
|
455
|
-
src = JSProperty("src")
|
456
|
-
width = JSProperty("width")
|
457
|
-
|
458
|
-
|
459
|
-
# NOTE: Input is a reserved keyword in Python, so we use input_ instead
|
460
|
-
class input_(ElementBase):
|
461
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input"""
|
462
|
-
|
463
|
-
tag = "input"
|
464
|
-
|
465
|
-
accept = JSProperty("accept")
|
466
|
-
alt = JSProperty("alt")
|
467
|
-
autofocus = JSProperty("autofocus")
|
468
|
-
capture = JSProperty("capture")
|
469
|
-
checked = JSProperty("checked")
|
470
|
-
dirname = JSProperty("dirname")
|
471
|
-
disabled = JSProperty("disabled")
|
472
|
-
form = JSProperty("form")
|
473
|
-
formaction = JSProperty("formaction")
|
474
|
-
formenctype = JSProperty("formenctype")
|
475
|
-
formmethod = JSProperty("formmethod")
|
476
|
-
formnovalidate = JSProperty("formnovalidate")
|
477
|
-
formtarget = JSProperty("formtarget")
|
478
|
-
height = JSProperty("height")
|
479
|
-
list = JSProperty("list")
|
480
|
-
max = JSProperty("max")
|
481
|
-
maxlength = JSProperty("maxlength")
|
482
|
-
min = JSProperty("min")
|
483
|
-
minlength = JSProperty("minlength")
|
484
|
-
multiple = JSProperty("multiple")
|
485
|
-
name = JSProperty("name")
|
486
|
-
pattern = JSProperty("pattern")
|
487
|
-
placeholder = JSProperty("placeholder")
|
488
|
-
popovertarget = JSProperty("popovertarget")
|
489
|
-
popovertargetaction = JSProperty("popovertargetaction")
|
490
|
-
readonly = JSProperty("readonly")
|
491
|
-
required = JSProperty("required")
|
492
|
-
size = JSProperty("size")
|
493
|
-
src = JSProperty("src")
|
494
|
-
step = JSProperty("step")
|
495
|
-
type = JSProperty("type")
|
496
|
-
value = JSProperty("value")
|
497
|
-
width = JSProperty("width")
|
498
|
-
|
499
|
-
|
500
|
-
class ins(TextElementBase):
|
501
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ins"""
|
502
|
-
|
503
|
-
tag = "ins"
|
504
|
-
|
505
|
-
cite = JSProperty("cite")
|
506
|
-
datetime = JSProperty("datetime")
|
507
|
-
|
508
|
-
|
509
|
-
class kbd(TextElementBase):
|
510
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd"""
|
511
|
-
|
512
|
-
tag = "kbd"
|
513
|
-
|
514
|
-
|
515
|
-
class label(TextElementBase):
|
516
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label"""
|
517
|
-
|
518
|
-
tag = "label"
|
519
|
-
|
520
|
-
for_ = JSProperty("for")
|
521
|
-
|
522
|
-
|
523
|
-
class legend(TextElementBase):
|
524
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend"""
|
525
|
-
|
526
|
-
tag = "legend"
|
527
|
-
|
528
|
-
|
529
|
-
class li(TextElementBase):
|
530
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li"""
|
531
|
-
|
532
|
-
tag = "li"
|
533
|
-
|
534
|
-
value = JSProperty("value")
|
535
|
-
|
536
|
-
|
537
|
-
class link(TextElementBase):
|
538
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link"""
|
539
|
-
|
540
|
-
tag = "link"
|
541
|
-
|
542
|
-
as_ = JSProperty("as")
|
543
|
-
crossorigin = JSProperty("crossorigin")
|
544
|
-
disabled = JSProperty("disabled")
|
545
|
-
fetchpriority = JSProperty("fetchpriority")
|
546
|
-
href = JSProperty("href")
|
547
|
-
imagesizes = JSProperty("imagesizes")
|
548
|
-
imagesrcset = JSProperty("imagesrcset")
|
549
|
-
integrity = JSProperty("integrity")
|
550
|
-
media = JSProperty("media")
|
551
|
-
rel = JSProperty("rel")
|
552
|
-
referrerpolicy = JSProperty("referrerpolicy")
|
553
|
-
sizes = JSProperty("sizes")
|
554
|
-
title = JSProperty("title")
|
555
|
-
type = JSProperty("type")
|
556
|
-
|
557
|
-
|
558
|
-
class main(TextElementBase):
|
559
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main"""
|
560
|
-
|
561
|
-
tag = "main"
|
562
|
-
|
563
|
-
|
564
|
-
class map_(TextElementBase):
|
565
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/map"""
|
566
|
-
|
567
|
-
tag = "map"
|
568
|
-
|
569
|
-
name = JSProperty("name")
|
570
|
-
|
571
|
-
|
572
|
-
class mark(TextElementBase):
|
573
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark"""
|
574
|
-
|
575
|
-
tag = "mark"
|
576
|
-
|
577
|
-
|
578
|
-
class menu(TextElementBase):
|
579
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menu"""
|
580
|
-
|
581
|
-
tag = "menu"
|
582
|
-
|
583
|
-
|
584
|
-
class meter(TextElementBase):
|
585
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meter"""
|
586
|
-
|
587
|
-
tag = "meter"
|
588
|
-
|
589
|
-
form = JSProperty("form")
|
590
|
-
high = JSProperty("high")
|
591
|
-
low = JSProperty("low")
|
592
|
-
max = JSProperty("max")
|
593
|
-
min = JSProperty("min")
|
594
|
-
optimum = JSProperty("optimum")
|
595
|
-
value = JSProperty("value")
|
596
|
-
|
597
|
-
|
598
|
-
class nav(TextElementBase):
|
599
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/nav"""
|
600
|
-
|
601
|
-
tag = "nav"
|
602
|
-
|
603
|
-
|
604
|
-
class object_(TextElementBase):
|
605
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object"""
|
606
|
-
|
607
|
-
tag = "object"
|
608
|
-
|
609
|
-
data = JSProperty("data")
|
610
|
-
form = JSProperty("form")
|
611
|
-
height = JSProperty("height")
|
612
|
-
name = JSProperty("name")
|
613
|
-
type = JSProperty("type")
|
614
|
-
usemap = JSProperty("usemap")
|
615
|
-
width = JSProperty("width")
|
616
|
-
|
617
|
-
|
618
|
-
class ol(TextElementBase):
|
619
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol"""
|
620
|
-
|
621
|
-
tag = "ol"
|
622
|
-
|
623
|
-
reversed = JSProperty("reversed")
|
624
|
-
start = JSProperty("start")
|
625
|
-
type = JSProperty("type")
|
626
|
-
|
627
|
-
|
628
|
-
class optgroup(TextElementBase):
|
629
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup"""
|
630
|
-
|
631
|
-
tag = "optgroup"
|
632
|
-
|
633
|
-
disabled = JSProperty("disabled")
|
634
|
-
label = JSProperty("label")
|
635
|
-
|
636
|
-
|
637
|
-
class option(TextElementBase):
|
638
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option"""
|
639
|
-
|
640
|
-
tag = "option"
|
641
|
-
|
642
|
-
disabled = JSProperty("value")
|
643
|
-
label = JSProperty("label")
|
644
|
-
selected = JSProperty("selected")
|
645
|
-
value = JSProperty("value")
|
646
|
-
|
647
|
-
|
648
|
-
class output(TextElementBase):
|
649
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/output"""
|
650
|
-
|
651
|
-
tag = "output"
|
652
|
-
|
653
|
-
for_ = JSProperty("for")
|
654
|
-
form = JSProperty("form")
|
655
|
-
name = JSProperty("name")
|
656
|
-
|
657
|
-
|
658
|
-
class p(TextElementBase):
|
659
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p"""
|
660
|
-
|
661
|
-
tag = "p"
|
662
|
-
|
663
|
-
|
664
|
-
class picture(TextElementBase):
|
665
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture"""
|
666
|
-
|
667
|
-
tag = "picture"
|
668
|
-
|
669
|
-
|
670
|
-
class pre(TextElementBase):
|
671
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre"""
|
672
|
-
|
673
|
-
tag = "pre"
|
674
|
-
|
675
|
-
|
676
|
-
class progress(TextElementBase):
|
677
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress"""
|
678
|
-
|
679
|
-
tag = "progress"
|
680
|
-
|
681
|
-
max = JSProperty("max")
|
682
|
-
value = JSProperty("value")
|
683
|
-
|
684
|
-
|
685
|
-
class q(TextElementBase):
|
686
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q"""
|
687
|
-
|
688
|
-
tag = "q"
|
689
|
-
|
690
|
-
cite = JSProperty("cite")
|
691
|
-
|
692
|
-
|
693
|
-
class s(TextElementBase):
|
694
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/s"""
|
695
|
-
|
696
|
-
tag = "s"
|
697
|
-
|
698
|
-
|
699
|
-
class script(TextElementBase):
|
700
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script"""
|
701
|
-
|
702
|
-
tag = "script"
|
703
|
-
|
704
|
-
# Let's add async manually since it's a reserved keyword in Python
|
705
|
-
async_ = JSProperty("async")
|
706
|
-
blocking = JSProperty("blocking")
|
707
|
-
crossorigin = JSProperty("crossorigin")
|
708
|
-
defer = JSProperty("defer")
|
709
|
-
fetchpriority = JSProperty("fetchpriority")
|
710
|
-
integrity = JSProperty("integrity")
|
711
|
-
nomodule = JSProperty("nomodule")
|
712
|
-
nonce = JSProperty("nonce")
|
713
|
-
referrerpolicy = JSProperty("referrerpolicy")
|
714
|
-
src = JSProperty("src")
|
715
|
-
type = JSProperty("type")
|
716
|
-
|
717
|
-
|
718
|
-
class section(TextElementBase):
|
719
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section"""
|
720
|
-
|
721
|
-
tag = "section"
|
722
|
-
|
723
|
-
|
724
|
-
class select(TextElementBase):
|
725
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select"""
|
726
|
-
|
727
|
-
tag = "select"
|
728
|
-
|
729
|
-
|
730
|
-
class small(TextElementBase):
|
731
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/small"""
|
732
|
-
|
733
|
-
tag = "small"
|
734
|
-
|
735
|
-
|
736
|
-
class source(TextElementBase):
|
737
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source"""
|
738
|
-
|
739
|
-
tag = "source"
|
740
|
-
|
741
|
-
media = JSProperty("media")
|
742
|
-
sizes = JSProperty("sizes")
|
743
|
-
src = JSProperty("src")
|
744
|
-
srcset = JSProperty("srcset")
|
745
|
-
type = JSProperty("type")
|
746
|
-
|
747
|
-
|
748
|
-
class span(TextElementBase):
|
749
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span"""
|
750
|
-
|
751
|
-
tag = "span"
|
752
|
-
|
753
|
-
|
754
|
-
class strong(TextElementBase):
|
755
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong"""
|
756
|
-
|
757
|
-
tag = "strong"
|
758
|
-
|
759
|
-
|
760
|
-
class style(TextElementBase):
|
761
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style"""
|
762
|
-
|
763
|
-
tag = "style"
|
764
|
-
|
765
|
-
blocking = JSProperty("blocking")
|
766
|
-
media = JSProperty("media")
|
767
|
-
nonce = JSProperty("nonce")
|
768
|
-
title = JSProperty("title")
|
769
|
-
|
770
|
-
|
771
|
-
class sub(TextElementBase):
|
772
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub"""
|
773
|
-
|
774
|
-
tag = "sub"
|
775
|
-
|
776
|
-
|
777
|
-
class summary(TextElementBase):
|
778
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary"""
|
779
|
-
|
780
|
-
tag = "summary"
|
781
|
-
|
782
|
-
|
783
|
-
class sup(TextElementBase):
|
784
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup"""
|
785
|
-
|
786
|
-
tag = "sup"
|
787
|
-
|
788
|
-
|
789
|
-
class table(TextElementBase):
|
790
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table"""
|
791
|
-
|
792
|
-
tag = "table"
|
793
|
-
|
794
|
-
|
795
|
-
class tbody(TextElementBase):
|
796
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody"""
|
797
|
-
|
798
|
-
tag = "tbody"
|
799
|
-
|
800
|
-
|
801
|
-
class td(TextElementBase):
|
802
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td"""
|
803
|
-
|
804
|
-
tag = "td"
|
805
|
-
|
806
|
-
colspan = JSProperty("colspan")
|
807
|
-
headers = JSProperty("headers")
|
808
|
-
rowspan = JSProperty("rowspan")
|
809
|
-
|
810
|
-
|
811
|
-
class template(TextElementBase):
|
812
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template"""
|
813
|
-
|
814
|
-
tag = "template"
|
815
|
-
|
816
|
-
shadowrootmode = JSProperty("shadowrootmode")
|
817
|
-
|
818
|
-
|
819
|
-
class textarea(TextElementBase):
|
820
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea"""
|
821
|
-
|
822
|
-
tag = "textarea"
|
823
|
-
|
824
|
-
autocapitalize = JSProperty("autocapitalize")
|
825
|
-
autocomplete = JSProperty("autocomplete")
|
826
|
-
autofocus = JSProperty("autofocus")
|
827
|
-
cols = JSProperty("cols")
|
828
|
-
dirname = JSProperty("dirname")
|
829
|
-
disabled = JSProperty("disabled")
|
830
|
-
form = JSProperty("form")
|
831
|
-
maxlength = JSProperty("maxlength")
|
832
|
-
minlength = JSProperty("minlength")
|
833
|
-
name = JSProperty("name")
|
834
|
-
placeholder = JSProperty("placeholder")
|
835
|
-
readonly = JSProperty("readonly")
|
836
|
-
required = JSProperty("required")
|
837
|
-
rows = JSProperty("rows")
|
838
|
-
spellcheck = JSProperty("spellcheck")
|
839
|
-
wrap = JSProperty("wrap")
|
840
|
-
|
841
|
-
|
842
|
-
class tfoot(TextElementBase):
|
843
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot"""
|
844
|
-
|
845
|
-
tag = "tfoot"
|
846
|
-
|
847
|
-
|
848
|
-
class th(TextElementBase):
|
849
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th"""
|
850
|
-
|
851
|
-
tag = "th"
|
852
|
-
|
853
|
-
|
854
|
-
class thead(TextElementBase):
|
855
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead"""
|
856
|
-
|
857
|
-
tag = "thead"
|
858
|
-
|
859
|
-
|
860
|
-
class time(TextElementBase):
|
861
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time"""
|
862
|
-
|
863
|
-
tag = "time"
|
864
|
-
|
865
|
-
datetime = JSProperty("datetime")
|
866
|
-
|
867
|
-
|
868
|
-
class title(TextElementBase):
|
869
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title"""
|
870
|
-
|
871
|
-
tag = "title"
|
872
|
-
|
873
|
-
|
874
|
-
class tr(TextElementBase):
|
875
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr"""
|
876
|
-
|
877
|
-
tag = "tr"
|
878
|
-
|
879
|
-
abbr = JSProperty("abbr")
|
880
|
-
colspan = JSProperty("colspan")
|
881
|
-
headers = JSProperty("headers")
|
882
|
-
rowspan = JSProperty("rowspan")
|
883
|
-
scope = JSProperty("scope")
|
884
|
-
|
885
|
-
|
886
|
-
class track(TextElementBase):
|
887
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track"""
|
888
|
-
|
889
|
-
tag = "track"
|
890
|
-
|
891
|
-
default = JSProperty("default")
|
892
|
-
kind = JSProperty("kind")
|
893
|
-
label = JSProperty("label")
|
894
|
-
src = JSProperty("src")
|
895
|
-
srclang = JSProperty("srclang")
|
896
|
-
|
897
|
-
|
898
|
-
class u(TextElementBase):
|
899
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/u"""
|
900
|
-
|
901
|
-
tag = "u"
|
902
|
-
|
903
|
-
|
904
|
-
class ul(TextElementBase):
|
905
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul"""
|
906
|
-
|
907
|
-
tag = "ul"
|
908
|
-
|
909
|
-
|
910
|
-
class var(TextElementBase):
|
911
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/var"""
|
912
|
-
|
913
|
-
tag = "var"
|
914
|
-
|
915
|
-
|
916
|
-
class video(TextElementBase):
|
917
|
-
"""Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video"""
|
918
|
-
|
919
|
-
tag = "video"
|
920
|
-
|
921
|
-
autoplay = JSProperty("autoplay")
|
922
|
-
controls = JSProperty("controls")
|
923
|
-
crossorigin = JSProperty("crossorigin")
|
924
|
-
disablepictureinpicture = JSProperty("disablepictureinpicture")
|
925
|
-
disableremoteplayback = JSProperty("disableremoteplayback")
|
926
|
-
height = JSProperty("height")
|
927
|
-
loop = JSProperty("loop")
|
928
|
-
muted = JSProperty("muted")
|
929
|
-
playsinline = JSProperty("playsinline")
|
930
|
-
poster = JSProperty("poster")
|
931
|
-
preload = JSProperty("preload")
|
932
|
-
src = JSProperty("src")
|
933
|
-
width = JSProperty("width")
|
934
|
-
|
935
|
-
|
936
|
-
# Custom Elements
|
937
|
-
class grid(TextElementBase):
|
938
|
-
tag = "div"
|
939
|
-
|
940
|
-
def __init__(self, layout, content=None, gap=None, **kwargs):
|
941
|
-
super().__init__(content, **kwargs)
|
942
|
-
self.style["display"] = "grid"
|
943
|
-
self.style["grid-template-columns"] = layout
|
944
|
-
|
945
|
-
# TODO: This should be a property
|
946
|
-
if not gap is None:
|
947
|
-
self.style["gap"] = gap
|