pulse-framework 0.1.62__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 (126) hide show
  1. pulse/__init__.py +1493 -0
  2. pulse/_examples.py +29 -0
  3. pulse/app.py +1086 -0
  4. pulse/channel.py +607 -0
  5. pulse/cli/__init__.py +0 -0
  6. pulse/cli/cmd.py +575 -0
  7. pulse/cli/dependencies.py +181 -0
  8. pulse/cli/folder_lock.py +134 -0
  9. pulse/cli/helpers.py +271 -0
  10. pulse/cli/logging.py +102 -0
  11. pulse/cli/models.py +35 -0
  12. pulse/cli/packages.py +262 -0
  13. pulse/cli/processes.py +292 -0
  14. pulse/cli/secrets.py +39 -0
  15. pulse/cli/uvicorn_log_config.py +87 -0
  16. pulse/code_analysis.py +38 -0
  17. pulse/codegen/__init__.py +0 -0
  18. pulse/codegen/codegen.py +359 -0
  19. pulse/codegen/templates/__init__.py +0 -0
  20. pulse/codegen/templates/layout.py +106 -0
  21. pulse/codegen/templates/route.py +345 -0
  22. pulse/codegen/templates/routes_ts.py +42 -0
  23. pulse/codegen/utils.py +20 -0
  24. pulse/component.py +237 -0
  25. pulse/components/__init__.py +0 -0
  26. pulse/components/for_.py +83 -0
  27. pulse/components/if_.py +86 -0
  28. pulse/components/react_router.py +94 -0
  29. pulse/context.py +108 -0
  30. pulse/cookies.py +322 -0
  31. pulse/decorators.py +344 -0
  32. pulse/dom/__init__.py +0 -0
  33. pulse/dom/elements.py +1024 -0
  34. pulse/dom/events.py +445 -0
  35. pulse/dom/props.py +1250 -0
  36. pulse/dom/svg.py +0 -0
  37. pulse/dom/tags.py +328 -0
  38. pulse/dom/tags.pyi +480 -0
  39. pulse/env.py +178 -0
  40. pulse/form.py +538 -0
  41. pulse/helpers.py +541 -0
  42. pulse/hooks/__init__.py +0 -0
  43. pulse/hooks/core.py +452 -0
  44. pulse/hooks/effects.py +88 -0
  45. pulse/hooks/init.py +668 -0
  46. pulse/hooks/runtime.py +464 -0
  47. pulse/hooks/setup.py +254 -0
  48. pulse/hooks/stable.py +138 -0
  49. pulse/hooks/state.py +192 -0
  50. pulse/js/__init__.py +125 -0
  51. pulse/js/__init__.pyi +115 -0
  52. pulse/js/_types.py +299 -0
  53. pulse/js/array.py +339 -0
  54. pulse/js/console.py +50 -0
  55. pulse/js/date.py +119 -0
  56. pulse/js/document.py +145 -0
  57. pulse/js/error.py +140 -0
  58. pulse/js/json.py +66 -0
  59. pulse/js/map.py +97 -0
  60. pulse/js/math.py +69 -0
  61. pulse/js/navigator.py +79 -0
  62. pulse/js/number.py +57 -0
  63. pulse/js/obj.py +81 -0
  64. pulse/js/object.py +172 -0
  65. pulse/js/promise.py +172 -0
  66. pulse/js/pulse.py +115 -0
  67. pulse/js/react.py +495 -0
  68. pulse/js/regexp.py +57 -0
  69. pulse/js/set.py +124 -0
  70. pulse/js/string.py +38 -0
  71. pulse/js/weakmap.py +53 -0
  72. pulse/js/weakset.py +48 -0
  73. pulse/js/window.py +205 -0
  74. pulse/messages.py +202 -0
  75. pulse/middleware.py +471 -0
  76. pulse/plugin.py +96 -0
  77. pulse/proxy.py +242 -0
  78. pulse/py.typed +0 -0
  79. pulse/queries/__init__.py +0 -0
  80. pulse/queries/client.py +609 -0
  81. pulse/queries/common.py +101 -0
  82. pulse/queries/effect.py +55 -0
  83. pulse/queries/infinite_query.py +1418 -0
  84. pulse/queries/mutation.py +295 -0
  85. pulse/queries/protocol.py +136 -0
  86. pulse/queries/query.py +1314 -0
  87. pulse/queries/store.py +120 -0
  88. pulse/react_component.py +88 -0
  89. pulse/reactive.py +1208 -0
  90. pulse/reactive_extensions.py +1172 -0
  91. pulse/render_session.py +768 -0
  92. pulse/renderer.py +584 -0
  93. pulse/request.py +205 -0
  94. pulse/routing.py +598 -0
  95. pulse/serializer.py +279 -0
  96. pulse/state.py +556 -0
  97. pulse/test_helpers.py +15 -0
  98. pulse/transpiler/__init__.py +111 -0
  99. pulse/transpiler/assets.py +81 -0
  100. pulse/transpiler/builtins.py +1029 -0
  101. pulse/transpiler/dynamic_import.py +130 -0
  102. pulse/transpiler/emit_context.py +49 -0
  103. pulse/transpiler/errors.py +96 -0
  104. pulse/transpiler/function.py +611 -0
  105. pulse/transpiler/id.py +18 -0
  106. pulse/transpiler/imports.py +341 -0
  107. pulse/transpiler/js_module.py +336 -0
  108. pulse/transpiler/modules/__init__.py +33 -0
  109. pulse/transpiler/modules/asyncio.py +57 -0
  110. pulse/transpiler/modules/json.py +24 -0
  111. pulse/transpiler/modules/math.py +265 -0
  112. pulse/transpiler/modules/pulse/__init__.py +5 -0
  113. pulse/transpiler/modules/pulse/tags.py +250 -0
  114. pulse/transpiler/modules/typing.py +63 -0
  115. pulse/transpiler/nodes.py +1987 -0
  116. pulse/transpiler/py_module.py +135 -0
  117. pulse/transpiler/transpiler.py +1100 -0
  118. pulse/transpiler/vdom.py +256 -0
  119. pulse/types/__init__.py +0 -0
  120. pulse/types/event_handler.py +50 -0
  121. pulse/user_session.py +386 -0
  122. pulse/version.py +69 -0
  123. pulse_framework-0.1.62.dist-info/METADATA +198 -0
  124. pulse_framework-0.1.62.dist-info/RECORD +126 -0
  125. pulse_framework-0.1.62.dist-info/WHEEL +4 -0
  126. pulse_framework-0.1.62.dist-info/entry_points.txt +3 -0
