@sdxc/ui 2026.11.10 → 2026.11.14

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 (196) hide show
  1. package/README.md +92 -45
  2. package/dist/app/app-shell-toggle.d.ts +2 -0
  3. package/dist/app/app-shell-toggle.js +5 -2
  4. package/dist/app/app-shell.d.ts +25 -1
  5. package/dist/app/app-shell.js +73 -38
  6. package/dist/app/auto-refresh.d.ts +2 -0
  7. package/dist/app/auto-refresh.js +3 -3
  8. package/dist/app/behaviors/refresh-schedule.d.ts +8 -3
  9. package/dist/app/behaviors/refresh-schedule.js +4 -3
  10. package/dist/app/board.d.ts +123 -0
  11. package/dist/app/board.js +224 -0
  12. package/dist/app/chart.d.ts +2 -2
  13. package/dist/app/chart.js +7 -3
  14. package/dist/app/check-runs.d.ts +116 -0
  15. package/dist/app/check-runs.js +201 -0
  16. package/dist/app/code-view.d.ts +172 -0
  17. package/dist/app/code-view.js +414 -0
  18. package/dist/app/command-palette.d.ts +38 -3
  19. package/dist/app/command-palette.js +53 -5
  20. package/dist/app/contribution-graph.d.ts +106 -0
  21. package/dist/app/contribution-graph.js +289 -0
  22. package/dist/app/detail-sheet.d.ts +7 -0
  23. package/dist/app/detail-sheet.js +7 -7
  24. package/dist/app/diff.d.ts +200 -0
  25. package/dist/app/diff.js +702 -0
  26. package/dist/app/filter-bar.d.ts +20 -0
  27. package/dist/app/filter-bar.js +35 -15
  28. package/dist/app/filter-menu.d.ts +144 -0
  29. package/dist/app/filter-menu.js +480 -0
  30. package/dist/app/gantt.d.ts +108 -0
  31. package/dist/app/gantt.js +420 -0
  32. package/dist/app/index.d.ts +19 -0
  33. package/dist/app/index.js +19 -0
  34. package/dist/app/log-viewer.d.ts +120 -0
  35. package/dist/app/log-viewer.js +384 -0
  36. package/dist/app/merge-box.d.ts +97 -0
  37. package/dist/app/merge-box.js +227 -0
  38. package/dist/app/mixins/app-shell-controls.d.ts +4 -1
  39. package/dist/app/mixins/app-shell-controls.js +64 -4
  40. package/dist/app/mixins/auto-refresh.d.ts +5 -2
  41. package/dist/app/mixins/auto-refresh.js +9 -3
  42. package/dist/app/mixins/close-popover-on-submit.d.ts +16 -0
  43. package/dist/app/mixins/close-popover-on-submit.js +32 -0
  44. package/dist/app/mixins/code-view-selection.d.ts +60 -0
  45. package/dist/app/mixins/code-view-selection.js +276 -0
  46. package/dist/app/mixins/command-palette.d.ts +15 -4
  47. package/dist/app/mixins/command-palette.js +94 -6
  48. package/dist/app/mixins/contribution-graph-keys.d.ts +19 -0
  49. package/dist/app/mixins/contribution-graph-keys.js +155 -0
  50. package/dist/app/mixins/diff-interactions.d.ts +72 -0
  51. package/dist/app/mixins/diff-interactions.js +269 -0
  52. package/dist/app/mixins/filter-menu-keys.d.ts +41 -0
  53. package/dist/app/mixins/filter-menu-keys.js +91 -0
  54. package/dist/app/mixins/gantt-today.d.ts +17 -0
  55. package/dist/app/mixins/gantt-today.js +50 -0
  56. package/dist/app/mixins/log-viewer.d.ts +29 -0
  57. package/dist/app/mixins/log-viewer.js +333 -0
  58. package/dist/app/mixins/optimistic-toggle-sync.d.ts +5 -0
  59. package/dist/app/mixins/optimistic-toggle-sync.js +25 -1
  60. package/dist/app/mixins/save-bar-sync.d.ts +7 -1
  61. package/dist/app/mixins/save-bar-sync.js +23 -4
  62. package/dist/app/mixins/save-status-sync.js +23 -1
  63. package/dist/app/mixins/split-view.js +1 -1
  64. package/dist/app/mixins/submit-on-close.d.ts +17 -0
  65. package/dist/app/mixins/submit-on-close.js +52 -0
  66. package/dist/app/mixins/tree-filter.d.ts +44 -0
  67. package/dist/app/mixins/tree-filter.js +111 -0
  68. package/dist/app/mixins/tree-navigation.d.ts +50 -0
  69. package/dist/app/mixins/tree-navigation.js +216 -0
  70. package/dist/app/optimistic-toggle.d.ts +8 -0
  71. package/dist/app/optimistic-toggle.js +3 -2
  72. package/dist/app/page-header.d.ts +18 -3
  73. package/dist/app/page-header.js +105 -50
  74. package/dist/app/review-thread.d.ts +115 -0
  75. package/dist/app/review-thread.js +116 -0
  76. package/dist/app/save-bar.d.ts +5 -0
  77. package/dist/app/save-bar.js +1 -1
  78. package/dist/app/settings-layout.d.ts +5 -0
  79. package/dist/app/settings-layout.js +5 -5
  80. package/dist/app/skeleton.d.ts +9 -0
  81. package/dist/app/skeleton.js +28 -0
  82. package/dist/app/split-view.d.ts +4 -0
  83. package/dist/app/split-view.js +3 -3
  84. package/dist/app/styles/code-tokens.d.ts +24 -0
  85. package/dist/app/styles/code-tokens.js +47 -0
  86. package/dist/app/tab-bar.d.ts +59 -0
  87. package/dist/app/tab-bar.js +111 -0
  88. package/dist/app/tree.d.ts +111 -14
  89. package/dist/app/tree.js +202 -15
  90. package/dist/app/utils/ansi.d.ts +55 -0
  91. package/dist/app/utils/ansi.js +157 -0
  92. package/dist/app/utils/diff-rows.d.ts +82 -0
  93. package/dist/app/utils/diff-rows.js +209 -0
  94. package/dist/app/utils/fuzzy-path.d.ts +58 -0
  95. package/dist/app/utils/fuzzy-path.js +202 -0
  96. package/dist/app/utils/line-range.d.ts +48 -0
  97. package/dist/app/utils/line-range.js +61 -0
  98. package/dist/app/utils/log-lines.d.ts +107 -0
  99. package/dist/app/utils/log-lines.js +170 -0
  100. package/dist/app/utils/tree-filter.d.ts +19 -0
  101. package/dist/app/utils/tree-filter.js +26 -0
  102. package/dist/app/view-options.d.ts +2 -0
  103. package/dist/app/view-options.js +2 -2
  104. package/dist/chat/activity.d.ts +72 -0
  105. package/dist/chat/activity.js +184 -0
  106. package/dist/chat/composer-submit.d.ts +38 -0
  107. package/dist/chat/composer-submit.js +44 -0
  108. package/dist/chat/composer.d.ts +47 -0
  109. package/dist/chat/composer.js +100 -0
  110. package/dist/chat/index.d.ts +6 -0
  111. package/dist/chat/index.js +6 -0
  112. package/dist/chat/mixins/composer-send.d.ts +32 -0
  113. package/dist/chat/mixins/composer-send.js +121 -0
  114. package/dist/chat/mixins/reveal-stream.d.ts +68 -0
  115. package/dist/chat/mixins/reveal-stream.js +184 -0
  116. package/dist/chat/mixins/stream-target.d.ts +18 -0
  117. package/dist/chat/mixins/stream-target.js +38 -0
  118. package/dist/components/button.js +7 -1
  119. package/dist/components/character-count.d.ts +44 -0
  120. package/dist/components/character-count.js +68 -0
  121. package/dist/components/index.d.ts +2 -0
  122. package/dist/components/index.js +2 -0
  123. package/dist/components/label-chip.d.ts +42 -0
  124. package/dist/components/label-chip.js +86 -0
  125. package/dist/components/property-list.d.ts +9 -2
  126. package/dist/components/property-list.js +11 -6
  127. package/dist/components/textarea.js +6 -1
  128. package/dist/components/timeline.d.ts +62 -5
  129. package/dist/components/timeline.js +124 -5
  130. package/dist/docs/code-block.js +8 -31
  131. package/dist/docs/file-tree.js +3 -48
  132. package/dist/landing/case-study.d.ts +79 -0
  133. package/dist/landing/case-study.js +162 -0
  134. package/dist/landing/contributor-wall.d.ts +72 -0
  135. package/dist/landing/contributor-wall.js +129 -0
  136. package/dist/landing/countdown.d.ts +88 -0
  137. package/dist/landing/countdown.js +91 -0
  138. package/dist/landing/episode-player.d.ts +87 -0
  139. package/dist/landing/episode-player.js +113 -0
  140. package/dist/landing/faq-band.d.ts +3 -2
  141. package/dist/landing/faq-band.js +4 -3
  142. package/dist/landing/feature-band.d.ts +8 -0
  143. package/dist/landing/feature-band.js +9 -3
  144. package/dist/landing/index.d.ts +9 -0
  145. package/dist/landing/index.js +9 -0
  146. package/dist/landing/landing-header.js +15 -4
  147. package/dist/landing/mixins/countdown-tick.d.ts +29 -0
  148. package/dist/landing/mixins/countdown-tick.js +65 -0
  149. package/dist/landing/mixins/usage-estimate-live.d.ts +32 -0
  150. package/dist/landing/mixins/usage-estimate-live.js +120 -0
  151. package/dist/landing/phone-fan.d.ts +38 -0
  152. package/dist/landing/phone-fan.js +89 -0
  153. package/dist/landing/phone-frame.d.ts +48 -0
  154. package/dist/landing/phone-frame.js +41 -0
  155. package/dist/landing/price-list.d.ts +68 -0
  156. package/dist/landing/price-list.js +125 -0
  157. package/dist/landing/scroll-scene.d.ts +59 -0
  158. package/dist/landing/scroll-scene.js +70 -0
  159. package/dist/landing/sponsor-wall.d.ts +30 -6
  160. package/dist/landing/sponsor-wall.js +70 -14
  161. package/dist/landing/typed-terminal.d.ts +24 -6
  162. package/dist/landing/typed-terminal.js +22 -14
  163. package/dist/landing/usage-estimate.d.ts +127 -0
  164. package/dist/landing/usage-estimate.js +164 -0
  165. package/dist/landing/utils/countdown.d.ts +33 -0
  166. package/dist/landing/utils/countdown.js +42 -0
  167. package/dist/landing/utils/pause-toggle.d.ts +2 -1
  168. package/dist/mixins/character-count.d.ts +62 -0
  169. package/dist/mixins/character-count.js +139 -0
  170. package/dist/mixins/index.d.ts +6 -2
  171. package/dist/mixins/index.js +6 -2
  172. package/dist/mixins/invoker-fields.d.ts +18 -0
  173. package/dist/mixins/invoker-fields.js +60 -0
  174. package/dist/mixins/media-sync.d.ts +58 -0
  175. package/dist/mixins/media-sync.js +102 -0
  176. package/dist/mixins/menu-keys.d.ts +11 -0
  177. package/dist/mixins/menu-keys.js +79 -70
  178. package/dist/mixins/sortable.d.ts +96 -0
  179. package/dist/mixins/sortable.js +433 -0
  180. package/dist/utils/code-lines.d.ts +26 -0
  181. package/dist/utils/code-lines.js +29 -0
  182. package/dist/utils/file-icon.d.ts +31 -0
  183. package/dist/utils/file-icon.js +60 -0
  184. package/dist/utils/index.d.ts +2 -0
  185. package/dist/utils/index.js +2 -0
  186. package/dist/utils/write-cookie.d.ts +15 -15
  187. package/dist/utils/write-cookie.js +10 -16
  188. package/dist/video/index.d.ts +11 -0
  189. package/dist/video/index.js +11 -0
  190. package/dist/video/mixins/video-player-sync.d.ts +27 -0
  191. package/dist/video/mixins/video-player-sync.js +413 -0
  192. package/dist/video/utils/timeline.d.ts +55 -0
  193. package/dist/video/utils/timeline.js +90 -0
  194. package/dist/video/video-player.d.ts +261 -0
  195. package/dist/video/video-player.js +927 -0
  196. package/package.json +6 -3
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Review gestures for a page of diffs, from listeners on the page's diff root rather than
3
+ * one per line: a `+` press or a drag across line numbers names the lines a comment covers,
4
+ * a file's copy button writes its path, and the arrow keys walk a table's line links from its
5
+ * one Tab stop. Why JS: ranges, roving focus and the clipboard need script.
6
+ * No-JS baseline: each `+` is a Tab stop linking to the comment form; numbers link to lines.
7
+ *
8
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
9
+ * @copyright Sergio Xalambrí 2026
10
+ */
11
+ import type { ElementProps, MixinFactory } from "remix/component";
12
+ import type { DiffSide } from "../utils/diff-rows.js";
13
+ /** Selector for the element a page's diffs share as their root. */
14
+ export declare const DIFF_SELECTOR = "[data-slot=\"diff\"]";
15
+ /** Selector for one file's card, which carries the file's path. */
16
+ export declare const DIFF_FILE_SELECTOR = "[data-slot=\"diff-file\"]";
17
+ /**
18
+ * Event a file's card dispatches, bubbling, when a reader asks to comment on lines, as a
19
+ * {@link DiffCommentEvent}. The app opens its comment form from it.
20
+ */
21
+ export declare const DIFF_COMMENT_EVENT: "ui:diff-comment";
22
+ declare global {
23
+ interface HTMLElementEventMap {
24
+ [DIFF_COMMENT_EVENT]: DiffCommentEvent;
25
+ }
26
+ }
27
+ /** Attribute the root carries while this mixin runs, which shows the controls only it answers. */
28
+ export declare const DIFF_LIVE_ATTRIBUTE = "data-diff-live";
29
+ /** Attribute a row carries while a drag covers it. */
30
+ export declare const DIFF_SELECTED_ATTRIBUTE = "data-selected";
31
+ /**
32
+ * Types for {@link diffInteractions}.
33
+ */
34
+ export declare namespace DiffInteractions {
35
+ /** What a {@link DiffCommentEvent} names: the file, the side and the lines, counted from 1. */
36
+ interface CommentDetail {
37
+ path: string;
38
+ side: DiffSide;
39
+ start: number;
40
+ end: number;
41
+ }
42
+ /** Options for {@link diffInteractions}. */
43
+ interface Options {
44
+ /** Announced once a path is on the clipboard, such as "Copied". */
45
+ copied: string;
46
+ }
47
+ }
48
+ /**
49
+ * Dispatched on a file's card when a reader presses a line's `+` or drags across numbers,
50
+ * naming the lines the comment covers, in ascending order.
51
+ */
52
+ export declare class DiffCommentEvent extends Event implements DiffInteractions.CommentDetail {
53
+ readonly path: string;
54
+ readonly side: DiffSide;
55
+ readonly start: number;
56
+ readonly end: number;
57
+ /**
58
+ * @param detail The file's path, the side and the first and last line.
59
+ */
60
+ constructor(detail: DiffInteractions.CommentDetail);
61
+ }
62
+ /**
63
+ * Owns a page's diff gestures from inside its one island: a press on a `+` asks to comment
64
+ * on its line, a drag from a number or a `+` across others on the same side asks for the
65
+ * range (the rows paint while it moves), and `[data-action="copy-path"]` copies `data-path`.
66
+ *
67
+ * @param options The copy announced after a copy.
68
+ * @example <span role="status" mix={[diffInteractions({ copied: t("copied") })]} />
69
+ */
70
+ export declare const diffInteractions: MixinFactory<HTMLElement, [
71
+ options: DiffInteractions.Options
72
+ ], ElementProps>;
@@ -0,0 +1,269 @@
1
+ /**
2
+ * Review gestures for a page of diffs, from listeners on the page's diff root rather than
3
+ * one per line: a `+` press or a drag across line numbers names the lines a comment covers,
4
+ * a file's copy button writes its path, and the arrow keys walk a table's line links from its
5
+ * one Tab stop. Why JS: ranges, roving focus and the clipboard need script.
6
+ * No-JS baseline: each `+` is a Tab stop linking to the comment form; numbers link to lines.
7
+ *
8
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
9
+ * @copyright Sergio Xalambrí 2026
10
+ */
11
+ import { createElement, createMixin } from "remix/component";
12
+ /** Selector for the element a page's diffs share as their root. */
13
+ export const DIFF_SELECTOR = '[data-slot="diff"]';
14
+ /** Selector for one file's card, which carries the file's path. */
15
+ export const DIFF_FILE_SELECTOR = '[data-slot="diff-file"]';
16
+ /**
17
+ * Event a file's card dispatches, bubbling, when a reader asks to comment on lines, as a
18
+ * {@link DiffCommentEvent}. The app opens its comment form from it.
19
+ */
20
+ export const DIFF_COMMENT_EVENT = "ui:diff-comment";
21
+ /** Attribute the root carries while this mixin runs, which shows the controls only it answers. */
22
+ export const DIFF_LIVE_ATTRIBUTE = "data-diff-live";
23
+ /** Attribute a row carries while a drag covers it. */
24
+ export const DIFF_SELECTED_ATTRIBUTE = "data-selected";
25
+ /** Selector for anything a comment gesture starts or lands on: a number or a `+` link. */
26
+ const LINE_SELECTOR = "a[data-line-number], a[data-comment]";
27
+ /**
28
+ * Takes the comment links the server left in the Tab order out of it, so each table is one
29
+ * Tab stop the arrow keys walk; a table with no line number keeps its first comment link as
30
+ * that stop. Runs again whenever rows arrive, such as a file loaded later.
31
+ */
32
+ function rove(root) {
33
+ let fresh = root.querySelectorAll("a[data-comment]:not([tabindex])");
34
+ if (fresh.length === 0)
35
+ return;
36
+ for (let link of fresh)
37
+ link.tabIndex = -1;
38
+ for (let table of root.querySelectorAll("table")) {
39
+ if (table.querySelector('a[tabindex="0"]') !== null)
40
+ continue;
41
+ let first = table.querySelector("a[data-comment]");
42
+ if (first !== null)
43
+ first.tabIndex = 0;
44
+ }
45
+ }
46
+ /**
47
+ * Closes a file the moment it is marked viewed and opens it when the mark is lifted. A redraw
48
+ * keeps each `<details>` as the reader left it, so the mark's change carries the fold.
49
+ */
50
+ function fold(changes) {
51
+ for (let change of changes) {
52
+ let card = change.target;
53
+ if (!(card instanceof HTMLElement) || !card.matches(DIFF_FILE_SELECTOR))
54
+ continue;
55
+ let details = card.querySelector(':scope > [data-slot="diff-file-details"]');
56
+ if (details !== null)
57
+ details.open = !card.hasAttribute("data-viewed");
58
+ }
59
+ }
60
+ /**
61
+ * The line link a key moves focus to from `link`: up or down its own column (the same side's
62
+ * numbers, or its comment links), to the first or last of that column, or across its row.
63
+ */
64
+ function lineStep(link, key) {
65
+ if (!link.matches(LINE_SELECTOR))
66
+ return undefined;
67
+ let row = link.closest("tr");
68
+ let table = link.closest("table");
69
+ if (row === null || table === null)
70
+ return undefined;
71
+ if (key === "ArrowLeft" || key === "ArrowRight") {
72
+ let across = [...row.querySelectorAll(LINE_SELECTOR)];
73
+ return across[across.indexOf(link) + (key === "ArrowLeft" ? -1 : 1)];
74
+ }
75
+ let column = link.closest("td")?.cellIndex;
76
+ let kind = link.hasAttribute("data-comment") ? "a[data-comment]" : "a[data-line-number]";
77
+ let same = [...table.querySelectorAll(kind)].filter((other) => other.closest("td")?.cellIndex === column);
78
+ let at = same.indexOf(link);
79
+ if (key === "ArrowUp")
80
+ return same[at - 1];
81
+ if (key === "ArrowDown")
82
+ return same[at + 1];
83
+ if (key === "Home")
84
+ return same[0];
85
+ if (key === "End")
86
+ return same[same.length - 1];
87
+ return undefined;
88
+ }
89
+ /** How long a copy button reads as copied. */
90
+ const COPIED_MS = 2000;
91
+ /**
92
+ * Dispatched on a file's card when a reader presses a line's `+` or drags across numbers,
93
+ * naming the lines the comment covers, in ascending order.
94
+ */
95
+ export class DiffCommentEvent extends Event {
96
+ path;
97
+ side;
98
+ start;
99
+ end;
100
+ /**
101
+ * @param detail The file's path, the side and the first and last line.
102
+ */
103
+ constructor(detail) {
104
+ super(DIFF_COMMENT_EVENT, { bubbles: true });
105
+ this.path = detail.path;
106
+ this.side = detail.side;
107
+ this.start = detail.start;
108
+ this.end = detail.end;
109
+ }
110
+ }
111
+ /**
112
+ * Reads the line an element names: a `+` link carries `data-comment="R12"`, and a number's
113
+ * `id` ends in its side and number.
114
+ */
115
+ function pointOf(element) {
116
+ let link = element?.closest(LINE_SELECTOR);
117
+ let file = link?.closest(DIFF_FILE_SELECTOR);
118
+ if (!link || !file)
119
+ return undefined;
120
+ let key = link.getAttribute("data-comment") ?? link.id;
121
+ let match = /([LR])(\d+)$/.exec(key);
122
+ if (match === null)
123
+ return undefined;
124
+ return { file, side: match[1], line: Number(match[2]) };
125
+ }
126
+ /** Marks the rows of `side` lines `start`–`end` in `file`, clearing every row marked before. */
127
+ function paint(root, range) {
128
+ clear(root);
129
+ let fileId = range.file.id;
130
+ let from = Math.min(range.line, range.end);
131
+ let to = Math.max(range.line, range.end);
132
+ for (let line = from; line <= to; line += 1) {
133
+ let number = range.file.ownerDocument.getElementById(`${fileId}${range.side}${line}`);
134
+ number?.closest("tr")?.setAttribute(DIFF_SELECTED_ATTRIBUTE, "");
135
+ }
136
+ }
137
+ /** Clears every row a drag marked. */
138
+ function clear(root) {
139
+ for (let row of root.querySelectorAll(`tr[${DIFF_SELECTED_ATTRIBUTE}]`)) {
140
+ row.removeAttribute(DIFF_SELECTED_ATTRIBUTE);
141
+ }
142
+ }
143
+ /** Sends the comment request from `file`, lines in ascending order. */
144
+ function request(point, end) {
145
+ point.file.dispatchEvent(new DiffCommentEvent({
146
+ path: point.file.getAttribute("data-path") ?? "",
147
+ side: point.side,
148
+ start: Math.min(point.line, end),
149
+ end: Math.max(point.line, end),
150
+ }));
151
+ }
152
+ /**
153
+ * Owns a page's diff gestures from inside its one island: a press on a `+` asks to comment
154
+ * on its line, a drag from a number or a `+` across others on the same side asks for the
155
+ * range (the rows paint while it moves), and `[data-action="copy-path"]` copies `data-path`.
156
+ *
157
+ * @param options The copy announced after a copy.
158
+ * @example <span role="status" mix={[diffInteractions({ copied: t("copied") })]} />
159
+ */
160
+ export const diffInteractions = createMixin((handle) => {
161
+ let options = { copied: "" };
162
+ handle.addEventListener("insert", (event) => {
163
+ let status = event.node;
164
+ let found = status.closest(DIFF_SELECTOR);
165
+ if (found === null)
166
+ return;
167
+ let root = found;
168
+ let signal = handle.signal;
169
+ let drag;
170
+ let swallowClick = false;
171
+ let timer;
172
+ signal.addEventListener("abort", () => clearTimeout(timer));
173
+ root.setAttribute(DIFF_LIVE_ATTRIBUTE, "");
174
+ signal.addEventListener("abort", () => root.removeAttribute(DIFF_LIVE_ATTRIBUTE));
175
+ rove(root);
176
+ let added = new MutationObserver(() => rove(root));
177
+ added.observe(root, { childList: true, subtree: true });
178
+ signal.addEventListener("abort", () => added.disconnect());
179
+ let marked = new MutationObserver(fold);
180
+ marked.observe(root, { attributes: true, attributeFilter: ["data-viewed"], subtree: true });
181
+ signal.addEventListener("abort", () => marked.disconnect());
182
+ root.addEventListener("pointerdown", (down) => {
183
+ if (down.button !== 0 || !(down.target instanceof Element))
184
+ return;
185
+ let point = pointOf(down.target);
186
+ clear(root);
187
+ if (point === undefined)
188
+ return;
189
+ down.preventDefault();
190
+ drag = { ...point, end: point.line };
191
+ }, { signal });
192
+ root.addEventListener("pointermove", (move) => {
193
+ if (drag === undefined)
194
+ return;
195
+ let under = root.ownerDocument.elementFromPoint(move.clientX, move.clientY);
196
+ let point = pointOf(under) ?? pointOf(move.target instanceof Element ? move.target : null);
197
+ if (point === undefined || point.file !== drag.file || point.side !== drag.side)
198
+ return;
199
+ if (point.line === drag.end)
200
+ return;
201
+ drag.end = point.line;
202
+ paint(root, drag);
203
+ }, { signal });
204
+ window.addEventListener("pointerup", () => {
205
+ let done = drag;
206
+ drag = undefined;
207
+ if (done === undefined || done.end === done.line)
208
+ return;
209
+ swallowClick = true;
210
+ request(done, done.end);
211
+ }, { signal });
212
+ root.addEventListener("keydown", (press) => {
213
+ if (!(press.target instanceof HTMLAnchorElement))
214
+ return;
215
+ let next = lineStep(press.target, press.key);
216
+ if (next === undefined)
217
+ return;
218
+ press.preventDefault();
219
+ let table = press.target.closest("table");
220
+ table?.querySelector('a[tabindex="0"]')?.setAttribute("tabindex", "-1");
221
+ next.tabIndex = 0;
222
+ next.focus();
223
+ }, { signal });
224
+ root.addEventListener("click", (click) => {
225
+ if (!(click.target instanceof Element))
226
+ return;
227
+ if (swallowClick) {
228
+ swallowClick = false;
229
+ if (click.target.closest(LINE_SELECTOR))
230
+ click.preventDefault();
231
+ return;
232
+ }
233
+ let copy = click.target.closest('[data-action="copy-path"]');
234
+ if (copy !== null && root.contains(copy)) {
235
+ void copyPath(copy);
236
+ return;
237
+ }
238
+ let comment = click.target.closest("a[data-comment]");
239
+ let point = pointOf(comment);
240
+ if (point === undefined)
241
+ return;
242
+ click.preventDefault();
243
+ paint(root, { ...point, end: point.line });
244
+ request(point, point.line);
245
+ }, { signal });
246
+ /** Writes a file's path to the clipboard and says so for a moment. */
247
+ async function copyPath(button) {
248
+ try {
249
+ await navigator.clipboard.writeText(button.getAttribute("data-path") ?? "");
250
+ }
251
+ catch {
252
+ return;
253
+ }
254
+ if (signal.aborted)
255
+ return;
256
+ button.setAttribute("data-copied", "");
257
+ status.textContent = options.copied;
258
+ clearTimeout(timer);
259
+ timer = setTimeout(() => {
260
+ button.removeAttribute("data-copied");
261
+ status.textContent = "";
262
+ }, COPIED_MS);
263
+ }
264
+ });
265
+ return (next) => {
266
+ options = next;
267
+ return createElement(handle.element, {});
268
+ };
269
+ });
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Why JS: a filterable picker is typed into and steered from its filter field, and only script
3
+ * hears those keys. This routes typing, ↑↓, Enter, Escape, picks, tab changes and hovers to the list.
4
+ * No-JS baseline: every row is a link or a native input, and tabs switch through CSS.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { MixinFactory } from "remix/component";
10
+ /** The slot every row of the list carries, with its entry's key in `data-key`. */
11
+ export declare const FILTER_MENU_ROW_SLOT = "filter-menu-row";
12
+ /** Types for {@link filterMenuKeys}. */
13
+ export declare namespace FilterMenuKeys {
14
+ /** What the list does for each gesture; the latest handlers always answer. */
15
+ interface Handlers {
16
+ /** The filter field's id; typing and keys count only there. */
17
+ input: string;
18
+ /** The filter field's text changed. */
19
+ onFilter(value: string): void;
20
+ /** ↓ (`1`) or ↑ (`-1`) moved the highlighted row. */
21
+ onMove(step: 1 | -1): void;
22
+ /** Enter picked the highlighted row. */
23
+ onChoose(host: HTMLElement): void;
24
+ /** Escape closed the menu, whatever the field holds. */
25
+ onClose(host: HTMLElement): void;
26
+ /** A tab radio, marked `data-tab-index`, was chosen. */
27
+ onTab(index: number): void;
28
+ /** A row's radio or checkbox changed. */
29
+ onPick(input: HTMLInputElement, host: HTMLElement): void;
30
+ /** The pointer moved onto the row whose key this is. */
31
+ onHover(key: string): void;
32
+ }
33
+ }
34
+ /**
35
+ * Applied to the list's root: listens for typing and keys in the filter field, changes to the
36
+ * row and tab inputs, and pointer moves over rows, and hands each to `handlers`. Escape is
37
+ * taken from the search field, so it closes the menu instead of only clearing the text.
38
+ *
39
+ * @example <div mix={[filterMenuKeys({ input: "refs-filter", onFilter, onMove, onChoose, onClose, onTab, onPick, onHover })]}>…</div>
40
+ */
41
+ export declare const filterMenuKeys: MixinFactory<HTMLElement, [handlers: FilterMenuKeys.Handlers]>;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Why JS: a filterable picker is typed into and steered from its filter field, and only script
3
+ * hears those keys. This routes typing, ↑↓, Enter, Escape, picks, tab changes and hovers to the list.
4
+ * No-JS baseline: every row is a link or a native input, and tabs switch through CSS.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createMixin } from "remix/component";
10
+ /** The slot every row of the list carries, with its entry's key in `data-key`. */
11
+ export const FILTER_MENU_ROW_SLOT = "filter-menu-row";
12
+ /**
13
+ * Applied to the list's root: listens for typing and keys in the filter field, changes to the
14
+ * row and tab inputs, and pointer moves over rows, and hands each to `handlers`. Escape is
15
+ * taken from the search field, so it closes the menu instead of only clearing the text.
16
+ *
17
+ * @example <div mix={[filterMenuKeys({ input: "refs-filter", onFilter, onMove, onChoose, onClose, onTab, onPick, onHover })]}>…</div>
18
+ */
19
+ export const filterMenuKeys = createMixin((handle) => {
20
+ let handlers;
21
+ let controller;
22
+ handle.addEventListener("insert", (event) => {
23
+ controller?.abort();
24
+ controller = new AbortController();
25
+ listen(event.node, () => handlers, controller.signal);
26
+ });
27
+ handle.addEventListener("remove", () => {
28
+ controller?.abort();
29
+ controller = undefined;
30
+ });
31
+ return (next) => {
32
+ handlers = next;
33
+ };
34
+ });
35
+ /**
36
+ * Wires `host`'s listeners until `signal` aborts.
37
+ *
38
+ * @param host The list's root.
39
+ * @param read Reads the latest handlers.
40
+ * @param signal Ends every listener once the list leaves the document.
41
+ */
42
+ function listen(host, read, signal) {
43
+ /** The filter field the event came from, or `undefined` for any other target. */
44
+ function field(event) {
45
+ let handlers = read();
46
+ let target = event.target;
47
+ if (!handlers || !(target instanceof HTMLInputElement))
48
+ return undefined;
49
+ return target.id === handlers.input ? target : undefined;
50
+ }
51
+ host.addEventListener("input", (event) => {
52
+ let input = field(event);
53
+ if (input)
54
+ read()?.onFilter(input.value);
55
+ }, { signal });
56
+ host.addEventListener("keydown", (event) => {
57
+ let handlers = read();
58
+ if (!handlers || !field(event))
59
+ return;
60
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
61
+ event.preventDefault();
62
+ handlers.onMove(event.key === "ArrowDown" ? 1 : -1);
63
+ }
64
+ else if (event.key === "Enter") {
65
+ event.preventDefault();
66
+ handlers.onChoose(host);
67
+ }
68
+ else if (event.key === "Escape") {
69
+ event.preventDefault();
70
+ handlers.onClose(host);
71
+ }
72
+ }, { signal });
73
+ host.addEventListener("change", (event) => {
74
+ let handlers = read();
75
+ let input = event.target;
76
+ if (!handlers || !(input instanceof HTMLInputElement))
77
+ return;
78
+ if (input.dataset.tabIndex === undefined)
79
+ handlers.onPick(input, host);
80
+ else
81
+ handlers.onTab(Number(input.dataset.tabIndex));
82
+ }, { signal });
83
+ host.addEventListener("pointermove", (event) => {
84
+ if (!(event.target instanceof Element))
85
+ return;
86
+ let row = event.target.closest(`[data-slot="${FILTER_MENU_ROW_SLOT}"]`);
87
+ let key = row?.dataset.key;
88
+ if (key)
89
+ read()?.onHover(key);
90
+ }, { signal });
91
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Why JS: a scroll box starts at its first day, and only script can scroll it to where the
3
+ * reader is in time. No-JS baseline: the chart opens at its first day, and today's line is
4
+ * one sideways scroll away.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { MixinFactory } from "remix/component";
10
+ /**
11
+ * Applied to a marker inside a `Gantt`: once the chart is laid out, scrolls it sideways so
12
+ * today's line sits a third of the way across the axis's visible width. A Gantt chart the reader
13
+ * already scrolled, or one wide enough to show today, is left where it is.
14
+ *
15
+ * @example <span hidden mix={[ganttToday()]} />
16
+ */
17
+ export declare const ganttToday: MixinFactory<HTMLElement>;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Why JS: a scroll box starts at its first day, and only script can scroll it to where the
3
+ * reader is in time. No-JS baseline: the chart opens at its first day, and today's line is
4
+ * one sideways scroll away.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createMixin } from "remix/component";
10
+ /** How far into the axis's visible width today's line lands: a third, so the past stays in view. */
11
+ const TODAY_SHARE = 1 / 3;
12
+ /**
13
+ * Applied to a marker inside a `Gantt`: once the chart is laid out, scrolls it sideways so
14
+ * today's line sits a third of the way across the axis's visible width. A Gantt chart the reader
15
+ * already scrolled, or one wide enough to show today, is left where it is.
16
+ *
17
+ * @example <span hidden mix={[ganttToday()]} />
18
+ */
19
+ export const ganttToday = createMixin((handle) => {
20
+ let frame;
21
+ /** Waits two frames, so the chart has its final width, then scrolls it. */
22
+ function attach(event) {
23
+ let marker = event.node;
24
+ frame = requestAnimationFrame(next);
25
+ /** Schedules the scroll for the frame after the first layout. */
26
+ function next() {
27
+ frame = requestAnimationFrame(scroll);
28
+ }
29
+ /** Puts today's line a third of the way across the visible axis. */
30
+ function scroll() {
31
+ let gantt = marker.closest('[data-slot="gantt"]');
32
+ let line = gantt?.querySelector('[data-slot="gantt-today"]');
33
+ let list = gantt?.querySelector('[data-slot="gantt-corner"]');
34
+ if (!gantt || !line || !list || gantt.scrollLeft !== 0)
35
+ return;
36
+ let axis = gantt.clientWidth - list.offsetWidth;
37
+ let today = line.getBoundingClientRect().left - gantt.getBoundingClientRect().left;
38
+ if (today >= list.offsetWidth && today <= gantt.clientWidth - axis * TODAY_SHARE)
39
+ return;
40
+ gantt.scrollLeft = Math.max(0, today - list.offsetWidth - axis * TODAY_SHARE);
41
+ }
42
+ }
43
+ /** Drops a scroll that has not run yet. */
44
+ function detach() {
45
+ if (frame !== undefined)
46
+ cancelAnimationFrame(frame);
47
+ }
48
+ handle.addEventListener("insert", attach);
49
+ handle.addEventListener("remove", detach);
50
+ });
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The browser half of the log viewer: opens a failed job on its first error, searches every
3
+ * line (painting matches through the CSS Custom Highlight API, stepping with Enter and ⇧Enter),
4
+ * and streams a live step's lines in while the log follows its tail.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { MixinFactory } from "remix/component";
10
+ /**
11
+ * Types for {@link logViewerController}.
12
+ */
13
+ export declare namespace LogViewerBehavior {
14
+ /** Plain data only, since the options cross into the browser with the viewer's island. */
15
+ type Options = {
16
+ /** The counter, with `{index}` and `{count}` replaced. */
17
+ matches: string;
18
+ /** Shown in place of the counter when nothing matches. */
19
+ noMatches: string;
20
+ };
21
+ }
22
+ /**
23
+ * Wires the `LogViewer` the host sits in: search over every line, each live step's stream, and
24
+ * following the tail; it all detaches when the host unmounts.
25
+ *
26
+ * @param options The counter's copy.
27
+ * @example <div hidden mix={[logViewerController({ matches: "{index} of {count}", noMatches: "No results" })]} />
28
+ */
29
+ export declare const logViewerController: MixinFactory<HTMLElement, [options: LogViewerBehavior.Options]>;