@tanstack/vue-virtual 3.13.50 → 3.13.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +2 -4
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +2 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +5 -3
- package/src/index.ts +2 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -8,10 +8,8 @@ function useVirtualizerBase(options) {
|
|
|
8
8
|
const cleanup = virtualizer._didMount();
|
|
9
9
|
vue.watch(
|
|
10
10
|
() => vue.unref(options).getScrollElement(),
|
|
11
|
-
(
|
|
12
|
-
|
|
13
|
-
virtualizer._willUpdate();
|
|
14
|
-
}
|
|
11
|
+
() => {
|
|
12
|
+
virtualizer._willUpdate();
|
|
15
13
|
},
|
|
16
14
|
{
|
|
17
15
|
immediate: true
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import {\n Virtualizer,\n elementScroll,\n observeElementOffset,\n observeElementRect,\n observeWindowOffset,\n observeWindowRect,\n windowScroll,\n} from '@tanstack/virtual-core'\nimport {\n computed,\n onScopeDispose,\n shallowRef,\n triggerRef,\n unref,\n watch,\n} from 'vue'\nimport type { PartialKeys, VirtualizerOptions } from '@tanstack/virtual-core'\nimport type { Ref } from 'vue'\n\nexport * from '@tanstack/virtual-core'\n\ntype MaybeRef<T> = T | Ref<T>\n\nfunction useVirtualizerBase<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n>(\n options: MaybeRef<VirtualizerOptions<TScrollElement, TItemElement>>,\n): Ref<Virtualizer<TScrollElement, TItemElement>> {\n const virtualizer = new Virtualizer(unref(options))\n const state = shallowRef(virtualizer)\n\n const cleanup = virtualizer._didMount()\n\n watch(\n () => unref(options).getScrollElement(),\n (
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import {\n Virtualizer,\n elementScroll,\n observeElementOffset,\n observeElementRect,\n observeWindowOffset,\n observeWindowRect,\n windowScroll,\n} from '@tanstack/virtual-core'\nimport {\n computed,\n onScopeDispose,\n shallowRef,\n triggerRef,\n unref,\n watch,\n} from 'vue'\nimport type { PartialKeys, VirtualizerOptions } from '@tanstack/virtual-core'\nimport type { Ref } from 'vue'\n\nexport * from '@tanstack/virtual-core'\n\ntype MaybeRef<T> = T | Ref<T>\n\nfunction useVirtualizerBase<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n>(\n options: MaybeRef<VirtualizerOptions<TScrollElement, TItemElement>>,\n): Ref<Virtualizer<TScrollElement, TItemElement>> {\n const virtualizer = new Virtualizer(unref(options))\n const state = shallowRef(virtualizer)\n\n const cleanup = virtualizer._didMount()\n\n watch(\n () => unref(options).getScrollElement(),\n () => {\n virtualizer._willUpdate()\n },\n {\n immediate: true,\n },\n )\n\n watch(\n () => unref(options),\n (options) => {\n virtualizer.setOptions({\n ...options,\n onChange: (instance, sync) => {\n triggerRef(state)\n options.onChange?.(instance, sync)\n },\n })\n\n virtualizer._willUpdate()\n triggerRef(state)\n },\n {\n immediate: true,\n },\n )\n\n onScopeDispose(cleanup)\n\n return state\n}\n\nexport function useVirtualizer<\n TScrollElement extends Element,\n TItemElement extends Element,\n>(\n options: MaybeRef<\n PartialKeys<\n VirtualizerOptions<TScrollElement, TItemElement>,\n 'observeElementRect' | 'observeElementOffset' | 'scrollToFn'\n >\n >,\n): Ref<Virtualizer<TScrollElement, TItemElement>> {\n return useVirtualizerBase<TScrollElement, TItemElement>(\n computed(() => ({\n observeElementRect: observeElementRect,\n observeElementOffset: observeElementOffset,\n scrollToFn: elementScroll,\n ...unref(options),\n })),\n )\n}\n\nexport function useWindowVirtualizer<TItemElement extends Element>(\n options: MaybeRef<\n PartialKeys<\n VirtualizerOptions<Window, TItemElement>,\n | 'observeElementRect'\n | 'observeElementOffset'\n | 'scrollToFn'\n | 'getScrollElement'\n >\n >,\n): Ref<Virtualizer<Window, TItemElement>> {\n return useVirtualizerBase<Window, TItemElement>(\n computed(() => ({\n getScrollElement: () => (typeof document !== 'undefined' ? window : null),\n observeElementRect: observeWindowRect,\n observeElementOffset: observeWindowOffset,\n scrollToFn: windowScroll,\n initialOffset: () =>\n typeof document !== 'undefined' ? window.scrollY : 0,\n ...unref(options),\n })),\n )\n}\n"],"names":["Virtualizer","unref","shallowRef","watch","options","triggerRef","onScopeDispose","computed","observeElementRect","observeElementOffset","elementScroll","observeWindowRect","observeWindowOffset","windowScroll"],"mappings":";;;;AAwBA,SAAS,mBAIP,SACgD;AAChD,QAAM,cAAc,IAAIA,YAAAA,YAAYC,IAAAA,MAAM,OAAO,CAAC;AAClD,QAAM,QAAQC,IAAAA,WAAW,WAAW;AAEpC,QAAM,UAAU,YAAY,UAAA;AAE5BC,MAAAA;AAAAA,IACE,MAAMF,IAAAA,MAAM,OAAO,EAAE,iBAAA;AAAA,IACrB,MAAM;AACJ,kBAAY,YAAA;AAAA,IACd;AAAA,IACA;AAAA,MACE,WAAW;AAAA,IAAA;AAAA,EACb;AAGFE,MAAAA;AAAAA,IACE,MAAMF,IAAAA,MAAM,OAAO;AAAA,IACnB,CAACG,aAAY;AACX,kBAAY,WAAW;AAAA,QACrB,GAAGA;AAAAA,QACH,UAAU,CAAC,UAAU,SAAS;;AAC5BC,cAAAA,WAAW,KAAK;AAChBD,yBAAQ,aAARA,kCAAmB,UAAU;AAAA,QAC/B;AAAA,MAAA,CACD;AAED,kBAAY,YAAA;AACZC,UAAAA,WAAW,KAAK;AAAA,IAClB;AAAA,IACA;AAAA,MACE,WAAW;AAAA,IAAA;AAAA,EACb;AAGFC,MAAAA,eAAe,OAAO;AAEtB,SAAO;AACT;AAEO,SAAS,eAId,SAMgD;AAChD,SAAO;AAAA,IACLC,IAAAA,SAAS,OAAO;AAAA,MAAA,oBACdC,YAAAA;AAAAA,MAAA,sBACAC,YAAAA;AAAAA,MACA,YAAYC,YAAAA;AAAAA,MACZ,GAAGT,IAAAA,MAAM,OAAO;AAAA,IAAA,EAChB;AAAA,EAAA;AAEN;AAEO,SAAS,qBACd,SASwC;AACxC,SAAO;AAAA,IACLM,IAAAA,SAAS,OAAO;AAAA,MACd,kBAAkB,MAAO,OAAO,aAAa,cAAc,SAAS;AAAA,MACpE,oBAAoBI,YAAAA;AAAAA,MACpB,sBAAsBC,YAAAA;AAAAA,MACtB,YAAYC,YAAAA;AAAAA,MACZ,eAAe,MACb,OAAO,aAAa,cAAc,OAAO,UAAU;AAAA,MACrD,GAAGZ,IAAAA,MAAM,OAAO;AAAA,IAAA,EAChB;AAAA,EAAA;AAEN;;;;;;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -7,10 +7,8 @@ function useVirtualizerBase(options) {
|
|
|
7
7
|
const cleanup = virtualizer._didMount();
|
|
8
8
|
watch(
|
|
9
9
|
() => unref(options).getScrollElement(),
|
|
10
|
-
(
|
|
11
|
-
|
|
12
|
-
virtualizer._willUpdate();
|
|
13
|
-
}
|
|
10
|
+
() => {
|
|
11
|
+
virtualizer._willUpdate();
|
|
14
12
|
},
|
|
15
13
|
{
|
|
16
14
|
immediate: true
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import {\n Virtualizer,\n elementScroll,\n observeElementOffset,\n observeElementRect,\n observeWindowOffset,\n observeWindowRect,\n windowScroll,\n} from '@tanstack/virtual-core'\nimport {\n computed,\n onScopeDispose,\n shallowRef,\n triggerRef,\n unref,\n watch,\n} from 'vue'\nimport type { PartialKeys, VirtualizerOptions } from '@tanstack/virtual-core'\nimport type { Ref } from 'vue'\n\nexport * from '@tanstack/virtual-core'\n\ntype MaybeRef<T> = T | Ref<T>\n\nfunction useVirtualizerBase<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n>(\n options: MaybeRef<VirtualizerOptions<TScrollElement, TItemElement>>,\n): Ref<Virtualizer<TScrollElement, TItemElement>> {\n const virtualizer = new Virtualizer(unref(options))\n const state = shallowRef(virtualizer)\n\n const cleanup = virtualizer._didMount()\n\n watch(\n () => unref(options).getScrollElement(),\n (
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import {\n Virtualizer,\n elementScroll,\n observeElementOffset,\n observeElementRect,\n observeWindowOffset,\n observeWindowRect,\n windowScroll,\n} from '@tanstack/virtual-core'\nimport {\n computed,\n onScopeDispose,\n shallowRef,\n triggerRef,\n unref,\n watch,\n} from 'vue'\nimport type { PartialKeys, VirtualizerOptions } from '@tanstack/virtual-core'\nimport type { Ref } from 'vue'\n\nexport * from '@tanstack/virtual-core'\n\ntype MaybeRef<T> = T | Ref<T>\n\nfunction useVirtualizerBase<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n>(\n options: MaybeRef<VirtualizerOptions<TScrollElement, TItemElement>>,\n): Ref<Virtualizer<TScrollElement, TItemElement>> {\n const virtualizer = new Virtualizer(unref(options))\n const state = shallowRef(virtualizer)\n\n const cleanup = virtualizer._didMount()\n\n watch(\n () => unref(options).getScrollElement(),\n () => {\n virtualizer._willUpdate()\n },\n {\n immediate: true,\n },\n )\n\n watch(\n () => unref(options),\n (options) => {\n virtualizer.setOptions({\n ...options,\n onChange: (instance, sync) => {\n triggerRef(state)\n options.onChange?.(instance, sync)\n },\n })\n\n virtualizer._willUpdate()\n triggerRef(state)\n },\n {\n immediate: true,\n },\n )\n\n onScopeDispose(cleanup)\n\n return state\n}\n\nexport function useVirtualizer<\n TScrollElement extends Element,\n TItemElement extends Element,\n>(\n options: MaybeRef<\n PartialKeys<\n VirtualizerOptions<TScrollElement, TItemElement>,\n 'observeElementRect' | 'observeElementOffset' | 'scrollToFn'\n >\n >,\n): Ref<Virtualizer<TScrollElement, TItemElement>> {\n return useVirtualizerBase<TScrollElement, TItemElement>(\n computed(() => ({\n observeElementRect: observeElementRect,\n observeElementOffset: observeElementOffset,\n scrollToFn: elementScroll,\n ...unref(options),\n })),\n )\n}\n\nexport function useWindowVirtualizer<TItemElement extends Element>(\n options: MaybeRef<\n PartialKeys<\n VirtualizerOptions<Window, TItemElement>,\n | 'observeElementRect'\n | 'observeElementOffset'\n | 'scrollToFn'\n | 'getScrollElement'\n >\n >,\n): Ref<Virtualizer<Window, TItemElement>> {\n return useVirtualizerBase<Window, TItemElement>(\n computed(() => ({\n getScrollElement: () => (typeof document !== 'undefined' ? window : null),\n observeElementRect: observeWindowRect,\n observeElementOffset: observeWindowOffset,\n scrollToFn: windowScroll,\n initialOffset: () =>\n typeof document !== 'undefined' ? window.scrollY : 0,\n ...unref(options),\n })),\n )\n}\n"],"names":["options"],"mappings":";;;AAwBA,SAAS,mBAIP,SACgD;AAChD,QAAM,cAAc,IAAI,YAAY,MAAM,OAAO,CAAC;AAClD,QAAM,QAAQ,WAAW,WAAW;AAEpC,QAAM,UAAU,YAAY,UAAA;AAE5B;AAAA,IACE,MAAM,MAAM,OAAO,EAAE,iBAAA;AAAA,IACrB,MAAM;AACJ,kBAAY,YAAA;AAAA,IACd;AAAA,IACA;AAAA,MACE,WAAW;AAAA,IAAA;AAAA,EACb;AAGF;AAAA,IACE,MAAM,MAAM,OAAO;AAAA,IACnB,CAACA,aAAY;AACX,kBAAY,WAAW;AAAA,QACrB,GAAGA;AAAAA,QACH,UAAU,CAAC,UAAU,SAAS;;AAC5B,qBAAW,KAAK;AAChBA,yBAAQ,aAARA,kCAAmB,UAAU;AAAA,QAC/B;AAAA,MAAA,CACD;AAED,kBAAY,YAAA;AACZ,iBAAW,KAAK;AAAA,IAClB;AAAA,IACA;AAAA,MACE,WAAW;AAAA,IAAA;AAAA,EACb;AAGF,iBAAe,OAAO;AAEtB,SAAO;AACT;AAEO,SAAS,eAId,SAMgD;AAChD,SAAO;AAAA,IACL,SAAS,OAAO;AAAA,MACd;AAAA,MACA;AAAA,MACA,YAAY;AAAA,MACZ,GAAG,MAAM,OAAO;AAAA,IAAA,EAChB;AAAA,EAAA;AAEN;AAEO,SAAS,qBACd,SASwC;AACxC,SAAO;AAAA,IACL,SAAS,OAAO;AAAA,MACd,kBAAkB,MAAO,OAAO,aAAa,cAAc,SAAS;AAAA,MACpE,oBAAoB;AAAA,MACpB,sBAAsB;AAAA,MACtB,YAAY;AAAA,MACZ,eAAe,MACb,OAAO,aAAa,cAAc,OAAO,UAAU;AAAA,MACrD,GAAG,MAAM,OAAO;AAAA,IAAA,EAChB;AAAA,EAAA;AAEN;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/vue-virtual",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.52",
|
|
4
4
|
"description": "Headless UI for virtualizing scrollable elements in Vue",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"src"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@tanstack/virtual-core": "3.19.
|
|
52
|
+
"@tanstack/virtual-core": "3.19.11"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@vitejs/plugin-vue": "^5.2.4",
|
|
@@ -60,9 +60,11 @@
|
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"clean": "premove ./dist ./coverage",
|
|
63
|
-
"test:eslint": "eslint ./src",
|
|
63
|
+
"test:eslint": "eslint ./src ./tests",
|
|
64
64
|
"test:types": "tsc",
|
|
65
65
|
"test:build": "publint --strict",
|
|
66
|
+
"test:lib": "vitest",
|
|
67
|
+
"test:lib:dev": "pnpm run test:lib --watch",
|
|
66
68
|
"build": "vite build"
|
|
67
69
|
}
|
|
68
70
|
}
|