@visulima/tui 1.0.0-alpha.25 → 1.0.0-alpha.26
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 +11 -0
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/controlled-scroll-view.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/scroll-list.js +1 -1
- package/dist/components/scroll-view.js +1 -1
- package/dist/packem_shared/{ControlledScrollView-BoN5Oi-p.js → ControlledScrollView-btYXQFoC.js} +1 -1
- package/dist/packem_shared/{ScrollList-DyFyVs6I.js → ScrollList-Dc2LzJFv.js} +1 -1
- package/dist/packem_shared/{ScrollView-BEgrtSnt.js → ScrollView-yZyiky7k.js} +1 -1
- package/dist/packem_shared/controlled-scroll-view-BQ0JOudw.js +1 -0
- package/index.js +26 -26
- package/package.json +10 -10
- package/dist/packem_shared/controlled-scroll-view-t55HU9L8.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## @visulima/tui [1.0.0-alpha.26](https://github.com/visulima/visulima/compare/@visulima/tui@1.0.0-alpha.25...@visulima/tui@1.0.0-alpha.26) (2026-06-19)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **tui:** clear eslint errors in components ([#685](https://github.com/visulima/visulima/issues/685)) ([ebdb47f](https://github.com/visulima/visulima/commit/ebdb47fb22c8584b5908b89b7fbbfa3fb499786b))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
* **@visulima/error:** upgraded to 6.0.0-alpha.34
|
|
11
|
+
|
|
1
12
|
## @visulima/tui [1.0.0-alpha.25](https://github.com/visulima/visulima/compare/@visulima/tui@1.0.0-alpha.24...@visulima/tui@1.0.0-alpha.25) (2026-06-15)
|
|
2
13
|
|
|
3
14
|
### Bug Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a,jsxs as o,Fragment as d}from"react/jsx-runtime";import{Fragment as c}from"react";import{Box as s}from"./box.js";import{Text as
|
|
1
|
+
import{jsx as a,jsxs as o,Fragment as d}from"react/jsx-runtime";import{Fragment as c}from"react";import{Box as s}from"./box.js";import{Text as t}from"./text.js";function b({currentColor:n="blue",items:i,separator:m="›"}){return a(s,{children:i.map((r,l)=>{const e=l===i.length-1;return o(c,{children:[l>0?o(t,{dimColor:!0,children:[" ",m," "]}):void 0,o(t,{bold:e,color:e?n:void 0,dimColor:!e,children:[r.icon===void 0?void 0:o(d,{children:[r.icon," "]}),r.label]})]},r.key??r.label)})})}export{b as Breadcrumb,b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as r}from"../packem_shared/controlled-scroll-view-
|
|
1
|
+
import{C as r}from"../packem_shared/controlled-scroll-view-BQ0JOudw.js";export{r as ControlledScrollView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,jsxs as j}from"react/jsx-runtime";import{useRef as M}from"react";import H from"../ink/hooks/use-terminal-palette.js";import I from"../ink/hooks/use-window-size.js";import{Box as o}from"./box.js";import{Text as R}from"./text.js";import{ScrollView as T}from"../packem_shared/ScrollView-
|
|
1
|
+
import{jsx as r,jsxs as j}from"react/jsx-runtime";import{useRef as M}from"react";import H from"../ink/hooks/use-terminal-palette.js";import I from"../ink/hooks/use-window-size.js";import{Box as o}from"./box.js";import{Text as R}from"./text.js";import{ScrollView as T}from"../packem_shared/ScrollView-yZyiky7k.js";const A=({backgroundColor:u,borderColor:l="cyan",borderStyle:f="round",children:h,columns:g,footer:d,maxHeight:e=.8,paddingX:i=2,paddingY:p=1,rows:b,scrollbarStyle:x="block",scrollRef:k,title:n,visible:C=!0,width:S=60})=>{const c=I(),{isLoading:w,palette:y}=H(),B=M(null),D=k??B;if(!C)return null;const a=g??(c.columns||80),t=b??(c.rows||24),s=u??(w?"black":y?.background??"black"),X=e<=1?Math.floor(t*e):Math.min(e,t-2),m=typeof n=="string"?r(o,{marginBottom:1,children:r(R,{bold:!0,color:l,children:n})}):n??null;return r(o,{alignItems:"center",height:t,justifyContent:"center",position:"absolute",width:a,children:j(o,{backgroundColor:s,borderBackgroundColor:s,borderColor:l,borderStyle:f,flexDirection:"column",maxHeight:X,opaque:!0,paddingY:p,width:Math.min(S,a-4),children:[m!=null&&r(o,{flexShrink:0,paddingX:i,children:m}),r(T,{flexGrow:1,flexShrink:1,paddingX:i,ref:D,scrollbar:!0,scrollbarColor:l,scrollbarStyle:x,children:h}),d!=null&&r(o,{alignItems:"center",flexDirection:"column",flexShrink:0,marginTop:1,paddingX:i,children:d})]})})};export{A as Dialog,A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ScrollList as l}from"../packem_shared/ScrollList-
|
|
1
|
+
import{ScrollList as l}from"../packem_shared/ScrollList-Dc2LzJFv.js";export{l as ScrollList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ScrollView as e}from"../packem_shared/ScrollView-
|
|
1
|
+
import{ScrollView as e}from"../packem_shared/ScrollView-yZyiky7k.js";export{e as ScrollView};
|
package/dist/packem_shared/{ControlledScrollView-BoN5Oi-p.js → ControlledScrollView-btYXQFoC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"react/jsx-runtime";import"react";import"./measure-element-Cs7_proT.js";import"../components/box.js";import{C as l}from"./controlled-scroll-view-
|
|
1
|
+
import"react/jsx-runtime";import"react";import"./measure-element-Cs7_proT.js";import"../components/box.js";import{C as l}from"./controlled-scroll-view-BQ0JOudw.js";export{l as ControlledScrollView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as Y}from"react/jsx-runtime";import{useRef as d,useState as K,useEffect as y,useCallback as g,useImperativeHandle as N}from"react";import Q from"../ink/hooks/use-scroll-input.js";import{C as U}from"./controlled-scroll-view-
|
|
1
|
+
import{jsx as Y}from"react/jsx-runtime";import{useRef as d,useState as K,useEffect as y,useCallback as g,useImperativeHandle as N}from"react";import Q from"../ink/hooks/use-scroll-input.js";import{C as U}from"./controlled-scroll-view-BQ0JOudw.js";const et=O=>{const{children:P,keyboard:A=!1,onContentHeightChange:V,onItemHeightChange:B,onScroll:T,onViewportSizeChange:b,overscan:E,ref:L,scrollAlignment:h="auto",selectedIndex:p,vimBindings:R=!1,virtualize:j,...q}=O,n=d(null),[s,D]=K(0),C=d(0);y(()=>{C.current=s},[s]);const o=g(t=>{t!==C.current&&(D(t),T?.(t))},[T]),a=d(p);a.current=p;const S=g(()=>{const t=a.current;if(t===void 0||t<0)return null;const e=n.current?.getItemPosition(t);if(!e)return null;const i=n.current?.getViewportHeight()??0,l=n.current?.getContentHeight()??0;let r=e.top+e.height-i,c=e.top;r>c&&([r,c]=[c,r]);const M=Math.max(0,l-i);return{max:Math.min(M,c),min:Math.max(0,r)}},[]),u=g(t=>{const e=n.current?.getContentHeight()??0,i=n.current?.getViewportHeight()??0,l=Math.max(0,e-i);let r=Math.max(0,Math.min(t,l));const c=S();return c&&(r=Math.max(c.min,Math.min(r,c.max))),r},[S]),m=g((t,e,i,l)=>{const r=n.current?.getItemPosition(t);if(!r)return e;const c=l??n.current?.getViewportHeight()??0,M=n.current?.getContentHeight()??0;let f=e;switch(i){case"bottom":{f=r.top+r.height-c;break}case"center":{f=r.top+r.height/2-c/2;break}case"top":{f=r.top;break}default:{const w=r.top+r.height;r.top<=e&&w>=e+c?f=e:r.top<e?f=r.top:w>e+c&&(f=w-c)}}const X=Math.max(0,M-c);return Math.max(0,Math.min(f,X))},[]);let H=s;p!==void 0&&p>=0&&(H=m(p,s,h)),y(()=>{H!==s&&o(H)},[H,s,o]);const k=g((t,e)=>{if(a.current!==void 0&&a.current>=0){const i=m(a.current,s,h,t.height);o(i)}b?.(t,e)},[b,m,s,h,o]),F=g((t,e,i)=>{const l=a.current;if(l!==void 0&&l>=0){if(t<l){const r=u(s+(e-i));o(r)}else if(t===l){const r=m(t,s,h);o(r)}}B?.(t,e,i)},[B,m,h,s,u,o]),G=g((t,e)=>{if(a.current!==void 0&&a.current>=0){const i=m(a.current,s,h);o(i)}V?.(t,e)},[V,m,s,h,o]),z=d(0),x=g(t=>{const e=C.current,i=u(e+t);o(i)},[u,o]),v=g(()=>{const t=n.current?.getContentHeight()??0,e=n.current?.getViewportHeight()??0,i=Math.max(0,t-e),l=u(i);o(l)},[u,o]),I=g(()=>{const t=u(0);o(t)},[u,o]),J=g(()=>z.current,[]);Q({getViewportHeight:J,isActive:A,scrollBy:x,scrollToBottom:v,scrollToTop:I,vimBindings:R}),N(L,()=>({getBottomOffset:()=>n.current?.getBottomOffset()??0,getContentHeight:()=>n.current?.getContentHeight()??0,getItemHeight:t=>n.current?.getItemHeight(t)??0,getItemPosition:t=>n.current?.getItemPosition(t)??null,getScrollOffset:()=>C.current,getViewportHeight:()=>n.current?.getViewportHeight()??0,remeasure:()=>n.current?.remeasure(),remeasureItem:t=>n.current?.remeasureItem(t),scrollBy:x,scrollTo:t=>{const e=u(t);o(e)},scrollToBottom:v,scrollToTop:I}),[u,o,x,v,I]);const W=g((t,e)=>{z.current=t.height,k(t,e)},[k]);return Y(U,{onContentHeightChange:G,onItemHeightChange:F,onViewportSizeChange:W,overscan:E,ref:n,scrollOffset:H,virtualize:j,...q,children:P})};export{et as ScrollList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as X,jsx as v}from"react/jsx-runtime";import{useRef as h,useState as E,useCallback as o,useImperativeHandle as _}from"react";import $ from"../ink/hooks/use-scroll-input.js";import{Box as ee}from"../components/box.js";import{f as re,C as F}from"./controlled-scroll-view-
|
|
1
|
+
import{jsxs as X,jsx as v}from"react/jsx-runtime";import{useRef as h,useState as E,useCallback as o,useImperativeHandle as _}from"react";import $ from"../ink/hooks/use-scroll-input.js";import{Box as ee}from"../components/box.js";import{f as re,C as F}from"./controlled-scroll-view-BQ0JOudw.js";import{ScrollBar as te}from"./ScrollBar-BKCK8jsb.js";const se=({children:I,debug:B=!1,followOutput:M=!1,followThreshold:T=3,keyboard:W=!1,onContentHeightChange:z,onItemHeightChange:y,onReachEnd:g,onReachStart:p,onScroll:V,onViewportSizeChange:N,overscan:O,reachThreshold:a=5,ref:Y,scrollbar:Z=!1,scrollbarColor:q,scrollbarStyle:J="line",vimBindings:K=!1,virtualize:G,...m})=>{const[d,k,n]=re(0),c=h(null),s=h(0),l=h(0),[D,L]=E(0),[x,Q]=E(0),C=h(!1),w=h(!1),i=o(()=>Math.max(0,s.current-l.current),[]),P=o(e=>{const t=i();g&&e>=t-a&&!C.current?(C.current=!0,g()):e<t-a&&(C.current=!1),p&&e<=a&&!w.current?(w.current=!0,p()):e>a&&(w.current=!1)},[g,p,a,i]),r=o(e=>{e!==n()&&(k(e),V?.(e),P(e))},[n,k,V,P]),j=o((e,t)=>{const u=n()>=i()-T;if(s.current=e,L(e),z?.(e,t),M&&u&&e>t){const f=Math.max(0,e-l.current);r(f)}else{const f=Math.max(0,e-l.current);n()>f&&r(f)}},[z,M,T,n,i,r]),A=o((e,t)=>{l.current=e.height,Q(e.height),N?.(e,t)},[N]),H=o(e=>{if(typeof e!="number"||Number.isNaN(e))return;const t=Math.max(0,s.current-l.current),u=Math.max(0,Math.min(n()+e,t));r(u)},[n,r]),R=o(e=>{if(typeof e!="number"||Number.isNaN(e))return;const t=Math.max(0,s.current-l.current),u=Math.max(0,Math.min(e,t));r(u)},[r]),b=o(()=>{const e=i();r(e)},[i,r]),S=o(()=>{r(0)},[r]),U=o(()=>l.current,[]);return $({getViewportHeight:U,isActive:W,scrollBy:H,scrollToBottom:b,scrollToTop:S,vimBindings:K}),_(Y,()=>({getBottomOffset:i,getContentHeight:()=>s.current,getItemHeight:e=>c.current?.getItemHeight(e)??0,getItemPosition:e=>c.current?.getItemPosition(e)??null,getScrollOffset:n,getViewportHeight:()=>l.current,remeasure:()=>c.current?.remeasure(),remeasureItem:e=>c.current?.remeasureItem(e),scrollBy:H,scrollTo:R,scrollToBottom:b,scrollToTop:S}),[i,n,H,R,b,S]),Z&&D>x&&x>0?X(ee,{flexDirection:"row",flexGrow:m.flexGrow,flexShrink:m.flexShrink,overflow:"hidden",children:[v(F,{children:I,debug:B,onContentHeightChange:j,onItemHeightChange:y,onViewportSizeChange:A,overscan:O,ref:c,scrollOffset:d,virtualize:G,...m,flexGrow:1}),v(te,{color:q,contentHeight:D,placement:"inset",scrollOffset:d,style:J,viewportHeight:x})]}):v(F,{children:I,debug:B,onContentHeightChange:j,onItemHeightChange:y,onViewportSizeChange:A,overscan:O,ref:c,scrollOffset:d,virtualize:G,...m})};export{se as ScrollView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as H,jsxs as rr}from"react/jsx-runtime";import{useState as K,useRef as d,useCallback as j,useLayoutEffect as T,isValidElement as z,useImperativeHandle as tr,Fragment as G}from"react";import{R as N}from"./measure-element-Cs7_proT.js";import{Box as M}from"../components/box.js";const J=u=>{const[g,m]=K(u),l=d(u),k=j(C=>{const E=typeof C=="function"?C(l.current):C;l.current=E,m(E)},[]),x=j(()=>l.current,[]);return[g,k,x]},er=({children:u,index:g,measureKey:m,onMeasure:l,width:k})=>{const x=d(null);return T(()=>{if(x.current){const{height:C}=N(x.current);l(g,C)}},[g,l,k,m,u]),H(M,{flexDirection:"column",flexShrink:0,ref:x,width:"100%",children:u})},B=u=>{if(u==null)return[];if(Array.isArray(u)){const g=[];for(let m=0;m<u.length;m+=1){const l=u[m];z(l)&&l.type===G?g.push(...B(l.props.children)):g.push(l)}return g}return z(u)&&u.type===G?B(u.props.children):[u]},hr=({children:u,debug:g=!1,onContentHeightChange:m,onItemHeightChange:l,onViewportSizeChange:k,overscan:x=3,ref:C,scrollOffset:E,virtualize:Q=!1,...U})=>{const D=d(!1),[$,q,S]=J({height:0,width:0}),[I,O,R]=J(0),[W,X]=K({}),V=d(null),b=d(0);T(()=>{I!==b.current&&(m?.(I,b.current),b.current=I)},[I,m]);const o=d({}),i=d([]),p=d([]),f=d(0),Y=j((r,t)=>{const e=i.current[r]??r;if(o.current[e]!==t){const h=o.current[e]??0;o.current={...o.current,[e]:t};let n=0;for(let s=0;s<i.current.length;s+=1){const y=i.current[s];y!=null&&(n+=o.current[y]??0)}const c=R();n!==c&&O(n),l?.(r,t,h),f.current=Math.min(f.current,r+1)}},[l,R,O]),F=j(()=>{if(V.current){const{height:r,width:t}=N(V.current),e=S();(t!==e.width||r!==e.height)&&(k?.({height:r,width:t},e),q({height:r,width:t}))}},[V,k,S,q]);T(()=>{F()});const Z=d(null);if(Z.current!==u){Z.current=u;const r=[],t={};B(u).forEach((n,c)=>{if(!n)return;const s=(z(n)?n.key:null)??c;r[c]=s;const y=o.current[s]??0;t[s]=y}),o.current=t,i.current=r,p.current=Array.from({length:r.length}).fill(0),f.current=0;let e=0;r.forEach(n=>{e+=t[n]??0});const h=R();e!==h&&O(e)}tr(C,()=>({getBottomOffset:()=>Math.max(0,R()-S().height),getContentHeight:R,getItemHeight:r=>{const t=i.current[r]??r;return o.current[t]??0},getItemPosition:r=>{if(r<0||r>=i.current.length)return null;if(r>=f.current){let h=0,n=0;if(f.current>0){n=f.current;const c=n-1,s=i.current[c]??c,y=o.current[s]??0;h=(p.current[c]??0)+y}for(let c=n;c<=r;c+=1){p.current[c]=h;const s=i.current[c]??c,y=o.current[s]??0;h+=y}f.current=r+1}const t=p.current[r]??0,e=i.current[r]??r;return{height:o.current[e]??0,top:t}},getViewportHeight:()=>S().height,remeasure:F,remeasureItem:r=>{X(t=>({...t,[r]:(t[r]??0)+1}))}}),[F,R,S,X]);const v=B(u);!D.current&&I>0&&(D.current=!0);let w=0,a=v.length-1,L=0,P=0;const _=v.length>0&&v.every((r,t)=>{const e=i.current[t]??t;return(o.current[e]??0)>0}),A=Q&&D.current&&_;if(A){const r=i.current.length;if(f.current<r){let e=0,h=0;if(f.current>0){h=f.current;const n=h-1,c=i.current[n]??n,s=o.current[c]??0;e=(p.current[n]??0)+s}for(let n=h;n<r;n+=1){p.current[n]=e;const c=i.current[n]??n;e+=o.current[c]??0}f.current=r}const t=E+$.height;w=v.length,a=-1;for(let e=0;e<r;e+=1){const h=p.current[e]??0,n=i.current[e]??e,c=o.current[n]??0;h+c>E&&h<t&&(e<w&&(w=e),a=e)}if(w>a&&(w=0,a=-1),w=Math.max(0,w-x),a=Math.min(v.length-1,Math.max(-1,a)+x),L=p.current[w]??0,a<v.length-1){const e=i.current[a]??a,h=(p.current[a]??0)+(o.current[e]??0);P=I-h}}return H(M,{...U,children:H(M,{ref:V,width:"100%",children:H(M,{overflow:g?void 0:"hidden",width:"100%",children:rr(M,{flexDirection:"column",marginTop:-E,width:"100%",children:[A&&L>0&&H(M,{height:L}),v.map((r,t)=>!r||A&&(t<w||t>a)?null:H(er,{index:t,measureKey:W[t],onMeasure:Y,width:$.width,children:r},z(r)?r.key??t:t)),A&&P>0&&H(M,{height:P})]})})})})};export{hr as C,J as f};
|
package/index.js
CHANGED
|
@@ -87,7 +87,7 @@ function requireNative() {
|
|
|
87
87
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
88
88
|
) {
|
|
89
89
|
throw new Error(
|
|
90
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
90
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
return binding;
|
|
@@ -109,7 +109,7 @@ function requireNative() {
|
|
|
109
109
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
110
110
|
) {
|
|
111
111
|
throw new Error(
|
|
112
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
112
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
return binding;
|
|
@@ -136,7 +136,7 @@ function requireNative() {
|
|
|
136
136
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
137
137
|
) {
|
|
138
138
|
throw new Error(
|
|
139
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
139
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
140
140
|
);
|
|
141
141
|
}
|
|
142
142
|
return binding;
|
|
@@ -158,7 +158,7 @@ function requireNative() {
|
|
|
158
158
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
159
159
|
) {
|
|
160
160
|
throw new Error(
|
|
161
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
161
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
164
|
return binding;
|
|
@@ -181,7 +181,7 @@ function requireNative() {
|
|
|
181
181
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
182
182
|
) {
|
|
183
183
|
throw new Error(
|
|
184
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
184
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
187
|
return binding;
|
|
@@ -203,7 +203,7 @@ function requireNative() {
|
|
|
203
203
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
204
204
|
) {
|
|
205
205
|
throw new Error(
|
|
206
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
206
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
207
207
|
);
|
|
208
208
|
}
|
|
209
209
|
return binding;
|
|
@@ -224,7 +224,7 @@ function requireNative() {
|
|
|
224
224
|
const bindingPackageVersion = require("@visulima/tui-binding-darwin-universal/package.json").version;
|
|
225
225
|
if (bindingPackageVersion !== "1.0.0-alpha.21" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
226
226
|
throw new Error(
|
|
227
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
227
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
228
228
|
);
|
|
229
229
|
}
|
|
230
230
|
return binding;
|
|
@@ -246,7 +246,7 @@ function requireNative() {
|
|
|
246
246
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
247
247
|
) {
|
|
248
248
|
throw new Error(
|
|
249
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
249
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
250
250
|
);
|
|
251
251
|
}
|
|
252
252
|
return binding;
|
|
@@ -268,7 +268,7 @@ function requireNative() {
|
|
|
268
268
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
269
269
|
) {
|
|
270
270
|
throw new Error(
|
|
271
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
271
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
272
272
|
);
|
|
273
273
|
}
|
|
274
274
|
return binding;
|
|
@@ -294,7 +294,7 @@ function requireNative() {
|
|
|
294
294
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
295
295
|
) {
|
|
296
296
|
throw new Error(
|
|
297
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
297
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
298
298
|
);
|
|
299
299
|
}
|
|
300
300
|
return binding;
|
|
@@ -316,7 +316,7 @@ function requireNative() {
|
|
|
316
316
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
317
317
|
) {
|
|
318
318
|
throw new Error(
|
|
319
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
319
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
320
320
|
);
|
|
321
321
|
}
|
|
322
322
|
return binding;
|
|
@@ -343,7 +343,7 @@ function requireNative() {
|
|
|
343
343
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
344
344
|
) {
|
|
345
345
|
throw new Error(
|
|
346
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
346
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
347
347
|
);
|
|
348
348
|
}
|
|
349
349
|
return binding;
|
|
@@ -365,7 +365,7 @@ function requireNative() {
|
|
|
365
365
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
366
366
|
) {
|
|
367
367
|
throw new Error(
|
|
368
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
368
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
369
369
|
);
|
|
370
370
|
}
|
|
371
371
|
return binding;
|
|
@@ -389,7 +389,7 @@ function requireNative() {
|
|
|
389
389
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
390
390
|
) {
|
|
391
391
|
throw new Error(
|
|
392
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
392
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
393
393
|
);
|
|
394
394
|
}
|
|
395
395
|
return binding;
|
|
@@ -411,7 +411,7 @@ function requireNative() {
|
|
|
411
411
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
412
412
|
) {
|
|
413
413
|
throw new Error(
|
|
414
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
414
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
415
415
|
);
|
|
416
416
|
}
|
|
417
417
|
return binding;
|
|
@@ -435,7 +435,7 @@ function requireNative() {
|
|
|
435
435
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
436
436
|
) {
|
|
437
437
|
throw new Error(
|
|
438
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
438
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
439
439
|
);
|
|
440
440
|
}
|
|
441
441
|
return binding;
|
|
@@ -457,7 +457,7 @@ function requireNative() {
|
|
|
457
457
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
458
458
|
) {
|
|
459
459
|
throw new Error(
|
|
460
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
460
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
461
461
|
);
|
|
462
462
|
}
|
|
463
463
|
return binding;
|
|
@@ -481,7 +481,7 @@ function requireNative() {
|
|
|
481
481
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
482
482
|
) {
|
|
483
483
|
throw new Error(
|
|
484
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
484
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
485
485
|
);
|
|
486
486
|
}
|
|
487
487
|
return binding;
|
|
@@ -503,7 +503,7 @@ function requireNative() {
|
|
|
503
503
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
504
504
|
) {
|
|
505
505
|
throw new Error(
|
|
506
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
506
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
507
507
|
);
|
|
508
508
|
}
|
|
509
509
|
return binding;
|
|
@@ -527,7 +527,7 @@ function requireNative() {
|
|
|
527
527
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
528
528
|
) {
|
|
529
529
|
throw new Error(
|
|
530
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
530
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
531
531
|
);
|
|
532
532
|
}
|
|
533
533
|
return binding;
|
|
@@ -549,7 +549,7 @@ function requireNative() {
|
|
|
549
549
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
550
550
|
) {
|
|
551
551
|
throw new Error(
|
|
552
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
552
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
553
553
|
);
|
|
554
554
|
}
|
|
555
555
|
return binding;
|
|
@@ -572,7 +572,7 @@ function requireNative() {
|
|
|
572
572
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
573
573
|
) {
|
|
574
574
|
throw new Error(
|
|
575
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
575
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
576
576
|
);
|
|
577
577
|
}
|
|
578
578
|
return binding;
|
|
@@ -594,7 +594,7 @@ function requireNative() {
|
|
|
594
594
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
595
595
|
) {
|
|
596
596
|
throw new Error(
|
|
597
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
597
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
598
598
|
);
|
|
599
599
|
}
|
|
600
600
|
return binding;
|
|
@@ -620,7 +620,7 @@ function requireNative() {
|
|
|
620
620
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
621
621
|
) {
|
|
622
622
|
throw new Error(
|
|
623
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
623
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
624
624
|
);
|
|
625
625
|
}
|
|
626
626
|
return binding;
|
|
@@ -642,7 +642,7 @@ function requireNative() {
|
|
|
642
642
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
643
643
|
) {
|
|
644
644
|
throw new Error(
|
|
645
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
645
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
646
646
|
);
|
|
647
647
|
}
|
|
648
648
|
return binding;
|
|
@@ -664,7 +664,7 @@ function requireNative() {
|
|
|
664
664
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
|
|
665
665
|
) {
|
|
666
666
|
throw new Error(
|
|
667
|
-
`Native binding package version mismatch, expected 1.0.0-alpha.
|
|
667
|
+
`Native binding package version mismatch, expected 1.0.0-alpha.26 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
668
668
|
);
|
|
669
669
|
}
|
|
670
670
|
return binding;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/tui",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.26",
|
|
4
4
|
"description": "React-based TUI library powered by a native Rust diff engine, drop-in Ink-compatible API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -595,7 +595,7 @@
|
|
|
595
595
|
"dependencies": {
|
|
596
596
|
"@visulima/ansi": "4.0.0-alpha.17",
|
|
597
597
|
"@visulima/colorize": "2.0.0-alpha.14",
|
|
598
|
-
"@visulima/error": "6.0.0-alpha.
|
|
598
|
+
"@visulima/error": "6.0.0-alpha.34",
|
|
599
599
|
"@visulima/spinner": "1.0.0-alpha.4",
|
|
600
600
|
"@visulima/string": "3.0.0-alpha.17",
|
|
601
601
|
"cli-boxes": "^4.0.1",
|
|
@@ -651,14 +651,14 @@
|
|
|
651
651
|
}
|
|
652
652
|
},
|
|
653
653
|
"optionalDependencies": {
|
|
654
|
-
"@visulima/tui-binding-darwin-arm64": "1.0.0-alpha.
|
|
655
|
-
"@visulima/tui-binding-linux-arm64-
|
|
656
|
-
"@visulima/tui-binding-linux-
|
|
657
|
-
"@visulima/tui-binding-darwin-x64": "1.0.0-alpha.
|
|
658
|
-
"@visulima/tui-binding-linux-
|
|
659
|
-
"@visulima/tui-binding-linux-x64-musl": "1.0.0-alpha.
|
|
660
|
-
"@visulima/tui-binding-win32-arm64-msvc": "1.0.0-alpha.
|
|
661
|
-
"@visulima/tui-binding-win32-x64-msvc": "1.0.0-alpha.
|
|
654
|
+
"@visulima/tui-binding-darwin-arm64": "1.0.0-alpha.26",
|
|
655
|
+
"@visulima/tui-binding-linux-arm64-musl": "1.0.0-alpha.26",
|
|
656
|
+
"@visulima/tui-binding-linux-arm64-gnu": "1.0.0-alpha.26",
|
|
657
|
+
"@visulima/tui-binding-darwin-x64": "1.0.0-alpha.26",
|
|
658
|
+
"@visulima/tui-binding-linux-x64-gnu": "1.0.0-alpha.26",
|
|
659
|
+
"@visulima/tui-binding-linux-x64-musl": "1.0.0-alpha.26",
|
|
660
|
+
"@visulima/tui-binding-win32-arm64-msvc": "1.0.0-alpha.26",
|
|
661
|
+
"@visulima/tui-binding-win32-x64-msvc": "1.0.0-alpha.26"
|
|
662
662
|
},
|
|
663
663
|
"engines": {
|
|
664
664
|
"node": "^22.14.0 || >=24.10.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as v,jsxs as rr}from"react/jsx-runtime";import{useState as J,useRef as d,useCallback as j,useLayoutEffect as T,isValidElement as z,useImperativeHandle as tr,Fragment as q}from"react";import{R as K}from"./measure-element-Cs7_proT.js";import{Box as H}from"../components/box.js";const G=u=>{const[g,m]=J(u),l=d(u),k=j(C=>{const E=typeof C=="function"?C(l.current):C;l.current=E,m(E)},[]),y=j(()=>l.current,[]);return[g,k,y]},er=({children:u,index:g,measureKey:m,onMeasure:l,width:k})=>{const y=d(null);return T(()=>{if(y.current){const{height:C}=K(y.current);l(g,C)}},[g,l,k,m,u]),v(H,{flexDirection:"column",flexShrink:0,ref:y,width:"100%",children:u})},B=u=>{if(u==null)return[];if(Array.isArray(u)){const g=[];for(let m=0;m<u.length;m+=1){const l=u[m];z(l)&&l.type===q?g.push(...B(l.props.children)):g.push(l)}return g}return z(u)&&u.type===q?B(u.props.children):[u]},ir=({children:u,debug:g=!1,onContentHeightChange:m,onItemHeightChange:l,onViewportSizeChange:k,overscan:y=3,ref:C,scrollOffset:E,virtualize:N=!1,...Q})=>{const D=d(!1),[$,X,S]=G({height:0,width:0}),[I,O,R]=G(0),[U,Z]=J({}),V=d(null),b=d(0);T(()=>{I!==b.current&&(m?.(I,b.current),b.current=I)},[I,m]);const o=d({}),h=d([]),p=d([]),f=d(0),W=j((r,t)=>{const e=h.current[r]??r;if(o.current[e]!==t){const i=o.current[e]??0;o.current={...o.current,[e]:t};let n=0;for(let s=0;s<h.current.length;s+=1){const x=h.current[s];x!=null&&(n+=o.current[x]??0)}const c=R();n!==c&&O(n),l?.(r,t,i),f.current=Math.min(f.current,r+1)}},[l,R,O]),F=j(()=>{if(V.current){const{height:r,width:t}=K(V.current),e=S();(t!==e.width||r!==e.height)&&(k?.({height:r,width:t},e),X({height:r,width:t}))}},[V,k,S,X]);T(()=>{F()});const _=d(null);if(_.current!==u){_.current=u;const r=[],t={};B(u).forEach((n,c)=>{if(!n)return;const s=(z(n)?n.key:null)??c;r[c]=s;const x=o.current[s]??0;t[s]=x}),o.current=t,h.current=r,p.current=Array.from({length:r.length}).fill(0),f.current=0;let e=0;r.forEach(n=>{e+=t[n]??0});const i=R();e!==i&&O(e)}tr(C,()=>({getBottomOffset:()=>Math.max(0,R()-S().height),getContentHeight:R,getItemHeight:r=>{const t=h.current[r]??r;return o.current[t]??0},getItemPosition:r=>{if(r<0||r>=h.current.length)return null;if(r>=f.current){let i=0,n=0;if(f.current>0){n=f.current;const c=n-1,s=h.current[c]??c,x=o.current[s]??0;i=(p.current[c]??0)+x}for(let c=n;c<=r;c+=1){p.current[c]=i;const s=h.current[c]??c,x=o.current[s]??0;i+=x}f.current=r+1}const t=p.current[r]??0,e=h.current[r]??r;return{height:o.current[e]??0,top:t}},getViewportHeight:()=>S().height,remeasure:F,remeasureItem:r=>{Z(t=>({...t,[r]:(t[r]??0)+1}))}}),[F,R,S,Z]);const M=B(u);!D.current&&I>0&&(D.current=!0);let w=0,a=M.length-1,L=0,P=0;const Y=M.length>0&&M.every((r,t)=>{const e=h.current[t]??t;return(o.current[e]??0)>0}),A=N&&D.current&&Y;if(A){const r=h.current.length;if(f.current<r){let e=0,i=0;if(f.current>0){i=f.current;const n=i-1,c=h.current[n]??n,s=o.current[c]??0;e=(p.current[n]??0)+s}for(let n=i;n<r;n+=1){p.current[n]=e;const c=h.current[n]??n;e+=o.current[c]??0}f.current=r}const t=E+$.height;w=M.length,a=-1;for(let e=0;e<r;e+=1){const i=p.current[e]??0,n=h.current[e]??e,c=o.current[n]??0;i+c>E&&i<t&&(e<w&&(w=e),a=e)}if(w>a&&(w=0,a=-1),w=Math.max(0,w-y),a=Math.min(M.length-1,Math.max(-1,a)+y),L=p.current[w]??0,a<M.length-1){const e=h.current[a]??a,i=(p.current[a]??0)+(o.current[e]??0);P=I-i}}return v(H,{...Q,children:v(H,{ref:V,width:"100%",children:v(H,{overflow:g?void 0:"hidden",width:"100%",children:rr(H,{flexDirection:"column",marginTop:-E,width:"100%",children:[A&&L>0&&v(H,{height:L}),M.map((r,t)=>!r||A&&(t<w||t>a)?null:v(er,{index:t,measureKey:U[t],onMeasure:W,width:$.width,children:r},z(r)?r.key??t:t)),A&&P>0&&v(H,{height:P})]})})})})};export{ir as C,G as f};
|