@slidy/easing
Advanced tools
+1
-1
@@ -1,1 +0,1 @@ | ||
| "use strict";var i=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var x=(n,c)=>{for(var s in c)i(n,s,{get:c[s],enumerable:!0})},m=(n,c,s,a)=>{if(c&&typeof c=="object"||typeof c=="function")for(let o of b(c))!f.call(n,o)&&o!==s&&i(n,o,{get:()=>c[o],enumerable:!(a=q(c,o))||a.enumerable});return n};var y=n=>m(i({},"__esModule",{value:!0}),n);var w={};x(w,{back:()=>l,bounce:()=>E,circ:()=>M,cubic:()=>t,elastic:()=>h,expo:()=>d,linear:()=>e,quad:()=>r,quart:()=>u,quint:()=>g,sine:()=>p});module.exports=y(w);var e=n=>n,r=n=>n*n,t=n=>n*n*n,u=n=>n*n*n*n,g=n=>n*n*n*n*n,E=n=>1-(s=>s<.36363636363636365?7.5625*s*s:s<.7272727272727273?7.5625*(s-=.5454545454545454)*s+.75:s<.9090909090909091?7.5625*(s-=.8181818181818182)*s+.9375:7.5625*(s-=.9545454545454546)*s+.984375)(1-n),p=n=>1-Math.cos(n*Math.PI/2),d=n=>n===0?0:Math.pow(2,10*n-10),h=n=>{let c=2*Math.PI/3;return n===0?0:n===1?1:-Math.pow(2,10*n-10)*Math.sin((n*10-10.75)*c)},M=n=>1-Math.sqrt(1-Math.pow(n,2)),l=n=>2.70158*n*n*n-1.70158*n*n; | ||
| "use strict";var i=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var k=(n,s)=>{for(var c in s)i(n,c,{get:s[c],enumerable:!0})},h=(n,s,c,u)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of m(s))!y.call(n,o)&&o!==c&&i(n,o,{get:()=>s[o],enumerable:!(u=x(s,o))||u.enumerable});return n};var w=n=>h(i({},"__esModule",{value:!0}),n);var j={};k(j,{back:()=>q,bounce:()=>b,circ:()=>l,cubic:()=>g,elastic:()=>f,expo:()=>d,linear:()=>a,quad:()=>t,quart:()=>E,quint:()=>F,sine:()=>p});module.exports=w(j);var{cos:I,sin:M,pow:e,sqrt:P,PI:r}=Math,a=n=>n,t=n=>n*n,g=n=>n*n*n,E=n=>n*n*n*n,F=n=>n*n*n*n*n,p=n=>1-I(n*r/2),d=n=>n===0?0:e(2,10*n-10),l=n=>1-P(1-e(n,2)),q=n=>2.70158*n*n*n-1.70158*n*n,b=n=>1-(c=>c<.36363636363636365?7.5625*c*c:c<.7272727272727273?7.5625*(c-=.5454545454545454)*c+.75:c<.9090909090909091?7.5625*(c-=.8181818181818182)*c+.9375:7.5625*(c-=.9545454545454546)*c+.984375)(1-n),f=n=>{let s=2*r/3;return n%1?-e(2,10*n-10)*M((n*10-10.75)*s):n}; |
+245
-2
@@ -1,2 +0,245 @@ | ||
| export { linear, quad, cubic, quart, quint, bounce, sine, expo, elastic, circ, back, } from './easing'; | ||
| export type { Easing } from './types'; | ||
| declare module "core/src/types" { | ||
| /** | ||
| * Slidy options object | ||
| * @see https://github.com/Valexr/slidy/tree/master/packages/core#options | ||
| */ | ||
| export interface Options { | ||
| /** | ||
| * Sliding index | ||
| */ | ||
| index?: number; | ||
| /** | ||
| * Sliding position. Setter working only in `snap: undefined` mode; | ||
| */ | ||
| position?: number; | ||
| /** | ||
| * Clamping sliding by index: `clamp - index + clamp` | ||
| */ | ||
| clamp?: number; | ||
| /** | ||
| * Part of gap padding both start/end edges of slide `gap * indent` | ||
| */ | ||
| indent?: number; | ||
| /** | ||
| * How many pixels to drag in the RAF `~16ms` to start move, `0` when sliding | ||
| */ | ||
| sensity?: number; | ||
| /** | ||
| * Sliding gravity: `0(space) ~ 1(eath) ~ 2(underground)` | ||
| */ | ||
| gravity?: number; | ||
| /** | ||
| * Sliding duration in ms | ||
| */ | ||
| duration?: number; | ||
| /** | ||
| * Custom slide animation. | ||
| * @see https://github.com/Valexr/Slidy/tree/master/packages/animation | ||
| */ | ||
| animation?: AnimationFunc; | ||
| /** | ||
| * Inertion scroll easing behaviour. | ||
| * @see https://github.com/Valexr/Slidy/tree/master/packages/easing | ||
| */ | ||
| easing?: EasingFunc; | ||
| /** | ||
| * Slidy plugins. | ||
| * @see https://github.com/Valexr/Slidy/tree/master/packages/plugins | ||
| */ | ||
| plugins?: ReturnType<PluginFunc>[]; | ||
| /** | ||
| * Control coordinate axis: `'x'`, `'y'`. | ||
| */ | ||
| axis?: Axis; | ||
| /** | ||
| * Snapping side: `'start', 'center', 'end', 'deck', undefined`. Default clamp sliding by edges. | ||
| */ | ||
| snap?: Snap; | ||
| /** | ||
| * Makes the slideshow continious. | ||
| */ | ||
| loop?: boolean; | ||
| /** | ||
| * Children move direction | ||
| * @readonly | ||
| */ | ||
| direction?: number; | ||
| /** | ||
| * Children vertical flow | ||
| * @readonly | ||
| */ | ||
| vertical?: boolean; | ||
| /** | ||
| * Children reverse flow: `-1` or `1` | ||
| * @readonly | ||
| */ | ||
| reverse?: number; | ||
| /** | ||
| * Children full width size gaps > target node size | ||
| * @readonly | ||
| */ | ||
| scrollable?: boolean; | ||
| /** | ||
| * Scroll position on one of the edges | ||
| * @readonly | ||
| */ | ||
| edged?: boolean; | ||
| } | ||
| type Axis = 'x' | 'y' | 'both'; | ||
| type Snap = 'start' | 'center' | 'end' | 'deck'; | ||
| export interface UniqEvent extends PointerEvent { | ||
| touches: TouchList; | ||
| deltaX: number; | ||
| deltaY: number; | ||
| } | ||
| export type EventMap = [string, EventListener, AddEventListenerOptions?]; | ||
| export type Detail = Record<string, any> | HTMLCollectionOf<Child> | HTMLElement | Options | string; | ||
| /** Easing function. | ||
| * @param t value from 0 to 1 | ||
| * @returns value from 0 to 1 | ||
| * @default linear | ||
| * @see https://easings.net | ||
| */ | ||
| export type EasingFunc = (t: number) => number; | ||
| export interface Child extends HTMLElement { | ||
| i: number; | ||
| index: number; | ||
| active: number; | ||
| size: number; | ||
| dist: number; | ||
| track: number; | ||
| turn: number; | ||
| exp: number; | ||
| } | ||
| export type AnimationArgs = { | ||
| node: HTMLElement; | ||
| child: Child; | ||
| options: Partial<Options>; | ||
| translate: string; | ||
| }; | ||
| /** | ||
| * Animation function | ||
| * @see https://github.com/Valexr/Slidy/tree/master/packages/animation | ||
| * ```ts | ||
| * AnimationArgs = { | ||
| * node: HTMLElement; | ||
| * child: Child; | ||
| * options: Partial<Options>; | ||
| * translate: string; | ||
| * } | ||
| * ``` | ||
| */ | ||
| export type AnimationFunc = (args: AnimationArgs) => Partial<CSSStyleDeclaration>; | ||
| export type PluginArgs = { | ||
| node: HTMLElement; | ||
| options: Options; | ||
| instance: SlidyInstance; | ||
| }; | ||
| /** | ||
| * Plugin function | ||
| * @see https://github.com/Valexr/Slidy/tree/master/packages/plugin | ||
| * | ||
| * ```ts | ||
| * PluginArgs = { | ||
| * node: HTMLElement, | ||
| * options: Options, | ||
| * instance: SlidyInstance | ||
| * } | ||
| * ``` | ||
| */ | ||
| export type PluginFunc = (params?: unknown) => (args: PluginArgs) => void; | ||
| export interface Dom { | ||
| edges: (index?: number) => boolean; | ||
| distance: (index: number, snap?: Options['snap']) => number; | ||
| index(target: number): number; | ||
| position(replace?: boolean): number; | ||
| swap(dir: number): number; | ||
| sense(e: UniqEvent, pos: number, sensity?: number): boolean; | ||
| animate(): void; | ||
| } | ||
| export interface SlidyInstance { | ||
| /** | ||
| * Init slidy() instance | ||
| */ | ||
| init: (node: HTMLElement) => void; | ||
| /** | ||
| * Update any property in options | ||
| */ | ||
| update: (options: Partial<Options>) => void; | ||
| /** | ||
| * Scroll to `index` or `position` | ||
| */ | ||
| to: (index: number, position?: number) => void; | ||
| /** | ||
| * Remove event listners, observers & defaulted props on `slidy()` instance | ||
| */ | ||
| destroy: () => Promise<void>; | ||
| } | ||
| } | ||
| declare module "core/src/lib/utils" { | ||
| import type { Options, PluginFunc } from "core/src/types"; | ||
| const assign: { | ||
| <T extends {}, U>(target: T, source: U): T & U; | ||
| <T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V; | ||
| <T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W; | ||
| (target: object, ...sources: any[]): any; | ||
| }, entries: { | ||
| <T>(o: { | ||
| [s: string]: T; | ||
| } | ArrayLike<T>): [string, T][]; | ||
| (o: {}): [string, any][]; | ||
| }; | ||
| const abs: (x: number) => number, exp: (x: number) => number, floor: (x: number) => number, max: (...values: number[]) => number, round: (x: number) => number, sign: (x: number) => number; | ||
| function clamp(mn: number, val: number, mx: number): number; | ||
| function throttle(fn: (args: any) => void, ms?: number, th?: boolean | number): (args: any) => void; | ||
| function loop(array: string | any[] | HTMLCollection | Array<Partial<Options>> | PluginFunc[], cb: (item: typeof array[number], i: number, array: any) => void): string | any[] | HTMLCollection | Partial<Options>[] | PluginFunc[]; | ||
| export { assign, abs, exp, floor, max, round, sign, clamp, entries, loop, throttle }; | ||
| } | ||
| declare module "core/src/lib/env" { | ||
| import type { Options, UniqEvent, Detail, EventMap } from "core/src/types"; | ||
| const X: (e: UniqEvent | WheelEvent, options: Partial<Options>) => boolean; | ||
| function mount(node: HTMLElement, count?: number): Promise<unknown>; | ||
| function indexing(node: HTMLElement, options: Partial<Options>, index: number): number; | ||
| function coordinate(e: UniqEvent, options: Partial<Options>): number; | ||
| function dispatch(node: HTMLElement, name: string, detail?: Detail): void; | ||
| function listen(node: Window | HTMLElement, events: EventMap[], on?: boolean): void; | ||
| export { mount, listen, dispatch, indexing, coordinate, X }; | ||
| } | ||
| declare module "core/src/lib/dom" { | ||
| import type { Dom, Options } from "core/src/types"; | ||
| export function dom(node: HTMLElement, options: Partial<Options>): Dom; | ||
| } | ||
| declare module "core/src/lib/slidy" { | ||
| import type { Options, SlidyInstance } from "core/src/types"; | ||
| /** | ||
| * Simple, configurable, nested & reusable sliding action script | ||
| * @see https://github.com/Valexr/slidy/tree/master/packages/core | ||
| */ | ||
| export function slidy(node: HTMLElement, opts: Partial<Options>): SlidyInstance; | ||
| } | ||
| declare module "core/src/index" { | ||
| export { slidy } from "core/src/lib/slidy"; | ||
| export type { Options, SlidyInstance, EasingFunc, AnimationFunc, AnimationArgs, PluginFunc, PluginArgs, EventMap, } from "core/src/types"; | ||
| } | ||
| declare module "easing/src/types" { | ||
| export type { EasingFunc } from "core/src/index"; | ||
| } | ||
| declare module "easing/src/easing" { | ||
| import type { EasingFunc } from "easing/src/types"; | ||
| const linear: EasingFunc; | ||
| const quad: EasingFunc; | ||
| const cubic: EasingFunc; | ||
| const quart: EasingFunc; | ||
| const quint: EasingFunc; | ||
| const sine: EasingFunc; | ||
| const expo: EasingFunc; | ||
| const circ: EasingFunc; | ||
| const back: EasingFunc; | ||
| const bounce: EasingFunc; | ||
| const elastic: EasingFunc; | ||
| export { linear, quad, cubic, quart, quint, bounce, sine, expo, elastic, circ, back }; | ||
| } | ||
| declare module "@slidy/easing" { | ||
| export { linear, quad, cubic, quart, quint, bounce, sine, expo, elastic, circ, back, } from "easing/src/easing"; | ||
| export type { EasingFunc } from "easing/src/types"; | ||
| } |
+1
-1
@@ -1,1 +0,1 @@ | ||
| "use strict";var SlidyEasing=(()=>{var i=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var x=(n,c)=>{for(var s in c)i(n,s,{get:c[s],enumerable:!0})},m=(n,c,s,a)=>{if(c&&typeof c=="object"||typeof c=="function")for(let o of b(c))!f.call(n,o)&&o!==s&&i(n,o,{get:()=>c[o],enumerable:!(a=q(c,o))||a.enumerable});return n};var y=n=>m(i({},"__esModule",{value:!0}),n);var w={};x(w,{back:()=>l,bounce:()=>E,circ:()=>M,cubic:()=>t,elastic:()=>h,expo:()=>d,linear:()=>e,quad:()=>r,quart:()=>u,quint:()=>g,sine:()=>p});var e=n=>n,r=n=>n*n,t=n=>n*n*n,u=n=>n*n*n*n,g=n=>n*n*n*n*n,E=n=>1-(s=>s<.36363636363636365?7.5625*s*s:s<.7272727272727273?7.5625*(s-=.5454545454545454)*s+.75:s<.9090909090909091?7.5625*(s-=.8181818181818182)*s+.9375:7.5625*(s-=.9545454545454546)*s+.984375)(1-n),p=n=>1-Math.cos(n*Math.PI/2),d=n=>n===0?0:Math.pow(2,10*n-10),h=n=>{let c=2*Math.PI/3;return n===0?0:n===1?1:-Math.pow(2,10*n-10)*Math.sin((n*10-10.75)*c)},M=n=>1-Math.sqrt(1-Math.pow(n,2)),l=n=>2.70158*n*n*n-1.70158*n*n;return y(w);})(); | ||
| "use strict";var SlidyEasing=(()=>{var i=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var k=(n,s)=>{for(var c in s)i(n,c,{get:s[c],enumerable:!0})},h=(n,s,c,u)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of m(s))!y.call(n,o)&&o!==c&&i(n,o,{get:()=>s[o],enumerable:!(u=x(s,o))||u.enumerable});return n};var w=n=>h(i({},"__esModule",{value:!0}),n);var j={};k(j,{back:()=>q,bounce:()=>b,circ:()=>l,cubic:()=>g,elastic:()=>f,expo:()=>d,linear:()=>a,quad:()=>t,quart:()=>E,quint:()=>F,sine:()=>p});var{cos:I,sin:M,pow:e,sqrt:P,PI:r}=Math,a=n=>n,t=n=>n*n,g=n=>n*n*n,E=n=>n*n*n*n,F=n=>n*n*n*n*n,p=n=>1-I(n*r/2),d=n=>n===0?0:e(2,10*n-10),l=n=>1-P(1-e(n,2)),q=n=>2.70158*n*n*n-1.70158*n*n,b=n=>1-(c=>c<.36363636363636365?7.5625*c*c:c<.7272727272727273?7.5625*(c-=.5454545454545454)*c+.75:c<.9090909090909091?7.5625*(c-=.8181818181818182)*c+.9375:7.5625*(c-=.9545454545454546)*c+.984375)(1-n),f=n=>{let s=2*r/3;return n%1?-e(2,10*n-10)*M((n*10-10.75)*s):n};return w(j);})(); |
+1
-1
@@ -1,1 +0,1 @@ | ||
| var o=n=>n,a=n=>n*n,i=n=>n*n*n,e=n=>n*n*n*n,r=n=>n*n*n*n*n,t=n=>1-(s=>s<.36363636363636365?7.5625*s*s:s<.7272727272727273?7.5625*(s-=.5454545454545454)*s+.75:s<.9090909090909091?7.5625*(s-=.8181818181818182)*s+.9375:7.5625*(s-=.9545454545454546)*s+.984375)(1-n),u=n=>1-Math.cos(n*Math.PI/2),g=n=>n===0?0:Math.pow(2,10*n-10),E=n=>{let c=2*Math.PI/3;return n===0?0:n===1?1:-Math.pow(2,10*n-10)*Math.sin((n*10-10.75)*c)},p=n=>1-Math.sqrt(1-Math.pow(n,2)),d=n=>2.70158*n*n*n-1.70158*n*n;export{d as back,t as bounce,p as circ,i as cubic,E as elastic,g as expo,o as linear,a as quad,e as quart,r as quint,u as sine}; | ||
| var{cos:i,sin:e,pow:o,sqrt:r,PI:u}=Math,a=n=>n,t=n=>n*n,g=n=>n*n*n,E=n=>n*n*n*n,F=n=>n*n*n*n*n,p=n=>1-i(n*u/2),d=n=>n===0?0:o(2,10*n-10),l=n=>1-r(1-o(n,2)),q=n=>2.70158*n*n*n-1.70158*n*n,b=n=>1-(c=>c<.36363636363636365?7.5625*c*c:c<.7272727272727273?7.5625*(c-=.5454545454545454)*c+.75:c<.9090909090909091?7.5625*(c-=.8181818181818182)*c+.9375:7.5625*(c-=.9545454545454546)*c+.984375)(1-n),f=n=>{let s=2*u/3;return n%1?-o(2,10*n-10)*e((n*10-10.75)*s):n};export{q as back,b as bounce,l as circ,g as cubic,f as elastic,d as expo,a as linear,t as quad,E as quart,F as quint,p as sine}; |
+13
-2
| { | ||
| "name": "@slidy/easing", | ||
| "version": "1.0.5", | ||
| "version": "1.0.6", | ||
| "description": "Simple easing functions for inertion scrolling", | ||
@@ -12,2 +12,13 @@ "main": "dist/index.cjs", | ||
| ], | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "require": "./dist/index.cjs", | ||
| "import": "./dist/index.mjs", | ||
| "default": "./dist/index.mjs", | ||
| "browser": "./dist/index.js" | ||
| }, | ||
| "./*": "./dist/*", | ||
| "./package.json": "./package.json" | ||
| }, | ||
| "repository": { | ||
@@ -39,3 +50,3 @@ "type": "git", | ||
| "dev:core": "node esbuild --dev", | ||
| "build": "node esbuild && tsc", | ||
| "build": "node esbuild && tsc && node ../../env/dts", | ||
| "lint": "eslint './src/**/*.{js,ts}'", | ||
@@ -42,0 +53,0 @@ "lint:fix": "eslint --fix './src/**/*.{js,ts}'", |
+2
-0
@@ -37,2 +37,4 @@ [](https://www.npmjs.com/package/@slidy/easing) | ||
| > ⚠️ For proper operation minimal `duration: 450` needed. | ||
| ```ts | ||
@@ -39,0 +41,0 @@ /** Easing function. |
| import type { Easing } from './types'; | ||
| declare const linear: Easing; | ||
| declare const quad: Easing; | ||
| declare const cubic: Easing; | ||
| declare const quart: Easing; | ||
| declare const quint: Easing; | ||
| declare const bounce: Easing; | ||
| declare const sine: Easing; | ||
| declare const expo: Easing; | ||
| declare const elastic: Easing; | ||
| declare const circ: Easing; | ||
| declare const back: Easing; | ||
| export { linear, quad, cubic, quart, quint, bounce, sine, expo, elastic, circ, back }; |
| /** Easing function. | ||
| * @param t value from 0 to 1 | ||
| * @returns value from 0 to 1 | ||
| * @default linear | ||
| * @see https://easings.net | ||
| */ | ||
| export declare type Easing = (t: number) => number; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
16181
100.63%258
637.14%94
2.17%7
-22.22%1
Infinity%