@opencode/ui 2.2.5 → 2.2.6

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 (117) hide show
  1. package/dist/actions/button/button.d.ts +2 -2
  2. package/dist/actions/icon-button/icon-button.d.ts +1 -1
  3. package/dist/components/animated-number-machine.d.ts +95 -0
  4. package/dist/components/file-icon-machine.d.ts +40 -0
  5. package/dist/components/file-icon.d.ts +0 -2
  6. package/dist/components/file-icons/choose-icon-name.d.ts +2 -0
  7. package/dist/components/image-flight-machine.d.ts +135 -0
  8. package/dist/components/image-zoom-machine.d.ts +95 -0
  9. package/dist/components/image-zoom.d.ts +6 -3
  10. package/dist/components/list.d.ts +2 -6
  11. package/dist/components/menu-scroll.d.ts +9 -3
  12. package/dist/components/popover-machine.d.ts +96 -0
  13. package/dist/components/popover.d.ts +2 -2
  14. package/dist/components/resize-handle-machine.d.ts +71 -0
  15. package/dist/components/resize-handle.d.ts +2 -0
  16. package/dist/components/scroll-view-machine.d.ts +68 -0
  17. package/dist/components/scroll-view.d.ts +2 -2
  18. package/dist/components/spinner.d.ts +11 -3
  19. package/dist/components/text-field-machine.d.ts +62 -0
  20. package/dist/components/text-reveal-machine.d.ts +90 -0
  21. package/dist/components/typewriter-machine.d.ts +62 -0
  22. package/dist/context/dialog-machine.d.ts +125 -0
  23. package/dist/context/dialog.d.ts +17 -16
  24. package/dist/data-display/line-comment/machine.d.ts +157 -0
  25. package/dist/data-display/project-avatar/animation-machine.d.ts +62 -0
  26. package/dist/data-display/project-avatar/animation.d.ts +1 -1
  27. package/dist/feedback/activity-ring/activity-ring.d.ts +2 -1
  28. package/dist/feedback/toast/machine.d.ts +57 -0
  29. package/dist/feedback/toast/toast.d.ts +1 -1
  30. package/dist/forms/checkbox/checkbox.d.ts +6 -1
  31. package/dist/forms/select/machine.d.ts +45 -0
  32. package/dist/forms/select/select.d.ts +4 -0
  33. package/dist/forms/typeahead/machine.d.ts +85 -0
  34. package/dist/hooks/auto-scroll-machine.d.ts +89 -0
  35. package/dist/hooks/create-auto-scroll.d.ts +1 -1
  36. package/dist/hooks/list-machine.d.ts +150 -0
  37. package/dist/hooks/use-filtered-list.d.ts +21 -35
  38. package/dist/i18n/en.d.ts +5 -0
  39. package/dist/icons/catalog.d.ts +8 -0
  40. package/dist/navigation/menu/machine.d.ts +49 -0
  41. package/dist/navigation/menu/menu.d.ts +5 -3
  42. package/dist/navigation/segmented-control/machine.d.ts +46 -0
  43. package/dist/overlays/mcp-sign-in/machine.d.ts +184 -0
  44. package/dist/overlays/mcp-sign-in/mcp-sign-in.d.ts +40 -0
  45. package/dist/overlays/tooltip/machine.d.ts +146 -0
  46. package/dist/theme/context.d.ts +38 -14
  47. package/dist/theme/machine.d.ts +174 -0
  48. package/dist/typography/text-shimmer/machine.d.ts +48 -0
  49. package/package.json +19 -3
  50. package/src/actions/button/button.tsx +11 -6
  51. package/src/actions/icon-button/icon-button.tsx +17 -4
  52. package/src/components/animated-number-machine.ts +214 -0
  53. package/src/components/animated-number.tsx +134 -83
  54. package/src/components/file-icon-machine.ts +78 -0
  55. package/src/components/file-icon.tsx +96 -579
  56. package/src/components/file-icons/choose-icon-name.ts +574 -0
  57. package/src/components/image-flight-machine.ts +247 -0
  58. package/src/components/image-preview.css +5 -2
  59. package/src/components/image-preview.tsx +390 -252
  60. package/src/components/image-zoom-machine.ts +191 -0
  61. package/src/components/image-zoom.ts +22 -14
  62. package/src/components/list.tsx +46 -137
  63. package/src/components/menu-scroll.css +19 -8
  64. package/src/components/menu-scroll.tsx +111 -34
  65. package/src/components/popover-machine.ts +198 -0
  66. package/src/components/popover.tsx +157 -89
  67. package/src/components/resize-handle-machine.ts +174 -0
  68. package/src/components/resize-handle.tsx +116 -67
  69. package/src/components/scroll-view-machine.ts +244 -0
  70. package/src/components/scroll-view.tsx +163 -116
  71. package/src/components/spinner.css +18 -5
  72. package/src/components/spinner.tsx +28 -14
  73. package/src/components/text-field-machine.ts +102 -0
  74. package/src/components/text-field.tsx +78 -24
  75. package/src/components/text-reveal-machine.ts +184 -0
  76. package/src/components/text-reveal.tsx +96 -93
  77. package/src/components/typewriter-machine.ts +134 -0
  78. package/src/components/typewriter.tsx +50 -39
  79. package/src/context/dialog-machine.ts +280 -0
  80. package/src/context/dialog.tsx +168 -177
  81. package/src/data-display/line-comment/line-comment.tsx +157 -178
  82. package/src/data-display/line-comment/machine.ts +391 -0
  83. package/src/data-display/project-avatar/animation-machine.ts +182 -0
  84. package/src/data-display/project-avatar/animation.ts +67 -38
  85. package/src/feedback/activity-ring/activity-ring.tsx +1 -1
  86. package/src/feedback/toast/machine.ts +115 -0
  87. package/src/feedback/toast/toast.tsx +55 -59
  88. package/src/forms/checkbox/checkbox-compact.css +169 -0
  89. package/src/forms/checkbox/checkbox.tsx +93 -31
  90. package/src/forms/search-list/search-list.css +5 -1
  91. package/src/forms/search-list/search-list.tsx +4 -4
  92. package/src/forms/select/machine.ts +81 -0
  93. package/src/forms/select/select.css +59 -17
  94. package/src/forms/select/select.tsx +67 -31
  95. package/src/forms/typeahead/machine.ts +253 -0
  96. package/src/forms/typeahead/typeahead.tsx +70 -62
  97. package/src/hooks/auto-scroll-machine.ts +261 -0
  98. package/src/hooks/create-auto-scroll.tsx +110 -205
  99. package/src/hooks/list-machine.ts +359 -0
  100. package/src/hooks/use-filtered-list.tsx +101 -112
  101. package/src/i18n/en.ts +6 -1
  102. package/src/icons/catalog.ts +8 -0
  103. package/src/navigation/menu/machine.ts +109 -0
  104. package/src/navigation/menu/menu.tsx +130 -22
  105. package/src/navigation/segmented-control/machine.ts +72 -0
  106. package/src/navigation/segmented-control/segmented-control.tsx +46 -46
  107. package/src/overlays/dialog/dialog.tsx +7 -1
  108. package/src/overlays/mcp-sign-in/machine.ts +343 -0
  109. package/src/overlays/mcp-sign-in/mcp-sign-in.ts +159 -0
  110. package/src/overlays/tooltip/machine.ts +303 -0
  111. package/src/overlays/tooltip/tooltip.tsx +157 -92
  112. package/src/styles/theme.css +10 -2
  113. package/src/theme/context.tsx +192 -269
  114. package/src/theme/machine.ts +508 -0
  115. package/src/typography/text-shimmer/machine.ts +90 -0
  116. package/src/typography/text-shimmer/text-shimmer.css +71 -39
  117. package/src/typography/text-shimmer/text-shimmer.tsx +41 -24
