reactpy 2.0.0b4__py3-none-any.whl → 2.0.0b6__py3-none-any.whl

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.
Files changed (55) hide show
  1. reactpy/__init__.py +3 -2
  2. reactpy/_console/rewrite_props.py +2 -2
  3. reactpy/_html.py +11 -9
  4. reactpy/_option.py +2 -1
  5. reactpy/config.py +2 -2
  6. reactpy/core/_life_cycle_hook.py +12 -10
  7. reactpy/core/_thread_local.py +2 -1
  8. reactpy/core/component.py +4 -38
  9. reactpy/core/events.py +61 -36
  10. reactpy/core/hooks.py +25 -35
  11. reactpy/core/layout.py +193 -201
  12. reactpy/core/serve.py +17 -22
  13. reactpy/core/vdom.py +9 -12
  14. reactpy/executors/asgi/__init__.py +9 -4
  15. reactpy/executors/asgi/middleware.py +1 -2
  16. reactpy/executors/asgi/pyscript.py +3 -7
  17. reactpy/executors/asgi/standalone.py +4 -6
  18. reactpy/executors/asgi/types.py +2 -2
  19. reactpy/pyscript/components.py +3 -3
  20. reactpy/pyscript/utils.py +49 -46
  21. reactpy/reactjs/__init__.py +353 -0
  22. reactpy/reactjs/module.py +203 -0
  23. reactpy/reactjs/types.py +7 -0
  24. reactpy/reactjs/utils.py +183 -0
  25. reactpy/static/index-h31022cd.js +5 -0
  26. reactpy/static/index-h31022cd.js.map +11 -0
  27. reactpy/static/index-sbddj6ms.js +5 -0
  28. reactpy/static/index-sbddj6ms.js.map +10 -0
  29. reactpy/static/index-y71bxs88.js +5 -0
  30. reactpy/static/index-y71bxs88.js.map +10 -0
  31. reactpy/static/index.js +2 -2
  32. reactpy/static/index.js.map +6 -10
  33. reactpy/static/react-dom.js +4 -0
  34. reactpy/static/react-dom.js.map +11 -0
  35. reactpy/static/react-jsx-runtime.js +4 -0
  36. reactpy/static/react-jsx-runtime.js.map +9 -0
  37. reactpy/static/react.js +4 -0
  38. reactpy/static/react.js.map +10 -0
  39. reactpy/testing/backend.py +6 -5
  40. reactpy/testing/common.py +3 -5
  41. reactpy/testing/display.py +2 -1
  42. reactpy/testing/logs.py +1 -1
  43. reactpy/transforms.py +2 -2
  44. reactpy/types.py +117 -58
  45. reactpy/utils.py +8 -8
  46. reactpy/web/__init__.py +0 -6
  47. reactpy/web/module.py +37 -470
  48. reactpy/web/utils.py +2 -158
  49. reactpy/widgets.py +2 -2
  50. {reactpy-2.0.0b4.dist-info → reactpy-2.0.0b6.dist-info}/METADATA +4 -7
  51. {reactpy-2.0.0b4.dist-info → reactpy-2.0.0b6.dist-info}/RECORD +54 -39
  52. reactpy/web/templates/react.js +0 -61
  53. {reactpy-2.0.0b4.dist-info → reactpy-2.0.0b6.dist-info}/WHEEL +0 -0
  54. {reactpy-2.0.0b4.dist-info → reactpy-2.0.0b6.dist-info}/entry_points.txt +0 -0
  55. {reactpy-2.0.0b4.dist-info → reactpy-2.0.0b6.dist-info}/licenses/LICENSE +0 -0
