@gjermundgaraba-designs/pixel-paper 0.20.0 → 0.21.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 (37) hide show
  1. package/DESIGN.md +3 -3
  2. package/dist/src/commandPalette/commandPalette.d.ts +4 -3
  3. package/dist/src/commandPalette/commandPalette.d.ts.map +1 -1
  4. package/dist/src/commandPalette/commandPalette.js +34 -35
  5. package/dist/src/commandPalette/match.d.ts +5 -2
  6. package/dist/src/commandPalette/match.d.ts.map +1 -1
  7. package/dist/src/commandPalette/match.js +14 -3
  8. package/dist/src/field/field.d.ts +3 -0
  9. package/dist/src/field/field.d.ts.map +1 -1
  10. package/dist/src/field/field.js +2 -2
  11. package/dist/src/lineDiff/index.d.ts +2 -0
  12. package/dist/src/lineDiff/index.d.ts.map +1 -1
  13. package/dist/src/lineDiff/index.js +1 -0
  14. package/dist/src/lineDiff/lineDiff.d.ts +8 -4
  15. package/dist/src/lineDiff/lineDiff.d.ts.map +1 -1
  16. package/dist/src/lineDiff/lineDiff.js +19 -15
  17. package/dist/src/lineDiff/patch.d.ts +35 -0
  18. package/dist/src/lineDiff/patch.d.ts.map +1 -0
  19. package/dist/src/lineDiff/patch.js +146 -0
  20. package/dist/src/menu/menu.d.ts +6 -6
  21. package/dist/src/reel/layout.d.ts +2 -1
  22. package/dist/src/reel/layout.d.ts.map +1 -1
  23. package/dist/src/reel/layout.js +22 -4
  24. package/dist/src/sortable/sortable.d.ts +30 -30
  25. package/dist/src/toast/toast.d.ts +12 -12
  26. package/dist/src/window/window.d.ts +3 -1
  27. package/dist/src/window/window.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/src/commandPalette/commandPalette.ts +11 -15
  30. package/src/commandPalette/match.ts +22 -5
  31. package/src/field/field.ts +5 -1
  32. package/src/lineDiff/index.ts +2 -0
  33. package/src/lineDiff/lineDiff.ts +29 -24
  34. package/src/lineDiff/patch.ts +218 -0
  35. package/src/pixel-paper.css +6 -0
  36. package/src/reel/layout.ts +27 -4
  37. package/src/window/window.ts +3 -1
