@hanzo/ui 8.27.85 → 8.27.87

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 (77) hide show
  1. package/dist/auth/session.cjs +47 -2
  2. package/dist/auth/session.d.ts +2 -0
  3. package/dist/auth/session.d.ts.map +1 -1
  4. package/dist/auth/session.js +45 -1
  5. package/dist/auth/session.js.map +1 -1
  6. package/dist/backends/gui/choice.cjs +4 -0
  7. package/dist/backends/gui/choice.d.ts +3 -0
  8. package/dist/backends/gui/choice.d.ts.map +1 -1
  9. package/dist/backends/gui/choice.js +3 -0
  10. package/dist/backends/gui/choice.js.map +1 -1
  11. package/dist/backends/gui/code-editor.cjs +13 -13
  12. package/dist/backends/gui/code-editor.d.ts +4 -4
  13. package/dist/backends/gui/code-editor.d.ts.map +1 -1
  14. package/dist/backends/gui/code-editor.js +14 -14
  15. package/dist/backends/gui/code-editor.js.map +1 -1
  16. package/dist/backends/gui/grip.cjs +128 -81
  17. package/dist/backends/gui/grip.d.ts +48 -25
  18. package/dist/backends/gui/grip.d.ts.map +1 -1
  19. package/dist/backends/gui/grip.js +129 -81
  20. package/dist/backends/gui/grip.js.map +1 -1
  21. package/dist/backends/gui/index.cjs +12 -7
  22. package/dist/backends/gui/index.d.ts +3 -1
  23. package/dist/backends/gui/index.d.ts.map +1 -1
  24. package/dist/backends/gui/index.js +3 -1
  25. package/dist/backends/gui/index.js.map +1 -1
  26. package/dist/backends/gui/json-tree.cjs +14 -16
  27. package/dist/backends/gui/json-tree.d.ts +3 -3
  28. package/dist/backends/gui/json-tree.d.ts.map +1 -1
  29. package/dist/backends/gui/json-tree.js +15 -17
  30. package/dist/backends/gui/json-tree.js.map +1 -1
  31. package/dist/backends/gui/span.cjs +54 -0
  32. package/dist/backends/gui/span.d.ts +15 -0
  33. package/dist/backends/gui/span.d.ts.map +1 -0
  34. package/dist/backends/gui/span.js +52 -0
  35. package/dist/backends/gui/span.js.map +1 -0
  36. package/dist/gallery.html +9 -4
  37. package/dist/index.cjs +8 -5
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/index.node.cjs +8 -5
  43. package/dist/index.node.js +1 -1
  44. package/dist/onboarding/Checkout.cjs +40 -23
  45. package/dist/onboarding/Checkout.d.ts +1 -0
  46. package/dist/onboarding/Checkout.d.ts.map +1 -1
  47. package/dist/onboarding/Checkout.js +44 -27
  48. package/dist/onboarding/Checkout.js.map +1 -1
  49. package/dist/onboarding/Onboarding.cjs +2 -3
  50. package/dist/onboarding/Onboarding.d.ts +3 -2
  51. package/dist/onboarding/Onboarding.d.ts.map +1 -1
  52. package/dist/onboarding/Onboarding.js +2 -3
  53. package/dist/onboarding/Onboarding.js.map +1 -1
  54. package/dist/onboarding/api.cjs +47 -5
  55. package/dist/onboarding/api.d.ts +2 -1
  56. package/dist/onboarding/api.d.ts.map +1 -1
  57. package/dist/onboarding/api.js +47 -6
  58. package/dist/onboarding/api.js.map +1 -1
  59. package/dist/onboarding/attempt.cjs +3 -3
  60. package/dist/onboarding/attempt.js +3 -3
  61. package/dist/onboarding/attempt.js.map +1 -1
  62. package/dist/onboarding/screens.cjs +1 -1
  63. package/dist/onboarding/screens.d.ts.map +1 -1
  64. package/dist/onboarding/screens.js +2 -2
  65. package/dist/onboarding/screens.js.map +1 -1
  66. package/dist/primitives/Grip.cjs +8 -0
  67. package/dist/primitives/Grip.d.ts +2 -0
  68. package/dist/primitives/Grip.d.ts.map +1 -0
  69. package/dist/primitives/Grip.js +5 -0
  70. package/dist/primitives/Grip.js.map +1 -0
  71. package/dist/primitives/useSpan.cjs +8 -0
  72. package/dist/primitives/useSpan.d.ts +2 -0
  73. package/dist/primitives/useSpan.d.ts.map +1 -0
  74. package/dist/primitives/useSpan.js +5 -0
  75. package/dist/primitives/useSpan.js.map +1 -0
  76. package/dist/styles.css +5 -0
  77. package/package.json +1 -1
