@gjermundgaraba-designs/pixel-paper 0.13.0 → 0.14.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 (130) hide show
  1. package/DESIGN.md +29 -22
  2. package/dist/src/announcer/announcer.d.ts +34 -26
  3. package/dist/src/announcer/announcer.d.ts.map +1 -1
  4. package/dist/src/announcer/announcer.js +42 -32
  5. package/dist/src/announcer/index.d.ts +1 -1
  6. package/dist/src/announcer/index.d.ts.map +1 -1
  7. package/dist/src/announcer/index.js +1 -1
  8. package/dist/src/banner/banner.d.ts +1 -1
  9. package/dist/src/banner/banner.js +1 -1
  10. package/dist/src/barChart/barChart.js +1 -1
  11. package/dist/src/board/board.d.ts +1 -4
  12. package/dist/src/board/board.d.ts.map +1 -1
  13. package/dist/src/board/board.js +8 -71
  14. package/dist/src/button/button.d.ts +1 -1
  15. package/dist/src/button/button.js +1 -1
  16. package/dist/src/card/card.d.ts +35 -9
  17. package/dist/src/card/card.d.ts.map +1 -1
  18. package/dist/src/card/card.js +46 -8
  19. package/dist/src/card/index.d.ts +2 -2
  20. package/dist/src/card/index.d.ts.map +1 -1
  21. package/dist/src/card/index.js +1 -1
  22. package/dist/src/commandPalette/commandPalette.d.ts +4 -0
  23. package/dist/src/commandPalette/commandPalette.d.ts.map +1 -1
  24. package/dist/src/confirmDialog/confirmDialog.d.ts +18 -26
  25. package/dist/src/confirmDialog/confirmDialog.d.ts.map +1 -1
  26. package/dist/src/confirmDialog/confirmDialog.js +21 -19
  27. package/dist/src/confirmDialog/index.d.ts +1 -1
  28. package/dist/src/confirmDialog/index.d.ts.map +1 -1
  29. package/dist/src/confirmDialog/index.js +1 -1
  30. package/dist/src/contextMenu/contextMenu.d.ts +6 -6
  31. package/dist/src/dialog/dialog.d.ts +36 -7
  32. package/dist/src/dialog/dialog.d.ts.map +1 -1
  33. package/dist/src/dialog/dialog.js +32 -12
  34. package/dist/src/dialog/index.d.ts +1 -1
  35. package/dist/src/dialog/index.d.ts.map +1 -1
  36. package/dist/src/dialog/index.js +1 -1
  37. package/dist/src/drag/drag.d.ts +40 -0
  38. package/dist/src/drag/drag.d.ts.map +1 -0
  39. package/dist/src/drag/drag.js +134 -0
  40. package/dist/src/emptyState/emptyState.d.ts +6 -4
  41. package/dist/src/emptyState/emptyState.d.ts.map +1 -1
  42. package/dist/src/emptyState/emptyState.js +1 -1
  43. package/dist/src/errorSummary/errorSummary.d.ts +1 -1
  44. package/dist/src/errorSummary/errorSummary.js +1 -1
  45. package/dist/src/index.d.ts +3 -0
  46. package/dist/src/index.d.ts.map +1 -1
  47. package/dist/src/index.js +3 -0
  48. package/dist/src/keyHelp/keyHelp.d.ts +4 -0
  49. package/dist/src/keyHelp/keyHelp.d.ts.map +1 -1
  50. package/dist/src/lineChart/lineChart.js +1 -1
  51. package/dist/src/liveRegion/index.d.ts +3 -0
  52. package/dist/src/liveRegion/index.d.ts.map +1 -0
  53. package/dist/src/liveRegion/index.js +1 -0
  54. package/dist/src/liveRegion/liveRegion.d.ts +42 -0
  55. package/dist/src/liveRegion/liveRegion.d.ts.map +1 -0
  56. package/dist/src/liveRegion/liveRegion.js +35 -0
  57. package/dist/src/loading/loading.d.ts +8 -3
  58. package/dist/src/loading/loading.d.ts.map +1 -1
  59. package/dist/src/loading/loading.js +4 -3
  60. package/dist/src/menu/menu.d.ts +6 -6
  61. package/dist/src/meter/meter.d.ts +3 -0
  62. package/dist/src/meter/meter.d.ts.map +1 -1
  63. package/dist/src/meter/meter.js +6 -3
  64. package/dist/src/remote/index.d.ts +3 -0
  65. package/dist/src/remote/index.d.ts.map +1 -0
  66. package/dist/src/remote/index.js +1 -0
  67. package/dist/src/remote/remote.d.ts +29 -0
  68. package/dist/src/remote/remote.d.ts.map +1 -0
  69. package/dist/src/remote/remote.js +41 -0
  70. package/dist/src/skipLink/index.d.ts +1 -1
  71. package/dist/src/skipLink/index.d.ts.map +1 -1
  72. package/dist/src/skipLink/index.js +1 -1
  73. package/dist/src/skipLink/skipLink.d.ts +24 -8
  74. package/dist/src/skipLink/skipLink.d.ts.map +1 -1
  75. package/dist/src/skipLink/skipLink.js +27 -8
  76. package/dist/src/sortable/index.d.ts +3 -0
  77. package/dist/src/sortable/index.d.ts.map +1 -0
  78. package/dist/src/sortable/index.js +1 -0
  79. package/dist/src/sortable/sortable.d.ts +1144 -0
  80. package/dist/src/sortable/sortable.d.ts.map +1 -0
  81. package/dist/src/sortable/sortable.js +504 -0
  82. package/dist/src/toast/index.d.ts +1 -1
  83. package/dist/src/toast/index.d.ts.map +1 -1
  84. package/dist/src/toast/index.js +1 -1
  85. package/dist/src/toast/toast.d.ts +32 -20
  86. package/dist/src/toast/toast.d.ts.map +1 -1
  87. package/dist/src/toast/toast.js +8 -3
  88. package/dist/src/topBar/barHeight.d.ts +6 -0
  89. package/dist/src/topBar/barHeight.d.ts.map +1 -1
  90. package/dist/src/topBar/barHeight.js +4 -0
  91. package/dist/src/topBar/index.d.ts +1 -1
  92. package/dist/src/topBar/index.d.ts.map +1 -1
  93. package/dist/src/topBar/index.js +1 -1
  94. package/dist/src/topBar/topBar.d.ts +1 -2
  95. package/dist/src/topBar/topBar.d.ts.map +1 -1
  96. package/package.json +1 -1
  97. package/src/announcer/announcer.ts +48 -32
  98. package/src/announcer/index.ts +1 -1
  99. package/src/banner/banner.ts +1 -1
  100. package/src/barChart/barChart.ts +1 -1
  101. package/src/board/board.ts +18 -87
  102. package/src/button/button.ts +1 -1
  103. package/src/card/card.ts +120 -21
  104. package/src/card/index.ts +2 -2
  105. package/src/confirmDialog/confirmDialog.ts +25 -32
  106. package/src/confirmDialog/index.ts +2 -0
  107. package/src/dialog/dialog.ts +39 -13
  108. package/src/dialog/index.ts +3 -1
  109. package/src/drag/drag.ts +207 -0
  110. package/src/emptyState/emptyState.ts +7 -5
  111. package/src/errorSummary/errorSummary.ts +1 -1
  112. package/src/index.ts +3 -0
  113. package/src/lineChart/lineChart.ts +1 -1
  114. package/src/liveRegion/index.ts +2 -0
  115. package/src/liveRegion/liveRegion.ts +75 -0
  116. package/src/loading/loading.ts +11 -5
  117. package/src/meter/meter.ts +17 -3
  118. package/src/pixel-paper.css +182 -27
  119. package/src/remote/index.ts +2 -0
  120. package/src/remote/remote.ts +76 -0
  121. package/src/skipLink/index.ts +1 -1
  122. package/src/skipLink/skipLink.ts +38 -9
  123. package/src/sortable/index.ts +14 -0
  124. package/src/sortable/sortable.ts +857 -0
  125. package/src/toast/index.ts +1 -0
  126. package/src/toast/toast.ts +9 -3
  127. package/src/tokens.css +13 -11
  128. package/src/topBar/barHeight.ts +6 -0
  129. package/src/topBar/index.ts +1 -1
  130. package/src/topBar/topBar.ts +1 -2
