@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import { LiteralUnion } from 'type-fest';
|
|
4
4
|
type ApprovalRisk = "high" | "low" | "medium";
|
package/dist/components/box.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ReactNode, PropsWithChildren, RefAttributes, ForwardRefExoticComponent } from 'react';
|
|
2
2
|
import { Except } from 'type-fest';
|
|
3
|
-
import {
|
|
4
|
-
import { S as Styles } from "../packem_shared/styles.d-
|
|
3
|
+
import { a as DOMElement } from "../packem_shared/dom.d-CcFuBd-k.js";
|
|
4
|
+
import { S as Styles } from "../packem_shared/styles.d-cMo36xQz.js";
|
|
5
5
|
import 'yoga-layout';
|
|
6
|
-
import
|
|
6
|
+
import '@visulima/colorize';
|
|
7
|
+
import 'cli-boxes';
|
|
7
8
|
type Props = Except<Styles, "textWrap"> & {
|
|
8
9
|
/**
|
|
9
10
|
* Hide the element from screen readers.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import { LiteralUnion } from 'type-fest';
|
|
4
4
|
type ButtonVariant = "ghost" | "outline" | "primary" | "secondary";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var O=Object.defineProperty;var S=(r,e)=>O(r,"name",{value:e,configurable:!0});import{jsx as D}from"react/jsx-runtime";import{useRef as P,useMemo as z,Fragment as H}from"react";import{d as I}from"../packem_shared/colorize-
|
|
1
|
+
var O=Object.defineProperty;var S=(r,e)=>O(r,"name",{value:e,configurable:!0});import{jsx as D}from"react/jsx-runtime";import{useRef as P,useMemo as z,Fragment as H}from"react";import{d as I}from"../packem_shared/colorize-DbTZMrJO.js";import{Box as V}from"./box.js";import{Text as _}from"./text.js";var E=Object.defineProperty,m=S((r,e)=>E(r,"name",{value:e,configurable:!0}),"u$1");const j=Math.trunc(1),F=2,R=32,q=0,G=m(()=>{const r=new Map,e=[void 0];return{decode:m(l=>e[l],"decode"),encode:m(l=>{if(l===void 0)return q;const u=typeof l=="number"?`n:${l}`:`s:${l}`,h=r.get(u);if(h!==void 0)return h;const y=e.length;return e.push(l),r.set(u,y),y},"encode")}},"createColorCoders"),$=[9601,9602,9603,9604,9605,9606,9607,9608],k=[9615,9614,9613,9612,9611,9610,9609,9608],T=9608,J=m(r=>{if(!r)return 0;let e=0;return r.bold&&(e|=j),r.dim&&(e|=F),e},"flagsFromStyle"),U=m(r=>typeof r=="number"?r:r.codePointAt(0)??R,"toCodepoint"),K=m((r,e)=>{const l=Math.max(0,r*e),u=new Uint32Array(l),h=new Uint32Array(l),y=new Int32Array(l),p=new Int32Array(l),v=new Uint8Array(e),{decode:x,encode:g}=G();u.fill(R);const C=m(o=>{o>=0&&o<e&&(v[o]=1)},"markDirty"),w=m((o,n,c,i)=>{if(o<0||o>=r||n<0||n>=e)return;const t=n*r+o,d=U(c),s=g(i?.color),a=g(i?.background),f=J(i);u[t]===d&&h[t]===f&&y[t]===s&&p[t]===a||(u[t]=d,h[t]=f,y[t]=s,p[t]=a,v[n]=1)},"setCellImpl");return{bg:p,chars:u,colorDecoder:x,context:{clear:m(()=>{u.fill(R),h.fill(0),y.fill(0),p.fill(0),v.fill(1)},"clear"),drawHBar:m((o,n,c,i,t)=>{if(c<=0||n<0||n>=e)return;const d=Math.max(0,Math.min(1,i)),s=c*k.length,a=Math.round(d*s),f=Math.floor(a/k.length),M=a%k.length;for(let b=0;b<c;b+=1){const B=o+b;b<f?w(B,n,T,t):b===f&&M>0?w(B,n,k[M-1],t):w(B,n,R,t)}C(n)},"drawHBar"),drawRect:m((o,n,c,i,t,d)=>{if(c<=0||i<=0)return;const s=U(t);for(let a=0;a<i;a+=1){for(let f=0;f<c;f+=1)w(o+f,n+a,s,d);C(n+a)}},"drawRect"),drawText:m((o,n,c,i)=>{if(n<0||n>=e||c.length===0)return;let t=0;for(const d of c)w(o+t,n,d,i),t+=1;C(n)},"drawText"),drawVBar:m((o,n,c,i,t)=>{if(c<=0||o<0||o>=r)return;const d=Math.max(0,Math.min(1,i)),s=c*$.length,a=Math.round(d*s),f=Math.floor(a/$.length),M=a%$.length;for(let b=0;b<c;b+=1){const B=c-b-1,A=n+b;B<f?w(o,A,T,t):B===f&&M>0?w(o,A,$[M-1],t):w(o,A,R,t),C(A)}},"drawVBar"),height:e,setCell:w,width:r},dirty:v,fg:y,height:e,styles:h,width:r}},"createCanvasBuffer"),L=m((r,e)=>{const{bg:l,chars:u,colorDecoder:h,fg:y,styles:p,width:v}=r,x=e*v;let g="",C=0,w=p[x],o=y[x],n=l[x];const c=m(i=>{let t="";for(let f=C;f<i;f+=1)t+=String.fromCodePoint(u[x+f]);const d=h(o),s=h(n);let a=t;d!==void 0&&(a=I(a,typeof d=="number"?String(d):d,"foreground")),s!==void 0&&(a=I(a,typeof s=="number"?String(s):s,"background")),(w&j)!==0&&(a=`\x1B[1m${a}\x1B[22m`),(w&F)!==0&&(a=`\x1B[2m${a}\x1B[22m`),g+=a},"flush");for(let i=1;i<v;i+=1){const t=p[x+i],d=y[x+i],s=l[x+i];(t!==w||d!==o||s!==n)&&(c(i),C=i,w=t,o=d,n=s)}return c(v),g},"serializeRow");var N=Object.defineProperty,Q=S((r,e)=>N(r,"name",{value:e,configurable:!0}),"u");function W({draw:r,height:e,version:l,width:u}){const h=P(void 0),y=P(void 0);(h.current?.width!==u||h.current.height!==e)&&(h.current=K(u,e),y.current={hasRendered:!1,lines:Array.from({length:e}).fill("")});const p=h.current,v=y.current,x=z(()=>{r(p.context);for(let g=0;g<p.height;g+=1)v.hasRendered&&p.dirty[g]===0||(v.lines[g]=L(p,g),p.dirty[g]=0);return v.hasRendered=!0,[...v.lines]},[l,u,e]);return D(V,{flexDirection:"column",flexShrink:0,height:e,width:u,children:x.map((g,C)=>D(H,{children:D(_,{wrap:"truncate-end",children:g})},C))})}S(W,"d");Q(W,"Canvas");export{W as Canvas,W as default};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { ReactNode, Ref } from 'react';
|
|
2
2
|
import { BoxProps as Props } from "./box.js";
|
|
3
3
|
import 'type-fest';
|
|
4
|
-
import "../packem_shared/dom.d-
|
|
4
|
+
import "../packem_shared/dom.d-CcFuBd-k.js";
|
|
5
5
|
import 'yoga-layout';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import '@visulima/colorize';
|
|
7
|
+
import 'cli-boxes';
|
|
8
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
8
9
|
interface ControlledScrollViewProps extends Props {
|
|
9
10
|
children?: ReactNode;
|
|
10
11
|
debug?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as r}from"../packem_shared/controlled-scroll-view-
|
|
1
|
+
import{C as r}from"../packem_shared/controlled-scroll-view-CcUS50jx.js";export{r as ControlledScrollView};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { RefObject } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { a as DOMElement } from "../packem_shared/dom.d-CcFuBd-k.js";
|
|
3
3
|
import 'yoga-layout';
|
|
4
|
+
import '@visulima/colorize';
|
|
5
|
+
import 'cli-boxes';
|
|
4
6
|
import 'type-fest';
|
|
5
|
-
import "../packem_shared/styles.d-
|
|
6
|
-
import "../packem_shared/index.server.d-eZWyC2Ku.js";
|
|
7
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
7
8
|
type Props = {
|
|
8
9
|
/**
|
|
9
10
|
* Optional reference to anchor cursor coordinates to a different element.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
2
|
import 'type-fest';
|
|
3
3
|
import 'yoga-layout';
|
|
4
|
+
import '@visulima/colorize';
|
|
5
|
+
import 'cli-boxes';
|
|
4
6
|
import { b as ScrollViewRef } from "../packem_shared/scroll-view.d-DtpsgHLg.js";
|
|
5
7
|
import "./box.js";
|
|
6
|
-
import "../packem_shared/dom.d-
|
|
7
|
-
import "../packem_shared/styles.d-
|
|
8
|
-
import "../packem_shared/index.server.d-eZWyC2Ku.js";
|
|
8
|
+
import "../packem_shared/dom.d-CcFuBd-k.js";
|
|
9
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
9
10
|
type Props = {
|
|
10
11
|
/**
|
|
11
12
|
* Background color for the dialog. Defaults to the detected terminal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var M=Object.defineProperty;var f=(l,r)=>M(l,"name",{value:r,configurable:!0});import{jsx as o,jsxs as X}from"react/jsx-runtime";import{useRef as H}from"react";import I from"../ink/hooks/use-terminal-palette.js";import R from"../ink/hooks/use-window-size.js";import{Box as e}from"./box.js";import{Text as T}from"./text.js";import{ScrollView as V}from"../packem_shared/ScrollView-
|
|
1
|
+
var M=Object.defineProperty;var f=(l,r)=>M(l,"name",{value:r,configurable:!0});import{jsx as o,jsxs as X}from"react/jsx-runtime";import{useRef as H}from"react";import I from"../ink/hooks/use-terminal-palette.js";import R from"../ink/hooks/use-window-size.js";import{Box as e}from"./box.js";import{Text as T}from"./text.js";import{ScrollView as V}from"../packem_shared/ScrollView-DKZ8OM-m.js";var Y=Object.defineProperty,q=f((l,r)=>Y(l,"name",{value:r,configurable:!0}),"b");const F=q(({backgroundColor:l,borderColor:r="cyan",borderStyle:g="round",children:b,columns:h,footer:d,maxHeight:n=.8,paddingX:i=2,paddingY:p=1,rows:x,scrollbarStyle:k="block",scrollRef:y,title:t,visible:C=!0,width:S=60})=>{const c=R(),{isLoading:w,palette:D}=I(),j=H(null),v=y??j;if(!C)return null;const m=h??(c.columns||80),a=x??(c.rows||24),s=l??(w?"black":D?.background??"black"),B=n<=1?Math.floor(a*n):Math.min(n,a-2),u=typeof t=="string"?o(e,{marginBottom:1,children:o(T,{bold:!0,color:r,children:t})}):t??null;return o(e,{alignItems:"center",height:a,justifyContent:"center",position:"absolute",width:m,children:X(e,{backgroundColor:s,borderBackgroundColor:s,borderColor:r,borderStyle:g,flexDirection:"column",maxHeight:B,opaque:!0,paddingY:p,width:Math.min(S,m-4),children:[u!=null&&o(e,{flexShrink:0,paddingX:i,children:u}),o(V,{flexGrow:1,flexShrink:1,paddingX:i,ref:v,scrollbar:!0,scrollbarColor:r,scrollbarStyle:k,children:b}),d!=null&&o(e,{alignItems:"center",flexDirection:"column",flexShrink:0,marginTop:1,paddingX:i,children:d})]})})},"Dialog");export{F as Dialog,F as default};
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
+
import { multilineGradient } from '@visulima/colorize/gradient';
|
|
1
2
|
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
type ColorValueHex = `#${string}`;
|
|
3
|
-
type CssColorName = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
4
|
-
type StopInput = {
|
|
5
|
-
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
6
|
-
colorLess?: boolean;
|
|
7
|
-
position: number;
|
|
8
|
-
};
|
|
9
|
-
type RGB = {
|
|
10
|
-
b: number;
|
|
11
|
-
g: number;
|
|
12
|
-
r: number;
|
|
13
|
-
};
|
|
14
|
-
declare const multilineGradient: (stops: (ColorValueHex | CssColorName | RGB | StopInput | [number, number, number])[], options?: {
|
|
15
|
-
hsvSpin?: "long" | "short";
|
|
16
|
-
interpolation?: "hsv" | "rgb";
|
|
17
|
-
loop?: boolean;
|
|
18
|
-
reverse?: boolean;
|
|
19
|
-
}) => (string_: string) => string;
|
|
20
3
|
/**
|
|
21
4
|
* A color stop for the gradient — hex string, CSS color name, RGB tuple, RGB object, or positioned stop.
|
|
22
5
|
*/
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)&&(n=n.replace(/(\r*\n)/g,`${o.closeStack}$1${o.openStack}`)),o.openStack+n+o.closeStack},"wrapText"),K=x(({props:e},{close:r,open:o})=>{const n=(e?.openStack??"")+o,t=r+(e?.closeStack??""),s=x((i,...u)=>Qe(i,u,s.props),"style");return Object.setPrototypeOf(s,D),s.props={close:r,closeStack:t,open:o,openStack:n,props:e},s.open=n,s.close=t,s},"createStyle"),Ue=x(function(){const e=x(r=>String(r),"self");e.strip=r=>r.replaceAll(A(),"");for(const r in _)O[r]={get(){const o=K(this,_[r]);return Object.defineProperty(this,r,{value:o}),o}};for(const r in X)O[r]={get(){const o=K(this,X[r]);return Object.defineProperty(this,r,{value:o}),o}};return D=Object.defineProperties({},O),Object.setPrototypeOf(e,D),e},"Colorize");for(const e in ee)O[e]={get(){return(...r)=>K(this,ee[e](...r))}};O.ansi256=O.fg;O.bgAnsi256=O.bg;var Xe=Object.defineProperty,de=$((e,r)=>Xe(e,"name",{value:r,configurable:!0}),"y$1"),_e=Object.defineProperty,j=de((e,r)=>_e(e,"name",{value:r,configurable:!0}),"u");const re={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};var er=Object.defineProperty,rr=j((e,r)=>er(e,"name",{value:r,configurable:!0}),"i");const oe=rr((e,r)=>{const o=e.length;if(r=Number.parseInt(r.toString(),10),Number.isNaN(r)||r<2)throw new Error("Invalid number of steps (< 2)");if(r<o)throw new Error("Number of steps cannot be inferior to number of stops");const n=[];for(let s=1;s<o;s+=1){const i=(r-1)*(e[s].position-e[s-1].position);n.push(Math.max(1,Math.round(i)))}let t=1;for(let s=o-2;s>=0;s-=1)t+=n[s];for(;t!==r;)if(t<r){const s=Math.min(...n),i=n.indexOf(s);n[i]=n[i]+1,t+=1}else{const s=Math.max(...n),i=n.indexOf(s);n[i]=n[i]-1,t-=1}return n},"computeSubSteps");var or=Object.defineProperty,tr=j((e,r)=>or(e,"name",{value:r,configurable:!0}),"c$1");const nr=tr((e,r,o)=>{let n=0,t=0,s=0;const i=Math.floor(e/60),u=e/60-i,c=o*(1-r),h=o*(1-u*r),l=o*(1-(1-u)*r);return i%6===0?(n=o,t=l,s=c):i%6===1?(n=h,t=o,s=c):i%6===2?(n=c,t=o,s=l):i%6===3?(n=c,t=h,s=o):i%6===4?(n=l,t=c,s=o):i%6===5&&(n=o,t=c,s=h),{b:Math.round(s*255),g:Math.round(t*255),r:Math.round(n*255)}},"hsvToRgb");var sr=Object.defineProperty,te=j((e,r)=>sr(e,"name",{value:r,configurable:!0}),"b");const ne=te(({b:e,g:r,r:o})=>{let n,t,s,i=0,u=0;o/=255,r/=255,e/=255;const c=Math.max(o,r,e),h=c-Math.min(o,r,e),l=te(p=>(c-p)/6/h+1/2,"diffc");return h!==0&&(u=h/c,n=l(o),t=l(r),s=l(e),c===o?i=s-t:c===r?i=.3333333333333333+n-s:c===e&&(i=.6666666666666666+t-n),i<0?i+=1:i>1&&(i-=1)),{h:i*360,s:u,v:c}},"rgbToHsv");var ir=Object.defineProperty,T=j((e,r)=>ir(e,"name",{value:r,configurable:!0}),"c");const ar={b:256,g:256,r:256},lr={h:360,s:1,v:1},me=T((e,r,o)=>{const n={};for(const t in e)Object.hasOwn(e,t)&&(n[t]=o===0?0:(r[t]-e[t])/o);return n},"calculateStepSize"),ve=T((e,r,o,n)=>{const t={};for(const s in r)if(Object.hasOwn(r,s)){let i=e[s]*o+r[s];i<0?i+=n[s]:n[s]!==1&&(i%=n[s]),t[s]=i}return t},"interpolate"),Y=T((e,r,o)=>{const n={b:e.color[2],g:e.color[1],r:e.color[0]},t={b:r.color[2],g:r.color[1],r:r.color[0]},s=me(n,t,o),i=[{...n}];for(let u=1;u<o;u+=1){const c=ve(s,n,u,ar);i.push({b:Math.floor(c.b),g:Math.floor(c.g),r:Math.floor(c.r)})}return i},"interpolateRgb"),se=T((e,r,o,n)=>{const t=ne({b:e.color[2],g:e.color[1],r:e.color[0]}),s=ne({b:r.color[2],g:r.color[1],r:r.color[0]});if(t.s===0||s.s===0)return Y(e,r,o);let i;if(typeof n=="boolean")i=n;else{const l=t.h<s.h&&s.h-t.h<180||t.h>s.h&&t.h-s.h>180;i=n==="long"&&l||n==="short"&&!l}const u=me(t,s,o),c=[{b:e.color[2],g:e.color[1],r:e.color[0]}];let h;t.h<=s.h&&!i||t.h>=s.h&&i?h=s.h-t.h:i?h=360-s.h+t.h:h=360-t.h+s.h,u.h=(-1)**(i?1:0)*Math.abs(h)/o;for(let l=1;l<o;l+=1){const p=ve(u,t,l,lr);c.push(nr(p.h,p.s,p.v))}return c},"interpolateHsv");var cr=Object.defineProperty,ur=j((e,r)=>cr(e,"name",{value:r,configurable:!0}),"d");class P{static{$(this,"f")}static{de(this,"v")}static{j(this,"GradientBuilder")}static{ur(this,"GradientBuilder")}#e;stops;constructor(r,o){if(this.#e=r,this.stops=[],o.length<2)throw new Error("Invalid number of stops (< 2)");const n=o[0].position!==void 0;let t=o.length,s=-1,i=!1;for(const[h,l]of o.entries()){let p;const w=l.position!==void 0;if(n!==w)throw new Error("Cannot mix positioned and non-positioned color stops");if(w){const f=l,g=f.color!==void 0;if(!g&&(i||h===0||h===t-1))throw new Error("Cannot define two consecutive position-only stops");i=!g;let v;if(g&&(Array.isArray(f.color)?v=f.color:typeof f.color=="string"?v=f.color.includes("#")?I(f.color):re[f.color]:f.color&&"r"in f.color&&"g"in f.color&&"b"in f.color&&(v=[f.color.r,f.color.g,f.color.b])),p={color:v,colorLess:!g,position:f.position},p.position<0||p.position>1)throw new Error("Color stops positions must be between 0 and 1");if(p.position<s)throw new Error("Color stops positions are not ordered");s=p.position}else if(Array.isArray(l))p={color:l,position:h/(t-1)};else if(typeof l=="string")p={color:l.includes("#")?I(l):re[l],position:h/(t-1)};else if(l?.r!==void 0&&l?.g!==void 0&&l?.b!==void 0)p={color:[l.r,l.g,l.b],position:h/(t-1)};else throw new Error("Invalid color stop");this.stops.push(p)}const u=this.stops[0];u.position!==0&&(this.stops.unshift({color:u.color,position:0}),t+=1);const c=this.stops[t-1];c.position!==1&&this.stops.push({color:c.color,position:1})}reverse(){const r=[];for(const o of this.stops){const n={...o,position:1-o.position};r.push(n)}return new P(this.#e,r.toReversed())}loop(){const r=[],o=[];for(const n of this.stops)r.push({color:n.color,position:(n.position||0)/2});for(const n of this.stops.slice(0,-1))o.push({color:n.color,position:1-(n.position||0)/2});return new P(this.#e,[...r,...o.toReversed()])}rgb(r){const o=oe(this.stops,r),n=[];this.stops.forEach((t,s)=>{if(t.colorLess){const i=Y(this.stops[s-1],this.stops[s+1],2);t.color=[i[1].r,i[1].g,i[1].b]}});for(let t=0,s=this.stops.length;t<s-1;t+=1){const i=Y(this.stops[t],this.stops[t+1],o[t]);n.splice(n.length,0,...i.map(u=>this.#e.rgb(u.r,u.g,u.b)))}return n.push(this.#e.rgb(...this.stops.at(-1).color)),n}hsv(r,o=!1){const n=oe(this.stops,r),t=[];this.stops.forEach((s,i)=>{if(s.colorLess){const u=se(this.stops[i-1],this.stops[i+1],2,o);s.color=[u[1].r,u[1].g,u[1].b]}});for(let s=0,i=this.stops.length;s<i-1;s+=1){const u=se(this.stops[s],this.stops[s+1],n[s],o);t.splice(t.length,0,...u.map(c=>this.#e.rgb(c.r,c.g,c.b)))}return t.push(this.#e.rgb(...this.stops.at(-1).color)),t}}var hr=Object.defineProperty,gr=$((e,r)=>hr(e,"name",{value:r,configurable:!0}),"u"),pr=Object.defineProperty,fr=gr((e,r)=>pr(e,"name",{value:r,configurable:!0}),"u"),br=Object.defineProperty,ye=fr((e,r)=>br(e,"name",{value:r,configurable:!0}),"h");const we=new Ue,dr=/\s/g,$e=/\s/;ye((e,r)=>{const{hsvSpin:o="short",interpolation:n="rgb"}=r??{};let t=new P(we,e);return r?.loop?t=t.loop():r?.reverse&&(t=t.reverse()),s=>{const i=s.replaceAll(dr,""),u=Math.max(i.length,t.stops.length),c=n==="rgb"?t.rgb(u):t.hsv(u,o);let h="";for(const l of s)if($e.test(l))h+=l;else{const p=c.shift();h+=p(l)}return h}},"gradient");const ie=ye((e,r)=>{const{hsvSpin:o="short",interpolation:n="rgb"}=r??{};let t=new P(we,e);return r?.loop?t=t.loop():r?.reverse&&(t=t.reverse()),s=>{const i=s.split(`
|
|
3
|
-
`),u=Reflect.apply(Math.max,void 0,[...i.map(l=>l.length),t.stops.length]),c=n==="rgb"?t.rgb(u):t.hsv(u,o),h=[];for(const l of i){const p=[...c];let w="";for(const f of l)w+=$e.test(f)?f:p.shift()(f);h.push(w)}return h.join(`
|
|
4
|
-
`)}},"multilineGradient");var mr=Object.defineProperty,y=$((e,r)=>mr(e,"name",{value:r,configurable:!0}),"o");const ae={atlas:{colors:["#feac5e","#c779d0","#4bc0c8"]},cristal:{colors:["#bdfff3","#4ac29a"]},fruit:{colors:["#ff4e50","#f9d423"]},instagram:{colors:["#833ab4","#fd1d1d","#fcb045"]},mind:{colors:["#473b7b","#3584a7","#30d2be"]},morning:{colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},passion:{colors:["#f43b47","#453a94"]},pastel:{colors:["#74ebd5","#74ecd5"],options:{hsvSpin:"long",interpolation:"hsv"}},rainbow:{colors:["#ff0000","#ff0100"],options:{hsvSpin:"long",interpolation:"hsv"}},retro:{colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"]},summer:{colors:["#fdbb2d","#22c1c3"]},teen:{colors:["#77a1d3","#79cbca","#e684ae"]},vice:{colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}}},le=y(e=>{let r=!1;const o=y(n=>{q.forEach(n,t=>{if(r||!he(t))return;if(t.type===ge){r=!0;return}const s=t.props;Object.hasOwn(s,"children")&&o(s.children)})},"search");return o(e),r},"containsBoxDescendant"),ce=y(e=>Object.hasOwn(e,"children"),"hasChildrenProp"),ue=y(e=>typeof e=="string"||typeof e=="number","isPlainTextNode"),vr=y(e=>e==null||typeof e=="boolean","isNonRenderableChild");function yr({children:e,colors:r,name:o}){if(o&&r)throw new Error("The `name` and `colors` props are mutually exclusive");if(!o&&!r)throw new Error("Either `name` or `colors` prop must be provided");const n=Se(()=>o?ie(ae[o].colors,ae[o].options):ie(r??[]),[o,r]),t=y(u=>n(Be(u)),"applyGradient"),s=q.count(e);if(ue(e))return S(G,{transform:t,children:e});if(s===1&&!le(e))return S(G,{transform:t,children:e});const i=y(u=>{const c=[];let h="",l=0;const p=y(()=>{const g=`gradient-node-${String(l)}`;return l+=1,g},"createKey"),w=y((g,v)=>{c.push(S(G,{transform:t,children:g},v))},"pushTransformed"),f=y(()=>{if(h==="")return;const g=h;h="",w(S(W,{children:g}),p())},"flushText");return q.forEach(u,g=>{if(!vr(g)){if(ue(g)){h+=String(g);return}if(f(),he(g)){const v=g.key??p(),M=g.props;if(g.type===W){w(g,v);return}if(g.type===ge){if(ce(M)){const E=M.children;c.push(C(g,{key:v},i(E)));return}c.push(C(g,{key:v}));return}if(ce(M)){const E=M.children;if(!le(E)){w(g,v);return}c.push(C(g,{key:v},i(E)));return}w(g,v);return}c.push(g)}}),f(),c},"applyGradientToChildren");return S(Oe,{children:i(e)})}$(yr,"K");y(yr,"Gradient");export{yr as Gradient,yr as default};
|
|
1
|
+
var D=Object.defineProperty;var y=(o,e)=>D(o,"name",{value:e,configurable:!0});import{jsx as c,Fragment as K}from"react/jsx-runtime";import{strip as N}from"@visulima/ansi";import{multilineGradient as G}from"@visulima/colorize/gradient";import{useMemo as F,Children as x,isValidElement as P,cloneElement as v}from"react";import{Box as B}from"./box.js";import{Text as O}from"./text.js";import{Transform as g}from"./transform.js";var M=Object.defineProperty,n=y((o,e)=>M(o,"name",{value:e,configurable:!0}),"o");const k={atlas:{colors:["#feac5e","#c779d0","#4bc0c8"]},cristal:{colors:["#bdfff3","#4ac29a"]},fruit:{colors:["#ff4e50","#f9d423"]},instagram:{colors:["#833ab4","#fd1d1d","#fcb045"]},mind:{colors:["#473b7b","#3584a7","#30d2be"]},morning:{colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},passion:{colors:["#f43b47","#453a94"]},pastel:{colors:["#74ebd5","#74ecd5"],options:{hsvSpin:"long",interpolation:"hsv"}},rainbow:{colors:["#ff0000","#ff0100"],options:{hsvSpin:"long",interpolation:"hsv"}},retro:{colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"]},summer:{colors:["#fdbb2d","#22c1c3"]},teen:{colors:["#77a1d3","#79cbca","#e684ae"]},vice:{colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}}},C=n(o=>{let e=!1;const t=n(h=>{x.forEach(h,s=>{if(e||!P(s))return;if(s.type===B){e=!0;return}const f=s.props;Object.hasOwn(f,"children")&&t(f.children)})},"search");return t(o),e},"containsBoxDescendant"),j=n(o=>Object.hasOwn(o,"children"),"hasChildrenProp"),S=n(o=>typeof o=="string"||typeof o=="number","isPlainTextNode"),R=n(o=>o==null||typeof o=="boolean","isNonRenderableChild");function V({children:o,colors:e,name:t}){if(t&&e)throw new Error("The `name` and `colors` props are mutually exclusive");if(!t&&!e)throw new Error("Either `name` or `colors` prop must be provided");const h=F(()=>t?G(k[t].colors,k[t].options):G(e??[]),[t,e]),s=n(b=>h(N(b)),"applyGradient"),f=x.count(o);if(S(o))return c(g,{transform:s,children:o});if(f===1&&!C(o))return c(g,{transform:s,children:o});const m=n(b=>{const a=[];let l="",w=0;const E=n(()=>{const r=`gradient-node-${String(w)}`;return w+=1,r},"createKey"),p=n((r,i)=>{a.push(c(g,{transform:s,children:r},i))},"pushTransformed"),T=n(()=>{if(l==="")return;const r=l;l="",p(c(O,{children:r}),E())},"flushText");return x.forEach(b,r=>{if(!R(r)){if(S(r)){l+=String(r);return}if(T(),P(r)){const i=r.key??E(),d=r.props;if(r.type===O){p(r,i);return}if(r.type===B){if(j(d)){const u=d.children;a.push(v(r,{key:i},m(u)));return}a.push(v(r,{key:i}));return}if(j(d)){const u=d.children;if(!C(u)){p(r,i);return}a.push(v(r,{key:i},m(u)));return}p(r,i);return}a.push(r)}}),T(),a},"applyGradientToChildren");return c(K,{children:m(o)})}y(V,"K");n(V,"Gradient");export{V as Gradient,V as default};
|
package/dist/components/kbd.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
3
|
import { LiteralUnion } from 'type-fest';
|
|
4
4
|
import { C as CanvasContext } from "../packem_shared/buffer.d-EJkZr8uH.js";
|
package/dist/components/link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a=Object.defineProperty;var o=(r,e)=>a(r,"name",{value:e,configurable:!0});import{jsx as u}from"react/jsx-runtime";import{hyperlink as f}from"@visulima/ansi";import{useCallback as l}from"react";import{Text as m}from"./text.js";import{Transform as R}from"./transform.js";var v=Object.defineProperty,i=o((r,e)=>v(r,"name",{value:e,configurable:!0}),"s");let p;const d=i(()=>{if(!process.stdout.isTTY)return!1;const r=process.env.TERM_PROGRAM??"",e=process.env.TERM_PROGRAM_VERSION??"";if(r==="iTerm.app")return Number.parseInt(e.split(".")[0]??"0",10)>=3;if(r==="WezTerm"||r==="ghostty")return!0;if(r==="vscode"){const s=e.split("."),n=Number.parseInt(s[0]??"0",10),c=Number.parseInt(s[1]??"0",10);return n>1||n===1&&c>=72}if(process.env.WT_SESSION)return!0;const t=process.env.VTE_VERSION;if(t){const s=Number.parseInt(t,10);return s>=5e3&&s!==5e3}return!1},"detectHyperlinkSupport"),E=i(()=>process.env.FORCE_HYPERLINK?process.env.FORCE_HYPERLINK!=="0":(p!==void 0||(p=d()),p),"supportsHyperlinks");function T({children:r,fallback:e=!0,url:t}){const s=l(n=>E()?f(n,t):e===!1?n:typeof e=="function"?e(n,t):`${n} ${t}`,[e,t]);return u(R,{transform:s,children:u(m,{children:r})})}o(T,"u");i(T,"Link");export{T as Link,T as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { SpinnerName } from '@visulima/spinner';
|
|
3
3
|
import { ReactNode, ReactElement } from 'react';
|
|
4
4
|
import { LiteralUnion } from 'type-fest';
|
|
5
5
|
type Props = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import { LiteralUnion } from 'type-fest';
|
|
4
4
|
type MessageRole = "assistant" | "system" | "tool" | "user";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { Props as Props$1 } from "./text.js";
|
|
3
|
-
import
|
|
3
|
+
import '@visulima/colorize';
|
|
4
4
|
import 'type-fest';
|
|
5
|
-
import "../packem_shared/styles.d-
|
|
5
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
6
|
+
import 'cli-boxes';
|
|
6
7
|
import 'yoga-layout';
|
|
7
8
|
type Props = {
|
|
8
9
|
/** Fill glyph repeated across the completed portion of the progress bar. Defaults to "█". */
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BoxProps as Props } from "./box.js";
|
|
3
3
|
import 'type-fest';
|
|
4
|
-
import "../packem_shared/dom.d-
|
|
4
|
+
import "../packem_shared/dom.d-CcFuBd-k.js";
|
|
5
5
|
import 'yoga-layout';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import '@visulima/colorize';
|
|
7
|
+
import 'cli-boxes';
|
|
8
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
8
9
|
interface ScrollBarBoxProps extends Props {
|
|
9
10
|
children?: React.ReactNode;
|
|
10
11
|
contentHeight: number;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BoxProps as Props } from "./box.js";
|
|
3
3
|
import 'type-fest';
|
|
4
|
-
import "../packem_shared/dom.d-
|
|
4
|
+
import "../packem_shared/dom.d-CcFuBd-k.js";
|
|
5
5
|
import 'yoga-layout';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import '@visulima/colorize';
|
|
7
|
+
import 'cli-boxes';
|
|
8
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
8
9
|
type ScrollBarPlacement = "inset" | "left" | "right";
|
|
9
10
|
type ScrollBarStyle = Props["borderStyle"] | "block" | "line" | "thick" | "dots";
|
|
10
11
|
interface ScrollBarProps {
|
|
@@ -2,10 +2,11 @@ import React, { Ref } from 'react';
|
|
|
2
2
|
import { a as ScrollViewProps, b as ScrollViewRef } from "../packem_shared/scroll-view.d-DtpsgHLg.js";
|
|
3
3
|
import "./box.js";
|
|
4
4
|
import 'type-fest';
|
|
5
|
-
import "../packem_shared/dom.d-
|
|
5
|
+
import "../packem_shared/dom.d-CcFuBd-k.js";
|
|
6
6
|
import 'yoga-layout';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import '@visulima/colorize';
|
|
8
|
+
import 'cli-boxes';
|
|
9
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
9
10
|
type ScrollAlignment = "auto" | "bottom" | "center" | "top";
|
|
10
11
|
interface ScrollListProps extends ScrollViewProps {
|
|
11
12
|
readonly scrollAlignment?: ScrollAlignment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ScrollList as l}from"../packem_shared/ScrollList-
|
|
1
|
+
import{ScrollList as l}from"../packem_shared/ScrollList-C7nZ9ufK.js";export{l as ScrollList};
|
|
@@ -2,7 +2,8 @@ export { S as ScrollView, type a as ScrollViewProps, type b as ScrollViewRef } f
|
|
|
2
2
|
import 'react';
|
|
3
3
|
import "./box.js";
|
|
4
4
|
import 'type-fest';
|
|
5
|
-
import "../packem_shared/dom.d-
|
|
5
|
+
import "../packem_shared/dom.d-CcFuBd-k.js";
|
|
6
6
|
import 'yoga-layout';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import '@visulima/colorize';
|
|
8
|
+
import 'cli-boxes';
|
|
9
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ScrollView as e}from"../packem_shared/ScrollView-
|
|
1
|
+
import{ScrollView as e}from"../packem_shared/ScrollView-DKZ8OM-m.js";export{e as ScrollView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
2
|
import { FC, ReactElement } from 'react';
|
|
3
3
|
import { LiteralUnion } from 'type-fest';
|
|
4
4
|
import { Props as Props$1 } from "./select-input-indicator.js";
|