@saar-ai/web-widget 0.4.1 → 0.6.0
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/card-aspect.d.ts +58 -0
- package/dist/card-aspect.d.ts.map +1 -0
- package/dist/chunks/chat-tMKkYmTC.js +592 -0
- package/dist/chunks/host-widget-C0XT9lHX.js +9637 -0
- package/dist/chunks/{telemetry-Bw-3F_Zk.js → telemetry-BI_SEWTb.js} +104 -2
- package/dist/dock/dock-caption.d.ts +67 -0
- package/dist/dock/dock-caption.d.ts.map +1 -0
- package/dist/dock/dock-motion.d.ts +155 -0
- package/dist/dock/dock-motion.d.ts.map +1 -0
- package/dist/dock/dock-pill.d.ts +38 -0
- package/dist/dock/dock-pill.d.ts.map +1 -0
- package/dist/dock/dock-row.d.ts +120 -0
- package/dist/dock/dock-row.d.ts.map +1 -0
- package/dist/dock/dock-sheet.d.ts +89 -0
- package/dist/dock/dock-sheet.d.ts.map +1 -0
- package/dist/dock/dock-shelf.d.ts +38 -0
- package/dist/dock/dock-shelf.d.ts.map +1 -0
- package/dist/dock/dock-state.d.ts +221 -0
- package/dist/dock/dock-state.d.ts.map +1 -0
- package/dist/dock/dock.d.ts +344 -0
- package/dist/dock/dock.d.ts.map +1 -0
- package/dist/dock/geometry.d.ts +161 -0
- package/dist/dock/geometry.d.ts.map +1 -0
- package/dist/format-money.d.ts +54 -17
- package/dist/format-money.d.ts.map +1 -1
- package/dist/generated/widget-css.d.ts.map +1 -1
- package/dist/host-widget.d.ts +156 -16
- package/dist/host-widget.d.ts.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4029 -7
- package/dist/messages.d.ts +86 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/next/index.js +1 -1
- package/dist/session-log.d.ts +7 -0
- package/dist/session-log.d.ts.map +1 -1
- package/dist/session-panel.d.ts +13 -3
- package/dist/session-panel.d.ts.map +1 -1
- package/dist/theme/color.d.ts +114 -0
- package/dist/theme/color.d.ts.map +1 -0
- package/dist/theme/derive.d.ts +92 -0
- package/dist/theme/derive.d.ts.map +1 -0
- package/dist/theme/index.d.ts +10 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/turn-order.d.ts +106 -0
- package/dist/turn-order.d.ts.map +1 -0
- package/dist/use-chat-session.d.ts +146 -17
- package/dist/use-chat-session.d.ts.map +1 -1
- package/dist/use-voice-session.d.ts +110 -4
- package/dist/use-voice-session.d.ts.map +1 -1
- package/dist/voice-widget.d.ts +114 -24
- package/dist/voice-widget.d.ts.map +1 -1
- package/dist/widget-cards.d.ts +28 -1
- package/dist/widget-cards.d.ts.map +1 -1
- package/dist/widget.css +1 -1
- package/package.json +4 -4
- package/src/styles/concierge.css +803 -28
- package/src/styles/tokens.css +67 -0
- package/dist/chunks/chat-DfajYOmN.js +0 -240
- package/dist/chunks/host-widget-C9EyGeiN.js +0 -9745
- package/dist/concierge-launcher.d.ts +0 -53
- package/dist/concierge-launcher.d.ts.map +0 -1
- package/dist/concierge-shell.d.ts +0 -256
- package/dist/concierge-shell.d.ts.map +0 -1
- package/dist/position.d.ts +0 -65
- package/dist/position.d.ts.map +0 -1
- package/dist/transcript-geometry.d.ts +0 -220
- package/dist/transcript-geometry.d.ts.map +0 -1
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { type WidgetAvatar } from './avatar.js';
|
|
2
|
-
import { alignOf, type ConciergePosition } from './position.js';
|
|
3
|
-
/**
|
|
4
|
-
* The collapsed concierge: a pill the visitor can read, press, and move.
|
|
5
|
-
*
|
|
6
|
-
* ## Why a pill and not a round button
|
|
7
|
-
*
|
|
8
|
-
* A bare orb says "there is a bot here" and nothing else. This product's
|
|
9
|
-
* concierge answers in SPEECH, which is the thing a visitor has to be told —
|
|
10
|
-
* nobody presses an unlabelled circle expecting to talk to it. So the launcher
|
|
11
|
-
* carries the tenant's own words (`label`), beside the face rather than instead
|
|
12
|
-
* of it: the mascot is what the concierge IS, and swapping it for a microphone
|
|
13
|
-
* glyph would trade a personality for an icon that says less.
|
|
14
|
-
*
|
|
15
|
-
* ## Why it is draggable
|
|
16
|
-
*
|
|
17
|
-
* The widget sits on somebody else's page, over content the tenant chose and we
|
|
18
|
-
* have never seen. A fixed corner covers a cookie bar on one site and a "buy"
|
|
19
|
-
* button on another, and no default can be right everywhere. The tenant picks
|
|
20
|
-
* where it starts; the visitor gets the last word.
|
|
21
|
-
*
|
|
22
|
-
* Dragging is the obvious gesture and the inaccessible one, so the grip is a
|
|
23
|
-
* real focusable control and arrow keys move between the same six anchors —
|
|
24
|
-
* see `positionForArrow`. Anyone who cannot drag can still move the thing off
|
|
25
|
-
* the content it is covering.
|
|
26
|
-
*
|
|
27
|
-
* ## What it does NOT do
|
|
28
|
-
*
|
|
29
|
-
* It does not remember anything. Where the widget sits between visits is the
|
|
30
|
-
* host app's business — it owns the storage, the tenant default it falls back
|
|
31
|
-
* to, and the consent posture around keeping anything at all.
|
|
32
|
-
*/
|
|
33
|
-
export interface ConciergeLauncherProps {
|
|
34
|
-
/** Visible text. Absent ⇒ the face alone, and `srLabel` names it. */
|
|
35
|
-
readonly label?: string;
|
|
36
|
-
/** Accessible name of the launcher itself. Always required. */
|
|
37
|
-
readonly srLabel: string;
|
|
38
|
-
/** Accessible name of the drag grip, e.g. "Move the assistant". */
|
|
39
|
-
readonly moveLabel: string;
|
|
40
|
-
readonly position: ConciergePosition;
|
|
41
|
-
/** Absent ⇒ the launcher is fixed where the tenant put it, with no grip. */
|
|
42
|
-
readonly onPositionChange?: (position: ConciergePosition) => void;
|
|
43
|
-
readonly onOpen: () => void;
|
|
44
|
-
readonly hidden: boolean;
|
|
45
|
-
readonly id?: string;
|
|
46
|
-
readonly testId?: string;
|
|
47
|
-
/** Which face renders inside the pill. Defaults to `'orb'` — see `avatar.ts`. */
|
|
48
|
-
readonly avatar?: WidgetAvatar;
|
|
49
|
-
}
|
|
50
|
-
export declare function ConciergeLauncher({ label, srLabel, moveLabel, position, onPositionChange, onOpen, hidden, id, testId, avatar, }: ConciergeLauncherProps): import("react").JSX.Element;
|
|
51
|
-
/** Re-exported so a host can type its own stored value. */
|
|
52
|
-
export { alignOf };
|
|
53
|
-
//# sourceMappingURL=concierge-launcher.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"concierge-launcher.d.ts","sourceRoot":"","sources":["../src/concierge-launcher.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,OAAO,EAIP,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,4EAA4E;IAC5E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClE,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AAED,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,MAAM,EACN,EAAE,EACF,MAAM,EACN,MAA8B,GAC/B,EAAE,sBAAsB,+BAuOxB;AAED,2DAA2D;AAC3D,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
-
import type { BotState } from './bot-state.js';
|
|
3
|
-
import { type WidgetAvatar } from './avatar.js';
|
|
4
|
-
import { type ConciergePosition } from './position.js';
|
|
5
|
-
/**
|
|
6
|
-
* The concierge widget's chrome: trigger, backdrop, panel, face, composer.
|
|
7
|
-
*
|
|
8
|
-
* ## Why it is a package and not a component in one app
|
|
9
|
-
*
|
|
10
|
-
* This widget renders in two places — the scripted preview on the marketing
|
|
11
|
-
* site and the real assistant in the product — and the preview's entire claim
|
|
12
|
-
* is that a visitor is looking at what they would get. Two implementations can
|
|
13
|
-
* only agree by hand, and would stop agreeing the first time either was
|
|
14
|
-
* touched. So the chrome is defined once, here, and each app supplies what is
|
|
15
|
-
* genuinely its own: the marketing preview replays a script, the product holds
|
|
16
|
-
* a live session with a microphone, product cards and a cart.
|
|
17
|
-
*
|
|
18
|
-
* What is deliberately NOT here: the transcript. `children` is the whole
|
|
19
|
-
* conversation area, because that is where the two legitimately differ — the
|
|
20
|
-
* preview renders bubbles, the product renders bubbles plus cards, attachments,
|
|
21
|
-
* markdown and a cart summary. A shell that tried to own that would end up with
|
|
22
|
-
* a prop for every feature either app ever grows.
|
|
23
|
-
*
|
|
24
|
-
* ## No i18n, no router, no data
|
|
25
|
-
*
|
|
26
|
-
* Every string arrives in {@link ConciergeShellProps.labels}. The package has
|
|
27
|
-
* no locale of its own, and an app that translates with `next-intl` should not
|
|
28
|
-
* have to reach a translator into a design-system component to render a button.
|
|
29
|
-
*
|
|
30
|
-
* ## It is a modal dialog, and behaves like one
|
|
31
|
-
*
|
|
32
|
-
* `Escape` closes, `Tab` is trapped inside the panel, and focus returns to the
|
|
33
|
-
* trigger on close — focus leaking to the page behind an open dialog leaves a
|
|
34
|
-
* keyboard or screen-reader user navigating content they cannot see.
|
|
35
|
-
*
|
|
36
|
-
* Focus lands on the COMPOSER, not the close button. It is what a visitor
|
|
37
|
-
* opened the panel to use, and a focused close button swallows the space bar:
|
|
38
|
-
* press space to start typing before clicking into the field and the panel
|
|
39
|
-
* shuts instead — a keyboard user's first keystroke dismissing the thing they
|
|
40
|
-
* just opened.
|
|
41
|
-
*
|
|
42
|
-
* ## The animation carries nothing
|
|
43
|
-
*
|
|
44
|
-
* Every flourish below is decorative and stops wholesale under
|
|
45
|
-
* `prefers-reduced-motion`. That is only safe because the state is also
|
|
46
|
-
* announced in text — see {@link ConciergeShellProps.announcement}, which is
|
|
47
|
-
* the live region and not an afterthought.
|
|
48
|
-
*/
|
|
49
|
-
export interface ConciergeShellLabels {
|
|
50
|
-
/** Accessible name of the collapsed trigger. */
|
|
51
|
-
readonly open: string;
|
|
52
|
-
/**
|
|
53
|
-
* Visible text ON the collapsed launcher — the tenant's own words for their
|
|
54
|
-
* concierge, from the widget config, in the config's own locale.
|
|
55
|
-
*
|
|
56
|
-
* Absent leaves the face alone with `open` as its accessible name, which is
|
|
57
|
-
* what a host with nothing to say should render rather than a placeholder.
|
|
58
|
-
*/
|
|
59
|
-
readonly launcher?: string;
|
|
60
|
-
/** Accessible name of the drag grip, e.g. "Move the assistant". */
|
|
61
|
-
readonly move?: string;
|
|
62
|
-
readonly close: string;
|
|
63
|
-
/** Accessible name of the dialog itself. */
|
|
64
|
-
readonly dialog: string;
|
|
65
|
-
readonly composerPlaceholder: string;
|
|
66
|
-
readonly send: string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Where a call is, from the caller's point of view.
|
|
70
|
-
*
|
|
71
|
-
* The panel no longer draws a full status BAR for these — removed on
|
|
72
|
-
* request; the widget reads better without one. What it draws instead, on
|
|
73
|
-
* explicit later request, is a small one-word PILL under the orb (see
|
|
74
|
-
* `ConciergeShellVoice.labels`'s `connecting`/`listening`/`thinking`/
|
|
75
|
-
* `speaking` and the orb overlay below) — a partial reversal, not a
|
|
76
|
-
* contradiction: the pill shows only the call's current state word, never
|
|
77
|
-
* an error or a refusal reason, which still reaches the caller through the
|
|
78
|
-
* host's own status line exactly as before. The phase still decides which
|
|
79
|
-
* control the composer row offers too.
|
|
80
|
-
*/
|
|
81
|
-
export type ConciergeCallPhase = 'idle' | 'connecting' | 'waiting' | 'live' | 'blocked';
|
|
82
|
-
/**
|
|
83
|
-
* The voice leg, as the panel needs to see it.
|
|
84
|
-
*
|
|
85
|
-
* Replaces the old `mic` prop, which could only express "there is a button".
|
|
86
|
-
* A voice-first widget has to express where the call IS: a caller who presses
|
|
87
|
-
* the microphone and sees nothing for four seconds concludes the product is
|
|
88
|
-
* broken, and that is exactly what the transport spends on a good day.
|
|
89
|
-
*/
|
|
90
|
-
export interface ConciergeShellVoice {
|
|
91
|
-
readonly phase: ConciergeCallPhase;
|
|
92
|
-
/** Start a call. Only reachable while `phase` is `idle`. */
|
|
93
|
-
readonly onStart: () => void;
|
|
94
|
-
/** Leave the call — a different intention from muting it. */
|
|
95
|
-
readonly onEnd?: () => void;
|
|
96
|
-
/** Ask the browser for the microphone again, after it was refused. */
|
|
97
|
-
readonly onRetryMic?: () => void;
|
|
98
|
-
readonly muted?: boolean;
|
|
99
|
-
readonly onToggleMute?: () => void;
|
|
100
|
-
/** True while the agent is talking, so the bar can offer the interrupt. */
|
|
101
|
-
readonly agentSpeaking?: boolean;
|
|
102
|
-
/** 0..1, drives the level meter. */
|
|
103
|
-
readonly level?: number;
|
|
104
|
-
/**
|
|
105
|
-
* Present and DISABLED rather than hidden, for a surface that has no voice
|
|
106
|
-
* leg but wants to show the product has one — the marketing preview. A host
|
|
107
|
-
* with nothing to offer omits `voice` entirely.
|
|
108
|
-
*/
|
|
109
|
-
readonly disabled?: boolean;
|
|
110
|
-
readonly labels: {
|
|
111
|
-
/** Accessible name of the start button, and its tooltip when disabled. */
|
|
112
|
-
readonly start: string;
|
|
113
|
-
readonly end?: string;
|
|
114
|
-
readonly mute?: string;
|
|
115
|
-
readonly unmute?: string;
|
|
116
|
-
/** One line for the call bar: "Connecting…", "You can talk now", a reason. */
|
|
117
|
-
readonly status?: string;
|
|
118
|
-
/** Shown while the agent speaks: "go ahead and interrupt". */
|
|
119
|
-
readonly interrupt?: string;
|
|
120
|
-
/** The retry button, offered only when the microphone was refused. */
|
|
121
|
-
readonly retry?: string;
|
|
122
|
-
/**
|
|
123
|
-
* WHY the control cannot be used, replacing `start` as the accessible
|
|
124
|
-
* name for as long as it cannot — see `micLabel` below.
|
|
125
|
-
*
|
|
126
|
-
* `start` names the action the button would perform, and a button that
|
|
127
|
-
* performs nothing must not announce one: a caller who hears "Start
|
|
128
|
-
* talking" on a control that refuses every press has been told the
|
|
129
|
-
* product is broken. Read only while the control is unusable
|
|
130
|
-
* (`disabled`, or `phase === 'blocked'`), so a host can supply it
|
|
131
|
-
* unconditionally; absent falls back to the old behaviour, which is what
|
|
132
|
-
* a host with no reason worth naming should get.
|
|
133
|
-
*/
|
|
134
|
-
readonly unavailable?: string;
|
|
135
|
-
/**
|
|
136
|
-
* The four words the voice-state pill under the orb shows (see that
|
|
137
|
-
* pill's own doc comment) — one per state a live call can be in.
|
|
138
|
-
* Defaults to the package's brand-neutral English fallback
|
|
139
|
-
* (`defaultWidgetMessages`, `messages.ts`) so an existing caller that
|
|
140
|
-
* has not been updated to pass these still renders sensibly; a host
|
|
141
|
-
* with its own translation catalogue supplies its own.
|
|
142
|
-
*/
|
|
143
|
-
readonly connecting?: string;
|
|
144
|
-
readonly listening?: string;
|
|
145
|
-
readonly thinking?: string;
|
|
146
|
-
readonly speaking?: string;
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* The small wordmark link rendered directly under the open panel — which
|
|
151
|
-
* adopter's framework fork produced this bundle, not a per-tenant value. See
|
|
152
|
-
* {@link ConciergeShellProps.attribution}'s own doc comment for the full
|
|
153
|
-
* "why not just resolve `@wesence/branding` here" reasoning. Exported (rather
|
|
154
|
-
* than declared inline on each prop that carries it) so `voice-widget.tsx`,
|
|
155
|
-
* `host-widget.tsx`, and `cdn/core.ts`'s `UiModule` reference one definition
|
|
156
|
-
* instead of four independent copies of the same two-field shape.
|
|
157
|
-
*/
|
|
158
|
-
export interface WidgetAttribution {
|
|
159
|
-
readonly name: string;
|
|
160
|
-
readonly href: string;
|
|
161
|
-
}
|
|
162
|
-
export interface ConciergeShellProps {
|
|
163
|
-
readonly open: boolean;
|
|
164
|
-
readonly onOpenChange: (open: boolean) => void;
|
|
165
|
-
/** What the face renders. */
|
|
166
|
-
readonly state: BotState;
|
|
167
|
-
/** One-shot flourish when the visitor's own message lands. */
|
|
168
|
-
readonly messageArrived?: boolean;
|
|
169
|
-
/** Which face — the 'orb' blob or the 'knot' rope line. Defaults to `'orb'`; see `avatar.ts`. */
|
|
170
|
-
readonly avatar?: WidgetAvatar;
|
|
171
|
-
readonly labels: ConciergeShellLabels;
|
|
172
|
-
/**
|
|
173
|
-
* The conversation. Rendered inside the panel's own scroll container, so a
|
|
174
|
-
* caller supplies list items and nothing about scrolling or padding.
|
|
175
|
-
*/
|
|
176
|
-
readonly children: ReactNode;
|
|
177
|
-
/** Between the face and the transcript — the preview's "scripted" badge. */
|
|
178
|
-
readonly badge?: ReactNode;
|
|
179
|
-
readonly draft: string;
|
|
180
|
-
readonly onDraftChange: (value: string) => void;
|
|
181
|
-
/** The composer was submitted with a non-empty draft. */
|
|
182
|
-
readonly onSubmit: () => void;
|
|
183
|
-
readonly composerDisabled?: boolean;
|
|
184
|
-
/** Omitted ⇒ no voice control renders at all. */
|
|
185
|
-
readonly voice?: ConciergeShellVoice;
|
|
186
|
-
/**
|
|
187
|
-
* Rendered inside the composer, before the text field.
|
|
188
|
-
*
|
|
189
|
-
* Exists for the product's attachment control, which the marketing preview
|
|
190
|
-
* has nothing to put there. A slot rather than an `onAttach` prop because
|
|
191
|
-
* the widget that owns the file input also owns its label, its accepted
|
|
192
|
-
* types and what "uploading" looks like — none of which belongs in a design
|
|
193
|
-
* system component.
|
|
194
|
-
*/
|
|
195
|
-
readonly composerLeading?: ReactNode;
|
|
196
|
-
/**
|
|
197
|
-
* What a screen reader is told, replacing everything the animation conveys.
|
|
198
|
-
* Changing it announces it, so it should be the state or the newest reply —
|
|
199
|
-
* never a value that changes on every frame.
|
|
200
|
-
*/
|
|
201
|
-
readonly announcement?: string;
|
|
202
|
-
/** `[data-skin]` on the root, for the brand-token overrides. */
|
|
203
|
-
readonly skin?: string;
|
|
204
|
-
/** Inline brand-token overrides, for a skin computed at runtime. */
|
|
205
|
-
readonly skinStyle?: CSSProperties;
|
|
206
|
-
/**
|
|
207
|
-
* Namespaces this instance's element ids. Two widgets on one page would
|
|
208
|
-
* otherwise share a trigger id and hand focus to each other's.
|
|
209
|
-
*/
|
|
210
|
-
readonly idPrefix?: string;
|
|
211
|
-
/** Scrolls the transcript to the newest turn when it changes. */
|
|
212
|
-
readonly scrollKey?: unknown;
|
|
213
|
-
/**
|
|
214
|
-
* Which edge the widget hangs from. Defaults to bottom-centre.
|
|
215
|
-
*
|
|
216
|
-
* The TENANT's default arrives here from the widget config; a visitor may
|
|
217
|
-
* move it, which is what `onPositionChange` reports. Remembering their choice
|
|
218
|
-
* is the host app's business — see `ConciergeLauncher`.
|
|
219
|
-
*/
|
|
220
|
-
readonly position?: ConciergePosition;
|
|
221
|
-
/** Absent ⇒ the launcher cannot be moved and renders no grip. */
|
|
222
|
-
readonly onPositionChange?: (position: ConciergePosition) => void;
|
|
223
|
-
/**
|
|
224
|
-
* `data-testid`s for the controls the shell owns.
|
|
225
|
-
*
|
|
226
|
-
* The product's suite drives this widget through its own ids and predates
|
|
227
|
-
* the shell; naming them here keeps those tests asserting behaviour rather
|
|
228
|
-
* than being rewritten into assertions about a design system's markup.
|
|
229
|
-
*/
|
|
230
|
-
readonly testIds?: {
|
|
231
|
-
readonly trigger?: string;
|
|
232
|
-
readonly panel?: string;
|
|
233
|
-
readonly input?: string;
|
|
234
|
-
readonly send?: string;
|
|
235
|
-
readonly mic?: string;
|
|
236
|
-
readonly endCall?: string;
|
|
237
|
-
};
|
|
238
|
-
/**
|
|
239
|
-
* The small wordmark link rendered directly under the open panel — which
|
|
240
|
-
* adopter's framework fork produced this bundle, not a per-tenant value.
|
|
241
|
-
*
|
|
242
|
-
* A NAME and DATA prop, same rule this file states above for `labels`: this
|
|
243
|
-
* package owns no identity of its own and never imports `@wesence/branding`
|
|
244
|
-
* (this package publishes to public npm with an absolute "resolves no
|
|
245
|
-
* `@wesence/*` module at all" guard, `scripts/check-npm-bundle-provenance.mjs`) —
|
|
246
|
-
* the caller resolves `branding.name`/`branding.domain` and passes them
|
|
247
|
-
* down. `cdn/core.ts` does this unconditionally for the real merchant-facing
|
|
248
|
-
* embed (that file is CDN-only, out of the guard's scope, so importing
|
|
249
|
-
* `@wesence/branding` there is safe); any other caller wanting the badge
|
|
250
|
-
* (the marketing preview, a future light-DOM npm consumer) does the same.
|
|
251
|
-
* Absent ⇒ no attribution renders at all, rather than a placeholder.
|
|
252
|
-
*/
|
|
253
|
-
readonly attribution?: WidgetAttribution;
|
|
254
|
-
}
|
|
255
|
-
export declare function ConciergeShell({ open, onOpenChange, state, messageArrived, avatar, labels, children, badge, draft, onDraftChange, onSubmit, composerDisabled, voice, announcement, skin, skinStyle, idPrefix, scrollKey, composerLeading, testIds, position, onPositionChange, attribution, }: ConciergeShellProps): import("react").JSX.Element;
|
|
256
|
-
//# sourceMappingURL=concierge-shell.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"concierge-shell.d.ts","sourceRoot":"","sources":["../src/concierge-shell.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AA4BvE,OAAO,EAIL,KAAK,iBAAiB,EACvB,M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AAE,MAAM,CAAC;QACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAC;CAC1C;AAKD,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,cAAsB,EACtB,MAA8B,EAC9B,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,EACL,aAAa,EACb,QAAQ,EACR,gBAAwB,EACxB,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,QAAsB,EACtB,SAAS,EACT,eAAe,EACf,OAAO,EACP,QAAqC,EACrC,gBAAgB,EAChB,WAAW,GACZ,EAAE,mBAAmB,+BA67BrB"}
|
package/dist/position.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Where the concierge sits on the host page, and how a visitor moves it.
|
|
3
|
-
*
|
|
4
|
-
* Six anchors, not four. The two centres exist because the launcher is a PILL
|
|
5
|
-
* with a label on it now, not a round button: a wide control tucked into a
|
|
6
|
-
* corner reads as an ad, and the middle of an edge is where a host page's own
|
|
7
|
-
* content is least likely to be. The corners remain because they are where a
|
|
8
|
-
* tenant with a fixed footer or a cookie bar needs it.
|
|
9
|
-
*
|
|
10
|
-
* The tenant picks the default in the widget config; a visitor may drag it
|
|
11
|
-
* somewhere else, and where they put it is theirs — see `nearestPosition`.
|
|
12
|
-
*/
|
|
13
|
-
export declare const CONCIERGE_POSITIONS: readonly ['top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'];
|
|
14
|
-
export type ConciergePosition = (typeof CONCIERGE_POSITIONS)[number];
|
|
15
|
-
export declare const DEFAULT_CONCIERGE_POSITION: ConciergePosition;
|
|
16
|
-
/** `top` | `bottom` — which edge the widget hangs from. */
|
|
17
|
-
export type ConciergeEdge = 'top' | 'bottom';
|
|
18
|
-
/** `left` | `center` | `right` — where along that edge. */
|
|
19
|
-
export type ConciergeAlign = 'left' | 'center' | 'right';
|
|
20
|
-
export declare function edgeOf(position: ConciergePosition): ConciergeEdge;
|
|
21
|
-
export declare function alignOf(position: ConciergePosition): ConciergeAlign;
|
|
22
|
-
/**
|
|
23
|
-
* The anchor a dropped widget should snap to.
|
|
24
|
-
*
|
|
25
|
-
* Thirds horizontally, halves vertically, measured on the widget's own CENTRE
|
|
26
|
-
* rather than the pointer: a visitor drags the grip, which sits at one end of
|
|
27
|
-
* the pill, and snapping on the pointer would send a pill they dropped dead
|
|
28
|
-
* centre off to whichever side they happened to be holding.
|
|
29
|
-
*
|
|
30
|
-
* Pure arithmetic on numbers the caller measures, so it is testable without a
|
|
31
|
-
* DOM and cannot disagree with itself across browsers.
|
|
32
|
-
* @param centre the widget's centre point, in viewport pixels
|
|
33
|
-
* @param viewport the viewport's size, in pixels
|
|
34
|
-
*/
|
|
35
|
-
export declare function nearestPosition(centre: {
|
|
36
|
-
x: number;
|
|
37
|
-
y: number;
|
|
38
|
-
}, viewport: {
|
|
39
|
-
width: number;
|
|
40
|
-
height: number;
|
|
41
|
-
}): ConciergePosition;
|
|
42
|
-
/**
|
|
43
|
-
* The anchor an arrow key moves to.
|
|
44
|
-
*
|
|
45
|
-
* The keyboard equivalent of dragging, and not a nicety: a pointer-only way to
|
|
46
|
-
* move the widget is unusable for anyone who cannot drag, and the widget can
|
|
47
|
-
* cover a host page's own controls. Left/right walk the three columns and stop
|
|
48
|
-
* at the ends rather than wrapping — a control that jumps from one edge of the
|
|
49
|
-
* screen to the other because a key was held is disorienting. Up/down flip the
|
|
50
|
-
* edge.
|
|
51
|
-
* @param position where it is now
|
|
52
|
-
* @param key the arrow key pressed
|
|
53
|
-
*/
|
|
54
|
-
export declare function positionForArrow(position: ConciergePosition, key: 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'ArrowDown'): ConciergePosition;
|
|
55
|
-
/** Tailwind classes pinning a fixed element to one anchor. */
|
|
56
|
-
export declare function positionClasses(position: ConciergePosition): string;
|
|
57
|
-
/**
|
|
58
|
-
* How the open PANEL lines up under (or over) the launcher.
|
|
59
|
-
*
|
|
60
|
-
* The panel is much wider than the pill, so it cannot simply share the
|
|
61
|
-
* launcher's anchor: pinned left it would still be pinned left, but pinned
|
|
62
|
-
* centre it has to centre on the viewport rather than on the pill.
|
|
63
|
-
*/
|
|
64
|
-
export declare function panelClasses(position: ConciergePosition): string;
|
|
65
|
-
//# sourceMappingURL=position.d.ts.map
|
package/dist/position.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../src/position.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,YAC9B,UAAU,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,eAAe,EACf,cAAc,CACN,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,eAAO,MAAM,0BAA0B,EAAE,iBAAmC,CAAC;AAE7E,2DAA2D;AAC3D,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC;AAC7C,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,aAAa,CAEjE;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,cAAc,CAInE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAChC,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1C,iBAAiB,CAMnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,iBAAiB,EAC3B,GAAG,EAAE,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GACxD,iBAAiB,CAUnB;AAED,8DAA8D;AAC9D,wBAAgB,eAAe,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAQnE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAQhE"}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PANEL GEOMETRY — where the conversation's first row sits, as a FRACTION of
|
|
3
|
-
* the panel's height, and what that costs horizontally.
|
|
4
|
-
*
|
|
5
|
-
* Four CSS length expressions and the arithmetic behind them, used by
|
|
6
|
-
* `concierge-shell.tsx`'s `transcriptEdgeFade`. Their own module, and NOT
|
|
7
|
-
* re-exported from `index.ts`: `concierge-shell.geometry.test.tsx` has to read
|
|
8
|
-
* the exact strings the component ships (jsdom's CSS serializer mangles a
|
|
9
|
-
* `max()` containing a subtraction, so reading them back off a rendered element
|
|
10
|
-
* tests jsdom rather than this widget), while the package's public API stays
|
|
11
|
-
* the components themselves.
|
|
12
|
-
*
|
|
13
|
-
* One ratio ties the four lengths together, and it is the whole
|
|
14
|
-
* repair for a bug that shipped: the panel is an ellipse (`rounded-full` on a
|
|
15
|
-
* `w x 1.6w` box), so how much width it offers depends entirely on how far down
|
|
16
|
-
* you are. The clearances below scaled with `cqh` while the transcript's
|
|
17
|
-
* horizontal inset was a fixed 8px tuned for the oval's wide middle, so the
|
|
18
|
-
* taller the panel got the HIGHER the first message sat proportionally — into a
|
|
19
|
-
* narrower part of the curve, with no matching inset. Measured live in
|
|
20
|
-
* Storybook, first agent bubble's top-left corner against the curve at its own
|
|
21
|
-
* top edge: 14px inside the ellipse at a 582px panel, 37px at 720px, 62px at
|
|
22
|
-
* 920px (the 2000x1150 desktop it was reported on). `overflow-clip` on the
|
|
23
|
-
* surface then cut exactly that much off the bubble.
|
|
24
|
-
*
|
|
25
|
-
* 0.1924 is not chosen, it is READ OFF the short panel: 112px (the tuned
|
|
26
|
-
* clearance, see {@link TRANSCRIPT_FADE_TOP_LEN}) over 582px (the panel a
|
|
27
|
-
* 375x812 phone renders) is 0.19244. Holding that ratio at every size is what
|
|
28
|
-
* makes the geometry scale-invariant — every panel then presents the first row
|
|
29
|
-
* at the same point on the same curve, and ONE horizontal inset serves all of
|
|
30
|
-
* them ({@link TRANSCRIPT_INSET_X}). Expressed as `19.24cqh` in the lengths
|
|
31
|
-
* below; `cqh` is the panel's own height, via `[container-type:size]` on the
|
|
32
|
-
* panel div (verified live: `14cqh` resolved to 128.8px on a 920px panel).
|
|
33
|
-
*
|
|
34
|
-
* Not a JS constant that gets multiplied out — the panel's height is never
|
|
35
|
-
* known to JS, only to CSS, which is why every length here is an expression.
|
|
36
|
-
*/
|
|
37
|
-
/**
|
|
38
|
-
* Top ramp when the transcript starts at the panel's top, under the floating
|
|
39
|
-
* orb — it has to span the orb, so a message is gone before it reaches it
|
|
40
|
-
* rather than sliding out from behind it half-visible.
|
|
41
|
-
*
|
|
42
|
-
* A CSS length EXPRESSION, not a bare number, since the aspect-ratio panel
|
|
43
|
-
* (`w-[min(97vw,50dvh)]` + `aspect-[5/8]`) ranges from ~582px tall (mobile,
|
|
44
|
-
* width-bound) to 800px+ (desktop, height-bound) — a fixed 112px clearance
|
|
45
|
-
* tuned for the OLD fixed-520px panel left too little air under the orb on a
|
|
46
|
-
* tall one and too much on a short one. `max(112px, 19.24cqh)` is a floor, not
|
|
47
|
-
* a fixed value: it stays exactly 112px (today's tuned figure) on a short
|
|
48
|
-
* panel, where 19.24cqh would fall below it, and grows with `cqh` — the query
|
|
49
|
-
* container's own height, established by `[container-type:size]` on the
|
|
50
|
-
* panel div below — once the panel is tall enough that 19.24% of it exceeds
|
|
51
|
-
* 112px. `cqh` rather than `dvh` specifically: the panel's real rendered
|
|
52
|
-
* height, not the viewport's, since the panel does not always fill the
|
|
53
|
-
* viewport (mobile: width-bound, height is `w / (8/5)`, shorter than 100dvh).
|
|
54
|
-
*
|
|
55
|
-
* 19.24, not the 14 this shipped with: 14cqh gave a TALL panel proportionally
|
|
56
|
-
* LESS clearance than the 112px floor gives a short one (14% against 19.24%),
|
|
57
|
-
* which pushed the first message up into the narrowing part of the ellipse —
|
|
58
|
-
* see the ratio's own note above for the measurements. The floor and the
|
|
59
|
-
* scaling term now agree at 582px (19.24% of 582 = 111.98), so the two meet
|
|
60
|
-
* without a step rather than crossing over at some unrelated height.
|
|
61
|
-
*/
|
|
62
|
-
export declare const TRANSCRIPT_FADE_TOP_LEN = "max(112px, 19.24cqh)";
|
|
63
|
-
/**
|
|
64
|
-
* Top ramp when a `badge` sits above the transcript.
|
|
65
|
-
*
|
|
66
|
-
* A badge has ALREADY pushed the transcript clear of the orb, so reusing the
|
|
67
|
-
* orb-sized ramp charges for the same clearance twice: it left a 112px dead
|
|
68
|
-
* band directly under the badge and dissolved the opening message for no
|
|
69
|
-
* reason (measured in `WithABadgeAndNoVoice` — orb ends 565, badge 573-598,
|
|
70
|
-
* first message could not start above 710). At that point the fade is only
|
|
71
|
-
* doing its ordinary job of softening a scroll edge, so it wants an ordinary
|
|
72
|
-
* scroll-edge length. Same floor+`cqh` scheme as {@link TRANSCRIPT_FADE_TOP_LEN}
|
|
73
|
-
* above and for the same reason — this ramp needs to soften proportionally
|
|
74
|
-
* more of a tall panel's scroll edge than a short one's.
|
|
75
|
-
*
|
|
76
|
-
* The third arm is the ellipse, and it is what keeps this variant honest at
|
|
77
|
-
* sizes the badge's own fixed offsets stop covering. With a badge the first row
|
|
78
|
-
* is pushed down by chrome that does NOT scale — 1px surface border + 6px
|
|
79
|
-
* column padding + the badge wrapper's `mt-[104px]` + 4px list padding = 115px
|
|
80
|
-
* — so the row lands at `(115px + this ramp) / panelHeight`, a fraction that
|
|
81
|
-
* SHRINKS as the panel grows. `19.24cqh - 115px` is that equation solved for
|
|
82
|
-
* the ramp, so the row lands on the same point of the curve the no-badge
|
|
83
|
-
* variant does. It is inert on the panels this variant was tuned against
|
|
84
|
-
* (negative at 582px, 4.5px at 720px, so the other two arms win) and takes over
|
|
85
|
-
* only above ~745px, where the fixed 115px has stopped being enough.
|
|
86
|
-
*
|
|
87
|
-
* The badge's own height is counted as ZERO in that 115px, deliberately:
|
|
88
|
-
* `badge` is an arbitrary node from the host (`voice-widget.tsx` passes a
|
|
89
|
-
* one-line status pill, ~26px), and only the shortest-badge bound holds for
|
|
90
|
-
* every caller. A taller badge pushes the row further down, which is the safe
|
|
91
|
-
* direction.
|
|
92
|
-
*/
|
|
93
|
-
export declare const TRANSCRIPT_FADE_TOP_WITH_BADGE_LEN = "max(28px, 4cqh, 19.24cqh - 115px)";
|
|
94
|
-
export declare const TRANSCRIPT_FADE_BOTTOM_LEN = "max(118px, 20.27cqh)";
|
|
95
|
-
/**
|
|
96
|
-
* The transcript's horizontal inset — the width the ellipse actually costs.
|
|
97
|
-
*
|
|
98
|
-
* `10.6cqw` is where the curve is at the first row's height: on an ellipse of
|
|
99
|
-
* width `w`, at the fraction 0.1924 of the way down (the ratio the clearances
|
|
100
|
-
* above hold at every size), the left edge lies `w * (1 - sqrt(1 - (2*0.1924 -
|
|
101
|
-
* 1)^2)) / 2` = `0.1058 * w` in from the bounding box. Rounded up to 10.6% so
|
|
102
|
-
* the rounding goes toward clearance rather than away from it.
|
|
103
|
-
*
|
|
104
|
-
* `- 11px` because 11px of that is already paid for by fixed chrome outside
|
|
105
|
-
* this element: the surface's 1px border plus the inner column's `px-2.5`. The
|
|
106
|
-
* inset is measured from the PANEL's box, which is where the curve is; this
|
|
107
|
-
* padding only has to make up the difference. Verified live: a 363.8px-wide
|
|
108
|
-
* panel put the first bubble's left edge at 19px = 11px chrome + the 8px this
|
|
109
|
-
* replaces.
|
|
110
|
-
*
|
|
111
|
-
* The `8px` floor is the value this shipped with, kept as a lower bound so a
|
|
112
|
-
* degenerately small panel can never end up with less padding than a plain
|
|
113
|
-
* scroll edge wants. It is inert at every real size (the formula gives 27.6px
|
|
114
|
-
* on the smallest panel the widget renders).
|
|
115
|
-
*
|
|
116
|
-
* Symmetric on purpose, and applied as `padding-inline` so it stays symmetric
|
|
117
|
-
* in RTL: the ellipse is symmetric, the visitor's own bubbles are `justify-end`
|
|
118
|
-
* against the other side of it, and either side is the first row's side
|
|
119
|
-
* depending on who spoke.
|
|
120
|
-
*/
|
|
121
|
-
export declare const TRANSCRIPT_INSET_X = "max(8px, 10.6cqw - 11px)";
|
|
122
|
-
/**
|
|
123
|
-
* How far above the panel's BOTTOM the composer's text input ends, as a
|
|
124
|
-
* fraction of panel height — the composer's answer to
|
|
125
|
-
* {@link TRANSCRIPT_FADE_TOP_LEN}'s 19.24cqh, and the number
|
|
126
|
-
* {@link COMPOSER_MAX_WIDTH_LEN} is derived from.
|
|
127
|
-
*
|
|
128
|
-
* Read off the short panel exactly as the transcript's ratio was: 69px (the
|
|
129
|
-
* input's bottom edge on a 582px panel today — 1px surface border + the
|
|
130
|
-
* overlay's 6px `bottom-1.5` + the 62px microphone block) over 582px is
|
|
131
|
-
* 0.11856. Holding THAT ratio at every panel size is the whole repair: the
|
|
132
|
-
* composer's offsets are plain pixels (6px, and a 40px input over a 62px
|
|
133
|
-
* microphone block), so on a taller panel they place the input a SMALLER
|
|
134
|
-
* fraction of the way up from the tip — further into the narrowing curve — and
|
|
135
|
-
* no fixed width can be correct at two sizes at once. Pinned, one `cqw`
|
|
136
|
-
* expression serves every panel.
|
|
137
|
-
*
|
|
138
|
-
* Exported for the geometry test, which needs the fraction itself rather than
|
|
139
|
-
* either length below.
|
|
140
|
-
*/
|
|
141
|
-
export declare const COMPOSER_ROW_FRACTION = 0.1186;
|
|
142
|
-
/**
|
|
143
|
-
* The composer overlay's bottom offset when the microphone is drawn.
|
|
144
|
-
*
|
|
145
|
-
* `11.86cqh` is {@link COMPOSER_ROW_FRACTION} as a length. `- 63px` is
|
|
146
|
-
* everything between this offset and the input's bottom edge that does NOT
|
|
147
|
-
* scale: the surface's 1px border (the overlay is positioned against the inner
|
|
148
|
-
* column's padding box, one border inside the panel) plus the 62px microphone
|
|
149
|
-
* block — a 10px `gap-2.5`, the row's 4px `mt-1`, and a 48px `size-12` button.
|
|
150
|
-
*
|
|
151
|
-
* `max(6px, …)` keeps the 6px this shipped with as a floor, and the two arms
|
|
152
|
-
* MEET at the panel it was tuned on rather than crossing somewhere unrelated:
|
|
153
|
-
* `11.86cqh - 63px` is 6.03px at 582px, so a phone renders what it rendered
|
|
154
|
-
* before to a hundredth of a pixel and only larger panels lift the composer.
|
|
155
|
-
*/
|
|
156
|
-
export declare const COMPOSER_BOTTOM_LEN = "max(6px, 11.86cqh - 63px)";
|
|
157
|
-
/**
|
|
158
|
-
* The composer overlay's bottom offset when there is NO microphone.
|
|
159
|
-
*
|
|
160
|
-
* Same target row, minus only the 1px surface border: with `voice` omitted the
|
|
161
|
-
* overlay's last child IS the input, so the 62px the microphone block
|
|
162
|
-
* contributed above has to come from this offset instead. That is a real move —
|
|
163
|
-
* 6px to 68px on a phone — and it is the fix rather than a side effect. Left at
|
|
164
|
-
* 6px the input sits 7px off a `rounded-full` panel's bottom tip, where the
|
|
165
|
-
* ellipse offers 79px of width in total; no width cap can rescue that row, so
|
|
166
|
-
* the row itself has to come up to where the panel is wide enough to hold it.
|
|
167
|
-
*
|
|
168
|
-
* The band it moves into is the one the microphone would have occupied, which
|
|
169
|
-
* the transcript already clears ({@link TRANSCRIPT_FADE_BOTTOM_LEN} is sized
|
|
170
|
-
* for the input + microphone pair regardless of whether the pair is drawn), so
|
|
171
|
-
* nothing above has to move to make room.
|
|
172
|
-
*/
|
|
173
|
-
export declare const COMPOSER_BOTTOM_NO_VOICE_LEN = "max(6px, 11.86cqh - 1px)";
|
|
174
|
-
/**
|
|
175
|
-
* The composer's width cap — what the ellipse actually offers at that row.
|
|
176
|
-
*
|
|
177
|
-
* On an ellipse of width `w`, at the fraction `1 - 0.1186` of the way down, the
|
|
178
|
-
* full chord is `w * sqrt(1 - (2*0.8814 - 1)^2)` = `0.6465 * w`. So `64.65cqw`
|
|
179
|
-
* is not a taste-tuned percentage, it is the panel's own width at the row the
|
|
180
|
-
* two offsets above pin the input to — where `w-[71%]`, the class this caps,
|
|
181
|
-
* was 6.4% of the panel too wide at EVERY size (10.8px of overhang on a phone,
|
|
182
|
-
* 52.0px on a 920px panel, because the row also drifts lower as the panel
|
|
183
|
-
* grows).
|
|
184
|
-
*
|
|
185
|
-
* `- 10px` is clearance, 5px each side, matching the 5px the transcript's rows
|
|
186
|
-
* clear the curve by — the panel paints a 1.5px gradient ring plus a 1px
|
|
187
|
-
* surface border at that edge, and the input's own rounding means the arc, not
|
|
188
|
-
* the corner, is what approaches the curve.
|
|
189
|
-
*
|
|
190
|
-
* Applied as `max-width` over the existing `w-[71%]`, not in place of it: 71%
|
|
191
|
-
* stays the upper bound the composer had, and this only ever tightens it (the
|
|
192
|
-
* ellipse term is below 71% for any panel, since 0.6465 < 0.71). The `160px`
|
|
193
|
-
* floor is the "cap it sensibly" arm — it stops a degenerately small panel from
|
|
194
|
-
* resolving the composer to a few dozen pixels of unusable input, and it is
|
|
195
|
-
* inert at every size the widget really renders (it binds only below a 248px
|
|
196
|
-
* panel; the narrowest phone in circulation, 320px, gives 310px).
|
|
197
|
-
*/
|
|
198
|
-
export declare const COMPOSER_MAX_WIDTH_LEN = "max(160px, 64.65cqw - 10px)";
|
|
199
|
-
/**
|
|
200
|
-
* The opaque ground the composer sits on, which has to keep covering it.
|
|
201
|
-
*
|
|
202
|
-
* The transcript runs the panel's whole height and passes BEHIND this row, so
|
|
203
|
-
* this gradient is the only thing between a message and the input's own
|
|
204
|
-
* translucent chip fill. It was a fixed `h-[132px]`, tuned when the composer
|
|
205
|
-
* was pinned 6px off the bottom on every panel — and the moment the offsets
|
|
206
|
-
* above start lifting the composer on a tall panel, a fixed ground stops
|
|
207
|
-
* reaching its top edge (the composer's top is `11.86cqh + 40px` above the
|
|
208
|
-
* panel's bottom: 109px at 582px, but 149px at 920px, against 132px of ground).
|
|
209
|
-
*
|
|
210
|
-
* 22.68cqh is the same read-off-the-short-panel derivation as everything else
|
|
211
|
-
* here — 132/582 = 0.22680 — so a phone renders exactly the 132px it rendered
|
|
212
|
-
* before and the ground grows with the row it is under. It stays above the
|
|
213
|
-
* composer's own top at every size, and stays the same shade taller than the
|
|
214
|
-
* transcript's bottom clearance that it is today ({@link
|
|
215
|
-
* TRANSCRIPT_FADE_BOTTOM_LEN} is 20.27cqh against this 22.68cqh, exactly the
|
|
216
|
-
* 118:132 relationship the two were tuned at), so they still meet without a
|
|
217
|
-
* seam or a band of doubly-darkened panel.
|
|
218
|
-
*/
|
|
219
|
-
export declare const COMPOSER_GROUND_LEN = "max(132px, 22.68cqh)";
|
|
220
|
-
//# sourceMappingURL=transcript-geometry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-geometry.d.ts","sourceRoot":"","sources":["../src/transcript-geometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAC9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,kCAAkC,sCAAsC,CAAC;AAiBtF,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;AACjE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAqB7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAC5C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAC/D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AACvE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AACpE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,mBAAmB,yBAAyB,CAAC"}
|