UNPKG

framer-motion

Version:

A simple and powerful JavaScript animation library

1 lines 1.5 kB
{"version":3,"file":"render.mjs","sources":["../../../../../src/render/html/utils/render.ts"],"sourcesContent":["import { MotionStyle } from \"../../..\"\nimport { IProjectionNode } from \"../../../projection/node/types\"\nimport { HTMLRenderState } from \"../types\"\n\nexport function renderHTML(\n element: HTMLElement,\n { style, vars }: HTMLRenderState,\n styleProp?: MotionStyle,\n projection?: IProjectionNode\n) {\n const elementStyle = element.style\n\n let key: string\n for (key in style) {\n // CSSStyleDeclaration has [index: number]: string; in the types, so we use that as key type.\n elementStyle[key as unknown as number] = style[key] as string\n }\n\n // Write projection styles directly to element style\n projection?.applyProjectionStyles(elementStyle, styleProp)\n\n for (key in vars) {\n // Loop over any CSS variables and assign those.\n // They can only be assigned using `setProperty`.\n elementStyle.setProperty(key, vars[key] as string)\n }\n}\n"],"names":[],"mappings":"AAIgB,SAAA,UAAU,CACtB,OAAoB,EACpB,EAAE,KAAK,EAAE,IAAI,EAAmB,EAChC,SAAuB,EACvB,UAA4B,EAAA;AAE5B,IAAA,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAA;AAElC,IAAA,IAAI,GAAW,CAAA;AACf,IAAA,KAAK,GAAG,IAAI,KAAK,EAAE;;QAEf,YAAY,CAAC,GAAwB,CAAC,GAAG,KAAK,CAAC,GAAG,CAAW,CAAA;KAChE;;AAGD,IAAA,UAAU,EAAE,qBAAqB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA;AAE1D,IAAA,KAAK,GAAG,IAAI,IAAI,EAAE;;;QAGd,YAAY,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAW,CAAC,CAAA;KACrD;AACL;;;;"}