refactor virtual list
This commit is contained in:
parent
ab3efd2829
commit
569f384192
|
@ -15,7 +15,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<script>
|
<script>
|
||||||
import Nav from './Nav.html';
|
import Nav from './Nav.html';
|
||||||
import VirtualListContainer from './VirtualListContainer.html'
|
import VirtualListContainer from './virtualList/VirtualListContainer.html'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
import { getTimeline } from '../_utils/mastodon/timelines'
|
import { getTimeline } from '../_utils/mastodon/timelines'
|
||||||
import StatusListItem from './StatusListItem.html'
|
import StatusListItem from './StatusListItem.html'
|
||||||
import LoadingFooter from './LoadingFooter.html'
|
import LoadingFooter from './LoadingFooter.html'
|
||||||
import VirtualList from './VirtualList.html'
|
import VirtualList from './virtualList/VirtualList.html'
|
||||||
import { splice, push } from 'svelte-extras'
|
import { splice, push } from 'svelte-extras'
|
||||||
import { mergeStatuses } from '../_utils/statuses'
|
import { mergeStatuses } from '../_utils/statuses'
|
||||||
import { mark, stop } from '../_utils/marks'
|
import { mark, stop } from '../_utils/marks'
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
<script>
|
<script>
|
||||||
import VirtualListLazyItem from './VirtualListLazyItem'
|
import VirtualListLazyItem from './VirtualListLazyItem'
|
||||||
import VirtualListFooter from './VirtualListFooter.html'
|
import VirtualListFooter from './VirtualListFooter.html'
|
||||||
import { virtualListStore } from '../_utils/virtualListStore'
|
import { virtualListStore } from './virtualListStore'
|
||||||
import throttle from 'lodash/throttle'
|
import throttle from 'lodash/throttle'
|
||||||
import { mark, stop } from '../_utils/marks'
|
import { mark, stop } from '../../_utils/marks'
|
||||||
|
|
||||||
const DISTANCE_FROM_BOTTOM_TO_FIRE = 400
|
const DISTANCE_FROM_BOTTOM_TO_FIRE = 400
|
||||||
const SCROLL_TO_BOTTOM_DELAY = 1000
|
const SCROLL_TO_BOTTOM_DELAY = 1000
|
|
@ -5,11 +5,11 @@
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
import { virtualListStore } from '../_utils/virtualListStore'
|
import { virtualListStore } from './virtualListStore'
|
||||||
|
|
||||||
import throttle from 'lodash/throttle'
|
import throttle from 'lodash/throttle'
|
||||||
import { isFullscreen, attachFullscreenListener, detachFullscreenListener } from '../_utils/fullscreen'
|
import { isFullscreen, attachFullscreenListener, detachFullscreenListener } from '../../_utils/fullscreen'
|
||||||
import { mark, stop } from '../_utils/marks'
|
import { mark, stop } from '../../_utils/marks'
|
||||||
|
|
||||||
const SCROLL_EVENT_DELAY = 300
|
const SCROLL_EVENT_DELAY = 300
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
import { virtualListStore } from '../_utils/virtualListStore'
|
import { virtualListStore } from './virtualListStore'
|
||||||
import { AsyncLayout } from '../_utils/AsyncLayout'
|
import { AsyncLayout } from '../../_utils/AsyncLayout'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate() {
|
oncreate() {
|
|
@ -21,8 +21,8 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
import { virtualListStore } from '../_utils/virtualListStore'
|
import { virtualListStore } from './virtualListStore'
|
||||||
import { AsyncLayout } from '../_utils/AsyncLayout'
|
import { AsyncLayout } from '../../_utils/AsyncLayout'
|
||||||
|
|
||||||
const keyGetter = node => node.getAttribute('virtual-list-key')
|
const keyGetter = node => node.getAttribute('virtual-list-key')
|
||||||
const asyncLayout = new AsyncLayout(keyGetter)
|
const asyncLayout = new AsyncLayout(keyGetter)
|
|
@ -1,5 +1,5 @@
|
||||||
import { Store } from 'svelte/store.js'
|
import { Store } from 'svelte/store.js'
|
||||||
import { mark, stop } from '../_utils/marks'
|
import { mark, stop } from '../../_utils/marks'
|
||||||
|
|
||||||
const VIEWPORT_RENDER_FACTOR = 4
|
const VIEWPORT_RENDER_FACTOR = 4
|
||||||
|
|
Loading…
Reference in New Issue