@jgengine/react 0.22.0 → 0.23.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 (70) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/dist/accessibility.d.ts +5 -0
  3. package/dist/accessibility.js +9 -0
  4. package/dist/achievements.js +4 -3
  5. package/dist/actionHud.d.ts +6 -1
  6. package/dist/actionHud.js +37 -17
  7. package/dist/bars.js +5 -2
  8. package/dist/barsPreview.js +2 -1
  9. package/dist/characterSheet.js +5 -4
  10. package/dist/coachMarks.js +3 -2
  11. package/dist/codex.js +4 -3
  12. package/dist/components.js +9 -2
  13. package/dist/creditsScreen.js +2 -1
  14. package/dist/engineStyles.d.ts +18 -0
  15. package/dist/engineStyles.js +119 -0
  16. package/dist/fastTravel.js +4 -3
  17. package/dist/hud.js +7 -6
  18. package/dist/hudButton.d.ts +29 -0
  19. package/dist/hudButton.js +31 -0
  20. package/dist/hudChromePreview.d.ts +8 -0
  21. package/dist/hudChromePreview.js +27 -0
  22. package/dist/hudFrame.js +15 -11
  23. package/dist/hudInteract.d.ts +26 -0
  24. package/dist/hudInteract.js +28 -0
  25. package/dist/hudLayout.js +4 -3
  26. package/dist/hudPanel.d.ts +31 -0
  27. package/dist/hudPanel.js +32 -0
  28. package/dist/hudTheme.d.ts +88 -1
  29. package/dist/hudTheme.js +123 -8
  30. package/dist/hudThemePreview.js +2 -1
  31. package/dist/hudThemeRoot.d.ts +15 -0
  32. package/dist/hudThemeRoot.js +20 -0
  33. package/dist/hudTokens.d.ts +39 -0
  34. package/dist/hudTokens.js +56 -0
  35. package/dist/iconTreatment.js +3 -2
  36. package/dist/iconsPreview.js +2 -1
  37. package/dist/keybindingMenu.js +3 -2
  38. package/dist/map.js +9 -8
  39. package/dist/modals.d.ts +6 -3
  40. package/dist/modals.js +42 -52
  41. package/dist/notices.d.ts +27 -0
  42. package/dist/notices.js +145 -0
  43. package/dist/notifications.js +4 -3
  44. package/dist/panels.d.ts +9 -2
  45. package/dist/panels.js +78 -35
  46. package/dist/photoMode.js +2 -1
  47. package/dist/presence.d.ts +9 -0
  48. package/dist/presence.js +25 -0
  49. package/dist/previewFixtures.js +6 -0
  50. package/dist/questTracker.js +3 -2
  51. package/dist/quickMenu.js +6 -5
  52. package/dist/saveSlots.js +4 -3
  53. package/dist/selectionHud.js +4 -3
  54. package/dist/shopGrid.js +2 -1
  55. package/dist/statusEffectBar.js +2 -1
  56. package/dist/streetGeometryPreview.js +3 -2
  57. package/dist/styles.css +72 -0
  58. package/dist/talentTree.js +3 -2
  59. package/dist/tweenNumber.d.ts +37 -0
  60. package/dist/tweenNumber.js +66 -0
  61. package/dist/uiCues.d.ts +20 -0
  62. package/dist/uiCues.js +37 -0
  63. package/dist/waveHud.js +2 -1
  64. package/dist/waypointMarkers.js +2 -1
  65. package/package.json +10 -6
  66. package/skills/jgengine/api.md +18 -18
  67. package/skills/jgengine-ui/SKILL.md +4 -0
  68. package/skills/jgengine-ui/api.md +233 -37
  69. package/skills/jgengine-ui/capabilities.md +52 -0
  70. package/skills/jgengine-ui/reference-primitives.md +4 -4
@@ -69,6 +69,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
69
69
 
70
70
  - `useAutoScroll` (function) · `import { useAutoScroll } from "@jgengine/react"`
71
71
 
