@timbal-ai/timbal-react 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +51 -5
- package/dist/app.cjs +1750 -1157
- package/dist/app.d.cts +2 -2
- package/dist/app.d.ts +2 -2
- package/dist/app.esm.js +27 -5
- package/dist/{button-CIKzUrJI.d.cts → button-ClSgD6OF.d.cts} +1 -1
- package/dist/{button-CIKzUrJI.d.ts → button-ClSgD6OF.d.ts} +1 -1
- package/dist/{chart-artifact-C2m891nx.d.cts → chart-artifact-DWkqIAK5.d.cts} +165 -1
- package/dist/{chart-artifact-CqqhdSR9.d.ts → chart-artifact-DwfRtQWL.d.ts} +165 -1
- package/dist/chat.esm.js +3 -3
- package/dist/{chunk-VVTTLIGT.esm.js → chunk-5ZKLPWVN.esm.js} +1 -1
- package/dist/{chunk-ZG5NBHOS.esm.js → chunk-CFU3YDTV.esm.js} +2 -2
- package/dist/{chunk-ZEDE2TWQ.esm.js → chunk-GBBLAM3G.esm.js} +954 -378
- package/dist/{chunk-YNDXBN6C.esm.js → chunk-OISVICYF.esm.js} +1 -1
- package/dist/{chunk-LSEUKTU5.esm.js → chunk-P4SN7M67.esm.js} +1 -1
- package/dist/{chunk-Z27GBSOT.esm.js → chunk-QIABF4KB.esm.js} +53 -51
- package/dist/{chunk-QKO67F4V.esm.js → chunk-QVAUCVQA.esm.js} +93 -93
- package/dist/{chunk-4AO3HCAR.esm.js → chunk-VWHHKAHN.esm.js} +5 -5
- package/dist/index.cjs +1006 -418
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +30 -8
- package/dist/studio.cjs +3 -1
- package/dist/studio.esm.js +6 -6
- package/dist/ui.d.cts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.esm.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@timbal-ai/timbal-react` are documented here.
|
|
4
4
|
|
|
5
|
+
## [0.8.1] — 2026-06-02
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Programmatic theming** — derive a complete, paired light + dark palette from a single brand color so apps and UI-generation agents never hand-author OKLCH or risk a light-only override:
|
|
10
|
+
- **`createTimbalTheme({ brand, accent?, radius?, tintNeutrals? })`** — owns the OKLCH math for `--primary`, its foreground, `--ring`, the full primary button gradient, and the soft playground tint. Returns paired `{ light, dark, root }` token maps.
|
|
11
|
+
- **`themeToCss(theme, { scope? })`** — serialize to a paired `:root` / `.dark` (or `[data-timbal-theme]`-scoped) CSS string for build-time/SSR.
|
|
12
|
+
- **`applyTimbalTheme(theme)` / `clearTimbalTheme()`** — runtime apply via a managed `<style>` (works with the `.dark` toggle); returns a disposer.
|
|
13
|
+
- **`TimbalThemeStyle`** — render a generated theme (or `preset`) as a `<style>` near the app root.
|
|
14
|
+
- **`TIMBAL_THEME_PRESETS`** + **`getThemePreset`**, **`applyThemePreset`**, **`getStoredThemePreset`** — a closed catalog (`platform`, `indigo`, `violet`, `forest`, `warm`, `slate`) to offer styles by stable id; persists to `STORAGE_KEYS.themePreset` (`timbal-theme-preset`).
|
|
15
|
+
- **`ThemePresetGallery`** — preview + pick presets with real-component swatches, scoped so the live app doesn't change until selection.
|
|
16
|
+
- **`THEME_AGENT_INSTRUCTIONS`** — system-prompt text directing UI-generation agents to theme via these APIs, never raw OKLCH.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
5
20
|
## [0.8.0] — 2026-06-02
|
|
6
21
|
|
|
7
22
|
### Added
|
package/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
React components and runtime for building Timbal chat UIs and studio apps. Drop in a single component to get a fully-featured streaming chat interface connected to a Timbal workforce agent, or compose dashboards with the **app kit**.
|
|
4
4
|
|
|
5
|
-
## Package structure (0.
|
|
5
|
+
## Package structure (0.8+)
|
|
6
6
|
|
|
7
7
|
| Subpath | Use when |
|
|
8
8
|
|---------|----------|
|
|
9
9
|
| `@timbal-ai/timbal-react` | Full surface (chat shells, auth, artifacts, app kit) |
|
|
10
10
|
| `@timbal-ai/timbal-react/chat` | Chat-only apps — `Thread`, `Composer`, runtime, layout helpers |
|
|
11
11
|
| `@timbal-ai/timbal-react/studio` | Studio chrome — `TimbalChatShell`, `TimbalStudioShell`, sidebar |
|
|
12
|
-
| `@timbal-ai/timbal-react/ui` | Primitives — `Button`, `Dialog`, `Avatar`, `Shimmer` |
|
|
12
|
+
| `@timbal-ai/timbal-react/ui` | Primitives — `Button`, `Dialog`, `DropdownMenu`, `Popover`, `Select`, `Tooltip`, `Avatar`, `Shimmer` |
|
|
13
13
|
| `@timbal-ai/timbal-react/app` | Dashboards — `AppShell`, `Page`, `DataTable`, `StatTile`, … |
|
|
14
14
|
| `@timbal-ai/timbal-react/styles.css` | Theme tokens (required once) |
|
|
15
15
|
|
|
@@ -71,6 +71,45 @@ Every token has a CSS-variable indirection in `styles.css`. Override individual
|
|
|
71
71
|
|
|
72
72
|
Both light AND dark blocks must be defined for every overridden token — otherwise toggling dark mode produces an inconsistent UI. The library prints a one-time dev-only console warning when it detects a mismatch.
|
|
73
73
|
|
|
74
|
+
### Programmatic theming (no hand-authored OKLCH)
|
|
75
|
+
|
|
76
|
+
Instead of hand-writing paired `:root` / `.dark` blocks, derive a complete, contrast-correct palette from a single brand color. The package owns the OKLCH math for every token (primary, foreground, ring, the full button gradient, the playground tint):
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { createTimbalTheme, themeToCss, applyTimbalTheme } from "@timbal-ai/timbal-react";
|
|
80
|
+
|
|
81
|
+
const theme = createTimbalTheme({ brand: "#4f46e5", radius: 0.75 });
|
|
82
|
+
|
|
83
|
+
// Build-time / SSR — paste into index.css (paired light + dark, always in sync):
|
|
84
|
+
const css = themeToCss(theme);
|
|
85
|
+
|
|
86
|
+
// Runtime — inject a managed <style>, swappable, returns a disposer:
|
|
87
|
+
const dispose = applyTimbalTheme(theme);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or render it as a component near your app root:
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import { TimbalThemeStyle } from "@timbal-ai/timbal-react";
|
|
94
|
+
|
|
95
|
+
<TimbalThemeStyle theme={createTimbalTheme({ brand: "#4f46e5" })} />
|
|
96
|
+
// or: <TimbalThemeStyle preset="indigo" />
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Presets + the picker
|
|
100
|
+
|
|
101
|
+
A small closed catalog (`TIMBAL_THEME_PRESETS`: `platform`, `indigo`, `violet`, `forest`, `warm`, `slate`) lets you offer styles by stable id and apply on selection. `ThemePresetGallery` previews each option with real components, scoped so the live app doesn't change until the user picks:
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { ThemePresetGallery, applyThemePreset } from "@timbal-ai/timbal-react";
|
|
105
|
+
|
|
106
|
+
<ThemePresetGallery value={id} onSelect={(next) => { setId(next); applyThemePreset(next); }} />
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`applyThemePreset` persists the choice to `localStorage` (`timbal-theme-preset`); `getStoredThemePreset()` restores it on reload.
|
|
110
|
+
|
|
111
|
+
**For UI-generation agents:** inject `THEME_AGENT_INSTRUCTIONS` into the system prompt so the model themes via these APIs (and never emits raw OKLCH), mirroring `APP_KIT_AGENT_INSTRUCTIONS`.
|
|
112
|
+
|
|
74
113
|
### CSS imports
|
|
75
114
|
|
|
76
115
|
Import these stylesheets once in your app entry:
|
|
@@ -800,9 +839,16 @@ if (res.ok) {
|
|
|
800
839
|
|
|
801
840
|
### UI primitives
|
|
802
841
|
|
|
803
|
-
|
|
842
|
+
Radix-backed wrappers pre-styled with the design tokens (`bg-popover`, `border-border`, `shadow-card`, …) — import from `@timbal-ai/timbal-react/ui` or the root. Use these instead of `npx shadcn`; raw shadcn references token names the app doesn't define and renders unstyled.
|
|
804
843
|
|
|
805
|
-
|
|
844
|
+
- **Button:** `Button`
|
|
845
|
+
- **Dialog:** `Dialog` · `DialogTrigger` · `DialogContent` · `DialogTitle` · `DialogDescription` · `DialogHeader` · `DialogFooter` · `DialogClose` · `DialogOverlay` · `DialogPortal`
|
|
846
|
+
- **Dropdown menu:** `DropdownMenu` · `DropdownMenuTrigger` · `DropdownMenuContent` · `DropdownMenuItem` · `DropdownMenuCheckboxItem` · `DropdownMenuRadioGroup` · `DropdownMenuRadioItem` · `DropdownMenuLabel` · `DropdownMenuSeparator` · `DropdownMenuShortcut` · `DropdownMenuGroup` · `DropdownMenuSub` · `DropdownMenuSubTrigger` · `DropdownMenuSubContent`
|
|
847
|
+
- **Popover:** `Popover` · `PopoverTrigger` · `PopoverContent` · `PopoverAnchor`
|
|
848
|
+
- **Select:** `Select` · `SelectTrigger` · `SelectValue` · `SelectContent` · `SelectItem` · `SelectGroup` · `SelectLabel` · `SelectSeparator` · `SelectScrollUpButton` · `SelectScrollDownButton`
|
|
849
|
+
- **Tooltip:** `Tooltip` · `TooltipTrigger` · `TooltipContent` · `TooltipProvider`
|
|
850
|
+
- **Avatar:** `Avatar` · `AvatarImage` · `AvatarFallback`
|
|
851
|
+
- **Misc:** `Shimmer`
|
|
806
852
|
|
|
807
853
|
---
|
|
808
854
|
|
|
@@ -976,7 +1022,7 @@ The following symbols are no longer exported. Most have no replacement because t
|
|
|
976
1022
|
|
|
977
1023
|
- All `STUDIO_*` layout constants (`STUDIO_SIDEBAR_WIDTH`, `STUDIO_INSET_LEFT`, `STUDIO_SIDEBAR_COLLAPSED_STORAGE_KEY`, `STUDIO_SIDEBAR_PX_*`, …) — override the matching `--studio-*` CSS variables instead.
|
|
978
1024
|
- All `studio*Class` / `studioChromeShellStyle` helpers — re-create the look with normal Tailwind classes against semantic tokens (`bg-elevated-from`, `border-border`, `shadow-card`, …).
|
|
979
|
-
- All `TIMBAL_V2_*` button token records and `TimbalV2Button` — use the standard `Button` export from this package; it covers the same variants.
|
|
1025
|
+
- All `TIMBAL_V2_*` button token records and `TimbalV2Button` — use the standard `Button` export from this package; it covers the same variants. (Note: `TimbalV2Button` and several `TIMBAL_V2_*` surface tokens were re-introduced as public exports in 0.7 for catalog/list surfaces — see the CHANGELOG.)
|
|
980
1026
|
- `StudioSidebarPanel`, `StudioSidebarHeader/Nav/Footer/Entries/Backdrop/Tooltip/RuntimePortal/EntryMotion`, `StudioSidebarContext`, `useStudioSidebarLayout`, `useStudioSidebarCollapsed`, `useSidebarCollapsePhase`, `workforceItemId/Label/Initial` — use `StudioSidebar` or `TimbalStudioShell` directly.
|
|
981
1027
|
- `runThemeSanityCheck` — `<Thread>` already schedules the dev-only check.
|
|
982
1028
|
- `SyntaxHighlighter`, `UserMessageAttachments`, `ComposerAttachments`, `ComposerAddAttachment`, `MessagePartPrimitive`, `ActionBarMorePrimitive`, `ErrorPrimitive`, `useAuiState`, `buttonVariants` — internal composer/markdown details. Override the `Composer` / `AssistantMessage` slot via the `components` prop if you need a custom layout.
|