@opencode/ui 0.0.0-dev-735 → 0.0.0-dev-767

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 (56) hide show
  1. package/dist/components/animated-number-machine.d.ts +95 -0
  2. package/dist/components/image-flight-machine.d.ts +135 -0
  3. package/dist/components/image-zoom-machine.d.ts +95 -0
  4. package/dist/components/image-zoom.d.ts +6 -3
  5. package/dist/components/popover-machine.d.ts +96 -0
  6. package/dist/components/popover.d.ts +2 -2
  7. package/dist/components/resize-handle-machine.d.ts +71 -0
  8. package/dist/components/scroll-view-machine.d.ts +66 -0
  9. package/dist/components/scroll-view.d.ts +2 -2
  10. package/dist/components/text-field-machine.d.ts +62 -0
  11. package/dist/components/text-reveal-machine.d.ts +90 -0
  12. package/dist/data-display/line-comment/machine.d.ts +157 -0
  13. package/dist/data-display/project-avatar/animation-machine.d.ts +62 -0
  14. package/dist/data-display/project-avatar/animation.d.ts +1 -1
  15. package/dist/feedback/toast/machine.d.ts +57 -0
  16. package/dist/feedback/toast/toast.d.ts +1 -1
  17. package/dist/forms/select/machine.d.ts +45 -0
  18. package/dist/forms/typeahead/machine.d.ts +85 -0
  19. package/dist/navigation/menu/machine.d.ts +49 -0
  20. package/dist/navigation/segmented-control/machine.d.ts +46 -0
  21. package/dist/theme/context.d.ts +20 -9
  22. package/dist/theme/machine.d.ts +174 -0
  23. package/package.json +3 -3
  24. package/src/components/animated-number-machine.ts +214 -0
  25. package/src/components/animated-number.tsx +134 -83
  26. package/src/components/image-flight-machine.ts +247 -0
  27. package/src/components/image-preview.css +5 -2
  28. package/src/components/image-preview.tsx +390 -252
  29. package/src/components/image-zoom-machine.ts +191 -0
  30. package/src/components/image-zoom.ts +22 -14
  31. package/src/components/popover-machine.ts +198 -0
  32. package/src/components/popover.tsx +157 -89
  33. package/src/components/resize-handle-machine.ts +174 -0
  34. package/src/components/resize-handle.tsx +113 -83
  35. package/src/components/scroll-view-machine.ts +231 -0
  36. package/src/components/scroll-view.tsx +163 -116
  37. package/src/components/text-field-machine.ts +102 -0
  38. package/src/components/text-field.tsx +78 -24
  39. package/src/components/text-reveal-machine.ts +184 -0
  40. package/src/components/text-reveal.tsx +96 -93
  41. package/src/data-display/line-comment/line-comment.tsx +154 -178
  42. package/src/data-display/line-comment/machine.ts +392 -0
  43. package/src/data-display/project-avatar/animation-machine.ts +182 -0
  44. package/src/data-display/project-avatar/animation.ts +67 -38
  45. package/src/feedback/toast/machine.ts +115 -0
  46. package/src/feedback/toast/toast.tsx +55 -59
  47. package/src/forms/select/machine.ts +81 -0
  48. package/src/forms/select/select.tsx +49 -27
  49. package/src/forms/typeahead/machine.ts +253 -0
  50. package/src/forms/typeahead/typeahead.tsx +70 -62
  51. package/src/navigation/menu/machine.ts +109 -0
  52. package/src/navigation/menu/menu.tsx +118 -20
  53. package/src/navigation/segmented-control/machine.ts +72 -0
  54. package/src/navigation/segmented-control/segmented-control.tsx +46 -46
  55. package/src/theme/context.tsx +134 -240
  56. package/src/theme/machine.ts +508 -0
