@umicat/three-sdk 1.0.1 → 1.1.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.
@@ -1,6 +1,7 @@
1
1
  import { UmicatCore } from '@umicat/platform-sdk/core/UmicatCore.js';
2
2
  import type { UmicatInitOptions } from '@umicat/platform-sdk/core/UmicatCore.js';
3
3
  import { DialogueModule } from '@umicat/platform-sdk/dialogue/DialogueModule.js';
4
+ import { HudBinding3DNamespace } from './hud3d/HudDynamicBinding3D.js';
4
5
  export type { UmicatInitOptions };
5
6
  /**
6
7
  * Umicat platform services for a three.js game.
@@ -18,6 +19,11 @@ export type { UmicatInitOptions };
18
19
  export declare class ThreeUmicat extends UmicatCore {
19
20
  /** Scripted (authored, non-AI) dialogue. Supply a renderer when playing. */
20
21
  readonly dialogue: DialogueModule<unknown, unknown>;
22
+ /** Dynamic-value registry for `HudTextSource`/`HudNumberSource` bindings
23
+ * authored in a HUD scene (`{mode:'dynamic', binding: key}`) — the one-line
24
+ * contract behavior code uses to drive a HUD widget, e.g.
25
+ * `umicat.hud.set('score', 42)`. See `hud3d/HudDynamicBinding3D.ts`. */
26
+ readonly hud: HudBinding3DNamespace;
21
27
  private constructor();
22
28
  static init(options?: UmicatInitOptions): Promise<ThreeUmicat>;
23
29
  }
@@ -1,5 +1,6 @@
1
1
  import { UmicatCore } from '@umicat/platform-sdk/core/UmicatCore.js';
2
2
  import { DialogueModule } from '@umicat/platform-sdk/dialogue/DialogueModule.js';
3
+ import { HudBinding3DNamespace } from './hud3d/HudDynamicBinding3D.js';
3
4
  /** Kept in sync with package.json on each publish. */
4
5
  const SDK_VERSION = '0.0.1';
