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

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 (177) 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-VNLCQBFQ.mjs +747 -0
  9. package/dist/src/cdn/core.cjs +1279 -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-WMN2AA7E.mjs +66 -0
  14. package/dist/src/index.cjs +1201 -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 +1313 -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-2C2KDDQV.mjs +133 -0
  24. package/dist/src/lib/client/index.cjs +870 -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-X526HSWQ.mjs +548 -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 +1200 -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 +1313 -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 +627 -1
  125. package/dist/src/lib/router/index.d.ts +62 -10
  126. package/dist/src/lib/router/index.d.ts.map +1 -1
  127. package/dist/src/lib/router/index.js +85 -33
  128. package/dist/src/lib/router/index.mjs +639 -1
  129. package/dist/src/lib/server/hydration.cjs +169 -1
  130. package/dist/src/lib/server/hydration.d.ts +15 -55
  131. package/dist/src/lib/server/hydration.d.ts.map +1 -1
  132. package/dist/src/lib/server/hydration.js +23 -62
  133. package/dist/src/lib/server/hydration.mjs +148 -1
  134. package/dist/src/lib/server/index.cjs +401 -11
  135. package/dist/src/lib/server/index.d.ts +30 -6
  136. package/dist/src/lib/server/index.d.ts.map +1 -1
  137. package/dist/src/lib/server/index.js +34 -11
  138. package/dist/src/lib/server/index.mjs +379 -11
  139. package/dist/src/lib/server/reactive.cjs +197 -1
  140. package/dist/src/lib/server/reactive.d.ts +18 -77
  141. package/dist/src/lib/server/reactive.d.ts.map +1 -1
  142. package/dist/src/lib/server/reactive.js +19 -78
  143. package/dist/src/lib/server/reactive.mjs +176 -1
  144. package/dist/src/lib/theme/index.cjs +110 -1
  145. package/dist/src/lib/theme/index.d.ts +19 -4
  146. package/dist/src/lib/theme/index.d.ts.map +1 -1
  147. package/dist/src/lib/theme/index.js +17 -2
  148. package/dist/src/lib/theme/index.mjs +89 -1
  149. package/dist/src/lib/utils/index.cjs +209 -1
  150. package/dist/src/lib/utils/index.d.ts +0 -93
  151. package/dist/src/lib/utils/index.d.ts.map +1 -1
  152. package/dist/src/lib/utils/index.js +0 -93
  153. package/dist/src/lib/utils/index.mjs +188 -1
  154. package/dist/src/routes.cjs +37 -1
  155. package/dist/src/routes.d.ts +1 -1
  156. package/dist/src/routes.js +2 -2
  157. package/dist/src/routes.mjs +17 -1
  158. package/dist/src/server.cjs +400 -11
  159. package/dist/src/server.d.ts +0 -1
  160. package/dist/src/server.d.ts.map +1 -1
  161. package/dist/src/server.js +0 -1
  162. package/dist/src/server.mjs +377 -11
  163. package/dist/src/utils.cjs +21 -1
  164. package/dist/src/utils.d.ts +1 -1
  165. package/dist/src/utils.js +1 -1
  166. package/dist/src/utils.mjs +4 -1
  167. package/dist/src/version.generated.cjs +26 -1
  168. package/dist/src/version.generated.d.ts +1 -1
  169. package/dist/src/version.generated.js +2 -2
  170. package/dist/src/version.generated.mjs +5 -1
  171. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  172. package/package.json +17 -16
  173. package/src/index.ts +2 -14
  174. package/dist/src/cdn/chunk-55BT3H6E.mjs +0 -1
  175. package/dist/src/cdn/router-5JJZBK4E.mjs +0 -1
  176. package/dist/src/lib/client/chunk-SM4WHBOP.mjs +0 -1
  177. package/dist/src/lib/client/router-IBD4WPQT.mjs +0 -1
