Repository navigation
Expand file tree
/
Copy pathschema.ts
More file actions
79 lines (70 loc) · 1.61 KB
/
Copy pathschema.ts
File metadata and controls
79 lines (70 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
export type CardId = string;
export type TermId = string;
export type BindingId = string;
export interface AlgorithmDef {
id: string;
name: string;
title: string;
defaultVisibleCards: CardId[];
bindings?: Record<BindingId, BindingDef>;
cards: CardDef[];
}
export type BindingDef =
| { from: string }
| { compute: ComputeKind; inputs: BindingId[] };
export type ComputeKind =
| "exp"
| "log"
| "neg"
| "neg_mul"
| "add"
| "sub"
| "mul"
| "div"
| "clip_mul"
| "min"
| "max"
| "min_winner"
| "array_mean"
| "array_std";
export interface CardDef {
id: CardId;
title: string;
position: { x: number; y: number };
size?: { w: number; h?: number };
sections: SectionDef[];
terms?: Record<TermId, TermSpawn>;
description?: string;
header?: ValueSlot;
}
export interface SectionDef {
id?: string;
label?: string;
katex: string;
opensCardId?: CardId;
header?: ValueSlot;
termValues?: Record<TermId, ValueSlot>;
compare?: CompareSpec;
}
export interface TermSpawn {
toCardId?: CardId;
toSectionId?: string;
tooltip?: string;
}
export interface ValueSlot {
binding: BindingId;
position?: "above" | "below" | "inline" | "replace";
format?: "decimal:2" | "decimal:3" | "decimal:4" | "sigfig:3" | "string";
style?: "default" | "heatmap";
}
export interface CompareSpec {
binding: BindingId;
candidates: Record<string, TermId>;
marker: "check";
}
export interface Edge {
fromCard: CardId;
fromTermId: TermId;
toCard: CardId;
toSectionId?: string;
}