luzia-widget 0.1.3 → 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/dist/styles.js CHANGED
@@ -9,8 +9,8 @@
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-speech-tail-top`: how far down the speech bubble's tail points (towards luzIA's mouth)
13
- * - `--luzia-avatar-size`: height of luzIA's picture at the top of the chat (default: 7rem to 13rem, by screen height)
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
@@ -94,6 +94,40 @@ export const styles = `
94
94
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);
95
95
  cursor: pointer;
96
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%); }
97
131
  }
98
132
  @media (hover: hover) and (pointer: fine) {
99
133
  .bubble:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); }
@@ -131,8 +165,9 @@ export const styles = `
131
165
  transition-duration: 140ms;
132
166
  transition-delay: 0ms;
133
167
  }
134
- /* Less motion: the text still fades, but nothing moves or turns. */
168
+ /* Less motion: the text still fades, but nothing moves or turns (and luzIA doesn't peek). */
135
169
  @media (prefers-reduced-motion: reduce) {
170
+ .peek { display: none; }
136
171
  .bubble, .bubble-label, .bubble-icon path { transition: none; }
137
172
  .bubble:hover, .bubble:active, .bubble-text, .bubble[aria-expanded='true'] .bubble-text { transform: none; }
138
173
  .bubble-text, .bubble[aria-expanded='true'] .bubble-text { filter: none; transition: opacity 150ms ease; }
@@ -143,10 +178,9 @@ export const styles = `
143
178
  width: min(24rem, calc(100vw - 2.5rem));
144
179
  height: min(40rem, calc(100vh - 7rem));
145
180
  margin-bottom: 0.75rem;
146
- /* luzIA stands in a soft light of the accent colour; it fades out before the conversation. */
147
- background-color: var(--luzia-surface);
148
- background-image: radial-gradient(19rem 12rem at 6.5rem 8rem, color-mix(in srgb, var(--luzia-accent) var(--luzia-glow-strength), transparent), transparent 70%);
149
- background-repeat: no-repeat;
181
+ background: var(--luzia-surface);
182
+ /* luzIA's light (.stage::before) sits behind the header and stage, above this background. */
183
+ isolation: isolate;
150
184
  border: 1px solid color-mix(in srgb, var(--luzia-border) 70%, transparent);
151
185
  border-radius: 1.25rem;
152
186
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 24px 48px -12px rgb(0 0 0 / 0.3);
@@ -191,20 +225,42 @@ export const styles = `
191
225
  .header-icon svg { display: block; }
192
226
  .header-icon circle { fill: var(--luzia-accent); }
193
227
  .header-icon path { fill: var(--luzia-accent-contrast); }
194
- /* Like a video call: luzIA's whole picture large and centred at the top, the conversation below it. */
228
+ /* Like a video call: luzIA's whole picture at the top, her state beside it like a name tag. */
195
229
  .stage {
230
+ --luzia-avatar-height: var(--luzia-avatar-size, clamp(6rem, 26vh, 11rem));
231
+ position: relative;
196
232
  flex: none;
197
233
  display: flex;
198
- justify-content: flex-start;
199
- gap: 0.75rem;
234
+ justify-content: center;
235
+ align-items: flex-end;
200
236
  padding: 0.25rem 1rem 0;
201
237
  border-bottom: 1px solid color-mix(in srgb, var(--luzia-border) 75%, transparent);
202
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;
251
+ }
203
252
  /* The picture is shown whole, in its own shape (a cut-out stands on the divider line). */
204
253
  .avatar {
205
- display: block;
206
- height: var(--luzia-avatar-size, clamp(7rem, 30vh, 13rem));
254
+ display: grid;
255
+ grid-template-rows: 100%;
256
+ flex: none;
257
+ height: var(--luzia-avatar-height);
207
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; }
208
264
  .avatar img,
209
265
  .avatar svg {
210
266
  display: block;
@@ -212,78 +268,76 @@ export const styles = `
212
268
  width: auto;