@@ -1,5 +1,4 @@
1
1
  /**
2
- * @fileoverview Client-Side Rendering Entry Point for Fluixi
3
2
  * @module @fluixi/core/client
4
3
  *
5
4
  * Implements client-side mounting and hydration logic using @fluixi/dom runtime.
@@ -9,9 +8,6 @@ import '../render/versions.js';
9
8
  /**
10
9
  * Mount application to DOM (Client-side Rendering)
11
10
  *
12
- * @param App Root component function
13
- * @param container DOM element to mount into
14
- *
15
11
  * @example
16
12
  * ```typescript
17
13
  * import { mount } from '@fluixi/core/client';
@@ -28,13 +24,28 @@ export interface StartClientOptions {
28
24
  /** Force hydration mode. Default: auto-detect from __FLUIXI_HYDRATION__ marker */
29
25
  hydrate?: boolean;
30
26
  /**
31
- * The app's route tree (the same array passed to <Router routes={}/>). When provided,
27
+ * The app's route tree (the same array passed to <Router routes={...}/>). When provided,
32
28
  * the lazy chunk(s) for the route matching the current URL are downloaded and awaited
33
- * BEFORE hydration, so each lazy file-route resolves synchronously and adopts the server
29
+ * before hydration, so each lazy file-route resolves synchronously and adopts the server
34
30
  * DOM in place (no fallback, no duplicate). Passing this also enables auto-hydration of a
35
31
  * server-rendered (non-empty) root, giving flash-free hydration with zero extra config.
36
32
  */
37
33
  routes?: any[];
38
34
  }
35
+ /**
36
+ * Mount or hydrate an app in the browser.
37
+ *
38
+ * Hydration is detected from the marker the server render leaves behind, so the same
39
+ * call works for a server-rendered page and a plain SPA. Pass `hydrate` to force it.
40
+ *
41
+ * Pass `routes` for a file-routed app. The chunks for the route matching the current URL
42
+ * are downloaded and awaited before hydrating, which is what lets each lazy route resolve
43
+ * synchronously and adopt the server's DOM rather than building a second copy beside it.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * await startClient(App, { root: '#app', routes });
48
+ * ```
49
+ */
39
50
  export declare function startClient(App: (props?: any) => any, options?: StartClientOptions): Promise<void>;
40
51
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,OAAO,uBAAuB,CAAC;AAgB/B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,EAAE,SAAS,EAAE,WAAW,GAAG,IAAI,QAOlE;AAED,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC5B,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;CAChB;AAoBD,wBAAsB,WAAW,CAC/B,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,GAAG,EACzB,OAAO,GAAE,kBAAuB,iBAgEjC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/client/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,uBAAuB,CAAC;AAgB/B;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,EAAE,SAAS,EAAE,WAAW,GAAG,IAAI,QAOlE;AAED,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC5B,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;CAChB;AAoBD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,GAAG,EACzB,OAAO,GAAE,kBAAuB,iBAgEjC"}
@@ -1,17 +1,12 @@
1
1
  /**
2
- * @fileoverview Client-Side Rendering Entry Point for Fluixi
3
2
  * @module @fluixi/core/client
4
3
  *
5
4
  * Implements client-side mounting and hydration logic using @fluixi/dom runtime.
6
5
  * Supports both JSX and Lit HTML.
7
6
  */
8
- // import {
9
- // cleanupHydration,
10
- // deserializeHydrationData,
11
- // } from '../server/hydration.js';
12
7
  import { render as domRender, hydrate as domHydrate, } from '@fluixi/dom';
13
8
  // Registers core's version with the DOM runtime, which does the stamping. This entry is a
14
- // separate subpath, so it does not otherwise load core's render and without this the
9
+ // separate subpath, so it does not otherwise load core's render, and without this the
15
10
  // hydrate path stamped `fx-dom`/`fx-reactive` but never `fluixi`.
16
11
  import '../render/versions.js';
17
12
  import { deserializeHydrationData, setHydrating, cleanupHydration, } from '../server/hydration.js';