72
+ ## balance-ibl-lighting — trim flat ambient under IBL and add a key light to directionless lighting
73
+
74
+ - `balanceLightingForIbl` (function) · `import { balanceLightingForIbl } from "@jgengine/core/render/lightingBalance"`
75
+
72
76
  ## bounded-spatial-audio — play positional or flat cues with listener orientation, voice budgets, and per-source cleanup
73
77
 
74
78
  - `createAudioEngine` (function) · `import { createAudioEngine } from "@jgengine/shell/audio/audioEngine"`
@@ -210,6 +214,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
210
214
 
211
215
  - `useDragLayer` (function) · `import { useDragLayer } from "@jgengine/react"`
212
216
 
217
+ ## engine-styles — inject the engine stylesheet (jg-* keyframes, interaction states, reduced motion) once
218
+
219
+ - `useEngineStyles` (function) · `import { useEngineStyles } from "@jgengine/react/engineStyles"`
220
+
213
221
  ## entity-frames — overlay that renders caller-composed frames over on-screen entities
214
222
 
215
223
  - `EntityFrames` (function) · `import { EntityFrames } from "@jgengine/react"`
@@ -266,6 +274,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
266
274
 
267
275
  - `displaceHeightfieldGeometry` (function) · `import { displaceHeightfieldGeometry } from "@jgengine/shell/terrain"`
268
276
 
277
+ ## hud-button — themed button with hover lift, press scale, focus ring, disabled state, and an interaction cue seam
278
+
279
+ - `HudButton` (const) · `import { HudButton } from "@jgengine/react/hudButton"`
280
+
269
281
  ## hud-canvas — the HUD root surface — design-resolution scaling plus live panel-placement editing (F2+C)
270
282
 
271
283
  - `HudCanvas` (function) · `import { HudCanvas } from "@jgengine/react"`
@@ -290,6 +302,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
290
302
 
291
303
  - `IconSchool` (type) · `import { IconSchool } from "@jgengine/react"`
292
304
 
305
+ ## hud-interact — one listener for hover/press/activate/open/close from every engine HUD primitive
306
+
307
+ - `HudInteractProvider` (function) · `import { HudInteractProvider } from "@jgengine/react/hudInteract"`
308
+
293
309
  ## hud-layout — persistent, live-editable HUD panel layout state for `HudCanvas`
294
310
 
295
311
  - `useHudLayout` (function) · `import { useHudLayout } from "@jgengine/react"`
@@ -326,10 +342,18 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
326
342
 
327
343
  - `deriveHudTheme` (function) · `import { deriveHudTheme } from "@jgengine/react"`
328
344
 
345
+ ## hud-theme-root — apply the default (or a game) HudTheme and the engine stylesheet at the HUD root
346
+
347
+ - `HudThemeRoot` (function) · `import { HudThemeRoot } from "@jgengine/react/hudThemeRoot"`
348
+
329
349
  ## hud-ticker — re-render a HUD element at a steady hz for time-derived readouts (cooldowns, cast/swing bars) — no hand-rolled setInterval effects
330
350
 
331
351
  - `useTicker` (function) · `import { useTicker } from "@jgengine/react"`
332
352
 
353
+ ## hud-tokens — inline-style accessors for the HudTheme type scale, spacing, motion, elevation, and focus ring
354
+
355
+ - `HudTypeStep` (type) · `import { HudTypeStep } from "@jgengine/react/hudTokens"`
356
+
333
357
  ## hud-vitals — atomic purpose-named vitals bars (token-themed parts, not a finished HUD)
334
358
 
335
359
  - `BarTokens` (interface) · `import { BarTokens } from "@jgengine/react"`
@@ -414,6 +438,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
414
438
 
415
439
  - `menuStackReducer` (function) · `import { menuStackReducer } from "@jgengine/react/menuRouter"`
416
440
 
441
+ ## merge-post-processing — layer a partial post chain over a look preset without losing its stages
442
+
443
+ - `mergePostProcessing` (function) · `import { mergePostProcessing } from "@jgengine/core/render/lookPreset"`
444
+
417
445
  ## minimap — framed circular minimap with terrain bake, fog, markers, and facing arrow
418
446
 
419
447
  - `Minimap` (function) · `import { Minimap } from "@jgengine/react"`
