hayao 0.2.0 → 0.3.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 (69) hide show
  1. package/README.md +113 -24
  2. package/bin/create-hayao.mjs +380 -0
  3. package/bin/hayao-mcp-cli.mjs +11 -0
  4. package/dist/app/browser.d.ts +33 -2
  5. package/dist/app/game.d.ts +47 -2
  6. package/dist/app/tuning.d.ts +68 -0
  7. package/dist/art/palette.d.ts +41 -0
  8. package/dist/audio/adaptive.d.ts +58 -0
  9. package/dist/audio/album.d.ts +16 -0
  10. package/dist/audio/analysis.d.ts +59 -0
  11. package/dist/audio/audio.d.ts +21 -0
  12. package/dist/audio/chord.d.ts +17 -0
  13. package/dist/audio/genres.d.ts +11 -0
  14. package/dist/audio/lint.d.ts +29 -0
  15. package/dist/audio/match.d.ts +38 -0
  16. package/dist/audio/music.d.ts +88 -0
  17. package/dist/audio/pcm.d.ts +54 -0
  18. package/dist/audio/quality.d.ts +28 -0
  19. package/dist/audio/reverb.d.ts +15 -0
  20. package/dist/audio/synth.d.ts +56 -0
  21. package/dist/audio/theory.d.ts +64 -0
  22. package/dist/content/campaign.d.ts +69 -0
  23. package/dist/content/generate.d.ts +78 -0
  24. package/dist/content/level.d.ts +93 -0
  25. package/dist/content/worldgraph.d.ts +73 -0
  26. package/dist/core/dmath.d.ts +2 -0
  27. package/dist/hayao.global.js +15 -0
  28. package/dist/index.d.ts +30 -1
  29. package/dist/index.js +4293 -434
  30. package/dist/index.js.map +4 -4
  31. package/dist/index.min.js +15 -0
  32. package/dist/input/source.d.ts +52 -1
  33. package/dist/mcp.js +31225 -0
  34. package/dist/rasterize-worker-lite.mjs +13 -0
  35. package/dist/render/canvas.d.ts +6 -1
  36. package/dist/render/commands.d.ts +46 -0
  37. package/dist/render/paint.d.ts +33 -0
  38. package/dist/render/renderer.d.ts +22 -0
  39. package/dist/render/svg.d.ts +4 -1
  40. package/dist/render/svgString.d.ts +6 -2
  41. package/dist/scene/cameraController.d.ts +42 -0
  42. package/dist/scene/node.d.ts +17 -4
  43. package/dist/scene/nodes.d.ts +14 -0
  44. package/dist/scene/parallax.d.ts +15 -0
  45. package/dist/studio/mcpMain.d.ts +1 -0
  46. package/dist/studio/mcpServer.d.ts +2 -0
  47. package/dist/studio/record.d.ts +54 -0
  48. package/dist/studio/run.d.ts +78 -0
  49. package/dist/studio/session.d.ts +80 -0
  50. package/dist/studio/timeline.d.ts +35 -0
  51. package/dist/studio/vitePlugin.d.ts +6 -0
  52. package/dist/studio-plugin.js +228 -0
  53. package/dist/ui/overlay.d.ts +6 -0
  54. package/dist/verify/audioFilmstrip.d.ts +39 -0
  55. package/dist/verify/ethnography.d.ts +67 -0
  56. package/dist/verify/gates.d.ts +160 -0
  57. package/dist/verify/layout.d.ts +30 -3
  58. package/dist/verify/ramp.d.ts +40 -0
  59. package/dist/world.d.ts +38 -2
  60. package/dist-studio/assets/index-C7tty_Wo.js +109 -0
  61. package/dist-studio/assets/index-CM3tjRQo.css +1 -0
  62. package/dist-studio/index.html +18 -0
  63. package/docs/API.md +233 -9
  64. package/docs/CONVENTIONS.md +223 -0
  65. package/docs/EMBED.md +85 -0
  66. package/docs/QUICKSTART.md +129 -0
  67. package/docs/STUDIO.md +97 -0
  68. package/docs/VERIFICATION.md +226 -0
  69. package/package.json +39 -6
@@ -1,4 +1,5 @@
1
- import { type InputMap } from './actions';
1
+ import { type InputMap, type InputState } from './actions';
2
+ import type { Vec2 } from '../core/math';
2
3
  export declare class KeyboardSource {
3
4
  private keysDown;
4
5
  /** Virtual action taps (from DOM buttons etc.) pending consumption by a step. */
@@ -23,3 +24,53 @@ export declare class KeyboardSource {
23
24
  setMap(map: InputMap): void;
24
25
  dispose(): void;
25
26
  }
27
+ /** A live pointer reading, in DESIGN space (already un-letterboxed). */
28
+ export interface PointerReadout {
29
+ /** Design-space x. Falls outside 0..width when the pointer leaves the letterbox. */
30
+ x: number;
31
+ y: number;
32
+ /** Is the primary pointer/finger currently pressed? */
33
+ down: boolean;
34
+ /** Has the pointer ever produced an event (else x/y are a neutral 0,0)? */
35
+ active: boolean;
36
+ }
37
+ /** What a PointerSource needs from a renderer: the DOM node + the design mapper. */
38
+ export interface PointerTarget {
39
+ readonly element?: HTMLElement | SVGElement;
40
+ toDesign?(clientX: number, clientY: number): Vec2;
41
+ }
42
+ /**
43
+ * Continuous pointer / touch input — the sibling of KeyboardSource for games
44
+ * driven by *where* the cursor is (slice, aim, drag, point-and-click, placement).
45
+ * It listens on the renderer's canvas, converts every event to DESIGN space via
46
+ * `renderer.toDesign`, and each fixed step writes the sample into InputState's
47
+ * analog axes: `pointer.x`, `pointer.y`, `pointer.down` (1/0). Sim code then
48
+ * reads `world.input.axis('pointer.x')` — no out-of-engine letterbox glue.
49
+ *
50
+ * Determinism note: axes are host-sampled live input and are NOT part of the
51
+ * string input log or the world hash. `sample()` QUANTIZES design coords to a
52
+ * 1/8-px grid so a recorded axes log (Studio sessions) replays bit-exactly —
53
+ * the sim only ever sees the quantized values, live or replayed. For lockstep
54
+ * netplay, still prefer discrete actions (map a tap to a key via
55
+ * KeyboardSource.press, or snap position to a grid cell). See docs/CONVENTIONS.md.
56
+ */
57
+ export declare class PointerSource {
58
+ private clientX;
59
+ private clientY;
60
+ private isDown;
61
+ private seen;
62
+ private target;
63
+ private el;
64
+ private onMove;
65
+ private onDown;
66
+ private onUp;
67
+ constructor(target: PointerTarget);
68
+ /** The current pointer position in design space + press state. */
69
+ read(): PointerReadout;
70
+ /**
71
+ * Write the current sample into an InputState's axes as pointer.x / pointer.y /
72
+ * pointer.down. Call once per step (the browser driver does this before advance).
73
+ */
74
+ sample(input: InputState): void;
75
+ dispose(): void;
76
+ }