@fluixi/core 1.0.0-alpha.82 → 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 (179) 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 +10 -14
  26. package/dist/src/lib/client/index.d.ts.map +1 -1
  27. package/dist/src/lib/client/index.js +36 -21
  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 +20 -38
  32. package/dist/src/lib/context/context.d.ts.map +1 -1
  33. package/dist/src/lib/context/context.js +10 -47
  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 +7 -8
  46. package/dist/src/lib/env/index.d.ts.map +1 -1
  47. package/dist/src/lib/env/index.js +14 -9
  48. package/dist/src/lib/env/index.mjs +39 -1
  49. package/dist/src/lib/i18n/index.cjs +108 -1
  50. package/dist/src/lib/i18n/index.d.ts +31 -10
  51. package/dist/src/lib/i18n/index.d.ts.map +1 -1
  52. package/dist/src/lib/i18n/index.js +31 -10
  53. package/dist/src/lib/i18n/index.mjs +88 -1
  54. package/dist/src/lib/index.cjs +633 -1
  55. package/dist/src/lib/index.d.ts +0 -2
  56. package/dist/src/lib/index.d.ts.map +1 -1
  57. package/dist/src/lib/index.js +5 -11
  58. package/dist/src/lib/index.mjs +721 -1
  59. package/dist/src/lib/isomorphic.cjs +85 -1
  60. package/dist/src/lib/isomorphic.d.ts +41 -8
  61. package/dist/src/lib/isomorphic.d.ts.map +1 -1
  62. package/dist/src/lib/isomorphic.js +38 -5
  63. package/dist/src/lib/isomorphic.mjs +64 -1
  64. package/dist/src/lib/jsx-runtime/index.cjs +21 -1
  65. package/dist/src/lib/jsx-runtime/index.d.ts +1 -1
  66. package/dist/src/lib/jsx-runtime/index.js +1 -11
  67. package/dist/src/lib/jsx-runtime/index.mjs +4 -1
  68. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.cjs +21 -1
  69. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.mjs +4 -1
  70. package/dist/src/lib/plugins/fluixi-routes-plugin.cjs +302 -8
  71. package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts +15 -1
  72. package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts.map +1 -1
  73. package/dist/src/lib/plugins/fluixi-routes-plugin.js +19 -5
  74. package/dist/src/lib/plugins/fluixi-routes-plugin.mjs +271 -8
  75. package/dist/src/lib/plugins/index.cjs +311 -8
  76. package/dist/src/lib/plugins/index.mjs +279 -8
  77. package/dist/src/lib/plugins/route-codegen.cjs +73 -8
  78. package/dist/src/lib/plugins/route-codegen.d.ts +0 -1
  79. package/dist/src/lib/plugins/route-codegen.d.ts.map +1 -1
  80. package/dist/src/lib/plugins/route-codegen.js +4 -5
  81. package/dist/src/lib/plugins/route-codegen.mjs +52 -8
  82. package/dist/src/lib/plugins/route-scanner.cjs +189 -1
  83. package/dist/src/lib/plugins/route-scanner.d.ts +1 -2
  84. package/dist/src/lib/plugins/route-scanner.d.ts.map +1 -1
  85. package/dist/src/lib/plugins/route-scanner.js +7 -8
  86. package/dist/src/lib/plugins/route-scanner.mjs +158 -1
  87. package/dist/src/lib/plugins/vite.cjs +27 -1
  88. package/dist/src/lib/plugins/vite.mjs +6 -1
  89. package/dist/src/lib/render/await.cjs +38 -1
  90. package/dist/src/lib/render/await.d.ts +18 -0
  91. package/dist/src/lib/render/await.d.ts.map +1 -1
  92. package/dist/src/lib/render/await.js +20 -2
  93. package/dist/src/lib/render/await.mjs +17 -1
  94. package/dist/src/lib/render/component.cjs +221 -1
  95. package/dist/src/lib/render/component.d.ts +3 -44
  96. package/dist/src/lib/render/component.d.ts.map +1 -1
  97. package/dist/src/lib/render/component.js +32 -59
  98. package/dist/src/lib/render/component.mjs +214 -1
  99. package/dist/src/lib/render/deferred.cjs +175 -1
  100. package/dist/src/lib/render/deferred.d.ts.map +1 -1
  101. package/dist/src/lib/render/deferred.js +8 -8
  102. package/dist/src/lib/render/deferred.mjs +158 -1
  103. package/dist/src/lib/render/index.cjs +573 -1
  104. package/dist/src/lib/render/index.d.ts +3 -17
  105. package/dist/src/lib/render/index.d.ts.map +1 -1
  106. package/dist/src/lib/render/index.js +12 -26
  107. package/dist/src/lib/render/index.mjs +590 -1
  108. package/dist/src/lib/render/lazy.cjs +67 -1
  109. package/dist/src/lib/render/lazy.d.ts +22 -1
  110. package/dist/src/lib/render/lazy.d.ts.map +1 -1
  111. package/dist/src/lib/render/lazy.js +47 -8
  112. package/dist/src/lib/render/lazy.mjs +50 -1
  113. package/dist/src/lib/render/suspense.cjs +141 -1
  114. package/dist/src/lib/render/suspense.d.ts +40 -0
  115. package/dist/src/lib/render/suspense.d.ts.map +1 -1
  116. package/dist/src/lib/render/suspense.js +47 -7
  117. package/dist/src/lib/render/suspense.mjs +136 -1
  118. package/dist/src/lib/render/versions.cjs +35 -1
  119. package/dist/src/lib/render/versions.js +6 -6
  120. package/dist/src/lib/render/versions.mjs +14 -1
  121. package/dist/src/lib/router/data.cjs +230 -1
  122. package/dist/src/lib/router/data.d.ts +1 -13
  123. package/dist/src/lib/router/data.d.ts.map +1 -1
  124. package/dist/src/lib/router/data.js +1 -13
  125. package/dist/src/lib/router/data.mjs +214 -1
  126. package/dist/src/lib/router/index.cjs +627 -1
  127. package/dist/src/lib/router/index.d.ts +62 -10
  128. package/dist/src/lib/router/index.d.ts.map +1 -1
  129. package/dist/src/lib/router/index.js +90 -39
  130. package/dist/src/lib/router/index.mjs +639 -1
  131. package/dist/src/lib/server/hydration.cjs +169 -1
  132. package/dist/src/lib/server/hydration.d.ts +15 -55
  133. package/dist/src/lib/server/hydration.d.ts.map +1 -1
  134. package/dist/src/lib/server/hydration.js +23 -62
  135. package/dist/src/lib/server/hydration.mjs +148 -1
  136. package/dist/src/lib/server/index.cjs +401 -11
  137. package/dist/src/lib/server/index.d.ts +30 -6
  138. package/dist/src/lib/server/index.d.ts.map +1 -1
  139. package/dist/src/lib/server/index.js +34 -11
  140. package/dist/src/lib/server/index.mjs +379 -11
  141. package/dist/src/lib/server/reactive.cjs +197 -1
  142. package/dist/src/lib/server/reactive.d.ts +18 -77
  143. package/dist/src/lib/server/reactive.d.ts.map +1 -1
  144. package/dist/src/lib/server/reactive.js +19 -78
  145. package/dist/src/lib/server/reactive.mjs +176 -1
  146. package/dist/src/lib/theme/index.cjs +110 -1
  147. package/dist/src/lib/theme/index.d.ts +19 -4
  148. package/dist/src/lib/theme/index.d.ts.map +1 -1
  149. package/dist/src/lib/theme/index.js +17 -2
  150. package/dist/src/lib/theme/index.mjs +89 -1
  151. package/dist/src/lib/utils/index.cjs +209 -1
  152. package/dist/src/lib/utils/index.d.ts +0 -93
  153. package/dist/src/lib/utils/index.d.ts.map +1 -1
  154. package/dist/src/lib/utils/index.js +0 -93
  155. package/dist/src/lib/utils/index.mjs +188 -1
  156. package/dist/src/routes.cjs +37 -1
  157. package/dist/src/routes.d.ts +1 -1
  158. package/dist/src/routes.js +2 -2
  159. package/dist/src/routes.mjs +17 -1
  160. package/dist/src/server.cjs +400 -11
  161. package/dist/src/server.d.ts +0 -1
  162. package/dist/src/server.d.ts.map +1 -1
  163. package/dist/src/server.js +0 -1
  164. package/dist/src/server.mjs +377 -11
  165. package/dist/src/utils.cjs +21 -1
  166. package/dist/src/utils.d.ts +1 -1
  167. package/dist/src/utils.js +1 -1
  168. package/dist/src/utils.mjs +4 -1
  169. package/dist/src/version.generated.cjs +26 -1
  170. package/dist/src/version.generated.d.ts +1 -1
  171. package/dist/src/version.generated.js +2 -2
  172. package/dist/src/version.generated.mjs +5 -1
  173. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  174. package/package.json +17 -16
  175. package/src/index.ts +2 -14
  176. package/dist/src/cdn/chunk-RN7C7HNS.mjs +0 -1
  177. package/dist/src/cdn/router-QB3W43UQ.mjs +0 -1
  178. package/dist/src/lib/client/chunk-FT22BLCQ.mjs +0 -1
  179. package/dist/src/lib/client/router-IH7JYMRU.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,27 +24,27 @@ 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
  }