@@ -456,6 +484,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
456
484
 
457
485
  - `modelLoadIdleMs` (function) · `import { modelLoadIdleMs } from "@jgengine/shell/render/modelLoad"`
458
486
 
487
+ ## model-load-starts — count of model streaming bursts, for capture quiescence checks
488
+
489
+ - `modelLoadStarts` (function) · `import { modelLoadStarts } from "@jgengine/shell/render/modelLoad"`
490
+
459
491
  ## multiplayer-p2p — bootstrap a playable authoritative world for browser peer co-op
460
492
 
461
493
  - `resolvePeerShellMultiplayer` (function) · `import { resolvePeerShellMultiplayer } from "@jgengine/shell/multiplayer"`
@@ -464,6 +496,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
464
496
 
465
497
  - `WorldNameplates` (function) · `import { WorldNameplates } from "@jgengine/shell/world/WorldHud"`
466
498
 
499
+ ## notice-feed — render ctx.game.notices as an animated toned stack (enter/exit motion, ×N stacking)
500
+
501
+ - `NoticeStack` (function) · `import { NoticeStack } from "@jgengine/react/notices"`
502
+
467
503
  ## notification-bell — icon button with a live unread-count badge over a notification store
468
504
 
469
505
  - `NotificationBell` (function) · `import { NotificationBell } from "@jgengine/react"`
@@ -553,6 +589,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
553
589
 
554
590
  - `Popover` (function) · `import { Popover } from "@jgengine/react"`
555
591
 
592
+ ## presence — keep a closing element mounted through its exit transition
593
+
594
+ - `usePresence` (function) · `import { usePresence } from "@jgengine/react/presence"`
595
+
556
596
  ## projected-overdraw — sample actual mesh/camera fragment overlap with native coverage and explicit depth/blending/transmission limits
557
597
 
558
598
  - `measureProjectedOverdraw` (function) · `import { measureProjectedOverdraw } from "@jgengine/shell/render/projectedOverdraw"`
@@ -698,6 +738,18 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
698
738
 
699
739
  - `TransformGizmo` (const) · `import { TransformGizmo } from "@jgengine/shell/structures"`
700
740
 
741
+ ## tween-number — rolling number readout with an up/down delta flash
742
+
743
+ - `TweenNumber` (function) · `import { TweenNumber } from "@jgengine/react/tweenNumber"`
744
+
745
+ ## tweened-value — animate a displayed number toward its target, honouring reduced motion
746
+
747
+ - `useTweenedValue` (function) · `import { useTweenedValue } from "@jgengine/react/tweenNumber"`
748
+
749
+ ## ui-sound-cues — play click/hover/open/close/confirm/deny/notify UI sounds from any component
750
+
751
+ - `useUiCue` (function) · `import { useUiCue } from "@jgengine/react/uiCues"`
752
+
701
753
  ## use-camera-shake — React hook binding a camera-shake controller — subscribes for live trauma/kind and can self-drive its decay on a frame loop
702
754
 
703
755
  - `useCameraShake` (function) · `import { useCameraShake } from "@jgengine/react"`
@@ -70,7 +70,7 @@ instead of mirroring external entities into `createMarkerSet`.
70
70
 
71
71
  **Toggleable game windows** are already shipped, not hand-rolled open/close state: `usePanels(defs)` + `<PanelHost>` + `<Window>` (`@jgengine/react`) over the headless `@jgengine/core/ui/panelModel` are THE way to build openable windows — bag (`B`), character (`C`), spellbook, quest log — with keybind toggles, drag-to-move, close buttons, ESC-to-close, and z-stack ordering all handled. Declare each window in `defs` (id, keybind, title), mount one `<PanelHost>`, and render each panel's body inside a `<Window>`; the game owns the body content and skin, the model owns focus/stacking/keybind wiring. Never re-derive window toggling from local `useState` booleans and hand-rolled keydown listeners.
72
72
 
