@hollis-labs/surface-page 0.0.0-stage → 0.1.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/README.md +24 -2
- package/dist/chunks/chunk-ZT6LTRMY.js +220 -0
- package/dist/gallery.js +1016 -0
- package/dist/index.js +2000 -0
- package/dist/registry-items.json +36 -0
- package/dist/sdk.js +24 -0
- package/dist/types/ade/Overlay.d.ts +4 -0
- package/dist/types/ade/hub.d.ts +5 -0
- package/dist/types/agent/AgentPanel.d.ts +24 -0
- package/dist/types/agent/api.d.ts +57 -0
- package/dist/types/agent/index.d.ts +2 -0
- package/dist/types/agent/items.d.ts +25 -0
- package/dist/types/boot.d.ts +12 -0
- package/dist/types/cards/renderers.d.ts +22 -0
- package/dist/types/cards/store.d.ts +41 -0
- package/dist/types/cards/views.d.ts +9 -0
- package/dist/types/desk/Confirm.d.ts +2 -0
- package/dist/types/desk/Desktop.d.ts +6 -0
- package/dist/types/desk/Palette.d.ts +9 -0
- package/dist/types/desk/commands.d.ts +9 -0
- package/dist/types/desk/coreViews.d.ts +2 -0
- package/dist/types/desk/keys.d.ts +12 -0
- package/dist/types/desk/moduleApi.d.ts +3 -0
- package/dist/types/desk/store.d.ts +107 -0
- package/dist/types/gallery/Gallery.d.ts +49 -0
- package/dist/types/gallery/Specimen.d.ts +12 -0
- package/dist/types/gallery/ade.d.ts +1 -0
- package/dist/types/gallery/cards.d.ts +1 -0
- package/dist/types/gallery/chat.d.ts +1 -0
- package/dist/types/gallery/controls.d.ts +1 -0
- package/dist/types/gallery/display.d.ts +1 -0
- package/dist/types/gallery/genui.d.ts +1 -0
- package/dist/types/gallery/index.d.ts +9 -0
- package/dist/types/gallery/overlays.d.ts +1 -0
- package/dist/types/gallery/windows.d.ts +1 -0
- package/dist/types/genui/card.d.ts +2 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/sdk/anchors.d.ts +8 -0
- package/dist/types/sdk/hooks.d.ts +11 -0
- package/dist/types/sdk/icon.d.ts +5 -0
- package/dist/types/sdk/index.d.ts +9 -0
- package/dist/types/sdk/marks.d.ts +10 -0
- package/dist/types/sdk/runtime.d.ts +40 -0
- package/dist/types/sdk/types.d.ts +99 -0
- package/package.json +70 -4
- package/vite.d.ts +3 -0
- package/vite.js +42 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[
|
|
2
|
+
"alert-dialog",
|
|
3
|
+
"app-frame",
|
|
4
|
+
"attention-layer",
|
|
5
|
+
"badge",
|
|
6
|
+
"button",
|
|
7
|
+
"card",
|
|
8
|
+
"card-approval",
|
|
9
|
+
"card-choice",
|
|
10
|
+
"card-confirm",
|
|
11
|
+
"card-form",
|
|
12
|
+
"card-miss",
|
|
13
|
+
"card-notice",
|
|
14
|
+
"card-plan",
|
|
15
|
+
"card-progress",
|
|
16
|
+
"card-prompt",
|
|
17
|
+
"command",
|
|
18
|
+
"conversation",
|
|
19
|
+
"dialog",
|
|
20
|
+
"dropdown-menu",
|
|
21
|
+
"empty",
|
|
22
|
+
"genui-surface",
|
|
23
|
+
"guide-bar",
|
|
24
|
+
"input",
|
|
25
|
+
"item",
|
|
26
|
+
"kbd",
|
|
27
|
+
"label",
|
|
28
|
+
"markdown",
|
|
29
|
+
"message",
|
|
30
|
+
"prompt-input",
|
|
31
|
+
"select",
|
|
32
|
+
"spinner",
|
|
33
|
+
"switch",
|
|
34
|
+
"tool",
|
|
35
|
+
"window-manager"
|
|
36
|
+
]
|
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ApiError,
|
|
3
|
+
Icon,
|
|
4
|
+
addMark,
|
|
5
|
+
replyMark,
|
|
6
|
+
resolveMark,
|
|
7
|
+
setSetting,
|
|
8
|
+
useAnchor,
|
|
9
|
+
useEvent,
|
|
10
|
+
useMarks,
|
|
11
|
+
useSetting
|
|
12
|
+
} from "./chunks/chunk-ZT6LTRMY.js";
|
|
13
|
+
export {
|
|
14
|
+
ApiError,
|
|
15
|
+
Icon,
|
|
16
|
+
addMark,
|
|
17
|
+
replyMark,
|
|
18
|
+
resolveMark,
|
|
19
|
+
setSetting,
|
|
20
|
+
useAnchor,
|
|
21
|
+
useEvent,
|
|
22
|
+
useMarks,
|
|
23
|
+
useSetting
|
|
24
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const hub: import("@hollis-labs/ade-core").Hub;
|
|
2
|
+
/** Put the desk in front of the hub and follow the server. Once per page. */
|
|
3
|
+
export declare function startAde(): void;
|
|
4
|
+
/** The owner dismissed what the agent pointed at. */
|
|
5
|
+
export declare const dismissAttention: () => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent panel: the context strip (the slot in play, the tools top of mind there, and the
|
|
3
|
+
* <context> block the next message will carry) above the conversation with the embedded
|
|
4
|
+
* agent.
|
|
5
|
+
*
|
|
6
|
+
* The conversation is @hollis-labs/surface-chat's store, drawn with the registry's chat components. Each
|
|
7
|
+
* part subscribes to its own slice, so typing redraws only the composer and a streamed token
|
|
8
|
+
* redraws only the message it belongs to. In development the list, each row and the composer
|
|
9
|
+
* count their own commits in window.__chatRenders, which is how that is checked.
|
|
10
|
+
*
|
|
11
|
+
* The context is the server's: it is assembled from the desk on every message and pushed
|
|
12
|
+
* here as an "agent.context" event whenever the window in front changes. The page sends no
|
|
13
|
+
* context and no tools of its own.
|
|
14
|
+
*/
|
|
15
|
+
import { type ChatStore } from "@hollis-labs/surface-chat";
|
|
16
|
+
import { type Desk } from "../sdk";
|
|
17
|
+
/** The one conversation of the page: a run goes on while the panel is closed. */
|
|
18
|
+
export declare function agentSession(): ChatStore;
|
|
19
|
+
export interface AgentPanelProps {
|
|
20
|
+
/** The desk, for opening what the agent names. Optional. */
|
|
21
|
+
desk?: Desk;
|
|
22
|
+
title?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function AgentPanel({ title }: AgentPanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent's own routes beside the agent-host/1 wire (core/internal/agent/http.go).
|
|
3
|
+
*/
|
|
4
|
+
/** One active slot (slots.SlotView). */
|
|
5
|
+
export interface SlotView {
|
|
6
|
+
name: string;
|
|
7
|
+
module?: string;
|
|
8
|
+
about: string;
|
|
9
|
+
instructions?: string;
|
|
10
|
+
where?: string;
|
|
11
|
+
note?: string;
|
|
12
|
+
note_updated?: string;
|
|
13
|
+
knowledge?: string;
|
|
14
|
+
}
|
|
15
|
+
/** What the next message carries (slots.Assembly). */
|
|
16
|
+
export interface Assembly {
|
|
17
|
+
slot: string;
|
|
18
|
+
slots: SlotView[];
|
|
19
|
+
why: string;
|
|
20
|
+
top_of_mind: string[] | null;
|
|
21
|
+
focused?: {
|
|
22
|
+
window: string;
|
|
23
|
+
view: string;
|
|
24
|
+
module: string;
|
|
25
|
+
title: string;
|
|
26
|
+
kind?: string;
|
|
27
|
+
ref?: string;
|
|
28
|
+
};
|
|
29
|
+
mode?: string;
|
|
30
|
+
layout?: string;
|
|
31
|
+
reminders?: string[];
|
|
32
|
+
block: string;
|
|
33
|
+
}
|
|
34
|
+
/** One slot in the app (agent.SlotInfo). */
|
|
35
|
+
export interface SlotInfo {
|
|
36
|
+
name: string;
|
|
37
|
+
module?: string;
|
|
38
|
+
about: string;
|
|
39
|
+
views?: string[];
|
|
40
|
+
tools?: string[];
|
|
41
|
+
note?: string;
|
|
42
|
+
active: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface Setup {
|
|
45
|
+
ready: boolean;
|
|
46
|
+
model: string;
|
|
47
|
+
config_path: string;
|
|
48
|
+
/** Why the agent cannot answer, in a sentence, when it cannot. */
|
|
49
|
+
reason?: string;
|
|
50
|
+
}
|
|
51
|
+
export declare const agentApi: {
|
|
52
|
+
context: () => Promise<Assembly>;
|
|
53
|
+
setup: () => Promise<Setup>;
|
|
54
|
+
slots: () => Promise<SlotInfo[]>;
|
|
55
|
+
/** Pin a slot; "" lets the window in front choose again. */
|
|
56
|
+
pin: (slot: string) => Promise<Assembly>;
|
|
57
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How each item of the conversation is drawn. The table is the seam for cards: a tool with a
|
|
3
|
+
* card of its own (an approval, a plan, progress) is drawn by the component `toolCards` names
|
|
4
|
+
* for it, and every other tool by the plain row.
|
|
5
|
+
*/
|
|
6
|
+
import type { ChatItem } from "@hollis-labs/surface-chat";
|
|
7
|
+
import type { ComponentType } from "react";
|
|
8
|
+
type Of<K extends ChatItem["kind"]> = Extract<ChatItem, {
|
|
9
|
+
kind: K;
|
|
10
|
+
}>;
|
|
11
|
+
export type ToolItem = Of<"tool">;
|
|
12
|
+
/** Tool name → the card that draws its calls. */
|
|
13
|
+
export declare const toolCards: Record<string, ComponentType<{
|
|
14
|
+
item: ToolItem;
|
|
15
|
+
}>>;
|
|
16
|
+
/** One kind → how it is drawn. */
|
|
17
|
+
export declare const renderers: {
|
|
18
|
+
[K in ChatItem["kind"]]: ComponentType<{
|
|
19
|
+
item: Of<K>;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
export declare function ItemView({ item }: {
|
|
23
|
+
item: ChatItem;
|
|
24
|
+
}): import("react").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Root } from "react-dom/client";
|
|
2
|
+
import type { ModuleWeb } from "./sdk/types";
|
|
3
|
+
export interface PageProps {
|
|
4
|
+
/** The views compiled into this app's page, by module id. */
|
|
5
|
+
modules: Record<string, ModuleWeb>;
|
|
6
|
+
/** Views of the core's own (`surface/*`) to add, such as the Components window from ./gallery. */
|
|
7
|
+
core?: ModuleWeb["views"];
|
|
8
|
+
}
|
|
9
|
+
/** The whole page: a loading state until the server answers, then the desktop and the cards. */
|
|
10
|
+
export declare function Page({ modules, core }: PageProps): import("react").JSX.Element;
|
|
11
|
+
/** Draw the page into an element (by default `#root`). */
|
|
12
|
+
export declare function mountPage(props: PageProps, element?: Element | null): Root;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which component draws each kind of card. The table is the app's: a module with a card
|
|
3
|
+
* kind of its own registers its renderer here (`registerCard`), and a card nothing is
|
|
4
|
+
* registered for is drawn as a plain "no renderer" card, never as nothing.
|
|
5
|
+
*/
|
|
6
|
+
import { type CardOutcome } from "@hollis-labs/surface-cards";
|
|
7
|
+
import { type ComponentType } from "react";
|
|
8
|
+
import { type ServerCard } from "./store";
|
|
9
|
+
/** What a renderer is handed: the card, and how to answer it. */
|
|
10
|
+
export interface CardRendererProps {
|
|
11
|
+
card: ServerCard;
|
|
12
|
+
respond: (outcome: CardOutcome) => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export type CardRenderer = ComponentType<CardRendererProps>;
|
|
15
|
+
/** Registers the component that draws a kind of card at a version. */
|
|
16
|
+
export declare const registerCard: (kind: string, version: string, component: CardRenderer) => void;
|
|
17
|
+
/** A closed card's answer in a few words, for its receipt. */
|
|
18
|
+
export declare function describeOutcome(card: ServerCard): string | undefined;
|
|
19
|
+
/** Draws one card with the renderer registered for its kind. */
|
|
20
|
+
export declare function CardView({ card }: {
|
|
21
|
+
card: ServerCard;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cards as the page knows them. The server holds each card and its state and streams
|
|
3
|
+
* changes; the page keeps the latest of each, and the engine from @hollis-labs/surface-cards decides
|
|
4
|
+
* where each one shows, from rules that are data.
|
|
5
|
+
*/
|
|
6
|
+
import { type CardOutcome, type CardViewModel, type Surface } from "@hollis-labs/surface-cards";
|
|
7
|
+
/** A card as the server sends it. */
|
|
8
|
+
export interface ServerCard {
|
|
9
|
+
id: string;
|
|
10
|
+
kind: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
source?: string;
|
|
14
|
+
subject?: string;
|
|
15
|
+
risk?: string;
|
|
16
|
+
blocking?: boolean;
|
|
17
|
+
payload?: Record<string, unknown>;
|
|
18
|
+
status?: string;
|
|
19
|
+
outcome?: CardOutcome;
|
|
20
|
+
revision?: number;
|
|
21
|
+
superseded_by?: string;
|
|
22
|
+
created?: string;
|
|
23
|
+
responded?: string;
|
|
24
|
+
expires_at?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const ANSWERABLE: string[];
|
|
27
|
+
/** Reads the open cards once and follows changes from then on. */
|
|
28
|
+
export declare function startCards(): void;
|
|
29
|
+
/** Sends the person's answer. A card that closed meanwhile comes back as it stands. */
|
|
30
|
+
export declare function respond(id: string, outcome: CardOutcome): Promise<void>;
|
|
31
|
+
export declare const dismissToast: (id: string) => void;
|
|
32
|
+
export declare const isStale: (id: string) => boolean;
|
|
33
|
+
export declare const cardById: (id: string) => ServerCard | undefined;
|
|
34
|
+
export interface Shown {
|
|
35
|
+
card: ServerCard;
|
|
36
|
+
view: CardViewModel;
|
|
37
|
+
}
|
|
38
|
+
/** The cards on one surface, in the order they arrived. */
|
|
39
|
+
export declare function useCards(surface: Surface): Shown[];
|
|
40
|
+
/** One card by id, following its changes. */
|
|
41
|
+
export declare function useCard(id: string): ServerCard | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ViewProps } from "../sdk";
|
|
2
|
+
/** The agent's open cards, above its composer. A closed one leaves the dock: the
|
|
3
|
+
* conversation carries what was answered. */
|
|
4
|
+
export declare function CardDock(): import("react").JSX.Element | null;
|
|
5
|
+
/** Cards from anything but the agent: pop-ups in the corner, and the one its sender is
|
|
6
|
+
* waiting on in the middle. Mounted once, over the whole page. */
|
|
7
|
+
export declare function CardHost(): import("react").JSX.Element;
|
|
8
|
+
/** The Cards window: every open card, and the recent ones that are closed. */
|
|
9
|
+
export declare function CardsWindow(_: ViewProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ModuleWeb } from "../sdk";
|
|
2
|
+
export interface DesktopProps {
|
|
3
|
+
/** The views compiled into this app's page, by module id. */
|
|
4
|
+
modules: Record<string, ModuleWeb>;
|
|
5
|
+
}
|
|
6
|
+
export declare function Desktop({ modules }: DesktopProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CommandDef } from "./store";
|
|
2
|
+
interface PaletteProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
commands: CommandDef[];
|
|
6
|
+
}
|
|
7
|
+
/** The command palette: every command, every view and every saved layout, by what you type. */
|
|
8
|
+
export declare function Palette({ open, onOpenChange, commands }: PaletteProps): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CommandDef } from "./store";
|
|
2
|
+
export interface UI {
|
|
3
|
+
togglePalette(open?: boolean): void;
|
|
4
|
+
toggleAgent(open?: boolean): void;
|
|
5
|
+
toggleMenu(): void;
|
|
6
|
+
}
|
|
7
|
+
export declare const clientCommands: CommandDef[];
|
|
8
|
+
/** Runs a page command. Returns undefined when the id is not one of the page's. */
|
|
9
|
+
export declare function runClient(id: string, ui: UI, args?: Record<string, unknown>): Promise<unknown> | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Shortcuts written like "ctrl+alt+t" or "cmd+k", matched against keyboard events. */
|
|
2
|
+
export interface Chord {
|
|
3
|
+
key: string;
|
|
4
|
+
ctrl: boolean;
|
|
5
|
+
alt: boolean;
|
|
6
|
+
shift: boolean;
|
|
7
|
+
meta: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseKeys(keys: string): Chord | null;
|
|
10
|
+
export declare function matches(c: Chord, e: KeyboardEvent): boolean;
|
|
11
|
+
/** A shortcut as a person reads it: "⌃⌥T". */
|
|
12
|
+
export declare function showKeys(keys?: string): string;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { WindowTree } from "@/components/ui/window-manager";
|
|
2
|
+
import type { Desk, Win } from "../sdk";
|
|
3
|
+
export interface DeskWin {
|
|
4
|
+
id: string;
|
|
5
|
+
view: string;
|
|
6
|
+
module: string;
|
|
7
|
+
title: string;
|
|
8
|
+
key?: string;
|
|
9
|
+
args: Record<string, unknown>;
|
|
10
|
+
state?: Record<string, unknown>;
|
|
11
|
+
dirty?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface DeskState {
|
|
14
|
+
wins: DeskWin[];
|
|
15
|
+
focus: string;
|
|
16
|
+
/** How the windows are arranged: the server's, drawn by the window manager. */
|
|
17
|
+
tree: WindowTree;
|
|
18
|
+
layout: "tile" | "float";
|
|
19
|
+
ratio: number;
|
|
20
|
+
active?: string;
|
|
21
|
+
mode?: string;
|
|
22
|
+
rev: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ViewDef {
|
|
25
|
+
id: string;
|
|
26
|
+
title: string;
|
|
27
|
+
icon?: string;
|
|
28
|
+
width?: number;
|
|
29
|
+
height?: number;
|
|
30
|
+
menu?: boolean;
|
|
31
|
+
multi?: boolean;
|
|
32
|
+
bare?: boolean;
|
|
33
|
+
render: {
|
|
34
|
+
kind: "component" | "frame";
|
|
35
|
+
entry: string;
|
|
36
|
+
};
|
|
37
|
+
opens?: string[];
|
|
38
|
+
module: string;
|
|
39
|
+
}
|
|
40
|
+
export interface CommandDef {
|
|
41
|
+
id: string;
|
|
42
|
+
title: string;
|
|
43
|
+
section?: string;
|
|
44
|
+
keywords?: string;
|
|
45
|
+
keys?: string;
|
|
46
|
+
hidden?: boolean;
|
|
47
|
+
module: string;
|
|
48
|
+
/** True when the server runs it; false for a command of the page's own. */
|
|
49
|
+
server: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface AppManifest {
|
|
52
|
+
name: string;
|
|
53
|
+
title: string;
|
|
54
|
+
modules: {
|
|
55
|
+
id: string;
|
|
56
|
+
title: string;
|
|
57
|
+
about?: string;
|
|
58
|
+
version?: string;
|
|
59
|
+
}[];
|
|
60
|
+
views: ViewDef[];
|
|
61
|
+
commands: CommandDef[];
|
|
62
|
+
}
|
|
63
|
+
export interface LayoutDef {
|
|
64
|
+
name: string;
|
|
65
|
+
about?: string;
|
|
66
|
+
mode: string;
|
|
67
|
+
ratio?: number;
|
|
68
|
+
windows: {
|
|
69
|
+
view: string;
|
|
70
|
+
key?: string;
|
|
71
|
+
title?: string;
|
|
72
|
+
floating?: boolean;
|
|
73
|
+
focus?: boolean;
|
|
74
|
+
}[];
|
|
75
|
+
setup?: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
export declare function loadManifest(): Promise<AppManifest>;
|
|
78
|
+
export declare const app: () => AppManifest;
|
|
79
|
+
export declare const viewById: (id: string) => ViewDef | undefined;
|
|
80
|
+
/** The view that opens a file of this name: the first whose Opens patterns match it. */
|
|
81
|
+
export declare function viewForFile(name: string): ViewDef | undefined;
|
|
82
|
+
export declare const deskState: () => DeskState;
|
|
83
|
+
export declare function useDeskState(): DeskState;
|
|
84
|
+
/** Post one action to the server's window manager. */
|
|
85
|
+
export declare function act(action: Record<string, unknown>): Promise<DeskWin | undefined>;
|
|
86
|
+
export declare const toWin: (w: DeskWin, focus: string) => Win;
|
|
87
|
+
type Confirm = (q: {
|
|
88
|
+
title: string;
|
|
89
|
+
message?: string;
|
|
90
|
+
confirmLabel?: string;
|
|
91
|
+
danger?: boolean;
|
|
92
|
+
}) => Promise<boolean>;
|
|
93
|
+
/** The desktop installs its dialog here. */
|
|
94
|
+
export declare const setConfirm: (fn: Confirm) => void;
|
|
95
|
+
/** Runs a command: the server's by id, or one of the page's own. */
|
|
96
|
+
type ClientRunner = (id: string, args?: Record<string, unknown>) => Promise<unknown> | undefined;
|
|
97
|
+
export declare const setClientRunner: (fn: ClientRunner) => void;
|
|
98
|
+
export declare function runCommand<T = unknown>(id: string, args?: Record<string, unknown>): Promise<T>;
|
|
99
|
+
/** Close a window, asking first when it holds unsaved work. */
|
|
100
|
+
export declare function closeWindow(id: string): Promise<void>;
|
|
101
|
+
/** The Desk a view is handed. */
|
|
102
|
+
export declare const desk: Desk;
|
|
103
|
+
export declare const listLayouts: () => Promise<LayoutDef[]>;
|
|
104
|
+
export declare const saveLayout: (name: string, about?: string) => Promise<LayoutDef>;
|
|
105
|
+
export declare const loadLayout: (name: string) => Promise<unknown>;
|
|
106
|
+
export declare const deleteLayout: (name: string) => Promise<unknown>;
|
|
107
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The component gallery: every component installed from the @surface registry, in its
|
|
3
|
+
* variants and states, drawn from fixtures. Design work happens against it, and
|
|
4
|
+
* `make ui-shots` photographs each section in dark and light. Nothing here calls the server.
|
|
5
|
+
*/
|
|
6
|
+
import type { ViewProps } from "@hollis-labs/surface-page/sdk";
|
|
7
|
+
import { Ade } from "./ade";
|
|
8
|
+
import { Cards } from "./cards";
|
|
9
|
+
import { Chat } from "./chat";
|
|
10
|
+
import { Controls } from "./controls";
|
|
11
|
+
import { Display } from "./display";
|
|
12
|
+
import { Genui } from "./genui";
|
|
13
|
+
import { Overlays } from "./overlays";
|
|
14
|
+
import { Windows } from "./windows";
|
|
15
|
+
/** The sections, in order. Their ids name the screenshots. */
|
|
16
|
+
export declare const SECTIONS: readonly [{
|
|
17
|
+
readonly id: "controls";
|
|
18
|
+
readonly title: "Controls";
|
|
19
|
+
readonly draw: typeof Controls;
|
|
20
|
+
}, {
|
|
21
|
+
readonly id: "display";
|
|
22
|
+
readonly title: "Display";
|
|
23
|
+
readonly draw: typeof Display;
|
|
24
|
+
}, {
|
|
25
|
+
readonly id: "overlays";
|
|
26
|
+
readonly title: "Overlays";
|
|
27
|
+
readonly draw: typeof Overlays;
|
|
28
|
+
}, {
|
|
29
|
+
readonly id: "chat";
|
|
30
|
+
readonly title: "Chat";
|
|
31
|
+
readonly draw: typeof Chat;
|
|
32
|
+
}, {
|
|
33
|
+
readonly id: "cards";
|
|
34
|
+
readonly title: "Cards";
|
|
35
|
+
readonly draw: typeof Cards;
|
|
36
|
+
}, {
|
|
37
|
+
readonly id: "genui";
|
|
38
|
+
readonly title: "GenUI";
|
|
39
|
+
readonly draw: typeof Genui;
|
|
40
|
+
}, {
|
|
41
|
+
readonly id: "ade";
|
|
42
|
+
readonly title: "ADE";
|
|
43
|
+
readonly draw: typeof Ade;
|
|
44
|
+
}, {
|
|
45
|
+
readonly id: "windows";
|
|
46
|
+
readonly title: "Windows";
|
|
47
|
+
readonly draw: typeof Windows;
|
|
48
|
+
}];
|
|
49
|
+
export declare function Gallery({ win }: ViewProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The gallery's two layout pieces: a section with a title, and one labelled specimen. */
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export declare function Section({ title, about, children }: {
|
|
4
|
+
title: string;
|
|
5
|
+
about?: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
export declare function Specimen({ label, wide, children }: {
|
|
9
|
+
label: string;
|
|
10
|
+
wide?: boolean;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Ade(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Cards(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Chat(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Controls(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Display(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Genui(): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Components window (`surface/gallery`): every registry component in its variants and states,
|
|
3
|
+
* from fixtures. Optional for an app: it needs every registry item installed.
|
|
4
|
+
*/
|
|
5
|
+
import { Gallery } from "./Gallery";
|
|
6
|
+
export { Gallery };
|
|
7
|
+
export declare const galleryViews: {
|
|
8
|
+
"surface/gallery": typeof Gallery;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Overlays(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Windows(): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hollis-labs/surface-page: the core of a Surface app's page. An app's entry is
|
|
3
|
+
*
|
|
4
|
+
* import { mountPage } from "@hollis-labs/surface-page"
|
|
5
|
+
* mountPage({ modules })
|
|
6
|
+
*
|
|
7
|
+
* with `modules` its modules' views. A module's own web code imports only
|
|
8
|
+
* "@hollis-labs/surface-page/sdk". The drawing is the app's installed registry components
|
|
9
|
+
* (`@/components/ui/*`); see registry/README.md, "Using it in an app".
|
|
10
|
+
*/
|
|
11
|
+
export { mountPage, Page, type PageProps } from "./boot";
|
|
12
|
+
export { type CardRenderer, type CardRendererProps, registerCard } from "./cards/renderers";
|
|
13
|
+
export { CardHost, CardsWindow } from "./cards/views";
|
|
14
|
+
export { coreWeb } from "./desk/coreViews";
|
|
15
|
+
export { Desktop, type DesktopProps } from "./desk/Desktop";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Win } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Name an element of this window so the agent can point at it. Returns a ref for the
|
|
4
|
+
* element; the anchor goes when the element does.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useAnchor(win: Pick<Win, "id"> | string, name: string, label?: string): (el: HTMLElement | null) => (() => void) | undefined;
|
|
7
|
+
/** The element a window's anchor names, if it is on the page. The page's own, for drawing. */
|
|
8
|
+
export declare const anchorElement: (win: string, name: string) => HTMLElement | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Mark, SurfaceEvent } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Listen to the app's event bus. fn is called for each event whose topic is prefix or lies
|
|
4
|
+
* under it ("notes" takes "notes.saved"). This is how a view learns that the agent, a
|
|
5
|
+
* command or another window changed its data.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useEvent<T = unknown>(prefix: string, fn: (ev: SurfaceEvent<T>) => void): void;
|
|
8
|
+
/** A live setting by its full key ("scratch.show_done"). It follows changes, with no reload. */
|
|
9
|
+
export declare function useSetting<T = unknown>(fullKey: string): T | undefined;
|
|
10
|
+
/** The marks on a ref, kept current. */
|
|
11
|
+
export declare function useMarks(ref: string | undefined): Mark[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hollis-labs/surface-page/sdk: everything a module's web code may import from Surface.
|
|
3
|
+
*/
|
|
4
|
+
export { useAnchor } from "./anchors";
|
|
5
|
+
export { useEvent, useMarks, useSetting } from "./hooks";
|
|
6
|
+
export { Icon } from "./icon";
|
|
7
|
+
export { addMark, replyMark, resolveMark } from "./marks";
|
|
8
|
+
export { ApiError, setSetting } from "./runtime";
|
|
9
|
+
export * from "./types";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Mark } from "./types";
|
|
2
|
+
/** Pin a note of the owner's to a part of something. ref is what WindowContext.ref names. */
|
|
3
|
+
export declare const addMark: (m: {
|
|
4
|
+
ref: string;
|
|
5
|
+
body: string;
|
|
6
|
+
quote?: string;
|
|
7
|
+
anchor?: unknown;
|
|
8
|
+
}) => Promise<Mark>;
|
|
9
|
+
export declare const replyMark: (id: string, body: string) => Promise<Mark>;
|
|
10
|
+
export declare const resolveMark: (id: string) => Promise<void>;
|