@gjermundgaraba-designs/pixel-paper 0.22.2 → 0.24.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 (176) hide show
  1. package/DESIGN.md +18 -17
  2. package/dist/src/adapters/mermaid.d.ts.map +1 -1
  3. package/dist/src/adapters/mermaid.js +0 -24
  4. package/dist/src/announcer/announcer.d.ts.map +1 -1
  5. package/dist/src/announcer/announcer.js +12 -12
  6. package/dist/src/board/board.d.ts +0 -10
  7. package/dist/src/board/board.d.ts.map +1 -1
  8. package/dist/src/board/board.js +36 -64
  9. package/dist/src/board/index.d.ts +2 -1
  10. package/dist/src/board/index.d.ts.map +1 -1
  11. package/dist/src/board/index.js +2 -1
  12. package/dist/src/button/button.d.ts +1 -1
  13. package/dist/src/button/button.d.ts.map +1 -1
  14. package/dist/src/commandPalette/commandPalette.d.ts.map +1 -1
  15. package/dist/src/commandPalette/commandPalette.js +78 -83
  16. package/dist/src/commandPalette/keys.d.ts +2 -2
  17. package/dist/src/commandPalette/keys.d.ts.map +1 -1
  18. package/dist/src/commandPalette/keys.js +2 -4
  19. package/dist/src/commandPalette/match.d.ts.map +1 -1
  20. package/dist/src/commandPalette/match.js +2 -2
  21. package/dist/src/confirmDialog/confirmDialog.d.ts.map +1 -1
  22. package/dist/src/confirmDialog/confirmDialog.js +1 -2
  23. package/dist/src/copyButton/copyButton.d.ts +0 -5
  24. package/dist/src/copyButton/copyButton.d.ts.map +1 -1
  25. package/dist/src/copyButton/copyButton.js +2 -2
  26. package/dist/src/crumbs/crumbs.d.ts +0 -2
  27. package/dist/src/crumbs/crumbs.d.ts.map +1 -1
  28. package/dist/src/crumbs/crumbs.js +2 -2
  29. package/dist/src/dialog/dialog.d.ts +2 -0
  30. package/dist/src/dialog/dialog.d.ts.map +1 -1
  31. package/dist/src/dialog/dialog.js +3 -2
  32. package/dist/src/drag/drag.d.ts +28 -0
  33. package/dist/src/drag/drag.d.ts.map +1 -1
  34. package/dist/src/drag/drag.js +39 -17
  35. package/dist/src/editableTitle/editableTitle.d.ts +4 -4
  36. package/dist/src/field/field.d.ts +7 -1
  37. package/dist/src/field/field.d.ts.map +1 -1
  38. package/dist/src/field/field.js +14 -6
  39. package/dist/src/fieldset/fieldset.d.ts.map +1 -1
  40. package/dist/src/fieldset/fieldset.js +2 -4
  41. package/dist/src/fileTree/fileTree.d.ts.map +1 -1
  42. package/dist/src/fileTree/fileTree.js +16 -16
  43. package/dist/src/iconButton/iconButton.d.ts +6 -1
  44. package/dist/src/iconButton/iconButton.d.ts.map +1 -1
  45. package/dist/src/iconButton/iconButton.js +7 -2
  46. package/dist/src/inlineInput/inlineInput.d.ts +4 -0
  47. package/dist/src/inlineInput/inlineInput.d.ts.map +1 -1
  48. package/dist/src/inlineInput/inlineInput.js +9 -6
  49. package/dist/src/keyHelp/index.d.ts +1 -1
  50. package/dist/src/keyHelp/index.d.ts.map +1 -1
  51. package/dist/src/keyHelp/index.js +1 -1
  52. package/dist/src/keyHelp/keyHelp.d.ts +1 -3
  53. package/dist/src/keyHelp/keyHelp.d.ts.map +1 -1
  54. package/dist/src/keyHelp/keyHelp.js +3 -6
  55. package/dist/src/keyHint/keyLabel.d.ts +2 -0
  56. package/dist/src/keyHint/keyLabel.d.ts.map +1 -1
  57. package/dist/src/keyHint/keyLabel.js +3 -2
  58. package/dist/src/lineDiff/diff.d.ts +6 -3
  59. package/dist/src/lineDiff/diff.d.ts.map +1 -1
  60. package/dist/src/lineDiff/diff.js +40 -28
  61. package/dist/src/lineDiff/patch.d.ts.map +1 -1
  62. package/dist/src/lineDiff/patch.js +18 -13
  63. package/dist/src/linkState/linkState.d.ts.map +1 -1
  64. package/dist/src/linkState/linkState.js +1 -7
  65. package/dist/src/menu/slip.js +2 -2
  66. package/dist/src/meter/meter.d.ts.map +1 -1
  67. package/dist/src/meter/meter.js +22 -17
  68. package/dist/src/notice/notice.d.ts +2 -0
  69. package/dist/src/notice/notice.d.ts.map +1 -1
  70. package/dist/src/notice/notice.js +2 -1
  71. package/dist/src/panel/panel.d.ts +3 -0
  72. package/dist/src/panel/panel.d.ts.map +1 -1
  73. package/dist/src/panel/panel.js +2 -1
  74. package/dist/src/passwordField/passwordField.d.ts.map +1 -1
  75. package/dist/src/passwordField/passwordField.js +3 -7
  76. package/dist/src/rail/index.d.ts +1 -1
  77. package/dist/src/rail/index.d.ts.map +1 -1
  78. package/dist/src/rail/index.js +1 -1
  79. package/dist/src/rail/rail.d.ts +95 -20
  80. package/dist/src/rail/rail.d.ts.map +1 -1
  81. package/dist/src/rail/rail.js +103 -46
  82. package/dist/src/reel/layout.d.ts +9 -5
  83. package/dist/src/reel/layout.d.ts.map +1 -1
  84. package/dist/src/reel/layout.js +11 -5
  85. package/dist/src/reel/reel.d.ts.map +1 -1
  86. package/dist/src/reel/reel.js +122 -68
  87. package/dist/src/scheme/scheme.d.ts +1 -1
  88. package/dist/src/scheme/scheme.d.ts.map +1 -1
  89. package/dist/src/segmented/segmented.d.ts +0 -3
  90. package/dist/src/segmented/segmented.d.ts.map +1 -1
  91. package/dist/src/segmented/segmented.js +1 -6
  92. package/dist/src/selectField/selectField.d.ts.map +1 -1
  93. package/dist/src/selectField/selectField.js +3 -10
  94. package/dist/src/sortable/index.d.ts +1 -1
  95. package/dist/src/sortable/index.d.ts.map +1 -1
  96. package/dist/src/sortable/index.js +1 -1
  97. package/dist/src/sortable/sortable.d.ts +39 -40
  98. package/dist/src/sortable/sortable.d.ts.map +1 -1
  99. package/dist/src/sortable/sortable.js +14 -31
  100. package/dist/src/stack/stack.d.ts +1 -1
  101. package/dist/src/stack/stack.d.ts.map +1 -1
  102. package/dist/src/stack/stack.js +1 -1
  103. package/dist/src/tabs/tabs.d.ts +1 -1
  104. package/dist/src/tabs/tabs.d.ts.map +1 -1
  105. package/dist/src/tabs/tabs.js +1 -1
  106. package/dist/src/textareaField/textareaField.d.ts.map +1 -1
  107. package/dist/src/textareaField/textareaField.js +3 -7
  108. package/dist/src/time/time.d.ts.map +1 -1
  109. package/dist/src/time/time.js +4 -2
  110. package/dist/src/tips/index.d.ts +1 -1
  111. package/dist/src/tips/index.d.ts.map +1 -1
  112. package/dist/src/tips/tips.d.ts +30 -1
  113. package/dist/src/tips/tips.d.ts.map +1 -1
  114. package/dist/src/tips/tips.js +53 -31
  115. package/dist/src/toast/index.d.ts +1 -1
  116. package/dist/src/toast/index.d.ts.map +1 -1
  117. package/dist/src/toast/toast.d.ts +5 -5
  118. package/dist/src/toast/toast.d.ts.map +1 -1
  119. package/dist/src/toast/toast.js +1 -6
  120. package/dist/src/toolbar/toolbar.d.ts +0 -3
  121. package/dist/src/toolbar/toolbar.d.ts.map +1 -1
  122. package/dist/src/toolbar/toolbar.js +1 -2
  123. package/package.json +1 -1
  124. package/src/adapters/mermaid.ts +0 -24
  125. package/src/announcer/announcer.ts +13 -17
  126. package/src/board/board.ts +32 -80
  127. package/src/board/index.ts +1 -1
  128. package/src/button/button.ts +1 -1
  129. package/src/commandPalette/commandPalette.ts +21 -38
  130. package/src/commandPalette/keys.ts +2 -4
  131. package/src/commandPalette/match.ts +3 -3
  132. package/src/confirmDialog/confirmDialog.ts +5 -3
  133. package/src/copyButton/copyButton.ts +2 -5
  134. package/src/crumbs/crumbs.ts +2 -4
  135. package/src/dialog/dialog.ts +3 -2
  136. package/src/drag/drag.ts +54 -5
  137. package/src/field/field.ts +29 -7
  138. package/src/fieldset/fieldset.ts +2 -4
  139. package/src/fileTree/fileTree.ts +10 -12
  140. package/src/iconButton/iconButton.ts +19 -2
  141. package/src/inlineInput/inlineInput.ts +11 -2
  142. package/src/keyHelp/index.ts +0 -1
  143. package/src/keyHelp/keyHelp.ts +3 -9
  144. package/src/keyHint/keyLabel.ts +5 -2
  145. package/src/lineDiff/diff.ts +70 -54
  146. package/src/lineDiff/patch.ts +27 -14
  147. package/src/linkState/linkState.ts +1 -8
  148. package/src/menu/slip.ts +2 -2
  149. package/src/meter/meter.ts +25 -15
  150. package/src/notice/notice.ts +2 -1
  151. package/src/panel/panel.ts +5 -0
  152. package/src/passwordField/passwordField.ts +3 -7
  153. package/src/pixel-paper.css +200 -134
  154. package/src/rail/index.ts +2 -0
  155. package/src/rail/rail.ts +124 -44
  156. package/src/reel/layout.ts +14 -7
  157. package/src/reel/reel.ts +132 -63
  158. package/src/scheme/scheme.ts +1 -1
  159. package/src/segmented/segmented.ts +1 -9
  160. package/src/selectField/selectField.ts +3 -10
  161. package/src/sortable/index.ts +0 -1
  162. package/src/sortable/sortable.ts +35 -54
  163. package/src/stack/stack.ts +1 -1
  164. package/src/tabs/tabs.ts +1 -1
  165. package/src/textareaField/textareaField.ts +3 -7
  166. package/src/time/time.ts +6 -7
  167. package/src/tips/index.ts +1 -1
  168. package/src/tips/tips.ts +71 -35
  169. package/src/toast/index.ts +1 -1
  170. package/src/toast/toast.ts +2 -8
  171. package/src/tokens.css +7 -0
  172. package/src/toolbar/toolbar.ts +0 -5
  173. package/dist/src/inlineInput/inline.d.ts +0 -6
  174. package/dist/src/inlineInput/inline.d.ts.map +0 -1
  175. package/dist/src/inlineInput/inline.js +0 -7
  176. package/src/inlineInput/inline.ts +0 -13
