@ai-matrx/canvas 0.4.0 → 0.5.1
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 +40 -0
- package/README.md +61 -1
- package/dist/index.cjs +203 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +203 -21
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +998 -293
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +94 -4
- package/dist/react.d.ts +94 -4
- package/dist/react.js +1007 -298
- package/dist/react.js.map +1 -1
- package/dist/styles.css +223 -26
- package/dist/{toggleKind-A9v45oSb.d.cts → toggleKind-BD78LnMB.d.cts} +105 -1
- package/dist/{toggleKind-A9v45oSb.d.ts → toggleKind-BD78LnMB.d.ts} +105 -1
- package/dist/tokens.css +3 -0
- package/package.json +1 -1
package/dist/react.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode, CSSProperties, ButtonHTMLAttributes, HTMLAttributes, ReactElement } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { N as CanvasRect, d as CanvasPaneId, C as CanvasItemId, a as CanvasWindowId, b as CanvasJson, i as CanvasItem, h as CanvasController, L as CanvasPresentation, Q as CanvasSessionEvent, O as CanvasSessionAttachReason, P as CanvasSessionDetachReason, K as CanvasPreferredTarget, e as CanvasStoreBinding, J as CanvasPersistencePort, A as CanvasErrorSink, E as CanvasLayoutRules, X as ToggleKindInput, D as CanvasKindVisibility, f as CanvasState } from './toggleKind-BD78LnMB.cjs';
|
|
4
4
|
|
|
5
5
|
/** One floating thing. Plain data, so a host can draw it in another process. */
|
|
6
6
|
type CanvasFloating = {
|
|
@@ -66,9 +66,21 @@ interface CanvasKindProps<TData extends CanvasJson = CanvasJson> {
|
|
|
66
66
|
readonly data: TData;
|
|
67
67
|
readonly paneId: CanvasPaneId;
|
|
68
68
|
readonly isFocused: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* On screen right now: its tab is active and its canvas is open. A body
|
|
71
|
+
* stays mounted while hidden (a background tab, a put-away canvas) — pause
|
|
72
|
+
* costly work (polling, animation) while this is false.
|
|
73
|
+
*/
|
|
74
|
+
readonly isVisible: boolean;
|
|
69
75
|
/** The canvas, acting for the window this pane is in. */
|
|
70
76
|
readonly canvas: CanvasController;
|
|
71
77
|
readonly windowId: CanvasWindowId;
|
|
78
|
+
/**
|
|
79
|
+
* The space this body has, live: size, orientation, narrow, expanded, pane
|
|
80
|
+
* count. Lay content out for it (a graph in a tall narrow pane flows top to
|
|
81
|
+
* bottom). Nested components read the same value with `useCanvasPresentation()`.
|
|
82
|
+
*/
|
|
83
|
+
readonly presentation: CanvasPresentation;
|
|
72
84
|
}
|
|
73
85
|
interface CanvasMenuItem {
|
|
74
86
|
readonly id: string;
|
|
@@ -105,8 +117,26 @@ interface CanvasKind<TData extends CanvasJson = CanvasJson> {
|
|
|
105
117
|
readonly onAttach?: (event: CanvasSessionEvent<CanvasSessionAttachReason>) => void;
|
|
106
118
|
/** restore "session": the tab no longer shows it ("close" | "leave" | "unmount"). Never kill the process here. */
|
|
107
119
|
readonly onDetach?: (event: CanvasSessionEvent<CanvasSessionDetachReason>) => void;
|
|
108
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* @deprecated Since 0.5.0 every body stays mounted from the first time it
|
|
122
|
+
* is shown until its tab closes — through tab switches, splits, moves,
|
|
123
|
+
* expand and the canvas being put away. This field changes nothing.
|
|
124
|
+
*/
|
|
109
125
|
readonly keepAlive?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Opt OUT of staying mounted: the body unmounts whenever it is not on
|
|
128
|
+
* screen (a hidden tab, a put-away canvas) and mounts fresh when shown.
|
|
129
|
+
* Only for genuinely heavy bodies whose state is cheap to rebuild.
|
|
130
|
+
*/
|
|
131
|
+
readonly unmountWhenHidden?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Where a NEW item of this kind opens while the canvas already shows
|
|
134
|
+
* something: "split-down" puts it in a pane below (the layout rules' split
|
|
135
|
+
* share — a feed under the work), "split-right" beside, "focused" (default)
|
|
136
|
+
* in the focused pane. A pane already showing this kind takes it instead of
|
|
137
|
+
* a new split. A caller's explicit `target` always wins.
|
|
138
|
+
*/
|
|
139
|
+
readonly preferredTarget?: CanvasPreferredTarget;
|
|
110
140
|
/**
|
|
111
141
|
* "native": the body is drawn by the HOST outside the DOM (an Electron
|
|
112
142
|
* WebContentsView). The pane renders a placeholder and reports its rect
|
|
@@ -185,6 +215,22 @@ interface CanvasHostPorts {
|
|
|
185
215
|
readonly onNativeBodyFrame?: CanvasNativeBodyFrame | undefined;
|
|
186
216
|
}
|
|
187
217
|
type CanvasTabStripMode = "auto" | "always";
|
|
218
|
+
/**
|
|
219
|
+
* One contextual launcher entry: a page offers something about ITSELF in the
|
|
220
|
+
* canvas's "New tab" launcher ("This chat's documents" on a chat page) for as
|
|
221
|
+
* long as it is mounted. Shown before the global kinds.
|
|
222
|
+
*/
|
|
223
|
+
interface CanvasLauncherEntry {
|
|
224
|
+
readonly kind: string;
|
|
225
|
+
readonly key: string;
|
|
226
|
+
readonly data?: CanvasJson | undefined;
|
|
227
|
+
/** The entry's label (and the new tab's title). Default: the kind's label. */
|
|
228
|
+
readonly title?: string | null | undefined;
|
|
229
|
+
/** Default: the kind's icon. */
|
|
230
|
+
readonly icon?: ComponentType<{
|
|
231
|
+
className?: string;
|
|
232
|
+
}> | undefined;
|
|
233
|
+
}
|
|
188
234
|
interface CanvasProviderProps extends CanvasHostPorts {
|
|
189
235
|
readonly children: ReactNode;
|
|
190
236
|
/** A Redux-bound store (bindCanvasToReduxStore), a remote one (createRemoteCanvasStore), or omit for a standalone store. */
|
|
@@ -203,7 +249,7 @@ interface CanvasProviderProps extends CanvasHostPorts {
|
|
|
203
249
|
/** "auto": a pane with one tab shows a title instead of a tab strip. Default "auto". */
|
|
204
250
|
readonly tabStrip?: CanvasTabStripMode;
|
|
205
251
|
}
|
|
206
|
-
declare function CanvasProvider({ children, store, persistence, onError, hotkeys, windowId: windowIdProp, layoutRules, regionWidth, tabStrip,
|
|
252
|
+
declare function CanvasProvider({ children, store, persistence, onError, hotkeys, windowId: windowIdProp, layoutRules, regionWidth, tabStrip, itemActions, popOut, dockBack, showMenu, overlay, onNativeBodyFrame, }: CanvasProviderProps): react.JSX.Element;
|
|
207
253
|
/**
|
|
208
254
|
* Renders a subtree as ANOTHER window of the same canvas — the web host's
|
|
209
255
|
* pop-out panel: `<CanvasWindowScope windowId={id}><CanvasColumn placement="fill"/></CanvasWindowScope>`.
|
|
@@ -250,6 +296,15 @@ declare function useCanvasKindToggle(input: ToggleKindInput): {
|
|
|
250
296
|
/** Re-renders when kinds register, so late-registered kinds appear. */
|
|
251
297
|
declare function useCanvasKinds(): readonly AnyCanvasKind[];
|
|
252
298
|
declare function useCanvasKind(id: string): AnyCanvasKind | undefined;
|
|
299
|
+
/**
|
|
300
|
+
* Offers `entry` in the canvas's "New tab" launcher while the calling
|
|
301
|
+
* component is mounted — a route registers what is about IT (a chat's
|
|
302
|
+
* documents, a table's saved views). Contextual entries show before the
|
|
303
|
+
* global kinds. A no-op outside a CanvasProvider.
|
|
304
|
+
*/
|
|
305
|
+
declare function useCanvasLauncherEntry(entry: CanvasLauncherEntry): void;
|
|
306
|
+
/** Contextual launcher entries, latest registration of each `kind::key` only, in registration order. */
|
|
307
|
+
declare function useCanvasLauncherEntries(): readonly CanvasLauncherEntry[];
|
|
253
308
|
|
|
254
309
|
/** The column's rendered width in px for this window: 0 when put away, null when expanded. */
|
|
255
310
|
declare function useCanvasColumnWidth(): number | null;
|
|
@@ -274,6 +329,31 @@ declare function CanvasToggle({ className, variant, }: {
|
|
|
274
329
|
className?: string;
|
|
275
330
|
variant?: "glass" | "transparent";
|
|
276
331
|
}): react.JSX.Element;
|
|
332
|
+
/** One icon of a `CanvasKindIcons` cluster. A string is a kind on its "default" tab. */
|
|
333
|
+
interface CanvasKindIcon {
|
|
334
|
+
readonly kind: string;
|
|
335
|
+
/** Default "default" — one instance of the kind (a toolbar tool). */
|
|
336
|
+
readonly key?: string | undefined;
|
|
337
|
+
/** Data for a NEW item; an open one keeps its own. */
|
|
338
|
+
readonly data?: CanvasJson | undefined;
|
|
339
|
+
readonly title?: string | null | undefined;
|
|
340
|
+
/** What a press does while the item is in front: close it (default) or put the canvas away. */
|
|
341
|
+
readonly whenVisible?: "close" | "hide" | undefined;
|
|
342
|
+
/** Accessible name and tooltip. Default: the kind's label. */
|
|
343
|
+
readonly label?: string | undefined;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* A cluster of icon buttons for pinned kinds — the tool icons of a header
|
|
347
|
+
* (Terminal, Review, Browser…). Each toggles or focuses its kind and is drawn
|
|
348
|
+
* pressed while its item is in front, so web and desktop show the same
|
|
349
|
+
* cluster. A kind that is not registered draws nothing.
|
|
350
|
+
*/
|
|
351
|
+
declare function CanvasKindIcons({ kinds, variant, className, label, }: {
|
|
352
|
+
kinds: readonly (string | CanvasKindIcon)[];
|
|
353
|
+
variant?: "glass" | "transparent";
|
|
354
|
+
className?: string;
|
|
355
|
+
label?: string;
|
|
356
|
+
}): react.JSX.Element;
|
|
277
357
|
/**
|
|
278
358
|
* For hosts without their own shell (a Vite app, an Electron window): the app
|
|
279
359
|
* on the left, the canvas column on the right, expand handled.
|
|
@@ -283,6 +363,16 @@ declare function CanvasFrame({ children, className }: {
|
|
|
283
363
|
className?: string;
|
|
284
364
|
}): react.JSX.Element;
|
|
285
365
|
|
|
366
|
+
/**
|
|
367
|
+
* The live presentation of the canvas body this component renders in: size,
|
|
368
|
+
* orientation, narrow, expanded, pane count. `null` outside the canvas — so a
|
|
369
|
+
* component used both on a page and in a canvas adapts only in the canvas.
|
|
370
|
+
*
|
|
371
|
+
* const p = useCanvasPresentation();
|
|
372
|
+
* const direction = preferredFlowDirection(p); // "vertical" in a tall narrow pane
|
|
373
|
+
*/
|
|
374
|
+
declare function useCanvasPresentation(): CanvasPresentation | null;
|
|
375
|
+
|
|
286
376
|
declare function itemTitle(item: CanvasItem, kind: AnyCanvasKind | undefined): string;
|
|
287
377
|
declare function CanvasPaneView({ paneId }: {
|
|
288
378
|
paneId: CanvasPaneId;
|
|
@@ -389,4 +479,4 @@ interface BrowserBarProps {
|
|
|
389
479
|
/** A browser's back · forward · reload · address bar, for a kind's leading slot or its body. */
|
|
390
480
|
declare function BrowserBar({ url, canGoBack, canGoForward, onBack, onForward, onReload, onNavigate, trailing, className }: BrowserBarProps): react.JSX.Element;
|
|
391
481
|
|
|
392
|
-
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, useCanvasKindToggle, useCanvasKinds, useCanvasNativeBodies, useCanvasState, useCanvasWindowId, useOptionalCanvas, useOptionalCanvasState };
|
|
482
|
+
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 CanvasKindIcon, CanvasKindIcons, type CanvasKindProps, type CanvasLauncherEntry, 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, useCanvasKindToggle, useCanvasKinds, useCanvasLauncherEntries, useCanvasLauncherEntry, useCanvasNativeBodies, useCanvasPresentation, useCanvasState, useCanvasWindowId, useOptionalCanvas, useOptionalCanvasState };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode, CSSProperties, ButtonHTMLAttributes, HTMLAttributes, ReactElement } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { N as CanvasRect, d as CanvasPaneId, C as CanvasItemId, a as CanvasWindowId, b as CanvasJson, i as CanvasItem, h as CanvasController, L as CanvasPresentation, Q as CanvasSessionEvent, O as CanvasSessionAttachReason, P as CanvasSessionDetachReason, K as CanvasPreferredTarget, e as CanvasStoreBinding, J as CanvasPersistencePort, A as CanvasErrorSink, E as CanvasLayoutRules, X as ToggleKindInput, D as CanvasKindVisibility, f as CanvasState } from './toggleKind-BD78LnMB.js';
|
|
4
4
|
|
|
5
5
|
/** One floating thing. Plain data, so a host can draw it in another process. */
|
|
6
6
|
type CanvasFloating = {
|
|
@@ -66,9 +66,21 @@ interface CanvasKindProps<TData extends CanvasJson = CanvasJson> {
|
|
|
66
66
|
readonly data: TData;
|
|
67
67
|
readonly paneId: CanvasPaneId;
|
|
68
68
|
readonly isFocused: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* On screen right now: its tab is active and its canvas is open. A body
|
|
71
|
+
* stays mounted while hidden (a background tab, a put-away canvas) — pause
|
|
72
|
+
* costly work (polling, animation) while this is false.
|
|
73
|
+
*/
|
|
74
|
+
readonly isVisible: boolean;
|
|
69
75
|
/** The canvas, acting for the window this pane is in. */
|
|
70
76
|
readonly canvas: CanvasController;
|
|
71
77
|
readonly windowId: CanvasWindowId;
|
|
78
|
+
/**
|
|
79
|
+
* The space this body has, live: size, orientation, narrow, expanded, pane
|
|
80
|
+
* count. Lay content out for it (a graph in a tall narrow pane flows top to
|
|
81
|
+
* bottom). Nested components read the same value with `useCanvasPresentation()`.
|
|
82
|
+
*/
|
|
83
|
+
readonly presentation: CanvasPresentation;
|
|
72
84
|
}
|
|
73
85
|
interface CanvasMenuItem {
|
|
74
86
|
readonly id: string;
|
|
@@ -105,8 +117,26 @@ interface CanvasKind<TData extends CanvasJson = CanvasJson> {
|
|
|
105
117
|
readonly onAttach?: (event: CanvasSessionEvent<CanvasSessionAttachReason>) => void;
|
|
106
118
|
/** restore "session": the tab no longer shows it ("close" | "leave" | "unmount"). Never kill the process here. */
|
|
107
119
|
readonly onDetach?: (event: CanvasSessionEvent<CanvasSessionDetachReason>) => void;
|
|
108
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* @deprecated Since 0.5.0 every body stays mounted from the first time it
|
|
122
|
+
* is shown until its tab closes — through tab switches, splits, moves,
|
|
123
|
+
* expand and the canvas being put away. This field changes nothing.
|
|
124
|
+
*/
|
|
109
125
|
readonly keepAlive?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Opt OUT of staying mounted: the body unmounts whenever it is not on
|
|
128
|
+
* screen (a hidden tab, a put-away canvas) and mounts fresh when shown.
|
|
129
|
+
* Only for genuinely heavy bodies whose state is cheap to rebuild.
|
|
130
|
+
*/
|
|
131
|
+
readonly unmountWhenHidden?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Where a NEW item of this kind opens while the canvas already shows
|
|
134
|
+
* something: "split-down" puts it in a pane below (the layout rules' split
|
|
135
|
+
* share — a feed under the work), "split-right" beside, "focused" (default)
|
|
136
|
+
* in the focused pane. A pane already showing this kind takes it instead of
|
|
137
|
+
* a new split. A caller's explicit `target` always wins.
|
|
138
|
+
*/
|
|
139
|
+
readonly preferredTarget?: CanvasPreferredTarget;
|
|
110
140
|
/**
|
|
111
141
|
* "native": the body is drawn by the HOST outside the DOM (an Electron
|
|
112
142
|
* WebContentsView). The pane renders a placeholder and reports its rect
|
|
@@ -185,6 +215,22 @@ interface CanvasHostPorts {
|
|
|
185
215
|
readonly onNativeBodyFrame?: CanvasNativeBodyFrame | undefined;
|
|
186
216
|
}
|
|
187
217
|
type CanvasTabStripMode = "auto" | "always";
|
|
218
|
+
/**
|
|
219
|
+
* One contextual launcher entry: a page offers something about ITSELF in the
|
|
220
|
+
* canvas's "New tab" launcher ("This chat's documents" on a chat page) for as
|
|
221
|
+
* long as it is mounted. Shown before the global kinds.
|
|
222
|
+
*/
|
|
223
|
+
interface CanvasLauncherEntry {
|
|
224
|
+
readonly kind: string;
|
|
225
|
+
readonly key: string;
|
|
226
|
+
readonly data?: CanvasJson | undefined;
|
|
227
|
+
/** The entry's label (and the new tab's title). Default: the kind's label. */
|
|
228
|
+
readonly title?: string | null | undefined;
|
|
229
|
+
/** Default: the kind's icon. */
|
|
230
|
+
readonly icon?: ComponentType<{
|
|
231
|
+
className?: string;
|
|
232
|
+
}> | undefined;
|
|
233
|
+
}
|
|
188
234
|
interface CanvasProviderProps extends CanvasHostPorts {
|
|
189
235
|
readonly children: ReactNode;
|
|
190
236
|
/** A Redux-bound store (bindCanvasToReduxStore), a remote one (createRemoteCanvasStore), or omit for a standalone store. */
|
|
@@ -203,7 +249,7 @@ interface CanvasProviderProps extends CanvasHostPorts {
|
|
|
203
249
|
/** "auto": a pane with one tab shows a title instead of a tab strip. Default "auto". */
|
|
204
250
|
readonly tabStrip?: CanvasTabStripMode;
|
|
205
251
|
}
|
|
206
|
-
declare function CanvasProvider({ children, store, persistence, onError, hotkeys, windowId: windowIdProp, layoutRules, regionWidth, tabStrip,
|
|
252
|
+
declare function CanvasProvider({ children, store, persistence, onError, hotkeys, windowId: windowIdProp, layoutRules, regionWidth, tabStrip, itemActions, popOut, dockBack, showMenu, overlay, onNativeBodyFrame, }: CanvasProviderProps): react.JSX.Element;
|
|
207
253
|
/**
|
|
208
254
|
* Renders a subtree as ANOTHER window of the same canvas — the web host's
|
|
209
255
|
* pop-out panel: `<CanvasWindowScope windowId={id}><CanvasColumn placement="fill"/></CanvasWindowScope>`.
|
|
@@ -250,6 +296,15 @@ declare function useCanvasKindToggle(input: ToggleKindInput): {
|
|
|
250
296
|
/** Re-renders when kinds register, so late-registered kinds appear. */
|
|
251
297
|
declare function useCanvasKinds(): readonly AnyCanvasKind[];
|
|
252
298
|
declare function useCanvasKind(id: string): AnyCanvasKind | undefined;
|
|
299
|
+
/**
|
|
300
|
+
* Offers `entry` in the canvas's "New tab" launcher while the calling
|
|
301
|
+
* component is mounted — a route registers what is about IT (a chat's
|
|
302
|
+
* documents, a table's saved views). Contextual entries show before the
|
|
303
|
+
* global kinds. A no-op outside a CanvasProvider.
|
|
304
|
+
*/
|
|
305
|
+
declare function useCanvasLauncherEntry(entry: CanvasLauncherEntry): void;
|
|
306
|
+
/** Contextual launcher entries, latest registration of each `kind::key` only, in registration order. */
|
|
307
|
+
declare function useCanvasLauncherEntries(): readonly CanvasLauncherEntry[];
|
|
253
308
|
|
|
254
309
|
/** The column's rendered width in px for this window: 0 when put away, null when expanded. */
|
|
255
310
|
declare function useCanvasColumnWidth(): number | null;
|
|
@@ -274,6 +329,31 @@ declare function CanvasToggle({ className, variant, }: {
|
|
|
274
329
|
className?: string;
|
|
275
330
|
variant?: "glass" | "transparent";
|
|
276
331
|
}): react.JSX.Element;
|
|
332
|
+
/** One icon of a `CanvasKindIcons` cluster. A string is a kind on its "default" tab. */
|
|
333
|
+
interface CanvasKindIcon {
|
|
334
|
+
readonly kind: string;
|
|
335
|
+
/** Default "default" — one instance of the kind (a toolbar tool). */
|
|
336
|
+
readonly key?: string | undefined;
|
|
337
|
+
/** Data for a NEW item; an open one keeps its own. */
|
|
338
|
+
readonly data?: CanvasJson | undefined;
|
|
339
|
+
readonly title?: string | null | undefined;
|
|
340
|
+
/** What a press does while the item is in front: close it (default) or put the canvas away. */
|
|
341
|
+
readonly whenVisible?: "close" | "hide" | undefined;
|
|
342
|
+
/** Accessible name and tooltip. Default: the kind's label. */
|
|
343
|
+
readonly label?: string | undefined;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* A cluster of icon buttons for pinned kinds — the tool icons of a header
|
|
347
|
+
* (Terminal, Review, Browser…). Each toggles or focuses its kind and is drawn
|
|
348
|
+
* pressed while its item is in front, so web and desktop show the same
|
|
349
|
+
* cluster. A kind that is not registered draws nothing.
|
|
350
|
+
*/
|
|
351
|
+
declare function CanvasKindIcons({ kinds, variant, className, label, }: {
|
|
352
|
+
kinds: readonly (string | CanvasKindIcon)[];
|
|
353
|
+
variant?: "glass" | "transparent";
|
|
354
|
+
className?: string;
|
|
355
|
+
label?: string;
|
|
356
|
+
}): react.JSX.Element;
|
|
277
357
|
/**
|
|
278
358
|
* For hosts without their own shell (a Vite app, an Electron window): the app
|
|
279
359
|
* on the left, the canvas column on the right, expand handled.
|
|
@@ -283,6 +363,16 @@ declare function CanvasFrame({ children, className }: {
|
|
|
283
363
|
className?: string;
|
|
284
364
|
}): react.JSX.Element;
|
|
285
365
|
|
|
366
|
+
/**
|
|
367
|
+
* The live presentation of the canvas body this component renders in: size,
|
|
368
|
+
* orientation, narrow, expanded, pane count. `null` outside the canvas — so a
|
|
369
|
+
* component used both on a page and in a canvas adapts only in the canvas.
|
|
370
|
+
*
|
|
371
|
+
* const p = useCanvasPresentation();
|
|
372
|
+
* const direction = preferredFlowDirection(p); // "vertical" in a tall narrow pane
|
|
373
|
+
*/
|
|
374
|
+
declare function useCanvasPresentation(): CanvasPresentation | null;
|
|
375
|
+
|
|
286
376
|
declare function itemTitle(item: CanvasItem, kind: AnyCanvasKind | undefined): string;
|
|
287
377
|
declare function CanvasPaneView({ paneId }: {
|
|
288
378
|
paneId: CanvasPaneId;
|
|
@@ -389,4 +479,4 @@ interface BrowserBarProps {
|
|
|
389
479
|
/** A browser's back · forward · reload · address bar, for a kind's leading slot or its body. */
|
|
390
480
|
declare function BrowserBar({ url, canGoBack, canGoForward, onBack, onForward, onReload, onNavigate, trailing, className }: BrowserBarProps): react.JSX.Element;
|
|
391
481
|
|
|
392
|
-
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, useCanvasKindToggle, useCanvasKinds, useCanvasNativeBodies, useCanvasState, useCanvasWindowId, useOptionalCanvas, useOptionalCanvasState };
|
|
482
|
+
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 CanvasKindIcon, CanvasKindIcons, type CanvasKindProps, type CanvasLauncherEntry, 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, useCanvasKindToggle, useCanvasKinds, useCanvasLauncherEntries, useCanvasLauncherEntry, useCanvasNativeBodies, useCanvasPresentation, useCanvasState, useCanvasWindowId, useOptionalCanvas, useOptionalCanvasState };
|