@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.
- package/CHANGELOG.md +192 -1
- package/README.md +70 -7
- package/dist/ag-ui-web-component.bundle.js +171 -107
- package/dist/ag-ui-web-component.bundle.js.map +3 -3
- package/dist/core/ag_ui_chat.d.ts +8 -2
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/index.js +591 -82
- package/dist/index.js.map +3 -3
- package/dist/tools/chat_surface_tools.d.ts +8 -5
- package/dist/tools/chat_surface_tools.d.ts.map +1 -1
- package/dist/ui/placement/dock_styles.d.ts.map +1 -1
- package/dist/ui/placement/panel_placement.d.ts +18 -1
- package/dist/ui/placement/panel_placement.d.ts.map +1 -1
- package/dist/ui/placement/surface_for.d.ts +15 -6
- package/dist/ui/placement/surface_for.d.ts.map +1 -1
- package/dist/ui/progress/tool_group_styles.d.ts.map +1 -1
- package/dist/ui/shell/frame_styles.d.ts.map +1 -1
- package/dist/ui/shell/token_styles.d.ts.map +1 -1
- package/dist/ui/themes/classic_tokens.d.ts.map +1 -1
- package/dist/ui/themes/ledger_styles.d.ts.map +1 -1
- package/dist/ui/themes/ledger_tokens.d.ts.map +1 -1
- package/dist/ui/themes/quiet_styles.d.ts.map +1 -1
- package/dist/ui/themes/soft_styles.d.ts.map +1 -1
- package/dist/ui/themes/soft_tokens.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/ag_ui_chat.ts +56 -8
- package/src/tools/chat_surface_tools.ts +11 -10
- package/src/ui/placement/dock_styles.ts +5 -1
- package/src/ui/placement/panel_placement.ts +587 -82
- package/src/ui/placement/surface_for.ts +33 -8
- package/src/ui/progress/tool_group_styles.ts +3 -2
- package/src/ui/shell/frame_styles.ts +22 -2
- package/src/ui/shell/token_styles.ts +31 -0
- package/src/ui/themes/classic_tokens.ts +1 -0
- package/src/ui/themes/ledger_styles.ts +4 -3
- package/src/ui/themes/ledger_tokens.ts +1 -0
- package/src/ui/themes/quiet_styles.ts +6 -3
- package/src/ui/themes/soft_styles.ts +4 -3
- package/src/ui/themes/soft_tokens.ts +1 -0
- package/src/version.ts +1 -1
|
@@ -39,10 +39,18 @@ export interface Surface {
|
|
|
39
39
|
readonly collapseTo: CollapseTarget;
|
|
40
40
|
/**
|
|
41
41
|
* Whether a gesture may move the launcher. The rest have nowhere to put it:
|
|
42
|
-
* the rail is a docked edge, `header` and `null` have no launcher,
|
|
43
|
-
* full-bleed panel covers the screen it would be opening into
|
|
42
|
+
* the rail is a docked edge, `header` and `null` have no launcher, a
|
|
43
|
+
* full-bleed panel covers the screen it would be opening into, and the bar
|
|
44
|
+
* and the host's own control are not a launcher at all.
|
|
44
45
|
*/
|
|
45
46
|
readonly launcherDraggable: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the header drag and `moveTo` may move the open panel. The same
|
|
49
|
+
* answer as {@link launcherDraggable} for every placement on its own; the two
|
|
50
|
+
* part under `collapse-to="bar"` and `"none"`, where a corner panel still
|
|
51
|
+
* moves like one but has no launcher left to drag.
|
|
52
|
+
*/
|
|
53
|
+
readonly panelMovable: boolean;
|
|
46
54
|
/**
|
|
47
55
|
* Which axes the resize grips may change. A full-bleed layout is the whole
|
|
48
56
|
* viewport by definition and cannot be resized; a docked panel owns its
|
|
@@ -67,6 +75,7 @@ export interface Surface {
|
|
|
67
75
|
const CORNER: Surface = {
|
|
68
76
|
collapseTo: "launcher",
|
|
69
77
|
launcherDraggable: true,
|
|
78
|
+
panelMovable: true,
|
|
70
79
|
resizeAxis: "both",
|
|
71
80
|
startsCollapsed: true,
|
|
72
81
|
};
|
|
@@ -74,6 +83,7 @@ const CORNER: Surface = {
|
|
|
74
83
|
const DOCKED: Surface = {
|
|
75
84
|
collapseTo: "launcher",
|
|
76
85
|
launcherDraggable: false,
|
|
86
|
+
panelMovable: false,
|
|
77
87
|
resizeAxis: "width",
|
|
78
88
|
startsCollapsed: false,
|
|
79
89
|
};
|
|
@@ -94,17 +104,30 @@ const SURFACES: ReadonlyMap<string | null, Surface> = new Map<string | null, Sur
|
|
|
94
104
|
{
|
|
95
105
|
collapseTo: "launcher",
|
|
96
106
|
launcherDraggable: false,
|
|
107
|
+
panelMovable: false,
|
|
97
108
|
resizeAxis: "none",
|
|
98
109
|
startsCollapsed: false,
|
|
99
110
|
},
|
|
100
111
|
],
|
|
101
112
|
[
|
|
102
113
|
"page",
|
|
103
|
-
{
|
|
114
|
+
{
|
|
115
|
+
collapseTo: null,
|
|
116
|
+
launcherDraggable: false,
|
|
117
|
+
panelMovable: false,
|
|
118
|
+
resizeAxis: "none",
|
|
119
|
+
startsCollapsed: false,
|
|
120
|
+
},
|
|
104
121
|
],
|
|
105
122
|
[
|
|
106
123
|
"embedded",
|
|
107
|
-
{
|
|
124
|
+
{
|
|
125
|
+
collapseTo: "header",
|
|
126
|
+
launcherDraggable: false,
|
|
127
|
+
panelMovable: false,
|
|
128
|
+
resizeAxis: "both",
|
|
129
|
+
startsCollapsed: false,
|
|
130
|
+
},
|
|
108
131
|
],
|
|
109
132
|
]);
|
|
110
133
|
|
|
@@ -117,6 +140,7 @@ const SURFACES: ReadonlyMap<string | null, Surface> = new Map<string | null, Sur
|
|
|
117
140
|
const UNKNOWN: Surface = {
|
|
118
141
|
collapseTo: "launcher",
|
|
119
142
|
launcherDraggable: false,
|
|
143
|
+
panelMovable: false,
|
|
120
144
|
resizeAxis: "both",
|
|
121
145
|
startsCollapsed: false,
|
|
122
146
|
};
|
|
@@ -129,10 +153,11 @@ const UNKNOWN: Surface = {
|
|
|
129
153
|
* state, never a placement's own shape: `bar` applies where the placement
|
|
130
154
|
* collapses to `launcher`, so the sidebar keeps its rail and an embedded chat
|
|
131
155
|
* its header bar, and `none` applies to every collapsible placement. Absent,
|
|
132
|
-
* `auto` and any other value leave the placement as it was.
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* the
|
|
156
|
+
* `auto` and any other value leave the placement as it was. Both turn the
|
|
157
|
+
* launcher drag off, because there is no launcher left to drag, and keep the
|
|
158
|
+
* placement's own answer for moving the panel: a corner panel rises from the
|
|
159
|
+
* bar or the anchor until the user drags it somewhere else, and a placement
|
|
160
|
+
* that owns its position keeps owning it.
|
|
136
161
|
*/
|
|
137
162
|
export function surfaceFor(placement: string | null, collapseTo: string | null = null): Surface {
|
|
138
163
|
const surface = SURFACES.get(placement) ?? UNKNOWN;
|
|
@@ -173,7 +173,8 @@ ${GROUPED} .tool-group[data-open="false"] .tool-group-list {
|
|
|
173
173
|
|
|
174
174
|
/* A card inside the group is one line of the list: icon, name, and its
|
|
175
175
|
Details control at the end, with the arguments and result opening under
|
|
176
|
-
the whole row.
|
|
176
|
+
the whole row. Its ink is the second ink in every theme, unless the host
|
|
177
|
+
set the tool token, which then reaches the grouped calls too. */
|
|
177
178
|
${GROUPED} .tool-group .tool-call {
|
|
178
179
|
max-width: 100%;
|
|
179
180
|
align-self: stretch;
|
|
@@ -184,7 +185,7 @@ ${GROUPED} .tool-group .tool-call {
|
|
|
184
185
|
border: 0;
|
|
185
186
|
border-radius: 0;
|
|
186
187
|
background: transparent;
|
|
187
|
-
color: var(--_ink-2);
|
|
188
|
+
color: var(--_tool-fg-set, var(--_ink-2));
|
|
188
189
|
font-family: inherit;
|
|
189
190
|
font-size: var(--_text-sm);
|
|
190
191
|
}
|
|
@@ -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:
|
|
137
|
+
background: var(--_header-btn-hover);
|
|
118
138
|
}
|
|
119
139
|
`;
|
|
@@ -58,6 +58,24 @@ export const TOKEN_STYLES: string = `
|
|
|
58
58
|
--_tool-fg: var(--ag-ui-tool-fg, var(--_ink-2));
|
|
59
59
|
--_header-bg: var(--ag-ui-header-bg, var(--_bg));
|
|
60
60
|
--_header-fg: var(--ag-ui-header-fg, var(--_fg));
|
|
61
|
+
/* Switches: a public token read with no fallback, named for it with -set.
|
|
62
|
+
With the token unset the switch computes to the guaranteed-invalid value,
|
|
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. 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). */
|
|
68
|
+
--_header-fg-set: var(--ag-ui-header-fg);
|
|
69
|
+
--_tool-fg-set: var(--ag-ui-tool-fg);
|
|
70
|
+
/* The header buttons' hover square, by default, once the header text is
|
|
71
|
+
set. Here it is the text at about a fifth, which every browser can mix;
|
|
72
|
+
where relative colour syntax is supported (see the block at the end) it
|
|
73
|
+
is the text's opposite instead. It reads the switch, so it is unset with
|
|
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. */
|
|
77
|
+
--_header-btn-hover-auto: color-mix(in srgb, var(--_header-fg-set) 18%, transparent);
|
|
78
|
+
--_header-btn-hover: var(--ag-ui-header-btn-hover, var(--_header-btn-hover-auto, var(--_hover)));
|
|
61
79
|
--_border: var(--ag-ui-border, var(--_line));
|
|
62
80
|
--_radius: var(--ag-ui-radius, 12px);
|
|
63
81
|
/* The panel's own frame, which is the one corner a placement can put against
|
|
@@ -430,4 +448,17 @@ export const TOKEN_STYLES: string = `
|
|
|
430
448
|
--_on-accent: var(--ag-ui-on-accent, #ffffff);
|
|
431
449
|
}
|
|
432
450
|
}
|
|
451
|
+
|
|
452
|
+
/* The header buttons' default hover square as the header text's opposite,
|
|
453
|
+
so white text gets a darker square and dark text a lighter one. A square
|
|
454
|
+
mixed from the text itself moves the ground toward the glyph: white on a
|
|
455
|
+
mid-blue header fell from 5.1:1 to 3.75:1 under the pointer. Moving away
|
|
456
|
+
from it can only raise what the host's own pair reads. Gated on this
|
|
457
|
+
exact expression, so a browser that cannot compute it keeps the square
|
|
458
|
+
mixed from the text rather than losing the square altogether. */
|
|
459
|
+
@supports (color: rgb(from red calc(255 - r) calc(255 - g) calc(255 - b))) {
|
|
460
|
+
:host {
|
|
461
|
+
--_header-btn-hover-auto: color-mix(in srgb, rgb(from var(--_header-fg-set) calc(255 - r) calc(255 - g) calc(255 - b)) 18%, transparent);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
433
464
|
`;
|
|
@@ -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
|
-
|
|
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));
|
|
@@ -24,14 +24,17 @@ ${THEME_HOST.quiet} .header-title {
|
|
|
24
24
|
letter-spacing: -0.01em;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/* The buttons sit back in the third ink on the panel. Once the host sets the
|
|
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). */
|
|
27
30
|
${THEME_HOST.quiet} .header-btn {
|
|
28
|
-
color: var(--_ink-3);
|
|
31
|
+
color: var(--_header-fg-set, var(--_ink-3));
|
|
29
32
|
border-radius: 8px;
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
/* The glyph takes the header text, which is the full ink when that is unset. */
|
|
32
36
|
${THEME_HOST.quiet} .header-btn:hover {
|
|
33
|
-
color: var(--
|
|
34
|
-
background: var(--_hover);
|
|
37
|
+
color: var(--_header-fg);
|
|
35
38
|
}
|
|
36
39
|
|
|
37
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
|
-
|
|
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);
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION: string = "0.
|
|
1
|
+
export const VERSION: string = "0.50.0";
|