@@ -1 +1 @@
1
- {"version":3,"file":"copyButton.d.ts","sourceRoot":"","sources":["../../../src/copyButton/copyButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAY,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAM3C,OAAO,KAAK,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAK9D;4FAC4F;AAC5F,eAAO,MAAM,SAAS;;;;EAIpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC;AAE9C,wDAAwD;AACxD,eAAO,MAAM,KAAK;;;;;;;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AEH,6DAA6D;AAC7D,eAAO,MAAM,YAAY;;;;iBAIvB,CAAC;AAIH;gFACgF;AAChF,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO;;;;;;;;;;;;;;;;;;;;;;;;EAqBjD,CAAC;AAIL;oCACoC;AACpC,eAAO,MAAM,OAAO,8CAAsC,CAAC;AAC3D,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb;2BACuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;IAff,kCAAkC;UAC5B,MAAM;IACZ;2BACuB;WAChB,MAAM;cACH,OAAO;GAsCjB,CAAC"}
@@ -103,9 +103,9 @@ export const Variant = Schema.Literals(["Icon", "Button"]);
103
103
  * resources.
104
104
  */
105
105
  export const view = defineView((model, viewInputs, h) => {
106
- const { text, label, variant = "Icon", attributes = [] } = viewInputs;
106
+ const { text, label, variant = "Icon" } = viewInputs;
107
107
  const isDone = isCopied(model);
108
- const buttonAttributes = [...attributes, h.Id(id(model))];
108
+ const buttonAttributes = [h.Id(id(model))];
109
109
  const onClick = Message.ClickedCopy({ text });
110
110
  return __foldkitBrandViewResult((variant === "Icon"
111
111
  ? IconButton.view({
@@ -9,8 +9,6 @@ export type Crumb = Readonly<{
9
9
  /** Configuration for rendering crumbs with `view`. */
10
10
  export type ViewConfig = Readonly<{
11
11
  crumbs: ReadonlyArray<Crumb>;
12
- /** Names the navigation for screen readers. */
13
- label?: string;
14
12
  }>;
15
13
  /** The path to where you are, in the pixel face, split by muted slashes: a navigation
16
14
  * landmark named "Breadcrumb", its steps an ordered list, the last `aria-current="page"`. */
@@ -1 +1 @@
1
- {"version":3,"file":"crumbs.d.ts","sourceRoot":"","sources":["../../../src/crumbs/crumbs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAItD,2DAA2D;AAC3D,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd;wCACoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IAC7B,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAeH;8FAC8F;AAC9F,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAO3E,CAAC"}
1
+ {"version":3,"file":"crumbs.d.ts","sourceRoot":"","sources":["../../../src/crumbs/crumbs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAItD,2DAA2D;AAC3D,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd;wCACoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CAC9B,CAAC,CAAC;AAeH;8FAC8F;AAC9F,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAO3E,CAAC"}
@@ -8,6 +8,6 @@ const crumbView = (lastIndex, h) => __foldkitBrandViewResult((({ label, href },
8
8
  /** The path to where you are, in the pixel face, split by muted slashes: a navigation
9
9
  * landmark named "Breadcrumb", its steps an ordered list, the last `aria-current="page"`. */
10
10
  export const view = (config, h) => {
11
- const { crumbs, label = "Breadcrumb" } = config;
12
- return __foldkitBrandViewResult((h.nav([h.AriaLabel(label), h.Class("crumbs")], [h.ol([], Array.map(crumbs, crumbView(crumbs.length - 1, h)))])), "@gjermundgaraba-designs/pixel-paper/src/crumbs/crumbs.js#view");
11
+ const { crumbs } = config;
12
+ return __foldkitBrandViewResult((h.nav([h.AriaLabel("Breadcrumb"), h.Class("crumbs")], [h.ol([], Array.map(crumbs, crumbView(crumbs.length - 1, h)))])), "@gjermundgaraba-designs/pixel-paper/src/crumbs/crumbs.js#view");
13
13
  };
@@ -82,6 +82,8 @@ export type UpdateContext = Readonly<{
82
82
  * soon after the start a key comes. */
83
83
  isCloseHeld: boolean;
84
84
  }>;
85
+ /** The context of a dialog whose close is not held, the default. */
86
+ export declare const FREE: UpdateContext;
85
87
  /** Processes a dialog Message and returns the next Model, Commands and OutMessage. */
86
88
  export declare const update: (model: Model, message: Message, context?: UpdateContext) => Readonly<{
87
89
  model: {
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/dialog/dialog.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,MAAM,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAE5D,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAC;AAE/E,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AAGvC,OAAO,KAAK,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAO9C,gFAAgF;AAChF,eAAO,MAAM,KAAK;;;;;;;;;;;;;EAEhB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAEtC,8EAA8E;AAC9E,QAAA,MAAM,eAAe,gDAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI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xE,WAAW,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC3C,iFAAiF;IACjF,SAAS,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CAC1C,CAAC,CAAC;AAEH,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,2FAA2F;IAC3F,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC;0FACsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;2FAIuF;IACvF,gBAAgB,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CAC7C,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAzBf,2FAA2F;YACnF,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;IACpC;0FACsF;YAC9E,MAAM;IACd,sEAAsE;cAC5D,OAAO;gBACL,SAAS;qBACJ,OAAO;IACxB;;;;2FAIuF;uBACpE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;GA2D3C,CAAC"}
@@ -51,7 +51,8 @@ const dialogFold = foldDialog(UiDialog, {
51
51
  toParentMessage: (message) => __foldkitBrandViewResult((Message.GotDialogMessage({ message })), "@gjermundgaraba-designs/pixel-paper/src/dialog/dialog.js#toParentMessage"),
52
52
  toParentOutMessage: toOutMessage,
53
53
  });
54
- const FREE = { isCloseHeld: false };
54
+ /** The context of a dialog whose close is not held, the default. */
55
+ export const FREE = { isCloseHeld: false };
55
56
  // NOTE: @foldkit/ui gap: Dialog has no way to hold a close. Escape, a press on the veil and a
56
57
  // control given the `closeButton` group all send `RequestedClose`, so a held dialog reads it
57
58
  // by its tag and leaves it out.
@@ -125,7 +126,7 @@ export const sceneMounts = [
125
126
  export const view = defineView((model, viewInputs, h) => {
126
127
  const { toView, label, isAlert = false, placement = "Center", hasDescription = false, toLiveRegionView, } = viewInputs;
127
128
  const actionBar = childAttributes([
128
- h.DataAttribute("pixel-paper-action-bar", ""),
129
+ h.Attribute(ACTION_BAR_ATTRIBUTE, ""),
129
130
  h.OnMount(BindActionKeys()),
130
131
  ]);
131
132
  const veilView = (render) => __foldkitBrandViewResult((h.dialog([...render.dialog, ...(isAlert ? [h.Role("alertdialog")] : []), h.Class("veil")], render.isVisible
@@ -1,12 +1,31 @@
1
1
  import { DragAndDrop as UiDragAndDrop } from "@foldkit/ui";
2
2
  import { Option, Stream } from "effect";
3
+ import type * as Command from "foldkit/command";
3
4
  import type { Attribute, HtmlBuilder } from "foldkit/html";
5
+ import * as Subscription from "foldkit/subscription";
6
+ import * as Update from "foldkit/update";
4
7
  /** Where a drag is: nothing pressed, pressed but not yet moved, carried by a pointer, or
5
8
  * carried by the keyboard. */
6
9
  type Phase = "Idle" | "Pressed" | "PointerDragging" | "KeyboardDragging";
7
10
  export declare const phaseOf: (dragAndDrop: UiDragAndDrop.Model) => Phase;
8
11
  /** Whether an item is carried, by a pointer or the keyboard. */
9
12
  export declare const isCarrying: (phase: Phase) => boolean;
13
+ /** What a Board's and a Sortable's Model share: the DragAndDrop, whether items may move, and
14
+ * what the list keeps while an item is pressed or held. */
15
+ type Holder = Readonly<{
16
+ dragAndDrop: UiDragAndDrop.Model;
17
+ isMovable: boolean;
18
+ maybeHeld: Option.Option<unknown>;
19
+ }>;
20
+ /** Whether an item is pressed or held. While it is, the arrow keys, Space and Escape belong to
21
+ * the list: pause the page's own bindings for them. The list takes Escape before anything
22
+ * else sees it. */
23
+ export declare const isHolding: (model: Holder) => boolean;
24
+ /** Whether a press may lift an item now: items may move and none is pressed or held. */
25
+ export declare const canLift: (model: Holder) => boolean;
26
+ /** Settles a DragAndDrop step: forgets the held item once it is down, and runs what the step
27
+ * says (`maybeAnnouncement`) after the step's own Commands. */
28
+ export declare const settle: <Model extends Holder, Message, OutMessage>(step: Update.ReturnWithOutMessage<Model, Message, OutMessage>, maybeAnnouncement: Option.Option<Command.Command<Message>>) => Update.ReturnWithOutMessage<Model, Message, OutMessage>;
10
29
  export declare const pressedDraggable: (fields: Parameters<typeof UiDragAndDrop.Message.PressedDraggable>[0]) => UiDragAndDrop.Message;
11
30
  export declare const activatedKeyboardDrag: (fields: Parameters<typeof UiDragAndDrop.Message.ActivatedKeyboardDrag>[0]) => UiDragAndDrop.Message;
12
31
  export declare const movedPointer: (fields: Parameters<typeof UiDragAndDrop.Message.MovedPointer>[0]) => UiDragAndDrop.Message;
@@ -22,6 +41,15 @@ export declare const innerControls: (liftingButtons: string) => string;
22
41
  export declare const takeEscape: <Message>(event: KeyboardEvent, message: Message) => Option.Option<Message>;
23
42
  /** Escape on the window, in the capture phase, as `message`. */
24
43
  export declare const escapeKeys: <Message>(message: Message) => Stream.Stream<Message>;
44
+ /** A list's `escape` Subscription: `escapeKeys` as `message` while an item is pressed or
45
+ * held. */
46
+ export declare const escapeSubscriptions: <Model extends Holder, Message>(message: Message) => {
47
+ readonly escape: Subscription.EntryWithoutKeepAlive<Model, Message, {
48
+ readonly isHolding: boolean;
49
+ }, never> & {
50
+ readonly __subscription: never;
51
+ };
52
+ };
25
53
  /** What the pressing pointer `pointerId` does, as Messages: each move, the release and the
26
54
  * browser's cancel. */
27
55
  export declare const pointerMessages: <Message>(pointerId: number, toMessage: Readonly<{
@@ -1 +1 @@
1
- {"version":3,"file":"drag.d.ts","sourceRoot":"","sources":["../../../src/drag/drag.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAiB,MAAM,EAAS,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;A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AAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1E,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC;CACxC,CAAC,KACC,WAAW,CAAC,OAAO,CAAC,KACtB,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAmBlC,CAAC;AAIF;6CAC6C;AAC7C,eAAO,MAAM,WAAW,YACb,OAAO,kBACA,MAAM,UACd,MAAM,UACN,MAAM,KACb,IAQF,CAAC;AAoBF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,cACd,OAAO,UACV,MAAM,WACL,MAAM,WACN,MAAM,KACd,MA+BF,CAAC;AAMF;;8DAE8D;AAC9D,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAK7C,CAAC"}
@@ -1,12 +1,14 @@
1
1
  import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
2
  // Shared by Board and Sortable, the two users of @foldkit/ui's DragAndDrop, and Reel, which
3
- // holds its own: the phase a drag is in, the DragAndDrop Messages both build, what a press
4
- // lifts, Escape taken before anything else, the pressing pointer's events, the lifted copy's
5
- // measure, and the closest-centre drop target a sortable resolves for a pointer. A splitter's
6
- // handlers are the Reel's and the Rail's.
3
+ // holds its own: the phase a drag is in, what a hold keeps and how a step settles it, the
4
+ // DragAndDrop Messages both build, what a press lifts, Escape taken before anything else, the
5
+ // pressing pointer's events, the lifted copy's measure, and the closest-centre drop target a
6
+ // sortable resolves for a pointer. A splitter's handlers are the Reel's and the Rail's.
7
7
  import { DragAndDrop as UiDragAndDrop } from "@foldkit/ui";
8
- import { Array, Effect, Option, Order, Stream, pipe } from "effect";
8
+ import { Array, Effect, Option, Order, Schema, Stream, pipe } from "effect";
9
9
  import * as Dom from "foldkit/dom";
10
+ import * as Subscription from "foldkit/subscription";
11
+ import * as Update from "foldkit/update";
10
12
  import { isPlain } from "../keys/keys.js";
11
13
  // NOTE: @foldkit/ui gap: DragAndDrop has no accessor for which input holds an item.
12
14
  // `ghostStyle` is Some only while a pointer drags, so it tells a pointer drag from a keyboard
@@ -27,6 +29,18 @@ export const phaseOf = (dragAndDrop) => {
27
29
  };
28
30
  /** Whether an item is carried, by a pointer or the keyboard. */
29
31
  export const isCarrying = (phase) => __foldkitBrandViewResult((phase === "PointerDragging" || phase === "KeyboardDragging"), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#isCarrying");
32
+ /** Whether an item is pressed or held. While it is, the arrow keys, Space and Escape belong to
33
+ * the list: pause the page's own bindings for them. The list takes Escape before anything
34
+ * else sees it. */
35
+ export const isHolding = (model) => __foldkitBrandViewResult((phaseOf(model.dragAndDrop) !== "Idle"), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#isHolding");
36
+ /** Whether a press may lift an item now: items may move and none is pressed or held. */
37
+ export const canLift = (model) => __foldkitBrandViewResult((model.isMovable && !isHolding(model)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#canLift");
38
+ /** Settles a DragAndDrop step: forgets the held item once it is down, and runs what the step
39
+ * says (`maybeAnnouncement`) after the step's own Commands. */
40
+ export const settle = (step, maybeAnnouncement) => __foldkitBrandViewResult((Update.withOutMessage({
41
+ model: isHolding(step.model) ? step.model : { ...step.model, maybeHeld: Option.none() },
42
+ commands: [...(step.commands ?? []), ...Array.fromOption(maybeAnnouncement)],
43
+ }, step.outMessage)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#settle");
30
44
  // CHILD MESSAGES
31
45
  // NOTE: @foldkit/ui gap: DragAndDrop exposes no update capability for a press, a keyboard
32
46
  // pick-up, a pointer's move and release, or a cancel, and its `draggable` bundle
@@ -81,21 +95,29 @@ export const escapeKeys = (message) => __foldkitBrandViewResult((Dom.streamFromE
81
95
  filterMapEvent: (event) => __foldkitBrandViewResult((takeEscape(event, message)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#filterMapEvent"),
82
96
  options: { capture: true },
83
97
  })), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#escapeKeys");
98
+ /** A list's `escape` Subscription: `escapeKeys` as `message` while an item is pressed or
99
+ * held. */
100
+ export const escapeSubscriptions = (message) => __foldkitBrandViewResult((Subscription.make()((entry) => (__foldkitBrandViewResult(({
101
+ escape: entry({ isHolding: Schema.Boolean }, {
102
+ modelToDependencies: (model) => (__foldkitBrandViewResult(({ isHolding: isHolding(model) }), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#modelToDependencies")),
103
+ dependenciesToStream: ({ isHolding: isHoldingNow }) => __foldkitBrandViewResult((isHoldingNow ? escapeKeys(message) : Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#dependenciesToStream"),
104
+ }),
105
+ }), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous")))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#escapeSubscriptions");
84
106
  // POINTER
85
107
  /** The moves, release and cancel of the pointer `pointerId`, on the document; another
86
108
  * pointer's are not the drag's. */
87
- const pressingPointer = (pointerId) => __foldkitBrandViewResult((Stream.filter(Stream.mergeAll(Array.map(["pointermove", "pointerup", "pointercancel"], (type) => __foldkitBrandViewResult((Stream.fromEventListener(document, type)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous")), { concurrency: "unbounded" }), (event) => __foldkitBrandViewResult((event.pointerId === pointerId), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~2"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#pressingPointer");
109
+ const pressingPointer = (pointerId) => __foldkitBrandViewResult((Stream.filter(Stream.mergeAll(Array.map(["pointermove", "pointerup", "pointercancel"], (type) => __foldkitBrandViewResult((Stream.fromEventListener(document, type)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~2")), { concurrency: "unbounded" }), (event) => __foldkitBrandViewResult((event.pointerId === pointerId), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~3"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#pressingPointer");
88
110
  /** What the pressing pointer `pointerId` does, as Messages: each move, the release and the
89
111
  * browser's cancel. */
90
112
  export const pointerMessages = (pointerId, toMessage) => __foldkitBrandViewResult((Stream.map(pressingPointer(pointerId), (event) => {
91
113
  if (event.type === "pointermove") {
92
- return __foldkitBrandViewResult((toMessage.moved(event)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~3");
114
+ return __foldkitBrandViewResult((toMessage.moved(event)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~4");
93
115
  }
94
116
  else if (event.type === "pointerup") {
95
- return __foldkitBrandViewResult((toMessage.released(event)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~3");
117
+ return __foldkitBrandViewResult((toMessage.released(event)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~4");
96
118
  }
97
119
  else {
98
- return __foldkitBrandViewResult((toMessage.cancelled()), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~3");
120
+ return __foldkitBrandViewResult((toMessage.cancelled()), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~4");
99
121
  }
100
122
  })), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#pointerMessages");
101
123
  // SPLITTER
@@ -107,8 +129,8 @@ export const splitterAttributes = (config, h) => {
107
129
  const [less, more] = config.orientation === "vertical" ? ["ArrowLeft", "ArrowRight"] : ["ArrowUp", "ArrowDown"];
108
130
  return __foldkitBrandViewResult(([
109
131
  h.AriaOrientation(config.orientation),
110
- h.OnPointerDown((_pointerType, button, _screenX, _screenY, _time, clientX, clientY, pointerId) => __foldkitBrandViewResult((Option.liftPredicate(config.onPress(pointerId, clientX, clientY), () => __foldkitBrandViewResult((button === LEFT_BUTTON && config.isIdle), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~5"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~4")),
111
- h.OnKeyDownPreventDefault((key, modifiers) => __foldkitBrandViewResult((Option.liftPredicate(config.onStep(key === more ? 1 : -1), () => __foldkitBrandViewResult((isPlain(modifiers) && (key === less || key === more)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~7"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~6")),
132
+ h.OnPointerDown((_pointerType, button, _screenX, _screenY, _time, clientX, clientY, pointerId) => __foldkitBrandViewResult((Option.liftPredicate(config.onPress(pointerId, clientX, clientY), () => __foldkitBrandViewResult((button === LEFT_BUTTON && config.isIdle), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~6"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~5")),
133
+ h.OnKeyDownPreventDefault((key, modifiers) => __foldkitBrandViewResult((Option.liftPredicate(config.onStep(key === more ? 1 : -1), () => __foldkitBrandViewResult((isPlain(modifiers) && (key === less || key === more)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~8"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~7")),
112
134
  ]), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#splitterAttributes");
113
135
  };
114
136
  // LIFTED COPY
@@ -142,14 +164,14 @@ const isOnSameRow = (box, other) => __foldkitBrandViewResult((Math.abs(other.top
142
164
  * in a column of rows it is read down, so one reading serves a list and a grid.
143
165
  */
144
166
  export const insertionIndex = (container, heldId, clientX, clientY) => {
145
- const items = Array.map(Array.fromIterable(container.querySelectorAll("[data-sortable-id]")), (item) => (__foldkitBrandViewResult(({ id: item.dataset["sortableId"], box: boxOf(item) }), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~8")));
167
+ const items = Array.map(Array.fromIterable(container.querySelectorAll("[data-sortable-id]")), (item) => (__foldkitBrandViewResult(({ id: item.dataset["sortableId"], box: boxOf(item) }), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~9")));
146
168
  // read with the held item in its place: two tiles side by side are a row even while one of
147
169
  // them is held
148
- const isTiled = Array.some(items, ({ box }, index) => __foldkitBrandViewResult((Option.exists(Array.get(items, index + 1), (next) => __foldkitBrandViewResult((isOnSameRow(box, next.box)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~10"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~9"));
149
- const boxes = pipe(Array.filter(items, (item) => __foldkitBrandViewResult((item.id !== heldId), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~11")), Array.map(({ box }) => __foldkitBrandViewResult((box), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~12")));
170
+ const isTiled = Array.some(items, ({ box }, index) => __foldkitBrandViewResult((Option.exists(Array.get(items, index + 1), (next) => __foldkitBrandViewResult((isOnSameRow(box, next.box)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~11"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~10"));
171
+ const boxes = pipe(Array.filter(items, (item) => __foldkitBrandViewResult((item.id !== heldId), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~12")), Array.map(({ box }) => __foldkitBrandViewResult((box), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~13")));
150
172
  const distance = (box) => __foldkitBrandViewResult((Math.hypot(box.centreX - clientX, box.centreY - clientY)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#distance");
151
- const byDistance = Order.mapInput(Order.Number, ({ box }) => __foldkitBrandViewResult((distance(box)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~13"));
152
- return __foldkitBrandViewResult((Array.match(Array.map(boxes, (box, index) => (__foldkitBrandViewResult(({ box, index }), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~14"))), {
173
+ const byDistance = Order.mapInput(Order.Number, ({ box }) => __foldkitBrandViewResult((distance(box)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~14"));
174
+ return __foldkitBrandViewResult((Array.match(Array.map(boxes, (box, index) => (__foldkitBrandViewResult(({ box, index }), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~15"))), {
153
175
  onEmpty: () => __foldkitBrandViewResult((0), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#onEmpty"),
154
176
  onNonEmpty: (candidates) => {
155
177
  const { box, index } = Array.min(candidates, byDistance);
@@ -163,4 +185,4 @@ const DRAGGING_ATTRIBUTE = "data-pixel-paper-dragging";
163
185
  /** While a pointer presses or carries an item, the page is marked
164
186
  * (`data-pixel-paper-dragging` on the root), so the stylesheet prints the grabbing cursor and
165
187
  * holds text selection, with no style element of its own. */
166
- export const markDragging = Stream.callback(() => __foldkitBrandViewResult((Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((document.documentElement.setAttribute(DRAGGING_ATTRIBUTE, "")), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~16")), () => __foldkitBrandViewResult((Effect.sync(() => __foldkitBrandViewResult((document.documentElement.removeAttribute(DRAGGING_ATTRIBUTE)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~18"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~17")).pipe(Effect.flatMap(() => __foldkitBrandViewResult((Effect.never), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~19")))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~15"));
188
+ export const markDragging = Stream.callback(() => __foldkitBrandViewResult((Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((document.documentElement.setAttribute(DRAGGING_ATTRIBUTE, "")), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~17")), () => __foldkitBrandViewResult((Effect.sync(() => __foldkitBrandViewResult((document.documentElement.removeAttribute(DRAGGING_ATTRIBUTE)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~19"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~18")).pipe(Effect.flatMap(() => __foldkitBrandViewResult((Effect.never), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~20")))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~16"));
@@ -86,13 +86,13 @@ export declare const update: (model: Model, message: Message) => Readonly<{
86
86
  } | {
87
87
  readonly _tag: "GotEditMessage";
88
88
  readonly message: {
89
- readonly _tag: "PressedEscape";
90
- } | {
91
89
  readonly _tag: "BlurredField";
92
90
  } | {
93
91
  readonly _tag: "CompletedFocusField";
94
92
  } | {
95
93
  readonly _tag: "PressedEnter";
94
+ } | {
95
+ readonly _tag: "PressedEscape";
96
96
  } | {
97
97
  readonly _tag: "UpdatedDraft";
98
98
  readonly value: string;
@@ -142,13 +142,13 @@ export declare const view: import("foldkit/submodel").View<{
142
142
  } | {
143
143
  readonly _tag: "GotEditMessage";
144
144
  readonly message: {
145
- readonly _tag: "PressedEscape";
146
- } | {
147
145
  readonly _tag: "BlurredField";
148
146
  } | {
149
147
  readonly _tag: "CompletedFocusField";
150
148
  } | {
151
149
  readonly _tag: "PressedEnter";
150
+ } | {
151
+ readonly _tag: "PressedEscape";
152
152
  } | {
153
153
  readonly _tag: "UpdatedDraft";
154
154
  readonly value: string;
@@ -1,4 +1,4 @@
1
- import type { Html, HtmlBuilder, TextareaAttribute } from "foldkit/html";
1
+ import type { Attribute, Html, HtmlBuilder, TextareaAttribute } from "foldkit/html";
2
2
  import type { Attributes } from "../attributes/attributes.ts";
3
3
  /** The red sentence under a field's control that says why it failed, given an error. */
4
4
  export declare const errorView: <Message>(id: string, error: string | undefined, h: HtmlBuilder<Message>) => ReadonlyArray<Html>;
@@ -6,6 +6,12 @@ export declare const errorView: <Message>(id: string, error: string | undefined,
6
6
  * `@foldkit/ui` attributes, whose `aria-describedby` names the help line alone; every
7
7
  * `@foldkit/ui` control names that line `<id>-description`, as Input does. */
8
8
  export declare const describedByError: <Message>(id: string, error: string | undefined, hasHelp: boolean, h: HtmlBuilder<Message>) => ReadonlyArray<TextareaAttribute<Message>>;
9
+ /** A field's control, after the `@foldkit/ui` attributes: described by its error before its
10
+ * help line, and `aria-required` when the form is not sent without it. */
11
+ export declare const controlAttributes: <Message>(id: string, error: string | undefined, help: string | undefined, isRequired: boolean, h: HtmlBuilder<Message>) => ReadonlyArray<TextareaAttribute<Message>>;
12
+ /** The sans sentence under a field's controls, given one, with the `@foldkit/ui`
13
+ * `description` group that makes it describe them. */
14
+ export declare const helpView: <Message>(help: string | undefined, description: ReadonlyArray<Attribute<Message>>, h: HtmlBuilder<Message>) => ReadonlyArray<Html>;
9
15
  /** Configuration for rendering a text field with `view`. */
10
16
  export type ViewConfig<Message> = Readonly<{
11
17
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/field/field.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAM9D,wFAAwF;AACxF,eAAO,MAAM,SAAS,GAAI,OAAO,MAC3B,MAAM,SACH,MAAM,GAAG,SAAS,KACtB,WAAW,CAAC,OAAO,CAAC,KACtB,aAAa,CAAC,IAAI,CACmE,CAAC;AAEzF;;+EAE+E;AAC/E,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAClC,MAAM,SACH,MAAM,GAAG,SAAS,WAChB,OAAO,KACb,WAAW,CAAC,OAAO,CAAC,KACtB,aAAa,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAGqD,CAAC;AAIjG,4DAA4D;AAC5D,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,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AiB,GAAI,OAAO,MACnC,MAAM,SACH,MAAM,GAAG,SAAS,QACnB,MAAM,GAAG,SAAS,cACZ,OAAO,KAChB,WAAW,CAAC,OAAO,CAAC,KACtB,aAAa,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAG1C,CAAC;AAIF;uDACuD;AACvD,eAAO,MAAM,QAAQ,GAAI,OAAO,QACxB,MAAM,GAAG,SAAS,eACX,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAC3C,WAAW,CAAC,OAAO,CAAC,KACtB,aAAa,CAAC,IAAI,CAC6D,CAAC;AAInF,4DAA4D;AAC5D,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;uCAEmC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,yFAAyF;IACzF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;qEACiE;IACjE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;iBACa;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;iBACa;IACb,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CACvC,CAAC,CAAC;AAEH;;;6EAG6E;AAC7E,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAyCpF,CAAC"}
@@ -10,6 +10,18 @@ export const errorView = (id, error, h) => __foldkitBrandViewResult((error === u
10
10
  export const describedByError = (id, error, hasHelp, h) => __foldkitBrandViewResult((error === undefined
11
11
  ? []
12
12
  : [h.AriaDescribedBy(hasHelp ? `${errorId(id)} ${UiInput.descriptionId(id)}` : errorId(id))]), "@gjermundgaraba-designs/pixel-paper/src/field/field.js#describedByError");
13
+ /** A field's control, after the `@foldkit/ui` attributes: described by its error before its
14
+ * help line, and `aria-required` when the form is not sent without it. */
15
+ // NOTE: @foldkit/ui gap: Input, Select and Textarea have no required option, so the wrapper
16
+ // says it.
17
+ export const controlAttributes = (id, error, help, isRequired, h) => __foldkitBrandViewResult(([
18
+ ...describedByError(id, error, help !== undefined, h),
19
+ ...(isRequired ? [h.AriaRequired(true)] : []),
20
+ ]), "@gjermundgaraba-designs/pixel-paper/src/field/field.js#controlAttributes");
21
+ // HELP
22
+ /** The sans sentence under a field's controls, given one, with the `@foldkit/ui`
23
+ * `description` group that makes it describe them. */
24
+ export const helpView = (help, description, h) => __foldkitBrandViewResult((help === undefined ? [] : [h.p([...description, h.Class("field-help")], [help])]), "@gjermundgaraba-designs/pixel-paper/src/field/field.js#helpView");
13
25
  /** A labelled text input with its help line, built on `@foldkit/ui`'s `Input`: the label
14
26
  * names the input, the help line describes it (`aria-describedby`), an `error` sets
15
27
  * `aria-invalid` and describes it before the help, and `isRequired` sets `aria-required`.
@@ -25,17 +37,13 @@ export const view = (config, h) => {
25
37
  hasDescription: help !== undefined,
26
38
  toView: (groups) => __foldkitBrandViewResult((h.div([h.Class(`field${isBoxed || type === "date" ? " boxed" : ""}${isMono ? " mono" : ""}`)], [
27
39
  h.label([...groups.label, ...(isLabelHidden ? [h.Class("sr-only")] : [])], [label]),
28
- // NOTE: @foldkit/ui gap: Input has no required option, so the wrapper says it.
29
40
  h.input([
30
41
  ...inputAttributes,
31
42
  ...groups.input,
32
- ...describedByError(id, error, help !== undefined, h),
33
- ...(isRequired ? [h.AriaRequired(true)] : []),
43
+ ...controlAttributes(id, error, help, isRequired, h),
34
44
  ]),
35
45
  ...errorView(id, error, h),
36
- ...(help === undefined
37
- ? []
38
- : [h.p([...groups.description, h.Class("field-help")], [help])]),
46
+ ...helpView(help, groups.description, h),
39
47
  ])), "@gjermundgaraba-designs/pixel-paper/src/field/field.js#toView"),
40
48
  }, h)), "@gjermundgaraba-designs/pixel-paper/src/field/field.js#view");
41
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fieldset.d.ts","sourceRoot":"","sources":["../../../src/fieldset/fieldset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAMtD,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,qFAAqF;IACrF,EAAE,EAAE,MAAM,CAAC;IACX,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;gBAGY;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,0CAA0C;IAC1C,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH;;mFAEmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IA0B3E,CAAC"}
1
+ {"version":3,"file":"fieldset.d.ts","sourceRoot":"","sources":["../../../src/fieldset/fieldset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAMtD,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,qFAAqF;IACrF,EAAE,EAAE,MAAM,CAAC;IACX,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;gBAGY;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,0CAA0C;IAC1C,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH;;mFAEmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAwB3E,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
2
  import { Fieldset as UiFieldset } from "@foldkit/ui";
3
- import { describedByError, errorView } from "../field/field.js";
3
+ import { describedByError, errorView, helpView } from "../field/field.js";
4
4
  /** A group of controls under one name, built on `@foldkit/ui`'s Fieldset: a `<fieldset>`
5
5
  * named by its `<legend>` and described by its error and its help line
6
6
  * (`aria-describedby`). The legend turns red while a control in it is invalid. */
@@ -17,9 +17,7 @@ export const view = (config, h) => {
17
17
  h.legend([...groups.legend, h.Class("field-label")], [label]),
18
18
  ...body,
19
19
  ...errorView(id, error, h),
20
- ...(help === undefined
21
- ? []
22
- : [h.p([...groups.description, h.Class("field-help")], [help])]),
20
+ ...helpView(help, groups.description, h),
23
21
  ])), "@gjermundgaraba-designs/pixel-paper/src/fieldset/fieldset.js#toView"),
24
22
  }, h)), "@gjermundgaraba-designs/pixel-paper/src/fieldset/fieldset.js#view");
25
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fileTree.d.ts","sourceRoot":"","sources":["../../../src/fileTree/fileTree.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,MAAM,EAAS,MAAM,EAAgB,MAAM,QAAQ,CAAC;AAGzF,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AAGvC,OAAO,KAAK,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAKpD;4CAC4C;AAC5C,eAAO,MAAM,KAAK;;;;EAIhB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAA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D;AAClD,eAAO,MAAM,EAAE,UAAW,KAAK,KAAG,MAAkB,CAAC;AAerD,+EAA+E;AAC/E,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;EASjD,CAAC;AAmJL;;mEAEmE;AACnE,eAAO,MAAM,YAAY;;;;;;;;;EAyCvB,CAAC;AAIH,0BAA0B;AAC1B,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnC,qCAAqC;IACrC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC/B,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC;AA0IH;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;IAtJf,2CAA2C;WACpC,MAAM;WACN,aAAa,CAAC,QAAQ,CAAC;IAC9B,6DAA6D;kBAC/C,MAAM;GAsKpB,CAAC"}
@@ -84,20 +84,20 @@ const moveInTree = (tree, event) => {
84
84
  return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#moveInTree");
85
85
  }
86
86
  const items = ownItems(tree);
87
- return __foldkitBrandViewResult((pipe(Array.findFirstIndex(items, (item) => __foldkitBrandViewResult((item === event.target), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~21")), Option.flatMap((index) => __foldkitBrandViewResult((Option.flatMap(Array.get(items, index), (item) => {
87
+ return __foldkitBrandViewResult((pipe(Array.findFirstWithIndex(items, (item) => __foldkitBrandViewResult((item === event.target), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~21")), Option.flatMap(([item, index]) => {
88
88
  if (isTypeahead(event)) {
89
- return __foldkitBrandViewResult((moveTo(itemStartingWith(items, index, event.key))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~23");
89
+ return __foldkitBrandViewResult((moveTo(itemStartingWith(items, index, event.key))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~22");
90
90
  }
91
91
  else if (isPlain(event)) {
92
- return __foldkitBrandViewResult((actOnKey(items, index, item, event.key)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~23");
92
+ return __foldkitBrandViewResult((actOnKey(items, index, item, event.key)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~22");
93
93
  }
94
94
  else {
95
- return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~23");
95
+ return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~22");
96
96
  }
97
- })), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~22")))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#moveInTree");
97
+ }))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#moveInTree");
98
98
  };
99
99
  // the tree item focus landed on, if focus landed on one: it becomes the tree's Tab stop
100
- const focusInMessage = (event) => __foldkitBrandViewResult((Option.map(Option.flatMap(Option.liftPredicate(event.target, (target) => __foldkitBrandViewResult((target instanceof Element), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~24")), (target) => __foldkitBrandViewResult((Option.flatMap(Option.fromNullishOr(target.closest(ITEM_SELECTOR)), pathOf)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~25")), (path) => __foldkitBrandViewResult((Message.FocusedTreeItem({ path })), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~26"))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#focusInMessage");
100
+ const focusInMessage = (event) => __foldkitBrandViewResult((Option.map(Option.flatMap(Option.liftPredicate(event.target, (target) => __foldkitBrandViewResult((target instanceof Element), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~23")), (target) => __foldkitBrandViewResult((Option.flatMap(Option.fromNullishOr(target.closest(ITEM_SELECTOR)), pathOf)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~24")), (path) => __foldkitBrandViewResult((Message.FocusedTreeItem({ path })), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~25"))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#focusInMessage");
101
101
  /** The tree's keys (see `moveInTree`), and the item focus lands on (see `focusInMessage`),
102
102
  * which becomes the tree's stop for Tab. A key that moves focus reports nothing itself: the
103
103
  * item's `focusin` does, once. Attached to the tree by `view`. */
@@ -106,7 +106,7 @@ export const BindTreeKeys = Mount.defineStream("BindTreeKeys", {
106
106
  execute: ({ element }) => __foldkitBrandViewResult((Stream.callback((queue) => __foldkitBrandViewResult((Effect.gen(function* () {
107
107
  yield* Effect.acquireRelease(Effect.sync(() => {
108
108
  const onKeyDown = (event) => {
109
- const maybeAction = Option.flatMap(Option.liftPredicate(event, (keyEvent) => __foldkitBrandViewResult((keyEvent instanceof KeyboardEvent), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~30")), (keyEvent) => __foldkitBrandViewResult((moveInTree(element, keyEvent)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~31"));
109
+ const maybeAction = Option.flatMap(Option.liftPredicate(event, (keyEvent) => __foldkitBrandViewResult((keyEvent instanceof KeyboardEvent), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~29")), (keyEvent) => __foldkitBrandViewResult((moveInTree(element, keyEvent)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~30"));
110
110
  if (Option.isSome(maybeAction)) {
111
111
  event.preventDefault();
112
112
  TreeKeyAction.$match(maybeAction.value, {
@@ -125,23 +125,23 @@ export const BindTreeKeys = Mount.defineStream("BindTreeKeys", {
125
125
  };
126
126
  element.addEventListener("keydown", onKeyDown);
127
127
  element.addEventListener("focusin", onFocusIn);
128
- return __foldkitBrandViewResult(({ onKeyDown, onFocusIn }), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~29");
128
+ return __foldkitBrandViewResult(({ onKeyDown, onFocusIn }), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~28");
129
129
  }), ({ onKeyDown, onFocusIn }) => __foldkitBrandViewResult((Effect.sync(() => {
130
130
  element.removeEventListener("keydown", onKeyDown);
131
131
  element.removeEventListener("focusin", onFocusIn);
132
- })), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~32"));
133
- return __foldkitBrandViewResult((yield* Effect.never), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~28");
134
- })), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~27"))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#execute"),
132
+ })), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~31"));
133
+ return __foldkitBrandViewResult((yield* Effect.never), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~27");
134
+ })), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~26"))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#execute"),
135
135
  });
136
136
  const visiblePaths = (model, nodes) => __foldkitBrandViewResult((Array.flatMap(nodes, (node) => __foldkitBrandViewResult((node.children !== undefined && isFolderOpen(model, node.path)
137
137
  ? [node.path, ...visiblePaths(model, node.children)]
138
- : [node.path]), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~34"))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#visiblePaths");
138
+ : [node.path]), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~33"))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#visiblePaths");
139
139
  /** The one item Tab stops on: where the keyboard last was, else the open file, else the
140
140
  * first item, whichever is visible. */
141
141
  const tabStop = (model, nodes, maybeCurrentPath) => {
142
142
  const visible = visiblePaths(model, nodes);
143
143
  const isVisible = (path) => __foldkitBrandViewResult((Array.contains(visible, path)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#isVisible");
144
- return __foldkitBrandViewResult((pipe(Option.filter(model.maybeFocusedPath, isVisible), Option.orElse(() => __foldkitBrandViewResult((Option.filter(maybeCurrentPath, isVisible)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~35")), Option.orElse(() => __foldkitBrandViewResult((Array.head(visible)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~36")))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#tabStop");
144
+ return __foldkitBrandViewResult((pipe(Option.filter(model.maybeFocusedPath, isVisible), Option.orElse(() => __foldkitBrandViewResult((Option.filter(maybeCurrentPath, isVisible)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~34")), Option.orElse(() => __foldkitBrandViewResult((Array.head(visible)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~35")))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#tabStop");
145
145
  };
146
146
  const groupId = (model, path) => __foldkitBrandViewResult((`${model.id}-group-${path}`), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#groupId");
147
147
  const itemAttributes = (context, level, node, index) => {
@@ -152,7 +152,7 @@ const itemAttributes = (context, level, node, index) => {
152
152
  h.AriaSetsize(level.nodes.length),
153
153
  h.AriaPosinset(index + 1),
154
154
  h.DataAttribute("path", node.path),
155
- h.Tabindex(Option.exists(maybeTabStop, (path) => __foldkitBrandViewResult((path === node.path), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~37")) ? 0 : -1),
155
+ h.Tabindex(Option.exists(maybeTabStop, (path) => __foldkitBrandViewResult((path === node.path), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~36")) ? 0 : -1),
156
156
  h.Class("file"),
157
157
  ]), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#itemAttributes");
158
158
  };
@@ -202,7 +202,7 @@ const branchView = (context, level, listAttributes) => {
202
202
  const { h } = context;
203
203
  return __foldkitBrandViewResult((h.ul(listAttributes, Array.map(level.nodes, (node, index) => __foldkitBrandViewResult((h.keyed("li")(node.path, [h.Role("none")], node.children === undefined
204
204
  ? [fileView(context, level, node, index)]
205
- : folderView(context, level, node, index, node.children))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~38")))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#branchView");
205
+ : folderView(context, level, node, index, node.children))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~37")))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#branchView");
206
206
  };
207
207
  /**
208
208
  * Files and folders in the system monospace, nested on a 1px rule guide, as an ARIA tree:
@@ -226,5 +226,5 @@ export const view = defineView((model, viewInputs, h) => {
226
226
  h.AriaLabel(label),
227
227
  h.OnMount(BindTreeKeys()),
228
228
  ]),
229
- ])), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~39");
229
+ ])), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~38");
230
230
  });
@@ -1,5 +1,6 @@
1
1
  import type { Html, HtmlBuilder } from "foldkit/html";
2
2
  import type { Attributes } from "../attributes/attributes.ts";
3
+ import type { KeyHintConfig } from "../button/button.ts";
3
4
  import type { GlyphName } from "../glyph/glyphs.ts";
4
5
  /** Configuration for rendering an icon button with `view`. */
5
6
  export type ViewConfig<Message> = Readonly<{
@@ -11,9 +12,13 @@ export type ViewConfig<Message> = Readonly<{
11
12
  isQuiet?: boolean;
12
13
  /** Unavailable but focusable (`aria-disabled`), as in `@foldkit/ui`. */
13
14
  isDisabled?: boolean;
15
+ /** The key that does the same, printed in the tip after the label (`data-tip-key`): the
16
+ * button has no words to print it beside. */
17
+ keyHint?: KeyHintConfig;
14
18
  /** Further attributes for the `<button>`, never a class. */
15
19
  attributes?: Attributes<Message>;
16
20
  }>;
17
- /** A bare glyph button, 24px square. Its label is its accessible name and its tip. */
21
+ /** A bare glyph button, 24px square. Its label is its accessible name and its tip, and its
22
+ * key, where it has one, prints in the tip after the label. */
18
23
  export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
19
24
  //# sourceMappingURL=iconButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"iconButton.d.ts","sourceRoot":"","sources":["../../../src/iconButton/iconButton.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIpD,8DAA8D;AAC9D,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,KAAK,EAAE,SAAS,CAAC;IACjB,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAClC,CAAC,CAAC;AAEH,sFAAsF;AACtF,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAqBpF,CAAC"}
1
+ {"version":3,"file":"iconButton.d.ts","sourceRoot":"","sources":["../../../src/iconButton/iconButton.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAKpD,8DAA8D;AAC9D,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,KAAK,EAAE,SAAS,CAAC;IACjB,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;kDAC8C;IAC9C,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAClC,CAAC,CAAC;AAEH;gEACgE;AAChE,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAgCpF,CAAC"}
@@ -1,9 +1,11 @@
1
1
  import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
2
  import { Button as UiButton } from "@foldkit/ui";
3
3
  import * as Glyph from "../glyph/glyph.js";
4
- /** A bare glyph button, 24px square. Its label is its accessible name and its tip. */
4
+ import { keyLabel } from "../keyHint/keyLabel.js";
5
+ /** A bare glyph button, 24px square. Its label is its accessible name and its tip, and its
6
+ * key, where it has one, prints in the tip after the label. */
5
7
  export const view = (config, h) => {
6
- const { glyph, label, onClick, isQuiet = false, isDisabled = false, attributes = [] } = config;
8
+ const { glyph, label, onClick, isQuiet = false, isDisabled = false, keyHint, attributes = [], } = config;
7
9
  return __foldkitBrandViewResult((UiButton.view({
8
10
  ...(onClick !== undefined && { onClick }),
9
11
  isDisabled,
@@ -12,6 +14,9 @@ export const view = (config, h) => {
12
14
  ...groups.button,
13
15
  h.AriaLabel(label),
14
16
  h.DataAttribute("tip", label),
17
+ ...(keyHint === undefined
18
+ ? []
19
+ : [h.DataAttribute("tip-key", keyLabel(keyHint.keys, keyHint.platform))]),
15
20
  h.Class(isQuiet ? "iconbtn quiet" : "iconbtn"),
16
21
  ], [Glyph.view({ name: glyph }, h)])), "@gjermundgaraba-designs/pixel-paper/src/iconButton/iconButton.js#toView"),
17
22
  }, h)), "@gjermundgaraba-designs/pixel-paper/src/iconButton/iconButton.js#view");
@@ -75,6 +75,10 @@ export declare const isSaving: (model: Model) => boolean;
75
75
  * fails, and again once the draft changes or the next save goes out. */
76
76
  export declare const maybeError: (model: Model) => Option.Option<string>;
77
77
  type UpdateReturn = Update.ReturnWithOutMessage<Model, Message, OutMessage>;
78
+ /** What Enter or leaving an inline field writes: the draft trimmed, or none (an untouched
79
+ * draft, so an edit made elsewhere to `value` is never overwritten; an empty one; or the
80
+ * text it replaces). */
81
+ export declare const toWrite: (maybeDraft: Option.Option<string>, value: string) => Option.Option<string>;
78
82
  /** Processes an inline field Message and returns the next Model, Commands and OutMessage. */
79
83
  export declare const update: (model: Model, message: Message) => Readonly<{
80
84
  model: {