@jaetask/toolkit 0.3.1 → 0.3.6

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 (118) hide show
  1. package/CHANGELOG.md +37 -1
  2. package/README.md +12 -10
  3. package/dist/guard.d.ts +1 -1
  4. package/dist/guard.d.ts.map +1 -1
  5. package/dist/guard.js +17 -6
  6. package/dist/guard.js.map +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +0 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/styles.css +0 -11
  11. package/dist/suite/chat.d.ts +65 -0
  12. package/dist/suite/chat.d.ts.map +1 -0
  13. package/dist/suite/chat.js +103 -0
  14. package/dist/suite/chat.js.map +1 -0
  15. package/dist/suite/controls.d.ts +0 -1
  16. package/dist/suite/controls.d.ts.map +1 -1
  17. package/dist/suite/controls.js +0 -2
  18. package/dist/suite/controls.js.map +1 -1
  19. package/dist/suite/due-picker.d.ts +0 -9
  20. package/dist/suite/due-picker.d.ts.map +1 -1
  21. package/dist/suite/due-picker.js +0 -8
  22. package/dist/suite/due-picker.js.map +1 -1
  23. package/dist/suite/due.d.ts +0 -2
  24. package/dist/suite/due.d.ts.map +1 -1
  25. package/dist/suite/due.js +0 -9
  26. package/dist/suite/due.js.map +1 -1
  27. package/dist/suite/emoji.d.ts +0 -7
  28. package/dist/suite/emoji.d.ts.map +1 -1
  29. package/dist/suite/emoji.js +0 -7
  30. package/dist/suite/emoji.js.map +1 -1
  31. package/dist/suite/entity-nav.d.ts +37 -0
  32. package/dist/suite/entity-nav.d.ts.map +1 -0
  33. package/dist/suite/entity-nav.js +125 -0
  34. package/dist/suite/entity-nav.js.map +1 -0
  35. package/dist/suite/files.d.ts +0 -8
  36. package/dist/suite/files.d.ts.map +1 -1
  37. package/dist/suite/files.js +0 -8
  38. package/dist/suite/files.js.map +1 -1
  39. package/dist/suite/filters.d.ts +18 -0
  40. package/dist/suite/filters.d.ts.map +1 -0
  41. package/dist/suite/filters.js +23 -0
  42. package/dist/suite/filters.js.map +1 -0
  43. package/dist/suite/forms.d.ts +0 -3
  44. package/dist/suite/forms.d.ts.map +1 -1
  45. package/dist/suite/forms.js +7 -7
  46. package/dist/suite/forms.js.map +1 -1
  47. package/dist/suite/index.d.ts +5 -1
  48. package/dist/suite/index.d.ts.map +1 -1
  49. package/dist/suite/index.js +5 -3
  50. package/dist/suite/index.js.map +1 -1
  51. package/dist/suite/link.d.ts +0 -6
  52. package/dist/suite/link.d.ts.map +1 -1
  53. package/dist/suite/link.js +0 -9
  54. package/dist/suite/link.js.map +1 -1
  55. package/dist/suite/links.d.ts +0 -9
  56. package/dist/suite/links.d.ts.map +1 -1
  57. package/dist/suite/links.js +0 -9
  58. package/dist/suite/links.js.map +1 -1
  59. package/dist/suite/markdown.d.ts +0 -1
  60. package/dist/suite/markdown.d.ts.map +1 -1
  61. package/dist/suite/markdown.js +1 -8
  62. package/dist/suite/markdown.js.map +1 -1
  63. package/dist/suite/page.d.ts +0 -23
  64. package/dist/suite/page.d.ts.map +1 -1
  65. package/dist/suite/page.js +0 -23
  66. package/dist/suite/page.js.map +1 -1
  67. package/dist/suite/parts.d.ts +0 -14
  68. package/dist/suite/parts.d.ts.map +1 -1
  69. package/dist/suite/parts.js +0 -16
  70. package/dist/suite/parts.js.map +1 -1
  71. package/dist/suite/pickers.d.ts +0 -10
  72. package/dist/suite/pickers.d.ts.map +1 -1
  73. package/dist/suite/pickers.js +1 -13
  74. package/dist/suite/pickers.js.map +1 -1
  75. package/dist/suite/project-appearance.d.ts.map +1 -1
  76. package/dist/suite/project-appearance.js +0 -1
  77. package/dist/suite/project-appearance.js.map +1 -1
  78. package/dist/suite/project-icon.d.ts +4 -5
  79. package/dist/suite/project-icon.d.ts.map +1 -1
  80. package/dist/suite/project-icon.js +2 -9
  81. package/dist/suite/project-icon.js.map +1 -1
  82. package/dist/suite/shell.d.ts +4 -27
  83. package/dist/suite/shell.d.ts.map +1 -1
  84. package/dist/suite/shell.js +63 -11
  85. package/dist/suite/shell.js.map +1 -1
  86. package/dist/suite/suite.css +375 -40
  87. package/dist/suite/views.d.ts +0 -7
  88. package/dist/suite/views.d.ts.map +1 -1
  89. package/dist/suite/views.js +1 -8
  90. package/dist/suite/views.js.map +1 -1
  91. package/dist/suite/work.d.ts +100 -0
  92. package/dist/suite/work.d.ts.map +1 -0
  93. package/dist/suite/work.js +160 -0
  94. package/dist/suite/work.js.map +1 -0
  95. package/dist/theme/suite-theme.css +0 -8
  96. package/package.json +2 -2
  97. package/skills/ux-flow/SKILL.md +12 -6
  98. package/dist/fonts/OFL.txt +0 -93
  99. package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
  100. package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
  101. package/dist/forms.d.ts +0 -70
  102. package/dist/forms.js +0 -56
  103. package/dist/forms.js.map +0 -1
  104. package/dist/link.d.ts +0 -22
  105. package/dist/link.js +0 -45
  106. package/dist/link.js.map +0 -1
  107. package/dist/page.d.ts +0 -122
  108. package/dist/page.js +0 -108
  109. package/dist/page.js.map +0 -1
  110. package/dist/parts.d.ts +0 -83
  111. package/dist/parts.js +0 -78
  112. package/dist/parts.js.map +0 -1
  113. package/dist/shell.d.ts +0 -85
  114. package/dist/shell.js +0 -143
  115. package/dist/shell.js.map +0 -1
  116. package/dist/ui.d.ts +0 -26
  117. package/dist/ui.js +0 -37
  118. package/dist/ui.js.map +0 -1
@@ -0,0 +1,100 @@
1
+ import { type ReactNode } from "react";
2
+ export declare function WorkPage({ title, icon, help, action, wide, children, }: {
3
+ title: string;
4
+ icon?: ReactNode;
5
+ help?: ReactNode;
6
+ action?: ReactNode;
7
+ wide?: boolean;
8
+ children: ReactNode;
9
+ }): import("react").JSX.Element;
10
+ export declare function PageSection({ id, title, count, onAdd, addLabel, aside, defaultOpen, children, }: {
11
+ id?: string;
12
+ title: string;
13
+ count?: ReactNode;
14
+ onAdd?: () => void;
15
+ addLabel?: string;
16
+ aside?: ReactNode;
17
+ defaultOpen?: boolean;
18
+ children: ReactNode;
19
+ }): import("react").JSX.Element;
20
+ export declare function EmptyLine({ children }: {
21
+ children: ReactNode;
22
+ }): import("react").JSX.Element;
23
+ export declare function InlineText({ value, label, onSave, disabled, editing, onEditingChange, maxLength, className, }: {
24
+ value: string;
25
+ label: string;
26
+ onSave: (value: string) => void;
27
+ disabled?: boolean;
28
+ editing?: boolean;
29
+ onEditingChange?: (editing: boolean) => void;
30
+ maxLength?: number;
31
+ className?: string;
32
+ }): import("react").JSX.Element;
33
+ export type MenuEntry = {
34
+ label: string;
35
+ onSelect: () => void;
36
+ disabled?: boolean;
37
+ hint?: string;
38
+ icon?: ReactNode;
39
+ } | {
40
+ label: string;
41
+ items: MenuEntry[];
42
+ disabled?: boolean;
43
+ } | {
44
+ label: string;
45
+ content: ReactNode;
46
+ } | "line";
47
+ export declare function RowMenu({ label, items, quiet, align, }: {
48
+ label: string;
49
+ items: MenuEntry[];
50
+ quiet?: boolean;
51
+ align?: "start" | "end";
52
+ }): import("react").JSX.Element;
53
+ export declare function FormDialog({ open, onOpenChange, title, line, saveLabel, onSave, extra, wide, children, }: {
54
+ open: boolean;
55
+ onOpenChange: (open: boolean) => void;
56
+ title: string;
57
+ line?: ReactNode;
58
+ saveLabel?: string;
59
+ onSave: () => boolean | Promise<boolean>;
60
+ extra?: ReactNode;
61
+ wide?: boolean;
62
+ children: ReactNode;
63
+ }): import("react").JSX.Element;
64
+ export declare function Field({ label, hint, htmlFor, children, }: {
65
+ label: string;
66
+ hint?: ReactNode;
67
+ htmlFor?: string;
68
+ children: ReactNode;
69
+ }): import("react").JSX.Element;
70
+ export declare function IconAvatar({ name, icon, colour, size, }: {
71
+ name: string;
72
+ icon?: string;
73
+ colour?: string;
74
+ size?: number;
75
+ }): import("react").JSX.Element;
76
+ export declare function ago(at: string | number | Date, now?: number): string;
77
+ export declare function TimeAgo({ at, prefix }: {
78
+ at: string;
79
+ prefix?: string;
80
+ }): import("react").JSX.Element;
81
+ export declare function IconAction({ label, icon, primary, onClick, href, }: {
82
+ label: string;
83
+ icon: ReactNode;
84
+ primary?: boolean;
85
+ onClick?: () => void;
86
+ href?: string;
87
+ }): import("react").JSX.Element;
88
+ export declare function PageControls({ children }: {
89
+ children: ReactNode;
90
+ }): import("react").JSX.Element;
91
+ export declare function PageGroups({ children }: {
92
+ children: ReactNode;
93
+ }): import("react").JSX.Element;
94
+ export declare function PageGroup({ title, icon, count, children, }: {
95
+ title: string;
96
+ icon?: ReactNode;
97
+ count?: ReactNode;
98
+ children?: ReactNode;
99
+ }): import("react").JSX.Element;
100
+ //# sourceMappingURL=work.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"work.d.ts","sourceRoot":"","sources":["../../src/suite/work.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AA6BpE,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;CACrB,+BA8BA;AAED,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,KAAK,EACL,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EACL,WAAkB,EAClB,QAAQ,GACT,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CA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AM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,+BAWtE;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,OAAO,EACP,OAAO,EACP,IAAI,GACL,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,+BAyBA;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAEjE;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAE/D;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,+BAWA"}
@@ -0,0 +1,160 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { IconChevronRight, IconDots, IconHelpCircle, IconPlus } from "@tabler/icons-react";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { Button } from "../ui/button.js";
5
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../ui/collapsible.js";
6
+ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "../ui/dialog.js";
7
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "../ui/dropdown-menu.js";
8
+ import { Input } from "../ui/input.js";
9
+ import { Label } from "../ui/label.js";
10
+ import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover.js";
11
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip.js";
12
+ import { Link } from "./link.js";
13
+ import { DEFAULT_PROJECT_COLOUR, PROJECT_ICONS } from "./project-appearance.js";
14
+ import { ProjectIcon } from "./project-icon.js";
15
+ export function WorkPage({ title, icon, help, action, wide, children, }) {
16
+ return (_jsxs("div", { className: "tk-page tk-work", "data-wide": wide ? "true" : undefined, children: [_jsxs("div", { className: "tk-work-head", children: [_jsxs("div", { className: "tk-work-title-row", children: [icon, _jsx("h1", { className: "tk-work-title", children: title }), help && (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": `About ${title}`, className: "text-muted-foreground [&_svg]:size-4", children: _jsx(IconHelpCircle, { "aria-hidden": true }) }) }), _jsx(PopoverContent, { align: "start", className: "w-80 text-sm text-muted-foreground", children: help })] }))] }), action && _jsx("div", { className: "tk-work-actions", children: action })] }), children] }));
17
+ }
18
+ export function PageSection({ id, title, count, onAdd, addLabel, aside, defaultOpen = true, children, }) {
19
+ return (_jsx(Collapsible, { asChild: true, defaultOpen: defaultOpen, children: _jsxs("section", { id: id, "aria-label": title, className: "tk-section", children: [_jsxs("div", { className: "tk-section-head", children: [_jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "tk-section-title group/section", children: [_jsx(IconChevronRight, { size: 14, "aria-hidden": true, className: "transition-transform group-data-[state=open]/section:rotate-90" }), title, count !== undefined && count !== "" && (_jsx("span", { className: "tk-section-count", children: count }))] }) }), _jsxs("span", { className: "flex items-center gap-1", children: [aside, onAdd && (_jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": addLabel ?? `Add to ${title}`, className: "text-muted-foreground", onClick: onAdd, children: _jsx(IconPlus, { "aria-hidden": true }) }))] })] }), _jsx(CollapsibleContent, { className: "grid gap-1", children: children })] }) }));
20
+ }
21
+ export function EmptyLine({ children }) {
22
+ return _jsx("p", { className: "tk-empty-line", children: children });
23
+ }
24
+ export function InlineText({ value, label, onSave, disabled, editing, onEditingChange, maxLength = 60, className, }) {
25
+ const [own, setOwn] = useState(false);
26
+ const on = editing ?? own;
27
+ const set = (next) => {
28
+ setOwn(next);
29
+ onEditingChange?.(next);
30
+ };
31
+ if (on && !disabled)
32
+ return (_jsx(Input, { autoFocus: true, "aria-label": label, className: `h-7 min-w-0 flex-1 ${className ?? ""}`, maxLength: maxLength, defaultValue: value, onFocus: (e) => e.currentTarget.select(), onKeyDown: (e) => {
33
+ if (e.key === "Enter")
34
+ e.currentTarget.blur();
35
+ if (e.key === "Escape") {
36
+ e.stopPropagation();
37
+ e.currentTarget.value = value;
38
+ e.currentTarget.blur();
39
+ }
40
+ }, onBlur: (e) => {
41
+ const wanted = e.currentTarget.value.trim();
42
+ set(false);
43
+ if (wanted && wanted !== value)
44
+ onSave(wanted);
45
+ } }));
46
+ return (_jsx(Button, { variant: "ghost", disabled: disabled ?? false, title: disabled ? undefined : "Click to rename", className: `h-auto min-w-0 cursor-text justify-start truncate p-0 text-left hover:bg-transparent disabled:opacity-100 ${className ?? ""}`, onClick: () => set(true), children: value }));
47
+ }
48
+ function Entries({ items }) {
49
+ return (_jsx(_Fragment, { children: items.map((item, i) => {
50
+ // biome-ignore lint/suspicious/noArrayIndexKey: a menu's lines never reorder
51
+ if (item === "line")
52
+ return _jsx(DropdownMenuSeparator, {}, i);
53
+ if ("items" in item || "content" in item)
54
+ return (_jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { disabled: ("disabled" in item && item.disabled) ?? false, children: item.label }), _jsx(DropdownMenuSubContent, { children: "items" in item ? (_jsx(Entries, { items: item.items })) : (_jsx("div", { className: "p-2", children: item.content })) })] }, item.label));
55
+ return (_jsxs(DropdownMenuItem, { disabled: item.disabled ?? false, onSelect: item.onSelect, className: item.icon ? "gap-2" : undefined, children: [item.icon, item.label, item.hint && (_jsx("span", { className: "ml-auto pl-4 text-xs text-muted-foreground", children: item.hint }))] }, item.label));
56
+ }) }));
57
+ }
58
+ export function RowMenu({ label, items, quiet, align = "end", }) {
59
+ const after = useRef(null);
60
+ const later = (entries) => entries.map((e) => e === "line" || "content" in e
61
+ ? e
62
+ : "items" in e
63
+ ? { ...e, items: later(e.items) }
64
+ : {
65
+ ...e,
66
+ onSelect: () => {
67
+ const run = e.onSelect;
68
+ after.current = run;
69
+ setTimeout(() => {
70
+ if (after.current !== run)
71
+ return;
72
+ after.current = null;
73
+ run();
74
+ }, 400);
75
+ },
76
+ });
77
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": label, className: `text-muted-foreground ${quiet ? "opacity-0 focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100" : ""}`, children: _jsx(IconDots, { "aria-hidden": true }) }) }), _jsx(DropdownMenuContent, { align: align, onCloseAutoFocus: (e) => {
78
+ const run = after.current;
79
+ after.current = null;
80
+ if (!run)
81
+ return;
82
+ e.preventDefault();
83
+ run();
84
+ }, children: _jsx(Entries, { items: later(items) }) })] }));
85
+ }
86
+ export function FormDialog({ open, onOpenChange, title, line, saveLabel = "Save", onSave, extra, wide, children, }) {
87
+ const [busy, setBusy] = useState(false);
88
+ const save = async () => {
89
+ if (busy)
90
+ return;
91
+ setBusy(true);
92
+ try {
93
+ if (await onSave())
94
+ onOpenChange(false);
95
+ }
96
+ finally {
97
+ setBusy(false);
98
+ }
99
+ };
100
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: open && (_jsx(DialogContent, { motion: "instant", className: `inset-0 m-auto h-fit translate-none ${wide ? "w-[min(44rem,95vw)] max-w-none" : "max-w-md"}`, children: _jsxs("form", { className: "grid min-w-0 gap-4", onSubmit: (e) => {
101
+ e.preventDefault();
102
+ e.stopPropagation();
103
+ void save();
104
+ }, onKeyDown: (e) => {
105
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
106
+ e.preventDefault();
107
+ void save();
108
+ }
109
+ }, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: title }), line ? (_jsx(DialogDescription, { children: line })) : (_jsx(DialogDescription, { className: "sr-only", children: title }))] }), children, _jsxs(DialogFooter, { className: "items-center", children: [extra && _jsx("span", { className: "mr-auto flex items-center gap-2", children: extra }), _jsx(Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }), _jsx(Button, { type: "submit", disabled: busy, children: saveLabel })] })] }) })) }));
110
+ }
111
+ export function Field({ label, hint, htmlFor, children, }) {
112
+ return (_jsxs("div", { className: "grid min-w-0 gap-1.5", children: [htmlFor ? (_jsx(Label, { htmlFor: htmlFor, className: "text-xs font-medium text-muted-foreground", children: label })) : (_jsx("span", { className: "text-xs font-medium text-muted-foreground", children: label })), children, hint && _jsx("span", { className: "text-xs text-muted-foreground", children: hint })] }));
113
+ }
114
+ export function IconAvatar({ name, icon, colour, size = 24, }) {
115
+ const named = !!icon && PROJECT_ICONS.includes(icon);
116
+ return (_jsx("span", { "aria-hidden": true, className: "tk-icon-avatar", style: { width: size, height: size, fontSize: Math.round(size * 0.46) }, children: named ? (_jsx(ProjectIcon, { projectIcon: icon, iconColour: colour || DEFAULT_PROJECT_COLOUR, size: Math.round(size * 0.62) })) : (icon || (name.trim()[0] ?? "?").toUpperCase()) }));
117
+ }
118
+ export function ago(at, now = Date.now()) {
119
+ const minutes = Math.max(0, Math.floor((now - new Date(at).getTime()) / 60_000));
120
+ if (minutes < 1)
121
+ return "now";
122
+ if (minutes < 60)
123
+ return `${minutes}m ago`;
124
+ const hours = Math.floor(minutes / 60);
125
+ if (hours < 24)
126
+ return `${hours}h ago`;
127
+ const days = Math.floor(hours / 24);
128
+ if (days < 7)
129
+ return `${days}d ago`;
130
+ if (days < 365)
131
+ return `${Math.floor(days / 7)}w ago`;
132
+ return `${Math.floor(days / 365)}y ago`;
133
+ }
134
+ export function TimeAgo({ at, prefix }) {
135
+ const [, tick] = useState(0);
136
+ useEffect(() => {
137
+ const timer = setInterval(() => tick((n) => n + 1), 60_000);
138
+ return () => clearInterval(timer);
139
+ }, []);
140
+ return (_jsx("time", { dateTime: at, title: new Date(at).toLocaleString(), children: prefix ? `${prefix} ${ago(at)}` : ago(at) }));
141
+ }
142
+ export function IconAction({ label, icon, primary, onClick, href, }) {
143
+ const look = {
144
+ variant: primary ? "default" : "outline",
145
+ size: "icon-sm",
146
+ "aria-label": label,
147
+ className: primary ? "[&_svg]:size-4" : "text-muted-foreground [&_svg]:size-4",
148
+ };
149
+ return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: href ? (_jsx(Button, { asChild: true, ...look, children: _jsx(Link, { href: href, children: icon }) })) : (_jsx(Button, { ...look, onClick: onClick, children: icon })) }), _jsx(TooltipContent, { children: label })] }) }));
150
+ }
151
+ export function PageControls({ children }) {
152
+ return _jsx("div", { className: "tk-controls", children: children });
153
+ }
154
+ export function PageGroups({ children }) {
155
+ return _jsx("div", { className: "tk-groups", children: children });
156
+ }
157
+ export function PageGroup({ title, icon, count, children, }) {
158
+ return (_jsxs("section", { "aria-label": title, className: "tk-group-list", children: [_jsxs("h2", { className: "tk-group-list-head", children: [icon, title, count !== undefined && _jsx("span", { className: "tk-group-list-count", children: count })] }), children] }));
159
+ }
160
+ //# sourceMappingURL=work.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"work.js","sourceRoot":"","sources":["../../src/suite/work.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,iBA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GAAO,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EACxB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,GAMT;IACC,OAAO,CACL,iCAAqB,KAAK,EAAE,SAAS,EAAC,eAAe,aACnD,cAAI,SAAS,EAAC,oBAAoB,aAC/B,IAAI,EACJ,KAAK,EACL,KAAK,KAAK,SAAS,IAAI,eAAM,SAAS,EAAC,qBAAqB,YAAE,KAAK,GAAQ,IACzE,EACJ,QAAQ,IACD,CACX,CAAC;AACJ,CAAC"}
@@ -1,7 +1,4 @@
1
- /* The suite's look, as the theme variables the ui parts read (the values the Marketing app uses).
2
- Light on :root, dark under .dark. An app can override any of them after importing styles.css. */
3
1
  :root {
4
- /* The page is a very light grey, so white cards and threads stand out on it. */
5
2
  --background: 0 0% 97.6%;
6
3
  --foreground: 0 0% 10%;
7
4
  --card: 0 0% 100%;
@@ -22,7 +19,6 @@
22
19
  --input: 0 0% 90%;
23
20
  --ring: 0 0% 40%;
24
21
  --radius: 0.5rem;
25
- /* The sidebar is a step greyer than the page. */
26
22
  --sidebar-background: 0 0% 95.3%;
27
23
  --sidebar-foreground: 0 0% 45%;
28
24
  --sidebar-primary: 0 0% 15%;
@@ -79,10 +75,6 @@
79
75
  }
