pull/12215/head
Rich Harris 2 months ago
parent 520b3e16bf
commit 7f26fd0258

@ -126,15 +126,7 @@ export function sibling(node, is_text = false) {
// text node to hydrate — we must therefore create one
if (is_text && type !== 3) {
var text = empty();
var dom = /** @type {import('#client').TemplateNode[]} */ (
/** @type {import('#client').Effect} */ (current_effect).dom
);
// TODO something needs to happen here but i'm not quite sure what
dom.unshift(text);
next_sibling?.before(text);
return text;
}

@ -7,35 +7,8 @@ import {
TEMPLATE_UNSET_START,
TEMPLATE_USE_IMPORT_NODE
} from '../../../constants.js';
import { is_array } from '../utils.js';
import { queue_micro_task } from './task.js';
/**
* @template {import("#client").TemplateNode | import("#client").TemplateNode[]} T
* @param {T} dom
* @param {import("#client").Effect} effect
*/
function push_template_node(
dom,
effect = /** @type {import('#client').Effect} */ (current_effect)
) {
var current_dom = effect.dom;
if (current_dom === null) {
effect.dom = dom;
} else {
if (!is_array(current_dom)) {
current_dom = effect.dom = [current_dom];
}
if (is_array(dom)) {
current_dom.push(...dom);
} else {
current_dom.push(dom);
}
}
return dom;
}
/**
*
* @param {import('#client').TemplateNode | null | undefined} start
@ -76,7 +49,6 @@ export function template(content, flags) {
hydrate_nodes[hydrate_nodes.length - 1]
);
push_template_node(is_fragment ? hydrate_nodes : hydrate_start);
return hydrate_start;
}
@ -99,12 +71,6 @@ export function template(content, flags) {
assign_nodes(start, end);
push_template_node(
is_fragment
? /** @type {import('#client').TemplateNode[]} */ ([...clone.childNodes])
: /** @type {import('#client').TemplateNode} */ (clone)
);
return clone;
};
}
@ -153,7 +119,6 @@ export function ns_template(content, flags, ns = 'svg') {
if (hydrating) {
assign_nodes(has_start ? hydrate_nodes[0] : null, hydrate_nodes[hydrate_nodes.length - 1]);
push_template_node(is_fragment ? hydrate_nodes : hydrate_start);
return hydrate_start;
}
@ -183,12 +148,6 @@ export function ns_template(content, flags, ns = 'svg') {
assign_nodes(start, end);
push_template_node(
is_fragment
? /** @type {import('#client').TemplateNode[]} */ ([...clone.childNodes])
: /** @type {import('#client').TemplateNode} */ (clone)
);
return clone;
};
}
@ -267,7 +226,7 @@ export function text(anchor) {
if (!hydrating) {
var t = empty();
assign_nodes(t, t);
return push_template_node(t);
return t;
}
var node = hydrate_start;
@ -279,7 +238,6 @@ export function text(anchor) {
}
assign_nodes(node, node);
push_template_node(node);
return node;
}
@ -294,7 +252,6 @@ export function comment(flags = 0) {
hydrate_nodes[hydrate_nodes.length - 1]
);
push_template_node(hydrate_nodes);
return hydrate_start;
}
@ -303,7 +260,6 @@ export function comment(flags = 0) {
frag.append(anchor);
assign_nodes((flags & TEMPLATE_UNSET_START) !== 0 ? undefined : null, anchor);
push_template_node([anchor]);
return frag;
}

@ -85,7 +85,6 @@ function create_effect(type, fn, sync) {
var effect = {
ctx: current_component_context,
deps: null,
dom: null,
nodes: null,
f: type | DIRTY,
first: null,

@ -36,7 +36,6 @@ export interface Derived<V = unknown> extends Value<V>, Reaction {
export interface Effect extends Reaction {
parent: Effect | null;
dom: Dom | null;
nodes: null | { start: undefined | null | TemplateNode; end: TemplateNode };
/** The associated component context */
ctx: null | ComponentContext;

Loading…
Cancel
Save