@gjermundgaraba-designs/pixel-paper 0.17.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.
Files changed (57) hide show
  1. package/DESIGN.md +41 -12
  2. package/dist/src/drag/drag.d.ts +3 -0
  3. package/dist/src/drag/drag.d.ts.map +1 -1
  4. package/dist/src/drag/drag.js +14 -10
  5. package/dist/src/glyph/glyph.d.ts +3 -1
  6. package/dist/src/glyph/glyph.d.ts.map +1 -1
  7. package/dist/src/glyph/glyph.js +2 -1
  8. package/dist/src/glyph/glyphs.d.ts +3 -0
  9. package/dist/src/glyph/glyphs.d.ts.map +1 -1
  10. package/dist/src/glyph/glyphs.js +4 -3
  11. package/dist/src/identity/identity.d.ts +2 -0
  12. package/dist/src/identity/identity.d.ts.map +1 -1
  13. package/dist/src/identity/identity.js +8 -2
  14. package/dist/src/index.d.ts +1 -0
  15. package/dist/src/index.d.ts.map +1 -1
  16. package/dist/src/index.js +1 -0
  17. package/dist/src/meter/meter.d.ts +5 -1
  18. package/dist/src/meter/meter.d.ts.map +1 -1
  19. package/dist/src/meter/meter.js +15 -3
  20. package/dist/src/monogram/monogram.d.ts +7 -2
  21. package/dist/src/monogram/monogram.d.ts.map +1 -1
  22. package/dist/src/monogram/monogram.js +24 -6
  23. package/dist/src/panel/panel.d.ts +5 -1
  24. package/dist/src/panel/panel.d.ts.map +1 -1
  25. package/dist/src/panel/panel.js +7 -3
  26. package/dist/src/reel/index.d.ts +4 -0
  27. package/dist/src/reel/index.d.ts.map +1 -0
  28. package/dist/src/reel/index.js +2 -0
  29. package/dist/src/reel/layout.d.ts +180 -0
  30. package/dist/src/reel/layout.d.ts.map +1 -0
  31. package/dist/src/reel/layout.js +370 -0
  32. package/dist/src/reel/reel.d.ts +1158 -0
  33. package/dist/src/reel/reel.d.ts.map +1 -0
  34. package/dist/src/reel/reel.js +922 -0
  35. package/dist/src/sortable/sortable.d.ts +30 -30
  36. package/dist/src/sortable/sortable.d.ts.map +1 -1
  37. package/dist/src/sortable/sortable.js +2 -10
  38. package/dist/src/toast/toast.d.ts +12 -12
  39. package/dist/src/window/window.d.ts +2 -0
  40. package/dist/src/window/window.d.ts.map +1 -1
  41. package/dist/src/window/window.js +2 -1
  42. package/package.json +1 -1
  43. package/src/drag/drag.ts +19 -4
  44. package/src/glyph/glyph.ts +2 -1
  45. package/src/glyph/glyphs.ts +6 -4
  46. package/src/identity/identity.ts +10 -2
  47. package/src/index.ts +1 -0
  48. package/src/meter/meter.ts +18 -2
  49. package/src/monogram/monogram.ts +46 -6
  50. package/src/panel/panel.ts +21 -3
  51. package/src/pixel-paper.css +249 -2
  52. package/src/reel/index.ts +20 -0
  53. package/src/reel/layout.ts +602 -0
  54. package/src/reel/reel.ts +1597 -0
  55. package/src/sortable/sortable.ts +8 -16
  56. package/src/tokens.css +5 -0
  57. package/src/window/window.ts +4 -0
@@ -245,6 +245,8 @@ export declare const update: (model: Model, message: Message) => Readonly<{
245
245
  }>;
246
246
  };
