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.0 to 0.1.1

1

dist/declarations.d.ts

@@ -24,2 +24,3 @@ import Aion from '@adoratorio/aion';

boundries: Boundries;
autoBoundries: boolean;
mode: string;

@@ -26,0 +27,0 @@ sections: string | boolean;

@@ -22,7 +22,14 @@ import { MODE, DIRECTION, HadesOptions, Boundries, Vec2 } from "./declarations";

private sections;
private automaticScrolling;
private imediateScrolling;
amount: Vec2;
velocity: Vec2;
running: boolean;
constructor(options: Partial<HadesOptions>);
private frame;
private scroll;
scrollTo(position: Vec2, duration: number): void;
play(): void;
pause(): void;
destroy(): void;
readonly virtual: boolean;

@@ -29,0 +36,0 @@ readonly fake: boolean;

@@ -28,4 +28,7 @@ "use strict";

this.sections = [];
this.automaticScrolling = false;
this.imediateScrolling = false;
this.amount = { x: 0, y: 0 };
this.velocity = { x: 0, y: 0 };
this.running = false;
var defaults = {

@@ -44,2 +47,3 @@ mode: declarations_1.MODE.VIRTUAL,

boundries: Hades.createBoundries(0, 0, 0, 0),
autoBoundries: true,
sections: false,

@@ -84,2 +88,4 @@ autoplay: true,

// Check and initialize Aion
if (this.options.autoplay)
this.running = true;
if (this.options.aion === null || typeof this.options.aion === 'undefined') {

@@ -92,7 +98,12 @@ this.engine = new aion_1.default();

this.engine.add(this.frameHandler, 'hades_frame');
if (this.options.autoplay)
this.engine.start();
this.engine.start();
}
Hades.prototype.frame = function (delta) {
var _this = this;
// If boundires are autosetted use the container dimensions
if (this.options.autoBoundries) {
var containerRect = this.options.container.getBoundingClientRect();
var viewportRect = this.options.viewport.getBoundingClientRect();
this.options.boundries = Hades.createBoundries(0, containerRect.width < viewportRect.width ? 0 : containerRect.width - viewportRect.width, 0, containerRect.height < viewportRect.height ? 0 : containerRect.height - viewportRect.height);
}
// Get the new final value

@@ -105,2 +116,7 @@ this.timeline.final.x = this.internalAmount.x;

var time = delta / this.timeline.duration;
// Check if the frame is imediate
if (this.imediateScrolling) {
time = 1;
this.imediateScrolling = false;
}
// Get the interpolated time

@@ -154,2 +170,11 @@ time = this.options.easing(time);

Hades.prototype.scroll = function (event) {
// Return if is stopped
if (!this.running)
return;
// Reset from the scroll to if needed
if (this.automaticScrolling) {
this.timeline.duration = this.options.duration;
this.amount = this.prevAmount;
this.automaticScrolling = false;
}
// Set the first scroll direction

@@ -192,2 +217,34 @@ if (this.prevDirection.x === Hades.DIRECTION.INITIAL || this.prevDirection.y === Hades.DIRECTION.INITIAL) {

};
Hades.prototype.scrollTo = function (position, duration) {
if (this.virtual) {
if (duration > 0) {
this.automaticScrolling = true;
this.timeline.duration = duration;
}
else {
this.imediateScrolling = true;
}
this.internalAmount.x = position.x;
this.internalAmount.y = position.y;
}
else {
this.options.viewport.scroll({
left: position.x,
top: position.y,
behavior: duration === 0 ? 'auto' : 'smooth',
});
}
};
Hades.prototype.play = function () {
this.running = true;
};
Hades.prototype.pause = function () {
this.running = false;
};
Hades.prototype.destroy = function () {
this.manager.destroy();
this.engine.remove('hades_frame');
delete this.manager;
delete this.engine;
};
Object.defineProperty(Hades.prototype, "virtual", {

@@ -194,0 +251,0 @@ // Common getter for retriving props

10

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

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

"types": "dist/index.d.ts",
"files": ["dist/**/*"],
"files": [
"dist/**/*"
],
"scripts": {

@@ -38,4 +40,4 @@ "build": "rm -rf dist && mkdir dist && tsc",

"dependencies": {
"@adoratorio/aion": "^0.3.2",
"@adoratorio/hermes": "^0.1.20"
"@adoratorio/aion": "^0.3.3",
"@adoratorio/hermes": "^0.1.21"
},

@@ -42,0 +44,0 @@ "devDependencies": {

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