@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.
Files changed (68) 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/chat-tMKkYmTC.js +592 -0
  4. package/dist/chunks/host-widget-C0XT9lHX.js +9637 -0
  5. package/dist/chunks/{telemetry-Bw-3F_Zk.js → telemetry-BI_SEWTb.js} +104 -2
  6. package/dist/dock/dock-caption.d.ts +67 -0
  7. package/dist/dock/dock-caption.d.ts.map +1 -0
  8. package/dist/dock/dock-motion.d.ts +155 -0
  9. package/dist/dock/dock-motion.d.ts.map +1 -0
  10. package/dist/dock/dock-pill.d.ts +38 -0
  11. package/dist/dock/dock-pill.d.ts.map +1 -0
  12. package/dist/dock/dock-row.d.ts +120 -0
  13. package/dist/dock/dock-row.d.ts.map +1 -0
  14. package/dist/dock/dock-sheet.d.ts +89 -0
  15. package/dist/dock/dock-sheet.d.ts.map +1 -0
  16. package/dist/dock/dock-shelf.d.ts +38 -0
  17. package/dist/dock/dock-shelf.d.ts.map +1 -0
  18. package/dist/dock/dock-state.d.ts +221 -0
  19. package/dist/dock/dock-state.d.ts.map +1 -0
  20. package/dist/dock/dock.d.ts +344 -0
  21. package/dist/dock/dock.d.ts.map +1 -0
  22. package/dist/dock/geometry.d.ts +161 -0
  23. package/dist/dock/geometry.d.ts.map +1 -0
  24. package/dist/format-money.d.ts +54 -17
  25. package/dist/format-money.d.ts.map +1 -1
  26. package/dist/generated/widget-css.d.ts.map +1 -1
  27. package/dist/host-widget.d.ts +156 -16
  28. package/dist/host-widget.d.ts.map +1 -1
  29. package/dist/index.d.ts +7 -3
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +4029 -7
  32. package/dist/messages.d.ts +86 -0
  33. package/dist/messages.d.ts.map +1 -1
  34. package/dist/next/index.js +1 -1
  35. package/dist/session-log.d.ts +7 -0
  36. package/dist/session-log.d.ts.map +1 -1
  37. package/dist/session-panel.d.ts +13 -3
  38. package/dist/session-panel.d.ts.map +1 -1
  39. package/dist/theme/color.d.ts +114 -0
  40. package/dist/theme/color.d.ts.map +1 -0
  41. package/dist/theme/derive.d.ts +92 -0
  42. package/dist/theme/derive.d.ts.map +1 -0
  43. package/dist/theme/index.d.ts +10 -0
  44. package/dist/theme/index.d.ts.map +1 -0
  45. package/dist/turn-order.d.ts +106 -0
  46. package/dist/turn-order.d.ts.map +1 -0
  47. package/dist/use-chat-session.d.ts +146 -17
  48. package/dist/use-chat-session.d.ts.map +1 -1
  49. package/dist/use-voice-session.d.ts +110 -4
  50. package/dist/use-voice-session.d.ts.map +1 -1
  51. package/dist/voice-widget.d.ts +114 -24
  52. package/dist/voice-widget.d.ts.map +1 -1
  53. package/dist/widget-cards.d.ts +28 -1
  54. package/dist/widget-cards.d.ts.map +1 -1
  55. package/dist/widget.css +1 -1
  56. package/package.json +4 -4
  57. package/src/styles/concierge.css +803 -28
  58. package/src/styles/tokens.css +67 -0
  59. package/dist/chunks/chat-DfajYOmN.js +0 -240
  60. package/dist/chunks/host-widget-C9EyGeiN.js +0 -9745
  61. package/dist/concierge-launcher.d.ts +0 -53
  62. package/dist/concierge-launcher.d.ts.map +0 -1
  63. package/dist/concierge-shell.d.ts +0 -256
  64. package/dist/concierge-shell.d.ts.map +0 -1
  65. package/dist/position.d.ts +0 -65
  66. package/dist/position.d.ts.map +0 -1
  67. package/dist/transcript-geometry.d.ts +0 -220
  68. package/dist/transcript-geometry.d.ts.map +0 -1
@@ -80,19 +80,20 @@
80
80
  }
81
81
  }
82
82
 
83
+ /* The glow itself is a STATIC `box-shadow` on the element (see `bot-face.tsx`);
84
+ * only its intensity moves, and it moves on `opacity` and `transform` alone.
85
+ * It used to animate the shadow's blur and spread, which repaints the whole
86
+ * layer on every frame of someone else's storefront — DOCK_SPEC §7.1 rule 1,
87
+ * enforced by `tools/check-widget-motion.mjs`. */
83
88
  @keyframes pulse-glow {
84
89
  0%,
85
90
  100% {
86
91
  opacity: 0.8;
87
- box-shadow:
88
- 0 0 8px color-mix(in oklab, var(--brand-amber) 45%, transparent),
89
- 0 0 3px color-mix(in oklab, var(--brand-amber) 30%, transparent);
92
+ transform: scaleY(1);
90
93
  }
91
94
  50% {
92
95
  opacity: 1;
93
- box-shadow:
94
- 0 0 14px color-mix(in oklab, var(--brand-amber) 60%, transparent),
95
- 0 0 6px color-mix(in oklab, var(--brand-amber) 35%, transparent);
96
+ transform: scaleY(1.35);
96
97
  }
97
98
  }
98
99
 
