@ai-matrx/canvas 0.9.3 → 0.10.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 +44 -0
- package/dist/react.cjs +342 -135
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +104 -3
- package/dist/react.d.ts +104 -3
- package/dist/react.js +291 -84
- package/dist/react.js.map +1 -1
- package/dist/styles.css +5 -1
- package/package.json +2 -2
package/dist/react.d.cts
CHANGED
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode, CSSProperties, ButtonHTMLAttributes, HTMLAttributes, ReactElement } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { i as CanvasItem, C as CanvasItemId, b as CanvasJson, d as CanvasPaneId, h as CanvasController, a as CanvasWindowId, Q as CanvasPresentation, V as CanvasSessionEvent, T as CanvasSessionAttachReason, U as CanvasSessionDetachReason, P as CanvasPreferredTarget, S as CanvasRect, e as CanvasStoreBinding, O as CanvasPersistencePort, F as CanvasErrorSink, I as CanvasLayoutRules, a0 as ToggleKindInput, H as CanvasKindVisibility, f as CanvasState } from './toggleKind-CI2nBjum.cjs';
|
|
4
|
+
|
|
5
|
+
/** What a body (or a kind) can do with its rendered output right now. */
|
|
6
|
+
interface CanvasOutputHandlers {
|
|
7
|
+
/** Print exactly what is shown (a frame page asks its own page to print). Runs inside the click. */
|
|
8
|
+
readonly print?: (() => void | Promise<void>) | undefined;
|
|
9
|
+
/** Save as PDF. Absent ⇒ the print dialog's "Save as PDF" (the Print handler) when there is one. */
|
|
10
|
+
readonly savePdf?: (() => void | Promise<void>) | undefined;
|
|
11
|
+
/** A full image of the item exactly as rendered (full height, the viewer's width). */
|
|
12
|
+
readonly capture?: (() => Promise<Blob>) | undefined;
|
|
13
|
+
/** A short honest reason an entry cannot run NOW ("Publishing the page…"). Shown in the menu, disabled. */
|
|
14
|
+
readonly unavailable?: {
|
|
15
|
+
readonly print?: string | undefined;
|
|
16
|
+
readonly capture?: string | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}
|
|
19
|
+
/** One request to the host's engines. */
|
|
20
|
+
interface CanvasOutputRequest {
|
|
21
|
+
readonly item: CanvasItem;
|
|
22
|
+
readonly kind: AnyCanvasKind | undefined;
|
|
23
|
+
readonly surface: CanvasKindSurface;
|
|
24
|
+
/** The body's root element in this window (null when it is not mounted here). */
|
|
25
|
+
readonly element: HTMLElement | null;
|
|
26
|
+
/** Tab title. */
|
|
27
|
+
readonly title: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The host's print / capture / attach engines (web: `@ai-matrx/print` and DOM
|
|
31
|
+
* capture; desktop: `webContents.print` / `capturePage`). Each returns null
|
|
32
|
+
* when it cannot serve that request — the entry is then absent.
|
|
33
|
+
*/
|
|
34
|
+
interface CanvasOutputPorts {
|
|
35
|
+
/** Print engine for an item the kind/body does not print itself ("dom" bodies). */
|
|
36
|
+
readonly print?: ((request: CanvasOutputRequest) => (() => void | Promise<void>) | null) | undefined;
|
|
37
|
+
/** Save-as-PDF engine. Absent ⇒ Print stands in (the print dialog saves PDFs). */
|
|
38
|
+
readonly savePdf?: ((request: CanvasOutputRequest) => (() => void | Promise<void>) | null) | undefined;
|
|
39
|
+
/** Capture engine (an image of the item). */
|
|
40
|
+
readonly capture?: ((request: CanvasOutputRequest) => (() => Promise<Blob>) | null) | undefined;
|
|
41
|
+
/** Puts an image on the clipboard. Default: `navigator.clipboard.write` with a PNG ClipboardItem. */
|
|
42
|
+
readonly copyImage?: ((image: Blob, request: CanvasOutputRequest) => Promise<void>) | undefined;
|
|
43
|
+
/** "Attach to chat ▸" options for the item (code · screenshot · text). Given the resolved capture, if any. */
|
|
44
|
+
readonly attachOptions?: ((request: CanvasOutputRequest, capture: (() => Promise<Blob>) | null) => readonly CanvasMenuItem[]) | undefined;
|
|
45
|
+
/** Where a failed entry is reported. Default: console.error. */
|
|
46
|
+
readonly onError?: ((message: string, error: unknown) => void) | undefined;
|
|
47
|
+
}
|
|
48
|
+
/** The body element of `itemId` in this document (the live tab, never a kept step). */
|
|
49
|
+
declare function canvasItemElement(itemId: string): HTMLElement | null;
|
|
50
|
+
/** A kind's surface, read defensively (a kind registered without `defineCanvasKind`). */
|
|
51
|
+
declare function canvasKindSurface(kind: AnyCanvasKind | undefined): CanvasKindSurface;
|
|
52
|
+
/**
|
|
53
|
+
* The standard entries for one item, in order: Print, Save as PDF, Copy
|
|
54
|
+
* image, then the host's Attach options. An entry nobody can serve is absent;
|
|
55
|
+
* one declared unavailable shows its reason, disabled — never a silent no-op.
|
|
56
|
+
*/
|
|
57
|
+
declare function canvasOutputMenu(input: {
|
|
58
|
+
readonly item: CanvasItem;
|
|
59
|
+
readonly kind: AnyCanvasKind | undefined;
|
|
60
|
+
readonly title: string;
|
|
61
|
+
readonly body: CanvasOutputHandlers;
|
|
62
|
+
readonly ports: CanvasOutputPorts | undefined;
|
|
63
|
+
}): CanvasMenuItem[];
|
|
64
|
+
/**
|
|
65
|
+
* A body offers its rendered output: `print` (a page printing itself),
|
|
66
|
+
* `capture` (an exact image), or an honest `unavailable` reason. The latest
|
|
67
|
+
* handlers are read each time the menu opens.
|
|
68
|
+
*/
|
|
69
|
+
declare function useCanvasOutput(itemId: CanvasItemId | string | null | undefined, handlers: CanvasOutputHandlers): void;
|
|
70
|
+
/**
|
|
71
|
+
* Guard for hosts' tests: what a kind's declaration lacks under the standard.
|
|
72
|
+
* Every kind declares `surface`; a "frame" or "native" kind declares `print`
|
|
73
|
+
* and `capture` (a handler, or an honest reason string).
|
|
74
|
+
*/
|
|
75
|
+
declare function canvasKindOutputProblems(kind: AnyCanvasKind): string[];
|
|
4
76
|
|
|
5
77
|
/**
|
|
6
78
|
* THE canvas kind registry. A kind is one sort of thing the canvas can show —
|
|
@@ -46,9 +118,31 @@ interface CanvasMenuItem {
|
|
|
46
118
|
readonly icon?: ReactNode;
|
|
47
119
|
readonly onSelect: () => void;
|
|
48
120
|
readonly destructive?: boolean;
|
|
121
|
+
/** Shown but not choosable — an honest "cannot, and why" entry (its label says why). */
|
|
122
|
+
readonly disabled?: boolean;
|
|
49
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* What a kind's body is, for printing and capturing it:
|
|
126
|
+
* - "dom": same-origin DOM — the host's DOM print and capture copy it as drawn.
|
|
127
|
+
* - "frame": drawn in a frame or a drawing surface (an iframe page, a canvas,
|
|
128
|
+
* WebGL, a map) that a DOM copy cannot reproduce — the kind declares its own
|
|
129
|
+
* `print` and `capture` (or an honest reason it cannot).
|
|
130
|
+
* - "native": drawn by the host outside the DOM (`body: "native"`) — same.
|
|
131
|
+
*/
|
|
132
|
+
type CanvasKindSurface = "dom" | "frame" | "native";
|
|
50
133
|
interface CanvasKind<TData extends CanvasJson = CanvasJson> {
|
|
51
134
|
readonly id: string;
|
|
135
|
+
/** Required, no default — see `CanvasKindSurface`. A guard holds every registered kind to it. */
|
|
136
|
+
readonly surface: CanvasKindSurface;
|
|
137
|
+
/**
|
|
138
|
+
* How a tab of this kind prints (the pane menu's Print / Save as PDF): a
|
|
139
|
+
* handler, or a short honest reason it cannot ("not yet for live apps"),
|
|
140
|
+
* shown disabled; `false` when there is nothing to print (a launcher). Absent on a "dom" kind ⇒ the host's DOM print. A body can
|
|
141
|
+
* offer a better answer at run time with `useCanvasOutput`.
|
|
142
|
+
*/
|
|
143
|
+
readonly print?: ((request: CanvasOutputRequest) => void | Promise<void>) | string | false;
|
|
144
|
+
/** How a tab of this kind becomes an image (Copy image, Attach screenshot): a handler or an honest reason. */
|
|
145
|
+
readonly capture?: ((request: CanvasOutputRequest) => Promise<Blob>) | string | false;
|
|
52
146
|
/** Singular noun shown in menus and the empty-pane launcher. */
|
|
53
147
|
readonly label: string;
|
|
54
148
|
readonly icon: ComponentType<{
|
|
@@ -178,6 +272,7 @@ type CanvasMenuEntry = {
|
|
|
178
272
|
readonly id: string;
|
|
179
273
|
readonly label: string;
|
|
180
274
|
readonly destructive?: boolean;
|
|
275
|
+
readonly disabled?: boolean;
|
|
181
276
|
} | {
|
|
182
277
|
readonly type: "separator";
|
|
183
278
|
};
|
|
@@ -220,6 +315,12 @@ interface CanvasHostPorts {
|
|
|
220
315
|
readonly overlay?: CanvasOverlayPort | undefined;
|
|
221
316
|
/** Where each native-body kind's view goes, reported in the frame the layout changed. */
|
|
222
317
|
readonly onNativeBodyFrame?: CanvasNativeBodyFrame | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* The print / capture / attach engines behind the standard entries (Print,
|
|
320
|
+
* Save as PDF, Copy image, Attach to chat ▸). Absent ⇒ only what kinds and
|
|
321
|
+
* bodies serve themselves is offered.
|
|
322
|
+
*/
|
|
323
|
+
readonly output?: CanvasOutputPorts | undefined;
|
|
223
324
|
}
|
|
224
325
|
type CanvasTabStripMode = "auto" | "always";
|
|
225
326
|
/**
|
|
@@ -256,7 +357,7 @@ interface CanvasProviderProps extends CanvasHostPorts {
|
|
|
256
357
|
/** "auto": a pane with one tab shows a title instead of a tab strip. Default "auto". */
|
|
257
358
|
readonly tabStrip?: CanvasTabStripMode;
|
|
258
359
|
}
|
|
259
|
-
declare function CanvasProvider({ children, store, persistence, onError, hotkeys, windowId: windowIdProp, layoutRules, regionWidth, tabStrip, itemActions, popOut, dockBack, showMenu, overlay, onNativeBodyFrame, }: CanvasProviderProps): react.JSX.Element;
|
|
360
|
+
declare function CanvasProvider({ children, store, persistence, onError, hotkeys, windowId: windowIdProp, layoutRules, regionWidth, tabStrip, itemActions, popOut, dockBack, showMenu, overlay, onNativeBodyFrame, output, }: CanvasProviderProps): react.JSX.Element;
|
|
260
361
|
/**
|
|
261
362
|
* Renders a subtree as ANOTHER window of the same canvas — the web host's
|
|
262
363
|
* pop-out panel: `<CanvasWindowScope windowId={id}><CanvasColumn placement="fill"/></CanvasWindowScope>`.
|
|
@@ -547,4 +648,4 @@ interface BrowserBarProps {
|
|
|
547
648
|
/** A browser's back · forward · reload · address bar, for a kind's leading slot or its body. */
|
|
548
649
|
declare function BrowserBar({ url, canGoBack, canGoForward, onBack, onForward, onReload, onNavigate, trailing, className }: BrowserBarProps): react.JSX.Element;
|
|
549
650
|
|
|
550
|
-
export { type AnyCanvasKind, BrowserBar, type BrowserBarProps, type BrowserTab, BrowserTabs, type BrowserTabsProps, CANVAS_TAB_LIST_ROOM, CANVAS_TAB_MIN_WIDTH, 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, type CanvasStripEntry, type CanvasStripTab, CanvasTab, type CanvasTabProps, type CanvasTabStripMode, type CanvasTabWindow, CanvasToggle, CanvasWindowScope, CanvasWindowTabs, beginCanvasResize, canvasSessionKey, defineCanvasKind, fitCanvasTabWindow, getCanvasKind, itemTitle, listCanvasKinds, planCanvasTabStrip, registerCanvasKind, registerCanvasKinds, useCanvas, useCanvasColumnWidth, useCanvasHostPorts, useCanvasIsPresented, useCanvasKind, useCanvasKindToggle, useCanvasKinds, useCanvasLauncherEntries, useCanvasLauncherEntry, useCanvasMenuItems, useCanvasNativeBodies, useCanvasPresentation, useCanvasState, useCanvasWindowId, useOptionalCanvas, useOptionalCanvasState };
|
|
651
|
+
export { type AnyCanvasKind, BrowserBar, type BrowserBarProps, type BrowserTab, BrowserTabs, type BrowserTabsProps, CANVAS_TAB_LIST_ROOM, CANVAS_TAB_MIN_WIDTH, CanvasColumn, type CanvasColumnProps, type CanvasFloating, CanvasFrame, CanvasHeaderButton, type CanvasHeaderButtonProps, type CanvasHostPorts, type CanvasKind, type CanvasKindIcon, CanvasKindIcons, type CanvasKindProps, type CanvasKindSurface, type CanvasLauncherEntry, type CanvasMenuEntry, type CanvasMenuItem, CanvasMenuTrigger, type CanvasNativeBodyFrame, type CanvasNativeBodyInfo, type CanvasNativeRect, type CanvasOutputHandlers, type CanvasOutputPorts, type CanvasOutputRequest, type CanvasOverlayPort, CanvasPaneView, CanvasPanel, CanvasPanelEmpty, type CanvasPanelProps, CanvasProvider, type CanvasProviderProps, type CanvasShowMenu, type CanvasStripEntry, type CanvasStripTab, CanvasTab, type CanvasTabProps, type CanvasTabStripMode, type CanvasTabWindow, CanvasToggle, CanvasWindowScope, CanvasWindowTabs, beginCanvasResize, canvasItemElement, canvasKindOutputProblems, canvasKindSurface, canvasOutputMenu, canvasSessionKey, defineCanvasKind, fitCanvasTabWindow, getCanvasKind, itemTitle, listCanvasKinds, planCanvasTabStrip, registerCanvasKind, registerCanvasKinds, useCanvas, useCanvasColumnWidth, useCanvasHostPorts, useCanvasIsPresented, useCanvasKind, useCanvasKindToggle, useCanvasKinds, useCanvasLauncherEntries, useCanvasLauncherEntry, useCanvasMenuItems, useCanvasNativeBodies, useCanvasOutput, useCanvasPresentation, useCanvasState, useCanvasWindowId, useOptionalCanvas, useOptionalCanvasState };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode, CSSProperties, ButtonHTMLAttributes, HTMLAttributes, ReactElement } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { i as CanvasItem, C as CanvasItemId, b as CanvasJson, d as CanvasPaneId, h as CanvasController, a as CanvasWindowId, Q as CanvasPresentation, V as CanvasSessionEvent, T as CanvasSessionAttachReason, U as CanvasSessionDetachReason, P as CanvasPreferredTarget, S as CanvasRect, e as CanvasStoreBinding, O as CanvasPersistencePort, F as CanvasErrorSink, I as CanvasLayoutRules, a0 as ToggleKindInput, H as CanvasKindVisibility, f as CanvasState } from './toggleKind-CI2nBjum.js';
|
|
4
|
+
|
|
5
|
+
/** What a body (or a kind) can do with its rendered output right now. */
|
|
6
|
+
interface CanvasOutputHandlers {
|
|
7
|
+
/** Print exactly what is shown (a frame page asks its own page to print). Runs inside the click. */
|
|
8
|
+
readonly print?: (() => void | Promise<void>) | undefined;
|
|
9
|
+
/** Save as PDF. Absent ⇒ the print dialog's "Save as PDF" (the Print handler) when there is one. */
|
|
10
|
+
readonly savePdf?: (() => void | Promise<void>) | undefined;
|
|
11
|
+
/** A full image of the item exactly as rendered (full height, the viewer's width). */
|
|
12
|
+
readonly capture?: (() => Promise<Blob>) | undefined;
|
|
13
|
+
/** A short honest reason an entry cannot run NOW ("Publishing the page…"). Shown in the menu, disabled. */
|
|
14
|
+
readonly unavailable?: {
|
|
15
|
+
readonly print?: string | undefined;
|
|
16
|
+
readonly capture?: string | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}
|
|
19
|
+
/** One request to the host's engines. */
|
|
20
|
+
interface CanvasOutputRequest {
|
|
21
|
+
readonly item: CanvasItem;
|
|
22
|
+
readonly kind: AnyCanvasKind | undefined;
|
|
23
|
+
readonly surface: CanvasKindSurface;
|
|
24
|
+
/** The body's root element in this window (null when it is not mounted here). */
|
|
25
|
+
readonly element: HTMLElement | null;
|
|
26
|
+
/** Tab title. */
|
|
27
|
+
readonly title: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The host's print / capture / attach engines (web: `@ai-matrx/print` and DOM
|
|
31
|
+
* capture; desktop: `webContents.print` / `capturePage`). Each returns null
|
|
32
|
+
* when it cannot serve that request — the entry is then absent.
|
|
33
|
+
*/
|
|
34
|
+
interface CanvasOutputPorts {
|
|
35
|
+
/** Print engine for an item the kind/body does not print itself ("dom" bodies). */
|
|
36
|
+
readonly print?: ((request: CanvasOutputRequest) => (() => void | Promise<void>) | null) | undefined;
|
|
37
|
+
/** Save-as-PDF engine. Absent ⇒ Print stands in (the print dialog saves PDFs). */
|
|
38
|
+
readonly savePdf?: ((request: CanvasOutputRequest) => (() => void | Promise<void>) | null) | undefined;
|
|
39
|
+
/** Capture engine (an image of the item). */
|
|
40
|
+
readonly capture?: ((request: CanvasOutputRequest) => (() => Promise<Blob>) | null) | undefined;
|
|
41
|
+
/** Puts an image on the clipboard. Default: `navigator.clipboard.write` with a PNG ClipboardItem. */
|
|
42
|
+
readonly copyImage?: ((image: Blob, request: CanvasOutputRequest) => Promise<void>) | undefined;
|
|
43
|
+
/** "Attach to chat ▸" options for the item (code · screenshot · text). Given the resolved capture, if any. */
|
|
44
|
+
readonly attachOptions?: ((request: CanvasOutputRequest, capture: (() => Promise<Blob>) | null) => readonly CanvasMenuItem[]) | undefined;
|
|
45
|
+
/** Where a failed entry is reported. Default: console.error. */
|
|
46
|
+
readonly onError?: ((message: string, error: unknown) => void) | undefined;
|
|
47
|
+
}
|
|
48
|
+
/** The body element of `itemId` in this document (the live tab, never a kept step). */
|
|
49
|
+
declare function canvasItemElement(itemId: string): HTMLElement | null;
|
|
50
|
+
/** A kind's surface, read defensively (a kind registered without `defineCanvasKind`). */
|
|
51
|
+
declare function canvasKindSurface(kind: AnyCanvasKind | undefined): CanvasKindSurface;
|
|
52
|
+
/**
|
|
53
|
+
* The standard entries for one item, in order: Print, Save as PDF, Copy
|
|
54
|
+
* image, then the host's Attach options. An entry nobody can serve is absent;
|
|
55
|
+
* one declared unavailable shows its reason, disabled — never a silent no-op.
|
|
56
|
+
*/
|
|
57
|
+
declare function canvasOutputMenu(input: {
|
|
58
|
+
readonly item: CanvasItem;
|
|
59
|
+
readonly kind: AnyCanvasKind | undefined;
|
|
60
|
+
readonly title: string;
|
|
61
|
+
readonly body: CanvasOutputHandlers;
|
|
62
|
+
readonly ports: CanvasOutputPorts | undefined;
|
|
63
|
+
}): CanvasMenuItem[];
|
|
64
|
+
/**
|
|
65
|
+
* A body offers its rendered output: `print` (a page printing itself),
|
|
66
|
+
* `capture` (an exact image), or an honest `unavailable` reason. The latest
|
|
67
|
+
* handlers are read each time the menu opens.
|
|
68
|
+
*/
|
|
69
|
+
declare function useCanvasOutput(itemId: CanvasItemId | string | null | undefined, handlers: CanvasOutputHandlers): void;
|
|
70
|
+
/**
|
|
71
|
+
* Guard for hosts' tests: what a kind's declaration lacks under the standard.
|
|
72
|
+
* Every kind declares `surface`; a "frame" or "native" kind declares `print`
|
|
73
|
+
* and `capture` (a handler, or an honest reason string).
|
|
74
|
+
*/
|
|
75
|
+
declare function canvasKindOutputProblems(kind: AnyCanvasKind): string[];
|
|
4
76
|
|
|
5
77
|
/**
|
|
6
78
|
* THE canvas kind registry. A kind is one sort of thing the canvas can show —
|
|
@@ -46,9 +118,31 @@ interface CanvasMenuItem {
|
|
|
46
118
|
readonly icon?: ReactNode;
|
|
47
119
|
readonly onSelect: () => void;
|
|
48
120
|
readonly destructive?: boolean;
|
|
121
|
+
/** Shown but not choosable — an honest "cannot, and why" entry (its label says why). */
|
|
122
|
+
readonly disabled?: boolean;
|
|
49
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* What a kind's body is, for printing and capturing it:
|
|
126
|
+
* - "dom": same-origin DOM — the host's DOM print and capture copy it as drawn.
|
|
127
|
+
* - "frame": drawn in a frame or a drawing surface (an iframe page, a canvas,
|
|
128
|
+
* WebGL, a map) that a DOM copy cannot reproduce — the kind declares its own
|
|
129
|
+
* `print` and `capture` (or an honest reason it cannot).
|
|
130
|
+
* - "native": drawn by the host outside the DOM (`body: "native"`) — same.
|
|
131
|
+
*/
|
|
132
|
+
type CanvasKindSurface = "dom" | "frame" | "native";
|
|
50
133
|
interface CanvasKind<TData extends CanvasJson = CanvasJson> {
|
|
51
134
|
readonly id: string;
|
|
135
|
+
/** Required, no default — see `CanvasKindSurface`. A guard holds every registered kind to it. */
|
|
136
|
+
readonly surface: CanvasKindSurface;
|
|
137
|
+
/**
|
|
138
|
+
* How a tab of this kind prints (the pane menu's Print / Save as PDF): a
|
|
139
|
+
* handler, or a short honest reason it cannot ("not yet for live apps"),
|
|
140
|
+
* shown disabled; `false` when there is nothing to print (a launcher). Absent on a "dom" kind ⇒ the host's DOM print. A body can
|
|
141
|
+
* offer a better answer at run time with `useCanvasOutput`.
|
|
142
|
+
*/
|
|
143
|
+
readonly print?: ((request: CanvasOutputRequest) => void | Promise<void>) | string | false;
|
|
144
|
+
/** How a tab of this kind becomes an image (Copy image, Attach screenshot): a handler or an honest reason. */
|
|
145
|
+
readonly capture?: ((request: CanvasOutputRequest) => Promise<Blob>) | string | false;
|
|
52
146
|
/** Singular noun shown in menus and the empty-pane launcher. */
|
|
53
147
|
readonly label: string;
|
|
54
148
|
readonly icon: ComponentType<{
|
|
@@ -178,6 +272,7 @@ type CanvasMenuEntry = {
|
|
|
178
272
|
readonly id: string;
|
|
179
273
|
readonly label: string;
|
|
180
274
|
readonly destructive?: boolean;
|
|
275
|
+
readonly disabled?: boolean;
|
|
181
276
|
} | {
|
|
182
277
|
readonly type: "separator";
|
|
183
278
|
};
|
|
@@ -220,6 +315,12 @@ interface CanvasHostPorts {
|
|
|
220
315
|
readonly overlay?: CanvasOverlayPort | undefined;
|
|
221
316
|
/** Where each native-body kind's view goes, reported in the frame the layout changed. */
|
|
222
317
|
readonly onNativeBodyFrame?: CanvasNativeBodyFrame | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* The print / capture / attach engines behind the standard entries (Print,
|
|
320
|
+
* Save as PDF, Copy image, Attach to chat ▸). Absent ⇒ only what kinds and
|
|
321
|
+
* bodies serve themselves is offered.
|
|
322
|
+
*/
|
|
323
|
+
readonly output?: CanvasOutputPorts | undefined;
|
|
223
324
|
}
|
|
224
325
|
type CanvasTabStripMode = "auto" | "always";
|
|
225
326
|
/**
|
|
@@ -256,7 +357,7 @@ interface CanvasProviderProps extends CanvasHostPorts {
|
|
|
256
357
|
/** "auto": a pane with one tab shows a title instead of a tab strip. Default "auto". */
|
|
257
358
|
readonly tabStrip?: CanvasTabStripMode;
|
|
258
359
|
}
|
|
259
|
-
declare function CanvasProvider({ children, store, persistence, onError, hotkeys, windowId: windowIdProp, layoutRules, regionWidth, tabStrip, itemActions, popOut, dockBack, showMenu, overlay, onNativeBodyFrame, }: CanvasProviderProps): react.JSX.Element;
|
|
360
|
+
declare function CanvasProvider({ children, store, persistence, onError, hotkeys, windowId: windowIdProp, layoutRules, regionWidth, tabStrip, itemActions, popOut, dockBack, showMenu, overlay, onNativeBodyFrame, output, }: CanvasProviderProps): react.JSX.Element;
|
|
260
361
|
/**
|
|
261
362
|
* Renders a subtree as ANOTHER window of the same canvas — the web host's
|
|
262
363
|
* pop-out panel: `<CanvasWindowScope windowId={id}><CanvasColumn placement="fill"/></CanvasWindowScope>`.
|
|
@@ -547,4 +648,4 @@ interface BrowserBarProps {
|
|
|
547
648
|
/** A browser's back · forward · reload · address bar, for a kind's leading slot or its body. */
|
|
548
649
|
declare function BrowserBar({ url, canGoBack, canGoForward, onBack, onForward, onReload, onNavigate, trailing, className }: BrowserBarProps): react.JSX.Element;
|
|
549
650
|
|
|
550
|
-
export { type AnyCanvasKind, BrowserBar, type BrowserBarProps, type BrowserTab, BrowserTabs, type BrowserTabsProps, CANVAS_TAB_LIST_ROOM, CANVAS_TAB_MIN_WIDTH, 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, type CanvasStripEntry, type CanvasStripTab, CanvasTab, type CanvasTabProps, type CanvasTabStripMode, type CanvasTabWindow, CanvasToggle, CanvasWindowScope, CanvasWindowTabs, beginCanvasResize, canvasSessionKey, defineCanvasKind, fitCanvasTabWindow, getCanvasKind, itemTitle, listCanvasKinds, planCanvasTabStrip, registerCanvasKind, registerCanvasKinds, useCanvas, useCanvasColumnWidth, useCanvasHostPorts, useCanvasIsPresented, useCanvasKind, useCanvasKindToggle, useCanvasKinds, useCanvasLauncherEntries, useCanvasLauncherEntry, useCanvasMenuItems, useCanvasNativeBodies, useCanvasPresentation, useCanvasState, useCanvasWindowId, useOptionalCanvas, useOptionalCanvasState };
|
|
651
|
+
export { type AnyCanvasKind, BrowserBar, type BrowserBarProps, type BrowserTab, BrowserTabs, type BrowserTabsProps, CANVAS_TAB_LIST_ROOM, CANVAS_TAB_MIN_WIDTH, CanvasColumn, type CanvasColumnProps, type CanvasFloating, CanvasFrame, CanvasHeaderButton, type CanvasHeaderButtonProps, type CanvasHostPorts, type CanvasKind, type CanvasKindIcon, CanvasKindIcons, type CanvasKindProps, type CanvasKindSurface, type CanvasLauncherEntry, type CanvasMenuEntry, type CanvasMenuItem, CanvasMenuTrigger, type CanvasNativeBodyFrame, type CanvasNativeBodyInfo, type CanvasNativeRect, type CanvasOutputHandlers, type CanvasOutputPorts, type CanvasOutputRequest, type CanvasOverlayPort, CanvasPaneView, CanvasPanel, CanvasPanelEmpty, type CanvasPanelProps, CanvasProvider, type CanvasProviderProps, type CanvasShowMenu, type CanvasStripEntry, type CanvasStripTab, CanvasTab, type CanvasTabProps, type CanvasTabStripMode, type CanvasTabWindow, CanvasToggle, CanvasWindowScope, CanvasWindowTabs, beginCanvasResize, canvasItemElement, canvasKindOutputProblems, canvasKindSurface, canvasOutputMenu, canvasSessionKey, defineCanvasKind, fitCanvasTabWindow, getCanvasKind, itemTitle, listCanvasKinds, planCanvasTabStrip, registerCanvasKind, registerCanvasKinds, useCanvas, useCanvasColumnWidth, useCanvasHostPorts, useCanvasIsPresented, useCanvasKind, useCanvasKindToggle, useCanvasKinds, useCanvasLauncherEntries, useCanvasLauncherEntry, useCanvasMenuItems, useCanvasNativeBodies, useCanvasOutput, useCanvasPresentation, useCanvasState, useCanvasWindowId, useOptionalCanvas, useOptionalCanvasState };
|