@saar-ai/web-widget 0.6.1 → 0.8.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/chunks/{chat-tMKkYmTC.js → chat-e1afSRBr.js} +188 -3
- package/dist/chunks/{host-widget-CAPud_Jz.js → host-widget-Ce-l1xu1.js} +1760 -116
- package/dist/chunks/{schemas-Bl_6mxe4.js → schemas-D-uDc-9q.js} +164 -1
- package/dist/chunks/{telemetry-BI_SEWTb.js → telemetry-CBblNC6C.js} +1 -1
- package/dist/dock/dock-drag.d.ts +81 -0
- package/dist/dock/dock-drag.d.ts.map +1 -0
- package/dist/dock/dock-motion.d.ts +14 -0
- package/dist/dock/dock-motion.d.ts.map +1 -1
- package/dist/dock/dock-pill.d.ts +7 -2
- package/dist/dock/dock-pill.d.ts.map +1 -1
- package/dist/dock/dock-row.d.ts +13 -2
- package/dist/dock/dock-row.d.ts.map +1 -1
- package/dist/dock/dock-sheet.d.ts +11 -1
- package/dist/dock/dock-sheet.d.ts.map +1 -1
- package/dist/dock/dock-state.d.ts +41 -0
- package/dist/dock/dock-state.d.ts.map +1 -1
- package/dist/dock/dock.d.ts +64 -0
- package/dist/dock/dock.d.ts.map +1 -1
- package/dist/dock/geometry.d.ts +74 -2
- package/dist/dock/geometry.d.ts.map +1 -1
- package/dist/generated/widget-css.d.ts.map +1 -1
- package/dist/host-widget.d.ts +14 -2
- package/dist/host-widget.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/messages.d.ts +14 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/next/index.js +1 -1
- package/dist/styles.d.ts +3 -3
- package/dist/theme/derive.d.ts +1 -1
- package/dist/theme/derive.d.ts.map +1 -1
- package/dist/use-chat-session.d.ts +45 -1
- package/dist/use-chat-session.d.ts.map +1 -1
- package/dist/use-voice-session.d.ts +35 -0
- package/dist/use-voice-session.d.ts.map +1 -1
- package/dist/voice-widget.d.ts.map +1 -1
- package/dist/widget.css +1 -1
- package/package.json +3 -3
- package/src/styles/concierge.css +160 -7
- package/src/styles/tokens.css +6 -0
package/src/styles/concierge.css
CHANGED
|
@@ -797,10 +797,32 @@ label[for] {
|
|
|
797
797
|
pointer-events: auto;
|
|
798
798
|
font-family: var(--wgt-font);
|
|
799
799
|
color: var(--wgt-text);
|
|
800
|
-
transform
|
|
800
|
+
/* Two per-frame values on one `transform` (§7.1 rules 1 and 5): the
|
|
801
|
+
* keyboard offset (§8.2, continuous and unEASED) and §9.1's drag. Both are
|
|
802
|
+
* custom properties written straight onto this element, never React state,
|
|
803
|
+
* and neither ever touches a layout property. */
|
|
804
|
+
transform: translate(var(--wgt-drag-x, 0px), calc(-1 * var(--wgt-kb, 0px)));
|
|
801
805
|
contain: layout style;
|
|
802
806
|
}
|
|
803
807
|
|
|
808
|
+
/* §9.1 — the release SNAPS with §7.2's FLIP easing.
|
|
809
|
+
*
|
|
810
|
+
* On an attribute rather than on `.wgt-dock` itself, because `--wgt-kb` rides
|
|
811
|
+
* on the same `transform` and §7.2 gives the keyboard offset "continuous, no
|
|
812
|
+
* easing": a permanent transition here would ease every frame of a shopper
|
|
813
|
+
* typing on a phone. `dock-drag.ts` sets the attribute for the length of the
|
|
814
|
+
* settle and takes it off on the same fallback timer §7.1 rule 12 requires
|
|
815
|
+
* everywhere else. */
|
|
816
|
+
.wgt-dock[data-settling='true'] {
|
|
817
|
+
transition: transform var(--wgt-dur-swap, 240ms) cubic-bezier(0.2, 0, 0, 1);
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/* While the pointer is down the translate IS the position; easing it would
|
|
821
|
+
* make the dock lag the pointer. */
|
|
822
|
+
.wgt-dock[data-dragging='true'] {
|
|
823
|
+
transition: none;
|
|
824
|
+
}
|
|
825
|
+
|
|
804
826
|
.wgt-dock *,
|
|
805
827
|
.wgt-dock *::before,
|
|
806
828
|
.wgt-dock *::after {
|
|
@@ -819,7 +841,10 @@ label[for] {
|
|
|
819
841
|
height: var(--wgt-row-h, 48px);
|
|
820
842
|
padding: 0 8px;
|
|
821
843
|
border: 1px solid var(--wgt-border);
|
|
822
|
-
|
|
844
|
+
/* §2 (revised 2026-09-11) — ALWAYS a full pill, whatever `type.radius` says.
|
|
845
|
+
* `--wgt-radius` still shapes the sheet, the cards and the buttons; it
|
|
846
|
+
* stopped shaping the row, which is a bar and not a dialog. */
|
|
847
|
+
border-radius: var(--wgt-row-radius, 9999px);
|
|
823
848
|
background: var(--wgt-surface);
|
|
824
849
|
color: var(--wgt-text);
|
|
825
850
|
contain: layout style paint;
|
|
@@ -848,6 +873,72 @@ label[for] {
|
|
|
848
873
|
pointer-events: none;
|
|
849
874
|
}
|
|
850
875
|
|
|
876
|
+
/* §2 (revised 2026-09-11) — the row is ONE surface.
|
|
877
|
+
*
|
|
878
|
+
* On the first production pass the mark cell drew a vertical rule against the
|
|
879
|
+
* activity slot and the caption's `<input>` drew its own outlined field inside
|
|
880
|
+
* the row, so a bar the spec describes as four slots of one thing rendered as
|
|
881
|
+
* three boxes in a box. Nothing inside the row has an edge of its own: no
|
|
882
|
+
* border, no divider, no fill, no shadow. The row's own 1 px border is the
|
|
883
|
+
* only edge the shopper ever sees, and §1 rule 5 is what it is for.
|
|
884
|
+
*
|
|
885
|
+
* A descendant rule rather than four class rules, so a slot added later
|
|
886
|
+
* inherits the ruling instead of rediscovering it. It is deliberately not
|
|
887
|
+
* `all: unset`: the slots' own layout (`flex`, `min-width`) is theirs. */
|
|
888
|
+
.wgt-row > *,
|
|
889
|
+
.wgt-row > * > * {
|
|
890
|
+
border: none;
|
|
891
|
+
box-shadow: none;
|
|
892
|
+
background: transparent;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/* §11 — the CAPTION FIELD's focus ring belongs to the ROW.
|
|
896
|
+
*
|
|
897
|
+
* A ring on `.wgt-input` is the outlined box this change removed, in another
|
|
898
|
+
* spelling: the caption is not a separate control the shopper focuses, it is
|
|
899
|
+
* the row's own line, so the row is what draws the ring.
|
|
900
|
+
*
|
|
901
|
+
* `:has(.wgt-input:focus-visible)` and NOT a bare `:focus-within`, which was
|
|
902
|
+
* the first spelling and was wrong in both directions. `:focus-within`
|
|
903
|
+
* matches on any focusable descendant, and the row is four slots of buttons:
|
|
904
|
+
* a shopper who mouse-clicked mute during a call left that button focused
|
|
905
|
+
* and the whole 48 px row ringed for the rest of the call, and a shopper who
|
|
906
|
+
* tabbed to the mic got two concentric rings 2 px apart — the control's own,
|
|
907
|
+
* from the rule below, and the row's. `:focus-visible` carries the UA's
|
|
908
|
+
* mouse-versus-keyboard heuristic, which is the whole point of the rule
|
|
909
|
+
* below; `:focus-within` has no such thing. A text field still matches
|
|
910
|
+
* `:focus-visible` when clicked with a mouse, so the field keeps the ring it
|
|
911
|
+
* should have had all along. */
|
|
912
|
+
.wgt-row:has(.wgt-input:focus-visible) {
|
|
913
|
+
outline: 2px solid var(--wgt-ring);
|
|
914
|
+
outline-offset: 2px;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/* §3.3 (revised 2026-09-11) — the sheet sits FLUSH on the row, so the two
|
|
918
|
+
* corners they share are square.
|
|
919
|
+
*
|
|
920
|
+
* A STATIC swap, driven by `data-sheet`, and never a transition: §7.1 rule 1
|
|
921
|
+
* allows `transform`, `opacity` and `clip-path` and nothing else, and
|
|
922
|
+
* `border-radius` is a paint on every frame it changes. (The alternative
|
|
923
|
+
* considered was overlaying the sheet's square bottom over the row's top half,
|
|
924
|
+
* which is compositor-only too — and hides the top half of a 48 px row whose
|
|
925
|
+
* caption, mark and controls all live there.) The radius therefore snaps in
|
|
926
|
+
* the frame the sheet's own `clip-path` reveal begins, under the sheet's
|
|
927
|
+
* leading edge, where there is nothing yet to see it move. */
|
|
928
|
+
.wgt-row[data-sheet='open'] {
|
|
929
|
+
border-start-start-radius: 0;
|
|
930
|
+
border-start-end-radius: 0;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/* §9.1 `layout.draggable` — §7.1 rule 8's `touch-action: none` on the HANDLE
|
|
934
|
+
* only. The handle is the mark cell; on the rest of the row it would kill the
|
|
935
|
+
* caption's own text selection and the browser's scroll. */
|
|
936
|
+
.wgt-row[data-draggable='true'] .wgt-mark,
|
|
937
|
+
.wgt-pill[data-draggable='true'] {
|
|
938
|
+
touch-action: none;
|
|
939
|
+
cursor: grab;
|
|
940
|
+
}
|
|
941
|
+
|
|
851
942
|
.wgt-mark {
|
|
852
943
|
flex: 0 0 auto;
|
|
853
944
|
display: flex;
|
|
@@ -975,7 +1066,16 @@ label[for] {
|
|
|
975
1066
|
flex: 1 1 auto;
|
|
976
1067
|
min-width: 0;
|
|
977
1068
|
height: 44px;
|
|
1069
|
+
/* Every way a browser can draw a box around a text field, refused
|
|
1070
|
+
* explicitly — §2's "no internal borders". `appearance` is the one that
|
|
1071
|
+
* actually bit: iOS Safari and some Android WebViews paint a UA field
|
|
1072
|
+
* chrome that `border: none` alone does not remove, which is what put an
|
|
1073
|
+
* outlined box inside the row on the live tenant. */
|
|
1074
|
+
appearance: none;
|
|
1075
|
+
-webkit-appearance: none;
|
|
978
1076
|
border: none;
|
|
1077
|
+
border-radius: 0;
|
|
1078
|
+
box-shadow: none;
|
|
979
1079
|
outline: none;
|
|
980
1080
|
background: transparent;
|
|
981
1081
|
color: var(--wgt-text);
|
|
@@ -1079,10 +1179,11 @@ label[for] {
|
|
|
1079
1179
|
cursor: default;
|
|
1080
1180
|
}
|
|
1081
1181
|
|
|
1182
|
+
/* The input is NOT in this list — its ring is the row's (`:focus-within`
|
|
1183
|
+
* above). Every other control keeps its own. */
|
|
1082
1184
|
.wgt-control:focus-visible,
|
|
1083
1185
|
.wgt-mark:focus-visible,
|
|
1084
1186
|
.wgt-pill:focus-visible,
|
|
1085
|
-
.wgt-input:focus-visible,
|
|
1086
1187
|
.wgt-sheet-handle:focus-visible {
|
|
1087
1188
|
outline: 2px solid var(--wgt-ring);
|
|
1088
1189
|
outline-offset: 2px;
|
|
@@ -1113,7 +1214,8 @@ label[for] {
|
|
|
1113
1214
|
max-width: calc(100% - 20px);
|
|
1114
1215
|
padding: 0 14px 0 8px;
|
|
1115
1216
|
border: 1px solid var(--wgt-border);
|
|
1116
|
-
|
|
1217
|
+
/* §2 — the pill is the row's resting form and wears the row's radius. */
|
|
1218
|
+
border-radius: var(--wgt-row-radius, 9999px);
|
|
1117
1219
|
background: var(--wgt-surface);
|
|
1118
1220
|
color: var(--wgt-text);
|
|
1119
1221
|
-webkit-text-fill-color: var(--wgt-text);
|
|
@@ -1172,7 +1274,10 @@ label[for] {
|
|
|
1172
1274
|
|
|
1173
1275
|
.wgt-sheet {
|
|
1174
1276
|
position: absolute;
|
|
1175
|
-
|
|
1277
|
+
/* §3.3 (revised 2026-09-11) — FLUSH on the row: `SHEET_GAP` is 0
|
|
1278
|
+
* (`dock/geometry.ts`), and the 8 px that used to be here read as two
|
|
1279
|
+
* unrelated boxes stacked on the merchant's page. */
|
|
1280
|
+
bottom: var(--wgt-row-h, 48px);
|
|
1176
1281
|
inset-inline: var(--wgt-row-margin, 0px);
|
|
1177
1282
|
display: flex;
|
|
1178
1283
|
flex-direction: column;
|
|
@@ -1182,8 +1287,12 @@ label[for] {
|
|
|
1182
1287
|
* tenant's `--wgt-radius` belongs to the row, the pill and the controls; a
|
|
1183
1288
|
* `pill` tenant's 9999px on a full-width sheet is an ellipse, not a corner. */
|
|
1184
1289
|
border-radius: var(--wgt-sheet-radius, 12px) var(--wgt-sheet-radius, 12px) 0 0;
|
|
1185
|
-
/* §7.1 rule 11
|
|
1186
|
-
|
|
1290
|
+
/* §3.3 / §7.1 rule 11 (both revised 2026-09-11) — the sheet is TRANSLUCENT:
|
|
1291
|
+
* the tenant's surface at 92 %, over the hairline above. A token rather
|
|
1292
|
+
* than `opacity`, which would fade the shopper's own words and the prices
|
|
1293
|
+
* with it. The fallback is the opaque surface, for a browser that never
|
|
1294
|
+
* received the token (the console preview before its first derive). */
|
|
1295
|
+
background: var(--wgt-surface-glass, var(--wgt-surface));
|
|
1187
1296
|
contain: layout style paint;
|
|
1188
1297
|
/* §7.2 — laid out ONCE at its final height, then revealed with `clip-path`.
|
|
1189
1298
|
* Animating the height would be a layout per frame; this is a clip. */
|
|
@@ -1484,6 +1593,50 @@ label[for] {
|
|
|
1484
1593
|
transform: scaleX(-1);
|
|
1485
1594
|
}
|
|
1486
1595
|
|
|
1596
|
+
/* §3.3 / §7.1 rule 11 — a STATIC blur behind the sheet, on a pointer that can
|
|
1597
|
+
* afford it.
|
|
1598
|
+
*
|
|
1599
|
+
* `pointer: fine` is a proxy for "not a phone": a full-surface backdrop blur
|
|
1600
|
+
* is the one paint a mid-range Android cannot do for free, and §1 rule 8 says
|
|
1601
|
+
* mobile is the case this widget is designed for. Mobile gets the 92 % alpha
|
|
1602
|
+
* and nothing else, which is the whole effect minus the expensive half.
|
|
1603
|
+
*
|
|
1604
|
+
* Rule 11 forbids ANIMATED blur, and this never animates: it is not in any
|
|
1605
|
+
* transition list, not in any keyframe, and `tools/check-widget-motion.mjs`
|
|
1606
|
+
* (whose own suite pins exactly this distinction) is what keeps it that way.
|
|
1607
|
+
* Declaring it on the sheet unconditionally would be the mistake — a
|
|
1608
|
+
* `backdrop-filter` on an element whose `clip-path` is animating is a re-blur
|
|
1609
|
+
* per frame even with nothing blurring. The sheet's reveal clips a surface
|
|
1610
|
+
* that was already blurred; the filter itself stands still. */
|
|
1611
|
+
@supports (backdrop-filter: blur(16px)) {
|
|
1612
|
+
@media (pointer: fine) {
|
|
1613
|
+
.wgt-sheet {
|
|
1614
|
+
/* STANDARD PROPERTY ONLY — do not add `-webkit-backdrop-filter` here.
|
|
1615
|
+
*
|
|
1616
|
+
* Lightning CSS (Tailwind v4's minifier) models the prefixed alias as
|
|
1617
|
+
* the SAME property carrying a vendor-prefix flag, so a hand-written
|
|
1618
|
+
* `-webkit-backdrop-filter` AFTER this line replaces it rather than
|
|
1619
|
+
* supplementing it, and the compiled bundle ships the WebKit-only
|
|
1620
|
+
* alias alone. Chrome has never recognised that alias, so it drops the
|
|
1621
|
+
* declaration at parse time and the rule arrives EMPTY — which is what
|
|
1622
|
+
* shipped until 2026-09-11, giving every desktop Chrome shopper a flat
|
|
1623
|
+
* sheet with the storefront's product grid legible through it.
|
|
1624
|
+
*
|
|
1625
|
+
* Left alone, the pipeline prefixes this from its own browser targets
|
|
1626
|
+
* and emits both spellings. `concierge-css.test.ts` asserts that on the
|
|
1627
|
+
* COMPILED output, which is the only place the difference shows. */
|
|
1628
|
+
backdrop-filter: blur(16px);
|
|
1629
|
+
/* Only NOW is 92 % safe. The `@supports` gate is doing real work: the
|
|
1630
|
+
* alpha and the blur are one decision, so the surface may only get
|
|
1631
|
+
* thinner where the blur is actually going to be painted. Anywhere else
|
|
1632
|
+
* — a coarse pointer, a browser without the filter, a future refactor
|
|
1633
|
+
* that moves this rule — the sheet keeps `--wgt-surface-glass`'s 97 %,
|
|
1634
|
+
* which is legible unaided. See `theme/derive.ts`. */
|
|
1635
|
+
background: var(--wgt-surface-glass-blurred, var(--wgt-surface-glass, var(--wgt-surface)));
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1487
1640
|
/* §7.1 rule 10 — reduced motion wins. Durations are also zeroed in JS
|
|
1488
1641
|
* (`dock-motion.ts`), so this is the belt to that braces: a stylesheet loaded
|
|
1489
1642
|
* without the React dock still respects it. */
|
package/src/styles/tokens.css
CHANGED
|
@@ -104,11 +104,14 @@
|
|
|
104
104
|
--wgt-accent: #191525;
|
|
105
105
|
--wgt-surface: #ffffff;
|
|
106
106
|
--wgt-surface-2: #f0efef;
|
|
107
|
+
--wgt-surface-glass: rgb(255 255 255 / 0.97);
|
|
108
|
+
--wgt-surface-glass-blurred: rgb(255 255 255 / 0.92);
|
|
107
109
|
--wgt-text: #1c1618;
|
|
108
110
|
--wgt-text-muted: rgb(28 22 24 / 0.62);
|
|
109
111
|
--wgt-border: rgb(28 22 24 / 0.12);
|
|
110
112
|
--wgt-ring: #111827;
|
|
111
113
|
--wgt-radius: 12px;
|
|
114
|
+
--wgt-row-radius: 9999px;
|
|
112
115
|
--wgt-sheet-radius: 12px;
|
|
113
116
|
--wgt-card-radius: 12px;
|
|
114
117
|
--wgt-font: inherit;
|
|
@@ -122,11 +125,14 @@
|
|
|
122
125
|
--wgt-accent: #191525;
|
|
123
126
|
--wgt-surface: #141414;
|
|
124
127
|
--wgt-surface-2: #1f1f1f;
|
|
128
|
+
--wgt-surface-glass: rgb(20 20 20 / 0.97);
|
|
129
|
+
--wgt-surface-glass-blurred: rgb(20 20 20 / 0.92);
|
|
125
130
|
--wgt-text: #fbf2f5;
|
|
126
131
|
--wgt-text-muted: rgb(251 242 245 / 0.62);
|
|
127
132
|
--wgt-border: rgb(251 242 245 / 0.12);
|
|
128
133
|
--wgt-ring: #5a6376;
|
|
129
134
|
--wgt-radius: 12px;
|
|
135
|
+
--wgt-row-radius: 9999px;
|
|
130
136
|
--wgt-sheet-radius: 12px;
|
|
131
137
|
--wgt-card-radius: 12px;
|
|
132
138
|
--wgt-font: inherit;
|