@gjermundgaraba-designs/pixel-paper 0.18.0 → 0.19.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.
@@ -23,6 +23,7 @@ import {
23
23
  movedPointer,
24
24
  phaseOf,
25
25
  pressedDraggable,
26
+ pressingPointer,
26
27
  releasedPointer,
27
28
  } from "../drag/drag.ts";
28
29
  import * as Glyph from "../glyph/glyph.ts";
@@ -472,23 +473,14 @@ const pointerAt = (hold: PointerHold, event: PointerEvent): PointerAt => ({
472
473
  });
473
474
 
474
475
  /** The pressing pointer's moves, release and cancel; another pointer's are not the list's. */
475
- export const pointerMessages = (hold: PointerHold): Stream.Stream<Message> => {
476
- const fromPressing = (type: "pointermove" | "pointerup" | "pointercancel") =>
477
- Stream.fromEventListener<PointerEvent>(document, type).pipe(
478
- Stream.filter((event) => event.pointerId === hold.pointerId),
479
- );
480
-
481
- const streams: ReadonlyArray<Stream.Stream<Message>> = [
482
- Stream.map(fromPressing("pointermove"), (event) =>
483
- Message.MovedPointer(pointerAt(hold, event)),
484
- ),
485
- Stream.map(fromPressing("pointerup"), (event) =>
486
- Message.ReleasedPointer(pointerAt(hold, event)),
476
+ export const pointerMessages = (hold: PointerHold): Stream.Stream<Message> =>
477
+ Stream.map(pressingPointer(hold.pointerId), (event) =>
478
+ Match.value(event.type).pipe(
479
+ Match.when("pointermove", () => Message.MovedPointer(pointerAt(hold, event))),
480
+ Match.when("pointerup", () => Message.ReleasedPointer(pointerAt(hold, event))),
481
+ Match.orElse(() => Message.CancelledPointer()),
487
482
  ),
488
- Stream.map(fromPressing("pointercancel"), () => Message.CancelledPointer()),
489
- ];
490
- return Stream.mergeAll(streams, { concurrency: "unbounded" });
491
- };
483
+ );
492
484
 
493
485
  const ownSubscriptions = Subscription.make<Model, Message>()((entry) => ({
494
486
  pointer: entry(
package/src/tokens.css CHANGED
@@ -139,6 +139,11 @@
139
139
  --shadow-pressed: 1px 1px 0 var(--shadow-color);
140
140
  --shadow-danger: 3px 3px 0 var(--shadow-danger-color);
141
141
 
142
+ /* ---------- the reel: a scrolling row of columns of panes ---------- */
143
+ --reel-gutter: 16px; /* between columns, and between the panes of a column */
144
+ --reel-column-min: 280px; /* the narrowest a column prints, whatever its width */
145
+ --reel-pane-min: 120px; /* the shortest a pane prints */
146
+
142
147
  /* ---------- charts ---------- */
143
148
  --chart-plot: 160px; /* a line chart's plot, between its top line and its axis */
144
149
 
@@ -14,6 +14,8 @@ export type ViewConfig<Message> = Readonly<{
14
14
  id: string;
15
15
  /** Pixel caps in the inverted title bar. */
16
16
  title: string;
17
+ /** A quiet IconButton before the kind glyph: a Reel's grip. */
18
+ lead?: ReadonlyArray<Html>;
17
19
  /** What kind of thing it is: a terminal, a note, a machine. */
18
20
  glyph?: GlyphName;
19
21
  /** A chip in the title bar: its state. */
@@ -36,6 +38,7 @@ export const view = <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Messag
36
38
  const {
37
39
  id,
38
40
  title,
41
+ lead = [],
39
42
  glyph,
40
43
  status = [],
41
44
  tools = [],
@@ -55,6 +58,7 @@ export const view = <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Messag
55
58
  h.header(
56
59
  [h.Class("panel-tb")],
57
60
  [
61
+ ...slotView("span", "panel-lead", lead, h),
58
62
  ...(glyph === undefined ? [] : [Glyph.view({ name: glyph }, h)]),
59
63
  h.h2([h.Id(titleId(id))], [title]),
60
64
  ...status,