@@ -34,99 +34,146 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.useGrip = useGrip;
38
37
  exports.Grip = Grip;
39
38
  const jsx_runtime_1 = require("react/jsx-runtime");
40
39
  /**
41
- * The grip under a pane that resizes it, shared by CodeEditor and JsonTree.
40
+ * Grip — a box's free edge, which is also how big the box is: a separator a
41
+ * person drags, or moves with the arrow keys, to size the box beside it. The one
42
+ * resizer: a sidebar, an aside, a split between two panes, and an editor's
43
+ * height all use it.
42
44
  *
43
- * The footer is the drag target and the knob is the separator a keyboard and a
44
- * screen reader find. A drag, or ArrowUp / ArrowDown on the knob, sets a height
45
- * of the reader's own, as tall as they like; a double-click on the footer hands
46
- * the height back to the content. `useGrip` owns that height; `Grip` draws the
47
- * knob.
45
+ * side the edge the box is pinned to. `left` grows rightwards (a sidebar,
46
+ * the first pane of a split), `right` grows leftwards (an aside, a
47
+ * drawer), `top` grows downwards (an editor, a tree). One control,
48
+ * the arithmetic reflected.
49
+ * span the box's size now, px, for assistive tech; `floor` and `ceil`
50
+ * bound it.
51
+ * onSpan the size while it moves, at most once a frame.
52
+ * onKeep the size it settled on: a drag let go, a key, a double-click.
53
+ * onShut when given, a drag pulled well past the floor, or a key pressed at
54
+ * it, puts the box away (a sidebar snaps to its icons); absent, the
55
+ * floor holds.
56
+ * reset the size a double-click returns to; `onReset` instead hands the
57
+ * size back to the box (an editor that follows its text).
58
+ *
59
+ * Keys: the arrows step 8px (32px with Shift), Home and End go to the floor and
60
+ * the ceiling. Pointer events, so a mouse, a trackpad, a touchscreen and a pen
61
+ * are one path, with the pointer captured: a drag that outruns the handle keeps
62
+ * sizing. A drag and a key both start from the box as drawn, so the edge never
63
+ * jumps to the cursor and a box that follows its content steps from where it is.
64
+ *
65
+ * It sits inside the box, absolutely, on the free edge; the rest of its props
66
+ * place it elsewhere and win. The line is drawn only while a person reaches for
67
+ * it: under the pointer, while it moves, and for a keyboard's focus, which it
68
+ * draws instead of an outline.
69
+ *
70
+ * Moved here from @hanzo/build, where hanzo.ai's sidebar and asides used it.
48
71
  */
49
72
  const gui_1 = require("@hanzo/gui");
50
- const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
51
73
  const React = __importStar(require("react"));
