@open-artifact/editor-kit 0.9.2 → 0.11.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/package.json +4 -4
- package/src/chrome.d.ts +13 -4
- package/src/chrome.js +40 -9
- package/src/clipboard.d.ts +19 -0
- package/src/clipboard.js +48 -0
- package/src/collab/comments.js +24 -2
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/menu-fit.d.ts +12 -0
- package/src/menu-fit.js +9 -0
- package/src/react.d.ts +1 -0
- package/src/react.js +1 -0
- package/src/shell.d.ts +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-artifact/editor-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "What every artifact editor shares: collaboration (comments, presence, history), roles and host session, Shell chrome reports, find, recovery stashes, line merge, announcements, chrome primitives and design-system loading.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@base-ui/react": "^1.8.0",
|
|
25
|
-
"@open-artifact/design-system-core": "0.
|
|
26
|
-
"@open-artifact/runtime": "0.
|
|
27
|
-
"@open-artifact/ui": "0.
|
|
25
|
+
"@open-artifact/design-system-core": "0.11.0",
|
|
26
|
+
"@open-artifact/runtime": "0.11.0",
|
|
27
|
+
"@open-artifact/ui": "0.11.0",
|
|
28
28
|
"clsx": "^2.1.1",
|
|
29
29
|
"lucide-react": "^1.65.0",
|
|
30
30
|
"zustand": "^5.0.10",
|
package/src/chrome.d.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* `shadow-chrome`, `bg-tip`…); the focus ring is `outline-chrome-focus`, so
|
|
16
16
|
* each editor picks its own focus color.
|
|
17
17
|
*/
|
|
18
|
+
import { Popover as BasePopover } from '@base-ui/react/popover';
|
|
18
19
|
import { type ButtonHTMLAttributes, type CSSProperties, type HTMLAttributes, type ReactElement, type ReactNode } from 'react';
|
|
19
20
|
import type { ChromeDraw, ShellConnection } from '@open-artifact/runtime';
|
|
20
21
|
/** A floating chrome card. */
|
|
@@ -110,7 +111,7 @@ export interface ChromeMenuItemProps {
|
|
|
110
111
|
icon?: ReactNode;
|
|
111
112
|
title?: string;
|
|
112
113
|
}
|
|
113
|
-
/** One menu row. */
|
|
114
|
+
/** One menu row. A row that closes the menu keeps the rest of a double click from reaching what the menu uncovers. */
|
|
114
115
|
export declare function ChromeMenuItem({ children, onSelect, shortcut, checked, disabled, danger, icon, title, description, closeOnClick }: ChromeMenuItemProps): ReactNode;
|
|
115
116
|
/** A submenu row and its popup. */
|
|
116
117
|
export declare function ChromeSubmenu({ label, icon, children, disabled, className, mark, popupBase, }: {
|
|
@@ -138,7 +139,7 @@ export interface ChromePopoverProps {
|
|
|
138
139
|
side?: ChromeSide;
|
|
139
140
|
align?: 'start' | 'center' | 'end';
|
|
140
141
|
open?: boolean;
|
|
141
|
-
onOpenChange?: (open: boolean) => void;
|
|
142
|
+
onOpenChange?: (open: boolean, details: ChromePopoverChange) => void;
|
|
142
143
|
className?: string;
|
|
143
144
|
/** Accessible name of the popup. */
|
|
144
145
|
label?: string;
|
|
@@ -153,9 +154,17 @@ export interface ChromePopoverProps {
|
|
|
153
154
|
/** Popup classes in place of {@link POPUP}. */
|
|
154
155
|
popupBase?: string;
|
|
155
156
|
style?: CSSProperties;
|
|
157
|
+
/**
|
|
158
|
+
* Once something has been typed into a field of the popup (other than a
|
|
159
|
+
* search field), a press outside no longer closes it: Escape, or the
|
|
160
|
+
* popup's own buttons, do.
|
|
161
|
+
*/
|
|
162
|
+
holdWhileTyped?: boolean;
|
|
156
163
|
}
|
|
157
|
-
/**
|
|
158
|
-
export
|
|
164
|
+
/** Why a {@link ChromePopover} opens or closes; `cancel()` keeps it as it is. */
|
|
165
|
+
export type ChromePopoverChange = BasePopover.Root.ChangeEventDetails;
|
|
166
|
+
/** A floating chrome panel anchored to a trigger (or to `anchor`). A press outside that closes it does not double-click what is under it. */
|
|
167
|
+
export declare function ChromePopover({ trigger, children, side, align, open, onOpenChange, className, label, anchor, gap, initialFocus, mark, popupBase, style, holdWhileTyped, }: ChromePopoverProps): ReactNode;
|
|
159
168
|
/** One color choice of a {@link SwatchRow}. */
|
|
160
169
|
export interface Swatch {
|
|
161
170
|
/** The value stored (a palette name or `#rrggbb`). */
|
package/src/chrome.js
CHANGED
|
@@ -20,8 +20,9 @@ import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
|
20
20
|
import { Popover as BasePopover } from '@base-ui/react/popover';
|
|
21
21
|
import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';
|
|
22
22
|
import { Check, ChevronRight } from 'lucide-react';
|
|
23
|
-
import { forwardRef, useEffect, useState } from 'react';
|
|
24
|
-
import { cn } from '@open-artifact/ui';
|
|
23
|
+
import { forwardRef, useEffect, useRef, useState } from 'react';
|
|
24
|
+
import { cn, swallowFollowUpClicks } from '@open-artifact/ui';
|
|
25
|
+
import { menuFit } from "./menu-fit.js";
|
|
25
26
|
/** A floating chrome card. */
|
|
26
27
|
export const Card = forwardRef(function Card({ className, ...rest }, ref) {
|
|
27
28
|
return _jsx("div", { ref: ref, className: cn('pointer-events-auto flex items-center gap-1 rounded-[12px] bg-chrome text-chrome-fg shadow-chrome', className), ...rest });
|
|
@@ -63,15 +64,19 @@ const ITEM = 'flex h-7 cursor-default select-none items-center gap-2 rounded-[8p
|
|
|
63
64
|
/** A chrome menu. `trigger` is rendered as the menu's trigger. */
|
|
64
65
|
export function ChromeMenu({ trigger, children, side = 'bottom', align = 'start', className, tip, open, onOpenChange, sideOffset = 6, mark, popupBase = POPUP, }) {
|
|
65
66
|
const triggerElement = _jsx(BaseMenu.Trigger, { render: trigger });
|
|
66
|
-
return (_jsxs(BaseMenu.Root, { open: open, onOpenChange: onOpenChange ? (next) => onOpenChange(next) : undefined, children: [tip ? (_jsx(Tip, { label: tip.label, shortcut: tip.shortcut, side: tip.side ?? (side === 'top' ? 'top' : 'bottom'), children: triggerElement })) : (triggerElement), _jsx(BaseMenu.Portal, { children: _jsx(BaseMenu.Positioner, { side: side, align: align, sideOffset: sideOffset, className: "z-[1000]", children: _jsx(BaseMenu.Popup, { ...marked(mark), className: cn(popupBase, className), children: children }) }) })] }));
|
|
67
|
+
return (_jsxs(BaseMenu.Root, { open: open, onOpenChange: onOpenChange ? (next) => onOpenChange(next) : undefined, children: [tip ? (_jsx(Tip, { label: tip.label, shortcut: tip.shortcut, side: tip.side ?? (side === 'top' ? 'top' : 'bottom'), children: triggerElement })) : (triggerElement), _jsx(BaseMenu.Portal, { children: _jsx(BaseMenu.Positioner, { side: side, align: align, sideOffset: sideOffset, className: "z-[1000]", children: _jsx(BaseMenu.Popup, { ...marked(mark), className: cn(popupBase, className), style: menuFit(className), children: children }) }) })] }));
|
|
67
68
|
}
|
|
68
|
-
/** One menu row. */
|
|
69
|
+
/** One menu row. A row that closes the menu keeps the rest of a double click from reaching what the menu uncovers. */
|
|
69
70
|
export function ChromeMenuItem({ children, onSelect, shortcut, checked, disabled, danger, icon, title, description, closeOnClick }) {
|
|
70
|
-
return (_jsxs(BaseMenu.Item, { className: cn(ITEM, description !== undefined && 'h-auto min-h-7 items-start py-1.5', danger && 'text-danger data-[highlighted]:bg-danger data-[highlighted]:text-white'), disabled: disabled, onClick:
|
|
71
|
+
return (_jsxs(BaseMenu.Item, { className: cn(ITEM, description !== undefined && 'h-auto min-h-7 items-start py-1.5', danger && 'text-danger data-[highlighted]:bg-danger data-[highlighted]:text-white'), disabled: disabled, onClick: (event) => {
|
|
72
|
+
if (closeOnClick !== false)
|
|
73
|
+
swallowFollowUpClicks(event.nativeEvent);
|
|
74
|
+
onSelect?.();
|
|
75
|
+
}, closeOnClick: closeOnClick, title: title, children: [checked !== undefined ? (_jsx("span", { className: "flex size-4 shrink-0 items-center justify-center", children: checked ? _jsx(Check, { className: "size-4 text-chrome-accent", strokeWidth: 2.25 }) : null })) : null, icon ? _jsx("span", { "data-chrome-icon": "", className: "flex size-4 shrink-0 items-center justify-center text-chrome-muted", children: icon }) : null, description !== undefined ? (_jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx("span", { className: "truncate", children: children }), _jsx("span", { className: "truncate text-[12px] leading-4 text-chrome-muted", children: description })] })) : (_jsx("span", { className: "min-w-0 flex-1 truncate", children: children })), shortcut ? _jsx("span", { className: "ml-6 max-w-40 shrink-0 truncate text-[13px] text-chrome-muted", children: shortcut }) : null] }));
|
|
71
76
|
}
|
|
72
77
|
/** A submenu row and its popup. */
|
|
73
78
|
export function ChromeSubmenu({ label, icon, children, disabled, className, mark, popupBase = POPUP, }) {
|
|
74
|
-
return (_jsxs(BaseMenu.SubmenuRoot, { children: [_jsxs(BaseMenu.SubmenuTrigger, { className: ITEM, disabled: disabled, children: [icon ? _jsx("span", { "data-chrome-icon": "", className: "flex size-4 shrink-0 items-center justify-center text-chrome-muted", children: icon }) : null, _jsx("span", { className: "min-w-0 flex-1 truncate", children: label }), _jsx(ChevronRight, { className: "size-4 shrink-0 text-chrome-muted", strokeWidth: 1.5 })] }), _jsx(BaseMenu.Portal, { children: _jsx(BaseMenu.Positioner, { sideOffset: 4, className: "z-[1000]", children: _jsx(BaseMenu.Popup, { ...marked(mark), className: cn(popupBase, className), children: children }) }) })] }));
|
|
79
|
+
return (_jsxs(BaseMenu.SubmenuRoot, { children: [_jsxs(BaseMenu.SubmenuTrigger, { className: ITEM, disabled: disabled, children: [icon ? _jsx("span", { "data-chrome-icon": "", className: "flex size-4 shrink-0 items-center justify-center text-chrome-muted", children: icon }) : null, _jsx("span", { className: "min-w-0 flex-1 truncate", children: label }), _jsx(ChevronRight, { className: "size-4 shrink-0 text-chrome-muted", strokeWidth: 1.5 })] }), _jsx(BaseMenu.Portal, { children: _jsx(BaseMenu.Positioner, { sideOffset: 4, className: "z-[1000]", children: _jsx(BaseMenu.Popup, { ...marked(mark), className: cn(popupBase, className), style: menuFit(className), children: children }) }) })] }));
|
|
75
80
|
}
|
|
76
81
|
/** A menu separator. */
|
|
77
82
|
export function ChromeMenuSeparator() {
|
|
@@ -81,9 +86,35 @@ export function ChromeMenuSeparator() {
|
|
|
81
86
|
export function ChromeMenuLabel({ children }) {
|
|
82
87
|
return _jsx("div", { className: "px-2.5 py-1 text-[13px] font-medium text-chrome-muted", children: children });
|
|
83
88
|
}
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
/** True for a field whose typing is a search (a filter, not an edit worth keeping). */
|
|
90
|
+
function isSearchField(target) {
|
|
91
|
+
if (!(target instanceof HTMLElement))
|
|
92
|
+
return true;
|
|
93
|
+
if (!target.matches('input, textarea, [contenteditable="true"]'))
|
|
94
|
+
return true;
|
|
95
|
+
return target.matches('[type="search"], [role="searchbox"], [role="combobox"]');
|
|
96
|
+
}
|
|
97
|
+
/** A floating chrome panel anchored to a trigger (or to `anchor`). A press outside that closes it does not double-click what is under it. */
|
|
98
|
+
export function ChromePopover({ trigger, children, side = 'top', align = 'center', open, onOpenChange, className, label, anchor, gap = 8, initialFocus = true, mark, popupBase = POPUP, style, holdWhileTyped = false, }) {
|
|
99
|
+
const typed = useRef(false);
|
|
100
|
+
const change = (next, details) => {
|
|
101
|
+
if (!next && details.reason === 'outside-press') {
|
|
102
|
+
if (holdWhileTyped && typed.current) {
|
|
103
|
+
details.cancel();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (details.event instanceof MouseEvent)
|
|
107
|
+
swallowFollowUpClicks(details.event);
|
|
108
|
+
}
|
|
109
|
+
onOpenChange?.(next, details);
|
|
110
|
+
};
|
|
111
|
+
return (_jsxs(BasePopover.Root, { open: open, onOpenChange: change, onOpenChangeComplete: (done) => {
|
|
112
|
+
if (!done)
|
|
113
|
+
typed.current = false;
|
|
114
|
+
}, children: [_jsx(BasePopover.Trigger, { render: trigger }), _jsx(BasePopover.Portal, { children: _jsx(BasePopover.Positioner, { side: side, align: align, sideOffset: gap, anchor: anchor ?? undefined, className: "z-[1000]", children: _jsx(BasePopover.Popup, { ...marked(mark), "aria-label": label, initialFocus: initialFocus ? undefined : false, className: cn(popupBase, className), style: style, onInput: (event) => {
|
|
115
|
+
if (!isSearchField(event.target))
|
|
116
|
+
typed.current = true;
|
|
117
|
+
}, children: children }) }) })] }));
|
|
87
118
|
}
|
|
88
119
|
/** A row of round color swatches (radio semantics); the current one is ringed in the chrome accent. */
|
|
89
120
|
export function SwatchRow({ label, swatches, current, onPick, size = 20, className, }) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writing the system clipboard from an editor. Some browsers keep the
|
|
3
|
+
* clipboard from framed pages whatever the frame's `allow` says; there the
|
|
4
|
+
* Open Artifact Shell framing the editor writes instead (it may, right after
|
|
5
|
+
* a press in the frame). Pure (no DOM until called).
|
|
6
|
+
*/
|
|
7
|
+
import type { ShellConnection } from '@open-artifact/runtime';
|
|
8
|
+
/** The browser refused the clipboard (rather than failing on the content). */
|
|
9
|
+
export declare function clipboardRefused(error: unknown): boolean;
|
|
10
|
+
/** Formats can be copied: by the browser, or by the Shell framing the page. */
|
|
11
|
+
export declare function canWriteClipboard(shell?: ShellConnection | null): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Writes one clipboard item. Call it on the person's press without awaiting
|
|
14
|
+
* anything first (a format may still be a promise, such as an image being
|
|
15
|
+
* drawn). Where the browser refuses this page, the Shell writes it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function writeClipboard(items: Record<string, Blob | PromiseLike<Blob>>, shell?: ShellConnection | null): Promise<void>;
|
|
18
|
+
/** Writes text to the clipboard, through the Shell where the browser refuses this page. */
|
|
19
|
+
export declare function writeClipboardText(text: string, shell?: ShellConnection | null): Promise<void>;
|
package/src/clipboard.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writing the system clipboard from an editor. Some browsers keep the
|
|
3
|
+
* clipboard from framed pages whatever the frame's `allow` says; there the
|
|
4
|
+
* Open Artifact Shell framing the editor writes instead (it may, right after
|
|
5
|
+
* a press in the frame). Pure (no DOM until called).
|
|
6
|
+
*/
|
|
7
|
+
/** The browser itself writes clipboard formats (images, HTML) here. */
|
|
8
|
+
const browserWrites = () => typeof ClipboardItem !== 'undefined' && Boolean(globalThis.navigator?.clipboard?.write);
|
|
9
|
+
/** The browser refused the clipboard (rather than failing on the content). */
|
|
10
|
+
export function clipboardRefused(error) {
|
|
11
|
+
return typeof error === 'object' && error !== null && error.name === 'NotAllowedError';
|
|
12
|
+
}
|
|
13
|
+
/** Formats can be copied: by the browser, or by the Shell framing the page. */
|
|
14
|
+
export function canWriteClipboard(shell) {
|
|
15
|
+
return browserWrites() || Boolean(shell?.writesClipboard);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Writes one clipboard item. Call it on the person's press without awaiting
|
|
19
|
+
* anything first (a format may still be a promise, such as an image being
|
|
20
|
+
* drawn). Where the browser refuses this page, the Shell writes it.
|
|
21
|
+
*/
|
|
22
|
+
export async function writeClipboard(items, shell) {
|
|
23
|
+
if (browserWrites()) {
|
|
24
|
+
try {
|
|
25
|
+
await navigator.clipboard.write([new ClipboardItem(items)]);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (!shell?.writesClipboard || !clipboardRefused(error))
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (!shell?.writesClipboard) {
|
|
34
|
+
throw new Error('This browser cannot copy to the clipboard.');
|
|
35
|
+
}
|
|
36
|
+
await shell.writeClipboard(items);
|
|
37
|
+
}
|
|
38
|
+
/** Writes text to the clipboard, through the Shell where the browser refuses this page. */
|
|
39
|
+
export async function writeClipboardText(text, shell) {
|
|
40
|
+
try {
|
|
41
|
+
await navigator.clipboard.writeText(text);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (!shell?.writesClipboard || !clipboardRefused(error))
|
|
45
|
+
throw error;
|
|
46
|
+
await shell.writeClipboard({ 'text/plain': new Blob([text], { type: 'text/plain' }) });
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/collab/comments.js
CHANGED
|
@@ -267,9 +267,31 @@ export function createComments(adapter) {
|
|
|
267
267
|
}
|
|
268
268
|
},
|
|
269
269
|
async sendAllToAgent() {
|
|
270
|
+
if (!capability || !canSendToAgent())
|
|
271
|
+
return;
|
|
270
272
|
const open = store.getState().threads.filter((t) => controller.canSendThread(t));
|
|
271
|
-
|
|
272
|
-
|
|
273
|
+
if (!open.length)
|
|
274
|
+
return;
|
|
275
|
+
// All at once: the host merges what reaches it within a short window into one message, so the agent gets
|
|
276
|
+
// every thread in one turn. One after another, each would wait out the window and arrive (or queue) alone.
|
|
277
|
+
if (adapter.sendToAgent) {
|
|
278
|
+
await Promise.all(open.map((thread) => adapter.sendToAgent(thread, anchorOf(thread))));
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const cap = capability;
|
|
282
|
+
const results = await Promise.allSettled(open.map((thread) => cap.sendToAgent(thread.id)));
|
|
283
|
+
let sent = 0;
|
|
284
|
+
for (const result of results) {
|
|
285
|
+
if (result.status === 'fulfilled') {
|
|
286
|
+
put(result.value);
|
|
287
|
+
sent++;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (sent)
|
|
291
|
+
notify(sentNotice(adapter.agentName?.() || 'the agent', adapter.agentWakesIdle?.()));
|
|
292
|
+
const failure = results.find((result) => result.status === 'rejected');
|
|
293
|
+
if (failure)
|
|
294
|
+
failed(failure.reason);
|
|
273
295
|
},
|
|
274
296
|
canSendThread(thread) {
|
|
275
297
|
if (thread.status !== 'open')
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The inline style {@link menuFit} gives a popup. */
|
|
2
|
+
export interface MenuFitStyle {
|
|
3
|
+
maxHeight: string;
|
|
4
|
+
overflowY: 'auto';
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Keeps a menu inside a short window: a popup with no height limit of its
|
|
8
|
+
* own scrolls, headings and all, within the height Base UI measured free
|
|
9
|
+
* next to its trigger (`--available-height`). A popup whose classes set a
|
|
10
|
+
* `max-h-*` keeps that limit.
|
|
11
|
+
*/
|
|
12
|
+
export declare function menuFit(className?: string): MenuFitStyle | undefined;
|
package/src/menu-fit.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps a menu inside a short window: a popup with no height limit of its
|
|
3
|
+
* own scrolls, headings and all, within the height Base UI measured free
|
|
4
|
+
* next to its trigger (`--available-height`). A popup whose classes set a
|
|
5
|
+
* `max-h-*` keeps that limit.
|
|
6
|
+
*/
|
|
7
|
+
export function menuFit(className) {
|
|
8
|
+
return className && /(^|\s)max-h-/.test(className) ? undefined : { maxHeight: 'var(--available-height)', overflowY: 'auto' };
|
|
9
|
+
}
|
package/src/react.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './collab/HistoryViews.tsx';
|
|
|
11
11
|
export * from './collab/PresenceViews.tsx';
|
|
12
12
|
export * from './Announcer.tsx';
|
|
13
13
|
export * from './chrome.tsx';
|
|
14
|
+
export { menuFit } from './menu-fit.ts';
|
|
14
15
|
export * from './FindBar.tsx';
|
|
15
16
|
export * from './PanelEdge.tsx';
|
|
16
17
|
/** Key labels for the chrome's shortcut chips (also in the pure entry). */
|
package/src/react.js
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./collab/HistoryViews.js";
|
|
|
11
11
|
export * from "./collab/PresenceViews.js";
|
|
12
12
|
export * from "./Announcer.js";
|
|
13
13
|
export * from "./chrome.js";
|
|
14
|
+
export { menuFit } from "./menu-fit.js";
|
|
14
15
|
export * from "./FindBar.js";
|
|
15
16
|
export * from "./PanelEdge.js";
|
|
16
17
|
/** Key labels for the chrome's shortcut chips (also in the pure entry). */
|
package/src/shell.d.ts
CHANGED
|
@@ -32,7 +32,11 @@ export interface ShellDrawsState {
|
|
|
32
32
|
/** A Shell frames this page. */
|
|
33
33
|
framed: boolean;
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* A handler of Shell commands; may answer an `exports` request with items.
|
|
37
|
+
* Every command reaches every handler, `follow` too (sent where the report
|
|
38
|
+
* has `following`, with a key from its `peers` or `null` to stop).
|
|
39
|
+
*/
|
|
36
40
|
export type ShellCommandHandler = (command: ChromeCommand) => ChromeExportItem[] | void;
|
|
37
41
|
/** A bridge made by {@link createShellBridge}. */
|
|
38
42
|
export interface ShellBridge {
|