@justanarthur/modo-ui-ai 0.0.0-stage → 0.2.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 +21 -0
- package/LICENSE.fluid-functionalism +21 -0
- package/README.md +105 -2
- package/blocks/conversation/agent-prompt/examples.mdx +44 -0
- package/blocks/conversation/agent-prompt/index.tsx +114 -0
- package/blocks/conversation/composer/draft.css +25 -0
- package/blocks/conversation/composer/draft.tsx +589 -0
- package/blocks/conversation/composer/examples.mdx +114 -0
- package/blocks/conversation/composer/file-preview-tile.tsx +59 -0
- package/blocks/conversation/composer/file-thumbnail.tsx +146 -0
- package/blocks/conversation/composer/index.tsx +517 -0
- package/blocks/conversation/composer/queued-row.tsx +102 -0
- package/blocks/conversation/composer/shared.ts +38 -0
- package/blocks/conversation/composer/suggestion-row.tsx +64 -0
- package/blocks/conversation/composer/use-composer-files.ts +142 -0
- package/blocks/conversation/composer/use-history-nav.ts +60 -0
- package/blocks/conversation/composer/use-message-queue.ts +108 -0
- package/blocks/conversation/composer/use-region-height.ts +34 -0
- package/blocks/conversation/failure-states/examples.mdx +58 -0
- package/blocks/conversation/failure-states/index.tsx +274 -0
- package/blocks/conversation/transcript/examples.mdx +43 -0
- package/blocks/conversation/transcript/index.tsx +204 -0
- package/blocks/conversation/transcript-search/examples.mdx +50 -0
- package/blocks/conversation/transcript-search/index.tsx +469 -0
- package/blocks/dialogs/command-palette/examples.mdx +33 -0
- package/blocks/dialogs/command-palette/index.tsx +232 -0
- package/blocks/dialogs/hook-dialog/examples.mdx +44 -0
- package/blocks/dialogs/hook-dialog/index.tsx +286 -0
- package/blocks/dialogs/mcp-server-dialog/examples.mdx +57 -0
- package/blocks/dialogs/mcp-server-dialog/index.tsx +415 -0
- package/blocks/dialogs/shortcuts-sheet/examples.mdx +36 -0
- package/blocks/dialogs/shortcuts-sheet/index.tsx +186 -0
- package/blocks/panes/artifacts-pane/examples.mdx +23 -0
- package/blocks/panes/artifacts-pane/index.tsx +82 -0
- package/blocks/panes/changes-pane/examples.mdx +23 -0
- package/blocks/panes/changes-pane/index.tsx +248 -0
- package/blocks/panes/file-pane/examples.mdx +13 -0
- package/blocks/panes/file-pane/index.tsx +102 -0
- package/blocks/panes/pr-pane/examples.mdx +13 -0
- package/blocks/panes/pr-pane/index.tsx +191 -0
- package/blocks/panes/side-pane/examples.mdx +58 -0
- package/blocks/panes/side-pane/index.tsx +187 -0
- package/blocks/panes/tasks-pane/examples.mdx +23 -0
- package/blocks/panes/tasks-pane/index.tsx +127 -0
- package/blocks/panes/terminal-pane/examples.mdx +13 -0
- package/blocks/panes/terminal-pane/index.tsx +99 -0
- package/blocks/panes/usage-pane/examples.mdx +13 -0
- package/blocks/panes/usage-pane/index.tsx +75 -0
- package/blocks/profiles/profile-onboarding/examples.mdx +80 -0
- package/blocks/profiles/profile-onboarding/index.tsx +580 -0
- package/blocks/profiles/profile-switcher/examples.mdx +18 -0
- package/blocks/profiles/profile-switcher/index.tsx +197 -0
- package/blocks/profiles/profile-usage/examples.mdx +21 -0
- package/blocks/profiles/profile-usage/index.tsx +127 -0
- package/blocks/sessions/inbox/examples.mdx +35 -0
- package/blocks/sessions/inbox/index.tsx +372 -0
- package/blocks/sessions/session-board/examples.mdx +34 -0
- package/blocks/sessions/session-board/index.tsx +570 -0
- package/blocks/sessions/session-sidebar/examples.mdx +43 -0
- package/blocks/sessions/session-sidebar/index.tsx +442 -0
- package/blocks/settings/extensions/examples.mdx +10 -0
- package/blocks/settings/extensions/index.tsx +72 -0
- package/blocks/settings/hooks/examples.mdx +16 -0
- package/blocks/settings/hooks/index.tsx +127 -0
- package/blocks/settings/mcp-servers/examples.mdx +26 -0
- package/blocks/settings/mcp-servers/index.tsx +204 -0
- package/blocks/settings/memory/examples.mdx +22 -0
- package/blocks/settings/memory/index.tsx +113 -0
- package/blocks/settings/notifications/examples.mdx +8 -0
- package/blocks/settings/notifications/index.tsx +63 -0
- package/blocks/settings/permission-rules/examples.mdx +37 -0
- package/blocks/settings/permission-rules/index.tsx +317 -0
- package/blocks/settings/plugin-catalog/examples.mdx +52 -0
- package/blocks/settings/plugin-catalog/index.tsx +407 -0
- package/blocks/settings/plugins/examples.mdx +10 -0
- package/blocks/settings/plugins/index.tsx +72 -0
- package/blocks/settings/settings-window/examples.mdx +40 -0
- package/blocks/settings/settings-window/index.tsx +188 -0
- package/blocks/settings/worktrees/examples.mdx +17 -0
- package/blocks/settings/worktrees/index.tsx +145 -0
- package/components/conversation/agent-run/examples.mdx +30 -0
- package/components/conversation/agent-run/index.tsx +82 -0
- package/components/conversation/chapter-nav/examples.mdx +30 -0
- package/components/conversation/chapter-nav/index.tsx +123 -0
- package/components/conversation/message/examples.mdx +53 -0
- package/components/conversation/message/index.tsx +128 -0
- package/components/conversation/message/working.tsx +102 -0
- package/components/conversation/reasoning/examples.mdx +22 -0
- package/components/conversation/reasoning/index.tsx +54 -0
- package/components/conversation/recap/examples.mdx +21 -0
- package/components/conversation/recap/index.tsx +67 -0
- package/components/conversation/todo-list/examples.mdx +32 -0
- package/components/conversation/todo-list/index.tsx +106 -0
- package/components/conversation/tool-call/examples.mdx +48 -0
- package/components/conversation/tool-call/index.tsx +142 -0
- package/components/conversation/work-summary/examples.mdx +50 -0
- package/components/conversation/work-summary/index.tsx +87 -0
- package/components/prompts/permission-request/examples.mdx +32 -0
- package/components/prompts/permission-request/index.tsx +74 -0
- package/components/prompts/plan-approval/examples.mdx +37 -0
- package/components/prompts/plan-approval/index.tsx +76 -0
- package/components/prompts/prompt-card/examples.mdx +31 -0
- package/components/prompts/prompt-card/index.tsx +82 -0
- package/components/prompts/question-prompt/examples.mdx +46 -0
- package/components/prompts/question-prompt/index.tsx +118 -0
- package/dist/blocks/conversation/agent-prompt/index.d.ts +7 -0
- package/dist/blocks/conversation/agent-prompt/index.js +13 -0
- package/dist/blocks/conversation/composer/index.d.ts +4 -0
- package/dist/blocks/conversation/composer/index.js +15 -0
- package/dist/blocks/conversation/failure-states/index.d.ts +4 -0
- package/dist/blocks/conversation/failure-states/index.js +8 -0
- package/dist/blocks/conversation/transcript/index.d.ts +50 -0
- package/dist/blocks/conversation/transcript/index.js +17 -0
- package/dist/blocks/conversation/transcript-search/index.d.ts +4 -0
- package/dist/blocks/conversation/transcript-search/index.js +11 -0
- package/dist/blocks/dialogs/command-palette/index.d.ts +5 -0
- package/dist/blocks/dialogs/command-palette/index.js +20 -0
- package/dist/blocks/dialogs/hook-dialog/index.d.ts +3 -0
- package/dist/blocks/dialogs/hook-dialog/index.js +12 -0
- package/dist/blocks/dialogs/mcp-server-dialog/index.d.ts +5 -0
- package/dist/blocks/dialogs/mcp-server-dialog/index.js +12 -0
- package/dist/blocks/dialogs/shortcuts-sheet/index.d.ts +2 -0
- package/dist/blocks/dialogs/shortcuts-sheet/index.js +11 -0
- package/dist/blocks/panes/artifacts-pane/index.d.ts +3 -0
- package/dist/blocks/panes/artifacts-pane/index.js +9 -0
- package/dist/blocks/panes/changes-pane/index.d.ts +3 -0
- package/dist/blocks/panes/changes-pane/index.js +9 -0
- package/dist/blocks/panes/file-pane/index.d.ts +3 -0
- package/dist/blocks/panes/file-pane/index.js +9 -0
- package/dist/blocks/panes/pr-pane/index.d.ts +3 -0
- package/dist/blocks/panes/pr-pane/index.js +10 -0
- package/dist/blocks/panes/side-pane/index.d.ts +5 -0
- package/dist/blocks/panes/side-pane/index.js +21 -0
- package/dist/blocks/panes/tasks-pane/index.d.ts +3 -0
- package/dist/blocks/panes/tasks-pane/index.js +10 -0
- package/dist/blocks/panes/terminal-pane/index.d.ts +3 -0
- package/dist/blocks/panes/terminal-pane/index.js +9 -0
- package/dist/blocks/panes/usage-pane/index.d.ts +4 -0
- package/dist/blocks/panes/usage-pane/index.js +11 -0
- package/dist/blocks/profiles/profile-onboarding/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-onboarding/index.js +11 -0
- package/dist/blocks/profiles/profile-switcher/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-switcher/index.js +11 -0
- package/dist/blocks/profiles/profile-usage/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-usage/index.js +10 -0
- package/dist/blocks/sessions/inbox/index.d.ts +2 -0
- package/dist/blocks/sessions/inbox/index.js +11 -0
- package/dist/blocks/sessions/session-board/index.d.ts +4 -0
- package/dist/blocks/sessions/session-board/index.js +26 -0
- package/dist/blocks/sessions/session-sidebar/index.d.ts +5 -0
- package/dist/blocks/sessions/session-sidebar/index.js +15 -0
- package/dist/blocks/settings/extensions/index.d.ts +2 -0
- package/dist/blocks/settings/extensions/index.js +9 -0
- package/dist/blocks/settings/hooks/index.d.ts +4 -0
- package/dist/blocks/settings/hooks/index.js +9 -0
- package/dist/blocks/settings/mcp-servers/index.d.ts +4 -0
- package/dist/blocks/settings/mcp-servers/index.js +9 -0
- package/dist/blocks/settings/memory/index.d.ts +4 -0
- package/dist/blocks/settings/memory/index.js +8 -0
- package/dist/blocks/settings/notifications/index.d.ts +2 -0
- package/dist/blocks/settings/notifications/index.js +8 -0
- package/dist/blocks/settings/permission-rules/index.d.ts +3 -0
- package/dist/blocks/settings/permission-rules/index.js +10 -0
- package/dist/blocks/settings/plugin-catalog/index.d.ts +2 -0
- package/dist/blocks/settings/plugin-catalog/index.js +11 -0
- package/dist/blocks/settings/plugins/index.d.ts +4 -0
- package/dist/blocks/settings/plugins/index.js +9 -0
- package/dist/blocks/settings/settings-window/index.d.ts +4 -0
- package/dist/blocks/settings/settings-window/index.js +8 -0
- package/dist/blocks/settings/worktrees/index.d.ts +4 -0
- package/dist/blocks/settings/worktrees/index.js +9 -0
- package/dist/components/conversation/agent-run/index.d.ts +3 -0
- package/dist/components/conversation/agent-run/index.js +10 -0
- package/dist/components/conversation/chapter-nav/index.d.ts +2 -0
- package/dist/components/conversation/chapter-nav/index.js +11 -0
- package/dist/components/conversation/message/index.d.ts +2 -0
- package/dist/components/conversation/message/index.js +15 -0
- package/dist/components/conversation/reasoning/index.d.ts +2 -0
- package/dist/components/conversation/reasoning/index.js +8 -0
- package/dist/components/conversation/recap/index.d.ts +2 -0
- package/dist/components/conversation/recap/index.js +9 -0
- package/dist/components/conversation/todo-list/index.d.ts +2 -0
- package/dist/components/conversation/todo-list/index.js +9 -0
- package/dist/components/conversation/tool-call/index.d.ts +3 -0
- package/dist/components/conversation/tool-call/index.js +13 -0
- package/dist/components/conversation/work-summary/index.d.ts +2 -0
- package/dist/components/conversation/work-summary/index.js +10 -0
- package/dist/components/prompts/permission-request/index.d.ts +2 -0
- package/dist/components/prompts/permission-request/index.js +9 -0
- package/dist/components/prompts/plan-approval/index.d.ts +2 -0
- package/dist/components/prompts/plan-approval/index.js +9 -0
- package/dist/components/prompts/prompt-card/index.d.ts +3 -0
- package/dist/components/prompts/prompt-card/index.js +8 -0
- package/dist/components/prompts/question-prompt/index.d.ts +2 -0
- package/dist/components/prompts/question-prompt/index.js +9 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +231 -0
- package/dist/lib/config-parts.d.ts +2 -0
- package/dist/lib/config-parts.js +16 -0
- package/dist/lib/icons.d.ts +2 -0
- package/dist/lib/icons.js +10 -0
- package/dist/lib/pace-bar.d.ts +11 -0
- package/dist/lib/pace-bar.js +6 -0
- package/dist/lib/pace.d.ts +4 -0
- package/dist/lib/pace.js +12 -0
- package/dist/lib/pane-parts.d.ts +25 -0
- package/dist/lib/pane-parts.js +11 -0
- package/dist/lib/row-trigger.d.ts +5 -0
- package/dist/lib/row-trigger.js +7 -0
- package/dist/lib/settings-parts.d.ts +70 -0
- package/dist/lib/settings-parts.js +24 -0
- package/dist/lib/side-pane-types.d.ts +2 -0
- package/dist/lib/side-pane-types.js +1 -0
- package/dist/lib/status-glyph.d.ts +8 -0
- package/dist/lib/status-glyph.js +12 -0
- package/dist/lib/types.d.ts +3 -0
- package/dist/lib/types.js +1 -0
- package/dist/shared/chunk-04a497rr.js +21 -0
- package/dist/shared/chunk-13yf0mza.d.ts +70 -0
- package/dist/shared/chunk-1aq2xzv5.js +558 -0
- package/dist/shared/chunk-1f96cz69.js +45 -0
- package/dist/shared/chunk-1yt061np.d.ts +64 -0
- package/dist/shared/chunk-218qabm5.js +250 -0
- package/dist/shared/chunk-2fk5aq60.js +313 -0
- package/dist/shared/chunk-4248zvmh.js +177 -0
- package/dist/shared/chunk-45rqgey6.d.ts +25 -0
- package/dist/shared/chunk-4n0v64qx.js +179 -0
- package/dist/shared/chunk-4zvhpf2x.js +55 -0
- package/dist/shared/chunk-57hzzmjd.d.ts +67 -0
- package/dist/shared/chunk-58qvny6a.d.ts +29 -0
- package/dist/shared/chunk-5fhkkn39.js +130 -0
- package/dist/shared/chunk-5hw0525a.d.ts +33 -0
- package/dist/shared/chunk-5k6xwqfj.d.ts +68 -0
- package/dist/shared/chunk-5meda998.js +238 -0
- package/dist/shared/chunk-5pqksw7z.js +91 -0
- package/dist/shared/chunk-6220dy5n.js +70 -0
- package/dist/shared/chunk-64bnh22t.d.ts +59 -0
- package/dist/shared/chunk-66sh633m.d.ts +60 -0
- package/dist/shared/chunk-6cmf27g3.d.ts +81 -0
- package/dist/shared/chunk-6g4970a6.d.ts +20 -0
- package/dist/shared/chunk-75zwypyr.d.ts +43 -0
- package/dist/shared/chunk-7rzjmcnh.d.ts +30 -0
- package/dist/shared/chunk-7zvb39cf.d.ts +26 -0
- package/dist/shared/chunk-8mecznyr.js +357 -0
- package/dist/shared/chunk-8pag6vmd.js +255 -0
- package/dist/shared/chunk-8xg5gwwy.js +38 -0
- package/dist/shared/chunk-9kw6m047.d.ts +32 -0
- package/dist/shared/chunk-a4s440b6.js +79 -0
- package/dist/shared/chunk-at0jje23.d.ts +110 -0
- package/dist/shared/chunk-awd573h9.js +34 -0
- package/dist/shared/chunk-b171wjge.d.ts +25 -0
- package/dist/shared/chunk-bh2b5d1z.js +98 -0
- package/dist/shared/chunk-bzs6amnv.js +187 -0
- package/dist/shared/chunk-c36qvrwq.d.ts +30 -0
- package/dist/shared/chunk-c8wp058j.js +153 -0
- package/dist/shared/chunk-cd4f87as.d.ts +28 -0
- package/dist/shared/chunk-cmwby8f9.js +467 -0
- package/dist/shared/chunk-d2t72h4x.d.ts +35 -0
- package/dist/shared/chunk-dh3qy5fj.js +49 -0
- package/dist/shared/chunk-e46apgve.d.ts +40 -0
- package/dist/shared/chunk-ejtknc0w.js +21 -0
- package/dist/shared/chunk-eqajdxn8.js +82 -0
- package/dist/shared/chunk-fbn0h7cr.js +123 -0
- package/dist/shared/chunk-fqhcz6ss.d.ts +29 -0
- package/dist/shared/chunk-g28hweee.d.ts +35 -0
- package/dist/shared/chunk-g88hweqh.d.ts +70 -0
- package/dist/shared/chunk-gewnsgza.js +61 -0
- package/dist/shared/chunk-gkyk663q.d.ts +53 -0
- package/dist/shared/chunk-hd4gtj5z.d.ts +23 -0
- package/dist/shared/chunk-hxjgey30.d.ts +36 -0
- package/dist/shared/chunk-jkkdq1mh.d.ts +213 -0
- package/dist/shared/chunk-jpq101w3.js +91 -0
- package/dist/shared/chunk-k3bv9k1v.d.ts +56 -0
- package/dist/shared/chunk-k5zegxje.d.ts +81 -0
- package/dist/shared/chunk-kreypnzp.d.ts +34 -0
- package/dist/shared/chunk-kw9npka5.js +224 -0
- package/dist/shared/chunk-mrb3fp2f.d.ts +30 -0
- package/dist/shared/chunk-n1qq2wp9.js +6 -0
- package/dist/shared/chunk-n4742y54.js +39 -0
- package/dist/shared/chunk-ndjvdkv7.d.ts +29 -0
- package/dist/shared/chunk-nk4578dr.js +73 -0
- package/dist/shared/chunk-paezqfg1.js +106 -0
- package/dist/shared/chunk-qemm9e3r.d.ts +21 -0
- package/dist/shared/chunk-qhxz1etk.js +96 -0
- package/dist/shared/chunk-qj5ev9ak.js +531 -0
- package/dist/shared/chunk-qnwggvjy.js +150 -0
- package/dist/shared/chunk-r5hz78pb.js +129 -0
- package/dist/shared/chunk-r6nb21kz.d.ts +102 -0
- package/dist/shared/chunk-rjfwje37.d.ts +234 -0
- package/dist/shared/chunk-rqrpvvz4.d.ts +107 -0
- package/dist/shared/chunk-rzajcn44.d.ts +49 -0
- package/dist/shared/chunk-s3r759ec.js +80 -0
- package/dist/shared/chunk-sdtjrw9w.d.ts +98 -0
- package/dist/shared/chunk-sfqvyzcs.d.ts +68 -0
- package/dist/shared/chunk-skg3m9m0.js +56 -0
- package/dist/shared/chunk-szkvrqg1.d.ts +54 -0
- package/dist/shared/chunk-t21t9x7e.js +188 -0
- package/dist/shared/chunk-tc75ng2c.js +235 -0
- package/dist/shared/chunk-tkx1krwc.js +88 -0
- package/dist/shared/chunk-tprdqtb1.d.ts +30 -0
- package/dist/shared/chunk-tv9a1sek.js +137 -0
- package/dist/shared/chunk-tvbd27hg.d.ts +43 -0
- package/dist/shared/chunk-v6yevw62.d.ts +28 -0
- package/dist/shared/chunk-v9q38p0x.js +258 -0
- package/dist/shared/chunk-vd59gzzd.js +86 -0
- package/dist/shared/chunk-vgh4f3sv.js +118 -0
- package/dist/shared/chunk-vjht1zn1.js +391 -0
- package/dist/shared/chunk-vsrkb0sp.d.ts +21 -0
- package/dist/shared/chunk-w5z8qnf8.js +175 -0
- package/dist/shared/chunk-wgvzavx1.js +1488 -0
- package/dist/shared/chunk-whsx7yp9.d.ts +37 -0
- package/dist/shared/chunk-x7az5x1y.d.ts +57 -0
- package/dist/shared/chunk-x9jf26yb.js +318 -0
- package/dist/shared/chunk-xbrrt07s.d.ts +23 -0
- package/dist/shared/chunk-xkchhs2z.js +129 -0
- package/dist/shared/chunk-xzfrskd7.js +202 -0
- package/dist/shared/chunk-y4cj4y54.js +423 -0
- package/dist/shared/chunk-y934at6m.js +7 -0
- package/dist/shared/chunk-zbpwhpjy.d.ts +75 -0
- package/dist/shared/chunk-zfhmbb7n.js +63 -0
- package/dist/shared/chunk-zk0t4vq5.js +71 -0
- package/dist/shared/chunk-znp9gna7.d.ts +23 -0
- package/dist/styles.css +467 -0
- package/index.ts +49 -0
- package/lib/config-parts.tsx +97 -0
- package/lib/icons.tsx +149 -0
- package/lib/pace-bar.tsx +24 -0
- package/lib/pace.ts +74 -0
- package/lib/pane-parts.tsx +76 -0
- package/lib/row-trigger.tsx +44 -0
- package/lib/settings-parts.tsx +232 -0
- package/lib/side-pane-types.ts +75 -0
- package/lib/status-glyph.tsx +25 -0
- package/lib/types.ts +204 -0
- package/mock/demo-reply.tsx +33 -0
- package/mock/demo-session.tsx +150 -0
- package/mock/mock-config.ts +173 -0
- package/mock/mock-extras.ts +288 -0
- package/mock/mock-panes.ts +190 -0
- package/mock/mock-settings.ts +92 -0
- package/mock/mock.ts +548 -0
- package/mock/screen-frame.tsx +49 -0
- package/package.json +114 -4
package/lib/icons.tsx
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* The kit's glyphs on top of modo-ui's icon set: tools, panes, session states
|
|
3
|
+
* and settings sections. modo-ui's names resolve through its IconProvider,
|
|
4
|
+
* the kit's own through AiIconProvider, so a host swaps either set.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
type IconComponent,
|
|
11
|
+
type IconName as UiIconName,
|
|
12
|
+
useIcons as useUiIcons,
|
|
13
|
+
} from '@justanarthur/modo-ui/lib/icon-context'
|
|
14
|
+
import {
|
|
15
|
+
Archive,
|
|
16
|
+
ArrowUpRight,
|
|
17
|
+
AtSign,
|
|
18
|
+
Ban,
|
|
19
|
+
BookOpen,
|
|
20
|
+
Bot,
|
|
21
|
+
ChevronUp,
|
|
22
|
+
CircleDot,
|
|
23
|
+
CircleX,
|
|
24
|
+
Clipboard,
|
|
25
|
+
Cloud,
|
|
26
|
+
Columns2,
|
|
27
|
+
Command,
|
|
28
|
+
Cpu,
|
|
29
|
+
ExternalLink,
|
|
30
|
+
FilePlus,
|
|
31
|
+
FileText,
|
|
32
|
+
FolderOpen,
|
|
33
|
+
Gauge,
|
|
34
|
+
GitBranch,
|
|
35
|
+
GitFork,
|
|
36
|
+
GitPullRequest,
|
|
37
|
+
History,
|
|
38
|
+
Key,
|
|
39
|
+
Layers,
|
|
40
|
+
LayoutDashboard,
|
|
41
|
+
ListChecks,
|
|
42
|
+
ListTree,
|
|
43
|
+
Package,
|
|
44
|
+
Paperclip,
|
|
45
|
+
PenLine,
|
|
46
|
+
Pin,
|
|
47
|
+
Plug,
|
|
48
|
+
Puzzle,
|
|
49
|
+
RefreshCw,
|
|
50
|
+
Server,
|
|
51
|
+
ShieldCheck,
|
|
52
|
+
Split,
|
|
53
|
+
SquareKanban,
|
|
54
|
+
Terminal,
|
|
55
|
+
TextWrap,
|
|
56
|
+
Trash2,
|
|
57
|
+
TriangleAlert,
|
|
58
|
+
Webhook,
|
|
59
|
+
Wrench,
|
|
60
|
+
Zap,
|
|
61
|
+
} from 'lucide-react'
|
|
62
|
+
import { createContext, type ReactNode, useContext, useMemo } from 'react'
|
|
63
|
+
|
|
64
|
+
const aiIcons = {
|
|
65
|
+
archive: Archive,
|
|
66
|
+
'arrow-up-right': ArrowUpRight,
|
|
67
|
+
'at-sign': AtSign,
|
|
68
|
+
ban: Ban,
|
|
69
|
+
'book-open': BookOpen,
|
|
70
|
+
bot: Bot,
|
|
71
|
+
'chevron-up': ChevronUp,
|
|
72
|
+
'circle-dot': CircleDot,
|
|
73
|
+
'circle-x': CircleX,
|
|
74
|
+
clipboard: Clipboard,
|
|
75
|
+
cloud: Cloud,
|
|
76
|
+
'columns-2': Columns2,
|
|
77
|
+
command: Command,
|
|
78
|
+
cpu: Cpu,
|
|
79
|
+
'external-link': ExternalLink,
|
|
80
|
+
'file-plus': FilePlus,
|
|
81
|
+
'file-text': FileText,
|
|
82
|
+
'folder-open': FolderOpen,
|
|
83
|
+
gauge: Gauge,
|
|
84
|
+
'git-branch': GitBranch,
|
|
85
|
+
'git-fork': GitFork,
|
|
86
|
+
'git-pull-request': GitPullRequest,
|
|
87
|
+
history: History,
|
|
88
|
+
key: Key,
|
|
89
|
+
layers: Layers,
|
|
90
|
+
'layout-dashboard': LayoutDashboard,
|
|
91
|
+
'list-checks': ListChecks,
|
|
92
|
+
'list-tree': ListTree,
|
|
93
|
+
package: Package,
|
|
94
|
+
paperclip: Paperclip,
|
|
95
|
+
'pen-line': PenLine,
|
|
96
|
+
pin: Pin,
|
|
97
|
+
plug: Plug,
|
|
98
|
+
puzzle: Puzzle,
|
|
99
|
+
'refresh-cw': RefreshCw,
|
|
100
|
+
server: Server,
|
|
101
|
+
'shield-check': ShieldCheck,
|
|
102
|
+
split: Split,
|
|
103
|
+
'square-kanban': SquareKanban,
|
|
104
|
+
terminal: Terminal,
|
|
105
|
+
'text-wrap': TextWrap,
|
|
106
|
+
trash: Trash2,
|
|
107
|
+
'triangle-alert': TriangleAlert,
|
|
108
|
+
webhook: Webhook,
|
|
109
|
+
wrench: Wrench,
|
|
110
|
+
zap: Zap,
|
|
111
|
+
} satisfies Record<string, IconComponent>
|
|
112
|
+
|
|
113
|
+
/** A glyph only the kit draws. */
|
|
114
|
+
type AiIconName = keyof typeof aiIcons
|
|
115
|
+
|
|
116
|
+
/** Every name the kit's items read: modo-ui's set plus the kit's own. */
|
|
117
|
+
type IconName = UiIconName | AiIconName
|
|
118
|
+
|
|
119
|
+
const AiIconContext = createContext<Record<AiIconName, IconComponent> | null>(null)
|
|
120
|
+
|
|
121
|
+
/** The whole map: modo-ui's icons (through its IconProvider) and the kit's (through AiIconProvider). */
|
|
122
|
+
function useIcons(): Record<IconName, IconComponent> {
|
|
123
|
+
const ui = useUiIcons()
|
|
124
|
+
const ai = useContext(AiIconContext) ?? aiIcons
|
|
125
|
+
return useMemo(() => ({ ...ui, ...ai }), [ui, ai])
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** One icon by name, from either set. */
|
|
129
|
+
function useIcon(name: IconName): IconComponent {
|
|
130
|
+
return useIcons()[name]
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Swap some or all of the kit's own glyphs. Names left out keep their Lucide
|
|
135
|
+
* component; modo-ui's names are swapped with its IconProvider.
|
|
136
|
+
*/
|
|
137
|
+
function AiIconProvider({
|
|
138
|
+
children,
|
|
139
|
+
icons,
|
|
140
|
+
}: {
|
|
141
|
+
children: ReactNode
|
|
142
|
+
icons?: Partial<Record<AiIconName, IconComponent>>
|
|
143
|
+
}) {
|
|
144
|
+
const value = useMemo(() => ({ ...aiIcons, ...icons }), [icons])
|
|
145
|
+
return <AiIconContext.Provider value={value}>{children}</AiIconContext.Provider>
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export type { AiIconName, IconComponent, IconName }
|
|
149
|
+
export { AiIconProvider, useIcon, useIcons }
|
package/lib/pace-bar.tsx
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: a usage limit read against time — a Meter line whose tone
|
|
3
|
+
* is whether the limit lasts until its reset (see pace.ts) and whose marker
|
|
4
|
+
* is where an even spend would be by now.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import Meter, { type MeterTone } from '@justanarthur/modo-ui/components/feedback/meter'
|
|
8
|
+
import type { LimitPace, Verdict } from './pace'
|
|
9
|
+
|
|
10
|
+
const TONE: Record<Verdict, MeterTone> = { free: 'default', watch: 'warning', tight: 'error' }
|
|
11
|
+
|
|
12
|
+
/** The used share, colored by verdict, with a tick at the even-pace share. */
|
|
13
|
+
export function PaceBar({ pace, className }: { pace: LimitPace; className?: string }) {
|
|
14
|
+
return (
|
|
15
|
+
<Meter
|
|
16
|
+
variant="line"
|
|
17
|
+
label={pace.limit.label}
|
|
18
|
+
value={pace.limit.value}
|
|
19
|
+
marker={pace.elapsed}
|
|
20
|
+
tone={TONE[pace.verdict]}
|
|
21
|
+
className={className}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
}
|
package/lib/pace.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the profile usage's model of a limit over time. A
|
|
3
|
+
* limit's share alone says little (78% used is fine when it resets in a few
|
|
4
|
+
* hours), so each limit is read against its window: the burn rate so far,
|
|
5
|
+
* where that rate lands at the reset, and whether it runs out first.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Profile, UsageLimit } from './types'
|
|
9
|
+
|
|
10
|
+
/** `free`: lasts past the reset at this pace; `watch`: only just; `tight`: runs out before it. */
|
|
11
|
+
export type Verdict = 'free' | 'watch' | 'tight'
|
|
12
|
+
|
|
13
|
+
export interface LimitPace {
|
|
14
|
+
limit: UsageLimit
|
|
15
|
+
/** Share of the window already gone, 0–1: where an even spend would be now. */
|
|
16
|
+
elapsed: number
|
|
17
|
+
/** Share used at the reset if spending goes on at the pace so far (may exceed 1). */
|
|
18
|
+
projected: number
|
|
19
|
+
/** Hours until the limit is hit at that pace; Infinity when it lasts past the reset. */
|
|
20
|
+
runsOutInHours: number
|
|
21
|
+
verdict: Verdict
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ProfilePace {
|
|
25
|
+
profile: Profile
|
|
26
|
+
limits: LimitPace[]
|
|
27
|
+
/** The limit that runs out first, or lands highest at its reset. */
|
|
28
|
+
binding: LimitPace
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Projected share from which a limit counts as only just lasting. */
|
|
32
|
+
const WATCH_AT = 0.95
|
|
33
|
+
// The first minutes of a window say nothing about its pace: read at least a tenth of it.
|
|
34
|
+
const MIN_ELAPSED = 0.1
|
|
35
|
+
|
|
36
|
+
function paceOfLimit(limit: UsageLimit): LimitPace {
|
|
37
|
+
const elapsedHours = limit.windowHours - limit.resetsInHours
|
|
38
|
+
const rate = limit.value / Math.max(elapsedHours, limit.windowHours * MIN_ELAPSED)
|
|
39
|
+
const projected = limit.value + rate * limit.resetsInHours
|
|
40
|
+
const runsOut = rate > 0 ? (1 - limit.value) / rate : Number.POSITIVE_INFINITY
|
|
41
|
+
const runsOutInHours = runsOut < limit.resetsInHours ? runsOut : Number.POSITIVE_INFINITY
|
|
42
|
+
const verdict: Verdict =
|
|
43
|
+
runsOutInHours < Number.POSITIVE_INFINITY ? 'tight' : projected >= WATCH_AT ? 'watch' : 'free'
|
|
44
|
+
return { limit, elapsed: elapsedHours / limit.windowHours, projected, runsOutInHours, verdict }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function paceOf(profile: Profile): ProfilePace {
|
|
48
|
+
const limits = profile.limits.map(paceOfLimit)
|
|
49
|
+
const binding = [...limits].sort((a, b) => b.projected - a.projected)[0] ?? paceOfLimit(profile.limits[0]!)
|
|
50
|
+
return { profile, limits, binding }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** A short duration: `17m`, `2h 20m`, `20h`, `4d`. */
|
|
54
|
+
export function duration(hours: number) {
|
|
55
|
+
if (hours < 1) return `${Math.max(Math.round(hours * 60), 1)}m`
|
|
56
|
+
if (hours < 10) {
|
|
57
|
+
const h = Math.floor(hours)
|
|
58
|
+
const m = Math.round((hours - h) * 60)
|
|
59
|
+
return m === 0 ? `${h}h` : `${h}h ${m}m`
|
|
60
|
+
}
|
|
61
|
+
if (hours < 48) return `${Math.round(hours)}h`
|
|
62
|
+
return `${Math.round(hours / 24)}d`
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function percent(share: number) {
|
|
66
|
+
return `${Math.round(share * 100)}%`
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Literal tables: UnoCSS only generates the classes it can read whole.
|
|
70
|
+
export const VERDICT_TEXT: Record<Verdict, string> = {
|
|
71
|
+
free: 'text-muted-foreground',
|
|
72
|
+
watch: 'text-status-warning',
|
|
73
|
+
tight: 'text-status-error',
|
|
74
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the side pane's shared language. PaneSection is a
|
|
3
|
+
* caption-sized title, its meta and icon actions on one row, the rows under
|
|
4
|
+
* it on the control height with their own 8px inset; IconAction is an
|
|
5
|
+
* icon-only ghost button with its label as a tooltip; PaneEmpty is what a
|
|
6
|
+
* pane shows with nothing in it.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use client'
|
|
10
|
+
|
|
11
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
12
|
+
import EmptyState from '@justanarthur/modo-ui/components/feedback/empty-state'
|
|
13
|
+
import Tooltip from '@justanarthur/modo-ui/components/overlays/tooltip'
|
|
14
|
+
import { type ReactNode, useId } from 'react'
|
|
15
|
+
import { type IconComponent, type IconName, useIcon } from './icons'
|
|
16
|
+
|
|
17
|
+
/** A titled group: the title, its meta and its icon actions on one row, the rows under it. */
|
|
18
|
+
export function PaneSection({
|
|
19
|
+
title,
|
|
20
|
+
meta,
|
|
21
|
+
actions,
|
|
22
|
+
children,
|
|
23
|
+
}: {
|
|
24
|
+
title: ReactNode
|
|
25
|
+
meta?: ReactNode
|
|
26
|
+
actions?: ReactNode
|
|
27
|
+
children?: ReactNode
|
|
28
|
+
}) {
|
|
29
|
+
const id = useId()
|
|
30
|
+
return (
|
|
31
|
+
<section aria-labelledby={id} className="flex flex-col">
|
|
32
|
+
<div className="flex h-9 items-center gap-2 px-2 text-caption text-muted-foreground">
|
|
33
|
+
{/* Not a heading: the docs' table of contents collects every h1–h3 on the page. */}
|
|
34
|
+
<span id={id} className="min-w-0 truncate weight-medium text-foreground">
|
|
35
|
+
{title}
|
|
36
|
+
</span>
|
|
37
|
+
{meta && <span className="min-w-0 truncate tabular-nums">{meta}</span>}
|
|
38
|
+
{actions && <div className="-mr-1 ml-auto flex shrink-0 items-center gap-0.5">{actions}</div>}
|
|
39
|
+
</div>
|
|
40
|
+
{children}
|
|
41
|
+
</section>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** An icon-only ghost button with its label as a tooltip. */
|
|
46
|
+
export function IconAction({
|
|
47
|
+
icon: Icon,
|
|
48
|
+
label,
|
|
49
|
+
pressed,
|
|
50
|
+
onClick,
|
|
51
|
+
}: {
|
|
52
|
+
icon: IconComponent
|
|
53
|
+
label: string
|
|
54
|
+
pressed?: boolean
|
|
55
|
+
onClick?: () => void
|
|
56
|
+
}) {
|
|
57
|
+
return (
|
|
58
|
+
<Tooltip content={label} side="bottom">
|
|
59
|
+
<Button
|
|
60
|
+
variant="ghost"
|
|
61
|
+
size="icon-compact"
|
|
62
|
+
aria-label={label}
|
|
63
|
+
aria-pressed={pressed}
|
|
64
|
+
active={pressed}
|
|
65
|
+
onClick={onClick}
|
|
66
|
+
>
|
|
67
|
+
<Icon />
|
|
68
|
+
</Button>
|
|
69
|
+
</Tooltip>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** What a pane shows with nothing in it: a glyph, a line and what to do next. */
|
|
74
|
+
export function PaneEmpty({ icon, title, detail }: { icon: IconName; title: string; detail: string }) {
|
|
75
|
+
return <EmptyState size="compact" icon={useIcon(icon)} title={title} description={detail} />
|
|
76
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* A borderless button field with a trailing chevron, on modo-ui's field box:
|
|
3
|
+
* a row of pickers (profile, project, branch, model) reads as one strip of
|
|
4
|
+
* Select triggers. Forwards a popover or menu trigger's props.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import { useFieldBox } from '@justanarthur/modo-ui/lib/field-box'
|
|
10
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
11
|
+
import { type ButtonHTMLAttributes, forwardRef } from 'react'
|
|
12
|
+
import { useIcon } from './icons'
|
|
13
|
+
|
|
14
|
+
export const RowTrigger = forwardRef<HTMLButtonElement, ButtonHTMLAttributes<HTMLButtonElement>>(
|
|
15
|
+
({ children, className, disabled, ...props }, ref) => {
|
|
16
|
+
const field = useFieldBox({ variant: 'borderless', disabled })
|
|
17
|
+
const Chevron = useIcon('chevron-down')
|
|
18
|
+
return (
|
|
19
|
+
<button
|
|
20
|
+
ref={ref}
|
|
21
|
+
type="button"
|
|
22
|
+
disabled={disabled}
|
|
23
|
+
{...field.props}
|
|
24
|
+
className={cn(
|
|
25
|
+
field.props.className,
|
|
26
|
+
'flex cursor-pointer items-center outline-none focus-visible:ring-1 focus-visible:ring-focus-ring',
|
|
27
|
+
field.size.control,
|
|
28
|
+
field.size.text,
|
|
29
|
+
field.size.gap,
|
|
30
|
+
className,
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
<Chevron
|
|
36
|
+
size={field.size.icon}
|
|
37
|
+
strokeWidth={1.5}
|
|
38
|
+
className="shrink-0 text-muted-foreground transition-[color] duration-fast group-hover/field:text-foreground"
|
|
39
|
+
/>
|
|
40
|
+
</button>
|
|
41
|
+
)
|
|
42
|
+
},
|
|
43
|
+
)
|
|
44
|
+
RowTrigger.displayName = 'RowTrigger'
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the settings sections' shared row language. Plain lists
|
|
3
|
+
* (no frames) pulled back by their rows' padding so text lines up with the
|
|
4
|
+
* section heading; a label with a caption on the left, its state or control
|
|
5
|
+
* on the right. Toggles are a Switch.Group; anything with more to it is an
|
|
6
|
+
* Accordion.Group row that lifts into a card with its config, as the
|
|
7
|
+
* session board's rows do.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use client'
|
|
11
|
+
|
|
12
|
+
import { SurfaceProvider, useSurface } from '@justanarthur/modo-ui'
|
|
13
|
+
import Accordion from '@justanarthur/modo-ui/components/containers/accordion'
|
|
14
|
+
import Switch from '@justanarthur/modo-ui/components/inputs/switch'
|
|
15
|
+
import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
|
|
16
|
+
import { SURFACE_BG, SURFACE_SHADOW } from '@justanarthur/modo-ui/lib/surface-classes'
|
|
17
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
18
|
+
import Code from '@justanarthur/modo-ui/primitives/content/code'
|
|
19
|
+
import { createContext, type ReactNode, useContext, useState } from 'react'
|
|
20
|
+
|
|
21
|
+
export function Section({
|
|
22
|
+
title,
|
|
23
|
+
lead,
|
|
24
|
+
actions,
|
|
25
|
+
children,
|
|
26
|
+
}: {
|
|
27
|
+
title: string
|
|
28
|
+
lead: string
|
|
29
|
+
actions?: ReactNode
|
|
30
|
+
children: ReactNode
|
|
31
|
+
}) {
|
|
32
|
+
return (
|
|
33
|
+
<section className="flex flex-col gap-[var(--space-5)]">
|
|
34
|
+
<div className="flex items-start gap-[var(--space-3)]">
|
|
35
|
+
<div className="flex min-w-0 flex-1 flex-col gap-[var(--space-1)]">
|
|
36
|
+
<h1 className="m-0 text-title text-foreground">{title}</h1>
|
|
37
|
+
<p className="m-0 max-w-2xl text-body text-muted-foreground">{lead}</p>
|
|
38
|
+
</div>
|
|
39
|
+
{actions && <div className="flex shrink-0 gap-[var(--space-2)]">{actions}</div>}
|
|
40
|
+
</div>
|
|
41
|
+
<div className="flex flex-col gap-[var(--space-5)]">{children}</div>
|
|
42
|
+
</section>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** A captioned run of rows inside a section. */
|
|
47
|
+
export function Group({ title, aside, children }: { title: string; aside?: ReactNode; children: ReactNode }) {
|
|
48
|
+
return (
|
|
49
|
+
<section aria-label={title} className="flex flex-col gap-[var(--space-1)]">
|
|
50
|
+
<div className="flex items-baseline justify-between gap-[var(--space-2)] text-caption text-muted-foreground">
|
|
51
|
+
<span>{title}</span>
|
|
52
|
+
{aside}
|
|
53
|
+
</div>
|
|
54
|
+
{children}
|
|
55
|
+
</section>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Switch rows, unframed; pulled back by the rows' px-4 so labels line up with the heading. */
|
|
60
|
+
export function Toggles({ label, children }: { label: string; children: ReactNode }) {
|
|
61
|
+
return (
|
|
62
|
+
<div className="-mx-4">
|
|
63
|
+
<Switch.Group aria-label={label} className="w-full border-0">
|
|
64
|
+
{children}
|
|
65
|
+
</Switch.Group>
|
|
66
|
+
</div>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const OpenRows = createContext<string[]>([])
|
|
71
|
+
|
|
72
|
+
// Literal pairs, so UnoCSS sees them: the slot's width and the trigger's room for it.
|
|
73
|
+
const ACTION_SLOTS = {
|
|
74
|
+
// Narrow, a button folds to its icon.
|
|
75
|
+
button: { slot: 'w-8 @md:w-28', room: 'pr-12 @md:pr-32' },
|
|
76
|
+
icon: { slot: 'w-8', room: 'pr-12' },
|
|
77
|
+
} as const
|
|
78
|
+
|
|
79
|
+
type ActionKind = keyof typeof ACTION_SLOTS
|
|
80
|
+
|
|
81
|
+
const ActionSlot = createContext<ActionKind | undefined>(undefined)
|
|
82
|
+
|
|
83
|
+
/** Rows that open into a card with their config. `actions` keeps a slot at every row's end, so the chevrons line up. */
|
|
84
|
+
export function Details({
|
|
85
|
+
label,
|
|
86
|
+
actions,
|
|
87
|
+
defaultOpen = [],
|
|
88
|
+
children,
|
|
89
|
+
}: {
|
|
90
|
+
label: string
|
|
91
|
+
actions?: ActionKind
|
|
92
|
+
defaultOpen?: string[]
|
|
93
|
+
children: ReactNode
|
|
94
|
+
}) {
|
|
95
|
+
const [open, setOpen] = useState(defaultOpen)
|
|
96
|
+
return (
|
|
97
|
+
<OpenRows.Provider value={open}>
|
|
98
|
+
<ActionSlot.Provider value={actions}>
|
|
99
|
+
<div className="-mx-4">
|
|
100
|
+
<Accordion.Group
|
|
101
|
+
type="multiple"
|
|
102
|
+
value={open}
|
|
103
|
+
onValueChange={setOpen}
|
|
104
|
+
highlight="trigger"
|
|
105
|
+
aria-label={label}
|
|
106
|
+
className="w-full max-w-none"
|
|
107
|
+
>
|
|
108
|
+
{children}
|
|
109
|
+
</Accordion.Group>
|
|
110
|
+
</div>
|
|
111
|
+
</ActionSlot.Provider>
|
|
112
|
+
</OpenRows.Provider>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Visible on hover or focus of its row, always on touch. */
|
|
117
|
+
export const ON_HOVER =
|
|
118
|
+
'opacity-0 transition-opacity duration-fast group-hover/row:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100'
|
|
119
|
+
|
|
120
|
+
export function Row({
|
|
121
|
+
value,
|
|
122
|
+
index,
|
|
123
|
+
label,
|
|
124
|
+
caption,
|
|
125
|
+
meta,
|
|
126
|
+
action,
|
|
127
|
+
children,
|
|
128
|
+
}: {
|
|
129
|
+
value: string
|
|
130
|
+
index: number
|
|
131
|
+
label: ReactNode
|
|
132
|
+
caption?: ReactNode
|
|
133
|
+
/** State on the row's right: a badge, a size. */
|
|
134
|
+
meta?: ReactNode
|
|
135
|
+
/** A control beside the trigger, in the list's action slot. */
|
|
136
|
+
action?: ReactNode
|
|
137
|
+
/** The card's body when the row is open. */
|
|
138
|
+
children: ReactNode
|
|
139
|
+
}) {
|
|
140
|
+
const open = useContext(OpenRows).includes(value)
|
|
141
|
+
const slot = useContext(ActionSlot)
|
|
142
|
+
const shape = useShape()
|
|
143
|
+
const substrate = useSurface()
|
|
144
|
+
const level = Math.min(substrate + 2, 8)
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<Accordion.Item
|
|
148
|
+
value={value}
|
|
149
|
+
index={index}
|
|
150
|
+
className={cn(
|
|
151
|
+
// Open, the row lifts into a card; margin and padding cancel out sideways, so the row holds still.
|
|
152
|
+
'group/row transition-[margin,padding,background-color,box-shadow] duration-moderate',
|
|
153
|
+
open && ['-mx-1 my-[var(--space-2)] p-1', SURFACE_BG[level], SURFACE_SHADOW[3], shape.container],
|
|
154
|
+
)}
|
|
155
|
+
>
|
|
156
|
+
<SurfaceProvider value={open ? level : substrate}>
|
|
157
|
+
<div className="relative">
|
|
158
|
+
<Accordion.Trigger
|
|
159
|
+
className={cn(
|
|
160
|
+
'px-4 py-2.5 [&>span:first-child]:min-w-0 [&>span:first-child]:grid-cols-[minmax(0,1fr)]',
|
|
161
|
+
slot && ACTION_SLOTS[slot].room,
|
|
162
|
+
)}
|
|
163
|
+
>
|
|
164
|
+
<span className="flex min-w-0 items-center gap-[var(--space-3)]">
|
|
165
|
+
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
166
|
+
<span className="truncate weight-medium text-foreground">{label}</span>
|
|
167
|
+
{caption && (
|
|
168
|
+
<span className="truncate text-caption weight-normal text-muted-foreground">{caption}</span>
|
|
169
|
+
)}
|
|
170
|
+
</span>
|
|
171
|
+
{meta && (
|
|
172
|
+
<span className="flex shrink-0 items-center gap-[var(--space-3)] weight-normal text-muted-foreground">
|
|
173
|
+
{meta}
|
|
174
|
+
</span>
|
|
175
|
+
)}
|
|
176
|
+
</span>
|
|
177
|
+
</Accordion.Trigger>
|
|
178
|
+
{slot && (
|
|
179
|
+
// Beside the trigger, not in it: a press here never toggles the row.
|
|
180
|
+
<div
|
|
181
|
+
className={cn('absolute inset-y-0 right-4 z-20 flex items-center justify-end', ACTION_SLOTS[slot].slot)}
|
|
182
|
+
>
|
|
183
|
+
{action}
|
|
184
|
+
</div>
|
|
185
|
+
)}
|
|
186
|
+
</div>
|
|
187
|
+
<Accordion.Content>
|
|
188
|
+
<div className="flex flex-col gap-[var(--space-3)] px-1 pt-[var(--space-1)]">{children}</div>
|
|
189
|
+
</Accordion.Content>
|
|
190
|
+
</SurfaceProvider>
|
|
191
|
+
</Accordion.Item>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** An open row's config: a caption label on the left, its value on the right. */
|
|
196
|
+
export function Facts({ items }: { items: [string, ReactNode][] }) {
|
|
197
|
+
return (
|
|
198
|
+
<dl className="m-0 grid grid-cols-[minmax(0,6rem)_minmax(0,1fr)] items-baseline gap-x-[var(--space-4)] gap-y-[var(--space-2)] text-body">
|
|
199
|
+
{items.map(([term, value]) => (
|
|
200
|
+
<div key={term} className="contents">
|
|
201
|
+
<dt className="text-caption text-muted-foreground">{term}</dt>
|
|
202
|
+
<dd className="m-0 min-w-0 break-words text-foreground">{value}</dd>
|
|
203
|
+
</div>
|
|
204
|
+
))}
|
|
205
|
+
</dl>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** Code inside an open row's card: a sunken well, since in light every surface from the card up is white. */
|
|
210
|
+
export function CardCode({ language, children }: { language: string; children: string }) {
|
|
211
|
+
return (
|
|
212
|
+
<Code language={language} className="bg-sunken">
|
|
213
|
+
{children}
|
|
214
|
+
</Code>
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export function Mono({ children }: { children: ReactNode }) {
|
|
219
|
+
return <span className="font-mono text-caption">{children}</span>
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** The card's last line: where the setting lives, and what you can do to it. */
|
|
223
|
+
export function Footer({ source, children }: { source: string; children: ReactNode }) {
|
|
224
|
+
return (
|
|
225
|
+
<div className="flex min-w-0 flex-wrap items-center gap-[var(--space-2)]">
|
|
226
|
+
<span className="min-w-0 flex-1 truncate text-caption text-muted-foreground">
|
|
227
|
+
In <span className="font-mono">{source}</span>
|
|
228
|
+
</span>
|
|
229
|
+
<div className="flex shrink-0 gap-[var(--space-1)]">{children}</div>
|
|
230
|
+
</div>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the side pane's data shapes — the session's changed files,
|
|
3
|
+
* an open file, a shell, a pull request with its checks and reviews,
|
|
4
|
+
* artifacts and background tasks. The pane blocks take these through props;
|
|
5
|
+
* the pages fill them from mock/mock-panes.ts.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface PaneChange {
|
|
9
|
+
path: string
|
|
10
|
+
status: 'added' | 'modified' | 'deleted'
|
|
11
|
+
staged: boolean
|
|
12
|
+
patch: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface PaneFile {
|
|
16
|
+
path: string
|
|
17
|
+
language: string
|
|
18
|
+
source: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ShellEntry {
|
|
22
|
+
command: string
|
|
23
|
+
output: string[]
|
|
24
|
+
/** Non-zero when the command failed. Defaults to 0. */
|
|
25
|
+
exit?: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PaneShell {
|
|
29
|
+
/** The shell's name, as the section title. */
|
|
30
|
+
name: string
|
|
31
|
+
cwd: string
|
|
32
|
+
/** What the prompt shows before `$`. */
|
|
33
|
+
prompt: string
|
|
34
|
+
history: ShellEntry[]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PaneCheck {
|
|
38
|
+
name: string
|
|
39
|
+
status: 'success' | 'running' | 'failed'
|
|
40
|
+
/** The run time, or what it is doing while it runs. */
|
|
41
|
+
detail: string
|
|
42
|
+
/** The tail of the check's log. */
|
|
43
|
+
log: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface PaneReview {
|
|
47
|
+
author: string
|
|
48
|
+
where: string
|
|
49
|
+
body: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface PanePullRequest {
|
|
53
|
+
number: number
|
|
54
|
+
title: string
|
|
55
|
+
branch: string
|
|
56
|
+
base: string
|
|
57
|
+
checks: PaneCheck[]
|
|
58
|
+
reviews: PaneReview[]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type ArtifactKind = 'page' | 'dashboard' | 'document' | 'diagram'
|
|
62
|
+
|
|
63
|
+
export interface PaneArtifact {
|
|
64
|
+
title: string
|
|
65
|
+
kind: ArtifactKind
|
|
66
|
+
updated: string
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface PaneTask {
|
|
70
|
+
id: string
|
|
71
|
+
title: string
|
|
72
|
+
kind: 'agent' | 'shell' | 'session'
|
|
73
|
+
status: 'running' | 'done' | 'failed' | 'stopped'
|
|
74
|
+
detail: string
|
|
75
|
+
}
|