213
269
  max-width: 100%;
214
270
  object-fit: contain;
215
- transition: filter 0.2s ease;
271
+ transform-origin: 50% 100%;
272
+ transition: filter 0.2s ease, transform 360ms cubic-bezier(0.23, 1, 0.32, 1);
216
273
  }
217
- .avatar svg { aspect-ratio: 1; margin-bottom: 0.75rem; height: calc(100% - 0.75rem); }
274
+ .avatar svg { aspect-ratio: 1; margin-bottom: 0.5rem; height: calc(100% - 0.5rem); }
218
275
  /* luzIA's own icon: the star on a disc lit by the accent, not a flat white circle. */
219
276
  .avatar svg circle { fill: color-mix(in srgb, var(--luzia-accent) 12%, var(--luzia-surface)); }
220
- /* luzIA stays on the left; her speech bubble appears on the right without moving her. */
221
- .speech {
222
- position: relative;
223
- flex: 1;
224
- align-self: flex-start;
225
- min-width: 0;
226
- margin: 0.75rem 0 0;
227
- padding: 0.6rem 0.8rem;
228
- border: 1px solid var(--luzia-border);
229
- border-radius: 1rem;
230
- background: var(--luzia-surface);
231
- color: var(--luzia-text);
232
- box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 10px 24px -10px rgb(0 0 0 / 0.25);
233
- font-size: 0.875rem;
234
- line-height: 1.45;
235
- opacity: 1;
236
- transition: opacity 0.4s ease;
237
- }
238
- .speech-text {
239
- display: block;
240
- max-height: calc(var(--luzia-avatar-size, clamp(7rem, 30vh, 13rem)) - 2.75rem);
241
- /* Long replies scroll inside the bubble, so their beginning can be read. */
242
- overflow-y: auto;
243
- overscroll-behavior: contain;
244
- padding-inline-end: 0.25rem;
245
- white-space: pre-wrap;
246
- overflow-wrap: anywhere;
247
- }
248
- /* The tail points back at luzIA's mouth (tune its height with --luzia-speech-tail-top). */
249
- .speech::before,
250
- .speech::after {
251
- content: '';
252
- position: absolute;
253
- border-block-style: solid;
254
- border-block-color: transparent;
255
- border-inline-end-style: solid;
256
- }
257
- .speech::before {
258
- top: var(--luzia-speech-tail-top, 1.6rem);
259
- left: -0.6rem;
260
- border-block-width: 0.45rem;
261
- border-inline-end-width: 0.6rem;
262
- border-inline-end-color: var(--luzia-border);
263
- }
264
- .speech::after {
265
- top: calc(var(--luzia-speech-tail-top, 1.6rem) + 1px);
266
- left: calc(-0.6rem + 1.5px);
267
- border-block-width: calc(0.45rem - 1px);
268
- border-inline-end-width: 0.6rem;
269
- border-inline-end-color: var(--luzia-surface);
270
- }
271
- .speech.leaving { opacity: 0; }
272
- @media (prefers-reduced-motion: reduce) {
273
- .speech { transition: none; }
274
- }
275
- /* While a reply streams in, a soft glow follows the picture's outline. */
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. */
276
281
  .stage[data-speaking] .avatar img,
277
- .stage[data-speaking] .avatar svg {
282
+ .stage[data-speaking] .avatar svg,
283
+ .stage[data-greeting] .avatar img,
284
+ .stage[data-greeting] .avatar svg {
278
285
  filter: drop-shadow(0 0 6px var(--luzia-accent));
279
286
  animation: luzia-speaking 1.4s ease-in-out infinite;
280
287
  }
281
288
  @keyframes luzia-speaking {
282
289
  50% { filter: drop-shadow(0 0 14px var(--luzia-accent)); }
283
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
+ }
284
331
  @media (prefers-reduced-motion: reduce) {
332
+ .avatar img, .avatar svg { transition: filter 0.2s ease; transform: none !important; }
285
333
  .stage[data-speaking] .avatar img,
286
- .stage[data-speaking] .avatar svg { animation: none; }
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; }
287
341
  }
