@n3rdw1z4rd/core 0.23.0 → 0.24.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 (141) hide show
  1. package/dist/astar.d.ts +1 -3
  2. package/dist/astar.js +1 -2
  3. package/dist/canvas-renderer.d.ts +1 -3
  4. package/dist/canvas-renderer.js +1 -2
  5. package/dist/clock.d.ts +1 -3
  6. package/dist/clock.js +1 -2
  7. package/dist/color-palette.d.ts +1 -3
  8. package/dist/color-palette.js +1 -2
  9. package/dist/color.d.ts +1 -3
  10. package/dist/color.js +1 -2
  11. package/dist/disposable.d.ts +1 -3
  12. package/dist/disposable.js +1 -2
  13. package/dist/dungeon-generator.d.ts +2 -4
  14. package/dist/dungeon-generator.js +3 -4
  15. package/dist/ecs.d.ts +1 -3
  16. package/dist/ecs.js +1 -2
  17. package/dist/emitter.d.ts +1 -3
  18. package/dist/emitter.js +1 -2
  19. package/dist/event-queue.d.ts +1 -3
  20. package/dist/event-queue.js +1 -2
  21. package/dist/graph/doc.d.ts +2 -4
  22. package/dist/graph/doc.js +1 -2
  23. package/dist/graph/evaluate.d.ts +1 -3
  24. package/dist/graph/evaluate.js +1 -2
  25. package/dist/graph/index.d.ts +2 -2
  26. package/dist/graph/index.js +2 -2
  27. package/dist/graph/node.d.ts +1 -3
  28. package/dist/graph/node.js +1 -2
  29. package/dist/graph/nodes.d.ts +1 -3
  30. package/dist/graph/nodes.js +1 -2
  31. package/dist/graph/script.d.ts +1 -3
  32. package/dist/graph/script.js +1 -2
  33. package/dist/graph/sources.d.ts +1 -3
  34. package/dist/graph/sources.js +1 -2
  35. package/dist/graph/subgraph.d.ts +2 -4
  36. package/dist/graph/subgraph.js +1 -2
  37. package/dist/graph/types.d.ts +1 -3
  38. package/dist/graph/types.js +1 -2
  39. package/dist/graph.cjs +9 -17
  40. package/dist/graph.d.cts +1 -17
  41. package/dist/index.cjs +91 -67
  42. package/dist/index.d.cts +9 -63
  43. package/dist/index.d.ts +10 -10
  44. package/dist/index.js +14 -14
  45. package/dist/input/_input.d.ts +1 -3
  46. package/dist/input/_input.js +1 -2
  47. package/dist/input/action-map.d.ts +1 -3
  48. package/dist/input/action-map.js +1 -2
  49. package/dist/input/bindings.d.ts +1 -3
  50. package/dist/input/bindings.js +1 -2
  51. package/dist/input/gestures.d.ts +1 -3
  52. package/dist/input/gestures.js +1 -2
  53. package/dist/input/index.d.ts +1 -1
  54. package/dist/input/index.js +1 -1
  55. package/dist/input/input-action-map.d.ts +11 -5
  56. package/dist/input/input-action-map.js +67 -19
  57. package/dist/input/input.d.ts +2 -4
  58. package/dist/input/input.js +2 -3
  59. package/dist/log.d.ts +1 -3
  60. package/dist/log.js +1 -2
  61. package/dist/map2d.d.ts +1 -3
  62. package/dist/map2d.js +1 -2
  63. package/dist/{map3d-CHDJiq5T.d.cts → map3d-DRHhbrFn.d.cts} +0 -8
  64. package/dist/map3d.d.ts +1 -3
  65. package/dist/map3d.js +1 -2
  66. package/dist/math.d.ts +1 -3
  67. package/dist/math.js +1 -2
  68. package/dist/misc.d.ts +1 -3
  69. package/dist/misc.js +1 -2
  70. package/dist/observable.d.ts +1 -3
  71. package/dist/observable.js +1 -2
  72. package/dist/particle-renderer.d.ts +1 -3
  73. package/dist/particle-renderer.js +1 -2
  74. package/dist/particle-system-2d.d.ts +1 -3
  75. package/dist/particle-system-2d.js +3 -4
  76. package/dist/random.d.ts +1 -3
  77. package/dist/random.js +1 -2
  78. package/dist/rectangle.d.ts +1 -3
  79. package/dist/rectangle.js +1 -2
  80. package/dist/{rng-Dhqq7owV.cjs → rng-edL6atS3.cjs} +3 -6
  81. package/dist/rng.d.ts +1 -3
  82. package/dist/rng.js +2 -3
  83. package/dist/signal.d.ts +1 -3
  84. package/dist/signal.js +1 -2
  85. package/dist/spatial-partition-2d.d.ts +1 -3
  86. package/dist/spatial-partition-2d.js +1 -2
  87. package/dist/{spatial-partition-3d-CmSCL87Z.cjs → spatial-partition-3d-D1uyJVhM.cjs} +7 -13
  88. package/dist/spatial-partition-3d.d.ts +1 -3
  89. package/dist/spatial-partition-3d.js +1 -2
  90. package/dist/three/adaptive-grid.d.ts +1 -3
  91. package/dist/three/adaptive-grid.js +1 -2
  92. package/dist/three/asteroid-mesh.d.ts +1 -3
  93. package/dist/three/asteroid-mesh.js +1 -2
  94. package/dist/three/camera-rig.d.ts +1 -3
  95. package/dist/three/camera-rig.js +1 -2
  96. package/dist/three/cube-sphere-geometry.d.ts +1 -3
  97. package/dist/three/cube-sphere-geometry.js +1 -2
  98. package/dist/three/ecs.d.ts +1 -3
  99. package/dist/three/ecs.js +1 -2
  100. package/dist/three/editor-camera.d.ts +1 -3
  101. package/dist/three/editor-camera.js +1 -2
  102. package/dist/three/index.d.ts +4 -4
  103. package/dist/three/index.js +1 -1
  104. package/dist/three/particle-system-3d.d.ts +1 -3
  105. package/dist/three/particle-system-3d.js +3 -4
  106. package/dist/three/picking.d.ts +2 -4
  107. package/dist/three/picking.js +1 -2
  108. package/dist/three/renderer.d.ts +1 -3
  109. package/dist/three/renderer.js +1 -2
  110. package/dist/three/schema.d.ts +0 -2
  111. package/dist/three/schema.js +1 -2
  112. package/dist/three/starfield.d.ts +1 -3
  113. package/dist/three/starfield.js +1 -2
  114. package/dist/three/texture-atlas.d.ts +1 -3
  115. package/dist/three/texture-atlas.js +1 -2
  116. package/dist/three/texture-utils.d.ts +1 -3
  117. package/dist/three/texture-utils.js +1 -2
  118. package/dist/three/voxel-geometry.d.ts +2 -4
  119. package/dist/three/voxel-geometry.js +2 -3
  120. package/dist/three/voxel-mesh.d.ts +1 -3
  121. package/dist/three/voxel-mesh.js +1 -2
  122. package/dist/three/world.d.ts +0 -2
  123. package/dist/three/world.js +1 -2
  124. package/dist/three.cjs +18 -34
  125. package/dist/three.d.cts +1 -33
  126. package/dist/tilemap.d.ts +1 -3
  127. package/dist/tilemap.js +1 -2
  128. package/dist/types.d.ts +1 -3
  129. package/dist/vector.d.ts +1 -3
  130. package/dist/vector.js +1 -2
  131. package/dist/vite.cjs +1 -2
  132. package/dist/vite.d.cts +1 -3
  133. package/dist/vite.d.ts +1 -3
  134. package/dist/vite.js +1 -2
  135. package/dist/webgl-renderer.d.ts +1 -3
  136. package/dist/webgl-renderer.js +1 -2
  137. package/dist/webgl.d.ts +1 -3
  138. package/dist/webgl.js +1 -2
  139. package/dist/worker-interface.d.ts +1 -3
  140. package/dist/worker-interface.js +1 -2
  141. package/package.json +6 -6
