Home / Class/ HTMLElement Class — svelte Architecture

HTMLElement Class — svelte Architecture

Architecture documentation for the HTMLElement class in index.d.ts from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  2003c7aa_7f92_2ab3_f241_436f48fa638d["HTMLElement"]
  6bd9d090_a582_e05c_669e_d53d4e7245f2["index.d.ts"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|defined in| 6bd9d090_a582_e05c_669e_d53d4e7245f2
  2ddd846f_2fa8_4fd5_aa4e_227ddfc9bb99["constructor()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| 2ddd846f_2fa8_4fd5_aa4e_227ddfc9bb99
  b59082c3_711d_4a83_bc81_8663350bbd89["$destroy()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| b59082c3_711d_4a83_bc81_8663350bbd89
  a9bce55e_0053_f256_42c7_54e159e7778b["$on()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| a9bce55e_0053_f256_42c7_54e159e7778b
  f61dff4e_b1e2_3d9d_3df2_c9a7fd7b9fb7["$set()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| f61dff4e_b1e2_3d9d_3df2_c9a7fd7b9fb7
  68c1a8e8_2ae9_03b0_7bcb_cf76284f3e92["internals()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| 68c1a8e8_2ae9_03b0_7bcb_cf76284f3e92
  e6d4df95_6914_55e3_7437_193b398b3598["args()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| e6d4df95_6914_55e3_7437_193b398b3598
  361c5670_4a12_2246_56ef_279ec38a9a2e["commit()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| 361c5670_4a12_2246_56ef_279ec38a9a2e
  70ed2461_4e9e_b71d_5a18_d3cfbdbdb538["discard()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| 70ed2461_4e9e_b71d_5a18_d3cfbdbdb538
  b1e4ed9a_4bb0_4b2f_8254_b1b0dd6e2b33["getAbortSignal()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| b1e4ed9a_4bb0_4b2f_8254_b1b0dd6e2b33
  c743b0f6_54bf_e3c5_50da_390daaeb48bc["onMount()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| c743b0f6_54bf_e3c5_50da_390daaeb48bc
  a48157ff_a33e_2fb7_aae3_3608d98ce6b0["onDestroy()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| a48157ff_a33e_2fb7_aae3_3608d98ce6b0
  918c0eb0_474d_cb9a_c322_6e324ed81ded["createEventDispatcher()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| 918c0eb0_474d_cb9a_c322_6e324ed81ded
  b7ebb463_11dc_8542_4679_47abb11db099["beforeUpdate()"]
  2003c7aa_7f92_2ab3_f241_436f48fa638d -->|method| b7ebb463_11dc_8542_4679_47abb11db099

Relationship Graph

Source Code

packages/svelte/types/index.d.ts lines 3–602

declare module 'svelte' {
	/**
	 * @deprecated In Svelte 4, components are classes. In Svelte 5, they are functions.
	 * Use `mount` instead to instantiate components.
	 * See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes)
	 * for more info.
	 */
	export interface ComponentConstructorOptions<
		Props extends Record<string, any> = Record<string, any>
	> {
		target: Element | Document | ShadowRoot;
		anchor?: Element;
		props?: Props;
		context?: Map<any, any>;
		hydrate?: boolean;
		intro?: boolean;
		recover?: boolean;
		sync?: boolean;
		idPrefix?: string;
		$$inline?: boolean;
	}

	/**
	 * Utility type for ensuring backwards compatibility on a type level that if there's a default slot, add 'children' to the props
	 */
	type Properties<Props, Slots> = Props &
		(Slots extends { default: any }
			? // This is unfortunate because it means "accepts no props" turns into "accepts any prop"
				// but the alternative is non-fixable type errors because of the way TypeScript index
				// signatures work (they will always take precedence and make an impossible-to-satisfy children type).
				Props extends Record<string, never>
				? any
				: { children?: any }
			: {});

	/**
	 * This was the base class for Svelte components in Svelte 4. Svelte 5+ components
	 * are completely different under the hood. For typing, use `Component` instead.
	 * To instantiate components, use `mount` instead.
	 * See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) for more info.
	 */
	export class SvelteComponent<
		Props extends Record<string, any> = Record<string, any>,
		Events extends Record<string, any> = any,
		Slots extends Record<string, any> = any
	> {
		/** The custom element version of the component. Only present if compiled with the `customElement` compiler option */
		static element?: typeof HTMLElement;

		[prop: string]: any;
		/**
		 * @deprecated This constructor only exists when using the `asClassComponent` compatibility helper, which
		 * is a stop-gap solution. Migrate towards using `mount` instead. See
		 * [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) for more info.
		 */
		constructor(options: ComponentConstructorOptions<Properties<Props, Slots>>);
		/**
		 * For type checking capabilities only.
		 * Does not exist at runtime.
		 * ### DO NOT USE!
		 */
		$$prop_def: Props; // Without Properties: unnecessary, causes type bugs
		/**
		 * For type checking capabilities only.
		 * Does not exist at runtime.
		 * ### DO NOT USE!
		 */
		$$events_def: Events;
		/**
		 * For type checking capabilities only.
		 * Does not exist at runtime.
		 * ### DO NOT USE!
		 */
		$$slot_def: Slots;
		/**
		 * For type checking capabilities only.
		 * Does not exist at runtime.
		 * ### DO NOT USE!
		 */
		$$bindings?: string;

Frequently Asked Questions

What is the HTMLElement class?
HTMLElement is a class in the svelte codebase, defined in packages/svelte/types/index.d.ts.
Where is HTMLElement defined?
HTMLElement is defined in packages/svelte/types/index.d.ts at line 3.

Analyze Your Own Codebase

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

Try Supermodel Free