@simpludify/core 0.1.2 → 0.1.4

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.
@@ -42,15 +42,20 @@ export declare class ActionController<A extends ActionSet> implements LifetimeOw
42
42
  private readonly entries;
43
43
  private readonly sources;
44
44
  private readonly bus;
45
+ private keyboardAllowed;
46
+ private readonly blockedKeys;
45
47
  private pending;
46
48
  private transitions;
47
49
  constructor(actions: A, options: {
48
50
  scene: Scene;
49
51
  input: InputSystem;
50
52
  bindings?: ActionBindings<A>;
53
+ keyboard?: boolean;
51
54
  });
52
55
  get disposed(): boolean;
53
56
  get active(): boolean;
57
+ get keyboardEnabled(): boolean;
58
+ set keyboardEnabled(value: boolean);
54
59
  get sourceCount(): number;
55
60
  onDispose(callback: () => void): () => void;
56
61
  private entry;
@@ -2,8 +2,11 @@ import { type LifetimeOwner } from "../foundation/lifetime.js";
2
2
  /** @internal Shared lifetime for logical and device contributions. */
3
3
  export declare abstract class OwnedInputSource {
4
4
  private dead;
5
+ private accepting;
5
6
  private removeOwner;
6
7
  get disposed(): boolean;
8
+ get enabled(): boolean;
9
+ set enabled(value: boolean);
7
10
  /** @internal */ own(owner: LifetimeOwner): void;
8
11
  protected writable(neutral: boolean): boolean;
9
12
  protected abstract release(remove: boolean): void;
@@ -2,6 +2,12 @@ import { type LifetimeOwner } from "../foundation/lifetime.js";
2
2
  import type { ActionFrame } from "./action-frame.js";
3
3
  import { OwnedInputSource } from "./input-source.js";
4
4
  import { type KeyCode } from "./key-code.js";
5
+ /** Host device adapter. Sampled before all Action frames; reset flushes held device state. */
6
+ export interface InputAdapter {
7
+ sample(): void;
8
+ reset(): void;
9
+ dispose(): void;
10
+ }
5
11
  /** @internal Engine boundary participant, implemented by ActionController. */
6
12
  export interface ActionInputPort {
7
13
  readonly active: boolean;
@@ -24,12 +30,15 @@ export declare class KeyboardSource extends OwnedInputSource {
24
30
  /** Engine-owned routing and update boundary. No raw game-state/alternate movement API. */
25
31
  export declare class InputSystem {
26
32
  private readonly actions;
33
+ private readonly adapters;
27
34
  private readonly keyboards;
28
35
  private dead;
29
36
  private playback;
30
37
  private frames;
31
38
  get sourceCount(): number;
32
39
  /** @internal */ registerActions(actions: ActionInputPort): () => void;
40
+ /** Host integration boundary; ordinary game input uses ActionSource instead. */
41
+ addAdapter(adapter: InputAdapter): () => void;
33
42
  acceptsKey(code: KeyCode): boolean;
34
43
  private notify;
35
44
  /** @internal Device state is resolved only through Action bindings. */
@@ -26,7 +26,7 @@ export type CanvasControlModel = {
26
26
  readonly text: string;
27
27
  readonly placeholder: string;
28
28
  readonly maxLength: number | undefined;
29
- readonly inputMode: "text" | "decimal";
29
+ readonly inputMode: "text" | "numeric" | "decimal";
30
30
  readonly numeric?: Readonly<{
31
31
  value: number;
32
32
  min: number;
@@ -18,6 +18,7 @@ export declare abstract class CanvasTextEditorNode<T> extends CanvasInputNode<T>
18
18
  protected abstract parse(text: string): {
19
19
  value: T;
20
20
  } | undefined;
21
+ protected get inputMode(): "text" | "numeric" | "decimal";
21
22
  protected get limit(): number | undefined;
22
23
  get draft(): CanvasTextSnapshot;
23
24
  get placeholder(): string;
@@ -58,6 +58,16 @@ export interface CanvasPresentationStyle {
58
58
  readonly offsetY: number;
59
59
  readonly opacity: number;
60
60
  }
61
+ /** Portable text semantics; headings require a document level. */
62
+ export type CanvasLabelOptions = {
63
+ readonly text: string;
64
+ } & ({
65
+ readonly role?: "status" | "alert";
66
+ readonly level?: never;
67
+ } | {
68
+ readonly role: "heading";
69
+ readonly level: 1 | 2 | 3 | 4 | 5 | 6;
70
+ });
61
71
  export interface UIBounds {
62
72
  readonly x: number;
63
73
  readonly y: number;
@@ -138,9 +148,15 @@ export declare class CanvasNode implements LifetimeOwner {
138
148
  setScrollRange(x: number, y: number): void;
139
149
  private click;
140
150
  private hold;
151
+ /** @internal Text semantics supplied by CanvasLabel. */
152
+ readonly labelSemantics: Readonly<{
153
+ role?: "heading" | "status" | "alert";
154
+ level?: number;
155
+ }> | undefined;
141
156
  /** @internal Prefer CanvasPanel/Label/Button/HoldButton. */
142
157
  constructor(kind: CanvasNodeKind, options?: {
143
158
  text?: string;
159
+ label?: Omit<CanvasLabelOptions, "text">;
144
160
  style?: CanvasStyle;
145
161
  click?: (signal: CancellationSignal) => void | Promise<void>;
146
162
  hold?: (held: boolean) => void;
@@ -188,7 +204,7 @@ export declare class CanvasNode implements LifetimeOwner {
188
204
  export declare function CanvasPanel(children?: readonly CanvasNode[], style?: CanvasStyle): CanvasNode;
189
205
  export declare function CanvasRow(children: readonly CanvasNode[], style?: CanvasStyle): CanvasNode;
190
206
  export declare function CanvasColumn(children: readonly CanvasNode[], style?: CanvasStyle): CanvasNode;
191
- export declare function CanvasLabel(text: string, style?: CanvasStyle): CanvasNode;
207
+ export declare function CanvasLabel(content: string | CanvasLabelOptions, style?: CanvasStyle): CanvasNode;
192
208
  export declare function CanvasButton(text: string, click: (signal: CancellationSignal) => void | Promise<void>, style?: CanvasStyle): CanvasNode;
193
209
  export declare function CanvasHoldButton(text: string, hold: (held: boolean) => void, style?: CanvasStyle): CanvasNode;
194
210
  /** Clipped overflowing panel. Give the viewport a bounded size or grow allocation. */
@@ -1,6 +1,9 @@
1
1
  import { CanvasTextEditorNode } from "./canvas-editor.js";
2
2
  import type { CanvasStyle } from "./canvas-node.js";
3
+ export type CanvasTextInputMode = "text" | "numeric" | "decimal";
3
4
  export interface CanvasTextInputOptions {
5
+ /** Keyboard hint only; accepted text and IME remain unchanged. Default text. */
6
+ inputMode?: CanvasTextInputMode;
4
7
  label?: string;
5
8
  value?: string;
6
9
  placeholder?: string;
@@ -15,6 +18,7 @@ export declare class CanvasTextInputNode extends CanvasTextEditorNode<string> {
15
18
  protected parse(text: string): {
16
19
  value: string;
17
20
  } | undefined;
21
+ protected get inputMode(): CanvasTextInputMode;
18
22
  protected get limit(): number | undefined;
19
23
  get maxLength(): number | undefined;
20
24
  /** Atomic: shrinking below the accepted value is rejected. Valid changes supersede active editing. */
@@ -13,6 +13,7 @@ export declare class CanvasUI implements LifetimeOwner {
13
13
  private focusNode;
14
14
  private factor;
15
15
  private dirty;
16
+ private measure;
16
17
  private projectionDirty;
17
18
  private readonly baseBounds;
18
19
  private readonly moving;
@@ -54,6 +55,8 @@ export declare class CanvasUI implements LifetimeOwner {
54
55
  focus(node?: CanvasNode): void;
55
56
  /** Ordered traversal, including offscreen controls. Undefined leaves focus at the boundary. */
56
57
  focusNext(reverse?: boolean): CanvasNode | undefined;
58
+ /** Reuse the Host's last metrics after a dynamic form/list mutation. */
59
+ private syncFocusLayout;
57
60
  /** Project scroll reveal before testing clips; static clipped controls must not trap Tab. */
58
61
  private canFocus;
59
62
  /** Scroll ancestors just enough to reveal a focused descendant. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simpludify/core",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {