@msb235/blits-panel 0.0.0-stage → 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ This package follows [semver](https://semver.org). Below 1.0.0, a breaking change bumps the minor
4
+ version and everything else the patch. The release workflow refuses a `panel-v*` tag with no
5
+ section here.
6
+
7
+ ## 0.1.1
8
+
9
+ The first version on npm: 0.1.0 can never be published there.
10
+
11
+ ### Added
12
+
13
+ - `mount()`: a debugger window on the page for every blits mix on it. It starts as a pill in a
14
+ corner with the clock controls, and opens into a window with the mix's subjects and voices and
15
+ the picked subject's channels plotted over the last 10 s. It holds a mix's clock to pause, step
16
+ and scrub it, and picks a subject from a list or by clicking it on the page. Mixes made after it
17
+ keep 10 s of history so they can scrub back.
18
+ - `agent()` and the `Source` protocol: the page side of the panel, speaking only plain data, so a
19
+ DevTools extension can host the same window across a message channel.
20
+ - `ChannelPlot`, the plot the window draws, which the blits playground draws too.
21
+ - `offer({ pick, outline })`: an app hands its own picking to whatever panel inspects the page,
22
+ the in-page one or the DevTools extension's.
23
+ - `Panel`, with a `docked` layout and a `bar` slot for a host's own controls, `panelStyles`, and
24
+ `wireSource` and `serve`, which carry the panel's protocol over any string channel.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Michael Baker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,74 @@
1
- # Temporary Holding Version
1
+ # @msb235/blits-panel
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A debugger window for [blits](https://github.com/orochi235/blits). It finds every mix on the page,
4
+ plots the channels of a subject you pick, and takes a mix's clock so you can pause it, step it a
5
+ frame at a time and scrub it back and forth.
6
+
7
+ ```sh
8
+ npm install -D @msb235/blits-panel
9
+ ```
10
+
11
+ ```ts
12
+ import { mount } from '@msb235/blits-panel';
13
+
14
+ if (import.meta.env.DEV) mount();
15
+ // …then make your mixes.
16
+ ```
17
+
18
+ Call `mount()` before the app makes its mixes. Mixes made after it keep 10 s of history, which
19
+ scrubbing back needs; a mix made earlier can only be paused and stepped forward. The panel says
20
+ which applies to the mix you are looking at.
21
+
22
+ The panel lives in a shadow root, so the app's styles and the panel's stay apart, and it works
23
+ whatever the app is built with. `mount()` returns a function that takes it off the page again and
24
+ gives back any clock it holds.
25
+
26
+ ## What it shows
27
+
28
+ - **The pill:** the mix's name, hold (⏸), step (⏭), a scrub bar, ⤢ to open the window, and the
29
+ mix clock.
30
+ - **The window:**
31
+ - **Top bar:** a mix picker, the same clock controls, and a rate for a held mix.
32
+ - **Left side:** the mix's subjects, which you can filter, and its voices with their state and
33
+ their weight on the picked subject.
34
+ - **Right side:** one plot per number in the picked subject's pose, then each voice's weight.
35
+ A plot is marked "read, not shown" when the app did not read the subject that frame, so the
36
+ panel read it.
37
+
38
+ Holding a mix holds every mix on the same transport. Nothing the panel does while holding goes on
39
+ the mix's tape, and freeing the hold lets the mix carry on from where the panel left it.
40
+
41
+ ## Picking a subject
42
+
43
+ Pick from the list, or press **◎ pick** and click the subject on the page; Escape cancels. A
44
+ subject that is a DOM element, or contains the element you click, is found on its own. For
45
+ anything the DOM cannot see, such as a three.js object, pass the app's own lookup:
46
+
47
+ ```ts
48
+ mount({
49
+ pick: (x, y) => objectUnderPointer(x, y), // client coordinates in, a subject out
50
+ outline: (subject) => screenBoxOf(subject), // optional: a DOMRect to outline it by
51
+ });
52
+ ```
53
+
54
+ `offer({ pick, outline })` hands over the same two functions without mounting anything, so the
55
+ blits DevTools extension can pick in the scene too.
56
+
57
+ Subjects are named by the mix's `labelOf` option where it has one, and otherwise by their `name`
58
+ or `id`, a DOM element's tag, or their class and a number.
59
+
60
+ ## Options
61
+
62
+ | Option | Default | What it does |
63
+ |---|---|---|
64
+ | `history` | `10000` | How far back mixes made after `mount()` can scrub, in ms. `false` adds no history. |
65
+ | `pick` | none | Finds the subject under a point, for subjects the DOM cannot see. |
66
+ | `outline` | none | Where a subject is on screen, so hovering it can outline it. |
67
+
68
+ ## The two halves
69
+
70
+ The window never touches a mix. It talks to a `Source`: events up from the page and commands
71
+ down to it, all plain data. `agent()` is the page side and `Panel` the window. `mount()` joins
72
+ them in one page. Across a channel, `serve(agent(), wire)` runs on the page side and
73
+ `wireSource(wire)` on the panel's, where a `Wire` is anything that sends and receives strings; the
74
+ blits DevTools extension in `apps/devtools` does this.
@@ -0,0 +1,19 @@
1
+ import type { Source } from './protocol.js';
2
+ /** What the page side of the panel can be told about the app; `offer()` tells it the same from afar. */
3
+ export interface AgentOptions {
4
+ /** The subject under a point in client coordinates, for scenes the DOM cannot see into. */
5
+ pick?: (x: number, y: number) => unknown;
6
+ /** Where a subject is on screen, in client coordinates; a DOM element's own box otherwise. */
7
+ outline?: (subject: unknown) => DOMRect | undefined;
8
+ /** The panel's own element: picking on the page passes over it. */
9
+ ignore?: Element;
10
+ }
11
+ /** Each numeric part of a pose under a flat key: `x`, `position[1]`, `color.l`. */
12
+ export declare function flatten(pose: unknown, out?: Record<string, number>, key?: string, depth?: number): Record<string, number>;
13
+ /**
14
+ * The page side of the panel: finds the mixes, watches the one picked, holds its clock, and picks
15
+ * and outlines subjects on the page. Speaks only in the protocol's plain data.
16
+ */
17
+ export declare function agent(opts?: AgentOptions): Source & {
18
+ dispose(): void;
19
+ };
@@ -0,0 +1,11 @@
1
+ export { type AgentOptions, agent, flatten } from './agent.js';
2
+ export { type MountOptions, mount } from './mount.js';
3
+ export { type Offer, offer } from './offer.js';
4
+ export type { Command, Event, HoldInfo, MixInfo, Sample, Source, SubjectInfo, VoiceInfo, } from './protocol.js';
5
+ export { CAP, Samples, WINDOW_MS } from './store.js';
6
+ export { panelStyles } from './styles.js';
7
+ export { ChannelPlot, type ChannelPlotProps } from './ui/ChannelPlot.js';
8
+ export { hueColor } from './ui/hue.js';
9
+ export { Panel, type PanelProps } from './ui/Panel.js';
10
+ export type { Series } from './ui/path.js';
11
+ export { decode, encode, serve, type Wire, wireSource } from './wire.js';