@molecule/app-pointer-events-dom 0.0.1-stage → 1.1.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,17 +3,19 @@ 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-25T14:48:10.019Z
6
+ Generated: 2026-11-25T19:03:26.212Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-pointer-events-dom
10
10
 
11
- DOM pointer drag gestures for the Molecule web UI kits.
11
+ Shared DOM drag, hover, and Ctrl-wheel zoom gestures for the Molecule web UI kits.
12
12
 
13
13
  Use the renderer's drag binding with `ElementDrag` from `@molecule/app-ui`.
14
14
  All web kits share press ownership, pointer capture, touch intent, and
15
15
  cancellation on pointer cancel, lost capture, window blur, and host removal.
16
16
  Use `markPressTarget` for custom controls that must keep their own presses.
17
+ Use `bindWebHover` for one mouse or pen transition per boundary and
18
+ `bindWebWheelZoom` to handle Ctrl-wheel steps on a surface.
17
19
 
18
20
  > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
19
21
  > It is written to be read by coding agents as much as by people, and is generated from this
@@ -93,6 +95,63 @@ interface WebDragBinding {
93
95
  }
94
96
  ```
95
97
 
98
+ #### `WebHoverHandlers`
99
+
100
+ Callbacks for the shared hover transition.
101
+
102
+ ```typescript
103
+ interface WebHoverHandlers {
104
+ /** Runs when a mouse or pen enters the host. */
105
+ onEnter?: (event: MouseEvent) => void
106
+ /** Runs when the hovering mouse or pen leaves the host. */
107
+ onLeave?: (event: MouseEvent) => void
108
+ }
109
+ ```
110
+
111
+ #### `WebHoverBinding`
112
+
113
+ The lifecycle of a hover attached to a DOM element.
114
+
115
+ ```typescript
116
+ interface WebHoverBinding {
117
+ /**
118
+ * Updates the callbacks. Pass undefined to disable hover.
119
+ *
120
+ * @param handlers - The current hover callbacks.
121
+ */
122
+ update(handlers: WebHoverHandlers | undefined): void
123
+ /** Removes the event listeners. */
124
+ destroy(): void
125
+ }
126
+ ```
127
+
128
+ #### `WebWheelZoomBinding`
129
+
130
+ The lifecycle of the Ctrl-wheel shortcut on a surface.
131
+
132
+ ```typescript
133
+ interface WebWheelZoomBinding {
134
+ /**
135
+ * Updates the callback. Pass undefined to leave wheel input to the browser.
136
+ *
137
+ * @param onStep - The current zoom callback.
138
+ */
139
+ update(onStep: WebWheelZoomHandler | undefined): void
140
+ /** Removes the wheel listener. */
141
+ destroy(): void
142
+ }
143
+ ```
144
+
145
+ ### Types
146
+
147
+ #### `WebWheelZoomHandler`
148
+
149
+ Called with the direction of one Ctrl-wheel step.
150
+
151
+ ```typescript
152
+ type WebWheelZoomHandler = (direction: 'in' | 'out') => void
153
+ ```
154
+
96
155
  ### Functions
97
156
 
98
157
  #### `markPressTarget(host)`
@@ -130,6 +189,52 @@ function bindWebDrag(host: HTMLElement | SVGElement, drag?: ElementDrag): WebDra
130
189
 
131
190
  **Returns:** The binding to update or destroy with the host.
132
191
 
192
+ #### `createWebHover()`
193
+
194
+ Creates one enter/leave transition for a host. Touch and its compatibility
195
+ mouse events never hover. A later mouse or pen pointer resumes hover.
196
+
197
+ ```typescript
198
+ function createWebHover(): (entered: boolean, event: HoverEvent) => boolean
199
+ ```
200
+
201
+ **Returns:** A function that reports whether an event changes the host's hover state.
202
+
203
+ #### `bindWebHover(host, initialHandlers)`
204
+
205
+ Binds shared hover to a DOM element. The bubbling over/out events and the
206
+ direct enter/leave events use the same transition. Moving between a host's
207
+ descendants leaves its hover state alone.
208
+
209
+ ```typescript
210
+ function bindWebHover(
211
+ host: HTMLElement | SVGElement,
212
+ initialHandlers?: WebHoverHandlers,
213
+ ): WebHoverBinding
214
+ ```
215
+
216
+ - `host` — The HTML or SVG element that receives hover.
217
+ - `initialHandlers` — The callbacks to use until the first update.
218
+
219
+ **Returns:** The binding to update or destroy with the host.
220
+
221
+ #### `bindWebWheelZoom(host, initialStep)`
222
+
223
+ Listens non-passively for Ctrl-wheel with a finite, nonzero vertical delta.
224
+ The handled event is consumed so the browser leaves page zoom alone.
225
+
226
+ ```typescript
227
+ function bindWebWheelZoom(
228
+ host: Partial<EventTarget>,
229
+ initialStep?: WebWheelZoomHandler,
230
+ ): WebWheelZoomBinding
231
+ ```
232
+
233
+ - `host` — The surface receiving wheel events. A handle without DOM listeners is inert.
234
+ - `initialStep` — The zoom callback to use until the first update.
235
+
236
+ **Returns:** The binding to update or destroy with the host.
237
+
133
238
  ## Injection Notes
134
239
 
135
240
  ### Requirements
package/dist/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  /**
2
- * DOM pointer drag gestures for the Molecule web UI kits.
2
+ * Shared DOM drag, hover, and Ctrl-wheel zoom gestures for the Molecule web UI kits.
3
3
  *
4
4
  * Use the renderer's drag binding with `ElementDrag` from `@molecule/app-ui`.
5
5
  * All web kits share press ownership, pointer capture, touch intent, and
6
6
  * cancellation on pointer cancel, lost capture, window blur, and host removal.
7
7
  * Use `markPressTarget` for custom controls that must keep their own presses.
8
+ * Use `bindWebHover` for one mouse or pen transition per boundary and
9
+ * `bindWebWheelZoom` to handle Ctrl-wheel steps on a surface.
8
10
  *
9
11
  * @example
10
12
  * ```ts