pulse/dom/tags.pyi ADDED
@@ -0,0 +1,480 @@
1
+ from typing import Any, Protocol, Unpack
2
+
3
+ from pulse.dom.elements import GenericHTMLElement
4
+ from pulse.dom.props import (
5
+ HTMLAnchorProps,
6
+ HTMLAreaProps,
7
+ HTMLAudioProps,
8
+ HTMLBaseProps,
9
+ HTMLBlockquoteProps,
10
+ HTMLButtonProps,
11
+ HTMLCanvasProps,
12
+ HTMLColgroupProps,
13
+ HTMLColProps,
14
+ HTMLDataProps,
15
+ HTMLDelProps,
16
+ HTMLDetailsProps,
17
+ HTMLDialogProps,
18
+ HTMLEmbedProps,
19
+ HTMLFieldsetProps,
20
+ HTMLFormProps,
21
+ HTMLHtmlProps,
22
+ HTMLIframeProps,
23
+ HTMLImgProps,
24
+ HTMLInputProps,
25
+ HTMLInsProps,
26
+ HTMLLabelProps,
27
+ HTMLLinkProps,
28
+ HTMLLiProps,
29
+ HTMLMapProps,
30
+ HTMLMenuProps,
31
+ HTMLMetaProps,
32
+ HTMLMeterProps,
33
+ HTMLObjectProps,
34
+ HTMLOlProps,
35
+ HTMLOptgroupProps,
36
+ HTMLOptionProps,
37
+ HTMLOutputProps,
38
+ HTMLParamProps,
39
+ HTMLProgressProps,
40
+ HTMLProps,
41
+ HTMLQuoteProps,
42
+ HTMLScriptProps,
43
+ HTMLSelectProps,
44
+ HTMLSourceProps,
45
+ HTMLStyleProps,
46
+ HTMLSVGProps,
47
+ HTMLTableProps,
48
+ HTMLTdProps,
49
+ HTMLTextareaProps,
50
+ HTMLThProps,
51
+ HTMLTimeProps,
52
+ HTMLTrackProps,
53
+ HTMLVideoProps,
54
+ )
55
+ from pulse.transpiler.nodes import Element, Node
56
+
57
+ class Tag(Protocol):
58
+ def __call__(self, *children: Node, **props: Any) -> Element: ...
59
+
60
+ def define_tag(
61
+ name: str,
62
+ default_props: dict[str, Any] | None = None,
63
+ ) -> Tag: ...
64
+ def define_self_closing_tag(
65
+ name: str,
66
+ default_props: dict[str, Any] | None = None,
67
+ ) -> Tag: ...
68
+
69
+ # --- Self-closing tags ----
70
+ def area(*, key: str | None = None, **props: Unpack[HTMLAreaProps]) -> Element: ...
71
+ def base(*, key: str | None = None, **props: Unpack[HTMLBaseProps]) -> Element: ...
72
+ def br(*, key: str | None = None, **props: Unpack[HTMLProps]) -> Element: ...
73
+ def col(*, key: str | None = None, **props: Unpack[HTMLColProps]) -> Element: ...
74
+ def embed(*, key: str | None = None, **props: Unpack[HTMLEmbedProps]) -> Element: ...
75
+ def hr(*, key: str | None = None, **props: Unpack[HTMLProps]) -> Element: ...
76
+ def img(*, key: str | None = None, **props: Unpack[HTMLImgProps]) -> Element: ...
77
+ def input(*, key: str | None = None, **props: Unpack[HTMLInputProps]) -> Element: ...
78
+ def link(*, key: str | None = None, **props: Unpack[HTMLLinkProps]) -> Element: ...
79
+ def meta(*, key: str | None = None, **props: Unpack[HTMLMetaProps]) -> Element: ...
80
+ def param(*, key: str | None = None, **props: Unpack[HTMLParamProps]) -> Element: ...
81
+ def source(*, key: str | None = None, **props: Unpack[HTMLSourceProps]) -> Element: ...
82
+ def track(*, key: str | None = None, **props: Unpack[HTMLTrackProps]) -> Element: ...
83
+ def wbr(*, key: str | None = None, **props: Unpack[HTMLProps]) -> Element: ...
84
+
85
+ # --- Regular tags ---
86
+
87
+ def a(
88
+ *children: Node, key: str | None = None, **props: Unpack[HTMLAnchorProps]
89
+ ) -> Element: ...
90
+ def abbr(
91
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
92
+ ) -> Element: ...
93
+ def address(
94
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
95
+ ) -> Element: ...
96
+ def article(
97
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
98
+ ) -> Element: ...
99
+ def aside(
100
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
101
+ ) -> Element: ...
102
+ def audio(
103
+ *children: Node, key: str | None = None, **props: Unpack[HTMLAudioProps]
104
+ ) -> Element: ...
105
+ def b(
106
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
107
+ ) -> Element: ...
108
+ def bdi(
109
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
110
+ ) -> Element: ...
111
+ def bdo(
112
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
113
+ ) -> Element: ...
114
+ def blockquote(
115
+ *children: Node,
116
+ key: str | None = None,
117
+ **props: Unpack[HTMLBlockquoteProps],
118
+ ) -> Element: ...
119
+ def body(
120
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
121
+ ) -> Element: ...
122
+ def button(
123
+ *children: Node, key: str | None = None, **props: Unpack[HTMLButtonProps]
124
+ ) -> Element: ...
125
+ def canvas(
126
+ *children: Node, key: str | None = None, **props: Unpack[HTMLCanvasProps]
127
+ ) -> Element: ...
128
+ def caption(
129
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
130
+ ) -> Element: ...
131
+ def cite(
132
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
133
+ ) -> Element: ...
134
+ def code(
135
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
136
+ ) -> Element: ...
137
+ def colgroup(
138
+ *children: Node,
139
+ key: str | None = None,
140
+ **props: Unpack[HTMLColgroupProps],
141
+ ) -> Element: ...
142
+ def data(
143
+ *children: Node, key: str | None = None, **props: Unpack[HTMLDataProps]
144
+ ) -> Element: ...
145
+ def datalist(
146
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
147
+ ) -> Element: ...
148
+ def dd(
149
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
150
+ ) -> Element: ...
151
+ def del_(
152
+ *children: Node, key: str | None = None, **props: Unpack[HTMLDelProps]
153
+ ) -> Element: ...
154
+ def details(
155
+ *children: Node,
156
+ key: str | None = None,
157
+ **props: Unpack[HTMLDetailsProps],
158
+ ) -> Element: ...
159
+ def dfn(
160
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
161
+ ) -> Element: ...
162
+ def dialog(
163
+ *children: Node, key: str | None = None, **props: Unpack[HTMLDialogProps]
164
+ ) -> Element: ...
165
+ def div(
166
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
167
+ ) -> Element: ...
168
+ def dl(
169
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
170
+ ) -> Element: ...
171
+ def dt(
172
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
173
+ ) -> Element: ...
174
+ def em(
175
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
176
+ ) -> Element: ...
177
+ def fieldset(
178
+ *children: Node,
179
+ key: str | None = None,
180
+ **props: Unpack[HTMLFieldsetProps],
181
+ ) -> Element: ...
182
+ def figcaption(
183
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
184
+ ) -> Element: ...
185
+ def figure(
186
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
187
+ ) -> Element: ...
188
+ def footer(
189
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
190
+ ) -> Element: ...
191
+ def form(
192
+ *children: Node, key: str | None = None, **props: Unpack[HTMLFormProps]
193
+ ) -> Element: ...
194
+ def h1(
195
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
196
+ ) -> Element: ...
197
+ def h2(
198
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
199
+ ) -> Element: ...
200
+ def h3(
201
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
202
+ ) -> Element: ...
203
+ def h4(
204
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
205
+ ) -> Element: ...
206
+ def h5(
207
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
208
+ ) -> Element: ...
209
+ def h6(
210
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
211
+ ) -> Element: ...
212
+ def head(
213
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
214
+ ) -> Element: ...
215
+ def header(
216
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
217
+ ) -> Element: ...
218
+ def hgroup(
219
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
220
+ ) -> Element: ...
221
+ def html(
222
+ *children: Node, key: str | None = None, **props: Unpack[HTMLHtmlProps]
223
+ ) -> Element: ...
224
+ def i(
225
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
226
+ ) -> Element: ...
227
+ def iframe(
228
+ *children: Node, key: str | None = None, **props: Unpack[HTMLIframeProps]
229
+ ) -> Element: ...
230
+ def ins(
231
+ *children: Node, key: str | None = None, **props: Unpack[HTMLInsProps]
232
+ ) -> Element: ...
233
+ def kbd(
234
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
235
+ ) -> Element: ...
236
+ def label(
237
+ *children: Node, key: str | None = None, **props: Unpack[HTMLLabelProps]
238
+ ) -> Element: ...
239
+ def legend(
240
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
241
+ ) -> Element: ...
242
+ def li(
243
+ *children: Node, key: str | None = None, **props: Unpack[HTMLLiProps]
244
+ ) -> Element: ...
245
+ def main(
246
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
247
+ ) -> Element: ...
248
+ def map_(
249
+ *children: Node, key: str | None = None, **props: Unpack[HTMLMapProps]
250
+ ) -> Element: ...
251
+ def mark(
252
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
253
+ ) -> Element: ...
254
+ def menu(
255
+ *children: Node, key: str | None = None, **props: Unpack[HTMLMenuProps]
256
+ ) -> Element: ...
257
+ def meter(
258
+ *children: Node, key: str | None = None, **props: Unpack[HTMLMeterProps]
259
+ ) -> Element: ...
260
+ def nav(
261
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
262
+ ) -> Element: ...
263
+ def noscript(
264
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
265
+ ) -> Element: ...
266
+ def object_(
267
+ *children: Node, key: str | None = None, **props: Unpack[HTMLObjectProps]
268
+ ) -> Element: ...
269
+ def ol(
270
+ *children: Node, key: str | None = None, **props: Unpack[HTMLOlProps]
271
+ ) -> Element: ...
272
+ def optgroup(
273
+ *children: Node,
274
+ key: str | None = None,
275
+ **props: Unpack[HTMLOptgroupProps],
276
+ ) -> Element: ...
277
+ def option(
278
+ *children: Node, key: str | None = None, **props: Unpack[HTMLOptionProps]
279
+ ) -> Element: ...
280
+ def output(
281
+ *children: Node, key: str | None = None, **props: Unpack[HTMLOutputProps]
282
+ ) -> Element: ...
283
+ def p(
284
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
285
+ ) -> Element: ...
286
+ def picture(
287
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
288
+ ) -> Element: ...
289
+ def pre(
290
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
291
+ ) -> Element: ...
292
+ def progress(
293
+ *children: Node,
294
+ key: str | None = None,
295
+ **props: Unpack[HTMLProgressProps],
296
+ ) -> Element: ...
297
+ def q(
298
+ *children: Node, key: str | None = None, **props: Unpack[HTMLQuoteProps]
299
+ ) -> Element: ...
300
+ def rp(
301
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
302
+ ) -> Element: ...
303
+ def rt(
304
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
305
+ ) -> Element: ...
306
+ def ruby(
307
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
308
+ ) -> Element: ...
309
+ def s(
310
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
311
+ ) -> Element: ...
312
+ def samp(
313
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
314
+ ) -> Element: ...
315
+ def script(
316
+ *children: Node, key: str | None = None, **props: Unpack[HTMLScriptProps]
317
+ ) -> Element: ...
318
+ def section(
319
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
320
+ ) -> Element: ...
321
+ def select(
322
+ *children: Node, key: str | None = None, **props: Unpack[HTMLSelectProps]
323
+ ) -> Element: ...
324
+ def small(
325
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
326
+ ) -> Element: ...
327
+ def span(
328
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
329
+ ) -> Element: ...
330
+ def strong(
331
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
332
+ ) -> Element: ...
333
+ def style(
334
+ *children: Node, key: str | None = None, **props: Unpack[HTMLStyleProps]
335
+ ) -> Element: ...
336
+ def sub(
337
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
338
+ ) -> Element: ...
339
+ def summary(
340
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
341
+ ) -> Element: ...
342
+ def sup(
343
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
344
+ ) -> Element: ...
345
+ def table(
346
+ *children: Node, key: str | None = None, **props: Unpack[HTMLTableProps]
347
+ ) -> Element: ...
348
+ def tbody(
349
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
350
+ ) -> Element: ...
351
+ def td(
352
+ *children: Node, key: str | None = None, **props: Unpack[HTMLTdProps]
353
+ ) -> Element: ...
354
+ def template(
355
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
356
+ ) -> Element: ...
357
+ def textarea(
358
+ *children: Node,
359
+ key: str | None = None,
360
+ **props: Unpack[HTMLTextareaProps],
361
+ ) -> Element: ...
362
+ def tfoot(
363
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
364
+ ) -> Element: ...
365
+ def th(
366
+ *children: Node, key: str | None = None, **props: Unpack[HTMLThProps]
367
+ ) -> Element: ...
368
+ def thead(
369
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
370
+ ) -> Element: ...
371
+ def time(
372
+ *children: Node, key: str | None = None, **props: Unpack[HTMLTimeProps]
373
+ ) -> Element: ...
374
+ def title(
375
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
376
+ ) -> Element: ...
377
+ def tr(
378
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
379
+ ) -> Element: ...
380
+ def u(
381
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
382
+ ) -> Element: ...
383
+ def ul(
384
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
385
+ ) -> Element: ...
386
+ def var(
387
+ *children: Node, key: str | None = None, **props: Unpack[HTMLProps]
388
+ ) -> Element: ...
389
+ def video(
390
+ *children: Node, key: str | None = None, **props: Unpack[HTMLVideoProps]
391
+ ) -> Element: ...
392
+
393
+ # -- React Fragment ---
394
+ def fragment(*children: Node, key: str | None = None) -> Element: ...
395
+
396
+ # -- SVG --
397
+ def svg(
398
+ *children: Node,
399
+ key: str | None = None,
400
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
401
+ ) -> Element: ...
402
+ def circle(
403
+ *children: Node,
404
+ key: str | None = None,
405
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
406
+ ) -> Element: ...
407
+ def ellipse(
408
+ *children: Node,
409
+ key: str | None = None,
410
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
411
+ ) -> Element: ...
412
+ def g(
413
+ *children: Node,
414
+ key: str | None = None,
415
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
416
+ ) -> Element: ...
417
+ def line(
418
+ *children: Node,
419
+ key: str | None = None,
420
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
421
+ ) -> Element: ...
422
+ def path(
423
+ *children: Node,
424
+ key: str | None = None,
425
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
426
+ ) -> Element: ...
427
+ def polygon(
428
+ *children: Node,
429
+ key: str | None = None,
430
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
431
+ ) -> Element: ...
432
+ def polyline(
433
+ *children: Node,
434
+ key: str | None = None,
435
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
436
+ ) -> Element: ...
437
+ def rect(
438
+ *children: Node,
439
+ key: str | None = None,
440
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
441
+ ) -> Element: ...
442
+ def text(
443
+ *children: Node,
444
+ key: str | None = None,
445
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
446
+ ) -> Element: ...
447
+ def tspan(
448
+ *children: Node,
449
+ key: str | None = None,
450
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
451
+ ) -> Element: ...
452
+ def defs(
453
+ *children: Node,
454
+ key: str | None = None,
455
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
456
+ ) -> Element: ...
457
+ def clipPath(
458
+ *children: Node,
459
+ key: str | None = None,
460
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
461
+ ) -> Element: ...
462
+ def mask(
463
+ *children: Node,
464
+ key: str | None = None,
465
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
466
+ ) -> Element: ...
467
+ def pattern(
468
+ *children: Node,
469
+ key: str | None = None,
470
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
471
+ ) -> Element: ...
472
+ def use(
473
+ *children: Node,
474
+ key: str | None = None,
475
+ **props: Unpack[HTMLSVGProps[GenericHTMLElement]],
476
+ ) -> Element: ...
477
+
478
+ # Lists exported for JS transpiler
479
+ TAGS: list[tuple[str, dict[str, Any] | None]]
480
+ SELF_CLOSING_TAGS: list[tuple[str, dict[str, Any] | None]]
pulse/env.py ADDED
@@ -0,0 +1,178 @@
1
+ """
2
+ Centralized environment variable definitions and typed accessors for Pulse.
3
+
4
+ Preferred usage:
5
+
6
+ from pulse.env import env
7
+ env.pulse_env = "prod"
8
+ if env.running_cli:
9
+ ...
10
+
11
+ You can still import constants for passing into subprocess env dicts.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import os
17
+ from typing import Literal
18
+
19
+ # Types
20
+ PulseEnv = Literal["dev", "ci", "prod"]
21
+ """Environment type for the Pulse application.
22
+
23
+ Values:
24
+ "dev": Development environment with hot reload and debugging.
25
+ "ci": Continuous integration environment for testing.
26
+ "prod": Production environment with optimizations enabled.
27
+ """
28
+
29
+ # Keys
30
+ ENV_PULSE_ENV = "PULSE_ENV"
31
+ ENV_PULSE_APP_FILE = "PULSE_APP_FILE"
32
+ ENV_PULSE_APP_DIR = "PULSE_APP_DIR"
33
+ ENV_PULSE_HOST = "PULSE_HOST"
34
+ ENV_PULSE_PORT = "PULSE_PORT"
35
+ ENV_PULSE_REACT_SERVER_ADDRESS = "PULSE_REACT_SERVER_ADDRESS"
36
+ ENV_PULSE_SECRET = "PULSE_SECRET"
37
+ ENV_PULSE_DISABLE_CODEGEN = "PULSE_DISABLE_CODEGEN"
38
+
39
+
40
+ class EnvVars:
41
+ """Singleton accessor for Pulse environment variables.
42
+
43
+ Provides typed getters and setters for all Pulse-related environment
44
+ variables. Access via the `env` singleton instance.
45
+
46
+ Example:
47
+ ```python
48
+ from pulse.env import env
49
+
50
+ env.pulse_env = "prod"
51
+ if env.pulse_env == "dev":
52
+ print(f"Running on {env.pulse_host}:{env.pulse_port}")
53
+ ```
54
+
55
+ Attributes:
56
+ pulse_env: Current environment ("dev", "ci", "prod").
57
+ pulse_host: Server hostname. Defaults to "localhost".
58
+ pulse_port: Server port number. Defaults to 8000.
59
+ pulse_secret: Secret key for JWT session signing.
60
+ codegen_disabled: If True, skip code generation.
61
+ """
62
+
63
+ def _get(self, key: str) -> str | None:
64
+ return os.environ.get(key)
65
+
66
+ def _set(self, key: str, value: str | None) -> None:
67
+ if value is None:
68
+ os.environ.pop(key, None)
69
+ else:
70
+ os.environ[key] = value
71
+
72
+ @property
73
+ def pulse_env(self) -> PulseEnv:
74
+ value = (self._get(ENV_PULSE_ENV) or "dev").lower()
75
+ if value not in ("dev", "ci", "prod"):
76
+ value = "dev"
77
+ return value
78
+
79
+ @pulse_env.setter
80
+ def pulse_env(self, value: PulseEnv) -> None:
81
+ self._set(ENV_PULSE_ENV, value)
82
+
83
+ # App file/dir
84
+ @property
85
+ def pulse_app_file(self) -> str | None:
86
+ return self._get(ENV_PULSE_APP_FILE)
87
+
88
+ @pulse_app_file.setter
89
+ def pulse_app_file(self, value: str | None) -> None:
90
+ self._set(ENV_PULSE_APP_FILE, value)
91
+
92
+ @property
93
+ def pulse_app_dir(self) -> str | None:
94
+ return self._get(ENV_PULSE_APP_DIR)
95
+
96
+ @pulse_app_dir.setter
97
+ def pulse_app_dir(self, value: str | None) -> None:
98
+ self._set(ENV_PULSE_APP_DIR, value)
99
+
100
+ # Host/port
101
+ @property
102
+ def pulse_host(self) -> str:
103
+ return self._get(ENV_PULSE_HOST) or "localhost"
104
+
105
+ @pulse_host.setter
106
+ def pulse_host(self, value: str) -> None:
107
+ self._set(ENV_PULSE_HOST, value)
108
+
109
+ @property
110
+ def pulse_port(self) -> int:
111
+ try:
112
+ return int(self._get(ENV_PULSE_PORT) or 8000)
113
+ except Exception:
114
+ return 8000
115
+
116
+ @pulse_port.setter
117
+ def pulse_port(self, value: int) -> None:
118
+ self._set(ENV_PULSE_PORT, str(value))
119
+
120
+ @property
121
+ def react_server_address(self) -> str | None:
122
+ return self._get(ENV_PULSE_REACT_SERVER_ADDRESS)
123
+
124
+ @react_server_address.setter
125
+ def react_server_address(self, value: str | None) -> None:
126
+ self._set(ENV_PULSE_REACT_SERVER_ADDRESS, value)
127
+
128
+ # Secrets
129
+ @property
130
+ def pulse_secret(self) -> str | None:
131
+ return self._get(ENV_PULSE_SECRET)
132
+
133
+ @pulse_secret.setter
134
+ def pulse_secret(self, value: str | None) -> None:
135
+ self._set(ENV_PULSE_SECRET, value)
136
+
137
+ # Flags
138
+ @property
139
+ def codegen_disabled(self) -> bool:
140
+ return self._get(ENV_PULSE_DISABLE_CODEGEN) == "1"
141
+
142
+ @codegen_disabled.setter
143
+ def codegen_disabled(self, value: bool) -> None:
144
+ self._set(ENV_PULSE_DISABLE_CODEGEN, "1" if value else None)
145
+
146
+
147
+ # Singleton
148
+ env = EnvVars()
149
+ """Singleton instance for accessing Pulse environment variables.
150
+
151
+ Example:
152
+ ```python
153
+ from pulse.env import env
154
+
155
+ env.pulse_env = "prod"
156
+ print(env.pulse_host) # "localhost"
157
+ print(env.pulse_port) # 8000
158
+ ```
159
+ """
160
+
161
+
162
+ def mode() -> PulseEnv:
163
+ """Returns the current pulse_env value.
164
+
165
+ Shorthand for `env.pulse_env`.
166
+
167
+ Returns:
168
+ The current environment: "dev", "ci", or "prod".
169
+
170
+ Example:
171
+ ```python
172
+ from pulse.env import mode
173
+
174
+ if mode() == "dev":
175
+ enable_debug_toolbar()
176
+ ```
177
+ """
178
+ return env.pulse_env