@native-sdk/core 0.5.1 → 0.5.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/sdk/events.ts +39 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@native-sdk/core",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "The TypeScript authoring tier: the app-core subset, its dev-time transpiler to arena-backed Zig, and the SDK module cores import",
5
5
  "repository": {
6
6
  "type": "git",
package/sdk/events.ts CHANGED
@@ -26,8 +26,9 @@
26
26
  // - `TextInputEvent`, `ScrollState`: Msg-arm PAYLOAD fields —
27
27
  // `{ kind: "draft_edit"; edit: TextInputEvent }`,
28
28
  // `{ kind: "scrolled"; scroll: ScrollState }`.
29
- // - `FrameEvent`, `KeyEvent`: the wiring channels' parameter records —
30
- // `frameMsg(model, frame: FrameEvent)`, `keyMsg(key: KeyEvent)`.
29
+ // - `FrameEvent`, `KeyEvent`, `PinchEvent`: the wiring channels'
30
+ // parameter records — `frameMsg(model, frame: FrameEvent)`,
31
+ // `keyMsg(key: KeyEvent)`, `pinchMsg(pinch: PinchEvent)`.
31
32
  // - `ColorScheme`, `ChromeInsets`, `ChromeButtons`, `AudioState`: field
32
33
  // types INSIDE the arm records the `appearanceMsg`/`chromeMsg`/audio
33
34
  // routes name (the arms themselves stay inline unions of `kind` plus
@@ -72,6 +73,42 @@ export interface KeyEvent {
72
73
  readonly super: boolean;
73
74
  }
74
75
 
76
+ /// The pinch phase vocabulary — a NAMED begin/change/end alias (the host
77
+ /// matches enum members by name, so this is the `phase` field's type in
78
+ /// `pinchMsg`'s parameter record). A host-cancelled gesture folds into
79
+ /// "end": pinch delivers incremental deltas the app applies as they
80
+ /// arrive, so there is no transient state to roll back. A terminal host
81
+ /// event that still measured a nonzero delta delivers it as a final
82
+ /// "change" before the "end", so the cumulative product always matches
83
+ /// what the OS reported.
84
+ export type PinchPhase = "begin" | "change" | "end";
85
+
86
+ /// The pinch channel's record (`pinchMsg(pinch)`): the trackpad pinch
87
+ /// gesture, phase-explicit. `windowId`/`label` name the source window and
88
+ /// gpu-surface view — `x`/`y` are view-local, so a coordinate without its
89
+ /// view is not a position, and multi-window apps tell pinches apart by
90
+ /// these. `scale` is the magnification DELTA for this event (nonzero
91
+ /// only on "change"), and the delta is MULTIPLICATIVE: the cumulative
92
+ /// gesture scale is the running product of `1 + scale` — apply it
93
+ /// memorylessly, `zoom *= 1 + scale`, no gesture-start bookkeeping. On
94
+ /// macOS this is AppKit's raw per-event `NSEvent.magnification`, which
95
+ /// IS that multiplicative delta per the browser-engine convention, so
96
+ /// the product matches the zoom the same gesture performs in Safari and
97
+ /// Chrome. `x`/`y` is the pointer anchor in view-local canvas
98
+ /// points — the pointer location during the gesture (hosts report gesture
99
+ /// events at the pointer, not at a midpoint between the fingers), so a
100
+ /// zoom can anchor under the cursor. Pinch is a view-global gesture — it
101
+ /// never routes through widgets — so this is the honest home for timeline
102
+ /// and canvas zoom. Only hosts with a pinch source emit it (macOS today).
103
+ export interface PinchEvent {
104
+ readonly windowId: number;
105
+ readonly label: string;
106
+ readonly phase: PinchPhase;
107
+ readonly scale: number;
108
+ readonly x: number;
109
+ readonly y: number;
110
+ }
111
+
75
112
  /// The appearance vocabulary — a NAMED light/dark alias (the host matches
76
113
  /// enum members by name, so this is the `colorScheme` field's type in the
77
114
  /// arm `appearanceMsg` names).