@genesislcap/ai-assistant 15.35.4 → 15.36.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/ai-assistant.api.json +23 -0
- package/dist/ai-assistant.d.ts +46 -0
- package/dist/custom-elements.json +930 -826
- package/dist/dts/components/chat-bubble/chat-bubble.d.ts +18 -0
- package/dist/dts/components/chat-bubble/chat-bubble.d.ts.map +1 -1
- package/dist/dts/components/chat-bubble/chat-bubble.template.d.ts.map +1 -1
- package/dist/dts/components/chat-markdown/chat-markdown.d.ts +29 -0
- package/dist/dts/components/chat-markdown/chat-markdown.d.ts.map +1 -1
- package/dist/dts/components/halo-overlay.d.ts +30 -0
- package/dist/dts/components/halo-overlay.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/main/main.template.d.ts +15 -0
- package/dist/dts/main/main.template.d.ts.map +1 -1
- package/dist/dts/suggestions/chat-suggestions.d.ts +7 -0
- package/dist/dts/suggestions/chat-suggestions.d.ts.map +1 -1
- package/dist/esm/components/chat-bubble/chat-bubble.js +27 -0
- package/dist/esm/components/chat-bubble/chat-bubble.template.js +5 -3
- package/dist/esm/components/chat-markdown/chat-markdown.js +132 -1
- package/dist/esm/components/halo-overlay.js +96 -8
- package/dist/esm/index.js +3 -1
- package/dist/esm/main/main.template.js +110 -45
- package/dist/esm/suggestions/chat-suggestions.js +11 -3
- package/docs/styling.md +153 -0
- package/package.json +18 -18
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { isChatToolCallUnknown } from '@genesislcap/foundation-ai';
|
|
18
18
|
import { classNames, html, ref, repeat, when } from '@genesislcap/web-core';
|
|
19
|
+
import { MARKDOWN_EXPORTPARTS } from '../components/chat-markdown/chat-markdown';
|
|
19
20
|
import { SettingsModalTemplate } from '../components/settings-modal';
|
|
21
|
+
import { SUGGESTIONS_EXPORTPARTS } from '../suggestions/chat-suggestions';
|
|
20
22
|
import { formatAbsoluteTimestamp, formatMessageTimestamp, messageTimestampDateTime, } from '../utils/format-message-timestamp';
|
|
21
23
|
import { compactionDividerLabel } from '../utils/history-transform';
|
|
22
24
|
import { LOADING_STYLE_ANIMATIONS } from './main.types';
|
|
@@ -37,35 +39,6 @@ function unknownToolPayload(tc) {
|
|
|
37
39
|
const HALO_SPEED_DEFAULT = 1.5;
|
|
38
40
|
const HALO_SPEED_ORCHESTRATING = 0.4;
|
|
39
41
|
const HALO_BORDER_SIZE_DEFAULT = 3;
|
|
40
|
-
// Avatar markup is owned by the component (`assistantIconSafe` / `userIconSafe`),
|
|
41
|
-
// which holds the sanitized SVG string for the default or any consumer override
|
|
42
|
-
// and is injected via `:innerHTML`. A raster `image-src` / `user-image-src`
|
|
43
|
-
// takes precedence over the inline icon. The exported `*IconSvg` string
|
|
44
|
-
// constants in `./main` let apps opt back into a specific built-in mark.
|
|
45
|
-
const assistantAvatarTemplate = html `
|
|
46
|
-
${(m, c) => {
|
|
47
|
-
const parent = c.parent;
|
|
48
|
-
return parent.imageSrc
|
|
49
|
-
? html `
|
|
50
|
-
<img src="${() => parent.imageSrc}" alt="Assistant" class="avatar-img" />
|
|
51
|
-
`
|
|
52
|
-
: html `
|
|
53
|
-
<span class="avatar-icon" :innerHTML="${() => parent.assistantIconSafe}"></span>
|
|
54
|
-
`;
|
|
55
|
-
}}
|
|
56
|
-
`;
|
|
57
|
-
const userAvatarTemplate = html `
|
|
58
|
-
${(m, c) => {
|
|
59
|
-
const parent = c.parent;
|
|
60
|
-
return parent.userImageSrc
|
|
61
|
-
? html `
|
|
62
|
-
<img src="${() => parent.userImageSrc}" alt="You" class="avatar-img" />
|
|
63
|
-
`
|
|
64
|
-
: html `
|
|
65
|
-
<span class="avatar-icon" :innerHTML="${() => parent.userIconSafe}"></span>
|
|
66
|
-
`;
|
|
67
|
-
}}
|
|
68
|
-
`;
|
|
69
42
|
/**
|
|
70
43
|
* @beta
|
|
71
44
|
*/
|
|
@@ -94,6 +67,77 @@ const messageType = (m) => {
|
|
|
94
67
|
return 'ai';
|
|
95
68
|
}
|
|
96
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Part names for one avatar element: the bare name, a role-level name, and — on the assistant
|
|
72
|
+
* side, whose rows vary — the message type.
|
|
73
|
+
*
|
|
74
|
+
* The role-level name is the one an app usually wants. `messageType` splits the assistant across
|
|
75
|
+
* `ai`, `ai-thinking`, `ai-function` and `interaction`, so without it "style the assistant's
|
|
76
|
+
* avatar, not the user's" takes four selectors and silently misses any type added later.
|
|
77
|
+
* `::part()` names cannot be chained, so each has to be a name of its own rather than a
|
|
78
|
+
* combination. The user side needs no extra name — its role and its type are both `user`.
|
|
79
|
+
*
|
|
80
|
+
* Exported for the unit test that pins the vocabulary; not part of the element API.
|
|
81
|
+
*
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
export const avatarPartsFor = (base, type) => type === 'user' ? `${base} ${base}-user` : `${base} ${base}-assistant ${base}-${type}`;
|
|
85
|
+
// Avatar markup is owned by the component (`assistantIconSafe` / `userIconSafe`),
|
|
86
|
+
// which holds the sanitized SVG string for the default or any consumer override
|
|
87
|
+
// and is injected via `:innerHTML`. A raster `image-src` / `user-image-src`
|
|
88
|
+
// takes precedence over the inline icon. The exported `*IconSvg` string
|
|
89
|
+
// constants in `./main` let apps opt back into a specific built-in mark.
|
|
90
|
+
/**
|
|
91
|
+
* The assistant's own avatar markup.
|
|
92
|
+
*
|
|
93
|
+
* Shared rather than duplicated because the loading-indicator row renders the same avatar from a
|
|
94
|
+
* different binding context (the assistant, not a message) — two copies drifted once already, and
|
|
95
|
+
* the parts below are the kind of thing only one copy tends to get.
|
|
96
|
+
*
|
|
97
|
+
* `type` is the message type the avatar belongs to, so `::part()` can reach the assistant's image
|
|
98
|
+
* without also matching the user's: part names cannot be chained in a selector, so the variant has
|
|
99
|
+
* to be a name of its own.
|
|
100
|
+
*/
|
|
101
|
+
const assistantAvatarMarkup = (parent, type) => parent.imageSrc
|
|
102
|
+
? html `
|
|
103
|
+
<img
|
|
104
|
+
src="${() => parent.imageSrc}"
|
|
105
|
+
alt="Assistant"
|
|
106
|
+
class="avatar-img"
|
|
107
|
+
part="${() => avatarPartsFor('avatar-img', type)}"
|
|
108
|
+
/>
|
|
109
|
+
`
|
|
110
|
+
: html `
|
|
111
|
+
<span
|
|
112
|
+
class="avatar-icon"
|
|
113
|
+
part="${() => avatarPartsFor('avatar-icon', type)}"
|
|
114
|
+
:innerHTML="${() => parent.assistantIconSafe}"
|
|
115
|
+
></span>
|
|
116
|
+
`;
|
|
117
|
+
const assistantAvatarTemplate = html `
|
|
118
|
+
${(m, c) => assistantAvatarMarkup(c.parent, messageType(m))}
|
|
119
|
+
`;
|
|
120
|
+
const userAvatarTemplate = html `
|
|
121
|
+
${(m, c) => {
|
|
122
|
+
const parent = c.parent;
|
|
123
|
+
return parent.userImageSrc
|
|
124
|
+
? html `
|
|
125
|
+
<img
|
|
126
|
+
src="${() => parent.userImageSrc}"
|
|
127
|
+
alt="You"
|
|
128
|
+
class="avatar-img"
|
|
129
|
+
part="${() => avatarPartsFor('avatar-img', 'user')}"
|
|
130
|
+
/>
|
|
131
|
+
`
|
|
132
|
+
: html `
|
|
133
|
+
<span
|
|
134
|
+
class="avatar-icon"
|
|
135
|
+
part="${() => avatarPartsFor('avatar-icon', 'user')}"
|
|
136
|
+
:innerHTML="${() => parent.userIconSafe}"
|
|
137
|
+
></span>
|
|
138
|
+
`;
|
|
139
|
+
}}
|
|
140
|
+
`;
|
|
97
141
|
const senderLabel = {
|
|
98
142
|
user: 'You',
|
|
99
143
|
'ai-thinking': 'Thinking',
|
|
@@ -513,7 +557,10 @@ ${(tc) => { var _a; return (((_a = tc.foldPath) === null || _a === void 0 ? void
|
|
|
513
557
|
<div
|
|
514
558
|
class="message-row ${(m) => messageType(m)} ${(m) => m.interaction ? `present-${interactionPresentation(m)}` : ''}"
|
|
515
559
|
>
|
|
516
|
-
<div
|
|
560
|
+
<div
|
|
561
|
+
class="avatar ${(m) => messageType(m)}"
|
|
562
|
+
part="${(m) => avatarPartsFor('avatar', messageType(m))}"
|
|
563
|
+
>
|
|
517
564
|
${when(
|
|
518
565
|
// Keyed on messageType (not raw role) so a synthetic-user message,
|
|
519
566
|
// which renders as 'user', gets the user avatar rather than the
|
|
@@ -528,8 +575,8 @@ ${(tc) => { var _a; return (((_a = tc.foldPath) === null || _a === void 0 ? void
|
|
|
528
575
|
// A 'bare' interaction owns its full presentation — suppress the
|
|
529
576
|
// host sender label. Every other message keeps it.
|
|
530
577
|
(m) => !(m.interaction && interactionPresentation(m) === 'bare'), html `
|
|
531
|
-
<div class="sender">
|
|
532
|
-
<span class="sender-label">
|
|
578
|
+
<div class="sender" part="sender">
|
|
579
|
+
<span class="sender-label" part="sender-label">
|
|
533
580
|
${(m, c) => {
|
|
534
581
|
var _a;
|
|
535
582
|
return messageType(m) === 'ai-function' &&
|
|
@@ -547,9 +594,16 @@ ${(tc) => { var _a; return (((_a = tc.foldPath) === null || _a === void 0 ? void
|
|
|
547
594
|
c.parent.timestampDisplay !== 'off', messageTimestampTemplate)}
|
|
548
595
|
</div>
|
|
549
596
|
`)}
|
|
550
|
-
<div class="content">
|
|
597
|
+
<div class="content" part="content">
|
|
551
598
|
${when((m) => m.content, html `
|
|
552
|
-
|
|
599
|
+
${
|
|
600
|
+
/* Markdown renders inside THIS shadow root, so its parts need forwarding for
|
|
601
|
+
an app to reach them: ::part() crosses exactly one boundary. Built from the
|
|
602
|
+
component's own vocabulary so the two cannot drift. */ ''}
|
|
603
|
+
<ai-chat-markdown
|
|
604
|
+
exportparts="${MARKDOWN_EXPORTPARTS}"
|
|
605
|
+
:content="${(m) => m.content}"
|
|
606
|
+
></ai-chat-markdown>
|
|
553
607
|
`)}
|
|
554
608
|
${when((m) => m.toolCalls, html `
|
|
555
609
|
${repeat((m) => { var _a; return (_a = m.toolCalls) !== null && _a !== void 0 ? _a : []; }, toolCallItemTemplate)}
|
|
@@ -833,12 +887,30 @@ ${(tc) => { var _a; return (((_a = tc.foldPath) === null || _a === void 0 ? void
|
|
|
833
887
|
${when((x) => !!x.headerTitle, html `
|
|
834
888
|
<span class="chat-title" part="chat-title">${(x) => x.headerTitle}</span>
|
|
835
889
|
`)}
|
|
890
|
+
${
|
|
891
|
+
/* The two buttons below re-publish the design-system button's inner parts (control,
|
|
892
|
+
content) into THIS component's part namespace via exportparts.
|
|
893
|
+
|
|
894
|
+
Without it they are unreachable by an embedding app: ::part() crosses exactly one
|
|
895
|
+
shadow boundary, and the control sits two away (app -> foundation-ai-assistant ->
|
|
896
|
+
buttonTag -> control). Exposing only the button host leaves an app able to size
|
|
897
|
+
the box but not the padded control inside it, which pushes hosts into sizing the
|
|
898
|
+
host and clipping the overflow to flatten these buttons - a workaround for a
|
|
899
|
+
missing hook rather than a styling choice.
|
|
900
|
+
|
|
901
|
+
The forwarded control/content names come from whichever design system's button is
|
|
902
|
+
registered as `buttonTag`; a button exposing different parts forwards nothing and
|
|
903
|
+
the rules below simply do not match.
|
|
904
|
+
|
|
905
|
+
Named with the owning button as a prefix so the namespace stays legible as more
|
|
906
|
+
parts are exported, and so control does not collide across buttons. */ ''}
|
|
836
907
|
<div class="header-actions" part="header-actions">
|
|
837
908
|
<slot name="header-actions-extra"></slot>
|
|
838
909
|
${when((x) => !!x.popoutMode, html `
|
|
839
910
|
<${buttonTag}
|
|
840
911
|
class="popout-button"
|
|
841
912
|
part="popout-button"
|
|
913
|
+
exportparts="control: popout-button-control, content: popout-button-content"
|
|
842
914
|
appearance="stealth"
|
|
843
915
|
title="${(x) => (x.popoutMode === 'expand' ? 'Expand to panel' : 'Pop back to bubble')}"
|
|
844
916
|
?disabled=${(x) => x.hasActivePendingInteraction}
|
|
@@ -848,6 +920,7 @@ ${(tc) => { var _a; return (((_a = tc.foldPath) === null || _a === void 0 ? void
|
|
|
848
920
|
<${buttonTag}
|
|
849
921
|
class="settings-button"
|
|
850
922
|
part="settings-button"
|
|
923
|
+
exportparts="control: settings-button-control, content: settings-button-content"
|
|
851
924
|
appearance="stealth"
|
|
852
925
|
title="Settings"
|
|
853
926
|
aria-haspopup="dialog"
|
|
@@ -888,17 +961,8 @@ ${(tc) => { var _a; return (((_a = tc.foldPath) === null || _a === void 0 ? void
|
|
|
888
961
|
LOADING_STYLE_ANIMATIONS.some((s) => x.enabledAnimations.includes(s)));
|
|
889
962
|
}, html `
|
|
890
963
|
<div class="message-row ai" part="thinking">
|
|
891
|
-
<div class="avatar">
|
|
892
|
-
${(x) => x
|
|
893
|
-
? html `
|
|
894
|
-
<img src="${() => x.imageSrc}" alt="Assistant" class="avatar-img" />
|
|
895
|
-
`
|
|
896
|
-
: html `
|
|
897
|
-
<span
|
|
898
|
-
class="avatar-icon"
|
|
899
|
-
:innerHTML="${() => x.assistantIconSafe}"
|
|
900
|
-
></span>
|
|
901
|
-
`}
|
|
964
|
+
<div class="avatar ai" part="${avatarPartsFor('avatar', 'ai')}">
|
|
965
|
+
${(x) => assistantAvatarMarkup(x, 'ai')}
|
|
902
966
|
</div>
|
|
903
967
|
${(x) => selectThinkingTemplate(x)}
|
|
904
968
|
</div>
|
|
@@ -936,6 +1000,7 @@ ${(tc) => { var _a; return (((_a = tc.foldPath) === null || _a === void 0 ? void
|
|
|
936
1000
|
`)}
|
|
937
1001
|
${when((x) => { var _a; return ((_a = x.chatConfig.suggestions) === null || _a === void 0 ? void 0 : _a.behavior) !== 'never' && !x.suggestionsBlocked; }, html `
|
|
938
1002
|
<chat-suggestions
|
|
1003
|
+
exportparts="${SUGGESTIONS_EXPORTPARTS}"
|
|
939
1004
|
:state="${(x) => x.suggestionsState}"
|
|
940
1005
|
@suggestion-clicked="${(x, c) => x.handleSuggestionClick(c.event.detail)}"
|
|
941
1006
|
></chat-suggestions>
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { attr, customElement, GenesisElement, observable, html, css, repeat, when, } from '@genesislcap/web-core';
|
|
3
3
|
const PILL_ANIMATION_STAGGER_MS = 70;
|
|
4
|
+
/**
|
|
5
|
+
* Every part this component exposes, as an `exportparts` value.
|
|
6
|
+
*
|
|
7
|
+
* `::part()` crosses exactly one shadow boundary, so a host rendering `<chat-suggestions>` in its
|
|
8
|
+
* own shadow root has to forward these for an embedding app to reach them at all.
|
|
9
|
+
*/
|
|
10
|
+
export const SUGGESTIONS_EXPORTPARTS = 'suggestions-container, suggestion-placeholder, suggestion-pill';
|
|
4
11
|
const template = html `
|
|
5
12
|
${when((x) => x.state.status === 'loading', html `
|
|
6
|
-
<div class="suggestions-container">
|
|
13
|
+
<div class="suggestions-container" part="suggestions-container">
|
|
7
14
|
${repeat(() => Array.from({ length: 3 }), html `
|
|
8
|
-
<div class="suggestion-placeholder"></div>
|
|
15
|
+
<div class="suggestion-placeholder" part="suggestion-placeholder"></div>
|
|
9
16
|
`)}
|
|
10
17
|
</div>
|
|
11
18
|
`)}
|
|
12
19
|
${when((x) => x.state.status === 'loaded', html `
|
|
13
|
-
<div class="suggestions-container">
|
|
20
|
+
<div class="suggestions-container" part="suggestions-container">
|
|
14
21
|
${repeat((x) => x.state.suggestions, html `
|
|
15
22
|
<button
|
|
16
23
|
class="suggestion-pill"
|
|
24
|
+
part="suggestion-pill"
|
|
17
25
|
style="animation-delay: ${(_, c) => c.index * PILL_ANIMATION_STAGGER_MS}ms"
|
|
18
26
|
@click="${(suggestion, c) => c.parent.handleSuggestionClick(suggestion)}"
|
|
19
27
|
>
|
package/docs/styling.md
CHANGED
|
@@ -60,6 +60,44 @@ Parts on the conversation area (the outer frame exposes many more — e.g.
|
|
|
60
60
|
| `message-<type>` | A bubble of one kind: `message-user`, `message-ai`, `message-ai-thinking`, `message-ai-function`, `message-interaction` |
|
|
61
61
|
| `message-interaction-<presentation>` | An interaction bubble in one presentation: `message-interaction-label`, `message-interaction-bare`, `message-interaction-bubble` |
|
|
62
62
|
| `thinking` | The loading-indicator row |
|
|
63
|
+
| `avatar` | The avatar box beside a message (and beside the loading indicator) |
|
|
64
|
+
| `avatar-user` / `avatar-assistant` | That box, by **role** — `avatar-assistant` covers every assistant row whatever its type |
|
|
65
|
+
| `avatar-<type>` | That box for one kind of row: `avatar-user`, `avatar-ai`, `avatar-ai-thinking`, `avatar-ai-function`, `avatar-interaction` |
|
|
66
|
+
| `avatar-img` | The avatar image, when `image-src` / `user-image-src` is set |
|
|
67
|
+
| `avatar-img-user` / `avatar-img-assistant` | That image, by role |
|
|
68
|
+
| `avatar-img-<type>` | That image, by row type |
|
|
69
|
+
| `avatar-icon` | The inline SVG mark, when no image is set |
|
|
70
|
+
| `avatar-icon-user` / `avatar-icon-assistant` | That mark, by role |
|
|
71
|
+
| `avatar-icon-<type>` | That mark, by row type |
|
|
72
|
+
| `sender` | The name + timestamp row at the top of a bubble |
|
|
73
|
+
| `sender-label` | Just the name |
|
|
74
|
+
| `content` | The bubble's body (markdown, tool calls, interaction widgets) |
|
|
75
|
+
|
|
76
|
+
Each avatar element carries all three names at once, because `::part()` names
|
|
77
|
+
cannot be chained — `::part(avatar-assistant) ::part(avatar-img)` does not exist,
|
|
78
|
+
so every combination you might want to select has to be a name of its own.
|
|
79
|
+
|
|
80
|
+
**Reach for the role name first.** The assistant is split across four row types,
|
|
81
|
+
so `avatar-icon-ai` is only the *plain reply* — thinking, tool-call and
|
|
82
|
+
interaction rows are `avatar-icon-ai-thinking`, `avatar-icon-ai-function` and
|
|
83
|
+
`avatar-icon-interaction`. `avatar-icon-assistant` is all of them, and keeps
|
|
84
|
+
working if a row type is added later:
|
|
85
|
+
|
|
86
|
+
```css
|
|
87
|
+
/* Every assistant mark, never the user's */
|
|
88
|
+
foundation-ai-assistant::part(avatar-icon-assistant) {
|
|
89
|
+
color: var(--accent-fill-rest);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Just the thinking rows */
|
|
93
|
+
foundation-ai-assistant::part(avatar-icon-ai-thinking) {
|
|
94
|
+
opacity: 0.6;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The loading-indicator row uses the same avatar as a plain reply, so it answers to
|
|
99
|
+
`avatar`, `avatar-assistant` and `avatar-ai` like any other assistant row — hiding
|
|
100
|
+
avatars no longer leaves that one behind.
|
|
63
101
|
|
|
64
102
|
Target them from an app stylesheet with `::part()`:
|
|
65
103
|
|
|
@@ -188,6 +226,121 @@ foundation-ai-assistant::part(messages-content) { max-width: none; }
|
|
|
188
226
|
foundation-ai-assistant::part(messages-content) { display: contents; }
|
|
189
227
|
```
|
|
190
228
|
|
|
229
|
+
### The header buttons
|
|
230
|
+
|
|
231
|
+
The header's popout and settings buttons are design-system buttons, so their
|
|
232
|
+
padded inner `control` sits two shadow boundaries from the app. `::part()` crosses
|
|
233
|
+
exactly one, so the assistant re-publishes them under its own namespace:
|
|
234
|
+
|
|
235
|
+
| Part | Element |
|
|
236
|
+
| --- | --- |
|
|
237
|
+
| `popout-button` / `settings-button` | The button hosts |
|
|
238
|
+
| `popout-button-control` / `settings-button-control` | The button's inner control — where padding and sizing actually live |
|
|
239
|
+
| `popout-button-content` / `settings-button-content` | The content slot wrapper inside the control |
|
|
240
|
+
|
|
241
|
+
Size the control, not the host: shrinking the host and clipping the overflow
|
|
242
|
+
flattens the glyph, which is the workaround these parts exist to remove.
|
|
243
|
+
|
|
244
|
+
```css
|
|
245
|
+
foundation-ai-assistant::part(settings-button-control) {
|
|
246
|
+
padding: 2px;
|
|
247
|
+
min-width: 24px;
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
The `-control` / `-content` names come from the registered design-system button.
|
|
252
|
+
A button exposing different parts forwards nothing and these rules simply do not
|
|
253
|
+
match.
|
|
254
|
+
|
|
255
|
+
### Rendered markdown
|
|
256
|
+
|
|
257
|
+
Assistant replies are markdown rendered at runtime, so there is no template to
|
|
258
|
+
author parts on — the generated DOM is annotated after sanitising instead. Every
|
|
259
|
+
element kind gets a part, forwarded through the assistant's own shadow root:
|
|
260
|
+
|
|
261
|
+
| Part | Element |
|
|
262
|
+
| --- | --- |
|
|
263
|
+
| `md-p` | `<p>` |
|
|
264
|
+
| `md-ul` / `md-ol` / `md-li` | Lists and list items |
|
|
265
|
+
| `md-ul-level-<n>` / `md-ol-level-<n>` / `md-li-level-<n>` | The same, at nesting level `n` (1-based) |
|
|
266
|
+
| `md-pre` | Code block wrapper |
|
|
267
|
+
| `md-code` | Any `<code>` |
|
|
268
|
+
| `md-code-block` / `md-code-inline` | A `<code>` inside a `<pre>`, or standing alone |
|
|
269
|
+
| `md-link` | `<a>` |
|
|
270
|
+
| `md-quote` | `<blockquote>` |
|
|
271
|
+
| `md-table` / `md-thead` / `md-tbody` / `md-tr` / `md-th` / `md-td` | Table structure |
|
|
272
|
+
| `md-hr` | `<hr>` |
|
|
273
|
+
| `md-img` | `<img>` |
|
|
274
|
+
| `md-strong` / `md-em` | Bold and italic |
|
|
275
|
+
| `md-h1` … `md-h6` | Headings |
|
|
276
|
+
|
|
277
|
+
```css
|
|
278
|
+
/* Inline code only — code blocks keep their own treatment */
|
|
279
|
+
foundation-ai-assistant::part(md-code-inline) {
|
|
280
|
+
background: var(--neutral-fill-secondary-rest);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/* Tighten nested lists */
|
|
284
|
+
foundation-ai-assistant::part(md-ul-level-2) {
|
|
285
|
+
margin-block: 0;
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
If you render `<ai-chat-markdown>` yourself, inside your own shadow root, you
|
|
290
|
+
have the same forwarding problem — import the list rather than retyping it:
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
import { MARKDOWN_EXPORTPARTS } from '@genesislcap/ai-assistant';
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Two caveats. **List levels stop at 3**: `exportparts` has no wildcard, so the
|
|
297
|
+
forwarded vocabulary has to be finite — a list nested four deep is tagged
|
|
298
|
+
`md-ul-level-3`, i.e. the deepest level means "this deep or deeper". And the part
|
|
299
|
+
vocabulary is exactly the table above whatever the model writes: `part` and
|
|
300
|
+
`exportparts` are stripped from the markdown during sanitising, so inline HTML in
|
|
301
|
+
a reply cannot mint a name of its own.
|
|
302
|
+
|
|
303
|
+
### Suggestions
|
|
304
|
+
|
|
305
|
+
| Part | Element |
|
|
306
|
+
| --- | --- |
|
|
307
|
+
| `suggestions-container` | The row of suggestion pills |
|
|
308
|
+
| `suggestion-placeholder` | A skeleton pill, while suggestions load |
|
|
309
|
+
| `suggestion-pill` | One suggestion button |
|
|
310
|
+
|
|
311
|
+
### The floating bubble
|
|
312
|
+
|
|
313
|
+
When the assistant runs as a floating bubble (`ai-chat-bubble`):
|
|
314
|
+
|
|
315
|
+
| Part | Element |
|
|
316
|
+
| --- | --- |
|
|
317
|
+
| `bubble` | The collapsed floating bubble |
|
|
318
|
+
| `pulse-ring` | The ring animating around it |
|
|
319
|
+
| `tooltip` | Its hover tooltip |
|
|
320
|
+
| `dialog` | The expanded dialog |
|
|
321
|
+
| `dialog-content` | The dialog's content area |
|
|
322
|
+
|
|
323
|
+
These three are positioned and sized by the component, and an outer `::part()`
|
|
324
|
+
rule beats both the component's own styles *and* its inline `style` attribute —
|
|
325
|
+
the tree-context comparison comes before the style-attribute one in the cascade.
|
|
326
|
+
So the component owns, and you should not set:
|
|
327
|
+
|
|
328
|
+
| Part | Properties the component owns |
|
|
329
|
+
| --- | --- |
|
|
330
|
+
| `bubble` | `translate` (its drag position) |
|
|
331
|
+
| `dialog` | `translate`, `width`, `height` (drag position and resize state) |
|
|
332
|
+
| `tooltip` | Its placement (set inline as the bubble moves) |
|
|
333
|
+
|
|
334
|
+
Overriding `width` / `height` on `dialog` does not resize the dialog so much as
|
|
335
|
+
desynchronise it: the resize handle keeps writing sizes that no longer apply.
|
|
336
|
+
Everything else — colours, borders, radius, shadow, typography — is yours.
|
|
337
|
+
|
|
338
|
+
One more on `dialog`: the exit animation is a real dependency, not decoration.
|
|
339
|
+
Removing it (`animation: none`) is handled — the dialog closes immediately
|
|
340
|
+
instead of waiting for an `animationend` that would never fire — but replacing it
|
|
341
|
+
with a non-terminating animation will leave the dialog open, since the close
|
|
342
|
+
waits for that animation to end.
|
|
343
|
+
|
|
191
344
|
---
|
|
192
345
|
|
|
193
346
|
## Responsive sizing
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/ai-assistant",
|
|
3
3
|
"description": "Genesis AI Assistant micro-frontend",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.36.0",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/ai-assistant.d.ts",
|
|
@@ -82,32 +82,32 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@genesislcap/foundation-comms": "15.
|
|
86
|
-
"@genesislcap/foundation-testing": "15.
|
|
87
|
-
"@genesislcap/genx": "15.
|
|
88
|
-
"@genesislcap/rollup-builder": "15.
|
|
89
|
-
"@genesislcap/ts-builder": "15.
|
|
90
|
-
"@genesislcap/uvu-playwright-builder": "15.
|
|
91
|
-
"@genesislcap/vite-builder": "15.
|
|
92
|
-
"@genesislcap/webpack-builder": "15.
|
|
85
|
+
"@genesislcap/foundation-comms": "15.36.0",
|
|
86
|
+
"@genesislcap/foundation-testing": "15.36.0",
|
|
87
|
+
"@genesislcap/genx": "15.36.0",
|
|
88
|
+
"@genesislcap/rollup-builder": "15.36.0",
|
|
89
|
+
"@genesislcap/ts-builder": "15.36.0",
|
|
90
|
+
"@genesislcap/uvu-playwright-builder": "15.36.0",
|
|
91
|
+
"@genesislcap/vite-builder": "15.36.0",
|
|
92
|
+
"@genesislcap/webpack-builder": "15.36.0",
|
|
93
93
|
"@types/dompurify": "^3.0.5",
|
|
94
94
|
"@types/marked": "^5.0.2",
|
|
95
95
|
"esbuild": "0.25.12"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@genesislcap/foundation-ai": "15.
|
|
99
|
-
"@genesislcap/foundation-logger": "15.
|
|
100
|
-
"@genesislcap/foundation-notifications": "15.
|
|
101
|
-
"@genesislcap/foundation-redux": "15.
|
|
102
|
-
"@genesislcap/foundation-ui": "15.
|
|
103
|
-
"@genesislcap/foundation-utils": "15.
|
|
104
|
-
"@genesislcap/rapid-design-system": "15.
|
|
105
|
-
"@genesislcap/web-core": "15.
|
|
98
|
+
"@genesislcap/foundation-ai": "15.36.0",
|
|
99
|
+
"@genesislcap/foundation-logger": "15.36.0",
|
|
100
|
+
"@genesislcap/foundation-notifications": "15.36.0",
|
|
101
|
+
"@genesislcap/foundation-redux": "15.36.0",
|
|
102
|
+
"@genesislcap/foundation-ui": "15.36.0",
|
|
103
|
+
"@genesislcap/foundation-utils": "15.36.0",
|
|
104
|
+
"@genesislcap/rapid-design-system": "15.36.0",
|
|
105
|
+
"@genesislcap/web-core": "15.36.0",
|
|
106
106
|
"dompurify": "^3.3.1",
|
|
107
107
|
"marked": "^17.0.3"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
|
-
"@genesislcap/foundation-comms": "^15.
|
|
110
|
+
"@genesislcap/foundation-comms": "^15.36.0"
|
|
111
111
|
},
|
|
112
112
|
"peerDependenciesMeta": {
|
|
113
113
|
"@genesislcap/foundation-comms": {
|