@figurestead/web 0.9.0-alpha.1 → 0.9.0-alpha.2
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 +179 -5
- package/THIRD_PARTY_NOTICES.md +12 -5
- package/package.json +42 -5
- package/src/accessibility.js +51 -11
- package/src/canvas-scene.js +12 -5
- package/src/clock.js +19 -8
- package/src/core-renderers.js +9 -3
- package/src/create-matrix-plot.js +86 -30
- package/src/export-bundle.js +1 -1
- package/src/extensions/temporal/shared.js +1 -1
- package/src/figure-layout.js +3 -2
- package/src/height-negotiation.js +77 -0
- package/src/layout.js +4 -2
- package/src/marks.js +2 -2
- package/src/paper-profile.js +5 -1
- package/src/renderers/scatter.js +3 -2
- package/src/resolved-scene.js +42 -3
- package/src/responsive-header.js +159 -0
- package/src/schema.js +32 -9
- package/src/scientific-layout.js +148 -0
- package/src/screen-legibility.js +30 -0
- package/src/statistics.js +21 -0
- package/src/svg-export.js +23 -8
- package/src/terminal-scene.js +2 -3
- package/themes/deep_observatory_sage_core.json +28 -0
- package/themes/lavender_fog_notebook.json +29 -0
- package/themes/midnight_transit_signal_slate.json +28 -0
- package/themes/registration_ink.json +28 -0
- package/themes/slipware.json +28 -0
- package/themes/ultraviolet_laboratory.json +29 -0
- package/types/extensions/temporal.d.ts +45 -0
- package/types/index.d.ts +640 -0
- package/types/theme-json.d.ts +4 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public TypeScript surface for @figurestead/web.
|
|
3
|
+
*
|
|
4
|
+
* These declarations describe the current browser contract structurally.
|
|
5
|
+
* Runtime validation remains authoritative for semantic constraints such as
|
|
6
|
+
* finite numbers, ordered domains, canonical #RRGGBB colors, and data-array
|
|
7
|
+
* cardinality.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type CanonicalColor = string;
|
|
11
|
+
export type FiguresteadSchemaVersion = "0.4";
|
|
12
|
+
export type RendererApiVersion = "1";
|
|
13
|
+
export type ApplicationProfileKey = "paper" | "atlas" | "talk";
|
|
14
|
+
export type MotionMode = "none" | "semantic" | "legacy";
|
|
15
|
+
export type AmbientMode = "none" | "matrix";
|
|
16
|
+
export type MotionStrategy = "auto" | "none" | "reveal" | "points_then_connect" | "bar_grow" | "matrix_illuminate";
|
|
17
|
+
export type MarkerGlyph = "ring" | "square" | "triangle" | "diamond";
|
|
18
|
+
export type LineStyle = "solid" | "dash" | "dot" | "dash-dot";
|
|
19
|
+
export type HatchStyle = "none" | "diag" | "cross" | "vertical";
|
|
20
|
+
export type LegendPosition = "auto" | "top-right" | "top-left" | "bottom-right" | "bottom-left" | "outside-right" | "none";
|
|
21
|
+
export type CurveType = "linear" | "monotone";
|
|
22
|
+
export type LifecycleState = "playing" | "paused" | "complete";
|
|
23
|
+
export type UnknownRecord = Record<string, unknown>;
|
|
24
|
+
|
|
25
|
+
export interface FiguresteadTheme {
|
|
26
|
+
key: string;
|
|
27
|
+
name: string;
|
|
28
|
+
field: CanonicalColor;
|
|
29
|
+
panel: CanonicalColor;
|
|
30
|
+
grid: CanonicalColor;
|
|
31
|
+
spine: CanonicalColor;
|
|
32
|
+
label: CanonicalColor;
|
|
33
|
+
secondary: CanonicalColor;
|
|
34
|
+
faint: CanonicalColor;
|
|
35
|
+
primary: CanonicalColor;
|
|
36
|
+
summaryCore: CanonicalColor;
|
|
37
|
+
warm: CanonicalColor;
|
|
38
|
+
series: CanonicalColor[];
|
|
39
|
+
primaryEdge?: CanonicalColor;
|
|
40
|
+
summaryEdge?: CanonicalColor;
|
|
41
|
+
seriesEdges?: CanonicalColor[];
|
|
42
|
+
mode?: ApplicationProfileKey;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ThemePack {
|
|
46
|
+
schemaVersion: "figurestead.theme-pack/1";
|
|
47
|
+
name: string;
|
|
48
|
+
themes: Record<string, FiguresteadTheme>;
|
|
49
|
+
drafts?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface AuthoredFiguresteadTheme {
|
|
53
|
+
key?: string;
|
|
54
|
+
name: string;
|
|
55
|
+
field: CanonicalColor;
|
|
56
|
+
panel: CanonicalColor;
|
|
57
|
+
grid: CanonicalColor;
|
|
58
|
+
spine: CanonicalColor;
|
|
59
|
+
label: CanonicalColor;
|
|
60
|
+
secondary: CanonicalColor;
|
|
61
|
+
faint: CanonicalColor;
|
|
62
|
+
primary: CanonicalColor;
|
|
63
|
+
summaryCore?: CanonicalColor;
|
|
64
|
+
summary_core?: CanonicalColor;
|
|
65
|
+
warm: CanonicalColor;
|
|
66
|
+
series: CanonicalColor[];
|
|
67
|
+
primaryEdge?: CanonicalColor;
|
|
68
|
+
primary_edge?: CanonicalColor;
|
|
69
|
+
summaryEdge?: CanonicalColor;
|
|
70
|
+
summary_edge?: CanonicalColor;
|
|
71
|
+
seriesEdges?: CanonicalColor[];
|
|
72
|
+
series_edges?: CanonicalColor[];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface AuthoredThemePack {
|
|
76
|
+
schemaVersion?: "figurestead.theme-pack/1";
|
|
77
|
+
schema_version?: "figurestead.theme-pack/1";
|
|
78
|
+
name: string;
|
|
79
|
+
themes: Record<string, AuthoredFiguresteadTheme>;
|
|
80
|
+
drafts?: Record<string, unknown>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface FiguresteadProfile {
|
|
84
|
+
key: string;
|
|
85
|
+
name: string;
|
|
86
|
+
marker: string;
|
|
87
|
+
markerSize: number;
|
|
88
|
+
markerAlpha: number;
|
|
89
|
+
edgeWidth: number;
|
|
90
|
+
coreFraction: number;
|
|
91
|
+
gridAlpha: number;
|
|
92
|
+
pointGlow: boolean;
|
|
93
|
+
gridX: boolean;
|
|
94
|
+
gridY: boolean;
|
|
95
|
+
summaryGlow: boolean;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type TimelineWindow = [number, number];
|
|
99
|
+
|
|
100
|
+
export interface FiguresteadTimeline {
|
|
101
|
+
rainIn: TimelineWindow;
|
|
102
|
+
marksEnter: TimelineWindow;
|
|
103
|
+
summaryCompiles: TimelineWindow;
|
|
104
|
+
rainOut: TimelineWindow;
|
|
105
|
+
settle: TimelineWindow;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface FiguresteadMotion {
|
|
109
|
+
durationMs: number;
|
|
110
|
+
lightingPeak: number;
|
|
111
|
+
trailAlpha: number;
|
|
112
|
+
frames: number;
|
|
113
|
+
fps: number;
|
|
114
|
+
rainStreams: number;
|
|
115
|
+
rainGlyphs: number;
|
|
116
|
+
seed: number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface FiguresteadSpec {
|
|
120
|
+
title: string;
|
|
121
|
+
subtitle?: string;
|
|
122
|
+
xLabel?: string;
|
|
123
|
+
yLabel?: string;
|
|
124
|
+
note?: string;
|
|
125
|
+
signature?: string;
|
|
126
|
+
description?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface PanelSpec {
|
|
130
|
+
title?: string;
|
|
131
|
+
subtitle?: string;
|
|
132
|
+
xLabel?: string;
|
|
133
|
+
yLabel?: string;
|
|
134
|
+
note?: string;
|
|
135
|
+
signature?: string;
|
|
136
|
+
description?: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface FiguresteadLayout {
|
|
140
|
+
type: "grid";
|
|
141
|
+
columns: number;
|
|
142
|
+
gap: number;
|
|
143
|
+
sharedX: boolean;
|
|
144
|
+
sharedY: boolean;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface FiguresteadView {
|
|
148
|
+
profile: ApplicationProfileKey;
|
|
149
|
+
motion: MotionMode;
|
|
150
|
+
ambient: AmbientMode;
|
|
151
|
+
strategy: MotionStrategy;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface SeriesStyleOverride {
|
|
155
|
+
colorIndex?: number;
|
|
156
|
+
color?: CanonicalColor;
|
|
157
|
+
edge?: CanonicalColor | null;
|
|
158
|
+
glyph?: MarkerGlyph;
|
|
159
|
+
lineStyle?: LineStyle;
|
|
160
|
+
hatch?: HatchStyle;
|
|
161
|
+
lineWidth?: number;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface FiguresteadStyle {
|
|
165
|
+
glyphs: MarkerGlyph[];
|
|
166
|
+
lineStyles: LineStyle[];
|
|
167
|
+
series: Record<string, SeriesStyleOverride>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface LinearScaleSpec {
|
|
171
|
+
type: "linear";
|
|
172
|
+
domain?: [number, number] | null;
|
|
173
|
+
label?: string;
|
|
174
|
+
nice?: boolean;
|
|
175
|
+
padding?: number;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface TimeScaleSpec {
|
|
179
|
+
type: "time";
|
|
180
|
+
domain?: [number | string, number | string] | null;
|
|
181
|
+
label?: string;
|
|
182
|
+
nice?: boolean;
|
|
183
|
+
padding?: number;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface BandScaleSpec {
|
|
187
|
+
type: "band";
|
|
188
|
+
domain?: string[] | null;
|
|
189
|
+
label?: string;
|
|
190
|
+
nice?: boolean;
|
|
191
|
+
padding?: number;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export type ScaleSpec = LinearScaleSpec | TimeScaleSpec | BandScaleSpec;
|
|
195
|
+
|
|
196
|
+
export interface PanelPresentation {
|
|
197
|
+
panelSurface?: boolean;
|
|
198
|
+
frame?: boolean;
|
|
199
|
+
curve?: CurveType;
|
|
200
|
+
legend?: LegendPosition;
|
|
201
|
+
lineWidth?: number;
|
|
202
|
+
markerScale?: number;
|
|
203
|
+
seriesMarkers?: MarkerGlyph[];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface PanelEncoding {
|
|
207
|
+
interpolation?: CurveType;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface LineSeries {
|
|
211
|
+
key: string;
|
|
212
|
+
label?: string;
|
|
213
|
+
y: number[];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface LineData {
|
|
217
|
+
x: number[];
|
|
218
|
+
series: LineSeries[];
|
|
219
|
+
revealOrder?: "random" | "x";
|
|
220
|
+
xDomain?: [number, number] | null;
|
|
221
|
+
yDomain?: [number, number] | null;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface ScatterData {
|
|
225
|
+
x: number[];
|
|
226
|
+
y: number[];
|
|
227
|
+
series?: Array<string | number>;
|
|
228
|
+
seriesLabels?: Record<string, string>;
|
|
229
|
+
summary?: "linear_fit" | null;
|
|
230
|
+
xDomain?: [number, number] | null;
|
|
231
|
+
yDomain?: [number, number] | null;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export interface StripSummaryData {
|
|
235
|
+
groups: Array<string | number>;
|
|
236
|
+
values: number[];
|
|
237
|
+
group: Array<string | number>;
|
|
238
|
+
series?: Array<string | number>;
|
|
239
|
+
seriesLabels?: Record<string, string>;
|
|
240
|
+
summary?: "median" | null;
|
|
241
|
+
yDomain?: [number, number] | null;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface FiguresteadPanelBase<R extends string, D> {
|
|
245
|
+
id?: string;
|
|
246
|
+
renderer: R;
|
|
247
|
+
spec?: PanelSpec;
|
|
248
|
+
xScale?: ScaleSpec;
|
|
249
|
+
yScale?: ScaleSpec;
|
|
250
|
+
annotations?: unknown[];
|
|
251
|
+
presentation?: PanelPresentation;
|
|
252
|
+
encoding?: PanelEncoding;
|
|
253
|
+
data: D;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export type LinePanel = FiguresteadPanelBase<"line", LineData>;
|
|
257
|
+
export type ScatterPanel = FiguresteadPanelBase<"scatter", ScatterData>;
|
|
258
|
+
export type StripSummaryPanel = FiguresteadPanelBase<"strip_summary", StripSummaryData>;
|
|
259
|
+
export type CoreFiguresteadPanel = LinePanel | ScatterPanel | StripSummaryPanel;
|
|
260
|
+
export type FiguresteadPanel<R extends string = string, D = unknown> = FiguresteadPanelBase<R, D>;
|
|
261
|
+
|
|
262
|
+
export interface FiguresteadContract<P extends FiguresteadPanel = CoreFiguresteadPanel> {
|
|
263
|
+
schemaVersion: FiguresteadSchemaVersion;
|
|
264
|
+
rendererApiVersion: RendererApiVersion;
|
|
265
|
+
theme: FiguresteadTheme;
|
|
266
|
+
profile: FiguresteadProfile;
|
|
267
|
+
timeline: FiguresteadTimeline;
|
|
268
|
+
motion: FiguresteadMotion;
|
|
269
|
+
style: FiguresteadStyle;
|
|
270
|
+
spec: FiguresteadSpec;
|
|
271
|
+
layout: FiguresteadLayout;
|
|
272
|
+
view: FiguresteadView;
|
|
273
|
+
panels: P[];
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface LegacyFiguresteadContract {
|
|
277
|
+
schemaVersion: "0.3";
|
|
278
|
+
renderer: "line" | "scatter" | "strip_summary";
|
|
279
|
+
data: LineData | ScatterData | StripSummaryData;
|
|
280
|
+
theme: FiguresteadTheme;
|
|
281
|
+
profile: FiguresteadProfile;
|
|
282
|
+
timeline: FiguresteadTimeline;
|
|
283
|
+
motion: FiguresteadMotion;
|
|
284
|
+
spec: FiguresteadSpec;
|
|
285
|
+
view?: Partial<FiguresteadView>;
|
|
286
|
+
style?: Partial<FiguresteadStyle>;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface AccessibilityOptions {
|
|
290
|
+
visible?: boolean;
|
|
291
|
+
table?: boolean;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface FiguresteadDrawErrorContext {
|
|
295
|
+
phase: "draw";
|
|
296
|
+
progress: number;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface FiguresteadHeightNegotiationErrorContext {
|
|
300
|
+
phase: "height-negotiation";
|
|
301
|
+
operation: "baseline" | "request";
|
|
302
|
+
width: number;
|
|
303
|
+
baselineHeight: number | null;
|
|
304
|
+
preferredHeight: number | null;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export type FiguresteadRuntimeErrorContext = FiguresteadDrawErrorContext | FiguresteadHeightNegotiationErrorContext;
|
|
308
|
+
|
|
309
|
+
export interface FiguresteadHeightBaselineContext {
|
|
310
|
+
readonly canvas: HTMLCanvasElement;
|
|
311
|
+
readonly width: number;
|
|
312
|
+
readonly currentHeight: number;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export interface FiguresteadPreferredHeightRequest {
|
|
316
|
+
readonly preferredHeight: number;
|
|
317
|
+
readonly baselineHeight: number;
|
|
318
|
+
readonly width: number;
|
|
319
|
+
readonly signal: AbortSignal;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export interface FiguresteadHeightNegotiationAdapter {
|
|
323
|
+
getBaselineHeight(context: FiguresteadHeightBaselineContext): number | null;
|
|
324
|
+
requestPreferredHeight(request: FiguresteadPreferredHeightRequest): void;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export interface RendererDescription {
|
|
328
|
+
summary: string;
|
|
329
|
+
headers: unknown[];
|
|
330
|
+
rows: unknown[][];
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface RendererEnvironment {
|
|
334
|
+
contract: UnknownRecord;
|
|
335
|
+
prepared: unknown;
|
|
336
|
+
layout: UnknownRecord;
|
|
337
|
+
domains: UnknownRecord;
|
|
338
|
+
progress: number;
|
|
339
|
+
settled: boolean;
|
|
340
|
+
panel: FiguresteadPanel;
|
|
341
|
+
figure: FiguresteadContract<FiguresteadPanel>;
|
|
342
|
+
[key: string]: unknown;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export interface RendererDefinition<D = unknown, Prepared = unknown> {
|
|
346
|
+
key: string;
|
|
347
|
+
family?: string;
|
|
348
|
+
apiVersion: RendererApiVersion;
|
|
349
|
+
validateData(data: unknown, path?: string): D;
|
|
350
|
+
prepare(contract: UnknownRecord): Prepared;
|
|
351
|
+
draw(context: CanvasRenderingContext2D, environment: RendererEnvironment): unknown;
|
|
352
|
+
describe(contract: UnknownRecord, prepared?: Prepared): RendererDescription;
|
|
353
|
+
domains?(contract: UnknownRecord, prepared: Prepared): UnknownRecord;
|
|
354
|
+
compileScene?(context: UnknownRecord): UnknownRecord;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export interface RendererRegistry {
|
|
358
|
+
readonly apiVersion: RendererApiVersion;
|
|
359
|
+
get(key: string): RendererDefinition | null;
|
|
360
|
+
has(key: string): boolean;
|
|
361
|
+
keys(): readonly string[];
|
|
362
|
+
definitions(): readonly RendererDefinition[];
|
|
363
|
+
with(...definitions: Array<RendererDefinition | RendererDefinition[]>): RendererRegistry;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface CreateFiguresteadOptions {
|
|
367
|
+
registry?: RendererRegistry;
|
|
368
|
+
reducedMotion?: boolean | null;
|
|
369
|
+
accessibility?: AccessibilityOptions;
|
|
370
|
+
autoplay?: boolean;
|
|
371
|
+
dprCap?: number;
|
|
372
|
+
onProgress?: (progress: number) => void;
|
|
373
|
+
onState?: (state: LifecycleState) => void;
|
|
374
|
+
onError?: (error: unknown, context: FiguresteadRuntimeErrorContext) => void;
|
|
375
|
+
heightNegotiation?: FiguresteadHeightNegotiationAdapter;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export interface FiguresteadState {
|
|
379
|
+
progress: number;
|
|
380
|
+
playing: boolean;
|
|
381
|
+
reducedMotion: boolean;
|
|
382
|
+
runtimeFailed: boolean;
|
|
383
|
+
renderers: string[];
|
|
384
|
+
sceneVersion: string;
|
|
385
|
+
resolvedSceneVersion: string;
|
|
386
|
+
composedSceneVersion: string;
|
|
387
|
+
profile: ApplicationProfileKey;
|
|
388
|
+
destroyed: boolean;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export interface FiguresteadPointCoordinate {
|
|
392
|
+
x: number | undefined;
|
|
393
|
+
y: number | undefined;
|
|
394
|
+
dataX: unknown;
|
|
395
|
+
dataY: unknown;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export interface FiguresteadPanelCoordinates {
|
|
399
|
+
panelId: string;
|
|
400
|
+
points: FiguresteadPointCoordinate[];
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
export interface TerminalScene extends UnknownRecord {
|
|
404
|
+
schemaVersion: "figurestead.scene/1";
|
|
405
|
+
contractSchemaVersion: string;
|
|
406
|
+
rendererApiVersion: string;
|
|
407
|
+
panels: readonly UnknownRecord[];
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export interface ResolvedScene extends UnknownRecord {
|
|
411
|
+
schemaVersion: "figurestead.resolved-scene/1";
|
|
412
|
+
panels: readonly UnknownRecord[];
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export interface ComposedScene extends UnknownRecord {
|
|
416
|
+
schemaVersion: "figurestead.composed-scene/1";
|
|
417
|
+
panels: readonly UnknownRecord[];
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export interface FiguresteadController<P extends FiguresteadPanel = CoreFiguresteadPanel> {
|
|
421
|
+
play(): void;
|
|
422
|
+
pause(): void;
|
|
423
|
+
replay(): void;
|
|
424
|
+
setData(data: unknown): void;
|
|
425
|
+
setConfig(next: FiguresteadContract<P>): void;
|
|
426
|
+
setReducedMotion(value: boolean | null): void;
|
|
427
|
+
resize(): void;
|
|
428
|
+
destroy(): void;
|
|
429
|
+
getState(): FiguresteadState;
|
|
430
|
+
getScene(): TerminalScene;
|
|
431
|
+
getResolvedScene(): ResolvedScene;
|
|
432
|
+
getComposedScene(): ComposedScene;
|
|
433
|
+
getFinalCoordinates(): FiguresteadPanelCoordinates[];
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export class FiguresteadConfigError extends Error {
|
|
437
|
+
constructor(message: string, path?: string);
|
|
438
|
+
path: string;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export function createFigurestead<P extends FiguresteadPanel = CoreFiguresteadPanel>(canvas: HTMLCanvasElement, input: FiguresteadContract<P>, options?: CreateFiguresteadOptions): FiguresteadController<P>;
|
|
442
|
+
export function validateContract<P extends FiguresteadPanel = CoreFiguresteadPanel>(input: FiguresteadContract<P> | LegacyFiguresteadContract, registry?: RendererRegistry | null): FiguresteadContract<P>;
|
|
443
|
+
|
|
444
|
+
export const SCHEMA_VERSION: "0.4";
|
|
445
|
+
export const LEGACY_SCHEMA_VERSION: "0.3";
|
|
446
|
+
export const RENDERER_API_VERSION: "1";
|
|
447
|
+
export const CORE_REGISTRY: RendererRegistry;
|
|
448
|
+
export const CORE_RENDERERS: readonly RendererDefinition[];
|
|
449
|
+
export function defineRenderer<D = unknown, Prepared = unknown>(definition: RendererDefinition<D, Prepared>): Readonly<RendererDefinition<D, Prepared>>;
|
|
450
|
+
export function createRendererRegistry(definitions?: RendererDefinition[]): RendererRegistry;
|
|
451
|
+
|
|
452
|
+
export interface FiguresteadRect { left: number; top: number; right: number; bottom: number }
|
|
453
|
+
export interface FiguresteadLayoutResult extends UnknownRecord { width: number; height: number; panels: readonly UnknownRecord[] }
|
|
454
|
+
export function deriveFigureLayout(width: number, height: number, contract: FiguresteadContract<FiguresteadPanel>): FiguresteadLayoutResult;
|
|
455
|
+
|
|
456
|
+
export interface ContinuousScale { (value: number): number }
|
|
457
|
+
export interface BandScale { (value: string | number): number | undefined; bandwidth(): number; step(): number; domain(): string[] }
|
|
458
|
+
export function linearScale(domain: readonly number[], range: readonly number[]): ContinuousScale;
|
|
459
|
+
export function timeScale(domain: readonly (number | string | Date)[], range: readonly number[]): ContinuousScale;
|
|
460
|
+
export function bandScale(domain: readonly string[], range: readonly number[], options?: { padding?: number }): BandScale;
|
|
461
|
+
export function parseTime(value: number | string | Date, path?: string): number;
|
|
462
|
+
export function timeTicks(domain: readonly (number | string | Date)[], count?: number): number[];
|
|
463
|
+
export function formatTimeTick(value: number | string | Date, domain?: readonly (number | string | Date)[] | null): string;
|
|
464
|
+
|
|
465
|
+
export interface RulePrimitive { x1: number; y1: number; x2: number; y2: number; color: string; alpha?: number; width?: number; dash?: number[] }
|
|
466
|
+
export interface RectPrimitive { left: number; top: number; right: number; bottom: number; color: string; alpha?: number }
|
|
467
|
+
export function drawRule(context: CanvasRenderingContext2D, options: RulePrimitive): void;
|
|
468
|
+
export function drawBand(context: CanvasRenderingContext2D, options: RectPrimitive): void;
|
|
469
|
+
export function drawBar(context: CanvasRenderingContext2D, options: RectPrimitive & { stroke?: string | null; lineWidth?: number }): void;
|
|
470
|
+
export function drawInterval(context: CanvasRenderingContext2D, options: { x1: number; x2: number; y: number; color: string; alpha?: number; width?: number; cap?: number }): void;
|
|
471
|
+
export function drawCell(context: CanvasRenderingContext2D, options: RectPrimitive & { stroke?: string | null }): void;
|
|
472
|
+
|
|
473
|
+
export interface RendererConformanceResult { readonly ok: boolean; readonly errors: readonly string[] }
|
|
474
|
+
export function rendererConformance(definition: RendererDefinition, contract: UnknownRecord): RendererConformanceResult;
|
|
475
|
+
export function assertRendererConformance(definition: RendererDefinition, contract: UnknownRecord): RendererConformanceResult;
|
|
476
|
+
|
|
477
|
+
export interface PreparedPoint { x: number; y: number; series?: string; index?: number; [key: string]: unknown }
|
|
478
|
+
export interface PreparedRendererData extends UnknownRecord { points: PreparedPoint[] }
|
|
479
|
+
export function prepareLine(contract: UnknownRecord): PreparedRendererData;
|
|
480
|
+
export function lineSegmentState(left: PreparedPoint, right: PreparedPoint, progress: number, interpolation?: CurveType): UnknownRecord;
|
|
481
|
+
export function prepareScatter(contract: UnknownRecord): PreparedRendererData;
|
|
482
|
+
export function prepareStrip(contract: UnknownRecord): PreparedRendererData;
|
|
483
|
+
|
|
484
|
+
export const SCIENTIFIC_POSE: Readonly<PanelPresentation>;
|
|
485
|
+
export interface ScientificPoseFocus { panelId: string; label: string; anchorId?: string; x?: number; y?: number; space?: "plot" | "data"; dx?: number; dy?: number }
|
|
486
|
+
export interface ScientificPoseOptions extends PanelPresentation { focus?: ScientificPoseFocus[] }
|
|
487
|
+
export function applyScientificPose<C extends FiguresteadContract<FiguresteadPanel>>(input: C, options?: ScientificPoseOptions): C;
|
|
488
|
+
export function applyEvidencePose<C extends FiguresteadContract<FiguresteadPanel>>(input: C, options?: ScientificPoseOptions): C;
|
|
489
|
+
|
|
490
|
+
export interface ApplicationProfile {
|
|
491
|
+
key: ApplicationProfileKey | string;
|
|
492
|
+
name: string;
|
|
493
|
+
surface: string;
|
|
494
|
+
density: string;
|
|
495
|
+
typography: string;
|
|
496
|
+
legend: string;
|
|
497
|
+
ambient: string;
|
|
498
|
+
motion: string;
|
|
499
|
+
lineWidth: number;
|
|
500
|
+
markerScale: number;
|
|
501
|
+
panelSurface: boolean;
|
|
502
|
+
frame: boolean;
|
|
503
|
+
}
|
|
504
|
+
export const APPLICATION_PROFILE_VERSION: "figurestead.application-profile/1";
|
|
505
|
+
export const APPLICATION_PROFILES: Readonly<Record<ApplicationProfileKey, Readonly<ApplicationProfile>>>;
|
|
506
|
+
export function resolveApplicationProfile(value?: ApplicationProfileKey | ApplicationProfile): Readonly<ApplicationProfile>;
|
|
507
|
+
export function applyApplicationProfile<C extends FiguresteadContract<FiguresteadPanel>>(input: C, profile?: ApplicationProfileKey | ApplicationProfile, options?: UnknownRecord): C;
|
|
508
|
+
|
|
509
|
+
export const APPEARANCE_VERSION: "figurestead.appearance/1";
|
|
510
|
+
export interface ComposeAppearanceOptions extends UnknownRecord { profile?: ApplicationProfileKey | ApplicationProfile; palettePack?: PalettePack; paletteKey?: string; mode?: ApplicationProfileKey; themePack?: ThemePack; themeKey?: string; theme?: FiguresteadTheme }
|
|
511
|
+
export function composeAppearance<C extends FiguresteadContract<FiguresteadPanel>>(input: C, options?: ComposeAppearanceOptions): C;
|
|
512
|
+
|
|
513
|
+
export interface ResolvedSeriesStyle extends SeriesStyleOverride { key: string; colorIndex: number; color: CanonicalColor; edge: CanonicalColor | null; glyph: MarkerGlyph; lineStyle: LineStyle; hatch: HatchStyle; lineWidth: number }
|
|
514
|
+
export const SERIES_STYLE_VERSION: "figurestead.series-style/1";
|
|
515
|
+
export const GLYPH_CYCLE: readonly MarkerGlyph[];
|
|
516
|
+
export const LINE_STYLE_CYCLE: readonly LineStyle[];
|
|
517
|
+
export const HATCH_CYCLE: readonly HatchStyle[];
|
|
518
|
+
export function collectSeriesKeys(contract: FiguresteadContract<FiguresteadPanel>): string[];
|
|
519
|
+
export function resolveSeriesStyles(contract: FiguresteadContract<FiguresteadPanel>): Readonly<Record<string, Readonly<ResolvedSeriesStyle>>>;
|
|
520
|
+
export function styleForSeries(environment: UnknownRecord, key: string, fallbackIndex?: number): ResolvedSeriesStyle;
|
|
521
|
+
|
|
522
|
+
export const TERMINAL_SCENE_VERSION: "figurestead.scene/1";
|
|
523
|
+
export function compileFigureModel(input: FiguresteadContract<FiguresteadPanel>, options?: { registry?: RendererRegistry }): Readonly<{ contract: FiguresteadContract<FiguresteadPanel>; scene: TerminalScene; preparedPanels: readonly UnknownRecord[]; domains: readonly UnknownRecord[] }>;
|
|
524
|
+
export function compileTerminalScene(input: FiguresteadContract<FiguresteadPanel>, options?: { registry?: RendererRegistry }): TerminalScene;
|
|
525
|
+
export function terminalEvidence(scene: TerminalScene): UnknownRecord[];
|
|
526
|
+
export function canonicalTerminalEvidence(scene: TerminalScene): UnknownRecord;
|
|
527
|
+
export function evidenceFingerprint(scene: TerminalScene): string;
|
|
528
|
+
|
|
529
|
+
export const RESOLVED_SCENE_VERSION: "figurestead.resolved-scene/1";
|
|
530
|
+
export const RESOLVED_RENDERERS: readonly string[];
|
|
531
|
+
export function isResolvedRenderer(renderer: string): boolean;
|
|
532
|
+
export function resolveTerminalScene(scene: TerminalScene, options?: { width?: number; height?: number; measureText?: (text: string, fontSize: number) => { width: number; ascent?: number; descent?: number } }): ResolvedScene;
|
|
533
|
+
export function resolveSceneFrame(scene: ResolvedScene, progress?: number): ResolvedScene;
|
|
534
|
+
export function resolveSceneFrame(scene: ComposedScene, progress?: number): ComposedScene;
|
|
535
|
+
export function resolvedTerminalGeometry(scene: ResolvedScene | ComposedScene): UnknownRecord[];
|
|
536
|
+
|
|
537
|
+
export const COMPOSED_SCENE_VERSION: "figurestead.composed-scene/1";
|
|
538
|
+
export function auditComposition(scene: ResolvedScene): Readonly<UnknownRecord>;
|
|
539
|
+
export function composeResolvedScene(scene: ResolvedScene): ComposedScene;
|
|
540
|
+
|
|
541
|
+
export interface MotionState { opacity: number; translateX: number; translateY: number; scaleX: number; scaleY: number; clip: number; glow: number }
|
|
542
|
+
export type MotionChannel = "opacity" | "translate" | "scale" | "clip" | "glow";
|
|
543
|
+
export const MOTION_PLAN_VERSION: "figurestead.motion-plan/1";
|
|
544
|
+
export const ALLOWED_MOTION_CHANNELS: readonly MotionChannel[];
|
|
545
|
+
export const TERMINAL_MOTION_STATE: Readonly<MotionState>;
|
|
546
|
+
export function strategyForRenderer(renderer: string, requested?: MotionStrategy): MotionStrategy;
|
|
547
|
+
export function compileMotionPlan(scene: TerminalScene, view?: Partial<FiguresteadView>): Readonly<UnknownRecord>;
|
|
548
|
+
export function markMotionState(mark: UnknownRecord, index: number, count: number, progress: number, strategy?: MotionStrategy): MotionState;
|
|
549
|
+
export function assertTerminalMotionIdentity(plan: UnknownRecord, scene: TerminalScene): true;
|
|
550
|
+
|
|
551
|
+
export interface ExportSizeOptions {
|
|
552
|
+
width?: number;
|
|
553
|
+
height?: number;
|
|
554
|
+
paperSize?: "paper-single" | "paper-double";
|
|
555
|
+
physicalWidthMm?: number;
|
|
556
|
+
minLabelPt?: number;
|
|
557
|
+
}
|
|
558
|
+
export interface SvgExportOptions extends ExportSizeOptions { registry?: RendererRegistry; idPrefix?: string; sourceScene?: TerminalScene; exportSize?: ExportSize }
|
|
559
|
+
export function exportFigureSvg(input: FiguresteadContract<FiguresteadPanel> | TerminalScene, options?: SvgExportOptions): string;
|
|
560
|
+
export function sceneToSvg(scene: TerminalScene, options?: SvgExportOptions): string;
|
|
561
|
+
export function resolvedSceneToSvg(scene: ResolvedScene | ComposedScene, options?: SvgExportOptions): string;
|
|
562
|
+
|
|
563
|
+
export const EXPORT_MANIFEST_VERSION: "figurestead.export-manifest/1";
|
|
564
|
+
export const FIGURESTEAD_PACKAGE_VERSION: string;
|
|
565
|
+
export interface FigureArtifacts { readonly scene: TerminalScene; readonly resolved: ResolvedScene; readonly composed: ComposedScene; readonly svg: string; readonly sceneJson: string; readonly geometryJson: string; readonly manifest: Readonly<UnknownRecord>; readonly manifestJson: string }
|
|
566
|
+
export function exportFigureArtifacts(input: FiguresteadContract<FiguresteadPanel> | TerminalScene, options?: SvgExportOptions): FigureArtifacts;
|
|
567
|
+
export function canvasToPngBlob(canvas: HTMLCanvasElement, options?: { quality?: number }): Promise<Blob>;
|
|
568
|
+
export function stableStringify(value: unknown, space?: number): string;
|
|
569
|
+
|
|
570
|
+
export interface MotionRecipe { key: string; name: string; motion: MotionMode; ambient: AmbientMode; strategy: MotionStrategy; durationMs: number; lightingPeak: number }
|
|
571
|
+
export const MOTION_RECIPE_VERSION: "figurestead.motion-recipe/1";
|
|
572
|
+
export const MOTION_RECIPES: Readonly<Record<"static" | "restrained" | "expressive" | "matrix_origin", Readonly<MotionRecipe>>>;
|
|
573
|
+
export function resolveMotionRecipe(value?: keyof typeof MOTION_RECIPES | MotionRecipe): Readonly<MotionRecipe>;
|
|
574
|
+
export function applyMotionRecipe<C extends FiguresteadContract<FiguresteadPanel>>(input: C, recipe?: keyof typeof MOTION_RECIPES | MotionRecipe): C;
|
|
575
|
+
|
|
576
|
+
export interface ThemeCatalog { readonly schemaVersion: "figurestead.theme-catalog/1"; readonly name: string; readonly themes: Readonly<Record<string, FiguresteadTheme>>; readonly sources: Readonly<Record<string, string>> }
|
|
577
|
+
export const THEME_CATALOG_VERSION: "figurestead.theme-catalog/1";
|
|
578
|
+
export function mergeThemePacks(packs: ThemePack[], options?: { name?: string }): ThemeCatalog;
|
|
579
|
+
export function auditThemeCatalog(catalog: ThemeCatalog): Readonly<{ themes: readonly UnknownRecord[]; total: number; warnings: number; clean: boolean }>;
|
|
580
|
+
export function catalogThemePack(catalog: ThemeCatalog): ThemePack;
|
|
581
|
+
|
|
582
|
+
export class AnimationClock {
|
|
583
|
+
constructor(options: { durationMs: number; draw: (progress: number) => void; onState?: (state: LifecycleState) => void; onError?: (error: unknown, context: FiguresteadRuntimeErrorContext) => void; raf?: (callback: FrameRequestCallback) => number; cancel?: (handle: number) => void });
|
|
584
|
+
durationMs: number;
|
|
585
|
+
progress: number;
|
|
586
|
+
playing: boolean;
|
|
587
|
+
destroyed: boolean;
|
|
588
|
+
failed: boolean;
|
|
589
|
+
render(progress?: number): boolean;
|
|
590
|
+
play(): void;
|
|
591
|
+
pause(): void;
|
|
592
|
+
replay(): void;
|
|
593
|
+
settle(): void;
|
|
594
|
+
resetFailure(): void;
|
|
595
|
+
destroy(): void;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export interface PalettePack extends UnknownRecord { schemaVersion: "figurestead.palette-pack/2"; name?: string; palettes: Record<string, UnknownRecord> }
|
|
599
|
+
export const THEME_PACK_VERSION: "figurestead.theme-pack/1";
|
|
600
|
+
export const PALETTE_PACK_VERSION: "figurestead.palette-pack/2";
|
|
601
|
+
export function validateThemePack(input: ThemePack): ThemePack;
|
|
602
|
+
export function validateAuthoredThemePack(input: AuthoredThemePack): ThemePack;
|
|
603
|
+
export function normalizeThemePackLenient(input: UnknownRecord): ThemePack;
|
|
604
|
+
export function loadThemePack(url: RequestInfo | URL, options?: RequestInit): Promise<ThemePack>;
|
|
605
|
+
export function resolveTheme(pack: ThemePack, key: string): FiguresteadTheme;
|
|
606
|
+
export function applyTheme<C extends FiguresteadContract<FiguresteadPanel>>(contract: C, theme: FiguresteadTheme): C;
|
|
607
|
+
export function themeForProfile(theme: FiguresteadTheme, profile?: ApplicationProfileKey | ApplicationProfile): FiguresteadTheme;
|
|
608
|
+
export function validatePalettePack(input: PalettePack): UnknownRecord;
|
|
609
|
+
export function resolvePalette(pack: PalettePack, key: string, options?: { mode?: ApplicationProfileKey }): UnknownRecord & { theme: FiguresteadTheme };
|
|
610
|
+
export function contrastRatio(left: CanonicalColor, right: CanonicalColor): number;
|
|
611
|
+
export function contrastAudit(theme: FiguresteadTheme): UnknownRecord[];
|
|
612
|
+
|
|
613
|
+
export const RENDER_LAYER_ORDER: readonly string[];
|
|
614
|
+
export function renderLayerForMark(mark: UnknownRecord): string;
|
|
615
|
+
export function partitionPanelMarks(marks?: UnknownRecord[]): Record<string, UnknownRecord[]>;
|
|
616
|
+
export function plotClipRect(panel: UnknownRecord): FiguresteadRect;
|
|
617
|
+
export function withCanvasPlotClip<T>(context: CanvasRenderingContext2D, panel: UnknownRecord, draw: (plot: FiguresteadRect) => T): T;
|
|
618
|
+
export function validateEvidenceCoverage(panels: UnknownRecord[]): Readonly<UnknownRecord>;
|
|
619
|
+
|
|
620
|
+
export interface OklabColor { L: number; a: number; b: number }
|
|
621
|
+
export interface OklchColor { L: number; C: number; h: number }
|
|
622
|
+
export function colorContrast(left: CanonicalColor, right: CanonicalColor): number;
|
|
623
|
+
export function hexToOklab(value: CanonicalColor): OklabColor;
|
|
624
|
+
export function hexToOklch(value: CanonicalColor): OklchColor;
|
|
625
|
+
export function oklabDistance(left: OklabColor, right: OklabColor): number;
|
|
626
|
+
export function oklchToHex(value: OklchColor): { hex: CanonicalColor; oklch: OklchColor };
|
|
627
|
+
export function resolveContrastColor(source: CanonicalColor, surface: CanonicalColor, minimum: number, options?: { chromaCap?: number }): Readonly<UnknownRecord & { color: CanonicalColor; contrast: number }>;
|
|
628
|
+
|
|
629
|
+
export const PAPER_FLOORS: Readonly<{ text: number; evidence: number; thinEvidenceTarget: number; pairwiseLightness: number; identityWarning: number }>;
|
|
630
|
+
export const PAPER_PROFILE_VERSION: "figurestead.paper-profile/1";
|
|
631
|
+
export const PAPER_SURFACE: Readonly<Record<string, CanonicalColor>>;
|
|
632
|
+
export function auditPaperTheme(theme: FiguresteadTheme, seriesStyles?: Record<string, ResolvedSeriesStyle> | null): Readonly<UnknownRecord & { clean: boolean }>;
|
|
633
|
+
export function resolvePaperTheme(theme: FiguresteadTheme): Readonly<{ theme: FiguresteadTheme; report: Readonly<UnknownRecord> }>;
|
|
634
|
+
export function themeResolutionForProfile(theme: FiguresteadTheme, profile?: ApplicationProfileKey | ApplicationProfile): Readonly<{ theme: FiguresteadTheme; report: Readonly<UnknownRecord> | null }>;
|
|
635
|
+
|
|
636
|
+
export interface PhysicalExport { preset: string; widthMm: number; heightMm: number; minLabelPt: number }
|
|
637
|
+
export interface ExportSize { width: number; height: number; widthAttribute: number | string; heightAttribute: number | string; physical: Readonly<PhysicalExport> | null }
|
|
638
|
+
export const PAPER_SIZE_PRESETS: Readonly<{ "paper-single": 89; "paper-double": 183 }>;
|
|
639
|
+
export function resolveExportSize(options?: ExportSizeOptions): Readonly<ExportSize>;
|
|
640
|
+
export function auditPhysicalTypography(composed: ComposedScene, physical: PhysicalExport | null): Readonly<UnknownRecord> | null;
|