@arisbh/marqueeck
Advanced tools
Comparing version 0.3.0 to 0.3.2
@@ -0,3 +1,9 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MarqueeckOptions = void 0; | ||
// Reexport your entry components here | ||
import Marqueeck from "./Marqueeck.svelte"; | ||
export default Marqueeck; | ||
const Marqueeck_svelte_1 = __importDefault(require("./Marqueeck.svelte")); | ||
exports.default = Marqueeck_svelte_1.default; |
@@ -1,5 +0,8 @@ | ||
import { quadInOut } from 'svelte/easing'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.debugState = exports.setOpacity = exports.stickyPos = exports.hasHoverState = exports.defaultOptions = void 0; | ||
const easing_1 = require("svelte/easing"); | ||
//* DEFAULTS | ||
// The default object options that get merged to user options | ||
export const defaultOptions = { | ||
exports.defaultOptions = { | ||
speed: 75, | ||
@@ -15,11 +18,15 @@ direction: 'left', | ||
debug: false, | ||
easing: quadInOut | ||
easing: easing_1.quadInOut | ||
}; | ||
//* HELPER FUNCTIONS | ||
// Return false if option 'onHover' is set to 'stop' | ||
export const hasHoverState = (mergedOptions) => mergedOptions.onHover === 'stop' || mergedOptions.onHover === 'customSpeed' ? true : false; | ||
const hasHoverState = (mergedOptions) => mergedOptions.onHover === 'stop' || mergedOptions.onHover === 'customSpeed' ? true : false; | ||
exports.hasHoverState = hasHoverState; | ||
// Define sticky element style position depending on stickyPosition options | ||
export const stickyPos = (mergedOptions) => mergedOptions.stickyPosition === 'start' ? 'left: 0;' : 'right: 0;'; | ||
const stickyPos = (mergedOptions) => mergedOptions.stickyPosition === 'start' ? 'left: 0;' : 'right: 0;'; | ||
exports.stickyPos = stickyPos; | ||
// Simple | ||
export const setOpacity = (node, value) => node.style.opacity = value.toString(); | ||
export const debugState = (state) => state ? 'show-debug' : ""; | ||
const setOpacity = (node, value) => node.style.opacity = value.toString(); | ||
exports.setOpacity = setOpacity; | ||
const debugState = (state) => state ? 'show-debug' : ""; | ||
exports.debugState = debugState; |
@@ -1,4 +0,7 @@ | ||
import { writable } from 'svelte/store'; | ||
import { tweened } from 'svelte/motion'; | ||
import { cubicOut, cubicInOut } from 'svelte/easing'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pingPongHelper = exports.factorHelper = exports.scrollHandler = exports.scrollState = void 0; | ||
const store_1 = require("svelte/store"); | ||
const motion_1 = require("svelte/motion"); | ||
const easing_1 = require("svelte/easing"); | ||
function createScrollState() { | ||
@@ -10,6 +13,6 @@ let lastPos = null; | ||
const initialState = { distance: 0, percentage: 0, direction: 'static', velocity: 0 }; | ||
const { subscribe, update } = writable(initialState); | ||
const scrollVelocity = tweened(0, { | ||
const { subscribe, update } = (0, store_1.writable)(initialState); | ||
const scrollVelocity = (0, motion_1.tweened)(0, { | ||
duration: delay, | ||
easing: cubicOut | ||
easing: easing_1.cubicOut | ||
}); | ||
@@ -54,13 +57,14 @@ scrollVelocity.subscribe(($velocity) => { | ||
} | ||
export const scrollState = createScrollState(); | ||
export const scrollHandler = (event) => { | ||
exports.scrollState = createScrollState(); | ||
const scrollHandler = (event) => { | ||
const newPos = event.currentTarget.scrollTop; | ||
const distance = newPos; | ||
const velocity = scrollState.checkScrollSpeed(newPos); | ||
const velocity = exports.scrollState.checkScrollSpeed(newPos); | ||
const direction = velocity >= 0 ? 'down' : 'up'; | ||
const maxScrollTop = event.currentTarget.scrollHeight - event.currentTarget.clientHeight; | ||
scrollState.updateDistanceAndDirection(distance, direction, velocity, maxScrollTop); | ||
scrollState.setVelocity(velocity); | ||
exports.scrollState.updateDistanceAndDirection(distance, direction, velocity, maxScrollTop); | ||
exports.scrollState.setVelocity(velocity); | ||
}; | ||
export const factorHelper = (velocity, damper = 7) => { | ||
exports.scrollHandler = scrollHandler; | ||
const factorHelper = (velocity, damper = 7) => { | ||
if (velocity <= 5 && velocity >= -5) { | ||
@@ -73,7 +77,8 @@ return 1; | ||
}; | ||
export function pingPongHelper(min, max, duration) { | ||
const internalStore = writable(min); | ||
const pingPongValue = tweened(min, { | ||
exports.factorHelper = factorHelper; | ||
function pingPongHelper(min, max, duration) { | ||
const internalStore = (0, store_1.writable)(min); | ||
const pingPongValue = (0, motion_1.tweened)(min, { | ||
duration, | ||
easing: cubicInOut | ||
easing: easing_1.cubicInOut | ||
}); | ||
@@ -103,1 +108,2 @@ function startPingPong(min, max) { | ||
} | ||
exports.pingPongHelper = pingPongHelper; |
{ | ||
"name": "@arisbh/marqueeck", | ||
"version": "0.3.0", | ||
"version": "0.3.2", | ||
"description": "Marqueeck is a performant full-featured marquee component for Svelte, style-free, highly customizable and dependency-less.", | ||
@@ -36,26 +36,26 @@ "author": { | ||
"@arisbh/marqueeck": "0.1.12", | ||
"@skeletonlabs/skeleton": "^1.6.2", | ||
"@skeletonlabs/skeleton": "^1.12.0", | ||
"@sveltejs/adapter-auto": "^2.1.0", | ||
"@sveltejs/kit": "^1.19.0", | ||
"@sveltejs/package": "^2.0.2", | ||
"@types/node": "^20.2.4", | ||
"@typescript-eslint/eslint-plugin": "^5.59.7", | ||
"@typescript-eslint/parser": "^5.59.7", | ||
"autoprefixer": "^10.4.14", | ||
"eslint": "^8.41.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-svelte": "^2.29.0", | ||
"@sveltejs/kit": "^1.25.0", | ||
"@sveltejs/package": "^2.2.2", | ||
"@types/node": "^20.6.2", | ||
"@typescript-eslint/eslint-plugin": "^6.7.2", | ||
"@typescript-eslint/parser": "^6.7.2", | ||
"autoprefixer": "^10.4.15", | ||
"eslint": "^8.49.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-svelte": "^2.33.2", | ||
"highlight.js": "^11.8.0", | ||
"postcss": "^8.4.23", | ||
"postcss": "^8.4.30", | ||
"postcss-load-config": "^4.0.1", | ||
"prettier": "^2.8.8", | ||
"prettier-plugin-svelte": "^2.10.0", | ||
"publint": "^0.1.12", | ||
"svelte": "^3.59.1", | ||
"svelte-check": "^3.3.2", | ||
"svelte-preprocess": "^5.0.3", | ||
"tailwindcss": "^3.3.2", | ||
"tslib": "^2.5.2", | ||
"typescript": "^5.0.4", | ||
"vite": "^4.3.8" | ||
"prettier": "^3.0.3", | ||
"prettier-plugin-svelte": "^3.0.3", | ||
"publint": "^0.2.2", | ||
"svelte": "^4.2.0", | ||
"svelte-check": "^3.5.2", | ||
"svelte-preprocess": "^5.0.4", | ||
"tailwindcss": "^3.3.3", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.2.2", | ||
"vite": "^4.4.9" | ||
}, | ||
@@ -62,0 +62,0 @@ "svelte": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
18879
247