Home / File/ each.js — svelte Source File

each.js — svelte Source File

Architecture documentation for each.js, a javascript file in the svelte codebase. 34 imports, 0 dependents.

File javascript ClientRuntime Hydration 34 imports 10 functions

Entity Profile

Dependency Diagram

graph LR
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa["each.js"]
  73865c3c_2786_c9ac_d34f_b51d28b3a29e["constants.js"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> 73865c3c_2786_c9ac_d34f_b51d28b3a29e
  f3948b0d_b92a_0767_ba6c_832767f4e2bb["hydration.js"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> f3948b0d_b92a_0767_ba6c_832767f4e2bb
  b31601aa_35ce_7827_5394_99fb97fa27d2["hydrate_next"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> b31601aa_35ce_7827_5394_99fb97fa27d2
  965d3fe6_c7da_0708_eb2c_13a616bc4bca["read_hydration_instruction"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> 965d3fe6_c7da_0708_eb2c_13a616bc4bca
  8bcc1a1c_73ab_4fe7_59be_b28bbe88fd3e["skip_nodes"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> 8bcc1a1c_73ab_4fe7_59be_b28bbe88fd3e
  40f27ad3_30bb_8f2a_3fb3_757088cf7428["set_hydrate_node"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> 40f27ad3_30bb_8f2a_3fb3_757088cf7428
  f5b61c69_d41c_bdb7_b931_5b8b3374332c["set_hydrating"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> f5b61c69_d41c_bdb7_b931_5b8b3374332c
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0["operations.js"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> 9a9bbc27_46b6_021c_6d77_f736ed4b40f0
  7bff6ec5_15bb_4289_1bd5_99cb794400ed["clear_text_content"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> 7bff6ec5_15bb_4289_1bd5_99cb794400ed
  ec54e18a_a454_5d8c_9e00_7bc16e4f49c4["create_text"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> ec54e18a_a454_5d8c_9e00_7bc16e4f49c4
  f3bd5a62_2879_ccbe_7046_712cbf9eeaab["get_first_child"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> f3bd5a62_2879_ccbe_7046_712cbf9eeaab
  4776c976_30bb_448d_921d_ee70a7fa0135["get_next_sibling"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> 4776c976_30bb_448d_921d_ee70a7fa0135
  c4c2548c_902e_185e_193f_a8d4a30d7f72["should_defer_append"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> c4c2548c_902e_185e_193f_a8d4a30d7f72
  1ae6fa4e_16ee_acdf_5e28_17eb0819fddb["effects.js"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> 1ae6fa4e_16ee_acdf_5e28_17eb0819fddb
  style ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */
/** @import { Batch } from '../../reactivity/batch.js'; */
import {
	EACH_INDEX_REACTIVE,
	EACH_IS_ANIMATED,
	EACH_IS_CONTROLLED,
	EACH_ITEM_IMMUTABLE,
	EACH_ITEM_REACTIVE,
	HYDRATION_END,
	HYDRATION_START_ELSE
} from '../../../../constants.js';
import {
	hydrate_next,
	hydrate_node,
	hydrating,
	read_hydration_instruction,
	skip_nodes,
	set_hydrate_node,
	set_hydrating
} from '../hydration.js';
import {
	clear_text_content,
	create_text,
	get_first_child,
	get_next_sibling,
	should_defer_append
} from '../operations.js';
import {
	block,
	branch,
	destroy_effect,
	pause_effect,
	resume_effect
} from '../../reactivity/effects.js';
import { source, mutable_source, internal_set } from '../../reactivity/sources.js';
import { array_from, is_array } from '../../../shared/utils.js';
import { BRANCH_EFFECT, COMMENT_NODE, EFFECT_OFFSCREEN, INERT } from '#client/constants';
import { queue_micro_task } from '../task.js';
import { get } from '../../runtime.js';
import { DEV } from 'esm-env';
import { derived_safe_equal } from '../../reactivity/deriveds.js';
import { current_batch } from '../../reactivity/batch.js';
import * as e from '../../errors.js';

// When making substantive changes to this file, validate them with the each block stress test:
// https://svelte.dev/playground/1972b2cf46564476ad8c8c6405b23b7b
// This test also exists in this repo, as `packages/svelte/tests/manual/each-stress-test`

/**
 * @param {any} _
 * @param {number} i
 */
export function index(_, i) {
	return i;
}

/**
 * Pause multiple effects simultaneously, and coordinate their
 * subsequent destruction. Used in each blocks
 * @param {EachState} state
// ... (656 more lines)

Domain

Subdomains

Frequently Asked Questions

What does each.js do?
each.js is a source file in the svelte codebase, written in javascript. It belongs to the ClientRuntime domain, Hydration subdomain.
What functions are defined in each.js?
each.js defines 10 function(s): create_item, destroy_effects, each, index, link, move, pause_effects, reconcile, skip_to_branch, validate_each_keys.
What does each.js depend on?
each.js imports 34 module(s): batch.js, block, branch, clear_text_content, constants, constants.js, create_text, derived_safe_equal, and 26 more.
Where is each.js in the architecture?
each.js is located at packages/svelte/src/internal/client/dom/blocks/each.js (domain: ClientRuntime, subdomain: Hydration, directory: packages/svelte/src/internal/client/dom/blocks).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free