sootsim 0.1.229 → 0.1.231
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-cli/bin.js +4 -4
- package/dist-cli/chunks/{agent-O26YYN6Z.js → agent-AH5KSX6R.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-GSMHXP6S.js → agent-wrapper-6KEN4XWE.js} +2 -2
- package/dist-cli/chunks/{app-fonts-TVTDVD7S.js → app-fonts-6KSWFR34.js} +2 -2
- package/dist-cli/chunks/{assert-KEWRJSST.js → assert-VK3ZNVOE.js} +2 -2
- package/dist-cli/chunks/{auth-KQXLD6AC.js → auth-K5TSJU4G.js} +2 -2
- package/dist-cli/chunks/beta-GG4SKXJH.js +2 -0
- package/dist-cli/chunks/{camera-RTNVNBMT.js → camera-V4FPK26J.js} +2 -2
- package/dist-cli/chunks/{chunk-WRPO6J3Z.js → chunk-2D6RUG3E.js} +2 -2
- package/dist-cli/chunks/{chunk-VKVRAWJR.js → chunk-2WAYJJIL.js} +2 -2
- package/dist-cli/chunks/{chunk-AZWH6YSL.js → chunk-4GWETXII.js} +2 -2
- package/dist-cli/chunks/{chunk-THDVL3ST.js → chunk-4XMWRLHS.js} +1 -1
- package/dist-cli/chunks/{chunk-7IBNJPSB.js → chunk-5GMZJIXF.js} +2 -2
- package/dist-cli/chunks/{chunk-3FYUTNM4.js → chunk-75XS6H6B.js} +1 -1
- package/dist-cli/chunks/{chunk-BZOTL2IQ.js → chunk-76NRK5LH.js} +2 -2
- package/dist-cli/chunks/{chunk-7LSM7YNF.js → chunk-77PV2FU7.js} +1 -1
- package/dist-cli/chunks/{chunk-XQHCHVHE.js → chunk-7JZVKKSL.js} +2 -2
- package/dist-cli/chunks/{chunk-OUJVQUX4.js → chunk-ADT2LUD2.js} +1 -1
- package/dist-cli/chunks/{chunk-HKZICBKI.js → chunk-AE3BELZM.js} +1 -1
- package/dist-cli/chunks/{chunk-GVOFX6LJ.js → chunk-BCUTZMYU.js} +1 -1
- package/dist-cli/chunks/{chunk-62GPXYH7.js → chunk-BUQ4OVPF.js} +1 -1
- package/dist-cli/chunks/{chunk-FF7GZMWQ.js → chunk-D3ZEKF5O.js} +2 -2
- package/dist-cli/chunks/{chunk-4O73AHYA.js → chunk-DATFU5M3.js} +1 -1
- package/dist-cli/chunks/{chunk-U4OPCVAL.js → chunk-DVQS7XW4.js} +1 -1
- package/dist-cli/chunks/{chunk-3UE5OA64.js → chunk-EYBZL4LO.js} +2 -2
- package/dist-cli/chunks/{chunk-6Q3M6FMW.js → chunk-FAMEC3A3.js} +2 -2
- package/dist-cli/chunks/{chunk-SCGYOJJP.js → chunk-HGP47PYK.js} +2 -2
- package/dist-cli/chunks/{chunk-4WAZOAAS.js → chunk-HGXZ5LTS.js} +2 -2
- package/dist-cli/chunks/{chunk-SHBXXKJW.js → chunk-I3NLVJO7.js} +1 -1
- package/dist-cli/chunks/chunk-J3U5NHJ6.js +1 -0
- package/dist-cli/chunks/{chunk-AB7XCG3A.js → chunk-L7STWTUD.js} +1 -1
- package/dist-cli/chunks/{chunk-SYZKYAPC.js → chunk-MC32IMHX.js} +1 -1
- package/dist-cli/chunks/{chunk-UCVK6JDW.js → chunk-N5J3NQIA.js} +1 -1
- package/dist-cli/chunks/{chunk-V2TABN7W.js → chunk-NNXM4S37.js} +1 -1
- package/dist-cli/chunks/{chunk-S4CJUMUZ.js → chunk-NPCX4IAQ.js} +3 -3
- package/dist-cli/chunks/{chunk-VUJ5FLL7.js → chunk-NQASQSKK.js} +1 -1
- package/dist-cli/chunks/{chunk-CE3XI55C.js → chunk-NWTNH63K.js} +2 -2
- package/dist-cli/chunks/{chunk-TJXRSDEU.js → chunk-OE6VL4ZA.js} +2 -2
- package/dist-cli/chunks/{chunk-JK4AGL2U.js → chunk-P4X4M3ZU.js} +2 -2
- package/dist-cli/chunks/{chunk-PY65YXHI.js → chunk-PYYTNSGW.js} +3 -3
- package/dist-cli/chunks/{chunk-P3ORPGKZ.js → chunk-R6X7MBYT.js} +3 -3
- package/dist-cli/chunks/{chunk-PNLTVAPK.js → chunk-SB7INNHS.js} +3 -3
- package/dist-cli/chunks/{chunk-OWSZCLYZ.js → chunk-SCVX5MDD.js} +1 -1
- package/dist-cli/chunks/{chunk-32O3YKA2.js → chunk-SHSYOZSW.js} +3 -3
- package/dist-cli/chunks/{chunk-SPBHQVJ4.js → chunk-TDEFREVM.js} +2 -2
- package/dist-cli/chunks/{chunk-TWUPMUWQ.js → chunk-V3TEFUGE.js} +1 -1
- package/dist-cli/chunks/{chunk-HKBDDBKZ.js → chunk-V7J6D2DS.js} +2 -2
- package/dist-cli/chunks/{chunk-456MZ4LU.js → chunk-VPMLXKVQ.js} +2 -2
- package/dist-cli/chunks/{chunk-UGFZIHBA.js → chunk-VRTTFRVD.js} +2 -2
- package/dist-cli/chunks/{chunk-ZORXBO54.js → chunk-WAUO3ED2.js} +2 -2
- package/dist-cli/chunks/chunk-XE4BKSAN.js +1 -0
- package/dist-cli/chunks/{chunk-DXF6DHIR.js → chunk-YCAL6N7R.js} +2 -2
- package/dist-cli/chunks/{chunk-3FGXJMSF.js → chunk-ZVHAYHJO.js} +1 -1
- package/dist-cli/chunks/cli-version-JHTQTAP7.js +2 -0
- package/dist-cli/chunks/{compat-HPS6RGWD.js → compat-3ZU42KR4.js} +3 -3
- package/dist-cli/chunks/{config-EKIT7WKS.js → config-2M6LE7GM.js} +2 -2
- package/dist-cli/chunks/{control-QFNWOCLW.js → control-D7OTV6TJ.js} +2 -2
- package/dist-cli/chunks/daemon-PBEEDQBA.js +2 -0
- package/dist-cli/chunks/{debug-EU5JDWZR.js → debug-JMJNOHJD.js} +3 -3
- package/dist-cli/chunks/{desktop-OOCDJB3I.js → desktop-KB2WRU2C.js} +3 -3
- package/dist-cli/chunks/{detox-BXXEPJ3F.js → detox-EKPVQJDG.js} +2 -2
- package/dist-cli/chunks/{device-6B6NKGAW.js → device-KWIWZRFU.js} +2 -2
- package/dist-cli/chunks/{diagnose-FOWBMKO6.js → diagnose-GAZMES24.js} +2 -2
- package/dist-cli/chunks/drivers-SQSCB6TD.js +2 -0
- package/dist-cli/chunks/{film-MVJCHWBU.js → film-BZWIEUKD.js} +3 -3
- package/dist-cli/chunks/flow-RWWESFRX.js +2 -0
- package/dist-cli/chunks/help-77N2EWKA.js +2 -0
- package/dist-cli/chunks/{hidden-runtime-alias-OVGHDXOR.js → hidden-runtime-alias-Z2W6KIXU.js} +2 -2
- package/dist-cli/chunks/{home-paths-3W46OKY6.js → home-paths-SEZOWRM2.js} +2 -2
- package/dist-cli/chunks/inspect-DFW3SSR2.js +2 -0
- package/dist-cli/chunks/install-desktop-X4PMZYLV.js +2 -0
- package/dist-cli/chunks/{login-CU72MJHE.js → login-PSX27F6J.js} +4 -4
- package/dist-cli/chunks/{logout-SF5EPW7M.js → logout-NI5E3G7P.js} +2 -2
- package/dist-cli/chunks/{maestro-NYFSOD2H.js → maestro-PPFQ5C56.js} +3 -3
- package/dist-cli/chunks/{maestro-generate-VDAXEVCE.js → maestro-generate-6VJUC7Y2.js} +3 -3
- package/dist-cli/chunks/{mode-VSABDCU5.js → mode-7K2ZK3L3.js} +2 -2
- package/dist-cli/chunks/optional-demo-registry-IFCUM2NS.js +2 -0
- package/dist-cli/chunks/{perf-5XMCN7A2.js → perf-RBYOKWVM.js} +2 -2
- package/dist-cli/chunks/{record-NAYAEQPD.js → record-LHANNPUS.js} +3 -3
- package/dist-cli/chunks/runtime-QX5QTV2U.js +2 -0
- package/dist-cli/chunks/screenshot-command-RUDD2TRH.js +153 -0
- package/dist-cli/chunks/{screenshots-capture-JCBFMJFS.js → screenshots-capture-VVZYN5RO.js} +2 -2
- package/dist-cli/chunks/{serve-Z5HVGJ3C.js → serve-AE4VMFKM.js} +7 -7
- package/dist-cli/chunks/{setup-YKDBK3RX.js → setup-W6FVHUX5.js} +3 -3
- package/dist-cli/chunks/{skills-DQOWHZBC.js → skills-T4R4SJEB.js} +2 -2
- package/dist-cli/chunks/{storage-TKTKWTWE.js → storage-63GA4N7U.js} +2 -2
- package/dist-cli/chunks/store-RRGC4ZGZ.js +2 -0
- package/dist-cli/chunks/telemetry-FABN6VZA.js +2 -0
- package/dist-cli/chunks/{timeline-QJPIAP7L.js → timeline-BA6UP4YU.js} +2 -2
- package/dist-cli/chunks/{upgrade-4ZEV4BY2.js → upgrade-FF3QGMPI.js} +2 -2
- package/dist-cli/chunks/upload-GPOYAPIE.js +2 -0
- package/dist-cli/chunks/{version-OVU37MXP.js → version-C4LNO3QB.js} +2 -2
- package/dist-cli/chunks/{web-JUDK5W4T.js → web-43QRKPAU.js} +2 -2
- package/dist-cli/chunks/{what-happened-TKCIGNLL.js → what-happened-43KTITUH.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1 -2
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +5 -6
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/scripts/dev-server-scanner.ts +1 -1
- package/src/config.ts +5 -0
- package/src/host/agent-host.ts +1 -2
- package/dist-cli/chunks/beta-BXBII74U.js +0 -2
- package/dist-cli/chunks/chunk-6VQIZJLG.js +0 -1
- package/dist-cli/chunks/chunk-7FSM4I7A.js +0 -1
- package/dist-cli/chunks/cli-version-W42GGXV7.js +0 -2
- package/dist-cli/chunks/daemon-B6RUIEYN.js +0 -2
- package/dist-cli/chunks/drivers-DC6SRA2P.js +0 -2
- package/dist-cli/chunks/flow-XO4D3LRA.js +0 -2
- package/dist-cli/chunks/help-WNPSM6ZU.js +0 -2
- package/dist-cli/chunks/inspect-4J5NJCXS.js +0 -2
- package/dist-cli/chunks/install-desktop-GAEFTQ2K.js +0 -2
- package/dist-cli/chunks/optional-demo-registry-YQZA2MRD.js +0 -2
- package/dist-cli/chunks/runtime-LR63M7XX.js +0 -2
- package/dist-cli/chunks/screenshot-command-HFNYL2CY.js +0 -151
- package/dist-cli/chunks/store-FPAX23SK.js +0 -2
- package/dist-cli/chunks/telemetry-CWRFOESH.js +0 -2
- package/dist-cli/chunks/upload-OF4CO6WM.js +0 -2
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a as re,b as ne,f as se}from"./chunk-S4CJUMUZ.js";import"./chunk-7IBNJPSB.js";import{a as k}from"./chunk-UCVK6JDW.js";import{b as Q}from"./chunk-P3ORPGKZ.js";import{a as ee}from"./chunk-VKVRAWJR.js";import"./chunk-JK4AGL2U.js";import{a as te,b as oe}from"./chunk-SPBHQVJ4.js";import"./chunk-BZOTL2IQ.js";import"./chunk-PY65YXHI.js";import"./chunk-6VQIZJLG.js";import"./chunk-DXF6DHIR.js";import"./chunk-SHBXXKJW.js";import"./chunk-HKZICBKI.js";import"./chunk-OWSZCLYZ.js";import"./chunk-THDVL3ST.js";import"./chunk-V2TABN7W.js";import"./chunk-FF7GZMWQ.js";import{r as K}from"./chunk-3FYUTNM4.js";import{g as A,h as X,i as R,j as J,k as Z,l as M,m as $}from"./chunk-6Q3M6FMW.js";import"./chunk-SYZKYAPC.js";import"./chunk-UGFZIHBA.js";import"./chunk-WRPO6J3Z.js";import"./chunk-CE3XI55C.js";import"./chunk-AZWH6YSL.js";import"./chunk-AB7XCG3A.js";import"./chunk-4O73AHYA.js";import"./chunk-GVOFX6LJ.js";import"./chunk-TWUPMUWQ.js";import"./chunk-TJXRSDEU.js";import{a as x,b as j,c as I,d as L,e as U,f as F,g as E}from"./chunk-OUJVQUX4.js";import"./chunk-U4OPCVAL.js";import{mkdirSync as ce,writeFileSync as ie}from"fs";import{dirname as le,resolve as ue}from"path";async function de(e,t){let o=Le(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=Ue(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=ze(o),a=_e(o);if(r||s)return n&&(console.error(" --with-frame is not supported with --gallery / --themes"),process.exit(1)),ae(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=A(o,{port:t.port,stripBooleanFlags:["--with-frame","--no-frame","--no-shell","--shell-only"],stripValueFlags:["--output","--area","--id","--text"]}),l=me(o),u=await Be(o);if(await Re(c.wsPort)){try{await Oe(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 ae(o,t)}async function Re(e){let t=X(e,{commandTimeoutMs:1e3});try{return await t.listSims(),!0}catch{return!1}finally{t.close()}}async function Be(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 Oe(e,t,o,i,r){let s=R({...e,commandTimeoutMs:45e3});try{(await J(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.CONTRAST_SCREENSHOT_READY_MAX_MS)||9e4,c=await K(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 v=await s.send({type:"evaluate",code:Q(u)});if(!v)throw new Error(u.id?`no node with id "${u.id}"`:`no node matching text "${u.text}"`);l=v}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 g=await s.send(p);if(typeof g!="string"||g.length<="data:image/png;base64,".length)throw new Error("screenshot capture returned no image data \u2014 the sim is connected but not painting; check `sootsim get errors`");let m=g.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 w=ue(process.cwd(),t||"/tmp/sootsim-inspect.png");ce(le(w),{recursive:!0});let S=Buffer.from(m,"base64");if(i){let v=await Te(s);if(!v)throw new Error("could not read current device model from the target sim");let Ae=await re(S,v);ie(w,Ae),console.log(` frame: ${v}`)}else ie(w,S);console.log(` saved: ${w}`)}finally{s.close()}}async function Te(e){let t=await M(e,"SootSim.bridges.settings.get")??{deviceModel:null},o=typeof t.deviceModel=="string"?t.deviceModel:null;return!o||!(o in E)?null:o}function ze(e){let t=!1;for(let o of e)o==="--with-frame"&&(t=!0),o==="--no-frame"&&(t=!1);return t}function _e(e){if(e.includes("--shell-only"))return"shell";if(e.includes("--no-shell"))return"tenant"}var je=new Set(["--help","-h","--verbose","-v","--with-frame","--no-frame","--no-shell","--shell-only","--gallery","--themes"]),pe=new Set(["--output","--area","--id","--text","--url","--port","--timeout","--sim"]),Ie={"--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 Le(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 Ue(e){let t=[];for(let o=0;o<e.length;o++){let i=e[o];if(i.startsWith("-")){if(pe.has(i)){o++;continue}je.has(i)||t.push({flag:i,suggestion:Ie[i]})}}return t}function me(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("-")){pe.has(i)&&o++;continue}return i}}async function ae(e,t){let o=me(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 k(a=>s.launch(a),{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=ue(process.cwd(),o);ce(le(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 V,readFileSync as et,writeFileSync as ve}from"fs";import{tmpdir as to}from"os";import T from"path";import{mkdirSync as fe,readFileSync as He,writeFileSync as ge}from"fs";import H from"path";function he(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 Y(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function Ye(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 B(e,t){let o=Ye(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 Ge(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 We(e){let t=e.glow;return t?`radial-gradient(circle at 50% 24%, ${B(t,.46)} 0%, ${B(t,.2)} 24%, rgba(0,0,0,0) 62%)`:"none"}function G(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 we(...e){let t=e.map(o=>o.trim()).filter(o=>o.length>0&&o!=="none");return t.length>0?t.join(" "):"none"}function W(e){let t=B(e.color,e.opacity),o=B(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${o}) drop-shadow(0 0 ${e.blur}px ${t})`}function q(e,t){return!t.glow||e.color&&e.color!==x.color?e:{...e,color:t.glow}}function qe(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=q(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:${G(d)}`,`filter:${W(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=q(n.shadow,c);return["position:absolute",`top:${Math.round(t.height*.075)+u}px`,"left:50%",`width:${l}px`,"transform-origin:center center",`transform:${we("translateX(-50%)",G(d))}`,`filter:${W(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=q(r.shadow,n);return["position:absolute",`top:${Math.round(t.height*.28)+c}px`,"left:50%",`width:${a}px`,"transform-origin:center top",`transform:${we("translateX(-50%)",G(l))}`,`filter:${W(u)}`,"z-index:2"].join(";")}}}function Ve({canvas:e,compose:t,slide:o,imageDataUrl:i}){let r=o.background??t.background,s=qe(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}">${Y(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}">${Y(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};">${Y(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: ${Ge(r)};
|
|
56
|
-
color: ${t.text.color};
|
|
57
|
-
isolation: isolate;
|
|
58
|
-
}
|
|
59
|
-
#glow {
|
|
60
|
-
position: absolute;
|
|
61
|
-
inset: 0;
|
|
62
|
-
background: ${We(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 ye(e,t,o){let i=[],r=o??await(async()=>{let{chromium:n}=await import("playwright");return k(a=>n.launch(a),{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,${He(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(Ve({canvas:u,compose:e,slide:a.slide,imageDataUrl:l}),{waitUntil:"load"}),await d.waitForTimeout(20);let p=H.join(e.outDir,u.name,e.locale);fe(p,{recursive:!0});let g=H.join(p,`${a.slide.assetKey}.png`),f=await d.screenshot({type:"png",clip:{x:0,y:0,width:u.width,height:u.height}});ge(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()}fe(e.outDir,{recursive:!0});let s=H.join(e.outDir,"manifest.json");return ge(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 D(e){return typeof e=="string"&&e.length>0?e:void 0}async function Se(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:D(c.title),subtitle:D(c.subtitle),bgTop:D(c.bgTop),bgBottom:D(c.bgBottom),titleColor:D(c.titleColor)}}):null}function be(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:I(r.bgTop)},{offset:1,color:I(r.bgBottom)}]};o.background=s}})}import{readFileSync as Ke}from"fs";import P from"path";function h(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function O(e,t){if(!h(e))throw new Error(`${t} must be an object`);return e}function y(e,t=""){return typeof e=="string"?e:t}function b(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function xe(e,t){return typeof e=="boolean"?e:t}function C(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Pe(e,t){return typeof e!="string"||e.trim().length===0?t:Object.prototype.hasOwnProperty.call(E,e)?e:null}function $e(e,t){if(typeof e=="string"){let r=F(e);if(!r)throw new Error(`unknown background preset: ${e}`);return r}if(!h(e))return U(t);let o=e.type==="solid"||e.type==="gradient"?e.type:t.type;if(o==="solid")return{type:o,color:y(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=C(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:C(e.direction,t.direction??180),glow:b(e.glow)??t.glow,stops:i.length>0?i:t.stops?.map(r=>({...r}))??[]}}function Xe(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=L(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 Je(e){switch(e){case"editorial-left":case"minimal-bottom":case"none":case"bold-top":return e;default:return"bold-top"}}function Ze(e){switch(e){case"plan":case"flow":case"auto":return e;default:return"auto"}}function ke(e){switch(e){case"straight":case"tilted-left":case"tilted-right":case"cut-bottom":case"cut-top":return e;default:return}}function N(e,t){return P.isAbsolute(t)?t:P.resolve(e,t)}function Qe(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=O(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=he(n||s);return{id:n||a,assetKey:a,screenshot:s,headline:y(r.headline),subheadline:y(r.subheadline),eyebrow:y(r.eyebrow),pose:ke(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?$e(r.theme??r.background,t):void 0}})}function Ce(e){let t=P.resolve(e),o=P.dirname(t),i=ee.parse(Ke(t,"utf8")),r=O(i,"screenshots plan"),s=O(r.capture??{},"capture"),n=O(r.compose??{},"compose"),a=typeof r.app=="number"?String(r.app):b(r.app),c=Pe(r.device,null),l=N(o,y(s.out,P.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=Ze(s.pathMode),f=$e(n.background??"cyan",F("cyan")),m={show:xe(n.frame&&h(n.frame)?n.frame.show:void 0,!0),style:Pe(n.frame&&h(n.frame)?n.frame.style:null,null)||c||j,pose:ke(n.frame&&h(n.frame)?n.frame.pose:void 0)||"straight",scale:C(n.frame&&h(n.frame)?n.frame.scale:void 0,1),offsetY:C(n.frame&&h(n.frame)?n.frame.offsetY:void 0,0),shadow:{color:y(n.frame&&h(n.frame)&&h(n.frame.shadow)?n.frame.shadow.color:void 0,x.color),blur:C(n.frame&&h(n.frame)&&h(n.frame.shadow)?n.frame.shadow.blur:void 0,x.blur),spread:C(n.frame&&h(n.frame)&&h(n.frame.shadow)?n.frame.shadow.spread:void 0,x.spread),opacity:C(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?N(o,d):null,fromDir:u?N(o,u):null,outDir:l,rawDir:u?N(o,u):P.join(l,"raw"),framedDir:P.join(l,"framed"),mode:p,pathMode:g,simId:b(s.sim),openInNewSim:xe(s.new,!1)},compose:{outDir:N(o,y(n.out,P.join(".sootsim","screenshots","exports"))),locale:y(n.locale,"en"),canvases:Xe(n.canvases),frame:m,background:f,text:{preset:Je(n.text&&h(n.text)?n.text.preset:void 0),color:y(n.text&&h(n.text)?n.text.color:void 0,"#ffffff"),subColor:y(n.text&&h(n.text)?n.text.subColor:void 0,"rgba(232,240,247,0.86)"),eyebrowColor:y(n.text&&h(n.text)?n.text.eyebrowColor:void 0,"rgba(229,242,255,0.72)")},slides:Qe(n.slides,f)}}}function tt(e){return e.capture.pathMode==="plan"||e.capture.pathMode==="flow"?e.capture.pathMode:e.capture.fromDir?"flow":"plan"}function ot(e,t){if(!e.capture.flowPath)throw new Error("capture flow path is required to build flow args");let o=[e.capture.flowPath],i=tt(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 z(e,t){return T.isAbsolute(t)?t:T.join(e.capture.rawDir,t)}function rt(e){return T.join(e.capture.outDir,"manifest.json")}async function nt(e,t){if(!e.capture.flowPath)return;V(e.capture.rawDir,{recursive:!0});let o=ot(e,t),i=await se(o);if(i!==0)throw new Error(`flow capture failed with exit code ${i}`)}async function st(e,t){let o=new Map;V(e.capture.framedDir,{recursive:!0});let i=t??await(async()=>{let{chromium:r}=await import("playwright");return k(s=>r.launch(s),{headless:!0})})();try{let r=await ne(i);try{for(let s of e.compose.slides){let n=z(e,s.screenshot),a=et(n),c=await r.compose(a,e.compose.frame.style),l=T.join(e.capture.framedDir,`${s.assetKey}.png`);ve(l,c),o.set(s.id,l)}}finally{await r.close()}}finally{!t&&typeof i.close=="function"&&await i.close()}return o}function it(e,t,o){let i=[],r=[];V(e.capture.outDir,{recursive:!0});let s=rt(e),n=e.compose.slides.map(a=>{let c=z(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 ve(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 at(e,t){return e.compose.slides.map(o=>({slide:o,imagePath:e.compose.frame.show===!0?t.get(o.id)??z(e,o.screenshot):z(e,o.screenshot)}))}async function Me(e,t={}){let o=Ce(e);t.orgDeckFrames&&t.orgDeckFrames.length>0&&be(o,t.orgDeckFrames);let i=t.deviceModel??o.deviceModel;t.composeOnly||await nt(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 k(c=>a.launch(c),{headless:!0})})():null;try{let a=r?await st(o,n??void 0):new Map,c=it(o,a,i);if(t.captureOnly)return{plan:o,capture:c,compose:null};let l=at(o,a),u=await ye(o.compose,l,n??void 0);return{plan:o,capture:c,compose:u}}finally{n&&typeof n.close=="function"&&await n.close()}}async function De(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> contrast origin to fetch the deck from (default: the
|
|
99
|
-
signed-in session origin, else https://contrast.dev)
|
|
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((w,S)=>e[S-1]===m),i=new Set(["--plan","--sim","--app","--device","--org","--repo","--api-origin"]),r=e.filter((m,w)=>{if(m.startsWith("-"))return!1;let S=e[w-1];return!S||!i.has(S)}),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=te();if(!m)return console.error(" error: --org/--repo needs auth \u2014 run `sootsim login` or set SOOTSIM_API_KEY."),1;let w=d||(m.kind==="session"?m.origin:"https://contrast.dev");try{f=await Se({org:l,repo:u,origin:w,authHeader:oe(m)})}catch(S){return console.error(` ${S.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 Me(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 ct,writeFileSync as lt}from"node:fs";import{dirname as ut,isAbsolute as dt,join as Ne,resolve as pt}from"node:path";var mt=`
|
|
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
|
-
`,ht={"--title":"title","--subtitle":"subtitle","--bg-top":"bgTop","--bg-bottom":"bgBottom","--title-color":"titleColor","--title-size":"titleSize","--underlay":"titleUnderlay","--shadow":"titleShadow","--out":"out"};function ft(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=ht[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 gt(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:e}async function wt(e){if(!await Z(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 yt(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 St(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 Fe(e,t){if(e.includes("--help")||e.includes("-h")){console.log(mt);return}let{rest:o,values:i,json:r}=ft(e),s=A(o,{port:t.port,commandTimeoutMs:45e3}),n=s.positional[0]??"list",a=gt(s.positional[1]),c=R(s),l=u=>{r?console.log(JSON.stringify(u,null,2)):yt(u)};try{switch(await wt(c),n){case"list":{l(await M(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 $(c,"SootSim.bridges.screenshotControl.setSlide",a,u));break}case"add":{l(await $(c,"SootSim.bridges.screenshotControl.addSlide"));break}case"remove":{if(a==null)throw new Error("usage: sootsim screenshot slides remove <n>");l(await $(c,"SootSim.bridges.screenshotControl.removeSlide",a));break}case"focus":{if(a==null)throw new Error("usage: sootsim screenshot slides focus <n>");l(await $(c,"SootSim.bridges.screenshotControl.focusSlide",a));break}case"overview":{l(await $(c,"SootSim.bridges.screenshotControl.overview"));break}case"capture":{let u=await $(c,"SootSim.bridges.screenshotControl.capture",...a!=null?[a]:[]);l(u);break}case"export":{let u=i.out?dt(i.out)?i.out:pt(process.cwd(),i.out):Ne(process.cwd(),"screenshots"),d=await M(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 M(c,"SootSim.bridges.screenshotControl.exportSlide",f.index),w=Ne(u,m.name);ct(ut(w),{recursive:!0}),lt(w,St(m.dataUrl)),g.push(w),console.log(` saved: ${w} (${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 bt=new Set(["--sim","--port","-p","--output","-o","--out","--plan","--app","--device","--org","--repo","--api-origin","--branch","--platform","--slides","--shell-origin","--timeout"]),xt=new Set(["capture","slides","appstore"]);function Ee(e){for(let t=0;t<e.length;t++){let o=e[t];if(o.startsWith("-")){bt.has(o)&&t++;continue}return xt.has(o)?{name:o,index:t}:null}return null}function _(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function Pt(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 Po(e,t){let o=Ee(e);if(!o||o.name==="capture"){await de(o?_(e,o.index):e,t);return}if(o.name==="slides"){await Fe(_(e,o.index),t);return}let i=_(e,o.index),r=Ee(i);if(r?.name==="capture")try{let{runScreenshotsCapture:s}=await import("./screenshots-capture-JCBFMJFS.js");return await s(Pt(_(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 De(i,t)}export{Po as runScreenshotCommand};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a,b,c}from"./chunk-JK4AGL2U.js";import"./chunk-SPBHQVJ4.js";import"./chunk-HKZICBKI.js";import"./chunk-OWSZCLYZ.js";import"./chunk-THDVL3ST.js";import"./chunk-6Q3M6FMW.js";import"./chunk-UGFZIHBA.js";import"./chunk-WRPO6J3Z.js";import"./chunk-AB7XCG3A.js";import"./chunk-4O73AHYA.js";import"./chunk-TWUPMUWQ.js";import"./chunk-U4OPCVAL.js";export{a as resolveDefaultUploadOrigin,b as resolvePublicPreviewOrigin,c as runUpload};
|