73
- Window title-bar movement belongs to one primary pointer. Release, cancellation, capture loss, blur, and window unmount retire that gesture's listeners; another pointer cannot move it. Controlled positions and panel z-order remain caller-owned.
73
+ Window title-bar movement belongs to one primary pointer. Release, cancellation, capture loss, blur, and window unmount retire that gesture's listeners; another pointer cannot move it. Controlled positions and panel z-order remain caller-owned. Windows without a `variation` render on `HudPanel` (theme frame plus modal elevation) and rise in on open; `PanelHost` keeps a closed window mounted for its short exit transition, and closing retires any drag in progress. `ModalHost` fades its backdrop and lifts the dialog in, and plays the same exit when the stack empties; `ConfirmDialog` and `PauseMenu` are built from `HudPanel` and `HudButton`.
74
74
 
75
75
  **Character sheet / paperdoll** is already shipped, not hand-rolled: `<CharacterSheet>` / `<Paperdoll>` / `<StatList>` (`@jgengine/react`) compose the paperdoll equip layout (worn `EquipmentSlots` arranged around a portrait) and the derived-stat readout into one window body. `Paperdoll` is the equip-slot arrangement, `StatList` the derived-stat rows, `CharacterSheet` the batteries-included default that pairs them — the game composes and reskins them (slot layout, stat labels/terminology, skin) rather than re-deriving a paperdoll from raw divs and manual stat math.
76
76
 
@@ -80,21 +80,21 @@ Do not create a primitive whose only value is wrapping a `div` with border radiu
80
80
 
81
81
  ## Rendering — post-processing, lighting, shadows
82
82
 
