@msb235/blits-panel 0.9.0 → 1.1.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/CHANGELOG.md CHANGED
@@ -1,9 +1,24 @@
1
1
  # Changelog
2
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
3
+ This package follows [semver](https://semver.org) and shares the engine's version: each release of
4
+ `@msb235/blits` releases this package at the same number, and the release workflow refuses a
5
+ `panel-v*` tag that differs from it. Before 1.1.0, a breaking change bumped the minor version and
6
+ everything else the patch. The release workflow refuses a `panel-v*` tag with no
5
7
  section here.
6
8
 
9
+ ## 1.1.0
10
+
11
+ ### Breaking
12
+
13
+ - Released in lockstep with `@msb235/blits`, so 0.9.0 is followed by 1.1.0.
14
+ - `@msb235/blits` is a peer at `^1.1.0`, where it was `^1.0.0`. The plan's lanes need the `track` it
15
+ reports.
16
+
17
+ ### Added
18
+
19
+ - The plan draws a lane per `track`, each of its voices a bar on it, and a lane of its own for a
20
+ voice with none. The lane cap and its "more" count now count lanes, not voices.
21
+
7
22
  ## 0.9.0
8
23
 
9
24
  ### Breaking
package/README.md CHANGED
@@ -37,6 +37,9 @@ gives back any clock it holds.
37
37
  `scaleY`); any other channel is one plot per number.
38
38
  A plot is marked "read, not shown" when the app did not read the subject that frame, so the
39
39
  panel read it.
40
+ - **The plan**, above the plots: what the mix has scheduled around now, a lane per voice
41
+ `track` with each of its voices a bar on it, and a lane of its own for a voice with none. A
42
+ tick marks each of a voice's marks, and a dashed line each mark the host announced.
40
43
  - **◯ circles**, beside the voices: draws each bounded voice's circle (its `within`, or its
41
44
  `around` weight's) on the page, in the voice's hue. A bounded voice is marked ◯ in the list.
42
45
 
package/dist/index.js CHANGED
@@ -110,7 +110,8 @@ function k(e, t) {
110
110
  mark: e.mark ?? null,
111
111
  voice: e.voice ?? null,
112
112
  name: e.name ?? null,
113
- tags: [...e.tags]
113
+ tags: [...e.tags],
114
+ track: e.track ?? null
114
115
  }));