package/dist/graph.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/graph/types.d.ts
2
1
  /**
3
2
  * Pin types. A type is a name (`number`, `vec2`, your own…) with a color for the editor;
4
3
  * a trailing `[]` in a port declaration (`vec2[]`) makes the port a **list port** — it takes
@@ -53,8 +52,6 @@ export declare class TypeRegistry {
53
52
  * @category Graph
54
53
  */
55
54
  export declare const portTypes: TypeRegistry;
56
- //#endregion
57
- //#region src/graph/node.d.ts
58
55
  /**
59
56
  * Node definitions: a node is a function with a typed interface.
60
57
  *
@@ -205,8 +202,6 @@ export declare class NodeRegistry {
205
202
  /** Called when a type is registered (or replaced) or removed; returns an unsubscribe. */
206
203
  onChange(listener: (def: NodeDef, removed: boolean) => void): () => void;
207
204
  }
208
- //#endregion
209
- //#region src/graph/doc.d.ts
210
205
  /**
211
206
  * The graph document: plain JSON, saved and shared as-is.
212
207
  *
@@ -344,8 +339,6 @@ export declare function canConnect(doc: GraphDoc, registry: NodeRegistry, from:
344
339
  export declare function connect(doc: GraphDoc, registry: NodeRegistry, from: PortRef, to: PortRef, types?: TypeRegistry): GraphLink;
345
340
  /** @category Graph */
