@fluixi/core 1.0.0-alpha.92 → 1.0.0-alpha.93

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 (113) hide show
  1. package/dist/cdn/core.global.js +2 -2
  2. package/dist/src/cdn/{chunk-MDJLC3PE.mjs → chunk-7XM7Q5VR.mjs} +271 -229
  3. package/dist/src/cdn/core.cjs +360 -253
  4. package/dist/src/cdn/core.mjs +92 -20
  5. package/dist/src/cdn/{router-JYFZP3EZ.mjs → router-VOY43YNM.mjs} +7 -3
  6. package/dist/src/index.cjs +547 -232
  7. package/dist/src/index.mjs +547 -223
  8. package/dist/src/lib/client/chunk-QT3RFKH6.mjs +53 -0
  9. package/dist/src/lib/client/index.cjs +310 -176
  10. package/dist/src/lib/client/index.d.ts.map +1 -1
  11. package/dist/src/lib/client/index.js +33 -18
  12. package/dist/src/lib/client/index.mjs +86 -15
  13. package/dist/src/lib/client/{router-PHLUYVQU.mjs → router-ADTS55OP.mjs} +244 -99
  14. package/dist/src/lib/context/context.cjs +35 -72
  15. package/dist/src/lib/context/context.d.ts +45 -291
  16. package/dist/src/lib/context/context.d.ts.map +1 -1
  17. package/dist/src/lib/context/context.js +65 -397
  18. package/dist/src/lib/context/context.mjs +38 -73
  19. package/dist/src/lib/context/index.cjs +35 -72
  20. package/dist/src/lib/context/index.d.ts +2 -2
  21. package/dist/src/lib/context/index.d.ts.map +1 -1
  22. package/dist/src/lib/context/index.js +1 -5
  23. package/dist/src/lib/context/index.mjs +38 -73
  24. package/dist/src/lib/core.cjs +546 -231
  25. package/dist/src/lib/core.d.ts +3 -1
  26. package/dist/src/lib/core.d.ts.map +1 -1
  27. package/dist/src/lib/core.js +5 -3
  28. package/dist/src/lib/core.mjs +546 -222
  29. package/dist/src/lib/env/index.cjs +1 -17
  30. package/dist/src/lib/env/index.d.ts +2 -14
  31. package/dist/src/lib/env/index.d.ts.map +1 -1
  32. package/dist/src/lib/env/index.js +2 -26
  33. package/dist/src/lib/env/index.mjs +1 -17
  34. package/dist/src/lib/i18n/index.cjs +17 -2
  35. package/dist/src/lib/i18n/index.d.ts +10 -0
  36. package/dist/src/lib/i18n/index.d.ts.map +1 -1
  37. package/dist/src/lib/i18n/index.js +17 -1
  38. package/dist/src/lib/i18n/index.mjs +17 -2
  39. package/dist/src/lib/index.cjs +64 -99
  40. package/dist/src/lib/index.mjs +43 -76
  41. package/dist/src/lib/isomorphic.cjs +9 -4
  42. package/dist/src/lib/isomorphic.d.ts +9 -2
  43. package/dist/src/lib/isomorphic.d.ts.map +1 -1
  44. package/dist/src/lib/isomorphic.js +11 -4
  45. package/dist/src/lib/isomorphic.mjs +9 -4
  46. package/dist/src/lib/jsx-runtime/index.cjs +1 -1
  47. package/dist/src/lib/jsx-runtime/index.mjs +1 -1
  48. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.cjs +1 -1
  49. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.mjs +1 -1
  50. package/dist/src/lib/plugins/fluixi-routes-plugin.cjs +2 -2
  51. package/dist/src/lib/plugins/fluixi-routes-plugin.mjs +2 -2
  52. package/dist/src/lib/plugins/index.cjs +3 -3
  53. package/dist/src/lib/plugins/index.mjs +3 -3
  54. package/dist/src/lib/plugins/route-codegen.cjs +2 -2
  55. package/dist/src/lib/plugins/route-codegen.js +1 -1
  56. package/dist/src/lib/plugins/route-codegen.mjs +2 -2
  57. package/dist/src/lib/render/index.cjs +1 -1
  58. package/dist/src/lib/render/index.mjs +1 -1
  59. package/dist/src/lib/render/versions.cjs +1 -1
  60. package/dist/src/lib/render/versions.mjs +1 -1
  61. package/dist/src/lib/router/data.cjs +113 -115
  62. package/dist/src/lib/router/data.d.ts +63 -10
  63. package/dist/src/lib/router/data.d.ts.map +1 -1
  64. package/dist/src/lib/router/data.js +158 -68
  65. package/dist/src/lib/router/data.mjs +112 -112
  66. package/dist/src/lib/router/index.cjs +260 -163
  67. package/dist/src/lib/router/index.d.ts +22 -2
  68. package/dist/src/lib/router/index.d.ts.map +1 -1
  69. package/dist/src/lib/router/index.js +165 -22
  70. package/dist/src/lib/router/index.mjs +244 -143
  71. package/dist/src/lib/server/index.cjs +1 -1
  72. package/dist/src/lib/server/index.mjs +1 -1
  73. package/dist/src/lib/storage/cache.cjs +51 -0
  74. package/dist/src/lib/storage/cache.d.ts +18 -0
  75. package/dist/src/lib/storage/cache.d.ts.map +1 -0
  76. package/dist/src/lib/storage/cache.js +42 -0
  77. package/dist/src/lib/storage/cache.mjs +30 -0
  78. package/dist/src/lib/storage/index.cjs +246 -0
  79. package/dist/src/lib/storage/index.d.ts +83 -0
  80. package/dist/src/lib/storage/index.d.ts.map +1 -0
  81. package/dist/src/lib/storage/index.js +179 -0
  82. package/dist/src/lib/storage/index.mjs +231 -0
  83. package/dist/src/lib/storage/persisted.cjs +91 -0
  84. package/dist/src/lib/storage/persisted.d.ts +53 -0
  85. package/dist/src/lib/storage/persisted.d.ts.map +1 -0
  86. package/dist/src/lib/storage/persisted.js +75 -0
  87. package/dist/src/lib/storage/persisted.mjs +70 -0
  88. package/dist/src/lib/theme/color-scheme.cjs +281 -0
  89. package/dist/src/lib/theme/color-scheme.d.ts +61 -0
  90. package/dist/src/lib/theme/color-scheme.d.ts.map +1 -0
  91. package/dist/src/lib/theme/color-scheme.js +120 -0
  92. package/dist/src/lib/theme/color-scheme.mjs +265 -0
  93. package/dist/src/lib/theme/index.cjs +194 -37
  94. package/dist/src/lib/theme/index.d.ts +23 -11
  95. package/dist/src/lib/theme/index.d.ts.map +1 -1
  96. package/dist/src/lib/theme/index.js +73 -32
  97. package/dist/src/lib/theme/index.mjs +197 -35
  98. package/dist/src/lib/theme/provider.cjs +346 -0
  99. package/dist/src/lib/theme/provider.d.ts +34 -0
  100. package/dist/src/lib/theme/provider.d.ts.map +1 -0
  101. package/dist/src/lib/theme/provider.js +60 -0
  102. package/dist/src/lib/theme/provider.mjs +332 -0
  103. package/dist/src/routes.cjs +1 -1
  104. package/dist/src/routes.mjs +1 -1
  105. package/dist/src/utils.cjs +1 -1
  106. package/dist/src/utils.mjs +1 -1
  107. package/dist/src/version.generated.cjs +1 -1
  108. package/dist/src/version.generated.d.ts +1 -1
  109. package/dist/src/version.generated.js +1 -1
  110. package/dist/src/version.generated.mjs +1 -1
  111. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  112. package/package.json +18 -11
  113. package/dist/src/lib/client/chunk-VB567ABU.mjs +0 -133
