@artooi/ag-ui-web-component 0.48.0 → 0.50.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 (40) hide show
  1. package/CHANGELOG.md +192 -1
  2. package/README.md +70 -7
  3. package/dist/ag-ui-web-component.bundle.js +171 -107
  4. package/dist/ag-ui-web-component.bundle.js.map +3 -3
  5. package/dist/core/ag_ui_chat.d.ts +8 -2
  6. package/dist/core/ag_ui_chat.d.ts.map +1 -1
  7. package/dist/index.js +591 -82
  8. package/dist/index.js.map +3 -3
  9. package/dist/tools/chat_surface_tools.d.ts +8 -5
  10. package/dist/tools/chat_surface_tools.d.ts.map +1 -1
  11. package/dist/ui/placement/dock_styles.d.ts.map +1 -1
  12. package/dist/ui/placement/panel_placement.d.ts +18 -1
  13. package/dist/ui/placement/panel_placement.d.ts.map +1 -1
  14. package/dist/ui/placement/surface_for.d.ts +15 -6
  15. package/dist/ui/placement/surface_for.d.ts.map +1 -1
  16. package/dist/ui/progress/tool_group_styles.d.ts.map +1 -1
  17. package/dist/ui/shell/frame_styles.d.ts.map +1 -1
  18. package/dist/ui/shell/token_styles.d.ts.map +1 -1
  19. package/dist/ui/themes/classic_tokens.d.ts.map +1 -1
  20. package/dist/ui/themes/ledger_styles.d.ts.map +1 -1
  21. package/dist/ui/themes/ledger_tokens.d.ts.map +1 -1
  22. package/dist/ui/themes/quiet_styles.d.ts.map +1 -1
  23. package/dist/ui/themes/soft_styles.d.ts.map +1 -1
  24. package/dist/ui/themes/soft_tokens.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/core/ag_ui_chat.ts +56 -8
  27. package/src/tools/chat_surface_tools.ts +11 -10
  28. package/src/ui/placement/dock_styles.ts +5 -1
  29. package/src/ui/placement/panel_placement.ts +587 -82
  30. package/src/ui/placement/surface_for.ts +33 -8
  31. package/src/ui/progress/tool_group_styles.ts +3 -2
  32. package/src/ui/shell/frame_styles.ts +22 -2
  33. package/src/ui/shell/token_styles.ts +31 -0
  34. package/src/ui/themes/classic_tokens.ts +1 -0
  35. package/src/ui/themes/ledger_styles.ts +4 -3
  36. package/src/ui/themes/ledger_tokens.ts +1 -0
  37. package/src/ui/themes/quiet_styles.ts +6 -3
  38. package/src/ui/themes/soft_styles.ts +4 -3
  39. package/src/ui/themes/soft_tokens.ts +1 -0
  40. package/src/version.ts +1 -1
