fjkit 0.2.1__tar.gz → 0.4.1__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 (188) hide show
  1. {fjkit-0.2.1 → fjkit-0.4.1}/PKG-INFO +2 -2
  2. {fjkit-0.2.1 → fjkit-0.4.1}/README.md +1 -1
  3. {fjkit-0.2.1 → fjkit-0.4.1}/docs/README.md +2 -2
  4. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/assets/brand.css +20 -1
  5. fjkit-0.4.1/docs/workbench/assets/demo-dark.jpg +0 -0
  6. fjkit-0.4.1/docs/workbench/assets/demo-light.jpg +0 -0
  7. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/build.py +82 -4
  8. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/cheatsheet.py +39 -7
  9. fjkit-0.4.1/docs/workbench/templates/_architecture.html +129 -0
  10. fjkit-0.4.1/docs/workbench/templates/architecture.html +190 -0
  11. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/components.html +1 -1
  12. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/introduction.html +53 -2
  13. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/learn.html +5 -3
  14. fjkit-0.4.1/docs/workbench/templates/why.html +92 -0
  15. fjkit-0.4.1/docs/workbench/templates/zh/architecture.html +182 -0
  16. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/zh/components.html +1 -1
  17. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/zh/introduction.html +50 -2
  18. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/zh/learn.html +5 -3
  19. fjkit-0.4.1/docs/workbench/templates/zh/why.html +87 -0
  20. {fjkit-0.2.1 → fjkit-0.4.1}/pyproject.toml +1 -1
  21. {fjkit-0.2.1 → fjkit-0.4.1}/scripts/vendor_ui.py +10 -0
  22. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/auth/plugin.py +92 -13
  23. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/cli/build_css.py +10 -1
  24. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/cli/check.py +39 -23
  25. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/cli/eject.py +174 -54
  26. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/cli/ejected.py +6 -1
  27. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/config.py +7 -0
  28. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/errors.py +68 -26
  29. fjkit-0.4.1/src/fjkit/sse.py +188 -0
  30. fjkit-0.4.1/src/fjkit/static/dist/fjkit-luma.css +2 -0
  31. fjkit-0.4.1/src/fjkit/static/dist/fjkit-lyra.css +2 -0
  32. fjkit-0.4.1/src/fjkit/static/dist/fjkit-maia.css +2 -0
  33. fjkit-0.4.1/src/fjkit/static/dist/fjkit-mira.css +2 -0
  34. fjkit-0.4.1/src/fjkit/static/dist/fjkit-nova.css +2 -0
  35. fjkit-0.4.1/src/fjkit/static/dist/fjkit-rhea.css +2 -0
  36. fjkit-0.4.1/src/fjkit/static/dist/fjkit-sera.css +2 -0
  37. fjkit-0.4.1/src/fjkit/static/dist/fjkit-vega.css +2 -0
  38. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/js/resize.js +36 -10
  39. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/src/fjkit.css +31 -14
  40. fjkit-0.4.1/src/fjkit/static/vendor/htmx/sse.min.js +1 -0
  41. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/data.html +31 -6
  42. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/form.html +11 -0
  43. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/shell.html +10 -1
  44. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/sidebar.html +37 -0
  45. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/swap.html +36 -1
  46. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/table.html +22 -4
  47. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/tabs.html +42 -9
  48. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templating.py +22 -3
  49. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/vendored.py +17 -1
  50. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_auth.py +156 -9
  51. fjkit-0.4.1/tests/test_authority.py +75 -0
  52. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_components.py +172 -1
  53. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_docs_site.py +58 -1
  54. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_errors.py +91 -0
  55. fjkit-0.4.1/tests/test_readme.py +146 -0
  56. fjkit-0.4.1/tests/test_sse.py +206 -0
  57. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_style_packs.py +13 -1
  58. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_vocabulary.py +121 -0
  59. fjkit-0.2.1/src/fjkit/static/dist/fjkit-luma.css +0 -2
  60. fjkit-0.2.1/src/fjkit/static/dist/fjkit-lyra.css +0 -2
  61. fjkit-0.2.1/src/fjkit/static/dist/fjkit-maia.css +0 -2
  62. fjkit-0.2.1/src/fjkit/static/dist/fjkit-mira.css +0 -2
  63. fjkit-0.2.1/src/fjkit/static/dist/fjkit-nova.css +0 -2
  64. fjkit-0.2.1/src/fjkit/static/dist/fjkit-rhea.css +0 -2
  65. fjkit-0.2.1/src/fjkit/static/dist/fjkit-sera.css +0 -2
  66. fjkit-0.2.1/src/fjkit/static/dist/fjkit-vega.css +0 -2
  67. {fjkit-0.2.1 → fjkit-0.4.1}/.gitignore +0 -0
  68. {fjkit-0.2.1 → fjkit-0.4.1}/LICENSE +0 -0
  69. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/assets/common.js +0 -0
  70. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/assets/components.js +0 -0
  71. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/assets/learn.js +0 -0
  72. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/assets/mock-server.js +0 -0
  73. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/build_data.py +0 -0
  74. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/_diagram.html +0 -0
  75. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/_parts.html +0 -0
  76. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/_shell_diagram.html +0 -0
  77. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/base.html +0 -0
  78. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/cheatsheet.html +0 -0
  79. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/plugins.html +0 -0
  80. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/zh/cheatsheet.html +0 -0
  81. {fjkit-0.2.1 → fjkit-0.4.1}/docs/workbench/templates/zh/plugins.html +0 -0
  82. {fjkit-0.2.1 → fjkit-0.4.1}/scripts/vendor_icons.py +0 -0
  83. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/__init__.py +0 -0
  84. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/auth/__init__.py +0 -0
  85. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/auth/csrf.py +0 -0
  86. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/auth/errors.py +0 -0
  87. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/auth/sources.py +0 -0
  88. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/auth/stores.py +0 -0
  89. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/auth/types.py +0 -0
  90. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/cli/__init__.py +0 -0
  91. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/cli/vocabulary.py +0 -0
  92. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/flash.py +0 -0
  93. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/forms.py +0 -0
  94. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/htmx.py +0 -0
  95. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/icons.py +0 -0
  96. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/messages.py +0 -0
  97. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/mounting.py +0 -0
  98. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/plugins.py +0 -0
  99. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/py.typed +0 -0
  100. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/rendering.py +0 -0
  101. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/signing.py +0 -0
  102. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/brand/torii-bolt.png +0 -0
  103. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/icons/lucide.json +0 -0
  104. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/js/errors.js +0 -0
  105. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/js/multiselect.js +0 -0
  106. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/js/reveal.js +0 -0
  107. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/js/select.js +0 -0
  108. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/base/base.css +0 -0
  109. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat-base.css +0 -0
  110. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat-components.css +0 -0
  111. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat-luma.css +0 -0
  112. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat-lyra.css +0 -0
  113. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat-maia.css +0 -0
  114. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat-mira.css +0 -0
  115. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat-nova.css +0 -0
  116. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat-rhea.css +0 -0
  117. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat-sera.css +0 -0
  118. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat-vega.css +0 -0
  119. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat.all.css +0 -0
  120. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/basecoat.css +0 -0
  121. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/accordion.css +0 -0
  122. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/alert.css +0 -0
  123. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/avatar.css +0 -0
  124. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/badge.css +0 -0
  125. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/breadcrumb.css +0 -0
  126. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/button-group.css +0 -0
  127. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/button.css +0 -0
  128. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/card.css +0 -0
  129. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/chart.css +0 -0
  130. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/checkbox.css +0 -0
  131. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/collapsible.css +0 -0
  132. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/combobox.css +0 -0
  133. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/command.css +0 -0
  134. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/dialog.css +0 -0
  135. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/drawer.css +0 -0
  136. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/dropdown-menu.css +0 -0
  137. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/empty.css +0 -0
  138. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/field.css +0 -0
  139. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/form.css +0 -0
  140. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/input-group.css +0 -0
  141. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/input.css +0 -0
  142. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/item.css +0 -0
  143. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/kbd.css +0 -0
  144. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/label.css +0 -0
  145. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/native-select.css +0 -0
  146. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/popover.css +0 -0
  147. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/progress.css +0 -0
  148. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/radio.css +0 -0
  149. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/range.css +0 -0
  150. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/scrollbar.css +0 -0
  151. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/select.css +0 -0
  152. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/sidebar.css +0 -0
  153. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/skeleton.css +0 -0
  154. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/switch.css +0 -0
  155. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/table.css +0 -0
  156. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/tabs.css +0 -0
  157. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/textarea.css +0 -0
  158. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/toast.css +0 -0
  159. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/components/tooltip.css +0 -0
  160. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/js/all.min.js +0 -0
  161. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/styles/luma.css +0 -0
  162. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/styles/lyra.css +0 -0
  163. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/styles/maia.css +0 -0
  164. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/styles/mira.css +0 -0
  165. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/styles/nova.css +0 -0
  166. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/styles/rhea.css +0 -0
  167. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/styles/sera.css +0 -0
  168. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/basecoat/styles/vega.css +0 -0
  169. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/htmx/htmx.min.js +0 -0
  170. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/htmx/idiomorph-ext.min.js +0 -0
  171. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/static/vendor/htmx/json-enc.js +0 -0
  172. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/styles.py +0 -0
  173. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/errors/page.html +0 -0
  174. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/attrs.html +0 -0
  175. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/button.html +0 -0
  176. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/disclosure.html +0 -0
  177. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/feedback.html +0 -0
  178. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/icon.html +0 -0
  179. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/layout.html +0 -0
  180. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/nav.html +0 -0
  181. {fjkit-0.2.1 → fjkit-0.4.1}/src/fjkit/templates/ui/overlay.html +0 -0
  182. {fjkit-0.2.1 → fjkit-0.4.1}/tests/conftest.py +0 -0
  183. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_color_scheme.py +0 -0
  184. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_flash.py +0 -0
  185. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_messages.py +0 -0
  186. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_mounting.py +0 -0
  187. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_plugins.py +0 -0
  188. {fjkit-0.2.1 → fjkit-0.4.1}/tests/test_rendering.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: fjkit
