@deltarobotics/uhd-viewer 0.0.0-stage → 0.2.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/CHANGELOG.md +41 -0
- package/LICENSE +202 -0
- package/NOTICE +22 -0
- package/README.md +168 -2
- package/bin/serve.d.mts +62 -0
- package/bin/serve.mjs +257 -0
- package/bin/uhd-viewer.mjs +75 -0
- package/dist/app/assets/KodeMono-Bold-DdIivhPN.woff2 +0 -0
- package/dist/app/assets/KodeMono-Medium-CVnTuv5A.ttf +0 -0
- package/dist/app/assets/KodeMono-Regular-Bdr_-rJX.woff2 +0 -0
- package/dist/app/assets/KodeMono-SemiBold-JAfn5Dpm.ttf +0 -0
- package/dist/app/assets/index-Boi2erhd.css +2 -0
- package/dist/app/assets/index-CkpIRYgM.js +3853 -0
- package/dist/app/index.html +16 -0
- package/dist/components/components.css +6108 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +26048 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/types/uhd-viewer/src/api.d.ts +286 -0
- package/dist/components/types/uhd-viewer/src/cad/CadView.d.ts +52 -0
- package/dist/components/types/uhd-viewer/src/cad/ModelView.d.ts +28 -0
- package/dist/components/types/uhd-viewer/src/cad/explode.d.ts +110 -0
- package/dist/components/types/uhd-viewer/src/cad/explodeSample.d.ts +25 -0
- package/dist/components/types/uhd-viewer/src/cad/findings.d.ts +41 -0
- package/dist/components/types/uhd-viewer/src/cad/labels.d.ts +76 -0
- package/dist/components/types/uhd-viewer/src/cad/model.d.ts +132 -0
- package/dist/components/types/uhd-viewer/src/cad/row.d.ts +15 -0
- package/dist/components/types/uhd-viewer/src/cad/scene.d.ts +95 -0
- package/dist/components/types/uhd-viewer/src/cad/scope.d.ts +89 -0
- package/dist/components/types/uhd-viewer/src/canvas/Canvas.d.ts +86 -0
- package/dist/components/types/uhd-viewer/src/canvas/Icon.d.ts +5 -0
- package/dist/components/types/uhd-viewer/src/canvas/LinkEdge.d.ts +40 -0
- package/dist/components/types/uhd-viewer/src/canvas/Port.d.ts +18 -0
- package/dist/components/types/uhd-viewer/src/canvas/actions.d.ts +5 -0
- package/dist/components/types/uhd-viewer/src/canvas/geometry.d.ts +72 -0
- package/dist/components/types/uhd-viewer/src/canvas/interaction.d.ts +162 -0
- package/dist/components/types/uhd-viewer/src/canvas/nodes.d.ts +43 -0
- package/dist/components/types/uhd-viewer/src/canvas/reveal.d.ts +37 -0
- package/dist/components/types/uhd-viewer/src/canvas/rightDrag.d.ts +51 -0
- package/dist/components/types/uhd-viewer/src/canvas/routing.d.ts +28 -0
- package/dist/components/types/uhd-viewer/src/chrome/ArtifactCards.d.ts +30 -0
- package/dist/components/types/uhd-viewer/src/chrome/Artifacts.d.ts +44 -0
- package/dist/components/types/uhd-viewer/src/chrome/BoardInspector.d.ts +53 -0
- package/dist/components/types/uhd-viewer/src/chrome/Chrome.d.ts +116 -0
- package/dist/components/types/uhd-viewer/src/chrome/Evidence.d.ts +20 -0
- package/dist/components/types/uhd-viewer/src/chrome/InterfaceCards.d.ts +56 -0
- package/dist/components/types/uhd-viewer/src/chrome/PairView.d.ts +37 -0
- package/dist/components/types/uhd-viewer/src/chrome/Sections.d.ts +107 -0
- package/dist/components/types/uhd-viewer/src/components.d.ts +60 -0
- package/dist/components/types/uhd-viewer/src/host/channel.d.ts +49 -0
- package/dist/components/types/uhd-viewer/src/host/context.d.ts +29 -0
- package/dist/components/types/uhd-viewer/src/host/protocol.d.ts +22 -0
- package/dist/components/types/uhd-viewer/src/host/targets.d.ts +85 -0
- package/dist/components/types/uhd-viewer/src/layout/board-layout.d.ts +69 -0
- package/dist/components/types/uhd-viewer/src/layout/card-body.d.ts +64 -0
- package/dist/components/types/uhd-viewer/src/layout/layout.d.ts +94 -0
- package/dist/components/types/uhd-viewer/src/layout/module-layout.d.ts +32 -0
- package/dist/components/types/uhd-viewer/src/layout/router.d.ts +55 -0
- package/dist/components/types/uhd-viewer/src/layout/taps.d.ts +20 -0
- package/dist/components/types/uhd-viewer/src/model/artifacts.d.ts +129 -0
- package/dist/components/types/uhd-viewer/src/model/classification.d.ts +38 -0
- package/dist/components/types/uhd-viewer/src/model/diagnostics.d.ts +27 -0
- package/dist/components/types/uhd-viewer/src/model/evidence.d.ts +63 -0
- package/dist/components/types/uhd-viewer/src/model/from-uhd.d.ts +57 -0
- package/dist/components/types/uhd-viewer/src/model/hierarchy.d.ts +169 -0
- package/dist/components/types/uhd-viewer/src/model/isolate.d.ts +33 -0
- package/dist/components/types/uhd-viewer/src/model/nets.d.ts +53 -0
- package/dist/components/types/uhd-viewer/src/model/outputs.d.ts +79 -0
- package/dist/components/types/uhd-viewer/src/model/slots.d.ts +182 -0
- package/dist/components/types/uhd-viewer/src/model/types.d.ts +213 -0
- package/dist/components/types/uhd-viewer/src/options.d.ts +27 -0
- package/dist/components/types/uhd-viewer/src/source/source.d.ts +109 -0
- package/dist/components/types/uhd-viewer/src/source/tolerant.d.ts +45 -0
- package/dist/components/types/uhd-viewer/src/theme/ThemeProvider.d.ts +33 -0
- package/dist/components/types/uhd-viewer/src/theme/adapters.d.ts +28 -0
- package/dist/components/types/uhd-viewer/src/theme/resolve.d.ts +19 -0
- package/dist/components/types/uhd-viewer/src/theme/themes.d.ts +67 -0
- package/dist/components/types/uhd-viewer/src/theme/tokens.d.ts +175 -0
- package/dist/components/types/uhd-viewer/src/ui/Inspector.d.ts +45 -0
- package/dist/components/types/uhd-viewer/src/ui/Legend.d.ts +40 -0
- package/dist/components/types/uhd-viewer/src/ui/ScrollArea.d.ts +16 -0
- package/dist/components/types/uhd-viewer/src/ui/Toolbar.d.ts +49 -0
- package/dist/components/types/uhd-viewer/src/ui/Tooltips.d.ts +3 -0
- package/dist/components/types/uhd-viewer/src/ui/cx.d.ts +2 -0
- package/dist/components/types/uhd-viewer/src/ui/legendFit.d.ts +42 -0
- package/dist/components/types/uhd-viewer/src/viewer/controller.d.ts +218 -0
- package/dist/components/types/uhd-viewer/src/viewer/details.d.ts +81 -0
- package/dist/components/types/uhd-viewer/src/viewer/hierarchy.d.ts +60 -0
- package/dist/components/types/uhd-viewer/src/viewer/mount.d.ts +12 -0
- package/dist/components/types/uhd-viewer/src/viewer/views.d.ts +156 -0
- package/dist/headless/index.d.ts +71 -0
- package/dist/headless/index.js +7425 -0
- package/dist/headless/index.js.map +1 -0
- package/dist/lib/api.d.ts +252 -0
- package/dist/lib/uhd-viewer.css +3 -0
- package/dist/lib/uhd-viewer.d.ts +4 -0
- package/dist/lib/uhd-viewer.js +97469 -0
- package/package.json +110 -4
- package/src/styles/fonts/OFL.txt +93 -0
- package/src/styles/tailwind-theme.css +48 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the pointer and the keyboard act on the diagram: which tool is chosen
|
|
3
|
+
* (select or pan), what a drag on the empty canvas does with it, and the
|
|
4
|
+
* canvas's keys. No React and no DOM here, so the rules are tested as data.
|
|
5
|
+
*
|
|
6
|
+
* - Select (the default): a left-drag on the empty canvas draws a selection
|
|
7
|
+
* box; a middle-button drag pans; holding Space makes a left-drag pan,
|
|
8
|
+
* also one that starts on a module (modules are not dragged while it is held).
|
|
9
|
+
* - Pan: a left-drag pans, also over modules (they are not dragged).
|
|
10
|
+
* - With either tool, a right-drag pans, over the empty canvas, modules and
|
|
11
|
+
* links; a right-click that does not move (`rightPress`) opens the menu.
|
|
12
|
+
* - The wheel and a pinch zoom with either tool.
|
|
13
|
+
*/
|
|
14
|
+
export type CanvasTool = "select" | "pan";
|
|
15
|
+
export interface InteractionState {
|
|
16
|
+
tool: CanvasTool;
|
|
17
|
+
/** Space is held: a left-drag pans while it is. */
|
|
18
|
+
space: boolean;
|
|
19
|
+
}
|
|
20
|
+
export type InteractionAction = {
|
|
21
|
+
type: "tool";
|
|
22
|
+
tool: CanvasTool;
|
|
23
|
+
} | {
|
|
24
|
+
type: "toggle";
|
|
25
|
+
} | {
|
|
26
|
+
type: "space";
|
|
27
|
+
down: boolean;
|
|
28
|
+
} | {
|
|
29
|
+
type: "blur";
|
|
30
|
+
};
|
|
31
|
+
export declare const initialInteraction: InteractionState;
|
|
32
|
+
export declare function interactionReducer(state: InteractionState, action: InteractionAction): InteractionState;
|
|
33
|
+
export interface InteractionProps {
|
|
34
|
+
/** `true`: every button pans; a list: only these buttons do. */
|
|
35
|
+
panOnDrag: true | number[];
|
|
36
|
+
/** A left-drag on the empty canvas draws a selection box. */
|
|
37
|
+
selectionOnDrag: boolean;
|
|
38
|
+
nodesDraggable: boolean;
|
|
39
|
+
/** What the pointer looks like over the empty canvas. */
|
|
40
|
+
cursor: "default" | "grab";
|
|
41
|
+
}
|
|
42
|
+
/** What React Flow is told for a state: the tool, and Space held over it. */
|
|
43
|
+
export declare function interactionProps(state: InteractionState): InteractionProps;
|
|
44
|
+
/** The right button: a drag with it pans, a click opens the menu. */
|
|
45
|
+
export declare const RIGHT = 2;
|
|
46
|
+
/** How far (px) the pointer may move with the right button down and still be a click. */
|
|
47
|
+
export declare const CLICK_SLOP = 4;
|
|
48
|
+
/** The right button held on the canvas: where it went down, and whether it has become a pan. */
|
|
49
|
+
export interface RightPress {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
panning: boolean;
|
|
53
|
+
}
|
|
54
|
+
export declare const rightPress: (x: number, y: number) => RightPress;
|
|
55
|
+
/**
|
|
56
|
+
* The press after the pointer moved to (x, y): a pan once it has gone further
|
|
57
|
+
* than the slop from where it went down, and a pan from then on, also if it
|
|
58
|
+
* comes back (a drag that returns to its start is still not a click).
|
|
59
|
+
*/
|
|
60
|
+
export declare function rightMove(press: RightPress, x: number, y: number, slop?: number): RightPress;
|
|
61
|
+
/** What letting go of the right button does: open the menu (a click) or nothing more (a pan, which already moved the view). */
|
|
62
|
+
export declare const rightRelease: (press: RightPress) => "menu" | "pan";
|
|
63
|
+
/** The tool toggle's two choices (Lucide icons), each with its key. */
|
|
64
|
+
export declare const TOOL_OPTIONS: readonly [{
|
|
65
|
+
readonly id: "select";
|
|
66
|
+
readonly icon: "mouse-pointer-2";
|
|
67
|
+
readonly label: "Select: drag on the canvas to select several";
|
|
68
|
+
readonly shortcut: "V";
|
|
69
|
+
}, {
|
|
70
|
+
readonly id: "pan";
|
|
71
|
+
readonly icon: "hand";
|
|
72
|
+
readonly label: "Pan: drag to move the view";
|
|
73
|
+
readonly shortcut: "H";
|
|
74
|
+
}];
|
|
75
|
+
/** What a key press asks of the canvas. */
|
|
76
|
+
export type CanvasCommand = {
|
|
77
|
+
type: "tool";
|
|
78
|
+
tool: CanvasTool;
|
|
79
|
+
} | {
|
|
80
|
+
type: "selectAll";
|
|
81
|
+
} | {
|
|
82
|
+
type: "escape";
|
|
83
|
+
} | {
|
|
84
|
+
type: "fit";
|
|
85
|
+
} | {
|
|
86
|
+
type: "zoom";
|
|
87
|
+
by: "in" | "out" | "reset";
|
|
88
|
+
} | {
|
|
89
|
+
type: "nudge";
|
|
90
|
+
dx: number;
|
|
91
|
+
dy: number;
|
|
92
|
+
};
|
|
93
|
+
export interface KeyLike {
|
|
94
|
+
key: string;
|
|
95
|
+
ctrlKey?: boolean;
|
|
96
|
+
metaKey?: boolean;
|
|
97
|
+
shiftKey?: boolean;
|
|
98
|
+
altKey?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The canvas command of a key press, or undefined for a key the canvas
|
|
102
|
+
* leaves alone. Keys with Ctrl or Cmd other than select-all are the host's
|
|
103
|
+
* (an editor's own zoom, save, undo); Alt is never taken.
|
|
104
|
+
*/
|
|
105
|
+
export declare function canvasCommand(e: KeyLike, grid?: number): CanvasCommand | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Keys typed into a field, or pressed on a control that uses them, are not the
|
|
108
|
+
* canvas's: a menu, a dialog (the legend's popover), and a tree or list that walks its rows with the arrows and
|
|
109
|
+
* filters as you type (the hierarchy panel). The canvas listens on the window
|
|
110
|
+
* before them, so without this an arrow on a hierarchy row nudged the selected
|
|
111
|
+
* module and a letter switched the tool (UI QA phase 3).
|
|
112
|
+
*/
|
|
113
|
+
export declare function typingTarget(target: {
|
|
114
|
+
closest?: (selector: string) => unknown;
|
|
115
|
+
} | null | undefined): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* The nodes selected after React Flow's selection changes (a box drag, a
|
|
118
|
+
* click with Shift, Ctrl or Cmd held, a plain click): what was selected, with
|
|
119
|
+
* the changes applied, each named by `canonical` (a supply rail's taps are
|
|
120
|
+
* the rail), once.
|
|
121
|
+
*/
|
|
122
|
+
export declare function applySelectChanges(selected: Iterable<string>, changes: readonly {
|
|
123
|
+
id: string;
|
|
124
|
+
selected: boolean;
|
|
125
|
+
}[], canonical?: (id: string) => string): string[];
|
|
126
|
+
export interface Viewport {
|
|
127
|
+
x: number;
|
|
128
|
+
y: number;
|
|
129
|
+
zoom: number;
|
|
130
|
+
}
|
|
131
|
+
export interface FirstViewState {
|
|
132
|
+
/** The viewport saved for this level (the user's last pan or zoom there). */
|
|
133
|
+
saved?: Viewport;
|
|
134
|
+
/** The saved viewport was put back since the canvas mounted. */
|
|
135
|
+
restored: boolean;
|
|
136
|
+
/** The user panned or zoomed since the canvas mounted (or a host moved the view to something). */
|
|
137
|
+
moved: boolean;
|
|
138
|
+
/** What is drawn: changes when modules come or go. */
|
|
139
|
+
nodesKey: string;
|
|
140
|
+
/** What was drawn at the last automatic fit (null: none yet). */
|
|
141
|
+
fittedKey: string | null;
|
|
142
|
+
/** The canvas has a size (a tab opened in the background has none yet). */
|
|
143
|
+
sized: boolean;
|
|
144
|
+
/** The canvas's size now and at the last automatic fit (`w×h`): a panel docked beside it or folded changes it. */
|
|
145
|
+
size?: string;
|
|
146
|
+
fittedSize?: string | null;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* What the canvas does with its view when it opens or its modules change:
|
|
150
|
+
* a saved viewport is put back, once; with none, the diagram is fitted, and
|
|
151
|
+
* fitted again when modules come or go or the canvas changes size (a panel
|
|
152
|
+
* docked beside it opens or folds), until the user moves the view.
|
|
153
|
+
*/
|
|
154
|
+
export declare function firstView(s: FirstViewState): {
|
|
155
|
+
kind: "restore";
|
|
156
|
+
viewport: Viewport;
|
|
157
|
+
} | {
|
|
158
|
+
kind: "fit";
|
|
159
|
+
} | {
|
|
160
|
+
kind: "keep";
|
|
161
|
+
};
|
|
162
|
+
export declare const validViewport: (v: unknown) => v is Viewport;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Node, NodeProps } from "@xyflow/react";
|
|
2
|
+
import type { Box, PlacedPort, PortGroup } from "../layout/layout";
|
|
3
|
+
import type { ViewNode } from "../model/types";
|
|
4
|
+
import type { NodeMark } from "../api";
|
|
5
|
+
import { type Classification } from "../model/classification";
|
|
6
|
+
export interface NodeData extends Record<string, unknown> {
|
|
7
|
+
node: ViewNode;
|
|
8
|
+
box: Box;
|
|
9
|
+
ports: PlacedPort[];
|
|
10
|
+
groups: PortGroup[];
|
|
11
|
+
mode: Classification;
|
|
12
|
+
showGrounds: boolean;
|
|
13
|
+
selectedPorts: Set<string>;
|
|
14
|
+
/** Ports ("node|port") whose link draws its own pin handle (ribbon mode): no dot. */
|
|
15
|
+
ribbonPorts?: Set<string>;
|
|
16
|
+
/** The host's mark for the node's definition: the corner dot takes its tone. */
|
|
17
|
+
mark?: NodeMark;
|
|
18
|
+
/** Legend entries are isolated and the node stays: its ports that stay (the others fade). Absent: nothing is isolated. */
|
|
19
|
+
keptPorts?: Set<string>;
|
|
20
|
+
}
|
|
21
|
+
export type ModuleNodeType = Node<NodeData, "module">;
|
|
22
|
+
export type ContainerNodeType = Node<NodeData, "container">;
|
|
23
|
+
export type SheetNodeType = Node<NodeData, "sheet">;
|
|
24
|
+
export type HarnessNodeType = Node<NodeData, "harness">;
|
|
25
|
+
export type NetNodeType = Node<NodeData, "net">;
|
|
26
|
+
export declare function ModuleNode({ data, selected }: NodeProps<ModuleNodeType>): import("react").JSX.Element;
|
|
27
|
+
export declare function ContainerNode({ data, selected }: NodeProps<ContainerNodeType>): import("react").JSX.Element;
|
|
28
|
+
export declare function SheetNode({ data, selected }: NodeProps<SheetNodeType>): import("react").JSX.Element;
|
|
29
|
+
/** A harness module drawn as the carrier node its links pass through (design D2, board 04). */
|
|
30
|
+
export declare function HarnessNode({ data, selected }: NodeProps<HarnessNodeType>): import("react").JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* A board net (PB-823): a junction that its members' grouped lines meet at.
|
|
33
|
+
* Its colour is the net's own (power, ground, the bus it carries), its status
|
|
34
|
+
* the worst of its lines.
|
|
35
|
+
*/
|
|
36
|
+
export declare function NetNode({ data, selected }: NodeProps<NetNodeType>): import("react").JSX.Element;
|
|
37
|
+
export declare const nodeTypes: {
|
|
38
|
+
module: typeof ModuleNode;
|
|
39
|
+
container: typeof ContainerNode;
|
|
40
|
+
sheet: typeof SheetNode;
|
|
41
|
+
harness: typeof HarnessNode;
|
|
42
|
+
net: typeof NetNode;
|
|
43
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bringing a host's selection into view (a host's select, such as a DRC
|
|
3
|
+
* finding's Locate): where the selection is drawn, and the viewport that shows
|
|
4
|
+
* it clear of the floating chrome, or none when it is in view already.
|
|
5
|
+
*/
|
|
6
|
+
import type { ComputedLayout } from "../layout/layout";
|
|
7
|
+
import type { ViewModel } from "../model/types";
|
|
8
|
+
/** A selection on the level, as the canvas holds it. */
|
|
9
|
+
export type RevealSelection = {
|
|
10
|
+
kind: "node" | "link";
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
export type Rect = {
|
|
14
|
+
x0: number;
|
|
15
|
+
y0: number;
|
|
16
|
+
x1: number;
|
|
17
|
+
y1: number;
|
|
18
|
+
};
|
|
19
|
+
/** Where a selection is drawn, in flow coordinates: a node's box, or every line of a link (a derived link: the lines it runs over). */
|
|
20
|
+
export declare function selectionBounds(vm: ViewModel, layout: ComputedLayout, selection: RevealSelection): Rect | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The viewport that shows `rect` clear of the floating chrome (the inspector
|
|
23
|
+
* too, when open), or undefined when it is in view already. It keeps the zoom
|
|
24
|
+
* and pans, zooming out only as far as the selection needs; never in.
|
|
25
|
+
*/
|
|
26
|
+
export declare function revealViewport(rect: Rect, viewport: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
zoom: number;
|
|
30
|
+
}, pane: {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
}, inspector: boolean, minZoom?: number): {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
zoom: number;
|
|
37
|
+
} | undefined;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The right button on the diagram: a drag pans the view, a click (the pointer
|
|
3
|
+
* moved no further than `CLICK_SLOP`) opens the canvas's menu where it was
|
|
4
|
+
* let go. No DOM here: the canvas feeds it the pointer's events and does what
|
|
5
|
+
* it returns, so the order browsers send them in is tested as data.
|
|
6
|
+
*
|
|
7
|
+
* Browsers send `contextmenu` at different moments: on Linux and macOS when
|
|
8
|
+
* the button goes down (before anyone knows whether it will be a drag), on
|
|
9
|
+
* Windows after it comes up. So the canvas never lets the browser's menu (or
|
|
10
|
+
* a VS Code webview's) open over what has a menu of its own: `contextmenu`
|
|
11
|
+
* is cancelled, and the menu opens on release, only when the press was a
|
|
12
|
+
* click. A `contextmenu` with no right press behind it (the keyboard's menu
|
|
13
|
+
* key, Shift+F10, Ctrl+click on a Mac) opens the menu at once.
|
|
14
|
+
*/
|
|
15
|
+
import { type Viewport } from "./interaction";
|
|
16
|
+
export interface RightDragHost<T> {
|
|
17
|
+
viewport(): Viewport;
|
|
18
|
+
setViewport(viewport: Viewport): void;
|
|
19
|
+
/** A pan by the right button began. */
|
|
20
|
+
panStart?(): void;
|
|
21
|
+
/** A pan by the right button ended, at this viewport. */
|
|
22
|
+
panEnd(viewport: Viewport): void;
|
|
23
|
+
/** The canvas has a menu of its own for what is at this target (a module, a link, the empty canvas). */
|
|
24
|
+
hasMenu(target: T): boolean;
|
|
25
|
+
/** Open the canvas's menu for the target, at the pointer. */
|
|
26
|
+
openMenu(target: T, x: number, y: number): void;
|
|
27
|
+
/** The time now (ms); default `performance.now()`. */
|
|
28
|
+
now?(): number;
|
|
29
|
+
}
|
|
30
|
+
export interface PointerLike<T> {
|
|
31
|
+
button: number;
|
|
32
|
+
/** The buttons held (a pointer move): a release the canvas did not see ends the press. */
|
|
33
|
+
buttons?: number;
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
target: T;
|
|
37
|
+
}
|
|
38
|
+
export interface RightDrag<T> {
|
|
39
|
+
/** A button went down on the canvas: true when it is the right one (the press is the canvas's). */
|
|
40
|
+
down(e: PointerLike<T>): boolean;
|
|
41
|
+
/** The pointer moved: true while the press pans. */
|
|
42
|
+
move(e: Omit<PointerLike<T>, "button" | "target">): boolean;
|
|
43
|
+
/** A button came up: what the press was, if it was a right one. */
|
|
44
|
+
up(e: PointerLike<T>): "menu" | "pan" | undefined;
|
|
45
|
+
/** The browser asks to show its menu: true to cancel it (the canvas has its own, now or on release). */
|
|
46
|
+
contextMenu(e: Omit<PointerLike<T>, "button">): boolean;
|
|
47
|
+
/** Forget the press (the window lost focus). */
|
|
48
|
+
cancel(): void;
|
|
49
|
+
readonly panning: boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare function createRightDrag<T>(host: RightDragHost<T>): RightDrag<T>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orthogonal link routing with filleted corners (design decision D3).
|
|
3
|
+
* Pure geometry: no React.
|
|
4
|
+
*/
|
|
5
|
+
export type Side = "left" | "right" | "top" | "bottom";
|
|
6
|
+
export type Pt = [number, number];
|
|
7
|
+
/** Remove duplicate and collinear points. */
|
|
8
|
+
export declare function simplify(points: Pt[]): Pt[];
|
|
9
|
+
/**
|
|
10
|
+
* Route from a port on `sourceSide` to a port on `targetSide`. Waypoints, when
|
|
11
|
+
* given, are visited in order; otherwise a 1–2 elbow Manhattan route is used.
|
|
12
|
+
*/
|
|
13
|
+
export declare function route(source: Pt, sourceSide: Side, target: Pt, targetSide: Side, waypoints?: Pt[]): Pt[];
|
|
14
|
+
/** SVG path through `points` with quadratic fillets of radius `r` (or per-corner radii). */
|
|
15
|
+
export declare function filletPath(points: Pt[], r: number | number[]): string;
|
|
16
|
+
export declare function length(points: Pt[]): number;
|
|
17
|
+
/** Point at fraction `t` (0..1) along the polyline. */
|
|
18
|
+
export declare function pointAt(points: Pt[], t: number): Pt;
|
|
19
|
+
/** Fraction along the path of the middle of its longest segment (default label spot). */
|
|
20
|
+
export declare function longestSegmentMid(points: Pt[]): number;
|
|
21
|
+
/**
|
|
22
|
+
* Offset an orthogonal polyline sideways by `d` (positive = left of travel
|
|
23
|
+
* direction in screen space). Returns the points and concentric fillet radii.
|
|
24
|
+
*/
|
|
25
|
+
export declare function offsetPolyline(points: Pt[], d: number, r: number): {
|
|
26
|
+
points: Pt[];
|
|
27
|
+
radii: number[];
|
|
28
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Artifacts as cards: a picture (the image itself, a model's preview, else
|
|
3
|
+
* the kind's icon), the title, the kind and where it comes from. A click
|
|
4
|
+
* opens the artifact: through the host when it takes artifacts, else its URL
|
|
5
|
+
* in a new tab. Pictures load lazily (only cards scrolled into view); a model
|
|
6
|
+
* is drawn only when the host gives a drawer for it.
|
|
7
|
+
*
|
|
8
|
+
* The grid is a container: two or more cards a row where they fit, and one
|
|
9
|
+
* card a row, picture at the left, in a narrow panel (the layout is in
|
|
10
|
+
* styles/ui.css; see there why it is not container-variant utilities).
|
|
11
|
+
*/
|
|
12
|
+
import { type ReactNode } from "react";
|
|
13
|
+
import type { ArtifactCardModel } from "../model/artifacts";
|
|
14
|
+
export interface ArtifactCardProps {
|
|
15
|
+
card: ArtifactCardModel;
|
|
16
|
+
/** Shown at the card's top right (a "sample" tag, a state). */
|
|
17
|
+
badge?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/** One artifact: its picture, title, kind and source. */
|
|
20
|
+
export declare function ArtifactCard({ card, badge }: ArtifactCardProps): import("react").JSX.Element;
|
|
21
|
+
/** Cards in a grid that fits its container. */
|
|
22
|
+
export declare function ArtifactGrid({ cards, className }: {
|
|
23
|
+
cards: ArtifactCardModel[];
|
|
24
|
+
className?: string;
|
|
25
|
+
}): import("react").JSX.Element | null;
|
|
26
|
+
/** Cards under a small title per group (Images, 3D models, Datasheets, …), each with its count. */
|
|
27
|
+
export declare function ArtifactCards({ cards, className }: {
|
|
28
|
+
cards: ArtifactCardModel[];
|
|
29
|
+
className?: string;
|
|
30
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ArtifactDef, ModuleDef } from "@deltarobotics/uhd";
|
|
2
|
+
import type { Appearance } from "../source/source";
|
|
3
|
+
import type { ArtifactResolver } from "../api";
|
|
4
|
+
export type { ArtifactResolver };
|
|
5
|
+
/**
|
|
6
|
+
* The library's convention: an image artifact tagged "thumbnail"; failing that
|
|
7
|
+
* any image (by MIME type or extension), a datasheet's pages last.
|
|
8
|
+
*/
|
|
9
|
+
export declare function thumbnailOf(def: ModuleDef): ArtifactDef | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* An artifact file row: a link to the file, or, when a host takes artifacts
|
|
12
|
+
* (`onOpenArtifact`), a request to the host to open it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ArtifactLink({ defId, artifactId, href, title, children }: {
|
|
15
|
+
defId: string;
|
|
16
|
+
artifactId: string;
|
|
17
|
+
href?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* An assembly (FC + ESC stack, an arm) usually has no CAD of its own: show its
|
|
23
|
+
* parts' artifacts instead, one part at a time, picked from a row of names.
|
|
24
|
+
*/
|
|
25
|
+
export declare function AssemblyArtifacts({ def, lookup, resolve, appearance, titled, }: {
|
|
26
|
+
def?: ModuleDef;
|
|
27
|
+
lookup: (id?: string) => ModuleDef | undefined;
|
|
28
|
+
resolve: ArtifactResolver;
|
|
29
|
+
appearance?: Record<string, Appearance>;
|
|
30
|
+
/** Its own "Artifacts" title (off where a section header says it). */
|
|
31
|
+
titled?: boolean;
|
|
32
|
+
}): import("react").JSX.Element | null;
|
|
33
|
+
/**
|
|
34
|
+
* A definition's artifacts: its picture, its body model (turning in a small
|
|
35
|
+
* 3D preview, unless the host shows models as cards), and every artifact as
|
|
36
|
+
* a card under its kind. A board's drawings and outputs are left to the
|
|
37
|
+
* board's own section (BoardViews).
|
|
38
|
+
*/
|
|
39
|
+
export declare function ArtifactsSection({ def, resolve, appearance, titled }: {
|
|
40
|
+
def?: ModuleDef;
|
|
41
|
+
resolve: ArtifactResolver;
|
|
42
|
+
appearance?: Appearance;
|
|
43
|
+
titled?: boolean;
|
|
44
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ModuleDef } from "@deltarobotics/uhd";
|
|
2
|
+
import type { ViewDerived, ViewModel, ViewNode } from "../model/types";
|
|
3
|
+
import type { ArtifactResolver } from "../api";
|
|
4
|
+
import type { Selection } from "../canvas/Canvas";
|
|
5
|
+
/** A part's package as the manufacturer states it (UHD `partPackage`), with its body size. */
|
|
6
|
+
export declare function PackageSection({ def, titled }: {
|
|
7
|
+
def?: ModuleDef;
|
|
8
|
+
titled?: boolean;
|
|
9
|
+
}): import("react").JSX.Element | null;
|
|
10
|
+
/**
|
|
11
|
+
* Every pin with a designator, in package order, with the net it is on at
|
|
12
|
+
* this level (from the grouped membership lines of `node`).
|
|
13
|
+
*/
|
|
14
|
+
export declare function PinTable({ def, node, vm, titled }: {
|
|
15
|
+
def?: ModuleDef;
|
|
16
|
+
node: ViewNode;
|
|
17
|
+
vm: ViewModel;
|
|
18
|
+
titled?: boolean;
|
|
19
|
+
}): import("react").JSX.Element | null;
|
|
20
|
+
/** Functional links derived over nets, listed by name. */
|
|
21
|
+
export declare function DerivedList({ items, title, onSelect, titled }: {
|
|
22
|
+
items: ViewDerived[];
|
|
23
|
+
title: string;
|
|
24
|
+
onSelect: (s: Selection) => void;
|
|
25
|
+
titled?: boolean;
|
|
26
|
+
}): import("react").JSX.Element | null;
|
|
27
|
+
/** A net: its voltage, its members and their pins, and the links derived over it. */
|
|
28
|
+
export declare function NetDetails({ node, vm, onSelect, bare }: {
|
|
29
|
+
node: ViewNode;
|
|
30
|
+
vm: ViewModel;
|
|
31
|
+
onSelect: (s: Selection) => void;
|
|
32
|
+
bare?: boolean;
|
|
33
|
+
}): import("react").JSX.Element;
|
|
34
|
+
/** A link derived over nets, shown by name: its ends, nets, conductors and findings. */
|
|
35
|
+
export declare function DerivedDetails({ d, vm, onSelect, bare }: {
|
|
36
|
+
d: ViewDerived;
|
|
37
|
+
vm: ViewModel;
|
|
38
|
+
onSelect: (s: Selection) => void;
|
|
39
|
+
bare?: boolean;
|
|
40
|
+
}): import("react").JSX.Element;
|
|
41
|
+
/**
|
|
42
|
+
* The board's drawings, one tab each. `highlight` is a component instance
|
|
43
|
+
* (relative to the board) to mark; `onPick` receives the component clicked.
|
|
44
|
+
*/
|
|
45
|
+
export declare function BoardViews({ def, lookup, resolve, highlight, onPick, drawings, }: {
|
|
46
|
+
/** The drawings with pan and zoom (default). False: the outputs as cards only, nothing fetched. */
|
|
47
|
+
drawings?: boolean;
|
|
48
|
+
def: ModuleDef;
|
|
49
|
+
lookup: (id: string) => ModuleDef | undefined;
|
|
50
|
+
resolve: ArtifactResolver;
|
|
51
|
+
highlight?: string;
|
|
52
|
+
onPick?: (instance: string) => void;
|
|
53
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { ChildLink, ModuleDef } from "@deltarobotics/uhd";
|
|
2
|
+
import type { UhdBundleDiagnostic } from "@deltarobotics/uhd";
|
|
3
|
+
import type { ScopedDiagnostic } from "../model/diagnostics";
|
|
4
|
+
import type { ViewLink, ViewModel, ViewNode } from "../model/types";
|
|
5
|
+
import { type ArtifactResolver } from "./Artifacts";
|
|
6
|
+
import type { Appearance } from "../source/source";
|
|
7
|
+
import { type Classification } from "../model/classification";
|
|
8
|
+
import { type HostFinding } from "../model/slots";
|
|
9
|
+
import { type InterfaceCardActions } from "./InterfaceCards";
|
|
10
|
+
import type { Selection } from "../canvas/Canvas";
|
|
11
|
+
export type Panel = "hierarchy" | "checks";
|
|
12
|
+
/** "24 models · 2 docs · 1 evidence": what a definition's artifacts, and its parts', are, by group. */
|
|
13
|
+
export declare function artifactSummary(def: ModuleDef | undefined, lookup: (id?: string) => ModuleDef | undefined): {
|
|
14
|
+
count: number;
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
export interface NodeDetailsProps {
|
|
18
|
+
node: ViewNode;
|
|
19
|
+
vm: ViewModel;
|
|
20
|
+
mode: Classification;
|
|
21
|
+
def?: ModuleDef;
|
|
22
|
+
onDrill: (id: string) => void;
|
|
23
|
+
onToggleExpand: (id: string) => void;
|
|
24
|
+
onSelect: (s: Selection) => void;
|
|
25
|
+
/** Thumbnail and CAD preview. */
|
|
26
|
+
artifacts?: React.ReactNode;
|
|
27
|
+
/** The board's drawings: this node's own, or those of the board it sits on, with it marked. */
|
|
28
|
+
board?: React.ReactNode;
|
|
29
|
+
/** Ask the host to open the module's source (only when a host takes it). */
|
|
30
|
+
onOpenSource?: () => void;
|
|
31
|
+
/** No title and no action buttons: the host draws its own header and actions. */
|
|
32
|
+
bare?: boolean;
|
|
33
|
+
/** Definitions by id (the interface cards read the module's children and the other ends). */
|
|
34
|
+
lookup?: (id?: string) => ModuleDef | undefined;
|
|
35
|
+
/** The level shown, from the root: canonical ids for findings and Locate. */
|
|
36
|
+
drill?: string[];
|
|
37
|
+
/** Names as written, by node id on the level; link names by link id. */
|
|
38
|
+
names?: Map<string, string>;
|
|
39
|
+
linkNames?: Map<string, string>;
|
|
40
|
+
/** Findings to show on the interface cards (the host's, with keys; else the viewer's own checks). */
|
|
41
|
+
findings?: HostFinding[];
|
|
42
|
+
/** What the interface cards' actions do. */
|
|
43
|
+
cardActions?: InterfaceCardActions;
|
|
44
|
+
}
|
|
45
|
+
export declare function NodeDetails(props: NodeDetailsProps): import("react").JSX.Element;
|
|
46
|
+
export declare function LinkDetails({ link, mode, open, onToggle, onPair, bSlots, override, onOverride, harness, derived, onOpenSource, preview, bare, }: {
|
|
47
|
+
/** No title and no action buttons: the host draws its own header and actions. */
|
|
48
|
+
bare?: boolean;
|
|
49
|
+
/** Ask the host to open the source that declares the link (only when a host takes it). */
|
|
50
|
+
onOpenSource?: () => void;
|
|
51
|
+
/** The pair the link joins, small (its button opens the pair view). */
|
|
52
|
+
preview?: React.ReactNode;
|
|
53
|
+
/** The harness carrying the link: its artifacts (thumbnail, CAD). */
|
|
54
|
+
harness?: React.ReactNode;
|
|
55
|
+
/** Functional links that run over this line (a grouped net membership). */
|
|
56
|
+
derived?: React.ReactNode;
|
|
57
|
+
link: ViewLink;
|
|
58
|
+
mode: Classification;
|
|
59
|
+
open: boolean;
|
|
60
|
+
onToggle: (id: string) => void;
|
|
61
|
+
onPair: () => void;
|
|
62
|
+
/** Child slots on the b side, for remapping. */
|
|
63
|
+
bSlots: string[];
|
|
64
|
+
override?: ChildLink[];
|
|
65
|
+
onOverride?: (childLinks: ChildLink[] | null) => void;
|
|
66
|
+
}): import("react").JSX.Element;
|
|
67
|
+
/** Where to go for a finding: a drill path and what to select there. */
|
|
68
|
+
export interface Goto {
|
|
69
|
+
drill: string[];
|
|
70
|
+
selection: Selection;
|
|
71
|
+
}
|
|
72
|
+
declare function InspectorView(props: {
|
|
73
|
+
className?: string;
|
|
74
|
+
vm: ViewModel;
|
|
75
|
+
panel: Panel;
|
|
76
|
+
onPanel: (p: Panel) => void;
|
|
77
|
+
selection: Selection;
|
|
78
|
+
mode: Classification;
|
|
79
|
+
openLinks: Set<string>;
|
|
80
|
+
diagnostics: ScopedDiagnostic[];
|
|
81
|
+
/** Findings from the bundle's producer and the host (UHD's own checks excluded: the viewer runs them). */
|
|
82
|
+
hostDiagnostics: UhdBundleDiagnostic[];
|
|
83
|
+
defFor: (defId?: string) => ModuleDef | undefined;
|
|
84
|
+
/** Artifact URLs (from the bundle source) and per-definition appearance hints, for the previews. */
|
|
85
|
+
resolveArtifact: ArtifactResolver;
|
|
86
|
+
appearance?: Record<string, Appearance>;
|
|
87
|
+
bSlotsFor: (link: ViewLink) => string[];
|
|
88
|
+
overrides: Record<string, ChildLink[]>;
|
|
89
|
+
onOverride: (linkId: string, childLinks: ChildLink[] | null) => void;
|
|
90
|
+
onSelect: (s: Selection) => void;
|
|
91
|
+
onDrill: (id: string) => void;
|
|
92
|
+
onToggleLink: (id: string) => void;
|
|
93
|
+
onToggleExpand: (id: string) => void;
|
|
94
|
+
onPair: (link: ViewLink) => void;
|
|
95
|
+
topLevel: boolean;
|
|
96
|
+
/** The module shown at this level and its drill path (for its board drawings and for findings elsewhere). */
|
|
97
|
+
levelDef: ModuleDef;
|
|
98
|
+
drill: string[];
|
|
99
|
+
onGoto: (g: Goto) => void;
|
|
100
|
+
/** A module's context menu (when a host takes open actions). */
|
|
101
|
+
onNodeContext?: (id: string, x: number, y: number) => void;
|
|
102
|
+
}): import("react").JSX.Element;
|
|
103
|
+
export interface NodeMenuItem {
|
|
104
|
+
label: string;
|
|
105
|
+
run: () => void;
|
|
106
|
+
}
|
|
107
|
+
/** A small menu at the pointer; any click elsewhere, Escape, or a choice closes it. */
|
|
108
|
+
export declare function NodeMenu({ x, y, items, onClose }: {
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
items: NodeMenuItem[];
|
|
112
|
+
onClose: () => void;
|
|
113
|
+
}): import("react").JSX.Element | null;
|
|
114
|
+
/** Memoised: re-renders only when its props change, not on every frame of a canvas drag. */
|
|
115
|
+
export declare const Inspector: import("react").MemoExoticComponent<typeof InspectorView>;
|
|
116
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evidence for a part, in the inspector: whether its facts were audited, the
|
|
3
|
+
* performance its definition states, the assumptions and source conflicts it
|
|
4
|
+
* records, the open data gaps, and its sources, each a card (its title, the
|
|
5
|
+
* kind of source, its host, its authority and when it was fetched).
|
|
6
|
+
*
|
|
7
|
+
* The traits come with the bundle. The sources and the verification record
|
|
8
|
+
* are files of the part (sources.json, verification.json): a host that has
|
|
9
|
+
* them gives them through the host context (`evidence`), or registers them
|
|
10
|
+
* (registerEvidenceFiles).
|
|
11
|
+
*/
|
|
12
|
+
import type { ModuleDef } from "@deltarobotics/uhd";
|
|
13
|
+
import { evidenceFor } from "../model/evidence";
|
|
14
|
+
/** Whether a definition has evidence to show (its performance facts count only when `performance` is shown). */
|
|
15
|
+
export declare function hasEvidence(ev: ReturnType<typeof evidenceFor>, performance?: boolean): boolean;
|
|
16
|
+
export declare function EvidenceSection({ def, titled, performance }: {
|
|
17
|
+
def?: ModuleDef;
|
|
18
|
+
titled?: boolean;
|
|
19
|
+
performance?: boolean;
|
|
20
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { InterfaceSlot, SlotKind } from "../model/slots";
|
|
2
|
+
/** The card's look, in one place. */
|
|
3
|
+
export declare const CARD_LOOK: {
|
|
4
|
+
readonly list: "flex flex-col gap-1.5";
|
|
5
|
+
readonly card: "uhd-slot-card rounded-[6px] border border-line bg-[color-mix(in_oklab,var(--uhd-text)_3%,transparent)] px-2.5 py-[7px] has-[[data-card-toggle]:focus-visible]:outline has-[[data-card-toggle]:focus-visible]:outline-1 has-[[data-card-toggle]:focus-visible]:-outline-offset-1 has-[[data-card-toggle]:focus-visible]:outline-focus hover:border-line-strong";
|
|
6
|
+
readonly cardOpen: "border-line-strong";
|
|
7
|
+
readonly cardOpenSlot: "bg-transparent";
|
|
8
|
+
readonly head: "flex min-w-0 items-center gap-2";
|
|
9
|
+
/** The toggle covers the whole summary (a stretched button): a click anywhere opens the card. */
|
|
10
|
+
readonly toggle: "min-w-0 truncate text-left text-[12px] leading-[18px] text-fg outline-none after:absolute after:inset-0 after:content-[''] cursor-pointer";
|
|
11
|
+
readonly chip: "inline-flex h-[18px] shrink-0 items-center rounded-[4px] bg-[color-mix(in_oklab,var(--uhd-text)_8%,transparent)] px-1.5 text-[10px] leading-none text-fg-muted";
|
|
12
|
+
readonly pin: "inline-flex h-4 shrink-0 items-center rounded-[4px] border border-line px-1 text-[10px] leading-none text-fg-muted";
|
|
13
|
+
readonly meta: "mt-[5px] flex min-w-0 items-center gap-1";
|
|
14
|
+
readonly role: "ml-auto shrink-0 text-[10px] leading-none text-fg-faint";
|
|
15
|
+
readonly linked: "mt-[5px] flex min-w-0 items-center gap-1.5 text-[11px] leading-[16px]";
|
|
16
|
+
readonly more: "flex h-6 w-full cursor-pointer items-center gap-1.5 rounded-[3px] px-1 text-left text-[11px] text-fg-muted hover:text-fg focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus";
|
|
17
|
+
readonly detail: "mt-2 flex flex-col gap-2.5 border-t border-line-subtle pt-2";
|
|
18
|
+
readonly group: "flex flex-col gap-[3px]";
|
|
19
|
+
readonly button: "relative z-10 inline-flex h-6 min-w-0 cursor-pointer items-center gap-1.5 rounded-[4px] border border-line px-2 text-[10.5px] leading-none text-fg hover:bg-hover focus-visible:outline focus-visible:outline-1 focus-visible:-outline-offset-1 focus-visible:outline-focus";
|
|
20
|
+
readonly textAction: "relative z-10 inline-flex shrink-0 cursor-pointer items-center gap-1 text-[10.5px] leading-none text-link hover:underline focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus";
|
|
21
|
+
};
|
|
22
|
+
/** The pin glyph's colour by kind: power red, signal blue, mechanical grey (theme tokens; swap here). */
|
|
23
|
+
export declare const SLOT_COLOR: Record<SlotKind, string>;
|
|
24
|
+
export interface InterfaceCardActions {
|
|
25
|
+
/** Show the interface (or its first link) on the canvas. */
|
|
26
|
+
locate?: (slot: InterfaceSlot) => void;
|
|
27
|
+
/** Select one of its links (or a derived one) by its id on the level. */
|
|
28
|
+
selectLink?: (id: string) => void;
|
|
29
|
+
/** Open the source that declares it (its link's line, else the interface's). */
|
|
30
|
+
openSource?: (slot: InterfaceSlot) => void;
|
|
31
|
+
/** An open slot: start a link from it. */
|
|
32
|
+
connect?: (slot: InterfaceSlot) => void;
|
|
33
|
+
/** A finding's Locate (the host's key), else the slot's own Locate. */
|
|
34
|
+
finding?: (key: string) => void;
|
|
35
|
+
/** A source the interface cites. */
|
|
36
|
+
openLink?: (url: string) => void;
|
|
37
|
+
}
|
|
38
|
+
/** The pin glyph: one bar per pin (up to four), in the kind's colour; an open slot's are outlined. */
|
|
39
|
+
export declare function SlotGlyph({ kind, pins, open }: {
|
|
40
|
+
kind: SlotKind;
|
|
41
|
+
pins: number;
|
|
42
|
+
open?: boolean;
|
|
43
|
+
}): import("react").JSX.Element;
|
|
44
|
+
/** One interface as a slot card; it expands in place. */
|
|
45
|
+
export declare function InterfaceCard({ slot, open, onToggle, actions }: {
|
|
46
|
+
slot: InterfaceSlot;
|
|
47
|
+
open: boolean;
|
|
48
|
+
onToggle: () => void;
|
|
49
|
+
actions: InterfaceCardActions;
|
|
50
|
+
}): import("react").JSX.Element;
|
|
51
|
+
/** The cards, the first few shown; "N more · names" opens the rest. */
|
|
52
|
+
export declare function InterfaceCards({ slots, actions, first }: {
|
|
53
|
+
slots: InterfaceSlot[];
|
|
54
|
+
actions: InterfaceCardActions;
|
|
55
|
+
first?: number;
|
|
56
|
+
}): import("react").JSX.Element;
|