346
341
  export declare function disconnect(doc: GraphDoc, linkId: string): void;
347
- //#endregion
348
- //#region src/graph/evaluate.d.ts
349
342
  /**
350
343
  * Evaluates a graph: runs the nodes the outputs depend on, in dependency order, passing
351
344
  * values along the links.
@@ -455,8 +448,6 @@ export interface EvaluateResult {
455
448
  ran: string[];
456
449
  results: Map<string, NodeResult>;
457
450
  }
458
- //#endregion
459
- //#region src/graph/nodes.d.ts
460
451
  /** @category Graph */
461
452
  export declare const BUILTIN_NODES: NodeSpec[];
462
453
  /**
@@ -465,8 +456,6 @@ export declare const BUILTIN_NODES: NodeSpec[];
465
456
  * @category Graph
466
457
  */
467
458
  export declare function createNodeRegistry(): NodeRegistry;
468
- //#endregion
469
- //#region src/graph/script.d.ts
470
459
  /**
471
460
  * Script nodes: a node type written as a plain ES module, compiled at runtime.
472
461
  *
@@ -527,8 +516,6 @@ export interface ScriptOptions {
527
516
  export declare function compileNodeScript(type: string, source: string, options?: ScriptOptions): Promise<NodeDef>;
528
517
  /** A starting point for a new script node. @category Graph */
529
518
  export declare const SCRIPT_NODE_TEMPLATE = "// A node is a function with a typed interface.\n// inputs: pins wired from other nodes (an unconnected one uses its widget value / default)\n// params: widgets on the node\n// outputs: what run() returns\n// A \"type[]\" pin takes (or gives) a whole list; a list wired into a plain pin runs\n// run() once per item and collects the results into lists.\n\nexport const inputs = {\n a: { type: 'number', default: 1 },\n b: { type: 'number', default: 2 },\n};\n\nexport const params = {\n scale: { type: 'number', default: 1, min: 0, max: 10, step: 0.1 },\n};\n\nexport const outputs = {\n result: 'number',\n};\n\nexport function run({ a, b }, { scale }, ctx) {\n return { result: (a + b) * scale };\n}\n";
530
- //#endregion
531
- //#region src/graph/sources.d.ts
532
519
  /**
533
520
  * The built-in nodes as script modules: the same interface and behaviour as the TypeScript
534
521
  * definitions in `nodes.ts`, written self-contained so the editor can show a built-in's code
@@ -538,8 +525,6 @@ export declare const SCRIPT_NODE_TEMPLATE = "// A node is a function with a type
538
525
  */
539
526
  /** @category Graph */
