Skip to content

Commit 8a23a05

Browse files
Regenerate tags to improve type safety
1 parent e9117a8 commit 8a23a05

File tree

2 files changed

+128
-20
lines changed

2 files changed

+128
-20
lines changed

meta/tags.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ textarea:
157157
placeholder: Placeholder text to use when the field is empty.
158158
disabled:
159159
doc: "Whether this option is disabled, meaning it cannot be selected, and will not be submitted with the form."
160-
type: "Optional[Literal['disabled']]"
160+
type: "Optional[bool]"
161161
maxlength: The maximum number of characters permitted in the textarea
162162
wrap:
163163
doc: How to perform word wrapping ("hard" or "soft")
@@ -172,7 +172,7 @@ option:
172172
doc: "Whether this option is the default selection within the `select` element"
173173
type: "Optional[bool]"
174174
disabled:
175-
doc: "Whether this option is disabled, meaning it cannot be selected, and will not be submitted with the form."
175+
doc: "Whether this option is disabled, meaning it cannot be selected."
176176
type: "Optional[bool]"
177177
value:
178178
doc: "The value to use if this option is selected when submitting the form"
@@ -184,4 +184,9 @@ select:
184184
doc: Whether the input is required to submit the form it is contained within.
185185
type: "Optional[bool]"
186186
name: The name to use for this value when submitting the form.
187-
187+
disabled:
188+
doc: "Whether this form element is disabled, meaning it cannot be selected, and will not be submitted with the form."
189+
type: "Optional[bool]"
190+
multiple:
191+
doc: "Whether multiple options can be simultaneously selected."
192+
type: "Optional[bool]"

pyhtml/__tags/generated.py

Lines changed: 120 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5209,48 +5209,62 @@ class option(Tag):
52095209
"""
52105210
Used to define an item contained in a select, an [<optgroup>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup), or a [<datalist>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist) element. As such, `<option>` can represent menu items in popups and other lists of items in an HTML document.
52115211
5212-
5212+
* `selected`: Whether this option is the default selection within the `select` element
5213+
* `disabled`: Whether this option is disabled, meaning it cannot be selected.
5214+
* `value`: The value to use if this option is selected when submitting the form
52135215
52145216
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
52155217
"""
52165218
def __init__(
52175219
self,
52185220
*children: ChildrenType,
5219-
5221+
selected: Optional[bool] = None,
5222+
disabled: Optional[bool] = None,
5223+
value: AttributeType = None,
52205224
**attributes: AttributeType,
52215225
) -> None:
52225226
"""
52235227
Used to define an item contained in a select, an [<optgroup>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup), or a [<datalist>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist) element. As such, `<option>` can represent menu items in popups and other lists of items in an HTML document.
52245228
5225-
5229+
* `selected`: Whether this option is the default selection within the `select` element
5230+
* `disabled`: Whether this option is disabled, meaning it cannot be selected.
5231+
* `value`: The value to use if this option is selected when submitting the form
52265232
52275233
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
52285234
"""
52295235
attributes |= {
5230-
5236+
'selected': selected,
5237+
'disabled': disabled,
5238+
'value': value,
52315239
}
52325240
super().__init__(*children, **attributes)
52335241

52345242
def __call__( # type: ignore
52355243
self,
52365244
*children: ChildrenType,
5237-
5245+
selected: Optional[bool] = None,
5246+
disabled: Optional[bool] = None,
5247+
value: AttributeType = None,
52385248
**attributes: AttributeType,
52395249
):
52405250
"""
52415251
Used to define an item contained in a select, an [<optgroup>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup), or a [<datalist>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist) element. As such, `<option>` can represent menu items in popups and other lists of items in an HTML document.
52425252
5243-
5253+
* `selected`: Whether this option is the default selection within the `select` element
5254+
* `disabled`: Whether this option is disabled, meaning it cannot be selected.
5255+
* `value`: The value to use if this option is selected when submitting the form
52445256
52455257
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
52465258
"""
52475259
attributes |= {
5248-
5260+
'selected': selected,
5261+
'disabled': disabled,
5262+
'value': value,
52495263
}
52505264
return super().__call__(*children, **attributes)
52515265

52525266
def _get_default_attributes(self, given: dict[str, AttributeType]) -> dict[str, AttributeType]:
5253-
return {}
5267+
return {'selected': None, 'disabled': None, 'value': None}
52545268

