BLOBBO/editor.html
type-two 367e700934 Lane J: workshop editor — drop-in GLB fitting on the real course
Three-panel editor page (editor.html + src/editor/): slot list, the actual
greybox course built from the game's own builders, and fit controls. Drop a
.glb on a slot, nudge offset/rotation/scale, save to IndexedDB so the live
game picks it up with no deploy, export manifest.json to commit it.

Design notes worth keeping:
- A custom asset never replaces the procedural node; it goes into a new
  sibling 'fit' node and the original is hidden. Reset is instant, references
  other systems captured stay alive, and the manifest transform lives on a
  node nobody else writes to (feel.ts, telegraph.ts and the machine parts all
  own transforms of their own).
- The stage creates physics but never steps it: no systems, no world.start(),
  just renderOnce() on a rAF. Nothing here affects gameplay.
- A blob body whose UVs paint cannot stick to is refused outright rather than
  swapped in — silently broken paint is worse than a missing model.

Headless verification: 148 assertions across three node test files
(manifest round-trip, GLB paintability against real parsed glTF, and the
whole drop/save/restore path over an in-memory IndexedDB).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 11:40:25 +10:00

103 lines
5.0 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>BLOBBO workshop</title>
<style>
:root{
--ink:#0a2540; --ink-soft:#4a627d; --paper:#f4f7fb; --card:#ffffff;
--line:#d7e2ee; --hot:#FF9500; --good:#34C759; --bad:#FF3B30; --pick:#0A84FF;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--paper);color:var(--ink);
font:15px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;overflow:hidden}
button,input{font:inherit;color:inherit}
.workshop{display:grid;grid-template-columns:280px 1fr 330px;height:100%}
.panel{overflow-y:auto;padding:16px}
.panel-slots{background:var(--card);border-right:1px solid var(--line)}
.panel-fit{background:var(--card);border-left:1px solid var(--line)}
.panel-stage{position:relative;padding:0;overflow:hidden;background:#bfe3ff}
.stage-host{position:absolute;inset:0}
.stage-host canvas{display:block;width:100%;height:100%}
.brand{margin:0 0 4px;font-size:19px;letter-spacing:.02em}
.lede{margin:0 0 18px;color:var(--ink-soft);font-size:13px}
.group{margin:16px 0 6px;font-size:11px;letter-spacing:.09em;text-transform:uppercase;
color:var(--ink-soft)}
.slot-list{display:flex;flex-direction:column;gap:4px}
.slot{display:flex;justify-content:space-between;align-items:center;gap:8px;
width:100%;padding:9px 11px;border:1px solid var(--line);border-radius:10px;
background:#fff;cursor:pointer;text-align:left;transition:.12s}
.slot:hover{border-color:var(--pick);background:#f2f8ff}
.slot[data-selected="true"]{border-color:var(--pick);background:#e7f2ff;
box-shadow:inset 3px 0 0 var(--pick)}
.slot-name{font-weight:600}
.slot-state{font-size:11px;padding:2px 7px;border-radius:20px;background:#eef3f8;
color:var(--ink-soft);white-space:nowrap}
.slot[data-state="custom"] .slot-state{background:#e6f8ea;color:#1c7a35}
.slot[data-state="derived"] .slot-state{background:#f3ecff;color:#6b3fa0}
.big-actions{display:flex;flex-direction:column;gap:8px;margin:22px 0 12px}
.action{padding:12px;border:1px solid var(--line);border-radius:11px;background:#fff;
cursor:pointer;font-weight:600}
.action:hover{border-color:var(--pick)}
.action.primary{background:var(--pick);border-color:var(--pick);color:#fff}
.action.danger{color:var(--bad);border-color:#f6d2cf}
.status{margin:0;padding:10px 12px;border-radius:10px;background:#eef3f8;
font-size:13px;color:var(--ink-soft)}
.status[data-tone="warn"]{background:#fff3e2;color:#8a5100}
.stage-hint{position:absolute;left:14px;bottom:14px;padding:7px 11px;border-radius:9px;
background:rgba(10,37,64,.72);color:#fff;font-size:12px;pointer-events:none}
.focus-btn{position:absolute;right:14px;bottom:14px;padding:10px 14px;border:0;
border-radius:10px;background:rgba(10,37,64,.86);color:#fff;font-weight:600;cursor:pointer}
.fit-title{margin:0 0 4px;font-size:18px}
.fit-hint{margin:0 0 14px;color:var(--ink-soft);font-size:13px}
.dropzone{display:flex;flex-direction:column;align-items:center;justify-content:center;
gap:5px;min-height:132px;border:2.5px dashed var(--line);border-radius:14px;
background:#fbfdff;cursor:pointer;text-align:center;padding:14px}
.dropzone:hover,.dropzone[data-hot="true"]{border-color:var(--hot);background:#fff6ea}
.dropzone-label{font-size:17px;font-weight:700}
.dropzone-sub{font-size:12px;color:var(--ink-soft)}
.paint-card{display:none;margin-top:14px;padding:12px;border-radius:12px;
border:1px solid var(--line);background:#fbfdff}
.paint-card[data-tone="ok"]{border-color:#bde5c8;background:#f2fcf5}
.paint-card[data-tone="bad"]{border-color:#f3b9b4;background:#fff3f2}
.paint-head{font-weight:700;margin-bottom:6px}
.paint-facts{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px}
.paint-facts span{font-size:11px;padding:3px 8px;border-radius:20px;background:#fff;
border:1px solid var(--line)}
.paint-note{font-size:12.5px;color:var(--ink-soft);margin-top:4px}
.fit-controls{display:none;margin-top:16px}
.fit-row{display:grid;grid-template-columns:1fr;gap:4px;margin-bottom:11px}
.fit-label{font-size:12px;font-weight:600;color:var(--ink-soft)}
.fit-row input[type=range]{width:100%}
.fit-row input[type=number]{width:96px;padding:5px 7px;border:1px solid var(--line);
border-radius:7px;background:#fff}
.help-card{margin-top:20px;border:1px solid var(--line);border-radius:12px;
background:#fbfdff;padding:10px 12px}
.help-card summary{cursor:pointer;font-weight:600}
.help-body{font-size:13px;color:var(--ink-soft)}
.help-body h3{margin:14px 0 4px;font-size:13px;color:var(--ink)}
.help-body ul,.help-body ol{margin:0;padding-left:18px}
.help-body code{background:#eef3f8;padding:1px 5px;border-radius:5px;font-size:12px}
@media (max-width:1100px){
html,body{overflow:auto}
.workshop{grid-template-columns:1fr;height:auto}
.panel-stage{height:60vh}
}
</style>
</head>
<body>
<div id="workshop"></div>
<script type="module" src="/src/editor/main.ts"></script>
</body>
</html>