@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
@@ -1,9 +1,30 @@
1
- import { GAMEPAD_AXES, GAMEPAD_BUTTONS, XR_AXES, XR_BUTTONS, controlId } from "./bindings.js";
1
+ import { Observable } from "../observable.js";
2
2
  import { ActionMap } from "./action-map.js";
3
3
  import { GestureRecognizer } from "./gestures.js";
4
4
  import { Input } from "./input.js";
5
- import { Observable } from "../observable.js";
6
- //#region src/input/input-action-map.ts
5
+ import { GAMEPAD_AXES, GAMEPAD_BUTTONS, XR_AXES, XR_BUTTONS, controlId } from "./bindings.js";
6
+ // src/input/input-action-map.ts
7
+ const SHIFT = 1;
8
+ const CTRL = 2;
9
+ const ALT = 4;
10
+ const META = 8;
11
+ const MODIFIER_KEYS = [
12
+ ["ShiftLeft", SHIFT],
13
+ ["ShiftRight", SHIFT],
14
+ ["ControlLeft", CTRL],
15
+ ["ControlRight", CTRL],
16
+ ["AltLeft", ALT],
17
+ ["AltRight", ALT],
18
+ ["MetaLeft", META],
19
+ ["MetaRight", META]
20
+ ];
21
+ const modifierBits = (m) => (m.shift ? SHIFT : 0) | (m.ctrl ? CTRL : 0) | (m.alt ? ALT : 0) | (m.meta ? META : 0);
22
+ const modifiersOf = (bits) => ({
23
+ shift: !!(bits & SHIFT),
24
+ ctrl: !!(bits & CTRL),
25
+ alt: !!(bits & ALT),
26
+ meta: !!(bits & META)
27
+ });
7
28
  const ANY = -1;
8
29
  const now = () => performance.now();
