@arisbh/marqueeck
Advanced tools
Comparing version 0.3.6 to 0.3.7
@@ -1,9 +0,4 @@ | ||
"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 | ||
const Marqueeck_svelte_1 = __importDefault(require("./Marqueeck.svelte")); | ||
exports.default = Marqueeck_svelte_1.default; | ||
import Marqueeck from "./Marqueeck.svelte"; | ||
export default Marqueeck; | ||
export { MarqueeckOptions }; |
@@ -1,8 +0,5 @@ | ||
"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"); | ||
import { quadInOut } from 'svelte/easing'; | ||
//* DEFAULTS | ||
// The default object options that get merged to user options | ||
exports.defaultOptions = { | ||
export const defaultOptions = { | ||
speed: 75, | ||
@@ -18,15 +15,11 @@ direction: 'left', | ||
debug: false, | ||
easing: easing_1.quadInOut | ||
easing: quadInOut | ||
}; | ||
//* HELPER FUNCTIONS | ||
// Return false if option 'onHover' is set to 'stop' | ||
const hasHoverState = (mergedOptions) => mergedOptions.onHover === 'stop' || mergedOptions.onHover === 'customSpeed' ? true : false; | ||
exports.hasHoverState = hasHoverState; | ||
export const hasHoverState = (mergedOptions) => mergedOptions.onHover === 'stop' || mergedOptions.onHover === 'customSpeed' ? true : false; | ||
// Define sticky element style position depending on stickyPosition options | ||
const stickyPos = (mergedOptions) => mergedOptions.stickyPosition === 'start' ? 'left: 0;' : 'right: 0;'; | ||
exports.stickyPos = stickyPos; | ||
export const stickyPos = (mergedOptions) => mergedOptions.stickyPosition === 'start' ? 'left: 0;' : 'right: 0;'; | ||
// Simple | ||
const setOpacity = (node, value) => node.style.opacity = value.toString(); | ||
exports.setOpacity = setOpacity; | ||
const debugState = (state) => state ? 'show-debug' : ""; | ||
exports.debugState = debugState; | ||
export const setOpacity = (node, value) => node.style.opacity = value.toString(); | ||
export const debugState = (state) => state ? 'show-debug' : ""; |
@@ -1,7 +0,4 @@ | ||
"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"); | ||
import { writable } from 'svelte/store'; | ||
import { tweened } from 'svelte/motion'; | ||
import { cubicOut, cubicInOut } from 'svelte/easing'; | ||
function createScrollState() { | ||
@@ -13,6 +10,6 @@ let lastPos = null; | ||
const initialState = { distance: 0, percentage: 0, direction: 'static', velocity: 0 }; | ||
const { subscribe, update } = (0, store_1.writable)(initialState); | ||
const scrollVelocity = (0, motion_1.tweened)(0, { | ||
const { subscribe, update } = writable(initialState); | ||
const scrollVelocity = tweened(0, { | ||
duration: delay, | ||
easing: easing_1.cubicOut | ||
easing: cubicOut | ||
}); | ||
@@ -57,14 +54,13 @@ scrollVelocity.subscribe(($velocity) => { | ||
} | ||
exports.scrollState = createScrollState(); | ||
const scrollHandler = (event) => { | ||
export const scrollState = createScrollState(); | ||
export const scrollHandler = (event) => { | ||
const newPos = event.currentTarget.scrollTop; | ||
const distance = newPos; | ||
const velocity = exports.scrollState.checkScrollSpeed(newPos); | ||
const velocity = scrollState.checkScrollSpeed(newPos); | ||
const direction = velocity >= 0 ? 'down' : 'up'; | ||
const maxScrollTop = event.currentTarget.scrollHeight - event.currentTarget.clientHeight; | ||
exports.scrollState.updateDistanceAndDirection(distance, direction, velocity, maxScrollTop); | ||
exports.scrollState.setVelocity(velocity); | ||
scrollState.updateDistanceAndDirection(distance, direction, velocity, maxScrollTop); | ||
scrollState.setVelocity(velocity); | ||
}; | ||
exports.scrollHandler = scrollHandler; | ||
const factorHelper = (velocity, damper = 7) => { | ||
export const factorHelper = (velocity, damper = 7) => { | ||
if (velocity <= 5 && velocity >= -5) { | ||
@@ -77,8 +73,7 @@ return 1; | ||
}; | ||
exports.factorHelper = factorHelper; | ||
function pingPongHelper(min, max, duration) { | ||
const internalStore = (0, store_1.writable)(min); | ||
const pingPongValue = (0, motion_1.tweened)(min, { | ||
export function pingPongHelper(min, max, duration) { | ||
const internalStore = writable(min); | ||
const pingPongValue = tweened(min, { | ||
duration, | ||
easing: easing_1.cubicInOut | ||
easing: cubicInOut | ||
}); | ||
@@ -108,2 +103,1 @@ function startPingPong(min, max) { | ||
} | ||
exports.pingPongHelper = pingPongHelper; |
{ | ||
"name": "@arisbh/marqueeck", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"description": "Marqueeck is a performant full-featured marquee component for Svelte, style-free, highly customizable and dependency-less.", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
17625
230