@typeonce/ritmo-browser 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +6 -1
  3. package/dist/Controls.d.ts +495 -0
  4. package/dist/Controls.d.ts.map +1 -0
  5. package/dist/Controls.js +343 -0
  6. package/dist/Controls.js.map +1 -0
  7. package/dist/Gamepad.d.ts +375 -0
  8. package/dist/Gamepad.d.ts.map +1 -0
  9. package/dist/Gamepad.js +452 -0
  10. package/dist/Gamepad.js.map +1 -0
  11. package/dist/InputCapture.d.ts +46 -16
  12. package/dist/InputCapture.d.ts.map +1 -1
  13. package/dist/InputCapture.js +1 -1
  14. package/dist/InputCapture.js.map +1 -1
  15. package/dist/Keyboard.d.ts +184 -21
  16. package/dist/Keyboard.d.ts.map +1 -1
  17. package/dist/Keyboard.js +257 -91
  18. package/dist/Keyboard.js.map +1 -1
  19. package/dist/Pointer.d.ts +231 -62
  20. package/dist/Pointer.d.ts.map +1 -1
  21. package/dist/Pointer.js +205 -145
  22. package/dist/Pointer.js.map +1 -1
  23. package/dist/Touch.d.ts +73 -27
  24. package/dist/Touch.d.ts.map +1 -1
  25. package/dist/Touch.js +25 -30
  26. package/dist/Touch.js.map +1 -1
  27. package/dist/index.d.ts +10 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +10 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/internal/buttons.d.ts +52 -0
  32. package/dist/internal/buttons.d.ts.map +1 -0
  33. package/dist/internal/buttons.js +211 -0
  34. package/dist/internal/buttons.js.map +1 -0
  35. package/dist/internal/introspect.d.ts +14 -0
  36. package/dist/internal/introspect.d.ts.map +1 -0
  37. package/dist/internal/introspect.js +19 -0
  38. package/dist/internal/introspect.js.map +1 -0
  39. package/dist/internal/used.d.ts +8 -0
  40. package/dist/internal/used.d.ts.map +1 -0
  41. package/dist/internal/used.js +14 -0
  42. package/dist/internal/used.js.map +1 -0
  43. package/dist/internal/vectors.d.ts +24 -0
  44. package/dist/internal/vectors.d.ts.map +1 -0
  45. package/dist/internal/vectors.js +22 -0
  46. package/dist/internal/vectors.js.map +1 -0
  47. package/package.json +4 -3
  48. package/src/Controls.ts +799 -0
  49. package/src/Gamepad.ts +747 -0
  50. package/src/InputCapture.ts +43 -24
  51. package/src/Keyboard.ts +395 -68
  52. package/src/Pointer.ts +392 -164
  53. package/src/Touch.ts +111 -54
  54. package/src/index.ts +10 -1
  55. package/src/internal/buttons.ts +222 -0
  56. package/src/internal/introspect.ts +23 -0
  57. package/src/internal/used.ts +14 -0
  58. package/src/internal/vectors.ts +36 -0