540
527
  export declare const BUILTIN_SOURCES: Record<string, string>;
541
- //#endregion
542
- //#region src/graph/subgraph.d.ts
543
528
  /**
544
529
  * Subgraphs: a selection of nodes collapsed into one node type. The inner graph is stored in
545
530
  * `doc.subgraphs[type]` with its interface — every wire that crossed the selection's edge
@@ -571,5 +556,4 @@ export declare function collapseToSubgraph(doc: GraphDoc, registry: NodeRegistry
571
556
  * `defs`: where the definitions are (default: `doc.subgraphs`; pass the top-level document's
572
557
  * when `doc` is itself a subgraph's inner graph).
573
558
  */
574
- export declare function expandSubgraph(doc: GraphDoc, nodeId: string, defs?: Record<string, SubgraphDef> | undefined): string[];
575
- //#endregion
559
+ export declare function expandSubgraph(doc: GraphDoc, nodeId: string, defs?: Record<string, SubgraphDef> | undefined): string[];
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_rng = require("./rng-Dhqq7owV.cjs");
3
- const require_spatial_partition_3d = require("./spatial-partition-3d-CmSCL87Z.cjs");
2
+ const require_rng = require("./rng-edL6atS3.cjs");
3
+ const require_spatial_partition_3d = require("./spatial-partition-3d-D1uyJVhM.cjs");
4
4
  let heap_js = require("heap-js");
5
- //#region src/astar.ts
5
+ // src/astar.ts
6
6
  const DEFAULT_MAX_NODES = 1e4;
7
7
  const DIRECTIONS = [
8
8
  [0, -1],
@@ -116,8 +116,7 @@ function buildPath(end) {
116
116
  });
117
117
  return path.reverse();
118
118
  }
119
- //#endregion
120
- //#region src/canvas-renderer.ts
119
+ // src/canvas-renderer.ts
121
120
  /**
122
121
  * Fill / stroke color used when {@link DrawParams.color} is not given.
123
122
  *
@@ -321,8 +320,7 @@ var CanvasRenderer = class {
321
320
  else this.context.drawImage(image, x, y, width, height);
322
321
  }
323
322
  };
324
- //#endregion
325
- //#region src/clock.ts
323
+ // src/clock.ts
326
324
  /**
327
325
  * Milliseconds in one second.
328
326
  *
@@ -428,8 +426,7 @@ var Clock = class {
428
426
  this._fpsFrames = 0;
429
427
  }
430
428
  };
431
- //#endregion
432
- //#region src/color-palette.ts
429
+ // src/color-palette.ts
433
430
  const DEFAULT_COLORS = [
434
431
  [
435
432
  237,
@@ -539,8 +536,7 @@ function buildColorPalette(grayscaleSteps = 8, colorSteps = 4, ...colors) {
539
536
  for (const rgb of colorList) palette.push(...colorRamp(rgb, colorSteps));
540
537
  return palette;
541
538
  }
542
- //#endregion
543
- //#region src/disposable.ts
539
+ // src/disposable.ts
544
540
  /**
545
541
  * Collects cleanup functions (e.g. the unsubscribe functions returned by {@link Observable.subscribe}
546
542
  * and {@link Signal.subscribe}) and runs them all at once.
@@ -570,8 +566,7 @@ var Disposable = class {
570
566
  while (this.disposers.length) this.disposers.pop()?.();
571
567
  }
572
568
  };
573
- //#endregion
574
- //#region src/map2d.ts
569
+ // src/map2d.ts
575
570
  /**
576
571
  * Default "empty" value of a {@link Map2D}: cells holding it are not stored.
577
572
  *
@@ -689,8 +684,7 @@ var Map2D = class {
689
684
  });
690
685
  }
691
686
  };
692
- //#endregion
693
- //#region src/vector.ts
687
+ // src/vector.ts
694
688
  /**
695
689
  * Mutable 2D vector. Most methods modify the vector in place and return `this` for chaining;
696
690
  * {@link Vector.clone} and {@link Vector.floored} return new vectors.
@@ -856,8 +850,7 @@ var Vector = class Vector {
856
850
  return new Vector(-1, 0);
857
851
  }
858
852
  };
859
- //#endregion
860
- //#region src/rectangle.ts
853
+ // src/rectangle.ts
861
854
  /**
862
855
  * Axis-aligned rectangle given by its top-left corner (`x`, `y`) and size. Edges are inclusive
863
856
  * in the containment and intersection tests.
@@ -923,8 +916,7 @@ var Rectangle = class Rectangle {
923
916
  return this.contains(vec, padding);
924
917
  }
925
918
  };
926
- //#endregion
927
- //#region src/dungeon-generator.ts
919
+ // src/dungeon-generator.ts
928
920
  /**
929
921
  * Tile value for empty (unused) space.
930
922
  *
@@ -1201,8 +1193,7 @@ function GenerateWalls(map) {
1201
1193
  });
1202
1194
  return [...walls.values()];
1203
1195
  }
1204
- //#endregion
1205
- //#region src/ecs.ts
1196
+ // src/ecs.ts
1206
1197
  /**
1207
1198
  * A minimal entity-component store. Entities are integers; components are class instances stored
1208
1199
  * per class, and {@link ECS.query} iterates the entities that have every requested component.
@@ -1301,8 +1292,7 @@ var ECS = class {
1301
1292
  * @category ECS
1302
1293
  */
