inline-chat-kit 0.49.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/CHANGELOG.md +2111 -0
- package/LICENSE +21 -0
- package/README.md +1430 -0
- package/dist/AnswerActions/AnswerActions.d.ts +35 -0
- package/dist/Approval/Approval.d.ts +42 -0
- package/dist/Artifact/ArtifactCard.d.ts +45 -0
- package/dist/Artifact/ArtifactPane.d.ts +50 -0
- package/dist/Artifact/ChatLayout.d.ts +35 -0
- package/dist/Artifact/useArtifacts.d.ts +21 -0
- package/dist/Attachments/Attachments.d.ts +50 -0
- package/dist/Branch/Branch.d.ts +28 -0
- package/dist/Button/Button.d.ts +23 -0
- package/dist/ChainOfThought/ChainOfThought.d.ts +49 -0
- package/dist/ChatHeader/ChatHeader.d.ts +89 -0
- package/dist/ChatInput/AddCardsOverlay.d.ts +11 -0
- package/dist/ChatInput/ChatInput.d.ts +118 -0
- package/dist/ChatInput/HoverActionsRow.d.ts +13 -0
- package/dist/ChatInput/MorphGlyph.d.ts +15 -0
- package/dist/ChatTurnRow/ChatTurnRow.d.ts +115 -0
- package/dist/Chip/Chip.d.ts +7 -0
- package/dist/CodeBlock/CodeBlock.d.ts +24 -0
- package/dist/CodeBlock/grammars.d.ts +16 -0
- package/dist/CodeBlock/highlight.d.ts +38 -0
- package/dist/Context/Context.d.ts +36 -0
- package/dist/Conversation/Conversation.d.ts +64 -0
- package/dist/CustomCursor/CustomCursor.d.ts +1 -0
- package/dist/EmptyState/EmptyState.d.ts +24 -0
- package/dist/GlassButton/GlassButton.d.ts +19 -0
- package/dist/InlineCitation/InlineCitation.d.ts +30 -0
- package/dist/Loader/Loader.d.ts +23 -0
- package/dist/QuestionCard/QuestionCard.d.ts +32 -0
- package/dist/QuestionCard/parts.d.ts +84 -0
- package/dist/QuestionCard/types.d.ts +54 -0
- package/dist/QuestionGroup/QuestionGroup.d.ts +87 -0
- package/dist/Reasoning/Reasoning.d.ts +37 -0
- package/dist/ReplyThreadPopup/ReplyThreadPopup.d.ts +18 -0
- package/dist/Sources/Sources.d.ts +46 -0
- package/dist/SystemMessage/SystemMessage.d.ts +39 -0
- package/dist/TaskList/TaskList.d.ts +42 -0
- package/dist/TextHighlighter/TextHighlighter.d.ts +17 -0
- package/dist/Tool/Tool.d.ts +41 -0
- package/dist/announce/announce.d.ts +27 -0
- package/dist/disclosure/DisclosureBody.d.ts +22 -0
- package/dist/disclosure/DisclosureHeader.d.ts +42 -0
- package/dist/disclosure/useDisclosure.d.ts +30 -0
- package/dist/duration/formatDuration.d.ts +9 -0
- package/dist/grammars-B19jp7qm.js +3181 -0
- package/dist/grammars-B19jp7qm.js.map +1 -0
- package/dist/index.d.ts +80 -0
- package/dist/inline-chat-kit.css +2 -0
- package/dist/inline-chat-kit.js +5314 -0
- package/dist/inline-chat-kit.js.map +1 -0
- package/dist/markdown/parse.d.ts +105 -0
- package/dist/markdown/parseMarkdown.d.ts +47 -0
- package/dist/radiusCorrection/useCorrectedRadius.d.ts +24 -0
- package/dist/reducedMotion/reducedMotion.d.ts +3 -0
- package/dist/stateGlyph/StateGlyph.d.ts +23 -0
- package/dist/turnParts/turnParts.d.ts +156 -0
- package/dist/useChatTurns/useChatTurns.d.ts +127 -0
- package/dist/voice/useVoiceInput.d.ts +79 -0
- package/package.json +95 -0
- package/theming.md +234 -0
package/theming.md
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Theming
|
|
2
|
+
|
|
3
|
+
The kit reads CSS custom properties. That is the whole interface — no provider,
|
|
4
|
+
no build step, no JavaScript API. Set them on `:root` and you are done.
|
|
5
|
+
|
|
6
|
+
```css
|
|
7
|
+
:root {
|
|
8
|
+
--ick-ink-rgb: 20 20 24;
|
|
9
|
+
--ick-paper-rgb: 253 252 250;
|
|
10
|
+
--ick-marker-rgb: 120 200 255;
|
|
11
|
+
--ick-font-sans: "Inter", system-ui, sans-serif;
|
|
12
|
+
--ick-radius-xl: 12px;
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Everything the kit paints is derived from those, so a handful of lines moves
|
|
17
|
+
the whole thing. You do not have to override a hundred tokens to look like
|
|
18
|
+
yourself, and there is no specificity fight: the kit's defaults sit in a named
|
|
19
|
+
cascade layer, and any unlayered rule in your app beats them whatever the
|
|
20
|
+
import order.
|
|
21
|
+
|
|
22
|
+
## The ones worth knowing
|
|
23
|
+
|
|
24
|
+
Colours are built from **channel triplets** rather than finished colours, so
|
|
25
|
+
one line moves every tint and every alpha step derived from it.
|
|
26
|
+
|
|
27
|
+
| Token | What it moves |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `--ick-ink-rgb` | every shade of text, every hover wash, every border |
|
|
30
|
+
| `--ick-paper-rgb` | surfaces, and the light side of glass |
|
|
31
|
+
| `--ick-marker-rgb` | the highlighter — its stroke, its glow, its keyboard selection |
|
|
32
|
+
| `--ick-font-sans` | the interface font |
|
|
33
|
+
| `--ick-font-mono` | labels and the glass buttons |
|
|
34
|
+
| `--ick-radius-pill` … `--ick-radius-xs` | how round everything is |
|
|
35
|
+
| `--ick-glass-rim-rgb` / `--ick-glass-shade-rgb` | what glass is lit by, and lit against |
|
|
36
|
+
|
|
37
|
+
Write triplets **without commas** — `20 20 24`, not `20, 20, 24` — because
|
|
38
|
+
they are used as `rgb(var(--ick-ink-rgb) / 0.6)`.
|
|
39
|
+
|
|
40
|
+
## A brand, in practice
|
|
41
|
+
|
|
42
|
+
Three invented ones live in Storybook under **Design tokens → Themes**, side by
|
|
43
|
+
side with the default. They set between six and nine tokens each and nothing
|
|
44
|
+
component-specific — which is the claim, rendered rather than asserted:
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
/* "Ledger": warm, editorial, and a highlighter that looks like one. */
|
|
48
|
+
:root {
|
|
49
|
+
--ick-ink-rgb: 38 32 26;
|
|
50
|
+
--ick-paper-rgb: 250 246 238;
|
|
51
|
+
--ick-marker-rgb: 255 176 46;
|
|
52
|
+
--ick-font-sans: "Iowan Old Style", Georgia, serif;
|
|
53
|
+
--ick-font-mono: "SF Mono", ui-monospace, monospace;
|
|
54
|
+
--ick-radius-xl: 10px;
|
|
55
|
+
--ick-radius-lg: 8px;
|
|
56
|
+
--ick-radius-pill: 8px;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Theming part of a page
|
|
61
|
+
|
|
62
|
+
Put the overrides on `:root` for the whole document, or on any element with
|
|
63
|
+
**`class="ick-theme"`** for a subtree:
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<div class="ick-theme" style="--ick-marker-rgb: 255 64 160">
|
|
67
|
+
<!-- the kit is pink in here, and unchanged everywhere else -->
|
|
68
|
+
</div>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The class is required, and the reason is worth knowing because it is not
|
|
72
|
+
obvious. A derived token like `--ick-marker` is substituted where it is
|
|
73
|
+
*declared*, and the finished value is what inherits — so setting
|
|
74
|
+
`--ick-marker-rgb` on a wrapper without the class changes the channel and
|
|
75
|
+
nothing else. `.ick-theme` re-declares the derived tokens on that element, so
|
|
76
|
+
they recompute from whatever it inherits. Only elements carrying the class pay
|
|
77
|
+
for it.
|
|
78
|
+
|
|
79
|
+
`data-theme` works on such an element too, so a subtree can be dark on a light
|
|
80
|
+
page.
|
|
81
|
+
|
|
82
|
+
## Everything else
|
|
83
|
+
|
|
84
|
+
The complete list, with every value resolved live in the current theme, is the
|
|
85
|
+
first entry in Storybook:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm run storybook --workspace packages/inline-chat-kit
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
It is read out of the stylesheets rather than written by hand, so it cannot
|
|
92
|
+
drift from what the components actually use.
|
|
93
|
+
|
|
94
|
+
## Dark
|
|
95
|
+
|
|
96
|
+
Three states, and you choose how much of it you want:
|
|
97
|
+
|
|
98
|
+
- **Nothing set** — the kit follows `prefers-color-scheme`.
|
|
99
|
+
- **`data-theme="light"` or `.light`** on the root — pinned light, whatever
|
|
100
|
+
the system says.
|
|
101
|
+
- **`data-theme="dark"` or `.dark`** — pinned dark. `.dark` is there because
|
|
102
|
+
Tailwind projects already have it.
|
|
103
|
+
|
|
104
|
+
The dark palette is one block of `--ick-dark-*` values; both rules assign from
|
|
105
|
+
it rather than restating it. To adjust dark without touching light, override
|
|
106
|
+
those:
|
|
107
|
+
|
|
108
|
+
```css
|
|
109
|
+
:root {
|
|
110
|
+
--ick-dark-ink-rgb: 240 238 235;
|
|
111
|
+
--ick-dark-paper-rgb: 24 22 28;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Two things that deliberately do not follow the theme
|
|
116
|
+
|
|
117
|
+
Not an oversight in either case:
|
|
118
|
+
|
|
119
|
+
- **The cursor** (`--ick-cursor-fill`, `--ick-cursor-ink`) is drawn over
|
|
120
|
+
content the kit does not control. It keeps a light body and a dark outline in
|
|
121
|
+
both themes for the same reason road signs do — it has to stay legible
|
|
122
|
+
against anything.
|
|
123
|
+
- **Text on the marker** (`--ick-marker-ink`). Where the marker is a surface —
|
|
124
|
+
a badge, a chosen row, a citation chip — it is the same colour in both
|
|
125
|
+
themes, so the words on it stay dark or they stop being readable.
|
|
126
|
+
|
|
127
|
+
One thing does change, and it is the exception worth knowing about. The
|
|
128
|
+
**stroke drawn across an answer** (`--ick-marker-stroke`, `--ick-marker-blend`,
|
|
129
|
+
`--ick-marker-active-ink`) is the only place the marker composites with live
|
|
130
|
+
text rather than sitting behind it, and the two themes need opposite physics.
|
|
131
|
+
|
|
132
|
+
Light multiplies: the stroke keeps its hue and the words come through
|
|
133
|
+
darkened. That works because the page's ink is darker than the marker. In the
|
|
134
|
+
dark theme it is not, and the blend inverts figure and ground — measured in
|
|
135
|
+
Chrome, the band came out `rgb(169 198 19)` with the words on it
|
|
136
|
+
`rgb(217 245 73)`, the text *brighter* than the stroke, at 1.59:1 where AA
|
|
137
|
+
wants 4.5.
|
|
138
|
+
|
|
139
|
+
So dark stops multiplying and lays a tint down instead, and the words keep the
|
|
140
|
+
page's own ink: 5.26:1 for the text on the stroke, 3.23:1 for the stroke
|
|
141
|
+
against the bare page. Move `--ick-marker-rgb` far enough and both of those
|
|
142
|
+
move with it — the alpha that holds them is pinned to a measured range by a
|
|
143
|
+
test, and the way to change it is to measure again rather than to guess.
|
|
144
|
+
|
|
145
|
+
One value that is not a colour but does change: `--ick-recede`, how far the
|
|
146
|
+
rest of a paragraph falls back while one highlight has the floor. It is `0.15`
|
|
147
|
+
in light and `0.32` in dark, because 15% of near-black on white is a legible
|
|
148
|
+
grey and 15% of near-white on black is very nearly nothing.
|
|
149
|
+
|
|
150
|
+
## Per component
|
|
151
|
+
|
|
152
|
+
Each component names its own handful, defaulting to the semantic layer. Change
|
|
153
|
+
these to move one thing without moving its neighbours:
|
|
154
|
+
|
|
155
|
+
```css
|
|
156
|
+
:root {
|
|
157
|
+
--ick-input-h: 44px; /* a taller composer */
|
|
158
|
+
--ick-input-radius: 12px; /* squarer, without touching other radii */
|
|
159
|
+
--ick-input-fill: transparent; /* an input with no fill at all */
|
|
160
|
+
|
|
161
|
+
--ick-conversation-gap: 48px; /* between turns */
|
|
162
|
+
--ick-loader-dot: 5px;
|
|
163
|
+
/* Three surfaces that nest, used in this order everywhere the kit stacks
|
|
164
|
+
boxes. Move these and the question card, the tool call and the approval
|
|
165
|
+
all follow. The card is paper and opaque — a translucent one picks up
|
|
166
|
+
whatever it is sitting on. */
|
|
167
|
+
--ick-ground: rgb(17 17 17 / 0.05); /* what a group of things sits on */
|
|
168
|
+
--ick-card: #fff; /* an opaque panel raised on it */
|
|
169
|
+
--ick-inset: rgb(17 17 17 / 0.04); /* a row set into the card */
|
|
170
|
+
|
|
171
|
+
--ick-question-surface: var(--ick-ground);
|
|
172
|
+
--ick-question-card: var(--ick-card);
|
|
173
|
+
--ick-question-row: var(--ick-inset);
|
|
174
|
+
--ick-question-row-selected: var(--ick-marker-tint);
|
|
175
|
+
--ick-question-row-focus: var(--ick-marker);
|
|
176
|
+
--ick-badge-size: 24px;
|
|
177
|
+
/* Concentric, one chain for the whole kit: each step is the one inside it
|
|
178
|
+
plus the gap. Set the seed or a gap and everything follows — a question
|
|
179
|
+
card, a tool call and an approval all read these. Set one of the derived
|
|
180
|
+
steps and you have broken the chain. */
|
|
181
|
+
--ick-nest-inner: 8px; /* the seed: a badge, a chip, a fenced value */
|
|
182
|
+
--ick-nest-pad: 8px; /* inside a card, and inside a row */
|
|
183
|
+
--ick-nest-ground-pad: 16px; /* around a card, on its ground */
|
|
184
|
+
/* derived: --ick-nest-row 16, --ick-nest-card 24, --ick-nest-ground 40 */
|
|
185
|
+
--ick-chip-fill: var(--ick-surface-active);
|
|
186
|
+
--ick-empty-pad: 40px; /* around the empty state */
|
|
187
|
+
--ick-conversation-pad-block: 24px; /* inside the scroll */
|
|
188
|
+
--ick-conversation-pad-inline: 24px;
|
|
189
|
+
|
|
190
|
+
--ick-header-height-m: 56px; /* a roomier header */
|
|
191
|
+
--ick-header-bg: rgb(0 0 0 / 0.6);/* what sits behind the blur */
|
|
192
|
+
--ick-header-blur: 20px;
|
|
193
|
+
--ick-header-title: var(--ick-ink);
|
|
194
|
+
--ick-header-subtitle: var(--ick-ink-faint);
|
|
195
|
+
--ick-header-badge-bg: var(--ick-marker); /* the count on an action */
|
|
196
|
+
--ick-header-badge-ink: var(--ick-marker-ink);
|
|
197
|
+
|
|
198
|
+
--ick-md-gap: 0.85em; /* between blocks in an answer */
|
|
199
|
+
--ick-md-item-gap: 0.35em; /* between list items */
|
|
200
|
+
--ick-md-heading-space: 1.4em; /* above a heading */
|
|
201
|
+
--ick-md-indent: 1.5em; /* list indent */
|
|
202
|
+
--ick-md-quote-indent: 0.9em;
|
|
203
|
+
--ick-md-rule: var(--ick-border); /* quote bar, table borders, hr, links */
|
|
204
|
+
--ick-md-code-fill: var(--ick-surface-sunken);
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Code blocks ship monochrome — ink at four weights, because this kit is ink,
|
|
209
|
+
paper and one acid yellow. Six tokens turn that into a palette:
|
|
210
|
+
|
|
211
|
+
```css
|
|
212
|
+
:root {
|
|
213
|
+
--ick-code-comment: #6a737d;
|
|
214
|
+
--ick-code-keyword: #d73a49;
|
|
215
|
+
--ick-code-string: #032f62;
|
|
216
|
+
--ick-code-number: #005cc5;
|
|
217
|
+
--ick-code-name: #6f42c1;
|
|
218
|
+
--ick-code-attr: #e36209;
|
|
219
|
+
--ick-code-size: 0.75rem;
|
|
220
|
+
--ick-code-leading: 1.55;
|
|
221
|
+
--ick-code-addition: rgb(0 200 80 / 0.1); /* whole-line bands, for diffs */
|
|
222
|
+
--ick-code-deletion: rgb(220 0 40 / 0.06);
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
The markdown gaps are in `em` rather than pixels, so they scale with whatever
|
|
227
|
+
size the answer is set at instead of drifting away from it.
|
|
228
|
+
|
|
229
|
+
## Motion
|
|
230
|
+
|
|
231
|
+
`--ick-ease`, `--ick-ease-overshoot`, and the `--ick-duration-*` scale. The kit
|
|
232
|
+
already honours `prefers-reduced-motion` on its own: transforms and layout snap
|
|
233
|
+
to their final values while opacity and colour still fade, so state stays
|
|
234
|
+
legible without travelling.
|