52555269

52565270
class output(Tag):
@@ -5353,62 +5367,111 @@ class select(Tag):
53535367
"""
53545368
Represents a control that provides a menu of options.
53555369
5356-
5370+
* `required`: Whether the input is required to submit the form it is contained within.
5371+
* `name`: The name to use for this value when submitting the form.
5372+
* `disabled`: Whether this form element is disabled, meaning it cannot be selected, and will not be submitted with the form.
5373+
* `multiple`: Whether multiple options can be simultaneously selected.
53575374
53585375
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select)
53595376
"""
53605377
def __init__(
53615378
self,
53625379
*children: ChildrenType,
5363-
5380+
required: Optional[bool] = None,
5381+
name: AttributeType = None,
5382+
disabled: Optional[bool] = None,
5383+
multiple: Optional[bool] = None,
5384+
id: Optional[str] = None,
5385+
_class: Optional[str] = None,
5386+
style: Optional[str] = None,
53645387
**attributes: AttributeType,
53655388
) -> None:
53665389
"""
53675390
Represents a control that provides a menu of options.
53685391
5369-
5392+
* `required`: Whether the input is required to submit the form it is contained within.
5393+
* `name`: The name to use for this value when submitting the form.
5394+
* `disabled`: Whether this form element is disabled, meaning it cannot be selected, and will not be submitted with the form.
5395+
* `multiple`: Whether multiple options can be simultaneously selected.
53705396
53715397
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select)
53725398
"""
53735399
attributes |= {
5374-
5400+
'_class': _class,
5401+
'id': id,
5402+
'style': style,
5403+
'required': required,
5404+
'name': name,
5405+
'disabled': disabled,
5406+
'multiple': multiple,
53755407
}
53765408
super().__init__(*children, **attributes)
53775409

53785410
def __call__( # type: ignore
53795411
self,
53805412
*children: ChildrenType,
5381-
5413+
required: Optional[bool] = None,
5414+
name: AttributeType = None,
5415+
disabled: Optional[bool] = None,
5416+
multiple: Optional[bool] = None,
5417+
id: Optional[str] = None,
5418+
_class: Optional[str] = None,
5419+
style: Optional[str] = None,
53825420
**attributes: AttributeType,
53835421
):
53845422
"""
53855423
Represents a control that provides a menu of options.
53865424
5387-
5425+
* `required`: Whether the input is required to submit the form it is contained within.
5426+
* `name`: The name to use for this value when submitting the form.
5427+
* `disabled`: Whether this form element is disabled, meaning it cannot be selected, and will not be submitted with the form.
5428+
* `multiple`: Whether multiple options can be simultaneously selected.
53885429
53895430
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select)
53905431
"""
53915432
attributes |= {
5392-
5433+
'_class': _class,
5434+
'id': id,
5435+
'style': style,
5436+
'required': required,
5437+
'name': name,
5438+
'disabled': disabled,
5439+
'multiple': multiple,
53935440
}
53945441
return super().__call__(*children, **attributes)
53955442

53965443
def _get_default_attributes(self, given: dict[str, AttributeType]) -> dict[str, AttributeType]:
5397-
return {}
5444+
return {'required': None, 'name': None, 'disabled': None, 'multiple': None}
53985445

53995446

