Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@animini/core

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@animini/core - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

6

CHANGELOG.md
# @animini/core
## 0.2.1
### Patch Changes
- bf2fd1b: Internal refactoring
## 0.2.0

@@ -4,0 +10,0 @@

22

dist/animini-core.cjs.dev.js

@@ -295,3 +295,3 @@ 'use strict';

function buildAnimate(target) {
return function animate(element, currentValues, masterConfig) {
return function animate(element, masterConfig) {
const loop = target.loop || GlobalLoop;

@@ -303,2 +303,3 @@ const el = typeof element === 'object' && 'current' in element ? element : {

const animations = new Map();
let cachedValues;
let resolveRef;

@@ -321,6 +322,6 @@ let rejectRef;

values[key] = value;
adapter === null || adapter === void 0 ? void 0 : (_adapter$onChange = adapter.onChange) === null || _adapter$onChange === void 0 ? void 0 : _adapter$onChange.call(adapter, value, key, el.current, currentValues);
adapter === null || adapter === void 0 ? void 0 : (_adapter$onChange = adapter.onChange) === null || _adapter$onChange === void 0 ? void 0 : _adapter$onChange.call(adapter, value, key, el.current, cachedValues);
idle && (idle = animated.idle);
});
(_target$setValues = target.setValues) === null || _target$setValues === void 0 ? void 0 : _target$setValues.call(target, values, el.current, currentValues);
(_target$setValues = target.setValues) === null || _target$setValues === void 0 ? void 0 : _target$setValues.call(target, values, el.current);

@@ -347,4 +348,4 @@ if (idle) {

if (!animation) {
const [_value, _adapter] = target.getInitialValueAndAdapter(el.current, key, currentValues);
const value = _adapter !== null && _adapter !== void 0 && _adapter.parseInitial ? _adapter === null || _adapter === void 0 ? void 0 : _adapter.parseInitial(_value, key, el.current, currentValues) : _value;
const [_value, _adapter] = target.getInitialValueAndAdapter(el.current, key, cachedValues);
const value = _adapter !== null && _adapter !== void 0 && _adapter.parseInitial ? _adapter === null || _adapter === void 0 ? void 0 : _adapter.parseInitial(_value, key, el.current, cachedValues) : _value;
animated = new Animated(value, loop);

@@ -361,3 +362,3 @@ adapter = _adapter;

const _to = (_adapter2 = adapter) !== null && _adapter2 !== void 0 && _adapter2.parse ? adapter.parse(to[key], key, el.current, currentValues) : to[key];
const _to = (_adapter2 = adapter) !== null && _adapter2 !== void 0 && _adapter2.parse ? adapter.parse(to[key], key, el.current, cachedValues) : to[key];

@@ -386,2 +387,8 @@ animated.start(_to, typeof config === 'function' ? config(key) : config);

const setCachedValues = () => {
var _target$getCurrentVal;
cachedValues = (_target$getCurrentVal = target.getCurrentValues) === null || _target$getCurrentVal === void 0 ? void 0 : _target$getCurrentVal.call(target, el.current);
};
const api = {

@@ -391,3 +398,4 @@ get,

stop,
clean
clean,
setCachedValues
};

@@ -394,0 +402,0 @@ return api;

@@ -295,3 +295,3 @@ 'use strict';

function buildAnimate(target) {
return function animate(element, currentValues, masterConfig) {
return function animate(element, masterConfig) {
const loop = target.loop || GlobalLoop;

@@ -303,2 +303,3 @@ const el = typeof element === 'object' && 'current' in element ? element : {

const animations = new Map();
let cachedValues;
let resolveRef;

@@ -321,6 +322,6 @@ let rejectRef;

values[key] = value;
adapter === null || adapter === void 0 ? void 0 : (_adapter$onChange = adapter.onChange) === null || _adapter$onChange === void 0 ? void 0 : _adapter$onChange.call(adapter, value, key, el.current, currentValues);
adapter === null || adapter === void 0 ? void 0 : (_adapter$onChange = adapter.onChange) === null || _adapter$onChange === void 0 ? void 0 : _adapter$onChange.call(adapter, value, key, el.current, cachedValues);
idle && (idle = animated.idle);
});
(_target$setValues = target.setValues) === null || _target$setValues === void 0 ? void 0 : _target$setValues.call(target, values, el.current, currentValues);
(_target$setValues = target.setValues) === null || _target$setValues === void 0 ? void 0 : _target$setValues.call(target, values, el.current);

@@ -347,4 +348,4 @@ if (idle) {

if (!animation) {
const [_value, _adapter] = target.getInitialValueAndAdapter(el.current, key, currentValues);
const value = _adapter !== null && _adapter !== void 0 && _adapter.parseInitial ? _adapter === null || _adapter === void 0 ? void 0 : _adapter.parseInitial(_value, key, el.current, currentValues) : _value;
const [_value, _adapter] = target.getInitialValueAndAdapter(el.current, key, cachedValues);
const value = _adapter !== null && _adapter !== void 0 && _adapter.parseInitial ? _adapter === null || _adapter === void 0 ? void 0 : _adapter.parseInitial(_value, key, el.current, cachedValues) : _value;
animated = new Animated(value, loop);

@@ -361,3 +362,3 @@ adapter = _adapter;

const _to = (_adapter2 = adapter) !== null && _adapter2 !== void 0 && _adapter2.parse ? adapter.parse(to[key], key, el.current, currentValues) : to[key];
const _to = (_adapter2 = adapter) !== null && _adapter2 !== void 0 && _adapter2.parse ? adapter.parse(to[key], key, el.current, cachedValues) : to[key];

@@ -386,2 +387,8 @@ animated.start(_to, typeof config === 'function' ? config(key) : config);

const setCachedValues = () => {
var _target$getCurrentVal;
cachedValues = (_target$getCurrentVal = target.getCurrentValues) === null || _target$getCurrentVal === void 0 ? void 0 : _target$getCurrentVal.call(target, el.current);
};
const api = {

@@ -391,3 +398,4 @@ get,

stop,
clean
clean,
setCachedValues
};

@@ -394,0 +402,0 @@ return api;

@@ -292,3 +292,3 @@ import { c as clamp, l as lerp } from './lerp-839ad04d.esm.js';

function buildAnimate(target) {
return function animate(element, currentValues, masterConfig) {
return function animate(element, masterConfig) {
const loop = target.loop || GlobalLoop;

@@ -300,2 +300,3 @@ const el = typeof element === 'object' && 'current' in element ? element : {

const animations = new Map();
let cachedValues;
let resolveRef;

@@ -318,6 +319,6 @@ let rejectRef;

values[key] = value;
adapter === null || adapter === void 0 ? void 0 : (_adapter$onChange = adapter.onChange) === null || _adapter$onChange === void 0 ? void 0 : _adapter$onChange.call(adapter, value, key, el.current, currentValues);
adapter === null || adapter === void 0 ? void 0 : (_adapter$onChange = adapter.onChange) === null || _adapter$onChange === void 0 ? void 0 : _adapter$onChange.call(adapter, value, key, el.current, cachedValues);
idle && (idle = animated.idle);
});
(_target$setValues = target.setValues) === null || _target$setValues === void 0 ? void 0 : _target$setValues.call(target, values, el.current, currentValues);
(_target$setValues = target.setValues) === null || _target$setValues === void 0 ? void 0 : _target$setValues.call(target, values, el.current);

@@ -344,4 +345,4 @@ if (idle) {

if (!animation) {
const [_value, _adapter] = target.getInitialValueAndAdapter(el.current, key, currentValues);
const value = _adapter !== null && _adapter !== void 0 && _adapter.parseInitial ? _adapter === null || _adapter === void 0 ? void 0 : _adapter.parseInitial(_value, key, el.current, currentValues) : _value;
const [_value, _adapter] = target.getInitialValueAndAdapter(el.current, key, cachedValues);
const value = _adapter !== null && _adapter !== void 0 && _adapter.parseInitial ? _adapter === null || _adapter === void 0 ? void 0 : _adapter.parseInitial(_value, key, el.current, cachedValues) : _value;
animated = new Animated(value, loop);

@@ -358,3 +359,3 @@ adapter = _adapter;

const _to = (_adapter2 = adapter) !== null && _adapter2 !== void 0 && _adapter2.parse ? adapter.parse(to[key], key, el.current, currentValues) : to[key];
const _to = (_adapter2 = adapter) !== null && _adapter2 !== void 0 && _adapter2.parse ? adapter.parse(to[key], key, el.current, cachedValues) : to[key];

@@ -383,2 +384,8 @@ animated.start(_to, typeof config === 'function' ? config(key) : config);

const setCachedValues = () => {
var _target$getCurrentVal;
cachedValues = (_target$getCurrentVal = target.getCurrentValues) === null || _target$getCurrentVal === void 0 ? void 0 : _target$getCurrentVal.call(target, el.current);
};
const api = {

@@ -388,3 +395,4 @@ get,

stop,
clean
clean,
setCachedValues
};

@@ -391,0 +399,0 @@ return api;

import { Config, Payload, Target } from './types';
export declare function buildAnimate<ElementType, ValueType extends Payload>(target: Target<ElementType, ValueType>): (element: ElementType | {
current: ElementType;
}, currentValues: any, masterConfig?: Config) => {
}, masterConfig?: Config) => {
get: (key: keyof ValueType) => any;

@@ -9,2 +9,3 @@ start: (to: Partial<ValueType>, config?: Config | undefined) => Promise<unknown>;

clean: () => void;
setCachedValues: () => void;
};
import { AnimatedValue } from './animated/AnimatedValue';
import { FrameLoop } from './FrameLoop';
export declare type ParsedValue = number | number[] | Record<string, number>;
export declare type AdapterFn<ElementType, R> = (value: any, key: string | number | symbol, target: ElementType | undefined | null, currentValues: any) => R;
export declare type AdapterFn<ElementType, R> = (value: any, key: string | number | symbol, target: ElementType | undefined | null, cachedValues: any) => R;
export declare type Adapter<ElementType, ValueType extends Payload> = {

@@ -22,4 +22,5 @@ parse?: AdapterFn<ElementType, ParsedValue>;

loop?: FrameLoop;
setValues?(rawValues: ValueType, element: ElementType, payload: Partial<ValueType>): void;
getInitialValueAndAdapter<K extends keyof ValueType>(element: ElementType, key: K, currentValues?: any): [ValueType[K], Adapter<ElementType, ValueType> | undefined];
getCurrentValues?(element: ElementType): Record<string, any>;
setValues?(rawValues: ValueType, element: ElementType): void;
getInitialValueAndAdapter<K extends keyof ValueType>(element: ElementType, key: K, cachedValues?: any): [ValueType[K], Adapter<ElementType, ValueType> | undefined];
};

@@ -26,0 +27,0 @@ export declare type ConfigValue = {

{
"name": "@animini/core",
"version": "0.2.0",
"version": "0.2.1",
"description": "Core of animini",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -16,3 +16,3 @@ import { Animated } from './animated/Animated'

export function buildAnimate<ElementType, ValueType extends Payload>(target: Target<ElementType, ValueType>) {
return function animate(element: ElementType | { current: ElementType }, currentValues: any, masterConfig?: Config) {
return function animate(element: ElementType | { current: ElementType }, masterConfig?: Config) {
const loop = target.loop || GlobalLoop

@@ -22,2 +22,3 @@ const el = typeof element === 'object' && 'current' in element ? element : { current: element }

const animations = new Map<keyof ValueType, Animation<ElementType, ValueType>>()
let cachedValues: any
let resolveRef: (value?: unknown) => void

@@ -35,6 +36,6 @@ let rejectRef: (value?: unknown) => void

values[key] = value
adapter?.onChange?.(value, key, el.current, currentValues)
adapter?.onChange?.(value, key, el.current, cachedValues)
idle &&= animated.idle
})
target.setValues?.(values, el.current, currentValues)
target.setValues?.(values, el.current)
if (idle) {

@@ -58,5 +59,5 @@ loop.stop(update)

if (!animation) {
const [_value, _adapter] = target.getInitialValueAndAdapter(el.current, key, currentValues)
const [_value, _adapter] = target.getInitialValueAndAdapter(el.current, key, cachedValues)
const value = _adapter?.parseInitial
? _adapter?.parseInitial(_value, key, el.current, currentValues)
? _adapter?.parseInitial(_value, key, el.current, cachedValues)
: _value

@@ -71,3 +72,3 @@ animated = new Animated(value, loop)

const _to = adapter?.parse ? adapter.parse(to[key], key, el.current, currentValues) : (to[key] as ParsedValue)
const _to = adapter?.parse ? adapter.parse(to[key], key, el.current, cachedValues) : (to[key] as ParsedValue)
animated.start(_to, typeof config === 'function' ? config(key) : config)

@@ -93,5 +94,8 @@ idle &&= animated.idle

const get = (key: keyof ValueType) => values[key]
const api = { get, start, stop, clean }
const setCachedValues = () => {
cachedValues = target.getCurrentValues?.(el.current)
}
const api = { get, start, stop, clean, setCachedValues }
return api
}
}

@@ -10,3 +10,3 @@ import { AnimatedValue } from './animated/AnimatedValue'

target: ElementType | undefined | null,
currentValues: any
cachedValues: any
) => R

@@ -35,7 +35,8 @@

loop?: FrameLoop
setValues?(rawValues: ValueType, element: ElementType, payload: Partial<ValueType>): void
getCurrentValues?(element: ElementType): Record<string, any>
setValues?(rawValues: ValueType, element: ElementType): void
getInitialValueAndAdapter<K extends keyof ValueType>(
element: ElementType,
key: K,
currentValues?: any
cachedValues?: any
): [ValueType[K], Adapter<ElementType, ValueType> | undefined]

@@ -42,0 +43,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc