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

@adoratorio/hades

Package Overview
Dependencies
Maintainers
4
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adoratorio/hades - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

7

dist/declarations.d.ts

@@ -15,4 +15,3 @@ import Aion from '@adoratorio/aion';

container: HTMLElement;
easing: Function;
duration: number;
easing: Easing;
infiniteScroll: boolean;

@@ -49,1 +48,5 @@ emitGlobal: boolean;

}
export interface Easing {
mode: Function;
duration: number;
}

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

import { MODE, DIRECTION, HadesOptions, Boundries, Vec2 } from "./declarations";
import { MODE, DIRECTION, HadesOptions, Boundries, Vec2, Easing } from "./declarations";
declare class Hades {

@@ -12,6 +12,6 @@ static EASING: {

static DIRECTION: typeof DIRECTION;
private _amount;
private options;
private engine;
private manager;
private internalAmount;
private scrollHandler;

@@ -39,4 +39,3 @@ private frameHandler;

readonly direction: Vec2;
easing: Function;
duration: number;
easing: Easing;
infiniteScroll: boolean;

@@ -43,0 +42,0 @@ emitGlobal: boolean;

@@ -24,3 +24,3 @@ "use strict";

var _this = this;
this.internalAmount = { x: 0, y: 0 };
this._amount = { x: 0, y: 0 };
this.prevDirection = { x: Hades.DIRECTION.INITIAL, y: Hades.DIRECTION.INITIAL };

@@ -38,4 +38,6 @@ this.prevAmount = { x: 0, y: 0 };

container: document.querySelector('.hades-container'),
easing: easing_1.default.LINEAR,
duration: 1000,
easing: {
mode: easing_1.default.LINEAR,
duration: 1000,
},
infiniteScroll: false,

@@ -59,3 +61,3 @@ emitGlobal: true,

start: 0,
duration: this.options.duration,
duration: this.options.easing.duration,
initial: { x: 0, y: 0 },

@@ -109,6 +111,6 @@ final: { x: 0, y: 0 },

// Get the new final value
this.timeline.final.x = this.internalAmount.x;
this.timeline.final.y = this.internalAmount.y;
this.timeline.final.x = this._amount.x;
this.timeline.final.y = this._amount.y;
// Normalize delta based on duration
delta = Math.min(Math.max(delta, 0), this.options.duration);
delta = Math.min(Math.max(delta, 0), this.options.easing.duration);
// Normalize the delta to be 0 - 1

@@ -122,3 +124,3 @@ var time = delta / this.timeline.duration;

// Get the interpolated time
time = this.options.easing(time);
time = this.options.easing.mode(time);
// Use the interpolated time to calculate values

@@ -175,3 +177,3 @@ this.timeline.current.x = this.timeline.initial.x + (time * (this.timeline.final.x - this.timeline.initial.x));

if (this.automaticScrolling) {
this.timeline.duration = this.options.duration;
this.timeline.duration = this.options.easing.duration;
this.amount = this.prevAmount;

@@ -186,12 +188,12 @@ this.automaticScrolling = false;

// Temporary sum amount
var tempX = this.internalAmount.x + event.delta.x;
var tempY = this.internalAmount.y + event.delta.y;
var tempX = this._amount.x + event.delta.x;
var tempY = this._amount.y + event.delta.y;
// Clamp the sum amount to be inside the boundries if not infinite scrolling
if (!this.options.infiniteScroll) {
this.internalAmount.x = Math.min(Math.max(tempX, this.options.boundries.min.x), this.options.boundries.max.y);
this.internalAmount.y = Math.min(Math.max(tempY, this.options.boundries.min.y), this.options.boundries.max.y);
this._amount.x = Math.min(Math.max(tempX, this.options.boundries.min.x), this.options.boundries.max.y);
this._amount.y = Math.min(Math.max(tempY, this.options.boundries.min.y), this.options.boundries.max.y);
}
else {
this.internalAmount.x = tempX;
this.internalAmount.y = tempY;
this._amount.x = tempX;
this._amount.y = tempY;
}

@@ -203,5 +205,5 @@ // Check the scroll direction

if (currentXDirection !== this.prevDirection.x)
this.internalAmount.x = this.amount.x;
this._amount.x = this.amount.x;
if (currentYDirection !== this.prevDirection.y)
this.internalAmount.y = this.amount.y;
this._amount.y = this.amount.y;
}

@@ -228,4 +230,4 @@ this.prevDirection.x = currentXDirection;

}
this.internalAmount.x = position.x;
this.internalAmount.y = position.y;
this._amount.x = position.x;
this._amount.y = position.y;
}

@@ -289,9 +291,2 @@ else {

});
Object.defineProperty(Hades.prototype, "duration", {
set: function (duration) {
this.options.duration = duration;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Hades.prototype, "infiniteScroll", {

@@ -298,0 +293,0 @@ set: function (infiniteScroll) {

{
"name": "@adoratorio/hades",
"version": "0.1.1",
"version": "0.1.2",
"description": "A smooth scrollbar based on Hermes, scroll down 'till hell",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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