83
- **Look presets.** Unset `look` is `"neutral"` (#1719): the game's own `lighting`/`backdrop`/`postProcessing` with an AgX tone-map and no styling. One field picks a whole art direction: `"photoreal"` (high-contrast PBR post), `"cinematic"` (day sky, view-following shadow-casting sun, tone-map/bloom/SSAO/vignette), `"toon"` (clean graphic grade), `"comic"` (ink outlines + cel bands + saturated grade — Borderlands-style), `"retro"` (pixelated, posterized, no smoothing), and `"flat"` (bare ambient+directional rig, no post). Non-neutral presets add a day sky unless the world declares one. The preset only fills knobs you didn't set — any explicit `lighting`/`backdrop`/`postProcessing` always wins. `resolveGameLook` (`@jgengine/core/render/lookPreset`) is the pure resolver; assert on it in a `bun test` (the post/sky layers are not visible to `summarizeEnvironment`). HUD-presentation and no-camera games are unaffected.
83
+ **Look presets.** Unset `look` is `"neutral"` (#1719): the game's own `lighting`/`backdrop`/`postProcessing` with an AgX tone-map and no styling. One field picks a whole art direction: `"photoreal"` (high-contrast PBR post), `"cinematic"` (day sky, view-following shadow-casting sun, tone-map/bloom/SSAO/vignette), `"toon"` (clean graphic grade), `"comic"` (ink outlines + cel bands + saturated grade — Borderlands-style), `"retro"` (pixelated, posterized, no smoothing), and `"flat"` (bare ambient+directional rig, no post). Non-neutral presets add a day sky unless the world declares one. The preset only fills knobs you didn't set — any explicit `lighting`/`backdrop` wins, and a styled preset's post stages deep-merge under a partial `postProcessing` (`mergePostProcessing`): fields you set, including `false`, win; stages you omit come from the preset. Under `"neutral"` your chain is used as authored. `resolveGameLook` (`@jgengine/core/render/lookPreset`) is the pure resolver; assert on it in a `bun test` (the post/sky layers are not visible to `summarizeEnvironment`). HUD-presentation and no-camera games are unaffected.
84
84
 
85
85
  The post chain itself is never hand-wired render passes. Set `defineGame({ postProcessing })` (`PostProcessingConfig` from `@jgengine/core/render/postProcessing`) and the shell mounts an `EffectComposer` and owns the render: RenderPass → AO → Bloom → tone-map output → Stylize → Grade. Each stage is a config object, `false` to skip, or omitted for its tuned default:
86
86
 
87
87
  - `toneMapping: "aces" | "agx" | "reinhard" | "cineon" | "linear" | "none"` (default `aces`) + `exposure`.
88
88
  - `bloom: { strength, radius, threshold }` — HDR glow around bright pixels (defaults 0.32 / 0.55 / 0.85).
89
89
  - `grade: { lift, gain, gamma, saturation, vignette, grain }` — display-space colour grade: cool-shadow/warm-highlight split, vignette, animated film grain.
90
- - `ao: { radius, intensity, distanceFalloff, blend }` — ground-truth ambient occlusion; heavier than the rest, omit or `false` on low-end targets.
90
+ - `ao: { radius, intensity, distanceFalloff, blend }` — ground-truth ambient occlusion. Omitted runs `DEFAULT_AO` on tiers whose `postStages.ao` is on (medium and up; low skips it); `ao: false` turns it off everywhere. It adds a normal/depth prepass (one extra draw per opaque mesh) and is fill-heavy: 8 samples on medium, 12 on high, 16 on ultra.
91
91
  - `stylize: { outline, bands, pixelSize }` — art style without touching materials. `outline: { color, thickness, opacity, depthThreshold, normalThreshold, fadeDistance }` traces ink lines from depth and normal edges (one extra normal/depth scene render, shadow maps reused); `bands` quantizes brightness into cel bands keeping hue; `pixelSize` snaps the frame to retro blocks. Mix freely: outline alone is a clean comic ink, `bands: 3` plus outline is cartoon, `pixelSize` plus `bands` is retro. Mark custom overlay effects with `POSTFX_OVERLAY_USERDATA` so they are not outlined; transparent, alpha-cut, points, lines and sprites are skipped automatically.
92
92
 
93
93
  AO and depth-of-field prepasses reuse the beauty pass's shadow maps; they do not redraw shadow casters. Prepass failure restores shadow update policy and marked overlay visibility. The composer resizes passes through `setSize`, and graph cleanup calls each pass's `dispose` once; avoid reading a pass's internal targets or materials.
94
94
 
95
95
  **Orbit camera occlusion:** the third-person orbit rig takes `camera: { collision: { enabled, padding?, minTargetDistance? } }` — a spring-arm that raycasts target→camera each frame and pulls the boom in past walls/terrain so the camera never clips inside geometry. Off by default (unchanged chase feel); enable it for any world with interiors or dense structures.
96
96
 
97
- Lighting is `defineGame({ lighting })` (`LightingConfig`): ambient / hemisphere / directional, replacing the shell's default lights when set. A `DirectionalLightingConfig` with `castShadow` takes `shadowMapSize`, `shadowCameraSize`, `shadowBias`, `shadowNormalBias` for crisp contact shadows. Sky-lit worlds (a `sky()` world feature) get a high-res sun whose shadow camera follows the view each frame, so grounded shadows stay sharp under the player anywhere in a large world.
97
+ Lighting is `defineGame({ lighting })` (`LightingConfig`): ambient / hemisphere / directional, replacing the shell's default lights when set. A `DirectionalLightingConfig` with `castShadow` takes `shadowMapSize`, `shadowCameraSize`, `shadowBias`, `shadowNormalBias` and `shadowRadius` (PCF penumbra in texels, default 1.25; the shell uses `PCFShadowMap` — in three r182 `PCFSoftShadowMap` silently compiles as unfiltered basic shadows). Every look but `"flat"` adds image-based light from a procedural sky probe (sky/horizon/ground from `hemisphere`, an HDR sun lobe from the first directional light, horizon leaning toward the ambient colour, intensity 0.45); `environmentSource` swaps in an HDRI or cube map. Under that IBL, `ambient` intensity is scaled by `iblAmbientScale` (default 0.5; set 1 to keep it), and lighting with no `directional` entry gets a soft shadowless key tinted by the ambient colour unless `fallbackKey: false` (`balanceLightingForIbl` in `@jgengine/core/render/lightingBalance`). Sky-lit worlds (a `sky()` world feature) get a high-res sun whose shadow camera follows the view each frame, so grounded shadows stay sharp under the player anywhere in a large world.
98
98
 
99
99
  ## First-person viewmodel, WorldOverlay props, render cues (#542)
100
100