@@ -0,0 +1,95 @@
1
+ export declare const ANIMATED_NUMBER_TRACK_LENGTH = 30;
2
+ /** Added to the measured transition time before a roll or resize that never reported its end settles anyway. */
3
+ export declare const ANIMATED_NUMBER_FALLBACK_PAD_MS = 100;
4
+ /**
5
+ * `resizing` eases the width to `targetDigits` while extra leading places stay mounted to roll in or out. `attempt`
6
+ * names each eased change, so a fallback timer from an earlier one cannot cut the current one short.
7
+ */
8
+ export type AnimatedNumberState = {
9
+ readonly status: "static";
10
+ readonly attempt: number;
11
+ readonly value: number;
12
+ readonly direction: 1 | -1;
13
+ readonly places: number;
14
+ } | {
15
+ readonly status: "resizing";
16
+ readonly attempt: number;
17
+ readonly value: number;
18
+ readonly direction: 1 | -1;
19
+ readonly places: number;
20
+ readonly targetDigits: number;
21
+ } | {
22
+ readonly status: "disposed";
23
+ };
24
+ /** `canAnimate` is false while detached or under reduced motion, where no transition runs to report its end. */
25
+ export type AnimatedNumberEvent = {
26
+ readonly type: "value.changed";
27
+ readonly value: number;
28
+ readonly canAnimate: boolean;
29
+ } | {
30
+ readonly type: "resize.ended";
31
+ } | {
32
+ readonly type: "resize.timed-out";
33
+ readonly attempt: number;
34
+ } | {
35
+ readonly type: "disposed";
36
+ };
37
+ export type AnimatedDigitState = {
38
+ readonly status: "static";
39
+ readonly attempt: number;
40
+ readonly digit: number;
41
+ readonly step: number;
42
+ } | {
43
+ readonly status: "rolling";
44
+ readonly attempt: number;
45
+ readonly digit: number;
46
+ readonly step: number;
47
+ } | {
48
+ readonly status: "disposed";
49
+ };
50
+ export type AnimatedDigitEvent = {
51
+ readonly type: "digit.changed";
52
+ readonly digit: number;
53
+ readonly direction: 1 | -1;
54
+ readonly canAnimate: boolean;
55
+ } | {
56
+ readonly type: "roll.ended";
57
+ } | {
58
+ readonly type: "roll.timed-out";
59
+ readonly attempt: number;
60
+ } | {
61
+ readonly type: "disposed";
62
+ };
63
+ /** `watch` arms the fallback for an eased change; `clear` drops it once the change has settled. */
64
+ export type AnimatedNumberEffect = {
65
+ readonly type: "watch";
66
+ readonly attempt: number;
67
+ } | {
68
+ readonly type: "clear";
69
+ };
70
+ export type AnimatedNumberTransition<State> = {
71
+ readonly state: State;
72
+ readonly effects: readonly AnimatedNumberEffect[];
73
+ };
74
+ export declare function createAnimatedNumberState(value: number): AnimatedNumberState;
75
+ export declare function transitionAnimatedNumber(state: AnimatedNumberState, event: AnimatedNumberEvent): AnimatedNumberTransition<AnimatedNumberState>;
76
+ export declare function createAnimatedDigitState(digit: number): AnimatedDigitState;
77
+ export declare function transitionAnimatedDigit(state: AnimatedDigitState, event: AnimatedDigitEvent): AnimatedNumberTransition<AnimatedDigitState>;
78
+ export declare function selectAnimatedNumberValue(state: AnimatedNumberState): number;
79
+ export declare function selectAnimatedNumberDirection(state: AnimatedNumberState): -1 | 1;
80
+ export declare function selectAnimatedNumberPlaces(state: AnimatedNumberState): number;
81
+ export declare function selectAnimatedNumberResizing(state: AnimatedNumberState): state is {
82
+ readonly status: "resizing";
83
+ readonly attempt: number;
84
+ readonly value: number;
85
+ readonly direction: 1 | -1;
86
+ readonly places: number;
87
+ readonly targetDigits: number;
88
+ };
89
+ export declare function selectAnimatedDigitRolling(state: AnimatedDigitState): state is {
90
+ readonly status: "rolling";
91
+ readonly attempt: number;
92
+ readonly digit: number;
93
+ readonly step: number;
94
+ };
95
+ export declare function selectAnimatedDigitStep(state: AnimatedDigitState): number;
@@ -0,0 +1,135 @@
1
+ import type { FlightFrame } from "./image-flight";
2
+ /**
3
+ * How long the preview waits for its image to decode before it opens anyway. Decoding first keeps the flight's first
4
+ * frames smooth; a decode that hangs, such as the stand-in's on a slow second fetch, must not keep the preview hidden.
5
+ */
6
+ export declare const DECODE_TIMEOUT_MS = 1000;
7
+ /** What `data-stage` tells the stylesheet: hidden, a stand-in flying, the preview at rest, or fading out after a close. */
8
+ export type PreviewFlightStage = "pending" | "flying" | "rest" | "closing";
9
+ /**
10
+ * The preview's life from load to close. `attempt` counts image loads, so a decode that settles after the image
11
+ * changed or loaded again is ignored. `borrowed` says the preview holds the page's video, which it hands back once the
12
+ * close lands. `originHidden` says the origin on the page is hidden because the image flew out of it.
13
+ *
14
+ * A close flies home when the origin still shows, then fades the stand-in over the page's image (`veil`). It only
15
+ * fades when the origin is gone, out of sight, or motion is reduced (`fade`).
16
+ */
17
+ export type PreviewFlightState = {
18
+ readonly status: "pending";
19
+ readonly attempt: number;
20
+ } | {
21
+ readonly status: "decoding";
22
+ readonly attempt: number;
23
+ } | {
24
+ readonly status: "opening";
25
+ readonly mode: "flight" | "fade";
26
+ readonly borrowed: boolean;
27
+ } | {
28
+ readonly status: "open";
29
+ readonly originHidden: boolean;
30
+ readonly borrowed: boolean;
31
+ } | {
32
+ readonly status: "closing";
33
+ readonly mode: "flight" | "veil" | "fade";
34
+ readonly borrowed: boolean;
35
+ } | {
36
+ readonly status: "closed";
37
+ } | {
38
+ readonly status: "disposed";
39
+ };
40
+ /** `origin` is the origin's frame to fly from or to, or nothing when it is gone, out of sight, or motion is reduced. */
41
+ export type PreviewFlightEvent = {
42
+ readonly type: "src.changed";
43
+ } | {
44
+ readonly type: "image.loaded";
45
+ } | {
46
+ readonly type: "image.failed";
47
+ } | {
48
+ readonly type: "decode.ready";
49
+ readonly attempt: number;
50
+ readonly origin: FlightFrame | undefined;
51
+ } | {
52
+ readonly type: "video.ready";
53
+ readonly origin: FlightFrame | undefined;
54
+ } | {
55
+ readonly type: "close.started";
56
+ readonly origin: FlightFrame | undefined;
57
+ }
58
+ /** The flight landed with the backdrop at rest, or, without a flight, the backdrop and the veil came to rest. */
59
+ | {
60
+ readonly type: "motion.settled";
61
+ } | {
62
+ readonly type: "disposed";
63
+ };
64
+ export type PreviewFlightEffect = {
65
+ readonly type: "decode.start";
66
+ readonly attempt: number;
67
+ } | {
68
+ readonly type: "decode.cancel";
69
+ } | {
70
+ readonly type: "video.borrow";
71
+ } | {
72
+ readonly type: "video.return";
73
+ } | {
74
+ readonly type: "origin.hide";
75
+ } | {
76
+ readonly type: "origin.show";
77
+ } | {
78
+ readonly type: "open.flight";
79
+ readonly from: FlightFrame;
80
+ } | {
81
+ readonly type: "open.fade";
82
+ }
83
+ /** `turn` turns the opening flight around where it is, keeping its velocity, instead of starting from rest. */
84
+ | {
85
+ readonly type: "close.flight";
86
+ readonly to: FlightFrame;
87
+ readonly turn: boolean;
88
+ } | {
89
+ readonly type: "close.veil";
90
+ } | {
91
+ readonly type: "close.fade";
92
+ }
93
+ /** A video eases back to its whole frame on the way home; an image stops where it is and flies as it is shown. */
94
+ | {
95
+ readonly type: "zoom.fit";
96
+ } | {
97
+ readonly type: "zoom.settle";
98
+ } | {
99
+ readonly type: "body.closing.acquire";
100
+ } | {
101
+ readonly type: "body.closing.release";
102
+ } | {
103
+ readonly type: "loop.stop";
104
+ };
105
+ export type PreviewFlightTransition = {
106
+ readonly state: PreviewFlightState;
107
+ readonly effects: readonly PreviewFlightEffect[];
108
+ };
109
+ export declare const INITIAL_PREVIEW_FLIGHT_STATE: PreviewFlightState;
110
+ export declare function transitionPreviewFlight(state: PreviewFlightState, event: PreviewFlightEvent): PreviewFlightTransition;
111
+ export declare function selectFlightStage(state: PreviewFlightState): PreviewFlightStage;
112
+ /** Whether the preview takes zoom, pan and keyboard input: from the moment it reveals until a close starts. */
113
+ export declare function selectFlightInteractive(state: PreviewFlightState): state is {
114
+ readonly status: "opening";
115
+ readonly mode: "flight" | "fade";
116
+ readonly borrowed: boolean;
117
+ } | {
118
+ readonly status: "open";
119
+ readonly originHidden: boolean;
120
+ readonly borrowed: boolean;
121
+ };
122
+ /** Whether the preview, its controls and a borrowed video fade with the backdrop rather than flying. */
123
+ export declare function selectFlightFading(state: PreviewFlightState): boolean;
124
+ /** Whether a borrowed video sits fitted in the preview, not flying, so a resize moves it with the preview. */
125
+ export declare function selectVideoAtRest(state: PreviewFlightState): boolean;
126
+ /** Whether the preview still waits to reveal, so it is worth measuring where it would fly from. */
127
+ export declare function selectAwaitingReveal(state: PreviewFlightState): state is {
128
+ readonly status: "pending";
129
+ readonly attempt: number;
130
+ } | {
131
+ readonly status: "decoding";
132
+ readonly attempt: number;
133
+ };
134
+ /** Whether a decode of image load `attempt` is still the one the preview waits for. */
135
+ export declare function selectDecodeCurrent(state: PreviewFlightState, attempt: number): boolean;
@@ -0,0 +1,95 @@
1
+ /** The element a pan captures the pointer on: the preview's body for an image, the borrowed video for a video. */
2
+ export type PanTarget = "viewport" | "video";
3
+ /**
4
+ * The press under way. A `backdrop-press` began on the backdrop around the image and stayed put, so the click that ends
5
+ * it closes the preview. A pan captures the pointer, so its click lands on the backdrop wherever it began: `onBackdrop`
6
+ * says whether it began there, and `moved` whether it has moved, so the click that ends a moved pan neither closes the
7
+ * preview nor plays the video.
8
+ */
9
+ export type PreviewZoomGesture = {
10
+ readonly type: "idle";
11
+ } | {
12
+ readonly type: "backdrop-press";
13
+ } | {
14
+ readonly type: "panning";
15
+ readonly pointerId: number;
16
+ readonly target: PanTarget;
17
+ readonly onBackdrop: boolean;
18
+ readonly moved: boolean;
19
+ };
20
+ /**
21
+ * `gliding` is an eased zoom under way on the frame loop. Scale and offsets live on springs in the driver, not here: a
22
+ * frame of a glide or a pan writes no state. A press does not stop a glide, so a third click of a double-click zoom
23
+ * leaves it running; the hand moving does.
24
+ */
25
+ export type PreviewZoomState = {
26
+ readonly status: "still" | "gliding";
27
+ readonly gesture: PreviewZoomGesture;
28
+ } | {
29
+ readonly status: "disposed";
30
+ };
31
+ /** `zoomed` is whether the image shows above fit once the event's change applies. */
32
+ export type PreviewZoomEvent = {
33
+ readonly type: "pointer.down";
34
+ readonly pointerId: number;
35
+ readonly button: number;
36
+ /** `content` is anywhere in the preview but its body, such as the band around it or the controls. */
37
+ readonly target: PanTarget | "content";
38
+ readonly onBackdrop: boolean;
39
+ readonly zoomed: boolean;
40
+ } | {
41
+ readonly type: "pointer.moved";
42
+ readonly pointerId: number;
43
+ } | {
44
+ readonly type: "pointer.up";
45
+ readonly pointerId: number;
46
+ }
47
+ /** `pointercancel`, `lostpointercapture`, or a move with the primary button already up: the pan ends unreleased. */
48
+ | {
49
+ readonly type: "pointer.cancel";
50
+ readonly pointerId: number;
51
+ } | {
52
+ readonly type: "backdrop.click";
53
+ readonly onBackdrop: boolean;
54
+ }
55
+ /** Pinch, wheel, drag or a resize set the view directly. */
56
+ | {
57
+ readonly type: "follow";
58
+ readonly zoomed: boolean;
59
+ } | {
60
+ readonly type: "glide.start";
61
+ } | {
62
+ readonly type: "glide.settled";
63
+ readonly zoomed: boolean;
64
+ } | {
65
+ readonly type: "disposed";
66
+ };
67
+ export type PreviewZoomEffect = {
68
+ readonly type: "pointer.capture";
69
+ readonly target: PanTarget;
70
+ readonly pointerId: number;
71
+ } | {
72
+ readonly type: "pointer.release";
73
+ readonly target: PanTarget;
74
+ readonly pointerId: number;
75
+ } | {
76
+ readonly type: "glide.loop.start";
77
+ } | {
78
+ readonly type: "glide.loop.stop";
79
+ }
80
+ /** Swallows the click that ends a moved pan over the video, so it does not play or pause it. */
81
+ | {
82
+ readonly type: "video.suppress-click";
83
+ } | {
84
+ readonly type: "dialog.close";
85
+ };
86
+ export type PreviewZoomTransition = {
87
+ readonly state: PreviewZoomState;
88
+ readonly effects: readonly PreviewZoomEffect[];
89
+ };
90
+ export declare const INITIAL_PREVIEW_ZOOM_STATE: PreviewZoomState;
91
+ export declare function transitionPreviewZoom(state: PreviewZoomState, event: PreviewZoomEvent): PreviewZoomTransition;
92
+ /** Whether a pan holds the pointer, which shows the grabbing cursor. */
93
+ export declare function selectDragging(state: PreviewZoomState): boolean;
94
+ /** Whether `pointerId` is the pointer the pan under way follows. */
95
+ export declare function selectPanPointer(state: PreviewZoomState, pointerId: number): boolean;
@@ -32,10 +32,11 @@ export declare function clampView(view: ZoomView, bounds: ZoomBounds): ZoomView;
32
32
  /** The double-click target: 100% for a downscaled image, or twice the fitted size when 100% is barely larger. */
