@beeson-group/tycho 0.1.0 → 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/AUTHORS +7 -0
- package/LICENSE +202 -0
- package/NOTICE +14 -0
- package/README.md +38 -0
- package/THIRD_PARTY_NOTICES.md +68 -0
- package/dist/tycho.esm.js +515 -261
- package/dist/tycho.js +515 -261
- package/dist/types/container.d.ts +64 -0
- package/dist/types/errors.d.ts +10 -0
- package/dist/types/evaluate/clock.d.ts +30 -0
- package/dist/types/evaluate/frames.d.ts +63 -0
- package/dist/types/evaluate/index.d.ts +14 -0
- package/dist/types/evaluate/layers.d.ts +47 -0
- package/dist/types/evaluate/resolve.d.ts +39 -0
- package/dist/types/evaluate/sets.d.ts +49 -0
- package/dist/types/evaluate/types.d.ts +36 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/runtime/colormaps.d.ts +10 -0
- package/dist/types/runtime/colors.d.ts +94 -0
- package/dist/types/runtime/element.d.ts +224 -0
- package/dist/types/runtime/export.d.ts +119 -0
- package/dist/types/runtime/geometry.d.ts +214 -0
- package/dist/types/runtime/icons.d.ts +56 -0
- package/dist/types/runtime/layout.d.ts +34 -0
- package/dist/types/runtime/overlay.d.ts +33 -0
- package/dist/types/runtime/readouts.d.ts +129 -0
- package/dist/types/runtime/renderer.d.ts +303 -0
- package/dist/types/runtime/state.d.ts +106 -0
- package/dist/types/runtime/tiles.d.ts +33 -0
- package/dist/types/scene.d.ts +37 -0
- package/dist/types/scene.gen.d.ts +440 -0
- package/dist/types/validate.d.ts +9 -0
- package/package.json +63 -35
- package/src/colormaps.ts +0 -42
- package/src/container.ts +0 -126
- package/src/element.ts +0 -1034
- package/src/frames.ts +0 -204
- package/src/index.ts +0 -14
- package/src/layout.ts +0 -82
- package/src/viewer.ts +0 -864
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for scene.tys, generated from spec/scene.schema.json by scripts/gen-types.mjs.
|
|
3
|
+
* Do not edit. Run `npm run gen:types` after changing the schema.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
7
|
+
* via the `definition` "color".
|
|
8
|
+
*/
|
|
9
|
+
export type Color = string;
|
|
10
|
+
/**
|
|
11
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
12
|
+
* via the `definition` "id".
|
|
13
|
+
*/
|
|
14
|
+
export type Id = string;
|
|
15
|
+
/**
|
|
16
|
+
* @minItems 3
|
|
17
|
+
* @maxItems 3
|
|
18
|
+
*
|
|
19
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
20
|
+
* via the `definition` "point".
|
|
21
|
+
*/
|
|
22
|
+
export type Point = [ConstantScalar, ConstantScalar, ConstantScalar];
|
|
23
|
+
/**
|
|
24
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
25
|
+
* via the `definition` "constantScalar".
|
|
26
|
+
*/
|
|
27
|
+
export type ConstantScalar = number | Attr;
|
|
28
|
+
/**
|
|
29
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
30
|
+
* via the `definition` "name".
|
|
31
|
+
*/
|
|
32
|
+
export type Name = string;
|
|
33
|
+
/**
|
|
34
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
35
|
+
* via the `definition` "scalar".
|
|
36
|
+
*/
|
|
37
|
+
export type Scalar = number | Attr | ChannelRef;
|
|
38
|
+
/**
|
|
39
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
40
|
+
* via the `definition` "variable".
|
|
41
|
+
*/
|
|
42
|
+
export type Variable = {
|
|
43
|
+
kind: 'selector';
|
|
44
|
+
by?: 'nearest' | 'index';
|
|
45
|
+
parameter?: Name;
|
|
46
|
+
default: number;
|
|
47
|
+
scope?: 'scene' | 'panel';
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'choice';
|
|
50
|
+
/**
|
|
51
|
+
* @minItems 1
|
|
52
|
+
*/
|
|
53
|
+
values: [string, ...string[]];
|
|
54
|
+
labels?: string[];
|
|
55
|
+
default: string;
|
|
56
|
+
scope?: 'scene' | 'panel';
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'toggle';
|
|
59
|
+
default: boolean;
|
|
60
|
+
scope?: 'scene' | 'panel';
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
64
|
+
* via the `definition` "camera".
|
|
65
|
+
*/
|
|
66
|
+
export type Camera = {
|
|
67
|
+
kind: 'plane';
|
|
68
|
+
plane?: 'xy' | 'xz' | 'yz';
|
|
69
|
+
} | {
|
|
70
|
+
kind: 'orbit';
|
|
71
|
+
projection?: 'orthographic' | 'perspective';
|
|
72
|
+
up?: 'x' | 'y' | 'z';
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
76
|
+
* via the `definition` "setQuery".
|
|
77
|
+
*/
|
|
78
|
+
export type SetQuery = {
|
|
79
|
+
set: Id;
|
|
80
|
+
} | {
|
|
81
|
+
tags: {
|
|
82
|
+
[k: string]: StringValue | undefined;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
87
|
+
* via the `definition` "stringValue".
|
|
88
|
+
*/
|
|
89
|
+
export type StringValue = string | VarRef;
|
|
90
|
+
/**
|
|
91
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
92
|
+
* via the `definition` "layer".
|
|
93
|
+
*/
|
|
94
|
+
export type Layer = {
|
|
95
|
+
kind: 'track';
|
|
96
|
+
sets: SetQuery;
|
|
97
|
+
members: MemberRef;
|
|
98
|
+
reveal?: 'none' | 'grow' | 'trail';
|
|
99
|
+
trail?: Trail;
|
|
100
|
+
head?: boolean | {
|
|
101
|
+
color?: Color;
|
|
102
|
+
size?: number;
|
|
103
|
+
};
|
|
104
|
+
before?: 'clamp' | 'hidden';
|
|
105
|
+
after?: 'clamp' | 'hidden';
|
|
106
|
+
color?: ColorSpec;
|
|
107
|
+
opacity?: number;
|
|
108
|
+
width?: number;
|
|
109
|
+
highlight?: {
|
|
110
|
+
var: Id;
|
|
111
|
+
width?: number;
|
|
112
|
+
opacity?: number;
|
|
113
|
+
kernel?: {
|
|
114
|
+
width: number;
|
|
115
|
+
opacity: number;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
visible?: VarRef;
|
|
119
|
+
} | {
|
|
120
|
+
kind: 'body';
|
|
121
|
+
body: Id;
|
|
122
|
+
trail?: Trail;
|
|
123
|
+
size?: number;
|
|
124
|
+
visible?: VarRef;
|
|
125
|
+
} | {
|
|
126
|
+
kind: 'axes';
|
|
127
|
+
span?: 'positive' | 'full';
|
|
128
|
+
visible?: VarRef;
|
|
129
|
+
} | {
|
|
130
|
+
kind: 'grid';
|
|
131
|
+
labels?: boolean;
|
|
132
|
+
visible?: VarRef;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
136
|
+
* via the `definition` "memberRef".
|
|
137
|
+
*/
|
|
138
|
+
export type MemberRef = 'all' | {
|
|
139
|
+
index: number;
|
|
140
|
+
} | {
|
|
141
|
+
count: number;
|
|
142
|
+
} | VarRef;
|
|
143
|
+
/**
|
|
144
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
145
|
+
* via the `definition` "colorSpec".
|
|
146
|
+
*/
|
|
147
|
+
export type ColorSpec = Color | {
|
|
148
|
+
parameter: Name;
|
|
149
|
+
colormap: ColormapName | ColormapByChoice;
|
|
150
|
+
/**
|
|
151
|
+
* @minItems 2
|
|
152
|
+
* @maxItems 2
|
|
153
|
+
*/
|
|
154
|
+
range?: [number, number];
|
|
155
|
+
/**
|
|
156
|
+
* @minItems 2
|
|
157
|
+
* @maxItems 2
|
|
158
|
+
*/
|
|
159
|
+
clip?: [number, number];
|
|
160
|
+
} | {
|
|
161
|
+
channel: Name;
|
|
162
|
+
colormap: ColormapName | ColormapByChoice;
|
|
163
|
+
/**
|
|
164
|
+
* @minItems 2
|
|
165
|
+
* @maxItems 2
|
|
166
|
+
*/
|
|
167
|
+
range?: [number, number];
|
|
168
|
+
/**
|
|
169
|
+
* @minItems 2
|
|
170
|
+
* @maxItems 2
|
|
171
|
+
*/
|
|
172
|
+
clip?: [number, number];
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
176
|
+
* via the `definition` "colormapName".
|
|
177
|
+
*/
|
|
178
|
+
export type ColormapName = 'viridis' | 'plasma' | 'cividis' | 'blues' | 'reds';
|
|
179
|
+
/**
|
|
180
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
181
|
+
* via the `definition` "control".
|
|
182
|
+
*/
|
|
183
|
+
export type Control = {
|
|
184
|
+
kind: 'slider';
|
|
185
|
+
variable: Id;
|
|
186
|
+
label: string;
|
|
187
|
+
domain: SetQuery;
|
|
188
|
+
} | {
|
|
189
|
+
kind: 'tabs' | 'toggle';
|
|
190
|
+
variable: Id;
|
|
191
|
+
label: string;
|
|
192
|
+
} | {
|
|
193
|
+
kind: 'transport';
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
197
|
+
* via the `definition` "layout".
|
|
198
|
+
*/
|
|
199
|
+
export type Layout = {
|
|
200
|
+
kind: 'panel';
|
|
201
|
+
id: Id;
|
|
202
|
+
} | {
|
|
203
|
+
kind: 'split';
|
|
204
|
+
dir: 'row' | 'col';
|
|
205
|
+
ratio: number;
|
|
206
|
+
a: Layout;
|
|
207
|
+
b: Layout;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Structure of scene.tys, version 0.2. The rules that this schema cannot express are in tycho-scene.md.
|
|
211
|
+
*/
|
|
212
|
+
export interface Scene {
|
|
213
|
+
format: 'tycho-scene';
|
|
214
|
+
version: string;
|
|
215
|
+
requires?: string[];
|
|
216
|
+
generator?: string;
|
|
217
|
+
title?: string;
|
|
218
|
+
theme?: Theme;
|
|
219
|
+
frames: {
|
|
220
|
+
[k: string]: Frame | undefined;
|
|
221
|
+
};
|
|
222
|
+
bodies?: {
|
|
223
|
+
[k: string]: Body | undefined;
|
|
224
|
+
};
|
|
225
|
+
track_sets: {
|
|
226
|
+
[k: string]: TrackSet | undefined;
|
|
227
|
+
};
|
|
228
|
+
variables?: {
|
|
229
|
+
[k: string]: Variable | undefined;
|
|
230
|
+
};
|
|
231
|
+
clock: Clock;
|
|
232
|
+
views: {
|
|
233
|
+
[k: string]: View | undefined;
|
|
234
|
+
};
|
|
235
|
+
controls?: Control[];
|
|
236
|
+
readouts?: Readout[];
|
|
237
|
+
initial: State;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
241
|
+
* via the `definition` "theme".
|
|
242
|
+
*/
|
|
243
|
+
export interface Theme {
|
|
244
|
+
background?: Color;
|
|
245
|
+
foreground?: Color;
|
|
246
|
+
grid?: Color;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
250
|
+
* via the `definition` "frame".
|
|
251
|
+
*/
|
|
252
|
+
export interface Frame {
|
|
253
|
+
label?: string;
|
|
254
|
+
/**
|
|
255
|
+
* @minItems 3
|
|
256
|
+
* @maxItems 3
|
|
257
|
+
*/
|
|
258
|
+
axes?: [string, string, string];
|
|
259
|
+
unit?: string;
|
|
260
|
+
parent?: Id;
|
|
261
|
+
origin?: Point | {
|
|
262
|
+
body: Id;
|
|
263
|
+
};
|
|
264
|
+
rotation?: {
|
|
265
|
+
axis: 'x' | 'y' | 'z';
|
|
266
|
+
angle: Scalar;
|
|
267
|
+
};
|
|
268
|
+
scale?: Scalar;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
272
|
+
* via the `definition` "attr".
|
|
273
|
+
*/
|
|
274
|
+
export interface Attr {
|
|
275
|
+
attr: Name;
|
|
276
|
+
factor?: number;
|
|
277
|
+
offset?: number;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
281
|
+
* via the `definition` "channelRef".
|
|
282
|
+
*/
|
|
283
|
+
export interface ChannelRef {
|
|
284
|
+
channel: Name;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
288
|
+
* via the `definition` "body".
|
|
289
|
+
*/
|
|
290
|
+
export interface Body {
|
|
291
|
+
label?: string;
|
|
292
|
+
frame: Id;
|
|
293
|
+
position: Point;
|
|
294
|
+
color?: Color;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
298
|
+
* via the `definition` "trackSet".
|
|
299
|
+
*/
|
|
300
|
+
export interface TrackSet {
|
|
301
|
+
label?: string;
|
|
302
|
+
frame: Id;
|
|
303
|
+
tags?: {
|
|
304
|
+
[k: string]: string | undefined;
|
|
305
|
+
};
|
|
306
|
+
attrs?: {
|
|
307
|
+
[k: string]: number | undefined;
|
|
308
|
+
};
|
|
309
|
+
tracks: number;
|
|
310
|
+
offsets: Name;
|
|
311
|
+
positions: Name;
|
|
312
|
+
channels?: {
|
|
313
|
+
[k: string]: {
|
|
314
|
+
view: Name;
|
|
315
|
+
interp?: 'linear' | 'hold';
|
|
316
|
+
unit?: string;
|
|
317
|
+
} | undefined;
|
|
318
|
+
};
|
|
319
|
+
parameters?: {
|
|
320
|
+
[k: string]: {
|
|
321
|
+
view: Name;
|
|
322
|
+
label?: string;
|
|
323
|
+
unit?: string;
|
|
324
|
+
} | undefined;
|
|
325
|
+
};
|
|
326
|
+
periodic?: boolean;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
330
|
+
* via the `definition` "clock".
|
|
331
|
+
*/
|
|
332
|
+
export interface Clock {
|
|
333
|
+
mode: 'fraction' | 'value';
|
|
334
|
+
/**
|
|
335
|
+
* @minItems 1
|
|
336
|
+
*/
|
|
337
|
+
channels: [Name, ...Name[]];
|
|
338
|
+
labels?: string[];
|
|
339
|
+
steps: number;
|
|
340
|
+
/**
|
|
341
|
+
* @minItems 2
|
|
342
|
+
* @maxItems 2
|
|
343
|
+
*/
|
|
344
|
+
range?: [number, number];
|
|
345
|
+
laps?: number;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
349
|
+
* via the `definition` "view".
|
|
350
|
+
*/
|
|
351
|
+
export interface View {
|
|
352
|
+
label?: string;
|
|
353
|
+
frame: Id | VarRef;
|
|
354
|
+
camera?: Camera;
|
|
355
|
+
driver: Driver;
|
|
356
|
+
layers: Layer[];
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
360
|
+
* via the `definition` "varRef".
|
|
361
|
+
*/
|
|
362
|
+
export interface VarRef {
|
|
363
|
+
var: Id;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
367
|
+
* via the `definition` "driver".
|
|
368
|
+
*/
|
|
369
|
+
export interface Driver {
|
|
370
|
+
sets: SetQuery;
|
|
371
|
+
member: {
|
|
372
|
+
index: number;
|
|
373
|
+
} | VarRef;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
377
|
+
* via the `definition` "trail".
|
|
378
|
+
*/
|
|
379
|
+
export interface Trail {
|
|
380
|
+
fraction: number;
|
|
381
|
+
taper?: {
|
|
382
|
+
width?: number;
|
|
383
|
+
opacity?: number;
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
388
|
+
* via the `definition` "colormapByChoice".
|
|
389
|
+
*/
|
|
390
|
+
export interface ColormapByChoice {
|
|
391
|
+
var: Id;
|
|
392
|
+
map: {
|
|
393
|
+
[k: string]: ColormapName | undefined;
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
398
|
+
* via the `definition` "readout".
|
|
399
|
+
*/
|
|
400
|
+
export interface Readout {
|
|
401
|
+
place: 'caption' | 'panel';
|
|
402
|
+
parts: (string | {
|
|
403
|
+
var: Id;
|
|
404
|
+
digits?: number;
|
|
405
|
+
} | {
|
|
406
|
+
member: Name;
|
|
407
|
+
digits?: number;
|
|
408
|
+
} | {
|
|
409
|
+
attr: Name;
|
|
410
|
+
factor?: number;
|
|
411
|
+
offset?: number;
|
|
412
|
+
digits?: number;
|
|
413
|
+
} | {
|
|
414
|
+
channel: Name;
|
|
415
|
+
digits?: number;
|
|
416
|
+
} | {
|
|
417
|
+
clock: 'index' | 'steps';
|
|
418
|
+
})[];
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* This interface was referenced by `Scene`'s JSON-Schema
|
|
422
|
+
* via the `definition` "state".
|
|
423
|
+
*/
|
|
424
|
+
export interface State {
|
|
425
|
+
variables?: {
|
|
426
|
+
[k: string]: number | string | boolean | undefined;
|
|
427
|
+
};
|
|
428
|
+
clock: {
|
|
429
|
+
channel: Name;
|
|
430
|
+
};
|
|
431
|
+
panels: {
|
|
432
|
+
[k: string]: {
|
|
433
|
+
view: Id;
|
|
434
|
+
variables?: {
|
|
435
|
+
[k: string]: number | string | boolean | undefined;
|
|
436
|
+
};
|
|
437
|
+
} | undefined;
|
|
438
|
+
};
|
|
439
|
+
layout: Layout;
|
|
440
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The checks a reader makes before evaluating a scene. `validate` throws a TychoError that gives the
|
|
3
|
+
* rule, and returns warnings for what a reader only reports: unknown top-level keys (section 2)
|
|
4
|
+
* and a panel value of a scene-scoped variable (rule V1).
|
|
5
|
+
*/
|
|
6
|
+
import type { DataStore } from './container.js';
|
|
7
|
+
import { type Scene, type State } from './scene.js';
|
|
8
|
+
/** Checks a scene, and its data and a state when given. Returns the warnings. */
|
|
9
|
+
export declare function validate(scene: Scene, data?: DataStore, state?: State): string[];
|
package/package.json
CHANGED
|
@@ -1,39 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beeson-group/tycho",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "npm run build:iife && npm run build:esm && npm run build:py",
|
|
7
|
-
"build:iife": "esbuild src/index.ts --bundle --format=iife --global-name=tycho --minify --target=es2020 --outfile=dist/tycho.js",
|
|
8
|
-
"build:esm": "esbuild src/index.ts --bundle --format=esm --minify --target=es2020 --outfile=dist/tycho.esm.js",
|
|
9
|
-
"build:py": "node -e \"require('fs').mkdirSync('../src/pytycho/_static',{recursive:true});require('fs').copyFileSync('dist/tycho.js','../src/pytycho/_static/tycho.js')\"",
|
|
10
|
-
"build:dev": "esbuild src/index.ts --bundle --format=iife --global-name=tycho --sourcemap=inline --target=es2020 --outfile=dist/tycho.dev.js",
|
|
11
|
-
"typecheck": "tsc --noEmit"
|
|
12
|
-
},
|
|
13
|
-
"devDependencies": {
|
|
14
|
-
"@types/three": "^0.180.0",
|
|
15
|
-
"esbuild": "^0.28.0",
|
|
16
|
-
"typescript": "^5.6.0"
|
|
17
|
-
},
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"three": "^0.180.0"
|
|
20
|
-
},
|
|
21
|
-
"main": "dist/tycho.esm.js",
|
|
22
|
-
"module": "dist/tycho.esm.js",
|
|
23
|
-
"exports": {
|
|
24
|
-
".": "./dist/tycho.esm.js",
|
|
25
|
-
"./iife": "./dist/tycho.js"
|
|
26
|
-
},
|
|
27
|
-
"files": [
|
|
28
|
-
"dist",
|
|
29
|
-
"src"
|
|
30
|
-
],
|
|
31
|
-
"repository": {
|
|
32
|
-
"type": "git",
|
|
33
|
-
"url": "git+https://github.com/beeson-group/tycho.git",
|
|
34
|
-
"directory": "web"
|
|
35
|
-
},
|
|
36
|
-
"homepage": "https://github.com/beeson-group/tycho",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "The browser runtime of TyCHO, with the scene format reader, its pure evaluator, and the <tycho-viewer> element",
|
|
37
5
|
"keywords": [
|
|
38
6
|
"astrodynamics",
|
|
39
7
|
"visualization",
|
|
@@ -41,5 +9,65 @@
|
|
|
41
9
|
"webgl",
|
|
42
10
|
"web-component"
|
|
43
11
|
],
|
|
44
|
-
"
|
|
12
|
+
"homepage": "https://github.com/beeson-group/tycho",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/beeson-group/tycho/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/beeson-group/tycho.git",
|
|
19
|
+
"directory": "web"
|
|
20
|
+
},
|
|
21
|
+
"author": "Claudio Vestini",
|
|
22
|
+
"contributors": ["Nina Karampela", "Jack Sydney Schwartz"],
|
|
23
|
+
"license": "Apache-2.0 AND MIT",
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "./dist/tycho.esm.js",
|
|
26
|
+
"module": "./dist/tycho.esm.js",
|
|
27
|
+
"types": "./dist/types/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/types/index.d.ts",
|
|
31
|
+
"default": "./dist/tycho.esm.js"
|
|
32
|
+
},
|
|
33
|
+
"./iife": "./dist/tycho.js",
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist/tycho.js",
|
|
38
|
+
"dist/tycho.esm.js",
|
|
39
|
+
"dist/types",
|
|
40
|
+
"NOTICE",
|
|
41
|
+
"AUTHORS",
|
|
42
|
+
"THIRD_PARTY_NOTICES.md"
|
|
43
|
+
],
|
|
44
|
+
"sideEffects": true,
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "npm run build:iife && npm run build:esm && npm run build:py",
|
|
47
|
+
"build:iife": "esbuild src/index.ts --bundle --format=iife --global-name=tycho --minify --target=es2022 --outfile=dist/tycho.js --banner:js=\"$(node scripts/notices.mjs)\"",
|
|
48
|
+
"build:esm": "esbuild src/index.ts --bundle --format=esm --minify --target=es2022 --outfile=dist/tycho.esm.js --banner:js=\"$(node scripts/notices.mjs)\"",
|
|
49
|
+
"build:py": "node -e \"require('fs').mkdirSync('../src/pytycho/_static',{recursive:true});require('fs').copyFileSync('dist/tycho.js','../src/pytycho/_static/tycho.js')\"",
|
|
50
|
+
"build:dev": "esbuild src/index.ts --bundle --format=iife --global-name=tycho --sourcemap=inline --target=es2022 --outfile=dist/tycho.dev.js",
|
|
51
|
+
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p test/tsconfig.json",
|
|
52
|
+
"test": "vitest run",
|
|
53
|
+
"gen:types": "node scripts/gen-types.mjs",
|
|
54
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
55
|
+
"notices": "node scripts/notices.mjs --check",
|
|
56
|
+
"prepack": "npm run notices && npm run build && npm run build:types && node scripts/prepack.mjs",
|
|
57
|
+
"postpack": "node scripts/prepack.mjs --clean"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^26.6.3",
|
|
61
|
+
"@types/three": "^0.180.0",
|
|
62
|
+
"ajv": "^8.20.0",
|
|
63
|
+
"esbuild": "^0.28.2",
|
|
64
|
+
"json-schema-to-typescript": "^16.0.0",
|
|
65
|
+
"mp4-muxer": "^5.2.2",
|
|
66
|
+
"three": "^0.180.0",
|
|
67
|
+
"typescript": "^7.0.2",
|
|
68
|
+
"vitest": "^5.0.3"
|
|
69
|
+
},
|
|
70
|
+
"publishConfig": {
|
|
71
|
+
"access": "public"
|
|
72
|
+
}
|
|
45
73
|
}
|
package/src/colormaps.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Small colormap lookup tables, sampled from matplotlib's maps, for colouring
|
|
3
|
-
* family members by their continuation parameter. The two single-hue maps are
|
|
4
|
-
* restricted to their brighter half so the low end stays visible on black.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export type ColormapId = 'viridis' | 'plasma' | 'cividis' | 'blues' | 'reds';
|
|
8
|
-
|
|
9
|
-
const STOPS: Record<ColormapId, number[][]> = {
|
|
10
|
-
viridis: [
|
|
11
|
-
[0.267, 0.005, 0.329], [0.283, 0.141, 0.458], [0.254, 0.265, 0.53], [0.207, 0.372, 0.553],
|
|
12
|
-
[0.164, 0.471, 0.558], [0.128, 0.567, 0.551], [0.135, 0.659, 0.518], [0.267, 0.749, 0.441],
|
|
13
|
-
[0.478, 0.821, 0.318], [0.741, 0.873, 0.15], [0.993, 0.906, 0.144],
|
|
14
|
-
],
|
|
15
|
-
plasma: [
|
|
16
|
-
[0.05, 0.03, 0.528], [0.294, 0.012, 0.615], [0.492, 0.012, 0.658], [0.665, 0.139, 0.586],
|
|
17
|
-
[0.798, 0.28, 0.47], [0.902, 0.418, 0.36], [0.973, 0.585, 0.252], [0.993, 0.771, 0.155],
|
|
18
|
-
[0.94, 0.975, 0.131],
|
|
19
|
-
],
|
|
20
|
-
cividis: [
|
|
21
|
-
[0.0, 0.135, 0.304], [0.086, 0.218, 0.396], [0.243, 0.301, 0.42], [0.365, 0.383, 0.432],
|
|
22
|
-
[0.478, 0.466, 0.448], [0.588, 0.55, 0.437], [0.702, 0.638, 0.402], [0.822, 0.73, 0.343],
|
|
23
|
-
[0.945, 0.827, 0.244], [0.996, 0.91, 0.149],
|
|
24
|
-
],
|
|
25
|
-
blues: [[0.19, 0.42, 0.71], [0.33, 0.6, 0.8], [0.53, 0.76, 0.87], [0.7, 0.85, 0.92], [0.85, 0.93, 0.98]],
|
|
26
|
-
reds: [[0.72, 0.1, 0.1], [0.89, 0.27, 0.2], [0.98, 0.5, 0.36], [0.99, 0.7, 0.58], [1.0, 0.86, 0.78]],
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** RGB in [0, 1] at parameter t in [0, 1]. */
|
|
30
|
-
export function colormap(id: ColormapId, t: number, out: number[] = [0, 0, 0]): number[] {
|
|
31
|
-
const stops = STOPS[id];
|
|
32
|
-
const x = Math.max(0, Math.min(1, t)) * (stops.length - 1);
|
|
33
|
-
const i = Math.min(stops.length - 2, Math.floor(x));
|
|
34
|
-
const u = x - i;
|
|
35
|
-
for (let c = 0; c < 3; c++) out[c] = stops[i][c] + (stops[i + 1][c] - stops[i][c]) * u;
|
|
36
|
-
return out;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function colormapCss(id: ColormapId, t: number): string {
|
|
40
|
-
const [r, g, b] = colormap(id, t);
|
|
41
|
-
return `rgb(${Math.round(r * 255)},${Math.round(g * 255)},${Math.round(b * 255)})`;
|
|
42
|
-
}
|