54005447
class textarea(Tag):
54015448
"""
54025449
Represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example, a comment on a review or feedback form.
54035450
54045451
* `required`: Whether the input is required to submit the form it is contained within.
5452+
* `name`: The name to use for this value when submitting the form.
5453+
* `rows`: The number of rows (lines) to use in the text area. Value should be an integer, but given as type `str`.
5454+
* `cols`: The number of columns (length of each line) to use in the text area. Value should be an integer, but given as type `str`.
5455+
* `placeholder`: Placeholder text to use when the field is empty.
5456+
* `disabled`: Whether this option is disabled, meaning it cannot be selected, and will not be submitted with the form.
5457+
* `maxlength`: The maximum number of characters permitted in the textarea
5458+
* `wrap`: How to perform word wrapping ("hard" or "soft")
5459+
* `readonly`: Whether this option is read-only, meaning it cannot be modified
54055460
54065461
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea)
54075462
"""
54085463
def __init__(
54095464
self,
54105465
*children: ChildrenType,
54115466
required: Optional[bool] = None,
5467+
name: AttributeType = None,
5468+
rows: Optional[str] = None,
5469+
cols: Optional[str] = None,
5470+
placeholder: AttributeType = None,
5471+
disabled: Optional[bool] = None,
5472+
maxlength: AttributeType = None,
5473+
wrap: Union[Literal['hard', 'soft'], None] = None,
5474+
readonly: Optional[bool] = None,
54125475
id: Optional[str] = None,
54135476
_class: Optional[str] = None,
54145477
style: Optional[str] = None,
@@ -5418,6 +5481,14 @@ def __init__(
54185481
Represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example, a comment on a review or feedback form.
54195482
54205483
* `required`: Whether the input is required to submit the form it is contained within.
5484+
* `name`: The name to use for this value when submitting the form.
5485+
* `rows`: The number of rows (lines) to use in the text area. Value should be an integer, but given as type `str`.
5486+
* `cols`: The number of columns (length of each line) to use in the text area. Value should be an integer, but given as type `str`.
5487+
* `placeholder`: Placeholder text to use when the field is empty.
5488+
* `disabled`: Whether this option is disabled, meaning it cannot be selected, and will not be submitted with the form.
5489+
* `maxlength`: The maximum number of characters permitted in the textarea
5490+
* `wrap`: How to perform word wrapping ("hard" or "soft")
5491+
* `readonly`: Whether this option is read-only, meaning it cannot be modified
54215492
54225493
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea)
54235494
"""
@@ -5426,13 +5497,29 @@ def __init__(
54265497
'id': id,
54275498
'style': style,
54285499
'required': required,
5500+
'name': name,
5501+
'rows': rows,
5502+
'cols': cols,
5503+
'placeholder': placeholder,
5504+
'disabled': disabled,
5505+
'maxlength': maxlength,
5506+
'wrap': wrap,
5507+
'readonly': readonly,
54295508
}
54305509
super().__init__(*children, **attributes)
54315510

54325511
def __call__( # type: ignore
54335512
self,
54345513
*children: ChildrenType,
54355514
required: Optional[bool] = None,
5515+
name: AttributeType = None,
5516+
rows: Optional[str] = None,
5517+
cols: Optional[str] = None,
5518+
placeholder: AttributeType = None,
5519+
disabled: Optional[bool] = None,
5520+
maxlength: AttributeType = None,
5521+
wrap: Union[Literal['hard', 'soft'], None] = None,
5522+
readonly: Optional[bool] = None,
54365523
id: Optional[str] = None,
54375524
_class: Optional[str] = None,
54385525
style: Optional[str] = None,
@@ -5442,6 +5529,14 @@ def __call__( # type: ignore
54425529
Represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example, a comment on a review or feedback form.
54435530
54445531
* `required`: Whether the input is required to submit the form it is contained within.
5532+
* `name`: The name to use for this value when submitting the form.
5533+
* `rows`: The number of rows (lines) to use in the text area. Value should be an integer, but given as type `str`.
5534+
* `cols`: The number of columns (length of each line) to use in the text area. Value should be an integer, but given as type `str`.
5535+
* `placeholder`: Placeholder text to use when the field is empty.
5536+
* `disabled`: Whether this option is disabled, meaning it cannot be selected, and will not be submitted with the form.
5537+
* `maxlength`: The maximum number of characters permitted in the textarea
5538+
* `wrap`: How to perform word wrapping ("hard" or "soft")
5539+
* `readonly`: Whether this option is read-only, meaning it cannot be modified
54455540
54465541
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea)
54475542
"""
@@ -5450,11 +5545,19 @@ def __call__( # type: ignore
54505545
'id': id,
54515546
'style': style,
54525547
'required': required,
5548+
'name': name,
5549+
'rows': rows,
5550+
'cols': cols,
5551+
'placeholder': placeholder,
5552+
'disabled': disabled,
5553+
'maxlength': maxlength,
5554+
'wrap': wrap,
5555+
'readonly': readonly,
54535556
}
54545557
return super().__call__(*children, **attributes)
54555558

54565559
def _get_default_attributes(self, given: dict[str, AttributeType]) -> dict[str, AttributeType]:
5457-
return {'required': None}
5560+
return {'required': None, 'name': None, 'rows': None, 'cols': None, 'placeholder': None, 'disabled': None, 'maxlength': None, 'wrap': None, 'readonly': None}
54585561

54595562

54605563
class details(Tag):

0 commit comments

Comments
 (0)