@tempoxyz/ds 0.3.16 → 0.3.18
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 +248 -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 +511 -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 +388 -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 +452 -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 +532 -0
- package/src/document/bin.ts +38 -0
- package/src/document/document.css +388 -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,511 @@
|
|
|
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
|
+
// The summary of a Brief is a sibling of its article, and its notes join the article's notes.
|
|
35
|
+
const summary = doc.closest('.brief')?.querySelector(':scope > .summary');
|
|
36
|
+
notes(doc, view, summary ?? undefined);
|
|
37
|
+
anchors(doc, view, announce);
|
|
38
|
+
code(doc, view, announce);
|
|
39
|
+
if (doc.hasAttribute('data-rail'))
|
|
40
|
+
rail(doc, view);
|
|
41
|
+
}
|
|
42
|
+
for (const nav of page.querySelectorAll('.summary nav'))
|
|
43
|
+
contents(nav, view);
|
|
44
|
+
for (const axis of page.querySelectorAll('ol.axis'))
|
|
45
|
+
place(axis, view);
|
|
46
|
+
}
|
|
47
|
+
/** Adds a copy-link anchor to each H2 and H3 that has an id, or gets one from its text. */
|
|
48
|
+
function anchors(doc, view, announce) {
|
|
49
|
+
const page = doc.ownerDocument;
|
|
50
|
+
for (const heading of doc.querySelectorAll(':scope > h2, :scope > h3')) {
|
|
51
|
+
if (heading.querySelector('.h-anchor'))
|
|
52
|
+
continue;
|
|
53
|
+
const name = (heading.textContent ?? '').trim();
|
|
54
|
+
heading.dataset['name'] = name;
|
|
55
|
+
if (!heading.id) {
|
|
56
|
+
const base = slug(name) || 'section';
|
|
57
|
+
let id = base;
|
|
58
|
+
for (let n = 2; page.getElementById(id); n++)
|
|
59
|
+
id = `${base}-${n}`;
|
|
60
|
+
heading.id = id;
|
|
61
|
+
}
|
|
62
|
+
const anchor = page.createElement('a');
|
|
63
|
+
anchor.className = 'h-anchor';
|
|
64
|
+
anchor.href = '#' + heading.id;
|
|
65
|
+
anchor.setAttribute('aria-label', 'Copy link to ' + name);
|
|
66
|
+
anchor.innerHTML = link + '<span class="tip" aria-hidden="true">Copy link</span>';
|
|
67
|
+
// The last word and the anchor never wrap apart.
|
|
68
|
+
const last = heading.lastChild;
|
|
69
|
+
const match = last?.nodeType === 3 ? /^([\s\S]*?)(\S+)\s*$/.exec(last.textContent ?? '') : null;
|
|
70
|
+
if (last && match) {
|
|
71
|
+
last.textContent = match[1] ?? '';
|
|
72
|
+
const tail = page.createElement('span');
|
|
73
|
+
tail.className = 'h-tail';
|
|
74
|
+
tail.append(match[2] ?? '', anchor);
|
|
75
|
+
heading.append(tail);
|
|
76
|
+
}
|
|
77
|
+
else
|
|
78
|
+
heading.append(anchor);
|
|
79
|
+
let timer;
|
|
80
|
+
const tip = anchor.querySelector('.tip');
|
|
81
|
+
anchor.addEventListener('click', (event) => {
|
|
82
|
+
const clipboard = view.navigator.clipboard;
|
|
83
|
+
if (!clipboard)
|
|
84
|
+
return;
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
const url = view.location.href.split('#')[0] + '#' + heading.id;
|
|
87
|
+
clipboard.writeText(url).then(() => {
|
|
88
|
+
view.history.replaceState(null, '', '#' + heading.id);
|
|
89
|
+
anchor.dataset['copied'] = '';
|
|
90
|
+
if (tip)
|
|
91
|
+
tip.textContent = 'Link copied';
|
|
92
|
+
announce('Link to ' + name + ' copied');
|
|
93
|
+
clearTimeout(timer);
|
|
94
|
+
timer = setTimeout(() => {
|
|
95
|
+
delete anchor.dataset['copied'];
|
|
96
|
+
if (tip)
|
|
97
|
+
tip.textContent = 'Copy link';
|
|
98
|
+
announce('');
|
|
99
|
+
}, settle);
|
|
100
|
+
}, () => {
|
|
101
|
+
view.location.hash = heading.id;
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** Wraps each code block with a copy button. */
|
|
107
|
+
function code(doc, view, announce) {
|
|
108
|
+
const page = doc.ownerDocument;
|
|
109
|
+
for (const pre of doc.querySelectorAll(':scope > pre')) {
|
|
110
|
+
const wrap = page.createElement('div');
|
|
111
|
+
wrap.className = [
|
|
112
|
+
'code-block',
|
|
113
|
+
...[...pre.classList].filter((name) => name.startsWith('l-')),
|
|
114
|
+
].join(' ');
|
|
115
|
+
pre.replaceWith(wrap);
|
|
116
|
+
wrap.append(pre);
|
|
117
|
+
const button = page.createElement('button');
|
|
118
|
+
button.type = 'button';
|
|
119
|
+
button.className = 'copy';
|
|
120
|
+
button.textContent = 'Copy';
|
|
121
|
+
button.setAttribute('aria-label', 'Copy code');
|
|
122
|
+
wrap.append(button);
|
|
123
|
+
let timer;
|
|
124
|
+
button.addEventListener('click', async () => {
|
|
125
|
+
const text = (pre.querySelector('code') ?? pre).textContent ?? '';
|
|
126
|
+
try {
|
|
127
|
+
await view.navigator.clipboard.writeText(text);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
button.textContent = 'Copied';
|
|
133
|
+
button.dataset['copied'] = '';
|
|
134
|
+
announce('Copied');
|
|
135
|
+
clearTimeout(timer);
|
|
136
|
+
timer = setTimeout(() => {
|
|
137
|
+
button.textContent = 'Copy';
|
|
138
|
+
delete button.dataset['copied'];
|
|
139
|
+
announce('');
|
|
140
|
+
}, settle);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Marks the Brief contents link of the section in view: the last one whose heading reached the
|
|
146
|
+
* line where a followed link puts it. A followed link marks its own section while that heading
|
|
147
|
+
* stays on screen, so a section too short to reach the line is marked as well.
|
|
148
|
+
*/
|
|
149
|
+
function contents(nav, view) {
|
|
150
|
+
const page = nav.ownerDocument;
|
|
151
|
+
const links = [...nav.querySelectorAll('a[href^="#"]')];
|
|
152
|
+
const targets = links.flatMap((anchor) => {
|
|
153
|
+
const target = page.getElementById((anchor.getAttribute('href') ?? '').slice(1));
|
|
154
|
+
return target ? [target] : [];
|
|
155
|
+
});
|
|
156
|
+
if (targets.length === 0)
|
|
157
|
+
return;
|
|
158
|
+
const root = page.documentElement;
|
|
159
|
+
// The address holds a fragment percent-encoded, and an id holds it as written.
|
|
160
|
+
const fragment = () => (() => {
|
|
161
|
+
const hash = view.location.hash.slice(1);
|
|
162
|
+
try {
|
|
163
|
+
return decodeURIComponent(hash);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return hash;
|
|
167
|
+
}
|
|
168
|
+
})();
|
|
169
|
+
let chosen;
|
|
170
|
+
const mark = () => {
|
|
171
|
+
// A followed link stops its heading below the scroll padding of the page and the scroll
|
|
172
|
+
// margin of the heading. The 4px covers fractional scroll positions.
|
|
173
|
+
const padding = Number.parseFloat(view.getComputedStyle(root).scrollPaddingTop) || 0;
|
|
174
|
+
let reading = 0;
|
|
175
|
+
targets.forEach((target, index) => {
|
|
176
|
+
const margin = Number.parseFloat(view.getComputedStyle(target).scrollMarginTop) || 0;
|
|
177
|
+
if (target.getBoundingClientRect().top <= padding + margin + 4)
|
|
178
|
+
reading = index;
|
|
179
|
+
});
|
|
180
|
+
// At the end of the page the last heading may never reach the line.
|
|
181
|
+
const end = view.scrollY > 0 && view.scrollY + view.innerHeight >= root.scrollHeight - 2;
|
|
182
|
+
if (chosen) {
|
|
183
|
+
const top = targets[chosen.index]?.getBoundingClientRect().top ?? -1;
|
|
184
|
+
const visible = top >= 0 && top < view.innerHeight;
|
|
185
|
+
chosen.arrived ||= visible;
|
|
186
|
+
// The choice ends when the reading position agrees with it, or when its heading leaves the
|
|
187
|
+
// screen or a later heading reaches the line. The heading starts off screen for a far link.
|
|
188
|
+
const agrees = reading === chosen.index && !end;
|
|
189
|
+
const left = chosen.arrived && (!visible || reading > chosen.index);
|
|
190
|
+
if (agrees || left)
|
|
191
|
+
chosen = undefined;
|
|
192
|
+
}
|
|
193
|
+
const current = targets[chosen?.index ?? (end ? targets.length - 1 : reading)];
|
|
194
|
+
for (const anchor of links)
|
|
195
|
+
anchor.setAttribute('aria-current', String(anchor.getAttribute('href') === '#' + current?.id));
|
|
196
|
+
};
|
|
197
|
+
const choose = (id) => {
|
|
198
|
+
const index = targets.findIndex((target) => target.id === id);
|
|
199
|
+
chosen = index < 0 ? undefined : { arrived: false, index };
|
|
200
|
+
mark();
|
|
201
|
+
};
|
|
202
|
+
// A choice whose heading is not on screen once the page is at rest went somewhere else.
|
|
203
|
+
const settle = () => {
|
|
204
|
+
mark();
|
|
205
|
+
if (chosen && !chosen.arrived)
|
|
206
|
+
chosen = undefined;
|
|
207
|
+
mark();
|
|
208
|
+
};
|
|
209
|
+
// Only a plain click scrolls this page. A click with a modifier opens the link somewhere else.
|
|
210
|
+
for (const anchor of links)
|
|
211
|
+
anchor.addEventListener('click', (event) => {
|
|
212
|
+
const modified = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
|
|
213
|
+
if (event.button !== 0 || modified || event.defaultPrevented)
|
|
214
|
+
return;
|
|
215
|
+
choose((anchor.getAttribute('href') ?? '').slice(1));
|
|
216
|
+
});
|
|
217
|
+
// The address also changes on Back and Forward, after the page scrolls. The event of a followed
|
|
218
|
+
// link is late, and its choice may have ended by then.
|
|
219
|
+
view.addEventListener('hashchange', () => {
|
|
220
|
+
const id = fragment();
|
|
221
|
+
if (targets[chosen?.index ?? -1]?.id === id)
|
|
222
|
+
return;
|
|
223
|
+
choose(id);
|
|
224
|
+
settle();
|
|
225
|
+
});
|
|
226
|
+
view.addEventListener('scroll', () => view.requestAnimationFrame(mark), { passive: true });
|
|
227
|
+
view.addEventListener('scrollend', settle);
|
|
228
|
+
// The browser may scroll to the fragment of the address after this script runs.
|
|
229
|
+
choose(fragment());
|
|
230
|
+
if (page.readyState === 'complete')
|
|
231
|
+
settle();
|
|
232
|
+
else
|
|
233
|
+
view.addEventListener('load', settle, { once: true });
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Turns each `span.sn > small` into a numbered button with a popover, and lists the notes at the
|
|
237
|
+
* end. Escape closes the open note and returns focus to its button. The notes of a Brief summary
|
|
238
|
+
* take the first numbers, since the summary is at the top of the page.
|
|
239
|
+
*/
|
|
240
|
+
function notes(doc, view, summary) {
|
|
241
|
+
const page = doc.ownerDocument;
|
|
242
|
+
const roots = summary ? [summary, doc] : [doc];
|
|
243
|
+
const items = roots
|
|
244
|
+
.flatMap((root) => [...root.querySelectorAll('.sn')])
|
|
245
|
+
.flatMap((note) => {
|
|
246
|
+
const small = note.querySelector(':scope > small');
|
|
247
|
+
return small ? [{ note, small }] : [];
|
|
248
|
+
});
|
|
249
|
+
if (items.length === 0)
|
|
250
|
+
return;
|
|
251
|
+
let open;
|
|
252
|
+
const close = () => {
|
|
253
|
+
if (!open)
|
|
254
|
+
return;
|
|
255
|
+
open.note.classList.remove('open');
|
|
256
|
+
open.button.setAttribute('aria-expanded', 'false');
|
|
257
|
+
open = undefined;
|
|
258
|
+
};
|
|
259
|
+
const place = (note, button, small) => {
|
|
260
|
+
// The open note is positioned against its containing block: the nearest positioned ancestor
|
|
261
|
+
// (the article.doc), or the window for a note in the sticky summary. That note is fixed, so
|
|
262
|
+
// the scroll box of the summary does not clip it.
|
|
263
|
+
const fixed = view.getComputedStyle(small).position === 'fixed';
|
|
264
|
+
const frame = fixed ? { left: 0, top: 0 } : (small.offsetParent ?? doc).getBoundingClientRect();
|
|
265
|
+
const anchor = button.getBoundingClientRect();
|
|
266
|
+
const width = Math.min(320, view.innerWidth - 40);
|
|
267
|
+
const x = Math.max(20 - frame.left, Math.min(anchor.left - frame.left - 16, view.innerWidth - 20 - width - frame.left));
|
|
268
|
+
// A fixed note does not scroll into view, so it opens above its number when the window has
|
|
269
|
+
// no room below.
|
|
270
|
+
const below = anchor.bottom + 8;
|
|
271
|
+
const above = Math.max(8, anchor.top - 8 - small.offsetHeight);
|
|
272
|
+
const y = fixed && below + small.offsetHeight > view.innerHeight - 8 ? above : below;
|
|
273
|
+
note.style.setProperty('--pop-x', x + 'px');
|
|
274
|
+
note.style.setProperty('--pop-y', y - frame.top + 'px');
|
|
275
|
+
};
|
|
276
|
+
const show = (note, button, small) => {
|
|
277
|
+
if (open && open.note !== note)
|
|
278
|
+
close();
|
|
279
|
+
note.classList.add('open');
|
|
280
|
+
button.setAttribute('aria-expanded', 'true');
|
|
281
|
+
open = { button, note, small };
|
|
282
|
+
place(note, button, small);
|
|
283
|
+
};
|
|
284
|
+
const list = page.createElement('ol');
|
|
285
|
+
items.forEach((item, index) => {
|
|
286
|
+
const { note, small } = item;
|
|
287
|
+
const number = String(index + 1);
|
|
288
|
+
small.id ||= 'note-' + number;
|
|
289
|
+
small.setAttribute('role', 'note');
|
|
290
|
+
small.dataset['note'] = number;
|
|
291
|
+
const button = page.createElement('button');
|
|
292
|
+
button.type = 'button';
|
|
293
|
+
button.className = 'sn-ref';
|
|
294
|
+
button.textContent = number;
|
|
295
|
+
button.setAttribute('aria-label', 'Note ' + number);
|
|
296
|
+
button.setAttribute('aria-controls', small.id);
|
|
297
|
+
button.setAttribute('aria-expanded', 'false');
|
|
298
|
+
note.insertBefore(button, small);
|
|
299
|
+
button.addEventListener('click', (event) => {
|
|
300
|
+
event.stopPropagation();
|
|
301
|
+
if (note.classList.contains('open'))
|
|
302
|
+
close();
|
|
303
|
+
else
|
|
304
|
+
show(note, button, small);
|
|
305
|
+
});
|
|
306
|
+
let timer;
|
|
307
|
+
note.addEventListener('pointerenter', (event) => {
|
|
308
|
+
if (event.pointerType !== 'mouse')
|
|
309
|
+
return;
|
|
310
|
+
clearTimeout(timer);
|
|
311
|
+
timer = setTimeout(() => show(note, button, small), 300);
|
|
312
|
+
});
|
|
313
|
+
note.addEventListener('pointerleave', (event) => {
|
|
314
|
+
if (event.pointerType !== 'mouse')
|
|
315
|
+
return;
|
|
316
|
+
clearTimeout(timer);
|
|
317
|
+
timer = setTimeout(() => open?.note === note && close(), 160);
|
|
318
|
+
});
|
|
319
|
+
const listed = page.createElement('li');
|
|
320
|
+
listed.innerHTML = small.innerHTML;
|
|
321
|
+
list.append(listed);
|
|
322
|
+
});
|
|
323
|
+
page.addEventListener('click', (event) => {
|
|
324
|
+
if (open && !open.note.contains(event.target))
|
|
325
|
+
close();
|
|
326
|
+
});
|
|
327
|
+
// A fixed note does not move with its number, so place it again when anything scrolls.
|
|
328
|
+
if (summary)
|
|
329
|
+
view.addEventListener('scroll', () => view.requestAnimationFrame(() => open && place(open.note, open.button, open.small)), { capture: true, passive: true });
|
|
330
|
+
page.addEventListener('keydown', (event) => {
|
|
331
|
+
if (event.key !== 'Escape' || !open)
|
|
332
|
+
return;
|
|
333
|
+
const { button, note } = open;
|
|
334
|
+
const inside = note.contains(page.activeElement);
|
|
335
|
+
close();
|
|
336
|
+
if (inside)
|
|
337
|
+
button.focus();
|
|
338
|
+
});
|
|
339
|
+
const section = page.createElement('section');
|
|
340
|
+
section.className = 'footnotes';
|
|
341
|
+
section.setAttribute('aria-label', 'Notes');
|
|
342
|
+
const heading = page.createElement('h2');
|
|
343
|
+
heading.textContent = 'Notes';
|
|
344
|
+
section.append(heading, list);
|
|
345
|
+
doc.append(section);
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Lays an Axis timeline out horizontally at 768px and wider, in lanes so labels never overlap.
|
|
349
|
+
* Narrower, it stays a vertical list in date order.
|
|
350
|
+
*/
|
|
351
|
+
function place(axis, view) {
|
|
352
|
+
const page = axis.ownerDocument;
|
|
353
|
+
const items = [...axis.children];
|
|
354
|
+
const day = 864e5;
|
|
355
|
+
const start = Date.parse(axis.dataset['start'] ?? '');
|
|
356
|
+
const end = Date.parse(axis.dataset['end'] ?? '');
|
|
357
|
+
if (!Number.isFinite(start) || !Number.isFinite(end) || end <= start)
|
|
358
|
+
return;
|
|
359
|
+
const at = (time) => (time - start) / (end - start);
|
|
360
|
+
for (const item of items) {
|
|
361
|
+
const times = [...item.querySelectorAll('time')].map((time) => Date.parse(time.getAttribute('datetime') ?? ''));
|
|
362
|
+
const first = times[0] ?? start;
|
|
363
|
+
item.style.setProperty('--x', at(first).toFixed(4));
|
|
364
|
+
if (item.classList.contains('phase'))
|
|
365
|
+
item.style.setProperty('--w', (at(times[1] ?? first) - at(first)).toFixed(4));
|
|
366
|
+
}
|
|
367
|
+
// As a list, read in date order with each phase ahead of the events inside it.
|
|
368
|
+
items
|
|
369
|
+
.map((item, index) => ({
|
|
370
|
+
index,
|
|
371
|
+
item,
|
|
372
|
+
kind: item.classList.contains('phase') ? 0 : 1,
|
|
373
|
+
x: Number(item.style.getPropertyValue('--x')),
|
|
374
|
+
}))
|
|
375
|
+
.sort((a, b) => a.x - b.x || a.kind - b.kind || a.index - b.index)
|
|
376
|
+
.forEach((entry, order) => {
|
|
377
|
+
entry.item.style.order = String(order);
|
|
378
|
+
});
|
|
379
|
+
axis.style.display = 'flex';
|
|
380
|
+
axis.style.flexDirection = 'column';
|
|
381
|
+
const scale = page.createElement('div');
|
|
382
|
+
scale.className = 'axis-scale';
|
|
383
|
+
scale.setAttribute('aria-hidden', 'true');
|
|
384
|
+
const marks = [start];
|
|
385
|
+
for (let time = start + 7 * day; time < end - 3 * day; time += 7 * day)
|
|
386
|
+
marks.push(time);
|
|
387
|
+
marks.push(end);
|
|
388
|
+
for (const mark of marks) {
|
|
389
|
+
const span = page.createElement('span');
|
|
390
|
+
span.style.left = (at(mark) * 100).toFixed(2) + '%';
|
|
391
|
+
span.textContent = new Date(mark).toLocaleDateString('en-US', {
|
|
392
|
+
day: 'numeric',
|
|
393
|
+
month: 'short',
|
|
394
|
+
timeZone: 'UTC',
|
|
395
|
+
});
|
|
396
|
+
scale.append(span);
|
|
397
|
+
}
|
|
398
|
+
axis.after(scale);
|
|
399
|
+
const wide = view.matchMedia('(min-width: 768px)');
|
|
400
|
+
const lanes = () => {
|
|
401
|
+
if (!wide.matches) {
|
|
402
|
+
delete axis.dataset['placed'];
|
|
403
|
+
axis.style.display = 'flex';
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
axis.dataset['placed'] = '';
|
|
407
|
+
axis.style.removeProperty('display');
|
|
408
|
+
const width = axis.clientWidth;
|
|
409
|
+
const fill = (list, phase) => {
|
|
410
|
+
const ends = [];
|
|
411
|
+
const placed = [];
|
|
412
|
+
for (const item of list) {
|
|
413
|
+
delete item.dataset['flip'];
|
|
414
|
+
item.style.setProperty('--lane', '0');
|
|
415
|
+
const x = Number(item.style.getPropertyValue('--x')) * width;
|
|
416
|
+
const size = phase
|
|
417
|
+
? Math.max(item.scrollWidth, Number(item.style.getPropertyValue('--w')) * width)
|
|
418
|
+
: item.scrollWidth;
|
|
419
|
+
let left = x;
|
|
420
|
+
let right = x + size;
|
|
421
|
+
if (!phase && right > width) {
|
|
422
|
+
item.dataset['flip'] = '';
|
|
423
|
+
left = x - size;
|
|
424
|
+
right = x;
|
|
425
|
+
}
|
|
426
|
+
let lane;
|
|
427
|
+
if (phase) {
|
|
428
|
+
lane = ends.findIndex((edge) => edge < left - 12);
|
|
429
|
+
if (lane < 0)
|
|
430
|
+
lane = ends.push(0) - 1;
|
|
431
|
+
ends[lane] = right;
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
const crossed = (depth) => placed.some((other) => other.lane > depth && other.x >= left - 4 && other.x <= right + 4);
|
|
435
|
+
lane = ends.findIndex((edge, depth) => edge > right + 12 && !crossed(depth));
|
|
436
|
+
if (lane < 0)
|
|
437
|
+
lane = ends.push(0) - 1;
|
|
438
|
+
ends[lane] = left;
|
|
439
|
+
placed.push({ lane, x: 'flip' in item.dataset ? right : left });
|
|
440
|
+
}
|
|
441
|
+
item.style.setProperty('--lane', String(lane));
|
|
442
|
+
}
|
|
443
|
+
return Math.max(1, ends.length);
|
|
444
|
+
};
|
|
445
|
+
const phases = items.filter((item) => item.classList.contains('phase'));
|
|
446
|
+
// Events right to left, so a leader line never crosses a label in a shallower lane.
|
|
447
|
+
const events = items
|
|
448
|
+
.filter((item) => !item.classList.contains('phase') && !item.classList.contains('minor'))
|
|
449
|
+
.reverse();
|
|
450
|
+
axis.style.setProperty('--phase-lanes', String(fill(phases, true)));
|
|
451
|
+
axis.style.setProperty('--event-lanes', String(fill(events, false)));
|
|
452
|
+
};
|
|
453
|
+
lanes();
|
|
454
|
+
wide.addEventListener('change', lanes);
|
|
455
|
+
view.addEventListener('resize', lanes);
|
|
456
|
+
void page.fonts?.ready.then(lanes);
|
|
457
|
+
}
|
|
458
|
+
/** Adds Essay's reading rail: progress through the page, with a tick for each section. */
|
|
459
|
+
function rail(doc, view) {
|
|
460
|
+
const page = doc.ownerDocument;
|
|
461
|
+
const headings = [...doc.querySelectorAll(':scope > h2[id]')];
|
|
462
|
+
const nav = page.createElement('nav');
|
|
463
|
+
nav.className = 'rail';
|
|
464
|
+
nav.setAttribute('aria-label', 'Reading progress');
|
|
465
|
+
nav.innerHTML = '<div class="rail-track"></div><div class="rail-fill"></div>';
|
|
466
|
+
const ticks = headings.map((heading) => {
|
|
467
|
+
const anchor = page.createElement('a');
|
|
468
|
+
const name = heading.dataset['name'] ?? heading.textContent ?? '';
|
|
469
|
+
anchor.href = '#' + heading.id;
|
|
470
|
+
anchor.setAttribute('aria-label', 'Go to ' + name);
|
|
471
|
+
const label = page.createElement('span');
|
|
472
|
+
label.textContent = name;
|
|
473
|
+
anchor.append(label);
|
|
474
|
+
nav.append(anchor);
|
|
475
|
+
return anchor;
|
|
476
|
+
});
|
|
477
|
+
page.body.append(nav);
|
|
478
|
+
const header = doc.querySelector('header');
|
|
479
|
+
let span = 1;
|
|
480
|
+
const measure = () => {
|
|
481
|
+
span = Math.max(1, page.documentElement.scrollHeight - view.innerHeight);
|
|
482
|
+
headings.forEach((heading, index) => {
|
|
483
|
+
const y = heading.getBoundingClientRect().top + view.scrollY - view.innerHeight * 0.25;
|
|
484
|
+
ticks[index]?.style.setProperty('--at', Math.min(1, Math.max(0, y / span)).toFixed(4));
|
|
485
|
+
});
|
|
486
|
+
};
|
|
487
|
+
const update = () => {
|
|
488
|
+
nav.style.setProperty('--p', Math.min(1, Math.max(0, view.scrollY / span)).toFixed(4));
|
|
489
|
+
const started = header ? header.getBoundingClientRect().bottom < 80 : view.scrollY > 200;
|
|
490
|
+
nav.toggleAttribute('data-on', started);
|
|
491
|
+
};
|
|
492
|
+
measure();
|
|
493
|
+
update();
|
|
494
|
+
view.addEventListener('scroll', () => view.requestAnimationFrame(update), { passive: true });
|
|
495
|
+
view.addEventListener('resize', () => {
|
|
496
|
+
measure();
|
|
497
|
+
update();
|
|
498
|
+
});
|
|
499
|
+
void page.fonts?.ready.then(() => {
|
|
500
|
+
measure();
|
|
501
|
+
update();
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
/** Returns a URL fragment for a heading's text. */
|
|
505
|
+
function slug(text) {
|
|
506
|
+
return text
|
|
507
|
+
.toLowerCase()
|
|
508
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
509
|
+
.replace(/^-|-$/g, '');
|
|
510
|
+
}
|
|
511
|
+
//# 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,wEAA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,QAAQ,EAAE,GAAG,EAAE;QACnC,OAAO,EAAE,CAAA;QACT,MAAM,EAAE,CAAA;IACV,CAAC,CAAC,CAAA;IACF,KAAK,IAAI,CAAC,KAAK,EAAE,KAAK,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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