@@ -0,0 +1,452 @@
1
+ import * as Result from "@typeonce/ritmo/Result";
2
+ import * as ButtonsInternal from "./internal/buttons.js";
3
+ import { buttonTracker, flattenButtons, idleActions, idleButtons, idleVectors, splitActions } from "./internal/buttons.js";
4
+ import { digital, isVectorBinding, longer } from "./internal/vectors.js";
5
+ import { anyUsed } from "./internal/used.js";
6
+ /**
7
+ * The buttons of the browser's standard mapping, in index order: face
8
+ * buttons by compass position, bumpers and triggers, the two small center
9
+ * buttons, the stick clicks, the d-pad, and the home button.
10
+ */
11
+ export const buttonNames = [
12
+ "south",
13
+ "east",
14
+ "west",
15
+ "north",
16
+ "leftBumper",
17
+ "rightBumper",
18
+ "leftTrigger",
19
+ "rightTrigger",
20
+ "select",
21
+ "start",
22
+ "leftStick",
23
+ "rightStick",
24
+ "dpadUp",
25
+ "dpadDown",
26
+ "dpadLeft",
27
+ "dpadRight",
28
+ "home"
29
+ ];
30
+ /**
31
+ * Binds a vector action to a stick, to buttons for its four directions, or
32
+ * to both. The snapshot's `vectors` reports the longer of the two: the
33
+ * stick keeps its tilt (after the dead zone), and the buttons give length 1
34
+ * (a diagonal is not faster).
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const bindings = {
39
+ * move: Gamepad.vector({ stick: "left", up: ["dpadUp"], down: ["dpadDown"], left: ["dpadLeft"], right: ["dpadRight"] }),
40
+ * jump: ["south"]
41
+ * } as const
42
+ * ```
43
+ */
44
+ export const vector = (binding) => ({ _tag: "Vector", ...binding });
45
+ const zero = { x: 0, y: 0 };
46
+ /**
47
+ * A snapshot with nothing held and no pad, for initializing an input
48
+ * resource before the first capture.
49
+ */
50
+ export const idle = (bindings) => {
51
+ return { actions: idleActions(bindings), vectors: idleVectors(bindings), buttons: idleButtons(buttonNames), left: zero, right: zero, leftTrigger: 0, rightTrigger: 0, used: false, connected: false, id: null };
52
+ };
53
+ const sameVector = (a, b) => a.x === b.x && a.y === b.y;
54
+ /** Removes the dead zone and rescales, so the stick goes from zero to full tilt smoothly. */
55
+ const stick = (x, y, deadZone) => {
56
+ const length = Math.sqrt(x * x + y * y);
57
+ if (length <= deadZone)
58
+ return zero;
59
+ const scaled = Math.min(1, (length - deadZone) / (1 - deadZone));
60
+ return { x: (x / length) * scaled, y: (y / length) * scaled };
61
+ };
62
+ /** The button tracker with the pad's analog state, shared by live and scripted actions. */
63
+ const tracker = (initial) => {
64
+ // Vector actions are tracked as their four directions, next to the button actions.
65
+ let bindings = initial;
66
+ const buttons = buttonTracker(buttonNames, flattenButtons(initial));
67
+ return {
68
+ held: buttons.held,
69
+ down: buttons.down,
70
+ up: buttons.up,
71
+ upAll: buttons.upAll,
72
+ rebind(next) {
73
+ bindings = next;
74
+ buttons.rebind(flattenButtons(next));
75
+ },
76
+ snapshot(analog) {
77
+ const taken = buttons.take();
78
+ // The actions are fixed at creation; a rebind only changes how each is bound.
79
+ const { actions, held } = splitActions(initial, taken.actions);
80
+ const vectors = {};
81
+ for (const [name, entry] of Object.entries(initial)) {
82
+ if (!isVectorBinding(entry))
83
+ continue;
84
+ const binding = bindings[name];
85
+ const pad = digital(held(name, "up"), held(name, "down"), held(name, "left"), held(name, "right"));
86
+ vectors[name] = binding.stick === undefined ? pad : longer(analog[binding.stick], pad);
87
+ }
88
+ const used = anyUsed(taken.buttons) || !sameVector(analog.left, zero) || !sameVector(analog.right, zero);
89
+ return { actions, vectors, buttons: taken.buttons, ...analog, used };
90
+ }
91
+ };
92
+ };
93
+ /** Whether a pad is being touched: a button down or a stick past the dead zone. */
94
+ const inUse = (pad, deadZone, triggerThreshold) => pad.buttons.some((button, index) => isDown(button, index, triggerThreshold)) ||
95
+ // Only the sticks' axes: some pads report their triggers as extra axes resting at -1.
96
+ pad.axes.slice(0, 4).some((axis) => Math.abs(axis) > deadZone);
97
+ const triggerIndices = new Set([6, 7]);
98
+ const isDown = (button, index, triggerThreshold) => triggerIndices.has(index) ? button.value >= triggerThreshold : button.pressed;
99
+ /** Reads the pads, treating a host that throws (a blocked permission policy) as having none. */
100
+ const readPads = (host) => {
101
+ try {
102
+ return host.navigator.getGamepads();
103
+ }
104
+ catch {
105
+ return [];
106
+ }
107
+ };
108
+ /**
109
+ * Starts reading pads from `host`, usually `window`, on every animation
110
+ * frame until `dispose()`. With several pads connected it follows the one
111
+ * used last; switching pads, or the followed pad disconnecting, releases
112
+ * everything it held. Use {@link pads} to give each pad its own player.
113
+ */
114
+ export const actions = (host, bindings, options = {}) => {
115
+ const deadZone = options.deadZone ?? 0.15;
116
+ const triggerThreshold = options.triggerThreshold ?? 0.5;
117
+ const state = tracker(bindings);
118
+ let followed = null;
119
+ let disposed = false;
120
+ let reading = null;
121
+ let frame = 0;
122
+ const poll = () => {
123
+ if (disposed)
124
+ return;
125
+ const pads = readPads(host).filter((pad) => pad !== null && pad.connected);
126
+ const current = pads.find((pad) => pad.index === followed);
127
+ // Keep the followed pad while it is in use; otherwise switch to another one being used, or keep the first there is.
128
+ const used = current !== undefined && inUse(current, deadZone, triggerThreshold)
129
+ ? current
130
+ : pads.find((pad) => pad.index !== followed && inUse(pad, deadZone, triggerThreshold));
131
+ const next = used ?? current ?? pads[0];
132
+ if (next?.index !== followed)
133
+ state.upAll();
134
+ followed = next?.index ?? null;
135
+ reading = next ?? null;
136
+ if (next === undefined)
137
+ return;
138
+ readButtons(state, next, triggerThreshold);
139
+ };
140
+ const onFrame = () => {
141
+ if (disposed)
142
+ return;
143
+ poll();
144
+ frame = host.requestAnimationFrame(onFrame);
145
+ };
146
+ frame = host.requestAnimationFrame(onFrame);
147
+ return {
148
+ snapshot() {
149
+ poll();
150
+ const pad = reading;
151
+ if (pad === null)
152
+ return state.snapshot({ ...resting, connected: false, id: null });
153
+ return state.snapshot({ ...analogOf(pad, deadZone), connected: true, id: pad.id });
154
+ },
155
+ rebind: state.rebind,
156
+ dispose() {
157
+ if (disposed)
158
+ return;
159
+ disposed = true;
160
+ host.cancelAnimationFrame(frame);
161
+ reading = null;
162
+ state.upAll();
163
+ }
164
+ };
165
+ };
166
+ /** Presses and releases `state`'s buttons as `pad` reads now. */
167
+ const readButtons = (state, pad, triggerThreshold) => {
168
+ for (let index = 0; index < buttonNames.length; index++) {
169
+ const button = pad.buttons[index];
170
+ const name = buttonNames[index];
171
+ if (button !== undefined && isDown(button, index, triggerThreshold))
172
+ state.down(name);
173
+ else
174
+ state.up(name);
175
+ }
176
+ };
177
+ /** A pad's sticks (dead zone removed) and triggers. */
178
+ const analogOf = (pad, deadZone) => {
179
+ const axis = (index) => pad.axes[index] ?? 0;
180
+ const trigger = (index) => Math.min(1, Math.max(0, pad.buttons[index]?.value ?? 0));
181
+ return {
182
+ left: stick(axis(0), axis(1), deadZone),
183
+ right: stick(axis(2), axis(3), deadZone),
184
+ leftTrigger: trigger(6),
185
+ rightTrigger: trigger(7)
186
+ };
187
+ };
188
+ const resting = { left: zero, right: zero, leftTrigger: 0, rightTrigger: 0 };
189
+ /**
190
+ * Starts reading every pad on `host`, usually `window`, up to `max` of
191
+ * them, each with its own presses and sticks; pads beyond `max` are
192
+ * ignored. A pad keeps its place in the list while unplugged; one that comes
193
+ * back at the same browser index continues it, and a different pad at that
194
+ * index takes the place over with nothing held.
195
+ */
196
+ export const pads = (host, bindings, max, options = {}) => {
197
+ const deadZone = options.deadZone ?? 0.15;
198
+ const triggerThreshold = options.triggerThreshold ?? 0.5;
199
+ const seen = [];
200
+ let disposed = false;
201
+ let frame = 0;
202
+ const poll = () => {
203
+ if (disposed)
204
+ return;
205
+ const connected = readPads(host).filter((pad) => pad !== null && pad.connected);
206
+ for (const pad of connected) {
207
+ if (seen.length < max && !seen.some((entry) => entry.index === pad.index)) {
208
+ seen.push({ index: pad.index, state: tracker(bindings), id: pad.id, reading: null });
209
+ }
210
+ }
211
+ for (const entry of seen) {
212
+ const pad = connected.find((reading) => reading.index === entry.index);
213
+ // Unplugged, or another pad took the index: everything it held is released.
214
+ if (pad === undefined || pad.id !== entry.id) {
215
+ if (entry.reading !== null)
216
+ entry.state.upAll();
217
+ entry.reading = null;
218
+ if (pad === undefined)
219
+ continue;
220
+ entry.id = pad.id;
221
+ }
222
+ entry.reading = pad;
223
+ readButtons(entry.state, pad, triggerThreshold);
224
+ }
225
+ };
226
+ const onFrame = () => {
227
+ if (disposed)
228
+ return;
229
+ poll();
230
+ frame = host.requestAnimationFrame(onFrame);
231
+ };
232
+ frame = host.requestAnimationFrame(onFrame);
233
+ return {
234
+ _tag: "Pads",
235
+ max,
236
+ snapshot() {
237
+ poll();
238
+ return seen.map((entry) => entry.state.snapshot(entry.reading === null
239
+ ? { ...resting, connected: false, id: entry.id }
240
+ : { ...analogOf(entry.reading, deadZone), connected: true, id: entry.id }));
241
+ },
242
+ rebind(next) {
243
+ for (const entry of seen)
244
+ entry.state.rebind(next);
245
+ // Pads that appear later start with the new bindings too.
246
+ bindings = next;
247
+ },
248
+ dispose() {
249
+ if (disposed)
250
+ return;
251
+ disposed = true;
252
+ host.cancelAnimationFrame(frame);
253
+ for (const entry of seen)
254
+ entry.state.upAll();
255
+ }
256
+ };
257
+ };
258
+ /**
259
+ * Pads driven by timelines instead of a host, one timeline per pad (as
260
+ * {@link scripted}), each with the id `scripted <n>` (from `scripted 1`)
261
+ * and `max` the number of timelines: for tests of games where every player
262
+ * has a pad.
263
+ */
264
+ export const scriptedPads = (bindings, timelines) => {
265
+ const each = timelines.map((timeline) => scripted(bindings, timeline));
266
+ return {
267
+ _tag: "Pads",
268
+ max: each.length,
269
+ snapshot: () => each.map((pad, index) => ({ ...pad.snapshot(), id: `scripted ${index + 1}` })),
270
+ rebind(next) {
271
+ for (const pad of each)
272
+ pad.rebind(next);
273
+ },
274
+ dispose() { }
275
+ };
276
+ };
277
+ /**
278
+ * Plays `timeline`: before the snapshot at index `frame`, every entry for
279
+ * that frame is applied. A pad counts as connected (with the id
280
+ * `"scripted"`) from the first entry on, until an entry says
281
+ * `connected: false`; `scripted(bindings, [])` is a pad that never connects.
282
+ * Buttons stay held from their press until their release; pressing a held
283
+ * button is not a new press.
284
+ */
285
+ export const scripted = (bindings, timeline) => {
286
+ const state = tracker(bindings);
287
+ const byFrame = new Map();
288
+ for (const entry of timeline) {
289
+ const entries = byFrame.get(entry.frame);
290
+ if (entries)
291
+ entries.push(entry);
292
+ else
293
+ byFrame.set(entry.frame, [entry]);
294
+ }
295
+ const first = timeline.reduce((earliest, entry) => Math.min(earliest, entry.frame), Number.POSITIVE_INFINITY);
296
+ const resting = { left: zero, right: zero, leftTrigger: 0, rightTrigger: 0 };
297
+ let analog = resting;
298
+ let connected = false;
299
+ let frame = 0;
300
+ return {
301
+ snapshot() {
302
+ for (const entry of byFrame.get(frame) ?? []) {
303
+ const releases = new Set(entry.release ?? []);
304
+ for (const button of entry.press ?? []) {
305
+ if (state.held.has(button) && releases.has(button)) {
306
+ // Released and pressed again within the frame.
307
+ releases.delete(button);
308
+ state.up(button);
309
+ }
310
+ state.down(button);
311
+ }
312
+ for (const button of releases)
313
+ state.up(button);
314
+ analog = {
315
+ left: entry.left ?? analog.left,
316
+ right: entry.right ?? analog.right,
317
+ leftTrigger: entry.leftTrigger ?? analog.leftTrigger,
318
+ rightTrigger: entry.rightTrigger ?? analog.rightTrigger
319
+ };
320
+ connected = entry.connected ?? (frame === first ? true : connected);
321
+ if (!connected) {
322
+ state.upAll();
323
+ analog = resting;
324
+ }
325
+ }
326
+ frame += 1;
327
+ return state.snapshot({ ...analog, connected, id: connected ? "scripted" : null });
328
+ },
329
+ rebind: state.rebind,
330
+ dispose() { },
331
+ frames: () => frame
332
+ };
333
+ };
334
+ /**
335
+ * Wraps `actions` and records, for every snapshot, the buttons pressed and
336
+ * released since the previous one and the sticks and triggers that moved.
337
+ */
338
+ export const recording = (actions) => {
339
+ const entries = [];
340
+ let previous = { buttons: idleButtons(buttonNames), left: zero, right: zero, leftTrigger: 0, rightTrigger: 0, connected: false };
341
+ let frame = 0;
342
+ return {
343
+ snapshot() {
344
+ const snapshot = actions.snapshot();
345
+ const press = buttonNames.filter((name) => snapshot.buttons[name].pressed);
346
+ // A press of a button held at the previous snapshot means it was released in between.
347
+ const release = buttonNames.filter((name) => snapshot.buttons[name].released || (snapshot.buttons[name].pressed && previous.buttons[name].held));
348
+ const entry = {
349
+ ...(press.length > 0 ? { press } : {}),
350
+ ...(release.length > 0 ? { release } : {}),
351
+ ...(sameVector(snapshot.left, previous.left) ? {} : { left: snapshot.left }),
352
+ ...(sameVector(snapshot.right, previous.right) ? {} : { right: snapshot.right }),
353
+ ...(snapshot.leftTrigger === previous.leftTrigger ? {} : { leftTrigger: snapshot.leftTrigger }),
354
+ ...(snapshot.rightTrigger === previous.rightTrigger ? {} : { rightTrigger: snapshot.rightTrigger }),
355
+ // The first entry connects the pad by itself; later changes are written out.
356
+ ...(snapshot.connected === previous.connected || entries.length === 0 ? {} : { connected: snapshot.connected })
357
+ };
358
+ // The first entry also marks when a pad appeared, so a replay connects on the same frame.
359
+ if (Object.keys(entry).length > 0 || (entries.length === 0 && snapshot.connected))
360
+ entries.push({ frame, ...entry });
361
+ previous = snapshot;
362
+ frame += 1;
363
+ return snapshot;
364
+ },
365
+ rebind: (bindings) => actions.rebind(bindings),
366
+ dispose: () => actions.dispose(),
367
+ timeline: () => [...entries]
368
+ };
369
+ };
370
+ const buttonSet = new Set(buttonNames);
371
+ /** Whether `name` is a button of the standard mapping, for validating stored bindings. */
372
+ export const isButton = (name) => typeof name === "string" && buttonSet.has(name);
373
+ /**
374
+ * Validates untrusted data, such as a parsed JSON file, as a timeline: an
375
+ * array of entries with a non-negative integer `frame`, optional
376
+ * `press`/`release` arrays of button names, optional `left`/`right` vectors
377
+ * of length at most 1, optional triggers from 0 to 1, and an optional
378
+ * boolean `connected`.
379
+ */
380
+ export const parseTimeline = (data) => {
381
+ const invalid = (path, message) => Result.failure({ _tag: "InvalidTimeline", path, message });
382
+ if (!Array.isArray(data))
383
+ return invalid("", "expected an array of entries");
384
+ const entries = [];
385
+ for (let index = 0; index < data.length; index++) {
386
+ const entry = data[index];
387
+ const path = `[${index}]`;
388
+ if (typeof entry !== "object" || entry === null)
389
+ return invalid(path, "expected an object");
390
+ const fields = entry;
391
+ const frame = fields["frame"];
392
+ if (typeof frame !== "number" || !Number.isInteger(frame) || frame < 0)
393
+ return invalid(`${path}.frame`, "expected a non-negative integer");
394
+ const parsed = { frame };
395
+ for (const field of ["press", "release"]) {
396
+ const value = fields[field];
397
+ if (value === undefined)
398
+ continue;
399
+ if (!Array.isArray(value))
400
+ return invalid(`${path}.${field}`, "expected an array of button names");
401
+ for (let offset = 0; offset < value.length; offset++) {
402
+ if (!isButton(value[offset]))
403
+ return invalid(`${path}.${field}[${offset}]`, `expected one of ${buttonNames.join(", ")}`);
404
+ }
405
+ parsed[field] = [...value];
406
+ }
407
+ for (const field of ["left", "right"]) {
408
+ const value = fields[field];
409
+ if (value === undefined)
410
+ continue;
411
+ const { x, y } = (typeof value === "object" && value !== null ? value : {});
412
+ if (typeof x !== "number" || typeof y !== "number" || !Number.isFinite(x) || !Number.isFinite(y) || x * x + y * y > 1 + 1e-9) {
413
+ return invalid(`${path}.${field}`, "expected { x, y } of length at most 1");
414
+ }
415
+ parsed[field] = { x, y };
416
+ }
417
+ for (const field of ["leftTrigger", "rightTrigger"]) {
418
+ const value = fields[field];
419
+ if (value === undefined)
420
+ continue;
421
+ if (typeof value !== "number" || !(value >= 0 && value <= 1))
422
+ return invalid(`${path}.${field}`, "expected a number from 0 to 1");
423
+ parsed[field] = value;
424
+ }
425
+ const connected = fields["connected"];
426
+ if (connected !== undefined) {
427
+ if (typeof connected !== "boolean")
428
+ return invalid(`${path}.connected`, "expected a boolean");
429
+ parsed["connected"] = connected;
430
+ }
431
+ entries.push(parsed);
432
+ }
433
+ return Result.success(entries);
434
+ };
435
+ /**
436
+ * Validates untrusted data, such as saved settings parsed from JSON, as new
437
+ * buttons for `bindings`: an object with exactly the same action names, each
438
+ * mapped to a non-empty array of button names (for a vector action, an
439
+ * object with an optional `stick` and buttons for all four directions or
440
+ * none, as `Gamepad.vector` saves). Pass the result to
441
+ * {@link Actions.rebind}; on failure, keep the defaults.
442
+ *
443
+ * @example
444
+ * ```ts
445
+ * const saved = Gamepad.parseRebinding(bindings, JSON.parse(stored))
446
+ * if (saved.ok) pad.rebind(saved.value)
447
+ * ```
448
+ */
449
+ export const parseRebinding = (bindings, data) =>
450
+ // The checked names and buttons are exactly `Rebinding<B>`.
451
+ ButtonsInternal.parseButtonRebinding(buttonNames, bindings, data, ["left", "right"]);
452
+ //# sourceMappingURL=Gamepad.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Gamepad.js","sourceRoot":"","sources":["../src/Gamepad.ts"],"names":[],"mappings":"AAyDA,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAA;AAIhD,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAC1H,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,YA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AAK,SAAS,EAAE,CAAC;YAC5B,IAAI,OAAO,SAAS,KAAK,SAAS;gBAAE,OAAO,OAAO,CAAC,GAAG,IAAI,YAAY,EAAE,oBAAoB,CAAC,CAAA;YAC7F,MAAM,CAAC,WAAW,CAAC,GAAG,SAAS,CAAA;QACjC,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,MAAkC,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC,CAAA;AAQD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,QAAW,EACX,IAAa,EACkC,EAAE;AACjD,4DAA4D;AAC5D,eAAe,CAAC,oBAAoB,CAAC,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAkD,CAAA"}
@@ -8,12 +8,22 @@
8
8
  * every system in that run reads the same snapshot and press edges are
