-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from ya-erm/dev
Version 2.8.6
- Loading branch information
Showing
28 changed files
with
565 additions
and
123 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "client", | ||
"version": "2.8.5", | ||
"version": "2.8.6", | ||
"private": true, | ||
"scripts": { | ||
"dev": "vite dev", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<script> | ||
/** | ||
* The HTML Element to observe. | ||
* @type {null | HTMLElement} | ||
*/ | ||
export let element = null; | ||
/** | ||
* Set to `true` to unobserve the element | ||
* after it intersects the viewport. | ||
* @type {boolean} | ||
*/ | ||
export let once = false; | ||
/** | ||
* `true` if the observed element | ||
* is intersecting the viewport. | ||
*/ | ||
export let intersecting = false; | ||
/** | ||
* Specify the containing element. | ||
* Defaults to the browser viewport. | ||
* @type {null | HTMLElement} | ||
*/ | ||
export let root = null; | ||
/** Margin offset of the containing element. */ | ||
export let rootMargin = '0px'; | ||
/** | ||
* Percentage of element visibility to trigger an event. | ||
* Value must be between 0 and 1. | ||
*/ | ||
export let threshold = 0; | ||
/** | ||
* Observed element metadata. | ||
* @type {null | IntersectionObserverEntry} | ||
*/ | ||
export let entry = null; | ||
/** | ||
* `IntersectionObserver` instance. | ||
* @type {null | IntersectionObserver} | ||
*/ | ||
export let observer = null; | ||
import { tick, createEventDispatcher, afterUpdate, onMount } from 'svelte'; | ||
const dispatch = createEventDispatcher(); | ||
/** @type {null | string} */ | ||
let prevRootMargin = null; | ||
/** @type {null | HTMLElement} */ | ||
let prevElement = null; | ||
const initialize = () => { | ||
observer = new IntersectionObserver( | ||
(entries) => { | ||
entries.forEach((_entry) => { | ||
entry = _entry; | ||
intersecting = _entry.isIntersecting; | ||
}); | ||
}, | ||
{ root, rootMargin, threshold }, | ||
); | ||
}; | ||
onMount(() => { | ||
initialize(); | ||
return () => { | ||
if (observer) { | ||
observer.disconnect(); | ||
observer = null; | ||
} | ||
}; | ||
}); | ||
afterUpdate(async () => { | ||
if (entry !== null) { | ||
dispatch('observe', entry); | ||
if (entry.isIntersecting) { | ||
dispatch('intersect', entry); | ||
if (element && once) observer?.unobserve(element); | ||
} | ||
} | ||
await tick(); | ||
if (element !== null && element !== prevElement) { | ||
observer?.observe(element); | ||
if (prevElement !== null) observer?.unobserve(prevElement); | ||
prevElement = element; | ||
} | ||
if (prevRootMargin && rootMargin !== prevRootMargin) { | ||
observer?.disconnect(); | ||
prevElement = null; | ||
initialize(); | ||
} | ||
prevRootMargin = rootMargin; | ||
}); | ||
</script> | ||
<slot {intersecting} {entry} {observer} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script lang="ts"> | ||
import { translate } from '$lib/translate'; | ||
import Button from '$lib/ui/Button.svelte'; | ||
import IntersectionObserver from '$lib/ui/IntersectionObserver.svelte'; | ||
export let limit: number; | ||
export let step: number; | ||
export let total: number; | ||
let showMoreContainer: HTMLDivElement; | ||
const showMore = () => { | ||
limit = Math.min(total, limit + step); | ||
}; | ||
</script> | ||
|
||
<IntersectionObserver element={showMoreContainer} on:intersect={showMore}> | ||
<slot /> | ||
<div class="show-more"> | ||
<div bind:this={showMoreContainer} class="show-more-before" /> | ||
{#if limit < total} | ||
<div class="flex-col px-1 pb-1"> | ||
<Button color="white" on:click={showMore}> | ||
{$translate('transactions.show_more')} | ||
</Button> | ||
</div> | ||
{/if} | ||
</div> | ||
</IntersectionObserver> | ||
|
||
<style> | ||
.show-more { | ||
position: relative; | ||
} | ||
.show-more-before { | ||
position: absolute; | ||
top: -200px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.