teloce-py 0.2.4__tar.gz → 0.2.6__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 (161) hide show
  1. teloce_py-0.2.6/PKG-INFO +159 -0
  2. teloce_py-0.2.6/README.md +126 -0
  3. {teloce_py-0.2.4 → teloce_py-0.2.6}/pyproject.toml +8 -2
  4. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/__init__.py +7 -1
  5. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/ast/nodes.py +67 -35
  6. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/build/__init__.py +29 -26
  7. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/build/assets.py +21 -10
  8. teloce_py-0.2.6/src/teloce/build/builder.py +1365 -0
  9. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/build/esbuild.py +23 -5
  10. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/build/manifest.py +34 -23
  11. teloce_py-0.2.6/src/teloce/build/minifyjs.py +98 -0
  12. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/cli/build.py +80 -35
  13. teloce_py-0.2.6/src/teloce/cli/compile.py +86 -0
  14. teloce_py-0.2.6/src/teloce/cli/component.py +113 -0
  15. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/cli/create.py +5 -0
  16. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/cli/dev.py +17 -2
  17. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/cli/main.py +184 -120
  18. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/cli/watch.py +17 -1
  19. teloce_py-0.2.6/src/teloce/compiler/compiler.py +547 -0
  20. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/compiler/generator.py +612 -174
  21. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/compiler/lexer.py +189 -107
  22. teloce_py-0.2.6/src/teloce/compiler/minifier.py +187 -0
  23. teloce_py-0.2.6/src/teloce/compiler/optimizer.py +350 -0
  24. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/compiler/parser.py +213 -168
  25. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/compiler/source_map.py +27 -6
  26. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/compiler/transformer.py +5 -3
  27. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/components/dependency_graph.py +2 -2
  28. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/components/imports.py +63 -50
  29. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/components/resolver.py +7 -2
  30. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/css/scoped.py +116 -116
  31. teloce_py-0.2.6/src/teloce/data.py +145 -0
  32. teloce_py-0.2.6/src/teloce/directives/advanced.py +60 -0
  33. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/directives/registry.py +19 -5
  34. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/javascript/__init__.py +34 -10
  35. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/javascript/generator.py +12 -6
  36. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/javascript/parser.py +83 -13
  37. teloce_py-0.2.6/src/teloce/javascript/tree_sitter_backend.py +356 -0
  38. teloce_py-0.2.6/src/teloce/javascript/ts_transpile.py +210 -0
  39. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/project/configuration.py +47 -21
  40. teloce_py-0.2.6/src/teloce/project/extensions.py +47 -0
  41. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/project/scanner.py +26 -12
  42. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/router/__init__.py +7 -4
  43. teloce_py-0.2.6/src/teloce/router/facade.py +246 -0
  44. teloce_py-0.2.6/src/teloce/runtime/compiled.js +1422 -0
  45. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/component.js +45 -5
  46. teloce_py-0.2.6/src/teloce/runtime/data.js +103 -0
  47. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/dom.js +31 -8
  48. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/runtime.js +2 -0
  49. teloce_py-0.2.6/src/teloce/runtime/table.js +56 -0
  50. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/sfc/component.py +11 -1
  51. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/sfc/parser.py +3 -2
  52. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/sfc/script.py +483 -395
  53. teloce_py-0.2.6/src/teloce/ssr.py +155 -0
  54. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/version.py +1 -1
  55. teloce_py-0.2.6/src/teloce_py.egg-info/PKG-INFO +159 -0
  56. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce_py.egg-info/SOURCES.txt +13 -0
  57. teloce_py-0.2.6/src/teloce_py.egg-info/requires.txt +4 -0
  58. teloce_py-0.2.4/PKG-INFO +0 -225
  59. teloce_py-0.2.4/README.md +0 -196
  60. teloce_py-0.2.4/src/teloce/build/builder.py +0 -493
  61. teloce_py-0.2.4/src/teloce/cli/compile.py +0 -26
  62. teloce_py-0.2.4/src/teloce/compiler/compiler.py +0 -314
  63. teloce_py-0.2.4/src/teloce/compiler/optimizer.py +0 -115
  64. teloce_py-0.2.4/src/teloce/ssr.py +0 -75
  65. teloce_py-0.2.4/src/teloce_py.egg-info/PKG-INFO +0 -225
  66. {teloce_py-0.2.4 → teloce_py-0.2.6}/LICENSE +0 -0
  67. {teloce_py-0.2.4 → teloce_py-0.2.6}/setup.cfg +0 -0
  68. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/__main__.py +0 -0
  69. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/ast/__init__.py +0 -0
  70. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/ast/components.py +0 -0
  71. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/ast/elements.py +0 -0
  72. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/ast/expressions.py +0 -0
  73. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/ast/visitors.py +0 -0
  74. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/build/bundler.py +0 -0
  75. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/build/writer.py +0 -0
  76. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/cli/__init__.py +0 -0
  77. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/cli/benchmark.py +0 -0
  78. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/cli/debug.py +0 -0
  79. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/cli/doctor.py +0 -0
  80. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/cli/lint.py +0 -0
  81. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/cli/server.py +0 -0
  82. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/compiler/__init__.py +0 -0
  83. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/compiler/diagnostics.py +0 -0
  84. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/components/__init__.py +0 -0
  85. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/components/registry.py +0 -0
  86. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/css/__init__.py +0 -0
  87. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/css/generator.py +0 -0
  88. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/css/hashing.py +0 -0
  89. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/css/modules.py +0 -0
  90. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/css/parser.py +0 -0
  91. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/debug/__init__.py +0 -0
  92. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/debug/dashboard.py +0 -0
  93. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/debug/errors.py +0 -0
  94. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/debug/formatter.py +0 -0
  95. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/debug/suggestions.py +0 -0
  96. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/directives/__init__.py +0 -0
  97. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/directives/base.py +0 -0
  98. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/directives/bind.py +0 -0
  99. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/directives/events.py +0 -0
  100. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/directives/for_.py +0 -0
  101. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/directives/if_.py +0 -0
  102. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/directives/model.py +0 -0
  103. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/directives/show.py +0 -0
  104. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/expressions/__init__.py +0 -0
  105. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/expressions/ast.py +0 -0
  106. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/expressions/generator.py +0 -0
  107. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/expressions/lexer.py +0 -0
  108. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/expressions/parser.py +0 -0
  109. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/filters/__init__.py +0 -0
  110. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/filters/arrays.py +0 -0
  111. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/filters/dates.py +0 -0
  112. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/filters/numbers.py +0 -0
  113. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/filters/objects.py +0 -0
  114. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/filters/registry.py +0 -0
  115. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/filters/strings.py +0 -0
  116. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/javascript/dom.py +0 -0
  117. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/javascript/exports.py +0 -0
  118. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/javascript/helpers.py +0 -0
  119. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/javascript/imports.py +0 -0
  120. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/javascript/module.py +0 -0
  121. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/plugins/__init__.py +0 -0
  122. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/plugins/api.py +0 -0
  123. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/plugins/directives.py +0 -0
  124. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/plugins/filters.py +0 -0
  125. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/plugins/hooks.py +0 -0
  126. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/plugins/registry.py +0 -0
  127. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/project/__init__.py +0 -0
  128. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/project/discovery.py +0 -0
  129. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/project/paths.py +0 -0
  130. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/router/compiler.py +0 -0
  131. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/router/generator.py +0 -0
  132. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/__init__.py +0 -0
  133. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/computed.js +0 -0
  134. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/effects.js +0 -0
  135. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/events.js +0 -0
  136. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/lifecycle.js +0 -0
  137. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/props.js +0 -0
  138. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/reactivity.js +0 -0
  139. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/scheduler.js +0 -0
  140. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/signals.js +0 -0
  141. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/slots.js +0 -0
  142. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/runtime/standalone.js +0 -0
  143. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/sfc/__init__.py +0 -0
  144. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/sfc/sections.py +0 -0
  145. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/sfc/style.py +0 -0
  146. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/sfc/template.py +0 -0
  147. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/template/__init__.py +0 -0
  148. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/template/components.py +0 -0
  149. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/template/conditions.py +0 -0
  150. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/template/directives.py +0 -0
  151. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/template/expressions.py +0 -0
  152. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/template/interpolation.py +0 -0
  153. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/template/lexer.py +0 -0
  154. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/template/loops.py +0 -0
  155. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/template/parser.py +0 -0
  156. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/template/slots.py +0 -0
  157. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/watcher/__init__.py +0 -0
  158. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce/watcher/watcher.py +0 -0
  159. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce_py.egg-info/dependency_links.txt +0 -0
  160. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce_py.egg-info/entry_points.txt +0 -0
  161. {teloce_py-0.2.4 → teloce_py-0.2.6}/src/teloce_py.egg-info/top_level.txt +0 -0
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: teloce-py
3
+ Version: 0.2.6
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
+ Dynamic: license-file
33
+
34
+ <p align="center">
35
+ <img src="https://raw.githubusercontent.com/Flaxon-labs/teloce-py/main/assets/py-teloce.jpg" alt="Teloce-Py logo" width="160"/>
36
+ </p>
37
+
38
+ <h1 align="center">Teloce-Py</h1>
39
+
40
+ <p align="center">
41
+ Build interactive Python apps with <code>.vel</code> components. No Node.js required.
42
+ </p>
43
+
44
+ <p align="center">
45
+ <a href="https://pypi.org/project/teloce-py/"><img src="https://img.shields.io/pypi/v/teloce-py" alt="PyPI version"></a>
46
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"></a>
47
+ <a href="https://github.com/aldanedev-create/teloce-py/blob/main/docs/README.md"><img src="https://img.shields.io/badge/docs-read-green" alt="Documentation"></a>
48
+ </p>
49
+
50
+ Teloce-Py compiles a template, browser behavior, and scoped CSS from a single
51
+ `.vel` file into plain browser assets. Your Python framework (Flask, FastAPI,
52
+ Django, or Flaxon) keeps handling routes, APIs, databases, auth, and security.
53
+
54
+ ## Features
55
+
56
+ - **Single-file components**: template, script, and scoped style in one `.vel` file.
57
+ - **Bring your own backend**: works with Flask, FastAPI, Django, and Flaxon.
58
+ - **No Node.js**: production builds use [MinifyJS](docs/minifyjs.md), a native esbuild engine bundled in the wheel.
59
+ - **Fast builds**: tree shaking, mangling, code splitting, source maps, and hashed assets.
60
+
61
+ ## Getting Started
62
+
63
+ Install:
64
+
65
+ ```bash
66
+ python -m pip install teloce-py Flask
67
+ ```
68
+
69
+ Create `static/js/App.vel`:
70
+
71
+ ```html
72
+ <script>
73
+ export default {
74
+ data() { return { count: 0 }; },
75
+ methods: {
76
+ increment() { this.count += 1; }
77
+ }
78
+ };
79
+ </script>
80
+
81
+ <template>
82
+ <button @click="increment">Clicked {{ count }} times</button>
83
+ </template>
84
+ ```
85
+
86
+ Create `app.py`:
87
+
88
+ ```python
89
+ from pathlib import Path
90
+ from flask import Flask, render_template
91
+ from teloce.build import build_project
92
+
93
+ ROOT = Path(__file__).parent
94
+ build_project(ROOT, out_dir=ROOT / "dist", options={"dev": True})
95
+ app = Flask(__name__, static_folder="dist/static", static_url_path="/static")
96
+
97
+ @app.get("/")
98
+ def home():
99
+ return render_template("app.html")
100
+
101
+ if __name__ == "__main__":
102
+ app.run(debug=True)
103
+ ```
104
+
105
+ Create `templates/app.html`:
106
+
107
+ ```html
108
+ <!doctype html>
109
+ <html>
110
+ <body>
111
+ <div id="app"></div>
112
+ <script type="module">
113
+ import { mount } from "{{ url_for('static', filename='js/App.js') }}";
114
+ mount("#app");
115
+ </script>
116
+ </body>
117
+ </html>
118
+ ```
119
+
120
+ Run it and open <http://127.0.0.1:5000>:
121
+
122
+ ```bash
123
+ python app.py
124
+ ```
125
+
126
+ ## Project Structure
127
+
128
+ ```text
129
+ my-app/
130
+ ├── app.py
131
+ ├── teloce.config.json
132
+ ├── static/js/App.vel # your source
133
+ ├── templates/app.html # HTML shell with #app mount
134
+ └── dist/ # generated, never edit by hand
135
+ ```
136
+
137
+ ## Production Build
138
+
139
+ ```bash
140
+ teloce lint --strict
141
+ teloce build --source-map --hash-assets --bundle --report
142
+ ```
143
+
144
+ Teloce strips common TypeScript syntax but does not type-check.
145
+
146
+ ## Documentation
147
+
148
+ - [Documentation](https://github.com/aldanedev-create/teloce-py/blob/main/docs/README.md)
149
+ - [Project structure](https://github.com/aldanedev-create/teloce-py/blob/main/docs/lessons/file-structure.md)
150
+ - [Examples](https://github.com/aldanedev-create/teloce-py/blob/main/examples/README.md): [Flask chat](examples/flask-chat), [FastAPI CMS](https://github.com/aldanedev-create/teloce-py/tree/main/examples/fastapi-cms), [Django scanner](https://github.com/aldanedev-create/teloce-py/tree/main/examples/django-scanner), [Flaxon network](https://github.com/aldanedev-create/teloce-py/tree/main/examples/flaxon-network), [Gallery](https://github.com/aldanedev-create/teloce-py/tree/main/examples/teloce-gallery)
151
+
152
+ ## Status
153
+
154
+ Teloce-Py is in beta. Pin your version and test generated assets on your target
155
+ framework and platform.
156
+
157
+ ## License
158
+
159
+ [MIT](LICENSE)
@@ -0,0 +1,126 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/Flaxon-labs/teloce-py/main/assets/py-teloce.jpg" alt="Teloce-Py logo" width="160"/>
3
+ </p>
4
+
5
+ <h1 align="center">Teloce-Py</h1>
6
+
7
+ <p align="center">
8
+ Build interactive Python apps with <code>.vel</code> components. No Node.js required.
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://pypi.org/project/teloce-py/"><img src="https://img.shields.io/pypi/v/teloce-py" alt="PyPI version"></a>
13
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"></a>
14
+ <a href="https://github.com/aldanedev-create/teloce-py/blob/main/docs/README.md"><img src="https://img.shields.io/badge/docs-read-green" alt="Documentation"></a>
15
+ </p>
16
+
17
+ Teloce-Py compiles a template, browser behavior, and scoped CSS from a single
18
+ `.vel` file into plain browser assets. Your Python framework (Flask, FastAPI,
19
+ Django, or Flaxon) keeps handling routes, APIs, databases, auth, and security.
20
+
21
+ ## Features
22
+
23
+ - **Single-file components**: template, script, and scoped style in one `.vel` file.
24
+ - **Bring your own backend**: works with Flask, FastAPI, Django, and Flaxon.
25
+ - **No Node.js**: production builds use [MinifyJS](docs/minifyjs.md), a native esbuild engine bundled in the wheel.
26
+ - **Fast builds**: tree shaking, mangling, code splitting, source maps, and hashed assets.
27
+
28
+ ## Getting Started
29
+
30
+ Install:
31
+
32
+ ```bash
33
+ python -m pip install teloce-py Flask
34
+ ```
35
+
36
+ Create `static/js/App.vel`:
37
+
38
+ ```html
39
+ <script>
40
+ export default {
41
+ data() { return { count: 0 }; },
42
+ methods: {
43
+ increment() { this.count += 1; }
44
+ }
45
+ };
46
+ </script>
47
+
48
+ <template>
49
+ <button @click="increment">Clicked {{ count }} times</button>
50
+ </template>
51
+ ```
52
+
53
+ Create `app.py`:
54
+
55
+ ```python
56
+ from pathlib import Path
57
+ from flask import Flask, render_template
58
+ from teloce.build import build_project
59
+
60
+ ROOT = Path(__file__).parent
61
+ build_project(ROOT, out_dir=ROOT / "dist", options={"dev": True})
62
+ app = Flask(__name__, static_folder="dist/static", static_url_path="/static")
63
+
64
+ @app.get("/")
65
+ def home():
66
+ return render_template("app.html")
67
+
68
+ if __name__ == "__main__":
69
+ app.run(debug=True)
70
+ ```
71
+
72
+ Create `templates/app.html`:
73
+
74
+ ```html
75
+ <!doctype html>
76
+ <html>
77
+ <body>
78
+ <div id="app"></div>
79
+ <script type="module">
80
+ import { mount } from "{{ url_for('static', filename='js/App.js') }}";
81
+ mount("#app");
82
+ </script>
83
+ </body>
84
+ </html>
85
+ ```
86
+
87
+ Run it and open <http://127.0.0.1:5000>:
88
+
89
+ ```bash
90
+ python app.py
91
+ ```
92
+
93
+ ## Project Structure
94
+
95
+ ```text
96
+ my-app/
97
+ ├── app.py
98
+ ├── teloce.config.json
99
+ ├── static/js/App.vel # your source
100
+ ├── templates/app.html # HTML shell with #app mount
101
+ └── dist/ # generated, never edit by hand
102
+ ```
103
+
104
+ ## Production Build
105
+
106
+ ```bash
107
+ teloce lint --strict
108
+ teloce build --source-map --hash-assets --bundle --report
109
+ ```
110
+
111
+ Teloce strips common TypeScript syntax but does not type-check.
112
+
113
+ ## Documentation
114
+
115
+ - [Documentation](https://github.com/aldanedev-create/teloce-py/blob/main/docs/README.md)
116
+ - [Project structure](https://github.com/aldanedev-create/teloce-py/blob/main/docs/lessons/file-structure.md)
117
+ - [Examples](https://github.com/aldanedev-create/teloce-py/blob/main/examples/README.md): [Flask chat](examples/flask-chat), [FastAPI CMS](https://github.com/aldanedev-create/teloce-py/tree/main/examples/fastapi-cms), [Django scanner](https://github.com/aldanedev-create/teloce-py/tree/main/examples/django-scanner), [Flaxon network](https://github.com/aldanedev-create/teloce-py/tree/main/examples/flaxon-network), [Gallery](https://github.com/aldanedev-create/teloce-py/tree/main/examples/teloce-gallery)
118
+
119
+ ## Status
120
+
121
+ Teloce-Py is in beta. Pin your version and test generated assets on your target
122
+ framework and platform.
123
+
124
+ ## License
125
+
126
+ [MIT](LICENSE)
@@ -33,13 +33,18 @@ classifiers = [
33
33
  "Programming Language :: Python :: 3.11",
34
34
  "Programming Language :: Python :: 3.12",
35
35
  "Programming Language :: Python :: 3.13",
36
- "Programming Language :: Python :: 3.14",
36
+ "Programming Language :: Python :: 3.14",
37
37
  "Programming Language :: Python :: 3.15",
38
38
  "Topic :: Software Development :: Compilers",
39
39
  "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
40
40
  ]
41
41
  requires-python = ">=3.10"
42
- dependencies = []
42
+ dependencies = [
43
+ "minifyjs>=0.1.3,<0.2",
44
+ "tree-sitter>=0.26,<0.27",
45
+ "tree-sitter-javascript>=0.25,<0.26",
46
+ "tree-sitter-typescript>=0.23,<0.24",
47
+ ]
43
48
  dynamic = ["version"]
44
49
 
45
50
  [project.urls]
@@ -81,6 +86,7 @@ ignore_missing_imports = true
81
86
 
82
87
  [tool.pytest.ini_options]
83
88
  testpaths = ["tests"]
89
+ norecursedirs = [".git", "node_modules", "dist", "*.egg", ".venv"]
84
90
  pythonpath = ["src"]
85
91
  python_files = "test_*.py"
86
92
  python_classes = "Test*"
@@ -15,7 +15,8 @@ __all__ = [
15
15
  ]
16
16
 
17
17
  from teloce.compiler.compiler import compile, compile_file, compile_project
18
- from teloce.ssr import render_ssr, to_jinax_template
18
+ from teloce.ssr import render_ssr, render_static_component, render_static, to_jinax_template
19
+ from teloce.data import DataShapeError, frontend_json, to_frontend_data
19
20
 
20
21
  __all__ = [
21
22
  "__version__",
@@ -24,4 +25,9 @@ __all__ = [
24
25
  "compile_project",
25
26
  "render_ssr",
26
27
  "to_jinax_template",
28
+ "render_static_component",
29
+ "render_static",
30
+ "DataShapeError",
31
+ "to_frontend_data",
32
+ "frontend_json",
27
33
  ]
@@ -43,33 +43,36 @@ class ASTNode:
43
43
  return visitor.visit_default(self)
44
44
 
45
45
 
46
- @dataclass(init=False)
47
- class ElementNode(ASTNode):
46
+ @dataclass(init=False)
47
+ class ElementNode(ASTNode):
48
48
  """HTML element node."""
49
49
  tag: str
50
50
  attributes: Dict[str, str] = field(default_factory=dict)
51
51
  events: List['EventNode'] = field(default_factory=list)
52
52
  bindings: List['BindingNode'] = field(default_factory=list)
53
+ transitions: List['TransitionDirectiveNode'] = field(default_factory=list)
53
54
  children: List[ASTNode] = field(default_factory=list)
54
55
 
55
56
  def __init__(self, tag: str, attributes: Dict[str, str] = None,
56
57
  events: List['EventNode'] = None,
57
58
  bindings: List['BindingNode'] = None,
58
59
  children: List[ASTNode] = None,
59
- line: int = 0, column: int = 0):
60
+ line: int = 0, column: int = 0,
61
+ transitions: List['TransitionDirectiveNode'] = None):
60
62
  super().__init__(NodeType.ELEMENT, line, column)
61
63
  self.tag = tag
62
64
  self.attributes = attributes or {}
63
65
  self.events = events or []
64
66
  self.bindings = bindings or []
67
+ self.transitions = transitions or []
65
68
  self.children = children or []
66
69
 
67
70
  def accept(self, visitor):
68
71
  return visitor.visit_element(self)
69
72
 
70
73
 
71
- @dataclass(init=False)
72
- class TextNode(ASTNode):
74
+ @dataclass(init=False)
75
+ class TextNode(ASTNode):
73
76
  """Plain text node."""
74
77
  value: str
75
78
 
@@ -81,8 +84,8 @@ class TextNode(ASTNode):
81
84
  return visitor.visit_text(self)
82
85
 
83
86
 
84
- @dataclass(init=False)
85
- class InterpolationNode(ASTNode):
87
+ @dataclass(init=False)
88
+ class InterpolationNode(ASTNode):
86
89
  """{{ expression }} interpolation node."""
87
90
  expression: str
88
91
 
@@ -94,29 +97,35 @@ class InterpolationNode(ASTNode):
94
97
  return visitor.visit_interpolation(self)
95
98
 
96
99
 
97
- @dataclass(init=False)
100
+ @dataclass(init=False)
98
101
  class ForNode(ASTNode):
99
102
  """For loop directive node."""
100
103
  item: str
101
104
  collection: str
102
- key: str = ""
103
- children: List[ASTNode] = field(default_factory=list)
105
+ key: str = ""
106
+ children: List[ASTNode] = field(default_factory=list)
107
+ virtual: bool = False
108
+ virtual_options: Dict[str, str] = field(default_factory=dict)
104
109
 
105
- def __init__(self, item: str, collection: str, key: str = "",
106
- children: List[ASTNode] = None,
107
- line: int = 0, column: int = 0):
110
+ def __init__(self, item: str, collection: str, key: str = "",
111
+ children: List[ASTNode] = None,
112
+ line: int = 0, column: int = 0,
113
+ virtual: bool = False,
114
+ virtual_options: Dict[str, str] = None):
108
115
  super().__init__(NodeType.FOR, line, column)
109
116
  self.item = item
110
117
  self.collection = collection
111
- self.key = key
112
- self.children = children or []
118
+ self.key = key
119
+ self.children = children or []
120
+ self.virtual = virtual
121
+ self.virtual_options = virtual_options or {}
113
122
 
114
123
  def accept(self, visitor):
115
124
  return visitor.visit_for(self)
116
125
 
117
126
 
118
- @dataclass(init=False)
119
- class IfNode(ASTNode):
127
+ @dataclass(init=False)
128
+ class IfNode(ASTNode):
120
129
  """If directive node."""
121
130
  condition: str
122
131
  children: List[ASTNode] = field(default_factory=list)
@@ -134,8 +143,8 @@ class IfNode(ASTNode):
134
143
  return visitor.visit_if(self)
135
144
 
136
145
 
137
- @dataclass(init=False)
138
- class ElseNode(ASTNode):
146
+ @dataclass(init=False)
147
+ class ElseNode(ASTNode):
139
148
  """Else directive node."""
140
149
  children: List[ASTNode] = field(default_factory=list)
141
150
 
@@ -148,8 +157,8 @@ class ElseNode(ASTNode):
148
157
  return visitor.visit_else(self)
149
158
 
150
159
 
151
- @dataclass(init=False)
152
- class EventNode(ASTNode):
160
+ @dataclass(init=False)
161
+ class EventNode(ASTNode):
153
162
  """@click event binding node."""
154
163
  name: str
155
164
  handler: str
@@ -163,8 +172,31 @@ class EventNode(ASTNode):
163
172
  return visitor.visit_event(self)
164
173
 
165
174
 
166
- @dataclass(init=False)
167
- class BindingNode(ASTNode):
175
+ @dataclass(init=False)
176
+ class TransitionDirectiveNode(ASTNode):
177
+ """transition:/in:/out:/animate: directive node.
178
+
179
+ kind is one of "transition", "in", "out", "animate".
180
+ name is the helper name, e.g. "fade", "slide", "flip".
181
+ params is the raw `{ ... }` JS object literal, or "" if none given.
182
+ """
183
+ kind: str
184
+ name: str
185
+ params: str
186
+
187
+ def __init__(self, kind: str, name: str, params: str = "", line: int = 0, column: int = 0):
188
+ super().__init__(NodeType.BINDING, line, column)
189
+ self.kind = kind
190
+ self.name = name
191
+ self.params = params
192
+
193
+ def accept(self, visitor):
194
+ method = getattr(visitor, "visit_transition_directive", None)
195
+ return method(self) if method else visitor.visit_default(self)
196
+
197
+
198
+ @dataclass(init=False)
199
+ class BindingNode(ASTNode):
168
200
  """:model binding node."""
169
201
  name: str
170
202
  value: str
@@ -178,8 +210,8 @@ class BindingNode(ASTNode):
178
210
  return visitor.visit_binding(self)
179
211
 
180
212
 
181
- @dataclass(init=False)
182
- class ComponentNode(ASTNode):
213
+ @dataclass(init=False)
214
+ class ComponentNode(ASTNode):
183
215
  """Custom component node."""
184
216
  name: str
185
217
  props: Dict[str, str] = field(default_factory=dict)
@@ -200,8 +232,8 @@ class ComponentNode(ASTNode):
200
232
  return visitor.visit_component(self)
201
233
 
202
234
 
203
- @dataclass(init=False)
204
- class SlotNode(ASTNode):
235
+ @dataclass(init=False)
236
+ class SlotNode(ASTNode):
205
237
  """Slot node."""
206
238
  name: str = "default"
207
239
  children: List[ASTNode] = field(default_factory=list)
@@ -216,8 +248,8 @@ class SlotNode(ASTNode):
216
248
  return visitor.visit_slot(self)
217
249
 
218
250
 
219
- @dataclass(init=False)
220
- class FragmentNode(ASTNode):
251
+ @dataclass(init=False)
252
+ class FragmentNode(ASTNode):
221
253
  """Fragment node (multiple root elements)."""
222
254
  children: List[ASTNode] = field(default_factory=list)
223
255
 
@@ -230,8 +262,8 @@ class FragmentNode(ASTNode):
230
262
  return visitor.visit_fragment(self)
231
263
 
232
264
 
233
- @dataclass(init=False)
234
- class AttributeNode(ASTNode):
265
+ @dataclass(init=False)
266
+ class AttributeNode(ASTNode):
235
267
  """HTML attribute node."""
236
268
  name: str
237
269
  value: str
@@ -245,8 +277,8 @@ class AttributeNode(ASTNode):
245
277
  return visitor.visit_attribute(self)
246
278
 
247
279
 
248
- @dataclass(init=False)
249
- class CommentNode(ASTNode):
280
+ @dataclass(init=False)
281
+ class CommentNode(ASTNode):
250
282
  """HTML comment node."""
251
283
  value: str
252
284
 
@@ -258,8 +290,8 @@ class CommentNode(ASTNode):
258
290
  return visitor.visit_comment(self)
259
291
 
260
292
 
261
- @dataclass(init=False)
262
- class DoctypeNode(ASTNode):
293
+ @dataclass(init=False)
294
+ class DoctypeNode(ASTNode):
263
295
  """DOCTYPE node."""
264
296
  value: str
265
297
 
@@ -7,34 +7,37 @@ Provides build system for compiling .vel files.
7
7
  from teloce.build.builder import Builder
8
8
  from teloce.build.writer import FileWriter
9
9
  from teloce.build.manifest import ManifestGenerator
10
- from teloce.build.assets import AssetManager
11
- from teloce.build.bundler import ModuleBundler, BundleError
12
- from teloce.build.esbuild import EsbuildBundler, EsbuildUnavailable
13
-
14
-
15
- def build_project(root_dir, out_dir=None, options=None):
16
- """Compile a project's `.vel` files for a Python web-server startup.
17
-
18
- Raises ``RuntimeError`` when any component fails, preventing a server
19
- from starting with stale or incomplete frontend assets.
20
- """
21
- result = Builder(options or {}).build(root_dir, out_dir)
22
- if result.get("failed"):
23
- details = "\n".join(
24
- f"{item.get('file')}: {item.get('error')}"
25
- for item in result.get("errors", [])
26
- )
27
- raise RuntimeError(f"Teloce build failed:\n{details}")
28
- return result
10
+ from teloce.build.assets import AssetManager
11
+ from teloce.build.bundler import ModuleBundler, BundleError
12
+ from teloce.build.minifyjs import MinifyJSBundler, TeloceMinifyJSAdapter
13
+ from teloce.build.esbuild import EsbuildBundler, EsbuildUnavailable
14
+
15
+
16
+ def build_project(root_dir, out_dir=None, options=None):
17
+ """Compile a project's `.vel` files for a Python web-server startup.
18
+
19
+ Raises ``RuntimeError`` when any component fails, preventing a server
20
+ from starting with stale or incomplete frontend assets.
21
+ """
22
+ result = Builder(options or {}).build(root_dir, out_dir)
23
+ if result.get("failed"):
24
+ details = "\n".join(
25
+ f"{item.get('file')}: {item.get('error')}"
26
+ for item in result.get("errors", [])
27
+ )
28
+ raise RuntimeError(f"Teloce build failed:\n{details}")
29
+ return result
29
30
 
30
31
  __all__ = [
31
32
  "Builder",
32
33
  "FileWriter",
33
34
  "ManifestGenerator",
34
- "AssetManager",
35
- "ModuleBundler",
36
- "BundleError",
37
- "EsbuildBundler",
38
- "EsbuildUnavailable",
39
- "build_project",
40
- ]
35
+ "AssetManager",
36
+ "ModuleBundler",
37
+ "BundleError",
38
+ "MinifyJSBundler",
39
+ "TeloceMinifyJSAdapter",
40
+ "EsbuildBundler",
41
+ "EsbuildUnavailable",
42
+ "build_project",
43
+ ]
@@ -23,11 +23,12 @@ class AssetManager:
23
23
  self.asset_extensions = {
24
24
  '.css', '.js', '.png', '.jpg', '.jpeg', '.gif', '.svg',
25
25
  '.ico', '.webp', '.woff', '.woff2', '.ttf', '.eot',
26
- '.mp3', '.mp4', '.webm', '.ogg', '.pdf', '.json',
27
- '.xml', '.txt', '.md',
26
+ '.mp3', '.mp4', '.webm', '.ogg', '.pdf', '.json',
27
+ '.xml', '.txt', '.md', '.csv', '.tsv',
28
28
  }
29
29
 
30
- def copy_assets(self, source_dir: str | Path, dest_dir: str | Path) -> int:
30
+ def copy_assets(self, source_dir: str | Path, dest_dir: str | Path,
31
+ asset_directories: list[str | Path] | None = None) -> int:
31
32
  """
32
33
  Copy static assets to the build directory.
33
34
 
@@ -49,13 +50,23 @@ class AssetManager:
49
50
  # Create destination directory
50
51
  dest.mkdir(parents=True, exist_ok=True)
51
52
 
52
- # Copy assets from common asset directories
53
- asset_dirs = [
54
- source / 'static',
55
- source / 'assets',
56
- source / 'public',
57
- source / 'media',
58
- ]
53
+ # Copy assets from common asset directories, plus an explicitly
54
+ # configured source directory such as ``client``. The latter matters
55
+ # for projects whose authored static tree is not named ``static``.
56
+ asset_dirs = [
57
+ source / 'static',
58
+ source / 'assets',
59
+ source / 'public',
60
+ source / 'media',
61
+ ]
62
+ for configured in asset_directories or []:
63
+ candidate = source / Path(configured)
64
+ try:
65
+ candidate.resolve().relative_to(source.resolve())
66
+ except (OSError, ValueError):
67
+ continue
68
+ if candidate not in asset_dirs:
69
+ asset_dirs.append(candidate)
59
70
 
60
71
  for asset_dir in asset_dirs:
61
72
  if asset_dir.exists():