80
76
  }
81
77
 
82
- /*
83
- * No focus rings. The ported parts ask for a ring with Tailwind's ring and outline classes; the
84
- * suite's look draws none, on any part. A focused field shows a darker border in its place.
85
- */
86
78
  :focus,
87
79
  :focus-visible {
88
80
  outline: none !important;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaetask/toolkit",
3
- "version": "0.3.1",
3
+ "version": "0.3.6",
4
4
  "description": "The agent-native toolkit's ui parts, ported with the suite's look, plus the suite's app shell and page kit.",
5
5
  "keywords": [
6
6
  "react",
@@ -101,7 +101,7 @@
101
101
  "scripts": {
102
102
  "build": "tsc -p tsconfig.build.json && node scripts/finalize-build.mjs && chmod +x dist/guard.js",
103
103
  "typecheck": "tsc --noEmit",
104
- "lint": "biome lint . && node scripts/check-scrub.mjs",
104
+ "lint": "biome lint . && node scripts/check-scrub.mjs && node .agents/guardrails/check-comments.mjs",
105
105
  "format": "biome format --write .",
106
106
  "format:check": "biome format .",
107
107
  "test": "tsx --test src/*.test.ts src/suite/*.test.tsx",
@@ -11,15 +11,21 @@ description: Show and edit an app's data the same way on every page, so users kn
11
11
  Every Kit app feels the same. The user reads, edits, and lands back where they were.
12
12
 
13
13
  - **Read page.** Sections stacked at one width. Each has a title, one line on what it holds, and its data, read-only. A list row opens its own page.
14
- - **Edit.** One button per section. It opens that section's own edit page and carries the way back (`?from=`).
15
- - **Edit page.** The read page's width and frame. Back at the top. Labelled rows: label and one line on the left, input on the right. Cancel and Save at the bottom; both return to the same spot.
14
+ - **Working page.** A page people work on all day (a board, a list, settings) uses `WorkPage`: one small title, what the page is for behind "?", its actions on the right, and its lists straight on the page. A section is a `PageSection`: a small grey heading that folds, a count, a "+".
15
+ - **Edit in place.** On a working page a name is changed where it is shown (`InlineText`): click, type, Enter saves, Escape cancels. Everything else that can be done to a row is in its "..." (`RowMenu`).
16
+ - **A short form is a dialog.** Making something new, or changing several fields at once, opens a `FormDialog` in the centre: fields, Cancel, one button that saves.
17
+ - **White space is the hierarchy.** A working page has three bands: the title, its controls (`PageControls`: search, filter, ticks, tabs), then the content. The gap grows down the page: title to controls 24px, controls to content 32px, group to group 28px (`PageGroups`, `PageGroup`), a group's heading to its list 10px. Never the same gap everywhere, and no band pressed against the next.
18
+ - **Room around things.** Nothing touches an edge. Text in a box that can show a border has at least 12px of padding inside it; a box that must line up with text around it gets the padding and a matching negative margin. A dialog's content sits 24px from its edge, and a handle or icon that appears beside text has space on both sides. When in doubt, more space.
19
+ - **Icons, not words.** A page's actions are icon buttons (`IconAction`): the icon shows, its name is the tooltip and the label. Words stay where no icon says it, and on the one button that saves a form.
20
+ - **List or board.** Where the same things can be shown as a list or as a board, one toggle at the top of the Display popover switches between them, and the page remembers the choice.
21
+ - **Edit page.** A long form keeps its own page: the read page's width and frame, Back at the top, labelled rows, Cancel and Save at the bottom; both return to the same spot (`?from=`).
16
22
  - **One home per field.** Each value is edited on exactly one page.
17
- - **One way in.** Every edit takes this trip.
23
+ - **One way in.** A value is changed the same way wherever it shows.
18
24
  - **One sidebar per side.** We do not want multiple sidebars on the same page. If you load one sidebar and then another, we don't want content being hidden by multiple sidebars. For example, when the agent chat is docked on the right (as in a file reader, content left and chat right), never open a drawer or sheet over it on that side.
19
25
  - **Modals are fine.** A pop-up modal that takes the centre of the stage, lets you do your thing, and closes back to what you were doing is a normal pattern. Popovers and menus are fine too.
20
26
  - **Colours are swatches.** A colour is chosen from round swatches (and a custom colour input), never from a list of colour names.
21
27
  - **Real data.** Show what is stored or computed from it; an empty section says how to fill it.
22
- - **Deliberate delete.** Archive first. Permanent delete confirms by name.
28
+ - **Deliberate delete.** Archive first. Permanent delete confirms by name. No solid red button on a page: what removes sits in the "..." menu.
23
29
 
24
- 1. Build from `@jaetask/toolkit`: the ui parts (`@jaetask/toolkit/ui`), and `Panel`, `ListRow`, `EditLink`, `EditFrame`, `Row`, `BackLink`, `ProjectIconPicker`, inside `AppShell` (`@jaetask/toolkit/suite`). A missing piece goes into the toolkit, never a single page.
25
- 2. Run `npx toolkit-guard src` with the app's lint. It fails on a hand-built shell or kit component, a raw browser control, a colour chosen by name, a literal colour, or a ring or outline drawn on focus, and names the toolkit piece to use.
30
+ 1. Build from `@jaetask/toolkit`: the ui parts (`@jaetask/toolkit/ui`), and `Panel`, `ListRow`, `EditLink`, `EditFrame`, `Row`, `BackLink`, `WorkPage`, `PageSection`, `InlineText`, `RowMenu`, `FormDialog`, `ProjectIconPicker`, inside `AppShell` (`@jaetask/toolkit/suite`). A missing piece goes into the toolkit, never a single page.
31
+ 2. Run `npx toolkit-guard src` with the app's lint. It fails on a hand-built shell or kit component, a raw browser control, a colour chosen by name, a literal colour, a ring or outline drawn on focus, or a bordered box with no padding inside, and names the toolkit piece to use.
@@ -1,93 +0,0 @@
1
- Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter) Inter-Italic[opsz,wght].ttf: Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter)
2
-
3
- This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
- This license is copied below, and is also available with a FAQ at:
5
- http://scripts.sil.org/OFL
6
-
7
-
8
- -----------------------------------------------------------
9
- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
- -----------------------------------------------------------
11
-
12
- PREAMBLE
13
- The goals of the Open Font License (OFL) are to stimulate worldwide
14
- development of collaborative font projects, to support the font creation
15
- efforts of academic and linguistic communities, and to provide a free and
16
- open framework in which fonts may be shared and improved in partnership
17
- with others.
18
-
19
- The OFL allows the licensed fonts to be used, studied, modified and
20
- redistributed freely as long as they are not sold by themselves. The
21
- fonts, including any derivative works, can be bundled, embedded,
22
- redistributed and/or sold with any software provided that any reserved
23
- names are not used by derivative works. The fonts and derivatives,
24
- however, cannot be released under any other type of license. The
25
- requirement for fonts to remain under this license does not apply
26
- to any document created using the fonts or their derivatives.
27
-
28
- DEFINITIONS
29
- "Font Software" refers to the set of files released by the Copyright
30
- Holder(s) under this license and clearly marked as such. This may
31
- include source files, build scripts and documentation.
32
-
33
- "Reserved Font Name" refers to any names specified as such after the
34
- copyright statement(s).
35
-
36
- "Original Version" refers to the collection of Font Software components as
37
- distributed by the Copyright Holder(s).
38
-
39
- "Modified Version" refers to any derivative made by adding to, deleting,
40
- or substituting -- in part or in whole -- any of the components of the
41
- Original Version, by changing formats or by porting the Font Software to a
42
- new environment.
43
-
44
- "Author" refers to any designer, engineer, programmer, technical
45
- writer or other person who contributed to the Font Software.
46
-
47
- PERMISSION & CONDITIONS
48
- Permission is hereby granted, free of charge, to any person obtaining
49
- a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
- redistribute, and sell modified and unmodified copies of the Font
51
- Software, subject to the following conditions:
52
-
53
- 1) Neither the Font Software nor any of its individual components,
54
- in Original or Modified Versions, may be sold by itself.
55
-
56
- 2) Original or Modified Versions of the Font Software may be bundled,
57
- redistributed and/or sold with any software, provided that each copy
58
- contains the above copyright notice and this license. These can be
59
- included either as stand-alone text files, human-readable headers or
60
- in the appropriate machine-readable metadata fields within text or
61
- binary files as long as those fields can be easily viewed by the user.
62
-
63
- 3) No Modified Version of the Font Software may use the Reserved Font
64
- Name(s) unless explicit written permission is granted by the corresponding
65
- Copyright Holder. This restriction only applies to the primary font name as
66
- presented to the users.
67
-
68
- 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
- Software shall not be used to promote, endorse or advertise any
70
- Modified Version, except to acknowledge the contribution(s) of the
71
- Copyright Holder(s) and the Author(s) or with their explicit written
72
- permission.
73
-
74
- 5) The Font Software, modified or unmodified, in part or in whole,
75
- must be distributed entirely under this license, and must not be
76
- distributed under any other license. The requirement for fonts to
77
- remain under this license does not apply to any document created
78
- using the Font Software.
79
-
80
- TERMINATION
81
- This license becomes null and void if any of the above conditions are
82
- not met.
83
-
84
- DISCLAIMER
85
- THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
- OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
- COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
- INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
- DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
- FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
- OTHER DEALINGS IN THE FONT SOFTWARE.
package/dist/forms.d.ts DELETED
@@ -1,70 +0,0 @@
1
- import { type ReactNode } from "react";
2
- import { type Surface } from "./ui.js";
3
- export type TabOption<T extends string> = {
4
- id: T;
5
- name: string;
6
- count?: number;
7
- href?: string;
8
- };
9
- /**
10
- * Tabs above a list. With `href` on each option they are links (the current one marked); without,
11
- * they are buttons that call onChange.
12
- */
13
- export declare function Tabs<T extends string>({ label, value, options, onChange, }: {
14
- label: string;
15
- value: T;
16
- options: TabOption<T>[];
17
- onChange?: (value: T) => void;
18
- }): import("react").JSX.Element;
19
- /** Pills to pick several values from, on an edit page. */
20
- export declare function ChipMultiPicker<T extends string>({ label, value, options, onChange, }: {
21
- label: string;
22
- value: T[];
23
- options: {
24
- id: T;
25
- name: string;
26
- }[];
27
- onChange: (value: T[]) => void;
28
- }): import("react").JSX.Element;
29
- /** A one-line input with its button: chat, a quick add, a reply. */
30
- export declare function Composer({ label, value, onChange, onSubmit, placeholder, button, busy, maxLength, }: {
31
- label: string;
32
- value: string;
33
- onChange: (value: string) => void;
34
- onSubmit: (value: string) => void;
35
- placeholder?: string;
36
- button?: string;
37
- busy?: boolean;
38
- maxLength?: number;
39
- }): import("react").JSX.Element;
40
- /** The bar above a list: a search box first, then selects and toggles. */
41
- export declare function FilterBar({ children, label, }: {
42
- children: ReactNode;
43
- label?: string;
44
- }): import("react").JSX.Element;
45
- /** The search box for a FilterBar. */
46
- export declare function SearchInput({ value, onChange, label, placeholder, }: {
47
- value: string;
48
- onChange: (value: string) => void;
49
- label?: string;
50
- placeholder?: string;
51
- }): import("react").JSX.Element;
52
- /** A grey button that opens the file picker. */
53
- export declare function FileButton({ label, onFiles, accept, multiple, disabled, surface, }: {
54
- label: string;
55
- onFiles: (files: File[]) => void;
56
- accept?: string;
57
- multiple?: boolean;
58
- disabled?: boolean;
59
- surface?: Surface;
60
- }): import("react").JSX.Element;
61
- /** A grid of image thumbnails, each with a Remove button. */
62
- export declare function Thumbs({ items, onRemove, removeLabel, }: {
63
- items: {
64
- id: string;
65
- src: string;
66
- alt: string;
67
- }[];
68
- onRemove?: (id: string) => void;
69
- removeLabel?: string;
70
- }): import("react").JSX.Element;
package/dist/forms.js DELETED
@@ -1,56 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- // Controls for list views and edit pages: tabs, pick-many chips, the composer, the filter bar,
3
- // and a file button with a thumbnail grid.
4
- import { useRef } from "react";
5
- import { Link } from "./link.js";
6
- import { Button, Input } from "./ui.js";
7
- /**
8
- * Tabs above a list. With `href` on each option they are links (the current one marked); without,
9
- * they are buttons that call onChange.
10
- */
11
- export function Tabs({ label, value, options, onChange, }) {
12
- const body = (o) => (_jsxs(_Fragment, { children: [o.name, o.count !== undefined && _jsx("span", { className: "tk-count", children: o.count })] }));
13
- if (options.every((o) => o.href))
14
- return (_jsx("nav", { className: "tk-tabs", "aria-label": label, children: options.map((o) => (_jsx(Link, { href: o.href ?? "", className: "tk-tab", "aria-current": o.id === value ? "page" : undefined, children: body(o) }, o.id))) }));
15
- return (_jsx("div", { className: "tk-tabs", role: "tablist", "aria-label": label, children: options.map((o) => (_jsx("button", { type: "button", role: "tab", className: "tk-tab", "aria-selected": o.id === value, onClick: () => onChange?.(o.id), children: body(o) }, o.id))) }));
16
- }
17
- /** Pills to pick several values from, on an edit page. */
18
- export function ChipMultiPicker({ label, value, options, onChange, }) {
19
- const on = new Set(value);
20
- return (
21
- // biome-ignore lint/a11y/useSemanticElements: a row of toggle pills, not a fieldset of inputs
22
- _jsx("div", { role: "group", "aria-label": label, className: "tk-chips", children: options.map((o) => (_jsx("button", { type: "button", className: "tk-pick", "aria-pressed": on.has(o.id), onClick: () => onChange(on.has(o.id) ? value.filter((v) => v !== o.id) : [...value, o.id]), children: o.name }, o.id))) }));
23
- }
24
- /** A one-line input with its button: chat, a quick add, a reply. */
25
- export function Composer({ label, value, onChange, onSubmit, placeholder, button = "Send", busy, maxLength, }) {
26
- const submit = (e) => {
27
- e.preventDefault();
28
- const text = value.trim();
29
- if (text && !busy)
30
- onSubmit(text);
31
- };
32
- return (_jsxs("form", { className: "tk-composer", onSubmit: submit, children: [_jsx(Input, { "aria-label": label, value: value, placeholder: placeholder, maxLength: maxLength, onChange: (e) => onChange(e.target.value) }), _jsx(Button, { type: "submit", variant: "primary", disabled: busy || !value.trim(), children: button })] }));
33
- }
34
- /** The bar above a list: a search box first, then selects and toggles. */
35
- export function FilterBar({ children, label = "Filters", }) {
36
- return (
37
- // biome-ignore lint/a11y/useSemanticElements: a toolbar of filters, not a form that submits
38
- _jsx("div", { className: "tk-filter", role: "group", "aria-label": label, children: children }));
39
- }
40
- /** The search box for a FilterBar. */
41
- export function SearchInput({ value, onChange, label = "Search", placeholder = "Search", }) {
42
- return (_jsx(Input, { type: "search", className: "tk-search", "aria-label": label, placeholder: placeholder, value: value, onChange: (e) => onChange(e.target.value) }));
43
- }
44
- /** A grey button that opens the file picker. */
45
- export function FileButton({ label, onFiles, accept = "image/png,image/jpeg,image/webp", multiple, disabled, surface = "white", }) {
46
- const ref = useRef(null);
47
- return (_jsxs(_Fragment, { children: [_jsx(Button, { surface: surface, disabled: disabled ?? false, onClick: () => ref.current?.click(), children: label }), _jsx("input", { ref: ref, type: "file", hidden: true, accept: accept, multiple: multiple, onChange: (e) => {
48
- onFiles(Array.from(e.target.files ?? []));
49
- e.target.value = "";
50
- } })] }));
51
- }
52
- /** A grid of image thumbnails, each with a Remove button. */
53
- export function Thumbs({ items, onRemove, removeLabel = "Remove", }) {
54
- return (_jsx("ul", { className: "tk-thumbs", children: items.map((t) => (_jsxs("li", { className: "tk-thumb", children: [_jsx("img", { src: t.src, alt: t.alt, loading: "lazy" }), onRemove && (_jsx("button", { type: "button", className: "tk-thumb-remove", "aria-label": `${removeLabel} ${t.alt}`, onClick: () => onRemove(t.id), children: removeLabel }))] }, t.id))) }));
55
- }
56
- //# sourceMappingURL=forms.js.map
package/dist/forms.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"forms.js","sourceRoot":"","sources":["../src/forms.tsx"],"names":[],"mappings":";AAAA,+FAA+F;AA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AAC,EAAE,CAYR,CACN,CAAC,GACC,CACN,CAAC;AACJ,CAAC"}
package/dist/link.d.ts DELETED
@@ -1,22 +0,0 @@
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;