39
35
  /**
40
- * Standard entry point for client-side rendering or hydration.
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.
41
40
  *
42
- * Auto-detects whether to hydrate (if server-rendered HTML is present)
43
- * or do a full client render.
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
44
  *
45
45
  * @example
46
46
  * ```ts
47
- * // entry-client.ts
48
- * import { startClient } from '@fluixi/core/client';
49
- * import App from './app';
50
- *
51
- * startClient(App);
47
+ * await startClient(App, { root: '#app', routes });
52
48
  * ```
53
49
  */
54
50
  export declare function startClient(App: (props?: any) => any, options?: StartClientOptions): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,OAAO,uBAAuB,CAAC;AAe/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;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,GAAG,EACzB,OAAO,GAAE,kBAAuB,iBA4DjC"}
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,32 +1,26 @@
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';
18
13
  import { render } from '../render/index.js';
14
+ import { createComponent } from '../render/component.js';
15
+ import { createMemo } from '@fluixi/reactive/signal';
19
16
  import { createHead, setActiveHead, mountHead, stripHeadMarker } from '@fluixi/head';
20
17
  // Connect the reactive system (signals, effects, batch) to the DOM runtime.
21
18
  // Without this, createRenderEffect in @fluixi/dom is a one-shot call that never
22
- // re-runs when signals change breaking all JSX reactive updates.
19
+ // re-runs when signals change: breaking all JSX reactive updates.
23
20
  // ensureIntegration();