52
- const slot_1 = require("./slot.cjs");
53
- /** How far one ArrowUp / ArrowDown on the knob moves the height. */
54
- const STEP = 24;
55
- /** The separator's stated maximum, in px: the drag itself has none. */
56
- const CEILING = 4096;
57
- function useGrip({ enabled, min, measure, initial = null, onChange }) {
58
- const grip = React.useRef(null);
59
- const knob = React.useRef(null);
60
- const [height, setHeight] = React.useState(initial);
61
- const latest = React.useRef({ measure, onChange });
62
- latest.current = { measure, onChange };
63
- const set = React.useCallback((next) => {
64
- setHeight(next);
65
- latest.current.onChange?.(next);
66
- }, []);
67
- React.useEffect(() => {
68
- const el = grip.current;
69
- const handle = knob.current;
70
- if (!el || !handle || !enabled)
74
+ /** A key's step, px; with Shift, the long one. */
75
+ const STEP = 8;
76
+ const LONG = 32;
77
+ /** How far past the floor a drag is pulled before it shuts the box, px: a deliberate pull, not a twitch. */
78
+ const SLACK = 48;
79
+ /** The grab band's thickness, px; the line drawn inside it is 2. */
80
+ const BAND = 8;
81
+ function Grip({ side, span, floor, ceil, reset, onReset, onSpan, onKeep, onShut, label, ...rest }) {
82
+ const tall = side === 'top';
83
+ /** +1 when the pointer moving away from the pinned edge grows the box. */
84
+ const grows = side === 'right' ? -1 : 1;
85
+ // The pinned edge in client coordinates, taken as the drag begins.
86
+ const held = React.useRef(0);
87
+ // Whether a press holds the pointer and whether it has moved since, the size it
88
+ // last asked for, and the frame that will draw it. A press that never moves
89
+ // keeps nothing.
90
+ const drag = React.useRef('none');
91
+ const want = React.useRef(span);
92
+ const frame = React.useRef(0);
93
+ const [hovered, setHovered] = React.useState(false);
94
+ const [keyed, setKeyed] = React.useState(false);
95
+ const [moving, setMoving] = React.useState(false);
96
+ React.useEffect(() => () => cancelAnimationFrame(frame.current), []);
97
+ const clamp = (n) => Math.round(Math.min(ceil, Math.max(floor, n)));
98
+ const along = (e) => (tall ? e.clientY : e.clientX);
99
+ /** The box as drawn, read off the element the grip sits in. */
100
+ const drawn = (el) => {
101
+ const box = el?.parentElement?.getBoundingClientRect();
102
+ return box ? (tall ? box.height : box.width) : span;
103
+ };
104
+ const settle = (n) => {
105
+ onSpan(n);
106
+ onKeep?.(n);
107
+ };
108
+ const stop = () => {
109
+ drag.current = 'none';
110
+ cancelAnimationFrame(frame.current);
111
+ frame.current = 0;
112
+ setMoving(false);
113
+ };
114
+ const end = () => {
115
+ if (drag.current === 'none')
71
116
  return;
72
- let pointer = -1;
73
- let startY = 0;
74
- let startH = 0;
75
- const down = (e) => {
117
+ const moved = drag.current === 'moved';
118
+ stop();
119
+ if (moved)
120
+ settle(want.current);
121
+ };
122
+ const wider = side === 'left' ? 'ArrowRight' : side === 'right' ? 'ArrowLeft' : 'ArrowDown';
123
+ const narrower = side === 'left' ? 'ArrowLeft' : side === 'right' ? 'ArrowRight' : 'ArrowUp';
124
+ const edge = tall
125
+ ? { l: 0, r: 0, b: 0, height: BAND, justify: 'center' }
126
+ : { t: 0, b: 0, width: BAND, items: 'center', ...(side === 'left' ? { r: 0 } : { l: 0 }) };
127
+ return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { role: "separator", "aria-orientation": tall ? 'horizontal' : 'vertical', "aria-label": label, "aria-valuenow": Math.round(span), "aria-valuemin": floor, "aria-valuemax": ceil, tabIndex: 0, "data-slot": "grip", "data-side": side, "data-moving": moving ? '' : undefined, position: "absolute", ...edge, z: 10, cursor: tall ? 'row-resize' : 'col-resize', outlineWidth: 0, focusVisibleStyle: { outlineWidth: 0 }, style: { touchAction: 'none' }, onPointerEnter: () => setHovered(true), onPointerLeave: () => setHovered(false),
128
+ // The line is the focus ring, drawn for a keyboard's focus and not a pointer's.
129
+ onFocus: (e) => setKeyed(e.currentTarget.matches(':focus-visible')), onBlur: () => setKeyed(false), onPointerDown: (e) => {
76
130
  if (e.button !== 0)
77
131
  return;
132
+ // No text selection starts under a drag.
78
133
  e.preventDefault();
79
- pointer = e.pointerId;
80
- startY = e.clientY;
81
- startH = latest.current.measure();
82
- el.setPointerCapture?.(pointer);
83
- };
84
- const move = (e) => {
85
- if (e.pointerId !== pointer)
134
+ e.currentTarget.setPointerCapture?.(e.pointerId);
135
+ const now = drawn(e.currentTarget);
136
+ held.current = along(e) - grows * now;
137
+ want.current = clamp(now);
138
+ drag.current = 'held';
139
+ setMoving(true);
140
+ }, onPointerMove: (e) => {
141
+ if (drag.current === 'none')
86
142
  return;
87
- set(Math.max(min, Math.round(startH + e.clientY - startY)));
88
- };
89
- const up = (e) => {
90
- if (e.pointerId !== pointer)
143
+ drag.current = 'moved';
144
+ const pulled = grows * (along(e) - held.current);
145
+ if (onShut && pulled < floor - SLACK) {
146
+ stop();
147
+ e.currentTarget.releasePointerCapture?.(e.pointerId);
148
+ onShut();
91
149
  return;
92
- el.releasePointerCapture?.(pointer);
93
- pointer = -1;
94
- };
95
- const key = (e) => {
96
- if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown')
150
+ }
151
+ want.current = clamp(pulled);
152
+ if (frame.current)
97
153
  return;
98
- e.preventDefault();
99
- set(Math.max(min, Math.round(latest.current.measure() + (e.key === 'ArrowDown' ? STEP : -STEP))));
100
- };
101
- const reset = () => set(null);
102
- el.addEventListener('pointerdown', down);
103
- el.addEventListener('pointermove', move);
104
- el.addEventListener('pointerup', up);
105
- el.addEventListener('pointercancel', up);
106
- el.addEventListener('dblclick', reset);
107
- handle.addEventListener('keydown', key);
108
- return () => {
109
- el.removeEventListener('pointerdown', down);
110
- el.removeEventListener('pointermove', move);
111
- el.removeEventListener('pointerup', up);
112
- el.removeEventListener('pointercancel', up);
113
- el.removeEventListener('dblclick', reset);
114
- handle.removeEventListener('keydown', key);
115
- };
116
- }, [enabled, min, set]);
117
- return { grip, knob, height };
118
- }
119
- /** The knob: a separator that names what it resizes and says how tall it is. */
120
- function Grip({ knob, name, label, min, height, }) {
121
- return ((0, jsx_runtime_1.jsx)(gui_1.XStack, { ref: knob, ...(0, slot_1.slot)(name), ...{
122
- role: 'separator',
123
- 'aria-orientation': 'horizontal',
124
- 'aria-label': `Resize ${label}`,
125
- 'aria-valuemin': min,
126
- // A drag has no ceiling; this stands in for "as tall as you like".
127
- 'aria-valuemax': CEILING,
128
- 'aria-valuenow': height ?? min,
129
- 'aria-valuetext': height === null ? 'Fits its content' : `${height} pixels`,
130
- tabIndex: 0,
131
- }, rounded: "$2", p: "$1", focusVisibleStyle: { bg: '$hover' }, children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.GripHorizontal, { size: 14, color: "$soft" }) }));
154
+ frame.current = requestAnimationFrame(() => {
155
+ frame.current = 0;
156
+ onSpan(want.current);
157
+ });
158
+ },
159
+ // A drag ends when the pointer is let go: lifted, or taken by the browser.
160
+ onPointerUp: end, onPointerCancel: end, onDoubleClick: () => (onReset ? onReset() : settle(clamp(reset ?? span))), onKeyDown: (e) => {
161
+ const step = e.shiftKey ? LONG : STEP;
162
+ const now = drawn(e.currentTarget);
163
+ const to = e.key === wider
164
+ ? now + step
165
+ : e.key === narrower
166
+ ? now - step
167
+ : e.key === 'Home'
168
+ ? floor
169
+ : e.key === 'End'
170
+ ? ceil
171
+ : null;
172
+ if (to === null)
173
+ return;
174
+ e.preventDefault?.();
175
+ if (onShut && to < floor)
176
+ return onShut();
177
+ settle(clamp(to));
178
+ }, ...rest, children: (0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(tall ? { height: 2, width: '100%' } : { width: 2, height: '100%' }), rounded: 1, bg: keyed || moving ? '$outlineColor' : hovered ? '$rim' : 'transparent', pointerEvents: "none" }) }));
132
179
  }