@@ -120,23 +121,31 @@
120
121
  }
121
122
  }
122
123
 
124
+ /* The expanding ring is drawn by a dedicated overlay element carrying a
125
+ * static `ring-2` (`bot-face.tsx`, `bot-state.ts`), so the pulse is that
126
+ * element growing and fading rather than a `box-shadow` spread animated per
127
+ * frame. Same picture, no repaint — DOCK_SPEC §7.1 rule 1. */
123
128
  @keyframes bot-ring-speak {
124
129
  0%,
125
130
  100% {
126
- box-shadow: 0 0 0 0 color-mix(in oklab, var(--brand-amber) 35%, transparent);
131
+ opacity: 0.9;
132
+ transform: scale(1);
127
133
  }
128
134
  50% {
129
- box-shadow: 0 0 0 6px color-mix(in oklab, var(--brand-amber) 0%, transparent);
135
+ opacity: 0;
136
+ transform: scale(1.09);
130
137
  }
131
138
  }
132
139
 
133
140
  @keyframes bot-ring-listen {
134
141
  0%,
135
142
  100% {
136
- box-shadow: 0 0 0 0 color-mix(in oklab, var(--brand-rose) 35%, transparent);
143
+ opacity: 0.9;
144
+ transform: scale(1);
137
145
  }
138
146
  50% {
139
- box-shadow: 0 0 0 8px color-mix(in oklab, var(--brand-rose) 0%, transparent);
147
+ opacity: 0;
148
+ transform: scale(1.12);
140
149
  }
141
150
  }
142
151
 
@@ -253,24 +262,6 @@
253
262
  }
254
263
  }
255
264
 
