Penpot design workflow: baseline export, importer plugin, tokens
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
This commit is contained in:
Johan Sandoval committed 2026-10-08 19:40:41 +00:00
1 parent 38b5213138
commit bf0d1efa2c
263 files changed
+1054 -1

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Baseline preview</title>
<!-- Same Google Fonts Penpot uses -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,100..900&family=Dela+Gothic+One&family=DotGothic16&family=Doto:wght@100..900&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@100..700&family=Rubik+Mono+One&family=Rubik+Wet+Paint&family=Sedgwick+Ave+Display&family=VT323&display=block" />
<style>
body { margin: 0; background: #2a2a2a; font-family: system-ui; }
#board { position: relative; overflow: hidden; margin: 0 auto; }
#board > * { position: absolute; box-sizing: border-box; }
.t { white-space: pre-wrap; overflow: visible; }
nav { position: fixed; top: 0; right: 0; z-index: 9; background: #000c; padding: 6px; }
nav select { font-size: 13px; }
</style>
</head>
<body>
<nav><select id="pick"></select></nav>
<div id="board"></div>
<script>
// Mirrors plugin.js: rect → div with fill/stroke/radius, image → img, text → absolutely placed text.
const pick = document.getElementById('pick');
const render = async (file) => {
const b = await (await fetch('/baseline/' + file)).json();
const el = document.getElementById('board');
el.style.cssText = `width:${b.width}px;height:${b.height}px;background:${b.background}`;
el.innerHTML = '';
for (const sec of b.sections) for (const l of sec.layers) {
const d = document.createElement(l.type === 'image' ? 'img' : 'div');
d.style.left = l.x + 'px'; d.style.top = l.y + 'px'; d.style.width = (l.type === 'text' ? l.w + 2 : l.w) + 'px'; d.style.height = l.h + 'px';
if (l.type === 'image') d.src = '/baseline/' + l.src;
if (l.type === 'rect') {
if (l.fill) d.style.background = l.fill.color, d.style.opacity = 1;
if (l.fill && l.fill.opacity < 1) d.style.background = l.fill.color + Math.round(l.fill.opacity * 255).toString(16).padStart(2, '0');
if (l.stroke) d.style.border = `${l.stroke.width}px solid ${l.stroke.color}`;
if (l.radius) d.style.borderRadius = l.radius + 'px';
if (l.shadow) d.style.boxShadow = l.shadow;
}
if (l.type === 'text') {
d.className = 't'; d.textContent = l.text;
if (l.stroke) { d.style.webkitTextStroke = `${l.stroke.width}px ${l.stroke.color}`; d.style.paintOrder = 'stroke fill'; }
if (l.shadow) d.style.textShadow = l.shadow;
Object.assign(d.style, { fontFamily: `'${l.font}'`, fontSize: l.size + 'px', fontWeight: l.weight, fontStyle: l.italic ? 'italic' : 'normal',
lineHeight: l.lineHeight, letterSpacing: (l.letterSpacing || 0) + 'px', textTransform: l.transform || 'none', textAlign: l.align, color: l.color, opacity: l.opacity });
}
el.appendChild(d);
}
document.fonts.ready.then(() => document.body.dataset.ready = file);
};
fetch('/baseline/index.json').then((r) => r.json()).then((idx) => {
pick.innerHTML = idx.map((b) => `<option value="${b.file}">${b.name}</option>`).join('');
pick.onchange = () => { location.hash = pick.value; render(pick.value); };
const f = location.hash.slice(1) || idx[0].file; pick.value = f; render(f);
});
</script>
</body>
</html>