@@ -1,28 +1,51 @@
1
+ /**
2
+ * Grip — a box's free edge, which is also how big the box is: a separator a
3
+ * person drags, or moves with the arrow keys, to size the box beside it. The one
4
+ * resizer: a sidebar, an aside, a split between two panes, and an editor's
5
+ * height all use it.
6
+ *
7
+ * side the edge the box is pinned to. `left` grows rightwards (a sidebar,
8
+ * the first pane of a split), `right` grows leftwards (an aside, a
9
+ * drawer), `top` grows downwards (an editor, a tree). One control,
10
+ * the arithmetic reflected.
11
+ * span the box's size now, px, for assistive tech; `floor` and `ceil`
12
+ * bound it.
13
+ * onSpan the size while it moves, at most once a frame.
14
+ * onKeep the size it settled on: a drag let go, a key, a double-click.
15
+ * onShut when given, a drag pulled well past the floor, or a key pressed at
16
+ * it, puts the box away (a sidebar snaps to its icons); absent, the
17
+ * floor holds.
18
+ * reset the size a double-click returns to; `onReset` instead hands the
19
+ * size back to the box (an editor that follows its text).
20
+ *
21
+ * Keys: the arrows step 8px (32px with Shift), Home and End go to the floor and
22
+ * the ceiling. Pointer events, so a mouse, a trackpad, a touchscreen and a pen
23
+ * are one path, with the pointer captured: a drag that outruns the handle keeps
24
+ * sizing. A drag and a key both start from the box as drawn, so the edge never
25
+ * jumps to the cursor and a box that follows its content steps from where it is.
26
+ *
27
+ * It sits inside the box, absolutely, on the free edge; the rest of its props
28
+ * place it elsewhere and win. The line is drawn only while a person reaches for
29
+ * it: under the pointer, while it moves, and for a keyboard's focus, which it
30
+ * draws instead of an outline.
31
+ *
32
+ * Moved here from @hanzo/build, where hanzo.ai's sidebar and asides used it.
33
+ */
34
+ import { type YStackProps } from '@hanzo/gui';
1
35
  import * as React from 'react';
