luzia-widget 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/styles.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * override on the element (`luzia-widget { --luzia-accent: #e11d48; }`); an
4
4
  * Owner's value wins over both the light and the dark palette.
5
5
  *
6
- * - `--luzia-accent` / `--luzia-accent-contrast`: bubble, header, Visitor messages, buttons, and text on them
6
+ * - `--luzia-accent` / `--luzia-accent-contrast`: bubble, the light behind luzIA, Visitor messages, buttons, and text on them
7
7
  * - `--luzia-surface` / `--luzia-text`: chat background and text
8
8
  * - `--luzia-muted`: Agent messages, greeting and suggested questions
9
9
  * - `--luzia-border`: input and inline-panel borders
@@ -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 /* 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";
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 --luzia-ease-out: cubic-bezier(0.23, 1, 0.32, 1);\n /* How strongly the accent lights the top of the chat, behind luzIA. */\n --luzia-glow-strength: 22%;\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-glow-strength: 30%;\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-glow-strength: 30%;\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 message box shows focus on its whole field (see .composer:focus-within). */\n .composer textarea:focus-visible { outline: none; }\n ::selection { background: color-mix(in srgb, var(--luzia-accent) 28%, transparent); }\n .message[data-role='user']::selection { background: color-mix(in srgb, var(--luzia-accent-contrast) 35%, transparent); }\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 /*\n * The launcher: a pill with luzIA's icon and an invitation to ask. With the\n * chat open it folds into just the icon: the text fades and blurs out first,\n * then the pill narrows (unfolding, the pill widens first, then the text comes in).\n */\n .bubble {\n display: flex;\n align-items: center;\n height: 3.25rem;\n margin-left: auto;\n padding: 0 0.45rem;\n border: none;\n border-radius: 999px;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n font: 600 0.95rem var(--luzia-font);\n box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);\n cursor: pointer;\n transition: transform 160ms ease-out, box-shadow 160ms ease-out;\n }\n @media (hover: hover) and (pointer: fine) {\n .bubble:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); }\n }\n .bubble:active { transform: scale(0.97); }\n .bubble-icon { display: block; width: 2.35rem; height: 2.35rem; flex: none; }\n .bubble-icon svg { display: block; }\n /* The star turns a little as the pill folds and unfolds. */\n .bubble-icon path {\n transform-box: fill-box;\n transform-origin: center;\n transition: transform 400ms var(--luzia-ease-out);\n }\n .bubble[aria-expanded='true'] .bubble-icon path { transform: rotate(90deg); }\n .bubble-label {\n display: block;\n overflow: hidden;\n max-width: 14rem;\n transition: max-width 320ms var(--luzia-ease-out);\n }\n .bubble-text {\n display: block;\n padding: 0 0.95rem 0 0.6rem;\n white-space: nowrap;\n transition: opacity 200ms ease 90ms, filter 200ms ease 90ms, transform 200ms ease-out 90ms;\n }\n .bubble[aria-expanded='true'] .bubble-label {\n max-width: 0;\n transition-delay: 60ms;\n }\n .bubble[aria-expanded='true'] .bubble-text {\n opacity: 0;\n filter: blur(3px);\n transform: translateX(-0.4rem);\n transition-duration: 140ms;\n transition-delay: 0ms;\n }\n /* Less motion: the text still fades, but nothing moves or turns. */\n @media (prefers-reduced-motion: reduce) {\n .bubble, .bubble-label, .bubble-icon path { transition: none; }\n .bubble:hover, .bubble:active, .bubble-text, .bubble[aria-expanded='true'] .bubble-text { transform: none; }\n .bubble-text, .bubble[aria-expanded='true'] .bubble-text { filter: none; transition: opacity 150ms ease; }\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 /* luzIA stands in a soft light of the accent colour; it fades out before the conversation. */\n background-color: var(--luzia-surface);\n background-image: radial-gradient(19rem 12rem at 6.5rem 8rem, color-mix(in srgb, var(--luzia-accent) var(--luzia-glow-strength), transparent), transparent 70%);\n background-repeat: no-repeat;\n border: 1px solid color-mix(in srgb, var(--luzia-border) 70%, transparent);\n border-radius: 1.25rem;\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 24px 48px -12px rgb(0 0 0 / 0.3);\n overflow: hidden;\n }\n /* Opening grows the chat out of the launcher below it; closing is instant. */\n :host(:not([mode='inline'])) .panel {\n transform-origin: bottom right;\n transition: opacity 200ms ease-out, transform 240ms var(--luzia-ease-out);\n @starting-style {\n opacity: 0;\n transform: translateY(8px) scale(0.97);\n }\n }\n @media (prefers-reduced-motion: reduce) {\n :host(:not([mode='inline'])) .panel {\n transition: opacity 150ms ease;\n @starting-style { transform: none; }\n }\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 box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);\n }\n /* Quiet: luzIA's mark and name, then two icon buttons. The light below carries the colour. */\n .header {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.375rem 0.375rem 0 0.875rem;\n color: var(--luzia-text);\n }\n .header-icon { display: block; width: 1.5rem; height: 1.5rem; flex: none; }\n .header-icon svg { display: block; }\n .header-icon circle { fill: var(--luzia-accent); }\n .header-icon path { fill: var(--luzia-accent-contrast); }\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.25rem 1rem 0;\n border-bottom: 1px solid color-mix(in srgb, var(--luzia-border) 75%, transparent);\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's own icon: the star on a disc lit by the accent, not a flat white circle. */\n .avatar svg circle { fill: color-mix(in srgb, var(--luzia-accent) 12%, var(--luzia-surface)); }\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.6rem 0.8rem;\n border: 1px solid var(--luzia-border);\n border-radius: 1rem;\n background: var(--luzia-surface);\n color: var(--luzia-text);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 10px 24px -10px rgb(0 0 0 / 0.25);\n font-size: 0.875rem;\n line-height: 1.45;\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 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: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }\n .new-conversation,\n .close {\n color: color-mix(in srgb, var(--luzia-text) 65%, transparent);\n }\n /* Restart: a circular arrow, named by a tooltip on hover or keyboard focus. */\n .new-conversation {\n position: relative;\n display: grid;\n place-items: center;\n margin-inline: auto 0.25rem;\n padding: 0;\n border: none;\n border-radius: 0.75rem;\n background: transparent;\n cursor: pointer;\n transition: background-color 150ms ease, color 150ms ease, transform 160ms ease-out;\n }\n .new-conversation svg { display: block; transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1); }\n .new-conversation:active { transform: scale(0.94); }\n .tooltip {\n position: absolute;\n top: calc(100% + 0.4rem);\n right: 0;\n z-index: 1;\n padding: 0.35rem 0.6rem;\n border-radius: 0.375rem;\n background: var(--luzia-text);\n color: var(--luzia-surface);\n font: 500 0.75rem var(--luzia-font);\n white-space: nowrap;\n box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);\n pointer-events: none;\n opacity: 0;\n transform: translateY(-2px) scale(0.97);\n transform-origin: top right;\n /* Leaving: quick, with no wait. */\n transition: opacity 100ms ease-out, transform 100ms ease-out;\n }\n /* Appearing: after a short pause, so passing over the button does not flash it. */\n .new-conversation:focus-visible .tooltip {\n opacity: 1;\n transform: none;\n transition: opacity 125ms ease-out, transform 125ms ease-out;\n }\n @media (hover: hover) and (pointer: fine) {\n .new-conversation:hover,\n .close:hover { background-color: color-mix(in srgb, var(--luzia-text) 8%, transparent); color: var(--luzia-text); }\n /* The arrow winds back a little, hinting at what it does. */\n .new-conversation:hover svg { transform: rotate(-45deg); }\n .new-conversation:hover .tooltip {\n opacity: 1;\n transform: none;\n transition: opacity 125ms ease-out 350ms, transform 125ms ease-out 350ms;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .tooltip, .new-conversation:active, .new-conversation svg { transform: none !important; }\n }\n .close {\n display: grid;\n place-items: center;\n padding: 0;\n border: none;\n border-radius: 0.75rem;\n background: transparent;\n cursor: pointer;\n transition: background-color 150ms ease, color 150ms ease, transform 160ms ease-out;\n }\n .close svg { display: block; }\n .close:active { transform: scale(0.94); }\n @media (prefers-reduced-motion: reduce) {\n .close:active { transform: none; }\n }\n .body {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n padding: 1rem 1rem 0.75rem;\n overflow-y: auto;\n }\n .body,\n .speech-text {\n scrollbar-width: thin;\n scrollbar-color: color-mix(in srgb, var(--luzia-text) 22%, transparent) transparent;\n }\n /* Messages: soft, with the corner nearest the speaker drawn in, like a tail. */\n .greeting,\n .message {\n max-width: 85%;\n margin: 0;\n padding: 0.55rem 0.875rem;\n border-radius: 1.125rem;\n font-size: 0.9375rem;\n line-height: 1.45;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n .greeting,\n .message[data-role='assistant'] {\n align-self: flex-start;\n border-bottom-left-radius: 0.375rem;\n background: var(--luzia-muted);\n transform-origin: bottom left;\n }\n /* Links in luzIA's replies: underlined in the text's own colour, so they read as links on any theme. */\n .message a,\n .speech-text a {\n color: inherit;\n text-decoration: underline;\n text-decoration-thickness: 1px;\n text-underline-offset: 0.15em;\n border-radius: 0.125rem;\n }\n .message a:hover,\n .speech-text a:hover { text-decoration-thickness: 2px; }\n .message a:focus-visible {\n outline: 2px solid var(--luzia-accent);\n outline-offset: 1px;\n }\n .messages {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n }\n .message[data-role='user'] {\n align-self: flex-end;\n border-bottom-right-radius: 0.375rem;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--luzia-accent) 80%, transparent);\n transform-origin: bottom right;\n }\n /* A little more room where the speaker changes. */\n .message[data-role='assistant'] + .message[data-role='user'],\n .message[data-role='user'] + .message[data-role='assistant'] { margin-top: 0.375rem; }\n .greeting:not([hidden]) + .messages:not(:empty) { margin-top: 0.375rem; }\n /* Each new message rises into place once. */\n .message { animation: luzia-rise 260ms var(--luzia-ease-out); }\n @keyframes luzia-rise {\n from { opacity: 0; transform: translateY(6px) scale(0.98); }\n }\n @keyframes luzia-fade {\n from { opacity: 0; }\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 /* Questions the Visitor could ask, tinted with the accent; they arrive one after another. */\n .suggestions li { animation: luzia-rise 320ms var(--luzia-ease-out) both; transform-origin: bottom right; }\n .suggestions li:nth-child(2) { animation-delay: 50ms; }\n .suggestions li:nth-child(3) { animation-delay: 100ms; }\n .suggestions li:nth-child(n + 4) { animation-delay: 150ms; }\n .suggestion {\n padding: 0.5rem 0.9rem;\n border: 1px solid color-mix(in srgb, var(--luzia-accent) 24%, transparent);\n border-radius: 999px;\n background: color-mix(in srgb, var(--luzia-accent) 7%, var(--luzia-surface));\n color: color-mix(in srgb, var(--luzia-accent) 60%, var(--luzia-text));\n font: 500 0.875rem/1.3 var(--luzia-font);\n text-align: left;\n cursor: pointer;\n transition: background-color 150ms ease, border-color 150ms ease, transform 160ms ease-out;\n }\n @media (hover: hover) and (pointer: fine) {\n .suggestion:hover {\n border-color: color-mix(in srgb, var(--luzia-accent) 45%, transparent);\n background: color-mix(in srgb, var(--luzia-accent) 13%, var(--luzia-surface));\n }\n }\n .suggestion:active { transform: scale(0.97); }\n @media (prefers-reduced-motion: reduce) {\n .message, .suggestions li { animation-name: luzia-fade; }\n .suggestion:active { transform: none; }\n }\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 /* One rounded field: the message box with a round Send button inside it. */\n .composer {\n display: flex;\n align-items: flex-end;\n gap: 0.375rem;\n margin: 0 0.75rem 0.75rem;\n padding: 0.25rem 0.25rem 0.25rem 1rem;\n border: 1px solid var(--luzia-border);\n border-radius: 1.5rem;\n background: var(--luzia-surface);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);\n transition: border-color 150ms ease, box-shadow 150ms ease;\n }\n .composer:focus-within {\n border-color: color-mix(in srgb, var(--luzia-accent) 60%, var(--luzia-border));\n box-shadow: 0 0 0 4px color-mix(in srgb, var(--luzia-accent) 16%, transparent);\n }\n .composer textarea {\n flex: 1;\n box-sizing: border-box;\n min-height: 2.75rem;\n max-height: 8rem;\n resize: none;\n padding: 0.7rem 0;\n border: none;\n background: transparent;\n color: var(--luzia-text);\n caret-color: var(--luzia-accent);\n font: inherit;\n font-size: 0.9375rem;\n line-height: 1.4;\n /* Grows with what is typed, where supported. */\n field-sizing: content;\n }\n .composer textarea::placeholder { color: color-mix(in srgb, var(--luzia-text) 55%, transparent); }\n .composer textarea:disabled { cursor: not-allowed; }\n .send {\n display: grid;\n place-items: center;\n flex: none;\n width: 44px;\n height: 44px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n cursor: pointer;\n transition: background-color 150ms ease, opacity 150ms ease, transform 160ms ease-out;\n }\n .send svg { display: block; }\n @media (hover: hover) and (pointer: fine) {\n .send:not(:disabled):hover { background: color-mix(in srgb, var(--luzia-accent) 86%, #000); }\n }\n .send:not(:disabled):active { transform: scale(0.94); }\n .send:disabled { opacity: 0.35; cursor: default; }\n @media (prefers-reduced-motion: reduce) {\n .send:not(:disabled):active { transform: none; }\n }\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: none;\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 { margin-bottom: max(0.75rem, env(safe-area-inset-bottom)); }\n :host(:not([mode='inline'])) .panel { transform-origin: bottom center; }\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
@@ -3,7 +3,7 @@
3
3
  * override on the element (`luzia-widget { --luzia-accent: #e11d48; }`); an
