|
|
|
@ -30,7 +30,6 @@ import {
|
|
|
|
skip_nodes,
|
|
|
|
skip_nodes,
|
|
|
|
set_hydrate_node
|
|
|
|
set_hydrate_node
|
|
|
|
} from '../hydration.js';
|
|
|
|
} from '../hydration.js';
|
|
|
|
import { get_next_sibling } from '../operations.js';
|
|
|
|
|
|
|
|
import { queue_micro_task } from '../task.js';
|
|
|
|
import { queue_micro_task } from '../task.js';
|
|
|
|
import * as e from '../../errors.js';
|
|
|
|
import * as e from '../../errors.js';
|
|
|
|
import * as w from '../../warnings.js';
|
|
|
|
import * as w from '../../warnings.js';
|
|
|
|
@ -39,6 +38,7 @@ import { Batch, effect_pending_updates } from '../../reactivity/batch.js';
|
|
|
|
import { internal_set, source } from '../../reactivity/sources.js';
|
|
|
|
import { internal_set, source } from '../../reactivity/sources.js';
|
|
|
|
import { tag } from '../../dev/tracing.js';
|
|
|
|
import { tag } from '../../dev/tracing.js';
|
|
|
|
import { createSubscriber } from '../../../../reactivity/create-subscriber.js';
|
|
|
|
import { createSubscriber } from '../../../../reactivity/create-subscriber.js';
|
|
|
|
|
|
|
|
import { create_text } from '../operations.js';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @typedef {{
|
|
|
|
* @typedef {{
|
|
|
|
@ -93,6 +93,9 @@ export class Boundary {
|
|
|
|
/** @type {DocumentFragment | null} */
|
|
|
|
/** @type {DocumentFragment | null} */
|
|
|
|
#offscreen_fragment = null;
|
|
|
|
#offscreen_fragment = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {TemplateNode | null} */
|
|
|
|
|
|
|
|
#pending_anchor = null;
|
|
|
|
|
|
|
|
|
|
|
|
#local_pending_count = 0;
|
|
|
|
#local_pending_count = 0;
|
|
|
|
#pending_count = 0;
|
|
|
|
#pending_count = 0;
|
|
|
|
|
|
|
|
|
|
|
|
@ -156,8 +159,10 @@ export class Boundary {
|
|
|
|
this.#hydrate_resolved_content();
|
|
|
|
this.#hydrate_resolved_content();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
var anchor = this.#get_anchor();
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
this.#main_effect = branch(() => children(this.#anchor));
|
|
|
|
this.#main_effect = branch(() => children(anchor));
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
this.error(error);
|
|
|
|
this.error(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -168,6 +173,10 @@ export class Boundary {
|
|
|
|
this.#pending = false;
|
|
|
|
this.#pending = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
|
|
|
this.#pending_anchor?.remove();
|
|
|
|
|
|
|
|
};
|
|
|
|
}, flags);
|
|
|
|
}, flags);
|
|
|
|
|
|
|
|
|
|
|
|
if (hydrating) {
|
|
|
|
if (hydrating) {
|
|
|
|
@ -195,9 +204,11 @@ export class Boundary {
|
|
|
|
this.#pending_effect = branch(() => pending(this.#anchor));
|
|
|
|
this.#pending_effect = branch(() => pending(this.#anchor));
|
|
|
|
|
|
|
|
|
|
|
|
Batch.enqueue(() => {
|
|
|
|
Batch.enqueue(() => {
|
|
|
|
|
|
|
|
var anchor = this.#get_anchor();
|
|
|
|
|
|
|
|
|
|
|
|
this.#main_effect = this.#run(() => {
|
|
|
|
this.#main_effect = this.#run(() => {
|
|
|
|
Batch.ensure();
|
|
|
|
Batch.ensure();
|
|
|
|
return branch(() => this.#children(this.#anchor));
|
|
|
|
return branch(() => this.#children(anchor));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (this.#pending_count > 0) {
|
|
|
|
if (this.#pending_count > 0) {
|
|
|
|
@ -212,6 +223,19 @@ export class Boundary {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#get_anchor() {
|
|
|
|
|
|
|
|
var anchor = this.#anchor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.#pending) {
|
|
|
|
|
|
|
|
this.#pending_anchor = create_text();
|
|
|
|
|
|
|
|
this.#anchor.before(this.#pending_anchor);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
anchor = this.#pending_anchor;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return anchor;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns `true` if the effect exists inside a boundary whose pending snippet is shown
|
|
|
|
* Returns `true` if the effect exists inside a boundary whose pending snippet is shown
|
|
|
|
* @returns {boolean}
|
|
|
|
* @returns {boolean}
|
|
|
|
@ -253,6 +277,7 @@ export class Boundary {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.#main_effect !== null) {
|
|
|
|
if (this.#main_effect !== null) {
|
|
|
|
this.#offscreen_fragment = document.createDocumentFragment();
|
|
|
|
this.#offscreen_fragment = document.createDocumentFragment();
|
|
|
|
|
|
|
|
this.#offscreen_fragment.append(/** @type {TemplateNode} */ (this.#pending_anchor));
|
|
|
|
move_effect(this.#main_effect, this.#offscreen_fragment);
|
|
|
|
move_effect(this.#main_effect, this.#offscreen_fragment);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -402,6 +427,7 @@ export class Boundary {
|
|
|
|
if (failed) {
|
|
|
|
if (failed) {
|
|
|
|
queue_micro_task(() => {
|
|
|
|
queue_micro_task(() => {
|
|
|
|
this.#failed_effect = this.#run(() => {
|
|
|
|
this.#failed_effect = this.#run(() => {
|
|
|
|
|
|
|
|
Batch.ensure();
|
|
|
|
this.#is_creating_fallback = true;
|
|
|
|
this.#is_creating_fallback = true;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|