pulse-framework 0.1.44__py3-none-any.whl → 0.1.47__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 (80) hide show
  1. pulse/__init__.py +10 -24
  2. pulse/app.py +3 -25
  3. pulse/codegen/codegen.py +43 -88
  4. pulse/codegen/js.py +35 -5
  5. pulse/codegen/templates/route.py +341 -254
  6. pulse/form.py +1 -1
  7. pulse/helpers.py +40 -8
  8. pulse/hooks/core.py +2 -2
  9. pulse/hooks/effects.py +1 -1
  10. pulse/hooks/init.py +2 -1
  11. pulse/hooks/setup.py +1 -1
  12. pulse/hooks/stable.py +2 -2
  13. pulse/hooks/states.py +2 -2
  14. pulse/html/props.py +3 -2
  15. pulse/html/tags.py +135 -0
  16. pulse/html/tags.pyi +4 -0
  17. pulse/js/__init__.py +110 -0
  18. pulse/js/__init__.pyi +95 -0
  19. pulse/js/_types.py +297 -0
  20. pulse/js/array.py +253 -0
  21. pulse/js/console.py +47 -0
  22. pulse/js/date.py +113 -0
  23. pulse/js/document.py +138 -0
  24. pulse/js/error.py +139 -0
  25. pulse/js/json.py +62 -0
  26. pulse/js/map.py +84 -0
  27. pulse/js/math.py +66 -0
  28. pulse/js/navigator.py +76 -0
  29. pulse/js/number.py +54 -0
  30. pulse/js/object.py +173 -0
  31. pulse/js/promise.py +150 -0
  32. pulse/js/regexp.py +54 -0
  33. pulse/js/set.py +109 -0
  34. pulse/js/string.py +35 -0
  35. pulse/js/weakmap.py +50 -0
  36. pulse/js/weakset.py +45 -0
  37. pulse/js/window.py +199 -0
  38. pulse/messages.py +22 -3
  39. pulse/queries/client.py +7 -7
  40. pulse/queries/effect.py +16 -0
  41. pulse/queries/infinite_query.py +138 -29
  42. pulse/queries/mutation.py +1 -15
  43. pulse/queries/protocol.py +136 -0
  44. pulse/queries/query.py +610 -174
  45. pulse/queries/store.py +11 -14
  46. pulse/react_component.py +167 -14
  47. pulse/reactive.py +19 -1
  48. pulse/reactive_extensions.py +5 -5
  49. pulse/render_session.py +185 -59
  50. pulse/renderer.py +80 -158
  51. pulse/routing.py +1 -18
  52. pulse/transpiler/__init__.py +131 -0
  53. pulse/transpiler/builtins.py +731 -0
  54. pulse/transpiler/constants.py +110 -0
  55. pulse/transpiler/context.py +26 -0
  56. pulse/transpiler/errors.py +2 -0
  57. pulse/transpiler/function.py +250 -0
  58. pulse/transpiler/ids.py +16 -0
  59. pulse/transpiler/imports.py +409 -0
  60. pulse/transpiler/js_module.py +274 -0
  61. pulse/transpiler/modules/__init__.py +30 -0
  62. pulse/transpiler/modules/asyncio.py +38 -0
  63. pulse/transpiler/modules/json.py +20 -0
  64. pulse/transpiler/modules/math.py +320 -0
  65. pulse/transpiler/modules/re.py +466 -0
  66. pulse/transpiler/modules/tags.py +268 -0
  67. pulse/transpiler/modules/typing.py +59 -0
  68. pulse/transpiler/nodes.py +1216 -0
  69. pulse/transpiler/py_module.py +119 -0
  70. pulse/transpiler/transpiler.py +938 -0
  71. pulse/transpiler/utils.py +4 -0
  72. pulse/types/event_handler.py +3 -2
  73. pulse/vdom.py +212 -13
  74. {pulse_framework-0.1.44.dist-info → pulse_framework-0.1.47.dist-info}/METADATA +1 -1
  75. pulse_framework-0.1.47.dist-info/RECORD +119 -0
  76. pulse/codegen/imports.py +0 -204
  77. pulse/css.py +0 -155
  78. pulse_framework-0.1.44.dist-info/RECORD +0 -79
  79. {pulse_framework-0.1.44.dist-info → pulse_framework-0.1.47.dist-info}/WHEEL +0 -0
  80. {pulse_framework-0.1.44.dist-info → pulse_framework-0.1.47.dist-info}/entry_points.txt +0 -0