247
247
  commands?: Update.Commands<{
248
+ readonly _tag: "PressedEscape";
249
+ } | {
248
250
  readonly _tag: "CancelledPointer";
249
251
  } | {
250
252
  readonly _tag: "CompletedAnnounceReorder";
@@ -253,6 +255,9 @@ export declare const update: (model: Model, message: Message) => Readonly<{
253
255
  } | {
254
256
  readonly _tag: "GotDragAndDropMessage";
255
257
  readonly message: {
258
+ readonly _tag: "PressedArrowKey";
259
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
260
+ } | {
256
261
  readonly _tag: "ActivatedKeyboardDrag";
257
262
  readonly itemId: string;
258
263
  readonly containerId: string;
@@ -279,9 +284,6 @@ export declare const update: (model: Model, message: Message) => Readonly<{
279
284
  readonly containerId: string;
280
285
  readonly index: number;
281
286
  }>;
282
- } | {
283
- readonly _tag: "PressedArrowKey";
284
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
285
287
  } | {
286
288
  readonly _tag: "PressedDraggable";
287
289
  readonly itemId: string;
@@ -299,8 +301,6 @@ export declare const update: (model: Model, message: Message) => Readonly<{
299
301
  readonly clientX: number;
300
302
  readonly clientY: number;
301
303
  readonly maybeIndex: Option.Option<number>;
302
- } | {
303
- readonly _tag: "PressedEscape";
304
304
  } | {
305
305
  readonly _tag: "PressedGripKey";
306
306
  readonly itemId: string;
@@ -413,6 +413,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
413
413
  }>;
414
414
  }>;
415
415
  }, {
416
+ readonly _tag: "PressedEscape";
417
+ } | {
416
418
  readonly _tag: "CancelledPointer";
417
419
  } | {
418
420
  readonly _tag: "CompletedAnnounceReorder";
@@ -421,6 +423,9 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
421
423
  } | {
422
424
  readonly _tag: "GotDragAndDropMessage";
423
425
  readonly message: {
426
+ readonly _tag: "PressedArrowKey";
427
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
428
+ } | {
424
429
  readonly _tag: "ActivatedKeyboardDrag";
425
430
  readonly itemId: string;
426
431
  readonly containerId: string;
@@ -447,9 +452,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
447
452
  readonly containerId: string;
448
453
  readonly index: number;
449
454
  }>;
450
- } | {
451
- readonly _tag: "PressedArrowKey";
452
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
453
455
  } | {
454
456
  readonly _tag: "PressedDraggable";
455
457
  readonly itemId: string;
@@ -467,8 +469,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
467
469
  readonly clientX: number;
468
470
  readonly clientY: number;
469
471
  readonly maybeIndex: Option.Option<number>;
470
- } | {
471
- readonly _tag: "PressedEscape";
472
472
  } | {
473
473
  readonly _tag: "PressedGripKey";
474
474
  readonly itemId: string;
@@ -559,6 +559,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
559
559
  }>;
560
560
  }>;
561
561
  }, {
562
+ readonly _tag: "PressedEscape";
563
+ } | {
562
564
  readonly _tag: "CancelledPointer";
563
565
  } | {
564
566
  readonly _tag: "CompletedAnnounceReorder";
@@ -567,6 +569,9 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
567
569
  } | {
568
570
  readonly _tag: "GotDragAndDropMessage";
569
571
  readonly message: {
572
+ readonly _tag: "PressedArrowKey";
573
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
574
+ } | {
570
575
  readonly _tag: "ActivatedKeyboardDrag";
571
576
  readonly itemId: string;
572
577
  readonly containerId: string;
@@ -593,9 +598,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
593
598
  readonly containerId: string;
594
599
  readonly index: number;
595
600
  }>;
596
- } | {
597
- readonly _tag: "PressedArrowKey";
598
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
599
601
  } | {
600
602
  readonly _tag: "PressedDraggable";
601
603
  readonly itemId: string;
@@ -613,8 +615,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
613
615
  readonly clientX: number;
614
616
  readonly clientY: number;
615
617
  readonly maybeIndex: Option.Option<number>;
616
- } | {
617
- readonly _tag: "PressedEscape";
618
618
  } | {
619
619
  readonly _tag: "PressedGripKey";
620
620
  readonly itemId: string;
@@ -710,6 +710,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
710
710
  }>;
711
711
  }>;
712
712
  }, {
713
+ readonly _tag: "PressedEscape";
714
+ } | {
713
715
  readonly _tag: "CancelledPointer";
714
716
  } | {
715
717
  readonly _tag: "CompletedAnnounceReorder";
@@ -718,6 +720,9 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
718
720
  } | {
719
721
  readonly _tag: "GotDragAndDropMessage";
720
722
  readonly message: {
723
+ readonly _tag: "PressedArrowKey";
724
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
725
+ } | {
721
726
  readonly _tag: "ActivatedKeyboardDrag";
722
727
  readonly itemId: string;
723
728
  readonly containerId: string;
@@ -744,9 +749,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
744
749
  readonly containerId: string;
745
750
  readonly index: number;
746
751
  }>;
747
- } | {
748
- readonly _tag: "PressedArrowKey";
749
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
750
752
  } | {
751
753
  readonly _tag: "PressedDraggable";
752
754
  readonly itemId: string;
@@ -764,8 +766,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
764
766
  readonly clientX: number;
765
767
  readonly clientY: number;
766
768
  readonly maybeIndex: Option.Option<number>;
767
- } | {
768
- readonly _tag: "PressedEscape";
769
769
  } | {
770
770
  readonly _tag: "PressedGripKey";
771
771
  readonly itemId: string;
@@ -857,6 +857,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
857
857
  }>;