9
9
  * observed exactly once per run.
10
10
  *
11
- * The source is any service with `snapshot()`: `Keyboard.actions(...)`
12
- * directly, or a game-specific adapter that merges several devices. The
13
- * resource's value type must be exactly the snapshot type.
11
+ * The source is any service with `snapshot()`: one device such as
12
+ * `Keyboard.actions(...)`, a `Controls` merge of several, or a
13
+ * `Controls.players(...)` pool. The resource's
14
+ * value type must be exactly the snapshot type (declare it as
15
+ * `InputCapture.SnapshotOf<typeof Source>`): not a wider type, and not one
16
+ * with extra optional fields.
14
17
  *
15
- * Its spec is erased, so it does not count as a writer of the resource for
16
- * `Game.System.thisTick(...)` order checks: place it first yourself.
18
+ * The system declares its access like any other: it writes the resource, so
19
+ * a reader declared with `Game.System.thisTick(...)` placed before it does
20
+ * not compile, and it consumes the source (`Game.System.consumeService`), so
21
+ * `describe()` warns with `service-consumed-twice` when one source is
22
+ * captured at more than one placement (in named schedules, or wherever a
23
+ * debug runtime saw it run). Every input source marks `snapshot()` with
24
+ * `System.Consumes`, so another system that declares the source with
25
+ * `Game.System.service` (to rebind it, say) cannot call `snapshot()`.
26
+ * Capture each source once and read the resource everywhere else.
17
27
  *
