generated from Labyricorn/labyricorn-project-template
One commit for the work accumulated in the working tree since Step 6.3, which had never been split into per-step commits: - src/local-surfaces.js + src/surface-url.js (new); src/ui.js, src/validation.js, src/connection.js and public/index.html updated for local-surface hosting and generic surface rendering - tests: local-surfaces (20), scifi-surfaces (24) and postmessage-interop (7) new; connection/museum-gallery/surface-validation suites updated - reference exhibits: shared/contract-core.js defaults to Contract 5.3 (major 5, minor 3, xzbt 5.3); museum-gallery advertises its surface catalog; aquarium/haunted-house/planetarium adapters updated - SciFi-XZBT (Step 6.7A/6.7B): surface-mode.js + surface-bus.js, Observation-surface boot branch, local-change hooks, view.pillars / view.warp-flight targets; fixture byte-identical to G:/.vibe/SciFi-XZBT - SciFi-XZBT contract adapter handshake fix: the inbound bridge filter no longer gates on an exact advisory xzbt value (Contract 5.3 §6.5), only on its presence/type, matching the host's own envelope validation; the adapter now advertises contract minor 3 / version 5.3.0, which it already implemented via the 5.3 surfaces field. Root cause of the five failing postmessage-interop tests (host hello was silently dropped). - docs: architecture 6.4 and 6.7A, reference 6.6 and 6.7; evidence logs; test-fixtures/PROVENANCE.md resync record Test results: NGN 154/154 (was 149/154); postmessage-interop 7/7 (was 2/7); SciFi contract harness 21/21, real-adapter suite 32/32. git diff --check clean for changed files; two pre-existing trailing-whitespace lines remain in test-fixtures/reference-exhibits/scifi/index.html, copied verbatim from the authoritative SciFi source. Step 6.7 live verification (browser Observation, packaged standalone) is still pending and is not claimed here.
68 lines
2.7 KiB
JavaScript
68 lines
2.7 KiB
JavaScript
/*
|
|
* Museum Gallery — Information Wall boot (non-primary surface).
|
|
*
|
|
* Structurally identical in principle to artifact.boot.js: no Core here,
|
|
* only an attachment to the Control Room's Core over surface-bus.js, and a
|
|
* clear waiting state if that Core is not reachable.
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
|
|
var Shell = window.XZBTShell;
|
|
var el = Shell.el;
|
|
var statusEl = el('status');
|
|
var announcer = new Shell.Announcer({ node: el('announcement'), idleText: 'Waiting for shared state.' });
|
|
var toggleButton = el('toggle-button');
|
|
|
|
var ARTIFACT_LABELS = { 'the-orrery': 'The Orrery', 'star-map': 'Star Map', meteorite: 'Meteorite Fragment' };
|
|
|
|
var latest = null; // read-only mirror; see artifact.boot.js for the rationale
|
|
|
|
function render() {
|
|
if (!latest) return;
|
|
Shell.setText(el('artifact-name'), ARTIFACT_LABELS[latest['artifact.selected']] || latest['artifact.selected']);
|
|
Shell.setText(el('labels-readout'), latest['labels.enabled'] ? 'Labels: ON' : 'Labels: OFF');
|
|
}
|
|
|
|
var link = window.MuseumGallerySurfaceBus.attach({
|
|
timeoutMs: 1500,
|
|
onSnapshot: function (snapshot) {
|
|
latest = snapshot.values;
|
|
Shell.setText(statusEl, 'Attached to Control Room.');
|
|
statusEl.classList.remove('is-waiting');
|
|
toggleButton.disabled = false;
|
|
render();
|
|
},
|
|
onEvent: function (event) {
|
|
if (!latest) return;
|
|
if (event.type === 'state.changed' || event.type === 'selection.changed') {
|
|
latest[event.target] = event.value;
|
|
render();
|
|
} else if (event.type === 'action.executed' && event.target === 'action.spotlight-flash') {
|
|
announcer.flash('Spotlight flashed.');
|
|
}
|
|
},
|
|
onTimeout: function () {
|
|
Shell.setText(statusEl, 'Waiting for the Control Room surface to be open…');
|
|
statusEl.classList.add('is-waiting');
|
|
toggleButton.disabled = true;
|
|
}
|
|
});
|
|
|
|
toggleButton.addEventListener('click', function () {
|
|
if (!latest) return;
|
|
/* Same canonical mutation path proof as the Artifact Display's cycle
|
|
* button, exercising a boolean state target instead of a selection. */
|
|
link.mutate('set', 'labels.enabled', !latest['labels.enabled']);
|
|
});
|
|
|
|
/* Same rationale as artifact.boot.js: `__xzbtSurfaceDispose` is the
|
|
* deterministic path (called synchronously by local-surfaces.js right
|
|
* before it removes this frame); `beforeunload` remains only as a
|
|
* best-effort fallback for the cases NGN can't foresee (e.g. the tab
|
|
* closing on its own). detach() is idempotent either way. */
|
|
window.__xzbtSurfaceDispose = function () { link.detach(); };
|
|
window.addEventListener('beforeunload', function () { link.detach(); });
|
|
window.__museumGalleryDebug = { link: link };
|
|
})();
|