Skip to content

Commit e8263de

Browse files
authored
Rewrite style props (#936)
* rewrite style prop + other fixes * apply rewrites * changelog * remove extra print * minor annotation improvement * fix class_name * more helpful error message * fix types * fix typo
1 parent 3aa249d commit e8263de

File tree

29 files changed

+157
-115
lines changed

29 files changed

+157
-115
lines changed

docs/examples.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ def Wrapper():
122122
def PrintView():
123123
text, set_text = idom.hooks.use_state(print_buffer.getvalue())
124124
print_buffer.set_callback(set_text)
125-
return idom.html.pre({"class": "printout"}, text) if text else idom.html.div()
125+
return (
126+
idom.html.pre({"class_name": "printout"}, text) if text else idom.html.div()
127+
)
126128

127129
return Wrapper()
128130

docs/source/_exts/custom_autosectionlabel.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
https://github.com/sphinx-doc/sphinx/blob/f9968594206e538f13fa1c27c065027f10d4ea27/LICENSE
55
"""
66

7+
from __future__ import annotations
8+
79
from fnmatch import fnmatch
8-
from typing import Any, Dict, cast
10+
from typing import Any, cast
911

1012
from docutils import nodes
1113
from docutils.nodes import Node
@@ -30,7 +32,6 @@ def get_node_depth(node: Node) -> int:
3032

3133
def register_sections_as_label(app: Sphinx, document: Node) -> None:
3234
docname = app.env.docname
33-
print(docname)
3435

3536
for pattern in app.config.autosectionlabel_skip_docs:
3637
if fnmatch(docname, pattern):
@@ -67,7 +68,7 @@ def register_sections_as_label(app: Sphinx, document: Node) -> None:
6768
domain.labels[name] = docname, labelid, sectname
6869

6970

70-
def setup(app: Sphinx) -> Dict[str, Any]:
71+
def setup(app: Sphinx) -> dict[str, Any]:
7172
app.add_config_value("autosectionlabel_prefix_document", False, "env")
7273
app.add_config_value("autosectionlabel_maxdepth", None, "env")
7374
app.add_config_value("autosectionlabel_skip_docs", [], "env")

docs/source/about/changelog.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ more info, see the :ref:`Contributor Guide <Creating a Changelog Entry>`.
2323
Unreleased
2424
----------
2525

26-
No changes.
26+
**Fixed**
27+
28+
- :pull:`936` - remaining issues from :pull:`934`
2729

2830

2931
v1.0.0-a5

docs/source/guides/adding-interactivity/dangers-of-mutability/_examples/moving_dot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ async def handle_pointer_move(event):
2222
"position": "relative",
2323
"height": "200px",
2424
"width": "100%",
25-
"backgroundColor": "white",
25+
"background_color": "white",
2626
},
2727
},
2828
html.div(
2929
{
3030
"style": {
3131
"position": "absolute",
32-
"backgroundColor": "red",
33-
"borderRadius": "50%",
32+
"background_color": "red",
33+
"border_radius": "50%",
3434
"width": "20px",
3535
"height": "20px",
3636
"left": "-10px",

docs/source/guides/adding-interactivity/dangers-of-mutability/_examples/moving_dot_broken.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ def handle_pointer_move(event):
2020
"position": "relative",
2121
"height": "200px",
2222
"width": "100%",
23-
"backgroundColor": "white",
23+
"background_color": "white",
2424
},
2525
},
2626
html.div(
2727
{
2828
"style": {
2929
"position": "absolute",
30-
"backgroundColor": "red",
31-
"borderRadius": "50%",
30+
"background_color": "red",
31+
"border_radius": "50%",
3232
"width": "20px",
3333
"height": "20px",
3434
"left": "-10px",

docs/source/guides/adding-interactivity/dangers-of-mutability/_examples/set_remove.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def handle_click(event):
2424
"style": {
2525
"height": "30px",
2626
"width": "30px",
27-
"backgroundColor": "black"
27+
"background_color": "black"
2828
if index in selected_indices
2929
else "white",
3030
"outline": "1px solid grey",

docs/source/guides/adding-interactivity/dangers-of-mutability/_examples/set_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def handle_click(event):
2121
"style": {
2222
"height": "30px",
2323
"width": "30px",
24-
"backgroundColor": "black"
24+
"background_color": "black"
2525
if index in selected_indices
2626
else "white",
2727
"outline": "1px solid grey",

docs/source/guides/adding-interactivity/multiple-state-updates/_examples/set_color_3_times.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ def handle_reset(event):
1515

1616
return html.div(
1717
html.button(
18-
{"on_click": handle_click, "style": {"backgroundColor": color}}, "Set Color"
18+
{"on_click": handle_click, "style": {"background_color": color}},
19+
"Set Color",
1920
),
2021
html.button(
21-
{"on_click": handle_reset, "style": {"backgroundColor": color}}, "Reset"
22+
{"on_click": handle_reset, "style": {"background_color": color}}, "Reset"
2223
),
2324
)
2425

docs/source/guides/adding-interactivity/responding-to-events/_examples/audio_player.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def PlayDinosaurSound():
1010
idom.html.audio(
1111
{
1212
"controls": True,
13-
"onTimeUpdate": lambda e: set_event(e),
13+
"on_time_update": lambda e: set_event(e),
1414
"src": "https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3",
1515
}
1616
),

docs/source/guides/adding-interactivity/responding-to-events/_examples/stop_event_propagation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ def DivInDiv():
1010
div_in_div = html.div(
1111
{
1212
"on_click": lambda event: set_outer_count(outer_count + 1),
13-
"style": {"height": "100px", "width": "100px", "backgroundColor": "red"},
13+
"style": {"height": "100px", "width": "100px", "background_color": "red"},
1414
},
1515
html.div(
1616
{
1717
"on_click": event(
1818
lambda event: set_inner_count(inner_count + 1),
1919
stop_propagation=stop_propagatation,
2020
),
21-
"style": {"height": "50px", "width": "50px", "backgroundColor": "blue"},
21+
"style": {
22+
"height": "50px",
23+
"width": "50px",
24+
"background_color": "blue",
25+
},
2226
}
2327
),
2428
)

0 commit comments

Comments
 (0)