|
|
@ -4,8 +4,7 @@ import {
|
|
|
|
clear_text_content,
|
|
|
|
clear_text_content,
|
|
|
|
create_element,
|
|
|
|
create_element,
|
|
|
|
empty,
|
|
|
|
empty,
|
|
|
|
init_operations,
|
|
|
|
init_operations
|
|
|
|
next_sibling
|
|
|
|
|
|
|
|
} from './dom/operations.js';
|
|
|
|
} from './dom/operations.js';
|
|
|
|
import { HYDRATION_ERROR, HYDRATION_START, PassiveDelegatedEvents } from '../../constants.js';
|
|
|
|
import { HYDRATION_ERROR, 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 } from './runtime.js';
|
|
|
@ -107,7 +106,6 @@ export function mount(component, options) {
|
|
|
|
if (DEV) {
|
|
|
|
if (DEV) {
|
|
|
|
validate_component(component);
|
|
|
|
validate_component(component);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
init_operations();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const anchor = options.anchor ?? options.target.appendChild(empty());
|
|
|
|
const anchor = options.anchor ?? options.target.appendChild(empty());
|
|
|
|
// Don't flush previous effects to ensure order of outer effects stays consistent
|
|
|
|
// Don't flush previous effects to ensure order of outer effects stays consistent
|
|
|
@ -135,7 +133,6 @@ export function hydrate(component, options) {
|
|
|
|
if (DEV) {
|
|
|
|
if (DEV) {
|
|
|
|
validate_component(component);
|
|
|
|
validate_component(component);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
init_operations();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const target = options.target;
|
|
|
|
const target = options.target;
|
|
|
|
const previous_hydrate_nodes = hydrate_nodes;
|
|
|
|
const previous_hydrate_nodes = hydrate_nodes;
|
|
|
@ -147,13 +144,12 @@ export function hydrate(component, options) {
|
|
|
|
return flush_sync(() => {
|
|
|
|
return flush_sync(() => {
|
|
|
|
set_hydrating(true);
|
|
|
|
set_hydrating(true);
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {Node | null} */
|
|
|
|
|
|
|
|
var node = target.firstChild;
|
|
|
|
var node = target.firstChild;
|
|
|
|
while (
|
|
|
|
while (
|
|
|
|
node &&
|
|
|
|
node &&
|
|
|
|
(node.nodeType !== 8 || /** @type {Comment} */ (node).data !== HYDRATION_START)
|
|
|
|
(node.nodeType !== 8 || /** @type {Comment} */ (node).data !== HYDRATION_START)
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
node = next_sibling(node);
|
|
|
|
node = node.nextSibling;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
if (!node) {
|
|
|
@ -176,6 +172,8 @@ export function hydrate(component, options) {
|
|
|
|
e.hydration_failed();
|
|
|
|
e.hydration_failed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If an error occured above, the operations might not yet have been initialised.
|
|
|
|
|
|
|
|
init_operations();
|
|
|
|
clear_text_content(target);
|
|
|
|
clear_text_content(target);
|
|
|
|
|
|
|
|
|
|
|
|
set_hydrating(false);
|
|
|
|
set_hydrating(false);
|
|
|
@ -204,6 +202,8 @@ export function hydrate(component, options) {
|
|
|
|
* @returns {Exports}
|
|
|
|
* @returns {Exports}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function _mount(Component, { target, anchor, props = {}, events, context, intro = false }) {
|
|
|
|
function _mount(Component, { target, anchor, props = {}, events, context, intro = false }) {
|
|
|
|
|
|
|
|
init_operations();
|
|
|
|
|
|
|
|
|
|
|
|
const registered_events = new Set();
|
|
|
|
const registered_events = new Set();
|
|
|
|
|
|
|
|
|
|
|
|
const bound_event_listener = handle_event_propagation.bind(null, target);
|
|
|
|
const bound_event_listener = handle_event_propagation.bind(null, target);
|
|
|
|