@peers-app/peers-ui 0.33.24 → 0.34.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/dist/command-palette/command-palette.js +4 -2
- package/dist/components/router.d.ts +1 -0
- package/dist/components/router.js +4 -1
- package/dist/host-shell/host-shell-consumer.js +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -1
- package/dist/isolated-screens/config.d.ts +51 -0
- package/dist/isolated-screens/config.js +73 -0
- package/dist/isolated-screens/frame-autostart.d.ts +1 -0
- package/dist/isolated-screens/frame-autostart.js +18 -0
- package/dist/isolated-screens/frame-bridge.d.ts +30 -0
- package/dist/isolated-screens/frame-bridge.js +113 -0
- package/dist/isolated-screens/frame-component.d.ts +6 -0
- package/dist/isolated-screens/frame-component.js +20 -0
- package/dist/isolated-screens/frame-document.d.ts +28 -0
- package/dist/isolated-screens/frame-document.js +77 -0
- package/dist/isolated-screens/frame-policy.d.ts +17 -0
- package/dist/isolated-screens/frame-policy.js +230 -0
- package/dist/isolated-screens/frame-protocol.d.ts +196 -0
- package/dist/isolated-screens/frame-protocol.js +150 -0
- package/dist/isolated-screens/frame-pvars.d.ts +33 -0
- package/dist/isolated-screens/frame-pvars.js +152 -0
- package/dist/isolated-screens/frame-realm.d.ts +12 -0
- package/dist/isolated-screens/frame-realm.js +31 -0
- package/dist/isolated-screens/frame-runtime.d.ts +5 -0
- package/dist/isolated-screens/frame-runtime.js +494 -0
- package/dist/isolated-screens/frame-storage.d.ts +43 -0
- package/dist/isolated-screens/frame-storage.js +85 -0
- package/dist/isolated-screens/index.d.ts +3 -0
- package/dist/isolated-screens/index.js +13 -0
- package/dist/isolated-screens/isolated-screen.d.ts +193 -0
- package/dist/isolated-screens/isolated-screen.js +695 -0
- package/dist/isolated-screens/piece-frames.d.ts +27 -0
- package/dist/isolated-screens/piece-frames.js +351 -0
- package/dist/isolated-screens/piece-reach.d.ts +11 -0
- package/dist/isolated-screens/piece-reach.js +56 -0
- package/dist/isolated-screens/port-channel.d.ts +47 -0
- package/dist/isolated-screens/port-channel.js +153 -0
- package/dist/isolated-screens/routes-sandbox.d.ts +8 -0
- package/dist/isolated-screens/routes-sandbox.js +130 -0
- package/dist/isolated-screens/screen-tab-context.d.ts +4 -0
- package/dist/isolated-screens/screen-tab-context.js +6 -0
- package/dist/isolated-screens/test-ports.d.ts +3 -0
- package/dist/isolated-screens/test-ports.js +21 -0
- package/dist/isolated-screens/wheel-relay.d.ts +48 -0
- package/dist/isolated-screens/wheel-relay.js +186 -0
- package/dist/mentions/mentions-client.js +9 -0
- package/dist/notifications/index.js +9 -5
- package/dist/operator-console/console-copy.d.ts +15 -0
- package/dist/operator-console/console-copy.js +97 -0
- package/dist/operator-console/console-header.d.ts +33 -0
- package/dist/operator-console/console-header.js +67 -0
- package/dist/operator-console/console-input.d.ts +20 -0
- package/dist/operator-console/console-input.js +313 -0
- package/dist/operator-console/console-repl.d.ts +7 -0
- package/dist/operator-console/console-repl.js +108 -0
- package/dist/operator-console/console-scope.d.ts +45 -0
- package/dist/operator-console/console-scope.js +174 -0
- package/dist/operator-console/console-screen.d.ts +8 -0
- package/dist/operator-console/console-screen.js +32 -0
- package/dist/operator-console/console-session.d.ts +106 -0
- package/dist/operator-console/console-session.js +567 -0
- package/dist/operator-console/console-test-host.d.ts +21 -0
- package/dist/operator-console/console-test-host.js +114 -0
- package/dist/operator-console/console-theme.d.ts +41 -0
- package/dist/operator-console/console-theme.js +55 -0
- package/dist/operator-console/console-value.d.ts +27 -0
- package/dist/operator-console/console-value.js +291 -0
- package/dist/operator-console/operator-console-state.js +3 -1
- package/dist/operator-console/operator-console.d.ts +8 -21
- package/dist/operator-console/operator-console.js +8 -61
- package/dist/root-layout/app-shell-height.d.ts +16 -3
- package/dist/root-layout/app-shell-height.js +17 -4
- package/dist/root-layout/host-app-menu.d.ts +17 -0
- package/dist/root-layout/host-app-menu.js +22 -0
- package/dist/root-layout/layouts/full-screen-layout.js +4 -2
- package/dist/system-apps/console.app.d.ts +15 -0
- package/dist/system-apps/console.app.js +25 -0
- package/dist/system-apps/index.d.ts +1 -0
- package/dist/system-apps/index.js +6 -1
- package/dist/tabs-layout/tabs-layout.js +12 -20
- package/dist/tabs-layout/tabs-state.js +39 -16
- package/dist/theme.css +32 -5
- package/dist/ui-contracts/piece-height.d.ts +18 -0
- package/dist/ui-contracts/piece-height.js +15 -0
- package/dist/ui-contracts/piece-host.d.ts +24 -1
- package/dist/ui-contracts/piece-host.js +53 -2
- package/dist/ui-contracts/piece-props.d.ts +16 -0
- package/dist/ui-contracts/piece-props.js +39 -0
- package/dist/ui-contracts/piece-resolution.d.ts +5 -0
- package/dist/ui-contracts/piece-resolution.js +38 -2
- package/dist/ui-contracts/piece.d.ts +2 -7
- package/dist/ui-contracts/piece.js +22 -37
- package/dist/ui-contracts/popover-surface.d.ts +14 -0
- package/dist/ui-contracts/popover-surface.js +32 -3
- package/dist/ui-inspection/dom-actions.d.ts +23 -0
- package/dist/ui-inspection/dom-actions.js +169 -0
- package/dist/ui-inspection/dom-inspector.d.ts +20 -0
- package/dist/ui-inspection/dom-inspector.js +184 -0
- package/dist/ui-inspection/index.d.ts +73 -0
- package/dist/ui-inspection/index.js +147 -0
- package/dist/ui-router/find-route.d.ts +6 -0
- package/dist/ui-router/find-route.js +22 -0
- package/dist/ui-router/routes-loader.js +23 -4
- package/dist/ui-router/runnable-version.js +3 -0
- package/dist/ui-router/ui-loader.d.ts +6 -1
- package/dist/ui-router/ui-loader.js +102 -26
- package/package.json +3 -3
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { type IContractPiece, type IPackage, type Observable } from "@peers-app/peers-sdk";
|
|
2
|
+
import { type IPieceBundle } from "../ui-contracts/piece-host";
|
|
3
|
+
/**
|
|
4
|
+
* The host side of an isolated package screen: the frame, and everything the host does for it.
|
|
5
|
+
*
|
|
6
|
+
* The host makes the frame and boots it (`frame-document.ts`). It then serves the frame over the
|
|
7
|
+
* port: a contract session that acts as the screen's package, the legacy RPC its policy allows,
|
|
8
|
+
* the package's persistent variables and `localStorage`, navigation of the screen's own tab, links,
|
|
9
|
+
* mentions, the host's shortcuts and `peers ui` inspection. When the frame says hello a second
|
|
10
|
+
* time, its document was replaced (it navigated), so the host drops the frame and makes a new one
|
|
11
|
+
* instead of booting whatever is in it now.
|
|
12
|
+
*/
|
|
13
|
+
/** A package's UI bundle, as the screen loader read it. */
|
|
14
|
+
export interface IIsolatedScreenBundle {
|
|
15
|
+
code: string;
|
|
16
|
+
packageVersionId: string;
|
|
17
|
+
uiBundleFileId: string;
|
|
18
|
+
/** The context the version's row was read from. */
|
|
19
|
+
dataContextId: string;
|
|
20
|
+
}
|
|
21
|
+
interface IIsolatedScreenProps {
|
|
22
|
+
pkg: IPackage;
|
|
23
|
+
bundle: IIsolatedScreenBundle;
|
|
24
|
+
peersUIId: string;
|
|
25
|
+
props: Record<string, unknown>;
|
|
26
|
+
/** The tab's path. */
|
|
27
|
+
path: string;
|
|
28
|
+
}
|
|
29
|
+
/** What a package's frame shows: one of its screens, or one of its pieces for an embedder. */
|
|
30
|
+
export type FrameContent = {
|
|
31
|
+
kind: "screen";
|
|
32
|
+
peersUIId: string;
|
|
33
|
+
props: Record<string, unknown>;
|
|
34
|
+
path: string;
|
|
35
|
+
} | {
|
|
36
|
+
kind: "piece";
|
|
37
|
+
/** The piece's key (`pieceKey`) under the version the provider implements. */
|
|
38
|
+
key: string;
|
|
39
|
+
props: Record<string, unknown>;
|
|
40
|
+
/** The group it's embedded for. */
|
|
41
|
+
groupId: string;
|
|
42
|
+
height: "fill" | "content";
|
|
43
|
+
/** In a popover: it takes its content's width, up to this many pixels. */
|
|
44
|
+
width?: number;
|
|
45
|
+
/** The emits the embedder's version declares. */
|
|
46
|
+
emits?: string[];
|
|
47
|
+
};
|
|
48
|
+
/** What a piece's frame tells its embedder. */
|
|
49
|
+
export interface IFramePieceEvents {
|
|
50
|
+
onEmit(name: string, payload: unknown): void;
|
|
51
|
+
onClose(): void;
|
|
52
|
+
/** Its content's height, for a piece that takes its own height, and its width in a popover. */
|
|
53
|
+
onSize(height: number, width?: number): void;
|
|
54
|
+
/** It failed to load or threw. */
|
|
55
|
+
onFailed(message: string): void;
|
|
56
|
+
/** Escape pressed in it that it left alone: for a popover around it. */
|
|
57
|
+
onKey?(key: {
|
|
58
|
+
key: string;
|
|
59
|
+
code?: string;
|
|
60
|
+
}): void;
|
|
61
|
+
/** A wheel over it that it didn't scroll with, in pixels: for the screen it's drawn over. */
|
|
62
|
+
onWheel?(deltaX: number, deltaY: number): void;
|
|
63
|
+
}
|
|
64
|
+
/** A slot in a framed screen where one of the pieces it embeds is drawn, over the frame. */
|
|
65
|
+
interface IPieceSlot {
|
|
66
|
+
slotId: string;
|
|
67
|
+
bundle: IPieceBundle;
|
|
68
|
+
content: Extract<FrameContent, {
|
|
69
|
+
kind: "piece";
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* The piece as the embedder's version declares it. Its props are checked against it, and a
|
|
73
|
+
* provider serving it through a newer version can send emits it doesn't declare; the host
|
|
74
|
+
* drops those before they reach the embedder's frame.
|
|
75
|
+
*/
|
|
76
|
+
piece: IContractPiece;
|
|
77
|
+
/** Where the slot is, in the frame's coordinates, and the part of it that shows. */
|
|
78
|
+
rect?: {
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
};
|
|
84
|
+
clip?: {
|
|
85
|
+
top: number;
|
|
86
|
+
right: number;
|
|
87
|
+
bottom: number;
|
|
88
|
+
left: number;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/** For a piece drawn over a framed screen's slot: that screen's session, and the slot. */
|
|
92
|
+
type SlotLink = () => {
|
|
93
|
+
session: FrameSession | undefined;
|
|
94
|
+
slotId: string;
|
|
95
|
+
} | undefined;
|
|
96
|
+
/** Everything one booted frame has open: torn down together. */
|
|
97
|
+
declare class FrameSession {
|
|
98
|
+
private readonly opts;
|
|
99
|
+
private readonly channel;
|
|
100
|
+
private contractSession?;
|
|
101
|
+
private readonly rpc;
|
|
102
|
+
private readonly pvars;
|
|
103
|
+
private readonly tabPath;
|
|
104
|
+
private readonly disposers;
|
|
105
|
+
private init?;
|
|
106
|
+
constructor(opts: {
|
|
107
|
+
port: MessagePort;
|
|
108
|
+
frameId: string;
|
|
109
|
+
element: HTMLIFrameElement;
|
|
110
|
+
pkg: IPackage;
|
|
111
|
+
bundle: IIsolatedScreenBundle;
|
|
112
|
+
tabId: () => string | undefined;
|
|
113
|
+
/** For a piece's frame: where its emits, close and size go. */
|
|
114
|
+
pieceEvents: () => IFramePieceEvents | undefined;
|
|
115
|
+
/** The pieces this frame embeds, drawn over it by its component. */
|
|
116
|
+
slots: Observable<IPieceSlot[]>;
|
|
117
|
+
/** For a piece drawn over a framed screen's slot: that screen, and the slot. */
|
|
118
|
+
slotOf?: SlotLink;
|
|
119
|
+
/** Make a new frame, as Retry on a screen that failed to load asks. */
|
|
120
|
+
restart: () => void;
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* A pointer went down in this frame. The window around it hears it on the frame's element, and
|
|
124
|
+
* every other frame is told: the screens this piece is drawn over, through the pieces between,
|
|
125
|
+
* as a click in their slot; the rest as one outside.
|
|
126
|
+
*/
|
|
127
|
+
private pointerDown;
|
|
128
|
+
/**
|
|
129
|
+
* Tell this frame a pointer went down outside it: in the piece drawn over `slotId` when it's
|
|
130
|
+
* given, elsewhere when it isn't.
|
|
131
|
+
*/
|
|
132
|
+
pointerOutside(slotId?: string): void;
|
|
133
|
+
private navigate;
|
|
134
|
+
/** Open the frame's contract session now rather than on its first call. */
|
|
135
|
+
openContractSession(): void;
|
|
136
|
+
private session;
|
|
137
|
+
private serve;
|
|
138
|
+
/**
|
|
139
|
+
* Resolve a piece this frame embeds. The frame's package must consume the UI contract; then
|
|
140
|
+
* the host's resolution answers, as it would for a screen in the window.
|
|
141
|
+
*/
|
|
142
|
+
private resolvePieceFor;
|
|
143
|
+
/**
|
|
144
|
+
* Draw a piece over one of this frame's slots: resolve it again (the frame only asks), read its
|
|
145
|
+
* provider's bundle, and add the slot; the frame's component draws a frame for the piece over it.
|
|
146
|
+
*/
|
|
147
|
+
private mountPiece;
|
|
148
|
+
private updateSlot;
|
|
149
|
+
/** Tell a piece slot's frame what happened in its piece. */
|
|
150
|
+
slotNotify(type: string, payload: Record<string, unknown>): void;
|
|
151
|
+
/** Show a screen or a piece: sends the init now if the frame is ready, or once it says so. */
|
|
152
|
+
show(getContent: () => FrameContent): Promise<void>;
|
|
153
|
+
private frameReady;
|
|
154
|
+
private sendInit;
|
|
155
|
+
/** The tab's path changed. */
|
|
156
|
+
setPath(path: string): void;
|
|
157
|
+
/** Whether the frame has been told what to show. */
|
|
158
|
+
get started(): boolean;
|
|
159
|
+
dispose(): void;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Show one package screen in a frame of its own.
|
|
163
|
+
*
|
|
164
|
+
* @param props.pkg - The screen's package.
|
|
165
|
+
* @param props.bundle - Its UI bundle, read and checked by the loader.
|
|
166
|
+
* @param props.peersUIId - The UI to show.
|
|
167
|
+
* @param props.props - The UI's props: data only.
|
|
168
|
+
* @param props.path - The tab's path.
|
|
169
|
+
*/
|
|
170
|
+
export declare function IsolatedScreen(props: IIsolatedScreenProps): import("react/jsx-runtime").JSX.Element;
|
|
171
|
+
/** What {@link PackageFrame} takes. */
|
|
172
|
+
export interface IPackageFrameProps {
|
|
173
|
+
/** The package whose code runs in the frame. */
|
|
174
|
+
pkg: IPackage;
|
|
175
|
+
/** Its UI bundle, read and checked. */
|
|
176
|
+
bundle: IIsolatedScreenBundle;
|
|
177
|
+
/** What the frame shows. */
|
|
178
|
+
content: FrameContent;
|
|
179
|
+
/** For a screen: its tab. */
|
|
180
|
+
tabId?: string;
|
|
181
|
+
/** For a piece: where its emits, close, size and failure go. */
|
|
182
|
+
pieceEvents?: IFramePieceEvents;
|
|
183
|
+
/** For a piece drawn over a framed screen's slot: that screen, and the slot. */
|
|
184
|
+
slotOf?: SlotLink;
|
|
185
|
+
/** The frame's name, for screen readers. */
|
|
186
|
+
label: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* A package's frame: one of its screens, or one of its pieces for an embedder, acting as the
|
|
190
|
+
* package. A frame whose document was replaced is dropped, and the next key makes a new element.
|
|
191
|
+
*/
|
|
192
|
+
export declare function PackageFrame(props: IPackageFrameProps): import("react/jsx-runtime").JSX.Element;
|
|
193
|
+
export {};
|