remove some stuff

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

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

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

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

@ -4,12 +4,9 @@ import {
RENDER_EFFECT, RENDER_EFFECT,
SOURCE, SOURCE,
PRE_EFFECT, PRE_EFFECT,
ROOT_BLOCK,
EACH_BLOCK, EACH_BLOCK,
EACH_ITEM_BLOCK, EACH_ITEM_BLOCK,
IF_BLOCK, IF_BLOCK,
AWAIT_BLOCK,
KEY_BLOCK,
HEAD_BLOCK, HEAD_BLOCK,
DYNAMIC_COMPONENT_BLOCK, DYNAMIC_COMPONENT_BLOCK,
DYNAMIC_ELEMENT_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 EqualsFunctions<T = any> = (a: T, v: T) => boolean;
export type BlockType = export type BlockType =
| typeof ROOT_BLOCK
| typeof EACH_BLOCK | typeof EACH_BLOCK
| typeof EACH_ITEM_BLOCK | typeof EACH_ITEM_BLOCK
| typeof IF_BLOCK | typeof IF_BLOCK
| typeof AWAIT_BLOCK
| typeof KEY_BLOCK
| typeof SNIPPET_BLOCK | typeof SNIPPET_BLOCK
| typeof HEAD_BLOCK | typeof HEAD_BLOCK
| typeof DYNAMIC_COMPONENT_BLOCK | typeof DYNAMIC_COMPONENT_BLOCK
@ -175,21 +169,6 @@ export type Transition = {
d: HTMLElement; 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 = { export type IfBlock = {
/** value */ /** value */
v: boolean; v: boolean;
@ -213,19 +192,6 @@ export type IfBlock = {
t: typeof IF_BLOCK; 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 = { export type HeadBlock = {
/** dom */ /** dom */
d: null | TemplateNode | Array<TemplateNode>; d: null | TemplateNode | Array<TemplateNode>;
@ -265,21 +231,6 @@ export type DynamicComponentBlock = {
t: typeof DYNAMIC_COMPONENT_BLOCK; 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 = { export type EachBlock = {
/** anchor */ /** anchor */
a: Element | Comment; a: Element | Comment;
@ -338,13 +289,10 @@ export type SnippetBlock = {
}; };
export type Block = export type Block =
| RootBlock
| IfBlock | IfBlock
| AwaitBlock
| DynamicElementBlock | DynamicElementBlock
| DynamicComponentBlock | DynamicComponentBlock
| HeadBlock | HeadBlock
| KeyBlock
| EachBlock | EachBlock
| EachItemBlock | EachItemBlock
| SnippetBlock; | SnippetBlock;

Loading…
Cancel
Save