@fluixi/core 1.0.0-alpha.100

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 (253) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +334 -0
  3. package/dist/cdn/core.global.js +2 -0
  4. package/dist/cli/generate.cjs +5639 -0
  5. package/dist/cli/generate.d.ts +7 -0
  6. package/dist/cli/generate.d.ts.map +1 -0
  7. package/dist/cli/generate.js +2580 -0
  8. package/dist/cli/generate.mjs +5644 -0
  9. package/dist/cli/index.cjs +5639 -0
  10. package/dist/cli/index.d.ts +7 -0
  11. package/dist/cli/index.d.ts.map +1 -0
  12. package/dist/cli/index.js +2580 -0
  13. package/dist/cli/index.mjs +5644 -0
  14. package/dist/cli/run.cjs +64 -0
  15. package/dist/cli/run.d.ts +3 -0
  16. package/dist/cli/run.d.ts.map +1 -0
  17. package/dist/cli/run.js +62 -0
  18. package/dist/cli/run.mjs +40 -0
  19. package/dist/fluixi.d.ts +5 -0
  20. package/dist/src/cdn/chunk-RKBFEFZP.mjs +987 -0
  21. package/dist/src/cdn/core.cjs +1592 -0
  22. package/dist/src/cdn/core.d.ts +16 -0
  23. package/dist/src/cdn/core.d.ts.map +1 -0
  24. package/dist/src/cdn/core.js +15 -0
  25. package/dist/src/cdn/core.mjs +714 -0
  26. package/dist/src/cdn/router-V2THK27H.mjs +74 -0
  27. package/dist/src/index.cjs +1711 -0
  28. package/dist/src/index.d.ts +4 -0
  29. package/dist/src/index.d.ts.map +1 -0
  30. package/dist/src/index.js +11 -0
  31. package/dist/src/index.mjs +1833 -0
  32. package/dist/src/jsx-dev-runtime.cjs +26 -0
  33. package/dist/src/jsx-dev-runtime.d.ts +2 -0
  34. package/dist/src/jsx-dev-runtime.d.ts.map +1 -0
  35. package/dist/src/jsx-dev-runtime.js +1 -0
  36. package/dist/src/jsx-dev-runtime.mjs +24 -0
  37. package/dist/src/jsx-runtime.cjs +26 -0
  38. package/dist/src/jsx-runtime.d.ts +7 -0
  39. package/dist/src/jsx-runtime.d.ts.map +1 -0
  40. package/dist/src/jsx-runtime.js +8 -0
  41. package/dist/src/jsx-runtime.mjs +24 -0
  42. package/dist/src/lib/client/chunk-FDOPDB6Z.mjs +53 -0
  43. package/dist/src/lib/client/index.cjs +1210 -0
  44. package/dist/src/lib/client/index.d.ts +51 -0
  45. package/dist/src/lib/client/index.d.ts.map +1 -0
  46. package/dist/src/lib/client/index.js +174 -0
  47. package/dist/src/lib/client/index.mjs +293 -0
  48. package/dist/src/lib/client/router-4PTBPZLQ.mjs +891 -0
  49. package/dist/src/lib/context/context.cjs +81 -0
  50. package/dist/src/lib/context/context.d.ts +73 -0
  51. package/dist/src/lib/context/context.d.ts.map +1 -0
  52. package/dist/src/lib/context/context.js +93 -0
  53. package/dist/src/lib/context/context.mjs +64 -0
  54. package/dist/src/lib/context/index.cjs +83 -0
  55. package/dist/src/lib/context/index.d.ts +3 -0
  56. package/dist/src/lib/context/index.d.ts.map +1 -0
  57. package/dist/src/lib/context/index.js +1 -0
  58. package/dist/src/lib/context/index.mjs +64 -0
  59. package/dist/src/lib/control-flow.cjs +35 -0
  60. package/dist/src/lib/control-flow.d.ts +4 -0
  61. package/dist/src/lib/control-flow.d.ts.map +1 -0
  62. package/dist/src/lib/control-flow.js +1 -0
  63. package/dist/src/lib/control-flow.mjs +25 -0
  64. package/dist/src/lib/core.cjs +1710 -0
  65. package/dist/src/lib/core.d.ts +91 -0
  66. package/dist/src/lib/core.d.ts.map +1 -0
  67. package/dist/src/lib/core.js +158 -0
  68. package/dist/src/lib/core.mjs +1833 -0
  69. package/dist/src/lib/env/index.cjs +44 -0
  70. package/dist/src/lib/env/index.d.ts +26 -0
  71. package/dist/src/lib/env/index.d.ts.map +1 -0
  72. package/dist/src/lib/env/index.js +31 -0
  73. package/dist/src/lib/env/index.mjs +23 -0
  74. package/dist/src/lib/i18n/index.cjs +123 -0
  75. package/dist/src/lib/i18n/index.d.ts +110 -0
  76. package/dist/src/lib/i18n/index.d.ts.map +1 -0
  77. package/dist/src/lib/i18n/index.js +164 -0
  78. package/dist/src/lib/i18n/index.mjs +103 -0
  79. package/dist/src/lib/index.cjs +598 -0
  80. package/dist/src/lib/index.d.ts +81 -0
  81. package/dist/src/lib/index.d.ts.map +1 -0
  82. package/dist/src/lib/index.js +130 -0
  83. package/dist/src/lib/index.mjs +688 -0
  84. package/dist/src/lib/isomorphic.cjs +90 -0
  85. package/dist/src/lib/isomorphic.d.ts +114 -0
  86. package/dist/src/lib/isomorphic.d.ts.map +1 -0
  87. package/dist/src/lib/isomorphic.js +132 -0
  88. package/dist/src/lib/isomorphic.mjs +69 -0
  89. package/dist/src/lib/jsx-runtime/index.cjs +21 -0
  90. package/dist/src/lib/jsx-runtime/index.d.ts +13 -0
  91. package/dist/src/lib/jsx-runtime/index.d.ts.map +1 -0
  92. package/dist/src/lib/jsx-runtime/index.js +13 -0
  93. package/dist/src/lib/jsx-runtime/index.mjs +4 -0
  94. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.cjs +21 -0
  95. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.d.ts +2 -0
  96. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.d.ts.map +1 -0
  97. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.js +1 -0
  98. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.mjs +4 -0
  99. package/dist/src/lib/plugins/fluixi-routes-plugin.cjs +302 -0
  100. package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts +35 -0
  101. package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts.map +1 -0
  102. package/dist/src/lib/plugins/fluixi-routes-plugin.js +118 -0
  103. package/dist/src/lib/plugins/fluixi-routes-plugin.mjs +271 -0
  104. package/dist/src/lib/plugins/index.cjs +311 -0
  105. package/dist/src/lib/plugins/index.d.ts +6 -0
  106. package/dist/src/lib/plugins/index.d.ts.map +1 -0
  107. package/dist/src/lib/plugins/index.js +7 -0
  108. package/dist/src/lib/plugins/index.mjs +279 -0
  109. package/dist/src/lib/plugins/route-codegen.cjs +73 -0
  110. package/dist/src/lib/plugins/route-codegen.d.ts +12 -0
  111. package/dist/src/lib/plugins/route-codegen.d.ts.map +1 -0
  112. package/dist/src/lib/plugins/route-codegen.js +80 -0
  113. package/dist/src/lib/plugins/route-codegen.mjs +52 -0
  114. package/dist/src/lib/plugins/route-scanner.cjs +189 -0
  115. package/dist/src/lib/plugins/route-scanner.d.ts +38 -0
  116. package/dist/src/lib/plugins/route-scanner.d.ts.map +1 -0
  117. package/dist/src/lib/plugins/route-scanner.js +215 -0
  118. package/dist/src/lib/plugins/route-scanner.mjs +158 -0
  119. package/dist/src/lib/plugins/vite.cjs +27 -0
  120. package/dist/src/lib/plugins/vite.d.ts +3 -0
  121. package/dist/src/lib/plugins/vite.d.ts.map +1 -0
  122. package/dist/src/lib/plugins/vite.js +1 -0
  123. package/dist/src/lib/plugins/vite.mjs +6 -0
  124. package/dist/src/lib/render/await.cjs +38 -0
  125. package/dist/src/lib/render/await.d.ts +26 -0
  126. package/dist/src/lib/render/await.d.ts.map +1 -0
  127. package/dist/src/lib/render/await.js +45 -0
  128. package/dist/src/lib/render/await.mjs +17 -0
  129. package/dist/src/lib/render/component.cjs +221 -0
  130. package/dist/src/lib/render/component.d.ts +296 -0
  131. package/dist/src/lib/render/component.d.ts.map +1 -0
  132. package/dist/src/lib/render/component.js +514 -0
  133. package/dist/src/lib/render/component.mjs +214 -0
  134. package/dist/src/lib/render/deferred.cjs +175 -0
  135. package/dist/src/lib/render/deferred.d.ts +36 -0
  136. package/dist/src/lib/render/deferred.d.ts.map +1 -0
  137. package/dist/src/lib/render/deferred.js +141 -0
  138. package/dist/src/lib/render/deferred.mjs +158 -0
  139. package/dist/src/lib/render/index.cjs +573 -0
  140. package/dist/src/lib/render/index.d.ts +98 -0
  141. package/dist/src/lib/render/index.d.ts.map +1 -0
  142. package/dist/src/lib/render/index.js +180 -0
  143. package/dist/src/lib/render/index.mjs +590 -0
  144. package/dist/src/lib/render/lazy.cjs +67 -0
  145. package/dist/src/lib/render/lazy.d.ts +49 -0
  146. package/dist/src/lib/render/lazy.d.ts.map +1 -0
  147. package/dist/src/lib/render/lazy.js +105 -0
  148. package/dist/src/lib/render/lazy.mjs +50 -0
  149. package/dist/src/lib/render/suspense.cjs +141 -0
  150. package/dist/src/lib/render/suspense.d.ts +65 -0
  151. package/dist/src/lib/render/suspense.d.ts.map +1 -0
  152. package/dist/src/lib/render/suspense.js +196 -0
  153. package/dist/src/lib/render/suspense.mjs +136 -0
  154. package/dist/src/lib/render/versions.cjs +35 -0
  155. package/dist/src/lib/render/versions.d.ts +2 -0
  156. package/dist/src/lib/render/versions.d.ts.map +1 -0
  157. package/dist/src/lib/render/versions.js +21 -0
  158. package/dist/src/lib/render/versions.mjs +14 -0
  159. package/dist/src/lib/router/data.cjs +228 -0
  160. package/dist/src/lib/router/data.d.ts +142 -0
  161. package/dist/src/lib/router/data.d.ts.map +1 -0
  162. package/dist/src/lib/router/data.js +258 -0
  163. package/dist/src/lib/router/data.mjs +214 -0
  164. package/dist/src/lib/router/index.cjs +921 -0
  165. package/dist/src/lib/router/index.d.ts +274 -0
  166. package/dist/src/lib/router/index.d.ts.map +1 -0
  167. package/dist/src/lib/router/index.js +904 -0
  168. package/dist/src/lib/router/index.mjs +938 -0
  169. package/dist/src/lib/router/scroll.cjs +79 -0
  170. package/dist/src/lib/router/scroll.d.ts +19 -0
  171. package/dist/src/lib/router/scroll.d.ts.map +1 -0
  172. package/dist/src/lib/router/scroll.js +68 -0
  173. package/dist/src/lib/router/scroll.mjs +58 -0
  174. package/dist/src/lib/router/transition.cjs +75 -0
  175. package/dist/src/lib/router/transition.d.ts +81 -0
  176. package/dist/src/lib/router/transition.d.ts.map +1 -0
  177. package/dist/src/lib/router/transition.js +136 -0
  178. package/dist/src/lib/router/transition.mjs +54 -0
  179. package/dist/src/lib/server/hydration.cjs +169 -0
  180. package/dist/src/lib/server/hydration.d.ts +198 -0
  181. package/dist/src/lib/server/hydration.d.ts.map +1 -0
  182. package/dist/src/lib/server/hydration.js +345 -0
  183. package/dist/src/lib/server/hydration.mjs +148 -0
  184. package/dist/src/lib/server/index.cjs +406 -0
  185. package/dist/src/lib/server/index.d.ts +115 -0
  186. package/dist/src/lib/server/index.d.ts.map +1 -0
  187. package/dist/src/lib/server/index.js +164 -0
  188. package/dist/src/lib/server/index.mjs +384 -0
  189. package/dist/src/lib/server/reactive.cjs +197 -0
  190. package/dist/src/lib/server/reactive.d.ts +239 -0
  191. package/dist/src/lib/server/reactive.d.ts.map +1 -0
  192. package/dist/src/lib/server/reactive.js +413 -0
  193. package/dist/src/lib/server/reactive.mjs +176 -0
  194. package/dist/src/lib/storage/cache.cjs +51 -0
  195. package/dist/src/lib/storage/cache.d.ts +18 -0
  196. package/dist/src/lib/storage/cache.d.ts.map +1 -0
  197. package/dist/src/lib/storage/cache.js +42 -0
  198. package/dist/src/lib/storage/cache.mjs +30 -0
  199. package/dist/src/lib/storage/index.cjs +246 -0
  200. package/dist/src/lib/storage/index.d.ts +83 -0
  201. package/dist/src/lib/storage/index.d.ts.map +1 -0
  202. package/dist/src/lib/storage/index.js +179 -0
  203. package/dist/src/lib/storage/index.mjs +231 -0
  204. package/dist/src/lib/storage/persisted.cjs +91 -0
  205. package/dist/src/lib/storage/persisted.d.ts +53 -0
  206. package/dist/src/lib/storage/persisted.d.ts.map +1 -0
  207. package/dist/src/lib/storage/persisted.js +75 -0
  208. package/dist/src/lib/storage/persisted.mjs +70 -0
  209. package/dist/src/lib/theme/color-scheme.cjs +281 -0
  210. package/dist/src/lib/theme/color-scheme.d.ts +61 -0
  211. package/dist/src/lib/theme/color-scheme.d.ts.map +1 -0
  212. package/dist/src/lib/theme/color-scheme.js +120 -0
  213. package/dist/src/lib/theme/color-scheme.mjs +265 -0
  214. package/dist/src/lib/theme/index.cjs +267 -0
  215. package/dist/src/lib/theme/index.d.ts +78 -0
  216. package/dist/src/lib/theme/index.d.ts.map +1 -0
  217. package/dist/src/lib/theme/index.js +135 -0
  218. package/dist/src/lib/theme/index.mjs +251 -0
  219. package/dist/src/lib/theme/provider.cjs +346 -0
  220. package/dist/src/lib/theme/provider.d.ts +34 -0
  221. package/dist/src/lib/theme/provider.d.ts.map +1 -0
  222. package/dist/src/lib/theme/provider.js +60 -0
  223. package/dist/src/lib/theme/provider.mjs +332 -0
  224. package/dist/src/lib/utils/index.cjs +209 -0
  225. package/dist/src/lib/utils/index.d.ts +286 -0
  226. package/dist/src/lib/utils/index.d.ts.map +1 -0
  227. package/dist/src/lib/utils/index.js +434 -0
  228. package/dist/src/lib/utils/index.mjs +188 -0
  229. package/dist/src/routes.cjs +37 -0
  230. package/dist/src/routes.d.ts +22 -0
  231. package/dist/src/routes.d.ts.map +1 -0
  232. package/dist/src/routes.js +20 -0
  233. package/dist/src/routes.mjs +17 -0
  234. package/dist/src/server.cjs +405 -0
  235. package/dist/src/server.d.ts +63 -0
  236. package/dist/src/server.d.ts.map +1 -0
  237. package/dist/src/server.js +62 -0
  238. package/dist/src/server.mjs +382 -0
  239. package/dist/src/utils.cjs +21 -0
  240. package/dist/src/utils.d.ts +10 -0
  241. package/dist/src/utils.d.ts.map +1 -0
  242. package/dist/src/utils.js +9 -0
  243. package/dist/src/utils.mjs +4 -0
  244. package/dist/src/version.generated.cjs +26 -0
  245. package/dist/src/version.generated.d.ts +3 -0
  246. package/dist/src/version.generated.d.ts.map +1 -0
  247. package/dist/src/version.generated.js +3 -0
  248. package/dist/src/version.generated.mjs +5 -0
  249. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  250. package/package.json +164 -0
  251. package/src/index.ts +19 -0
  252. package/types/fluixi.d.ts +5 -0
  253. package/types/vinxi.d.ts +50 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ibrahima Touré
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,334 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/fluixi/assets/main/logos/128x128.png" alt="Fluixi" width="120" height="120" />
3
+ </p>
4
+
5
+ # fluixi
6
+
7
+ **A compiler-native reactive framework. The compiler knows what's reactive, so you write ordinary TypeScript.**
8
+
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-22c55e.svg)](./LICENSE)
10
+ ![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white)
11
+ [![npm](https://img.shields.io/npm/v/fluixi?logo=npm)](https://www.npmjs.com/package/fluixi)
12
+
13
+ ---
14
+
15
+ Most reactive frameworks ask you to keep a model in your head that the language doesn't share: which reads are tracked, what you may not destructure, where a value has to stay a function. The compiler can't help, because it doesn't know what your values are — so the burden is yours, and the failures are quiet ones.
16
+
17
+ Fluixi's compiler knows. It resolves a reactive primitive by the binding it came from, not by how the name reads, and carries that through JSX and `` html`` `` templates, the DOM it generates, SSR, hydration and routing as one model.
18
+
19
+ ## Features
20
+
21
+ - 🧠 **The compiler understands reactivity** - resolves primitives by binding, not by name; an alias is recognised, a same-named local function is not
22
+ - ✂️ **Destructure your props** - `function Card({ title })` keeps updating; `...rest` becomes the `splitProps` call you'd have written
23
+ - ✍️ **Two syntaxes, one model** - JSX and `` html`` `` templates compile to the same reactive representation
24
+ - 🚀 **Direct DOM** - a change runs the binding that depends on it; no component re-render, no diff, no virtual tree
25
+ - ⏳ **Load strategies** - `load:visible`, `load:idle`, `load:interaction`, `load:media` split a component into its own chunk
26
+ - 🛣️ **Router, SSR and hydration** - the same reactive graph end to end, not agreed at the edges
27
+ - 📡 **Resources + Suspense** - async data with loading/error state, awaited and seeded during SSR
28
+ - 🏗️ **TypeScript first** - full types, and a language-service plugin for `` html`` `` templates
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ npm install @fluixi/core @fluixi/reactive
34
+ # or
35
+ pnpm add @fluixi/core @fluixi/reactive
36
+ # or
37
+ yarn add @fluixi/core @fluixi/reactive
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ### Creating a New Project
43
+
44
+ ```bash
45
+ npm create fluixi my-app
46
+ # or: pnpm create fluixi my-app
47
+ ```
48
+
49
+ ### Basic Example
50
+
51
+ ```tsx
52
+ import { render } from '@fluixi/core';
53
+
54
+ const Counter = () => {
55
+ const count = $signal(0);
56
+
57
+ return (
58
+ <div>
59
+ <h1>Count: {count()}</h1>
60
+ <button onClick={() => count.set(count() + 1)}>Increment</button>
61
+ <button onClick={() => count.set(count() - 1)}>Decrement</button>
62
+ <button onClick={() => count.set(0)}>Reset</button>
63
+ </div>
64
+ );
65
+ };
66
+
67
+ render(() => <Counter />, document.getElementById('app')!);
68
+ ```
69
+
70
+ `$signal` needs no import — the compiler resolves it and adds what it needs. `signal(0)` from `@fluixi/reactive/signal` is the same primitive when you'd rather import it, and works in a package that never runs this compiler.
71
+
72
+ > JSX is compiled by `@fluixi/vite-plugin`. Scaffold a ready-to-run app with `npm create fluixi`.
73
+
74
+ ## Core Concepts
75
+
76
+ ### Signals
77
+
78
+ Signals are reactive state. Reading one inside an effect or JSX subscribes to it; setting it updates only what depends on it.
79
+
80
+ ```tsx
81
+ const count = $signal(0);
82
+ const name = $signal('Alice');
83
+
84
+ $effect(() => {
85
+ console.log(`${name()} counted to ${count()}`);
86
+ });
87
+
88
+ count.set(5); // "Alice counted to 5"
89
+ name.set('Bob'); // "Bob counted to 5"
90
+ ```
91
+
92
+ Call it to read, `.set()` to write. `$memo` derives, `$store` holds an object you read
93
+ properties off, `$resource` wraps async data. Each has an importable twin — `signal`,
94
+ `memo`, `effect`, `store`, `resource` from `@fluixi/reactive/signal` — and they are the
95
+ same primitives, so the two spellings mix freely in one file.
96
+
97
+ `createSignal` and its `[read, write]` pair are unchanged, and plenty of code is written
98
+ against them.
99
+
100
+ ### Components
101
+
102
+ Components are plain functions that return JSX. A component runs **once**; props are live
103
+ reads rather than values handed over at call time.
104
+
105
+ ```tsx
106
+ function Greeting(props: { name: string }) {
107
+ return <h1>Hello, {props.name}!</h1>;
108
+ }
109
+ ```
110
+
111
+ Destructuring them is fine — the compiler rewrites the bindings into reads, so they keep
112
+ updating, and `...rest` becomes the `splitProps` call you would have written:
113
+
114
+ ```tsx
115
+ function Card({ title, tone = 'calm', ...rest }) {
116
+ return <article data-tone={tone} {...rest}><h2>{title}</h2></article>;
117
+ }
118
+ ```
119
+
120
+ Where it can't prove a rewrite is safe — a reassigned binding, a computed key, a default
121
+ it would have to re-run on every read — it leaves your code exactly as written and says
122
+ why at build time.
123
+
124
+ ### Control Flow
125
+
126
+ Use control-flow components instead of ternaries and `.map()` so updates stay fine-grained.
127
+
128
+ ```tsx
129
+ import { Show, For, Switch, Match } from '@fluixi/core';
130
+
131
+ // Show — conditional rendering (child callback receives the narrowed value)
132
+ <Show when={() => user()} fallback={<p>Please log in</p>}>
133
+ {(u) => <p>Welcome, {u.name}!</p>}
134
+ </Show>
135
+
136
+ // For — keyed list rendering (index is an accessor)
137
+ <For each={todos()}>
138
+ {(todo, i) => <li>{i() + 1}. {todo.text}</li>}
139
+ </For>
140
+
141
+ // Switch / Match — multi-branch
142
+ <Switch fallback={<p>Idle</p>}>
143
+ <Match when={() => status() === 'loading'}><p>Loading…</p></Match>
144
+ <Match when={() => status() === 'success'}><p>Done!</p></Match>
145
+ <Match when={() => status() === 'error'}><p>Error</p></Match>
146
+ </Switch>
147
+ ```
148
+
149
+ `Portal`, `Dynamic`, `Index`, and `ErrorBoundary` are also exported.
150
+
151
+ ### Load strategies
152
+
153
+ A `load:` directive decides *when* a component's module is fetched, and moves it into its
154
+ own chunk:
155
+
156
+ ```tsx
157
+ import { RevenueChart } from './RevenueChart';
158
+
159
+ <RevenueChart load:visible="200px" /> // when it scrolls near the viewport
160
+ <ExportDialog load:interaction /> // on first pointer, focus or key
161
+ <AuditLog load:media="(min-width: 1024px)" />
162
+ <Panel load:idle />
163
+ ```
164
+
165
+ Deferring replaces your static import with a dynamic one, so it applies when the name is
166
+ used only as a tag. Reference it as a value too and the import stays — the build says so
167
+ rather than silently shipping the chunk eagerly.
168
+
169
+ ### `` html`` `` templates
170
+
171
+ The same reactive model without configuring JSX — useful in a library, a script, or a
172
+ plain-TypeScript codebase:
173
+
174
+ ```ts
175
+ import { html } from '@fluixi/core';
176
+
177
+ function Counter() {
178
+ const n = $signal(0);
179
+ return html`<button @click=${() => n.set(n() + 1)}>${n()}</button>`;
180
+ }
181
+ ```
182
+
183
+ Both syntaxes compile to the same representation; `@fluixi/ts-plugin` gives templates
184
+ hover, completion and type-checking in the editor.
185
+
186
+ ### Resources & Suspense
187
+
188
+ `createResource` fetches async data and tracks loading/error. `<Suspense>` shows a fallback while it's pending (works on the client and during SSR).
189
+
190
+ ```tsx
191
+ import { Suspense } from '@fluixi/core';
192
+
193
+ function UserCard() {
194
+ const id = $signal(1);
195
+ const user = $resource(id, (id) =>
196
+ fetch(`/api/users/${id}`).then((r) => r.json())
197
+ );
198
+
199
+ return (
200
+ <Suspense fallback={<p>Loading…</p>}>
201
+ <p>{user()?.name}</p>
202
+ </Suspense>
203
+ );
204
+ }
205
+ ```
206
+
207
+ ### Context
208
+
209
+ Share state down the tree without prop drilling.
210
+
211
+ ```tsx
212
+ import { createContext, useContext } from '@fluixi/core';
213
+
214
+ const ThemeContext = createContext<'light' | 'dark'>('light');
215
+
216
+ function App() {
217
+ return (
218
+ <ThemeContext.Provider value="dark">
219
+ <Toolbar />
220
+ </ThemeContext.Provider>
221
+ );
222
+ }
223
+
224
+ function Toolbar() {
225
+ const theme = useContext(ThemeContext);
226
+ return <div class={theme}>…</div>;
227
+ }
228
+ ```
229
+
230
+ ### Router
231
+
232
+ The router takes a `routes` config; nested routes render through `<Outlet />`, and `lazy()` code-splits.
233
+
234
+ ```tsx
235
+ import { render } from '@fluixi/core';
236
+ import { Router, Outlet, lazy } from '@fluixi/core/router';
237
+
238
+ const routes = [
239
+ {
240
+ path: '/',
241
+ component: () => (
242
+ <div class="app">
243
+ <nav>…</nav>
244
+ <Outlet />
245
+ </div>
246
+ ),
247
+ children: [
248
+ { path: '', component: () => <h1>Home</h1> },
249
+ { path: 'about', component: lazy(() => import('./About')) },
250
+ ],
251
+ },
252
+ ];
253
+
254
+ render(() => <Router routes={routes} />, document.getElementById('app')!);
255
+ ```
256
+
257
+ ## Lifecycle Hooks
258
+
259
+ ```tsx
260
+ import { onMount, onCleanup } from '@fluixi/core';
261
+
262
+ function Clock() {
263
+ const now = $signal(Date.now());
264
+
265
+ onMount(() => {
266
+ const id = setInterval(() => now.set(Date.now()), 1000);
267
+ onCleanup(() => clearInterval(id));
268
+ });
269
+
270
+ return <time>{new Date(now()).toLocaleTimeString()}</time>;
271
+ }
272
+ ```
273
+
274
+ ## Derived State & Batching
275
+
276
+ ```tsx
277
+ import { batch } from '@fluixi/core';
278
+
279
+ const first = $signal('Ada');
280
+ const last = $signal('Lovelace');
281
+
282
+ // Memo — cached, recomputes only when a dependency changes
283
+ const fullName = $memo(() => `${first()} ${last()}`);
284
+
285
+ // Batch — coalesce multiple writes into one update
286
+ batch(() => {
287
+ first.set('Grace');
288
+ last.set('Hopper');
289
+ });
290
+ ```
291
+
292
+ ## SSR
293
+
294
+ Server rendering, hydration, file-based routing and the dev/build tooling live in [`@fluixi/start`](https://www.npmjs.com/package/@fluixi/start). Scaffold an SSR app with `npm create fluixi` and pick the SSR template.
295
+
296
+ ## TypeScript
297
+
298
+ Fluixi is written in TypeScript and ships full types. Configure JSX in your `tsconfig.json`:
299
+
300
+ ```json
301
+ {
302
+ "compilerOptions": {
303
+ "jsx": "preserve",
304
+ "jsxImportSource": "@fluixi/jsx"
305
+ }
306
+ }
307
+ ```
308
+
309
+ ## Ecosystem
310
+
311
+ | Package | Purpose |
312
+ | --- | --- |
313
+ | `@fluixi/core` | Framework façade — components, control flow, router, render |
314
+ | `@fluixi/reactive` | Signals, memos, effects, store — usable on its own |
315
+ | `@fluixi/dom` | The DOM rendering runtime |
316
+ | `@fluixi/compiler` | JSX and `` html`` `` → IR → direct DOM calls |
317
+ | `@fluixi/vite-plugin` | The compiler as a Vite plugin (rollup, esbuild and webpack adapters too) |
318
+ | `@fluixi/start` | SSR, streaming, SSG, file routing, server functions, deploy adapters |
319
+ | `@fluixi/router` | The routing core |
320
+ | `@fluixi/server` | Server rendering |
321
+ | `@fluixi/head` | Document head and SEO |
322
+ | `@fluixi/ts-plugin` | Editor support for `` html`` `` templates |
323
+ | `@fluixi/template-parser` | The `` html`` `` parser, standalone |
324
+ | `@fluixi/auth` · `@fluixi/session` | Auth bindings and sessions |
325
+ | `@fluixi/testing` · `@fluixi/devtools` | Test helpers, reactive-graph devtools |
326
+ | `@fluixi/cli` · `create-fluixi` | Generators and the app scaffolder |
327
+
328
+ ## License
329
+
330
+ MIT
331
+
332
+ ## Links
333
+
334
+ - [npm](https://www.npmjs.com/package/fluixi)