@tangle-network/charts 0.1.1 → 0.1.3
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 +1 -2
- package/dist/index.d.ts +152 -229
- package/dist/index.js +1868 -1779
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -63,5 +63,4 @@ pnpm --filter @tangle-network/charts build # fails when src/css.generated.ts
|
|
|
63
63
|
|
|
64
64
|
## Release
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
npm trusted publishing needs the package to exist before a trusted publisher can be added, so the first version is published once by an owner, then `npm trust github @tangle-network/charts --file release.yml --repo tangle-network/brand --allow-publish` hands later versions to the release workflow.
|
|
66
|
+
Versions publish from the brand release workflow through npm trusted publishing, like `@tangle-network/brand` and `@tangle-network/ui`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Inputs and outputs of the figure functions.
|
|
3
4
|
*
|
|
@@ -15,10 +16,10 @@ type IntervalMethod = "task-cluster-bootstrap" | "mcnemar-exact" | "wilson";
|
|
|
15
16
|
* interval that does not name both.
|
|
16
17
|
*/
|
|
17
18
|
interface Interval {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
lower: number;
|
|
20
|
+
upper: number;
|
|
21
|
+
level: number | null;
|
|
22
|
+
method: IntervalMethod | null;
|
|
22
23
|
}
|
|
23
24
|
/** The App Grade ladder, lowest first. U (unable to measure) is not on it. */
|
|
24
25
|
type Tier = "F" | "C" | "B" | "A" | "S";
|
|
@@ -27,265 +28,187 @@ type TierCounts = Record<Tier, number>;
|
|
|
27
28
|
type CostBasis = "receipts" | "estimated" | "unknown";
|
|
28
29
|
/** A column or row identity: an AgentProfile, a model, a judge, a search node. */
|
|
29
30
|
interface Setup {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
id: string;
|
|
32
|
+
label: string;
|
|
33
|
+
/** Null when the order is a sort, not a ranking backed by comparisons. */
|
|
34
|
+
rank: number | null;
|
|
34
35
|
}
|
|
35
36
|
/** One setup's rate. Field names follow the board record's `BoardProfile`. */
|
|
36
37
|
interface RateRow extends Setup {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
solved: number;
|
|
39
|
+
attempts: number;
|
|
40
|
+
rate: number;
|
|
41
|
+
/** The producer's label for what `attempts` supports; the library holds no threshold. */
|
|
42
|
+
estimate: Estimate;
|
|
43
|
+
interval: Interval | null;
|
|
44
|
+
tiers: TierCounts | null;
|
|
45
|
+
cost: {
|
|
46
|
+
perSolvedUsd: number | null;
|
|
47
|
+
basis: CostBasis;
|
|
48
|
+
receipts: number | null;
|
|
49
|
+
};
|
|
50
|
+
medianWallMs: number | null;
|
|
51
|
+
/** Null when the producer computed no frontier. */
|
|
52
|
+
onFront: boolean | null;
|
|
52
53
|
}
|
|
53
54
|
/** One task × setup cell. */
|
|
54
55
|
interface MatrixCell {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
task: string;
|
|
57
|
+
setup: string;
|
|
58
|
+
/** Attempts that count; null when the cell never ran. */
|
|
59
|
+
attempts: number | null;
|
|
60
|
+
/** Attempts that passed; null when no pass rule applies. */
|
|
61
|
+
solved: number | null;
|
|
62
|
+
/** Attempts graded on the App Grade ladder. */
|
|
63
|
+
tiers: TierCounts | null;
|
|
64
|
+
/** Attempts graded U: no floor check failed, but one could not be observed. */
|
|
65
|
+
unmeasured?: number;
|
|
66
|
+
/** Attempts whose grade failed an integrity check and awaits human review. */
|
|
67
|
+
flagged?: number;
|
|
68
|
+
/** A lens cell's mean score; null when the setup never scored the task. */
|
|
69
|
+
mean: number | null;
|
|
70
|
+
costUsd: number | null;
|
|
70
71
|
}
|
|
71
72
|
interface ComparisonRow {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
/** Setup ids. */
|
|
74
|
+
favored: string;
|
|
75
|
+
other: string;
|
|
76
|
+
pairs: number | null;
|
|
77
|
+
minimumEffect: number | null;
|
|
78
|
+
/** The clustered interval on the difference, in the measure's units. */
|
|
79
|
+
interval: Interval | null;
|
|
80
|
+
/** The exact interval, drawn under the clustered one when present. */
|
|
81
|
+
exactInterval: Interval | null;
|
|
81
82
|
}
|
|
82
83
|
interface BreakdownInput {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
84
|
+
reasons: string[];
|
|
85
|
+
setups: Array<{
|
|
86
|
+
id: string;
|
|
87
|
+
label: string;
|
|
88
|
+
n: number | null;
|
|
89
|
+
}>;
|
|
90
|
+
counts: Array<{
|
|
91
|
+
reason: string;
|
|
92
|
+
setup: string;
|
|
93
|
+
count: number | null;
|
|
94
|
+
}>;
|
|
95
|
+
excluded: {
|
|
96
|
+
count: number;
|
|
97
|
+
why: string;
|
|
98
|
+
} | null;
|
|
99
|
+
/** True when one attempt can count under several reasons. */
|
|
100
|
+
overlapping?: boolean;
|
|
100
101
|
}
|
|
101
102
|
/** Attempts left out of a figure, stated in its note. */
|
|
102
103
|
interface Exclusion {
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
count: number;
|
|
105
|
+
why: string;
|
|
105
106
|
}
|
|
106
107
|
interface Figure {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
108
|
+
id: string;
|
|
109
|
+
/** Generated from the input; no function accepts heading text. */
|
|
110
|
+
finding: string;
|
|
111
|
+
/** One quantified sentence. */
|
|
112
|
+
lede: string;
|
|
113
|
+
/** How to read the marks. */
|
|
114
|
+
read: string;
|
|
115
|
+
/** 720 px and 358 px renders; a null narrow render means the table is the phone view. */
|
|
116
|
+
svg: {
|
|
117
|
+
wide: string;
|
|
118
|
+
narrow: string | null;
|
|
119
|
+
};
|
|
120
|
+
/** An HTML table with every number the plot shows. */
|
|
121
|
+
table: string;
|
|
122
|
+
note: {
|
|
123
|
+
method: string;
|
|
124
|
+
n: string;
|
|
125
|
+
exclusions: string[];
|
|
126
|
+
};
|
|
126
127
|
}
|
|
127
128
|
interface Refusal {
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
id: string;
|
|
130
|
+
refused: string;
|
|
130
131
|
}
|
|
131
|
-
declare function isRefusal(value: Figure | Refusal): value is Refusal;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
*
|
|
136
|
-
* In order: the finding as a heading with a note reference, a one-sentence
|
|
137
|
-
* lede, the plot (both widths, swapped by `figure.css` on the figure's own
|
|
138
|
-
* width), a reading line, and the data table in a disclosure. Notes render
|
|
139
|
-
* once per page, numbered, each with a way back to its figure.
|
|
140
|
-
*/
|
|
141
|
-
|
|
142
|
-
declare function renderFigure(f: Figure, noteNumber: number): string;
|
|
132
|
+
export declare function isRefusal(value: Figure | Refusal): value is Refusal;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/block.d.ts
|
|
135
|
+
export declare function renderFigure(f: Figure, noteNumber: number): string;
|
|
143
136
|
/** Numbered notes for `figures`, in the order their blocks were numbered (1-based). */
|
|
144
|
-
declare function renderNotes(figures: Figure[]): string;
|
|
137
|
+
export declare function renderNotes(figures: Figure[]): string;
|
|
145
138
|
/** What a page leaves out, and why. */
|
|
146
|
-
declare function renderRefusals(refusals: Refusal[]): string;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
* `breakdown`: why attempts fail.
|
|
150
|
-
*
|
|
151
|
-
* Rows are reasons (a failure layer, cause or check); columns are setups with
|
|
152
|
-
* `n=` under each name. Each cell prints its count over a neutral tint of
|
|
153
|
-
* count / n, capped at 50% so ink keeps its contrast. The accent never marks a
|
|
154
|
-
* failure. On a phone the table is the view.
|
|
155
|
-
*
|
|
156
|
-
* Refuses: a share without its column n (the count prints with no tint);
|
|
157
|
-
* counting excluded attempts (they are stated in the note); hiding a zero.
|
|
158
|
-
*/
|
|
159
|
-
|
|
139
|
+
export declare function renderRefusals(refusals: Refusal[]): string;
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/breakdown.d.ts
|
|
160
142
|
interface BreakdownOptions {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
143
|
+
/** What a row counts, lower case: "failed checks". */
|
|
144
|
+
measure: string;
|
|
145
|
+
id?: string;
|
|
164
146
|
}
|
|
165
|
-
declare function breakdown(input: BreakdownInput, o: BreakdownOptions): Figure | Refusal;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
* `comparisonIntervals`: is each step in an order real.
|
|
169
|
-
*
|
|
170
|
-
* One row per comparison, "{favored} over {other}", with the pair count. x is
|
|
171
|
-
* the difference in points with a muted zero line. The clustered interval is a
|
|
172
|
-
* 6 px accent bar, the exact interval a 2 px muted bar under it, and a dashed
|
|
173
|
-
* ink tick marks the row's registered minimum effect. There is no point
|
|
174
|
-
* estimate, because the record carries none.
|
|
175
|
-
*
|
|
176
|
-
* Refuses: a row whose interval names no level or method, or that has no pair
|
|
177
|
-
* count or no registered minimum effect (each is listed in the note); the
|
|
178
|
-
* whole figure when no row can be drawn.
|
|
179
|
-
*/
|
|
180
|
-
|
|
147
|
+
export declare function breakdown(input: BreakdownInput, o: BreakdownOptions): Figure | Refusal;
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/comparison-intervals.d.ts
|
|
181
150
|
interface ComparisonIntervalsOptions {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
151
|
+
/** The measure the difference is in, lower case: "solve rate". */
|
|
152
|
+
measure: string;
|
|
153
|
+
id?: string;
|
|
185
154
|
}
|
|
186
|
-
declare function comparisonIntervals(rows: ComparisonRow[], setups: Setup[], o: ComparisonIntervalsOptions): Figure | Refusal;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
* `costFrontier`: which setup gives the most passes per dollar.
|
|
190
|
-
*
|
|
191
|
-
* y is the measure on a fixed 0–1 axis. x is cost per pass on a log
|
|
192
|
-
* scale, reversed so cheaper sits right and better is always up and right. A
|
|
193
|
-
* point on the producer's frontier is an accent disc; any other point is a
|
|
194
|
-
* hollow muted circle, and an estimated cost is never a filled disc. An ink
|
|
195
|
-
* line joins frontier points. Every point is labelled directly; a label that
|
|
196
|
-
* collides everywhere becomes a number listed in the table. A setup with no
|
|
197
|
-
* pass, an unknown cost or too few units for a rate is listed under the axis,
|
|
198
|
-
* never placed: a log axis has no origin, and a point's height is a rate. On a
|
|
199
|
-
* phone the plot becomes a list in rate order, with the same point marks, a
|
|
200
|
-
* rate bar and the cost as text.
|
|
201
|
-
*
|
|
202
|
-
* Refuses: the whole figure when fewer than two setups have both a cost per
|
|
203
|
-
* pass and enough units for a rate; the frontier line unless two or more
|
|
204
|
-
* plotted rows carry `onFront: true` (it never computes dominance itself).
|
|
205
|
-
*/
|
|
206
|
-
|
|
155
|
+
export declare function comparisonIntervals(rows: ComparisonRow[], setups: Setup[], o: ComparisonIntervalsOptions): Figure | Refusal;
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/cost-frontier.d.ts
|
|
207
158
|
interface CostFrontierOptions {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
159
|
+
/** The y measure, lower case: "solve rate". */
|
|
160
|
+
measure: string;
|
|
161
|
+
id?: string;
|
|
211
162
|
}
|
|
212
|
-
declare function costFrontier(rows: RateRow[], o: CostFrontierOptions): Figure | Refusal;
|
|
213
|
-
|
|
163
|
+
export declare function costFrontier(rows: RateRow[], o: CostFrontierOptions): Figure | Refusal;
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/css.generated.d.ts
|
|
214
166
|
/** The figure block and mark styles (src/figure.css), for documents that inline their CSS. */
|
|
215
|
-
declare const figureCss: string;
|
|
167
|
+
export declare const figureCss: string;
|
|
216
168
|
/** --chart-* resolved per theme, for documents without brand tokens: light, dark by preference or [data-theme="dark"], light in print. */
|
|
217
|
-
declare const chartTokensCss: string;
|
|
218
|
-
|
|
169
|
+
export declare const chartTokensCss: string;
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/format.d.ts
|
|
219
172
|
/**
|
|
220
173
|
* The order rows are drawn in. Ranked rows keep their rank. Otherwise rows
|
|
221
174
|
* with enough units to draw a rate come first, highest rate first; rows with
|
|
222
175
|
* too few units follow, most units first, so a 1/1 row never heads the list.
|
|
223
176
|
*/
|
|
224
|
-
declare function rateOrder<T extends Pick<RateRow, "rank" | "rate" | "estimate" | "attempts">>(rows: readonly T[]): T[];
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
* `rankedRates`: which setup passes most, and how uncertain is each rate.
|
|
228
|
-
*
|
|
229
|
-
* One row per setup: rank (only when every row is ranked), label, an accent
|
|
230
|
-
* bar on a shared 0–1 axis with an eligible interval as an ink whisker, `passed/n`,
|
|
231
|
-
* cost per pass and median run. An App Grade grader adds a tier strip under
|
|
232
|
-
* the bar with a tick at the pass tier. Bootstrap rows with ranks keep their order;
|
|
233
|
-
* unranked rows sort by rate, rows with too few units last, and the finding
|
|
234
|
-
* says no comparison backs the order.
|
|
235
|
-
*
|
|
236
|
-
* Refuses: a bar when the producer labels the estimate `none` or
|
|
237
|
-
* `insufficient` (the row prints its count only); a whisker whose interval
|
|
238
|
-
* names no level or method; a rank number unless every row carries one; any
|
|
239
|
-
* cost it was not given. It never prints "winner", "best" or "#1".
|
|
240
|
-
*/
|
|
241
|
-
|
|
177
|
+
export declare function rateOrder<T extends Pick<RateRow, "rank" | "rate" | "estimate" | "attempts">>(rows: readonly T[]): T[];
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/ranked-rates.d.ts
|
|
242
180
|
interface RankedRatesOptions {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
181
|
+
/** What the rate measures, lower case: "solve rate". */
|
|
182
|
+
measure: string;
|
|
183
|
+
/** The App Grade tier a pass needs; marks the tier strip. */
|
|
184
|
+
passTier?: Tier;
|
|
185
|
+
/** Singular, lower-case nouns: what one unit of `attempts` is, and what a row is. */
|
|
186
|
+
nouns?: {
|
|
187
|
+
attempt: string;
|
|
188
|
+
setup: string;
|
|
189
|
+
};
|
|
190
|
+
id?: string;
|
|
191
|
+
excluded?: Exclusion[];
|
|
254
192
|
}
|
|
255
|
-
declare function rankedRates(input: RateRow[], o: RankedRatesOptions): Figure | Refusal;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
* `taskMatrix`: where each setup succeeds and fails.
|
|
259
|
-
*
|
|
260
|
-
* Rows are tasks in the given (registered) order; columns are setups in rank
|
|
261
|
-
* order when every setup is ranked, otherwise in the given order. Each cell
|
|
262
|
-
* draws one 12 px tile per attempt, best first, then `solved/attempts`.
|
|
263
|
-
* App Grade tiles fill by tier and F is an outline; U (unable to measure) is a
|
|
264
|
-
* dashed outline and an integrity-flagged grade is a struck outline. Runner
|
|
265
|
-
* verification fills solved tiles with the accent. A lens matrix (`show:
|
|
266
|
-
* "means"`) prints each mean with a bar on one shared scale.
|
|
267
|
-
*
|
|
268
|
-
* Refuses: a fill for an attempt without a grade (outline with a dot); a zero
|
|
269
|
-
* for a cell that never ran ("·"); counts that do not add up; any column order
|
|
270
|
-
* but the given rank.
|
|
271
|
-
*/
|
|
272
|
-
|
|
193
|
+
export declare function rankedRates(input: RateRow[], o: RankedRatesOptions): Figure | Refusal;
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/task-matrix.d.ts
|
|
273
196
|
interface TaskMatrixOptions {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
197
|
+
/** The App Grade tier a pass needs; named in the legend. */
|
|
198
|
+
passTier?: Tier;
|
|
199
|
+
/** "attempts" draws a tile per attempt; "means" draws one tinted cell per mean. */
|
|
200
|
+
show?: "attempts" | "means";
|
|
201
|
+
/** Singular, lower-case nouns for rows, columns and one attempt. */
|
|
202
|
+
nouns?: {
|
|
203
|
+
task: string;
|
|
204
|
+
setup: string;
|
|
205
|
+
attempt?: string;
|
|
206
|
+
};
|
|
207
|
+
/** The columns grade the same attempts (judges on one set of plants): the finding reports agreement. */
|
|
208
|
+
agreement?: boolean;
|
|
209
|
+
id?: string;
|
|
210
|
+
excluded?: Exclusion[];
|
|
288
211
|
}
|
|
289
|
-
declare function taskMatrix(tasks: string[], setupsIn: Setup[], cells: MatrixCell[], o?: TaskMatrixOptions): Figure | Refusal;
|
|
290
|
-
|
|
291
|
-
export {
|
|
212
|
+
export declare function taskMatrix(tasks: string[], setupsIn: Setup[], cells: MatrixCell[], o?: TaskMatrixOptions): Figure | Refusal;
|
|
213
|
+
//#endregion
|
|
214
|
+
export type { BreakdownInput, BreakdownOptions, ComparisonIntervalsOptions, ComparisonRow, CostBasis, CostFrontierOptions, Estimate, Exclusion, Figure, Interval, IntervalMethod, MatrixCell, RankedRatesOptions, RateRow, Refusal, Setup, TaskMatrixOptions, Tier, TierCounts };
|