@skillcdn/console 0.0.0-stage → 0.1.1

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 (128) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +79 -2
  3. package/dist/api.d.ts +7 -0
  4. package/dist/api.d.ts.map +1 -0
  5. package/dist/api.js +11 -0
  6. package/dist/api.js.map +1 -0
  7. package/dist/cli/cli.d.ts +34 -0
  8. package/dist/cli/cli.d.ts.map +1 -0
  9. package/dist/cli/cli.js +557 -0
  10. package/dist/cli/cli.js.map +1 -0
  11. package/dist/cli/credentials.d.ts +16 -0
  12. package/dist/cli/credentials.d.ts.map +1 -0
  13. package/dist/cli/credentials.js +46 -0
  14. package/dist/cli/credentials.js.map +1 -0
  15. package/dist/cli/format.d.ts +16 -0
  16. package/dist/cli/format.d.ts.map +1 -0
  17. package/dist/cli/format.js +151 -0
  18. package/dist/cli/format.js.map +1 -0
  19. package/dist/cli/help.d.ts +16 -0
  20. package/dist/cli/help.d.ts.map +1 -0
  21. package/dist/cli/help.js +181 -0
  22. package/dist/cli/help.js.map +1 -0
  23. package/dist/cli/main.d.ts +3 -0
  24. package/dist/cli/main.d.ts.map +1 -0
  25. package/dist/cli/main.js +32 -0
  26. package/dist/cli/main.js.map +1 -0
  27. package/dist/cli/terminal.d.ts +12 -0
  28. package/dist/cli/terminal.d.ts.map +1 -0
  29. package/dist/cli/terminal.js +68 -0
  30. package/dist/cli/terminal.js.map +1 -0
  31. package/dist/client.d.ts +92 -0
  32. package/dist/client.d.ts.map +1 -0
  33. package/dist/client.js +117 -0
  34. package/dist/client.js.map +1 -0
  35. package/dist/components/board.d.ts +20 -0
  36. package/dist/components/board.d.ts.map +1 -0
  37. package/dist/components/board.js +19 -0
  38. package/dist/components/board.js.map +1 -0
  39. package/dist/components/decision-form.d.ts +13 -0
  40. package/dist/components/decision-form.d.ts.map +1 -0
  41. package/dist/components/decision-form.js +23 -0
  42. package/dist/components/decision-form.js.map +1 -0
  43. package/dist/components/decision-list.d.ts +22 -0
  44. package/dist/components/decision-list.d.ts.map +1 -0
  45. package/dist/components/decision-list.js +28 -0
  46. package/dist/components/decision-list.js.map +1 -0
  47. package/dist/components/event-feed.d.ts +13 -0
  48. package/dist/components/event-feed.d.ts.map +1 -0
  49. package/dist/components/event-feed.js +59 -0
  50. package/dist/components/event-feed.js.map +1 -0
  51. package/dist/components/markdown.d.ts +4 -0
  52. package/dist/components/markdown.d.ts.map +1 -0
  53. package/dist/components/markdown.js +34 -0
  54. package/dist/components/markdown.js.map +1 -0
  55. package/dist/components/people.d.ts +11 -0
  56. package/dist/components/people.d.ts.map +1 -0
  57. package/dist/components/people.js +7 -0
  58. package/dist/components/people.js.map +1 -0
  59. package/dist/components/runs.d.ts +27 -0
  60. package/dist/components/runs.d.ts.map +1 -0
  61. package/dist/components/runs.js +45 -0
  62. package/dist/components/runs.js.map +1 -0
  63. package/dist/components/shell.d.ts +22 -0
  64. package/dist/components/shell.d.ts.map +1 -0
  65. package/dist/components/shell.js +16 -0
  66. package/dist/components/shell.js.map +1 -0
  67. package/dist/components/sign-in.d.ts +11 -0
  68. package/dist/components/sign-in.d.ts.map +1 -0
  69. package/dist/components/sign-in.js +15 -0
  70. package/dist/components/sign-in.js.map +1 -0
  71. package/dist/components/skills.d.ts +7 -0
  72. package/dist/components/skills.d.ts.map +1 -0
  73. package/dist/components/skills.js +26 -0
  74. package/dist/components/skills.js.map +1 -0
  75. package/dist/components/task-form.d.ts +14 -0
  76. package/dist/components/task-form.d.ts.map +1 -0
  77. package/dist/components/task-form.js +34 -0
  78. package/dist/components/task-form.js.map +1 -0
  79. package/dist/components/task-view.d.ts +22 -0
  80. package/dist/components/task-view.d.ts.map +1 -0
  81. package/dist/components/task-view.js +32 -0
  82. package/dist/components/task-view.js.map +1 -0
  83. package/dist/components/tokens.d.ts +26 -0
  84. package/dist/components/tokens.d.ts.map +1 -0
  85. package/dist/components/tokens.js +42 -0
  86. package/dist/components/tokens.js.map +1 -0
  87. package/dist/components/ui.d.ts +61 -0
  88. package/dist/components/ui.d.ts.map +1 -0
  89. package/dist/components/ui.js +109 -0
  90. package/dist/components/ui.js.map +1 -0
  91. package/dist/console.css +1382 -0
  92. package/dist/console.d.ts +44 -0
  93. package/dist/console.d.ts.map +1 -0
  94. package/dist/console.js +181 -0
  95. package/dist/console.js.map +1 -0
  96. package/dist/data.d.ts +41 -0
  97. package/dist/data.d.ts.map +1 -0
  98. package/dist/data.js +208 -0
  99. package/dist/data.js.map +1 -0
  100. package/dist/index.d.ts +19 -0
  101. package/dist/index.d.ts.map +1 -0
  102. package/dist/index.js +23 -0
  103. package/dist/index.js.map +1 -0
  104. package/dist/limits.d.ts +37 -0
  105. package/dist/limits.d.ts.map +1 -0
  106. package/dist/limits.js +40 -0
  107. package/dist/limits.js.map +1 -0
  108. package/dist/router.d.ts +37 -0
  109. package/dist/router.d.ts.map +1 -0
  110. package/dist/router.js +55 -0
  111. package/dist/router.js.map +1 -0
  112. package/dist/routes.d.ts +47 -0
  113. package/dist/routes.d.ts.map +1 -0
  114. package/dist/routes.js +53 -0
  115. package/dist/routes.js.map +1 -0
  116. package/dist/schemas.d.ts +789 -0
  117. package/dist/schemas.d.ts.map +1 -0
  118. package/dist/schemas.js +341 -0
  119. package/dist/schemas.js.map +1 -0
  120. package/dist/text.d.ts +6 -0
  121. package/dist/text.d.ts.map +1 -0
  122. package/dist/text.js +31 -0
  123. package/dist/text.js.map +1 -0
  124. package/dist/vocabulary.d.ts +35 -0
  125. package/dist/vocabulary.d.ts.map +1 -0
  126. package/dist/vocabulary.js +57 -0
  127. package/dist/vocabulary.js.map +1 -0
  128. package/package.json +70 -3
