@molecule/app-pointer-events-dom 1.1.0 → 1.2.0

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.
package/README.md CHANGED
@@ -3,14 +3,15 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-25T19:03:26.212Z
6
+ Generated: 2026-11-27T20:36:32.142Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-pointer-events-dom
10
10
 
11
- Shared DOM drag, hover, and Ctrl-wheel zoom gestures for the Molecule web UI kits.
11
+ Shared DOM drag, hover, and focal zoom gestures for the Molecule web UI kits.
12
12
 
13
- Use the renderer's drag binding with `ElementDrag` from `@molecule/app-ui`.
13
+ Use the renderer's drag binding with `ElementDrag` or pass `{ drag, zoom }` from
14
+ `@molecule/app-ui` on a surface with focal wheel zoom and two-finger pinch.
14
15
  All web kits share press ownership, pointer capture, touch intent, and
15
16
  cancellation on pointer cancel, lost capture, window blur, and host removal.
16
17
  Use `markPressTarget` for custom controls that must keep their own presses.
@@ -56,9 +57,15 @@ interface WebDrag {
56
57
  /**
57
58
  * Updates the callbacks used by the gesture. Removing the handlers cancels the contact.
58
59
  *
59
- * @param drag - The current handlers, or undefined to disable dragging.
60
+ * @param options - The current handlers, or undefined to disable the surface.
60
61
  */
61
- update(drag: ElementDrag | undefined): void
62
+ update(options: WebDragOptions | undefined): void
63
+ /**
64
+ * Attaches touch reservation and focal wheel input to the current host.
65
+ *
66
+ * @param host - The host receiving wheel events, or null on detach.
67
+ */
68
+ attach(host: DragHost | null): void
62
69
  /**
63
70
  * Offers a pointer press to this host.
64
71
  *
@@ -73,7 +80,7 @@ interface WebDrag {
73
80
  drag?: ElementDrag,
74
81
  target?: EventTarget | null,
75
82
  ): void
76
- /** Cancels the active contact, if any. */
83
+ /** Cancels the active input, if any. */
77
84
  cancel(): void
78
85
  }
79
86
  ```
@@ -87,9 +94,9 @@ interface WebDragBinding {
87
94
  /**
88
95
  * Updates the handlers for this host.
89
96
  *
90
- * @param drag - The current handlers, or undefined to disable dragging.
97
+ * @param options - The current handlers, or undefined to disable the surface.
91
98
  */
92
- update(drag: ElementDrag | undefined): void
99
+ update(options: WebDragOptions | undefined): void
93
100
  /** Removes the pointer listener and cancels any active contact. */
94
101
  destroy(): void
95
102
  }
@@ -144,6 +151,14 @@ interface WebWheelZoomBinding {
144
151
 
145
152
  ### Types
146
153
 
154
+ #### `WebDragOptions`
155
+
156
+ Accepts a standalone drag or the element's combined drag and zoom options.
157
+
158
+ ```typescript
159
+ type WebDragOptions = ElementDrag | ElementDragProps
160
+ ```
161
+
147
162
  #### `WebWheelZoomHandler`
148
163
 
149
164
  Called with the direction of one Ctrl-wheel step.
@@ -164,28 +179,28 @@ function markPressTarget(host: Element): void
164
179
 
165
180
  - `host` — The element that owns the activation.
166
181
 
167
- #### `createWebDrag(initialDrag)`
182
+ #### `createWebDrag(initial)`
168
183
 
169
184
  Acquires a press on the deepest drag host and follows its pointer until release or interruption.
170
185
 
171
186
  ```typescript
172
- function createWebDrag(initialDrag?: ElementDrag): WebDrag
187
+ function createWebDrag(initial?: WebDragOptions): WebDrag
173
188
  ```
174
189
 
175
- - `initialDrag` — The initial handlers, if the host starts enabled.
190
+ - `initial` — The initial handlers, if the host starts enabled.
176
191
 
177
192
  **Returns:** The controls a renderer uses to handle pointerdown, updates and unmount.
178
193
 
179
- #### `bindWebDrag(host, drag)`
194
+ #### `bindWebDrag(host, options)`
180
195
 
181
196
  Binds a drag to a native bubbling pointerdown listener.
182
197
 
183
198
  ```typescript
