Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.lib.composables.virtual.mjs.map Maven / Gradle / Ivy
{"version":3,"file":"virtual.mjs","names":["useDisplay","useResizeObserver","computed","nextTick","onScopeDispose","ref","shallowRef","watch","watchEffect","clamp","debounce","IN_BROWSER","propsFactory","UP","DOWN","BUFFER_PX","makeVirtualProps","itemHeight","type","Number","String","default","height","useVirtual","props","items","display","value","parseFloat","first","last","Math","ceil","parseInt","paddingTop","paddingBottom","containerRef","markerRef","markerOffset","resizeRef","contentRect","viewportHeight","document","documentElement","hasInitialRender","sizes","Array","from","length","offsets","updateTime","targetScrollIndex","getSize","index","updateOffsets","start","performance","now","i","max","unwatch","v","offsetTop","immediate","calculateVisibleItems","window","requestAnimationFrame","scrollToIndex","clear","handleItemResize","prevHeight","prevMinHeight","min","calculateOffset","calculateIndex","scrollTop","binaryClosest","lastScrollTop","scrollVelocity","lastScrollTime","val","oldVal","handleScroll","scrollTime","scrollDeltaT","sign","handleScrollend","raf","cancelAnimationFrame","_calculateVisibleItems","direction","startPx","endPx","end","topOverflow","bottomOverflow","bufferOverflow","offset","computedItems","slice","map","item","raw","deep","arr","high","low","mid","target"],"sources":["../../src/composables/virtual.ts"],"sourcesContent":["// Composables\nimport { useDisplay } from '@/composables/display'\nimport { useResizeObserver } from '@/composables/resizeObserver'\n\n// Utilities\nimport { computed, nextTick, onScopeDispose, ref, shallowRef, watch, watchEffect } from 'vue'\nimport { clamp, debounce, IN_BROWSER, propsFactory } from '@/util'\n\n// Types\nimport type { Ref } from 'vue'\n\nconst UP = -1\nconst DOWN = 1\n\n/** Determines how large each batch of items should be */\nconst BUFFER_PX = 100\n\ntype VirtualProps = {\n itemHeight?: number | string\n height?: number | string\n}\n\nexport const makeVirtualProps = propsFactory({\n itemHeight: {\n type: [Number, String],\n default: null,\n },\n height: [Number, String],\n}, 'virtual')\n\nexport function useVirtual (props: VirtualProps, items: Ref) {\n const display = useDisplay()\n\n const itemHeight = shallowRef(0)\n watchEffect(() => {\n itemHeight.value = parseFloat(props.itemHeight || 0)\n })\n\n const first = shallowRef(0)\n const last = shallowRef(Math.ceil(\n // Assume 16px items filling the entire screen height if\n // not provided. This is probably incorrect but it minimises\n // the chance of ending up with empty space at the bottom.\n // The default value is set here to avoid poisoning getSize()\n (parseInt(props.height!) || display.height.value) / (itemHeight.value || 16)\n ) || 1)\n const paddingTop = shallowRef(0)\n const paddingBottom = shallowRef(0)\n\n /** The scrollable element */\n const containerRef = ref()\n /** An element marking the top of the scrollable area,\n * used to add an offset if there's padding or other elements above the virtual list */\n const markerRef = ref()\n /** markerRef's offsetTop, lazily evaluated */\n let markerOffset = 0\n\n const { resizeRef, contentRect } = useResizeObserver()\n watchEffect(() => {\n resizeRef.value = containerRef.value\n })\n const viewportHeight = computed(() => {\n return containerRef.value === document.documentElement\n ? display.height.value\n : contentRect.value?.height || parseInt(props.height!) || 0\n })\n /** All static elements have been rendered and we have an assumed item height */\n const hasInitialRender = computed(() => {\n return !!(containerRef.value && markerRef.value && viewportHeight.value && itemHeight.value)\n })\n\n let sizes = Array.from({ length: items.value.length })\n let offsets = Array.from({ length: items.value.length })\n const updateTime = shallowRef(0)\n let targetScrollIndex = -1\n\n function getSize (index: number) {\n return sizes[index] || itemHeight.value\n }\n\n const updateOffsets = debounce(() => {\n const start = performance.now()\n offsets[0] = 0\n const length = items.value.length\n for (let i = 1; i <= length - 1; i++) {\n offsets[i] = (offsets[i - 1] || 0) + getSize(i - 1)\n }\n updateTime.value = Math.max(updateTime.value, performance.now() - start)\n }, updateTime)\n\n const unwatch = watch(hasInitialRender, v => {\n if (!v) return\n // First render is complete, update offsets and visible\n // items in case our assumed item height was incorrect\n\n unwatch()\n markerOffset = markerRef.value!.offsetTop\n updateOffsets.immediate()\n calculateVisibleItems()\n\n if (!~targetScrollIndex) return\n\n nextTick(() => {\n IN_BROWSER && window.requestAnimationFrame(() => {\n scrollToIndex(targetScrollIndex)\n targetScrollIndex = -1\n })\n })\n })\n\n onScopeDispose(() => {\n updateOffsets.clear()\n })\n\n function handleItemResize (index: number, height: number) {\n const prevHeight = sizes[index]\n const prevMinHeight = itemHeight.value\n\n itemHeight.value = prevMinHeight ? Math.min(itemHeight.value, height) : height\n\n if (prevHeight !== height || prevMinHeight !== itemHeight.value) {\n sizes[index] = height\n updateOffsets()\n }\n }\n\n function calculateOffset (index: number) {\n index = clamp(index, 0, items.value.length - 1)\n return offsets[index] || 0\n }\n\n function calculateIndex (scrollTop: number) {\n return binaryClosest(offsets, scrollTop)\n }\n\n let lastScrollTop = 0\n let scrollVelocity = 0\n let lastScrollTime = 0\n\n watch(viewportHeight, (val, oldVal) => {\n if (oldVal) {\n calculateVisibleItems()\n if (val < oldVal) {\n requestAnimationFrame(() => {\n scrollVelocity = 0\n calculateVisibleItems()\n })\n }\n }\n })\n\n function handleScroll () {\n if (!containerRef.value || !markerRef.value) return\n\n const scrollTop = containerRef.value.scrollTop\n const scrollTime = performance.now()\n const scrollDeltaT = scrollTime - lastScrollTime\n\n if (scrollDeltaT > 500) {\n scrollVelocity = Math.sign(scrollTop - lastScrollTop)\n\n // Not super important, only update at the\n // start of a scroll sequence to avoid reflows\n markerOffset = markerRef.value.offsetTop\n } else {\n scrollVelocity = scrollTop - lastScrollTop\n }\n\n lastScrollTop = scrollTop\n lastScrollTime = scrollTime\n\n calculateVisibleItems()\n }\n function handleScrollend () {\n if (!containerRef.value || !markerRef.value) return\n\n scrollVelocity = 0\n lastScrollTime = 0\n\n calculateVisibleItems()\n }\n\n let raf = -1\n function calculateVisibleItems () {\n cancelAnimationFrame(raf)\n raf = requestAnimationFrame(_calculateVisibleItems)\n }\n function _calculateVisibleItems () {\n if (!containerRef.value || !viewportHeight.value) return\n const scrollTop = lastScrollTop - markerOffset\n const direction = Math.sign(scrollVelocity)\n\n const startPx = Math.max(0, scrollTop - BUFFER_PX)\n const start = clamp(calculateIndex(startPx), 0, items.value.length)\n\n const endPx = scrollTop + viewportHeight.value + BUFFER_PX\n const end = clamp(calculateIndex(endPx) + 1, start + 1, items.value.length)\n\n if (\n // Only update the side we're scrolling towards,\n // the other side will be updated incidentally\n (direction !== UP || start < first.value) &&\n (direction !== DOWN || end > last.value)\n ) {\n const topOverflow = calculateOffset(first.value) - calculateOffset(start)\n const bottomOverflow = calculateOffset(end) - calculateOffset(last.value)\n const bufferOverflow = Math.max(topOverflow, bottomOverflow)\n\n if (bufferOverflow > BUFFER_PX) {\n first.value = start\n last.value = end\n } else {\n // Only update the side that's reached its limit if there's still buffer left\n if (start <= 0) first.value = start\n if (end >= items.value.length) last.value = end\n }\n }\n\n paddingTop.value = calculateOffset(first.value)\n paddingBottom.value = calculateOffset(items.value.length) - calculateOffset(last.value)\n }\n\n function scrollToIndex (index: number) {\n const offset = calculateOffset(index)\n if (!containerRef.value || (index && !offset)) {\n targetScrollIndex = index\n } else {\n containerRef.value.scrollTop = offset\n }\n }\n\n const computedItems = computed(() => {\n return items.value.slice(first.value, last.value).map((item, index) => ({\n raw: item,\n index: index + first.value,\n }))\n })\n\n watch(items, () => {\n sizes = Array.from({ length: items.value.length })\n offsets = Array.from({ length: items.value.length })\n updateOffsets.immediate()\n calculateVisibleItems()\n }, { deep: true })\n\n return {\n containerRef,\n markerRef,\n computedItems,\n paddingTop,\n paddingBottom,\n scrollToIndex,\n handleScroll,\n handleScrollend,\n handleItemResize,\n }\n}\n\n// https://gist.github.com/robertleeplummerjr/1cc657191d34ecd0a324\nfunction binaryClosest (arr: ArrayLike, val: number) {\n let high = arr.length - 1\n let low = 0\n let mid = 0\n let item = null\n let target = -1\n\n if (arr[high]! < val) {\n return high\n }\n\n while (low <= high) {\n mid = (low + high) >> 1\n item = arr[mid]!\n\n if (item > val) {\n high = mid - 1\n } else if (item < val) {\n target = mid\n low = mid + 1\n } else if (item === val) {\n return mid\n } else {\n return low\n }\n }\n\n return target\n}\n"],"mappings":"AAAA;AAAA,SACSA,UAAU;AAAA,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