Index of every page on this site: llms.txt
All skills
oahc09 avatar

/cocosair-input-action

@ed38648
by oahc09oahc09/cocosairjs3 stars
2
Run it yourself

Wire keyboard, mouse, touch and action state; navigate SceneStack pages. Use for focus, held-key resets, session gates, DOM canvas errors or persistent push/pop.

  • 10 files
  • 38.8 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/oahc09/cocosairjs/cocosair-input-action

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescontext.md

≈1.3k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Working context

Use package imports and shipped docs for an application; use source paths and repository commands only in a confirmed AIR checkout. A copied host skill is not a runtime installation.

Read the shared environment rules when locating these roots. If sibling resources are unavailable, use the installed canonical chapter and disclose the limitation. Tool declarations identify workflow capabilities; they do not authorize installation, writes, publication or any action outside the user and host scope.

Related skills

  • cocosair - routing and shared Code First constraints; reuse it if already loaded.
  • cocosair-application - createAirApp, the app handle and its session scope that gate input admission.
  • cocosair-scene-graph - Node/Scene structure and deferred destroy() that SceneStack pages rely on.
  • cocosair-camera - the camera converting a screen point to a ray for a picked node.
  • cocosair-verification - how to prove an input path in a real browser instead of asserting it.

For gesture unlock, live inspection or widgets, load cocosair-audio-video, cocosair-agent-session or cocosair-ui-2d as needed. These skills exist alongside this one.

Original entry guidance

The original entry wording below is an on-demand archive, not a second routing source.

Use the environment rules to locate the checkout or installed package; sibling skills are optional direct dependencies, not a recursive load list.

Read real events through input / systemEvent, then drive gameplay through the AIR action layer: createActionState holds the state machine, createActionInput wires one backend to it, createSessionGate admits or rejects, and SceneStack navigates persistent pages.

Read references/quick-start.md when constructing the minimal example. It preserves the complete setup and teardown sequence; select the source-checkout or npm-consumer environment first.

Read references/context.md to select the owner of this step and only its directly needed dependencies. Reuse already loaded skills; this is not a recursive load list.

Original mistake navigation

Before implementing the relevant path, read its wrong/right examples in references/common-mistakes.md:

  • [HIGH] Using the dom backend and expecting the canvas to be found for you
  • [HIGH] Assuming reset() unhooked the event listeners
  • [MEDIUM] Expecting keys to keep firing while an input element has focus

Original metadata

Description and description_en

The two original fields contained exactly the same value, retained once here.

Wires native input events and the AIR action layer in code-first Cocos AIR - the engine input singleton and systemEvent globals, EventTouch/EventKeyboard/EventMouse with the Input.EventType and SystemEvent.EventType enums and KeyCode key codes, createActionState as a pure held/pressed/released/axis reducer keyed per (action, source) with seven reset reasons and no listener removal, createActionInput over the native or dom backend where dom needs an explicit canvas and skips editable targets, createSessionGate for session admission, and SceneStack persistent-page navigation with dual-page transition, capture-phase input block and LRU eviction. Use when handling touch/keyboard/mouse in a Cocos AIR scene, when keys stop firing because an input or textarea has focus, when a dom action backend throws for a missing canvas, when a held button must survive a blur or page-hidden reset, or when push/pop page state must be preserved during a transition.

Keywords

Cocos AIR, cocosair.js, input, action

References

  • native-input.md - the input and systemEvent globals, the Input.EventType and SystemEvent.EventType enums, the EventTouch/EventKeyboard/EventMouse payloads, KeyCode, and the mouse-to-touch conversion.
  • action-state.md - the pure reducer surface: source identity and backends, OR semantics, idempotent press, consumeTick ordering, the seven reset reasons, axis clamping, and the AIR_E_* validation errors.
  • action-input.md - the native and dom adapters, the explicit-canvas requirement, focus and editable-target rules, the session gate wiring, and attach/detach/reset/dispose lifecycle.
  • scene-stack.md - persistent-page navigation: dual-page transition, capture-phase input block, LRU eviction, and disposal.

Canonical docs

  • docs/manual/input-and-events.md - the engine-level event surface, listener registration and event payloads.
  • docs/manual/input-action-state.md - the action reducer and adapter contracts, backend choice and validation errors.
  • docs/manual/test-input-injection.md - injecting native and dom input for tests and headless verification.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at ed38648. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
layer
subsystem
All 1 allowed tools
Read Edit Write Bash
Other metadata
compatibility
Cocos AIR source checkout or installed cocosair.js package. Browser rendering requires WebGL 2; source tooling requires Node.js >=18. Use the host-provided tools and user-authorized workspace.
when_to_use
[
  "map keys, touch or mouse to named actions",
  "keys stop firing while an input has focus",
  "DOM input fails without an explicit canvas",
  "clear held actions after blur or page hiding",
  "preserve page state across push/pop transitions"
]
owns
[
  "native-input",
  "action-state",
  "dom-input",
  "focus-reset",
  "session-gate",
  "scene-stack"
]
not_for
[
  "full scene replacement -> cocosair-application",
  "DOM overlay geometry -> cocosair-graphics-and-dom",
  "node lifecycle and custom events -> cocosair-scene-graph"
]
metadata
{
  "author": "oahc09@gmail.com",
  "version": "1.0.0",
  "last-updated": "2026-10-13",
  "description_zh": "处理原生和 DOM 输入、动作状态、焦点、会话门禁及 SceneStack。用于按键触摸、动作映射、输入阻断或清理问题。"
}

README badge

README badge for oahc09/cocosairjs/cocosair-input-action