@jaetask/toolkit 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 jaetask
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,122 @@
1
- # Temporary Holding Version
1
+ # @jaetask/toolkit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ One shell and one page kit for every Kit app, so each app looks and works the same: a light grey sidebar with the app's pages and its projects, warm grey sections with one Edit button each, and edit pages with labelled rows, Back, Cancel and Save.
4
+
5
+ ![The read page: sidebar with the app mark, pages, a Projects group with the selected project open, and Settings at the bottom; on the right, warm grey sections with Edit buttons.](docs/read.png)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @jaetask/toolkit react react-dom
11
+ ```
12
+
13
+ Import the styles once at the app's root, and load Inter (from Google Fonts or `@fontsource-variable/inter`):
14
+
15
+ ```ts
16
+ import "@jaetask/toolkit/styles.css";
17
+ ```
18
+
19
+ ## Use
20
+
21
+ ```tsx
22
+ import {
23
+ AppShell,
24
+ EditLink,
25
+ Panel,
26
+ PageBody,
27
+ StatusDot,
28
+ ListCard,
29
+ ListRow,
30
+ } from "@jaetask/toolkit";
31
+
32
+ <AppShell
33
+ app={{ name: "Tasks" }}
34
+ title="Website · Profile"
35
+ nav={[{ href: "/today", label: "Today", icon: <IconSun size={16} />, current: true }]}
36
+ groups={[
37
+ {
38
+ label: "Projects",
39
+ items: projects.map((p) => ({
40
+ id: p.id,
41
+ href: `/p/${p.id}`,
42
+ label: p.name,
43
+ status: p.status,
44
+ })),
45
+ },
46
+ ]}
47
+ settingsHref="/settings"
48
+ >
49
+ <PageBody title="Profile" line="What this project is and how its tickets are named.">
50
+ <Panel
51
+ id="identity"
52
+ title="Identity"
53
+ line="The name and prefix every ticket carries."
54
+ action={<EditLink to="/p/web/edit/identity" />}
55
+ >
56
+ …
57
+ </Panel>
58
+ </PageBody>
59
+ </AppShell>;
60
+ ```
61
+
62
+ The edit page that Edit opens:
63
+
64
+ ```tsx
65
+ import { EditFrame, Input, Row, useBackTo } from "@jaetask/toolkit";
66
+
67
+ const back = useBackTo("/p/web/profile");
68
+ <EditFrame title="Edit identity" backTo={back} onSave={save}>
69
+ <Row title="Name" line="Shown in the sidebar and on every page." htmlFor="name">
70
+ <Input id="name" value={name} onChange={(e) => setName(e.target.value)} />
71
+ </Row>
72
+ </EditFrame>;
73
+ ```
74
+
75
+ With a router, pass its link component and location once:
76
+
77
+ ```tsx
78
+ <ToolkitProvider link={({ href, ...rest }) => <RouterLink to={href} {...rest} />} location={pathname + search}>
79
+ ```
80
+
81
+ ## What is in it
82
+
83
+ | Component | Use |
84
+ | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
85
+ | `AppShell` | Sidebar (app mark, pages with icons, small-caps groups with status dots, Settings, search, collapse), top bar and page. |
86
+ | `SideSection`, `SideLink` | The sections and links inside the selected group item. |
87
+ | `PageBody` | Page title, one line, the one primary action, then stacked panels. |
88
+ | `Panel` | A section: warm grey, title, one line, at most one action. |
89
+ | `EditLink`, `PageLink`, `PrimaryLink`, `BackLink` | Buttons that open pages; edit links carry `?from=` so the way back returns to the same spot. |
90
+ | `Card`, `Kicker`, `ListCard`, `ListRow`, `EmptyCard`, `Chip` | What goes inside a panel. |
91
+ | `StatusDot`, `Dot` | Grey not started, orange in progress, green done. |
92
+ | `EditFrame`, `Row`, `ChipPicker` | The edit page and its labelled rows. |
93
+ | `Button`, `Input`, `Textarea`, `Select`, `Label`, `ConfirmDelete` | Primitives. `ConfirmDelete` is the only dialog: permanent delete, confirmed by typing the name. |
94
+
95
+ ## The ux-flow skill
96
+
97
+ [skills/ux-flow](skills/ux-flow/SKILL.md) is the rule these components follow. Install it in an app:
98
+
99
+ ```bash
100
+ npx skills add jaetask/toolkit --skill ux-flow
101
+ ```
102
+
103
+ ## toolkit-guard
104
+
105
+ `npx toolkit-guard src` fails when an app hand-builds what the toolkit has:
106
+
107
+ | Rule | Fails when |
108
+ | --------------- | ------------------------------------------------------------------------------------------------------- |
109
+ | `own-kit` | The app defines its own AppShell, Sidebar, Panel, EditFrame, Row, ListRow or another toolkit component. |
110
+ | `no-sheet` | The app imports a sheet or drawer. |
111
+ | `tokens-only` | App code or CSS holds a literal colour instead of a `--tk-` token. |
112
+ | `shell-present` | No file imports `AppShell` from `@jaetask/toolkit`. |
113
+
114
+ A line that must keep a literal ends with the comment `toolkit-guard-allow`.
115
+
116
+ ## Credit
117
+
118
+ The app shell follows the layout of [agent-native](https://github.com/BuilderIO/agent-native) (MIT, Builder.io).
119
+
120
+ ## Licence
121
+
122
+ MIT
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ export type Finding = {
3
+ file: string;
4
+ line: number;
5
+ rule: string;
6
+ message: string;
7
+ };
8
+ /** Every finding in the given directories. */
9
+ export declare function check(dirs: string[], root?: string): Finding[];
package/dist/guard.js ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ // toolkit-guard: fails when an app hand-builds what the toolkit already has.
3
+ // npx toolkit-guard [dir ...] (default: src)
4
+ // A line ending in the comment `toolkit-guard-allow` is skipped, for the rare literal that must stay.
5
+ import { readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
6
+ import { extname, join, relative } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ const KIT = [
9
+ "AppShell",
10
+ "Sidebar",
11
+ "PageBody",
12
+ "Panel",
13
+ "EditFrame",
14
+ "EditLink",
15
+ "Row",
16
+ "ListCard",
17
+ "ListRow",
18
+ "EmptyCard",
19
+ "StatusDot",
20
+ "BackLink",
21
+ "ChipPicker",
22
+ ];
23
+ const CODE = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs"]);
24
+ const STYLE = new Set([".css", ".scss"]);
25
+ const PAGE = new Set([".html"]);
26
+ const SKIP = new Set(["node_modules", "dist", "build", ".git", "coverage"]);
27
+ const ownKit = new RegExp(`\\b(?:function|const|let|class)\\s+(${KIT.join("|")})\\b(?!\\s*=\\s*(?:require|await import))`);
28
+ const sheetImport = /from\s+["'][^"']*(?:sheet|drawer)[^"']*["']|<(?:Sheet|Drawer)[\s>]/i;
29
+ const colour = /(?:^|[\s:("'`,=])(#[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3}(?:[0-9a-fA-F]{2})?)?)\b|\b(?:rgba?|hsla?)\(/;
30
+ const shellImport = /import\s*{[^}]*\bAppShell\b[^}]*}\s*from\s*["']@jaetask\/toolkit["']/s;
31
+ function files(dir) {
32
+ let out = [];
33
+ for (const name of readdirSync(dir)) {
34
+ if (SKIP.has(name))
35
+ continue;
36
+ const path = join(dir, name);
37
+ if (statSync(path).isDirectory())
38
+ out = out.concat(files(path));
39
+ else
40
+ out.push(path);
41
+ }
42
+ return out;
43
+ }
44
+ /** Every finding in the given directories. */
45
+ export function check(dirs, root = process.cwd()) {
46
+ const found = [];
47
+ let shell = false;
48
+ for (const file of dirs.flatMap((d) => files(d))) {
49
+ const ext = extname(file);
50
+ if (!CODE.has(ext) && !STYLE.has(ext) && !PAGE.has(ext))
51
+ continue;
52
+ const text = readFileSync(file, "utf8");
53
+ const rel = relative(root, file);
54
+ if (CODE.has(ext) && shellImport.test(text))
55
+ shell = true;
56
+ text.split("\n").forEach((line, i) => {
57
+ if (line.includes("toolkit-guard-allow"))
58
+ return;
59
+ const at = { file: rel, line: i + 1 };
60
+ if (CODE.has(ext)) {
61
+ const kit = ownKit.exec(line);
62
+ if (kit)
63
+ found.push({
64
+ ...at,
65
+ rule: "own-kit",
66
+ message: `${kit[1]} is a toolkit component: import it from @jaetask/toolkit.`,
67
+ });
68
+ if (sheetImport.test(line))
69
+ found.push({
70
+ ...at,
71
+ rule: "no-sheet",
72
+ message: "Sheets and drawers break ux-flow: open an EditFrame page instead.",
73
+ });
74
+ }
75
+ if ((CODE.has(ext) || STYLE.has(ext)) && colour.test(line))
76
+ found.push({
77
+ ...at,
78
+ rule: "tokens-only",
79
+ message: "Use a toolkit token (var(--tk-…)) instead of a literal colour.",
80
+ });
81
+ });
82
+ }
83
+ if (!shell)
84
+ found.push({
85
+ file: dirs.join(", "),
86
+ line: 0,
87
+ rule: "shell-present",
88
+ message: "No page imports AppShell from @jaetask/toolkit: every app opens in the shell.",
89
+ });
90
+ return found;
91
+ }
92
+ const isMain = !!process.argv[1] &&
93
+ realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
94
+ if (isMain) {
95
+ const dirs = process.argv.slice(2);
96
+ const found = check(dirs.length ? dirs : ["src"]);
97
+ for (const f of found)
98
+ console.error(`${f.file}:${f.line} ${f.rule} ${f.message}`);
99
+ if (found.length) {
100
+ console.error(`toolkit-guard: ${found.length} finding(s).`);
101
+ process.exit(1);
102
+ }
103
+ console.log("toolkit-guard: clean.");
104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M,GACV,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjB,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACjF,IAAI,MAAM,EAAE,CAAC;IACX,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAClD,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACrF,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,kBAAkB,KAAK,CAAC,MAAM,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { type LinkComponent, type LinkProps, Link, safeFrom, ToolkitProvider, useBackTo, useFromHref, withFrom, } from "./link.js";
2
+ export { BackLink, Card, Chip, ChipPicker, Dot, EditFrame, EditLink, EmptyCard, Kicker, ListCard, ListRow, PageBody, PageLink, Panel, PrimaryLink, type Progress, Row, StatusDot, } from "./page.js";
3
+ export { AppShell, Avatar, type Group, type GroupItem, type NavItem, SideLink, SideSection, } from "./shell.js";
4
+ export { Button, type ButtonVariant, ConfirmDelete, cx, Input, Label, Select, type Surface, Textarea, } from "./ui.js";
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { Link, safeFrom, ToolkitProvider, useBackTo, useFromHref, withFrom, } from "./link.js";
2
+ export { BackLink, Card, Chip, ChipPicker, Dot, EditFrame, EditLink, EmptyCard, Kicker, ListCard, ListRow, PageBody, PageLink, Panel, PrimaryLink, Row, StatusDot, } from "./page.js";
3
+ export { AppShell, Avatar, SideLink, SideSection, } from "./shell.js";
4
+ export { Button, ConfirmDelete, cx, Input, Label, Select, Textarea, } from "./ui.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,SAAS,EACT,WAAW,EACX,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,GAAG,EACH,SAAS,EACT,QAAQ,EACR,SAAS,EACT,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,WAAW,EAEX,GAAG,EACH,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,QAAQ,EACR,MAAM,EAIN,QAAQ,EACR,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,MAAM,EAEN,aAAa,EACb,EAAE,EACF,KAAK,EACL,KAAK,EACL,MAAM,EAEN,QAAQ,GACT,MAAM,SAAS,CAAC"}
package/dist/link.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { type AnchorHTMLAttributes, type ReactNode } from "react";
2
+ export type LinkProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & {
3
+ href: string;
4
+ children?: ReactNode;
5
+ };
6
+ export type LinkComponent = (props: LinkProps) => ReactNode;
7
+ /** Gives the toolkit the app's router: its link component and its current location. */
8
+ export declare function ToolkitProvider({ link, location, children, }: {
9
+ link?: LinkComponent;
10
+ location?: string | (() => string);
11
+ children: ReactNode;
12
+ }): import("react").JSX.Element;
13
+ /** The app's link component. */
14
+ export declare function Link(props: LinkProps): import("react").JSX.Element;
15
+ /** `to` with ?from= set to the given location. */
16
+ export declare function withFrom(to: string, from: string): string;
17
+ /** `to` with ?from= set to the current location. */
18
+ export declare function useFromHref(to: string): string;
19
+ /** A ?from= value that is safe to follow: a same-origin path. */
20
+ export declare function safeFrom(from: string | null | undefined): string | null;
21
+ /** Where an edit page's Back goes: the ?from= path when it is safe, else the fallback. */
22
+ export declare function useBackTo(fallback: string): string;
package/dist/link.js ADDED
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Links and the way back. Every link the toolkit draws goes through one Link component, so an app
3
+ // with a router (React Router, TanStack) passes its own, and an app without one gets a plain <a>.
4
+ // Edit links carry ?from= so the edit page's Back, Cancel and Save return to the same spot.
5
+ import { createContext, useContext } from "react";
6
+ const PlainLink = ({ href, children, ...rest }) => (_jsx("a", { href: href, ...rest, children: children }));
7
+ const browserLocation = () => typeof window === "undefined" ? "" : window.location.pathname + window.location.search;
8
+ const RoutingContext = createContext({ link: PlainLink, location: browserLocation });
9
+ /** Gives the toolkit the app's router: its link component and its current location. */
10
+ export function ToolkitProvider({ link, location, children, }) {
11
+ const value = {
12
+ link: link ?? PlainLink,
13
+ location: typeof location === "string" ? () => location : (location ?? browserLocation),
14
+ };
15
+ return _jsx(RoutingContext.Provider, { value: value, children: children });
16
+ }
17
+ /** The app's link component. */
18
+ export function Link(props) {
19
+ const { link: L } = useContext(RoutingContext);
20
+ return _jsx(L, { ...props });
21
+ }
22
+ /** `to` with ?from= set to the given location. */
23
+ export function withFrom(to, from) {
24
+ if (!from)
25
+ return to;
26
+ return `${to}${to.includes("?") ? "&" : "?"}from=${encodeURIComponent(from)}`;
27
+ }
28
+ /** `to` with ?from= set to the current location. */
29
+ export function useFromHref(to) {
30
+ const { location } = useContext(RoutingContext);
31
+ return withFrom(to, location());
32
+ }
33
+ /** A ?from= value that is safe to follow: a same-origin path. */
34
+ export function safeFrom(from) {
35
+ if (!from)
36
+ return null;
37
+ return from.startsWith("/") && !from.startsWith("//") && !from.includes("\\") ? from : null;
38
+ }
39
+ /** Where an edit page's Back goes: the ?from= path when it is safe, else the fallback. */
40
+ export function useBackTo(fallback) {
41
+ const { location } = useContext(RoutingContext);
42
+ const query = location().split("?")[1] ?? "";
43
+ return safeFrom(new URLSearchParams(query).get("from")) ?? fallback;
44
+ }
45
+ //# sourceMappingURL=link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.js","sourceRoot":"","sources":["../src/link.tsx"],"names":[],"mappings":";AAAA,kGAAkG;AAClG,kGAAkG;AAClG,4FAA4F;AAC5F,OAAO,EAA6B,aAAa,EAAkB,UAAU,EAAE,MAAM,OAAO,CAAC;AAe7F,MAAM,SAAS,GAAkB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,CAChE,YAAG,IAAI,EAAE,IAAI,KAAM,IAAI,YACpB,QAAQ,GACP,CACL,CAAC;AAEF,MAAM,eAAe,GAAG,GAAG,EAAE,CAC3B,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;AAEzF,MAAM,cAAc,GAAG,aAAa,CAAU,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC;AAE9F,uFAAuF;AACvF,MAAM,UAAU,eAAe,CAAC,EAC9B,IAAI,EACJ,QAAQ,EACR,QAAQ,GAKT;IACC,MAAM,KAAK,GAAY;QACrB,IAAI,EAAE,IAAI,IAAI,SAAS;QACvB,QAAQ,EAAE,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAA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CAAC;IAChD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,OAAO,QAAQ,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,QAAQ,CAAC;AACtE,CAAC"}
package/dist/page.d.ts ADDED
@@ -0,0 +1,108 @@
1
+ import type { ReactNode } from "react";
2
+ import { type Surface } from "./ui.js";
3
+ /** A page: title, one line, the one primary action on the right, then stacked panels. */
4
+ export declare function PageBody({ title, line, action, children, }: {
5
+ title: string;
6
+ line?: ReactNode;
7
+ action?: ReactNode;
8
+ children: ReactNode;
9
+ }): import("react").JSX.Element;
10
+ /** A section: warm grey panel, title, one line on what it holds, at most one action on the right. */
11
+ export declare function Panel({ id, title, line, action, children, }: {
12
+ id: string;
13
+ title: string;
14
+ line?: ReactNode;
15
+ action?: ReactNode;
16
+ children: ReactNode;
17
+ }): import("react").JSX.Element;
18
+ /** A white card inside a panel. */
19
+ export declare function Card({ children, className }: {
20
+ children: ReactNode;
21
+ className?: string;
22
+ }): import("react").JSX.Element;
23
+ /** A small-caps label above a value inside a card. */
24
+ export declare function Kicker({ children }: {
25
+ children: ReactNode;
26
+ }): import("react").JSX.Element;
27
+ /** A grey button that opens another page and remembers this one as ?from=. */
28
+ export declare function PageLink({ to, children, disabled, surface, }: {
29
+ to: string;
30
+ children: ReactNode;
31
+ disabled?: boolean;
32
+ surface?: Surface;
33
+ }): import("react").JSX.Element;
34
+ /** A panel's one Edit button: opens that section's own edit page. */
35
+ export declare function EditLink({ to, label, disabled, }: {
36
+ to: string;
37
+ label?: string;
38
+ disabled?: boolean;
39
+ }): import("react").JSX.Element;
40
+ /** The page's one dark button. */
41
+ export declare function PrimaryLink({ to, children }: {
42
+ to: string;
43
+ children: ReactNode;
44
+ }): import("react").JSX.Element;
45
+ /** Back to where you came from: the same pill on every page that has one. */
46
+ export declare function BackLink({ to }: {
47
+ to: string;
48
+ }): import("react").JSX.Element;
49
+ /** A list: one white card of divided rows. */
50
+ export declare function ListCard({ children }: {
51
+ children: ReactNode;
52
+ }): import("react").JSX.Element;
53
+ /** One list row. With `to`, the row opens its own page. */
54
+ export declare function ListRow({ to, children, aside, }: {
55
+ to?: string;
56
+ children: ReactNode;
57
+ aside?: ReactNode;
58
+ }): import("react").JSX.Element;
59
+ /** An empty section: a dashed card, one sentence on how to fill it, one button. */
60
+ export declare function EmptyCard({ text, action }: {
61
+ text: string;
62
+ action?: ReactNode;
63
+ }): import("react").JSX.Element;
64
+ export type Progress = "not-started" | "in-progress" | "done";
65
+ /** A bare status dot, for sidebars and tight rows. */
66
+ export declare function Dot({ status }: {
67
+ status: Progress;
68
+ }): import("react").JSX.Element;
69
+ /** Status as a dot and a word: grey not started, orange in progress, green done. Never red. */
70
+ export declare function StatusDot({ status, label }: {
71
+ status: Progress;
72
+ label?: string;
73
+ }): import("react").JSX.Element;
74
+ /** A pill value. */
75
+ export declare function Chip({ children }: {
76
+ children: ReactNode;
77
+ }): import("react").JSX.Element;
78
+ /** Pills to pick one value from, on an edit page. */
79
+ export declare function ChipPicker<T extends string>({ value, options, onChange, label, }: {
80
+ value: T;
81
+ options: {
82
+ id: T;
83
+ name: string;
84
+ }[];
85
+ onChange: (value: T) => void;
86
+ label: string;
87
+ }): import("react").JSX.Element;
88
+ /**
89
+ * One edit page: title and Back, a white card of labelled Rows, then Cancel and Save. Without
90
+ * onSave (changes save as you go) the bar shows Done.
91
+ */
92
+ export declare function EditFrame({ title, line, backTo, children, onSave, busy, saveLabel, extra, }: {
93
+ title: string;
94
+ line?: ReactNode;
95
+ backTo: string;
96
+ children: ReactNode;
97
+ onSave?: () => void;
98
+ busy?: boolean;
99
+ saveLabel?: string;
100
+ extra?: ReactNode;
101
+ }): import("react").JSX.Element;
102
+ /** A labelled row on an edit page: label and one line on the left, the inputs on the right. */
103
+ export declare function Row({ title, line, htmlFor, children, }: {
104
+ title: string;
105
+ line?: string;
106
+ htmlFor?: string;
107
+ children: ReactNode;
108
+ }): import("react").JSX.Element;
package/dist/page.js ADDED
@@ -0,0 +1,90 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Link, useFromHref } from "./link.js";
3
+ import { Button, cx } from "./ui.js";
4
+ /** A page: title, one line, the one primary action on the right, then stacked panels. */
5
+ export function PageBody({ title, line, action, children, }) {
6
+ return (_jsxs("div", { className: "tk-page", children: [_jsxs("div", { className: "tk-page-head", children: [_jsxs("div", { children: [_jsx("h1", { className: "tk-page-title", children: title }), line && _jsx("p", { className: "tk-page-line", children: line })] }), action] }), children] }));
7
+ }
8
+ /** A section: warm grey panel, title, one line on what it holds, at most one action on the right. */
9
+ export function Panel({ id, title, line, action, children, }) {
10
+ return (_jsxs("section", { id: id, "aria-labelledby": `${id}-title`, className: "tk-panel", children: [_jsxs("div", { className: "tk-panel-head", children: [_jsxs("div", { children: [_jsx("h2", { id: `${id}-title`, className: "tk-panel-title", children: title }), line && _jsx("p", { className: "tk-panel-line", children: line })] }), action] }), children] }));
11
+ }
12
+ /** A white card inside a panel. */
13
+ export function Card({ children, className }) {
14
+ return _jsx("div", { className: cx("tk-card", className), children: children });
15
+ }
16
+ /** A small-caps label above a value inside a card. */
17
+ export function Kicker({ children }) {
18
+ return _jsx("span", { className: "tk-kicker", children: children });
19
+ }
20
+ function ButtonLink({ href, variant = "grey", surface = "panel", disabled, children, }) {
21
+ if (disabled)
22
+ return (_jsx(Button, { variant: variant, surface: surface, disabled: true, children: children }));
23
+ return (_jsx(Link, { href: href, className: "tk-button", "data-variant": variant, "data-surface": surface, children: children }));
24
+ }
25
+ /** A grey button that opens another page and remembers this one as ?from=. */
26
+ export function PageLink({ to, children, disabled, surface, }) {
27
+ const href = useFromHref(to);
28
+ return (_jsx(ButtonLink, { href: href, surface: surface ?? "panel", disabled: disabled ?? false, children: children }));
29
+ }
30
+ /** A panel's one Edit button: opens that section's own edit page. */
31
+ export function EditLink({ to, label = "Edit", disabled, }) {
32
+ return (_jsx(PageLink, { to: to, disabled: disabled ?? false, children: label }));
33
+ }
34
+ /** The page's one dark button. */
35
+ export function PrimaryLink({ to, children }) {
36
+ const href = useFromHref(to);
37
+ return (_jsx(ButtonLink, { href: href, variant: "primary", children: children }));
38
+ }
39
+ /** Back to where you came from: the same pill on every page that has one. */
40
+ export function BackLink({ to }) {
41
+ return (_jsx(ButtonLink, { href: to, surface: "white", children: "Back" }));
42
+ }
43
+ /** A list: one white card of divided rows. */
44
+ export function ListCard({ children }) {
45
+ return _jsx("ul", { className: "tk-list", children: children });
46
+ }
47
+ /** One list row. With `to`, the row opens its own page. */
48
+ export function ListRow({ to, children, aside, }) {
49
+ const href = useFromHref(to ?? "");
50
+ return (_jsxs("li", { className: "tk-list-row", children: [to ? (_jsx(Link, { href: href, className: "tk-list-body", children: children })) : (_jsx("span", { className: "tk-list-body", children: children })), aside && _jsx("span", { className: "tk-list-aside", children: aside })] }));
51
+ }
52
+ /** An empty section: a dashed card, one sentence on how to fill it, one button. */
53
+ export function EmptyCard({ text, action }) {
54
+ return (_jsxs("div", { className: "tk-empty", children: [_jsx("p", { children: text }), action] }));
55
+ }
56
+ const WORD = {
57
+ "not-started": "Not started",
58
+ "in-progress": "In progress",
59
+ done: "Done",
60
+ };
61
+ /** A bare status dot, for sidebars and tight rows. */
62
+ export function Dot({ status }) {
63
+ return _jsx("span", { "aria-hidden": true, className: "tk-dot", "data-status": status });
64
+ }
65
+ /** Status as a dot and a word: grey not started, orange in progress, green done. Never red. */
66
+ export function StatusDot({ status, label }) {
67
+ return (_jsxs("span", { className: "tk-status", children: [_jsx(Dot, { status: status }), label ?? WORD[status]] }));
68
+ }
69
+ /** A pill value. */
70
+ export function Chip({ children }) {
71
+ return _jsx("span", { className: "tk-chip", children: children });
72
+ }
73
+ /** Pills to pick one value from, on an edit page. */
74
+ export function ChipPicker({ value, options, onChange, label, }) {
75
+ return (_jsx("div", { role: "radiogroup", "aria-label": label, className: "tk-chips", children: options.map((o) => (
76
+ // biome-ignore lint/a11y/useSemanticElements: pills styled as buttons, with radio semantics
77
+ _jsx("button", { type: "button", role: "radio", "aria-checked": value === o.id, className: "tk-pick", onClick: () => onChange(o.id), children: o.name }, o.id))) }));
78
+ }
79
+ /**
80
+ * One edit page: title and Back, a white card of labelled Rows, then Cancel and Save. Without
81
+ * onSave (changes save as you go) the bar shows Done.
82
+ */
83
+ export function EditFrame({ title, line, backTo, children, onSave, busy, saveLabel = "Save", extra, }) {
84
+ return (_jsxs("div", { className: "tk-edit", children: [_jsxs("div", { className: "tk-page-head", children: [_jsxs("div", { children: [_jsx("h1", { className: "tk-page-title", children: title }), line && _jsx("p", { className: "tk-page-line", children: line })] }), _jsx(BackLink, { to: backTo })] }), _jsx("div", { className: "tk-edit-card", children: children }), _jsxs("div", { className: "tk-edit-bar", children: [extra && _jsx("span", { className: "tk-edit-extra", children: extra }), onSave ? (_jsxs(_Fragment, { children: [_jsx(ButtonLink, { href: backTo, surface: "white", children: "Cancel" }), _jsx(Button, { variant: "primary", disabled: busy ?? false, onClick: onSave, children: busy ? "Saving…" : saveLabel })] })) : (_jsx(ButtonLink, { href: backTo, variant: "primary", children: "Done" }))] })] }));
85
+ }
86
+ /** A labelled row on an edit page: label and one line on the left, the inputs on the right. */
87
+ export function Row({ title, line, htmlFor, children, }) {
88
+ return (_jsxs("div", { className: "tk-row", children: [_jsxs("div", { className: "tk-row-label", children: [htmlFor ? (_jsx("label", { htmlFor: htmlFor, className: "tk-row-title", children: title })) : (_jsx("span", { className: "tk-row-title", children: title })), line && _jsx("span", { className: "tk-row-line", children: line })] }), _jsx("div", { className: "tk-row-fields", children: children })] }));
89
+ }
90
+ //# sourceMappingURL=page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.js","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,W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AAK,SAAS,EAAC,cAAc,YAAE,QAAQ,GAAO,EAC9C,eAAK,SAAS,EAAC,aAAa,aACzB,KAAK,IAAI,eAAM,SAAS,EAAC,eAAe,YAAE,KAAK,GAAQ,EACvD,MAAM,CAAC,CAAC,CAAC,CACR,8BACE,KAAC,UAAU,IAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAC,OAAO,uBAE5B,EACb,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,QAAQ,EAAE,IAAI,IAAI,KAAK,EAAE,OAAO,EAAE,MAAM,YAC/D,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,GACtB,IACR,CACJ,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,IAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAC,SAAS,qBAE9B,CACd,IACG,IACF,CACP,CAAC;AACJ,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,GAAG,CAAC,EAClB,KAAK,EACL,IAAI,EACJ,OAAO,EACP,QAAQ,GAMT;IACC,OAAO,CACL,eAAK,SAAS,EAAC,QAAQ,aACrB,eAAK,SAAS,EAAC,cAAc,aAC1B,OAAO,CAAC,CAAC,CAAC,CACT,gBAAO,OAAO,EAAE,OAAO,EAAE,SAAS,EAAC,cAAc,YAC9C,KAAK,GACA,CACT,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,cAAc,YAAE,KAAK,GAAQ,CAC9C,EACA,IAAI,IAAI,eAAM,SAAS,EAAC,aAAa,YAAE,IAAI,GAAQ,IAChD,EACN,cAAK,SAAS,EAAC,eAAe,YAAE,QAAQ,GAAO,IAC3C,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { type ReactNode } from "react";
2
+ import { type Progress } from "./page.js";
3
+ export type NavItem = {
4
+ href: string;
5
+ label: string;
6
+ /** A 16px line icon (for example from @tabler/icons-react). */
7
+ icon?: ReactNode;
8
+ current?: boolean;
9
+ };
10
+ export type GroupItem = {
11
+ id: string;
12
+ href: string;
13
+ label: string;
14
+ /** An image or Avatar. */
15
+ avatar?: ReactNode;
16
+ status?: Progress;
17
+ /** The selected item opens into a warm grey block holding these sections. */
18
+ open?: ReactNode;
19
+ onSelect?: () => void;
20
+ };
21
+ export type Group = {
22
+ label: string;
23
+ /** Where the group label links, for example the list of all projects. */
24
+ href?: string;
25
+ items: GroupItem[];
26
+ /** Shown when the group has no items: one line on how to add the first. */
27
+ empty?: ReactNode;
28
+ };
29
+ /** A round avatar: an image, or the first letter on a colour. */
30
+ export declare function Avatar({ name, src, colour }: {
31
+ name: string;
32
+ src?: string;
33
+ colour?: string;
34
+ }): import("react").JSX.Element;
35
+ /** A small-caps label and its links, inside the selected group item. */
36
+ export declare function SideSection({ label, children }: {
37
+ label: string;
38
+ children: ReactNode;
39
+ }): import("react").JSX.Element;
40
+ /** A link inside the selected group item, with an optional line and status dot. */
41
+ export declare function SideLink({ href, label, line, status, current, }: {
42
+ href: string;
43
+ label: string;
44
+ line?: string;
45
+ status?: Progress;
46
+ current?: boolean;
47
+ }): import("react").JSX.Element;
48
+ /** The frame every Kit app opens in. */
49
+ export declare function AppShell({ app, nav, groups, settingsHref, onSearch, title, topAside, collapsed: collapsedProp, onCollapsedChange, children, }: {
50
+ app: {
51
+ name: string;
52
+ href?: string;
53
+ mark?: ReactNode;
54
+ };
55
+ nav: NavItem[];
56
+ groups?: Group[];
57
+ settingsHref?: string;
58
+ onSearch?: () => void;
59
+ /** Where you are, shown in the top bar before the app name. */
60
+ title?: ReactNode;
61
+ /** Controls on the right of the top bar, for example the chat panel toggle. */
62
+ topAside?: ReactNode;
63
+ collapsed?: boolean;
64
+ onCollapsedChange?: (collapsed: boolean) => void;
65
+ children: ReactNode;
66
+ }): import("react").JSX.Element;