@whzxc/agent-design-gallery 0.14.1 → 0.16.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 +29 -16
- package/package.json +2 -1
- package/public/access.css +15 -2
- package/public/app.js +1284 -521
- package/public/arrangement-worker.js +7 -7
- package/public/arrangement.js +35 -30
- package/public/assets.js +85 -48
- package/public/auth.js +59 -4
- package/public/boards.js +129 -0
- package/public/comment-anchors.js +50 -0
- package/public/comments.css +400 -0
- package/public/comments.js +1106 -0
- package/public/context-menu.js +97 -0
- package/public/frame-identity.js +51 -14
- package/public/hub.css +25 -3
- package/public/hub.html +10 -2
- package/public/hub.js +127 -23
- package/public/icons.js +9 -0
- package/public/index.html +26 -10
- package/public/instance-actions.js +9 -2
- package/public/layout.js +156 -86
- package/public/motion-flow.js +28 -0
- package/public/motion-identity.js +100 -0
- package/public/motion-paint.js +332 -0
- package/public/motion-scene.js +165 -0
- package/public/motion-specimens.js +335 -0
- package/public/player.css +270 -0
- package/public/player.js +753 -0
- package/public/recent-updates.js +535 -0
- package/public/selection.js +1 -1
- package/public/style.css +91 -154
- package/public/switcher.css +5 -4
- package/public/switcher.js +109 -34
- package/public/token-catalog.js +8 -3
- package/public/tokens.css +20 -1
- package/public/view-boards.css +131 -0
- package/public/view-boards.js +350 -0
- package/public/view-route.js +1 -2
- package/src/boards/board.mjs +30 -0
- package/src/boards/motion-board.mjs +202 -0
- package/src/boards/token-board.mjs +200 -0
- package/src/cli-output.mjs +10 -5
- package/src/cli.mjs +89 -35
- package/src/comments.mjs +293 -0
- package/src/http.mjs +7 -5
- package/src/hub/project-link.mjs +41 -0
- package/src/hub/registry.mjs +5 -0
- package/src/hub.mjs +14 -10
- package/src/link.mjs +13 -1
- package/src/recent-frames.mjs +295 -0
- package/src/recent-history.mjs +100 -0
- package/src/recent-job.mjs +63 -0
- package/src/recent-worker.mjs +171 -0
- package/src/server.mjs +285 -110
- package/src/service.mjs +46 -12
- package/src/toolkit/arch-git.mjs +8 -14
- package/src/toolkit/arch.mjs +3 -2
- package/src/toolkit/asset-rules.mjs +24 -1
- package/src/toolkit/browser.mjs +1 -13
- package/src/toolkit/build-store.mjs +9 -1
- package/src/toolkit/build-worker.mjs +6 -0
- package/src/toolkit/build.mjs +22 -16
- package/src/toolkit/commands.mjs +105 -9
- package/src/toolkit/compare.mjs +13 -11
- package/src/toolkit/config.mjs +2 -2
- package/{public/review.js → src/toolkit/diff-document.mjs} +137 -43
- package/src/toolkit/diff-inputs.mjs +97 -52
- package/src/toolkit/diff.mjs +198 -43
- package/src/toolkit/frame-declarations.mjs +36 -0
- package/src/toolkit/git-blobs.mjs +50 -0
- package/src/toolkit/impact-inputs.mjs +11 -19
- package/src/toolkit/impact-selection.mjs +27 -12
- package/src/toolkit/impact.mjs +49 -15
- package/src/toolkit/implementation-map.mjs +17 -6
- package/src/toolkit/input-generation.mjs +15 -0
- package/src/toolkit/inspect-output.mjs +1 -1
- package/src/toolkit/inspect.d.ts +9 -1
- package/src/toolkit/inspect.mjs +25 -1
- package/src/toolkit/motion-check.mjs +382 -0
- package/src/toolkit/motion-css.mjs +105 -0
- package/src/toolkit/motion-flows.mjs +95 -0
- package/src/toolkit/motion-impact.mjs +87 -0
- package/src/toolkit/motion-inventory.mjs +202 -0
- package/src/toolkit/motion-label.mjs +111 -0
- package/src/toolkit/motion-patterns.mjs +216 -0
- package/src/toolkit/motion-primitives.mjs +94 -0
- package/src/toolkit/motion-queries.mjs +169 -0
- package/src/toolkit/motion.mjs +300 -0
- package/src/toolkit/move-pairing.mjs +140 -0
- package/src/toolkit/owner.mjs +19 -6
- package/src/toolkit/play-endpoint.mjs +66 -0
- package/src/toolkit/project-index.mjs +4 -4
- package/src/toolkit/recent-structure.mjs +201 -0
- package/src/toolkit/results.mjs +3 -3
- package/src/toolkit/review-document.mjs +440 -0
- package/src/toolkit/review-embed-document.mjs +671 -0
- package/src/toolkit/review-filmstrip.mjs +76 -0
- package/src/toolkit/review-groups.mjs +29 -0
- package/src/toolkit/review-motion-card.mjs +51 -0
- package/src/toolkit/review-motion.mjs +159 -0
- package/src/toolkit/review-observation.mjs +131 -0
- package/src/toolkit/review-playback.js +123 -0
- package/src/toolkit/review-sheet.mjs +125 -0
- package/src/toolkit/review-specimens.mjs +60 -0
- package/src/toolkit/review.mjs +240 -0
- package/src/toolkit/runtime.mjs +8 -2
- package/src/toolkit/theme.mjs +16 -0
- package/src/viewer-cache.mjs +48 -12
- package/public/annotations.js +0 -816
- package/public/labels.js +0 -122
- package/src/annotations.mjs +0 -238
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { motionCard, motionStyle } from './review-motion-card.mjs';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
|
|
4
|
+
const escape = value => String(value ?? '').replace(/[&<>"']/g, char => ({
|
|
5
|
+
'&': '&', '<': '<', '>': '>', '"': '"', "'": ''',
|
|
6
|
+
})[char]);
|
|
7
|
+
const label = ({ source, frame }) => `${source.replace(/^design\//, '').replace(/\.tsx$/, '')}#${frame}`;
|
|
8
|
+
const key = ({ source, frame }) => JSON.stringify([source, frame]);
|
|
9
|
+
const short = revision => revision?.slice(0, 10) ?? '—';
|
|
10
|
+
const countLabel = count => `${count} ${count === 1 ? 'frame' : 'frames'}`;
|
|
11
|
+
const icons = {
|
|
12
|
+
expand: '<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 4H4v4m12-4h4v4m0 8v4h-4m-8 0H4v-4"/></svg>',
|
|
13
|
+
external: '<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 17 17 7M7 7h10v10"/></svg>',
|
|
14
|
+
close: '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><path d="m6 6 12 12M6 18 18 6"/></svg>',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function originLabel(origin) {
|
|
18
|
+
const parts = [origin.layer, origin.chapter, origin.title].filter(Boolean);
|
|
19
|
+
return parts.map(part => `<span>${escape(part)}</span>`).join('<span class="crumb-separator" aria-hidden="true">/</span>');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function originHtml(origin) {
|
|
23
|
+
const content = `<span class="breadcrumbs">${originLabel(origin)}</span><strong>${escape(origin.frame)}${origin.href ? icons.external : ''}</strong>`;
|
|
24
|
+
return origin.href ? `<a class="origin" href="${escape(origin.href)}" target="_blank" rel="noopener" title="Open in ADG">${content}</a>` : `<span class="origin">${content}</span>`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function reviewDocument(report, { properties, styles, templates }) {
|
|
28
|
+
const { title, theme, base, head, cards, counts, groups, removed, moved, failures } = report;
|
|
29
|
+
const byKey = new Map(cards.map(card => [key(card), card]));
|
|
30
|
+
const added = cards.filter(card => card.status === 'added');
|
|
31
|
+
const direct = cards.filter(card => card.status === 'changed' && card.change?.kind !== 'inherited');
|
|
32
|
+
const cssText = value => value.replace(/<\/style/gi, '<\\/style');
|
|
33
|
+
const sections = [
|
|
34
|
+
{ id: 'added', title: 'Added', count: counts.added, html: () => added.map(card => cardHtml(card)).join('') },
|
|
35
|
+
{ id: 'direct', title: 'Direct changes', count: counts.direct, html: () => direct.map(card => cardHtml(card)).join('') },
|
|
36
|
+
{ id: 'inherited', title: 'Inherited changes', count: counts.inherited, html: () => groups.map((group, index) => inheritedHtml(group, index, byKey)).join('') },
|
|
37
|
+
{ id: 'motion', title: 'Transition changes', count: report.motion?.cards.length ?? 0,
|
|
38
|
+
html: () => report.motion.cards.map((card, i) => motionCard(card, i)).join('') },
|
|
39
|
+
{ id: 'removed', title: 'Removed', count: counts.removed, html: () => namesHtml(removed.map(frame => originHtml(frame.origin))) },
|
|
40
|
+
{ id: 'moved', title: 'Moved', count: counts.moved, html: () => namesHtml(moved.map(({ before, after }) =>
|
|
41
|
+
`${originHtml(before)}<span aria-hidden="true">→</span>${originHtml(after)}`)) },
|
|
42
|
+
].filter(section => section.count > 0);
|
|
43
|
+
const playback = report.motion ? report.motion.script + '\nreviewPlayback.mountReport();' : '';
|
|
44
|
+
const script = `(${mountPreviews.toString()})();` + playback;
|
|
45
|
+
const hash = createHash('sha256').update(script).digest('base64');
|
|
46
|
+
const metadata = JSON.stringify(cards.map(({ before, after, difference }) => ({ before, after, difference: Boolean(difference) })));
|
|
47
|
+
return `<!doctype html>
|
|
48
|
+
<html lang="en" data-theme="${theme}">
|
|
49
|
+
<head>
|
|
50
|
+
<meta charset="utf-8">
|
|
51
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
52
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'sha256-${hash}'; style-src 'unsafe-inline'; img-src data:; font-src data:; ${report.motion ? "frame-src 'self' about:; " : ''}base-uri 'none'; form-action 'none'">
|
|
53
|
+
<title>${escape(title)} · Design review</title>
|
|
54
|
+
<style>${cssText(properties.join('\n'))}${documentStyles}${report.motion ? motionStyle : ''}</style>
|
|
55
|
+
</head>
|
|
56
|
+
<body>
|
|
57
|
+
<header id="top" class="masthead">
|
|
58
|
+
<div class="shell masthead-inner">
|
|
59
|
+
<h1 title="${escape(title)} · Design review">${escape(title)} <span>Review</span></h1>
|
|
60
|
+
<div class="revisions" aria-label="Compared revisions">
|
|
61
|
+
<code title="Base ${escape(base)}">${short(base)}</code><span class="revision-arrow" aria-hidden="true">→</span>
|
|
62
|
+
<code title="Working tree ${escape(head)}">${short(head)}</code>
|
|
63
|
+
</div>
|
|
64
|
+
<span class="theme-label">${theme === 'dark' ? 'Dark' : 'Light'} theme</span>
|
|
65
|
+
</div>
|
|
66
|
+
</header>
|
|
67
|
+
<div class="shell layout">
|
|
68
|
+
<main>
|
|
69
|
+
${failures.length ? `<section class="failures" role="alert"><h2>Some sources could not be built</h2><ul>${failures.map(failure =>
|
|
70
|
+
`<li><code>${escape(failure.source)}</code> (${escape(failure.side)}) · ${escape(failure.message)}</li>`).join('')}</ul></section>` : ''}
|
|
71
|
+
${sections.map(({ id, title, count, html }) => `<section id="${id}" data-section="${id}" aria-labelledby="heading-${id}">
|
|
72
|
+
<header class="section-head"><h2 id="heading-${id}">${title}</h2><span>${id === 'motion' ? count + (count === 1 ? ' edge' : ' edges') : countLabel(count)}</span></header>
|
|
73
|
+
<div class="section-body">${html()}</div>
|
|
74
|
+
</section>`).join('')}
|
|
75
|
+
${sections.length ? '' : '<p>No changed frames.</p>'}
|
|
76
|
+
</main>
|
|
77
|
+
</div>
|
|
78
|
+
<dialog id="frame-zoom" aria-labelledby="zoom-title">
|
|
79
|
+
<header class="zoom-header">
|
|
80
|
+
<div id="zoom-title"></div>
|
|
81
|
+
<div class="zoom-actions" aria-label="Zoom controls">
|
|
82
|
+
<button type="button" data-zoom="out" aria-label="Zoom out">−</button>
|
|
83
|
+
<output id="zoom-scale"></output>
|
|
84
|
+
<button type="button" data-zoom="in" aria-label="Zoom in">+</button>
|
|
85
|
+
<button type="button" data-zoom="fit">Fit</button>
|
|
86
|
+
<button type="button" data-zoom="actual">100%</button>
|
|
87
|
+
<button type="button" data-zoom="close" aria-label="Close enlarged frame">${icons.close}</button>
|
|
88
|
+
</div>
|
|
89
|
+
</header>
|
|
90
|
+
<div class="zoom-modes" role="group" aria-label="Frame comparison" id="zoom-modes"></div>
|
|
91
|
+
<div class="zoom-panes" id="zoom-panes"></div>
|
|
92
|
+
</dialog>
|
|
93
|
+
<script id="review-data" type="application/json">${metadata}</script>
|
|
94
|
+
${styles.map((style, index) => `<template id="style-${index}"><style>${cssText(style)}</style></template>`).join('\n')}
|
|
95
|
+
${templates.join('\n')}
|
|
96
|
+
${cards.filter(card => card.difference).map(card => `<template id="difference-${card.index}"><img src="${escape(card.difference)}" alt="Changed pixels in ${escape(label(card))}"></template>`).join('\n')}
|
|
97
|
+
${report.motion ? '<script id="motion-data" type="application/json">' + JSON.stringify({ cards: report.motion.cards, assets: report.motion.assets, theme }).replaceAll('<', '\\u003c') + '</script>' : ''}
|
|
98
|
+
<script>${script}</script>
|
|
99
|
+
</body>
|
|
100
|
+
</html>`;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function namesHtml(items) {
|
|
104
|
+
return `<ul class="names">${items.map(item => `<li>${item}</li>`).join('')}</ul>`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function cardHtml(card, role) {
|
|
108
|
+
const id = `review-${card.index}`;
|
|
109
|
+
const added = card.status === 'added';
|
|
110
|
+
const panes = added ? ['after'] : ['before', 'after', ...(card.difference ? ['difference'] : [])];
|
|
111
|
+
const size = (preview) => `${Math.round(preview.width)} × ${Math.round(preview.height)}`;
|
|
112
|
+
const dimensions = card.after ? (card.before && size(card.before) !== size(card.after)
|
|
113
|
+
? `${size(card.before)} → ${size(card.after)}` : size(card.after)) : '';
|
|
114
|
+
return `<article class="frame-card" id="${id}" data-card="${card.index}" data-status="${card.status}"
|
|
115
|
+
data-source="${escape(card.source)}" data-frame="${escape(card.frame)}" ${role ? `data-role="${role.toLowerCase()}"` : ''} aria-labelledby="${id}-title">
|
|
116
|
+
<header class="card-head">
|
|
117
|
+
<h3 id="${id}-title">${originHtml(card.origin)}</h3>
|
|
118
|
+
<div class="card-meta">${role ? `<span class="role-label">${role}</span>` : ''}${dimensions ? `<span class="dimensions" aria-label="Frame size in CSS pixels">${dimensions}</span>` : ''}
|
|
119
|
+
<button type="button" class="enlarge" data-enlarge="${added ? 'after' : 'compare'}" aria-label="Enlarge ${escape(card.origin.frame)}">${icons.expand}<span>Enlarge</span></button>
|
|
120
|
+
</div>
|
|
121
|
+
</header>
|
|
122
|
+
<div class="panes" style="--panes:${panes.length}">
|
|
123
|
+
${panes.map(side => `<figure data-side="${side}"><figcaption>
|
|
124
|
+
<span>${side[0].toUpperCase() + side.slice(1)}</span>
|
|
125
|
+
${side === 'before' && card.previousOrigin ? `<small>${escape(card.previousOrigin.title)} · ${escape(card.previousOrigin.frame)}</small>` : ''}
|
|
126
|
+
${side === 'difference' && card.differentPixels ? `<small>${card.differentPixels.toLocaleString('en-US')} px changed</small>` : ''}
|
|
127
|
+
</figcaption><div class="stage">${card[side] ? `<button type="button" class="pane-trigger" data-enlarge="${side}" aria-label="Enlarge ${side} · ${escape(card.origin.frame)}" title="Enlarge ${side}">${icons.expand}</button>` : '<span class="absent">Absent at base</span>'}</div></figure>`).join('')}
|
|
128
|
+
</div>
|
|
129
|
+
</article>`;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function inheritedHtml(group, index, byKey) {
|
|
133
|
+
const representative = key(group.representative);
|
|
134
|
+
const outliers = group.outliers.map(key).filter(value => value !== representative);
|
|
135
|
+
const featured = new Set([representative, ...outliers]);
|
|
136
|
+
const rest = group.frames.map(key).filter(value => !featured.has(value));
|
|
137
|
+
return `<section class="inherited-group" data-group="${index}" aria-labelledby="group-${index}">
|
|
138
|
+
<header class="group-head"><h3 id="group-${index}">${group.causes.length ? group.causes.map(cause => `<code>${escape(cause)}</code>`).join('') : 'Shared dependencies'}</h3><span>${countLabel(group.frames.length)}</span></header>
|
|
139
|
+
<div class="group-body">
|
|
140
|
+
${cardHtml(byKey.get(representative), 'Representative')}
|
|
141
|
+
${outliers.map(value => cardHtml(byKey.get(value), 'Outlier')).join('')}
|
|
142
|
+
${rest.length ? `<details><summary>${countLabel(rest.length)} more</summary><div class="members">${rest.map(value => cardHtml(byKey.get(value))).join('')}</div></details>` : ''}
|
|
143
|
+
</div>
|
|
144
|
+
</section>`;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function mountPreviews() {
|
|
148
|
+
const data = JSON.parse(document.getElementById('review-data').textContent);
|
|
149
|
+
const cards = [...document.querySelectorAll('[data-card]')];
|
|
150
|
+
const sheetCache = new Map();
|
|
151
|
+
const pending = new Set();
|
|
152
|
+
const zoom = document.getElementById('frame-zoom');
|
|
153
|
+
const modes = document.getElementById('zoom-modes');
|
|
154
|
+
const zoomPanes = document.getElementById('zoom-panes');
|
|
155
|
+
const zoomTitle = document.getElementById('zoom-title');
|
|
156
|
+
const zoomScale = document.getElementById('zoom-scale');
|
|
157
|
+
const zoomNames = { compare: 'Compare', before: 'Before', after: 'After', difference: 'Difference' };
|
|
158
|
+
let activeZoom;
|
|
159
|
+
function specimen(preview) {
|
|
160
|
+
const host = document.createElement('div');
|
|
161
|
+
host.className = 'specimen';
|
|
162
|
+
const width = Math.ceil(preview.width), height = Math.ceil(preview.height);
|
|
163
|
+
host.style.width = width + 'px';
|
|
164
|
+
host.style.height = height + 'px';
|
|
165
|
+
for (const [unit, value] of Object.entries({ vw: width, vh: height, vmin: Math.min(width, height), vmax: Math.max(width, height) })) {
|
|
166
|
+
host.style.setProperty('--review-' + unit, value / 100 + 'px');
|
|
167
|
+
}
|
|
168
|
+
if (!sheetCache.has(preview.style)) {
|
|
169
|
+
const sheet = new CSSStyleSheet();
|
|
170
|
+
const css = document.getElementById('style-' + preview.style).content.firstElementChild.textContent;
|
|
171
|
+
sheet.replaceSync('review-document,review-body{display:block}review-document{min-height:100%}' + css);
|
|
172
|
+
sheetCache.set(preview.style, sheet);
|
|
173
|
+
}
|
|
174
|
+
const root = host.attachShadow({ mode: 'open' });
|
|
175
|
+
root.adoptedStyleSheets = [sheetCache.get(preview.style)];
|
|
176
|
+
root.append(document.getElementById('frame-' + preview.template).content.cloneNode(true));
|
|
177
|
+
return host;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function makePlane(index, side) {
|
|
181
|
+
const plane = document.createElement('div');
|
|
182
|
+
plane.className = 'plane';
|
|
183
|
+
if (side === 'difference') plane.append(document.getElementById('difference-' + index).content.cloneNode(true));
|
|
184
|
+
else plane.append(specimen(data[index][side]));
|
|
185
|
+
return plane;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function sizesFor(preview, side) {
|
|
189
|
+
const pair = side === 'difference' || side === 'compare';
|
|
190
|
+
const frames = pair ? [preview.before, preview.after].filter(Boolean) : [preview[side]];
|
|
191
|
+
return { width: Math.ceil(Math.max(...frames.map(frame => frame.width))), height: Math.ceil(Math.max(...frames.map(frame => frame.height))) };
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function fit(card) {
|
|
195
|
+
const { before, after } = data[Number(card.dataset.card)];
|
|
196
|
+
const stages = [...card.querySelectorAll('.stage')];
|
|
197
|
+
const width = Math.ceil(Math.max(before?.width ?? 0, after?.width ?? 0));
|
|
198
|
+
const height = Math.ceil(Math.max(before?.height ?? 0, after?.height ?? 0));
|
|
199
|
+
const available = Math.min(...stages.map(stage => stage.clientWidth)) - 28;
|
|
200
|
+
if (!width || !height || available <= 0) return;
|
|
201
|
+
const scale = Math.min(1, available / width, 360 / height);
|
|
202
|
+
card.style.setProperty('--preview-scale', scale);
|
|
203
|
+
card.style.setProperty('--plane-width', Math.ceil(width * scale) + 'px');
|
|
204
|
+
card.style.setProperty('--plane-height', Math.ceil(height * scale) + 'px');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function mount(card) {
|
|
208
|
+
if (card.dataset.mounted || card.closest('details:not([open])')) return;
|
|
209
|
+
card.dataset.mounted = 'true';
|
|
210
|
+
const index = Number(card.dataset.card), preview = data[index];
|
|
211
|
+
const decodes = [];
|
|
212
|
+
for (const pane of card.querySelectorAll('[data-side]')) {
|
|
213
|
+
const side = pane.dataset.side;
|
|
214
|
+
if (!preview[side]) continue;
|
|
215
|
+
const plane = makePlane(index, side);
|
|
216
|
+
const images = plane.firstElementChild.shadowRoot?.querySelectorAll('img') ?? plane.querySelectorAll('img');
|
|
217
|
+
decodes.push(...[...images].map(image => image.decode()));
|
|
218
|
+
pane.querySelector('.stage').prepend(plane);
|
|
219
|
+
}
|
|
220
|
+
fit(card);
|
|
221
|
+
Promise.allSettled([document.fonts.ready, ...decodes]).then(() => {
|
|
222
|
+
requestAnimationFrame(() => requestAnimationFrame(() => { card.dataset.ready = 'true'; }));
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
let queued = false;
|
|
227
|
+
const near = new IntersectionObserver(entries => {
|
|
228
|
+
for (const entry of entries) {
|
|
229
|
+
if (entry.isIntersecting) pending.add(entry.target);
|
|
230
|
+
else pending.delete(entry.target);
|
|
231
|
+
}
|
|
232
|
+
if (!queued && pending.size) {
|
|
233
|
+
queued = true;
|
|
234
|
+
requestAnimationFrame(() => {
|
|
235
|
+
queued = false;
|
|
236
|
+
for (const card of pending) {
|
|
237
|
+
mount(card);
|
|
238
|
+
if (card.dataset.mounted) near.unobserve(card);
|
|
239
|
+
}
|
|
240
|
+
pending.clear();
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}, { rootMargin: '280px 0px' });
|
|
244
|
+
const sizes = new ResizeObserver(entries => { for (const entry of entries) fit(entry.target); });
|
|
245
|
+
for (const card of cards) { fit(card); sizes.observe(card); near.observe(card); }
|
|
246
|
+
|
|
247
|
+
function fitZoom() {
|
|
248
|
+
if (!zoom.open || !activeZoom) return;
|
|
249
|
+
const preview = data[activeZoom.index];
|
|
250
|
+
const { width, height } = sizesFor(preview, activeZoom.mode);
|
|
251
|
+
const stages = [...zoomPanes.querySelectorAll('.zoom-stage')];
|
|
252
|
+
const fit = Math.max(.02, Math.min(2, ...stages.flatMap(stage => [(stage.clientWidth - 18) / width, (stage.clientHeight - 18) / height])));
|
|
253
|
+
const scale = activeZoom.scale ?? fit;
|
|
254
|
+
activeZoom.shown = scale;
|
|
255
|
+
zoomScale.value = Math.round(scale * 100) + '%';
|
|
256
|
+
zoomPanes.style.setProperty('--preview-scale', scale);
|
|
257
|
+
zoomPanes.style.setProperty('--plane-width', Math.ceil(width * scale) + 'px');
|
|
258
|
+
zoomPanes.style.setProperty('--plane-height', Math.ceil(height * scale) + 'px');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function showMode(mode) {
|
|
262
|
+
activeZoom.mode = mode;
|
|
263
|
+
activeZoom.scale = null;
|
|
264
|
+
for (const button of modes.children) button.setAttribute('aria-pressed', String(button.dataset.mode === mode));
|
|
265
|
+
const sides = mode === 'compare' ? activeZoom.sides : [mode];
|
|
266
|
+
zoomPanes.style.setProperty('--zoom-panes', sides.length);
|
|
267
|
+
zoomPanes.replaceChildren(...sides.map(side => {
|
|
268
|
+
const pane = document.createElement('figure');
|
|
269
|
+
pane.dataset.side = side;
|
|
270
|
+
const caption = document.createElement('figcaption');
|
|
271
|
+
caption.textContent = zoomNames[side];
|
|
272
|
+
const stage = document.createElement('div'), surface = document.createElement('div');
|
|
273
|
+
stage.className = 'zoom-stage';
|
|
274
|
+
surface.className = 'zoom-surface';
|
|
275
|
+
stage.setAttribute('tabindex', '0');
|
|
276
|
+
stage.setAttribute('aria-label', zoomNames[side] + ' preview');
|
|
277
|
+
surface.append(makePlane(activeZoom.index, side));
|
|
278
|
+
stage.append(surface);
|
|
279
|
+
pane.append(caption, stage);
|
|
280
|
+
return pane;
|
|
281
|
+
}));
|
|
282
|
+
fitZoom();
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function openZoom(card, control) {
|
|
286
|
+
const index = Number(card.dataset.card);
|
|
287
|
+
const sides = ['before', 'after', 'difference'].filter(side => data[index][side]);
|
|
288
|
+
const allowed = sides.length > 1 ? ['compare', ...sides] : sides;
|
|
289
|
+
activeZoom = { index, sides, control };
|
|
290
|
+
zoomTitle.replaceChildren(card.querySelector('.origin').cloneNode(true));
|
|
291
|
+
modes.replaceChildren(...allowed.map(mode => {
|
|
292
|
+
const button = document.createElement('button');
|
|
293
|
+
button.type = 'button';
|
|
294
|
+
button.dataset.mode = mode;
|
|
295
|
+
button.textContent = zoomNames[mode];
|
|
296
|
+
button.addEventListener('click', () => showMode(mode));
|
|
297
|
+
return button;
|
|
298
|
+
}));
|
|
299
|
+
modes.hidden = allowed.length === 1;
|
|
300
|
+
zoom.showModal();
|
|
301
|
+
showMode(allowed.includes(control.dataset.enlarge) ? control.dataset.enlarge : allowed[0]);
|
|
302
|
+
zoom.querySelector('[data-zoom="close"]').focus();
|
|
303
|
+
document.documentElement.classList.add('zoom-open');
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
for (const card of cards) card.addEventListener('click', event => {
|
|
307
|
+
const control = event.target.closest('[data-enlarge]');
|
|
308
|
+
if (control) openZoom(card, control);
|
|
309
|
+
});
|
|
310
|
+
zoom.querySelector('.zoom-actions').addEventListener('click', event => {
|
|
311
|
+
const control = event.target.closest('[data-zoom]');
|
|
312
|
+
if (!control || !activeZoom) return;
|
|
313
|
+
const { zoom: action } = control.dataset;
|
|
314
|
+
if (action === 'close') { zoom.close(); return; }
|
|
315
|
+
if (action === 'fit') activeZoom.scale = null;
|
|
316
|
+
if (action === 'actual') activeZoom.scale = 1;
|
|
317
|
+
if (action === 'in') activeZoom.scale = Math.min(4, activeZoom.shown * 1.25);
|
|
318
|
+
if (action === 'out') activeZoom.scale = Math.max(.02, activeZoom.shown / 1.25);
|
|
319
|
+
fitZoom();
|
|
320
|
+
});
|
|
321
|
+
zoom.addEventListener('close', () => {
|
|
322
|
+
document.documentElement.classList.remove('zoom-open');
|
|
323
|
+
zoomPanes.replaceChildren();
|
|
324
|
+
activeZoom?.control.focus();
|
|
325
|
+
activeZoom = null;
|
|
326
|
+
});
|
|
327
|
+
const zoomSizes = new ResizeObserver(fitZoom);
|
|
328
|
+
zoomSizes.observe(zoomPanes);
|
|
329
|
+
|
|
330
|
+
function revealAnchor() {
|
|
331
|
+
const target = document.getElementById(location.hash.slice(1));
|
|
332
|
+
const group = target?.closest('details');
|
|
333
|
+
if (group && !group.open) {
|
|
334
|
+
group.open = true;
|
|
335
|
+
requestAnimationFrame(() => target.scrollIntoView());
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
window.addEventListener('hashchange', revealAnchor);
|
|
339
|
+
revealAnchor();
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
const documentStyles = `
|
|
343
|
+
:root{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color-scheme:light;
|
|
344
|
+
--page:#f4f5f7;--top:#fff;--panel:#fff;--group:#eef0f3;--well:#edf0f4;--line:#d8dde5;--ink:#171d27;--muted:#596679;
|
|
345
|
+
--accent:#284b9e;--nav-tint:#e7edf9;--positive:#266844;--warning:#8b4c18;}
|
|
346
|
+
:root[data-theme="dark"]{color-scheme:dark;--page:#11141a;--top:#181c24;--panel:#1b2029;--group:#151a22;--well:#101319;
|
|
347
|
+
--line:#313a49;--ink:#eff3f9;--muted:#a5b0c2;--accent:#afc4ff;--nav-tint:#232e47;--positive:#8ed2ab;--warning:#f0bb80;}
|
|
348
|
+
*,*::before,*::after{box-sizing:border-box}
|
|
349
|
+
body{margin:0;background:var(--page);color:var(--ink);font-size:14px;line-height:1.5}
|
|
350
|
+
h1,h2,h3,p,ul,figure{margin:0} a{color:inherit;text-decoration:none}
|
|
351
|
+
code,.dimensions,#zoom-scale{font:12px/1.5 ui-monospace,"SF Mono",Menlo,monospace}
|
|
352
|
+
:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
|
|
353
|
+
.shell{max-width:1680px;margin-inline:auto;padding-inline:clamp(16px,2.6vw,42px)}
|
|
354
|
+
.masthead{background:var(--top);border-bottom:1px solid var(--line)}
|
|
355
|
+
.masthead-inner{min-height:55px;padding-block:8px;display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:14px}
|
|
356
|
+
h1{min-width:0;font-size:17px;letter-spacing:-.025em;line-height:1.3;font-weight:670;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
357
|
+
h1 span{font-size:13px;font-weight:500;letter-spacing:0;color:var(--muted);margin-left:7px}
|
|
358
|
+
.revisions{display:flex;align-items:center;gap:9px;color:var(--muted);font-size:12px;white-space:nowrap}
|
|
359
|
+
.revisions code{color:var(--muted)}
|
|
360
|
+
.revision-arrow{color:var(--accent)}
|
|
361
|
+
.theme-label{line-height:1;white-space:nowrap;color:var(--muted);border-left:1px solid var(--line);padding-left:14px;font-size:11px}
|
|
362
|
+
.layout{padding-block:21px 72px}
|
|
363
|
+
main{min-width:0;display:grid;gap:42px}
|
|
364
|
+
[data-section],.frame-card{scroll-margin-top:24px}
|
|
365
|
+
.section-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:13px;padding-bottom:10px;border-bottom:1px solid var(--line)}
|
|
366
|
+
.section-head h2{font-size:22px;letter-spacing:-.025em;font-weight:650}
|
|
367
|
+
#added .section-head h2{color:var(--positive)}
|
|
368
|
+
.section-head>span,.group-head>span{color:var(--muted);font-size:12px;white-space:nowrap}
|
|
369
|
+
.section-body,.members,.group-body{display:grid;gap:14px;min-width:0}
|
|
370
|
+
#added .section-body{grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch}
|
|
371
|
+
#added .frame-card,#added .panes figure{display:flex;flex-direction:column}
|
|
372
|
+
#added .panes{flex:1;align-items:stretch}
|
|
373
|
+
#added .stage{flex:1}
|
|
374
|
+
.frame-card,.inherited-group{border:1px solid var(--line);border-radius:11px;min-width:0;overflow:hidden}
|
|
375
|
+
.frame-card{background:var(--panel);--plane-height:0px}
|
|
376
|
+
.frame-card:target{border-color:var(--accent)}
|
|
377
|
+
.card-head{padding:11px 13px;min-height:60px;display:flex;justify-content:space-between;align-items:center;gap:8px 14px;border-bottom:1px solid var(--line)}
|
|
378
|
+
.card-head h3{min-width:0}
|
|
379
|
+
.origin{display:grid;gap:3px;min-width:0;overflow-wrap:anywhere}
|
|
380
|
+
.origin strong{color:var(--ink);font-size:15px;font-weight:640;line-height:1.25}
|
|
381
|
+
.origin strong svg{display:inline-block;vertical-align:-2px;margin-left:5px;color:var(--accent)}
|
|
382
|
+
a.origin:hover strong{color:var(--accent)}
|
|
383
|
+
.breadcrumbs{display:flex;align-items:baseline;flex-wrap:wrap;gap:1px 7px;color:var(--muted);font-size:11px;font-weight:500;line-height:1.3}
|
|
384
|
+
.crumb-separator{color:var(--muted);opacity:.65}
|
|
385
|
+
.card-meta{display:flex;gap:7px 10px;align-items:center;flex-wrap:wrap;justify-content:flex-end;color:var(--muted);flex:none}
|
|
386
|
+
.dimensions{font-size:11px;white-space:nowrap}
|
|
387
|
+
.role-label{font-size:10px;color:var(--accent);border:1px solid var(--line);border-radius:999px;padding:0 6px}
|
|
388
|
+
[data-role="outlier"] .role-label{color:var(--warning)}
|
|
389
|
+
button{font:inherit;color:inherit}
|
|
390
|
+
.enlarge,.zoom-actions button,.zoom-modes button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:30px;padding:4px 9px;
|
|
391
|
+
border:1px solid var(--line);border-radius:6px;background:var(--panel);color:var(--ink);cursor:pointer;font-size:12px;white-space:nowrap}
|
|
392
|
+
.enlarge:hover,.zoom-actions button:hover,.zoom-modes button:hover,.zoom-modes button[aria-pressed="true"]{background:var(--nav-tint);color:var(--accent)}
|
|
393
|
+
.panes{display:grid;grid-template-columns:repeat(var(--panes),minmax(0,1fr));gap:10px;padding:11px 12px 12px;align-items:start}
|
|
394
|
+
.panes figure{min-width:0}
|
|
395
|
+
figcaption{display:flex;justify-content:space-between;align-items:baseline;gap:4px 8px;flex-wrap:wrap;font-size:11px;font-weight:630;color:var(--muted);padding:0 1px 6px}
|
|
396
|
+
figcaption small{font-size:10px;font-weight:400;font-variant-numeric:tabular-nums}
|
|
397
|
+
.stage{position:relative;display:grid;place-items:center;min-height:max(128px,calc(24px + var(--plane-height)));overflow:hidden;border:1px solid var(--line);border-radius:7px;background:var(--well)}
|
|
398
|
+
.pane-trigger{display:block;position:absolute;inset:0;border:0;background:transparent;color:var(--ink);cursor:zoom-in}
|
|
399
|
+
.pane-trigger svg{position:absolute;top:7px;right:7px;box-sizing:content-box;border:1px solid var(--line);border-radius:6px;padding:5px;background:var(--panel);opacity:0}
|
|
400
|
+
.pane-trigger:hover svg,.pane-trigger:focus-visible svg{opacity:1}
|
|
401
|
+
.pane-trigger:focus-visible{outline-offset:-3px}
|
|
402
|
+
.plane{position:relative;width:var(--plane-width);height:var(--plane-height)}
|
|
403
|
+
.plane>img{display:block;width:100%;height:100%;object-fit:contain;object-position:top left}
|
|
404
|
+
.specimen{position:absolute;inset:0 auto auto 0;overflow:hidden;transform:scale(var(--preview-scale));transform-origin:top left;font:16px/normal "Times New Roman",serif;color:initial}
|
|
405
|
+
.absent{color:var(--muted);font-size:12px}
|
|
406
|
+
.inherited-group{background:var(--group)}
|
|
407
|
+
.group-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:13px 15px;border-bottom:1px solid var(--line)}
|
|
408
|
+
.group-head h3{display:flex;flex-wrap:wrap;gap:5px 10px;min-width:0;font-size:13px}
|
|
409
|
+
.group-head code{color:var(--accent);overflow-wrap:anywhere}
|
|
410
|
+
.group-body{padding:12px}
|
|
411
|
+
details{min-width:0}
|
|
412
|
+
summary{cursor:pointer;color:var(--accent);font-size:12px;padding:6px 4px}
|
|
413
|
+
.members{margin-top:7px}
|
|
414
|
+
.names{list-style:none;padding:10px 13px;display:grid;gap:9px;border:1px solid var(--line);border-radius:9px;background:var(--panel)}
|
|
415
|
+
.names li{display:flex;gap:9px;flex-wrap:wrap;overflow-wrap:anywhere}
|
|
416
|
+
.failures{padding:14px 17px;border:1px solid var(--warning);border-radius:9px}
|
|
417
|
+
.failures h2{font-size:16px;color:var(--warning)}
|
|
418
|
+
.zoom-open{overflow:hidden}
|
|
419
|
+
#frame-zoom{padding:0;color:var(--ink);background:var(--top);border:1px solid var(--line);border-radius:12px;width:min(1640px,calc(100% - 34px));
|
|
420
|
+
height:calc(100% - 34px);max-width:none;max-height:none;overflow:hidden}
|
|
421
|
+
#frame-zoom[open]{display:flex;flex-direction:column}
|
|
422
|
+
#frame-zoom::backdrop{background:rgb(5 8 13 / 78%)}
|
|
423
|
+
.zoom-header{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:12px 15px;border-bottom:1px solid var(--line)}
|
|
424
|
+
#zoom-title{min-width:0}
|
|
425
|
+
.zoom-actions{display:flex;align-items:center;gap:6px;flex:none}
|
|
426
|
+
.zoom-actions button[data-zoom="close"]{margin-left:4px;min-width:32px}
|
|
427
|
+
#zoom-scale{min-width:38px;text-align:center;color:var(--muted)}
|
|
428
|
+
.zoom-modes{display:flex;gap:5px;flex-wrap:wrap;padding:9px 15px 0}
|
|
429
|
+
.zoom-modes[hidden]{display:none}
|
|
430
|
+
.zoom-modes button{min-height:28px}
|
|
431
|
+
.zoom-panes{min-height:0;flex:1;display:grid;grid-template-columns:repeat(var(--zoom-panes,1),minmax(0,1fr));gap:10px;padding:12px 15px 15px}
|
|
432
|
+
.zoom-panes figure{display:flex;flex-direction:column;min-width:0;min-height:0}
|
|
433
|
+
.zoom-stage{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;background:var(--well);border:1px solid var(--line);border-radius:7px}
|
|
434
|
+
.zoom-surface{width:max(100%,calc(var(--plane-width) + 16px));min-height:max(100%,calc(var(--plane-height) + 16px));display:grid;place-items:center}
|
|
435
|
+
@media(max-width:1000px){.card-head{flex-wrap:wrap}.card-meta{justify-content:flex-start}}
|
|
436
|
+
@media(max-width:760px){.layout{padding-top:14px}.panes{gap:7px}.section-head h2{font-size:20px}.zoom-header{flex-wrap:wrap}}
|
|
437
|
+
@media(max-width:540px){.panes,#added .section-body{grid-template-columns:minmax(0,1fr)}.theme-label{display:none}.masthead-inner{grid-template-columns:minmax(0,1fr) auto;gap:8px}
|
|
438
|
+
.revisions{gap:5px}.revisions code{font-size:9px}h1{font-size:15px}h1 span{font-size:11px}.card-meta{width:100%}.enlarge{margin-left:auto}
|
|
439
|
+
.group-body{padding:9px}.section-head{margin-bottom:10px}.zoom-panes{grid-template-columns:1fr}.zoom-actions{flex-wrap:wrap}}
|
|
440
|
+
`;
|