@webqit/webflo 0.11.61 → 0.20.2-next.0

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 (235) hide show
  1. package/.github/FUNDING.yml +12 -0
  2. package/.github/workflows/publish.yml +48 -0
  3. package/.gitignore +2 -0
  4. package/LICENSE +2 -2
  5. package/README.md +71 -2050
  6. package/package.json +28 -13
  7. package/site/-/_.md +139 -0
  8. package/site/-/docs.old.md +2010 -0
  9. package/site/.vitepress/cache/deps/@braintree_sanitize-url 2.js +93 -0
  10. package/site/.vitepress/cache/deps/@braintree_sanitize-url.js +93 -0
  11. package/site/.vitepress/cache/deps/@braintree_sanitize-url.js 2.map +7 -0
  12. package/site/.vitepress/cache/deps/@braintree_sanitize-url.js.map +7 -0
  13. package/site/.vitepress/cache/deps/_metadata 2.json +85 -0
  14. package/site/.vitepress/cache/deps/_metadata.json +85 -0
  15. package/site/.vitepress/cache/deps/chunk-BUSYA2B4 2.js +9 -0
  16. package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js +9 -0
  17. package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js 2.map +7 -0
  18. package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js.map +7 -0
  19. package/site/.vitepress/cache/deps/chunk-Q2AYPHVK 2.js +9719 -0
  20. package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js +9719 -0
  21. package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js 2.map +7 -0
  22. package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js.map +7 -0
  23. package/site/.vitepress/cache/deps/chunk-QAXAIFA7 2.js +12705 -0
  24. package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js +12705 -0
  25. package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js 2.map +7 -0
  26. package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js.map +7 -0
  27. package/site/.vitepress/cache/deps/cytoscape 2.js +30278 -0
  28. package/site/.vitepress/cache/deps/cytoscape-cose-bilkent 2.js +4710 -0
  29. package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js +4710 -0
  30. package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js 2.map +7 -0
  31. package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js.map +7 -0
  32. package/site/.vitepress/cache/deps/cytoscape.js +30278 -0
  33. package/site/.vitepress/cache/deps/cytoscape.js 2.map +7 -0
  34. package/site/.vitepress/cache/deps/cytoscape.js.map +7 -0
  35. package/site/.vitepress/cache/deps/dayjs 2.js +285 -0
  36. package/site/.vitepress/cache/deps/dayjs.js +285 -0
  37. package/site/.vitepress/cache/deps/dayjs.js 2.map +7 -0
  38. package/site/.vitepress/cache/deps/dayjs.js.map +7 -0
  39. package/site/.vitepress/cache/deps/debug 2.js +453 -0
  40. package/site/.vitepress/cache/deps/debug.js +453 -0
  41. package/site/.vitepress/cache/deps/debug.js 2.map +7 -0
  42. package/site/.vitepress/cache/deps/debug.js.map +7 -0
  43. package/site/.vitepress/cache/deps/package 2.json +3 -0
  44. package/site/.vitepress/cache/deps/package.json +3 -0
  45. package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api 2.js +4507 -0
  46. package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4507 -0
  47. package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js 2.map +7 -0
  48. package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
  49. package/site/.vitepress/cache/deps/vitepress___@vueuse_core 2.js +584 -0
  50. package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js +584 -0
  51. package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js 2.map +7 -0
  52. package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
  53. package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap 2.js +1166 -0
  54. package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1166 -0
  55. package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js 2.map +7 -0
  56. package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
  57. package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js 2.js +1667 -0
  58. package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1667 -0
  59. package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js 2.map +7 -0
  60. package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
  61. package/site/.vitepress/cache/deps/vitepress___minisearch 2.js +1815 -0
  62. package/site/.vitepress/cache/deps/vitepress___minisearch.js +1815 -0
  63. package/site/.vitepress/cache/deps/vitepress___minisearch.js 2.map +7 -0
  64. package/site/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
  65. package/site/.vitepress/cache/deps/vue 2.js +344 -0
  66. package/site/.vitepress/cache/deps/vue.js +344 -0
  67. package/site/.vitepress/cache/deps/vue.js 2.map +7 -0
  68. package/site/.vitepress/cache/deps/vue.js.map +7 -0
  69. package/site/.vitepress/config.ts +147 -0
  70. package/site/.vitepress/theme/custom.css +50 -0
  71. package/site/.vitepress/theme/index.ts +6 -0
  72. package/site/api/webflo-fetch/FormData.md +0 -0
  73. package/site/api/webflo-fetch/Headers.md +0 -0
  74. package/site/api/webflo-fetch/LiveResponse.md +0 -0
  75. package/site/api/webflo-fetch/Request.md +0 -0
  76. package/site/api/webflo-fetch/Response.md +0 -0
  77. package/site/api/webflo-fetch/fetch.md +0 -0
  78. package/site/api/webflo-routing/HttpCookies.md +0 -0
  79. package/site/api/webflo-routing/HttpEvent/respondWith.md +1 -0
  80. package/site/api/webflo-routing/HttpEvent/waitUntil.md +1 -0
  81. package/site/api/webflo-routing/HttpEvent/waitUntilNavigate.md +1 -0
  82. package/site/api/webflo-routing/HttpEvent.md +30 -0
  83. package/site/api/webflo-routing/HttpSession.md +0 -0
  84. package/site/api/webflo-routing/HttpState.md +0 -0
  85. package/site/api/webflo-routing/HttpUser.md +0 -0
  86. package/site/api/webflo-routing/handler/fetch.md +42 -0
  87. package/site/api/webflo-routing/handler/next.md +54 -0
  88. package/site/api/webflo-routing/handler.md +119 -0
  89. package/site/api.md +26 -0
  90. package/site/contributing.md +16 -0
  91. package/site/docs/advanced/lifecycles.md +20 -0
  92. package/site/docs/advanced/redirects.md +0 -0
  93. package/site/docs/advanced/routing.md +1 -0
  94. package/site/docs/advanced.md +9 -0
  95. package/site/docs/concepts/realtime.md +637 -0
  96. package/site/docs/concepts/rendering.md +60 -0
  97. package/site/docs/concepts/request-response.md +47 -0
  98. package/site/docs/concepts/routing.md +656 -0
  99. package/site/docs/concepts/state.md +44 -0
  100. package/site/docs/concepts/templates.md +48 -0
  101. package/site/docs/concepts.md +97 -0
  102. package/site/docs/getting-started.md +378 -0
  103. package/site/docs/tech-stack.md +56 -0
  104. package/site/docs.md +100 -0
  105. package/site/examples/pwa.md +10 -0
  106. package/site/examples/web.md +11 -0
  107. package/site/examples.md +10 -0
  108. package/site/faq.md +13 -0
  109. package/site/guides/guide-auth.md +13 -0
  110. package/site/guides/guide-file-upload.md +11 -0
  111. package/site/guides/guide-service-worker.md +10 -0
  112. package/site/guides/tutorial-1-todo.md +24 -0
  113. package/site/guides.md +15 -0
  114. package/site/index.md +39 -0
  115. package/site/public/img/brand/logo-670x670.png +0 -0
  116. package/site/recipes/realtime.md +11 -0
  117. package/site/recipes/streaming.md +15 -0
  118. package/site/reference/cli.md +11 -0
  119. package/site/reference/config.md +13 -0
  120. package/site/reference/tools.md +9 -0
  121. package/src/Context.js +3 -11
  122. package/src/config-pi/deployment/Env.js +6 -19
  123. package/src/config-pi/deployment/Layout.js +11 -3
  124. package/src/config-pi/runtime/Client.js +40 -48
  125. package/src/config-pi/runtime/Server.js +52 -20
  126. package/src/config-pi/runtime/client/Worker.js +22 -20
  127. package/src/config-pi/static/Init.js +57 -0
  128. package/src/config-pi/static/index.js +2 -0
  129. package/src/deployment-pi/origins/index.js +1 -1
  130. package/src/deployment-pi/util.js +161 -0
  131. package/src/index.js +3 -9
  132. package/src/init-pi/index.js +117 -0
  133. package/src/init-pi/templates/pwa/app/handler.server.js +8 -0
  134. package/src/init-pi/templates/pwa/app/page.html +7 -0
  135. package/src/init-pi/templates/pwa/package.json +19 -0
  136. package/src/init-pi/templates/pwa/public/assets/app.css +16 -0
  137. package/src/init-pi/templates/pwa/public/index.html +39 -0
  138. package/src/init-pi/templates/pwa/public/manifest.json +29 -0
  139. package/src/init-pi/templates/web/app/handler.server.js +8 -0
  140. package/src/init-pi/templates/web/app/page.html +7 -0
  141. package/src/init-pi/templates/web/package.json +19 -0
  142. package/src/init-pi/templates/web/public/assets/app.css +16 -0
  143. package/src/init-pi/templates/web/public/index.html +39 -0
  144. package/src/runtime-pi/WebfloRuntime.js +350 -0
  145. package/src/runtime-pi/index.js +3 -10
  146. package/src/runtime-pi/webflo-client/ClientSideCookies.js +17 -0
  147. package/src/runtime-pi/webflo-client/ClientSideWorkport.js +63 -0
  148. package/src/runtime-pi/webflo-client/DeviceCapabilities.js +213 -0
  149. package/src/runtime-pi/webflo-client/WebfloClient.js +500 -0
  150. package/src/runtime-pi/webflo-client/WebfloRootClient1.js +206 -0
  151. package/src/runtime-pi/webflo-client/WebfloRootClient2.js +113 -0
  152. package/src/runtime-pi/webflo-client/WebfloSubClient.js +118 -0
  153. package/src/runtime-pi/webflo-client/index.js +17 -0
  154. package/src/runtime-pi/webflo-client/webflo-codegen.js +469 -0
  155. package/src/runtime-pi/webflo-client/webflo-devmode.js +243 -0
  156. package/src/runtime-pi/webflo-client/webflo-embedded.js +50 -0
  157. package/src/runtime-pi/webflo-fetch/LiveResponse.js +437 -0
  158. package/src/runtime-pi/webflo-fetch/cookies.js +10 -0
  159. package/src/runtime-pi/webflo-fetch/fetch.js +16 -0
  160. package/src/runtime-pi/webflo-fetch/formdata.js +54 -0
  161. package/src/runtime-pi/webflo-fetch/headers.js +151 -0
  162. package/src/runtime-pi/webflo-fetch/index.js +5 -0
  163. package/src/runtime-pi/webflo-fetch/message.js +49 -0
  164. package/src/runtime-pi/webflo-fetch/request.js +62 -0
  165. package/src/runtime-pi/webflo-fetch/response.js +110 -0
  166. package/src/runtime-pi/webflo-fetch/util.js +28 -0
  167. package/src/runtime-pi/webflo-messaging/WQBroadcastChannel.js +10 -0
  168. package/src/runtime-pi/webflo-messaging/WQMessageChannel.js +26 -0
  169. package/src/runtime-pi/webflo-messaging/WQMessageEvent.js +87 -0
  170. package/src/runtime-pi/webflo-messaging/WQMessagePort.js +38 -0
  171. package/src/runtime-pi/webflo-messaging/WQRelayPort.js +47 -0
  172. package/src/runtime-pi/webflo-messaging/WQSockPort.js +113 -0
  173. package/src/runtime-pi/webflo-messaging/WQStarPort.js +104 -0
  174. package/src/runtime-pi/webflo-messaging/wq-message-port.js +404 -0
  175. package/src/runtime-pi/webflo-routing/HttpCookies.js +42 -0
  176. package/src/runtime-pi/webflo-routing/HttpEvent.js +112 -0
  177. package/src/runtime-pi/webflo-routing/HttpSession.js +11 -0
  178. package/src/runtime-pi/webflo-routing/HttpState.js +153 -0
  179. package/src/runtime-pi/webflo-routing/HttpUser.js +54 -0
  180. package/src/runtime-pi/webflo-routing/WebfloRouter.js +245 -0
  181. package/src/runtime-pi/webflo-server/ServerSideCookies.js +19 -0
  182. package/src/runtime-pi/webflo-server/ServerSideSession.js +38 -0
  183. package/src/runtime-pi/webflo-server/WebfloServer.js +937 -0
  184. package/src/runtime-pi/webflo-server/index.js +11 -0
  185. package/src/runtime-pi/webflo-server/messaging/Client.js +27 -0
  186. package/src/runtime-pi/webflo-server/messaging/ClientRequestRealtime.js +50 -0
  187. package/src/runtime-pi/webflo-server/messaging/Clients.js +25 -0
  188. package/src/runtime-pi/webflo-server/webflo-devmode.js +326 -0
  189. package/src/runtime-pi/{client → webflo-url}/Url.js +27 -76
  190. package/src/runtime-pi/webflo-url/index.js +1 -0
  191. package/src/runtime-pi/webflo-url/urlpattern.js +38 -0
  192. package/src/runtime-pi/{util-url.js → webflo-url/util.js} +5 -43
  193. package/src/runtime-pi/webflo-url/xURL.js +94 -0
  194. package/src/runtime-pi/webflo-worker/WebfloWorker.js +234 -0
  195. package/src/runtime-pi/webflo-worker/WorkerSideCookies.js +19 -0
  196. package/src/runtime-pi/webflo-worker/WorkerSideWorkport.js +18 -0
  197. package/src/runtime-pi/webflo-worker/index.js +11 -0
  198. package/src/services-pi/index.js +2 -0
  199. package/src/services-pi/push/index.js +23 -0
  200. package/src/util.js +10 -0
  201. package/src/{webflo.js → webflo-cli.js} +4 -4
  202. package/src/runtime-pi/Application.js +0 -29
  203. package/src/runtime-pi/Cookies.js +0 -82
  204. package/src/runtime-pi/HttpEvent.js +0 -107
  205. package/src/runtime-pi/Router.js +0 -130
  206. package/src/runtime-pi/Runtime.js +0 -21
  207. package/src/runtime-pi/client/Application.js +0 -76
  208. package/src/runtime-pi/client/Context.js +0 -7
  209. package/src/runtime-pi/client/Router.js +0 -48
  210. package/src/runtime-pi/client/Runtime.js +0 -525
  211. package/src/runtime-pi/client/Workport.js +0 -190
  212. package/src/runtime-pi/client/createStorage.js +0 -58
  213. package/src/runtime-pi/client/generate.js +0 -481
  214. package/src/runtime-pi/client/index.js +0 -21
  215. package/src/runtime-pi/client/worker/Application.js +0 -44
  216. package/src/runtime-pi/client/worker/Context.js +0 -7
  217. package/src/runtime-pi/client/worker/Runtime.js +0 -275
  218. package/src/runtime-pi/client/worker/Workport.js +0 -78
  219. package/src/runtime-pi/client/worker/index.js +0 -21
  220. package/src/runtime-pi/server/Application.js +0 -101
  221. package/src/runtime-pi/server/Context.js +0 -16
  222. package/src/runtime-pi/server/Router.js +0 -159
  223. package/src/runtime-pi/server/Runtime.js +0 -558
  224. package/src/runtime-pi/server/index.js +0 -21
  225. package/src/runtime-pi/util-http.js +0 -86
  226. package/src/runtime-pi/xFormData.js +0 -24
  227. package/src/runtime-pi/xHeaders.js +0 -146
  228. package/src/runtime-pi/xRequest.js +0 -46
  229. package/src/runtime-pi/xRequestHeaders.js +0 -109
  230. package/src/runtime-pi/xResponse.js +0 -33
  231. package/src/runtime-pi/xResponseHeaders.js +0 -117
  232. package/src/runtime-pi/xURL.js +0 -105
  233. package/src/runtime-pi/xfetch.js +0 -23
  234. package/src/runtime-pi/xxHttpMessage.js +0 -102
  235. package/src/static-pi/index.js +0 -11