reactpy/web/utils.py CHANGED
@@ -1,159 +1,3 @@
1
- import logging
2
- import re
3
- from pathlib import Path, PurePosixPath
4
- from urllib.parse import urlparse, urlunparse
5
-
6
- import requests
7
-
8
- logger = logging.getLogger(__name__)
9
-
10
-
11
- def module_name_suffix(name: str) -> str:
12
- if name.startswith("@"):
13
- name = name[1:]
14
- head, _, tail = name.partition("@") # handle version identifier
15
- _, _, tail = tail.partition("/") # get section after version
16
- return PurePosixPath(tail or head).suffix or ".js"
17
-
18
-
19
- def resolve_module_exports_from_file(
20
- file: Path,
21
- max_depth: int,
22
- is_re_export: bool = False,
23
- ) -> set[str]:
24
- if max_depth == 0:
25
- logger.warning(f"Did not resolve all exports for {file} - max depth reached")
26
- return set()
27
- elif not file.exists():
28
- logger.warning(f"Did not resolve exports for unknown file {file}")
29
- return set()
30
-
31
- export_names, references = resolve_module_exports_from_source(
32
- file.read_text(encoding="utf-8"), exclude_default=is_re_export
33
- )
34
-
35
- for ref in references:
36
- if urlparse(ref).scheme: # is an absolute URL
37
- export_names.update(
38
- resolve_module_exports_from_url(ref, max_depth - 1, is_re_export=True)
39
- )
40
- else:
41
- path = file.parent.joinpath(*ref.split("/"))
42
- export_names.update(
43
- resolve_module_exports_from_file(path, max_depth - 1, is_re_export=True)
44
- )
45
-
46
- return export_names
47
-
48
-
49
- def resolve_module_exports_from_url(
50
- url: str,
51
- max_depth: int,
52
- is_re_export: bool = False,
53
- ) -> set[str]:
54
- if max_depth == 0:
55
- logger.warning(f"Did not resolve all exports for {url} - max depth reached")
56
- return set()
57
-
58
- try:
59
- text = requests.get(url, timeout=5).text
60
- except requests.exceptions.ConnectionError as error:
61
- reason = "" if error is None else " - {error.errno}"
62
- logger.warning("Did not resolve exports for url " + url + reason)
63
- return set()
64
-
65
- export_names, references = resolve_module_exports_from_source(
66
- text, exclude_default=is_re_export
67
- )
68
-
69
- for ref in references:
70
- url = _resolve_relative_url(url, ref)
71
- export_names.update(
72
- resolve_module_exports_from_url(url, max_depth - 1, is_re_export=True)
73
- )
74
-
75
- return export_names
76
-
77
-
78
- def resolve_module_exports_from_source(
79
- content: str, exclude_default: bool
80
- ) -> tuple[set[str], set[str]]:
81
- names: set[str] = set()
82
- references: set[str] = set()
83
-
84
- if _JS_DEFAULT_EXPORT_PATTERN.search(content):
85
- names.add("default")
86
-
87
- # Exporting functions and classes
88
- names.update(_JS_FUNC_OR_CLS_EXPORT_PATTERN.findall(content))
89
-
90
- for export in _JS_GENERAL_EXPORT_PATTERN.findall(content):
91
- export = export.rstrip(";").strip()
92
- # Exporting individual features
93
- if export.startswith("let "):
94
- names.update(let.split("=", 1)[0] for let in export[4:].split(","))
95
- # Renaming exports and export list
96
- elif export.startswith("{") and export.endswith("}"):
97
- names.update(
98
- item.split(" as ", 1)[-1] for item in export.strip("{}").split(",")
99
- )
100
- # Exporting destructured assignments with renaming
101
- elif export.startswith("const "):
102
- names.update(
103
- item.split(":", 1)[0]
104
- for item in export[6:].split("=", 1)[0].strip("{}").split(",")
105
- )
106
- # Default exports
107
- elif export.startswith("default "):
108
- names.add("default")
109
- # Aggregating modules
110
- elif export.startswith("* as "):
111
- names.add(export[5:].split(" from ", 1)[0])
112
- elif export.startswith("* "):
113
- references.add(export[2:].split("from ", 1)[-1].strip("'\""))
114
- elif export.startswith("{") and " from " in export:
115
- names.update(
116
- item.split(" as ", 1)[-1]
117
- for item in export.split(" from ")[0].strip("{}").split(",")
118
- )
119
- elif not (export.startswith("function ") or export.startswith("class ")):
120
- logger.warning(f"Unknown export type {export!r}")
121
-
122
- names = {n.strip() for n in names}
123
- references = {r.strip() for r in references}
124
-
125
- if exclude_default and "default" in names:
126
- names.remove("default")
127
-
128
- return names, references
129
-
130
-
131
- def _resolve_relative_url(base_url: str, rel_url: str) -> str:
132
- if not rel_url.startswith("."):
133
- if rel_url.startswith("/"):
134
- # copy scheme and hostname from base_url
135
- return urlunparse(urlparse(base_url)[:2] + urlparse(rel_url)[2:])
136
- else:
137
- return rel_url
138
-
139
- base_url = base_url.rsplit("/", 1)[0]
140
-
141
- if rel_url.startswith("./"):
142
- return base_url + rel_url[1:]
143
-
144
- while rel_url.startswith("../"):
145
- base_url = base_url.rsplit("/", 1)[0]
146
- rel_url = rel_url[3:]
147
-
148
- return f"{base_url}/{rel_url}"
149
-
150
-
151
- _JS_DEFAULT_EXPORT_PATTERN = re.compile(
152
- r";?\s*export\s+default\s",
153
- )
154
- _JS_FUNC_OR_CLS_EXPORT_PATTERN = re.compile(
155
- r";?\s*export\s+(?:function|class)\s+([a-zA-Z_$][0-9a-zA-Z_$]*)"
156
- )
157
- _JS_GENERAL_EXPORT_PATTERN = re.compile(
158
- r"(?:^|;|})\s*export(?=\s+|{)(.*?)(?=;|$)", re.MULTILINE
1
+ raise ImportError( # nocov
2
+ "WARNING: reactpy.web.utils was not within the public API, and thus has been removed without notice."
159
3
  )
reactpy/widgets.py CHANGED
@@ -1,8 +1,8 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from base64 import b64encode
4
- from collections.abc import Sequence
5
- from typing import Any, Callable, Protocol, TypeVar
4
+ from collections.abc import Callable, Sequence
5
+ from typing import Any, Protocol, TypeVar
6
6
 
7
7
  import reactpy
8
8
  from reactpy._html import html
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reactpy
3
- Version: 2.0.0b4
3
+ Version: 2.0.0b6
4
4
  Summary: It's React, but in Python.
5
5
  Project-URL: Changelog, https://reactpy.dev/docs/about/changelog.html
6
6
  Project-URL: Documentation, https://reactpy.dev/
@@ -8,28 +8,26 @@ Project-URL: Source, https://github.com/reactive-python/reactpy
8
8
  Author-email: Mark Bakhit <archiethemonger@gmail.com>, Ryan Morshead <ryan.morshead@gmail.com>
9
9
  License-Expression: MIT
10
10
  License-File: LICENSE
11
- Keywords: component,javascript,react,reactpy
11
+ Keywords: asgi,components,interactive,javascript,react,reactive,reactjs,reactpy,server,website,wsgi
12
12
  Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Programming Language :: Python
14
- Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
17
16
  Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
18
  Classifier: Programming Language :: Python :: Implementation :: CPython
19
19
  Classifier: Programming Language :: Python :: Implementation :: PyPy
20
- Requires-Python: >=3.9
20
+ Requires-Python: >=3.11
21
21
  Requires-Dist: anyio>=3
22
22
  Requires-Dist: fastjsonschema>=2.14.5
23
23
  Requires-Dist: lxml>=4
24
24
  Requires-Dist: requests>=2
25
- Requires-Dist: typing-extensions>=3.10
26
25
  Provides-Extra: all
27
26
  Requires-Dist: asgi-tools; extra == 'all'
28
27
  Requires-Dist: asgiref; extra == 'all'
29
28
  Requires-Dist: jinja2-simple-tags; extra == 'all'
30
29
  Requires-Dist: jinja2>=3; extra == 'all'
31
30
  Requires-Dist: orjson; extra == 'all'
32
- Requires-Dist: pip; extra == 'all'
33
31
  Requires-Dist: playwright; extra == 'all'
34
32
  Requires-Dist: servestatic; extra == 'all'
35
33
  Requires-Dist: uvicorn[standard]; extra == 'all'
@@ -37,7 +35,6 @@ Provides-Extra: asgi
37
35
  Requires-Dist: asgi-tools; extra == 'asgi'
38
36
  Requires-Dist: asgiref; extra == 'asgi'
39
37
  Requires-Dist: orjson; extra == 'asgi'
40
- Requires-Dist: pip; extra == 'asgi'
41
38
  Requires-Dist: servestatic; extra == 'asgi'
42
39
  Provides-Extra: jinja
43
40
  Requires-Dist: jinja2-simple-tags; extra == 'jinja'
@@ -1,44 +1,60 @@
1
- reactpy/__init__.py,sha256=Mz3B-HReWf6koCC_HL2anGCDkJoKwy8vhPivouSaH-E,1179
2
- reactpy/_html.py,sha256=SNDqr_ovXYFruC7ZWYFGCCCN9S4UTYGTsLnM-8VCz0o,11368
3
- reactpy/_option.py,sha256=GK3Msnaqhcgkbx-RStbiMSeC9Qocf8Y6JbdxcO6f6ZI,5088
1
+ reactpy/__init__.py,sha256=ZO54xizsV76Vsxfo_9PdHlOkZ7dMxoXn7rAizQsPk30,1203
2
+ reactpy/_html.py,sha256=1r47Irgeh_emnJfSNo9ajDntmW4CeiqSqPFLMczQG_Y,11529
3
+ reactpy/_option.py,sha256=T4rQa_YIGLEVlYmqLDD-a2hQBfM5OHVGjFycTQUP4sI,5115
4
4
  reactpy/_warnings.py,sha256=DR1YGzTS8ijaH0Wqh2V3TWDeDlkBwEb9dSsEYYuW-RI,933
5
- reactpy/config.py,sha256=s3iWAQu9BAxidd5enacJm0b86cBaoVs-iTtWQrYpDy4,3835
5
+ reactpy/config.py,sha256=qLEOO2QQ_wq8qVaiPRujuc1nVVfwmJkHAAUTxvvQsTk,3791
6
6
  reactpy/logging.py,sha256=VEQWQIjgAfAKj1qdvcT9PoMiRZ5iCfd0GPkhI5vmjxA,857
7
7
  reactpy/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
8
- reactpy/transforms.py,sha256=hgIiMriflwPsMZhtZkqUm5Qj_eR5hrLrp0yTJ7NnC_c,11837
9
- reactpy/types.py,sha256=gMolX9rL02FryH7DGTQoOPgenKNNT5w3dRGNc3bYDao,32475
10
- reactpy/utils.py,sha256=JSrSrA3JWJwGAK5vRx5jcgJ7kigTOJ41NjmUlNVi1ds,10891
11
- reactpy/widgets.py,sha256=OoDO7HqTMRyqEK1y3RWVx_3vbfX8tsADZDvw6Umib1I,2623
8
+ reactpy/transforms.py,sha256=mDtA_8_GFluukNBckIGaeCtOQ8EOi-Fn-MTlq-xEn6Y,11871
9
+ reactpy/types.py,sha256=Uh6_PsiZoPa9AdNT9zstMnqgrgrAl_X5NhZxJgk8onk,33727
10
+ reactpy/utils.py,sha256=8IIAe_3lpSlwL8BQtFfqel77vYr95d4o0xDpcayFMWE,10862
11
+ reactpy/widgets.py,sha256=xLfjTqvDg96jQa-mApex7QGcikt216DeTcDFc_9pwAU,2623
12
12
  reactpy/_console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  reactpy/_console/ast_utils.py,sha256=bBQ0hNP5-p5CbQFRK0-f-z1c1cVReNBFR0BAcN30vTg,6340
14
14
  reactpy/_console/cli.py,sha256=r-6tOyK8nJw7RF0JLJrjdKkQIM-36ZZsuUmR5Opxo6M,346
15
15
  reactpy/_console/rewrite_keys.py,sha256=Ydnbfxp8Sv6OnCwLCLQp6aTurAOLW9w1fOFVPWSudbc,3505
16
- reactpy/_console/rewrite_props.py,sha256=JMPJQWdq837saZjccKMB4iogngoRCehwogIKmkPrr_M,4768
16
+ reactpy/_console/rewrite_props.py,sha256=bnGjLBOLQJNgIWBbilQ6Df_nJBuPDODk93bAQUwgC4s,4791
17
17
  reactpy/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  reactpy/core/_f_back.py,sha256=hVVbAjfaGO7oTh3VGdDziThuspYftfQICtWSv_0i1yc,605
19
- reactpy/core/_life_cycle_hook.py,sha256=z-kV9l6Nc8lZZyaG4t-_FXGgCxdaB6TfQo_h1ESqFL0,9583
20
- reactpy/core/_thread_local.py,sha256=AW1T7z4M4DH92EyYCmfAH_gxxW51ZCqZBFfZdEO6u54,800
21
- reactpy/core/component.py,sha256=1lRXyIKgpGz-Nl-Nz9dq0i972ZiYd-AuZPgoQjIOqVQ,2042
22
- reactpy/core/events.py,sha256=zrzTQYWDUOIfZPKK7xPgwmYv_KtdGapnd3qaBvIS0wg,7726
23
- reactpy/core/hooks.py,sha256=fhyI96Y8YrKpbbMIT7fl96MFq_ELaTPsT2vOTUGfNv4,19287
24
- reactpy/core/layout.py,sha256=9Zfhhp414WJJ_L88SzBHCD6mZtPd3BbVcLjb0s9dwoI,26837
25
- reactpy/core/serve.py,sha256=vZUOsDuUHkcfVrFvqjWceR7dDxscsVZUC0XqVxUIftM,2544
26
- reactpy/core/vdom.py,sha256=J7uHx35SHQakspnZkeD2Z1OvIu2yKt3yJHVBSIr1vdo,9918
19
+ reactpy/core/_life_cycle_hook.py,sha256=GyMF6g-Mjeh0wO5NBJziPOcA7gXFUO-OITmApZ2CAek,9635
20
+ reactpy/core/_thread_local.py,sha256=nqvmSQhTrFgh34RUhzSTPEy1AaW3_j82Ji96BTz7hu0,827
21
+ reactpy/core/component.py,sha256=zASYlRhBrT6JZ-_uTU7N_UOhVSIsnnky4S8xoz5OY98,969
22
+ reactpy/core/events.py,sha256=HK8SHvl6uQS4H1AqfoK4Mj_YCaMaX3JvSFJ6Bqc4eMI,8594
23
+ reactpy/core/hooks.py,sha256=GtEG1bFubMUR1BLW_k5cBz1-mCy6XxKUkoR1x_tv2mk,19034
24
+ reactpy/core/layout.py,sha256=CYQBWnzS0PdzRi8pifC8PYg3BS0kzOgB0MQc1O4e404,26122
25
+ reactpy/core/serve.py,sha256=DFdJ6AWZzAuuq_8PtPmD-QprvMJFsYp77_O3Q46prx8,2337
26
+ reactpy/core/vdom.py,sha256=Boe9dsHKrsVWM2hZai7Y41VYzTHeIQn-bl537vkj0ds,9771
27
27
  reactpy/executors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  reactpy/executors/utils.py,sha256=ikhv0MvsOKq45Gm7auLh6PbxvUH2ZgC5HLFXI9vBcLc,2779
29
- reactpy/executors/asgi/__init__.py,sha256=3a2x9izF5MmZrI70wdy3Z8CsSZhhM2_CFxoSI6B4eiI,231
30
- reactpy/executors/asgi/middleware.py,sha256=ysxMMHGSpnELNvx4HLCe81H2NvvfNS99x76ph4VrTFQ,11457
31
- reactpy/executors/asgi/pyscript.py,sha256=w2BwHB1eV_EguWPsriYMkPevte6vOcrgdsU8pe1Veeo,5329
32
- reactpy/executors/asgi/standalone.py,sha256=gH-gYhicMxlwvPcpklKx8ZpFpp8LWYoQALNTUi-4czo,8736
33
- reactpy/executors/asgi/types.py,sha256=IzWrukH7U7QCnVdpVXUcxIDh9FZzJwo9YthBrh8Rcjk,3362
29
+ reactpy/executors/asgi/__init__.py,sha256=eneHZqUxGxTUkTrrpXhq_YBqfA_mig-9YBTNNVFzXC0,405
30
+ reactpy/executors/asgi/middleware.py,sha256=AgXs7VxBjS01v1Fq4WkU6ORmNr7-pd7eEzaybRYig3o,11428
31
+ reactpy/executors/asgi/pyscript.py,sha256=W-5E5RNVsE5zNKF9iU0zs0M37DKbuGWTKUZiOwoVbWs,5263
32
+ reactpy/executors/asgi/standalone.py,sha256=dh1BqFwDOcsXeAjgWH2cw2Wn3vp4KK7x8uwhX_cb3BM,8698
33
+ reactpy/executors/asgi/types.py,sha256=jCIU8mJx1CMvYtmV3Lq7iIET8uiSwAeMJOwTsosHBKs,3362
34
34
  reactpy/pyscript/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  reactpy/pyscript/component_template.py,sha256=jYzQ7YwfJ6RA3A1BcKs_1udUTt7dT3Qct7Bm73BsZdU,778
36
- reactpy/pyscript/components.py,sha256=BJ8qx8qEUYO4Hus_QSBsMakMxkJ9BstTES2HztgVwmU,1927
36
+ reactpy/pyscript/components.py,sha256=1ZUM3o11cbb4QC1eSCSo1euJeV6uaKAleB3Ie7ntyoU,1915
37
37
  reactpy/pyscript/layout_handler.py,sha256=aBrnBeiEMudUvRqbhW7KoJW-RkwS_wQ2KZl6m47vcNA,6289
38
- reactpy/pyscript/utils.py,sha256=MSrW-SPPw0lkocazN0sHIo-GdJsWoDSad1sqGsmlM4k,8718
39
- reactpy/static/index.js,sha256=WDjRua1rk4HI0ku8SnpmD5cFSZLiC27ylmcRZTMOh18,32374
40
- reactpy/static/index.js.map,sha256=fLT5BZonDGihwPQ3Q688E49k3i45hsXFpZd_Vz42CMQ,104592
38
+ reactpy/pyscript/utils.py,sha256=qI923vqfs91nAOYmE9G-yfIwW2DgJIUPyc9Vrm6N0t0,8863
39
+ reactpy/reactjs/__init__.py,sha256=mfhyZ0pXw9y32tb3e0pSFh6DQJGikhQ-d8Xf726-g7U,11998
40
+ reactpy/reactjs/module.py,sha256=5o-k-9LrIM2DUEgCS60HLkreEvy6cBxmyoCqAXdY57w,6122
41
+ reactpy/reactjs/types.py,sha256=Oik_-Ipj6SNwZyHa1_wEVQBAUPWIB1rtadb_rLpFDgI,208
42
+ reactpy/reactjs/utils.py,sha256=kM4OUHS3T7Ym667aDnLCsdDgId0ff4eyPXTlYpW1vvk,5893
43
+ reactpy/static/index-h31022cd.js,sha256=kDoTnADufQXfXnWz1yE4xccOc9-xenN2yVWTGsuFn_o,13168
44
+ reactpy/static/index-h31022cd.js.map,sha256=Bg8TRwgvfGprr0JUjrjX-s3SiyHhXG6D3deCpdKnsQw,30745
45
+ reactpy/static/index-sbddj6ms.js,sha256=v67dPuLSMuF_01rl37lne4610g7LGkk6mgrgK_w0dx0,1788
46
+ reactpy/static/index-sbddj6ms.js.map,sha256=0JbncMkhrRFSdL0U2EqM159wThOAKPoBPgrtluQFW00,4190
47
+ reactpy/static/index-y71bxs88.js,sha256=w91A8_qCwdjEBtVii6PS20Qq1z8MpHqhpRyzrH6KgVY,11970
48
+ reactpy/static/index-y71bxs88.js.map,sha256=bv5Abkijs0X1W0beBCtwnRJC_JS7-eYXJ-x6muSh5KU,27453
49
+ reactpy/static/index.js,sha256=pKHrDDN2A3mA4DN_Luud3mQvHQEongy8BMSxZHe1prs,13662
50
+ reactpy/static/index.js.map,sha256=3xQKLRka-SIEFOqxWnE3vn1stoSwJChUIzxqlTEe6Gc,54315
41
51
  reactpy/static/pyscript-hide-debug.css,sha256=TSVmdOQVWwN-L9C0g0JmvvHoOfN4NlXvom0SXrIEmXg,33
52
+ reactpy/static/react-dom.js,sha256=u4m8a4ULKBcBA92sLRH0olOket7n2HdnEbkB97hmu0w,1464
53
+ reactpy/static/react-dom.js.map,sha256=IGvF1acksknNvcFCRp7NnTKshv_hjIdJeoAZKdecnAQ,1182
54
+ reactpy/static/react-jsx-runtime.js,sha256=VnTzcoGvqVoi4uE1lzoBG9Hai--mqVOYpQZzt_DLkOM,292
55
+ reactpy/static/react-jsx-runtime.js.map,sha256=hTiAjMVPdotYC6qZRKa3GqLM8jodZuOeNlqPMujdWb4,144
56
+ reactpy/static/react.js,sha256=_rmkynU4uIOLGDmQdg8YSPpdY9hSN63bSc2zmO751uA,1302
57
+ reactpy/static/react.js.map,sha256=M-E4EaQVVOVEoMgXhnUWiuqTtSP1vE7QBA7f7NW_r7Y,320
42
58
  reactpy/static/morphdom/morphdom-esm.js,sha256=SOgEV5tSt-D2pjMeZDbV0cLiHCT4FVKNipG8NQmE7Do,28610
43
59
  reactpy/static/morphdom/morphdom-factory.js,sha256=iDCdYf_nbCiXC-_NKcp6nihq980NzgMZE6NX4HDgy74,26492
44
60
  reactpy/static/morphdom/morphdom-umd.js,sha256=guJOFWL0884p3kouGnEBOxxjqpyT7joM8fRXaQihL9s,31590
@@ -100,17 +116,16 @@ reactpy/static/pyscript/zip-pccs084i.js.map,sha256=HiY9HOwFsPc-R9viM6qN0QVf1PQBE
100
116
  reactpy/templatetags/__init__.py,sha256=slwD8UiXJ8WQAGxDsGy1_fpX-9mbwNAU17cTL0bktMo,80
101
117
  reactpy/templatetags/jinja.py,sha256=YHKZhf6i6tsd0IwsS4SBb7kR9MbUjSKwuEH3xdtF6-Y,1541
102
118
  reactpy/testing/__init__.py,sha256=f8JhesjRwOConigrCKd-XHRDAmpIA7xRU5oVIxLG4Fw,643
103
- reactpy/testing/backend.py,sha256=21D8QfJYI70ezsEO4knBb8wzugUg7BvPN9fLqCoLtxw,7101
104
- reactpy/testing/common.py,sha256=rPURV28pQSoMUFx46WtStTzF1e3APytOJTrov408qic,7080
105
- reactpy/testing/display.py,sha256=9XbQ6qVrsbDXWIJ-LXemspGFqxmtzzIy5Ojed6J71-c,2170
106
- reactpy/testing/logs.py,sha256=40MGuZIlwT6c_ziziwLCsH1Y032ROAFcLvd8g9lRvAc,5672
119
+ reactpy/testing/backend.py,sha256=EUerzGvyPsBX7j8QCqsl03aWe2yk95lnZhSfcpYjHrA,7075
120
+ reactpy/testing/common.py,sha256=gkcEJDAel-6nsOtuL628WoB1eSmzhLKp6RFwtN84TR8,7042
121
+ reactpy/testing/display.py,sha256=zDAu7WsGDRHBt6JzBcj6U6z9htJobuG2uun1PMhEc4k,2358
122
+ reactpy/testing/logs.py,sha256=XfFZr-Qhq-x6nPgkPqeo_L51NmhJQtAsvnzjuWbx8qY,5672
107
123
  reactpy/testing/utils.py,sha256=b4s1hpLqdl_Z8G_hHAx3ELlr4x1oI9iuazOdS43wkZI,1071
108
- reactpy/web/__init__.py,sha256=gJuI9-GMoMSV6KrA3idYRIWmFu6wtnwnIWU2IA8PJS0,422
109
- reactpy/web/module.py,sha256=fHPsaZJ5J93x7huNHHcH9ZMIHVEriM-q2_8aIxxUpLs,17866
110
- reactpy/web/utils.py,sha256=gAlR_rIIB0ezPZCb8bYKd8hSPb95RTAjcQmozkUqMhY,5172
111
- reactpy/web/templates/react.js,sha256=VIwJfl8S3b53PazgFdaWpgHLhTYpcmNdSQfpl9LPQdM,1950
112
- reactpy-2.0.0b4.dist-info/METADATA,sha256=knWAEL89NbqlPqmGjXSXUf5jdcZJxzM-SoFR9pM3L-U,5052
113
- reactpy-2.0.0b4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
114
- reactpy-2.0.0b4.dist-info/entry_points.txt,sha256=WRit3ZrLVh7iDEhUMAPE3A9bcaa7TsolCdAdkxGmv0U,61
115
- reactpy-2.0.0b4.dist-info/licenses/LICENSE,sha256=-8yQb3G5cW-IBhxyIe-uoQzI9lPEu7-6Yi5wJSO1ous,1093
116
- reactpy-2.0.0b4.dist-info/RECORD,,
124
+ reactpy/web/__init__.py,sha256=ldSzfmqYFnKCEclfPs8Y5oL9GaG5LDYtXN9Vaz9wUhI,216
125
+ reactpy/web/module.py,sha256=A5N6habdSSOsTjvahQ7jXEPBYQKRiGslxzAc8N7GWDU,3332
126
+ reactpy/web/utils.py,sha256=TOCy15woEr2QZjiXZV_p6YMof2rYZbQu7wsJVznB5jI,136
127
+ reactpy-2.0.0b6.dist-info/METADATA,sha256=Eqm6izDH1ZU1f498yxhg_zaIxBe6lhx90qMz5FTU6Pg,4998
128
+ reactpy-2.0.0b6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
129
+ reactpy-2.0.0b6.dist-info/entry_points.txt,sha256=WRit3ZrLVh7iDEhUMAPE3A9bcaa7TsolCdAdkxGmv0U,61
130
+ reactpy-2.0.0b6.dist-info/licenses/LICENSE,sha256=-8yQb3G5cW-IBhxyIe-uoQzI9lPEu7-6Yi5wJSO1ous,1093
131
+ reactpy-2.0.0b6.dist-info/RECORD,,
@@ -1,61 +0,0 @@
1
- export * from "$CDN/$PACKAGE";
2
-
3
- import * as React from "$CDN/react$VERSION";
4
- import * as ReactDOM from "$CDN/react-dom$VERSION";
5
-
6
- export default ({ children, ...props }) => {
7
- const [{ component }, setComponent] = React.useState({});
8
- React.useEffect(() => {
9
- import("$CDN/$PACKAGE").then((module) => {
10
- // dynamically load the default export since we don't know if it's exported.
11
- setComponent({ component: module.default });
12
- });
13
- });
14
- return component
15
- ? React.createElement(component, props, ...(children || []))
16
- : null;
17
- };
18
-
19
- export function bind(node, config) {
20
- const root = ReactDOM.createRoot(node);
21
- return {
22
- create: (component, props, children) =>
23
- React.createElement(component, wrapEventHandlers(props), ...children),
24
- render: (element) => root.render(element),
25
- unmount: () => root.unmount()
26
- };
27
- }
28
-
29
- function wrapEventHandlers(props) {
30
- const newProps = Object.assign({}, props);
31
- for (const [key, value] of Object.entries(props)) {
32
- if (typeof value === "function" && value.isHandler) {
33
- newProps[key] = makeJsonSafeEventHandler(value);
34
- }
35
- }
36
- return newProps;
37
- }
38
-
39
- function makeJsonSafeEventHandler(oldHandler) {
40
- // Since we can't really know what the event handlers get passed we have to check if
41
- // they are JSON serializable or not. We can allow normal synthetic events to pass
42
- // through since the original handler already knows how to serialize those for us.
43
- return function safeEventHandler() {
44
- oldHandler(
45
- ...Array.from(arguments).filter((value) => {
46
- if (typeof value === "object" && value.nativeEvent) {
47
- // this is probably a standard React synthetic event
48
- return true;
49
- } else {
50
- try {
51
- JSON.stringify(value);
52
- } catch (err) {
53
- console.error("Failed to serialize some event data");
54
- return false;
55
- }
56
- return true;
57
- }
58
- }),
59
- );
60
- };
61
- }