115
116
  } catch {
116
117
  return [];
@@ -258,6 +259,7 @@ function B(e = {}) {
258
259
  n = {
259
260
  name: r?.name ?? null,
260
261
  tags: [...r?.tags ?? []],
262
+ track: r?.track ?? null,
261
263
  within: r?.within
262
264
  }, m.set(t.id, n);
263
265
  }
@@ -269,6 +271,7 @@ function B(e = {}) {
269
271
  id: t.id,
270
272
  name: n.name,
271
273
  tags: n.tags,
274
+ track: n.track,
272
275
  state: t.state,
273
276
  weight: r,
274
277
  bounded: n.within !== void 0
@@ -688,28 +691,47 @@ var ue = /* @__PURE__ */ new Set([
688
691
  "fading"
689
692
  ]);
690
693
  function de(e, t) {
691
- let n = new Map(t.map((e) => [e.id, e.name])), r = /* @__PURE__ */ new Map(), i = (e, t) => {
692
- let i = r.get(e);
693
- return i === void 0 && (i = {
694
- voice: e,
695
- label: n.get(e) ?? t ?? `#${e}`,
696
- hue: y(e),
697
- marks: [],
698
- from: -Infinity,
699
- to: Infinity
700
- }, r.set(e, i)), i;
694
+ let n = new Map(t.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map(), i = (e, t, i) => {
695
+ let a = r.get(e);
696
+ if (a === void 0) {
697
+ let o = n.get(e);
698
+ a = {
699
+ span: {
700
+ voice: e,
701
+ label: o?.name ?? t ?? `#${e}`,
702
+ marks: [],
703
+ from: -Infinity,
704
+ to: Infinity
705
+ },
706
+ track: o?.track ?? i
707
+ }, r.set(e, a);
708
+ }
709
+ return a.span;
701
710
  }, a = [];
702
711
  for (let t of e) {
703
712
  if (t.voice === null) {
704
713
  a.push(t);
705
714
  continue;
706
715
  }
707
- let e = i(t.voice, t.name);
716
+ let e = i(t.voice, t.name, t.track);
708
717
  e.marks.push(t), t.mark === "start" && (e.from = t.at), t.mark === "end" && (e.to = t.at);
709
718
  }
710
- for (let e of t) ue.has(e.state) && i(e.id, e.name);
711
- return {
712
- lanes: [...r.values()].sort((e, t) => e.from - t.from || e.voice - t.voice),
719
+ for (let e of t) ue.has(e.state) && i(e.id, e.name, e.track);
720
+ let o = /* @__PURE__ */ new Map();
721
+ for (let { span: e, track: t } of r.values()) {
722
+ let n = t ?? `#${e.voice}`, r = o.get(n);
723
+ r === void 0 && (r = {
724
+ key: n,
725
+ label: t ?? e.label,
726
+ hue: y(e.voice),
727
+ spans: [],
728
+ from: e.from
729
+ }, o.set(n, r)), r.spans.push(e), r.from = Math.min(r.from, e.from);
730
+ }
731
+ let s = [...o.values()];
732
+ for (let e of s) e.spans.sort((e, t) => e.from - t.from || e.voice - t.voice);
733
+ return s.sort((e, t) => e.from - t.from || (e.spans[0]?.voice ?? 0) - (t.spans[0]?.voice ?? 0)), {
734
+ lanes: s,
713
735
  announced: a
714
736
  };
715
737
  }
@@ -746,7 +768,7 @@ function _e({ marks: e, voices: t, range: n, playhead: r, width: i = 320 }) {
746
768
  children: [
747
769
  "plan",
748
770
  h > 0 ? `, ${Y(h)} ahead` : "",
749
- s.length > u.length && ` · ${s.length - u.length} more voices`
771
+ s.length > u.length && ` · ${s.length - u.length} more lanes`
750
772
  ]
751
773
  }),
752
774
  /* @__PURE__ */ _("svg", {
@@ -774,7 +796,7 @@ function _e({ marks: e, voices: t, range: n, playhead: r, width: i = 320 }) {
774
796
  x: d,
775
797
  xMin: a,
776
798
  xMax: o
777
- }, e.voice)),
799
+ }, e.key)),
778
800
  l.map((e) => /* @__PURE__ */ g("line", {
779
801
  className: "bp-plan-said",
780
802
  x1: d(e.at),
@@ -790,7 +812,7 @@ function _e({ marks: e, voices: t, range: n, playhead: r, width: i = 320 }) {
790
812
  x: 2,
791
813
  y: 10,
792
814
  children: "announced"
793
- }), ye(l, d).map(({ m: e, show: t }) => /* @__PURE__ */ _("g", { children: [/* @__PURE__ */ g("path", {
815
+ }), be(l, d).map(({ m: e, show: t }) => /* @__PURE__ */ _("g", { children: [/* @__PURE__ */ g("path", {
794
816
  d: `M${d(e.at)} 12l4 4l-4 4l-4 -4z`,
795
817
  fill: "var(--wzl-fg)",
796
818
  "aria-label": Z(e),
@@ -815,39 +837,52 @@ function _e({ marks: e, voices: t, range: n, playhead: r, width: i = 320 }) {
815
837
  });
816
838
  }
817
839
  function ve({ lane: e, y: t, x: n, xMin: r, xMax: i }) {
818
- let a = v(e.hue), o = n(e.from), s = !(e.to <= i), c = s ? n(i) - 6 : n(e.to), l = e.to === Infinity ? "no end known: plays on" : `gone at ${Y(e.to)}`;
840
+ let a = v(e.hue), o = n(e.from);
819
841
  return /* @__PURE__ */ _("g", {
820
842
  transform: `translate(0 ${t})`,
821
- "aria-label": `${e.label}: ${l}`,
843
+ "aria-label": e.label,
844
+ children: [/* @__PURE__ */ g("text", {
845
+ className: "bp-plan-name",
846
+ x: Math.max(2, Math.min(o, n(i) - 60)) + 2,
847
+ y: 9,
848
+ children: e.label
849
+ }), e.spans.map((e) => /* @__PURE__ */ g(ye, {
850
+ span: e,
851
+ color: a,
852
+ x: n,
853
+ xMin: r,
854
+ xMax: i
855
+ }, e.voice))]
856
+ });
857
+ }
858
+ function ye({ span: e, color: t, x: n, xMin: r, xMax: i }) {
859
+ let a = n(e.from), o = !(e.to <= i), s = o ? n(i) - 6 : n(e.to), c = e.to === Infinity ? "no end known: plays on" : `gone at ${Y(e.to)}`;
860
+ return /* @__PURE__ */ _("g", {
861
+ "aria-label": `${e.label}: ${c}`,
822
862
  children: [
823
- /* @__PURE__ */ g("text", {
824
- className: "bp-plan-name",
825
- x: Math.max(2, Math.min(o, n(i) - 60)) + 2,
826
- y: 9,
827
- children: e.label
828
- }),
829
- c > o && /* @__PURE__ */ g("rect", {
863
+ s > a && /* @__PURE__ */ g("rect", {
830
864
  className: "bp-plan-bar",
831
- x: o,
865
+ x: a,
832
866
  y: 13,
833
- width: c - o,
867
+ width: s - a,
834
868
  height: 5,
835
- fill: a
869
+ fill: t,
870
+ children: /* @__PURE__ */ g("title", { children: `${e.label}: ${c}` })
836
871
  }),
837
- s && /* @__PURE__ */ g("path", {
838
- d: `M${c} 10l6 5.5l-6 5.5z`,
839
- fill: a,
840
- children: /* @__PURE__ */ g("title", { children: l })
872
+ o && /* @__PURE__ */ g("path", {
873
+ d: `M${s} 10l6 5.5l-6 5.5z`,
874
+ fill: t,
875
+ children: /* @__PURE__ */ g("title", { children: c })
841
876
  }),
842
- ye(e.marks.filter((e) => e.at >= r && e.at <= i), n).map(({ m: e, show: t }) => /* @__PURE__ */ _("g", { children: [/* @__PURE__ */ g("line", {
877
+ be(e.marks.filter((e) => e.at >= r && e.at <= i), n).map(({ m: e, show: r }) => /* @__PURE__ */ _("g", { children: [/* @__PURE__ */ g("line", {
843
878
  className: "bp-plan-tick",
844
879
  x1: n(e.at),
845
880
  x2: n(e.at),
846
881
  y1: 10,
847
882
  y2: 21,
848
- stroke: a,
883
+ stroke: t,
849
884
  children: /* @__PURE__ */ g("title", { children: Z(e) })
850
- }), t && /* @__PURE__ */ g("text", {
885
+ }), r && /* @__PURE__ */ g("text", {
851
886
  className: "bp-plan-text",
852
887
  x: n(e.at) + 2,
853
888
  y: 28,
@@ -856,7 +891,7 @@ function ve({ lane: e, y: t, x: n, xMin: r, xMax: i }) {
856
891
  ]
857
892
  });
858
893
  }
859
- function ye(e, t) {
894
+ function be(e, t) {
860
895
  let n = -Infinity;
861
896
  return e.map((e) => {
862
897
  let r = t(e.at), i = (e.voice === null ? e.name : e.mark) ?? "", a = r >= n;
@@ -871,7 +906,7 @@ function Z(e) {
871
906
  }
872
907
  //#endregion
873
908
  //#region src/ui/Plots.tsx
874
- function be({ samples: e, drawn: t, voices: n, marks: r, playhead: i, picked: a, mix: o }) {
909
+ function xe({ samples: e, drawn: t, voices: n, marks: r, playhead: i, picked: a, mix: o }) {
875
910
  let { times: s, values: c, colors: u, weights: d, read: f } = l(() => e.series(), [e, t]), p = Number.isFinite(i) ? i : s[s.length - 1] ?? NaN, m = fe(p, a ? s : [], r), h = o && /* @__PURE__ */ g(_e, {
876
911
  marks: r,
877
912
  voices: n,
@@ -926,7 +961,7 @@ function be({ samples: e, drawn: t, voices: n, marks: r, playhead: i, picked: a,
926
961
  }
927
962
  //#endregion
928
963
  //#region src/ui/Panel.tsx
929
- var xe = {
964
+ var Se = {
930
965
  mixes: [],
931
966
  mix: null,
932
967
  subject: null,
@@ -943,7 +978,7 @@ var xe = {
943
978
  circles: !1,
944
979
  drawn: 0
945
980
  };
946
- function Se(e, t) {
981
+ function Ce(e, t) {
947
982
  switch (t.kind) {
948
983
  case "mixes": return {
949
984
  ...e,
@@ -986,17 +1021,17 @@ function Se(e, t) {
986
1021
  default: return e;
987
1022
  }
988
1023
  }
989
- var Ce = [
1024
+ var we = [
990
1025
  0,
991
1026
  .1,
992
1027
  .25,
993
1028
  .5,
994
1029
  1,
995
1030
  2
996
- ], we = 1e3 / 60, Te = "blits-panel:place";
997
- function Ee() {
1031
+ ], Te = 1e3 / 60, Ee = "blits-panel:place";
1032
+ function De() {
998
1033
  try {
999
- let e = JSON.parse(localStorage.getItem(Te) ?? "null");
1034
+ let e = JSON.parse(localStorage.getItem(Ee) ?? "null");
1000
1035
  if (e && typeof e.x == "number" && typeof e.y == "number") return e;
1001
1036
  } catch {}
1002
1037
  return {
@@ -1005,24 +1040,24 @@ function Ee() {
1005
1040
  open: !1
1006
1041
  };
1007
1042
  }
1008
- function De(e) {
1043
+ function Oe(e) {
1009
1044
  try {
1010
- localStorage.setItem(Te, JSON.stringify(e));
1045
+ localStorage.setItem(Ee, JSON.stringify(e));
1011
1046
  } catch {}
1012
1047
  }
1013
- function Oe(e, t) {
1048
+ function ke(e, t) {
1014
1049
  let n = typeof innerWidth == "number" ? innerWidth : 1024, r = typeof innerHeight == "number" ? innerHeight : 768;
1015
1050
  return {
1016
1051
  x: Math.min(Math.max(0, e), Math.max(0, n - 120)),
1017
1052
  y: Math.min(Math.max(0, t), Math.max(0, r - 40))
1018
1053
  };
1019
1054
  }
1020
- function ke({ source: e, docked: t = !1, bar: n }) {
1021
- let [r, i] = u(Se, xe), a = d(new O()), [o, c] = f(() => {
1022
- let e = Ee();
1055
+ function Ae({ source: e, docked: t = !1, bar: n }) {
1056
+ let [r, i] = u(Ce, Se), a = d(new O()), [o, c] = f(() => {
1057
+ let e = De();
1023
1058
  return {
1024
1059
  ...e,
1025
- ...Oe(e.x, e.y)
1060
+ ...ke(e.x, e.y)
1026
1061
  };
1027
1062
  }), [l, p] = f(""), [m, v] = f(null);
1028
1063
  s(() => {
@@ -1059,10 +1094,10 @@ function ke({ source: e, docked: t = !1, bar: n }) {
1059
1094
  S && r.hold.now > y.current && (y.current = r.hold.now), S || (y.current = -Infinity);
1060
1095
  let C = (e, t = o.x, n = o.y) => {
1061
1096
  let r = {
1062
- ...Oe(t, n),
1097
+ ...ke(t, n),
1063
1098
  open: e
1064
1099
  };
1065
- c(r), De(r);
1100
+ c(r), Oe(r);
1066
1101
  }, w = (e) => {
1067
1102
  if (e.target.closest("button, select, input")) return;
1068
1103
  let t = {
@@ -1092,7 +1127,7 @@ function ke({ source: e, docked: t = !1, bar: n }) {
1092
1127
  title: "step one frame",
1093
1128
  onClick: () => b({
1094
1129
  kind: "step",
1095
- ms: we
1130
+ ms: Te
1096
1131
  }),
1097
1132
  children: "⏭"
1098
1133
  }),
@@ -1172,7 +1207,7 @@ function ke({ source: e, docked: t = !1, bar: n }) {
1172
1207
  kind: "rate",
1173
1208
  rate: Number(e.currentTarget.value)
1174
1209
  }),
1175
- children: Ce.map((e) => /* @__PURE__ */ _("option", {
1210
+ children: we.map((e) => /* @__PURE__ */ _("option", {
1176
1211
  value: e,
1177
1212
  children: ["×", e]
1178
1213
  }, e))
@@ -1190,7 +1225,7 @@ function ke({ source: e, docked: t = !1, bar: n }) {
1190
1225
  })
1191
1226
  ]
1192
1227
  }),
1193
- x !== void 0 && /* @__PURE__ */ g(Ae, {
1228
+ x !== void 0 && /* @__PURE__ */ g(je, {
1194
1229
  mix: x,
1195
1230
  hold: r.hold
1196
1231
  }),
@@ -1284,7 +1319,7 @@ function ke({ source: e, docked: t = !1, bar: n }) {
1284
1319
  }, e.id))
1285
1320
  })
1286
1321
  ]
1287
- }), /* @__PURE__ */ g(be, {
1322
+ }), /* @__PURE__ */ g(xe, {
1288
1323
  samples: a.current,
1289
1324
  drawn: r.drawn,
1290
1325
  voices: r.voices,
@@ -1297,7 +1332,7 @@ function ke({ source: e, docked: t = !1, bar: n }) {
1297
1332
  ]
1298
1333
  });
1299
1334
  }
1300
- function Ae({ mix: e, hold: t }) {
1335
+ function je({ mix: e, hold: t }) {
1301
1336
  let n = e.history, r = n === null ? "no history: made before the panel, or the panel was told not to add it, so it only pauses and steps forward" : n.tape ? n.added ? `history: ${(n.ms / 1e3).toFixed(0)} s, added by the debugger` : `history: ${(n.ms / 1e3).toFixed(0)} s, its own` : "no tape: it only pauses and steps forward";
1302
1337
  return /* @__PURE__ */ _("p", {
1303
1338
  className: "bp-note",
@@ -1306,7 +1341,7 @@ function Ae({ mix: e, hold: t }) {
1306
1341
  }
1307
1342
  //#endregion
1308
1343
  //#region src/mount.tsx
1309
- function je(e = {}) {
1344
+ function Me(e = {}) {
1310
1345
  let t = r(), n = t.history, s = e.history ?? (n === void 0 && 1e4), c = s === !1 ? void 0 : {
1311
1346
  ms: s,
1312
1347
  tape: i
@@ -1332,7 +1367,7 @@ function je(e = {}) {
1332
1367
  p.render(/* @__PURE__ */ g(a, {
1333
1368
  selection: { mode: "auto" },
1334
1369
  className: "bp-root",
1335
- children: /* @__PURE__ */ g(ke, { source: f })
1370
+ children: /* @__PURE__ */ g(Ae, { source: f })
1336
1371
  }));
1337
1372
  let m = !1;
1338
1373
  return () => {
@@ -1347,7 +1382,7 @@ function Q(e) {
1347
1382
  function $(e) {
1348
1383
  return JSON.parse(e, (e, t) => typeof t == "object" && t && typeof t.$n == "string" && Object.keys(t).length === 1 ? Number(t.$n) : t);
1349
1384
  }
1350
- function Me(e) {
1385
+ function Ne(e) {
1351
1386
  let t = /* @__PURE__ */ new Set(), n = e.listen((e) => {
1352
1387
  let n = $(e);
1353
1388
  if ("e" in n) for (let e of [...t]) e(n.e);
@@ -1369,7 +1404,7 @@ function Me(e) {
1369
1404
  }
1370
1405
  };
1371
1406
  }
1372
- function Ne(e, t) {
1407
+ function Pe(e, t) {
1373
1408
  let n = () => {}, r = () => {
1374
1409
  n(), n = e.subscribe((e) => t.send(Q({ e })));
1375
1410
  }, i = t.listen((t) => {
@@ -1381,6 +1416,6 @@ function Ne(e, t) {
1381
1416
  };
1382
1417
  }
1383
1418
  //#endregion
1384
- export { D as AHEAD_CAP_MS, E as AHEAD_MS, T as CAP, K as ChannelPlot, le as ColorStrip, ke as Panel, O as Samples, w as WINDOW_MS, B as agent, I as colorsOf, $ as decode, Q as encode, F as flatten, v as hueColor, je as mount, ee as offer, V as panelStyles, L as readPose, Ne as serve, Me as wireSource };
1419
+ export { D as AHEAD_CAP_MS, E as AHEAD_MS, T as CAP, K as ChannelPlot, le as ColorStrip, Ae as Panel, O as Samples, w as WINDOW_MS, B as agent, I as colorsOf, $ as decode, Q as encode, F as flatten, v as hueColor, Me as mount, ee as offer, V as panelStyles, L as readPose, Pe as serve, Ne as wireSource };
1385
1420
 
1386
1421
  //# sourceMappingURL=index.js.map