@gjermundgaraba-designs/pixel-paper 0.11.0 → 0.13.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 (65) hide show
  1. package/DESIGN.md +13 -13
  2. package/dist/src/emptyState/emptyState.d.ts +4 -0
  3. package/dist/src/emptyState/emptyState.d.ts.map +1 -1
  4. package/dist/src/emptyState/emptyState.js +4 -2
  5. package/dist/src/field/field.d.ts +14 -6
  6. package/dist/src/field/field.d.ts.map +1 -1
  7. package/dist/src/field/field.js +17 -5
  8. package/dist/src/fieldset/fieldset.d.ts +7 -2
  9. package/dist/src/fieldset/fieldset.d.ts.map +1 -1
  10. package/dist/src/fieldset/fieldset.js +10 -4
  11. package/dist/src/lineDiff/diff.d.ts +26 -31
  12. package/dist/src/lineDiff/diff.d.ts.map +1 -1
  13. package/dist/src/lineDiff/diff.js +62 -41
  14. package/dist/src/lineDiff/index.d.ts +2 -2
  15. package/dist/src/lineDiff/index.d.ts.map +1 -1
  16. package/dist/src/lineDiff/index.js +1 -1
  17. package/dist/src/lineDiff/lineDiff.d.ts +14 -0
  18. package/dist/src/lineDiff/lineDiff.d.ts.map +1 -1
  19. package/dist/src/lineDiff/lineDiff.js +43 -21
  20. package/dist/src/passwordField/passwordField.d.ts +11 -6
  21. package/dist/src/passwordField/passwordField.d.ts.map +1 -1
  22. package/dist/src/passwordField/passwordField.js +10 -7
  23. package/dist/src/places/places.d.ts +15 -5
  24. package/dist/src/places/places.d.ts.map +1 -1
  25. package/dist/src/places/places.js +19 -17
  26. package/dist/src/radioChoices/radioChoices.d.ts +4 -4
  27. package/dist/src/radioChoices/radioChoices.d.ts.map +1 -1
  28. package/dist/src/rail/rail.d.ts +2 -2
  29. package/dist/src/rail/rail.d.ts.map +1 -1
  30. package/dist/src/rail/rail.js +5 -3
  31. package/dist/src/rows/index.d.ts +1 -1
  32. package/dist/src/rows/index.d.ts.map +1 -1
  33. package/dist/src/rows/rows.d.ts +31 -5
  34. package/dist/src/rows/rows.d.ts.map +1 -1
  35. package/dist/src/rows/rows.js +46 -17
  36. package/dist/src/selectField/selectField.d.ts +7 -5
  37. package/dist/src/selectField/selectField.d.ts.map +1 -1
  38. package/dist/src/selectField/selectField.js +12 -6
  39. package/dist/src/sheet/sheet.d.ts +3 -2
  40. package/dist/src/sheet/sheet.d.ts.map +1 -1
  41. package/dist/src/sheet/sheet.js +3 -2
  42. package/dist/src/slot/slot.d.ts +2 -1
  43. package/dist/src/slot/slot.d.ts.map +1 -1
  44. package/dist/src/slot/slot.js +2 -2
  45. package/dist/src/textareaField/textareaField.d.ts +15 -5
  46. package/dist/src/textareaField/textareaField.d.ts.map +1 -1
  47. package/dist/src/textareaField/textareaField.js +15 -6
  48. package/package.json +1 -1
  49. package/src/emptyState/emptyState.ts +8 -2
  50. package/src/field/field.ts +37 -8
  51. package/src/fieldset/fieldset.ts +16 -4
  52. package/src/lineDiff/diff.ts +104 -48
  53. package/src/lineDiff/index.ts +2 -2
  54. package/src/lineDiff/lineDiff.ts +76 -31
  55. package/src/passwordField/passwordField.ts +18 -9
  56. package/src/pixel-paper.css +41 -6
  57. package/src/places/places.ts +43 -30
  58. package/src/radioChoices/radioChoices.ts +2 -2
  59. package/src/rail/rail.ts +5 -3
  60. package/src/rows/index.ts +1 -0
  61. package/src/rows/rows.ts +95 -25
  62. package/src/selectField/selectField.ts +17 -17
  63. package/src/sheet/sheet.ts +3 -2
  64. package/src/slot/slot.ts +4 -1
  65. package/src/textareaField/textareaField.ts +39 -9
@@ -9,8 +9,22 @@ export type ViewConfig = Readonly<{
9
9
  * default. */
10
10
  context?: number;
11
11
  }>;
12
+ /** Configuration for rendering a unified diff with `patchView`. */
13
+ export type PatchViewConfig = Readonly<{
14
+ /** One file's unified diff, as `diff -u` or `git diff -- <path>` writes it. */
15
+ patch: string;
16
+ /** Names the two sides for screen readers: `"Version 3 against version 4"`. */
17
+ label: string;
18
+ }>;
12
19
  /** A line diff as a ruled table: the old and new numbers, a sign, the line. Added lines sit on
13
20
  * the head tint behind an ink +; removed lines go muted behind a red −, and each sign is
14
21
  * named for screen readers. Two texts that are the same say so in a sentence. */
15
22
  export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
23
+ /** A unified diff the caller already has (from a server, or `git diff -- <path>`) as `view`'s
24
+ * table: its hunks' lines, numbered from their headers, and the unchanged lines between hunks
25
+ * folded into a counted row. Lines past the last hunk are not in the patch, so nothing counts
26
+ * them. An empty patch says there is no difference, as `view` does; anything but one file
27
+ * with a hunk (text that is not a diff, a binary change, several files) says it cannot be
28
+ * shown as lines. */
29
+ export declare const patchView: <Message>(config: PatchViewConfig, h: HtmlBuilder<Message>) => Html;
16
30
  //# sourceMappingURL=lineDiff.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lineDiff.d.ts","sourceRoot":"","sources":["../../../src/lineDiff/lineDiff.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAiBtD,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC;IACd;mBACe;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AA0CH;;kFAEkF;AAClF,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAsB3E,CAAC"}
