@absolutejs/absolute 0.19.0-beta.1066 → 0.19.0-beta.1067

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.
@@ -282,6 +282,26 @@ export const handleSvelteUpdate = (message: {
282
282
  acceptFn(newModule);
283
283
  }
284
284
 
285
+ /* $.hmr_accept swaps component code in place but re-runs
286
+ * the <script> body with the original mount props, so any
287
+ * state seeded from a prop (e.g. a composable doing
288
+ * $state(initialCount)) resets. Remount with the preserved
289
+ * state merged into props — mirroring the bundled-fallback
290
+ * bootstrap — so that state carries across (issue #41). */
291
+ const preserved = window.__HMR_PRESERVED_STATE__;
292
+ const remount = window.__SVELTE_REMOUNT__;
293
+ if (
294
+ typeof remount === 'function' &&
295
+ preserved &&
296
+ Object.keys(preserved).length > 0
297
+ ) {
298
+ remount({
299
+ ...(window.__INITIAL_PROPS__ ?? {}),
300
+ ...preserved
301
+ });
302
+ }
303
+ window.__HMR_PRESERVED_STATE__ = undefined;
304
+
285
305
  if (
286
306
  window.__HMR_WS__ &&
287
307
  message.data.serverDuration !== undefined
package/dist/index.js CHANGED
@@ -23061,6 +23061,14 @@ if (isHMR) {
23061
23061
  if (typeof window !== "undefined") {
23062
23062
  window.__SVELTE_COMPONENT__ = component;
23063
23063
  window.__SVELTE_UNMOUNT__ = function() { if (component) { unmount(component); } };
23064
+ window.__SVELTE_REMOUNT__ = function(props) {
23065
+ if (typeof window.__SVELTE_UNMOUNT__ === "function") {
23066
+ try { window.__SVELTE_UNMOUNT__(); } catch (err) { /* ignore */ }
23067
+ }
23068
+ component = mount(Component, { target, props });
23069
+ window.__SVELTE_COMPONENT__ = component;
23070
+ window.__SVELTE_UNMOUNT__ = function() { if (component) { unmount(component); } };
23071
+ };
23064
23072
  window.__ABS_SLOT_HYDRATION_PENDING__ = shouldHydrate;
23065
23073
  var releaseStreamingSlots = function() {
23066
23074
  window.__ABS_SLOT_HYDRATION_PENDING__ = false;
@@ -46599,5 +46607,5 @@ export {
46599
46607
  ANGULAR_INIT_TIMEOUT_MS
46600
46608
  };
46601
46609
 
46602
- //# debugId=6A3DA19918ED0F0164756E2164756E21
46610
+ //# debugId=CBC02BD79E05A41764756E2164756E21
46603
46611
  //# sourceMappingURL=index.js.map