3
- Version: 0.2.1
3
+ Version: 0.4.1
4
4
  Summary: Server-rendered UI kit for FastAPI — Jinja2 + Basecoat + htmx, no front-end build
5
5
  Project-URL: Homepage, https://liweicheng00.github.io/fjkit/
6
6
  Project-URL: Documentation, https://liweicheng00.github.io/fjkit/
@@ -129,7 +129,7 @@ uv run fjkit check app/templates
129
129
 
130
130
  **[Docs](https://liweicheng00.github.io/fjkit/)**
131
131
 
132
- Status: 0.1.0. Macro signatures can change before 1.0.
132
+ Status: 0.4.1. Macro signatures can change before 1.0.
133
133
 
134
134
  ## License
135
135
 
@@ -102,7 +102,7 @@ uv run fjkit check app/templates
102
102
 
103
103
  **[Docs](https://liweicheng00.github.io/fjkit/)**
104
104
 
105
- Status: 0.1.0. Macro signatures can change before 1.0.
105
+ Status: 0.4.1. Macro signatures can change before 1.0.
106
106
 
107
107
  ## License
108
108
 
@@ -111,8 +111,8 @@ your app.
111
111
  | A macro cannot be misused | signatures take closed enumerations and never a class string |
112
112
  | Page and htmx swap cannot drift | one partial, embedded by the page and returned by the endpoints |
113
113
 
114
- The diagrams behind these decisions are in `docs/architecture.md`, at the repo
115
- root.
114
+ The diagrams behind these decisions are the site's Architecture page —
115
+ `templates/architecture.html`, beside this file.
116
116
 
117
117
  ## Commands
118
118
 
@@ -111,13 +111,32 @@ main .card > footer:first-child {
111
111
  .code-block [data-t="a"] { color: var(--info); }
112
112
 
113
113
  /*
114
- * GAP 2 — a diagram surface.
114
+ * GAP 2 — a figure surface: a diagram, and now a screenshot.
115
115
  *
116
116
  * `_diagram.html` is an SVG, and no component library should be drawing one.
117
117
  * What is missing is only the frame and the "stage lighting" the request demo
118
118
  * drives — both keyed off `data-lit`, so the markup carries no class either
119
119
  * way. Arguably a `figure()` macro; more likely this stays an app's problem.
120
+ *
121
+ * The Introduction page added the second half of the same gap: a raster figure.
122
+ * A UI kit whose landing page shows nothing it rendered is asking to be taken
123
+ * on trust, so the page carries a screenshot of `examples/fjkit-demo` — and
124
+ * carries it twice, because the claim being illustrated includes dark mode and
125
+ * one picture can only make half of it. Measured: 47 KB each, 94 KB for the
126
+ * pair, on one page. `data-figure` names which scheme a file is for, so the
127
+ * markup stays class-free; `.dark` on the right of the selector is the kit's
128
+ * own theme hook, documented in `ui/shell.html`, not a class this site coined.
129
+ *
130
+ * What a `figure()` macro would own: these four rules and the caption. What it
131
+ * would not solve: both files download whichever scheme is showing. Fixing
132
+ * that needs `<picture>`, and `<picture>` keys off the media query while the
133
+ * toggle keys off the class, so the two disagree the moment a visitor toggles.
120
134
  */
135
+ img[data-figure] { display: block; width: 100%; height: auto; }
136
+ img[data-figure="dark"] { display: none; }
137
+ .dark img[data-figure="light"] { display: none; }
138
+ .dark img[data-figure="dark"] { display: block; }
139
+
121
140
  svg[role="img"] {
122
141
  display: block;
123
142
  width: 100%;
@@ -1,17 +1,19 @@
1
- """Build the documentation site: five pages in two languages, rendered by fjkit.
1
+ """Build the documentation site: seven pages in two languages, rendered by fjkit.
2
2
 
3
3
  uv run python packages/fjkit/docs/workbench/build.py
4
4
 
5
5
  Output, all under `docs/` at the repo root, which is what GitHub Pages serves:
6
6
 
7
7
  index.html Introduction — what the kit is, who it is for, what it is not
8
+ why.html Why fjkit — the three approaches, and what this one costs
9
+ architecture.html Architecture — the closed decisions, as pictures
8
10
  learn.html Learn — the narrative: wiring, htmx, theming, the gate
9
11
  plugins.html Plugins — the extension seam, and the session plugin
10
12
  components.html Components — every macro, live, with the code that made it,
11
13
  one section per file in templates/ui/
12
14
  cheatsheet.html Cheatsheet — the index: every macro in one table each, with
13
15
  the block it takes stated rather than encoded
14
- zh/ the same five pages in Chinese, from `templates/zh/`
16
+ zh/ the same seven pages in Chinese, from `templates/zh/`
15
17
  assets/dist/ fjkit.css, exactly as the wheel ships it
16
18
  assets/vendor/ htmx and Basecoat's JS, exactly as the wheel ships them
17
19
  assets/js/ errors.js, the kit's own script the shell loads
@@ -56,6 +58,7 @@ sliders on these pages), and every component preview — all rendered by
56
58
 
57
59
  from __future__ import annotations
58
60
 
61
+ import gzip
59
62
  import hashlib
60
63
  import json
61
64
  import shutil
@@ -93,7 +96,7 @@ OUT_ASSETS = OUT / "assets"
93
96
 
94
97
  DEMO = REPO / "examples" / "fjkit-demo"
95
98
 
96
- #: The five pages, in reading order. The sidebar and `url_for` are both built
99
+ #: The pages, in reading order. The sidebar and `url_for` are both built
97
100
  #: from this, so a page added here appears in the others' navigation and becomes
98
101
  #: addressable by name without touching a template. The first entry is
99
102
  #: `index.html`, which is what GitHub Pages serves to someone arriving with no
@@ -124,6 +127,48 @@ PAGES = [
124
127
  ),
125
128
  },
126
129
  },
130
+ {
131
+ "route": "why",
132
+ "file": "why.html",
133
+ "icon": "scale",
134
+ "en": {
135
+ "label": "Why fjkit",
136
+ "title": "Why fjkit, and when not",
137
+ "description": (
138
+ "Three ways to put a UI on a FastAPI app and what each one costs, and what this "
139
+ "one gives up in exchange."
140
+ ),
141
+ },
142
+ "zh": {
143
+ "label": "為什麼用",
144
+ "title": "為什麼選 fjkit,以及什麼時候不要",
145
+ "description": (
146
+ "幫 FastAPI app 做介面的三種做法各自的代價,以及這個做法換來什麼又放棄什麼。"
147
+ ),
148
+ },
149
+ },
150
+ {
151
+ "route": "architecture",
152
+ "file": "architecture.html",
153
+ "icon": "layers",
154
+ "en": {
155
+ "label": "Architecture",
156
+ "title": "How fjkit is put together",
157
+ "description": (
158
+ "The five closed architecture decisions as pictures: the package boundary, template "
159
+ "resolution and eject, when the build runs, one partial with two entry points, and "
160
+ "the loop that grows the vocabulary."
161
+ ),
162
+ },
163
+ "zh": {
164
+ "label": "架構",
165
+ "title": "fjkit 是怎麼組起來的",
166
+ "description": (
167
+ "五個已經定案的架構決定,用圖說明:套件邊界、模板解析與 eject、build 發生的時機、"
168
+ "一份 partial 兩個入口,以及那條讓詞彙表長大的迴圈。"
169
+ ),
170
+ },
171
+ },
127
172
  {
128
173
  "route": "learn",
129
174
  "file": "learn.html",
@@ -424,6 +469,39 @@ def is_active(request, name: str) -> bool:
424
469
  return getattr(request, "route", None) == name
425
470
 
426
471
 
472
+ def css_size() -> SimpleNamespace:
473
+ """The stylesheet's measured size, and the budget it is held to.
474
+
475
+ These three numbers were written by hand on the Introduction page and in
476
+ `notes/architecture.md`, and both copies were wrong: the page claimed 23.9 KB
477
+ gzip against a real 25.5, which is outside the range `CHARTER.md` §4.1 had
478
+ already recorded. Nothing read them, so nothing said so.
479
+
480
+ Measured here, from the same file the site links to, the way the footer's
481
+ version stamp is. A number a reader can check should not be a number anyone
482
+ types.
483
+ """
484
+ from fjkit.cli.build_css import GZIP_BUDGET
485
+
486
+ raw = CSS.read_bytes()
487
+ return SimpleNamespace(
488
+ raw_kb=f"{len(raw) / 1024:.0f}",
489
+ gzip_kb=f"{len(gzip.compress(raw)) / 1024:.1f}",
490
+ budget_kb=f"{GZIP_BUDGET / 1024:.0f}",
491
+ pack=DOCS_STYLE,
492
+ )
493
+
494
+
495
+ def site_globals() -> dict:
496
+ """Every template global the site needs, in one place.
497
+
498
+ `build()` and `tests/test_docs_site.py::test_the_site_builds` both construct
499
+ an `Environment`, and a global added to one and not the other makes the test
500
+ pass against a site that cannot build.
501
+ """
502
+ return {"url_for": url_for, "is_active": is_active, "repo": repo, "css": css_size()}
503
+
504
+
427
505
  def content_stamped(prefix: str):
428
506
  """Build the site's `fjkit_static`: the kit's URL, stamped with a hash of
429
507
  the file's bytes rather than its mtime.
@@ -491,7 +569,7 @@ def build() -> int:
491
569
  # into `assets/dist/` come from one word.
492
570
  style=DOCS_STYLE,
493
571
  auto_reload=False,
494
- globals={"url_for": url_for, "is_active": is_active, "repo": repo},
572
+ globals=site_globals(),
495
573
  )
496
574
  )
497
575
  env.globals["fjkit_static"] = content_stamped(lang["static"])
@@ -127,6 +127,18 @@ GROUPS = [
127
127
  "都撐得過一次排序。分兩半——要 morph 的元素自己宣告 "
128
128
  'hx-ext="morph",swap 本身寫 swap="morph:outerHTML"。逐頁載入,不進 shell。',
129
129
  ),
130
+ _m(
131
+ "sse_scripts()",
132
+ en="Loads htmx's sse extension, so a reply can arrive in pieces over one "
133
+ 'connection: hx-ext="sse" and sse-connect on the container, sse-swap on '
134
+ "each element an event fills, sse-close naming the event that ends it. "
135
+ "The server side is templates.events(), which always sends that event — "
136
+ "without it the extension reconnects forever. Per page, never the shell.",
137
+ zh="載入 htmx 的 sse 擴充,讓一段回覆經由同一條連線分段抵達:容器寫 "
138
+ 'hx-ext="sse" 與 sse-connect,每個要被事件填入的元素寫 sse-swap,'
139
+ "sse-close 指定結束串流的事件名稱。伺服器端是 templates.events(),"
140
+ "它一定會送出這個結束事件——少了它,擴充會無限重連。逐頁載入,不進 shell。",
141
+ ),
130
142
  ],
131
143
  },
132
144
  ],
@@ -241,6 +253,13 @@ GROUPS = [
241
253
  zh="route 是路由名稱,不是網址。作用中狀態由 is_active 決定,"
242
254
  "連結不可能跟所在頁面對不上。",
243
255
  ),
256
+ _m(
257
+ "sidebar_item(label, href, active=false, icon_name=none, lead=none)",
258
+ en="For a URL that is not one route: the same route with a different "
259
+ "parameter per row. lead puts a badge in a fixed-width cell so labels align.",
260
+ zh="給不是單一路由的網址用:同一條路由、每列帶不同參數。"
261
+ "lead 把徽章放進固定寬度的格子,讓標籤對齊。",
262
+ ),
244
263
  _m("sidebar_submenu(label, icon_name=none, open=false)", block="sidebar_link()"),
245
264
  _m(
246
265
  'sidebar_trigger(target="sidebar", label="Toggle navigation")',
@@ -307,7 +326,14 @@ GROUPS = [
307
326
  _m('bullet_list(tone="muted")', block="list_item()"),
308
327
  _m("list_item()", block="text"),
309
328
  _m("item_list()", block="item()"),
310
- _m("description_list(layout=\"rows\")", block="description_item()"),
329
+ _m(
330
+ "description_list(layout=\"rows\")",
331
+ block="description_item()",
332
+ en="layout: rows | stacked | inline. inline is a few short facts on one "
333
+ "wrapping line, in small type.",
334
+ zh="layout:rows | stacked | inline。inline 把幾個短事實排在一行、"
335
+ "可換行,字級較小。",
336
+ ),
311
337
  _m(
312
338
  "description_item(term, value=none)",
313
339
  block="value",
@@ -338,7 +364,7 @@ GROUPS = [
338
364
  zh="它自己帶捲動區與可聚焦性,溢出的程式碼用鍵盤也到得了。",
339
365
  ),
340
366
  _m(
341
- "caption(text=none)",
367
+ 'caption(text=none, size="sm", tone="muted", icon_name=none)',
342
368
  block="text",
343
369
  optional=True,
344
370
  en="A muted line that stands on its own. card, section and page_header "
@@ -483,8 +509,10 @@ GROUPS = [
483
509
  _m(
484
510
  'field_row(template="two", gap=3)',
485
511
  block="fields",
486
- en="Two or three fields on one line, collapsing to one column when narrow.",
487
- zh="一行放兩到三個欄位,窄螢幕收成一欄。",
512
+ en="Two or three fields on one line, collapsing to one column when narrow. "
513
+ "template=\"inline\" gives each short field a fixed 16rem cell instead.",
514
+ zh="一行放兩到三個欄位,窄螢幕收成一欄。"
515
+ "template=\"inline\" 改為每個短欄位固定 16rem 一格。",
488
516
  ),
489
517
  _m(
490
518
  "fieldset(legend=none, hint=none)",
@@ -642,15 +670,19 @@ GROUPS = [
642
670
  _m(
643
671
  'tab_panel("detail", lazy=url_for(request, "detail"),\n'
644
672
  ' on=["task-selected"], include="[name=task_id]")',
645
- block="the placeholder",
673
+ block="the placeholder, or the open tab's body",
646
674
  en="lazy is a URL: the panel fetches its own body when its tab is shown, "
647
- "and the block is what stands in until it arrives. on lists the "
675
+ "and the block is what stands in until it arrives. The open tab is the "
676
+ "exception: it does not fetch at load, so its block is the real body, "
677
+ "rendered by the page from the partial lazy returns. on lists the "
648
678
  "broadcasts it follows while it is visible, include the selector for "
649
679
  "what it sends. Not revealed — a panel hidden by display:none reports "
650
680
  "an all-zero rect, which passes htmx's visibility test, so a revealed "
651
681
  "panel fetches at page load.",
652
682
  zh="lazy 是一個 URL:分頁被選到時,這個面板才去抓自己的內容,"
653
- "區塊裡放的是在那之前的暫代內容。on 列出它顯示中要跟著更新的廣播,"
683
+ "區塊裡放的是在那之前的暫代內容。一開始就打開的分頁例外:它在載入時不抓,"
684
+ "所以區塊裡放的是真正的內容,由頁面用 lazy 回傳的同一個 partial 渲染。"
685
+ "on 列出它顯示中要跟著更新的廣播,"
654
686
  "include 是它要送出什麼的選擇器。不能用 revealed——"
655
687
  "被 display:none 藏起來的面板回報的是全為零的矩形,"
656
688
  "剛好通過 htmx 的可見性判斷,所以 revealed 會在頁面載入時就抓。",
@@ -0,0 +1,129 @@
1
+ {#
2
+ The two figures on the Architecture page — one set of coordinates, both
3
+ languages.
4
+
5
+ Same contract as `_diagram.html`: every word arrives as a parameter, so the
6
+ Chinese page does not fork the geometry. The difference is where the words
7
+ come from. `_diagram.html` reads `t.diagram`, which is site chrome carried in
8
+ `build.py`; these are page copy, so the page that shows a figure passes its
9
+ own labels, the way `introduction.html` holds its own prose.
10
+
11
+ No classes anywhere. Colour and size are SVG presentation attributes, and
12
+ `data-accent` marks what the surrounding prose is pointing at — the same hook
13
+ `brand.css` already styles for the request figure. `role="img"` is what picks
14
+ up the frame in `brand.css`, GAP 2.
15
+ #}
16
+
17
+ {#
18
+ Four boxes on the left, four on the right, four arrows between them: the whole
19
+ surface an app touches. The rows are paired on purpose — each contact point is
20
+ one row, so "four places" is something the reader counts rather than something
21
+ the caption asserts.
22
+ #}
23
+ {% macro boundary(t) %}
24
+ <svg viewBox="0 0 720 300" role="img" fill="none"
25
+ font-family="ui-monospace, SFMono-Regular, Menlo, monospace"
26
+ aria-label="{{ t.alt }}">
27
+ <defs>
28
+ <marker id="arch-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
29
+ <path d="M 0 0 L 10 5 L 0 10 z" fill="currentColor"></path>
30
+ </marker>
31
+ </defs>
32
+
33
+ <rect x="8" y="28" width="268" height="262" rx="8" fill="var(--card)" stroke="currentColor"></rect>
34
+ <text x="24" y="50" font-size="10" fill="var(--muted-foreground)">{{ t.app }}</text>
35
+
36
+ <rect x="24" y="62" width="236" height="46" rx="5" stroke="currentColor" stroke-dasharray="3 3"></rect>
37
+ <text x="36" y="82" font-size="11" fill="currentColor">routers/*.py</text>
38
+ <text x="36" y="98" font-size="9" fill="var(--muted-foreground)">{{ t.routers }}</text>
39
+
40
+ <rect x="24" y="120" width="236" height="46" rx="5" stroke="currentColor" stroke-dasharray="3 3"></rect>
41
+ <text x="36" y="140" font-size="11" fill="currentColor">page.html</text>
42
+ <text x="36" y="156" font-size="9" fill="var(--muted-foreground)">{{ t.page }}</text>
43
+
44
+ <rect x="24" y="178" width="236" height="46" rx="5" stroke="currentColor" stroke-dasharray="3 3"></rect>
45
+ <text x="36" y="198" font-size="11" fill="currentColor">_board.html</text>
46
+ <text x="36" y="214" font-size="9" fill="var(--muted-foreground)">{{ t.partial }}</text>
47
+
48
+ <rect x="24" y="236" width="236" height="46" rx="5" stroke="currentColor" stroke-dasharray="3 3"></rect>
49
+ <text x="36" y="256" font-size="11" fill="currentColor">brand.css</text>
50
+ <text x="36" y="272" font-size="9" fill="var(--muted-foreground)">{{ t.brand }}</text>
51
+
52
+ <line data-accent x1="276" y1="85" x2="436" y2="85" stroke="currentColor" stroke-width="1.5" marker-end="url(#arch-arrow)"></line>
53
+ <text x="356" y="78" font-size="9" fill="var(--muted-foreground)" text-anchor="middle">import</text>
54
+
55
+ <line data-accent x1="276" y1="143" x2="436" y2="143" stroke="currentColor" stroke-width="1.5" marker-end="url(#arch-arrow)"></line>
56
+ <text x="356" y="136" font-size="9" fill="var(--muted-foreground)" text-anchor="middle">extends</text>
57
+
58
+ <line data-accent x1="276" y1="201" x2="436" y2="201" stroke="currentColor" stroke-width="1.5" marker-end="url(#arch-arrow)"></line>
59
+ <text x="356" y="194" font-size="9" fill="var(--muted-foreground)" text-anchor="middle">{% raw %}{% from %}{% endraw %}</text>
60
+
61
+ <line data-accent x1="276" y1="259" x2="436" y2="259" stroke="currentColor" stroke-width="1.5" marker-end="url(#arch-arrow)"></line>
62
+ <text x="356" y="252" font-size="9" fill="var(--muted-foreground)" text-anchor="middle">{{ t.override }}</text>
63
+
64
+ <rect x="444" y="28" width="268" height="262" rx="8" fill="var(--card)" stroke="currentColor"></rect>
65
+ <text x="460" y="50" font-size="10" fill="var(--muted-foreground)">FJKIT</text>
66
+
67
+ <rect x="460" y="62" width="236" height="46" rx="5" stroke="currentColor" stroke-dasharray="3 3"></rect>
68
+ <text x="472" y="82" font-size="11" fill="currentColor">fjkit.Templates</text>
69
+ <text x="472" y="98" font-size="9" fill="var(--muted-foreground)">page() · stream()</text>
70
+
71
+ <rect x="460" y="120" width="236" height="46" rx="5" stroke="currentColor" stroke-dasharray="3 3"></rect>
72
+ <text x="472" y="140" font-size="11" fill="currentColor">ui/shell.html</text>
73
+ <text x="472" y="156" font-size="9" fill="var(--muted-foreground)">{{ t.shell }}</text>
74
+
75
+ <rect x="460" y="178" width="236" height="46" rx="5" stroke="currentColor" stroke-dasharray="3 3"></rect>
76
+ <text x="472" y="198" font-size="11" fill="currentColor">ui/layout · data · form · table</text>
77
+ <text x="472" y="214" font-size="9" fill="var(--muted-foreground)">{{ t.vocab }}</text>
78
+
79
+ <rect x="460" y="236" width="236" height="46" rx="5" stroke="currentColor" stroke-dasharray="3 3"></rect>
80
+ <text x="472" y="256" font-size="11" fill="currentColor">dist/fjkit-&lt;pack&gt;.css</text>
81
+ <text x="472" y="272" font-size="9" fill="var(--muted-foreground)">{{ t.css }}</text>
82
+ </svg>
83
+ {% endmacro %}
84
+
85
+ {#
86
+ Two ways in, one template, two ways out.
87
+
88
+ The accented box is the whole point of the picture: a full GET and an htmx
89
+ swap meet at one file, so the page and the fragment it swaps cannot describe
90
+ different things. `@render(..., partial=...)` is what guarantees it.
91
+ #}
92
+ {% macro render_path(t) %}
93
+ <svg viewBox="0 0 720 240" role="img" fill="none"
94
+ font-family="ui-monospace, SFMono-Regular, Menlo, monospace"
95
+ aria-label="{{ t.alt }}">
96
+ <defs>
97
+ <marker id="path-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
98
+ <path d="M 0 0 L 10 5 L 0 10 z" fill="currentColor"></path>
99
+ </marker>
100
+ </defs>
101
+
102
+ <rect x="8" y="26" width="186" height="52" rx="6" fill="var(--card)" stroke="currentColor"></rect>
103
+ <text x="24" y="48" font-size="11" fill="currentColor">GET /tasks</text>
104
+ <text x="24" y="64" font-size="9" fill="var(--muted-foreground)">tasks_page()</text>
105
+
106
+ <rect x="8" y="162" width="186" height="52" rx="6" fill="var(--card)" stroke="currentColor"></rect>
107
+ <text x="24" y="184" font-size="11" fill="currentColor">POST /tasks</text>
108
+ <text x="24" y="200" font-size="9" fill="var(--muted-foreground)">create_task() · hx-post</text>
109
+
110
+ <path d="M 194 52 C 240 52 240 104 272 104" stroke="currentColor" stroke-width="1.5" marker-end="url(#path-arrow)"></path>
111
+ <path d="M 194 188 C 240 188 240 136 272 136" stroke="currentColor" stroke-width="1.5" marker-end="url(#path-arrow)"></path>
112
+
113
+ <rect data-accent x="276" y="88" width="190" height="64" rx="6" fill="var(--card)" stroke="currentColor"></rect>
114
+ <text data-accent x="292" y="112" font-size="11" fill="currentColor">tasks/_board.html</text>
115
+ <text x="292" y="130" font-size="9" fill="var(--muted-foreground)">{{ t.only }}</text>
116
+ <text x="292" y="144" font-size="9" fill="var(--muted-foreground)">{{ t.only_2 }}</text>
117
+
118
+ <path d="M 466 104 C 498 104 498 52 528 52" stroke="currentColor" stroke-width="1.5" marker-end="url(#path-arrow)"></path>
119
+ <path d="M 466 136 C 498 136 498 188 528 188" stroke="currentColor" stroke-width="1.5" marker-end="url(#path-arrow)"></path>
120
+
121
+ <rect x="528" y="26" width="184" height="52" rx="6" fill="var(--card)" stroke="currentColor"></rect>
122
+ <text x="544" y="48" font-size="11" fill="currentColor">{{ t.document }}</text>
123
+ <text x="544" y="64" font-size="9" fill="var(--muted-foreground)">{{ t.document_2 }}</text>
124
+
125
+ <rect x="528" y="162" width="184" height="52" rx="6" fill="var(--card)" stroke="currentColor"></rect>
126
+ <text x="544" y="184" font-size="11" fill="currentColor">{{ t.fragment }}</text>
127
+ <text x="544" y="200" font-size="9" fill="var(--muted-foreground)">{{ t.fragment_2 }}</text>
128
+ </svg>
129
+ {% endmacro %}
@@ -0,0 +1,190 @@
1
+ {% extends "base.html" %}
2
+ {% from "_architecture.html" import boundary, render_path %}
3
+ {% from "_parts.html" import code, defs, lesson, prose, stage %}
4
+ {% from "ui/layout.html" import grid, page_header, stack %}
5
+
6
+ {#
7
+ What the kit looks like from outside, in five pictures.
8
+
9
+ These five existed before this page did, as mermaid blocks in a Chinese-only
10
+ Markdown file sitting in `docs/` — which is the build output, so the file was
11
+ published as plain text, never rendered, and never linked from any
12
+ navigation. Five diagrams nobody could see. They live here now, and that file
13
+ is gone: one home, in both languages, inside the vocabulary.
14
+
15
+ Each section is one decision from `CHARTER.md` §3. The charter says what was
16
+ decided and why; this page is what the decision looks like. Neither repeats
17
+ the other, and the section says which letter it is drawing.
18
+
19
+ House style: one idea per sentence, the takeaway first.
20
+ #}
21
+ {% set sections = [
22
+ {"id": "boundary", "num": "01", "title": "The package boundary"},
23
+ {"id": "loader", "num": "02", "title": "Template resolution"},
24
+ {"id": "timing", "num": "03", "title": "When the build runs"},
25
+ {"id": "render", "num": "04", "title": "The render path"},
26
+ {"id": "gate", "num": "05", "title": "The gate loop"},
27
+ ] %}
28
+
29
+ {% block content %}
30
+ {% call stack(8) %}
31
+
32
+ {% set intro %}
33
+ Five pictures, one for each architecture decision that is closed. What was decided and why is
34
+ CHARTER.md §3; this is what the decisions look like.
35
+ {% endset %}
36
+ {{ page_header("How fjkit is put together", intro) }}
37
+
38
+ {# ============================================================== 01 #}
39
+ {% set a01 %}Your app touches the kit in four places. Everything else is sealed in the package.{% endset %}
40
+ {% call lesson("boundary", "01", "The package boundary", a01, tag="A2") %}
41
+ {% set fig = {
42
+ "alt": "Four boxes in your app — routers, a page template, a partial and brand.css — each with one arrow to the fjkit box it uses.",
43
+ "app": "YOUR APP",
44
+ "routers": "routes, Depends, template choice",
45
+ "page": "calls macros, writes no classes",
46
+ "partial": "the htmx fragment",
47
+ "brand": "the --primary lines, nothing else",
48
+ "override": "overrides tokens",
49
+ "shell": "head, theme, asset links",
50
+ "vocab": "the closed vocabulary",
51
+ "css": "eight packs, built at release",
52
+ } %}
53
+ {{ boundary(fig) }}
54
+
55
+ {% call prose() %}
56
+ <p>
57
+ All four arrows point one way. Your app depends on fjkit; nothing in the kit reaches back
58
+ into your app, and nothing in it knows the shape of your data.
59
+ </p>
60
+ <p>
61
+ <code>brand.css</code> is the whole configuration surface, and it is plain CSS variables.
62
+ No step compiles it.
63
+ </p>
64
+ {% endcall %}
65
+
66
+ {{ defs("What this removes from your repository", [
67
+ ("a Tailwind install", "the binary runs when fjkit is released, not when your app does"),
68
+ ("a watcher", "there is nothing to rebuild after you edit a template"),
69
+ ("a vendoring script", "htmx and Basecoat are pinned in the wheel and served by mount_fjkit"),
70
+ ]) }}
71
+ {% endcall %}
72
+
73
+ {# ============================================================== 02 #}
74
+ {% set a02 %}The app's template directory is searched first, so one import line resolves differently after an eject — and the caller never changes.{% endset %}
75
+ {% call lesson("loader", "02", "Template resolution, and what eject changes", a02, tag="A5") %}
76
+ {{ code('{% from "ui/button.html" import button %}', "jinja", label="the same line, before and after") }}
77
+
78
+ {% call grid(cols=2, gap=4) %}
79
+ {{ defs("Before", [
80
+ ("① app/templates/ui/button.html", "not there — the loader moves on"),
81
+ ("② fjkit/templates/ui/button.html", "found, and this is what renders"),
82
+ ]) }}
83
+ {{ defs("After fjkit eject button", [
84
+ ("① app/templates/ui/button.html", "found, and this is what renders"),
85
+ ("② fjkit/templates/ui/button.html", "never reached"),
86
+ ]) }}
87
+ {% endcall %}
88
+
89
+ {% call prose() %}
90
+ <p>
91
+ Shadowing is the feature, not an accident: <code>ChoiceLoader</code> puts your directory in
92
+ front of the package's.
93
+ </p>
94
+ <p>
95
+ The price is that an ejected file stops receiving upstream fixes, which is why the
96
+ documentation does not lead with it. <code>fjkit eject</code> copies the macros you name
97
+ and re-exports the rest, so the file you own stays small — 49 lines against a 289-line
98
+ source, for <code>badge</code>.
99
+ </p>
100
+ {% endcall %}
101
+ {% endcall %}
102
+
103
+ {# ============================================================== 03 #}
104
+ {% set a03 %}The same pipeline runs either way. The difference is who runs it, and how often.{% endset %}
105
+ {% call lesson("timing", "03", "When the build runs", a03, tag="A1") %}
106
+ {% call grid(cols=2, gap=4) %}
107
+ {{ defs("Every app builds its own", [
108
+ ("your templates + the component CSS", "go into the Tailwind CLI"),
109
+ ("the CLI", "is yours to install, pin and run"),
110
+ ("--watch", "stays open while you work"),
111
+ ("the output", "is a file your deployment has to produce"),
112
+ ]) }}
113
+ {{ defs("fjkit builds at release", [
114
+ ("the kit's templates + the component CSS", "go into the same CLI, in fjkit's CI, once"),
115
+ ("the output", "ships inside the wheel, one file per style pack"),
116
+ ("your brand.css", "is a second <link>, not a second build"),
117
+ ("--watch", "does not exist on your side"),
118
+ ]) }}
119
+ {% endcall %}
120
+
121
+ {% call prose() %}
122
+ <p>
123
+ Measured on the pack this site loads: {{ css.raw_kb }} KB raw, {{ css.gzip_kb }} KB gzip,
124
+ against a {{ css.budget_kb }} KB budget the build enforces. About 217 KB of the raw figure
125
+ is Basecoat's component layer, which ships whole whether fjkit writes one macro over it or
126
+ forty.
127
+ </p>
128
+ {% endcall %}
129
+ {% endcall %}
130
+
131
+ {# ============================================================== 04 #}
132
+ {% set a04 %}A full page and an htmx swap take different routes into the same template.{% endset %}
133
+ {% call lesson("render", "04", "The render path: one partial, two entry points", a04, tag="A6") %}
134
+ {% set fig = {
135
+ "alt": "A GET and a POST both arrive at tasks/_board.html, which leaves as a whole document on one path and as a fragment on the other.",
136
+ "only": "the only definition",
137
+ "only_2": "included, and returned",
138
+ "document": "a whole document",
139
+ "document_2": "page.html, through the shell",
140
+ "fragment": "a fragment",
141
+ "fragment_2": "swapped into #board",
142
+ } %}
143
+ {{ render_path(fig) }}
144
+
145
+ {% call prose() %}
146
+ <p>
147
+ <code>_board.html</code> has two ways in and two ways out, and one definition in the middle.
148
+ What the first paint shows and what the swap replaces it with are therefore rendered from
149
+ the same source, so they cannot drift.
150
+ </p>
151
+ {% endcall %}
152
+
153
+ {{ code('@router.get("/tasks", name="tasks_page")
154
+ @render("tasks/page.html", partial="tasks/_board.html")
155
+ def tasks_page(service: TaskServiceDep) -> BoardResponse:
156
+ return board(service)', label="what guarantees it") }}
157
+
158
+ {% call prose() %}
159
+ <p>
160
+ <code>partial=</code> is the guarantee. One route answers a navigation with the page and an
161
+ htmx request with the fragment, so there is no second route to keep in step.
162
+ </p>
163
+ {% endcall %}
164
+ {% endcall %}
165
+
166
+ {# ============================================================== 05 #}
167
+ {% set a05 %}A closed vocabulary only holds if breaking it fails. Every failure names the component that is missing.{% endset %}
168
+ {% call lesson("gate", "05", "The gate loop", a05, tag="A7") %}
169
+ {{ defs("The loop", [
170
+ ("① you write a template", "and reach for a class the kit does not emit — grid-cols-7, say"),
171
+ ("② fjkit check fails the build", "the class is not in the whitelist, and the whitelist is derived from Basecoat's own CSS rather than maintained by hand"),
172
+ ("③ the blocked class is the answer", "it names a component, or a macro parameter, that does not exist yet"),
173
+ ("④ it goes into ui/*.html", "and the next template that needs it passes"),
174
+ ]) }}
175
+
176
+ {% call prose() %}
177
+ <p>
178
+ This feedback edge is the kit's only expansion mechanism, and the demo is its test case.
179
+ Measured when 0.1 was finished: the same screens written before fjkit produced 258
180
+ violations; rewritten against the kit, 0.
181
+ </p>
182
+ <p>
183
+ The check also blocks a utility that merely happens to exist today. An app that borrows
184
+ <code>gap-4</code> because the shell emits it breaks silently on the day the shell stops.
185
+ </p>
186
+ {% endcall %}
187
+ {% endcall %}
188
+
189
+ {% endcall %}
190
+ {% endblock %}
@@ -466,7 +466,7 @@
466
466
  <p>
467
467
  Render each row with a macro call inside your loop. <code>{% raw %}{% include %}{% endraw %}</code>
468
468
  in a loop does a template lookup and builds a new context per row, and is 20–30% slower
469
- (<a href="{{ repo("docs/jinja-performance.md") }}">jinja-performance.md</a>).
469
+ (<a href="{{ repo("notes/jinja-performance.md") }}">jinja-performance.md</a>).
470
470
  </p>
471
471
  <p>
472
472
  A column carrying a <code>sort_url</code> becomes a sortable header, and