@deltarobotics/uhd-viewer 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -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-CEJyT8hF.css +2 -0
- package/dist/app/assets/index-DWZ-48wc.js +3853 -0
- package/dist/app/index.html +16 -0
- package/dist/components/components.css +6372 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +26609 -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 +30 -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 +90 -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 +55 -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 +126 -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 +66 -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 +128 -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 +101 -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 +41 -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 +58 -0
- package/dist/components/types/uhd-viewer/src/model/hierarchy.d.ts +173 -0
- package/dist/components/types/uhd-viewer/src/model/isolate.d.ts +33 -0
- package/dist/components/types/uhd-viewer/src/model/level.d.ts +7 -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 +184 -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 +59 -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 +55 -0
- package/dist/components/types/uhd-viewer/src/viewer/controller.d.ts +219 -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 +82 -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 +187 -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 +97787 -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,94 @@
|
|
|
1
|
+
import type { ViewLink, ViewModel, ViewPort } from "../model/types";
|
|
2
|
+
import { type Pt, type Side } from "../canvas/routing";
|
|
3
|
+
import type { LinkLayout } from "../api";
|
|
4
|
+
/** Distance kept between a corner and anything placed on a link (handles, toggles). */
|
|
5
|
+
export declare const BEND_CLEAR = 28;
|
|
6
|
+
export interface Box {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
w: number;
|
|
10
|
+
h: number;
|
|
11
|
+
}
|
|
12
|
+
/** A link's hand layout: part of the host contract (src/api.ts). */
|
|
13
|
+
export type { LinkLayout };
|
|
14
|
+
export interface LevelLayout {
|
|
15
|
+
/** Top-level nodes: absolute. Nodes inside a container: relative to it. */
|
|
16
|
+
nodes: Record<string, Partial<Box>>;
|
|
17
|
+
/** Port side overrides keyed "node|port". */
|
|
18
|
+
ports?: Record<string, Side>;
|
|
19
|
+
links?: Record<string, LinkLayout>;
|
|
20
|
+
}
|
|
21
|
+
export interface PlacedPort {
|
|
22
|
+
node: string;
|
|
23
|
+
port: ViewPort;
|
|
24
|
+
side: Side;
|
|
25
|
+
/** Absolute position on the node outline. */
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
/** Colour key: the link that decides this port's classification colour. */
|
|
29
|
+
links: ViewLink[];
|
|
30
|
+
}
|
|
31
|
+
export interface PortGroup {
|
|
32
|
+
protocol: string;
|
|
33
|
+
domain: string;
|
|
34
|
+
count: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ComputedLayout {
|
|
37
|
+
boxes: Record<string, Box>;
|
|
38
|
+
ports: Record<string, PlacedPort>;
|
|
39
|
+
/** Unlinked ports summarised per node (design D6: "UART ×4"). */
|
|
40
|
+
groups: Record<string, PortGroup[]>;
|
|
41
|
+
routes: Record<string, Pt[]>;
|
|
42
|
+
/** Label anchor per link (absent: route too short to label). */
|
|
43
|
+
labels: Record<string, Pt>;
|
|
44
|
+
/** Label + toggle position as an arc length along the route. */
|
|
45
|
+
labelAt: Record<string, number>;
|
|
46
|
+
/** Harness region span along the route (arc lengths), for links that run through one. */
|
|
47
|
+
runs: Record<string, [number, number]>;
|
|
48
|
+
/** Pinned waypoints per link, and the automatic ones (the router's own bends). */
|
|
49
|
+
pins: Record<string, Pt[]>;
|
|
50
|
+
bends: Record<string, Pt[]>;
|
|
51
|
+
/** Links whose label (and expansion point) the user or the display file placed. */
|
|
52
|
+
labelFixed: Record<string, boolean>;
|
|
53
|
+
/** The display file's and the user's label and tab placement per link, merged. */
|
|
54
|
+
edits: Record<string, LinkLayout>;
|
|
55
|
+
}
|
|
56
|
+
export declare const portKey: (node: string, port: string) => string;
|
|
57
|
+
/** How an automatic layout starts (PB-1007): cards that keep their places, and an earlier arrangement to keep. */
|
|
58
|
+
export interface ArrangeOptions {
|
|
59
|
+
/** Top-level cards that stay where they are (top-left). */
|
|
60
|
+
fixed?: Record<string, {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
}>;
|
|
64
|
+
/** Each top-level card's centre in an earlier layout: the arrangement to start from. */
|
|
65
|
+
seed?: Record<string, {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
}>;
|
|
69
|
+
/** The old default (one row), for comparing against. */
|
|
70
|
+
legacy?: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A drag in progress: only the links touching what moves are rerouted, around
|
|
74
|
+
* the routes the other links already have; everything is rerouted once the
|
|
75
|
+
* drag ends. Keeps dragging a module or a waypoint at frame rate.
|
|
76
|
+
*/
|
|
77
|
+
export interface LiveLayout {
|
|
78
|
+
previous: ComputedLayout;
|
|
79
|
+
/** Nodes being dragged (their children move with them). */
|
|
80
|
+
nodes?: Set<string>;
|
|
81
|
+
/** Links whose waypoints are being dragged. */
|
|
82
|
+
links?: Set<string>;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The automatic layout of a level as a hand layout (PB-1007, for a host that
|
|
86
|
+
* writes it to the display file): top-level nodes absolute, nodes inside an
|
|
87
|
+
* expanded module relative to it. `fixed` cards keep their places; a `seed`
|
|
88
|
+
* keeps an earlier arrangement where it can.
|
|
89
|
+
*/
|
|
90
|
+
export declare function arrangeLevel(vm: ViewModel, opts?: ArrangeOptions, keepSizes?: LevelLayout): LevelLayout;
|
|
91
|
+
export declare function computeLayout(vm: ViewModel, hand: LevelLayout | undefined, overrides: Record<string, {
|
|
92
|
+
x: number;
|
|
93
|
+
y: number;
|
|
94
|
+
}>, showGrounds: boolean, linkOverrides?: Record<string, LinkLayout>, live?: LiveLayout, arrange?: ArrangeOptions): ComputedLayout;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface GridNode {
|
|
2
|
+
id: string;
|
|
3
|
+
w: number;
|
|
4
|
+
h: number;
|
|
5
|
+
category?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface GridOptions {
|
|
8
|
+
/** Cards that stay where they are: top-left positions. */
|
|
9
|
+
fixed?: Record<string, {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
}>;
|
|
13
|
+
/** Where each card's centre was: the starting arrangement. */
|
|
14
|
+
seed?: Record<string, {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
}>;
|
|
18
|
+
/** Width over height to aim for (default 1.6). */
|
|
19
|
+
aspect?: number;
|
|
20
|
+
}
|
|
21
|
+
/** Room between columns (lines and their labels run there) and between rows. */
|
|
22
|
+
export declare const GRID_GAP_X = 192;
|
|
23
|
+
export declare const GRID_GAP_Y = 128;
|
|
24
|
+
/**
|
|
25
|
+
* Top-left positions by id for a level of modules. `edges` are the lines
|
|
26
|
+
* between cards (one entry per line; several between two cards weigh more,
|
|
27
|
+
* though less than that many).
|
|
28
|
+
*/
|
|
29
|
+
export declare function gridLayout(nodes: GridNode[], edges: [string, string][], opts?: GridOptions): Record<string, {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
}>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grid router (PB-803, design D12): orthogonal routes on the 16 px grid.
|
|
3
|
+
*
|
|
4
|
+
* A* over grid cells with a direction in the state. It avoids module cards,
|
|
5
|
+
* penalises bends and crossings, and keeps parallel runs one grid step apart
|
|
6
|
+
* by charging for cells another route already runs along. Pinned waypoints
|
|
7
|
+
* (dragged by the user, saved in the display file) are visited in order; the
|
|
8
|
+
* bends it chooses itself are the automatic waypoints.
|
|
9
|
+
*/
|
|
10
|
+
import type { Pt, Side } from "../canvas/routing";
|
|
11
|
+
export declare const GRID = 16;
|
|
12
|
+
export interface Rect {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
w: number;
|
|
16
|
+
h: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const snap: (v: number) => number;
|
|
19
|
+
export declare class GridRouter {
|
|
20
|
+
private x0;
|
|
21
|
+
private y0;
|
|
22
|
+
private W;
|
|
23
|
+
private H;
|
|
24
|
+
private blocked;
|
|
25
|
+
/** Cells used by earlier routes: bit 1 horizontal run, bit 2 vertical run. */
|
|
26
|
+
private used;
|
|
27
|
+
/** Search state, allocated once and reused: a state is valid when its stamp is the current search's. */
|
|
28
|
+
private g;
|
|
29
|
+
private prev;
|
|
30
|
+
private stamp;
|
|
31
|
+
private gen;
|
|
32
|
+
private thorough;
|
|
33
|
+
/**
|
|
34
|
+
* `thorough`: a search that runs out of its budget is retried over the whole grid (off while
|
|
35
|
+
* dragging, where a frame cannot wait for it).
|
|
36
|
+
*/
|
|
37
|
+
constructor(obstacles: Rect[], extra?: Pt[], margin?: number, thorough?: boolean);
|
|
38
|
+
private idx;
|
|
39
|
+
/**
|
|
40
|
+
* Route from a port (on `fromSide` of its card) to another port, through
|
|
41
|
+
* `pins` in order. Returns the polyline in canvas coordinates. With
|
|
42
|
+
* `within`, the route stays inside that rectangle (a link between two
|
|
43
|
+
* modules of a container expanded in place never leaves the container);
|
|
44
|
+
* where no such route exists it is routed without the limit.
|
|
45
|
+
*/
|
|
46
|
+
route(from: Pt, fromSide: Side, to: Pt, toSide: Side, pins?: Pt[], within?: Rect): Pt[];
|
|
47
|
+
/** The cells a search may use, in grid coordinates (a container's inside), when a route is kept within one. */
|
|
48
|
+
private region;
|
|
49
|
+
/** One routing attempt; `strict` gives up (undefined, nothing marked) where a leg finds no way instead of jogging straight. */
|
|
50
|
+
private routeOnce;
|
|
51
|
+
private search;
|
|
52
|
+
/** Treat an existing route (canvas coordinates, axis-aligned) as occupied, as if it had just been routed. */
|
|
53
|
+
occupy(points: Pt[]): void;
|
|
54
|
+
private mark;
|
|
55
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rail taps (PB-873): a supply rail drawn the way a schematic draws it.
|
|
3
|
+
*
|
|
4
|
+
* A rail joins most of a board (a 3V3 rail reaches 15–20 parts). Drawn as one
|
|
5
|
+
* junction it pulls a line from every corner of the sheet. Drawn as a net
|
|
6
|
+
* label at each place it is used, it reads at a glance: here the rail is
|
|
7
|
+
* split into taps, one per cluster of parts (a part and the passives that
|
|
8
|
+
* serve it, board-layout.ts), each joined only to the members of its cluster.
|
|
9
|
+
* The taps carry the net's name and colour; the one with the most members
|
|
10
|
+
* keeps the net's id, the others are `<net>~<cluster>` with `tapOf` set.
|
|
11
|
+
*
|
|
12
|
+
* Only the drawing changes: the inspector, the hierarchy and the findings
|
|
13
|
+
* read the level's view model, where the net is one node.
|
|
14
|
+
*/
|
|
15
|
+
import type { ViewModel, ViewNode } from "../model/types";
|
|
16
|
+
/** A power net with at least this many members is drawn as taps. */
|
|
17
|
+
export declare const RAIL_TAP_MIN = 5;
|
|
18
|
+
export declare function tapRails(vm: ViewModel): ViewModel;
|
|
19
|
+
/** The node a selection names for a drawn node: a tap's net. */
|
|
20
|
+
export declare const selectionId: (node: ViewNode | undefined, id: string) => string;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A definition's artifacts as cards: every artifact is one card with a kind
|
|
3
|
+
* (image, 3D model, schematic, PCB, datasheet, document, …), a title, where
|
|
4
|
+
* it comes from (a file, or the host of its URL) and, where it has one, a
|
|
5
|
+
* picture to show. No React here: the inspector draws the cards
|
|
6
|
+
* (chrome/ArtifactCards.tsx), a host may read the same list.
|
|
7
|
+
*/
|
|
8
|
+
import type { ArtifactDef, ModuleDef } from "@deltarobotics/uhd";
|
|
9
|
+
import type { ArtifactResolver } from "../api";
|
|
10
|
+
export type ArtifactKind = "image" | "model" | "schematic" | "pcb" | "drawing" | "datasheet" | "document" | "source" | "firmware" | "data" | "evidence";
|
|
11
|
+
/** The sections cards are shown in, in this order. */
|
|
12
|
+
export type ArtifactGroup = "images" | "models" | "board" | "datasheets" | "documents" | "evidence" | "design" | "data";
|
|
13
|
+
export declare const ARTIFACT_GROUPS: {
|
|
14
|
+
id: ArtifactGroup;
|
|
15
|
+
title: string;
|
|
16
|
+
}[];
|
|
17
|
+
/** What a card shows above its title: a picture, or a model a host may draw small. */
|
|
18
|
+
export type ArtifactPreview = {
|
|
19
|
+
kind: "image";
|
|
20
|
+
src: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "model";
|
|
23
|
+
src: string;
|
|
24
|
+
};
|
|
25
|
+
export interface ArtifactCardModel {
|
|
26
|
+
/** Unique among a definition's cards. */
|
|
27
|
+
key: string;
|
|
28
|
+
defId: string;
|
|
29
|
+
/** The artifact's id (absent for a card that is not an artifact of the definition: an evidence source). */
|
|
30
|
+
artifactId?: string;
|
|
31
|
+
title: string;
|
|
32
|
+
kind: ArtifactKind;
|
|
33
|
+
group: ArtifactGroup;
|
|
34
|
+
/** The kind in words: "Datasheet", "STEP model", "PCB top". */
|
|
35
|
+
kindLabel: string;
|
|
36
|
+
/** The file format, upper case: "PDF", "STEP", "GLB". */
|
|
37
|
+
format?: string;
|
|
38
|
+
/** Where it comes from, short: a URL's host, a file's name. */
|
|
39
|
+
source?: string;
|
|
40
|
+
/** More about the source: its authority and when it was fetched ("manufacturer · fetched 2026-10-03"). */
|
|
41
|
+
sourceNote?: string;
|
|
42
|
+
/** The whole URL or path, for the tooltip. */
|
|
43
|
+
location?: string;
|
|
44
|
+
/** What a click opens when no host takes artifacts. */
|
|
45
|
+
href?: string;
|
|
46
|
+
/** Lucide icon name, drawn when there is no picture. */
|
|
47
|
+
icon: string;
|
|
48
|
+
preview?: ArtifactPreview;
|
|
49
|
+
/** The artifact is a web address, not a file of the project. */
|
|
50
|
+
remote: boolean;
|
|
51
|
+
description?: string;
|
|
52
|
+
/** The same model in other formats (a STEP and the GLB exported with it): one card, each format a way to open it. */
|
|
53
|
+
also?: {
|
|
54
|
+
artifactId: string;
|
|
55
|
+
format?: string;
|
|
56
|
+
href?: string;
|
|
57
|
+
}[];
|
|
58
|
+
}
|
|
59
|
+
/** An evidence source row (sources.json), as far as cards need it. */
|
|
60
|
+
export interface ArtifactSourceRow {
|
|
61
|
+
id: string;
|
|
62
|
+
title: string;
|
|
63
|
+
url: string;
|
|
64
|
+
type?: string;
|
|
65
|
+
authority?: string;
|
|
66
|
+
fetched_at?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface ArtifactCardOptions {
|
|
69
|
+
/**
|
|
70
|
+
* A picture for an artifact that is not an image itself (a model's exported
|
|
71
|
+
* preview, or the model for the host to draw small). Not given: such cards
|
|
72
|
+
* show their icon.
|
|
73
|
+
*/
|
|
74
|
+
previewFor?: (def: ModuleDef, artifact: ArtifactDef) => ArtifactPreview | undefined;
|
|
75
|
+
/** Load pictures from web addresses (default true). A host that loads only its own files turns it off: those cards show their icon. */
|
|
76
|
+
remoteImages?: boolean;
|
|
77
|
+
/** The definition's evidence sources: an artifact with the same URL says its authority and when it was fetched; `evidence: true` lists the others as cards of their own. */
|
|
78
|
+
sources?: ArtifactSourceRow[];
|
|
79
|
+
evidence?: boolean;
|
|
80
|
+
/** Artifacts to leave out (already shown another way). */
|
|
81
|
+
skip?: (artifact: ArtifactDef) => boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Keep a part's internal geometry: the per-interface models its mates are computed from (role `interface`),
|
|
84
|
+
* which a module's cards leave out (QA B2: 17 "interface geometry" GLBs on a flight controller). An
|
|
85
|
+
* interface's own card asks for them.
|
|
86
|
+
*/
|
|
87
|
+
internal?: boolean;
|
|
88
|
+
/** One card per model, its formats together (`mergeFormats`; default true). */
|
|
89
|
+
mergeFormats?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/** An artifact that is a part's internal geometry, not something to open: one interface's mating model. */
|
|
92
|
+
export declare const isInternalArtifact: (a: Pick<ArtifactDef, "role">) => boolean;
|
|
93
|
+
/** A file's or URL's last path segment. */
|
|
94
|
+
export declare const artifactFileName: (a: Pick<ArtifactDef, "filePath" | "url">) => string;
|
|
95
|
+
/** The extension of an artifact's file or URL, lower case (only a short alphanumeric one counts). */
|
|
96
|
+
export declare function artifactExtension(a: Pick<ArtifactDef, "filePath" | "url">): string;
|
|
97
|
+
/** A URL's host without `www.`, or undefined when it is not a URL. */
|
|
98
|
+
export declare function hostOf(url: string | undefined): string | undefined;
|
|
99
|
+
interface Classified {
|
|
100
|
+
kind: ArtifactKind;
|
|
101
|
+
group: ArtifactGroup;
|
|
102
|
+
kindLabel: string;
|
|
103
|
+
icon: string;
|
|
104
|
+
}
|
|
105
|
+
/** What an artifact is, from its type, role, format and file name. */
|
|
106
|
+
export declare function classifyArtifact(a: ArtifactDef): Classified;
|
|
107
|
+
/** One artifact as a card. */
|
|
108
|
+
export declare function artifactCard(def: ModuleDef, a: ArtifactDef, resolve: ArtifactResolver, options?: ArtifactCardOptions): ArtifactCardModel;
|
|
109
|
+
/** A definition's evidence sources (sources.json), each as a card: its title, what kind of source, its host, its authority and when it was fetched. */
|
|
110
|
+
export declare const evidenceSourceCards: (defId: string, sources: ArtifactSourceRow[]) => ArtifactCardModel[];
|
|
111
|
+
/**
|
|
112
|
+
* Every artifact of a definition as a card, in the order of the groups; with
|
|
113
|
+
* `evidence`, the definition's evidence sources that no artifact names follow
|
|
114
|
+
* as cards too.
|
|
115
|
+
*/
|
|
116
|
+
export declare function artifactCards(def: ModuleDef | undefined, resolve: ArtifactResolver, options?: ArtifactCardOptions): ArtifactCardModel[];
|
|
117
|
+
/**
|
|
118
|
+
* One card per model (QA B2): models that are one file in several formats (`body.step` and `body.glb`, beside
|
|
119
|
+
* each other) are one card, the first's (a STEP before its GLB), with every format named and the others in
|
|
120
|
+
* `also`. Its title loses a "(STEP)" that named the format.
|
|
121
|
+
*/
|
|
122
|
+
export declare function mergeFormats(cards: ArtifactCardModel[]): ArtifactCardModel[];
|
|
123
|
+
/** Cards by group, in the groups' order; empty groups are left out. */
|
|
124
|
+
export declare function groupArtifactCards(cards: ArtifactCardModel[]): {
|
|
125
|
+
id: ArtifactGroup;
|
|
126
|
+
title: string;
|
|
127
|
+
cards: ArtifactCardModel[];
|
|
128
|
+
}[];
|
|
129
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { LinkState } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Interface/harness classification (design decision D7): the rule that
|
|
4
|
+
* colours ports and links. Domain is the default.
|
|
5
|
+
*/
|
|
6
|
+
export type Classification = "domain" | "drc" | "signal";
|
|
7
|
+
export declare const CLASSIFICATIONS: {
|
|
8
|
+
id: Classification;
|
|
9
|
+
label: string;
|
|
10
|
+
}[];
|
|
11
|
+
export interface Colorable {
|
|
12
|
+
domain: string;
|
|
13
|
+
protocol: string;
|
|
14
|
+
state?: LinkState;
|
|
15
|
+
}
|
|
16
|
+
export declare function colorFor(item: Colorable, mode: Classification): string;
|
|
17
|
+
/** Items outside the classification's focus are faded (signal mode shows electrical only). */
|
|
18
|
+
export declare function isFaded(item: Colorable, mode: Classification): boolean;
|
|
19
|
+
/** One entry of a classification's legend. `key` is what `classKey` gives the items it stands for. */
|
|
20
|
+
export interface LegendEntry {
|
|
21
|
+
key: string;
|
|
22
|
+
/** Its name, as the legend shows it. */
|
|
23
|
+
label: string;
|
|
24
|
+
/** What it stands for, in a few words (the legend's second line). */
|
|
25
|
+
meaning: string;
|
|
26
|
+
color: string;
|
|
27
|
+
}
|
|
28
|
+
/** The legend entry an item belongs to in a classification (the key of its colour). */
|
|
29
|
+
export declare function classKey(item: Colorable, mode: Classification): string;
|
|
30
|
+
/**
|
|
31
|
+
* What the colours of a classification mean. With `present` (the keys drawn
|
|
32
|
+
* on the level, `presentKeys`), the entries the fixed list leaves out (SPI,
|
|
33
|
+
* CAN, a domain of its own…) are added where the level has them, so every
|
|
34
|
+
* colour on screen has an entry to read and to isolate.
|
|
35
|
+
*/
|
|
36
|
+
export declare function legendFor(mode: Classification, present?: ReadonlySet<string>): LegendEntry[];
|
|
37
|
+
/** Signal-type colour: one table for links, lanes and conductors ("uart_tx" is a UART). */
|
|
38
|
+
declare function signalColor(protocol: string): string;
|
|
39
|
+
/** Colour of one conductor in signal mode (the same table as links and lanes). */
|
|
40
|
+
export declare const conductorColor: typeof signalColor;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The system checks the viewer runs itself (PB-823).
|
|
3
|
+
*
|
|
4
|
+
* UHD derives links per module: a parent does not see through a child
|
|
5
|
+
* board's nets (docs/boards-and-nets.md, "Limits"). So the root is checked,
|
|
6
|
+
* and so is every module below it that declares nets (a board), on its own.
|
|
7
|
+
* A board's findings are re-based onto the root: refs and ids carry the
|
|
8
|
+
* board's instance path (`board/u2:pin_14`, `link:board/<id>`, `board:sda`),
|
|
9
|
+
* and `scope` names the board, so the checks panel can say where a finding
|
|
10
|
+
* is and the diagram can overlay it when that board is drilled into.
|
|
11
|
+
*/
|
|
12
|
+
import type { ModuleDef } from "@deltarobotics/uhd";
|
|
13
|
+
import type { ModuleLookup } from "@deltarobotics/uhd";
|
|
14
|
+
import { type SystemDiagnostic } from "@deltarobotics/uhd";
|
|
15
|
+
export interface ScopedDiagnostic extends SystemDiagnostic {
|
|
16
|
+
/** Instance path of the module that was checked ("" for the root). */
|
|
17
|
+
scope: string;
|
|
18
|
+
}
|
|
19
|
+
/** A canonical path below `scope`, re-based onto the root. */
|
|
20
|
+
export declare function rebase(ref: string, scope: string): string;
|
|
21
|
+
/** Instance paths of every module below `root` that declares nets, depth first. */
|
|
22
|
+
export declare function boardsBelow(root: ModuleDef, lookup: ModuleLookup): {
|
|
23
|
+
path: string;
|
|
24
|
+
def: ModuleDef;
|
|
25
|
+
}[];
|
|
26
|
+
/** The root's findings, then each board's, re-based onto the root. */
|
|
27
|
+
export declare function systemDiagnostics(root: ModuleDef, lookup: ModuleLookup): ScopedDiagnostic[];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evidence for a part: its sources.json and verification.json, when they are
|
|
3
|
+
* registered (registerEvidenceFiles; nothing does yet), plus the evidence
|
|
4
|
+
* traits on its definition.
|
|
5
|
+
*
|
|
6
|
+
* The traits come with the bundle. The two files do not (yet): UHD has no
|
|
7
|
+
* part library to read them from, so without a host that supplies them the
|
|
8
|
+
* viewer shows the traits only.
|
|
9
|
+
*/
|
|
10
|
+
import type { ModuleDef } from "@deltarobotics/uhd";
|
|
11
|
+
export interface SourceRow {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
url: string;
|
|
15
|
+
type: string;
|
|
16
|
+
authority: string;
|
|
17
|
+
supports?: string[];
|
|
18
|
+
fetched_at?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface Verification {
|
|
21
|
+
audit: {
|
|
22
|
+
checked: number;
|
|
23
|
+
confirmed: number;
|
|
24
|
+
wrong: number;
|
|
25
|
+
unsupported: number;
|
|
26
|
+
} | null;
|
|
27
|
+
repairs: string | null;
|
|
28
|
+
assumptions: unknown[];
|
|
29
|
+
data_gaps: unknown[];
|
|
30
|
+
vocabulary_gaps: unknown[];
|
|
31
|
+
recorded_at: string;
|
|
32
|
+
}
|
|
33
|
+
/** Evidence files by part id (definition id). */
|
|
34
|
+
export declare function registerEvidenceFiles(files: {
|
|
35
|
+
sources: Record<string, SourceRow[]>;
|
|
36
|
+
verification: Record<string, Verification>;
|
|
37
|
+
}): void;
|
|
38
|
+
export interface Evidence {
|
|
39
|
+
/** Whether sources.json / verification.json were available at all (false: the audit state is unknown). */
|
|
40
|
+
filesKnown: boolean;
|
|
41
|
+
sources: SourceRow[];
|
|
42
|
+
verification?: Verification;
|
|
43
|
+
performance: {
|
|
44
|
+
kind: string;
|
|
45
|
+
facts: [string, string][];
|
|
46
|
+
}[];
|
|
47
|
+
assumptions: {
|
|
48
|
+
field: string;
|
|
49
|
+
value?: string;
|
|
50
|
+
reason?: string;
|
|
51
|
+
}[];
|
|
52
|
+
discrepancies: {
|
|
53
|
+
field: string;
|
|
54
|
+
resolution?: string;
|
|
55
|
+
}[];
|
|
56
|
+
gaps: string[];
|
|
57
|
+
}
|
|
58
|
+
/** A definition's evidence files as a host gives them (`files`), else as registered. */
|
|
59
|
+
export interface EvidenceFiles {
|
|
60
|
+
sources?: SourceRow[];
|
|
61
|
+
verification?: Verification;
|
|
62
|
+
}
|
|
63
|
+
export declare function evidenceFor(def: ModuleDef | undefined, files?: EvidenceFiles): Evidence | undefined;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter: UHD system ModuleDef → neutral view model.
|
|
3
|
+
*
|
|
4
|
+
* A level shows the children of one module. Children that have children of
|
|
5
|
+
* their own are drawn expanded in place when listed in `expanded` (their
|
|
6
|
+
* boundary ports are exports, joined to the inner ports by pass-through
|
|
7
|
+
* lines); otherwise they are drawn as a single card with boundary ports.
|
|
8
|
+
* Harness children (kind "harness") become harness nodes, and every link
|
|
9
|
+
* they carry is drawn in two segments through them. System diagnostics
|
|
10
|
+
* (checkSystem) are overlaid onto link state for DRC colouring.
|
|
11
|
+
*/
|
|
12
|
+
import type { ChildLink, InterfaceDef, ModuleDef } from "@deltarobotics/uhd";
|
|
13
|
+
import { type LinkResult, type ModuleLookup } from "@deltarobotics/uhd";
|
|
14
|
+
import type { SystemDiagnostic } from "@deltarobotics/uhd";
|
|
15
|
+
import type { ViewLink, ViewModel, ViewPort } from "./types";
|
|
16
|
+
export declare function toPort(iface: InterfaceDef, owner: ModuleDef, exported?: ViewPort["exported"]): ViewPort;
|
|
17
|
+
/** Link ids whose child links are stored overrides. */
|
|
18
|
+
type Overrides = Record<string, ChildLink[]>;
|
|
19
|
+
export interface LevelLinks {
|
|
20
|
+
links: ViewLink[];
|
|
21
|
+
/** Harness children drawn as regions on links, not as nodes. */
|
|
22
|
+
regionHarnesses: Set<string>;
|
|
23
|
+
/** Stored or derived link id → the view link that draws it (for diagnostics). */
|
|
24
|
+
owners: Map<string, string>;
|
|
25
|
+
/** Every link UHD derives at this level (through cables and over nets). */
|
|
26
|
+
derived: LinkResult[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The links of one level (PB-803/805). A harness with exactly two connector
|
|
30
|
+
* ends becomes one link from part to part with the harness as a region along
|
|
31
|
+
* it; its lanes are the links derived through its conductors and its
|
|
32
|
+
* conductors are the mated positions. Logical links that name a harness get
|
|
33
|
+
* the same region. Anything else keeps its own line.
|
|
34
|
+
*/
|
|
35
|
+
export declare function levelLinks(def: ModuleDef, results: LinkResult[], lookup: ModuleLookup, prefix: string, overrides: Overrides | undefined): LevelLinks;
|
|
36
|
+
export interface BuildOptions {
|
|
37
|
+
/** Child ids (at this level) drawn expanded in place. */
|
|
38
|
+
expanded: Set<string>;
|
|
39
|
+
/** Stored child-link overrides keyed by link id (top level). */
|
|
40
|
+
overrides?: Overrides;
|
|
41
|
+
/**
|
|
42
|
+
* System diagnostics to overlay on link state. Refs are relative to the
|
|
43
|
+
* root; findings of a board checked on its own (see App) carry its path
|
|
44
|
+
* (`link:board/<id>`), so they overlay when that board is drilled into.
|
|
45
|
+
*/
|
|
46
|
+
diagnostics?: SystemDiagnostic[];
|
|
47
|
+
/** Draw ground nets as junctions with wires (GND wires on) rather than as ground symbols. */
|
|
48
|
+
grounds?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** Apply child-link overrides to a module's stored links. */
|
|
51
|
+
export declare function withOverrides(def: ModuleDef, overrides: Overrides | undefined): ModuleDef;
|
|
52
|
+
/** Descend `drill` child ids from the root to find the module shown at this level. */
|
|
53
|
+
export declare function levelModule(root: ModuleDef, drill: string[], lookup: ModuleLookup): {
|
|
54
|
+
def: ModuleDef;
|
|
55
|
+
path: ViewModel["path"];
|
|
56
|
+
};
|
|
57
|
+
export declare function buildView(root: ModuleDef, lookup: ModuleLookup, drill: string[], opts: BuildOptions): ViewModel;
|
|
58
|
+
export {};
|