@@ -0,0 +1,27 @@
1
+ import type { ReactNode } from "react";
2
+ import { type RestArtifact, type RestRun, type RunStatus } from "../api.js";
3
+ export declare const RUN_STATUS_LABELS: Readonly<Record<RunStatus, string>>;
4
+ export declare function RunStatusBadge(props: {
5
+ readonly status: RunStatus;
6
+ }): import("react").JSX.Element;
7
+ export interface RunCardProps {
8
+ readonly run: RestRun;
9
+ /** Where the decision the run waits for is answered, when the page knows. */
10
+ readonly decisionHref?: ((decisionId: string) => string) | undefined;
11
+ /** Where a file handed in is read; the console's own path, on the page's origin, when left out. */
12
+ readonly fileHref?: ((artifact: RestArtifact) => string) | undefined;
13
+ /** Called to mark a run that will not come back as abandoned. Left out, it cannot be here. */
14
+ readonly onAbandon?: ((run: RestRun) => void) | undefined;
15
+ readonly busy?: boolean | undefined;
16
+ }
17
+ export declare function RunCard(props: RunCardProps): import("react").JSX.Element;
18
+ export interface RunListProps {
19
+ readonly runs: readonly RestRun[];
20
+ readonly decisionHref?: ((decisionId: string) => string) | undefined;
21
+ readonly fileHref?: ((artifact: RestArtifact) => string) | undefined;
22
+ readonly onAbandon?: ((run: RestRun) => void) | undefined;
23
+ readonly busy?: boolean | undefined;
24
+ readonly empty?: ReactNode;
25
+ }
26
+ export declare function RunList(props: RunListProps): import("react").JSX.Element;
27
+ //# sourceMappingURL=runs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/components/runs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,WAAW,CAAC;AAOtF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAMjE,CAAC;AAEF,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;CAAE,+BAYnE;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAC;IACrE,mGAAmG;IACnG,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,YAAY,KAAK,MAAM,CAAC,GAAG,SAAS,CAAC;IACrE,8FAA8F;IAC9F,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,+BAiE1C;AA4BD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,CAAC;IAClC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAC;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,YAAY,KAAK,MAAM,CAAC,GAAG,SAAS,CAAC;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAC5B;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,+BAkB1C"}
@@ -0,0 +1,45 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { restPath } from "../api.js";
3
+ import { Markdown } from "./markdown.js";
4
+ import { Badge, Button, formatBytes, PersonChip, Time } from "./ui.js";
5
+ // A run: one agent at work on one task for one person, with what it reported, what it handed
6
+ // in, and what it waits for. Takes its data as props and nothing from the network.
7
+ export const RUN_STATUS_LABELS = {
8
+ running: "At work",
9
+ waiting: "Waiting for a decision",
10
+ finished: "Finished",
11
+ failed: "Failed",
12
+ abandoned: "Abandoned",
13
+ };
14
+ export function RunStatusBadge(props) {
15
+ const tone = props.status === "running"
16
+ ? "accent"
17
+ : props.status === "waiting"
18
+ ? "warning"
19
+ : props.status === "finished"
20
+ ? "success"
21
+ : props.status === "failed"
22
+ ? "danger"
23
+ : "neutral";
24
+ return _jsx(Badge, { tone: tone, children: RUN_STATUS_LABELS[props.status] });
25
+ }
26
+ export function RunCard(props) {
27
+ const { run } = props;
28
+ const open = run.status === "running" || run.status === "waiting";
29
+ return (_jsxs("article", { className: "sc-run", "aria-label": `${run.agent} for ${run.person.login}`, children: [_jsxs("header", { className: "sc-run-header", children: [_jsx("span", { className: "sc-run-agent", children: run.agent }), _jsx(RunStatusBadge, { status: run.status }), _jsxs("span", { className: "sc-run-meta", children: ["for ", _jsx(PersonChip, { person: run.person }), " since ", _jsx(Time, { iso: run.startedAt }), run.endedAt !== null && (_jsxs(_Fragment, { children: [" ", "until ", _jsx(Time, { iso: run.endedAt })] }))] }), open && props.onAbandon !== undefined && (_jsx(Button, { variant: "ghost", size: "sm", disabled: props.busy === true, onClick: () => props.onAbandon?.(run), children: "Mark abandoned" }))] }), run.waitingFor !== null && (_jsxs("p", { className: "sc-run-waiting", children: ["Waiting for a decision", props.decisionHref !== undefined && (_jsxs(_Fragment, { children: [": ", _jsx("a", { href: props.decisionHref(run.waitingFor), children: "answer it" })] })), "."] })), run.reports.length > 0 && (_jsx("ol", { className: "sc-run-reports", "aria-label": "Reports", children: run.reports.map((report) => (_jsxs("li", { className: "sc-report", children: [_jsx(Time, { iso: report.createdAt }), _jsx(Markdown, { source: report.body })] }, report.id))) })), run.artifacts.length > 0 && (_jsx("ul", { className: "sc-link-list", "aria-label": "Handed in", children: run.artifacts.map((artifact) => (_jsx("li", { children: _jsx(ArtifactLink, { artifact: artifact, fileHref: props.fileHref }) }, artifact.id))) })), run.summary !== null && (_jsx("div", { className: "sc-run-summary", children: _jsx(Markdown, { source: run.summary }) }))] }));
30
+ }
31
+ /** A link as it was handed in; a file by its name, with its size, read from the console. */
32
+ function ArtifactLink(props) {
33
+ const { artifact } = props;
34
+ if (artifact.file === null) {
35
+ return (_jsx("a", { href: artifact.url ?? "", target: "_blank", rel: "noopener noreferrer nofollow ugc", children: artifact.label ?? artifact.url }));
36
+ }
37
+ return (_jsxs(_Fragment, { children: [_jsx("a", { href: props.fileHref?.(artifact) ?? restPath("files", artifact.id), rel: "nofollow ugc", children: artifact.label ?? artifact.file.name }), " ", _jsxs("span", { className: "sc-muted", children: [artifact.label === null ? "" : `${artifact.file.name}, `, formatBytes(artifact.file.size)] })] }));
38
+ }
39
+ export function RunList(props) {
40
+ if (props.runs.length === 0) {
41
+ return _jsx(_Fragment, { children: props.empty ?? null });
42
+ }
43
+ return (_jsx("div", { className: "sc-runs", children: props.runs.map((run) => (_jsx(RunCard, { run: run, decisionHref: props.decisionHref, fileHref: props.fileHref, onAbandon: props.onAbandon, busy: props.busy }, run.id))) }));
44
+ }
45
+ //# sourceMappingURL=runs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.js","sourceRoot":"","sources":["../../src/components/runs.tsx"],"names":[],"mappings":";AACA,OAAO,EAAmD,QAAQ,EAAE,MAAM,WAAW,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEvE,6FAA6F;AAC7F,mFAAmF;AAEnF,MAAM,CAAC,MAAM,iBAAiB,GAAwC;IACpE,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,wBAAwB;IACjC,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;CACvB,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,KAAqC;IAClE,MAAM,IAAI,GACR,KAA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AAG,EACR,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,IAAI,EAAE,KAAK,CAAC,IAAI,IALX,GAAG,CAAC,EAAE,CAMX,CACH,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { ReactNode } from "react";
2
+ import type { RestPerson } from "../api.js";
3
+ export interface NavItem {
4
+ readonly href: string;
5
+ readonly label: string;
6
+ readonly current: boolean;
7
+ /** A count beside the label: the decisions waiting, for example. */
8
+ readonly count?: number | undefined;
9
+ }
10
+ export interface ShellProps {
11
+ readonly title: string;
12
+ readonly nav: readonly NavItem[];
13
+ readonly person: RestPerson | undefined;
14
+ /** Follows a link inside the app without loading a document. */
15
+ readonly onNavigate: (href: string) => void;
16
+ readonly onSignOut?: (() => void) | undefined;
17
+ /** Whether the feed is connected: a dot in the header says so. */
18
+ readonly live?: boolean | undefined;
19
+ readonly children: ReactNode;
20
+ }
21
+ export declare function Shell(props: ShellProps): import("react").JSX.Element;
22
+ //# sourceMappingURL=shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/components/shell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAM5C,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,SAAS,OAAO,EAAE,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IACxC,gEAAgE;IAChE,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAC9C,kEAAkE;IAClE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,+BAqEtC"}
@@ -0,0 +1,16 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Avatar, Button, cx } from "./ui.js";
3
+ export function Shell(props) {
4
+ const follow = (href) => (event) => {
5
+ if (event.button === 0 &&
6
+ !event.metaKey &&
7
+ !event.ctrlKey &&
8
+ !event.shiftKey &&
9
+ !event.altKey) {
10
+ event.preventDefault();
11
+ props.onNavigate(href);
12
+ }
13
+ };
14
+ return (_jsxs("div", { className: "sc-shell", children: [_jsx("a", { className: "sc-skip", href: "#sc-content", children: "Skip to content" }), _jsx("header", { className: "sc-header", children: _jsxs("div", { className: "sc-header-inner", children: [_jsx("a", { className: "sc-brand", href: "/", onClick: follow("/"), children: props.title }), _jsx("nav", { className: "sc-nav", "aria-label": "Pages", children: props.nav.map((item) => (_jsxs("a", { href: item.href, className: cx("sc-nav-link", item.current && "sc-nav-current"), "aria-current": item.current ? "page" : undefined, onClick: follow(item.href), children: [item.label, item.count !== undefined && item.count > 0 && (_jsx("span", { className: "sc-nav-count", children: item.count }))] }, item.href))) }), _jsxs("div", { className: "sc-header-end", children: [props.live !== undefined && (_jsx("span", { className: cx("sc-live", props.live && "sc-live-on"), title: props.live ? "Live" : "Reconnecting", children: _jsx("span", { className: "sc-visually-hidden", children: props.live ? "Live" : "Reconnecting" }) })), props.person !== undefined && (_jsxs(_Fragment, { children: [_jsxs("span", { className: "sc-person", title: props.person.name ?? props.person.login, children: [_jsx(Avatar, { person: props.person, size: "sm" }), _jsx("span", { className: "sc-person-login", children: props.person.login })] }), props.onSignOut !== undefined && (_jsx(Button, { size: "sm", variant: "ghost", onClick: props.onSignOut, children: "Sign out" }))] }))] })] }) }), _jsx("main", { id: "sc-content", className: "sc-main", children: props.children })] }));
15
+ }
16
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/components/shell.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAyB7C,MAAM,UAAU,KAAK,CAAC,KAAiB;IACrC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,KAAuB,EAAE,EAAE;QAC3D,IACE,KAAK,CAAC,MAAM,KAAK,CAAC;YAClB,CAAC,KAAK,CAAC,OAAO;YACd,CAAC,KAAK,CAAC,OAAO;YACd,CAAC,KAAK,CAAC,QAAQ;YACf,CAAC,KAAK,CAAC,MAAM,EACb,CAAC;YACD,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,CAAC;IACF,OAAO,CACL,eAAK,SAAS,EAAC,UAAU,aACvB,YAAG,SAAS,EAAC,SAAS,EAAC,IAAI,EAAC,aAAa,gCAErC,EACJ,iBAAQ,SAAS,EAAC,WAAW,YAC3B,eAAK,SAAS,EAAC,iBAAiB,aAC9B,YAAG,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,YAClD,KAAK,CAAC,KAAK,GACV,EACJ,cAAK,SAAS,EAAC,QAAQ,g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K,GAAQ,IACxD,EACN,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,CAChC,KAAC,MAAM,IAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,KAAK,CAAC,SAAS,yBAEjD,CACV,IACA,CACJ,IACG,IACF,GACC,EACT,eAAM,EAAE,EAAC,YAAY,EAAC,SAAS,EAAC,SAAS,YACtC,KAAK,CAAC,QAAQ,GACV,IACH,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type RestProvider, type SignInFailure } from "../api.js";
2
+ export interface SignInProps {
3
+ readonly title: string;
4
+ /** The identity providers people sign in through; none where nobody can. */
5
+ readonly providers: readonly RestProvider[];
6
+ /** The page to come back to, signed in: a path of this origin. */
7
+ readonly returnTo: string;
8
+ readonly failure?: SignInFailure | undefined;
9
+ }
10
+ export declare function SignIn(props: SignInProps): import("react").JSX.Element;
11
+ //# sourceMappingURL=sign-in.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-in.d.ts","sourceRoot":"","sources":["../../src/components/sign-in.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAa7E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,SAAS,YAAY,EAAE,CAAC;IAC5C,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;CAC9C;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAkCxC"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { loginPath } from "../api.js";
3
+ import { Callout } from "./ui.js";
4
+ // The page a person sees before they are anyone: the way to each provider the deployment has,
5
+ // and what went wrong the last time, when something did.
6
+ const FAILURE_WORDS = {
7
+ denied: "The provider did not confirm the sign-in: you said no, or it did.",
8
+ expired: "The sign-in took too long or was finished in another browser. Try again.",
9
+ failed: "The sign-in did not complete. Try again in a moment.",
10
+ refused: "This account is not a member of the board. Ask whoever runs it to add you.",
11
+ };
12
+ export function SignIn(props) {
13
+ return (_jsxs("div", { className: "sc-sign-in", children: [_jsx("h1", { className: "sc-sign-in-title", children: props.title }), _jsx("p", { className: "sc-sign-in-lead", children: "The board of the work, the agents at it, what they did, and the decisions that wait for a person." }), props.failure !== undefined && (_jsx(Callout, { tone: props.failure === "refused" ? "warning" : "info", children: FAILURE_WORDS[props.failure] })), props.providers.length === 0 ? (_jsxs(Callout, { tone: "warning", title: "Nobody can sign in here yet", children: ["Signing in is not configured on this console. Whoever runs it sets it up as", " ", _jsx("code", { children: "deploy/README.md" }), " describes."] })) : (_jsx("div", { className: "sc-sign-in-ways", children: props.providers.map((provider) => (_jsxs("a", { className: "sc-button sc-button-primary sc-sign-in-button", href: loginPath(provider.key, props.returnTo), children: ["Continue with ", provider.label] }, provider.key))) }))] }));
14
+ }
15
+ //# sourceMappingURL=sign-in.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../../src/components/sign-in.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAyC,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,8FAA8F;AAC9F,yDAAyD;AAEzD,MAAM,aAAa,GAA4C;IAC7D,MAAM,EAAE,mEAAmE;IAC3E,OAAO,EAAE,0EAA0E;IACnF,MAAM,EAAE,sDAAsD;IAC9D,OAAO,EAAE,4EAA4E;CACtF,CAAC;AAWF,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,OAAO,CACL,eAAK,SAAS,EAAC,YAAY,aACzB,aAAI,SAAS,EAAC,kBAAkB,YAAE,KAAK,CAAC,KAAK,GAAM,EACnD,YAAG,SAAS,EAAC,iBAAiB,kHAG1B,EACH,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,CAC9B,KAAC,OAAO,IAAC,IAAI,EAAE,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,YAC5D,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,GACrB,CACX,EACA,KAAK,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAC9B,MAAC,OAAO,IAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAC,6BAA6B,4FACmB,GAAG,EAC/E,8CAA6B,mBACrB,CACX,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,iBAAiB,YAC7B,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAEjC,aAEE,SAAS,EAAC,+CAA+C,EACzD,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,+BAE9B,QAAQ,CAAC,KAAK,KAJxB,QAAQ,CAAC,GAAG,CAKf,CACL,CAAC,GACE,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { RestSkills } from "../api.js";
2
+ export interface SkillListProps {
3
+ /** What the console answered, or nothing while it has not yet. */
4
+ readonly skills: RestSkills | undefined;
5
+ }
6
+ export declare function SkillList(props: SkillListProps): import("react").JSX.Element;
7
+ //# sourceMappingURL=skills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/components/skills.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAO5C,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;CACzC;AAUD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAuE9C"}
@@ -0,0 +1,26 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Callout, EmptyState, Spinner } from "./ui.js";
3
+ const STATUS_WORDS = {
4
+ indexing: "SkillCDN is still indexing the repository. Look again in a moment.",
5
+ failed: "SkillCDN could not index the repository. What it found is on the address's page.",
6
+ not_found: "SkillCDN does not serve this address, or serves it only to someone signed in there. The address's page says which.",
7
+ unavailable: "SkillCDN could not be reached. The skills are as they were; look again later.",
8
+ };
9
+ export function SkillList(props) {
10
+ const { skills } = props;
11
+ if (skills === undefined) {
12
+ return _jsx(Spinner, { label: "Loading the skills" });
13
+ }
14
+ if (skills.status === "none" || skills.address === null || skills.page === null) {
15
+ return (_jsx(EmptyState, { title: "No skills address yet", body: "This console has no address for the organization's skills. Whoever runs it names a repository served by SkillCDN in its configuration." }));
16
+ }
17
+ const where = (_jsxs("p", { className: "sc-lead", children: ["The organization's skills, served by", " ", _jsx("a", { href: skills.source, target: "_blank", rel: "noopener noreferrer", children: "SkillCDN" }), " ", "at", " ", _jsx("a", { href: skills.page, target: "_blank", rel: "noopener noreferrer", children: _jsx("code", { children: skills.address }) }), ". An agent loads one through its SkillCDN connection; a person reads it at its page."] }));
18
+ if (skills.status !== "ready") {
19
+ return (_jsxs(_Fragment, { children: [where, _jsx(Callout, { tone: skills.status === "indexing" ? "info" : "warning", children: STATUS_WORDS[skills.status] })] }));
20
+ }
21
+ if (skills.items.length === 0) {
22
+ return (_jsxs(_Fragment, { children: [where, _jsx(EmptyState, { title: "No skills at this address", body: "The repository is served, and SkillCDN found no skill in it." })] }));
23
+ }
24
+ return (_jsxs(_Fragment, { children: [where, _jsx("ul", { className: "sc-skills", "aria-label": "Skills", children: skills.items.map((skill) => (_jsxs("li", { className: "sc-skill", children: [_jsxs("p", { className: "sc-skill-head", children: [_jsx("a", { className: "sc-skill-name", href: skill.page, target: "_blank", rel: "noopener noreferrer nofollow", children: skill.name }), _jsx("span", { className: "sc-muted", children: skill.directory === "" ? "/" : skill.directory })] }), _jsx("p", { className: "sc-skill-description", children: skill.description }), skill.uri !== null && _jsx("code", { className: "sc-skill-uri", children: skill.uri })] }, skill.path))) })] }));
25
+ }
26
+ //# sourceMappingURL=skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/components/skills.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAWvD,MAAM,YAAY,GAA8E;IAC9F,QAAQ,EAAE,oEAAoE;IAC9E,MAAM,EAAE,kFAAkF;IAC1F,SAAS,EACP,oHAAoH;IACtH,WAAW,EAAE,+EAA+E;CAC7F,CAAC;AAEF,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,KAAC,OAAO,IAAC,KAAK,EAAC,oBAAoB,GAAG,CAAC;IAChD,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,OAAO,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAChF,OAAO,CACL,KAAC,UAAU,IACT,KAAK,EAAC,uBAAuB,EAC7B,IAAI,EAAC,wIAAwI,GAC7I,CACH,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,CACZ,aAAG,SAAS,EAAC,SAAS,qDACiB,GAAG,EACxC,YAAG,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB,yBAE7D,EAAC,GAAG,QACL,GAAG,EACN,YAAG,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAC,QA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AAK,CAAC,IAAI,CAcd,CACN,CAAC,GACC,IACJ,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type RestPerson, type RestTask, type RestTaskInput } from "../api.js";
2
+ export interface TaskFormProps {
3
+ readonly people: readonly RestPerson[];
4
+ /** The task to change; left out, the form writes a new one. */
5
+ readonly task?: RestTask | undefined;
6
+ /** The tasks a new one may be part of. */
7
+ readonly parents?: readonly RestTask[] | undefined;
8
+ readonly busy?: boolean | undefined;
9
+ readonly error?: string | undefined;
10
+ readonly onSubmit: (input: RestTaskInput) => void;
11
+ readonly onCancel?: (() => void) | undefined;
12
+ }
13
+ export declare function TaskForm(props: TaskFormProps): import("react").JSX.Element;
14
+ //# sourceMappingURL=task-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-form.d.ts","sourceRoot":"","sources":["../../src/components/task-form.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,aAAa,EAGnB,MAAM,WAAW,CAAC;AAKnB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACrC,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,QAAQ,EAAE,GAAG,SAAS,CAAC;IACnD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CAC9C;AAOD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,+BA+L5C"}
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { MAX_BODY_LENGTH, MAX_LINK_LABEL_LENGTH, MAX_LINKS, MAX_TITLE_LENGTH, MAX_URL_LENGTH, TASK_PRIORITIES, TASK_STATES, } from "../api.js";
4
+ import { Button, PRIORITY_LABELS, STATE_LABELS } from "./ui.js";
5
+ export function TaskForm(props) {
6
+ const { task } = props;
7
+ const [title, setTitle] = useState(task?.title ?? "");
8
+ const [body, setBody] = useState(task?.body ?? "");
9
+ const [state, setState] = useState(task?.state ?? "idea");
10
+ const [priority, setPriority] = useState(task?.priority ?? "normal");
11
+ const [assigneeId, setAssigneeId] = useState(task?.assignee?.id ?? "");
12
+ const [parentId, setParentId] = useState(task?.parentId ?? "");
13
+ const [links, setLinks] = useState(task?.links.map((link) => ({ url: link.url, label: link.label ?? "" })) ?? []);
14
+ const submit = (event) => {
15
+ event.preventDefault();
16
+ props.onSubmit({
17
+ title: title.trim(),
18
+ body,
19
+ state,
20
+ priority,
21
+ assigneeId: assigneeId === "" ? null : assigneeId,
22
+ parentId: parentId === "" ? null : parentId,
23
+ links: links
24
+ .filter((link) => link.url.trim().length > 0)
25
+ .map((link) => ({
26
+ url: link.url.trim(),
27
+ label: link.label.trim() === "" ? null : link.label.trim(),
28
+ })),
29
+ });
30
+ };
31
+ const parents = (props.parents ?? []).filter((candidate) => candidate.id !== task?.id);
32
+ return (_jsxs("form", { className: "sc-form", onSubmit: submit, children: [_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: "Title" }), _jsx("input", { className: "sc-input", value: title, maxLength: MAX_TITLE_LENGTH, required: true, onChange: (event) => setTitle(event.target.value) })] }), _jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: "Body" }), _jsx("textarea", { className: "sc-input sc-textarea", value: body, maxLength: MAX_BODY_LENGTH, rows: 6, placeholder: "What is to be done, in Markdown.", onChange: (event) => setBody(event.target.value) })] }), _jsxs("div", { className: "sc-field-row", children: [_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: "State" }), _jsx("select", { className: "sc-input", value: state, onChange: (event) => setState(event.target.value), children: TASK_STATES.map((candidate) => (_jsx("option", { value: candidate, children: STATE_LABELS[candidate] }, candidate))) })] }), _jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: "Priority" }), _jsx("select", { className: "sc-input", value: priority, onChange: (event) => setPriority(event.target.value), children: TASK_PRIORITIES.map((candidate) => (_jsx("option", { value: candidate, children: PRIORITY_LABELS[candidate] }, candidate))) })] }), _jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: "Assignee" }), _jsxs("select", { className: "sc-input", value: assigneeId, onChange: (event) => setAssigneeId(event.target.value), children: [_jsx("option", { value: "", children: "Nobody" }), props.people.map((person) => (_jsx("option", { value: person.id, children: person.login }, person.id)))] })] }), parents.length > 0 && (_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: "Part of" }), _jsxs("select", { className: "sc-input", value: parentId, onChange: (event) => setParentId(event.target.value), children: [_jsx("option", { value: "", children: "Nothing" }), parents.map((candidate) => (_jsxs("option", { value: candidate.id, children: ["#", candidate.number, " ", candidate.title] }, candidate.id)))] })] }))] }), _jsxs("fieldset", { className: "sc-field sc-links", children: [_jsx("legend", { className: "sc-field-label", children: "Links" }), links.map((link, index) => (_jsxs("div", { className: "sc-link-row", children: [_jsx("input", { className: "sc-input", type: "url", placeholder: "https://", pattern: "https://.*", maxLength: MAX_URL_LENGTH, value: link.url, onChange: (event) => setLinks(links.map((entry, at) => at === index ? { ...entry, url: event.target.value } : entry)) }), _jsx("input", { className: "sc-input", placeholder: "Label", maxLength: MAX_LINK_LABEL_LENGTH, value: link.label, onChange: (event) => setLinks(links.map((entry, at) => at === index ? { ...entry, label: event.target.value } : entry)) }), _jsx(Button, { variant: "ghost", size: "sm", onClick: () => setLinks(links.filter((_, at) => at !== index)), children: "Remove" })] }, index))), links.length < MAX_LINKS && (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setLinks([...links, { url: "", label: "" }]), children: "Add a link" }))] }), props.error !== undefined && (_jsx("p", { className: "sc-form-error", role: "alert", children: props.error })), _jsxs("div", { className: "sc-form-actions", children: [_jsx(Button, { type: "submit", variant: "primary", disabled: props.busy === true || title.trim() === "", children: task === undefined ? "Write the task" : "Save" }), props.onCancel !== undefined && (_jsx(Button, { variant: "ghost", onClick: props.onCancel, children: "Cancel" }))] })] }));
33
+ }
34
+ //# sourceMappingURL=task-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-form.js","sourceRoot":"","sources":["../../src/components/task-form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,gBAAgB,EAChB,cAAc,EAId,eAAe,EACf,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAqBhE,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACvB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACtD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,MAAM,CAAC,CAAC;IAC1D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,QAAQ,IAAI,QAAQ,CAAC,CAAC;IAC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MAAM,IACL,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,uBAGvD,KAnCD,KAAK,CAoCT,CACP,CAAC,EACD,KAAK,CAAC,MAAM,GAAG,SAAS,IAAI,CAC3B,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,2BAGpD,CACV,IACQ,EACV,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,CAC5B,YAAG,SAAS,EAAC,eAAe,EAAC,IAAI,EAAC,OAAO,YACtC,KAAK,CAAC,KAAK,GACV,CACL,EACD,eAAK,SAAS,EAAC,iBAAiB,aAC9B,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,SAAS,EACjB,QAAQ,EAAE,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,YAEnD,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,GACxC,EACR,KAAK,CAAC,QAAQ,KAAK,SAAS,IAAI,CAC/B,KAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,uBAEtC,CACV,IACG,IACD,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { RestAnswerInput, RestDecision, RestDecisionInput, RestPerson, RestRun, RestTask, RestTaskInput, TaskState } from "../api.js";
2
+ export interface TaskViewProps {
3
+ readonly task: RestTask;
4
+ readonly people: readonly RestPerson[];
5
+ /** Every task of the board, for the breakdown and for what this one may be part of. */
6
+ readonly tasks: readonly RestTask[];
7
+ readonly decisions: readonly RestDecision[];
8
+ /** The runs of the board, or of this task; the ones on this task are shown. */
9
+ readonly runs?: readonly RestRun[] | undefined;
10
+ readonly taskHref: (task: RestTask) => string;
11
+ /** Where a decision is answered, for a run that waits for one. */
12
+ readonly decisionHref?: ((decisionId: string) => string) | undefined;
13
+ readonly busy?: boolean | undefined;
14
+ readonly error?: string | undefined;
15
+ readonly onChange: (task: RestTask, patch: RestTaskInput) => void;
16
+ readonly onMove: (task: RestTask, state: TaskState) => void;
17
+ readonly onRaiseDecision: (input: RestDecisionInput) => void;
18
+ readonly onAnswer: (decision: RestDecision, input: RestAnswerInput) => void;
19
+ readonly onAbandonRun?: ((run: RestRun) => void) | undefined;
20
+ }
21
+ export declare function TaskView(props: TaskViewProps): import("react").JSX.Element;
22
+ //# sourceMappingURL=task-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-view.d.ts","sourceRoot":"","sources":["../../src/components/task-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,OAAO,EACP,QAAQ,EACR,aAAa,EACb,SAAS,EACV,MAAM,WAAW,CAAC;AAanB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,YAAY,EAAE,CAAC;IAC5C,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC;IAC9C,kEAAkE;IAClE,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAC;IACrE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAClE,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAC5D,QAAQ,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7D,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5E,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAC9D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,+BA0L5C"}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { TASK_STATES } from "../vocabulary.js";
4
+ import { DecisionForm } from "./decision-form.js";
5
+ import { DecisionCard } from "./decision-list.js";
6
+ import { Markdown } from "./markdown.js";
7
+ import { RunList } from "./runs.js";
8
+ import { TaskForm } from "./task-form.js";
9
+ import { Button, PersonChip, PriorityBadge, STATE_LABELS, StateBadge, Time } from "./ui.js";
10
+ export function TaskView(props) {
11
+ const { task } = props;
12
+ const [editing, setEditing] = useState(false);
13
+ const [asking, setAsking] = useState(false);
14
+ const parent = task.parentId === null
15
+ ? undefined
16
+ : props.tasks.find((candidate) => candidate.id === task.parentId);
17
+ const subtasks = props.tasks.filter((candidate) => candidate.parentId === task.id);
18
+ const about = props.decisions.filter((decision) => decision.taskId === task.id);
19
+ const runs = (props.runs ?? []).filter((run) => run.taskId === task.id);
20
+ const tasksById = new Map(props.tasks.map((candidate) => [candidate.id, candidate]));
21
+ if (editing) {
22
+ return (_jsxs("div", { className: "sc-task", children: [_jsxs("h1", { className: "sc-task-title", children: [_jsxs("span", { className: "sc-card-number", children: ["#", task.number] }), " ", task.title] }), _jsx(TaskForm, { people: props.people, task: task, parents: props.tasks, busy: props.busy, error: props.error, onSubmit: (input) => {
23
+ props.onChange(task, input);
24
+ setEditing(false);
25
+ }, onCancel: () => setEditing(false) })] }));
26
+ }
27
+ return (_jsxs("div", { className: "sc-task", children: [_jsxs("header", { className: "sc-task-header", children: [parent !== undefined && (_jsxs("p", { className: "sc-task-parent", children: ["Part of", " ", _jsxs("a", { href: props.taskHref(parent), children: ["#", parent.number, " ", parent.title] })] })), _jsxs("h1", { className: "sc-task-title", children: [_jsxs("span", { className: "sc-card-number", children: ["#", task.number] }), " ", task.title] }), _jsxs("div", { className: "sc-task-badges", children: [_jsx(StateBadge, { state: task.state }), _jsx(PriorityBadge, { priority: task.priority })] })] }), _jsxs("dl", { className: "sc-facts", children: [_jsxs("div", { children: [_jsx("dt", { children: "Owner" }), _jsx("dd", { children: _jsx(PersonChip, { person: task.owner }) })] }), _jsxs("div", { children: [_jsx("dt", { children: "Assignee" }), _jsx("dd", { children: task.assignee === null ? (_jsx("span", { className: "sc-muted", children: "Nobody" })) : (_jsx(PersonChip, { person: task.assignee })) })] }), _jsxs("div", { children: [_jsx("dt", { children: "Written" }), _jsx("dd", { children: _jsx(Time, { iso: task.createdAt }) })] }), _jsxs("div", { children: [_jsx("dt", { children: "Changed" }), _jsx("dd", { children: _jsx(Time, { iso: task.updatedAt }) })] })] }), _jsxs("div", { className: "sc-task-actions", children: [_jsxs("label", { className: "sc-field sc-field-inline", children: [_jsx("span", { className: "sc-field-label", children: "State" }), _jsx("select", { className: "sc-input", value: task.state, disabled: props.busy === true, onChange: (event) => props.onMove(task, event.target.value), children: TASK_STATES.map((state) => (_jsx("option", { value: state, children: STATE_LABELS[state] }, state))) })] }), _jsx(Button, { onClick: () => setEditing(true), children: "Edit" }), _jsx(Button, { onClick: () => setAsking(true), disabled: asking, children: "Raise a decision" })] }), props.error !== undefined && (_jsx("p", { className: "sc-form-error", role: "alert", children: props.error })), task.body.length > 0 ? (_jsx(Markdown, { source: task.body })) : (_jsx("p", { className: "sc-muted", children: "Nothing more was written about it." })), task.links.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": "Links", children: [_jsx("h2", { className: "sc-section-title", children: "Links" }), _jsx("ul", { className: "sc-link-list", children: task.links.map((link) => (_jsx("li", { children: _jsx("a", { href: link.url, target: "_blank", rel: "noopener noreferrer nofollow", children: link.label ?? link.url }) }, link.url))) })] })), asking && (_jsxs("section", { className: "sc-task-section", "aria-label": "Raise a decision", children: [_jsx("h2", { className: "sc-section-title", children: "Raise a decision" }), _jsx(DecisionForm, { tasks: props.tasks, taskId: task.id, busy: props.busy, onSubmit: (input) => {
28
+ props.onRaiseDecision(input);
29
+ setAsking(false);
30
+ }, onCancel: () => setAsking(false) })] })), runs.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": "Runs", children: [_jsx("h2", { className: "sc-section-title", children: "Agents at work" }), _jsx(RunList, { runs: runs, decisionHref: props.decisionHref, onAbandon: props.onAbandonRun, busy: props.busy })] })), about.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": "Decisions", children: [_jsx("h2", { className: "sc-section-title", children: "Decisions" }), about.map((decision) => (_jsx(DecisionCard, { decision: decision, task: decision.taskId === null ? undefined : tasksById.get(decision.taskId), onAnswer: props.onAnswer, busy: props.busy }, decision.id)))] })), subtasks.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": "Subtasks", children: [_jsx("h2", { className: "sc-section-title", children: "Part of it" }), _jsx("ul", { className: "sc-subtasks", children: subtasks.map((subtask) => (_jsxs("li", { children: [_jsxs("a", { href: props.taskHref(subtask), children: [_jsxs("span", { className: "sc-card-number", children: ["#", subtask.number] }), " ", subtask.title] }), " ", _jsx(StateBadge, { state: subtask.state })] }, subtask.id))) })] }))] }));
31
+ }
32
+ //# sourceMappingURL=task-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-view.js","sourceRoot":"","sources":["../../src/components/task-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAWjC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AA0B5F,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACvB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,MAAM,GACV,IAAI,CAAC,QAAQ,KAAK,IAAI;QACpB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtE,MAAM,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AAS,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC3E,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,IAAI,EAAE,KAAK,CAAC,IAAI,IAJX,QAAQ,CAAC,EAAE,CAKhB,CACH,CAAC,IACM,CACX,EACA,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CACtB,mBAAS,SAAS,EAAC,iBAAiB,gBAAY,UAAU,aACxD,aAAI,SAAS,EAAC,kBAAkB,2BAAgB,EAChD,aAAI,SAAS,EAAC,aAAa,YACxB,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACzB,yBACE,aAAG,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,aAC9B,gBAAM,SAAS,EAAC,gBAAgB,kBAAG,OAAO,CAAC,MAAM,IAAQ,OAAE,OAAO,CAAC,KAAK,IACtE,EAAC,GAAG,EACR,KAAC,UAAU,IAAC,KAAK,EAAE,OAAO,CAAC,KAAK,GAAI,KAJ7B,OAAO,CAAC,EAAE,CAKd,CACN,CAAC,GACC,IACG,CACX,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { type ReactNode } from "react";
2
+ import { type RestToken, type RestTokenInput } from "../api.js";
3
+ export interface TokenListProps {
4
+ readonly tokens: readonly RestToken[];
5
+ /** Called to take a token away. Left out, tokens cannot be removed here. */
6
+ readonly onRevoke?: ((token: RestToken) => void) | undefined;
7
+ readonly busy?: boolean | undefined;
8
+ readonly empty?: ReactNode;
9
+ }
10
+ export declare function TokenList(props: TokenListProps): import("react").JSX.Element;
11
+ export interface TokenFormProps {
12
+ readonly busy?: boolean | undefined;
13
+ readonly error?: string | undefined;
14
+ readonly onSubmit: (input: RestTokenInput) => void;
15
+ readonly onCancel?: (() => void) | undefined;
16
+ }
17
+ export declare function TokenForm(props: TokenFormProps): import("react").JSX.Element;
18
+ export interface NewTokenProps {
19
+ readonly token: RestToken;
20
+ /** The secret, which the server answered once and does not keep. */
21
+ readonly secret: string;
22
+ readonly onDone: () => void;
23
+ }
24
+ /** The token just made, with its secret shown this once and the way to copy it. */
25
+ export declare function NewToken(props: NewTokenProps): import("react").JSX.Element;
26
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/components/tokens.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AACjE,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AAiBnB,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC7D,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAC5B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAgD9C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CAC9C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BA4D9C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,mFAAmF;AACnF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,+BA2C5C"}
@@ -0,0 +1,42 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { DEFAULT_TOKEN_DAYS, MAX_TOKEN_NAME_LENGTH, } from "../api.js";
4
+ import { Button, Callout, Time } from "./ui.js";
5
+ // The tokens a person holds for their agents, scripts and consoles of their own: the list, the
6
+ // way to make one, and the one just made, whose secret is shown this once. Each takes its data
7
+ // as props and nothing from the network.
8
+ /** How long a token may be good for, as the form offers it; `never` for one that does not expire. */
9
+ const DAY_CHOICES = ["30", "90", "180", "365", "never"];
10
+ const DEFAULT_CHOICE = DAY_CHOICES.find((choice) => choice === String(DEFAULT_TOKEN_DAYS)) ?? "90";
11
+ const choiceOf = (value) => DAY_CHOICES.find((choice) => choice === value) ?? DEFAULT_CHOICE;
12
+ const choiceLabel = (choice) => choice === "never" ? "Does not expire" : `${choice} days`;
13
+ export function TokenList(props) {
14
+ if (props.tokens.length === 0) {
15
+ return _jsx(_Fragment, { children: props.empty ?? null });
16
+ }
17
+ return (_jsx("ul", { className: "sc-token-list", "aria-label": "Tokens", children: props.tokens.map((token) => (_jsxs("li", { className: "sc-token", children: [_jsxs("div", { children: [_jsx("p", { className: "sc-token-name", children: token.name }), _jsxs("p", { className: "sc-token-meta", children: [_jsxs("span", { children: ["Made ", _jsx(Time, { iso: token.createdAt })] }), _jsx("span", { children: token.expiresAt === null ? ("Does not expire") : (_jsxs(_Fragment, { children: ["Good until ", _jsx(Time, { iso: token.expiresAt })] })) }), _jsx("span", { children: token.lastUsedAt === null ? ("Never used") : (_jsxs(_Fragment, { children: ["Last used ", _jsx(Time, { iso: token.lastUsedAt })] })) })] })] }), props.onRevoke !== undefined && (_jsx(Button, { variant: "danger", size: "sm", disabled: props.busy === true, onClick: () => props.onRevoke?.(token), children: "Remove" }))] }, token.id))) }));
18
+ }
19
+ export function TokenForm(props) {
20
+ const [name, setName] = useState("");
21
+ const [choice, setChoice] = useState(DEFAULT_CHOICE);
22
+ const submit = (event) => {
23
+ event.preventDefault();
24
+ props.onSubmit({
25
+ name: name.trim(),
26
+ expiresInDays: choice === "never" ? null : Number(choice),
27
+ });
28
+ };
29
+ return (_jsxs("form", { className: "sc-form", onSubmit: submit, children: [_jsxs("div", { className: "sc-field-row", children: [_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: "Name" }), _jsx("input", { className: "sc-input", value: name, maxLength: MAX_TOKEN_NAME_LENGTH, required: true, placeholder: "The agent it is for, and where it runs", onChange: (event) => setName(event.target.value) })] }), _jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: "Good for" }), _jsx("select", { className: "sc-input", value: choice, onChange: (event) => setChoice(choiceOf(event.target.value)), children: DAY_CHOICES.map((option) => (_jsx("option", { value: option, children: choiceLabel(option) }, option))) })] })] }), props.error !== undefined && (_jsx("p", { className: "sc-form-error", role: "alert", children: props.error })), _jsxs("div", { className: "sc-form-actions", children: [_jsx(Button, { type: "submit", variant: "primary", disabled: props.busy === true || name.trim() === "", children: "Make the token" }), props.onCancel !== undefined && (_jsx(Button, { variant: "ghost", onClick: props.onCancel, children: "Cancel" }))] })] }));
30
+ }
31
+ /** The token just made, with its secret shown this once and the way to copy it. */
32
+ export function NewToken(props) {
33
+ const [copied, setCopied] = useState(false);
34
+ const copy = () => {
35
+ if (typeof navigator === "undefined" || navigator.clipboard === undefined) {
36
+ return;
37
+ }
38
+ void navigator.clipboard.writeText(props.secret).then(() => setCopied(true), () => setCopied(false));
39
+ };
40
+ return (_jsxs(Callout, { tone: "warning", title: `The token "${props.token.name}" is ready`, action: _jsx(Button, { size: "sm", variant: "ghost", onClick: props.onDone, children: "Done" }), children: [_jsx("p", { children: "Copy it now: it is shown this once, and the console keeps only its hash." }), _jsxs("p", { className: "sc-secret", children: [_jsx("code", { className: "sc-secret-value", children: props.secret }), _jsx(Button, { size: "sm", onClick: copy, children: copied ? "Copied" : "Copy" })] }), _jsxs("p", { children: ["Sign the ", _jsx("code", { children: "console" }), " command in with it, present it as", " ", _jsx("code", { children: "Authorization: Bearer \u2026" }), " to the REST API, or give it to a console or a script of your own.", " ", props.token.expiresAt === null ? ("It does not expire, so remove it here once it is no longer needed.") : (_jsxs(_Fragment, { children: ["It is good until ", _jsx(Time, { iso: props.token.expiresAt }), ", and you can remove it here at any time."] }))] })] }));
41
+ }
42
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/components/tokens.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkC,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GAGtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEhD,+FAA+F;AAC/F,+FAA+F;AAC/F,yCAAyC;AAEzC,qGAAqG;AACrG,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAU,CAAC;AAEjE,MAAM,cAAc,GAClB,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,IAAI,CAAC;AAC9E,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAa,EAAE,CAC5C,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,cAAc,CAAC;AACnE,MAAM,WAAW,GAAG,CAAC,MAAiB,EAAU,EAAE,CAChD,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,iBAAiB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OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,KAAK,CAAC,MAAM,qBAE9C,aAGX,mGAA+E,EAC/E,aAAG,SAAS,EAAC,WAAW,aACtB,eAAM,SAAS,EAAC,iBAAiB,YAAE,KAAK,CAAC,MAAM,GAAQ,EACvD,KAAC,MAAM,IAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,IAAI,YAC5B,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,GACpB,IACP,EACJ,qCACW,qCAAoB,wCAAmC,GAAG,EACnE,0DAAoC,wEAC1B,GAAG,EACZ,KAAK,CAAC,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,CAChC,oEAAoE,CACrE,CAAC,CAAC,CAAC,CACF,mDACmB,KAAC,IAAI,IAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,GAAI,iDAEpD,CACJ,IACC,IACI,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { ButtonHTMLAttributes, ReactNode } from "react";
2
+ import type { PersonRole, RestPerson, TaskPriority, TaskState } from "../api.js";
3
+ export declare function cx(...names: (string | false | undefined)[]): string;
4
+ export declare function Button(props: ButtonHTMLAttributes<HTMLButtonElement> & {
5
+ readonly variant?: "primary" | "secondary" | "ghost" | "danger";
6
+ readonly size?: "md" | "sm";
7
+ }): import("react").JSX.Element;
8
+ export declare function Badge(props: {
9
+ readonly tone?: "neutral" | "accent" | "point" | "success" | "warning" | "danger";
10
+ readonly title?: string;
11
+ readonly children: ReactNode;
12
+ }): import("react").JSX.Element;
13
+ export declare function Callout(props: {
14
+ readonly tone?: "info" | "warning" | "danger";
15
+ readonly title?: string;
16
+ readonly children?: ReactNode;
17
+ readonly action?: ReactNode;
18
+ }): import("react").JSX.Element;
19
+ /**
20
+ * A person's picture as the git host serves it: loaded lazily, without a referrer, and gone as
21
+ * a whole when there is none or it cannot be loaded, leaving the initial of the login instead.
22
+ */
23
+ export declare function Avatar(props: {
24
+ readonly person: RestPerson;
25
+ readonly size?: "sm" | "md" | "lg";
26
+ }): import("react").JSX.Element;
27
+ /** A person, as a picture and a name, wherever one is named. */
28
+ export declare function PersonChip(props: {
29
+ readonly person: RestPerson;
30
+ readonly size?: "sm" | "md";
31
+ }): import("react").JSX.Element;
32
+ /** The words of the vocabulary as people read them. */
33
+ export declare const STATE_LABELS: Readonly<Record<TaskState, string>>;
34
+ export declare const PRIORITY_LABELS: Readonly<Record<TaskPriority, string>>;
35
+ export declare const ROLE_LABELS: Readonly<Record<PersonRole, string>>;
36
+ export declare function RoleBadge(props: {
37
+ readonly role: PersonRole;
38
+ }): import("react").JSX.Element;
39
+ export declare function StateBadge(props: {
40
+ readonly state: TaskState;
41
+ }): import("react").JSX.Element;
42
+ export declare function PriorityBadge(props: {
43
+ readonly priority: TaskPriority;
44
+ }): import("react").JSX.Element | null;
45
+ export declare function Spinner(props: {
46
+ readonly label: string;
47
+ }): import("react").JSX.Element;
48
+ /** Where there is nothing yet, said plainly, with the way to the first thing. */
49
+ export declare function EmptyState(props: {
50
+ readonly title: string;
51
+ readonly body?: string;
52
+ readonly action?: ReactNode;
53
+ }): import("react").JSX.Element;
54
+ /** An instant as people read one: the date, and the time of day. */
55
+ export declare function formatInstant(iso: string): string;
56
+ /** A size in bytes as people read one: `12 B`, `3.4 KB`, `120 MB`. */
57
+ export declare function formatBytes(size: number): string;
58
+ export declare function Time(props: {
59
+ readonly iso: string;
60
+ }): import("react").JSX.Element;
61
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/components/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAKjF,wBAAgB,E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