9
30
  const MOUSE_BUTTONS = [
@@ -154,35 +175,49 @@ var InputActionMap = class {
154
175
  this._updateGestures(time);
155
176
  const devices = [...this._controls.keys()];
156
177
  const fired = [];
178
+ const heldMods = this._heldMods();
157
179
  for (const name of this.actions.names) {
158
180
  const action = this.actions.get(name);
159
181
  let states = this._actionStates.get(name);
160
182
  if (!states) this._actionStates.set(name, states = /* @__PURE__ */ new Map());
161
183
  let anyRaw = 0;
184
+ let anyPressMods = -1;
162
185
  for (const device of devices) {
163
186
  let raw = 0;
164
- for (const binding of action.bindings) raw = Math.max(raw, this._bindingValue(binding, device));
187
+ let pressMods = -1;
188
+ for (const binding of action.bindings) {
189
+ const value = this._bindingValue(binding, device);
190
+ raw = Math.max(raw, value);
191
+ const control = this._controls.get(device)?.get(controlId(binding));
192
+ if (value > 0 && control?.pressed) pressMods = Math.max(0, pressMods) | control.mods;
193
+ }
165
194
  anyRaw = Math.max(anyRaw, raw);
195
+ if (pressMods >= 0) anyPressMods = Math.max(0, anyPressMods) | pressMods;
166
196
  const phase = this._advance(states, device, raw, action, time);
197
+ const state = states.get(device);
167
198
  if (phase) fired.push({
168
199
  action: name,
169
200
  phase,
170
201
  device,
171
- repeat: states.get(device).repeated
202
+ repeat: state.repeated,
203
+ mods: phase === "pressed" && !state.repeated && pressMods >= 0 ? pressMods : heldMods
172
204
  });
173
205
  }
174
206
  const phase = this._advance(states, ANY, anyRaw, action, time);
207
+ const state = states.get(ANY);
175
208
  if (phase) fired.push({
176
209
  action: name,
177
210
  phase,
178
211
  device: ANY,
179
- repeat: states.get(ANY).repeated
212
+ repeat: state.repeated,
213
+ mods: phase === "pressed" && !state.repeated && anyPressMods >= 0 ? anyPressMods : heldMods
180
214
  });
181
215
  }
182
216
  for (const controls of this._controls.values()) for (const state of controls.values()) state.pressed = false;
183
- 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({
217
+ 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({
184
218
  action,
185
- repeat
219
+ repeat,
220
+ modifiers: modifiersOf(mods)
186
221
  });
187
222
  }
188
223
  /** Whether the action is held past its deadzone. Unknown actions return false (and warn once). */
@@ -392,13 +427,11 @@ var InputActionMap = class {
392
427
  _bindingValue(binding, device) {
393
428
  const value = this._controlValue(device, controlId(binding));
394
429
  if (value === 0 || binding.type !== "key" || !binding.modifiers) return value;
395
- const held = (left, right) => this._controlValue(device, `key:${left}`) > 0 || this._controlValue(device, `key:${right}`) > 0;
396
- const m = binding.modifiers;
397
- if (m.shift && !held("ShiftLeft", "ShiftRight")) return 0;
398
- if (m.ctrl && !held("ControlLeft", "ControlRight")) return 0;
399
- if (m.alt && !held("AltLeft", "AltRight")) return 0;
400
- if (m.meta && !held("MetaLeft", "MetaRight")) return 0;
401
- return value;
430
+ const control = this._controls.get(device)?.get(controlId(binding));
431
+ let held = control?.pressed ? control.mods : 0;
432
+ for (const [code, bit] of MODIFIER_KEYS) if (this._controlValue(device, `key:${code}`) > 0) held |= bit;
433
+ const need = modifierBits(binding.modifiers);
434
+ return (held & need) === need ? value : 0;
402
435
  }
403
436
  _control(device, binding) {
404
437
  let controls = this._controls.get(device);
@@ -408,7 +441,8 @@ var InputActionMap = class {
408
441
  if (!state) controls.set(id, state = {
409
442
  value: 0,
410
443
  pressed: false,
411
- suppressed: false
444
+ suppressed: false,
445
+ mods: 0
412
446
  });
413
447
  return state;
414
448
  }
@@ -419,14 +453,29 @@ var InputActionMap = class {
419
453
  state.value = value;
420
454
  if (value >= .5 && !wasDown) {
421
455
  if (this._tryCapture(binding)) state.suppressed = true;
422
- else state.pressed = true;
456
+ else {
457
+ state.pressed = true;
458
+ state.mods = this._heldMods();
459
+ }
423
460
  }
424
461
  if (value === 0) state.suppressed = false;
425
462
  }
426
463
  /** A one-frame press with no held state: wheel steps, gestures. */
427
464
  _pulse(device, binding) {
428
465
  const state = this._control(device, binding);
429
- if (!this._tryCapture(binding)) state.pressed = true;
466
+ if (!this._tryCapture(binding)) {
467
+ state.pressed = true;
468
+ state.mods = this._heldMods();
469
+ }
470
+ }
471
+ /** the keyboard's modifier keys held right now (bits); they apply to every device's presses (Shift + click) */
472
+ _heldMods() {
473
+ const keys = this._controls.get(0);
474
+ let bits = 0;
475
+ if (keys) {
476
+ for (const [code, bit] of MODIFIER_KEYS) if ((keys.get(`key:${code}`)?.value ?? 0) > 0) bits |= bit;
477
+ }
478
+ return bits;
430
479
  }
431
480
  _tryCapture(binding) {
432
481
  const capture = this._capture;
@@ -685,5 +734,4 @@ var InputActionMap = class {
685
734
  });
686
735
  }
687
736
  };
688
- //#endregion
689
737
  export { InputActionMap };
@@ -1,6 +1,5 @@
1
- import { Vector } from "../vector.js";
2
1
  import { Emitter } from "../emitter.js";
3
- //#region src/input/input.d.ts
2
+ import { Vector } from "../vector.js";
4
3
  /**
5
4
  * Whether a key or button is down (`state` 1) or up (0), and when that last changed.
6
5
  *
@@ -98,5 +97,4 @@ export declare class Input extends Emitter {
98
97
  isButtonDown(buttonNumber: number): boolean;
99
98
  /** 1 if the button is down, else 0. */
100
99
  getButtonState(buttonNumber: number): number;
101
- }
102
- //#endregion
100
+ }
@@ -1,6 +1,6 @@
1
- import { Vector } from "../vector.js";
2
1
  import { Emitter } from "../emitter.js";
3
- //#region src/input/input.ts
2
+ import { Vector } from "../vector.js";
3
+ // src/input/input.ts
4
4
  const BUTTON_BITS = [
5
5
  1,
6
6
  4,
@@ -239,5 +239,4 @@ var Input = class Input extends Emitter {
239
239
  return this._state[`button${buttonNumber}`]?.state ?? 0;
240
240
  }
241
241
  };
242
- //#endregion
243
242
  export { Input };
package/dist/log.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- //#region src/log.d.ts
2
1
  /**
3
2
  * `console.debug` with a bold gray `[dev]` prefix; takes the same arguments. Visible only when the
4
3
  * console shows verbose/debug messages.
5
4
  * @category Utilities
6
5
  */
7
- export declare const log: (...args: any[]) => void;
8
- //#endregion
6
+ export declare const log: (...args: any[]) => void;
package/dist/log.js CHANGED
@@ -1,9 +1,8 @@
1
- //#region src/log.ts
1
+ // src/log.ts
2
2
  /**
3
3
  * `console.debug` with a bold gray `[dev]` prefix; takes the same arguments. Visible only when the
4
4
  * console shows verbose/debug messages.
5
5
  * @category Utilities
6
6
  */
7
7
  const log = console.debug.bind(console, "%c[dev]", "font-weight: bold; color: #888;");
8
- //#endregion
9
8
  export { log };
package/dist/map2d.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/map2d.d.ts
2
1
  /**
3
2
  * Default "empty" value of a {@link Map2D}: cells holding it are not stored.
4
3
  *
@@ -79,5 +78,4 @@ export declare class Map2D {
79
78
  * O(size), not O(area).
80
79
  */
81
80
  forEachInArea(x1: number, y1: number, x2: number, y2: number, callback: (x: number, y: number, n: number) => void): void;
82
- }
83
- //#endregion
81
+ }
package/dist/map2d.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/map2d.ts
1
+ // src/map2d.ts
2
2
  /**
3
3
  * Default "empty" value of a {@link Map2D}: cells holding it are not stored.
4
4
  *
@@ -116,5 +116,4 @@ var Map2D = class {
116
116
  });
117
117
  }
118
118
  };
119
- //#endregion
120
119
  export { DEFAULT_MAP_2D_VALUE, MAP_2D_MAX_COORD, MAP_2D_MIN_COORD, Map2D };
@@ -1,4 +1,3 @@
1
- //#region src/types.d.ts
2
1
  /**
3
2
  * Any object with numeric `x` and `y`, such as a {@link Vector}.
4
3
  * @property x horizontal coordinate
@@ -31,8 +30,6 @@ type KeyValue = Record<string, any>;
31
30
  * @category Math & Random
32
31
  */
