@trendr/core 0.4.9 → 0.4.10
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 +4 -4
- package/package.json +1 -1
- package/src/ansi.js +2 -2
- package/src/input.js +2 -0
package/README.md
CHANGED
|
@@ -305,15 +305,15 @@ const { status, data } = useAsync(fetchUsers, { immediate: true })
|
|
|
305
305
|
|
|
306
306
|
```jsx
|
|
307
307
|
useMouse((event) => {
|
|
308
|
-
// event.action: 'press' | 'release' | 'drag' | 'scroll'
|
|
309
|
-
// event.button: 'left' | 'middle' | 'right' (press/release only)
|
|
310
|
-
// event.direction: 'up' | 'down' (scroll only)
|
|
308
|
+
// event.action: 'press' | 'release' | 'drag' | 'move' | 'scroll'
|
|
309
|
+
// event.button: 'left' | 'middle' | 'right' (press/release/drag only)
|
|
310
|
+
// event.direction: 'up' | 'down' | 'left' | 'right' (scroll only)
|
|
311
311
|
// event.x, event.y: 0-based terminal coordinates
|
|
312
312
|
// event.stopPropagation(): prevent other handlers from receiving this event
|
|
313
313
|
})
|
|
314
314
|
```
|
|
315
315
|
|
|
316
|
-
Mouse is enabled automatically. Built-in components support click, scroll wheel, and scrollbar dragging.
|
|
316
|
+
Mouse is enabled automatically. Passive pointer movement is reported as `move`, so it can be combined with `useLayout()` to derive hover state. Built-in components support click, scroll wheel, and scrollbar dragging.
|
|
317
317
|
|
|
318
318
|
### useStdout
|
|
319
319
|
|
package/package.json
CHANGED
package/src/ansi.js
CHANGED
|
@@ -19,8 +19,8 @@ export const sgrReset = `${ESC}0m`
|
|
|
19
19
|
export const setTitle = (title) => `\x1b]2;${title}\x07`
|
|
20
20
|
export const osc52Copy = (text) => `\x1b]52;c;${Buffer.from(text, 'utf8').toString('base64')}\x07`
|
|
21
21
|
|
|
22
|
-
export const enableMouse = `${ESC}?
|
|
23
|
-
export const disableMouse = `${ESC}?
|
|
22
|
+
export const enableMouse = `${ESC}?1003h${ESC}?1006h`
|
|
23
|
+
export const disableMouse = `${ESC}?1003l${ESC}?1006l`
|
|
24
24
|
|
|
25
25
|
export const BOLD = 1
|
|
26
26
|
export const DIM = 2
|
package/src/input.js
CHANGED
|
@@ -53,6 +53,8 @@ export function parseMouse(raw) {
|
|
|
53
53
|
return { type: 'mouse', action: 'scroll', direction, x, y }
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
if (motion && button === 3) return { type: 'mouse', action: 'move', x, y }
|
|
57
|
+
|
|
56
58
|
const buttonName = extended
|
|
57
59
|
? (button === 0 ? 'back' : button === 1 ? 'forward' : button === 2 ? 'button10' : 'button11')
|
|
58
60
|
: (button === 0 ? 'left' : button === 1 ? 'middle' : 'right')
|