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

svelte-fast-marquee

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-fast-marquee - npm Package Compare versions

Comparing version 0.5.4 to 0.6.0

1654

dist/index.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["svelte-fast-marquee"] = factory());
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["svelte-fast-marquee"] = factory());
})(this, (function () { 'use strict';
function noop() { }
function assign(tar, src) {
// @ts-ignore
for (const k in src)
tar[k] = src[k];
return tar;
}
function run(fn) {
return fn();
}
function blank_object() {
return Object.create(null);
}
function run_all(fns) {
fns.forEach(run);
}
function is_function(thing) {
return typeof thing === 'function';
}
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
}
function is_empty(obj) {
return Object.keys(obj).length === 0;
}
function create_slot(definition, ctx, $$scope, fn) {
if (definition) {
const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
return definition[0](slot_ctx);
}
}
function get_slot_context(definition, ctx, $$scope, fn) {
return definition[1] && fn
? assign($$scope.ctx.slice(), definition[1](fn(ctx)))
: $$scope.ctx;
}
function get_slot_changes(definition, $$scope, dirty, fn) {
if (definition[2] && fn) {
const lets = definition[2](fn(dirty));
if ($$scope.dirty === undefined) {
return lets;
}
if (typeof lets === 'object') {
const merged = [];
const len = Math.max($$scope.dirty.length, lets.length);
for (let i = 0; i < len; i += 1) {
merged[i] = $$scope.dirty[i] | lets[i];
}
return merged;
}
return $$scope.dirty | lets;
}
return $$scope.dirty;
}
function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {
if (slot_changes) {
const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
slot.p(slot_context, slot_changes);
}
}
function get_all_dirty_from_scope($$scope) {
if ($$scope.ctx.length > 32) {
const dirty = [];
const length = $$scope.ctx.length / 32;
for (let i = 0; i < length; i++) {
dirty[i] = -1;
}
return dirty;
}
return -1;
}
function append(target, node) {
target.appendChild(node);
}
function append_styles(target, style_sheet_id, styles) {
const append_styles_to = get_root_for_style(target);
if (!append_styles_to.getElementById(style_sheet_id)) {
const style = element('style');
style.id = style_sheet_id;
style.textContent = styles;
append_stylesheet(append_styles_to, style);
}
}
function get_root_for_style(node) {
if (!node)
return document;
const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
if (root && root.host) {
return root;
}
return node.ownerDocument;
}
function append_stylesheet(node, style) {
append(node.head || node, style);
return style.sheet;
}
function insert(target, node, anchor) {
target.insertBefore(node, anchor || null);
}
function detach(node) {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}
function element(name) {
return document.createElement(name);
}
function text(data) {
return document.createTextNode(data);
}
function space() {
return text(' ');
}
function listen(node, event, handler, options) {
node.addEventListener(event, handler, options);
return () => node.removeEventListener(event, handler, options);
}
function attr(node, attribute, value) {
if (value == null)
node.removeAttribute(attribute);
else if (node.getAttribute(attribute) !== value)
node.setAttribute(attribute, value);
}
function children(element) {
return Array.from(element.childNodes);
}
// unfortunately this can't be a constant as that wouldn't be tree-shakeable
// so we cache the result instead
let crossorigin;
function is_crossorigin() {
if (crossorigin === undefined) {
crossorigin = false;
try {
if (typeof window !== 'undefined' && window.parent) {
void window.parent.document;
}
}
catch (error) {
crossorigin = true;
}
}
return crossorigin;
}
function add_iframe_resize_listener(node, fn) {
const computed_style = getComputedStyle(node);
if (computed_style.position === 'static') {
node.style.position = 'relative';
}
const iframe = element('iframe');
iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +
'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;');
iframe.setAttribute('aria-hidden', 'true');
iframe.tabIndex = -1;
const crossorigin = is_crossorigin();
let unsubscribe;
if (crossorigin) {
iframe.src = "data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}</script>";
unsubscribe = listen(window, 'message', (event) => {
if (event.source === iframe.contentWindow)
fn();
});
}
else {
iframe.src = 'about:blank';
iframe.onload = () => {
unsubscribe = listen(iframe.contentWindow, 'resize', fn);
// make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)
// see https://github.com/sveltejs/svelte/issues/4233
fn();
};
}
append(node, iframe);
return () => {
if (crossorigin) {
unsubscribe();
}
else if (unsubscribe && iframe.contentWindow) {
unsubscribe();
}
detach(iframe);
};
}
/** @returns {void} */
function noop() {}
let current_component;
function set_current_component(component) {
current_component = component;
}
/**
* @template T
* @template S
* @param {T} tar
* @param {S} src
* @returns {T & S}
*/
function assign(tar, src) {
// @ts-ignore
for (const k in src) tar[k] = src[k];
return /** @type {T & S} */ (tar);
}
const dirty_components = [];
const binding_callbacks = [];
let render_callbacks = [];
const flush_callbacks = [];
const resolved_promise = /* @__PURE__ */ Promise.resolve();
let update_scheduled = false;
function schedule_update() {
if (!update_scheduled) {
update_scheduled = true;
resolved_promise.then(flush);
}
}
function add_render_callback(fn) {
render_callbacks.push(fn);
}
// flush() calls callbacks in this order:
// 1. All beforeUpdate callbacks, in order: parents before children
// 2. All bind:this callbacks, in reverse order: children before parents.
// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
// for afterUpdates called during the initial onMount, which are called in
// reverse order: children before parents.
// Since callbacks might update component values, which could trigger another
// call to flush(), the following steps guard against this:
// 1. During beforeUpdate, any updated components will be added to the
// dirty_components array and will cause a reentrant call to flush(). Because
// the flush index is kept outside the function, the reentrant call will pick
// up where the earlier call left off and go through all dirty components. The
// current_component value is saved and restored so that the reentrant call will
// not interfere with the "parent" flush() call.
// 2. bind:this callbacks cannot trigger new flush() calls.
// 3. During afterUpdate, any updated components will NOT have their afterUpdate
// callback called a second time; the seen_callbacks set, outside the flush()
// function, guarantees this behavior.
const seen_callbacks = new Set();
let flushidx = 0; // Do *not* move this inside the flush() function
function flush() {
// Do not reenter flush while dirty components are updated, as this can
// result in an infinite loop. Instead, let the inner flush handle it.
// Reentrancy is ok afterwards for bindings etc.
if (flushidx !== 0) {
return;
}
const saved_component = current_component;
do {
// first, call beforeUpdate functions
// and update components
try {
while (flushidx < dirty_components.length) {
const component = dirty_components[flushidx];
flushidx++;
set_current_component(component);
update(component.$$);
}
}
catch (e) {
// reset dirty state to not end up in a deadlocked state and then rethrow
dirty_components.length = 0;
flushidx = 0;
throw e;
}
set_current_component(null);
dirty_components.length = 0;
flushidx = 0;
while (binding_callbacks.length)
binding_callbacks.pop()();
// then, once components are updated, call
// afterUpdate functions. This may cause
// subsequent updates...
for (let i = 0; i < render_callbacks.length; i += 1) {
const callback = render_callbacks[i];
if (!seen_callbacks.has(callback)) {
// ...so guard against infinite loops
seen_callbacks.add(callback);
callback();
}
}
render_callbacks.length = 0;
} while (dirty_components.length);
while (flush_callbacks.length) {
flush_callbacks.pop()();
}
update_scheduled = false;
seen_callbacks.clear();
set_current_component(saved_component);
}
function update($$) {
if ($$.fragment !== null) {
$$.update();
run_all($$.before_update);
const dirty = $$.dirty;
$$.dirty = [-1];
$$.fragment && $$.fragment.p($$.ctx, dirty);
$$.after_update.forEach(add_render_callback);
}
}
/**
* Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.
*/
function flush_render_callbacks(fns) {
const filtered = [];
const targets = [];
render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
targets.forEach((c) => c());
render_callbacks = filtered;
}
const outroing = new Set();
let outros;
function transition_in(block, local) {
if (block && block.i) {
outroing.delete(block);
block.i(local);
}
}
function transition_out(block, local, detach, callback) {
if (block && block.o) {
if (outroing.has(block))
return;
outroing.add(block);
outros.c.push(() => {
outroing.delete(block);
if (callback) {
if (detach)
block.d(1);
callback();
}
});
block.o(local);
}
else if (callback) {
callback();
}
}
function mount_component(component, target, anchor, customElement) {
const { fragment, after_update } = component.$$;
fragment && fragment.m(target, anchor);
if (!customElement) {
// onMount happens before the initial afterUpdate
add_render_callback(() => {
const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
// if the component was destroyed immediately
// it will update the `$$.on_destroy` reference to `null`.
// the destructured on_destroy may still reference to the old array
if (component.$$.on_destroy) {
component.$$.on_destroy.push(...new_on_destroy);
}
else {
// Edge case - component was destroyed immediately,
// most likely as a result of a binding initialising
run_all(new_on_destroy);
}
component.$$.on_mount = [];
});
}
after_update.forEach(add_render_callback);
}
function destroy_component(component, detaching) {
const $$ = component.$$;
if ($$.fragment !== null) {
flush_render_callbacks($$.after_update);
run_all($$.on_destroy);
$$.fragment && $$.fragment.d(detaching);
// TODO null out other refs, including component.$$ (but need to
// preserve final state?)
$$.on_destroy = $$.fragment = null;
$$.ctx = [];
}
}
function make_dirty(component, i) {
if (component.$$.dirty[0] === -1) {
dirty_components.push(component);
schedule_update();
component.$$.dirty.fill(0);
}
component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
}
function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {
const parent_component = current_component;
set_current_component(component);
const $$ = component.$$ = {
fragment: null,
ctx: [],
// state
props,
update: noop,
not_equal,
bound: blank_object(),
// lifecycle
on_mount: [],
on_destroy: [],
on_disconnect: [],
before_update: [],
after_update: [],
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
// everything else
callbacks: blank_object(),
dirty,
skip_bound: false,
root: options.target || parent_component.$$.root
};
append_styles && append_styles($$.root);
let ready = false;
$$.ctx = instance
? instance(component, options.props || {}, (i, ret, ...rest) => {
const value = rest.length ? rest[0] : ret;
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
if (!$$.skip_bound && $$.bound[i])
$$.bound[i](value);
if (ready)
make_dirty(component, i);
}
return ret;
})
: [];
$$.update();
ready = true;
run_all($$.before_update);
// `false` as a special case of no DOM component
$$.fragment = create_fragment ? create_fragment($$.ctx) : false;
if (options.target) {
if (options.hydrate) {
const nodes = children(options.target);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$$.fragment && $$.fragment.l(nodes);
nodes.forEach(detach);
}
else {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$$.fragment && $$.fragment.c();
}
if (options.intro)
transition_in(component.$$.fragment);
mount_component(component, options.target, options.anchor, options.customElement);
flush();
}
set_current_component(parent_component);
}
/**
* Base class for Svelte components. Used when dev=false.
*/
class SvelteComponent {
$destroy() {
destroy_component(this, 1);
this.$destroy = noop;
}
$on(type, callback) {
if (!is_function(callback)) {
return noop;
}
const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
callbacks.push(callback);
return () => {
const index = callbacks.indexOf(callback);
if (index !== -1)
callbacks.splice(index, 1);
};
}
$set($$props) {
if (this.$$set && !is_empty($$props)) {
this.$$.skip_bound = true;
this.$$set($$props);
this.$$.skip_bound = false;
}
}
}
function run(fn) {
return fn();
}
/* src/Marquee.svelte generated by Svelte v3.59.2 */
function blank_object() {
return Object.create(null);
}
function add_css(target) {
append_styles(target, "svelte-nbo9dd", ".marquee-container.svelte-nbo9dd.svelte-nbo9dd{display:flex;width:100%;overflow-x:hidden;flex-direction:row;position:relative}.marquee-container.svelte-nbo9dd:hover .marquee.svelte-nbo9dd{animation-play-state:var(--pause-on-hover)}.marquee-container.svelte-nbo9dd:active .marquee.svelte-nbo9dd{animation-play-state:var(--pause-on-click)}.marquee.svelte-nbo9dd.svelte-nbo9dd{flex:0 0 auto;min-width:100%;z-index:1;display:flex;flex-direction:row;align-items:center;animation:svelte-nbo9dd-scroll var(--duration) linear infinite;animation-play-state:var(--play);animation-direction:var(--direction)}@keyframes svelte-nbo9dd-scroll{0%{transform:translateX(0%)}100%{transform:translateX(-100%)}}.initial-child-container.svelte-nbo9dd.svelte-nbo9dd{flex:0 0 auto;display:flex;min-width:auto;flex-direction:row}.gradient.svelte-nbo9dd.svelte-nbo9dd::after,.gradient.svelte-nbo9dd.svelte-nbo9dd::before{background:linear-gradient(to right, white, transparent);content:\"\";height:100%;position:absolute;width:10%;z-index:2}.gradient.svelte-nbo9dd.svelte-nbo9dd::before{left:0;top:0}.gradient.svelte-nbo9dd.svelte-nbo9dd::after{right:0;top:0;transform:rotateZ(180deg)}");
}
/**
* @param {Function[]} fns
* @returns {void}
*/
function run_all(fns) {
fns.forEach(run);
}
// (70:1) {#if gradient}
function create_if_block(ctx) {
let div;
/**
* @param {any} thing
* @returns {thing is Function}
*/
function is_function(thing) {
return typeof thing === 'function';
}
return {
c() {
div = element("div");
attr(div, "class", "gradient svelte-nbo9dd");
},
m(target, anchor) {
insert(target, div, anchor);
},
d(detaching) {
if (detaching) detach(div);
}
};
}
/** @returns {boolean} */
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || (a && typeof a === 'object') || typeof a === 'function';
}
function create_fragment(ctx) {
let div2;
let t0;
let div0;
let div0_resize_listener;
let t1;
let div1;
let div2_class_value;
let div2_resize_listener;
let current;
let if_block = /*gradient*/ ctx[0] && create_if_block();
const default_slot_template = /*#slots*/ ctx[13].default;
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[12], null);
const default_slot_template_1 = /*#slots*/ ctx[13].default;
const default_slot_1 = create_slot(default_slot_template_1, ctx, /*$$scope*/ ctx[12], null);
/** @returns {boolean} */
function is_empty(obj) {
return Object.keys(obj).length === 0;
}
return {
c() {
div2 = element("div");
if (if_block) if_block.c();
t0 = space();
div0 = element("div");
if (default_slot) default_slot.c();
t1 = space();
div1 = element("div");
if (default_slot_1) default_slot_1.c();
attr(div0, "class", "marquee svelte-nbo9dd");
attr(div0, "style", /*_marqueeStyle*/ ctx[4]);
add_render_callback(() => /*div0_elementresize_handler*/ ctx[14].call(div0));
attr(div1, "class", "marquee svelte-nbo9dd");
attr(div1, "style", /*_marqueeStyle*/ ctx[4]);
attr(div2, "class", div2_class_value = "marquee-container " + /*className*/ ctx[1] + " svelte-nbo9dd");
attr(div2, "style", /*_style*/ ctx[5]);
add_render_callback(() => /*div2_elementresize_handler*/ ctx[15].call(div2));
},
m(target, anchor) {
insert(target, div2, anchor);
if (if_block) if_block.m(div2, null);
append(div2, t0);
append(div2, div0);
function create_slot(definition, ctx, $$scope, fn) {
if (definition) {
const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
return definition[0](slot_ctx);
}
}
if (default_slot) {
default_slot.m(div0, null);
}
function get_slot_context(definition, ctx, $$scope, fn) {
return definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx;
}
div0_resize_listener = add_iframe_resize_listener(div0, /*div0_elementresize_handler*/ ctx[14].bind(div0));
append(div2, t1);
append(div2, div1);
function get_slot_changes(definition, $$scope, dirty, fn) {
if (definition[2] && fn) {
const lets = definition[2](fn(dirty));
if ($$scope.dirty === undefined) {
return lets;
}
if (typeof lets === 'object') {
const merged = [];
const len = Math.max($$scope.dirty.length, lets.length);
for (let i = 0; i < len; i += 1) {
merged[i] = $$scope.dirty[i] | lets[i];
}
return merged;
}
return $$scope.dirty | lets;
}
return $$scope.dirty;
}
if (default_slot_1) {
default_slot_1.m(div1, null);
}
/** @returns {void} */
function update_slot_base(
slot,
slot_definition,
ctx,
$$scope,
slot_changes,
get_slot_context_fn
) {
if (slot_changes) {
const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
slot.p(slot_context, slot_changes);
}
}
div2_resize_listener = add_iframe_resize_listener(div2, /*div2_elementresize_handler*/ ctx[15].bind(div2));
current = true;
},
p(ctx, [dirty]) {
if (/*gradient*/ ctx[0]) {
if (if_block) ; else {
if_block = create_if_block();
if_block.c();
if_block.m(div2, t0);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
/** @returns {any[] | -1} */
function get_all_dirty_from_scope($$scope) {
if ($$scope.ctx.length > 32) {
const dirty = [];
const length = $$scope.ctx.length / 32;
for (let i = 0; i < length; i++) {
dirty[i] = -1;
}
return dirty;
}
return -1;
}
if (default_slot) {
if (default_slot.p && (!current || dirty & /*$$scope*/ 4096)) {
update_slot_base(
default_slot,
default_slot_template,
ctx,
/*$$scope*/ ctx[12],
!current
? get_all_dirty_from_scope(/*$$scope*/ ctx[12])
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[12], dirty, null),
null
);
}
}
/**
* @param {Node} target
* @param {Node} node
* @returns {void}
*/
function append(target, node) {
target.appendChild(node);
}
if (!current || dirty & /*_marqueeStyle*/ 16) {
attr(div0, "style", /*_marqueeStyle*/ ctx[4]);
}
/**
* @param {Node} target
* @param {string} style_sheet_id
* @param {string} styles
* @returns {void}
*/
function append_styles(target, style_sheet_id, styles) {
const append_styles_to = get_root_for_style(target);
if (!append_styles_to.getElementById(style_sheet_id)) {
const style = element('style');
style.id = style_sheet_id;
style.textContent = styles;
append_stylesheet(append_styles_to, style);
}
}
if (default_slot_1) {
if (default_slot_1.p && (!current || dirty & /*$$scope*/ 4096)) {
update_slot_base(
default_slot_1,
default_slot_template_1,
ctx,
/*$$scope*/ ctx[12],
!current
? get_all_dirty_from_scope(/*$$scope*/ ctx[12])
: get_slot_changes(default_slot_template_1, /*$$scope*/ ctx[12], dirty, null),
null
);
}
}
/**
* @param {Node} node
* @returns {ShadowRoot | Document}
*/
function get_root_for_style(node) {
if (!node) return document;
const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
if (root && /** @type {ShadowRoot} */ (root).host) {
return /** @type {ShadowRoot} */ (root);
}
return node.ownerDocument;
}
if (!current || dirty & /*_marqueeStyle*/ 16) {
attr(div1, "style", /*_marqueeStyle*/ ctx[4]);
}
/**
* @param {ShadowRoot | Document} node
* @param {HTMLStyleElement} style
* @returns {CSSStyleSheet}
*/
function append_stylesheet(node, style) {
append(/** @type {Document} */ (node).head || node, style);
return style.sheet;
}
if (!current || dirty & /*className*/ 2 && div2_class_value !== (div2_class_value = "marquee-container " + /*className*/ ctx[1] + " svelte-nbo9dd")) {
attr(div2, "class", div2_class_value);
}
/**
* @param {Node} target
* @param {Node} node
* @param {Node} [anchor]
* @returns {void}
*/
function insert(target, node, anchor) {
target.insertBefore(node, anchor || null);
}
if (!current || dirty & /*_style*/ 32) {
attr(div2, "style", /*_style*/ ctx[5]);
}
},
i(local) {
if (current) return;
transition_in(default_slot, local);
transition_in(default_slot_1, local);
current = true;
},
o(local) {
transition_out(default_slot, local);
transition_out(default_slot_1, local);
current = false;
},
d(detaching) {
if (detaching) detach(div2);
if (if_block) if_block.d();
if (default_slot) default_slot.d(detaching);
div0_resize_listener();
if (default_slot_1) default_slot_1.d(detaching);
div2_resize_listener();
}
};
}
/**
* @param {Node} node
* @returns {void}
*/
function detach(node) {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}
function instance($$self, $$props, $$invalidate) {
let duration;
let _style;
let _marqueeStyle;
let { $$slots: slots = {}, $$scope } = $$props;
let { pauseOnHover = false } = $$props;
let { pauseOnClick = false } = $$props;
let { direction = "left" } = $$props;
let { speed = 100 } = $$props;
let { play = true } = $$props;
let { gradient = false } = $$props;
let { class: className = "" } = $$props;
let containerWidth;
let marqueeWidth;
/**
* @template {keyof HTMLElementTagNameMap} K
* @param {K} name
* @returns {HTMLElementTagNameMap[K]}
*/
function element(name) {
return document.createElement(name);
}
function div0_elementresize_handler() {
marqueeWidth = this.clientWidth;
$$invalidate(3, marqueeWidth);
}
/**
* @param {string} data
* @returns {Text}
*/
function text(data) {
return document.createTextNode(data);
}
function div2_elementresize_handler() {
containerWidth = this.clientWidth;
$$invalidate(2, containerWidth);
}
/**
* @returns {Text} */
function space() {
return text(' ');
}
$$self.$$set = $$props => {
if ('pauseOnHover' in $$props) $$invalidate(6, pauseOnHover = $$props.pauseOnHover);
if ('pauseOnClick' in $$props) $$invalidate(7, pauseOnClick = $$props.pauseOnClick);
if ('direction' in $$props) $$invalidate(8, direction = $$props.direction);
if ('speed' in $$props) $$invalidate(9, speed = $$props.speed);
if ('play' in $$props) $$invalidate(10, play = $$props.play);
if ('gradient' in $$props) $$invalidate(0, gradient = $$props.gradient);
if ('class' in $$props) $$invalidate(1, className = $$props.class);
if ('$$scope' in $$props) $$invalidate(12, $$scope = $$props.$$scope);
};
/**
* @param {EventTarget} node
* @param {string} event
* @param {EventListenerOrEventListenerObject} handler
* @param {boolean | AddEventListenerOptions | EventListenerOptions} [options]
* @returns {() => void}
*/
function listen(node, event, handler, options) {
node.addEventListener(event, handler, options);
return () => node.removeEventListener(event, handler, options);
}
$$self.$$.update = () => {
if ($$self.$$.dirty & /*marqueeWidth, containerWidth, speed*/ 524) {
$$invalidate(11, duration = marqueeWidth < containerWidth
? containerWidth / speed
: marqueeWidth / speed);
}
/**
* @param {Element} node
* @param {string} attribute
* @param {string} [value]
* @returns {void}
*/
function attr(node, attribute, value) {
if (value == null) node.removeAttribute(attribute);
else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);
}
if ($$self.$$.dirty & /*pauseOnHover, pauseOnClick*/ 192) {
$$invalidate(5, _style = `
--pause-on-hover: ${pauseOnHover ? "paused" : "running"};
--pause-on-click: ${pauseOnClick ? "paused" : "running"};
`);
}
/**
* @param {Element} element
* @returns {ChildNode[]}
*/
function children(element) {
return Array.from(element.childNodes);
}
if ($$self.$$.dirty & /*play, direction, duration*/ 3328) {
$$invalidate(4, _marqueeStyle = `
--play: ${play ? "running" : "paused"};
--direction: ${direction === "left" ? "normal" : "reverse"};
--duration: ${duration}s;
`);
}
/**
* @returns {void} */
function set_style(node, key, value, important) {
if (value == null) {
node.style.removeProperty(key);
} else {
node.style.setProperty(key, value, important ? 'important' : '');
}
}
// unfortunately this can't be a constant as that wouldn't be tree-shakeable
// so we cache the result instead
if ($$self.$$.dirty & /*className*/ 2) {
console.log(className);
}
};
/**
* @type {boolean} */
let crossorigin;
return [
gradient,
className,
containerWidth,
marqueeWidth,
_marqueeStyle,
_style,
pauseOnHover,
pauseOnClick,
direction,
speed,
play,
duration,
$$scope,
slots,
div0_elementresize_handler,
div2_elementresize_handler
];
}
/**
* @returns {boolean} */
function is_crossorigin() {
if (crossorigin === undefined) {
crossorigin = false;
try {
if (typeof window !== 'undefined' && window.parent) {
void window.parent.document;
}
} catch (error) {
crossorigin = true;
}
}
return crossorigin;
}
class Marquee extends SvelteComponent {
constructor(options) {
super();
/**
* @param {HTMLElement} node
* @param {() => void} fn
* @returns {() => void}
*/
function add_iframe_resize_listener(node, fn) {
const computed_style = getComputedStyle(node);
if (computed_style.position === 'static') {
node.style.position = 'relative';
}
const iframe = element('iframe');
iframe.setAttribute(
'style',
'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +
'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;'
);
iframe.setAttribute('aria-hidden', 'true');
iframe.tabIndex = -1;
const crossorigin = is_crossorigin();
init(
this,
options,
instance,
create_fragment,
safe_not_equal,
{
pauseOnHover: 6,
pauseOnClick: 7,
direction: 8,
speed: 9,
play: 10,
gradient: 0,
class: 1
},
add_css
);
}
}
/**
* @type {() => void}
*/
let unsubscribe;
if (crossorigin) {
iframe.src = "data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}</script>";
unsubscribe = listen(
window,
'message',
/** @param {MessageEvent} event */ (event) => {
if (event.source === iframe.contentWindow) fn();
}
);
} else {
iframe.src = 'about:blank';
iframe.onload = () => {
unsubscribe = listen(iframe.contentWindow, 'resize', fn);
// make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)
// see https://github.com/sveltejs/svelte/issues/4233
fn();
};
}
append(node, iframe);
return () => {
if (crossorigin) {
unsubscribe();
} else if (unsubscribe && iframe.contentWindow) {
unsubscribe();
}
detach(iframe);
};
}
return Marquee;
/**
* @typedef {Node & {
* claim_order?: number;
* hydrate_init?: true;
* actual_end_child?: NodeEx;
* childNodes: NodeListOf<NodeEx>;
* }} NodeEx
*/
/** @typedef {ChildNode & NodeEx} ChildNodeEx */
/** @typedef {NodeEx & { claim_order: number }} NodeEx2 */
/**
* @typedef {ChildNodeEx[] & {
* claim_info?: {
* last_index: number;
* total_claimed: number;
* };
* }} ChildNodeArray
*/
let current_component;
/** @returns {void} */
function set_current_component(component) {
current_component = component;
}
const dirty_components = [];
const binding_callbacks = [];
let render_callbacks = [];
const flush_callbacks = [];
const resolved_promise = /* @__PURE__ */ Promise.resolve();
let update_scheduled = false;
/** @returns {void} */
function schedule_update() {
if (!update_scheduled) {
update_scheduled = true;
resolved_promise.then(flush);
}
}
/** @returns {void} */
function add_render_callback(fn) {
render_callbacks.push(fn);
}
// flush() calls callbacks in this order:
// 1. All beforeUpdate callbacks, in order: parents before children
// 2. All bind:this callbacks, in reverse order: children before parents.
// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
// for afterUpdates called during the initial onMount, which are called in
// reverse order: children before parents.
// Since callbacks might update component values, which could trigger another
// call to flush(), the following steps guard against this:
// 1. During beforeUpdate, any updated components will be added to the
// dirty_components array and will cause a reentrant call to flush(). Because
// the flush index is kept outside the function, the reentrant call will pick
// up where the earlier call left off and go through all dirty components. The
// current_component value is saved and restored so that the reentrant call will
// not interfere with the "parent" flush() call.
// 2. bind:this callbacks cannot trigger new flush() calls.
// 3. During afterUpdate, any updated components will NOT have their afterUpdate
// callback called a second time; the seen_callbacks set, outside the flush()
// function, guarantees this behavior.
const seen_callbacks = new Set();
let flushidx = 0; // Do *not* move this inside the flush() function
/** @returns {void} */
function flush() {
// Do not reenter flush while dirty components are updated, as this can
// result in an infinite loop. Instead, let the inner flush handle it.
// Reentrancy is ok afterwards for bindings etc.
if (flushidx !== 0) {
return;
}
const saved_component = current_component;
do {
// first, call beforeUpdate functions
// and update components
try {
while (flushidx < dirty_components.length) {
const component = dirty_components[flushidx];
flushidx++;
set_current_component(component);
update(component.$$);
}
} catch (e) {
// reset dirty state to not end up in a deadlocked state and then rethrow
dirty_components.length = 0;
flushidx = 0;
throw e;
}
set_current_component(null);
dirty_components.length = 0;
flushidx = 0;
while (binding_callbacks.length) binding_callbacks.pop()();
// then, once components are updated, call
// afterUpdate functions. This may cause
// subsequent updates...
for (let i = 0; i < render_callbacks.length; i += 1) {
const callback = render_callbacks[i];
if (!seen_callbacks.has(callback)) {
// ...so guard against infinite loops
seen_callbacks.add(callback);
callback();
}
}
render_callbacks.length = 0;
} while (dirty_components.length);
while (flush_callbacks.length) {
flush_callbacks.pop()();
}
update_scheduled = false;
seen_callbacks.clear();
set_current_component(saved_component);
}
/** @returns {void} */
function update($$) {
if ($$.fragment !== null) {
$$.update();
run_all($$.before_update);
const dirty = $$.dirty;
$$.dirty = [-1];
$$.fragment && $$.fragment.p($$.ctx, dirty);
$$.after_update.forEach(add_render_callback);
}
}
/**
* Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.
* @param {Function[]} fns
* @returns {void}
*/
function flush_render_callbacks(fns) {
const filtered = [];
const targets = [];
render_callbacks.forEach((c) => (fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c)));
targets.forEach((c) => c());
render_callbacks = filtered;
}
const outroing = new Set();
/**
* @type {Outro}
*/
let outros;
/**
* @param {import('./private.js').Fragment} block
* @param {0 | 1} [local]
* @returns {void}
*/
function transition_in(block, local) {
if (block && block.i) {
outroing.delete(block);
block.i(local);
}
}
/**
* @param {import('./private.js').Fragment} block
* @param {0 | 1} local
* @param {0 | 1} [detach]
* @param {() => void} [callback]
* @returns {void}
*/
function transition_out(block, local, detach, callback) {
if (block && block.o) {
if (outroing.has(block)) return;
outroing.add(block);
outros.c.push(() => {
outroing.delete(block);
if (callback) {
if (detach) block.d(1);
callback();
}
});
block.o(local);
} else if (callback) {
callback();
}
}
/** @typedef {1} INTRO */
/** @typedef {0} OUTRO */
/** @typedef {{ direction: 'in' | 'out' | 'both' }} TransitionOptions */
/** @typedef {(node: Element, params: any, options: TransitionOptions) => import('../transition/public.js').TransitionConfig} TransitionFn */
/**
* @typedef {Object} Outro
* @property {number} r
* @property {Function[]} c
* @property {Object} p
*/
/**
* @typedef {Object} PendingProgram
* @property {number} start
* @property {INTRO|OUTRO} b
* @property {Outro} [group]
*/
/**
* @typedef {Object} Program
* @property {number} a
* @property {INTRO|OUTRO} b
* @property {1|-1} d
* @property {number} duration
* @property {number} start
* @property {number} end
* @property {Outro} [group]
*/
/** @returns {void} */
function mount_component(component, target, anchor) {
const { fragment, after_update } = component.$$;
fragment && fragment.m(target, anchor);
// onMount happens before the initial afterUpdate
add_render_callback(() => {
const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
// if the component was destroyed immediately
// it will update the `$$.on_destroy` reference to `null`.
// the destructured on_destroy may still reference to the old array
if (component.$$.on_destroy) {
component.$$.on_destroy.push(...new_on_destroy);
} else {
// Edge case - component was destroyed immediately,
// most likely as a result of a binding initialising
run_all(new_on_destroy);
}
component.$$.on_mount = [];
});
after_update.forEach(add_render_callback);
}
/** @returns {void} */
function destroy_component(component, detaching) {
const $$ = component.$$;
if ($$.fragment !== null) {
flush_render_callbacks($$.after_update);
run_all($$.on_destroy);
$$.fragment && $$.fragment.d(detaching);
// TODO null out other refs, including component.$$ (but need to
// preserve final state?)
$$.on_destroy = $$.fragment = null;
$$.ctx = [];
}
}
/** @returns {void} */
function make_dirty(component, i) {
if (component.$$.dirty[0] === -1) {
dirty_components.push(component);
schedule_update();
component.$$.dirty.fill(0);
}
component.$$.dirty[(i / 31) | 0] |= 1 << i % 31;
}
/** @returns {void} */
function init(
component,
options,
instance,
create_fragment,
not_equal,
props,
append_styles,
dirty = [-1]
) {
const parent_component = current_component;
set_current_component(component);
/** @type {import('./private.js').T$$} */
const $$ = (component.$$ = {
fragment: null,
ctx: [],
// state
props,
update: noop,
not_equal,
bound: blank_object(),
// lifecycle
on_mount: [],
on_destroy: [],
on_disconnect: [],
before_update: [],
after_update: [],
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
// everything else
callbacks: blank_object(),
dirty,
skip_bound: false,
root: options.target || parent_component.$$.root
});
append_styles && append_styles($$.root);
let ready = false;
$$.ctx = instance
? instance(component, options.props || {}, (i, ret, ...rest) => {
const value = rest.length ? rest[0] : ret;
if ($$.ctx && not_equal($$.ctx[i], ($$.ctx[i] = value))) {
if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
if (ready) make_dirty(component, i);
}
return ret;
})
: [];
$$.update();
ready = true;
run_all($$.before_update);
// `false` as a special case of no DOM component
$$.fragment = create_fragment ? create_fragment($$.ctx) : false;
if (options.target) {
if (options.hydrate) {
const nodes = children(options.target);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$$.fragment && $$.fragment.l(nodes);
nodes.forEach(detach);
} else {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$$.fragment && $$.fragment.c();
}
if (options.intro) transition_in(component.$$.fragment);
mount_component(component, options.target, options.anchor);
flush();
}
set_current_component(parent_component);
}
/**
* Base class for Svelte components. Used when dev=false.
*
* @template {Record<string, any>} [Props=any]
* @template {Record<string, any>} [Events=any]
*/
class SvelteComponent {
/**
* ### PRIVATE API
*
* Do not use, may change at any time
*
* @type {any}
*/
$$ = undefined;
/**
* ### PRIVATE API
*
* Do not use, may change at any time
*
* @type {any}
*/
$$set = undefined;
/** @returns {void} */
$destroy() {
destroy_component(this, 1);
this.$destroy = noop;
}
/**
* @template {Extract<keyof Events, string>} K
* @param {K} type
* @param {((e: Events[K]) => void) | null | undefined} callback
* @returns {() => void}
*/
$on(type, callback) {
if (!is_function(callback)) {
return noop;
}
const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
callbacks.push(callback);
return () => {
const index = callbacks.indexOf(callback);
if (index !== -1) callbacks.splice(index, 1);
};
}
/**
* @param {Partial<Props>} props
* @returns {void}
*/
$set(props) {
if (this.$$set && !is_empty(props)) {
this.$$.skip_bound = true;
this.$$set(props);
this.$$.skip_bound = false;
}
}
}
/**
* @typedef {Object} CustomElementPropDefinition
* @property {string} [attribute]
* @property {boolean} [reflect]
* @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type]
*/
/* src/Marquee.svelte generated by Svelte v3.59.2 */
function add_css(target) {
append_styles(target, "svelte-1qw93g3", ".marquee-container.svelte-1qw93g3.svelte-1qw93g3{display:flex;width:100%;overflow-x:hidden;flex-direction:row;position:relative}.marquee-container.svelte-1qw93g3:hover .marquee.svelte-1qw93g3{animation-play-state:var(--pause-on-hover)}.marquee-container.svelte-1qw93g3:active .marquee.svelte-1qw93g3{animation-play-state:var(--pause-on-click)}.marquee.svelte-1qw93g3.svelte-1qw93g3{flex:0 0 auto;min-width:100%;z-index:1;display:flex;flex-direction:row;align-items:center;animation:svelte-1qw93g3-scroll var(--duration) linear infinite;animation-play-state:var(--play);animation-direction:var(--direction)}@keyframes svelte-1qw93g3-scroll{0%{transform:translateX(0%)}100%{transform:translateX(-100%)}}.initial-child-container.svelte-1qw93g3.svelte-1qw93g3{flex:0 0 auto;display:flex;min-width:auto;flex-direction:row}.gradient.svelte-1qw93g3.svelte-1qw93g3::after,.gradient.svelte-1qw93g3.svelte-1qw93g3::before{background:linear-gradient(\n\t\t\tto right,\n\t\t\tvar(--gradientColor, white),\n\t\t\ttransparent\n\t\t);content:\"\";height:100%;position:absolute;width:var(--gradientWidth, 10%);z-index:2}.gradient.svelte-1qw93g3.svelte-1qw93g3::before{left:0;top:0}.gradient.svelte-1qw93g3.svelte-1qw93g3::after{right:0;top:0;transform:rotateZ(180deg)}");
}
// (68:1) {#if gradient}
function create_if_block(ctx) {
let div;
return {
c() {
div = element("div");
attr(div, "class", "gradient svelte-1qw93g3");
},
m(target, anchor) {
insert(target, div, anchor);
},
d(detaching) {
if (detaching) detach(div);
}
};
}
function create_fragment(ctx) {
let div2;
let t0;
let div0;
let div0_resize_listener;
let t1;
let div1;
let div2_class_value;
let div2_resize_listener;
let current;
let if_block = /*gradient*/ ctx[5] && create_if_block();
const default_slot_template = /*#slots*/ ctx[12].default;
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[11], null);
const default_slot_template_1 = /*#slots*/ ctx[12].default;
const default_slot_1 = create_slot(default_slot_template_1, ctx, /*$$scope*/ ctx[11], null);
return {
c() {
div2 = element("div");
if (if_block) if_block.c();
t0 = space();
div0 = element("div");
if (default_slot) default_slot.c();
t1 = space();
div1 = element("div");
if (default_slot_1) default_slot_1.c();
attr(div0, "class", "marquee svelte-1qw93g3");
add_render_callback(() => /*div0_elementresize_handler*/ ctx[13].call(div0));
attr(div1, "class", "marquee svelte-1qw93g3");
attr(div2, "style", /*style*/ ctx[0]);
attr(div2, "class", div2_class_value = "marquee-container " + /*className*/ ctx[6] + " svelte-1qw93g3");
add_render_callback(() => /*div2_elementresize_handler*/ ctx[14].call(div2));
set_style(div2, "--play", /*play*/ ctx[4]);
set_style(div2, "--direction", /*direction*/ ctx[3] === "left" ? "normal" : "reverse");
set_style(div2, "--duration", /*duration*/ ctx[9] + "s");
set_style(div2, "--pause-on-hover", /*pauseOnHover*/ ctx[1] ? "paused" : "running");
set_style(div2, "--pause-on-click", /*pauseOnClick*/ ctx[2] ? "paused" : "running");
},
m(target, anchor) {
insert(target, div2, anchor);
if (if_block) if_block.m(div2, null);
append(div2, t0);
append(div2, div0);
if (default_slot) {
default_slot.m(div0, null);
}
div0_resize_listener = add_iframe_resize_listener(div0, /*div0_elementresize_handler*/ ctx[13].bind(div0));
append(div2, t1);
append(div2, div1);
if (default_slot_1) {
default_slot_1.m(div1, null);
}
div2_resize_listener = add_iframe_resize_listener(div2, /*div2_elementresize_handler*/ ctx[14].bind(div2));
current = true;
},
p(ctx, [dirty]) {
if (/*gradient*/ ctx[5]) {
if (if_block) ; else {
if_block = create_if_block();
if_block.c();
if_block.m(div2, t0);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
if (default_slot) {
if (default_slot.p && (!current || dirty & /*$$scope*/ 2048)) {
update_slot_base(
default_slot,
default_slot_template,
ctx,
/*$$scope*/ ctx[11],
!current
? get_all_dirty_from_scope(/*$$scope*/ ctx[11])
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[11], dirty, null),
null
);
}
}
if (default_slot_1) {
if (default_slot_1.p && (!current || dirty & /*$$scope*/ 2048)) {
update_slot_base(
default_slot_1,
default_slot_template_1,
ctx,
/*$$scope*/ ctx[11],
!current
? get_all_dirty_from_scope(/*$$scope*/ ctx[11])
: get_slot_changes(default_slot_template_1, /*$$scope*/ ctx[11], dirty, null),
null
);
}
}
if (!current || dirty & /*style*/ 1) {
attr(div2, "style", /*style*/ ctx[0]);
}
if (!current || dirty & /*className*/ 64 && div2_class_value !== (div2_class_value = "marquee-container " + /*className*/ ctx[6] + " svelte-1qw93g3")) {
attr(div2, "class", div2_class_value);
}
const style_changed = dirty & /*style*/ 1;
if (style_changed || dirty & /*play, style*/ 17) {
set_style(div2, "--play", /*play*/ ctx[4]);
}
if (style_changed || dirty & /*direction, style*/ 9) {
set_style(div2, "--direction", /*direction*/ ctx[3] === "left" ? "normal" : "reverse");
}
if (style_changed || dirty & /*duration, style*/ 513) {
set_style(div2, "--duration", /*duration*/ ctx[9] + "s");
}
if (style_changed || dirty & /*pauseOnHover, style*/ 3) {
set_style(div2, "--pause-on-hover", /*pauseOnHover*/ ctx[1] ? "paused" : "running");
}
if (style_changed || dirty & /*pauseOnClick, style*/ 5) {
set_style(div2, "--pause-on-click", /*pauseOnClick*/ ctx[2] ? "paused" : "running");
}
},
i(local) {
if (current) return;
transition_in(default_slot, local);
transition_in(default_slot_1, local);
current = true;
},
o(local) {
transition_out(default_slot, local);
transition_out(default_slot_1, local);
current = false;
},
d(detaching) {
if (detaching) detach(div2);
if (if_block) if_block.d();
if (default_slot) default_slot.d(detaching);
div0_resize_listener();
if (default_slot_1) default_slot_1.d(detaching);
div2_resize_listener();
}
};
}
function instance($$self, $$props, $$invalidate) {
let duration;
let { $$slots: slots = {}, $$scope } = $$props;
let { style = {} } = $$props;
let { pauseOnHover = false } = $$props;
let { pauseOnClick = false } = $$props;
let { direction = "left" } = $$props;
let { speed = 100 } = $$props;
let { play = true } = $$props;
let { gradient = false } = $$props;
let { class: className = "" } = $$props;
let containerWidth;
let marqueeWidth;
function div0_elementresize_handler() {
marqueeWidth = this.clientWidth;
$$invalidate(8, marqueeWidth);
}
function div2_elementresize_handler() {
containerWidth = this.clientWidth;
$$invalidate(7, containerWidth);
}
$$self.$$set = $$props => {
if ('style' in $$props) $$invalidate(0, style = $$props.style);
if ('pauseOnHover' in $$props) $$invalidate(1, pauseOnHover = $$props.pauseOnHover);
if ('pauseOnClick' in $$props) $$invalidate(2, pauseOnClick = $$props.pauseOnClick);
if ('direction' in $$props) $$invalidate(3, direction = $$props.direction);
if ('speed' in $$props) $$invalidate(10, speed = $$props.speed);
if ('play' in $$props) $$invalidate(4, play = $$props.play);
if ('gradient' in $$props) $$invalidate(5, gradient = $$props.gradient);
if ('class' in $$props) $$invalidate(6, className = $$props.class);
if ('$$scope' in $$props) $$invalidate(11, $$scope = $$props.$$scope);
};
$$self.$$.update = () => {
if ($$self.$$.dirty & /*marqueeWidth, containerWidth, speed*/ 1408) {
$$invalidate(9, duration = marqueeWidth < containerWidth
? containerWidth / speed
: marqueeWidth / speed);
}
};
return [
style,
pauseOnHover,
pauseOnClick,
direction,
play,
gradient,
className,
containerWidth,
marqueeWidth,
duration,
speed,
$$scope,
slots,
div0_elementresize_handler,
div2_elementresize_handler
];
}
class Marquee extends SvelteComponent {
constructor(options) {
super();
init(
this,
options,
instance,
create_fragment,
safe_not_equal,
{
style: 0,
pauseOnHover: 1,
pauseOnClick: 2,
direction: 3,
speed: 10,
play: 4,
gradient: 5,
class: 6
},
add_css
);
}
}
return Marquee;
}));
{
"name": "svelte-fast-marquee",
"version": "0.5.4",
"version": "0.6.0",
"description": "A Marquee component for Svelte inspired by react-fast-marquee.",

@@ -43,11 +43,11 @@ "main": "dist/index.js",

"devDependencies": {
"@babel/core": "^7.14.8",
"@babel/preset-env": "^7.14.8",
"@rollup/plugin-node-resolve": "^13.0.4",
"rollup": "^2.53.3",
"rollup-plugin-svelte": "^7.1.0",
"sveld": "latest",
"svelte": "^3.40.2",
"svelte-check": "^2.2.3"
"@babel/core": "7.14.8",
"@babel/preset-env": "7.14.8",
"@rollup/plugin-node-resolve": "13.0.4",
"rollup": "2.53.3",
"rollup-plugin-svelte": "7.1.0",
"sveld": "0.19.0",
"svelte": "4.2.0",
"svelte-check": "3.5.1"
}
}