1303
1294
  const ecs = new ECS();
1304
- //#endregion
1305
- //#region src/emitter.ts
1295
+ // src/emitter.ts
1306
1296
  /**
1307
1297
  * A string-keyed event emitter. Listeners get the emitted arguments followed by the event name,
1308
1298
  * so one listener can tell apart the events it was added to.
@@ -1354,8 +1344,7 @@ var Emitter = class {
1354
1344
  return this;
1355
1345
  }
1356
1346
  };
1357
- //#endregion
1358
- //#region src/event-queue.ts
1347
+ // src/event-queue.ts
1359
1348
  /**
1360
1349
  * A buffered queue of events: producers `emit()` events, and a consumer reads them later (e.g.
1361
1350
  * once per frame) with `drain()`, or with `consume()` followed by `clear()`.
@@ -1393,8 +1382,7 @@ var EventQueue = class {
1393
1382
  return this.events.length;
1394
1383
  }
1395
1384
  };
1396
- //#endregion
1397
- //#region src/input/bindings.ts
1385
+ // src/input/bindings.ts
1398
1386
  /**
1399
1387
  * W3C "standard" gamepad mapping, in button-index order (Xbox names; on PlayStation A = Cross,
1400
1388
  * B = Circle, X = Square, Y = Triangle).
@@ -1642,8 +1630,7 @@ function bindingLabel(binding, keyLabels) {
1642
1630
  case "xrAxis": return `${capitalize(binding.hand)} ${AXIS_NAMES[binding.axis][binding.direction > 0 ? 1 : 0]}`;
1643
1631
  }
1644
1632
  }
1645
- //#endregion
1646
- //#region src/input/action-map.ts
1633
+ // src/input/action-map.ts
1647
1634
  /**
1648
1635
  * Deadzone given to new actions when none is specified.
1649
1636
  *
@@ -1797,8 +1784,7 @@ var ActionMap = class {
1797
1784
  return this;
1798
1785
  }
1799
1786
  };
1800
- //#endregion
1801
- //#region src/input/gestures.ts
1787
+ // src/input/gestures.ts
1802
1788
  const DEFAULT_THRESHOLDS = {
1803
1789
  tapMaxDuration: 250,
1804
1790
  tapMaxMovement: 10,
@@ -1981,8 +1967,7 @@ var GestureRecognizer = class {
1981
1967
  return frame;
1982
1968
  }
1983
1969
  };
1984
- //#endregion
1985
- //#region src/input/input.ts
1970
+ // src/input/input.ts
1986
1971
  const BUTTON_BITS = [
1987
1972
  1,
1988
1973
  4,
@@ -2221,8 +2206,7 @@ var Input = class Input extends Emitter {
2221
2206
  return this._state[`button${buttonNumber}`]?.state ?? 0;
2222
2207
  }
2223
2208
  };
2224
- //#endregion
2225
- //#region src/observable.ts
2209
+ // src/observable.ts
2226
2210
  /**
2227
2211
  * A set of observers notified with a value (plus optional extra arguments). Observers are
2228
2212
  * called in subscription order; subscribing the same function twice has no effect.
@@ -2273,8 +2257,28 @@ var Observable = class {
2273
2257
  return this.observers.size;
2274
2258
  }
2275
2259
  };
2276
- //#endregion
2277
- //#region src/input/input-action-map.ts
2260
+ // src/input/input-action-map.ts
2261
+ const SHIFT = 1;
2262
+ const CTRL = 2;
2263
+ const ALT = 4;
2264
+ const META = 8;
2265
+ const MODIFIER_KEYS = [
2266
+ ["ShiftLeft", SHIFT],
2267
+ ["ShiftRight", SHIFT],
2268
+ ["ControlLeft", CTRL],
2269
+ ["ControlRight", CTRL],
2270
+ ["AltLeft", ALT],
2271
+ ["AltRight", ALT],
2272
+ ["MetaLeft", META],
2273
+ ["MetaRight", META]
2274
+ ];
2275
+ const modifierBits = (m) => (m.shift ? SHIFT : 0) | (m.ctrl ? CTRL : 0) | (m.alt ? ALT : 0) | (m.meta ? META : 0);
2276
+ const modifiersOf = (bits) => ({
2277
+ shift: !!(bits & SHIFT),
2278
+ ctrl: !!(bits & CTRL),
2279
+ alt: !!(bits & ALT),
2280
+ meta: !!(bits & META)
2281
+ });
2278
2282
  const ANY = -1;
2279
2283
  const now = () => performance.now();
2280
2284
  const MOUSE_BUTTONS = [
@@ -2425,35 +2429,49 @@ var InputActionMap = class {
2425
2429
  this._updateGestures(time);
2426
2430
  const devices = [...this._controls.keys()];
2427
2431
  const fired = [];
2432
+ const heldMods = this._heldMods();
2428
2433
  for (const name of this.actions.names) {
2429
2434
  const action = this.actions.get(name);
2430
2435
  let states = this._actionStates.get(name);
2431
2436
  if (!states) this._actionStates.set(name, states = /* @__PURE__ */ new Map());
