From 61f62ccac6c01197c196e6239847fa83b0edb7a6 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 22 Feb 2024 17:52:59 -0500 Subject: [PATCH] remove some stuff --- packages/svelte/src/internal/client/block.js | 8 +-- .../svelte/src/internal/client/constants.js | 3 -- .../svelte/src/internal/client/runtime.js | 34 ++++++------ .../svelte/src/internal/client/types.d.ts | 52 ------------------- 4 files changed, 18 insertions(+), 79 deletions(-) diff --git a/packages/svelte/src/internal/client/block.js b/packages/svelte/src/internal/client/block.js index 0904b1d080..65b30bb07e 100644 --- a/packages/svelte/src/internal/client/block.js +++ b/packages/svelte/src/internal/client/block.js @@ -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} */ diff --git a/packages/svelte/src/internal/client/constants.js b/packages/svelte/src/internal/client/constants.js index 4344a4d51e..07c062adcb 100644 --- a/packages/svelte/src/internal/client/constants.js +++ b/packages/svelte/src/internal/client/constants.js @@ -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; diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index 5b072fd7e6..c8bbdb1088 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -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(); + // } } /** diff --git a/packages/svelte/src/internal/client/types.d.ts b/packages/svelte/src/internal/client/types.d.ts index 35b9dd0eb7..8a99241847 100644 --- a/packages/svelte/src/internal/client/types.d.ts +++ b/packages/svelte/src/internal/client/types.d.ts @@ -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 extends Signal ? U : T; export type EqualsFunctions = (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; - /** 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; - /** 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; @@ -265,21 +231,6 @@ export type DynamicComponentBlock = { t: typeof DYNAMIC_COMPONENT_BLOCK; }; -export type AwaitBlock = { - /** dom */ - d: null | TemplateNode | Array; - /** 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;