2
- export interface GripOptions {
3
- enabled: boolean;
4
- /** The shortest a drag makes the pane, in px. */
5
- min: number;
6
- /** The pane's height now, read when a drag or a key starts. */
7
- measure: () => number;
8
- /** A height to start from, as `onChange` last reported it. */
9
- initial?: number | null;
10
- /** Every height the reader sets, and `null` when a double-click hands it back. */
11
- onChange?: (height: number | null) => void;
12
- }
13
- export declare function useGrip({ enabled, min, measure, initial, onChange }: GripOptions): {
14
- grip: React.RefObject<HTMLElement | null>;
15
- knob: React.RefObject<HTMLElement | null>;
16
- height: number | null;
17
- };
18
- /** The knob: a separator that names what it resizes and says how tall it is. */
19
- export declare function Grip({ knob, name, label, min, height, }: {
20
- knob: React.RefObject<HTMLElement | null>;
21
- /** Its `data-slot`. */
22
- name: string;
23
- /** What it resizes, for "Resize <label>". */
36
+ export type GripSide = 'left' | 'right' | 'top';
37
+ export interface GripProps extends Omit<YStackProps, 'children'> {
38
+ side: GripSide;
39
+ span: number;
40
+ floor: number;
41
+ ceil: number;
42
+ reset?: number;
43
+ onReset?: () => void;
44
+ onSpan: (n: number) => void;
45
+ onKeep?: (n: number) => void;
46
+ onShut?: () => void;
47
+ /** The separator's accessible name: "Resize sidebar", "Resize Input". */
24
48
  label: string;
25
- min: number;
26
- height: number | null;
27
- }): React.JSX.Element;
49
+ }
50
+ export declare function Grip({ side, span, floor, ceil, reset, onReset, onSpan, onKeep, onShut, label, ...rest }: GripProps): React.JSX.Element;
28
51
  //# sourceMappingURL=grip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grip.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/grip.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAS9B,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAA;IACX,+DAA+D;IAC/D,OAAO,EAAE,MAAM,MAAM,CAAA;IACrB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;CAC3C;AAED,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAc,EAAE,QAAQ,EAAE,EAAE,WAAW;;;;EA2DvF;AAED,gFAAgF;AAChF,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,GAAG,EACH,MAAM,GACP,EAAE;IACD,IAAI,EAAE,KAA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x as _jsx } from "react/jsx-runtime";
