first build
This commit is contained in:
-66
@@ -1,66 +0,0 @@
|
||||
import { elementScroll, observeElementOffset, observeElementRect, windowScroll, observeWindowOffset, observeWindowRect, Virtualizer } from "@tanstack/virtual-core";
|
||||
export * from "@tanstack/virtual-core";
|
||||
import { computed, unref, shallowRef, watch, triggerRef, onScopeDispose } from "vue";
|
||||
function useVirtualizerBase(options) {
|
||||
const virtualizer = new Virtualizer(unref(options));
|
||||
const state = shallowRef(virtualizer);
|
||||
const cleanup = virtualizer._didMount();
|
||||
watch(
|
||||
() => unref(options).getScrollElement(),
|
||||
(el) => {
|
||||
if (el) {
|
||||
virtualizer._willUpdate();
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => unref(options),
|
||||
(options2) => {
|
||||
virtualizer.setOptions({
|
||||
...options2,
|
||||
onChange: (instance, sync) => {
|
||||
var _a;
|
||||
triggerRef(state);
|
||||
(_a = options2.onChange) == null ? void 0 : _a.call(options2, instance, sync);
|
||||
}
|
||||
});
|
||||
virtualizer._willUpdate();
|
||||
triggerRef(state);
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
onScopeDispose(cleanup);
|
||||
return state;
|
||||
}
|
||||
function useVirtualizer(options) {
|
||||
return useVirtualizerBase(
|
||||
computed(() => ({
|
||||
observeElementRect,
|
||||
observeElementOffset,
|
||||
scrollToFn: elementScroll,
|
||||
...unref(options)
|
||||
}))
|
||||
);
|
||||
}
|
||||
function useWindowVirtualizer(options) {
|
||||
return useVirtualizerBase(
|
||||
computed(() => ({
|
||||
getScrollElement: () => typeof document !== "undefined" ? window : null,
|
||||
observeElementRect: observeWindowRect,
|
||||
observeElementOffset: observeWindowOffset,
|
||||
scrollToFn: windowScroll,
|
||||
initialOffset: () => typeof document !== "undefined" ? window.scrollY : 0,
|
||||
...unref(options)
|
||||
}))
|
||||
);
|
||||
}
|
||||
export {
|
||||
useVirtualizer,
|
||||
useWindowVirtualizer
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
{
|
||||
"name": "@tanstack/vue-virtual",
|
||||
"version": "3.13.12",
|
||||
"description": "Headless UI for virtualizing scrollable elements in Vue",
|
||||
"author": "Tanner Linsley",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/TanStack/virtual.git",
|
||||
"directory": "packages/vue-virtual"
|
||||
},
|
||||
"homepage": "https://tanstack.com/virtual",
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
},
|
||||
"keywords": [
|
||||
"react",
|
||||
"vue",
|
||||
"solid",
|
||||
"svelte",
|
||||
"virtual",
|
||||
"virtual-core",
|
||||
"datagrid"
|
||||
],
|
||||
"type": "module",
|
||||
"types": "dist/esm/index.d.ts",
|
||||
"main": "dist/cjs/index.cjs",
|
||||
"module": "dist/esm/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/cjs/index.d.cts",
|
||||
"default": "./dist/cjs/index.cjs"
|
||||
}
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"dependencies": {
|
||||
"@tanstack/virtual-core": "3.13.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^5.2.4",
|
||||
"vue": "^3.5.16"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "^2.7.0 || ^3.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "premove ./dist ./coverage",
|
||||
"test:eslint": "eslint ./src",
|
||||
"test:types": "tsc",
|
||||
"test:build": "publint --strict",
|
||||
"build": "vite build"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user