@msb235/blits-panel 0.1.1 → 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.
@@ -0,0 +1,8 @@
1
+ import type { Watched } from '@msb235/blits';
2
+ import type { MarkInfo } from './protocol.js';
3
+ /**
4
+ * A mix's marks from `backMs` behind now, within its history, to `AHEAD_CAP_MS` ahead. `marks`
5
+ * speaks the host's clock and the plots the mix's: a mark's lead on the last sync, at the mix's
6
+ * rate, is its lead on now.
7
+ */
8
+ export declare function marksOf(e: Watched, backMs: number): MarkInfo[];
package/dist/offer.d.ts CHANGED
@@ -1,12 +1,15 @@
1
+ import type { Screen } from './circles.js';
1
2
  /** What an app can tell any panel on the page about subjects the DOM cannot see. */
2
3
  export interface Offer {
3
4
  /** The subject under a point in client coordinates. */
4
5
  pick?: (x: number, y: number) => unknown;
5
6
  /** Where a subject is on screen, in client coordinates. */
6
7
  outline?: (subject: unknown) => DOMRect | undefined;
8
+ /** Where a point in the mix's positions is on screen, in client coordinates. */
9
+ screen?: Screen;
7
10
  }
8
11
  /**
9
- * Hands the app's own `pick` and `outline` to whatever panel inspects the page: one `mount()`
12
+ * Hands the app's own `pick`, `outline` and `screen` to whatever panel inspects the page: one `mount()`
10
13
  * put there, or the DevTools extension's. Kept on the page's global object, so it reaches a panel
11
14
  * bundled apart from the app. A later call replaces an earlier one.
12
15
  */
@@ -0,0 +1,5 @@
1
+ /** The box drawn over a subject on the page while it is hovered or picked from. */
2
+ export declare class Outline {
3
+ el: HTMLDivElement | null;
4
+ show(rect: DOMRect | undefined): void;
5
+ }
@@ -0,0 +1,16 @@
1
+ interface Hooks {
2
+ /** The mix that lists a subject, by id. */
3
+ owner(subject: unknown): number | undefined;
4
+ arming(on: boolean): void;
5
+ picked(subject: unknown, mix: number): void;
6
+ }
7
+ /** Picking a subject by clicking it on the page, and the outline drawn over it. */
8
+ export declare function picking(opts: {
9
+ pick?: (x: number, y: number) => unknown;
10
+ outline?: (subject: unknown) => DOMRect | undefined;
11
+ ignore?: Element;
12
+ }, hooks: Hooks): {
13
+ arm: (on: boolean) => void;
14
+ outline: (s: unknown) => void;
15
+ };
16
+ export {};
@@ -26,6 +26,8 @@ export interface VoiceInfo {
26
26
  state: string;
27
27
  /** Its weight on the picked subject, NaN with none picked. */
28
28
  weight: number;
29
+ /** Whether it is bounded, by `within` or an `around` weight. */
30
+ bounded: boolean;
29
31
  }
30
32
  /**
31
33
  * The picked subject in one frame: each numeric part of its pose by a flat key (`x`,
@@ -38,6 +40,20 @@ export interface Sample {
38
40
  /** The host did not read the subject this frame, so the panel read it. */
39
41
  read: boolean;
40
42
  }