858
858
  }>;
859
859
  }, {
860
+ readonly _tag: "PressedEscape";
861
+ } | {
860
862
  readonly _tag: "CancelledPointer";
861
863
  } | {
862
864
  readonly _tag: "CompletedAnnounceReorder";
@@ -865,6 +867,9 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
865
867
  } | {
866
868
  readonly _tag: "GotDragAndDropMessage";
867
869
  readonly message: {
870
+ readonly _tag: "PressedArrowKey";
871
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
872
+ } | {
868
873
  readonly _tag: "ActivatedKeyboardDrag";
869
874
  readonly itemId: string;
870
875
  readonly containerId: string;
@@ -891,9 +896,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
891
896
  readonly containerId: string;
892
897
  readonly index: number;
893
898
  }>;
894
- } | {
895
- readonly _tag: "PressedArrowKey";
896
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
897
899
  } | {
898
900
  readonly _tag: "PressedDraggable";
899
901
  readonly itemId: string;
@@ -911,8 +913,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
911
913
  readonly clientX: number;
912
914
  readonly clientY: number;
913
915
  readonly maybeIndex: Option.Option<number>;
914
- } | {
915
- readonly _tag: "PressedEscape";
916
916
  } | {
917
917
  readonly _tag: "PressedGripKey";
918
918
  readonly itemId: string;
@@ -1055,6 +1055,8 @@ export declare const view: import("foldkit/submodel").View<{
1055
1055
  }>;
1056
1056
  }>;
