Home / File/ imageAttributes.ts — astro Source File

imageAttributes.ts — astro Source File

Architecture documentation for imageAttributes.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.

File typescript CoreAstro RenderingEngine 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  038ae3fa_b0fa_2171_53fd_a3441a780778["imageAttributes.ts"]
  f6f0048c_504d_27bf_f669_9d6d4a931037["./util.js"]
  038ae3fa_b0fa_2171_53fd_a3441a780778 --> f6f0048c_504d_27bf_f669_9d6d4a931037
  style 038ae3fa_b0fa_2171_53fd_a3441a780778 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { toStyleString } from '../../runtime/server/render/util.js';

export const cssFitValues = ['fill', 'contain', 'cover', 'scale-down'];

export function addCSSVarsToStyle(
	vars: Record<string, string | false | undefined>,
	styles?: string | Record<string, any>,
) {
	const cssVars = Object.entries(vars)
		.filter(([_, value]) => value !== undefined && value !== false)
		.map(([key, value]) => `--${key}: ${value};`)
		.join(' ');

	if (!styles) {
		return cssVars;
	}
	const style = typeof styles === 'string' ? styles : toStyleString(styles);

	return `${cssVars} ${style}`;
}

Domain

Subdomains

Dependencies

  • ./util.js

Frequently Asked Questions

What does imageAttributes.ts do?
imageAttributes.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in imageAttributes.ts?
imageAttributes.ts defines 1 function(s): addCSSVarsToStyle.
What does imageAttributes.ts depend on?
imageAttributes.ts imports 1 module(s): ./util.js.
Where is imageAttributes.ts in the architecture?
imageAttributes.ts is located at packages/astro/src/assets/utils/imageAttributes.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/assets/utils).

Analyze Your Own Codebase

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

Try Supermodel Free