luzia-widget 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,13 @@ 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
+ /** luzIA's own introduction, in the page's language (Spanish or English), for Owners who set no greeting. */
11
+ function defaultGreeting() {
12
+ const language = (document.documentElement.lang || navigator.language || 'en').toLowerCase();
13
+ return language.startsWith('es')
14
+ ? '¡Hola! Soy luzIA, una IA que responde preguntas sobre la persona de este portfolio: su experiencia, sus proyectos y lo que busca. ¿Qué te gustaría saber?'
15
+ : 'Hi! I’m luzIA, an AI agent that answers questions about the person behind this portfolio: their experience, their projects and what they’re looking for. What would you like to know?';
16
+ }
10
17
  /** How long the speech bubble stays after the mouse leaves it. */
11
18
  const SPEECH_AFTER_HOVER_MS = 2_000;
12
19
  /** luzIA's own icon, in the accent colours so it follows the Owner's theme. */
@@ -67,8 +74,9 @@ export class LuziaWidgetElement extends BaseElement {
67
74
  set contact(value) {
68
75
  this.setAttribute('contact', value);
69
76
  }
77
+ /** The Owner's greeting; without the attribute, luzIA introduces itself. An empty `greeting=""` turns it off. */
70
78
  get greeting() {
71
- return this.getAttribute('greeting') ?? '';
79
+ return this.getAttribute('greeting') ?? defaultGreeting();
72
80
  }
73
81
  set greeting(value) {
74
82
  this.setAttribute('greeting', value);
@@ -141,8 +149,17 @@ class View {
141
149
  #stage;
142
150
  #speech;
143
151
  #speechText;
144
- /** The reply luzIA is "saying" in the speech bubble (index in the conversation), kept out of the history until it ends. */
152
+ /**
153
+ * What luzIA is "saying" in the speech bubble, kept out of the history until
154
+ * it ends: a reply (its index in the conversation) or the greeting.
155
+ */
145
156
  #speaking = null;
157
+ #greetingText = '';
158
+ #host;
159
+ /** Stops following the visible area of the screen (see {@link View.#followViewport}). */
160
+ #unfollowViewport = null;
161
+ /** luzIA greets once per conversation: when the chat first shows, and again after "New conversation". */
162
+ #greeted = false;
146
163
  #speechTimer;
147
164
  /** While the mouse is over the bubble, it stays (the Visitor may be reading or scrolling it). */
148
165
  #speechHovered = false;
@@ -161,6 +178,7 @@ class View {
161
178
  #wasStreaming = false;
162
179
  constructor(root, conversation, contact) {
163
180
  this.#conversation = conversation;
181
+ this.#host = root.host;
164
182
  this.#contact = contact;
165
183
  this.#bubble = root.querySelector('.bubble');
166
184
  this.#panel = root.querySelector('.panel');
@@ -199,6 +217,8 @@ class View {
199
217
  });
200
218
  root.querySelector('.new-conversation').addEventListener('click', () => {
201
219
  conversation.reset();
220
+ this.#greeted = false;
221
+ this.#greet();
202
222
  this.#input.focus();
203
223
  });
204
224
  this.#form.addEventListener('submit', (event) => {
@@ -217,9 +237,8 @@ class View {
217
237
  /** Applies the Owner's options; called on mount and whenever one changes. */
218
238
  configure(options) {
219
239
  this.#showAvatar(options.avatar.trim());
220
- const greeting = options.greeting.trim();
221
- this.#greeting.textContent = greeting;
222
- this.#greeting.hidden = !greeting;
240
+ this.#greetingText = options.greeting.trim();
241
+ this.#greeting.textContent = this.#greetingText;
223
242
  this.#suggestions.replaceChildren(...options.suggestedQuestions.map((question) => {
224
243
  const button = document.createElement('button');
225
244
  button.type = 'button';
@@ -258,6 +277,56 @@ class View {
258
277
  #setOpen(open) {
259
278
  this.#panel.hidden = !open;
260
279
  this.#bubble.setAttribute('aria-expanded', String(open));
280
+ if (open)
281
+ this.#greet();
282
+ this.#unfollowViewport?.();
283
+ this.#unfollowViewport = open ? this.#followViewport() : null;
284
+ }
285
+ /**
286
+ * On a phone the chat fills the screen, but an on-screen keyboard covers its
287
+ * lower part and the browser scrolls the page under it, pushing luzIA's
288
+ * picture and speech bubble out of view. While the chat is open it follows
289
+ * the part of the screen that is actually visible (`visualViewport`), and
290
+ * marks the host with `data-keyboard` so the picture gets smaller.
291
+ */
292
+ #followViewport() {
293
+ const viewport = window.visualViewport;
294
+ if (!viewport)
295
+ return null;
296
+ const fit = () => {
297
+ const phone = this.#mode === 'bubble' && window.matchMedia('(max-width: 480px)').matches;
298
+ if (!phone)
299
+ return this.#clearViewport();
300
+ this.#host.style.setProperty('--luzia-viewport-height', `${viewport.height}px`);
301
+ this.#host.style.setProperty('--luzia-viewport-top', `${viewport.offsetTop}px`);
302
+ // A keyboard takes a good part of the screen; browser bars alone don't.
303
+ this.#host.toggleAttribute('data-keyboard', viewport.height < window.innerHeight * 0.75);
304
+ };
305
+ fit();
306
+ viewport.addEventListener('resize', fit);
307
+ viewport.addEventListener('scroll', fit);
308
+ return () => {
309
+ viewport.removeEventListener('resize', fit);
310
+ viewport.removeEventListener('scroll', fit);
311
+ this.#clearViewport();
312
+ };
313
+ }
314
+ #clearViewport() {
315
+ this.#host.style.removeProperty('--luzia-viewport-height');
316
+ this.#host.style.removeProperty('--luzia-viewport-top');
317
+ this.#host.removeAttribute('data-keyboard');
318
+ }
319
+ /** luzIA says the greeting in the bubble when a conversation starts empty (never over a restored one). */
320
+ #greet() {
321
+ if (this.#greeted || this.#panel.hidden)
322
+ return;
323
+ this.#greeted = true;
324
+ if (!this.#greetingText || this.#conversation.state.messages.length > 0)
325
+ return;
326
+ this.#stopSpeaking();
327
+ this.#speaking = 'greeting';
328
+ this.#showSpeech(this.#greetingText);
329
+ this.#render(this.#conversation.state);
261
330
  }
262
331
  /** The Owner's image at the top of the chat, or luzIA's icon. Decorative: the title already says "luzIA". */
263
332
  #showAvatar(url) {
@@ -317,19 +386,22 @@ class View {
317
386
  this.#showSpeech(state.messages[last].content);
318
387
  }
319
388
  else if (this.#speaking !== null) {
320
- const stillThisReply = this.#speaking === last && state.status === 'idle';
321
- if (!stillThisReply)
389
+ const greeting = this.#speaking === 'greeting';
390
+ // The greeting stays until the Visitor says something; a reply until another one starts.
391
+ const stillSaying = greeting ? state.messages.length === 0 : this.#speaking === last && state.status === 'idle';
392
+ if (!stillSaying)
322
393
  this.#stopSpeaking();
323
394
  else if (this.#speechTimer === undefined && !this.#speechHovered) {
324
- const text = state.messages[last].content;
395
+ const text = greeting ? this.#greetingText : state.messages[last].content;
325
396
  const delay = this.#speechVisited ? SPEECH_AFTER_HOVER_MS : Math.min(10_000, 4_000 + text.length * 40);
326
397
  this.#speechTimer = setTimeout(() => this.#fadeSpeech(), delay);
327
398
  }
328
399
  }
329
- // The reply being said stays out of the history until the bubble is gone.
400
+ // What is being said stays out of the history until the bubble is gone.
330
401
  [...this.#messages.children].forEach((item, index) => {
331
402
  item.hidden = index === this.#speaking;
332
403
  });
404
+ this.#greeting.hidden = !this.#greetingText || this.#speaking === 'greeting';
333
405
  }
334
406
  #showSpeech(text) {
335
407
  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,IAAI,EAAE,CAAC;IAC7C,CAAC;IAED,IAAI,QAAQ,CAAC,KAAa;QACxB,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,YAAY,CA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,MAAM,CAAC,eAAe,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;QACxD,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,CAAC,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 S="conversation_limit_reached",E="message_too_long";function m(i){return i.code===S?"limit":i.code===E?"too-long":"unavailable"}var k={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(k[e]);let s=t.trim();e==="too-long"||!s||i.append(" You can get in touch directly: ",T(s),".")}function T(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*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 l("network_error",f(n))}if(!s.ok)throw await M(s);if(!s.body)throw new l("network_error","The reply had no body.",s.status);let r=s.body.pipeThrough(new TextDecoderStream).getReader();try{for(;;){let{done:n,value:o}=await r.read();if(n)return;o&&(yield o)}}catch(n){if(t?.aborted)return;throw new l("network_error",f(n),s.status)}finally{r.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 f(i){return i instanceof Error?i.message:String(i)}var d=class{#e;#n=new Set;#h;#t=null;constructor(e){this.#h=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.#m([...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#m(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.#h.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 l?r:new l("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 x(i){let e=i;try{e=new URL(i,document.baseURI).href}catch{}return`luzia:conversation:${e}`}function z(i,e){let t=O();if(!t)return()=>{};let s=A(t,e);s&&i.state.messages.length===0&&i.reset(s);let r=w(y(i.state));return i.subscribe(n=>{let o=y(n),u=w(o);if(u!==r){r=u;try{o.length===0?t.removeItem(e):t.setItem(e,u)}catch{}}})}function y(i){return i.status==="streaming"?i.messages.slice(0,-1):i.messages}function w(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 I(s)?s.messages.map(({role:r,content:n})=>({role:r,content:n})):null}catch{return null}}function I(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 O(){try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}}var L=`
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 g="luzia-widget",q=typeof HTMLElement>"u"?class{}:HTMLElement;function R(){return(document.documentElement.lang||navigator.language||"en").toLowerCase().startsWith("es")?"\xA1Hola! Soy luzIA, una IA que responde preguntas sobre 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 the person behind this portfolio: their experience, their projects and what they\u2019re looking for. What would you like to know?"}var _=2e3,W=`<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>`,N=`
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")??R()}set greeting(e){this.setAttribute("greeting",e)}get suggestedQuestions(){return V(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>${N}`,z(this.conversation,x(this.endpoint)),this.#e=new c(e,this.conversation,()=>this.contact),this.#e.configure(this)}attributeChangedCallback(){this.#e?.configure(this)}};function V(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 c=class{#e;#n;#h;#t;#m;#i;#f;#r;#p;#a=null;#c="";#u;#E=null;#z=!1;#o;#b=!1;#L=!1;#d;#C;#v;#k;#y;#s;#T;#l;#M;#w="bubble";#A=!1;constructor(e,t,s){this.#l=t,this.#u=e.host,this.#M=s,this.#e=e.querySelector(".bubble"),this.#n=e.querySelector(".panel"),this.#h=e.querySelector(".close"),this.#t=e.querySelector(".body"),this.#m=e.querySelector(".greeting"),this.#i=e.querySelector(".avatar"),this.#f=e.querySelector(".stage"),this.#r=e.querySelector(".speech"),this.#p=e.querySelector(".speech-text"),this.#r.addEventListener("mouseenter",()=>{this.#b=!0,this.#L=!0,clearTimeout(this.#o),this.#o=void 0,this.#r.classList.remove("leaving")}),this.#r.addEventListener("mouseleave",()=>{this.#b=!1,this.#g(this.#l.state)}),this.#d=e.querySelector(".messages"),this.#C=e.querySelector(".announcer"),this.#v=e.querySelector(".suggestions"),this.#k=e.querySelector(".alert"),this.#y=e.querySelector(".composer"),this.#s=this.#y.querySelector("textarea"),this.#T=this.#y.querySelector("button"),this.#e.addEventListener("click",()=>this.#S(this.#e.getAttribute("aria-expanded")!=="true")),this.#h.addEventListener("click",()=>this.#S(!1)),this.#n.addEventListener("keydown",r=>{r.key==="Escape"&&this.#w==="bubble"&&!r.isComposing&&(r.preventDefault(),this.#S(!1))}),e.querySelector(".new-conversation").addEventListener("click",()=>{t.reset(),this.#z=!1,this.#O(),this.#s.focus()}),this.#y.addEventListener("submit",r=>{r.preventDefault(),this.#q()}),this.#s.addEventListener("keydown",r=>{r.key==="Enter"&&!r.shiftKey&&!r.isComposing&&(r.preventDefault(),this.#q())}),t.subscribe(r=>this.#g(r)),this.#g(t.state)}configure(e){this.#N(e.avatar.trim()),this.#c=e.greeting.trim(),this.#m.textContent=this.#c,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.#l.send(t)&&this.#s.focus()});let r=document.createElement("li");return r.append(s),r})),this.#g(this.#l.state),e.mode!==this.#w&&this.#_(e.mode)}#_(e){this.#w=e;let t=e==="inline";this.#n.setAttribute("role",t?"region":"dialog"),this.#e.hidden=t,this.#h.hidden=t,this.#I(t)}#S(e){this.#I(e),(e?this.#s:this.#e).focus()}#I(e){this.#n.hidden=!e,this.#e.setAttribute("aria-expanded",String(e)),e&&this.#O(),this.#E?.(),this.#E=e?this.#W():null}#W(){let e=window.visualViewport;if(!e)return null;let t=()=>{if(!(this.#w==="bubble"&&window.matchMedia("(max-width: 480px)").matches))return this.#H();this.#u.style.setProperty("--luzia-viewport-height",`${e.height}px`),this.#u.style.setProperty("--luzia-viewport-top",`${e.offsetTop}px`),this.#u.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.#H()}}#H(){this.#u.style.removeProperty("--luzia-viewport-height"),this.#u.style.removeProperty("--luzia-viewport-top"),this.#u.removeAttribute("data-keyboard")}#O(){this.#z||this.#n.hidden||(this.#z=!0,!(!this.#c||this.#l.state.messages.length>0)&&(this.#x(),this.#a="greeting",this.#R(this.#c),this.#g(this.#l.state)))}#N(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=W}#q(){let e=this.#s.value;this.#l.send(e)&&(this.#s.value="",this.#s.focus())}#V(e,t){let s=this.#A&&!t;if(this.#A=t,(t||e.messages.length===0)&&(this.#C.textContent=""),!s)return;let r=e.messages.at(-1);this.#C.textContent=e.status==="idle"&&r?.role==="assistant"?r.content:""}#F(e,t){let s=e.messages.length-1,r=e.messages[s]?.role==="assistant";if(t&&r)this.#a!==s&&this.#x(),this.#a=s,clearTimeout(this.#o),this.#R(e.messages[s].content);else if(this.#a!==null){let n=this.#a==="greeting";if(!(n?e.messages.length===0:this.#a===s&&e.status==="idle"))this.#x();else if(this.#o===void 0&&!this.#b){let u=n?this.#c:e.messages[s].content,a=this.#L?_:Math.min(1e4,4e3+u.length*40);this.#o=setTimeout(()=>this.#P(),a)}}[...this.#d.children].forEach((n,o)=>{n.hidden=o===this.#a}),this.#m.hidden=!this.#c||this.#a==="greeting"}#R(e){this.#r.classList.remove("leaving"),this.#r.hidden=e==="",this.#f.toggleAttribute("data-saying",!this.#r.hidden),this.#p.textContent!==e&&(this.#p.textContent=e)}#P(){this.#r.classList.add("leaving"),this.#o=setTimeout(()=>{this.#x(),this.#g(this.#l.state)},400)}#x(){clearTimeout(this.#o),this.#o=void 0,this.#a=null,this.#r.hidden=!0,this.#b=!1,this.#L=!1,this.#f.removeAttribute("data-saying"),this.#p.scrollTop=0,this.#r.classList.remove("leaving"),this.#p.textContent=""}#g(e){for(e.messages.forEach((n,o)=>{let u=this.#d.children[o],a=u;(!a||a.dataset.role!==n.role)&&(a=document.createElement("li"),a.className="message",a.dataset.role=n.role,u?u.replaceWith(a):this.#d.append(a)),a.textContent!==n.content&&(a.textContent=n.content)});this.#d.children.length>e.messages.length;)this.#d.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.#d.setAttribute("aria-busy",String(t)),this.#V(e,t);let s=e.status==="error"&&e.error?m(e.error):null;p(this.#k,s,this.#M());let r=s==="limit";this.#s.disabled=r,this.#T.disabled=t||r,e.unsent!==null&&!r&&!this.#s.value&&(this.#s.value=e.unsent)}};function C(){customElements.get(g)||customElements.define(g,h)}C();export{d as Conversation,g as LUZIA_WIDGET_TAG,l as LuziaRequestError,h as LuziaWidgetElement,C 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.1",
4
4
  "description": "Embeddable luzIA chat widget (framework-free Web Component)",
5
5
  "license": "MIT",
6
6
  "author": "Sergio Deri <sergio.deri@astrocode.uy>",