Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert #841 #919

Merged
merged 19 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/ambv/black
rev: 22.6.0
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.6.3
rev: 5.12.0
hooks:
- id: isort
name: isort
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.5.1"
rev: v2.7.1
hooks:
rmorshea marked this conversation as resolved.
Show resolved Hide resolved
- id: prettier
2 changes: 1 addition & 1 deletion docs/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def Wrapper():
def PrintView():
text, set_text = idom.hooks.use_state(print_buffer.getvalue())
print_buffer.set_callback(set_text)
return idom.html.pre(text, class_name="printout") if text else idom.html.div()
return idom.html.pre({"class": "printout"}, text) if text else idom.html.div()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"class" needs a revert to "class_name". Also confirm throughout the docs we aren't missing any of those situations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return idom.html.pre({"class": "printout"}, text) if text else idom.html.div()
return idom.html.pre({"class_name": "printout"}, text) if text else idom.html.div()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to still be unresolved?


return Wrapper()

Expand Down
16 changes: 13 additions & 3 deletions docs/source/_custom_js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions docs/source/_exts/custom_autosectionlabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

from fnmatch import fnmatch
from typing import Any, cast
from typing import Any, Dict, cast

from docutils import nodes
from docutils.nodes import Node
Expand All @@ -30,6 +30,7 @@ def get_node_depth(node: Node) -> int:

def register_sections_as_label(app: Sphinx, document: Node) -> None:
docname = app.env.docname
print(docname)
Copy link
Contributor

@Archmonger Archmonger Feb 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded print?


for pattern in app.config.autosectionlabel_skip_docs:
if fnmatch(docname, pattern):
Expand Down Expand Up @@ -66,7 +67,7 @@ def register_sections_as_label(app: Sphinx, document: Node) -> None:
domain.labels[name] = docname, labelid, sectname


def setup(app: Sphinx) -> dict[str, Any]:
def setup(app: Sphinx) -> Dict[str, Any]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use typing.Dict here.

app.add_config_value("autosectionlabel_prefix_document", False, "env")
app.add_config_value("autosectionlabel_maxdepth", None, "env")
app.add_config_value("autosectionlabel_skip_docs", [], "env")
Expand Down
10 changes: 9 additions & 1 deletion docs/source/about/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ more info, see the :ref:`Contributor Guide <Creating a Changelog Entry>`.
Unreleased
----------

No changes.
**Changed**

- :pull:`919` - Reverts :pull:`841` as per the conclusion in :discussion:`916`. but
preserves the ability to declare attributes with snake_case.

**Deprecated**

- :pull:`919` - Declaration of keys via keywork arguments in standard elements. A script
has been added to automatically convert old usages where possible.
rmorshea marked this conversation as resolved.
Show resolved Hide resolved


v1.0.0-a3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def handle_click(event):
url = sculpture["url"]