33
32
  type NoiseFunction3D = (x: number, y: number, z: number) => number;
34
- //#endregion
35
- //#region src/color-palette.d.ts
36
33
  /**
37
34
  * Color as `[r, g, b]`, each 0-255.
38
35
  * @category Color
@@ -56,8 +53,6 @@ type ColorPalette = readonly number[];
56
53
  * @category Color
57
54
  */
58
55
  declare function buildColorPalette(grayscaleSteps?: number, colorSteps?: number, ...colors: RGB[]): ColorPalette;
59
- //#endregion
60
- //#region src/map2d.d.ts
61
56
  /**
62
57
  * Default "empty" value of a {@link Map2D}: cells holding it are not stored.
63
58
  *
@@ -139,8 +134,6 @@ declare class Map2D {
139
134
  */
140
135
  forEachInArea(x1: number, y1: number, x2: number, y2: number, callback: (x: number, y: number, n: number) => void): void;
141
136
  }
142
- //#endregion
143
- //#region src/map3d.d.ts
144
137
  /**
145
138
  * Default "empty" value of a {@link Map3D}: cells holding it are not stored.
146
139
  *
@@ -232,5 +225,4 @@ declare class Map3D {
232
225
  /** Copies every stored cell of a {@link Map2D} into a new map, at z = 0. */