256
- /* Widget open transition ---------------------------------------------- */
257
- @keyframes widget-portal {
258
- 0% {
259
- opacity: 0.75;
260
- transform: scale(1);
261
- filter: blur(0px);
262
- }
263
- 100% {
264
- opacity: 0;
265
- transform: scale(10);
266
- filter: blur(10px);
267
- }
268
- }
269
-
270
- .widget-portal {
271
- animation: widget-portal 700ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
272
- }
273
-
274
265
  /* Scroll containers inside the widget hide their scrollbar but keep
275
266
  * scrolling. The panel is a compact overlay on someone else's page: a
276
267
  * visible bar eats a meaningful slice of its width and reads as host-page
@@ -285,6 +276,51 @@
285
276
  display: none;
286
277
  }
287
278
 
279
+ /* The product carousel's scrollbar, which is an AFFORDANCE on a mouse and
280
+ * clutter on a touchscreen (SAA-148).
281
+ *
282
+ * The carousel shipped with `.no-scrollbar`, on the reasoning that
283
+ * "`snap-mandatory` + native touch scrolling is the whole interaction" and
284
+ * that the next card peeking at the edge is the scroll affordance. That holds
285
+ * on a phone. On a desktop with a mouse there is no touch gesture, a vertical
286
+ * wheel does not scroll a horizontal container, and the scrollbar was hidden —
287
+ * so there was no way at all to reach the cards past the first. A shopper on
288
+ * Windows Chrome said exactly that, mid-conversation, with three carpets
289
+ * delivered and two of them unreachable: "I am unable to scroll and see the
290
+ * options u shared".
291
+ *
292
+ * So: visible by default, hidden only where a coarse pointer means the user
293
+ * can swipe. The thumb is deliberately quiet — this sits under a row of
294
+ * product cards inside a chat bubble, not on a document. */
295
+ .card-carousel {
296
+ scrollbar-width: thin;
297
+ scrollbar-color: rgb(0 0 0 / 0.25) transparent;
298
+ }
299
+ .card-carousel::-webkit-scrollbar {
300
+ height: 6px;
301
+ }
302
+ .card-carousel::-webkit-scrollbar-track {
303
+ background: transparent;
304
+ }
305
+ .card-carousel::-webkit-scrollbar-thumb {
306
+ background: rgb(0 0 0 / 0.25);
307
+ border-radius: 9999px;
308
+ }
309
+ .dark .card-carousel {
310
+ scrollbar-color: rgb(255 255 255 / 0.3) transparent;
311
+ }
312
+ .dark .card-carousel::-webkit-scrollbar-thumb {
313
+ background: rgb(255 255 255 / 0.3);
314
+ }
315
+ @media (pointer: coarse) {
316
+ .card-carousel {
317
+ scrollbar-width: none;
318
+ }
319
+ .card-carousel::-webkit-scrollbar {
320
+ display: none;
321
+ }
322
+ }
323
+
288
324
  /* Tailwind v4's preflight dropped v3's `button { cursor: pointer }`. The
289
325
  * embed never loads the console's shared base layer (`@wesence/ui`'s
290
326
  * globals.css, which restores the affordance for the apps), so the widget
@@ -726,3 +762,742 @@ label[for] {
726
762
  animation: none;
727
763
  }
728
764
  }
765
+
766
+ /* ═══════════════════════════════════════════════════════════════════════════
767
+ * THE DOCK — docs/DOCK_SPEC.md §2, §3, §7.
768
+ *
769
+ * Plain CSS, never Tailwind utilities, and that is deliberate. The dock is
770
+ * drawn TWICE: `cdn/dock-dom.ts` paints the resting row and the pill in the
771
+ * `core` stage with inline styles and no stylesheet at all, and the React
772
+ * dock (`src/dock/*`) takes over the same geometry one frame later (§4.2).
773
+ * Utilities would put the two renderers' declarations in different orders
774
+ * with different specificity, which is exactly how an invisible handover
775
+ * becomes a visible jump. Every LENGTH here comes from `dock/geometry.ts`'s
776
+ * custom properties and every COLOUR from `theme/derive.ts`'s `--wgt-*`, so
777
+ * neither renderer owns a number of its own.
778
+ *
779
+ * §7.1 rule 1 — only `transform`, `opacity` and `clip-path` are ever
780
+ * transitioned or keyframed below. `tools/check-widget-motion.mjs` fails the
781
+ * build on anything else, and `border-color` (a paint on one element, not a
782
+ * layout) is named explicitly rather than reached through `transition: all`.
783
+ * ═══════════════════════════════════════════════════════════════════════════ */
784
+
785
+ /* The fixed container. Its own `bottom` deliberately EXCLUDES the keyboard
786
+ * term — that rides on `translateY` instead, because `bottom` is a layout
787
+ * property and a per-frame `--wgt-kb` inside it costs the MERCHANT's document
788
+ * a layout on every frame while the shopper types (§7.2, §8.2). */
789
+ .wgt-dock {
790
+ position: fixed;
791
+ z-index: var(--wgt-z, 2147483000);
792
+ /* `core.ts`'s shadow HOST is `pointer-events: none` so it never blocks a
793
+ * click on the merchant's page. That is an INHERITED property, so the dock
794
+ * has to opt back in explicitly or it renders and is unclickable by a real
795
+ * pointer — a jsdom `.click()` calls the handler directly and never catches
796
+ * this. */
797
+ pointer-events: auto;
798
+ font-family: var(--wgt-font);
799
+ color: var(--wgt-text);
800
+ transform: translateY(calc(-1 * var(--wgt-kb, 0px)));
801
+ contain: layout style;
802
+ }
803
+
804
+ .wgt-dock *,
805
+ .wgt-dock *::before,
806
+ .wgt-dock *::after {
807
+ box-sizing: border-box;
808
+ }
809
+
810
+ /* ── The row (§2, §3.1) ─────────────────────────────────────────────────── */
811
+
812
+ .wgt-row {
813
+ position: absolute;
814
+ bottom: 0;
815
+ inset-inline: var(--wgt-row-margin, 0px);
816
+ display: flex;
817
+ align-items: center;
818
+ gap: 8px;
819
+ height: var(--wgt-row-h, 48px);
820
+ padding: 0 8px;
821
+ border: 1px solid var(--wgt-border);
822
+ border-radius: var(--wgt-radius);
823
+ background: var(--wgt-surface);
824
+ color: var(--wgt-text);
825
+ contain: layout style paint;
826
+ /* `visibility` is in the list on purpose — see `.wgt-pill` below for the
827
+ * whole of why, and for why it is a duration rather than a delay. Without
828
+ * it the row disappears at frame 0 of its own fade and §7.2's cross-fade
829
+ * plays with nothing on the outgoing side. */
830
+ transition:
831
+ border-color var(--wgt-dur-border, 160ms) linear,
832
+ transform var(--wgt-dur-swap, 240ms) cubic-bezier(0.2, 0, 0, 1),
833
+ opacity var(--wgt-dur-swap, 240ms) cubic-bezier(0.2, 0, 0, 1),
834
+ visibility var(--wgt-dur-swap, 240ms) linear;
835
+ }
836
+
837
+ /* §1 rule 5 — the ONLY chrome that changes. A primary border means the audio
838
+ * channel is open, and the mark's accessible name says the same thing in
839
+ * words (§11), so colour never carries the only copy of a state. */
840
+ .wgt-row[data-border='primary'] {
841
+ border-color: var(--wgt-primary);
842
+ }
843
+
844
+ .wgt-row[data-form='pill'] {
845
+ opacity: 0;
846
+ transform: scale(0.98);
847
+ visibility: hidden;
848
+ pointer-events: none;
849
+ }
850
+
851
+ .wgt-mark {
852
+ flex: 0 0 auto;
853
+ display: flex;
854
+ align-items: center;
855
+ justify-content: center;
856
+ min-width: 44px;
857
+ min-height: 44px;
858
+ border: none;
859
+ background: transparent;
860
+ padding: 0;
861
+ color: inherit;
862
+ cursor: pointer;
863
+ }
864
+
865
+ .wgt-mark-face {
866
+ display: flex;
867
+ align-items: center;
868
+ justify-content: center;
869
+ flex: 0 0 auto;
870
+ width: var(--wgt-mark-size, 32px);
871
+ height: var(--wgt-mark-size, 32px);
872
+ border-radius: 9999px;
873
+ overflow: hidden;
874
+ transition: opacity var(--wgt-dur-border, 160ms) linear;
875
+ }
876
+
877
+ /* §2 — state as a TREATMENT, not a colour swap: full when live, 55 % when
878
+ * dormant, ducked, muted or reconnecting. */
879
+ .wgt-mark-face[data-mark='dimmed'] {
880
+ opacity: 0.55;
881
+ }
882
+
883
+ .wgt-mark-img {
884
+ width: 100%;
885
+ height: 100%;
886
+ object-fit: cover;
887
+ }
888
+
889
+ .wgt-mark-visor {
890
+ display: block;
891
+ width: 56%;
892
+ height: 25%;
893
+ border-radius: 9999px;
894
+ background: var(--wgt-primary);
895
+ }
896
+
897
+ .wgt-mark-dot {
898
+ display: block;
899
+ width: 37.5%;
900
+ height: 37.5%;
901
+ border-radius: 9999px;
902
+ background: var(--wgt-primary);
903
+ }
904
+
905
+ /* An `image` avatar cannot carry an animated treatment, so it gets a state
906
+ * RING instead (§2). Drawn with `outline`, never `box-shadow`: it is static,
907
+ * and nothing here ever animates it. */
908
+ .wgt-mark-face[data-avatar='image'][data-mark='live'] {
909
+ outline: 2px solid var(--wgt-primary);
910
+ outline-offset: 1px;
911
+ }
912
+
913
+ /* ── The activity slot (§2) ─────────────────────────────────────────────── */
914
+
915
+ .wgt-activity {
916
+ flex: 0 0 auto;
917
+ display: flex;
918
+ align-items: center;
919
+ justify-content: center;
920
+ gap: 2px;
921
+ width: 20px;
922
+ height: 20px;
923
+ }
924
+
925
+ .wgt-bar {
926
+ width: 2px;
927
+ height: 100%;
928
+ border-radius: 1px;
929
+ background: var(--wgt-primary);
930
+ /* §7.2 — five bars, `scaleY(var(--wgt-level-n))`, values written per frame
931
+ * by the analyser with a 0.25 lerp. No transition: the value IS the
932
+ * animation, and a transition on top of a per-frame write only adds lag. */
933
+ transform: scaleY(var(--wgt-level, 0.15));
934
+ transform-origin: center;
935
+ }
936
+
937
+ .wgt-progress {
938
+ width: 100%;
939
+ height: 2px;
940
+ border-radius: 1px;
941
+ background: var(--wgt-surface-2);
942
+ overflow: hidden;
943
+ }
944
+
945
+ .wgt-progress::after {
946
+ content: '';
947
+ display: block;
948
+ width: 40%;
949
+ height: 100%;
950
+ border-radius: 1px;
951
+ background: var(--wgt-primary);
952
+ animation: wgt-progress 1.1s ease-in-out infinite;
953
+ }
954
+
955
+ @keyframes wgt-progress {
956
+ 0% {
957
+ transform: translateX(-100%);
958
+ }
959
+ 100% {
960
+ transform: translateX(350%);
961
+ }
962
+ }
963
+
964
+ /* ── The caption (§2, §5.2 — the caption IS the field) ──────────────────── */
965
+
966
+ .wgt-caption {
967
+ position: relative;
968
+ flex: 1 1 auto;
969
+ min-width: 0;
970
+ display: flex;
971
+ align-items: center;
972
+ }
973
+
974
+ .wgt-input {
975
+ flex: 1 1 auto;
976
+ min-width: 0;
977
+ height: 44px;
978
+ border: none;
979
+ outline: none;
980
+ background: transparent;
981
+ color: var(--wgt-text);
982
+ -webkit-text-fill-color: var(--wgt-text);
983
+ font-size: 15px;
984
+ font-family: inherit;
985
+ }
986
+
987
+ .wgt-input::placeholder {
988
+ color: var(--wgt-text-muted);
989
+ }
990
+
991
+ /* The status line is LAYERED OVER the field rather than written into it: a
992
+ * caption is ours and a draft is the shopper's, and overwriting a half-typed
993
+ * question with our own copy is the one thing this slot must never do. */
994
+ .wgt-line {
995
+ position: absolute;
996
+ inset-inline: 0;
997
+ font-size: 15px;
998
+ line-height: 44px;
999
+ color: var(--wgt-text);
1000
+ overflow: hidden;
1001
+ text-overflow: ellipsis;
1002
+ white-space: nowrap;
1003
+ pointer-events: none;
1004
+ }
1005
+
1006
+ /* §7.2 — caption swap: cross-fade + translateY(±4px), 160 ms. KEYFRAMES, not
1007
+ * a transition: both layers MOUNT at the moment of the swap (see
1008
+ * `dock-caption.tsx`), and a transition does not run on a freshly-mounted
1009
+ * element — it would give a fade-out that never happens and a fade-in that
1010
+ * appears instantly. `transform` and `opacity` only, per §7.1 rule 1. */
1011
+ .wgt-line[data-phase='in'] {
1012
+ animation: wgt-caption-in var(--wgt-dur-caption, 160ms) ease;
1013
+ }
1014
+
1015
+ .wgt-line[data-phase='out'] {
1016
+ animation: wgt-caption-out var(--wgt-dur-caption, 160ms) ease forwards;
1017
+ }
1018
+
1019
+ @keyframes wgt-caption-in {
1020
+ from {
1021
+ opacity: 0;
1022
+ transform: translateY(4px);
1023
+ }
1024
+ to {
1025
+ opacity: 1;
1026
+ transform: translateY(0);
1027
+ }
1028
+ }
1029
+
1030
+ @keyframes wgt-caption-out {
1031
+ from {
1032
+ opacity: 1;
1033
+ transform: translateY(0);
1034
+ }
1035
+ to {
1036
+ opacity: 0;
1037
+ transform: translateY(-4px);
1038
+ }
1039
+ }
1040
+
1041
+ .wgt-caption[data-mode='line'] .wgt-input {
1042
+ /* Still focusable and still carrying the draft — just not the thing being
1043
+ * read while a status line owns the slot. */
1044
+ opacity: 0;
1045
+ }
1046
+
1047
+ /* ── Controls (§2 — never more than three, each ≥ 44 px) ────────────────── */
1048
+
1049
+ .wgt-controls {
1050
+ flex: 0 0 auto;
1051
+ display: flex;
1052
+ align-items: center;
1053
+ }
1054
+
1055
+ .wgt-control {
1056
+ display: inline-flex;
1057
+ align-items: center;
1058
+ justify-content: center;
1059
+ gap: 6px;
1060
+ min-width: 44px;
1061
+ min-height: 44px;
1062
+ padding: 0 6px;
1063
+ border: none;
1064
+ background: transparent;
1065
+ color: var(--wgt-text);
1066
+ -webkit-text-fill-color: var(--wgt-text);
1067
+ font: inherit;
1068
+ font-size: 13px;
1069
+ text-transform: var(--wgt-caps);
1070
+ cursor: pointer;
1071
+ /* §7.2 — control in/out: scale(0.8 → 1) + opacity, 120 ms. */
1072
+ transition:
1073
+ transform var(--wgt-dur-control, 120ms) ease,
1074
+ opacity var(--wgt-dur-control, 120ms) ease;
1075
+ }
1076
+
1077
+ .wgt-control:disabled {
1078
+ opacity: 0.4;
1079
+ cursor: default;
1080
+ }
1081
+
1082
+ .wgt-control:focus-visible,
1083
+ .wgt-mark:focus-visible,
1084
+ .wgt-pill:focus-visible,
1085
+ .wgt-input:focus-visible,
1086
+ .wgt-sheet-handle:focus-visible {
1087
+ outline: 2px solid var(--wgt-ring);
1088
+ outline-offset: 2px;
1089
+ }
1090
+
1091
+ .wgt-control[data-control='mute'][aria-pressed='true'] {
1092
+ color: var(--wgt-primary);
1093
+ -webkit-text-fill-color: var(--wgt-primary);
1094
+ }
1095
+
1096
+ /* ── The pill (§3.2) ───────────────────────────────────────────────────── */
1097
+
1098
+ .wgt-pill {
1099
+ position: absolute;
1100
+ bottom: 0;
1101
+ /* §3.2/§8.9 — the thumb edge. PHYSICAL properties, deliberately: the mirror
1102
+ * decision is `pillAnchor`'s (`dock/geometry.ts`), which mirrors on mobile
1103
+ * and does not on desktop, and writing it once there beats writing it twice
1104
+ * here. */
1105
+ left: var(--wgt-pill-left, auto);
1106
+ right: var(--wgt-pill-right, 16px);
1107
+ display: flex;
1108
+ align-items: center;
1109
+ gap: 8px;
1110
+ height: var(--wgt-pill-h, 44px);
1111
+ min-width: 44px;
1112
+ min-height: 44px;
1113
+ max-width: calc(100% - 20px);
1114
+ padding: 0 14px 0 8px;
1115
+ border: 1px solid var(--wgt-border);
1116
+ border-radius: var(--wgt-radius);
1117
+ background: var(--wgt-surface);
1118
+ color: var(--wgt-text);
1119
+ -webkit-text-fill-color: var(--wgt-text);
1120
+ /* §9.1 `type.caps` — §11 calls the pill "one `<button>`", and it is the
1121
+ * most-seen button on the merchant's page. A tenant on `caps: buttons`
1122
+ * whose controls came out uppercase beside a mixed-case launcher would have
1123
+ * the one button everybody sees disagreeing with every other one. */
1124
+ text-transform: var(--wgt-caps, none);
1125
+ cursor: pointer;
1126
+ contain: layout style paint;
1127
+ /* §7.2 — "FLIP … on outgoing and incoming with CROSS-FADE", and `visibility`
1128
+ * is what makes the outgoing half of it exist.
1129
+ *
1130
+ * The form that is leaving needs `visibility: hidden` at the end: it has to
1131
+ * drop out of the accessibility tree, the tab order and hit-testing, and it
1132
+ * cannot use `display: none` for that — that would cancel the transition
1133
+ * outright and reflow the row inside the merchant's document. But
1134
+ * `visibility` left out of THIS list applies at frame 0, so the pill is
1135
+ * gone before its own fade begins and the shopper sees the incoming form
1136
+ * appear over empty space. Half a cross-fade reads as a flicker.
1137
+ *
1138
+ * A DURATION rather than the `visibility 0s linear <dur>` delay idiom,
1139
+ * because CSS Transitions interpolates this property specially: every
1140
+ * timing-function output strictly between 0 and 1 maps to `visible`. One
1141
+ * entry therefore holds the box painted for the whole fade OUT and flips it
1142
+ * at the start of the fade IN — the delay idiom needs two different values
1143
+ * in two different rules to say the same thing, and gets the incoming
1144
+ * direction wrong the moment one of them is forgotten.
1145
+ *
1146
+ * It costs a repaint and a hit-test change on one element and never a
1147
+ * layout (a hidden box keeps its space), which is why
1148
+ * `tools/check-widget-motion.mjs` allows it by name alongside
1149
+ * `border-color`. */
1150
+ transition:
1151
+ transform var(--wgt-dur-swap, 240ms) cubic-bezier(0.2, 0, 0, 1),
1152
+ opacity var(--wgt-dur-swap, 240ms) cubic-bezier(0.2, 0, 0, 1),
1153
+ visibility var(--wgt-dur-swap, 240ms) linear;
1154
+ }
1155
+
1156
+ .wgt-pill[data-form='row'] {
1157
+ opacity: 0;
1158
+ transform: scale(0.92);
1159
+ visibility: hidden;
1160
+ pointer-events: none;
1161
+ }
1162
+
1163
+ .wgt-pill-label {
1164
+ font-size: 14px;
1165
+ font-weight: 500;
1166
+ overflow: hidden;
1167
+ text-overflow: ellipsis;
1168
+ white-space: nowrap;
1169
+ }
1170
+
1171
+ /* ── The sheet (§3.3) ──────────────────────────────────────────────────── */
1172
+
1173
+ .wgt-sheet {
1174
+ position: absolute;
1175
+ bottom: calc(var(--wgt-row-h, 48px) + 8px);
1176
+ inset-inline: var(--wgt-row-margin, 0px);
1177
+ display: flex;
1178
+ flex-direction: column;
1179
+ max-height: var(--wgt-sheet-max-h);
1180
+ border: 1px solid var(--wgt-border);
1181
+ /* §3.3 — the SHEET's own radius, capped at 20 px by `theme/derive.ts`. The
1182
+ * tenant's `--wgt-radius` belongs to the row, the pill and the controls; a
1183
+ * `pill` tenant's 9999px on a full-width sheet is an ellipse, not a corner. */
1184
+ border-radius: var(--wgt-sheet-radius, 12px) var(--wgt-sheet-radius, 12px) 0 0;
1185
+ /* §7.1 rule 11 — no blur. The sheet is opaque `--wgt-surface`. */
1186
+ background: var(--wgt-surface);
1187
+ contain: layout style paint;
1188
+ /* §7.2 — laid out ONCE at its final height, then revealed with `clip-path`.
1189
+ * Animating the height would be a layout per frame; this is a clip. */
1190
+ transform: translateY(var(--wgt-sheet-y, 0px));
1191
+ /* `visibility` for the same reason as the pill's — and here it is the whole
1192
+ * of §7.2's "Sheet close | reverse of open | 180 ms". The closed sheet is
1193
+ * `visibility: hidden` so a shopper tabbing through the merchant's page
1194
+ * never lands inside a transcript that is not on screen; unlisted, that
1195
+ * applies at frame 0 and the close is a hard cut with a clip-path animating
1196
+ * behind it. The `[data-snap='closed']` rule below re-times the whole list
1197
+ * at once with a single `transition-duration`, so the visibility step lands
1198
+ * with the close's 180 ms rather than the open's 240 ms. */
1199
+ transition:
1200
+ clip-path var(--wgt-dur-sheet, 240ms) cubic-bezier(0.2, 0, 0, 1),
1201
+ transform var(--wgt-dur-sheet, 240ms) cubic-bezier(0.2, 0, 0, 1),
1202
+ opacity var(--wgt-dur-sheet, 240ms) cubic-bezier(0.2, 0, 0, 1),
1203
+ visibility var(--wgt-dur-sheet, 240ms) linear;
1204
+ }
1205
+
1206
+ .wgt-sheet[data-snap='closed'] {
1207
+ clip-path: inset(100% 0 0 0);
1208
+ transform: translateY(8px);
1209
+ opacity: 0;
1210
+ visibility: hidden;
1211
+ pointer-events: none;
1212
+ transition-duration: var(--wgt-dur-sheet-close, 180ms);
1213
+ transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
1214
+ }
1215
+
1216
+ .wgt-sheet[data-snap='peek'],
1217
+ .wgt-sheet[data-snap='expanded'] {
1218
+ clip-path: inset(0 0 0 0);
1219
+ opacity: 1;
1220
+ }
1221
+
1222
+ .wgt-sheet[data-snap='peek'] {
1223
+ max-height: min(var(--wgt-sheet-max-h), var(--wgt-sheet-peek, 260px));
1224
+ }
1225
+
1226
+ .wgt-sheet[data-dragging='true'] {
1227
+ transition: none;
1228
+ }
1229
+
1230
+ /* §7.1 rule 8 — the drag uses pointer events, and `touch-action: none` is on
1231
+ * the HANDLE only. On the sheet body it would kill the internal scroll the
1232
+ * shopper needs. */
1233
+ .wgt-sheet-handle {
1234
+ position: relative;
1235
+ flex: 0 0 auto;
1236
+ display: flex;
1237
+ align-items: center;
1238
+ justify-content: center;
1239
+ min-height: 24px;
1240
+ padding: 8px 0 4px;
1241
+ border: none;
1242
+ background: transparent;
1243
+ cursor: grab;
1244
+ touch-action: none;
1245
+ }
1246
+
1247
+ /* §2 — every control is ≥ 44 px to the thumb, and the handle IS a control:
1248
+ * it drags the sheet and a tap on it toggles the snap.
1249
+ *
1250
+ * The BOX stays 24 px, which is the right visual weight — the grip is a
1251
+ * 36 x 4 px bar, and 44 px of dead space at the top of the sheet pushes the
1252
+ * content the sheet exists to show below the fold. The target is this
1253
+ * pseudo-element instead, and it grows DOWNWARDS: upwards it would be clipped
1254
+ * by `.wgt-sheet`'s own `contain: paint`, which is an overflow clip for
1255
+ * hit-testing as much as for painting. The header and the body sit above it
1256
+ * (below), so the strip it adds can never swallow a press meant for
1257
+ * "Minimise" or for a card. */
1258
+ .wgt-sheet-handle::before {
1259
+ content: '';
1260
+ position: absolute;
1261
+ inset-inline: 0;
1262
+ top: 0;
1263
+ height: 44px;
1264
+ }
1265
+
1266
+ .wgt-sheet-grip {
1267
+ display: block;
1268
+ width: 36px;
1269
+ height: 4px;
1270
+ border-radius: 9999px;
1271
+ background: var(--wgt-border);
1272
+ }
1273
+
1274
+ .wgt-sheet-header {
1275
+ /* Above the handle's hit area (`.wgt-sheet-handle::before`) — a press on
1276
+ * "Minimise" is a press on "Minimise". */
1277
+ position: relative;
1278
+ z-index: 1;
1279
+ flex: 0 0 auto;
1280
+ display: flex;
1281
+ align-items: center;
1282
+ justify-content: flex-end;
1283
+ gap: 8px;
1284
+ padding: 0 12px 4px;
1285
+ }
1286
+
1287
+ .wgt-sheet-body {
1288
+ /* As `.wgt-sheet-header` — above the handle's hit area. */
1289
+ position: relative;
1290
+ z-index: 1;
1291
+ flex: 1 1 auto;
1292
+ min-height: 0;
1293
+ overflow-y: auto;
1294
+ /* §3.3 — a scroll that reaches the end must not become a scroll of the
1295
+ * merchant's page underneath it. */
1296
+ overscroll-behavior: contain;
1297
+ scrollbar-gutter: stable;
1298
+ padding: 0 12px 12px;
1299
+ }
1300
+
1301
+ .wgt-sheet-action {
1302
+ border: none;
1303
+ /* A chip inside the sheet takes the CARD radius, not the tenant's — see
1304
+ * `.wgt-sheet` above. It carries the focus ring's shape even though the
1305
+ * button itself is transparent. */
1306
+ border-radius: var(--wgt-card-radius, 12px);
1307
+ background: transparent;
1308
+ color: var(--wgt-text-muted);
1309
+ -webkit-text-fill-color: var(--wgt-text-muted);
1310
+ font: inherit;
1311
+ font-size: 13px;
1312
+ /* §11 — "every control ≥ 44 px", and that is a BOX, not a height. A short
1313
+ * localised label ("סגור", "закрыть") makes a 30 px-wide target out of a
1314
+ * 44 px-tall rule, which is the same miss the height was there to prevent. */
1315
+ min-height: 44px;
1316
+ min-width: 44px;
1317
+ padding: 0 6px;
1318
+ text-transform: var(--wgt-caps);
1319
+ cursor: pointer;
1320
+ }
1321
+
1322
+ /* ── Transcript rows (§7.1 rule 3) ─────────────────────────────────────── */
1323
+
1324
+ /*
1325
+ * Every row of the transcript — a turn and everything hanging off it, a
1326
+ * handoff divider, the human-operator typing bubble. A long conversation is
1327
+ * the one part of this UI with no upper bound on its size, and without this
1328
+ * the sheet re-lays-out and re-paints a hundred off-screen turns on every
1329
+ * streamed token. `content-visibility: auto` lets the browser skip the ones
1330
+ * outside the scrollport; `contain-intrinsic-size: auto <n>` gives it a size
1331
+ * to reserve, and the `auto` keyword makes it REMEMBER the real size once a
1332
+ * row has been rendered, so scrolling back up does not jump.
1333
+ *
1334
+ * The padding is not decoration and must not be removed. `content-visibility`
1335
+ * turns on PAINT containment — always, not only while a row is skipped — which
1336
+ * clips anything a descendant draws outside its own box: the agent bubble's
1337
+ * `ring-1` hairline, a card's shadow, and (the one that would be a defect
1338
+ * rather than a blemish) the 2 px focus outline with its 2 px offset on a
1339
+ * focusable card inside a turn. 4 px is that outline's reach.
1340
+ *
1341
+ * Both axes give the 4 px back, so the row a reader sees is the row that was
1342
+ * there before: the transcript's container spends 4 px LESS between rows
1343
+ * (`gap-1` where it used to be `space-y-3`, which keeps two turns 12 px
1344
+ * apart), and `margin-inline: -4px` puts the bubbles back where the sheet
1345
+ * body's own 12 px of horizontal padding had them. The negative margin cannot
1346
+ * overflow that padding — 12 > 4 — so the sheet gains no horizontal scroll.
1347
+ */
1348
+ .wgt-turn-row {
1349
+ content-visibility: auto;
1350
+ contain-intrinsic-size: auto 64px;
1351
+ padding: 4px;
1352
+ margin-inline: -4px;
1353
+ }
1354
+
1355
+ /* ── The shelf (§3.4) ──────────────────────────────────────────────────── */
1356
+
1357
+ .wgt-shelf {
1358
+ display: grid;
1359
+ gap: 8px;
1360
+ /* Mobile: full-width rows. Desktop overrides to 3-up below. */
1361
+ grid-template-columns: 1fr;
1362
+ margin: 0;
1363
+ padding: 0;
1364
+ list-style: none;
1365
+ }
1366
+
1367
+ .wgt-dock[data-viewport='desktop'] .wgt-shelf {
1368
+ grid-template-columns: repeat(3, minmax(0, 1fr));
1369
+ }
1370
+
1371
+ .wgt-shelf-row {
1372
+ display: flex;
1373
+ /* §7.1 rule 3 — a long shelf costs nothing to lay out off-screen. */
1374
+ content-visibility: auto;
1375
+ contain-intrinsic-size: auto 72px;
1376
+ }
1377
+
1378
+ /* The card is the whole row's hit target when it links to a PDP, and an inert
1379
+ * wrapper when it does not — same box either way, so a linked and an unlinked
1380
+ * card differ only by the cursor. `color: inherit` and no underline because a
1381
+ * merchant's own `a { color: blue }` cannot reach in here, but the UA's can. */
1382
+ .wgt-shelf-card {
1383
+ display: flex;
1384
+ align-items: center;
1385
+ gap: 10px;
1386
+ min-width: 0;
1387
+ flex: 1 1 auto;
1388
+ min-height: 44px;
1389
+ color: inherit;
1390
+ text-decoration: none;
1391
+ }
1392
+
1393
+ .wgt-dock[data-viewport='desktop'] .wgt-shelf-card {
1394
+ flex-direction: column;
1395
+ align-items: stretch;
1396
+ }
1397
+
1398
+ /* §7.1 rule 7 — a fixed box, so a slow or oversized image can never shift the
1399
+ * shelf's layout. */
1400
+ .wgt-shelf-image {
1401
+ flex: 0 0 auto;
1402
+ /* §9.1 `cards.imageAspect`, and §7.1 rule 7's "fixed box".
1403
+ *
1404
+ * The box is sized from the ASPECT rather than from two fixed lengths so a
1405
+ * merchant whose catalogue was shot portrait gets portrait thumbnails. The
1406
+ * height is the constant on a mobile row — 64 px is what keeps three rows
1407
+ * inside a peek sheet — and the width follows the ratio; on desktop the
1408
+ * column width is the constant and the height follows. Either way the box
1409
+ * is known before the image loads, which is the whole of rule 7. */
1410
+ height: 64px;
1411
+ width: auto;
1412
+ aspect-ratio: var(--wgt-card-aspect, 1 / 1);
1413
+ /* §3.3 — the CARD radius, capped at 12 px. Half of a `pill` tenant's
1414
+ * 9999px is still a circle; a product thumbnail is not a badge. */
1415
+ border-radius: var(--wgt-card-radius, 12px);
1416
+ background: var(--wgt-surface-2);
1417
+ object-fit: cover;
1418
+ }
1419
+
1420
+ .wgt-dock[data-viewport='desktop'] .wgt-shelf-image {
1421
+ width: 100%;
1422
+ height: auto;
1423
+ }
1424
+
1425
+ .wgt-shelf-text {
1426
+ min-width: 0;
1427
+ display: flex;
1428
+ flex-direction: column;
1429
+ gap: 2px;
1430
+ }
1431
+
1432
+ .wgt-shelf-title {
1433
+ font-size: 14px;
1434
+ font-weight: 500;
1435
+ overflow: hidden;
1436
+ text-overflow: ellipsis;
1437
+ white-space: nowrap;
1438
+ }
1439
+
1440
+ .wgt-shelf-price {
1441
+ font-size: 13px;
1442
+ color: var(--wgt-text-muted);
1443
+ }
1444
+
1445
+ .wgt-shelf-reason {
1446
+ font-size: 12px;
1447
+ color: var(--wgt-text-muted);
1448
+ overflow: hidden;
1449
+ text-overflow: ellipsis;
1450
+ white-space: nowrap;
1451
+ }
1452
+
1453
+ .wgt-shelf-more {
1454
+ display: inline-flex;
1455
+ align-items: center;
1456
+ /* §11's 44 px is a box — see `.wgt-sheet-action`. "See all 4" is short in
1457
+ * English and shorter in several of the locales we ship. */
1458
+ min-height: 44px;
1459
+ min-width: 44px;
1460
+ justify-content: center;
1461
+ font-size: 13px;
1462
+ color: var(--wgt-primary);
1463
+ -webkit-text-fill-color: var(--wgt-primary);
1464
+ text-decoration: none;
1465
+ }
1466
+
1467
+ /* ── §11 — the live region. Announced, never seen. ─────────────────────── */
1468
+
1469
+ .wgt-sr {
1470
+ position: absolute;
1471
+ width: 1px;
1472
+ height: 1px;
1473
+ margin: -1px;
1474
+ padding: 0;
1475
+ overflow: hidden;
1476
+ clip: rect(0, 0, 0, 0);
1477
+ white-space: nowrap;
1478
+ border: 0;
1479
+ }
1480
+
1481
+ /* §8.9 — the row mirrors with LOGICAL properties, and the two icons that
1482
+ * point somewhere mirror with it. Nothing here uses `left`/`right`. */
1483
+ .wgt-dock[dir='rtl'] .wgt-icon-directional {
1484
+ transform: scaleX(-1);
1485
+ }
1486
+
1487
+ /* §7.1 rule 10 — reduced motion wins. Durations are also zeroed in JS
1488
+ * (`dock-motion.ts`), so this is the belt to that braces: a stylesheet loaded
1489
+ * without the React dock still respects it. */
1490
+ @media (prefers-reduced-motion: reduce) {
1491
+ .wgt-row,
1492
+ .wgt-pill,
1493
+ .wgt-sheet,
1494
+ .wgt-control,
1495
+ .wgt-mark-face {
1496
+ transition-duration: 0ms !important;
1497
+ }
1498
+
1499
+ .wgt-line,
1500
+ .wgt-progress::after {
1501
+ animation: none;
1502
+ }
1503
+ }