assistant-chat-scroll
Advanced tools
Comparing version 0.0.1-alpha.11 to 0.0.1-alpha.12
@@ -1,27 +0,1 @@ | ||
import { useMemo as o } from "react"; | ||
import { PrependScrollRestorationStrategy as l } from "./types.js"; | ||
const n = ({ childrenArray: e, visibleItem: r }) => r ? e.findIndex((t) => t.key === r.key) : -1, s = ({ childrenArray: e }) => e.length - 1, a = { | ||
scrollFollowOffsetPx: 30, | ||
scrollLoadHistoryOffsetPx: 100, | ||
scrollLoadHistoryWorker: async () => { | ||
}, | ||
estimateSizePx: 100, | ||
prependScrollRestorationStrategy: l.restore, | ||
loader: null, | ||
overscan: 2, | ||
paddingStart: 100, | ||
prependScrollTargetIndex: n, | ||
appendScrollTargetIndex: s, | ||
scrollAlignment: "end", | ||
getScrollButton: null, | ||
scrollToLastOnAppend: !1 | ||
}, p = (e) => o(() => ({ | ||
...a, | ||
...e | ||
}), [e]); | ||
export { | ||
a as AssistantChatScrollPropDefaults, | ||
s as defaultAppendScrollTargetIndex, | ||
n as defaultPrependScrollTargetIndex, | ||
p as useAssistantChatScrollProps | ||
}; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),a=require("./types.js"),r=({childrenArray:e,visibleItem:t})=>t?e.findIndex(s=>s.key===t.key):-1,l=({childrenArray:e})=>e.length-1,o={scrollFollowOffsetPx:30,scrollLoadHistoryOffsetPx:100,scrollLoadHistoryWorker:async()=>{},estimateSizePx:100,prependScrollRestorationStrategy:a.PrependScrollRestorationStrategy.restore,loader:null,overscan:2,paddingStart:100,prependScrollTargetIndex:r,appendScrollTargetIndex:l,scrollAlignment:"end",getScrollButton:null,scrollToLastOnAppend:!1},c=e=>n.useMemo(()=>({...o,...e}),[e]);exports.AssistantChatScrollPropDefaults=o;exports.defaultAppendScrollTargetIndex=l;exports.defaultPrependScrollTargetIndex=r;exports.useAssistantChatScrollProps=c; |
@@ -1,9 +0,1 @@ | ||
import { AssistantChatScroll as e } from "./AssistantChatScroll.js"; | ||
import { AssistantChatScrollPropDefaults as s, defaultAppendScrollTargetIndex as a, defaultPrependScrollTargetIndex as o, useAssistantChatScrollProps as n } from "./AssistantChatScrollProps.js"; | ||
export { | ||
e as AssistantChatScroll, | ||
s as AssistantChatScrollPropDefaults, | ||
a as defaultAppendScrollTargetIndex, | ||
o as defaultPrependScrollTargetIndex, | ||
n as useAssistantChatScrollProps | ||
}; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./AssistantChatScroll.js"),t=require("./AssistantChatScrollProps.js");exports.AssistantChatScroll=s.AssistantChatScroll;exports.AssistantChatScrollPropDefaults=t.AssistantChatScrollPropDefaults;exports.defaultAppendScrollTargetIndex=t.defaultAppendScrollTargetIndex;exports.defaultPrependScrollTargetIndex=t.defaultPrependScrollTargetIndex;exports.useAssistantChatScrollProps=t.useAssistantChatScrollProps; |
@@ -1,4 +0,1 @@ | ||
var v = /* @__PURE__ */ ((u) => (u.auto = "auto", u.start = "start", u.center = "center", u.end = "end", u.restore = "0", u))(v || {}); | ||
export { | ||
v as PrependScrollRestorationStrategy | ||
}; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=(u=>(u.auto="auto",u.start="start",u.center="center",u.end="end",u.restore="0",u))(e||{});exports.PrependScrollRestorationStrategy=e; |
@@ -1,43 +0,1 @@ | ||
import { useState as c, useEffect as s } from "react"; | ||
const d = (t) => { | ||
const [e, r] = c(t != null && t.current ? t.current.getBoundingClientRect() : { | ||
x: 0, | ||
y: 0, | ||
width: 0, | ||
height: 0 | ||
}), [l, i] = c(t != null && t.current ? { | ||
top: t.current.scrollTop, | ||
maxTop: t.current.scrollTop - t.current.getBoundingClientRect().height, | ||
scrollHeight: t.current.scrollHeight | ||
} : { | ||
top: 0, | ||
maxTop: 0, | ||
scrollHeight: 0 | ||
}); | ||
return s(() => { | ||
if (!(t != null && t.current)) | ||
return; | ||
const n = new ResizeObserver(() => { | ||
const o = t.current.getBoundingClientRect(); | ||
(o.width !== e.width || o.height !== e.height) && r(o); | ||
}); | ||
return n.observe(t.current), () => { | ||
n.disconnect(); | ||
}; | ||
}, [e.height, e.width, t]), s(() => { | ||
if (!t.current) | ||
return; | ||
const n = t.current, o = () => { | ||
const u = n.getBoundingClientRect(), h = { | ||
top: n.scrollTop, | ||
maxTop: n.scrollHeight - u.height, | ||
scrollHeight: n.scrollHeight | ||
}; | ||
i(h); | ||
}; | ||
return n.addEventListener("scroll", o), () => n.removeEventListener("scroll", o); | ||
}, [e, t]), { pos: e, scrollPos: l }; | ||
}; | ||
export { | ||
d as useElementPos | ||
}; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),h=t=>{const[n,s]=c.useState(t!=null&&t.current?t.current.getBoundingClientRect():{x:0,y:0,width:0,height:0}),[r,l]=c.useState(t!=null&&t.current?{top:t.current.scrollTop,maxTop:t.current.scrollTop-t.current.getBoundingClientRect().height,scrollHeight:t.current.scrollHeight}:{top:0,maxTop:0,scrollHeight:0});return c.useEffect(()=>{if(!(t!=null&&t.current))return;const e=new ResizeObserver(()=>{const o=t.current.getBoundingClientRect();(o.width!==n.width||o.height!==n.height)&&s(o)});return e.observe(t.current),()=>{e.disconnect()}},[n.height,n.width,t]),c.useEffect(()=>{if(!t.current)return;const e=t.current,o=()=>{const i=e.getBoundingClientRect(),u={top:e.scrollTop,maxTop:e.scrollHeight-i.height,scrollHeight:e.scrollHeight};l(u)};return e.addEventListener("scroll",o),()=>e.removeEventListener("scroll",o)},[n,t]),{pos:n,scrollPos:r}};exports.useElementPos=h; |
@@ -1,10 +0,1 @@ | ||
function f(n, i) { | ||
for (let t = n.length - 1; t > 0; t--) { | ||
const e = n[t]; | ||
if (i(e)) | ||
return e; | ||
} | ||
} | ||
export { | ||
f as findLast | ||
}; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(e,n){for(let t=e.length-1;t>0;t--){const i=e[t];if(n(i))return i}}exports.findLast=o; |
@@ -1,9 +0,1 @@ | ||
import { AssistantChatScroll as e } from "./AssistantChatScroll/AssistantChatScroll.js"; | ||
import { AssistantChatScrollPropDefaults as s, defaultAppendScrollTargetIndex as a, defaultPrependScrollTargetIndex as o, useAssistantChatScrollProps as n } from "./AssistantChatScroll/AssistantChatScrollProps.js"; | ||
export { | ||
e as AssistantChatScroll, | ||
s as AssistantChatScrollPropDefaults, | ||
a as defaultAppendScrollTargetIndex, | ||
o as defaultPrependScrollTargetIndex, | ||
n as useAssistantChatScrollProps | ||
}; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./AssistantChatScroll/AssistantChatScroll.js"),t=require("./AssistantChatScroll/AssistantChatScrollProps.js");exports.AssistantChatScroll=s.AssistantChatScroll;exports.AssistantChatScrollPropDefaults=t.AssistantChatScrollPropDefaults;exports.defaultAppendScrollTargetIndex=t.defaultAppendScrollTargetIndex;exports.defaultPrependScrollTargetIndex=t.defaultPrependScrollTargetIndex;exports.useAssistantChatScrollProps=t.useAssistantChatScrollProps; |
@@ -1,1 +0,1 @@ | ||
"use strict"; |
{ | ||
"name": "assistant-chat-scroll", | ||
"version": "0.0.1-alpha.11", | ||
"version": "0.0.1-alpha.12", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 4 instances in 1 package
447419
1911
7
1