Home / Function/ build_style_directives_object() — svelte Function Reference

build_style_directives_object() — svelte Function Reference

Architecture documentation for the build_style_directives_object() function in RegularElement.js from the svelte codebase.

Function javascript Compiler Transformer calls 5 called by 2

Entity Profile

Dependency Diagram

graph TD
  4fce48f1_e9d7_958a_ce38_30799ece4fc7["build_style_directives_object()"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe["RegularElement.js"]
  4fce48f1_e9d7_958a_ce38_30799ece4fc7 -->|defined in| 4610488f_3cf2_5f73_043e_da0aa9d026fe
  ef858948_a3b7_f31d_ad40_16743e642d00["build_attribute_effect()"]
  ef858948_a3b7_f31d_ad40_16743e642d00 -->|calls| 4fce48f1_e9d7_958a_ce38_30799ece4fc7
  9e463b1e_1f97_8c97_f5f2_bccfb0ffe03b["build_set_style()"]
  9e463b1e_1f97_8c97_f5f2_bccfb0ffe03b -->|calls| 4fce48f1_e9d7_958a_ce38_30799ece4fc7
  804afe56_25d1_9f41_dafe_adc75e952134["object()"]
  4fce48f1_e9d7_958a_ce38_30799ece4fc7 -->|calls| 804afe56_25d1_9f41_dafe_adc75e952134
  23cf92f5_03a7_f07d_fe6f_d5ac1659d37e["merge()"]
  4fce48f1_e9d7_958a_ce38_30799ece4fc7 -->|calls| 23cf92f5_03a7_f07d_fe6f_d5ac1659d37e
  27fded45_bc11_247b_d3fe_94831379f9ed["build_getter()"]
  4fce48f1_e9d7_958a_ce38_30799ece4fc7 -->|calls| 27fded45_bc11_247b_d3fe_94831379f9ed
  e31bc2c2_91c1_b9a9_f78a_2832bddce6c5["build_attribute_value()"]
  4fce48f1_e9d7_958a_ce38_30799ece4fc7 -->|calls| e31bc2c2_91c1_b9a9_f78a_2832bddce6c5
  5ff7d39f_78e8_c057_8c8e_279f6e72149e["add()"]
  4fce48f1_e9d7_958a_ce38_30799ece4fc7 -->|calls| 5ff7d39f_78e8_c057_8c8e_279f6e72149e
  style 4fce48f1_e9d7_958a_ce38_30799ece4fc7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js lines 591–616

export function build_style_directives_object(
	style_directives,
	context,
	memoizer = context.state.memoizer
) {
	const normal = b.object([]);
	const important = b.object([]);

	const metadata = new ExpressionMetadata();

	for (const d of style_directives) {
		metadata.merge(d.metadata.expression);

		const expression =
			d.value === true
				? build_getter(b.id(d.name), context.state)
				: build_attribute_value(d.value, context).value;

		const object = d.modifiers.includes('important') ? important : normal;
		object.properties.push(b.init(d.name, expression));
	}

	const directives = important.properties.length ? b.array([normal, important]) : normal;

	return memoizer.add(directives, metadata);
}

Domain

Subdomains

Frequently Asked Questions

What does build_style_directives_object() do?
build_style_directives_object() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js.
Where is build_style_directives_object() defined?
build_style_directives_object() is defined in packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js at line 591.
What does build_style_directives_object() call?
build_style_directives_object() calls 5 function(s): add, build_attribute_value, build_getter, merge, object.
What calls build_style_directives_object()?
build_style_directives_object() is called by 2 function(s): build_attribute_effect, build_set_style.

Analyze Your Own Codebase

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

Try Supermodel Free