web-input-system 0.0.0-stage → 0.4.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.
- package/LICENSE +21 -0
- package/README.md +109 -2
- package/README.zh-CN.md +108 -0
- package/dist/action.d.ts +43 -0
- package/dist/action.d.ts.map +1 -0
- package/dist/actionMap.d.ts +21 -0
- package/dist/actionMap.d.ts.map +1 -0
- package/dist/asset.d.ts +72 -0
- package/dist/asset.d.ts.map +1 -0
- package/dist/composites.d.ts +35 -0
- package/dist/composites.d.ts.map +1 -0
- package/dist/index.cjs +936 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +885 -0
- package/dist/index.js.map +1 -0
- package/dist/interactions.d.ts +49 -0
- package/dist/interactions.d.ts.map +1 -0
- package/dist/manager.d.ts +134 -0
- package/dist/manager.d.ts.map +1 -0
- package/dist/processors.d.ts +29 -0
- package/dist/processors.d.ts.map +1 -0
- package/dist/types.d.ts +44 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +46 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/asset.ts","../src/composites.ts","../src/interactions.ts","../src/processors.ts","../src/action.ts","../src/actionMap.ts","../src/types.ts","../src/manager.ts"],"sourcesContent":["export { defineInputAsset } from './asset';\nexport type {\n ActionDef,\n ActionMapDef,\n AssetActionValues,\n Binding,\n ButtonActionDef,\n InputAsset,\n InputAssetDef,\n ValueActionDef,\n} from './asset';\n\nexport { axis1D, vector2D, isComposite } from './composites';\nexport type { Axis1DBinding, CompositeBinding, Vector2DBinding } from './composites';\n\nexport { press, hold, tap, doubleTap } from './interactions';\nexport type { InteractionDef } from './interactions';\n\nexport { scale, invert, invertX, invertY, deadzone, clamp, normalize } from './processors';\nexport type { Processor } from './processors';\n\nexport { InputAction } from './action';\nexport { InputActionMap } from './actionMap';\n\nexport { InputManager, createInput } from './manager';\nexport type { InputOptions, InputOverrides, RebindCallbacks, RebindOptions } from './manager';\n\nexport {\n MOUSE_DELTA,\n MOUSE_LEFT_BUTTON,\n MOUSE_MIDDLE_BUTTON,\n MOUSE_RIGHT_BUTTON,\n MOUSE_WHEEL_Y,\n isDeltaControl,\n mouseButtonPath,\n} from './types';\nexport type {\n ActionCallback,\n ActionCallbackContext,\n ActionPhase,\n ActionValueType,\n ControlPath,\n ValueOfType,\n Vector2,\n} from './types';\n","/**\n * Input asset definition: the single source of truth for maps, actions, bindings.\n *\n * An asset is plain data (processors hold functions, everything else is\n * JSON-serializable); defineInputAsset only carries types. Map names, action\n * names and per-action value types are all inferred from the object literal,\n * so input.action('movement', 'move') returns a precise type.\n */\n\nimport type { CompositeBinding } from './composites';\nimport type { InteractionDef } from './interactions';\nimport type { Processor } from './processors';\nimport type { ActionValueType, ControlPath, ValueOfType } from './types';\n\n/** A single control path, or a composite combining several controls into one value. */\nexport type Binding = ControlPath | CompositeBinding;\n\nexport interface ButtonActionDef {\n /** button: press/release semantics; started+performed on press, canceled on release. */\n readonly type: 'button';\n readonly bindings?: readonly Binding[];\n /**\n * Trigger conditions (hold / tap / doubleTap). Default (= press()) fires on\n * press. At most one interaction per action.\n */\n readonly interactions?: readonly InteractionDef[];\n}\n\nexport interface ValueActionDef {\n /** value: continuous semantics; poll via readValue(), performed fires on value change. */\n readonly type: 'value';\n readonly value: ActionValueType;\n readonly bindings?: readonly Binding[];\n /** Value transforms, applied in order after evaluation (both polling and callbacks). */\n readonly processors?: readonly Processor[];\n}\n\nexport type ActionDef = ButtonActionDef | ValueActionDef;\n\nexport interface ActionMapDef<Ctx = unknown> {\n /**\n * Activation predicate: false takes the whole map out of dispatch (default: always\n * active). Coexists with the enabled flag: effective = enabled && active(ctx).\n */\n readonly active?: (ctx: Ctx) => boolean;\n readonly actions: Record<string, ActionDef>;\n}\n\nexport interface InputAssetDef<Ctx = unknown> {\n readonly maps: Record<string, ActionMapDef<Ctx>>;\n}\n\n/** Opaque handle returned by defineInputAsset, carrying the def and context types. */\nexport interface InputAsset<Ctx, Def extends InputAssetDef<Ctx>> {\n readonly def: Def;\n}\n\n/** Context type inferred from the `active` predicate parameter annotations. */\ntype CtxOf<Def> = Def extends InputAssetDef<infer C> ? C : unknown;\n\n/**\n * Define an input asset (returns the def as-is; only carries types).\n *\n * Annotate predicate parameters with your context type so Ctx can be inferred:\n * defineInputAsset({ maps: { move: { active: (ctx: MyCtx) => ctx.playing, actions: {...} } } })\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function defineInputAsset<const Def extends InputAssetDef<any>>(\n def: Def,\n): InputAsset<CtxOf<Def>, Def> {\n return { def };\n}\n\n/** JS value type of an action definition. */\nexport type ActionValueOf<D> =\n D extends { readonly type: 'button' } ? boolean\n : D extends { readonly type: 'value'; readonly value: infer V extends ActionValueType } ? ValueOfType<V>\n : never;\n\n/** Asset definition → per-action value types (drives InputManager.action's return type). */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AssetActionValues<Def extends InputAssetDef<any>> = {\n [M in keyof Def['maps']]: {\n [A in keyof Def['maps'][M]['actions']]: ActionValueOf<Def['maps'][M]['actions'][A]>;\n };\n};\n","/**\n * Composite bindings: combine several controls into a single value.\n *\n * - axis1D: negative/positive pair → [-1, 1] (e.g. A/D)\n * - vector2D: four directions → 2D vector (e.g. WASD), normalized by default\n */\n\nimport type { ControlPath } from './types';\n\nexport interface Axis1DBinding {\n readonly kind: 'axis1d';\n readonly negative: ControlPath;\n readonly positive: ControlPath;\n}\n\nexport interface Vector2DBinding {\n readonly kind: 'vector2d';\n readonly up: ControlPath;\n readonly down: ControlPath;\n readonly left: ControlPath;\n readonly right: ControlPath;\n /** Normalize diagonals (default true; false allows length up to √2). */\n readonly normalize: boolean;\n}\n\nexport type CompositeBinding = Axis1DBinding | Vector2DBinding;\n\nexport function axis1D(opts: { negative: ControlPath; positive: ControlPath }): Axis1DBinding {\n return { kind: 'axis1d', ...opts };\n}\n\nexport function vector2D(opts: {\n up: ControlPath;\n down: ControlPath;\n left: ControlPath;\n right: ControlPath;\n normalize?: boolean;\n}): Vector2DBinding {\n return { kind: 'vector2d', normalize: opts.normalize ?? true, ...opts };\n}\n\nexport function isComposite(binding: unknown): binding is CompositeBinding {\n return (\n typeof binding === 'object' &&\n binding !== null &&\n ((binding as CompositeBinding).kind === 'axis1d' || (binding as CompositeBinding).kind === 'vector2d')\n );\n}\n","/**\n * Interactions: decide *when* a button action fires.\n *\n * Definitions are plain data (JSON-serializable); the manager compiles each\n * into a small state machine driven by press/release edges and update(dt).\n *\n * - press(): default behavior — started+performed on press, canceled on release\n * - hold(duration): performed only after being held for `duration` seconds;\n * releasing early cancels without performing\n * - tap(maxDuration): performed on a quick press+release; holding too long\n * cancels without performing\n * - doubleTap(maxInterval, maxDuration): performed after two quick taps within\n * the interval\n *\n * v0.3 supports a single interaction per action; they apply to button\n * actions only (ignored on value actions).\n */\n\nexport type InteractionDef =\n | { readonly kind: 'press' }\n | { readonly kind: 'hold'; readonly duration: number }\n | { readonly kind: 'tap'; readonly maxDuration: number }\n | { readonly kind: 'doubleTap'; readonly maxInterval: number; readonly maxDuration: number };\n\nexport function press(): InteractionDef {\n return { kind: 'press' };\n}\n\nexport function hold(duration: number): InteractionDef {\n return { kind: 'hold', duration };\n}\n\nexport function tap(maxDuration = 0.25): InteractionDef {\n return { kind: 'tap', maxDuration };\n}\n\nexport function doubleTap(maxInterval = 0.3, maxDuration = 0.25): InteractionDef {\n return { kind: 'doubleTap', maxInterval, maxDuration };\n}\n\n/** Phase dispatch hooks wired by the manager. */\nexport interface InteractionHooks {\n started(): void;\n performed(): void;\n canceled(): void;\n}\n\nexport interface InteractionRuntime {\n onPress(): void;\n onRelease(): void;\n tick(dt: number): void;\n reset(): void;\n}\n\n/** Build the state machine for a definition ('press' needs none → null). */\nexport function createInteraction(def: InteractionDef, hooks: InteractionHooks): InteractionRuntime | null {\n switch (def.kind) {\n case 'press':\n return null;\n case 'hold':\n return new HoldInteraction(def.duration, hooks);\n case 'tap':\n return new TapInteraction(def.maxDuration, hooks);\n case 'doubleTap':\n return new DoubleTapInteraction(def.maxInterval, def.maxDuration, hooks);\n }\n}\n\nclass HoldInteraction implements InteractionRuntime {\n private phase: 'idle' | 'holding' | 'done' = 'idle';\n private timer = 0;\n\n constructor(private readonly duration: number, private readonly hooks: InteractionHooks) {}\n\n onPress(): void {\n this.phase = 'holding';\n this.timer = 0;\n this.hooks.started();\n }\n\n onRelease(): void {\n if (this.phase === 'idle') return;\n this.phase = 'idle';\n this.hooks.canceled();\n }\n\n tick(dt: number): void {\n if (this.phase !== 'holding') return;\n this.timer += dt;\n if (this.timer >= this.duration) {\n this.phase = 'done';\n this.hooks.performed();\n }\n }\n\n reset(): void {\n this.phase = 'idle';\n this.timer = 0;\n }\n}\n\nclass TapInteraction implements InteractionRuntime {\n private phase: 'idle' | 'pressing' = 'idle';\n private timer = 0;\n\n constructor(private readonly maxDuration: number, private readonly hooks: InteractionHooks) {}\n\n onPress(): void {\n this.phase = 'pressing';\n this.timer = 0;\n this.hooks.started();\n }\n\n onRelease(): void {\n if (this.phase !== 'pressing') return;\n this.phase = 'idle';\n this.hooks.performed();\n this.hooks.canceled();\n }\n\n tick(dt: number): void {\n if (this.phase !== 'pressing') return;\n this.timer += dt;\n if (this.timer > this.maxDuration) {\n this.phase = 'idle';\n this.hooks.canceled();\n }\n }\n\n reset(): void {\n this.phase = 'idle';\n this.timer = 0;\n }\n}\n\nclass DoubleTapInteraction implements InteractionRuntime {\n private phase: 'idle' | 'press1' | 'wait2' | 'press2' = 'idle';\n private timer = 0;\n\n constructor(\n private readonly maxInterval: number,\n private readonly maxDuration: number,\n private readonly hooks: InteractionHooks,\n ) {}\n\n onPress(): void {\n if (this.phase === 'idle') {\n this.phase = 'press1';\n this.timer = 0;\n this.hooks.started();\n } else if (this.phase === 'wait2') {\n this.phase = 'press2';\n this.timer = 0;\n }\n }\n\n onRelease(): void {\n if (this.phase === 'press1') {\n if (this.timer <= this.maxDuration) {\n this.phase = 'wait2';\n this.timer = 0;\n } else {\n this.cancel();\n }\n } else if (this.phase === 'press2') {\n if (this.timer <= this.maxDuration) {\n this.phase = 'idle';\n this.hooks.performed();\n this.hooks.canceled();\n } else {\n this.cancel();\n }\n }\n }\n\n tick(dt: number): void {\n if (this.phase === 'idle') return;\n this.timer += dt;\n const expired =\n (this.phase === 'press1' && this.timer > this.maxDuration) ||\n (this.phase === 'wait2' && this.timer > this.maxInterval) ||\n (this.phase === 'press2' && this.timer > this.maxDuration);\n if (expired) this.cancel();\n }\n\n reset(): void {\n this.phase = 'idle';\n this.timer = 0;\n }\n\n private cancel(): void {\n this.phase = 'idle';\n this.hooks.canceled();\n }\n}\n","/**\n * Processors: transform an action's evaluated value, applied in order.\n *\n * Each processor declares which value types it handles (`number` for axis,\n * `vector2` for vector2 actions); others pass through untouched. Processors\n * are function objects — unlike the rest of the asset they are not\n * JSON-serializable.\n */\n\nimport type { Vector2 } from './types';\n\nexport interface Processor {\n readonly number?: (v: number) => number;\n readonly vector2?: (v: Vector2) => Vector2;\n}\n\n/** Multiply by a constant (mouse sensitivity, axis scaling, ...). */\nexport function scale(factor: number): Processor {\n return {\n number: (v) => v * factor,\n vector2: (v) => ({ x: v.x * factor, y: v.y * factor }),\n };\n}\n\n/** Flip the sign (axis: negate; vector2: negate both axes). */\nexport function invert(): Processor {\n return {\n number: (v) => -v,\n vector2: (v) => ({ x: -v.x, y: -v.y }),\n };\n}\n\nexport function invertX(): Processor {\n return { vector2: (v) => ({ x: -v.x, y: v.y }) };\n}\n\nexport function invertY(): Processor {\n return { vector2: (v) => ({ x: v.x, y: -v.y }) };\n}\n\n/**\n * Axis deadzone: |v| < min → 0, |v| ≥ max → ±1, rescaled linearly in between\n * (sign preserved). Defaults match common gamepad conventions.\n */\nexport function deadzone(min = 0.125, max = 0.925): Processor {\n return {\n number: (v) => {\n const a = Math.abs(v);\n if (a < min) return 0;\n if (a >= max) return Math.sign(v);\n return Math.sign(v) * ((a - min) / (max - min));\n },\n };\n}\n\n/** Clamp an axis value into [min, max]. */\nexport function clamp(min: number, max: number): Processor {\n return { number: (v) => Math.min(max, Math.max(min, v)) };\n}\n\n/** Scale a vector2 to unit length (zero vector passes through). */\nexport function normalize(): Processor {\n return {\n vector2: (v) => {\n const len = Math.hypot(v.x, v.y);\n return len > 0 ? { x: v.x / len, y: v.y / len } : v;\n },\n };\n}\n","/**\n * InputAction: a single action, created by InputManager from the asset.\n *\n * Two ways to consume:\n * - subscribe: performed / started / canceled (each returns an unsubscribe fn)\n * - poll: readValue() (current value), isPressed() (currently actuated)\n *\n * Lifecycle for discrete controls:\n * press → started → performed (re-fires on value change) → release → canceled\n * Delta controls (mouse motion, wheel) only dispatch performed.\n */\n\nimport type { ActionCallback, ActionCallbackContext, ActionPhase } from './types';\n\n/** Runtime hooks injected by InputManager (avoids a reverse type dependency). */\nexport interface ActionRuntime<T> {\n readValue: () => T;\n isPressed: () => boolean;\n}\n\nexport class InputAction<T = boolean> {\n /** Action name in 'map.action' form, for logging and debugging. */\n public readonly name: string;\n /** Current phase ('waiting' = never triggered or fully reset). */\n public get phase(): ActionPhase {\n return this._phase;\n }\n\n private _phase: ActionPhase = 'waiting';\n private readonly runtime: ActionRuntime<T>;\n private readonly listeners: Record<'started' | 'performed' | 'canceled', Set<ActionCallback<T>>> = {\n started: new Set(),\n performed: new Set(),\n canceled: new Set(),\n };\n\n constructor(name: string, runtime: ActionRuntime<T>) {\n this.name = name;\n this.runtime = runtime;\n }\n\n /** Subscribe to performed (value produced/changed). Returns an unsubscribe fn. */\n public performed(cb: ActionCallback<T>): () => void {\n return this.subscribe('performed', cb);\n }\n\n /** Subscribe to started (first frame leaving the default value). Returns an unsubscribe fn. */\n public started(cb: ActionCallback<T>): () => void {\n return this.subscribe('started', cb);\n }\n\n /** Subscribe to canceled (release / back to default / map deactivated). Returns an unsubscribe fn. */\n public canceled(cb: ActionCallback<T>): () => void {\n return this.subscribe('canceled', cb);\n }\n\n private subscribe(phase: 'started' | 'performed' | 'canceled', cb: ActionCallback<T>): () => void {\n const set = this.listeners[phase];\n set.add(cb);\n return () => set.delete(cb);\n }\n\n /** Poll the current value (type default — false / 0 / {0,0} — while the map is inactive). */\n public readValue(): T {\n return this.runtime.readValue();\n }\n\n /** Whether the action is currently actuated (button: held; value: non-default). */\n public isPressed(): boolean {\n return this.runtime.isPressed();\n }\n\n /** [internal] Called by the manager during dispatch. */\n public _emit(phase: 'started' | 'performed' | 'canceled', value: T): void {\n this._phase = phase;\n const ctx: ActionCallbackContext<T> = {\n action: this.name,\n value,\n phase,\n time: typeof performance !== 'undefined' ? performance.now() : 0,\n };\n for (const cb of this.listeners[phase]) cb(ctx);\n }\n\n /** [internal] Reset phase without dispatching (used by dispose). */\n public _reset(): void {\n this._phase = 'waiting';\n }\n}\n","/**\n * InputActionMap: a named group of actions with a shared activation condition.\n *\n * A map is effectively active when: enabled && (active?.(ctx) ?? true).\n * - enable()/disable(): explicit runtime switch\n * - the asset's `active` predicate: declarative context gating\n *\n * When a map deactivates, its actuated actions receive `canceled` (no stuck\n * state); when it reactivates, still-held controls re-fire started+performed.\n */\n\nexport class InputActionMap {\n public readonly name: string;\n\n /** [internal] Notifies the manager to re-evaluate dispatch on toggle. */\n private readonly onToggle: () => void;\n private _enabled = true;\n\n constructor(name: string, onToggle: () => void) {\n this.name = name;\n this.onToggle = onToggle;\n }\n\n public get enabled(): boolean {\n return this._enabled;\n }\n\n public enable(): void {\n if (this._enabled) return;\n this._enabled = true;\n this.onToggle();\n }\n\n public disable(): void {\n if (!this._enabled) return;\n this._enabled = false;\n this.onToggle();\n }\n}\n","/**\n * Shared types: value types, action phases, callback context, control paths.\n *\n * A ControlPath is a plain string with a few built-in aliases:\n * - keyboard: KeyboardEvent.code ('KeyW', 'Space', 'Digit1', 'Numpad1', ...)\n * - mouse buttons: '<Mouse>/leftButton' | '<Mouse>/middleButton' | '<Mouse>/rightButton'\n * - mouse motion: '<Mouse>/delta' (per-frame movement, vector2)\n * - wheel: '<Mouse>/wheelY' (per-frame scroll amount, axis)\n * There is no full '<Device>/<control>' path parser; the aliases above are the whole set.\n */\n\nexport interface Vector2 {\n x: number;\n y: number;\n}\n\n/** Action value type: button=boolean, axis=1D float, vector2=2D vector. */\nexport type ActionValueType = 'button' | 'axis' | 'vector2';\n\n/** JS value type for a given ActionValueType. */\nexport type ValueOfType<T extends ActionValueType> =\n T extends 'button' ? boolean : T extends 'axis' ? number : Vector2;\n\nexport type ActionPhase = 'waiting' | 'started' | 'performed' | 'canceled';\n\nexport interface ActionCallbackContext<T = unknown> {\n /** Action name ('map.action'). */\n readonly action: string;\n /** Current value for discrete controls; per-event delta for delta controls. */\n readonly value: T;\n readonly phase: ActionPhase;\n /** performance.now() timestamp. */\n readonly time: number;\n}\n\nexport type ActionCallback<T = unknown> = (ctx: ActionCallbackContext<T>) => void;\n\n/** Keyboard code or one of the built-in mouse aliases. */\nexport type ControlPath = string;\n\nexport const MOUSE_LEFT_BUTTON = '<Mouse>/leftButton';\nexport const MOUSE_MIDDLE_BUTTON = '<Mouse>/middleButton';\nexport const MOUSE_RIGHT_BUTTON = '<Mouse>/rightButton';\nexport const MOUSE_DELTA = '<Mouse>/delta';\nexport const MOUSE_WHEEL_Y = '<Mouse>/wheelY';\n\n/** MouseEvent.button number → control path. */\nexport function mouseButtonPath(button: number): ControlPath {\n switch (button) {\n case 0: return MOUSE_LEFT_BUTTON;\n case 1: return MOUSE_MIDDLE_BUTTON;\n case 2: return MOUSE_RIGHT_BUTTON;\n default: return `<Mouse>/button${button}`;\n }\n}\n\n/**\n * Delta controls dispatch `performed` per event with the event delta; polled\n * values accumulate per frame and reset on update(). No started/canceled.\n */\nexport function isDeltaControl(path: ControlPath): boolean {\n return path === MOUSE_DELTA || path === MOUSE_WHEEL_Y;\n}\n","/**\n * InputManager: the core runtime.\n *\n * Owns DOM listener lifecycle, the control state table (key/button pressed\n * state + per-frame delta accumulators), action value evaluation, three-phase\n * dispatch (started/performed/canceled) and map activation\n * (enabled && predicate).\n *\n * Browser robustness is built in:\n * - window blur / tab hidden clears all controls and fires canceled\n * (otherwise keyup is lost and held movement \"sticks\")\n * - OS key auto-repeat (e.repeat) is filtered\n * - typing in input/textarea/contentEditable never triggers actions\n * - preventDefault applies only to bound key codes and active wheel actions\n *\n * Frame-loop contract: call update(dt) at the end of every frame to reset\n * delta accumulators. If never called, polled delta values keep accumulating.\n */\n\nimport { InputAction } from './action';\nimport { InputActionMap } from './actionMap';\nimport type {\n AssetActionValues,\n InputAsset,\n InputAssetDef,\n ActionMapDef,\n Binding,\n} from './asset';\nimport type { Vector2DBinding } from './composites';\nimport { isComposite } from './composites';\nimport { createInteraction, type InteractionRuntime } from './interactions';\nimport type { Processor } from './processors';\nimport {\n isDeltaControl,\n mouseButtonPath,\n MOUSE_DELTA,\n MOUSE_WHEEL_Y,\n type ActionValueType,\n type ControlPath,\n type Vector2,\n} from './types';\n\nexport interface InputOptions<Ctx = unknown> {\n /** Listener target (defaults to window; injectable for SSR/tests). */\n target?: Window;\n /**\n * Live context sampler, consulted before every dispatch/evaluation to\n * resolve predicate-gated maps. Takes precedence over setContext.\n */\n context?: () => Ctx;\n /** Gate mouse motion/wheel/buttons behind pointer lock (default false). */\n gateMouseByPointerLock?: boolean;\n /** preventDefault for bound key codes and active wheel actions (default true). */\n preventDefault?: boolean;\n}\n\n/** Control state: pressed = held state; x/y = delta accumulators. */\ninterface ControlState {\n pressed: boolean;\n x: number;\n y: number;\n}\n\ninterface RuntimeAction {\n action: InputAction<unknown>;\n mapName: string;\n /** Asset-defined bindings (restore target for resets). */\n defaultBindings: readonly Binding[];\n /** Effective bindings (overrides applied); evaluation and indexing use these. */\n bindings: readonly Binding[];\n valueType: ActionValueType;\n processors: readonly Processor[];\n /** Interaction state machine (button actions with interactions; else null). */\n interaction: InteractionRuntime | null;\n /** Physical pressed state at the last sync (interaction edge detection). */\n held: boolean;\n /** Whether started/performed was dispatched and canceled is still pending. */\n dispatched: boolean;\n lastValue: unknown;\n}\n\n/** Rebind capture session: the next discrete control press becomes the new binding. */\ninterface CaptureSession {\n mapName: string;\n actionName: string;\n cancelOn: readonly ControlPath[];\n onComplete: (path: ControlPath) => void;\n onCancel?: () => void;\n}\n\n/** Serializable override table: 'map.action' → replacement bindings. */\nexport type InputOverrides = Record<string, readonly Binding[]>;\n\nexport interface RebindOptions {\n /** Controls that cancel the capture instead of becoming the binding (default: Escape). */\n cancelOn?: readonly ControlPath[];\n}\n\nexport interface RebindCallbacks {\n onComplete: (path: ControlPath) => void;\n onCancel?: () => void;\n}\n\ninterface RuntimeMap {\n map: InputActionMap;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n def: ActionMapDef<any>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class InputManager<Ctx = unknown, Def extends InputAssetDef<any> = InputAssetDef<any>> {\n /** Auto-tracked from pointerlockchange; hosts may also override manually. */\n public isPointerLocked = false;\n\n private readonly maps = new Map<string, RuntimeMap>();\n private readonly actions = new Map<string, RuntimeAction>();\n /** control path → actions bound to it (dispatch entry point). */\n private readonly controlIndex = new Map<ControlPath, RuntimeAction[]>();\n /** All bound keyboard codes, computed once (preventDefault lookup). */\n private readonly boundKeyCodes = new Set<string>();\n private readonly controls = new Map<ControlPath, ControlState>();\n\n private readonly contextGetter?: () => Ctx;\n private contextValue!: Ctx;\n private readonly gateMouse: boolean;\n private readonly doPreventDefault: boolean;\n private readonly disposers: Array<() => void> = [];\n /** Active rebind capture session (at most one at a time). */\n private capture: CaptureSession | null = null;\n /** 'map/action' → replacement bindings (the serializable overrides table). */\n private readonly overrides = new Map<string, readonly Binding[]>();\n\n constructor(asset: InputAsset<Ctx, Def>, options: InputOptions<Ctx> = {}) {\n this.contextGetter = options.context;\n this.gateMouse = options.gateMouseByPointerLock ?? false;\n this.doPreventDefault = options.preventDefault ?? true;\n\n for (const [mapName, mapDef] of Object.entries(asset.def.maps)) {\n const runtimeMap: RuntimeMap = {\n map: new InputActionMap(mapName, () => this.syncAll()),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n def: mapDef as ActionMapDef<any>,\n };\n this.maps.set(mapName, runtimeMap);\n\n for (const [actionName, actionDef] of Object.entries(mapDef.actions)) {\n const valueType: ActionValueType = actionDef.type === 'button' ? 'button' : actionDef.value;\n const ra: RuntimeAction = {\n action: null as unknown as InputAction<unknown>,\n mapName,\n defaultBindings: actionDef.bindings ?? [],\n bindings: actionDef.bindings ?? [],\n valueType,\n processors: actionDef.type === 'value' ? (actionDef.processors ?? []) : [],\n interaction: null,\n held: false,\n dispatched: false,\n lastValue: defaultValue(valueType),\n };\n ra.action = new InputAction(`${mapName}.${actionName}`, {\n readValue: () => this.readActionValue(ra),\n isPressed: () => this.isActionPressed(ra),\n });\n\n const interactions = actionDef.type === 'button' ? actionDef.interactions : undefined;\n if (interactions && interactions.length > 0) {\n if (interactions.length > 1) {\n throw new Error(\n `InputManager: '${mapName}/${actionName}' declares ${interactions.length} interactions; only one per action is supported`,\n );\n }\n ra.interaction = createInteraction(interactions[0], {\n started: () => {\n ra.dispatched = true;\n ra.action._emit('started', true);\n },\n performed: () => {\n ra.action._emit('performed', true);\n },\n canceled: () => {\n ra.dispatched = false;\n ra.action._emit('canceled', false);\n },\n });\n }\n\n this.actions.set(`${mapName}/${actionName}`, ra);\n }\n }\n this.rebuildIndexes();\n\n const target = options.target ?? (typeof window !== 'undefined' ? window : undefined);\n if (target) this.attach(target);\n }\n\n // ==================== Lookup ====================\n\n /** Get an action; map/action names and the value type are inferred from the asset. */\n public action<M extends keyof Def['maps'] & string, A extends keyof Def['maps'][M]['actions'] & string>(\n mapName: M,\n actionName: A,\n ): InputAction<AssetActionValues<Def>[M][A]> {\n const ra = this.actions.get(`${mapName}/${actionName}`);\n if (!ra) throw new Error(`InputManager: unknown action '${mapName}/${actionName}'`);\n return ra.action as InputAction<AssetActionValues<Def>[M][A]>;\n }\n\n /** Get an action map (enable/disable). */\n public map(name: keyof Def['maps'] & string): InputActionMap {\n const rm = this.maps.get(name);\n if (!rm) throw new Error(`InputManager: unknown action map '${name}'`);\n return rm.map;\n }\n\n /** Raw control held-state polling, bypassing map gating (hold-to-row etc.). */\n public isControlDown(path: ControlPath): boolean {\n return this.control(path).pressed;\n }\n\n /** Push-style context (alternative to the `context` sampler, which wins if both exist). */\n public setContext(ctx: Ctx): void {\n this.contextValue = ctx;\n this.syncAll();\n }\n\n /** Call at the end of every frame: advances interaction timers, then resets delta accumulators. */\n public update(dt: number): void {\n for (const ra of this.actions.values()) ra.interaction?.tick(dt);\n const delta = this.controls.get(MOUSE_DELTA);\n if (delta) { delta.x = 0; delta.y = 0; }\n const wheel = this.controls.get(MOUSE_WHEEL_Y);\n if (wheel) { wheel.x = 0; wheel.y = 0; }\n }\n\n // ==================== Rebinding ====================\n\n /** Effective bindings of an action (overrides applied). */\n public getBindings<M extends keyof Def['maps'] & string, A extends keyof Def['maps'][M]['actions'] & string>(\n mapName: M,\n actionName: A,\n ): readonly Binding[] {\n return this.requireAction(mapName, actionName).bindings;\n }\n\n /**\n * Replace an action's bindings at runtime (recorded in the overrides table).\n * For composite bindings, read current bindings with getBindings, swap the\n * control path of one part, and pass the updated array back.\n */\n public setBindings<M extends keyof Def['maps'] & string, A extends keyof Def['maps'][M]['actions'] & string>(\n mapName: M,\n actionName: A,\n bindings: readonly Binding[],\n ): void {\n this.setBindingsInternal(`${mapName}/${actionName}`, bindings);\n }\n\n /** Restore asset defaults: one action, or everything when called without arguments. */\n public resetBindings(mapName?: string, actionName?: string): void {\n if (mapName !== undefined && actionName !== undefined) {\n const ra = this.actions.get(`${mapName}/${actionName}`);\n if (ra) ra.bindings = ra.defaultBindings;\n this.overrides.delete(`${mapName}/${actionName}`);\n } else {\n for (const [key, ra] of this.actions) ra.bindings = ra.defaultBindings;\n this.overrides.clear();\n }\n this.rebuildIndexes();\n this.syncAll();\n }\n\n /** Export the overrides table (JSON-serializable; persistence is the host's job). */\n public exportOverrides(): InputOverrides {\n const out: InputOverrides = {};\n for (const [key, bindings] of this.overrides) out[key] = bindings;\n return out;\n }\n\n /**\n * Apply a previously exported overrides table. Unknown action paths are\n * skipped (overrides may come from an older version of the asset).\n */\n public applyOverrides(overrides: InputOverrides): void {\n for (const [key, bindings] of Object.entries(overrides)) {\n const ra = this.actions.get(key);\n if (!ra) continue;\n ra.bindings = bindings;\n this.overrides.set(key, bindings);\n }\n this.rebuildIndexes();\n this.syncAll();\n }\n\n /** Conflict detection: which actions currently bind this control. */\n public findActionsByControl(path: ControlPath): Array<{ map: string; action: string }> {\n const out: Array<{ map: string; action: string }> = [];\n for (const ra of this.controlIndex.get(path) ?? []) {\n out.push({ map: ra.mapName, action: ra.action.name.split('.').pop()! });\n }\n return out;\n }\n\n /**\n * Capture the next discrete input (keyboard key or mouse button) and make it\n * the action's only binding. Normal dispatch is suppressed while capturing;\n * blur cancels the session. Returns a function to cancel manually.\n */\n public startRebind<M extends keyof Def['maps'] & string, A extends keyof Def['maps'][M]['actions'] & string>(\n mapName: M,\n actionName: A,\n callbacks: RebindCallbacks,\n options: RebindOptions = {},\n ): () => void {\n this.requireAction(mapName, actionName);\n this.capture?.onCancel?.(); // a new session supersedes the previous one\n const session: CaptureSession = {\n mapName,\n actionName,\n cancelOn: options.cancelOn ?? ['Escape'],\n onComplete: callbacks.onComplete,\n onCancel: callbacks.onCancel,\n };\n this.capture = session;\n return () => {\n if (this.capture === session) {\n this.capture = null;\n session.onCancel?.();\n }\n };\n }\n\n /** True while a rebind capture is waiting for input. */\n public get isRebinding(): boolean {\n return this.capture !== null;\n }\n\n private requireAction(mapName: string, actionName: string): RuntimeAction {\n const ra = this.actions.get(`${mapName}/${actionName}`);\n if (!ra) throw new Error(`InputManager: unknown action '${mapName}/${actionName}'`);\n return ra;\n }\n\n private setBindingsInternal(key: string, bindings: readonly Binding[]): void {\n const ra = this.actions.get(key);\n if (!ra) throw new Error(`InputManager: unknown action '${key}'`);\n ra.bindings = bindings;\n this.overrides.set(key, bindings);\n this.rebuildIndexes();\n this.syncAll();\n }\n\n /** Rebuild control→action index and bound-key set from effective bindings. */\n private rebuildIndexes(): void {\n this.controlIndex.clear();\n this.boundKeyCodes.clear();\n for (const ra of this.actions.values()) {\n for (const path of flattenControlPaths(ra.bindings)) {\n const list = this.controlIndex.get(path);\n if (list) list.push(ra);\n else this.controlIndex.set(path, [ra]);\n if (!path.startsWith('<')) this.boundKeyCodes.add(path);\n }\n }\n }\n\n /** Feed a control press into the capture session. Returns true when consumed. */\n private handleCapture(path: ControlPath): boolean {\n const session = this.capture;\n if (!session) return false;\n this.capture = null;\n if (session.cancelOn.includes(path)) {\n session.onCancel?.();\n return true;\n }\n this.setBindingsInternal(`${session.mapName}/${session.actionName}`, [path]);\n session.onComplete(path);\n return true;\n }\n\n // ==================== Evaluation ====================\n\n private getCtx(): Ctx {\n return this.contextGetter ? this.contextGetter() : this.contextValue;\n }\n\n private isMapActive(mapName: string): boolean {\n const rm = this.maps.get(mapName);\n if (!rm || !rm.map.enabled) return false;\n const predicate = rm.def.active as ((ctx: Ctx) => boolean) | undefined;\n return predicate ? predicate(this.getCtx()) : true;\n }\n\n private control(path: ControlPath): ControlState {\n let st = this.controls.get(path);\n if (!st) {\n st = { pressed: false, x: 0, y: 0 };\n this.controls.set(path, st);\n }\n return st;\n }\n\n /** override: delta dispatch substitutes the event delta for the frame accumulator (prevents double-counting). */\n private evaluate(ra: RuntimeAction, override?: { path: ControlPath; x: number; y: number }): unknown {\n let raw: unknown;\n switch (ra.valueType) {\n case 'button':\n raw = ra.bindings.some((b) => this.bindingPressed(b));\n break;\n case 'axis':\n raw = ra.bindings.reduce((sum, b) => sum + this.bindingAxis(b, override), 0);\n break;\n case 'vector2': {\n let x = 0;\n let y = 0;\n for (const b of ra.bindings) {\n const v = this.bindingVector(b, override);\n x += v.x;\n y += v.y;\n }\n raw = { x, y };\n break;\n }\n }\n return applyProcessors(ra.processors, ra.valueType, raw);\n }\n\n private bindingPressed(b: Binding): boolean {\n if (isComposite(b)) {\n return b.kind === 'axis1d'\n ? this.control(b.negative).pressed || this.control(b.positive).pressed\n : this.control(b.up).pressed || this.control(b.down).pressed ||\n this.control(b.left).pressed || this.control(b.right).pressed;\n }\n const st = this.control(b);\n return isDeltaControl(b) ? st.x !== 0 || st.y !== 0 : st.pressed;\n }\n\n private bindingAxis(b: Binding, override?: { path: ControlPath; x: number; y: number }): number {\n if (isComposite(b)) {\n if (b.kind !== 'axis1d') return 0;\n return (this.control(b.positive).pressed ? 1 : 0) - (this.control(b.negative).pressed ? 1 : 0);\n }\n if (b === MOUSE_WHEEL_Y) return override && override.path === b ? override.y : this.control(b).y;\n if (b === MOUSE_DELTA) return override && override.path === b ? override.x : this.control(b).x;\n return this.control(b).pressed ? 1 : 0;\n }\n\n private bindingVector(b: Binding, override?: { path: ControlPath; x: number; y: number }): Vector2 {\n if (isComposite(b)) {\n if (b.kind !== 'vector2d') return { x: 0, y: 0 };\n return compositeVector(b, (p) => this.control(p).pressed);\n }\n if (b === MOUSE_DELTA) {\n if (override && override.path === b) return { x: override.x, y: override.y };\n const st = this.control(b);\n return { x: st.x, y: st.y };\n }\n if (b === MOUSE_WHEEL_Y) {\n const y = override && override.path === b ? override.y : this.control(b).y;\n return { x: 0, y };\n }\n return { x: 0, y: this.control(b).pressed ? 1 : 0 };\n }\n\n private readActionValue(ra: RuntimeAction): unknown {\n if (!this.isMapActive(ra.mapName)) return defaultValue(ra.valueType);\n return this.evaluate(ra);\n }\n\n private isActionPressed(ra: RuntimeAction): boolean {\n if (!this.isMapActive(ra.mapName)) return false;\n const v = this.evaluate(ra);\n return ra.valueType === 'button' ? (v as boolean) : !isDefaultValue(ra.valueType, v);\n }\n\n // ==================== Dispatch ====================\n\n /** Discrete controls (keyboard / mouse buttons): three-phase state machine. */\n private syncAction(ra: RuntimeAction): void {\n if (!this.isMapActive(ra.mapName)) {\n // Map went inactive: cancel actuated actions so no release is ever lost.\n if (ra.interaction) {\n ra.held = false; // physical state is stale across the gap; treat as released\n ra.interaction.reset();\n }\n if (ra.dispatched) {\n ra.dispatched = false;\n ra.action._emit('canceled', defaultValue(ra.valueType));\n }\n return;\n }\n const value = this.evaluate(ra);\n if (ra.valueType === 'button') {\n if (ra.interaction) {\n // Interaction state machines consume press/release edges and dispatch\n // through their hooks instead of firing directly.\n const pressed = value as boolean;\n if (pressed !== ra.held) {\n ra.held = pressed;\n if (pressed) ra.interaction.onPress();\n else ra.interaction.onRelease();\n }\n return;\n }\n if (value && !ra.dispatched) {\n ra.dispatched = true;\n ra.action._emit('started', value);\n ra.action._emit('performed', value);\n } else if (!value && ra.dispatched) {\n ra.dispatched = false;\n ra.action._emit('canceled', value);\n }\n return;\n }\n if (isDefaultValue(ra.valueType, value)) {\n if (ra.dispatched) {\n ra.dispatched = false;\n ra.action._emit('canceled', value);\n }\n } else {\n if (!ra.dispatched) {\n ra.dispatched = true;\n ra.action._emit('started', value);\n ra.action._emit('performed', value);\n } else if (!valueEquals(ra.lastValue, value)) {\n ra.action._emit('performed', value);\n }\n }\n ra.lastValue = value;\n }\n\n private syncControls(paths: ControlPath[]): void {\n const seen = new Set<RuntimeAction>();\n for (const path of paths) {\n for (const ra of this.controlIndex.get(path) ?? []) {\n if (seen.has(ra)) continue;\n seen.add(ra);\n this.syncAction(ra);\n }\n }\n }\n\n private syncAll(): void {\n for (const ra of this.actions.values()) this.syncAction(ra);\n }\n\n /** Delta controls (mouse motion / wheel): performed per event, no started/canceled lifecycle. */\n private dispatchDelta(path: ControlPath, x: number, y: number): void {\n const st = this.control(path);\n st.x += x;\n st.y += y;\n for (const ra of this.controlIndex.get(path) ?? []) {\n if (!this.isMapActive(ra.mapName)) continue;\n const value = this.evaluate(ra, { path, x, y });\n if (!isDefaultValue(ra.valueType, value)) {\n ra.action._emit('performed', value);\n ra.lastValue = value;\n }\n }\n }\n\n private mouseGateOpen(): boolean {\n return !this.gateMouse || this.isPointerLocked;\n }\n\n // ==================== DOM wiring ====================\n\n private attach(target: Window): void {\n const doc = target.document;\n\n const onKeyDown = (e: KeyboardEvent) => {\n // Never steal keystrokes from form fields (modals, chat boxes, ...).\n const el = e.target as HTMLElement | null;\n if (el && (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.isContentEditable)) return;\n // Ignore OS auto-repeat: \"pressed once\" actions must not re-fire while held.\n if (e.repeat) return;\n // Rebind capture consumes the press before any normal dispatch.\n if (this.handleCapture(e.code)) return;\n this.control(e.code).pressed = true;\n // Swallow browser defaults only for bound keys (Tab focus, Space scroll).\n if (this.doPreventDefault && this.boundKeyCodes.has(e.code)) e.preventDefault();\n this.syncControls([e.code]);\n };\n const onKeyUp = (e: KeyboardEvent) => {\n this.control(e.code).pressed = false;\n this.syncControls([e.code]);\n };\n const onMouseMove = (e: MouseEvent) => {\n if (!this.mouseGateOpen()) return;\n this.dispatchDelta(MOUSE_DELTA, e.movementX, e.movementY);\n };\n const onWheel = (e: WheelEvent) => {\n if (!this.mouseGateOpen()) return;\n this.dispatchDelta(MOUSE_WHEEL_Y, 0, e.deltaY);\n // Block page scroll only while a wheel action is actually active.\n if (this.doPreventDefault && (this.controlIndex.get(MOUSE_WHEEL_Y) ?? []).some((ra) => this.isMapActive(ra.mapName))) {\n e.preventDefault();\n }\n };\n const onMouseDown = (e: MouseEvent) => {\n // Held state is tracked even outside the gate: the release may arrive\n // after unlock, and the state must be able to reset.\n const path = mouseButtonPath(e.button);\n this.control(path).pressed = true;\n // Rebind capture works regardless of the pointer-lock gate (rebind UIs\n // usually run unlocked) and consumes the press before normal dispatch.\n if (this.handleCapture(path)) return;\n if (this.mouseGateOpen()) this.syncControls([path]);\n };\n const onMouseUp = (e: MouseEvent) => {\n const path = mouseButtonPath(e.button);\n this.control(path).pressed = false;\n if (this.mouseGateOpen()) this.syncControls([path]);\n };\n\n // On blur / tab switch the keyup events are lost; without this, held keys\n // stick. Clearing the table and re-syncing fires canceled for everything actuated.\n const clearAll = () => {\n for (const st of this.controls.values()) {\n st.pressed = false;\n }\n // A pending rebind capture cannot complete while unfocused; cancel it.\n if (this.capture) {\n const session = this.capture;\n this.capture = null;\n session.onCancel?.();\n }\n this.syncAll();\n };\n const onBlur = () => clearAll();\n const onVisibilityChange = () => {\n if (doc.hidden) clearAll();\n };\n const onPointerLockChange = () => {\n this.isPointerLocked = doc.pointerLockElement != null;\n // Lock state feeds both the mouse gate and map predicates: re-evaluate.\n this.syncAll();\n };\n\n target.addEventListener('keydown', onKeyDown);\n target.addEventListener('keyup', onKeyUp);\n target.addEventListener('mousemove', onMouseMove);\n target.addEventListener('wheel', onWheel, { passive: false });\n target.addEventListener('mousedown', onMouseDown);\n target.addEventListener('mouseup', onMouseUp);\n target.addEventListener('blur', onBlur);\n doc.addEventListener('visibilitychange', onVisibilityChange);\n doc.addEventListener('pointerlockchange', onPointerLockChange);\n\n this.disposers.push(\n () => target.removeEventListener('keydown', onKeyDown),\n () => target.removeEventListener('keyup', onKeyUp),\n () => target.removeEventListener('mousemove', onMouseMove),\n () => target.removeEventListener('wheel', onWheel),\n () => target.removeEventListener('mousedown', onMouseDown),\n () => target.removeEventListener('mouseup', onMouseUp),\n () => target.removeEventListener('blur', onBlur),\n () => doc.removeEventListener('visibilitychange', onVisibilityChange),\n () => doc.removeEventListener('pointerlockchange', onPointerLockChange),\n );\n }\n\n public dispose(): void {\n this.disposers.forEach((d) => d());\n this.disposers.length = 0;\n for (const ra of this.actions.values()) {\n ra.dispatched = false;\n ra.action._reset();\n }\n this.controls.clear();\n }\n}\n\n/** Create an input manager; types are fully inferred from the asset. */\nexport function createInput<Ctx, Def extends InputAssetDef<Ctx>>(\n asset: InputAsset<Ctx, Def>,\n options?: InputOptions<Ctx>,\n): InputManager<Ctx, Def> {\n return new InputManager(asset, options);\n}\n\n// ==================== Internals ====================\n\nfunction flattenControlPaths(bindings: readonly Binding[]): ControlPath[] {\n const out: ControlPath[] = [];\n for (const b of bindings) {\n if (isComposite(b)) {\n if (b.kind === 'axis1d') out.push(b.negative, b.positive);\n else out.push(b.up, b.down, b.left, b.right);\n } else {\n out.push(b);\n }\n }\n return out;\n}\n\nfunction compositeVector(b: Vector2DBinding, pressed: (p: ControlPath) => boolean): Vector2 {\n let x = (pressed(b.right) ? 1 : 0) - (pressed(b.left) ? 1 : 0);\n let y = (pressed(b.up) ? 1 : 0) - (pressed(b.down) ? 1 : 0);\n if (b.normalize && x !== 0 && y !== 0) {\n const inv = 1 / Math.hypot(x, y);\n x *= inv;\n y *= inv;\n }\n return { x, y };\n}\n\nfunction defaultValue(type: ActionValueType): boolean | number | Vector2 {\n return type === 'button' ? false : type === 'axis' ? 0 : { x: 0, y: 0 };\n}\n\nfunction applyProcessors(processors: readonly Processor[], type: ActionValueType, value: unknown): unknown {\n if (processors.length === 0) return value;\n if (type === 'axis') {\n let v = value as number;\n for (const p of processors) if (p.number) v = p.number(v);\n return v;\n }\n if (type === 'vector2') {\n let v = value as Vector2;\n for (const p of processors) if (p.vector2) v = p.vector2(v);\n return v;\n }\n return value;\n}\n\nfunction isDefaultValue(type: ActionValueType, v: unknown): boolean {\n if (type === 'button') return !(v as boolean);\n if (type === 'axis') return (v as number) === 0;\n const vec = v as Vector2;\n return vec.x === 0 && vec.y === 0;\n}\n\nfunction valueEquals(a: unknown, b: unknown): boolean {\n if (typeof a === 'object' && typeof b === 'object' && a !== null && b !== null) {\n const va = a as Vector2;\n const vb = b as Vector2;\n return va.x === vb.x && va.y === vb.y;\n }\n return a === b;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmEO,SAAS,iBACd,KAC6B;AAC7B,SAAO,EAAE,IAAI;AACf;;;AC5CO,SAAS,OAAO,MAAuE;AAC5F,SAAO,EAAE,MAAM,UAAU,GAAG,KAAK;AACnC;AAEO,SAAS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E,GAAG,EAAE;AAChB;AAEA,SAAS,aAAa,MAAmD;AACvE,SAAO,SAAS,WAAW,QAAQ,SAAS,SAAS,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE;AACxE;AAEA,SAAS,gBAAgB,YAAkC,MAAuB,OAAyB;AACzG,MAAI,WAAW,WAAW,EAAG,QAAO;AACpC,MAAI,SAAS,QAAQ;AACnB,QAAI,IAAI;AACR,eAAW,KAAK,WAAY,KAAI,EAAE,OAAQ,KAAI,EAAE,OAAO,CAAC;AACxD,WAAO;AAAA,EACT;AACA,MAAI,SAAS,WAAW;AACtB,QAAI,IAAI;AACR,eAAW,KAAK,WAAY,KAAI,EAAE,QAAS,KAAI,EAAE,QAAQ,CAAC;AAC1D,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,eAAe,MAAuB,GAAqB;AAClE,MAAI,SAAS,SAAU,QAAO,CAAE;AAChC,MAAI,SAAS,OAAQ,QAAQ,MAAiB;AAC9C,QAAM,MAAM;AACZ,SAAO,IAAI,MAAM,KAAK,IAAI,MAAM;AAClC;AAEA,SAAS,YAAY,GAAY,GAAqB;AACpD,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM,YAAY,MAAM,QAAQ,MAAM,MAAM;AAC9E,UAAM,KAAK;AACX,UAAM,KAAK;AACX,WAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG;AAAA,EACtC;AACA,SAAO,MAAM;AACf;","names":["_a"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { defineInputAsset } from './asset';
|
|
2
|
+
export type { ActionDef, ActionMapDef, AssetActionValues, Binding, ButtonActionDef, InputAsset, InputAssetDef, ValueActionDef, } from './asset';
|
|
3
|
+
export { axis1D, vector2D, isComposite } from './composites';
|
|
4
|
+
export type { Axis1DBinding, CompositeBinding, Vector2DBinding } from './composites';
|
|
5
|
+
export { press, hold, tap, doubleTap } from './interactions';
|
|
6
|
+
export type { InteractionDef } from './interactions';
|
|
7
|
+
export { scale, invert, invertX, invertY, deadzone, clamp, normalize } from './processors';
|
|
8
|
+
export type { Processor } from './processors';
|
|
9
|
+
export { InputAction } from './action';
|
|
10
|
+
export { InputActionMap } from './actionMap';
|
|
11
|
+
export { InputManager, createInput } from './manager';
|
|
12
|
+
export type { InputOptions, InputOverrides, RebindCallbacks, RebindOptions } from './manager';
|
|
13
|
+
export { MOUSE_DELTA, MOUSE_LEFT_BUTTON, MOUSE_MIDDLE_BUTTON, MOUSE_RIGHT_BUTTON, MOUSE_WHEEL_Y, isDeltaControl, mouseButtonPath, } from './types';
|
|
14
|
+
export type { ActionCallback, ActionCallbackContext, ActionPhase, ActionValueType, ControlPath, ValueOfType, Vector2, } from './types';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EACV,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,UAAU,EACV,aAAa,EACb,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAErF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3F,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA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