288
342
  .title { margin: 0; font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }
289
343
  .new-conversation,
@@ -364,11 +418,11 @@ export const styles = `
364
418
  display: flex;
365
419
  flex-direction: column;
366
420
  gap: 0.375rem;
367
- padding: 1rem 1rem 0.75rem;
421
+ /* Room at the top for luzIA's name tag, which sits on the divider line. */
422
+ padding: 1.5rem 1rem 0.75rem;
368
423
  overflow-y: auto;
369
424
  }
370
- .body,
371
- .speech-text {
425
+ .body {
372
426
  scrollbar-width: thin;
373
427
  scrollbar-color: color-mix(in srgb, var(--luzia-text) 22%, transparent) transparent;
374
428
  }
@@ -391,17 +445,37 @@ export const styles = `
391
445
  background: var(--luzia-muted);
392
446
  transform-origin: bottom left;
393
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
+ }
394
470
  /* Links in luzIA's replies: underlined in the text's own colour, so they read as links on any theme. */
395
- .message a,
396
- .speech-text a {
471
+ .message a {
397
472
  color: inherit;
398
473
  text-decoration: underline;
399
474
  text-decoration-thickness: 1px;
400
475
  text-underline-offset: 0.15em;
401
476
  border-radius: 0.125rem;
402
477
  }
403
- .message a:hover,
404
- .speech-text a:hover { text-decoration-thickness: 2px; }
478
+ .message a:hover { text-decoration-thickness: 2px; }
405
479
  .message a:focus-visible {
406
480
  outline: 2px solid var(--luzia-accent);
407
481
  outline-offset: 1px;
@@ -427,7 +501,7 @@ export const styles = `
427
501
  .message[data-role='user'] + .message[data-role='assistant'] { margin-top: 0.375rem; }
428
502
  .greeting:not([hidden]) + .messages:not(:empty) { margin-top: 0.375rem; }
429
503
  /* Each new message rises into place once. */
430
- .message { animation: luzia-rise 260ms var(--luzia-ease-out); }
504
+ .greeting, .message { animation: luzia-rise 260ms var(--luzia-ease-out); }
431
505
  @keyframes luzia-rise {
432
506
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
433
507
  }
@@ -467,7 +541,7 @@ export const styles = `
467
541
  }
468
542
  .suggestion:active { transform: scale(0.97); }
469
543
  @media (prefers-reduced-motion: reduce) {
470
- .message, .suggestions li { animation-name: luzia-fade; }
544
+ .greeting, .message, .suggestions li { animation-name: luzia-fade; }
471
545
  .suggestion:active { transform: none; }
472
546
  }
473
547
  .alert {
@@ -552,9 +626,8 @@ export const styles = `
552
626
  @supports (height: 100dvh) {
553
627
  .panel { height: var(--luzia-viewport-height, 100dvh); }
554
628
  }
555
- /* With the keyboard open there is little room: a smaller picture keeps the speech bubble and the last messages in view. */
556
- :host([data-keyboard]) .avatar { height: min(var(--luzia-avatar-size, 6rem), 6rem); }
557
- :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; }
558
631
  /* Inline, the chat stays in the page but never taller than the screen. */
559
632
  :host([mode='inline']) .panel { height: min(var(--luzia-inline-height), 85vh); }
560
633
  .composer { margin-bottom: max(0.75rem, env(safe-area-inset-bottom)); }
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;CA2mBrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luzia-widget",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Embeddable luzIA chat widget (framework-free Web Component)",
5
5
  "license": "MIT",
6
6
  "author": "Sergio Deri <sergio.deri@astrocode.uy>",