motion-dom
Version:
1 lines • 1.75 kB
Source Map (JSON)
{"version":3,"file":"animatable-none.mjs","sources":["../../../../../src/value/types/utils/animatable-none.ts"],"sourcesContent":["import { complex } from \"../complex\"\nimport { filter } from \"../complex/filter\"\nimport { mask } from \"../complex/mask\"\nimport { getDefaultValueType } from \"../maps/defaults\"\n\nconst customTypes = /*@__PURE__*/ new Set([filter, mask])\n\n/**\n * The last call and its result. animate() on many elements asks for the\n * same none for each one, and parsing the value is the slow part.\n */\nlet lastKey: string | undefined\nlet lastValue: string | undefined\nlet lastNone: any\n\nexport function getAnimatableNone(key: string, value: string) {\n if (key === lastKey && value === lastValue) return lastNone\n\n let defaultValueType = getDefaultValueType(key)\n if (!customTypes.has(defaultValueType as any)) defaultValueType = complex\n // If value is not recognised as animatable, ie \"none\", create an animatable version origin based on the target\n lastNone = defaultValueType.getAnimatableNone\n ? defaultValueType.getAnimatableNone(value)\n : undefined\n lastKey = key\n lastValue = value\n\n return lastNone\n}\n"],"names":[],"mappings":";;;;;AAKA,MAAM,WAAW,iBAAiB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAEzD;;;AAGG;AACH,IAAI,OAA2B;AAC/B,IAAI,SAA6B;AACjC,IAAI,QAAa;AAEX,SAAU,iBAAiB,CAAC,GAAW,EAAE,KAAa,EAAA;AACxD,IAAA,IAAI,GAAG,KAAK,OAAO,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,QAAQ;AAE3D,IAAA,IAAI,gBAAgB,GAAG,mBAAmB,CAAC,GAAG,CAAC;AAC/C,IAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAuB,CAAC;QAAE,gBAAgB,GAAG,OAAO;;IAEzE,QAAQ,GAAG,gBAAgB,CAAC;AACxB,UAAE,gBAAgB,CAAC,iBAAiB,CAAC,KAAK;UACxC,SAAS;IACf,OAAO,GAAG,GAAG;IACb,SAAS,GAAG,KAAK;AAEjB,IAAA,OAAO,QAAQ;AACnB;;;;"}