@constela/runtime 0.19.4 → 0.19.6

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.
package/dist/index.d.ts CHANGED
@@ -480,6 +480,13 @@ interface HMRHandlerOptions {
480
480
  program: CompiledProgram;
481
481
  /** Optional route context */
482
482
  route?: RouteContext;
483
+ /**
484
+ * Skip initial app creation (for hydration scenarios where hydrateApp handles initial render).
485
+ * When true, the HMR handler will NOT render the app on creation. The first handleUpdate()
486
+ * call will clear the container (removing SSR content) before rendering.
487
+ * @default false
488
+ */
489
+ skipInitialRender?: boolean;
483
490
  }
484
491
  /**
485
492
  * HMR Handler interface
package/dist/index.js CHANGED
@@ -15951,21 +15951,27 @@ function createHMRApp(program, container, route, existingStateStore) {
15951
15951
  };
15952
15952
  }
15953
15953
  function createHMRHandler(options) {
15954
- const { container, program, route } = options;
15954
+ const { container, program, route, skipInitialRender } = options;
15955
15955
  let currentApp = null;
15956
15956
  let destroyed = false;
15957
- currentApp = createHMRApp(program, container, route);
15957
+ if (!skipInitialRender) {
15958
+ currentApp = createHMRApp(program, container, route);
15959
+ }
15958
15960
  return {
15959
15961
  handleUpdate(newProgram) {
15960
15962
  if (destroyed) {
15961
15963
  return;
15962
15964
  }
15963
- let stateSnapshot = {};
15964
- if (currentApp) {
15965
- stateSnapshot = currentApp.stateStore.serialize();
15966
- currentApp.destroy();
15967
- currentApp = null;
15965
+ if (!currentApp) {
15966
+ while (container.firstChild) {
15967
+ container.removeChild(container.firstChild);
15968
+ }
15969
+ currentApp = createHMRApp(newProgram, container, route);
15970
+ return;
15968
15971
  }
15972
+ const stateSnapshot = currentApp.stateStore.serialize();
15973
+ currentApp.destroy();
15974
+ currentApp = null;
15969
15975
  const newStateStore = createStateStore(newProgram.state);
15970
15976
  const newDefinitions = Object.entries(newProgram.state).map(
15971
15977
  ([name, def]) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/runtime",
3
- "version": "0.19.4",
3
+ "version": "0.19.6",
4
4
  "description": "Runtime DOM renderer for Constela UI framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -18,8 +18,8 @@
18
18
  "dompurify": "^3.3.1",
19
19
  "marked": "^17.0.1",
20
20
  "shiki": "^3.20.0",
21
- "@constela/compiler": "0.14.5",
22
- "@constela/core": "0.16.0"
21
+ "@constela/compiler": "0.14.7",
22
+ "@constela/core": "0.16.2"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/dompurify": "^3.2.0",
@@ -29,10 +29,10 @@
29
29
  "tsup": "^8.0.0",
30
30
  "typescript": "^5.3.0",
31
31
  "vitest": "^2.0.0",
32
- "@constela/server": "12.0.0"
32
+ "@constela/server": "12.0.2"
33
33
  },
34
34
  "peerDependencies": {
35
- "@constela/ai": "1.0.0"
35
+ "@constela/ai": "1.0.2"
36
36
  },
37
37
  "peerDependenciesMeta": {
38
38
  "@constela/ai": {