@@ -1 +1 @@
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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/client/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,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,iBA8EjC"}
@@ -4,7 +4,7 @@
4
4
  * Implements client-side mounting and hydration logic using @fluixi/dom runtime.
5
5
  * Supports both JSX and Lit HTML.
6
6
  */
7
- import { render as domRender, hydrate as domHydrate, } from '@fluixi/dom';
7
+ import { render as domRender, hydrate as domHydrate, beginAppHydration, endAppHydration, removeUnclaimedKeyed, clearHydrationKeys, } from '@fluixi/dom';
8
8
  // Registers core's version with the DOM runtime, which does the stamping. This entry is a
9
9
  // separate subpath, so it does not otherwise load core's render, and without this the
10
10
  // hydrate path stamped `fx-dom`/`fx-reactive` but never `fluixi`.
@@ -96,26 +96,41 @@ export async function startClient(App, options = {}) {
96
96
  // the server already extracted it (the supported adapter/prerender/dev paths do).
97
97
  stripHeadMarker(container);
98
98
  if (shouldHydrate) {
99
- // Preload the lazy chunk(s) for the current route so they resolve synchronously during the
100
- // hydration render, the lazy boundary then adopts the server DOM in place instead of
101
- // resolving a tick later and rebuilding a duplicate. Dynamic import keeps the router out of
102
- // client-only bundles that never pass `routes`.
103
- if (options.routes && options.routes.length) {
104
- const { preloadRoutes } = await import('../router/index.js');
105
- await preloadRoutes(options.routes, window.location.pathname);
99
+ // Before the first await: custom elements the server rendered upgrade while the route
100
+ // chunks load, and wait for this hydration to hand them their owner.
101
+ beginAppHydration();
102
+ try {
103
+ // Preload the lazy chunk(s) for the current route so they resolve synchronously during the
104
+ // hydration render, the lazy boundary then adopts the server DOM in place instead of
105
+ // resolving a tick later and rebuilding a duplicate. Dynamic import keeps the router out of
106
+ // client-only bundles that never pass `routes`.
107
+ if (options.routes && options.routes.length) {
108
+ const { preloadRoutes } = await import('../router/index.js');
109
+ await preloadRoutes(options.routes, window.location.pathname);
110
+ }
111
+ deserializeHydrationData();
112
+ setHydrating(true);
113
+ // A memo around createComponent, which is what compiled JSX emits for every other
114
+ // component. Called directly, the root is the one component the runtime never hears
115
+ // about: nothing holds its return value, so no node is made and a graph of the
116
+ // application starts at whatever the root happened to render.
117
+ domHydrate(rootOf(App), container);
118
+ // Handlers are now wired (delegated $$listeners attach during the hydration
119
+ // render): replay any events the user fired before hydration.
120
+ replayEvents();
121
+ }
122
+ finally {
123
+ endAppHydration();
106
124
  }
107
- deserializeHydrationData();
108
- setHydrating(true);
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);
114
- // Handlers are now wired (delegated $$listeners attach during the hydration
115
- // render): replay any events the user fired before hydration.
116
- replayEvents();
117
125
  setTimeout(() => {
118
126
  setHydrating(false);
127
+ // Late route chunks have had their chance to claim their markup: what nothing claimed
128
+ // is server output the client did not render, or rendered differently.
129
+ const removed = removeUnclaimedKeyed(container);
130
+ if (removed && typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production') {
131
+ console.warn(`[fluixi] hydration: removed ${removed} server element(s) the client did not render. Check for markup that depends on client-only state.`);
132
+ }
133
+ clearHydrationKeys();
119
134
  cleanupHydration();
120
135
  }, 100);
121
136
  }
@@ -1,26 +1,87 @@
1
- /*! @fluixi/core v1.0.0-alpha.92 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
- import {
3
- cleanupHydration,
4
- deserializeHydrationData,
5
- setHydrating
6
- } from "./chunk-VB567ABU.mjs";
1
+ /*! @fluixi/core v1.0.0-alpha.93 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+ import "./chunk-QT3RFKH6.mjs";
7
3
 
8
4
  // src/lib/client/index.ts
9
5
  import {
10
6
  render as domRender,
11
- hydrate as domHydrate
7
+ hydrate as domHydrate,
8
+ beginAppHydration,
9
+ endAppHydration,
10
+ removeUnclaimedKeyed,
11
+ clearHydrationKeys
12
12
  } from "@fluixi/dom";
13
13
 
14
14
  // src/lib/render/versions.ts
15
15
  import { registerCoreVersion } from "@fluixi/dom";
16
16
 
17
17
  // src/version.generated.ts
18
- var VERSION = "1.0.0-alpha.92";
18
+ var VERSION = "1.0.0-alpha.93";
19
19
 
20
20
  // src/lib/render/versions.ts
21
21
  import { stampVersions, warnOnVersionSkew, versions } from "@fluixi/dom";
22
22
  registerCoreVersion(VERSION);
23
23
 
24
+ // src/lib/server/hydration.ts
25
+ import { isServer as domIsServer } from "@fluixi/dom";
26
+ var hydrating = false;
27
+ var hydrationDataMap = /* @__PURE__ */ new Map();
28
+ function setHydrating(state) {
29
+ hydrating = state;
30
+ }
31
+ function clearHydrationData() {
32
+ hydrationDataMap.clear();
33
+ }
34
+ function deserializeHydrationData() {
35
+ if (typeof window === "undefined") {
36
+ return false;
37
+ }
38
+ const script = document.getElementById("__FLUIXI_HYDRATION__");
39
+ if (!script || script.getAttribute("type") !== "application/json") {
40
+ return false;
41
+ }
42
+ try {
43
+ const json = script.textContent || "{}";
44
+ const data = JSON.parse(json);
45
+ for (const [key, value] of Object.entries(data)) {
46
+ hydrationDataMap.set(key, value);
47
+ }
48
+ return true;
49
+ } catch (error) {
50
+ console.error("Failed to deserialize hydration data:", error);
51
+ return false;
52
+ }
53
+ }
54
+ function cleanupHydration() {
55
+ if (typeof window === "undefined") {
56
+ return;
57
+ }
58
+ const script = document.getElementById("__FLUIXI_HYDRATION__");
59
+ if (script) {
60
+ script.remove();
61
+ }
62
+ const walker = document.createTreeWalker(
63
+ document.body,
64
+ NodeFilter.SHOW_COMMENT,
65
+ null
66
+ );
67
+ const comments = [];
68
+ let node;
69
+ while (node = walker.nextNode()) {
70
+ const comment = node;
71
+ const text = comment.nodeValue || "";
72
+ if (text.startsWith("#") || text.startsWith("/")) {
73
+ comments.push(comment);
74
+ }
75
+ }
76
+ comments.forEach((comment) => comment.remove());
77
+ clearHydrationData();
78
+ }
79
+ if (typeof window !== "undefined") {
80
+ window.addEventListener("load", () => {
81
+ setTimeout(cleanupHydration, 100);
82
+ });
83
+ }
84
+
24
85
  // src/lib/render/index.ts
25
86
  import { isServer as isServer3 } from "@fluixi/dom";
26
87
  import { createRoot as createRoot2 } from "@fluixi/reactive/signal";
@@ -182,16 +243,26 @@ async function startClient(App, options = {}) {
182
243
  setActiveHead(head);
183
244
  stripHeadMarker(container);
184
245
  if (shouldHydrate) {
185
- if (options.routes && options.routes.length) {
186
- const { preloadRoutes } = await import("./router-PHLUYVQU.mjs");
187
- await preloadRoutes(options.routes, window.location.pathname);
246
+ beginAppHydration();
247
+ try {
248
+ if (options.routes && options.routes.length) {
249
+ const { preloadRoutes } = await import("./router-ADTS55OP.mjs");
250
+ await preloadRoutes(options.routes, window.location.pathname);
251
+ }
252
+ deserializeHydrationData();
253
+ setHydrating(true);
254
+ domHydrate(rootOf(App), container);
255
+ replayEvents();
256
+ } finally {
257
+ endAppHydration();
188
258
  }
189
- deserializeHydrationData();
190
- setHydrating(true);
191
- domHydrate(rootOf(App), container);
192
- replayEvents();
193
259
  setTimeout(() => {
194
260
  setHydrating(false);
261
+ const removed = removeUnclaimedKeyed(container);
262
+ if (removed && typeof process !== "undefined" && false) {
263
+ console.warn(`[fluixi] hydration: removed ${removed} server element(s) the client did not render. Check for markup that depends on client-only state.`);
264
+ }
265
+ clearHydrationKeys();
195
266
  cleanupHydration();
196
267
  }, 100);
197
268
  } else {