@@ -21,14 +16,11 @@ import { createMemo } from '@fluixi/reactive/signal';
21
16
  import { createHead, setActiveHead, mountHead, stripHeadMarker } from '@fluixi/head';
22
17
  // Connect the reactive system (signals, effects, batch) to the DOM runtime.
23
18
  // Without this, createRenderEffect in @fluixi/dom is a one-shot call that never
24
- // re-runs when signals change breaking all JSX reactive updates.
19
+ // re-runs when signals change: breaking all JSX reactive updates.
25
20
  // ensureIntegration();
26
21
  /**
27
22
  * Mount application to DOM (Client-side Rendering)
28
23
  *
29
- * @param App Root component function
30
- * @param container DOM element to mount into
31
- *
32
24
  * @example
33
25
  * ```typescript
34
26
  * import { mount } from '@fluixi/core/client';
@@ -62,6 +54,21 @@ export { hydrate } from '@fluixi/dom';
62
54
  */
63
55
  /** The root, entered the way the compiler enters every other component. */
64
56
  const rootOf = (App) => createMemo(() => createComponent(App));
57
+ /**
58
+ * Mount or hydrate an app in the browser.
59
+ *
60
+ * Hydration is detected from the marker the server render leaves behind, so the same
61
+ * call works for a server-rendered page and a plain SPA. Pass `hydrate` to force it.
62
+ *
63
+ * Pass `routes` for a file-routed app. The chunks for the route matching the current URL
64
+ * are downloaded and awaited before hydrating, which is what lets each lazy route resolve
65
+ * synchronously and adopt the server's DOM rather than building a second copy beside it.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * await startClient(App, { root: '#app', routes });
70
+ * ```
71
+ */
65
72
  export async function startClient(App, options = {}) {
66
73
  const container = typeof options.root === 'string'
67
74
  ? document.querySelector(options.root)
@@ -70,27 +77,27 @@ export async function startClient(App, options = {}) {
70
77
  throw new Error(`[Fluixi] Mount container not found: ${options.root ?? '#app'}`);
71
78
  }
72
79
  // Hydrate when explicitly requested (`{ hydrate: true }`), when the server emits the
73
- // `__FLUIXI_HYDRATION__` marker, or with a route tree in hand when the mount root already
80
+ // `__FLUIXI_HYDRATION__` marker, or, with a route tree in hand, when the mount root already
74
81
  // holds server-rendered content. A non-empty root means SSR/SSG ran, so reuse that DOM instead
75
82
  // of clearing and re-rendering (which flashes). Auto-hydration is gated on `routes` because
76
83
  // hydrating an app with async lazy file-routes is only safe once those chunks are preloaded
77
- // (below) without the route tree we can't preload, so we fall back to the render() path. A
78
- // client-only app mounts into an empty `<div id="root">` (firstElementChild null) client render.
84
+ // (below): without the route tree we can't preload, so we fall back to the render() path. A
85
+ // client-only app mounts into an empty `<div id="root">` (firstElementChild null) -> client render.
79
86
  const hasServerDom = !!document.getElementById('__FLUIXI_HYDRATION__') ||
80
87
  (!!options.routes && container.firstElementChild != null);
81
88
  const shouldHydrate = options.hydrate ?? hasServerDom;
82
- // Active head registry for this document seo()/useHead() during the app render register here;
89
+ // Active head registry for this document: seo()/useHead() during the app render register here;
83
90
  // mountHead reconciles it into <head> after mount (reusing server tags by key) and keeps it live.
84
91
  const head = createHead();
85
92
  setActiveHead(head);
86
- // Drop a stray `<!--fh:…-->` head-transport comment if the server left one in the mount root
93
+ // Drop a stray `<!--fh:...-->` head-transport comment if the server left one in the mount root
87
94
  // (streaming / custom servers that don't lift it into <head>). It would otherwise be the cursor's
88
- // first node and strand hydration rebuilding the whole tree as a duplicate. Harmless no-op when
95
+ // first node and strand hydration: rebuilding the whole tree as a duplicate. Harmless no-op when
89
96
  // the server already extracted it (the supported adapter/prerender/dev paths do).
90
97
  stripHeadMarker(container);
91
98
  if (shouldHydrate) {
92
99
  // Preload the lazy chunk(s) for the current route so they resolve synchronously during the
93
- // hydration render the lazy boundary then adopts the server DOM in place instead of
100
+ // hydration render, the lazy boundary then adopts the server DOM in place instead of
94
101
  // resolving a tick later and rebuilding a duplicate. Dynamic import keeps the router out of
95
102
  // client-only bundles that never pass `routes`.
96
103
  if (options.routes && options.routes.length) {
@@ -105,7 +112,7 @@ export async function startClient(App, options = {}) {
105
112
  // application starts at whatever the root happened to render.
106
113
  domHydrate(rootOf(App), container);
107
114
  // Handlers are now wired (delegated $$listeners attach during the hydration
108
- // render) replay any events the user fired before hydration.
115
+ // render): replay any events the user fired before hydration.
109
116
  replayEvents();
110
117
  setTimeout(() => {
111
118
  setHydrating(false);
@@ -120,7 +127,7 @@ export async function startClient(App, options = {}) {
120
127
  /**
121
128
  * Replay events captured before hydration by the server's eventCaptureScript
122
129
  * (window.__FX_REPLAY__). Hydration REUSES the server DOM, so each recorded target
123
- * is still live re-dispatch a synthetic event on it so the app's delegated
130
+ * is still live: re-dispatch a synthetic event on it so the app's delegated
124
131
  * handlers fire. Discrete events only (click/input/change/submit/keydown). No-op
125
132
  * when the capture script wasn't emitted (no queue).
126
133
  */
@@ -1 +1,222 @@
1
- import{b as f,e as m,f as y}from"./chunk-SM4WHBOP.mjs";import{render as Z,hydrate as ee}from"@fluixi/dom";import{registerCoreVersion as L}from"@fluixi/dom";var b="1.0.0-alpha.83";import{stampVersions as h,warnOnVersionSkew as v,versions as le}from"@fluixi/dom";L(b);import{isServer as K}from"@fluixi/dom";import{createRoot as J}from"@fluixi/reactive/signal";import{isDOMNode as vt,delegateEvents as Q,insert as G}from"@fluixi/dom";import{isServer as me}from"@fluixi/dom";import{createComponent as O,asComponent as he}from"@fluixi/dom";import{untrack as xe,onCleanup as R,getOwner as _,createEffect as A,createMemo as P,createSignal as Se,isSignal as Ce,batch as M,runWithOwner as F,isOwnerDisposed as Ee}from"@fluixi/reactive/signal";function d(t,e){return O(t,e)}import{createSignal as D,createMemo as H,createEffect as Fe,createRenderEffect as j,isSignal as w,readChildren as I,useContext as $,createContext as N,createSuspenseBoundary as U,provideSuspense as x}from"@fluixi/reactive/signal";import{asSuspense as V,isComponent as q,createComponent as X,runWithoutHydration as z}from"@fluixi/dom";function S(t){return!!(t&&typeof t=="object"&&typeof t.then=="function"||t instanceof Promise)}var W=N(void 0,"suspense-list");function l(t){return X(Y,t)}function Y(t){let e=U(),o=$(W),r=o?o.register(e.inFallback):void 0;function i(n){return n==null||typeof n=="boolean"?null:typeof n=="function"&&q(n)&&!w(n)?n():n}let s=z(()=>i(t.fallback??null)),a=x(e,()=>I(()=>t.children)),c=(n,u)=>{if(!(u>8))if(Array.isArray(n))for(let T of n)c(T,u+1);else typeof n=="function"&&w(n)&&c(n(),u+1)};x(e,()=>{j(()=>c(a,0))});let[E,k]=D(void 0),p=S(a);return p&&(e.increment(),a.then(n=>{k(()=>n),e.decrement()},()=>e.decrement())),H(()=>(r?r.showFallback():e.inFallback())?s:p?E():a)}V(l);Object.defineProperty(l,"__suspense",{value:!0,enumerable:!0});import{isServer as Ie}from"@fluixi/dom";import{createMemo as Ne,createSignal as Ue}from"@fluixi/reactive/signal";import{observeIntersection as qe}from"@fluixi/dom/utils";import{createResource as Ye}from"@fluixi/reactive/signal";function C(t,e,o={}){if(Q(["click","input","change","submit"]),K())throw new Error("render() is for client-side only. Use renderToString() on server.");if(!e)throw new Error("Container element is required");let r;return J(i=>{r=i;let s=typeof t=="function"?t():t;e.textContent="",h(e),v(),G(e,()=>s)}),()=>{r&&(r(),r=void 0)}}import{createMemo as te}from"@fluixi/reactive/signal";import{createHead as ne,setActiveHead as re,mountHead as oe,stripHeadMarker as ie}from"@fluixi/head";import{hydrate as jt}from"@fluixi/dom";function Mt(t,e){if(!e)throw new Error("Container element not found for mount()");Z(()=>t(),e)}var g=t=>te(()=>d(t));async function Ft(t,e={}){let o=typeof e.root=="string"?document.querySelector(e.root):e.root??document.querySelector("#app");if(!o)throw new Error(`[Fluixi] Mount container not found: ${e.root??"#app"}`);let r=!!document.getElementById("__FLUIXI_HYDRATION__")||!!e.routes&&o.firstElementChild!=null,i=e.hydrate??r,s=ne();if(re(s),ie(o),i){if(e.routes&&e.routes.length){let{preloadRoutes:a}=await import("./router-IBD4WPQT.mjs");await a(e.routes,window.location.pathname)}m(),f(!0),ee(g(t),o),se(),setTimeout(()=>{f(!1),y()},100)}else C(g(t),o);oe(s)}function se(){if(typeof window>"u")return;let t=window;typeof t.__FX_REPLAY_STOP__=="function"&&t.__FX_REPLAY_STOP__();let e=t.__FX_REPLAY__;if(t.__FX_REPLAY__=void 0,t.__FX_REPLAY_STOP__=void 0,!(!Array.isArray(e)||e.length===0))for(let o of e){let r=o&&o.target;if(!r||r.isConnected===!1||typeof r.dispatchEvent!="function")continue;let i=o.type,s=i==="click"?new MouseEvent(i,{bubbles:!0,cancelable:!0}):new Event(i,{bubbles:!0,cancelable:!0});r.dispatchEvent(s)}}export{jt as hydrate,Mt as mount,Ft as startClient};
1
+ /*! @fluixi/core v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+ import {
3
+ cleanupHydration,
4
+ deserializeHydrationData,
5
+ setHydrating
6
+ } from "./chunk-2C2KDDQV.mjs";
7
+
8
+ // src/lib/client/index.ts
9
+ import {
10
+ render as domRender,
11
+ hydrate as domHydrate
12
+ } from "@fluixi/dom";
13
+
14
+ // src/lib/render/versions.ts
15
+ import { registerCoreVersion } from "@fluixi/dom";
16
+
17
+ // src/version.generated.ts
18
+ var VERSION = "1.0.0-alpha.84";
19
+
20
+ // src/lib/render/versions.ts
21
+ import { stampVersions, warnOnVersionSkew, versions } from "@fluixi/dom";
22
+ registerCoreVersion(VERSION);
23
+
24
+ // src/lib/render/index.ts
25
+ import { isServer as isServer3 } from "@fluixi/dom";
26
+ import { createRoot as createRoot2 } from "@fluixi/reactive/signal";
27
+ import {
28
+ isDOMNode,
29
+ delegateEvents,
30
+ insert
31
+ } from "@fluixi/dom";
32
+
33
+ // src/lib/render/component.ts
34
+ import { isServer } from "@fluixi/dom";
35
+ import {
36
+ createComponent as domCreateComponent,
37
+ asComponent
38
+ } from "@fluixi/dom";
39
+ import {
40
+ untrack,
41
+ onCleanup,
42
+ getOwner,
43
+ createEffect,
44
+ createMemo,
45
+ createSignal,
46
+ isSignal,
47
+ batch,
48
+ runWithOwner,
49
+ isOwnerDisposed
50
+ } from "@fluixi/reactive/signal";
51
+ function createComponent(Comp, props) {
52
+ return domCreateComponent(Comp, props);
53
+ }
54
+
55
+ // src/lib/render/suspense.ts
56
+ import {
57
+ createSignal as createSignal2,
58
+ createMemo as createMemo2,
59
+ createEffect as createEffect2,
60
+ createRenderEffect as createRenderEffect2,
61
+ isSignal as isSignal2,
62
+ readChildren,
63
+ useContext as useContext2,
64
+ createContext as createContext2,
65
+ createSuspenseBoundary,
66
+ provideSuspense
67
+ } from "@fluixi/reactive/signal";
68
+ import {
69
+ asSuspense,
70
+ isComponent,
71
+ createComponent as createComponent2,
72
+ runWithoutHydration
73
+ } from "@fluixi/dom";
74
+ function isPromise(value) {
75
+ return !!(value && typeof value === "object" && typeof value.then === "function" || value instanceof Promise);
76
+ }
77
+ var SuspenseListContext = createContext2(void 0, "suspense-list");
78
+ function Suspense(props) {
79
+ return createComponent2(SuspenseImpl, props);
80
+ }
81
+ function SuspenseImpl(props) {
82
+ const boundary = createSuspenseBoundary();
83
+ const listCtx = useContext2(SuspenseListContext);
84
+ const listState = listCtx ? listCtx.register(boundary.inFallback) : void 0;
85
+ function instantiateOnce(val) {
86
+ if (val == null || typeof val === "boolean") return null;
87
+ if (typeof val === "function" && isComponent(val) && !isSignal2(val)) return val();
88
+ return val;
89
+ }
90
+ const fallback = runWithoutHydration(() => instantiateOnce(props.fallback ?? null));
91
+ const children = provideSuspense(boundary, () => readChildren(() => props.children));
92
+ const track = (value, depth) => {
93
+ if (depth > 8) return;
94
+ if (Array.isArray(value)) {
95
+ for (const x of value) track(x, depth + 1);
96
+ } else if (typeof value === "function" && isSignal2(value)) {
97
+ track(value(), depth + 1);
98
+ }
99
+ };
100
+ provideSuspense(boundary, () => {
101
+ createRenderEffect2(() => track(children, 0));
102
+ });
103
+ const [resolved, setResolved] = createSignal2(void 0);
104
+ const childIsPromise = isPromise(children);
105
+ if (childIsPromise) {
106
+ boundary.increment();
107
+ children.then(
108
+ (v) => {
109
+ setResolved(() => v);
110
+ boundary.decrement();
111
+ },
112
+ () => boundary.decrement()
113
+ );
114
+ }
115
+ return createMemo2(() => {
116
+ const showFallback = listState ? listState.showFallback() : boundary.inFallback();
117
+ if (showFallback) return fallback;
118
+ if (childIsPromise) return resolved();
119
+ return children;
120
+ });
121
+ }
122
+ asSuspense(Suspense);
123
+ Object.defineProperty(Suspense, "__suspense", { value: true, enumerable: true });
124
+
125
+ // src/lib/render/deferred.ts
126
+ import { isServer as isServer2 } from "@fluixi/dom";
127
+ import { createMemo as createMemo3, createSignal as createSignal3 } from "@fluixi/reactive/signal";
128
+ import { observeIntersection } from "@fluixi/dom/utils";
129
+
130
+ // src/lib/render/await.ts
131
+ import { createResource as createResource2 } from "@fluixi/reactive/signal";
132
+
133
+ // src/lib/render/index.ts
134
+ function render(code, container, options = {}) {
135
+ delegateEvents(["click", "input", "change", "submit"]);
136
+ if (isServer3()) {
137
+ throw new Error(
138
+ "render() is for client-side only. Use renderToString() on server."
139
+ );
140
+ }
141
+ if (!container) {
142
+ throw new Error("Container element is required");
143
+ }
144
+ let disposer;
145
+ createRoot2((dispose) => {
146
+ disposer = dispose;
147
+ const result = typeof code === "function" ? code() : code;
148
+ container.textContent = "";
149
+ stampVersions(container);
150
+ warnOnVersionSkew();
151
+ insert(container, () => result);
152
+ });
153
+ return () => {
154
+ if (disposer) {
155
+ disposer();
156
+ disposer = void 0;
157
+ }
158
+ };
159
+ }
160
+
161
+ // src/lib/client/index.ts
162
+ import { createMemo as createMemo4 } from "@fluixi/reactive/signal";
163
+ import { createHead, setActiveHead, mountHead, stripHeadMarker } from "@fluixi/head";
164
+ import { hydrate } from "@fluixi/dom";
165
+ function mount(App, container) {
166
+ if (!container) {
167
+ throw new Error("Container element not found for mount()");
168
+ }
169
+ domRender(() => App(), container);
170
+ }
171
+ var rootOf = (App) => createMemo4(() => createComponent(App));
172
+ async function startClient(App, options = {}) {
173
+ const container = typeof options.root === "string" ? document.querySelector(options.root) : options.root ?? document.querySelector("#app");
174
+ if (!container) {
175
+ throw new Error(
176
+ `[Fluixi] Mount container not found: ${options.root ?? "#app"}`
177
+ );
178
+ }
179
+ const hasServerDom = !!document.getElementById("__FLUIXI_HYDRATION__") || !!options.routes && container.firstElementChild != null;
180
+ const shouldHydrate = options.hydrate ?? hasServerDom;
181
+ const head = createHead();
182
+ setActiveHead(head);
183
+ stripHeadMarker(container);
184
+ if (shouldHydrate) {
185
+ if (options.routes && options.routes.length) {
186
+ const { preloadRoutes } = await import("./router-X526HSWQ.mjs");
187
+ await preloadRoutes(options.routes, window.location.pathname);
188
+ }
189
+ deserializeHydrationData();
190
+ setHydrating(true);
191
+ domHydrate(rootOf(App), container);
192
+ replayEvents();
193
+ setTimeout(() => {
194
+ setHydrating(false);
195
+ cleanupHydration();
196
+ }, 100);
197
+ } else {
198
+ render(rootOf(App), container);
199
+ }
200
+ mountHead(head);
201
+ }
202
+ function replayEvents() {
203
+ if (typeof window === "undefined") return;
204
+ const w = window;
205
+ if (typeof w.__FX_REPLAY_STOP__ === "function") w.__FX_REPLAY_STOP__();
206
+ const queue = w.__FX_REPLAY__;
207
+ w.__FX_REPLAY__ = void 0;
208
+ w.__FX_REPLAY_STOP__ = void 0;
209
+ if (!Array.isArray(queue) || queue.length === 0) return;
210
+ for (const rec of queue) {
211
+ const target = rec && rec.target;
212
+ if (!target || target.isConnected === false || typeof target.dispatchEvent !== "function") continue;
213
+ const type = rec.type;
214
+ const ev = type === "click" ? new MouseEvent(type, { bubbles: true, cancelable: true }) : new Event(type, { bubbles: true, cancelable: true });
215
+ target.dispatchEvent(ev);
216
+ }
217
+ }
218
+ export {
219
+ hydrate,
220
+ mount,
221
+ startClient
222
+ };