luzia-widget 0.1.2 → 0.1.4
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/README.md +1 -1
- package/dist/element.d.ts +30 -2
- package/dist/element.js +213 -119
- package/dist/element.js.map +1 -1
- package/dist/links.d.ts +9 -0
- package/dist/links.js +85 -0
- package/dist/links.js.map +1 -0
- package/dist/luzia-widget.js +455 -150
- package/dist/styles.d.ts +4 -4
- package/dist/styles.js +428 -141
- package/dist/styles.js.map +1 -1
- package/package.json +1 -1
package/dist/styles.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* override on the element (`luzia-widget { --luzia-accent: #e11d48; }`); an
|
|
4
4
|
* Owner's value wins over both the light and the dark palette.
|
|
5
5
|
*
|
|
6
|
-
* - `--luzia-accent` / `--luzia-accent-contrast`: bubble,
|
|
6
|
+
* - `--luzia-accent` / `--luzia-accent-contrast`: bubble, the light behind luzIA, Visitor messages, buttons, and text on them
|
|
7
7
|
* - `--luzia-surface` / `--luzia-text`: chat background and text
|
|
8
8
|
* - `--luzia-muted`: Agent messages, greeting and suggested questions
|
|
9
9
|
* - `--luzia-border`: input and inline-panel borders
|
|
10
10
|
* - `--luzia-font`: font family
|
|
11
11
|
* - `--luzia-inline-height`: height of the chat in inline mode
|
|
12
|
-
* - `--luzia-
|
|
13
|
-
* - `--luzia-
|
|
12
|
+
* - `--luzia-avatar-size`: height of luzIA's picture at the top of the chat (default: 6rem to 11rem, by screen height)
|
|
13
|
+
* - `--luzia-peek-size`: height of the hello animation when luzIA peeks out of the closed launcher (default: 8.5rem)
|
|
14
14
|
*
|
|
15
15
|
* Every control is at least 44px square (a comfortable tap target) and shows
|
|
16
16
|
* a focus ring for keyboard users. Below 480px wide the bubble's chat fills
|
|
@@ -26,6 +26,9 @@ export const styles = `
|
|
|
26
26
|
--luzia-font: system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
27
27
|
--luzia-border: #d4d4d8;
|
|
28
28
|
--luzia-inline-height: 38rem;
|
|
29
|
+
--luzia-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
|
|
30
|
+
/* How strongly the accent lights the top of the chat, behind luzIA. */
|
|
31
|
+
--luzia-glow-strength: 22%;
|
|
29
32
|
position: fixed;
|
|
30
33
|
right: 1.25rem;
|
|
31
34
|
bottom: 1.25rem;
|
|
@@ -34,6 +37,7 @@ export const styles = `
|
|
|
34
37
|
color: var(--luzia-text);
|
|
35
38
|
}
|
|
36
39
|
:host([theme='dark']) {
|
|
40
|
+
--luzia-glow-strength: 30%;
|
|
37
41
|
--luzia-surface: #18181b;
|
|
38
42
|
--luzia-text: #f4f4f5;
|
|
39
43
|
--luzia-muted: #27272a;
|
|
@@ -41,6 +45,7 @@ export const styles = `
|
|
|
41
45
|
}
|
|
42
46
|
@media (prefers-color-scheme: dark) {
|
|
43
47
|
:host([theme='auto']) {
|
|
48
|
+
--luzia-glow-strength: 30%;
|
|
44
49
|
--luzia-surface: #18181b;
|
|
45
50
|
--luzia-text: #f4f4f5;
|
|
46
51
|
--luzia-muted: #27272a;
|
|
@@ -54,8 +59,10 @@ export const styles = `
|
|
|
54
59
|
outline: 2px solid var(--luzia-accent);
|
|
55
60
|
outline-offset: 2px;
|
|
56
61
|
}
|
|
57
|
-
/* The
|
|
58
|
-
.
|
|
62
|
+
/* The message box shows focus on its whole field (see .composer:focus-within). */
|
|
63
|
+
.composer textarea:focus-visible { outline: none; }
|
|
64
|
+
::selection { background: color-mix(in srgb, var(--luzia-accent) 28%, transparent); }
|
|
65
|
+
.message[data-role='user']::selection { background: color-mix(in srgb, var(--luzia-accent-contrast) 35%, transparent); }
|
|
59
66
|
/* Read by screen readers only: each finished reply (see the element's View). */
|
|
60
67
|
.announcer {
|
|
61
68
|
position: absolute;
|
|
@@ -68,19 +75,102 @@ export const styles = `
|
|
|
68
75
|
white-space: nowrap;
|
|
69
76
|
border: 0;
|
|
70
77
|
}
|
|
78
|
+
/*
|
|
79
|
+
* The launcher: a pill with luzIA's icon and an invitation to ask. With the
|
|
80
|
+
* chat open it folds into just the icon: the text fades and blurs out first,
|
|
81
|
+
* then the pill narrows (unfolding, the pill widens first, then the text comes in).
|
|
82
|
+
*/
|
|
71
83
|
.bubble {
|
|
72
|
-
display:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
height: 3.5rem;
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
height: 3.25rem;
|
|
76
87
|
margin-left: auto;
|
|
88
|
+
padding: 0 0.45rem;
|
|
77
89
|
border: none;
|
|
78
|
-
border-radius:
|
|
90
|
+
border-radius: 999px;
|
|
79
91
|
background: var(--luzia-accent);
|
|
80
92
|
color: var(--luzia-accent-contrast);
|
|
81
|
-
font: 600 0.
|
|
93
|
+
font: 600 0.95rem var(--luzia-font);
|
|
82
94
|
box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);
|
|
83
95
|
cursor: pointer;
|
|
96
|
+
transition: transform 160ms ease-out, box-shadow 160ms ease-out;
|
|
97
|
+
position: relative;
|
|
98
|
+
}
|
|
99
|
+
/*
|
|
100
|
+
* With the Owner's hello animation, luzIA peeks out of the closed launcher
|
|
101
|
+
* now and then, above its text: she rises from its top edge (clipped there,
|
|
102
|
+
* as if from behind it), says hello, and ducks back down.
|
|
103
|
+
*/
|
|
104
|
+
.peek {
|
|
105
|
+
position: absolute;
|
|
106
|
+
left: calc(50% + 1.15rem);
|
|
107
|
+
bottom: calc(100% - 1px);
|
|
108
|
+
width: 10.5rem;
|
|
109
|
+
height: var(--luzia-peek-size, 8.5rem);
|
|
110
|
+
transform: translateX(-50%);
|
|
111
|
+
clip-path: inset(-3rem -3rem 0 -3rem);
|
|
112
|
+
pointer-events: none;
|
|
113
|
+
}
|
|
114
|
+
.peek-image {
|
|
115
|
+
display: block;
|
|
116
|
+
height: 100%;
|
|
117
|
+
width: 100%;
|
|
118
|
+
object-fit: contain;
|
|
119
|
+
object-position: 50% 100%;
|
|
120
|
+
transform: translateY(105%);
|
|
121
|
+
transform-origin: 50% 100%;
|
|
122
|
+
filter: drop-shadow(0 4px 10px rgb(0 0 0 / 0.18));
|
|
123
|
+
}
|
|
124
|
+
/* The animation says hello; she only rises and ducks: half a second up, gently settling;
|
|
125
|
+
half a second down, easing in and out (no sudden drop). */
|
|
126
|
+
.bubble[data-peeking] .peek-image { animation: luzia-peek-rise 4s both; }
|
|
127
|
+
@keyframes luzia-peek-rise {
|
|
128
|
+
0% { transform: translateY(105%); animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1); }
|
|
129
|
+
12.5%, 87.5% { transform: translateY(0); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
|
|
130
|
+
100% { transform: translateY(105%); }
|
|
131
|
+
}
|
|
132
|
+
@media (hover: hover) and (pointer: fine) {
|
|
133
|
+
.bubble:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); }
|
|
134
|
+
}
|
|
135
|
+
.bubble:active { transform: scale(0.97); }
|
|
136
|
+
.bubble-icon { display: block; width: 2.35rem; height: 2.35rem; flex: none; }
|
|
137
|
+
.bubble-icon svg { display: block; }
|
|
138
|
+
/* The star turns a little as the pill folds and unfolds. */
|
|
139
|
+
.bubble-icon path {
|
|
140
|
+
transform-box: fill-box;
|
|
141
|
+
transform-origin: center;
|
|
142
|
+
transition: transform 400ms var(--luzia-ease-out);
|
|
143
|
+
}
|
|
144
|
+
.bubble[aria-expanded='true'] .bubble-icon path { transform: rotate(90deg); }
|
|
145
|
+
.bubble-label {
|
|
146
|
+
display: block;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
max-width: 14rem;
|
|
149
|
+
transition: max-width 320ms var(--luzia-ease-out);
|
|
150
|
+
}
|
|
151
|
+
.bubble-text {
|
|
152
|
+
display: block;
|
|
153
|
+
padding: 0 0.95rem 0 0.6rem;
|
|
154
|
+
white-space: nowrap;
|
|
155
|
+
transition: opacity 200ms ease 90ms, filter 200ms ease 90ms, transform 200ms ease-out 90ms;
|
|
156
|
+
}
|
|
157
|
+
.bubble[aria-expanded='true'] .bubble-label {
|
|
158
|
+
max-width: 0;
|
|
159
|
+
transition-delay: 60ms;
|
|
160
|
+
}
|
|
161
|
+
.bubble[aria-expanded='true'] .bubble-text {
|
|
162
|
+
opacity: 0;
|
|
163
|
+
filter: blur(3px);
|
|
164
|
+
transform: translateX(-0.4rem);
|
|
165
|
+
transition-duration: 140ms;
|
|
166
|
+
transition-delay: 0ms;
|
|
167
|
+
}
|
|
168
|
+
/* Less motion: the text still fades, but nothing moves or turns (and luzIA doesn't peek). */
|
|
169
|
+
@media (prefers-reduced-motion: reduce) {
|
|
170
|
+
.peek { display: none; }
|
|
171
|
+
.bubble, .bubble-label, .bubble-icon path { transition: none; }
|
|
172
|
+
.bubble:hover, .bubble:active, .bubble-text, .bubble[aria-expanded='true'] .bubble-text { transform: none; }
|
|
173
|
+
.bubble-text, .bubble[aria-expanded='true'] .bubble-text { filter: none; transition: opacity 150ms ease; }
|
|
84
174
|
}
|
|
85
175
|
.panel {
|
|
86
176
|
display: flex;
|
|
@@ -89,10 +179,28 @@ export const styles = `
|
|
|
89
179
|
height: min(40rem, calc(100vh - 7rem));
|
|
90
180
|
margin-bottom: 0.75rem;
|
|
91
181
|
background: var(--luzia-surface);
|
|
92
|
-
|
|
93
|
-
|
|
182
|
+
/* luzIA's light (.stage::before) sits behind the header and stage, above this background. */
|
|
183
|
+
isolation: isolate;
|
|
184
|
+
border: 1px solid color-mix(in srgb, var(--luzia-border) 70%, transparent);
|
|
185
|
+
border-radius: 1.25rem;
|
|
186
|
+
box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 24px 48px -12px rgb(0 0 0 / 0.3);
|
|
94
187
|
overflow: hidden;
|
|
95
188
|
}
|
|
189
|
+
/* Opening grows the chat out of the launcher below it; closing is instant. */
|
|
190
|
+
:host(:not([mode='inline'])) .panel {
|
|
191
|
+
transform-origin: bottom right;
|
|
192
|
+
transition: opacity 200ms ease-out, transform 240ms var(--luzia-ease-out);
|
|
193
|
+
@starting-style {
|
|
194
|
+
opacity: 0;
|
|
195
|
+
transform: translateY(8px) scale(0.97);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
@media (prefers-reduced-motion: reduce) {
|
|
199
|
+
:host(:not([mode='inline'])) .panel {
|
|
200
|
+
transition: opacity 150ms ease;
|
|
201
|
+
@starting-style { transform: none; }
|
|
202
|
+
}
|
|
203
|
+
}
|
|
96
204
|
:host([mode='inline']) {
|
|
97
205
|
position: static;
|
|
98
206
|
display: block;
|
|
@@ -103,31 +211,56 @@ export const styles = `
|
|
|
103
211
|
width: 100%;
|
|
104
212
|
height: var(--luzia-inline-height);
|
|
105
213
|
margin: 0;
|
|
106
|
-
|
|
107
|
-
box-shadow: none;
|
|
214
|
+
box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
|
|
108
215
|
}
|
|
216
|
+
/* Quiet: luzIA's mark and name, then two icon buttons. The light below carries the colour. */
|
|
109
217
|
.header {
|
|
110
218
|
display: flex;
|
|
111
219
|
align-items: center;
|
|
112
|
-
|
|
113
|
-
padding: 0.
|
|
114
|
-
|
|
115
|
-
color: var(--luzia-accent-contrast);
|
|
220
|
+
gap: 0.5rem;
|
|
221
|
+
padding: 0.375rem 0.375rem 0 0.875rem;
|
|
222
|
+
color: var(--luzia-text);
|
|
116
223
|
}
|
|
117
|
-
|
|
224
|
+
.header-icon { display: block; width: 1.5rem; height: 1.5rem; flex: none; }
|
|
225
|
+
.header-icon svg { display: block; }
|
|
226
|
+
.header-icon circle { fill: var(--luzia-accent); }
|
|
227
|
+
.header-icon path { fill: var(--luzia-accent-contrast); }
|
|
228
|
+
/* Like a video call: luzIA's whole picture at the top, her state beside it like a name tag. */
|
|
118
229
|
.stage {
|
|
230
|
+
--luzia-avatar-height: var(--luzia-avatar-size, clamp(6rem, 26vh, 11rem));
|
|
231
|
+
position: relative;
|
|
119
232
|
flex: none;
|
|
120
233
|
display: flex;
|
|
121
|
-
justify-content:
|
|
122
|
-
|
|
123
|
-
padding: 0.
|
|
124
|
-
border-bottom: 1px solid var(--luzia-border);
|
|
234
|
+
justify-content: center;
|
|
235
|
+
align-items: flex-end;
|
|
236
|
+
padding: 0.25rem 1rem 0;
|
|
237
|
+
border-bottom: 1px solid color-mix(in srgb, var(--luzia-border) 75%, transparent);
|
|
238
|
+
}
|
|
239
|
+
/* She stands in a soft light of the accent colour. */
|
|
240
|
+
.stage::before {
|
|
241
|
+
content: '';
|
|
242
|
+
position: absolute;
|
|
243
|
+
z-index: -1;
|
|
244
|
+
left: 50%;
|
|
245
|
+
bottom: -3rem;
|
|
246
|
+
width: 22rem;
|
|
247
|
+
height: 15rem;
|
|
248
|
+
transform: translateX(-50%);
|
|
249
|
+
background: radial-gradient(closest-side, color-mix(in srgb, var(--luzia-accent) var(--luzia-glow-strength), transparent), transparent);
|
|
250
|
+
pointer-events: none;
|
|
125
251
|
}
|
|
126
252
|
/* The picture is shown whole, in its own shape (a cut-out stands on the divider line). */
|
|
127
253
|
.avatar {
|
|
128
|
-
display:
|
|
129
|
-
|
|
254
|
+
display: grid;
|
|
255
|
+
grid-template-rows: 100%;
|
|
256
|
+
flex: none;
|
|
257
|
+
height: var(--luzia-avatar-height);
|
|
130
258
|
}
|
|
259
|
+
/* The still picture and its talking version share one place; only one shows at a time. */
|
|
260
|
+
.avatar > * { grid-area: 1 / 1; }
|
|
261
|
+
.avatar .speaking { opacity: 0; }
|
|
262
|
+
.stage[data-talking] .avatar .speaking { opacity: 1; }
|
|
263
|
+
.stage[data-talking] .avatar:has(.speaking) .still { opacity: 0; }
|
|
131
264
|
.avatar img,
|
|
132
265
|
.avatar svg {
|
|
133
266
|
display: block;
|
|
@@ -135,116 +268,217 @@ export const styles = `
|
|
|
135
268
|
width: auto;
|
|
136
269
|
max-width: 100%;
|
|
137
270
|
object-fit: contain;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
padding: 0.55rem 0.75rem;
|
|
149
|
-
border: 1px solid var(--luzia-border);
|
|
150
|
-
border-radius: 0.9rem;
|
|
151
|
-
background: var(--luzia-surface);
|
|
152
|
-
color: var(--luzia-text);
|
|
153
|
-
box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
|
|
154
|
-
font-size: 0.875rem;
|
|
155
|
-
line-height: 1.4;
|
|
156
|
-
opacity: 1;
|
|
157
|
-
transition: opacity 0.4s ease;
|
|
158
|
-
}
|
|
159
|
-
.speech-text {
|
|
160
|
-
display: block;
|
|
161
|
-
max-height: calc(var(--luzia-avatar-size, clamp(7rem, 30vh, 13rem)) - 2.75rem);
|
|
162
|
-
/* Long replies scroll inside the bubble, so their beginning can be read. */
|
|
163
|
-
overflow-y: auto;
|
|
164
|
-
overscroll-behavior: contain;
|
|
165
|
-
scrollbar-width: thin;
|
|
166
|
-
padding-inline-end: 0.25rem;
|
|
167
|
-
white-space: pre-wrap;
|
|
168
|
-
overflow-wrap: anywhere;
|
|
169
|
-
}
|
|
170
|
-
/* The tail points back at luzIA's mouth (tune its height with --luzia-speech-tail-top). */
|
|
171
|
-
.speech::before,
|
|
172
|
-
.speech::after {
|
|
173
|
-
content: '';
|
|
174
|
-
position: absolute;
|
|
175
|
-
border-block-style: solid;
|
|
176
|
-
border-block-color: transparent;
|
|
177
|
-
border-inline-end-style: solid;
|
|
178
|
-
}
|
|
179
|
-
.speech::before {
|
|
180
|
-
top: var(--luzia-speech-tail-top, 1.6rem);
|
|
181
|
-
left: -0.6rem;
|
|
182
|
-
border-block-width: 0.45rem;
|
|
183
|
-
border-inline-end-width: 0.6rem;
|
|
184
|
-
border-inline-end-color: var(--luzia-border);
|
|
185
|
-
}
|
|
186
|
-
.speech::after {
|
|
187
|
-
top: calc(var(--luzia-speech-tail-top, 1.6rem) + 1px);
|
|
188
|
-
left: calc(-0.6rem + 1.5px);
|
|
189
|
-
border-block-width: calc(0.45rem - 1px);
|
|
190
|
-
border-inline-end-width: 0.6rem;
|
|
191
|
-
border-inline-end-color: var(--luzia-surface);
|
|
192
|
-
}
|
|
193
|
-
.speech.leaving { opacity: 0; }
|
|
194
|
-
@media (prefers-reduced-motion: reduce) {
|
|
195
|
-
.speech { transition: none; }
|
|
196
|
-
}
|
|
197
|
-
/* While a reply streams in, a soft glow follows the picture's outline. */
|
|
271
|
+
transform-origin: 50% 100%;
|
|
272
|
+
transition: filter 0.2s ease, transform 360ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
273
|
+
}
|
|
274
|
+
.avatar svg { aspect-ratio: 1; margin-bottom: 0.5rem; height: calc(100% - 0.5rem); }
|
|
275
|
+
/* luzIA's own icon: the star on a disc lit by the accent, not a flat white circle. */
|
|
276
|
+
.avatar svg circle { fill: color-mix(in srgb, var(--luzia-accent) 12%, var(--luzia-surface)); }
|
|
277
|
+
/* While the Visitor types, she leans in a little, as someone listening does. */
|
|
278
|
+
.stage[data-presence='listening'] .avatar img,
|
|
279
|
+
.stage[data-presence='listening'] .avatar svg { transform: scale(1.025) rotate(-1deg); }
|
|
280
|
+
/* Speaking (the greeting, or a reply as it streams in): a soft glow breathes along her outline. */
|
|
198
281
|
.stage[data-speaking] .avatar img,
|
|
199
|
-
.stage[data-speaking] .avatar svg
|
|
282
|
+
.stage[data-speaking] .avatar svg,
|
|
283
|
+
.stage[data-greeting] .avatar img,
|
|
284
|
+
.stage[data-greeting] .avatar svg {
|
|
200
285
|
filter: drop-shadow(0 0 6px var(--luzia-accent));
|
|
201
286
|
animation: luzia-speaking 1.4s ease-in-out infinite;
|
|
202
287
|
}
|
|
203
288
|
@keyframes luzia-speaking {
|
|
204
289
|
50% { filter: drop-shadow(0 0 14px var(--luzia-accent)); }
|
|
205
290
|
}
|
|
291
|
+
/* Her state, like the name tag in a video call: a dot that is lit while she is busy. */
|
|
292
|
+
/* Centred under her, on the divider line, like the name tag in a video call. */
|
|
293
|
+
.presence {
|
|
294
|
+
position: absolute;
|
|
295
|
+
z-index: 1;
|
|
296
|
+
left: 50%;
|
|
297
|
+
bottom: 0;
|
|
298
|
+
transform: translate(-50%, 50%);
|
|
299
|
+
display: flex;
|
|
300
|
+
align-items: center;
|
|
301
|
+
gap: 0.45rem;
|
|
302
|
+
max-width: calc(100% - 2rem);
|
|
303
|
+
padding: 0.3rem 0.7rem 0.3rem 0.55rem;
|
|
304
|
+
border-radius: 999px;
|
|
305
|
+
background: var(--luzia-surface);
|
|
306
|
+
box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 0 0 1px color-mix(in srgb, var(--luzia-border) 60%, transparent);
|
|
307
|
+
color: color-mix(in srgb, var(--luzia-text) 72%, transparent);
|
|
308
|
+
font-size: 0.8125rem;
|
|
309
|
+
font-weight: 500;
|
|
310
|
+
line-height: 1.2;
|
|
311
|
+
white-space: nowrap;
|
|
312
|
+
}
|
|
313
|
+
.presence-dot {
|
|
314
|
+
flex: none;
|
|
315
|
+
width: 0.5rem;
|
|
316
|
+
height: 0.5rem;
|
|
317
|
+
border-radius: 50%;
|
|
318
|
+
background: #16a34a;
|
|
319
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 18%, transparent);
|
|
320
|
+
transition: background-color 200ms ease, box-shadow 200ms ease;
|
|
321
|
+
}
|
|
322
|
+
.stage:not([data-presence='idle']) .presence-dot {
|
|
323
|
+
background: var(--luzia-accent);
|
|
324
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--luzia-accent) 22%, transparent);
|
|
325
|
+
animation: luzia-pulse 1.2s ease-in-out infinite;
|
|
326
|
+
}
|
|
327
|
+
.stage:not([data-presence='idle']) .presence-text { color: var(--luzia-text); }
|
|
328
|
+
@keyframes luzia-pulse {
|
|
329
|
+
50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--luzia-accent) 8%, transparent); }
|
|
330
|
+
}
|
|
206
331
|
@media (prefers-reduced-motion: reduce) {
|
|
332
|
+
.avatar img, .avatar svg { transition: filter 0.2s ease; transform: none !important; }
|
|
207
333
|
.stage[data-speaking] .avatar img,
|
|
208
|
-
.stage[data-speaking] .avatar svg
|
|
334
|
+
.stage[data-speaking] .avatar svg,
|
|
335
|
+
.stage[data-greeting] .avatar img,
|
|
336
|
+
.stage[data-greeting] .avatar svg,
|
|
337
|
+
.stage:not([data-presence='idle']) .presence-dot { animation: none; }
|
|
338
|
+
/* A moving mouth is motion too: the still picture stays. */
|
|
339
|
+
.stage[data-talking] .avatar .speaking { opacity: 0; }
|
|
340
|
+
.stage[data-talking] .avatar:has(.speaking) .still { opacity: 1; }
|
|
341
|
+
}
|
|
342
|
+
.title { margin: 0; font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }
|
|
343
|
+
.new-conversation,
|
|
344
|
+
.close {
|
|
345
|
+
color: color-mix(in srgb, var(--luzia-text) 65%, transparent);
|
|
209
346
|
}
|
|
210
|
-
|
|
347
|
+
/* Restart: a circular arrow, named by a tooltip on hover or keyboard focus. */
|
|
211
348
|
.new-conversation {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
349
|
+
position: relative;
|
|
350
|
+
display: grid;
|
|
351
|
+
place-items: center;
|
|
352
|
+
margin-inline: auto 0.25rem;
|
|
353
|
+
padding: 0;
|
|
354
|
+
border: none;
|
|
355
|
+
border-radius: 0.75rem;
|
|
216
356
|
background: transparent;
|
|
217
|
-
color: inherit;
|
|
218
|
-
font: inherit;
|
|
219
|
-
font-size: 0.8rem;
|
|
220
357
|
cursor: pointer;
|
|
358
|
+
transition: background-color 150ms ease, color 150ms ease, transform 160ms ease-out;
|
|
359
|
+
}
|
|
360
|
+
.new-conversation svg { display: block; transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1); }
|
|
361
|
+
.new-conversation:active { transform: scale(0.94); }
|
|
362
|
+
.tooltip {
|
|
363
|
+
position: absolute;
|
|
364
|
+
top: calc(100% + 0.4rem);
|
|
365
|
+
right: 0;
|
|
366
|
+
z-index: 1;
|
|
367
|
+
padding: 0.35rem 0.6rem;
|
|
368
|
+
border-radius: 0.375rem;
|
|
369
|
+
background: var(--luzia-text);
|
|
370
|
+
color: var(--luzia-surface);
|
|
371
|
+
font: 500 0.75rem var(--luzia-font);
|
|
372
|
+
white-space: nowrap;
|
|
373
|
+
box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
|
|
374
|
+
pointer-events: none;
|
|
375
|
+
opacity: 0;
|
|
376
|
+
transform: translateY(-2px) scale(0.97);
|
|
377
|
+
transform-origin: top right;
|
|
378
|
+
/* Leaving: quick, with no wait. */
|
|
379
|
+
transition: opacity 100ms ease-out, transform 100ms ease-out;
|
|
380
|
+
}
|
|
381
|
+
/* Appearing: after a short pause, so passing over the button does not flash it. */
|
|
382
|
+
.new-conversation:focus-visible .tooltip {
|
|
383
|
+
opacity: 1;
|
|
384
|
+
transform: none;
|
|
385
|
+
transition: opacity 125ms ease-out, transform 125ms ease-out;
|
|
386
|
+
}
|
|
387
|
+
@media (hover: hover) and (pointer: fine) {
|
|
388
|
+
.new-conversation:hover,
|
|
389
|
+
.close:hover { background-color: color-mix(in srgb, var(--luzia-text) 8%, transparent); color: var(--luzia-text); }
|
|
390
|
+
/* The arrow winds back a little, hinting at what it does. */
|
|
391
|
+
.new-conversation:hover svg { transform: rotate(-45deg); }
|
|
392
|
+
.new-conversation:hover .tooltip {
|
|
393
|
+
opacity: 1;
|
|
394
|
+
transform: none;
|
|
395
|
+
transition: opacity 125ms ease-out 350ms, transform 125ms ease-out 350ms;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
@media (prefers-reduced-motion: reduce) {
|
|
399
|
+
.tooltip, .new-conversation:active, .new-conversation svg { transform: none !important; }
|
|
221
400
|
}
|
|
222
401
|
.close {
|
|
402
|
+
display: grid;
|
|
403
|
+
place-items: center;
|
|
404
|
+
padding: 0;
|
|
223
405
|
border: none;
|
|
406
|
+
border-radius: 0.75rem;
|
|
224
407
|
background: transparent;
|
|
225
|
-
color: inherit;
|
|
226
|
-
font-size: 1.4rem;
|
|
227
|
-
line-height: 1;
|
|
228
408
|
cursor: pointer;
|
|
409
|
+
transition: background-color 150ms ease, color 150ms ease, transform 160ms ease-out;
|
|
410
|
+
}
|
|
411
|
+
.close svg { display: block; }
|
|
412
|
+
.close:active { transform: scale(0.94); }
|
|
413
|
+
@media (prefers-reduced-motion: reduce) {
|
|
414
|
+
.close:active { transform: none; }
|
|
229
415
|
}
|
|
230
416
|
.body {
|
|
231
417
|
flex: 1;
|
|
232
418
|
display: flex;
|
|
233
419
|
flex-direction: column;
|
|
234
|
-
gap: 0.
|
|
235
|
-
|
|
420
|
+
gap: 0.375rem;
|
|
421
|
+
/* Room at the top for luzIA's name tag, which sits on the divider line. */
|
|
422
|
+
padding: 1.5rem 1rem 0.75rem;
|
|
236
423
|
overflow-y: auto;
|
|
237
424
|
}
|
|
238
|
-
.
|
|
239
|
-
|
|
425
|
+
.body {
|
|
426
|
+
scrollbar-width: thin;
|
|
427
|
+
scrollbar-color: color-mix(in srgb, var(--luzia-text) 22%, transparent) transparent;
|
|
428
|
+
}
|
|
429
|
+
/* Messages: soft, with the corner nearest the speaker drawn in, like a tail. */
|
|
430
|
+
.greeting,
|
|
431
|
+
.message {
|
|
240
432
|
max-width: 85%;
|
|
241
433
|
margin: 0;
|
|
242
|
-
padding: 0.
|
|
243
|
-
border-radius:
|
|
244
|
-
|
|
434
|
+
padding: 0.55rem 0.875rem;
|
|
435
|
+
border-radius: 1.125rem;
|
|
436
|
+
font-size: 0.9375rem;
|
|
437
|
+
line-height: 1.45;
|
|
245
438
|
white-space: pre-wrap;
|
|
246
439
|
overflow-wrap: anywhere;
|
|
247
|
-
|
|
440
|
+
}
|
|
441
|
+
.greeting,
|
|
442
|
+
.message[data-role='assistant'] {
|
|
443
|
+
align-self: flex-start;
|
|
444
|
+
border-bottom-left-radius: 0.375rem;
|
|
445
|
+
background: var(--luzia-muted);
|
|
446
|
+
transform-origin: bottom left;
|
|
447
|
+
}
|
|
448
|
+
/* Before her reply starts, luzIA thinks in her own message: three dots that rise in turn. */
|
|
449
|
+
.message[data-thinking] {
|
|
450
|
+
display: flex;
|
|
451
|
+
gap: 0.3rem;
|
|
452
|
+
padding-block: 0.85rem;
|
|
453
|
+
}
|
|
454
|
+
.message[data-thinking] .dot {
|
|
455
|
+
width: 0.4rem;
|
|
456
|
+
height: 0.4rem;
|
|
457
|
+
border-radius: 50%;
|
|
458
|
+
background: color-mix(in srgb, var(--luzia-text) 45%, transparent);
|
|
459
|
+
animation: luzia-think 1.1s ease-in-out infinite;
|
|
460
|
+
}
|
|
461
|
+
.message[data-thinking] .dot:nth-child(2) { animation-delay: 160ms; }
|
|
462
|
+
.message[data-thinking] .dot:nth-child(3) { animation-delay: 320ms; }
|
|
463
|
+
@keyframes luzia-think {
|
|
464
|
+
0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
|
|
465
|
+
30% { transform: translateY(-3px); opacity: 1; }
|
|
466
|
+
}
|
|
467
|
+
@media (prefers-reduced-motion: reduce) {
|
|
468
|
+
.message[data-thinking] .dot { animation: luzia-fade 1.1s ease-in-out infinite alternate; }
|
|
469
|
+
}
|
|
470
|
+
/* Links in luzIA's replies: underlined in the text's own colour, so they read as links on any theme. */
|
|
471
|
+
.message a {
|
|
472
|
+
color: inherit;
|
|
473
|
+
text-decoration: underline;
|
|
474
|
+
text-decoration-thickness: 1px;
|
|
475
|
+
text-underline-offset: 0.15em;
|
|
476
|
+
border-radius: 0.125rem;
|
|
477
|
+
}
|
|
478
|
+
.message a:hover { text-decoration-thickness: 2px; }
|
|
479
|
+
.message a:focus-visible {
|
|
480
|
+
outline: 2px solid var(--luzia-accent);
|
|
481
|
+
outline-offset: 1px;
|
|
248
482
|
}
|
|
249
483
|
.messages {
|
|
250
484
|
margin: 0;
|
|
@@ -252,24 +486,27 @@ export const styles = `
|
|
|
252
486
|
list-style: none;
|
|
253
487
|
display: flex;
|
|
254
488
|
flex-direction: column;
|
|
255
|
-
gap: 0.
|
|
256
|
-
}
|
|
257
|
-
.message {
|
|
258
|
-
max-width: 85%;
|
|
259
|
-
padding: 0.5rem 0.75rem;
|
|
260
|
-
border-radius: 0.75rem;
|
|
261
|
-
white-space: pre-wrap;
|
|
262
|
-
overflow-wrap: anywhere;
|
|
263
|
-
line-height: 1.4;
|
|
489
|
+
gap: 0.375rem;
|
|
264
490
|
}
|
|
265
491
|
.message[data-role='user'] {
|
|
266
492
|
align-self: flex-end;
|
|
493
|
+
border-bottom-right-radius: 0.375rem;
|
|
267
494
|
background: var(--luzia-accent);
|
|
268
495
|
color: var(--luzia-accent-contrast);
|
|
496
|
+
box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--luzia-accent) 80%, transparent);
|
|
497
|
+
transform-origin: bottom right;
|
|
269
498
|
}
|
|
270
|
-
.
|
|
271
|
-
|
|
272
|
-
|
|
499
|
+
/* A little more room where the speaker changes. */
|
|
500
|
+
.message[data-role='assistant'] + .message[data-role='user'],
|
|
501
|
+
.message[data-role='user'] + .message[data-role='assistant'] { margin-top: 0.375rem; }
|
|
502
|
+
.greeting:not([hidden]) + .messages:not(:empty) { margin-top: 0.375rem; }
|
|
503
|
+
/* Each new message rises into place once. */
|
|
504
|
+
.greeting, .message { animation: luzia-rise 260ms var(--luzia-ease-out); }
|
|
505
|
+
@keyframes luzia-rise {
|
|
506
|
+
from { opacity: 0; transform: translateY(6px) scale(0.98); }
|
|
507
|
+
}
|
|
508
|
+
@keyframes luzia-fade {
|
|
509
|
+
from { opacity: 0; }
|
|
273
510
|
}
|
|
274
511
|
.suggestions {
|
|
275
512
|
display: flex;
|
|
@@ -280,17 +517,33 @@ export const styles = `
|
|
|
280
517
|
padding: 0;
|
|
281
518
|
list-style: none;
|
|
282
519
|
}
|
|
520
|
+
/* Questions the Visitor could ask, tinted with the accent; they arrive one after another. */
|
|
521
|
+
.suggestions li { animation: luzia-rise 320ms var(--luzia-ease-out) both; transform-origin: bottom right; }
|
|
522
|
+
.suggestions li:nth-child(2) { animation-delay: 50ms; }
|
|
523
|
+
.suggestions li:nth-child(3) { animation-delay: 100ms; }
|
|
524
|
+
.suggestions li:nth-child(n + 4) { animation-delay: 150ms; }
|
|
283
525
|
.suggestion {
|
|
284
|
-
padding: 0.
|
|
285
|
-
border: 1px solid var(--luzia-accent);
|
|
526
|
+
padding: 0.5rem 0.9rem;
|
|
527
|
+
border: 1px solid color-mix(in srgb, var(--luzia-accent) 24%, transparent);
|
|
286
528
|
border-radius: 999px;
|
|
287
|
-
background: var(--luzia-surface);
|
|
288
|
-
color: var(--luzia-text);
|
|
289
|
-
font: 0.875rem var(--luzia-font);
|
|
529
|
+
background: color-mix(in srgb, var(--luzia-accent) 7%, var(--luzia-surface));
|
|
530
|
+
color: color-mix(in srgb, var(--luzia-accent) 60%, var(--luzia-text));
|
|
531
|
+
font: 500 0.875rem/1.3 var(--luzia-font);
|
|
290
532
|
text-align: left;
|
|
291
533
|
cursor: pointer;
|
|
534
|
+
transition: background-color 150ms ease, border-color 150ms ease, transform 160ms ease-out;
|
|
535
|
+
}
|
|
536
|
+
@media (hover: hover) and (pointer: fine) {
|
|
537
|
+
.suggestion:hover {
|
|
538
|
+
border-color: color-mix(in srgb, var(--luzia-accent) 45%, transparent);
|
|
539
|
+
background: color-mix(in srgb, var(--luzia-accent) 13%, var(--luzia-surface));
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
.suggestion:active { transform: scale(0.97); }
|
|
543
|
+
@media (prefers-reduced-motion: reduce) {
|
|
544
|
+
.greeting, .message, .suggestions li { animation-name: luzia-fade; }
|
|
545
|
+
.suggestion:active { transform: none; }
|
|
292
546
|
}
|
|
293
|
-
.suggestion:hover { background: var(--luzia-muted); }
|
|
294
547
|
.alert {
|
|
295
548
|
margin: 0 1rem 0.5rem;
|
|
296
549
|
font-size: 0.875rem;
|
|
@@ -299,32 +552,65 @@ export const styles = `
|
|
|
299
552
|
.alert a {
|
|
300
553
|
color: inherit;
|
|
301
554
|
}
|
|
555
|
+
/* One rounded field: the message box with a round Send button inside it. */
|
|
302
556
|
.composer {
|
|
303
557
|
display: flex;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
558
|
+
align-items: flex-end;
|
|
559
|
+
gap: 0.375rem;
|
|
560
|
+
margin: 0 0.75rem 0.75rem;
|
|
561
|
+
padding: 0.25rem 0.25rem 0.25rem 1rem;
|
|
562
|
+
border: 1px solid var(--luzia-border);
|
|
563
|
+
border-radius: 1.5rem;
|
|
564
|
+
background: var(--luzia-surface);
|
|
565
|
+
box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
|
|
566
|
+
transition: border-color 150ms ease, box-shadow 150ms ease;
|
|
567
|
+
}
|
|
568
|
+
.composer:focus-within {
|
|
569
|
+
border-color: color-mix(in srgb, var(--luzia-accent) 60%, var(--luzia-border));
|
|
570
|
+
box-shadow: 0 0 0 4px color-mix(in srgb, var(--luzia-accent) 16%, transparent);
|
|
307
571
|
}
|
|
308
572
|
.composer textarea {
|
|
309
573
|
flex: 1;
|
|
574
|
+
box-sizing: border-box;
|
|
575
|
+
min-height: 2.75rem;
|
|
576
|
+
max-height: 8rem;
|
|
310
577
|
resize: none;
|
|
311
|
-
padding: 0.
|
|
312
|
-
border:
|
|
313
|
-
|
|
314
|
-
background: var(--luzia-surface);
|
|
578
|
+
padding: 0.7rem 0;
|
|
579
|
+
border: none;
|
|
580
|
+
background: transparent;
|
|
315
581
|
color: var(--luzia-text);
|
|
582
|
+
caret-color: var(--luzia-accent);
|
|
316
583
|
font: inherit;
|
|
584
|
+
font-size: 0.9375rem;
|
|
585
|
+
line-height: 1.4;
|
|
586
|
+
/* Grows with what is typed, where supported. */
|
|
587
|
+
field-sizing: content;
|
|
317
588
|
}
|
|
318
|
-
.composer
|
|
319
|
-
|
|
589
|
+
.composer textarea::placeholder { color: color-mix(in srgb, var(--luzia-text) 55%, transparent); }
|
|
590
|
+
.composer textarea:disabled { cursor: not-allowed; }
|
|
591
|
+
.send {
|
|
592
|
+
display: grid;
|
|
593
|
+
place-items: center;
|
|
594
|
+
flex: none;
|
|
595
|
+
width: 44px;
|
|
596
|
+
height: 44px;
|
|
597
|
+
padding: 0;
|
|
320
598
|
border: none;
|
|
321
|
-
border-radius:
|
|
599
|
+
border-radius: 50%;
|
|
322
600
|
background: var(--luzia-accent);
|
|
323
601
|
color: var(--luzia-accent-contrast);
|
|
324
|
-
font: 600 0.875rem var(--luzia-font);
|
|
325
602
|
cursor: pointer;
|
|
603
|
+
transition: background-color 150ms ease, opacity 150ms ease, transform 160ms ease-out;
|
|
604
|
+
}
|
|
605
|
+
.send svg { display: block; }
|
|
606
|
+
@media (hover: hover) and (pointer: fine) {
|
|
607
|
+
.send:not(:disabled):hover { background: color-mix(in srgb, var(--luzia-accent) 86%, #000); }
|
|
608
|
+
}
|
|
609
|
+
.send:not(:disabled):active { transform: scale(0.94); }
|
|
610
|
+
.send:disabled { opacity: 0.35; cursor: default; }
|
|
611
|
+
@media (prefers-reduced-motion: reduce) {
|
|
612
|
+
.send:not(:disabled):active { transform: none; }
|
|
326
613
|
}
|
|
327
|
-
.composer button:disabled { opacity: 0.5; cursor: default; }
|
|
328
614
|
@media (max-width: 480px) {
|
|
329
615
|
/* The whole visible screen: above the on-screen keyboard when it is open (set by the element from visualViewport). */
|
|
330
616
|
.panel {
|
|
@@ -334,17 +620,18 @@ export const styles = `
|
|
|
334
620
|
width: 100vw;
|
|
335
621
|
height: var(--luzia-viewport-height, 100vh);
|
|
336
622
|
margin: 0;
|
|
623
|
+
border: none;
|
|
337
624
|
border-radius: 0;
|
|
338
625
|
}
|
|
339
626
|
@supports (height: 100dvh) {
|
|
340
627
|
.panel { height: var(--luzia-viewport-height, 100dvh); }
|
|
341
628
|
}
|
|
342
|
-
/* With the keyboard open there is little room: a smaller picture keeps the
|
|
343
|
-
:host([data-keyboard]) .
|
|
344
|
-
:host([data-keyboard]) .speech-text { max-height: 4.5rem; }
|
|
629
|
+
/* With the keyboard open there is little room: a smaller picture keeps the last messages in view. */
|
|
630
|
+
:host([data-keyboard]) .stage { --luzia-avatar-height: 4.5rem; }
|
|
345
631
|
/* Inline, the chat stays in the page but never taller than the screen. */
|
|
346
632
|
:host([mode='inline']) .panel { height: min(var(--luzia-inline-height), 85vh); }
|
|
347
|
-
.composer {
|
|
633
|
+
.composer { margin-bottom: max(0.75rem, env(safe-area-inset-bottom)); }
|
|
634
|
+
:host(:not([mode='inline'])) .panel { transform-origin: bottom center; }
|
|
348
635
|
/* Below 16px, mobile browsers zoom the page when the text box gets focus. */
|
|
349
636
|
.composer textarea { font-size: 16px; }
|
|
350
637
|
}
|