@artooi/ag-ui-web-component 0.49.0 → 0.50.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 (38) hide show
  1. package/CHANGELOG.md +175 -1
  2. package/README.md +25 -14
  3. package/dist/ag-ui-web-component.bundle.js +168 -125
  4. package/dist/ag-ui-web-component.bundle.js.map +3 -3
  5. package/dist/core/ag_ui_chat.d.ts.map +1 -1
  6. package/dist/index.js +530 -110
  7. package/dist/index.js.map +2 -2
  8. package/dist/tools/chat_surface_tools.d.ts +8 -5
  9. package/dist/tools/chat_surface_tools.d.ts.map +1 -1
  10. package/dist/ui/placement/collapse_styles.d.ts.map +1 -1
  11. package/dist/ui/placement/panel_placement.d.ts +15 -1
  12. package/dist/ui/placement/panel_placement.d.ts.map +1 -1
  13. package/dist/ui/placement/resize_styles.d.ts.map +1 -1
  14. package/dist/ui/shell/frame_styles.d.ts.map +1 -1
  15. package/dist/ui/shell/token_styles.d.ts.map +1 -1
  16. package/dist/ui/themes/classic_tokens.d.ts.map +1 -1
  17. package/dist/ui/themes/ledger_styles.d.ts.map +1 -1
  18. package/dist/ui/themes/ledger_tokens.d.ts.map +1 -1
  19. package/dist/ui/themes/quiet_styles.d.ts.map +1 -1
  20. package/dist/ui/themes/soft_styles.d.ts.map +1 -1
  21. package/dist/ui/themes/soft_tokens.d.ts.map +1 -1
  22. package/dist/ui/transcript/transcript_styles.d.ts.map +1 -1
  23. package/package.json +1 -1
  24. package/src/core/ag_ui_chat.ts +73 -7
  25. package/src/tools/chat_surface_tools.ts +8 -5
  26. package/src/ui/placement/collapse_styles.ts +8 -0
  27. package/src/ui/placement/panel_placement.ts +512 -99
  28. package/src/ui/placement/resize_styles.ts +9 -0
  29. package/src/ui/shell/frame_styles.ts +22 -2
  30. package/src/ui/shell/token_styles.ts +7 -6
  31. package/src/ui/themes/classic_tokens.ts +1 -0
  32. package/src/ui/themes/ledger_styles.ts +4 -3
  33. package/src/ui/themes/ledger_tokens.ts +1 -0
  34. package/src/ui/themes/quiet_styles.ts +2 -15
  35. package/src/ui/themes/soft_styles.ts +4 -3
  36. package/src/ui/themes/soft_tokens.ts +1 -0
  37. package/src/ui/transcript/transcript_styles.ts +14 -1
  38. package/src/version.ts +1 -1
@@ -90,6 +90,15 @@ export const RESIZE_STYLES: string = `
90
90
  bottom: 0;
91
91
  }
92
92
 
93
+ /* A docked panel a host sized to the whole window has nothing to give a grip: its size
94
+ is the host's, and a place a grip left would outlast that size with the bar back
95
+ under it. They go as they do on a phone. A corner panel keeps them, since it has no
96
+ bar to stand clear of and a grip's place is its own. */
97
+ :host([data-collapsed-to="bar"][data-fills-window]) .resize-handle,
98
+ :host([data-collapsed-to="none"][data-fills-window]) .resize-handle {
99
+ display: none;
100
+ }
101
+
93
102
  /* Docked: the placement owns the height, so the horizontal edges and every
94
103
  corner are inert and must not advertise a drag that does nothing. The two
95
104
  vertical edges remain, which is the same affordance these placements had
@@ -44,6 +44,15 @@ export const FRAME_STYLES: string = `
44
44
  touch-action: auto;
45
45
  }
46
46
 
