@beeson-group/tycho 0.2.0 → 0.3.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/AUTHORS +1 -0
- package/NOTICE +1 -1
- package/THIRD_PARTY_NOTICES.md +4 -4
- package/dist/tycho.esm.js +1231 -728
- package/dist/tycho.js +1231 -728
- package/dist/types/container.d.ts +16 -16
- package/dist/types/errors.d.ts +2 -3
- package/dist/types/evaluate/clock.d.ts +21 -15
- package/dist/types/evaluate/frames.d.ts +11 -11
- package/dist/types/evaluate/index.d.ts +9 -2
- package/dist/types/evaluate/layers.d.ts +87 -26
- package/dist/types/evaluate/resolve.d.ts +34 -23
- package/dist/types/evaluate/sets.d.ts +16 -15
- package/dist/types/evaluate/timeline.d.ts +60 -0
- package/dist/types/evaluate/types.d.ts +57 -6
- package/dist/types/index.d.ts +2 -2
- package/dist/types/runtime/colormaps.d.ts +1 -1
- package/dist/types/runtime/colors.d.ts +40 -13
- package/dist/types/runtime/contexts.d.ts +40 -0
- package/dist/types/runtime/element.d.ts +100 -22
- package/dist/types/runtime/export.d.ts +44 -34
- package/dist/types/runtime/geometry.d.ts +106 -103
- package/dist/types/runtime/icons.d.ts +12 -2
- package/dist/types/runtime/outline.d.ts +29 -0
- package/dist/types/runtime/overlay.d.ts +3 -1
- package/dist/types/runtime/paint.d.ts +116 -0
- package/dist/types/runtime/raster.d.ts +33 -0
- package/dist/types/runtime/readouts.d.ts +35 -28
- package/dist/types/runtime/renderer.d.ts +344 -61
- package/dist/types/runtime/state.d.ts +27 -29
- package/dist/types/runtime/tiles.d.ts +2 -2
- package/dist/types/scene.d.ts +27 -13
- package/dist/types/scene.gen.d.ts +1826 -194
- package/dist/types/validate.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1,47 +1,44 @@
|
|
|
1
1
|
import { type PanelScope } from '../evaluate/resolve.js';
|
|
2
2
|
import type { SetCache } from '../evaluate/sets.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Control, Panel, Scene, SetQuery, State, TextPart } from '../scene.js';
|
|
4
4
|
import { type GeometryCache } from './geometry.js';
|
|
5
5
|
/**
|
|
6
6
|
* A number for a readout. With `digits`, it is written to `digits` significant digits with trailing
|
|
7
7
|
* zeros kept. Otherwise an integer is written as it is, and any other number to six significant
|
|
8
8
|
* digits with trailing zeros dropped. An exponent is written as `e` and the exponent, and a minus sign as U+2212.
|
|
9
9
|
*/
|
|
10
|
-
export declare function formatNumber(x: number, digits?: number): string;
|
|
11
|
-
/** The slider's stops, which are the distinct parameter values of the matched
|
|
10
|
+
export declare function formatNumber(x: number, digits?: number, decimals?: number, grouping?: boolean): string;
|
|
11
|
+
/** The slider's stops, which are the distinct parameter values of the matched trajectory sets in increasing order (section 2.9). */
|
|
12
12
|
export declare function sliderStops(scope: PanelScope, sets: SetCache, control: Extract<Control, {
|
|
13
13
|
kind: 'slider';
|
|
14
14
|
}>): number[];
|
|
15
15
|
/** The index of the stop nearest a value, the lowest index winning a tie, or -1 when `stops` is empty. */
|
|
16
16
|
export declare function nearestStop(stops: readonly number[], value: number): number;
|
|
17
|
-
|
|
18
|
-
export declare const LAP_SECONDS = 8;
|
|
19
|
-
/** The seconds that one loop of the clock lasts at speed 1, which are LAP_SECONDS for each of its laps (rule C6). */
|
|
20
|
-
export declare function loopSeconds(clock: Clock): number;
|
|
17
|
+
export { REVOLUTION_SECONDS, loopSeconds } from '../evaluate/timeline.js';
|
|
21
18
|
/**
|
|
22
19
|
* The loop position, in frame indices and unwrapped, `time` after a playback showed frame index
|
|
23
|
-
* `start`, with `perSecond` units of time to the second. A loop of `
|
|
20
|
+
* `start`, with `perSecond` units of time to the second. A loop of `frameCount` frames lasts `seconds / speed`
|
|
24
21
|
* seconds. Live playback counts milliseconds and a video export its frames, and one division of
|
|
25
22
|
* exact products keeps a position that should be an integer exact.
|
|
26
23
|
*/
|
|
27
|
-
export declare function loopPosition(start: number, time: number, perSecond: number,
|
|
28
|
-
/** The frame index at a loop position, i.e. its integer part wrapped into [0,
|
|
29
|
-
export declare function positionIndex(x: number,
|
|
24
|
+
export declare function loopPosition(start: number, time: number, perSecond: number, frameCount: number, speed: number, seconds: number): number;
|
|
25
|
+
/** The frame index at a loop position, i.e. its integer part wrapped into [0, frameCount). */
|
|
26
|
+
export declare function positionIndex(x: number, frameCount: number): number;
|
|
30
27
|
/** The progress q in [0, 1) at a loop position, which lies between two frame indices while playing. */
|
|
31
|
-
export declare function positionProgress(x: number,
|
|
28
|
+
export declare function positionProgress(x: number, frameCount: number): number;
|
|
32
29
|
/** The panel, the state, and the frame index through which a readout reads. A caption without a panel does not read anything. */
|
|
33
30
|
export interface ReadoutContext {
|
|
34
31
|
scene: Scene;
|
|
35
32
|
geometry: GeometryCache;
|
|
36
33
|
state: State;
|
|
37
|
-
/** The panel whose
|
|
34
|
+
/** The panel whose reference and values the readout reads. */
|
|
38
35
|
panel: string;
|
|
39
36
|
frameIndex: number;
|
|
40
|
-
/** The progress at which the channel parts read, between two frame indices while playing. It defaults to frameIndex /
|
|
37
|
+
/** The progress at which the channel parts read, between two frame indices while playing. It defaults to frameIndex / frameCount. */
|
|
41
38
|
progress?: number;
|
|
42
39
|
}
|
|
43
|
-
type Part =
|
|
44
|
-
/** The text of a readout. A part that the
|
|
40
|
+
type Part = TextPart;
|
|
41
|
+
/** The text of a readout. A part that the reference cannot give, because its query does not match any set, reads as a dash. */
|
|
45
42
|
export declare function readoutText(ctx: ReadoutContext, parts: readonly Part[]): string;
|
|
46
43
|
/** The text of each part of a readout, one per part, or an empty list when the panel is missing. */
|
|
47
44
|
export declare function readoutPieces(ctx: ReadoutContext, parts: readonly Part[]): string[];
|
|
@@ -101,29 +98,39 @@ export type KeyAction = {
|
|
|
101
98
|
} | {
|
|
102
99
|
kind: 'slider';
|
|
103
100
|
by: number;
|
|
101
|
+
} | {
|
|
102
|
+
kind: 'view';
|
|
103
|
+
axis: 'x' | 'y' | 'z';
|
|
104
|
+
sign: 1 | -1;
|
|
105
|
+
} | {
|
|
106
|
+
kind: 'turn';
|
|
107
|
+
degrees: number;
|
|
104
108
|
};
|
|
105
109
|
/**
|
|
106
110
|
* The action of a key, following common video players. Space or k plays and pauses. The left and right
|
|
107
|
-
* arrows
|
|
108
|
-
*
|
|
109
|
-
*
|
|
111
|
+
* arrows step one frame and pause, and ten with Shift. Home or 0 goes to frame 0, and a digit from 1 to 9
|
|
112
|
+
* goes to as many tenths of the loop. The key f fits every panel. The up and down arrows step the first
|
|
113
|
+
* shared slider by one stop, or by ten with Shift. In a panel with a 3d camera, x, y, and z show
|
|
114
|
+
* the view from the positive side of that axis, and from the negative side with Shift, and "," and "." turn
|
|
115
|
+
* it about the camera's up axis by 15 degrees, where "." turns it as a drag to the right does. Shift with
|
|
116
|
+
* either turns it by 90 degrees. Shift with them gives "<" and ">" on a US keyboard and other characters
|
|
117
|
+
* elsewhere, hence the two keys are then known by `code`, the `code` of the key event.
|
|
110
118
|
*/
|
|
111
|
-
export declare function keyAction(key: string, shift: boolean,
|
|
119
|
+
export declare function keyAction(key: string, shift: boolean, frameCount: number, code?: string): KeyAction | null;
|
|
112
120
|
/** Whether a focused form control takes `key` itself, given the tag name and the `type` of the control. */
|
|
113
121
|
export declare function controlUsesKey(tag: string, type: string, key: string): boolean;
|
|
114
|
-
/** The
|
|
122
|
+
/** The shared input of kind parameter that dragging a colorbar sets, with the label of its control and the trajectory sets that its stops come from. */
|
|
115
123
|
export interface ColorbarLink {
|
|
116
|
-
|
|
124
|
+
input: string;
|
|
117
125
|
label: string;
|
|
118
126
|
domain: SetQuery;
|
|
119
127
|
}
|
|
120
128
|
/**
|
|
121
|
-
* The
|
|
122
|
-
* layer colored by a parameter whose label the bar carries and a
|
|
123
|
-
* same parameter. The stops come from the
|
|
124
|
-
* The result is null when a matching layer or a matching
|
|
129
|
+
* The parameter input that a colorbar of the declared panel `panel` sets. It is found from the bar's label, through a trajectory
|
|
130
|
+
* layer colored by a parameter whose label the bar carries and a shared input of kind parameter over the
|
|
131
|
+
* same parameter. The stops come from the parameter input's slider domain, else from the layer's sets.
|
|
132
|
+
* The result is null when a matching layer or a matching parameter input does not exist.
|
|
125
133
|
*/
|
|
126
|
-
export declare function colorbarLink(scene: Scene,
|
|
134
|
+
export declare function colorbarLink(scene: Scene, panel: Panel, barLabel: string): ColorbarLink | null;
|
|
127
135
|
/** The index of the stop nearest the value at `t` in [0, 1] along a bar from `lo` to `hi`, or -1 when `stops` is empty. */
|
|
128
136
|
export declare function stopAt(stops: readonly number[], lo: number, hi: number, t: number): number;
|
|
129
|
-
export {};
|