Move @joan/procedural-glyph-engine from absolute path dep (/private/tmp/orby-pkg) to vendored local dep (web/vendor/) so the SPA builds in Docker and on other machines without the temp dir. - Vendor Orby v5.0.0 into web/vendor/ - Switch package.json dep to file:../vendor - Update Dockerfile to COPY vendor into build context - Use npm install instead of npm ci (file: deps need install) - Fix missing trailing newline in Dockerfile
51 lines
1.8 KiB
HTML
51 lines
1.8 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>Orby · Canvas example</title>
|
|
<link rel="stylesheet" href="./example.css" />
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<h1>Native canvas</h1>
|
|
<p>
|
|
One long-lived engine instance moves between semantic states while
|
|
preserving its seeded visual identity.
|
|
</p>
|
|
<div class="glyph-stage">
|
|
<canvas id="aiGlyph" width="440" height="440" aria-label="Animated AI state"></canvas>
|
|
</div>
|
|
<div class="actions" role="group" aria-label="Choose a semantic state">
|
|
<button type="button" data-sprite="ai.idle">Ready</button>
|
|
<button type="button" data-sprite="ai.thinking">Thinking</button>
|
|
<button type="button" data-sprite="ai.progress">Progress</button>
|
|
<button type="button" data-sprite="status.success">Done</button>
|
|
</div>
|
|
<p id="stateStatus" role="status">Current state: ai.idle</p>
|
|
</main>
|
|
|
|
<script type="module">
|
|
import { createGlyph } from "../src/joan-engine.js";
|
|
|
|
const glyph = createGlyph("#aiGlyph", {
|
|
sprite: "ai.idle",
|
|
seed: "self-service-example",
|
|
gridSize: 68,
|
|
});
|
|
const status = document.querySelector("#stateStatus");
|
|
|
|
document.querySelectorAll("[data-sprite]").forEach((button) => {
|
|
button.addEventListener("click", async () => {
|
|
const sprite = button.dataset.sprite;
|
|
status.textContent = `Transitioning to ${sprite}…`;
|
|
await glyph.transitionTo(sprite);
|
|
status.textContent = `Current state: ${sprite}`;
|
|
});
|
|
});
|
|
|
|
window.addEventListener("pagehide", () => glyph.destroy(), { once: true });
|
|
</script>
|
|
</body>
|
|
</html>
|