184
- function bindWebDrag(host: HTMLElement | SVGElement, drag?: ElementDrag): WebDragBinding
199
+ function bindWebDrag(host: DragHost, options?: WebDragOptions): WebDragBinding
185
200
  ```
186
201
 
187
202
  - `host` — The element that can own the press.
188
- - `drag` — The initial handlers, if the host starts enabled.
203
+ - `options` — The initial handlers, if the host starts enabled.
189
204
 
190
205
  **Returns:** The binding to update or destroy with the host.
191
206
 
@@ -235,13 +250,31 @@ function bindWebWheelZoom(
235
250
 
236
251
  **Returns:** The binding to update or destroy with the host.
237
252
 
253
+ #### `bindWebFocalWheelZoom(host, frame, current)`
254
+
255
+ Binds a non-passive focal wheel listener to a gesture surface.
256
+
257
+ ```typescript
258
+ function bindWebFocalWheelZoom(
259
+ host: Element,
260
+ frame: () => Element,
261
+ current: () => ElementZoom | undefined,
262
+ ): () => void
263
+ ```
264
+
265
+ - `host` — The wheel event host.
266
+ - `frame` — Reads the untransformed outer frame after the host mounts.
267
+ - `current` — Reads the enabled zoom callback when the surface is free to accept a wheel.
268
+
269
+ **Returns:** Removes the wheel listener.
270
+
238
271
  ## Injection Notes
239
272
 
240
273
  ### Requirements
241
274
 
242
275
  Peer dependencies:
243
276
 
244
- - `@molecule/app-ui` ^1.9.0
277
+ - `@molecule/app-ui` ^1.16.0
245
278
 
246
279
  ### Runtime Dependencies
247
280
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Shared DOM drag, hover, and Ctrl-wheel zoom gestures for the Molecule web UI kits.
2
+ * Shared DOM drag, hover, and focal zoom gestures for the Molecule web UI kits.
3
3
  *
4
- * Use the renderer's drag binding with `ElementDrag` from `@molecule/app-ui`.
4
+ * Use the renderer's drag binding with `ElementDrag` or pass `{ drag, zoom }` from
5
+ * `@molecule/app-ui` on a surface with focal wheel zoom and two-finger pinch.
5
6
  * All web kits share press ownership, pointer capture, touch intent, and
6
7
  * cancellation on pointer cancel, lost capture, window blur, and host removal.
7
8
  * Use `markPressTarget` for custom controls that must keep their own presses.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Shared DOM drag, hover, and Ctrl-wheel zoom gestures for the Molecule web UI kits.
2
+ * Shared DOM drag, hover, and focal zoom gestures for the Molecule web UI kits.
3
3
  *
4
- * Use the renderer's drag binding with `ElementDrag` from `@molecule/app-ui`.
4
+ * Use the renderer's drag binding with `ElementDrag` or pass `{ drag, zoom }` from
5
+ * `@molecule/app-ui` on a surface with focal wheel zoom and two-finger pinch.
5
6
  * All web kits share press ownership, pointer capture, touch intent, and
6
7
  * cancellation on pointer cancel, lost capture, window blur, and host removal.
7
8
  * Use `markPressTarget` for custom controls that must keep their own presses.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
@@ -1,4 +1,7 @@
1
- import type { ElementDrag } from '@molecule/app-ui';
1
+ import type { ElementDrag, ElementDragProps } from '@molecule/app-ui';
2
+ type DragHost = HTMLElement | SVGElement;
3
+ /** Accepts a standalone drag or the element's combined drag and zoom options. */
4
+ export type WebDragOptions = ElementDrag | ElementDragProps;
2
5
  /**
3
6
  * Marks a custom press target so an enclosing drag leaves its activation alone.
4
7
  *
@@ -10,9 +13,15 @@ export interface WebDrag {
10
13
  /**
11
14
  * Updates the callbacks used by the gesture. Removing the handlers cancels the contact.
12
15
  *
13
- * @param drag - The current handlers, or undefined to disable dragging.
16
+ * @param options - The current handlers, or undefined to disable the surface.
14
17
  */
15
- update(drag: ElementDrag | undefined): void;
18
+ update(options: WebDragOptions | undefined): void;
19
+ /**
20
+ * Attaches touch reservation and focal wheel input to the current host.
21
+ *
22
+ * @param host - The host receiving wheel events, or null on detach.
23
+ */
24
+ attach(host: DragHost | null): void;
16
25
  /**
17
26
  * Offers a pointer press to this host.
18
27
  *
@@ -22,24 +31,24 @@ export interface WebDrag {
22
31
  * @param target - The renderer's normalized target, when it differs from the native target.
23
32
  */
24
33
  start(host: HTMLElement | SVGElement, down: PointerEvent, drag?: ElementDrag, target?: EventTarget | null): void;
25
- /** Cancels the active contact, if any. */
34
+ /** Cancels the active input, if any. */
26
35
  cancel(): void;
27
36
  }
28
37
  /**
29
38
  * Acquires a press on the deepest drag host and follows its pointer until release or interruption.
30
39
  *
31
- * @param initialDrag - The initial handlers, if the host starts enabled.
40
+ * @param initial - The initial handlers, if the host starts enabled.
32
41
  * @returns The controls a renderer uses to handle pointerdown, updates and unmount.
33
42
  */
34
- export declare function createWebDrag(initialDrag?: ElementDrag): WebDrag;
43
+ export declare function createWebDrag(initial?: WebDragOptions): WebDrag;
35
44
  /** The lifecycle of a drag attached to a DOM element. */
36
45
  export interface WebDragBinding {
37
46
  /**
38
47
  * Updates the handlers for this host.
39
48
  *
40
- * @param drag - The current handlers, or undefined to disable dragging.
49
+ * @param options - The current handlers, or undefined to disable the surface.
41
50
  */
42
- update(drag: ElementDrag | undefined): void;
51
+ update(options: WebDragOptions | undefined): void;
43
52
  /** Removes the pointer listener and cancels any active contact. */
44
53
  destroy(): void;
45
54
  }
@@ -47,8 +56,9 @@ export interface WebDragBinding {
47
56
  * Binds a drag to a native bubbling pointerdown listener.
48
57
  *
49
58
  * @param host - The element that can own the press.
50
- * @param drag - The initial handlers, if the host starts enabled.
59
+ * @param options - The initial handlers, if the host starts enabled.
51
60
  * @returns The binding to update or destroy with the host.
52
61
  */
53
- export declare function bindWebDrag(host: HTMLElement | SVGElement, drag?: ElementDrag): WebDragBinding;
62
+ export declare function bindWebDrag(host: DragHost, options?: WebDragOptions): WebDragBinding;
63
+ export {};
54
64
  //# sourceMappingURL=web-drag.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-drag.d.ts","sourceRoot":"","sources":["../src/web-drag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAoB,MAAM,kBAAkB,CAAA;AAQrE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAEnD;AA6CD,sDAAsD;AACtD,MAAM,WAAW,OAAO;IACtB;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAA;IAC3C;;;;;;;OAOG;IACH,KAAK,CACH,IAAI,EAAE,WAAW,GAAG,UAAU,EAC9B,IAAI,EAAE,YAAY,EAClB,IAAI,CAAC,EAAE,WAAW,EAClB,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GAC1B,IAAI,CAAA;IACP,0CAA0C;IAC1C,MAAM,IAAI,IAAI,CAAA;CACf;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAgJhE;AAED,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAA;IAC3C,mEAAmE;IACnE,OAAO,IAAI,IAAI,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,EAAE,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
+ import { trackWebPinch } from './web-pinch.js';
2
+ import { bindWebFocalWheelZoom } from './web-wheel-zoom.js';
1
3
  const claimed = new WeakSet();
2
4
  const pressTargets = new WeakSet();
3
5
  const controls = 'button, input, textarea, select, label, a[href], [role="button"], [role="link"]';
@@ -42,15 +44,47 @@ function point(viewport, down, { clientX, clientY, altKey, ctrlKey, metaKey, shi
42
44
  shiftKey,
43
45
  };
44
46
  }
47
+ /** Uses the SVG viewport rather than the bounds of a transformed group. */
48
+ function viewportFor(host) {
49
+ return host.localName === 'g' && 'ownerSVGElement' in host ? (host.ownerSVGElement ?? host) : host;
50
+ }
51
+ /** Normalizes the original drag-only binding and the combined gesture options. */
52
+ function surfaceOptions(options) {
53
+ return options && 'onStart' in options ? { drag: options } : (options ?? {});
54
+ }
45
55
  /**
46
56
  * Acquires a press on the deepest drag host and follows its pointer until release or interruption.
47
57
  *
48
- * @param initialDrag - The initial handlers, if the host starts enabled.
58
+ * @param initial - The initial handlers, if the host starts enabled.
49
59
  * @returns The controls a renderer uses to handle pointerdown, updates and unmount.
50
60
  */
51
- export function createWebDrag(initialDrag) {
52
- let handlers = initialDrag;
61
+ export function createWebDrag(initial) {
62
+ let { drag: handlers, zoom } = surfaceOptions(initial);
53
63
  let active = null;
64
+ let touch = null;
65
+ let attached = null;
66
+ let detachZoom;
67
+ /** Reserves touch input and installs focal wheel handling on the attached host. */
68
+ function attachZoom() {
69
+ if (!attached || !zoom || detachZoom)
70
+ return;
71
+ const host = attached;
72
+ const previous = host.style.touchAction;
73
+ // The touch-action decision is made at pointer down, before a second contact can register.
74
+ host.style.touchAction = 'none';
75
+ const removeWheel = bindWebFocalWheelZoom(host, () => viewportFor(host), () => (active || touch ? undefined : zoom));
76
+ detachZoom = () => {
77
+ removeWheel();
78
+ if (host.style.touchAction === 'none')
79
+ host.style.touchAction = previous ?? '';
80
+ detachZoom = undefined;
81
+ };
82
+ }
83
+ /** Closes both the contact tracker and any acquired drag. */
84
+ function cancel() {
85
+ touch?.cancel();
86
+ active?.cancel();
87
+ }
54
88
  /**
55
89
  * Claims the press and starts tracking the owning pointer.
56
90
  *
@@ -60,40 +94,78 @@ export function createWebDrag(initialDrag) {
60
94
  * @param target - The element the press hit.
61
95
  */
62
96
  function start(host, down, drag = handlers, target = down.target) {
63
- if (!drag)
97
+ if (!drag && !zoom)
64
98
  return;
65
99
  if (down.button !== undefined && down.button !== 0)
66
100
  return;
67
- // A pointer event can lack a device type when dispatched through a mouse-only host.
68
- if (down.pointerType && down.isPrimary === false)
69
- return;
70
101
  if (claimed.has(down) || insideControl(host, target))
71
102
  return;
72
103
  const ownerWindow = host.ownerDocument.defaultView;
73
104
  if (!ownerWindow)
74
105
  return;
106
+ if (down.pointerType === 'touch' && zoom) {
107
+ // A second finger cannot acquire a surface whose first contact belongs elsewhere.
108
+ if (!touch) {
109
+ if (down.isPrimary === false || active)
110
+ return;
111
+ touch = trackWebPinch(viewportFor(host), ownerWindow, {
112
+ takeOver: () => active?.takeOver(),
113
+ resume(remaining, event) {
114
+ if (handlers)
115
+ beginDrag(host, ownerWindow, remaining, handlers, true, true).move(event);
116
+ },
117
+ zoom: (sample) => zoom?.onZoom(sample),
118
+ close(cancelDrag) {
119
+ touch = null;
120
+ if (cancelDrag)
121
+ active?.cancel();
122
+ },
123
+ });
124
+ claimed.add(down);
125
+ touch.add(down);
126
+ if (drag)
127
+ beginDrag(host, ownerWindow, down, drag, true);
128
+ }
129
+ else {
130
+ claimed.add(down);
131
+ touch.add(down);
132
+ }
133
+ return;
134
+ }
135
+ if (!drag || touch || (down.pointerType && down.isPrimary === false))
136
+ return;
75
137
  claimed.add(down);
76
- const { pointerId } = down;
77
138
  // A down for the same pointer after a lost terminal event starts a new contact.
78
- if (active && active.pointerId !== pointerId)
139
+ if (active && active.pointerId !== down.pointerId)
79
140
  return;
80
141
  active?.cancel();
81
- const viewport = host.localName === 'g' && 'ownerSVGElement' in host ? (host.ownerSVGElement ?? host) : host;
142
+ beginDrag(host, ownerWindow, down, drag, false);
143
+ }
144
+ /** Starts a drag at the original contact or the surviving contact after a pinch. */
145
+ function beginDrag(host, ownerWindow, down, drag, ownsTouch, resumed = false) {
146
+ const { pointerId } = down;
147
+ const viewport = viewportFor(host);
82
148
  const touch = down.pointerType === 'touch';
83
- const longPress = touch && drag.touchStart === 'longPress';
149
+ const longPress = touch && !resumed && drag.touchStart === 'longPress';
84
150
  let timer;
85
151
  let last;
86
152
  let captured = false;
87
153
  let axisChosen = longPress ||
88
154
  (drag.axis !== 'horizontal' && drag.axis !== 'vertical') ||
89
- (touch && ownerWindow.getComputedStyle(host).touchAction === 'none');
90
- const session = { pointerId, cancel: () => finish() };
155
+ (touch && (ownsTouch || ownerWindow.getComputedStyle(host).touchAction === 'none'));
156
+ const session = {
157
+ pointerId,
158
+ move,
159
+ cancel: () => finish(),
160
+ takeOver: () => finish(undefined, true),
161
+ };
91
162
  active = session;
92
163
  /** Captures the contact when supported and delivers the first sample. */
93
164
  function acquire() {
94
165
  if (active !== session)
95
166
  return;
96
- if (host.setPointerCapture && Number.isFinite(pointerId)) {
167
+ // Touch pointers on zoom surfaces already have implicit capture. Keep it through takeover.
168
+ if (!ownsTouch && host.setPointerCapture && Number.isFinite(pointerId)) {
97
169
  try {
98
170
  host.setPointerCapture(pointerId);
99
171
  captured = true;
@@ -116,11 +188,11 @@ export function createWebDrag(initialDrag) {
116
188
  if (!last)
117
189
  return true;
118
190
  axisChosen = true;
119
- return drag?.axis === 'horizontal' ? dy > dx : dx > dy;
191
+ return drag.axis === 'horizontal' ? dy > dx : dx > dy;
120
192
  }
121
193
  /** Delivers movement from the owned pointer after scroll negotiation. */
122
194
  function move(sample) {
123
- if (sample.pointerId !== pointerId)
195
+ if (active !== session || sample.pointerId !== pointerId)
124
196
  return;
125
197
  if (shouldYield(sample.clientX, sample.clientY))
126
198
  finish();
@@ -151,7 +223,7 @@ export function createWebDrag(initialDrag) {
151
223
  finish();
152
224
  }
153
225
  /** Removes the active subscriptions before the single terminal callback. */
154
- function finish(released) {
226
+ function finish(released, takenOver = false) {
155
227
  if (active !== session)
156
228
  return;
157
229
  active = null;
@@ -174,6 +246,8 @@ export function createWebDrag(initialDrag) {
174
246
  return;
175
247
  if (released)
176
248
  handlers?.onEnd?.(point(viewport, down, released));
249
+ else if (takenOver)
250
+ (handlers?.onCancel ?? handlers?.onEnd)?.(last);
177
251
  else
178
252
  handlers?.onCancel?.(last);
179
253
  }
@@ -183,34 +257,49 @@ export function createWebDrag(initialDrag) {
183
257
  ownerWindow.addEventListener('pointercancel', cancel, true);
184
258
  ownerWindow.addEventListener('blur', session.cancel);
185
259
  host.addEventListener('lostpointercapture', cancel);
186
- if (touch)
260
+ if (touch && !ownsTouch)
187
261
  ownerWindow.addEventListener('touchmove', preventScroll, { passive: false });
188
262
  if (longPress)
189
263
  timer = setTimeout(acquire, LONG_PRESS_MS);
190
264
  else
191
265
  acquire();
266
+ return session;
192
267
  }
193
268
  return {
194
269
  start,
195
- update(drag) {
196
- if (!drag)
270
+ update(options) {
271
+ const next = surfaceOptions(options);
272
+ if (zoom && !next.zoom) {
273
+ touch?.cancel();
274
+ detachZoom?.();
275
+ }
276
+ if (!next.drag)
197
277
  active?.cancel();
198
- handlers = drag;
278
+ handlers = next.drag;
279
+ zoom = next.zoom;
280
+ attachZoom();
199
281
  },
200
- cancel() {
201
- active?.cancel();
282
+ attach(host) {
283
+ if (attached === host)
284
+ return;
285
+ cancel();
286
+ detachZoom?.();
287
+ attached = host;
288
+ attachZoom();
202
289
  },
290
+ cancel,
203
291
  };
204
292
  }
205
293
  /**
206
294
  * Binds a drag to a native bubbling pointerdown listener.
207
295
  *
208
296
  * @param host - The element that can own the press.
209
- * @param drag - The initial handlers, if the host starts enabled.
297
+ * @param options - The initial handlers, if the host starts enabled.
210
298
  * @returns The binding to update or destroy with the host.
211
299
  */
212
- export function bindWebDrag(host, drag) {
213
- const gesture = createWebDrag(drag);
300
+ export function bindWebDrag(host, options) {
301
+ const gesture = createWebDrag(options);
302
+ gesture.attach(host);
214
303
  const target = host;
215
304
  const pointerDown = (event) => gesture.start(host, event);
216
305
  target.addEventListener('pointerdown', pointerDown);
@@ -218,7 +307,7 @@ export function bindWebDrag(host, drag) {
218
307
  update: gesture.update,
219
308
  destroy() {
220
309
  target.removeEventListener('pointerdown', pointerDown);
221
- gesture.cancel();
310
+ gesture.attach(null);
222
311
  },
223
312
  };
224
313
  }
@@ -1 +1 @@
1
- {"version":3,"file":"web-drag.js","sourceRoot":"","sources":["../src/web-drag.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG,IAAI,OAAO,EAAS,CAAA;AACpC,MAAM,YAAY,GAAG,IAAI,OAAO,EAAW,CAAA;AAC3C,MAAM,QAAQ,GAAG,iFAAiF,CAAA;AAClG,MAAM,aAAa,GAAG,GAAG,CAAA;AACzB,MAAM,UAAU,GAAG,CAAC,CAAA;AAEpB;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAa;IAC3C,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC;AAED,4DAA4D;AAC5D,SAAS,aAAa,CAAC,IAAa,EAAE,MAA0B;IAC9D,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAA;IAClD,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvF,OAAO,IAAI,CAAA;IACb,CAAC;IACD,KAAK,IAAI,KAAK,GAAmB,MAAM,EAAE,KAAK,IAAI,KAAK,KAAK,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QAC9F,IACE,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC;YACvB,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YACvB,CAAC,KAAK,YAAY,WAAW,CAAC,WAAW,IAAI,KAAK,CAAC,iBAAiB,CAAC;YACrE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,WAAW,CAAC,CAAA;YACtD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACtB,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { ElementZoomSample } from '@molecule/app-ui';
2
+ type PinchSample = Extract<ElementZoomSample, {
3
+ kind: 'pinch';
4
+ }>;
5
+ /**
6
+ * Tracks the first two accepted contacts in insertion order.
7
+ *
8
+ * @param frame - The untransformed outer frame.
9
+ * @param owner - The window that receives captured movement and termination.
10
+ * @param callbacks - Ownership transitions and incremental pinch samples.
11
+ * @returns Adds accepted presses or cancels the touch sequence.
12
+ */
13
+ export declare function trackWebPinch(frame: Element, owner: Window, callbacks: {
14
+ takeOver(): void;
15
+ resume(remaining: PointerEvent, event: PointerEvent): void;
16
+ zoom(sample: PinchSample): void;
17
+ close(cancelDrag: boolean): void;
18
+ }): {
19
+ add(event: PointerEvent): void;
20
+ cancel(): void;
21
+ };
22
+ export {};
23
+ //# sourceMappingURL=web-pinch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-pinch.d.ts","sourceRoot":"","sources":["../src/web-pinch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAE3E,KAAK,WAAW,GAAG,OAAO,CAAC,iBAAiB,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAA;AAGhE;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,EACb,SAAS,EAAE;IACT,QAAQ,IAAI,IAAI,CAAA;IAChB,MAAM,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CAAA;IAC1D,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;IAC/B,KAAK,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAAA;CACjC,GACA;IAAE,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAAC,MAAM,IAAI,IAAI,CAAA;CAAE,CA6FpD"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Tracks the first two accepted contacts in insertion order.
3
+ *
4
+ * @param frame - The untransformed outer frame.
5
+ * @param owner - The window that receives captured movement and termination.
6
+ * @param callbacks - Ownership transitions and incremental pinch samples.
7
+ * @returns Adds accepted presses or cancels the touch sequence.
8
+ */
9
+ export function trackWebPinch(frame, owner, callbacks) {
10
+ const contacts = new Map();
11
+ let previous;
12
+ let rebased;
13
+ /** Measures the pair in the current outer frame. */
14
+ function measure(first, second) {
15
+ const { left, top } = frame.getBoundingClientRect();
16
+ return {
17
+ at: {
18
+ x: (first.clientX + second.clientX) / 2 - left,
19
+ y: (first.clientY + second.clientY) / 2 - top,
20
+ },
21
+ distance: Math.hypot(first.clientX - second.clientX, first.clientY - second.clientY),
22
+ };
23
+ }
24
+ /** Delivers pair movement or resumes the rebased drag. */
25
+ function move(event) {
26
+ if (!contacts.has(event.pointerId))
27
+ return;
28
+ contacts.set(event.pointerId, event);
29
+ const [first, second] = contacts.values();
30
+ if (!second && rebased) {
31
+ const origin = rebased;
32
+ rebased = undefined;
33
+ callbacks.resume(origin, event);
34
+ }
35
+ if (!first || !second || (event !== first && event !== second))
36
+ return;
37
+ const next = measure(first, second);
38
+ const from = previous;
39
+ previous = next;
40
+ if (!from || !(from.distance > 0) || !(next.distance > 0))
41
+ return;
42
+ const factor = next.distance / from.distance;
43
+ if (factor !== 1 || from.at.x !== next.at.x || from.at.y !== next.at.y) {
44
+ callbacks.zoom({ kind: 'pinch', from: from.at, at: next.at, factor });
45
+ }
46
+ }
47
+ /** Rebases only when a member of the owned pair lifts. */
48
+ function up(event) {
49
+ const [first, second] = contacts.values();
50
+ if (!contacts.delete(event.pointerId))
51
+ return;
52
+ const [remaining, substitute] = contacts.values();
53
+ if (!remaining)
54
+ finish(false);
55
+ else if (second &&
56
+ (first?.pointerId === event.pointerId || second.pointerId === event.pointerId)) {
57
+ previous = substitute ? measure(remaining, substitute) : undefined;
58
+ rebased = substitute ? undefined : remaining;
59
+ }
60
+ }
61
+ /** Interrupts the sequence if the browser cancels an owned contact. */
62
+ function interrupt(event) {
63
+ if (contacts.has(event.pointerId))
64
+ finish(true);
65
+ }
66
+ /** Cancels the touch sequence through the owner. */
67
+ function cancel() {
68
+ finish(true);
69
+ }
70
+ /** Removes all observers before notifying the owner. */
71
+ function finish(cancelDrag) {
72
+ contacts.clear();
73
+ owner.removeEventListener('pointermove', move, true);
74
+ owner.removeEventListener('pointerup', up, true);
75
+ owner.removeEventListener('pointercancel', interrupt, true);
76
+ owner.removeEventListener('lostpointercapture', interrupt, true);
77
+ owner.removeEventListener('blur', cancel);
78
+ callbacks.close(cancelDrag);
79
+ }
80
+ owner.addEventListener('pointermove', move, true);
81
+ owner.addEventListener('pointerup', up, true);
82
+ owner.addEventListener('pointercancel', interrupt, true);
83
+ owner.addEventListener('lostpointercapture', interrupt, true);
84
+ owner.addEventListener('blur', cancel);
85
+ return {
86
+ add(event) {
87
+ if (contacts.has(event.pointerId))
88
+ return;
89
+ contacts.set(event.pointerId, event);
90
+ if (contacts.size !== 2)
91
+ return;
92
+ const [first, second] = contacts.values();
93
+ if (!first || !second)
94
+ return;
95
+ previous = measure(first, second);
96
+ rebased = undefined;
97
+ callbacks.takeOver();
98
+ },
99
+ cancel,
100
+ };
101
+ }
102
+ //# sourceMappingURL=web-pinch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-pinch.js","sourceRoot":"","sources":["../src/web-pinch.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAc,EACd,KAAa,EACb,SAKC;IAED,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAA;IAChD,IAAI,QAA0B,CAAA;IAC9B,IAAI,OAAiC,CAAA;IAErC,oDAAoD;IACpD,SAAS,OAAO,CAAC,KAAmB,EAAE,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AAQ,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;YACpC,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC;gBAAE,OAAM;YAC/B,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAA;YACzC,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM;gBAAE,OAAM;YAC7B,QAAQ,GAAG,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YACjC,OAAO,GAAG,SAAS,CAAA;YACnB,SAAS,CAAC,QAAQ,EAAE,CAAA;QACtB,CAAC;QACD,MAAM;KACP,CAAA;AACH,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { ElementZoom } from '@molecule/app-ui';
1
2
  /** Called with the direction of one Ctrl-wheel step. */
2
3
  export type WebWheelZoomHandler = (direction: 'in' | 'out') => void;
3
4
  /** The lifecycle of the Ctrl-wheel shortcut on a surface. */
@@ -20,4 +21,13 @@ export interface WebWheelZoomBinding {
20
21
  * @returns The binding to update or destroy with the host.
21
22
  */
22
23
  export declare function bindWebWheelZoom(host: Partial<EventTarget>, initialStep?: WebWheelZoomHandler): WebWheelZoomBinding;
24
+ /**
25
+ * Binds a non-passive focal wheel listener to a gesture surface.
26
+ *
27
+ * @param host - The wheel event host.
28
+ * @param frame - Reads the untransformed outer frame after the host mounts.
29
+ * @param current - Reads the enabled zoom callback when the surface is free to accept a wheel.
30
+ * @returns Removes the wheel listener.
31
+ */
32
+ export declare function bindWebFocalWheelZoom(host: Element, frame: () => Element, current: () => ElementZoom | undefined): () => void;
23
33
  //# sourceMappingURL=web-wheel-zoom.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-wheel-zoom.d.ts","sourceRoot":"","sources":["../src/web-wheel-zoom.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,KAAK,KAAK,IAAI,CAAA;AAEnE,6DAA6D;AAC7D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI,CAAA;IACrD,kCAAkC;IAClC,OAAO,IAAI,IAAI,CAAA;CAChB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,EAC1B,WAAW,CAAC,EAAE,mBAAmB,GAChC,mBAAmB,CA0BrB"}
1
+ {"version":3,"file":"web-wheel-zoom.d.ts","sourceRoot":"","sources":["../src/web-wheel-zoom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,kBAAkB,CAAA;AAItE,wDAAwD;AACxD,MAAM,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,KAAK,KAAK,IAAI,CAAA;AAEnE,6DAA6D;AAC7D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI,CAAA;IACrD,kCAAkC;IAClC,OAAO,IAAI,IAAI,CAAA;CAChB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,EAC1B,WAAW,CAAC,EAAE,mBAAmB,GAChC,mBAAmB,CAmCrB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,MAAM,OAAO,EACpB,OAAO,EAAE,MAAM,WAAW,GAAG,SAAS,GACrC,MAAM,IAAI,CAqCZ"}
@@ -1,3 +1,4 @@
1
+ const claimed = new WeakSet();
1
2
  /**
2
3
  * Listens non-passively for Ctrl-wheel with a finite, nonzero vertical delta.
3
4
  * The handled event is consumed so the browser leaves page zoom alone.
@@ -9,11 +10,17 @@
9
10
  export function bindWebWheelZoom(host, initialStep) {
10
11
  let onStep;
11
12
  const wheel = (event) => {
12
- if (!onStep || !('ctrlKey' in event) || !event.ctrlKey || !('deltaY' in event))
13
+ if (!onStep ||
14
+ claimed.has(event) ||
15
+ event.defaultPrevented ||
16
+ !('ctrlKey' in event) ||
17
+ !event.ctrlKey ||
18
+ !('deltaY' in event))
13
19
  return;
14
20
  const delta = event.deltaY;
15
21
  if (typeof delta !== 'number' || !Number.isFinite(delta) || delta === 0)
16
22
  return;
23
+ claimed.add(event);
17
24
  event.preventDefault();
18
25
  onStep(delta < 0 ? 'in' : 'out');
19
26
  };
@@ -35,4 +42,46 @@ export function bindWebWheelZoom(host, initialStep) {
35
42
  update(initialStep);
36
43
  return { update, destroy: () => update(undefined) };
37
44
  }
45
+ /**
46
+ * Binds a non-passive focal wheel listener to a gesture surface.
47
+ *
48
+ * @param host - The wheel event host.
49
+ * @param frame - Reads the untransformed outer frame after the host mounts.
50
+ * @param current - Reads the enabled zoom callback when the surface is free to accept a wheel.
51
+ * @returns Removes the wheel listener.
52
+ */
53
+ export function bindWebFocalWheelZoom(host, frame, current) {
54
+ const wheel = (event) => {
55
+ const Wheel = host.ownerDocument.defaultView?.WheelEvent;
56
+ const zoom = current();
57
+ if (!zoom ||
58
+ !Wheel ||
59
+ zoom.wheel === 'off' ||
60
+ claimed.has(event) ||
61
+ event.defaultPrevented ||
62
+ !(event instanceof Wheel) ||
63
+ (zoom.wheel === 'ctrl' && !event.ctrlKey))
64
+ return;
65
+ // Read the unit before the delta. Some browsers choose compatibility units at access time.
66
+ const { deltaMode, deltaY, clientX, clientY } = event;
67
+ if ((deltaMode !== 0 && deltaMode !== 1 && deltaMode !== 2) ||
68
+ !Number.isFinite(deltaY) ||
69
+ deltaY === 0 ||
70
+ !Number.isFinite(clientX) ||
71
+ !Number.isFinite(clientY))
72
+ return;
73
+ const { left, top } = frame().getBoundingClientRect();
74
+ const sample = {
75
+ kind: 'wheel',
76
+ at: { x: clientX - left, y: clientY - top },
77
+ deltaY,
78
+ deltaMode,
79
+ };
80
+ claimed.add(event);
81
+ event.preventDefault();
82
+ zoom.onZoom(sample);
83
+ };
84
+ host.addEventListener('wheel', wheel, { passive: false });
85
+ return () => host.removeEventListener('wheel', wheel);
86
+ }
38
87
  //# sourceMappingURL=web-wheel-zoom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-wheel-zoom.js","sourceRoot":"","sources":["../src/web-wheel-zoom.ts"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAA0B,EAC1B,WAAiC;IAEjC,IAAI,MAAuC,CAAA;IAE3C,MAAM,KAAK,GAAG,CAAC,KAAY,EAAQ,EAAE;QACnC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC;YAAE,OAAM;QACtF,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAA;QAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC;YAAE,OAAM;QAC/E,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC,CAAA;IAED;;;;OAIG;IACH,SAAS,MAAM,CAAC,IAAqC;QACnD,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;QAClC,MAAM,GAAG,IAAI,CAAA;QACb,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,mBAAmB;YAAE,OAAM;QAC/D,IAAI,IAAI,IAAI,CAAC,UAAU;YAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EA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C,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;YACxB,MAAM,KAAK,CAAC;YACZ,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;YACzB,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;YAEzB,OAAM;QACR,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,qBAAqB,EAAE,CAAA;QACrD,MAAM,MAAM,GAAsB;YAChC,IAAI,EAAE,OAAO;YACb,EAAE,EAAE,EAAE,CAAC,EAAE,OAAO,GAAG,IAAI,EAAE,CAAC,EAAE,OAAO,GAAG,GAAG,EAAE;YAC3C,MAAM;YACN,SAAS;SACV,CAAA;QACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAClB,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACrB,CAAC,CAAA;IACD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;IACzD,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;AACvD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-pointer-events-dom",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "DOM pointer event handling shared by Molecule web UI kits",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,10 +28,10 @@
28
28
  "license": "Apache-2.0",
29
29
  "author": "Molecule Dev, Inc. (https://molecule.dev)",
30
30
  "peerDependencies": {
31
- "@molecule/app-ui": "^1.9.0"
31
+ "@molecule/app-ui": "^1.16.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@molecule/app-ui": "1.13.0",
34
+ "@molecule/app-ui": "1.16.0",
35
35
  "@types/node": "26.6.5",
36
36
  "jsdom": "31.0.1",
37
37
  "typescript": "6.0.3",