@skillcdn/console 0.5.1 → 0.5.2
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.
- package/README.md +20 -2
- package/dist/agent-page.d.ts.map +1 -1
- package/dist/agent-page.js +4 -4
- package/dist/agent-page.js.map +1 -1
- package/dist/api.d.ts +5 -4
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +5 -4
- package/dist/api.js.map +1 -1
- package/dist/cli/cli.d.ts +32 -0
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +442 -93
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/format.d.ts +6 -2
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +25 -3
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +10 -5
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/machine-check.d.ts +36 -0
- package/dist/cli/machine-check.d.ts.map +1 -0
- package/dist/cli/machine-check.js +151 -0
- package/dist/cli/machine-check.js.map +1 -0
- package/dist/cli/runner-host.d.ts +7 -0
- package/dist/cli/runner-host.d.ts.map +1 -1
- package/dist/cli/runner-host.js +2 -0
- package/dist/cli/runner-host.js.map +1 -1
- package/dist/cli/secret-notes.d.ts +8 -0
- package/dist/cli/secret-notes.d.ts.map +1 -0
- package/dist/cli/secret-notes.js +48 -0
- package/dist/cli/secret-notes.js.map +1 -0
- package/dist/client.d.ts +7 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -1
- package/dist/client.js.map +1 -1
- package/dist/components/agent-page.d.ts +106 -13
- package/dist/components/agent-page.d.ts.map +1 -1
- package/dist/components/agent-page.js +391 -102
- package/dist/components/agent-page.js.map +1 -1
- package/dist/components/agents.d.ts.map +1 -1
- package/dist/components/agents.js +1 -1
- package/dist/components/agents.js.map +1 -1
- package/dist/components/board.d.ts.map +1 -1
- package/dist/components/board.js +3 -2
- package/dist/components/board.js.map +1 -1
- package/dist/components/categories.js +1 -1
- package/dist/components/categories.js.map +1 -1
- package/dist/components/decision-list.d.ts.map +1 -1
- package/dist/components/decision-list.js +1 -1
- package/dist/components/decision-list.js.map +1 -1
- package/dist/components/event-feed.d.ts.map +1 -1
- package/dist/components/event-feed.js +3 -2
- package/dist/components/event-feed.js.map +1 -1
- package/dist/components/goals.d.ts +2 -0
- package/dist/components/goals.d.ts.map +1 -1
- package/dist/components/goals.js +1 -1
- package/dist/components/goals.js.map +1 -1
- package/dist/components/home.d.ts.map +1 -1
- package/dist/components/home.js +12 -6
- package/dist/components/home.js.map +1 -1
- package/dist/components/icon.d.ts +31 -0
- package/dist/components/icon.d.ts.map +1 -0
- package/dist/components/icon.js +169 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/markdown.d.ts +6 -0
- package/dist/components/markdown.d.ts.map +1 -1
- package/dist/components/markdown.js +10 -2
- package/dist/components/markdown.js.map +1 -1
- package/dist/components/people.js +1 -1
- package/dist/components/people.js.map +1 -1
- package/dist/components/plugin-frame.d.ts.map +1 -1
- package/dist/components/plugin-frame.js +7 -0
- package/dist/components/plugin-frame.js.map +1 -1
- package/dist/components/projects.d.ts +17 -4
- package/dist/components/projects.d.ts.map +1 -1
- package/dist/components/projects.js +25 -6
- package/dist/components/projects.js.map +1 -1
- package/dist/components/sessions.d.ts.map +1 -1
- package/dist/components/sessions.js +3 -2
- package/dist/components/sessions.js.map +1 -1
- package/dist/components/setup.d.ts.map +1 -1
- package/dist/components/setup.js +2 -2
- package/dist/components/setup.js.map +1 -1
- package/dist/components/shell.d.ts.map +1 -1
- package/dist/components/shell.js +3 -2
- package/dist/components/shell.js.map +1 -1
- package/dist/components/tokens.js +1 -1
- package/dist/components/tokens.js.map +1 -1
- package/dist/components/ui.d.ts +5 -2
- package/dist/components/ui.d.ts.map +1 -1
- package/dist/components/ui.js +10 -7
- package/dist/components/ui.js.map +1 -1
- package/dist/connect-page.js +1 -1
- package/dist/connect-page.js.map +1 -1
- package/dist/console.css +473 -77
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +38 -31
- package/dist/console.js.map +1 -1
- package/dist/home-tiles.d.ts +9 -0
- package/dist/home-tiles.d.ts.map +1 -1
- package/dist/home-tiles.js +105 -23
- package/dist/home-tiles.js.map +1 -1
- package/dist/i18n/en.d.ts +48 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +125 -2
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +197 -79
- package/dist/i18n/ko.js.map +1 -1
- package/dist/i18n/particles.d.ts +7 -0
- package/dist/i18n/particles.d.ts.map +1 -0
- package/dist/i18n/particles.js +72 -0
- package/dist/i18n/particles.js.map +1 -0
- package/dist/icons/glyphs.d.ts +605 -0
- package/dist/icons/glyphs.d.ts.map +1 -0
- package/dist/icons/glyphs.js +104 -0
- package/dist/icons/glyphs.js.map +1 -0
- package/dist/icons/index.d.ts +59 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +157 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +9 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +9 -0
- package/dist/limits.js.map +1 -1
- package/dist/marks.d.ts +9 -0
- package/dist/marks.d.ts.map +1 -1
- package/dist/marks.js +9 -0
- package/dist/marks.js.map +1 -1
- package/dist/onboarding.js +3 -3
- package/dist/onboarding.js.map +1 -1
- package/dist/plugin/web.d.ts +3 -0
- package/dist/plugin/web.d.ts.map +1 -1
- package/dist/plugin/web.js +5 -1
- package/dist/plugin/web.js.map +1 -1
- package/dist/runner/acp.d.ts.map +1 -1
- package/dist/runner/acp.js +2 -2
- package/dist/runner/acp.js.map +1 -1
- package/dist/runner/awake.d.ts +35 -0
- package/dist/runner/awake.d.ts.map +1 -0
- package/dist/runner/awake.js +95 -0
- package/dist/runner/awake.js.map +1 -0
- package/dist/runner/claude.d.ts.map +1 -1
- package/dist/runner/claude.js +19 -7
- package/dist/runner/claude.js.map +1 -1
- package/dist/runner/codex.d.ts.map +1 -1
- package/dist/runner/codex.js +2 -2
- package/dist/runner/codex.js.map +1 -1
- package/dist/runner/config.d.ts +5 -0
- package/dist/runner/config.d.ts.map +1 -1
- package/dist/runner/config.js +9 -0
- package/dist/runner/config.js.map +1 -1
- package/dist/runner/desk.d.ts.map +1 -1
- package/dist/runner/desk.js +5 -6
- package/dist/runner/desk.js.map +1 -1
- package/dist/runner/runner.d.ts +13 -2
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/runner.js +141 -22
- package/dist/runner/runner.js.map +1 -1
- package/dist/runner/slack.d.ts.map +1 -1
- package/dist/runner/slack.js +10 -4
- package/dist/runner/slack.js.map +1 -1
- package/dist/runner/types.d.ts +15 -0
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/types.js +9 -0
- package/dist/runner/types.js.map +1 -1
- package/dist/schemas.d.ts +94 -1
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +81 -5
- package/dist/schemas.js.map +1 -1
- package/dist/services.d.ts.map +1 -1
- package/dist/services.js +9 -5
- package/dist/services.js.map +1 -1
- package/dist/setup-guide.d.ts +14 -3
- package/dist/setup-guide.d.ts.map +1 -1
- package/dist/setup-guide.js +41 -37
- package/dist/setup-guide.js.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +5 -1
- package/dist/tokens.js.map +1 -1
- package/dist/vocabulary.d.ts +7 -0
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +6 -0
- package/dist/vocabulary.js.map +1 -1
- package/docs/specs/cli.md +10 -7
- package/docs/specs/plugins.md +17 -6
- package/docs/specs/rest.md +10 -8
- package/docs/specs/runner.md +26 -8
- package/package.json +7 -3
- package/skills/building-a-console/SKILL.md +2 -2
- package/skills/building-a-plugin/SKILL.md +2 -2
- package/skills/keeping-a-desk/SKILL.md +2 -2
- package/skills/running-an-agent/SKILL.md +47 -57
- package/skills/working-the-board/SKILL.md +5 -4
- package/skills/working-the-board/references/the-pack.md +1 -1
- package/src/agent-page.tsx +13 -1
- package/src/api.ts +32 -1
- package/src/cli/cli.ts +530 -106
- package/src/cli/format.ts +31 -3
- package/src/cli/help.ts +12 -4
- package/src/cli/machine-check.ts +223 -0
- package/src/cli/runner-host.ts +8 -0
- package/src/cli/secret-notes.ts +63 -0
- package/src/client.ts +23 -0
- package/src/components/agent-page.tsx +629 -112
- package/src/components/agents.tsx +9 -5
- package/src/components/board.tsx +3 -15
- package/src/components/categories.tsx +2 -2
- package/src/components/decision-list.tsx +11 -7
- package/src/components/event-feed.tsx +7 -2
- package/src/components/goals.tsx +33 -25
- package/src/components/home.tsx +30 -6
- package/src/components/icon.tsx +337 -0
- package/src/components/markdown.tsx +22 -2
- package/src/components/people.tsx +1 -1
- package/src/components/plugin-frame.tsx +7 -0
- package/src/components/projects.tsx +39 -5
- package/src/components/sessions.tsx +2 -13
- package/src/components/setup.tsx +2 -2
- package/src/components/shell.tsx +3 -20
- package/src/components/tokens.tsx +1 -1
- package/src/components/ui.tsx +16 -8
- package/src/connect-page.tsx +1 -1
- package/src/console.tsx +87 -53
- package/src/home-tiles.ts +127 -23
- package/src/i18n/en.ts +127 -2
- package/src/i18n/ko.ts +200 -79
- package/src/i18n/particles.ts +79 -0
- package/src/icons/glyphs.ts +112 -0
- package/src/icons/index.ts +195 -0
- package/src/index.ts +7 -0
- package/src/limits.ts +9 -0
- package/src/marks.ts +12 -0
- package/src/onboarding.ts +3 -3
- package/src/plugin/web.ts +9 -2
- package/src/runner/acp.ts +2 -1
- package/src/runner/awake.ts +135 -0
- package/src/runner/claude.ts +19 -4
- package/src/runner/codex.ts +2 -1
- package/src/runner/config.ts +9 -0
- package/src/runner/desk.ts +5 -6
- package/src/runner/runner.ts +183 -23
- package/src/runner/slack.ts +10 -4
- package/src/runner/types.ts +20 -0
- package/src/schemas.ts +94 -3
- package/src/services.ts +9 -5
- package/src/setup-guide.ts +43 -38
- package/src/styles/README.md +5 -4
- package/src/styles/base.css +17 -0
- package/src/styles/console.css +1 -0
- package/src/styles/drawn-by-pages.json +1 -1
- package/src/styles/pages/agents.css +103 -1
- package/src/styles/pages/board.css +0 -10
- package/src/styles/pages/calendar.css +1 -1
- package/src/styles/pages/connect.css +0 -10
- package/src/styles/pages/decisions.css +3 -1
- package/src/styles/pages/feed.css +5 -2
- package/src/styles/pages/home.css +5 -0
- package/src/styles/pages/roadmap.css +2 -2
- package/src/styles/pages/settings.css +11 -0
- package/src/styles/pages/task.css +0 -20
- package/src/styles/pages/thread.css +1 -1
- package/src/styles/parts/calendar.css +1 -1
- package/src/styles/parts/callout.css +1 -0
- package/src/styles/parts/detail.css +22 -0
- package/src/styles/parts/empty.css +2 -0
- package/src/styles/parts/eyebrow.css +1 -1
- package/src/styles/parts/facts.css +1 -1
- package/src/styles/parts/figures.css +1 -1
- package/src/styles/parts/form.css +2 -1
- package/src/styles/parts/icon.css +191 -0
- package/src/styles/parts/input.css +14 -4
- package/src/styles/parts/mark.css +36 -0
- package/src/styles/parts/menu.css +1 -7
- package/src/styles/parts/page.css +1 -1
- package/src/styles/parts/panel.css +10 -0
- package/src/styles/parts/person.css +5 -2
- package/src/styles/parts/progress.css +5 -2
- package/src/styles/parts/rows.css +1 -0
- package/src/styles/parts/settings.css +5 -0
- package/src/styles/parts/stat.css +1 -1
- package/src/styles/tokens.css +22 -7
- package/src/tokens.ts +5 -1
- package/src/vocabulary.ts +9 -0
|
@@ -186,11 +186,15 @@ export function AgentAccountList(props: AgentAccountListProps) {
|
|
|
186
186
|
{state === null ? (
|
|
187
187
|
<span className="sc-muted">{invited ? accounts.invitedHint : states.none}</span>
|
|
188
188
|
) : (
|
|
189
|
-
<span>
|
|
190
|
-
{state.reason !== null &&
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
<span className="sc-agent-card-now">
|
|
190
|
+
{state.reason !== null && (
|
|
191
|
+
<span>{reasons[state.reason] ?? state.reason}</span>
|
|
192
|
+
)}
|
|
193
|
+
<span className="sc-muted">
|
|
194
|
+
{states.since.before}
|
|
195
|
+
<Time iso={state.since} precision="clock" />
|
|
196
|
+
{states.since.after}
|
|
197
|
+
</span>
|
|
194
198
|
</span>
|
|
195
199
|
)}
|
|
196
200
|
</dd>
|
package/src/components/board.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
} from "../api.js";
|
|
19
19
|
import { useWords } from "../i18n/index.js";
|
|
20
20
|
import type { BoardFilter } from "../router.js";
|
|
21
|
+
import { Icon } from "./icon.js";
|
|
21
22
|
import { Picker } from "./picker.js";
|
|
22
23
|
import { listSearch } from "./searches.js";
|
|
23
24
|
import { isPlainClick } from "./shell.js";
|
|
@@ -317,11 +318,7 @@ function CardMenu(props: {
|
|
|
317
318
|
aria-expanded={open}
|
|
318
319
|
onClick={toggle}
|
|
319
320
|
>
|
|
320
|
-
<
|
|
321
|
-
<circle cx="8" cy="3" r="1.5" fill="currentColor" />
|
|
322
|
-
<circle cx="8" cy="8" r="1.5" fill="currentColor" />
|
|
323
|
-
<circle cx="8" cy="13" r="1.5" fill="currentColor" />
|
|
324
|
-
</svg>
|
|
321
|
+
<Icon name="more-vertical" />
|
|
325
322
|
</button>
|
|
326
323
|
{place !== null &&
|
|
327
324
|
typeof document !== "undefined" &&
|
|
@@ -611,16 +608,7 @@ export function Board(props: BoardProps) {
|
|
|
611
608
|
title={folded ? words.board.unfold(name) : words.board.fold(name)}
|
|
612
609
|
onClick={() => toggle(state)}
|
|
613
610
|
>
|
|
614
|
-
<
|
|
615
|
-
<path
|
|
616
|
-
d={folded ? "M6 4l4 4-4 4" : "M10 4l-4 4 4 4"}
|
|
617
|
-
fill="none"
|
|
618
|
-
stroke="currentColor"
|
|
619
|
-
strokeWidth="1.5"
|
|
620
|
-
strokeLinecap="round"
|
|
621
|
-
strokeLinejoin="round"
|
|
622
|
-
/>
|
|
623
|
-
</svg>
|
|
611
|
+
<Icon name={folded ? "chevron-right" : "chevron-left"} size="sm" />
|
|
624
612
|
</button>
|
|
625
613
|
)}
|
|
626
614
|
</header>
|
|
@@ -85,7 +85,7 @@ function CategoryRow(props: {
|
|
|
85
85
|
</label>
|
|
86
86
|
<Button
|
|
87
87
|
type="submit"
|
|
88
|
-
variant="
|
|
88
|
+
variant="secondary"
|
|
89
89
|
size="sm"
|
|
90
90
|
disabled={props.busy === true || !changed || name.trim() === ""}
|
|
91
91
|
>
|
|
@@ -93,7 +93,7 @@ function CategoryRow(props: {
|
|
|
93
93
|
</Button>
|
|
94
94
|
{props.onRemove !== undefined && (
|
|
95
95
|
<Button
|
|
96
|
-
variant="
|
|
96
|
+
variant="ghost"
|
|
97
97
|
size="sm"
|
|
98
98
|
disabled={props.busy === true}
|
|
99
99
|
onClick={() => props.onRemove?.(category)}
|
|
@@ -200,13 +200,17 @@ function AnswerForm(props: {
|
|
|
200
200
|
/>
|
|
201
201
|
</label>
|
|
202
202
|
</div>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
203
|
+
{/* A word to add is asked for once an answer is chosen: until then a waiting decision is
|
|
204
|
+
its question and its options, and a page of them is short enough to read down. */}
|
|
205
|
+
{(chosen !== undefined || own) && (
|
|
206
|
+
<input
|
|
207
|
+
className="sc-input"
|
|
208
|
+
placeholder={words.decisions.notePlaceholder}
|
|
209
|
+
maxLength={MAX_NOTE_LENGTH}
|
|
210
|
+
value={note}
|
|
211
|
+
onChange={(event) => setNote(event.target.value)}
|
|
212
|
+
/>
|
|
213
|
+
)}
|
|
210
214
|
<div className="sc-form-actions">
|
|
211
215
|
<Button
|
|
212
216
|
type="submit"
|
|
@@ -254,7 +254,7 @@ function formatClock(iso: string, language: string): string {
|
|
|
254
254
|
const date = new Date(iso);
|
|
255
255
|
return Number.isNaN(date.getTime())
|
|
256
256
|
? iso
|
|
257
|
-
: date.toLocaleTimeString(language, { hour: "
|
|
257
|
+
: date.toLocaleTimeString(language, { hour: "numeric", minute: "2-digit" });
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
type FeedRun = { readonly actor: RestEvent; readonly events: RestEvent[] };
|
|
@@ -286,7 +286,12 @@ export function EventFeed(props: EventFeedProps) {
|
|
|
286
286
|
const newestFirst = [...props.events].reverse();
|
|
287
287
|
const { shown, rest, more } = usePaged(newestFirst);
|
|
288
288
|
if (props.events.length === 0) {
|
|
289
|
-
|
|
289
|
+
// Named as the feed with events is, so that a feed with nothing in it is still found.
|
|
290
|
+
return (
|
|
291
|
+
<section className="sc-feed" aria-label={words.feed.list}>
|
|
292
|
+
{props.empty ?? null}
|
|
293
|
+
</section>
|
|
294
|
+
);
|
|
290
295
|
}
|
|
291
296
|
return (
|
|
292
297
|
<>
|
package/src/components/goals.tsx
CHANGED
|
@@ -234,6 +234,8 @@ export interface GoalViewProps {
|
|
|
234
234
|
/** Where a document of the project is read, by its path, for the links in what was written. */
|
|
235
235
|
readonly docHref?: ((path: string) => string) | undefined;
|
|
236
236
|
readonly today?: string | undefined;
|
|
237
|
+
/** Where every goal of the project is: the way back, over the title. */
|
|
238
|
+
readonly allHref?: string | undefined;
|
|
237
239
|
/** Where the goal is changed; left out, it cannot be changed from here. */
|
|
238
240
|
readonly editHref?: string | undefined;
|
|
239
241
|
/** Called when an owner moves the goal to another state from here. */
|
|
@@ -287,14 +289,39 @@ export function GoalView(props: GoalViewProps) {
|
|
|
287
289
|
<div className="sc-goal-page">
|
|
288
290
|
<header className="sc-goal-header">
|
|
289
291
|
<div className="sc-task-header">
|
|
290
|
-
<
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
<DueBadge dueOn={goal.dueOn} state={dueState(goal)} today={props.today} />
|
|
292
|
+
<div className="sc-task-heading">
|
|
293
|
+
{props.allHref !== undefined && (
|
|
294
|
+
<p className="sc-task-parent">
|
|
295
|
+
<a href={props.allHref}>{roadmap.all}</a>
|
|
296
|
+
</p>
|
|
296
297
|
)}
|
|
298
|
+
<h1 className="sc-task-title">{goal.title}</h1>
|
|
299
|
+
<div className="sc-task-badges">
|
|
300
|
+
{goal.category !== null && <CategoryBadge category={goal.category} />}
|
|
301
|
+
<GoalStateBadge state={goal.state} />
|
|
302
|
+
{goal.dueOn !== null && (
|
|
303
|
+
<DueBadge dueOn={goal.dueOn} state={dueState(goal)} today={props.today} />
|
|
304
|
+
)}
|
|
305
|
+
</div>
|
|
297
306
|
</div>
|
|
307
|
+
{(props.editHref !== undefined || props.onArchiveTasks !== undefined) && (
|
|
308
|
+
<div className="sc-task-actions">
|
|
309
|
+
{props.editHref !== undefined && (
|
|
310
|
+
<a className="sc-button sc-button-secondary" href={props.editHref}>
|
|
311
|
+
{words.common.edit}
|
|
312
|
+
</a>
|
|
313
|
+
)}
|
|
314
|
+
{props.onArchiveTasks !== undefined && (
|
|
315
|
+
<Button
|
|
316
|
+
variant="secondary"
|
|
317
|
+
disabled={props.busy === true}
|
|
318
|
+
onClick={props.onArchiveTasks}
|
|
319
|
+
>
|
|
320
|
+
{roadmap.archiveTasks}
|
|
321
|
+
</Button>
|
|
322
|
+
)}
|
|
323
|
+
</div>
|
|
324
|
+
)}
|
|
298
325
|
</div>
|
|
299
326
|
<div className="sc-goal-progress">
|
|
300
327
|
<ProgressBar counts={goal.taskCounts} />
|
|
@@ -361,25 +388,6 @@ export function GoalView(props: GoalViewProps) {
|
|
|
361
388
|
<Time iso={goal.createdAt} />
|
|
362
389
|
</dd>
|
|
363
390
|
</div>
|
|
364
|
-
{props.editHref !== undefined && (
|
|
365
|
-
<div>
|
|
366
|
-
<a className="sc-button sc-button-secondary sc-button-sm" href={props.editHref}>
|
|
367
|
-
{words.common.edit}
|
|
368
|
-
</a>
|
|
369
|
-
</div>
|
|
370
|
-
)}
|
|
371
|
-
{props.onArchiveTasks !== undefined && (
|
|
372
|
-
<div>
|
|
373
|
-
<Button
|
|
374
|
-
variant="secondary"
|
|
375
|
-
size="sm"
|
|
376
|
-
disabled={props.busy === true}
|
|
377
|
-
onClick={props.onArchiveTasks}
|
|
378
|
-
>
|
|
379
|
-
{roadmap.archiveTasks}
|
|
380
|
-
</Button>
|
|
381
|
-
</div>
|
|
382
|
-
)}
|
|
383
391
|
</dl>
|
|
384
392
|
{goal.body.length > 0 && (
|
|
385
393
|
<details className="sc-goal-about">
|
package/src/components/home.tsx
CHANGED
|
@@ -37,8 +37,10 @@ import {
|
|
|
37
37
|
type PlacedTile,
|
|
38
38
|
resized,
|
|
39
39
|
rowsOf,
|
|
40
|
+
sameArrangement,
|
|
40
41
|
sizesAt,
|
|
41
42
|
standsComposed,
|
|
43
|
+
tidied,
|
|
42
44
|
waitToGiveWay,
|
|
43
45
|
} from "../home-tiles.js";
|
|
44
46
|
import { useWords } from "../i18n/index.js";
|
|
@@ -65,6 +67,7 @@ import { Badge, Button, Callout, cx, Day, DueBadge, ProgressBar, Workers } from
|
|
|
65
67
|
const SPARE_ROWS = 2;
|
|
66
68
|
|
|
67
69
|
const NONE: readonly string[] = [];
|
|
70
|
+
const NOT_PLACED: readonly PlacedTile[] = [];
|
|
68
71
|
|
|
69
72
|
/**
|
|
70
73
|
* What a project's tile at a glance reads of its board (ADR-0105): the one answer of
|
|
@@ -531,8 +534,12 @@ export function HomeGrid(props: HomeGridProps) {
|
|
|
531
534
|
const working = draft ?? home;
|
|
532
535
|
const hidden = working?.hidden ?? NONE;
|
|
533
536
|
// A width nobody arranged is closed up by trying the sizes the tiles come in: once a render, not
|
|
534
|
-
// once a pointer's move
|
|
535
|
-
|
|
537
|
+
// once a pointer's move, and not at all while the page stands composed and nobody arranges
|
|
538
|
+
// it, since the composed page is drawn from its own boxes and reads none of this.
|
|
539
|
+
const placed = useMemo(
|
|
540
|
+
() => (!editing && nobodyArranged(working) ? NOT_PLACED : arranged(tiles, working, columns)),
|
|
541
|
+
[editing, tiles, working, columns],
|
|
542
|
+
);
|
|
536
543
|
const [drag, setDrag] = useState<Drag | null>(null);
|
|
537
544
|
const { busy, error, act } = useAction();
|
|
538
545
|
/** The tile in hand, once it has come loose; nothing while one is merely pressed. */
|
|
@@ -751,13 +758,20 @@ export function HomeGrid(props: HomeGridProps) {
|
|
|
751
758
|
};
|
|
752
759
|
/** The page as composed again, every tile back on it: kept by Done like any change, let go by Cancel. */
|
|
753
760
|
const reset = () => setDraft(COMPOSED_HOME);
|
|
761
|
+
// The page closed up (ADR-0139), worked out while it is arranged alone: it tries the sizes the
|
|
762
|
+
// widgets come in, and the way to it is offered only where it would change something.
|
|
763
|
+
const closed = useMemo(
|
|
764
|
+
() => (editing ? tidied(placed, columns) : placed),
|
|
765
|
+
[editing, placed, columns],
|
|
766
|
+
);
|
|
767
|
+
const gaps = editing && !sameArrangement(closed, placed);
|
|
754
768
|
|
|
755
769
|
const nameOfTile = (tile: HomeTile): string =>
|
|
756
770
|
tile.kind === "project" ? tile.project.name : nameOf(tile.widget.name);
|
|
757
771
|
// Moved in the page, a frame would load again: the tiles keep the order they came in for as
|
|
758
772
|
// long as the page is open, and each stands where its style says.
|
|
759
|
-
// Someone who has arranged nothing sees the page composed, edge to edge; arranging
|
|
760
|
-
// same tiles on the grid's cells, where they move from (ADR-
|
|
773
|
+
// Someone who has arranged nothing sees the page composed, edge to edge (ADR-0082); arranging
|
|
774
|
+
// it puts the same tiles on the grid's cells, closed up, where they move from (ADR-0139).
|
|
761
775
|
const composing = !editing && nobodyArranged(working);
|
|
762
776
|
const boxes: readonly ComposedTile[] = useMemo(
|
|
763
777
|
() =>
|
|
@@ -812,6 +826,14 @@ export function HomeGrid(props: HomeGridProps) {
|
|
|
812
826
|
>
|
|
813
827
|
{words.reset}
|
|
814
828
|
</Button>
|
|
829
|
+
<Button
|
|
830
|
+
size="sm"
|
|
831
|
+
variant="ghost"
|
|
832
|
+
disabled={busy || !gaps}
|
|
833
|
+
onClick={() => change(closed)}
|
|
834
|
+
>
|
|
835
|
+
{words.tidy}
|
|
836
|
+
</Button>
|
|
815
837
|
<Button size="sm" variant="ghost" disabled={busy} onClick={cancel}>
|
|
816
838
|
{allWords.common.cancel}
|
|
817
839
|
</Button>
|
|
@@ -842,13 +864,15 @@ export function HomeGrid(props: HomeGridProps) {
|
|
|
842
864
|
))}
|
|
843
865
|
</div>
|
|
844
866
|
)}
|
|
845
|
-
{
|
|
867
|
+
{/* What stands on the page, composed or arranged: the tiles drawn, not the arranged ones,
|
|
868
|
+
which are not worked out while the page stands composed. */}
|
|
869
|
+
{boxes.length === 0 && !editing && (props.empty ?? null)}
|
|
846
870
|
<ul
|
|
847
871
|
ref={grid}
|
|
848
872
|
className="sc-home-grid"
|
|
849
873
|
aria-label={allWords.projects.list}
|
|
850
874
|
data-columns={columns}
|
|
851
|
-
hidden={
|
|
875
|
+
hidden={boxes.length === 0 && !editing}
|
|
852
876
|
style={
|
|
853
877
|
{
|
|
854
878
|
"--sc-home-columns": columns,
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createElement,
|
|
3
|
+
type KeyboardEvent,
|
|
4
|
+
useEffect,
|
|
5
|
+
useId,
|
|
6
|
+
useLayoutEffect,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
} from "react";
|
|
10
|
+
import { useWords } from "../i18n/index.js";
|
|
11
|
+
import {
|
|
12
|
+
findIcons,
|
|
13
|
+
GLYPHS,
|
|
14
|
+
type GlyphShape,
|
|
15
|
+
ICON_GRID,
|
|
16
|
+
ICON_GROUP_LIST,
|
|
17
|
+
type IconName,
|
|
18
|
+
type IconSection,
|
|
19
|
+
iconPlace,
|
|
20
|
+
iconStep,
|
|
21
|
+
isIconName,
|
|
22
|
+
} from "../icons/index.js";
|
|
23
|
+
import { opensAbove } from "./picker.js";
|
|
24
|
+
import { cx } from "./ui.js";
|
|
25
|
+
|
|
26
|
+
// A glyph of the icon pack by its name (ADR-0142), and the way to choose one. A glyph is drawn
|
|
27
|
+
// from the pack's data as elements, in the colour of the text it stands in, and never from
|
|
28
|
+
// markup: a name that is none of the pack's draws an empty box of the same size. The picker
|
|
29
|
+
// offers the pack by its groups and finds a glyph by words in the reader's language.
|
|
30
|
+
|
|
31
|
+
export type IconSize = "xs" | "sm" | "md" | "lg";
|
|
32
|
+
|
|
33
|
+
export interface IconProps {
|
|
34
|
+
readonly name: IconName;
|
|
35
|
+
/** `xs` a caret beside a word, `sm` in a line of text, `md` where it stands by itself (the default), `lg` in an empty state or on a card. */
|
|
36
|
+
readonly size?: IconSize | undefined;
|
|
37
|
+
/** What the glyph says, where it stands for words; left out, it is an ornament beside words and hidden from a screen reader. */
|
|
38
|
+
readonly label?: string | undefined;
|
|
39
|
+
readonly className?: string | undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The side a glyph is drawn at where no stylesheet says: a line of text's. */
|
|
43
|
+
const PLAIN_SIDE = 20;
|
|
44
|
+
|
|
45
|
+
export function Icon(props: IconProps) {
|
|
46
|
+
const shapes: readonly GlyphShape[] = isIconName(props.name) ? GLYPHS[props.name] : [];
|
|
47
|
+
// The measures and the stroke stand on the element too, so that a page without the console's
|
|
48
|
+
// stylesheet, a prototype's, draws the glyph as the pack means it.
|
|
49
|
+
const drawn = {
|
|
50
|
+
className: cx("sc-icon", `sc-icon-${props.size ?? "md"}`, props.className),
|
|
51
|
+
viewBox: `0 0 ${ICON_GRID} ${ICON_GRID}`,
|
|
52
|
+
width: PLAIN_SIDE,
|
|
53
|
+
height: PLAIN_SIDE,
|
|
54
|
+
fill: "none",
|
|
55
|
+
stroke: "currentColor",
|
|
56
|
+
strokeWidth: "1.5",
|
|
57
|
+
strokeLinecap: "round",
|
|
58
|
+
strokeLinejoin: "round",
|
|
59
|
+
focusable: "false",
|
|
60
|
+
} as const;
|
|
61
|
+
// A glyph's shapes are fixed, in a fixed order: each is told apart by its place.
|
|
62
|
+
const lines = shapes.map(([tag, measures], index) =>
|
|
63
|
+
createElement(tag, { key: index, ...measures }),
|
|
64
|
+
);
|
|
65
|
+
return props.label !== undefined && props.label.length > 0 ? (
|
|
66
|
+
<svg {...drawn} role="img" aria-label={props.label}>
|
|
67
|
+
{lines}
|
|
68
|
+
</svg>
|
|
69
|
+
) : (
|
|
70
|
+
<svg {...drawn} aria-hidden="true">
|
|
71
|
+
{lines}
|
|
72
|
+
</svg>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface IconPickerProps {
|
|
77
|
+
/** The glyph chosen, or `null` for none. */
|
|
78
|
+
readonly value: IconName | null;
|
|
79
|
+
readonly onChange: (value: IconName | null) => void;
|
|
80
|
+
/** The field's name, for the button and the list. */
|
|
81
|
+
readonly label: string;
|
|
82
|
+
/** What choosing none means, in the field and as the first choice; the pack's word for none when left out. */
|
|
83
|
+
readonly none?: string | undefined;
|
|
84
|
+
/** The button's id, where a label points at it. */
|
|
85
|
+
readonly id?: string | undefined;
|
|
86
|
+
readonly disabled?: boolean | undefined;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** How many tiles stand on a row of a grid as the browser laid it out; one where it cannot be read. */
|
|
90
|
+
function columnsOf(grid: Element | null): number {
|
|
91
|
+
if (grid === null || typeof getComputedStyle === "undefined") {
|
|
92
|
+
return 1;
|
|
93
|
+
}
|
|
94
|
+
const tracks = getComputedStyle(grid).gridTemplateColumns.split(" ").filter(Boolean).length;
|
|
95
|
+
return Math.max(1, tracks);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Choosing a glyph of the pack, or none: a field that shows the choice and opens the pack under
|
|
100
|
+
* it, with a box to find a glyph by words, the choice of none first, and the glyphs in their
|
|
101
|
+
* groups. The words typed keep the focus; the arrows move over the glyphs, Enter chooses,
|
|
102
|
+
* Escape closes, and the focus is back on the field afterwards.
|
|
103
|
+
*/
|
|
104
|
+
export function IconPicker(props: IconPickerProps) {
|
|
105
|
+
const all = useWords();
|
|
106
|
+
const words = all.icons;
|
|
107
|
+
const groupWords: Readonly<Record<string, string>> = words.groups;
|
|
108
|
+
const none = props.none ?? words.none;
|
|
109
|
+
const listId = useId();
|
|
110
|
+
const [open, setOpen] = useState(false);
|
|
111
|
+
const [query, setQuery] = useState("");
|
|
112
|
+
const [active, setActive] = useState(-1);
|
|
113
|
+
const [above, setAbove] = useState(false);
|
|
114
|
+
const trigger = useRef<HTMLButtonElement>(null);
|
|
115
|
+
const field = useRef<HTMLInputElement>(null);
|
|
116
|
+
const panel = useRef<HTMLDivElement>(null);
|
|
117
|
+
|
|
118
|
+
const searching = query.trim().length > 0;
|
|
119
|
+
/** What is offered, section by section: none first while nothing is searched, then the groups, or what the words found. */
|
|
120
|
+
const sections: readonly {
|
|
121
|
+
readonly key: string;
|
|
122
|
+
readonly heading: string | undefined;
|
|
123
|
+
readonly icons: readonly (IconName | null)[];
|
|
124
|
+
}[] = searching
|
|
125
|
+
? [{ key: "found", heading: undefined, icons: findIcons(query, words.words) }]
|
|
126
|
+
: [
|
|
127
|
+
{ key: "none", heading: undefined, icons: [null] },
|
|
128
|
+
...ICON_GROUP_LIST.map((group) => ({
|
|
129
|
+
key: group.key,
|
|
130
|
+
heading: Object.hasOwn(groupWords, group.key)
|
|
131
|
+
? (groupWords[group.key] ?? group.key)
|
|
132
|
+
: group.key,
|
|
133
|
+
icons: group.icons,
|
|
134
|
+
})),
|
|
135
|
+
];
|
|
136
|
+
const choices = sections.flatMap((section) => section.icons);
|
|
137
|
+
|
|
138
|
+
/** Opens the pack with the choice in hand, so that it is in sight and the keys go on from it. */
|
|
139
|
+
const show = () => {
|
|
140
|
+
setActive(iconPlace(props.value));
|
|
141
|
+
setOpen(true);
|
|
142
|
+
};
|
|
143
|
+
const close = (refocus: boolean) => {
|
|
144
|
+
setOpen(false);
|
|
145
|
+
setQuery("");
|
|
146
|
+
setActive(-1);
|
|
147
|
+
if (refocus) {
|
|
148
|
+
trigger.current?.focus();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const choose = (choice: IconName | null) => {
|
|
152
|
+
props.onChange(choice);
|
|
153
|
+
close(true);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// Opened, the words are typed at once; the pack opens above the field only where the window
|
|
157
|
+
// has no room below it and more above, measured before anything is painted.
|
|
158
|
+
useLayoutEffect(() => {
|
|
159
|
+
if (!open || trigger.current === null || panel.current === null) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
setAbove(
|
|
163
|
+
opensAbove(
|
|
164
|
+
trigger.current.getBoundingClientRect(),
|
|
165
|
+
panel.current.offsetHeight,
|
|
166
|
+
window.innerHeight,
|
|
167
|
+
),
|
|
168
|
+
);
|
|
169
|
+
field.current?.focus();
|
|
170
|
+
}, [open]);
|
|
171
|
+
|
|
172
|
+
// The choice in hand is kept in sight as the keys move it.
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
if (open && active >= 0) {
|
|
175
|
+
document.getElementById(`${listId}-${active}`)?.scrollIntoView?.({ block: "nearest" });
|
|
176
|
+
}
|
|
177
|
+
}, [open, active, listId]);
|
|
178
|
+
|
|
179
|
+
const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
|
|
180
|
+
if (event.key === "Escape") {
|
|
181
|
+
event.preventDefault();
|
|
182
|
+
event.stopPropagation();
|
|
183
|
+
close(true);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (event.key === "Enter") {
|
|
187
|
+
// A choice, or nothing: the form around the field is never sent by this key.
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
const chosen = active >= 0 ? choices[active] : searching ? choices[0] : undefined;
|
|
190
|
+
if (chosen !== undefined) {
|
|
191
|
+
choose(chosen);
|
|
192
|
+
}
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (event.key === "Tab") {
|
|
196
|
+
close(false);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
// Left and right move the caret in the words until a glyph is in hand; Home and End too.
|
|
200
|
+
const moves =
|
|
201
|
+
event.key === "ArrowDown" ||
|
|
202
|
+
event.key === "ArrowUp" ||
|
|
203
|
+
(active >= 0 &&
|
|
204
|
+
(event.key === "ArrowLeft" ||
|
|
205
|
+
event.key === "ArrowRight" ||
|
|
206
|
+
event.key === "Home" ||
|
|
207
|
+
event.key === "End"));
|
|
208
|
+
if (!moves) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
event.preventDefault();
|
|
212
|
+
// Every grid of the pack is as wide as the next, so the first says how many stand on a row.
|
|
213
|
+
const columns = columnsOf(panel.current?.querySelector(".sc-icon-grid") ?? null);
|
|
214
|
+
const laid: IconSection[] = sections.map((section) => ({
|
|
215
|
+
size: section.icons.length,
|
|
216
|
+
columns: section.key === "none" ? 1 : columns,
|
|
217
|
+
}));
|
|
218
|
+
const next = iconStep(laid, active, event.key);
|
|
219
|
+
if (next !== undefined) {
|
|
220
|
+
setActive(next);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
let place = 0;
|
|
225
|
+
return (
|
|
226
|
+
<div className="sc-icon-picker">
|
|
227
|
+
<button
|
|
228
|
+
type="button"
|
|
229
|
+
ref={trigger}
|
|
230
|
+
id={props.id}
|
|
231
|
+
className="sc-input sc-icon-picker-field"
|
|
232
|
+
aria-haspopup="listbox"
|
|
233
|
+
aria-expanded={open}
|
|
234
|
+
aria-label={`${props.label}: ${props.value ?? none}`}
|
|
235
|
+
disabled={props.disabled}
|
|
236
|
+
onClick={() => (open ? close(false) : show())}
|
|
237
|
+
onKeyDown={(event) => {
|
|
238
|
+
if (!open && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
show();
|
|
241
|
+
}
|
|
242
|
+
}}
|
|
243
|
+
>
|
|
244
|
+
{props.value !== null && <Icon name={props.value} size="sm" />}
|
|
245
|
+
<span className="sc-icon-picker-value">{props.value ?? none}</span>
|
|
246
|
+
<Icon name="chevron-down" size="sm" className="sc-icon-picker-caret" />
|
|
247
|
+
</button>
|
|
248
|
+
{open && (
|
|
249
|
+
// The pack under its field. A press anywhere in it keeps the focus on the words, so that
|
|
250
|
+
// the bar it scrolls by and the room between its tiles close nothing.
|
|
251
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: the press is kept from taking the focus off the words, and does nothing else
|
|
252
|
+
<div
|
|
253
|
+
ref={panel}
|
|
254
|
+
className={cx("sc-icon-picker-panel", above && "sc-icon-picker-panel-above")}
|
|
255
|
+
onMouseDown={(event) => {
|
|
256
|
+
if (event.target !== field.current) {
|
|
257
|
+
event.preventDefault();
|
|
258
|
+
}
|
|
259
|
+
}}
|
|
260
|
+
>
|
|
261
|
+
<input
|
|
262
|
+
ref={field}
|
|
263
|
+
className="sc-input"
|
|
264
|
+
type="text"
|
|
265
|
+
role="combobox"
|
|
266
|
+
aria-label={words.search}
|
|
267
|
+
aria-expanded="true"
|
|
268
|
+
aria-controls={listId}
|
|
269
|
+
aria-autocomplete="list"
|
|
270
|
+
aria-activedescendant={active >= 0 ? `${listId}-${active}` : undefined}
|
|
271
|
+
autoComplete="off"
|
|
272
|
+
spellCheck={false}
|
|
273
|
+
placeholder={words.search}
|
|
274
|
+
value={query}
|
|
275
|
+
onChange={(event) => {
|
|
276
|
+
setQuery(event.target.value);
|
|
277
|
+
setActive(-1);
|
|
278
|
+
}}
|
|
279
|
+
onBlur={() => close(false)}
|
|
280
|
+
onKeyDown={onKeyDown}
|
|
281
|
+
/>
|
|
282
|
+
<div className="sc-icon-picker-list" id={listId} role="listbox" aria-label={props.label}>
|
|
283
|
+
{sections.map((section) => (
|
|
284
|
+
// biome-ignore lint/a11y/useSemanticElements: a fieldset draws a frame and a legend of its own; a group of options is this
|
|
285
|
+
<div
|
|
286
|
+
key={section.key}
|
|
287
|
+
className="sc-icon-picker-group"
|
|
288
|
+
role="group"
|
|
289
|
+
aria-label={section.heading}
|
|
290
|
+
>
|
|
291
|
+
{section.heading !== undefined && (
|
|
292
|
+
<p className="sc-eyebrow" aria-hidden="true">
|
|
293
|
+
{section.heading}
|
|
294
|
+
</p>
|
|
295
|
+
)}
|
|
296
|
+
<div className={section.key === "none" ? "sc-icon-picker-none" : "sc-icon-grid"}>
|
|
297
|
+
{section.icons.map((choice) => {
|
|
298
|
+
const at = place;
|
|
299
|
+
place += 1;
|
|
300
|
+
const chosen = choice === props.value;
|
|
301
|
+
return (
|
|
302
|
+
<div
|
|
303
|
+
key={choice ?? "none"}
|
|
304
|
+
id={`${listId}-${at}`}
|
|
305
|
+
role="option"
|
|
306
|
+
tabIndex={-1}
|
|
307
|
+
aria-selected={chosen}
|
|
308
|
+
aria-label={choice ?? none}
|
|
309
|
+
title={choice ?? undefined}
|
|
310
|
+
className={cx(
|
|
311
|
+
"sc-icon-tile",
|
|
312
|
+
choice === null && "sc-icon-tile-none",
|
|
313
|
+
at === active && "sc-icon-tile-active",
|
|
314
|
+
chosen && "sc-icon-tile-chosen",
|
|
315
|
+
)}
|
|
316
|
+
onMouseDown={(event) => {
|
|
317
|
+
event.preventDefault();
|
|
318
|
+
choose(choice);
|
|
319
|
+
}}
|
|
320
|
+
onMouseEnter={() => setActive(at)}
|
|
321
|
+
>
|
|
322
|
+
{choice === null ? none : <Icon name={choice} />}
|
|
323
|
+
</div>
|
|
324
|
+
);
|
|
325
|
+
})}
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
))}
|
|
329
|
+
{choices.length === 0 && (
|
|
330
|
+
<p className="sc-icon-picker-note sc-muted">{words.nothingFound}</p>
|
|
331
|
+
)}
|
|
332
|
+
</div>
|
|
333
|
+
</div>
|
|
334
|
+
)}
|
|
335
|
+
</div>
|
|
336
|
+
);
|
|
337
|
+
}
|