4
4
  * Owner's value wins over both the light and the dark palette.
5
5
  *
6
- * - `--luzia-accent` / `--luzia-accent-contrast`: bubble, header, Visitor messages, buttons, and text on them
6
+ * - `--luzia-accent` / `--luzia-accent-contrast`: bubble, the light behind luzIA, Visitor messages, buttons, and text on them
7
7
  * - `--luzia-surface` / `--luzia-text`: chat background and text
8
8
  * - `--luzia-muted`: Agent messages, greeting and suggested questions
9
9
  * - `--luzia-border`: input and inline-panel borders
@@ -26,6 +26,9 @@ export const styles = `
26
26
  --luzia-font: system-ui, -apple-system, 'Segoe UI', sans-serif;
27
27
  --luzia-border: #d4d4d8;
28
28
  --luzia-inline-height: 38rem;
29
+ --luzia-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
30
+ /* How strongly the accent lights the top of the chat, behind luzIA. */
31
+ --luzia-glow-strength: 22%;
29
32
  position: fixed;
30
33
  right: 1.25rem;
31
34
  bottom: 1.25rem;
@@ -34,6 +37,7 @@ export const styles = `
34
37
  color: var(--luzia-text);
35
38
  }
36
39
  :host([theme='dark']) {
40
+ --luzia-glow-strength: 30%;
37
41
  --luzia-surface: #18181b;
38
42
  --luzia-text: #f4f4f5;
39
43
  --luzia-muted: #27272a;
@@ -41,6 +45,7 @@ export const styles = `
41
45
  }
42
46
  @media (prefers-color-scheme: dark) {
43
47
  :host([theme='auto']) {
48
+ --luzia-glow-strength: 30%;
44
49
  --luzia-surface: #18181b;
45
50
  --luzia-text: #f4f4f5;
46
51
  --luzia-muted: #27272a;
@@ -54,8 +59,10 @@ export const styles = `
54
59
  outline: 2px solid var(--luzia-accent);
55
60
  outline-offset: 2px;
56
61
  }
