MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / normalizeCssValue

Function normalizeCssValue

packages/extension/utils/css.ts:316–335  ·  view source on GitHub ↗
(value: string, config: CodegenConfig, prop?: string)

Source from the content-addressed store, hash-verified

314}
315
316export function normalizeCssValue(value: string, config: CodegenConfig, prop?: string): string {
317 if (!value) return value
318
319 let current = value.trim()
320
321 if (prop && KEEP_PX_PROPS.has(prop)) {
322 return current
323 }
324
325 if (typeof config.scale === 'number' && config.scale !== 1) {
326 current = scalePxValue(current, config.scale)
327 }
328
329 if (config.cssUnit === 'rem') {
330 const root = config.rootFontSize || 16
331 current = pxToRem(current, root)
332 }
333
334 return current
335}
336
337export function normalizeStyleValues(
338 style: Record<string, string>,

Callers 7

css.test.tsFile · 0.90
serializeVariableValueFunction · 0.90
normalizeSizeFunction · 0.90
ensureSizedValueFunction · 0.90
buildFallbackPropsFunction · 0.90
serializeVariableValueFunction · 0.90
normalizeStyleValuesFunction · 0.85

Calls 3

scalePxValueFunction · 0.85
pxToRemFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected