New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

xiaohe-transition

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

xiaohe-transition - npm Package Compare versions

Comparing version 0.0.14 to 0.0.16

6

lib/esm/index.d.ts
import XhTransition from "./transition.js";
import XhTransitionTimer from "./timer.js";
import XhTransitionRepeater from "./repeater.js";
export * from "./types.js";
export * from "./config.js";
export * from "./utils.js";
export * from "./timer.js";
export * from "./repeater.js";
export { XhTransition as default, XhTransition };
export { XhTransition as default, XhTransition, XhTransitionTimer, XhTransitionRepeater };

@@ -1,1 +0,1 @@

export{default as XhTransition,default}from"./transition.js";export{XhTransitionPresetBezier,XhTransitionRepeatDirection,XhTransitionRepeatMode,XhTransitionWorkStatus}from"./types.js";export{XhDefaultTransitionCompatibleFps,XhDefaultTransitionDelay,XhDefaultTransitionDuration,XhDefaultTransitionFps,XhDefaultTransitionPreset,XhDefaultTransitionRepeatCount,XhDefaultTransitionRepeatMode,XhTransitionPresetBezierConfig}from"./config.js";export{fps2ms}from"./utils.js";export{XhTransitionTimer}from"./timer.js";export{XhTransitionRepeater}from"./repeater.js";import"bezier-easing";
export{default as XhTransition,default}from"./transition.js";export{default as XhTransitionTimer}from"./timer.js";export{default as XhTransitionRepeater}from"./repeater.js";export{XhTransitionPresetBezier,XhTransitionRepeatDirection,XhTransitionRepeatMode,XhTransitionWorkStatus}from"./types.js";export{XhDefaultTransitionCompatibleFps,XhDefaultTransitionDelay,XhDefaultTransitionDuration,XhDefaultTransitionFps,XhDefaultTransitionPreset,XhDefaultTransitionRepeatCount,XhDefaultTransitionRepeatMode,XhTransitionPresetBezierConfig}from"./config.js";export{fps2ms}from"./utils.js";import"bezier-easing";

@@ -157,2 +157,2 @@ import { IXhTransitionRepeaterOptions, XhTransitionRepeatDirection, XhTransitionWorkStatus } from "./types.js";

}
export { XhTransitionRepeater };
export { XhTransitionRepeater as default };

@@ -1,1 +0,1 @@

import{XhTransitionWorkStatus as t,XhTransitionRepeatDirection as s,XhTransitionRepeatMode as i}from"./types.js";import{XhDefaultTransitionRepeatCount as r,XhDefaultTransitionRepeatMode as o}from"./config.js";class n{_transition;_options;_status=t.free;_counts=0;_direction=s.forward;constructor(t,s){this._transition=t,this._options=s??{}}options(t){return null!=t&&(this._options=Object.assign({},this._options,t)),this._options}status(){return this._status}counts(){return this._counts}direction(){return this._direction}start(n){this.status()!==t.free&&this.stop();const{count:e=r,mode:a=o}=this.options(n),h=t=>{if(this._counts+=1,this._options.repeated?.(this.counts(),this,t),e>0&&this.counts()>=e)return;const{start:r,target:o}=t.options();switch(a){case i.normal:t.start({start:r,target:o,completed:h}),this._direction=s.forward;break;case i.alternate:{const i=this.direction();switch(t.start({start:o,target:r,completed:h}),i){case s.forward:this._direction=s.backward;break;case s.backward:this._direction=s.forward}break}}};return this._transition.start({completed:h}),this._status=t.working,this._options.started?.(this,this._transition),this}pause(){return this.status()!==t.working||(this._transition.pause(),this._status=t.paused,this._options.paused?.(this,this._transition)),this}resume(){return this.status()!==t.paused||(this._transition.resume(),this._status=t.working,this._options.resumed?.(this,this._transition)),this}stop(){return this._transition.stop(),this.reset(),this._options.stopped?.(this,this._transition),this}reset(){this._status=t.free,this._counts=0,this._direction=s.forward}}export{n as XhTransitionRepeater};
import{XhTransitionWorkStatus as t,XhTransitionRepeatDirection as s,XhTransitionRepeatMode as i}from"./types.js";import{XhDefaultTransitionRepeatCount as r,XhDefaultTransitionRepeatMode as o}from"./config.js";class n{_transition;_options;_status=t.free;_counts=0;_direction=s.forward;constructor(t,s){this._transition=t,this._options=s??{}}options(t){return null!=t&&(this._options=Object.assign({},this._options,t)),this._options}status(){return this._status}counts(){return this._counts}direction(){return this._direction}start(n){this.status()!==t.free&&this.stop();const{count:e=r,mode:a=o}=this.options(n),h=t=>{if(this._counts+=1,this._options.repeated?.(this.counts(),this,t),e>0&&this.counts()>=e)return;const{start:r,target:o}=t.options();switch(a){case i.normal:t.start({start:r,target:o,completed:h}),this._direction=s.forward;break;case i.alternate:{const i=this.direction();switch(t.start({start:o,target:r,completed:h}),i){case s.forward:this._direction=s.backward;break;case s.backward:this._direction=s.forward}break}}};return this._transition.start({completed:h}),this._status=t.working,this._options.started?.(this,this._transition),this}pause(){return this.status()!==t.working||(this._transition.pause(),this._status=t.paused,this._options.paused?.(this,this._transition)),this}resume(){return this.status()!==t.paused||(this._transition.resume(),this._status=t.working,this._options.resumed?.(this,this._transition)),this}stop(){return this._transition.stop(),this.reset(),this._options.stopped?.(this,this._transition),this}reset(){this._status=t.free,this._counts=0,this._direction=s.forward}}export{n as default};

@@ -116,2 +116,2 @@ import { NullableNumber, XhTransitionTimerCallback } from "./types.js";

}
export { XhTransitionTimer };
export { XhTransitionTimer as default };

@@ -1,1 +0,1 @@

import{XhDefaultTransitionCompatibleFps as i}from"./config.js";import{fps2ms as t}from"./utils.js";import"./types.js";class s{_id=null;_timing=!1;_fps;_callback;constructor(t,s){this._fps=t>0?t:this.supportAnimationFrame()?-1:i,this._callback=s}id(){return this._id}start(){return this.stop(),this.useAnimationFrame()?this._id=requestAnimationFrame((()=>{this.animate()})):this._id=setInterval((()=>{this._callback()}),t(this._fps)),this._timing=!0,this}stop(){return null==this._id||(this.useAnimationFrame()?cancelAnimationFrame(this._id):clearInterval(this._id),this._timing=!1,this._id=null),this}animate(){this._timing&&(this._callback(),this._id=requestAnimationFrame((()=>{this.animate()})))}supportAnimationFrame(){return"function"==typeof requestAnimationFrame}useAnimationFrame(){return this.supportAnimationFrame()&&this._fps<=0}}export{s as XhTransitionTimer};
import{XhDefaultTransitionCompatibleFps as i}from"./config.js";import{fps2ms as t}from"./utils.js";import"./types.js";class s{_id=null;_timing=!1;_fps;_callback;constructor(t,s){this._fps=t>0?t:this.supportAnimationFrame()?-1:i,this._callback=s}id(){return this._id}start(){return this.stop(),this.useAnimationFrame()?this._id=requestAnimationFrame((()=>{this.animate()})):this._id=setInterval((()=>{this._callback()}),t(this._fps)),this._timing=!0,this}stop(){return null==this._id||(this.useAnimationFrame()?cancelAnimationFrame(this._id):clearInterval(this._id),this._timing=!1,this._id=null),this}animate(){this._timing&&(this._callback(),this._id=requestAnimationFrame((()=>{this.animate()})))}supportAnimationFrame(){return"function"==typeof requestAnimationFrame}useAnimationFrame(){return this.supportAnimationFrame()&&this._fps<=0}}export{s as default};

@@ -1,1 +0,1 @@

import{XhTransitionWorkStatus as t}from"./types.js";import{XhTransitionPresetBezierConfig as s,XhDefaultTransitionDuration as i,XhDefaultTransitionPreset as e,XhDefaultTransitionDelay as r,XhDefaultTransitionFps as o}from"./config.js";import{XhTransitionTimer as h}from"./timer.js";import a from"bezier-easing";import"./utils.js";class n{_options;_callback;_status=t.free;_progress=0;_bezier=null;_timer=null;_last=0;_pauses=0;constructor(t,s){"function"==typeof t?(this._options={},this._callback=t):(this._options=t,this._callback=s)}options(t){return null!=t&&(this._options=Object.assign({},this._options,t)),this._options}status(){return this._status}progress(){return this._progress}value(){const{start:t=0,target:s=0}=this._options;if(null==this._bezier)throw new Error("需要先调用XhTransition#start方法以创建BezierEasing实例!");return this._bezier(this.progress())*(s-t)+t}start(n){this.status()!==t.free&&this.stop();const{duration:_=i,preset:p=e,bezier:u,delay:l=r,fps:m=o}=this.options(n);this._bezier=a(...u??s[p]);const c=Date.now()+l;return this._timer=new h(m,(()=>{const t=(Date.now()-c-this._pauses)/_;this._progress=Math.max(0,Math.min(1,t)),this._callback(this.value(),this),this.progress()>=1&&(this.stop(),this._options.completed?.(this))})).start(),this._status=t.working,this._options.started?.(this),this}pause(){return this.status()!==t.working||null==this._timer||(this._timer.stop(),this._last=Date.now(),this._status=t.paused,this._options.paused?.(this)),this}resume(){return this.status()!==t.paused||null==this._timer||(this._last>0&&(this._pauses+=Date.now()-this._last),this._timer.start(),this._status=t.working,this._options.resumed?.(this)),this}stop(){return null!=this._timer&&(this._timer.stop(),this._timer=null),this.reset(),this._options.stopped?.(this),this}reset(){this._status=t.free,this._progress=0,this._bezier=null,this._last=0,this._pauses=0}}export{n as default};
import{XhTransitionWorkStatus as t}from"./types.js";import{XhTransitionPresetBezierConfig as s,XhDefaultTransitionDuration as i,XhDefaultTransitionPreset as e,XhDefaultTransitionDelay as r,XhDefaultTransitionFps as o}from"./config.js";import h from"./timer.js";import a from"bezier-easing";import"./utils.js";class n{_options;_callback;_status=t.free;_progress=0;_bezier=null;_timer=null;_last=0;_pauses=0;constructor(t,s){"function"==typeof t?(this._options={},this._callback=t):(this._options=t,this._callback=s)}options(t){return null!=t&&(this._options=Object.assign({},this._options,t)),this._options}status(){return this._status}progress(){return this._progress}value(){const{start:t=0,target:s=0}=this._options;if(null==this._bezier)throw new Error("需要先调用XhTransition#start方法以创建BezierEasing实例!");return this._bezier(this.progress())*(s-t)+t}start(n){this.status()!==t.free&&this.stop();const{duration:_=i,preset:p=e,bezier:u,delay:l=r,fps:m=o}=this.options(n);this._bezier=a(...u??s[p]);const c=Date.now()+l;return this._timer=new h(m,(()=>{const t=(Date.now()-c-this._pauses)/_;this._progress=Math.max(0,Math.min(1,t)),this._callback(this.value(),this),this.progress()>=1&&(this.stop(),this._options.completed?.(this))})).start(),this._status=t.working,this._options.started?.(this),this}pause(){return this.status()!==t.working||null==this._timer||(this._timer.stop(),this._last=Date.now(),this._status=t.paused,this._options.paused?.(this)),this}resume(){return this.status()!==t.paused||null==this._timer||(this._last>0&&(this._pauses+=Date.now()-this._last),this._timer.start(),this._status=t.working,this._options.resumed?.(this)),this}stop(){return null!=this._timer&&(this._timer.stop(),this._timer=null),this.reset(),this._options.stopped?.(this),this}reset(){this._status=t.free,this._progress=0,this._bezier=null,this._last=0,this._pauses=0}}export{n as default};
import XhTransition from "./transition.js";
import { XhTransitionRepeater } from "./repeater.js";
import XhTransitionRepeater from "./repeater.js";
type NullableBoolean = boolean | null;

@@ -4,0 +4,0 @@ type NullableNumber = number | null;

{
"name": "xiaohe-transition",
"version": "0.0.14",
"version": "0.0.16",
"description": "🏀 一个简单易用的贝塞尔曲线过渡动画工具",

@@ -5,0 +5,0 @@ "scripts": {

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