47
+ /* A panel that is the screen has nowhere to go, so its header refuses the drag
48
+ and must not offer it. No selector can see that a host has sized the panel to
49
+ the window, so the placement stamps this from the measurement that refuses the
50
+ drag. :host is carried for the specificity, not the scope, as below. Before the
51
+ dragging rule, so a drag the header did take keeps its grabbing cursor. */
52
+ :host .header[data-fills-screen] {
53
+ cursor: auto;
54
+ }
55
+
47
56
  /* :host is carried for the specificity, not the scope: the placement rules
48
57
  above are a host selector plus a class plus an attribute, and a bare
49
58
  .header[data-dragging] loses to them -- silently, because the drag still
@@ -93,6 +102,14 @@ export const FRAME_STYLES: string = `
93
102
  flex: none;
94
103
  }
95
104
 
105
+ /* Under every theme: once the host sets the header text, the header behind the
106
+ buttons is the host's colour, so their rest opacity goes. The frame's 0.85
107
+ lets the header through the glyph, which took white on a mid-blue header from
108
+ 5.1:1 to 4.2:1. With the header text set, the opacity below reads a colour,
109
+ which no opacity can be, so it is invalid at computed-value time and falls to
110
+ the initial 1; unset, it reads the fallback. The glyph is each theme's own
111
+ business: this inherits the header text, and a theme that draws the buttons
112
+ in another ink reads the same switch to yield. */
96
113
  .header-btn {
97
114
  display: inline-flex;
98
115
  flex: 0 0 auto;
@@ -109,11 +126,14 @@ export const FRAME_STYLES: string = `
109
126
  padding: 0;
110
127
  border-radius: 6px;
111
128
  cursor: pointer;
112
- opacity: 0.85;
129
+ opacity: var(--_header-fg-set, 0.85);
113
130
  }
114
131
 
132
+ /* The square is the host's own when it set one; otherwise it is mixed from the
133
+ header text when the host set that, so it reads on any header the host
134
+ painted; otherwise it is the theme's own. See the alias in the token defaults. */
115
135
  .header-btn:hover {
116
136
  opacity: 1;
117
- background: rgba(255, 255, 255, 0.18);
137
+ background: var(--_header-btn-hover);
118
138
  }
119
139
  `;
@@ -61,18 +61,19 @@ export const TOKEN_STYLES: string = `
61
61
  /* Switches: a public token read with no fallback, named for it with -set.
62
62
  With the token unset the switch computes to the guaranteed-invalid value,
63
63
  so a rule that reads it with a fallback gets the fallback; that is how a
64
- rule tells a token the host set from the theme's default for it. The
65
- default theme's header buttons follow the header text only once a host
66
- sets it, and a step group's calls follow the tool token only once a host
67
- sets it (classic defaults --_tool-fg to the accent, which a group never
68
- drew). */
64
+ rule tells a token the host set from the theme's default for it. Every
65
+ theme's header buttons follow the header text only once a host sets it,
66
+ and a step group's calls follow the tool token only once a host sets it
67
+ (classic defaults --_tool-fg to the accent, which a group never drew). */
69
68
  --_header-fg-set: var(--ag-ui-header-fg);
70
69
  --_tool-fg-set: var(--ag-ui-tool-fg);
71
70
  /* The header buttons' hover square, by default, once the header text is
72
71
  set. Here it is the text at about a fifth, which every browser can mix;
73
72
  where relative colour syntax is supported (see the block at the end) it
74
73
  is the text's opposite instead. It reads the switch, so it is unset with
75
- it, and the square below falls to the panel's hover shade. */
74
+ it, and the square below falls to the theme's own: the panel's hover shade
75
+ here, restated by each theme that draws another, so one rule in the frame
76
+ paints them all. */
76
77
  --_header-btn-hover-auto: color-mix(in srgb, var(--_header-fg-set) 18%, transparent);
77
78
  --_header-btn-hover: var(--ag-ui-header-btn-hover, var(--_header-btn-hover-auto, var(--_hover)));
78
79
  --_border: var(--ag-ui-border, var(--_line));
@@ -18,6 +18,7 @@ export const CLASSIC_TOKENS: string = `
18
18
  --_tool-fg: var(--ag-ui-tool-fg, var(--_accent));
19
19
  --_header-bg: var(--ag-ui-header-bg, light-dark(var(--_accent), #1f1f30));
20
20
  --_header-fg: var(--ag-ui-header-fg, light-dark(#ffffff, #e8e8f2));
21
+ --_header-btn-hover: var(--ag-ui-header-btn-hover, var(--_header-btn-hover-auto, rgba(255, 255, 255, 0.18)));
21
22
  --_border: var(--ag-ui-border, light-dark(#e2e2ec, #33334a));
22
23
  --_muted: var(--ag-ui-muted, light-dark(#6b7280, #9aa0b4));
23
24
  --_success: var(--ag-ui-success, #15803d);
@@ -32,14 +32,15 @@ export const LEDGER_STYLES: string = `
32
32
  vertical-align: 1px;
33
33
  }
34
34
 
35
+ /* Both inks yield once the host sets the header text, since the header behind
36
+ them is then the host's colour (see the switches in the token defaults). */
35
37
  :host([theme~="ledger"]) .header-btn {
36
- color: var(--_ink-3);
38
+ color: var(--_header-fg-set, var(--_ink-3));
37
39
  border-radius: 3px;
38
40
  }
39
41
 
40
42
  :host([theme~="ledger"]) .header-btn:hover {
41
- background: var(--_hover);
42
- color: var(--_fg);
43
+ color: var(--_header-fg-set, var(--_fg));
43
44
  }
44
45
 
45
46
  :host([theme~="ledger"]) .message--user {
@@ -20,6 +20,7 @@ export const LEDGER_TOKENS: string = `
20
20
  --_msg-radius: var(--ag-ui-msg-radius, 0px);
21
21
  --_composer-radius: var(--ag-ui-composer-radius, 4px);
22
22
  --_user-bg: var(--ag-ui-user-bg, transparent);
23
+ --_header-btn-hover: var(--ag-ui-header-btn-hover, var(--_header-btn-hover-auto, var(--_hover)));
23
24
  --_frame-shadow: var(--ag-ui-frame-shadow, 0 0 0 1px var(--_line-strong), 0 20px 40px -28px rgb(0 0 0 / 0.45));
24
25
  --_launcher-bg: var(--ag-ui-launcher-bg, var(--_fg));
25
26
  --_launcher-fg: var(--ag-ui-launcher-fg, var(--_bg));
@@ -26,28 +26,15 @@ ${THEME_HOST.quiet} .header-title {
26
26
 
27
27
  /* The buttons sit back in the third ink on the panel. Once the host sets the
28
28
  header text they draw in it instead, since the header behind them is then
29
- the host's colour (see the switches in the token defaults). So does their
30
- rest opacity: the frame's 0.85 lets the header through the glyph, which
31
- took white on a mid-blue header from 5.1:1 to 4.2:1. With the header text
32
- set, the opacity below reads a colour, which no opacity can be, so it is
33
- invalid at computed-value time and falls to the initial 1; unset, it reads
34
- the fallback, the frame's own 0.85. */
29
+ the host's colour (see the switches in the token defaults). */
35
30
  ${THEME_HOST.quiet} .header-btn {
36
31
  color: var(--_header-fg-set, var(--_ink-3));
37
- opacity: var(--_header-fg-set, 0.85);
38
32
  border-radius: 8px;
39
33
  }
40
34
 
41
- /* The hover square is the host's own when it set one; otherwise it is mixed
42
- from the header text when the host set that, so it reads on any header the
43
- host painted; otherwise it is the panel shade.
44
- The glyph takes the header text, which is the full ink when that is unset.
45
- The opacity restates the frame's hover value, which the rest rule above
46
- outweighs. */
35
+ /* The glyph takes the header text, which is the full ink when that is unset. */
47
36
  ${THEME_HOST.quiet} .header-btn:hover {
48
37
  color: var(--_header-fg);
49
- opacity: 1;
50
- background: var(--_header-btn-hover);
51
38
  }
52
39
 
53
40
  ${THEME_HOST.quiet} .message--user {
@@ -31,14 +31,15 @@ export const SOFT_STYLES: string = `
31
31
  background: linear-gradient(140deg, color-mix(in oklch, var(--_accent) 55%, var(--_bg)), var(--_accent));
32
32
  }
33
33
 
34
+ /* Both inks yield once the host sets the header text, since the header behind
35
+ them is then the host's colour (see the switches in the token defaults). */
34
36
  :host([theme~="soft"]) .header-btn {
35
- color: var(--_ink-3);
37
+ color: var(--_header-fg-set, var(--_ink-3));
36
38
  border-radius: 10px;
37
39
  }
38
40
 
39
41
  :host([theme~="soft"]) .header-btn:hover {
40
- background: var(--_tint-2);
41
- color: var(--_accent-ink);
42
+ color: var(--_header-fg-set, var(--_accent-ink));
42
43
  }
43
44
 
44
45
  :host([theme~="soft"]) .messages {
@@ -10,6 +10,7 @@ export const SOFT_TOKENS: string = `
10
10
  --_tint: var(--ag-ui-tint, color-mix(in oklch, var(--_accent) 5%, var(--_bg)));
11
11
  --_tint-2: var(--ag-ui-tint-2, color-mix(in oklch, var(--_accent) 13%, var(--_bg)));
12
12
  --_header-bg: var(--ag-ui-header-bg, var(--_tint));
13
+ --_header-btn-hover: var(--ag-ui-header-btn-hover, var(--_header-btn-hover-auto, var(--_tint-2)));
13
14
  --_user-bg: var(--ag-ui-user-bg, var(--_tint-2));
14
15
  --_border: var(--ag-ui-border, color-mix(in oklch, var(--_accent) 14%, var(--_bg)));
15
16
  --_radius: var(--ag-ui-radius, 16px);
@@ -97,7 +97,18 @@ export const TRANSCRIPT_STYLES: string = `
97
97
 
98
98
  visibility rather than display: none, because a box that generates no
99
99
  layout has no used values to read. Zero-sized, absolutely positioned and
100
- inert, so it costs nothing but the read. */
100
+ inert, so it costs nothing but the read.
101
+
102
+ The padding gives that box the size of the tokens, which a card narrower than
103
+ one of them would scroll to reach. Scrollable overflow counts a box as its
104
+ transform draws it, so a scale of nothing takes it out of that count on every
105
+ side and in either direction, and leaves what is read: the padding's used values,
106
+ and the containing block a percentage resolves against. Position fixed would add
107
+ no scroll either, and would change that block.
108
+
109
+ From its own corner, which is inside whatever holds it where the centre of the
110
+ padding need not be: kept for an engine that counts a point with no area. Chromium
111
+ does not, so the suite cannot pin the origin. */
101
112
  .viewport-probe {
102
113
  position: absolute;
103
114
  top: 0;
@@ -106,6 +117,8 @@ export const TRANSCRIPT_STYLES: string = `
106
117
  height: 0;
107
118
  visibility: hidden;
108
119
  pointer-events: none;
120
+ transform: scale(0);
121
+ transform-origin: 0 0;
109
122
  padding: var(--_viewport-inset-top) var(--_viewport-inset-right)
110
123
  var(--_viewport-inset-bottom) var(--_viewport-inset-left);
111
124
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION: string = "0.49.0";
1
+ export const VERSION: string = "0.50.1";