sootsim 0.1.216 → 0.1.218

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.
Files changed (142) hide show
  1. package/dist-cli/bin.js +4 -4
  2. package/dist-cli/chunks/{agent-RMGUE35J.js → agent-TQJDQNML.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-PNKMWDVX.js → agent-wrapper-OAOFXHX2.js} +2 -2
  4. package/dist-cli/chunks/{app-fonts-Z6SGSVKJ.js → app-fonts-4VPAP3RZ.js} +2 -2
  5. package/dist-cli/chunks/{assert-ELIDRXY7.js → assert-DKNRGH4M.js} +2 -2
  6. package/dist-cli/chunks/{auth-2NJA7QI6.js → auth-ZYOAQEI2.js} +2 -2
  7. package/dist-cli/chunks/beta-HL46FNX3.js +2 -0
  8. package/dist-cli/chunks/{camera-XICNRGGO.js → camera-BJCRYG27.js} +2 -2
  9. package/dist-cli/chunks/{chunk-S3C2S27B.js → chunk-24FHNNST.js} +2 -2
  10. package/dist-cli/chunks/{chunk-GIZDZKHC.js → chunk-2HJU3NAO.js} +1 -1
  11. package/dist-cli/chunks/{chunk-URGNAE7V.js → chunk-4DLUGQXQ.js} +21 -21
  12. package/dist-cli/chunks/{chunk-U7UICUB4.js → chunk-6WWKUDWP.js} +2 -2
  13. package/dist-cli/chunks/{chunk-CCFLATUR.js → chunk-73WAFGRP.js} +2 -2
  14. package/dist-cli/chunks/{chunk-G6VHJWGQ.js → chunk-7NP5BWIH.js} +1 -1
  15. package/dist-cli/chunks/{chunk-SPKRGAWR.js → chunk-AHTGZMT4.js} +2 -2
  16. package/dist-cli/chunks/{chunk-J4GDWHXE.js → chunk-AK4CONMS.js} +2 -2
  17. package/dist-cli/chunks/{chunk-4BUASWNE.js → chunk-AY5S4CWZ.js} +1 -1
  18. package/dist-cli/chunks/{chunk-VDONTXCB.js → chunk-B4KB5TBV.js} +1 -1
  19. package/dist-cli/chunks/chunk-BZRIJJIK.js +1 -0
  20. package/dist-cli/chunks/{chunk-YN44PKW5.js → chunk-CJHPCUUV.js} +1 -1
  21. package/dist-cli/chunks/{chunk-GPLW7IL5.js → chunk-CMGPYPUE.js} +2 -2
  22. package/dist-cli/chunks/{chunk-UGNYHNBN.js → chunk-CRPOEKYT.js} +3 -3
  23. package/dist-cli/chunks/{chunk-4XCGYTBN.js → chunk-DVZVP32W.js} +2 -2
  24. package/dist-cli/chunks/{chunk-J74AW22R.js → chunk-EEUNNW2P.js} +1 -1
  25. package/dist-cli/chunks/{chunk-2FNN7T63.js → chunk-F5H6XTMN.js} +1 -1
  26. package/dist-cli/chunks/{chunk-SBP46OOV.js → chunk-FAUOGIHF.js} +1 -1
  27. package/dist-cli/chunks/{chunk-CQSIRKJ2.js → chunk-FEMAFOUH.js} +2 -2
  28. package/dist-cli/chunks/{chunk-P5JY275Q.js → chunk-FP3DRAKI.js} +2 -2
  29. package/dist-cli/chunks/{chunk-DA7KPSMF.js → chunk-IKZ4Z6ND.js} +1 -1
  30. package/dist-cli/chunks/{chunk-CU3LQUJD.js → chunk-JDCABF7Y.js} +2 -2
  31. package/dist-cli/chunks/{chunk-HZCW6RRE.js → chunk-KLBOD2JL.js} +2 -2
  32. package/dist-cli/chunks/{chunk-7SPHDLSB.js → chunk-L5HYRG4P.js} +2 -2
  33. package/dist-cli/chunks/{chunk-HKKKZRKS.js → chunk-LIR2VPPJ.js} +2 -2
  34. package/dist-cli/chunks/{chunk-BGDEZZWT.js → chunk-MW3G72KG.js} +2 -2
  35. package/dist-cli/chunks/{chunk-P735P65P.js → chunk-NN7XOWXY.js} +4 -4
  36. package/dist-cli/chunks/{chunk-6TZMBHQ5.js → chunk-OTCJCVFR.js} +3 -3
  37. package/dist-cli/chunks/chunk-OUZAVYUG.js +1 -0
  38. package/dist-cli/chunks/{chunk-LWECTC6A.js → chunk-Q7K5GJR4.js} +2 -2
  39. package/dist-cli/chunks/{chunk-VURHG6DO.js → chunk-Q7U5TPQN.js} +1 -1
  40. package/dist-cli/chunks/{chunk-TNPHXSMV.js → chunk-QWJG2WVA.js} +1 -1
  41. package/dist-cli/chunks/{chunk-M2DYRSIS.js → chunk-RZMI7IKL.js} +2 -2
  42. package/dist-cli/chunks/{chunk-DRFWZ74H.js → chunk-SXS5SPIZ.js} +1 -1
  43. package/dist-cli/chunks/{chunk-HIDDRHAN.js → chunk-T2NAWDMZ.js} +2 -2
  44. package/dist-cli/chunks/{chunk-CRU7UL5Q.js → chunk-TGXLBFTC.js} +1 -1
  45. package/dist-cli/chunks/{chunk-AWSL2LAA.js → chunk-TNEHHCMZ.js} +2 -2
  46. package/dist-cli/chunks/{chunk-HBCEGJQH.js → chunk-V64N734Y.js} +2 -2
  47. package/dist-cli/chunks/{chunk-SSLFXUZQ.js → chunk-VOZZ62OJ.js} +1 -1
  48. package/dist-cli/chunks/{chunk-QNRORBZE.js → chunk-XB6FCXX3.js} +2 -2
  49. package/dist-cli/chunks/{chunk-RESHDGBU.js → chunk-YMFQOXT4.js} +1 -1
  50. package/dist-cli/chunks/{chunk-VSGSEQE7.js → chunk-Z4QP44SI.js} +2 -2
  51. package/dist-cli/chunks/{chunk-UPLXEL4D.js → chunk-ZJI2JP7F.js} +1 -1
  52. package/dist-cli/chunks/cli-version-5FG6LIHX.js +2 -0
  53. package/dist-cli/chunks/{compat-MF7YZPCS.js → compat-IETPHSZ3.js} +3 -3
  54. package/dist-cli/chunks/{config-WJSCJ622.js → config-BOOBJ25W.js} +2 -2
  55. package/dist-cli/chunks/{control-AZFQJXJ5.js → control-U52Q4YES.js} +2 -2
  56. package/dist-cli/chunks/daemon-EJDBU2UY.js +2 -0
  57. package/dist-cli/chunks/{debug-LIXGHFHV.js → debug-X4AW6CXJ.js} +3 -3
  58. package/dist-cli/chunks/{desktop-T7GTXHL4.js → desktop-HHREMDE2.js} +3 -3
  59. package/dist-cli/chunks/{detox-WV5FD4G6.js → detox-AXETJDTZ.js} +2 -2
  60. package/dist-cli/chunks/{device-GPHUF3BL.js → device-B7PBIMER.js} +2 -2
  61. package/dist-cli/chunks/{diagnose-OAXHSPXW.js → diagnose-7YEDF42J.js} +2 -2
  62. package/dist-cli/chunks/drivers-325S27FC.js +2 -0
  63. package/dist-cli/chunks/film-XQMAOELQ.js +87 -0
  64. package/dist-cli/chunks/flow-V2SWGBAR.js +2 -0
  65. package/dist-cli/chunks/help-F4VH4LXF.js +2 -0
  66. package/dist-cli/chunks/{home-paths-T3SY5QGR.js → home-paths-I3NOFS6P.js} +2 -2
  67. package/dist-cli/chunks/inspect-NY5VGZNC.js +2 -0
  68. package/dist-cli/chunks/install-desktop-X7SXH7IN.js +2 -0
  69. package/dist-cli/chunks/{login-QS2GVTJJ.js → login-O4ZPWWEU.js} +4 -4
  70. package/dist-cli/chunks/{logout-I752SSKU.js → logout-REEPRXWZ.js} +2 -2
  71. package/dist-cli/chunks/{maestro-RDBKRP4O.js → maestro-OCUCS5DY.js} +3 -3
  72. package/dist-cli/chunks/{maestro-generate-JOTQKAEH.js → maestro-generate-VHUHJFHR.js} +3 -3
  73. package/dist-cli/chunks/{mode-Z4W3XXXU.js → mode-T24V4RZ4.js} +2 -2
  74. package/dist-cli/chunks/optional-demo-registry-HPLGNZCO.js +2 -0
  75. package/dist-cli/chunks/{perf-RXXW5GRA.js → perf-ZUER6TVQ.js} +2 -2
  76. package/dist-cli/chunks/{record-527ZYKHE.js → record-XDKPMUBK.js} +3 -3
  77. package/dist-cli/chunks/runtime-4A24ALGX.js +2 -0
  78. package/dist-cli/chunks/screenshot-command-MMUGPJ4I.js +151 -0
  79. package/dist-cli/chunks/{screenshots-capture-VC752Q3V.js → screenshots-capture-OM6BE572.js} +2 -2
  80. package/dist-cli/chunks/{serve-NU6WWN2K.js → serve-BCATAS4S.js} +2 -2
  81. package/dist-cli/chunks/{setup-6BJWI3PC.js → setup-LXPQLQ6I.js} +3 -3
  82. package/dist-cli/chunks/{skills-L7JPAJEZ.js → skills-OOPLWNI2.js} +2 -2
  83. package/dist-cli/chunks/{storage-XIZZSPC3.js → storage-E7MGHPIG.js} +2 -2
  84. package/dist-cli/chunks/store-3DU64I7C.js +2 -0
  85. package/dist-cli/chunks/telemetry-AKRLP3AR.js +2 -0
  86. package/dist-cli/chunks/{timeline-3MAGSV2V.js → timeline-4AN6A5CV.js} +2 -2
  87. package/dist-cli/chunks/{upgrade-YDHOHVYZ.js → upgrade-FRBWFDPI.js} +2 -2
  88. package/dist-cli/chunks/upload-XGUWNMYV.js +2 -0
  89. package/dist-cli/chunks/{version-QDGDS5P2.js → version-LI2X5HLA.js} +2 -2
  90. package/dist-cli/chunks/web-UDCVLGPU.js +2 -0
  91. package/dist-cli/chunks/{what-happened-4GGACNI4.js → what-happened-2NTKQ4AT.js} +2 -2
  92. package/dist-lib/agent-daemon-client.cjs +1 -1
  93. package/dist-lib/agent-events.cjs +1 -1
  94. package/dist-lib/agent-identity.cjs +1 -1
  95. package/dist-lib/agent-sessions.cjs +1 -1
  96. package/dist-lib/attached-projects.cjs +1 -1
  97. package/dist-lib/auth/shared-session.cjs +1 -1
  98. package/dist-lib/backend-origin.cjs +1 -1
  99. package/dist-lib/beta.cjs +1 -1
  100. package/dist-lib/beta.mjs +1 -1
  101. package/dist-lib/bridge-constants.cjs +1 -1
  102. package/dist-lib/cli-constants.cjs +1 -1
  103. package/dist-lib/config.cjs +1 -1
  104. package/dist-lib/detox/index.cjs +1 -1
  105. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  106. package/dist-lib/home-paths.cjs +1 -1
  107. package/dist-lib/host/bridge-host.cjs +1 -1
  108. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  109. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  110. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  111. package/dist-lib/host/websocket-proxy.cjs +1 -1
  112. package/dist-lib/index.cjs +1 -1
  113. package/dist-lib/jump-to-source-babel.cjs +1 -1
  114. package/dist-lib/menu.cjs +1 -1
  115. package/dist-lib/menu.mjs +1 -1
  116. package/dist-lib/metro.cjs +1 -1
  117. package/dist-lib/profiles.cjs +1 -1
  118. package/dist-lib/render-mode.cjs +1 -1
  119. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  120. package/dist-lib/sdk.cjs +1 -1
  121. package/dist-lib/sdk.mjs +1 -1
  122. package/dist-lib/skills.cjs +13 -11
  123. package/dist-lib/vite.cjs +1 -1
  124. package/package.json +1 -1
  125. package/dist-cli/chunks/beta-MTYUL7U7.js +0 -2
  126. package/dist-cli/chunks/chunk-5LT4NR6Y.js +0 -1
  127. package/dist-cli/chunks/chunk-6KRC622O.js +0 -1
  128. package/dist-cli/chunks/cli-version-BP5GKAZ6.js +0 -2
  129. package/dist-cli/chunks/daemon-MU77JEAP.js +0 -2
  130. package/dist-cli/chunks/drivers-LJAA7XSZ.js +0 -2
  131. package/dist-cli/chunks/film-ZBYERRWW.js +0 -69
  132. package/dist-cli/chunks/flow-TXG46ARF.js +0 -2
  133. package/dist-cli/chunks/help-BVVLN5KL.js +0 -2
  134. package/dist-cli/chunks/inspect-7SHQVCCL.js +0 -2
  135. package/dist-cli/chunks/install-desktop-RFGXCZRS.js +0 -2
  136. package/dist-cli/chunks/optional-demo-registry-JTRVZB45.js +0 -2
  137. package/dist-cli/chunks/runtime-DOAHJLEK.js +0 -2
  138. package/dist-cli/chunks/screenshot-command-OBPEZJLR.js +0 -151
  139. package/dist-cli/chunks/store-3UAGOXD4.js +0 -2
  140. package/dist-cli/chunks/telemetry-IXCWQVEB.js +0 -2
  141. package/dist-cli/chunks/upload-YQVEPIO7.js +0 -2
  142. package/dist-cli/chunks/web-BK6VHH5W.js +0 -2
