luzia-widget 0.1.0 → 0.1.2

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 CHANGED
@@ -16,6 +16,6 @@ import { defineLuziaWidget } from 'luzia-widget';
16
16
  defineLuziaWidget();
17
17
  ```
18
18
 
19
- Attributes: `endpoint`, `contact`, `greeting`, `suggested-questions` (JSON array), `mode` (`bubble` | `inline`), `theme` (`light` | `dark` | `auto`), `avatar` (image URL shown large at the top of the chat, like a video call; luzIA's icon when unset). Theme colours are `--luzia-*` CSS custom properties. See the [root README](../../README.md#widget) for details. For React, use [`luzia-react`](../react).
19
+ Attributes: `endpoint`, `contact`, `greeting` (said by luzIA when a conversation starts; a default introduction when unset, none with `greeting=""`), `suggested-questions` (JSON array), `mode` (`bubble` | `inline`), `theme` (`light` | `dark` | `auto`), `avatar` (image URL shown large at the top of the chat, like a video call; luzIA's icon when unset). Theme colours are `--luzia-*` CSS custom properties. See the [root README](../../README.md#widget) for details. For React, use [`luzia-react`](../react).
20
20
 
21
21
  `pnpm build` emits the module build and `dist/luzia-widget.js` (the script bundle, built with esbuild from `src/register.ts`).
package/dist/element.d.ts CHANGED
@@ -59,6 +59,7 @@ export declare class LuziaWidgetElement extends BaseElement implements LuziaWidg
59
59
  set endpoint(value: string);
60
60
  get contact(): string;
61
61
  set contact(value: string);
62
+ /** The Owner's greeting; without the attribute, luzIA introduces itself. An empty `greeting=""` turns it off. */
62
63
  get greeting(): string;
63
64
  set greeting(value: string);
64
65
  get suggestedQuestions(): string[];
package/dist/element.js CHANGED
@@ -7,6 +7,32 @@ export const LUZIA_WIDGET_TAG = 'luzia-widget';
7
7
  // Lets this module be imported during server-side rendering, where there is no DOM.
8
8
  const BaseElement = typeof HTMLElement === 'undefined' ? class {
9
9
  } : HTMLElement;
10
+ /**
11
+ * luzIA's own introduction, in the page's language (Spanish or English), for
12
+ * Owners who set no greeting: by the Owner's name when the server shares it.
13
+ */
14
+ function defaultGreeting(name = null) {
15
+ const language = (document.documentElement.lang || navigator.language || 'en').toLowerCase();
16
+ return language.startsWith('es')
17
+ ? `¡Hola! Soy luzIA, una IA que responde preguntas sobre ${name ?? 'la persona de este portfolio'}: su experiencia, sus proyectos y lo que busca. ¿Qué te gustaría saber?`
18
+ : `Hi! I’m luzIA, an AI agent that answers questions about ${name ?? 'the person behind this portfolio'}: their experience, their projects and what they’re looking for. What would you like to know?`;
19
+ }
20
+ /** How long the greeting waits for the Owner's name before luzIA introduces itself without it. */
21
+ const OWNER_WAIT_MS = 1_500;
22
+ /**
23
+ * Asks the luzIA server who it talks about (GET on the endpoint; the server
24
+ * lets browsers cache the answer). `null` when it can't say, e.g. an older server.
25
+ */
26
+ function lookUpOwner(endpoint) {
27
+ return fetch(endpoint, { headers: { accept: 'application/json' } })
28
+ .then(async (response) => {
29
+ if (!response.ok)
30
+ return null;
31
+ const body = (await response.json());
32
+ return typeof body.owner?.name === 'string' && body.owner.name.trim() ? body.owner.name.trim() : null;
33
+ })
34
+ .catch(() => null);
35
+ }
10
36
  /** How long the speech bubble stays after the mouse leaves it. */
11
37
  const SPEECH_AFTER_HOVER_MS = 2_000;
12
38
  /** luzIA's own icon, in the accent colours so it follows the Owner's theme. */
@@ -67,8 +93,9 @@ export class LuziaWidgetElement extends BaseElement {
67
93
  set contact(value) {
68
94
  this.setAttribute('contact', value);
69
95
  }
96
+ /** The Owner's greeting; without the attribute, luzIA introduces itself. An empty `greeting=""` turns it off. */
70
97
  get greeting() {
71
- return this.getAttribute('greeting') ?? '';
98
+ return this.getAttribute('greeting') ?? defaultGreeting();
72
99
  }
73
100
  set greeting(value) {
74
101
  this.setAttribute('greeting', value);
@@ -108,8 +135,18 @@ export class LuziaWidgetElement extends BaseElement {
108
135
  const root = this.attachShadow({ mode: 'open' });
109
136
  root.innerHTML = `<style>${styles}</style>${TEMPLATE}`;
110
137
  persistConversation(this.conversation, storageKey(this.endpoint));
111
- this.#view = new View(root, this.conversation, () => this.contact);
138
+ // Without a greeting of the Owner's own, luzIA introduces itself by the Owner's name, which the server knows.
139
+ let lookup = null;
140
+ const owner = () => {
141
+ if (this.hasAttribute('greeting') || !this.endpoint)
142
+ return null;
143
+ lookup ??= lookUpOwner(this.endpoint);
144
+ return lookup;
145
+ };
146
+ this.#view = new View(root, this.conversation, () => this.contact, owner);
112
147
  this.#view.configure(this);
148
+ // Asked as the page loads, so the name is ready when the chat opens.
149
+ void owner();
113
150
  }
114
151
  attributeChangedCallback() {
115
152
  this.#view?.configure(this);
@@ -141,8 +178,17 @@ class View {
141
178
  #stage;
142
179
  #speech;
143
180
  #speechText;
144
- /** The reply luzIA is "saying" in the speech bubble (index in the conversation), kept out of the history until it ends. */
181
+ /**
182
+ * What luzIA is "saying" in the speech bubble, kept out of the history until
183
+ * it ends: a reply (its index in the conversation) or the greeting.
184
+ */
145
185
  #speaking = null;
186
+ #greetingText = '';
187
+ #host;
188
+ /** Stops following the visible area of the screen (see {@link View.#followViewport}). */
189
+ #unfollowViewport = null;
190
+ /** luzIA greets once per conversation: when the chat first shows, and again after "New conversation". */
191
+ #greeted = false;
146
192
  #speechTimer;
147
193
  /** While the mouse is over the bubble, it stays (the Visitor may be reading or scrolling it). */
148
194
  #speechHovered = false;
@@ -159,8 +205,12 @@ class View {
159
205
  #contact;
160
206
  #mode = 'bubble';
161
207
  #wasStreaming = false;
162
- constructor(root, conversation, contact) {
208
+ #owner;
209
+ #ownerName = null;
210
+ constructor(root, conversation, contact, owner = () => null) {
211
+ this.#owner = owner;
163
212
  this.#conversation = conversation;
213
+ this.#host = root.host;
164
214
  this.#contact = contact;
165
215
  this.#bubble = root.querySelector('.bubble');
166
216
  this.#panel = root.querySelector('.panel');
@@ -199,6 +249,8 @@ class View {
199
249
  });
200
250
  root.querySelector('.new-conversation').addEventListener('click', () => {
201
251
  conversation.reset();
252
+ this.#greeted = false;
253
+ this.#greet();
202
254
  this.#input.focus();
203
255
  });
204
256
  this.#form.addEventListener('submit', (event) => {
@@ -217,9 +269,8 @@ class View {
217
269
  /** Applies the Owner's options; called on mount and whenever one changes. */
218
270
  configure(options) {
219
271
  this.#showAvatar(options.avatar.trim());
220
- const greeting = options.greeting.trim();
221
- this.#greeting.textContent = greeting;
222
- this.#greeting.hidden = !greeting;
272
+ this.#greetingText = this.#ownerName && this.#owner() ? defaultGreeting(this.#ownerName) : options.greeting.trim();
273
+ this.#greeting.textContent = this.#greetingText;
223
274
  this.#suggestions.replaceChildren(...options.suggestedQuestions.map((question) => {
224
275
  const button = document.createElement('button');
225
276
  button.type = 'button';
@@ -258,6 +309,71 @@ class View {
258
309
  #setOpen(open) {
259
310
  this.#panel.hidden = !open;
260
311
  this.#bubble.setAttribute('aria-expanded', String(open));
312
+ if (open)
313
+ this.#greet();
314
+ this.#unfollowViewport?.();
315
+ this.#unfollowViewport = open ? this.#followViewport() : null;
316
+ }
317
+ /**
318
+ * On a phone the chat fills the screen, but an on-screen keyboard covers its
319
+ * lower part and the browser scrolls the page under it, pushing luzIA's
320
+ * picture and speech bubble out of view. While the chat is open it follows
321
+ * the part of the screen that is actually visible (`visualViewport`), and
322
+ * marks the host with `data-keyboard` so the picture gets smaller.
323
+ */
324
+ #followViewport() {
325
+ const viewport = window.visualViewport;
326
+ if (!viewport)
327
+ return null;
328
+ const fit = () => {
329
+ const phone = this.#mode === 'bubble' && window.matchMedia('(max-width: 480px)').matches;
330
+ if (!phone)
331
+ return this.#clearViewport();
332
+ this.#host.style.setProperty('--luzia-viewport-height', `${viewport.height}px`);
333
+ this.#host.style.setProperty('--luzia-viewport-top', `${viewport.offsetTop}px`);
334
+ // A keyboard takes a good part of the screen; browser bars alone don't.
335
+ this.#host.toggleAttribute('data-keyboard', viewport.height < window.innerHeight * 0.75);
336
+ };
337
+ fit();
338
+ viewport.addEventListener('resize', fit);
339
+ viewport.addEventListener('scroll', fit);
340
+ return () => {
341
+ viewport.removeEventListener('resize', fit);
342
+ viewport.removeEventListener('scroll', fit);
343
+ this.#clearViewport();
344
+ };
345
+ }
346
+ #clearViewport() {
347
+ this.#host.style.removeProperty('--luzia-viewport-height');
348
+ this.#host.style.removeProperty('--luzia-viewport-top');
349
+ this.#host.removeAttribute('data-keyboard');
350
+ }
351
+ /** luzIA says the greeting in the bubble when a conversation starts empty (never over a restored one). */
352
+ #greet() {
353
+ if (this.#greeted || this.#panel.hidden)
354
+ return;
355
+ this.#greeted = true;
356
+ const say = () => {
357
+ if (!this.#greetingText || this.#panel.hidden || this.#conversation.state.messages.length > 0)
358
+ return;
359
+ this.#stopSpeaking();
360
+ this.#speaking = 'greeting';
361
+ this.#showSpeech(this.#greetingText);
362
+ this.#render(this.#conversation.state);
363
+ };
364
+ const lookup = this.#owner();
365
+ if (!lookup)
366
+ return say();
367
+ // Wait briefly for the Owner's name; without it, luzIA still introduces itself.
368
+ const timeout = new Promise((resolve) => setTimeout(() => resolve(null), OWNER_WAIT_MS));
369
+ void Promise.race([lookup, timeout]).then((name) => {
370
+ if (name) {
371
+ this.#ownerName = name;
372
+ this.#greetingText = defaultGreeting(name);
373
+ this.#greeting.textContent = this.#greetingText;
374
+ }
375
+ say();
376
+ });
261
377
  }
262
378
  /** The Owner's image at the top of the chat, or luzIA's icon. Decorative: the title already says "luzIA". */
263
379
  #showAvatar(url) {
@@ -317,19 +433,22 @@ class View {
317
433
  this.#showSpeech(state.messages[last].content);
318
434
  }
319
435
  else if (this.#speaking !== null) {
320
- const stillThisReply = this.#speaking === last && state.status === 'idle';
321
- if (!stillThisReply)
436
+ const greeting = this.#speaking === 'greeting';
437
+ // The greeting stays until the Visitor says something; a reply until another one starts.
438
+ const stillSaying = greeting ? state.messages.length === 0 : this.#speaking === last && state.status === 'idle';
439
+ if (!stillSaying)
322
440
  this.#stopSpeaking();
323
441
  else if (this.#speechTimer === undefined && !this.#speechHovered) {
324
- const text = state.messages[last].content;
442
+ const text = greeting ? this.#greetingText : state.messages[last].content;
325
443
  const delay = this.#speechVisited ? SPEECH_AFTER_HOVER_MS : Math.min(10_000, 4_000 + text.length * 40);
326
444
  this.#speechTimer = setTimeout(() => this.#fadeSpeech(), delay);
327
445
  }
328
446
  }
329
- // The reply being said stays out of the history until the bubble is gone.
447
+ // What is being said stays out of the history until the bubble is gone.
330
448
  [...this.#messages.children].forEach((item, index) => {
331
449
  item.hidden = index === this.#speaking;
332
450
  });
451
+ this.#greeting.hidden = !this.#greetingText || this.#speaking === 'greeting';
333
452
  }
334
453
  #showSpeech(text) {
335
454
  this.#speech.classList.remove('leaving');
@@ -1 +1 @@
1
- {"version":3,"file":"element.js","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,YAAY,EAA0B,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AA2C/C,oFAAoF;AACpF,MAAM,WAAW,GACf,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAE;CAA0C,CAAC,CAAC,CAAC,WAAW,CAAC;AAEjG,kEAAkE;AAClE,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAEpC,+EAA+E;AAC/E,MAAM,UAAU,GAAG;;;OAGZ,CAAC;AAER,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BhB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IACxC,YAAY,GAAG,IAAI,YAAY,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5E,KAAK,GAAgB,IAAI,CAAC;IAE1B,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,I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C,KAAK,EAAE,SAAS,CAAC,CAAC;QAEjC,qDAAqD;QACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,KAAK,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1F,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnD,MAAM,gBAAgB,GAAG,OAAO,KAAK,OAAO,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,gBAAgB,CAAC;QACxC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS,IAAI,gBAAgB,CAAC;QACpD,qGAAqG;QACrG,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;YAAE,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;IACzG,CAAC;CACF"}
@@ -1,4 +1,4 @@
1
- var S="conversation_limit_reached",E="message_too_long";function m(i){return i.code===S?"limit":i.code===E?"too-long":"unavailable"}var T={limit:"You've reached the message limit for this conversation.","too-long":"That message is too long. Please shorten it and try again.",unavailable:"luzIA is unavailable right now. Please try again later."};function p(i,e,t){if(i.hidden=e===null,i.replaceChildren(),e===null)return;i.append(T[e]);let s=t.trim();e==="too-long"||!s||i.append(" You can get in touch directly: ",k(s),".")}function k(i){let e=/^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/.test(i)?`mailto:${i}`:/^https?:\/\/\S+$/i.test(i)?i:null;if(!e)return document.createTextNode(i);let t=document.createElement("a");return t.href=e,t.textContent=i,e.startsWith("mailto:")||(t.target="_blank",t.rel="noopener noreferrer"),t}var o=class extends Error{code;status;constructor(e,t,s){super(t),this.name="LuziaRequestError",this.code=e,this.status=s}};async function*b(i,e,t){let s;try{s=await fetch(i,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({messages:e}),signal:t})}catch(n){if(t?.aborted)return;throw new o("network_error",f(n))}if(!s.ok)throw await M(s);if(!s.body)throw new o("network_error","The reply had no body.",s.status);let r=s.body.pipeThrough(new TextDecoderStream).getReader();try{for(;;){let{done:n,value:a}=await r.read();if(n)return;a&&(yield a)}}catch(n){if(t?.aborted)return;throw new o("network_error",f(n),s.status)}finally{r.releaseLock()}}async function M(i){let t=(await i.json().catch(()=>{}))?.error;return new o(typeof t?.code=="string"?t.code:"http_error",typeof t?.message=="string"?t.message:`The server answered ${i.status}.`,i.status)}function f(i){return i instanceof Error?i.message:String(i)}var d=class{#e;#n=new Set;#l;#t=null;constructor(e){this.#l=e,this.#e={messages:e.messages??[],status:"idle",error:null,unsent:null}}get state(){return this.#e}subscribe(e){return this.#n.add(e),()=>this.#n.delete(e)}send(e){let t=e.trim();return!t||this.#e.status==="streaming"?!1:(this.#c([...this.#e.messages,{role:"user",content:t}]),!0)}abort(){this.#t?.abort()}reset(e=[]){let t=this.#t;this.#t=null,t?.abort(),this.#i({messages:e,status:"idle",error:null,unsent:null})}async#c(e){let t=new AbortController;this.#t=t;let s="";this.#i({messages:[...e,{role:"assistant",content:s}],status:"streaming",error:null,unsent:null});try{for await(let r of b(this.#l.endpoint(),e,t.signal)){if(this.#t!==t)return;s+=r,this.#i({...this.#e,messages:[...e,{role:"assistant",content:s}]})}if(this.#t!==t)return;this.#i({messages:v(e,s),status:"idle",error:null,unsent:null})}catch(r){if(this.#t!==t)return;let n=r instanceof o?r:new o("network_error",String(r));s?this.#i({messages:v(e,s),status:"error",error:n,unsent:null}):this.#i({messages:e.slice(0,-1),status:"error",error:n,unsent:e.at(-1)?.content??null})}finally{this.#t===t&&(this.#t=null)}}#i(e){this.#e=e;for(let t of this.#n)t(e)}};function v(i,e){return e?[...i,{role:"assistant",content:e}]:i}function w(i){let e=i;try{e=new URL(i,document.baseURI).href}catch{}return`luzia:conversation:${e}`}function z(i,e){let t=I();if(!t)return()=>{};let s=A(t,e);s&&i.state.messages.length===0&&i.reset(s);let r=x(y(i.state));return i.subscribe(n=>{let a=y(n),l=x(a);if(l!==r){r=l;try{a.length===0?t.removeItem(e):t.setItem(e,l)}catch{}}})}function y(i){return i.status==="streaming"?i.messages.slice(0,-1):i.messages}function x(i){let e={v:1,messages:[...i]};return JSON.stringify(e)}function A(i,e){try{let t=i.getItem(e);if(t===null)return null;let s=JSON.parse(t);return O(s)?s.messages.map(({role:r,content:n})=>({role:r,content:n})):null}catch{return null}}function O(i){if(typeof i!="object"||i===null)return!1;let{v:e,messages:t}=i;return e===1&&Array.isArray(t)&&t.every(R)}function R(i){if(typeof i!="object"||i===null)return!1;let{role:e,content:t}=i;return(e==="user"||e==="assistant")&&typeof t=="string"}function I(){try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}}var L=`
1
+ var k="conversation_limit_reached",E="message_too_long";function p(i){return i.code===k?"limit":i.code===E?"too-long":"unavailable"}var T={limit:"You've reached the message limit for this conversation.","too-long":"That message is too long. Please shorten it and try again.",unavailable:"luzIA is unavailable right now. Please try again later."};function f(i,e,t){if(i.hidden=e===null,i.replaceChildren(),e===null)return;i.append(T[e]);let s=t.trim();e==="too-long"||!s||i.append(" You can get in touch directly: ",A(s),".")}function A(i){let e=/^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/.test(i)?`mailto:${i}`:/^https?:\/\/\S+$/i.test(i)?i:null;if(!e)return document.createTextNode(i);let t=document.createElement("a");return t.href=e,t.textContent=i,e.startsWith("mailto:")||(t.target="_blank",t.rel="noopener noreferrer"),t}var l=class extends Error{code;status;constructor(e,t,s){super(t),this.name="LuziaRequestError",this.code=e,this.status=s}};async function*v(i,e,t){let s;try{s=await fetch(i,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({messages:e}),signal:t})}catch(r){if(t?.aborted)return;throw new l("network_error",b(r))}if(!s.ok)throw await M(s);if(!s.body)throw new l("network_error","The reply had no body.",s.status);let n=s.body.pipeThrough(new TextDecoderStream).getReader();try{for(;;){let{done:r,value:o}=await n.read();if(r)return;o&&(yield o)}}catch(r){if(t?.aborted)return;throw new l("network_error",b(r),s.status)}finally{n.releaseLock()}}async function M(i){let t=(await i.json().catch(()=>{}))?.error;return new l(typeof t?.code=="string"?t.code:"http_error",typeof t?.message=="string"?t.message:`The server answered ${i.status}.`,i.status)}function b(i){return i instanceof Error?i.message:String(i)}var d=class{#e;#r=new Set;#c;#t=null;constructor(e){this.#c=e,this.#e={messages:e.messages??[],status:"idle",error:null,unsent:null}}get state(){return this.#e}subscribe(e){return this.#r.add(e),()=>this.#r.delete(e)}send(e){let t=e.trim();return!t||this.#e.status==="streaming"?!1:(this.#g([...this.#e.messages,{role:"user",content:t}]),!0)}abort(){this.#t?.abort()}reset(e=[]){let t=this.#t;this.#t=null,t?.abort(),this.#i({messages:e,status:"idle",error:null,unsent:null})}async#g(e){let t=new AbortController;this.#t=t;let s="";this.#i({messages:[...e,{role:"assistant",content:s}],status:"streaming",error:null,unsent:null});try{for await(let n of v(this.#c.endpoint(),e,t.signal)){if(this.#t!==t)return;s+=n,this.#i({...this.#e,messages:[...e,{role:"assistant",content:s}]})}if(this.#t!==t)return;this.#i({messages:y(e,s),status:"idle",error:null,unsent:null})}catch(n){if(this.#t!==t)return;let r=n instanceof l?n:new l("network_error",String(n));s?this.#i({messages:y(e,s),status:"error",error:r,unsent:null}):this.#i({messages:e.slice(0,-1),status:"error",error:r,unsent:e.at(-1)?.content??null})}finally{this.#t===t&&(this.#t=null)}}#i(e){this.#e=e;for(let t of this.#r)t(e)}};function y(i,e){return e?[...i,{role:"assistant",content:e}]:i}function z(i){let e=i;try{e=new URL(i,document.baseURI).href}catch{}return`luzia:conversation:${e}`}function L(i,e){let t=_();if(!t)return()=>{};let s=I(t,e);s&&i.state.messages.length===0&&i.reset(s);let n=x(w(i.state));return i.subscribe(r=>{let o=w(r),u=x(o);if(u!==n){n=u;try{o.length===0?t.removeItem(e):t.setItem(e,u)}catch{}}})}function w(i){return i.status==="streaming"?i.messages.slice(0,-1):i.messages}function x(i){let e={v:1,messages:[...i]};return JSON.stringify(e)}function I(i,e){try{let t=i.getItem(e);if(t===null)return null;let s=JSON.parse(t);return O(s)?s.messages.map(({role:n,content:r})=>({role:n,content:r})):null}catch{return null}}function O(i){if(typeof i!="object"||i===null)return!1;let{v:e,messages:t}=i;return e===1&&Array.isArray(t)&&t.every(H)}function H(i){if(typeof i!="object"||i===null)return!1;let{role:e,content:t}=i;return(e==="user"||e==="assistant")&&typeof t=="string"}function _(){try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}}var C=`
2
2
  :host {
3
3
  --luzia-accent: #4f46e5;
4
4
  --luzia-accent-contrast: #ffffff;
@@ -308,28 +308,32 @@ var S="conversation_limit_reached",E="message_too_long";function m(i){return i.c
308
308
  }
309
309
  .composer button:disabled { opacity: 0.5; cursor: default; }
310
310
  @media (max-width: 480px) {
311
+ /* The whole visible screen: above the on-screen keyboard when it is open (set by the element from visualViewport). */
311
312
  .panel {
312
313
  position: fixed;
313
- top: 0;
314
+ top: var(--luzia-viewport-top, 0px);
314
315
  left: 0;
315
316
  width: 100vw;
316
- height: 100vh;
317
+ height: var(--luzia-viewport-height, 100vh);
317
318
  margin: 0;
318
319
  border-radius: 0;
319
320
  }
320
321
  @supports (height: 100dvh) {
321
- .panel { height: 100dvh; }
322
+ .panel { height: var(--luzia-viewport-height, 100dvh); }
322
323
  }
324
+ /* With the keyboard open there is little room: a smaller picture keeps the speech bubble and the last messages in view. */
325
+ :host([data-keyboard]) .avatar { height: min(var(--luzia-avatar-size, 6rem), 6rem); }
326
+ :host([data-keyboard]) .speech-text { max-height: 4.5rem; }
323
327
  /* Inline, the chat stays in the page but never taller than the screen. */
324
328
  :host([mode='inline']) .panel { height: min(var(--luzia-inline-height), 85vh); }
325
329
  .composer { padding-bottom: max(0.75rem, env(safe-area-inset-bottom)); }
326
330
  /* Below 16px, mobile browsers zoom the page when the text box gets focus. */
327
331
  .composer textarea { font-size: 16px; }
328
332
  }
329
- `;var g="luzia-widget",_=typeof HTMLElement>"u"?class{}:HTMLElement,q=2e3,H=`<svg viewBox="0 0 32 32" width="100%" height="100%" focusable="false">
333
+ `;var m="luzia-widget",q=typeof HTMLElement>"u"?class{}:HTMLElement;function c(i=null){return(document.documentElement.lang||navigator.language||"en").toLowerCase().startsWith("es")?`\xA1Hola! Soy luzIA, una IA que responde preguntas sobre ${i??"la persona de este portfolio"}: su experiencia, sus proyectos y lo que busca. \xBFQu\xE9 te gustar\xEDa saber?`:`Hi! I\u2019m luzIA, an AI agent that answers questions about ${i??"the person behind this portfolio"}: their experience, their projects and what they\u2019re looking for. What would you like to know?`}var R=1500;function W(i){return fetch(i,{headers:{accept:"application/json"}}).then(async e=>{if(!e.ok)return null;let t=await e.json();return typeof t.owner?.name=="string"&&t.owner.name.trim()?t.owner.name.trim():null}).catch(()=>null)}var N=2e3,P=`<svg viewBox="0 0 32 32" width="100%" height="100%" focusable="false">
330
334
  <circle cx="16" cy="16" r="16" fill="var(--luzia-accent-contrast)" />
331
335
  <path d="M16 6l2.6 6.4L25 15l-6.4 2.6L16 24l-2.6-6.4L7 15l6.4-2.6z" fill="var(--luzia-accent)" />
332
- </svg>`,W=`
336
+ </svg>`,V=`
333
337
  <section class="panel" role="dialog" aria-label="luzIA" hidden>
334
338
  <header class="header">
335
339
  <h2 class="title">luzIA</h2>
@@ -355,4 +359,4 @@ var S="conversation_limit_reached",E="message_too_long";function m(i){return i.c
355
359
  <button type="button" class="bubble" aria-label="luzIA chat" aria-expanded="false">
356
360
  <span aria-hidden="true">luzIA</span>
357
361
  </button>
358
- `,c=class extends _{conversation=new d({endpoint:()=>this.endpoint});#e=null;get endpoint(){return this.getAttribute("endpoint")??""}set endpoint(e){this.setAttribute("endpoint",e)}get contact(){return this.getAttribute("contact")??""}set contact(e){this.setAttribute("contact",e)}get greeting(){return this.getAttribute("greeting")??""}set greeting(e){this.setAttribute("greeting",e)}get suggestedQuestions(){return N(this.getAttribute("suggested-questions"))}set suggestedQuestions(e){this.setAttribute("suggested-questions",JSON.stringify(e))}get mode(){return this.getAttribute("mode")==="inline"?"inline":"bubble"}set mode(e){this.setAttribute("mode",e)}get theme(){let e=this.getAttribute("theme");return e==="dark"||e==="auto"?e:"light"}set theme(e){this.setAttribute("theme",e)}get avatar(){return this.getAttribute("avatar")??""}set avatar(e){this.setAttribute("avatar",e)}static get observedAttributes(){return["greeting","suggested-questions","mode","avatar"]}connectedCallback(){if(this.#e)return;let e=this.attachShadow({mode:"open"});e.innerHTML=`<style>${L}</style>${W}`,z(this.conversation,w(this.endpoint)),this.#e=new h(e,this.conversation,()=>this.contact),this.#e.configure(this)}attributeChangedCallback(){this.#e?.configure(this)}};function N(i){if(!i)return[];let e;try{e=JSON.parse(i)}catch{return[]}return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim()).filter(Boolean):[]}var h=class{#e;#n;#l;#t;#c;#i;#m;#r;#h;#u=null;#a;#p=!1;#v=!1;#o;#y;#f;#L;#b;#s;#C;#d;#S;#x="bubble";#E=!1;constructor(e,t,s){this.#d=t,this.#S=s,this.#e=e.querySelector(".bubble"),this.#n=e.querySelector(".panel"),this.#l=e.querySelector(".close"),this.#t=e.querySelector(".body"),this.#c=e.querySelector(".greeting"),this.#i=e.querySelector(".avatar"),this.#m=e.querySelector(".stage"),this.#r=e.querySelector(".speech"),this.#h=e.querySelector(".speech-text"),this.#r.addEventListener("mouseenter",()=>{this.#p=!0,this.#v=!0,clearTimeout(this.#a),this.#a=void 0,this.#r.classList.remove("leaving")}),this.#r.addEventListener("mouseleave",()=>{this.#p=!1,this.#g(this.#d.state)}),this.#o=e.querySelector(".messages"),this.#y=e.querySelector(".announcer"),this.#f=e.querySelector(".suggestions"),this.#L=e.querySelector(".alert"),this.#b=e.querySelector(".composer"),this.#s=this.#b.querySelector("textarea"),this.#C=this.#b.querySelector("button"),this.#e.addEventListener("click",()=>this.#w(this.#e.getAttribute("aria-expanded")!=="true")),this.#l.addEventListener("click",()=>this.#w(!1)),this.#n.addEventListener("keydown",r=>{r.key==="Escape"&&this.#x==="bubble"&&!r.isComposing&&(r.preventDefault(),this.#w(!1))}),e.querySelector(".new-conversation").addEventListener("click",()=>{t.reset(),this.#s.focus()}),this.#b.addEventListener("submit",r=>{r.preventDefault(),this.#k()}),this.#s.addEventListener("keydown",r=>{r.key==="Enter"&&!r.shiftKey&&!r.isComposing&&(r.preventDefault(),this.#k())}),t.subscribe(r=>this.#g(r)),this.#g(t.state)}configure(e){this.#A(e.avatar.trim());let t=e.greeting.trim();this.#c.textContent=t,this.#c.hidden=!t,this.#f.replaceChildren(...e.suggestedQuestions.map(s=>{let r=document.createElement("button");r.type="button",r.className="suggestion",r.textContent=s,r.addEventListener("click",()=>{this.#d.send(s)&&this.#s.focus()});let n=document.createElement("li");return n.append(r),n})),this.#g(this.#d.state),e.mode!==this.#x&&this.#M(e.mode)}#M(e){this.#x=e;let t=e==="inline";this.#n.setAttribute("role",t?"region":"dialog"),this.#e.hidden=t,this.#l.hidden=t,this.#T(t)}#w(e){this.#T(e),(e?this.#s:this.#e).focus()}#T(e){this.#n.hidden=!e,this.#e.setAttribute("aria-expanded",String(e))}#A(e){let t=this.#i.querySelector("img")?.getAttribute("src")??null;if(!(e&&t===e)&&!(!e&&t===null&&this.#i.firstChild))if(e){let s=document.createElement("img");s.src=e,s.alt="",this.#i.replaceChildren(s)}else this.#i.innerHTML=H}#k(){let e=this.#s.value;this.#d.send(e)&&(this.#s.value="",this.#s.focus())}#O(e,t){let s=this.#E&&!t;if(this.#E=t,(t||e.messages.length===0)&&(this.#y.textContent=""),!s)return;let r=e.messages.at(-1);this.#y.textContent=e.status==="idle"&&r?.role==="assistant"?r.content:""}#R(e,t){let s=e.messages.length-1,r=e.messages[s]?.role==="assistant";if(t&&r)this.#u!==s&&this.#z(),this.#u=s,clearTimeout(this.#a),this.#I(e.messages[s].content);else if(this.#u!==null){if(!(this.#u===s&&e.status==="idle"))this.#z();else if(this.#a===void 0&&!this.#p){let a=e.messages[s].content,l=this.#v?q:Math.min(1e4,4e3+a.length*40);this.#a=setTimeout(()=>this.#_(),l)}}[...this.#o.children].forEach((n,a)=>{n.hidden=a===this.#u})}#I(e){this.#r.classList.remove("leaving"),this.#r.hidden=e==="",this.#m.toggleAttribute("data-saying",!this.#r.hidden),this.#h.textContent!==e&&(this.#h.textContent=e)}#_(){this.#r.classList.add("leaving"),this.#a=setTimeout(()=>{this.#z(),this.#g(this.#d.state)},400)}#z(){clearTimeout(this.#a),this.#a=void 0,this.#u=null,this.#r.hidden=!0,this.#p=!1,this.#v=!1,this.#m.removeAttribute("data-saying"),this.#h.scrollTop=0,this.#r.classList.remove("leaving"),this.#h.textContent=""}#g(e){for(e.messages.forEach((n,a)=>{let l=this.#o.children[a],u=l;(!u||u.dataset.role!==n.role)&&(u=document.createElement("li"),u.className="message",u.dataset.role=n.role,l?l.replaceWith(u):this.#o.append(u)),u.textContent!==n.content&&(u.textContent=n.content)});this.#o.children.length>e.messages.length;)this.#o.lastElementChild?.remove();this.#f.hidden=e.messages.length>0||this.#f.children.length===0;let t=e.status==="streaming";this.#R(e,t),this.#t.scrollTop=this.#t.scrollHeight,this.#m.toggleAttribute("data-speaking",t),this.#o.setAttribute("aria-busy",String(t)),this.#O(e,t);let s=e.status==="error"&&e.error?m(e.error):null;p(this.#L,s,this.#S());let r=s==="limit";this.#s.disabled=r,this.#C.disabled=t||r,e.unsent!==null&&!r&&!this.#s.value&&(this.#s.value=e.unsent)}};function C(){customElements.get(g)||customElements.define(g,c)}C();export{d as Conversation,g as LUZIA_WIDGET_TAG,o as LuziaRequestError,c as LuziaWidgetElement,C as defineLuziaWidget};
362
+ `,h=class extends q{conversation=new d({endpoint:()=>this.endpoint});#e=null;get endpoint(){return this.getAttribute("endpoint")??""}set endpoint(e){this.setAttribute("endpoint",e)}get contact(){return this.getAttribute("contact")??""}set contact(e){this.setAttribute("contact",e)}get greeting(){return this.getAttribute("greeting")??c()}set greeting(e){this.setAttribute("greeting",e)}get suggestedQuestions(){return j(this.getAttribute("suggested-questions"))}set suggestedQuestions(e){this.setAttribute("suggested-questions",JSON.stringify(e))}get mode(){return this.getAttribute("mode")==="inline"?"inline":"bubble"}set mode(e){this.setAttribute("mode",e)}get theme(){let e=this.getAttribute("theme");return e==="dark"||e==="auto"?e:"light"}set theme(e){this.setAttribute("theme",e)}get avatar(){return this.getAttribute("avatar")??""}set avatar(e){this.setAttribute("avatar",e)}static get observedAttributes(){return["greeting","suggested-questions","mode","avatar"]}connectedCallback(){if(this.#e)return;let e=this.attachShadow({mode:"open"});e.innerHTML=`<style>${C}</style>${V}`,L(this.conversation,z(this.endpoint));let t=null,s=()=>this.hasAttribute("greeting")||!this.endpoint?null:(t??=W(this.endpoint),t);this.#e=new g(e,this.conversation,()=>this.contact,s),this.#e.configure(this),s()}attributeChangedCallback(){this.#e?.configure(this)}};function j(i){if(!i)return[];let e;try{e=JSON.parse(i)}catch{return[]}return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim()).filter(Boolean):[]}var g=class{#e;#r;#c;#t;#g;#i;#f;#n;#p;#a=null;#o="";#d;#T=null;#z=!1;#l;#b=!1;#L=!1;#h;#C;#v;#A;#y;#s;#M;#u;#I;#w="bubble";#O=!1;#S;#k=null;constructor(e,t,s,n=()=>null){this.#S=n,this.#u=t,this.#d=e.host,this.#I=s,this.#e=e.querySelector(".bubble"),this.#r=e.querySelector(".panel"),this.#c=e.querySelector(".close"),this.#t=e.querySelector(".body"),this.#g=e.querySelector(".greeting"),this.#i=e.querySelector(".avatar"),this.#f=e.querySelector(".stage"),this.#n=e.querySelector(".speech"),this.#p=e.querySelector(".speech-text"),this.#n.addEventListener("mouseenter",()=>{this.#b=!0,this.#L=!0,clearTimeout(this.#l),this.#l=void 0,this.#n.classList.remove("leaving")}),this.#n.addEventListener("mouseleave",()=>{this.#b=!1,this.#m(this.#u.state)}),this.#h=e.querySelector(".messages"),this.#C=e.querySelector(".announcer"),this.#v=e.querySelector(".suggestions"),this.#A=e.querySelector(".alert"),this.#y=e.querySelector(".composer"),this.#s=this.#y.querySelector("textarea"),this.#M=this.#y.querySelector("button"),this.#e.addEventListener("click",()=>this.#E(this.#e.getAttribute("aria-expanded")!=="true")),this.#c.addEventListener("click",()=>this.#E(!1)),this.#r.addEventListener("keydown",r=>{r.key==="Escape"&&this.#w==="bubble"&&!r.isComposing&&(r.preventDefault(),this.#E(!1))}),e.querySelector(".new-conversation").addEventListener("click",()=>{t.reset(),this.#z=!1,this.#q(),this.#s.focus()}),this.#y.addEventListener("submit",r=>{r.preventDefault(),this.#R()}),this.#s.addEventListener("keydown",r=>{r.key==="Enter"&&!r.shiftKey&&!r.isComposing&&(r.preventDefault(),this.#R())}),t.subscribe(r=>this.#m(r)),this.#m(t.state)}configure(e){this.#V(e.avatar.trim()),this.#o=this.#k&&this.#S()?c(this.#k):e.greeting.trim(),this.#g.textContent=this.#o,this.#v.replaceChildren(...e.suggestedQuestions.map(t=>{let s=document.createElement("button");s.type="button",s.className="suggestion",s.textContent=t,s.addEventListener("click",()=>{this.#u.send(t)&&this.#s.focus()});let n=document.createElement("li");return n.append(s),n})),this.#m(this.#u.state),e.mode!==this.#w&&this.#N(e.mode)}#N(e){this.#w=e;let t=e==="inline";this.#r.setAttribute("role",t?"region":"dialog"),this.#e.hidden=t,this.#c.hidden=t,this.#H(t)}#E(e){this.#H(e),(e?this.#s:this.#e).focus()}#H(e){this.#r.hidden=!e,this.#e.setAttribute("aria-expanded",String(e)),e&&this.#q(),this.#T?.(),this.#T=e?this.#P():null}#P(){let e=window.visualViewport;if(!e)return null;let t=()=>{if(!(this.#w==="bubble"&&window.matchMedia("(max-width: 480px)").matches))return this.#_();this.#d.style.setProperty("--luzia-viewport-height",`${e.height}px`),this.#d.style.setProperty("--luzia-viewport-top",`${e.offsetTop}px`),this.#d.toggleAttribute("data-keyboard",e.height<window.innerHeight*.75)};return t(),e.addEventListener("resize",t),e.addEventListener("scroll",t),()=>{e.removeEventListener("resize",t),e.removeEventListener("scroll",t),this.#_()}}#_(){this.#d.style.removeProperty("--luzia-viewport-height"),this.#d.style.removeProperty("--luzia-viewport-top"),this.#d.removeAttribute("data-keyboard")}#q(){if(this.#z||this.#r.hidden)return;this.#z=!0;let e=()=>{!this.#o||this.#r.hidden||this.#u.state.messages.length>0||(this.#x(),this.#a="greeting",this.#W(this.#o),this.#m(this.#u.state))},t=this.#S();if(!t)return e();let s=new Promise(n=>setTimeout(()=>n(null),R));Promise.race([t,s]).then(n=>{n&&(this.#k=n,this.#o=c(n),this.#g.textContent=this.#o),e()})}#V(e){let t=this.#i.querySelector("img")?.getAttribute("src")??null;if(!(e&&t===e)&&!(!e&&t===null&&this.#i.firstChild))if(e){let s=document.createElement("img");s.src=e,s.alt="",this.#i.replaceChildren(s)}else this.#i.innerHTML=P}#R(){let e=this.#s.value;this.#u.send(e)&&(this.#s.value="",this.#s.focus())}#j(e,t){let s=this.#O&&!t;if(this.#O=t,(t||e.messages.length===0)&&(this.#C.textContent=""),!s)return;let n=e.messages.at(-1);this.#C.textContent=e.status==="idle"&&n?.role==="assistant"?n.content:""}#F(e,t){let s=e.messages.length-1,n=e.messages[s]?.role==="assistant";if(t&&n)this.#a!==s&&this.#x(),this.#a=s,clearTimeout(this.#l),this.#W(e.messages[s].content);else if(this.#a!==null){let r=this.#a==="greeting";if(!(r?e.messages.length===0:this.#a===s&&e.status==="idle"))this.#x();else if(this.#l===void 0&&!this.#b){let u=r?this.#o:e.messages[s].content,a=this.#L?N:Math.min(1e4,4e3+u.length*40);this.#l=setTimeout(()=>this.#$(),a)}}[...this.#h.children].forEach((r,o)=>{r.hidden=o===this.#a}),this.#g.hidden=!this.#o||this.#a==="greeting"}#W(e){this.#n.classList.remove("leaving"),this.#n.hidden=e==="",this.#f.toggleAttribute("data-saying",!this.#n.hidden),this.#p.textContent!==e&&(this.#p.textContent=e)}#$(){this.#n.classList.add("leaving"),this.#l=setTimeout(()=>{this.#x(),this.#m(this.#u.state)},400)}#x(){clearTimeout(this.#l),this.#l=void 0,this.#a=null,this.#n.hidden=!0,this.#b=!1,this.#L=!1,this.#f.removeAttribute("data-saying"),this.#p.scrollTop=0,this.#n.classList.remove("leaving"),this.#p.textContent=""}#m(e){for(e.messages.forEach((r,o)=>{let u=this.#h.children[o],a=u;(!a||a.dataset.role!==r.role)&&(a=document.createElement("li"),a.className="message",a.dataset.role=r.role,u?u.replaceWith(a):this.#h.append(a)),a.textContent!==r.content&&(a.textContent=r.content)});this.#h.children.length>e.messages.length;)this.#h.lastElementChild?.remove();this.#v.hidden=e.messages.length>0||this.#v.children.length===0;let t=e.status==="streaming";this.#F(e,t),this.#t.scrollTop=this.#t.scrollHeight,this.#f.toggleAttribute("data-speaking",t),this.#h.setAttribute("aria-busy",String(t)),this.#j(e,t);let s=e.status==="error"&&e.error?p(e.error):null;f(this.#A,s,this.#I());let n=s==="limit";this.#s.disabled=n,this.#M.disabled=t||n,e.unsent!==null&&!n&&!this.#s.value&&(this.#s.value=e.unsent)}};function S(){customElements.get(m)||customElements.define(m,h)}S();export{d as Conversation,m as LUZIA_WIDGET_TAG,l as LuziaRequestError,h as LuziaWidgetElement,S as defineLuziaWidget};
package/dist/styles.d.ts CHANGED
@@ -16,4 +16,4 @@
16
16
  * a focus ring for keyboard users. Below 480px wide the bubble's chat fills
17
17
  * the screen; the inline chat stays in the page at full width.
18
18
  */
19
- export declare const styles = "\n :host {\n --luzia-accent: #4f46e5;\n --luzia-accent-contrast: #ffffff;\n --luzia-surface: #ffffff;\n --luzia-text: #18181b;\n --luzia-muted: #f4f4f5;\n --luzia-font: system-ui, -apple-system, 'Segoe UI', sans-serif;\n --luzia-border: #d4d4d8;\n --luzia-inline-height: 38rem;\n position: fixed;\n right: 1.25rem;\n bottom: 1.25rem;\n z-index: 2147483000;\n font-family: var(--luzia-font);\n color: var(--luzia-text);\n }\n :host([theme='dark']) {\n --luzia-surface: #18181b;\n --luzia-text: #f4f4f5;\n --luzia-muted: #27272a;\n --luzia-border: #3f3f46;\n }\n @media (prefers-color-scheme: dark) {\n :host([theme='auto']) {\n --luzia-surface: #18181b;\n --luzia-text: #f4f4f5;\n --luzia-muted: #27272a;\n --luzia-border: #3f3f46;\n }\n }\n [hidden] { display: none !important; }\n button { min-width: 44px; min-height: 44px; }\n button:focus-visible,\n textarea:focus-visible {\n outline: 2px solid var(--luzia-accent);\n outline-offset: 2px;\n }\n /* The header is accent-coloured, so its focus ring takes the text colour. */\n .header button:focus-visible { outline-color: currentColor; outline-offset: -4px; }\n /* Read by screen readers only: each finished reply (see the element's View). */\n .announcer {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n border: 0;\n }\n .bubble {\n display: grid;\n place-items: center;\n width: 3.5rem;\n height: 3.5rem;\n margin-left: auto;\n border: none;\n border-radius: 50%;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n font: 600 0.8rem var(--luzia-font);\n box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);\n cursor: pointer;\n }\n .panel {\n display: flex;\n flex-direction: column;\n width: min(24rem, calc(100vw - 2.5rem));\n height: min(40rem, calc(100vh - 7rem));\n margin-bottom: 0.75rem;\n background: var(--luzia-surface);\n border-radius: 1rem;\n box-shadow: 0 12px 40px rgb(0 0 0 / 0.2);\n overflow: hidden;\n }\n :host([mode='inline']) {\n position: static;\n display: block;\n z-index: auto;\n }\n :host([mode='inline']) .panel {\n position: static;\n width: 100%;\n height: var(--luzia-inline-height);\n margin: 0;\n border: 1px solid var(--luzia-border);\n box-shadow: none;\n }\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.25rem 0.5rem 0.25rem 1rem;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n }\n /* Like a video call: luzIA's whole picture large and centred at the top, the conversation below it. */\n .stage {\n flex: none;\n display: flex;\n justify-content: flex-start;\n gap: 0.75rem;\n padding: 0.75rem 1rem 0;\n border-bottom: 1px solid var(--luzia-border);\n }\n /* The picture is shown whole, in its own shape (a cut-out stands on the divider line). */\n .avatar {\n display: block;\n height: var(--luzia-avatar-size, clamp(7rem, 30vh, 13rem));\n }\n .avatar img,\n .avatar svg {\n display: block;\n height: 100%;\n width: auto;\n max-width: 100%;\n object-fit: contain;\n transition: filter 0.2s ease;\n }\n .avatar svg { aspect-ratio: 1; margin-bottom: 0.75rem; height: calc(100% - 0.75rem); }\n /* luzIA stays on the left; her speech bubble appears on the right without moving her. */\n .speech {\n position: relative;\n flex: 1;\n align-self: flex-start;\n min-width: 0;\n margin: 0.75rem 0 0;\n padding: 0.55rem 0.75rem;\n border: 1px solid var(--luzia-border);\n border-radius: 0.9rem;\n background: var(--luzia-surface);\n color: var(--luzia-text);\n box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);\n font-size: 0.875rem;\n line-height: 1.4;\n opacity: 1;\n transition: opacity 0.4s ease;\n }\n .speech-text {\n display: block;\n max-height: calc(var(--luzia-avatar-size, clamp(7rem, 30vh, 13rem)) - 2.75rem);\n /* Long replies scroll inside the bubble, so their beginning can be read. */\n overflow-y: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n padding-inline-end: 0.25rem;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n /* The tail points back at luzIA's mouth (tune its height with --luzia-speech-tail-top). */\n .speech::before,\n .speech::after {\n content: '';\n position: absolute;\n border-block-style: solid;\n border-block-color: transparent;\n border-inline-end-style: solid;\n }\n .speech::before {\n top: var(--luzia-speech-tail-top, 1.6rem);\n left: -0.6rem;\n border-block-width: 0.45rem;\n border-inline-end-width: 0.6rem;\n border-inline-end-color: var(--luzia-border);\n }\n .speech::after {\n top: calc(var(--luzia-speech-tail-top, 1.6rem) + 1px);\n left: calc(-0.6rem + 1.5px);\n border-block-width: calc(0.45rem - 1px);\n border-inline-end-width: 0.6rem;\n border-inline-end-color: var(--luzia-surface);\n }\n .speech.leaving { opacity: 0; }\n @media (prefers-reduced-motion: reduce) {\n .speech { transition: none; }\n }\n /* While a reply streams in, a soft glow follows the picture's outline. */\n .stage[data-speaking] .avatar img,\n .stage[data-speaking] .avatar svg {\n filter: drop-shadow(0 0 6px var(--luzia-accent));\n animation: luzia-speaking 1.4s ease-in-out infinite;\n }\n @keyframes luzia-speaking {\n 50% { filter: drop-shadow(0 0 14px var(--luzia-accent)); }\n }\n @media (prefers-reduced-motion: reduce) {\n .stage[data-speaking] .avatar img,\n .stage[data-speaking] .avatar svg { animation: none; }\n }\n .title { margin: 0; font-size: 1rem; }\n .new-conversation {\n margin-inline: auto 0.5rem;\n padding: 0.25rem 0.5rem;\n border: 1px solid currentColor;\n border-radius: 0.375rem;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 0.8rem;\n cursor: pointer;\n }\n .close {\n border: none;\n background: transparent;\n color: inherit;\n font-size: 1.4rem;\n line-height: 1;\n cursor: pointer;\n }\n .body {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 1rem;\n overflow-y: auto;\n }\n .greeting {\n align-self: flex-start;\n max-width: 85%;\n margin: 0;\n padding: 0.5rem 0.75rem;\n border-radius: 0.75rem;\n background: var(--luzia-muted);\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n line-height: 1.4;\n }\n .messages {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n }\n .message {\n max-width: 85%;\n padding: 0.5rem 0.75rem;\n border-radius: 0.75rem;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n line-height: 1.4;\n }\n .message[data-role='user'] {\n align-self: flex-end;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n }\n .message[data-role='assistant'] {\n align-self: flex-start;\n background: var(--luzia-muted);\n }\n .suggestions {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: 0.5rem;\n margin: auto 0 0;\n padding: 0;\n list-style: none;\n }\n .suggestion {\n padding: 0.4rem 0.75rem;\n border: 1px solid var(--luzia-accent);\n border-radius: 999px;\n background: var(--luzia-surface);\n color: var(--luzia-text);\n font: 0.875rem var(--luzia-font);\n text-align: left;\n cursor: pointer;\n }\n .suggestion:hover { background: var(--luzia-muted); }\n .alert {\n margin: 0 1rem 0.5rem;\n font-size: 0.875rem;\n color: #b91c1c;\n }\n .alert a {\n color: inherit;\n }\n .composer {\n display: flex;\n gap: 0.5rem;\n padding: 0.75rem;\n border-top: 1px solid var(--luzia-muted);\n }\n .composer textarea {\n flex: 1;\n resize: none;\n padding: 0.5rem;\n border: 1px solid var(--luzia-border);\n border-radius: 0.5rem;\n background: var(--luzia-surface);\n color: var(--luzia-text);\n font: inherit;\n }\n .composer button {\n padding: 0 1rem;\n border: none;\n border-radius: 0.5rem;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n font: 600 0.875rem var(--luzia-font);\n cursor: pointer;\n }\n .composer button:disabled { opacity: 0.5; cursor: default; }\n @media (max-width: 480px) {\n .panel {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n margin: 0;\n border-radius: 0;\n }\n @supports (height: 100dvh) {\n .panel { height: 100dvh; }\n }\n /* Inline, the chat stays in the page but never taller than the screen. */\n :host([mode='inline']) .panel { height: min(var(--luzia-inline-height), 85vh); }\n .composer { padding-bottom: max(0.75rem, env(safe-area-inset-bottom)); }\n /* Below 16px, mobile browsers zoom the page when the text box gets focus. */\n .composer textarea { font-size: 16px; }\n }\n";
19
+ export declare const styles = "\n :host {\n --luzia-accent: #4f46e5;\n --luzia-accent-contrast: #ffffff;\n --luzia-surface: #ffffff;\n --luzia-text: #18181b;\n --luzia-muted: #f4f4f5;\n --luzia-font: system-ui, -apple-system, 'Segoe UI', sans-serif;\n --luzia-border: #d4d4d8;\n --luzia-inline-height: 38rem;\n position: fixed;\n right: 1.25rem;\n bottom: 1.25rem;\n z-index: 2147483000;\n font-family: var(--luzia-font);\n color: var(--luzia-text);\n }\n :host([theme='dark']) {\n --luzia-surface: #18181b;\n --luzia-text: #f4f4f5;\n --luzia-muted: #27272a;\n --luzia-border: #3f3f46;\n }\n @media (prefers-color-scheme: dark) {\n :host([theme='auto']) {\n --luzia-surface: #18181b;\n --luzia-text: #f4f4f5;\n --luzia-muted: #27272a;\n --luzia-border: #3f3f46;\n }\n }\n [hidden] { display: none !important; }\n button { min-width: 44px; min-height: 44px; }\n button:focus-visible,\n textarea:focus-visible {\n outline: 2px solid var(--luzia-accent);\n outline-offset: 2px;\n }\n /* The header is accent-coloured, so its focus ring takes the text colour. */\n .header button:focus-visible { outline-color: currentColor; outline-offset: -4px; }\n /* Read by screen readers only: each finished reply (see the element's View). */\n .announcer {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n border: 0;\n }\n .bubble {\n display: grid;\n place-items: center;\n width: 3.5rem;\n height: 3.5rem;\n margin-left: auto;\n border: none;\n border-radius: 50%;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n font: 600 0.8rem var(--luzia-font);\n box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);\n cursor: pointer;\n }\n .panel {\n display: flex;\n flex-direction: column;\n width: min(24rem, calc(100vw - 2.5rem));\n height: min(40rem, calc(100vh - 7rem));\n margin-bottom: 0.75rem;\n background: var(--luzia-surface);\n border-radius: 1rem;\n box-shadow: 0 12px 40px rgb(0 0 0 / 0.2);\n overflow: hidden;\n }\n :host([mode='inline']) {\n position: static;\n display: block;\n z-index: auto;\n }\n :host([mode='inline']) .panel {\n position: static;\n width: 100%;\n height: var(--luzia-inline-height);\n margin: 0;\n border: 1px solid var(--luzia-border);\n box-shadow: none;\n }\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.25rem 0.5rem 0.25rem 1rem;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n }\n /* Like a video call: luzIA's whole picture large and centred at the top, the conversation below it. */\n .stage {\n flex: none;\n display: flex;\n justify-content: flex-start;\n gap: 0.75rem;\n padding: 0.75rem 1rem 0;\n border-bottom: 1px solid var(--luzia-border);\n }\n /* The picture is shown whole, in its own shape (a cut-out stands on the divider line). */\n .avatar {\n display: block;\n height: var(--luzia-avatar-size, clamp(7rem, 30vh, 13rem));\n }\n .avatar img,\n .avatar svg {\n display: block;\n height: 100%;\n width: auto;\n max-width: 100%;\n object-fit: contain;\n transition: filter 0.2s ease;\n }\n .avatar svg { aspect-ratio: 1; margin-bottom: 0.75rem; height: calc(100% - 0.75rem); }\n /* luzIA stays on the left; her speech bubble appears on the right without moving her. */\n .speech {\n position: relative;\n flex: 1;\n align-self: flex-start;\n min-width: 0;\n margin: 0.75rem 0 0;\n padding: 0.55rem 0.75rem;\n border: 1px solid var(--luzia-border);\n border-radius: 0.9rem;\n background: var(--luzia-surface);\n color: var(--luzia-text);\n box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);\n font-size: 0.875rem;\n line-height: 1.4;\n opacity: 1;\n transition: opacity 0.4s ease;\n }\n .speech-text {\n display: block;\n max-height: calc(var(--luzia-avatar-size, clamp(7rem, 30vh, 13rem)) - 2.75rem);\n /* Long replies scroll inside the bubble, so their beginning can be read. */\n overflow-y: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n padding-inline-end: 0.25rem;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n /* The tail points back at luzIA's mouth (tune its height with --luzia-speech-tail-top). */\n .speech::before,\n .speech::after {\n content: '';\n position: absolute;\n border-block-style: solid;\n border-block-color: transparent;\n border-inline-end-style: solid;\n }\n .speech::before {\n top: var(--luzia-speech-tail-top, 1.6rem);\n left: -0.6rem;\n border-block-width: 0.45rem;\n border-inline-end-width: 0.6rem;\n border-inline-end-color: var(--luzia-border);\n }\n .speech::after {\n top: calc(var(--luzia-speech-tail-top, 1.6rem) + 1px);\n left: calc(-0.6rem + 1.5px);\n border-block-width: calc(0.45rem - 1px);\n border-inline-end-width: 0.6rem;\n border-inline-end-color: var(--luzia-surface);\n }\n .speech.leaving { opacity: 0; }\n @media (prefers-reduced-motion: reduce) {\n .speech { transition: none; }\n }\n /* While a reply streams in, a soft glow follows the picture's outline. */\n .stage[data-speaking] .avatar img,\n .stage[data-speaking] .avatar svg {\n filter: drop-shadow(0 0 6px var(--luzia-accent));\n animation: luzia-speaking 1.4s ease-in-out infinite;\n }\n @keyframes luzia-speaking {\n 50% { filter: drop-shadow(0 0 14px var(--luzia-accent)); }\n }\n @media (prefers-reduced-motion: reduce) {\n .stage[data-speaking] .avatar img,\n .stage[data-speaking] .avatar svg { animation: none; }\n }\n .title { margin: 0; font-size: 1rem; }\n .new-conversation {\n margin-inline: auto 0.5rem;\n padding: 0.25rem 0.5rem;\n border: 1px solid currentColor;\n border-radius: 0.375rem;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 0.8rem;\n cursor: pointer;\n }\n .close {\n border: none;\n background: transparent;\n color: inherit;\n font-size: 1.4rem;\n line-height: 1;\n cursor: pointer;\n }\n .body {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 1rem;\n overflow-y: auto;\n }\n .greeting {\n align-self: flex-start;\n max-width: 85%;\n margin: 0;\n padding: 0.5rem 0.75rem;\n border-radius: 0.75rem;\n background: var(--luzia-muted);\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n line-height: 1.4;\n }\n .messages {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n }\n .message {\n max-width: 85%;\n padding: 0.5rem 0.75rem;\n border-radius: 0.75rem;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n line-height: 1.4;\n }\n .message[data-role='user'] {\n align-self: flex-end;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n }\n .message[data-role='assistant'] {\n align-self: flex-start;\n background: var(--luzia-muted);\n }\n .suggestions {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: 0.5rem;\n margin: auto 0 0;\n padding: 0;\n list-style: none;\n }\n .suggestion {\n padding: 0.4rem 0.75rem;\n border: 1px solid var(--luzia-accent);\n border-radius: 999px;\n background: var(--luzia-surface);\n color: var(--luzia-text);\n font: 0.875rem var(--luzia-font);\n text-align: left;\n cursor: pointer;\n }\n .suggestion:hover { background: var(--luzia-muted); }\n .alert {\n margin: 0 1rem 0.5rem;\n font-size: 0.875rem;\n color: #b91c1c;\n }\n .alert a {\n color: inherit;\n }\n .composer {\n display: flex;\n gap: 0.5rem;\n padding: 0.75rem;\n border-top: 1px solid var(--luzia-muted);\n }\n .composer textarea {\n flex: 1;\n resize: none;\n padding: 0.5rem;\n border: 1px solid var(--luzia-border);\n border-radius: 0.5rem;\n background: var(--luzia-surface);\n color: var(--luzia-text);\n font: inherit;\n }\n .composer button {\n padding: 0 1rem;\n border: none;\n border-radius: 0.5rem;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n font: 600 0.875rem var(--luzia-font);\n cursor: pointer;\n }\n .composer button:disabled { opacity: 0.5; cursor: default; }\n @media (max-width: 480px) {\n /* The whole visible screen: above the on-screen keyboard when it is open (set by the element from visualViewport). */\n .panel {\n position: fixed;\n top: var(--luzia-viewport-top, 0px);\n left: 0;\n width: 100vw;\n height: var(--luzia-viewport-height, 100vh);\n margin: 0;\n border-radius: 0;\n }\n @supports (height: 100dvh) {\n .panel { height: var(--luzia-viewport-height, 100dvh); }\n }\n /* With the keyboard open there is little room: a smaller picture keeps the speech bubble and the last messages in view. */\n :host([data-keyboard]) .avatar { height: min(var(--luzia-avatar-size, 6rem), 6rem); }\n :host([data-keyboard]) .speech-text { max-height: 4.5rem; }\n /* Inline, the chat stays in the page but never taller than the screen. */\n :host([mode='inline']) .panel { height: min(var(--luzia-inline-height), 85vh); }\n .composer { padding-bottom: max(0.75rem, env(safe-area-inset-bottom)); }\n /* Below 16px, mobile browsers zoom the page when the text box gets focus. */\n .composer textarea { font-size: 16px; }\n }\n";
package/dist/styles.js CHANGED
@@ -326,18 +326,22 @@ export const styles = `
326
326
  }
327
327
  .composer button:disabled { opacity: 0.5; cursor: default; }
328
328
  @media (max-width: 480px) {
329
+ /* The whole visible screen: above the on-screen keyboard when it is open (set by the element from visualViewport). */
329
330
  .panel {
330
331
  position: fixed;
331
- top: 0;
332
+ top: var(--luzia-viewport-top, 0px);
332
333
  left: 0;
333
334
  width: 100vw;
334
- height: 100vh;
335
+ height: var(--luzia-viewport-height, 100vh);
335
336
  margin: 0;
336
337
  border-radius: 0;
337
338
  }
338
339
  @supports (height: 100dvh) {
339
- .panel { height: 100dvh; }
340
+ .panel { height: var(--luzia-viewport-height, 100dvh); }
340
341
  }
342
+ /* With the keyboard open there is little room: a smaller picture keeps the speech bubble and the last messages in view. */
343
+ :host([data-keyboard]) .avatar { height: min(var(--luzia-avatar-size, 6rem), 6rem); }
344
+ :host([data-keyboard]) .speech-text { max-height: 4.5rem; }
341
345
  /* Inline, the chat stays in the page but never taller than the screen. */
342
346
  :host([mode='inline']) .panel { height: min(var(--luzia-inline-height), 85vh); }
343
347
  .composer { padding-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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwUrB,CAAC"}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4UrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luzia-widget",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Embeddable luzIA chat widget (framework-free Web Component)",
5
5
  "license": "MIT",
6
6
  "author": "Sergio Deri <sergio.deri@astrocode.uy>",