@@ -0,0 +1,146 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { Array, Option, String, pipe } from "effect";
3
+ import { diffRowsOfPatch } from "./diff.js";
4
+ // QUOTED PATHS
5
+ const ESCAPED_BYTES = {
6
+ a: 7,
7
+ b: 8,
8
+ t: 9,
9
+ n: 10,
10
+ v: 11,
11
+ f: 12,
12
+ r: 13,
13
+ };
14
+ // an octal escape is one byte of the name's UTF-8, so the bytes are gathered before decoding
15
+ const QUOTED_PART = /\\([0-7]{3})|\\(.)|[^\\]+/gu;
16
+ const bytesOf = (text) => __foldkitBrandViewResult(([...new TextEncoder().encode(text)]), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#bytesOf");
17
+ const bytesOfPart = ([part, octal, escaped]) => {
18
+ if (octal !== undefined) {
19
+ return __foldkitBrandViewResult(([Number.parseInt(octal, 8)]), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#bytesOfPart");
20
+ }
21
+ else if (escaped !== undefined) {
22
+ return __foldkitBrandViewResult((Option.match(Option.fromUndefinedOr(ESCAPED_BYTES[escaped]), {
23
+ onNone: () => __foldkitBrandViewResult((bytesOf(escaped)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#onNone"),
24
+ onSome: (byte) => __foldkitBrandViewResult(([byte]), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#onSome"),
25
+ })), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#bytesOfPart");
26
+ }
27
+ else {
28
+ return __foldkitBrandViewResult((bytesOf(part)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#bytesOfPart");
29
+ }
30
+ };
31
+ /** The name a path in git's header stands for: git C-quotes a name with unusual bytes
32
+ * (`"caf\303\251.txt"`), and leaves any other as it is. */
33
+ export const unquoted = (path) => __foldkitBrandViewResult((path.length >= 2 && path.startsWith('"') && path.endsWith('"')
34
+ ? new TextDecoder().decode(Uint8Array.from(Array.flatMap(Array.fromIterable(path.slice(1, -1).matchAll(QUOTED_PART)), bytesOfPart)))
35
+ : path), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#unquoted");
36
+ // HEADER
37
+ const GIT_SECTION = "diff --git ";
38
+ // the header is what comes before the first hunk, so a changed line that reads like a header
39
+ // line ("+rename from x") is never taken for one
40
+ const headOf = (section) => __foldkitBrandViewResult((Array.takeWhile(section.split("\n"), (line) => __foldkitBrandViewResult((!line.startsWith("@@") && !line.startsWith("--- ")), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#anonymous"))), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#headOf");
41
+ const valueAfter = (head, prefix) => __foldkitBrandViewResult((pipe(Array.findFirst(head, String.startsWith(prefix)), Option.map((line) => __foldkitBrandViewResult((line.slice(prefix.length)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#anonymous~2")))), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#valueAfter");
42
+ const hasLine = (head, prefix) => __foldkitBrandViewResult((Option.isSome(valueAfter(head, prefix))), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#hasLine");
43
+ const hasHunk = (section) => __foldkitBrandViewResult((Array.some(section.split("\n"), String.startsWith("@@ "))), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#hasHunk");
44
+ // git writes one section per file, after whatever precedes the first (a commit's message, a
45
+ // mail's head); a patch without a git header is one section
46
+ const sectionsOf = (patch) => {
47
+ const [first = "", ...others] = patch.split(/(?=^diff --git )/mu);
48
+ return __foldkitBrandViewResult((Array.isArrayNonEmpty(others) && !first.startsWith(GIT_SECTION)
49
+ ? others
50
+ : [first, ...others]), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#sectionsOf");
51
+ };
52
+ // READING
53
+ /** What a diff of two same texts says. */
54
+ export const SAME_NOTE = "No difference: both sides hold the same text.";
55
+ const UNREADABLE_NOTE = "This diff cannot be shown as lines.";
56
+ const BINARY_NOTE = "A binary file: its change has no lines.";
57
+ const unreadable = {
58
+ maybeRenamedFrom: Option.none(),
59
+ notes: [UNREADABLE_NOTE],
60
+ tables: [],
61
+ };
62
+ const lineNote = (head, hasRows) => {
63
+ if (hasLine(head, "Binary files ") || hasLine(head, "GIT binary patch")) {
64
+ return __foldkitBrandViewResult((Option.some(BINARY_NOTE)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#lineNote");
65
+ }
66
+ else if (hasRows) {
67
+ return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#lineNote");
68
+ }
69
+ else if (hasLine(head, "new file mode ")) {
70
+ return __foldkitBrandViewResult((Option.some("New empty file.")), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#lineNote");
71
+ }
72
+ else if (hasLine(head, "deleted file mode ")) {
73
+ return __foldkitBrandViewResult((Option.some("Deleted empty file.")), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#lineNote");
74
+ }
75
+ else {
76
+ return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#lineNote");
77
+ }
78
+ };
79
+ const readSection = (section) => {
80
+ const head = headOf(section);
81
+ const maybeRows = diffRowsOfPatch(section);
82
+ const maybeRenamedFrom = Option.map(valueAfter(head, "rename from "), unquoted);
83
+ const notes = [
84
+ ...Option.toArray(Option.map(maybeRenamedFrom, (from) => __foldkitBrandViewResult((`Renamed from ${from}.`), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#anonymous~3"))),
85
+ ...Option.toArray(Option.map(Option.all({ before: valueAfter(head, "old mode "), after: valueAfter(head, "new mode ") }), ({ before, after }) => __foldkitBrandViewResult((`Mode ${before} → ${after}.`), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#anonymous~4"))),
86
+ ...Option.toArray(lineNote(head, Option.isSome(maybeRows))),
87
+ ];
88
+ const isUnread = Option.isNone(maybeRows) && (hasHunk(section) || Array.isArrayEmpty(notes));
89
+ return __foldkitBrandViewResult((isUnread
90
+ ? unreadable
91
+ : {
92
+ maybeRenamedFrom,
93
+ notes,
94
+ tables: Option.toArray(Option.map(maybeRows, (rows) => (__foldkitBrandViewResult(({ rows, maybeSide: Option.none() }), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#anonymous~5")))),
95
+ }), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#readSection");
96
+ };
97
+ const KINDS = {
98
+ "100644": "a file",
99
+ "100755": "an executable file",
100
+ "120000": "a symlink",
101
+ "160000": "a submodule",
102
+ };
103
+ const kindOf = (mode) => __foldkitBrandViewResult((KINDS[mode] ?? `mode ${mode}`), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#kindOf");
104
+ const sideTable = (section, side) => __foldkitBrandViewResult((Option.toArray(Option.map(diffRowsOfPatch(section), (rows) => (__foldkitBrandViewResult(({ rows, maybeSide: Option.some(side) }), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#anonymous~6"))))), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#sideTable");
105
+ // a file that became a symlink (or any other kind) is two sections for one path: the old
106
+ // kind deleted, then the new one added
107
+ const readTypeChange = (gone, added) => {
108
+ const [goneHead, addedHead] = [headOf(gone), headOf(added)];
109
+ return __foldkitBrandViewResult((Option.flatMap(Option.all({
110
+ before: valueAfter(goneHead, "deleted file mode "),
111
+ after: valueAfter(addedHead, "new file mode "),
112
+ }), ({ before, after }) => __foldkitBrandViewResult((goneHead[0] === addedHead[0]
113
+ ? Option.some({
114
+ maybeRenamedFrom: Option.none(),
115
+ notes: [`It was ${kindOf(before)} and is now ${kindOf(after)}.`],
116
+ tables: [...sideTable(gone, "as it was"), ...sideTable(added, "as it is")],
117
+ })
118
+ : Option.none()), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#anonymous~7"))), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#readTypeChange");
119
+ };
120
+ /** What `patchView` makes of a patch: the notes it prints and the tables it draws. */
121
+ export const readPatch = (patch) => {
122
+ const text = patch.replaceAll("\r\n", "\n");
123
+ if (String.isEmpty(String.trim(text))) {
124
+ return __foldkitBrandViewResult(({ maybeRenamedFrom: Option.none(), notes: [SAME_NOTE], tables: [] }), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#readPatch");
125
+ }
126
+ else {
127
+ const sections = sectionsOf(text);
128
+ const [first, second, ...rest] = sections;
129
+ if (first !== undefined && second === undefined) {
130
+ return __foldkitBrandViewResult((readSection(first)), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#readPatch");
131
+ }
132
+ else if (first !== undefined && second !== undefined && Array.isArrayEmpty(rest)) {
133
+ return __foldkitBrandViewResult((Option.getOrElse(readTypeChange(first, second), () => __foldkitBrandViewResult((unreadable), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#anonymous~8"))), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#readPatch");
134
+ }
135
+ else {
136
+ return __foldkitBrandViewResult((unreadable), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#readPatch");
137
+ }
138
+ }
139
+ };
140
+ /** What `patchView` says about a patch from `git diff`, read from its header: the notes it
141
+ * prints (`["Renamed from old.txt."]`), for a caller that prints them itself, and the path a
142
+ * rename left. */
143
+ export const describePatch = (patch) => {
144
+ const { maybeRenamedFrom, notes } = readPatch(patch);
145
+ return __foldkitBrandViewResult(({ maybeRenamedFrom, notes }), "@gjermundgaraba-designs/pixel-paper/src/lineDiff/patch.js#describePatch");
146
+ };
@@ -76,6 +76,8 @@ export declare const update: (model: Model, message: Message) => Readonly<{
76
76
  };
77
77
  commands?: Update.Commands<{
78
78
  readonly _tag: "CompletedFocus";
79
+ } | {
80
+ readonly _tag: "PressedEscape";
79
81
  } | {
80
82
  readonly _tag: "ClickedToggle";
81
83
  } | {
@@ -84,8 +86,6 @@ export declare const update: (model: Model, message: Message) => Readonly<{
84
86
  readonly _tag: "CompletedPlaceSlip";
85
87
  } | {
86
88
  readonly _tag: "LeftSlip";
87
- } | {
88
- readonly _tag: "PressedEscape";
89
89
  } | {
90
90
  readonly _tag: "PressedTab";
91
91
  } | {
@@ -125,11 +125,11 @@ export declare const BindSlip: Mount.MountDefinitionWithArgs<"BindSlip", {
125
125
  isEnd: Schema.Boolean;
126
126
  edge: Schema.Literals<readonly ["First", "Last"]>;
127
127
  }, {
128
+ readonly _tag: "PressedEscape";
129
+ } | {
128
130
  readonly _tag: "CompletedPlaceSlip";
129
131
  } | {
130
132
  readonly _tag: "LeftSlip";
131
- } | {
132
- readonly _tag: "PressedEscape";
133
133
  } | {
134
134
  readonly _tag: "PressedTab";
135
135
  }>;
@@ -175,6 +175,8 @@ export declare const view: import("foldkit/submodel").View<{
175
175
  readonly edge: "First" | "Last";
176
176
  }, {
177
177
  readonly _tag: "CompletedFocus";
178
+ } | {
179
+ readonly _tag: "PressedEscape";
178
180
  } | {
179
181
  readonly _tag: "ClickedToggle";
180
182
  } | {
@@ -183,8 +185,6 @@ export declare const view: import("foldkit/submodel").View<{
183
185
  readonly _tag: "CompletedPlaceSlip";
184
186
  } | {
185
187
  readonly _tag: "LeftSlip";
186
- } | {
187
- readonly _tag: "PressedEscape";
188
188
  } | {
189
189
  readonly _tag: "PressedTab";
190
190
  } | {
@@ -173,7 +173,8 @@ export declare const targetAtPoint: (subject: Subject, columns: ReadonlyArray<Co
173
173
  /** What moving `splitter` by `share` asks of the layout, from the sizes the layout holds (not
174
174
  * the sizes printed, which the stylesheet may hold at a minimum): a width splitter adds
175
175
  * `share` to its column's width; a pane splitter moves `share` of its column's height from
176
- * the pane below it to the pane above. None when what it sizes is gone. */
176
+ * the pane below it to the pane above, leaving each a weight above nothing however small the
177
+ * column. None when what it sizes is gone. */
177
178
  export declare const resizeOf: (layout: Layout, splitter: Splitter, share: number) => Option.Option<Resize>;
178
179
  /** Whether what `splitter` sizes is still in `layout`. */
179
180
  export declare const isSplitterPresent: (layout: Layout, splitter: Splitter) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/reel/layout.ts"],"names":[],"mappings":"AAGA,OAAO,EAA+B,MAAM,EAAqB,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAQ9F;;sEAEsE;AACtE,eAAO,MAAM,IAAI;;;;EAIf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC;AAEpC;;;oFAGoF;AACpF,eAAO,MAAM,MAAM;;;;;;;;EAIjB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AAExC,yFAAyF;AACzF,eAAO,MAAM,MAAM;;;;;;;;GAAuB,CAAC;AAC3C,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AAExC,mDAAmD;AACnD,eAAO,MAAM,OAAO;;QACV,MAAM;;;QACJ,QAAQ;;EAClB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C;oFACoF;AACpF,eAAO,MAAM,MAAM;;QACT,QAAQ;QAAiB,KAAK;;;QAC/B,mBAAmB;;EAC1B,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AAIxC;;;;;gGAKgG;AAChG,eAAO,MAAM,UAAU;;QACR,MAAM;QAAiB,UAAU;QAAiB,OAAO;;;QACrD,MAAM;QAAiB,mBAAmB;;;QAC5C,QAAQ;QAAiB,mBAAmB;;;QAC1C,QAAQ;QAAiB,KAAK;;;QAE7C,QAAQ;QACR,OAAO;;EAET,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAEhD;0DAC0D;AAC1D,eAAO,MAAM,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M,cAAc,WAAY,MAAM,UAAU,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAKhF,CAAC;AAEL,eAAO,MAAM,IAAI,2DAAmD,CAAC;AACrE,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC;AAWpC,8FAA8F;AAC9F,eAAO,MAAM,eAAe,WAAY,MAAM,UAAU,MAAM,KAAG,OAC1B,CAAC;AAuDxC;;;gFAGgF;AAChF,eAAO,MAAM,aAAa,WAChB,MAAM,WACL,OAAO,UACR,MAAM,QACR,IAAI,KACT,MAeF,CAAC;AAQF;8CAC8C;AAC9C,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACpC,CAAC,CAAC;AAKH;;;;8FAI8F;AAC9F,eAAO,MAAM,aAAa,YACf,OAAO,WACP,aAAa,CAAC,SAAS,CAAC,WACxB,MAAM,WACN,MAAM,KACd,MA4BC,CAAC;AAuBL;;;;+CAI+C;AAC/C,eAAO,MAAM,QAAQ,WACX,MAAM,YACJ,QAAQ,SACX,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,MAAM,CAmCnB,CAAC;AAEL,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,WAAY,MAAM,YAAY,QAAQ,KAAG,OACzB,CAAC"}
@@ -69,9 +69,10 @@ export const columnIndexOf = (layout, columnId) => __foldkitBrandViewResult((Arr
69
69
  export const columnOf = (layout, columnId) => __foldkitBrandViewResult((Array.findFirst(layout, (column) => __foldkitBrandViewResult((column.id === columnId), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~7"))), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#columnOf");
70
70
  /** The id of the column after the one at `columnIndex`: none after the last. */
71
71
  const nextColumnId = (layout, columnIndex) => __foldkitBrandViewResult((Option.map(Array.get(layout, columnIndex + 1), (column) => __foldkitBrandViewResult((column.id), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~8"))), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#nextColumnId");
72
+ // a running mean, which never passes the largest weight, where the weights' sum may overflow
72
73
  const meanWeight = (panes) => __foldkitBrandViewResult((Array.match(panes, {
73
74
  onEmpty: () => __foldkitBrandViewResult((1), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#onEmpty"),
74
- onNonEmpty: (some) => __foldkitBrandViewResult((Number.sumAll(Array.map(some, (pane) => __foldkitBrandViewResult((pane.weight), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~9"))) / some.length), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#onNonEmpty"),
75
+ onNonEmpty: (some) => __foldkitBrandViewResult((Array.reduce(some, 0, (mean, pane, index) => __foldkitBrandViewResult((mean + (pane.weight - mean) / (index + 1)), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~9"))), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#onNonEmpty"),
75
76
  })), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#meanWeight");
76
77
  const othersIn = (column, paneId) => __foldkitBrandViewResult((Array.filter(column.panes, (pane) => __foldkitBrandViewResult((pane.id !== paneId), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~10"))), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#othersIn");
77
78
  const insertAt = (items, index, item) => {
@@ -343,10 +344,20 @@ const WIDTH_FLOOR = 0.1;
343
344
  const SHARE_FLOOR = 0.05;
344
345
  const PRECISION = 10_000;
345
346
  const rounded = (value) => __foldkitBrandViewResult((Math.round(value * PRECISION) / PRECISION), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#rounded");
347
+ /** `weight`, at least `floor`, to four decimals, or, where a step of four decimals is more than
348
+ * `floor` (a column whose weights total under a five-hundredth, or two panes that small), to
349
+ * the first power of ten no more than it, so that it never rounds to nothing. A weight too
350
+ * large or a floor too small to scale by that power is left as it is. */
351
+ const roundedOver = (weight, floor) => {
352
+ const precision = Math.max(PRECISION, 10 ** Math.ceil(-Math.log10(floor)));
353
+ const scaled = weight * precision;
354
+ return __foldkitBrandViewResult((globalThis.Number.isFinite(scaled) ? Math.round(scaled) / precision : weight), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#roundedOver");
355
+ };
346
356
  /** What moving `splitter` by `share` asks of the layout, from the sizes the layout holds (not
347
357
  * the sizes printed, which the stylesheet may hold at a minimum): a width splitter adds
348
358
  * `share` to its column's width; a pane splitter moves `share` of its column's height from
349
- * the pane below it to the pane above. None when what it sizes is gone. */
359
+ * the pane below it to the pane above, leaving each a weight above nothing however small the
360
+ * column. None when what it sizes is gone. */
350
361
  export const resizeOf = (layout, splitter, share) => __foldkitBrandViewResult((Splitter.match(splitter, {
351
362
  Width: ({ columnId }) => __foldkitBrandViewResult((Option.map(columnOf(layout, columnId), (column) => __foldkitBrandViewResult((OutMessage.ResizedColumn({
352
363
  columnId,
@@ -355,14 +366,21 @@ export const resizeOf = (layout, splitter, share) => __foldkitBrandViewResult((S
355
366
  Split: ({ abovePaneId }) => __foldkitBrandViewResult((Option.flatMap(placeOf(layout, abovePaneId), ({ column, row, pane: above }) => __foldkitBrandViewResult((Option.map(Array.get(column.panes, row + 1), (below) => {
356
367
  const total = Number.sumAll(Array.map(column.panes, ({ weight }) => __foldkitBrandViewResult((weight), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~51")));
357
368
  const pair = above.weight + below.weight;
358
- const floor = Math.min(total * SHARE_FLOOR, pair / 2);
369
+ // a column so small that a twentieth of it is no number keeps the least there is
370
+ const floor = Math.max(Math.min(total * SHARE_FLOOR, pair / 2), globalThis.Number.MIN_VALUE);
359
371
  const nextAbove = Number.clamp(above.weight + share * total, {
360
372
  minimum: floor,
361
373
  maximum: pair - floor,
362
374
  });
363
375
  return __foldkitBrandViewResult((OutMessage.ResizedPanes({
364
376
  columnId: column.id,
365
- weights: { [above.id]: rounded(nextAbove), [below.id]: rounded(pair - nextAbove) },
377
+ weights: globalThis.Number.isFinite(total)
378
+ ? {
379
+ [above.id]: roundedOver(nextAbove, floor),
380
+ [below.id]: roundedOver(pair - nextAbove, floor),
381
+ }
382
+ : // weights that total past the largest number have no share to move: they stay
383
+ { [above.id]: above.weight, [below.id]: below.weight },
366
384
  })), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~50");
367
385
  })), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~49"))), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#Split"),
368
386
  })), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#resizeOf");
@@ -245,8 +245,6 @@ export declare const update: (model: Model, message: Message) => Readonly<{
245
245
  }>;
246
246
  };
247
247
  commands?: Update.Commands<{
248
- readonly _tag: "PressedEscape";
249
- } | {
250
248
  readonly _tag: "CancelledPointer";
251
249
  } | {
252
250
  readonly _tag: "CompletedAnnounceReorder";
@@ -255,9 +253,6 @@ export declare const update: (model: Model, message: Message) => Readonly<{
255
253
  } | {
256
254
  readonly _tag: "GotDragAndDropMessage";
257
255
  readonly message: {
258
- readonly _tag: "PressedArrowKey";
259
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
260
- } | {
261
256
  readonly _tag: "ActivatedKeyboardDrag";
262
257
  readonly itemId: string;
263
258
  readonly containerId: string;
@@ -284,6 +279,9 @@ export declare const update: (model: Model, message: Message) => Readonly<{
284
279
  readonly containerId: string;
285
280
  readonly index: number;
286
281
  }>;
282
+ } | {
283
+ readonly _tag: "PressedArrowKey";
284
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
287
285
  } | {
288
286
  readonly _tag: "PressedDraggable";
289
287
  readonly itemId: string;
@@ -301,6 +299,8 @@ export declare const update: (model: Model, message: Message) => Readonly<{
301
299
  readonly clientX: number;
302
300
  readonly clientY: number;
303
301
  readonly maybeIndex: Option.Option<number>;
302
+ } | {
303
+ readonly _tag: "PressedEscape";
304
304
  } | {
305
305
  readonly _tag: "PressedGripKey";
306
306
  readonly itemId: string;
@@ -413,8 +413,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
413
413
  }>;
414
414
  }>;
415
415
  }, {
416
- readonly _tag: "PressedEscape";
417
- } | {
418
416
  readonly _tag: "CancelledPointer";
419
417
  } | {
420
418
  readonly _tag: "CompletedAnnounceReorder";
@@ -423,9 +421,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
423
421
  } | {
424
422
  readonly _tag: "GotDragAndDropMessage";
425
423
  readonly message: {
426
- readonly _tag: "PressedArrowKey";
427
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
428
- } | {
429
424
  readonly _tag: "ActivatedKeyboardDrag";
430
425
  readonly itemId: string;
431
426
  readonly containerId: string;
@@ -452,6 +447,9 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
452
447
  readonly containerId: string;
453
448
  readonly index: number;
454
449
  }>;
450
+ } | {
451
+ readonly _tag: "PressedArrowKey";
452
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
455
453
  } | {
456
454
  readonly _tag: "PressedDraggable";
457
455
  readonly itemId: string;
@@ -469,6 +467,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
469
467
  readonly clientX: number;
470
468
  readonly clientY: number;
471
469
  readonly maybeIndex: Option.Option<number>;
470
+ } | {
471
+ readonly _tag: "PressedEscape";
472
472
  } | {
473
473
  readonly _tag: "PressedGripKey";
474
474
  readonly itemId: string;
@@ -559,8 +559,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
559
559
  }>;
560
560
  }>;
561
561
  }, {
562
- readonly _tag: "PressedEscape";
563
- } | {
564
562
  readonly _tag: "CancelledPointer";
565
563
  } | {
566
564
  readonly _tag: "CompletedAnnounceReorder";
@@ -569,9 +567,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
569
567
  } | {
570
568
  readonly _tag: "GotDragAndDropMessage";
571
569
  readonly message: {
572
- readonly _tag: "PressedArrowKey";
573
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
574
- } | {
575
570
  readonly _tag: "ActivatedKeyboardDrag";
576
571
  readonly itemId: string;
577
572
  readonly containerId: string;
@@ -598,6 +593,9 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
598
593
  readonly containerId: string;
599
594
  readonly index: number;
600
595
  }>;
596
+ } | {
597
+ readonly _tag: "PressedArrowKey";
598
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
601
599
  } | {
602
600
  readonly _tag: "PressedDraggable";
603
601
  readonly itemId: string;
@@ -615,6 +613,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
615
613
  readonly clientX: number;
616
614
  readonly clientY: number;
617
615
  readonly maybeIndex: Option.Option<number>;
616
+ } | {
617
+ readonly _tag: "PressedEscape";
618
618
  } | {
619
619
  readonly _tag: "PressedGripKey";
620
620
  readonly itemId: string;
@@ -710,8 +710,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
710
710
  }>;
711
711
  }>;
712
712
  }, {
713
- readonly _tag: "PressedEscape";
714
- } | {
715
713
  readonly _tag: "CancelledPointer";
716
714
  } | {
717
715
  readonly _tag: "CompletedAnnounceReorder";
@@ -720,9 +718,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
720
718
  } | {
721
719
  readonly _tag: "GotDragAndDropMessage";
722
720
  readonly message: {
723
- readonly _tag: "PressedArrowKey";
724
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
725
- } | {
726
721
  readonly _tag: "ActivatedKeyboardDrag";
727
722
  readonly itemId: string;
728
723
  readonly containerId: string;
@@ -749,6 +744,9 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
749
744
  readonly containerId: string;
750
745
  readonly index: number;
751
746
  }>;
747
+ } | {
748
+ readonly _tag: "PressedArrowKey";
749
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
752
750
  } | {
753
751
  readonly _tag: "PressedDraggable";
754
752
  readonly itemId: string;
@@ -766,6 +764,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
766
764
  readonly clientX: number;
767
765
  readonly clientY: number;
768
766
  readonly maybeIndex: Option.Option<number>;
767
+ } | {
768
+ readonly _tag: "PressedEscape";
769
769
  } | {
770
770
  readonly _tag: "PressedGripKey";
771
771
  readonly itemId: string;
@@ -857,8 +857,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
857
857
  }>;
858
858
  }>;
859
859
  }, {
860
- readonly _tag: "PressedEscape";
861
- } | {
862
860
  readonly _tag: "CancelledPointer";
863
861
  } | {
864
862
  readonly _tag: "CompletedAnnounceReorder";
@@ -867,9 +865,6 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
867
865
  } | {
868
866
  readonly _tag: "GotDragAndDropMessage";
869
867
  readonly message: {
870
- readonly _tag: "PressedArrowKey";
871
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
872
- } | {
873
868
  readonly _tag: "ActivatedKeyboardDrag";
874
869
  readonly itemId: string;
875
870
  readonly containerId: string;
@@ -896,6 +891,9 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
896
891
  readonly containerId: string;
897
892
  readonly index: number;
898
893
  }>;
894
+ } | {
895
+ readonly _tag: "PressedArrowKey";
896
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
899
897
  } | {
900
898
  readonly _tag: "PressedDraggable";
901
899
  readonly itemId: string;
@@ -913,6 +911,8 @@ export declare const subscriptions: <Prefix extends string>(keyPrefix: Prefix) =
913
911
  readonly clientX: number;
914
912
  readonly clientY: number;
915
913
  readonly maybeIndex: Option.Option<number>;
914
+ } | {
915
+ readonly _tag: "PressedEscape";
916
916
  } | {
917
917
  readonly _tag: "PressedGripKey";
918
918
  readonly itemId: string;
@@ -1055,8 +1055,6 @@ export declare const view: import("foldkit/submodel").View<{
1055
1055
  }>;
1056
1056
  }>;
1057
1057
  }, {
1058
- readonly _tag: "PressedEscape";
1059
- } | {
1060
1058
  readonly _tag: "CancelledPointer";
1061
1059
  } | {
1062
1060
  readonly _tag: "CompletedAnnounceReorder";
@@ -1065,9 +1063,6 @@ export declare const view: import("foldkit/submodel").View<{
1065
1063
  } | {
1066
1064
  readonly _tag: "GotDragAndDropMessage";
1067
1065
  readonly message: {
1068
- readonly _tag: "PressedArrowKey";
1069
- readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
1070
- } | {
1071
1066
  readonly _tag: "ActivatedKeyboardDrag";
1072
1067
  readonly itemId: string;
1073
1068
  readonly containerId: string;
@@ -1094,6 +1089,9 @@ export declare const view: import("foldkit/submodel").View<{
1094
1089
  readonly containerId: string;
1095
1090
  readonly index: number;
1096
1091
  }>;
1092
+ } | {
1093
+ readonly _tag: "PressedArrowKey";
1094
+ readonly direction: "Down" | "Left" | "NextContainer" | "PreviousContainer" | "Right" | "Up";
1097
1095
  } | {
1098
1096
  readonly _tag: "PressedDraggable";
1099
1097
  readonly itemId: string;
@@ -1111,6 +1109,8 @@ export declare const view: import("foldkit/submodel").View<{
1111
1109
  readonly clientX: number;
1112
1110
  readonly clientY: number;
1113
1111
  readonly maybeIndex: Option.Option<number>;
1112
+ } | {
1113
+ readonly _tag: "PressedEscape";
1114
1114
  } | {
1115
1115
  readonly _tag: "PressedGripKey";
1116
1116
  readonly itemId: string;
@@ -326,6 +326,8 @@ export declare const update: (model: Model, message: Message) => Readonly<{
326
326
  readonly pendingDismissVersion: number;
327
327
  readonly isHovered: boolean;
328
328
  readonly swipeState: {
329
+ readonly _tag: "Idle";
330
+ } | {
329
331
  readonly _tag: "Dismissing";
330
332
  readonly offsetX: number;
331
333
  readonly direction: "Left" | "Right";
@@ -334,8 +336,6 @@ export declare const update: (model: Model, message: Message) => Readonly<{
334
336
  readonly pointerId: number;
335
337
  readonly startX: number;
336
338
  readonly currentX: number;
337
- } | {
338
- readonly _tag: "Idle";
339
339
  } | {
340
340
  readonly _tag: "Settling";
341
341
  readonly offsetX: number;
@@ -371,15 +371,15 @@ export declare const update: (model: Model, message: Message) => Readonly<{
371
371
  readonly _tag: "GotAnimationMessage";
372
372
  readonly entryId: string;
373
373
  readonly message: {
374
+ readonly _tag: "Hid";
375
+ } | {
376
+ readonly _tag: "Showed";
377
+ } | {
374
378
  readonly _tag: "CompletedWaitForPaint";
375
379
  readonly generation: number;
376
380
  } | {
377
381
  readonly _tag: "EndedAnimation";
378
382
  readonly generation: number;
379
- } | {
380
- readonly _tag: "Hid";
381
- } | {
382
- readonly _tag: "Showed";
383
383
  };
384
384
  } | {
385
385
  readonly _tag: "HoveredEntry";
@@ -557,6 +557,8 @@ export declare const view: import("foldkit/submodel").View<{
557
557
  readonly pendingDismissVersion: number;
558
558
  readonly isHovered: boolean;
559
559
  readonly swipeState: {
560
+ readonly _tag: "Idle";
561
+ } | {
560
562
  readonly _tag: "Dismissing";
561
563
  readonly offsetX: number;
562
564
  readonly direction: "Left" | "Right";
@@ -565,8 +567,6 @@ export declare const view: import("foldkit/submodel").View<{
565
567
  readonly pointerId: number;
566
568
  readonly startX: number;
567
569
  readonly currentX: number;
568
- } | {
569
- readonly _tag: "Idle";
570
570
  } | {
571
571
  readonly _tag: "Settling";
572
572
  readonly offsetX: number;
@@ -602,15 +602,15 @@ export declare const view: import("foldkit/submodel").View<{
602
602
  readonly _tag: "GotAnimationMessage";
603
603
  readonly entryId: string;
604
604
  readonly message: {
605
+ readonly _tag: "Hid";
606
+ } | {
607
+ readonly _tag: "Showed";
608
+ } | {
605
609
  readonly _tag: "CompletedWaitForPaint";
606
610
  readonly generation: number;
607
611
  } | {
608
612
  readonly _tag: "EndedAnimation";
609
613
  readonly generation: number;
610
- } | {
611
- readonly _tag: "Hid";
612
- } | {
613
- readonly _tag: "Showed";
614
614
  };
615
615
  } | {
616
616
  readonly _tag: "HoveredEntry";
@@ -12,7 +12,9 @@ export type ViewConfig<Message> = Readonly<{
12
12
  glyph?: GlyphName;
13
13
  /** A chip in the title bar: its state. */
14
14
  status?: ReadonlyArray<Html | string>;
15
- /** IconButtons in the title bar, before the close. */
15
+ /** IconButtons in the title bar, before the close. A child Submodel, whose view is one
16
+ * `Html`, hands back several in a `span.window-tools`: it is no box of its own
17
+ * (`display: contents`), so its buttons sit in the bar as the others do. */
16
18
  tools?: ReadonlyArray<Html>;
17
19
  /** The close glyph's Message; the glyph prints when it is given. */
18
20
  onClose?: Message;
@@ -1 +1 @@
1
- {"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../src/window/window.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAOpD,wDAAwD;AACxD,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,oFAAoF;IACpF,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,IAAI,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3B,+DAA+D;IAC/D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IACtC,sDAAsD;IACtD,KAAK,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;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;IAC9D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAEH;;6DAE6D;AAC7D,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAsCpF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjermundgaraba-designs/pixel-paper",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",