return html.div(
html.button("Next", on_click=handle_click),
html.button({"on_click": handle_click}, "Next"),
html.h2(name, " by ", artist),
html.p(f"({bounded_index + 1} of {len(sculpture_data)})"),
html.img(src=url, alt=alt, style={"height": "200px"}),
html.img({"src": url, "alt": alt, "style": {"height": "200px"}}),
html.p(description),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ def handle_more_click(event):
url = sculpture["url"]

return html.div(
html.button("Next", on_click=handle_next_click),
html.button({"on_click": handle_next_click}, "Next"),
html.h2(name, " by ", artist),
html.p(f"({bounded_index + 1} or {len(sculpture_data)})"),
html.img(src=url, alt=alt, style={"height": "200px"}),
html.img({"src": url, "alt": alt, "style": {"height": "200px"}}),
html.div(
html.button(
{"on_click": handle_more_click},
f"{('Show' if show_more else 'Hide')} details",
on_click=handle_more_click,
),
(html.p(description) if show_more else ""),
),
Expand All @@ -46,8 +46,8 @@ def handle_more_click(event):
@component
def App():
return html.div(
html.section(Gallery(), style={"width": "50%", "float": "left"}),
html.section(Gallery(), style={"width": "50%", "float": "left"}),
html.section({"style": {"width": "50%", "float": "left"}}, Gallery()),
html.section({"style": {"width": "50%", "float": "left"}}, Gallery()),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ def handle_more_click(event):
url = sculpture["url"]

return html.div(
html.button("Next", on_click=handle_next_click),
html.button({"on_click": handle_next_click}, "Next"),
html.h2(name, " by ", artist),
html.p(f"({bounded_index + 1} or {len(sculpture_data)})"),
html.img(src=url, alt=alt, style={"height": "200px"}),
html.img({"src": url, "alt": alt, "style": {"height": "200px"}}),
html.div(
html.button(
{"on_click": handle_more_click},
f"{('Show' if show_more else 'Hide')} details",
on_click=handle_more_click,
),
(html.p(description) if show_more else ""),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def handle_click(event):
url = sculpture["url"]

return html.div(
html.button("Next", on_click=handle_click),
html.button({"on_click": handle_click}, "Next"),
html.h2(name, " by ", artist),
html.p(f"({bounded_index + 1} or {len(sculpture_data)})"),
html.img(src=url, alt=alt, style={"height": "200px"}),
html.img({"src": url, "alt": alt, "style": {"height": "200px"}}),
html.p(description),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,29 @@ def handle_click(event):
return handle_click

return html.div(
html.button("add term", on_click=handle_add_click),
html.button({"on_click": handle_add_click}, "add term"),
html.label(
"Term: ",
html.input(value=term_to_add, on_change=handle_term_to_add_change),
html.input({"value": term_to_add, "on_change": handle_term_to_add_change}),
),
html.label(
"Definition: ",
html.input(
value=definition_to_add, on_change=handle_definition_to_add_change
{
"value": definition_to_add,
"on_change": handle_definition_to_add_change,
}
),
),
html.hr(),
[
html.div(
html.button("delete term", on_click=make_delete_click_handler(term)),
{"key": term},
html.button(
{"on_click": make_delete_click_handler(term)}, "delete term"
),
html.dt(term),
html.dd(definition),
key=term,
)
for term, definition in all_terms.items()
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@ def handle_email_change(event):
return html.div(
html.label(
"First name: ",
html.input(value=person["first_name"], on_change=handle_first_name_change),
html.input(
{"value": person["first_name"], "on_change": handle_first_name_change}
),
),
html.label(
"Last name: ",
html.input(value=person["last_name"], on_change=handle_last_name_change),
html.input(
{"value": person["last_name"], "on_change": handle_last_name_change}
),
),
html.label(
"Email: ",
html.input(value=person["email"], on_change=handle_email_change),
html.input({"value": person["email"], "on_change": handle_email_change}),
),
html.p(f"{person['first_name']} {person['last_name']} {person['email']}"),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def handle_click(event):

return html.div(
html.h1("Inspiring sculptors:"),
html.input(value=artist_to_add, on_change=handle_change),
html.button("add", on_click=handle_click),
html.ul([html.li(name, key=name) for name in artists]),
html.input({"value": artist_to_add, "on_change": handle_change}),
html.button({"on_click": handle_click}, "add"),
html.ul([html.li({"key": name}, name) for name in artists]),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def handle_reverse_click(event):

return html.div(
html.h1("Inspiring sculptors:"),
html.button("sort", on_click=handle_sort_click),
html.button("reverse", on_click=handle_reverse_click),
html.ul([html.li(name, key=name) for name in artists]),
html.button({"on_click": handle_sort_click}, "sort"),
html.button({"on_click": handle_reverse_click}, "reverse"),
html.ul([html.li({"key": name}, name) for name in artists]),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ def handle_click(event):

return html.div(
html.h1("Inspiring sculptors:"),
html.input(value=artist_to_add, on_change=handle_change),
html.button("add", on_click=handle_add_click),
html.input({"value": artist_to_add, "on_change": handle_change}),
html.button({"on_click": handle_add_click}, "add"),
html.ul(
[
html.li(
{"key": name},
name,
html.button("delete", on_click=make_handle_delete_click(index)),
key=name,
html.button(
{"on_click": make_handle_delete_click(index)}, "delete"
),
)
for index, name in enumerate(artists)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def handle_click(event):
return html.ul(
[
html.li(
{"key": index},
count,
html.button("+1", on_click=make_increment_click_handler(index)),
key=index,
html.button({"on_click": make_increment_click_handler(index)}, "+1"),
)
for index, count in enumerate(counters)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,29 @@ async def handle_pointer_move(event):
)

return html.div(
{
"on_pointer_move": handle_pointer_move,
"style": {
"position": "relative",
"height": "200px",
"width": "100%",
"backgroundColor": "white",
},
},
html.div(
style={
"position": "absolute",
"background_color": "red",
"border_radius": "50%",
"width": "20px",
"height": "20px",
"left": "-10px",
"top": "-10px",
"transform": f"translate({position['x']}px, {position['y']}px)",
{
"style": {
"position": "absolute",
"backgroundColor": "red",
"borderRadius": "50%",
"width": "20px",
"height": "20px",
"left": "-10px",
"top": "-10px",
"transform": f"translate({position['x']}px, {position['y']}px)",
}
}
),
on_pointer_move=handle_pointer_move,
style={
"position": "relative",
"height": "200px",
"width": "100%",
"background_color": "white",
},
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,29 @@ def handle_pointer_move(event):
position["y"] = event["clientY"] - outer_div_bounds["y"]

return html.div(
{
"on_pointer_move": handle_pointer_move,
"style": {
"position": "relative",
"height": "200px",
"width": "100%",
"backgroundColor": "white",
},
},
html.div(
style={
"position": "absolute",
"background_color": "red",
"border_radius": "50%",
"width": "20px",
"height": "20px",
"left": "-10px",
"top": "-10px",
"transform": f"translate({position['x']}px, {position['y']}px)",
{
"style": {
"position": "absolute",
"backgroundColor": "red",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we convert styles to snake_case?

"borderRadius": "50%",
"width": "20px",
"height": "20px",
"left": "-10px",
"top": "-10px",
"transform": f"translate({position['x']}px, {position['y']}px)",
}
}
),
on_pointer_move=handle_pointer_move,
style={
"position": "relative",
"height": "200px",
"width": "100%",
"background_color": "white",
},
)


Expand Down
Loading