-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
708 lines (672 loc) · 20.2 KB
/
Copy pathindex.html
File metadata and controls
708 lines (672 loc) · 20.2 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
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Auth Guide for Indie Devs, Write On Track</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Nunito:wght@400;600;700;800&display=swap">
<link rel="stylesheet" href="./tokens.css">
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: var(--font-body);
color: var(--color-text);
background: #EDE6DA;
min-height: 100vh;
padding: 24px;
}
.shell { max-width: 1400px; margin: 0 auto; }
/* ── Header ─────────────────────────────────────────── */
.banner {
display: inline-block;
padding: 4px 12px;
background: rgba(196,149,106,0.18);
color: var(--color-accent);
border: 1px dashed var(--color-accent);
border-radius: 12px;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.5px;
text-transform: uppercase;
margin-bottom: 14px;
}
h1 { font-family: var(--font-heading); font-size: 32px; margin-bottom: 4px; }
.subhead {
color: var(--color-text-muted);
font-size: 14px;
max-width: 820px;
line-height: 1.55;
margin-bottom: 12px;
}
.subhead strong { color: var(--color-text); }
.hint {
padding: 10px 14px;
background: rgba(123,158,106,0.10);
border-left: 3px solid var(--color-publishing);
border-radius: 8px;
font-size: 12px;
color: var(--color-text-secondary);
max-width: 820px;
line-height: 1.55;
margin-bottom: 28px;
}
.hint strong { color: var(--color-publishing); }
.hint code {
font-family: 'SFMono-Regular', Menlo, monospace;
font-size: 11px;
background: var(--color-surface);
padding: 1px 5px;
border-radius: 3px;
}
/* ── Layout ─────────────────────────────────────────── */
.layout {
display: grid;
grid-template-columns: 260px 1fr;
gap: 28px;
align-items: start;
}
@media (max-width: 900px) {
.layout { grid-template-columns: 1fr; }
.sidebar { position: static; max-height: none; }
}
/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
position: sticky;
top: 24px;
background: var(--color-bg);
border: 1px solid var(--color-border);
border-radius: 14px;
padding: 14px;
max-height: calc(100vh - 48px);
overflow-y: auto;
}
.sidebar-title {
font-family: var(--font-heading);
font-size: 13px;
color: var(--color-text-muted);
text-transform: uppercase;
letter-spacing: 0.8px;
margin-bottom: 10px;
padding: 0 8px;
}
.toc-item {
display: flex;
flex-direction: column;
padding: 10px 12px;
margin-bottom: 4px;
background: transparent;
border: 1px solid transparent;
border-radius: 10px;
text-decoration: none;
color: var(--color-text);
transition: all 0.12s;
cursor: pointer;
}
.toc-item:hover {
background: var(--color-accent-bg);
border-color: var(--color-accent);
}
.toc-item.active {
background: var(--color-accent-bg);
border-color: var(--color-accent);
}
.toc-item-row {
display: flex; align-items: baseline; gap: 8px;
}
.toc-num {
font-family: 'SFMono-Regular', Menlo, monospace;
font-size: 11px;
color: var(--color-text-hint);
flex-shrink: 0;
}
.toc-title {
flex: 1; min-width: 0;
font-size: 13.5px;
font-weight: 700;
color: var(--color-text);
}
.toc-item.active .toc-title { color: var(--color-accent); }
.toc-summary {
font-size: 11.5px;
color: var(--color-text-muted);
line-height: 1.4;
margin-top: 3px;
padding-left: 28px;
}
/* ── Viewer ─────────────────────────────────────────── */
.viewer {
background: var(--color-bg);
border: 1px solid var(--color-border);
border-radius: 16px;
padding: 28px 32px 32px;
min-height: calc(100vh - 48px);
}
.viewer-header {
margin-bottom: 20px;
padding-bottom: 16px;
border-bottom: 1px solid var(--color-border);
}
.viewer-num {
font-family: 'SFMono-Regular', Menlo, monospace;
font-size: 12px;
background: var(--color-accent-bg);
color: var(--color-accent);
padding: 2px 8px;
border-radius: 6px;
font-weight: 800;
display: inline-block;
margin-bottom: 8px;
}
.viewer-header h1 {
font-family: var(--font-heading);
font-size: 28px;
margin-bottom: 4px;
color: var(--color-text);
}
.viewer-header .summary {
font-size: 13px;
color: var(--color-text-muted);
}
.viewer-nav {
display: flex;
justify-content: space-between;
margin-top: 36px;
padding-top: 18px;
border-top: 1px solid var(--color-border);
font-size: 12.5px;
}
.viewer-nav a {
color: var(--color-accent);
text-decoration: none;
padding: 6px 12px;
border: 1px solid var(--color-accent);
border-radius: 8px;
font-weight: 700;
transition: background 0.12s;
}
.viewer-nav a:hover { background: var(--color-accent-bg); }
.viewer-nav .spacer { flex: 1; }
/* Markdown body */
.md h2 {
font-family: var(--font-heading);
font-size: 20px;
margin-top: 28px;
margin-bottom: 10px;
color: var(--color-text);
}
.md h2:first-child { margin-top: 4px; }
.md h3 {
font-family: var(--font-body);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.8px;
font-weight: 800;
color: var(--color-accent);
margin-top: 18px;
margin-bottom: 8px;
}
.md h4 {
font-family: var(--font-body);
font-size: 14px;
font-weight: 800;
color: var(--color-text);
margin-top: 14px;
margin-bottom: 6px;
}
.md p {
font-size: 13.5px;
line-height: 1.65;
color: var(--color-text-secondary);
margin-bottom: 10px;
}
.md ul, .md ol {
padding-left: 22px;
margin-bottom: 12px;
}
.md li {
font-size: 13.5px;
line-height: 1.65;
color: var(--color-text-secondary);
margin-bottom: 5px;
}
.md strong { color: var(--color-text); }
.md code {
font-family: 'SFMono-Regular', Menlo, monospace;
font-size: 11.5px;
background: var(--color-surface);
padding: 1px 5px;
border-radius: 4px;
color: var(--color-text);
}
.md pre {
background: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: 10px;
padding: 14px 16px;
overflow-x: auto;
margin: 12px 0 16px;
}
.md pre code {
background: transparent;
padding: 0;
font-size: 11.5px;
line-height: 1.55;
color: var(--color-text);
}
.md a {
color: var(--color-accent);
text-decoration: none;
font-weight: 700;
}
.md a:hover { text-decoration: underline; }
.md table {
width: 100%;
border-collapse: collapse;
margin: 12px 0 16px;
font-size: 12.5px;
}
.md th, .md td {
text-align: left;
padding: 8px 12px;
border-bottom: 1px solid var(--color-border);
}
.md th {
background: var(--color-surface);
font-weight: 800;
color: var(--color-text);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.md td { color: var(--color-text-secondary); }
.md blockquote {
border-left: 3px solid var(--color-accent);
padding: 6px 14px;
background: var(--color-accent-bg);
border-radius: 0 8px 8px 0;
margin: 12px 0;
font-size: 13px;
color: var(--color-text-secondary);
font-style: italic;
}
/* Collapsible spoilers (<details>/<summary>) */
.md details {
margin: 12px 0 16px;
border: 1px solid var(--color-border);
border-radius: 10px;
background: var(--color-surface);
padding: 0;
overflow: hidden;
}
.md details > summary {
cursor: pointer;
list-style: none;
padding: 10px 14px;
font-size: 12.5px;
font-weight: 700;
color: var(--color-accent);
user-select: none;
transition: background 0.12s;
}
.md details > summary::-webkit-details-marker { display: none; }
.md details > summary::before {
content: '▸ ';
color: var(--color-text-muted);
font-weight: 400;
margin-right: 4px;
display: inline-block;
transition: transform 0.15s;
}
.md details[open] > summary::before {
transform: rotate(90deg);
}
.md details > summary:hover {
background: var(--color-accent-bg);
}
.md details[open] > summary {
border-bottom: 1px solid var(--color-border);
background: var(--color-accent-bg);
}
.md details > *:not(summary) {
padding: 0 14px;
}
.md details > pre {
margin: 12px 14px;
padding: 12px 14px;
background: var(--color-bg);
}
.md details > p:first-of-type { padding-top: 12px; }
.md details > p:last-of-type,
.md details > ul:last-child,
.md details > ol:last-child { padding-bottom: 12px; }
/* Mermaid block rendered inside markdown */
.md .mermaid-rendered {
margin: 18px 0 22px;
padding: 16px 16px 20px;
background: #FBF8F4;
border: 1px solid var(--color-border);
border-radius: 12px;
overflow: auto;
}
.md .mermaid-rendered svg {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
.md .mermaid-rendered .node { cursor: pointer; }
.md .mermaid-rendered .node:hover rect,
.md .mermaid-rendered .node:hover polygon {
filter: brightness(0.96);
}
.mermaid-error {
margin: 12px 0;
padding: 10px 14px;
background: var(--color-destructive-bg);
border: 1px solid var(--color-destructive);
border-radius: 8px;
color: var(--color-destructive);
font-family: 'SFMono-Regular', Menlo, monospace;
font-size: 11px;
line-height: 1.5;
white-space: pre-wrap;
}
.loading {
text-align: center;
padding: 60px;
color: var(--color-text-muted);
font-size: 13px;
}
/* Download button inside markdown */
.md .download-row { margin: 14px 0 18px; }
.md a.download-btn {
display: inline-block;
padding: 8px 16px;
background: var(--color-accent-bg);
border: 1px solid var(--color-accent);
border-radius: 8px;
color: var(--color-accent);
text-decoration: none;
font-size: 13px;
font-weight: 700;
transition: all 0.12s;
}
.md a.download-btn:hover {
background: var(--color-accent);
color: var(--color-bg);
text-decoration: none;
}
/* Support block at sidebar bottom — title + buttons always visible, text is a teaser-revealing spoiler */
.support-block {
margin-top: 18px;
padding: 14px;
background: var(--color-accent-bg);
border: 1px solid var(--color-accent);
border-radius: 12px;
}
.support-title {
font-family: var(--font-heading);
font-size: 14px;
color: var(--color-text);
margin-bottom: 8px;
display: flex; align-items: baseline; gap: 4px;
}
.support-heart {
color: var(--color-destructive);
font-size: 13px;
}
.support-spoiler {
margin-bottom: 10px;
}
.support-teaser {
list-style: none;
cursor: pointer;
font-size: 12px;
line-height: 1.5;
color: var(--color-accent);
font-style: italic;
user-select: none;
display: inline;
}
.support-teaser::-webkit-details-marker { display: none; }
.support-teaser::after {
content: ' ▸';
color: var(--color-accent);
font-size: 10px;
font-style: normal;
transition: transform 0.15s;
display: inline-block;
}
.support-spoiler[open] .support-teaser::after {
content: ' ▾';
}
.support-spoiler[open] .support-teaser {
font-style: normal;
color: var(--color-text-secondary);
}
.support-text {
font-size: 12px;
line-height: 1.5;
color: var(--color-text-secondary);
margin: 4px 0 0;
}
.support-links {
display: flex; gap: 6px; flex-wrap: wrap;
}
.support-links a {
flex: 1; min-width: 0;
text-align: center;
padding: 7px 10px;
background: var(--color-bg);
border: 1px solid var(--color-accent);
border-radius: 8px;
color: var(--color-accent);
text-decoration: none;
font-size: 12px;
font-weight: 700;
transition: all 0.12s;
}
.support-links a:hover {
background: var(--color-accent);
color: var(--color-bg);
}
</style>
</head>
<body>
<div class="shell">
<span class="banner">Mobile auth · indie playbook</span>
<h1>How to ship mobile auth as an indie</h1>
<p class="subhead">
Notes on setting up Apple, Google, and Anonymous sign-in for a Flutter app on Firebase. Covers what to set up, what to skip, and the bugs that usually break the first build.
</p>
<div class="hint">
<strong>How to read it:</strong> open <strong>Overview</strong> for the big picture. Click any node in a diagram, or any sidebar item, to jump to that topic.
</div>
<div class="layout">
<!-- Sidebar TOC -->
<aside class="sidebar">
<div class="sidebar-title">Topics</div>
<div id="toc"></div>
<div class="support-block">
<div class="support-title">Made by FitHappensML <span class="support-heart">❤</span></div>
<details class="support-spoiler">
<summary class="support-teaser">If this saved you time…</summary>
<p class="support-text">
…a follow would actually mean a lot. I'm an indie dev. Not naturally a public person, but every subscriber really matters when you're solo. I don't post a ton, just building stuff.
</p>
</details>
<div class="support-links">
<a href="https://t.me/FitHappensML" target="_blank" rel="noopener">Telegram</a>
<a href="https://x.com/FitHappensML" target="_blank" rel="noopener">Twitter · X</a>
</div>
</div>
</aside>
<!-- Main viewer -->
<main class="viewer">
<header class="viewer-header">
<span class="viewer-num" id="viewer-num"></span>
<h1 id="viewer-title">Loading…</h1>
<div class="summary" id="viewer-summary"></div>
</header>
<div class="md" id="viewer-body">
<div class="loading">Loading topic…</div>
</div>
<nav class="viewer-nav" id="viewer-nav"></nav>
</main>
</div>
</div>
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10.9.1/+esm';
mermaid.initialize({
startOnLoad: false,
theme: 'base',
securityLevel: 'loose',
flowchart: {
htmlLabels: false, // SVG-native text, accurate measurement, no font race
curve: 'basis',
padding: 24, // breathing room without breaking measurement
nodeSpacing: 50,
rankSpacing: 70,
useMaxWidth: false,
},
themeVariables: {
fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif',
fontSize: '12px',
primaryColor: '#FBF8F4',
primaryTextColor: '#3D3425',
primaryBorderColor: '#C4956A',
lineColor: '#8B7E6A',
tertiaryColor: '#FBF8F4',
clusterBkg: '#F3EEE5',
clusterBorder: '#E2DACE',
titleColor: '#3D3425',
}
// No themeCSS, overriding font-weight/family after measurement caused the overflow.
// Mermaid measures and renders with the same default weight; we don't touch it.
});
const esc = s => String(s ?? '')
.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
let manifest = [];
async function loadManifest() {
const r = await fetch('./topics/_index.json');
if (!r.ok) throw new Error('topics/_index.json not found');
const data = await r.json();
manifest = data.topics || [];
}
function parseFrontmatter(md) {
const m = md.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
if (!m) return { meta: {}, content: md };
const meta = {};
for (const line of m[1].split(/\r?\n/)) {
const kv = line.match(/^([\w-]+):\s*(.*)$/);
if (kv) meta[kv[1]] = kv[2].trim();
}
return { meta, content: m[2] };
}
function renderToc(activeId) {
const root = document.getElementById('toc');
root.innerHTML = manifest.map(t => {
const num = String(t.order).padStart(2, '0');
const isActive = t.id === activeId;
return `<a class="toc-item ${isActive ? 'active' : ''}" href="#topic=${t.id}">
<div class="toc-item-row">
<span class="toc-num">${num}</span>
<span class="toc-title">${esc(t.title)}</span>
</div>
<div class="toc-summary">${esc(t.summary || '')}</div>
</a>`;
}).join('');
}
async function renderEmbeddedMermaid(container, idPrefix) {
const blocks = [...container.querySelectorAll('pre code.language-mermaid')];
for (let i = 0; i < blocks.length; i++) {
const block = blocks[i];
const src = block.textContent;
const id = `mmd-${idPrefix}-${i}-${Date.now()}`.replace(/[^a-zA-Z0-9_-]/g, '-');
try {
const { svg, bindFunctions } = await mermaid.render(id, src);
const wrapper = document.createElement('div');
wrapper.className = 'mermaid-rendered';
wrapper.innerHTML = svg;
if (bindFunctions) bindFunctions(wrapper);
block.parentElement.replaceWith(wrapper);
} catch (e) {
console.error('[auth-guide] mermaid render failed', id, e);
const err = document.createElement('div');
err.className = 'mermaid-error';
err.textContent = 'Diagram failed to render:\n' + (e.message || e);
block.parentElement.replaceWith(err);
}
}
}
function renderNav(currentId) {
const idx = manifest.findIndex(t => t.id === currentId);
const prev = idx > 0 ? manifest[idx - 1] : null;
const next = idx >= 0 && idx < manifest.length - 1 ? manifest[idx + 1] : null;
const root = document.getElementById('viewer-nav');
root.innerHTML = `
${prev ? `<a href="#topic=${prev.id}">← ${esc(prev.title)}</a>` : '<span></span>'}
<span class="spacer"></span>
${next ? `<a href="#topic=${next.id}">${esc(next.title)} →</a>` : '<span></span>'}
`;
}
async function loadTopic(topicId) {
const topic = manifest.find(t => t.id === topicId);
if (!topic) {
document.getElementById('viewer-title').textContent = 'Topic not found';
document.getElementById('viewer-body').innerHTML =
`<div class="mermaid-error">No topic with id "${esc(topicId)}". Try one from the sidebar.</div>`;
return;
}
renderToc(topicId);
try {
const r = await fetch(`./topics/${topic.id}.md`);
if (!r.ok) throw new Error(`Missing file: topics/${topic.id}.md`);
const raw = await r.text();
const { meta, content } = parseFrontmatter(raw);
const num = String(topic.order).padStart(2, '0');
document.getElementById('viewer-num').textContent = num;
document.getElementById('viewer-title').textContent = meta.title || topic.title;
document.getElementById('viewer-summary').textContent = meta.summary || topic.summary || '';
const body = document.getElementById('viewer-body');
body.innerHTML = marked.parse(content);
await renderEmbeddedMermaid(body, topic.id);
renderNav(topic.id);
// Scroll body to top
window.scrollTo({ top: 0, behavior: 'instant' });
} catch (e) {
console.error('[auth-guide] load topic failed', e);
document.getElementById('viewer-body').innerHTML =
`<div class="mermaid-error">Failed to load topic ${esc(topic.id)}: ${esc(e.message)}</div>`;
}
}
function currentTopicFromHash() {
const m = location.hash.match(/topic=([\w-]+)/);
return m ? m[1] : manifest[0]?.id;
}
window.addEventListener('hashchange', () => {
const id = currentTopicFromHash();
if (id) loadTopic(id);
});
(async () => {
try {
// Wait for Google Fonts to load BEFORE rendering Mermaid.
// Mermaid measures text width during render; if Nunito isn't loaded yet
// it uses a fallback font's metrics and the rendered labels get clipped.
if (document.fonts && document.fonts.ready) {
try { await document.fonts.ready; } catch (_) { /* non-fatal */ }
}
await loadManifest();
const initial = currentTopicFromHash();
await loadTopic(initial);
} catch (e) {
document.getElementById('viewer-body').innerHTML =
`<div class="mermaid-error">Failed to bootstrap: ${esc(e.message)}</div>`;
console.error(e);
}
})();
</script>
</body>
</html>