@@ -21,12 +21,15 @@ export interface ChatSurfaceReport {
21
21
  /** Whether the panel can be moved, or the placement owns its position. */
22
22
  readonly movable: boolean;
23
23
  /**
24
- * Whether this page allows the panel to be moved at all.
24
+ * Whether this page allows the panel to be moved at all: true for every
25
+ * placement unless the host set `data-launcher-drag="false"`. It is the
26
+ * page's setting alone and does not vary with the placement or `collapse-to`;
27
+ * whether this panel moves is {@link ChatSurfaceReport.movable}.
25
28
  *
26
- * Reported apart from {@link ChatSurfaceReport.movable} only because the two
27
- * reasons a move is refused call for different sentences: a host that turned
28
- * dragging off is not the placement owning the position, and telling the
29
- * user the second when the first is true is a plain falsehood.
29
+ * Reported apart from `movable` only because the two reasons a move is
30
+ * refused call for different sentences: a host that turned dragging off is
31
+ * not the placement owning the position, and telling the user the second
32
+ * when the first is true is a plain falsehood.
30
33
  */
31
34
  readonly draggable: boolean;
32
35
  /** Whether the panel currently covers the whole viewport. */
@@ -1 +1 @@
1
- {"version":3,"file":"chat_surface_tools.d.ts","sourceRoot":"","sources":["../../src/tools/chat_surface_tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,kFAAkF;AAClF,eAAO,MAAM,YAAY,YAAI,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,CAAU,CAAC;AAE9F,yCAAyC;AACzC,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,oEAAo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CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,CAAC;IACF;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,UAAU,CAE/D;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,eAAe,IAAI,iBAAiB,CAAC;IACrC;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC;IAC/E,YAAY,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CACnF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,EAAE,CA4GzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"dock_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/placement/dock_styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,EAAE,MAsFzB,CAAC"}
1
+ {"version":3,"file":"dock_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/placement/dock_styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,EAAE,MA0FzB,CAAC"}
@@ -62,6 +62,11 @@ export declare class PanelPlacement {
62
62
  * Drop the dragged size and its stored copy, so the placement's own size and
63
63
  * the host's tokens apply again. For a host entering a sized state of its
64
64
  * own, which a user's drag would otherwise outrank.
65
+ *
66
+ * A docked panel the user dragged off its dock goes back to it as well, and
67
+ * the stored spot with it: there the position is part of the same resting
68
+ * state the host is asking for. A corner panel keeps a dragged position, as
69
+ * it always has.
65
70
  */
66
71
  resetSize(): void;
67
72
  /**
@@ -75,7 +80,9 @@ export declare class PanelPlacement {
75
80
  *
76
81
  * Read from the stamp the drag helpers already set, rather than tracked
77
82
  * separately: one source of truth, and it clears on `pointercancel` as well
78
- * as `pointerup`, which is the end a touch gesture usually gets.
83
+ * as `pointerup`, which is the end a touch gesture usually gets. The one
84
+ * gesture that stamps nothing is an arrow key on a grip, which applies a box
85
+ * per key and states it only when the key comes up, hence #resizing.
79
86
  */
80
87
  dragging(): boolean;
81
88
  /** The report behind `AgUiChat.describeSurface`, whose doc is the contract. */
@@ -124,8 +131,18 @@ export declare class PanelPlacement {
124
131
  * whenever the window resizes, and before an expand. The viewport that
125
132
  * stored a position may since have shrunk, and a launcher past the edge is
126
133
  * unreachable -- it is the only way back to a collapsed conversation.
134
+ *
135
+ * The one gate on whether a stored position is this element's to honour: the
136
+ * gestures check their own before they ever reach the placing below.
127
137
  */
128
138
  restoreLauncherPosition(): void;
139
+ /**
140
+ * Re-apply it for a change in the panel's own layout, which needs no window or
141
+ * reopen to happen: a line typed in the composer is one. A position waiting to
142
+ * be handed back under data-launcher-drag="false" waits on, because a panel that leaves for the
143
+ * host's corner as the reader starts typing is a jump with no cause they can see.
144
+ */
145
+ settleLauncherPosition(): void;
129
146
  /**
130
147
  * Give the position back to the host when the new placement owns it, the way
131
148
  * releaseOwnedAxes gives back a size. Without this a dragged inset survives
@@ -1 +1 @@
1
- {"version":3,"file":"panel_placement.d.ts","sourceRoot":"","sources":["../../../src/ui/placement/panel_placement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,iBA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8BnC;IAED,oEAAoE;IACpE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,GAAE;QAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAmDjF;IAqJD,sEAAsE;IACtE,gBAAgB,IAAI,IAAI,CAavB;IAsDD;;;;;;OAMG;IACH,gBAAgB,IAAI,IAAI,CAQvB;IAiBD;;;;;;;;;OASG;IACH,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CA8BzD;IA2LD;;;;;;;;;;;;OAYG;IACH,qBAAqB,IAAI,IAAI,CAgD5B;IAyQD;;;;;;;;OAQG;IACH,uBAAuB,IAAI,IAAI,CAG9B;IAED;;;;;OAKG;IACH,sBAAsB,IAAI,IAAI,CAG7B;IAsJD;;;;OAIG;IACH,uBAAuB,IAAI,IAAI,CAY9B;CAyJF"}
@@ -37,10 +37,18 @@ export interface Surface {
37
37
  readonly collapseTo: CollapseTarget;
38
38
  /**
39
39
  * Whether a gesture may move the launcher. The rest have nowhere to put it:
40
- * the rail is a docked edge, `header` and `null` have no launcher, and a
41
- * full-bleed panel covers the screen it would be opening into.
40
+ * the rail is a docked edge, `header` and `null` have no launcher, a
41
+ * full-bleed panel covers the screen it would be opening into, and the bar
42
+ * and the host's own control are not a launcher at all.
42
43
  */
43
44
  readonly launcherDraggable: boolean;
45
+ /**
46
+ * Whether the header drag and `moveTo` may move the open panel. The same
47
+ * answer as {@link launcherDraggable} for every placement on its own; the two
48
+ * part under `collapse-to="bar"` and `"none"`, where a corner panel still
49
+ * moves like one but has no launcher left to drag.
50
+ */
51
+ readonly panelMovable: boolean;
44
52
  /**
45
53
  * Which axes the resize grips may change. A full-bleed layout is the whole
46
54
  * viewport by definition and cannot be resized; a docked panel owns its
@@ -69,10 +77,11 @@ export interface Surface {
69
77
  * state, never a placement's own shape: `bar` applies where the placement
70
78
  * collapses to `launcher`, so the sidebar keeps its rail and an embedded chat
71
79
  * its header bar, and `none` applies to every collapsible placement. Absent,
72
- * `auto` and any other value leave the placement as it was. A docked surface
73
- * cannot be moved -- the panel rises from the bar or the host's anchor, and a
74
- * position the user dragged would take it away from either -- so both turn
75
- * the launcher drag off, and with it the header drag and `moveTo`.
80
+ * `auto` and any other value leave the placement as it was. Both turn the
81
+ * launcher drag off, because there is no launcher left to drag, and keep the
82
+ * placement's own answer for moving the panel: a corner panel rises from the
83
+ * bar or the anchor until the user drags it somewhere else, and a placement
84
+ * that owns its position keeps owning it.
76
85
  */
77
86
  export declare function surfaceFor(placement: string | null, collapseTo?: string | null): Surface;
78
87
  //# sourceMappingURL=surface_for.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"surface_for.d.ts","sourceRoot":"","sources":["../../../src/ui/placement/surface_for.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;AAEpF;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC;AA2DD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAS9F"}
1
+ {"version":3,"file":"surface_for.d.ts","sourceRoot":"","sources":["../../../src/ui/placement/surface_for.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;AAEpF;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC;AA2ED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAS9F"}
@@ -1 +1 @@
1
- {"version":3,"file":"tool_group_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/progress/tool_group_styles.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,iBAAiB,EAAE,MAqP/B,CAAC"}
1
+ {"version":3,"file":"tool_group_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/progress/tool_group_styles.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,iBAAiB,EAAE,MAsP/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"frame_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/shell/frame_styles.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,YAAY,EAAE,MAqH1B,CAAC"}
1
+ {"version":3,"file":"frame_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/shell/frame_styles.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,YAAY,EAAE,MAyI1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"token_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/shell/token_styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,EAAE,MA8a1B,CAAC"}
1
+ {"version":3,"file":"token_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/shell/token_styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,EAAE,MA6c1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"classic_tokens.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/classic_tokens.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,EAAE,MA+C5B,CAAC"}
1
+ {"version":3,"file":"classic_tokens.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/classic_tokens.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,EAAE,MAgD5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ledger_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/ledger_styles.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,EAAE,MAsK3B,CAAC"}
1
+ {"version":3,"file":"ledger_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/ledger_styles.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,EAAE,MAuK3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ledger_tokens.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/ledger_tokens.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,EAAE,MA8B3B,CAAC"}
1
+ {"version":3,"file":"ledger_tokens.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/ledger_tokens.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,EAAE,MA+B3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"quiet_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/quiet_styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,EAAE,MA8G1B,CAAC"}
1
+ {"version":3,"file":"quiet_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/quiet_styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,EAAE,MAiH1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"soft_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/soft_styles.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,EAAE,MAkJzB,CAAC"}
1
+ {"version":3,"file":"soft_styles.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/soft_styles.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,EAAE,MAmJzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"soft_tokens.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/soft_tokens.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,EAAE,MA0BzB,CAAC"}
1
+ {"version":3,"file":"soft_tokens.d.ts","sourceRoot":"","sources":["../../../src/ui/themes/soft_tokens.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,EAAE,MA2BzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artooi/ag-ui-web-component",
3
- "version": "0.48.0",
3
+ "version": "0.50.0",
4
4
  "description": "Framework-free <ag-ui-chat> Web Component over the AG-UI protocol. Drop-in chat sidebar with a pluggable client-side tool registry, DOM driver primitives, animations, and destructive-action confirmation modal.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -633,6 +633,24 @@ export class AgUiChat extends HTMLElement {
633
633
  * a field so `removeEventListener` on disconnect gets the same reference.
634
634
  */
635
635
  readonly #onViewportResize = (): void => {
636
+ if (this.#readyToPlace()) {
637
+ this.#placement.restoreLauncherPosition();
638
+ }
639
+ };
640
+
641
+ /**
642
+ * The same for a change only the panel's own layout shows: a host's size, a
643
+ * viewport inset token, a line typed in the composer. Not a moment to hand a
644
+ * position back, so a panel under data-launcher-drag="false" stays put.
645
+ */
646
+ readonly #onLayoutChange = (): void => {
647
+ if (this.#readyToPlace()) {
648
+ this.#placement.settleLauncherPosition();
649
+ }
650
+ };
651
+
652
+ /** Bring the viewport's readings up to date, and say whether placing may follow. */
653
+ #readyToPlace(): boolean {
636
654
  this.#placement.publishVisualViewport();
637
655
  this.#syncDock();
638
656
  // Not while a gesture owns the position. Restoring re-applies the *stored*
@@ -647,11 +665,8 @@ export class AgUiChat extends HTMLElement {
647
665
  // sent me looking -- that was an inset measured from the wrong box -- so it
648
666
  // is a guard against a fight that had not been observed rather than a fix
649
667
  // for one that had.
650
- if (this.#placement.dragging()) {
651
- return;
652
- }
653
- this.#placement.restoreLauncherPosition();
654
- };
668
+ return !this.#placement.dragging();
669
+ }
655
670
 
656
671
  /** Mic button mount point (input row); the control mounts on connect when enabled. */
657
672
  readonly #voiceSlot: HTMLSpanElement;
@@ -1128,7 +1143,8 @@ export class AgUiChat extends HTMLElement {
1128
1143
  return;
1129
1144
  }
1130
1145
  // collapse-to changes the surface the way placement does -- a docked panel
1131
- // cannot be moved, so the same handover applies -- and is live the same way.
1146
+ // has no launcher to drag, and keeps its own dragged spot apart from the
1147
+ // corner's, so the same handover applies -- and is live the same way.
1132
1148
  if (name === "placement" || name === "collapse-to") {
1133
1149
  // A placement owns the axes it fixes, so hand those back before anything
1134
1150
  // else: a size dragged under the previous placement would otherwise sit
@@ -1585,6 +1601,25 @@ export class AgUiChat extends HTMLElement {
1585
1601
  const dockObserver = new ResizeObserver(() => this.#syncDock());
1586
1602
  dockObserver.observe(this.#dockBar);
1587
1603
  this.#connection.signal.addEventListener("abort", () => dockObserver.disconnect());
1604
+ // A host's own size arrives with no event: a token written or a class changed
1605
+ // moves nothing here until the next window resize or reopen, and a panel
1606
+ // re-placed under a size that has since gone stays held short of its spot. The
1607
+ // transcript is watched rather than this element, whose box it follows, because
1608
+ // a page publishing a token from an observer of its own, as the README's recipe
1609
+ // does, changes this box after that observer has run, and the browser reports
1610
+ // the answer to a target no deeper than that one as a loop on the window. One
1611
+ // of its own already watches the transcript, so this adds no report of its own.
1612
+ const layoutObserver = new ResizeObserver(this.#onLayoutChange);
1613
+ layoutObserver.observe(this.#messages);
1614
+ this.#connection.signal.addEventListener("abort", () => layoutObserver.disconnect());
1615
+ // The viewport insets arrive the same way, and a page's observer writes them after
1616
+ // the window's resize event, so that restore reads the bar as it was. The probe
1617
+ // carries them, and an observer on it would be a report on the window for the same
1618
+ // reason, so it takes them as a transition instead: heard the next frame, whichever
1619
+ // element wrote them and however late.
1620
+ this.#placement.probe.addEventListener("transitionrun", this.#onLayoutChange, {
1621
+ signal: this.#connection.signal,
1622
+ });
1588
1623
  this.#syncDock();
1589
1624
  // Under collapse-to="none" the host draws the collapsed state itself, so
1590
1625
  // it has to learn the state the element mounted in -- restored from
@@ -2076,7 +2111,9 @@ export class AgUiChat extends HTMLElement {
2076
2111
  * `movable` folds two separate reasons into the one answer a caller needs:
2077
2112
  * a placement that places itself owns its position, and a panel that fills
2078
2113
  * the screen has nowhere to go. Reporting them apart would make every caller
2079
- * re-derive the same conjunction.
2114
+ * re-derive the same conjunction. A corner panel docked under
2115
+ * `collapse-to="bar"` or `"none"` is movable on a wide viewport, like the
2116
+ * corner panel it is.
2080
2117
  */
2081
2118
  describeSurface(): ChatSurfaceReport {
2082
2119
  return this.#placement.describeSurface();
@@ -2091,7 +2128,8 @@ export class AgUiChat extends HTMLElement {
2091
2128
  * the corner it opens from is re-picked, and switching placement hands
2092
2129
  * everything back. What it must not do is claim a move it did not make --
2093
2130
  * hence the boolean, and hence {@link describeSurface} existing so a caller
2094
- * can ask first.
2131
+ * can ask first. A docked panel moves too, within the room above its bar or
2132
+ * anchor, and remembers the spot as a header drag would.
2095
2133
  */
2096
2134
  moveTo(corner: ChatCorner, options: { readonly announce?: boolean } = {}): boolean {
2097
2135
  return this.#placement.moveTo(corner, options);
@@ -2100,6 +2138,9 @@ export class AgUiChat extends HTMLElement {
2100
2138
  /**
2101
2139
  * Drop a size the user dragged, and its stored copy, so the placement's
2102
2140
  * default and the host's `--ag-ui-width` / `--ag-ui-height` apply again.
2141
+ * Under `collapse-to="bar"` or `"none"` it also returns a panel the user
2142
+ * dragged off its dock to the dock, and forgets the stored spot; a corner
2143
+ * panel keeps a dragged position.
2103
2144
  */
2104
2145
  resetSize(): void {
2105
2146
  this.#placement.resetSize();
@@ -2788,6 +2829,13 @@ export class AgUiChat extends HTMLElement {
2788
2829
  const probe = this.#placement.probe;
2789
2830
  probe.className = "viewport-probe";
2790
2831
  probe.setAttribute("aria-hidden", "true");
2832
+ // A transition, so a token changing is an event. On the corners of a box with no
2833
+ // size, which draw nothing: a margin would push it out by the token again, and that
2834
+ // is scroll on a page or a card holding the chat. Not on the padding, which the
2835
+ // viewport is read from and has to stay instant.
2836
+ probe.style.borderRadius =
2837
+ "var(--_viewport-inset-top) var(--_viewport-inset-right) var(--_viewport-inset-bottom) var(--_viewport-inset-left)";
2838
+ probe.style.transition = "border-radius 1ms";
2791
2839
  this.#root.replaceChildren(probe, this.#announcer.region, this.#chat, this.#dockBar);
2792
2840
  }
2793
2841
 
@@ -25,12 +25,15 @@ export interface ChatSurfaceReport {
25
25
  /** Whether the panel can be moved, or the placement owns its position. */
26
26
  readonly movable: boolean;
27
27
  /**
28
- * Whether this page allows the panel to be moved at all.
28
+ * Whether this page allows the panel to be moved at all: true for every
29
+ * placement unless the host set `data-launcher-drag="false"`. It is the
30
+ * page's setting alone and does not vary with the placement or `collapse-to`;
31
+ * whether this panel moves is {@link ChatSurfaceReport.movable}.
29
32
  *
30
- * Reported apart from {@link ChatSurfaceReport.movable} only because the two
31
- * reasons a move is refused call for different sentences: a host that turned
32
- * dragging off is not the placement owning the position, and telling the
33
- * user the second when the first is true is a plain falsehood.
33
+ * Reported apart from `movable` only because the two reasons a move is
34
+ * refused call for different sentences: a host that turned dragging off is
35
+ * not the placement owning the position, and telling the user the second
36
+ * when the first is true is a plain falsehood.
34
37
  */
35
38
  readonly draggable: boolean;
36
39
  /** Whether the panel currently covers the whole viewport. */
@@ -161,11 +164,9 @@ export function createChatSurfaceTools(surface: ChatSurface): ClientTool[] {
161
164
  moved: false,
162
165
  reason: report.fullBleed
163
166
  ? "the panel fills the screen, so there is nowhere to move it to"
164
- : report.collapseTo === "bar" || report.collapseTo === "none"
165
- ? "the panel is docked: it rises from the page's bottom bar and stays there"
166
- : report.draggable === false
167
- ? "this page has turned off moving the panel"
168
- : `the "${report.placement ?? ""}" placement owns the panel's position`,
167
+ : report.draggable === false
168
+ ? "this page has turned off moving the panel"
169
+ : `the "${report.placement ?? ""}" placement owns the panel's position`,
169
170
  suggestion: report.collapsible ? "minimise_chat" : null,
170
171
  };
171
172
  }
@@ -16,7 +16,11 @@ export const DOCK_STYLES: string = `
16
16
  The cap follows the token block's rule: what the host left free less the
17
17
  one gutter the anchored edge spends, so a panel grown to the cap runs from
18
18
  just above the bar to the far edge. A host therefore needs no inset to keep
19
- the panel off its bar; --ag-ui-inset still wins when set.
19
+ the panel off its bar; --ag-ui-inset still wins when set. A panel the user
20
+ dragged off its dock is written there inline, which is how the dragged spot
21
+ outranks every rule below, the anchor gap included; the element holds that
22
+ spot above the bar or the anchor itself, and drops it on a phone, where the
23
+ small-viewport block reads the same property first.
20
24
 
21
25
  These blocks restate tokens and nothing else, and sit ahead of the phone
22
26
  block at no more weight than it has, so on a phone the panel is the screen