gramlot 0.1.0a1__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 (247) hide show
  1. gramlot-0.1.0a1/.gitignore +31 -0
  2. gramlot-0.1.0a1/LICENSE +176 -0
  3. gramlot-0.1.0a1/NOTICE +8 -0
  4. gramlot-0.1.0a1/PKG-INFO +88 -0
  5. gramlot-0.1.0a1/README.md +60 -0
  6. gramlot-0.1.0a1/assets/gramlot-logo.png +0 -0
  7. gramlot-0.1.0a1/docs/examples/hello/pages/alfa.py +10 -0
  8. gramlot-0.1.0a1/docs/examples/hello/pages/beta.py +10 -0
  9. gramlot-0.1.0a1/docs/examples/hello/pages/hello.py +10 -0
  10. gramlot-0.1.0a1/docs/requirements.txt +2 -0
  11. gramlot-0.1.0a1/docs/source/_static/custom.css +9 -0
  12. gramlot-0.1.0a1/docs/source/_static/request-flow.svg +6 -0
  13. gramlot-0.1.0a1/docs/source/conf.py +29 -0
  14. gramlot-0.1.0a1/docs/source/guide/fastapi.rst +105 -0
  15. gramlot-0.1.0a1/docs/source/guide/first-page.rst +94 -0
  16. gramlot-0.1.0a1/docs/source/guide/overview.rst +62 -0
  17. gramlot-0.1.0a1/docs/source/index.rst +38 -0
  18. gramlot-0.1.0a1/docs/source/reference/fastapi.rst +87 -0
  19. gramlot-0.1.0a1/docs/source/reference/pages.rst +105 -0
  20. gramlot-0.1.0a1/hatch_build.py +30 -0
  21. gramlot-0.1.0a1/js/dom/package-lock.json +730 -0
  22. gramlot-0.1.0a1/js/dom/package.json +43 -0
  23. gramlot-0.1.0a1/js/dom/src/application.js +270 -0
  24. gramlot-0.1.0a1/js/dom/src/builder-base.js +929 -0
  25. gramlot-0.1.0a1/js/dom/src/builder-handler.js +833 -0
  26. gramlot-0.1.0a1/js/dom/src/collections/clipboard.js +60 -0
  27. gramlot-0.1.0a1/js/dom/src/collections/colorpicker.js +65 -0
  28. gramlot-0.1.0a1/js/dom/src/collections/forms.js +27 -0
  29. gramlot-0.1.0a1/js/dom/src/collections/inputs.js +497 -0
  30. gramlot-0.1.0a1/js/dom/src/collections/layout.js +634 -0
  31. gramlot-0.1.0a1/js/dom/src/collections/palette.js +105 -0
  32. gramlot-0.1.0a1/js/dom/src/collections/storetree.js +174 -0
  33. gramlot-0.1.0a1/js/dom/src/collections.js +67 -0
  34. gramlot-0.1.0a1/js/dom/src/contrib/html/html-attributes.js +115 -0
  35. gramlot-0.1.0a1/js/dom/src/contrib/html/html-builder.js +125 -0
  36. gramlot-0.1.0a1/js/dom/src/contrib/html/html5-elements.js +1071 -0
  37. gramlot-0.1.0a1/js/dom/src/contrib/svg/svg-builder.js +60 -0
  38. gramlot-0.1.0a1/js/dom/src/contrib/svg/svg-elements.js +561 -0
  39. gramlot-0.1.0a1/js/dom/src/forms/controller.js +121 -0
  40. gramlot-0.1.0a1/js/dom/src/forms/field.js +215 -0
  41. gramlot-0.1.0a1/js/dom/src/forms/service.js +141 -0
  42. gramlot-0.1.0a1/js/dom/src/forms/validator.js +108 -0
  43. gramlot-0.1.0a1/js/dom/src/forms/value-snapshot.js +58 -0
  44. gramlot-0.1.0a1/js/dom/src/index.js +13 -0
  45. gramlot-0.1.0a1/js/dom/src/input-null-state.js +74 -0
  46. gramlot-0.1.0a1/js/dom/src/pointer.js +78 -0
  47. gramlot-0.1.0a1/js/dom/src/recipe-defaults.js +46 -0
  48. gramlot-0.1.0a1/js/dom/src/recipe-policies.js +68 -0
  49. gramlot-0.1.0a1/js/dom/src/renderer/base.js +387 -0
  50. gramlot-0.1.0a1/js/dom/src/services/recipe-runtime.js +20 -0
  51. gramlot-0.1.0a1/js/dom/src/services/topics.js +52 -0
  52. gramlot-0.1.0a1/js/dom/src/source-bag.js +360 -0
  53. gramlot-0.1.0a1/js/dom/src/target-wrapper.js +201 -0
  54. gramlot-0.1.0a1/js/dom/src/utils.js +11 -0
  55. gramlot-0.1.0a1/js/dom/src/widget-label.js +154 -0
  56. gramlot-0.1.0a1/js/pages/src/bag-xml-view.js +29 -0
  57. gramlot-0.1.0a1/js/pages/src/builder.js +15 -0
  58. gramlot-0.1.0a1/js/pages/src/codemirror-component.js +79 -0
  59. gramlot-0.1.0a1/js/pages/src/dev.js +15 -0
  60. gramlot-0.1.0a1/js/pages/src/inspector-editor.js +200 -0
  61. gramlot-0.1.0a1/js/pages/src/inspector.css +32 -0
  62. gramlot-0.1.0a1/js/pages/src/inspector.js +77 -0
  63. gramlot-0.1.0a1/js/pages/src/lab-session.js +58 -0
  64. gramlot-0.1.0a1/js/pages/src/module.js +13 -0
  65. gramlot-0.1.0a1/js/pages/src/playground-page.js +8 -0
  66. gramlot-0.1.0a1/js/pages/src/playground.js +62 -0
  67. gramlot-0.1.0a1/js/pages/src/recipe-highlight.js +14 -0
  68. gramlot-0.1.0a1/js/pages/src/shell.css +40 -0
  69. gramlot-0.1.0a1/js/pages/src/shortcuts.js +33 -0
  70. gramlot-0.1.0a1/js/pages/src/theme.css +61 -0
  71. gramlot-0.1.0a1/js/pages/src/xmldom.js +5 -0
  72. gramlot-0.1.0a1/pyproject.toml +59 -0
  73. gramlot-0.1.0a1/scripts/prepare_assets.py +54 -0
  74. gramlot-0.1.0a1/scripts/prepare_test_client.py +29 -0
  75. gramlot-0.1.0a1/scripts/verify_distribution.py +37 -0
  76. gramlot-0.1.0a1/src/gramlot/__init__.py +15 -0
  77. gramlot-0.1.0a1/src/gramlot/__main__.py +81 -0
  78. gramlot-0.1.0a1/src/gramlot/builder.py +175 -0
  79. gramlot-0.1.0a1/src/gramlot/contrib/__init__.py +1 -0
  80. gramlot-0.1.0a1/src/gramlot/contrib/fastapi/__init__.py +5 -0
  81. gramlot-0.1.0a1/src/gramlot/contrib/fastapi/application.py +168 -0
  82. gramlot-0.1.0a1/src/gramlot/contrib/fastapi/frontend/entry.js +22 -0
  83. gramlot-0.1.0a1/src/gramlot/contrib/fastapi/frontend/index.html +15 -0
  84. gramlot-0.1.0a1/src/gramlot/contrib/fastapi/frontend/module.js +10 -0
  85. gramlot-0.1.0a1/src/gramlot/contrib/fastapi/runtime.py +68 -0
  86. gramlot-0.1.0a1/src/gramlot/inspector.py +50 -0
  87. gramlot-0.1.0a1/src/gramlot/menu.py +23 -0
  88. gramlot-0.1.0a1/src/gramlot/page.py +18 -0
  89. gramlot-0.1.0a1/src/gramlot/pages/__init__.py +2 -0
  90. gramlot-0.1.0a1/src/gramlot/pages/about.py +13 -0
  91. gramlot-0.1.0a1/src/gramlot/pages/hello_world.py +22 -0
  92. gramlot-0.1.0a1/src/gramlot/pages/playground.py +47 -0
  93. gramlot-0.1.0a1/src/gramlot/pages/widgets/__init__.py +50 -0
  94. gramlot-0.1.0a1/src/gramlot/pages/widgets/bordercontainer.py +34 -0
  95. gramlot-0.1.0a1/src/gramlot/pages/widgets/box.py +18 -0
  96. gramlot-0.1.0a1/src/gramlot/pages/widgets/button.py +43 -0
  97. gramlot-0.1.0a1/src/gramlot/pages/widgets/checkbox.py +19 -0
  98. gramlot-0.1.0a1/src/gramlot/pages/widgets/colorpicker.py +19 -0
  99. gramlot-0.1.0a1/src/gramlot/pages/widgets/combobox.py +21 -0
  100. gramlot-0.1.0a1/src/gramlot/pages/widgets/copybutton.py +25 -0
  101. gramlot-0.1.0a1/src/gramlot/pages/widgets/datetextbox.py +19 -0
  102. gramlot-0.1.0a1/src/gramlot/pages/widgets/filteringselect.py +21 -0
  103. gramlot-0.1.0a1/src/gramlot/pages/widgets/horizontalslider.py +19 -0
  104. gramlot-0.1.0a1/src/gramlot/pages/widgets/numbertextbox.py +19 -0
  105. gramlot-0.1.0a1/src/gramlot/pages/widgets/palette.py +30 -0
  106. gramlot-0.1.0a1/src/gramlot/pages/widgets/panel.py +18 -0
  107. gramlot-0.1.0a1/src/gramlot/pages/widgets/passwordbox.py +19 -0
  108. gramlot-0.1.0a1/src/gramlot/pages/widgets/stackbuttons.py +33 -0
  109. gramlot-0.1.0a1/src/gramlot/pages/widgets/stackcontainer.py +33 -0
  110. gramlot-0.1.0a1/src/gramlot/pages/widgets/storetree.py +23 -0
  111. gramlot-0.1.0a1/src/gramlot/pages/widgets/tab.py +21 -0
  112. gramlot-0.1.0a1/src/gramlot/pages/widgets/tabcontainer.py +35 -0
  113. gramlot-0.1.0a1/src/gramlot/pages/widgets/textbox.py +19 -0
  114. gramlot-0.1.0a1/src/gramlot/pages/widgets/timetextbox.py +19 -0
  115. gramlot-0.1.0a1/src/gramlot/py.typed +0 -0
  116. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/bag-node-container.js +460 -0
  117. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/bag-node.js +622 -0
  118. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/bag.js +2434 -0
  119. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/browser-uuid.js +5 -0
  120. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/index.js +9 -0
  121. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/node-uuid.js +2 -0
  122. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/resolver-wire.js +128 -0
  123. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/resolver.js +533 -0
  124. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/resolvers/StorageResolver.js +102 -0
  125. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/resolvers/UrlResolver.js +209 -0
  126. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/resolvers/UuidResolver.js +37 -0
  127. gramlot-0.1.0a1/src/gramlot/resources/genro-bag-js/src/resolvers/index.js +9 -0
  128. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/CachedKeyDecoder.d.ts +16 -0
  129. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/CachedKeyDecoder.mjs +62 -0
  130. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/CachedKeyDecoder.mjs.map +1 -0
  131. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/DecodeError.d.ts +3 -0
  132. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/DecodeError.mjs +14 -0
  133. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/DecodeError.mjs.map +1 -0
  134. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/Decoder.d.ts +136 -0
  135. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/Decoder.mjs +734 -0
  136. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/Decoder.mjs.map +1 -0
  137. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/Encoder.d.ts +114 -0
  138. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/Encoder.mjs +494 -0
  139. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/Encoder.mjs.map +1 -0
  140. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/ExtData.d.ts +8 -0
  141. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/ExtData.mjs +12 -0
  142. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/ExtData.mjs.map +1 -0
  143. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/ExtensionCodec.d.ts +24 -0
  144. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/ExtensionCodec.mjs +72 -0
  145. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/ExtensionCodec.mjs.map +1 -0
  146. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/context.d.ts +9 -0
  147. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/context.mjs +2 -0
  148. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/context.mjs.map +1 -0
  149. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/decode.d.ts +20 -0
  150. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/decode.mjs +26 -0
  151. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/decode.mjs.map +1 -0
  152. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/decodeAsync.d.ts +18 -0
  153. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/decodeAsync.mjs +30 -0
  154. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/decodeAsync.mjs.map +1 -0
  155. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/encode.d.ts +9 -0
  156. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/encode.mjs +12 -0
  157. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/encode.mjs.map +1 -0
  158. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/index.d.ts +24 -0
  159. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/index.mjs +21 -0
  160. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/index.mjs.map +1 -0
  161. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/timestamp.d.ts +15 -0
  162. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/timestamp.mjs +96 -0
  163. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/timestamp.mjs.map +1 -0
  164. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/tsconfig.dist.esm.tsbuildinfo +1 -0
  165. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/int.d.ts +5 -0
  166. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/int.mjs +27 -0
  167. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/int.mjs.map +1 -0
  168. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/prettyByte.d.ts +1 -0
  169. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/prettyByte.mjs +4 -0
  170. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/prettyByte.mjs.map +1 -0
  171. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/stream.d.ts +4 -0
  172. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/stream.mjs +28 -0
  173. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/stream.mjs.map +1 -0
  174. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/typedArrays.d.ts +1 -0
  175. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/typedArrays.mjs +19 -0
  176. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/typedArrays.mjs.map +1 -0
  177. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/utf8.d.ts +7 -0
  178. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/utf8.mjs +168 -0
  179. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/node_modules/@msgpack/msgpack/dist.esm/utils/utf8.mjs.map +1 -0
  180. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/src/decode.js +128 -0
  181. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/src/encode.js +163 -0
  182. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/src/http.js +101 -0
  183. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/src/index.js +58 -0
  184. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/src/msgpack.js +194 -0
  185. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/src/qs.js +98 -0
  186. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/src/registry.js +434 -0
  187. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/src/utils.js +164 -0
  188. gramlot-0.1.0a1/src/gramlot/resources/genro-tytx/js/src/xml.js +237 -0
  189. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/application.js +270 -0
  190. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/builder-base.js +929 -0
  191. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/builder-handler.js +833 -0
  192. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/collections/clipboard.js +60 -0
  193. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/collections/colorpicker.js +65 -0
  194. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/collections/forms.js +27 -0
  195. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/collections/inputs.js +497 -0
  196. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/collections/layout.js +634 -0
  197. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/collections/palette.js +105 -0
  198. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/collections/storetree.js +174 -0
  199. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/collections.js +67 -0
  200. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/contrib/html/html-attributes.js +115 -0
  201. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/contrib/html/html-builder.js +125 -0
  202. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/contrib/html/html5-elements.js +1071 -0
  203. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/contrib/svg/svg-builder.js +60 -0
  204. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/contrib/svg/svg-elements.js +561 -0
  205. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/forms/controller.js +121 -0
  206. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/forms/field.js +215 -0
  207. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/forms/service.js +141 -0
  208. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/forms/validator.js +108 -0
  209. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/forms/value-snapshot.js +58 -0
  210. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/index.js +13 -0
  211. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/input-null-state.js +74 -0
  212. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/pointer.js +78 -0
  213. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/recipe-defaults.js +46 -0
  214. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/recipe-policies.js +68 -0
  215. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/renderer/base.js +387 -0
  216. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/services/recipe-runtime.js +20 -0
  217. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/services/topics.js +52 -0
  218. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/source-bag.js +360 -0
  219. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/target-wrapper.js +201 -0
  220. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/utils.js +11 -0
  221. gramlot-0.1.0a1/src/gramlot/resources/gramlot-dom/src/widget-label.js +154 -0
  222. gramlot-0.1.0a1/src/gramlot/resources/licenses/@msgpack/msgpack/LICENSE +5 -0
  223. gramlot-0.1.0a1/src/gramlot/resources/licenses/@msgpack/msgpack/package.json +99 -0
  224. gramlot-0.1.0a1/src/gramlot/resources/licenses/genro-bag-js/LICENSE +176 -0
  225. gramlot-0.1.0a1/src/gramlot/resources/licenses/genro-bag-js/NOTICE +7 -0
  226. gramlot-0.1.0a1/src/gramlot/resources/licenses/genro-bag-js/package.json +52 -0
  227. gramlot-0.1.0a1/src/gramlot/resources/licenses/genro-tytx/LICENSE +176 -0
  228. gramlot-0.1.0a1/src/gramlot/resources/licenses/genro-tytx/package.json +34 -0
  229. gramlot-0.1.0a1/src/gramlot/resources/manifest.json +186 -0
  230. gramlot-0.1.0a1/src/gramlot/resources/pages/bag-xml-view.js +29 -0
  231. gramlot-0.1.0a1/src/gramlot/resources/pages/builder.js +15 -0
  232. gramlot-0.1.0a1/src/gramlot/resources/pages/codemirror-component.js +79 -0
  233. gramlot-0.1.0a1/src/gramlot/resources/pages/dev.js +15 -0
  234. gramlot-0.1.0a1/src/gramlot/resources/pages/inspector-editor.js +200 -0
  235. gramlot-0.1.0a1/src/gramlot/resources/pages/inspector.css +32 -0
  236. gramlot-0.1.0a1/src/gramlot/resources/pages/inspector.js +77 -0
  237. gramlot-0.1.0a1/src/gramlot/resources/pages/lab-session.js +58 -0
  238. gramlot-0.1.0a1/src/gramlot/resources/pages/module.js +13 -0
  239. gramlot-0.1.0a1/src/gramlot/resources/pages/playground-page.js +8 -0
  240. gramlot-0.1.0a1/src/gramlot/resources/pages/playground.js +62 -0
  241. gramlot-0.1.0a1/src/gramlot/resources/pages/recipe-highlight.js +14 -0
  242. gramlot-0.1.0a1/src/gramlot/resources/pages/shell.css +40 -0
  243. gramlot-0.1.0a1/src/gramlot/resources/pages/shortcuts.js +33 -0
  244. gramlot-0.1.0a1/src/gramlot/resources/pages/theme.css +61 -0
  245. gramlot-0.1.0a1/src/gramlot/resources/pages/xmldom.js +5 -0
  246. gramlot-0.1.0a1/src/gramlot/transport.py +35 -0
  247. gramlot-0.1.0a1/src/gramlot/widget_test_page.py +35 -0
