@visulima/tui 1.0.0-alpha.17 → 1.0.0-alpha.19
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 +34 -0
- package/LICENSE.md +107 -284
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/approval-prompt.d.ts +1 -1
- package/dist/components/area-chart.d.ts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/bar-chart.d.ts +1 -1
- package/dist/components/blink-dot.d.ts +1 -1
- package/dist/components/box.d.ts +4 -3
- package/dist/components/breadcrumb.d.ts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/calendar.d.ts +1 -1
- package/dist/components/canvas.js +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/collapsible.d.ts +1 -1
- package/dist/components/command-palette.d.ts +1 -1
- package/dist/components/content-switcher.d.ts +1 -1
- package/dist/components/controlled-scroll-view.d.ts +4 -3
- package/dist/components/controlled-scroll-view.js +1 -1
- package/dist/components/cursor.d.ts +4 -3
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/definition-list.d.ts +1 -1
- package/dist/components/dialog.d.ts +4 -3
- package/dist/components/dialog.js +1 -1
- package/dist/components/divider.d.ts +1 -1
- package/dist/components/form.d.ts +1 -1
- package/dist/components/gauge.d.ts +1 -1
- package/dist/components/gradient.d.ts +1 -18
- package/dist/components/gradient.js +1 -4
- package/dist/components/heading.d.ts +1 -1
- package/dist/components/heatmap.d.ts +1 -1
- package/dist/components/histogram.d.ts +1 -1
- package/dist/components/kbd.d.ts +1 -1
- package/dist/components/line-chart.d.ts +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/loading-indicator.d.ts +2 -2
- package/dist/components/menu.d.ts +1 -1
- package/dist/components/message-bubble.d.ts +1 -1
- package/dist/components/model-badge.d.ts +1 -1
- package/dist/components/multi-select.d.ts +1 -1
- package/dist/components/option-list.d.ts +1 -1
- package/dist/components/paragraph.d.ts +1 -1
- package/dist/components/placeholder.d.ts +1 -1
- package/dist/components/progress-bar.d.ts +3 -2
- package/dist/components/radio-group.d.ts +1 -1
- package/dist/components/scatter-plot.d.ts +1 -1
- package/dist/components/scroll-bar-box.d.ts +4 -3
- package/dist/components/scroll-bar.d.ts +4 -3
- package/dist/components/scroll-list.d.ts +4 -3
- package/dist/components/scroll-list.js +1 -1
- package/dist/components/scroll-view.d.ts +4 -3
- package/dist/components/scroll-view.js +1 -1
- package/dist/components/search-input.d.ts +1 -1
- package/dist/components/select-input-indicator.d.ts +1 -1
- package/dist/components/select-input-item.d.ts +1 -1
- package/dist/components/select-input.d.ts +1 -1
- package/dist/components/shimmer-text.d.ts +1 -1
- package/dist/components/slider.d.ts +1 -1
- package/dist/components/sparkline.d.ts +1 -1
- package/dist/components/spinner.d.ts +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/static-render.d.ts +4 -3
- package/dist/components/static.d.ts +3 -2
- package/dist/components/status-line.d.ts +1 -1
- package/dist/components/stepper.d.ts +1 -1
- package/dist/components/streaming-text.d.ts +1 -1
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tag.d.ts +1 -1
- package/dist/components/text.d.ts +3 -2
- package/dist/components/text.js +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tree-view-entry.d.ts +4 -3
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +4 -3
- package/dist/ink/hooks/use-box-metrics.js +1 -1
- package/dist/ink/hooks/use-input.js +1 -1
- package/dist/ink/hooks/use-linked-scroll.d.ts +4 -3
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-text-selection.d.ts +5 -4
- package/dist/ink/hooks/use-text-selection.js +1 -1
- package/dist/ink/hooks/use-window-size.js +1 -1
- package/dist/ink/index.d.ts +7 -6
- package/dist/ink/index.js +1 -1
- package/dist/packem_shared/ControlledScrollView-CIc-x1Cx.js +1 -0
- package/dist/packem_shared/{DevTools-DdB596Gm.js → DevTools-ClAYpMVI.js} +1 -1
- package/dist/packem_shared/InputParser-B_qZcN3r.js +2 -0
- package/dist/packem_shared/{LayoutNode-B0qeT8sl.js → LayoutNode-B8zej4dm.js} +1 -1
- package/dist/packem_shared/{MouseProvider-CHU5DuwC.js → MouseProvider-PnIUKURs.js} +1 -1
- package/dist/packem_shared/{ScrollList-TUuafnA1.js → ScrollList-C7nZ9ufK.js} +1 -1
- package/dist/packem_shared/{ScrollView-D9nrXw4U.js → ScrollView-DKZ8OM-m.js} +1 -1
- package/dist/packem_shared/TuiApp-BVDXP0Cv.js +1 -0
- package/dist/packem_shared/ansi-parser-B6uXaq65.js +1 -0
- package/dist/packem_shared/colorize-DbTZMrJO.js +1 -0
- package/dist/packem_shared/{comparePoints-Dhgn8lGv.js → comparePoints-YxQfR_zq.js} +1 -1
- package/dist/packem_shared/{controlled-scroll-view-CFM7ZV9N.js → controlled-scroll-view-CcUS50jx.js} +1 -1
- package/dist/packem_shared/createInlineLoop-DRNZ7jqH.js +2 -0
- package/dist/packem_shared/createScreen-CrLrxA6t.js +3 -0
- package/dist/packem_shared/dom-BG-LS10p.js +1 -0
- package/dist/packem_shared/{dom.d-C-sqbtxD.d.ts → dom.d-CcFuBd-k.d.ts} +8 -6
- package/dist/packem_shared/{getPathToRoot-CL45WosJ.js → getPathToRoot-D5Hns9Er.js} +1 -1
- package/dist/packem_shared/input.d-CgxV2e8U.d.ts +90 -0
- package/dist/packem_shared/{layout-D5zRYQRE.js → layout-BMo200nF.js} +1 -1
- package/dist/packem_shared/measure-text-DDjHT1jD.js +3 -0
- package/dist/packem_shared/{measureElement-BP4fUMFg.js → measureElement-BTtTFZg4.js} +1 -1
- package/dist/packem_shared/parseSgrMouse-Ccj70ijb.js +1 -0
- package/dist/packem_shared/processLayout-FEKj_mWu.js +1 -0
- package/dist/packem_shared/{reconciler-ChRlmCI_.js → reconciler-CUbhOvcr.js} +1 -1
- package/dist/packem_shared/{reconciler-C0e93MVj.js → reconciler-DIfG72R9.js} +1 -1
- package/dist/packem_shared/{render-CqZntGO6.js → render-Dh7HMhK1.js} +1 -1
- package/dist/packem_shared/render-bdbSzkJo.js +26 -0
- package/dist/packem_shared/{render.d-CZ__oorj.d.ts → render.d-B1kiO3Ca.d.ts} +1 -1
- package/dist/packem_shared/{renderToString-DE1YWhbo.js → renderToString-BbQiRHrd.js} +1 -1
- package/dist/packem_shared/{renderToString-D3xqB85B.js → renderToString-DVE0cEHt.js} +1 -1
- package/dist/packem_shared/renderTreeToBuffer-CZilzyhN.js +2 -0
- package/dist/packem_shared/renderer-Cfi6ZyHf.js +17 -0
- package/dist/packem_shared/{selection.d-t_tKgYYA.d.ts → selection.d-DAh7REnW.d.ts} +1 -1
- package/dist/packem_shared/setEnableStyledLineCache-D2gZbwFM.js +1 -0
- package/dist/packem_shared/squashTextNodesWithMap-DCdi3SZ2.js +1 -0
- package/dist/packem_shared/{styles.d-CLJdt-kg.d.ts → styles.d-cMo36xQz.d.ts} +2 -98
- package/dist/packem_shared/text-width-BU2eeTWn.js +2 -0
- package/dist/packem_shared/utils-CoviI5Vm.js +1 -0
- package/dist/packem_shared/{wrapOrTruncateStyledLine-kyi6yijx.js → wrapOrTruncateStyledLine-BZ00SM8i.js} +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +5 -4
- package/dist/testing/index.js +1 -1
- package/index.js +691 -539
- package/package.json +20 -9
- package/dist/packem_shared/ControlledScrollView-C8VKEcM3.js +0 -1
- package/dist/packem_shared/InputParser-Cfi5GVKV.js +0 -2
- package/dist/packem_shared/TuiApp-BSWPFrDu.js +0 -1
- package/dist/packem_shared/ansi-parser-C5JuL732.js +0 -1
- package/dist/packem_shared/boxes-DyY_LXCi.js +0 -1
- package/dist/packem_shared/colorize-gy_cY-wC.js +0 -2
- package/dist/packem_shared/constants-D12jy2Zh-RSfxu1eM.js +0 -1
- package/dist/packem_shared/createInlineLoop-fhXU93QT.js +0 -2
- package/dist/packem_shared/createScreen-87XLHZq6.js +0 -3
- package/dist/packem_shared/dom-UWZI4lDM.js +0 -8
- package/dist/packem_shared/erase-DeDffywz.js +0 -1
- package/dist/packem_shared/get-string-width-CbMPWEJO.js +0 -1
- package/dist/packem_shared/index-LwZN2xbk.js +0 -75
- package/dist/packem_shared/index.d-Bk52cbgN.d.ts +0 -14
- package/dist/packem_shared/index.server.d-eZWyC2Ku.d.ts +0 -5
- package/dist/packem_shared/input.d-D-Yxqha8.d.ts +0 -172
- package/dist/packem_shared/measure-text-D-jVetsl.js +0 -3
- package/dist/packem_shared/mode-BOIU4Roy.js +0 -1
- package/dist/packem_shared/parseSgrMouse-DoBY7MKw.js +0 -1
- package/dist/packem_shared/processLayout-D2unRIYk.js +0 -1
- package/dist/packem_shared/render-Cn56QShB.js +0 -27
- package/dist/packem_shared/renderTreeToBuffer-LnGZkEUX.js +0 -2
- package/dist/packem_shared/renderer-DaPOmgCC.js +0 -17
- package/dist/packem_shared/setEnableStyledLineCache-Cke6_ZQt.js +0 -1
- package/dist/packem_shared/squashTextNodesWithMap-Cpqmc45i.js +0 -1
- package/dist/packem_shared/strip-C6HQYmlg.js +0 -1
- package/dist/packem_shared/text-width-CI9G0a-z.js +0 -2
- package/dist/packem_shared/utils-THUhYKG2.js +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var Be=Object.defineProperty;var D=(o,e)=>Be(o,"name",{value:e,configurable:!0});import{T as Oe,i as De}from"./dom-BG-LS10p.js";import{getStringWidth as Q,indent as Pe,isFullwidthCodePoint as We}from"@visulima/string";import{B as H,D as A,I,U as j,f as z,H as Y,g as q,h as ae,F as V,j as de,S as $e,k as He,p as Ae}from"./measure-text-DDjHT1jD.js";import T from"yoga-layout";import{j as F,i as Fe,m as ue,c as ce}from"./layout-BMo200nF.js";import{g as Ge,d as J}from"./colorize-DbTZMrJO.js";import Ie from"@visulima/colorize";import je from"cli-boxes";import{getScrollTop as Me}from"./getScrollHeight-ClEOyLHH.js";import Te from"./squashTextNodesWithMap-DCdi3SZ2.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
+
const ze=1114112;var Ye=Object.defineProperty,xe=D((o,e)=>Ye(o,"name",{value:e,configurable:!0}),"T$1");const qe=1,Ke=2,Xe=3,Ue=4,Ve=7,Je=8,Qe=9,he=22,ge=23,fe=24,pe=27,me=28,ye=29,be=39,ve=49,Ze="\x1B[",E=xe(o=>o.length===0?"":`${Ze}${o.join(";")}m`,"sgr"),et=xe(o=>{if(o.length===0)return"";let e="",t=0,r,n,s,i=!1,d=0;const g=o.getSpans();for(const f of g){const c=f.formatFlags&127,{fgColor:l}=f,{bgColor:a}=f,{link:h}=f,u=c;if(u!==t||l!==r||a!==n||h!==s){if(h!==s&&(s&&(e+=s.startsWith("ST:")?"\x1B]8;;\x1B\\":"\x1B]8;;\x07"),h)){const m=h.startsWith("ST:");e+=`\x1B]8;;${m?h.slice(3):h}${m?"\x1B\\":"\x07"}`}const p=t&(H|A),b=u&(H|A);if(p!==b){const m=t&H&&!(u&H),y=t&A&&!(u&A);(m||y)&&(e+=E([he])),u&H&&(!(t&H)||y)&&(e+=E([qe])),u&A&&(!(t&A)||m)&&(e+=E([Ke]))}u&I&&!(t&I)?e+=E([Xe]):!(u&I)&&t&I&&(e+=E([ge])),u&j&&!(t&j)?e+=E([Ue]):!(u&j)&&t&j&&(e+=E([fe])),u&z&&!(t&z)?e+=E([Ve]):!(u&z)&&t&z&&(e+=E([pe])),u&Y&&!(t&Y)?e+=E([Je]):!(u&Y)&&t&Y&&(e+=E([me])),u&q&&!(t&q)?e+=E([Qe]):!(u&q)&&t&q&&(e+=E([ye])),l!==r&&(e+=E(l?ae(l,!0):[be])),a!==n&&(e+=E(a?ae(a,!1):[ve])),i=u!==0||l!==void 0||a!==void 0,t=u,r=l,n=a,s=h}e+=o.getTextRange(d,d+f.length),d+=f.length}return i&&(t&(H|A)&&(e+=E([he])),t&I&&(e+=E([ge])),t&j&&(e+=E([fe])),t&z&&(e+=E([pe])),t&Y&&(e+=E([me])),t&q&&(e+=E([ye])),r!==void 0&&(e+=E([be])),n!==void 0&&(e+=E([ve]))),s&&(e+=s.startsWith("ST:")?"\x1B]8;;\x1B\\":"\x1B]8;;\x07"),e},"styledLineToString");var tt=Object.defineProperty,ke=D((o,e)=>tt(o,"name",{value:e,configurable:!0}),"v");class ee{static{D(this,"OutputCaches")}static{ke(this,"OutputCaches")}widths=new Map;blockWidths=new Map;styledLines=new Map;lines=new Map;maxEntries;pruneToFactor;constructor(e={}){const{maxEntries:t=3e4,pruneToFactor:r=.8}=e;this.maxEntries=Math.max(1,t),this.pruneToFactor=Math.min(.99,Math.max(.1,r))}getStyledLine(e){let t=this.styledLines.get(e);return t===void 0&&(t=this.hasAnsiControlMarker(e)?He(e):Ae(e),this.setCacheEntry(this.styledLines,e,t)),t}getStringWidth(e){let t=this.widths.get(e);return t===void 0&&(t=Q(e),this.setCacheEntry(this.widths,e,t)),t}getWidestLine(e){let t=this.blockWidths.get(e);if(t===void 0){let r=0;for(const n of this.getLines(e))r=Math.max(r,this.getStringWidth(n));t=r,this.setCacheEntry(this.blockWidths,e,t)}return t}getLines(e){let t=this.lines.get(e);return t===void 0&&(t=e.split(`
|
|
4
|
+
`),this.setCacheEntry(this.lines,e,t)),t}hasAnsiControlMarker(e){for(const t of e){const r=t.codePointAt(0);if(ot.has(r))return!0}return!1}setCacheEntry(e,t,r){!e.has(t)&&e.size>=this.maxEntries&&this.pruneCache(e),e.set(t,r)}pruneCache(e){const t=Math.floor(this.maxEntries*this.pruneToFactor);for(const r of e.keys())if(e.delete(r),e.size<=t)break}}const ot=new Set([27,144,152,155,157,158,159]),rt=.6,it=30;class te{static{D(this,"A")}static{ke(this,"Output")}width;height;caches;grid;clipStack=[];previousLines=[];previousRenderedLines=[];lineMemoizationEnabled=!0;memoizationProbeCountdown=0;constructor(e){const{caches:t,height:r,width:n}=e;this.width=Math.round(n),this.height=Math.round(r),this.caches=t??new ee,this.grid=this.createGrid(this.width,this.height)}reset(e,t){this.width=Math.round(e),this.height=Math.round(t),this.clipStack.length=0,this.grid=this.createGrid(this.width,this.height)}startChildRegion(e,t,r,n){const s=Math.round(e),i=Math.round(t);this.clipStack.push({x1:s,x2:s+Math.round(r),y1:i,y2:i+Math.round(n)})}endChildRegion(){this.clipStack.pop()}write(e,t,r,n){if(!r)return;const{transformers:s}=n,i=this.clipStack.at(-1),d=this.caches.getLines(r),g=s.length>0;for(const[f,c]of d.entries()){const l=t+f;if(l<0||l>=this.grid.length||i&&(l<i.y1||l>=i.y2))continue;let a=c;if(g)for(const m of s)a=m(a,f);if(a.length===0)continue;const h=this.grid[l],u=this.caches.getStyledLine(a);let p=e;const b=i?Math.min(i.x2,h.length):1/0;for(let m=0;m<u.length&&!(p>=b);m++){if(i&&(p<i.x1||p>=i.x2)){p++,u.getFullWidth(m)&&p++;continue}if(p>=0){p>=h.length&&h.ensureWidth(p+2);const y=u.getSpan(m),k=u.getFullWidth(m),w=(y?.formatFlags??0)|(k?V:0);h.setCharFast(p,u.getValue(m),w,y?.fgColor,y?.bgColor,y?.link),k&&(p++,p>=h.length&&h.ensureWidth(p+1),h.setCharFast(p,"",w&~V,y?.fgColor,y?.bgColor,y?.link))}p++}}}writeStyledLine(e,t,r){if(r.length===0||t<0||t>=this.grid.length)return;const n=this.clipStack.at(-1);n&&(t<n.y1||t>=n.y2)||this.writeStyledLineToRow(this.grid[t],e,r,this.width,n)}getRootLines(){return this.grid}getCurrentClip(){return this.clipStack.at(-1)}addRegionTree(e,t,r){for(let n=0;n<e.height;n++){const s=r+n;if(s<0||s>=this.grid.length)continue;const i=e.lines[n];if(!i)continue;const d=this.grid[s];for(let g=0;g<i.length;g++){const f=t+g;if(f<0||f>=d.length)continue;const c=i.getValue(g);(c!==" "||i.hasStyles(g))&&d.setCharFast(f,c,i.getFormatFlags(g),i.getFgColor(g),i.getBgColor(g),i.getLink(g))}}for(const n of e.children)this.addRegionTree(n,t+n.x,r+n.y)}writeStyledLineToRow(e,t,r,n,s){let i=t;const d=s?Math.min(s.x2,n):1/0;for(let g=0;g<r.length&&!(i>=d);g++){if(s&&(i<s.x1||i>=s.x2)){i++,r.getFullWidth(g)&&i++;continue}if(i>=0){i>=e.length&&e.ensureWidth(i+2);const f=r.getSpan(g),c=r.getFullWidth(g),l=(f?.formatFlags??0)|(c?V:0);e.setCharFast(i,r.getValue(g),l,f?.fgColor,f?.bgColor,f?.link),c&&(i++,i>=e.length&&e.ensureWidth(i+1),e.setCharFast(i,"",l&~V,f?.fgColor,f?.bgColor,f?.link))}i++}}get(){const e=this.grid;this.lineMemoizationEnabled||(this.memoizationProbeCountdown>0?this.memoizationProbeCountdown--:this.lineMemoizationEnabled=!0);const t=this.lineMemoizationEnabled,r=this.previousLines.length>0,n=t&&r&&this.previousLines.length===e.length&&this.previousRenderedLines.length===e.length;this.previousLines.length>e.length&&(this.previousLines.length=e.length),this.previousRenderedLines.length>e.length&&(this.previousRenderedLines.length=e.length);const s=Array.from({length:e.length});let i=0;for(const[d,g]of e.entries()){const f=g;if(n&&this.previousLines[d]?.equals(f)){s[d]=this.previousRenderedLines[d]??"";continue}i++;const c=f.trimEnd(),l=et(c);s[d]=l,t&&(this.previousRenderedLines[d]=l,this.previousLines[d]=f.clone())}return t&&n&&e.length>0&&i/e.length>rt&&this.disableLineMemoization(),{height:e.length,output:s.join(`
|
|
5
|
+
`)}}getBuffer(){const e=this.grid,t=e.length,r=new Uint32Array(this.width*t*2),n=65535;for(let s=0;s<r.length;s+=2)r[s]=32,r[s+1]=n;for(let s=0;s<t;s++){const i=e[s];for(let d=0;d<i.length&&d<this.width;d++){const g=i.getValue(d);if(g.length===0)continue;const f=g.codePointAt(0)??32,c=(s*this.width+d)*2,l=i.getSpan(d),a=l?.formatFlags??0,h=l?.fgColor,u=l?.bgColor,p=h?de(h):255,b=u?de(u):255,m=(a&255)<<16|(b&255)<<8|p&255;if(r[c]=f,r[c+1]=m,i.getFullWidth(d)&&d+1<this.width){const y=c+2;r[y]=ze,r[y+1]=m,d++}}}return{buffer:r,height:t}}createGrid(e,t){const r=[];for(let n=0;n<t;n++)r.push($e.empty(e));return r}disableLineMemoization(){this.lineMemoizationEnabled=!1,this.memoizationProbeCountdown=it,this.previousLines.length=0,this.previousRenderedLines.length=0}}var nt=Object.defineProperty,st=D((o,e)=>nt(o,"name",{value:e,configurable:!0}),"d");const lt=st(o=>Math.round(o.getComputedWidth()-Math.max(0,o.getComputedLeft()+o.getComputedWidth()-(o.getParent()?.getComputedWidth()??o.getComputedWidth()))-o.getComputedPadding(T.EDGE_LEFT)-o.getComputedPadding(T.EDGE_RIGHT)-o.getComputedBorder(T.EDGE_LEFT)-o.getComputedBorder(T.EDGE_RIGHT)),"getMaxWidth");var at=Object.defineProperty,dt=D((o,e)=>at(o,"name",{value:e,configurable:!0}),"c");const ut=dt((o,e,t,r)=>{if(!t.style.backgroundColor)return;const n=Math.round(t.yogaNode.getComputedWidth()),s=Math.round(t.yogaNode.getComputedHeight()),i=t.style.borderStyle&&t.style.borderLeft!==!1?1:0,d=t.style.borderStyle&&t.style.borderRight!==!1?1:0,g=t.style.borderStyle&&t.style.borderTop!==!1?1:0,f=t.style.borderStyle&&t.style.borderBottom!==!1?1:0,c=n-i-d,l=s-g-f;if(!(c>0&&l>0))return;const a=Ge(t.style.backgroundColor);if(!a)return;const h=`${a}${" ".repeat(c)}\x1B[49m`;for(let u=0;u<l;u++)r.write(o+i,e+g+u,h,{transformers:[]})},"renderBackground");var ct=Object.defineProperty,oe=D((o,e)=>ct(o,"name",{value:e,configurable:!0}),"T");const P=oe((o,e,t,r)=>{let n=J(o,e,"foreground");return n=J(n,t,"background"),r&&(n=Ie.dim(n)),n},"stylePiece"),Ce=oe((o,e,t,r,n,s,i,d)=>{if(!t&&!n)return P(o.repeat(e),s,i,d);const g=t?` ${t} `:"",f=n?` ${n} `:"",c=g.length,l=f.length,a=r??"left";if(c+l>=e){if(c>=e)return`${g.slice(0,e-1)}…`;const b=e-c;return b>3?g+f.slice(0,b):g+P(o.repeat(e-c),s,i,d)}const h=e-c-l;if(a==="left"||n)return g+P(o.repeat(h),s,i,d)+f;if(a==="right"){const b=e-c;return P(o.repeat(b),s,i,d)+g}const u=Math.floor(h/2),p=h-u;return P(o.repeat(u),s,i,d)+g+P(o.repeat(p),s,i,d)},"buildBorderWithTitle"),ht=oe((o,e,t,r)=>{if(t.style.borderStyle){const n=Math.round(t.yogaNode.getComputedWidth()),s=Math.round(t.yogaNode.getComputedHeight()),i=typeof t.style.borderStyle=="string"?je[t.style.borderStyle]:t.style.borderStyle,d=t.style.borderTopColor??t.style.borderColor,g=t.style.borderBottomColor??t.style.borderColor,f=t.style.borderLeftColor??t.style.borderColor,c=t.style.borderRightColor??t.style.borderColor,l=t.style.borderTopBackgroundColor??t.style.borderBackgroundColor,a=t.style.borderBottomBackgroundColor??t.style.borderBackgroundColor,h=t.style.borderLeftBackgroundColor??t.style.borderBackgroundColor,u=t.style.borderRightBackgroundColor??t.style.borderBackgroundColor,p=t.style.borderTopDimColor??t.style.borderDimColor,b=t.style.borderBottomDimColor??t.style.borderDimColor,m=t.style.borderLeftDimColor??t.style.borderDimColor,y=t.style.borderRightDimColor??t.style.borderDimColor,k=t.style.borderTop!==!1,w=t.style.borderBottom!==!1,B=t.style.borderLeft!==!1,W=t.style.borderRight!==!1,v=Math.max(0,n-(B?1:0)-(W?1:0));let M;if(k){const L=B?P(i.topLeft,d,l,p):"",O=W?P(i.topRight,d,l,p):"",R=Ce(i.top,v,t.style.borderTopTitle,t.style.borderTopTitleAlignment,t.style.borderTopRightTitle,d,l,p);M=L+R+O}let C=s;k&&(C-=1),w&&(C-=1),C=Math.max(0,C);let S="";B&&(S=`${P(i.left,f,h,m)}
|
|
6
|
+
`.repeat(C));let N="";W&&(N=`${P(i.right,c,u,y)}
|
|
7
|
+
`.repeat(C));let x;if(w){const L=B?P(i.bottomLeft,g,a,b):"",O=W?P(i.bottomRight,g,a,b):"",R=Ce(i.bottom,v,t.style.borderBottomTitle,t.style.borderBottomTitleAlignment,void 0,g,a,b);x=L+R+O}const _=k?1:0;M&&r.write(o,e,M,{transformers:[]}),S&&r.write(o,e+_,S,{transformers:[]}),N&&r.write(o+n-1,e+_,N,{transformers:[]}),x&&r.write(o,e+s-1,x,{transformers:[]})}},"renderBorder");var gt=Object.defineProperty,ft=D((o,e)=>gt(o,"name",{value:e,configurable:!0}),"m");const Ne=[],Se=ft(({axis:o,color:e,layout:t,output:r})=>{const{thumb:{end:n,endHalf:s,start:i,startHalf:d},x:g,y:f}=t;if(o==="vertical")for(let c=i;c<n;c++){let l="█";const a=2*c>=d&&2*c<s,h=2*c+1>=d&&2*c+1<s;a&&!h?l="▀":!a&&h&&(l="▄");const u=e?J(l,e,"foreground"):l;r.write(g,f+c,u,{transformers:Ne})}else for(let c=i;c<n;c++){let l="█";const a=2*c>=d&&2*c<s,h=2*c+1>=d&&2*c+1<s;a&&!h?l="▌":!a&&h&&(l="▐");const u=e?J(l,e,"foreground"):l;r.write(g+c,f,u,{transformers:Ne})}},"renderScrollbar");var pt=Object.defineProperty,re=D((o,e)=>pt(o,"name",{value:e,configurable:!0}),"b");const we=re((o,e=[])=>{for(const t of o.childNodes){if(t.nodeName==="#text")continue;const r=t;if(!r.internal_stickyAlternate)if(r.internal_sticky)e.push({node:r,type:r.internal_sticky==="bottom"?"bottom":"top"});else{const n=r.style.overflow??"visible",s=r.style.overflowX??n,i=r.style.overflowY??n;!(s==="scroll"||i==="scroll")&&r.childNodes&&we(r,e)}}return e},"getStickyDescendants"),mt=re((o,e,t,r)=>{let n,s=-1,i,d=-1;for(const[f,c]of o.entries()){const{node:l,type:a}=c;if(!l.yogaNode)continue;const h=F(l,e)??0,u=Math.round(l.yogaNode.getComputedHeight()),p=h+u,b=l.parentNode;let m=0,y=Number.MAX_SAFE_INTEGER;b?.yogaNode&&(m=F(b,e)??0,y=Math.round(b.yogaNode.getComputedHeight())),a==="top"&&h<t&&m+y>t&&(n=c,s=f),a==="bottom"&&Math.floor(p)>Math.floor(r)&&m<r&&(i=c,d=f)}const g=[];if(n){let f;for(let c=s+1;c<o.length;c++){const l=o[c];if(l.type!=="bottom"){f=l;break}}g.push({nextStickyNodeInfo:f,stickyNode:n.node,type:"top"})}if(i){let f;for(let c=d-1;c>=0;c--){const l=o[c];if(l.type==="bottom"){f=l;break}}g.push({nextStickyNodeInfo:f,stickyNode:i.node,type:"bottom"})}return g},"identifyActiveStickyNodes"),yt=re((o,e,t,r,n)=>{const{newTransformers:s,skipStaticElements:i,x:d,y:g}=n,{yogaNode:f}=e;if(!f)return;const c=f.getComputedBorder(T.EDGE_TOP),l=f.getComputedBorder(T.EDGE_LEFT),a=Me(e),h=e.internal_scrollState?.clientHeight??0;for(const{nextStickyNodeInfo:u,stickyNode:p,type:b}of o){if(!p.yogaNode)continue;const m=F(p,e)??0,y=Math.round(p.yogaNode.getComputedHeight()),k=d+(Fe(p,e)??0),w=p.parentNode;let B=0,W=Number.MAX_SAFE_INTEGER;w?.yogaNode&&(B=F(w,e)??0,W=Math.round(w.yogaNode.getComputedHeight()));let v;if(b==="top"){const S=w?.yogaNode?.getComputedBorder(T.EDGE_BOTTOM)??0,N=B+W-S;let x=g-a+N-y;const _=g-a+m,L=g+c;if(u?.node?.yogaNode){const O=F(u.node,e)??0,R=g-a+O-y;R<x&&(x=R)}v=Math.min(Math.max(L,_),x)}else{const S=w?.yogaNode?.getComputedBorder(T.EDGE_TOP)??0;let N=g-a+B+S;const x=g-a+m,_=g+c+h-y;if(u?.node?.yogaNode){const L=Math.round(u.node.yogaNode.getComputedHeight()),O=F(u.node,e)??0,R=g-a+O+L;R>N&&(N=R)}v=Math.max(Math.min(_,x),N)}const M=r({height:y,width:Math.round(p.yogaNode.getComputedWidth())});X(p,M,{offsetX:-Math.round(p.yogaNode.getComputedLeft()),offsetY:-Math.round(p.yogaNode.getComputedTop()),skipStaticElements:i,transformers:s});const C=M.get().output.split(`
|
|
8
|
+
`);for(const[S,N]of C.entries())N&&N.length>0&&t.write(k-(d+l),v-(g+c)+S,N,{transformers:[]})}},"renderActiveStickyNodes");var bt=Object.defineProperty,$=D((o,e)=>bt(o,"name",{value:e,configurable:!0}),"x");const vt=$((o,e)=>{const t=o.childNodes[0]?.yogaNode;if(t){const r=Math.round(t.getComputedLeft()),n=Math.round(t.getComputedTop());e=`
|
|
9
|
+
`.repeat(n)+Pe(e,r)}return e},"applyPaddingToText"),Ct=31,Nt=127,St=128,Et=159,Mt=$((o,e)=>{if(!Number.isFinite(e))return!1;if(e<0)return!0;let t=0;for(const r of o){if(r===`
|
|
10
|
+
`){if(t>e)return!0;t=0;continue}const n=r.codePointAt(0);if(n<=Ct||n===Nt||n>=St&&n<=Et||We(n)||(t++,t>e))return!0}return!1},"mightExceedWidth"),Tt=$(o=>(o.internal_hidden??!1)||o.yogaNode?.getDisplay()===T.DISPLAY_NONE,"isNodeHidden"),xt=$(o=>{let e=o;for(;e;){if(Tt(e))return!0;e=e.parentNode}return!1},"isNodeOrAncestorHidden"),Z=$((o,e={})=>{if(e.skipStaticElements&&o.internal_static||o.internal_hidden||o.internal_stickyAlternate||o.yogaNode?.getDisplay()===T.DISPLAY_NONE)return"";let t="";if(o.nodeName==="ink-text")t=Te(o);else if(o.nodeName==="ink-box"||o.nodeName==="ink-root"){const r=o.style.flexDirection==="row"||o.style.flexDirection==="row-reverse"?" ":`
|
|
11
|
+
`;t=(o.style.flexDirection==="row-reverse"||o.style.flexDirection==="column-reverse"?o.childNodes.toReversed():[...o.childNodes]).map(n=>Z(n,{parentRole:o.internal_accessibility?.role,skipStaticElements:e.skipStaticElements})).filter(Boolean).join(r)}if(o.internal_accessibility){const{role:r,state:n}=o.internal_accessibility;if(n){const s=Object.keys(n).filter(i=>n[i]).join(", ");s&&(t=`(${s}) ${t}`)}r&&r!==e.parentRole&&(t=`${r}: ${t}`)}return t},"renderNodeToScreenReaderOutput"),X=$((o,e,t)=>{const{absoluteOffsetX:r,absoluteOffsetY:n,offsetX:s=0,offsetY:i=0,renderState:d,selectionMap:g,skipStaticElements:f,transformers:c=[]}=t;if(f&&o.internal_static||o.internal_hidden)return;if(o.cachedRender){const a=Math.round(s+(o.yogaNode?.getComputedLeft()??0)),h=Math.round(i+(o.yogaNode?.getComputedTop()??0));e.addRegionTree(o.cachedRender,a,h);return}if(o.nodeName==="ink-cursor"){if(!d)return;d.cursorRequested=!0;const a=o.internal_cursor;if(!a){d.cursorPosition=void 0;return}if(a.inline){if(d.lastTextWriteEnd)d.cursorPosition={x:d.lastTextWriteEnd.x,y:d.lastTextWriteEnd.y};else{const p=o.parentNode?ue(o.parentNode):void 0;d.cursorPosition=p?{x:p.x,y:p.y}:void 0}return}const h=a.anchorRef?a.anchorRef.current:o.parentNode;if(!h){d.cursorPosition=void 0;return}if(a.anchorRef&&xt(h)){d.cursorPosition=void 0;return}const u=ue(h);if(!u){d.cursorPosition=void 0;return}d.cursorPosition={x:u.x+a.x,y:u.y+a.y};return}const{yogaNode:l}=o;if(l){if(l.getDisplay()===T.DISPLAY_NONE)return;const a=l.getComputedLeft(),h=l.getComputedTop(),u=Math.round(s+a),p=Math.round(i+h),b=Math.round((r??s)+a),m=Math.round((n??i)+h),y=e.getCurrentClip();if(y){const v=Math.round(l.getComputedWidth()),M=Math.round(l.getComputedHeight()),C=b+v,S=m+M,N=y.x1??-1/0,x=y.x2??1/0,_=y.y1??-1/0,L=y.y2??1/0;if(C<=N||b>=x||S<=_||m>=L)return}let k=c;if(typeof o.internal_transform=="function"&&(k=[o.internal_transform,...c]),o.nodeName==="ink-text"){let v=Te(o);if(v.length>0){const M=lt(l);if(Mt(v,M)&&Math.max(...v.split(`
|
|
12
|
+
`).map(C=>Q(C)))>M){const C=o.style.textWrap??"wrap";v=Oe(v,Math.floor(M),C)}if(v=vt(o,v),e.write(u,p,v,{transformers:k}),d){const C=v.split(`
|
|
13
|
+
`),S=C.at(-1)??"";d.lastTextWriteEnd={x:u+Q(S),y:p+C.length-1}}}return}let w=!1,B=0,W=0;if(o.nodeName==="ink-box"){ut(u,p,o,e),ht(u,p,o,e);const v=o.style.overflow??"visible",M=o.style.overflowX??v,C=o.style.overflowY??v,S=M==="hidden"||M==="scroll",N=C==="hidden"||C==="scroll";if(S||N){const x=Math.round(l.getComputedWidth()),_=Math.round(l.getComputedHeight()),L=S?u+l.getComputedBorder(T.EDGE_LEFT):u,O=S?x-l.getComputedBorder(T.EDGE_LEFT)-l.getComputedBorder(T.EDGE_RIGHT):x,R=N?p+l.getComputedBorder(T.EDGE_TOP):p,U=N?_-l.getComputedBorder(T.EDGE_TOP)-l.getComputedBorder(T.EDGE_BOTTOM):_;e.startChildRegion(L,R,Math.max(0,O),Math.max(0,U)),w=!0,C==="scroll"&&o.internal_scrollState&&(W=-o.internal_scrollState.scrollTop),M==="scroll"&&o.internal_scrollState&&(B=-o.internal_scrollState.scrollLeft)}}if(o.nodeName==="ink-root"||o.nodeName==="ink-box"||o.nodeName==="ink-static-render"){for(const v of o.childNodes)X(v,e,{absoluteOffsetX:b+B,absoluteOffsetY:m+W,offsetX:u+B,offsetY:p+W,renderState:d,selectionMap:g,skipStaticElements:f,transformers:k});if(o.nodeName==="ink-box"&&o.internal_scrollState){const v=we(o);if(v.length>0){const M=Me(o),C=o.internal_scrollState.clientHeight,S=M+C,N=mt(v,o,M,S);N.length>0&&yt(N,o,e,$(x=>new te(x),"createOutput"),{newTransformers:k,skipStaticElements:f,x:u,y:p})}}if(o.nodeName==="ink-box"&&o.internal_scrollState){const v=o.style.overflow??"visible",M=o.style.overflowX??v,C=o.style.overflowY??v,S=l.getComputedBorder(T.EDGE_LEFT),N=l.getComputedBorder(T.EDGE_RIGHT),x=l.getComputedBorder(T.EDGE_TOP),_=l.getComputedBorder(T.EDGE_BOTTOM),L=Math.round(l.getComputedWidth()-S-N),O=Math.round(l.getComputedHeight()-x-_),{clientHeight:R,clientWidth:U,scrollHeight:ie,scrollLeft:Le,scrollTop:Re,scrollWidth:ne}=o.internal_scrollState,se=C==="scroll"&&ie>R,_e=M==="scroll"&&ne>U,le=o.internal_scrollbar!==!1;if(se&&le){const G=ce({axis:"vertical",clientDimension:R,hasOppositeScrollbar:!1,height:O,marginBottom:0,marginRight:0,scrollDimension:ie,scrollPosition:Re,width:L,x:u+S,y:p+x});G&&Se({axis:"vertical",color:o.style.scrollbarThumbColor,layout:G,output:e})}if(_e&&le){const G=ce({axis:"horizontal",clientDimension:U,hasOppositeScrollbar:se,height:O,marginBottom:0,marginRight:0,scrollDimension:ne,scrollPosition:Le,width:L,x:u+S,y:p+x});G&&Se({axis:"horizontal",color:o.style.scrollbarThumbColor,layout:G,output:e})}}w&&e.endChildRegion()}}},"renderNodeToOutput"),zt=$((o,e)=>{if(!o.yogaNode)return;const t=Math.round(o.yogaNode.getComputedWidth()),r=Math.round(o.yogaNode.getComputedHeight());if(t<=0||r<=0)return;const{setCachedRender:n}=require("./dom"),s=new te({height:r,width:t});for(const d of o.childNodes)X(d,s,{skipStaticElements:e?.skipStaticElements??!1});const i={children:[],cursorPosition:void 0,height:r,id:o.internalId??"static",isScrollable:!1,lines:[...s.getRootLines()],selectableSpans:[],stickyHeaders:[],styledOutput:[...s.getRootLines()],width:t,x:0,y:0};n(o,i)},"renderToStatic");var kt=Object.defineProperty,K=D((o,e)=>kt(o,"name",{value:e,configurable:!0}),"N");const wt=K((o,e)=>{const t=new Map;if(e.rangeCount===0)return t;const r=e.getRangeAt(0),{endContainer:n,endOffset:s,startContainer:i,startOffset:d}=r;if(!i||!n)return t;let g=!1,f=!1;const c=K((a,h,u,p,b,m)=>{if(a.nodeName==="#text"){const{length:y}=a.nodeValue;i===a&&(b.value=!0,u.value=h.value+d),n===a&&(m.value=!0,p.value=h.value+s),h.value+=y}else if("childNodes"in a){for(const y of a.childNodes)a===i&&(b.value=!0,u.value=h.value),a===n&&(m.value=!0,p.value=h.value),c(y,h,u,p,b,m);a===i&&d===a.childNodes.length&&(b.value=!0,u.value=h.value),a===n&&s===a.childNodes.length&&(m.value=!0,p.value=h.value)}},"visitChildren"),l=K(a=>{if(a.nodeName==="ink-text"){if(!De(a))return;const h={value:0},u={value:-1},p={value:-1},b={value:!1},m={value:!1};for(const y of a.childNodes)a===i&&(b.value=!0,u.value=h.value),a===n&&(m.value=!0,p.value=h.value),c(y,h,u,p,b,m);if(a===i&&d===a.childNodes.length&&(b.value=!0,u.value=h.value),a===n&&s===a.childNodes.length&&(m.value=!0,p.value=h.value),(g||b.value)&&(!f||m.value)){const y=b.value?u.value:0,k=m.value?p.value:h.value;y!==-1&&k!==-1&&y<k&&t.set(a,{end:k,start:y})}b.value&&(g=!0),m.value&&(f=!0)}else{const{childNodes:h}=a;if(h){for(const u of h)a===i&&(g=!0),a===n&&(f=!0),l(u);a===i&&d===h.length&&(g=!0),a===n&&s===h.length&&(f=!0)}}},"visit");return l(o),t},"calculateSelectionMap"),Lt=new ee,Rt=new ee,_t=new WeakMap,Bt=new WeakMap,Ee=K(({caches:o,height:e,node:t,outputs:r,width:n})=>{let s=r.get(t);return s||(s=new te({caches:o,height:e,width:n}),r.set(t,s)),s.reset(n,e),s},"getReusableOutput"),Yt=K((o,e,t)=>{if(o.yogaNode){if(e){const f=Z(o,{skipStaticElements:!0}),c=f===""?0:f.split(`
|
|
14
|
+
`).length;let l="";return o.staticNode&&(l=Z(o.staticNode,{skipStaticElements:!1})),{cursorPosition:void 0,cursorRequested:!1,output:f,outputHeight:c,staticOutput:l?`${l}
|
|
15
|
+
`:""}}const r=t?.selection&&t.selection.rangeCount>0?wt(o,t.selection):void 0,n=Ee({caches:Lt,height:o.yogaNode.getComputedHeight(),node:o,outputs:_t,width:o.yogaNode.getComputedWidth()}),s={cursorPosition:void 0,cursorRequested:!1};X(o,n,{renderState:s,selectionMap:r,skipStaticElements:!0});let i;if(o.staticNode?.yogaNode&&(i=Ee({caches:Rt,height:o.staticNode.yogaNode.getComputedHeight(),node:o,outputs:Bt,width:o.staticNode.yogaNode.getComputedWidth()}),X(o.staticNode,i,{skipStaticElements:!1})),t?.useNativeRenderer){const{buffer:f,height:c}=n.getBuffer();return{cursorPosition:s.cursorPosition,cursorRequested:s.cursorRequested,output:"",outputBuffer:f,outputHeight:c,outputWidth:n.width,staticOutput:i?`${i.get().output}
|
|
16
|
+
`:""}}const{height:d,output:g}=n.get();return{cursorPosition:s.cursorPosition,cursorRequested:s.cursorRequested,output:g,outputHeight:d,staticOutput:i?`${i.get().output}
|
|
17
|
+
`:""}}return{cursorPosition:void 0,cursorRequested:!1,output:"",outputHeight:0,staticOutput:""}},"renderer");export{te as A,X as B,Yt as R,zt as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as DOMNode, S as StyledLine } from "./dom.d-CcFuBd-k.js";
|
|
2
2
|
/**
|
|
3
3
|
* Compare the document position of two points in the DOM tree.
|
|
4
4
|
* Returns -1 if A is before B, 0 if equal, 1 if A is after B.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"@visulima/string";import{c as i,a as s,e as l,i as n,m as d,s as r,b as c,l as h,d as y,t as S}from"./measure-text-DDjHT1jD.js";export{i as clearStringWidthCache,s as clearStyledLineCache,l as default,n as inkCharacterWidth,d as measureStyledLine,r as setEnableStyledLineCache,c as setStringWidthFunction,h as splitStyledLineByNewline,y as styledLineWidth,S as toStyledLine};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=Object.defineProperty;var u=(e,n)=>h(e,"name",{value:n,configurable:!0});import{h as m,t as x}from"./ansi-tokenizer-DqX9nJuk.js";var p=Object.defineProperty,d=u((e,n)=>p(e,"name",{value:n,configurable:!0}),"r");const v=/^[\d:;]*$/,N="\x1B]8;",g="8;",y=d(e=>e.startsWith(N)||e.startsWith(g),"isAllowedOsc"),_=d(e=>{if(!m(e))return e;let n="";for(const t of x(e)){if(t.type==="text"){n+=t.value;continue}if(t.type==="osc"&&y(t.value)){n+=t.value;continue}t.type==="csi"&&t.finalCharacter==="m"&&t.intermediateString===""&&v.test(t.parameterString)&&(n+=t.value)}return n},"sanitizeAnsi");var C=Object.defineProperty,f=u((e,n)=>C(e,"name",{value:n,configurable:!0}),"d");const k=f(e=>{let n="";for(let t=0;t<e.childNodes.length;t++){const a=e.childNodes[t];if(a===void 0)continue;let o="";a.nodeName==="#text"?o=a.nodeValue:((a.nodeName==="ink-text"||a.nodeName==="ink-virtual-text")&&(o=k(a)),o.length>0&&typeof a.internal_transform=="function"&&(o=a.internal_transform(o,t))),n+=o}return _(n)},"squashTextNodes"),b=f((e,n,t)=>{if(e.internal_textCache){const{map:s,text:r}=e.internal_textCache;for(const[i,l]of s.entries())n.set(i,{end:l.end+t.current,start:l.start+t.current});return t.current+=r.length,r}let a="";const o=new Map,c={current:0};for(let s=0;s<e.childNodes.length;s++){const r=e.childNodes[s];if(r===void 0)continue;let i="";const l=c.current;r.nodeName==="#text"?(i=r.nodeValue,o.set(r,{end:l+i.length,start:l}),c.current+=i.length):((r.nodeName==="ink-text"||r.nodeName==="ink-virtual-text")&&(i=b(r,o,c),o.set(r,{end:c.current,start:l})),i.length>0&&typeof r.internal_transform=="function"&&(i=r.internal_transform(i,s))),a+=i}e.internal_textCache={map:o,text:a};for(const[s,r]of o.entries())n.set(s,{end:r.end+t.current,start:r.start+t.current});return t.current+=a.length,a},"squashTextNodesWithMap");export{k as default,b as squashTextNodesWithMap};
|
|
@@ -1,103 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { Boxes, BoxStyle } from 'cli-boxes';
|
|
2
3
|
import { LiteralUnion } from 'type-fest';
|
|
3
4
|
import 'yoga-layout';
|
|
4
|
-
/**
|
|
5
|
-
Style of the box border.
|
|
6
|
-
*/
|
|
7
|
-
type BoxStyle = {
|
|
8
|
-
readonly topLeft: string;
|
|
9
|
-
readonly top: string;
|
|
10
|
-
readonly topRight: string;
|
|
11
|
-
readonly right: string;
|
|
12
|
-
readonly bottomRight: string;
|
|
13
|
-
readonly bottom: string;
|
|
14
|
-
readonly bottomLeft: string;
|
|
15
|
-
readonly left: string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
All box styles.
|
|
19
|
-
*/
|
|
20
|
-
type Boxes = {
|
|
21
|
-
/**
|
|
22
|
-
@example
|
|
23
|
-
```
|
|
24
|
-
┌────┐
|
|
25
|
-
│ │
|
|
26
|
-
└────┘
|
|
27
|
-
```
|
|
28
|
-
*/
|
|
29
|
-
readonly single: BoxStyle;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
@example
|
|
33
|
-
```
|
|
34
|
-
╔════╗
|
|
35
|
-
║ ║
|
|
36
|
-
╚════╝
|
|
37
|
-
```
|
|
38
|
-
*/
|
|
39
|
-
readonly double: BoxStyle;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
@example
|
|
43
|
-
```
|
|
44
|
-
╭────╮
|
|
45
|
-
│ │
|
|
46
|
-
╰────╯
|
|
47
|
-
```
|
|
48
|
-
*/
|
|
49
|
-
readonly round: BoxStyle;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
@example
|
|
53
|
-
```
|
|
54
|
-
┏━━━━┓
|
|
55
|
-
┃ ┃
|
|
56
|
-
┗━━━━┛
|
|
57
|
-
```
|
|
58
|
-
*/
|
|
59
|
-
readonly bold: BoxStyle;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
@example
|
|
63
|
-
```
|
|
64
|
-
╓────╖
|
|
65
|
-
║ ║
|
|
66
|
-
╙────╜
|
|
67
|
-
```
|
|
68
|
-
*/
|
|
69
|
-
readonly singleDouble: BoxStyle;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
@example
|
|
73
|
-
```
|
|
74
|
-
╒════╕
|
|
75
|
-
│ │
|
|
76
|
-
╘════╛
|
|
77
|
-
```
|
|
78
|
-
*/
|
|
79
|
-
readonly doubleSingle: BoxStyle;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
@example
|
|
83
|
-
```
|
|
84
|
-
+----+
|
|
85
|
-
| |
|
|
86
|
-
+----+
|
|
87
|
-
```
|
|
88
|
-
*/
|
|
89
|
-
readonly classic: BoxStyle;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
@example
|
|
93
|
-
```
|
|
94
|
-
↘↓↓↓↓↙
|
|
95
|
-
→ ←
|
|
96
|
-
↗↑↑↑↑↖
|
|
97
|
-
```
|
|
98
|
-
*/
|
|
99
|
-
readonly arrow: BoxStyle;
|
|
100
|
-
};
|
|
101
5
|
type Styles = {
|
|
102
6
|
/**
|
|
103
7
|
* It defines the alignment along the cross axis when there are multiple lines of flex items (when using flex-wrap).
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var m=Object.defineProperty;var o=(t,e)=>m(t,"name",{value:e,configurable:!0});import{getStringWidth as c}from"@visulima/string";var p=Object.defineProperty,u=o((t,e)=>p(t,"name",{value:e,configurable:!0}),"i");const d={ambiguousIsNarrow:!0,emojiWidth:1};function g(t){return Math.max(1,c(t,d))}o(g,"getCodePointWidth");u(g,"getCodePointWidth");function f(t){return c(t,d)}o(f,"getStringWidth");u(f,"getStringWidth");function h(t,e){if(e<=0)return 0;if(t.length===0)return 1;let i=1,r=0;for(const a of t){const n=Math.min(g(a),e);r+n>e&&(i++,r=0),r+=n}return i}o(h,"countWrappedRowsForLine");u(h,"countWrappedRowsForLine");function W(t,e){const i=t.split(`
|
|
2
|
+
`);let r=0,a=0;for(const n of i){const s=f(n);s>r&&(r=s),a+=e>0?h(n,e):0}return{maxLineWidth:r,wrappedRows:a}}o(W,"measureTextBlock");u(W,"measureTextBlock");export{f as a,g,W as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=Object.defineProperty;var s=(r,o)=>t(r,"name",{value:o,configurable:!0});import c from"terminal-size";var u=Object.defineProperty,i=s((r,o)=>u(r,"name",{value:o,configurable:!0}),"s");const l=i(r=>{const{columns:o,rows:e}=r;if(o&&e)return{columns:o,rows:e};const n=c();return{columns:o||n.columns||80,rows:e||n.rows||24}},"getWindowSize");export{l as g};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var y=Object.defineProperty;var p=(e,n)=>y(e,"name",{value:n,configurable:!0});import{S as V,d as m,i as h}from"./measure-text-
|
|
1
|
+
var y=Object.defineProperty;var p=(e,n)=>y(e,"name",{value:n,configurable:!0});import{S as V,d as m,i as h}from"./measure-text-DDjHT1jD.js";var b=Object.defineProperty,g=p((e,n)=>b(e,"name",{value:n,configurable:!0}),"g");const S=g((e,n,u="end")=>{if(n<1)return new V;if(m(e)<=n)return e;const r=new V;if(r.pushChar("…",0),n===1)return r;if(u==="start"){let t=0,s=e.length;for(let l=e.length-1;l>=0&&(t+=h(e.getValue(l)),!(t>n-1));l--)s=l;return r.combine(e.slice(s))}if(u==="middle"){const t=Math.ceil(n/2),s=n-t;let l=0,c=0;for(let i=0;i<e.length;i++){const d=h(e.getValue(i));if(c+d>t-1)break;c+=d,l=i+1}let a=e.length;c=0;for(let i=e.length-1;i>=0&&(c+=h(e.getValue(i)),!(c>s));i--)a=i;return e.slice(0,l).combine(r,e.slice(a))}let f=0,o=0;for(let t=0;t<e.length;t++){const s=h(e.getValue(t));if(o+s>n-1)break;o+=s,f=t+1}return e.slice(0,f).combine(r)},"truncateStyledLine"),w=g((e,n)=>{const u=[];let r=0,f=0,o=!0,t=0;for(;t<e.length;){const s=e.getValue(t);if(s===`
|
|
2
2
|
`){u.push(e.slice(r,t)),r=t+1,f=0,o=!0,t++;continue}let l=t,c=0;if(s===" ")c=h(" "),l=t+1;else for(;l<e.length&&e.getValue(l)!==" "&&e.getValue(l)!==`
|
|
3
3
|
`;)c+=h(e.getValue(l)),l++;if(f+c>n&&f>0){if(s===" "&&!o&&!e.hasStyles(t)){t=l;continue}let a=t;for(;a>r&&e.getValue(a-1)===" "&&!e.hasStyles(a-1);)a--;u.push(e.slice(r,a)),r=t,f=0;continue}if(f===0&&c>n){let a=t,i=0;for(;a<l;){const d=h(e.getValue(a));i+d>n&&i>0&&(u.push(e.slice(r,a)),r=a,i=0),i+=d,a++}f=i,t=l,o=!1}else f+=c,t=l,s!==" "&&(o=!1)}return(r<e.length||u.length===0)&&u.push(e.slice(r)),u},"wrapStyledLine"),v=g((e,n,u="wrap")=>{if(u.startsWith("truncate")){let r="end";return u==="truncate-middle"?r="middle":u==="truncate-start"&&(r="start"),[S(e,n,r)]}return w(e,n)},"wrapOrTruncateStyledLine");export{v as wrapOrTruncateStyledLine};
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { Context, RefObject, ReactNode } from 'react';
|
|
2
|
-
import { M as MouseEvent, T as TuiApp, c as InputParser, a as InlineOptions } from "../packem_shared/input.d-
|
|
2
|
+
import { M as MouseEvent, T as TuiApp, c as InputParser, a as InlineOptions } from "../packem_shared/input.d-CgxV2e8U.js";
|
|
3
3
|
import Yoga from 'yoga-layout';
|
|
4
|
+
import 'tseep';
|
|
4
5
|
interface DevToolsProps {
|
|
5
6
|
children: React.ReactNode;
|
|
6
7
|
/** Show/hide the HUD without unmounting (default: true) */
|
package/dist/react/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DevTools as o}from"../packem_shared/DevTools-
|
|
1
|
+
import{DevTools as o}from"../packem_shared/DevTools-ClAYpMVI.js";import{FocusContext as u,FocusProvider as s,useFocus as n,useFocusManager as p}from"../packem_shared/FocusContext-Xy0cwJpO.js";import{TuiContext as d,measureElement as f,useApp as l,useBoxMetrics as m,useCursor as a,useInput as i,useIsScreenReaderEnabled as S,useMouse as c,usePaste as T,useScrollable as C,useStderr as F,useStdin as I,useStdout as M,useTextInput as v,useTuiContext as y,useWindowSize as E}from"../packem_shared/TuiContext-BoJvG3NN.js";import{render as g,renderInline as A}from"../packem_shared/render-Dh7HMhK1.js";import{renderToString as D}from"../packem_shared/renderToString-BbQiRHrd.js";import{Static as N}from"../packem_shared/Static-DLynr5pn.js";import{LayoutNode as P}from"../packem_shared/LayoutNode-B8zej4dm.js";import{NAMED_COLORS as w,applyStyles as z,resolveColor as W}from"../packem_shared/NAMED_COLORS-B9fJsYdg.js";import{renderTreeToBuffer as h}from"../packem_shared/renderTreeToBuffer-CZilzyhN.js";export{o as DevTools,u as FocusContext,s as FocusProvider,P as LayoutNode,w as NAMED_COLORS,N as Static,d as TuiContext,z as applyStyles,f as measureElement,g as render,A as renderInline,D as renderToString,h as renderTreeToBuffer,W as resolveColor,l as useApp,m as useBoxMetrics,a as useCursor,n as useFocus,p as useFocusManager,i as useInput,S as useIsScreenReaderEnabled,c as useMouse,T as usePaste,C as useScrollable,F as useStderr,I as useStdin,M as useStdout,v as useTextInput,y as useTuiContext,E as useWindowSize};
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { R as RenderOptions } from "../packem_shared/render.d-
|
|
3
|
-
import "../packem_shared/dom.d-
|
|
2
|
+
import { R as RenderOptions } from "../packem_shared/render.d-B1kiO3Ca.js";
|
|
3
|
+
import "../packem_shared/dom.d-CcFuBd-k.js";
|
|
4
4
|
import 'yoga-layout';
|
|
5
|
+
import '@visulima/colorize';
|
|
6
|
+
import 'cli-boxes';
|
|
5
7
|
import 'type-fest';
|
|
6
|
-
import "../packem_shared/styles.d-
|
|
7
|
-
import "../packem_shared/index.server.d-eZWyC2Ku.js";
|
|
8
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
8
9
|
import 'node:stream';
|
|
9
10
|
import "../packem_shared/cursor-helpers.d-BIvqz0TZ.js";
|
|
10
11
|
declare const KEY: {
|
package/dist/testing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var w=Object.defineProperty;var a=(t,e)=>w(t,"name",{value:e,configurable:!0});import{createRequire as F}from"node:module";import x from"../packem_shared/render-
|
|
1
|
+
var w=Object.defineProperty;var a=(t,e)=>w(t,"name",{value:e,configurable:!0});import{createRequire as F}from"node:module";import x from"../packem_shared/render-bdbSzkJo.js";import{createKeySender as y}from"../packem_shared/KEY-Bk8B-3h_.js";import{KEY as $}from"../packem_shared/KEY-Bk8B-3h_.js";import{createScreen as T}from"../packem_shared/createScreen-CrLrxA6t.js";import{waitFor as j}from"../packem_shared/waitFor-Dj5zfL5s.js";const b=F(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=a(t=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,i]=o.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return o.getBuiltinModule(t)}return b(t)},"__cjs_getBuiltinModule"),l=v("node:events");var R=Object.defineProperty,r=a((t,e)=>R(t,"name",{value:e,configurable:!0}),"t");class S extends l{static{a(this,"v")}static{r(this,"Stdout")}columns;_lastFrame;_frames=[];constructor(e=100){super(),this.columns=e}get frames(){return this._frames}lastFrame(){return this._lastFrame}write=r(e=>(this._frames.push(e),this._lastFrame=e,!0),"write")}class D extends l{static{a(this,"x")}static{r(this,"Stderr")}columns;_lastFrame;_frames=[];constructor(e=100){super(),this.columns=e}get frames(){return this._frames}lastFrame(){return this._lastFrame}write=r(e=>(this._frames.push(e),this._lastFrame=e,!0),"write")}class P extends l{static{a(this,"R")}static{r(this,"Stdin")}isTTY=!0;pendingData;write=r(e=>(this.pendingData=e,this.emit("readable"),this.emit("data",e),!0),"write");read(){const{pendingData:e}=this;return this.pendingData=void 0,e}setEncoding(){return this}setRawMode(){return this}resume(){return this}pause(){return this}ref(){return this}unref(){return this}}const c=[],O=r((t,e={})=>{const{columns:i,options:p}=e,n=new S(i),d=new D(i),m=new P,u=x(t,{debug:!0,exitOnCtrlC:!1,patchConsole:!1,stderr:d,stdin:m,stdout:n,...p});c.push(u);const f=T(()=>n.lastFrame(),n.frames),h=y(s=>m.write(s)),_=r(async()=>{await new Promise(s=>{setTimeout(s,0)}),await new Promise(s=>{setTimeout(s,0)})},"flush");return{cleanup:u.cleanup,flush:_,get frames(){return n.frames},keys:h,lastFrame:r(()=>n.lastFrame(),"lastFrame"),rerender:u.rerender,screen:f,stderr:d,stdin:m,stdout:n,unmount:u.unmount,async waitFor(s,g){await j(s,()=>f.text(),g)}}},"testRender"),Y=r(()=>{for(const t of c)t.cleanup();c.length=0},"cleanup");export{$ as KEY,Y as cleanup,y as createKeySender,T as createScreen,O as render,j as waitFor};
|