@fluixi/core 1.0.0-alpha.83 → 1.0.0-alpha.85

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 (182) hide show
  1. package/dist/cdn/core.global.js +2 -1
  2. package/dist/cli/generate.cjs +4117 -292
  3. package/dist/cli/generate.mjs +4122 -292
  4. package/dist/cli/index.cjs +4117 -292
  5. package/dist/cli/index.mjs +4122 -292
  6. package/dist/cli/run.cjs +63 -1
  7. package/dist/cli/run.mjs +39 -1
  8. package/dist/src/cdn/chunk-MDJLC3PE.mjs +830 -0
  9. package/dist/src/cdn/core.cjs +1365 -1
  10. package/dist/src/cdn/core.d.ts +3 -3
  11. package/dist/src/cdn/core.js +3 -3
  12. package/dist/src/cdn/core.mjs +642 -1
  13. package/dist/src/cdn/router-JYFZP3EZ.mjs +70 -0
  14. package/dist/src/index.cjs +1280 -1
  15. package/dist/src/index.d.ts.map +1 -1
  16. package/dist/src/index.js +1 -11
  17. package/dist/src/index.mjs +1393 -1
  18. package/dist/src/jsx-dev-runtime.cjs +26 -1
  19. package/dist/src/jsx-dev-runtime.mjs +24 -1
  20. package/dist/src/jsx-runtime.cjs +26 -1
  21. package/dist/src/jsx-runtime.js +0 -9
  22. package/dist/src/jsx-runtime.mjs +24 -1
  23. package/dist/src/lib/client/chunk-7IUN2FLI.mjs +133 -0
  24. package/dist/src/lib/client/index.cjs +956 -1
  25. package/dist/src/lib/client/index.d.ts +17 -6
  26. package/dist/src/lib/client/index.d.ts.map +1 -1
  27. package/dist/src/lib/client/index.js +26 -19
  28. package/dist/src/lib/client/index.mjs +222 -1
  29. package/dist/src/lib/client/router-NOFEMOEH.mjs +631 -0
  30. package/dist/src/lib/context/context.cjs +118 -1
  31. package/dist/src/lib/context/context.d.ts +19 -37
  32. package/dist/src/lib/context/context.d.ts.map +1 -1
  33. package/dist/src/lib/context/context.js +8 -45
  34. package/dist/src/lib/context/context.mjs +99 -1
  35. package/dist/src/lib/context/index.cjs +120 -1
  36. package/dist/src/lib/context/index.mjs +99 -1
  37. package/dist/src/lib/control-flow.cjs +35 -1
  38. package/dist/src/lib/control-flow.mjs +25 -1
  39. package/dist/src/lib/core.cjs +1279 -1
  40. package/dist/src/lib/core.d.ts +0 -2
  41. package/dist/src/lib/core.d.ts.map +1 -1
  42. package/dist/src/lib/core.js +14 -48
  43. package/dist/src/lib/core.mjs +1393 -1
  44. package/dist/src/lib/env/index.cjs +60 -1
  45. package/dist/src/lib/env/index.d.ts +5 -5
  46. package/dist/src/lib/env/index.js +5 -5
  47. package/dist/src/lib/env/index.mjs +39 -1
  48. package/dist/src/lib/i18n/index.cjs +108 -1
  49. package/dist/src/lib/i18n/index.d.ts +31 -10
  50. package/dist/src/lib/i18n/index.d.ts.map +1 -1
  51. package/dist/src/lib/i18n/index.js +31 -10
  52. package/dist/src/lib/i18n/index.mjs +88 -1
  53. package/dist/src/lib/index.cjs +633 -1
  54. package/dist/src/lib/index.d.ts +0 -2
  55. package/dist/src/lib/index.d.ts.map +1 -1
  56. package/dist/src/lib/index.js +5 -11
  57. package/dist/src/lib/index.mjs +721 -1
  58. package/dist/src/lib/isomorphic.cjs +85 -1
  59. package/dist/src/lib/isomorphic.d.ts +41 -8
  60. package/dist/src/lib/isomorphic.d.ts.map +1 -1
  61. package/dist/src/lib/isomorphic.js +38 -5
  62. package/dist/src/lib/isomorphic.mjs +64 -1
  63. package/dist/src/lib/jsx-runtime/index.cjs +21 -1
  64. package/dist/src/lib/jsx-runtime/index.d.ts +1 -1
  65. package/dist/src/lib/jsx-runtime/index.js +1 -11
  66. package/dist/src/lib/jsx-runtime/index.mjs +4 -1
  67. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.cjs +21 -1
  68. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.mjs +4 -1
  69. package/dist/src/lib/plugins/fluixi-routes-plugin.cjs +302 -8
  70. package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts +15 -1
  71. package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts.map +1 -1
  72. package/dist/src/lib/plugins/fluixi-routes-plugin.js +19 -5
  73. package/dist/src/lib/plugins/fluixi-routes-plugin.mjs +271 -8
  74. package/dist/src/lib/plugins/index.cjs +311 -8
  75. package/dist/src/lib/plugins/index.mjs +279 -8
  76. package/dist/src/lib/plugins/route-codegen.cjs +73 -8
  77. package/dist/src/lib/plugins/route-codegen.d.ts +0 -1
  78. package/dist/src/lib/plugins/route-codegen.d.ts.map +1 -1
  79. package/dist/src/lib/plugins/route-codegen.js +4 -5
  80. package/dist/src/lib/plugins/route-codegen.mjs +52 -8
  81. package/dist/src/lib/plugins/route-scanner.cjs +189 -1
  82. package/dist/src/lib/plugins/route-scanner.d.ts +1 -2
  83. package/dist/src/lib/plugins/route-scanner.d.ts.map +1 -1
  84. package/dist/src/lib/plugins/route-scanner.js +7 -8
  85. package/dist/src/lib/plugins/route-scanner.mjs +158 -1
  86. package/dist/src/lib/plugins/vite.cjs +27 -1
  87. package/dist/src/lib/plugins/vite.mjs +6 -1
  88. package/dist/src/lib/render/await.cjs +38 -1
  89. package/dist/src/lib/render/await.d.ts +18 -0
  90. package/dist/src/lib/render/await.d.ts.map +1 -1
  91. package/dist/src/lib/render/await.js +20 -2
  92. package/dist/src/lib/render/await.mjs +17 -1
  93. package/dist/src/lib/render/component.cjs +221 -1
  94. package/dist/src/lib/render/component.d.ts +3 -44
  95. package/dist/src/lib/render/component.d.ts.map +1 -1
  96. package/dist/src/lib/render/component.js +23 -55
  97. package/dist/src/lib/render/component.mjs +214 -1
  98. package/dist/src/lib/render/deferred.cjs +175 -1
  99. package/dist/src/lib/render/deferred.js +5 -5
  100. package/dist/src/lib/render/deferred.mjs +158 -1
  101. package/dist/src/lib/render/index.cjs +573 -1
  102. package/dist/src/lib/render/index.d.ts +3 -17
  103. package/dist/src/lib/render/index.d.ts.map +1 -1
  104. package/dist/src/lib/render/index.js +8 -22
  105. package/dist/src/lib/render/index.mjs +590 -1
  106. package/dist/src/lib/render/lazy.cjs +67 -1
  107. package/dist/src/lib/render/lazy.d.ts +22 -1
  108. package/dist/src/lib/render/lazy.d.ts.map +1 -1
  109. package/dist/src/lib/render/lazy.js +26 -5
  110. package/dist/src/lib/render/lazy.mjs +50 -1
  111. package/dist/src/lib/render/suspense.cjs +141 -1
  112. package/dist/src/lib/render/suspense.d.ts +40 -0
  113. package/dist/src/lib/render/suspense.d.ts.map +1 -1
  114. package/dist/src/lib/render/suspense.js +46 -6
  115. package/dist/src/lib/render/suspense.mjs +136 -1
  116. package/dist/src/lib/render/versions.cjs +35 -1
  117. package/dist/src/lib/render/versions.js +6 -6
  118. package/dist/src/lib/render/versions.mjs +14 -1
  119. package/dist/src/lib/router/data.cjs +230 -1
  120. package/dist/src/lib/router/data.d.ts +1 -13
  121. package/dist/src/lib/router/data.d.ts.map +1 -1
  122. package/dist/src/lib/router/data.js +0 -12
  123. package/dist/src/lib/router/data.mjs +214 -1
  124. package/dist/src/lib/router/index.cjs +709 -1
  125. package/dist/src/lib/router/index.d.ts +78 -23
  126. package/dist/src/lib/router/index.d.ts.map +1 -1
  127. package/dist/src/lib/router/index.js +161 -37
  128. package/dist/src/lib/router/index.mjs +722 -1
  129. package/dist/src/lib/router/transition.cjs +75 -0
  130. package/dist/src/lib/router/transition.d.ts +81 -0
  131. package/dist/src/lib/router/transition.d.ts.map +1 -0
  132. package/dist/src/lib/router/transition.js +136 -0
  133. package/dist/src/lib/router/transition.mjs +54 -0
  134. package/dist/src/lib/server/hydration.cjs +169 -1
  135. package/dist/src/lib/server/hydration.d.ts +15 -55
  136. package/dist/src/lib/server/hydration.d.ts.map +1 -1
  137. package/dist/src/lib/server/hydration.js +23 -62
  138. package/dist/src/lib/server/hydration.mjs +148 -1
  139. package/dist/src/lib/server/index.cjs +401 -11
  140. package/dist/src/lib/server/index.d.ts +30 -6
  141. package/dist/src/lib/server/index.d.ts.map +1 -1
  142. package/dist/src/lib/server/index.js +34 -11
  143. package/dist/src/lib/server/index.mjs +379 -11
  144. package/dist/src/lib/server/reactive.cjs +197 -1
  145. package/dist/src/lib/server/reactive.d.ts +18 -77
  146. package/dist/src/lib/server/reactive.d.ts.map +1 -1
  147. package/dist/src/lib/server/reactive.js +19 -78
  148. package/dist/src/lib/server/reactive.mjs +176 -1
  149. package/dist/src/lib/theme/index.cjs +110 -1
  150. package/dist/src/lib/theme/index.d.ts +19 -4
  151. package/dist/src/lib/theme/index.d.ts.map +1 -1
  152. package/dist/src/lib/theme/index.js +17 -2
  153. package/dist/src/lib/theme/index.mjs +89 -1
  154. package/dist/src/lib/utils/index.cjs +209 -1
  155. package/dist/src/lib/utils/index.d.ts +0 -93
  156. package/dist/src/lib/utils/index.d.ts.map +1 -1
  157. package/dist/src/lib/utils/index.js +0 -93
  158. package/dist/src/lib/utils/index.mjs +188 -1
  159. package/dist/src/routes.cjs +37 -1
  160. package/dist/src/routes.d.ts +1 -1
  161. package/dist/src/routes.js +2 -2
  162. package/dist/src/routes.mjs +17 -1
  163. package/dist/src/server.cjs +400 -11
  164. package/dist/src/server.d.ts +0 -1
  165. package/dist/src/server.d.ts.map +1 -1
  166. package/dist/src/server.js +0 -1
  167. package/dist/src/server.mjs +377 -11
  168. package/dist/src/utils.cjs +21 -1
  169. package/dist/src/utils.d.ts +1 -1
  170. package/dist/src/utils.js +1 -1
  171. package/dist/src/utils.mjs +4 -1
  172. package/dist/src/version.generated.cjs +26 -1
  173. package/dist/src/version.generated.d.ts +1 -1
  174. package/dist/src/version.generated.js +2 -2
  175. package/dist/src/version.generated.mjs +5 -1
  176. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  177. package/package.json +17 -16
  178. package/src/index.ts +2 -14
  179. package/dist/src/cdn/chunk-55BT3H6E.mjs +0 -1
  180. package/dist/src/cdn/router-5JJZBK4E.mjs +0 -1
  181. package/dist/src/lib/client/chunk-SM4WHBOP.mjs +0 -1
  182. package/dist/src/lib/client/router-IBD4WPQT.mjs +0 -1