@@ -1,8 +1,8 @@
1
- import { Root } from "@kobalte/core/button";
1
+ import type { Root } from "@kobalte/core/button";
2
2
  import { type ComponentProps } from "solid-js";
3
3
  import { type IconProps } from "@opencode/ui/icon";
4
4
  import "./button.css";
5
- export interface ButtonProps extends ComponentProps<typeof Root>, Pick<ComponentProps<"button">, "class" | "classList" | "children"> {
5
+ export interface ButtonProps extends Omit<ComponentProps<typeof Root>, "type">, Pick<ComponentProps<"button">, "class" | "classList" | "children" | "type"> {
6
6
  size?: "small" | "normal" | "large";
7
7
  variant?: "neutral" | "danger" | "warning" | "outline" | "contrast" | "submit" | "ghost" | "ghost-muted" | "ghost-faint" | "ghost-danger" | "loading";
8
8
  icon?: IconProps["name"];
@@ -1,4 +1,4 @@
1
- import { Root } from "@kobalte/core/button";
1
+ import type { Root } from "@kobalte/core/button";
2
2
  import { type ComponentProps } from "solid-js";
3
3
  import { JSX } from "solid-js";
4
4
  import "./icon-button.css";
@@ -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,40 @@
1
+ import type { IconName } from "./file-icons/types";
2
+ export declare const FILE_ICON_LOAD_TIMEOUT_MS = 10000;
3
+ /** Bundled with the component, so they are always in the sprite and stand in for an icon that failed to load. */
4
+ export type FallbackIconName = "Document" | "Folder" | "FolderOpen";
5
+ /**
6
+ * Lifecycle of one lazy `<symbol>` in the in-document sprite, shared by every mounted icon with that name. It only
7
+ * moves forward: Chromium keeps a failed dynamic import failed for the page's lifetime, so a retry cannot succeed.
8
+ */
9
+ export type FileIconSymbolState = {
10
+ readonly status: "unrequested" | "loading" | "failed" | "ready";
11
+ };
12
+ export type FileIconSymbolEvent = {
13
+ readonly type: "requested";
14
+ } | {
15
+ readonly type: "load.succeeded";
16
+ readonly svg: string;
17
+ } | {
18
+ readonly type: "load.failed";
19
+ } | {
20
+ readonly type: "load.timed-out";
21
+ };
22
+ export type FileIconSymbolEffect = {
23
+ readonly type: "load";
24
+ } | {
25
+ readonly type: "insert-symbol";
26
+ readonly svg: string;
27
+ } | {
28
+ readonly type: "cancel-timeout";
29
+ };
30
+ export type FileIconSymbolTransition = {
31
+ readonly state: FileIconSymbolState;
32
+ readonly effects: readonly FileIconSymbolEffect[];
33
+ };
34
+ export declare const INITIAL_FILE_ICON_SYMBOL_STATE: FileIconSymbolState;
35
+ export declare const READY_FILE_ICON_SYMBOL_STATE: FileIconSymbolState;
36
+ export declare const FILE_ICON_REQUESTED: FileIconSymbolEvent;
37
+ export declare function transitionFileIconSymbol(state: FileIconSymbolState, event: FileIconSymbolEvent): FileIconSymbolTransition;
38
+ export declare function chooseFallbackIconName(type: "directory" | "file", expanded: boolean): FallbackIconName;
39
+ /** The symbol a mounted icon shows: its own unless it failed to load. */
40
+ export declare function selectFileIconSymbol(state: FileIconSymbolState, name: IconName, fallback: FallbackIconName): IconName;
@@ -1,5 +1,4 @@
1
1
  import type { Component, JSX } from "solid-js";
2
- import type { IconName } from "./file-icons/types";
3
2
  export type FileIconProps = JSX.GSVGAttributes<SVGSVGElement> & {
4
3
  node: {
5
4
  path: string;
@@ -9,4 +8,3 @@ export type FileIconProps = JSX.GSVGAttributes<SVGSVGElement> & {
9
8
  mono?: boolean;
10
9
  };
11
10
  export declare const FileIcon: Component<FileIconProps>;
12
- export declare function chooseIconName(path: string, type: "directory" | "file", expanded: boolean): IconName;
@@ -0,0 +1,2 @@
1
+ import type { IconName } from "./types";
2
+ export declare function chooseIconName(path: string, type: "directory" | "file", expanded: boolean): IconName;
@@ -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;
@@ -12,20 +12,16 @@ export interface ListAddProps {
12
12
  class?: string;
13
13
  render: () => JSX.Element;
14
14
  }
15
- export interface ListAddProps {
16
- class?: string;
17
- render: () => JSX.Element;
18
- }
19
15
  export interface ListProps<T> extends FilteredListProps<T> {
20
16
  class?: string;
21
17
  children: (item: T) => JSX.Element;
22
18
  emptyMessage?: string;
23
19
  loadingMessage?: string;
20
+ /** Shown when an async `items` loader rejects or times out. */
21
+ errorMessage?: string;
24
22
  onKeyEvent?: (event: KeyboardEvent, item: T | undefined) => void;
25
23
  onMove?: (item: T | undefined) => void;
26
- onFilter?: (value: string) => void;
27
24
  activeIcon?: IconProps["name"];
28
- filter?: string;
29
25
  search?: ListSearchProps | boolean;
30
26
  itemWrapper?: (item: T, node: JSX.Element) => JSX.Element;
31
27
  divider?: boolean;
@@ -1,6 +1,12 @@
1
- import { type ComponentProps } from "solid-js";
1
+ import { type ComponentProps, type JSX } from "solid-js";
2
2
  import "./menu-scroll.css";
3
- export declare function MenuScroll(props: Omit<ComponentProps<"div">, "ref" | "onScroll"> & {
3
+ /**
4
+ * A scroll container for menus, popovers and dialog lists. It hides the native scrollbar and draws the shared thumb
5
+ * over the content, so rows keep equal start and end padding whether or not the list overflows. Touch devices and
6
+ * high-contrast modes keep the native scrollbar.
7
+ */
8
+ export declare function MenuScroll(props: Omit<ComponentProps<"div">, "ref" | "onScroll" | "onFocusIn"> & {
4
9
  viewportClass?: string;
5
10
  viewportRef?: (element: HTMLDivElement) => void;
6
- }): import("solid-js").JSX.Element;
11
+ onScroll?: JSX.EventHandler<HTMLDivElement, Event>;
12
+ }): JSX.Element;
@@ -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
+ };
@@ -10,5 +10,7 @@ export interface ResizeHandleProps extends Omit<JSX.HTMLAttributes<HTMLDivElemen
10
10
  /** Called while dragging when size crosses `collapseThreshold`. */
11
11
  onCollapseChange?: (collapsed: boolean) => void;
12
12
  collapseThreshold?: number;
13
+ /** Called with true on the first move of a drag and with false when it ends; a click without moving calls neither. */
14
+ onDraggingChange?: (dragging: boolean) => void;
13
15
  }
14
16
  export declare function ResizeHandle(props: ResizeHandleProps): JSX.Element;