57
- /* The header is accent-coloured, so its focus ring takes the text colour. */
58
- .header button:focus-visible { outline-color: currentColor; outline-offset: -4px; }
62
+ /* The message box shows focus on its whole field (see .composer:focus-within). */
63
+ .composer textarea:focus-visible { outline: none; }
64
+ ::selection { background: color-mix(in srgb, var(--luzia-accent) 28%, transparent); }
65
+ .message[data-role='user']::selection { background: color-mix(in srgb, var(--luzia-accent-contrast) 35%, transparent); }
59
66
  /* Read by screen readers only: each finished reply (see the element's View). */
60
67
  .announcer {
61
68
  position: absolute;
@@ -68,19 +75,67 @@ export const styles = `
68
75
  white-space: nowrap;
69
76
  border: 0;
70
77
  }
78
+ /*
79
+ * The launcher: a pill with luzIA's icon and an invitation to ask. With the
80
+ * chat open it folds into just the icon: the text fades and blurs out first,
81
+ * then the pill narrows (unfolding, the pill widens first, then the text comes in).
82
+ */
71
83
  .bubble {
72
- display: grid;
73
- place-items: center;
74
- width: 3.5rem;
75
- height: 3.5rem;
84
+ display: flex;
85
+ align-items: center;
86
+ height: 3.25rem;
76
87
  margin-left: auto;
88
+ padding: 0 0.45rem;
77
89
  border: none;
78
- border-radius: 50%;
90
+ border-radius: 999px;
79
91
  background: var(--luzia-accent);
80
92
  color: var(--luzia-accent-contrast);
81
- font: 600 0.8rem var(--luzia-font);
93
+ font: 600 0.95rem var(--luzia-font);
82
94
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);
83
95
  cursor: pointer;
96
+ transition: transform 160ms ease-out, box-shadow 160ms ease-out;
97
+ }
98
+ @media (hover: hover) and (pointer: fine) {
99
+ .bubble:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); }
100
+ }
101
+ .bubble:active { transform: scale(0.97); }
102
+ .bubble-icon { display: block; width: 2.35rem; height: 2.35rem; flex: none; }
103
+ .bubble-icon svg { display: block; }
104
+ /* The star turns a little as the pill folds and unfolds. */
105
+ .bubble-icon path {
106
+ transform-box: fill-box;
107
+ transform-origin: center;
108
+ transition: transform 400ms var(--luzia-ease-out);
109
+ }
110
+ .bubble[aria-expanded='true'] .bubble-icon path { transform: rotate(90deg); }
111
+ .bubble-label {
112
+ display: block;
113
+ overflow: hidden;
114
+ max-width: 14rem;
115
+ transition: max-width 320ms var(--luzia-ease-out);
116
+ }
117
+ .bubble-text {
118
+ display: block;
119
+ padding: 0 0.95rem 0 0.6rem;
120
+ white-space: nowrap;
121
+ transition: opacity 200ms ease 90ms, filter 200ms ease 90ms, transform 200ms ease-out 90ms;
122
+ }
123
+ .bubble[aria-expanded='true'] .bubble-label {
124
+ max-width: 0;
125
+ transition-delay: 60ms;
126
+ }
127
+ .bubble[aria-expanded='true'] .bubble-text {
128
+ opacity: 0;
129
+ filter: blur(3px);
130
+ transform: translateX(-0.4rem);
131
+ transition-duration: 140ms;
132
+ transition-delay: 0ms;
133
+ }
134
+ /* Less motion: the text still fades, but nothing moves or turns. */
135
+ @media (prefers-reduced-motion: reduce) {
136
+ .bubble, .bubble-label, .bubble-icon path { transition: none; }
137
+ .bubble:hover, .bubble:active, .bubble-text, .bubble[aria-expanded='true'] .bubble-text { transform: none; }
138
+ .bubble-text, .bubble[aria-expanded='true'] .bubble-text { filter: none; transition: opacity 150ms ease; }
84
139
  }
85
140
  .panel {
86
141
  display: flex;
@@ -88,11 +143,30 @@ export const styles = `
88
143
  width: min(24rem, calc(100vw - 2.5rem));
89
144
  height: min(40rem, calc(100vh - 7rem));
90
145
  margin-bottom: 0.75rem;
91
- background: var(--luzia-surface);
92
- border-radius: 1rem;
93
- box-shadow: 0 12px 40px rgb(0 0 0 / 0.2);
146
+ /* luzIA stands in a soft light of the accent colour; it fades out before the conversation. */
147
+ background-color: var(--luzia-surface);
148
+ background-image: radial-gradient(19rem 12rem at 6.5rem 8rem, color-mix(in srgb, var(--luzia-accent) var(--luzia-glow-strength), transparent), transparent 70%);
149
+ background-repeat: no-repeat;
150
+ border: 1px solid color-mix(in srgb, var(--luzia-border) 70%, transparent);
151
+ border-radius: 1.25rem;
152
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 24px 48px -12px rgb(0 0 0 / 0.3);
94
153
  overflow: hidden;
95
154
  }
