1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Desktop Settings — Prototype 9 (engine room, Dupre Kit)</title>
<link rel="stylesheet" href="desktop-settings-shared.css">
<style>
/* Dupre Kit token set (from the gallery :root / tokens.json) — the kit
builders read these; they override the shared prototype gold. */
:root{
--ground:#151311; --panel:#100f0f; --well:#0a0c0d; --raise:#1a1917;
--silver:#bfc4d0; --cream:#f3e7c5; --steel:#969385; --dim:#7c838a;
--slate:#424f5e; --slate-hi:#54677d; --wash:#2c2f32;
--pass:#74932f; --fail:#cb6b4d;
--phos:#7fe0a0; --phos-dim:#1c3626; --vfd:#63e6c8;
--sevgrn:#57d357; --sevred:#e2543f; --sevoff:#1a1613;
--jewel-r:#ff5b45; --jewel-a:#ffb43a; --jewel-g:#6fce33;
--gold:#e2a038; --gold-hi:#ffbe54;
--amber-grad-top:#f2c76a; --amber-grad-mid:#d29638; --amber-grad-bot:#8f671f;
--amber-edge:#7d5c16; --amber-warn:#f0b552;
--glow-hi:255,190,84; --glow-lo:226,160,56;
--mono:"BerkeleyMono Nerd Font","Berkeley Mono",monospace;
--pulse-rate:1s;
}
.row { display: flex; justify-content: center; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
/* kit spans that carry width/height need block layout outside the gallery */
.dupre-rotsel, .dupre-keylock { display: inline-block; }
.cellcap { color: var(--steel); font-size: 9px; letter-spacing: 0.14em; text-align: center; margin-top: 2px; }
.flap-well { display: flex; justify-content: center; padding: 6px 0 2px; pointer-events: none; }
</style>
</head>
<body class="ds-stage">
<div class="ds-caption">
<b>Direction 9 — Engine room (Dupre Kit).</b> Real kit instruments: the
DRUM ROLLER sets both levels (drag the drums), a split-flap board reads the
scene tuned on the rotary selector, breaker panels carry the toggles,
airplane is a guarded lever, power is an engine-order telegraph (click to
ring the next order). Lock/suspend/wallpaper are arm-to-fire.
</div>
<div class="ds-bar"><span>19:24</span><span class="gear">⚙</span></div>
<div class="ds-panel" id="panel">
<div class="ds-face">
<span class="glyph">⚙</span>
<span class="title">Settings</span>
<span class="sub" id="scene-sub"></span>
<span class="x">✕</span>
</div>
<div id="body"></div>
<div class="ds-toast" id="toast"></div>
<div class="ds-subview" id="subview"></div>
</div>
<script src="widgets.js"></script>
<script src="dupre-kit-additions.js"></script>
<script src="desktop-settings-shared.js"></script>
<script>
const h = DS.h;
const body = document.getElementById("body");
const subview = document.getElementById("subview");
DS.bindToast(document.getElementById("toast"));
const SCENES = Object.keys(DS.SCENES); // 4 names
const SEL = ["OFF", "FOCUS", "PRESENT", "BATTERY", "NIGHT"]; // rotary detents
let booting = true;
function openWallpaper() {
subview.innerHTML = "";
subview.appendChild(DS.wallpaperSubview(() => subview.classList.remove("open")));
subview.classList.add("open");
}
function sceneOff() {
DS.state.scene = null;
DS.toast("Scene: off", true);
render();
}
const debounce = (fn, ms) => { let t; return (...a) => { clearTimeout(t); t = setTimeout(() => fn(...a), ms); }; };
// breakerPanel has no set(): sync its hardcoded initial states to DS by
// clicking the transparent hit rects while booting swallows the onChange.
function breakers(names, keys) {
const host = h("div");
const bp = DUPRE.breakerPanel(host, {
names,
onChange: (states) => {
if (booting) return;
states.forEach((st, i) => {
const on = st === "on";
if (on !== DS.state[keys[i]]) DS.setToggle(keys[i], host);
});
},
});
const hits = host.querySelectorAll('rect[fill="transparent"]');
bp.get().forEach((st, i) => {
if ((st === "on") !== DS.state[keys[i]])
hits[i].dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
return host;
}
function render() {
booting = true;
body.innerHTML = "";
const col = h("div", "ds-col");
// Scenes: split-flap reads the tuned scene, rotary selector picks it.
col.appendChild(DS.engrave("Scene board"));
const flapWell = h("div", "flap-well");
const flap = DUPRE.splitFlap(flapWell, { cells: 8, animate: true, flapMs: 60 });
const BOARD = { Focus: "FOCUS", Presentation: "PRESENT", Battery: "BATTERY", Night: "NIGHT" };
flap.setText(DS.state.scene ? BOARD[DS.state.scene] : "STANDBY");
col.appendChild(flapWell);
const selRow = h("div", "row");
const selHost = h("div");
DUPRE.rotarySelector(selHost, {
values: SEL,
index: DS.state.scene ? SCENES.indexOf(DS.state.scene) + 1 : 0,
onChange: (v) => {
if (booting) return;
if (v === "OFF") sceneOff();
else DS.applyScene(SCENES[SEL.indexOf(v) - 1], selHost);
},
});
selRow.appendChild(selHost);
selRow.appendChild(Object.assign(h("div", "cellcap", "SCENE SELECT"), { style: "align-self:center" }));
col.appendChild(selRow);
// Levels: the drum roller (Craig favorite #1) — drums are 1-10, ×10 = percent.
col.appendChild(DS.engrave("Levels"));
const drumRow = h("div", "row");
const drumHost = h("div");
const commitDrums = debounce((vals) => {
const b = Math.round(vals[0]) * 10, k = Math.round(vals[1]) * 10;
if (b !== DS.state.brightness) DS.setSlider("brightness", b, drumHost);
if (k !== DS.state.kbd) DS.setSlider("kbd", k, drumHost);
}, 350);
DUPRE.drumRoller(drumHost, {
title: "LEVELS ×10",
channels: [
{ name: "BRIGHT", v: Math.max(1, Math.round(DS.state.brightness / 10)) },
{ name: "KBD", v: Math.max(1, Math.round(DS.state.kbd / 10)) },
],
onChange: (vals) => { if (!booting) commitDrums(vals); },
});
drumRow.appendChild(drumHost);
drumRow.appendChild(h("div"));
drumRow.lastChild.appendChild(h("div", "cellcap", "DRAG DRUM"));
col.appendChild(drumRow);
// Toggles: breaker panels + a guarded lever for airplane.
col.appendChild(DS.engrave("Breakers"));
const brRow = h("div", "row");
brRow.appendChild(breakers(["DIM", "CAFF", "TPAD", "MOUSE"], ["autodim", "caffeine", "touchpad", "mouse"]));
brRow.appendChild(breakers(["NIGHT", "DND", "WXGEO"], ["nightlight", "dnd", "weathergeo"]));
col.appendChild(brRow);
if (DS.state.laptop) {
const gRow = h("div", "row");
const gHost = h("div");
DUPRE.guardedToggle(gHost, {
on: DS.state.airplane,
onLabel: "AIRPLANE",
offLabel: "RADIO OK",
onChange: (on) => { if (!booting && on !== DS.state.airplane) DS.setToggle("airplane", gHost); },
});
gRow.appendChild(gHost);
col.appendChild(gRow);
}
// Power: engine-order telegraph — ring the next order.
col.appendChild(DS.engrave("Engine order — power"));
const tRow = h("div", "row");
const tHost = h("div");
DUPRE.telegraphIndicator(tHost, {
states: ["PERF", "BAL", "SAVER"],
index: DS.PROFILES.findIndex((p) => p.id === DS.state.powerprofile),
onChange: (i) => { if (!booting) DS.setProfile(DS.PROFILES[i].id, tHost); },
});
tRow.appendChild(tHost);
col.appendChild(tRow);
// Actions: arm-to-fire.
col.appendChild(DS.engrave("Actions"));
const aRow = h("div", "row");
[["LOCK", () => DS.momentary("Lock")],
["SUSPEND", () => DS.momentary("Suspend")],
["WALLPAPER", openWallpaper]].forEach(([label, fn]) => {
const host = h("div");
DUPRE.armButton(host, {
label,
armLabel: label + "?",
onChange: (st) => { if (!booting && st === "fired") fn(); },
});
aRow.appendChild(host);
});
col.appendChild(aRow);
body.appendChild(col);
document.getElementById("scene-sub").textContent = DS.state.scene ? "▶ " + DS.state.scene : "";
booting = false;
}
DS.onChange(render);
render();
</script>
</body>
</html>
|