2432
2437
  let anyRaw = 0;
2438
+ let anyPressMods = -1;
2433
2439
  for (const device of devices) {
2434
2440
  let raw = 0;
2435
- for (const binding of action.bindings) raw = Math.max(raw, this._bindingValue(binding, device));
2441
+ let pressMods = -1;
2442
+ for (const binding of action.bindings) {
2443
+ const value = this._bindingValue(binding, device);
2444
+ raw = Math.max(raw, value);
2445
+ const control = this._controls.get(device)?.get(controlId(binding));
2446
+ if (value > 0 && control?.pressed) pressMods = Math.max(0, pressMods) | control.mods;
2447
+ }
2436
2448
  anyRaw = Math.max(anyRaw, raw);
2449
+ if (pressMods >= 0) anyPressMods = Math.max(0, anyPressMods) | pressMods;
2437
2450
  const phase = this._advance(states, device, raw, action, time);
2451
+ const state = states.get(device);
2438
2452
  if (phase) fired.push({
2439
2453
  action: name,
2440
2454
  phase,
2441
2455
  device,
2442
- repeat: states.get(device).repeated
2456
+ repeat: state.repeated,
2457
+ mods: phase === "pressed" && !state.repeated && pressMods >= 0 ? pressMods : heldMods
2443
2458
  });
2444
2459
  }
2445
2460
  const phase = this._advance(states, ANY, anyRaw, action, time);
2461
+ const state = states.get(ANY);
2446
2462
  if (phase) fired.push({
2447
2463
  action: name,
2448
2464
  phase,
2449
2465
  device: ANY,
2450
- repeat: states.get(ANY).repeated
2466
+ repeat: state.repeated,
2467
+ mods: phase === "pressed" && !state.repeated && anyPressMods >= 0 ? anyPressMods : heldMods
2451
2468
  });
