teloce-py 0.3.0__tar.gz → 0.3.2__tar.gz

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 (187) hide show
  1. teloce_py-0.3.2/PKG-INFO +233 -0
  2. teloce_py-0.3.2/README.md +198 -0
  3. teloce_py-0.3.2/src/teloce/bridge/__init__.py +70 -0
  4. teloce_py-0.3.2/src/teloce/bridge/actions.py +465 -0
  5. teloce_py-0.3.2/src/teloce/bridge/channels.py +239 -0
  6. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/build/builder.py +19 -4
  7. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/build.py +2 -2
  8. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/dev.py +1 -1
  9. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/watch.py +1 -1
  10. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/compiler/compiler.py +61 -9
  11. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/compiler/generator.py +51 -1
  12. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/compiler/lexer.py +70 -78
  13. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/compiler/optimizer.py +51 -24
  14. teloce_py-0.3.2/src/teloce/compiler/source_map.py +246 -0
  15. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/css/parser.py +157 -133
  16. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/css/scoped.py +288 -270
  17. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/javascript/parser.py +1117 -787
  18. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/javascript/tree_sitter_backend.py +111 -7
  19. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/plugins/builtin.py +88 -6
  20. teloce_py-0.3.2/src/teloce/plugins/pwa_server.py +139 -0
  21. teloce_py-0.3.2/src/teloce/runtime/network.js +685 -0
  22. teloce_py-0.3.2/src/teloce/runtime/plugins/pwa.js +82 -0
  23. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/runtime.js +1 -0
  24. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/server/__init__.py +9 -1
  25. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/server/compiler.py +28 -12
  26. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/server/renderer.py +214 -29
  27. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/sfc/script.py +46 -45
  28. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/typecheck/adapter.py +523 -109
  29. teloce_py-0.3.2/src/teloce/version.py +6 -0
  30. teloce_py-0.3.2/src/teloce_py.egg-info/PKG-INFO +233 -0
  31. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce_py.egg-info/SOURCES.txt +8 -1
  32. {teloce_py-0.3.0 → teloce_py-0.3.2}/tests/test_typecheck.py +4 -4
  33. teloce_py-0.3.2/tests/test_typecheck_extended.py +150 -0
  34. teloce_py-0.3.2/tests/test_typecheck_runtime.py +159 -0
  35. teloce_py-0.3.0/PKG-INFO +0 -179
  36. teloce_py-0.3.0/README.md +0 -144
  37. teloce_py-0.3.0/src/teloce/compiler/source_map.py +0 -100
  38. teloce_py-0.3.0/src/teloce/runtime/plugins/pwa.js +0 -25
  39. teloce_py-0.3.0/src/teloce/version.py +0 -6
  40. teloce_py-0.3.0/src/teloce_py.egg-info/PKG-INFO +0 -179
  41. {teloce_py-0.3.0 → teloce_py-0.3.2}/LICENSE +0 -0
  42. {teloce_py-0.3.0 → teloce_py-0.3.2}/MANIFEST.in +0 -0
  43. {teloce_py-0.3.0 → teloce_py-0.3.2}/docs/publishing.md +0 -0
  44. {teloce_py-0.3.0 → teloce_py-0.3.2}/pyproject.toml +0 -0
  45. {teloce_py-0.3.0 → teloce_py-0.3.2}/scripts/publish.py +0 -0
  46. {teloce_py-0.3.0 → teloce_py-0.3.2}/setup.cfg +0 -0
  47. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/__init__.py +0 -0
  48. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/__main__.py +0 -0
  49. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/ast/__init__.py +0 -0
  50. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/ast/components.py +0 -0
  51. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/ast/elements.py +0 -0
  52. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/ast/expressions.py +0 -0
  53. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/ast/nodes.py +0 -0
  54. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/ast/visitors.py +0 -0
  55. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/build/__init__.py +0 -0
  56. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/build/assets.py +0 -0
  57. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/build/bundler.py +0 -0
  58. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/build/esbuild.py +0 -0
  59. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/build/manifest.py +0 -0
  60. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/build/minifyjs.py +0 -0
  61. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/build/writer.py +0 -0
  62. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/__init__.py +0 -0
  63. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/benchmark.py +0 -0
  64. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/compile.py +0 -0
  65. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/component.py +0 -0
  66. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/create.py +0 -0
  67. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/debug.py +0 -0
  68. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/doctor.py +0 -0
  69. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/lint.py +0 -0
  70. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/main.py +0 -0
  71. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/prerender.py +0 -0
  72. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/server.py +0 -0
  73. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/cli/typecheck.py +0 -0
  74. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/compiler/__init__.py +0 -0
  75. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/compiler/diagnostics.py +0 -0
  76. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/compiler/minifier.py +0 -0
  77. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/compiler/parser.py +0 -0
  78. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/compiler/transformer.py +0 -0
  79. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/components/__init__.py +0 -0
  80. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/components/dependency_graph.py +0 -0
  81. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/components/imports.py +0 -0
  82. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/components/registry.py +0 -0
  83. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/components/resolver.py +0 -0
  84. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/css/__init__.py +0 -0
  85. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/css/generator.py +0 -0
  86. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/css/hashing.py +0 -0
  87. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/css/modules.py +0 -0
  88. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/data.py +0 -0
  89. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/debug/__init__.py +0 -0
  90. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/debug/dashboard.py +0 -0
  91. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/debug/errors.py +0 -0
  92. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/debug/formatter.py +0 -0
  93. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/debug/suggestions.py +0 -0
  94. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/directives/__init__.py +0 -0
  95. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/directives/advanced.py +0 -0
  96. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/directives/base.py +0 -0
  97. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/directives/bind.py +0 -0
  98. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/directives/events.py +0 -0
  99. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/directives/for_.py +0 -0
  100. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/directives/if_.py +0 -0
  101. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/directives/model.py +0 -0
  102. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/directives/registry.py +0 -0
  103. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/directives/show.py +0 -0
  104. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/expressions/__init__.py +0 -0
  105. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/expressions/ast.py +0 -0
  106. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/expressions/generator.py +0 -0
  107. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/expressions/lexer.py +0 -0
  108. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/expressions/parser.py +0 -0
  109. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/filters/__init__.py +0 -0
  110. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/filters/arrays.py +0 -0
  111. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/filters/dates.py +0 -0
  112. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/filters/numbers.py +0 -0
  113. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/filters/objects.py +0 -0
  114. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/filters/registry.py +0 -0
  115. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/filters/strings.py +0 -0
  116. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/javascript/__init__.py +0 -0
  117. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/javascript/dom.py +0 -0
  118. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/javascript/exports.py +0 -0
  119. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/javascript/generator.py +0 -0
  120. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/javascript/helpers.py +0 -0
  121. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/javascript/imports.py +0 -0
  122. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/javascript/module.py +0 -0
  123. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/javascript/ts_transpile.py +0 -0
  124. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/plugins/__init__.py +0 -0
  125. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/plugins/api.py +0 -0
  126. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/plugins/directives.py +0 -0
  127. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/plugins/filters.py +0 -0
  128. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/plugins/hooks.py +0 -0
  129. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/plugins/registry.py +0 -0
  130. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/project/__init__.py +0 -0
  131. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/project/configuration.py +0 -0
  132. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/project/discovery.py +0 -0
  133. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/project/extensions.py +0 -0
  134. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/project/paths.py +0 -0
  135. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/project/scanner.py +0 -0
  136. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/router/__init__.py +0 -0
  137. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/router/compiler.py +0 -0
  138. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/router/facade.py +0 -0
  139. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/router/generator.py +0 -0
  140. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/__init__.py +0 -0
  141. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/compiled.js +0 -0
  142. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/component.js +0 -0
  143. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/computed.js +0 -0
  144. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/contracts.js +0 -0
  145. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/data.js +0 -0
  146. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/directive-contracts.js +0 -0
  147. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/dom.js +0 -0
  148. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/effects.js +0 -0
  149. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/events.js +0 -0
  150. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/lifecycle.js +0 -0
  151. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/plugins/accessibility.js +0 -0
  152. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/plugins/forms.js +0 -0
  153. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/plugins/head.js +0 -0
  154. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/plugins/i18n.js +0 -0
  155. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/props.js +0 -0
  156. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/reactivity.js +0 -0
  157. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/scheduler.js +0 -0
  158. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/signals.js +0 -0
  159. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/slots.js +0 -0
  160. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/standalone.js +0 -0
  161. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/runtime/table.js +0 -0
  162. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/server/expressions.py +0 -0
  163. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/sfc/__init__.py +0 -0
  164. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/sfc/component.py +0 -0
  165. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/sfc/parser.py +0 -0
  166. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/sfc/sections.py +0 -0
  167. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/sfc/style.py +0 -0
  168. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/sfc/template.py +0 -0
  169. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/ssr.py +0 -0
  170. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/template/__init__.py +0 -0
  171. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/template/components.py +0 -0
  172. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/template/conditions.py +0 -0
  173. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/template/directives.py +0 -0
  174. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/template/expressions.py +0 -0
  175. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/template/interpolation.py +0 -0
  176. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/template/lexer.py +0 -0
  177. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/template/loops.py +0 -0
  178. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/template/parser.py +0 -0
  179. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/template/slots.py +0 -0
  180. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/typecheck/__init__.py +0 -0
  181. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/watcher/__init__.py +0 -0
  182. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce/watcher/watcher.py +0 -0
  183. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce_py.egg-info/dependency_links.txt +0 -0
  184. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce_py.egg-info/entry_points.txt +0 -0
  185. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce_py.egg-info/requires.txt +0 -0
  186. {teloce_py-0.3.0 → teloce_py-0.3.2}/src/teloce_py.egg-info/top_level.txt +0 -0
  187. {teloce_py-0.3.0 → teloce_py-0.3.2}/tests/test_publish_script.py +0 -0
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: teloce-py
3
+ Version: 0.3.2
4
+ Summary: Python-native compiler and runtime for Teloce .vel Single File Components
5
+ Author: Aldane Hutchinson
6
+ Maintainer: Aldane Hutchinson
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/aldanedev-create/teloce-py
9
+ Project-URL: Documentation, https://github.com/aldanedev-create/teloce-py/tree/main/docs
10
+ Project-URL: Repository, https://github.com/aldanedev-create/teloce-py
11
+ Project-URL: Issues, https://github.com/aldanedev-create/teloce-py/issues
12
+ Project-URL: Changelog, https://github.com/aldanedev-create/teloce-py/blob/main/CHANGELOG.md
13
+ Keywords: teloce,compiler,sfc,template-engine,python,flask,django,fastapi,flaxon
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Programming Language :: Python :: 3.15
23
+ Classifier: Topic :: Software Development :: Compilers
24
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: minifyjs<0.2,>=0.1.3
29
+ Requires-Dist: tree-sitter<0.27,>=0.26
30
+ Requires-Dist: tree-sitter-javascript<0.26,>=0.25
31
+ Requires-Dist: tree-sitter-typescript<0.24,>=0.23
32
+ Provides-Extra: typecheck
33
+ Requires-Dist: pytscheck<0.2,>=0.1.1; python_version >= "3.11" and extra == "typecheck"
34
+ Dynamic: license-file
35
+
36
+ # Teloce-Py
37
+
38
+ \<p align="center">
39
+ &#x20; \<img src="[https://raw.githubusercontent.com/Flaxon-labs/teloce-py/main/assets/py-teloce.jpg](https://raw.githubusercontent.com/Flaxon-labs/teloce-py/main/assets/py-teloce.jpg)" alt="Teloce-Py logo" width="160"/>
40
+ \</p>
41
+
42
+ \<p align="center"> Build interactive Python apps with \<code>.vel\</code> components. No Node.js required. \</p>
43
+
44
+ \<p align="center"> \<a href="[https://pypi.org/project/teloce-py/](https://pypi.org/project/teloce-py/)">\<img src="[https://img.shields.io/pypi/v/teloce-py](https://img.shields.io/pypi/v/teloce-py)" alt="PyPI version">\</a> \<a href="LICENSE">\<img src="[https://img.shields.io/badge/license-MIT-blue](https://img.shields.io/badge/license-MIT-blue)" alt="MIT license">\</a> \<a href="[https://github.com/aldanedev-create/teloce-py/blob/main/docs/README.md](https://github.com/aldanedev-create/teloce-py/blob/main/docs/README.md)">\<img src="[https://img.shields.io/badge/docs-read-green](https://img.shields.io/badge/docs-read-green)" alt="Documentation">\</a> \</p>
45
+
46
+ Teloce-Py compiles a template, browser behavior, and scoped CSS from a single `.vel` file into plain browser assets. Your Python framework (Flask, FastAPI, Django, or Flaxon) keeps handling routes, APIs, databases, auth, and security.
47
+
48
+ ## Features
49
+
50
+ - **Single-file components:** Template, script, and scoped style in one `.vel` file.
51
+ - **Bring your own backend:** Works with Flask, FastAPI, Django, and Flaxon.
52
+ - **No Node.js:** Production builds use [MinifyJS](https://github.com/aldanedev-create/teloce-py/blob/main/docs/minifyjs.md), a native esbuild engine bundled in the wheel.
53
+ - **Fast builds:** Tree shaking, mangling, code splitting, source maps, and hashed assets.
54
+
55
+ ## Teloce Ecosystem
56
+
57
+ Teloce is designed to support both Python-based application development and JavaScript-based workflows.
58
+
59
+ ### Teloce-Py
60
+
61
+ [Teloce-Py](https://github.com/aldanedev-create/teloce-py) is the Python implementation. It lets developers build applications using `.vel` single-file components without requiring Node.js.
62
+
63
+ It integrates with Python web frameworks and handles component compilation, scoped styles, browser assets, and production builds.
64
+
65
+ ### Teloce-NPM
66
+
67
+ [Teloce-NPM](https://github.com/aldanedev-create/teloce-npm) is the companion npm project for the Teloce ecosystem.
68
+
69
+ It provides npm-based tooling and packages for developers working with Teloce and JavaScript-based projects. It complements Teloce-Py by supporting workflows outside the Python package environment.
70
+
71
+ **Explore Teloce-NPM:**
72
+
73
+ - [Teloce-NPM repository](https://github.com/aldanedev-create/teloce-npm)
74
+ - [Three.js example](https://github.com/aldanedev-create/teloce-npm/tree/main/examples/three-example)
75
+
76
+ The [Three.js example](https://github.com/aldanedev-create/teloce-npm/tree/main/examples/three-example) demonstrates using Teloce-NPM in a project with Three.js.
77
+
78
+ Together, Teloce-Py and Teloce-NPM provide different ways to work with the Teloce ecosystem.
79
+
80
+ ## Getting Started
81
+
82
+ Install:
83
+
84
+ ```bash
85
+ python -m pip install teloce-py Flask
86
+ ```
87
+
88
+ Create `static/js/App.vel`:
89
+
90
+ ```html
91
+ <script>
92
+ export default {
93
+ data() { return { count: 0 }; },
94
+ methods: {
95
+ increment() { this.count += 1; }
96
+ }
97
+ };
98
+ </script>
99
+
100
+ <template>
101
+ <button @click="increment">Clicked {{ count }} times</button>
102
+ </template>
103
+ ```
104
+
105
+ Create `app.py`:
106
+
107
+ ```python
108
+ from pathlib import Path
109
+ from flask import Flask, render_template
110
+ from teloce.build import build_project
111
+
112
+ ROOT = Path(__file__).parent
113
+ build_project(ROOT, out_dir=ROOT / "dist", options={"dev": True})
114
+
115
+ app = Flask(
116
+ __name__,
117
+ static_folder="dist/static",
118
+ static_url_path="/static"
119
+ )
120
+
121
+ @app.get("/")
122
+ def home():
123
+ return render_template("app.html")
124
+
125
+ if __name__ == "__main__":
126
+ app.run(debug=True)
127
+ ```
128
+
129
+ Create `templates/app.html`:
130
+
131
+ ```html
132
+ <!doctype html>
133
+ <html>
134
+ <body>
135
+ <div id="app"></div>
136
+ <script type="module">
137
+ import { mount } from "{{ url_for('static', filename='js/App.js') }}";
138
+ mount("#app");
139
+ </script>
140
+ </body>
141
+ </html>
142
+ ```
143
+
144
+ Run it and open [http://127.0.0.1:5000](http://127.0.0.1:5000):
145
+
146
+ ```bash
147
+ python app.py
148
+ ```
149
+
150
+ ## Project Structure
151
+
152
+ ```text
153
+ my-app/
154
+ ├── app.py
155
+ ├── teloce.config.json
156
+ ├── static/
157
+ │ └── js/
158
+ │ └── App.vel # Your source
159
+ ├── templates/
160
+ │ └── app.html # HTML shell with #app mount
161
+ └── dist/ # Generated, never edit by hand
162
+ ```
163
+
164
+ ## Production Build
165
+
166
+ ```bash
167
+ teloce lint --strict
168
+ teloce build --source-map --hash-assets --bundle --report
169
+ ```
170
+
171
+ Teloce strips common TypeScript syntax during compilation. The optional `teloce typecheck` command checks scripts and supported template expressions with PyTSCheck.
172
+
173
+ ## Documentation
174
+
175
+ - [Documentation](https://github.com/aldanedev-create/teloce-py/blob/main/docs/README.md)
176
+ - [Network API: http, action, socket](docs/network-api.md)
177
+ - [Project structure](https://github.com/aldanedev-create/teloce-py/blob/main/docs/lessons/file-structure.md)
178
+ - [Examples](https://github.com/aldanedev-create/teloce-py/blob/main/examples/README.md):
179
+ - [Flask chat](examples/flask-chat)
180
+ - [FastAPI CMS](https://github.com/aldanedev-create/teloce-py/tree/main/examples/fastapi-cms)
181
+ - [Django Admin](examples/django-admin-vel)
182
+ - [Django scanner](https://github.com/aldanedev-create/teloce-py/tree/main/examples/django-scanner)
183
+ - [Flaxon network](https://github.com/aldanedev-create/teloce-py/tree/main/examples/flaxon-network)
184
+ - [Gallery](https://github.com/aldanedev-create/teloce-py/tree/main/examples/teloce-gallery)
185
+
186
+ ## Status
187
+
188
+ Teloce-Py is in beta. Pin your version and test generated assets on your target framework and platform.
189
+
190
+ ## License
191
+
192
+ [MIT](https://github.com/aldanedev-create/teloce-py/blob/main/LICENSE)
193
+
194
+ ## Runtime Contributor Checks
195
+
196
+ The JavaScript runtime uses JSDoc types with a development-only checker:
197
+
198
+ ```bash
199
+ npm ci --ignore-scripts
200
+ npm run typecheck
201
+ ```
202
+
203
+ See [coverage and workflow](https://github.com/aldanedev-create/teloce-py/blob/main/docs/runtime-typechecking.md).
204
+
205
+ Runtime files stay `.js`; Python application users do not need Node or TypeScript.
206
+
207
+ ## Optional Component Type Checking
208
+
209
+ On Python 3.11+, install:
210
+
211
+ ```bash
212
+ pip install "teloce-py[typecheck]"
213
+ ```
214
+
215
+ Then run:
216
+
217
+ ```bash
218
+ teloce typecheck ui
219
+ ```
220
+
221
+ Or use JSON output for CI:
222
+
223
+ ```bash
224
+ teloce typecheck ui --json
225
+ ```
226
+
227
+ This checks TypeScript script blocks, `.ts` files/declarations, and supported template expressions using the bundled PyTSCheck compiler.
228
+
229
+ See the [type-checking guide](https://github.com/aldanedev-create/teloce-py/blob/main/docs/typecheck.md) for API examples, diagnostic locations, optional dependency handling, and prototype limits.
230
+
231
+ Plain JavaScript components are skipped. Project tsconfig settings and dependency declarations are inherited automatically; object-style props infer supported constructor types. Props passed to statically imported TypeScript children are validated. Array-style prop values, dynamic children, and some import forms remain limited.
232
+
233
+ You can also explore this [Teloce-NPM Three.js example](https://github.com/aldanedev-create/teloce-npm/tree/main/examples/three-example).
@@ -0,0 +1,198 @@
1
+ # Teloce-Py
2
+
3
+ \<p align="center">
4
+ &#x20; \<img src="[https://raw.githubusercontent.com/Flaxon-labs/teloce-py/main/assets/py-teloce.jpg](https://raw.githubusercontent.com/Flaxon-labs/teloce-py/main/assets/py-teloce.jpg)" alt="Teloce-Py logo" width="160"/>
5
+ \</p>
6
+
7
+ \<p align="center"> Build interactive Python apps with \<code>.vel\</code> components. No Node.js required. \</p>
8
+
9
+ \<p align="center"> \<a href="[https://pypi.org/project/teloce-py/](https://pypi.org/project/teloce-py/)">\<img src="[https://img.shields.io/pypi/v/teloce-py](https://img.shields.io/pypi/v/teloce-py)" alt="PyPI version">\</a> \<a href="LICENSE">\<img src="[https://img.shields.io/badge/license-MIT-blue](https://img.shields.io/badge/license-MIT-blue)" alt="MIT license">\</a> \<a href="[https://github.com/aldanedev-create/teloce-py/blob/main/docs/README.md](https://github.com/aldanedev-create/teloce-py/blob/main/docs/README.md)">\<img src="[https://img.shields.io/badge/docs-read-green](https://img.shields.io/badge/docs-read-green)" alt="Documentation">\</a> \</p>
10
+
11
+ Teloce-Py compiles a template, browser behavior, and scoped CSS from a single `.vel` file into plain browser assets. Your Python framework (Flask, FastAPI, Django, or Flaxon) keeps handling routes, APIs, databases, auth, and security.
12
+
13
+ ## Features
14
+
15
+ - **Single-file components:** Template, script, and scoped style in one `.vel` file.
16
+ - **Bring your own backend:** Works with Flask, FastAPI, Django, and Flaxon.
17
+ - **No Node.js:** Production builds use [MinifyJS](https://github.com/aldanedev-create/teloce-py/blob/main/docs/minifyjs.md), a native esbuild engine bundled in the wheel.
18
+ - **Fast builds:** Tree shaking, mangling, code splitting, source maps, and hashed assets.
19
+
20
+ ## Teloce Ecosystem
21
+
22
+ Teloce is designed to support both Python-based application development and JavaScript-based workflows.
23
+
24
+ ### Teloce-Py
25
+
26
+ [Teloce-Py](https://github.com/aldanedev-create/teloce-py) is the Python implementation. It lets developers build applications using `.vel` single-file components without requiring Node.js.
27
+
28
+ It integrates with Python web frameworks and handles component compilation, scoped styles, browser assets, and production builds.
29
+
30
+ ### Teloce-NPM
31
+
32
+ [Teloce-NPM](https://github.com/aldanedev-create/teloce-npm) is the companion npm project for the Teloce ecosystem.
33
+
34
+ It provides npm-based tooling and packages for developers working with Teloce and JavaScript-based projects. It complements Teloce-Py by supporting workflows outside the Python package environment.
35
+
36
+ **Explore Teloce-NPM:**
37
+
38
+ - [Teloce-NPM repository](https://github.com/aldanedev-create/teloce-npm)
39
+ - [Three.js example](https://github.com/aldanedev-create/teloce-npm/tree/main/examples/three-example)
40
+
41
+ The [Three.js example](https://github.com/aldanedev-create/teloce-npm/tree/main/examples/three-example) demonstrates using Teloce-NPM in a project with Three.js.
42
+
43
+ Together, Teloce-Py and Teloce-NPM provide different ways to work with the Teloce ecosystem.
44
+
45
+ ## Getting Started
46
+
47
+ Install:
48
+
49
+ ```bash
50
+ python -m pip install teloce-py Flask
51
+ ```
52
+
53
+ Create `static/js/App.vel`:
54
+
55
+ ```html
56
+ <script>
57
+ export default {
58
+ data() { return { count: 0 }; },
59
+ methods: {
60
+ increment() { this.count += 1; }
61
+ }
62
+ };
63
+ </script>
64
+
65
+ <template>
66
+ <button @click="increment">Clicked {{ count }} times</button>
67
+ </template>
68
+ ```
69
+
70
+ Create `app.py`:
71
+
72
+ ```python
73
+ from pathlib import Path
74
+ from flask import Flask, render_template
75
+ from teloce.build import build_project
76
+
77
+ ROOT = Path(__file__).parent
78
+ build_project(ROOT, out_dir=ROOT / "dist", options={"dev": True})
79
+
80
+ app = Flask(
81
+ __name__,
82
+ static_folder="dist/static",
83
+ static_url_path="/static"
84
+ )
85
+
86
+ @app.get("/")
87
+ def home():
88
+ return render_template("app.html")
89
+
90
+ if __name__ == "__main__":
91
+ app.run(debug=True)
92
+ ```
93
+
94
+ Create `templates/app.html`:
95
+
96
+ ```html
97
+ <!doctype html>
98
+ <html>
99
+ <body>
100
+ <div id="app"></div>
101
+ <script type="module">
102
+ import { mount } from "{{ url_for('static', filename='js/App.js') }}";
103
+ mount("#app");
104
+ </script>
105
+ </body>
106
+ </html>
107
+ ```
108
+
109
+ Run it and open [http://127.0.0.1:5000](http://127.0.0.1:5000):
110
+
111
+ ```bash
112
+ python app.py
113
+ ```
114
+
115
+ ## Project Structure
116
+
117
+ ```text
118
+ my-app/
119
+ ├── app.py
120
+ ├── teloce.config.json
121
+ ├── static/
122
+ │ └── js/
123
+ │ └── App.vel # Your source
124
+ ├── templates/
125
+ │ └── app.html # HTML shell with #app mount
126
+ └── dist/ # Generated, never edit by hand
127
+ ```
128
+
129
+ ## Production Build
130
+
131
+ ```bash
132
+ teloce lint --strict
133
+ teloce build --source-map --hash-assets --bundle --report
134
+ ```
135
+
136
+ Teloce strips common TypeScript syntax during compilation. The optional `teloce typecheck` command checks scripts and supported template expressions with PyTSCheck.
137
+
138
+ ## Documentation
139
+
140
+ - [Documentation](https://github.com/aldanedev-create/teloce-py/blob/main/docs/README.md)
141
+ - [Network API: http, action, socket](docs/network-api.md)
142
+ - [Project structure](https://github.com/aldanedev-create/teloce-py/blob/main/docs/lessons/file-structure.md)
143
+ - [Examples](https://github.com/aldanedev-create/teloce-py/blob/main/examples/README.md):
144
+ - [Flask chat](examples/flask-chat)
145
+ - [FastAPI CMS](https://github.com/aldanedev-create/teloce-py/tree/main/examples/fastapi-cms)
146
+ - [Django Admin](examples/django-admin-vel)
147
+ - [Django scanner](https://github.com/aldanedev-create/teloce-py/tree/main/examples/django-scanner)
148
+ - [Flaxon network](https://github.com/aldanedev-create/teloce-py/tree/main/examples/flaxon-network)
149
+ - [Gallery](https://github.com/aldanedev-create/teloce-py/tree/main/examples/teloce-gallery)
150
+
151
+ ## Status
152
+
153
+ Teloce-Py is in beta. Pin your version and test generated assets on your target framework and platform.
154
+
155
+ ## License
156
+
157
+ [MIT](https://github.com/aldanedev-create/teloce-py/blob/main/LICENSE)
158
+
159
+ ## Runtime Contributor Checks
160
+
161
+ The JavaScript runtime uses JSDoc types with a development-only checker:
162
+
163
+ ```bash
164
+ npm ci --ignore-scripts
165
+ npm run typecheck
166
+ ```
167
+
168
+ See [coverage and workflow](https://github.com/aldanedev-create/teloce-py/blob/main/docs/runtime-typechecking.md).
169
+
170
+ Runtime files stay `.js`; Python application users do not need Node or TypeScript.
171
+
172
+ ## Optional Component Type Checking
173
+
174
+ On Python 3.11+, install:
175
+
176
+ ```bash
177
+ pip install "teloce-py[typecheck]"
178
+ ```
179
+
180
+ Then run:
181
+
182
+ ```bash
183
+ teloce typecheck ui
184
+ ```
185
+
186
+ Or use JSON output for CI:
187
+
188
+ ```bash
189
+ teloce typecheck ui --json
190
+ ```
191
+
192
+ This checks TypeScript script blocks, `.ts` files/declarations, and supported template expressions using the bundled PyTSCheck compiler.
193
+
194
+ See the [type-checking guide](https://github.com/aldanedev-create/teloce-py/blob/main/docs/typecheck.md) for API examples, diagnostic locations, optional dependency handling, and prototype limits.
195
+
196
+ Plain JavaScript components are skipped. Project tsconfig settings and dependency declarations are inherited automatically; object-style props infer supported constructor types. Props passed to statically imported TypeScript children are validated. Array-style prop values, dynamic children, and some import forms remain limited.
197
+
198
+ You can also explore this [Teloce-NPM Three.js example](https://github.com/aldanedev-create/teloce-npm/tree/main/examples/three-example).
@@ -0,0 +1,70 @@
1
+ """Framework-agnostic backend for Teloce's browser network clients.
2
+
3
+ ``teloce.http`` needs no backend support. ``teloce.action`` and ``teloce.socket`` talk to the
4
+ two pieces in this package, which work with *any* Python web framework because they expose
5
+ plain functions plus standard WSGI / ASGI applications:
6
+
7
+ * :class:`ActionRegistry` — ``@registry.action("todos.create")`` functions called from the browser;
8
+ * :class:`ChannelHub` — publish/subscribe channels over WebSockets;
9
+ * :class:`Bridge` — one ASGI app serving both.
10
+
11
+ See ``docs/network-api.md`` for the wire protocol and mounting examples.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ from typing import Any, Awaitable, Callable
17
+
18
+ from .actions import (
19
+ ACTION_HEADER,
20
+ DEFAULT_PREFIX,
21
+ ActionContext,
22
+ ActionError,
23
+ ActionRegistry,
24
+ ActionRequest,
25
+ ActionResponse,
26
+ dumps,
27
+ )
28
+ from .channels import ChannelHub, Connection, allow_all, deny_all
29
+
30
+ __all__ = [
31
+ "ACTION_HEADER",
32
+ "ActionContext",
33
+ "ActionError",
34
+ "ActionRegistry",
35
+ "ActionRequest",
36
+ "ActionResponse",
37
+ "Bridge",
38
+ "ChannelHub",
39
+ "Connection",
40
+ "DEFAULT_PREFIX",
41
+ "allow_all",
42
+ "deny_all",
43
+ "dumps",
44
+ ]
45
+
46
+
47
+ class Bridge:
48
+ """Serve actions (HTTP) and channels (WebSocket) from one ASGI application."""
49
+
50
+ def __init__(self, actions: ActionRegistry | None = None, channels: ChannelHub | None = None):
51
+ self.actions = actions if actions is not None else ActionRegistry()
52
+ self.channels = channels if channels is not None else ChannelHub()
53
+
54
+ @property
55
+ def asgi_app(self) -> Callable[..., Awaitable[None]]:
56
+ actions_app = self.actions.asgi_app
57
+ channels_app = self.channels.asgi_app
58
+
59
+ async def app(scope: dict[str, Any], receive: Callable[..., Any], send: Callable[..., Any]) -> None:
60
+ if scope["type"] == "websocket":
61
+ await channels_app(scope, receive, send)
62
+ else: # http and lifespan
63
+ await actions_app(scope, receive, send)
64
+
65
+ return app
66
+
67
+ @property
68
+ def wsgi_app(self) -> Callable[..., Any]:
69
+ """WSGI cannot carry WebSockets, so this serves actions only."""
70
+ return self.actions.wsgi_app