StyleDirective() — svelte Function Reference
Architecture documentation for the StyleDirective() function in StyleDirective.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD e7854cdf_b18b_857a_0ebb_663e9f89aa43["StyleDirective()"] f78b6bee_5963_5e6b_4d2b_199d03083df8["StyleDirective.js"] e7854cdf_b18b_857a_0ebb_663e9f89aa43 -->|defined in| f78b6bee_5963_5e6b_4d2b_199d03083df8 86b36fed_6705_6ec8_96d4_da80aa6f8086["style_directive_invalid_modifier()"] e7854cdf_b18b_857a_0ebb_663e9f89aa43 -->|calls| 86b36fed_6705_6ec8_96d4_da80aa6f8086 313d2a82_30ea_3161_3aad_0cc2094979aa["mark_subtree_dynamic()"] e7854cdf_b18b_857a_0ebb_663e9f89aa43 -->|calls| 313d2a82_30ea_3161_3aad_0cc2094979aa f6625393_617b_8f3b_aaa5_b87527fde52f["get_attribute_chunks()"] e7854cdf_b18b_857a_0ebb_663e9f89aa43 -->|calls| f6625393_617b_8f3b_aaa5_b87527fde52f style e7854cdf_b18b_857a_0ebb_663e9f89aa43 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/2-analyze/visitors/StyleDirective.js lines 11–39
export function StyleDirective(node, context) {
if (node.modifiers.length > 1 || (node.modifiers.length && node.modifiers[0] !== 'important')) {
e.style_directive_invalid_modifier(node);
}
mark_subtree_dynamic(context.path);
if (node.value === true) {
// get the binding for node.name and change the binding to state
let binding = context.state.scope.get(node.name);
if (binding) {
if (binding.kind !== 'normal') {
node.metadata.expression.has_state = true;
}
if (binding.blocker) {
node.metadata.expression.dependencies.add(binding);
}
}
} else {
context.next();
for (const chunk of get_attribute_chunks(node.value)) {
if (chunk.type !== 'ExpressionTag') continue;
node.metadata.expression.merge(chunk.metadata.expression);
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does StyleDirective() do?
StyleDirective() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/visitors/StyleDirective.js.
Where is StyleDirective() defined?
StyleDirective() is defined in packages/svelte/src/compiler/phases/2-analyze/visitors/StyleDirective.js at line 11.
What does StyleDirective() call?
StyleDirective() calls 3 function(s): get_attribute_chunks, mark_subtree_dynamic, style_directive_invalid_modifier.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free