2452
2469
  }
2453
2470
  for (const controls of this._controls.values()) for (const state of controls.values()) state.pressed = false;
2454
- for (const { action, phase, device, repeat } of fired) for (const listener of [...this._actionListeners]) if (listener.action === action && listener.phase === phase && listener.device === device) listener.callback({
2471
+ for (const { action, phase, device, repeat, mods } of fired) for (const listener of [...this._actionListeners]) if (listener.action === action && listener.phase === phase && listener.device === device) listener.callback({
2455
2472
  action,
2456
- repeat
2473
+ repeat,
2474
+ modifiers: modifiersOf(mods)
2457
2475
  });
2458
2476
  }
2459
2477
  /** Whether the action is held past its deadzone. Unknown actions return false (and warn once). */
@@ -2663,13 +2681,11 @@ var InputActionMap = class {
2663
2681
  _bindingValue(binding, device) {
2664
2682
  const value = this._controlValue(device, controlId(binding));
2665
2683
  if (value === 0 || binding.type !== "key" || !binding.modifiers) return value;
2666
- const held = (left, right) => this._controlValue(device, `key:${left}`) > 0 || this._controlValue(device, `key:${right}`) > 0;
2667
- const m = binding.modifiers;
2668
- if (m.shift && !held("ShiftLeft", "ShiftRight")) return 0;
2669
- if (m.ctrl && !held("ControlLeft", "ControlRight")) return 0;
2670
- if (m.alt && !held("AltLeft", "AltRight")) return 0;
2671
- if (m.meta && !held("MetaLeft", "MetaRight")) return 0;
2672
- return value;
2684
+ const control = this._controls.get(device)?.get(controlId(binding));
2685
+ let held = control?.pressed ? control.mods : 0;
2686
+ for (const [code, bit] of MODIFIER_KEYS) if (this._controlValue(device, `key:${code}`) > 0) held |= bit;
2687
+ const need = modifierBits(binding.modifiers);
2688
+ return (held & need) === need ? value : 0;
2673
2689
  }
2674
2690
  _control(device, binding) {
2675
2691
  let controls = this._controls.get(device);
@@ -2679,7 +2695,8 @@ var InputActionMap = class {
2679
2695
  if (!state) controls.set(id, state = {
2680
2696
  value: 0,
2681
2697
  pressed: false,
2682
- suppressed: false
2698
+ suppressed: false,
2699
+ mods: 0
2683
2700
  });
2684
2701
  return state;
2685
2702
  }
@@ -2690,14 +2707,29 @@ var InputActionMap = class {
2690
2707
  state.value = value;
2691
2708
  if (value >= .5 && !wasDown) {
2692
2709
  if (this._tryCapture(binding)) state.suppressed = true;
2693
- else state.pressed = true;
2710
+ else {
2711
+ state.pressed = true;
2712
+ state.mods = this._heldMods();
2713
+ }
2694
2714
  }
2695
2715
  if (value === 0) state.suppressed = false;
2696
2716
  }
2697
2717
  /** A one-frame press with no held state: wheel steps, gestures. */
2698
2718
  _pulse(device, binding) {
2699
2719
  const state = this._control(device, binding);
2700
- if (!this._tryCapture(binding)) state.pressed = true;
2720
+ if (!this._tryCapture(binding)) {
2721
+ state.pressed = true;
2722
+ state.mods = this._heldMods();
2723
+ }
2724
+ }
2725
+ /** the keyboard's modifier keys held right now (bits); they apply to every device's presses (Shift + click) */
2726
+ _heldMods() {
2727
+ const keys = this._controls.get(0);
2728
+ let bits = 0;
2729
+ if (keys) {
2730
+ for (const [code, bit] of MODIFIER_KEYS) if ((keys.get(`key:${code}`)?.value ?? 0) > 0) bits |= bit;
2731
+ }
2732
+ return bits;
2701
2733
  }
2702
2734
  _tryCapture(binding) {
2703
2735
  const capture = this._capture;
@@ -2956,8 +2988,7 @@ var InputActionMap = class {
2956
2988
  });
2957
2989
  }
2958
2990
  };
2959
- //#endregion
2960
- //#region src/misc.ts
2991
+ // src/misc.ts
2961
2992
  /**
2962
2993
  * True if `target` is `null` or `undefined`.
2963
2994
  * @category Utilities
@@ -3025,8 +3056,7 @@ const xyz2k = (x, y, z, delimiter = ",") => `${x}${delimiter}${y}${delimiter}${z
3025
3056
  * @category Utilities
3026
3057
  */
3027
3058
  const k2xyz = (key, delimiter = ",") => key.split(delimiter).map(parseFloat);
3028
- //#endregion
3029
- //#region src/particle-renderer.ts
3059
+ // src/particle-renderer.ts
3030
3060
  /**
3031
3061
  * Double-buffered square-pixel renderer for particle effects: draw with `setPixel()` into an
3032
3062
  * offscreen buffer, then `render()` copies the buffer to the visible canvas and clears it.
@@ -3106,8 +3136,7 @@ var ParticleRenderer = class {
3106
3136
  this.bufferContext.clearRect(0, 0, this._screenCanvas.width, this._screenCanvas.height);
3107
3137
  }
3108
3138
  };
3109
- //#endregion
3110
- //#region src/signal.ts
3139
+ // src/signal.ts
3111
3140
  /**
3112
3141
  * A value holder that notifies subscribers when the value changes (compared with `Object.is`).
3113
3142
  * Subscribers are called immediately with the current value when they subscribe.
@@ -3146,8 +3175,7 @@ var Signal = class {
3146
3175
  return () => this.subscribers.delete(subscriber);
3147
3176
  }
3148
3177
  };
3149
- //#endregion
3150
- //#region src/tilemap.ts
3178
+ // src/tilemap.ts
3151
3179
  /**
3152
3180
  * Sparse 2D grid of arbitrary values, keyed by floored integer coordinates. Simpler than
3153
3181
  * {@link Map2D} (string keys, any value type, no default value or range limit).
@@ -3171,8 +3199,7 @@ var Tilemap = class {
3171
3199
  this.map.set(this._key(x, y), v);
3172
3200
  }
3173
3201
  };
3174
- //#endregion
3175
- //#region src/webgl.ts
3202
+ // src/webgl.ts
3176
3203
  /**
3177
3204
  * Literal GLenum values, so importing this module doesn't require `WebGL2RenderingContext` to exist.
3178
3205
  *
@@ -3798,8 +3825,7 @@ function Draw(gl, info, vertexArray, options = {}) {
3798
3825
  else gl.drawArrays(mode, offset, count);
3799
3826
  gl.bindVertexArray(null);
3800
3827
  }
3801
- //#endregion
3802
- //#region src/webgl-renderer.ts
3828
+ // src/webgl-renderer.ts
3803
3829
  /**
3804
3830
  * A thin owner of a WebGL2 context: sizing (CSS pixels x pixel ratio), clearing, render targets,
3805
3831
  * drawing, and context-loss notifications. Everything else is the webgl.ts wrappers on `gl`.
@@ -3935,8 +3961,7 @@ var WebGlRenderer = class {
3935
3961
  this._listeners.push([type, listener]);
3936
3962
  }
3937
3963
  };
3938
- //#endregion
3939
- //#region src/worker-interface.ts
3964
+ // src/worker-interface.ts
3940
3965
  /**
3941
3966
  * Thin wrapper around a module `Worker` that exposes its errors and messages as
3942
3967
  * {@link Observable}s.
@@ -3972,7 +3997,6 @@ var WorkerInterface = class {
3972
3997
  this._worker.terminate();
3973
3998
  }
3974
3999
  };
3975
- //#endregion
3976
4000
  exports.ActionMap = ActionMap;
3977
4001
  exports.BindRenderTarget = BindRenderTarget;
3978
4002
  exports.CanvasRenderer = CanvasRenderer;