43
+ /**
44
+ * A mark the plan knows, as `mix.marks` lists it: a voice's start, in, coast, out or end, one it
45
+ * placed inside itself, or one the host announced.
46
+ */
47
+ export interface MarkInfo {
48
+ /** On the mix clock, the plots' axis. */
49
+ at: number;
50
+ /** Which of a voice's marks; null for an announced one. */
51
+ mark: string | null;
52
+ /** The voice's id; null for an announced mark. */
53
+ voice: number | null;
54
+ name: string | null;
55
+ tags: string[];
56
+ }
41
57
  export interface HoldInfo {
42
58
  /** `elsewhere`: something other than this panel holds the clock. */
43
59
  state: 'free' | 'held' | 'elsewhere';
@@ -68,9 +84,19 @@ export type Event = {
68
84
  } | {
69
85
  kind: 'hold';
70
86
  hold: HoldInfo;
87
+ }
88
+ /** Every mark from as far back as the plots reach to `AHEAD_CAP_MS` ahead, earliest first. */
89
+ | {
90
+ kind: 'marks';
91
+ marks: MarkInfo[];
71
92
  } | {
72
93
  kind: 'arming';
73
94
  on: boolean;
95
+ }
96
+ /** Whether the page draws each bounded voice's circle. */
97
+ | {
98
+ kind: 'circles';
99
+ on: boolean;
74
100
  };
75
101
  export type Command = {
76
102
  kind: 'mix';
@@ -93,6 +119,9 @@ export type Command = {
93
119
  } | {
94
120
  kind: 'arm';
95
121
  on: boolean;
122
+ } | {
123
+ kind: 'circles';
124
+ on: boolean;
96
125
  } | {
97
126
  kind: 'outline';
98
127
  subject: number | null;
package/dist/store.d.ts CHANGED
@@ -2,6 +2,9 @@ import type { Sample } from './protocol.js';
2
2
  /** How much the plots keep: this much mix time, and never more frames than `cap`. */
3
3
  export declare const WINDOW_MS = 10000;
4
4
  export declare const CAP = 1200;
5
+ /** How far past now the axis always runs, ms of mix time, and how far a mark ahead can stretch it. */
6
+ export declare const AHEAD_MS = 2000;
7
+ export declare const AHEAD_CAP_MS = 30000;
5
8
  /**
6
9
  * The picked subject's samples, by mix time. A sample at the time of the last replaces it, as the
7
10
  * frames of a paused mix do; one behind it drops everything after it, as a seek back does.
@@ -4,6 +4,8 @@ export interface ChannelPlotProps {
4
4
  times: readonly number[];
5
5
  series: readonly Series[];
6
6
  playhead: number;
7
+ /** The span of time drawn; the samples' own span otherwise. */
8
+ range?: readonly [number, number];
7
9
  width?: number;
8
10
  height?: number;
9
11
  }
@@ -11,4 +13,4 @@ export interface ChannelPlotProps {
11
13
  * Values over time, one line per series, with a playhead: the plot the playground's inspector
12
14
  * and the panel both draw.
13
15
  */
14
- export declare function ChannelPlot({ label, times, series, playhead, width, height, }: ChannelPlotProps): import("react").JSX.Element;
16
+ export declare function ChannelPlot({ label, times, series, playhead, range: span, width, height, }: ChannelPlotProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import type { MarkInfo, VoiceInfo } from '../protocol.js';
2
+ export interface PlanProps {
3
+ marks: readonly MarkInfo[];
4
+ voices: readonly VoiceInfo[];
5
+ range: readonly [number, number];
6
+ playhead: number;
7
+ width?: number;
8
+ }
9
+ /**
10
+ * The plan on the plots' time axis: a lane per voice from its start to its end, an arrow where
11
+ * no end is known, a tick at each mark, and what the host announced across them all.
12
+ */
13
+ export declare function Plan({ marks, voices, range, playhead, width }: PlanProps): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { MarkInfo, VoiceInfo } from '../protocol.js';
2
+ import type { Samples } from '../store.js';
3
+ /** The plan, then the picked subject's channels and the voices' weights on it, on one time axis. */
4
+ export declare function Plots({ samples, drawn, voices, marks, playhead, picked, mix, }: {
5
+ samples: Samples;
6
+ drawn: number;
7
+ voices: VoiceInfo[];
8
+ marks: MarkInfo[];
9
+ playhead: number;
10
+ picked: boolean;
11
+ mix: boolean;
12
+ }): import("react").JSX.Element;
package/dist/ui/hue.d.ts CHANGED
@@ -1 +1,3 @@
1
1
  export declare const hueColor: (hue: number) => string;
2
+ /** A voice's hue, the same in every view that draws it. */
3
+ export declare const voiceHue: (id: number) => number;
@@ -0,0 +1,25 @@
1
+ import type { MarkInfo, VoiceInfo } from '../protocol.js';
2
+ /** One voice's row in the plan. */
3
+ export interface Lane {
4
+ voice: number;
5
+ label: string;
6
+ hue: number;
7
+ marks: MarkInfo[];
8
+ /** Its start, or -Infinity where that lies before what was listed. */
9
+ from: number;
10
+ /** Its end, or Infinity where none is known: it loops for good, or ends past the cap. */
11
+ to: number;
12
+ }
13
+ /**
14
+ * The plan by voice, earliest start first: a lane for each voice with a mark listed and each
15
+ * playing on with none, and the marks the host announced.
16
+ */
17
+ export declare function lanesOf(marks: readonly MarkInfo[], voices: readonly VoiceInfo[]): {
18
+ lanes: Lane[];
19
+ announced: MarkInfo[];
20
+ };
21
+ /**
22
+ * The span the plan and plots share: back to the first sample, or the earliest mark within the
23
+ * plots' window, and ahead `AHEAD_MS`, stretched to the furthest mark up to `AHEAD_CAP_MS`.
24
+ */
25
+ export declare function axisOf(head: number, times: readonly number[], marks: readonly MarkInfo[]): [number, number];
@@ -0,0 +1,2 @@
1
+ /** A clock reading in ms as `12.34s`, `1:05.20`, or `2:03:07.50`; `—` for one that isn't finite. */
2
+ export declare function clockText(ms: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@msb235/blits-panel",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "A debugger window for blits: every mix on the page, its voices and subjects, channels plotted over time, and a clock to pause, step and scrub",
5
5
  "keywords": [
6
6
  "blits",
@@ -45,12 +45,12 @@
45
45
  "@weasel-js/ui": "1.12.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "@msb235/blits": "^0.12.0",
48
+ "@msb235/blits": "^0.15.0",
49
49
  "react": "^19.3.0",
50
50
  "react-dom": "^19.3.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@msb235/blits": "0.12.0",
53
+ "@msb235/blits": "0.15.0",
54
54
  "@types/react": "^19.3.0",
55
55
  "@types/react-dom": "^19.3.0",
56
56
  "@vitejs/plugin-react": "^6.0.0",