remove some stuff

blockless
Rich Harris 2 years ago
parent 6785a53587
commit 61f62ccac6

@ -1,10 +1,4 @@
import {
ROOT_BLOCK,
HEAD_BLOCK,
DYNAMIC_ELEMENT_BLOCK,
DYNAMIC_COMPONENT_BLOCK,
SNIPPET_BLOCK
} from './constants.js';
import { DYNAMIC_ELEMENT_BLOCK, SNIPPET_BLOCK } from './constants.js';
import { current_block } from './runtime.js';
/** @returns {import('./types.js').DynamicElementBlock} */

@ -13,12 +13,9 @@ export const DESTROYED = 1 << 12;
export const ROOT_EFFECT = 1 << 13;
export const BRANCH_EFFECT = 1 << 14;
export const ROOT_BLOCK = 0;
export const IF_BLOCK = 1;
export const EACH_BLOCK = 2;
export const EACH_ITEM_BLOCK = 3;
export const AWAIT_BLOCK = 4;
export const KEY_BLOCK = 5;
export const HEAD_BLOCK = 6;
export const DYNAMIC_COMPONENT_BLOCK = 7;
export const DYNAMIC_ELEMENT_BLOCK = 8;

@ -1019,23 +1019,23 @@ export function set_signal_value(signal, value) {
*/
export function destroy_signal(signal) {
return;
const teardown = /** @type {null | (() => void)} */ (signal.v);
const destroy = signal.y;
const flags = signal.f;
destroy_references(signal);
remove_consumers(signal, 0);
signal.i = signal.r = signal.y = signal.x = signal.b = signal.d = signal.c = null;
set_signal_status(signal, DESTROYED);
if (destroy !== null) {
if (is_array(destroy)) {
run_all(destroy);
} else {
destroy();
}
}
if (teardown !== null && (flags & IS_EFFECT) !== 0) {
teardown();
}
// const teardown = /** @type {null | (() => void)} */ (signal.v);
// const destroy = signal.y;
// const flags = signal.f;
// destroy_references(signal);
// remove_consumers(signal, 0);
// signal.i = signal.r = signal.y = signal.x = signal.b = signal.d = signal.c = null;
// set_signal_status(signal, DESTROYED);
// if (destroy !== null) {
// if (is_array(destroy)) {
// run_all(destroy);
// } else {
// destroy();
// }
// }
// if (teardown !== null && (flags & IS_EFFECT) !== 0) {
// teardown();
// }
}
/**

@ -4,12 +4,9 @@ import {
RENDER_EFFECT,
SOURCE,
PRE_EFFECT,
ROOT_BLOCK,
EACH_BLOCK,
EACH_ITEM_BLOCK,
IF_BLOCK,
AWAIT_BLOCK,
KEY_BLOCK,
HEAD_BLOCK,
DYNAMIC_COMPONENT_BLOCK,
DYNAMIC_ELEMENT_BLOCK,
@ -140,12 +137,9 @@ export type UnwrappedSignal<T> = T extends Signal<infer U> ? U : T;
export type EqualsFunctions<T = any> = (a: T, v: T) => boolean;
export type BlockType =
| typeof ROOT_BLOCK
| typeof EACH_BLOCK
| typeof EACH_ITEM_BLOCK
| typeof IF_BLOCK
| typeof AWAIT_BLOCK
| typeof KEY_BLOCK
| typeof SNIPPET_BLOCK
| typeof HEAD_BLOCK
| typeof DYNAMIC_COMPONENT_BLOCK
@ -175,21 +169,6 @@ export type Transition = {
d: HTMLElement;
};
export type RootBlock = {
/** dom */
d: null | TemplateNode | Array<TemplateNode>;
/** effect */
e: null | ComputationSignal;
/** intro */
i: boolean;
/** parent */
p: null;
/** transition */
r: null | ((transition: Transition) => void);
/** type */
t: typeof ROOT_BLOCK;
};
export type IfBlock = {
/** value */
v: boolean;
@ -213,19 +192,6 @@ export type IfBlock = {
t: typeof IF_BLOCK;
};
export type KeyBlock = {
/** dom */
d: null | TemplateNode | Array<TemplateNode>;
/** effect */
e: null | EffectSignal;
/** parent */
p: Block;
/** transition */
r: null | ((transition: Transition) => void);
/** type */
t: typeof KEY_BLOCK;
};
export type HeadBlock = {
/** dom */
d: null | TemplateNode | Array<TemplateNode>;
@ -265,21 +231,6 @@ export type DynamicComponentBlock = {
t: typeof DYNAMIC_COMPONENT_BLOCK;
};
export type AwaitBlock = {
/** dom */
d: null | TemplateNode | Array<TemplateNode>;
/** effect */
e: null | ComputationSignal;
/** parent */
p: Block;
/** pending */
n: boolean;
/** transition */
r: null | ((transition: Transition) => void);
/** type */
t: typeof AWAIT_BLOCK;
};
export type EachBlock = {
/** anchor */
a: Element | Comment;
@ -338,13 +289,10 @@ export type SnippetBlock = {
};
export type Block =
| RootBlock
| IfBlock
| AwaitBlock
| DynamicElementBlock
| DynamicComponentBlock
| HeadBlock
| KeyBlock
| EachBlock
| EachItemBlock
| SnippetBlock;

Loading…
Cancel
Save