@visulima/tui 1.0.0-alpha.21 → 1.0.0-alpha.22
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 +17 -0
- package/dist/components/box.d.ts +1 -1
- package/dist/components/controlled-scroll-view.d.ts +1 -1
- package/dist/components/cursor.d.ts +1 -1
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/scroll-bar-box.d.ts +1 -1
- package/dist/components/scroll-bar.d.ts +1 -1
- package/dist/components/scroll-list.d.ts +1 -1
- package/dist/components/scroll-view.d.ts +1 -1
- package/dist/components/static-render.d.ts +1 -1
- package/dist/components/tree-view-entry.d.ts +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +1 -1
- 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 +1 -1
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-text-selection.d.ts +2 -2
- package/dist/ink/hooks/use-text-selection.js +1 -1
- package/dist/ink/index.d.ts +4 -4
- package/dist/ink/index.js +1 -1
- package/dist/packem_shared/{comparePoints-YxQfR_zq.js → comparePoints-C3NJirbh.js} +1 -1
- package/dist/packem_shared/{dom-BG-LS10p.js → dom-CXB-19sK.js} +1 -1
- package/dist/packem_shared/{dom.d-C1IxuLJ9.d.ts → dom.d-DzUPFLuP.d.ts} +1 -1
- package/dist/packem_shared/{getPathToRoot-D5Hns9Er.js → getPathToRoot-BuAM_kmj.js} +1 -1
- package/dist/packem_shared/{measure-text-DDjHT1jD.js → measure-text-Ce2widM1.js} +3 -3
- package/dist/packem_shared/{reconciler-CUbhOvcr.js → reconciler-DYE5h4K4.js} +1 -1
- package/dist/packem_shared/{render-BFio00DS.js → render-BRR1ESvR.js} +9 -9
- package/dist/packem_shared/{render.d-DuyG0zip.d.ts → render.d-E2MsoY_g.d.ts} +1 -1
- package/dist/packem_shared/{renderToString-SDrrFvu8.js → renderToString-vEQyGmv6.js} +1 -1
- package/dist/packem_shared/renderer-maLLQcut.js +17 -0
- package/dist/packem_shared/{selection.d-Dbha5bMS.d.ts → selection.d-FWD8cYY2.d.ts} +1 -1
- package/dist/packem_shared/setEnableStyledLineCache-DSbMbENc.js +1 -0
- package/dist/packem_shared/{wrapOrTruncateStyledLine-BZ00SM8i.js → wrapOrTruncateStyledLine-C5rcIrNb.js} +1 -1
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +1 -1
- package/index.js +52 -52
- package/package.json +15 -15
- package/dist/packem_shared/renderer-DG986Pcr.js +0 -17
- package/dist/packem_shared/setEnableStyledLineCache-D2gZbwFM.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## @visulima/tui [1.0.0-alpha.22](https://github.com/visulima/visulima/compare/@visulima/tui@1.0.0-alpha.21...@visulima/tui@1.0.0-alpha.22) (2026-06-04)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **tui:** 2 bug fixes + 2 perf ([53eb884](https://github.com/visulima/visulima/commit/53eb884de4609e6fb2c0ed8af7773673c0b83b2f))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
* **@visulima/ansi:** upgraded to 4.0.0-alpha.16
|
|
11
|
+
* **@visulima/colorize:** upgraded to 2.0.0-alpha.13
|
|
12
|
+
* **@visulima/error:** upgraded to 6.0.0-alpha.32
|
|
13
|
+
* **@visulima/spinner:** upgraded to 1.0.0-alpha.3
|
|
14
|
+
* **@visulima/string:** upgraded to 3.0.0-alpha.15
|
|
15
|
+
* **@visulima/boxen:** upgraded to 3.0.0-alpha.12
|
|
16
|
+
* **@visulima/tabular:** upgraded to 4.0.0-alpha.13
|
|
17
|
+
|
|
1
18
|
## @visulima/tui [1.0.0-alpha.21](https://github.com/visulima/visulima/compare/@visulima/tui@1.0.0-alpha.20...@visulima/tui@1.0.0-alpha.21) (2026-06-02)
|
|
2
19
|
|
|
3
20
|
### Miscellaneous Chores
|
package/dist/components/box.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, PropsWithChildren, RefAttributes, ForwardRefExoticComponent } from 'react';
|
|
2
2
|
import { Except } from 'type-fest';
|
|
3
|
-
import {
|
|
3
|
+
import { a as DOMElement } from "../packem_shared/dom.d-DzUPFLuP.js";
|
|
4
4
|
import { S as Styles } from "../packem_shared/styles.d-cMo36xQz.js";
|
|
5
5
|
import 'yoga-layout';
|
|
6
6
|
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
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-DzUPFLuP.js";
|
|
5
5
|
import 'yoga-layout';
|
|
6
6
|
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
7
7
|
import '@visulima/colorize';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { RefObject } from 'react';
|
|
2
2
|
import { C as CursorShape } from "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
3
|
-
import {
|
|
3
|
+
import { a as DOMElement } from "../packem_shared/dom.d-DzUPFLuP.js";
|
|
4
4
|
import 'yoga-layout';
|
|
5
5
|
import '@visulima/colorize';
|
|
6
6
|
import 'cli-boxes';
|
|
@@ -5,7 +5,7 @@ import 'cli-boxes';
|
|
|
5
5
|
import { b as ScrollViewRef } from "../packem_shared/scroll-view.d-DtpsgHLg.js";
|
|
6
6
|
import "./box.js";
|
|
7
7
|
import 'type-fest';
|
|
8
|
-
import "../packem_shared/dom.d-
|
|
8
|
+
import "../packem_shared/dom.d-DzUPFLuP.js";
|
|
9
9
|
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
10
10
|
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
11
11
|
type Props = {
|
|
@@ -1,7 +1,7 @@
|
|
|
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-DzUPFLuP.js";
|
|
5
5
|
import 'yoga-layout';
|
|
6
6
|
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
7
7
|
import '@visulima/colorize';
|
|
@@ -1,7 +1,7 @@
|
|
|
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-DzUPFLuP.js";
|
|
5
5
|
import 'yoga-layout';
|
|
6
6
|
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
7
7
|
import '@visulima/colorize';
|
|
@@ -2,7 +2,7 @@ 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-DzUPFLuP.js";
|
|
6
6
|
import 'yoga-layout';
|
|
7
7
|
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
8
8
|
import '@visulima/colorize';
|
|
@@ -2,7 +2,7 @@ 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-DzUPFLuP.js";
|
|
6
6
|
import 'yoga-layout';
|
|
7
7
|
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
8
8
|
import '@visulima/colorize';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode, DependencyList } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { a as DOMElement } from "../packem_shared/dom.d-DzUPFLuP.js";
|
|
3
3
|
import { S as Styles } from "../packem_shared/styles.d-cMo36xQz.js";
|
|
4
4
|
import 'yoga-layout';
|
|
5
5
|
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
@@ -2,7 +2,7 @@ import { BoxProps as Props$1 } from "./box.js";
|
|
|
2
2
|
import { Props as Props$2 } from "./text.js";
|
|
3
3
|
import { ReactNode, ReactElement } from 'react';
|
|
4
4
|
import 'type-fest';
|
|
5
|
-
import "../packem_shared/dom.d-
|
|
5
|
+
import "../packem_shared/dom.d-DzUPFLuP.js";
|
|
6
6
|
import 'yoga-layout';
|
|
7
7
|
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
8
8
|
import '@visulima/colorize';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { a as DOMElement } from "../../packem_shared/dom.d-DzUPFLuP.js";
|
|
3
3
|
import 'yoga-layout';
|
|
4
4
|
import "../../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
5
5
|
import '@visulima/colorize';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var p=Object.defineProperty;var n=(t,r)=>p(t,"name",{value:r,configurable:!0});import{useState as s,useCallback as m,useEffect as i,useMemo as g}from"react";import{a as N}from"../../packem_shared/dom-
|
|
1
|
+
var p=Object.defineProperty;var n=(t,r)=>p(t,"name",{value:r,configurable:!0});import{useState as s,useCallback as m,useEffect as i,useMemo as g}from"react";import{a as N}from"../../packem_shared/dom-CXB-19sK.js";var v=Object.defineProperty,f=n((t,r)=>v(t,"name",{value:r,configurable:!0}),"n");const d={height:0,left:0,top:0,width:0},c=f(t=>{if(t)return t.parentNode?c(t.parentNode):t.nodeName==="ink-root"?t:void 0},"findRootNode"),w=f(t=>{const[r,h]=s(d),[a,l]=s(!1),u=m(()=>{const e=t.current?.yogaNode?.getComputedLayout()??d;h(o=>o.width!==e.width||o.height!==e.height||o.left!==e.left||o.top!==e.top?e:o),l(!!t.current)},[t]);return i(u),i(()=>{const e=c(t.current);if(e)return N(e,u)}),g(()=>({...r,hasMeasured:a}),[r,a])},"useBoxMetrics");export{w as default,w as useBoxMetrics};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var K=Object.defineProperty;var m=(e,r)=>K(e,"name",{value:r,configurable:!0});import{createRequire as S}from"node:module";import{useRef as I,useEffectEvent as $,useEffect as w}from"react";import{IMECompositionBuffer as q,isIMEInput as j}from"../../packem_shared/IMECompositionBuffer-C89PhiOu.js";import{kittyModifiers as u}from"../../packem_shared/kittyFlags-C3rZLbcK.js";import{L as x}from"../../packem_shared/reconciler-
|
|
1
|
+
var K=Object.defineProperty;var m=(e,r)=>K(e,"name",{value:r,configurable:!0});import{createRequire as S}from"node:module";import{useRef as I,useEffectEvent as $,useEffect as w}from"react";import{IMECompositionBuffer as q,isIMEInput as j}from"../../packem_shared/IMECompositionBuffer-C89PhiOu.js";import{kittyModifiers as u}from"../../packem_shared/kittyFlags-C3rZLbcK.js";import{L as x}from"../../packem_shared/reconciler-DYE5h4K4.js";import{useStdinContext as N}from"./use-stdin.js";const _=S(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=m(e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[r,s]=h.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return h.getBuiltinModule(e)}return _(e)},"__cjs_getBuiltinModule"),{Buffer:M}=E("node:buffer");var T=Object.defineProperty,c=m((e,r)=>T(e,"name",{value:r,configurable:!0}),"i");const D=/^\u001B([a-z0-9])$/i,R=/^\u001B+([ON[]|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,C={"[1~":"home","[2$":"insert","[2^":"insert","[2~":"insert","[3$":"delete","[3^":"delete","[3~":"delete","[4~":"end","[5$":"pageup","[5^":"pageup","[5~":"pageup","[6$":"pagedown","[6^":"pagedown","[6~":"pagedown","[7$":"home","[7^":"home","[7~":"home","[8$":"end","[8^":"end","[8~":"end","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[[5~":"pageup","[[6~":"pagedown","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[A":"up","[a":"up","[B":"down","[b":"down","[C":"right","[c":"right","[D":"left","[d":"left","[E":"clear","[e":"clear","[F":"end","[H":"home","[P":"f1","[Q":"f2","[R":"f3","[S":"f4","[Z":"tab",OA:"up",Oa:"up",OB:"down",Ob:"down",OC:"right",Oc:"right",OD:"left",Od:"left",OE:"clear",Oe:"clear",OF:"end",OH:"home",OP:"f1",OQ:"f2",OR:"f3",OS:"f4"},Z=[...Object.values(C),"backspace"],F=c(e=>["[2$","[3$","[5$","[6$","[7$","[8$","[a","[b","[c","[d","[e","[Z"].includes(e),"isShiftKey"),U=c(e=>["[2^","[3^","[5^","[6^","[7^","[8^","Oa","Ob","Oc","Od","Oe"].includes(e),"isCtrlKey"),P=/^\u001B\[(\d+)(?:;(\d+)(?::(\d+))?(?:;([\d:]+))?)?u$/,z=/^\u001B\[(\d+);(\d+):(\d+)([A-Z~])$/i,H={A:"up",B:"down",C:"right",D:"left",E:"clear",F:"end",H:"home",P:"f1",Q:"f2",R:"f3",S:"f4"},Q={2:"insert",3:"delete",5:"pageup",6:"pagedown",7:"home",8:"end",11:"f1",12:"f2",13:"f3",14:"f4",15:"f5",17:"f6",18:"f7",19:"f8",20:"f9",21:"f10",23:"f11",24:"f12"},A={8:"backspace",9:"tab",27:"escape",127:"backspace",57358:"capslock",57359:"scrolllock",57360:"numlock",57361:"printscreen",57362:"pause",57363:"menu",57376:"f13",57377:"f14",57378:"f15",57379:"f16",57380:"f17",57381:"f18",57382:"f19",57383:"f20",57384:"f21",57385:"f22",57386:"f23",57387:"f24",57388:"f25",57389:"f26",57390:"f27",57391:"f28",57392:"f29",57393:"f30",57394:"f31",57395:"f32",57396:"f33",57397:"f34",57398:"f35",57399:"kp0",57400:"kp1",57401:"kp2",57402:"kp3",57403:"kp4",57404:"kp5",57405:"kp6",57406:"kp7",57407:"kp8",57408:"kp9",57409:"kpdecimal",57410:"kpdivide",57411:"kpmultiply",57412:"kpsubtract",57413:"kpadd",57414:"kpenter",57415:"kpequal",57416:"kpseparator",57417:"kpleft",57418:"kpright",57419:"kpup",57420:"kpdown",57421:"kppageup",57422:"kppagedown",57423:"kphome",57424:"kpend",57425:"kpinsert",57426:"kpdelete",57427:"kpbegin",57428:"mediaplay",57429:"mediapause",57430:"mediaplaypause",57431:"mediareverse",57432:"mediastop",57433:"mediafastforward",57434:"mediarewind",57435:"mediatracknext",57436:"mediatrackprevious",57437:"mediarecord",57438:"lowervolume",57439:"raisevolume",57440:"mutevolume",57441:"leftshift",57442:"leftcontrol",57443:"leftalt",57444:"leftsuper",57445:"lefthyper",57446:"leftmeta",57447:"rightshift",57448:"rightcontrol",57449:"rightalt",57450:"rightsuper",57451:"righthyper",57452:"rightmeta",57453:"isoLevel3Shift",57454:"isoLevel5Shift"},L=c(e=>e>=0&&e<=1114111&&!(e>=55296&&e<=57343),"isValidCodepoint"),y=c(e=>L(e)?String.fromCodePoint(e):"?","safeFromCodePoint");function B(e){return e===3?"release":e===2?"repeat":"press"}m(B,"k");c(B,"resolveEventType");function O(e){return{capsLock:!!(e&u.capsLock),ctrl:!!(e&u.ctrl),hyper:!!(e&u.hyper),meta:!!(e&u.meta),numLock:!!(e&u.numLock),option:!!(e&u.alt),shift:!!(e&u.shift),super:!!(e&u.super)}}m(O,"h");c(O,"parseKittyModifiers");const V=c(e=>{const r=P.exec(e);if(!r)return null;const s=Number.parseInt(r[1],10),p=r[2]?Math.max(0,Number.parseInt(r[2],10)-1):0,t=r[3]?Number.parseInt(r[3],10):1,l=r[4];if(!L(s))return null;let n;l&&(n=l.split(":").map(k=>y(Number.parseInt(k,10))).join(""));let i,f;return s===32?(i="space",f=!0):s===13?(i="return",f=!0):A[s]?(i=A[s],f=!1):s>=1&&s<=26?(i=String.fromCodePoint(s+96),f=!1):(i=y(s).toLowerCase(),f=!0),f&&!n&&(n=y(s)),{name:i,...O(p),eventType:B(t),isKittyProtocol:!0,isPrintable:f,raw:e,sequence:e,text:n}},"parseKittyKeypress"),W=c(e=>{const r=z.exec(e);if(!r)return null;const s=Number.parseInt(r[1],10),p=Math.max(0,Number.parseInt(r[2],10)-1),t=Number.parseInt(r[3],10),l=r[4],n=l==="~"?Q[s]:H[l];return n?{name:n,...O(p),eventType:B(t),isKittyProtocol:!0,isPrintable:!1,raw:e,sequence:e}:null},"parseKittySpecialKey"),G=c((e="")=>{let r;M.isBuffer(e)?e[0]>127&&e[1]===void 0?(e[0]-=128,e=`\x1B${String(e)}`):e=String(e):e!==void 0&&typeof e!="string"?e=String(e):e||(e="");const s=V(e);if(s)return s;const p=W(e);if(p)return p;if(P.test(e))return{ctrl:!1,isKittyProtocol:!0,isPrintable:!1,meta:!1,name:"",option:!1,raw:e,sequence:e,shift:!1};const t={ctrl:!1,meta:!1,name:"",option:!1,raw:e,sequence:e,shift:!1};switch(t.sequence=t.sequence||e||t.name,e){case"\r":case"\x1B\r":{t.raw=void 0,t.name="return",t.option=e.length===2;break}case`
|
|
2
2
|
`:{t.name="enter";break}case" ":{t.name="tab";break}case" ":case"\x1B ":{t.name="space",t.meta=e.length===2;break}case"\b":case"\x1B\b":{t.name="backspace",t.meta=e.charAt(0)==="\x1B";break}case"\x1B":case"\x1B\x1B":{t.name="escape",t.meta=e.length===2;break}case"\x1B":case"":{t.name="backspace",t.meta=e.charAt(0)==="\x1B";break}default:if(e.length===1&&e<="")t.name=String.fromCharCode(e.charCodeAt(0)+97-1),t.ctrl=!0;else if(e.length===1&&e>="0"&&e<="9")t.name="number";else if(e.length===1&&e>="a"&&e<="z")t.name=e;else if(e.length===1&&e>="A"&&e<="Z")t.name=e.toLowerCase(),t.shift=!0;else if(r=D.exec(e))t.meta=!0,t.shift=/^[A-Z]$/.test(r[1]);else if(r=R.exec(e)){const l=[...e];l[0]==="\x1B"&&l[1]==="\x1B"&&(t.option=!0);const n=[r[1],r[2],r[4],r[6]].filter(Boolean).join(""),i=(r[3]||r[5]||1)-1;t.ctrl=!!(i&4),t.meta=!!(i&10),t.shift=!!(i&1),t.code=n,t.name=C[n]??"",t.shift=F(n)||t.shift,t.ctrl=U(n)||t.ctrl}}return t},"parseKeypress");var J=Object.defineProperty,v=m((e,r)=>J(e,"name",{value:r,configurable:!0}),"l");const ne=v((e,r={})=>{const{internal_eventEmitter:s,internal_exitOnCtrlC:p,setRawMode:t,stdin:l}=N(),n=r.imeEnabled??!0,i=r.imeTimeout??50,f=I(void 0),k=$(e);w(()=>{if(n)return f.current=new q({onFlush:v(g=>{const d={backspace:!1,capsLock:!1,ctrl:!1,delete:!1,downArrow:!1,end:!1,escape:!1,home:!1,hyper:!1,leftArrow:!1,meta:!1,numLock:!1,pageDown:!1,pageUp:!1,return:!1,rightArrow:!1,shift:!1,super:!1,tab:!1,upArrow:!1};x.discreteUpdates(()=>{k(g,d)})},"onFlush"),timeout:i}),()=>{f.current?.destroy(),f.current=void 0}},[n,i]),w(()=>{if(r.isActive!==!1)return t(!0),()=>{t(!1)}},[r.isActive,t]),w(()=>{if(r.isActive===!1)return;const g=v(d=>{if(n&&j(d)){f.current?.add(d);return}f.current?.flush();const a=G(d),b={backspace:a.name==="backspace",capsLock:a.capsLock??!1,ctrl:a.ctrl,delete:a.name==="delete",downArrow:a.name==="down",end:a.name==="end",escape:a.name==="escape",eventType:a.eventType,home:a.name==="home",hyper:a.hyper??!1,leftArrow:a.name==="left",meta:a.meta||a.option,numLock:a.numLock??!1,pageDown:a.name==="pagedown",pageUp:a.name==="pageup",return:a.name==="return",rightArrow:a.name==="right",shift:a.shift,super:a.super??!1,tab:a.name==="tab",upArrow:a.name==="up"};let o;a.isKittyProtocol?a.isPrintable?o=a.text??a.name:a.ctrl&&a.name.length===1?o=a.name:o="":a.ctrl?o=a.name:o=a.sequence,!a.isKittyProtocol&&Z.includes(a.name)&&(o=""),o.startsWith("\x1B")&&(o=o.slice(1)),o.length===1&&typeof o[0]=="string"&&/[A-Z]/.test(o[0])&&(b.shift=!0),!(o==="c"&&b.ctrl&&p)&&(!a.name&&o===""||x.discreteUpdates(()=>{k(o,b)}))},"handleData");return s.on("input",g),()=>{s.removeListener("input",g)}},[r.isActive,l,p,n])},"useInput");export{ne as default,ne as useInput};
|
|
@@ -2,7 +2,7 @@ import { RefObject } from 'react';
|
|
|
2
2
|
import { b as ScrollViewRef } from "../../packem_shared/scroll-view.d-DtpsgHLg.js";
|
|
3
3
|
import "../../components/box.js";
|
|
4
4
|
import 'type-fest';
|
|
5
|
-
import "../../packem_shared/dom.d-
|
|
5
|
+
import "../../packem_shared/dom.d-DzUPFLuP.js";
|
|
6
6
|
import 'yoga-layout';
|
|
7
7
|
import "../../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
8
8
|
import '@visulima/colorize';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var l=Object.defineProperty;var n=(t,e)=>l(t,"name",{value:e,configurable:!0});import{useEffectEvent as v,useEffect as f}from"react";import{L as d}from"../../packem_shared/reconciler-
|
|
1
|
+
var l=Object.defineProperty;var n=(t,e)=>l(t,"name",{value:e,configurable:!0});import{useEffectEvent as v,useEffect as f}from"react";import{L as d}from"../../packem_shared/reconciler-DYE5h4K4.js";import{useStdinContext as m}from"./use-stdin.js";var p=Object.defineProperty,o=n((t,e)=>p(t,"name",{value:e,configurable:!0}),"n");const x=o((t,e={})=>{const{internal_eventEmitter:s,setBracketedPasteMode:r,setRawMode:a}=m(),c=v(t);f(()=>{if(e.isActive!==!1)return a(!0),r(!0),()=>{a(!1),r(!1)}},[e.isActive,a,r]),f(()=>{if(e.isActive===!1)return;const i=o(u=>{d.discreteUpdates(()=>{c(u)})},"handlePaste");return s.on("paste",i),()=>{s.removeListener("paste",i)}},[e.isActive,s])},"usePaste");export{x as default,x as usePaste};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { S as Selection } from "../../packem_shared/selection.d-
|
|
2
|
+
import { a as DOMElement } from "../../packem_shared/dom.d-DzUPFLuP.js";
|
|
3
|
+
import { S as Selection } from "../../packem_shared/selection.d-FWD8cYY2.js";
|
|
4
4
|
import 'yoga-layout';
|
|
5
5
|
import "../../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
6
6
|
import '@visulima/colorize';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var v=Object.defineProperty;var m=(n,o)=>v(n,"name",{value:o,configurable:!0});import{useRef as d,useState as x,useEffect as R,useCallback as p,useMemo as y}from"react";import{Selection as A,Range as C}from"../../packem_shared/comparePoints-
|
|
1
|
+
var v=Object.defineProperty;var m=(n,o)=>v(n,"name",{value:o,configurable:!0});import{useRef as d,useState as x,useEffect as R,useCallback as p,useMemo as y}from"react";import{Selection as A,Range as C}from"../../packem_shared/comparePoints-C3NJirbh.js";import b from"./use-clipboard.js";var h=Object.defineProperty,T=m((n,o)=>h(n,"name",{value:o,configurable:!0}),"f");const E=T((n,o={})=>{const{copyOnSelect:c=!1,isActive:r=!0,onSelectionChange:s}=o,{copy:l}=b(),e=d(new A).current,[a,S]=x(""),u=d(s);u.current=s,R(()=>r?e.onChange(()=>{const t=e.toString();S(t),u.current?.(t),c&&t.length>0&&l(t)}):void 0,[r,e,c,l]);const i=p(()=>{const t=n.current;if(!t||!r)return;e.removeAllRanges();const g=new C;g.selectNodeContents(t),e.addRange(g)},[n,r,e]),f=p(()=>{e.removeAllRanges()},[e]);return y(()=>({clearSelection:f,selectAll:i,selectedText:a,selection:e}),[f,a,i,e])},"useTextSelection");export{E as default,E as useTextSelection};
|
package/dist/ink/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export { type C as ClipboardTarget, c as clearOsc52, i as isOsc52Supported, w as writeOsc52 } from "../packem_shared/clipboard.d-D6lZTQ21.js";
|
|
2
2
|
export { b as COLOR_BLINDNESS_COMPENSATION, c as COLOR_BLINDNESS_SIMULATION, type C as ColorBlindnessType, type a as ColorMatrix, I as IDENTITY_MATRIX, d as applyColorMatrix, h as hexToRgb, r as rgbToHex, t as transformHexColor } from "../packem_shared/color-matrix.d-DSXLsB64.js";
|
|
3
|
-
import {
|
|
4
|
-
export { R as ResizeObserver, type b as ResizeObserverCallback, c as ResizeObserverEntry, type d as ScrollState, type e as StickyHeader, f as calculateScroll, g as getPathToRoot, h as getScrollHeight, i as getScrollLeft, j as getScrollTop, k as getScrollWidth, l as isNodeSelectable } from "../packem_shared/dom.d-
|
|
5
|
-
export { type I as Instance, type K as KittyFlagName, type a as KittyKeyboardOptions, type R as RenderOptions, k as kittyFlags, b as kittyModifiers, r as render } from "../packem_shared/render.d-
|
|
3
|
+
import { a as DOMElement, D as DOMNode, S as StyledLine } from "../packem_shared/dom.d-DzUPFLuP.js";
|
|
4
|
+
export { R as ResizeObserver, type b as ResizeObserverCallback, c as ResizeObserverEntry, type d as ScrollState, type e as StickyHeader, f as calculateScroll, g as getPathToRoot, h as getScrollHeight, i as getScrollLeft, j as getScrollTop, k as getScrollWidth, l as isNodeSelectable } from "../packem_shared/dom.d-DzUPFLuP.js";
|
|
5
|
+
export { type I as Instance, type K as KittyFlagName, type a as KittyKeyboardOptions, type R as RenderOptions, k as kittyFlags, b as kittyModifiers, r as render } from "../packem_shared/render.d-E2MsoY_g.js";
|
|
6
6
|
import 'node:stream';
|
|
7
7
|
export { type a as CursorPosition } from "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
8
8
|
import { EventEmitter } from 'node:events';
|
|
9
9
|
import React, { PropsWithChildren, RefObject, ReactNode } from 'react';
|
|
10
|
-
export { R as Range, S as Selection, a as applySelectionToStyledLine, c as comparePoints } from "../packem_shared/selection.d-
|
|
10
|
+
export { R as Range, S as Selection, a as applySelectionToStyledLine, c as comparePoints } from "../packem_shared/selection.d-FWD8cYY2.js";
|
|
11
11
|
export { type T as TerminalPalette, i as isTerminalPaletteQuerySupported, q as queryTerminalPalette } from "../packem_shared/terminal-palette.d-D2SQjfn-.js";
|
|
12
12
|
import 'yoga-layout';
|
|
13
13
|
import '@visulima/colorize';
|
package/dist/ink/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{clearOsc52 as o,isOsc52Supported as r,writeOsc52 as a}from"../packem_shared/isOsc52Supported-DKK7Uee6.js";import{COLOR_BLINDNESS_COMPENSATION as l,COLOR_BLINDNESS_SIMULATION as i,IDENTITY_MATRIX as n,applyColorMatrix as u,hexToRgb as f,rgbToHex as p,transformHexColor as c}from"../packem_shared/COLOR_BLINDNESS_SIMULATION-DqErf7XX.js";import{g as d,i as x}from"../packem_shared/dom-
|
|
1
|
+
import{clearOsc52 as o,isOsc52Supported as r,writeOsc52 as a}from"../packem_shared/isOsc52Supported-DKK7Uee6.js";import{COLOR_BLINDNESS_COMPENSATION as l,COLOR_BLINDNESS_SIMULATION as i,IDENTITY_MATRIX as n,applyColorMatrix as u,hexToRgb as f,rgbToHex as p,transformHexColor as c}from"../packem_shared/COLOR_BLINDNESS_SIMULATION-DqErf7XX.js";import{g as d,i as x}from"../packem_shared/dom-CXB-19sK.js";import{IMECompositionBuffer as S,isIMEInput as h}from"../packem_shared/IMECompositionBuffer-C89PhiOu.js";import{kittyFlags as M,kittyModifiers as O}from"../packem_shared/kittyFlags-C3rZLbcK.js";import{c as I,a as L,b,g as C,d as E,e as N,f as R,h as B,i as P,j as H,k as v,l as W,P as k,p as A}from"../packem_shared/layout-BMo200nF.js";import{c as D,a as F,i as z,s as q,b as w,t as j}from"../packem_shared/measure-text-Ce2widM1.js";import{default as U}from"../packem_shared/render-BRR1ESvR.js";import{default as X}from"../packem_shared/renderToString-vEQyGmv6.js";import{default as G,ResizeObserverEntry as J}from"../packem_shared/ResizeObserverEntry-Dq0dk8Kq.js";import{calculateScroll as Z,getScrollHeight as $,getScrollLeft as ee,getScrollTop as te,getScrollWidth as oe}from"../packem_shared/getScrollHeight-ClEOyLHH.js";import{Range as ae,Selection as se,applySelectionToStyledLine as le,comparePoints as ie}from"../packem_shared/comparePoints-C3NJirbh.js";import{squashTextNodesWithMap as ue}from"../packem_shared/squashTextNodesWithMap-DCdi3SZ2.js";import{isTerminalPaletteQuerySupported as pe,queryTerminalPalette as ce}from"../packem_shared/isTerminalPaletteQuerySupported-Dn2hFAZ_.js";import{wrapOrTruncateStyledLine as de}from"../packem_shared/wrapOrTruncateStyledLine-C5rcIrNb.js";import{default as ge}from"../packem_shared/Fullscreen-CxLd1-Zu.js";import{default as he}from"../packem_shared/MouseProvider-PnIUKURs.js";import{default as Me}from"../packem_shared/isIntersecting-B3KbKTmu.js";import{default as ye}from"../packem_shared/useMouseAction-2dRfU1vE.js";import{default as Le}from"../packem_shared/useMouseContext-C746G7kY.js";import{default as Ce}from"../packem_shared/useMousePosition-BTWfV4JK.js";import{default as Ne}from"../packem_shared/useOnMouseHover-D3DczIol.js";import{default as Be}from"../packem_shared/useOnMouseState-cRK8QvzD.js";import{a as He}from"../packem_shared/ansi-parser-B6uXaq65.js";import{useElementDimensions as We,useElementPosition as ke}from"../packem_shared/useElementDimensions-qJ_WXFZ9.js";import{useOnMouseClick as _e}from"../packem_shared/useOnMouseClick-nY8xLZmt.js";export{l as COLOR_BLINDNESS_COMPENSATION,i as COLOR_BLINDNESS_SIMULATION,ge as Fullscreen,n as IDENTITY_MATRIX,S as IMECompositionBuffer,he as MouseProvider,ae as Range,G as ResizeObserver,J as ResizeObserverEntry,se as Selection,u as applyColorMatrix,le as applySelectionToStyledLine,Z as calculateScroll,I as calculateScrollbarLayout,L as calculateScrollbarThumb,o as clearOsc52,D as clearStringWidthCache,F as clearStyledLineCache,b as collectSortedFragments,ie as comparePoints,C as getAddedScrollHeight,E as getBoundingBox,N as getHorizontalScrollbarBoundingBox,R as getInnerHeight,B as getInnerWidth,d as getPathToRoot,P as getRelativeLeft,H as getRelativeTop,$ as getScrollHeight,ee as getScrollLeft,te as getScrollTop,oe as getScrollWidth,v as getText,W as getVerticalScrollbarBoundingBox,f as hexToRgb,z as inkCharacterWidth,h as isIMEInput,Me as isIntersecting,x as isNodeSelectable,r as isOsc52Supported,pe as isTerminalPaletteQuerySupported,M as kittyFlags,O as kittyModifiers,k as measureElement,He as parseSgrMouse,A as processLayout,ce as queryTerminalPalette,U as render,X as renderToString,p as rgbToHex,q as setEnableStyledLineCache,w as setStringWidthFunction,ue as squashTextNodesWithMap,j as toStyledLine,c as transformHexColor,We as useElementDimensions,ke as useElementPosition,ye as useMouseAction,Le as useMouseContext,Ce as useMousePosition,_e as useOnMouseClick,Ne as useOnMouseHover,Be as useOnMouseState,de as wrapOrTruncateStyledLine,a as writeOsc52};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var N=Object.defineProperty;var g=(n,t)=>N(n,"name",{value:t,configurable:!0});import{g as m}from"./dom-
|
|
1
|
+
var N=Object.defineProperty;var g=(n,t)=>N(n,"name",{value:t,configurable:!0});import{g as m}from"./dom-CXB-19sK.js";import{t as O}from"./measure-text-Ce2widM1.js";import{squashTextNodesWithMap as S}from"./squashTextNodesWithMap-DCdi3SZ2.js";var v=Object.defineProperty,l=g((n,t)=>v(n,"name",{value:t,configurable:!0}),"f");const x=l(n=>{if(n.nodeName==="#text"){const r=O(n.nodeValue);return{charOffsetMap:new Map([[n,{end:r.length,start:0}]]),styledLine:r}}const t=new Map,e=S(n,t,{current:0}),s=O(e);return t.set(n,{end:s.length,start:0}),{charOffsetMap:t,styledLine:s}},"getPlainTextFromDomNode"),y=l((n,t)=>{if(!n.startContainer||!n.endContainer)return;const e=l((i,h)=>{const o=t.get(i);if(!o)return;if(i.nodeName==="#text")return o.start+h;const d=i;if(h>=d.childNodes.length)return o.end;const a=d.childNodes[h],u=t.get(a);if(u)return u.start;for(let f=h-1;f>=0;f--){const c=d.childNodes[f],C=t.get(c);if(C)return C.end}return o.start},"getOffset"),s=e(n.startContainer,n.startOffset),r=e(n.endContainer,n.endOffset);if(!(s===void 0||r===void 0))return{end:r,start:s}},"getRangeCharacterOffsets"),p=l((n,t,e,s)=>{if(n===e)return t===s?0:t<s?-1:1;const r=m(n),i=m(e);let h,o=0;for(;o<r.length&&o<i.length&&r[o]===i[o];)h=r[o],o++;if(!h)return 0;if(o===r.length){const c=i[o],C=n.childNodes.indexOf(c);return t<=C?-1:1}if(o===i.length){const c=r[o];return e.childNodes.indexOf(c)<s?-1:1}const d=r[o],a=i[o],u=h.childNodes.indexOf(d),f=h.childNodes.indexOf(a);return u<f?-1:1},"comparePoints");class A{static{g(this,"Range")}static{l(this,"Range")}startContainer=void 0;startOffset=0;endContainer=void 0;endOffset=0;collapsed=!0;commonAncestorContainer=void 0;setStart(t,e){this.startContainer=t,this.startOffset=e,this.updateCollapsed(),this.updateCommonAncestor()}setEnd(t,e){this.endContainer=t,this.endOffset=e,this.updateCollapsed(),this.updateCommonAncestor()}collapse(t){t?(this.endContainer=this.startContainer,this.endOffset=this.startOffset):(this.startContainer=this.endContainer,this.startOffset=this.endOffset),this.collapsed=!0,this.updateCommonAncestor()}selectNode(t){if(!t.parentNode)throw new Error("Node has no parent");const e=t.parentNode.childNodes.indexOf(t);this.setStart(t.parentNode,e),this.setEnd(t.parentNode,e+1)}selectNodeContents(t){this.setStart(t,0),t.nodeName==="#text"?this.setEnd(t,t.nodeValue.length):this.setEnd(t,t.childNodes.length)}toString(){if(this.collapsed||!this.startContainer||!this.endContainer||!this.commonAncestorContainer)return"";const{charOffsetMap:t,styledLine:e}=x(this.commonAncestorContainer),s=y(this,t);if(!s)return"";const r=e.slice(s.start,s.end);return r.getTextRange(0,r.length)}updateCollapsed(){this.collapsed=this.startContainer===this.endContainer&&this.startOffset===this.endOffset}updateCommonAncestor(){if(!this.startContainer||!this.endContainer){this.commonAncestorContainer=void 0;return}if(this.startContainer===this.endContainer){this.commonAncestorContainer=this.startContainer;return}const t=m(this.startContainer),e=m(this.endContainer);let s;for(let r=0;r<Math.min(t.length,e.length)&&t[r]===e[r];r++)s=t[r];this.commonAncestorContainer=s}}class L{static{g(this,"Selection")}static{l(this,"Selection")}anchorNode=void 0;anchorOffset=0;focusNode=void 0;focusOffset=0;isCollapsed=!0;rangeCount=0;ranges=[];listeners=new Set;onChange(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}toString(){return this.ranges.map(t=>t.toString()).join("")}getRangeAt(t){return this.ranges[t]}addRange(t){this.ranges.includes(t)||(this.ranges.push(t),this.rangeCount=this.ranges.length,this.rangeCount===1&&(this.anchorNode=t.startContainer,this.anchorOffset=t.startOffset,this.focusNode=t.endContainer,this.focusOffset=t.endOffset,this.isCollapsed=t.collapsed),this.notifyChange())}removeRange(t){const e=this.ranges.indexOf(t);e!==-1&&(this.ranges.splice(e,1),this.rangeCount=this.ranges.length,this.rangeCount===0&&this.clearState(),this.notifyChange())}removeAllRanges(){this.ranges=[],this.rangeCount=0,this.clearState(),this.notifyChange()}collapse(t,e){this.removeAllRanges();const s=new A;s.setStart(t,e),s.setEnd(t,e),this.addRange(s)}containsNode(t,e=!1){if(!t.parentNode)return!1;const s=t.parentNode,r=s.childNodes.indexOf(t),i=s,h=r,o=s,d=r+1;return this.ranges.some(a=>{if(!a.startContainer||!a.endContainer)return!1;const u=p(a.startContainer,a.startOffset,i,h),f=p(a.endContainer,a.endOffset,o,d);if(e){const c=p(a.startContainer,a.startOffset,o,d),C=p(a.endContainer,a.endOffset,i,h);return c<0&&C>0}return u<=0&&f>=0})}clearState(){this.anchorNode=void 0,this.anchorOffset=0,this.focusNode=void 0,this.focusOffset=0,this.isCollapsed=!0}notifyChange(){for(const t of this.listeners)t()}}const T=l((n,t)=>{if(n.length===0||t.start>=t.end)return n;const e=n.clone(),s=Math.max(0,t.start),r=Math.min(n.length,t.end);for(let i=s;i<r;i++)e.setInverted(i,!0);return e},"applySelectionToStyledLine");export{A as Range,L as Selection,T as applySelectionToStyledLine,p as comparePoints};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f=Object.defineProperty;var s=(e,t)=>f(e,"name",{value:t,configurable:!0});import p from"yoga-layout";import{
|
|
1
|
+
var f=Object.defineProperty;var s=(e,t)=>f(e,"name",{value:t,configurable:!0});import p from"yoga-layout";import{L as c}from"./measure-text-Ce2widM1.js";import m from"./squashTextNodesWithMap-DCdi3SZ2.js";import{wordWrap as C,truncate as v}from"@visulima/string";var x=Object.defineProperty,R=s((e,t)=>x(e,"name",{value:t,configurable:!0}),"R");const u={},T={hard:"STRICT_WIDTH",wrap:"BREAK_WORDS","wrap-anywhere":"BREAK_AT_CHARACTERS","wrap-preserve-words":"PRESERVE_WORDS","wrap-strict":"STRICT_WIDTH"},k=R((e,t,o)=>{const a=e+String(t)+String(o),n=u[a];if(n)return n;let d=e;const N=T[o];if(N)d=C(e,{trim:!1,width:t,wrapMode:N}).replace(/\n$/,"");else if(o.startsWith("truncate")){let i="end";o==="truncate-middle"&&(i="middle"),o==="truncate-start"&&(i="start"),d=v(e,t,{position:i})}return u[a]=d,d},"wrapText");var b=Object.defineProperty,r=s((e,t)=>b(e,"name",{value:t,configurable:!0}),"n");let S=0;const P=r(e=>{const t={attributes:{},childNodes:[],internal_accessibility:{},internal_id:S++,nodeName:e,parentNode:void 0,style:{},yogaNode:e==="ink-virtual-text"||e==="ink-cursor"?void 0:p.Node.create()};return e==="ink-text"&&t.yogaNode?.setMeasureFunc(_.bind(null,t)),t},"createNode"),l=r(e=>{g(e.nodeName==="ink-static-render"&&e.cachedRender?e.parentNode:e)},"markNodeAndParentIfStaticAsDirty"),O=r((e,t)=>{t.parentNode&&y(t.parentNode,t),t.parentNode=e,e.childNodes.push(t),t.yogaNode&&e.yogaNode?.insertChild(t.yogaNode,e.yogaNode.getChildCount()),l(e)},"appendChildNode"),V=r((e,t,o)=>{t.parentNode&&y(t.parentNode,t),t.parentNode=e;const a=e.childNodes.indexOf(o);if(a===-1)e.childNodes.push(t),t.yogaNode&&e.yogaNode?.insertChild(t.yogaNode,e.yogaNode.getChildCount());else if(e.childNodes.splice(a,0,t),t.yogaNode){const n=e.childNodes.slice(0,a).filter(d=>!!d.yogaNode).length;e.yogaNode?.insertChild(t.yogaNode,n)}l(e)},"insertBeforeNode"),y=r((e,t)=>{if(t.yogaNode){const a=t.yogaNode.getParent();a&&a.removeChild(t.yogaNode)}t.parentNode=void 0;const o=e.childNodes.indexOf(t);o!==-1&&e.childNodes.splice(o,1),l(e)},"removeChildNode"),I=r((e,t,o)=>{if(t==="internal_accessibility"){e.internal_accessibility=o;return}e.attributes[t]=o},"setAttribute"),B=r((e,t)=>{e.style=t??{}},"setStyle"),H=r(e=>{const t={nodeName:"#text",nodeValue:e,parentNode:void 0,style:{},yogaNode:void 0};return w(t,e),t},"createTextNode"),_=r(function(e,t){const o=e.nodeName==="#text"?e.nodeValue:m(e),a=c(o);if(a.width<=t||a.width>=1&&t>0&&t<1)return a;const n=e.style?.textWrap??"wrap",d=k(o,Math.floor(t),n);return c(d)},"measureTextNode"),h=r(e=>{if(e?.parentNode)return e.yogaNode??h(e.parentNode)},"findClosestYogaNode"),g=r(e=>{(e?.nodeName==="#text"||e?.nodeName==="ink-text"||e?.nodeName==="ink-virtual-text")&&h(e)?.markDirty();let t=e;for(;t;){if((t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&(t.internal_textCache=void 0),"childNodes"in t){if(t!==e&&t.nodeName==="ink-static-render"&&t.cachedRender)break;t.cachedRender=void 0}t=t.parentNode}},"markNodeAsDirty"),w=r((e,t)=>{typeof t!="string"&&(t=String(t)),e.nodeValue=t,g(e)},"setTextNodeValue"),$=r((e,t)=>e.nodeName!=="ink-root"?()=>{}:(e.internal_layoutListeners??=new Set,e.internal_layoutListeners.add(t),()=>{e.internal_layoutListeners?.delete(t)}),"addLayoutListener"),j=r(e=>{if(!(e.nodeName!=="ink-root"||!e.internal_layoutListeners))for(const t of e.internal_layoutListeners)t()},"emitLayoutListeners"),M=r((e,t)=>{if(e.cachedRender=t,e.yogaNode){for(e.yogaNode.setWidth(t.width),e.yogaNode.setHeight(t.height);e.yogaNode.getChildCount()>0;)e.yogaNode.removeChild(e.yogaNode.getChild(0));e.isYogaTreeDetached=!0}},"setCachedRender"),K=r(e=>{const t=[];let o=e;for(;o;)t.unshift(o),o=o.parentNode;return t},"getPathToRoot"),Y=r(e=>{let t=e;for(;t;){const{userSelect:o}=t.style;if(o==="none")return!1;if(o==="text"||o==="all")return!0;t=t.parentNode}return!0},"isNodeSelectable");export{k as T,$ as a,V as b,P as c,O as d,j as e,H as f,K as g,B as h,Y as i,I as j,M as k,g as m,y as r,w as s};
|
|
@@ -411,4 +411,4 @@ declare const getPathToRoot: (node: DOMNode) => DOMNode[];
|
|
|
411
411
|
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
412
412
|
*/
|
|
413
413
|
declare const isNodeSelectable: (node: DOMElement) => boolean;
|
|
414
|
-
export {
|
|
414
|
+
export { DOMNode as D, ResizeObserver as R, StyledLine as S, DOMElement as a, ResizeObserverCallback as b, ResizeObserverEntry as c, ScrollState as d, StickyHeader as e, calculateScroll as f, getPathToRoot as g, getScrollHeight as h, getScrollLeft as i, getScrollTop as j, getScrollWidth as k, isNodeSelectable as l };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"yoga-layout";import"./measure-text-
|
|
1
|
+
import"yoga-layout";import"./measure-text-Ce2widM1.js";import"./squashTextNodesWithMap-DCdi3SZ2.js";import{a as r,d,c as i,f as m,e as N,g as l,b as p,i as c,m as h,r as n,j as u,k as y,h as L,s as b}from"./dom-CXB-19sK.js";export{r as addLayoutListener,d as appendChildNode,i as createNode,m as createTextNode,N as emitLayoutListeners,l as getPathToRoot,p as insertBeforeNode,c as isNodeSelectable,h as markNodeAsDirty,n as removeChildNode,u as setAttribute,y as setCachedRender,L as setStyle,b as setTextNodeValue};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var X=Object.defineProperty;var k=(r,t)=>X(r,"name",{value:t,configurable:!0});import{isFullwidthCodePoint as Y,getStringWidth as Z}from"@visulima/string";import{t as tt}from"./ansi-tokenizer-DqX9nJuk.js";var et=Object.defineProperty,st=k((r,t)=>et(r,"name",{value:t,configurable:!0}),"r$1");let H=class{static{k(this,"h")}static{st(this,"DataLimitedLruMap")}map;maxDataSize;maxKeys;currentDataSize=0;constructor(t,e){this.map=new Map,this.maxKeys=t,this.maxDataSize=e}get size(){return this.map.size}clear(){this.map.clear(),this.currentDataSize=0}get(t){if(!this.map.has(t))return;const e=this.map.get(t);return this.map.delete(t),this.map.set(t,e),e}set(t,e){const s=t.length;if(!(s>this.maxDataSize)){for(this.map.has(t)&&(this.map.delete(t),this.currentDataSize-=s);this.currentDataSize+s>this.maxDataSize&&this.map.size>0;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}for(;this.map.size>=this.maxKeys;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}this.map.set(t,e),this.currentDataSize+=s}}};const at=1,nt=2,K=4,j=8,R=16,M=32,V=64,x=128;var rt=Object.defineProperty,it=k((r,t)=>rt(r,"name",{value:t,configurable:!0}),"x");const p=1073741823,C=1073741824;class d{static{k(this,"StyledLine")}static{it(this,"StyledLine")}length=0;static emptyCache=new Map;text;charData;spans;_cachedTrimmedLength;static empty(t){if(t<=0)return new d;const e=d.emptyCache.get(t);if(e)return e.clone();const s=new d;s.length=t,s.text=" ".repeat(t),s.charData=Array.from({length:t});for(let a=0;a<t;a++)s.charData[a]=a;return s.spans=[{formatFlags:0,length:t}],s._cachedTrimmedLength=0,Object.freeze(s.spans[0]),Object.freeze(s.spans),Object.freeze(s),d.emptyCache.set(t,s),s.clone()}getValue(t){if(this.text===void 0||t<0||t>=this.length)return"";const e=this.charData[t]&p,s=t+1<this.length?this.charData[t+1]&p:this.text.length;return this.text.slice(e,s)}getTextRange(t,e){if(this.text===void 0||t<0||e>this.length||t>=e)return"";const s=this.charData[t]&p,a=e<this.length?this.charData[e]&p:this.text.length;return this.text.slice(s,a)}getSpan(t){if(this.spans===void 0||t<0||t>=this.length)return;let e=0;for(const s of this.spans){if(t<e+s.length)return s;e+=s.length}}getFullWidth(t){return this.charData===void 0||t<0||t>=this.length?!1:(this.charData[t]&C)!==0}hasStyles(t){const e=this.getSpan(t);return e?(e.formatFlags&~x)!==0||e.fgColor!==void 0||e.bgColor!==void 0||e.link!==void 0:!1}getFormatFlags(t){let e=this.getSpan(t)?.formatFlags??0;return this.getFullWidth(t)&&(e|=x),e}getFgColor(t){return this.getSpan(t)?.fgColor}getBgColor(t){return this.getSpan(t)?.bgColor}getLink(t){return this.getSpan(t)?.link}setInverted(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{e?s.formatFlags|=M:s.formatFlags&=~M})}setBackgroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.bgColor=e})}setForegroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.fgColor=e})}setChar(t,e,s,a,n,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&x)!==0,o=s&~x,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l,b=e.length;if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==b){const f=b-m;for(let S=t+1;S<this.length;S++){const T=this.charData[S],w=T&p,L=T&C;this.charData[S]=w+f|L}}if(this.charData[t]=l|(i?C:0),this.trySetStyleAtIndex(t,o,a,n,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let u=0;for(let f=0;f<this.spans.length;f++){const S=this.spans[f];if(u===t&&S.length===1){this.spans[f]={bgColor:n,fgColor:a,formatFlags:o,length:1,link:h};break}u+=S.length}this.mergeSpans()}setCharFast(t,e,s,a,n,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&x)!==0,o=s&~x,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l;if(e.length===m)e!==this.text.slice(l,c)&&(this.text=this.text.slice(0,l)+e+this.text.slice(c)),this.charData[t]=l|(i?C:0);else{if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==e.length){const u=e.length-m;for(let f=t+1;f<this.length;f++){const S=this.charData[f];this.charData[f]=(S&p)+u|S&C}}this.charData[t]=l|(i?C:0)}if(this.trySetStyleAtIndex(t,o,a,n,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let b=0;for(let u=0;u<this.spans.length;u++){const f=this.spans[u];if(b===t&&f.length===1){this.spans[u]={bgColor:n,fgColor:a,formatFlags:o,length:1,link:h};break}b+=f.length}this.mergeSpans()}writeFrom(t,e,s=0,a){const n=a??e.length-s;if(n<=0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=Math.min(n,this.length-t,e.length-s),i=this.charData[t]&p,o=t+h<this.length?this.charData[t+h]&p:this.text.length;let l="";for(let g=0;g<h;g++)l+=e.getValue(s+g);const c=o-i,m=l.length-c;this.text=this.text.slice(0,i)+l+this.text.slice(o);let b=i;for(let g=0;g<h;g++){const D=e.getFullWidth(s+g);this.charData[t+g]=b|(D?C:0),b+=e.getValue(s+g).length}if(m!==0)for(let g=t+h;g<this.length;g++){const D=this.charData[g];this.charData[g]=(D&p)+m|D&C}this.splitSpansAt(t),this.splitSpansAt(t+h);const u=[];let f=0;for(const g of e.getSpans()){const D=f+g.length,P=Math.max(s,f),E=Math.min(s+h,D);if(P<E&&u.push({...g,length:E-P}),f=D,f>=s+h)break}let S=0,T=0;for(let g=0;g<this.spans.length;g++){if(T===t){S=g;break}T+=this.spans[g].length}let w=0,L=0;for(let g=S;g<this.spans.length&&L<h;g++)L+=this.spans[g].length,w++;this.spans.splice(S,w,...u),this.mergeSpans()}pushChar(t,e,s,a,n){this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=(e&x)!==0,i=e&~x,o=this.text.length;this.text=(this.text??"")+t,this.charData.push(o|(h?C:0));const l=this.spans.at(-1);l?.formatFlags===i&&l.fgColor===s&&l.bgColor===a&&l.link===n?l.length++:this.spans.push({bgColor:a,fgColor:s,formatFlags:i,length:1,link:n}),this.length++}clone(){if(this.charData===void 0)return new d;const t=new d;return t.length=this.length,t.text=this.text,t.charData=[...this.charData],t.spans=this.spans.map(e=>({...e})),t._cachedTrimmedLength=this._cachedTrimmedLength,t}slice(t,e){if(this.charData===void 0)return new d;const s=Math.max(0,t),a=e===void 0?this.length:Math.min(this.length,e);if(s>=a)return new d;if(s===0&&a===this.length)return this.clone();const n=new d;n.length=a-s,n.charData=Array.from({length:n.length});const h=this.charData[s]&p,i=a<this.length?this.charData[a]&p:this.text.length;n.text=this.text.slice(h,i);for(let c=0;c<n.length;c++){const m=this.charData[s+c],b=m&p,u=m&C;n.charData[c]=b-h|u}const o=[];let l=0;for(const c of this.spans){const m=l,b=l+c.length,u=Math.max(s,m),f=Math.min(a,b);if(u<f&&o.push({...c,length:f-u}),l+=c.length,l>=a)break}return n.spans=o,n.mergeSpans(),n}combine(...t){if(t.length===0)return this.clone();const e=[this,...t].filter(i=>i.length>0);if(e.length===0)return new d;if(e.length===1)return e[0].clone();let s=0;for(const i of e)s+=i.length;const a=new d;a.length=s,a.text=e.map(i=>i.getText()).join(""),a.charData=Array.from({length:s});let n=0,h=0;for(const i of e){const o=i.charData,l=i.getText();if(o)for(let c=0;c<i.length;c++){const m=o[c],b=m&p,u=m&C;a.charData[n+c]=h+b|u}else for(let c=0;c<i.length;c++)a.charData[n+c]=h+c;n+=i.length,h+=l.length}return a.spans=e.flatMap(i=>i.getSpans().map(o=>({...o}))),a.mergeSpans(),a}getTrimmedLength(){if(this._cachedTrimmedLength!==void 0)return this._cachedTrimmedLength;if(this.length===0)return this._cachedTrimmedLength=0,0;if(this.text===void 0||this.charData===void 0)return this._cachedTrimmedLength=0,0;let t=this.length-1;if(this.spans)for(let e=this.spans.length-1;e>=0;e--){const s=this.spans[e];if((s.formatFlags&~x)!==0||s.fgColor!==void 0||s.bgColor!==void 0||s.link!==void 0)return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;for(let a=0;a<s.length;a++){const n=this.charData[t]&p;if((t+1<this.length?this.charData[t+1]&p:this.text.length)-n!==1||this.text[n]!==" ")return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;t--}}return this._cachedTrimmedLength=0,0}trimEnd(){const t=this.getTrimmedLength();return t===this.length?this:t===0?new d:this.slice(0,t)}equals(t){if(this.length!==t.length)return!1;if(this.length===0)return!0;if(this.getText()!==t.getText())return!1;const e=this.getSpans(),s=t.getSpans();if(e.length!==s.length)return!1;for(const[h,i]of e.entries()){const o=i,l=s[h];if(o.length!==l.length||o.formatFlags!==l.formatFlags||o.fgColor!==l.fgColor||o.bgColor!==l.bgColor||o.link!==l.link)return!1}const a=this.charData,n=t.charData;if(a&&n){for(let h=0;h<this.length;h++)if(a[h]!==n[h])return!1}return!0}getText(){return this.text??""}getSpans(){return this.spans??[]}getValues(){return Array.from({length:this.length},(t,e)=>this.getValue(e))}*[Symbol.iterator](){if(this.length===0)return;let t=0,e=0;const s=this.getSpans();for(let a=0;a<this.length;a++){const n=s[t],h=n?n.formatFlags:0,i=this.getFullWidth(a);yield{bgColor:n?.bgColor,fgColor:n?.fgColor,formatFlags:h|(i?x:0),fullWidth:i,hasStyles:(h&~x)!==0||n?.fgColor!==void 0||n?.bgColor!==void 0||n?.link!==void 0,link:n?.link,value:this.getValue(a)},n&&(e++,e>=n.length&&(t++,e=0))}}updateSpanAt(t,e){if(t<0||t>=this.length)return;this.ensureInitialized(),this.splitSpansAt(t),this.splitSpansAt(t+1);let s=0;for(const a of this.spans){if(s===t&&a.length===1){e(a);break}s+=a.length}this.mergeSpans()}ensureWidth(t){if(t<=this.length)return;this.ensureInitialized();const e=this.length,s=t-e,a=this.text.length;for(let h=0;h<s;h++)this.charData.push(a);this.length=t;const n=this.spans.at(-1);n?.formatFlags===0&&n.fgColor===void 0&&n.bgColor===void 0&&n.link===void 0?n.length+=s:this.spans.push({formatFlags:0,length:s})}ensureInitialized(){if(this.charData===void 0&&(this.text="",this.charData=Array.from({length:this.length}),this.spans=this.length>0?[{formatFlags:0,length:this.length}]:[],this.length>0&&this.text.length===0)){this.text=" ".repeat(this.length);for(let t=0;t<this.length;t++)this.charData[t]=t}}splitSpansAt(t){if(this.spans===void 0||t<=0||t>=this.length)return;let e=0;for(let s=0;s<this.spans.length;s++){const a=this.spans[s];if(t>e&&t<e+a.length){const n=t-e,h=a.length-n;this.spans.splice(s,1,{...a,length:n},{...a,length:h});return}e+=a.length}}trySetStyleAtIndex(t,e,s,a,n){if(!this.spans)return!1;let h=0,i=-1,o;for(let l=0;l<this.spans.length;l++){const c=this.spans[l];if(h<=t&&h+c.length>t){i=l,o=c;break}h+=c.length}if(!o)return!1;if(o.formatFlags===e&&o.fgColor===s&&o.bgColor===a&&o.link===n)return!0;if(t===h&&i>0){const l=this.spans[i-1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===n)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}if(t===h+o.length-1&&i<this.spans.length-1){const l=this.spans[i+1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===n)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}return!1}mergeSpans(){if(this.spans===void 0)return;const t=[];for(const e of this.spans){if(e.length===0)continue;const s=t.at(-1);s?.formatFlags===e.formatFlags&&s.fgColor===e.fgColor&&s.bgColor===e.bgColor&&s.link===e.link?s.length+=e.length:t.push({...e})}this.spans=t}}var ht=Object.defineProperty,I=k((r,t)=>ht(r,"name",{value:t,configurable:!0}),"u$1");const G={black:0,blue:4,cyan:6,gray:8,green:2,grey:8,magenta:5,red:1,white:7,yellow:3},U={blackBright:8,blueBright:12,cyanBright:14,greenBright:10,magentaBright:13,redBright:9,whiteBright:15,yellowBright:11},q=/^ansi256\(\s?(\d+)\s?\)$/,J=/^rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,Nt=I(r=>{const t=G[r];if(t!==void 0)return t;const e=U[r];if(e!==void 0)return e;const s=q.exec(r);if(s)return Number(s[1])&255;if(r.startsWith("#")&&r.length===7){const n=Number.parseInt(r.slice(1,3),16),h=Number.parseInt(r.slice(3,5),16),i=Number.parseInt(r.slice(5,7),16);return 16+36*Math.round(n/51)+6*Math.round(h/51)+Math.round(i/51)}const a=J.exec(r);return a?16+36*Math.round(Number(a[1])/51)+6*Math.round(Number(a[2])/51)+Math.round(Number(a[3])/51):255},"colorToAnsi256"),lt=I((r,t)=>{const e=t?30:40,s=G[r];if(s!==void 0)return[e+s];const a=U[r];if(a!==void 0)return[e+60+(a-8)];if(r.startsWith("#")&&r.length===7){const i=Number.parseInt(r.slice(1,3),16),o=Number.parseInt(r.slice(3,5),16),l=Number.parseInt(r.slice(5,7),16);return[t?38:48,2,i,o,l]}const n=q.exec(r);if(n)return[t?38:48,5,Number(n[1])];const h=J.exec(r);return h?[t?38:48,2,Number(h[1]),Number(h[2]),Number(h[3])]:[]},"colorToSgrParams");I((r,t)=>{const e=lt(r,t);if(e.length!==0)return`\x1B[${e.join(";")}m`},"colorToAnsiCode");const A=I(r=>{const t=["black","red","green","yellow","blue","magenta","cyan","white"];return r>=0&&r<=7?t[r]:`ansi256(${r})`},"ansi256ToColorName");var ot=Object.defineProperty,y=k((r,t)=>ot(r,"name",{value:t,configurable:!0}),"u");const _=y(()=>({bgColor:void 0,fgColor:void 0,formatFlags:0,link:void 0}),"createSgrState"),ct=y((r,t)=>{if(t.length===0)return _();const e=(t.includes(":")?t.replaceAll(":",";"):t).split(";").filter(o=>o.length>0).map(Number);let{bgColor:s,fgColor:a,formatFlags:n,link:h}=r,i=0;for(;i<e.length;){const o=e[i];switch(o){case 0:{n=0,a=void 0,s=void 0,h=void 0;break}case 1:{n|=at;break}case 2:{n|=nt;break}case 3:{n|=K;break}case 4:{n|=j;break}case 7:{n|=M;break}case 8:{n|=V;break}case 9:{n|=R;break}case 22:{n&=-4;break}case 23:{n&=~K;break}case 24:{n&=~j;break}case 27:{n&=~M;break}case 28:{n&=~V;break}case 29:{n&=~R;break}case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:{a=A(o-30);break}case 38:{e[i+1]===5&&e[i+2]!==void 0?(a=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(a=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 39:{a=void 0;break}case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:{s=A(o-40);break}case 48:{e[i+1]===5&&e[i+2]!==void 0?(s=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(s=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 49:{s=void 0;break}case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:{a=`ansi256(${o-90+8})`;break}case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:{s=`ansi256(${o-100+8})`;break}}i++}return{bgColor:s,fgColor:a,formatFlags:n,link:h}},"applySgrParams"),z=127462,N=127487,gt=127995,ft=127999,ut=8205,dt=917504,mt=917631,pt=new RegExp("\\p{Mark}","u"),bt=new Intl.Segmenter(void 0,{granularity:"grapheme"}),St=y((r,t)=>!!(Y(t)||r.includes("️")||t>=z&&t<=N),"isFullwidthGrapheme"),xt=/(?:\u001B\]|\u009D)8;([^;]*);(.*?)(?:\u001B\\|\u0007|\u009C)/,Ct=y(r=>{const t=xt.exec(r);return!t?.[2]||t[2].length===0?void 0:r.endsWith("\x1B\\")?`ST:${t[2]}`:t[2]},"parseOscHyperlink"),Q=y((r,t,e)=>{const s=bt.segment(r),a=[];for(const{segment:n}of s)a.push(n);for(let n=0;n<a.length;n++){let h=a[n];if(h===" "){for(let l=0;l<4;l++)t.pushChar(" ",e.formatFlags,e.fgColor,e.bgColor,e.link);continue}if(h==="\b")continue;const i=h.codePointAt(0);if(!i)continue;if(i>=z&&i<=N&&n+1<a.length){const l=a[n+1],c=l.codePointAt(0);c&&c>=z&&c<=N&&(h+=l,n++)}else for(;n+1<a.length;){const l=a[n+1],c=l.codePointAt(0);if(!c)break;const m=pt.test(String.fromCodePoint(c)),b=c>=gt&&c<=ft,u=c===ut,f=c>=dt&&c<=mt;if(!m&&!b&&!u&&!f)break;h+=l,n++,u&&n+1<a.length&&(h+=a[n+1],n++)}const o=St(h,i)?e.formatFlags|x:e.formatFlags;t.pushChar(h,o,e.fgColor,e.bgColor,e.link)}},"processTextToken"),vt=y(r=>{if(r.length===0)return new d;const t=tt(r),e=new d;let s=_();for(const a of t)switch(a.type){case"csi":{a.finalCharacter==="m"&&(s=ct(s,a.parameterString));break}case"osc":{const n=Ct(a.value);n!==void 0?s={...s,link:n}:a.value.includes("8;")&&(s={...s,link:void 0});break}case"text":{Q(a.value,e,s);break}}return e},"textToStyledLine"),kt=/^[\u0020-\u007E]*$/,$t=y(r=>{if(r.length===0)return new d;const t=new d;if(kt.test(r)){for(const e of r)t.pushChar(e,0);return t}return Q(r,t,_()),t},"plainTextToStyledLine");var Dt=Object.defineProperty,v=k((r,t)=>Dt(r,"name",{value:t,configurable:!0}),"r");const $=new H(1e4,1e6),W=new Map,F=new H(1e4,1e6);let B=!0,O=Z;const Wt=v(r=>{B=r,r||F.clear()},"setEnableStyledLineCache"),Bt=v(()=>{F.clear()},"clearStyledLineCache"),_t=v(r=>{O=r,yt()},"setStringWidthFunction"),yt=v(()=>{$.clear(),W.clear(),F.clear()},"clearStringWidthCache"),Tt=v(r=>{if(r.length===1){const s=r.codePointAt(0);if(s!==void 0&&s>=32&&s<127)return 1}const t=W.get(r);if(t!==void 0)return t;let e;try{e=O(r)}catch{e=1}return W.set(r,e),e},"inkCharacterWidth"),Ft=v(r=>{try{return O(r)}catch{return 1}},"safeGetStringWidth"),Ot=v(r=>{if(r.length===0)return{height:0,width:0};const t=$.get(r);if(t)return t;const e=r.split(`
|
|
2
|
-
`)
|
|
3
|
-
`&&(t.push(s>e?r.slice(e,s):new d),e=s+1);return t.push(e<r.length?r.slice(e):new d),t},"splitStyledLineByNewline"),Et=v(r=>{if(r.length===0)return{height:0,width:0};const t=Lt(r);let e=0;for(const s of t)e=Math.max(e,wt(s));return{height:t.length,width:e}},"measureStyledLine");export{at as B,nt as D,
|
|
1
|
+
var X=Object.defineProperty;var k=(r,t)=>X(r,"name",{value:t,configurable:!0});import{isFullwidthCodePoint as Y,getStringWidth as Z}from"@visulima/string";import{t as tt}from"./ansi-tokenizer-DqX9nJuk.js";var et=Object.defineProperty,st=k((r,t)=>et(r,"name",{value:t,configurable:!0}),"r$1");let _=class{static{k(this,"h")}static{st(this,"DataLimitedLruMap")}map;maxDataSize;maxKeys;currentDataSize=0;constructor(t,e){this.map=new Map,this.maxKeys=t,this.maxDataSize=e}get size(){return this.map.size}clear(){this.map.clear(),this.currentDataSize=0}get(t){if(!this.map.has(t))return;const e=this.map.get(t);return this.map.delete(t),this.map.set(t,e),e}set(t,e){const s=t.length;if(!(s>this.maxDataSize)){for(this.map.has(t)&&(this.map.delete(t),this.currentDataSize-=s);this.currentDataSize+s>this.maxDataSize&&this.map.size>0;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}for(;this.map.size>=this.maxKeys;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}this.map.set(t,e),this.currentDataSize+=s}}};const at=1,nt=2,j=4,R=8,V=16,M=32,H=64,C=128;var rt=Object.defineProperty,it=k((r,t)=>rt(r,"name",{value:t,configurable:!0}),"x");const p=1073741823,x=1073741824;class d{static{k(this,"StyledLine")}static{it(this,"StyledLine")}length=0;static emptyCache=new Map;text;charData;spans;_cachedTrimmedLength;static empty(t){if(t<=0)return new d;const e=d.emptyCache.get(t);if(e)return e.clone();const s=new d;s.length=t,s.text=" ".repeat(t),s.charData=Array.from({length:t});for(let a=0;a<t;a++)s.charData[a]=a;return s.spans=[{formatFlags:0,length:t}],s._cachedTrimmedLength=0,Object.freeze(s.spans[0]),Object.freeze(s.spans),Object.freeze(s),d.emptyCache.set(t,s),s.clone()}getValue(t){if(this.text===void 0||t<0||t>=this.length)return"";const e=this.charData[t]&p,s=t+1<this.length?this.charData[t+1]&p:this.text.length;return this.text.slice(e,s)}getTextRange(t,e){if(this.text===void 0||t<0||e>this.length||t>=e)return"";const s=this.charData[t]&p,a=e<this.length?this.charData[e]&p:this.text.length;return this.text.slice(s,a)}getSpan(t){if(this.spans===void 0||t<0||t>=this.length)return;let e=0;for(const s of this.spans){if(t<e+s.length)return s;e+=s.length}}getFullWidth(t){return this.charData===void 0||t<0||t>=this.length?!1:(this.charData[t]&x)!==0}hasStyles(t){const e=this.getSpan(t);return e?(e.formatFlags&~C)!==0||e.fgColor!==void 0||e.bgColor!==void 0||e.link!==void 0:!1}getFormatFlags(t){let e=this.getSpan(t)?.formatFlags??0;return this.getFullWidth(t)&&(e|=C),e}getFgColor(t){return this.getSpan(t)?.fgColor}getBgColor(t){return this.getSpan(t)?.bgColor}getLink(t){return this.getSpan(t)?.link}setInverted(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{e?s.formatFlags|=M:s.formatFlags&=~M})}setBackgroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.bgColor=e})}setForegroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.fgColor=e})}setChar(t,e,s,a,n,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&C)!==0,o=s&~C,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l,b=e.length;if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==b){const f=b-m;for(let S=t+1;S<this.length;S++){const T=this.charData[S],w=T&p,L=T&x;this.charData[S]=w+f|L}}if(this.charData[t]=l|(i?x:0),this.trySetStyleAtIndex(t,o,a,n,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let u=0;for(let f=0;f<this.spans.length;f++){const S=this.spans[f];if(u===t&&S.length===1){this.spans[f]={bgColor:n,fgColor:a,formatFlags:o,length:1,link:h};break}u+=S.length}this.mergeSpans()}setCharFast(t,e,s,a,n,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&C)!==0,o=s&~C,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l;if(e.length===m)e!==this.text.slice(l,c)&&(this.text=this.text.slice(0,l)+e+this.text.slice(c)),this.charData[t]=l|(i?x:0);else{if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==e.length){const u=e.length-m;for(let f=t+1;f<this.length;f++){const S=this.charData[f];this.charData[f]=(S&p)+u|S&x}}this.charData[t]=l|(i?x:0)}if(this.trySetStyleAtIndex(t,o,a,n,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let b=0;for(let u=0;u<this.spans.length;u++){const f=this.spans[u];if(b===t&&f.length===1){this.spans[u]={bgColor:n,fgColor:a,formatFlags:o,length:1,link:h};break}b+=f.length}this.mergeSpans()}writeFrom(t,e,s=0,a){const n=a??e.length-s;if(n<=0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=Math.min(n,this.length-t,e.length-s),i=this.charData[t]&p,o=t+h<this.length?this.charData[t+h]&p:this.text.length;let l="";for(let g=0;g<h;g++)l+=e.getValue(s+g);const c=o-i,m=l.length-c;this.text=this.text.slice(0,i)+l+this.text.slice(o);let b=i;for(let g=0;g<h;g++){const D=e.getFullWidth(s+g);this.charData[t+g]=b|(D?x:0),b+=e.getValue(s+g).length}if(m!==0)for(let g=t+h;g<this.length;g++){const D=this.charData[g];this.charData[g]=(D&p)+m|D&x}this.splitSpansAt(t),this.splitSpansAt(t+h);const u=[];let f=0;for(const g of e.getSpans()){const D=f+g.length,E=Math.max(s,f),K=Math.min(s+h,D);if(E<K&&u.push({...g,length:K-E}),f=D,f>=s+h)break}let S=0,T=0;for(let g=0;g<this.spans.length;g++){if(T===t){S=g;break}T+=this.spans[g].length}let w=0,L=0;for(let g=S;g<this.spans.length&&L<h;g++)L+=this.spans[g].length,w++;this.spans.splice(S,w,...u),this.mergeSpans()}pushChar(t,e,s,a,n){this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=(e&C)!==0,i=e&~C,o=this.text.length;this.text=(this.text??"")+t,this.charData.push(o|(h?x:0));const l=this.spans.at(-1);l?.formatFlags===i&&l.fgColor===s&&l.bgColor===a&&l.link===n?l.length++:this.spans.push({bgColor:a,fgColor:s,formatFlags:i,length:1,link:n}),this.length++}clone(){if(this.charData===void 0)return new d;const t=new d;return t.length=this.length,t.text=this.text,t.charData=[...this.charData],t.spans=this.spans.map(e=>({...e})),t._cachedTrimmedLength=this._cachedTrimmedLength,t}slice(t,e){if(this.charData===void 0)return new d;const s=Math.max(0,t),a=e===void 0?this.length:Math.min(this.length,e);if(s>=a)return new d;if(s===0&&a===this.length)return this.clone();const n=new d;n.length=a-s,n.charData=Array.from({length:n.length});const h=this.charData[s]&p,i=a<this.length?this.charData[a]&p:this.text.length;n.text=this.text.slice(h,i);for(let c=0;c<n.length;c++){const m=this.charData[s+c],b=m&p,u=m&x;n.charData[c]=b-h|u}const o=[];let l=0;for(const c of this.spans){const m=l,b=l+c.length,u=Math.max(s,m),f=Math.min(a,b);if(u<f&&o.push({...c,length:f-u}),l+=c.length,l>=a)break}return n.spans=o,n.mergeSpans(),n}combine(...t){if(t.length===0)return this.clone();const e=[this,...t].filter(i=>i.length>0);if(e.length===0)return new d;if(e.length===1)return e[0].clone();let s=0;for(const i of e)s+=i.length;const a=new d;a.length=s,a.text=e.map(i=>i.getText()).join(""),a.charData=Array.from({length:s});let n=0,h=0;for(const i of e){const o=i.charData,l=i.getText();if(o)for(let c=0;c<i.length;c++){const m=o[c],b=m&p,u=m&x;a.charData[n+c]=h+b|u}else for(let c=0;c<i.length;c++)a.charData[n+c]=h+c;n+=i.length,h+=l.length}return a.spans=e.flatMap(i=>i.getSpans().map(o=>({...o}))),a.mergeSpans(),a}getTrimmedLength(){if(this._cachedTrimmedLength!==void 0)return this._cachedTrimmedLength;if(this.length===0)return this._cachedTrimmedLength=0,0;if(this.text===void 0||this.charData===void 0)return this._cachedTrimmedLength=0,0;let t=this.length-1;if(this.spans)for(let e=this.spans.length-1;e>=0;e--){const s=this.spans[e];if((s.formatFlags&~C)!==0||s.fgColor!==void 0||s.bgColor!==void 0||s.link!==void 0)return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;for(let a=0;a<s.length;a++){const n=this.charData[t]&p;if((t+1<this.length?this.charData[t+1]&p:this.text.length)-n!==1||this.text[n]!==" ")return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;t--}}return this._cachedTrimmedLength=0,0}trimEnd(){const t=this.getTrimmedLength();return t===this.length?this:t===0?new d:this.slice(0,t)}equals(t){if(this.length!==t.length)return!1;if(this.length===0)return!0;if(this.getText()!==t.getText())return!1;const e=this.getSpans(),s=t.getSpans();if(e.length!==s.length)return!1;for(const[h,i]of e.entries()){const o=i,l=s[h];if(o.length!==l.length||o.formatFlags!==l.formatFlags||o.fgColor!==l.fgColor||o.bgColor!==l.bgColor||o.link!==l.link)return!1}const a=this.charData,n=t.charData;if(a&&n){for(let h=0;h<this.length;h++)if(a[h]!==n[h])return!1}return!0}getText(){return this.text??""}getSpans(){return this.spans??[]}getValues(){return Array.from({length:this.length},(t,e)=>this.getValue(e))}*[Symbol.iterator](){if(this.length===0)return;let t=0,e=0;const s=this.getSpans();for(let a=0;a<this.length;a++){const n=s[t],h=n?n.formatFlags:0,i=this.getFullWidth(a);yield{bgColor:n?.bgColor,fgColor:n?.fgColor,formatFlags:h|(i?C:0),fullWidth:i,hasStyles:(h&~C)!==0||n?.fgColor!==void 0||n?.bgColor!==void 0||n?.link!==void 0,link:n?.link,value:this.getValue(a)},n&&(e++,e>=n.length&&(t++,e=0))}}updateSpanAt(t,e){if(t<0||t>=this.length)return;this.ensureInitialized(),this.splitSpansAt(t),this.splitSpansAt(t+1);let s=0;for(const a of this.spans){if(s===t&&a.length===1){e(a);break}s+=a.length}this.mergeSpans()}ensureWidth(t){if(t<=this.length)return;this.ensureInitialized();const e=this.length,s=t-e,a=this.text.length;for(let h=0;h<s;h++)this.charData.push(a);this.length=t;const n=this.spans.at(-1);n?.formatFlags===0&&n.fgColor===void 0&&n.bgColor===void 0&&n.link===void 0?n.length+=s:this.spans.push({formatFlags:0,length:s})}ensureInitialized(){if(this.charData===void 0&&(this.text="",this.charData=Array.from({length:this.length}),this.spans=this.length>0?[{formatFlags:0,length:this.length}]:[],this.length>0&&this.text.length===0)){this.text=" ".repeat(this.length);for(let t=0;t<this.length;t++)this.charData[t]=t}}splitSpansAt(t){if(this.spans===void 0||t<=0||t>=this.length)return;let e=0;for(let s=0;s<this.spans.length;s++){const a=this.spans[s];if(t>e&&t<e+a.length){const n=t-e,h=a.length-n;this.spans.splice(s,1,{...a,length:n},{...a,length:h});return}e+=a.length}}trySetStyleAtIndex(t,e,s,a,n){if(!this.spans)return!1;let h=0,i=-1,o;for(let l=0;l<this.spans.length;l++){const c=this.spans[l];if(h<=t&&h+c.length>t){i=l,o=c;break}h+=c.length}if(!o)return!1;if(o.formatFlags===e&&o.fgColor===s&&o.bgColor===a&&o.link===n)return!0;if(t===h&&i>0){const l=this.spans[i-1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===n)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}if(t===h+o.length-1&&i<this.spans.length-1){const l=this.spans[i+1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===n)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}return!1}mergeSpans(){if(this.spans===void 0)return;const t=[];for(const e of this.spans){if(e.length===0)continue;const s=t.at(-1);s?.formatFlags===e.formatFlags&&s.fgColor===e.fgColor&&s.bgColor===e.bgColor&&s.link===e.link?s.length+=e.length:t.push({...e})}this.spans=t}}var ht=Object.defineProperty,I=k((r,t)=>ht(r,"name",{value:t,configurable:!0}),"u$2");const G={black:0,blue:4,cyan:6,gray:8,green:2,grey:8,magenta:5,red:1,white:7,yellow:3},U={blackBright:8,blueBright:12,cyanBright:14,greenBright:10,magentaBright:13,redBright:9,whiteBright:15,yellowBright:11},q=/^ansi256\(\s?(\d+)\s?\)$/,J=/^rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,Nt=I(r=>{const t=G[r];if(t!==void 0)return t;const e=U[r];if(e!==void 0)return e;const s=q.exec(r);if(s)return Number(s[1])&255;if(r.startsWith("#")&&r.length===7){const n=Number.parseInt(r.slice(1,3),16),h=Number.parseInt(r.slice(3,5),16),i=Number.parseInt(r.slice(5,7),16);return 16+36*Math.round(n/51)+6*Math.round(h/51)+Math.round(i/51)}const a=J.exec(r);return a?16+36*Math.round(Number(a[1])/51)+6*Math.round(Number(a[2])/51)+Math.round(Number(a[3])/51):255},"colorToAnsi256"),lt=I((r,t)=>{const e=t?30:40,s=G[r];if(s!==void 0)return[e+s];const a=U[r];if(a!==void 0)return[e+60+(a-8)];if(r.startsWith("#")&&r.length===7){const i=Number.parseInt(r.slice(1,3),16),o=Number.parseInt(r.slice(3,5),16),l=Number.parseInt(r.slice(5,7),16);return[t?38:48,2,i,o,l]}const n=q.exec(r);if(n)return[t?38:48,5,Number(n[1])];const h=J.exec(r);return h?[t?38:48,2,Number(h[1]),Number(h[2]),Number(h[3])]:[]},"colorToSgrParams");I((r,t)=>{const e=lt(r,t);if(e.length!==0)return`\x1B[${e.join(";")}m`},"colorToAnsiCode");const A=I(r=>{const t=["black","red","green","yellow","blue","magenta","cyan","white"];return r>=0&&r<=7?t[r]:`ansi256(${r})`},"ansi256ToColorName");var ot=Object.defineProperty,y=k((r,t)=>ot(r,"name",{value:t,configurable:!0}),"u$1");const O=y(()=>({bgColor:void 0,fgColor:void 0,formatFlags:0,link:void 0}),"createSgrState"),ct=y((r,t)=>{if(t.length===0)return O();const e=(t.includes(":")?t.replaceAll(":",";"):t).split(";").filter(o=>o.length>0).map(Number);let{bgColor:s,fgColor:a,formatFlags:n,link:h}=r,i=0;for(;i<e.length;){const o=e[i];switch(o){case 0:{n=0,a=void 0,s=void 0,h=void 0;break}case 1:{n|=at;break}case 2:{n|=nt;break}case 3:{n|=j;break}case 4:{n|=R;break}case 7:{n|=M;break}case 8:{n|=H;break}case 9:{n|=V;break}case 22:{n&=-4;break}case 23:{n&=~j;break}case 24:{n&=~R;break}case 27:{n&=~M;break}case 28:{n&=~H;break}case 29:{n&=~V;break}case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:{a=A(o-30);break}case 38:{e[i+1]===5&&e[i+2]!==void 0?(a=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(a=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 39:{a=void 0;break}case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:{s=A(o-40);break}case 48:{e[i+1]===5&&e[i+2]!==void 0?(s=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(s=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 49:{s=void 0;break}case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:{a=`ansi256(${o-90+8})`;break}case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:{s=`ansi256(${o-100+8})`;break}}i++}return{bgColor:s,fgColor:a,formatFlags:n,link:h}},"applySgrParams"),z=127462,N=127487,gt=127995,ft=127999,ut=8205,dt=917504,mt=917631,pt=new RegExp("\\p{Mark}","u"),bt=new Intl.Segmenter(void 0,{granularity:"grapheme"}),St=y((r,t)=>!!(Y(t)||r.includes("️")||t>=z&&t<=N),"isFullwidthGrapheme"),Ct=/(?:\u001B\]|\u009D)8;([^;]*);(.*?)(?:\u001B\\|\u0007|\u009C)/,xt=y(r=>{const t=Ct.exec(r);return!t?.[2]||t[2].length===0?void 0:r.endsWith("\x1B\\")?`ST:${t[2]}`:t[2]},"parseOscHyperlink"),Q=y((r,t,e)=>{const s=bt.segment(r),a=[];for(const{segment:n}of s)a.push(n);for(let n=0;n<a.length;n++){let h=a[n];if(h===" "){for(let l=0;l<4;l++)t.pushChar(" ",e.formatFlags,e.fgColor,e.bgColor,e.link);continue}if(h==="\b")continue;const i=h.codePointAt(0);if(!i)continue;if(i>=z&&i<=N&&n+1<a.length){const l=a[n+1],c=l.codePointAt(0);c&&c>=z&&c<=N&&(h+=l,n++)}else for(;n+1<a.length;){const l=a[n+1],c=l.codePointAt(0);if(!c)break;const m=pt.test(String.fromCodePoint(c)),b=c>=gt&&c<=ft,u=c===ut,f=c>=dt&&c<=mt;if(!m&&!b&&!u&&!f)break;h+=l,n++,u&&n+1<a.length&&(h+=a[n+1],n++)}const o=St(h,i)?e.formatFlags|C:e.formatFlags;t.pushChar(h,o,e.fgColor,e.bgColor,e.link)}},"processTextToken"),vt=y(r=>{if(r.length===0)return new d;const t=tt(r),e=new d;let s=O();for(const a of t)switch(a.type){case"csi":{a.finalCharacter==="m"&&(s=ct(s,a.parameterString));break}case"osc":{const n=xt(a.value);n!==void 0?s={...s,link:n}:a.value.includes("8;")&&(s={...s,link:void 0});break}case"text":{Q(a.value,e,s);break}}return e},"textToStyledLine"),kt=/^[\u0020-\u007E]*$/,$t=y(r=>{if(r.length===0)return new d;const t=new d;if(kt.test(r)){for(const e of r)t.pushChar(e,0);return t}return Q(r,t,O()),t},"plainTextToStyledLine");var Dt=Object.defineProperty,v=k((r,t)=>Dt(r,"name",{value:t,configurable:!0}),"r");const $=new _(1e4,1e6),W=new _(1e4,1e6),F=new _(1e4,1e6);let B=!0,P=Z;const Wt=v(r=>{B=r,r||F.clear()},"setEnableStyledLineCache"),Bt=v(()=>{F.clear()},"clearStyledLineCache"),_t=v(r=>{P=r,yt()},"setStringWidthFunction"),yt=v(()=>{$.clear(),W.clear(),F.clear()},"clearStringWidthCache"),Tt=v(r=>{if(r.length===1){const s=r.codePointAt(0);if(s!==void 0&&s>=32&&s<127)return 1}const t=W.get(r);if(t!==void 0)return t;let e;try{e=P(r)}catch{e=1}return W.set(r,e),e},"inkCharacterWidth"),Ft=v(r=>{try{return P(r)}catch{return 1}},"safeGetStringWidth"),Ot=v(r=>{if(r.length===0)return{height:0,width:0};const t=$.get(r);if(t)return t;const e=r.split(`
|
|
2
|
+
`);let s=0;for(const n of e){const h=Ft(n);h>s&&(s=h)}const a={height:e.length,width:s};return $.set(r,a),a},"measureText"),Pt=v(r=>{if(B){const e=F.get(r);if(e!==void 0)return e}const t=vt(r);return B&&F.set(r,t),t},"toStyledLine"),wt=v(r=>{let t=0;for(let e=0;e<r.length;e++)t+=Tt(r.getValue(e));return t},"styledLineWidth"),Lt=v(r=>{if(r.length===0)return[new d];const t=[];let e=0;for(let s=0;s<r.length;s++)r.getValue(s)===`
|
|
3
|
+
`&&(t.push(s>e?r.slice(e,s):new d),e=s+1);return t.push(e<r.length?r.slice(e):new d),t},"splitStyledLineByNewline"),Et=v(r=>{if(r.length===0)return{height:0,width:0};const t=Lt(r);let e=0;for(const s of t)e=Math.max(e,wt(s));return{height:t.length,width:e}},"measureStyledLine");export{at as B,nt as D,C as F,H,j as I,Ot as L,d as S,R as U,Bt as a,_t as b,yt as c,wt as d,M as e,V as f,lt as g,Nt as h,Tt as i,vt as j,Lt as k,Et as m,$t as p,Wt as s,Pt as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var P=Object.defineProperty;var p=(e,t)=>P(e,"name",{value:t,configurable:!0});import{createRequire as b}from"node:module";import{version as O,createContext as F}from"react";import G from"react-reconciler";import{NoEventPriority as L,DefaultEventPriority as v}from"react-reconciler/constants.js";import{unstable_shouldYield as w,unstable_scheduleCallback as k,unstable_now as B,unstable_cancelCallback as W}from"scheduler";import n from"yoga-layout";import{b as y,d as g,s as E,m as _,e as M,r as I,f as H,c as U,h as C,j as N}from"./dom-BG-LS10p.js";const re=b(import.meta.url),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=D;var Y=Object.defineProperty,u=p((e,t)=>Y(e,"name",{value:t,configurable:!0}),"t");const j=[["top",n.EDGE_TOP],["right",n.EDGE_RIGHT],["bottom",n.EDGE_BOTTOM],["left",n.EDGE_LEFT]],X=u((e,t)=>{if("position"in t){let r=n.POSITION_TYPE_RELATIVE;t.position==="absolute"?r=n.POSITION_TYPE_ABSOLUTE:t.position==="static"&&(r=n.POSITION_TYPE_STATIC),e.setPositionType(r)}for(const[r,s]of j){if(!(r in t))continue;const l=t[r];if(typeof l=="string"){e.setPositionPercent(s,Number.parseFloat(l));continue}e.setPosition(s,l)}},"applyPositionStyles"),V=u((e,t)=>{"margin"in t&&e.setMargin(n.EDGE_ALL,t.margin??0),"marginX"in t&&e.setMargin(n.EDGE_HORIZONTAL,t.marginX??0),"marginY"in t&&e.setMargin(n.EDGE_VERTICAL,t.marginY??0),"marginLeft"in t&&e.setMargin(n.EDGE_START,t.marginLeft||0),"marginRight"in t&&e.setMargin(n.EDGE_END,t.marginRight||0),"marginTop"in t&&e.setMargin(n.EDGE_TOP,t.marginTop||0),"marginBottom"in t&&e.setMargin(n.EDGE_BOTTOM,t.marginBottom||0)},"applyMarginStyles"),J=u((e,t)=>{"padding"in t&&e.setPadding(n.EDGE_ALL,t.padding??0),"paddingX"in t&&e.setPadding(n.EDGE_HORIZONTAL,t.paddingX??0),"paddingY"in t&&e.setPadding(n.EDGE_VERTICAL,t.paddingY??0),"paddingLeft"in t&&e.setPadding(n.EDGE_LEFT,t.paddingLeft||0),"paddingRight"in t&&e.setPadding(n.EDGE_RIGHT,t.paddingRight||0),"paddingTop"in t&&e.setPadding(n.EDGE_TOP,t.paddingTop||0),"paddingBottom"in t&&e.setPadding(n.EDGE_BOTTOM,t.paddingBottom||0)},"applyPaddingStyles"),q=u((e,t)=>{"flexGrow"in t&&e.setFlexGrow(t.flexGrow??0),"flexShrink"in t&&e.setFlexShrink(typeof t.flexShrink=="number"?t.flexShrink:1),"flexWrap"in t&&(t.flexWrap==="nowrap"&&e.setFlexWrap(n.WRAP_NO_WRAP),t.flexWrap==="wrap"&&e.setFlexWrap(n.WRAP_WRAP),t.flexWrap==="wrap-reverse"&&e.setFlexWrap(n.WRAP_WRAP_REVERSE)),"flexDirection"in t&&(t.flexDirection==="row"&&e.setFlexDirection(n.FLEX_DIRECTION_ROW),t.flexDirection==="row-reverse"&&e.setFlexDirection(n.FLEX_DIRECTION_ROW_REVERSE),t.flexDirection==="column"&&e.setFlexDirection(n.FLEX_DIRECTION_COLUMN),t.flexDirection==="column-reverse"&&e.setFlexDirection(n.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in t&&(typeof t.flexBasis=="number"?e.setFlexBasis(t.flexBasis):typeof t.flexBasis=="string"?e.setFlexBasisPercent(Number.parseInt(t.flexBasis,10)):e.setFlexBasis(Number.NaN)),"alignItems"in t&&((t.alignItems==="stretch"||!t.alignItems)&&e.setAlignItems(n.ALIGN_STRETCH),t.alignItems==="flex-start"&&e.setAlignItems(n.ALIGN_FLEX_START),t.alignItems==="center"&&e.setAlignItems(n.ALIGN_CENTER),t.alignItems==="flex-end"&&e.setAlignItems(n.ALIGN_FLEX_END),t.alignItems==="baseline"&&e.setAlignItems(n.ALIGN_BASELINE)),"alignSelf"in t&&((t.alignSelf==="auto"||!t.alignSelf)&&e.setAlignSelf(n.ALIGN_AUTO),t.alignSelf==="flex-start"&&e.setAlignSelf(n.ALIGN_FLEX_START),t.alignSelf==="center"&&e.setAlignSelf(n.ALIGN_CENTER),t.alignSelf==="flex-end"&&e.setAlignSelf(n.ALIGN_FLEX_END),t.alignSelf==="stretch"&&e.setAlignSelf(n.ALIGN_STRETCH),t.alignSelf==="baseline"&&e.setAlignSelf(n.ALIGN_BASELINE)),"alignContent"in t&&((t.alignContent==="flex-start"||!t.alignContent)&&e.setAlignContent(n.ALIGN_FLEX_START),t.alignContent==="center"&&e.setAlignContent(n.ALIGN_CENTER),t.alignContent==="flex-end"&&e.setAlignContent(n.ALIGN_FLEX_END),t.alignContent==="space-between"&&e.setAlignContent(n.ALIGN_SPACE_BETWEEN),t.alignContent==="space-around"&&e.setAlignContent(n.ALIGN_SPACE_AROUND),t.alignContent==="space-evenly"&&e.setAlignContent(n.ALIGN_SPACE_EVENLY),t.alignContent==="stretch"&&e.setAlignContent(n.ALIGN_STRETCH)),"justifyContent"in t&&((t.justifyContent==="flex-start"||!t.justifyContent)&&e.setJustifyContent(n.JUSTIFY_FLEX_START),t.justifyContent==="center"&&e.setJustifyContent(n.JUSTIFY_CENTER),t.justifyContent==="flex-end"&&e.setJustifyContent(n.JUSTIFY_FLEX_END),t.justifyContent==="space-between"&&e.setJustifyContent(n.JUSTIFY_SPACE_BETWEEN),t.justifyContent==="space-around"&&e.setJustifyContent(n.JUSTIFY_SPACE_AROUND),t.justifyContent==="space-evenly"&&e.setJustifyContent(n.JUSTIFY_SPACE_EVENLY))},"applyFlexStyles"),$=u((e,t)=>{"width"in t&&(typeof t.width=="number"?e.setWidth(t.width):typeof t.width=="string"?e.setWidthPercent(Number.parseInt(t.width,10)):e.setWidthAuto()),"height"in t&&(typeof t.height=="number"?e.setHeight(t.height):typeof t.height=="string"?e.setHeightPercent(Number.parseInt(t.height,10)):e.setHeightAuto()),"minWidth"in t&&(typeof t.minWidth=="string"?e.setMinWidthPercent(Number.parseInt(t.minWidth,10)):e.setMinWidth(t.minWidth??0)),"minHeight"in t&&(typeof t.minHeight=="string"?e.setMinHeightPercent(Number.parseInt(t.minHeight,10)):e.setMinHeight(t.minHeight??0)),"maxWidth"in t&&(typeof t.maxWidth=="string"?e.setMaxWidthPercent(Number.parseInt(t.maxWidth,10)):e.setMaxWidth(t.maxWidth)),"maxHeight"in t&&(typeof t.maxHeight=="string"?e.setMaxHeightPercent(Number.parseInt(t.maxHeight,10)):e.setMaxHeight(t.maxHeight)),"aspectRatio"in t&&e.setAspectRatio(t.aspectRatio)},"applyDimensionStyles"),z=u((e,t)=>{"display"in t&&e.setDisplay(t.display==="flex"?n.DISPLAY_FLEX:n.DISPLAY_NONE)},"applyDisplayStyles"),Z=u((e,t,r)=>{if(!("borderStyle"in t||"borderTop"in t||"borderBottom"in t||"borderLeft"in t||"borderRight"in t))return;const s=r.borderStyle?1:0;e.setBorder(n.EDGE_TOP,r.borderTop===!1?0:s),e.setBorder(n.EDGE_BOTTOM,r.borderBottom===!1?0:s),e.setBorder(n.EDGE_LEFT,r.borderLeft===!1?0:s),e.setBorder(n.EDGE_RIGHT,r.borderRight===!1?0:s)},"applyBorderStyles"),K=u((e,t)=>{"gap"in t&&e.setGap(n.GUTTER_ALL,t.gap??0),"columnGap"in t&&e.setGap(n.GUTTER_COLUMN,t.columnGap??0),"rowGap"in t&&e.setGap(n.GUTTER_ROW,t.rowGap??0)},"applyGapStyles"),Q=u((e,t)=>{const r=t.overflow??"visible",s=t.overflowX??r,l=t.overflowY??r;s==="scroll"||l==="scroll"?e.setOverflow(n.OVERFLOW_SCROLL):s==="hidden"||l==="hidden"?e.setOverflow(n.OVERFLOW_HIDDEN):e.setOverflow(n.OVERFLOW_VISIBLE)},"applyOverflowStyles"),S=u((e,t={},r=t)=>{X(e,t),V(e,t),J(e,t),q(e,t),$(e,t),z(e,t),Z(e,t,r),K(e,t),Q(e,r)},"styles");var ee=Object.defineProperty,c=p((e,t)=>ee(e,"name",{value:t,configurable:!0}),"c");if(A.env.DEV==="true"){let e=!1;try{import.meta.resolve("react-devtools-core"),e=!0}catch{}e&&await import("../packem_chunks/devtools.js")}const x=c((e,t)=>{if(e===t)return;if(!e)return t;const r={};let s=!1;for(const l of Object.keys(e))(!t||!Object.hasOwn(t,l))&&(r[l]=void 0,s=!0);if(t)for(const l of Object.keys(t))t[l]!==e[l]&&(r[l]=t[l],s=!0);return s?r:void 0},"diff"),h=c(e=>{if(e){if(e.yogaNode?.unsetMeasureFunc(),"resizeObservers"in e&&e.resizeObservers?.clear(),"childNodes"in e&&e.childNodes)for(const t of e.childNodes)h(t);e.yogaNode?.free(),"cachedRender"in e&&(e.cachedRender=void 0),"childNodes"in e&&(e.childNodes=[]),e.parentNode=void 0}},"cleanupNodeTree");let m=L,T;async function R(){const e=(await import("node:fs")).readFileSync(new URL("../package.json",import.meta.url),"utf8"),t=JSON.parse(e);return{name:t?.name,version:t?.version}}p(R,"B");c(R,"loadPackageJson");let f={name:"ink",version:O};if(A.env.DEV==="true")try{const e=await R();f={name:e.name||f.name,version:e.version||f.version}}catch(e){console.warn("Failed to load package.json in development mode. Falling back to default renderer metadata.",e)}const de=G({afterActiveInstanceBlur(){},appendChild:g,appendChildToContainer:g,appendInitialChild:g,beforeActiveInstanceBlur(){},cancelCallback:W,cancelTimeout:clearTimeout,clearContainer:c(()=>!1,"clearContainer"),commitTextUpdate(e,t,r){E(e,r)},commitUpdate(e,t,r,s){T&&e.internal_static&&(T.isStaticDirty=!0);const l=x(r,s),a=x(r.style,s.style);if(!l&&!a)return;let i=!!a;if(l){for(const[o,d]of Object.entries(l))if(o!=="children"){if(o==="style"){C(e,d);continue}if(o==="internal_transform"){e.internal_transform=d,i=!0;continue}if(o==="internal_cursor"){e.internal_cursor=d,i=!0;continue}if(o==="internal_static"){e.internal_static=!0,i=!0;continue}if(o==="sticky"){e.internal_sticky=d,i=!0;continue}if(o==="internalStickyAlternate"){e.internal_stickyAlternate=d,i=!0;continue}if(o==="opaque"){e.internal_opaque=d,i=!0;continue}if(o==="scrollbar"){e.internal_scrollbar=d,i=!0;continue}if(o==="internal_terminalCursorFocus"){e.internal_terminalCursorFocus=d,i=!0;continue}if(o==="internal_terminalCursorPosition"){e.internal_terminalCursorPosition=d,i=!0;continue}if(o==="cachedRender"){e.cachedRender=d,i=!0;continue}N(e,o,d),i=!0}}a&&e.yogaNode&&S(e.yogaNode,a,s.style??{}),i&&_(e)},createInstance(e,t,r,s){if(s.isInsideText&&e==="ink-box")throw new Error("<Box> can’t be nested inside <Text> component");if(s.isInsideText&&e==="ink-cursor")throw new Error("<Cursor> can’t be nested inside <Text> component");const l=e==="ink-text"&&s.isInsideText?"ink-virtual-text":e,a=U(l);for(const[i,o]of Object.entries(t))if(i!=="children"){if(i==="style"){C(a,o),a.yogaNode&&S(a.yogaNode,o);continue}if(i==="internal_transform"){a.internal_transform=o;continue}if(i==="internal_cursor"){a.internal_cursor=o;continue}if(i==="internal_static"){T=r,a.internal_static=!0,r.isStaticDirty=!0,r.staticNode=a;continue}if(i==="sticky"){a.internal_sticky=o;continue}if(i==="internalStickyAlternate"){a.internal_stickyAlternate=o;continue}if(i==="opaque"){a.internal_opaque=o;continue}if(i==="scrollbar"){a.internal_scrollbar=o;continue}if(i==="internal_terminalCursorFocus"){a.internal_terminalCursorFocus=o;continue}if(i==="internal_terminalCursorPosition"){a.internal_terminalCursorPosition=o;continue}if(i==="internal_static"){a.internal_static=!0;continue}if(i==="cachedRender"){a.cachedRender=o;continue}N(a,i,o)}return a},createTextInstance(e,t,r){if(!r.isInsideText)throw new Error(`Text string "${e}" must be rendered inside <Text> component`);return H(e)},detachDeletedInstance(){},finalizeInitialChildren(){return!1},getChildHostContext(e,t){const r=e.isInsideText,s=t==="ink-text"||t==="ink-virtual-text";return r===s?e:{isInsideText:s}},getCurrentUpdatePriority:c(()=>m,"getCurrentUpdatePriority"),getInstanceFromNode:c(()=>null,"getInstanceFromNode"),getInstanceFromScope:c(()=>null,"getInstanceFromScope"),getPublicInstance:c(e=>e,"getPublicInstance"),getRootHostContext:c(()=>({isInsideText:!1}),"getRootHostContext"),hideInstance(e){e.internal_hidden=!0,e.yogaNode?.setDisplay(n.DISPLAY_NONE),_(e)},hideTextInstance(e){E(e,"")},HostTransitionContext:F(null),insertBefore:y,insertInContainerBefore:y,isPrimaryRenderer:!0,maySuspendCommit(){return!0},noTimeout:-1,NotPendingTransition:void 0,now:B,preloadInstance(){return!0},prepareForCommit:c(()=>null,"prepareForCommit"),preparePortalMount:c(()=>null,"preparePortalMount"),prepareScopeUpdate(){},removeChild(e,t){I(e,t),h(t)},removeChildFromContainer(e,t){I(e,t),h(t)},rendererPackageName:f.name,rendererVersion:f.version,requestPostPaintCallback(){},resetAfterCommit(e){if(typeof e.onComputeLayout=="function"&&e.onComputeLayout(),M(e),e.staticNode!==e.previousStaticNode&&(e.previousStaticNode=e.staticNode,typeof e.onStaticChange=="function"&&e.onStaticChange()),e.isStaticDirty){e.isStaticDirty=!1,typeof e.onImmediateRender=="function"&&e.onImmediateRender();return}typeof e.onRender=="function"&&e.onRender()},resetFormInstance(){},resetTextContent(){},resolveEventTimeStamp(){return-1.1},resolveEventType(){return null},resolveUpdatePriority(){return m!==L?m:v},scheduleCallback:k,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(e){m=e},shouldAttemptEagerTransition(){return!1},shouldSetTextContent:c(()=>!1,"shouldSetTextContent"),shouldYield:w,startSuspendingCommit(){},supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance(){},trackSchedulerEvent(){},unhideInstance(e){e.internal_hidden=!1,e.yogaNode?.setDisplay(n.DISPLAY_FLEX),_(e)},unhideTextInstance(e,t){E(e,t)},waitForCommitToBeReady(){return null}});export{de as L,S as u};
|
|
1
|
+
var P=Object.defineProperty;var p=(e,t)=>P(e,"name",{value:t,configurable:!0});import{createRequire as b}from"node:module";import{version as O,createContext as F}from"react";import G from"react-reconciler";import{NoEventPriority as L,DefaultEventPriority as v}from"react-reconciler/constants.js";import{unstable_shouldYield as w,unstable_scheduleCallback as k,unstable_now as B,unstable_cancelCallback as W}from"scheduler";import n from"yoga-layout";import{b as y,d as g,s as E,m as _,e as M,r as I,f as H,c as U,h as C,j as N}from"./dom-CXB-19sK.js";const re=b(import.meta.url),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=D;var Y=Object.defineProperty,u=p((e,t)=>Y(e,"name",{value:t,configurable:!0}),"t");const j=[["top",n.EDGE_TOP],["right",n.EDGE_RIGHT],["bottom",n.EDGE_BOTTOM],["left",n.EDGE_LEFT]],X=u((e,t)=>{if("position"in t){let r=n.POSITION_TYPE_RELATIVE;t.position==="absolute"?r=n.POSITION_TYPE_ABSOLUTE:t.position==="static"&&(r=n.POSITION_TYPE_STATIC),e.setPositionType(r)}for(const[r,s]of j){if(!(r in t))continue;const l=t[r];if(typeof l=="string"){e.setPositionPercent(s,Number.parseFloat(l));continue}e.setPosition(s,l)}},"applyPositionStyles"),V=u((e,t)=>{"margin"in t&&e.setMargin(n.EDGE_ALL,t.margin??0),"marginX"in t&&e.setMargin(n.EDGE_HORIZONTAL,t.marginX??0),"marginY"in t&&e.setMargin(n.EDGE_VERTICAL,t.marginY??0),"marginLeft"in t&&e.setMargin(n.EDGE_START,t.marginLeft||0),"marginRight"in t&&e.setMargin(n.EDGE_END,t.marginRight||0),"marginTop"in t&&e.setMargin(n.EDGE_TOP,t.marginTop||0),"marginBottom"in t&&e.setMargin(n.EDGE_BOTTOM,t.marginBottom||0)},"applyMarginStyles"),J=u((e,t)=>{"padding"in t&&e.setPadding(n.EDGE_ALL,t.padding??0),"paddingX"in t&&e.setPadding(n.EDGE_HORIZONTAL,t.paddingX??0),"paddingY"in t&&e.setPadding(n.EDGE_VERTICAL,t.paddingY??0),"paddingLeft"in t&&e.setPadding(n.EDGE_LEFT,t.paddingLeft||0),"paddingRight"in t&&e.setPadding(n.EDGE_RIGHT,t.paddingRight||0),"paddingTop"in t&&e.setPadding(n.EDGE_TOP,t.paddingTop||0),"paddingBottom"in t&&e.setPadding(n.EDGE_BOTTOM,t.paddingBottom||0)},"applyPaddingStyles"),q=u((e,t)=>{"flexGrow"in t&&e.setFlexGrow(t.flexGrow??0),"flexShrink"in t&&e.setFlexShrink(typeof t.flexShrink=="number"?t.flexShrink:1),"flexWrap"in t&&(t.flexWrap==="nowrap"&&e.setFlexWrap(n.WRAP_NO_WRAP),t.flexWrap==="wrap"&&e.setFlexWrap(n.WRAP_WRAP),t.flexWrap==="wrap-reverse"&&e.setFlexWrap(n.WRAP_WRAP_REVERSE)),"flexDirection"in t&&(t.flexDirection==="row"&&e.setFlexDirection(n.FLEX_DIRECTION_ROW),t.flexDirection==="row-reverse"&&e.setFlexDirection(n.FLEX_DIRECTION_ROW_REVERSE),t.flexDirection==="column"&&e.setFlexDirection(n.FLEX_DIRECTION_COLUMN),t.flexDirection==="column-reverse"&&e.setFlexDirection(n.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in t&&(typeof t.flexBasis=="number"?e.setFlexBasis(t.flexBasis):typeof t.flexBasis=="string"?e.setFlexBasisPercent(Number.parseInt(t.flexBasis,10)):e.setFlexBasis(Number.NaN)),"alignItems"in t&&((t.alignItems==="stretch"||!t.alignItems)&&e.setAlignItems(n.ALIGN_STRETCH),t.alignItems==="flex-start"&&e.setAlignItems(n.ALIGN_FLEX_START),t.alignItems==="center"&&e.setAlignItems(n.ALIGN_CENTER),t.alignItems==="flex-end"&&e.setAlignItems(n.ALIGN_FLEX_END),t.alignItems==="baseline"&&e.setAlignItems(n.ALIGN_BASELINE)),"alignSelf"in t&&((t.alignSelf==="auto"||!t.alignSelf)&&e.setAlignSelf(n.ALIGN_AUTO),t.alignSelf==="flex-start"&&e.setAlignSelf(n.ALIGN_FLEX_START),t.alignSelf==="center"&&e.setAlignSelf(n.ALIGN_CENTER),t.alignSelf==="flex-end"&&e.setAlignSelf(n.ALIGN_FLEX_END),t.alignSelf==="stretch"&&e.setAlignSelf(n.ALIGN_STRETCH),t.alignSelf==="baseline"&&e.setAlignSelf(n.ALIGN_BASELINE)),"alignContent"in t&&((t.alignContent==="flex-start"||!t.alignContent)&&e.setAlignContent(n.ALIGN_FLEX_START),t.alignContent==="center"&&e.setAlignContent(n.ALIGN_CENTER),t.alignContent==="flex-end"&&e.setAlignContent(n.ALIGN_FLEX_END),t.alignContent==="space-between"&&e.setAlignContent(n.ALIGN_SPACE_BETWEEN),t.alignContent==="space-around"&&e.setAlignContent(n.ALIGN_SPACE_AROUND),t.alignContent==="space-evenly"&&e.setAlignContent(n.ALIGN_SPACE_EVENLY),t.alignContent==="stretch"&&e.setAlignContent(n.ALIGN_STRETCH)),"justifyContent"in t&&((t.justifyContent==="flex-start"||!t.justifyContent)&&e.setJustifyContent(n.JUSTIFY_FLEX_START),t.justifyContent==="center"&&e.setJustifyContent(n.JUSTIFY_CENTER),t.justifyContent==="flex-end"&&e.setJustifyContent(n.JUSTIFY_FLEX_END),t.justifyContent==="space-between"&&e.setJustifyContent(n.JUSTIFY_SPACE_BETWEEN),t.justifyContent==="space-around"&&e.setJustifyContent(n.JUSTIFY_SPACE_AROUND),t.justifyContent==="space-evenly"&&e.setJustifyContent(n.JUSTIFY_SPACE_EVENLY))},"applyFlexStyles"),$=u((e,t)=>{"width"in t&&(typeof t.width=="number"?e.setWidth(t.width):typeof t.width=="string"?e.setWidthPercent(Number.parseInt(t.width,10)):e.setWidthAuto()),"height"in t&&(typeof t.height=="number"?e.setHeight(t.height):typeof t.height=="string"?e.setHeightPercent(Number.parseInt(t.height,10)):e.setHeightAuto()),"minWidth"in t&&(typeof t.minWidth=="string"?e.setMinWidthPercent(Number.parseInt(t.minWidth,10)):e.setMinWidth(t.minWidth??0)),"minHeight"in t&&(typeof t.minHeight=="string"?e.setMinHeightPercent(Number.parseInt(t.minHeight,10)):e.setMinHeight(t.minHeight??0)),"maxWidth"in t&&(typeof t.maxWidth=="string"?e.setMaxWidthPercent(Number.parseInt(t.maxWidth,10)):e.setMaxWidth(t.maxWidth)),"maxHeight"in t&&(typeof t.maxHeight=="string"?e.setMaxHeightPercent(Number.parseInt(t.maxHeight,10)):e.setMaxHeight(t.maxHeight)),"aspectRatio"in t&&e.setAspectRatio(t.aspectRatio)},"applyDimensionStyles"),z=u((e,t)=>{"display"in t&&e.setDisplay(t.display==="flex"?n.DISPLAY_FLEX:n.DISPLAY_NONE)},"applyDisplayStyles"),Z=u((e,t,r)=>{if(!("borderStyle"in t||"borderTop"in t||"borderBottom"in t||"borderLeft"in t||"borderRight"in t))return;const s=r.borderStyle?1:0;e.setBorder(n.EDGE_TOP,r.borderTop===!1?0:s),e.setBorder(n.EDGE_BOTTOM,r.borderBottom===!1?0:s),e.setBorder(n.EDGE_LEFT,r.borderLeft===!1?0:s),e.setBorder(n.EDGE_RIGHT,r.borderRight===!1?0:s)},"applyBorderStyles"),K=u((e,t)=>{"gap"in t&&e.setGap(n.GUTTER_ALL,t.gap??0),"columnGap"in t&&e.setGap(n.GUTTER_COLUMN,t.columnGap??0),"rowGap"in t&&e.setGap(n.GUTTER_ROW,t.rowGap??0)},"applyGapStyles"),Q=u((e,t)=>{const r=t.overflow??"visible",s=t.overflowX??r,l=t.overflowY??r;s==="scroll"||l==="scroll"?e.setOverflow(n.OVERFLOW_SCROLL):s==="hidden"||l==="hidden"?e.setOverflow(n.OVERFLOW_HIDDEN):e.setOverflow(n.OVERFLOW_VISIBLE)},"applyOverflowStyles"),S=u((e,t={},r=t)=>{X(e,t),V(e,t),J(e,t),q(e,t),$(e,t),z(e,t),Z(e,t,r),K(e,t),Q(e,r)},"styles");var ee=Object.defineProperty,c=p((e,t)=>ee(e,"name",{value:t,configurable:!0}),"c");if(A.env.DEV==="true"){let e=!1;try{import.meta.resolve("react-devtools-core"),e=!0}catch{}e&&await import("../packem_chunks/devtools.js")}const x=c((e,t)=>{if(e===t)return;if(!e)return t;const r={};let s=!1;for(const l of Object.keys(e))(!t||!Object.hasOwn(t,l))&&(r[l]=void 0,s=!0);if(t)for(const l of Object.keys(t))t[l]!==e[l]&&(r[l]=t[l],s=!0);return s?r:void 0},"diff"),h=c(e=>{if(e){if(e.yogaNode?.unsetMeasureFunc(),"resizeObservers"in e&&e.resizeObservers?.clear(),"childNodes"in e&&e.childNodes)for(const t of e.childNodes)h(t);e.yogaNode?.free(),"cachedRender"in e&&(e.cachedRender=void 0),"childNodes"in e&&(e.childNodes=[]),e.parentNode=void 0}},"cleanupNodeTree");let m=L,T;async function R(){const e=(await import("node:fs")).readFileSync(new URL("../package.json",import.meta.url),"utf8"),t=JSON.parse(e);return{name:t?.name,version:t?.version}}p(R,"B");c(R,"loadPackageJson");let f={name:"ink",version:O};if(A.env.DEV==="true")try{const e=await R();f={name:e.name||f.name,version:e.version||f.version}}catch(e){console.warn("Failed to load package.json in development mode. Falling back to default renderer metadata.",e)}const de=G({afterActiveInstanceBlur(){},appendChild:g,appendChildToContainer:g,appendInitialChild:g,beforeActiveInstanceBlur(){},cancelCallback:W,cancelTimeout:clearTimeout,clearContainer:c(()=>!1,"clearContainer"),commitTextUpdate(e,t,r){E(e,r)},commitUpdate(e,t,r,s){T&&e.internal_static&&(T.isStaticDirty=!0);const l=x(r,s),a=x(r.style,s.style);if(!l&&!a)return;let i=!!a;if(l){for(const[o,d]of Object.entries(l))if(o!=="children"){if(o==="style"){C(e,d);continue}if(o==="internal_transform"){e.internal_transform=d,i=!0;continue}if(o==="internal_cursor"){e.internal_cursor=d,i=!0;continue}if(o==="internal_static"){e.internal_static=!0,i=!0;continue}if(o==="sticky"){e.internal_sticky=d,i=!0;continue}if(o==="internalStickyAlternate"){e.internal_stickyAlternate=d,i=!0;continue}if(o==="opaque"){e.internal_opaque=d,i=!0;continue}if(o==="scrollbar"){e.internal_scrollbar=d,i=!0;continue}if(o==="internal_terminalCursorFocus"){e.internal_terminalCursorFocus=d,i=!0;continue}if(o==="internal_terminalCursorPosition"){e.internal_terminalCursorPosition=d,i=!0;continue}if(o==="cachedRender"){e.cachedRender=d,i=!0;continue}N(e,o,d),i=!0}}a&&e.yogaNode&&S(e.yogaNode,a,s.style??{}),i&&_(e)},createInstance(e,t,r,s){if(s.isInsideText&&e==="ink-box")throw new Error("<Box> can’t be nested inside <Text> component");if(s.isInsideText&&e==="ink-cursor")throw new Error("<Cursor> can’t be nested inside <Text> component");const l=e==="ink-text"&&s.isInsideText?"ink-virtual-text":e,a=U(l);for(const[i,o]of Object.entries(t))if(i!=="children"){if(i==="style"){C(a,o),a.yogaNode&&S(a.yogaNode,o);continue}if(i==="internal_transform"){a.internal_transform=o;continue}if(i==="internal_cursor"){a.internal_cursor=o;continue}if(i==="internal_static"){T=r,a.internal_static=!0,r.isStaticDirty=!0,r.staticNode=a;continue}if(i==="sticky"){a.internal_sticky=o;continue}if(i==="internalStickyAlternate"){a.internal_stickyAlternate=o;continue}if(i==="opaque"){a.internal_opaque=o;continue}if(i==="scrollbar"){a.internal_scrollbar=o;continue}if(i==="internal_terminalCursorFocus"){a.internal_terminalCursorFocus=o;continue}if(i==="internal_terminalCursorPosition"){a.internal_terminalCursorPosition=o;continue}if(i==="internal_static"){a.internal_static=!0;continue}if(i==="cachedRender"){a.cachedRender=o;continue}N(a,i,o)}return a},createTextInstance(e,t,r){if(!r.isInsideText)throw new Error(`Text string "${e}" must be rendered inside <Text> component`);return H(e)},detachDeletedInstance(){},finalizeInitialChildren(){return!1},getChildHostContext(e,t){const r=e.isInsideText,s=t==="ink-text"||t==="ink-virtual-text";return r===s?e:{isInsideText:s}},getCurrentUpdatePriority:c(()=>m,"getCurrentUpdatePriority"),getInstanceFromNode:c(()=>null,"getInstanceFromNode"),getInstanceFromScope:c(()=>null,"getInstanceFromScope"),getPublicInstance:c(e=>e,"getPublicInstance"),getRootHostContext:c(()=>({isInsideText:!1}),"getRootHostContext"),hideInstance(e){e.internal_hidden=!0,e.yogaNode?.setDisplay(n.DISPLAY_NONE),_(e)},hideTextInstance(e){E(e,"")},HostTransitionContext:F(null),insertBefore:y,insertInContainerBefore:y,isPrimaryRenderer:!0,maySuspendCommit(){return!0},noTimeout:-1,NotPendingTransition:void 0,now:B,preloadInstance(){return!0},prepareForCommit:c(()=>null,"prepareForCommit"),preparePortalMount:c(()=>null,"preparePortalMount"),prepareScopeUpdate(){},removeChild(e,t){I(e,t),h(t)},removeChildFromContainer(e,t){I(e,t),h(t)},rendererPackageName:f.name,rendererVersion:f.version,requestPostPaintCallback(){},resetAfterCommit(e){if(typeof e.onComputeLayout=="function"&&e.onComputeLayout(),M(e),e.staticNode!==e.previousStaticNode&&(e.previousStaticNode=e.staticNode,typeof e.onStaticChange=="function"&&e.onStaticChange()),e.isStaticDirty){e.isStaticDirty=!1,typeof e.onImmediateRender=="function"&&e.onImmediateRender();return}typeof e.onRender=="function"&&e.onRender()},resetFormInstance(){},resetTextContent(){},resolveEventTimeStamp(){return-1.1},resolveEventType(){return null},resolveUpdatePriority(){return m!==L?m:v},scheduleCallback:k,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(e){m=e},shouldAttemptEagerTransition(){return!1},shouldSetTextContent:c(()=>!1,"shouldSetTextContent"),shouldYield:w,startSuspendingCommit(){},supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance(){},trackSchedulerEvent(){},unhideInstance(e){e.internal_hidden=!1,e.yogaNode?.setDisplay(n.DISPLAY_FLEX),_(e)},unhideTextInstance(e,t){E(e,t)},waitForCommitToBeReady(){return null}});export{de as L,S as u};
|