- cmms-bridge.js: wipeProjectData() clears the project object stores (devices,
boards, components, images, overlappedImages, nets, schemas, schemaComponents
— not the KiCad symbol library) and resets studio.js's shared globals before
the CMMS attachment ZIP is imported. The ZIP is the single source of truth for
a CMMS board, so restoreDevice()'s merge path (which only de-dupes on a newer
meta.lastModified, absent on CMMS-created boards) no longer accretes duplicate
image/net rows across repeated opens. init() also stamps data-theme=light as
well as =dark. All gated on PCBRETRACE_CONFIG — standalone untouched.
- schema.html: inline head script mirrors ?theme=light|dark (passed by studio.js
on the iframe src) onto <html> and, for light, injects cmms-schema-light.css.
Full no-op with no ?theme=.
- cmms-schema-light.css (new): [data-theme="light"]-gated override of
schema.html's :root palette for the CMMS light theme. Canvas stays dark.
- studio.js: append ?theme=<active> to the schema.html iframe src.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
New docs/cmms-bridge.js — inert unless window.PCBRETRACE_CONFIG is present
(only public/vendor/pcb-retrace/edit.php in the CMMS sets it). When set:
- injects "Save" / "Save & close" into the top bar; hides the standalone
import/export/share buttons.
- on boot, if config.loadUrl is set, pulls the project .pcbretrace.zip
from the CMMS and restores it silently (reuses processUrlImport).
- Save builds the whole-device ZIP in memory and POSTs it multipart to
the CMMS attachment endpoint (action/csrf/job_id/id/original_name/file,
same contract as circuit-edit.php); first save of a new board switches
to in-place updates.
studio.js:
- exportDeviceZIP() split into buildDeviceZIP(pass, forCmms) -> {blob,
filename} + a thin exportDeviceZIP() wrapper. forCmms adjusts the
embedded README + manifest.source.
- importFile/processZIP/processUrlImport take an opts arg; opts.silent
skips the restore/import confirms and re-throws instead of alert().
- init() awaits window.CMMS.init() at the end when present.
studio.html: loads cmms-bridge.js (defer, after studio.js).
Standalone pcb.etaras.com / local use is unchanged — every new path is
gated on the config object or opts.silent, both absent by default.
Dark mode: config.dark is recorded as data-theme="dark" but studio.html
is light-only today; CMMS-theme-follow is a later task.