1057
1057
  }, {
1058
+ readonly _tag: "PressedEscape";
1059
+ } | {
1058
1060
  readonly _tag: "CancelledPointer";
1059
1061
  } | {
1060
1062
  readonly _tag: "CompletedAnnounceReorder";
@@ -1063,6 +1065,9 @@ export declare const view: import("foldkit/submodel").View<{
1063
1065
  } | {
1064
1066
  readonly _tag: "GotDragAndDropMessage";
1065
1067
  readonly message: {
1068
+ readonly _tag: "PressedArrowKey";
1069
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
1070
+ } | {
1066
1071
  readonly _tag: "ActivatedKeyboardDrag";
1067
1072
  readonly itemId: string;
1068
1073
  readonly containerId: string;
@@ -1089,9 +1094,6 @@ export declare const view: import("foldkit/submodel").View<{
1089
1094
  readonly containerId: string;
1090
1095
  readonly index: number;
1091
1096
  }>;
1092
- } | {
1093
- readonly _tag: "PressedArrowKey";
1094
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
1095
1097
  } | {
1096
1098
  readonly _tag: "PressedDraggable";
1097
1099
  readonly itemId: string;
@@ -1109,8 +1111,6 @@ export declare const view: import("foldkit/submodel").View<{
1109
1111
  readonly clientX: number;
1110
1112
  readonly clientY: number;
1111
1113
  readonly maybeIndex: Option.Option<number>;
1112
- } | {
1113
- readonly _tag: "PressedEscape";
1114
1114
  } | {
1115
1115
  readonly _tag: "PressedGripKey";
1116
1116
  readonly itemId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"sortable.d.ts","sourceRoot":"","sources":["../../../src/sortable/sortable.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,MAAM,EAAS,MAAM,EAAE,MAAM,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAC5E,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAa,IAAI,EAAe,MAAM,cAAc,CAAC;AAEjE,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AAGvC,OAAO,KAAK,YAAY,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAyBzC;oDACoD;AACpD,eAAO,MAAM,IAAI;;;EAA6D,CAAC;AAC/E,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC;AAiCpC;iFACiF;AACjF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIhB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAItC,oDAAoD;AACpD,eAAO,MAAM,OAAO;;QACO,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAE9B,MAAM;QACN,SAAS;QACT,OAAO;QACP,OAAO;QACP,OAAO;QACP,OAAO;QACP,KAAK;;;;;;QAEW,MAAM;QAAiB,KAAK;;;;;;QAE5C,OAAO;QACP,OAAO;QACP,OAAO;QACP,OAAO;QACP,UAAU;;;QAGV,OAAO;QACP,OAAO;QACP,OAAO;QACP,OAAO;QACP,UAAU;;;;;;EAMZ,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAI1C;;;;0EAI0E;AAC1E,eAAO,MAAM,UAAU;;QAEnB,MAAM;QACN,SAAS;QACT,OAAO;QACP,gBAAgB;Q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tD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC;4CACwC;IACxC,QAAQ,EAAE,OAAO,CAAC;IAClB;yEACqE;IACrE,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC,CAAC;AAEH;kEACkE;AAClE,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3B,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd;;gFAE4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;mDAC+C;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;6BACyB;IACzB,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC;CACrE,CAAC,CAAC;AAsNH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAjPR,aAAa,CAAC,IAAI,CAAC;IAC1B,yCAAyC;WAClC,MAAM;IACb;;gFAE4E;aACnE,MAAM;IACf;mDAC+C;iBAClC,OAAO;IACpB;6BACyB;gBACb,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,KAAK,aAAa,CAAC,IAAI,CAAC;GAkQnE,CAAC"}
@@ -10,7 +10,7 @@ import * as Subscription from "foldkit/subscription";
10
10
  import * as Update from "foldkit/update";
11
11
  import * as Announcer from "../announcer/announcer.js";
12
12
  import * as Button from "../button/button.js";
13
- import { LEFT_BUTTON, activatedKeyboardDrag, cancelledDrag, escapeKeys, insertionIndex, isCarrying, markDragging, measureLift, movedPointer, phaseOf, pressedDraggable, releasedPointer, } from "../drag/drag.js";
13
+ import { LEFT_BUTTON, activatedKeyboardDrag, cancelledDrag, escapeKeys, insertionIndex, isCarrying, markDragging, measureLift, movedPointer, phaseOf, pressedDraggable, pressingPointer, releasedPointer, } from "../drag/drag.js";
14
14
  import * as Glyph from "../glyph/glyph.js";
15
15
  import * as IconButton from "../iconButton/iconButton.js";
16
16
  import { LOCALE } from "../locale/locale.js";
@@ -289,15 +289,7 @@ const pointerAt = (hold, event) => (__foldkitBrandViewResult(({
289
289
  maybeIndex: pointerIndex(hold.listId, hold.heldHook, event.clientX, event.clientY),
290
290
  }), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#pointerAt"));
291
291
  /** The pressing pointer's moves, release and cancel; another pointer's are not the list's. */
292
- export const pointerMessages = (hold) => {
293
- const fromPressing = (type) => __foldkitBrandViewResult((Stream.fromEventListener(document, type).pipe(Stream.filter((event) => __foldkitBrandViewResult((event.pointerId === hold.pointerId), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#anonymous~25")))), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#fromPressing");
294
- const streams = [
295
- Stream.map(fromPressing("pointermove"), (event) => __foldkitBrandViewResult((Message.MovedPointer(pointerAt(hold, event))), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#anonymous~26")),
296
- Stream.map(fromPressing("pointerup"), (event) => __foldkitBrandViewResult((Message.ReleasedPointer(pointerAt(hold, event))), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#anonymous~27")),
297
- Stream.map(fromPressing("pointercancel"), () => __foldkitBrandViewResult((Message.CancelledPointer()), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#anonymous~28")),
298
- ];
299
- return __foldkitBrandViewResult((Stream.mergeAll(streams, { concurrency: "unbounded" })), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#pointerMessages");
300
- };
292
+ export const pointerMessages = (hold) => __foldkitBrandViewResult((Stream.map(pressingPointer(hold.pointerId), (event) => __foldkitBrandViewResult((Match.value(event.type).pipe(Match.when("pointermove", () => __foldkitBrandViewResult((Message.MovedPointer(pointerAt(hold, event))), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#anonymous~26")), Match.when("pointerup", () => __foldkitBrandViewResult((Message.ReleasedPointer(pointerAt(hold, event))), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#anonymous~27")), Match.orElse(() => __foldkitBrandViewResult((Message.CancelledPointer()), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#anonymous~28")))), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#anonymous~25"))), "@gjermundgaraba-designs/pixel-paper/src/sortable/sortable.js#pointerMessages");
301
293
  const ownSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResult(({
302
294
  pointer: entry({ maybeHold: Schema.Option(PointerHold) }, {
303
295
  modelToDependencies: (model) => (__foldkitBrandViewResult(({
@@ -326,8 +326,6 @@ export declare const update: (model: Model, message: Message) => Readonly<{
326
326
  readonly pendingDismissVersion: number;
327
327
  readonly isHovered: boolean;
328
328
  readonly swipeState: {
329
- readonly _tag: "Idle";
330
- } | {
331
329
  readonly _tag: "Dismissing";
332
330
  readonly offsetX: number;
333
331
  readonly direction: "Left" | "Right";
@@ -336,6 +334,8 @@ export declare const update: (model: Model, message: Message) => Readonly<{
336
334
  readonly pointerId: number;
337
335
  readonly startX: number;
338
336
  readonly currentX: number;
337
+ } | {
338
+ readonly _tag: "Idle";
339
339
  } | {
340
340
  readonly _tag: "Settling";
341
341
  readonly offsetX: number;
@@ -371,15 +371,15 @@ export declare const update: (model: Model, message: Message) => Readonly<{
371
371
  readonly _tag: "GotAnimationMessage";
372
372
  readonly entryId: string;
373
373
  readonly message: {
374
- readonly _tag: "Hid";
375
- } | {
376
- readonly _tag: "Showed";
377
- } | {
378
374
  readonly _tag: "CompletedWaitForPaint";
379
375
  readonly generation: number;
380
376
  } | {
381
377
  readonly _tag: "EndedAnimation";
382
378
  readonly generation: number;
379
+ } | {
380
+ readonly _tag: "Hid";
381
+ } | {
382
+ readonly _tag: "Showed";
383
383
  };
384
384
  } | {
385
385
  readonly _tag: "HoveredEntry";
@@ -557,8 +557,6 @@ export declare const view: import("foldkit/submodel").View<{
557
557
  readonly pendingDismissVersion: number;
558
558
  readonly isHovered: boolean;
559
559
  readonly swipeState: {
560
- readonly _tag: "Idle";
561
- } | {
562
560
  readonly _tag: "Dismissing";
563
561
  readonly offsetX: number;
564
562
  readonly direction: "Left" | "Right";
@@ -567,6 +565,8 @@ export declare const view: import("foldkit/submodel").View<{
567
565
  readonly pointerId: number;
568
566
  readonly startX: number;
569
567
  readonly currentX: number;
568
+ } | {
569
+ readonly _tag: "Idle";
570
570
  } | {
571
571
  readonly _tag: "Settling";
572
572
  readonly offsetX: number;
@@ -602,15 +602,15 @@ export declare const view: import("foldkit/submodel").View<{
602
602
  readonly _tag: "GotAnimationMessage";
603
603
  readonly entryId: string;
604
604
  readonly message: {
605
- readonly _tag: "Hid";
606
- } | {
607
- readonly _tag: "Showed";
608
- } | {
609
605
  readonly _tag: "CompletedWaitForPaint";
610
606
  readonly generation: number;
611
607
  } | {
612
608
  readonly _tag: "EndedAnimation";
613
609
  readonly generation: number;
610
+ } | {
611
+ readonly _tag: "Hid";
612
+ } | {
613
+ readonly _tag: "Showed";
614
614
  };
615
615
  } | {
616
616
  readonly _tag: "HoveredEntry";
@@ -6,6 +6,8 @@ export type ViewConfig<Message> = Readonly<{
6
6
  id: string;
7
7
  /** Pixel caps in the inverted title bar. */
8
8
  title: string;
9
+ /** A quiet IconButton before the kind glyph: a Reel's grip. */
10
+ lead?: ReadonlyArray<Html>;
9
11
  /** What kind of thing it is: a terminal, a note, a machine. */
10
12
  glyph?: GlyphName;
11
13
  /** A chip in the title bar: its state. */
@@ -1 +1 @@
1
- {"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../src/window/window.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cA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AAI,CAAC,CAAC;IAC3B,+DAA+D;IAC/D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IACtC,sDAAsD;IACtD,KAAK,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5B,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IACnC,iEAAiE;IACjE,IAAI,CAAC,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IACpC,8DAA8D;IAC9D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAEH;;6DAE6D;AAC7D,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAsCpF,CAAC"}
@@ -7,13 +7,14 @@ import { slotView } from "../slot/slot.js";
7
7
  * its body scrolls inside, and its title bar carries its kind, its state and its tools. A
8
8
  * region landmark (`<section>`) named by its `h2` title. */
9
9
  export const view = (config, h) => {
10
- const { id, title, glyph, status = [], tools = [], onClose, body, foot = [], isFlush = false, } = config;
10
+ const { id, title, lead = [], glyph, status = [], tools = [], onClose, body, foot = [], isFlush = false, } = config;
11
11
  return __foldkitBrandViewResult((h.section([
12
12
  h.Id(id),
13
13
  h.AriaLabelledBy(titleId(id)),
14
14
  h.Class(isFlush ? "panel window flush" : "panel window"),
15
15
  ], [
16
16
  h.header([h.Class("panel-tb")], [
17
+ ...slotView("span", "panel-lead", lead, h),
17
18
  ...(glyph === undefined ? [] : [Glyph.view({ name: glyph }, h)]),
18
19
  h.h2([h.Id(titleId(id))], [title]),
19
20
  ...status,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjermundgaraba-designs/pixel-paper",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
package/src/drag/drag.ts CHANGED
@@ -1,7 +1,7 @@
1
- // Shared by Board and Sortable, the two users of @foldkit/ui's DragAndDrop: the phase a drag
2
- // is in, the DragAndDrop Messages both build, what a press lifts, Escape taken before anything
3
- // else, the lifted copy's measure, and the closest-centre drop target a sortable resolves for
4
- // a pointer.
1
+ // Shared by Board and Sortable, the two users of @foldkit/ui's DragAndDrop, and Reel, which
2
+ // holds its own: the phase a drag is in, the DragAndDrop Messages both build, what a press
3
+ // lifts, Escape taken before anything else, the pressing pointer's events, the lifted copy's
4
+ // measure, and the closest-centre drop target a sortable resolves for a pointer.
5
5
 
6
6
  import { DragAndDrop as UiDragAndDrop } from "@foldkit/ui";
7
7
  import { Array, Effect, Option, Order, Stream, pipe } from "effect";
@@ -110,6 +110,21 @@ export const escapeKeys = <Message>(message: Message): Stream.Stream<Message> =>
110
110
  options: { capture: true },
111
111
  });
112
112
 
113
+ // POINTER
114
+
115
+ /** The moves, release and cancel of the pointer `pointerId`, on the document; another
116
+ * pointer's are not the drag's. */
117
+ export const pressingPointer = (pointerId: number): Stream.Stream<PointerEvent> =>
118
+ Stream.filter(
119
+ Stream.mergeAll(
120
+ Array.map(["pointermove", "pointerup", "pointercancel"] as const, (type) =>
121
+ Stream.fromEventListener<PointerEvent>(document, type),
122
+ ),
123
+ { concurrency: "unbounded" },
124
+ ),
125
+ (event) => event.pointerId === pointerId,
126
+ );
127
+
113
128
  // LIFTED COPY
114
129
 
115
130
  /** Sizes the copy that follows the pointer to the element `sourceSelector` finds, and keeps the
@@ -14,7 +14,8 @@ export type ViewConfig = Readonly<{
14
14
  size?: number;
15
15
  }>;
16
16
 
17
- const cellView =
17
+ /** One inked rectangle of a drawing, in `currentColor`. */
18
+ export const cellView =
18
19
  <Message>(h: HtmlBuilder<Message>) =>
19
20
  ([x, y, width, height]: Cell): Html =>
20
21
  h.rect([
@@ -2614,10 +2614,11 @@ export const artRows = (art: string): ReadonlyArray<string> =>
2614
2614
 
2615
2615
  const INK_RUN = /#+/g;
2616
2616
 
2617
- /** A drawing as rectangles one cell tall: one for each horizontal run of ink in each row. */
2618
- const toCells = (art: string): ReadonlyArray<Cell> =>
2617
+ /** A drawing as rectangles one cell tall: one for each horizontal run of ink in each row,
2618
+ * up to `width` cells into the row. */
2619
+ export const toCells = (art: string, width: number): ReadonlyArray<Cell> =>
2619
2620
  Array.flatMap(artRows(art), (row, y) =>
2620
- Array.map(Array.fromIterable(row.slice(0, GRID_SIZE).matchAll(INK_RUN)), (run): Cell => [
2621
+ Array.map(Array.fromIterable(row.slice(0, width).matchAll(INK_RUN)), (run): Cell => [
2621
2622
  run.index,
2622
2623
  y,
2623
2624
  run[0].length,
@@ -2627,7 +2628,8 @@ const toCells = (art: string): ReadonlyArray<Cell> =>
2627
2628
 
2628
2629
  const drawFamily = <Name extends string>(
2629
2630
  family: Record.ReadonlyRecord<Name, string>,
2630
- ): Record.ReadonlyRecord<Name, ReadonlyArray<Cell>> => Record.map(family, toCells);
2631
+ ): Record.ReadonlyRecord<Name, ReadonlyArray<Cell>> =>
2632
+ Record.map(family, (art) => toCells(art, GRID_SIZE));
2631
2633
 
2632
2634
  /** Every glyph as the rectangles `Glyph.view` draws. */
2633
2635
  export const glyphs: Record.ReadonlyRecord<GlyphName, ReadonlyArray<Cell>> = {
@@ -11,6 +11,8 @@ export type ViewConfig = Readonly<{
11
11
  label: string;
12
12
  /** The monogram's letters, when the name's initials are not the ones people know. */
13
13
  letters?: string;
14
+ /** The monogram's mark drawn in cells, in place of its letters (see Monogram). */
15
+ drawing?: string;
14
16
  /** A line under the name: an id, a kind, a scope. */
15
17
  meta?: ReadonlyArray<Html | string>;
16
18
  /** Beside a name set large, as a card's subject. */
@@ -20,13 +22,19 @@ export type ViewConfig = Readonly<{
20
22
  /** Who or what something is: its monogram beside its name in the sans, and a meta line.
21
23
  * Screen readers hear the name once: the monogram beside it is hidden from them. */
22
24
  export const view = <Message>(config: ViewConfig, h: HtmlBuilder<Message>): Html => {
23
- const { label, letters, meta = [], isLarge = false } = config;
25
+ const { label, letters, drawing, meta = [], isLarge = false } = config;
24
26
 
25
27
  return h.div(
26
28
  [h.Class(isLarge ? "identity large" : "identity")],
27
29
  [
28
30
  Monogram.view(
29
- { label, ...(letters !== undefined && { letters }), isLarge, isDecorative: true },
31
+ {
32
+ label,
33
+ ...(letters !== undefined && { letters }),
34
+ ...(drawing !== undefined && { drawing }),
35
+ isLarge,
36
+ isDecorative: true,
37
+ },
30
38
  h,
31
39
  ),
32
40
  h.span(
package/src/index.ts CHANGED
@@ -65,6 +65,7 @@ export * as Prose from "./prose/index.ts";
65
65
  export * as QueryChip from "./queryChip/index.ts";
66
66
  export * as RadioChoices from "./radioChoices/index.ts";
67
67
  export * as Rail from "./rail/index.ts";
68
+ export * as Reel from "./reel/index.ts";
68
69
  export * as Remote from "./remote/index.ts";
69
70
  export * as Rows from "./rows/index.ts";
70
71
  export * as Scheme from "./scheme/index.ts";
@@ -81,6 +81,10 @@ export type MeterConfig = Readonly<{
81
81
  hasNumbers?: boolean;
82
82
  /** In a red chip once the value reaches `max`. The percentage by default. */
83
83
  full?: string;
84
+ /** The lit cells take the reading's tone as well: amber from 80%, red at `max`. For a page
85
+ * of readings scanned for their level, such as a wall of limits; the reading beside the
86
+ * cells still says it in a mark or a chip. */
87
+ isToned?: boolean;
84
88
  /** The last reading failed: the cells print muted, the numbers are the last known, and
85
89
  * screen readers hear "(stale)" after the name. Say why, and when it was last read, in
86
90
  * `foot`. */
@@ -119,6 +123,16 @@ const percentView = <Message>(
119
123
  }
120
124
  };
121
125
 
126
+ const toneClass = (value: number, max: number, isFull: boolean): string => {
127
+ if (isFull) {
128
+ return " toned full";
129
+ } else if (value >= max * HIGH_SHARE) {
130
+ return " toned high";
131
+ } else {
132
+ return " toned";
133
+ }
134
+ };
135
+
122
136
  const meterView = <Message>(config: MeterConfig, h: HtmlBuilder<Message>): Html => {
123
137
  const {
124
138
  id,
@@ -129,10 +143,12 @@ const meterView = <Message>(config: MeterConfig, h: HtmlBuilder<Message>): Html
129
143
  foot = [],
130
144
  isStale = false,
131
145
  hasNumbers = true,
146
+ isToned = false,
132
147
  } = config;
133
148
  const share = max > 0 ? Math.min(1, Math.max(0, value / max)) : 0;
134
149
  const isFull = value >= max;
135
150
  const numbers = config.valueText ?? numbersText(value, max, config.unit);
151
+ const rowClass = `meter-row${isStale ? " stale" : ""}${isToned ? toneClass(value, max, isFull) : ""}`;
136
152
 
137
153
  return UiMeter.view(
138
154
  {
@@ -144,7 +160,7 @@ const meterView = <Message>(config: MeterConfig, h: HtmlBuilder<Message>): Html
144
160
  toView: (groups) =>
145
161
  h.keyed("li")(
146
162
  id,
147
- [h.Class(isStale ? "meter-row stale" : "meter-row")],
163
+ [h.Class(rowClass)],
148
164
  [
149
165
  h.div(
150
166
  [h.Class("meter-head")],
@@ -184,7 +200,7 @@ export type ListViewConfig = Readonly<{
184
200
  * A ruled list of meters, edge to edge in a flush panel. Each is a named reading against a
185
201
  * maximum, in the vocabulary of `<meter>`, built on `@foldkit/ui`'s Meter: 20 cells, the
186
202
  * percentage (amber from 80%, a red chip at `max`, and neither 100% nor every cell before it),
187
- * the numbers in English, a foot line. The cells are the `meter`, named by the printed label,
203
+ * the numbers in English, a foot line. The cells print ink unless the meter `isToned`. The cells are the `meter`, named by the printed label,
188
204
  * with the value, the maximum and the numbers in words for screen readers.
189
205
  */
190
206
  export const listView = <Message>(config: ListViewConfig, h: HtmlBuilder<Message>): Html =>
@@ -1,6 +1,9 @@
1
- import { Array, String, pipe } from "effect";
1
+ import { Array, Number, String, pipe } from "effect";
2
2
  import type { Html, HtmlBuilder } from "foldkit/html";
3
3
 
4
+ import { cellView } from "../glyph/glyph.ts";
5
+ import { artRows, toCells } from "../glyph/glyphs.ts";
6
+
4
7
  // LETTERS
5
8
 
6
9
  const WORD_BREAK = /[\s._-]+/;
@@ -25,6 +28,29 @@ const initials = (name: string): string =>
25
28
  }),
26
29
  );
27
30
 
31
+ // DRAWING
32
+
33
+ /** A drawing prints a pixel per cell, two in a large monogram, so its cells stay whole. */
34
+ const DRAWN_CELL = 1;
35
+ const LARGE_DRAWN_CELL = 2;
36
+
37
+ const drawingView = <Message>(art: string, isLarge: boolean, h: HtmlBuilder<Message>): Html => {
38
+ const rows = artRows(art);
39
+ const columns = Array.reduce(rows, 0, (widest, row) => Number.max(widest, row.length));
40
+ const cell = isLarge ? LARGE_DRAWN_CELL : DRAWN_CELL;
41
+
42
+ return h.svg(
43
+ [
44
+ h.ViewBox(`0 0 ${columns} ${rows.length}`),
45
+ h.Width(`${columns * cell}`),
46
+ h.Height(`${rows.length * cell}`),
47
+ h.AriaHidden(true),
48
+ h.Class("px-icon"),
49
+ ],
50
+ Array.map(toCells(art, columns), cellView(h)),
51
+ );
52
+ };
53
+
28
54
  // VIEW
29
55
 
30
56
  /** Configuration for rendering a monogram with `view`. */
@@ -33,6 +59,11 @@ export type ViewConfig = Readonly<{
33
59
  label: string;
34
60
  /** One or two letters, when the name's initials are not the ones people know. */
35
61
  letters?: string;
62
+ /** A mark the product draws in cells, in place of the letters: rows of `#` (ink) and `.`,
63
+ * as a glyph is drawn, on a grid of up to 16 for a large monogram. It prints bare, in ink,
64
+ * a pixel per cell (two when large): a provider's own mark redrawn in the system's
65
+ * cells, never a picture or a brand colour. */
66
+ drawing?: string;
36
67
  /** 34px, beside a name set large (a card of readings, a wall). */
37
68
  isLarge?: boolean;
38
69
  /** You, among others: the monogram inverts. */
@@ -42,16 +73,25 @@ export type ViewConfig = Readonly<{
42
73
  isDecorative?: boolean;
43
74
  }>;
44
75
 
45
- /** Letters in an ink square: the identity of a person, a provider or a source, where the
46
- * system draws no logos. An image named by `label`, or hidden when `isDecorative`. */
76
+ /** Letters in an ink square, or a mark the product draws in cells: the identity of a person,
77
+ * a provider or a source. An image named by `label`, or hidden when `isDecorative`. */
47
78
  export const view = <Message>(config: ViewConfig, h: HtmlBuilder<Message>): Html => {
48
- const { label, letters, isLarge = false, isCurrent = false, isDecorative = false } = config;
79
+ const {
80
+ label,
81
+ letters,
82
+ drawing,
83
+ isLarge = false,
84
+ isCurrent = false,
85
+ isDecorative = false,
86
+ } = config;
49
87
 
50
88
  return h.span(
51
89
  [
52
90
  ...(isDecorative ? [h.AriaHidden(true)] : [h.Role("img"), h.AriaLabel(label)]),
53
- h.Class(`monogram${isLarge ? " large" : ""}${isCurrent ? " current" : ""}`),
91
+ h.Class(
92
+ `monogram${drawing === undefined ? "" : " drawn"}${isLarge ? " large" : ""}${isCurrent ? " current" : ""}`,
93
+ ),
54
94
  ],
55
- [letters ?? initials(label)],
95
+ [drawing === undefined ? (letters ?? initials(label)) : drawingView(drawing, isLarge, h)],
56
96
  );
57
97
  };