24
21
  /**
25
22
  * Mount application to DOM (Client-side Rendering)
26
23
  *
27
- * @param App Root component function
28
- * @param container DOM element to mount into
29
- *
30
24
  * @example
31
25
  * ```typescript
32
26
  * import { mount } from '@fluixi/core/client';
@@ -58,6 +52,23 @@ export { hydrate } from '@fluixi/dom';
58
52
  * startClient(App);
59
53
  * ```
60
54
  */
55
+ /** The root, entered the way the compiler enters every other component. */
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
+ */
61
72
  export async function startClient(App, options = {}) {
62
73
  const container = typeof options.root === 'string'
63
74
  ? document.querySelector(options.root)
@@ -66,27 +77,27 @@ export async function startClient(App, options = {}) {
66
77
  throw new Error(`[Fluixi] Mount container not found: ${options.root ?? '#app'}`);
67
78
  }
68
79
  // Hydrate when explicitly requested (`{ hydrate: true }`), when the server emits the
69
- // `__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
70
81
  // holds server-rendered content. A non-empty root means SSR/SSG ran, so reuse that DOM instead
71
82
  // of clearing and re-rendering (which flashes). Auto-hydration is gated on `routes` because
72
83
  // hydrating an app with async lazy file-routes is only safe once those chunks are preloaded
73
- // (below) without the route tree we can't preload, so we fall back to the render() path. A
74
- // 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.
75
86
  const hasServerDom = !!document.getElementById('__FLUIXI_HYDRATION__') ||
76
87
  (!!options.routes && container.firstElementChild != null);
77
88
  const shouldHydrate = options.hydrate ?? hasServerDom;
78
- // 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;
79
90
  // mountHead reconciles it into <head> after mount (reusing server tags by key) and keeps it live.
80
91
  const head = createHead();
81
92
  setActiveHead(head);
82
- // 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
83
94
  // (streaming / custom servers that don't lift it into <head>). It would otherwise be the cursor's
84
- // 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
85
96
  // the server already extracted it (the supported adapter/prerender/dev paths do).
86
97
  stripHeadMarker(container);
87
98
  if (shouldHydrate) {
88
99
  // Preload the lazy chunk(s) for the current route so they resolve synchronously during the
89
- // 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
90
101
  // resolving a tick later and rebuilding a duplicate. Dynamic import keeps the router out of
91
102
  // client-only bundles that never pass `routes`.
92
103
  if (options.routes && options.routes.length) {
@@ -95,9 +106,13 @@ export async function startClient(App, options = {}) {
95
106
  }
96
107
  deserializeHydrationData();
97
108
  setHydrating(true);
98
- domHydrate(() => App(), container);
109
+ // A memo around createComponent, which is what compiled JSX emits for every other
110
+ // component. Called directly, the root is the one component the runtime never hears
111
+ // about: nothing holds its return value, so no node is made and a graph of the
112
+ // application starts at whatever the root happened to render.
113
+ domHydrate(rootOf(App), container);
99
114
  // Handlers are now wired (delegated $$listeners attach during the hydration
100
- // render) replay any events the user fired before hydration.
115
+ // render): replay any events the user fired before hydration.
101
116
  replayEvents();
102
117
  setTimeout(() => {
103
118
  setHydrating(false);
@@ -105,14 +120,14 @@ export async function startClient(App, options = {}) {
105
120
  }, 100);
106
121
  }
107
122
  else {
108
- render(() => App(), container);
123
+ render(rootOf(App), container);
109
124
  }
110
125
  mountHead(head);
111
126
  }
112
127
  /**
113
128
  * Replay events captured before hydration by the server's eventCaptureScript
114
129
  * (window.__FX_REPLAY__). Hydration REUSES the server DOM, so each recorded target
115
- * 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
116
131
  * handlers fire. Discrete events only (click/input/change/submit/keydown). No-op
117
132
  * when the capture script wasn't emitted (no queue).
118
133
  */
@@ -1 +1,222 @@
1
- import{b as f,e as p,f as y}from"./chunk-FT22BLCQ.mjs";import{render as J,hydrate as Q}from"@fluixi/dom";import{registerCoreVersion as k}from"@fluixi/dom";var m="1.0.0-alpha.82";import{stampVersions as h,warnOnVersionSkew as b,versions as ce}from"@fluixi/dom";k(m);import{createRoot as W}from"@fluixi/reactive/signal";import{isDOMNode as dt,delegateEvents as Y,insert as B}from"@fluixi/dom";import{createComponent as de,asComponent as le}from"@fluixi/dom";import{untrack as me,onCleanup as T,getOwner as L,createEffect as O,createMemo as R,createSignal as he,isSignal as be,batch as _,runWithOwner as A,isOwnerDisposed as ve}from"@fluixi/reactive/signal";import{createSignal as P,createMemo as M,createEffect as Re,createRenderEffect as F,isSignal as w,readChildren as D,useContext as H,createContext as j,createSuspenseBoundary as I,provideSuspense as v}from"@fluixi/reactive/signal";import{asSuspense as $,isComponent as N,createComponent as U,runWithoutHydration as V}from"@fluixi/dom";function x(t){return!!(t&&typeof t=="object"&&typeof t.then=="function"||t instanceof Promise)}var q=j();function d(t){return U(X,t)}function X(t){let e=I(),o=H(q),r=o?o.register(e.inFallback):void 0;function i(n){return n==null||typeof n=="boolean"?null:typeof n=="function"&&N(n)&&!w(n)?n():n}let s=V(()=>i(t.fallback??null)),a=v(e,()=>D(()=>t.children)),c=(n,u)=>{if(!(u>8))if(Array.isArray(n))for(let E of n)c(E,u+1);else typeof n=="function"&&w(n)&&c(n(),u+1)};v(e,()=>{F(()=>c(a,0))});let[C,g]=P(void 0),l=x(a);return l&&(e.increment(),a.then(n=>{g(()=>n),e.decrement()},()=>e.decrement())),M(()=>(r?r.showFallback():e.inFallback())?s:l?C():a)}$(d);Object.defineProperty(d,"__suspense",{value:!0,enumerable:!0});import{createMemo as Me,createSignal as Fe}from"@fluixi/reactive/signal";import{observeIntersection as He}from"@fluixi/dom/utils";import{createResource as Ne}from"@fluixi/reactive/signal";var K=typeof window>"u";function S(t,e,o={}){if(Y(["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 W(i=>{r=i;let s=typeof t=="function"?t():t;e.textContent="",h(e),b(),B(e,()=>s)}),()=>{r&&(r(),r=void 0)}}import{createHead as G,setActiveHead as Z,mountHead as ee,stripHeadMarker as te}from"@fluixi/head";import{hydrate as Lt}from"@fluixi/dom";function gt(t,e){if(!e)throw new Error("Container element not found for mount()");J(()=>t(),e)}async function Et(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=G();if(Z(s),te(o),i){if(e.routes&&e.routes.length){let{preloadRoutes:a}=await import("./router-IH7JYMRU.mjs");await a(e.routes,window.location.pathname)}p(),f(!0),Q(()=>t(),o),ne(),setTimeout(()=>{f(!1),y()},100)}else S(()=>t(),o);ee(s)}function ne(){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{Lt as hydrate,gt as mount,Et 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
+ };