Home / Function/ visitors.Declaration() — svelte Function Reference

visitors.Declaration() — svelte Function Reference

Architecture documentation for the visitors.Declaration() function in index.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  8e9b59ee_191f_edbc_3420_fd81297be5b5["visitors.Declaration()"]
  194b07ed_c18e_6587_618d_b4b4d02442e0["index.js"]
  8e9b59ee_191f_edbc_3420_fd81297be5b5 -->|defined in| 194b07ed_c18e_6587_618d_b4b4d02442e0
  3f22fc17_0616_dd51_19f2_61263301f664["remove_css_prefix()"]
  8e9b59ee_191f_edbc_3420_fd81297be5b5 -->|calls| 3f22fc17_0616_dd51_19f2_61263301f664
  a8fd9736_9ea9_9a69_e694_2cfe2f847ce9["remove_preceding_whitespace()"]
  8e9b59ee_191f_edbc_3420_fd81297be5b5 -->|calls| a8fd9736_9ea9_9a69_e694_2cfe2f847ce9
  style 8e9b59ee_191f_edbc_3420_fd81297be5b5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/3-transform/css/index.js lines 100–137

	Declaration(node, { state }) {
		const property = node.property && remove_css_prefix(node.property.toLowerCase());
		if (property === 'animation' || property === 'animation-name') {
			let index = node.start + node.property.length + 1;
			let name = '';

			while (index < state.code.original.length) {
				const character = state.code.original[index];

				if (regex_css_name_boundary.test(character)) {
					if (state.keyframes.includes(name)) {
						state.code.prependRight(index - name.length, `${state.hash}-`);
					}

					if (character === ';' || character === '}') {
						break;
					}

					name = '';
				} else {
					name += character;
				}

				index++;
			}
		} else if (state.minify) {
			remove_preceding_whitespace(node.start, state);

			// Don't minify whitespace in custom properties, since some browsers (Chromium < 99)
			// treat --foo: ; and --foo:; differently
			if (!node.property.startsWith('--')) {
				let start = node.start + node.property.length + 1;
				let end = start;
				while (/\s/.test(state.code.original[end])) end++;
				if (end > start) state.code.remove(start, end);
			}
		}
	},

Domain

Subdomains

Frequently Asked Questions

What does visitors.Declaration() do?
visitors.Declaration() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/3-transform/css/index.js.
Where is visitors.Declaration() defined?
visitors.Declaration() is defined in packages/svelte/src/compiler/phases/3-transform/css/index.js at line 100.
What does visitors.Declaration() call?
visitors.Declaration() calls 2 function(s): remove_css_prefix, remove_preceding_whitespace.

Analyze Your Own Codebase

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

Try Supermodel Free