18
28
  * @module InputCapture
19
29
  * @docGroup browser
@@ -34,13 +44,16 @@
34
44
  * }).value
35
45
  * ```
36
46
  */
47
+ import type * as System from "@typeonce/ritmo/System";
37
48
  import type { Descriptor } from "@typeonce/ritmo/Descriptor";
38
- import type { Condition, ConditionNeedsFromConditions } from "@typeonce/ritmo/Machine";
49
+ import type { Condition } from "@typeonce/ritmo/Machine";
39
50
  import type { Schema } from "@typeonce/ritmo/Schema";
40
51
  /**
41
- * Anything that produces one input snapshot per call.
52
+ * Anything that produces one input snapshot per call. `snapshot()` drains
53
+ * the source, so only a system that declares it with
54
+ * `Game.System.consumeService` (like `InputCapture.system`) calls it.
42
55
  */
43
- export interface Source<Value> {
56
+ export interface Source<Value> extends System.Consumes<"snapshot"> {
44
57
  readonly snapshot: () => Value;
45
58
  }
46
59
  type ServiceDescriptor = Descriptor<"service", string, any>;
@@ -50,13 +63,18 @@ type ResourceDescriptor = Descriptor<"resource", string, any>;
50
63
  * service has no `snapshot()`.
51
64
  */
52
65
  export type SnapshotOf<Service extends ServiceDescriptor> = Descriptor.Value<Service> extends Source<infer Value> ? Value : never;
53
- export interface Options<S extends Schema.Any, Service extends ServiceDescriptor, Resource extends Schema.ResourceDescriptor<S>, When extends ReadonlyArray<Condition> = readonly []> {
66
+ /** Whether `A` and `B` are the same type, not merely assignable both ways. */
67
+ type Same<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false;
68
+ /** The resource when its value type is exactly the source's snapshot type, otherwise an error naming the fix. */
69
+ type MatchingResource<Resource extends ResourceDescriptor, Service extends ServiceDescriptor> = Same<Descriptor.Value<Resource>, SnapshotOf<Service>> extends true ? Resource : "The resource's value type must be exactly the source's snapshot type: declare it with InputCapture.SnapshotOf<typeof Source>";
70
+ /** Options for {@link system}. */
71
+ export interface Options<S extends Schema.Any, Service extends ServiceDescriptor, Resource extends Schema.ResourceDescriptor<S>, When extends ReadonlyArray<Condition> = readonly [], Name extends string = string> {
54
72
  /** The system name. */
55
- readonly name: string;
73
+ readonly name: Name;
56
74
  /** The service to read snapshots from; its value must have `snapshot()`. */
57
75
  readonly source: Descriptor.Value<Service> extends Source<any> ? Service : "The source service must provide snapshot()";
58
76
  /** The resource to write each snapshot into; its value type must be exactly the snapshot type. */
59
- readonly resource: Resource & Descriptor<"resource", string, SnapshotOf<Service>>;
77
+ readonly resource: MatchingResource<Resource, Service>;
60
78
  /**
61
79
  * Run conditions, like a system's `when`. While they fail, snapshots are
62
80
  * not taken, so presses stay in the device until capture resumes (for
@@ -64,13 +82,25 @@ export interface Options<S extends Schema.Any, Service extends ServiceDescriptor
64
82
  */
65
83
  readonly when?: When;
66
84
  }
67
- /**
68
- * The generated system. It requires the source service and the resource.
69
- */
70
- export type CaptureSystem<S extends Schema.Any, Root, Needs extends ServiceDescriptor | ResourceDescriptor | ConditionNeedsFromConditions<ReadonlyArray<Condition>>> = Schema.BoundSystem<S, Root, any, never, string, Needs>;
71
85
  /**
72
86
  * Builds the system that writes `source.snapshot()` into `resource`.
73
87
  */
74
- export declare const system: <S extends Schema.Any, Root, const Service extends ServiceDescriptor, const Resource extends Schema.ResourceDescriptor<S>, const When extends ReadonlyArray<Condition<Root>> = readonly []>(Game: Schema.Game<S, Root>, options: Options<S, Service, Resource, When>) => CaptureSystem<S, Root, Service | Resource | ConditionNeedsFromConditions<When>>;
88
+ export declare const system: <S extends Schema.Any, Root, const Service extends ServiceDescriptor, const Resource extends Schema.ResourceDescriptor<S>, const When extends ReadonlyArray<Condition<Root>> = readonly [], const Name extends string = string>(Game: Schema.Game<S, Root>, options: Options<S, Service, Resource, When, Name>) => Schema.BoundSystem<S, Root, System.SystemSpec<S, {
89
+ readonly resources: {
90
+ input: System.ResourceWrite<Resource>;
91
+ };
92
+ readonly services: {
93
+ source: System.ServiceRead<Service, true>;
94
+ };
95
+ readonly when: When;
96
+ }, Root>, never, Name, System.SystemAccessNeeds<{
97
+ readonly resources: {
98
+ input: System.ResourceWrite<Resource>;
99
+ };
100
+ readonly services: {
101
+ source: System.ServiceRead<Service, true>;
102
+ };
103
+ readonly when: When;
104
+ }>>;
75
105
  export {};
76
106
  //# sourceMappingURL=InputCapture.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InputCapture.d.ts","sourceRoot":"","sources":["../src/InputCapture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AACtF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAEpD;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,KAAK;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,KAAK,CAAA;CAC/B;AAED,KAAK,iBAAiB,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;AAC3D,KAAK,kBAAkB,GAAG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;AAE7D;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,iBAAiB,IACtD,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,MAAM,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,GAAG,KAAK,CAAA;AAEvE,MAAM,WAAW,OAAO,CACtB,CAAC,SAAS,MAAM,CAAC,GAAG,EACpB,OAAO,SAAS,iBAAiB,EACjC,QAAQ,SAAS,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAC7C,IAAI,SAAS,aAAa,CAAC,SAAS,CAAC,GAAG,SAAS,EAAE;IAEnD,uBAAuB;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,4E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: Game.System.writeResource(options.resource) },
6
- services: { source: Game.System.service(options.source) },
6
+ services: { source: Game.System.consumeService(options.source) },
7
7
  when: (options.when ?? [])
8
8
  }, ({ resources, services }) => {
9
9
  resources.input.set(services.source.snapshot());
@@ -1 +1 @@
1
- {"version":3,"file":"InputCapture.js","sourceRoot":"","sources":["../src/InputCapture.ts"],"names":[],"mappings":"AAmFA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAOpB,IAA0B,EAC1B,OAA4C,EACqC,EAAE,CACnF,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE;IACxB,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;IACjE,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAiB,CAAC,EAAE;IACpE,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAmC;CAC7D,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC7B,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAW,CAAC,CAAA;AAC1D,CAAC,CAA+F,CAAA"}
1
+ {"version":3,"file":"InputCapture.js","sourceRoot":"","sources":["../src/InputCapture.ts"],"names":[],"mappings":"AAqGA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAQpB,IAA0B,EAC1B,OAAkD,EAClD,EAAE,CACF,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE;IACxB,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,QAAoB,CAAC,EAAE;IAC7E,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAA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