@@ -1,16 +1,384 @@
1
- var x=!1,a=new Map;function g(){return x}function b(t){x=t}function l(t,e){a.set(t,e)}function p(t){return a.get(t)}function O(t){return a.has(t)}function S(){a.clear()}function E(t){a.delete(t)}function f(){if(a.size===0)return"";let t=Object.fromEntries(a);return`<script type="application/json" id="__FLUIXI_HYDRATION__">${JSON.stringify(t)}<\/script>`}function A(){if(typeof window>"u")return!1;let t=document.getElementById("__FLUIXI_HYDRATION__");if(!t||t.getAttribute("type")!=="application/json")return!1;try{let e=t.textContent||"{}",n=JSON.parse(e);for(let[r,o]of Object.entries(n))a.set(r,o);return!0}catch(e){return console.error("Failed to deserialize hydration data:",e),!1}}function k(t){return`<!--#${t}-->`}function _(t){return`<!--#${t}-->`}function j(t){return`<!--/${t}-->`}function M(t,e){return async()=>{if(g()||typeof window<"u"){let r=p(t);if(r!==void 0)return r}let n=await e();return typeof window>"u"&&l(t,n),n}}function $(t,e){let n=p(t);if(n!==void 0)return n;let r=typeof e=="function"?e():e;return typeof window>"u"&&l(t,r),r}function m(){if(typeof window>"u")return;let t=document.getElementById("__FLUIXI_HYDRATION__");t&&t.remove();let e=document.createTreeWalker(document.body,NodeFilter.SHOW_COMMENT,null),n=[],r;for(;r=e.nextNode();){let o=r,i=o.nodeValue||"";(i.startsWith("#")||i.startsWith("/"))&&n.push(o)}n.forEach(o=>o.remove()),S()}typeof window<"u"&&window.addEventListener("load",()=>{setTimeout(m,100)});function K(){return typeof window>"u"}function F(){return typeof window<"u"}import{renderToString as w}from"@fluixi/server";function I(t,e){let n=t;return[(()=>n),i=>(typeof i=="function"?n=i(n):n=i,n)]}function y(t,e,n){try{t(e)}catch(r){console.error("[Fluixi Server] Effect error:",r)}return{dispose:()=>{}}}function h(t,e,n){let r=t(e);return(()=>r)}function N(t){let e=[],n=()=>{e.forEach(r=>{try{r()}catch(o){console.error("[Fluixi Server] Cleanup error:",o)}}),e.length=0};try{return t(n)}catch(r){throw n(),r}}function z(t){return t()}function W(t){return t()}var v=null;function L(t){v&&v.push(t)}var u=null;function U(){return u}function Y(t,e){let n=u;u=t;try{return e()}finally{u=n}}var s=new Map;function P(t){let e=Symbol("context");return{id:e,Provider:r=>{let o=s.get(e);s.set(e,r.value);try{return r.children}finally{o!==void 0?s.set(e,o):s.delete(e)}},defaultValue:t}}function V(t){let e=s.get(t.id);return e!==void 0?e:t.defaultValue}function X(t){return y(t)}function B(t){return y(t)}function J(t){return h(t)}function q(t){let e=t();return n=>n===e}function G(t,e,n){return[()=>{},{mutate:r=>r,refetch:()=>{}}]}function Q(t){t()}var Z=!0,tt=!1;var c=null;function dt(){return c}function lt(t){c=t}function pt(t,e){let n=c;c=t;try{return e()}finally{c=n}}async function et(t,e={}){let n=await C(t);return nt(n,e)}function nt(t,e={}){let{title:n="Fluixi App",lang:r="en",stylesheets:o=[],scripts:i=[],head:D="",bodyAttributes:T=""}=e,R=o.map(d=>`<link rel="stylesheet" href="${d}">`).join(`
2
- `),H=i.map(d=>`<script type="module" src="${d}"><\/script>`).join(`
3
- `);return`<!DOCTYPE html>
4
- <html lang="${r}">
1
+ /*! @fluixi/core v1.0.0-alpha.85 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+
3
+ // src/lib/server/hydration.ts
4
+ import { isServer as domIsServer } from "@fluixi/dom";
5
+ var hydrating = false;
6
+ var hydrationDataMap = /* @__PURE__ */ new Map();
7
+ function isHydrating() {
8
+ return hydrating;
9
+ }
10
+ function setHydrating(state) {
11
+ hydrating = state;
12
+ }
13
+ function setHydrationData(key, data) {
14
+ hydrationDataMap.set(key, data);
15
+ }
16
+ function getHydrationData(key) {
17
+ return hydrationDataMap.get(key);
18
+ }
19
+ function hasHydrationData(key) {
20
+ return hydrationDataMap.has(key);
21
+ }
22
+ function clearHydrationData() {
23
+ hydrationDataMap.clear();
24
+ }
25
+ function clearHydrationDataKey(key) {
26
+ hydrationDataMap.delete(key);
27
+ }
28
+ function serializeHydrationData() {
29
+ if (hydrationDataMap.size === 0) {
30
+ return "";
31
+ }
32
+ const data = Object.fromEntries(hydrationDataMap);
33
+ const json = JSON.stringify(data);
34
+ return `<script type="application/json" id="__FLUIXI_HYDRATION__">${json}<\/script>`;
35
+ }
36
+ function deserializeHydrationData() {
37
+ if (typeof window === "undefined") {
38
+ return false;
39
+ }
40
+ const script = document.getElementById("__FLUIXI_HYDRATION__");
41
+ if (!script || script.getAttribute("type") !== "application/json") {
42
+ return false;
43
+ }
44
+ try {
45
+ const json = script.textContent || "{}";
46
+ const data = JSON.parse(json);
47
+ for (const [key, value] of Object.entries(data)) {
48
+ hydrationDataMap.set(key, value);
49
+ }
50
+ return true;
51
+ } catch (error) {
52
+ console.error("Failed to deserialize hydration data:", error);
53
+ return false;
54
+ }
55
+ }
56
+ function hydrationMarker(id) {
57
+ return `<!--#${id}-->`;
58
+ }
59
+ function hydrationMarkerStart(id) {
60
+ return `<!--#${id}-->`;
61
+ }
62
+ function hydrationMarkerEnd(id) {
63
+ return `<!--/${id}-->`;
64
+ }
65
+ function createHydratableResource(key, fetcher) {
66
+ return async () => {
67
+ if (isHydrating() || typeof window !== "undefined") {
68
+ const cached = getHydrationData(key);
69
+ if (cached !== void 0) {
70
+ return cached;
71
+ }
72
+ }
73
+ const data = await fetcher();
74
+ if (typeof window === "undefined") {
75
+ setHydrationData(key, data);
76
+ }
77
+ return data;
78
+ };
79
+ }
80
+ function useHydrationData(key, value) {
81
+ const hydrationData = getHydrationData(key);
82
+ if (hydrationData !== void 0) {
83
+ return hydrationData;
84
+ }
85
+ const computedValue = typeof value === "function" ? value() : value;
86
+ if (typeof window === "undefined") {
87
+ setHydrationData(key, computedValue);
88
+ }
89
+ return computedValue;
90
+ }
91
+ function cleanupHydration() {
92
+ if (typeof window === "undefined") {
93
+ return;
94
+ }
95
+ const script = document.getElementById("__FLUIXI_HYDRATION__");
96
+ if (script) {
97
+ script.remove();
98
+ }
99
+ const walker = document.createTreeWalker(
100
+ document.body,
101
+ NodeFilter.SHOW_COMMENT,
102
+ null
103
+ );
104
+ const comments = [];
105
+ let node;
106
+ while (node = walker.nextNode()) {
107
+ const comment = node;
108
+ const text = comment.nodeValue || "";
109
+ if (text.startsWith("#") || text.startsWith("/")) {
110
+ comments.push(comment);
111
+ }
112
+ }
113
+ comments.forEach((comment) => comment.remove());
114
+ clearHydrationData();
115
+ }
116
+ if (typeof window !== "undefined") {
117
+ window.addEventListener("load", () => {
118
+ setTimeout(cleanupHydration, 100);
119
+ });
120
+ }
121
+ function isServerEnvironment() {
122
+ return domIsServer();
123
+ }
124
+ function isClientEnvironment() {
125
+ return !domIsServer();
126
+ }
127
+
128
+ // src/lib/server/index.ts
129
+ import { renderToString as domRenderToString } from "@fluixi/server";
130
+ import { isServer as isServer2 } from "@fluixi/dom";
131
+
132
+ // src/lib/server/reactive.ts
133
+ function createSignal(value, options) {
134
+ let current = value;
135
+ const read = (() => current);
136
+ const write = (newValue) => {
137
+ if (typeof newValue === "function") {
138
+ current = newValue(current);
139
+ } else {
140
+ current = newValue;
141
+ }
142
+ return current;
143
+ };
144
+ return [read, write];
145
+ }
146
+ function createEffect(fn, value, options) {
147
+ try {
148
+ fn(value);
149
+ } catch (error) {
150
+ console.error("[Fluixi Server] Effect error:", error);
151
+ }
152
+ return { dispose: () => {
153
+ } };
154
+ }
155
+ function createMemo(fn, value, options) {
156
+ const computed = fn(value);
157
+ return (() => computed);
158
+ }
159
+ function createRoot(fn) {
160
+ const cleanups = [];
161
+ const dispose = () => {
162
+ cleanups.forEach((cleanup) => {
163
+ try {
164
+ cleanup();
165
+ } catch (error) {
166
+ console.error("[Fluixi Server] Cleanup error:", error);
167
+ }
168
+ });
169
+ cleanups.length = 0;
170
+ };
171
+ try {
172
+ return fn(dispose);
173
+ } catch (error) {
174
+ dispose();
175
+ throw error;
176
+ }
177
+ }
178
+ function batch(fn) {
179
+ return fn();
180
+ }
181
+ function untrack(fn) {
182
+ return fn();
183
+ }
184
+ var currentCleanups = null;
185
+ function onCleanup(fn) {
186
+ if (currentCleanups) {
187
+ currentCleanups.push(fn);
188
+ }
189
+ }
190
+ var currentOwner = null;
191
+ function getOwner() {
192
+ return currentOwner;
193
+ }
194
+ function runWithOwner(owner, fn) {
195
+ const prev = currentOwner;
196
+ currentOwner = owner;
197
+ try {
198
+ return fn();
199
+ } finally {
200
+ currentOwner = prev;
201
+ }
202
+ }
203
+ var contextMap = /* @__PURE__ */ new Map();
204
+ function createContext(defaultValue) {
205
+ const id = /* @__PURE__ */ Symbol("context");
206
+ const Provider = (props) => {
207
+ const prevValue = contextMap.get(id);
208
+ contextMap.set(id, props.value);
209
+ try {
210
+ return props.children;
211
+ } finally {
212
+ if (prevValue !== void 0) {
213
+ contextMap.set(id, prevValue);
214
+ } else {
215
+ contextMap.delete(id);
216
+ }
217
+ }
218
+ };
219
+ return {
220
+ id,
221
+ Provider,
222
+ defaultValue
223
+ };
224
+ }
225
+ function useContext(context) {
226
+ const value = contextMap.get(context.id);
227
+ return value !== void 0 ? value : context.defaultValue;
228
+ }
229
+ function createComputed(fn) {
230
+ return createEffect(fn);
231
+ }
232
+ function createRenderEffect(fn) {
233
+ return createEffect(fn);
234
+ }
235
+ function createDeferred(fn) {
236
+ return createMemo(fn);
237
+ }
238
+ function createSelector(source) {
239
+ const value = source();
240
+ return (key) => key === value;
241
+ }
242
+ function createResource(source, fetcher, options) {
243
+ return [
244
+ () => void 0,
245
+ {
246
+ mutate: (v) => v,
247
+ refetch: () => {
248
+ }
249
+ }
250
+ ];
251
+ }
252
+ function startTransition(fn) {
253
+ fn();
254
+ }
255
+ var isServer = true;
256
+ var isClient = false;
257
+
258
+ // src/lib/server/index.ts
259
+ import { isServer as domIsServer2 } from "@fluixi/dom";
260
+ var currentSSRContext = null;
261
+ function getSSRContext() {
262
+ return currentSSRContext;
263
+ }
264
+ function setSSRContext(context) {
265
+ currentSSRContext = context;
266
+ }
267
+ function withSSRContext(context, fn) {
268
+ const prev = currentSSRContext;
269
+ currentSSRContext = context;
270
+ try {
271
+ return fn();
272
+ } finally {
273
+ currentSSRContext = prev;
274
+ }
275
+ }
276
+ async function renderToPage(code, options = {}) {
277
+ const content = await renderToString(code);
278
+ return createHtmlDocument(content, options);
279
+ }
280
+ function createHtmlDocument(content, options = {}) {
281
+ const {
282
+ title = "Fluixi App",
283
+ lang = "en",
284
+ stylesheets = [],
285
+ scripts = [],
286
+ head = "",
287
+ bodyAttributes = ""
288
+ } = options;
289
+ const styleTags = stylesheets.map((href) => `<link rel="stylesheet" href="${href}">`).join("\n ");
290
+ const scriptTags = scripts.map((src) => `<script type="module" src="${src}"><\/script>`).join("\n ");
291
+ return `<!DOCTYPE html>
292
+ <html lang="${lang}">
5
293
  <head>
6
294
  <meta charset="UTF-8">
7
295
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
- <title>${n}</title>
9
- ${R}
10
- ${D}
296
+ <title>${title}</title>
297
+ ${styleTags}
298
+ ${head}
11
299
  </head>
12
- <body${T?" "+T:""}>
13
- ${t}
14
- ${H}
300
+ <body${bodyAttributes ? " " + bodyAttributes : ""}>
301
+ ${content}
302
+ ${scriptTags}
15
303
  </body>
16
- </html>`}function rt(){return typeof window>"u"}function ot(){return typeof window<"u"}function ft(t,e){return rt()?t():e}function yt(t,e){return ot()?t():e}async function C(t){let e=await w(t),n=f();return e+n}async function it(t){let e=await w(t),n=f();return e+n}function Tt(t){return{render:e=>C(()=>t({url:e})),stream:e=>it(()=>t({url:e})),page:(e,n)=>et(()=>t({url:e}),n)}}export{z as batch,m as cleanupHydration,S as clearHydrationData,E as clearHydrationDataKey,X as createComputed,P as createContext,J as createDeferred,y as createEffect,nt as createHtmlDocument,M as createHydratableResource,h as createMemo,B as createRenderEffect,G as createResource,N as createRoot,q as createSelector,I as createSignal,A as deserializeHydrationData,p as getHydrationData,U as getOwner,dt as getSSRContext,O as hasHydrationData,k as hydrationMarker,j as hydrationMarkerEnd,_ as hydrationMarkerStart,ot as isClient,F as isClientEnvironment,tt as isClientReactive,g as isHydrating,rt as isServer,K as isServerEnvironment,Z as isServerReactive,L as onCleanup,yt as onClient,ft as onServer,et as renderToPage,it as renderToStream,C as renderToString,Y as runWithOwner,f as serializeHydrationData,b as setHydrating,l as setHydrationData,lt as setSSRContext,Tt as startServer,Q as startTransition,W as untrack,V as useContext,$ as useHydrationData,pt as withSSRContext};
304
+ </html>`;
305
+ }
306
+ function isClient2() {
307
+ return !domIsServer2();
308
+ }
309
+ function onServer(fn, fallback) {
310
+ return domIsServer2() ? fn() : fallback;
311
+ }
312
+ function onClient(fn, fallback) {
313
+ return !domIsServer2() ? fn() : fallback;
314
+ }
315
+ async function renderToString(code) {
316
+ const html = await domRenderToString(code);
317
+ const script = serializeHydrationData();
318
+ return html + script;
319
+ }
320
+ async function renderToStream(code) {
321
+ const html = await domRenderToString(code);
322
+ const script = serializeHydrationData();
323
+ return html + script;
324
+ }
325
+ function startServer(App) {
326
+ return {
327
+ /** Render the app to a full HTML string (includes hydration data) */
328
+ render: (url) => renderToString(() => App({ url })),
329
+ /** Render the app to a streamable HTML string (includes hydration data) */
330
+ stream: (url) => renderToStream(() => App({ url })),
331
+ /** Render the app to a complete HTML page document */
332
+ page: (url, opts) => renderToPage(() => App({ url }), opts)
333
+ };
334
+ }
335
+ export {
336
+ batch,
337
+ cleanupHydration,
338
+ clearHydrationData,
339
+ clearHydrationDataKey,
340
+ createComputed,
341
+ createContext,
342
+ createDeferred,
343
+ createEffect,
344
+ createHtmlDocument,
345
+ createHydratableResource,
346
+ createMemo,
347
+ createRenderEffect,
348
+ createResource,
349
+ createRoot,
350
+ createSelector,
351
+ createSignal,
352
+ deserializeHydrationData,
353
+ getHydrationData,
354
+ getOwner,
355
+ getSSRContext,
356
+ hasHydrationData,
357
+ hydrationMarker,
358
+ hydrationMarkerEnd,
359
+ hydrationMarkerStart,
360
+ isClient2 as isClient,
361
+ isClientEnvironment,
362
+ isClient as isClientReactive,
363
+ isHydrating,
364
+ isServer2 as isServer,
365
+ isServerEnvironment,
366
+ isServer as isServerReactive,
367
+ onCleanup,
368
+ onClient,
369
+ onServer,
370
+ renderToPage,
371
+ renderToStream,
372
+ renderToString,
373
+ runWithOwner,
374
+ serializeHydrationData,
375
+ setHydrating,
376
+ setHydrationData,
377
+ setSSRContext,
378
+ startServer,
379
+ startTransition,
380
+ untrack,
381
+ useContext,
382
+ useHydrationData,
383
+ withSSRContext
384
+ };
@@ -1 +1,197 @@
1
- "use strict";var l=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var v=(e,t)=>{for(var o in t)l(e,o,{get:t[o],enumerable:!0})},S=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of x(t))!y.call(e,r)&&r!==o&&l(e,r,{get:()=>t[r],enumerable:!(n=d(t,r))||n.enumerable});return e};var g=e=>S(l({},"__esModule",{value:!0}),e);var G={};v(G,{batch:()=>h,createComputed:()=>j,createContext:()=>b,createDeferred:()=>E,createEffect:()=>T,createMemo:()=>f,createRenderEffect:()=>F,createResource:()=>M,createRoot:()=>C,createSelector:()=>k,createSignal:()=>w,createStore:()=>D,getOwner:()=>R,getSharedConfig:()=>B,isClient:()=>q,isServer:()=>W,onCleanup:()=>K,runWithOwner:()=>O,setOwner:()=>z,sharedConfig:()=>u,startTransition:()=>V,untrack:()=>A,useContext:()=>m});module.exports=g(G);function w(e,t){let o=e;return[(()=>o),c=>(typeof c=="function"?o=c(o):o=c,o)]}function T(e,t,o){try{e(t)}catch(n){console.error("[Fluixi Server] Effect error:",n)}return{dispose:()=>{}}}function f(e,t,o){let n=e(t);return(()=>n)}function C(e){let t=[],o=()=>{t.forEach(n=>{try{n()}catch(r){console.error("[Fluixi Server] Cleanup error:",r)}}),t.length=0};try{return e(o)}catch(n){throw o(),n}}function h(e){return e()}function A(e){return e()}var p=null;function K(e){p&&p.push(e)}var s=null;function R(){return s}function O(e,t){let o=s;s=e;try{return t()}finally{s=o}}var i=new Map;function b(e){let t=Symbol("context");return{id:t,Provider:n=>{let r=i.get(t);i.set(t,n.value);try{return n.children}finally{r!==void 0?i.set(t,r):i.delete(t)}},defaultValue:e}}function m(e){let t=i.get(e.id);return t!==void 0?t:e.defaultValue}function j(e){return T(e)}function F(e){return T(e)}function E(e){return f(e)}function k(e){let t=e();return o=>o===t}function M(e,t,o){return[()=>{},{mutate:n=>n,refetch:()=>{}}]}function D(e){let t={...e};function o(n,r){if(typeof n=="object"&&n!==null&&!Array.isArray(n))for(let c of Object.keys(n)){let a=n[c];t[c]=typeof a=="function"?a(t[c]):a}else t[n]=typeof r=="function"?r(t[n]):r}return[t,o]}function V(e){e()}var W=!0,q=!1,u={context:null,owner:null};function z(e){s=e,u.owner=e,u.context=e}function B(){return u}
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/lib/server/reactive.ts
21
+ var reactive_exports = {};
22
+ __export(reactive_exports, {
23
+ batch: () => batch,
24
+ createComputed: () => createComputed,
25
+ createContext: () => createContext,
26
+ createDeferred: () => createDeferred,
27
+ createEffect: () => createEffect,
28
+ createMemo: () => createMemo,
29
+ createRenderEffect: () => createRenderEffect,
30
+ createResource: () => createResource,
31
+ createRoot: () => createRoot,
32
+ createSelector: () => createSelector,
33
+ createSignal: () => createSignal,
34
+ createStore: () => createStore,
35
+ getOwner: () => getOwner,
36
+ getSharedConfig: () => getSharedConfig,
37
+ isClient: () => isClient,
38
+ isServer: () => isServer,
39
+ onCleanup: () => onCleanup,
40
+ runWithOwner: () => runWithOwner,
41
+ setOwner: () => setOwner,
42
+ sharedConfig: () => sharedConfig,
43
+ startTransition: () => startTransition,
44
+ untrack: () => untrack,
45
+ useContext: () => useContext
46
+ });
47
+ module.exports = __toCommonJS(reactive_exports);
48
+ function createSignal(value, options) {
49
+ let current = value;
50
+ const read = (() => current);
51
+ const write = (newValue) => {
52
+ if (typeof newValue === "function") {
53
+ current = newValue(current);
54
+ } else {
55
+ current = newValue;
56
+ }
57
+ return current;
58
+ };
59
+ return [read, write];
60
+ }
61
+ function createEffect(fn, value, options) {
62
+ try {
63
+ fn(value);
64
+ } catch (error) {
65
+ console.error("[Fluixi Server] Effect error:", error);
66
+ }
67
+ return { dispose: () => {
68
+ } };
69
+ }
70
+ function createMemo(fn, value, options) {
71
+ const computed = fn(value);
72
+ return (() => computed);
73
+ }
74
+ function createRoot(fn) {
75
+ const cleanups = [];
76
+ const dispose = () => {
77
+ cleanups.forEach((cleanup) => {
78
+ try {
79
+ cleanup();
80
+ } catch (error) {
81
+ console.error("[Fluixi Server] Cleanup error:", error);
82
+ }
83
+ });
84
+ cleanups.length = 0;
85
+ };
86
+ try {
87
+ return fn(dispose);
88
+ } catch (error) {
89
+ dispose();
90
+ throw error;
91
+ }
92
+ }
93
+ function batch(fn) {
94
+ return fn();
95
+ }
96
+ function untrack(fn) {
97
+ return fn();
98
+ }
99
+ var currentCleanups = null;
100
+ function onCleanup(fn) {
101
+ if (currentCleanups) {
102
+ currentCleanups.push(fn);
103
+ }
104
+ }
105
+ var currentOwner = null;
106
+ function getOwner() {
107
+ return currentOwner;
108
+ }
109
+ function runWithOwner(owner, fn) {
110
+ const prev = currentOwner;
111
+ currentOwner = owner;
112
+ try {
113
+ return fn();
114
+ } finally {
115
+ currentOwner = prev;
116
+ }
117
+ }
118
+ var contextMap = /* @__PURE__ */ new Map();
119
+ function createContext(defaultValue) {
120
+ const id = /* @__PURE__ */ Symbol("context");
121
+ const Provider = (props) => {
122
+ const prevValue = contextMap.get(id);
123
+ contextMap.set(id, props.value);
124
+ try {
125
+ return props.children;
126
+ } finally {
127
+ if (prevValue !== void 0) {
128
+ contextMap.set(id, prevValue);
129
+ } else {
130
+ contextMap.delete(id);
131
+ }
132
+ }
133
+ };
134
+ return {
135
+ id,
136
+ Provider,
137
+ defaultValue
138
+ };
139
+ }
140
+ function useContext(context) {
141
+ const value = contextMap.get(context.id);
142
+ return value !== void 0 ? value : context.defaultValue;
143
+ }
144
+ function createComputed(fn) {
145
+ return createEffect(fn);
146
+ }
147
+ function createRenderEffect(fn) {
148
+ return createEffect(fn);
149
+ }
150
+ function createDeferred(fn) {
151
+ return createMemo(fn);
152
+ }
153
+ function createSelector(source) {
154
+ const value = source();
155
+ return (key) => key === value;
156
+ }
157
+ function createResource(source, fetcher, options) {
158
+ return [
159
+ () => void 0,
160
+ {
161
+ mutate: (v) => v,
162
+ refetch: () => {
163
+ }
164
+ }
165
+ ];
166
+ }
167
+ function createStore(init) {
168
+ const state = { ...init };
169
+ function setStore(keyOrPatch, value) {
170
+ if (typeof keyOrPatch === "object" && keyOrPatch !== null && !Array.isArray(keyOrPatch)) {
171
+ for (const k of Object.keys(keyOrPatch)) {
172
+ const v = keyOrPatch[k];
173
+ state[k] = typeof v === "function" ? v(state[k]) : v;
174
+ }
175
+ } else {
176
+ state[keyOrPatch] = typeof value === "function" ? value(state[keyOrPatch]) : value;
177
+ }
178
+ }
179
+ return [state, setStore];
180
+ }
181
+ function startTransition(fn) {
182
+ fn();
183
+ }
184
+ var isServer = true;
185
+ var isClient = false;
186
+ var sharedConfig = {
187
+ context: null,
188
+ owner: null
189
+ };
190
+ function setOwner(owner) {
191
+ currentOwner = owner;
192
+ sharedConfig.owner = owner;
193
+ sharedConfig.context = owner;
194
+ }
195
+ function getSharedConfig() {
196
+ return sharedConfig;
197
+ }