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.
147 lines
4.8 KiB
JavaScript
147 lines
4.8 KiB
JavaScript
/*
|
|
* Museum Gallery — XZBT Exhibit Contract 5.3 adapter.
|
|
*
|
|
* Same three responsibilities as every other reference exhibit's adapter
|
|
* (declare the catalog, bind it to the real exhibit, hold no state of its
|
|
* own) plus one addition that only this exhibit needs: declaring the
|
|
* Contract 5.3 `surfaces` catalog (Section 31).
|
|
*
|
|
* This file constructs exactly ONE Exhibit State Core. It is loaded only by
|
|
* control.html — the primary surface — which is the sole owner of the Core
|
|
* this exhibit instance uses. artifact.html and info-wall.html never load
|
|
* this file; they attach to the Core that control.html created, over the
|
|
* exhibit-internal bus in surface-bus.js. See README.md for the full
|
|
* attachment-architecture writeup.
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
|
|
var Core = window.XZBTContractCore;
|
|
var Gallery = window.MuseumGalleryExhibit.Gallery;
|
|
var ARTIFACTS = window.MuseumGalleryExhibit.ARTIFACTS;
|
|
var ARTIFACT_LABELS = window.MuseumGalleryExhibit.ARTIFACT_LABELS;
|
|
|
|
var IDENTITY = {
|
|
product: 'Museum Gallery',
|
|
version: '0.1.0',
|
|
build: 'reference-exhibit'
|
|
};
|
|
|
|
var DESCRIPTORS = [
|
|
{
|
|
id: 'artifact.selected',
|
|
kind: 'selection',
|
|
label: 'Selected Artifact',
|
|
description: 'The artifact currently on display.',
|
|
options: ARTIFACTS.map(function (id) {
|
|
return { value: id, label: ARTIFACT_LABELS[id] };
|
|
}),
|
|
readable: true, writable: true, restorable: true,
|
|
category: 'gallery', requires: []
|
|
},
|
|
{
|
|
id: 'lighting.level',
|
|
kind: 'range',
|
|
label: 'Lighting Level',
|
|
description: 'Gallery lighting, 0 (dark) to 1 (full).',
|
|
min: 0, max: 1, step: 0.01,
|
|
readable: true, writable: true, restorable: true,
|
|
category: 'gallery', requires: []
|
|
},
|
|
{
|
|
id: 'rotation.speed',
|
|
kind: 'range',
|
|
label: 'Rotation Speed',
|
|
description: 'Turntable speed under the displayed artifact.',
|
|
min: 0, max: 2, step: 0.1,
|
|
readable: true, writable: true, restorable: true,
|
|
category: 'gallery', requires: []
|
|
},
|
|
{
|
|
id: 'labels.enabled',
|
|
kind: 'state',
|
|
valueType: 'boolean',
|
|
label: 'Labels Enabled',
|
|
description: 'Whether descriptive labels are shown on the wall and display.',
|
|
readable: true, writable: true, restorable: true,
|
|
category: 'gallery', requires: []
|
|
},
|
|
{
|
|
id: 'action.spotlight-flash',
|
|
kind: 'impulse',
|
|
label: 'Spotlight Flash',
|
|
description: 'Briefly flash a spotlight on the current artifact.',
|
|
readable: false, writable: false, restorable: false,
|
|
category: 'action', requires: [], arguments: []
|
|
}
|
|
];
|
|
|
|
/* Contract 5.3 §31.2 surface descriptors. surface.control is primary. */
|
|
var SURFACES = [
|
|
{
|
|
id: 'surface.control', label: 'Control Room', kind: 'surface',
|
|
primary: true, url: 'control.html', role: 'control'
|
|
},
|
|
{
|
|
id: 'surface.artifact', label: 'Artifact Display', kind: 'surface',
|
|
primary: false, url: 'artifact.html', role: 'ambient'
|
|
},
|
|
{
|
|
id: 'surface.info-wall', label: 'Information Wall', kind: 'surface',
|
|
primary: false, url: 'info-wall.html', role: 'information'
|
|
}
|
|
];
|
|
|
|
function createMuseumGalleryContract(gallery) {
|
|
var catalog = new Core.Catalog(DESCRIPTORS);
|
|
|
|
var capabilities = new Core.CapabilityRegistry();
|
|
capabilities.declare('render', 'ready');
|
|
|
|
var surfaces = new Core.SurfaceCatalog(SURFACES);
|
|
|
|
var setters = {
|
|
'artifact.selected': function (v) { return gallery.setArtifact(v); },
|
|
'lighting.level': function (v) { return gallery.setLightingLevel(v); },
|
|
'rotation.speed': function (v) { return gallery.setRotationSpeed(v); },
|
|
'labels.enabled': function (v) { return gallery.setLabelsEnabled(v); }
|
|
};
|
|
|
|
var readers = {};
|
|
var ids = catalog.ids();
|
|
for (var i = 0; i < ids.length; i++) {
|
|
(function (id) {
|
|
readers[id] = function () { return gallery.read(id); };
|
|
})(ids[i]);
|
|
}
|
|
|
|
var actions = {
|
|
'action.spotlight-flash': function () { return gallery.flashSpotlight(); }
|
|
};
|
|
|
|
var core = new Core.ContractCore({
|
|
identity: IDENTITY,
|
|
catalog: catalog,
|
|
capabilities: capabilities,
|
|
setters: setters,
|
|
readers: readers,
|
|
actions: actions,
|
|
/* contractMinor/xzbtVersion are intentionally omitted: the shared
|
|
* contract-core.js now defaults every exhibit to Contract 5.3, and
|
|
* Museum Gallery has no reason to override that default. `surfaces`
|
|
* is the one thing that makes this exhibit's contract usage different
|
|
* from the others -- Contract 5.3 §31 presentation surfaces. */
|
|
surfaces: surfaces
|
|
});
|
|
|
|
return core;
|
|
}
|
|
|
|
window.MuseumGalleryContract = {
|
|
create: createMuseumGalleryContract,
|
|
IDENTITY: IDENTITY,
|
|
DESCRIPTORS: DESCRIPTORS,
|
|
SURFACES: SURFACES
|
|
};
|
|
})();
|