155
+ /* Opening grows the chat out of the launcher below it; closing is instant. */
156
+ :host(:not([mode='inline'])) .panel {
157
+ transform-origin: bottom right;
158
+ transition: opacity 200ms ease-out, transform 240ms var(--luzia-ease-out);
159
+ @starting-style {
160
+ opacity: 0;
161
+ transform: translateY(8px) scale(0.97);
162
+ }
163
+ }
164
+ @media (prefers-reduced-motion: reduce) {
165
+ :host(:not([mode='inline'])) .panel {
166
+ transition: opacity 150ms ease;
167
+ @starting-style { transform: none; }
168
+ }
169
+ }
96
170
  :host([mode='inline']) {
97
171
  position: static;
98
172
  display: block;
@@ -103,25 +177,28 @@ export const styles = `
103
177
  width: 100%;
104
178
  height: var(--luzia-inline-height);
105
179
  margin: 0;
106
- border: 1px solid var(--luzia-border);
107
- box-shadow: none;
180
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
108
181
  }
182
+ /* Quiet: luzIA's mark and name, then two icon buttons. The light below carries the colour. */
109
183
  .header {
110
184
  display: flex;
111
185
  align-items: center;
112
- justify-content: space-between;
113
- padding: 0.25rem 0.5rem 0.25rem 1rem;
114
- background: var(--luzia-accent);
115
- color: var(--luzia-accent-contrast);
186
+ gap: 0.5rem;
187
+ padding: 0.375rem 0.375rem 0 0.875rem;
188
+ color: var(--luzia-text);
116
189
  }
190
+ .header-icon { display: block; width: 1.5rem; height: 1.5rem; flex: none; }
191
+ .header-icon svg { display: block; }
192
+ .header-icon circle { fill: var(--luzia-accent); }
193
+ .header-icon path { fill: var(--luzia-accent-contrast); }
117
194
  /* Like a video call: luzIA's whole picture large and centred at the top, the conversation below it. */
118
195
  .stage {
119
196
  flex: none;
120
197
  display: flex;
121
198
  justify-content: flex-start;
122
199
  gap: 0.75rem;
123
- padding: 0.75rem 1rem 0;
124
- border-bottom: 1px solid var(--luzia-border);
200
+ padding: 0.25rem 1rem 0;
201
+ border-bottom: 1px solid color-mix(in srgb, var(--luzia-border) 75%, transparent);
125
202
  }
126
203
  /* The picture is shown whole, in its own shape (a cut-out stands on the divider line). */
127
204
  .avatar {
@@ -138,6 +215,8 @@ export const styles = `
138
215
  transition: filter 0.2s ease;
139
216
  }