@@ -1,151 +0,0 @@
1
- /*! sootsim v0.1.216 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as te,b as oe,f as re}from"./chunk-URGNAE7V.js";import{b as J}from"./chunk-P735P65P.js";import{a as Z}from"./chunk-HBCEGJQH.js";import"./chunk-CU3LQUJD.js";import"./chunk-HIDDRHAN.js";import{a as Q,b as ee}from"./chunk-J4GDWHXE.js";import"./chunk-7SPHDLSB.js";import"./chunk-CQSIRKJ2.js";import"./chunk-5LT4NR6Y.js";import"./chunk-4BUASWNE.js";import"./chunk-VDONTXCB.js";import"./chunk-SBP46OOV.js";import"./chunk-GPLW7IL5.js";import{r as q}from"./chunk-G6VHJWGQ.js";import{g as F,h as V,i as E,j as K,k as X,l as v,m as P}from"./chunk-SPKRGAWR.js";import"./chunk-BGDEZZWT.js";import"./chunk-GIZDZKHC.js";import"./chunk-UPLXEL4D.js";import"./chunk-TNPHXSMV.js";import"./chunk-U7UICUB4.js";import"./chunk-LWECTC6A.js";import"./chunk-AWSL2LAA.js";import"./chunk-P5JY275Q.js";import"./chunk-QNRORBZE.js";import"./chunk-VURHG6DO.js";import"./chunk-YN44PKW5.js";import"./chunk-RESHDGBU.js";import{a as x,b as z,c as _,d as j,e as I,f as D,g as N}from"./chunk-DA7KPSMF.js";import"./chunk-J74AW22R.js";import{mkdirSync as ie,writeFileSync as ne}from"fs";import{dirname as ae,resolve as ce}from"path";async function le(e,t){let o=je(e);(o.includes("--help")||o.includes("-h"))&&(console.log(`
3
- sootsim screenshot \u2014 capture the canvas as a PNG
4
-
5
- usage:
6
- sootsim screenshot [output] [options]
7
- sootsim screenshot [options] --output <path>
8
-
9
- options:
10
- --output <path> output file path (default: /tmp/sootsim-inspect.png)
11
- first positional arg works too: \`screenshot /tmp/x.png\`
12
- --with-frame wrap the captured screen in a tight device frame
13
- --no-frame capture the raw screen bitmap (default)
14
- --no-shell tenant-only capture (no status bar, keyboard, toasts,
15
- notification center, or other shell overlays). use for
16
- clean app screenshots when a shell surface is in the way.
17
- --shell-only capture only the shell chrome, no tenant content
18
- --area x,y,w,h crop to a logical sootsim rect
19
- --id <testID> crop to a node's bounding box
20
- --text <text> crop to a node found by text content
21
- --gallery crawl and capture multiple screens as HTML gallery
22
- --themes capture light and dark variants
23
-
24
- examples:
25
- sootsim screenshot
26
- sootsim screenshot --no-shell --output app.png
27
- sootsim screenshot --with-frame --output framed.png
28
- sootsim screenshot --area 0,200,393,400 --output hero.png
29
- sootsim screenshot --id loginButton --output button.png
30
- `),process.exit(0));let i=Ie(o);if(i.length>0){for(let{flag:p,suggestion:g}of i)console.error(g?` unknown flag: ${p} (did you mean ${g}?)`:` unknown flag: ${p}`);console.error(" run `sootsim screenshot --help` for the list of supported flags"),process.exit(1)}let r=o.includes("--gallery"),s=o.includes("--themes"),n=Oe(o),a=Te(o);if(r||s)return n&&(console.error(" --with-frame is not supported with --gallery / --themes"),process.exit(1)),se(o,t);n&&o.some(p=>p==="--area"||p==="--id"||p==="--text")&&(console.error(" --with-frame only supports full-screen capture for now"),console.error(" remove --area / --id / --text, or capture raw and compose later"),process.exit(1));let c=F(o,{port:t.port,stripBooleanFlags:["--with-frame","--no-frame","--no-shell","--shell-only"],stripValueFlags:["--output","--area","--id","--text"]}),l=de(o),u=await Ae(o);if(await Ee(c.wsPort)){try{await Be(c,l,u,n,a)}catch(p){console.error(` screenshot failed: ${p instanceof Error?p.message:String(p)}`),process.exit(1)}return}n&&(console.error(" --with-frame requires a running sootsim bridge"),console.error(" open the app in a live sim first, then rerun the command"),process.exit(1)),u&&(console.error(" --area / --id / --text require a running sootsim bridge"),console.error(" start one with `sootsim serve`, `sootsim desktop`, or your project dev server"),process.exit(1)),await se(o,t)}async function Ee(e){let t=V(e,{commandTimeoutMs:1e3});try{return await t.listSims(),!0}catch{return!1}finally{t.close()}}async function Ae(e){let t=e.find((r,s)=>e[s-1]==="--area");if(t){let r=t.split(",").map(l=>Number(l.trim()));if(r.length!==4||r.some(l=>!Number.isFinite(l)))throw new Error(`--area expects x,y,w,h (got "${t}")`);let[s,n,a,c]=r;return{x:s,y:n,w:a,h:c}}let o=e.find((r,s)=>e[s-1]==="--id"),i=e.find((r,s)=>e[s-1]==="--text");return o||i?{__matcher:{id:o,text:i}}:null}async function Be(e,t,o,i,r){let s=E({...e,commandTimeoutMs:45e3});try{(await K(s)).hidden&&process.stderr.write(` \u26A0 screenshot will capture the LAST PAINTED canvas \u2014 likely stale.
31
- navigation/\`shell\` commands sent before this screenshot may not
32
- have repainted yet. focus the tab manually or \`sootsim --sim <id>\`
33
- to target a visible sim before capturing.
34
-
35
- `);let a=Number(process.env.SOOT_SCREENSHOT_READY_MAX_MS)||9e4,c=await q(s,a);if(!c.ready)throw new Error(`app not ready to capture after ${Math.round(c.elapsedMs/1e3)}s`+(c.loadingText?` (still showing "${c.loadingText}")`:"")+"; refusing to capture the boot/loading card. retry once the app paints.");let l=o,u=o?.__matcher;if(u){let w=await s.send({type:"evaluate",code:J(u)});if(!w)throw new Error(u.id?`no node with id "${u.id}"`:`no node matching text "${u.text}"`);l=w}let d=l?{x:l.x,y:l.y,w:l.w,h:l.h}:void 0,p={type:"screenshot"};r&&(p.layers=r),d&&(p.crop=d);let f=(await s.send(p)).replace(/^data:image\/png;base64,/,"");d&&console.log(` area: x=${d.x} y=${d.y} w=${d.w} h=${d.h}`),r&&console.log(` layers: ${r}`);let m=ce(process.cwd(),t||"/tmp/sootsim-inspect.png");ie(ae(m),{recursive:!0});let y=Buffer.from(f,"base64");if(i){let w=await Re(s);if(!w)throw new Error("could not read current device model from the target sim");let Fe=await te(y,w);ne(m,Fe),console.log(` frame: ${w}`)}else ne(m,y);console.log(` saved: ${m}`)}finally{s.close()}}async function Re(e){let t=await v(e,"SootSim.bridges.settings.get")??{deviceModel:null},o=typeof t.deviceModel=="string"?t.deviceModel:null;return!o||!(o in N)?null:o}function Oe(e){let t=!1;for(let o of e)o==="--with-frame"&&(t=!0),o==="--no-frame"&&(t=!1);return t}function Te(e){if(e.includes("--shell-only"))return"shell";if(e.includes("--no-shell"))return"tenant"}var ze=new Set(["--help","-h","--verbose","-v","--with-frame","--no-frame","--no-shell","--shell-only","--gallery","--themes"]),ue=new Set(["--output","--area","--id","--text","--url","--port","--timeout","--sim"]),_e={"--rect":"--area","--crop":"--area","--region":"--area","--bounds":"--area","--box":"--area","--xywh":"--area","--out":"--output","-o":"--output","--file":"--output","--path":"--output","--testid":"--id","--test-id":"--id","--test_id":"--id"};function je(e){let t=[],o={"-o":"--output","--out":"--output","--file":"--output","--path":"--output","--testid":"--id","--test-id":"--id","--test_id":"--id","--rect":"--area","--crop":"--area","--region":"--area","--bounds":"--area","--box":"--area","--xywh":"--area"};for(let i of e){let r=o[i];t.push(r??i)}return t}function Ie(e){let t=[];for(let o=0;o<e.length;o++){let i=e[o];if(i.startsWith("-")){if(ue.has(i)){o++;continue}ze.has(i)||t.push({flag:i,suggestion:_e[i]})}}return t}function de(e){let t=e.find((o,i)=>e[i-1]==="--output");if(t)return t;for(let o=0;o<e.length;o++){let i=e[o];if(i.startsWith("-")){ue.has(i)&&o++;continue}return i}}async function se(e,t){let o=de(e)||"sootsim-screenshot.png",i=e.includes("--gallery"),r=e.find((a,c)=>e[c-1]==="--url")||`http://localhost:${t.port||5173}`,{chromium:s}=await import("playwright"),n=await s.launch({channel:"chrome",headless:!0});try{if(i)console.log(" capturing gallery..."),console.log(" (gallery mode not yet implemented)");else{let a=await n.newPage({viewport:{width:500,height:900}});await a.goto(r,{waitUntil:"networkidle"}),await a.waitForTimeout(2e3);let c=ce(process.cwd(),o);ie(ae(c),{recursive:!0}),await a.screenshot({path:c}),console.log(` saved: ${c}`),await a.close()}}catch(a){console.error(` screenshot failed: ${a.message}`),process.exitCode=1}finally{await n.close()}}import{mkdirSync as W,readFileSync as Ze,writeFileSync as ke}from"fs";import{tmpdir as Jt}from"os";import R from"path";import{mkdirSync as me,readFileSync as Ue,writeFileSync as he}from"fs";import U from"path";function pe(e){return e.replace(/\\/g,"/").replace(/\.png$/i,"").trim().split("/").filter(Boolean).join("--").replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"slide"}function L(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}function Le(e){let t=e.trim();return/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function A(e,t){let o=Le(e),i=Math.max(0,Math.min(1,t)),r=o.match(/^#([0-9a-f]{6})$/i);if(r){let s=r[1],n=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),c=Number.parseInt(s.slice(4,6),16);return`rgba(${n}, ${a}, ${c}, ${i})`}return o.startsWith("rgb(")?o.replace(/^rgb\((.+)\)$/i,`rgba($1, ${i})`):o}function He(e){if(e.type==="solid")return e.color||"#000000";let t=e.direction??180,o=e.stops?.map(i=>`${i.color} ${i.offset}%`).join(", ")||"#000000 0%, #111111 100%";return`linear-gradient(${t}deg, ${o})`}function Ye(e){let t=e.glow;return t?`radial-gradient(circle at 50% 24%, ${A(t,.46)} 0%, ${A(t,.2)} 24%, rgba(0,0,0,0) 62%)`:"none"}function H(e){switch(e){case"tilted-left":return"perspective(2400px) rotateY(10deg) rotateZ(-2deg)";case"tilted-right":return"perspective(2400px) rotateY(-10deg) rotateZ(2deg)";case"cut-bottom":return"translateY(10%) scale(1.08)";case"cut-top":return"translateY(-16%) scale(1.08)";case"straight":default:return"none"}}function fe(...e){let t=e.map(o=>o.trim()).filter(o=>o.length>0&&o!=="none");return t.length>0?t.join(" "):"none"}function Y(e){let t=A(e.color,e.opacity),o=A(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${o}) drop-shadow(0 0 ${e.blur}px ${t})`}function G(e,t){return!t.glow||e.color&&e.color!==x.color?e:{...e,color:t.glow}}function Ge(e,t){if(e==="editorial-left"){let r=Math.round(t.height*.056),s=Math.round(t.height*.022);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.12)}px`,`left:${Math.round(t.width*.085)}px`,`width:${Math.round(t.width*.42)}px`,"text-align:left","z-index:3"].join(";"),titleStyle:`font-size:${r}px;line-height:0.92;`,subStyle:`font-size:${s}px;line-height:1.36;max-width:${Math.round(t.width*.36)}px;`,eyebrowStyle:"align-items:flex-start;",deviceStyle:(n,a,c)=>{let l=Math.round(t.width*.68*(a.scale??n.scale)),u=Math.round(t.height*(.03+n.offsetY+(a.offsetY??0))),d=a.pose||n.pose||"tilted-right",p=G(n.shadow,c);return["position:absolute",`top:${Math.round(t.height*.18)+u}px`,`left:${Math.round(t.width*.56)}px`,`width:${l}px`,"transform-origin:center center",`transform:${H(d)}`,`filter:${Y(p)}`,"z-index:2"].join(";")}}}if(e==="minimal-bottom"){let r=Math.round(t.height*.041),s=Math.round(t.height*.019);return{copyStyle:["position:absolute",`left:${Math.round(t.width*.12)}px`,`right:${Math.round(t.width*.12)}px`,`bottom:${Math.round(t.height*.085)}px`,"text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${r}px;line-height:0.96;`,subStyle:`font-size:${s}px;line-height:1.34;max-width:${Math.round(t.width*.56)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(n,a,c)=>{let l=Math.round(t.width*.84*(a.scale??n.scale)),u=Math.round(t.height*(n.offsetY+(a.offsetY??0))),d=a.pose||n.pose,p=G(n.shadow,c);return["position:absolute",`top:${Math.round(t.height*.075)+u}px`,"left:50%",`width:${l}px`,"transform-origin:center center",`transform:${fe("translateX(-50%)",H(d))}`,`filter:${Y(p)}`,"z-index:2"].join(";")}}}let o=Math.round(t.height*.04),i=Math.round(t.height*.019);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.084)}px`,"left:50%",`width:${Math.round(t.width*.88)}px`,"transform:translateX(-50%)","text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${o}px;line-height:0.92;`,subStyle:`font-size:${i}px;line-height:1.34;max-width:${Math.round(t.width*.6)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(r,s,n)=>{let a=Math.round(t.width*.64*(s.scale??r.scale)),c=Math.round(t.height*(r.offsetY+(s.offsetY??0))),l=s.pose||r.pose,u=G(r.shadow,n);return["position:absolute",`top:${Math.round(t.height*.28)+c}px`,"left:50%",`width:${a}px`,"transform-origin:center top",`transform:${fe("translateX(-50%)",H(l))}`,`filter:${Y(u)}`,"z-index:2"].join(";")}}}function We({canvas:e,compose:t,slide:o,imageDataUrl:i}){let r=o.background??t.background,s=Ge(t.text.preset,e),n=t.text.preset!=="none"&&!!(o.eyebrow||o.headline||o.subheadline),a=s.deviceStyle(t.frame,o,r),c=o.headline?`<div style="font-weight:780;white-space:pre-line;text-wrap:balance;${s.titleStyle}">${L(o.headline)}</div>`:"",l=o.subheadline?`<div style="margin-top:${Math.round(e.height*.018)}px;color:${t.text.subColor};white-space:pre-line;text-wrap:balance;${s.subStyle}">${L(o.subheadline)}</div>`:"",u=o.eyebrow?`<div style="display:flex;${s.eyebrowStyle}margin-bottom:${Math.round(e.height*.016)}px;"><div style="font-size:${Math.round(e.height*.014)}px;font-weight:700;letter-spacing:0.18em;text-transform:uppercase;color:${t.text.eyebrowColor};">${L(o.eyebrow)}</div></div>`:"";return`<!doctype html>
36
- <html>
37
- <head>
38
- <meta charset="utf-8" />
39
- <style>
40
- html, body {
41
- margin: 0;
42
- width: ${e.width}px;
43
- height: ${e.height}px;
44
- overflow: hidden;
45
- background: transparent;
46
- }
47
- body {
48
- font-family: "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
49
- }
50
- #canvas {
51
- position: relative;
52
- width: ${e.width}px;
53
- height: ${e.height}px;
54
- overflow: hidden;
55
- background: ${He(r)};
56
- color: ${t.text.color};
57
- isolation: isolate;
58
- }
59
- #glow {
60
- position: absolute;
61
- inset: 0;
62
- background: ${Ye(r)};
63
- pointer-events: none;
64
- }
65
- #copy {
66
- ${s.copyStyle};
67
- }
68
- #device {
69
- ${a};
70
- }
71
- #device img {
72
- display: block;
73
- width: 100%;
74
- height: auto;
75
- }
76
- </style>
77
- </head>
78
- <body>
79
- <div id="canvas">
80
- <div id="glow"></div>
81
- ${n?`<div id="copy">${u}${c}${l}</div>`:""}
82
- <div id="device"><img src="${i}" alt="" /></div>
83
- </div>
84
- </body>
85
- </html>`}async function ge(e,t,o){let i=[],r=o??await(async()=>{let{chromium:n}=await import("playwright");return n.launch({headless:!0})})();try{let n=await r.newContext({viewport:{width:1280,height:720}});try{for(let a of t){let l=`data:image/png;base64,${Ue(a.imagePath).toString("base64")}`;for(let u of e.canvases){let d=await n.newPage();try{await d.setViewportSize({width:u.width,height:u.height}),await d.setContent(We({canvas:u,compose:e,slide:a.slide,imageDataUrl:l}),{waitUntil:"load"}),await d.waitForTimeout(20);let p=U.join(e.outDir,u.name,e.locale);me(p,{recursive:!0});let g=U.join(p,`${a.slide.assetKey}.png`),f=await d.screenshot({type:"png",clip:{x:0,y:0,width:u.width,height:u.height}});he(g,f),i.push({slideId:a.slide.id,canvas:u.name,locale:e.locale,outputPath:g,sourcePath:a.imagePath})}finally{await d.close()}}}}finally{await n.close()}}finally{!o&&typeof r.close=="function"&&await r.close()}me(e.outDir,{recursive:!0});let s=U.join(e.outDir,"manifest.json");return he(s,JSON.stringify({generatedAt:new Date().toISOString(),locale:e.locale,outputs:i},null,2)),{manifestPath:s,outputs:i.map(n=>n.outputPath),entries:i}}function C(e){return typeof e=="string"&&e.length>0?e:void 0}async function we(e){let o=`${e.origin.replace(/\/$/,"")}/api/sootsim/screenshot-decks?org=${encodeURIComponent(e.org)}&repo=${encodeURIComponent(e.repo)}`,i=await fetch(o,{headers:{Authorization:e.authHeader}});if(!i.ok){let a=await i.text().catch(()=>"");throw new Error(`org deck fetch failed (${i.status} ${i.statusText}) for ${e.org}/${e.repo}${a?` \u2014 ${a.slice(0,200)}`:""}`)}let s=(await i.json()).decks?.[0];if(!s||!s.config||typeof s.config!="object")return null;let n=s.config.frames;return Array.isArray(n)?n.map(a=>{let c=a??{};return{title:C(c.title),subtitle:C(c.subtitle),bgTop:C(c.bgTop),bgBottom:C(c.bgBottom),titleColor:C(c.titleColor)}}):null}function ye(e,t){e.compose.slides.forEach((o,i)=>{let r=t[i];if(r&&(r.title!=null&&(o.headline=r.title),r.subtitle!=null&&(o.subheadline=r.subtitle),r.bgTop&&r.bgBottom)){let s={type:"gradient",direction:180,stops:[{offset:0,color:_(r.bgTop)},{offset:1,color:_(r.bgBottom)}]};o.background=s}})}import{readFileSync as qe}from"fs";import $ from"path";function h(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function B(e,t){if(!h(e))throw new Error(`${t} must be an object`);return e}function S(e,t=""){return typeof e=="string"?e:t}function b(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function Se(e,t){return typeof e=="boolean"?e:t}function k(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function be(e,t){return typeof e!="string"||e.trim().length===0?t:Object.prototype.hasOwnProperty.call(N,e)?e:null}function xe(e,t){if(typeof e=="string"){let r=D(e);if(!r)throw new Error(`unknown background preset: ${e}`);return r}if(!h(e))return I(t);let o=e.type==="solid"||e.type==="gradient"?e.type:t.type;if(o==="solid")return{type:o,color:S(e.color,t.color??"#000000"),glow:b(e.glow)??t.glow};let i=Array.isArray(e.stops)?e.stops.map(r=>{if(!h(r))return null;let s=k(r.offset,Number.NaN),n=b(r.color);return!Number.isFinite(s)||!n?null:{offset:s,color:n}}).filter(r=>!!r):t.stops?.map(r=>({...r}))??[];return{type:o,direction:k(e.direction,t.direction??180),glow:b(e.glow)??t.glow,stops:i.length>0?i:t.stops?.map(r=>({...r}))??[]}}function Ve(e){let o=(Array.isArray(e)?e:["iphone-6-9"]).map(i=>{if(typeof i!="string")throw new Error("compose.canvases entries must be strings");let r=j(i);if(!r)throw new Error(`unknown canvas preset: ${i}`);return r});if(o.length===0)throw new Error("compose.canvases must include at least one preset");return o}function Ke(e){switch(e){case"editorial-left":case"minimal-bottom":case"none":case"bold-top":return e;default:return"bold-top"}}function Xe(e){switch(e){case"plan":case"flow":case"auto":return e;default:return"auto"}}function $e(e){switch(e){case"straight":case"tilted-left":case"tilted-right":case"cut-bottom":case"cut-top":return e;default:return}}function M(e,t){return $.isAbsolute(t)?t:$.resolve(e,t)}function Je(e,t){if(!Array.isArray(e)||e.length===0)throw new Error("compose.slides must be a non-empty array");return e.map((o,i)=>{let r=B(o,`compose.slides[${i}]`),s=b(r.screenshot);if(!s)throw new Error(`compose.slides[${i}].screenshot is required`);let n=b(r.id),a=pe(n||s);return{id:n||a,assetKey:a,screenshot:s,headline:S(r.headline),subheadline:S(r.subheadline),eyebrow:S(r.eyebrow),pose:$e(r.pose),scale:typeof r.scale=="number"&&Number.isFinite(r.scale)?r.scale:void 0,offsetY:typeof r.offsetY=="number"&&Number.isFinite(r.offsetY)?r.offsetY:void 0,background:r.theme||r.background?xe(r.theme??r.background,t):void 0}})}function Pe(e){let t=$.resolve(e),o=$.dirname(t),i=Z.parse(qe(t,"utf8")),r=B(i,"screenshots plan"),s=B(r.capture??{},"capture"),n=B(r.compose??{},"compose"),a=typeof r.app=="number"?String(r.app):b(r.app),c=be(r.device,null),l=M(o,S(s.out,$.join(".sootsim","screenshots","capture"))),u=b(s.from),d=b(s.flow);if(!u&&!d)throw new Error("capture.flow or capture.from is required");let p=s.mode==="raw"||s.mode==="framed"||s.mode==="raw+framed"?s.mode:"raw+framed",g=Xe(s.pathMode),f=xe(n.background??"cyan",D("cyan")),m={show:Se(n.frame&&h(n.frame)?n.frame.show:void 0,!0),style:be(n.frame&&h(n.frame)?n.frame.style:null,null)||c||z,pose:$e(n.frame&&h(n.frame)?n.frame.pose:void 0)||"straight",scale:k(n.frame&&h(n.frame)?n.frame.scale:void 0,1),offsetY:k(n.frame&&h(n.frame)?n.frame.offsetY:void 0,0),shadow:{color:S(n.frame&&h(n.frame)&&h(n.frame.shadow)?n.frame.shadow.color:void 0,x.color),blur:k(n.frame&&h(n.frame)&&h(n.frame.shadow)?n.frame.shadow.blur:void 0,x.blur),spread:k(n.frame&&h(n.frame)&&h(n.frame.shadow)?n.frame.shadow.spread:void 0,x.spread),opacity:k(n.frame&&h(n.frame)&&h(n.frame.shadow)?n.frame.shadow.opacity:void 0,x.opacity)}};return{planPath:t,planDir:o,appTarget:a,deviceModel:c,capture:{flowPath:d?M(o,d):null,fromDir:u?M(o,u):null,outDir:l,rawDir:u?M(o,u):$.join(l,"raw"),framedDir:$.join(l,"framed"),mode:p,pathMode:g,simId:b(s.sim),openInNewSim:Se(s.new,!1)},compose:{outDir:M(o,S(n.out,$.join(".sootsim","screenshots","exports"))),locale:S(n.locale,"en"),canvases:Ve(n.canvases),frame:m,background:f,text:{preset:Ke(n.text&&h(n.text)?n.text.preset:void 0),color:S(n.text&&h(n.text)?n.text.color:void 0,"#ffffff"),subColor:S(n.text&&h(n.text)?n.text.subColor:void 0,"rgba(232,240,247,0.86)"),eyebrowColor:S(n.text&&h(n.text)?n.text.eyebrowColor:void 0,"rgba(229,242,255,0.72)")},slides:Je(n.slides,f)}}}function Qe(e){return e.capture.pathMode==="plan"||e.capture.pathMode==="flow"?e.capture.pathMode:e.capture.fromDir?"flow":"plan"}function et(e,t){if(!e.capture.flowPath)throw new Error("capture flow path is required to build flow args");let o=[e.capture.flowPath],i=Qe(e);o.push("--screenshots",e.capture.rawDir),i==="flow"&&o.push("--screenshot-paths","flow");let r=t.appTarget??e.appTarget,s=t.deviceModel??e.deviceModel,n=t.simId??e.capture.simId;return r&&o.push("--url",r),s&&o.push("--device",s),n&&o.push("--sim",n),e.capture.openInNewSim&&o.push("--new"),o}function O(e,t){return R.isAbsolute(t)?t:R.join(e.capture.rawDir,t)}function tt(e){return R.join(e.capture.outDir,"manifest.json")}async function ot(e,t){if(!e.capture.flowPath)return;W(e.capture.rawDir,{recursive:!0});let o=et(e,t),i=await re(o);if(i!==0)throw new Error(`flow capture failed with exit code ${i}`)}async function rt(e,t){let o=new Map;W(e.capture.framedDir,{recursive:!0});let i=t??await(async()=>{let{chromium:r}=await import("playwright");return r.launch({headless:!0})})();try{let r=await oe(i);try{for(let s of e.compose.slides){let n=O(e,s.screenshot),a=Ze(n),c=await r.compose(a,e.compose.frame.style),l=R.join(e.capture.framedDir,`${s.assetKey}.png`);ke(l,c),o.set(s.id,l)}}finally{await r.close()}}finally{!t&&typeof i.close=="function"&&await i.close()}return o}function nt(e,t,o){let i=[],r=[];W(e.capture.outDir,{recursive:!0});let s=tt(e),n=e.compose.slides.map(a=>{let c=O(e,a.screenshot),l=t.get(a.id)??null;return i.push(c),l&&r.push(l),{id:a.id,screenshot:a.screenshot,rawPath:c,framedPath:l}});return ke(s,JSON.stringify({generatedAt:new Date().toISOString(),deviceModel:o,mode:e.capture.mode,rawDir:e.capture.rawDir,framedDir:e.capture.framedDir,slides:n},null,2)),{manifestPath:s,rawDir:e.capture.rawDir,framedDir:e.capture.framedDir,rawFiles:i,framedFiles:r}}function st(e,t){return e.compose.slides.map(o=>({slide:o,imagePath:e.compose.frame.show===!0?t.get(o.id)??O(e,o.screenshot):O(e,o.screenshot)}))}async function ve(e,t={}){let o=Pe(e);t.orgDeckFrames&&t.orgDeckFrames.length>0&&ye(o,t.orgDeckFrames);let i=t.deviceModel??o.deviceModel;t.composeOnly||await ot(o,t);let r=o.capture.mode!=="raw"||!t.captureOnly&&o.compose.frame.show===!0,n=r||!t.captureOnly?await(async()=>{let{chromium:a}=await import("playwright");return a.launch({headless:!0})})():null;try{let a=r?await rt(o,n??void 0):new Map,c=nt(o,a,i);if(t.captureOnly)return{plan:o,capture:c,compose:null};let l=st(o,a),u=await ge(o.compose,l,n??void 0);return{plan:o,capture:c,compose:u}}finally{n&&typeof n.close=="function"&&await n.close()}}async function Ce(e,t={}){if(e.includes("--help")||e.includes("-h"))return console.log(`
86
- sootsim screenshot appstore \u2014 capture and compose app-store screenshot sets
87
-
88
- usage:
89
- sootsim screenshot appstore --plan <plan.yaml> [options]
90
-
91
- options:
92
- --plan <path> screenshot plan yaml
93
- --sim <id> reuse a live sim for capture
94
- --app <target> override plan app target (port, url, or shell url)
95
- --device <model> override plan capture device for this run
96
- --org <slug> overlay copy/colors from a team's org screenshot deck
97
- --repo <name> repo for --org (both required to pull the org deck)
98
- --api-origin <url> sootbean origin to fetch the deck from (default: the
99
- signed-in session origin, else https://sootbean.com)
100
- --capture-only stop after raw/framed intermediates
101
- --compose-only skip flow capture, reuse existing raw screenshots
102
-
103
- examples:
104
- sootsim screenshot appstore --plan app-store.yaml
105
- sootsim screenshot appstore --plan app-store.yaml --sim a9
106
- sootsim screenshot appstore --plan app-store.yaml --org acme --repo mobile
107
- `),0;let o=m=>e.find((y,w)=>e[w-1]===m),i=new Set(["--plan","--sim","--app","--device","--org","--repo","--api-origin"]),r=e.filter((m,y)=>{if(m.startsWith("-"))return!1;let w=e[y-1];return!w||!i.has(w)}),s=o("--plan")||r[0];if(!s)return console.error(" error: screenshots plan path is required (`--plan <path>`)."),1;let n=o("--sim")?.trim()||null,a=o("--app")?.trim()||null,c=o("--device")?.trim()||null,l=o("--org")?.trim()||null,u=o("--repo")?.trim()||null,d=o("--api-origin")?.trim()||null,p=e.includes("--capture-only"),g=e.includes("--compose-only"),f=null;if(l||u){if(!l||!u)return console.error(" error: --org and --repo must be passed together."),1;let m=Q();if(!m)return console.error(" error: --org/--repo needs auth \u2014 run `sootsim login` or set SOOTSIM_API_KEY."),1;let y=d||(m.kind==="session"?m.origin:"https://sootbean.com");try{f=await we({org:l,repo:u,origin:y,authHeader:ee(m)})}catch(w){return console.error(` ${w.message}`),1}!f||f.length===0?console.log(` note: no org deck for ${l}/${u} \u2014 composing with the plan's copy/colors.`):console.log(` org deck: ${f.length} slide(s) from ${l}/${u}`)}try{let m=await ve(s,{simId:n,appTarget:a,deviceModel:c,captureOnly:p,composeOnly:g,orgDeckFrames:f});return console.log(` capture manifest: ${m.capture.manifestPath}`),m.compose?(console.log(` compose manifest: ${m.compose.manifestPath}`),console.log(` exports: ${m.compose.outputs.length}`)):console.log(" compose skipped"),0}catch(m){return console.error(` screenshots failed: ${m.message}`),1}}import{mkdirSync as it,writeFileSync as at}from"node:fs";import{dirname as ct,isAbsolute as lt,join as Me,resolve as ut}from"node:path";var dt=`
108
- sootsim screenshot slides \u2014 compose App Store screenshots in the live sim
109
-
110
- usage:
111
- sootsim screenshot slides list slides (alias: slides list)
112
- sootsim screenshot slides set <n> [fields] patch a slide's copy/colors
113
- sootsim screenshot slides add append a blank slide (focuses it)
114
- sootsim screenshot slides remove <n> delete a slide
115
- sootsim screenshot slides focus <n> open a slide (device flips into it)
116
- sootsim screenshot slides overview back to the gallery
117
- sootsim screenshot slides capture [<n>] capture the live frame into a slide
118
- sootsim screenshot slides export [<n>] [--out <dir>]
119
- write composed App-Store PNG(s)
120
-
121
- set fields:
122
- --title <text> headline
123
- --subtitle <text> subheadline
124
- --bg-top <color> gradient top (white gray slate black cyan blue
125
- --bg-bottom <color> gradient bottom teal green lime gold orange coral
126
- --title-color <color> copy color override, or "auto" red berry magenta
127
- --title-size <s> sm | md | lg | none gray-light
128
- --underlay <s> black | white | none gray-dark \u2026)
129
- --shadow <s> light | medium | strong | none
130
-
131
- notes:
132
- slides are addressed by 1-based index. screenshot mode is auto-enabled.
133
- capture shoots whatever the sim currently shows \u2014 navigate the app first
134
- (sootsim do tap-id \u2026), then capture.
135
-
136
- examples:
137
- sootsim screenshot slides set 1 --title "The ultimate MMA community." --bg-top cyan --bg-bottom black
138
- sootsim screenshot slides capture 1
139
- sootsim screenshot slides export --out ./exports
140
- `,pt={"--title":"title","--subtitle":"subtitle","--bg-top":"bgTop","--bg-bottom":"bgBottom","--title-color":"titleColor","--title-size":"titleSize","--underlay":"titleUnderlay","--shadow":"titleShadow","--out":"out"};function mt(e){let t=[],o={},i=!1;for(let r=0;r<e.length;r+=1){let s=e[r];if(s==="--json"){i=!0;continue}let n=s.indexOf("="),a=n>0?s.slice(0,n):s,c=pt[a];if(c){n>0?o[c]=s.slice(n+1):(o[c]=e[r+1]??"",r+=1);continue}t.push(s)}return{rest:t,values:o,json:i}}function ht(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:e}async function ft(e){if(!await X(e,`(async () => {
141
- if (window.SootSim?.bridges?.settings?.get?.()?.screenshotMode) return true
142
- window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
143
- detail: { type: 'fire-action', id: 'toggle-screenshot-mode' },
144
- }))
145
- const deadline = Date.now() + 2000
146
- while (Date.now() < deadline) {
147
- if (window.SootSim?.bridges?.settings?.get?.()?.screenshotMode) return true
148
- await new Promise((r) => setTimeout(r, 40))
149
- }
150
- return false
151
- })()`,{acquireLock:!0}))throw new Error("could not enable screenshot mode \u2014 is this a browser sim with the screenshot plugin? (electron has no screenshot mode)")}function gt(e){console.log(` ${e.projectName} \u2014 canvas ${e.canvas} (${e.exportSize.width}\xD7${e.exportSize.height}), device ${e.deviceModel}`);for(let t of e.slides){let o=[t.focused?"focused":t.active?"active":null,t.captured?`captured${t.captureMode==="3d"?" 3d":""}`:"no capture"].filter(Boolean).join(", "),i=t.title?`"${t.title}"`:"(no title)",r=[`bg ${t.bgTop}\u2192${t.bgBottom}`,t.titleColor?`color ${t.titleColor}`:null,t.titleSize?`size ${t.titleSize}`:null,t.titleUnderlay?`underlay ${t.titleUnderlay}`:null,t.titleShadow?`shadow ${t.titleShadow}`:null].filter(Boolean).join(", ");console.log(` ${t.index}. ${i} \u2014 ${r} [${o}]`),t.subtitle&&console.log(` ${t.subtitle}`)}}function wt(e){let t=e.match(/^data:[^;]+;base64,(.+)$/);if(!t)throw new Error("export returned an unexpected payload");return Buffer.from(t[1],"base64")}async function De(e,t){if(e.includes("--help")||e.includes("-h")){console.log(dt);return}let{rest:o,values:i,json:r}=mt(e),s=F(o,{port:t.port,commandTimeoutMs:45e3}),n=s.positional[0]??"list",a=ht(s.positional[1]),c=E(s),l=u=>{r?console.log(JSON.stringify(u,null,2)):gt(u)};try{switch(await ft(c),n){case"list":{l(await v(c,"SootSim.bridges.screenshotControl.getState"));break}case"set":{if(a==null)throw new Error("usage: sootsim screenshot slides set <n> --title \u2026 (see --help)");let u={};for(let d of["title","subtitle","bgTop","bgBottom","titleColor","titleSize","titleUnderlay","titleShadow"])i[d]!=null&&(u[d]=i[d]);if(Object.keys(u).length===0)throw new Error("nothing to set \u2014 pass at least one field (see --help)");l(await P(c,"SootSim.bridges.screenshotControl.setSlide",a,u));break}case"add":{l(await P(c,"SootSim.bridges.screenshotControl.addSlide"));break}case"remove":{if(a==null)throw new Error("usage: sootsim screenshot slides remove <n>");l(await P(c,"SootSim.bridges.screenshotControl.removeSlide",a));break}case"focus":{if(a==null)throw new Error("usage: sootsim screenshot slides focus <n>");l(await P(c,"SootSim.bridges.screenshotControl.focusSlide",a));break}case"overview":{l(await P(c,"SootSim.bridges.screenshotControl.overview"));break}case"capture":{let u=await P(c,"SootSim.bridges.screenshotControl.capture",...a!=null?[a]:[]);l(u);break}case"export":{let u=i.out?lt(i.out)?i.out:ut(process.cwd(),i.out):Me(process.cwd(),"screenshots"),d=await v(c,"SootSim.bridges.screenshotControl.getState"),p=a!=null?d.slides.filter(f=>f.index===a||f.id===a):d.slides.filter(f=>f.captured);if(p.length===0)throw new Error(a!=null?`no slide ${a}`:"no captured slides to export \u2014 capture first");let g=[];for(let f of p){let m=await v(c,"SootSim.bridges.screenshotControl.exportSlide",f.index),y=Me(u,m.name);it(ct(y),{recursive:!0}),at(y,wt(m.dataUrl)),g.push(y),console.log(` saved: ${y} (${m.width}\xD7${m.height})`)}r&&console.log(JSON.stringify({written:g},null,2));break}default:throw new Error(`unknown subcommand "${n}" \u2014 see sootsim screenshot slides --help`)}}finally{c.close()}}var yt=new Set(["--sim","--port","-p","--output","-o","--out","--plan","--app","--device","--org","--repo","--api-origin","--branch","--platform","--slides","--shell-origin","--timeout"]),St=new Set(["capture","slides","appstore"]);function Ne(e){for(let t=0;t<e.length;t++){let o=e[t];if(o.startsWith("-")){yt.has(o)&&t++;continue}return St.has(o)?{name:o,index:t}:null}return null}function T(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function bt(e){let t=[];for(let o=0;o<e.length;o++){if(e[o]==="--sim"){o++;continue}t.push(e[o])}return t}async function wo(e,t){let o=Ne(e);if(!o||o.name==="capture"){await le(o?T(e,o.index):e,t);return}if(o.name==="slides"){await De(T(e,o.index),t);return}let i=T(e,o.index),r=Ne(i);if(r?.name==="capture")try{let{runScreenshotsCapture:s}=await import("./screenshots-capture-VC752Q3V.js");return await s(bt(T(i,r.index)))}catch(s){if(s instanceof Error&&"code"in s&&s.code==="ERR_MODULE_NOT_FOUND")return console.error("screenshot appstore capture is repo-only tooling \u2014 it needs the sootsim workspace (playwright is not shipped with the published CLI)."),1;throw s}return Ce(i,t)}export{wo as runScreenshotCommand};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.216 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a}from"./chunk-U7UICUB4.js";import"./chunk-DA7KPSMF.js";import"./chunk-J74AW22R.js";export{a as settingsStore};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.216 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a,b}from"./chunk-LWECTC6A.js";import"./chunk-AWSL2LAA.js";import"./chunk-RESHDGBU.js";import"./chunk-J74AW22R.js";export{b as flushCliTelemetry,a as trackCliEvent};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.216 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a,b,c}from"./chunk-HIDDRHAN.js";import"./chunk-J4GDWHXE.js";import"./chunk-4BUASWNE.js";import"./chunk-VDONTXCB.js";import"./chunk-SPKRGAWR.js";import"./chunk-UPLXEL4D.js";import"./chunk-LWECTC6A.js";import"./chunk-AWSL2LAA.js";import"./chunk-VURHG6DO.js";import"./chunk-YN44PKW5.js";import"./chunk-RESHDGBU.js";import"./chunk-J74AW22R.js";export{a as resolveDefaultUploadOrigin,b as resolvePublicPreviewOrigin,c as runUpload};