5
6
  /**
@@ -19,6 +20,7 @@ export class ThreeUmicat extends UmicatCore {
19
20
  constructor(transport) {
20
21
  super(transport);
21
22
  this.dialogue = new DialogueModule(this.saves, () => transport.locale ?? 'en', () => transport.user?.name ?? null);
23
+ this.hud = new HudBinding3DNamespace();
22
24
  }
23
25
  static async init(options = {}) {
24
26
  const game = new ThreeUmicat(await UmicatCore.connect(SDK_VERSION, options));
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Dynamic HUD value registry — the 3D counterpart of 2D's Phaser
3
+ * `scene.registry`/`umicat.gameData` binding source for `HudTextSource`/
4
+ * `HudNumberSource`. Three-sdk has no Phaser scene registry to piggyback on,
5
+ * so this is a small standalone `Map` + subscriber set, exposed on
6
+ * `ThreeUmicat` as `umicat.hud.set/get` — the same one-line contract 2D's
7
+ * skill already teaches behavior code (`scene.registry.set(key, value)` →
8
+ * `umicat.hud.set(key, value)`), just a different namespace underneath.
9
+ */
10
+ type Listener = (value: unknown) => void;
11
+ export declare function setHudBinding3D(key: string, value: unknown): void;
12
+ export declare function getHudBinding3D(key: string): unknown;
13
+ /** Subscribe to a binding's changes. Returns an unsubscribe function. Used
14
+ * internally by spawned widgets that hold a `mode:'dynamic'` source so they
15
+ * can update their own DOM node without the runtime re-spawning anything. */
16
+ export declare function subscribeHudBinding3D(key: string, fn: Listener): () => void;
17
+ export declare function resolveHudText3D(source: {
18
+ mode: 'static';
19
+ text: string;
20
+ } | {
21
+ mode: 'dynamic';
22
+ binding: string;
23
+ prefix?: string;
24
+ suffix?: string;
25
+ fallback?: string;
26
+ }): string;
27
+ export declare function resolveHudNumber3D(source: {
28
+ mode: 'static';
29
+ value: number;
30
+ } | {
31
+ mode: 'dynamic';
32
+ binding: string;
33
+ fallback?: number;
34
+ }): number;
35
+ /** Public surface mounted as `umicat.hud` on `ThreeUmicat`. */
36
+ export declare class HudBinding3DNamespace {
37
+ set(key: string, value: unknown): void;
38
+ get(key: string): unknown;
39
+ }
40
+ export {};
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Dynamic HUD value registry — the 3D counterpart of 2D's Phaser
3
+ * `scene.registry`/`umicat.gameData` binding source for `HudTextSource`/
4
+ * `HudNumberSource`. Three-sdk has no Phaser scene registry to piggyback on,
5
+ * so this is a small standalone `Map` + subscriber set, exposed on
6
+ * `ThreeUmicat` as `umicat.hud.set/get` — the same one-line contract 2D's
7
+ * skill already teaches behavior code (`scene.registry.set(key, value)` →
8
+ * `umicat.hud.set(key, value)`), just a different namespace underneath.
9
+ */
10
+ const values = new Map();
11
+ const listeners = new Map();
12
+ export function setHudBinding3D(key, value) {
13
+ values.set(key, value);
14
+ for (const fn of listeners.get(key) ?? [])
15
+ fn(value);
16
+ }
17
+ export function getHudBinding3D(key) {
18
+ return values.get(key);
19
+ }
20
+ /** Subscribe to a binding's changes. Returns an unsubscribe function. Used
21
+ * internally by spawned widgets that hold a `mode:'dynamic'` source so they
22
+ * can update their own DOM node without the runtime re-spawning anything. */
23
+ export function subscribeHudBinding3D(key, fn) {
24
+ let set = listeners.get(key);
25
+ if (!set) {
26
+ set = new Set();
27
+ listeners.set(key, set);
28
+ }
29
+ set.add(fn);
30
+ return () => { set.delete(fn); if (set.size === 0)
31
+ listeners.delete(key); };
32
+ }
33
+ export function resolveHudText3D(source) {
34
+ if (source.mode === 'static')
35
+ return source.text;
36
+ const raw = values.get(source.binding);
37
+ const text = typeof raw === 'string' || typeof raw === 'number' ? String(raw) : (source.fallback ?? '');
38
+ return `${source.prefix ?? ''}${text}${source.suffix ?? ''}`;
39
+ }
40
+ export function resolveHudNumber3D(source) {
41
+ if (source.mode === 'static')
42
+ return source.value;
43
+ const raw = values.get(source.binding);
44
+ return typeof raw === 'number' ? raw : (source.fallback ?? 0);
45
+ }
46
+ /** Public surface mounted as `umicat.hud` on `ThreeUmicat`. */
47
+ export class HudBinding3DNamespace {
48
+ set(key, value) { setHudBinding3D(key, value); }
49
+ get(key) { return getHudBinding3D(key); }
50
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Pure-DOM 3D HUD runtime. Unlike 2D's `HudRuntime.ts`, there is no canvas to
3
+ * draw to and nothing to keep in sync via `requestAnimationFrame` — every
4
+ * widget kind is a real DOM element from the start (3D games already use a
5
+ * real `#hud` div, see `umicat-template/CLAUDE.md`'s "never write
6
+ * `hud.textContent`" convention), and 3D's canvas has no internal
7
+ * letterboxing (`width:100%;height:100%`, no fixed design resolution), so
8
+ * CSS alone resolves an anchor to a screen position with zero per-frame JS.
9
+ *
10
+ * One loader serves both Play and Edit (mirrors 2D's "one loader for both"
11
+ * principle) — the differences between them live entirely in the EDITOR
12
+ * layer (`EditorDesignPlayer3D.ts`'s HUD sub-mode: a backdrop over the
13
+ * canvas + pointer handlers added on top of these same DOM nodes), never in
14
+ * this file.
15
+ */
16
+ import type { Hud3DEntity, Hud3DScene } from './types.js';
17
+ export { resolveAnchor3D } from './anchor3d.js';
18
+ export interface Hud3DRuntimeHandle {
19
+ /** Root wrapper div this mount owns — a CHILD of `#hud` (or `opts.hudRootId`),
20
+ * never a replacement for it: the game's own hand-authored HUD content, if
21
+ * any, is untouched. */
22
+ root: HTMLElement;
23
+ /** Apply a patch to one entity's DOM node + its field. Used by the editor
24
+ * bridge (live patch) and whenever a dynamic binding's value changes. */
25
+ patchEntity(entityId: string, patch: Partial<Hud3DEntity>): void;
26
+ spawnEntity(entity: Hud3DEntity): HTMLElement;
27
+ removeEntity(entityId: string): void;
28
+ /** Current entity data, keyed by id — the in-memory model this handle owns. */
29
+ readonly entities: Map<string, Hud3DEntity>;
30
+ /** Tears down the mount: removes the wrapper div, clears listeners.
31
+ * Needed for "switch which HUD is being edited" (re-mount a different
32
+ * file) even though `EditorDesignPlayer3D` itself never tears down on
33
+ * exit (a scene switch is a full iframe reload, per existing convention). */
34
+ destroy(): void;
35
+ }
36
+ /** Mounts (or re-mounts) a HUD scene's DOM tree. Both Play and Edit call
37
+ * this same function — see this file's header comment. */
38
+ export declare function loadHud3DScene(hudScene: Hud3DScene, opts?: {
39
+ hudRootId?: string;
40
+ }): Hud3DRuntimeHandle;
@@ -0,0 +1,78 @@
1
+ import { DEFAULT_SAFE_AREA_3D } from './types.js';
2
+ import { spawnHud3DEntity, patchHud3DEntityDom, cleanupHud3DNode } from './spawnHud3DEntity.js';
3
+ import { resolveHudText3D, resolveHudNumber3D } from './HudDynamicBinding3D.js';
4
+ export { resolveAnchor3D } from './anchor3d.js';
5
+ const ROOT_WRAPPER_ID = 'umicat-hud3d-root';
6
+ /** Mounts (or re-mounts) a HUD scene's DOM tree. Both Play and Edit call
7
+ * this same function — see this file's header comment. */
8
+ export function loadHud3DScene(hudScene, opts) {
9
+ const hudHost = document.getElementById(opts?.hudRootId ?? 'hud') ?? document.body;
10
+ // Remove a prior mount of ours, if any — a HUD switch (editor "switch
11
+ // which HUD is being edited") must not leave the old one's nodes behind.
12
+ const existing = document.getElementById(ROOT_WRAPPER_ID);
13
+ if (existing)
14
+ existing.remove();
15
+ const root = document.createElement('div');
16
+ root.id = ROOT_WRAPPER_ID;
17
+ // Keep this mount discoverable (and spared) if the game or editor ever
18
+ // walks document.body hiding "static" markup — see EditorDesignPlayer3D's
19
+ // `hideNonCanvasStaticMarkup` and this directory's editor integration.
20
+ root.setAttribute('data-umicat-keep', '');
21
+ hudHost.appendChild(root);
22
+ const entities = new Map();
23
+ const nodes = new Map();
24
+ const safeArea = hudScene.design?.safeArea ?? DEFAULT_SAFE_AREA_3D;
25
+ function spawnEntity(entity) {
26
+ if (entity.editorHidden) {
27
+ // Still tracked (so a later patch can un-hide it) but nothing mounts.
28
+ entities.set(entity.id, entity);
29
+ return document.createElement('div');
30
+ }
31
+ const el = spawnHud3DEntity(entity, safeArea, { resolveText: resolveHudText3D, resolveNumber: resolveHudNumber3D });
32
+ if (entity.visible === false)
33
+ el.style.display = 'none';
34
+ root.appendChild(el);
35
+ entities.set(entity.id, entity);
36
+ nodes.set(entity.id, el);
37
+ return el;
38
+ }
39
+ function removeEntity(entityId) {
40
+ const el = nodes.get(entityId);
41
+ if (el) {
42
+ cleanupHud3DNode(el);
43
+ el.remove();
44
+ }
45
+ nodes.delete(entityId);
46
+ entities.delete(entityId);
47
+ }
48
+ function patchEntity(entityId, patch) {
49
+ const current = entities.get(entityId);
50
+ if (!current)
51
+ return;
52
+ const next = { ...current, ...patch };
53
+ entities.set(entityId, next);
54
+ const el = nodes.get(entityId);
55
+ if (!el) {
56
+ // Was editorHidden (unmounted) and the patch un-hides it — respawn.
57
+ if (patch.editorHidden === false)
58
+ spawnEntity(next);
59
+ return;
60
+ }
61
+ if (next.editorHidden) {
62
+ el.remove();
63
+ nodes.delete(entityId);
64
+ return;
65
+ }
66
+ patchHud3DEntityDom(el, next, safeArea, { resolveText: resolveHudText3D, resolveNumber: resolveHudNumber3D });
67
+ }
68
+ for (const entity of hudScene.entities ?? [])
69
+ spawnEntity(entity);
70
+ function destroy() {
71
+ for (const el of nodes.values())
72
+ cleanupHud3DNode(el);
73
+ root.remove();
74
+ nodes.clear();
75
+ entities.clear();
76
+ }
77
+ return { root, patchEntity, spawnEntity, removeEntity, entities, destroy };
78
+ }
@@ -0,0 +1,22 @@
1
+ /** Anchor→CSS resolution, split into its own file so `HudRuntime3D.ts` and
2
+ * `spawnHud3DEntity.ts` can both import it without a circular dependency
3
+ * between the two (the runtime orchestrates mounting, the spawn module
4
+ * builds individual DOM subtrees — both need this, neither owns it). */
5
+ import type { Anchor3D } from './types.js';
6
+ /** Resolve one anchor to CSS positioning. Convention (documented here since
7
+ * it's a 3D-specific judgment call, not a byte-for-byte port of 2D's own
8
+ * sign convention): `offsetX`/`offsetY` are a uniform screen-space nudge —
9
+ * positive X always moves right, positive Y always moves down, regardless
10
+ * of which corner/edge the widget is anchored to. Left/right and top/bottom
11
+ * anchoring uses real CSS `left`/`right`/`top`/`bottom` (not computed pixel
12
+ * `left`/`top` for every side) specifically so a widget re-anchors itself
13
+ * on window resize with ZERO JavaScript — no resize listener, no
14
+ * recomputation, unlike 2D's `resolveAnchor` which has to be because
15
+ * Phaser's `Scale.RESIZE` fires on resize and the game's logical/physical
16
+ * canvas size can diverge. */
17
+ export declare function resolveAnchor3D(anchor: Anchor3D, safeArea?: {
18
+ top: number;
19
+ right: number;
20
+ bottom: number;
21
+ left: number;
22
+ }): Partial<CSSStyleDeclaration>;
@@ -0,0 +1,44 @@
1
+ import { DEFAULT_SAFE_AREA_3D } from './types.js';
2
+ /** Resolve one anchor to CSS positioning. Convention (documented here since
3
+ * it's a 3D-specific judgment call, not a byte-for-byte port of 2D's own
4
+ * sign convention): `offsetX`/`offsetY` are a uniform screen-space nudge —
5
+ * positive X always moves right, positive Y always moves down, regardless
6
+ * of which corner/edge the widget is anchored to. Left/right and top/bottom
7
+ * anchoring uses real CSS `left`/`right`/`top`/`bottom` (not computed pixel
8
+ * `left`/`top` for every side) specifically so a widget re-anchors itself
9
+ * on window resize with ZERO JavaScript — no resize listener, no
10
+ * recomputation, unlike 2D's `resolveAnchor` which has to be because
11
+ * Phaser's `Scale.RESIZE` fires on resize and the game's logical/physical
12
+ * canvas size can diverge. */
13
+ export function resolveAnchor3D(anchor, safeArea = DEFAULT_SAFE_AREA_3D) {
14
+ const side = anchor.side;
15
+ const offsetX = anchor.offsetX ?? 0;
16
+ const offsetY = anchor.offsetY ?? 0;
17
+ const style = { position: 'fixed' };
18
+ const isLeft = side === 'top-left' || side === 'left' || side === 'bottom-left';
19
+ const isRight = side === 'top-right' || side === 'right' || side === 'bottom-right';
20
+ const isHCenter = side === 'top' || side === 'center' || side === 'bottom';
21
+ const isTop = side === 'top-left' || side === 'top' || side === 'top-right';
22
+ const isBottom = side === 'bottom-left' || side === 'bottom' || side === 'bottom-right';
23
+ const isVCenter = side === 'left' || side === 'center' || side === 'right';
24
+ const transforms = [];
25
+ if (isLeft)
26
+ style.left = `${safeArea.left + offsetX}px`;
27
+ else if (isRight)
28
+ style.right = `${safeArea.right - offsetX}px`;
29
+ else if (isHCenter) {
30
+ style.left = `calc(50% + ${offsetX}px)`;
31
+ transforms.push('translateX(-50%)');
32
+ }
33
+ if (isTop)
34
+ style.top = `${safeArea.top + offsetY}px`;
35
+ else if (isBottom)
36
+ style.bottom = `${safeArea.bottom - offsetY}px`;
37
+ else if (isVCenter) {
38
+ style.top = `calc(50% + ${offsetY}px)`;
39
+ transforms.push('translateY(-50%)');
40
+ }
41
+ if (transforms.length)
42
+ style.transform = transforms.join(' ');
43
+ return style;
44
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Builds the real DOM subtree for one HUD entity, kind by kind. All 7 kinds
3
+ * are plain DOM — no canvas, no Phaser-GameObject/DOM-mirror hybrid (see
4
+ * `HudRuntime3D.ts`'s header comment for why 3D doesn't need that). 9-slice
5
+ * backgrounds use CSS `border-image` against the SAME L/R/T/B cut config
6
+ * 2D's `NinePatchConfig` already stores (`ninePatch3D` on the entity) — a
7
+ * different renderer for the same authored data, not a new authoring
8
+ * concept.
9
+ */
10
+ import type { Hud3DEntity, HudNumberSource3D, HudTextSource3D } from './types.js';
11
+ interface Resolvers {
12
+ resolveText: (s: HudTextSource3D) => string;
13
+ resolveNumber: (s: HudNumberSource3D) => number;
14
+ }
15
+ type SafeArea = {
16
+ top: number;
17
+ right: number;
18
+ bottom: number;
19
+ left: number;
20
+ };
21
+ /** Called before a node is removed or re-spawned — cleans up any dynamic
22
+ * binding subscriptions it holds. */
23
+ export declare function cleanupHud3DNode(el: HTMLElement): void;
24
+ export declare function spawnHud3DEntity(entity: Hud3DEntity, safeArea: SafeArea, r: Resolvers): HTMLElement;
25
+ /** In-place patch: removes the old node, spawns a fresh one with the merged
26
+ * entity, and swaps it in — simplest-correct approach for v1 (every field
27
+ * can affect layout/background/content, so a full respawn is never wrong,
28
+ * only a cheap live mutation could be WRONG if it misses a field). Phase 4
29
+ * can optimize hot paths (e.g. plain color/text changes) if respawn churn
30
+ * turns out to matter. */
31
+ export declare function patchHud3DEntityDom(el: HTMLElement, entity: Hud3DEntity, safeArea: SafeArea, r: Resolvers): HTMLElement;
32
+ export {};
@@ -0,0 +1,266 @@
1
+ import { resolveAnchor3D } from './anchor3d.js';
2
+ import { subscribeHudBinding3D } from './HudDynamicBinding3D.js';
3
+ // Unsubscribe functions for any dynamic-binding subscriptions a spawned node
4
+ // holds, keyed by the node itself — cleared on remove/respawn so switching
5
+ // scenes or re-patching an entity can't leak listeners.
6
+ const unsubscribers = new WeakMap();
7
+ function trackUnsub(el, fn) {
8
+ let list = unsubscribers.get(el);
9
+ if (!list) {
10
+ list = [];
11
+ unsubscribers.set(el, list);
12
+ }
13
+ list.push(fn);
14
+ }
15
+ /** Called before a node is removed or re-spawned — cleans up any dynamic
16
+ * binding subscriptions it holds. */
17
+ export function cleanupHud3DNode(el) {
18
+ for (const fn of unsubscribers.get(el) ?? [])
19
+ fn();
20
+ unsubscribers.delete(el);
21
+ }
22
+ function applyBase(el, entity, safeArea) {
23
+ const style = resolveAnchor3D(entity.anchor, safeArea);
24
+ Object.assign(el.style, style);
25
+ el.style.zIndex = entity.layer === 'modal' ? '300' : entity.layer === 'overlay' ? '200' : '100';
26
+ if (typeof entity.z === 'number')
27
+ el.style.zIndex = String(Number(el.style.zIndex) + entity.z);
28
+ el.id = `umicat-hud3d-${entity.id}`;
29
+ el.dataset.hud3dEntityId = entity.id;
30
+ el.dataset.hud3dKind = entity.kind;
31
+ }
32
+ function applyNinePatch(el, assetUrl, np) {
33
+ if (!assetUrl)
34
+ return;
35
+ if (np) {
36
+ el.style.borderStyle = 'solid';
37
+ el.style.borderImageSource = `url(${assetUrl})`;
38
+ el.style.borderImageSlice = `${np.top} ${np.right} ${np.bottom} ${np.left} fill`;
39
+ el.style.borderImageWidth = `${np.top}px ${np.right}px ${np.bottom}px ${np.left}px`;
40
+ el.style.borderImageRepeat = 'stretch';
41
+ }
42
+ else {
43
+ el.style.backgroundImage = `url(${assetUrl})`;
44
+ el.style.backgroundSize = '100% 100%';
45
+ }
46
+ }
47
+ function spawnText(entity, r) {
48
+ const el = document.createElement('span');
49
+ el.style.display = 'inline-block';
50
+ el.style.font = `${entity.fontSize ?? 16}px ${entity.fontFamily ?? 'system-ui, sans-serif'}`;
51
+ el.style.color = entity.color ?? '#fff';
52
+ el.style.textAlign = entity.align ?? 'left';
53
+ if (entity.wrapWidth) {
54
+ el.style.width = `${entity.wrapWidth}px`;
55
+ el.style.whiteSpace = 'normal';
56
+ }
57
+ else {
58
+ el.style.whiteSpace = 'pre';
59
+ }
60
+ el.textContent = r.resolveText(entity.source);
61
+ if (entity.source.mode === 'dynamic') {
62
+ trackUnsub(el, subscribeHudBinding3D(entity.source.binding, () => { el.textContent = r.resolveText(entity.source); }));
63
+ }
64
+ return el;
65
+ }
66
+ function spawnImage(entity) {
67
+ const el = document.createElement('img');
68
+ el.src = entity.assetId;
69
+ if (entity.width)
70
+ el.style.width = `${entity.width}px`;
71
+ if (entity.height)
72
+ el.style.height = `${entity.height}px`;
73
+ if (entity.alpha !== undefined)
74
+ el.style.opacity = String(entity.alpha);
75
+ // Tint is an approximation (no true multiply-blend-via-CSS without a
76
+ // second layered element) — acceptable for v1, revisit if a game needs
77
+ // exact-color tinting.
78
+ if (entity.tint)
79
+ el.style.filter = `drop-shadow(0 0 0 ${entity.tint})`;
80
+ el.draggable = false;
81
+ return el;
82
+ }
83
+ function spawnIconButton(entity) {
84
+ const el = document.createElement('button');
85
+ el.type = 'button';
86
+ el.style.pointerEvents = 'auto';
87
+ el.style.cursor = 'pointer';
88
+ el.style.border = entity.strokeColor ? `${entity.strokeWidth ?? 1}px solid ${entity.strokeColor}` : 'none';
89
+ el.style.borderRadius = entity.shape === 'circle' ? '50%' : '8px';
90
+ el.style.background = entity.fillColor ?? 'rgba(0,0,0,0.5)';
91
+ el.style.color = entity.textColor ?? '#fff';
92
+ el.style.font = `${entity.fontSize ?? 14}px ${entity.fontFamily ?? 'system-ui, sans-serif'}`;
93
+ if (entity.width)
94
+ el.style.width = `${entity.width}px`;
95
+ if (entity.height)
96
+ el.style.height = `${entity.height}px`;
97
+ applyNinePatch(el, entity.backgroundAssetId, entity.ninePatch3D);
98
+ if (entity.iconAssetId) {
99
+ const icon = document.createElement('img');
100
+ icon.src = entity.iconAssetId;
101
+ icon.style.pointerEvents = 'none';
102
+ icon.draggable = false;
103
+ el.appendChild(icon);
104
+ }
105
+ if (entity.label) {
106
+ const label = document.createElement('span');
107
+ label.textContent = entity.label;
108
+ label.style.pointerEvents = 'none';
109
+ el.appendChild(label);
110
+ }
111
+ const pressed = entity.pressedFillColor;
112
+ if (pressed) {
113
+ el.addEventListener('pointerdown', () => { el.style.background = pressed; });
114
+ const restore = () => { el.style.background = entity.fillColor ?? 'rgba(0,0,0,0.5)'; };
115
+ el.addEventListener('pointerup', restore);
116
+ el.addEventListener('pointerleave', restore);
117
+ }
118
+ el.addEventListener('click', () => {
119
+ document.dispatchEvent(new CustomEvent('umicat:hud3d:press', { detail: { entityId: entity.id } }));
120
+ });
121
+ return el;
122
+ }
123
+ function spawnProgressBar(entity, r) {
124
+ const el = document.createElement('div');
125
+ el.style.width = `${entity.width ?? 160}px`;
126
+ el.style.height = `${entity.height ?? 16}px`;
127
+ el.style.background = entity.backgroundColor ?? 'rgba(0,0,0,0.4)';
128
+ el.style.borderRadius = `${entity.borderRadius ?? 0}px`;
129
+ if (entity.borderColor)
130
+ el.style.border = `${entity.borderWidth ?? 1}px solid ${entity.borderColor}`;
131
+ el.style.overflow = 'hidden';
132
+ const fill = document.createElement('div');
133
+ fill.style.height = '100%';
134
+ fill.style.background = entity.fillColor ?? '#4ade80';
135
+ const update = () => {
136
+ const value = r.resolveNumber(entity.value);
137
+ const max = r.resolveNumber(entity.max) || 1;
138
+ fill.style.width = `${Math.max(0, Math.min(1, value / max)) * 100}%`;
139
+ };
140
+ update();
141
+ el.appendChild(fill);
142
+ if (entity.value.mode === 'dynamic')
143
+ trackUnsub(el, subscribeHudBinding3D(entity.value.binding, update));
144
+ if (entity.max.mode === 'dynamic')
145
+ trackUnsub(el, subscribeHudBinding3D(entity.max.binding, update));
146
+ return el;
147
+ }
148
+ function spawnPanel(entity) {
149
+ const el = document.createElement('div');
150
+ if (entity.width)
151
+ el.style.width = `${entity.width}px`;
152
+ if (entity.height)
153
+ el.style.height = `${entity.height}px`;
154
+ el.style.background = entity.backgroundColor ?? 'transparent';
155
+ if (entity.backgroundAlpha !== undefined)
156
+ el.style.opacity = String(entity.backgroundAlpha);
157
+ el.style.borderRadius = `${entity.borderRadius ?? 0}px`;
158
+ if (entity.borderColor)
159
+ el.style.border = `${entity.borderWidth ?? 1}px solid ${entity.borderColor}`;
160
+ applyNinePatch(el, entity.backgroundAssetId, entity.ninePatch3D);
161
+ return el;
162
+ }
163
+ function applyBackgroundRows(el, entity) {
164
+ el.style.background = entity.backgroundColor ?? 'transparent';
165
+ if (entity.backgroundAlpha !== undefined)
166
+ el.style.opacity = String(entity.backgroundAlpha);
167
+ el.style.borderRadius = `${entity.borderRadius ?? 0}px`;
168
+ if (entity.borderColor)
169
+ el.style.border = `${entity.borderWidth ?? 1}px solid ${entity.borderColor}`;
170
+ applyNinePatch(el, entity.backgroundAssetId, entity.ninePatch3D);
171
+ }
172
+ function spawnTextInput(entity) {
173
+ const wrap = document.createElement('div');
174
+ wrap.style.width = `${entity.width}px`;
175
+ wrap.style.height = `${entity.height}px`;
176
+ applyBackgroundRows(wrap, entity);
177
+ const input = document.createElement('input');
178
+ input.type = 'text';
179
+ input.placeholder = entity.placeholder ?? '';
180
+ if (entity.maxLength)
181
+ input.maxLength = entity.maxLength;
182
+ input.style.width = '100%';
183
+ input.style.height = '100%';
184
+ input.style.boxSizing = 'border-box';
185
+ input.style.padding = `0 ${entity.padding ?? 10}px`;
186
+ input.style.border = 'none';
187
+ input.style.background = 'transparent';
188
+ input.style.font = `${entity.fontSize ?? 16}px ${entity.fontFamily ?? 'system-ui, sans-serif'}`;
189
+ input.style.color = entity.color ?? '#fff';
190
+ input.style.textAlign = entity.align ?? 'left';
191
+ input.style.pointerEvents = 'auto';
192
+ input.addEventListener('keydown', (e) => {
193
+ e.stopPropagation();
194
+ if (e.key === 'Enter') {
195
+ document.dispatchEvent(new CustomEvent('umicat:hud3d:submit', { detail: { entityId: entity.id, value: input.value } }));
196
+ input.value = '';
197
+ }
198
+ else if (e.key === 'Escape') {
199
+ input.blur();
200
+ document.dispatchEvent(new CustomEvent('umicat:hud3d:cancel', { detail: { entityId: entity.id } }));
201
+ }
202
+ });
203
+ wrap.appendChild(input);
204
+ return wrap;
205
+ }
206
+ function spawnTextArea(entity, r) {
207
+ const wrap = document.createElement('div');
208
+ wrap.style.width = `${entity.width}px`;
209
+ wrap.style.height = `${entity.height}px`;
210
+ wrap.style.overflowY = 'auto';
211
+ wrap.style.boxSizing = 'border-box';
212
+ wrap.style.padding = `${entity.padding ?? 8}px`;
213
+ wrap.style.font = `${entity.fontSize ?? 16}px ${entity.fontFamily ?? 'system-ui, sans-serif'}`;
214
+ wrap.style.color = entity.color ?? '#fff';
215
+ wrap.style.textAlign = entity.align ?? 'left';
216
+ wrap.style.whiteSpace = 'pre-wrap';
217
+ applyBackgroundRows(wrap, entity);
218
+ wrap.textContent = r.resolveText(entity.source);
219
+ if (entity.source.mode === 'dynamic') {
220
+ trackUnsub(wrap, subscribeHudBinding3D(entity.source.binding, () => { wrap.textContent = r.resolveText(entity.source); }));
221
+ }
222
+ return wrap;
223
+ }
224
+ export function spawnHud3DEntity(entity, safeArea, r) {
225
+ let el;
226
+ switch (entity.kind) {
227
+ case 'text':
228
+ el = spawnText(entity, r);
229
+ break;
230
+ case 'image':
231
+ el = spawnImage(entity);
232
+ break;
233
+ case 'icon-button':
234
+ el = spawnIconButton(entity);
235
+ break;
236
+ case 'progress-bar':
237
+ el = spawnProgressBar(entity, r);
238
+ break;
239
+ case 'panel':
240
+ el = spawnPanel(entity);
241
+ break;
242
+ case 'text-input':
243
+ el = spawnTextInput(entity);
244
+ break;
245
+ case 'text-area':
246
+ el = spawnTextArea(entity, r);
247
+ break;
248
+ }
249
+ el.style.pointerEvents = el.style.pointerEvents || 'none';
250
+ applyBase(el, entity, safeArea);
251
+ return el;
252
+ }
253
+ /** In-place patch: removes the old node, spawns a fresh one with the merged
254
+ * entity, and swaps it in — simplest-correct approach for v1 (every field
255
+ * can affect layout/background/content, so a full respawn is never wrong,
256
+ * only a cheap live mutation could be WRONG if it misses a field). Phase 4
257
+ * can optimize hot paths (e.g. plain color/text changes) if respawn churn
258
+ * turns out to matter. */
259
+ export function patchHud3DEntityDom(el, entity, safeArea, r) {
260
+ cleanupHud3DNode(el);
261
+ const fresh = spawnHud3DEntity(entity, safeArea, r);
262
+ if (entity.visible === false)
263
+ fresh.style.display = 'none';
264
+ el.replaceWith(fresh);
265
+ return fresh;
266
+ }
@@ -0,0 +1,228 @@
1
+ /**
2
+ * The 3D HUD design-data format.
3
+ *
4
+ * Deliberately NOT imported from `@umicat/phaser-sdk` — three-sdk has no
5
+ * dependency on phaser-sdk and must not grow one just for this; the shapes
6
+ * below are an independent declaration, field-for-field mirroring 2D's
7
+ * `HudEntity` union (`umicat-phaser-sdk/src/scene/types.ts`) because real
8
+ * shipped 3D games' HUD content (score+label, health bar, ammo readout,
9
+ * wave indicator, icon-chip row, center banner, hint caption, tint overlay,
10
+ * buttons, panel/plate) already maps cleanly onto that exact vocabulary —
11
+ * this is a port of the DATA MODEL and editor UX, not a redesign.
12
+ *
13
+ * What's genuinely different from 2D, and why:
14
+ * - No `design.designAspectRatio` / FIT-scale concept. 3D's canvas has no
15
+ * internal letterboxing (`canvas{width:100%;height:100%}`, no fixed
16
+ * design resolution the way Phaser's `GAME_WIDTH`/`GAME_HEIGHT` imply),
17
+ * so `Anchor3D` resolves straight to CSS — no logical-to-physical
18
+ * conversion step exists to need a ratio for.
19
+ * - Background images (`backgroundAssetId` on icon-button/panel/text-input/
20
+ * text-area) resolve as a direct URL/path, same convention
21
+ * `ModelAsset3D.path` already uses ("resolved by the runtime against the
22
+ * project's asset base url") — not an opaque id into a separate
23
+ * asset-library record carrying its own `ninePatch` metadata the way 2D's
24
+ * does. 9-slice config travels inline on the entity (`ninePatch3D`)
25
+ * instead, since three-sdk has no asset-metadata system to hang it off.
26
+ */
27
+ export type Hud3DEntityKind = 'text' | 'image' | 'icon-button' | 'progress-bar' | 'panel' | 'text-input' | 'text-area';
28
+ export type HudTextSource3D = {
29
+ mode: 'static';
30
+ text: string;
31
+ } | {
32
+ mode: 'dynamic';
33
+ /** Key into the `umicat.hud` registry (see `HudDynamicBinding3D.ts`) —
34
+ * the 3D counterpart of 2D's `scene.registry`/`umicat.gameData` key. */
35
+ binding: string;
36
+ prefix?: string;
37
+ suffix?: string;
38
+ /** Used when the binding is unset at runtime. */
39
+ fallback?: string;
40
+ };
41
+ export type HudNumberSource3D = {
42
+ mode: 'static';
43
+ value: number;
44
+ } | {
45
+ mode: 'dynamic';
46
+ binding: string;
47
+ /** Used when the binding is unset at runtime. Defaults to 0. */
48
+ fallback?: number;
49
+ };
50
+ export type AnchorSide3D = 'top-left' | 'top' | 'top-right' | 'left' | 'center' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
51
+ export interface Anchor3D {
52
+ side: AnchorSide3D;
53
+ offsetX?: number;
54
+ offsetY?: number;
55
+ }
56
+ /** Mirrors 2D's `HudLayer` → z-index mapping (base:100, overlay:200, modal:300). */
57
+ export type HudLayer3D = 'base' | 'overlay' | 'modal';
58
+ /** L/R/T/B 9-slice cut config, applied via CSS `border-image` at spawn time
59
+ * — see this file's own header comment for why this lives inline rather
60
+ * than on a separate asset record the way 2D's `NinePatchConfig` does. */
61
+ export interface NinePatch3D {
62
+ left: number;
63
+ right: number;
64
+ top: number;
65
+ bottom: number;
66
+ }
67
+ export interface Hud3DEntityBase {
68
+ /** Stable, authored, unique within the HUD scene. */
69
+ id: string;
70
+ /** Optional semantic tag. Behavior code keys off this. */
71
+ role?: string;
72
+ /** Free-form per-entity data the agent's behavior code reads. */
73
+ properties?: Record<string, unknown>;
74
+ anchor: Anchor3D;
75
+ layer?: HudLayer3D;
76
+ /** Z-order within the same layer. Higher = on top. Defaults to insertion order. */
77
+ z?: number;
78
+ /** RUNTIME show/hide, honored by the game. */
79
+ visible?: boolean;
80
+ /** EDIT-ONLY authoring state (Figma-style) — never affects the running
81
+ * game. Distinct from `visible` above. */
82
+ editorHidden?: boolean;
83
+ editorLocked?: boolean;
84
+ }
85
+ export interface Hud3DTextEntity extends Hud3DEntityBase {
86
+ kind: 'text';
87
+ source: HudTextSource3D;
88
+ fontFamily?: string;
89
+ fontSize?: number;
90
+ color?: string;
91
+ align?: 'left' | 'center' | 'right';
92
+ /** Word-wrap width in px — when set, grows DOWNWARD from the anchor
93
+ * instead of running off as one line. */
94
+ wrapWidth?: number;
95
+ }
96
+ export interface Hud3DImageEntity extends Hud3DEntityBase {
97
+ kind: 'image';
98
+ /** Direct URL/path — see this file's header comment. */
99
+ assetId: string;
100
+ width?: number;
101
+ height?: number;
102
+ tint?: string;
103
+ alpha?: number;
104
+ }
105
+ /** No built-in onPress wiring — clicks dispatch a DOM CustomEvent
106
+ * `umicat:hud3d:press` with `{detail:{entityId}}` on `document`, and the
107
+ * agent's behavior code subscribes. Mirrors 2D's `hud:press` scene event,
108
+ * just over DOM events since there's no Phaser scene to emit on. */
109
+ export interface Hud3DIconButtonEntity extends Hud3DEntityBase {
110
+ kind: 'icon-button';
111
+ label?: string;
112
+ iconAssetId?: string;
113
+ backgroundAssetId?: string;
114
+ ninePatch3D?: NinePatch3D;
115
+ shape?: 'rounded-rect' | 'circle';
116
+ width?: number;
117
+ height?: number;
118
+ fillColor?: string;
119
+ strokeColor?: string | null;
120
+ strokeWidth?: number;
121
+ pressedFillColor?: string;
122
+ textColor?: string;
123
+ fontFamily?: string;
124
+ fontSize?: number;
125
+ }
126
+ export interface Hud3DProgressBarEntity extends Hud3DEntityBase {
127
+ kind: 'progress-bar';
128
+ value: HudNumberSource3D;
129
+ max: HudNumberSource3D;
130
+ width?: number;
131
+ height?: number;
132
+ fillColor?: string;
133
+ backgroundColor?: string;
134
+ borderColor?: string | null;
135
+ borderWidth?: number;
136
+ borderRadius?: number;
137
+ }
138
+ export interface Hud3DPanelEntity extends Hud3DEntityBase {
139
+ kind: 'panel';
140
+ width?: number;
141
+ height?: number;
142
+ backgroundAssetId?: string;
143
+ ninePatch3D?: NinePatch3D;
144
+ backgroundColor?: string;
145
+ backgroundAlpha?: number;
146
+ borderColor?: string | null;
147
+ borderWidth?: number;
148
+ borderRadius?: number;
149
+ }
150
+ /** A real `<input>`, plain DOM from the start — unlike 2D's version there is
151
+ * no canvas-sync dance to do (see HudRuntime3D.ts), it's just positioned
152
+ * directly via CSS like every other 3D HUD widget. Same event contract as
153
+ * 2D: Enter dispatches `umicat:hud3d:submit` with `{entityId,value}` on
154
+ * `document` and clears; Escape dispatches `umicat:hud3d:cancel` and blurs. */
155
+ export interface Hud3DTextInputEntity extends Hud3DEntityBase {
156
+ kind: 'text-input';
157
+ width: number;
158
+ height: number;
159
+ fontFamily?: string;
160
+ fontSize?: number;
161
+ color?: string;
162
+ align?: 'left' | 'center' | 'right';
163
+ placeholder?: string;
164
+ maxLength?: number;
165
+ /** Defaults to 10. */
166
+ padding?: number;
167
+ backgroundAssetId?: string;
168
+ ninePatch3D?: NinePatch3D;
169
+ backgroundColor?: string;
170
+ backgroundAlpha?: number;
171
+ borderColor?: string | null;
172
+ borderWidth?: number;
173
+ borderRadius?: number;
174
+ }
175
+ /** A fixed-size, scrollable read-only text block — plain `overflow-y:auto`
176
+ * DOM, no canvas-clipping trick needed. */
177
+ export interface Hud3DTextAreaEntity extends Hud3DEntityBase {
178
+ kind: 'text-area';
179
+ width: number;
180
+ height: number;
181
+ source: HudTextSource3D;
182
+ fontFamily?: string;
183
+ fontSize?: number;
184
+ color?: string;
185
+ align?: 'left' | 'center' | 'right';
186
+ /** Defaults to 8. */
187
+ padding?: number;
188
+ backgroundAssetId?: string;
189
+ ninePatch3D?: NinePatch3D;
190
+ backgroundColor?: string;
191
+ backgroundAlpha?: number;
192
+ borderColor?: string | null;
193
+ borderWidth?: number;
194
+ borderRadius?: number;
195
+ }
196
+ export type Hud3DEntity = Hud3DTextEntity | Hud3DImageEntity | Hud3DIconButtonEntity | Hud3DProgressBarEntity | Hud3DPanelEntity | Hud3DTextInputEntity | Hud3DTextAreaEntity;
197
+ export interface Hud3DScene {
198
+ schemaVersion: 1;
199
+ id: string;
200
+ name?: string;
201
+ type: 'hud3d';
202
+ design?: {
203
+ safeArea?: {
204
+ top: number;
205
+ right: number;
206
+ bottom: number;
207
+ left: number;
208
+ };
209
+ };
210
+ entities: Hud3DEntity[];
211
+ }
212
+ /** Manifest registry entry — `Manifest3D.huds3d[]`. Deliberately named
213
+ * `huds3d`, not `huds` — see `scene3d.ts`'s own comment on the field. */
214
+ export interface Hud3DRef {
215
+ id: string;
216
+ name?: string;
217
+ /** Path under `public/scenes3d/`, e.g. `"hud/game-hud.json"`. */
218
+ file: string;
219
+ }
220
+ export declare const DEFAULT_SAFE_AREA_3D: {
221
+ top: number;
222
+ right: number;
223
+ bottom: number;
224
+ left: number;
225
+ };
226
+ /** Validate a HUD scene enough to fail loudly at author time — mirrors
227
+ * `scene3d.ts`'s `validateScene`'s problem-collecting shape. */
228
+ export declare function validateHud3DScene(scene: Hud3DScene): string[];
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The 3D HUD design-data format.
3
+ *
4
+ * Deliberately NOT imported from `@umicat/phaser-sdk` — three-sdk has no
5
+ * dependency on phaser-sdk and must not grow one just for this; the shapes
6
+ * below are an independent declaration, field-for-field mirroring 2D's
7
+ * `HudEntity` union (`umicat-phaser-sdk/src/scene/types.ts`) because real
8
+ * shipped 3D games' HUD content (score+label, health bar, ammo readout,
9
+ * wave indicator, icon-chip row, center banner, hint caption, tint overlay,
10
+ * buttons, panel/plate) already maps cleanly onto that exact vocabulary —
11
+ * this is a port of the DATA MODEL and editor UX, not a redesign.
12
+ *
13
+ * What's genuinely different from 2D, and why:
14
+ * - No `design.designAspectRatio` / FIT-scale concept. 3D's canvas has no
15
+ * internal letterboxing (`canvas{width:100%;height:100%}`, no fixed
16
+ * design resolution the way Phaser's `GAME_WIDTH`/`GAME_HEIGHT` imply),
17
+ * so `Anchor3D` resolves straight to CSS — no logical-to-physical
18
+ * conversion step exists to need a ratio for.
19
+ * - Background images (`backgroundAssetId` on icon-button/panel/text-input/
20
+ * text-area) resolve as a direct URL/path, same convention
21
+ * `ModelAsset3D.path` already uses ("resolved by the runtime against the
22
+ * project's asset base url") — not an opaque id into a separate
23
+ * asset-library record carrying its own `ninePatch` metadata the way 2D's
24
+ * does. 9-slice config travels inline on the entity (`ninePatch3D`)
25
+ * instead, since three-sdk has no asset-metadata system to hang it off.
26
+ */
27
+ export const DEFAULT_SAFE_AREA_3D = { top: 16, right: 16, bottom: 16, left: 16 };
28
+ /** Validate a HUD scene enough to fail loudly at author time — mirrors
29
+ * `scene3d.ts`'s `validateScene`'s problem-collecting shape. */
30
+ export function validateHud3DScene(scene) {
31
+ const problems = [];
32
+ if (scene.schemaVersion !== 1)
33
+ problems.push(`unknown schemaVersion ${scene.schemaVersion}`);
34
+ if (scene.type !== 'hud3d')
35
+ problems.push(`expected type 'hud3d', got '${scene.type}'`);
36
+ const ids = new Set();
37
+ for (const e of scene.entities ?? []) {
38
+ if (!e.id) {
39
+ problems.push('a HUD entity has no id');
40
+ continue;
41
+ }
42
+ if (ids.has(e.id))
43
+ problems.push(`duplicate HUD entity id '${e.id}'`);
44
+ ids.add(e.id);
45
+ if (!e.anchor?.side)
46
+ problems.push(`HUD entity '${e.id}' has no anchor.side`);
47
+ if ((e.kind === 'text-input' || e.kind === 'text-area') && (!e.width || !e.height)) {
48
+ problems.push(`HUD entity '${e.id}' (${e.kind}) requires width and height`);
49
+ }
50
+ }
51
+ return problems;
52
+ }
package/dist/index.d.ts CHANGED
@@ -20,6 +20,11 @@ export { setupScreenshotListener, takeScreenshot } from './capture/ScreenshotMan
20
20
  export { setupRecordingListener } from './capture/RecordingManager.js';
21
21
  export { runEditorDesignPlayer3D } from './editor/EditorDesignPlayer3D.js';
22
22
  export type { EditorDesignPlayer3DOptions } from './editor/EditorDesignPlayer3D.js';
23
+ export * from './hud3d/types.js';
24
+ export { loadHud3DScene } from './hud3d/HudRuntime3D.js';
25
+ export type { Hud3DRuntimeHandle } from './hud3d/HudRuntime3D.js';
26
+ export { resolveAnchor3D } from './hud3d/anchor3d.js';
27
+ export { setHudBinding3D, getHudBinding3D } from './hud3d/HudDynamicBinding3D.js';
23
28
  export type { Attachment } from './Sockets.js';
24
29
  export type { LoadedScene3D, LoadSceneOptions } from './SceneLoader3D.js';
25
30
  export { ORIENTATION_DIMENSIONS } from '@umicat/platform-sdk/orientation.js';
package/dist/index.js CHANGED
@@ -17,6 +17,10 @@ export { GameAudio } from './GameAudio.js';
17
17
  export { setupScreenshotListener, takeScreenshot } from './capture/ScreenshotManager.js';
18
18
  export { setupRecordingListener } from './capture/RecordingManager.js';
19
19
  export { runEditorDesignPlayer3D } from './editor/EditorDesignPlayer3D.js';
20
+ export * from './hud3d/types.js';
21
+ export { loadHud3DScene } from './hud3d/HudRuntime3D.js';
22
+ export { resolveAnchor3D } from './hud3d/anchor3d.js';
23
+ export { setHudBinding3D, getHudBinding3D } from './hud3d/HudDynamicBinding3D.js';
20
24
  // Re-exported so a game imports one package for the common case. A game should
21
25
  // not have to know that identity and saves come from a different package than
22
26
  // the renderer.
package/dist/scene3d.d.ts CHANGED
@@ -213,6 +213,17 @@ export interface Scene3D {
213
213
  offset?: Vec3;
214
214
  fov?: number;
215
215
  };
216
+ /**
217
+ * Id of a `Manifest3D.huds3d[]` entry this scene overlays, or null/absent
218
+ * for no HUD. Lives here on the scene itself rather than in a separate
219
+ * scenes-registry entry (the way 2D's `SceneRefShape.hud` does) because 3D
220
+ * scenes are resolved by FILENAME CONVENTION, never via `manifest.scenes`
221
+ * (confirmed dead/unread scaffold for 3D) — a second manifest-backed array
222
+ * would recreate that exact "which array is real" problem. This field is
223
+ * scene-level config of the same kind `environment`/`gravity`/`lights`
224
+ * already are: what else this scene brings with it when it loads.
225
+ */
226
+ hud?: string | null;
216
227
  }
217
228
  export interface Manifest3D {
218
229
  schemaVersion: 1;
@@ -222,6 +233,14 @@ export interface Manifest3D {
222
233
  file: string;
223
234
  }[];
224
235
  models?: ModelAsset3D[];
236
+ /** Registry of HUD resources — see `hud3d/types.ts`'s `Hud3DRef`. Named
237
+ * `huds3d`, not `huds`, so it reads unambiguously next to the
238
+ * already-dead `scenes` field above. */
239
+ huds3d?: {
240
+ id: string;
241
+ name?: string;
242
+ file: string;
243
+ }[];
225
244
  }
226
245
  /** Identity quaternion, spelled out so callers don't have to remember the order. */
227
246
  export declare const IDENTITY_QUAT: Quat;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umicat/three-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Three.js runtime for Umicat games: the scene3d design format, its loader with physics, a kinematic character controller, and the Umicat platform via @umicat/platform-sdk.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",