@saar-ai/web-widget 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/card-aspect.d.ts +58 -0
  2. package/dist/card-aspect.d.ts.map +1 -0
  3. package/dist/chunks/{host-widget-B0SkhMIs.js → host-widget-CAPud_Jz.js} +4609 -5776
  4. package/dist/chunks/{telemetry-Bw-3F_Zk.js → telemetry-BI_SEWTb.js} +104 -2
  5. package/dist/dock/dock-caption.d.ts +67 -0
  6. package/dist/dock/dock-caption.d.ts.map +1 -0
  7. package/dist/dock/dock-motion.d.ts +270 -0
  8. package/dist/dock/dock-motion.d.ts.map +1 -0
  9. package/dist/dock/dock-pill.d.ts +38 -0
  10. package/dist/dock/dock-pill.d.ts.map +1 -0
  11. package/dist/dock/dock-row.d.ts +120 -0
  12. package/dist/dock/dock-row.d.ts.map +1 -0
  13. package/dist/dock/dock-sheet.d.ts +89 -0
  14. package/dist/dock/dock-sheet.d.ts.map +1 -0
  15. package/dist/dock/dock-shelf.d.ts +38 -0
  16. package/dist/dock/dock-shelf.d.ts.map +1 -0
  17. package/dist/dock/dock-state.d.ts +221 -0
  18. package/dist/dock/dock-state.d.ts.map +1 -0
  19. package/dist/dock/dock.d.ts +344 -0
  20. package/dist/dock/dock.d.ts.map +1 -0
  21. package/dist/dock/geometry.d.ts +161 -0
  22. package/dist/dock/geometry.d.ts.map +1 -0
  23. package/dist/dock/motion-gate.d.ts +123 -0
  24. package/dist/dock/motion-gate.d.ts.map +1 -0
  25. package/dist/generated/widget-css.d.ts.map +1 -1
  26. package/dist/host-widget.d.ts +94 -16
  27. package/dist/host-widget.d.ts.map +1 -1
  28. package/dist/index.d.ts +7 -3
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +4029 -7
  31. package/dist/messages.d.ts +69 -0
  32. package/dist/messages.d.ts.map +1 -1
  33. package/dist/next/index.js +1 -1
  34. package/dist/session-log.d.ts +7 -0
  35. package/dist/session-log.d.ts.map +1 -1
  36. package/dist/session-panel.d.ts +13 -3
  37. package/dist/session-panel.d.ts.map +1 -1
  38. package/dist/theme/color.d.ts +114 -0
  39. package/dist/theme/color.d.ts.map +1 -0
  40. package/dist/theme/derive.d.ts +92 -0
  41. package/dist/theme/derive.d.ts.map +1 -0
  42. package/dist/theme/index.d.ts +10 -0
  43. package/dist/theme/index.d.ts.map +1 -0
  44. package/dist/use-chat-session.d.ts +18 -16
  45. package/dist/use-chat-session.d.ts.map +1 -1
  46. package/dist/use-voice-session.d.ts +79 -3
  47. package/dist/use-voice-session.d.ts.map +1 -1
  48. package/dist/voice-widget.d.ts +49 -19
  49. package/dist/voice-widget.d.ts.map +1 -1
  50. package/dist/widget-cards.d.ts +28 -1
  51. package/dist/widget-cards.d.ts.map +1 -1
  52. package/dist/widget.css +1 -1
  53. package/package.json +4 -4
  54. package/src/styles/concierge.css +758 -28
  55. package/src/styles/tokens.css +67 -0
  56. package/dist/concierge-launcher.d.ts +0 -53
  57. package/dist/concierge-launcher.d.ts.map +0 -1
  58. package/dist/concierge-shell.d.ts +0 -256
  59. package/dist/concierge-shell.d.ts.map +0 -1
  60. package/dist/position.d.ts +0 -65
  61. package/dist/position.d.ts.map +0 -1
  62. package/dist/transcript-geometry.d.ts +0 -220
  63. package/dist/transcript-geometry.d.ts.map +0 -1
@@ -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"}