3
3
  /**
4
- * The grip under a pane that resizes it, shared by CodeEditor and JsonTree.
4
+ * Grip — a box's free edge, which is also how big the box is: a separator a
5
+ * person drags, or moves with the arrow keys, to size the box beside it. The one
6
+ * resizer: a sidebar, an aside, a split between two panes, and an editor's
7
+ * height all use it.
5
8
  *
6
- * The footer is the drag target and the knob is the separator a keyboard and a
7
- * screen reader find. A drag, or ArrowUp / ArrowDown on the knob, sets a height
8
- * of the reader's own, as tall as they like; a double-click on the footer hands
9
- * the height back to the content. `useGrip` owns that height; `Grip` draws the
10
- * knob.
9
+ * side the edge the box is pinned to. `left` grows rightwards (a sidebar,
10
+ * the first pane of a split), `right` grows leftwards (an aside, a
11
+ * drawer), `top` grows downwards (an editor, a tree). One control,
12
+ * the arithmetic reflected.
13
+ * span the box's size now, px, for assistive tech; `floor` and `ceil`
14
+ * bound it.
15
+ * onSpan the size while it moves, at most once a frame.
16
+ * onKeep the size it settled on: a drag let go, a key, a double-click.
17
+ * onShut when given, a drag pulled well past the floor, or a key pressed at
18
+ * it, puts the box away (a sidebar snaps to its icons); absent, the
19
+ * floor holds.
20
+ * reset the size a double-click returns to; `onReset` instead hands the
21
+ * size back to the box (an editor that follows its text).
22
+ *
23
+ * Keys: the arrows step 8px (32px with Shift), Home and End go to the floor and
24
+ * the ceiling. Pointer events, so a mouse, a trackpad, a touchscreen and a pen
25
+ * are one path, with the pointer captured: a drag that outruns the handle keeps
26
+ * sizing. A drag and a key both start from the box as drawn, so the edge never
27
+ * jumps to the cursor and a box that follows its content steps from where it is.
28
+ *
29
+ * It sits inside the box, absolutely, on the free edge; the rest of its props
30
+ * place it elsewhere and win. The line is drawn only while a person reaches for
31
+ * it: under the pointer, while it moves, and for a keyboard's focus, which it
32
+ * draws instead of an outline.
33
+ *
34
+ * Moved here from @hanzo/build, where hanzo.ai's sidebar and asides used it.
11
35
  */
12
- import { XStack } from '@hanzo/gui';
13
- import { GripHorizontal } from '@hanzogui/lucide-icons-2';
36
+ import { YStack } from '@hanzo/gui';
14
37
  import * as React from 'react';