package/site/docs.md ADDED
@@ -0,0 +1,100 @@
1
+ # Webflo <br>— A Web-Native Framework for the Next Gen
2
+
3
+ _Build the full spectrum of modern apps — backends, frontends, offline-first, and realtime apps — on raw platform power._
4
+
5
+ Welcome to the docs.
6
+
7
+ ## What is Webflo
8
+
9
+ Webflo is a web-native framework that lets you build backends, frontends, offline-first, and realtime apps absurdly fast.
10
+
11
+ "Web-native." The cheatcode, if you caught it.<br>
12
+ Just programming fundamentals and raw platform power, shipped in a framework.
13
+ Modern apps — their sophistication and scale — solved from the foundation up.
14
+
15
+ ## Why Webflo
16
+
17
+ Webflo shares the same broad use cases as traditional frameworks, but it is designed on an entirely different premise:
18
+ **walk the traditional framework ladder back to programming fundamentals and sheer platform capabilities** — not merely to align with web standards, **but to put the foundations to work in new ways**. From JavaScript to HTML, to the web's transport layer, we took existing fundamentals and built new ones — to give developers less machinery, more leverage.
19
+
20
+ **An engineer’s tour…**
21
+
22
+ ### Mutation-Based Reactivity
23
+
24
+ At the foundation is an all-new reactive model: **mutation-based reactivity**, powered by the [Observer API](/docs/tech-stack#the-observer-api). With this model, Webflo anchors itself on JavaScript’s direct mutation semantics and makes it its own engine of reactivity across the whole stack — server, worker, and client. Reactivity just works as program state changes.
25
+ This means:
26
+
27
+ * **State is just objects and arrays**. With reactivity solved at the object level, no need for stores, hooks, signals, proxies, reducers, or container types. The object you see _is_ the state.
28
+ * **Mutation becomes the shared language of reactivity across the system** — whether on the server, the service worker, or the UI.
29
+ * **With no layers of indirection, mental model stays simple**. At any given time, you're simply either making mutations or observing mutations — exactly as you would without any framework.
30
+
31
+ This enables **a new generation of apps that entirely avoid the traditional state scaffolding and the inherent cost of forbidding mutability in a mutable world as JavaScript**.
32
+
33
+ ### Realtime Over HTTP
34
+
35
+ Webflo extends the HTTP request/response model with realtime capabilities that let request handlers opt into an interactive, realtime channel with the client — exposed as `event.client`. Webflo automatically upgrades the underlying transport and manages the request lifecycle.
36
+ You get a capable transport layer that can be used for many things. Webflo builds on that to enable:
37
+
38
+ + **A multi-stage response model via `LiveResponse`**. Send multiple responses at different stages of request processing: `liveResponse.replaceWith()`, `event.respondWith()`, etc. Clients swap state and rerender accordingly.
39
+ + **Differential, live state over the wire**. Share live state with the client and mutate it in place as you deem fit: `Observer.set(liveResponse.body, name, value)`, `Observer.proxy(liveResponse.body.items).push(item)`, etc. Clients preserve state and reflect diffs. Application state goes fullstack.
40
+ + **Interactive request handling**. Pause request processing to interact with the user as the need may arise: `event.user.confirm()`, `event.user.prompt()`, etc. Clients initiate the corresponding dialog with the user and reply.
41
+
42
+ Together with the `event.client` API itself, you get a unified surface for many different realtime apps — collaboration, multi-device presence, multiplayer, streaming progress, and more — with no extra wiring or protocols.
43
+
44
+ ### HTML for the Modern UI
45
+
46
+ Webflo brings HTML into the application authoring equation as its direct UI language — instead of as compile target. It converges on a design that leaves the UI layer entirely in HTML terms — and upgrades the authoring experience via first-class integration with [Object-Oriented HTML (OOHTML)](/docs/tech-stack#oohtml). OOHTML extends HTML with capabilities like **modularity & reusability**, **reactivity & data binding** — **without a build step**. You get:
47
+
48
+ * **Modular imports and composable templates** (`<template def>` and `<import ref>`) as first-class primitives.
49
+ * **Scoped styles and scripts, and even scoped subtrees** without Shadow DOM complexity (`<script scoped>`, `<style scoped>`, `<div namespace>`).
50
+ * **Reactive bindings without a compile step** — via HTML attributes and HTML comment (`<!--{ title }-->`, `<?{ title }?>`).
51
+
52
+ This solves for the sophistication of modern UIs in just HTML, without the complexity of a compile step. With that out of the way, you get **edit-in-browser workflows** where the UI directly reflects live DOM manipulation via the browser inspector.
53
+
54
+ ### The Service Worker as an Embedded Edge Runtime
55
+
56
+ Webflo brings the service worker into the application model as a full routing runtime — extending it beyond its traditional role as a cache script or network proxy.
57
+ The shift lets you bring your application routes into the service worker, with the same routing architecture and request-handling capabilities as the server and client runtimes. This unlocks:
58
+
59
+ * **Fullstack routing**. Distribute route handlers across, not two, but three runtimes (server, worker, client) as you deem fit. Same routing architecture, same request-handling capabilities.
60
+ * **More performant client-side routing**. Move compute-intensive routing logic into the service worker runtime from the main thread to keep the UI responsive.
61
+ * **Route-based background tasks**. Sync, periodic events, and push notifications map into routes naturally, not into separate worker-only APIs. One routing architecture for many use cases.
62
+
63
+ The service worker as a new routing site exposes this underutilized layer of the platform as a _standard application surface to build on_ — like an embedded edge runtime — taking the application closer to the heart of the platform’s capabilities than traditional architectures allow.
64
+
65
+ ---
66
+
67
+ **What this means**: Webflo is an orchestration of programming fundamentals, web platform capabilities, and the web’s communication protocols into an application framework for the next generation of web apps. With just the fundamentals as the entire application stack — _and no extra thing "going on"_ — Webflo achieves a rare level of conceptual and operational simplicity that makes the sophistication of modern apps feel _almost_ trivial.
68
+
69
+ ## What You Can Build
70
+
71
+ | Category | Examples & Notes |
72
+ | :------------------------- | :--------------------------------------------------------------------------------------------------------------- |
73
+ | **Web apps** | From classic MPAs to rich SPAs, hybrid SSR/CSR experiences, and full PWAs — all built on one unified framework. |
74
+ | **API backends** | REST endpoints, serverless-style handlers, and webhooks with streaming, partial responses, and live messaging. |
75
+ | **Static sites** | Static-first or fully pre-rendered sites that seamlessly upgrade sections to live or interactive behavior. |
76
+ | **Mobile experiences** | Installable, offline-capable PWAs with background sync, worker routing, and native-feeling navigation. |
77
+ | **Realtime & multiplayer** | Chats, presence, dashboards, live docs, notifications — realtime channels and dialogs available out of the box. |
78
+ | **AI & agents** | Multi-step AI workflows, background agents, and automation powered by Webflo’s live request lifecycle. |
79
+
80
+ ## Features
81
+
82
+ | Feature | Description |
83
+ | :------------------------------------ | :-------------------------------------------------------------------------------------------------- |
84
+ | 📁 **Folder-based routing** | Filesystem routing across client, worker, and server layers, with seamless interception and flow. |
85
+ | 🌍 **Full-stack routing & lifecycle** | Every request flows through browser, worker, and server layers using the same handler model. |
86
+ | 🔗 **Internal API composition** | Reuse your own routes as local function calls via `next(path)` — no extra networking required. |
87
+ | 🔐 **Sessions & auth** | Built-in cookie handling, session utilities, and helpers for gated routes and user-aware flows. |
88
+ | ⚡ **Realtime capabilities** | Live responses, incremental updates, dialogs, and background channels — no explicit WebSocket setup. |
89
+ | 🧠 **Mutation-based reactivity** | State is plain objects and arrays; mutations drive reactivity via the Observer API. |
90
+ | 🧱 **OOHTML integration** | HTML-native templates, imports, and composition without a component DSL or build-heavy toolchain. |
91
+ | 📦 **Offline & worker features** | Worker-side routing, caching, background sync, and offline-first behaviors built in. |
92
+ | 🧩 **Dev mode & HMR** | Fast development server with fine-grained rebuilds and hot updates for HTML, JS, and CSS. |
93
+
94
+ ## Get Started
95
+
96
+ | Path | Focus |
97
+ | :------------------------------------------- | :---------------------------------------------------------------- |
98
+ | [Getting Started](./docs/getting-started) | Your first route and page in minutes. |
99
+ | [Core Concepts](./docs/concepts) | The mental models behind routing, request/response, and realtime. |
100
+ | [Examples](./examples) | Small, focused examples. |
@@ -0,0 +1,10 @@
1
+ # Example: PWA
2
+
3
+ Add manifest, service worker, and offline caching.
4
+
5
+ - `public/manifest.json`
6
+ - Service worker registration
7
+ - Cache-first strategy
8
+
9
+ Related:
10
+ - [Service Worker Guide](/guides/guide-service-worker)
@@ -0,0 +1,11 @@
1
+ # Example: Web App
2
+
3
+ Conventional web app with server-rendered data and client interactivity.
4
+
5
+ - Root handler returns data
6
+ - Templates render UI
7
+ - Client enhances interactions
8
+
9
+ See:
10
+ - [Getting Started](/docs/getting-started)
11
+ - [Rendering](/docs/concepts/rendering)
@@ -0,0 +1,10 @@
1
+ # Examples
2
+
3
+ Small, focused examples you can copy and adapt.
4
+
5
+ - [Web Example](/examples/web)
6
+ - [PWA Example](/examples/pwa)
7
+
8
+ See also:
9
+ - Guides: [/guides](/guides)
10
+ - Recipes: [/recipes/streaming](/recipes/streaming), [/recipes/realtime](/recipes/realtime)
package/site/faq.md ADDED
@@ -0,0 +1,13 @@
1
+ # FAQ
2
+
3
+ - How do I start in dev?
4
+ - `webflo start --dev` or `npm run dev`
5
+
6
+ - How do I build for production?
7
+ - `webflo build` then `webflo start`
8
+
9
+ - Where do static files live?
10
+ - `public/`
11
+
12
+ - Where are routes defined?
13
+ - `app/` directory with handlers
@@ -0,0 +1,13 @@
1
+ # Guide: Auth
2
+
3
+ Patterns for session, cookies, and user state.
4
+
5
+ - Reading/writing cookies via `event.cookies`
6
+ - Session management via `event.session`
7
+ - Protecting routes (check auth, redirect or return 401)
8
+ - Client-side state reflection at `document.bindings.user`
9
+
10
+ See API:
11
+ - [HttpUser](/api/webflo-routing/HttpUser)
12
+ - [HttpCookies](/api/webflo-routing/HttpCookies)
13
+ - [HttpSession](/api/webflo-routing/HttpSession)
@@ -0,0 +1,11 @@
1
+ # Guide: File Upload
2
+
3
+ Handle form uploads and streaming.
4
+
5
+ - Use `Request.formData()` or streamed bodies
6
+ - Validate content type and size
7
+ - Store and return URLs
8
+
9
+ Related:
10
+ - [Request/Response](/docs/concepts/request-response)
11
+ - [fetch](/api/webflo-fetch/fetch)
@@ -0,0 +1,10 @@
1
+ # Guide: Service Worker
2
+
3
+ Integrate a Service Worker for offline and caching.
4
+
5
+ - Register SW client-side
6
+ - Cache static assets in `public/`
7
+ - Use background channels for sync
8
+
9
+ See:
10
+ - [Realtime](/docs/concepts/realtime)
@@ -0,0 +1,24 @@
1
+ # Tutorial: Todo App
2
+
3
+ Build a minimal Todo app to learn core Webflo flows.
4
+
5
+ ## 1) Scaffold
6
+ ```bash
7
+ webflo init webflo-todo --template=web
8
+ cd webflo-todo
9
+ webflo start --dev
10
+ ```
11
+
12
+ ## 2) Route handler
13
+ Edit `app/handler.server.js` to return an initial list and handle add/remove.
14
+
15
+ ## 3) Template
16
+ Bind `document.bindings.data` to render and mutate todos.
17
+
18
+ ## 4) Persist
19
+ Add simple storage using `event.session` or a backing store.
20
+
21
+ Next:
22
+ - [Routing](/docs/concepts/routing)
23
+ - [Rendering](/docs/concepts/rendering)
24
+ - [State](/docs/concepts/state)
package/site/guides.md ADDED
@@ -0,0 +1,15 @@
1
+ # Guides
2
+
3
+ Start with a hands-on tutorial, then dive into focused guides.
4
+
5
+ ## Start Here
6
+ - Tutorial: [Todo App](/guides/tutorial-1-todo)
7
+
8
+ ## Focused Guides
9
+ - [Auth](/guides/guide-auth)
10
+ - [File Upload](/guides/guide-file-upload)
11
+ - [Service Worker](/guides/guide-service-worker)
12
+
13
+ ## Related
14
+ - Recipes: [Streaming](/recipes/streaming), [Realtime Patterns](/recipes/realtime)
15
+ - API: [Handler](/api/webflo-routing/handler), [HttpEvent](/api/webflo-routing/HttpEvent)
package/site/index.md ADDED
@@ -0,0 +1,39 @@
1
+ ---
2
+ layout: home
3
+ hero:
4
+ name: Webflo
5
+ text: Modern Web Application Framework
6
+ tagline: Build scalable, real-time, and reactive web apps with ease.
7
+ image:
8
+ src: /img/brand/logo-670x670.png
9
+ width: 600px
10
+ alt: Webflo Logo
11
+ actions:
12
+ - theme: brand
13
+ text: Get Started
14
+ link: /docs/getting-started
15
+ - theme: alt
16
+ text: Star on GitHub
17
+ link: https://github.com/webqit/webflo
18
+ features:
19
+ - title: Universal Runtime
20
+ details: Run seamlessly across client, server, worker, and edge environments with unified APIs and portable logic.
21
+ - title: Reactive State & Lifecycle
22
+ details: Deeply integrated reactivity and lifecycle hooks for state, data, and UI updates everywhere.
23
+ - title: Real-time Messaging & Sync
24
+ details: Native support for real-time data, events, broadcast channels, and cross-context messaging.
25
+ - title: Advanced Routing & Context
26
+ details: Dynamic, nested, and parameterized routing with context-aware navigation, transitions, and guards.
27
+ - title: SSR, SSG, CSR
28
+ details: Out-of-the-box support for server-side rendering, static site generation, and client-side hydration for SEO and performance.
29
+ - title: Modular Architecture
30
+ details: Compose features with plug-and-play modules, custom plugins, and runtime integrations.
31
+ - title: Storage, Cookies, Sessions
32
+ details: Built-in APIs for storage, cookies, sessions, and secure data flows across all environments.
33
+ - title: Deployment & Config
34
+ details: Flexible deployment, environment config, origins, proxy, and manifest management.
35
+ - title: CLI & Dev Tools
36
+ details: Powerful CLI, hot-reloading, code generation, and rich debugging for rapid development.
37
+ - title: Security & Isolation
38
+ details: Context isolation, robust session management, and secure data flows for any environment.
39
+ ---
@@ -0,0 +1,11 @@
1
+ # Recipe: Realtime Patterns
2
+
3
+ Keep server and client in sync.
4
+
5
+ - Long-lived `LiveResponse`
6
+ - Background messaging
7
+ - Reconnect and resume
8
+
9
+ See:
10
+ - [Realtime Concept](/docs/concepts/realtime)
11
+ - [HttpEvent](/api/webflo-routing/HttpEvent)
@@ -0,0 +1,15 @@
1
+ # Recipe: Streaming
2
+
3
+ Send progressive updates.
4
+
5
+ ```js
6
+ export async function GET(event) {
7
+ event.respondWith({ step: 1 }, { done: false });
8
+ await new Promise(r => setTimeout(r, 100));
9
+ event.respondWith({ step: 2 }); // done
10
+ }
11
+ ```
12
+
13
+ See:
14
+ - [Handler → Return Styles](/api/webflo-routing/handler#return-styles)
15
+ - [Request/Response](/docs/concepts/request-response)
@@ -0,0 +1,11 @@
1
+ # CLI Reference
2
+
3
+ Webflo provides a CLI for development, build, and config workflows.
4
+
5
+ ## Commands
6
+ - `webflo init <name> [title] [description] [--template=web|pwa]`
7
+ - `webflo start [--dev] [--open] [--port <port>]`
8
+ - `webflo build`
9
+ - `webflo config`
10
+
11
+ See Getting Started: [/docs/getting-started](/docs/getting-started)
@@ -0,0 +1,13 @@
1
+ # Configuration Reference
2
+
3
+ Most apps work without extra configuration. When needed, configuration lives under `.webflo/` and/or environment variables.
4
+
5
+ ## Common Areas
6
+ - Environment variables via `.env`
7
+ - Origins/proxy
8
+ - Static assets under `public/`
9
+ - Routes under `app/`
10
+
11
+ See Concepts:
12
+ - [Routing](/docs/concepts/routing)
13
+ - [Request/Response](/docs/concepts/request-response)
@@ -0,0 +1,9 @@
1
+ # Tools
2
+
3
+ Supporting tools you’ll often use with Webflo.
4
+
5
+ - OOHTML (templates bundling)
6
+ - Build scripts for HTML/CSS/JS
7
+ - Dev server with HMR
8
+
9
+ See: [/docs/getting-started](/docs/getting-started)
package/src/Context.js CHANGED
@@ -1,12 +1,5 @@
1
+ export class Context {
1
2
 
2
- export default class Context {
3
-
4
- /**
5
- * Initializes a context.
6
- *
7
- * @param Object dict
8
- * @param String CD
9
- */
10
3
  constructor(dict, CD = null) {
11
4
  // dict can be plain object or some Context instance itself
12
5
  // Using it as only a prototype protects it from being mutated down here
@@ -41,8 +34,8 @@ export default class Context {
41
34
  }
42
35
 
43
36
  // app
44
- get app() {
45
- return this.dict.app || {};
37
+ get appMeta() {
38
+ return this.dict.appMeta || {};
46
39
  }
47
40
 
48
41
  // config
@@ -76,5 +69,4 @@ export default class Context {
76
69
  set logger(value) {
77
70
  Object.defineProperty(this.dict, 'logger', { value } );
78
71
  }
79
-
80
72
  }
@@ -13,18 +13,13 @@ export default class Env extends Dotfile {
13
13
 
14
14
  // @desc
15
15
  static get ['@desc']() {
16
- return 'Environmental variables config.';
17
- }
18
-
19
- // isEnv
20
- get isEnv() {
21
- return true;
16
+ return 'Environmental variable mappings.';
22
17
  }
23
18
 
24
19
  // Defaults merger
25
20
  withDefaults(config) {
26
21
  return this.merge({
27
- autoload: true,
22
+ mappings: {}
28
23
  }, config, 'patch');
29
24
  }
30
25
 
@@ -33,13 +28,13 @@ export default class Env extends Dotfile {
33
28
  // Questions
34
29
  return [
35
30
  {
36
- name: 'entries',
31
+ name: 'mappings',
37
32
  type: 'recursive',
38
33
  controls: {
39
- name: 'variable',
34
+ name: 'variable mappings',
40
35
  combomode: true,
41
36
  },
42
- initial: config.entries,
37
+ initial: config.mappings,
43
38
  schema: [
44
39
  {
45
40
  name: 'name',
@@ -54,15 +49,7 @@ export default class Env extends Dotfile {
54
49
  validation: ['important'],
55
50
  },
56
51
  ],
57
- },
58
- {
59
- name: 'autoload',
60
- type: 'toggle',
61
- message: 'Choose whether to autoload variables into "process.env"',
62
- active: 'YES',
63
- inactive: 'NO',
64
- initial: config.autoload,
65
- },
52
+ }
66
53
  ];
67
54
  }
68
55
  }
@@ -20,9 +20,10 @@ export default class Layout extends Dotfile {
20
20
  withDefaults(config) {
21
21
  return this.merge({
22
22
  PUBLIC_DIR: './public',
23
- SERVER_DIR: './server',
24
- CLIENT_DIR: './client',
25
- WORKER_DIR: './worker',
23
+ VIEWS_DIR: './app',
24
+ SERVER_DIR: './app',
25
+ CLIENT_DIR: './app',
26
+ WORKER_DIR: './app',
26
27
  }, config, 'patch');
27
28
  }
28
29
 
@@ -37,6 +38,13 @@ export default class Layout extends Dotfile {
37
38
  initial: config.PUBLIC_DIR,
38
39
  validation: ['important'],
39
40
  },
41
+ {
42
+ name: 'VIEWS_DIR',
43
+ type: 'text',
44
+ message: 'Enter the directory for the application\'s view files (templates)',
45
+ initial: config.VIEWS_DIR,
46
+ validation: ['important'],
47
+ },
40
48
  {
41
49
  name: 'SERVER_DIR',
42
50
  type: 'text',
@@ -19,36 +19,28 @@ export default class Client extends Dotfile {
19
19
  // Defaults merger
20
20
  withDefaults(config) {
21
21
  return this.merge({
22
- bundle_filename: 'bundle.js',
22
+ filename: 'app.js',
23
23
  public_base_url: '/',
24
+ copy_public_variables: true,
24
25
  spa_routing: true,
25
- service_worker: {
26
- filename: 'worker.js',
27
- scope: '/',
28
- support_push: false,
29
- vapid_key_env: 'VAPID_PUBLIC_KEY',
30
- push_registration_url_env: 'PUSH_REGISTRATION_PUBLIC_URL',
26
+ capabilities: {
27
+ service_worker: false,
28
+ webpush: false,
29
+ custom_install: false,
30
+ exposed: ['display-mode', 'notifications'],
31
31
  },
32
- bundle_public_env: false,
33
32
  }, config, 'patch');
34
33
  }
35
34
 
36
35
  // Questions generator
37
36
  getSchema(config, choices = {}) {
38
- // Choices
39
- const CHOICES = this.merge({
40
- webqit_dependencies: [
41
- {value: 'externalize', title: 'Externalize'},
42
- {value: 'internalize', title: 'Internalize'},
43
- ],
44
- }, choices, 'patch');
45
37
  // Questions
46
38
  return [
47
39
  {
48
- name: 'bundle_filename',
40
+ name: 'filename',
49
41
  type: 'text',
50
42
  message: 'Specify the bundle filename',
51
- initial: config.bundle_filename,
43
+ initial: config.filename,
52
44
  },
53
45
  {
54
46
  name: 'public_base_url',
@@ -58,7 +50,16 @@ export default class Client extends Dotfile {
58
50
  validation: ['important'],
59
51
  },
60
52
  {
61
- name: 'bundle_public_env',
53
+ name: 'copy_public_variables',
54
+ type: 'toggle',
55
+ message: '[copy_public_variables]: Bundle public ENV variables?',
56
+ active: 'YES',
57
+ inactive: 'NO',
58
+ initial: config.copy_public_variables,
59
+ validation: ['important'],
60
+ },
61
+ {
62
+ name: 'spa_routing',
62
63
  type: 'toggle',
63
64
  message: '[spa_routing]: Enable Single Page Routing Mode',
64
65
  active: 'YES',
@@ -67,50 +68,41 @@ export default class Client extends Dotfile {
67
68
  validation: ['important'],
68
69
  },
69
70
  {
70
- name: 'service_worker',
71
+ name: 'capabilities',
71
72
  controls: {
72
- name: 'service_worker',
73
+ name: 'capabilities',
73
74
  },
74
- initial: config.service_worker,
75
+ initial: config.capabilities,
75
76
  schema: [
76
77
  {
77
- name: 'filename',
78
- type: 'text',
79
- message: 'Specify the Service Worker filename',
80
- },
81
- {
82
- name: 'scope',
83
- type: 'text',
84
- message: 'Specify the Service Worker scope',
78
+ name: 'service_worker',
79
+ type: 'toggle',
80
+ message: 'Enable service worker?',
81
+ active: 'YES',
82
+ inactive: 'NO',
85
83
  },
86
84
  {
87
- name: 'support_push',
85
+ name: 'webpush',
88
86
  type: 'toggle',
89
87
  message: 'Support push-notifications?',
90
88
  active: 'YES',
91
89
  inactive: 'NO',
92
90
  },
93
91
  {
94
- name: 'vapid_key_env',
95
- type: (prev, answers) => answers.support_push ? 'text' : null,
96
- message: 'Enter the VAPID KEY env id for push notification subscription',
92
+ name: 'custom_install',
93
+ type: 'toggle',
94
+ message: 'Enable custom PWA install prompt?',
95
+ active: 'YES',
96
+ inactive: 'NO',
97
97
  },
98
98
  {
99
- name: 'push_registration_url_env',
100
- type: (prev, answers) => answers.support_push ? 'text' : null,
101
- message: 'Enter the URL for push notification subscription',
102
- },
103
- ],
104
- },
105
- {
106
- name: 'bundle_public_env',
107
- type: 'toggle',
108
- message: '[bundle_public_env]: Bundle public ENV variables?',
109
- active: 'YES',
110
- inactive: 'NO',
111
- initial: config.bundle_public_env,
112
- validation: ['important'],
113
- },
99
+ name: 'exposed',
100
+ type: 'list',
101
+ message: 'Specify features exposed on capabilities.exposed',
102
+ initial: (config.exposed || []).join(', '),
103
+ }
104
+ ]
105
+ }
114
106
  ];
115
107
  }
116
108
  }