gsd-pi 2.64.0-dev.cbb05a1 → 2.64.0-dev.cc2cef3
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/dist/resources/extensions/gsd/notification-overlay.js +41 -13
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +15 -15
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +15 -15
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +2 -2
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/package.json +1 -1
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js +14 -0
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.js +3 -2
- package/packages/pi-tui/dist/overlay-layout.js.map +1 -1
- package/packages/pi-tui/src/__tests__/overlay-layout.test.ts +17 -0
- package/packages/pi-tui/src/overlay-layout.ts +3 -2
- package/src/resources/extensions/gsd/notification-overlay.ts +38 -15
- package/src/resources/extensions/gsd/tests/notification-overlay.test.ts +73 -0
- /package/dist/web/standalone/.next/static/{6VY044iEgB5gScn5oawg3 → kOmg_dJ8TT33Q12mP5qZc}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{6VY044iEgB5gScn5oawg3 → kOmg_dJ8TT33Q12mP5qZc}/_ssgManifest.js +0 -0
|
@@ -14,7 +14,7 @@ f:I[90484,[],"MetadataBoundary"]
|
|
|
14
14
|
:HL["/_next/static/media/93f479601ee12b01-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
|
|
15
15
|
:HL["/_next/static/css/de70bee13400563f.css","style"]
|
|
16
16
|
:HL["/_next/static/css/f6e8833d46e738d8.css","style"]
|
|
17
|
-
0:{"P":null,"b":"
|
|
17
|
+
0:{"P":null,"b":"kOmg_dJ8TT33Q12mP5qZc","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/de70bee13400563f.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/f6e8833d46e738d8.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_188709 __variable_9a8899 font-sans antialiased","children":["$","$L2",null,{"attribute":"class","defaultTheme":"dark","children":[["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}],["$","$L5",null,{"position":"bottom-right"}]]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L6",null,{"Component":"$7","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@8","$@9"]}}],null,["$","$La",null,{"children":["$","$b",null,{"name":"Next.MetadataOutlet","children":"$@c"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Ld",null,{"children":"$Le"}],["$","div",null,{"hidden":true,"children":["$","$Lf",null,{"children":["$","$b",null,{"name":"Next.Metadata","children":"$L10"}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],false]],"m":"$undefined","G":["$11",[]],"S":true}
|
|
18
18
|
8:{}
|
|
19
19
|
9:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params"
|
|
20
20
|
e:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
3:I[66919,["8974","static/chunks/app/page-0c485498795110d6.js"],"default"]
|
|
4
4
|
6:I[90484,[],"OutletBoundary"]
|
|
5
5
|
7:"$Sreact.suspense"
|
|
6
|
-
0:{"buildId":"
|
|
6
|
+
0:{"buildId":"kOmg_dJ8TT33Q12mP5qZc","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],null,["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false}
|
|
7
7
|
4:{}
|
|
8
8
|
5:"$0:rsc:props:children:0:props:serverProvidedParams:params"
|
|
9
9
|
8:null
|
|
@@ -14,7 +14,7 @@ f:I[90484,[],"MetadataBoundary"]
|
|
|
14
14
|
:HL["/_next/static/media/93f479601ee12b01-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
|
|
15
15
|
:HL["/_next/static/css/de70bee13400563f.css","style"]
|
|
16
16
|
:HL["/_next/static/css/f6e8833d46e738d8.css","style"]
|
|
17
|
-
0:{"P":null,"b":"
|
|
17
|
+
0:{"P":null,"b":"kOmg_dJ8TT33Q12mP5qZc","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/de70bee13400563f.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/f6e8833d46e738d8.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_188709 __variable_9a8899 font-sans antialiased","children":["$","$L2",null,{"attribute":"class","defaultTheme":"dark","children":[["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}],["$","$L5",null,{"position":"bottom-right"}]]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L6",null,{"Component":"$7","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@8","$@9"]}}],null,["$","$La",null,{"children":["$","$b",null,{"name":"Next.MetadataOutlet","children":"$@c"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Ld",null,{"children":"$Le"}],["$","div",null,{"hidden":true,"children":["$","$Lf",null,{"children":["$","$b",null,{"name":"Next.Metadata","children":"$L10"}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],false]],"m":"$undefined","G":["$11",[]],"S":true}
|
|
18
18
|
8:{}
|
|
19
19
|
9:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params"
|
|
20
20
|
e:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
3:I[90484,[],"MetadataBoundary"]
|
|
4
4
|
4:"$Sreact.suspense"
|
|
5
5
|
5:I[86869,[],"IconMark"]
|
|
6
|
-
0:{"buildId":"
|
|
6
|
+
0:{"buildId":"kOmg_dJ8TT33Q12mP5qZc","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"GSD"}],["$","meta","1",{"name":"description","content":"The evolution of Get Shit Done — now a real coding agent. One command. Walk away. Come back to a built project."}],["$","meta","2",{"name":"application-name","content":"GSD"}],["$","link","3",{"rel":"icon","href":"/icon-light-32x32.png","media":"(prefers-color-scheme: light)"}],["$","link","4",{"rel":"icon","href":"/icon-dark-32x32.png","media":"(prefers-color-scheme: dark)"}],["$","link","5",{"rel":"icon","href":"/icon.svg","type":"image/svg+xml"}],["$","$L5","6",{}]]}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],"loading":null,"isPartial":false}
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
5:I[61549,["4986","static/chunks/4986-c2fc8845ce785303.js","7177","static/chunks/app/layout-a16c7a7ecdf0c2cf.js"],"Toaster"]
|
|
6
6
|
:HL["/_next/static/css/de70bee13400563f.css","style"]
|
|
7
7
|
:HL["/_next/static/css/f6e8833d46e738d8.css","style"]
|
|
8
|
-
0:{"buildId":"
|
|
8
|
+
0:{"buildId":"kOmg_dJ8TT33Q12mP5qZc","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/de70bee13400563f.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/f6e8833d46e738d8.css","precedence":"next"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_188709 __variable_9a8899 font-sans antialiased","children":["$","$L2",null,{"attribute":"class","defaultTheme":"dark","children":[["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}],["$","$L5",null,{"position":"bottom-right"}]]}]}]}]]}],"loading":null,"isPartial":false}
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
:HL["/_next/static/media/93f479601ee12b01-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
|
|
3
3
|
:HL["/_next/static/css/de70bee13400563f.css","style"]
|
|
4
4
|
:HL["/_next/static/css/f6e8833d46e738d8.css","style"]
|
|
5
|
-
0:{"buildId":"
|
|
5
|
+
0:{"buildId":"kOmg_dJ8TT33Q12mP5qZc","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300}
|
|
@@ -2,46 +2,46 @@
|
|
|
2
2
|
"/_not-found/page": "app/_not-found/page.js",
|
|
3
3
|
"/_global-error/page": "app/_global-error/page.js",
|
|
4
4
|
"/api/boot/route": "app/api/boot/route.js",
|
|
5
|
-
"/api/bridge-terminal/input/route": "app/api/bridge-terminal/input/route.js",
|
|
6
5
|
"/api/bridge-terminal/resize/route": "app/api/bridge-terminal/resize/route.js",
|
|
7
|
-
"/api/
|
|
6
|
+
"/api/bridge-terminal/input/route": "app/api/bridge-terminal/input/route.js",
|
|
8
7
|
"/api/cleanup/route": "app/api/cleanup/route.js",
|
|
9
|
-
"/api/
|
|
8
|
+
"/api/browse-directories/route": "app/api/browse-directories/route.js",
|
|
10
9
|
"/api/doctor/route": "app/api/doctor/route.js",
|
|
11
|
-
"/api/
|
|
10
|
+
"/api/bridge-terminal/stream/route": "app/api/bridge-terminal/stream/route.js",
|
|
11
|
+
"/api/dev-mode/route": "app/api/dev-mode/route.js",
|
|
12
|
+
"/api/export-data/route": "app/api/export-data/route.js",
|
|
12
13
|
"/api/git/route": "app/api/git/route.js",
|
|
13
|
-
"/api/captures/route": "app/api/captures/route.js",
|
|
14
14
|
"/api/history/route": "app/api/history/route.js",
|
|
15
|
+
"/api/forensics/route": "app/api/forensics/route.js",
|
|
15
16
|
"/api/hooks/route": "app/api/hooks/route.js",
|
|
16
17
|
"/api/inspect/route": "app/api/inspect/route.js",
|
|
17
|
-
"/api/
|
|
18
|
+
"/api/experimental/route": "app/api/experimental/route.js",
|
|
18
19
|
"/api/knowledge/route": "app/api/knowledge/route.js",
|
|
20
|
+
"/api/captures/route": "app/api/captures/route.js",
|
|
19
21
|
"/api/notifications/route": "app/api/notifications/route.js",
|
|
20
22
|
"/api/live-state/route": "app/api/live-state/route.js",
|
|
21
|
-
"/api/export-data/route": "app/api/export-data/route.js",
|
|
22
|
-
"/api/experimental/route": "app/api/experimental/route.js",
|
|
23
23
|
"/api/recovery/route": "app/api/recovery/route.js",
|
|
24
24
|
"/api/preferences/route": "app/api/preferences/route.js",
|
|
25
25
|
"/api/projects/route": "app/api/projects/route.js",
|
|
26
26
|
"/api/session/browser/route": "app/api/session/browser/route.js",
|
|
27
27
|
"/api/onboarding/route": "app/api/onboarding/route.js",
|
|
28
28
|
"/api/session/command/route": "app/api/session/command/route.js",
|
|
29
|
+
"/api/settings-data/route": "app/api/settings-data/route.js",
|
|
29
30
|
"/api/files/route": "app/api/files/route.js",
|
|
31
|
+
"/api/session/events/route": "app/api/session/events/route.js",
|
|
30
32
|
"/api/shutdown/route": "app/api/shutdown/route.js",
|
|
31
|
-
"/api/settings-data/route": "app/api/settings-data/route.js",
|
|
32
33
|
"/api/session/manage/route": "app/api/session/manage/route.js",
|
|
33
|
-
"/api/skill-health/route": "app/api/skill-health/route.js",
|
|
34
|
-
"/api/session/events/route": "app/api/session/events/route.js",
|
|
35
34
|
"/api/steer/route": "app/api/steer/route.js",
|
|
35
|
+
"/api/skill-health/route": "app/api/skill-health/route.js",
|
|
36
|
+
"/api/terminal/resize/route": "app/api/terminal/resize/route.js",
|
|
37
|
+
"/api/terminal/input/route": "app/api/terminal/input/route.js",
|
|
36
38
|
"/api/switch-root/route": "app/api/switch-root/route.js",
|
|
37
39
|
"/api/terminal/sessions/route": "app/api/terminal/sessions/route.js",
|
|
38
|
-
"/api/terminal/input/route": "app/api/terminal/input/route.js",
|
|
39
|
-
"/api/terminal/resize/route": "app/api/terminal/resize/route.js",
|
|
40
|
-
"/api/undo/route": "app/api/undo/route.js",
|
|
41
40
|
"/api/visualizer/route": "app/api/visualizer/route.js",
|
|
42
41
|
"/api/terminal/stream/route": "app/api/terminal/stream/route.js",
|
|
43
|
-
"/api/
|
|
42
|
+
"/api/undo/route": "app/api/undo/route.js",
|
|
44
43
|
"/api/remote-questions/route": "app/api/remote-questions/route.js",
|
|
45
44
|
"/api/terminal/upload/route": "app/api/terminal/upload/route.js",
|
|
45
|
+
"/api/update/route": "app/api/update/route.js",
|
|
46
46
|
"/page": "app/page.js"
|
|
47
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><!--
|
|
1
|
+
<!DOCTYPE html><!--kOmg_dJ8TT33Q12mP5qZc--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/><link rel="preload" href="/_next/static/media/4cf2300e9c8272f7-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/_next/static/media/93f479601ee12b01-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/de70bee13400563f.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/f6e8833d46e738d8.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-a1c1e452c6b32d04.js"/><script src="/_next/static/chunks/4bd1b696-e5d7c65570c947b7.js" async=""></script><script src="/_next/static/chunks/3794-337d1ca25ad99a89.js" async=""></script><script src="/_next/static/chunks/main-app-fdab67f7802d7832.js" async=""></script><script src="/_next/static/chunks/4986-c2fc8845ce785303.js" async=""></script><script src="/_next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js" async=""></script><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><title>GSD</title><meta name="description" content="The evolution of Get Shit Done — now a real coding agent. One command. Walk away. Come back to a built project."/><meta name="application-name" content="GSD"/><link rel="icon" href="/icon-light-32x32.png" media="(prefers-color-scheme: light)"/><link rel="icon" href="/icon-dark-32x32.png" media="(prefers-color-scheme: dark)"/><link rel="icon" href="/icon.svg" type="image/svg+xml"/><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body class="__variable_188709 __variable_9a8899 font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><script>((a,b,c,d,e,f,g,h)=>{let i=document.documentElement,j=["light","dark"];function k(b){var c;(Array.isArray(a)?a:[a]).forEach(a=>{let c="class"===a,d=c&&f?e.map(a=>f[a]||a):e;c?(i.classList.remove(...d),i.classList.add(f&&f[b]?f[b]:b)):i.setAttribute(a,b)}),c=b,h&&j.includes(c)&&(i.style.colorScheme=c)}if(d)k(d);else try{let a=localStorage.getItem(b)||c,d=g&&"system"===a?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a;k(d)}catch(a){}})("class","theme","dark",null,["light","dark"],null,true,true)</script><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><section aria-label="Notifications alt+T" tabindex="-1" aria-live="polite" aria-relevant="additions text" aria-atomic="false"></section><script src="/_next/static/chunks/webpack-a1c1e452c6b32d04.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[21942,[\"4986\",\"static/chunks/4986-c2fc8845ce785303.js\",\"7177\",\"static/chunks/app/layout-a16c7a7ecdf0c2cf.js\"],\"ThemeProvider\"]\n3:I[57121,[],\"\"]\n4:I[74581,[],\"\"]\n5:I[61549,[\"4986\",\"static/chunks/4986-c2fc8845ce785303.js\",\"7177\",\"static/chunks/app/layout-a16c7a7ecdf0c2cf.js\"],\"Toaster\"]\n6:I[90484,[],\"OutletBoundary\"]\n7:\"$Sreact.suspense\"\n9:I[90484,[],\"ViewportBoundary\"]\nb:I[90484,[],\"MetadataBoundary\"]\nd:I[27123,[],\"\"]\n:HL[\"/_next/static/media/4cf2300e9c8272f7-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/media/93f479601ee12b01-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/css/de70bee13400563f.css\",\"style\"]\n:HL[\"/_next/static/css/f6e8833d46e738d8.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"kOmg_dJ8TT33Q12mP5qZc\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/de70bee13400563f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/f6e8833d46e738d8.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[\"$\",\"body\",null,{\"className\":\"__variable_188709 __variable_9a8899 font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"attribute\":\"class\",\"defaultTheme\":\"dark\",\"children\":[[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],[\"$\",\"$L5\",null,{\"position\":\"bottom-right\"}]]}]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@8\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L9\",null,{\"children\":\"$La\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lb\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lc\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$d\",[]],\"S\":true}\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\"}]]\n"])</script><script>self.__next_f.push([1,"e:I[86869,[],\"IconMark\"]\n8:null\nc:[[\"$\",\"title\",\"0\",{\"children\":\"GSD\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"The evolution of Get Shit Done — now a real coding agent. One command. Walk away. Come back to a built project.\"}],[\"$\",\"meta\",\"2\",{\"name\":\"application-name\",\"content\":\"GSD\"}],[\"$\",\"link\",\"3\",{\"rel\":\"icon\",\"href\":\"/icon-light-32x32.png\",\"media\":\"(prefers-color-scheme: light)\"}],[\"$\",\"link\",\"4\",{\"rel\":\"icon\",\"href\":\"/icon-dark-32x32.png\",\"media\":\"(prefers-color-scheme: dark)\"}],[\"$\",\"link\",\"5\",{\"rel\":\"icon\",\"href\":\"/icon.svg\",\"type\":\"image/svg+xml\"}],[\"$\",\"$Le\",\"6\",{}]]\n"])</script></body></html>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
<!DOCTYPE html><!--
|
|
2
|
-
@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/webpack-a1c1e452c6b32d04.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[57121,[],\"\"]\n3:I[74581,[],\"\"]\n4:I[90484,[],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[90484,[],\"ViewportBoundary\"]\n9:I[90484,[],\"MetadataBoundary\"]\nb:I[27123,[],\"\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"
|
|
1
|
+
<!DOCTYPE html><!--kOmg_dJ8TT33Q12mP5qZc--><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-a1c1e452c6b32d04.js"/><script src="/_next/static/chunks/4bd1b696-e5d7c65570c947b7.js" async=""></script><script src="/_next/static/chunks/3794-337d1ca25ad99a89.js" async=""></script><script src="/_next/static/chunks/main-app-fdab67f7802d7832.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: Internal Server Error.</title><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}
|
|
2
|
+
@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/webpack-a1c1e452c6b32d04.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[57121,[],\"\"]\n3:I[74581,[],\"\"]\n4:I[90484,[],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[90484,[],\"ViewportBoundary\"]\n9:I[90484,[],\"MetadataBoundary\"]\nb:I[27123,[],\"\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"kOmg_dJ8TT33Q12mP5qZc\",\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_global-error\",{\"children\":[\"__PAGE__\",{}]}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"title\",null,{\"children\":\"500: Internal Server Error.\"}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"lineHeight\":\"48px\"},\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}\\n@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"paddingRight\":23,\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\"},\"children\":\"500\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"28px\"},\"children\":\"Internal Server Error.\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L7\",null,{\"children\":\"$L8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$La\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",[]],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\na:[]\n"])</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"node":{},"edge":{},"encryptionKey":"
|
|
1
|
+
{"node":{},"edge":{},"encryptionKey":"La2oJQIQoQ3pDPb3dGesIXuA5KOZhEhk8Wj5ldy1cJY="}
|
package/package.json
CHANGED
|
@@ -25,6 +25,20 @@ describe("compositeOverlays — backdrop", () => {
|
|
|
25
25
|
assert.ok(dimmedLine, "should have a line containing 'second line'");
|
|
26
26
|
assert.ok(dimmedLine.includes("\x1b[2m"), "base line should be dimmed");
|
|
27
27
|
});
|
|
28
|
+
it("backdrop uses gray foreground for dimming", () => {
|
|
29
|
+
const base = ["hello world", "second line"];
|
|
30
|
+
const overlay = makeEntry(["OV"], {
|
|
31
|
+
width: 2,
|
|
32
|
+
anchor: "top-left",
|
|
33
|
+
backdrop: true,
|
|
34
|
+
});
|
|
35
|
+
const result = compositeOverlays(base, [overlay], 20, 20, 2);
|
|
36
|
+
// Check a non-overlay line for backdrop codes (dim + gray fg, no bg)
|
|
37
|
+
const line = result.find((l) => l.includes("second line"));
|
|
38
|
+
assert.ok(line, "should have a line containing 'second line'");
|
|
39
|
+
assert.ok(line.includes("\x1b[38;5;240m"), "backdrop should set gray foreground");
|
|
40
|
+
assert.ok(!line.includes("\x1b[48;"), "backdrop should not set background color");
|
|
41
|
+
});
|
|
28
42
|
it("does not dim when backdrop is false/absent", () => {
|
|
29
43
|
const base = ["hello world", "second line"];
|
|
30
44
|
const overlay = makeEntry(["OVERLAY"], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay-layout.test.js","sourceRoot":"","sources":["../../src/__tests__/overlay-layout.test.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAqB,MAAM,sBAAsB,CAAC;AAE5E,SAAS,SAAS,CACjB,KAAe,EACf,OAAiC;IAEjC,OAAO;QACN,SAAS,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE;QAClC,OAAO;QACP,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,CAAC;KACb,CAAC;AACH,CAAC;AAED,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC7C,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAChD,MAAM,IAAI,GAAG,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,SAAS,CAAC,EAAE;YACtC,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,UAAU;YAClB,QAAQ,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QAE7D,iEAAiE;QACj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AC,CAAC;QAEH,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QAE7D,iDAAiD;QACjD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,mCAAmC,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["// pi-tui — Overlay Layout Tests (backdrop dimming)\n\nimport { describe, it } from \"node:test\";\nimport assert from \"node:assert/strict\";\nimport { compositeOverlays, type OverlayEntry } from \"../overlay-layout.js\";\n\nfunction makeEntry(\n\tlines: string[],\n\toptions?: OverlayEntry[\"options\"],\n): OverlayEntry {\n\treturn {\n\t\tcomponent: { render: () => lines },\n\t\toptions,\n\t\thidden: false,\n\t\tfocusOrder: 1,\n\t};\n}\n\ndescribe(\"compositeOverlays — backdrop\", () => {\n\tit(\"dims base lines when backdrop is true\", () => {\n\t\tconst base = [\"hello world\", \"second line\"];\n\t\tconst overlay = makeEntry([\"OVERLAY\"], {\n\t\t\twidth: 7,\n\t\t\tanchor: \"top-left\",\n\t\t\tbackdrop: true,\n\t\t});\n\n\t\tconst result = compositeOverlays(base, [overlay], 20, 20, 2);\n\n\t\t// All base lines in viewport should contain dim escape (\\x1b[2m)\n\t\t// The overlay line itself is composited on top, but underlying lines get dimmed\n\t\tconst dimmedLine = result.find((l) => l.includes(\"second line\"));\n\t\tassert.ok(dimmedLine, \"should have a line containing 'second line'\");\n\t\tassert.ok(dimmedLine.includes(\"\\x1b[2m\"), \"base line should be dimmed\");\n\t});\n\n\tit(\"does not dim when backdrop is false/absent\", () => {\n\t\tconst base = [\"hello world\", \"second line\"];\n\t\tconst overlay = makeEntry([\"OVERLAY\"], {\n\t\t\twidth: 7,\n\t\t\tanchor: \"top-left\",\n\t\t});\n\n\t\tconst result = compositeOverlays(base, [overlay], 20, 20, 2);\n\n\t\t// Lines not covered by overlay should remain undimmed\n\t\tconst secondLine = result.find((l) => l.includes(\"second line\"));\n\t\tassert.ok(secondLine, \"should have a line containing 'second line'\");\n\t\tassert.ok(!secondLine.includes(\"\\x1b[2m\"), \"base line should not be dimmed\");\n\t});\n\n\tit(\"overlay content renders on top of dimmed background\", () => {\n\t\tconst base = [\"aaaaaaaaaa\"];\n\t\tconst overlay = makeEntry([\"XX\"], {\n\t\t\twidth: 2,\n\t\t\tanchor: \"top-left\",\n\t\t\tbackdrop: true,\n\t\t});\n\n\t\tconst result = compositeOverlays(base, [overlay], 10, 10, 1);\n\n\t\t// The first line should contain the overlay text\n\t\tassert.ok(result[0].includes(\"XX\"), \"overlay text should be composited\");\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"overlay-layout.test.js","sourceRoot":"","sources":["../../src/__tests__/overlay-layout.test.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAqB,MAAM,sBAAsB,CAAC;AAE5E,SAAS,SAAS,CACjB,KAAe,EACf,OAAiC;IAEjC,OAAO;QACN,SAAS,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE;QAClC,OAAO;QACP,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,CAAC;KACb,CAAC;AACH,CAAC;AAED,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC7C,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAChD,MAAM,IAAI,GAAG,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,SAAS,CAAC,EAAE;YACtC,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,UAAU;YAClB,QAAQ,EAAE,IAAI;SACd,CAAC,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,CAAC,CAAC","sourcesContent":["// pi-tui — Overlay Layout Tests (backdrop dimming)\n\nimport { describe, it } from \"node:test\";\nimport assert from \"node:assert/strict\";\nimport { compositeOverlays, type OverlayEntry } from \"../overlay-layout.js\";\n\nfunction makeEntry(\n\tlines: string[],\n\toptions?: OverlayEntry[\"options\"],\n): OverlayEntry {\n\treturn {\n\t\tcomponent: { render: () => lines },\n\t\toptions,\n\t\thidden: false,\n\t\tfocusOrder: 1,\n\t};\n}\n\ndescribe(\"compositeOverlays — backdrop\", () => {\n\tit(\"dims base lines when backdrop is true\", () => {\n\t\tconst base = [\"hello world\", \"second line\"];\n\t\tconst overlay = makeEntry([\"OVERLAY\"], {\n\t\t\twidth: 7,\n\t\t\tanchor: \"top-left\",\n\t\t\tbackdrop: true,\n\t\t});\n\n\t\tconst result = compositeOverlays(base, [overlay], 20, 20, 2);\n\n\t\t// All base lines in viewport should contain dim escape (\\x1b[2m)\n\t\t// The overlay line itself is composited on top, but underlying lines get dimmed\n\t\tconst dimmedLine = result.find((l) => l.includes(\"second line\"));\n\t\tassert.ok(dimmedLine, \"should have a line containing 'second line'\");\n\t\tassert.ok(dimmedLine.includes(\"\\x1b[2m\"), \"base line should be dimmed\");\n\t});\n\n\tit(\"backdrop uses gray foreground for dimming\", () => {\n\t\tconst base = [\"hello world\", \"second line\"];\n\t\tconst overlay = makeEntry([\"OV\"], {\n\t\t\twidth: 2,\n\t\t\tanchor: \"top-left\",\n\t\t\tbackdrop: true,\n\t\t});\n\n\t\tconst result = compositeOverlays(base, [overlay], 20, 20, 2);\n\n\t\t// Check a non-overlay line for backdrop codes (dim + gray fg, no bg)\n\t\tconst line = result.find((l) => l.includes(\"second line\"));\n\t\tassert.ok(line, \"should have a line containing 'second line'\");\n\t\tassert.ok(line.includes(\"\\x1b[38;5;240m\"), \"backdrop should set gray foreground\");\n\t\tassert.ok(!line.includes(\"\\x1b[48;\"), \"backdrop should not set background color\");\n\t});\n\n\tit(\"does not dim when backdrop is false/absent\", () => {\n\t\tconst base = [\"hello world\", \"second line\"];\n\t\tconst overlay = makeEntry([\"OVERLAY\"], {\n\t\t\twidth: 7,\n\t\t\tanchor: \"top-left\",\n\t\t});\n\n\t\tconst result = compositeOverlays(base, [overlay], 20, 20, 2);\n\n\t\t// Lines not covered by overlay should remain undimmed\n\t\tconst secondLine = result.find((l) => l.includes(\"second line\"));\n\t\tassert.ok(secondLine, \"should have a line containing 'second line'\");\n\t\tassert.ok(!secondLine.includes(\"\\x1b[2m\"), \"base line should not be dimmed\");\n\t});\n\n\tit(\"overlay content renders on top of dimmed background\", () => {\n\t\tconst base = [\"aaaaaaaaaa\"];\n\t\tconst overlay = makeEntry([\"XX\"], {\n\t\t\twidth: 2,\n\t\t\tanchor: \"top-left\",\n\t\t\tbackdrop: true,\n\t\t});\n\n\t\tconst result = compositeOverlays(base, [overlay], 10, 10, 1);\n\n\t\t// The first line should contain the overlay text\n\t\tassert.ok(result[0].includes(\"XX\"), \"overlay text should be composited\");\n\t});\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay-layout.d.ts","sourceRoot":"","sources":["../src/overlay-layout.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAOzE,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAStG;AAID,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GACf,MAAM,CAeR;AAED,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GAChB,MAAM,CAeR;AAID,MAA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KAAE,CAAC;IACpE,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,qDAAqD;AACrD,wBAAgB,gBAAgB,CAC/B,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAChB,OAAO,CAMT;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,EAAE,YAAY,EAAE,EAC5B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,MAAM,GACtB,MAAM,EAAE,CAsEV;AAID;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkB1G"}
|
|
@@ -245,10 +245,11 @@ export function compositeOverlays(lines, overlayStack, termWidth, termHeight, ma
|
|
|
245
245
|
result.push("");
|
|
246
246
|
}
|
|
247
247
|
const viewportStart = Math.max(0, workingHeight - termHeight);
|
|
248
|
-
// Apply backdrop dimming if any visible overlay requests it
|
|
248
|
+
// Apply backdrop dimming if any visible overlay requests it.
|
|
249
|
+
// Uses dim + gray foreground so text fades without painting empty lines.
|
|
249
250
|
const hasBackdrop = visibleEntries.some((e) => e.options?.backdrop);
|
|
250
251
|
if (hasBackdrop) {
|
|
251
|
-
const dimFn = (text) => `\x1b[2m${text}\x1b[22m`;
|
|
252
|
+
const dimFn = (text) => `\x1b[2m\x1b[38;5;240m${text}\x1b[39m\x1b[22m`;
|
|
252
253
|
for (let i = viewportStart; i < result.length; i++) {
|
|
253
254
|
if (!isImageLine(result[i]) && result[i].length > 0) {
|
|
254
255
|
result[i] = applyBackgroundToLine(result[i], termWidth, dimFn);
|
|
@@ -1 +1 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AC;QACxB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAChD,IAAI,WAAW,KAAK,CAAC,CAAC,EAAE,CAAC;YACxB,wDAAwD;YACxD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;YAChD,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;YAEvC,6BAA6B;YAC7B,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YAEzF,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;QACrB,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/**\n * Overlay layout resolution, compositing, and rendering utilities.\n *\n * Extracted from tui.ts — these are pure functions that compute overlay\n * positions and composite overlay content onto base terminal lines.\n */\n\nimport type { OverlayAnchor, OverlayOptions, SizeValue } from \"./tui.js\";\nimport { applyBackgroundToLine, extractSegments, sliceByColumn, sliceWithWidth, truncateToWidth, visibleWidth } from \"./utils.js\";\nimport { isImageLine } from \"./terminal-image.js\";\nimport { CURSOR_MARKER } from \"./tui.js\";\n\n// ─── Size parsing ───────────────────────────────────────────────────────────\n\n/** Parse a SizeValue into absolute value given a reference size */\nexport function parseSizeValue(value: SizeValue | undefined, referenceSize: number): number | undefined {\n\tif (value === undefined) return undefined;\n\tif (typeof value === \"number\") return value;\n\t// Parse percentage string like \"50%\"\n\tconst match = value.match(/^(\\d+(?:\\.\\d+)?)%$/);\n\tif (match) {\n\t\treturn Math.floor((referenceSize * parseFloat(match[1])) / 100);\n\t}\n\treturn undefined;\n}\n\n// ─── Anchor resolution ──────────────────────────────────────────────────────\n\nexport function resolveAnchorRow(\n\tanchor: OverlayAnchor,\n\theight: number,\n\tavailHeight: number,\n\tmarginTop: number,\n): number {\n\tswitch (anchor) {\n\t\tcase \"top-left\":\n\t\tcase \"top-center\":\n\t\tcase \"top-right\":\n\t\t\treturn marginTop;\n\t\tcase \"bottom-left\":\n\t\tcase \"bottom-center\":\n\t\tcase \"bottom-right\":\n\t\t\treturn marginTop + availHeight - height;\n\t\tcase \"left-center\":\n\t\tcase \"center\":\n\t\tcase \"right-center\":\n\t\t\treturn marginTop + Math.floor((availHeight - height) / 2);\n\t}\n}\n\nexport function resolveAnchorCol(\n\tanchor: OverlayAnchor,\n\twidth: number,\n\tavailWidth: number,\n\tmarginLeft: number,\n): number {\n\tswitch (anchor) {\n\t\tcase \"top-left\":\n\t\tcase \"left-center\":\n\t\tcase \"bottom-left\":\n\t\t\treturn marginLeft;\n\t\tcase \"top-right\":\n\t\tcase \"right-center\":\n\t\tcase \"bottom-right\":\n\t\t\treturn marginLeft + availWidth - width;\n\t\tcase \"top-center\":\n\t\tcase \"center\":\n\t\tcase \"bottom-center\":\n\t\t\treturn marginLeft + Math.floor((availWidth - width) / 2);\n\t}\n}\n\n// ─── Overlay layout resolution ──────────────────────────────────────────────\n\nexport interface OverlayLayout {\n\twidth: number;\n\trow: number;\n\tcol: number;\n\tmaxHeight: number | undefined;\n}\n\n/**\n * Resolve overlay layout from options.\n * Returns { width, row, col, maxHeight } for rendering.\n */\nexport function resolveOverlayLayout(\n\toptions: OverlayOptions | undefined,\n\toverlayHeight: number,\n\ttermWidth: number,\n\ttermHeight: number,\n): OverlayLayout {\n\tconst opt = options ?? {};\n\n\t// Parse margin (clamp to non-negative)\n\tconst margin =\n\t\ttypeof opt.margin === \"number\"\n\t\t\t? { top: opt.margin, right: opt.margin, bottom: opt.margin, left: opt.margin }\n\t\t\t: (opt.margin ?? {});\n\tconst marginTop = Math.max(0, margin.top ?? 0);\n\tconst marginRight = Math.max(0, margin.right ?? 0);\n\tconst marginBottom = Math.max(0, margin.bottom ?? 0);\n\tconst marginLeft = Math.max(0, margin.left ?? 0);\n\n\t// Available space after margins\n\tconst availWidth = Math.max(1, termWidth - marginLeft - marginRight);\n\tconst availHeight = Math.max(1, termHeight - marginTop - marginBottom);\n\n\t// === Resolve width ===\n\tlet width = parseSizeValue(opt.width, termWidth) ?? Math.min(80, availWidth);\n\t// Apply minWidth\n\tif (opt.minWidth !== undefined) {\n\t\twidth = Math.max(width, opt.minWidth);\n\t}\n\t// Clamp to available space\n\twidth = Math.max(1, Math.min(width, availWidth));\n\n\t// === Resolve maxHeight ===\n\tlet maxHeight = parseSizeValue(opt.maxHeight, termHeight);\n\t// Clamp to available space\n\tif (maxHeight !== undefined) {\n\t\tmaxHeight = Math.max(1, Math.min(maxHeight, availHeight));\n\t}\n\n\t// Effective overlay height (may be clamped by maxHeight)\n\tconst effectiveHeight = maxHeight !== undefined ? Math.min(overlayHeight, maxHeight) : overlayHeight;\n\n\t// === Resolve position ===\n\tlet row: number;\n\tlet col: number;\n\n\tif (opt.row !== undefined) {\n\t\tif (typeof opt.row === \"string\") {\n\t\t\t// Percentage: 0% = top, 100% = bottom (overlay stays within bounds)\n\t\t\tconst match = opt.row.match(/^(\\d+(?:\\.\\d+)?)%$/);\n\t\t\tif (match) {\n\t\t\t\tconst maxRow = Math.max(0, availHeight - effectiveHeight);\n\t\t\t\tconst percent = parseFloat(match[1]) / 100;\n\t\t\t\trow = marginTop + Math.floor(maxRow * percent);\n\t\t\t} else {\n\t\t\t\t// Invalid format, fall back to center\n\t\t\t\trow = resolveAnchorRow(\"center\", effectiveHeight, availHeight, marginTop);\n\t\t\t}\n\t\t} else {\n\t\t\t// Absolute row position\n\t\t\trow = opt.row;\n\t\t}\n\t} else {\n\t\t// Anchor-based (default: center)\n\t\tconst anchor = opt.anchor ?? \"center\";\n\t\trow = resolveAnchorRow(anchor, effectiveHeight, availHeight, marginTop);\n\t}\n\n\tif (opt.col !== undefined) {\n\t\tif (typeof opt.col === \"string\") {\n\t\t\t// Percentage: 0% = left, 100% = right (overlay stays within bounds)\n\t\t\tconst match = opt.col.match(/^(\\d+(?:\\.\\d+)?)%$/);\n\t\t\tif (match) {\n\t\t\t\tconst maxCol = Math.max(0, availWidth - width);\n\t\t\t\tconst percent = parseFloat(match[1]) / 100;\n\t\t\t\tcol = marginLeft + Math.floor(maxCol * percent);\n\t\t\t} else {\n\t\t\t\t// Invalid format, fall back to center\n\t\t\t\tcol = resolveAnchorCol(\"center\", width, availWidth, marginLeft);\n\t\t\t}\n\t\t} else {\n\t\t\t// Absolute column position\n\t\t\tcol = opt.col;\n\t\t}\n\t} else {\n\t\t// Anchor-based (default: center)\n\t\tconst anchor = opt.anchor ?? \"center\";\n\t\tcol = resolveAnchorCol(anchor, width, availWidth, marginLeft);\n\t}\n\n\t// Apply offsets\n\tif (opt.offsetY !== undefined) row += opt.offsetY;\n\tif (opt.offsetX !== undefined) col += opt.offsetX;\n\n\t// Clamp to terminal bounds (respecting margins)\n\trow = Math.max(marginTop, Math.min(row, termHeight - marginBottom - effectiveHeight));\n\tcol = Math.max(marginLeft, Math.min(col, termWidth - marginRight - width));\n\n\treturn { width, row, col, maxHeight };\n}\n\n// ─── Line compositing ───────────────────────────────────────────────────────\n\nconst SEGMENT_RESET = \"\\x1b[0m\\x1b]8;;\\x07\";\n\n/** Append reset sequences to each non-image line. */\nexport function applyLineResets(lines: string[]): string[] {\n\tfor (let i = 0; i < lines.length; i++) {\n\t\tconst line = lines[i];\n\t\tif (!isImageLine(line)) {\n\t\t\tlines[i] = line + SEGMENT_RESET;\n\t\t}\n\t}\n\treturn lines;\n}\n\n/** Splice overlay content into a base line at a specific column. Single-pass optimized. */\nexport function compositeLineAt(\n\tbaseLine: string,\n\toverlayLine: string,\n\tstartCol: number,\n\toverlayWidth: number,\n\ttotalWidth: number,\n): string {\n\tif (isImageLine(baseLine)) return baseLine;\n\n\t// Single pass through baseLine extracts both before and after segments\n\tconst afterStart = startCol + overlayWidth;\n\tconst base = extractSegments(baseLine, startCol, afterStart, totalWidth - afterStart, true);\n\n\t// Extract overlay with width tracking (strict=true to exclude wide chars at boundary)\n\tconst overlay = sliceWithWidth(overlayLine, 0, overlayWidth, true);\n\n\t// Pad segments to target widths\n\tconst beforePad = Math.max(0, startCol - base.beforeWidth);\n\tconst overlayPad = Math.max(0, overlayWidth - overlay.width);\n\tconst actualBeforeWidth = Math.max(startCol, base.beforeWidth);\n\tconst actualOverlayWidth = Math.max(overlayWidth, overlay.width);\n\tconst afterTarget = Math.max(0, totalWidth - actualBeforeWidth - actualOverlayWidth);\n\tconst afterPad = Math.max(0, afterTarget - base.afterWidth);\n\n\t// Compose result\n\tconst r = SEGMENT_RESET;\n\tconst result =\n\t\tbase.before +\n\t\t\" \".repeat(beforePad) +\n\t\tr +\n\t\toverlay.text +\n\t\t\" \".repeat(overlayPad) +\n\t\tr +\n\t\tbase.after +\n\t\t\" \".repeat(afterPad);\n\n\t// CRITICAL: Always verify and truncate to terminal width.\n\t// This is the final safeguard against width overflow which would crash the TUI.\n\t// Width tracking can drift from actual visible width due to:\n\t// - Complex ANSI/OSC sequences (hyperlinks, colors)\n\t// - Wide characters at segment boundaries\n\t// - Edge cases in segment extraction\n\tconst resultWidth = visibleWidth(result);\n\tif (resultWidth <= totalWidth) {\n\t\treturn result;\n\t}\n\t// Truncate with strict=true to ensure we don't exceed totalWidth\n\treturn sliceByColumn(result, 0, totalWidth, true);\n}\n\n// ─── Overlay compositing ────────────────────────────────────────────────────\n\nexport interface OverlayEntry {\n\tcomponent: { render(width: number): string[]; invalidate?(): void };\n\toptions?: OverlayOptions;\n\thidden: boolean;\n\tfocusOrder: number;\n}\n\n/** Check if an overlay entry is currently visible */\nexport function isOverlayVisible(\n\tentry: OverlayEntry,\n\ttermWidth: number,\n\ttermHeight: number,\n): boolean {\n\tif (entry.hidden) return false;\n\tif (entry.options?.visible) {\n\t\treturn entry.options.visible(termWidth, termHeight);\n\t}\n\treturn true;\n}\n\n/**\n * Composite all visible overlays into content lines.\n * Sorted by focusOrder (higher = on top).\n */\nexport function compositeOverlays(\n\tlines: string[],\n\toverlayStack: OverlayEntry[],\n\ttermWidth: number,\n\ttermHeight: number,\n\tmaxLinesRendered: number,\n): string[] {\n\tif (overlayStack.length === 0) return lines;\n\tconst result = [...lines];\n\n\t// Pre-render all visible overlays and calculate positions\n\tconst rendered: { overlayLines: string[]; row: number; col: number; w: number }[] = [];\n\tlet minLinesNeeded = result.length;\n\n\tconst visibleEntries = overlayStack.filter((e) => isOverlayVisible(e, termWidth, termHeight));\n\tvisibleEntries.sort((a, b) => a.focusOrder - b.focusOrder);\n\tfor (const entry of visibleEntries) {\n\t\tconst { component, options } = entry;\n\n\t\t// Get layout with height=0 first to determine width and maxHeight\n\t\t// (width and maxHeight don't depend on overlay height)\n\t\tconst { width, maxHeight } = resolveOverlayLayout(options, 0, termWidth, termHeight);\n\n\t\t// Render component at calculated width\n\t\tlet overlayLines = component.render(width);\n\n\t\t// Apply maxHeight if specified\n\t\tif (maxHeight !== undefined && overlayLines.length > maxHeight) {\n\t\t\toverlayLines = overlayLines.slice(0, maxHeight);\n\t\t}\n\n\t\t// Get final row/col with actual overlay height\n\t\tconst { row, col } = resolveOverlayLayout(options, overlayLines.length, termWidth, termHeight);\n\n\t\trendered.push({ overlayLines, row, col, w: width });\n\t\tminLinesNeeded = Math.max(minLinesNeeded, row + overlayLines.length);\n\t}\n\n\t// Ensure result covers the terminal working area to keep overlay positioning stable across resizes.\n\t// maxLinesRendered can exceed current content length after a shrink; pad to keep viewportStart consistent.\n\tconst workingHeight = Math.max(maxLinesRendered, minLinesNeeded);\n\n\t// Extend result with empty lines if content is too short for overlay placement or working area\n\twhile (result.length < workingHeight) {\n\t\tresult.push(\"\");\n\t}\n\n\tconst viewportStart = Math.max(0, workingHeight - termHeight);\n\n\t// Apply backdrop dimming if any visible overlay requests it\n\tconst hasBackdrop = visibleEntries.some((e) => e.options?.backdrop);\n\tif (hasBackdrop) {\n\t\tconst dimFn = (text: string) => `\\x1b[2m${text}\\x1b[22m`;\n\t\tfor (let i = viewportStart; i < result.length; i++) {\n\t\t\tif (!isImageLine(result[i]) && result[i].length > 0) {\n\t\t\t\tresult[i] = applyBackgroundToLine(result[i], termWidth, dimFn);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Composite each overlay\n\tfor (const { overlayLines, row, col, w } of rendered) {\n\t\tfor (let i = 0; i < overlayLines.length; i++) {\n\t\t\tconst idx = viewportStart + row + i;\n\t\t\tif (idx >= 0 && idx < result.length) {\n\t\t\t\t// Defensive: truncate overlay line to declared width before compositing\n\t\t\t\t// (components should already respect width, but this ensures it)\n\t\t\t\tconst truncatedOverlayLine =\n\t\t\t\t\tvisibleWidth(overlayLines[i]) > w ? sliceByColumn(overlayLines[i], 0, w, true) : overlayLines[i];\n\t\t\t\tresult[idx] = compositeLineAt(result[idx], truncatedOverlayLine, col, w, termWidth);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\n// ─── Cursor extraction ──────────────────────────────────────────────────────\n\n/**\n * Find and extract cursor position from rendered lines.\n * Searches for CURSOR_MARKER, calculates its position, and strips it from the output.\n * Only scans the bottom terminal height lines (visible viewport).\n * @param lines - Rendered lines to search (mutated to strip marker)\n * @param height - Terminal height (visible viewport size)\n * @returns Cursor position { row, col } or null if no marker found\n */\nexport function extractCursorPosition(lines: string[], height: number): { row: number; col: number } | null {\n\t// Only scan the bottom `height` lines (visible viewport)\n\tconst viewportTop = Math.max(0, lines.length - height);\n\tfor (let row = lines.length - 1; row >= viewportTop; row--) {\n\t\tconst line = lines[row];\n\t\tconst markerIndex = line.indexOf(CURSOR_MARKER);\n\t\tif (markerIndex !== -1) {\n\t\t\t// Calculate visual column (width of text before marker)\n\t\t\tconst beforeMarker = line.slice(0, markerIndex);\n\t\t\tconst col = visibleWidth(beforeMarker);\n\n\t\t\t// Strip marker from the line\n\t\t\tlines[row] = line.slice(0, markerIndex) + line.slice(markerIndex + CURSOR_MARKER.length);\n\n\t\t\treturn { row, col };\n\t\t}\n\t}\n\treturn null;\n}\n"]}
|
|
1
|
+
{"version":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;QACxB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAChD,IAAI,WAAW,KAAK,CAAC,CAAC,EAAE,CAAC;YACxB,wDAAwD;YACxD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;YAChD,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;YAEvC,6BAA6B;YAC7B,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YAEzF,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;QACrB,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/**\n * Overlay layout resolution, compositing, and rendering utilities.\n *\n * Extracted from tui.ts — these are pure functions that compute overlay\n * positions and composite overlay content onto base terminal lines.\n */\n\nimport type { OverlayAnchor, OverlayOptions, SizeValue } from \"./tui.js\";\nimport { applyBackgroundToLine, extractSegments, sliceByColumn, sliceWithWidth, truncateToWidth, visibleWidth } from \"./utils.js\";\nimport { isImageLine } from \"./terminal-image.js\";\nimport { CURSOR_MARKER } from \"./tui.js\";\n\n// ─── Size parsing ───────────────────────────────────────────────────────────\n\n/** Parse a SizeValue into absolute value given a reference size */\nexport function parseSizeValue(value: SizeValue | undefined, referenceSize: number): number | undefined {\n\tif (value === undefined) return undefined;\n\tif (typeof value === \"number\") return value;\n\t// Parse percentage string like \"50%\"\n\tconst match = value.match(/^(\\d+(?:\\.\\d+)?)%$/);\n\tif (match) {\n\t\treturn Math.floor((referenceSize * parseFloat(match[1])) / 100);\n\t}\n\treturn undefined;\n}\n\n// ─── Anchor resolution ──────────────────────────────────────────────────────\n\nexport function resolveAnchorRow(\n\tanchor: OverlayAnchor,\n\theight: number,\n\tavailHeight: number,\n\tmarginTop: number,\n): number {\n\tswitch (anchor) {\n\t\tcase \"top-left\":\n\t\tcase \"top-center\":\n\t\tcase \"top-right\":\n\t\t\treturn marginTop;\n\t\tcase \"bottom-left\":\n\t\tcase \"bottom-center\":\n\t\tcase \"bottom-right\":\n\t\t\treturn marginTop + availHeight - height;\n\t\tcase \"left-center\":\n\t\tcase \"center\":\n\t\tcase \"right-center\":\n\t\t\treturn marginTop + Math.floor((availHeight - height) / 2);\n\t}\n}\n\nexport function resolveAnchorCol(\n\tanchor: OverlayAnchor,\n\twidth: number,\n\tavailWidth: number,\n\tmarginLeft: number,\n): number {\n\tswitch (anchor) {\n\t\tcase \"top-left\":\n\t\tcase \"left-center\":\n\t\tcase \"bottom-left\":\n\t\t\treturn marginLeft;\n\t\tcase \"top-right\":\n\t\tcase \"right-center\":\n\t\tcase \"bottom-right\":\n\t\t\treturn marginLeft + availWidth - width;\n\t\tcase \"top-center\":\n\t\tcase \"center\":\n\t\tcase \"bottom-center\":\n\t\t\treturn marginLeft + Math.floor((availWidth - width) / 2);\n\t}\n}\n\n// ─── Overlay layout resolution ──────────────────────────────────────────────\n\nexport interface OverlayLayout {\n\twidth: number;\n\trow: number;\n\tcol: number;\n\tmaxHeight: number | undefined;\n}\n\n/**\n * Resolve overlay layout from options.\n * Returns { width, row, col, maxHeight } for rendering.\n */\nexport function resolveOverlayLayout(\n\toptions: OverlayOptions | undefined,\n\toverlayHeight: number,\n\ttermWidth: number,\n\ttermHeight: number,\n): OverlayLayout {\n\tconst opt = options ?? {};\n\n\t// Parse margin (clamp to non-negative)\n\tconst margin =\n\t\ttypeof opt.margin === \"number\"\n\t\t\t? { top: opt.margin, right: opt.margin, bottom: opt.margin, left: opt.margin }\n\t\t\t: (opt.margin ?? {});\n\tconst marginTop = Math.max(0, margin.top ?? 0);\n\tconst marginRight = Math.max(0, margin.right ?? 0);\n\tconst marginBottom = Math.max(0, margin.bottom ?? 0);\n\tconst marginLeft = Math.max(0, margin.left ?? 0);\n\n\t// Available space after margins\n\tconst availWidth = Math.max(1, termWidth - marginLeft - marginRight);\n\tconst availHeight = Math.max(1, termHeight - marginTop - marginBottom);\n\n\t// === Resolve width ===\n\tlet width = parseSizeValue(opt.width, termWidth) ?? Math.min(80, availWidth);\n\t// Apply minWidth\n\tif (opt.minWidth !== undefined) {\n\t\twidth = Math.max(width, opt.minWidth);\n\t}\n\t// Clamp to available space\n\twidth = Math.max(1, Math.min(width, availWidth));\n\n\t// === Resolve maxHeight ===\n\tlet maxHeight = parseSizeValue(opt.maxHeight, termHeight);\n\t// Clamp to available space\n\tif (maxHeight !== undefined) {\n\t\tmaxHeight = Math.max(1, Math.min(maxHeight, availHeight));\n\t}\n\n\t// Effective overlay height (may be clamped by maxHeight)\n\tconst effectiveHeight = maxHeight !== undefined ? Math.min(overlayHeight, maxHeight) : overlayHeight;\n\n\t// === Resolve position ===\n\tlet row: number;\n\tlet col: number;\n\n\tif (opt.row !== undefined) {\n\t\tif (typeof opt.row === \"string\") {\n\t\t\t// Percentage: 0% = top, 100% = bottom (overlay stays within bounds)\n\t\t\tconst match = opt.row.match(/^(\\d+(?:\\.\\d+)?)%$/);\n\t\t\tif (match) {\n\t\t\t\tconst maxRow = Math.max(0, availHeight - effectiveHeight);\n\t\t\t\tconst percent = parseFloat(match[1]) / 100;\n\t\t\t\trow = marginTop + Math.floor(maxRow * percent);\n\t\t\t} else {\n\t\t\t\t// Invalid format, fall back to center\n\t\t\t\trow = resolveAnchorRow(\"center\", effectiveHeight, availHeight, marginTop);\n\t\t\t}\n\t\t} else {\n\t\t\t// Absolute row position\n\t\t\trow = opt.row;\n\t\t}\n\t} else {\n\t\t// Anchor-based (default: center)\n\t\tconst anchor = opt.anchor ?? \"center\";\n\t\trow = resolveAnchorRow(anchor, effectiveHeight, availHeight, marginTop);\n\t}\n\n\tif (opt.col !== undefined) {\n\t\tif (typeof opt.col === \"string\") {\n\t\t\t// Percentage: 0% = left, 100% = right (overlay stays within bounds)\n\t\t\tconst match = opt.col.match(/^(\\d+(?:\\.\\d+)?)%$/);\n\t\t\tif (match) {\n\t\t\t\tconst maxCol = Math.max(0, availWidth - width);\n\t\t\t\tconst percent = parseFloat(match[1]) / 100;\n\t\t\t\tcol = marginLeft + Math.floor(maxCol * percent);\n\t\t\t} else {\n\t\t\t\t// Invalid format, fall back to center\n\t\t\t\tcol = resolveAnchorCol(\"center\", width, availWidth, marginLeft);\n\t\t\t}\n\t\t} else {\n\t\t\t// Absolute column position\n\t\t\tcol = opt.col;\n\t\t}\n\t} else {\n\t\t// Anchor-based (default: center)\n\t\tconst anchor = opt.anchor ?? \"center\";\n\t\tcol = resolveAnchorCol(anchor, width, availWidth, marginLeft);\n\t}\n\n\t// Apply offsets\n\tif (opt.offsetY !== undefined) row += opt.offsetY;\n\tif (opt.offsetX !== undefined) col += opt.offsetX;\n\n\t// Clamp to terminal bounds (respecting margins)\n\trow = Math.max(marginTop, Math.min(row, termHeight - marginBottom - effectiveHeight));\n\tcol = Math.max(marginLeft, Math.min(col, termWidth - marginRight - width));\n\n\treturn { width, row, col, maxHeight };\n}\n\n// ─── Line compositing ───────────────────────────────────────────────────────\n\nconst SEGMENT_RESET = \"\\x1b[0m\\x1b]8;;\\x07\";\n\n/** Append reset sequences to each non-image line. */\nexport function applyLineResets(lines: string[]): string[] {\n\tfor (let i = 0; i < lines.length; i++) {\n\t\tconst line = lines[i];\n\t\tif (!isImageLine(line)) {\n\t\t\tlines[i] = line + SEGMENT_RESET;\n\t\t}\n\t}\n\treturn lines;\n}\n\n/** Splice overlay content into a base line at a specific column. Single-pass optimized. */\nexport function compositeLineAt(\n\tbaseLine: string,\n\toverlayLine: string,\n\tstartCol: number,\n\toverlayWidth: number,\n\ttotalWidth: number,\n): string {\n\tif (isImageLine(baseLine)) return baseLine;\n\n\t// Single pass through baseLine extracts both before and after segments\n\tconst afterStart = startCol + overlayWidth;\n\tconst base = extractSegments(baseLine, startCol, afterStart, totalWidth - afterStart, true);\n\n\t// Extract overlay with width tracking (strict=true to exclude wide chars at boundary)\n\tconst overlay = sliceWithWidth(overlayLine, 0, overlayWidth, true);\n\n\t// Pad segments to target widths\n\tconst beforePad = Math.max(0, startCol - base.beforeWidth);\n\tconst overlayPad = Math.max(0, overlayWidth - overlay.width);\n\tconst actualBeforeWidth = Math.max(startCol, base.beforeWidth);\n\tconst actualOverlayWidth = Math.max(overlayWidth, overlay.width);\n\tconst afterTarget = Math.max(0, totalWidth - actualBeforeWidth - actualOverlayWidth);\n\tconst afterPad = Math.max(0, afterTarget - base.afterWidth);\n\n\t// Compose result\n\tconst r = SEGMENT_RESET;\n\tconst result =\n\t\tbase.before +\n\t\t\" \".repeat(beforePad) +\n\t\tr +\n\t\toverlay.text +\n\t\t\" \".repeat(overlayPad) +\n\t\tr +\n\t\tbase.after +\n\t\t\" \".repeat(afterPad);\n\n\t// CRITICAL: Always verify and truncate to terminal width.\n\t// This is the final safeguard against width overflow which would crash the TUI.\n\t// Width tracking can drift from actual visible width due to:\n\t// - Complex ANSI/OSC sequences (hyperlinks, colors)\n\t// - Wide characters at segment boundaries\n\t// - Edge cases in segment extraction\n\tconst resultWidth = visibleWidth(result);\n\tif (resultWidth <= totalWidth) {\n\t\treturn result;\n\t}\n\t// Truncate with strict=true to ensure we don't exceed totalWidth\n\treturn sliceByColumn(result, 0, totalWidth, true);\n}\n\n// ─── Overlay compositing ────────────────────────────────────────────────────\n\nexport interface OverlayEntry {\n\tcomponent: { render(width: number): string[]; invalidate?(): void };\n\toptions?: OverlayOptions;\n\thidden: boolean;\n\tfocusOrder: number;\n}\n\n/** Check if an overlay entry is currently visible */\nexport function isOverlayVisible(\n\tentry: OverlayEntry,\n\ttermWidth: number,\n\ttermHeight: number,\n): boolean {\n\tif (entry.hidden) return false;\n\tif (entry.options?.visible) {\n\t\treturn entry.options.visible(termWidth, termHeight);\n\t}\n\treturn true;\n}\n\n/**\n * Composite all visible overlays into content lines.\n * Sorted by focusOrder (higher = on top).\n */\nexport function compositeOverlays(\n\tlines: string[],\n\toverlayStack: OverlayEntry[],\n\ttermWidth: number,\n\ttermHeight: number,\n\tmaxLinesRendered: number,\n): string[] {\n\tif (overlayStack.length === 0) return lines;\n\tconst result = [...lines];\n\n\t// Pre-render all visible overlays and calculate positions\n\tconst rendered: { overlayLines: string[]; row: number; col: number; w: number }[] = [];\n\tlet minLinesNeeded = result.length;\n\n\tconst visibleEntries = overlayStack.filter((e) => isOverlayVisible(e, termWidth, termHeight));\n\tvisibleEntries.sort((a, b) => a.focusOrder - b.focusOrder);\n\tfor (const entry of visibleEntries) {\n\t\tconst { component, options } = entry;\n\n\t\t// Get layout with height=0 first to determine width and maxHeight\n\t\t// (width and maxHeight don't depend on overlay height)\n\t\tconst { width, maxHeight } = resolveOverlayLayout(options, 0, termWidth, termHeight);\n\n\t\t// Render component at calculated width\n\t\tlet overlayLines = component.render(width);\n\n\t\t// Apply maxHeight if specified\n\t\tif (maxHeight !== undefined && overlayLines.length > maxHeight) {\n\t\t\toverlayLines = overlayLines.slice(0, maxHeight);\n\t\t}\n\n\t\t// Get final row/col with actual overlay height\n\t\tconst { row, col } = resolveOverlayLayout(options, overlayLines.length, termWidth, termHeight);\n\n\t\trendered.push({ overlayLines, row, col, w: width });\n\t\tminLinesNeeded = Math.max(minLinesNeeded, row + overlayLines.length);\n\t}\n\n\t// Ensure result covers the terminal working area to keep overlay positioning stable across resizes.\n\t// maxLinesRendered can exceed current content length after a shrink; pad to keep viewportStart consistent.\n\tconst workingHeight = Math.max(maxLinesRendered, minLinesNeeded);\n\n\t// Extend result with empty lines if content is too short for overlay placement or working area\n\twhile (result.length < workingHeight) {\n\t\tresult.push(\"\");\n\t}\n\n\tconst viewportStart = Math.max(0, workingHeight - termHeight);\n\n\t// Apply backdrop dimming if any visible overlay requests it.\n\t// Uses dim + gray foreground so text fades without painting empty lines.\n\tconst hasBackdrop = visibleEntries.some((e) => e.options?.backdrop);\n\tif (hasBackdrop) {\n\t\tconst dimFn = (text: string) => `\\x1b[2m\\x1b[38;5;240m${text}\\x1b[39m\\x1b[22m`;\n\t\tfor (let i = viewportStart; i < result.length; i++) {\n\t\t\tif (!isImageLine(result[i]) && result[i].length > 0) {\n\t\t\t\tresult[i] = applyBackgroundToLine(result[i], termWidth, dimFn);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Composite each overlay\n\tfor (const { overlayLines, row, col, w } of rendered) {\n\t\tfor (let i = 0; i < overlayLines.length; i++) {\n\t\t\tconst idx = viewportStart + row + i;\n\t\t\tif (idx >= 0 && idx < result.length) {\n\t\t\t\t// Defensive: truncate overlay line to declared width before compositing\n\t\t\t\t// (components should already respect width, but this ensures it)\n\t\t\t\tconst truncatedOverlayLine =\n\t\t\t\t\tvisibleWidth(overlayLines[i]) > w ? sliceByColumn(overlayLines[i], 0, w, true) : overlayLines[i];\n\t\t\t\tresult[idx] = compositeLineAt(result[idx], truncatedOverlayLine, col, w, termWidth);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\n// ─── Cursor extraction ──────────────────────────────────────────────────────\n\n/**\n * Find and extract cursor position from rendered lines.\n * Searches for CURSOR_MARKER, calculates its position, and strips it from the output.\n * Only scans the bottom terminal height lines (visible viewport).\n * @param lines - Rendered lines to search (mutated to strip marker)\n * @param height - Terminal height (visible viewport size)\n * @returns Cursor position { row, col } or null if no marker found\n */\nexport function extractCursorPosition(lines: string[], height: number): { row: number; col: number } | null {\n\t// Only scan the bottom `height` lines (visible viewport)\n\tconst viewportTop = Math.max(0, lines.length - height);\n\tfor (let row = lines.length - 1; row >= viewportTop; row--) {\n\t\tconst line = lines[row];\n\t\tconst markerIndex = line.indexOf(CURSOR_MARKER);\n\t\tif (markerIndex !== -1) {\n\t\t\t// Calculate visual column (width of text before marker)\n\t\t\tconst beforeMarker = line.slice(0, markerIndex);\n\t\t\tconst col = visibleWidth(beforeMarker);\n\n\t\t\t// Strip marker from the line\n\t\t\tlines[row] = line.slice(0, markerIndex) + line.slice(markerIndex + CURSOR_MARKER.length);\n\n\t\t\treturn { row, col };\n\t\t}\n\t}\n\treturn null;\n}\n"]}
|
|
@@ -34,6 +34,23 @@ describe("compositeOverlays — backdrop", () => {
|
|
|
34
34
|
assert.ok(dimmedLine.includes("\x1b[2m"), "base line should be dimmed");
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
it("backdrop uses gray foreground for dimming", () => {
|
|
38
|
+
const base = ["hello world", "second line"];
|
|
39
|
+
const overlay = makeEntry(["OV"], {
|
|
40
|
+
width: 2,
|
|
41
|
+
anchor: "top-left",
|
|
42
|
+
backdrop: true,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const result = compositeOverlays(base, [overlay], 20, 20, 2);
|
|
46
|
+
|
|
47
|
+
// Check a non-overlay line for backdrop codes (dim + gray fg, no bg)
|
|
48
|
+
const line = result.find((l) => l.includes("second line"));
|
|
49
|
+
assert.ok(line, "should have a line containing 'second line'");
|
|
50
|
+
assert.ok(line.includes("\x1b[38;5;240m"), "backdrop should set gray foreground");
|
|
51
|
+
assert.ok(!line.includes("\x1b[48;"), "backdrop should not set background color");
|
|
52
|
+
});
|
|
53
|
+
|
|
37
54
|
it("does not dim when backdrop is false/absent", () => {
|
|
38
55
|
const base = ["hello world", "second line"];
|
|
39
56
|
const overlay = makeEntry(["OVERLAY"], {
|
|
@@ -324,10 +324,11 @@ export function compositeOverlays(
|
|
|
324
324
|
|
|
325
325
|
const viewportStart = Math.max(0, workingHeight - termHeight);
|
|
326
326
|
|
|
327
|
-
// Apply backdrop dimming if any visible overlay requests it
|
|
327
|
+
// Apply backdrop dimming if any visible overlay requests it.
|
|
328
|
+
// Uses dim + gray foreground so text fades without painting empty lines.
|
|
328
329
|
const hasBackdrop = visibleEntries.some((e) => e.options?.backdrop);
|
|
329
330
|
if (hasBackdrop) {
|
|
330
|
-
const dimFn = (text: string) => `\x1b[2m${text}\x1b[22m`;
|
|
331
|
+
const dimFn = (text: string) => `\x1b[2m\x1b[38;5;240m${text}\x1b[39m\x1b[22m`;
|
|
331
332
|
for (let i = viewportStart; i < result.length; i++) {
|
|
332
333
|
if (!isImageLine(result[i]) && result[i].length > 0) {
|
|
333
334
|
result[i] = applyBackgroundToLine(result[i], termWidth, dimFn);
|