@ceriousdevtech/vue-cerious-scroll 1.0.2 → 1.0.4
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/CHANGELOG.md +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +25 -25
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to vue-cerious-scroll will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.4] - 2026-06-04
|
|
9
|
+
|
|
10
|
+
### Dependencies
|
|
11
|
+
- Bumped `@ceriousdevtech/cerious-scroll` to `^1.0.5`. Consumers get the new wheel input classifier (trackpad / free-scroll mice apply input immediately, ratcheted wheel notches still ease smoothly), the new `wheel.wheelBehavior` option (`'auto' | 'immediate' | 'smooth'`), and a fix for horizontal wheel forwarding in layouts where `overflow-x: auto` lives on an ancestor of `[data-cerious-scroll-content]`.
|
|
12
|
+
|
|
13
|
+
## [1.0.3] - 2026-06-03
|
|
14
|
+
|
|
15
|
+
### Dependencies
|
|
16
|
+
- Bumped peer dependency `@ceriousdevtech/cerious-scroll` to `^1.0.4`. Consumers get smooth wheel scrolling (eased over ~150ms, configurable via `wheel: { smooth }`) and the engine now reads viewport height from `[data-cerious-scroll-content]` so wrappers that put a horizontal scrollbar on the inner element get the last row clearance for free.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- The inner content element is now styled `overflow-y: clip; overflow-x: auto` so consumers can opt into a horizontal scrollbar on the rows axis without a stray vertical bar appearing.
|
|
20
|
+
|
|
8
21
|
## [1.0.2] - 2026-06-03
|
|
9
22
|
|
|
10
23
|
### Added
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),A=require("@ceriousdevtech/cerious-scroll"),V="data-cerious-scroll-content",N="data-cerious-scroll-row";function _(e){const s=e.querySelector(`[${V}]`);if(s)return s;const n=document.createElement("div");return n.setAttribute(V,""),n.style.position="relative",n.style.width="100%",n.style.height="100%",n.style.overflowY="clip",n.style.overflowX="auto",e.appendChild(n),n}function q(e,s){const n=l=>{const r=l.detail;r&&s({percentage:r.percentage,currentElement:r.currentElement,scrollOffset:r.scrollOffset,result:{element:r.result.element,offset:r.result.offset}})},f=l=>{const r=l.detail;r&&s({percentage:r.percentage,currentElement:r.element,scrollOffset:r.scrollOffset,result:{element:r.element,offset:r.scrollOffset}})};return e.addEventListener("cerious-viewport-change",n),e.addEventListener("viewport-change",f),()=>{e.removeEventListener("cerious-viewport-change",n),e.removeEventListener("viewport-change",f)}}function I(e,s){const n=typeof e=="number"?e:typeof s=="number"?s:void 0;if(n===void 0||Number.isNaN(n))throw new Error("useCeriousScroll: provide `totalElements` or `items`.");return Math.max(1,Math.floor(n))}function j(e){var O;const s=(O=o.getCurrentInstance())==null?void 0:O.appContext,n=o.ref(null),f=o.shallowRef(null);let l=null;const r=new Map;let c=null;const C=()=>o.toValue(e.autoRender)??!0,y=t=>{if(e.getItem)return e.getItem(t);const u=o.toValue(e.items);return u?u[t]:void 0},M=(t,u)=>{const i=s??null,m=o.effectScope(!0);return m.run(()=>o.watchEffect(()=>{const E=e.renderItem(y(t),t),d=Array.isArray(E)?E:[E];for(const w of d)o.isVNode(w)&&(w.appContext=i);const a=o.h(o.Fragment,d);a.appContext=i,o.render(a,u)},{flush:"sync"})),()=>m.stop()},b=t=>{t.stop(),o.render(null,t.mount),t.mount.remove()},h=()=>{var w;if(!l)return null;const{scroller:t,contentEl:u,container:i}=l,m=i.clientHeight||i.offsetHeight||0,E=(g,v)=>{const p=document.createElement("div");p.setAttribute(N,String(g)),v.appendChild(p);const S=M(g,p);r.set(g,{el:v,mount:p,stop:S})},d=t.renderViewport(m,u,E),a=new Set(t.getRenderedIndices());return r.forEach((g,v)=>{a.has(v)||(b(g),r.delete(v))}),(w=e.onMeasuredViewport)==null||w.call(e,d),d},R=t=>{if(!l)return;const u=l;l=null,u.unsubscribe(),t&&(c={currentElement:u.scroller.currentElement,scrollOffset:u.scroller.scrollOffset}),r.forEach(i=>b(i)),r.clear(),u.contentEl.textContent="",u.scroller.detachScrollbar(u.container),u.scroller.dispose(),f.value=null},T=t=>{var g,v;const u=_(t),i=e.options??{},m=i.onScroll,E={...i,onScroll:()=>{m==null||m(),C()&&h()}},d=I(o.toValue(e.totalElements),((g=o.toValue(e.items))==null?void 0:g.length)??null),a=new A.CeriousScroll(t,d,E);c&&(a.currentElement=Math.min(c.currentElement,d-1),a.scrollOffset=c.scrollOffset,c=null);const w=q(t,p=>{var S;(S=e.onViewportChange)==null||S.call(e,p)});l={scroller:a,contentEl:u,container:t,unsubscribe:w},f.value=a,(v=e.onReady)==null||v.call(e,a),C()&&requestAnimationFrame(()=>h())},P=()=>{R(!0);const t=n.value;t&&T(t)};return o.onMounted(()=>{const t=n.value;t&&T(t)}),o.onBeforeUnmount(()=>{R(!1)}),o.watch(()=>[o.toValue(e.totalElements),o.toValue(e.items)],()=>{var u;if(!l)return;const t=I(o.toValue(e.totalElements),((u=o.toValue(e.items))==null?void 0:u.length)??null);l.scroller.totalElements!==t&&P()}),{containerRef:n,scroller:f,render:h,jumpToElement:t=>l?(l.scroller.jumpToElement(t),h()):null,scrollToPercentage:t=>l?(l.scroller.handleScrollPercentage(t),h()):null,reset:()=>l?(l.scroller.reset(),h()):null,recalculate:()=>l?(l.scroller.clearAllCaches(),h()):null}}const F=o.defineComponent({name:"CeriousScroll",props:{totalElements:{type:Number,default:null},items:{type:Array,default:null},getItem:{type:Function,default:void 0},renderItem:{type:Function,default:void 0},options:{type:Object,default:void 0},autoRender:{type:Boolean,default:!0}},emits:{"viewport-change":e=>!0,"measured-viewport":e=>!0,ready:e=>!0},setup(e,{slots:s,emit:n,expose:f}){const l=(c,C)=>{var y;return e.renderItem?e.renderItem(c,C):(y=s.item)==null?void 0:y.call(s,{item:c,index:C})},r=j({totalElements:()=>e.totalElements,items:()=>e.items,getItem:e.getItem?c=>e.getItem(c):void 0,renderItem:l,options:e.options,autoRender:()=>e.autoRender,onViewportChange:c=>n("viewport-change",c),onMeasuredViewport:c=>n("measured-viewport",c),onReady:c=>n("ready",c)});return f({scroller:r.scroller,render:r.render,jumpToElement:r.jumpToElement,scrollToPercentage:r.scrollToPercentage,reset:r.reset,recalculate:r.recalculate}),()=>{var c;return o.h("div",{ref:r.containerRef,style:{position:"relative",overflow:"hidden"}},(c=s.default)==null?void 0:c.call(s))}}});Object.defineProperty(exports,"CeriousScrollEngine",{enumerable:!0,get:()=>A.CeriousScroll});exports.CeriousScroll=F;exports.useCeriousScroll=j;
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { getCurrentInstance as P, ref as _, shallowRef as x, onMounted as F, onBeforeUnmount as L, watch as $, toValue as
|
|
2
|
-
import { CeriousScroll as
|
|
1
|
+
import { getCurrentInstance as P, ref as _, shallowRef as x, onMounted as F, onBeforeUnmount as L, watch as $, toValue as v, render as O, effectScope as q, watchEffect as B, isVNode as H, h as M, Fragment as U, defineComponent as W } from "vue";
|
|
2
|
+
import { CeriousScroll as X } from "@ceriousdevtech/cerious-scroll";
|
|
3
3
|
import { CeriousScroll as oe } from "@ceriousdevtech/cerious-scroll";
|
|
4
|
-
const A = "data-cerious-scroll-content",
|
|
5
|
-
function
|
|
4
|
+
const A = "data-cerious-scroll-content", Y = "data-cerious-scroll-row";
|
|
5
|
+
function z(e) {
|
|
6
6
|
const s = e.querySelector(`[${A}]`);
|
|
7
7
|
if (s) return s;
|
|
8
8
|
const n = document.createElement("div");
|
|
9
|
-
return n.setAttribute(A, ""), n.style.position = "relative", n.style.width = "100%", n.style.height = "100%", n.style.
|
|
9
|
+
return n.setAttribute(A, ""), n.style.position = "relative", n.style.width = "100%", n.style.height = "100%", n.style.overflowY = "clip", n.style.overflowX = "auto", e.appendChild(n), n;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function D(e, s) {
|
|
12
12
|
const n = (o) => {
|
|
13
13
|
const r = o.detail;
|
|
14
14
|
r && s({
|
|
@@ -36,15 +36,15 @@ function V(e, s) {
|
|
|
36
36
|
throw new Error("useCeriousScroll: provide `totalElements` or `items`.");
|
|
37
37
|
return Math.max(1, Math.floor(n));
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function G(e) {
|
|
40
40
|
var I;
|
|
41
41
|
const s = (I = P()) == null ? void 0 : I.appContext, n = _(null), a = x(null);
|
|
42
42
|
let o = null;
|
|
43
43
|
const r = /* @__PURE__ */ new Map();
|
|
44
44
|
let l = null;
|
|
45
|
-
const C = () =>
|
|
45
|
+
const C = () => v(e.autoRender) ?? !0, y = (t) => {
|
|
46
46
|
if (e.getItem) return e.getItem(t);
|
|
47
|
-
const c =
|
|
47
|
+
const c = v(e.items);
|
|
48
48
|
return c ? c[t] : void 0;
|
|
49
49
|
}, N = (t, c) => {
|
|
50
50
|
const u = s ?? null, f = q(!0);
|
|
@@ -62,12 +62,12 @@ function K(e) {
|
|
|
62
62
|
), () => f.stop();
|
|
63
63
|
}, S = (t) => {
|
|
64
64
|
t.stop(), O(null, t.mount), t.mount.remove();
|
|
65
|
-
},
|
|
65
|
+
}, h = () => {
|
|
66
66
|
var w;
|
|
67
67
|
if (!o) return null;
|
|
68
68
|
const { scroller: t, contentEl: c, container: u } = o, f = u.clientHeight || u.offsetHeight || 0, E = (d, g) => {
|
|
69
69
|
const p = document.createElement("div");
|
|
70
|
-
p.setAttribute(
|
|
70
|
+
p.setAttribute(Y, String(d)), g.appendChild(p);
|
|
71
71
|
const R = N(d, p);
|
|
72
72
|
r.set(d, { el: g, mount: p, stop: R });
|
|
73
73
|
}, m = t.renderViewport(f, c, E), i = new Set(t.getRenderedIndices());
|
|
@@ -83,18 +83,18 @@ function K(e) {
|
|
|
83
83
|
}), r.forEach((u) => S(u)), r.clear(), c.contentEl.textContent = "", c.scroller.detachScrollbar(c.container), c.scroller.dispose(), a.value = null;
|
|
84
84
|
}, b = (t) => {
|
|
85
85
|
var d, g;
|
|
86
|
-
const c =
|
|
86
|
+
const c = z(t), u = e.options ?? {}, f = u.onScroll, E = {
|
|
87
87
|
...u,
|
|
88
88
|
onScroll: () => {
|
|
89
|
-
f == null || f(), C() &&
|
|
89
|
+
f == null || f(), C() && h();
|
|
90
90
|
}
|
|
91
|
-
}, m = V(
|
|
91
|
+
}, m = V(v(e.totalElements), ((d = v(e.items)) == null ? void 0 : d.length) ?? null), i = new X(t, m, E);
|
|
92
92
|
l && (i.currentElement = Math.min(l.currentElement, m - 1), i.scrollOffset = l.scrollOffset, l = null);
|
|
93
|
-
const w =
|
|
93
|
+
const w = D(t, (p) => {
|
|
94
94
|
var R;
|
|
95
95
|
(R = e.onViewportChange) == null || R.call(e, p);
|
|
96
96
|
});
|
|
97
|
-
o = { scroller: i, contentEl: c, container: t, unsubscribe: w }, a.value = i, (g = e.onReady) == null || g.call(e, i), C() && requestAnimationFrame(() =>
|
|
97
|
+
o = { scroller: i, contentEl: c, container: t, unsubscribe: w }, a.value = i, (g = e.onReady) == null || g.call(e, i), C() && requestAnimationFrame(() => h());
|
|
98
98
|
}, j = () => {
|
|
99
99
|
T(!0);
|
|
100
100
|
const t = n.value;
|
|
@@ -106,21 +106,21 @@ function K(e) {
|
|
|
106
106
|
}), L(() => {
|
|
107
107
|
T(!1);
|
|
108
108
|
}), $(
|
|
109
|
-
() => [
|
|
109
|
+
() => [v(e.totalElements), v(e.items)],
|
|
110
110
|
() => {
|
|
111
111
|
var c;
|
|
112
112
|
if (!o) return;
|
|
113
|
-
const t = V(
|
|
113
|
+
const t = V(v(e.totalElements), ((c = v(e.items)) == null ? void 0 : c.length) ?? null);
|
|
114
114
|
o.scroller.totalElements !== t && j();
|
|
115
115
|
}
|
|
116
116
|
), {
|
|
117
117
|
containerRef: n,
|
|
118
118
|
scroller: a,
|
|
119
|
-
render:
|
|
120
|
-
jumpToElement: (t) => o ? (o.scroller.jumpToElement(t),
|
|
121
|
-
scrollToPercentage: (t) => o ? (o.scroller.handleScrollPercentage(t),
|
|
122
|
-
reset: () => o ? (o.scroller.reset(),
|
|
123
|
-
recalculate: () => o ? (o.scroller.clearAllCaches(),
|
|
119
|
+
render: h,
|
|
120
|
+
jumpToElement: (t) => o ? (o.scroller.jumpToElement(t), h()) : null,
|
|
121
|
+
scrollToPercentage: (t) => o ? (o.scroller.handleScrollPercentage(t), h()) : null,
|
|
122
|
+
reset: () => o ? (o.scroller.reset(), h()) : null,
|
|
123
|
+
recalculate: () => o ? (o.scroller.clearAllCaches(), h()) : null
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
const te = W({
|
|
@@ -154,7 +154,7 @@ const te = W({
|
|
|
154
154
|
const o = (l, C) => {
|
|
155
155
|
var y;
|
|
156
156
|
return e.renderItem ? e.renderItem(l, C) : (y = s.item) == null ? void 0 : y.call(s, { item: l, index: C });
|
|
157
|
-
}, r =
|
|
157
|
+
}, r = G({
|
|
158
158
|
totalElements: () => e.totalElements,
|
|
159
159
|
items: () => e.items,
|
|
160
160
|
getItem: e.getItem ? (l) => e.getItem(l) : void 0,
|
|
@@ -192,5 +192,5 @@ const te = W({
|
|
|
192
192
|
export {
|
|
193
193
|
te as CeriousScroll,
|
|
194
194
|
oe as CeriousScrollEngine,
|
|
195
|
-
|
|
195
|
+
G as useCeriousScroll
|
|
196
196
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ceriousdevtech/vue-cerious-scroll",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Vue 3 bindings for CeriousScroll — high-performance virtual scrolling with O(1) memory and no height estimation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -56,12 +56,14 @@
|
|
|
56
56
|
"demo": "vite --config demo/vite.config.ts",
|
|
57
57
|
"demo:build": "vite build --config demo/vite.config.ts"
|
|
58
58
|
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@ceriousdevtech/cerious-scroll": "^1.0.5"
|
|
61
|
+
},
|
|
59
62
|
"peerDependencies": {
|
|
60
|
-
"@ceriousdevtech/cerious-scroll": "^1.0.3",
|
|
61
63
|
"vue": "^3.3.0"
|
|
62
64
|
},
|
|
63
65
|
"devDependencies": {
|
|
64
|
-
"@
|
|
66
|
+
"@tanstack/vue-virtual": "^3.10.8",
|
|
65
67
|
"@types/node": "^22.10.2",
|
|
66
68
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
67
69
|
"@vue/test-utils": "^2.4.6",
|