framepress 0.1.1 → 0.2.0
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/README.md +165 -18
- package/assets/backdrops/river-dusk.jpg +0 -0
- package/bin/camera.mjs +190 -0
- package/bin/ffmpeg.mjs +23 -0
- package/bin/mcp.mjs +233 -0
- package/bin/record.mjs +58 -13
- package/bin/sound.mjs +372 -0
- package/bin/studio-video.mjs +282 -0
- package/bin/studio.mjs +494 -0
- package/bin/take.mjs +251 -0
- package/examples/synthetic-desktop/check-alignment.mjs +28 -0
- package/examples/synthetic-desktop/check-sound.mjs +104 -0
- package/examples/synthetic-desktop/desktop.html +343 -0
- package/examples/synthetic-desktop/make.mjs +102 -0
- package/native/Package.swift +9 -0
- package/native/Sources/FramepressCapture/Capture.swift +325 -0
- package/native/Sources/FramepressCapture/Command.swift +219 -0
- package/native/Sources/FramepressCapture/Input.swift +202 -0
- package/native/bin/framepress-capture +0 -0
- package/package.json +17 -6
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<meta charset="utf-8">
|
|
3
|
+
<title>Synthetic desktop</title>
|
|
4
|
+
<!-- A Mac-like desktop for testing studio-video. window.renderAt(t) redraws the UI from the
|
|
5
|
+
event log at time t: selection, drag, the dropped file, the search field (with live
|
|
6
|
+
results) and scrolling. Every icon is an SVG drawn here; no font glyphs, emoji or Apple
|
|
7
|
+
assets. The pointer itself is never drawn; the compositor draws it from the events. -->
|
|
8
|
+
<style>
|
|
9
|
+
:root{--accent:#0a72f5;--accent-soft:rgba(10,114,245,.32);--ink:#1d1d1f;--ink2:#6e6e73;--ink3:#a1a1a6;--hair:rgba(0,0,0,.085)}
|
|
10
|
+
*{box-sizing:border-box}
|
|
11
|
+
html,body{margin:0;width:1440px;height:900px;overflow:hidden;font:13px/1.3 -apple-system,BlinkMacSystemFont,"SF Pro Text",Inter,"Helvetica Neue",sans-serif;color:var(--ink);-webkit-font-smoothing:antialiased;cursor:none;font-feature-settings:"kern"}
|
|
12
|
+
body{background:radial-gradient(120% 90% at 20% 10%,#f6b38a 0,#d7657a 35%,#5b3f8f 70%,#22264f 100%)}
|
|
13
|
+
svg{display:block;overflow:visible}
|
|
14
|
+
.ic{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}
|
|
15
|
+
#menubar{position:absolute;inset:0 0 auto;height:24px;background:rgba(246,240,245,.55);backdrop-filter:blur(20px);display:flex;align-items:center;gap:20px;padding:0 14px;font-size:13px}
|
|
16
|
+
#menubar b{font-weight:700}#menubar .r{margin-left:auto;display:flex;gap:16px;font-variant-numeric:tabular-nums}
|
|
17
|
+
.logo{width:12px;height:12px;border-radius:50%;background:#1d1d1f}
|
|
18
|
+
.deskicon{position:absolute;width:86px;text-align:center;color:#fff;font-size:12px;font-weight:500;text-shadow:0 1px 2px rgba(0,0,0,.55)}
|
|
19
|
+
.deskicon svg{margin:0 auto 2px}
|
|
20
|
+
|
|
21
|
+
/* Window */
|
|
22
|
+
#win{position:absolute;left:170px;top:96px;width:960px;height:600px;border-radius:11px;background:#fff;box-shadow:0 0 0 .5px rgba(0,0,0,.3),0 24px 70px rgba(0,0,0,.42),0 6px 18px rgba(0,0,0,.18);overflow:hidden}
|
|
23
|
+
#win:after{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 .5px rgba(0,0,0,.14),inset 0 1px 0 rgba(255,255,255,.7);pointer-events:none;z-index:9}
|
|
24
|
+
|
|
25
|
+
/* Sidebar: a simulated vibrant material, tinted by the wallpaper behind it. */
|
|
26
|
+
#side{position:absolute;left:0;top:0;bottom:0;width:212px;padding:0 10px;
|
|
27
|
+
background:
|
|
28
|
+
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
|
|
29
|
+
radial-gradient(130% 55% at 0% 0%,rgba(255,206,214,.55),transparent 70%),
|
|
30
|
+
radial-gradient(120% 60% at 100% 100%,rgba(196,198,255,.5),transparent 70%),
|
|
31
|
+
linear-gradient(#efedf3,#e9e9f0);
|
|
32
|
+
box-shadow:inset -.5px 0 0 rgba(0,0,0,.1)}
|
|
33
|
+
.lights{display:flex;gap:8px;position:absolute;left:18px;top:19px}
|
|
34
|
+
.lights i{width:12px;height:12px;border-radius:50%;background:radial-gradient(circle at 50% 30%,#ff7a73,#ff5f57 60%);box-shadow:inset 0 0 0 .5px rgba(160,30,25,.45)}
|
|
35
|
+
.lights i+i{background:radial-gradient(circle at 50% 30%,#ffd35a,#febc2e 60%);box-shadow:inset 0 0 0 .5px rgba(160,110,10,.45)}
|
|
36
|
+
.lights i+i+i{background:radial-gradient(circle at 50% 30%,#4bd860,#28c840 60%);box-shadow:inset 0 0 0 .5px rgba(20,110,30,.45)}
|
|
37
|
+
#side nav{position:absolute;left:10px;right:10px;top:52px}
|
|
38
|
+
.sh{font-size:11px;font-weight:600;color:rgba(60,60,67,.5);height:28px;padding:11px 10px 0;letter-spacing:.01em}
|
|
39
|
+
.si{position:relative;display:flex;align-items:center;gap:7px;height:28px;padding:0 9px;border-radius:7px;font-size:13px;color:var(--ink);white-space:nowrap}
|
|
40
|
+
.si svg{width:17px;height:17px;color:var(--accent);flex:none}
|
|
41
|
+
.si.cur{background:rgba(0,0,0,.075)}
|
|
42
|
+
.si.hot{background:rgba(0,0,0,.045)}
|
|
43
|
+
.si.drop{background:var(--accent);color:#fff;box-shadow:0 1px 3px rgba(10,114,245,.35)}
|
|
44
|
+
.si.drop svg{color:#fff}
|
|
45
|
+
.si .dot{width:10px;height:10px;border-radius:50%;margin:0 4px 0 3px;box-shadow:inset 0 0 0 .5px rgba(0,0,0,.18)}
|
|
46
|
+
.si .n{margin-left:auto;font-size:11px;color:var(--ink3);font-variant-numeric:tabular-nums}
|
|
47
|
+
|
|
48
|
+
/* Toolbar */
|
|
49
|
+
#bar{position:absolute;left:212px;right:0;top:0;height:52px;display:flex;align-items:center;padding:0 12px 0 10px;gap:2px;background:#fff;z-index:3;transition:none}
|
|
50
|
+
#bar.scrolled{box-shadow:0 .5px 0 var(--hair),0 2px 8px rgba(0,0,0,.04)}
|
|
51
|
+
.tb{width:30px;height:28px;border-radius:7px;display:grid;place-items:center;color:#5f5f64;flex:none}
|
|
52
|
+
.tb svg{width:19px;height:19px}
|
|
53
|
+
.tb.off{color:#c7c7cc}
|
|
54
|
+
.tb.hot{background:rgba(0,0,0,.06)}
|
|
55
|
+
.title{margin:0 0 0 8px;display:flex;flex-direction:column;justify-content:center;line-height:1.15;min-width:0}
|
|
56
|
+
.title b{font-size:15px;font-weight:650;letter-spacing:-.01em}
|
|
57
|
+
.title small{font-size:11px;color:var(--ink2);font-variant-numeric:tabular-nums;margin-top:1px}
|
|
58
|
+
.sp{flex:1}
|
|
59
|
+
.seg{display:flex;padding:2px;border-radius:8px;background:rgba(0,0,0,.05);margin-right:6px}
|
|
60
|
+
.seg .tb{width:30px;height:24px;border-radius:6px}
|
|
61
|
+
.seg .tb.on{background:#fff;color:var(--ink);box-shadow:0 .5px 1.5px rgba(0,0,0,.22),0 0 0 .5px rgba(0,0,0,.04)}
|
|
62
|
+
.seg svg{width:17px;height:17px}
|
|
63
|
+
#search{position:relative;width:196px;height:28px;border-radius:8px;background:rgba(0,0,0,.055);display:flex;align-items:center;padding:0 8px 0 8px;gap:6px;margin-left:8px;color:rgba(60,60,67,.5);font-size:13px}
|
|
64
|
+
#search svg.mg{width:14px;height:14px;flex:none}
|
|
65
|
+
#search.focus{background:#fff;color:var(--ink);box-shadow:0 0 0 3.5px var(--accent-soft),0 0 0 1px rgba(10,114,245,.85),0 1px 2px rgba(0,0,0,.08)}
|
|
66
|
+
#search.focus svg.mg{color:var(--ink2)}
|
|
67
|
+
#q{white-space:pre}
|
|
68
|
+
#q.ph{color:rgba(60,60,67,.45)}
|
|
69
|
+
#caret{width:1.6px;height:16px;border-radius:1px;background:var(--accent);margin-left:-5px;display:none}
|
|
70
|
+
#clear{margin-left:auto;width:15px;height:15px;display:none}
|
|
71
|
+
|
|
72
|
+
/* Search scope bar */
|
|
73
|
+
#scope{position:absolute;left:212px;right:0;top:52px;height:32px;display:none;align-items:center;gap:4px;padding:0 14px;font-size:12px;color:var(--ink2);background:#fcfcfd;box-shadow:inset 0 .5px 0 var(--hair),inset 0 -.5px 0 var(--hair);z-index:2}
|
|
74
|
+
#scope span{padding:3px 9px;border-radius:6px}
|
|
75
|
+
#scope .on{background:rgba(0,0,0,.075);color:var(--ink);font-weight:600}
|
|
76
|
+
#scope .lab{padding-left:0;font-weight:500}
|
|
77
|
+
#scope .save{margin-left:auto;color:var(--ink2)}
|
|
78
|
+
|
|
79
|
+
/* Files */
|
|
80
|
+
#content{position:absolute;left:212px;right:0;top:52px;bottom:28px;overflow:hidden}
|
|
81
|
+
#win.searching #content{top:84px}
|
|
82
|
+
#win.searching #scope{display:flex}
|
|
83
|
+
#grid{position:absolute;left:0;right:0;top:0;display:grid;grid-template-columns:repeat(6,1fr);grid-auto-rows:112px;padding:14px 14px}
|
|
84
|
+
.file{display:flex;flex-direction:column;align-items:center;padding-top:6px}
|
|
85
|
+
.file .doc{position:relative;width:64px;height:64px;display:grid;place-items:center}
|
|
86
|
+
.file .doc:before{content:"";position:absolute;inset:-5px;border-radius:9px;background:transparent}
|
|
87
|
+
.file .doc svg{position:relative;filter:drop-shadow(0 .6px .8px rgba(0,0,0,.2)) drop-shadow(0 3px 5px rgba(0,0,0,.07))}
|
|
88
|
+
.file .lb{margin-top:6px;font-size:12px;line-height:15px;padding:0 6px;border-radius:5px;max-width:112px;text-align:center;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;letter-spacing:-.005em}
|
|
89
|
+
.file.sel .doc:before{background:rgba(0,0,0,.08)}
|
|
90
|
+
.file.sel .lb{background:var(--accent);color:#fff}
|
|
91
|
+
.file.lift{opacity:.55}
|
|
92
|
+
.file.gone{visibility:hidden}
|
|
93
|
+
#ghost{position:absolute;display:none;pointer-events:none;z-index:12}
|
|
94
|
+
#ghost .doc{opacity:.82}
|
|
95
|
+
#ghost .doc svg{filter:drop-shadow(0 2px 3px rgba(0,0,0,.25)) drop-shadow(0 8px 14px rgba(0,0,0,.12))}
|
|
96
|
+
#ghost .lb{background:var(--accent);color:#fff;box-shadow:0 2px 6px rgba(10,114,245,.3)}
|
|
97
|
+
#sbar{position:absolute;right:3px;width:7px;border-radius:4px;background:rgba(0,0,0,.36);box-shadow:0 0 0 .5px rgba(255,255,255,.5);opacity:0;z-index:2}
|
|
98
|
+
|
|
99
|
+
/* Path bar + status */
|
|
100
|
+
#status{position:absolute;left:212px;right:0;bottom:0;height:28px;display:flex;align-items:center;gap:3px;padding:0 14px;font-size:11px;color:var(--ink2);background:#fbfbfc;box-shadow:inset 0 .5px 0 var(--hair);font-variant-numeric:tabular-nums}
|
|
101
|
+
#status .crumb{display:flex;align-items:center;gap:4px}
|
|
102
|
+
#status .crumb svg{width:13px;height:13px}
|
|
103
|
+
#status .chev{width:8px;height:8px;color:var(--ink3);margin:0 2px}
|
|
104
|
+
#status .free{margin-left:auto}
|
|
105
|
+
|
|
106
|
+
#dock{position:absolute;bottom:6px;left:50%;transform:translateX(-50%);height:66px;padding:8px 10px;border-radius:20px;background:rgba(255,255,255,.28);backdrop-filter:blur(20px);display:flex;gap:9px;box-shadow:0 0 0 .5px rgba(255,255,255,.4) inset}
|
|
107
|
+
#dock i{width:50px;height:50px;border-radius:12px;background:linear-gradient(#fff,#ddd)}
|
|
108
|
+
#dock i:nth-child(2){background:linear-gradient(#6cc4ff,#1f7ae0)}#dock i:nth-child(3){background:linear-gradient(#ffd36b,#f39b1f)}#dock i:nth-child(4){background:linear-gradient(#8de38a,#2fa84f)}#dock i:nth-child(5){background:linear-gradient(#c99bff,#7b4fe0)}#dock i:nth-child(6){background:linear-gradient(#ff8f8f,#e0413b)}
|
|
109
|
+
</style>
|
|
110
|
+
|
|
111
|
+
<!-- Shared gradients and symbols. Sized 0, not display:none, so gradients resolve. -->
|
|
112
|
+
<svg width="0" height="0" style="position:absolute">
|
|
113
|
+
<defs>
|
|
114
|
+
<linearGradient id="gPage" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#f2f3f6"/></linearGradient>
|
|
115
|
+
<linearGradient id="gFold" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#dfe2e8"/></linearGradient>
|
|
116
|
+
<linearGradient id="gKey" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#5fa8ff"/><stop offset="1" stop-color="#2459e0"/></linearGradient>
|
|
117
|
+
<linearGradient id="gFBack" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#5eaaf2"/><stop offset="1" stop-color="#3f8ee6"/></linearGradient>
|
|
118
|
+
<linearGradient id="gFFront" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#a3d6ff"/><stop offset=".55" stop-color="#79c0fb"/><stop offset="1" stop-color="#62b0f4"/></linearGradient>
|
|
119
|
+
<symbol id="i-clock" viewBox="0 0 16 16"><g class="ic" stroke-width="1.35"><circle cx="8" cy="8" r="6.2"/><path d="M8 4.7V8l2.3 1.5"/></g></symbol>
|
|
120
|
+
<symbol id="i-apps" viewBox="0 0 16 16"><g class="ic" stroke-width="1.3"><rect x="2.2" y="2.2" width="4.7" height="4.7" rx="1.4"/><rect x="9.1" y="2.2" width="4.7" height="4.7" rx="1.4"/><rect x="2.2" y="9.1" width="4.7" height="4.7" rx="1.4"/><rect x="9.1" y="9.1" width="4.7" height="4.7" rx="1.4"/></g></symbol>
|
|
121
|
+
<symbol id="i-desktop" viewBox="0 0 16 16"><g class="ic" stroke-width="1.35"><rect x="1.7" y="2.6" width="12.6" height="8.7" rx="1.6"/><path d="M5.8 13.7h4.4M8 11.4v2.3"/></g></symbol>
|
|
122
|
+
<symbol id="i-doc" viewBox="0 0 16 16"><g class="ic" stroke-width="1.3"><path d="M4.3 1.9h4.9l3.1 3.1v8.3a1 1 0 0 1-1 1H4.3a1 1 0 0 1-1-1V2.9a1 1 0 0 1 1-1z"/><path d="M9 2.1v2.5a.7.7 0 0 0 .7.7h2.4M5.7 8.1h4.6M5.7 10.7h3.2"/></g></symbol>
|
|
123
|
+
<symbol id="i-down" viewBox="0 0 16 16"><g class="ic" stroke-width="1.35"><circle cx="8" cy="8" r="6.2"/><path d="M8 4.7v6M5.6 8.4 8 10.8l2.4-2.4"/></g></symbol>
|
|
124
|
+
<symbol id="i-folder" viewBox="0 0 16 16"><g class="ic" stroke-width="1.3"><path d="M1.8 4.5a1.2 1.2 0 0 1 1.2-1.2h3.1l1.5 1.5h5.4a1.2 1.2 0 0 1 1.2 1.2v6.4a1.2 1.2 0 0 1-1.2 1.2H3a1.2 1.2 0 0 1-1.2-1.2z"/><path d="M1.8 6.7h12.4"/></g></symbol>
|
|
125
|
+
<symbol id="i-archive" viewBox="0 0 16 16"><g class="ic" stroke-width="1.3"><rect x="1.7" y="2.5" width="12.6" height="3.5" rx="1"/><path d="M2.8 6v6.3a1.2 1.2 0 0 0 1.2 1.2h8a1.2 1.2 0 0 0 1.2-1.2V6M6.3 8.7h3.4"/></g></symbol>
|
|
126
|
+
<symbol id="i-cloud" viewBox="0 0 16 16"><g class="ic" stroke-width="1.3"><path d="M4.6 12.6h7.1a2.9 2.9 0 0 0 .3-5.8A4.1 4.1 0 0 0 4.2 7.3a2.7 2.7 0 0 0 .4 5.3z"/></g></symbol>
|
|
127
|
+
<symbol id="i-drive" viewBox="0 0 16 16"><g class="ic" stroke-width="1.3"><rect x="1.7" y="4.1" width="12.6" height="7.8" rx="1.7"/><path d="M1.9 8.7h12.2"/></g><circle cx="11.7" cy="10.3" r=".75" fill="currentColor"/></symbol>
|
|
128
|
+
<symbol id="i-chevl" viewBox="0 0 20 20"><path class="ic" stroke-width="1.9" d="M12.3 4.6 6.9 10l5.4 5.4"/></symbol>
|
|
129
|
+
<symbol id="i-chevr" viewBox="0 0 20 20"><path class="ic" stroke-width="1.9" d="M7.7 4.6 13.1 10l-5.4 5.4"/></symbol>
|
|
130
|
+
<symbol id="i-vgrid" viewBox="0 0 20 20"><g class="ic" stroke-width="1.45"><rect x="3.4" y="3.4" width="5.4" height="5.4" rx="1.3"/><rect x="11.2" y="3.4" width="5.4" height="5.4" rx="1.3"/><rect x="3.4" y="11.2" width="5.4" height="5.4" rx="1.3"/><rect x="11.2" y="11.2" width="5.4" height="5.4" rx="1.3"/></g></symbol>
|
|
131
|
+
<symbol id="i-vlist" viewBox="0 0 20 20"><g class="ic" stroke-width="1.45"><path d="M7.6 5.4h9M7.6 10h9M7.6 14.6h9"/></g><g fill="currentColor"><circle cx="4" cy="5.4" r="1.05"/><circle cx="4" cy="10" r="1.05"/><circle cx="4" cy="14.6" r="1.05"/></g></symbol>
|
|
132
|
+
<symbol id="i-vcol" viewBox="0 0 20 20"><g class="ic" stroke-width="1.45"><rect x="2.8" y="4" width="14.4" height="12" rx="2"/><path d="M7.6 4v12M12.4 4v12"/></g></symbol>
|
|
133
|
+
<symbol id="i-vgal" viewBox="0 0 20 20"><g class="ic" stroke-width="1.45"><rect x="2.8" y="3.4" width="14.4" height="9.2" rx="1.8"/></g><g fill="currentColor"><rect x="3" y="14.6" width="3.6" height="2.4" rx=".8"/><rect x="8.2" y="14.6" width="3.6" height="2.4" rx=".8"/><rect x="13.4" y="14.6" width="3.6" height="2.4" rx=".8"/></g></symbol>
|
|
134
|
+
<symbol id="i-share" viewBox="0 0 20 20"><g class="ic" stroke-width="1.5"><path d="M10 2.9v9.3M6.9 5.9 10 2.8l3.1 3.1"/><path d="M7.1 8.2H5.9a1.7 1.7 0 0 0-1.7 1.7v5.6a1.7 1.7 0 0 0 1.7 1.7h8.2a1.7 1.7 0 0 0 1.7-1.7V9.9a1.7 1.7 0 0 0-1.7-1.7h-1.2"/></g></symbol>
|
|
135
|
+
<symbol id="i-tag" viewBox="0 0 20 20"><g class="ic" stroke-width="1.45"><path d="M3.2 4.5v4.4a1.6 1.6 0 0 0 .47 1.13l6.3 6.3a1.6 1.6 0 0 0 2.26 0l4.3-4.3a1.6 1.6 0 0 0 0-2.26l-6.3-6.3A1.6 1.6 0 0 0 9.1 3H4.7a1.5 1.5 0 0 0-1.5 1.5z"/><circle cx="6.7" cy="6.6" r="1.1"/></g></symbol>
|
|
136
|
+
<symbol id="i-more" viewBox="0 0 20 20"><circle class="ic" stroke-width="1.45" cx="10" cy="10" r="7.1"/><g fill="currentColor"><circle cx="6.7" cy="10" r="1.05"/><circle cx="10" cy="10" r="1.05"/><circle cx="13.3" cy="10" r="1.05"/></g></symbol>
|
|
137
|
+
<symbol id="i-mag" viewBox="0 0 14 14"><g class="ic" stroke-width="1.55"><circle cx="5.9" cy="5.9" r="4.3"/><path d="m9.1 9.1 3.4 3.4"/></g></symbol>
|
|
138
|
+
<symbol id="i-clear" viewBox="0 0 16 16"><circle cx="8" cy="8" r="7" fill="rgba(60,60,67,.32)"/><path d="m5.6 5.6 4.8 4.8M10.4 5.6l-4.8 4.8" stroke="#fff" stroke-width="1.5" stroke-linecap="round"/></symbol>
|
|
139
|
+
<symbol id="i-pchev" viewBox="0 0 8 8"><path class="ic" stroke-width="1.2" d="M2.8 1.4 5.4 4 2.8 6.6"/></symbol>
|
|
140
|
+
<symbol id="i-plus" viewBox="0 0 16 16"><g class="ic" stroke-width="1.35"><circle cx="8" cy="8" r="6.2"/><path d="M8 5.2v5.6M5.2 8h5.6"/></g></symbol>
|
|
141
|
+
</defs>
|
|
142
|
+
</svg>
|
|
143
|
+
|
|
144
|
+
<div id="menubar"><div class="logo"></div><b>Finder</b><span>File</span><span>Edit</span><span>View</span><span>Go</span><span>Window</span><span>Help</span><div class="r"><span>100%</span><span>Mon 30 Nov 10:42</span></div></div>
|
|
145
|
+
<div class="deskicon" style="left:1330px;top:52px"><div class="dfold"></div>Screenshots</div>
|
|
146
|
+
<div class="deskicon" style="left:1330px;top:152px"><div class="dfold"></div>Invoices 2026</div>
|
|
147
|
+
<div id="win">
|
|
148
|
+
<div id="side">
|
|
149
|
+
<div class="lights"><i></i><i></i><i></i></div>
|
|
150
|
+
<nav>
|
|
151
|
+
<div class="sh">Favourites</div>
|
|
152
|
+
<div class="si"><svg><use href="#i-clock"/></svg>Recents</div>
|
|
153
|
+
<div class="si"><svg><use href="#i-apps"/></svg>Applications</div>
|
|
154
|
+
<div class="si"><svg><use href="#i-desktop"/></svg>Desktop</div>
|
|
155
|
+
<div class="si"><svg><use href="#i-doc"/></svg>Documents</div>
|
|
156
|
+
<div class="si"><svg><use href="#i-down"/></svg>Downloads</div>
|
|
157
|
+
<div class="si cur"><svg><use href="#i-folder"/></svg>Projects</div>
|
|
158
|
+
<div class="si" id="archive"><svg><use href="#i-archive"/></svg>Archive</div>
|
|
159
|
+
<div class="sh">Locations</div>
|
|
160
|
+
<div class="si"><svg><use href="#i-cloud"/></svg>iCloud Drive</div>
|
|
161
|
+
<div class="si"><svg><use href="#i-drive"/></svg>Macintosh HD</div>
|
|
162
|
+
<div class="sh">Tags</div>
|
|
163
|
+
<div class="si"><i class="dot" style="background:#ff5f57"></i>Urgent</div>
|
|
164
|
+
<div class="si"><i class="dot" style="background:#ffb340"></i>Review</div>
|
|
165
|
+
<div class="si"><i class="dot" style="background:#34c759"></i>Done</div>
|
|
166
|
+
<div class="si"><i class="dot" style="background:#3d8bff"></i>Clients</div>
|
|
167
|
+
</nav>
|
|
168
|
+
</div>
|
|
169
|
+
<div id="bar">
|
|
170
|
+
<div class="tb"><svg><use href="#i-chevl"/></svg></div>
|
|
171
|
+
<div class="tb off"><svg><use href="#i-chevr"/></svg></div>
|
|
172
|
+
<div class="title"><b>Projects</b><small id="count">48 items</small></div>
|
|
173
|
+
<div class="sp"></div>
|
|
174
|
+
<div class="seg"><div class="tb on"><svg><use href="#i-vgrid"/></svg></div><div class="tb"><svg><use href="#i-vlist"/></svg></div><div class="tb"><svg><use href="#i-vcol"/></svg></div><div class="tb"><svg><use href="#i-vgal"/></svg></div></div>
|
|
175
|
+
<div class="tb" id="share"><svg><use href="#i-share"/></svg></div>
|
|
176
|
+
<div class="tb"><svg><use href="#i-tag"/></svg></div>
|
|
177
|
+
<div class="tb"><svg><use href="#i-more"/></svg></div>
|
|
178
|
+
<div id="search"><svg class="mg"><use href="#i-mag"/></svg><span id="q" class="ph">Search</span><span id="caret"></span><svg id="clear"><use href="#i-clear"/></svg></div>
|
|
179
|
+
</div>
|
|
180
|
+
<div id="scope"><span class="lab">Search:</span><span class="on">This Mac</span><span>“Projects”</span><span class="save"><svg style="width:16px;height:16px"><use href="#i-plus"/></svg></span></div>
|
|
181
|
+
<div id="content"><div id="grid"></div><div id="sbar"></div></div>
|
|
182
|
+
<div id="status">
|
|
183
|
+
<span class="crumb"><svg style="color:#8e8e93"><use href="#i-drive"/></svg>Macintosh HD</span><svg class="chev"><use href="#i-pchev"/></svg>
|
|
184
|
+
<span class="crumb"><span class="mf"></span>Users</span><svg class="chev"><use href="#i-pchev"/></svg>
|
|
185
|
+
<span class="crumb"><span class="mf"></span>demo</span><svg class="chev"><use href="#i-pchev"/></svg>
|
|
186
|
+
<span class="crumb"><span class="mf"></span>Projects</span>
|
|
187
|
+
<span class="free" id="free">312.4 GB available</span>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
<div id="ghost"></div>
|
|
191
|
+
<div id="dock"><i></i><i></i><i></i><i></i><i></i><i></i></div>
|
|
192
|
+
<script>
|
|
193
|
+
// ---------- Icons ----------
|
|
194
|
+
const PAGE = 'M14 4h25.5L52 16.5V58a3 3 0 0 1-3 3H14a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3z';
|
|
195
|
+
const FOLD = 'M39.5 4v9.5a3 3 0 0 0 3 3H52';
|
|
196
|
+
const BADGE = { pdf: ['PDF', '#e5484d'], key: ['KEY', '#2a6af0'], num: ['NUMBERS', '#27a74a'], txt: ['TXT', '#8e8e93'] };
|
|
197
|
+
const line = (x1, x2, y, c = '#cdd1d8', w = 1.8) => `<path d="M${x1} ${y}H${x2}" stroke="${c}" stroke-width="${w}" stroke-linecap="round"/>`;
|
|
198
|
+
function hash(s) { let h = 2166136261; for (const c of s) h = Math.imul(h ^ c.charCodeAt(0), 16777619); return h >>> 0; }
|
|
199
|
+
function docIcon(kind, name) {
|
|
200
|
+
const r = hash(name), v = i => ((r >>> (i * 3)) & 7) / 7;
|
|
201
|
+
let body = '';
|
|
202
|
+
if (kind === 'pdf') body = line(16, 32, 14, '#3a3d44', 2.4) + line(16, 46, 20) + line(16, 49, 24) + line(16, 40 + v(1) * 8, 28)
|
|
203
|
+
+ `<rect x="16" y="31.5" width="14" height="9.5" rx="1.6" fill="#f4c7c3"/><path d="m16.8 40.2 4.2-4 3 2.6 2.2-1.8 3 3.2" fill="#e5847c"/>` + line(33, 49, 33.5) + line(33, 46, 37.5);
|
|
204
|
+
if (kind === 'txt') for (let i = 0, y = 13; i < 8; i++, y += 4.1) body += line(16, i === 7 ? 30 : (i === 0 ? 36 : 44 + v(i) * 5), y, '#c6cad2', 1.6);
|
|
205
|
+
if (kind === 'key') body = `<rect x="15" y="17" width="34" height="22" rx="2.2" fill="url(#gKey)"/><rect x="19" y="22" width="15" height="2.8" rx="1.4" fill="#fff"/><rect x="19" y="27.2" width="20" height="1.7" rx=".85" fill="#fff" opacity=".65"/><rect x="19" y="30.6" width="13" height="1.7" rx=".85" fill="#fff" opacity=".65"/><circle cx="42" cy="32" r="4" fill="#fff" opacity=".28"/>`
|
|
206
|
+
+ `<rect x="15" y="12" width="9" height="2.4" rx="1.2" fill="#9bb7ef"/>`;
|
|
207
|
+
if (kind === 'num') {
|
|
208
|
+
body = `<rect x="15" y="14" width="34" height="27" rx="2" fill="#fff" stroke="#d4d8df" stroke-width=".8"/><path d="M15 16a2 2 0 0 1 2-2h30a2 2 0 0 1 2 2v3.6H15z" fill="#34c759"/>`;
|
|
209
|
+
for (const y of [25, 30.4, 35.8]) body += `<path d="M15 ${y}H49" stroke="#e1e4e9" stroke-width=".8"/>`;
|
|
210
|
+
for (const x of [26.3, 37.6]) body += `<path d="M${x} 19.6V41" stroke="#e1e4e9" stroke-width=".8"/>`;
|
|
211
|
+
[[38.6, 0.4], [41.6, 0.65], [44.6, 0.9]].forEach(([x, h]) => body += `<rect x="${x}" y="${39.4 - 12 * h}" width="2" height="${12 * h}" rx=".6" fill="#34c759" opacity=".75"/>`);
|
|
212
|
+
}
|
|
213
|
+
const [label, col] = BADGE[kind], bw = label.length > 3 ? 40 : 22, fs = label.length > 3 ? 5.9 : 7.2;
|
|
214
|
+
return `<svg width="64" height="64" viewBox="0 0 64 64"><path d="${PAGE}" fill="url(#gPage)" stroke="rgba(0,0,0,.17)" stroke-width=".8"/>${body}`
|
|
215
|
+
+ `<path d="${FOLD}" fill="url(#gFold)" stroke="rgba(0,0,0,.17)" stroke-width=".8" stroke-linejoin="round"/>`
|
|
216
|
+
+ `<rect x="${31.5 - bw / 2}" y="46" width="${bw}" height="10.5" rx="3" fill="${col}"/><text x="31.5" y="53.75" text-anchor="middle" font-size="${fs}" font-weight="700" letter-spacing=".35" fill="#fff" font-family="-apple-system,BlinkMacSystemFont,Inter,sans-serif">${label}</text></svg>`;
|
|
217
|
+
}
|
|
218
|
+
function folderIcon(size = 64) {
|
|
219
|
+
return `<svg width="${size}" height="${size}" viewBox="0 0 64 64"><path d="M5 14.5a4.5 4.5 0 0 1 4.5-4.5h13.6a4 4 0 0 1 2.9 1.2l2.9 3h25.6a4.5 4.5 0 0 1 4.5 4.5v31.3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4z" fill="url(#gFBack)"/>`
|
|
220
|
+
+ `<path d="M5 21.5a3.5 3.5 0 0 1 3.5-3.5h47a3.5 3.5 0 0 1 3.5 3.5v28a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4z" fill="url(#gFFront)"/>`
|
|
221
|
+
+ `<path d="M8.5 18.6h47" stroke="rgba(255,255,255,.85)" stroke-width="1" stroke-linecap="round"/><path d="M5.5 50.5a3.5 3.5 0 0 0 3.5 3h46a3.5 3.5 0 0 0 3.5-3" stroke="rgba(30,90,170,.35)" stroke-width="1" fill="none"/></svg>`;
|
|
222
|
+
}
|
|
223
|
+
// Tiny procedural thumbnails, in a 100 x 72 (landscape) or 72 x 96 (portrait) space.
|
|
224
|
+
const THUMBS = {
|
|
225
|
+
sunset: `<defs><linearGradient id="ts" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#4b3b8f"/><stop offset=".55" stop-color="#ff7a85"/><stop offset="1" stop-color="#ffc178"/></linearGradient></defs><rect width="100" height="72" fill="url(#ts)"/><circle cx="64" cy="44" r="11" fill="#ffe3a3"/><path d="M0 52 18 40l14 8 20-14 22 15 26-11v34H0z" fill="#3a2a63"/><path d="M0 60l24-8 20 6 26-9 30 10v13H0z" fill="#231a42"/>`,
|
|
226
|
+
lake: `<defs><linearGradient id="tl" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#8fcdf5"/><stop offset="1" stop-color="#e8f6ff"/></linearGradient></defs><rect width="100" height="72" fill="url(#tl)"/><path d="M0 44 22 18l14 14 16-22 22 26 12-10 14 18z" fill="#5d7a96"/><path d="M42 18l10-8 8 10-6-3z" fill="#fff" opacity=".9"/><rect y="44" width="100" height="28" fill="#4f8fb8"/><path d="M0 44 22 62l14-10 16 18 22-20 12 8 14-14z" fill="#466f8f" opacity=".55"/><path d="M10 52h18M48 58h26M70 50h14" stroke="#cfe8f8" stroke-width="1.2" opacity=".7"/>`,
|
|
227
|
+
mood: `<rect width="100" height="72" fill="#f7f3ec"/><rect x="5" y="5" width="42" height="38" rx="3" fill="#e07a5f"/><rect x="51" y="5" width="44" height="20" rx="3" fill="#3d405b"/><rect x="51" y="28" width="21" height="15" rx="3" fill="#81b29a"/><rect x="75" y="28" width="20" height="15" rx="3" fill="#f2cc8f"/><rect x="5" y="47" width="28" height="20" rx="3" fill="#a3c4f3"/><rect x="37" y="47" width="58" height="20" rx="3" fill="#ffd9cc"/><circle cx="26" cy="24" r="9" fill="#f4f1de" opacity=".85"/>`,
|
|
228
|
+
logo: `<rect width="100" height="72" fill="#fbfbfd"/><circle cx="44" cy="36" r="17" fill="#111"/><path d="M50 22 70 54H34z" fill="#ff5a36" opacity=".92"/><circle cx="44" cy="36" r="5" fill="#fbfbfd"/>`,
|
|
229
|
+
team: `<rect width="100" height="72" fill="#e9eef7"/>${[[22, '#f4b183', '#5b6ee1'], [42, '#c98d6b', '#e15b78'], [62, '#f2c7a5', '#3fb68b'], [80, '#8d5b45', '#f0a830']].map(([x, s, c]) => `<circle cx="${x}" cy="30" r="8" fill="${s}"/><path d="M${x - 13} 72a13 15 0 0 1 26 0z" fill="${c}"/><path d="M${x - 8} 27a8 8 0 0 1 16 0c-3-3-12-3-16 0z" fill="#2b2b33" opacity=".85"/>`).join('')}`,
|
|
230
|
+
banner: `<defs><linearGradient id="tb" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#14b8a6"/><stop offset="1" stop-color="#4f46e5"/></linearGradient></defs><rect width="100" height="72" fill="url(#tb)"/><path d="M60 0h14L40 72H26zM84 0h8L58 72h-8z" fill="#fff" opacity=".12"/><rect x="10" y="26" width="40" height="7" rx="2" fill="#fff"/><rect x="10" y="37" width="28" height="4" rx="2" fill="#fff" opacity=".7"/>`,
|
|
231
|
+
icon: `<rect width="100" height="72" fill="#f2f2f5"/><defs><linearGradient id="ti" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#ffb347"/><stop offset="1" stop-color="#ff3f81"/></linearGradient></defs><rect x="30" y="16" width="40" height="40" rx="10" fill="url(#ti)"/><path d="M42 44 50 26l8 18M45 38h10" stroke="#fff" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`,
|
|
232
|
+
sketch: `<rect width="100" height="72" fill="#fbf8f1"/><path d="M12 54c10-22 24-30 36-20s22 8 40-12" stroke="#55565c" stroke-width="1.4" fill="none"/><path d="M14 58c12-18 26-24 36-16s20 6 38-10" stroke="#9a9ba3" stroke-width=".9" fill="none"/><circle cx="70" cy="22" r="7" stroke="#55565c" stroke-width="1.2" fill="none"/><path d="M8 64h84" stroke="#c9c4b8" stroke-width=".8"/>`,
|
|
233
|
+
cover: `<rect width="100" height="72" fill="#121218"/><circle cx="70" cy="28" r="26" fill="#7c5cff" opacity=".85"/><circle cx="56" cy="44" r="20" fill="#ff6aa0" opacity=".8"/><rect x="10" y="48" width="34" height="6" rx="2" fill="#fff"/><rect x="10" y="57" width="22" height="3.5" rx="1.75" fill="#fff" opacity=".6"/>`,
|
|
234
|
+
wire: `<rect width="100" height="72" fill="#f6f7f9"/><rect x="6" y="6" width="88" height="8" rx="2" fill="#dfe3ea"/><rect x="6" y="18" width="40" height="30" rx="3" fill="#e7eaf0"/><path d="M6 18l40 30M46 18 6 48" stroke="#cfd4dc" stroke-width=".8"/><rect x="52" y="18" width="42" height="5" rx="2" fill="#cfd4dc"/><rect x="52" y="27" width="34" height="4" rx="2" fill="#dfe3ea"/><rect x="52" y="35" width="38" height="4" rx="2" fill="#dfe3ea"/><rect x="52" y="44" width="18" height="7" rx="3.5" fill="#0a72f5"/><rect x="6" y="54" width="88" height="12" rx="3" fill="#e7eaf0"/>`,
|
|
235
|
+
shot: `<rect width="100" height="72" fill="#dfe6f1"/><rect x="8" y="8" width="84" height="56" rx="4" fill="#fff"/><rect x="8" y="8" width="22" height="56" rx="4" fill="#eef0f4"/><circle cx="13" cy="13" r="1.6" fill="#ff5f57"/><circle cx="18" cy="13" r="1.6" fill="#febc2e"/><circle cx="23" cy="13" r="1.6" fill="#28c840"/><rect x="36" y="16" width="30" height="4" rx="2" fill="#1d1d1f" opacity=".8"/><rect x="36" y="26" width="48" height="16" rx="3" fill="#cfe2ff"/><rect x="36" y="46" width="40" height="3" rx="1.5" fill="#d5d9e0"/><rect x="36" y="52" width="30" height="3" rx="1.5" fill="#d5d9e0"/>`,
|
|
236
|
+
palette: ['#264653', '#2a9d8f', '#e9c46a', '#f4a261', '#e76f51'].map((c, i) => `<rect x="${i * 20}" width="20" height="72" fill="${c}"/>`).join(''),
|
|
237
|
+
chart: `<rect width="100" height="72" fill="#fff"/><path d="M10 60h82M10 12v48" stroke="#d5d9e0" stroke-width="1"/>${[18, 30, 24, 40, 34, 48].map((h, i) => `<rect x="${16 + i * 13}" y="${60 - h}" width="8" height="${h}" rx="1.5" fill="${i === 5 ? '#0a72f5' : '#9ec5ff'}"/>`).join('')}<path d="M20 44 33 36l13 8 13-16 13 6 13-14" stroke="#ff7a59" stroke-width="1.6" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`,
|
|
238
|
+
};
|
|
239
|
+
const THUMB_FOR = { 'Moodboard.png': 'mood', 'Hero shot.png': 'sunset', 'Logo.png': 'logo', 'Team.png': 'team', 'Banner.png': 'banner', 'Photo 041.png': 'lake', 'Icon.png': 'icon', 'Sketch.png': 'sketch', 'Cover.png': 'cover', 'Wireframe.png': 'wire', 'Screenshot 12.png': 'shot', 'Palette.png': 'palette', 'Report chart.png': 'chart', 'Report cover.png': 'cover', 'Report header.png': 'banner', 'Report photo.png': 'lake' };
|
|
240
|
+
let thumbId = 0;
|
|
241
|
+
function imgIcon(name) {
|
|
242
|
+
const k = THUMB_FOR[name] ?? Object.keys(THUMBS)[hash(name) % Object.keys(THUMBS).length];
|
|
243
|
+
// Unique gradient ids per instance so thumbnails never share defs by accident.
|
|
244
|
+
const art = THUMBS[k].replace(/id="(t\w)"/g, (_, i) => `id="${i}${++thumbId}"`).replace(/url\(#(t\w)\)/g, (_, i) => `url(#${i}${thumbId})`);
|
|
245
|
+
return `<svg width="64" height="64" viewBox="0 0 64 64"><rect x="3" y="11.5" width="58" height="42" rx="2.5" fill="#fff"/><svg x="5" y="13.5" width="54" height="38" viewBox="0 0 100 72" preserveAspectRatio="xMidYMid slice">${art}</svg><rect x="3" y="11.5" width="58" height="42" rx="2.5" fill="none" stroke="rgba(0,0,0,.12)" stroke-width=".6"/></svg>`;
|
|
246
|
+
}
|
|
247
|
+
const icon = (kind, name) => kind === 'dir' ? folderIcon() : kind === 'img' ? imgIcon(name) : docIcon(kind, name);
|
|
248
|
+
document.querySelectorAll('.dfold').forEach(e => e.innerHTML = folderIcon(62));
|
|
249
|
+
document.querySelectorAll('#status .mf').forEach(e => e.innerHTML = folderIcon(14));
|
|
250
|
+
|
|
251
|
+
// ---------- Files ----------
|
|
252
|
+
const kindOf = n => n.endsWith('.pdf') ? 'pdf' : n.endsWith('.key') ? 'key' : n.endsWith('.numbers') ? 'num' : n.endsWith('.png') ? 'img' : n.endsWith('.txt') ? 'txt' : 'dir';
|
|
253
|
+
const PROJECT = ['Assets', 'Exports', 'Reports', 'Brief.key', 'Moodboard.png', 'Q4 Report.pdf', 'Budget.numbers', 'Notes.txt', 'Hero shot.png',
|
|
254
|
+
'Invoice-Oct.pdf', 'Pitch v3.key', 'Report draft.pdf', 'Roadmap.numbers', 'Call notes.txt', 'Logo.png', 'Contract.pdf', 'Sprint report.key',
|
|
255
|
+
'Team.png', 'Hiring.numbers', 'Ideas.txt', 'Banner.png', 'Annual report.pdf', 'Retro.key', 'Photo 041.png', 'Costs.numbers', 'Todo.txt',
|
|
256
|
+
'Icon.png', 'Weekly report.pdf', 'Demo.key', 'Sketch.png', 'Sales.numbers', 'Draft.txt', 'Cover.png', 'Invoice-Nov.pdf', 'Launch plan.key',
|
|
257
|
+
'Wireframe.png', 'Metrics.numbers', 'Changelog.txt', 'Report outline.txt', 'Pricing.numbers', 'Screenshot 12.png', 'Offsite.key', 'Proposal.pdf',
|
|
258
|
+
'Report figures.numbers', 'Palette.png', 'Agenda.txt', 'Board deck.key', 'Press kit.pdf'];
|
|
259
|
+
// Elsewhere on this Mac: only ever seen as search results ("This Mac" scope).
|
|
260
|
+
const ELSEWHERE = ['Board report.pdf', 'Expense report.numbers', 'Status report.key', 'Report cover.png', 'Bug report.txt', 'Research report.pdf',
|
|
261
|
+
'Usage report.numbers', 'Design report.key', 'Report header.png', 'Incident report.txt', 'Quarterly report Q1.pdf', 'Quarterly report Q2.pdf',
|
|
262
|
+
'Quarterly report Q3.pdf', 'Audit report.pdf', 'Traffic report.numbers', 'Report chart.png', 'Investor report.key', 'Daily report.txt',
|
|
263
|
+
'Report March.pdf', 'Report April.pdf', 'Report May.pdf', 'Sales report.numbers', 'Team report.key', 'Report photo.png', 'Field report.txt',
|
|
264
|
+
'Final report.pdf', 'Report v2.pdf', 'Press report.pdf'];
|
|
265
|
+
const mk = (name, i, extra) => {
|
|
266
|
+
const el = document.createElement('div');
|
|
267
|
+
el.className = 'file'; el.id = `f${i}`; el.dataset.name = name;
|
|
268
|
+
el.innerHTML = `<div class="doc">${icon(kindOf(name), name)}</div><span class="lb">${name}</span>`;
|
|
269
|
+
return { name, el, extra };
|
|
270
|
+
};
|
|
271
|
+
const ITEMS = [...PROJECT.map((n, i) => mk(n, i, false)), ...ELSEWHERE.map((n, i) => mk(n, PROJECT.length + i, true))];
|
|
272
|
+
const BASE = ITEMS.filter(f => !f.extra);
|
|
273
|
+
const COLS = 6, ROW = 112, PADY = 28;
|
|
274
|
+
let shown = null;
|
|
275
|
+
const show = list => { if (shown !== list.map(f => f.name).join('|')) { grid.replaceChildren(...list.map(f => f.el)); shown = list.map(f => f.name).join('|'); } };
|
|
276
|
+
const contentH = searching => 600 - 52 - 28 - (searching ? 32 : 0);
|
|
277
|
+
const maxScroll = (n, searching) => Math.max(0, PADY + Math.ceil(n / COLS) * ROW - contentH(searching));
|
|
278
|
+
show(BASE);
|
|
279
|
+
const matches = q => ITEMS.filter(f => f.name.toLowerCase().includes(q.toLowerCase()));
|
|
280
|
+
|
|
281
|
+
// Set by the generator: the event log and the text typed into the search field.
|
|
282
|
+
window.EVENTS = []; window.TYPED = '';
|
|
283
|
+
const inside = (el, x, y) => { const r = el.getBoundingClientRect(); return x >= r.left && x <= r.right && y >= r.top && y <= r.bottom; };
|
|
284
|
+
const fileAt = (x, y, gone) => BASE.find(f => !gone.has(f) && (inside(f.el.querySelector('.doc'), x, y) || inside(f.el.querySelector('.lb'), x, y)));
|
|
285
|
+
const HOVERABLE = [...document.querySelectorAll('#bar .tb:not(.off), #side .si')];
|
|
286
|
+
window.renderAt = t => {
|
|
287
|
+
// Hit tests during replay run against the base view at scroll 0, where every press happens.
|
|
288
|
+
show(BASE); grid.style.top = '0px'; win.classList.remove('searching');
|
|
289
|
+
for (const f of ITEMS) f.el.className = 'file';
|
|
290
|
+
for (const h of HOVERABLE) h.classList.remove('hot', 'drop');
|
|
291
|
+
search.classList.remove('focus'); ghost.style.display = 'none'; archive.style.opacity = '';
|
|
292
|
+
let sel = null, dragging = null, downAt = null, focus = false, keys = 0, scroll = 0, x = 0, y = 0;
|
|
293
|
+
let focusT = -9, keyT = -9, scrollT = -9, dropT = -9;
|
|
294
|
+
const gone = new Set();
|
|
295
|
+
for (const e of EVENTS) {
|
|
296
|
+
if (e.t > t) break;
|
|
297
|
+
x = e.x; y = e.y;
|
|
298
|
+
if (e.type === 'down') {
|
|
299
|
+
downAt = { x, y }; focus = inside(search, x, y); if (focus) focusT = e.t;
|
|
300
|
+
const f = fileAt(x, y, gone); sel = f || (focus ? sel : null); dragging = null;
|
|
301
|
+
} else if (e.type === 'drag' && downAt && sel && Math.hypot(x - downAt.x, y - downAt.y) > 4) dragging = sel;
|
|
302
|
+
else if (e.type === 'up') {
|
|
303
|
+
if (dragging && inside(archive, x, y)) { gone.add(dragging); sel = null; dropT = e.t; }
|
|
304
|
+
dragging = null; downAt = null;
|
|
305
|
+
} else if (e.type === 'key' && focus) { keys++; keyT = e.t; }
|
|
306
|
+
else if (e.type === 'scroll') {
|
|
307
|
+
const q = focus ? TYPED.slice(0, keys) : '', n = q ? matches(q).filter(f => !gone.has(f)).length : BASE.length;
|
|
308
|
+
scroll = Math.max(0, Math.min(maxScroll(n, !!q), scroll + e.dy)); scrollT = e.t;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
// Drag ghost first, measured in the base view where the drag started.
|
|
312
|
+
if (dragging) {
|
|
313
|
+
const d = dragging.el.getBoundingClientRect();
|
|
314
|
+
ghost.innerHTML = dragging.el.outerHTML; ghost.firstChild.removeAttribute('id'); ghost.firstChild.className = 'file';
|
|
315
|
+
ghost.style.display = 'block'; ghost.style.width = d.width + 'px';
|
|
316
|
+
ghost.style.left = d.left + x - downAt.x + 'px'; ghost.style.top = d.top + y - downAt.y + 'px';
|
|
317
|
+
dragging.el.classList.add('lift');
|
|
318
|
+
if (inside(archive, x, y)) archive.classList.add('drop');
|
|
319
|
+
} else if (t - dropT < 0.28) { archive.classList.add('drop'); archive.style.opacity = String(1 - (t - dropT) / 0.28 * 0.6); }
|
|
320
|
+
const typed = focus ? TYPED.slice(0, keys) : '';
|
|
321
|
+
let list = BASE;
|
|
322
|
+
if (typed) { list = matches(typed).filter(f => !gone.has(f)); show(list); win.classList.add('searching'); }
|
|
323
|
+
for (const f of gone) f.el.classList.add('gone');
|
|
324
|
+
if (sel && !gone.has(sel)) sel.el.classList.add('sel');
|
|
325
|
+
if (focus) search.classList.add('focus');
|
|
326
|
+
q.textContent = focus && typed ? typed : 'Search'; q.className = focus && typed ? '' : 'ph';
|
|
327
|
+
caret.style.display = focus && ((t - Math.max(focusT, keyT)) % 1.06) < 0.6 ? 'block' : 'none';
|
|
328
|
+
caret.style.marginLeft = typed ? '-5px' : '-6px';
|
|
329
|
+
if (!typed && focus) { q.style.display = 'none'; caret.style.marginLeft = '0'; } else q.style.display = '';
|
|
330
|
+
clear.style.display = typed ? 'block' : 'none';
|
|
331
|
+
const items = typed ? list.length : BASE.length - gone.size;
|
|
332
|
+
count.textContent = typed ? `${items} result${items === 1 ? '' : 's'}` : sel && !dragging ? `1 of ${items} selected` : `${items} items`;
|
|
333
|
+
grid.style.top = -scroll + 'px';
|
|
334
|
+
bar.classList.toggle('scrolled', scroll > 0.5);
|
|
335
|
+
// Overlay scroller: visible while scrolling, fades 0.5 s after the last delta.
|
|
336
|
+
const range = maxScroll(list.length, !!typed), ch = contentH(!!typed), a = Math.max(0, Math.min(1, 1 - (t - scrollT - 0.5) / 0.3));
|
|
337
|
+
if (range > 0 && t >= scrollT) {
|
|
338
|
+
const th = Math.max(40, ch * ch / (ch + range));
|
|
339
|
+
sbar.style.height = th + 'px'; sbar.style.top = 3 + (ch - th - 6) * scroll / range + 'px'; sbar.style.opacity = a;
|
|
340
|
+
} else sbar.style.opacity = 0;
|
|
341
|
+
if (!dragging && !downAt) for (const h of HOVERABLE) if (inside(h, x, y) && !h.classList.contains('cur')) h.classList.add('hot');
|
|
342
|
+
};
|
|
343
|
+
</script>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Synthetic screen recording in the native recorder's format, for testing studio-video
|
|
3
|
+
// without a Mac capture: screen.mov (no cursor), meta.json and events.jsonl.
|
|
4
|
+
// node examples/synthetic-desktop/make.mjs <out dir> [--window]
|
|
5
|
+
// --window: a window capture of the Finder-like window only, as `framepress-capture --window`
|
|
6
|
+
// writes it: no wallpaper, menu bar or dock, transparent corners (black once encoded), event
|
|
7
|
+
// coordinates from the window's top left, meta.source "window" and a window.jsonl frame log.
|
|
8
|
+
// Scenario: select a file, drag it onto a sidebar folder, click the search field and type,
|
|
9
|
+
// scroll the file grid, rest on a toolbar button, then idle.
|
|
10
|
+
import { chromium } from 'playwright-core';
|
|
11
|
+
import ffmpeg from 'ffmpeg-static';
|
|
12
|
+
import { spawn } from 'node:child_process';
|
|
13
|
+
import { once } from 'node:events';
|
|
14
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
15
|
+
import { resolve } from 'node:path';
|
|
16
|
+
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
17
|
+
|
|
18
|
+
const WINDOW = process.argv.includes('--window');
|
|
19
|
+
const out = resolve(process.argv.slice(2).find(a => !a.startsWith('--')) ?? (WINDOW ? 'synthetic-window-capture' : 'synthetic-capture'));
|
|
20
|
+
const RADIUS = 10;
|
|
21
|
+
const FPS = 60, SCALE = 2, W = 1440, H = 900, TYPED = 'report';
|
|
22
|
+
let seed = 7;
|
|
23
|
+
const rand = () => { seed = (seed * 16807) % 2147483647; return seed / 2147483647; };
|
|
24
|
+
const minJerk = u => u <= 0 ? 0 : u >= 1 ? 1 : u * u * u * (10 + u * (-15 + 6 * u));
|
|
25
|
+
|
|
26
|
+
await mkdir(out, { recursive: true });
|
|
27
|
+
const browser = await chromium.launch({ headless: true, channel: 'chrome' });
|
|
28
|
+
let encoder;
|
|
29
|
+
try {
|
|
30
|
+
const page = await browser.newPage({ viewport: { width: W, height: H }, deviceScaleFactor: SCALE });
|
|
31
|
+
await page.goto(pathToFileURL(fileURLToPath(new URL('desktop.html', import.meta.url))).href);
|
|
32
|
+
await page.evaluate(() => document.fonts.ready);
|
|
33
|
+
if (WINDOW) await page.addStyleTag({ content: `body{background:#000}#menubar,#dock,.deskicon{display:none}#win{box-shadow:none;border-radius:${RADIUS}px}` });
|
|
34
|
+
const win = await page.locator('#win').evaluate(e => { const r = e.getBoundingClientRect(); return { x: r.x, y: r.y, w: r.width, h: r.height }; });
|
|
35
|
+
const off = WINDOW ? win : { x: 0, y: 0, w: W, h: H };
|
|
36
|
+
const rect = sel => page.locator(sel).first().evaluate(e => { const r = e.getBoundingClientRect(); return { x: r.x, y: r.y, w: r.width, h: r.height }; });
|
|
37
|
+
const [invoice, archive, search, share, content] = await Promise.all(['[data-name="Invoice-Oct.pdf"] .doc', '#archive', '#search', '#share', '#content'].map(rect));
|
|
38
|
+
const shape = (x, y, down) => {
|
|
39
|
+
const hit = r => x >= r.x && x <= r.x + r.w && y >= r.y && y <= r.y + r.h;
|
|
40
|
+
return down ? 'arrow' : hit(search) ? 'ibeam' : hit(share) ? 'pointer' : 'arrow';
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const events = [];
|
|
44
|
+
let pos = { x: 1236, y: 806 }, down = false;
|
|
45
|
+
const push = (t, type, extra = {}) => events.push({ t: +t.toFixed(4), type, x: +pos.x.toFixed(2), y: +pos.y.toFixed(2), button: ['down', 'up', 'drag'].includes(type) ? 'left' : null, dx: 0, dy: 0, cursor: shape(pos.x, pos.y, type === 'drag'), ...extra });
|
|
46
|
+
// A human move: minimum jerk with a slight bow, a small overshoot corrected at the end and
|
|
47
|
+
// hand tremor, sampled near 120 Hz with uneven timing.
|
|
48
|
+
const move = (t0, to, dur) => {
|
|
49
|
+
const from = { ...pos }, dx = to.x - from.x, dy = to.y - from.y, d = Math.hypot(dx, dy);
|
|
50
|
+
const bow = d * (0.03 + rand() * 0.03) * (dx >= 0 ? -1 : 1), over = 0.02 + rand() * 0.02;
|
|
51
|
+
let t = t0, n1 = 0, n2 = 0;
|
|
52
|
+
while (t < t0 + dur) {
|
|
53
|
+
t += 1 / 120 * (0.85 + rand() * 0.3);
|
|
54
|
+
const u = Math.min(1, (t - t0) / dur), e = minJerk(u) * (1 + over * Math.sin(Math.PI * Math.min(1, u * 1.15)));
|
|
55
|
+
n1 = n1 * .8 + (rand() - .5) * .5; n2 = n2 * .8 + (rand() - .5) * .5;
|
|
56
|
+
const tremor = Math.sin(Math.PI * u);
|
|
57
|
+
pos = { x: from.x + dx * e - dy / d * bow * Math.sin(Math.PI * u) + n1 * tremor, y: from.y + dy * e + dx / d * bow * Math.sin(Math.PI * u) + n2 * tremor };
|
|
58
|
+
push(Math.min(t, t0 + dur), down ? 'drag' : 'move');
|
|
59
|
+
}
|
|
60
|
+
pos = { ...to }; push(t0 + dur, down ? 'drag' : 'move');
|
|
61
|
+
return t0 + dur;
|
|
62
|
+
};
|
|
63
|
+
const click = (t, hold = 0.1) => { down = true; push(t, 'down'); down = false; push(t + hold, 'up'); return t + hold; };
|
|
64
|
+
const at = (r, fx = .5, fy = .5) => ({ x: r.x + r.w * fx, y: r.y + r.h * fy });
|
|
65
|
+
|
|
66
|
+
push(0, 'move');
|
|
67
|
+
let t = move(0.6, at(invoice, .46, .55), 0.78);
|
|
68
|
+
t = click(t + 0.13, 0.11);
|
|
69
|
+
// Press again and drag the file onto the Archive folder.
|
|
70
|
+
down = true; push(t + 0.45, 'down');
|
|
71
|
+
t = move(t + 0.55, at(archive, .45, .5), 1.0);
|
|
72
|
+
down = false; push(t + 0.18, 'up'); t += 0.18;
|
|
73
|
+
t = move(t + 0.35, at(search, .55, .5), 0.85);
|
|
74
|
+
t = click(t + 0.12, 0.1);
|
|
75
|
+
for (const gap of [0.24, 0.13, 0.09, 0.16, 0.11, 0.1]) { t += gap; push(t, 'key'); }
|
|
76
|
+
t = move(t + 0.45, at(content, .5, .45), 0.62);
|
|
77
|
+
// Two-finger scroll with momentum: deltas in points, positive scrolls the content down.
|
|
78
|
+
for (let i = 0, s = t + 0.15; i < 48; i++) { const dy = 14 * Math.exp(-i / 12) * (i < 4 ? (i + 1) / 4 : 1); push(s + i / 60, 'scroll', { dy: +dy.toFixed(2) }); t = s + i / 60; }
|
|
79
|
+
t = move(t + 0.4, at(share, .5, .5), 0.7);
|
|
80
|
+
const duration = Math.ceil((t + 1.8) * FPS) / FPS;
|
|
81
|
+
events.sort((a, b) => a.t - b.t);
|
|
82
|
+
|
|
83
|
+
await page.evaluate(([e, typed]) => { window.EVENTS = e; window.TYPED = typed; }, [events, TYPED]);
|
|
84
|
+
const frames = Math.round(duration * FPS);
|
|
85
|
+
encoder = spawn(ffmpeg, ['-hide_banner', '-loglevel', 'error', '-y', '-f', 'image2pipe', '-c:v', 'mjpeg', '-framerate', String(FPS), '-i', 'pipe:0', '-c:v', 'libx264', '-preset', 'veryfast', '-crf', '12', '-pix_fmt', 'yuv420p', resolve(out, 'screen.mov')], { stdio: ['pipe', 'ignore', 'inherit'] });
|
|
86
|
+
const cdp = await page.context().newCDPSession(page);
|
|
87
|
+
for (let i = 0; i < frames; i++) {
|
|
88
|
+
await page.evaluate(s => window.renderAt(s), i / FPS);
|
|
89
|
+
const { data } = await cdp.send('Page.captureScreenshot', { format: 'jpeg', quality: 93, ...(WINDOW && { clip: { x: win.x, y: win.y, width: win.w, height: win.h, scale: 1 } }) });
|
|
90
|
+
if (!encoder.stdin.write(Buffer.from(data, 'base64'))) await once(encoder.stdin, 'drain');
|
|
91
|
+
if (i % 60 === 0) process.stdout.write(`\r frame ${i}/${frames}`);
|
|
92
|
+
}
|
|
93
|
+
encoder.stdin.end(); await once(encoder, 'close');
|
|
94
|
+
// Page coordinates drive the UI; the capture's events are relative to its source.
|
|
95
|
+
const shifted = events.map(e => ({ ...e, x: +(e.x - off.x).toFixed(2), y: +(e.y - off.y).toFixed(2) }));
|
|
96
|
+
await writeFile(resolve(out, 'events.jsonl'), shifted.map(e => JSON.stringify(e)).join('\n') + '\n');
|
|
97
|
+
const meta = { version: 1, fps: FPS, width_px: off.w * SCALE, height_px: off.h * SCALE, scale: SCALE, display_points: { w: off.w, h: off.h }, origin_points: { x: off.x, y: off.y }, started_at: new Date().toISOString(), cursor_hidden: true, duration_s: frames / FPS,
|
|
98
|
+
...(WINDOW ? { source: 'window', window: { id: 0, title: 'Projects', bundle_id: 'com.apple.finder', app: 'Finder' }, corner_radius_points: RADIUS, corner_radius_source: 'synthetic' } : { source: 'display' }) };
|
|
99
|
+
await writeFile(resolve(out, 'meta.json'), JSON.stringify(meta, null, 2) + '\n');
|
|
100
|
+
if (WINDOW) await writeFile(resolve(out, 'window.jsonl'), JSON.stringify({ t: 0, x: win.x, y: win.y, w: win.w, h: win.h }) + '\n');
|
|
101
|
+
console.log(`\n ${out}: ${frames} frames, ${events.length} events`);
|
|
102
|
+
} finally { encoder?.kill(); await browser.close(); }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "FramepressCapture",
|
|
6
|
+
platforms: [.macOS(.v14)],
|
|
7
|
+
products: [.executable(name: "framepress-capture", targets: ["FramepressCapture"])],
|
|
8
|
+
targets: [.executableTarget(name: "FramepressCapture")]
|
|
9
|
+
)
|