@simpludify/core 0.1.2 → 0.1.3

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.
@@ -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.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {