svelte-infinite-loading
Advanced tools
Comparing version 1.3.5 to 1.3.6
@@ -252,18 +252,20 @@ (function (global, factory) { | ||
} | ||
function mount_component(component, target, anchor) { | ||
function mount_component(component, target, anchor, customElement) { | ||
const { fragment, on_mount, on_destroy, after_update } = component.$$; | ||
fragment && fragment.m(target, anchor); | ||
// onMount happens before the initial afterUpdate | ||
add_render_callback(() => { | ||
const new_on_destroy = on_mount.map(run).filter(is_function); | ||
if (on_destroy) { | ||
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 = []; | ||
}); | ||
if (!customElement) { | ||
// onMount happens before the initial afterUpdate | ||
add_render_callback(() => { | ||
const new_on_destroy = on_mount.map(run).filter(is_function); | ||
if (on_destroy) { | ||
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); | ||
@@ -293,3 +295,2 @@ } | ||
set_current_component(component); | ||
const prop_values = options.props || {}; | ||
const $$ = component.$$ = { | ||
@@ -306,2 +307,3 @@ fragment: null, | ||
on_destroy: [], | ||
on_disconnect: [], | ||
before_update: [], | ||
@@ -317,3 +319,3 @@ after_update: [], | ||
$$.ctx = instance | ||
? instance(component, prop_values, (i, ret, ...rest) => { | ||
? instance(component, options.props || {}, (i, ret, ...rest) => { | ||
const value = rest.length ? rest[0] : ret; | ||
@@ -347,3 +349,3 @@ if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { | ||
transition_in(component.$$.fragment); | ||
mount_component(component, options.target, options.anchor); | ||
mount_component(component, options.target, options.anchor, options.customElement); | ||
flush(); | ||
@@ -379,5 +381,5 @@ } | ||
/* src/Spinner.svelte generated by Svelte v3.31.0 */ | ||
/* src/Spinner.svelte generated by Svelte v3.35.0 */ | ||
function add_css() { | ||
function add_css$1() { | ||
var style = element("style"); | ||
@@ -408,3 +410,3 @@ style.id = "svelte-10h86fq-style"; | ||
// (38:33) | ||
function create_if_block_3(ctx) { | ||
function create_if_block_3$1(ctx) { | ||
let span5; | ||
@@ -434,3 +436,3 @@ | ||
// (33:31) | ||
function create_if_block_2(ctx) { | ||
function create_if_block_2$1(ctx) { | ||
let i; | ||
@@ -453,3 +455,3 @@ | ||
// (19:32) | ||
function create_if_block_1(ctx) { | ||
function create_if_block_1$1(ctx) { | ||
let span8; | ||
@@ -482,3 +484,3 @@ | ||
// (5:0) {#if spinner === 'bubbles'} | ||
function create_if_block(ctx) { | ||
function create_if_block$1(ctx) { | ||
let span8; | ||
@@ -510,10 +512,10 @@ | ||
function create_fragment(ctx) { | ||
function create_fragment$1(ctx) { | ||
let if_block_anchor; | ||
function select_block_type(ctx, dirty) { | ||
if (/*spinner*/ ctx[0] === "bubbles") return create_if_block; | ||
if (/*spinner*/ ctx[0] === "circles") return create_if_block_1; | ||
if (/*spinner*/ ctx[0] === "spiral") return create_if_block_2; | ||
if (/*spinner*/ ctx[0] === "wavedots") return create_if_block_3; | ||
if (/*spinner*/ ctx[0] === "bubbles") return create_if_block$1; | ||
if (/*spinner*/ ctx[0] === "circles") return create_if_block_1$1; | ||
if (/*spinner*/ ctx[0] === "spiral") return create_if_block_2$1; | ||
if (/*spinner*/ ctx[0] === "wavedots") return create_if_block_3$1; | ||
return create_else_block; | ||
@@ -554,3 +556,3 @@ } | ||
function instance($$self, $$props, $$invalidate) { | ||
function instance$1($$self, $$props, $$invalidate) { | ||
let { spinner = "" } = $$props; | ||
@@ -568,12 +570,12 @@ | ||
super(); | ||
if (!document.getElementById("svelte-10h86fq-style")) add_css(); | ||
init(this, options, instance, create_fragment, safe_not_equal, { spinner: 0 }); | ||
if (!document.getElementById("svelte-10h86fq-style")) add_css$1(); | ||
init(this, options, instance$1, create_fragment$1, safe_not_equal, { spinner: 0 }); | ||
} | ||
} | ||
/* src/InfiniteLoading.svelte generated by Svelte v3.31.0 */ | ||
/* src/InfiniteLoading.svelte generated by Svelte v3.35.0 */ | ||
const { document: document_1 } = globals; | ||
function add_css$1() { | ||
function add_css() { | ||
var style = element("style"); | ||
@@ -594,4 +596,4 @@ style.id = "svelte-o3w4bf-style"; | ||
// (323:1) {#if showSpinner} | ||
function create_if_block_3$1(ctx) { | ||
// (325:1) {#if showSpinner} | ||
function create_if_block_3(ctx) { | ||
let div; | ||
@@ -645,3 +647,3 @@ let current; | ||
// (325:38) | ||
// (327:38) | ||
function fallback_block_3(ctx) { | ||
@@ -680,4 +682,4 @@ let spinner_1; | ||
// (331:1) {#if showNoResults} | ||
function create_if_block_2$1(ctx) { | ||
// (333:1) {#if showNoResults} | ||
function create_if_block_2(ctx) { | ||
let div; | ||
@@ -727,3 +729,3 @@ let current; | ||
// (333:26) No results :( | ||
// (335:26) No results :( | ||
function fallback_block_2(ctx) { | ||
@@ -745,4 +747,4 @@ let t; | ||
// (339:1) {#if showNoMore} | ||
function create_if_block_1$1(ctx) { | ||
// (341:1) {#if showNoMore} | ||
function create_if_block_1(ctx) { | ||
let div; | ||
@@ -792,3 +794,3 @@ let current; | ||
// (341:23) No more data :) | ||
// (343:23) No more data :) | ||
function fallback_block_1(ctx) { | ||
@@ -810,4 +812,4 @@ let t; | ||
// (347:1) {#if showError} | ||
function create_if_block$1(ctx) { | ||
// (349:1) {#if showError} | ||
function create_if_block(ctx) { | ||
let div; | ||
@@ -857,3 +859,3 @@ let current; | ||
// (349:36) Oops, something went wrong :( | ||
// (351:36) Oops, something went wrong :( | ||
function fallback_block(ctx) { | ||
@@ -899,3 +901,3 @@ let t0; | ||
function create_fragment$1(ctx) { | ||
function create_fragment(ctx) { | ||
let div; | ||
@@ -906,6 +908,6 @@ let t0; | ||
let current; | ||
let if_block0 = /*showSpinner*/ ctx[3] && create_if_block_3$1(ctx); | ||
let if_block1 = /*showNoResults*/ ctx[5] && create_if_block_2$1(ctx); | ||
let if_block2 = /*showNoMore*/ ctx[6] && create_if_block_1$1(ctx); | ||
let if_block3 = /*showError*/ ctx[4] && create_if_block$1(ctx); | ||
let if_block0 = /*showSpinner*/ ctx[3] && create_if_block_3(ctx); | ||
let if_block1 = /*showNoResults*/ ctx[5] && create_if_block_2(ctx); | ||
let if_block2 = /*showNoMore*/ ctx[6] && create_if_block_1(ctx); | ||
let if_block3 = /*showError*/ ctx[4] && create_if_block(ctx); | ||
@@ -945,3 +947,3 @@ return { | ||
} else { | ||
if_block0 = create_if_block_3$1(ctx); | ||
if_block0 = create_if_block_3(ctx); | ||
if_block0.c(); | ||
@@ -969,3 +971,3 @@ transition_in(if_block0, 1); | ||
} else { | ||
if_block1 = create_if_block_2$1(ctx); | ||
if_block1 = create_if_block_2(ctx); | ||
if_block1.c(); | ||
@@ -993,3 +995,3 @@ transition_in(if_block1, 1); | ||
} else { | ||
if_block2 = create_if_block_1$1(ctx); | ||
if_block2 = create_if_block_1(ctx); | ||
if_block2.c(); | ||
@@ -1017,3 +1019,3 @@ transition_in(if_block2, 1); | ||
} else { | ||
if_block3 = create_if_block$1(ctx); | ||
if_block3 = create_if_block(ctx); | ||
if_block3.c(); | ||
@@ -1059,9 +1061,2 @@ transition_in(if_block3, 1); | ||
const STATUS = { | ||
READY: 0, | ||
LOADING: 1, | ||
COMPLETE: 2, | ||
ERROR: 3 | ||
}; | ||
const THROTTLE_LIMIT = 50; | ||
@@ -1205,5 +1200,17 @@ const LOOP_CHECK_TIMEOUT = 1000; | ||
function instance$1($$self, $$props, $$invalidate) { | ||
function instance($$self, $$props, $$invalidate) { | ||
let showSpinner; | ||
let showError; | ||
let showNoResults; | ||
let showNoMore; | ||
let { $$slots: slots = {}, $$scope } = $$props; | ||
const dispatch = createEventDispatcher(); | ||
const STATUS = { | ||
READY: 0, | ||
LOADING: 1, | ||
COMPLETE: 2, | ||
ERROR: 3 | ||
}; | ||
let { distance = 100 } = $$props; | ||
@@ -1384,22 +1391,17 @@ let { spinner = "default" } = $$props; | ||
let showSpinner; | ||
let showError; | ||
let showNoResults; | ||
let showNoMore; | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty & /*status*/ 4096) { | ||
$$invalidate(3, showSpinner = status === STATUS.LOADING); | ||
$$invalidate(3, showSpinner = status === STATUS.LOADING); | ||
} | ||
if ($$self.$$.dirty & /*status*/ 4096) { | ||
$$invalidate(4, showError = status === STATUS.ERROR); | ||
$$invalidate(4, showError = status === STATUS.ERROR); | ||
} | ||
if ($$self.$$.dirty & /*status, isFirstLoad*/ 4098) { | ||
$$invalidate(5, showNoResults = status === STATUS.COMPLETE && isFirstLoad); | ||
$$invalidate(5, showNoResults = status === STATUS.COMPLETE && isFirstLoad); | ||
} | ||
if ($$self.$$.dirty & /*status, isFirstLoad*/ 4098) { | ||
$$invalidate(6, showNoMore = status === STATUS.COMPLETE && !isFirstLoad); | ||
$$invalidate(6, showNoMore = status === STATUS.COMPLETE && !isFirstLoad); | ||
} | ||
@@ -1409,3 +1411,3 @@ | ||
// Watch forceUseInfiniteWrapper and mounted | ||
(updateScrollParent()); | ||
(updateScrollParent()); | ||
} | ||
@@ -1415,3 +1417,3 @@ | ||
// Watch identifier and mounted | ||
(identifierUpdated()); | ||
(identifierUpdated()); | ||
} | ||
@@ -1444,5 +1446,5 @@ }; | ||
super(); | ||
if (!document_1.getElementById("svelte-o3w4bf-style")) add_css$1(); | ||
if (!document_1.getElementById("svelte-o3w4bf-style")) add_css(); | ||
init(this, options, instance$1, create_fragment$1, safe_not_equal, { | ||
init(this, options, instance, create_fragment, safe_not_equal, { | ||
distance: 8, | ||
@@ -1449,0 +1451,0 @@ spinner: 0, |
{ | ||
"name": "svelte-infinite-loading", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"description": "An infinite scroll component for Svelte apps", | ||
@@ -5,0 +5,0 @@ "svelte": "src/index.js", |
@@ -14,3 +14,3 @@ <p align="center"><img src="https://raw.githubusercontent.com/Skayo/svelte-infinite-loading/master/assets/InfiniteLogo.svg" alt="InfiniteLogo" width="225"></p> | ||
<a href="#documentation">Documentation</a> • | ||
<a href="#examples">Examples</a> • | ||
<a href="#examples--demo">Examples</a> • | ||
<a href="#license">License</a> | ||
@@ -22,3 +22,3 @@ </p> | ||
An infinite scroll component for Svelte, to help you implement an infinite scroll list more easily. | ||
This is heavily inspired by [vue-infinite-loading](https://peachscript.github.io/vue-infinite-loading/) and uses most of its ideas and functionality! | ||
This is heavily inspired by [vue-infinite-loading](https://peachscript.github.io/vue-infinite-loading/) and uses most of its code and functionality! | ||
@@ -68,2 +68,3 @@ ### Features | ||
- [Hacker News with Top Direction](https://svelte.dev/repl/9a04b19fcf5f4da0bead27f1cdf55cfb) | ||
- [Hacker News using svelte-tiny-virtual-list](https://svelte.dev/repl/2239cc4c861c41d18abbc858248f5a0d) | ||
@@ -70,0 +71,0 @@ For more information on how to use this library, check the [documentation](https://github.com/Skayo/svelte-infinite-loading/wiki)! |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
124768
2739
79