15
- import { slot } from './slot.js';
16
- /** How far one ArrowUp / ArrowDown on the knob moves the height. */
17
- const STEP = 24;
18
- /** The separator's stated maximum, in px: the drag itself has none. */
19
- const CEILING = 4096;
20
- export function useGrip({ enabled, min, measure, initial = null, onChange }) {
21
- const grip = React.useRef(null);
22
- const knob = React.useRef(null);
23
- const [height, setHeight] = React.useState(initial);
24
- const latest = React.useRef({ measure, onChange });
25
- latest.current = { measure, onChange };
26
- const set = React.useCallback((next) => {
27
- setHeight(next);
28
- latest.current.onChange?.(next);
29
- }, []);
30
- React.useEffect(() => {
31
- const el = grip.current;
32
- const handle = knob.current;
33
- if (!el || !handle || !enabled)
38
+ /** A key's step, px; with Shift, the long one. */
39
+ const STEP = 8;
40
+ const LONG = 32;
41
+ /** How far past the floor a drag is pulled before it shuts the box, px: a deliberate pull, not a twitch. */
42
+ const SLACK = 48;
43
+ /** The grab band's thickness, px; the line drawn inside it is 2. */
44
+ const BAND = 8;
45
+ export function Grip({ side, span, floor, ceil, reset, onReset, onSpan, onKeep, onShut, label, ...rest }) {
46
+ const tall = side === 'top';
47
+ /** +1 when the pointer moving away from the pinned edge grows the box. */
48
+ const grows = side === 'right' ? -1 : 1;
49
+ // The pinned edge in client coordinates, taken as the drag begins.
50
+ const held = React.useRef(0);
51
+ // Whether a press holds the pointer and whether it has moved since, the size it
52
+ // last asked for, and the frame that will draw it. A press that never moves
53
+ // keeps nothing.
54
+ const drag = React.useRef('none');
55
+ const want = React.useRef(span);
56
+ const frame = React.useRef(0);
57
+ const [hovered, setHovered] = React.useState(false);
58
+ const [keyed, setKeyed] = React.useState(false);
59
+ const [moving, setMoving] = React.useState(false);
60
+ React.useEffect(() => () => cancelAnimationFrame(frame.current), []);
61
+ const clamp = (n) => Math.round(Math.min(ceil, Math.max(floor, n)));
62
+ const along = (e) => (tall ? e.clientY : e.clientX);
63
+ /** The box as drawn, read off the element the grip sits in. */
64
+ const drawn = (el) => {
65
+ const box = el?.parentElement?.getBoundingClientRect();
66
+ return box ? (tall ? box.height : box.width) : span;
67
+ };
68
+ const settle = (n) => {
69
+ onSpan(n);
70
+ onKeep?.(n);
71
+ };
72
+ const stop = () => {
73
+ drag.current = 'none';
74
+ cancelAnimationFrame(frame.current);
75
+ frame.current = 0;
76
+ setMoving(false);
77
+ };
78
+ const end = () => {
79
+ if (drag.current === 'none')
34
80
  return;
35
- let pointer = -1;
36
- let startY = 0;
37
- let startH = 0;
38
- const down = (e) => {
81
+ const moved = drag.current === 'moved';
82
+ stop();
83
+ if (moved)
84
+ settle(want.current);
85
+ };
86
+ const wider = side === 'left' ? 'ArrowRight' : side === 'right' ? 'ArrowLeft' : 'ArrowDown';
87
+ const narrower = side === 'left' ? 'ArrowLeft' : side === 'right' ? 'ArrowRight' : 'ArrowUp';
88
+ const edge = tall
89
+ ? { l: 0, r: 0, b: 0, height: BAND, justify: 'center' }
90
+ : { t: 0, b: 0, width: BAND, items: 'center', ...(side === 'left' ? { r: 0 } : { l: 0 }) };
91
+ return (_jsx(YStack, { role: "separator", "aria-orientation": tall ? 'horizontal' : 'vertical', "aria-label": label, "aria-valuenow": Math.round(span), "aria-valuemin": floor, "aria-valuemax": ceil, tabIndex: 0, "data-slot": "grip", "data-side": side, "data-moving": moving ? '' : undefined, position: "absolute", ...edge, z: 10, cursor: tall ? 'row-resize' : 'col-resize', outlineWidth: 0, focusVisibleStyle: { outlineWidth: 0 }, style: { touchAction: 'none' }, onPointerEnter: () => setHovered(true), onPointerLeave: () => setHovered(false),
92
+ // The line is the focus ring, drawn for a keyboard's focus and not a pointer's.
93
+ onFocus: (e) => setKeyed(e.currentTarget.matches(':focus-visible')), onBlur: () => setKeyed(false), onPointerDown: (e) => {
39
94
  if (e.button !== 0)
40
95
  return;
96
+ // No text selection starts under a drag.
41
97
  e.preventDefault();
42
- pointer = e.pointerId;
43
- startY = e.clientY;
44
- startH = latest.current.measure();
45
- el.setPointerCapture?.(pointer);
46
- };
47
- const move = (e) => {
48
- if (e.pointerId !== pointer)
98
+ e.currentTarget.setPointerCapture?.(e.pointerId);
99
+ const now = drawn(e.currentTarget);
100
+ held.current = along(e) - grows * now;
101
+ want.current = clamp(now);
102
+ drag.current = 'held';
103
+ setMoving(true);
104
+ }, onPointerMove: (e) => {
105
+ if (drag.current === 'none')
49
106
  return;
50
- set(Math.max(min, Math.round(startH + e.clientY - startY)));
51
- };
52
- const up = (e) => {
53
- if (e.pointerId !== pointer)
107
+ drag.current = 'moved';
108
+ const pulled = grows * (along(e) - held.current);
109
+ if (onShut && pulled < floor - SLACK) {
110
+ stop();
111
+ e.currentTarget.releasePointerCapture?.(e.pointerId);
112
+ onShut();
54
113
  return;
55
- el.releasePointerCapture?.(pointer);
56
- pointer = -1;
57
- };
58
- const key = (e) => {
59
- if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown')
114
+ }
115
+ want.current = clamp(pulled);
116
+ if (frame.current)
60
117
  return;
61
- e.preventDefault();
62
- set(Math.max(min, Math.round(latest.current.measure() + (e.key === 'ArrowDown' ? STEP : -STEP))));
63
- };
64
- const reset = () => set(null);
65
- el.addEventListener('pointerdown', down);
66
- el.addEventListener('pointermove', move);
67
- el.addEventListener('pointerup', up);
68
- el.addEventListener('pointercancel', up);
69
- el.addEventListener('dblclick', reset);
70
- handle.addEventListener('keydown', key);
71
- return () => {
72
- el.removeEventListener('pointerdown', down);
73
- el.removeEventListener('pointermove', move);
74
- el.removeEventListener('pointerup', up);
75
- el.removeEventListener('pointercancel', up);
76
- el.removeEventListener('dblclick', reset);
77
- handle.removeEventListener('keydown', key);
78
- };
79
- }, [enabled, min, set]);
80
- return { grip, knob, height };
81
- }
82
- /** The knob: a separator that names what it resizes and says how tall it is. */
83
- export function Grip({ knob, name, label, min, height, }) {
84
- return (_jsx(XStack, { ref: knob, ...slot(name), ...{
85
- role: 'separator',
86
- 'aria-orientation': 'horizontal',
87
- 'aria-label': `Resize ${label}`,
88
- 'aria-valuemin': min,
89
- // A drag has no ceiling; this stands in for "as tall as you like".
90
- 'aria-valuemax': CEILING,
91
- 'aria-valuenow': height ?? min,
92
- 'aria-valuetext': height === null ? 'Fits its content' : `${height} pixels`,
93
- tabIndex: 0,
94
- }, rounded: "$2", p: "$1", focusVisibleStyle: { bg: '$hover' }, children: _jsx(GripHorizontal, { size: 14, color: "$soft" }) }));
118
+ frame.current = requestAnimationFrame(() => {
119
+ frame.current = 0;
120
+ onSpan(want.current);
121
+ });
122
+ },
123
+ // A drag ends when the pointer is let go: lifted, or taken by the browser.
124
+ onPointerUp: end, onPointerCancel: end, onDoubleClick: () => (onReset ? onReset() : settle(clamp(reset ?? span))), onKeyDown: (e) => {
125
+ const step = e.shiftKey ? LONG : STEP;
126
+ const now = drawn(e.currentTarget);
127
+ const to = e.key === wider
128
+ ? now + step
129
+ : e.key === narrower
130
+ ? now - step
131
+ : e.key === 'Home'
132
+ ? floor
133
+ : e.key === 'End'
134
+ ? ceil
135
+ : null;
136
+ if (to === null)
137
+ return;
138
+ e.preventDefault?.();
139
+ if (onShut && to < floor)
140
+ return onShut();
141
+ settle(clamp(to));
142
+ }, ...rest, children: _jsx(YStack, { ...(tall ? { height: 2, width: '100%' } : { width: 2, height: '100%' }), rounded: 1, bg: keyed || moving ? '$outlineColor' : hovered ? '$rim' : 'transparent', pointerEvents: "none" }) }));
95
143
  }
96
144
  //# sourceMappingURL=grip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"grip.js","sourceRoot":"","sources":["../../../src/backends/gui/grip.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,oEAAoE;AACpE,MAAM,IAAI,GAAG,EAA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