@@ -60,9 +60,12 @@ # Svelte Fast Marquee

| Property | Type | Default | Description |
| :-------------- | :-------------------------- | :---------------- | :------------------------------------------------------- |
| `class` | `string` | `` | The name of the css class to style the container div. |
| `play` | `boolean` | `true` | Whether to play or pause the marquee |
| `pauseOnHover` | `boolean` | `false` | Whether to pause the marquee when hovered |
| `pauseOnClick` | `boolean` | `false` | Whether to pause the marquee when clicked |
| `direction` | `"left"` or `"right"` | `"left"` | The direction the marquee is sliding |
| `gradient` | `boolean` | `false` | Whether to show a gradient on right and left |
| Property | Type | Default | Description |
| :---------------- | :-------------------------- | :---------------- | :------------------------------------------------------- |
| `style` | `string` | `` | The inline style for the container div. |
| `class` | `string` | `` | The name of the css class to style the container div. |
| `play` | `boolean` | `true` | Whether to play or pause the marquee |
| `pauseOnHover` | `boolean` | `false` | Whether to pause the marquee when hovered |
| `pauseOnClick` | `boolean` | `false` | Whether to pause the marquee when clicked |
| `direction` | `"left"` or `"right"` | `"left"` | The direction the marquee is sliding |
| `gradient` | `boolean` | `false` | Whether to show a gradient on right and left |
| `--gradientWidth` | `string` | "10%" | The width of the gradient on either side. |
| `--gradientColor` | `string` | "white" | The color of the gradient |

@@ -5,2 +5,8 @@ import type { SvelteComponentTyped } from "svelte";

/**
* Custom style
* @default {}
*/
style?: string;
/**
* Pause on hover

@@ -7,0 +13,0 @@ * @default false

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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