233
226
  static fromMap2D(map2d: Map2D, defaultValue?: number): Map3D;
234
227
  }
235
- //#endregion
236
228
  export { XYZ as _, Map3DCell as a, MAP_2D_MIN_COORD as c, ColorPalette as d, RGB as f, XY as g, NoiseFunction3D as h, Map3D as i, Map2D as l, KeyValue as m, MAP_3D_MAX_COORD as n, DEFAULT_MAP_2D_VALUE as o, buildColorPalette as p, MAP_3D_MIN_COORD as r, MAP_2D_MAX_COORD as s, DEFAULT_MAP_3D_VALUE as t, Map2DData as u };
package/dist/map3d.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Map2D, Map2DData } from "./map2d.js";
2
- //#region src/map3d.d.ts
3
2
  /**
4
3
  * Default "empty" value of a {@link Map3D}: cells holding it are not stored.
5
4
  *
@@ -90,5 +89,4 @@ export declare class Map3D {
90
89
  import(data: Map3DCell[]): void;
91
90
  /** Copies every stored cell of a {@link Map2D} into a new map, at z = 0. */
92
91
  static fromMap2D(map2d: Map2D, defaultValue?: number): Map3D;
93
- }
94
- //#endregion
92
+ }
package/dist/map3d.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/map3d.ts
1
+ // src/map3d.ts
2
2
  /**
3
3
  * Default "empty" value of a {@link Map3D}: cells holding it are not stored.
4
4
  *
@@ -144,5 +144,4 @@ var Map3D = class Map3D {
144
144
  return map3d;
145
145
  }
146
146
  };
147
- //#endregion
148
147
  export { DEFAULT_MAP_3D_VALUE, MAP_3D_MAX_COORD, MAP_3D_MIN_COORD, Map3D };
package/dist/math.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/math.d.ts
2
1
  /**
3
2
  * π, half a turn in radians.
4
3
  * @category Math & Random
@@ -172,5 +171,4 @@ export declare const hash32: (n: number) => number;
172
171
  * unsigned 32-bit integer by folding them through {@link hash32}. Order matters; no values gives 0.
173
172
  * @category Math & Random
174
173
  */
175
- export declare const hash32mix: (...values: number[]) => number;
176
- //#endregion
174
+ export declare const hash32mix: (...values: number[]) => number;
package/dist/math.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/math.ts
1
+ // src/math.ts
2
2
  /**
3
3
  * π, half a turn in radians.
4
4
  * @category Math & Random
@@ -202,5 +202,4 @@ const hash32mix = (...values) => {
202
202
  }
203
203
  return n;
204
204
  };
205
- //#endregion
206
205
  export { DEG2RAD, E, EPSILON, HALF_PI, LN10, LN2, LOG10E, LOG2E, PI, QUARTER_PI, RAD2DEG, SQRT1_2, SQRT2, TAU, clamp, degrees, distance2d, distance3d, fract, hash32, hash32mix, inverseLerp, lerp, manhattanDistance, mod, nearlyEqual, normalizeRadians, radians, roundTo, saturate, smoothstep, squaredDistance, wrap };
package/dist/misc.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { KeyValue } from "./types.js";
2
- //#region src/misc.d.ts
3
2
  /**
4
3
  * True if `target` is `null` or `undefined`.
5
4
  * @category Utilities
@@ -42,5 +41,4 @@ export declare const xyz2k: (x: number, y: number, z: number, delimiter?: string
42
41
  * Splits a key made by {@link xyz2k} back into `[x, y, z]` (parsed with `parseFloat`).
43
42
  * @category Utilities
44
43
  */
