@beeson-group/tycho 0.2.0 → 0.3.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 +1 -0
- package/NOTICE +1 -1
- package/THIRD_PARTY_NOTICES.md +4 -4
- package/dist/tycho.esm.js +1227 -724
- package/dist/tycho.js +1227 -724
- 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/colors.d.ts +40 -13
- package/dist/types/runtime/element.d.ts +88 -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/paint.d.ts +110 -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 +306 -58
- 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 +1791 -198
- package/dist/types/validate.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Layout, type
|
|
1
|
+
import { type Layout, type ShownPanel, type Scene, type State, type InputValue } from '../scene.js';
|
|
2
2
|
import { type DropZone } from './layout.js';
|
|
3
3
|
/** Which of the snapshot, the frame index, and the playing flag changed. */
|
|
4
4
|
export type Change = 'state' | 'frame' | 'playing';
|
|
@@ -9,11 +9,11 @@ export declare class Store {
|
|
|
9
9
|
private snap;
|
|
10
10
|
private index;
|
|
11
11
|
private play;
|
|
12
|
-
private readonly
|
|
12
|
+
private readonly frameCount;
|
|
13
13
|
private readonly listeners;
|
|
14
|
-
constructor(state: State,
|
|
14
|
+
constructor(state: State, frameCount: number);
|
|
15
15
|
get state(): State;
|
|
16
|
-
/** The frame index, kept in [0,
|
|
16
|
+
/** The frame index, kept in [0, frameCount), since the indices i and i + frameCount are the same frame (section 2.6). */
|
|
17
17
|
get frame(): number;
|
|
18
18
|
get playing(): boolean;
|
|
19
19
|
subscribe(listener: Listener): () => void;
|
|
@@ -24,12 +24,12 @@ export declare class Store {
|
|
|
24
24
|
setPlaying(on: boolean): void;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* Sets
|
|
28
|
-
* (rule
|
|
27
|
+
* Sets an input in the shown panel when the input is per-panel, and in the state's shared inputs otherwise
|
|
28
|
+
* (rule `input-scope`). A value that does not fit the input leaves the state as it is.
|
|
29
29
|
*/
|
|
30
|
-
export declare function
|
|
30
|
+
export declare function withInput(scene: Scene, state: State, id: string, value: InputValue, panel?: string): State;
|
|
31
31
|
export declare function withChannel(state: State, channel: string): State;
|
|
32
|
-
export declare function withPanel(state: State, id: string, panel:
|
|
32
|
+
export declare function withPanel(state: State, id: string, panel: ShownPanel): State;
|
|
33
33
|
export declare function withLayout(state: State, layout: Layout): State;
|
|
34
34
|
/** Removes a panel and its layout leaf, collapsing its split. The last panel stays. */
|
|
35
35
|
export declare function withoutPanel(state: State, id: string): State;
|
|
@@ -37,23 +37,19 @@ export declare function withoutPanel(state: State, id: string): State;
|
|
|
37
37
|
export declare function newPanelId(state: State): string;
|
|
38
38
|
/** The layout with two leaves exchanged. */
|
|
39
39
|
export declare function swapLeaves(node: Layout, a: string, b: string): Layout;
|
|
40
|
-
/** What can be dropped on a panel: a
|
|
40
|
+
/** What can be dropped on a shown panel: a declared panel, or another shown panel. */
|
|
41
41
|
export type DropPayload = {
|
|
42
|
-
kind: '
|
|
43
|
-
|
|
44
|
-
} | {
|
|
45
|
-
kind: 'value';
|
|
46
|
-
variable: string;
|
|
47
|
-
value: string;
|
|
42
|
+
kind: 'declared';
|
|
43
|
+
panel: string;
|
|
48
44
|
} | {
|
|
49
45
|
kind: 'panel';
|
|
50
46
|
id: string;
|
|
51
47
|
};
|
|
52
48
|
/**
|
|
53
|
-
* The state after a drop on panel `target`. On an edge, a
|
|
54
|
-
* there,
|
|
55
|
-
*
|
|
56
|
-
*
|
|
49
|
+
* The state after a drop on the shown panel `target`. On an edge, a declared panel makes a new shown
|
|
50
|
+
* panel there, and a shown panel moves there. On the center, a declared panel replaces the declared
|
|
51
|
+
* panel that the target shows, which keeps its inputs, and a shown panel swaps places with it. A new
|
|
52
|
+
* shown panel is not made once the state has `maxPanels` shown panels.
|
|
57
53
|
*/
|
|
58
54
|
export declare function withDrop(scene: Scene, state: State, target: string, zone: DropZone, payload: DropPayload, maxPanels?: number): State;
|
|
59
55
|
/**
|
|
@@ -61,8 +57,8 @@ export declare function withDrop(scene: Scene, state: State, target: string, zon
|
|
|
61
57
|
* area is split along its longer side, below it when `tall` returns true (taller than wide) and
|
|
62
58
|
* to its right otherwise. A new panel is not made once the state has `maxPanels` panels.
|
|
63
59
|
*/
|
|
64
|
-
export declare function withAdd(scene: Scene, state: State, payload:
|
|
65
|
-
kind: '
|
|
60
|
+
export declare function withAdd(scene: Scene, state: State, payload: Extract<DropPayload, {
|
|
61
|
+
kind: 'declared';
|
|
66
62
|
}>, maxPanels: number, tall: (id: string) => boolean): State;
|
|
67
63
|
/** Where a chip's menu puts a panel, either where there is most room or where a drop on a panel would. */
|
|
68
64
|
export type Placement = {
|
|
@@ -87,20 +83,22 @@ export interface MenuItem {
|
|
|
87
83
|
*/
|
|
88
84
|
export declare function chipMenu(state: State, name: (id: string) => string, maxPanels: number): MenuItem[];
|
|
89
85
|
/** The state after a chip's menu item: `withAdd` or `withDrop` with the chip's payload. */
|
|
90
|
-
export declare function withPlacement(scene: Scene, state: State, placement: Placement, payload:
|
|
91
|
-
kind: '
|
|
86
|
+
export declare function withPlacement(scene: Scene, state: State, placement: Placement, payload: Extract<DropPayload, {
|
|
87
|
+
kind: 'declared';
|
|
92
88
|
}>, maxPanels: number, tall: (id: string) => boolean): State;
|
|
93
89
|
/** The 32-bit FNV-1a hash (Fowler-Noll-Vo) of the UTF-8 bytes of `text`, as eight hex digits. */
|
|
94
90
|
export declare function fnv1a(text: string): string;
|
|
95
91
|
/** The key under which a stored state is kept, built from a hash of scene.tys and its length (section 2.8). */
|
|
96
92
|
export declare function storageKey(sceneText: string): string;
|
|
97
93
|
/**
|
|
98
|
-
* Repairs a stored state against a scene, as described in section 2.8. A panel whose
|
|
99
|
-
* scene lacks is dropped together with its layout leaf, and a value that does not fit its
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
94
|
+
* Repairs a stored state against a scene, as described in section 2.8. A shown panel whose declared
|
|
95
|
+
* panel the scene lacks is dropped together with its layout leaf, and a value that does not fit its
|
|
96
|
+
* input is dropped, as is a value of a shared input in a shown panel. A split keeps its keyframes, the
|
|
97
|
+
* keyframes of its ratio (section 2.11), when they are valid, so that a restored layout still moves with
|
|
98
|
+
* the timeline, and loses them otherwise. The repair falls back to `initial` once every panel is
|
|
99
|
+
* dropped or when the clock channel is unknown. Beyond section 2.8,
|
|
100
|
+
* it also drops values that are never read (undeclared ids, and a shared value of a per-panel input),
|
|
101
|
+
* a shown panel that the layout does not show or whose id is not an identifier, and a repeated leaf. It falls
|
|
104
102
|
* back to `initial` as well on input that is not a state at all. It is pure and does not modify `stored`.
|
|
105
103
|
*/
|
|
106
104
|
export declare function repair(scene: Scene, stored: unknown): State;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Where the panels of a layout tree sit on a
|
|
3
|
-
* and the
|
|
2
|
+
* Where the panels of a layout tree sit on a panel area. The placement is a pure function of the tree
|
|
3
|
+
* and the panel area rectangle, and both the page and the renderer use it, so that a frame does not
|
|
4
4
|
* depend on how the browser lays out the page.
|
|
5
5
|
*/
|
|
6
6
|
import type { Layout } from '../scene.js';
|
package/dist/types/scene.d.ts
CHANGED
|
@@ -3,12 +3,18 @@
|
|
|
3
3
|
* spec/scene.schema.json, and the types therefore cannot drift apart from the schema. The aliases below
|
|
4
4
|
* only name parts that the generator, web/scripts/gen-types.mjs, leaves anonymous.
|
|
5
5
|
*/
|
|
6
|
-
import type { Layer, State,
|
|
6
|
+
import type { Input, Layer, State, TrajectorySet } from './scene.gen.js';
|
|
7
7
|
export type * from './scene.gen.js';
|
|
8
|
-
export type ChannelDef = NonNullable<NonNullable<
|
|
9
|
-
export type ParameterDef = NonNullable<NonNullable<
|
|
10
|
-
export type
|
|
11
|
-
kind: '
|
|
8
|
+
export type ChannelDef = NonNullable<NonNullable<TrajectorySet['channels']>[string]>;
|
|
9
|
+
export type ParameterDef = NonNullable<NonNullable<TrajectorySet['parameters']>[string]>;
|
|
10
|
+
export type TrajectoriesLayer = Extract<Layer, {
|
|
11
|
+
kind: 'trajectories';
|
|
12
|
+
}>;
|
|
13
|
+
export type ArrowLayer = Extract<Layer, {
|
|
14
|
+
kind: 'arrow';
|
|
15
|
+
}>;
|
|
16
|
+
export type InsetBoxLayer = Extract<Layer, {
|
|
17
|
+
kind: 'inset_box';
|
|
12
18
|
}>;
|
|
13
19
|
export type BodyLayer = Extract<Layer, {
|
|
14
20
|
kind: 'body';
|
|
@@ -16,22 +22,30 @@ export type BodyLayer = Extract<Layer, {
|
|
|
16
22
|
export type MarkLayer = Extract<Layer, {
|
|
17
23
|
kind: 'axes' | 'grid';
|
|
18
24
|
}>;
|
|
19
|
-
export type
|
|
20
|
-
kind: '
|
|
25
|
+
export type LabelLayer = Extract<Layer, {
|
|
26
|
+
kind: 'label';
|
|
27
|
+
}>;
|
|
28
|
+
export type PointsLayer = Extract<Layer, {
|
|
29
|
+
kind: 'points';
|
|
30
|
+
}>;
|
|
31
|
+
export type ParameterInput = Extract<Input, {
|
|
32
|
+
kind: 'parameter';
|
|
21
33
|
}>;
|
|
22
|
-
export type Choice = Extract<
|
|
34
|
+
export type Choice = Extract<Input, {
|
|
23
35
|
kind: 'choice';
|
|
24
36
|
}>;
|
|
25
|
-
export type Toggle = Extract<
|
|
37
|
+
export type Toggle = Extract<Input, {
|
|
26
38
|
kind: 'toggle';
|
|
27
39
|
}>;
|
|
28
|
-
export type
|
|
29
|
-
export type
|
|
40
|
+
export type ShownPanel = NonNullable<State['panels'][string]>;
|
|
41
|
+
export type InputValue = number | string | boolean;
|
|
30
42
|
/** The scene format version this reader implements. */
|
|
31
43
|
export declare const SCENE_MAJOR = 0;
|
|
32
|
-
export declare const SCENE_MINOR =
|
|
33
|
-
/** Features from `requires` that this reader implements.
|
|
44
|
+
export declare const SCENE_MINOR = 5;
|
|
45
|
+
/** Features from `requires` that this reader implements, i.e. the features of section 4 that version 0.5 of the format includes. */
|
|
34
46
|
export declare const SUPPORTED_FEATURES: ReadonlySet<string>;
|
|
35
47
|
export declare const TOP_LEVEL_KEYS: ReadonlySet<string>;
|
|
36
48
|
export declare const ID_PATTERN: RegExp;
|
|
37
49
|
export declare const INDEX_CHANNEL = "@index";
|
|
50
|
+
/** The built-in parameter whose value is the number of the member in its set. */
|
|
51
|
+
export declare const INDEX_PARAMETER = "@index";
|