@ai-matrx/canvas 0.1.1 → 0.2.0
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/CHANGELOG.md +26 -0
- package/README.md +114 -4
- package/dist/controller-Dv6J6XZm.d.cts +576 -0
- package/dist/controller-Dv6J6XZm.d.ts +576 -0
- package/dist/index.cjs +743 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +118 -11
- package/dist/index.d.ts +118 -11
- package/dist/index.js +743 -104
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +1476 -406
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +242 -22
- package/dist/react.d.ts +242 -22
- package/dist/react.js +1486 -404
- package/dist/react.js.map +1 -1
- package/dist/styles.css +346 -51
- package/dist/tokens.css +58 -36
- package/package.json +1 -1
- package/dist/controller-oY84BN2c.d.cts +0 -345
- package/dist/controller-oY84BN2c.d.ts +0 -345
package/dist/react.d.cts
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ComponentType, ReactNode, CSSProperties } from 'react';
|
|
3
|
-
import { a as CanvasJson,
|
|
2
|
+
import { ComponentType, ReactNode, CSSProperties, ButtonHTMLAttributes, HTMLAttributes, ReactElement } from 'react';
|
|
3
|
+
import { D as CanvasRect, d as CanvasPaneId, C as CanvasItemId, a as CanvasWindowId, b as CanvasJson, i as CanvasItem, h as CanvasController, G as CanvasSessionEvent, E as CanvasSessionAttachReason, F as CanvasSessionDetachReason, e as CanvasStoreBinding, B as CanvasPersistencePort, v as CanvasErrorSink, x as CanvasLayoutRules, f as CanvasState } from './controller-Dv6J6XZm.cjs';
|
|
4
|
+
|
|
5
|
+
/** One floating thing. Plain data, so a host can draw it in another process. */
|
|
6
|
+
type CanvasFloating = {
|
|
7
|
+
readonly type: "tooltip";
|
|
8
|
+
readonly text: string;
|
|
9
|
+
readonly anchor: CanvasRect;
|
|
10
|
+
readonly side: "top" | "bottom";
|
|
11
|
+
} | {
|
|
12
|
+
readonly type: "drop-indicator";
|
|
13
|
+
readonly rect: CanvasRect;
|
|
14
|
+
readonly paneId: CanvasPaneId;
|
|
15
|
+
} | {
|
|
16
|
+
readonly type: "tab-drag";
|
|
17
|
+
readonly itemId: CanvasItemId;
|
|
18
|
+
readonly title: string;
|
|
19
|
+
};
|
|
20
|
+
interface CanvasOverlayPort {
|
|
21
|
+
/** Shows a floating element above everything (native views included); returns its remover. */
|
|
22
|
+
show(element: CanvasFloating): () => void;
|
|
23
|
+
}
|
|
24
|
+
/** A serializable "…" menu: the package keeps the handlers, a host draws the entries. */
|
|
25
|
+
type CanvasMenuEntry = {
|
|
26
|
+
readonly type: "item";
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly label: string;
|
|
29
|
+
readonly destructive?: boolean;
|
|
30
|
+
} | {
|
|
31
|
+
readonly type: "separator";
|
|
32
|
+
};
|
|
33
|
+
/** Shows a menu at `anchor` (e.g. Electron `Menu.popup`); resolves the chosen entry id, or null. */
|
|
34
|
+
type CanvasShowMenu = (entries: readonly CanvasMenuEntry[], anchor: CanvasRect) => Promise<string | null>;
|
|
35
|
+
/** A native body's frame: window CSS pixels plus the device pixel ratio. */
|
|
36
|
+
interface CanvasNativeRect extends CanvasRect {
|
|
37
|
+
readonly devicePixelRatio: number;
|
|
38
|
+
}
|
|
39
|
+
interface CanvasNativeBodyInfo {
|
|
40
|
+
/** False while package DOM floats over the canvas (a DOM menu, a tab drag): hide the native view. */
|
|
41
|
+
readonly visible: boolean;
|
|
42
|
+
readonly windowId: CanvasWindowId;
|
|
43
|
+
}
|
|
44
|
+
/** Reports where a native body sits; null when it is hidden or gone. Called in the frame the layout changed. */
|
|
45
|
+
type CanvasNativeBodyFrame = (itemId: CanvasItemId, rect: CanvasNativeRect | null, info: CanvasNativeBodyInfo) => void;
|
|
4
46
|
|
|
5
47
|
/**
|
|
6
48
|
* THE canvas kind registry. A kind is one sort of thing the canvas can show —
|
|
@@ -24,7 +66,9 @@ interface CanvasKindProps<TData extends CanvasJson = CanvasJson> {
|
|
|
24
66
|
readonly data: TData;
|
|
25
67
|
readonly paneId: CanvasPaneId;
|
|
26
68
|
readonly isFocused: boolean;
|
|
69
|
+
/** The canvas, acting for the window this pane is in. */
|
|
27
70
|
readonly canvas: CanvasController;
|
|
71
|
+
readonly windowId: CanvasWindowId;
|
|
28
72
|
}
|
|
29
73
|
interface CanvasMenuItem {
|
|
30
74
|
readonly id: string;
|
|
@@ -40,7 +84,7 @@ interface CanvasKind<TData extends CanvasJson = CanvasJson> {
|
|
|
40
84
|
readonly icon: ComponentType<{
|
|
41
85
|
className?: string;
|
|
42
86
|
}>;
|
|
43
|
-
/** Eager component. Provide this OR `load
|
|
87
|
+
/** Eager component. Provide this OR `load` (optional for a native body or an `unavailable` placeholder). */
|
|
44
88
|
readonly component?: ComponentType<CanvasKindProps<TData>>;
|
|
45
89
|
/** Lazy component — the kind's code loads only when a tab of it renders. */
|
|
46
90
|
readonly load?: () => Promise<{
|
|
@@ -48,16 +92,45 @@ interface CanvasKind<TData extends CanvasJson = CanvasJson> {
|
|
|
48
92
|
}>;
|
|
49
93
|
/** Tab title from the item's data. Falls back to the item's title, then `label`. */
|
|
50
94
|
readonly title?: (data: TData, item: CanvasItem) => string;
|
|
51
|
-
/**
|
|
52
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Comes back after a reload. Default true; false for live things that cannot
|
|
97
|
+
* resume. "session": the tab is a view onto a process the HOST keeps (a
|
|
98
|
+
* terminal) — it comes back, closing it DETACHES (onDetach) instead of
|
|
99
|
+
* killing, and a restore or a move REATTACHES (onAttach).
|
|
100
|
+
*/
|
|
101
|
+
readonly restore?: boolean | "session";
|
|
102
|
+
/** restore "session": the session's key. Default: `data.sessionKey` when it is a string. */
|
|
103
|
+
readonly sessionKey?: (data: TData, item: CanvasItem) => string | null;
|
|
104
|
+
/** restore "session": the tab now shows this session ("open" | "restore" | "arrive"). */
|
|
105
|
+
readonly onAttach?: (event: CanvasSessionEvent<CanvasSessionAttachReason>) => void;
|
|
106
|
+
/** restore "session": the tab no longer shows it ("close" | "leave" | "unmount"). Never kill the process here. */
|
|
107
|
+
readonly onDetach?: (event: CanvasSessionEvent<CanvasSessionDetachReason>) => void;
|
|
53
108
|
/** Stays mounted while its tab is in the background (live chat, a running tool). */
|
|
54
109
|
readonly keepAlive?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* "native": the body is drawn by the HOST outside the DOM (an Electron
|
|
112
|
+
* WebContentsView). The pane renders a placeholder and reports its rect
|
|
113
|
+
* through the provider's `onNativeBodyFrame`. Default "dom".
|
|
114
|
+
*/
|
|
115
|
+
readonly body?: "dom" | "native";
|
|
116
|
+
/**
|
|
117
|
+
* An honest one-line state instead of the body while its backend is not
|
|
118
|
+
* there ("Files · next release", "No changes to show"). Return null to show
|
|
119
|
+
* the body. Read on every render.
|
|
120
|
+
*/
|
|
121
|
+
readonly unavailable?: (data: TData, item: CanvasItem) => string | null;
|
|
55
122
|
/** When set, the kind is offered in an empty pane's launcher. */
|
|
56
123
|
readonly launcher?: {
|
|
57
124
|
readonly key: string;
|
|
58
125
|
readonly data: TData;
|
|
59
126
|
readonly title?: string;
|
|
60
127
|
};
|
|
128
|
+
/**
|
|
129
|
+
* Controls at the START of the pane header, after the title or tabs: a
|
|
130
|
+
* "+ new terminal", a browser's back / forward / reload / address bar. The
|
|
131
|
+
* slot grows to fill the header.
|
|
132
|
+
*/
|
|
133
|
+
readonly HeaderLeading?: ComponentType<CanvasKindProps<TData>>;
|
|
61
134
|
/** The kind's own button, rendered left of the pane's "…" menu. */
|
|
62
135
|
readonly HeaderAction?: ComponentType<CanvasKindProps<TData>>;
|
|
63
136
|
/** Kind-specific entries for the pane's "…" menu. */
|
|
@@ -70,6 +143,8 @@ type AnyCanvasKind = CanvasKind<CanvasJson>;
|
|
|
70
143
|
* the registry stores the erased form (the cast is the one registration seam).
|
|
71
144
|
*/
|
|
72
145
|
declare function defineCanvasKind<TData extends CanvasJson>(kind: CanvasKind<TData>): AnyCanvasKind;
|
|
146
|
+
/** The session key of an item of a session kind (`kind.sessionKey`, else `data.sessionKey`). */
|
|
147
|
+
declare function canvasSessionKey(kind: AnyCanvasKind, item: CanvasItem): string | null;
|
|
73
148
|
/** Registers (or replaces) a kind. Returns an unregister function. */
|
|
74
149
|
declare function registerCanvasKind(kind: AnyCanvasKind): () => void;
|
|
75
150
|
declare function registerCanvasKinds(kinds: readonly AnyCanvasKind[]): () => void;
|
|
@@ -77,33 +152,75 @@ declare function getCanvasKind(id: string): AnyCanvasKind | undefined;
|
|
|
77
152
|
declare function listCanvasKinds(): AnyCanvasKind[];
|
|
78
153
|
|
|
79
154
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
155
|
+
* What the host answers ONCE for every kind. Saving, sharing and history are
|
|
156
|
+
* "handled globally" here; the window ports let a desktop host draw floating
|
|
157
|
+
* things and native bodies its own way. Every port has a working default.
|
|
83
158
|
*/
|
|
84
159
|
interface CanvasHostPorts {
|
|
85
160
|
/** Extra "…" menu entries for an item (share, save to cloud, version history…). */
|
|
86
|
-
readonly itemActions?: (item: CanvasItem, kind: AnyCanvasKind | undefined) => readonly CanvasMenuItem[];
|
|
87
|
-
/**
|
|
88
|
-
|
|
161
|
+
readonly itemActions?: ((item: CanvasItem, kind: AnyCanvasKind | undefined) => readonly CanvasMenuItem[]) | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Opens a window that renders this canvas for the returned window id (web: a
|
|
164
|
+
* floating panel with <CanvasWindowScope>; desktop: a BrowserWindow with its
|
|
165
|
+
* own provider). The item then moves there. Absent ⇒ no "Pop out" entry, and
|
|
166
|
+
* `controller.popOut` is refused aloud.
|
|
167
|
+
*/
|
|
168
|
+
readonly popOut?: ((item: CanvasItem) => Promise<{
|
|
169
|
+
readonly windowId: string;
|
|
170
|
+
} | null>) | undefined;
|
|
171
|
+
/** A tab docked back out of `fromWindowId`. Close that window once the state no longer lists it. */
|
|
172
|
+
readonly dockBack?: ((itemId: CanvasItemId, fromWindowId: CanvasWindowId) => void) | undefined;
|
|
173
|
+
/** Draws the "…" menu (Electron `Menu.popup`). Default: the package's DOM menu. */
|
|
174
|
+
readonly showMenu?: CanvasShowMenu | undefined;
|
|
175
|
+
/** Draws tooltips, drop indicators and tab drags above native views. Default: in the DOM. */
|
|
176
|
+
readonly overlay?: CanvasOverlayPort | undefined;
|
|
177
|
+
/** Where each native-body kind's view goes, reported in the frame the layout changed. */
|
|
178
|
+
readonly onNativeBodyFrame?: CanvasNativeBodyFrame | undefined;
|
|
89
179
|
}
|
|
180
|
+
type CanvasTabStripMode = "auto" | "always";
|
|
90
181
|
interface CanvasProviderProps extends CanvasHostPorts {
|
|
91
182
|
readonly children: ReactNode;
|
|
92
|
-
/** A Redux-bound store (bindCanvasToReduxStore)
|
|
183
|
+
/** A Redux-bound store (bindCanvasToReduxStore), a remote one (createRemoteCanvasStore), or omit for a standalone store. */
|
|
93
184
|
readonly store?: CanvasStoreBinding;
|
|
94
|
-
/** `null` turns memory off. Default: localStorage. */
|
|
185
|
+
/** `null` turns memory off. Default: localStorage. Ignored for a remote store (its owner saves). */
|
|
95
186
|
readonly persistence?: CanvasPersistencePort | null;
|
|
96
187
|
readonly onError?: CanvasErrorSink;
|
|
97
|
-
/**
|
|
188
|
+
/** Binds the shortcut table's web shortcuts (⌘\ toggles, Esc leaves expand…). Default true. */
|
|
98
189
|
readonly hotkeys?: boolean;
|
|
190
|
+
/** The window this provider renders. Default: the main window. */
|
|
191
|
+
readonly windowId?: string;
|
|
192
|
+
/** Width and split numbers, read once. Default: CANVAS_WEB_LAYOUT_RULES. */
|
|
193
|
+
readonly layoutRules?: Partial<CanvasLayoutRules>;
|
|
194
|
+
/** Live width of the region the canvas shares with the content beside it (desktop: right of the sidebar). Default: the window. */
|
|
195
|
+
readonly regionWidth?: number | null;
|
|
196
|
+
/** "auto": a pane with one tab shows a title instead of a tab strip. Default "auto". */
|
|
197
|
+
readonly tabStrip?: CanvasTabStripMode;
|
|
99
198
|
}
|
|
100
|
-
declare function CanvasProvider({ children, store, persistence, onError, hotkeys,
|
|
101
|
-
/**
|
|
199
|
+
declare function CanvasProvider({ children, store, persistence, onError, hotkeys, windowId: windowIdProp, layoutRules, regionWidth, tabStrip, ...hostPorts }: CanvasProviderProps): react.JSX.Element;
|
|
200
|
+
/**
|
|
201
|
+
* Renders a subtree as ANOTHER window of the same canvas — the web host's
|
|
202
|
+
* pop-out panel: `<CanvasWindowScope windowId={id}><CanvasColumn placement="fill"/></CanvasWindowScope>`.
|
|
203
|
+
*/
|
|
204
|
+
declare function CanvasWindowScope({ windowId, children }: {
|
|
205
|
+
windowId: string;
|
|
206
|
+
children: ReactNode;
|
|
207
|
+
}): react.JSX.Element;
|
|
208
|
+
/** The controller (acting for this window): open, close, toggle, split… */
|
|
102
209
|
declare function useCanvas(): CanvasController;
|
|
103
210
|
/** Same as useCanvas, but null outside a provider (for components that may render anywhere). */
|
|
104
211
|
declare function useOptionalCanvas(): CanvasController | null;
|
|
212
|
+
/** The window this subtree renders. */
|
|
213
|
+
declare function useCanvasWindowId(): CanvasWindowId;
|
|
105
214
|
declare function useCanvasHostPorts(): CanvasHostPorts;
|
|
106
|
-
/**
|
|
215
|
+
/**
|
|
216
|
+
* Native-body controls. `remeasure()` re-reports every native body's frame now —
|
|
217
|
+
* call it on each animation frame while the host animates its own layout (a
|
|
218
|
+
* sidebar collapsing moves the canvas without resizing it).
|
|
219
|
+
*/
|
|
220
|
+
declare function useCanvasNativeBodies(): {
|
|
221
|
+
readonly remeasure: () => void;
|
|
222
|
+
};
|
|
223
|
+
/** True when a canvas column is on screen for this window — the ONE availability answer. */
|
|
107
224
|
declare function useCanvasIsPresented(): boolean;
|
|
108
225
|
/** Subscribes to a slice of canvas state. The selector must return stable values. */
|
|
109
226
|
declare function useCanvasState<T>(selector: (state: CanvasState) => T): T;
|
|
@@ -117,22 +234,24 @@ declare function useOptionalCanvasState<T>(selector: (state: CanvasState) => T,
|
|
|
117
234
|
declare function useCanvasKinds(): readonly AnyCanvasKind[];
|
|
118
235
|
declare function useCanvasKind(id: string): AnyCanvasKind | undefined;
|
|
119
236
|
|
|
120
|
-
/** The column's rendered width in px: 0 when put away, null when
|
|
237
|
+
/** The column's rendered width in px for this window: 0 when put away, null when expanded. */
|
|
121
238
|
declare function useCanvasColumnWidth(): number | null;
|
|
122
239
|
interface CanvasColumnProps {
|
|
123
240
|
readonly className?: string;
|
|
124
241
|
readonly style?: CSSProperties;
|
|
125
242
|
/** Called with the live width while the edge is dragged, then null — lets a host shell reflow in step. */
|
|
126
243
|
readonly onLiveWidth?: (width: number | null) => void;
|
|
244
|
+
/** "docked": the right-edge column with a width handle. "fill": fills its container (a pop-out window). */
|
|
245
|
+
readonly placement?: "docked" | "fill";
|
|
127
246
|
}
|
|
128
|
-
declare function CanvasColumn({ className, style, onLiveWidth }: CanvasColumnProps): react.JSX.Element | null;
|
|
129
|
-
/** THE one button that opens and puts away the canvas. */
|
|
247
|
+
declare function CanvasColumn({ className, style, onLiveWidth, placement }: CanvasColumnProps): react.JSX.Element | null;
|
|
248
|
+
/** THE one button that opens and puts away the canvas (this window's). */
|
|
130
249
|
declare function CanvasToggle({ className }: {
|
|
131
250
|
className?: string;
|
|
132
251
|
}): react.JSX.Element;
|
|
133
252
|
/**
|
|
134
253
|
* For hosts without their own shell (a Vite app, an Electron window): the app
|
|
135
|
-
* on the left, the canvas column on the right,
|
|
254
|
+
* on the left, the canvas column on the right, expand handled.
|
|
136
255
|
*/
|
|
137
256
|
declare function CanvasFrame({ children, className }: {
|
|
138
257
|
children: ReactNode;
|
|
@@ -144,4 +263,105 @@ declare function CanvasPaneView({ paneId }: {
|
|
|
144
263
|
paneId: CanvasPaneId;
|
|
145
264
|
}): react.JSX.Element | null;
|
|
146
265
|
|
|
147
|
-
|
|
266
|
+
interface CanvasHeaderButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "title"> {
|
|
267
|
+
/** Accessible name and tooltip. */
|
|
268
|
+
readonly label: string;
|
|
269
|
+
/** Appended to the tooltip, e.g. "⌘\\". */
|
|
270
|
+
readonly shortcut?: string | null | undefined;
|
|
271
|
+
/** False draws the button dimmed and inert (a browser's Back with no history). Default true. */
|
|
272
|
+
readonly available?: boolean;
|
|
273
|
+
/** "sm" = a pane-header action (24px); "md" = a browser bar button (28px). */
|
|
274
|
+
readonly size?: "sm" | "md";
|
|
275
|
+
readonly pressed?: boolean;
|
|
276
|
+
readonly children: ReactNode;
|
|
277
|
+
}
|
|
278
|
+
/** The one icon button of the canvas chrome. */
|
|
279
|
+
declare const CanvasHeaderButton: react.ForwardRefExoticComponent<CanvasHeaderButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
280
|
+
interface CanvasPanelProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
281
|
+
readonly panelId: string;
|
|
282
|
+
/** The header title (a single-tab pane, a panel with no tabs). */
|
|
283
|
+
readonly title: ReactNode;
|
|
284
|
+
/** Controls after the title or tabs: "+ new terminal", a browser's bar. Grows to fill the header. */
|
|
285
|
+
readonly leading?: ReactNode;
|
|
286
|
+
/** A custom start of the header instead of the title (a tab strip). `leading` still follows it. */
|
|
287
|
+
readonly header?: ReactNode;
|
|
288
|
+
/** Controls just before the "…" menu (a kind's own button). */
|
|
289
|
+
readonly actions?: ReactNode;
|
|
290
|
+
/** The "…" menu: the host renders its own menu around the trigger it receives. */
|
|
291
|
+
readonly renderMenu?: ((trigger: ReactElement) => ReactNode) | undefined;
|
|
292
|
+
readonly expanded?: boolean | undefined;
|
|
293
|
+
readonly onToggleExpand?: (() => void) | undefined;
|
|
294
|
+
readonly expandShortcut?: string | null | undefined;
|
|
295
|
+
/** Phones only: put the canvas away without closing anything. */
|
|
296
|
+
readonly onHide?: (() => void) | undefined;
|
|
297
|
+
readonly onClose?: (() => void) | undefined;
|
|
298
|
+
readonly closeLabel?: string | undefined;
|
|
299
|
+
readonly focused?: boolean | undefined;
|
|
300
|
+
/** Where the header's own body element goes (the pane body). */
|
|
301
|
+
readonly bodyProps?: HTMLAttributes<HTMLDivElement> | undefined;
|
|
302
|
+
}
|
|
303
|
+
/** The menu trigger every panel shares. */
|
|
304
|
+
declare const CanvasMenuTrigger: react.ForwardRefExoticComponent<Omit<CanvasHeaderButtonProps, "children" | "label"> & {
|
|
305
|
+
label?: string;
|
|
306
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
307
|
+
/** The frame every canvas panel shares: header (title or tabs · leading · actions · … · expand · close) over a body. */
|
|
308
|
+
declare const CanvasPanel: react.ForwardRefExoticComponent<CanvasPanelProps & react.RefAttributes<HTMLElement>>;
|
|
309
|
+
/** The one-line honest state of a panel with nothing to show, or whose backend has not shipped. */
|
|
310
|
+
declare function CanvasPanelEmpty({ children, className }: {
|
|
311
|
+
children: ReactNode;
|
|
312
|
+
className?: string;
|
|
313
|
+
}): react.JSX.Element;
|
|
314
|
+
interface CanvasTabProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "onSelect"> {
|
|
315
|
+
readonly title: string;
|
|
316
|
+
readonly icon: ReactNode;
|
|
317
|
+
/** Small trailing state after the title, e.g. "exited". */
|
|
318
|
+
readonly note?: string | undefined;
|
|
319
|
+
readonly active: boolean;
|
|
320
|
+
readonly onSelect: () => void;
|
|
321
|
+
/** Absent ⇒ no close button. */
|
|
322
|
+
readonly onClose?: (() => void) | undefined;
|
|
323
|
+
}
|
|
324
|
+
/** One tab of a strip. */
|
|
325
|
+
declare const CanvasTab: react.ForwardRefExoticComponent<CanvasTabProps & react.RefAttributes<HTMLDivElement>>;
|
|
326
|
+
interface BrowserTab {
|
|
327
|
+
readonly id: string;
|
|
328
|
+
readonly title: string;
|
|
329
|
+
/** A favicon URL; a globe is drawn without one. */
|
|
330
|
+
readonly icon?: string | null | undefined;
|
|
331
|
+
/** A glyph instead of a favicon (a terminal tab draws its prompt icon). */
|
|
332
|
+
readonly glyph?: ReactNode;
|
|
333
|
+
/** Small trailing state after the title, e.g. "exited". */
|
|
334
|
+
readonly note?: string | undefined;
|
|
335
|
+
}
|
|
336
|
+
interface BrowserTabsProps {
|
|
337
|
+
readonly tabs: readonly BrowserTab[];
|
|
338
|
+
readonly activeId: string | null;
|
|
339
|
+
readonly onSelect: (id: string) => void;
|
|
340
|
+
readonly onClose: (id: string) => void;
|
|
341
|
+
/** Absent ⇒ no "+" button. */
|
|
342
|
+
readonly onNew?: (() => void) | undefined;
|
|
343
|
+
/** The "+" button's name (default "New tab"). */
|
|
344
|
+
readonly newLabel?: string;
|
|
345
|
+
/** The tab list's name (default "Tabs"). */
|
|
346
|
+
readonly label?: string;
|
|
347
|
+
readonly className?: string;
|
|
348
|
+
}
|
|
349
|
+
/** A tab strip for any panel with its own tabs: a browser's pages, a terminal's shells. */
|
|
350
|
+
declare function BrowserTabs({ tabs, activeId, onSelect, onClose, onNew, newLabel, label, className }: BrowserTabsProps): react.JSX.Element;
|
|
351
|
+
interface BrowserBarProps {
|
|
352
|
+
readonly url: string;
|
|
353
|
+
readonly canGoBack: boolean;
|
|
354
|
+
readonly canGoForward: boolean;
|
|
355
|
+
readonly onBack: () => void;
|
|
356
|
+
readonly onForward: () => void;
|
|
357
|
+
readonly onReload: () => void;
|
|
358
|
+
/** Called with the typed address when the person presses Enter. */
|
|
359
|
+
readonly onNavigate: (address: string) => void;
|
|
360
|
+
/** Controls after the address (screenshot, open in your browser, more). */
|
|
361
|
+
readonly trailing?: ReactNode;
|
|
362
|
+
readonly className?: string;
|
|
363
|
+
}
|
|
364
|
+
/** A browser's back · forward · reload · address bar, for a kind's leading slot or its body. */
|
|
365
|
+
declare function BrowserBar({ url, canGoBack, canGoForward, onBack, onForward, onReload, onNavigate, trailing, className }: BrowserBarProps): react.JSX.Element;
|
|
366
|
+
|
|
367
|
+
export { type AnyCanvasKind, BrowserBar, type BrowserBarProps, type BrowserTab, BrowserTabs, type BrowserTabsProps, CanvasColumn, type CanvasColumnProps, type CanvasFloating, CanvasFrame, CanvasHeaderButton, type CanvasHeaderButtonProps, type CanvasHostPorts, type CanvasKind, type CanvasKindProps, type CanvasMenuEntry, type CanvasMenuItem, CanvasMenuTrigger, type CanvasNativeBodyFrame, type CanvasNativeBodyInfo, type CanvasNativeRect, type CanvasOverlayPort, CanvasPaneView, CanvasPanel, CanvasPanelEmpty, type CanvasPanelProps, CanvasProvider, type CanvasProviderProps, type CanvasShowMenu, CanvasTab, type CanvasTabProps, type CanvasTabStripMode, CanvasToggle, CanvasWindowScope, canvasSessionKey, defineCanvasKind, getCanvasKind, itemTitle, listCanvasKinds, registerCanvasKind, registerCanvasKinds, useCanvas, useCanvasColumnWidth, useCanvasHostPorts, useCanvasIsPresented, useCanvasKind, useCanvasKinds, useCanvasNativeBodies, useCanvasState, useCanvasWindowId, useOptionalCanvas, useOptionalCanvasState };
|