pulse/css.py DELETED
@@ -1,155 +0,0 @@
1
- import hashlib
2
- import inspect
3
- from collections.abc import Iterable, Iterator, MutableMapping
4
- from dataclasses import dataclass
5
- from pathlib import Path
6
- from typing import override
7
-
8
- _CSS_MODULES: MutableMapping[Path, "CssModule"] = {}
9
- _CSS_IMPORTS: dict[str, "CssImport"] = {}
10
-
11
-
12
- def _caller_file() -> Path:
13
- frame = inspect.currentframe()
14
- try:
15
- if frame is None or frame.f_back is None:
16
- raise RuntimeError("Cannot determine caller frame for ps.css()")
17
- caller = frame.f_back
18
- # Walk past helper wrappers (ps.css may be imported under different name)
19
- while caller and caller.f_code.co_filename == __file__:
20
- caller = caller.f_back
21
- if caller is None:
22
- raise RuntimeError("Cannot determine caller for ps.css()")
23
- return Path(caller.f_code.co_filename).resolve()
24
- finally:
25
- del frame
26
-
27
-
28
- def css_module(path: str | Path, *, relative: bool = False) -> "CssModule":
29
- source = Path(path)
30
- caller = _caller_file()
31
- if relative:
32
- source = caller.parent / source
33
- source = source.resolve()
34
- if not source.exists():
35
- raise FileNotFoundError(f"CSS module '{source}' not found")
36
- module = _CSS_MODULES.get(source)
37
- if not module:
38
- module = CssModule.create(source)
39
- _CSS_MODULES[source] = module
40
- return module
41
-
42
-
43
- def css(path: str | Path, *, relative: bool = False) -> "CssImport":
44
- caller = _caller_file()
45
- if relative:
46
- source_path = (caller.parent / Path(path)).resolve()
47
- if not source_path.exists():
48
- raise FileNotFoundError(
49
- f"CSS import '{path}' not found relative to {caller.parent}"
50
- )
51
- key = f"file://{source_path}"
52
- existing = _CSS_IMPORTS.get(key)
53
- if existing:
54
- return existing
55
- imp = CssImport(
56
- _import_id(str(source_path)), specifier=None, source_path=source_path
57
- )
58
- _CSS_IMPORTS[key] = imp
59
- return imp
60
-
61
- spec = str(path)
62
- existing = _CSS_IMPORTS.get(spec)
63
- if existing:
64
- return existing
65
- imp = CssImport(_import_id(spec), specifier=spec, source_path=None)
66
- _CSS_IMPORTS[spec] = imp
67
- return imp
68
-
69
-
70
- def registered_css_modules() -> list["CssModule"]:
71
- return list(_CSS_MODULES.values())
72
-
73
-
74
- def registered_css_imports() -> list["CssImport"]:
75
- return list(_CSS_IMPORTS.values())
76
-
77
-
78
- @dataclass(frozen=True)
79
- class CssModule:
80
- id: str
81
- source_path: Path
82
-
83
- @staticmethod
84
- def create(path: Path) -> "CssModule":
85
- module_id = _module_id(path)
86
- return CssModule(module_id, path)
87
-
88
- def __getattr__(self, key: str) -> "CssReference":
89
- if key.startswith("__") and key.endswith("__"):
90
- raise AttributeError(key)
91
- return CssReference(self, key)
92
-
93
- def __getitem__(self, key: str) -> "CssReference":
94
- return self.__getattr__(key)
95
-
96
- def iter(self, names: Iterable[str]) -> Iterator["CssReference"]:
97
- for name in names:
98
- yield CssReference(self, name)
99
-
100
-
101
- @dataclass(frozen=True)
102
- class CssReference:
103
- module: CssModule
104
- name: str
105
-
106
- def __post_init__(self) -> None:
107
- if not self.name:
108
- raise ValueError("CSS class name cannot be empty")
109
-
110
- def __bool__(self) -> bool:
111
- raise TypeError("CssReference objects cannot be coerced to bool")
112
-
113
- def __int__(self) -> int:
114
- raise TypeError("CssReference objects cannot be converted to int")
115
-
116
- def __float__(self) -> float:
117
- raise TypeError("CssReference objects cannot be converted to float")
118
-
119
- @override
120
- def __str__(self) -> str:
121
- raise TypeError("CssReference objects cannot be converted to str")
122
-
123
- @override
124
- def __repr__(self) -> str:
125
- return f"CssReference(module={self.module.id!r}, name={self.name!r})"
126
-
127
-
128
- def _module_id(path: Path) -> str:
129
- data = str(path).encode("utf-8")
130
- digest = hashlib.sha1(data).hexdigest()
131
- return f"css_{digest[:12]}"
132
-
133
-
134
- @dataclass(frozen=True)
135
- class CssImport:
136
- id: str
137
- specifier: str | None
138
- source_path: Path | None
139
-
140
-
141
- def _import_id(value: str) -> str:
142
- data = value.encode("utf-8")
143
- digest = hashlib.sha1(data).hexdigest()
144
- return f"css_import_{digest[:12]}"
145
-
146
-
147
- __all__ = [
148
- "CssModule",
149
- "CssReference",
150
- "CssImport",
151
- "css",
152
- "css_module",
153
- "registered_css_modules",
154
- "registered_css_imports",
155
- ]
@@ -1,79 +0,0 @@
1
- pulse/__init__.py,sha256=Acb_t45WP9HsPBRBtKsx5rj-u-pl8gRmdwsKKVPokK4,32721
2
- pulse/app.py,sha256=cVEqazFcgSnmZSxqqz6HWk2QsI8rnKbO7Y_L88BcHSc,32082
3
- pulse/channel.py,sha256=d9eLxgyB0P9UBVkPkXV7MHkC4LWED1Cq3GKsEu_SYy4,13056
4
- pulse/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- pulse/cli/cmd.py,sha256=UBT7OoqWRU-idLOKkA9TDN8m8ugi1gwRMiUJTUmkVfU,14853
6
- pulse/cli/dependencies.py,sha256=ZBqBAfMvMBQUvh4THdPDztTMQ_dyR52S1IuotP_eEZs,5623
7
- pulse/cli/folder_lock.py,sha256=kvUmZBg869lwCTIZFoge9dhorv8qPXHTWwVv_jQg1k8,3477
8
- pulse/cli/helpers.py,sha256=8bRlV3d7w3w-jHaFvFYt9Pzue6_CbKOq_Z3jBsBOeUk,8820
9
- pulse/cli/models.py,sha256=NBV5byBDNoAQSk0vKwibLjoxuA85XBYIyOVJn64L8oU,858
10
- pulse/cli/packages.py,sha256=e7ycwwJfdmB4pzrai4DHos6-JzyUgmE4DCZp0BqjdeI,6792
11
- pulse/cli/processes.py,sha256=C1xU72oUanj-1Mkc9WmqESTsVUn_aUHG8URiPyRHSFM,7016
12
- pulse/cli/secrets.py,sha256=dNfQe6AzSYhZuWveesjCRHIbvaPd3-F9lEJ-kZA7ROw,921
13
- pulse/cli/uvicorn_log_config.py,sha256=f7ikDc5foXh3TmFMrnfnW8yev48ZAdlo8F4F_aMVoVk,2391
14
- pulse/codegen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- pulse/codegen/codegen.py,sha256=lPhgl57Ag3ChEDdhFD7wUCaU6lFiTQ1cD_vpSUgMfKg,11093
16
- pulse/codegen/imports.py,sha256=13f0uzJsotw069aP_COUUPMuTXXhRKRwUzfxsSCq_6A,6070
17
- pulse/codegen/js.py,sha256=7MuiECSJ-DulSqKuMZ8z1q_d7e3AbK6MYiNTYALZCLA,881
18
- pulse/codegen/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- pulse/codegen/templates/layout.py,sha256=nmWPQcO9SRXc3mCCVLCmykreSF96TqQfdDY7dvUBxRg,4737
20
- pulse/codegen/templates/route.py,sha256=cwmNHYkuecZ5M986hmm6SxisIoVSc656dtpqAvPjMjM,7824
21
- pulse/codegen/templates/routes_ts.py,sha256=nPgKCvU0gzue2k6KlOL1TJgrBqqRLmyy7K_qKAI8zAE,1129
22
- pulse/codegen/utils.py,sha256=QoXcV-h-DLLmq_t03hDNUePS0fNnofUQLoR-TXzDFCY,539
23
- pulse/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
- pulse/components/for_.py,sha256=LUyJEUlDM6b9oPjvUFgSsddxu6b6usF4BQdXe8FIiGI,1302
25
- pulse/components/if_.py,sha256=rQywsmdirNpkb-61ZEdF-tgzUh-37JWd4YFGblkzIdQ,1624
26
- pulse/components/react_router.py,sha256=TbRec-NVliUqrvAMeFXCrnDWV1rh6TGTPfRhqLuLubk,1129
27
- pulse/context.py,sha256=fMK6GdQY4q_3452v5DJli2f2_urVihnpzb-O-O9cJ1Q,1734
28
- pulse/cookies.py,sha256=c7ua1Lv6mNe1nYnA4SFVvewvRQAbYy9fN5G3Hr_Dr5c,5000
29
- pulse/css.py,sha256=-FyQQQ0EZI1Ins30qiF3l4z9yDb1V9qWuJKWxHcKGkw,3910
30
- pulse/decorators.py,sha256=ywNgLN6VFcKOM5fbFdUUzh-DWk4BuSXdD1BTfd1N-0U,4827
31
- pulse/env.py,sha256=p3XI8KG1ZCcXPD3LJP7fW8JPYfyvoYY5ENwae2o0PiA,2889
32
- pulse/form.py,sha256=P7W8guUdGbgqNOk8cSUCWuY6qWre0me6_fypv1qOvqw,8987
33
- pulse/helpers.py,sha256=aF0SD3z2oGWFRt3BUhoI8JU5SwDAy1a4eg9BaW0LTUg,13745
34
- pulse/hooks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- pulse/hooks/core.py,sha256=JTZbVxNOEs_GAeK6Bh6hemSTkgwZPtEi_wt55cvOdik,7381
36
- pulse/hooks/effects.py,sha256=CQvt5viAweGLSxaGGlWm155GlEQiwQnGussw7OfiCGc,2393
37
- pulse/hooks/init.py,sha256=snTy3PJtkSnnKBrAjcNOJbem2896xJzHD0DHLVVeyAo,11924
38
- pulse/hooks/runtime.py,sha256=k5LZ8hnlNBMKOiEkQcAvs8BKwYxV6gwea2WCfju5K7Y,5106
39
- pulse/hooks/setup.py,sha256=GJLSE6hLBNKHR9aLhvsS6KXwpOXQiSx1V3E2IkGADWM,4461
40
- pulse/hooks/stable.py,sha256=uHEJ2E22r2kHx4uFjWjDepQ6OtPjLd7tT5ju-yKlkCU,1702
41
- pulse/hooks/states.py,sha256=e9vO8ig8vaw6guY711S6rlY9WXCjDYXsjiR7IvyKrXU,6708
42
- pulse/html/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
- pulse/html/elements.py,sha256=YHXkVpfMAC4-0o61fK-E0LGTOM3KMCtBfpHHAwLx7dw,23241
44
- pulse/html/events.py,sha256=SiZxaQV340hc5YGoKWXC5uCmbLsuijuEgnQz1hmdqYg,14700
45
- pulse/html/props.py,sha256=XatI6N4Hyef3MAql7jCxCIm6iuusgUXKkwHwIGm_dcc,26646
46
- pulse/html/svg.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
- pulse/html/tags.py,sha256=dyG4BY9qthBbO-ihcy9F8mLY6WqQxKFXfpqNYcSMKN0,5182
48
- pulse/html/tags.pyi,sha256=I8dFoft9w4RvneZ3li1weAdijY1krj9jfO_p2SU6e04,13953
49
- pulse/messages.py,sha256=Z7iYkOacwca5tU1UgZHt96iojT5Hd7VDc0PkEcru_2Q,3619
50
- pulse/middleware.py,sha256=9uyAhVUEGMSwqWC3WXqs7x5JMMNEcSTTu3g7DjsR8w8,9812
51
- pulse/plugin.py,sha256=RfGl6Vtr7VRHb8bp4Ob4dOX9dVzvc4Riu7HWnStMPpk,580
52
- pulse/proxy.py,sha256=zh4v5lmYNg5IBE_xdHHmGPwbMQNSXb2npeLXvw_O1Oc,6591
53
- pulse/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- pulse/queries/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
- pulse/queries/client.py,sha256=hZB3rAfH_fl_6ld_s9z81Vxvt8Cg0gXWU4Gj1qAL0LE,15254
56
- pulse/queries/common.py,sha256=Cr_NV0dWz5DQ7Qg771jvUms1o2-EnTYqjZJe4tVeoVk,1160
57
- pulse/queries/effect.py,sha256=8U7iAo3B4WB5lIcT6bE7YRnyfEYTLzNESq9KdDQsVYA,835
58
- pulse/queries/infinite_query.py,sha256=XBMuVApwBnzsB-toQfsyYRziMwtQhQq8wjtBzCq0qv4,36098
59
- pulse/queries/mutation.py,sha256=_WVRFU4BwkHrHQjEZc2mjyZTUx9Pad73xFWaFPF7I1Y,5315
60
- pulse/queries/query.py,sha256=MEKV8eKANFQmiWWs12ytgD9szYNbR2226EW_DkoFiNo,22037
61
- pulse/queries/store.py,sha256=p_WO7X-REytwkEyGjJi6XDv9tlrJX0v6E1sk1bBrPqM,3541
62
- pulse/react_component.py,sha256=hPibKBEkVdpBKNSpMQ6bZ-7GnJQcNQwcw2SvfY1chHA,26026
63
- pulse/reactive.py,sha256=0CqzeowZHAENMxM2PFhi_Q6KkDzG844JofzDk0Wxckw,23961
64
- pulse/reactive_extensions.py,sha256=WAx4hlB1ByZLFVpgtRnaWXAQ3N2QQplf647oQXDL5vg,31901
65
- pulse/render_session.py,sha256=kqLfZ9AxCrB2mIJqegATL1KA7CI-LZSBQwRYr7Uxo9g,14581
66
- pulse/renderer.py,sha256=dJiX9VeHr9kC1UBw5oaKB8Mv-3OCMGTrHiKgLJ5FL50,16759
67
- pulse/request.py,sha256=sPsSRWi5KvReSPBLIs_kzqomn1wlRk1BTLZ5s0chQr4,4979
68
- pulse/routing.py,sha256=RlrGHyK4F28_zUHMYNeKp4pNbvqrt4GY4t5xNdhzunI,13926
69
- pulse/serializer.py,sha256=8RAITNoSNm5-U38elHpWmkBpcM_rxZFMCluJSfldfk4,5420
70
- pulse/state.py,sha256=ikQbK4R8PieV96qd4uWREUvs0jXo9sCapawY7i6oCYo,10776
71
- pulse/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
72
- pulse/types/event_handler.py,sha256=tfKa6OEA5XvzuYbllQZJ03ooN7rGSYOtaPBstSL4OLU,1642
73
- pulse/user_session.py,sha256=FITxLSEl3JU-jod6UWuUYC6EpnPG2rbaLCnIOdkQPtg,7803
74
- pulse/vdom.py,sha256=1UAjOYSmpdZeSVELqejh47Jer4mA73T_q2HtAogOphs,12514
75
- pulse/version.py,sha256=711vaM1jVIQPgkisGgKZqwmw019qZIsc_QTae75K2pg,1895
76
- pulse_framework-0.1.44.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
77
- pulse_framework-0.1.44.dist-info/entry_points.txt,sha256=i7aohd3QaPu5IcuGKKvsQQEiMYMe5HcF56QEsaLVO64,46
78
- pulse_framework-0.1.44.dist-info/METADATA,sha256=MnbisSOFD9QfMar8uD3nDaZBbDe7LSL4z1KO0ZYfCb0,580
79
- pulse_framework-0.1.44.dist-info/RECORD,,