@synergy-design-system/components
Version:
This package provides the base of the Synergy Design System as native web components. It uses [lit](https://www.lit.dev) and parts of [shoelace](https://shoelace.style/). Synergy officially supports the latest two versions of all major browsers (as define
48 lines (45 loc) • 1.53 kB
JavaScript
import {
__spreadProps,
__spreadValues
} from "./chunk.Z4XV3SMG.js";
// src/utilities/animation-registry.ts
var defaultAnimationRegistry = /* @__PURE__ */ new Map();
var customAnimationRegistry = /* @__PURE__ */ new WeakMap();
function ensureAnimation(animation) {
return animation != null ? animation : { keyframes: [], options: { duration: 0 } };
}
function getLogicalAnimation(animation, dir) {
if (dir.toLowerCase() === "rtl") {
return {
keyframes: animation.rtlKeyframes || animation.keyframes,
options: animation.options
};
}
return animation;
}
function setDefaultAnimation(animationName, animation) {
defaultAnimationRegistry.set(animationName, ensureAnimation(animation));
}
function setAnimation(el, animationName, animation) {
customAnimationRegistry.set(el, __spreadProps(__spreadValues({}, customAnimationRegistry.get(el)), { [animationName]: ensureAnimation(animation) }));
}
function getAnimation(el, animationName, options) {
const customAnimation = customAnimationRegistry.get(el);
if (customAnimation == null ? void 0 : customAnimation[animationName]) {
return getLogicalAnimation(customAnimation[animationName], options.dir);
}
const defaultAnimation = defaultAnimationRegistry.get(animationName);
if (defaultAnimation) {
return getLogicalAnimation(defaultAnimation, options.dir);
}
return {
keyframes: [],
options: { duration: 0 }
};
}
export {
setDefaultAnimation,
setAnimation,
getAnimation
};
//# sourceMappingURL=chunk.7JGKUB4A.js.map