-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
386 lines (363 loc) · 15.5 KB
/
index.html
File metadata and controls
386 lines (363 loc) · 15.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Machlit</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<nav id="nav">
<span id="nav-logo"
><img src="assets/logo-light.png" /> Machlit</span
>
<a id="nav-link" href="https://github.com/machlit" target="_blank"
>GitHub</a
>
</nav>
<div id="progress">
<div class="progress-dot active"></div>
<div class="progress-dot"></div>
<div class="progress-dot"></div>
<div class="progress-dot"></div>
<div class="progress-dot"></div>
</div>
<span id="scroll-hint">scroll</span>
<div id="scroll-container">
<div id="scroll-content">
<section class="section">
<span class="line heading">Prep your Mac tools</span>
<span class="line heading"
>like a
<span class="accent">chocolate basket.</span></span
>
<span class="spacer"></span>
<span class="line">(follow your scroll wheel)</span>
</section>
<section class="section">
<span class="spacer-sm"></span>
<span class="line"
>Ever feel like you need tools which you "enjoy"?</span
>
<span class="line"
>When was the last time you typed that one
command?</span
>
<span class="spacer"></span>
<span class="line">Now let's change it.</span>
<span class="spacer"></span>
<span class="line">Scroll down even more..</span>
<span class="line"
>To gift yourself
<span class="accent">convenience.</span></span
>
<span class="line"
>Apps and tools you'll
<span class="accent">love.</span></span
>
</section>
<section class="section">
<span class="line sub">cutler</span>
<span class="spacer-sm"></span>
<span
class="line heading"
style="font-size: clamp(1.8rem, 3.5vw, 2.8rem)"
>Declare your <span class="accent">Mac.</span></span
>
<span
class="line heading"
style="font-size: clamp(1.8rem, 3.5vw, 2.8rem)"
>Apply it <span class="accent">once.</span></span
>
<span class="spacer"></span>
<span class="line">Write a single TOML file.</span>
<span class="line">Run a single command.</span>
<span class="line"
>Watch your system become exactly what you
intended.</span
>
<span class="spacer"></span>
<span class="line">
<span
class="cmd-block"
data-cmd="brew install machlit/tap/cutler"
>
<span class="cmd-text"
>$ brew install machlit/tap/cutler</span
>
<button class="copy-btn" aria-label="Copy command">
<span class="copy-tooltip">copied</span>
<svg
width="15"
height="15"
viewBox="0 0 15 15"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect
x="5.5"
y="1.5"
width="8"
height="9"
rx="1.8"
stroke="#555"
stroke-width="1.25"
/>
<rect
x="1.5"
y="4.5"
width="8"
height="9"
rx="1.8"
fill="#f2f2f2"
stroke="#555"
stroke-width="1.25"
/>
</svg>
</button>
</span>
</span>
<span class="spacer"></span>
<span class="line"
><a
class="repo-link"
href="https://github.com/machlit/cutler"
target="_blank"
>github.com/machlit/cutler ↗</a
></span
>
</section>
<section class="section">
<span class="line sub">defaults-rs </span>
<span class="spacer-sm"></span>
<span
class="line heading"
style="font-size: clamp(1.8rem, 3.5vw, 2.8rem)"
><span class="accent">macOS</span> defaults,</span
>
<span
class="line heading"
style="font-size: clamp(1.8rem, 3.5vw, 2.8rem)"
>finally tamed.</span
>
<span class="spacer"></span>
<span class="line"
>A native
<span class="accent" style="font-weight: 400"
>Rust</span
>
interface to the macOS defaults system.</span
>
<span class="line"
>Read, write, and manage user preferences</span
>
<span class="line"
>from the command line or from your own library.</span
>
<span class="spacer"></span>
<span class="line"
><a
class="repo-link"
href="https://github.com/machlit/defaults-rs"
target="_blank"
>github.com/machlit/defaults-rs ↗</a
></span
>
</section>
<section class="section">
<span class="line">Everything here</span>
<span class="line">is free to use,</span>
<span class="line">free to fork,</span>
<span class="line">free to improve.</span>
<span class="spacer"></span>
<span class="line sub"
><a
class="repo-link"
href="https://github.com/machlit"
target="_blank"
>github.com/machlit ↗</a
></span
>
<span class="spacer-sm"></span>
<span class="line sub"
><a
class="repo-link"
href="https://codeberg.org/machlit"
target="_blank"
>codeberg.org/machlit ↗</a
></span
>
</section>
</div>
</div>
<script>
(function () {
const container = document.getElementById("scroll-container");
const content = document.getElementById("scroll-content");
const navLogo = document.getElementById("nav-logo");
const hint = document.getElementById("scroll-hint");
const dots = document.querySelectorAll(".progress-dot");
const sections = document.querySelectorAll(".section");
const lines = document.querySelectorAll(".line");
let curY = 0,
tgtY = 0,
raf = null,
maxScroll = 0,
scrolled = false;
const EASE = 0.2;
function clamp(v, a, b) {
return v < a ? a : v > b ? b : v;
}
function recalc() {
maxScroll = Math.max(
0,
content.scrollHeight - window.innerHeight,
);
tgtY = clamp(tgtY, 0, maxScroll);
}
function updateDOM() {
const half = window.innerHeight * 0.7;
lines.forEach((l) => {
const r = l.getBoundingClientRect();
l.classList.toggle(
"active",
r.top + r.height * 0.5 < half,
);
});
let cur = 0;
sections.forEach((s, i) => {
if (s.getBoundingClientRect().top < half) cur = i;
});
dots.forEach((d, i) =>
d.classList.toggle("active", i === cur),
);
const p = maxScroll ? curY / maxScroll : 0;
const c = Math.round(p * 80)
.toString(16)
.padStart(2, "0");
navLogo.style.color = `#${c}${c}${c}`;
}
function tick() {
const d = tgtY - curY;
if (Math.abs(d) < 0.08) {
curY = tgtY;
content.style.transform = `translateY(${-curY}px)`;
updateDOM();
raf = null;
return;
}
curY += d * EASE;
content.style.transform = `translateY(${-curY}px)`;
updateDOM();
raf = requestAnimationFrame(tick);
}
function go(delta) {
tgtY = clamp(tgtY + delta, 0, maxScroll);
if (!raf) raf = requestAnimationFrame(tick);
}
function markScrolled() {
if (!scrolled) {
scrolled = true;
hint.style.opacity = "0";
}
}
container.addEventListener(
"wheel",
(e) => {
e.preventDefault();
markScrolled();
go(e.deltaY * 0.8);
},
{ passive: false },
);
let t0 = 0;
container.addEventListener(
"touchstart",
(e) => {
t0 = e.touches[0].clientY;
},
{ passive: true },
);
container.addEventListener(
"touchmove",
(e) => {
e.preventDefault();
const dy = t0 - e.touches[0].clientY;
t0 = e.touches[0].clientY;
if (Math.abs(dy) > 1) markScrolled();
go(dy * 1.2);
},
{ passive: false },
);
window.addEventListener("keydown", (e) => {
const step = window.innerHeight * 0.6;
if (
e.key === "ArrowDown" ||
e.key === "PageDown" ||
e.key === " "
) {
e.preventDefault();
markScrolled();
go(step);
} else if (e.key === "ArrowUp" || e.key === "PageUp") {
e.preventDefault();
go(-step);
}
});
dots.forEach((d, i) => {
d.addEventListener("click", () => {
tgtY = clamp(sections[i].offsetTop, 0, maxScroll);
if (!raf) raf = requestAnimationFrame(tick);
});
});
window.addEventListener("resize", () => {
recalc();
if (!raf) raf = requestAnimationFrame(tick);
});
document.querySelectorAll(".copy-btn").forEach((btn) => {
btn.addEventListener("click", (e) => {
e.stopPropagation();
const cmd = btn.closest(".cmd-block").dataset.cmd;
const write = () => {
const ta = document.createElement("textarea");
ta.value = cmd;
ta.style.cssText = "position:fixed;opacity:0";
document.body.appendChild(ta);
ta.select();
document.execCommand("copy");
document.body.removeChild(ta);
};
navigator.clipboard
? navigator.clipboard.writeText(cmd).catch(write)
: Promise.resolve(write());
btn.classList.add("copied");
setTimeout(() => btn.classList.remove("copied"), 1600);
});
});
setTimeout(() => {
if (scrolled) return;
let op = 1,
dir = -1;
const iv = setInterval(() => {
if (scrolled) {
clearInterval(iv);
return;
}
op += dir * 0.02;
if (op <= 0.3) dir = 1;
if (op >= 1) dir = -1;
hint.style.opacity = op;
}, 40);
}, 2000);
recalc();
updateDOM();
})();
</script>
</body>
</html>