pulse-framework 0.1.60__py3-none-any.whl → 0.1.61__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.
pulse/renderer.py CHANGED
@@ -27,6 +27,7 @@ from pulse.transpiler.vdom import (
27
27
  UpdatePropsDelta,
28
28
  UpdatePropsOperation,
29
29
  VDOMElement,
30
+ VDOMExpr,
30
31
  VDOMNode,
31
32
  VDOMOperation,
32
33
  VDOMPropValue,
@@ -441,26 +442,17 @@ class Renderer:
441
442
  # Expression + tag rendering
442
443
  # ------------------------------------------------------------------
443
444
 
444
- def render_tag(self, tag: str | Expr) -> str:
445
+ def render_tag(self, tag: str | Expr) -> str | VDOMExpr:
445
446
  if isinstance(tag, str):
446
447
  return tag
447
448
 
448
- key = self.register_component_expr(tag)
449
- return f"{MOUNT_PREFIX}{key}"
449
+ return self.register_component_expr(tag)
450
450
 
451
- def register_component_expr(self, expr: Expr) -> str:
451
+ def register_component_expr(self, expr: Expr) -> str | VDOMExpr:
452
452
  ref = registry_ref(expr)
453
- if ref is None:
454
- expr_type = type(expr).__name__
455
- expr_repr = repr(expr)
456
- if len(expr_repr) > 200:
457
- expr_repr = f"{expr_repr[:197]}..."
458
- raise TypeError(
459
- "Component tag expressions must be registry-backed Expr values "
460
- + "(Import/JsFunction/Constant/JsxFunction). "
461
- + f"Got {expr_type}: {expr_repr}"
462
- )
463
- return ref["key"]
453
+ if ref is not None:
454
+ return f"{MOUNT_PREFIX}{ref['key']}"
455
+ return expr.render()
464
456
 
465
457
  # ------------------------------------------------------------------
466
458
  # Unmount helper
pulse/transpiler/vdom.py CHANGED
@@ -177,9 +177,10 @@ class VDOMElement(TypedDict):
177
177
  Special tags:
178
178
  - "": React Fragment
179
179
  - "$$<ComponentKey>": mount point for client component registry
180
+ - Expr object (VDOMExpr): evaluated on the client for dynamic component tags
180
181
  """
181
182
 
182
- tag: str
183
+ tag: str | VDOMExpr
183
184
  key: NotRequired[str]
184
185
  # Default: plain JSON props (no interpretation).
185
186
  # When `eval` is present, listed keys may contain VDOMExpr / VDOMElement / "$cb:...".
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pulse-framework
3
- Version: 0.1.60
3
+ Version: 0.1.61
4
4
  Summary: Pulse - Full-stack framework for building real-time React applications in Python
5
5
  Requires-Dist: websockets>=12.0
6
6
  Requires-Dist: fastapi>=0.128.0
@@ -89,7 +89,7 @@ pulse/react_component.py,sha256=8RLg4Bi7IcjqbnbEnp4hJpy8t1UsE7mG0UR1Q655LDk,2332
89
89
  pulse/reactive.py,sha256=FxxpH7NBtQr7G89iCVN7y1EG21f23GcRi1M-XIxcRQA,31280
90
90
  pulse/reactive_extensions.py,sha256=yQ1PpdAh4kMvll7R15T72FOg8NFdG_HGBsGc63dawYk,33754
91
91
  pulse/render_session.py,sha256=9gfwuBZRCWuQMN_nFuaAi__1UPN3I3C1mKWtAXyA3-A,21340
92
- pulse/renderer.py,sha256=CLUke7H3yL_idfjlWeGngWhO0iEZxJAQ2iMJOAuqlZc,16170
92
+ pulse/renderer.py,sha256=vXVd63Ox7f3of9_n6bN66KE96SvOYoc-PqzlRc09xvo,15907
93
93
  pulse/request.py,sha256=N0oFOLiGxpbgSgxznjvu64lG3YyOcZPKC8JFyKx6X7w,6023
94
94
  pulse/routing.py,sha256=LzTITvGgaLI1w7qTDZjFwoBcWAb4O8Dz7AmXeTNYrFU,16903
95
95
  pulse/serializer.py,sha256=HmQZgxQiaCx2SL2XwmEQLd_xsk_P8XfLtGciLLLOxx0,7616
@@ -115,12 +115,12 @@ pulse/transpiler/modules/typing.py,sha256=hMGff6gBscFJE2GPV9xUFNfLuff2QCMIbMJUs3
115
115
  pulse/transpiler/nodes.py,sha256=BI6maJdQ3KXyVHB-rf4H8ffp3nWpLZ2K6ZNUXzkj2vc,50424
116
116
  pulse/transpiler/py_module.py,sha256=YYSeroGInkXsoy39Y34Oxj1mrwDQnbSFVEgWru7vqG0,4465
117
117
  pulse/transpiler/transpiler.py,sha256=28diEp1yZTs3RsUEJZZdCv1DfzgO9WyOGI-xSHe7y_4,32562
118
- pulse/transpiler/vdom.py,sha256=l4CKQlt-wSSFJ7j7cF4dVwqYHWyAT1uAmbgsx0Kk4Jc,6310
118
+ pulse/transpiler/vdom.py,sha256=Ie36iHa2bkUbui5iMClbMSFDGlKaNxI98Ux0JLPCGT4,6399
119
119
  pulse/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
120
  pulse/types/event_handler.py,sha256=psQCydj-WEtBcFU5JU4mDwvyzkW8V2O0g_VFRU2EOHI,1618
121
121
  pulse/user_session.py,sha256=nsnsMgqq2xGJZLpbHRMHUHcLrElMP8WcA4gjGMrcoBk,10208
122
122
  pulse/version.py,sha256=711vaM1jVIQPgkisGgKZqwmw019qZIsc_QTae75K2pg,1895
123
- pulse_framework-0.1.60.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
124
- pulse_framework-0.1.60.dist-info/entry_points.txt,sha256=i7aohd3QaPu5IcuGKKvsQQEiMYMe5HcF56QEsaLVO64,46
125
- pulse_framework-0.1.60.dist-info/METADATA,sha256=2WsEddjjerzG1oroktnH5BSjkptzY4OD6VzCiUge1Kw,8300
126
- pulse_framework-0.1.60.dist-info/RECORD,,
123
+ pulse_framework-0.1.61.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
124
+ pulse_framework-0.1.61.dist-info/entry_points.txt,sha256=i7aohd3QaPu5IcuGKKvsQQEiMYMe5HcF56QEsaLVO64,46
125
+ pulse_framework-0.1.61.dist-info/METADATA,sha256=_rF3PxyuZJ5lKy4-pEX8LP9dZrstrw46DMxMypRNgUg,8300
126
+ pulse_framework-0.1.61.dist-info/RECORD,,