45
- export declare const k2xyz: (key: string, delimiter?: string) => [number, number, number];
46
- //#endregion
44
+ export declare const k2xyz: (key: string, delimiter?: string) => [number, number, number];
package/dist/misc.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { clamp } from "./math.js";
2
- //#region src/misc.ts
2
+ // src/misc.ts
3
3
  /**
4
4
  * True if `target` is `null` or `undefined`.
5
5
  * @category Utilities
@@ -67,5 +67,4 @@ const xyz2k = (x, y, z, delimiter = ",") => `${x}${delimiter}${y}${delimiter}${z
67
67
  * @category Utilities
68
68
  */
69
69
  const k2xyz = (key, delimiter = ",") => key.split(delimiter).map(parseFloat);
70
- //#endregion
71
70
  export { GetUrlParams, getRedYellowGreenGradientHex, isNullOrUndefined, isPositiveString, k2xy, k2xyz, xy2k, xyz2k };
@@ -1,4 +1,3 @@
1
- //#region src/observable.d.ts
2
1
  /**
3
2
  * An {@link Observable} observer: called with the notified value (and any extra arguments).
4
3
  *
@@ -39,5 +38,4 @@ export declare class Observable<T> {
39
38
  clear(): void;
40
39
  /** number of observers */
41
40
  get size(): number;
42
- }
43
- //#endregion
41
+ }
@@ -1,4 +1,4 @@
1
- //#region src/observable.ts
1
+ // src/observable.ts
2
2
  /**
3
3
  * A set of observers notified with a value (plus optional extra arguments). Observers are
4
4
  * called in subscription order; subscribing the same function twice has no effect.
@@ -49,5 +49,4 @@ var Observable = class {
49
49
  return this.observers.size;
50
50
  }
51
51
  };
52
- //#endregion
53
52
  export { Observable };
@@ -1,5 +1,4 @@
1
1
  import { Color } from "./color.js";
2
- //#region src/particle-renderer.d.ts
3
2
  /**
4
3
  * Double-buffered square-pixel renderer for particle effects: draw with `setPixel()` into an
5
4
  * offscreen buffer, then `render()` copies the buffer to the visible canvas and clears it.
@@ -43,5 +42,4 @@ export declare class ParticleRenderer {
43
42
  setPixel(x: number, y: number, color: Color, size?: number): void;
44
43
  /** Replaces the visible canvas with the buffer's contents, then clears the buffer for the next frame. */
45
44
  render(): void;
46
- }
47
- //#endregion
45
+ }
@@ -1,4 +1,4 @@
1
- //#region src/particle-renderer.ts
1
+ // src/particle-renderer.ts
2
2
  /**
3
3
  * Double-buffered square-pixel renderer for particle effects: draw with `setPixel()` into an
4
4
  * offscreen buffer, then `render()` copies the buffer to the visible canvas and clears it.
@@ -78,5 +78,4 @@ var ParticleRenderer = class {
78
78
  this.bufferContext.clearRect(0, 0, this._screenCanvas.width, this._screenCanvas.height);
79
79
  }
80
80
  };
81
- //#endregion
82
81
  export { ParticleRenderer };
@@ -1,5 +1,4 @@
1
1
  import { ParticleRenderer } from "./particle-renderer.js";
2
- //#region src/particle-system-2d.d.ts
3
2
  /**
4
3
  * A `size` x `size` attraction matrix with values in [-1, 1). Deterministic: the same `size` and
5
4
  * `seed` always give the same matrix.
@@ -56,5 +55,4 @@ export declare class ParticleSystem2d {
56
55
  * `dt` is capped to {@link ParticleSystem2d.maxDeltaTime}.
57
56
  */
58
57
  update(renderer: ParticleRenderer, dt: number): void;