@@ -0,0 +1,31 @@
1
+ # Python caches and local environments
2
+ __pycache__/
3
+ *.py[cod]
4
+ .venv/
5
+ venv/
6
+
7
+ # Local configuration and credentials
8
+ .env
9
+ .env.*
10
+
11
+ # Editor and operating system files
12
+ .idea/
13
+ .vscode/
14
+ .DS_Store
15
+ Thumbs.db
16
+
17
+ # Build and test output
18
+ build/
19
+ dist/
20
+ *.egg-info/
21
+ node_modules/
22
+ .pytest_cache/
23
+ .ruff_cache/
24
+ .coverage
25
+ htmlcov/
26
+
27
+ # Prepared browser assets (included explicitly in distributions)
28
+ src/gramlot/resources/
29
+
30
+ # Generated Sphinx documentation
31
+ docs/_build/
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
gramlot-0.1.0a1/NOTICE ADDED
@@ -0,0 +1,8 @@
1
+ Gramlot
2
+ Copyright 2025-2026 Softwell S.r.l.
3
+
4
+ This product includes software developed at Softwell S.r.l.
5
+ (https://www.softwell.it/), originally in Genro Pages and Genro DOM JS.
6
+ The original Genro DOM JS notice states: Copyright 2025 Softwell S.r.l.
7
+
8
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.5
2
+ Name: gramlot
3
+ Version: 0.1.0a1
4
+ Summary: Declarative web UI framework describing interfaces in Python as Live Object Trees
5
+ Project-URL: Homepage, https://gramlot.com
6
+ Project-URL: Repository, https://github.com/genropy/gramlot
7
+ Project-URL: Issues, https://github.com/genropy/gramlot/issues
8
+ Author-email: Genropy Team <info@softwell.it>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ License-File: NOTICE
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Requires-Python: >=3.11
17
+ Requires-Dist: genro-bag<0.22,>=0.21.1
18
+ Requires-Dist: genro-builders>=0.23.2
19
+ Requires-Dist: genro-toolbox>=0.14.0
20
+ Requires-Dist: genro-tytx[msgpack]>=0.15.0
21
+ Provides-Extra: fastapi
22
+ Requires-Dist: fastapi>=0.115; extra == 'fastapi'
23
+ Requires-Dist: uvicorn>=0.30; extra == 'fastapi'
24
+ Provides-Extra: test
25
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'test'
26
+ Requires-Dist: pytest>=7.0; extra == 'test'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # Gramlot
30
+
31
+ <img src="https://raw.githubusercontent.com/genropy/gramlot/main/assets/gramlot-logo.png" alt="Gramlot logo" width="180">
32
+
33
+ **GRAMmar for Live Object Trees**
34
+
35
+ Describe interfaces in Python and render them with the Gramlot JavaScript runtime.
36
+ The first alpha includes typed Source transport, widgets and an optional FastAPI
37
+ integration with automatic page discovery.
38
+
39
+ ## FastAPI integration
40
+
41
+ Create `pages/hello.py` in your application directory:
42
+
43
+ ```python
44
+ from genro_toolbox import metadata
45
+ from gramlot.page import WebPage
46
+
47
+ @metadata(title="Hello")
48
+ class Page(WebPage):
49
+ """Display a greeting."""
50
+
51
+ def main(self, root):
52
+ root.h1("Hello World")
53
+ ```
54
+
55
+ With Gramlot and its FastAPI extra installed:
56
+
57
+ ```sh
58
+ gramlot fastapi serve /path/to/my_app
59
+ ```
60
+
61
+ Open `http://127.0.0.1:8000/page/`. No `main.py` or JSON registry is required.
62
+ For custom servers, use `GramlotApplication` or `mount_gramlot` from
63
+ `gramlot.contrib.fastapi`. More integrations coming soon.
64
+
65
+ ## Documentation
66
+
67
+ - [Getting started](docs/source/guide/first-page.rst)
68
+ - [FastAPI integration](docs/source/guide/fastapi.rst)
69
+ - [Pages and reserved metadata](docs/source/reference/pages.rst)
70
+ - [Documentation development](docs/development/building-docs.rst)
71
+
72
+ Alpha candidate `0.1.0a1` is prepared for its first release. For local installation,
73
+ build a wheel and install it with the `[fastapi]` extra. See
74
+ [build and release instructions](docs/release.md).
75
+
76
+ ## Development
77
+
78
+ ```sh
79
+ npm --prefix js/dom ci --ignore-scripts
80
+ python scripts/prepare_assets.py
81
+ python scripts/prepare_test_client.py
82
+ python -m pip install '.[test,fastapi]' httpx
83
+ GRAMLOT_CLIENT_MODULES="$PWD/build/test-client" python -m pytest -q
84
+ npm --prefix js/dom test
85
+ ```
86
+
87
+ Documentation builds independently from runtime packages. See `docs/requirements.txt`.
88
+ Gramlot is licensed under Apache 2.0.
@@ -0,0 +1,60 @@
1
+ # Gramlot
2
+
3
+ <img src="https://raw.githubusercontent.com/genropy/gramlot/main/assets/gramlot-logo.png" alt="Gramlot logo" width="180">
4
+
5
+ **GRAMmar for Live Object Trees**
6
+
7
+ Describe interfaces in Python and render them with the Gramlot JavaScript runtime.
8
+ The first alpha includes typed Source transport, widgets and an optional FastAPI
9
+ integration with automatic page discovery.
10
+
11
+ ## FastAPI integration
12
+
13
+ Create `pages/hello.py` in your application directory:
14
+
15
+ ```python
16
+ from genro_toolbox import metadata
17
+ from gramlot.page import WebPage
18
+
19
+ @metadata(title="Hello")
20
+ class Page(WebPage):
21
+ """Display a greeting."""
22
+
23
+ def main(self, root):
24
+ root.h1("Hello World")
25
+ ```
26
+
27
+ With Gramlot and its FastAPI extra installed:
28
+
29
+ ```sh
30
+ gramlot fastapi serve /path/to/my_app
31
+ ```
32
+
33
+ Open `http://127.0.0.1:8000/page/`. No `main.py` or JSON registry is required.
34
+ For custom servers, use `GramlotApplication` or `mount_gramlot` from
35
+ `gramlot.contrib.fastapi`. More integrations coming soon.
36
+
37
+ ## Documentation
38
+
39
+ - [Getting started](docs/source/guide/first-page.rst)
40
+ - [FastAPI integration](docs/source/guide/fastapi.rst)
41
+ - [Pages and reserved metadata](docs/source/reference/pages.rst)
42
+ - [Documentation development](docs/development/building-docs.rst)
43
+
44
+ Alpha candidate `0.1.0a1` is prepared for its first release. For local installation,
45
+ build a wheel and install it with the `[fastapi]` extra. See
46
+ [build and release instructions](docs/release.md).
47
+
48
+ ## Development
49
+
50
+ ```sh
51
+ npm --prefix js/dom ci --ignore-scripts
52
+ python scripts/prepare_assets.py
53
+ python scripts/prepare_test_client.py
54
+ python -m pip install '.[test,fastapi]' httpx
55
+ GRAMLOT_CLIENT_MODULES="$PWD/build/test-client" python -m pytest -q
56
+ npm --prefix js/dom test
57
+ ```
58
+
59
+ Documentation builds independently from runtime packages. See `docs/requirements.txt`.
60
+ Gramlot is licensed under Apache 2.0.
Binary file
@@ -0,0 +1,10 @@
1
+ from genro_toolbox import metadata
2
+ from gramlot.page import WebPage
3
+
4
+
5
+ @metadata(title="Alfa")
6
+ class Page(WebPage):
7
+ """Display the first additional page in the discovery example."""
8
+
9
+ def main(self, root):
10
+ root.h1("Alfa page")
@@ -0,0 +1,10 @@
1
+ from genro_toolbox import metadata
2
+ from gramlot.page import WebPage
3
+
4
+
5
+ @metadata(title="Beta")
6
+ class Page(WebPage):
7
+ """Display the second additional page in the discovery example."""
8
+
9
+ def main(self, root):
10
+ root.h1("Beta page")
@@ -0,0 +1,10 @@
1
+ from genro_toolbox import metadata
2
+ from gramlot.page import WebPage
3
+
4
+
5
+ @metadata(title="Hello")
6
+ class Page(WebPage):
7
+ """Display a greeting to introduce a Python-authored Gramlot page."""
8
+
9
+ def main(self, root):
10
+ root.h1("Hello World")
@@ -0,0 +1,2 @@
1
+ Sphinx>=8.2,<9
2
+ furo>=2024.8.6,<2027
@@ -0,0 +1,9 @@
1
+ /* Gramlot identity; layout, navigation and theme switching belong to Furo. */
2
+ .sidebar-brand { gap: .7rem; }
3
+ .sidebar-logo { width: 108px; height: 108px; object-fit: contain;
4
+ background: white; border-radius: 20px; }
5
+ .sidebar-brand-text { font-weight: 750; letter-spacing: -.03em; }
6
+ h1 { letter-spacing: -.035em; }
7
+ .content p, .content li { line-height: 1.7; }
8
+ article img { max-width: 100%; height: auto; }
9
+ .highlight { border-radius: 8px; }
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 850 180" role="img" aria-labelledby="title desc">
2
+ <title id="title">From a Python recipe to the browser</title><desc id="desc">The browser requests HTML and then a recipe. The server runs Python main, returns Source as TYTX, and the browser mounts the interface.</desc>
3
+ <defs><marker id="arrow" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto"><path d="M0 0L8 4L0 8" fill="none" stroke="#52677c"/></marker></defs>
4
+ <g fill="#eef4fa" stroke="#9eb4c8"><rect x="5" y="35" width="245" height="95" rx="8"/><rect x="300" y="35" width="245" height="95" rx="8"/><rect x="595" y="35" width="245" height="95" rx="8"/></g>
5
+ <g font-family="sans-serif" text-anchor="middle" fill="#20354a"><text x="127" y="65" font-size="19">Browser startup</text><text x="127" y="96" font-size="15">HTML → recipe request</text><text x="422" y="65" font-size="19">Python on server</text><text x="422" y="96" font-size="15">Page.main → Source → TYTX</text><text x="717" y="65" font-size="19">Browser runtime</text><text x="717" y="96" font-size="15">Decode → mount → DOM</text></g>
6
+ <g stroke="#52677c" stroke-width="2" marker-end="url(#arrow)"><path d="M255 82H292"/><path d="M550 82H588"/></g></svg>
@@ -0,0 +1,29 @@
1
+ """English user documentation; builds without importing optional server packages."""
2
+ from pathlib import Path
3
+ import tomllib
4
+
5
+ project = 'Gramlot'
6
+ author = 'Gramlot Team'
7
+ copyright = '2026, Softwell S.r.l.'
8
+ release = tomllib.loads((Path(__file__).parents[2] / 'pyproject.toml').read_text())['project']['version']
9
+ language = 'en'
10
+ extensions = []
11
+ root_doc = 'index'
12
+ exclude_patterns = []
13
+ nitpicky = True
14
+ html_theme = 'furo'
15
+ html_logo = '../../assets/gramlot-logo.png'
16
+ html_static_path = ['_static']
17
+ html_css_files = ['custom.css']
18
+ html_theme_options = {
19
+ 'light_css_variables': {
20
+ 'color-brand-primary': '#1643c5',
21
+ 'color-brand-content': '#1643c5',
22
+ 'color-sidebar-background': '#f5f7fc',
23
+ },
24
+ 'dark_css_variables': {
25
+ 'color-brand-primary': '#ffcc43',
26
+ 'color-brand-content': '#8fb2ff',
27
+ },
28
+ }
29
+ html_title = f'Gramlot {release} documentation'
@@ -0,0 +1,105 @@
1
+ FastAPI integration
2
+ ===================
3
+
4
+ Choose the amount of server code you need
5
+ -----------------------------------------
6
+
7
+ For pages alone, :doc:`first-page` uses ``gramlot fastapi serve [directory]``.
8
+ The adapter creates FastAPI and starts Uvicorn. You only author pages.
9
+
10
+ For a customized FastAPI application, create ``main.py`` at the application root:
11
+
12
+ .. code-block:: python
13
+
14
+ from gramlot.contrib.fastapi import GramlotApplication
15
+
16
+ app = GramlotApplication()
17
+
18
+ @app.get('/health')
19
+ def health():
20
+ return {'status': 'ok'}
21
+
22
+ Run it from that root with ``uvicorn main:app``. ``GramlotApplication`` is a
23
+ FastAPI subclass; normal endpoint decorators, middleware registration and
24
+ FastAPI options remain available. The directory default is the working
25
+ directory, not the directory containing the calling Python file.
26
+
27
+ The discovery CLI does not load your custom ``main.py``. Use Uvicorn explicitly
28
+ when you want to execute that application module.
29
+
30
+ Integrate with an existing application
31
+ --------------------------------------
32
+
33
+ .. code-block:: python
34
+
35
+ from fastapi import FastAPI
36
+ from gramlot.contrib.fastapi import mount_gramlot
37
+
38
+ app = FastAPI()
39
+ mount_gramlot(app, directory='/srv/catalogue', prefix='/catalogue')
40
+ mount_gramlot(app, directory='/srv/help', prefix='/help')
41
+
42
+ Each application root contains its own ``pages/`` directory. Each registration
43
+ has a separate page collection. Choose distinct prefixes and avoid collisions
44
+ with your existing routes. This registration is not the same operation as
45
+ mounting the whole Gramlot application below another ASGI URL prefix.
46
+
47
+ What happens after a request
48
+ ----------------------------
49
+
50
+ 1. At startup, the adapter discovers Page classes and registers routes and
51
+ packaged static assets. It has not run the page's ``main`` yet.
52
+ 2. ``GET /page/hello/`` checks the registry and returns an HTML shell containing
53
+ a root element, an import map, startup data and the shared JavaScript entry.
54
+ 3. The browser loads runtime modules and fetches ``/page/hello/recipe``.
55
+ 4. The adapter creates a new Page and builder, calls ``main(root)``, then
56
+ returns the Source tree as ``application/vnd.tytx+json``.
57
+ 5. The browser decodes TYTX, loads the Source into the JavaScript builder and
58
+ mounts it using the runtime Application. That creates the visible DOM.
59
+
60
+ The index follows the same shell/recipe flow. Its recipe builds the navigation
61
+ from the discovered files. Links navigate to full documents; this adapter does
62
+ not add a client-side router. This is not server-side HTML rendering of page
63
+ content, so do not assume content is in the initial HTML for crawlers.
64
+
65
+ Where the shared code lives
66
+ ---------------------------
67
+
68
+ .. list-table:: Read the implementation in this order
69
+ :header-rows: 1
70
+ :widths: 45 55
71
+
72
+ * - File under ``src/gramlot/``
73
+ - Responsibility
74
+ * - ``__main__.py``
75
+ - Command parsing and optional Uvicorn startup
76
+ * - ``contrib/fastapi/application.py``
77
+ - FastAPI subclass, page collection, discovery and request methods
78
+ * - ``contrib/fastapi/runtime.py``
79
+ - Wheel asset locations, URL mapping and import map constants
80
+ * - ``contrib/fastapi/frontend/index.html``
81
+ - Initial document placeholders
82
+ * - ``contrib/fastapi/frontend/entry.js``
83
+ - Fetch, decode and mount the recipe
84
+ * - ``contrib/fastapi/frontend/module.js``
85
+ - Bridge for the current TYTX codec module lookup
86
+
87
+ Constants describe conventions shared by applications. Instance properties
88
+ hold application configuration and discovered classes. Page and builder local
89
+ variables belong to a single request. ``PageCollection`` is separate from
90
+ FastAPI so its method names do not override FastAPI methods.
91
+
92
+ Supported scope
93
+ ---------------
94
+
95
+ The current adapter supports pages, packaged resources and startup recipes.
96
+ It does not inject requests into Page, add server calls, retain sessions,
97
+ configure authentication or enable an inspector. Custom FastAPI applications
98
+ remain free to provide their own endpoints and middleware.
99
+
100
+ Browser deployment under a reverse-proxy subpath or a parent ASGI mount
101
+ (``root_path``) is not supported yet; generated URLs assume registration at
102
+ the server root with the configured page prefix. The default local command is
103
+ a development entry point, not a production deployment recipe.
104
+
105
+ See :doc:`../reference/fastapi` for constructor options and routes.
@@ -0,0 +1,94 @@
1
+ Your first three pages
2
+ ======================
3
+
4
+ Install the local alpha
5
+ -----------------------
6
+
7
+ Use Python 3.11 or newer and a virtual environment. This alpha is not published
8
+ on PyPI yet; obtain a wheel built with the FastAPI adapter from the maintainer.
9
+ Replace the sample wheel path with its actual location.
10
+
11
+ .. code-block:: console
12
+
13
+ python3 -m venv .venv
14
+ source .venv/bin/activate
15
+ python -m pip install '/path/to/gramlot-0.1.0a1-py3-none-any.whl[fastapi]'
16
+
17
+ On Windows, activate the environment with ``.venv\Scripts\activate`` instead.
18
+ Once a release is published, the corresponding installation will be
19
+ ``python -m pip install 'gramlot[fastapi]'``. The wheel includes browser assets;
20
+ these Python examples do not require Node or an application frontend build.
21
+
22
+ Create the application directory
23
+ --------------------------------
24
+
25
+ .. code-block:: text
26
+
27
+ my_app/
28
+ └── pages/
29
+ ├── hello.py
30
+ ├── alfa.py
31
+ └── beta.py
32
+
33
+ No ``main.py`` or ``application.json`` is needed. Each file defines its own
34
+ ``Page`` subclass. Save this as ``pages/hello.py``:
35
+
36
+ .. literalinclude:: ../../examples/hello/pages/hello.py
37
+ :language: python
38
+
39
+ ``metadata`` comes from Genro Toolbox, already a Gramlot dependency. It sets
40
+ the class attribute ``title`` used by the index. The docstring explains the
41
+ page to a reader of the source; the current index does not display it.
42
+ See :doc:`../reference/pages` for reserved names and exact behavior.
43
+
44
+ Save the other two pages:
45
+
46
+ .. literalinclude:: ../../examples/hello/pages/alfa.py
47
+ :language: python
48
+ :caption: pages/alfa.py
49
+
50
+ .. literalinclude:: ../../examples/hello/pages/beta.py
51
+ :language: python
52
+ :caption: pages/beta.py
53
+
54
+ Start the server
55
+ ----------------
56
+
57
+ From anywhere, provide the application directory:
58
+
59
+ .. code-block:: console
60
+
61
+ gramlot fastapi serve /path/to/my_app --port 8000
62
+
63
+ Or enter that directory first:
64
+
65
+ .. code-block:: console
66
+
67
+ cd /path/to/my_app
68
+ gramlot fastapi serve
69
+
70
+ Open http://127.0.0.1:8000/page/. The generated index lists Alfa, Beta and Hello,
71
+ ordered by filename. Follow each link to see its heading. The three URLs are
72
+ ``/page/alfa/``, ``/page/beta/`` and ``/page/hello/``.
73
+
74
+ Change the text in ``root.h1(...)``, stop the server with Ctrl+C, start it again
75
+ and refresh the browser. Discovery happens at startup: this command does not
76
+ currently enable automatic reload.
77
+
78
+ The files above are also runnable directly from a Gramlot checkout:
79
+
80
+ .. code-block:: console
81
+
82
+ gramlot fastapi serve docs/examples/hello
83
+
84
+ If startup fails
85
+ ----------------
86
+
87
+ * **Missing optional dependencies:** install the wheel with ``[fastapi]`` in
88
+ the same environment that provides the ``gramlot`` command.
89
+ * **Pages directory not found:** pass the parent of ``pages/``, not ``pages/``
90
+ itself. With no argument, the current working directory is used.
91
+ * **Cannot load page:** inspect the named file. It must define a local
92
+ ``Page(WebPage)`` with an implementation of ``main``.
93
+ * **Address already in use:** stop the previous server or select another
94
+ ``--port``. Opening a URL does not start the server.