@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.
- package/dist/actions/button/button.d.ts +2 -2
- package/dist/actions/icon-button/icon-button.d.ts +1 -1
- package/dist/components/animated-number-machine.d.ts +95 -0
- package/dist/components/file-icon-machine.d.ts +40 -0
- package/dist/components/file-icon.d.ts +0 -2
- package/dist/components/file-icons/choose-icon-name.d.ts +2 -0
- package/dist/components/image-flight-machine.d.ts +135 -0
- package/dist/components/image-zoom-machine.d.ts +95 -0
- package/dist/components/image-zoom.d.ts +6 -3
- package/dist/components/list.d.ts +2 -6
- package/dist/components/menu-scroll.d.ts +9 -3
- package/dist/components/popover-machine.d.ts +96 -0
- package/dist/components/popover.d.ts +2 -2
- package/dist/components/resize-handle-machine.d.ts +71 -0
- package/dist/components/resize-handle.d.ts +2 -0
- package/dist/components/scroll-view-machine.d.ts +68 -0
- package/dist/components/scroll-view.d.ts +2 -2
- package/dist/components/spinner.d.ts +11 -3
- package/dist/components/text-field-machine.d.ts +62 -0
- package/dist/components/text-reveal-machine.d.ts +90 -0
- package/dist/components/typewriter-machine.d.ts +62 -0
- package/dist/context/dialog-machine.d.ts +125 -0
- package/dist/context/dialog.d.ts +17 -16
- package/dist/data-display/line-comment/machine.d.ts +157 -0
- package/dist/data-display/project-avatar/animation-machine.d.ts +62 -0
- package/dist/data-display/project-avatar/animation.d.ts +1 -1
- package/dist/feedback/activity-ring/activity-ring.d.ts +2 -1
- package/dist/feedback/toast/machine.d.ts +57 -0
- package/dist/feedback/toast/toast.d.ts +1 -1
- package/dist/forms/checkbox/checkbox.d.ts +6 -1
- package/dist/forms/select/machine.d.ts +45 -0
- package/dist/forms/select/select.d.ts +4 -0
- package/dist/forms/typeahead/machine.d.ts +85 -0
- package/dist/hooks/auto-scroll-machine.d.ts +89 -0
- package/dist/hooks/create-auto-scroll.d.ts +1 -1
- package/dist/hooks/list-machine.d.ts +150 -0
- package/dist/hooks/use-filtered-list.d.ts +21 -35
- package/dist/i18n/en.d.ts +5 -0
- package/dist/icons/catalog.d.ts +8 -0
- package/dist/navigation/menu/machine.d.ts +49 -0
- package/dist/navigation/menu/menu.d.ts +5 -3
- package/dist/navigation/segmented-control/machine.d.ts +46 -0
- package/dist/overlays/mcp-sign-in/machine.d.ts +184 -0
- package/dist/overlays/mcp-sign-in/mcp-sign-in.d.ts +40 -0
- package/dist/overlays/tooltip/machine.d.ts +146 -0
- package/dist/theme/context.d.ts +38 -14
- package/dist/theme/machine.d.ts +174 -0
- package/dist/typography/text-shimmer/machine.d.ts +48 -0
- package/package.json +19 -3
- package/src/actions/button/button.tsx +11 -6
- package/src/actions/icon-button/icon-button.tsx +17 -4
- package/src/components/animated-number-machine.ts +214 -0
- package/src/components/animated-number.tsx +134 -83
- package/src/components/file-icon-machine.ts +78 -0
- package/src/components/file-icon.tsx +96 -579
- package/src/components/file-icons/choose-icon-name.ts +574 -0
- package/src/components/image-flight-machine.ts +247 -0
- package/src/components/image-preview.css +5 -2
- package/src/components/image-preview.tsx +390 -252
- package/src/components/image-zoom-machine.ts +191 -0
- package/src/components/image-zoom.ts +22 -14
- package/src/components/list.tsx +46 -137
- package/src/components/menu-scroll.css +19 -8
- package/src/components/menu-scroll.tsx +111 -34
- package/src/components/popover-machine.ts +198 -0
- package/src/components/popover.tsx +157 -89
- package/src/components/resize-handle-machine.ts +174 -0
- package/src/components/resize-handle.tsx +116 -67
- package/src/components/scroll-view-machine.ts +244 -0
- package/src/components/scroll-view.tsx +163 -116
- package/src/components/spinner.css +18 -5
- package/src/components/spinner.tsx +28 -14
- package/src/components/text-field-machine.ts +102 -0
- package/src/components/text-field.tsx +78 -24
- package/src/components/text-reveal-machine.ts +184 -0
- package/src/components/text-reveal.tsx +96 -93
- package/src/components/typewriter-machine.ts +134 -0
- package/src/components/typewriter.tsx +50 -39
- package/src/context/dialog-machine.ts +280 -0
- package/src/context/dialog.tsx +168 -177
- package/src/data-display/line-comment/line-comment.tsx +157 -178
- package/src/data-display/line-comment/machine.ts +391 -0
- package/src/data-display/project-avatar/animation-machine.ts +182 -0
- package/src/data-display/project-avatar/animation.ts +67 -38
- package/src/feedback/activity-ring/activity-ring.tsx +1 -1
- package/src/feedback/toast/machine.ts +115 -0
- package/src/feedback/toast/toast.tsx +55 -59
- package/src/forms/checkbox/checkbox-compact.css +169 -0
- package/src/forms/checkbox/checkbox.tsx +93 -31
- package/src/forms/search-list/search-list.css +5 -1
- package/src/forms/search-list/search-list.tsx +4 -4
- package/src/forms/select/machine.ts +81 -0
- package/src/forms/select/select.css +59 -17
- package/src/forms/select/select.tsx +67 -31
- package/src/forms/typeahead/machine.ts +253 -0
- package/src/forms/typeahead/typeahead.tsx +70 -62
- package/src/hooks/auto-scroll-machine.ts +261 -0
- package/src/hooks/create-auto-scroll.tsx +110 -205
- package/src/hooks/list-machine.ts +359 -0
- package/src/hooks/use-filtered-list.tsx +101 -112
- package/src/i18n/en.ts +6 -1
- package/src/icons/catalog.ts +8 -0
- package/src/navigation/menu/machine.ts +109 -0
- package/src/navigation/menu/menu.tsx +130 -22
- package/src/navigation/segmented-control/machine.ts +72 -0
- package/src/navigation/segmented-control/segmented-control.tsx +46 -46
- package/src/overlays/dialog/dialog.tsx +7 -1
- package/src/overlays/mcp-sign-in/machine.ts +343 -0
- package/src/overlays/mcp-sign-in/mcp-sign-in.ts +159 -0
- package/src/overlays/tooltip/machine.ts +303 -0
- package/src/overlays/tooltip/tooltip.tsx +157 -92
- package/src/styles/theme.css +10 -2
- package/src/theme/context.tsx +192 -269
- package/src/theme/machine.ts +508 -0
- package/src/typography/text-shimmer/machine.ts +90 -0
- package/src/typography/text-shimmer/text-shimmer.css +71 -39
- package/src/typography/text-shimmer/text-shimmer.tsx +41 -24
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every dropdown menu runs this machine, so each reachable state and event is a frozen module singleton, and an event
|
|
3
|
+
* that changes nothing returns the state it was given.
|
|
4
|
+
*/
|
|
5
|
+
export type MenuInputGesture = "pointer" | "keyboard" | "none";
|
|
6
|
+
/** How the menu opened. An open without an input gesture (a shortcut handler, an async action) is `programmatic`. */
|
|
7
|
+
export type MenuOpenModality = "pointer" | "keyboard" | "programmatic";
|
|
8
|
+
export type MenuState = {
|
|
9
|
+
readonly status: "closed";
|
|
10
|
+
} | {
|
|
11
|
+
readonly status: "open";
|
|
12
|
+
readonly modality: MenuOpenModality;
|
|
13
|
+
readonly outsideInteracted: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Kobalte reports the close first and restores focus a task later, so the modality outlives the open state until
|
|
17
|
+
* that focus restore has run.
|
|
18
|
+
*/
|
|
19
|
+
| {
|
|
20
|
+
readonly status: "closing";
|
|
21
|
+
readonly modality: MenuOpenModality;
|
|
22
|
+
readonly outsideInteracted: boolean;
|
|
23
|
+
} | {
|
|
24
|
+
readonly status: "disposed";
|
|
25
|
+
};
|
|
26
|
+
export type MenuEvent = {
|
|
27
|
+
readonly type: "open.changed";
|
|
28
|
+
readonly open: boolean;
|
|
29
|
+
readonly gesture: MenuInputGesture;
|
|
30
|
+
}
|
|
31
|
+
/** A press outside a non-modal menu, or a context menu anywhere, dismissed it and keeps focus where it landed. */
|
|
32
|
+
| {
|
|
33
|
+
readonly type: "outside.interacted";
|
|
34
|
+
} | {
|
|
35
|
+
readonly type: "close.autofocus";
|
|
36
|
+
} | {
|
|
37
|
+
readonly type: "disposed";
|
|
38
|
+
};
|
|
39
|
+
export declare const MENU_OUTSIDE_INTERACTED: MenuEvent;
|
|
40
|
+
export declare const MENU_CLOSE_AUTOFOCUS: MenuEvent;
|
|
41
|
+
export declare const MENU_DISPOSED: MenuEvent;
|
|
42
|
+
export declare function openChangedEvent(isOpen: boolean, gesture: MenuInputGesture): MenuEvent;
|
|
43
|
+
export declare function createMenuState(initialOpen: boolean): MenuState;
|
|
44
|
+
export declare function transitionMenu(state: MenuState, event: MenuEvent): MenuState;
|
|
45
|
+
/**
|
|
46
|
+
* Restore focus to the trigger without a focus ring: Escape counts as keyboard use, so Chromium would ring a trigger
|
|
47
|
+
* the pointer opened. After an outside press, focus stays where that press put it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function selectMenuRestoreTriggerWithoutRing(state: MenuState): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DropdownMenu } from "@kobalte/core/dropdown-menu";
|
|
1
|
+
import { DropdownMenu, type DropdownMenuTriggerProps } from "@kobalte/core/dropdown-menu";
|
|
2
2
|
import { ContextMenu } from "@kobalte/core/context-menu";
|
|
3
|
-
import
|
|
3
|
+
import type { PolymorphicProps } from "@kobalte/core/polymorphic";
|
|
4
|
+
import { type ComponentProps, type JSX, type ParentProps, type ValidComponent } from "solid-js";
|
|
4
5
|
import "./menu.css";
|
|
5
6
|
export type MenuAppearance = "standard" | "compact";
|
|
6
7
|
export interface MenuItemProps extends ComponentProps<typeof DropdownMenu.Item> {
|
|
@@ -30,6 +31,7 @@ declare function MenuSubTrigger(props: ParentProps<MenuSubTriggerProps>): JSX.El
|
|
|
30
31
|
declare function MenuSubContent(props: ComponentProps<typeof DropdownMenu.SubContent>): JSX.Element;
|
|
31
32
|
declare function MenuGroupLabel(props: ComponentProps<typeof DropdownMenu.GroupLabel>): JSX.Element;
|
|
32
33
|
declare function MenuSeparator(props: ComponentProps<typeof DropdownMenu.Separator>): JSX.Element;
|
|
34
|
+
declare function MenuTrigger<T extends ValidComponent = "button">(props: PolymorphicProps<T, DropdownMenuTriggerProps<T>>): JSX.Element;
|
|
33
35
|
declare function MenuContent(props: ComponentProps<typeof DropdownMenu.Content>): JSX.Element;
|
|
34
36
|
export interface MenuProps extends ComponentProps<typeof DropdownMenu> {
|
|
35
37
|
appearance?: MenuAppearance;
|
|
@@ -41,7 +43,7 @@ export interface MenuContextProps extends ComponentProps<typeof ContextMenu> {
|
|
|
41
43
|
declare function MenuContextRoot(props: MenuContextProps): JSX.Element;
|
|
42
44
|
declare function MenuContextContent(props: ComponentProps<typeof ContextMenu.Content>): JSX.Element;
|
|
43
45
|
export declare const Menu: typeof MenuRoot & {
|
|
44
|
-
Trigger: typeof
|
|
46
|
+
Trigger: typeof MenuTrigger;
|
|
45
47
|
Portal: typeof import("@kobalte/core/context-menu").Portal;
|
|
46
48
|
Content: typeof MenuContent;
|
|
47
49
|
Item: typeof MenuItem;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type IndicatorBox = {
|
|
2
|
+
readonly x: number;
|
|
3
|
+
readonly width: number;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The pill behind the selected segment. It is `placed` only while the selected segment has a measurable box, so a
|
|
7
|
+
* selection that changes while the control is hidden (`display: none`) jumps to its segment once it shows instead
|
|
8
|
+
* of springing from the previous segment's stale position.
|
|
9
|
+
*/
|
|
10
|
+
export type SegmentedIndicatorState = {
|
|
11
|
+
readonly status: "hidden";
|
|
12
|
+
} | {
|
|
13
|
+
readonly status: "placed";
|
|
14
|
+
readonly value: string;
|
|
15
|
+
readonly box: IndicatorBox;
|
|
16
|
+
} | {
|
|
17
|
+
readonly status: "disposed";
|
|
18
|
+
};
|
|
19
|
+
export type SegmentedIndicatorEvent = {
|
|
20
|
+
readonly type: "measured";
|
|
21
|
+
readonly value: string | null;
|
|
22
|
+
readonly box: IndicatorBox | null;
|
|
23
|
+
readonly reducedMotion: boolean;
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: "disposed";
|
|
26
|
+
};
|
|
27
|
+
export type SegmentedIndicatorEffect = {
|
|
28
|
+
readonly type: "jump";
|
|
29
|
+
readonly box: IndicatorBox;
|
|
30
|
+
} | {
|
|
31
|
+
readonly type: "animate";
|
|
32
|
+
readonly box: IndicatorBox;
|
|
33
|
+
} | {
|
|
34
|
+
readonly type: "stop";
|
|
35
|
+
};
|
|
36
|
+
export type SegmentedIndicatorTransition = {
|
|
37
|
+
readonly state: SegmentedIndicatorState;
|
|
38
|
+
readonly effect: SegmentedIndicatorEffect | null;
|
|
39
|
+
};
|
|
40
|
+
export declare const HIDDEN_INDICATOR: SegmentedIndicatorState;
|
|
41
|
+
export declare function transitionSegmentedIndicator(state: SegmentedIndicatorState, event: SegmentedIndicatorEvent): SegmentedIndicatorTransition;
|
|
42
|
+
export declare function selectIndicatorReady(state: SegmentedIndicatorState): state is {
|
|
43
|
+
readonly status: "placed";
|
|
44
|
+
readonly value: string;
|
|
45
|
+
readonly box: IndicatorBox;
|
|
46
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/** Delay between OAuth status polls while the attempt is pending or the server is unreachable. */
|
|
2
|
+
export declare const MCP_SIGN_IN_POLL_MS = 1000;
|
|
3
|
+
/** How long the MCP server and resource sync after a sign-in may run before it shows a retryable error. */
|
|
4
|
+
export declare const MCP_SIGN_IN_SYNC_TIMEOUT_MS = 30000;
|
|
5
|
+
/** The server's answer to a status poll of the sign-in attempt. */
|
|
6
|
+
export type McpSignInAttemptStatus = {
|
|
7
|
+
readonly status: "pending" | "complete" | "expired";
|
|
8
|
+
} | {
|
|
9
|
+
readonly status: "failed";
|
|
10
|
+
readonly message: string;
|
|
11
|
+
};
|
|
12
|
+
export type McpSignInPollOutcome = {
|
|
13
|
+
readonly status: "pending";
|
|
14
|
+
} | {
|
|
15
|
+
readonly status: "complete";
|
|
16
|
+
} | {
|
|
17
|
+
readonly status: "failed";
|
|
18
|
+
readonly message: string;
|
|
19
|
+
} | {
|
|
20
|
+
readonly status: "expired";
|
|
21
|
+
}
|
|
22
|
+
/** The status request threw; the attempt may still be open on the server until its lifetime ends. */
|
|
23
|
+
| {
|
|
24
|
+
readonly status: "unreachable";
|
|
25
|
+
readonly message: string;
|
|
26
|
+
};
|
|
27
|
+
export type McpSignInEntryError = {
|
|
28
|
+
readonly type: "required";
|
|
29
|
+
} | {
|
|
30
|
+
readonly type: "rejected";
|
|
31
|
+
readonly message: string;
|
|
32
|
+
};
|
|
33
|
+
export type McpSignInFailure = {
|
|
34
|
+
readonly type: "auth-expired";
|
|
35
|
+
} | {
|
|
36
|
+
readonly type: "auth-failed";
|
|
37
|
+
readonly message: string;
|
|
38
|
+
}
|
|
39
|
+
/** The sign-in succeeded, but reloading the MCP lists failed; a retry reloads them again. */
|
|
40
|
+
| {
|
|
41
|
+
readonly type: "sync-failed";
|
|
42
|
+
readonly message: string;
|
|
43
|
+
} | {
|
|
44
|
+
readonly type: "sync-timed-out";
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* An MCP sign-in that also accepts the redirect URL pasted from the browser. Requests take attempt numbers from
|
|
48
|
+
* `issued`, so a result whose attempt the state no longer holds is stale.
|
|
49
|
+
*/
|
|
50
|
+
export type McpSignInState = {
|
|
51
|
+
readonly status: "waiting";
|
|
52
|
+
readonly url: string;
|
|
53
|
+
readonly issued: number;
|
|
54
|
+
readonly pollAttempt: number;
|
|
55
|
+
readonly value: string;
|
|
56
|
+
/** The server accepted a pasted redirect URL and finishes the sign-in; the status poll reports the outcome. */
|
|
57
|
+
readonly pasteAccepted: boolean;
|
|
58
|
+
readonly entryError: McpSignInEntryError | undefined;
|
|
59
|
+
/** The last status request failed; shown if the attempt's lifetime ends before the server answers again. */
|
|
60
|
+
readonly unreachableError: string | undefined;
|
|
61
|
+
} | {
|
|
62
|
+
readonly status: "submitting";
|
|
63
|
+
readonly url: string;
|
|
64
|
+
readonly issued: number;
|
|
65
|
+
readonly pollAttempt: number;
|
|
66
|
+
readonly submitAttempt: number;
|
|
67
|
+
readonly value: string;
|
|
68
|
+
readonly unreachableError: string | undefined;
|
|
69
|
+
}
|
|
70
|
+
/** The sign-in succeeded; the MCP server and resource lists reload before the dialog closes. */
|
|
71
|
+
| {
|
|
72
|
+
readonly status: "completing";
|
|
73
|
+
readonly url: string;
|
|
74
|
+
readonly issued: number;
|
|
75
|
+
readonly syncAttempt: number;
|
|
76
|
+
} | {
|
|
77
|
+
readonly status: "failed";
|
|
78
|
+
readonly url: string;
|
|
79
|
+
readonly issued: number;
|
|
80
|
+
readonly failure: McpSignInFailure;
|
|
81
|
+
} | {
|
|
82
|
+
readonly status: "done";
|
|
83
|
+
} | {
|
|
84
|
+
readonly status: "disposed";
|
|
85
|
+
};
|
|
86
|
+
export type McpSignInEvent = {
|
|
87
|
+
readonly type: "browser.open";
|
|
88
|
+
} | {
|
|
89
|
+
readonly type: "paste.changed";
|
|
90
|
+
readonly value: string;
|
|
91
|
+
} | {
|
|
92
|
+
readonly type: "paste.submitted";
|
|
93
|
+
} | {
|
|
94
|
+
readonly type: "polled";
|
|
95
|
+
readonly pollAttempt: number;
|
|
96
|
+
readonly outcome: McpSignInPollOutcome;
|
|
97
|
+
} | {
|
|
98
|
+
readonly type: "submit.succeeded";
|
|
99
|
+
readonly submitAttempt: number;
|
|
100
|
+
} | {
|
|
101
|
+
readonly type: "submit.failed";
|
|
102
|
+
readonly submitAttempt: number;
|
|
103
|
+
readonly message: string;
|
|
104
|
+
}
|
|
105
|
+
/** The attempt's lifetime ended before the server reported an outcome. */
|
|
106
|
+
| {
|
|
107
|
+
readonly type: "waiting.timed-out";
|
|
108
|
+
} | {
|
|
109
|
+
readonly type: "sync.succeeded";
|
|
110
|
+
readonly syncAttempt: number;
|
|
111
|
+
} | {
|
|
112
|
+
readonly type: "sync.failed";
|
|
113
|
+
readonly syncAttempt: number;
|
|
114
|
+
readonly message: string;
|
|
115
|
+
} | {
|
|
116
|
+
readonly type: "sync.timed-out";
|
|
117
|
+
readonly syncAttempt: number;
|
|
118
|
+
} | {
|
|
119
|
+
readonly type: "retry.requested";
|
|
120
|
+
} | {
|
|
121
|
+
readonly type: "disposed";
|
|
122
|
+
};
|
|
123
|
+
export type McpSignInEffect = {
|
|
124
|
+
readonly type: "deadline.start";
|
|
125
|
+
readonly delayMs: number;
|
|
126
|
+
} | {
|
|
127
|
+
readonly type: "deadline.clear";
|
|
128
|
+
}
|
|
129
|
+
/** Aborts the poll in flight or scheduled, then polls the attempt's status after `delayMs`. */
|
|
130
|
+
| {
|
|
131
|
+
readonly type: "poll";
|
|
132
|
+
readonly pollAttempt: number;
|
|
133
|
+
readonly delayMs: number;
|
|
134
|
+
} | {
|
|
135
|
+
readonly type: "poll.abort";
|
|
136
|
+
} | {
|
|
137
|
+
readonly type: "submit";
|
|
138
|
+
readonly submitAttempt: number;
|
|
139
|
+
readonly code: string;
|
|
140
|
+
} | {
|
|
141
|
+
readonly type: "submit.abort";
|
|
142
|
+
}
|
|
143
|
+
/** Reloads the MCP server and resource lists, reporting back within `timeoutMs`. */
|
|
144
|
+
| {
|
|
145
|
+
readonly type: "sync";
|
|
146
|
+
readonly syncAttempt: number;
|
|
147
|
+
readonly timeoutMs: number;
|
|
148
|
+
} | {
|
|
149
|
+
readonly type: "sync.clear";
|
|
150
|
+
}
|
|
151
|
+
/** Reloads the MCP lists without reporting back, for a sign-in the server finishes after the dialog closed. */
|
|
152
|
+
| {
|
|
153
|
+
readonly type: "refresh";
|
|
154
|
+
} | {
|
|
155
|
+
readonly type: "open-external";
|
|
156
|
+
readonly url: string;
|
|
157
|
+
}
|
|
158
|
+
/** Ends the attempt on the server, so a late browser callback cannot connect the server. */
|
|
159
|
+
| {
|
|
160
|
+
readonly type: "cancel";
|
|
161
|
+
} | {
|
|
162
|
+
readonly type: "close";
|
|
163
|
+
};
|
|
164
|
+
export type McpSignInTransition = {
|
|
165
|
+
readonly state: McpSignInState;
|
|
166
|
+
readonly effects: readonly McpSignInEffect[];
|
|
167
|
+
};
|
|
168
|
+
export declare function startMcpSignIn(input: {
|
|
169
|
+
url: string;
|
|
170
|
+
lifetimeMs: number;
|
|
171
|
+
}): McpSignInTransition;
|
|
172
|
+
export declare function transitionMcpSignIn(state: McpSignInState, event: McpSignInEvent): McpSignInTransition;
|
|
173
|
+
export declare function selectMcpSignInView(state: McpSignInState): {
|
|
174
|
+
status: "completing" | "disposed" | "done" | "failed" | "submitting" | "waiting";
|
|
175
|
+
failure: McpSignInFailure | undefined;
|
|
176
|
+
canRetry: boolean;
|
|
177
|
+
showOpenBrowser: boolean;
|
|
178
|
+
showForm: boolean;
|
|
179
|
+
value: string;
|
|
180
|
+
entryError: McpSignInEntryError | undefined;
|
|
181
|
+
locked: boolean;
|
|
182
|
+
submitting: boolean;
|
|
183
|
+
};
|
|
184
|
+
export type McpSignInView = ReturnType<typeof selectMcpSignInView>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type McpSignInAttemptStatus, type McpSignInEvent } from "./machine";
|
|
2
|
+
export type { McpSignInAttemptStatus, McpSignInFailure, McpSignInView } from "./machine";
|
|
3
|
+
/** The server and host calls of one MCP sign-in; the app and the details plugin bind them to their own SDK. */
|
|
4
|
+
export type McpSignInHost = {
|
|
5
|
+
/** The authorization URL the browser opens. */
|
|
6
|
+
url: string;
|
|
7
|
+
/** The attempt's lifetime in milliseconds, from the server's `time`; the two clocks may disagree. */
|
|
8
|
+
lifetime: number;
|
|
9
|
+
/** Polls the attempt's status. */
|
|
10
|
+
status: (signal: AbortSignal) => Promise<McpSignInAttemptStatus>;
|
|
11
|
+
/** Sends a redirect URL pasted from the browser. */
|
|
12
|
+
complete: (code: string, signal: AbortSignal) => Promise<void>;
|
|
13
|
+
/** Ends the attempt on the server. */
|
|
14
|
+
cancel: () => Promise<void>;
|
|
15
|
+
/** Reloads the MCP server and resource lists after the sign-in succeeded. */
|
|
16
|
+
sync: () => Promise<void>;
|
|
17
|
+
openExternal: (url: string) => void;
|
|
18
|
+
/** Closes the dialog once the lists reloaded. */
|
|
19
|
+
close: () => void;
|
|
20
|
+
/** The text shown for a failed request. The SDK and the data layer reject with an `Error`. */
|
|
21
|
+
message: (error: Error) => string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Drives an MCP sign-in dialog's machine for the owner's lifetime: polls the attempt, sends a pasted redirect URL,
|
|
25
|
+
* reloads the MCP lists once it succeeded, and cancels an attempt still open when the owner is disposed.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createMcpSignIn(host: McpSignInHost): {
|
|
28
|
+
view: import("solid-js").Accessor<{
|
|
29
|
+
status: "completing" | "disposed" | "done" | "failed" | "submitting" | "waiting";
|
|
30
|
+
failure: import("./machine").McpSignInFailure | undefined;
|
|
31
|
+
canRetry: boolean;
|
|
32
|
+
showOpenBrowser: boolean;
|
|
33
|
+
showForm: boolean;
|
|
34
|
+
value: string;
|
|
35
|
+
entryError: import("./machine").McpSignInEntryError | undefined;
|
|
36
|
+
locked: boolean;
|
|
37
|
+
submitting: boolean;
|
|
38
|
+
}>;
|
|
39
|
+
dispatch: (event: McpSignInEvent) => void;
|
|
40
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every tooltip trigger runs this machine, so it never allocates: each reachable state, event and transition is a
|
|
3
|
+
* frozen module singleton, and an event that changes nothing returns the state it was given.
|
|
4
|
+
*/
|
|
5
|
+
export type TooltipState =
|
|
6
|
+
/** Kobalte is not mounted yet. Most triggers are never hovered, so it mounts on the first hover or focus. */
|
|
7
|
+
{
|
|
8
|
+
readonly status: "unmounted";
|
|
9
|
+
readonly disabled: boolean;
|
|
10
|
+
} | {
|
|
11
|
+
readonly status: "idle";
|
|
12
|
+
readonly hovered: boolean;
|
|
13
|
+
readonly disabled: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** `pressing` lasts from a press on the trigger until that press ends, so its click keeps the tooltip open. */
|
|
16
|
+
| {
|
|
17
|
+
readonly status: "open";
|
|
18
|
+
readonly hovered: boolean;
|
|
19
|
+
readonly pressing: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A popup the trigger opened (a menu, a popover) hides the tooltip. While it is open, a modal layer turns pointer
|
|
23
|
+
* events off for the page, so the trigger's own enter and leave events lie and `hovered` follows the pointer's
|
|
24
|
+
* position instead. Once it closes over a hovered trigger, the tooltip stays hidden until the pointer moves off the
|
|
25
|
+
* trigger or the trigger itself takes focus.
|
|
26
|
+
*/
|
|
27
|
+
| {
|
|
28
|
+
readonly status: "suppressed";
|
|
29
|
+
readonly popup: "open";
|
|
30
|
+
readonly hovered: boolean;
|
|
31
|
+
readonly disabled: boolean;
|
|
32
|
+
} | {
|
|
33
|
+
readonly status: "suppressed";
|
|
34
|
+
readonly popup: "closed";
|
|
35
|
+
readonly disabled: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** The caller sets `forceOpen`. `expanded` tracks the popup so releasing control can suppress the tooltip. */
|
|
38
|
+
| {
|
|
39
|
+
readonly status: "controlled";
|
|
40
|
+
readonly open: boolean;
|
|
41
|
+
readonly hovered: boolean;
|
|
42
|
+
readonly expanded: boolean;
|
|
43
|
+
readonly disabled: boolean;
|
|
44
|
+
} | {
|
|
45
|
+
readonly status: "disposed";
|
|
46
|
+
};
|
|
47
|
+
export type TooltipEvent = {
|
|
48
|
+
readonly type: "props.synced";
|
|
49
|
+
readonly forceOpen: boolean | undefined;
|
|
50
|
+
readonly disabled: boolean;
|
|
51
|
+
}
|
|
52
|
+
/** The pointer entered or left the trigger. Touch never hovers. */
|
|
53
|
+
| {
|
|
54
|
+
readonly type: "pointer.entered";
|
|
55
|
+
} | {
|
|
56
|
+
readonly type: "pointer.left";
|
|
57
|
+
}
|
|
58
|
+
/** Where a pointer move landed while a popup suppresses the tooltip, measured against the trigger's box. */
|
|
59
|
+
| {
|
|
60
|
+
readonly type: "pointer.moved";
|
|
61
|
+
readonly inside: boolean;
|
|
62
|
+
}
|
|
63
|
+
/** The trigger element itself took focus. */
|
|
64
|
+
| {
|
|
65
|
+
readonly type: "focused";
|
|
66
|
+
} | {
|
|
67
|
+
readonly type: "trigger.pressed";
|
|
68
|
+
}
|
|
69
|
+
/** The press ended, after the click it caused, if any. */
|
|
70
|
+
| {
|
|
71
|
+
readonly type: "press.ended";
|
|
72
|
+
}
|
|
73
|
+
/** The microtask after the pointer left, once Kobalte has seen the tooltip open and started its skip-delay window. */
|
|
74
|
+
| {
|
|
75
|
+
readonly type: "leave.settled";
|
|
76
|
+
} | {
|
|
77
|
+
readonly type: "popup.changed";
|
|
78
|
+
readonly expanded: boolean;
|
|
79
|
+
} | {
|
|
80
|
+
readonly type: "kobalte.changed";
|
|
81
|
+
readonly open: boolean;
|
|
82
|
+
} | {
|
|
83
|
+
readonly type: "disposed";
|
|
84
|
+
};
|
|
85
|
+
/** `replay` forwards the mounting hover or focus to Kobalte, which attached its listeners too late to receive it. */
|
|
86
|
+
export type TooltipEffect = "replay" | "schedule-leave";
|
|
87
|
+
export type TooltipTransition = {
|
|
88
|
+
readonly state: TooltipState;
|
|
89
|
+
readonly effects: readonly TooltipEffect[];
|
|
90
|
+
};
|
|
91
|
+
export declare const POINTER_ENTERED: TooltipEvent;
|
|
92
|
+
export declare const POINTER_LEFT: TooltipEvent;
|
|
93
|
+
export declare const POINTER_INSIDE: TooltipEvent;
|
|
94
|
+
export declare const POINTER_OUTSIDE: TooltipEvent;
|
|
95
|
+
export declare const FOCUSED: TooltipEvent;
|
|
96
|
+
export declare const TRIGGER_PRESSED: TooltipEvent;
|
|
97
|
+
export declare const PRESS_ENDED: TooltipEvent;
|
|
98
|
+
export declare const LEAVE_SETTLED: TooltipEvent;
|
|
99
|
+
export declare const POPUP_EXPANDED: TooltipEvent;
|
|
100
|
+
export declare const POPUP_COLLAPSED: TooltipEvent;
|
|
101
|
+
export declare const KOBALTE_OPENED: TooltipEvent;
|
|
102
|
+
export declare const KOBALTE_CLOSED: TooltipEvent;
|
|
103
|
+
export declare const DISPOSED_EVENT: TooltipEvent;
|
|
104
|
+
export declare function syncPropsEvent(forceOpen: boolean | undefined, disabled: boolean): TooltipEvent;
|
|
105
|
+
export declare function createTooltipState(forceOpen: boolean | undefined, disabled: boolean): TooltipState;
|
|
106
|
+
export declare function transitionTooltip(state: TooltipState, event: TooltipEvent): TooltipTransition;
|
|
107
|
+
/** Kobalte is mounted: the trigger owns its listeners and the popup observer runs. */
|
|
108
|
+
export declare function selectTooltipMounted(state: TooltipState): state is {
|
|
109
|
+
readonly status: "idle";
|
|
110
|
+
readonly hovered: boolean;
|
|
111
|
+
readonly disabled: boolean;
|
|
112
|
+
} | {
|
|
113
|
+
readonly status: "open";
|
|
114
|
+
readonly hovered: boolean;
|
|
115
|
+
readonly pressing: boolean;
|
|
116
|
+
} | {
|
|
117
|
+
readonly status: "suppressed";
|
|
118
|
+
readonly popup: "open";
|
|
119
|
+
readonly hovered: boolean;
|
|
120
|
+
readonly disabled: boolean;
|
|
121
|
+
} | {
|
|
122
|
+
readonly status: "suppressed";
|
|
123
|
+
readonly popup: "closed";
|
|
124
|
+
readonly disabled: boolean;
|
|
125
|
+
} | {
|
|
126
|
+
readonly status: "controlled";
|
|
127
|
+
readonly open: boolean;
|
|
128
|
+
readonly hovered: boolean;
|
|
129
|
+
readonly expanded: boolean;
|
|
130
|
+
readonly disabled: boolean;
|
|
131
|
+
};
|
|
132
|
+
export declare function selectTooltipOpen(state: TooltipState): boolean;
|
|
133
|
+
export declare function selectTooltipForceOpen(state: TooltipState): boolean | undefined;
|
|
134
|
+
/** A press is in progress, so the driver listens for its end. */
|
|
135
|
+
export declare function selectTooltipPressing(state: TooltipState): boolean;
|
|
136
|
+
/** A popup suppresses the tooltip, so the driver reports where the pointer moves. */
|
|
137
|
+
export declare function selectTooltipTracking(state: TooltipState): state is {
|
|
138
|
+
readonly status: "suppressed";
|
|
139
|
+
readonly popup: "open";
|
|
140
|
+
readonly hovered: boolean;
|
|
141
|
+
readonly disabled: boolean;
|
|
142
|
+
} | {
|
|
143
|
+
readonly status: "suppressed";
|
|
144
|
+
readonly popup: "closed";
|
|
145
|
+
readonly disabled: boolean;
|
|
146
|
+
};
|
package/dist/theme/context.d.ts
CHANGED
|
@@ -1,38 +1,62 @@
|
|
|
1
1
|
import type { DesktopTheme } from "./types";
|
|
2
|
-
|
|
2
|
+
import { type ColorScheme } from "./machine";
|
|
3
|
+
export type { ColorScheme } from "./machine";
|
|
3
4
|
export declare const { use: useTheme, provider: ThemeProvider }: {
|
|
4
5
|
context: import("solid-js").Context<{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/** The theme the window shows: a previewed one, the selected one, or the default while that one is not coming. */
|
|
7
|
+
themeId: import("solid-js").Accessor<string>;
|
|
8
|
+
colorScheme: import("solid-js").Accessor<ColorScheme>;
|
|
9
|
+
/** The mode the window shows, a previewed scheme included. */
|
|
10
|
+
mode: import("solid-js").Accessor<import("./machine").ResolvedMode>;
|
|
8
11
|
ids: () => string[];
|
|
9
12
|
name: (id: string) => string;
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
/** Loads every bundled theme; resolves once each import has loaded, failed or timed out. */
|
|
14
|
+
loadThemes: () => Promise<Readonly<Record<string, DesktopTheme>>>;
|
|
15
|
+
themes: () => Readonly<Record<string, DesktopTheme>>;
|
|
12
16
|
setTheme: (id: string) => void;
|
|
13
17
|
setColorScheme: (scheme: ColorScheme) => void;
|
|
14
|
-
|
|
18
|
+
/** Lists a theme beside the bundled ones until the returned function withdraws it. */
|
|
19
|
+
registerTheme: (theme: DesktopTheme) => () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Every theme source has registered what it will: a selected theme that is still missing is not coming, so the
|
|
22
|
+
* window shows the default theme and keeps the choice for when it returns.
|
|
23
|
+
*/
|
|
24
|
+
settle: () => void;
|
|
25
|
+
/** Shows a theme without saving it, until `commitPreview` or `cancelPreview`. */
|
|
15
26
|
previewTheme: (id: string) => void;
|
|
27
|
+
/** Shows a color scheme without saving it, until `commitPreview` or `cancelPreview`. */
|
|
16
28
|
previewColorScheme: (scheme: ColorScheme) => void;
|
|
17
29
|
commitPreview: () => void;
|
|
18
30
|
cancelPreview: () => void;
|
|
19
31
|
} | undefined>;
|
|
20
32
|
provider: (props: import("solid-js").ParentProps<{
|
|
21
33
|
defaultTheme?: string;
|
|
22
|
-
|
|
34
|
+
/** The window shows the theme: its colors, or until a registered theme arrives, those cached from the last run. */
|
|
35
|
+
onThemeApplied?: (mode: "light" | "dark", scheme: ColorScheme) => void;
|
|
23
36
|
}>) => import("solid-js").JSX.Element;
|
|
24
37
|
use(): {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
/** The theme the window shows: a previewed one, the selected one, or the default while that one is not coming. */
|
|
39
|
+
themeId: import("solid-js").Accessor<string>;
|
|
40
|
+
colorScheme: import("solid-js").Accessor<ColorScheme>;
|
|
41
|
+
/** The mode the window shows, a previewed scheme included. */
|
|
42
|
+
mode: import("solid-js").Accessor<import("./machine").ResolvedMode>;
|
|
28
43
|
ids: () => string[];
|
|
29
44
|
name: (id: string) => string;
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
/** Loads every bundled theme; resolves once each import has loaded, failed or timed out. */
|
|
46
|
+
loadThemes: () => Promise<Readonly<Record<string, DesktopTheme>>>;
|
|
47
|
+
themes: () => Readonly<Record<string, DesktopTheme>>;
|
|
32
48
|
setTheme: (id: string) => void;
|
|
33
49
|
setColorScheme: (scheme: ColorScheme) => void;
|
|
34
|
-
|
|
50
|
+
/** Lists a theme beside the bundled ones until the returned function withdraws it. */
|
|
51
|
+
registerTheme: (theme: DesktopTheme) => () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Every theme source has registered what it will: a selected theme that is still missing is not coming, so the
|
|
54
|
+
* window shows the default theme and keeps the choice for when it returns.
|
|
55
|
+
*/
|
|
56
|
+
settle: () => void;
|
|
57
|
+
/** Shows a theme without saving it, until `commitPreview` or `cancelPreview`. */
|
|
35
58
|
previewTheme: (id: string) => void;
|
|
59
|
+
/** Shows a color scheme without saving it, until `commitPreview` or `cancelPreview`. */
|
|
36
60
|
previewColorScheme: (scheme: ColorScheme) => void;
|
|
37
61
|
commitPreview: () => void;
|
|
38
62
|
cancelPreview: () => void;
|