59
- }
60
- //#endregion
58
+ }
@@ -1,9 +1,9 @@
1
- import { fract } from "./math.js";
2
1
  import { Color } from "./color.js";
3
- import { Random } from "./random.js";
2
+ import { fract } from "./math.js";
4
3
  import { rng } from "./rng.js";
5
4
  import { SpatialPartition2d } from "./spatial-partition-2d.js";
6
- //#region src/particle-system-2d.ts
5
+ import { Random } from "./random.js";
6
+ // src/particle-system-2d.ts
7
7
  /**
8
8
  * A `size` x `size` attraction matrix with values in [-1, 1). Deterministic: the same `size` and
9
9
  * `seed` always give the same matrix.
@@ -143,5 +143,4 @@ var ParticleSystem2d = class {
143
143
  this._updatePositions(dt, renderer);
144
144
  }
145
145
  };
146
- //#endregion
147
146
  export { ParticleSystem2d, randomMatrix };
package/dist/random.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/random.d.ts
2
1
  /**
3
2
  * Hash-based random numbers. The static methods are pure functions of their arguments (the same
4
3
  * inputs always give the same result), which makes them handy for coordinate-based noise; an
@@ -42,5 +41,4 @@ export declare class Random {
42
41
  sign(): -1 | 1;
43
42
  /** Next angle in radians in [0, 2π); advances the seed. */
44
43
  angle(): number;
45
- }
46
- //#endregion
44
+ }
package/dist/random.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TAU, hash32mix } from "./math.js";
2
- //#region src/random.ts
2
+ // src/random.ts
3
3
  /**
4
4
  * Hash-based random numbers. The static methods are pure functions of their arguments (the same
5
5
  * inputs always give the same result), which makes them handy for coordinate-based noise; an
@@ -70,5 +70,4 @@ var Random = class Random {
70
70
  return Random.angle(this._seed++);
71
71
  }
72
72
  };
73
- //#endregion
74
73
  export { Random };
@@ -1,5 +1,4 @@
1
1
  import { Vector } from "./vector.js";
2
- //#region src/rectangle.d.ts
3
2
  /**
4
3
  * Axis-aligned rectangle given by its top-left corner (`x`, `y`) and size. Edges are inclusive
5
4
  * in the containment and intersection tests.
@@ -40,5 +39,4 @@ export declare class Rectangle {
40
39
  grow(padding: number): Rectangle;
41
40
  /** Same as {@link Rectangle.contains} with a point. */
42
41
  vectorInside(vec: Vector, padding?: number): boolean;
43
- }
44
- //#endregion
42
+ }
package/dist/rectangle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Vector } from "./vector.js";
2
- //#region src/rectangle.ts
2
+ // src/rectangle.ts
3
3
  /**
4
4
  * Axis-aligned rectangle given by its top-left corner (`x`, `y`) and size. Edges are inclusive
5
5
  * in the containment and intersection tests.
@@ -65,5 +65,4 @@ var Rectangle = class Rectangle {
65
65
  return this.contains(vec, padding);
66
66
  }
67
67
  };
68
- //#endregion
69
68
  export { Rectangle };
@@ -1,4 +1,4 @@
1
- //#region src/math.ts
1
+ // src/math.ts
2
2
  /**
3
3
  * π, half a turn in radians.
4
4
  * @category Math & Random
@@ -202,8 +202,7 @@ const hash32mix = (...values) => {
202
202
  }
203
203
  return n;
204
204
  };
205
- //#endregion
206
- //#region src/random.ts
205
+ // src/random.ts
207
206
  /**
208
207
  * Hash-based random numbers. The static methods are pure functions of their arguments (the same
209
208
  * inputs always give the same result), which makes them handy for coordinate-based noise; an
@@ -274,8 +273,7 @@ var Random = class Random {
274
273
  return Random.angle(this._seed++);
275
274
  }
276
275
  };
277
- //#endregion
278
- //#region src/rng.ts
276
+ // src/rng.ts
279
277
  /**
280
278
  * Seeded random number generator with helpers for ranges, picking, shuffling, geometric points,
281
279
  * Gaussian samples and matrices. Every call advances the underlying {@link Random}, so a given
@@ -423,7 +421,6 @@ var Rng = class {
423
421
  * @category Math & Random
424
422
  */
