@tempoxyz/ds 0.3.16 → 0.3.17
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/docs/AGENTS.md +4 -2
- package/dist/docs/marketing.md +699 -0
- package/dist/docs/product/documents.md +225 -0
- package/dist/docs/product/foundations.md +1 -1
- package/dist/document/Document.d.ts +46 -0
- package/dist/document/Document.d.ts.map +1 -0
- package/dist/document/Document.js +190 -0
- package/dist/document/Document.js.map +1 -0
- package/dist/document/Enhance.d.ts +13 -0
- package/dist/document/Enhance.d.ts.map +1 -0
- package/dist/document/Enhance.js +421 -0
- package/dist/document/Enhance.js.map +1 -0
- package/dist/document/bin.d.ts +3 -0
- package/dist/document/bin.d.ts.map +1 -0
- package/dist/document/bin.js +38 -0
- package/dist/document/bin.js.map +1 -0
- package/dist/document/document.css +373 -0
- package/dist/document/index.d.ts +3 -0
- package/dist/document/index.d.ts.map +1 -0
- package/dist/document/index.js +3 -0
- package/dist/document/index.js.map +1 -0
- package/dist/document/internal/Cli.d.ts +43 -0
- package/dist/document/internal/Cli.d.ts.map +1 -0
- package/dist/document/internal/Cli.js +87 -0
- package/dist/document/internal/Cli.js.map +1 -0
- package/dist/document/internal/Template.d.ts +21 -0
- package/dist/document/internal/Template.d.ts.map +1 -0
- package/dist/document/internal/Template.js +15 -0
- package/dist/document/internal/Template.js.map +1 -0
- package/dist/document/script.d.ts +2 -0
- package/dist/document/script.d.ts.map +1 -0
- package/dist/document/script.js +379 -0
- package/dist/document/templates/brief.html +96 -0
- package/dist/document/templates/essay.html +70 -0
- package/dist/document/templates/post.html +69 -0
- package/package.json +19 -1
- package/src/document/Document.ts +277 -0
- package/src/document/Enhance.ts +434 -0
- package/src/document/bin.ts +38 -0
- package/src/document/document.css +373 -0
- package/src/document/index.ts +2 -0
- package/src/document/internal/Cli.ts +132 -0
- package/src/document/internal/Template.ts +25 -0
- package/src/document/script.ts +8 -0
- package/src/document/templates/brief.html +96 -0
- package/src/document/templates/essay.html +70 -0
- package/src/document/templates/post.html +69 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progressive enhancement for document mode: footnote popovers and the list of notes, heading
|
|
3
|
+
* copy-link anchors, copy buttons on code blocks, Essay's reading rail, Brief's contents highlight,
|
|
4
|
+
* and Axis placement. A document reads in full without it. @module
|
|
5
|
+
*/
|
|
6
|
+
// The Link icon from src/web/icons/svg/Link.svg, filled with currentColor as the React icon is. Inlined
|
|
7
|
+
// so the script has no imports to resolve.
|
|
8
|
+
const link = '<svg viewBox="0 0 16 16" fill="none" aria-hidden="true">' +
|
|
9
|
+
'<path d="M3.81309 6.81315C4.00834 6.61819 4.32494 6.61809 4.52012 6.81315C4.71529 7.00833 4.71513 7.32491 4.52012 7.52018L2.77501 9.26628C2.63738 9.40389 2.55452 9.48662 2.49864 9.55241C2.44691 9.61342 2.44701 9.62653 2.45079 9.61491C2.43994 9.64829 2.43997 9.68504 2.45079 9.71843C2.45504 9.72574 2.46795 9.74473 2.49864 9.78093C2.55453 9.84677 2.63719 9.92925 2.77501 10.0671L5.93321 13.2253C6.07102 13.3631 6.15351 13.4448 6.21934 13.5007C6.25519 13.5311 6.27422 13.5441 6.28184 13.5485C6.31522 13.5593 6.35199 13.5603 6.38536 13.5495C6.39329 13.5448 6.41267 13.5305 6.44786 13.5007C6.51365 13.4448 6.5964 13.3629 6.73399 13.2253L8.48008 11.4801C8.67537 11.2851 8.99194 11.285 9.18712 11.4801C9.38206 11.6753 9.38205 11.992 9.18712 12.1872L7.44102 13.9323C7.31499 14.0583 7.19946 14.1749 7.09532 14.2633C7.01381 14.3325 6.92065 14.4014 6.81016 14.4538L6.69395 14.4997C6.45972 14.5758 6.2075 14.5757 5.97325 14.4997C5.80931 14.4465 5.68052 14.3556 5.57188 14.2633C5.4677 14.1749 5.35229 14.0584 5.22618 13.9323L2.06798 10.7741C1.94181 10.6479 1.82539 10.5326 1.73692 10.4284C1.64466 10.3197 1.55286 10.1909 1.49962 10.027C1.42365 9.79294 1.42362 9.54039 1.49962 9.30632C1.55287 9.14262 1.64472 9.01358 1.73692 8.90495C1.82537 8.8008 1.94192 8.6853 2.06798 8.55925L3.81309 6.81315Z" fill="currentColor"/>' +
|
|
10
|
+
'<path d="M9.6461 5.64616C9.84126 5.451 10.1578 5.4512 10.3531 5.64616C10.5484 5.84142 10.5484 6.15793 10.3531 6.35319L6.35313 10.3532C6.15787 10.5485 5.84136 10.5485 5.6461 10.3532C5.45114 10.1579 5.45094 9.84132 5.6461 9.64616L9.6461 5.64616Z" fill="currentColor"/>' +
|
|
11
|
+
'<path d="M9.30626 1.49968C9.54033 1.42368 9.79288 1.42371 10.027 1.49968C10.1908 1.55292 10.3196 1.64472 10.4283 1.73698C10.5325 1.82546 10.6479 1.94187 10.774 2.06804L13.9322 5.22624C14.0583 5.35235 14.1748 5.46776 14.2633 5.57194C14.3555 5.68058 14.4464 5.80937 14.4996 5.97331C14.5566 6.14891 14.5711 6.33463 14.5426 6.5153L14.4996 6.69401C14.4464 6.85774 14.3554 6.98682 14.2633 7.09538C14.1748 7.19952 14.0583 7.31506 13.9322 7.44108L12.1871 9.18718C11.9919 9.38211 11.6753 9.38213 11.4801 9.18718C11.2849 8.992 11.2851 8.67543 11.4801 8.48015L13.2252 6.73405C13.3628 6.59646 13.4447 6.51371 13.5006 6.44792C13.5305 6.41273 13.5438 6.39335 13.5484 6.38542C13.5593 6.35205 13.5602 6.31528 13.5494 6.2819C13.5451 6.27428 13.531 6.25525 13.5006 6.2194C13.4447 6.15357 13.363 6.07108 13.2252 5.93327L10.067 2.77507C9.92919 2.63725 9.84671 2.55459 9.78087 2.4987C9.74467 2.46801 9.72568 2.45511 9.71837 2.45085C9.68498 2.44003 9.64823 2.44 9.61485 2.45085C9.62646 2.44707 9.61336 2.44697 9.55235 2.4987C9.48656 2.55458 9.40383 2.63744 9.26622 2.77507L7.52012 4.52018C7.32485 4.71519 7.00827 4.71535 6.81309 4.52018C6.61803 4.325 6.61813 4.0084 6.81309 3.81315L8.55919 2.06804C8.68524 1.94198 8.80074 1.82543 8.90489 1.73698C9.01352 1.64478 9.14256 1.55293 9.30626 1.49968Z" fill="currentColor"/>' +
|
|
12
|
+
'</svg>';
|
|
13
|
+
/** How long a copied state shows before it reverts, in milliseconds. */
|
|
14
|
+
const settle = 1500;
|
|
15
|
+
/**
|
|
16
|
+
* Enhances every document on a page. Safe to call once per page, after the document is parsed.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* Enhance.run(document)
|
|
20
|
+
*/
|
|
21
|
+
export function run(page) {
|
|
22
|
+
const view = page.defaultView;
|
|
23
|
+
if (!view)
|
|
24
|
+
return;
|
|
25
|
+
page.documentElement.classList.add('js');
|
|
26
|
+
const live = page.createElement('div');
|
|
27
|
+
live.className = 'sr-only';
|
|
28
|
+
live.setAttribute('aria-live', 'polite');
|
|
29
|
+
page.body.append(live);
|
|
30
|
+
const announce = (message) => {
|
|
31
|
+
live.textContent = message;
|
|
32
|
+
};
|
|
33
|
+
for (const doc of page.querySelectorAll('.doc')) {
|
|
34
|
+
notes(doc, view);
|
|
35
|
+
anchors(doc, view, announce);
|
|
36
|
+
code(doc, view, announce);
|
|
37
|
+
if (doc.hasAttribute('data-rail'))
|
|
38
|
+
rail(doc, view);
|
|
39
|
+
}
|
|
40
|
+
for (const nav of page.querySelectorAll('.summary nav'))
|
|
41
|
+
contents(nav, view);
|
|
42
|
+
for (const axis of page.querySelectorAll('ol.axis'))
|
|
43
|
+
place(axis, view);
|
|
44
|
+
}
|
|
45
|
+
/** Adds a copy-link anchor to each H2 and H3 that has an id, or gets one from its text. */
|
|
46
|
+
function anchors(doc, view, announce) {
|
|
47
|
+
const page = doc.ownerDocument;
|
|
48
|
+
for (const heading of doc.querySelectorAll(':scope > h2, :scope > h3')) {
|
|
49
|
+
if (heading.querySelector('.h-anchor'))
|
|
50
|
+
continue;
|
|
51
|
+
const name = (heading.textContent ?? '').trim();
|
|
52
|
+
heading.dataset['name'] = name;
|
|
53
|
+
if (!heading.id) {
|
|
54
|
+
const base = slug(name) || 'section';
|
|
55
|
+
let id = base;
|
|
56
|
+
for (let n = 2; page.getElementById(id); n++)
|
|
57
|
+
id = `${base}-${n}`;
|
|
58
|
+
heading.id = id;
|
|
59
|
+
}
|
|
60
|
+
const anchor = page.createElement('a');
|
|
61
|
+
anchor.className = 'h-anchor';
|
|
62
|
+
anchor.href = '#' + heading.id;
|
|
63
|
+
anchor.setAttribute('aria-label', 'Copy link to ' + name);
|
|
64
|
+
anchor.innerHTML = link + '<span class="tip" aria-hidden="true">Copy link</span>';
|
|
65
|
+
// The last word and the anchor never wrap apart.
|
|
66
|
+
const last = heading.lastChild;
|
|
67
|
+
const match = last?.nodeType === 3 ? /^([\s\S]*?)(\S+)\s*$/.exec(last.textContent ?? '') : null;
|
|
68
|
+
if (last && match) {
|
|
69
|
+
last.textContent = match[1] ?? '';
|
|
70
|
+
const tail = page.createElement('span');
|
|
71
|
+
tail.className = 'h-tail';
|
|
72
|
+
tail.append(match[2] ?? '', anchor);
|
|
73
|
+
heading.append(tail);
|
|
74
|
+
}
|
|
75
|
+
else
|
|
76
|
+
heading.append(anchor);
|
|
77
|
+
let timer;
|
|
78
|
+
const tip = anchor.querySelector('.tip');
|
|
79
|
+
anchor.addEventListener('click', (event) => {
|
|
80
|
+
const clipboard = view.navigator.clipboard;
|
|
81
|
+
if (!clipboard)
|
|
82
|
+
return;
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
const url = view.location.href.split('#')[0] + '#' + heading.id;
|
|
85
|
+
clipboard.writeText(url).then(() => {
|
|
86
|
+
view.history.replaceState(null, '', '#' + heading.id);
|
|
87
|
+
anchor.dataset['copied'] = '';
|
|
88
|
+
if (tip)
|
|
89
|
+
tip.textContent = 'Link copied';
|
|
90
|
+
announce('Link to ' + name + ' copied');
|
|
91
|
+
clearTimeout(timer);
|
|
92
|
+
timer = setTimeout(() => {
|
|
93
|
+
delete anchor.dataset['copied'];
|
|
94
|
+
if (tip)
|
|
95
|
+
tip.textContent = 'Copy link';
|
|
96
|
+
announce('');
|
|
97
|
+
}, settle);
|
|
98
|
+
}, () => {
|
|
99
|
+
view.location.hash = heading.id;
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** Wraps each code block with a copy button. */
|
|
105
|
+
function code(doc, view, announce) {
|
|
106
|
+
const page = doc.ownerDocument;
|
|
107
|
+
for (const pre of doc.querySelectorAll(':scope > pre')) {
|
|
108
|
+
const wrap = page.createElement('div');
|
|
109
|
+
wrap.className = [
|
|
110
|
+
'code-block',
|
|
111
|
+
...[...pre.classList].filter((name) => name.startsWith('l-')),
|
|
112
|
+
].join(' ');
|
|
113
|
+
pre.replaceWith(wrap);
|
|
114
|
+
wrap.append(pre);
|
|
115
|
+
const button = page.createElement('button');
|
|
116
|
+
button.type = 'button';
|
|
117
|
+
button.className = 'copy';
|
|
118
|
+
button.textContent = 'Copy';
|
|
119
|
+
button.setAttribute('aria-label', 'Copy code');
|
|
120
|
+
wrap.append(button);
|
|
121
|
+
let timer;
|
|
122
|
+
button.addEventListener('click', async () => {
|
|
123
|
+
const text = (pre.querySelector('code') ?? pre).textContent ?? '';
|
|
124
|
+
try {
|
|
125
|
+
await view.navigator.clipboard.writeText(text);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
button.textContent = 'Copied';
|
|
131
|
+
button.dataset['copied'] = '';
|
|
132
|
+
announce('Copied');
|
|
133
|
+
clearTimeout(timer);
|
|
134
|
+
timer = setTimeout(() => {
|
|
135
|
+
button.textContent = 'Copy';
|
|
136
|
+
delete button.dataset['copied'];
|
|
137
|
+
announce('');
|
|
138
|
+
}, settle);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/** Marks the Brief contents link of the section in view. */
|
|
143
|
+
function contents(nav, view) {
|
|
144
|
+
const page = nav.ownerDocument;
|
|
145
|
+
const links = [...nav.querySelectorAll('a[href^="#"]')];
|
|
146
|
+
const targets = links.flatMap((anchor) => {
|
|
147
|
+
const target = page.getElementById((anchor.getAttribute('href') ?? '').slice(1));
|
|
148
|
+
return target ? [target] : [];
|
|
149
|
+
});
|
|
150
|
+
if (targets.length === 0)
|
|
151
|
+
return;
|
|
152
|
+
const mark = () => {
|
|
153
|
+
let current = targets[0];
|
|
154
|
+
for (const target of targets)
|
|
155
|
+
if (target.getBoundingClientRect().top < view.innerHeight * 0.3)
|
|
156
|
+
current = target;
|
|
157
|
+
for (const anchor of links)
|
|
158
|
+
anchor.setAttribute('aria-current', String(anchor.getAttribute('href') === '#' + current?.id));
|
|
159
|
+
};
|
|
160
|
+
mark();
|
|
161
|
+
view.addEventListener('scroll', () => view.requestAnimationFrame(mark), { passive: true });
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Turns each `span.sn > small` into a numbered button with a popover, and lists the notes at the
|
|
165
|
+
* end. Escape closes the open note and returns focus to its button.
|
|
166
|
+
*/
|
|
167
|
+
function notes(doc, view) {
|
|
168
|
+
const page = doc.ownerDocument;
|
|
169
|
+
const items = [...doc.querySelectorAll('.sn')].flatMap((note) => {
|
|
170
|
+
const small = note.querySelector(':scope > small');
|
|
171
|
+
return small ? [{ note, small }] : [];
|
|
172
|
+
});
|
|
173
|
+
if (items.length === 0)
|
|
174
|
+
return;
|
|
175
|
+
let open;
|
|
176
|
+
const close = () => {
|
|
177
|
+
if (!open)
|
|
178
|
+
return;
|
|
179
|
+
open.note.classList.remove('open');
|
|
180
|
+
open.button.setAttribute('aria-expanded', 'false');
|
|
181
|
+
open = undefined;
|
|
182
|
+
};
|
|
183
|
+
const show = (note, button, small) => {
|
|
184
|
+
if (open && open.note !== note)
|
|
185
|
+
close();
|
|
186
|
+
note.classList.add('open');
|
|
187
|
+
button.setAttribute('aria-expanded', 'true');
|
|
188
|
+
open = { button, note };
|
|
189
|
+
// The open note is positioned against its containing block, which is the nearest positioned
|
|
190
|
+
// ancestor (the article.doc), so measure from that box.
|
|
191
|
+
const frame = (small.offsetParent ?? doc).getBoundingClientRect();
|
|
192
|
+
const anchor = button.getBoundingClientRect();
|
|
193
|
+
const width = Math.min(320, view.innerWidth - 40);
|
|
194
|
+
const x = Math.max(20 - frame.left, Math.min(anchor.left - frame.left - 16, view.innerWidth - 20 - width - frame.left));
|
|
195
|
+
note.style.setProperty('--pop-x', x + 'px');
|
|
196
|
+
note.style.setProperty('--pop-y', anchor.bottom - frame.top + 8 + 'px');
|
|
197
|
+
};
|
|
198
|
+
const list = page.createElement('ol');
|
|
199
|
+
items.forEach((item, index) => {
|
|
200
|
+
const { note, small } = item;
|
|
201
|
+
const number = String(index + 1);
|
|
202
|
+
small.id ||= 'note-' + number;
|
|
203
|
+
small.setAttribute('role', 'note');
|
|
204
|
+
const button = page.createElement('button');
|
|
205
|
+
button.type = 'button';
|
|
206
|
+
button.className = 'sn-ref';
|
|
207
|
+
button.textContent = number;
|
|
208
|
+
button.setAttribute('aria-label', 'Note ' + number);
|
|
209
|
+
button.setAttribute('aria-controls', small.id);
|
|
210
|
+
button.setAttribute('aria-expanded', 'false');
|
|
211
|
+
note.insertBefore(button, small);
|
|
212
|
+
button.addEventListener('click', (event) => {
|
|
213
|
+
event.stopPropagation();
|
|
214
|
+
if (note.classList.contains('open'))
|
|
215
|
+
close();
|
|
216
|
+
else
|
|
217
|
+
show(note, button, small);
|
|
218
|
+
});
|
|
219
|
+
let timer;
|
|
220
|
+
note.addEventListener('pointerenter', (event) => {
|
|
221
|
+
if (event.pointerType !== 'mouse')
|
|
222
|
+
return;
|
|
223
|
+
clearTimeout(timer);
|
|
224
|
+
timer = setTimeout(() => show(note, button, small), 300);
|
|
225
|
+
});
|
|
226
|
+
note.addEventListener('pointerleave', (event) => {
|
|
227
|
+
if (event.pointerType !== 'mouse')
|
|
228
|
+
return;
|
|
229
|
+
clearTimeout(timer);
|
|
230
|
+
timer = setTimeout(() => open?.note === note && close(), 160);
|
|
231
|
+
});
|
|
232
|
+
const listed = page.createElement('li');
|
|
233
|
+
listed.innerHTML = small.innerHTML;
|
|
234
|
+
list.append(listed);
|
|
235
|
+
});
|
|
236
|
+
page.addEventListener('click', (event) => {
|
|
237
|
+
if (open && !open.note.contains(event.target))
|
|
238
|
+
close();
|
|
239
|
+
});
|
|
240
|
+
page.addEventListener('keydown', (event) => {
|
|
241
|
+
if (event.key !== 'Escape' || !open)
|
|
242
|
+
return;
|
|
243
|
+
const { button, note } = open;
|
|
244
|
+
const inside = note.contains(page.activeElement);
|
|
245
|
+
close();
|
|
246
|
+
if (inside)
|
|
247
|
+
button.focus();
|
|
248
|
+
});
|
|
249
|
+
const section = page.createElement('section');
|
|
250
|
+
section.className = 'footnotes';
|
|
251
|
+
section.setAttribute('aria-label', 'Notes');
|
|
252
|
+
const heading = page.createElement('h2');
|
|
253
|
+
heading.textContent = 'Notes';
|
|
254
|
+
section.append(heading, list);
|
|
255
|
+
doc.append(section);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Lays an Axis timeline out horizontally at 768px and wider, in lanes so labels never overlap.
|
|
259
|
+
* Narrower, it stays a vertical list in date order.
|
|
260
|
+
*/
|
|
261
|
+
function place(axis, view) {
|
|
262
|
+
const page = axis.ownerDocument;
|
|
263
|
+
const items = [...axis.children];
|
|
264
|
+
const day = 864e5;
|
|
265
|
+
const start = Date.parse(axis.dataset['start'] ?? '');
|
|
266
|
+
const end = Date.parse(axis.dataset['end'] ?? '');
|
|
267
|
+
if (!Number.isFinite(start) || !Number.isFinite(end) || end <= start)
|
|
268
|
+
return;
|
|
269
|
+
const at = (time) => (time - start) / (end - start);
|
|
270
|
+
for (const item of items) {
|
|
271
|
+
const times = [...item.querySelectorAll('time')].map((time) => Date.parse(time.getAttribute('datetime') ?? ''));
|
|
272
|
+
const first = times[0] ?? start;
|
|
273
|
+
item.style.setProperty('--x', at(first).toFixed(4));
|
|
274
|
+
if (item.classList.contains('phase'))
|
|
275
|
+
item.style.setProperty('--w', (at(times[1] ?? first) - at(first)).toFixed(4));
|
|
276
|
+
}
|
|
277
|
+
// As a list, read in date order with each phase ahead of the events inside it.
|
|
278
|
+
items
|
|
279
|
+
.map((item, index) => ({
|
|
280
|
+
index,
|
|
281
|
+
item,
|
|
282
|
+
kind: item.classList.contains('phase') ? 0 : 1,
|
|
283
|
+
x: Number(item.style.getPropertyValue('--x')),
|
|
284
|
+
}))
|
|
285
|
+
.sort((a, b) => a.x - b.x || a.kind - b.kind || a.index - b.index)
|
|
286
|
+
.forEach((entry, order) => {
|
|
287
|
+
entry.item.style.order = String(order);
|
|
288
|
+
});
|
|
289
|
+
axis.style.display = 'flex';
|
|
290
|
+
axis.style.flexDirection = 'column';
|
|
291
|
+
const scale = page.createElement('div');
|
|
292
|
+
scale.className = 'axis-scale';
|
|
293
|
+
scale.setAttribute('aria-hidden', 'true');
|
|
294
|
+
const marks = [start];
|
|
295
|
+
for (let time = start + 7 * day; time < end - 3 * day; time += 7 * day)
|
|
296
|
+
marks.push(time);
|
|
297
|
+
marks.push(end);
|
|
298
|
+
for (const mark of marks) {
|
|
299
|
+
const span = page.createElement('span');
|
|
300
|
+
span.style.left = (at(mark) * 100).toFixed(2) + '%';
|
|
301
|
+
span.textContent = new Date(mark).toLocaleDateString('en-US', {
|
|
302
|
+
day: 'numeric',
|
|
303
|
+
month: 'short',
|
|
304
|
+
timeZone: 'UTC',
|
|
305
|
+
});
|
|
306
|
+
scale.append(span);
|
|
307
|
+
}
|
|
308
|
+
axis.after(scale);
|
|
309
|
+
const wide = view.matchMedia('(min-width: 768px)');
|
|
310
|
+
const lanes = () => {
|
|
311
|
+
if (!wide.matches) {
|
|
312
|
+
delete axis.dataset['placed'];
|
|
313
|
+
axis.style.display = 'flex';
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
axis.dataset['placed'] = '';
|
|
317
|
+
axis.style.removeProperty('display');
|
|
318
|
+
const width = axis.clientWidth;
|
|
319
|
+
const fill = (list, phase) => {
|
|
320
|
+
const ends = [];
|
|
321
|
+
const placed = [];
|
|
322
|
+
for (const item of list) {
|
|
323
|
+
delete item.dataset['flip'];
|
|
324
|
+
item.style.setProperty('--lane', '0');
|
|
325
|
+
const x = Number(item.style.getPropertyValue('--x')) * width;
|
|
326
|
+
const size = phase
|
|
327
|
+
? Math.max(item.scrollWidth, Number(item.style.getPropertyValue('--w')) * width)
|
|
328
|
+
: item.scrollWidth;
|
|
329
|
+
let left = x;
|
|
330
|
+
let right = x + size;
|
|
331
|
+
if (!phase && right > width) {
|
|
332
|
+
item.dataset['flip'] = '';
|
|
333
|
+
left = x - size;
|
|
334
|
+
right = x;
|
|
335
|
+
}
|
|
336
|
+
let lane;
|
|
337
|
+
if (phase) {
|
|
338
|
+
lane = ends.findIndex((edge) => edge < left - 12);
|
|
339
|
+
if (lane < 0)
|
|
340
|
+
lane = ends.push(0) - 1;
|
|
341
|
+
ends[lane] = right;
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
const crossed = (depth) => placed.some((other) => other.lane > depth && other.x >= left - 4 && other.x <= right + 4);
|
|
345
|
+
lane = ends.findIndex((edge, depth) => edge > right + 12 && !crossed(depth));
|
|
346
|
+
if (lane < 0)
|
|
347
|
+
lane = ends.push(0) - 1;
|
|
348
|
+
ends[lane] = left;
|
|
349
|
+
placed.push({ lane, x: 'flip' in item.dataset ? right : left });
|
|
350
|
+
}
|
|
351
|
+
item.style.setProperty('--lane', String(lane));
|
|
352
|
+
}
|
|
353
|
+
return Math.max(1, ends.length);
|
|
354
|
+
};
|
|
355
|
+
const phases = items.filter((item) => item.classList.contains('phase'));
|
|
356
|
+
// Events right to left, so a leader line never crosses a label in a shallower lane.
|
|
357
|
+
const events = items
|
|
358
|
+
.filter((item) => !item.classList.contains('phase') && !item.classList.contains('minor'))
|
|
359
|
+
.reverse();
|
|
360
|
+
axis.style.setProperty('--phase-lanes', String(fill(phases, true)));
|
|
361
|
+
axis.style.setProperty('--event-lanes', String(fill(events, false)));
|
|
362
|
+
};
|
|
363
|
+
lanes();
|
|
364
|
+
wide.addEventListener('change', lanes);
|
|
365
|
+
view.addEventListener('resize', lanes);
|
|
366
|
+
void page.fonts?.ready.then(lanes);
|
|
367
|
+
}
|
|
368
|
+
/** Adds Essay's reading rail: progress through the page, with a tick for each section. */
|
|
369
|
+
function rail(doc, view) {
|
|
370
|
+
const page = doc.ownerDocument;
|
|
371
|
+
const headings = [...doc.querySelectorAll(':scope > h2[id]')];
|
|
372
|
+
const nav = page.createElement('nav');
|
|
373
|
+
nav.className = 'rail';
|
|
374
|
+
nav.setAttribute('aria-label', 'Reading progress');
|
|
375
|
+
nav.innerHTML = '<div class="rail-track"></div><div class="rail-fill"></div>';
|
|
376
|
+
const ticks = headings.map((heading) => {
|
|
377
|
+
const anchor = page.createElement('a');
|
|
378
|
+
const name = heading.dataset['name'] ?? heading.textContent ?? '';
|
|
379
|
+
anchor.href = '#' + heading.id;
|
|
380
|
+
anchor.setAttribute('aria-label', 'Go to ' + name);
|
|
381
|
+
const label = page.createElement('span');
|
|
382
|
+
label.textContent = name;
|
|
383
|
+
anchor.append(label);
|
|
384
|
+
nav.append(anchor);
|
|
385
|
+
return anchor;
|
|
386
|
+
});
|
|
387
|
+
page.body.append(nav);
|
|
388
|
+
const header = doc.querySelector('header');
|
|
389
|
+
let span = 1;
|
|
390
|
+
const measure = () => {
|
|
391
|
+
span = Math.max(1, page.documentElement.scrollHeight - view.innerHeight);
|
|
392
|
+
headings.forEach((heading, index) => {
|
|
393
|
+
const y = heading.getBoundingClientRect().top + view.scrollY - view.innerHeight * 0.25;
|
|
394
|
+
ticks[index]?.style.setProperty('--at', Math.min(1, Math.max(0, y / span)).toFixed(4));
|
|
395
|
+
});
|
|
396
|
+
};
|
|
397
|
+
const update = () => {
|
|
398
|
+
nav.style.setProperty('--p', Math.min(1, Math.max(0, view.scrollY / span)).toFixed(4));
|
|
399
|
+
const started = header ? header.getBoundingClientRect().bottom < 80 : view.scrollY > 200;
|
|
400
|
+
nav.toggleAttribute('data-on', started);
|
|
401
|
+
};
|
|
402
|
+
measure();
|
|
403
|
+
update();
|
|
404
|
+
view.addEventListener('scroll', () => view.requestAnimationFrame(update), { passive: true });
|
|
405
|
+
view.addEventListener('resize', () => {
|
|
406
|
+
measure();
|
|
407
|
+
update();
|
|
408
|
+
});
|
|
409
|
+
void page.fonts?.ready.then(() => {
|
|
410
|
+
measure();
|
|
411
|
+
update();
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
/** Returns a URL fragment for a heading's text. */
|
|
415
|
+
function slug(text) {
|
|
416
|
+
return text
|
|
417
|
+
.toLowerCase()
|
|
418
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
419
|
+
.replace(/^-|-$/g, '');
|
|
420
|
+
}
|
|
421
|
+
//# sourceMappingURL=Enhance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Enhance.js","sourceRoot":"","sources":["../../src/document/Enhance.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wGAAwG;AACxG,2CAA2C;AAC3C,MAAM,IAAI,GACR,0DAA0D;IAC1D,2xCAA2xC;IAC3xC,4QAA4Q;IAC5Q,ixCAAixC;IACjxC,QAAQ,CAAA;AAEV,wEAAwE;AACxE,MAAM,MAAM,GAAG,IAAI,CAAA;AAEnB;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CAAC,IAAc;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAA;IAC7B,IAAI,CAAC,IAAI;QAAE,OAAM;IAEjB,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACxC,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IACtC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC1B,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;IACxC,IAAI,C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AAK,CAAC,IAAI,CAAC,GAAG,EAAE;QAC/B,OAAO,EAAE,CAAA;QACT,MAAM,EAAE,CAAA;IACV,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,mDAAmD;AACnD,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,IAAI;SACR,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/document/bin.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/** The `tempo-document` executable, which runs the document command line on the filesystem. @module */
|
|
3
|
+
import * as Fs from 'node:fs/promises';
|
|
4
|
+
import * as Cli from './internal/Cli.js';
|
|
5
|
+
// The bin sits at `dist/document` when installed and at `src/document` when linked for development.
|
|
6
|
+
const manifest = JSON.parse(await Fs.readFile(new URL('../../package.json', import.meta.url), 'utf8'));
|
|
7
|
+
const result = await Cli.run({
|
|
8
|
+
args: process.argv.slice(2),
|
|
9
|
+
files: {
|
|
10
|
+
async create(path, text) {
|
|
11
|
+
try {
|
|
12
|
+
await Fs.writeFile(path, text, { flag: 'wx' });
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
if (error.code === 'EEXIST')
|
|
17
|
+
return false;
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
async read(path) {
|
|
22
|
+
try {
|
|
23
|
+
return await Fs.readFile(path, 'utf8');
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (error.code === 'ENOENT')
|
|
27
|
+
return undefined;
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
template: (name) => Fs.readFile(new URL(`./templates/${name}.html`, import.meta.url), 'utf8'),
|
|
32
|
+
},
|
|
33
|
+
version: manifest.version,
|
|
34
|
+
});
|
|
35
|
+
process.stdout.write(result.stdout);
|
|
36
|
+
process.stderr.write(result.stderr);
|
|
37
|
+
process.exitCode = result.code;
|
|
38
|
+
//# sourceMappingURL=bin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/document/bin.ts"],"names":[],"mappings":";AACA,uGAAuG;AACvG,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAA;AAExC,oGAAoG;AACpG,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,oBAAoB,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CACnD,CAAA;AAExB,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3B,KAAK,EAAE;QACL,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI;YACrB,IAAI,CAAC;gBACH,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;gBAC9C,OAAO,IAAI,CAAA;YACb,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;oBAAE,OAAO,KAAK,CAAA;gBACpE,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAI;YACb,IAAI,CAAC;gBACH,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;YACxC,CAAC;YAAC,OAAO,KAAK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