teaching: run lessons in-app through an iframe-driven console

The teaching console now lives inside Web FreeCAD: web/teaching-console.html
hosts the workbench in a same-origin iframe and drives its DOM directly, with
no Node server and no spawned Chrome. The driver modules run in the framed
page's own realm (bridge.ts publishes window.__teaching), so the proven
driver/assembly code is reused unchanged and the CSP without 'unsafe-eval' is
never crossed.

- steps.ts globs both courses' ui-steps records (skipping their index.json
  manifests) so each lesson downloads only its own chunk
- runner.ts checks prerequisites in dependency order, then runs part or
  assembly lessons; a pass stores the FCStd in OPFS freecad-documents under
  the course document name, which is what assembly lessons consume
- assembly lessons insert, joint, solve and save through lib/assembly.mjs;
  insertLink falls back to UI-suffixed object names (Body1 for Body)
- check-inapp-console.mjs (npm run check:console-inapp) is green: preflight,
  P01 volume within 6e-13, OPFS evidence, both viewports
- run-inapp-lessons.mjs runs a whole course in one browser; reducer 23 parts
  + assembly and carrier 20 parts + assembly all pass in-browser

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 09:18:26 +08:00
parent 3a3077c089
commit fd37b92fd9
22 changed files with 7165 additions and 14 deletions

View File

@@ -0,0 +1,10 @@
// Standalone entry for /teaching-console.html.
import { createRoot } from "react-dom/client";
import { installNavigation, readNavigationContext } from "./navigation.js";
import { TeachingConsole } from "./teaching/console-page.js";
installNavigation("teaching-console", readNavigationContext());
const container = document.querySelector<HTMLDivElement>("#app");
if (!container) throw new Error("teaching console entry: #app container is missing");
createRoot(container).render(<TeachingConsole />);