@@ -20,4 +22,6 @@
20
22
  * @module
21
23
  */
22
24
  export * from './web-drag.js';
25
+ export * from './web-hover.js';
26
+ export * from './web-wheel-zoom.js';
23
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,cAAc,eAAe,CAAA"}
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"}
package/dist/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  /**
2
- * DOM pointer drag gestures for the Molecule web UI kits.
2
+ * Shared DOM drag, hover, and Ctrl-wheel zoom gestures for the Molecule web UI kits.
3
3
  *
4
4
  * Use the renderer's drag binding with `ElementDrag` from `@molecule/app-ui`.
5
5
  * All web kits share press ownership, pointer capture, touch intent, and
6
6
  * cancellation on pointer cancel, lost capture, window blur, and host removal.
7
7
  * Use `markPressTarget` for custom controls that must keep their own presses.
8
+ * Use `bindWebHover` for one mouse or pen transition per boundary and
9
+ * `bindWebWheelZoom` to handle Ctrl-wheel steps on a surface.
8
10
  *
9
11
  * @example
10
12
  * ```ts
@@ -20,4 +22,6 @@
20
22
  * @module
21
23
  */
22
24
  export * from './web-drag.js';
25
+ export * from './web-hover.js';
26
+ export * from './web-wheel-zoom.js';
23
27
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,cAAc,eAAe,CAAA"}
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"}
@@ -0,0 +1,42 @@
1
+ /** The fields needed to distinguish pointer and compatibility mouse events. */
2
+ interface HoverEvent {
3
+ readonly type: string;
4
+ readonly pointerType?: string;
5
+ }
6
+ /**
7
+ * Creates one enter/leave transition for a host. Touch and its compatibility
8
+ * mouse events never hover. A later mouse or pen pointer resumes hover.
9
+ *
10
+ * @returns A function that reports whether an event changes the host's hover state.
11
+ */
12
+ export declare function createWebHover(): (entered: boolean, event: HoverEvent) => boolean;
13
+ /** Callbacks for the shared hover transition. */
14
+ export interface WebHoverHandlers {
15
+ /** Runs when a mouse or pen enters the host. */
16
+ onEnter?: (event: MouseEvent) => void;
17
+ /** Runs when the hovering mouse or pen leaves the host. */
18
+ onLeave?: (event: MouseEvent) => void;
19
+ }
20
+ /** The lifecycle of a hover attached to a DOM element. */
21
+ export interface WebHoverBinding {
22
+ /**
23
+ * Updates the callbacks. Pass undefined to disable hover.
24
+ *
25
+ * @param handlers - The current hover callbacks.
26
+ */
27
+ update(handlers: WebHoverHandlers | undefined): void;
28
+ /** Removes the event listeners. */
29
+ destroy(): void;
30
+ }
31
+ /**
32
+ * Binds shared hover to a DOM element. The bubbling over/out events and the
33
+ * direct enter/leave events use the same transition. Moving between a host's
34
+ * descendants leaves its hover state alone.
35
+ *
36
+ * @param host - The HTML or SVG element that receives hover.
37
+ * @param initialHandlers - The callbacks to use until the first update.
38
+ * @returns The binding to update or destroy with the host.
39
+ */
40
+ export declare function bindWebHover(host: HTMLElement | SVGElement, initialHandlers?: WebHoverHandlers): WebHoverBinding;
41
+ export {};
42
+ //# sourceMappingURL=web-hover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-hover.d.ts","sourceRoot":"","sources":["../src/web-hover.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,UAAU,UAAU;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAejF;AAED,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACrC,2DAA2D;IAC3D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;CACtC;AAED,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,GAAG,IAAI,CAAA;IACpD,mCAAmC;IACnC,OAAO,IAAI,IAAI,CAAA;CAChB;AAeD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,WAAW,GAAG,UAAU,EAC9B,eAAe,CAAC,EAAE,gBAAgB,GACjC,eAAe,CAuCjB"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Creates one enter/leave transition for a host. Touch and its compatibility
3
+ * mouse events never hover. A later mouse or pen pointer resumes hover.
4
+ *
5
+ * @returns A function that reports whether an event changes the host's hover state.
6
+ */
7
+ export function createWebHover() {
8
+ let inside = false;
9
+ let fromTouch = false;
10
+ return (entered, event) => {
11
+ if ('pointerType' in event || event.type.startsWith('pointer')) {
12
+ fromTouch = event.pointerType === 'touch';
13
+ if (fromTouch)
14
+ return false;
15
+ }
16
+ else if (fromTouch) {
17
+ return false;
18
+ }
19
+ if (inside === entered)
20
+ return false;
21
+ inside = entered;
22
+ return true;
23
+ };
24
+ }
25
+ const enterEvents = [
26
+ 'pointerover',
27
+ 'pointerenter',
28
+ 'mouseover',
29
+ 'mouseenter',
30
+ ];
31
+ const leaveEvents = [
32
+ 'pointerout',
33
+ 'pointerleave',
34
+ 'mouseout',
35
+ 'mouseleave',
36
+ ];
37
+ /**
38
+ * Binds shared hover to a DOM element. The bubbling over/out events and the
39
+ * direct enter/leave events use the same transition. Moving between a host's
40
+ * descendants leaves its hover state alone.
41
+ *
42
+ * @param host - The HTML or SVG element that receives hover.
43
+ * @param initialHandlers - The callbacks to use until the first update.
44
+ * @returns The binding to update or destroy with the host.
45
+ */
46
+ export function bindWebHover(host, initialHandlers) {
47
+ const target = host;
48
+ const transition = createWebHover();
49
+ let handlers;
50
+ const route = (entered) => (event) => {
51
+ const Node = host.ownerDocument.defaultView?.Node;
52
+ if (Node && event.relatedTarget instanceof Node && host.contains(event.relatedTarget))
53
+ return;
54
+ if (!transition(entered, event))
55
+ return;
56
+ if (entered)
57
+ handlers?.onEnter?.(event);
58
+ else
59
+ handlers?.onLeave?.(event);
60
+ };
61
+ const enter = route(true);
62
+ const leave = route(false);
63
+ /**
64
+ * Updates the callbacks and subscribes only while at least one is active.
65
+ *
66
+ * @param next - The current callbacks.
67
+ */
68
+ function update(next) {
69
+ const wasEnabled = Boolean(handlers?.onEnter || handlers?.onLeave);
70
+ const enabled = Boolean(next?.onEnter || next?.onLeave);
71
+ handlers = next;
72
+ if (enabled === wasEnabled)
73
+ return;
74
+ if (enabled) {
75
+ for (const type of enterEvents)
76
+ target.addEventListener(type, enter);
77
+ for (const type of leaveEvents)
78
+ target.addEventListener(type, leave);
79
+ }
80
+ else {
81
+ for (const type of enterEvents)
82
+ target.removeEventListener(type, enter);
83
+ for (const type of leaveEvents)
84
+ target.removeEventListener(type, leave);
85
+ }
86
+ }
87
+ update(initialHandlers);
88
+ return { update, destroy: () => update(undefined) };
89
+ }
90
+ //# sourceMappingURL=web-hover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-hover.js","sourceRoot":"","sources":["../src/web-hover.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,23 @@
1
+ /** Called with the direction of one Ctrl-wheel step. */
2
+ export type WebWheelZoomHandler = (direction: 'in' | 'out') => void;
3
+ /** The lifecycle of the Ctrl-wheel shortcut on a surface. */
4
+ export interface WebWheelZoomBinding {
5
+ /**
6
+ * Updates the callback. Pass undefined to leave wheel input to the browser.
7
+ *
8
+ * @param onStep - The current zoom callback.
9
+ */
10
+ update(onStep: WebWheelZoomHandler | undefined): void;
11
+ /** Removes the wheel listener. */
12
+ destroy(): void;
13
+ }
14
+ /**
15
+ * Listens non-passively for Ctrl-wheel with a finite, nonzero vertical delta.
16
+ * The handled event is consumed so the browser leaves page zoom alone.
17
+ *
18
+ * @param host - The surface receiving wheel events. A handle without DOM listeners is inert.
19
+ * @param initialStep - The zoom callback to use until the first update.
20
+ * @returns The binding to update or destroy with the host.
21
+ */
22
+ export declare function bindWebWheelZoom(host: Partial<EventTarget>, initialStep?: WebWheelZoomHandler): WebWheelZoomBinding;
23
+ //# sourceMappingURL=web-wheel-zoom.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Listens non-passively for Ctrl-wheel with a finite, nonzero vertical delta.
3
+ * The handled event is consumed so the browser leaves page zoom alone.
4
+ *
5
+ * @param host - The surface receiving wheel events. A handle without DOM listeners is inert.
6
+ * @param initialStep - The zoom callback to use until the first update.
7
+ * @returns The binding to update or destroy with the host.
8
+ */
9
+ export function bindWebWheelZoom(host, initialStep) {
10
+ let onStep;
11
+ const wheel = (event) => {
12
+ if (!onStep || !('ctrlKey' in event) || !event.ctrlKey || !('deltaY' in event))
13
+ return;
14
+ const delta = event.deltaY;
15
+ if (typeof delta !== 'number' || !Number.isFinite(delta) || delta === 0)
16
+ return;
17
+ event.preventDefault();
18
+ onStep(delta < 0 ? 'in' : 'out');
19
+ };
20
+ /**
21
+ * Updates the callback and attaches or removes the listener when enabled changes.
22
+ *
23
+ * @param next - The current zoom callback.
24
+ */
25
+ function update(next) {
26
+ const wasEnabled = Boolean(onStep);
27
+ onStep = next;
28
+ if (!host.addEventListener || !host.removeEventListener)
29
+ return;
30
+ if (next && !wasEnabled)
31
+ host.addEventListener('wheel', wheel, { passive: false });
32
+ else if (!next && wasEnabled)
33
+ host.removeEventListener('wheel', wheel);
34
+ }
35
+ update(initialStep);
36
+ return { update, destroy: () => update(undefined) };
37
+ }
38
+ //# sourceMappingURL=web-wheel-zoom.js.map
@@ -0,0 +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,EAAE,CAAC,CAAA;aAC7E,IAAI,CAAC,IAAI,IAAI,UAAU;YAAE,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACxE,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,CAAA;IACnB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAA;AACrD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-pointer-events-dom",
3
- "version": "0.0.1-stage",
3
+ "version": "1.1.0",
4
4
  "description": "DOM pointer event handling shared by Molecule web UI kits",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "@molecule/app-ui": "^1.9.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@molecule/app-ui": "1.9.0",
34
+ "@molecule/app-ui": "1.13.0",
35
35
  "@types/node": "26.6.5",
36
36
  "jsdom": "31.0.1",
37
37
  "typescript": "6.0.3",