@workerdeck/ui 0.6.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/README.md +74 -0
- package/build/index.d.mts +927 -0
- package/build/index.mjs +5236 -0
- package/build/index.mjs.map +1 -0
- package/package.json +73 -0
- package/src/components/agent/Composer.tsx +139 -0
- package/src/components/agent/Conversation.tsx +59 -0
- package/src/components/agent/FileCard.tsx +50 -0
- package/src/components/agent/Loader.tsx +21 -0
- package/src/components/agent/Message.tsx +44 -0
- package/src/components/agent/ModelSelect.tsx +87 -0
- package/src/components/agent/PermissionModeSelect.tsx +94 -0
- package/src/components/agent/PermissionPrompt.tsx +52 -0
- package/src/components/agent/QuestionPrompt.tsx +193 -0
- package/src/components/agent/Reasoning.tsx +58 -0
- package/src/components/agent/Response.tsx +31 -0
- package/src/components/agent/SessionList.tsx +93 -0
- package/src/components/agent/SessionPanel.tsx +149 -0
- package/src/components/agent/StatusBar.tsx +140 -0
- package/src/components/agent/ToolCallCard.tsx +94 -0
- package/src/components/agent/Transcript.tsx +114 -0
- package/src/components/agent/status.ts +16 -0
- package/src/components/prompt-area/animated-placeholder.tsx +42 -0
- package/src/components/prompt-area/clipboard-helpers.ts +206 -0
- package/src/components/prompt-area/cursor-helpers.ts +244 -0
- package/src/components/prompt-area/dom-helpers.ts +721 -0
- package/src/components/prompt-area/file-strip.tsx +250 -0
- package/src/components/prompt-area/html-to-markdown.ts +278 -0
- package/src/components/prompt-area/image-strip.tsx +49 -0
- package/src/components/prompt-area/index.ts +23 -0
- package/src/components/prompt-area/prompt-area-engine.ts +705 -0
- package/src/components/prompt-area/prompt-area-list-ops.ts +499 -0
- package/src/components/prompt-area/prompt-area.tsx +375 -0
- package/src/components/prompt-area/remove-button.tsx +37 -0
- package/src/components/prompt-area/segment-helpers.ts +62 -0
- package/src/components/prompt-area/trigger-popover.tsx +139 -0
- package/src/components/prompt-area/trigger-presets.ts +143 -0
- package/src/components/prompt-area/types.ts +360 -0
- package/src/components/prompt-area/use-markdown-mode.ts +113 -0
- package/src/components/prompt-area/use-prompt-area-events.ts +470 -0
- package/src/components/prompt-area/use-prompt-area-state.ts +131 -0
- package/src/components/prompt-area/use-prompt-area.ts +1507 -0
- package/src/components/prompt-area/use-trigger-search.ts +115 -0
- package/src/components/ui/AlertDialog.tsx +56 -0
- package/src/components/ui/Badge.tsx +42 -0
- package/src/components/ui/Button.tsx +47 -0
- package/src/components/ui/Card.tsx +29 -0
- package/src/components/ui/CodeBlock.tsx +31 -0
- package/src/components/ui/CopyButton.tsx +28 -0
- package/src/components/ui/Input.tsx +20 -0
- package/src/components/ui/ProgressRing.tsx +49 -0
- package/src/components/ui/Select.tsx +80 -0
- package/src/components/ui/Sonner.tsx +22 -0
- package/src/components/ui/Spinner.tsx +6 -0
- package/src/components/ui/Textarea.tsx +21 -0
- package/src/components/ui/Tooltip.tsx +34 -0
- package/src/index.ts +99 -0
- package/src/lib/format.ts +67 -0
- package/src/lib/utils.ts +33 -0
- package/src/styles/theme.css +413 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tobias Strebitzer
|
|
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
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @workerdeck/ui
|
|
2
|
+
|
|
3
|
+
Styled agent-control component library for WorkerDeck hosts: `SessionPanel` (status bar +
|
|
4
|
+
streaming transcript + tool-call cards + permission prompts + composer), `SessionList`, and the
|
|
5
|
+
underlying primitives (Button, Badge, Card, Select, AlertDialog, …). Built on **Tailwind v4 +
|
|
6
|
+
Base UI + cva**, themed by CSS tokens with light/dark via `<html data-theme>`.
|
|
7
|
+
|
|
8
|
+
The headless layer (`useClaudeSession`, transcript reducer) lives in `@workerdeck/react`;
|
|
9
|
+
this package is the styling opinion on top.
|
|
10
|
+
|
|
11
|
+
## Consumer wiring (Tailwind v4)
|
|
12
|
+
|
|
13
|
+
The package ships **source styles + source classnames** — your app's Tailwind build compiles
|
|
14
|
+
them. Three steps:
|
|
15
|
+
|
|
16
|
+
1. Your Tailwind entry CSS:
|
|
17
|
+
|
|
18
|
+
```css
|
|
19
|
+
@import 'tailwindcss';
|
|
20
|
+
@import '@workerdeck/ui/theme.css';
|
|
21
|
+
/* Let Tailwind see this package's classnames (node_modules is not scanned by default). */
|
|
22
|
+
@source '../node_modules/@workerdeck/ui';
|
|
23
|
+
/* streamdown (the markdown renderer) also styles itself with Tailwind classes, split across
|
|
24
|
+
* chunk files — scan its whole dist dir. With npm/yarn it's hoisted to node_modules/streamdown;
|
|
25
|
+
* with pnpm it's nested under this package: */
|
|
26
|
+
@source '../node_modules/@workerdeck/ui/node_modules/streamdown/dist';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Inside this monorepo, point `@source` at the package source instead:
|
|
30
|
+
`@source '../../packages/ui/src';` plus
|
|
31
|
+
`@source '../../packages/ui/node_modules/streamdown/dist';`
|
|
32
|
+
|
|
33
|
+
2. Set the theme attribute before first paint (no-flash), e.g. in `index.html`:
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<script>
|
|
37
|
+
;(function () {
|
|
38
|
+
var t = localStorage.getItem('my-app.theme')
|
|
39
|
+
var dark = t === 'dark' || (t !== 'light' && matchMedia('(prefers-color-scheme: dark)').matches)
|
|
40
|
+
document.documentElement.setAttribute('data-theme', dark ? 'dark' : 'light')
|
|
41
|
+
})()
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
3. Fonts (optional but recommended): the tokens reference Inter + JetBrains Mono with safe
|
|
46
|
+
fallbacks. Import `@fontsource/inter/{400,500,600,700}.css` and
|
|
47
|
+
`@fontsource/jetbrains-mono/{400,500,600}.css` in your app to get the real faces.
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { WorkerDeckClient } from '@workerdeck/client'
|
|
53
|
+
import { SessionPanel } from '@workerdeck/ui'
|
|
54
|
+
|
|
55
|
+
const client = new WorkerDeckClient({ baseUrl: `${location.origin}/v1` })
|
|
56
|
+
|
|
57
|
+
<SessionPanel key={sessionId} client={client} sessionId={sessionId} />
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Every component takes `className` and carries `data-slot` attributes for targeted overrides.
|
|
61
|
+
|
|
62
|
+
`SessionPanel` is self-sufficient for errors: a `protocol_error` (the gateway or CLI refusing a
|
|
63
|
+
command — a `set_permission_mode` a provider engine can't run, say) renders as a dismissible strip
|
|
64
|
+
inside the panel. You do **not** need to mount anything else to see them. `Toaster` is exported
|
|
65
|
+
for your own `toast()` calls; the panel never depends on it, because an error channel a host can
|
|
66
|
+
lose by forgetting a second mount isn't one.
|
|
67
|
+
|
|
68
|
+
## Caveats
|
|
69
|
+
|
|
70
|
+
- Token names are unprefixed (`--bg`, `--accent`, `--primary`, …) and `theme.css` styles
|
|
71
|
+
`body`/focus rings. Embedding into an app with its own conflicting design system may need
|
|
72
|
+
scoping — file an issue with your case.
|
|
73
|
+
- Dark mode is driven **only** by `[data-theme='dark']` on the root element (the Tailwind
|
|
74
|
+
`dark:` variant is remapped to it); `prefers-color-scheme` is not consulted at CSS level.
|