|
|
|
|
@ -6,7 +6,7 @@ import {
|
|
|
|
|
HYDRATION_START,
|
|
|
|
|
PassiveDelegatedEvents
|
|
|
|
|
} from '../../constants.js';
|
|
|
|
|
import { flush_sync, push, pop, current_component_context } from './runtime.js';
|
|
|
|
|
import { flush_sync, push, pop, current_component_context, current_effect } from './runtime.js';
|
|
|
|
|
import { effect_root, branch } from './reactivity/effects.js';
|
|
|
|
|
import {
|
|
|
|
|
hydrate_next,
|
|
|
|
|
@ -21,6 +21,7 @@ import { reset_head_anchor } from './dom/blocks/svelte-head.js';
|
|
|
|
|
import * as w from './warnings.js';
|
|
|
|
|
import * as e from './errors.js';
|
|
|
|
|
import { validate_component } from '../shared/validate.js';
|
|
|
|
|
import { assign_nodes } from './dom/template.js';
|
|
|
|
|
|
|
|
|
|
/** @type {Set<string>} */
|
|
|
|
|
export const all_registered_events = new Set();
|
|
|
|
|
@ -144,12 +145,12 @@ export function hydrate(component, options) {
|
|
|
|
|
return flush_sync(() => {
|
|
|
|
|
set_hydrating(true);
|
|
|
|
|
|
|
|
|
|
var anchor = target.firstChild;
|
|
|
|
|
var anchor = /** @type {import('#client').TemplateNode} */ (target.firstChild);
|
|
|
|
|
while (
|
|
|
|
|
anchor &&
|
|
|
|
|
(anchor.nodeType !== 8 || /** @type {Comment} */ (anchor).data !== HYDRATION_START)
|
|
|
|
|
) {
|
|
|
|
|
anchor = anchor.nextSibling;
|
|
|
|
|
anchor = /** @type {import('#client').TemplateNode} */ (anchor.nextSibling);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!anchor) {
|
|
|
|
|
@ -258,11 +259,21 @@ function _mount(Component, { target, anchor, props = {}, events, context, intro
|
|
|
|
|
/** @type {any} */ (props).$$events = events;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hydrating) {
|
|
|
|
|
assign_nodes(/** @type {import('#client').TemplateNode} */ (anchor), null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
should_intro = intro;
|
|
|
|
|
// @ts-expect-error the public typings are not what the actual function looks like
|
|
|
|
|
component = Component(anchor, props) || {};
|
|
|
|
|
should_intro = true;
|
|
|
|
|
|
|
|
|
|
if (hydrating) {
|
|
|
|
|
/** @type {import('#client').Effect & { nodes: import('#client').EffectNodes }} */ (
|
|
|
|
|
current_effect
|
|
|
|
|
).nodes.end = hydrate_node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (context) {
|
|
|
|
|
pop();
|
|
|
|
|
}
|
|
|
|
|
|