140
217
  .avatar svg { aspect-ratio: 1; margin-bottom: 0.75rem; height: calc(100% - 0.75rem); }
218
+ /* luzIA's own icon: the star on a disc lit by the accent, not a flat white circle. */
219
+ .avatar svg circle { fill: color-mix(in srgb, var(--luzia-accent) 12%, var(--luzia-surface)); }
141
220
  /* luzIA stays on the left; her speech bubble appears on the right without moving her. */
142
221
  .speech {
143
222
  position: relative;
@@ -145,14 +224,14 @@ export const styles = `
145
224
  align-self: flex-start;
146
225
  min-width: 0;
147
226
  margin: 0.75rem 0 0;
148
- padding: 0.55rem 0.75rem;
227
+ padding: 0.6rem 0.8rem;
149
228
  border: 1px solid var(--luzia-border);
150
- border-radius: 0.9rem;
229
+ border-radius: 1rem;
151
230
  background: var(--luzia-surface);
152
231
  color: var(--luzia-text);
153
- box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
232
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 10px 24px -10px rgb(0 0 0 / 0.25);
154
233
  font-size: 0.875rem;
155
- line-height: 1.4;
234
+ line-height: 1.45;
156
235
  opacity: 1;
157
236
  transition: opacity 0.4s ease;
158
237
  }
@@ -162,7 +241,6 @@ export const styles = `
162
241
  /* Long replies scroll inside the bubble, so their beginning can be read. */
163
242
  overflow-y: auto;
164
243
  overscroll-behavior: contain;
165
- scrollbar-width: thin;
166
244
  padding-inline-end: 0.25rem;
167
245
  white-space: pre-wrap;
168
246
  overflow-wrap: anywhere;
@@ -207,44 +285,126 @@ export const styles = `
207
285
  .stage[data-speaking] .avatar img,
208
286
  .stage[data-speaking] .avatar svg { animation: none; }
209
287
  }
210
- .title { margin: 0; font-size: 1rem; }
288
+ .title { margin: 0; font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }
289
+ .new-conversation,
290
+ .close {
291
+ color: color-mix(in srgb, var(--luzia-text) 65%, transparent);
292
+ }
293
+ /* Restart: a circular arrow, named by a tooltip on hover or keyboard focus. */
211
294
  .new-conversation {
212
- margin-inline: auto 0.5rem;
213
- padding: 0.25rem 0.5rem;
214
- border: 1px solid currentColor;
215
- border-radius: 0.375rem;
295
+ position: relative;
296
+ display: grid;
297
+ place-items: center;
298
+ margin-inline: auto 0.25rem;
299
+ padding: 0;
300
+ border: none;
301
+ border-radius: 0.75rem;
216
302
  background: transparent;
217
- color: inherit;
218
- font: inherit;
219
- font-size: 0.8rem;
220
303
  cursor: pointer;
304
+ transition: background-color 150ms ease, color 150ms ease, transform 160ms ease-out;
305
+ }
306
+ .new-conversation svg { display: block; transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1); }
307
+ .new-conversation:active { transform: scale(0.94); }
308
+ .tooltip {
309
+ position: absolute;
310
+ top: calc(100% + 0.4rem);
311
+ right: 0;
312
+ z-index: 1;
313
+ padding: 0.35rem 0.6rem;
314
+ border-radius: 0.375rem;
315
+ background: var(--luzia-text);
316
+ color: var(--luzia-surface);
317
+ font: 500 0.75rem var(--luzia-font);
318
+ white-space: nowrap;
319
+ box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
320
+ pointer-events: none;
321
+ opacity: 0;
322
+ transform: translateY(-2px) scale(0.97);
323
+ transform-origin: top right;
324
+ /* Leaving: quick, with no wait. */
325
+ transition: opacity 100ms ease-out, transform 100ms ease-out;
326
+ }
327
+ /* Appearing: after a short pause, so passing over the button does not flash it. */
328
+ .new-conversation:focus-visible .tooltip {
329
+ opacity: 1;
330
+ transform: none;
331
+ transition: opacity 125ms ease-out, transform 125ms ease-out;
332
+ }
333
+ @media (hover: hover) and (pointer: fine) {
334
+ .new-conversation:hover,
335
+ .close:hover { background-color: color-mix(in srgb, var(--luzia-text) 8%, transparent); color: var(--luzia-text); }
336
+ /* The arrow winds back a little, hinting at what it does. */
337
+ .new-conversation:hover svg { transform: rotate(-45deg); }
338
+ .new-conversation:hover .tooltip {
339
+ opacity: 1;
340
+ transform: none;
341
+ transition: opacity 125ms ease-out 350ms, transform 125ms ease-out 350ms;
342
+ }
343
+ }
344
+ @media (prefers-reduced-motion: reduce) {
345
+ .tooltip, .new-conversation:active, .new-conversation svg { transform: none !important; }
221
346
  }
222
347
  .close {
348
+ display: grid;
349
+ place-items: center;
350
+ padding: 0;
223
351
  border: none;
352
+ border-radius: 0.75rem;
224
353
  background: transparent;
225
- color: inherit;
226
- font-size: 1.4rem;
227
- line-height: 1;
228
354
  cursor: pointer;
355
+ transition: background-color 150ms ease, color 150ms ease, transform 160ms ease-out;
356
+ }
357
+ .close svg { display: block; }
358
+ .close:active { transform: scale(0.94); }
359
+ @media (prefers-reduced-motion: reduce) {
360
+ .close:active { transform: none; }
229
361
  }
230
362
  .body {
231
363
  flex: 1;
232
364
  display: flex;
233
365
  flex-direction: column;
234
- gap: 0.5rem;
235
- padding: 1rem;
366
+ gap: 0.375rem;
367
+ padding: 1rem 1rem 0.75rem;
236
368
  overflow-y: auto;
237
369
  }
238
- .greeting {
239
- align-self: flex-start;
370
+ .body,
371
+ .speech-text {
372
+ scrollbar-width: thin;
373
+ scrollbar-color: color-mix(in srgb, var(--luzia-text) 22%, transparent) transparent;
374
+ }
375
+ /* Messages: soft, with the corner nearest the speaker drawn in, like a tail. */
376
+ .greeting,
377
+ .message {
240
378
  max-width: 85%;
241
379
  margin: 0;
242
- padding: 0.5rem 0.75rem;
243
- border-radius: 0.75rem;
244
- background: var(--luzia-muted);
380
+ padding: 0.55rem 0.875rem;
381
+ border-radius: 1.125rem;
382
+ font-size: 0.9375rem;
383
+ line-height: 1.45;
245
384
  white-space: pre-wrap;
246
385
  overflow-wrap: anywhere;
247
- line-height: 1.4;
386
+ }
387
+ .greeting,
388
+ .message[data-role='assistant'] {
389
+ align-self: flex-start;
390
+ border-bottom-left-radius: 0.375rem;
391
+ background: var(--luzia-muted);
392
+ transform-origin: bottom left;
393
+ }
394
+ /* Links in luzIA's replies: underlined in the text's own colour, so they read as links on any theme. */
395
+ .message a,
396
+ .speech-text a {
397
+ color: inherit;
398
+ text-decoration: underline;
399
+ text-decoration-thickness: 1px;
400
+ text-underline-offset: 0.15em;
401
+ border-radius: 0.125rem;
402
+ }
403
+ .message a:hover,
404
+ .speech-text a:hover { text-decoration-thickness: 2px; }
405
+ .message a:focus-visible {
406
+ outline: 2px solid var(--luzia-accent);
407
+ outline-offset: 1px;
248
408
  }
249
409
  .messages {
250
410
  margin: 0;
@@ -252,24 +412,27 @@ export const styles = `
252
412
  list-style: none;
253
413
  display: flex;
254
414
  flex-direction: column;
255
- gap: 0.5rem;
256
- }
257
- .message {
258
- max-width: 85%;
259
- padding: 0.5rem 0.75rem;
260
- border-radius: 0.75rem;
261
- white-space: pre-wrap;
262
- overflow-wrap: anywhere;
263
- line-height: 1.4;
415
+ gap: 0.375rem;
264
416
  }