33
33
  export declare function detailScale(fitRatio: number): number;
34
34
  /**
35
- * The `object-view-box` that shows `view` of media fitted at `size`, for media that must zoom inside its own box, such
36
- * as a video under its controls. The inset is in the media's natural pixels.
35
+ * The `object-view-box` that shows the view at `scale`, `x` and `y` of media fitted at `size`, for media that must zoom
36
+ * inside its own box, such as a video under its controls. The inset is in the media's natural pixels. It takes the view
37
+ * as numbers, so painting a frame of a glide allocates nothing but the string.
37
38
  */
38
- export declare function viewBox(view: ZoomView, size: {
39
+ export declare function viewBox(scale: number, x: number, y: number, size: {
39
40
  width: number;
40
41
  height: number;
41
42
  }, natural: {
@@ -44,3 +45,5 @@ export declare function viewBox(view: ZoomView, size: {
44
45
  }): string;
45
46
  /** The zoom factor for one wheel event, bounded so a coarse mouse-wheel notch is a step rather than a jump. */
46
47
  export declare function wheelZoomFactor(deltaY: number): number;
48
+ /** Keeps one axis of a zoomed image of `size` covering a `viewport` it overflows, and centered in one it fits. */
49
+ export declare function clampAxis(offset: number, size: number, viewport: number): number;
@@ -0,0 +1,96 @@
1
+ export type PopoverCloseReason = "escape" | "outside" | "control";
2
+ /**
3
+ * One popover's open state. `controlled` follows the `open` prop; `uncontrolled` owns it. A controlled popover that
4
+ * asked its owner to close stays open with `pendingDismiss` until the owner answers, so a refused close leaves no
5
+ * reason behind for a later close to read.
6
+ */
7
+ export type PopoverState = {
8
+ readonly status: "closed";
9
+ readonly mode: "controlled" | "uncontrolled";
10
+ /** Why it closed, until Kobalte decides where focus returns. Focus stays put after an outside press. */
11
+ readonly closeReason: PopoverCloseReason | null;
12
+ } | {
13
+ readonly status: "open";
14
+ readonly mode: "uncontrolled";
15
+ } | {
16
+ readonly status: "open";
17
+ readonly mode: "controlled";
18
+ readonly pendingDismiss: PopoverCloseReason | null;
19
+ } | {
20
+ readonly status: "disposed";
21
+ };
22
+ export type PopoverEvent =
23
+ /** The `open` prop, read again right after every `onOpenChange` call: a controlled `true` refuses a close. */
24
+ {
25
+ readonly type: "props.synced";
26
+ readonly open: boolean | undefined;
27
+ }
28
+ /** The shared listener dismissed this popover. */
29
+ | {
30
+ readonly type: "dismiss";
31
+ readonly reason: "escape" | "outside";
32
+ }
33
+ /** Kobalte asked to open or close, from the trigger or the close button. */
34
+ | {
35
+ readonly type: "kobalte.changed";
36
+ readonly open: boolean;
37
+ } | {
38
+ readonly type: "close-auto-focus.handled";
39
+ } | {
40
+ readonly type: "disposed";
41
+ };
42
+ export type PopoverEffect = {
43
+ readonly type: "notify.open";
44
+ readonly open: boolean;
45
+ };
46
+ export type PopoverTransition = {
47
+ readonly state: PopoverState;
48
+ readonly effects: readonly PopoverEffect[];
49
+ };
50
+ export declare function createPopoverState(open: boolean | undefined, defaultOpen: boolean | undefined): PopoverState;
51
+ export declare function transitionPopover(state: PopoverState, event: PopoverEvent): PopoverTransition;
52
+ export declare function selectPopoverOpen(state: PopoverState): state is {
53
+ readonly status: "open";
54
+ readonly mode: "uncontrolled";
55
+ } | {
56
+ readonly status: "open";
57
+ readonly mode: "controlled";
58
+ readonly pendingDismiss: PopoverCloseReason | null;
59
+ };
60
+ /** An outside press already moved focus where the user wanted it, so closing does not pull it back to the trigger. */
61
+ export declare function selectPreventCloseAutoFocus(state: PopoverState): boolean;
62
+ /** One open popover, and the popover it opened inside (portaled content is outside its parent in the DOM). */
63
+ export type PopoverStackEntry = {
64
+ readonly id: number;
65
+ readonly parentId: number | null;
66
+ };
67
+ /** Every open popover, in the order they opened. One shared set of window listeners routes Escape and outside presses. */
68
+ export type PopoverStackState = {
69
+ readonly entries: readonly PopoverStackEntry[];
70
+ };
71
+ export type PopoverStackEvent = {
72
+ readonly type: "layer.opened";
73
+ readonly id: number;
74
+ readonly parentId: number | null;
75
+ } | {
76
+ readonly type: "layer.closed";
77
+ readonly id: number;
78
+ } | {
79
+ readonly type: "escape.pressed";
80
+ }
81
+ /** A press or focus landed; `insideIds` are the open popovers whose trigger or content contains it. */
82
+ | {
83
+ readonly type: "outside.interacted";
84
+ readonly insideIds: ReadonlySet<number>;
85
+ };
86
+ export type PopoverStackEffect = {
87
+ readonly type: "dismiss.layer";
88
+ readonly id: number;
89
+ readonly reason: "escape" | "outside";
90
+ };
91
+ export type PopoverStackTransition = {
92
+ readonly state: PopoverStackState;
93
+ readonly effects: readonly PopoverStackEffect[];
94
+ };
95
+ export declare const EMPTY_POPOVER_STACK: PopoverStackState;
96
+ export declare function transitionPopoverStack(state: PopoverStackState, event: PopoverStackEvent): PopoverStackTransition;
@@ -1,6 +1,6 @@
1
- import { Popover as Kobalte } from "@kobalte/core/popover";
1
+ import { Root } from "@kobalte/core/popover";
2
2
  import { ComponentProps, JSXElement, ParentProps, ValidComponent } from "solid-js";
3
- export interface PopoverProps<T extends ValidComponent = "div"> extends ParentProps, Omit<ComponentProps<typeof Kobalte>, "children"> {
3
+ export interface PopoverProps<T extends ValidComponent = "div"> extends ParentProps, Omit<ComponentProps<typeof Root>, "children"> {
4
4
  trigger?: JSXElement;
5
5
  triggerAs?: T;
6
6
  triggerProps?: ComponentProps<T>;
@@ -0,0 +1,71 @@
1
+ export type ResizeDirection = "horizontal" | "vertical";
2
+ export type ResizeEdge = "start" | "end";
3
+ /** Fixed for one press: where it started, which way the size grows, and the limits it resizes within. */
4
+ export type ResizeSession = {
5
+ readonly pointerId: number;
6
+ readonly direction: ResizeDirection;
7
+ readonly sign: 1 | -1;
8
+ readonly startPos: number;
9
+ readonly startSize: number;
10
+ readonly min: number;
11
+ readonly max: number;
12
+ readonly threshold: number;
13
+ };
14
+ /**
15
+ * `pressed` holds the pointer before it moves, so a click never reports a drag. `dragging` reports the size on each
16
+ * move; `collapsed` is set while the raw size sits below the collapse threshold.
17
+ */
18
+ export type ResizeHandleState = {
19
+ readonly status: "idle";
20
+ } | {
21
+ readonly status: "pressed";
22
+ readonly session: ResizeSession;
23
+ } | {
24
+ readonly status: "dragging";
25
+ readonly session: ResizeSession;
26
+ readonly collapsed: boolean;
27
+ } | {
28
+ readonly status: "disposed";
29
+ };
30
+ export type ResizeHandleEvent = {
31
+ readonly type: "pointer.down";
32
+ readonly button: number;
33
+ readonly ctrlKey: boolean;
34
+ readonly detail: number;
35
+ readonly session: ResizeSession;
36
+ } | {
37
+ type: "pointer.moved";
38
+ pointerId: number;
39
+ pos: number;
40
+ } | {
41
+ readonly type: "pointer.up";
42
+ readonly pointerId: number;
43
+ }
44
+ /** Blur, `pointercancel` or lost capture; no `pointerId` cancels whichever pointer holds the handle. */
45
+ | {
46
+ readonly type: "drag.cancelled";
47
+ readonly pointerId?: number;
48
+ } | {
49
+ readonly type: "disposed";
50
+ };
51
+ export type ResizeHandleEffect = "lock-body" | "unlock-body" | "dragging-true" | "dragging-false" | "collapse-true" | "collapse-false" | "collapse-commit" | "resize";
52
+ export type ResizeHandleTransition = {
53
+ readonly state: ResizeHandleState;
54
+ readonly effects: readonly ResizeHandleEffect[];
55
+ };
56
+ export declare const INITIAL_RESIZE_HANDLE_STATE: ResizeHandleState;
57
+ export declare const RESIZE_HANDLE_DISPOSED: ResizeHandleEvent;
58
+ export declare const RESIZE_DRAG_CANCELLED: ResizeHandleEvent;
59
+ export declare function resizeSign(direction: ResizeDirection, edge: ResizeEdge, rtl: boolean): 1 | -1;
60
+ /** The size before clamping, which decides collapse, so dragging past `min` can still collapse the panel. */
61
+ export declare function rawResizeSize(session: ResizeSession, pos: number): number;
62
+ export declare function resizeSize(session: ResizeSession, pos: number): number;
63
+ export declare function transitionResizeHandle(state: ResizeHandleState, event: ResizeHandleEvent): ResizeHandleTransition;
64
+ export declare function selectResizeHandleActive(state: ResizeHandleState): state is {
65
+ readonly status: "pressed";
66
+ readonly session: ResizeSession;
67
+ } | {
68
+ readonly status: "dragging";
69
+ readonly session: ResizeSession;
70
+ readonly collapsed: boolean;
71
+ };
@@ -0,0 +1,66 @@
1
+ export declare const SCROLL_IDLE_MS = 800;
2
+ export type ScrollAxis = "vertical" | "horizontal";
3
+ /**
4
+ * `scrolling` shows the thumb until `SCROLL_IDLE_MS` after the last scroll. `dragging` holds the pointer on one thumb;
5
+ * `scrolled` records a scroll during the drag, so its release keeps the thumb up for the idle delay. A thumb exists
6
+ * only while its axis overflows, so losing that overflow ends a drag on it.
7
+ */
8
+ export type ScrollThumbState = {
9
+ readonly status: "idle" | "scrolling";
10
+ readonly hovered: boolean;
11
+ readonly verticalOverflow: boolean;
12
+ readonly horizontalOverflow: boolean;
13
+ } | {
14
+ readonly status: "dragging";
15
+ readonly axis: ScrollAxis;
16
+ readonly pointerId: number;
17
+ readonly grabOffset: number;
18
+ readonly rtl: boolean;
19
+ readonly hovered: boolean;
20
+ readonly scrolled: boolean;
21
+ readonly verticalOverflow: boolean;
22
+ readonly horizontalOverflow: boolean;
23
+ } | {
24
+ readonly status: "disposed";
25
+ };
26
+ export type ScrollThumbEvent = {
27
+ readonly type: "hover.changed";
28
+ readonly hovered: boolean;
29
+ } | {
30
+ readonly type: "scrolled";
31
+ } | {
32
+ readonly type: "idle.elapsed";
33
+ } | {
34
+ readonly type: "overflow.changed";
35
+ readonly vertical: boolean;
36
+ readonly horizontal: boolean;
37
+ } | {
38
+ readonly type: "drag.started";
39
+ readonly axis: ScrollAxis;
40
+ readonly pointerId: number;
41
+ readonly grabOffset: number;
42
+ readonly rtl: boolean;
43
+ } | {
44
+ readonly type: "drag.ended";
45
+ readonly pointerId: number;
46
+ } | {
47
+ readonly type: "disposed";
48
+ };
49
+ export type ScrollThumbEffect = "reset-idle-timer" | "clear-idle-timer" | "release-capture";
50
+ export type ScrollThumbTransition = {
51
+ readonly state: ScrollThumbState;
52
+ readonly effects: readonly ScrollThumbEffect[];
53
+ };
54
+ export declare const INITIAL_SCROLL_THUMB_STATE: ScrollThumbState;
55
+ export declare const SCROLLED: ScrollThumbEvent;
56
+ export declare const SCROLL_IDLE_ELAPSED: ScrollThumbEvent;
57
+ export declare const HOVER_ENTERED: ScrollThumbEvent;
58
+ export declare const HOVER_LEFT: ScrollThumbEvent;
59
+ export declare const SCROLL_THUMB_DISPOSED: ScrollThumbEvent;
60
+ export declare function overflowChanged(vertical: boolean, horizontal: boolean): ScrollThumbEvent;
61
+ export declare function transitionScrollThumb(state: ScrollThumbState, event: ScrollThumbEvent): ScrollThumbTransition;
62
+ export declare function selectShowVerticalThumb(state: ScrollThumbState): boolean;
63
+ export declare function selectShowHorizontalThumb(state: ScrollThumbState): boolean;
64
+ export declare function selectDraggingAxis(state: ScrollThumbState): ScrollAxis | undefined;
65
+ /** `hoverReveals` is the `hover` visibility mode; in `scroll` mode only scrolling and dragging show the thumb. */
66
+ export declare function selectThumbVisible(state: ScrollThumbState, hoverReveals: boolean): boolean;
@@ -1,4 +1,4 @@
1
- import { type ComponentProps } from "solid-js";
1
+ import { type ComponentProps, type JSX } from "solid-js";
2
2
  export type ScrollViewThumbVisibility = "hover" | "scroll";
3
3
  export interface ScrollViewProps extends ComponentProps<"div"> {
4
4
  viewportRef?: (el: HTMLDivElement) => void;
@@ -47,4 +47,4 @@ export declare function scrollOffsetFromThumbPointer(input: {
47
47
  * A scroll container that draws its own thumb, for a thumb in an external track or one corrected for virtualized
48
48
  * rows. Everything else scrolls with a plain `overflow: auto` element, which `styles/scrollbar.css` already styles.
49
49
  */
50
- export declare function ScrollView(props: ScrollViewProps): import("solid-js").JSX.Element;
50
+ export declare function ScrollView(props: ScrollViewProps): JSX.Element;
@@ -0,0 +1,62 @@
1
+ export declare const TEXT_FIELD_COPIED_MS = 2000;
2
+ /** A clipboard write that never settles gives up, so the button can copy again. */
3
+ export declare const TEXT_FIELD_COPY_TIMEOUT_MS = 2000;
4
+ export type TextFieldCopyKind = "clipboard" | "link";
5
+ /**
6
+ * The copy button's feedback. `copying` claims the click before the write starts, so a second click waits for it;
7
+ * `keepCopied` keeps the checkmark of an earlier copy while a repeat copy settles. `attempt` lets only the latest
8
+ * write, its timeout and its own reset timer move the button.
9
+ */
10
+ export type TextFieldCopyState = {
11
+ readonly status: "idle";
12
+ readonly issued: number;
13
+ } | {
14
+ readonly status: "copying";
15
+ readonly attempt: number;
16
+ readonly keepCopied: boolean;
17
+ } | {
18
+ readonly status: "copied";
19
+ readonly attempt: number;
20
+ } | {
21
+ readonly status: "disposed";
22
+ };
23
+ export type TextFieldCopyEvent = {
24
+ readonly type: "copy.requested";
25
+ readonly value: string;
26
+ readonly enabled: boolean;
27
+ } | {
28
+ readonly type: "copy.succeeded";
29
+ readonly attempt: number;
30
+ } | {
31
+ readonly type: "copy.failed";
32
+ readonly attempt: number;
33
+ } | {
34
+ readonly type: "copy.timed-out";
35
+ readonly attempt: number;
36
+ } | {
37
+ readonly type: "reset.elapsed";
38
+ readonly attempt: number;
39
+ } | {
40
+ readonly type: "disposed";
41
+ };
42
+ export type TextFieldCopyEffect = {
43
+ readonly type: "clipboard.write";
44
+ readonly attempt: number;
45
+ readonly value: string;
46
+ readonly timeoutMs: number;
47
+ } | {
48
+ readonly type: "reset.schedule";
49
+ readonly attempt: number;
50
+ readonly delayMs: number;
51
+ } | {
52
+ readonly type: "timer.clear";
53
+ };
54
+ export type TextFieldCopyTransition = {
55
+ readonly state: TextFieldCopyState;
56
+ readonly effects: readonly TextFieldCopyEffect[];
57
+ };
58
+ export declare const INITIAL_TEXT_FIELD_COPY_STATE: TextFieldCopyState;
59
+ export declare function transitionTextFieldCopy(state: TextFieldCopyState, event: TextFieldCopyEvent): TextFieldCopyTransition;
60
+ export declare function selectTextFieldCopied(state: TextFieldCopyState): boolean;
61
+ export declare function selectTextFieldCopyLabelKey(state: TextFieldCopyState, kind: TextFieldCopyKind | undefined): "ui.textField.copied" | "ui.textField.copyLink" | "ui.textField.copyToClipboard";
62
+ export declare function selectTextFieldCopyIcon(state: TextFieldCopyState, kind: TextFieldCopyKind | undefined): "check" | "copy" | "link";