Mirror to Gitea / mirror (push) Skipped
- tools/penpot/capture.mjs captures every page at 390 and 1440 px as editable layers (text, boxes, images) grouped by section - tools/penpot/plugin: Penpot plugin that rebuilds the captures as native boards; serve.py hosts it locally; preview.html shows the result - tools/penpot/tokens.mjs exports colours and fonts as design tokens - design/README.md documents the design -> hand-off -> code loop
62 lines
3.1 KiB
HTML
62 lines
3.1 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<style>
|
|
body { font: 13px system-ui, sans-serif; margin: 0; padding: 12px; color: #e8e8e8; background: #18181a; }
|
|
h1 { font-size: 14px; margin: 0 0 8px; }
|
|
label { display: flex; gap: 6px; align-items: center; padding: 3px 0; }
|
|
button { margin-top: 10px; width: 100%; padding: 8px; font-weight: 700; border: 0; border-radius: 6px; background: #31efb8; color: #000; cursor: pointer; }
|
|
button[disabled] { opacity: .5; }
|
|
#log { margin-top: 10px; font: 11px ui-monospace, monospace; white-space: pre-wrap; max-height: 150px; overflow: auto; color: #aaa; }
|
|
.row { display: flex; gap: 8px; font-size: 12px; }
|
|
.row a { color: #31efb8; cursor: pointer; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Import yoyos.sh baseline</h1>
|
|
<div class="row"><a id="all">all</a><a id="none">none</a><a id="mob">phone only</a><a id="desk">desktop only</a></div>
|
|
<div id="list">Loading boards…</div>
|
|
<button id="go" disabled>Import selected</button>
|
|
<div id="log"></div>
|
|
<script>
|
|
const log = (m) => { const el = document.getElementById('log'); el.textContent += m + '\n'; el.scrollTop = 1e9; };
|
|
let boards = [];
|
|
fetch('/baseline/index.json').then((r) => r.json()).then((idx) => {
|
|
boards = idx;
|
|
document.getElementById('list').innerHTML = idx.map((b, i) =>
|
|
`<label><input type="checkbox" data-i="${i}" checked> ${b.name} <small>(${b.layers})</small></label>`).join('');
|
|
document.getElementById('go').disabled = false;
|
|
}).catch((e) => log('Could not load /baseline/index.json — is tools/penpot/serve.py running? ' + e));
|
|
const boxes = () => [...document.querySelectorAll('input[type=checkbox]')];
|
|
document.getElementById('all').onclick = () => boxes().forEach((b) => (b.checked = true));
|
|
document.getElementById('none').onclick = () => boxes().forEach((b) => (b.checked = false));
|
|
document.getElementById('mob').onclick = () => boxes().forEach((b) => (b.checked = boards[b.dataset.i].slug.endsWith('mobile')));
|
|
document.getElementById('desk').onclick = () => boxes().forEach((b) => (b.checked = boards[b.dataset.i].slug.endsWith('desktop')));
|
|
|
|
let queue = [];
|
|
async function next() {
|
|
const item = queue.shift();
|
|
if (!item) { log('All done.'); document.getElementById('go').disabled = false; return; }
|
|
const board = await (await fetch('/baseline/' + item.file)).json();
|
|
const images = {};
|
|
for (const sec of board.sections) for (const l of sec.layers) {
|
|
if (l.type === 'image' && l.src && !images[l.src]) images[l.src] = new Uint8Array(await (await fetch('/baseline/' + l.src)).arrayBuffer());
|
|
}
|
|
log('Importing ' + board.name + '…');
|
|
parent.postMessage({ type: 'board', board, images }, '*');
|
|
}
|
|
window.addEventListener('message', (e) => {
|
|
const m = e.data;
|
|
if (m.type === 'done') { log(`✓ ${m.board} (${m.layers} layers)`); next(); }
|
|
if (m.type === 'error') { log(`✗ ${m.board}: ${m.error}`); next(); }
|
|
});
|
|
document.getElementById('go').onclick = () => {
|
|
queue = boxes().filter((b) => b.checked).map((b) => boards[b.dataset.i]);
|
|
document.getElementById('go').disabled = true;
|
|
next();
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|