@@ -2,7 +2,6 @@ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
2
  import { Button as UiButton, DragAndDrop as UiDragAndDrop } from "@foldkit/ui";
3
3
  import { Array, Effect, Equal, Match, Option, Schema, Stream, pipe } from "effect";
4
4
  import * as Command from "foldkit/command";
5
- import * as Dom from "foldkit/dom";
6
5
  import { childAttributes, } from "foldkit/html";
7
6
  import { defineMessageUnion } from "foldkit/message";
8
7
  import * as Mount from "foldkit/mount";
@@ -17,6 +16,7 @@ import * as IconButton from "../iconButton/iconButton.js";
17
16
  import { LOCALE } from "../locale/locale.js";
18
17
  import { slotView } from "../slot/slot.js";
19
18
  import { prefixKeys } from "../subscription/prefixKeys.js";
19
+ import { LEFT_BUTTON, activatedKeyboardDrag, cancelledDrag, escapeKeys, innerControls, isCarrying, measureLift, phaseOf, pressedDraggable, } from "../drag/drag.js";
20
20
  // MODEL
21
21
  /** Schema for one card as the board knows it: its id, unique across the board, and its name
22
22
  * in words, which the grip and screen readers use. */
@@ -134,28 +134,8 @@ const columnHook = (model, columnId) => __foldkitBrandViewResult((hookId(id(mode
134
134
  const CARD_ATTRIBUTE = "board-card";
135
135
  const TITLE_ATTRIBUTE = "board-title";
136
136
  const GRIP_ATTRIBUTE = "board-grip";
137
- // PHASE
138
- const Phase = Schema.Literals(["Idle", "Pressed", "PointerDragging", "KeyboardDragging"]);
139
- // NOTE: @foldkit/ui gap: DragAndDrop has no accessor for which input holds a card.
140
- // `ghostStyle` is Some only while a pointer drags, so it tells a pointer drag from a keyboard
141
- // one.
142
- const phaseOf = (dragAndDrop) => {
143
- if (Option.isNone(UiDragAndDrop.maybeDraggedItemId(dragAndDrop))) {
144
- return __foldkitBrandViewResult(("Idle"), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#phaseOf");
145
- }
146
- else if (!UiDragAndDrop.isDragging(dragAndDrop)) {
147
- return __foldkitBrandViewResult(("Pressed"), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#phaseOf");
148
- }
149
- else if (Option.isSome(UiDragAndDrop.ghostStyle(dragAndDrop))) {
150
- return __foldkitBrandViewResult(("PointerDragging"), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#phaseOf");
151
- }
152
- else {
153
- return __foldkitBrandViewResult(("KeyboardDragging"), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#phaseOf");
154
- }
155
- };
156
- const isCarrying = (phase) => __foldkitBrandViewResult((phase === "PointerDragging" || phase === "KeyboardDragging"), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#isCarrying");
157
137
  // COMMAND
158
- /** Says a step of a move through the page's live region (`Announcer.announce`), which is
138
+ /** Says a step of a move through the page's live region (as `Announcer.Announce` does), which is
159
139
  * inside the topmost open dialog when there is one. */
160
140
  export const AnnounceMove = Command.define("AnnounceMove", {
161
141
  args: { text: Schema.String },
@@ -238,18 +218,6 @@ const settle = (previous, putBack = COPY.putBack) => __foldkitBrandViewResult(((
238
218
  commands: [...(dragAndDropUpdate.commands ?? []), ...announceMove(maybeText)],
239
219
  }, dragAndDropUpdate.outMessage)), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#anonymous~20");
240
220
  }), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#settle");
241
- // NOTE: @foldkit/ui gap: DragAndDrop exposes no update capability for a press, a keyboard
242
- // pick-up or a cancel, and its `draggable` bundle (`role="option"`, `tabindex`) cannot sit on
243
- // the grip's button, so the board builds these three child Messages itself.
244
- const pressedDraggable = (fields) =>
245
- // oxlint-disable-next-line foldkit/no-child-message-construction-in-root
246
- __foldkitBrandViewResult((UiDragAndDrop.Message.PressedDraggable(fields)), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#pressedDraggable");
247
- const activatedKeyboardDrag = (fields) =>
248
- // oxlint-disable-next-line foldkit/no-child-message-construction-in-root
249
- __foldkitBrandViewResult((UiDragAndDrop.Message.ActivatedKeyboardDrag(fields)), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#activatedKeyboardDrag");
250
- const cancelledDrag = () =>
251
- // oxlint-disable-next-line foldkit/no-child-message-construction-in-root
252
- __foldkitBrandViewResult((UiDragAndDrop.Message.CancelledDrag()), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#cancelledDrag");
253
221
  const holding = (model, held) => __foldkitBrandViewResult((modifyFields(model, { maybeHeld: () => __foldkitBrandViewResult((Option.some(held)), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#maybeHeld~2") })), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#holding");
254
222
  const canLift = (model) => __foldkitBrandViewResult((model.isMovable && phaseOf(model.dragAndDrop) === "Idle"), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#canLift");
255
223
  const liftByKeyboard = (model, place, columns) => {
@@ -345,28 +313,10 @@ export const setMovable = (model, isMovable) => {
345
313
  return __foldkitBrandViewResult((isMovable ? { model: next } : cancel(next)), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#setMovable");
346
314
  };
347
315
  // SUBSCRIPTION
348
- // NOTE: @foldkit/ui gap: DragAndDrop's own Escape cancels the move and lets the key travel
349
- // on, to a dialog around the board. The board takes the key first and stops it.
350
- /** Escape while a card is pressed or held cancels it and goes no further: it is taken on the
351
- * window, before the page's own key bindings or a dialog see it. */
352
- export const escapeMessage = (event) => {
353
- if (event.key !== "Escape" || event.isComposing) {
354
- return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#escapeMessage");
355
- }
356
- event.preventDefault();
357
- event.stopPropagation();
358
- return __foldkitBrandViewResult((Option.some(Message.PressedEscape())), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#escapeMessage");
359
- };
360
- const escapeKeys = Dom.streamFromEventFilterMap({
361
- target: () => __foldkitBrandViewResult((window), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#target"),
362
- type: "keydown",
363
- filterMapEvent: escapeMessage,
364
- options: { capture: true },
365
- });
366
316
  const holdingSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResult(({
367
317
  escape: entry({ isHolding: Schema.Boolean }, {
368
318
  modelToDependencies: (model) => (__foldkitBrandViewResult(({ isHolding: isHolding(model) }), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#modelToDependencies")),
369
- dependenciesToStream: ({ isHolding: isHoldingNow }) => __foldkitBrandViewResult((isHoldingNow ? escapeKeys : Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#dependenciesToStream"),
319
+ dependenciesToStream: ({ isHolding: isHoldingNow }) => __foldkitBrandViewResult((isHoldingNow ? escapeKeys(Message.PressedEscape()) : Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#dependenciesToStream"),
370
320
  }),
371
321
  }), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#anonymous~35")));
372
322
  // NOTE: @foldkit/ui gap: DragAndDrop's Subscription keys are fixed, so two of its users on a
@@ -396,26 +346,11 @@ export const SizeLiftedCard = Mount.define("SizeLiftedCard", {
396
346
  args: { cardHook: Schema.String, pressX: Schema.Number, pressY: Schema.Number },
397
347
  messages: [Message.CompletedSizeLiftedCard],
398
348
  execute: ({ element, cardHook: hook, pressX, pressY }) => __foldkitBrandViewResult((Effect.sync(() => {
399
- const maybeCard = Option.fromNullishOr(document.querySelector(`[data-sortable-id="${CSS.escape(hook)}"]`));
400
- if (Option.isSome(maybeCard) && element instanceof HTMLElement) {
401
- const rect = maybeCard.value.getBoundingClientRect();
402
- element.style.setProperty("--lift-width", `${rect.width}px`);
403
- element.style.setProperty("--lift-x", `${rect.left - pressX}px`);
404
- element.style.setProperty("--lift-y", `${rect.top - pressY}px`);
405
- }
349
+ measureLift(element, `[data-sortable-id="${CSS.escape(hook)}"]`, pressX, pressY);
406
350
  return __foldkitBrandViewResult((Message.CompletedSizeLiftedCard()), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#anonymous~37");
407
351
  })), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#execute~2"),
408
352
  });
409
- const LEFT_BUTTON = 0;
410
- const INNER_CONTROL = [
411
- "input",
412
- "textarea",
413
- "select",
414
- "a[href]",
415
- '[contenteditable]:not([contenteditable="false"])',
416
- `button:not([data-${TITLE_ATTRIBUTE}]):not([data-${GRIP_ATTRIBUTE}])`,
417
- "[data-no-lift]",
418
- ].join(", ");
353
+ const INNER_CONTROL = innerControls(`[data-${TITLE_ATTRIBUTE}], [data-${GRIP_ATTRIBUTE}]`);
419
354
  const isInside = (outer, inner) => __foldkitBrandViewResult((inner !== null && outer.contains(inner)), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#isInside");
420
355
  /** Where a press on a card landed: its body, its grip, or a control inside it (none). */
421
356
  const pressSpotOf = (target) => {
@@ -549,7 +484,9 @@ const columnView = (info, column, h) => {
549
484
  ]),
550
485
  ...Array.match(items, {
551
486
  onEmpty: () => __foldkitBrandViewResult((info.toEmptyView(column)), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#onEmpty"),
552
- onNonEmpty: (cards) => __foldkitBrandViewResult(([h.ul([h.Class("board-cards")], cards)]), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#onNonEmpty"),
487
+ // NOTE: Safari takes list semantics from a list printed without markers, so the
488
+ // list says it is one
489
+ onNonEmpty: (cards) => __foldkitBrandViewResult(([h.ul([h.Role("list"), h.Class("board-cards")], cards)]), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#onNonEmpty"),
553
490
  }),
554
491
  ]),
555
492
  ])), "@gjermundgaraba-designs/pixel-paper/src/board/board.js#columnView");
@@ -64,7 +64,7 @@ export type ViewConfig<Message> = Look & Readonly<{
64
64
  * While busy it is `aria-busy` too.
65
65
  *
66
66
  * Enter in a field can still submit a form that has no live submit button, so the form's
67
- * own update must ignore a submit while its work is saving (see `Card`'s `onSubmit`).
67
+ * own update must ignore a submit while its work is saving (see `Card.formView`).
68
68
  */
69
69
  export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
70
70
  //# sourceMappingURL=button.d.ts.map
@@ -33,7 +33,7 @@ const wordsView = (label, maybeDone, h) => __foldkitBrandViewResult((Option.matc
33
33
  * While busy it is `aria-busy` too.
34
34
  *
35
35
  * Enter in a field can still submit a form that has no live submit button, so the form's
36
- * own update must ignore a submit while its work is saving (see `Card`'s `onSubmit`).
36
+ * own update must ignore a submit while its work is saving (see `Card.formView`).
37
37
  */
38
38
  export const view = (config, h) => {
39
39
  const { label, onClick, isBusy = false, isDisabled = false, type = "button", attributes = [], glyph, } = config;
@@ -11,11 +11,6 @@ export type ViewConfig<Message> = Readonly<{
11
11
  /** Attributes for the close glyph, such as a Dialog's `closeButton` group, which closes it.
12
12
  * The glyph prints when they are given. */
13
13
  closeAttributes?: Attributes<Message>;
14
- /** The close glyph is held while work the reader may not walk away from runs: it prints
15
- * held (`aria-disabled`), stays in the keyboard and drops `closeAttributes`, so a press does
16
- * nothing. Escape and the veil still send a Dialog's close request, so the parent's update
17
- * leaves that Message out while it holds the glyph (see `Dialog.isCloseRequest`). */
18
- isCloseHeld?: boolean;
19
14
  /** 440px instead of 680px: confirms, settings, sign-in. */
20
15
  isNarrow?: boolean;
21
16
  /** The action bar: a 2px ink rule, then these pushed right. Give the default `isDefault`. */
@@ -25,11 +20,42 @@ export type ViewConfig<Message> = Readonly<{
25
20
  /** Attributes for the action bar, such as a Dialog's `actionBar` group, which moves focus
26
21
  * between the actions with h, l and the side arrows. */
27
22
  actionBarAttributes?: Attributes<Message>;
28
- /** Makes the card a form, named by its title, so it is a form landmark; Enter in a field
29
- * submits it, whether or not its submit button is held. While the form's work is saving,
30
- * the parent's update must ignore this Message. */
31
- onSubmit?: Message;
32
23
  }>;
33
24
  /** The raised surface: paper in a 2px ink box on the 8px print shadow, under a title bar. */
34
25
  export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
26
+ /** Configuration for rendering a form card with `formView`: a card's, but for its body, its
27
+ * close attributes and its action bar, which the form fills. */
28
+ export type FormViewConfig<Message> = Omit<ViewConfig<Message>, "body" | "closeAttributes" | "actions" | "lead"> & Readonly<{
29
+ /** Unique in the document: the submit button's id is `submitId(id)`. */
30
+ id: string;
31
+ /** The form's content, fields and all, in one Fields group that `isBusy` holds. A link in
32
+ * it (an ErrorSummary's) stays live. */
33
+ body: ReadonlyArray<Html | string>;
34
+ /** The submit button's words. It prints primary, the card's default. */
35
+ submit: string;
36
+ /** The cancel button's words, before the submit. It closes through `closeAttributes`. */
37
+ cancel?: string;
38
+ /** Attributes for the close glyph and the cancel button, such as a Dialog's `closeButton`
39
+ * group, which closes it. The glyph prints when they are given. */
40
+ closeAttributes?: Attributes<Message>;
41
+ /** The form's work is running (it sends): the submit button is busy, the close glyph and
42
+ * cancel are held without `closeAttributes`, and the body is natively disabled, so
43
+ * nothing changes under the send and nothing sends twice. In a Dialog, hold its ways out
44
+ * too (`Dialog.setCloseHeld`), and let go of both where the send fails. Enter in a field can submit before the fields are held,
45
+ * so the update still ignores `onSubmit` while busy. */
46
+ isBusy?: boolean;
47
+ /** The form cannot be sent yet (nothing to send): the submit button is held as a Button
48
+ * is, and the fields and cancel stay live. Enter in a field can still submit, so the
49
+ * update ignores `onSubmit` while it cannot be sent. */
50
+ isSubmitDisabled?: boolean;
51
+ /** Sent when the form submits, by its button or by Enter in a field. */
52
+ onSubmit: Message;
53
+ }>;
54
+ /** The id of a form card's submit button. A send disables the fields, so focus in one falls
55
+ * to the page: the form's update moves it here as it sends, with
56
+ * `Focus.Focus({ id: Card.submitId(id) })`. */
57
+ export declare const submitId: (id: string) => string;
58
+ /** A card that is a form, named by its title, so a form landmark: its body in one Fields
59
+ * group, then cancel and the primary submit button in the action bar. */
60
+ export declare const formView: <Message>(config: FormViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
35
61
  //# sourceMappingURL=card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/card/card.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAM9D,sDAAsD;AACtD,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,0FAA0F;IAC1F,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IACnC;gDAC4C;IAC5C,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IACtC;;;0FAGsF;IACtF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6FAA6F;IAC7F,OAAO,CAAC,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IACvC,uEAAuE;IACvE,IAAI,CAAC,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IACpC;6DACyD;IACzD,mBAAmB,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAC1C;;wDAEoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,C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G,iBAAiB,GAAG,SAAS,GAAG,MAAM,CAChD,GACC,QAAQ,CAAC;IACP,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX;6CACyC;IACzC,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IACnC,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;wEACoE;IACpE,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IACtC;;;;6DAIyD;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;6DAEyD;IACzD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAEL;;gDAEgD;AAChD,eAAO,MAAM,QAAQ,OAAQ,MAAM,KAAG,MAAwB,CAAC;AAE/D;0EAC0E;AAC1E,eAAO,MAAM,QAAQ,GAAI,OAAO,UACtB,cAAc,CAAC,OAAO,CAAC,KAC5B,WAAW,CAAC,OAAO,CAAC,KACtB,IAwDF,CAAC"}
@@ -1,10 +1,11 @@
1
1
  import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
2
  import { Array } from "effect";
3
+ import * as Button from "../button/button.js";
4
+ import * as Fields from "../fields/fields.js";
3
5
  import * as IconButton from "../iconButton/iconButton.js";
4
6
  import { slotView } from "../slot/slot.js";
5
- /** The raised surface: paper in a 2px ink box on the 8px print shadow, under a title bar. */
6
- export const view = (config, h) => {
7
- const { title, titleAttributes = [], meta, body, closeAttributes, isCloseHeld = false, isNarrow = false, actions = [], lead = [], actionBarAttributes = [], onSubmit, } = config;
7
+ const childrenView = (config, h) => {
8
+ const { title, titleAttributes = [], meta, body, closeAttributes, isCloseHeld = false, actions = [], lead = [], actionBarAttributes = [], } = config;
8
9
  const titleBar = h.header([h.Class("card-tb")], [
9
10
  h.h2(titleAttributes, [title]),
10
11
  ...(meta === undefined ? [] : [h.span([h.Class("meta")], [meta])]),
@@ -23,9 +24,46 @@ export const view = (config, h) => {
23
24
  onEmpty: () => __foldkitBrandViewResult(([]), "@gjermundgaraba-designs/pixel-paper/src/card/card.js#onEmpty"),
24
25
  onNonEmpty: (bar) => __foldkitBrandViewResult(([h.div([...actionBarAttributes, h.Class("card-actions")], bar)]), "@gjermundgaraba-designs/pixel-paper/src/card/card.js#onNonEmpty"),
25
26
  });
26
- const children = [titleBar, h.div([h.Class("card-body")], body), ...actionBar];
27
- const rootAttributes = [h.Class(isNarrow ? "card narrow" : "card")];
28
- return __foldkitBrandViewResult((onSubmit === undefined
29
- ? h.div(rootAttributes, children)
30
- : h.form([...rootAttributes, h.AriaLabel(title), h.Novalidate(true), h.OnSubmit(onSubmit)], children)), "@gjermundgaraba-designs/pixel-paper/src/card/card.js#view");
27
+ return __foldkitBrandViewResult(([titleBar, h.div([h.Class("card-body")], body), ...actionBar]), "@gjermundgaraba-designs/pixel-paper/src/card/card.js#childrenView");
28
+ };
29
+ const className = (isNarrow) => __foldkitBrandViewResult((isNarrow === true ? "card narrow" : "card"), "@gjermundgaraba-designs/pixel-paper/src/card/card.js#className");
30
+ /** The raised surface: paper in a 2px ink box on the 8px print shadow, under a title bar. */
31
+ export const view = (config, h) => __foldkitBrandViewResult((h.div([h.Class(className(config.isNarrow))], childrenView(config, h))), "@gjermundgaraba-designs/pixel-paper/src/card/card.js#view");
32
+ /** The id of a form card's submit button. A send disables the fields, so focus in one falls
33
+ * to the page: the form's update moves it here as it sends, with
34
+ * `Focus.Focus({ id: Card.submitId(id) })`. */
35
+ export const submitId = (id) => __foldkitBrandViewResult((`${id}-submit`), "@gjermundgaraba-designs/pixel-paper/src/card/card.js#submitId");
36
+ /** A card that is a form, named by its title, so a form landmark: its body in one Fields
37
+ * group, then cancel and the primary submit button in the action bar. */
38
+ export const formView = (config, h) => {
39
+ const { id, title, submit, cancel, closeAttributes, isBusy = false, isSubmitDisabled = false, onSubmit, } = config;
40
+ const cancelButton = cancel === undefined
41
+ ? []
42
+ : [
43
+ Button.view({
44
+ label: cancel,
45
+ isDisabled: isBusy,
46
+ attributes: isBusy ? [] : (closeAttributes ?? []),
47
+ }, h),
48
+ ];
49
+ const submitButton = Button.view({
50
+ label: submit,
51
+ variant: "Primary",
52
+ isDefault: true,
53
+ isBusy,
54
+ isDisabled: isSubmitDisabled,
55
+ type: "submit",
56
+ attributes: [h.Id(submitId(id))],
57
+ }, h);
58
+ return __foldkitBrandViewResult((h.form([
59
+ h.Class(className(config.isNarrow)),
60
+ h.AriaLabel(title),
61
+ h.Novalidate(true),
62
+ h.OnSubmit(onSubmit),
63
+ ], childrenView({
64
+ ...config,
65
+ body: [Fields.view({ body: config.body, isBusy }, h)],
66
+ isCloseHeld: isBusy,
67
+ actions: [...cancelButton, submitButton],
68
+ }, h))), "@gjermundgaraba-designs/pixel-paper/src/card/card.js#formView");
31
69
  };
@@ -1,3 +1,3 @@
1
- export { view } from "./card.ts";
2
- export type { ViewConfig } from "./card.ts";
1
+ export { formView, submitId, view } from "./card.ts";
2
+ export type { FormViewConfig, ViewConfig } from "./card.ts";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACrD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
@@ -1 +1 @@
1
- export { view } from "./card.js";
1
+ export { formView, submitId, view } from "./card.js";
@@ -31,6 +31,7 @@ export declare const Model: Schema.Struct<{
31
31
  }>;
32
32
  readonly maybeFocusSelector: Schema.Option<Schema.String>;
33
33
  }>;
34
+ readonly isCloseHeld: Schema.Boolean;
34
35
  }>;
35
36
  readonly query: Schema.String;
36
37
  readonly maybeCursor: Schema.Option<Schema.String>;
@@ -126,6 +127,7 @@ export declare const update: (model: Model, message: Message) => Readonly<{
126
127
  };
127
128
  readonly maybeFocusSelector: Option.Option<string>;
128
129
  };
130
+ readonly isCloseHeld: boolean;
129
131
  };
130
132
  readonly query: string;
131
133
  readonly maybeCursor: Option.Option<string>;
@@ -289,6 +291,7 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
289
291
  };
290
292
  readonly maybeFocusSelector: Option.Option<string>;
291
293
  };
294
+ readonly isCloseHeld: boolean;
292
295
  };
293
296
  readonly query: string;
294
297
  readonly maybeCursor: Option.Option<string>;
@@ -457,6 +460,7 @@ export declare const view: import("foldkit/submodel").View<{
457
460
  };
458
461
  readonly maybeFocusSelector: Option.Option<string>;
459
462
  };
463
+ readonly isCloseHeld: boolean;
460
464
  };
461
465
  readonly query: string;
462
466
  readonly maybeCursor: Option.Option<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"commandPalette.d.ts","sourceRoot":"","sources":["../../../src/commandPalette/commandPalette.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,MAAM,EAAS,MAAM,EAAE,MAAM,EAAwB,MAAM,QAAQ,CAAC;AACpF,OAAO,KAAK,cAAc,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAa,IAAI,EAAkC,MAAM,cAAc,CAAC;AAKpF,OAAO,KAAK,YAAY,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAoBzC,OAAO,KAAK,EAAU,OAAO,EAAQ,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAavC;;;;;;;;;;;kDAWkD;AAClD,eAAO,MAAM,KAAK;;;;;;;;;;;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AAOH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAnZf;oFACgF;cACtE,aAAa,CAAC,OAAO,CAAC;IAChC;wBACoB;YACZ,MAAM;IACd,mFAAmF;WAC5E,MAAM;IACb;;kCAE8B;mBACf,MAAM,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC;IACjD;0CACsC;uBACnB,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;GAkZ5C,CAAC"}
@@ -16,11 +16,11 @@ export declare const Model: Schema.Struct<{
16
16
  }>;
17
17
  readonly maybeFocusSelector: Schema.Option<Schema.String>;
18
18
  }>;
19
+ readonly isCloseHeld: Schema.Boolean;
19
20
  }>;
20
21
  }>;
21
22
  export type Model = typeof Model.Type;
22
- /** Union of all Messages a confirm dialog can produce. `RequestedCloseWhileHeld`: Escape or a
23
- * press on the veil while `isCloseHeld` is set; nothing follows it. */
23
+ /** Union of all Messages a confirm dialog can produce. */
24
24
  export declare const Message: import("foldkit/message").MessageUnion<{
25
25
  readonly GotDialogMessage: {
26
26
  message: import("foldkit/message").MessageUnion<{
@@ -56,13 +56,12 @@ export declare const Message: import("foldkit/message").MessageUnion<{
56
56
  };
57
57
  readonly ClickedConfirm: {};
58
58
  readonly ClickedCancel: {};
59
- readonly RequestedCloseWhileHeld: {};
60
59
  }>;
61
60
  export type Message = typeof Message.Type;
62
61
  /** Union of OutMessages a confirm dialog reports. `Confirmed`: the reader pressed the action;
63
62
  * the dialog stays open until the parent calls `close`. `Cancelled`: cancel, Escape or a click
64
63
  * on the veil; the dialog has closed, and whether that also stops work already running is
65
- * the parent's to decide. Never reported while `isCloseHeld` is set. */
64
+ * the parent's to decide. Never reported while its ways out are held (`setCloseHeld`). */
66
65
  export declare const OutMessage: import("foldkit/message").MessageUnion<{
67
66
  readonly Confirmed: {};
68
67
  readonly Cancelled: {};
@@ -90,6 +89,7 @@ export declare const update: (model: Model, message: Message) => Readonly<{
90
89
  };
91
90
  readonly maybeFocusSelector: import("effect/Option").Option<string>;
92
91
  };
92
+ readonly isCloseHeld: boolean;
93
93
  };
94
94
  };
95
95
  commands?: Update.Commands<{
@@ -136,8 +136,6 @@ export declare const update: (model: Model, message: Message) => Readonly<{
136
136
  readonly _tag: "PressedActionKey";
137
137
  readonly direction: "Next" | "Previous";
138
138
  };
139
- } | {
140
- readonly _tag: "RequestedCloseWhileHeld";
141
139
  }, never>;
142
140
  outMessage?: {
143
141
  readonly _tag: "Cancelled";
@@ -147,13 +145,20 @@ export declare const update: (model: Model, message: Message) => Readonly<{
147
145
  }>;
148
146
  /** Opens the confirm dialog: focus starts on the action, or on cancel when it is `isDanger`. */
149
147
  export declare const open: (model: Model) => Update.Return<Model, Message>;
150
- /** Closes the confirm dialog without reporting `Cancelled`: call it once confirmed work has
151
- * landed. */
148
+ /** Closes the confirm dialog without reporting `Cancelled`, and lets go of a hold: call it
149
+ * once confirmed work has landed. */
152
150
  export declare const close: (model: Model) => Update.Return<Model, Message>;
151
+ /** Holds cancel, Escape and the veil, or lets them go: while held the dialog stays open and
152
+ * reports no `Cancelled`, and cancel prints held (`aria-disabled`, in the keyboard). Hold it
153
+ * in the update that starts confirmed work whose failure must land here, and let go in the
154
+ * update where the work fails; `close` lets go once it lands. */
155
+ export declare const setCloseHeld: (model: Model, isHeld: boolean) => Model;
153
156
  /** The confirm dialog's id, unique in the document. */
154
157
  export declare const id: (model: Model) => string;
155
158
  /** Whether the confirm dialog is open. */
156
159
  export declare const isOpen: (model: Model) => boolean;
160
+ /** Whether its ways out are held (`setCloseHeld`). */
161
+ export declare const isCloseHeld: (model: Model) => boolean;
157
162
  /** Per-render inputs passed to `view` through `h.submodel`'s `viewInputs`. */
158
163
  export type ViewInputs = Readonly<{
159
164
  /** The title bar: the action's name (`"Delete"`). */
@@ -174,18 +179,12 @@ export type ViewInputs = Readonly<{
174
179
  isDanger?: boolean;
175
180
  /** The confirmed work is running: the confirming button is held (its word stays, the
176
181
  * working cursor prints, a second press does nothing) and keeps focus. Cancel stays live
177
- * unless `isCloseHeld`. */
182
+ * unless the dialog's ways out are held (`setCloseHeld`). */
178
183
  isBusy?: boolean;
179
184
  /** The action cannot run now (nothing is running; it is blocked): the confirming button is
180
185
  * held, `aria-disabled` without the working cursor, and stays in the keyboard, so focus
181
186
  * does not fall to the page. Cancel stays live. */
182
187
  isDisabled?: boolean;
183
- /** The reader may not walk away from the work running now (a delete whose failure must
184
- * land in this dialog): cancel is held as a Button is (`aria-disabled`, in the keyboard,
185
- * a press does nothing), and Escape and a press on the veil leave the
186
- * dialog open, so it reports no `Cancelled` while this is set. `close` still closes it.
187
- * Usually set with `isBusy`. */
188
- isCloseHeld?: boolean;
189
188
  /** The page's live region and toasts while this is the topmost open dialog, `undefined`
190
189
  * while it is not (see `Dialog`). */
191
190
  toLiveRegionView?: (() => Html) | undefined;
@@ -200,8 +199,8 @@ export type ViewInputs = Readonly<{
200
199
  * double-click through.
201
200
  *
202
201
  * Work that takes a while stays in the dialog: set `isBusy` while it runs, `close` once it
203
- * has landed, and on failure keep it open with the error in `toDetailView`. Set
204
- * `isCloseHeld` with it when the reader must stay to see how it ends.
202
+ * has landed, and on failure keep it open with the error in `toDetailView`. Hold its ways
203
+ * out with `setCloseHeld` too when the reader must stay to see how it ends.
205
204
  */
206
205
  export declare const view: import("foldkit/submodel").View<{
207
206
  readonly dialog: {
@@ -217,6 +216,7 @@ export declare const view: import("foldkit/submodel").View<{
217
216
  };
218
217
  readonly maybeFocusSelector: import("effect/Option").Option<string>;
219
218
  };
219
+ readonly isCloseHeld: boolean;
220
220
  };
221
221
  }, {
222
222
  readonly _tag: "ClickedCancel";
@@ -262,8 +262,6 @@ export declare const view: import("foldkit/submodel").View<{
262
262
  readonly _tag: "PressedActionKey";
263
263
  readonly direction: "Next" | "Previous";
264
264
  };
265
- } | {
266
- readonly _tag: "RequestedCloseWhileHeld";
267
265
  }, Readonly<{
268
266
  /** The title bar: the action's name (`"Delete"`). */
269
267
  title: string;
@@ -283,18 +281,12 @@ export declare const view: import("foldkit/submodel").View<{
283
281
  isDanger?: boolean;
284
282
  /** The confirmed work is running: the confirming button is held (its word stays, the
285
283
  * working cursor prints, a second press does nothing) and keeps focus. Cancel stays live
286
- * unless `isCloseHeld`. */
284
+ * unless the dialog's ways out are held (`setCloseHeld`). */
287
285
  isBusy?: boolean;
288
286
  /** The action cannot run now (nothing is running; it is blocked): the confirming button is
289
287
  * held, `aria-disabled` without the working cursor, and stays in the keyboard, so focus
290
288
  * does not fall to the page. Cancel stays live. */
291
289
  isDisabled?: boolean;
292
- /** The reader may not walk away from the work running now (a delete whose failure must
293
- * land in this dialog): cancel is held as a Button is (`aria-disabled`, in the keyboard,
294
- * a press does nothing), and Escape and a press on the veil leave the
295
- * dialog open, so it reports no `Cancelled` while this is set. `close` still closes it.
296
- * Usually set with `isBusy`. */
297
- isCloseHeld?: boolean;
298
290
  /** The page's live region and toasts while this is the topmost open dialog, `undefined`
299
291
  * while it is not (see `Dialog`). */
300
292
  toLiveRegionView?: (() => Html) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"confirmDialog.d.ts","sourceRoot":"","sources":["../../../src/confirmDialog/confirmDialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAe,MAAM,cAAc,CAAC;AAItD,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAUzC,uEAAuE;AACvE,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;EAEhB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAItC;wEACwE;AACxE,eAAO,MAAM,OAAO;;QACE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI3B,CAAC;AACH,MA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AAM,CAAC;IACjB;;uCAEmC;IACnC,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IACnC;;oBAEgB;IAChB,YAAY,CAAC,EAAE,MAAM,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAClD,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;kEAE8D;IAC9D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;wDAEoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;0CACsC;IACtC,gBAAgB,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CAC7C,CAAC,CAAC;AAyDH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAjGf,qDAAqD;WAC9C,MAAM;IACb,6FAA6F;cACnF,MAAM;IAChB;;uCAEmC;UAC7B,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC;IAClC;;oBAEgB;mBACD,MAAM,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC;IACjD,iDAAiD;WAC1C,MAAM;IACb,mFAAmF;eACxE,OAAO;IAClB;;kEAE8D;aACrD,OAAO;IAChB;;wDAEoD;iBACvC,OAAO;IACpB;0CACsC;uBACnB,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;GAoF5C,CAAC"}
@@ -15,19 +15,17 @@ export const Model = Schema.Struct({
15
15
  dialog: Dialog.Model,
16
16
  });
17
17
  // MESSAGE
18
- /** Union of all Messages a confirm dialog can produce. `RequestedCloseWhileHeld`: Escape or a
19
- * press on the veil while `isCloseHeld` is set; nothing follows it. */
18
+ /** Union of all Messages a confirm dialog can produce. */
20
19
  export const Message = defineMessageUnion({
21
20
  GotDialogMessage: { message: Dialog.Message },
22
21
  ClickedConfirm: {},
23
22
  ClickedCancel: {},
24
- RequestedCloseWhileHeld: {},
25
23
  });
26
24
  // OUT MESSAGE
27
25
  /** Union of OutMessages a confirm dialog reports. `Confirmed`: the reader pressed the action;
28
26
  * the dialog stays open until the parent calls `close`. `Cancelled`: cancel, Escape or a click
29
27
  * on the veil; the dialog has closed, and whether that also stops work already running is
30
- * the parent's to decide. Never reported while `isCloseHeld` is set. */
28
+ * the parent's to decide. Never reported while its ways out are held (`setCloseHeld`). */
31
29
  export const OutMessage = defineMessageUnion({
32
30
  Confirmed: {},
33
31
  Cancelled: {},
@@ -50,21 +48,29 @@ const dialogFold = foldDialog(Dialog, {
50
48
  export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
51
49
  GotDialogMessage: ({ message: dialogMessage }) => __foldkitBrandViewResult((dialogFold.update(model, dialogMessage)), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#GotDialogMessage"),
52
50
  ClickedConfirm: () => (__foldkitBrandViewResult(({ model, outMessage: OutMessage.Confirmed() }), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#ClickedConfirm")),
53
- ClickedCancel: () => __foldkitBrandViewResult((pipe(dialogFold.close(model), Update.withOutMessage(OutMessage.Cancelled()))), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#ClickedCancel"),
54
- RequestedCloseWhileHeld: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#RequestedCloseWhileHeld")),
51
+ ClickedCancel: () => __foldkitBrandViewResult((Dialog.isCloseHeld(model.dialog)
52
+ ? { model }
53
+ : pipe(dialogFold.close(model), Update.withOutMessage(OutMessage.Cancelled()))), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#ClickedCancel"),
55
54
  })), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#update");
56
55
  /** Opens the confirm dialog: focus starts on the action, or on cancel when it is `isDanger`. */
57
56
  export const open = (model) => __foldkitBrandViewResult((dialogFold.open(model)), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#open");
58
- /** Closes the confirm dialog without reporting `Cancelled`: call it once confirmed work has
59
- * landed. */
57
+ /** Closes the confirm dialog without reporting `Cancelled`, and lets go of a hold: call it
58
+ * once confirmed work has landed. */
60
59
  export const close = (model) => __foldkitBrandViewResult((dialogFold.close(model)), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#close");
60
+ /** Holds cancel, Escape and the veil, or lets them go: while held the dialog stays open and
61
+ * reports no `Cancelled`, and cancel prints held (`aria-disabled`, in the keyboard). Hold it
62
+ * in the update that starts confirmed work whose failure must land here, and let go in the
63
+ * update where the work fails; `close` lets go once it lands. */
64
+ export const setCloseHeld = (model, isHeld) => __foldkitBrandViewResult((modifyFields(model, { dialog: (dialog) => __foldkitBrandViewResult((Dialog.setCloseHeld(dialog, isHeld)), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#dialog~2") })), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#setCloseHeld");
61
65
  // ACCESSORS
62
66
  /** The confirm dialog's id, unique in the document. */
63
67
  export const id = (model) => __foldkitBrandViewResult((Dialog.id(model.dialog)), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#id");
64
68
  /** Whether the confirm dialog is open. */
65
69
  export const isOpen = (model) => __foldkitBrandViewResult((Dialog.isOpen(model.dialog)), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#isOpen");
66
- const cardView = (viewInputs, render, h) => {
67
- const { isDanger = false, isBusy = false, isDisabled = false, isCloseHeld = false, toDetailView, } = viewInputs;
70
+ /** Whether its ways out are held (`setCloseHeld`). */
71
+ export const isCloseHeld = (model) => __foldkitBrandViewResult((Dialog.isCloseHeld(model.dialog)), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#isCloseHeld");
72
+ const cardView = (model, viewInputs, render, h) => {
73
+ const { isDanger = false, isBusy = false, isDisabled = false, toDetailView } = viewInputs;
68
74
  const commit = Button.view({
69
75
  label: viewInputs.label,
70
76
  variant: isDanger ? "Danger" : "Primary",
@@ -77,7 +83,7 @@ const cardView = (viewInputs, render, h) => {
77
83
  const cancel = Button.view({
78
84
  label: "cancel",
79
85
  isDefault: isDanger,
80
- isDisabled: isCloseHeld,
86
+ isDisabled: Dialog.isCloseHeld(model.dialog),
81
87
  onClick: Message.ClickedCancel(),
82
88
  attributes: isDanger ? render.initialFocus : [],
83
89
  }, h);
@@ -108,8 +114,8 @@ const cardView = (viewInputs, render, h) => {
108
114
  * double-click through.
109
115
  *
110
116
  * Work that takes a while stays in the dialog: set `isBusy` while it runs, `close` once it
111
- * has landed, and on failure keep it open with the error in `toDetailView`. Set
112
- * `isCloseHeld` with it when the reader must stay to see how it ends.
117
+ * has landed, and on failure keep it open with the error in `toDetailView`. Hold its ways
118
+ * out with `setCloseHeld` too when the reader must stay to see how it ends.
113
119
  */
114
120
  export const view = defineView((model, viewInputs, h) => __foldkitBrandViewResult((h.submodel({
115
121
  slotId: id(model),
@@ -119,11 +125,7 @@ export const view = defineView((model, viewInputs, h) => __foldkitBrandViewResul
119
125
  isAlert: viewInputs.isDanger ?? false,
120
126
  hasDescription: true,
121
127
  toLiveRegionView: viewInputs.toLiveRegionView,
122
- toView: (render) => __foldkitBrandViewResult((cardView(viewInputs, render, h)), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#toView"),
128
+ toView: (render) => __foldkitBrandViewResult((cardView(model, viewInputs, render, h)), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#toView"),
123
129
  },
124
- // NOTE: while closing is held, Escape and a press on the veil are handed on as
125
- // `RequestedCloseWhileHeld` instead of reaching the Dialog.
126
- toParentMessage: (message) => __foldkitBrandViewResult((viewInputs.isCloseHeld === true && Dialog.isCloseRequest(message)
127
- ? Message.RequestedCloseWhileHeld()
128
- : Message.GotDialogMessage({ message })), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#toParentMessage~2"),
130
+ toParentMessage: (message) => __foldkitBrandViewResult((Message.GotDialogMessage({ message })), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#toParentMessage~2"),
129
131
  })), "@gjermundgaraba-designs/pixel-paper/src/confirmDialog/confirmDialog.js#anonymous"));
@@ -1,3 +1,3 @@
1
- export { Message, Model, OutMessage, close, id, init, isOpen, open, update, view, } from "./confirmDialog.ts";
1
+ export { Message, Model, OutMessage, close, id, init, isCloseHeld, isOpen, open, setCloseHeld, update, view, } from "./confirmDialog.ts";
2
2
  export type { InitConfig, ViewInputs } from "./confirmDialog.ts";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/confirmDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EACL,UAAU,EACV,KAAK,EACL,EAAE,EACF,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,MAAM,EACN,IAAI,GACL,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/confirmDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EACL,UAAU,EACV,KAAK,EACL,EAAE,EACF,IAAI,EACJ,WAAW,EACX,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,IAAI,GACL,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- export { Message, Model, OutMessage, close, id, init, isOpen, open, update, view, } from "./confirmDialog.js";
1
+ export { Message, Model, OutMessage, close, id, init, isCloseHeld, isOpen, open, setCloseHeld, update, view, } from "./confirmDialog.js";