@smart-cloud/ai-kit-ui 1.5.38 → 1.5.40
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-chatbot/AnswerPresentation.d.ts +9 -1
- package/dist/ai-chatbot/CatalogPageControls.d.ts +16 -0
- package/dist/ai-chatbot/ChatMarkdownImage.d.ts +16 -0
- package/dist/ai-chatbot/chatStream.d.ts +6 -0
- package/dist/ai-chatbot/presentation-directives.d.ts +16 -0
- package/dist/ai-kit-ui.css +193 -0
- package/dist/index.cjs +11 -11
- package/dist/index.js +11 -11
- package/package.json +2 -2
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { AnswerPresentation } from "@smart-cloud/ai-kit-core";
|
|
2
|
+
export interface AnswerCarouselLabels {
|
|
3
|
+
previous: string;
|
|
4
|
+
next: string;
|
|
5
|
+
position: string;
|
|
6
|
+
region: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const AnswerCarouselLabelsContext: import("react").Context<AnswerCarouselLabels>;
|
|
2
9
|
/** The same source-independent layouts render approved REST, MCP and CPT data. */
|
|
3
|
-
export declare function AnswerPresentationView({ presentation, locale }: {
|
|
10
|
+
export declare function AnswerPresentationView({ presentation, locale, carouselLabels }: {
|
|
4
11
|
presentation?: AnswerPresentation;
|
|
5
12
|
locale?: string;
|
|
13
|
+
carouselLabels?: Partial<AnswerCarouselLabels>;
|
|
6
14
|
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type CatalogPage } from "@smart-cloud/ai-kit-core";
|
|
2
|
+
export interface CatalogPageLabels {
|
|
3
|
+
catalogPreviousLabel: string;
|
|
4
|
+
catalogNextLabel: string;
|
|
5
|
+
catalogResultsLabel: string;
|
|
6
|
+
catalogOfLabel: string;
|
|
7
|
+
catalogMoreAvailableLabel: string;
|
|
8
|
+
catalogExpiredLabel: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function catalogPageNavigation(input: unknown, direction: "next" | "previous", busy: boolean, now?: number): string | undefined;
|
|
11
|
+
export declare function CatalogPageControls({ page: input, labels, busy, onNavigate }: {
|
|
12
|
+
page: CatalogPage;
|
|
13
|
+
labels: CatalogPageLabels;
|
|
14
|
+
busy?: boolean;
|
|
15
|
+
onNavigate: (handle: string, label: string) => void;
|
|
16
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import type { ExtraProps } from "react-markdown";
|
|
3
|
+
export interface ChatMarkdownImageLabels {
|
|
4
|
+
enlarge: string;
|
|
5
|
+
close: string;
|
|
6
|
+
preview: string;
|
|
7
|
+
unavailable: string;
|
|
8
|
+
}
|
|
9
|
+
/** Authored block labels can override these without changing runtime language. */
|
|
10
|
+
export declare const ChatMarkdownImageLabelsContext: import("react").Context<ChatMarkdownImageLabels>;
|
|
11
|
+
/** ReactMarkdown has already sanitized src; do not introduce another URL or srcSet. */
|
|
12
|
+
export declare function ChatMarkdownImage({ src, alt, title, labels: suppliedLabels }: ComponentPropsWithoutRef<"img"> & ExtraProps & {
|
|
13
|
+
labels?: Partial<ChatMarkdownImageLabels>;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
/** A Markdown linked image must not produce an interactive button inside a link. */
|
|
16
|
+
export declare function ChatMarkdownLink({ children, node, ...props }: ComponentPropsWithoutRef<"a"> & ExtraProps): import("react").JSX.Element;
|
|
@@ -57,6 +57,9 @@ export type ChatStreamOptions = {
|
|
|
57
57
|
locale: string;
|
|
58
58
|
/** Selected only after a verified backend capability advertises this schema. */
|
|
59
59
|
presentationVersion?: 1 | 2;
|
|
60
|
+
/** Selected only after verified ai.catalog.pagination capability discovery; handles contain no client-selected queries. */
|
|
61
|
+
catalogPageVersion?: 1;
|
|
62
|
+
catalogContinuation?: string;
|
|
60
63
|
sessionId?: string;
|
|
61
64
|
requestId: string;
|
|
62
65
|
resume?: ChatStreamCheckpoint;
|
|
@@ -94,8 +97,11 @@ export declare function summarizeChatActivities(activities: ChatActivity[]): {
|
|
|
94
97
|
otherTools: number;
|
|
95
98
|
};
|
|
96
99
|
export declare function chatPresentationVersionForCapabilities(capabilities?: Record<string, unknown>): 1 | 2;
|
|
100
|
+
export declare function chatCatalogPageVersionForCapabilities(capabilities?: Record<string, unknown>): 1 | undefined;
|
|
97
101
|
/** The same negotiation applies to HTTP prompts and every stream resume frame. */
|
|
98
102
|
export declare function discoverChatPresentationVersion(): Promise<1 | 2>;
|
|
103
|
+
/** Older or unverified backends must never receive the new catalog request fields. */
|
|
104
|
+
export declare function discoverChatCatalogPageVersion(): Promise<1 | undefined>;
|
|
99
105
|
/** The backend advertises streaming only when its WebSocket route is ready. */
|
|
100
106
|
export declare function discoverChatStreamUrl(): Promise<string | undefined>;
|
|
101
107
|
export declare function sendChatStreamCancel(socket: WebSocket | null, checkpoint: ChatStreamCheckpoint | undefined): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface MarkdownNode {
|
|
2
|
+
type: string;
|
|
3
|
+
value?: string;
|
|
4
|
+
children?: MarkdownNode[];
|
|
5
|
+
position?: {
|
|
6
|
+
start: {
|
|
7
|
+
offset?: number;
|
|
8
|
+
};
|
|
9
|
+
end: {
|
|
10
|
+
offset?: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Render-only defense for legacy answers; text can never authorize a card. */
|
|
15
|
+
export declare function hideVerifiedPresentationDirectives(value: unknown, source: string): () => (tree: MarkdownNode) => void;
|
|
16
|
+
export {};
|
package/dist/ai-kit-ui.css
CHANGED
|
@@ -1149,6 +1149,199 @@
|
|
|
1149
1149
|
}
|
|
1150
1150
|
|
|
1151
1151
|
/* Markdown formatting */
|
|
1152
|
+
.ai-catalog-page-controls {
|
|
1153
|
+
display: flex;
|
|
1154
|
+
flex-wrap: wrap;
|
|
1155
|
+
align-items: center;
|
|
1156
|
+
gap: .5rem .75rem;
|
|
1157
|
+
min-width: 0;
|
|
1158
|
+
max-width: 100%;
|
|
1159
|
+
color: var(--ai-kit-color-text, #222);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
.ai-catalog-page-summary,
|
|
1163
|
+
.ai-catalog-page-expired {
|
|
1164
|
+
flex: 1 1 100%;
|
|
1165
|
+
min-width: 0;
|
|
1166
|
+
overflow-wrap: anywhere;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
.ai-catalog-page-expired {
|
|
1170
|
+
color: var(--ai-kit-color-text-muted, #666);
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
.ai-catalog-page-actions {
|
|
1174
|
+
display: flex;
|
|
1175
|
+
flex-wrap: wrap;
|
|
1176
|
+
align-items: stretch;
|
|
1177
|
+
gap: .5rem;
|
|
1178
|
+
min-width: 0;
|
|
1179
|
+
max-width: 100%;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
.ai-catalog-page-actions button {
|
|
1183
|
+
display: inline-flex;
|
|
1184
|
+
align-items: center;
|
|
1185
|
+
justify-content: center;
|
|
1186
|
+
flex: 1 1 auto;
|
|
1187
|
+
min-width: 2.75rem;
|
|
1188
|
+
min-height: 2.75rem;
|
|
1189
|
+
max-width: 100%;
|
|
1190
|
+
box-sizing: border-box;
|
|
1191
|
+
padding: .5rem .875rem;
|
|
1192
|
+
border: 1px solid var(--ai-kit-color-primary, #1c7ed6);
|
|
1193
|
+
border-radius: var(--ai-kit-radius-sm, .75rem);
|
|
1194
|
+
color: var(--ai-kit-color-primary-contrast, #fff);
|
|
1195
|
+
background: var(--ai-kit-color-primary, #1c7ed6);
|
|
1196
|
+
font: inherit;
|
|
1197
|
+
font-weight: 600;
|
|
1198
|
+
line-height: 1.35;
|
|
1199
|
+
text-align: center;
|
|
1200
|
+
white-space: normal;
|
|
1201
|
+
overflow-wrap: anywhere;
|
|
1202
|
+
cursor: pointer;
|
|
1203
|
+
transition: var(--ai-kit-action-transition, background-color 160ms ease);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
.ai-catalog-page-actions button:hover:not(:disabled) {
|
|
1207
|
+
background: var(--ai-kit-color-primary-hover, #1971c2);
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
.ai-catalog-page-actions button:focus-visible {
|
|
1211
|
+
outline: 2px solid var(--ai-kit-action-focus-ring, #1c7ed6);
|
|
1212
|
+
outline-offset: 2px;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
.ai-catalog-page-actions button:disabled {
|
|
1216
|
+
opacity: var(--ai-kit-action-disabled-opacity, .6);
|
|
1217
|
+
cursor: not-allowed;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
.ai-catalog-page-controls[aria-busy="true"] button:disabled {
|
|
1221
|
+
cursor: progress;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
.ai-answer-carousel-controls {
|
|
1225
|
+
display: flex;
|
|
1226
|
+
align-items: center;
|
|
1227
|
+
justify-content: space-between;
|
|
1228
|
+
flex-wrap: wrap;
|
|
1229
|
+
gap: .5rem;
|
|
1230
|
+
margin-bottom: .5rem;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
.ai-answer-carousel-controls button {
|
|
1234
|
+
min-width: 2.75rem;
|
|
1235
|
+
min-height: 2.75rem;
|
|
1236
|
+
padding: .5rem .75rem;
|
|
1237
|
+
border: 1px solid currentColor;
|
|
1238
|
+
border-radius: var(--ai-kit-radius-sm, .75rem);
|
|
1239
|
+
color: inherit;
|
|
1240
|
+
background: transparent;
|
|
1241
|
+
cursor: pointer;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
.ai-answer-carousel-controls button[aria-disabled="true"] {
|
|
1245
|
+
opacity: .45;
|
|
1246
|
+
cursor: default;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
.ai-answer-carousel-track {
|
|
1250
|
+
touch-action: pan-x pan-y;
|
|
1251
|
+
scrollbar-width: thin;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1255
|
+
.ai-answer-carousel-track { scroll-behavior: auto; }
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
/* Scope images at any Markdown nesting depth, including product images in lists. */
|
|
1259
|
+
.ai-chat-bubble .ai-chat-image-trigger {
|
|
1260
|
+
display: block;
|
|
1261
|
+
width: fit-content;
|
|
1262
|
+
max-width: 100%;
|
|
1263
|
+
min-width: 0;
|
|
1264
|
+
margin-block: .5rem;
|
|
1265
|
+
padding: 0;
|
|
1266
|
+
border: 0;
|
|
1267
|
+
border-radius: var(--ai-kit-radius, 4px);
|
|
1268
|
+
background: transparent;
|
|
1269
|
+
line-height: 0;
|
|
1270
|
+
overflow: hidden;
|
|
1271
|
+
cursor: zoom-in;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
.ai-chat-bubble .ai-chat-linked-image {
|
|
1275
|
+
display: block;
|
|
1276
|
+
width: fit-content;
|
|
1277
|
+
max-width: 100%;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
.ai-chat-bubble img.ai-chat-markdown-image {
|
|
1281
|
+
display: block;
|
|
1282
|
+
width: auto;
|
|
1283
|
+
height: auto;
|
|
1284
|
+
max-width: 100%;
|
|
1285
|
+
max-height: 16rem;
|
|
1286
|
+
object-fit: contain;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
.ai-chat-image-trigger:focus-visible,
|
|
1290
|
+
.ai-chat-image-dismiss:focus-visible {
|
|
1291
|
+
outline: 2px solid currentColor;
|
|
1292
|
+
outline-offset: 2px;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
.ai-chat-image-modal-inner {
|
|
1296
|
+
padding: 1rem;
|
|
1297
|
+
overflow: hidden;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
.ai-chat-image-modal {
|
|
1301
|
+
display: flex;
|
|
1302
|
+
flex-direction: column;
|
|
1303
|
+
width: max-content;
|
|
1304
|
+
max-width: calc(100vw - 2rem);
|
|
1305
|
+
max-height: calc(100dvh - 2rem);
|
|
1306
|
+
overflow: hidden;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
.ai-chat-image-modal-header {
|
|
1310
|
+
flex-shrink: 0;
|
|
1311
|
+
min-height: 3rem;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
.ai-chat-image-modal-title {
|
|
1315
|
+
overflow: hidden;
|
|
1316
|
+
text-overflow: ellipsis;
|
|
1317
|
+
white-space: nowrap;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
.ai-chat-image-modal-body {
|
|
1321
|
+
min-width: 0;
|
|
1322
|
+
min-height: 0;
|
|
1323
|
+
overflow: hidden;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
.ai-chat-image-dismiss {
|
|
1327
|
+
display: block;
|
|
1328
|
+
max-width: 100%;
|
|
1329
|
+
padding: 0;
|
|
1330
|
+
border: 0;
|
|
1331
|
+
background: transparent;
|
|
1332
|
+
cursor: zoom-out;
|
|
1333
|
+
overflow: hidden;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
.ai-chat-image-dismiss img {
|
|
1337
|
+
display: block;
|
|
1338
|
+
width: auto;
|
|
1339
|
+
height: auto;
|
|
1340
|
+
max-width: 100%;
|
|
1341
|
+
max-height: calc(100dvh - 8rem);
|
|
1342
|
+
object-fit: contain;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1152
1345
|
.ai-feature-root p,
|
|
1153
1346
|
.doc-search-root p,
|
|
1154
1347
|
.ai-feature-root ul,
|