265
417
  .message[data-role='user'] {
266
418
  align-self: flex-end;
419
+ border-bottom-right-radius: 0.375rem;
267
420
  background: var(--luzia-accent);
268
421
  color: var(--luzia-accent-contrast);
422
+ box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--luzia-accent) 80%, transparent);
423
+ transform-origin: bottom right;
269
424
  }
270
- .message[data-role='assistant'] {
271
- align-self: flex-start;
272
- background: var(--luzia-muted);
425
+ /* A little more room where the speaker changes. */
426
+ .message[data-role='assistant'] + .message[data-role='user'],
427
+ .message[data-role='user'] + .message[data-role='assistant'] { margin-top: 0.375rem; }
428
+ .greeting:not([hidden]) + .messages:not(:empty) { margin-top: 0.375rem; }
429
+ /* Each new message rises into place once. */
430
+ .message { animation: luzia-rise 260ms var(--luzia-ease-out); }
431
+ @keyframes luzia-rise {
432
+ from { opacity: 0; transform: translateY(6px) scale(0.98); }
433
+ }
434
+ @keyframes luzia-fade {
435
+ from { opacity: 0; }
273
436
  }
274
437
  .suggestions {
275
438
  display: flex;
@@ -280,17 +443,33 @@ export const styles = `
280
443
  padding: 0;
281
444
  list-style: none;
282
445
  }
446
+ /* Questions the Visitor could ask, tinted with the accent; they arrive one after another. */
447
+ .suggestions li { animation: luzia-rise 320ms var(--luzia-ease-out) both; transform-origin: bottom right; }
448
+ .suggestions li:nth-child(2) { animation-delay: 50ms; }
449
+ .suggestions li:nth-child(3) { animation-delay: 100ms; }
450
+ .suggestions li:nth-child(n + 4) { animation-delay: 150ms; }
283
451
  .suggestion {
284
- padding: 0.4rem 0.75rem;
285
- border: 1px solid var(--luzia-accent);
452
+ padding: 0.5rem 0.9rem;
453
+ border: 1px solid color-mix(in srgb, var(--luzia-accent) 24%, transparent);
286
454
  border-radius: 999px;
287
- background: var(--luzia-surface);
288
- color: var(--luzia-text);
289
- font: 0.875rem var(--luzia-font);
455
+ background: color-mix(in srgb, var(--luzia-accent) 7%, var(--luzia-surface));
456
+ color: color-mix(in srgb, var(--luzia-accent) 60%, var(--luzia-text));
457
+ font: 500 0.875rem/1.3 var(--luzia-font);
290
458
  text-align: left;
291
459
  cursor: pointer;
460
+ transition: background-color 150ms ease, border-color 150ms ease, transform 160ms ease-out;
461
+ }
462
+ @media (hover: hover) and (pointer: fine) {
463
+ .suggestion:hover {
464
+ border-color: color-mix(in srgb, var(--luzia-accent) 45%, transparent);
465
+ background: color-mix(in srgb, var(--luzia-accent) 13%, var(--luzia-surface));
466
+ }
467
+ }
468
+ .suggestion:active { transform: scale(0.97); }
469
+ @media (prefers-reduced-motion: reduce) {
470
+ .message, .suggestions li { animation-name: luzia-fade; }
471
+ .suggestion:active { transform: none; }
292
472
  }
293
- .suggestion:hover { background: var(--luzia-muted); }
294
473
  .alert {
295
474
  margin: 0 1rem 0.5rem;
296
475
  font-size: 0.875rem;
@@ -299,32 +478,65 @@ export const styles = `
299
478
  .alert a {
300
479
  color: inherit;
301
480
  }
481
+ /* One rounded field: the message box with a round Send button inside it. */
302
482
  .composer {
303
483
  display: flex;
304
- gap: 0.5rem;
305
- padding: 0.75rem;
306
- border-top: 1px solid var(--luzia-muted);
484
+ align-items: flex-end;
485
+ gap: 0.375rem;
486
+ margin: 0 0.75rem 0.75rem;
487
+ padding: 0.25rem 0.25rem 0.25rem 1rem;
488
+ border: 1px solid var(--luzia-border);
489
+ border-radius: 1.5rem;
490
+ background: var(--luzia-surface);
491
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
492
+ transition: border-color 150ms ease, box-shadow 150ms ease;
493
+ }
494
+ .composer:focus-within {
495
+ border-color: color-mix(in srgb, var(--luzia-accent) 60%, var(--luzia-border));
496
+ box-shadow: 0 0 0 4px color-mix(in srgb, var(--luzia-accent) 16%, transparent);
307
497
  }
308
498
  .composer textarea {
309
499
  flex: 1;
500
+ box-sizing: border-box;
501
+ min-height: 2.75rem;
502
+ max-height: 8rem;
310
503
  resize: none;
311
- padding: 0.5rem;
312
- border: 1px solid var(--luzia-border);
313
- border-radius: 0.5rem;
314
- background: var(--luzia-surface);
504
+ padding: 0.7rem 0;
505
+ border: none;
506
+ background: transparent;
315
507
  color: var(--luzia-text);
508
+ caret-color: var(--luzia-accent);
316
509
  font: inherit;
510
+ font-size: 0.9375rem;
511
+ line-height: 1.4;
512
+ /* Grows with what is typed, where supported. */
513
+ field-sizing: content;
317
514
  }
318
- .composer button {
319
- padding: 0 1rem;
515
+ .composer textarea::placeholder { color: color-mix(in srgb, var(--luzia-text) 55%, transparent); }
516
+ .composer textarea:disabled { cursor: not-allowed; }
517
+ .send {
518
+ display: grid;
519
+ place-items: center;
520
+ flex: none;
521
+ width: 44px;
522
+ height: 44px;
523
+ padding: 0;
320
524
  border: none;
321
- border-radius: 0.5rem;
525
+ border-radius: 50%;
322
526
  background: var(--luzia-accent);
323
527
  color: var(--luzia-accent-contrast);
324
- font: 600 0.875rem var(--luzia-font);
325
528
  cursor: pointer;
529
+ transition: background-color 150ms ease, opacity 150ms ease, transform 160ms ease-out;
530
+ }
531
+ .send svg { display: block; }
532
+ @media (hover: hover) and (pointer: fine) {
533
+ .send:not(:disabled):hover { background: color-mix(in srgb, var(--luzia-accent) 86%, #000); }
534
+ }
535
+ .send:not(:disabled):active { transform: scale(0.94); }
536
+ .send:disabled { opacity: 0.35; cursor: default; }
537
+ @media (prefers-reduced-motion: reduce) {
538
+ .send:not(:disabled):active { transform: none; }
326
539
  }
327
- .composer button:disabled { opacity: 0.5; cursor: default; }
328
540
  @media (max-width: 480px) {
329
541
  /* The whole visible screen: above the on-screen keyboard when it is open (set by the element from visualViewport). */
330
542
  .panel {
@@ -334,6 +546,7 @@ export const styles = `
334
546
  width: 100vw;
335
547
  height: var(--luzia-viewport-height, 100vh);
336
548
  margin: 0;
549
+ border: none;
337
550
  border-radius: 0;
338
551
  }
339
552
  @supports (height: 100dvh) {
@@ -344,7 +557,8 @@ export const styles = `
344
557
  :host([data-keyboard]) .speech-text { max-height: 4.5rem; }
345
558
  /* Inline, the chat stays in the page but never taller than the screen. */
346
559
  :host([mode='inline']) .panel { height: min(var(--luzia-inline-height), 85vh); }
347
- .composer { padding-bottom: max(0.75rem, env(safe-area-inset-bottom)); }
560
+ .composer { margin-bottom: max(0.75rem, env(safe-area-inset-bottom)); }
561
+ :host(:not([mode='inline'])) .panel { transform-origin: bottom center; }
348
562
  /* Below 16px, mobile browsers zoom the page when the text box gets focus. */
349
563
  .composer textarea { font-size: 16px; }
350
564
  }
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4UrB,CAAC"}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkiBrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luzia-widget",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Embeddable luzIA chat widget (framework-free Web Component)",
5
5
  "license": "MIT",
6
6
  "author": "Sergio Deri <sergio.deri@astrocode.uy>",