1
+ {"version":3,"file":"lineDiff.d.ts","sourceRoot":"","sources":["../../../src/lineDiff/lineDiff.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAiBtD,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC;IACd;mBACe;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH,mEAAmE;AACnE,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AA2EH;;kFAEkF;AAClF,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAO3E,CAAC;AAEF;;;;;sBAKsB;AACtB,eAAO,MAAM,SAAS,GAAI,OAAO,UAAU,eAAe,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAWrF,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
- import { Array, Option } from "effect";
2
+ import { Array, Option, String } from "effect";
3
3
  import { LOCALE } from "../locale/locale.js";
4
- import { DiffRow, diffLinesOf, foldUnchanged, hasChanges, } from "./diff.js";
4
+ import { DiffRow, diffRowsOf, diffRowsOfPatch, foldUnchanged, hasChanges, } from "./diff.js";
5
5
  // VIEW
6
6
  const DEFAULT_CONTEXT = 2;
7
7
  const COLUMN_COUNT = 4;
@@ -10,34 +10,56 @@ const KIND = {
10
10
  Added: { className: "add", sign: "+", said: "added" },
11
11
  Removed: { className: "del", sign: "−", said: "removed" },
12
12
  };
13
- const numberText = (maybeNumber) => __foldkitBrandViewResult((Option.match(maybeNumber, { onNone: () => __foldkitBrandViewResult((""), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#onNone"), onSome: (lineNumber) => __foldkitBrandViewResult((`${lineNumber}`), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#onSome") })), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#numberText");
14
- const lineKey = (line) => __foldkitBrandViewResult((`${numberText(line.maybeOldNumber)}:${numberText(line.maybeNewNumber)}`), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#lineKey");
15
- const lineView = (line, h) => {
16
- const { className, sign, said } = KIND[line.kind];
17
- return __foldkitBrandViewResult((h.keyed("tr")(lineKey(line), [h.Class(className)], [
18
- h.td([h.Class("ln")], [numberText(line.maybeOldNumber)]),
19
- h.td([h.Class("ln")], [numberText(line.maybeNewNumber)]),
13
+ const lineView = (kind, numbers, text, h) => {
14
+ const { className, sign, said } = KIND[kind];
15
+ return __foldkitBrandViewResult((h.keyed("tr")(`${numbers.old}:${numbers.new}`, [h.Class(className)], [
16
+ h.td([h.Class("ln")], [numbers.old]),
17
+ h.td([h.Class("ln")], [numbers.new]),
20
18
  h.td([h.Class("sign"), h.AriaLabel(said)], [sign]),
21
- h.td([h.Class("line")], [line.text === "" ? " " : line.text]),
19
+ h.td([h.Class("line")], [text === "" ? " " : text]),
22
20
  ])), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#lineView");
23
21
  };
24
- const foldView = (count, firstLine, h) => __foldkitBrandViewResult((h.keyed("tr")(`fold-${lineKey(firstLine)}`, [h.Class("fold")], [h.td([h.Colspan(COLUMN_COUNT)], [`${count.toLocaleString(LOCALE)} unchanged lines`])])), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#foldView");
22
+ const foldView = (count, firstOldNumber, h) => __foldkitBrandViewResult((h.keyed("tr")(`fold-${firstOldNumber}`, [h.Class("fold")], [
23
+ h.td([h.Colspan(COLUMN_COUNT)], [`${count.toLocaleString(LOCALE)} unchanged ${count === 1 ? "line" : "lines"}`]),
24
+ ])), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#foldView");
25
25
  const rowView = (row, h) => __foldkitBrandViewResult((DiffRow.match(row, {
26
- Line: ({ line }) => __foldkitBrandViewResult((lineView(line, h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#Line"),
27
- Fold: ({ count, firstLine }) => __foldkitBrandViewResult((foldView(count, firstLine, h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#Fold"),
26
+ Same: ({ text, oldNumber, newNumber }) => __foldkitBrandViewResult((lineView("Same", { old: `${oldNumber}`, new: `${newNumber}` }, text, h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#Same"),
27
+ Added: ({ text, newNumber }) => __foldkitBrandViewResult((lineView("Added", { old: "", new: `${newNumber}` }, text, h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#Added"),
28
+ Removed: ({ text, oldNumber }) => __foldkitBrandViewResult((lineView("Removed", { old: `${oldNumber}`, new: "" }, text, h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#Removed"),
29
+ Fold: ({ count, firstOldNumber }) => __foldkitBrandViewResult((foldView(count, firstOldNumber, h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#Fold"),
28
30
  })), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#rowView");
31
+ const noteView = (note, h) => __foldkitBrandViewResult((h.p([h.Class("note-line")], [note])), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#noteView");
32
+ const SAME_NOTE = "No difference: both sides hold the same text.";
33
+ const tableView = (rows, label, h) => __foldkitBrandViewResult((h.div([h.Class("diff-wrap")], [
34
+ h.table([h.AriaLabel(label), h.Class("diff")], [
35
+ h.tbody([], Array.map(rows, (row) => __foldkitBrandViewResult((rowView(row, h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#anonymous"))),
36
+ ]),
37
+ ])), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#tableView");
29
38
  /** A line diff as a ruled table: the old and new numbers, a sign, the line. Added lines sit on
30
39
  * the head tint behind an ink +; removed lines go muted behind a red −, and each sign is
31
40
  * named for screen readers. Two texts that are the same say so in a sentence. */
32
41
  export const view = (config, h) => {
33
42
  const { before, after, label, context = DEFAULT_CONTEXT } = config;
34
- const lines = diffLinesOf(before, after);
35
- if (!hasChanges(lines)) {
36
- return __foldkitBrandViewResult((h.p([h.Class("note-line")], ["No difference: both sides hold the same text."])), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#view");
43
+ const rows = diffRowsOf(before, after);
44
+ return __foldkitBrandViewResult((hasChanges(rows)
45
+ ? tableView(foldUnchanged(rows, context), label, h)
46
+ : noteView(SAME_NOTE, h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#view");
47
+ };
48
+ /** A unified diff the caller already has (from a server, or `git diff -- <path>`) as `view`'s
49
+ * table: its hunks' lines, numbered from their headers, and the unchanged lines between hunks
50
+ * folded into a counted row. Lines past the last hunk are not in the patch, so nothing counts
51
+ * them. An empty patch says there is no difference, as `view` does; anything but one file
52
+ * with a hunk (text that is not a diff, a binary change, several files) says it cannot be
53
+ * shown as lines. */
54
+ export const patchView = (config, h) => {
55
+ const { patch, label } = config;
56
+ if (String.isEmpty(String.trim(patch))) {
57
+ return __foldkitBrandViewResult((noteView(SAME_NOTE, h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#patchView");
58
+ }
59
+ else {
60
+ return __foldkitBrandViewResult((Option.match(diffRowsOfPatch(patch), {
61
+ onNone: () => __foldkitBrandViewResult((noteView("This diff cannot be shown as lines.", h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#onNone"),
62
+ onSome: (rows) => __foldkitBrandViewResult((tableView(rows, label, h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#onSome"),
63
+ })), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#patchView");
37
64
  }
38
- return __foldkitBrandViewResult((h.div([h.Class("diff-wrap")], [
39
- h.table([h.AriaLabel(label), h.Class("diff")], [
40
- h.tbody([], Array.map(foldUnchanged(lines, context), (row) => __foldkitBrandViewResult((rowView(row, h)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#anonymous"))),
41
- ]),
42
- ])), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/lineDiff.js#view");
43
65
  };
@@ -17,8 +17,10 @@ export type ViewConfig<Message> = Readonly<{
17
17
  onToggleShown: Message;
18
18
  /** A sans sentence under the box. */
19
19
  help?: string;
20
- /** Red on the box and on its label; say why in an ErrorSummary above the form. */
21
- isInvalid?: boolean;
20
+ /** Why the value was refused: a red sentence under the control, which the control is
21
+ * described by, with red on its box and its label (`aria-invalid`). Say it again in an
22
+ * ErrorSummary above the form. */
23
+ error?: string | undefined;
22
24
  /** The form is not sent without it: screen readers hear "required" (`aria-required`). */
23
25
  isRequired?: boolean;
24
26
  /** For a new password: four short cells and a word under the box (an empty box is "too
@@ -26,11 +28,14 @@ export type ViewConfig<Message> = Readonly<{
26
28
  strength?: Strength;
27
29
  /** `current-password` to sign in, `new-password` to set one. */
28
30
  autocomplete?: "current-password" | "new-password";
31
+ /** The show toggle's name, "Show password" when not given: give each of two fields in a
32
+ * form its own, such as "Show password again". */
33
+ toggleLabel?: string;
29
34
  }>;
30
35
  /** A boxed password field with a show toggle inside its box, built on `@foldkit/ui`'s Input:
31
- * named by its label, described by its help line, `aria-invalid` when it failed and
32
- * `aria-required` when the form is not sent without it. The toggle is a button named "Show
33
- * password", `aria-pressed` while the password shows. For a new password, its strength is a
34
- * meter. */
36
+ * named by its label, described by its help line, `aria-invalid` and described by its
37
+ * `error` when it failed, and `aria-required` when the form is not sent without it. The
38
+ * toggle is a button named `toggleLabel` ("Show password"), `aria-pressed` while the
39
+ * password shows. For a new password, its strength is a meter. */
35
40
  export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
36
41
  //# sourceMappingURL=passwordField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"passwordField.d.ts","sourceRoot":"","sources":["../../../src/passwordField/passwordField.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQtD,wEAAwE;AACxE,eAAO,MAAM,QAAQ,2CAAmC,CAAC;AACzD,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAiB5C,gEAAgE;AAChE,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,8CAA8C;IAC9C,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;gDAC4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,iDAAiD;IACjD,aAAa,EAAE,OAAO,CAAC;IACvB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yFAAyF;IACzF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;iDAC6C;IAC7C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,gEAAgE;IAChE,YAAY,CAAC,EAAE,kBAAkB,GAAG,cAAc,CAAC;CACpD,CAAC,CAAC;AAEH;;;;aAIa;AACb,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IA8EpF,CAAC"}
1
+ {"version":3,"file":"passwordField.d.ts","sourceRoot":"","sources":["../../../src/passwordField/passwordField.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAStD,wEAAwE;AACxE,eAAO,MAAM,QAAQ,2CAAmC,CAAC;AACzD,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAiB5C,gEAAgE;AAChE,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,8CAA8C;IAC9C,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;gDAC4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,iDAAiD;IACjD,aAAa,EAAE,OAAO,CAAC;IACvB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;uCAEmC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,yFAAyF;IACzF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;iDAC6C;IAC7C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,gEAAgE;IAChE,YAAY,CAAC,EAAE,kBAAkB,GAAG,cAAc,CAAC;IACnD;uDACmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC;AAEH;;;;mEAImE;AACnE,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAiFpF,CAAC"}
@@ -2,6 +2,7 @@ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
2
  import { Input as UiInput } from "@foldkit/ui";
3
3
  import { Match, Schema } from "effect";
4
4
  import { pressedAttribute } from "../button/button.js";
5
+ import { describedByError, errorView } from "../field/field.js";
5
6
  import * as IconButton from "../iconButton/iconButton.js";
6
7
  import * as Meter from "../meter/meter.js";
7
8
  // STRENGTH
@@ -10,17 +11,17 @@ export const Strength = Schema.Literals([0, 1, 2, 3, 4]);
10
11
  const STRENGTH_CELLS = 4;
11
12
  const strengthWord = (strength) => __foldkitBrandViewResult((Match.value(strength).pipe(Match.withReturnType(), Match.when(0, () => __foldkitBrandViewResult(("too short"), "@gjermundgaraba-designs/pixel-paper/src/passwordField/passwordField.js#anonymous")), Match.when(1, () => __foldkitBrandViewResult(("weak"), "@gjermundgaraba-designs/pixel-paper/src/passwordField/passwordField.js#anonymous~2")), Match.when(2, () => __foldkitBrandViewResult(("fair"), "@gjermundgaraba-designs/pixel-paper/src/passwordField/passwordField.js#anonymous~3")), Match.when(3, () => __foldkitBrandViewResult(("good"), "@gjermundgaraba-designs/pixel-paper/src/passwordField/passwordField.js#anonymous~4")), Match.when(4, () => __foldkitBrandViewResult(("strong"), "@gjermundgaraba-designs/pixel-paper/src/passwordField/passwordField.js#anonymous~5")), Match.exhaustive)), "@gjermundgaraba-designs/pixel-paper/src/passwordField/passwordField.js#strengthWord");
12
13
  /** A boxed password field with a show toggle inside its box, built on `@foldkit/ui`'s Input:
13
- * named by its label, described by its help line, `aria-invalid` when it failed and
14
- * `aria-required` when the form is not sent without it. The toggle is a button named "Show
15
- * password", `aria-pressed` while the password shows. For a new password, its strength is a
16
- * meter. */
14
+ * named by its label, described by its help line, `aria-invalid` and described by its
15
+ * `error` when it failed, and `aria-required` when the form is not sent without it. The
16
+ * toggle is a button named `toggleLabel` ("Show password"), `aria-pressed` while the
17
+ * password shows. For a new password, its strength is a meter. */
17
18
  export const view = (config, h) => {
18
- const { id, label, value, onInput, isShown, onToggleShown, help, isInvalid = false, isRequired = false, strength, autocomplete = "current-password", } = config;
19
+ const { id, label, value, onInput, isShown, onToggleShown, help, error, isRequired = false, strength, autocomplete = "current-password", toggleLabel = "Show password", } = config;
19
20
  return __foldkitBrandViewResult((UiInput.view({
20
21
  id,
21
22
  value,
22
23
  onInput,
23
- isInvalid,
24
+ isInvalid: error !== undefined,
24
25
  type: isShown ? "text" : "password",
25
26
  hasDescription: help !== undefined,
26
27
  toView: (groups) => __foldkitBrandViewResult((h.div([h.Class("field boxed")], [
@@ -30,16 +31,18 @@ export const view = (config, h) => {
30
31
  h.input([
31
32
  ...groups.input,
32
33
  h.Autocomplete(autocomplete),
34
+ ...describedByError(id, error, help !== undefined, h),
33
35
  ...(isRequired ? [h.AriaRequired(true)] : []),
34
36
  ]),
35
37
  IconButton.view({
36
38
  glyph: isShown ? "eye-off" : "eye",
37
- label: "Show password",
39
+ label: toggleLabel,
38
40
  isQuiet: true,
39
41
  onClick: onToggleShown,
40
42
  attributes: [pressedAttribute(isShown, h)],
41
43
  }, h),
42
44
  ]),
45
+ ...errorView(id, error, h),
43
46
  ...(strength === undefined
44
47
  ? []
45
48
  : [
@@ -1,6 +1,8 @@
1
1
  import type { Html, HtmlBuilder } from "foldkit/html";
2
- /** One place in Places: a button that shows it. */
3
- export type Place<Message> = Readonly<{
2
+ /** One place in Places: a link to its address (`href`), or a button that shows it in the page
3
+ * (`onSelect`). */
4
+ export type Place<Message> = PlaceContent & PlaceTarget<Message>;
5
+ type PlaceContent = Readonly<{
4
6
  /** Stable and unique among the places: the row's key, so two places that share a name stay
5
7
  * apart. */
6
8
  id: string;
@@ -12,8 +14,15 @@ export type Place<Message> = Readonly<{
12
14
  count?: number;
13
15
  /** A quiet IconButton after it that acts on the place itself (remove a saved filter). */
14
16
  tools?: ReadonlyArray<Html>;
15
- /** Shows the place. */
17
+ }>;
18
+ type PlaceTarget<Message> = Readonly<{
19
+ /** The place's address: the line is a link, so it opens in a new tab and reads as one. */
20
+ href: string;
21
+ onSelect?: never;
22
+ }> | Readonly<{
23
+ /** Shows the place without leaving the page: the line is a button. */
16
24
  onSelect: Message;
25
+ href?: never;
17
26
  }>;
18
27
  /** Configuration for rendering places with `view`. */
19
28
  export type ViewConfig<Message> = Readonly<{
@@ -22,7 +31,8 @@ export type ViewConfig<Message> = Readonly<{
22
31
  places: ReadonlyArray<Place<Message>>;
23
32
  }>;
24
33
  /** A column of places to go (areas, collections, saved filters), flush in a rail panel: a
25
- * navigation landmark named by its label, one line each a button built on `@foldkit/ui`'s
26
- * Button, the one you are in `aria-current="page"` and printed inverted. */
34
+ * navigation landmark named by its label, one line each a link to the place or a button built
35
+ * on `@foldkit/ui`'s Button, the one you are in `aria-current="page"` and printed inverted. */
27
36
  export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
37
+ export {};
28
38
  //# sourceMappingURL=places.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"places.d.ts","sourceRoot":"","sources":["../../../src/places/places.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAOtD,mDAAmD;AACnD,MAAM,MAAM,KAAK,CAAC,OAAO,IAAI,QAAQ,CAAC;IACpC;iBACa;IACb,EAAE,EAAE,MAAM,CAAC;IACX,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,KAAK,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5B,uBAAuB;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;CACvC,CAAC,CAAC;AAgCH;;6EAE6E;AAC7E,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAOpF,CAAC"}
1
+ {"version":3,"file":"places.d.ts","sourceRoot":"","sources":["../../../src/places/places.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAOtD;oBACoB;AACpB,MAAM,MAAM,KAAK,CAAC,OAAO,IAAI,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAEjE,KAAK,YAAY,GAAG,QAAQ,CAAC;IAC3B;iBACa;IACb,EAAE,EAAE,MAAM,CAAC;IACX,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,KAAK,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;CAC7B,CAAC,CAAC;AAEH,KAAK,WAAW,CAAC,OAAO,IACpB,QAAQ,CAAC;IACP,0FAA0F;IAC1F,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB,CAAC,GACF,QAAQ,CAAC;IACP,sEAAsE;IACtE,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,CAAC,CAAC;AAEP,sDAAsD;AACtD,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;CACvC,CAAC,CAAC;AAgCH;;gGAEgG;AAChG,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAOpF,CAAC"}
@@ -3,24 +3,26 @@ import { Button as UiButton } from "@foldkit/ui";
3
3
  import { Array } from "effect";
4
4
  import { LOCALE } from "../locale/locale.js";
5
5
  import { slotView } from "../slot/slot.js";
6
- const placeView = (h) => __foldkitBrandViewResult(((place) => {
7
- const { label, isCurrent = false, count, tools = [], onSelect } = place;
8
- return __foldkitBrandViewResult((h.keyed("li")(place.id, [], [
9
- UiButton.view({
10
- onClick: onSelect,
11
- toView: (groups) => __foldkitBrandViewResult((h.button([...groups.button, ...(isCurrent ? [h.AriaCurrent("page")] : [])], [
12
- h.span([h.Class("place-name")], [label]),
13
- ...(count === undefined
14
- ? []
15
- : [" ", h.span([h.Class("place-count")], [count.toLocaleString(LOCALE)])]),
16
- ])), "@gjermundgaraba-designs/pixel-paper/src/places/places.js#toView"),
17
- }, h),
18
- ...slotView("span", "place-tools", tools, h),
19
- ])), "@gjermundgaraba-designs/pixel-paper/src/places/places.js#anonymous");
20
- }), "@gjermundgaraba-designs/pixel-paper/src/places/places.js#placeView");
6
+ const lineView = (place, h) => {
7
+ const { label, isCurrent = false, count } = place;
8
+ const current = isCurrent ? [h.AriaCurrent("page")] : [];
9
+ const content = [
10
+ h.span([h.Class("place-name")], [label]),
11
+ ...(count === undefined
12
+ ? []
13
+ : [" ", h.span([h.Class("place-count")], [count.toLocaleString(LOCALE)])]),
14
+ ];
15
+ return __foldkitBrandViewResult((place.href === undefined
16
+ ? UiButton.view({
17
+ onClick: place.onSelect,
18
+ toView: (groups) => __foldkitBrandViewResult((h.button([...groups.button, ...current], content)), "@gjermundgaraba-designs/pixel-paper/src/places/places.js#toView"),
19
+ }, h)
20
+ : h.a([h.Href(place.href), ...current], content)), "@gjermundgaraba-designs/pixel-paper/src/places/places.js#lineView");
21
+ };
22
+ const placeView = (h) => __foldkitBrandViewResult(((place) => __foldkitBrandViewResult((h.keyed("li")(place.id, [], [lineView(place, h), ...slotView("span", "place-tools", place.tools ?? [], h)])), "@gjermundgaraba-designs/pixel-paper/src/places/places.js#anonymous")), "@gjermundgaraba-designs/pixel-paper/src/places/places.js#placeView");
21
23
  /** A column of places to go (areas, collections, saved filters), flush in a rail panel: a
22
- * navigation landmark named by its label, one line each a button built on `@foldkit/ui`'s
23
- * Button, the one you are in `aria-current="page"` and printed inverted. */
24
+ * navigation landmark named by its label, one line each a link to the place or a button built
25
+ * on `@foldkit/ui`'s Button, the one you are in `aria-current="page"` and printed inverted. */
24
26
  export const view = (config, h) => {
25
27
  const { label, places } = config;
26
28
  return __foldkitBrandViewResult((h.nav([h.AriaLabel(label), h.Class("places")], [h.ul([], Array.map(places, placeView(h)))])), "@gjermundgaraba-designs/pixel-paper/src/places/places.js#view");
@@ -83,8 +83,8 @@ export type ViewInputs = Readonly<{
83
83
  options: ReadonlyArray<RadioOption>;
84
84
  /** The parent's selection. */
85
85
  selectedValue: Option.Option<string>;
86
- /** The group is `aria-invalid` and its marks and names turn red; say why in an
87
- * ErrorSummary above the form. */
86
+ /** The group is `aria-invalid` and its marks and names turn red; say why in its
87
+ * Fieldset's `error` and in an ErrorSummary above the form. */
88
88
  isInvalid?: boolean;
89
89
  }>;
90
90
  /**
@@ -117,8 +117,8 @@ export declare const view: import("foldkit/submodel").View<{
117
117
  options: ReadonlyArray<RadioOption>;
118
118
  /** The parent's selection. */
119
119
  selectedValue: Option.Option<string>;
120
- /** The group is `aria-invalid` and its marks and names turn red; say why in an
121
- * ErrorSummary above the form. */
120
+ /** The group is `aria-invalid` and its marks and names turn red; say why in its
121
+ * Fieldset's `error` and in an ErrorSummary above the form. */
122
122
  isInvalid?: boolean;
123
123
  }>>;
124
124
  //# sourceMappingURL=radioChoices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radioChoices.d.ts","sourceRoot":"","sources":["../../../src/radioChoices/radioChoices.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAK/C,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAIzC;2FAC2F;AAC3F,eAAO,MAAM,KAAK;;;;;EAAoD,CAAC;AACvE,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAItC,wDAAwD;AACxD,eAAO,MAAM,OAAO;;QACM,OAAO;;;;;;;;;;;EAC/B,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAA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,CAAC;IAChC,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACpC,8BAA8B;IAC9B,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrC;oEACgE;IAChE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;IAjBf,oFAAoF;WAC7E,MAAM;aACJ,aAAa,CAAC,WAAW,CAAC;IACnC,8BAA8B;mBACf,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC;oEACgE;gBACpD,OAAO;GAkDnB,CAAC"}
@@ -113,8 +113,8 @@ export type ViewInputs = Readonly<{
113
113
  }>;
114
114
  /**
115
115
  * A column of panels beside the deck, fixed under the top bar and scrolling itself:
116
- * `div.railed > aside.rail[popover="auto"][aria-label]` and the deck. One element serves both
117
- * layouts, so nothing in it renders twice or loses its state. At 900px and under it leaves the
116
+ * `div.railed >` the deck, then `aside.rail[popover="auto"][aria-label]`. One element serves
117
+ * both layouts, so nothing in it renders twice or loses its state. At 900px and under it leaves the
118
118
  * page, and `span.rail-open > button.btn.small` at the top of the deck opens the same element as a
119
119
  * drawer over a veil, its head (the name and a close glyph) showing. Opening focuses its first
120
120
  * control; Escape, a press on the veil, the close glyph, focus leaving or the window growing
@@ -1 +1 @@
1
- {"version":3,"file":"rail.d.ts","sourceRoot":"","sources":["../../../src/rail/rail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACtE,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AAIvC,OAAO,KAAK,KAAK,MAAM,MAAM,gB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B,MAAM,CAAC,MAAM,CAAC,aAAa,CAC6D,CAAC;AAE5F;eACe;AACf,eAAO,MAAM,mBAAmB,UACvB,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,KACnC,MAAM,CAAC,MAAM,CAAC,aAAa,CACmD,CAAC;AAElF;6DAC6D;AAC7D,eAAO,MAAM,qBAAqB,SAC1B,OAAO,SACN,UAAU,gBACH,OAAO,KACpB,MAAM,CAAC,MAAM,CAAC,aAAa,CAK3B,CAAC;AAEJ;;8CAE8C;AAC9C,eAAO,MAAM,gBAAgB;;;;;;EA0B3B,CAAC;AAIH,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,2FAA2F;IAC3F,KAAK,EAAE,MAAM,CAAC;IACd;;uFAEmF;IACnF,WAAW,EAAE,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IACvC;;gDAE4C;IAC5C,UAAU,EAAE,CAAC,UAAU,EAAE,IAAI,KAAK,IAAI,CAAC;CACxC,CAAC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;IAzBf,2FAA2F;WACpF,MAAM;IACb;;uFAEmF;iBACtE,MAAM,aAAa,CAAC,IAAI,CAAC;IACtC;;gDAE4C;gBAChC,CAAC,UAAU,EAAE,IAAI,KAAK,IAAI;GAqEtC,CAAC"}
@@ -134,8 +134,8 @@ export const FollowRailDrawer = Mount.defineStream("FollowRailDrawer", {
134
134
  });
135
135
  /**
136
136
  * A column of panels beside the deck, fixed under the top bar and scrolling itself:
137
- * `div.railed > aside.rail[popover="auto"][aria-label]` and the deck. One element serves both
138
- * layouts, so nothing in it renders twice or loses its state. At 900px and under it leaves the
137
+ * `div.railed >` the deck, then `aside.rail[popover="auto"][aria-label]`. One element serves
138
+ * both layouts, so nothing in it renders twice or loses its state. At 900px and under it leaves the
139
139
  * page, and `span.rail-open > button.btn.small` at the top of the deck opens the same element as a
140
140
  * drawer over a veil, its head (the name and a close glyph) showing. Opening focuses its first
141
141
  * control; Escape, a press on the veil, the close glyph, focus leaving or the window growing
@@ -160,7 +160,10 @@ export const view = defineView((model, viewInputs, h) => {
160
160
  ],
161
161
  }, h),
162
162
  ]);
163
+ // NOTE: the deck comes first so the page's main content, and its h1, precede the rail's
164
+ // panels in reading order; the stylesheet places the rail, fixed, at the left.
163
165
  return __foldkitBrandViewResult((h.div([h.Class("railed")], [
166
+ toDeckView(openButton),
164
167
  h.aside([
165
168
  h.Id(model.id),
166
169
  h.Popover("auto"),
@@ -174,6 +177,5 @@ export const view = defineView((model, viewInputs, h) => {
174
177
  ]),
175
178
  ...toAsideView(),
176
179
  ]),
177
- toDeckView(openButton),
178
180
  ])), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~10");
179
181
  });
@@ -1,3 +1,3 @@
1
1
  export { glyphView, rowView, titleView, toggleView, view } from "./rows.ts";
2
- export type { GlyphConfig, RowConfig, RowSelect, TitleConfig, ToggleConfig, ViewConfig, } from "./rows.ts";
2
+ export type { GlyphConfig, RowConfig, RowSelect, TitleConfig, ToggleConfig, TreegridPlace, ViewConfig, } from "./rows.ts";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5E,YAAY,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,GACX,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5E,YAAY,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,WAAW,CAAC"}
@@ -7,8 +7,12 @@ export type ViewConfig = Readonly<{
7
7
  rows: ReadonlyArray<Html>;
8
8
  /** An outline: nested rows indent 26px and hang on a 1px rule guide. */
9
9
  isOutline?: boolean;
10
- /** Names the list for screen readers. */
10
+ /** Names the list for screen readers; a treegrid needs it. */
11
11
  label?: string;
12
+ /** A keyboard-driven list, whose cursor the application moves (see Keys in DESIGN.md): a
13
+ * `role="treegrid"`, so a screen reader hands it the arrow and letter keys. Give every row
14
+ * its `treegrid` place. */
15
+ isTreegrid?: boolean;
12
16
  }>;
13
17
  /** A list of 34px rows. */
14
18
  export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
@@ -26,6 +30,19 @@ export type RowSelect<Message> = Readonly<{
26
30
  * toggles it wherever it is clicked, on the button or the link too. */
27
31
  label?: string;
28
32
  }>;
33
+ /** A row's place in a treegrid (`view`'s `isTreegrid`): its line is a `role="row"` and each
34
+ * of its parts a `role="gridcell"`, while the list items around them step aside
35
+ * (`role="none"`). */
36
+ export type TreegridPlace = Readonly<{
37
+ /** Its depth, from 1 at the list's roots: `aria-level`. */
38
+ level: number;
39
+ /** Its place among its siblings, from 1: `aria-posinset`. */
40
+ position: number;
41
+ /** How many siblings it has, itself included: `aria-setsize`. */
42
+ setSize: number;
43
+ /** Whether the rows under it show, for a row that folds: `aria-expanded`. */
44
+ isExpanded?: boolean;
45
+ }>;
29
46
  /** Configuration for rendering a row with `rowView`. */
30
47
  export type RowConfig<Message> = Readonly<{
31
48
  /** The row's stable id among its siblings. */
@@ -36,6 +53,10 @@ export type RowConfig<Message> = Readonly<{
36
53
  body: ReadonlyArray<Html | string>;
37
54
  /** Right-aligned chips, marks, counts, due days. */
38
55
  slot?: ReadonlyArray<Html | string>;
56
+ /** Further attributes for the slot's `span.slot`, such as an id the row's line is described
57
+ * by (`aria-describedby`); there is no span, and so nothing to point at, while `slot` is
58
+ * empty. Never a class. */
59
+ slotAttributes?: Attributes<Message>;
39
60
  /** Controls that belong to the row's job, before the tools (an approve and reject pair). */
40
61
  actions?: ReadonlyArray<Html | string>;
41
62
  /** Icon buttons at the row's right end, dimmed until the row is hovered or focused (full
@@ -49,14 +70,18 @@ export type RowConfig<Message> = Readonly<{
49
70
  isContext?: boolean;
50
71
  /** Makes the row selectable: a box at its left edge. */
51
72
  select?: RowSelect<Message>;
73
+ /** The row's place in a treegrid; every row of a treegrid has one. */
74
+ treegrid?: TreegridPlace;
52
75
  /** Further attributes for the row's line, the `div.row`, not its `li`: a keyboard list's
53
76
  * cursor (`aria-current="true"`, which the stylesheet outlines, and a roving `tabindex`),
54
- * `role="group"` and a name, data attributes, key and focus handlers. Never a class. */
77
+ * its name (with `role="group"` outside a treegrid, whose row is already a named `row`), data
78
+ * attributes, key and focus handlers. Never a class. */
55
79
  attributes?: Attributes<Message>;
56
80
  }>;
57
81
  /** One 34px row: box, glyph, text, slot, actions, tools, and the rows nested under it. Hover
58
82
  * and focus tint it head. The box of a selectable row is built on `@foldkit/ui`'s Checkbox:
59
- * a `role="checkbox"` button (`aria-checked`) whose whole cell is its target. */
83
+ * a `role="checkbox"` button (`aria-checked`) whose whole cell is its target. In a treegrid
84
+ * the line is the `role="row"` and each part a `role="gridcell"`. */
60
85
  export declare const rowView: <Message>(config: RowConfig<Message>, h: HtmlBuilder<Message>) => Html;
61
86
  /** Configuration for rendering a glyph slot with `glyphView`. */
62
87
  export type GlyphConfig = Readonly<{
@@ -67,12 +92,13 @@ export declare const glyphView: <Message>(config: GlyphConfig, h: HtmlBuilder<Me
67
92
  /** Configuration for rendering a fold toggle with `toggleView`. */
68
93
  export type ToggleConfig<Message> = Readonly<{
69
94
  isExpanded: boolean;
70
- /** What folds: `"Fold Notes"` and `"Unfold Notes"` are built from it. */
95
+ /** What the nested rows hang under: the toggle is named `"Rows under Notes"` whether open
96
+ * or not, and `aria-expanded` says which. */
71
97
  label: string;
72
98
  onToggle: Message;
73
99
  }>;
74
100
  /** The glyph slot as a fold toggle, built on `@foldkit/ui`'s Button: a ring, open or closed,
75
- * `aria-expanded`, named for what it does next. */
101
+ * `aria-expanded`, named for the rows it shows. */
76
102
  export declare const toggleView: <Message>(config: ToggleConfig<Message>, h: HtmlBuilder<Message>) => Html;
77
103
  /** Configuration for rendering a row's title with `titleView`. */
78
104
  export type TitleConfig<Message> = Readonly<{
@@ -1 +1 @@
1
- {"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../../src/rows/rows.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;AAKpD,8DAA8D;AAC9D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,gCAAgC;IAChC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1B,wEAAwE;IACxE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,2BAA2B;AAC3B,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAOzE,CAAC;AAIJ;;+FAE+F;AAC/F,MAAM,MAAM,SAAS,CAAC,OAAO,IAAI,QAAQ,CAAC;IACxC;cACU;IACV,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAC;IAC1C;4EACwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,wDAAwD;AACxD,MAAM,MAAM,SAAS,CAAC,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6
6
  export const view = (config, h) => __foldkitBrandViewResult((h.ul([
7
+ ...(config.isTreegrid === true ? [h.Role("treegrid")] : []),
7
8
  ...(config.label === undefined ? [] : [h.AriaLabel(config.label)]),
8
9
  h.Class(config.isOutline === true ? "rows tree" : "rows"),
9
10
  ], config.rows)), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#view");
11
+ const cellRole = (config, h) => (__foldkitBrandViewResult((config.treegrid === undefined ? [] : [h.Role("gridcell")]), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#cellRole"));
12
+ const rowRole = (place, h) => __foldkitBrandViewResult((place === undefined
13
+ ? []
14
+ : [
15
+ h.Role("row"),
16
+ h.AriaLevel(place.level),
17
+ h.AriaPosinset(place.position),
18
+ h.AriaSetsize(place.setSize),
19
+ ...(place.isExpanded === undefined ? [] : [h.AriaExpanded(place.isExpanded)]),
20
+ ]), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#rowRole");
21
+ /** A part the caller gives (a glyph, the actions) in its own cell, in a treegrid. */
22
+ const cellView = (config, className, content, h) => __foldkitBrandViewResult((config.treegrid === undefined
23
+ ? content
24
+ : slotView("span", className, content, h, cellRole(config, h))), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#cellView");
10
25
  /** The row's text, with the words that say a context row is one. */
11
26
  const textOf = (config, h) => __foldkitBrandViewResult((config.isContext === true
12
27
  ? [...config.body, h.span([h.Class("sr-only")], [" (context)"])]
13
28
  : config.body), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#textOf");
14
- const lineView = (config, box, text, h) => __foldkitBrandViewResult((h.div([...(config.attributes ?? []), h.Class(config.isContext === true ? "row context" : "row")], [
29
+ const lineView = (config, box, text, h) => __foldkitBrandViewResult((h.div([
30
+ ...(config.attributes ?? []),
31
+ ...rowRole(config.treegrid, h),
32
+ h.Class(config.isContext === true ? "row context" : "row"),
33
+ ], [
15
34
  ...box,
16
- ...(config.glyph === undefined ? [] : [config.glyph]),
35
+ ...cellView(config, "cell", config.glyph === undefined ? [] : [config.glyph], h),
17
36
  text,
18
- ...slotView("span", "slot", config.slot ?? [], h),
19
- ...(config.actions ?? []),
20
- ...slotView("span", "tools", config.tools ?? [], h),
37
+ ...slotView("span", "slot", config.slot ?? [], h, [
38
+ ...(config.slotAttributes ?? []),
39
+ ...cellRole(config, h),
40
+ ]),
41
+ ...cellView(config, "cell actions", config.actions ?? [], h),
42
+ ...slotView("span", "tools", config.tools ?? [], h, cellRole(config, h)),
21
43
  ])), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#lineView");
22
44
  const selectableLineView = (config, select, h) => __foldkitBrandViewResult((UiCheckbox.view({
23
45
  id: select.id,
24
46
  isChecked: select.isChecked,
25
47
  onToggle: select.onToggle,
26
48
  toView: (groups) => {
27
- const boxView = (name) => __foldkitBrandViewResult((h.span([h.Class("row-check")], [h.button(groups.checkbox), ...name])), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#boxView");
49
+ const boxView = (name) => __foldkitBrandViewResult((h.span([...cellRole(config, h), h.Class("row-check")], [h.button(groups.checkbox), ...name])), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#boxView");
50
+ const label = h.label([...groups.label, h.Class("grow")], textOf(config, h));
28
51
  return __foldkitBrandViewResult((select.label === undefined
29
- ? lineView(config, [boxView([])], h.label([...groups.label, h.Class("grow")], textOf(config, h)), h)
30
- : lineView(config, [boxView([h.span([...groups.label, h.Class("sr-only")], [select.label])])], h.div([h.Class("grow")], textOf(config, h)), h)), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#toView");
52
+ ? lineView(config, [boxView([])], config.treegrid === undefined
53
+ ? label
54
+ : h.span([...cellRole(config, h), h.Class("cell grow-cell")], [label]), h)
55
+ : lineView(config, [boxView([h.span([...groups.label, h.Class("sr-only")], [select.label])])], h.div([...cellRole(config, h), h.Class("grow")], textOf(config, h)), h)), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#toView");
31
56
  },
32
57
  }, h)), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#selectableLineView");
33
58
  /** One 34px row: box, glyph, text, slot, actions, tools, and the rows nested under it. Hover
34
59
  * and focus tint it head. The box of a selectable row is built on `@foldkit/ui`'s Checkbox:
35
- * a `role="checkbox"` button (`aria-checked`) whose whole cell is its target. */
36
- export const rowView = (config, h) => __foldkitBrandViewResult((h.keyed("li")(config.key, [], [
37
- config.select === undefined
38
- ? lineView(config, [], h.div([h.Class("grow")], textOf(config, h)), h)
39
- : selectableLineView(config, config.select, h),
40
- ...slotView("ul", "rows", config.nested ?? [], h),
41
- ])), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#rowView");
60
+ * a `role="checkbox"` button (`aria-checked`) whose whole cell is its target. In a treegrid
61
+ * the line is the `role="row"` and each part a `role="gridcell"`. */
62
+ export const rowView = (config, h) => {
63
+ const listRole = config.treegrid === undefined ? [] : [h.Role("none")];
64
+ return __foldkitBrandViewResult((h.keyed("li")(config.key, listRole, [
65
+ config.select === undefined
66
+ ? lineView(config, [], h.div([...cellRole(config, h), h.Class("grow")], textOf(config, h)), h)
67
+ : selectableLineView(config, config.select, h),
68
+ ...slotView("ul", "rows", config.nested ?? [], h, listRole),
69
+ ])), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#rowView");
70
+ };
42
71
  /** A glyph in the row's 18px slot. */
43
72
  export const glyphView = (config, h) => __foldkitBrandViewResult((h.span([h.Class("glyph")], [Glyph.view({ name: config.name }, h)])), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#glyphView");
44
73
  /** The glyph slot as a fold toggle, built on `@foldkit/ui`'s Button: a ring, open or closed,
45
- * `aria-expanded`, named for what it does next. */
74
+ * `aria-expanded`, named for the rows it shows. */
46
75
  export const toggleView = (config, h) => __foldkitBrandViewResult((UiButton.view({
47
76
  onClick: config.onToggle,
48
77
  toView: (groups) => __foldkitBrandViewResult((h.button([
49
78
  ...groups.button,
50
79
  h.AriaExpanded(config.isExpanded),
51
- h.AriaLabel(`${config.isExpanded ? "Fold" : "Unfold"} ${config.label}`),
80
+ h.AriaLabel(`Rows under ${config.label}`),
52
81
  h.Class("glyph"),
53
82
  ], [Glyph.view({ name: config.isExpanded ? "ring" : "ring-closed" }, h)])), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#toView~2"),
54
83
  }, h)), "@gjermundgaraba-designs/pixel-paper/src/rows/rows.js#toggleView");