425
423
  const rng = new Rng();
426
- //#endregion
427
424
  Object.defineProperty(exports, "DEG2RAD", {
428
425
  enumerable: true,
429
426
  get: function() {
package/dist/rng.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Random } from "./random.js";
2
- //#region src/rng.d.ts
3
2
  /**
4
3
  * Seeded random number generator with helpers for ranges, picking, shuffling, geometric points,
5
4
  * Gaussian samples and matrices. Every call advances the underlying {@link Random}, so a given
@@ -68,5 +67,4 @@ export declare class Rng {
68
67
  * Shared {@link Rng} seeded from `Date.now()` at module load; set `rng.seed` for reproducible results.
69
68
  * @category Math & Random
70
69
  */
71
- export declare const rng: Rng;
72
- //#endregion
70
+ export declare const rng: Rng;
package/dist/rng.js CHANGED
@@ -1,6 +1,6 @@
1
- import { TAU } from "./math.js";
2
1
  import { Random } from "./random.js";
3
- //#region src/rng.ts
2
+ import { TAU } from "./math.js";
3
+ // src/rng.ts
4
4
  /**
5
5
  * Seeded random number generator with helpers for ranges, picking, shuffling, geometric points,
6
6
  * Gaussian samples and matrices. Every call advances the underlying {@link Random}, so a given
@@ -148,5 +148,4 @@ var Rng = class {
148
148
  * @category Math & Random
149
149
  */
150
150
  const rng = new Rng();
151
- //#endregion
152
151
  export { Rng, rng };
package/dist/signal.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/signal.d.ts
2
1
  /**
3
2
  * A {@link Signal} subscriber: called with the new value.
4
3
  *
@@ -30,5 +29,4 @@ export declare class Signal<T> {
30
29
  set(value: T): void;
31
30
  /** Adds a subscriber and calls it right away with the current value; returns a function that removes it. */
32
31
  subscribe(subscriber: Subscriber<T>): () => void;
33
- }
34
- //#endregion
32
+ }
package/dist/signal.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/signal.ts
1
+ // src/signal.ts
2
2
  /**
3
3
  * A value holder that notifies subscribers when the value changes (compared with `Object.is`).
4
4
  * Subscribers are called immediately with the current value when they subscribe.
@@ -37,5 +37,4 @@ var Signal = class {
37
37
  return () => this.subscribers.delete(subscriber);
38
38
  }
39
39
  };
40
- //#endregion
41
40
  export { Signal };
@@ -1,4 +1,3 @@
1
- //#region src/spatial-partition-2d.d.ts
2
1
  /**
3
2
  * Anything with a position that a {@link SpatialPartition2d} can bucket.
4
3
  *
@@ -38,5 +37,4 @@ export declare class SpatialPartition2d {
38
37
  * axis the block has fewer than 9 cells.
39
38
  */
40
39
  getCellNeighbors(x: number, y: number): SpatialPartitionEntity2d[][];
41
- }
42
- //#endregion
40
+ }
@@ -1,5 +1,5 @@
1
1
  import { mod } from "./math.js";
2
- //#region src/spatial-partition-2d.ts
2
+ // src/spatial-partition-2d.ts
3
3
  /**
4
4
  * Uniform grid over the wrapping unit square [0, 1)², for finding nearby entities without
5
5
  * comparing every pair. The grid has `ceil(1 / cellSize)` cells per axis.
@@ -48,5 +48,4 @@ var SpatialPartition2d = class {
48
48
  return [...neighbors];
49
49
  }
50
50
  };
51
- //#endregion
52
51
  export { SpatialPartition2d };