You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,9 @@ Using the following categories, list your changes in this order:
36
36
37
37
### Added
38
38
39
-
- Client-side Python components can now be rendered via the new `pyscript_component` template tag
39
+
- Client-side Python components can now be rendered via the new `{% pyscript_component %}` template tag
40
+
- PyScript's can be made accessible for an existing page using the `{% pyscript_setup %}` template tag
41
+
- This tag can also be used to load additional dependencies, or change the default PyScript configuration.
40
42
- Client-side components can be embedded into existing server-side components via `reactpy_django.components.pyscript_component`.
41
43
- You can now write Python code that runs within client browser via the `reactpy_django.html.pyscript` element. This is a viable substitution for most JavaScript code.
Copy file name to clipboardExpand all lines: docs/src/reference/router.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ URL router that enables the ability to conditionally render other components bas
20
20
21
21
!!! warning "Pitfall"
22
22
23
-
All pages where this component exists must have the same, or more permissive exposure within Django's [URL patterns](https://docs.djangoproject.com/en/5.0/topics/http/urls/#example). You can think of this component as a secondary, client-side router. Django still handles the primary server-side routes.
23
+
All pages where `django_router` is used must have the same, or more permissive URL exposure within Django's [URL patterns](https://docs.djangoproject.com/en/5.0/topics/http/urls/#example). You can think of this component as a secondary, client-side router. Django still handles the primary server-side routes.
24
24
25
25
We recommend creating a route with a wildcard `.*` to forward routes to ReactPy. For example...
Copy file name to clipboardExpand all lines: docs/src/reference/template-tag.md
+5-3
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Each component loaded via this template tag will receive a dedicated WebSocket c
39
39
40
40
The ReactPy component finder requires that your component path is a string.
41
41
42
-
**Do not** use Django template/context variables for the component path. Failure to follow this warning will result in components that will not render.
42
+
**Do not** use Django template/context variables for the component path. Failure to follow this warning will result in render failures.
43
43
44
44
For example, **do not** do the following:
45
45
@@ -157,7 +157,7 @@ This template tag can be used to insert any number of **client-side** ReactPy co
157
157
158
158
<!--pyscript-def-start-->
159
159
160
-
By default, the only dependencies available are the standard Python library, `pyscript`, `pyodide`, `reactpy` core.
160
+
By default, the only dependencies available are the Python standard library, `pyscript`, `pyodide`, `reactpy` core.
161
161
162
162
Your PyScript component file requires a `#!python def root()` component to function as the entry point.
163
163
@@ -197,6 +197,8 @@ Your PyScript component file requires a `#!python def root()` component to funct
197
197
198
198
PyScript components have the ability to directly execute JavaScript using the [`pyodide` `js` module](https://pyodide.org/en/stable/usage/type-conversions.html#importing-javascript-objects-into-python) or [`pyscript` foreign function interface](https://docs.pyscript.net/2024.6.1/user-guide/dom/).
199
199
200
+
_The `#!python js` module has access to everything within the browser's JavaScript environment. Therefore, any public JavaScript functions loaded within your HTML `#!html <head>` can be called as well. However, be mindful of JavaScript load order!_
201
+
200
202
=== "root.py"
201
203
202
204
```python
@@ -279,7 +281,7 @@ Your PyScript component file requires a `#!python def root()` component to funct
279
281
280
282
## PyScript Setup
281
283
282
-
This template tag configures the current page to be able to run `pyscript` by loading JavaScript, CSS, and settings values.
284
+
This template tag configures the current page to be able to run `pyscript` by loading PyScript's static files.
283
285
284
286
You can optionally include a list of Python packages to install within the PyScript environment, or a [PyScript configuration dictionary](https://docs.pyscript.net/2024.6.1/user-guide/configuration/).
0 commit comments