Input
cinnabar:extension/input@0.1.0
Local control edges, available only with explicit controls authority.
Grants: controls, except demo-pressed, which needs no grant.
Imported type event: event.
Types
text-event
A committed native field value addressed by its declared control ID.
record text-event {
id: string,
value: string,
}
| Member | Type | Description |
|---|---|---|
id | string | |
value | string |
field-key
A field navigation key with modifiers sampled at the key edge.
record field-key {
id: string,
key: string,
shift: bool,
control: bool,
alt: bool,
super-key: bool,
}
| Member | Type | Description |
|---|---|---|
id | string | |
key | string | |
shift | bool | |
control | bool | |
alt | bool | |
super-key | bool |
field-event
A native edit, submission or navigation edge; composition remains host-owned.
variant field-event {
change(text-event),
submit(text-event),
key(field-key),
}
| Member | Type | Description |
|---|---|---|
change | text-event | |
submit | text-event | |
key | field-key |
Types: field-key, text-event.
controls
One focused input sample; keys and pointer use the host’s coordinate and naming contracts.
record controls {
seconds: f32,
focused: bool,
gameplay: bool,
panel-open: bool,
keys-pressed: list<string>,
keys-held: list<string>,
events: list<event>,
pointer: option<tuple<f32, f32>>,
wheel: f32,
}
| Member | Type | Description |
|---|---|---|
seconds | f32 | |
focused | bool | |
gameplay | bool | |
panel-open | bool | |
keys-pressed | list<string> | Physical non-repeat edges; pointer buttons use MouseLeft/MouseRight/MouseMiddle. |
keys-held | list<string> | Physical keys held this frame, including reserved ones. |
events | list<event> | |
pointer | option<tuple<f32, f32>> | Pointer position in the gameplay HUD root’s GUI units from its top left, the space ofhud.read-viewport, while this mod’s open panel owns input; none otherwise. A panel’sown fitting, such as a reference_size scaled to a small window, does not change it. |
wheel | f32 | Wheel notches this frame while this mod’s panel owns input; positive scrolls up. |
Types: event.
selection
Selects which fields to copy without changing the underlying frame or its event ordering.
record selection {
keys-pressed: option<list<string>>,
keys-held: option<list<string>>,
events: bool,
}
| Member | Type | Description |
|---|---|---|
keys-pressed | option<list<string>> | None selects all keys; some(empty) selects none; names select exact matches. |
keys-held | option<list<string>> | |
events | bool |
Functions
demo-pressed
demo-pressed: func() -> bool;
True only for the current frame’s host-assigned action edge.
read-controls
read-controls: func() -> result<controls, string>;
Reads this callback’s control sample with controls authority and the shared read allowance.
Types: controls.
read-selected-controls
read-selected-controls: func(selection: selection) -> result<controls, string>;
Reads selected fields from the same current frame, preserving native key order. Requires controls authority and shares the read-controls callback read budget.
read-text-events
read-text-events: func() -> result<list<text-event>, string>;
Committed single-line native text edits, separate from legacy numeric control events. Requires controls authority; repeated reads see the same bounded batch in a frame callback.
Types: text-event.
read-field-events
read-field-events: func() -> result<list<field-event>, string>;
Live values coalesce per field between frame callbacks. Submit and navigation retain order. Navigation includes the modifiers sampled at that key edge; preedit stays host-local.
Types: field-event.
reserve-keys
reserve-keys: func(keys: list<string>) -> result<_, string>;
Physical key names reserved before the ordinary gameplay router samples them.