@runtypelabs/persona 3.8.3 → 3.9.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.
- package/README.md +1 -1
- package/dist/index.cjs +42 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.global.js +56 -56
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +42 -42
- package/dist/index.js.map +1 -1
- package/dist/theme-editor.cjs +590 -517
- package/dist/theme-editor.js +590 -517
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.js +1 -1
- package/package.json +1 -1
- package/src/client.test.ts +400 -0
- package/src/client.ts +86 -3
- package/src/components/panel.ts +2 -1
- package/src/defaults.ts +11 -1
- package/src/index.ts +2 -0
- package/src/presets.ts +2 -1
- package/src/theme-editor/sections.ts +7 -3
- package/src/theme-reference.ts +1 -1
- package/src/ui.ts +4 -4
- package/src/utils/tokens.ts +6 -2
package/dist/theme-editor.cjs
CHANGED
|
@@ -103,6 +103,296 @@ __export(theme_editor_exports, {
|
|
|
103
103
|
});
|
|
104
104
|
module.exports = __toCommonJS(theme_editor_exports);
|
|
105
105
|
|
|
106
|
+
// src/utils/deep-merge.ts
|
|
107
|
+
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
108
|
+
function deepMerge(base, override) {
|
|
109
|
+
if (!base) return override;
|
|
110
|
+
if (!override) return base;
|
|
111
|
+
const merged = { ...base };
|
|
112
|
+
for (const [key, value] of Object.entries(override)) {
|
|
113
|
+
const existing = merged[key];
|
|
114
|
+
if (isObject(existing) && isObject(value)) {
|
|
115
|
+
merged[key] = deepMerge(existing, value);
|
|
116
|
+
} else {
|
|
117
|
+
merged[key] = value;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return merged;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/defaults.ts
|
|
124
|
+
var DEFAULT_FLOATING_LAUNCHER_WIDTH = "min(440px, calc(100vw - 24px))";
|
|
125
|
+
var DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH = "440px";
|
|
126
|
+
var DEFAULT_WIDGET_CONFIG = {
|
|
127
|
+
apiUrl: "http://localhost:43111/api/chat/dispatch",
|
|
128
|
+
// Client token mode defaults (optional, only used when clientToken is set)
|
|
129
|
+
clientToken: void 0,
|
|
130
|
+
theme: void 0,
|
|
131
|
+
darkTheme: void 0,
|
|
132
|
+
colorScheme: "light",
|
|
133
|
+
launcher: {
|
|
134
|
+
enabled: true,
|
|
135
|
+
mountMode: "floating",
|
|
136
|
+
dock: {
|
|
137
|
+
side: "right",
|
|
138
|
+
width: "420px"
|
|
139
|
+
},
|
|
140
|
+
title: "Chat Assistant",
|
|
141
|
+
subtitle: "Here to help you get answers fast",
|
|
142
|
+
agentIconText: "\u{1F4AC}",
|
|
143
|
+
agentIconName: "bot",
|
|
144
|
+
headerIconName: "bot",
|
|
145
|
+
position: "bottom-right",
|
|
146
|
+
width: DEFAULT_FLOATING_LAUNCHER_WIDTH,
|
|
147
|
+
heightOffset: 0,
|
|
148
|
+
autoExpand: false,
|
|
149
|
+
callToActionIconHidden: false,
|
|
150
|
+
agentIconSize: "40px",
|
|
151
|
+
headerIconSize: "40px",
|
|
152
|
+
closeButtonSize: "32px",
|
|
153
|
+
callToActionIconName: "arrow-up-right",
|
|
154
|
+
callToActionIconText: "",
|
|
155
|
+
callToActionIconSize: "32px",
|
|
156
|
+
callToActionIconPadding: "5px",
|
|
157
|
+
callToActionIconColor: void 0,
|
|
158
|
+
callToActionIconBackgroundColor: void 0,
|
|
159
|
+
// closeButtonColor / clearChat.iconColor omitted so theme.components.header.actionIconForeground applies.
|
|
160
|
+
closeButtonBackgroundColor: "transparent",
|
|
161
|
+
clearChat: {
|
|
162
|
+
backgroundColor: "transparent",
|
|
163
|
+
borderColor: "transparent",
|
|
164
|
+
enabled: true,
|
|
165
|
+
placement: "inline",
|
|
166
|
+
iconName: "refresh-cw",
|
|
167
|
+
size: "32px",
|
|
168
|
+
showTooltip: true,
|
|
169
|
+
tooltipText: "Clear chat",
|
|
170
|
+
paddingX: "0px",
|
|
171
|
+
paddingY: "0px"
|
|
172
|
+
},
|
|
173
|
+
headerIconHidden: false,
|
|
174
|
+
border: void 0,
|
|
175
|
+
shadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)"
|
|
176
|
+
},
|
|
177
|
+
copy: {
|
|
178
|
+
welcomeTitle: "Hello \u{1F44B}",
|
|
179
|
+
welcomeSubtitle: "Ask anything about your account or products.",
|
|
180
|
+
inputPlaceholder: "How can I help...",
|
|
181
|
+
sendButtonLabel: "Send"
|
|
182
|
+
},
|
|
183
|
+
sendButton: {
|
|
184
|
+
borderWidth: "0px",
|
|
185
|
+
paddingX: "12px",
|
|
186
|
+
paddingY: "10px",
|
|
187
|
+
borderColor: void 0,
|
|
188
|
+
useIcon: true,
|
|
189
|
+
iconText: "\u2191",
|
|
190
|
+
size: "40px",
|
|
191
|
+
showTooltip: true,
|
|
192
|
+
tooltipText: "Send message",
|
|
193
|
+
iconName: "send"
|
|
194
|
+
},
|
|
195
|
+
statusIndicator: {
|
|
196
|
+
visible: true,
|
|
197
|
+
idleText: "Online",
|
|
198
|
+
connectingText: "Connecting\u2026",
|
|
199
|
+
connectedText: "Streaming\u2026",
|
|
200
|
+
errorText: "Offline"
|
|
201
|
+
},
|
|
202
|
+
voiceRecognition: {
|
|
203
|
+
enabled: true,
|
|
204
|
+
pauseDuration: 2e3,
|
|
205
|
+
iconName: "mic",
|
|
206
|
+
iconSize: "39px",
|
|
207
|
+
borderWidth: "0px",
|
|
208
|
+
paddingX: "9px",
|
|
209
|
+
paddingY: "14px",
|
|
210
|
+
iconColor: void 0,
|
|
211
|
+
backgroundColor: "transparent",
|
|
212
|
+
borderColor: "transparent",
|
|
213
|
+
recordingIconColor: void 0,
|
|
214
|
+
recordingBackgroundColor: void 0,
|
|
215
|
+
recordingBorderColor: "transparent",
|
|
216
|
+
showTooltip: true,
|
|
217
|
+
tooltipText: "Start voice recognition"
|
|
218
|
+
},
|
|
219
|
+
features: {
|
|
220
|
+
showReasoning: true,
|
|
221
|
+
showToolCalls: true,
|
|
222
|
+
scrollToBottom: {
|
|
223
|
+
enabled: true,
|
|
224
|
+
iconName: "arrow-down",
|
|
225
|
+
label: ""
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
suggestionChips: [
|
|
229
|
+
"What can you help me with?",
|
|
230
|
+
"Tell me about your features",
|
|
231
|
+
"How does this work?"
|
|
232
|
+
],
|
|
233
|
+
suggestionChipsConfig: {
|
|
234
|
+
fontFamily: "sans-serif",
|
|
235
|
+
fontWeight: "500",
|
|
236
|
+
paddingX: "12px",
|
|
237
|
+
paddingY: "6px"
|
|
238
|
+
},
|
|
239
|
+
layout: {
|
|
240
|
+
header: {
|
|
241
|
+
layout: "default",
|
|
242
|
+
showIcon: true,
|
|
243
|
+
showTitle: true,
|
|
244
|
+
showSubtitle: true,
|
|
245
|
+
showCloseButton: true,
|
|
246
|
+
showClearChat: true
|
|
247
|
+
},
|
|
248
|
+
messages: {
|
|
249
|
+
layout: "bubble",
|
|
250
|
+
avatar: {
|
|
251
|
+
show: false,
|
|
252
|
+
position: "left"
|
|
253
|
+
},
|
|
254
|
+
timestamp: {
|
|
255
|
+
show: false,
|
|
256
|
+
position: "below"
|
|
257
|
+
},
|
|
258
|
+
groupConsecutive: false
|
|
259
|
+
},
|
|
260
|
+
slots: {}
|
|
261
|
+
},
|
|
262
|
+
markdown: {
|
|
263
|
+
options: {
|
|
264
|
+
gfm: true,
|
|
265
|
+
breaks: true
|
|
266
|
+
},
|
|
267
|
+
disableDefaultStyles: false
|
|
268
|
+
},
|
|
269
|
+
messageActions: {
|
|
270
|
+
enabled: true,
|
|
271
|
+
showCopy: true,
|
|
272
|
+
showUpvote: false,
|
|
273
|
+
// Requires backend - disabled by default
|
|
274
|
+
showDownvote: false,
|
|
275
|
+
// Requires backend - disabled by default
|
|
276
|
+
visibility: "hover",
|
|
277
|
+
align: "right",
|
|
278
|
+
layout: "pill-inside"
|
|
279
|
+
},
|
|
280
|
+
debug: false
|
|
281
|
+
};
|
|
282
|
+
function mergeThemePartials(base, override) {
|
|
283
|
+
if (!base && !override) return void 0;
|
|
284
|
+
if (!base) return override;
|
|
285
|
+
if (!override) return base;
|
|
286
|
+
return deepMerge(
|
|
287
|
+
base,
|
|
288
|
+
override
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
function mergeWithDefaults(config) {
|
|
292
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
293
|
+
if (!config) return DEFAULT_WIDGET_CONFIG;
|
|
294
|
+
return {
|
|
295
|
+
...DEFAULT_WIDGET_CONFIG,
|
|
296
|
+
...config,
|
|
297
|
+
theme: mergeThemePartials(DEFAULT_WIDGET_CONFIG.theme, config.theme),
|
|
298
|
+
darkTheme: mergeThemePartials(DEFAULT_WIDGET_CONFIG.darkTheme, config.darkTheme),
|
|
299
|
+
launcher: {
|
|
300
|
+
...DEFAULT_WIDGET_CONFIG.launcher,
|
|
301
|
+
...config.launcher,
|
|
302
|
+
dock: {
|
|
303
|
+
...(_a = DEFAULT_WIDGET_CONFIG.launcher) == null ? void 0 : _a.dock,
|
|
304
|
+
...(_b = config.launcher) == null ? void 0 : _b.dock
|
|
305
|
+
},
|
|
306
|
+
clearChat: {
|
|
307
|
+
...(_c = DEFAULT_WIDGET_CONFIG.launcher) == null ? void 0 : _c.clearChat,
|
|
308
|
+
...(_d = config.launcher) == null ? void 0 : _d.clearChat
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
copy: {
|
|
312
|
+
...DEFAULT_WIDGET_CONFIG.copy,
|
|
313
|
+
...config.copy
|
|
314
|
+
},
|
|
315
|
+
sendButton: {
|
|
316
|
+
...DEFAULT_WIDGET_CONFIG.sendButton,
|
|
317
|
+
...config.sendButton
|
|
318
|
+
},
|
|
319
|
+
statusIndicator: {
|
|
320
|
+
...DEFAULT_WIDGET_CONFIG.statusIndicator,
|
|
321
|
+
...config.statusIndicator
|
|
322
|
+
},
|
|
323
|
+
voiceRecognition: {
|
|
324
|
+
...DEFAULT_WIDGET_CONFIG.voiceRecognition,
|
|
325
|
+
...config.voiceRecognition
|
|
326
|
+
},
|
|
327
|
+
features: (() => {
|
|
328
|
+
var _a2, _b2, _c2, _d2;
|
|
329
|
+
const da = (_a2 = DEFAULT_WIDGET_CONFIG.features) == null ? void 0 : _a2.artifacts;
|
|
330
|
+
const ca = (_b2 = config.features) == null ? void 0 : _b2.artifacts;
|
|
331
|
+
const dsb = (_c2 = DEFAULT_WIDGET_CONFIG.features) == null ? void 0 : _c2.scrollToBottom;
|
|
332
|
+
const csb = (_d2 = config.features) == null ? void 0 : _d2.scrollToBottom;
|
|
333
|
+
const mergedArtifacts = da === void 0 && ca === void 0 ? void 0 : {
|
|
334
|
+
...da,
|
|
335
|
+
...ca,
|
|
336
|
+
layout: {
|
|
337
|
+
...da == null ? void 0 : da.layout,
|
|
338
|
+
...ca == null ? void 0 : ca.layout
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
const mergedScrollToBottom = dsb === void 0 && csb === void 0 ? void 0 : {
|
|
342
|
+
...dsb,
|
|
343
|
+
...csb
|
|
344
|
+
};
|
|
345
|
+
return {
|
|
346
|
+
...DEFAULT_WIDGET_CONFIG.features,
|
|
347
|
+
...config.features,
|
|
348
|
+
...mergedScrollToBottom !== void 0 ? { scrollToBottom: mergedScrollToBottom } : {},
|
|
349
|
+
...mergedArtifacts !== void 0 ? { artifacts: mergedArtifacts } : {}
|
|
350
|
+
};
|
|
351
|
+
})(),
|
|
352
|
+
suggestionChips: (_e = config.suggestionChips) != null ? _e : DEFAULT_WIDGET_CONFIG.suggestionChips,
|
|
353
|
+
suggestionChipsConfig: {
|
|
354
|
+
...DEFAULT_WIDGET_CONFIG.suggestionChipsConfig,
|
|
355
|
+
...config.suggestionChipsConfig
|
|
356
|
+
},
|
|
357
|
+
layout: {
|
|
358
|
+
...DEFAULT_WIDGET_CONFIG.layout,
|
|
359
|
+
...config.layout,
|
|
360
|
+
header: {
|
|
361
|
+
...(_f = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _f.header,
|
|
362
|
+
...(_g = config.layout) == null ? void 0 : _g.header
|
|
363
|
+
},
|
|
364
|
+
messages: {
|
|
365
|
+
...(_h = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _h.messages,
|
|
366
|
+
...(_i = config.layout) == null ? void 0 : _i.messages,
|
|
367
|
+
avatar: {
|
|
368
|
+
...(_k = (_j = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _j.messages) == null ? void 0 : _k.avatar,
|
|
369
|
+
...(_m = (_l = config.layout) == null ? void 0 : _l.messages) == null ? void 0 : _m.avatar
|
|
370
|
+
},
|
|
371
|
+
timestamp: {
|
|
372
|
+
...(_o = (_n = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _n.messages) == null ? void 0 : _o.timestamp,
|
|
373
|
+
...(_q = (_p = config.layout) == null ? void 0 : _p.messages) == null ? void 0 : _q.timestamp
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
slots: {
|
|
377
|
+
...(_r = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _r.slots,
|
|
378
|
+
...(_s = config.layout) == null ? void 0 : _s.slots
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
markdown: {
|
|
382
|
+
...DEFAULT_WIDGET_CONFIG.markdown,
|
|
383
|
+
...config.markdown,
|
|
384
|
+
options: {
|
|
385
|
+
...(_t = DEFAULT_WIDGET_CONFIG.markdown) == null ? void 0 : _t.options,
|
|
386
|
+
...(_u = config.markdown) == null ? void 0 : _u.options
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
messageActions: {
|
|
390
|
+
...DEFAULT_WIDGET_CONFIG.messageActions,
|
|
391
|
+
...config.messageActions
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
106
396
|
// src/utils/tokens.ts
|
|
107
397
|
var DEFAULT_PALETTE = {
|
|
108
398
|
colors: {
|
|
@@ -370,8 +660,8 @@ var DEFAULT_COMPONENTS = {
|
|
|
370
660
|
shadow: "palette.shadows.lg"
|
|
371
661
|
},
|
|
372
662
|
panel: {
|
|
373
|
-
width:
|
|
374
|
-
maxWidth:
|
|
663
|
+
width: DEFAULT_FLOATING_LAUNCHER_WIDTH,
|
|
664
|
+
maxWidth: DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH,
|
|
375
665
|
height: "600px",
|
|
376
666
|
maxHeight: "calc(100vh - 80px)",
|
|
377
667
|
borderRadius: "palette.radius.xl",
|
|
@@ -850,526 +1140,238 @@ function themeToCssVariables(theme) {
|
|
|
850
1140
|
cssVars["--persona-dropdown-border"] = (_Za = cssVars["--persona-dropdown-border"]) != null ? _Za : t.copyMenuBorder;
|
|
851
1141
|
}
|
|
852
1142
|
if (t.copyMenuShadow) {
|
|
853
|
-
cssVars["--persona-artifact-toolbar-copy-menu-shadow"] = t.copyMenuShadow;
|
|
854
|
-
cssVars["--persona-dropdown-shadow"] = (__a = cssVars["--persona-dropdown-shadow"]) != null ? __a : t.copyMenuShadow;
|
|
855
|
-
}
|
|
856
|
-
if (t.copyMenuBorderRadius) {
|
|
857
|
-
cssVars["--persona-artifact-toolbar-copy-menu-radius"] = t.copyMenuBorderRadius;
|
|
858
|
-
cssVars["--persona-dropdown-radius"] = (_$a = cssVars["--persona-dropdown-radius"]) != null ? _$a : t.copyMenuBorderRadius;
|
|
859
|
-
}
|
|
860
|
-
if (t.copyMenuItemHoverBackground) {
|
|
861
|
-
cssVars["--persona-artifact-toolbar-copy-menu-item-hover-bg"] = t.copyMenuItemHoverBackground;
|
|
862
|
-
cssVars["--persona-dropdown-item-hover-bg"] = (_ab = cssVars["--persona-dropdown-item-hover-bg"]) != null ? _ab : t.copyMenuItemHoverBackground;
|
|
863
|
-
}
|
|
864
|
-
if (t.iconBackground) cssVars["--persona-artifact-toolbar-icon-bg"] = t.iconBackground;
|
|
865
|
-
if (t.toolbarBorder) cssVars["--persona-artifact-toolbar-border"] = t.toolbarBorder;
|
|
866
|
-
}
|
|
867
|
-
if (artifact == null ? void 0 : artifact.tab) {
|
|
868
|
-
const t = artifact.tab;
|
|
869
|
-
if (t.background) cssVars["--persona-artifact-tab-bg"] = t.background;
|
|
870
|
-
if (t.activeBackground) cssVars["--persona-artifact-tab-active-bg"] = t.activeBackground;
|
|
871
|
-
if (t.activeBorder) cssVars["--persona-artifact-tab-active-border"] = t.activeBorder;
|
|
872
|
-
if (t.borderRadius) cssVars["--persona-artifact-tab-radius"] = t.borderRadius;
|
|
873
|
-
if (t.textColor) cssVars["--persona-artifact-tab-color"] = t.textColor;
|
|
874
|
-
if (t.hoverBackground) cssVars["--persona-artifact-tab-hover-bg"] = t.hoverBackground;
|
|
875
|
-
if (t.listBackground) cssVars["--persona-artifact-tab-list-bg"] = t.listBackground;
|
|
876
|
-
if (t.listBorderColor) cssVars["--persona-artifact-tab-list-border-color"] = t.listBorderColor;
|
|
877
|
-
if (t.listPadding) cssVars["--persona-artifact-tab-list-padding"] = t.listPadding;
|
|
878
|
-
}
|
|
879
|
-
if (artifact == null ? void 0 : artifact.pane) {
|
|
880
|
-
const t = artifact.pane;
|
|
881
|
-
if (t.toolbarBackground) {
|
|
882
|
-
const toolbarBg = (_bb = resolveTokenValue(theme, t.toolbarBackground)) != null ? _bb : t.toolbarBackground;
|
|
883
|
-
cssVars["--persona-artifact-toolbar-bg"] = toolbarBg;
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
return cssVars;
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
// src/utils/deep-merge.ts
|
|
890
|
-
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
891
|
-
function deepMerge(base, override) {
|
|
892
|
-
if (!base) return override;
|
|
893
|
-
if (!override) return base;
|
|
894
|
-
const merged = { ...base };
|
|
895
|
-
for (const [key, value] of Object.entries(override)) {
|
|
896
|
-
const existing = merged[key];
|
|
897
|
-
if (isObject(existing) && isObject(value)) {
|
|
898
|
-
merged[key] = deepMerge(existing, value);
|
|
899
|
-
} else {
|
|
900
|
-
merged[key] = value;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
return merged;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
// src/utils/theme.ts
|
|
907
|
-
var DARK_PALETTE = {
|
|
908
|
-
colors: {
|
|
909
|
-
primary: {
|
|
910
|
-
50: "#ffffff",
|
|
911
|
-
100: "#f5f5f5",
|
|
912
|
-
200: "#d4d4d4",
|
|
913
|
-
300: "#a3a3a3",
|
|
914
|
-
400: "#737373",
|
|
915
|
-
500: "#171717",
|
|
916
|
-
600: "#0f0f0f",
|
|
917
|
-
700: "#0a0a0a",
|
|
918
|
-
800: "#050505",
|
|
919
|
-
900: "#030303",
|
|
920
|
-
950: "#000000"
|
|
921
|
-
},
|
|
922
|
-
secondary: {
|
|
923
|
-
50: "#f5f3ff",
|
|
924
|
-
100: "#ede9fe",
|
|
925
|
-
200: "#ddd6fe",
|
|
926
|
-
300: "#c4b5fd",
|
|
927
|
-
400: "#a78bfa",
|
|
928
|
-
500: "#8b5cf6",
|
|
929
|
-
600: "#7c3aed",
|
|
930
|
-
700: "#6d28d9",
|
|
931
|
-
800: "#5b21b6",
|
|
932
|
-
900: "#4c1d95",
|
|
933
|
-
950: "#2e1065"
|
|
934
|
-
},
|
|
935
|
-
accent: {
|
|
936
|
-
50: "#ecfeff",
|
|
937
|
-
100: "#cffafe",
|
|
938
|
-
200: "#a5f3fc",
|
|
939
|
-
300: "#67e8f9",
|
|
940
|
-
400: "#22d3ee",
|
|
941
|
-
500: "#06b6d4",
|
|
942
|
-
600: "#0891b2",
|
|
943
|
-
700: "#0e7490",
|
|
944
|
-
800: "#155e75",
|
|
945
|
-
900: "#164e63",
|
|
946
|
-
950: "#083344"
|
|
947
|
-
},
|
|
948
|
-
gray: {
|
|
949
|
-
50: "#f9fafb",
|
|
950
|
-
100: "#f3f4f6",
|
|
951
|
-
200: "#e5e7eb",
|
|
952
|
-
300: "#d1d5db",
|
|
953
|
-
400: "#9ca3af",
|
|
954
|
-
500: "#6b7280",
|
|
955
|
-
600: "#4b5563",
|
|
956
|
-
700: "#374151",
|
|
957
|
-
800: "#1f2937",
|
|
958
|
-
900: "#111827",
|
|
959
|
-
950: "#030712"
|
|
960
|
-
},
|
|
961
|
-
success: {
|
|
962
|
-
50: "#f0fdf4",
|
|
963
|
-
100: "#dcfce7",
|
|
964
|
-
200: "#bbf7d0",
|
|
965
|
-
300: "#86efac",
|
|
966
|
-
400: "#4ade80",
|
|
967
|
-
500: "#22c55e",
|
|
968
|
-
600: "#16a34a",
|
|
969
|
-
700: "#15803d",
|
|
970
|
-
800: "#166534",
|
|
971
|
-
900: "#14532d"
|
|
972
|
-
},
|
|
973
|
-
warning: {
|
|
974
|
-
50: "#fefce8",
|
|
975
|
-
100: "#fef9c3",
|
|
976
|
-
200: "#fef08a",
|
|
977
|
-
300: "#fde047",
|
|
978
|
-
400: "#facc15",
|
|
979
|
-
500: "#eab308",
|
|
980
|
-
600: "#ca8a04",
|
|
981
|
-
700: "#a16207",
|
|
982
|
-
800: "#854d0e",
|
|
983
|
-
900: "#713f12"
|
|
984
|
-
},
|
|
985
|
-
error: {
|
|
986
|
-
50: "#fef2f2",
|
|
987
|
-
100: "#fee2e2",
|
|
988
|
-
200: "#fecaca",
|
|
989
|
-
300: "#fca5a5",
|
|
990
|
-
400: "#f87171",
|
|
991
|
-
500: "#ef4444",
|
|
992
|
-
600: "#dc2626",
|
|
993
|
-
700: "#b91c1c",
|
|
994
|
-
800: "#991b1b",
|
|
995
|
-
900: "#7f1d1d"
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
};
|
|
999
|
-
var normalizeThemeConfig = (theme) => {
|
|
1000
|
-
if (!theme || typeof theme !== "object" || Array.isArray(theme)) return void 0;
|
|
1001
|
-
return theme;
|
|
1002
|
-
};
|
|
1003
|
-
var detectColorScheme = () => {
|
|
1004
|
-
var _a;
|
|
1005
|
-
if (typeof document !== "undefined" && document.documentElement.classList.contains("dark")) {
|
|
1006
|
-
return "dark";
|
|
1007
|
-
}
|
|
1008
|
-
if (typeof window !== "undefined" && ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches)) {
|
|
1009
|
-
return "dark";
|
|
1010
|
-
}
|
|
1011
|
-
return "light";
|
|
1012
|
-
};
|
|
1013
|
-
var getColorSchemeFromConfig = (config) => {
|
|
1014
|
-
var _a;
|
|
1015
|
-
const colorScheme = (_a = config == null ? void 0 : config.colorScheme) != null ? _a : "light";
|
|
1016
|
-
if (colorScheme === "light") return "light";
|
|
1017
|
-
if (colorScheme === "dark") return "dark";
|
|
1018
|
-
return detectColorScheme();
|
|
1019
|
-
};
|
|
1020
|
-
var getColorScheme = (config) => {
|
|
1021
|
-
return getColorSchemeFromConfig(config);
|
|
1022
|
-
};
|
|
1023
|
-
var createLightTheme = (userConfig) => {
|
|
1024
|
-
return createTheme(userConfig);
|
|
1025
|
-
};
|
|
1026
|
-
var createDarkTheme = (userConfig) => {
|
|
1027
|
-
var _a;
|
|
1028
|
-
const baseTheme = createTheme(void 0, { validate: false });
|
|
1029
|
-
return createTheme(
|
|
1030
|
-
{
|
|
1031
|
-
...userConfig,
|
|
1032
|
-
palette: {
|
|
1033
|
-
...baseTheme.palette,
|
|
1034
|
-
colors: {
|
|
1035
|
-
...DARK_PALETTE.colors,
|
|
1036
|
-
...(_a = userConfig == null ? void 0 : userConfig.palette) == null ? void 0 : _a.colors
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
},
|
|
1040
|
-
{ validate: false }
|
|
1041
|
-
);
|
|
1042
|
-
};
|
|
1043
|
-
var getActiveTheme = (config) => {
|
|
1044
|
-
const scheme = getColorScheme(config);
|
|
1045
|
-
const lightThemeConfig = normalizeThemeConfig(config == null ? void 0 : config.theme);
|
|
1046
|
-
const darkThemeConfig = normalizeThemeConfig(config == null ? void 0 : config.darkTheme);
|
|
1047
|
-
if (scheme === "dark") {
|
|
1048
|
-
return createDarkTheme(
|
|
1049
|
-
deepMerge(
|
|
1050
|
-
lightThemeConfig != null ? lightThemeConfig : {},
|
|
1051
|
-
darkThemeConfig != null ? darkThemeConfig : {}
|
|
1052
|
-
)
|
|
1053
|
-
);
|
|
1054
|
-
}
|
|
1055
|
-
return createLightTheme(lightThemeConfig);
|
|
1056
|
-
};
|
|
1057
|
-
var getCssVariables = (theme) => {
|
|
1058
|
-
return themeToCssVariables(theme);
|
|
1059
|
-
};
|
|
1060
|
-
var applyThemeVariables = (element, config) => {
|
|
1061
|
-
var _a;
|
|
1062
|
-
const theme = getActiveTheme(config);
|
|
1063
|
-
const cssVars = getCssVariables(theme);
|
|
1064
|
-
for (const [name, value] of Object.entries(cssVars)) {
|
|
1065
|
-
element.style.setProperty(name, value);
|
|
1066
|
-
}
|
|
1067
|
-
const toolCallShadow = (_a = config == null ? void 0 : config.toolCall) == null ? void 0 : _a.shadow;
|
|
1068
|
-
if (toolCallShadow !== void 0) {
|
|
1069
|
-
element.style.setProperty(
|
|
1070
|
-
"--persona-tool-bubble-shadow",
|
|
1071
|
-
toolCallShadow.trim() === "" ? "none" : toolCallShadow
|
|
1072
|
-
);
|
|
1073
|
-
}
|
|
1074
|
-
};
|
|
1075
|
-
var createThemeObserver = (callback) => {
|
|
1076
|
-
const cleanupFns = [];
|
|
1077
|
-
if (typeof document !== "undefined" && typeof MutationObserver !== "undefined") {
|
|
1078
|
-
const observer = new MutationObserver(() => {
|
|
1079
|
-
callback(detectColorScheme());
|
|
1080
|
-
});
|
|
1081
|
-
observer.observe(document.documentElement, {
|
|
1082
|
-
attributes: true,
|
|
1083
|
-
attributeFilter: ["class"]
|
|
1084
|
-
});
|
|
1085
|
-
cleanupFns.push(() => observer.disconnect());
|
|
1086
|
-
}
|
|
1087
|
-
if (typeof window !== "undefined" && window.matchMedia) {
|
|
1088
|
-
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1089
|
-
const handleChange = () => callback(detectColorScheme());
|
|
1090
|
-
if (mediaQuery.addEventListener) {
|
|
1091
|
-
mediaQuery.addEventListener("change", handleChange);
|
|
1092
|
-
cleanupFns.push(() => mediaQuery.removeEventListener("change", handleChange));
|
|
1093
|
-
} else if (mediaQuery.addListener) {
|
|
1094
|
-
mediaQuery.addListener(handleChange);
|
|
1095
|
-
cleanupFns.push(() => mediaQuery.removeListener(handleChange));
|
|
1143
|
+
cssVars["--persona-artifact-toolbar-copy-menu-shadow"] = t.copyMenuShadow;
|
|
1144
|
+
cssVars["--persona-dropdown-shadow"] = (__a = cssVars["--persona-dropdown-shadow"]) != null ? __a : t.copyMenuShadow;
|
|
1145
|
+
}
|
|
1146
|
+
if (t.copyMenuBorderRadius) {
|
|
1147
|
+
cssVars["--persona-artifact-toolbar-copy-menu-radius"] = t.copyMenuBorderRadius;
|
|
1148
|
+
cssVars["--persona-dropdown-radius"] = (_$a = cssVars["--persona-dropdown-radius"]) != null ? _$a : t.copyMenuBorderRadius;
|
|
1149
|
+
}
|
|
1150
|
+
if (t.copyMenuItemHoverBackground) {
|
|
1151
|
+
cssVars["--persona-artifact-toolbar-copy-menu-item-hover-bg"] = t.copyMenuItemHoverBackground;
|
|
1152
|
+
cssVars["--persona-dropdown-item-hover-bg"] = (_ab = cssVars["--persona-dropdown-item-hover-bg"]) != null ? _ab : t.copyMenuItemHoverBackground;
|
|
1096
1153
|
}
|
|
1154
|
+
if (t.iconBackground) cssVars["--persona-artifact-toolbar-icon-bg"] = t.iconBackground;
|
|
1155
|
+
if (t.toolbarBorder) cssVars["--persona-artifact-toolbar-border"] = t.toolbarBorder;
|
|
1097
1156
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
side: "right",
|
|
1116
|
-
width: "420px"
|
|
1117
|
-
},
|
|
1118
|
-
title: "Chat Assistant",
|
|
1119
|
-
subtitle: "Here to help you get answers fast",
|
|
1120
|
-
agentIconText: "\u{1F4AC}",
|
|
1121
|
-
agentIconName: "bot",
|
|
1122
|
-
headerIconName: "bot",
|
|
1123
|
-
position: "bottom-right",
|
|
1124
|
-
width: "min(400px, calc(100vw - 24px))",
|
|
1125
|
-
heightOffset: 0,
|
|
1126
|
-
autoExpand: false,
|
|
1127
|
-
callToActionIconHidden: false,
|
|
1128
|
-
agentIconSize: "40px",
|
|
1129
|
-
headerIconSize: "40px",
|
|
1130
|
-
closeButtonSize: "32px",
|
|
1131
|
-
callToActionIconName: "arrow-up-right",
|
|
1132
|
-
callToActionIconText: "",
|
|
1133
|
-
callToActionIconSize: "32px",
|
|
1134
|
-
callToActionIconPadding: "5px",
|
|
1135
|
-
callToActionIconColor: void 0,
|
|
1136
|
-
callToActionIconBackgroundColor: void 0,
|
|
1137
|
-
// closeButtonColor / clearChat.iconColor omitted so theme.components.header.actionIconForeground applies.
|
|
1138
|
-
closeButtonBackgroundColor: "transparent",
|
|
1139
|
-
clearChat: {
|
|
1140
|
-
backgroundColor: "transparent",
|
|
1141
|
-
borderColor: "transparent",
|
|
1142
|
-
enabled: true,
|
|
1143
|
-
placement: "inline",
|
|
1144
|
-
iconName: "refresh-cw",
|
|
1145
|
-
size: "32px",
|
|
1146
|
-
showTooltip: true,
|
|
1147
|
-
tooltipText: "Clear chat",
|
|
1148
|
-
paddingX: "0px",
|
|
1149
|
-
paddingY: "0px"
|
|
1150
|
-
},
|
|
1151
|
-
headerIconHidden: false,
|
|
1152
|
-
border: void 0,
|
|
1153
|
-
shadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)"
|
|
1154
|
-
},
|
|
1155
|
-
copy: {
|
|
1156
|
-
welcomeTitle: "Hello \u{1F44B}",
|
|
1157
|
-
welcomeSubtitle: "Ask anything about your account or products.",
|
|
1158
|
-
inputPlaceholder: "How can I help...",
|
|
1159
|
-
sendButtonLabel: "Send"
|
|
1160
|
-
},
|
|
1161
|
-
sendButton: {
|
|
1162
|
-
borderWidth: "0px",
|
|
1163
|
-
paddingX: "12px",
|
|
1164
|
-
paddingY: "10px",
|
|
1165
|
-
borderColor: void 0,
|
|
1166
|
-
useIcon: true,
|
|
1167
|
-
iconText: "\u2191",
|
|
1168
|
-
size: "40px",
|
|
1169
|
-
showTooltip: true,
|
|
1170
|
-
tooltipText: "Send message",
|
|
1171
|
-
iconName: "send"
|
|
1172
|
-
},
|
|
1173
|
-
statusIndicator: {
|
|
1174
|
-
visible: true,
|
|
1175
|
-
idleText: "Online",
|
|
1176
|
-
connectingText: "Connecting\u2026",
|
|
1177
|
-
connectedText: "Streaming\u2026",
|
|
1178
|
-
errorText: "Offline"
|
|
1179
|
-
},
|
|
1180
|
-
voiceRecognition: {
|
|
1181
|
-
enabled: true,
|
|
1182
|
-
pauseDuration: 2e3,
|
|
1183
|
-
iconName: "mic",
|
|
1184
|
-
iconSize: "39px",
|
|
1185
|
-
borderWidth: "0px",
|
|
1186
|
-
paddingX: "9px",
|
|
1187
|
-
paddingY: "14px",
|
|
1188
|
-
iconColor: void 0,
|
|
1189
|
-
backgroundColor: "transparent",
|
|
1190
|
-
borderColor: "transparent",
|
|
1191
|
-
recordingIconColor: void 0,
|
|
1192
|
-
recordingBackgroundColor: void 0,
|
|
1193
|
-
recordingBorderColor: "transparent",
|
|
1194
|
-
showTooltip: true,
|
|
1195
|
-
tooltipText: "Start voice recognition"
|
|
1196
|
-
},
|
|
1197
|
-
features: {
|
|
1198
|
-
showReasoning: true,
|
|
1199
|
-
showToolCalls: true,
|
|
1200
|
-
scrollToBottom: {
|
|
1201
|
-
enabled: true,
|
|
1202
|
-
iconName: "arrow-down",
|
|
1203
|
-
label: ""
|
|
1157
|
+
if (artifact == null ? void 0 : artifact.tab) {
|
|
1158
|
+
const t = artifact.tab;
|
|
1159
|
+
if (t.background) cssVars["--persona-artifact-tab-bg"] = t.background;
|
|
1160
|
+
if (t.activeBackground) cssVars["--persona-artifact-tab-active-bg"] = t.activeBackground;
|
|
1161
|
+
if (t.activeBorder) cssVars["--persona-artifact-tab-active-border"] = t.activeBorder;
|
|
1162
|
+
if (t.borderRadius) cssVars["--persona-artifact-tab-radius"] = t.borderRadius;
|
|
1163
|
+
if (t.textColor) cssVars["--persona-artifact-tab-color"] = t.textColor;
|
|
1164
|
+
if (t.hoverBackground) cssVars["--persona-artifact-tab-hover-bg"] = t.hoverBackground;
|
|
1165
|
+
if (t.listBackground) cssVars["--persona-artifact-tab-list-bg"] = t.listBackground;
|
|
1166
|
+
if (t.listBorderColor) cssVars["--persona-artifact-tab-list-border-color"] = t.listBorderColor;
|
|
1167
|
+
if (t.listPadding) cssVars["--persona-artifact-tab-list-padding"] = t.listPadding;
|
|
1168
|
+
}
|
|
1169
|
+
if (artifact == null ? void 0 : artifact.pane) {
|
|
1170
|
+
const t = artifact.pane;
|
|
1171
|
+
if (t.toolbarBackground) {
|
|
1172
|
+
const toolbarBg = (_bb = resolveTokenValue(theme, t.toolbarBackground)) != null ? _bb : t.toolbarBackground;
|
|
1173
|
+
cssVars["--persona-artifact-toolbar-bg"] = toolbarBg;
|
|
1204
1174
|
}
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
"What can you help me with?",
|
|
1208
|
-
"Tell me about your features",
|
|
1209
|
-
"How does this work?"
|
|
1210
|
-
],
|
|
1211
|
-
suggestionChipsConfig: {
|
|
1212
|
-
fontFamily: "sans-serif",
|
|
1213
|
-
fontWeight: "500",
|
|
1214
|
-
paddingX: "12px",
|
|
1215
|
-
paddingY: "6px"
|
|
1216
|
-
},
|
|
1217
|
-
layout: {
|
|
1218
|
-
header: {
|
|
1219
|
-
layout: "default",
|
|
1220
|
-
showIcon: true,
|
|
1221
|
-
showTitle: true,
|
|
1222
|
-
showSubtitle: true,
|
|
1223
|
-
showCloseButton: true,
|
|
1224
|
-
showClearChat: true
|
|
1225
|
-
},
|
|
1226
|
-
messages: {
|
|
1227
|
-
layout: "bubble",
|
|
1228
|
-
avatar: {
|
|
1229
|
-
show: false,
|
|
1230
|
-
position: "left"
|
|
1231
|
-
},
|
|
1232
|
-
timestamp: {
|
|
1233
|
-
show: false,
|
|
1234
|
-
position: "below"
|
|
1235
|
-
},
|
|
1236
|
-
groupConsecutive: false
|
|
1237
|
-
},
|
|
1238
|
-
slots: {}
|
|
1239
|
-
},
|
|
1240
|
-
markdown: {
|
|
1241
|
-
options: {
|
|
1242
|
-
gfm: true,
|
|
1243
|
-
breaks: true
|
|
1244
|
-
},
|
|
1245
|
-
disableDefaultStyles: false
|
|
1246
|
-
},
|
|
1247
|
-
messageActions: {
|
|
1248
|
-
enabled: true,
|
|
1249
|
-
showCopy: true,
|
|
1250
|
-
showUpvote: false,
|
|
1251
|
-
// Requires backend - disabled by default
|
|
1252
|
-
showDownvote: false,
|
|
1253
|
-
// Requires backend - disabled by default
|
|
1254
|
-
visibility: "hover",
|
|
1255
|
-
align: "right",
|
|
1256
|
-
layout: "pill-inside"
|
|
1257
|
-
},
|
|
1258
|
-
debug: false
|
|
1259
|
-
};
|
|
1260
|
-
function mergeThemePartials(base, override) {
|
|
1261
|
-
if (!base && !override) return void 0;
|
|
1262
|
-
if (!base) return override;
|
|
1263
|
-
if (!override) return base;
|
|
1264
|
-
return deepMerge(
|
|
1265
|
-
base,
|
|
1266
|
-
override
|
|
1267
|
-
);
|
|
1175
|
+
}
|
|
1176
|
+
return cssVars;
|
|
1268
1177
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
...(_c = DEFAULT_WIDGET_CONFIG.launcher) == null ? void 0 : _c.clearChat,
|
|
1286
|
-
...(_d = config.launcher) == null ? void 0 : _d.clearChat
|
|
1287
|
-
}
|
|
1178
|
+
|
|
1179
|
+
// src/utils/theme.ts
|
|
1180
|
+
var DARK_PALETTE = {
|
|
1181
|
+
colors: {
|
|
1182
|
+
primary: {
|
|
1183
|
+
50: "#ffffff",
|
|
1184
|
+
100: "#f5f5f5",
|
|
1185
|
+
200: "#d4d4d4",
|
|
1186
|
+
300: "#a3a3a3",
|
|
1187
|
+
400: "#737373",
|
|
1188
|
+
500: "#171717",
|
|
1189
|
+
600: "#0f0f0f",
|
|
1190
|
+
700: "#0a0a0a",
|
|
1191
|
+
800: "#050505",
|
|
1192
|
+
900: "#030303",
|
|
1193
|
+
950: "#000000"
|
|
1288
1194
|
},
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1195
|
+
secondary: {
|
|
1196
|
+
50: "#f5f3ff",
|
|
1197
|
+
100: "#ede9fe",
|
|
1198
|
+
200: "#ddd6fe",
|
|
1199
|
+
300: "#c4b5fd",
|
|
1200
|
+
400: "#a78bfa",
|
|
1201
|
+
500: "#8b5cf6",
|
|
1202
|
+
600: "#7c3aed",
|
|
1203
|
+
700: "#6d28d9",
|
|
1204
|
+
800: "#5b21b6",
|
|
1205
|
+
900: "#4c1d95",
|
|
1206
|
+
950: "#2e1065"
|
|
1292
1207
|
},
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1208
|
+
accent: {
|
|
1209
|
+
50: "#ecfeff",
|
|
1210
|
+
100: "#cffafe",
|
|
1211
|
+
200: "#a5f3fc",
|
|
1212
|
+
300: "#67e8f9",
|
|
1213
|
+
400: "#22d3ee",
|
|
1214
|
+
500: "#06b6d4",
|
|
1215
|
+
600: "#0891b2",
|
|
1216
|
+
700: "#0e7490",
|
|
1217
|
+
800: "#155e75",
|
|
1218
|
+
900: "#164e63",
|
|
1219
|
+
950: "#083344"
|
|
1296
1220
|
},
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1221
|
+
gray: {
|
|
1222
|
+
50: "#f9fafb",
|
|
1223
|
+
100: "#f3f4f6",
|
|
1224
|
+
200: "#e5e7eb",
|
|
1225
|
+
300: "#d1d5db",
|
|
1226
|
+
400: "#9ca3af",
|
|
1227
|
+
500: "#6b7280",
|
|
1228
|
+
600: "#4b5563",
|
|
1229
|
+
700: "#374151",
|
|
1230
|
+
800: "#1f2937",
|
|
1231
|
+
900: "#111827",
|
|
1232
|
+
950: "#030712"
|
|
1300
1233
|
},
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1234
|
+
success: {
|
|
1235
|
+
50: "#f0fdf4",
|
|
1236
|
+
100: "#dcfce7",
|
|
1237
|
+
200: "#bbf7d0",
|
|
1238
|
+
300: "#86efac",
|
|
1239
|
+
400: "#4ade80",
|
|
1240
|
+
500: "#22c55e",
|
|
1241
|
+
600: "#16a34a",
|
|
1242
|
+
700: "#15803d",
|
|
1243
|
+
800: "#166534",
|
|
1244
|
+
900: "#14532d"
|
|
1304
1245
|
},
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
...ca == null ? void 0 : ca.layout
|
|
1317
|
-
}
|
|
1318
|
-
};
|
|
1319
|
-
const mergedScrollToBottom = dsb === void 0 && csb === void 0 ? void 0 : {
|
|
1320
|
-
...dsb,
|
|
1321
|
-
...csb
|
|
1322
|
-
};
|
|
1323
|
-
return {
|
|
1324
|
-
...DEFAULT_WIDGET_CONFIG.features,
|
|
1325
|
-
...config.features,
|
|
1326
|
-
...mergedScrollToBottom !== void 0 ? { scrollToBottom: mergedScrollToBottom } : {},
|
|
1327
|
-
...mergedArtifacts !== void 0 ? { artifacts: mergedArtifacts } : {}
|
|
1328
|
-
};
|
|
1329
|
-
})(),
|
|
1330
|
-
suggestionChips: (_e = config.suggestionChips) != null ? _e : DEFAULT_WIDGET_CONFIG.suggestionChips,
|
|
1331
|
-
suggestionChipsConfig: {
|
|
1332
|
-
...DEFAULT_WIDGET_CONFIG.suggestionChipsConfig,
|
|
1333
|
-
...config.suggestionChipsConfig
|
|
1246
|
+
warning: {
|
|
1247
|
+
50: "#fefce8",
|
|
1248
|
+
100: "#fef9c3",
|
|
1249
|
+
200: "#fef08a",
|
|
1250
|
+
300: "#fde047",
|
|
1251
|
+
400: "#facc15",
|
|
1252
|
+
500: "#eab308",
|
|
1253
|
+
600: "#ca8a04",
|
|
1254
|
+
700: "#a16207",
|
|
1255
|
+
800: "#854d0e",
|
|
1256
|
+
900: "#713f12"
|
|
1334
1257
|
},
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1258
|
+
error: {
|
|
1259
|
+
50: "#fef2f2",
|
|
1260
|
+
100: "#fee2e2",
|
|
1261
|
+
200: "#fecaca",
|
|
1262
|
+
300: "#fca5a5",
|
|
1263
|
+
400: "#f87171",
|
|
1264
|
+
500: "#ef4444",
|
|
1265
|
+
600: "#dc2626",
|
|
1266
|
+
700: "#b91c1c",
|
|
1267
|
+
800: "#991b1b",
|
|
1268
|
+
900: "#7f1d1d"
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1272
|
+
var normalizeThemeConfig = (theme) => {
|
|
1273
|
+
if (!theme || typeof theme !== "object" || Array.isArray(theme)) return void 0;
|
|
1274
|
+
return theme;
|
|
1275
|
+
};
|
|
1276
|
+
var detectColorScheme = () => {
|
|
1277
|
+
var _a;
|
|
1278
|
+
if (typeof document !== "undefined" && document.documentElement.classList.contains("dark")) {
|
|
1279
|
+
return "dark";
|
|
1280
|
+
}
|
|
1281
|
+
if (typeof window !== "undefined" && ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches)) {
|
|
1282
|
+
return "dark";
|
|
1283
|
+
}
|
|
1284
|
+
return "light";
|
|
1285
|
+
};
|
|
1286
|
+
var getColorSchemeFromConfig = (config) => {
|
|
1287
|
+
var _a;
|
|
1288
|
+
const colorScheme = (_a = config == null ? void 0 : config.colorScheme) != null ? _a : "light";
|
|
1289
|
+
if (colorScheme === "light") return "light";
|
|
1290
|
+
if (colorScheme === "dark") return "dark";
|
|
1291
|
+
return detectColorScheme();
|
|
1292
|
+
};
|
|
1293
|
+
var getColorScheme = (config) => {
|
|
1294
|
+
return getColorSchemeFromConfig(config);
|
|
1295
|
+
};
|
|
1296
|
+
var createLightTheme = (userConfig) => {
|
|
1297
|
+
return createTheme(userConfig);
|
|
1298
|
+
};
|
|
1299
|
+
var createDarkTheme = (userConfig) => {
|
|
1300
|
+
var _a;
|
|
1301
|
+
const baseTheme = createTheme(void 0, { validate: false });
|
|
1302
|
+
return createTheme(
|
|
1303
|
+
{
|
|
1304
|
+
...userConfig,
|
|
1305
|
+
palette: {
|
|
1306
|
+
...baseTheme.palette,
|
|
1307
|
+
colors: {
|
|
1308
|
+
...DARK_PALETTE.colors,
|
|
1309
|
+
...(_a = userConfig == null ? void 0 : userConfig.palette) == null ? void 0 : _a.colors
|
|
1352
1310
|
}
|
|
1353
|
-
},
|
|
1354
|
-
slots: {
|
|
1355
|
-
...(_r = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _r.slots,
|
|
1356
|
-
...(_s = config.layout) == null ? void 0 : _s.slots
|
|
1357
|
-
}
|
|
1358
|
-
},
|
|
1359
|
-
markdown: {
|
|
1360
|
-
...DEFAULT_WIDGET_CONFIG.markdown,
|
|
1361
|
-
...config.markdown,
|
|
1362
|
-
options: {
|
|
1363
|
-
...(_t = DEFAULT_WIDGET_CONFIG.markdown) == null ? void 0 : _t.options,
|
|
1364
|
-
...(_u = config.markdown) == null ? void 0 : _u.options
|
|
1365
1311
|
}
|
|
1366
1312
|
},
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1313
|
+
{ validate: false }
|
|
1314
|
+
);
|
|
1315
|
+
};
|
|
1316
|
+
var getActiveTheme = (config) => {
|
|
1317
|
+
const scheme = getColorScheme(config);
|
|
1318
|
+
const lightThemeConfig = normalizeThemeConfig(config == null ? void 0 : config.theme);
|
|
1319
|
+
const darkThemeConfig = normalizeThemeConfig(config == null ? void 0 : config.darkTheme);
|
|
1320
|
+
if (scheme === "dark") {
|
|
1321
|
+
return createDarkTheme(
|
|
1322
|
+
deepMerge(
|
|
1323
|
+
lightThemeConfig != null ? lightThemeConfig : {},
|
|
1324
|
+
darkThemeConfig != null ? darkThemeConfig : {}
|
|
1325
|
+
)
|
|
1326
|
+
);
|
|
1327
|
+
}
|
|
1328
|
+
return createLightTheme(lightThemeConfig);
|
|
1329
|
+
};
|
|
1330
|
+
var getCssVariables = (theme) => {
|
|
1331
|
+
return themeToCssVariables(theme);
|
|
1332
|
+
};
|
|
1333
|
+
var applyThemeVariables = (element, config) => {
|
|
1334
|
+
var _a;
|
|
1335
|
+
const theme = getActiveTheme(config);
|
|
1336
|
+
const cssVars = getCssVariables(theme);
|
|
1337
|
+
for (const [name, value] of Object.entries(cssVars)) {
|
|
1338
|
+
element.style.setProperty(name, value);
|
|
1339
|
+
}
|
|
1340
|
+
const toolCallShadow = (_a = config == null ? void 0 : config.toolCall) == null ? void 0 : _a.shadow;
|
|
1341
|
+
if (toolCallShadow !== void 0) {
|
|
1342
|
+
element.style.setProperty(
|
|
1343
|
+
"--persona-tool-bubble-shadow",
|
|
1344
|
+
toolCallShadow.trim() === "" ? "none" : toolCallShadow
|
|
1345
|
+
);
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
var createThemeObserver = (callback) => {
|
|
1349
|
+
const cleanupFns = [];
|
|
1350
|
+
if (typeof document !== "undefined" && typeof MutationObserver !== "undefined") {
|
|
1351
|
+
const observer = new MutationObserver(() => {
|
|
1352
|
+
callback(detectColorScheme());
|
|
1353
|
+
});
|
|
1354
|
+
observer.observe(document.documentElement, {
|
|
1355
|
+
attributes: true,
|
|
1356
|
+
attributeFilter: ["class"]
|
|
1357
|
+
});
|
|
1358
|
+
cleanupFns.push(() => observer.disconnect());
|
|
1359
|
+
}
|
|
1360
|
+
if (typeof window !== "undefined" && window.matchMedia) {
|
|
1361
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1362
|
+
const handleChange = () => callback(detectColorScheme());
|
|
1363
|
+
if (mediaQuery.addEventListener) {
|
|
1364
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
1365
|
+
cleanupFns.push(() => mediaQuery.removeEventListener("change", handleChange));
|
|
1366
|
+
} else if (mediaQuery.addListener) {
|
|
1367
|
+
mediaQuery.addListener(handleChange);
|
|
1368
|
+
cleanupFns.push(() => mediaQuery.removeListener(handleChange));
|
|
1370
1369
|
}
|
|
1370
|
+
}
|
|
1371
|
+
return () => {
|
|
1372
|
+
cleanupFns.forEach((fn) => fn());
|
|
1371
1373
|
};
|
|
1372
|
-
}
|
|
1374
|
+
};
|
|
1373
1375
|
|
|
1374
1376
|
// src/theme-editor/state.ts
|
|
1375
1377
|
function getByPath(obj, path) {
|
|
@@ -2234,8 +2236,8 @@ var panelLayoutSectionDef = {
|
|
|
2234
2236
|
title: "Panel",
|
|
2235
2237
|
collapsed: false,
|
|
2236
2238
|
fields: [
|
|
2237
|
-
{ id: "panel-width", label: "Width", type: "text", path: "theme.components.panel.width", defaultValue:
|
|
2238
|
-
{ id: "panel-max-width", label: "Max Width", type: "text", path: "theme.components.panel.maxWidth", defaultValue:
|
|
2239
|
+
{ id: "panel-width", label: "Width", type: "text", path: "theme.components.panel.width", defaultValue: DEFAULT_FLOATING_LAUNCHER_WIDTH },
|
|
2240
|
+
{ id: "panel-max-width", label: "Max Width", type: "text", path: "theme.components.panel.maxWidth", defaultValue: DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH },
|
|
2239
2241
|
{ id: "panel-height", label: "Height", type: "text", path: "theme.components.panel.height", defaultValue: "600px" },
|
|
2240
2242
|
{ id: "panel-max-height", label: "Max Height", type: "text", path: "theme.components.panel.maxHeight", defaultValue: "calc(100vh - 80px)" },
|
|
2241
2243
|
{ id: "panel-border-radius", label: "Border Radius", type: "select", path: "theme.components.panel.borderRadius", defaultValue: "palette.radius.xl", options: [
|
|
@@ -2539,7 +2541,7 @@ var launcherBasicsSectionDef = {
|
|
|
2539
2541
|
{ id: "launch-enabled", label: "Enabled", type: "toggle", path: "launcher.enabled", defaultValue: true },
|
|
2540
2542
|
{ id: "launch-mount-mode", label: "Mount Mode", type: "select", path: "launcher.mountMode", defaultValue: "floating", options: [{ value: "floating", label: "Floating" }, { value: "docked", label: "Docked" }] },
|
|
2541
2543
|
{ id: "launch-position", label: "Position", type: "select", path: "launcher.position", defaultValue: "bottom-right", options: [{ value: "bottom-right", label: "Bottom Right" }, { value: "bottom-left", label: "Bottom Left" }, { value: "top-right", label: "Top Right" }, { value: "top-left", label: "Top Left" }] },
|
|
2542
|
-
{ id: "launch-width", label: "Width", type: "text", path: "launcher.width", defaultValue:
|
|
2544
|
+
{ id: "launch-width", label: "Width", type: "text", path: "launcher.width", defaultValue: DEFAULT_FLOATING_LAUNCHER_WIDTH },
|
|
2543
2545
|
{ id: "launch-auto-expand", label: "Auto Expand", type: "toggle", path: "launcher.autoExpand", defaultValue: false },
|
|
2544
2546
|
{ id: "launch-title", label: "Title", type: "text", path: "launcher.title", defaultValue: "Chat Assistant" },
|
|
2545
2547
|
{ id: "launch-subtitle", label: "Subtitle", type: "text", path: "launcher.subtitle", defaultValue: "Here to help you get answers fast" }
|
|
@@ -4253,6 +4255,7 @@ var AgentWidgetClient = class {
|
|
|
4253
4255
|
let assistantMessage = null;
|
|
4254
4256
|
const assistantMessageRef = { current: null };
|
|
4255
4257
|
const partIdState = { current: null };
|
|
4258
|
+
let didSplitByPartId = false;
|
|
4256
4259
|
const reasoningMessages = /* @__PURE__ */ new Map();
|
|
4257
4260
|
const toolMessages = /* @__PURE__ */ new Map();
|
|
4258
4261
|
const reasoningContext = {
|
|
@@ -4283,11 +4286,21 @@ var AgentWidgetClient = class {
|
|
|
4283
4286
|
(_g2 = (_f2 = (_e2 = (_d2 = (_c2 = (_b2 = (_a2 = payload.callId) != null ? _a2 : payload.call_id) != null ? _b2 : payload.requestId) != null ? _c2 : payload.request_id) != null ? _d2 : payload.toolCallId) != null ? _e2 : payload.tool_call_id) != null ? _f2 : payload.stepId) != null ? _g2 : payload.step_id
|
|
4284
4287
|
);
|
|
4285
4288
|
};
|
|
4289
|
+
const baseAssistantId = assistantMessageId;
|
|
4290
|
+
let assistantIdConsumed = false;
|
|
4286
4291
|
const ensureAssistantMessage = () => {
|
|
4287
4292
|
if (assistantMessage) return assistantMessage;
|
|
4293
|
+
let id;
|
|
4294
|
+
if (!assistantIdConsumed && baseAssistantId) {
|
|
4295
|
+
id = baseAssistantId;
|
|
4296
|
+
assistantIdConsumed = true;
|
|
4297
|
+
} else if (baseAssistantId && partIdState.current) {
|
|
4298
|
+
id = `${baseAssistantId}_${partIdState.current}`;
|
|
4299
|
+
} else {
|
|
4300
|
+
id = `assistant-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
4301
|
+
}
|
|
4288
4302
|
assistantMessage = {
|
|
4289
|
-
|
|
4290
|
-
id: assistantMessageId != null ? assistantMessageId : `assistant-${Date.now()}-${Math.random().toString(16).slice(2)}`,
|
|
4303
|
+
id,
|
|
4291
4304
|
role: "assistant",
|
|
4292
4305
|
content: "",
|
|
4293
4306
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -4656,13 +4669,51 @@ var AgentWidgetClient = class {
|
|
|
4656
4669
|
if (callKey) {
|
|
4657
4670
|
toolContext.byCall.delete(callKey);
|
|
4658
4671
|
}
|
|
4672
|
+
} else if (payloadType === "text_start") {
|
|
4673
|
+
const incomingPartId = payload.partId;
|
|
4674
|
+
if (incomingPartId !== void 0 && partIdState.current !== null && incomingPartId !== partIdState.current) {
|
|
4675
|
+
const prev = assistantMessage;
|
|
4676
|
+
if (prev) {
|
|
4677
|
+
prev.streaming = false;
|
|
4678
|
+
emitMessage(prev);
|
|
4679
|
+
assistantMessage = null;
|
|
4680
|
+
didSplitByPartId = true;
|
|
4681
|
+
}
|
|
4682
|
+
}
|
|
4683
|
+
if (incomingPartId !== void 0) {
|
|
4684
|
+
partIdState.current = incomingPartId;
|
|
4685
|
+
}
|
|
4686
|
+
} else if (payloadType === "text_end") {
|
|
4687
|
+
const prev = assistantMessage;
|
|
4688
|
+
if (prev) {
|
|
4689
|
+
prev.streaming = false;
|
|
4690
|
+
emitMessage(prev);
|
|
4691
|
+
assistantMessage = null;
|
|
4692
|
+
didSplitByPartId = true;
|
|
4693
|
+
}
|
|
4659
4694
|
} else if (payloadType === "step_chunk" || payloadType === "step_delta") {
|
|
4660
4695
|
const stepType = payload.stepType;
|
|
4661
4696
|
const executionType = payload.executionType;
|
|
4662
4697
|
if (stepType === "tool" || executionType === "context") {
|
|
4663
4698
|
continue;
|
|
4664
4699
|
}
|
|
4700
|
+
const incomingPartId = payload.partId;
|
|
4701
|
+
if (incomingPartId !== void 0 && partIdState.current !== null && incomingPartId !== partIdState.current) {
|
|
4702
|
+
const prev = assistantMessage;
|
|
4703
|
+
if (prev) {
|
|
4704
|
+
prev.streaming = false;
|
|
4705
|
+
emitMessage(prev);
|
|
4706
|
+
assistantMessage = null;
|
|
4707
|
+
didSplitByPartId = true;
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4710
|
+
if (incomingPartId !== void 0) {
|
|
4711
|
+
partIdState.current = incomingPartId;
|
|
4712
|
+
}
|
|
4665
4713
|
const assistant = ensureAssistantMessage();
|
|
4714
|
+
if (incomingPartId !== void 0 && !assistant.partId) {
|
|
4715
|
+
assistant.partId = incomingPartId;
|
|
4716
|
+
}
|
|
4666
4717
|
const chunk = (_ca = (_ba = (_aa = (_$ = payload.text) != null ? _$ : payload.delta) != null ? _aa : payload.content) != null ? _ba : payload.chunk) != null ? _ca : "";
|
|
4667
4718
|
if (chunk) {
|
|
4668
4719
|
const rawBuffer = (_da = rawContentBuffers.get(assistant.id)) != null ? _da : "";
|
|
@@ -4791,6 +4842,18 @@ var AgentWidgetClient = class {
|
|
|
4791
4842
|
if (stepType === "tool" || executionType === "context") {
|
|
4792
4843
|
continue;
|
|
4793
4844
|
}
|
|
4845
|
+
if (didSplitByPartId) {
|
|
4846
|
+
if (assistantMessage !== null) {
|
|
4847
|
+
const msg = assistantMessage;
|
|
4848
|
+
streamParsers.delete(msg.id);
|
|
4849
|
+
rawContentBuffers.delete(msg.id);
|
|
4850
|
+
if (msg.streaming !== false) {
|
|
4851
|
+
msg.streaming = false;
|
|
4852
|
+
emitMessage(msg);
|
|
4853
|
+
}
|
|
4854
|
+
}
|
|
4855
|
+
continue;
|
|
4856
|
+
}
|
|
4794
4857
|
const finalContent = (_ja = payload.result) == null ? void 0 : _ja.response;
|
|
4795
4858
|
const assistant = ensureAssistantMessage();
|
|
4796
4859
|
if (finalContent !== void 0 && finalContent !== null) {
|
|
@@ -4886,7 +4949,17 @@ var AgentWidgetClient = class {
|
|
|
4886
4949
|
}
|
|
4887
4950
|
} else if (payloadType === "flow_complete") {
|
|
4888
4951
|
const finalContent = (_ma = payload.result) == null ? void 0 : _ma.response;
|
|
4889
|
-
if (
|
|
4952
|
+
if (didSplitByPartId) {
|
|
4953
|
+
if (assistantMessage !== null) {
|
|
4954
|
+
const msg = assistantMessage;
|
|
4955
|
+
streamParsers.delete(msg.id);
|
|
4956
|
+
rawContentBuffers.delete(msg.id);
|
|
4957
|
+
if (msg.streaming !== false) {
|
|
4958
|
+
msg.streaming = false;
|
|
4959
|
+
emitMessage(msg);
|
|
4960
|
+
}
|
|
4961
|
+
}
|
|
4962
|
+
} else if (finalContent !== void 0 && finalContent !== null) {
|
|
4890
4963
|
const assistant = ensureAssistantMessage();
|
|
4891
4964
|
const rawBuffer = rawContentBuffers.get(assistant.id);
|
|
4892
4965
|
const stringContent = rawBuffer != null ? rawBuffer : ensureStringContent(finalContent);
|
|
@@ -9306,7 +9379,7 @@ var createWrapper = (config) => {
|
|
|
9306
9379
|
"persona-widget-panel persona-relative persona-min-h-[320px]"
|
|
9307
9380
|
);
|
|
9308
9381
|
const launcherWidth = (_i = (_h = config == null ? void 0 : config.launcher) == null ? void 0 : _h.width) != null ? _i : config == null ? void 0 : config.launcherWidth;
|
|
9309
|
-
const width = launcherWidth != null ? launcherWidth :
|
|
9382
|
+
const width = launcherWidth != null ? launcherWidth : DEFAULT_FLOATING_LAUNCHER_WIDTH;
|
|
9310
9383
|
panel.style.width = width;
|
|
9311
9384
|
panel.style.maxWidth = width;
|
|
9312
9385
|
wrapper.appendChild(panel);
|
|
@@ -14014,7 +14087,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
14014
14087
|
const mobileBreakpoint = (_g2 = (_f2 = config.launcher) == null ? void 0 : _f2.mobileBreakpoint) != null ? _g2 : 640;
|
|
14015
14088
|
if (mobileFullscreen && ownerWindow2.innerWidth <= mobileBreakpoint) return;
|
|
14016
14089
|
if (!shouldExpandLauncherForArtifacts(config, launcherEnabled)) return;
|
|
14017
|
-
const base = (_j2 = (_i2 = (_h2 = config.launcher) == null ? void 0 : _h2.width) != null ? _i2 : config.launcherWidth) != null ? _j2 :
|
|
14090
|
+
const base = (_j2 = (_i2 = (_h2 = config.launcher) == null ? void 0 : _h2.width) != null ? _i2 : config.launcherWidth) != null ? _j2 : DEFAULT_FLOATING_LAUNCHER_WIDTH;
|
|
14018
14091
|
const expanded = (_n2 = (_m2 = (_l2 = (_k2 = config.features) == null ? void 0 : _k2.artifacts) == null ? void 0 : _l2.layout) == null ? void 0 : _m2.expandedPanelWidth) != null ? _n2 : "min(720px, calc(100vw - 24px))";
|
|
14019
14092
|
const hasVisible = lastArtifactsState.artifacts.length > 0 && !artifactsPaneUserHidden;
|
|
14020
14093
|
if (hasVisible) {
|
|
@@ -14130,7 +14203,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
14130
14203
|
return;
|
|
14131
14204
|
}
|
|
14132
14205
|
const launcherWidth = (_r2 = (_q2 = config == null ? void 0 : config.launcher) == null ? void 0 : _q2.width) != null ? _r2 : config == null ? void 0 : config.launcherWidth;
|
|
14133
|
-
const width = launcherWidth != null ? launcherWidth :
|
|
14206
|
+
const width = launcherWidth != null ? launcherWidth : DEFAULT_FLOATING_LAUNCHER_WIDTH;
|
|
14134
14207
|
if (!sidebarMode && !dockedMode) {
|
|
14135
14208
|
if (isInlineEmbed && fullHeight) {
|
|
14136
14209
|
panel.style.width = "100%";
|
|
@@ -15650,7 +15723,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
|
|
|
15650
15723
|
}
|
|
15651
15724
|
if (!sidebarMode && !dockedMode) {
|
|
15652
15725
|
const launcherWidth = (_k2 = (_j2 = config == null ? void 0 : config.launcher) == null ? void 0 : _j2.width) != null ? _k2 : config == null ? void 0 : config.launcherWidth;
|
|
15653
|
-
const width = launcherWidth != null ? launcherWidth :
|
|
15726
|
+
const width = launcherWidth != null ? launcherWidth : DEFAULT_FLOATING_LAUNCHER_WIDTH;
|
|
15654
15727
|
panel.style.width = width;
|
|
15655
15728
|
panel.style.maxWidth = width;
|
|
15656
15729
|
}
|