@singlebase/elements 0.5.0 → 0.6.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/{authui-display-BCZBP7HR.js → authui-display-CKfGK5va.js} +519 -503
- package/dist/authui-display-CKfGK5va.js.map +1 -0
- package/dist/{authui-display-CLGFSqRi.cjs → authui-display-aWNht0cW.cjs} +38 -58
- package/dist/authui-display-aWNht0cW.cjs.map +1 -0
- package/dist/authui.cjs +1 -1
- package/dist/authui.js +2 -2
- package/dist/chat-C-gsskho.cjs +3258 -0
- package/dist/chat-C-gsskho.cjs.map +1 -0
- package/dist/{chat-bXaRWel7.js → chat-CEh6RygY.js} +1957 -1137
- package/dist/chat-CEh6RygY.js.map +1 -0
- package/dist/chat-messages.d.ts +11 -5
- package/dist/chat.cjs +1 -1
- package/dist/chat.d.ts +4 -3
- package/dist/chat.js +8 -6
- package/dist/elements/authui-base.d.ts +2 -0
- package/dist/elements/authui-buttons.d.ts +1 -1
- package/dist/elements/authui-display.d.ts +1 -1
- package/dist/elements/authui.d.ts +5 -1
- package/dist/elements/chat.d.ts +153 -10
- package/dist/elements/uploader.d.ts +14 -0
- package/dist/{files-BOwtpYyQ.js → files-DDJWPzZW.js} +82 -35
- package/dist/files-DDJWPzZW.js.map +1 -0
- package/dist/files-DyxcjZsx.cjs +75 -0
- package/dist/files-DyxcjZsx.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +24 -22
- package/dist/singlebase-elements.min.js +3799 -2892
- package/dist/singlebase-elements.min.js.map +1 -1
- package/dist/styles/branding.d.ts +5 -0
- package/dist/styles/tokens.d.ts +2 -0
- package/dist/{uploader-DGV2y9uT.cjs → uploader-660JIgIN.cjs} +53 -76
- package/dist/uploader-660JIgIN.cjs.map +1 -0
- package/dist/{uploader-abQoem5q.js → uploader-vfczkX51.js} +294 -271
- package/dist/uploader-vfczkX51.js.map +1 -0
- package/dist/uploader.cjs +1 -1
- package/dist/uploader.js +2 -2
- package/dist/utils/branding.d.ts +8 -0
- package/dist/utils/markdown.d.ts +69 -12
- package/dist/utils/svg.d.ts +10 -0
- package/package.json +3 -3
- package/dist/authui-display-BCZBP7HR.js.map +0 -1
- package/dist/authui-display-CLGFSqRi.cjs.map +0 -1
- package/dist/chat-DRenTJlI.cjs +0 -3001
- package/dist/chat-DRenTJlI.cjs.map +0 -1
- package/dist/chat-bXaRWel7.js.map +0 -1
- package/dist/files-BOwtpYyQ.js.map +0 -1
- package/dist/files-DW8A4Jl-.cjs +0 -38
- package/dist/files-DW8A4Jl-.cjs.map +0 -1
- package/dist/uploader-DGV2y9uT.cjs.map +0 -1
- package/dist/uploader-abQoem5q.js.map +0 -1
package/dist/chat-messages.d.ts
CHANGED
|
@@ -7,16 +7,12 @@
|
|
|
7
7
|
export interface SinglebaseChatMessages {
|
|
8
8
|
eyebrowChat: string;
|
|
9
9
|
eyebrowRag: string;
|
|
10
|
-
eyebrowRich: string;
|
|
11
10
|
headingChat: string;
|
|
12
11
|
headingRag: string;
|
|
13
|
-
headingRich: string;
|
|
14
12
|
descriptionChat: string;
|
|
15
13
|
descriptionRag: string;
|
|
16
|
-
descriptionRich: string;
|
|
17
14
|
placeholderChat: string;
|
|
18
15
|
placeholderRag: string;
|
|
19
|
-
placeholderRich: string;
|
|
20
16
|
footnote: string;
|
|
21
17
|
attach: string;
|
|
22
18
|
send: string;
|
|
@@ -26,7 +22,6 @@ export interface SinglebaseChatMessages {
|
|
|
26
22
|
dropSub: string;
|
|
27
23
|
thinking: string;
|
|
28
24
|
searching: string;
|
|
29
|
-
building: string;
|
|
30
25
|
chats: string;
|
|
31
26
|
newChat: string;
|
|
32
27
|
searchChats: string;
|
|
@@ -81,6 +76,17 @@ export interface SinglebaseChatMessages {
|
|
|
81
76
|
copyReference: string;
|
|
82
77
|
alsoCited: string;
|
|
83
78
|
close: string;
|
|
79
|
+
renderingChart: string;
|
|
80
|
+
renderingSvg: string;
|
|
81
|
+
copySvg: string;
|
|
82
|
+
showRaw: string;
|
|
83
|
+
showFormatted: string;
|
|
84
|
+
showingRows: string;
|
|
85
|
+
calloutNote: string;
|
|
86
|
+
calloutTip: string;
|
|
87
|
+
calloutImportant: string;
|
|
88
|
+
calloutWarning: string;
|
|
89
|
+
calloutCaution: string;
|
|
84
90
|
undo: string;
|
|
85
91
|
chatDeleted: string;
|
|
86
92
|
messageDeleted: string;
|
package/dist/chat.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chat-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chat-C-gsskho.cjs");Object.defineProperty(exports,"SinglebaseChat",{enumerable:!0,get:()=>e.SinglebaseChat});exports.adaptBlocks=e.adaptBlocks;exports.citedNumbers=e.citedNumbers;exports.defaultChatMessages=e.defaultChatMessages;exports.describeSource=e.describeSource;exports.parseInline=e.parseInline;exports.parseMarkdown=e.parseMarkdown;exports.resolveChatMessages=e.resolveChatMessages;exports.settleStreaming=e.settleStreaming;exports.splitFollowups=e.splitFollowups;exports.svgDataUrl=e.svgDataUrl;
|
|
2
2
|
//# sourceMappingURL=chat.cjs.map
|
package/dist/chat.d.ts
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* authentication elements or the uploader. Importing it registers the tag.
|
|
4
4
|
*/
|
|
5
5
|
export { SinglebaseChat, describeSource } from "./elements/chat.js";
|
|
6
|
-
export type { ChatAttachment, ChatClient, ChatConfig, ChatEmbed, ChatExportFormat, ChatGlow, ChatMessage, ChatMode, ChatPrompt, ChatSummary } from "./elements/chat.js";
|
|
7
|
-
export { adaptBlocks, citedNumbers, parseInline, parseMarkdown, splitFollowups } from "./utils/markdown.js";
|
|
8
|
-
export
|
|
6
|
+
export type { ChatAfterParse, ChatAttachment, ChatBeforeSend, ChatBlockRenderer, ChatClient, ChatConfig, ChatEmbed, ChatExportFormat, ChatGlow, ChatMessage, ChatMode, ChatPrompt, ChatSidebar, ChatSummary } from "./elements/chat.js";
|
|
7
|
+
export { adaptBlocks, citedNumbers, parseInline, parseMarkdown, settleStreaming, splitFollowups } from "./utils/markdown.js";
|
|
8
|
+
export { svgDataUrl } from "./utils/svg.js";
|
|
9
|
+
export type { Block, ChartSpec, ChatFormat, Segment } from "./utils/markdown.js";
|
|
9
10
|
export { defaultChatMessages, resolveChatMessages } from "./chat-messages.js";
|
|
10
11
|
export type { SinglebaseChatMessages } from "./chat-messages.js";
|
package/dist/chat.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { S as e, a as r, c as
|
|
1
|
+
import { S as e, a as r, c as t, d as l, b as o, p, e as d, r as g, s as i, f as c, g as n } from "./chat-CEh6RygY.js";
|
|
2
2
|
export {
|
|
3
3
|
e as SinglebaseChat,
|
|
4
4
|
r as adaptBlocks,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
t as citedNumbers,
|
|
6
|
+
l as defaultChatMessages,
|
|
7
|
+
o as describeSource,
|
|
8
8
|
p as parseInline,
|
|
9
9
|
d as parseMarkdown,
|
|
10
|
-
|
|
11
|
-
i as
|
|
10
|
+
g as resolveChatMessages,
|
|
11
|
+
i as settleStreaming,
|
|
12
|
+
c as splitFollowups,
|
|
13
|
+
n as svgDataUrl
|
|
12
14
|
};
|
|
13
15
|
//# sourceMappingURL=chat.js.map
|
|
@@ -27,6 +27,8 @@ export declare abstract class SinglebaseElementBase extends LitElement {
|
|
|
27
27
|
* same reason as theme/density — the CSS is an attribute selector.
|
|
28
28
|
*/
|
|
29
29
|
accessor fieldStyle: "outline" | "underline" | undefined;
|
|
30
|
+
/** Corner preset for this element: `sharp`, `default` or `round`. */
|
|
31
|
+
accessor radius: "sharp" | "default" | "round" | undefined;
|
|
30
32
|
protected auth: AuthController;
|
|
31
33
|
/**
|
|
32
34
|
* Resolution order: an explicit `.client`, then the page's default
|
|
@@ -36,7 +36,7 @@ export declare class SinglebaseAuthButtons extends SinglebaseFormBase {
|
|
|
36
36
|
private renderLink;
|
|
37
37
|
private onSignOut;
|
|
38
38
|
private renderSignOut;
|
|
39
|
-
protected render(): import("lit").TemplateResult<1
|
|
39
|
+
protected render(): typeof nothing | import("lit").TemplateResult<1>;
|
|
40
40
|
}
|
|
41
41
|
declare global {
|
|
42
42
|
interface HTMLElementTagNameMap {
|
|
@@ -41,7 +41,7 @@ export declare class SinglebaseAuthDisplay extends SinglebaseElementBase {
|
|
|
41
41
|
/** The resolved value as a string, or "" when there is nothing to show. */
|
|
42
42
|
private get textValue();
|
|
43
43
|
private get avatarSrc();
|
|
44
|
-
protected render(): import("lit").TemplateResult<1
|
|
44
|
+
protected render(): typeof nothing | import("lit").TemplateResult<1>;
|
|
45
45
|
private renderAvatar;
|
|
46
46
|
}
|
|
47
47
|
declare global {
|
|
@@ -70,6 +70,10 @@ export declare class SinglebaseAuthScreen extends SinglebaseElementBase {
|
|
|
70
70
|
* thing that fails a security review, and deservedly.
|
|
71
71
|
*/
|
|
72
72
|
accessor branding: boolean;
|
|
73
|
+
/** The credit's text. Empty uses the element's default ("… by Singlebase"). */
|
|
74
|
+
accessor brandingText: string;
|
|
75
|
+
/** Where the credit links to. Only http(s); anything else uses singlebase.cloud. */
|
|
76
|
+
accessor brandingUrl: string;
|
|
73
77
|
/**
|
|
74
78
|
* Where to send the user once a session exists. Same-origin only — an
|
|
75
79
|
* absolute URL pointing anywhere else is refused, because a login widget
|
|
@@ -206,7 +210,7 @@ export declare class SinglebaseAuthScreen extends SinglebaseElementBase {
|
|
|
206
210
|
private onInterstitialSignOut;
|
|
207
211
|
/** The Terms/Privacy consent line, rendered only when the host supplies a link. */
|
|
208
212
|
private renderConsent;
|
|
209
|
-
protected render(): import("lit").TemplateResult<1
|
|
213
|
+
protected render(): typeof nothing | import("lit").TemplateResult<1>;
|
|
210
214
|
}
|
|
211
215
|
declare global {
|
|
212
216
|
interface HTMLElementTagNameMap {
|
package/dist/elements/chat.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { LitElement, type PropertyValues, type TemplateResult } from "lit";
|
|
2
2
|
import { type SinglebaseChatMessages } from "../chat-messages.js";
|
|
3
|
-
import { type
|
|
4
|
-
export type ChatMode = "chat" | "rag"
|
|
3
|
+
import { type Block, type ChatFormat } from "../utils/markdown.js";
|
|
4
|
+
export type ChatMode = "chat" | "rag";
|
|
5
5
|
export type ChatEmbed = "page" | "inline" | "launcher";
|
|
6
6
|
export type ChatGlow = "subtle" | "vivid" | "off";
|
|
7
7
|
export type ChatExportFormat = "md" | "txt" | "json" | "copy";
|
|
8
|
+
/** `auto` docks when there's room; `none` removes the list and its toggle. */
|
|
9
|
+
export type ChatSidebar = "auto" | "open" | "closed" | "none";
|
|
8
10
|
/** What the chat needs from a client: `llm.call`, and nothing else. */
|
|
9
11
|
export type ChatClient = {
|
|
10
12
|
llm: {
|
|
@@ -49,31 +51,78 @@ export interface ChatMessage {
|
|
|
49
51
|
execTime?: number;
|
|
50
52
|
model?: string;
|
|
51
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Draws a fenced block the host knows about, e.g. ```order {"id":"A-1"}```.
|
|
56
|
+
* Return a Lit template, a DOM node or text; return null to fall back to code.
|
|
57
|
+
*/
|
|
58
|
+
export type ChatBlockRenderer = (source: string, context: {
|
|
59
|
+
lang: string;
|
|
60
|
+
message: ChatMessage;
|
|
61
|
+
}) => unknown;
|
|
62
|
+
/**
|
|
63
|
+
* Runs before each message is sent. Return the payload (changed or not), a new
|
|
64
|
+
* payload, or `false` to cancel. Anything else stops the send.
|
|
65
|
+
*/
|
|
66
|
+
export type ChatBeforeSend = (payload: Record<string, unknown>, context: {
|
|
67
|
+
chatId: string | null;
|
|
68
|
+
isNew: boolean;
|
|
69
|
+
message: ChatMessage;
|
|
70
|
+
}) => Record<string, unknown> | false | Promise<Record<string, unknown> | false>;
|
|
71
|
+
/** Runs after a reply is parsed. Return the blocks to draw. */
|
|
72
|
+
export type ChatAfterParse = (blocks: Block[], context: {
|
|
73
|
+
message: ChatMessage;
|
|
74
|
+
format: ChatFormat;
|
|
75
|
+
}) => Block[];
|
|
52
76
|
export interface ChatPrompt {
|
|
53
77
|
label?: string;
|
|
54
78
|
text: string;
|
|
55
79
|
}
|
|
56
80
|
/** Every setting in one object, keyed by property name. */
|
|
57
81
|
export interface ChatConfig {
|
|
82
|
+
/** The client to chat with. Defaults to the page's SinglebaseClient(). */
|
|
83
|
+
client: ChatClient | null;
|
|
84
|
+
/** Opens this saved chat. */
|
|
85
|
+
chatId: string;
|
|
58
86
|
embed: ChatEmbed;
|
|
59
87
|
mode: ChatMode;
|
|
60
|
-
|
|
88
|
+
format: ChatFormat;
|
|
89
|
+
renderers: Record<string, ChatBlockRenderer>;
|
|
90
|
+
beforeSend: ChatBeforeSend | null;
|
|
91
|
+
afterParse: ChatAfterParse | null;
|
|
61
92
|
glow: ChatGlow;
|
|
62
93
|
position: "right" | "left";
|
|
63
|
-
sidebar:
|
|
94
|
+
sidebar: ChatSidebar;
|
|
64
95
|
showTitle: boolean;
|
|
65
96
|
assistantName: string;
|
|
66
97
|
logoUrl: string;
|
|
67
98
|
heading: string;
|
|
68
99
|
description: string;
|
|
100
|
+
eyebrow: string;
|
|
69
101
|
prompts: string | (string | ChatPrompt)[];
|
|
70
102
|
bubbleText: string;
|
|
71
103
|
greetingBubble: boolean;
|
|
72
104
|
unreadBadge: boolean;
|
|
73
105
|
allowUpload: boolean;
|
|
74
106
|
allowExport: boolean;
|
|
107
|
+
allowRaw: boolean;
|
|
108
|
+
allowCopy: boolean;
|
|
109
|
+
allowRegenerate: boolean;
|
|
110
|
+
allowBookmark: boolean;
|
|
111
|
+
allowDelete: boolean;
|
|
112
|
+
allowRename: boolean;
|
|
113
|
+
allowFeedback: boolean;
|
|
114
|
+
showTime: boolean;
|
|
115
|
+
showComposer: boolean;
|
|
116
|
+
footnote: string;
|
|
117
|
+
brandingText: string;
|
|
118
|
+
brandingUrl: string;
|
|
75
119
|
branding: boolean;
|
|
76
120
|
followups: boolean;
|
|
121
|
+
showFollowups: boolean;
|
|
122
|
+
showSources: boolean;
|
|
123
|
+
showNewChat: boolean;
|
|
124
|
+
showBookmarked: boolean;
|
|
125
|
+
allowSearch: boolean;
|
|
77
126
|
autoTitle: boolean;
|
|
78
127
|
model: string;
|
|
79
128
|
params: Record<string, unknown>;
|
|
@@ -82,6 +131,7 @@ export interface ChatConfig {
|
|
|
82
131
|
metadata: Record<string, unknown>;
|
|
83
132
|
messages: Partial<SinglebaseChatMessages>;
|
|
84
133
|
theme: "light" | "dark";
|
|
134
|
+
radius: "sharp" | "default" | "round";
|
|
85
135
|
}
|
|
86
136
|
/** A readable view of whatever shape the server recorded for a source. */
|
|
87
137
|
export declare function describeSource(source: Record<string, unknown>, n: number): {
|
|
@@ -111,13 +161,39 @@ export declare class SinglebaseChat extends LitElement {
|
|
|
111
161
|
accessor client: ChatClient | null;
|
|
112
162
|
accessor messages: Partial<SinglebaseChatMessages>;
|
|
113
163
|
accessor theme: "light" | "dark" | undefined;
|
|
164
|
+
/** Corner preset for this element: `sharp`, `default` or `round`. */
|
|
165
|
+
accessor radius: "sharp" | "default" | "round" | undefined;
|
|
114
166
|
/** `chat` free-form, `rag` grounded with citations, `rich` charts and tables. */
|
|
115
167
|
accessor mode: ChatMode;
|
|
116
|
-
/**
|
|
117
|
-
|
|
168
|
+
/**
|
|
169
|
+
* How much of a reply is formatted: `raw` (the text as written), `plain`
|
|
170
|
+
* (light formatting), `advanced` (+ tables, CSV, JSON and SVG) or `rich`
|
|
171
|
+
* (+ callouts, charts, images and `renderers`). Copy and export always use
|
|
172
|
+
* the original text.
|
|
173
|
+
*/
|
|
174
|
+
accessor format: ChatFormat;
|
|
175
|
+
/** Your own fenced blocks, by language. Drawn at the `rich` level. */
|
|
176
|
+
accessor renderers: Record<string, ChatBlockRenderer>;
|
|
177
|
+
/**
|
|
178
|
+
* Preflight for every message: gets the `llm.chat` payload, returns it
|
|
179
|
+
* (changed or not), or `false` to cancel. May be async.
|
|
180
|
+
*/
|
|
181
|
+
accessor beforeSend: ChatBeforeSend | null;
|
|
182
|
+
/** Rewrites a reply's parsed blocks before they're drawn. Returns the blocks. */
|
|
183
|
+
accessor afterParse: ChatAfterParse | null;
|
|
118
184
|
accessor glow: ChatGlow;
|
|
119
|
-
/** Ask for follow-up questions with each reply. */
|
|
185
|
+
/** Ask the model for follow-up questions with each reply. */
|
|
120
186
|
accessor followups: boolean;
|
|
187
|
+
/** The "Cited sources" cards and the "Searched n sources" row under answers. */
|
|
188
|
+
accessor showSources: boolean;
|
|
189
|
+
/** The New chat button. */
|
|
190
|
+
accessor showNewChat: boolean;
|
|
191
|
+
/** The pinned "Bookmarked" group in the chat list. */
|
|
192
|
+
accessor showBookmarked: boolean;
|
|
193
|
+
/** Show the follow-up questions under the latest reply. */
|
|
194
|
+
accessor showFollowups: boolean;
|
|
195
|
+
/** The search box in the chat list. */
|
|
196
|
+
accessor allowSearch: boolean;
|
|
121
197
|
/** Replace the provisional title with a model-written one after the first reply. */
|
|
122
198
|
accessor autoTitle: boolean;
|
|
123
199
|
/** Model for new turns; empty uses the chat's, then the project default. */
|
|
@@ -132,8 +208,11 @@ export declare class SinglebaseChat extends LitElement {
|
|
|
132
208
|
accessor embed: ChatEmbed;
|
|
133
209
|
/** Launcher side. */
|
|
134
210
|
accessor position: "right" | "left";
|
|
135
|
-
/**
|
|
136
|
-
|
|
211
|
+
/**
|
|
212
|
+
* The chat list: `auto` docks it when there's room, `open` / `closed` set
|
|
213
|
+
* how it starts, `none` removes it and its toggle entirely.
|
|
214
|
+
*/
|
|
215
|
+
accessor sidebar: ChatSidebar;
|
|
137
216
|
accessor showTitle: boolean;
|
|
138
217
|
/** Opens this chat on load. */
|
|
139
218
|
accessor chatIdAttr: string;
|
|
@@ -142,15 +221,50 @@ export declare class SinglebaseChat extends LitElement {
|
|
|
142
221
|
accessor logoUrl: string;
|
|
143
222
|
accessor heading: string;
|
|
144
223
|
accessor description: string;
|
|
145
|
-
/**
|
|
224
|
+
/** The small label above the heading. Unset uses the mode's; `""` hides it. */
|
|
225
|
+
accessor eyebrow: string | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* Suggested prompts: `|`-separated in markup, an array in JavaScript.
|
|
228
|
+
* `"none"` or `[]` shows no suggestions.
|
|
229
|
+
*/
|
|
146
230
|
accessor prompts: string | (string | ChatPrompt)[];
|
|
147
231
|
accessor bubbleText: string;
|
|
148
232
|
accessor greetingBubble: boolean;
|
|
149
233
|
accessor unreadBadge: boolean;
|
|
150
234
|
accessor allowUpload: boolean;
|
|
151
235
|
accessor allowExport: boolean;
|
|
236
|
+
/** Copy buttons on messages. */
|
|
237
|
+
accessor allowCopy: boolean;
|
|
238
|
+
/** Regenerate on the latest reply. */
|
|
239
|
+
accessor allowRegenerate: boolean;
|
|
240
|
+
/** Bookmark buttons for chats and messages. */
|
|
241
|
+
accessor allowBookmark: boolean;
|
|
242
|
+
/** Delete buttons for chats and messages. */
|
|
243
|
+
accessor allowDelete: boolean;
|
|
244
|
+
/** Renaming a chat from its title or the chat list. */
|
|
245
|
+
accessor allowRename: boolean;
|
|
246
|
+
/** The helpful / not helpful buttons on replies. */
|
|
247
|
+
accessor allowFeedback: boolean;
|
|
248
|
+
/**
|
|
249
|
+
* The message box. Off, the chat only shows the conversation — pair it with
|
|
250
|
+
* `chat-id` to display a saved chat read-only.
|
|
251
|
+
*/
|
|
252
|
+
accessor showComposer: boolean;
|
|
253
|
+
/** Message times in the toolbars. */
|
|
254
|
+
accessor showTime: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* The line under the composer. Unset uses the default ("{name} can make
|
|
257
|
+
* mistakes…"); an empty string hides it.
|
|
258
|
+
*/
|
|
259
|
+
accessor footnote: string | undefined;
|
|
260
|
+
/** A per-reply toggle between the formatted answer and the text as written. */
|
|
261
|
+
accessor allowRaw: boolean;
|
|
152
262
|
/** The "Chat by Singlebase" credit. A plain link — it makes no request. */
|
|
153
263
|
accessor branding: boolean;
|
|
264
|
+
/** The credit's text. Empty uses the element's default ("… by Singlebase"). */
|
|
265
|
+
accessor brandingText: string;
|
|
266
|
+
/** Where the credit links to. Only http(s); anything else uses singlebase.cloud. */
|
|
267
|
+
accessor brandingUrl: string;
|
|
154
268
|
private accessor chatList;
|
|
155
269
|
private accessor listState;
|
|
156
270
|
private accessor activeId;
|
|
@@ -174,6 +288,9 @@ export declare class SinglebaseChat extends LitElement {
|
|
|
174
288
|
private accessor toast;
|
|
175
289
|
private accessor copiedKey;
|
|
176
290
|
private accessor retrievalOpen;
|
|
291
|
+
private accessor rawKeys;
|
|
292
|
+
private accessor hasSidebarContent;
|
|
293
|
+
private accessor sorts;
|
|
177
294
|
private accessor arrivedKey;
|
|
178
295
|
private accessor dragging;
|
|
179
296
|
private accessor showJump;
|
|
@@ -195,6 +312,7 @@ export declare class SinglebaseChat extends LitElement {
|
|
|
195
312
|
private media;
|
|
196
313
|
private focusNext;
|
|
197
314
|
private bubbleScheduled;
|
|
315
|
+
private pendingChatId;
|
|
198
316
|
get msg(): SinglebaseChatMessages;
|
|
199
317
|
/** An explicit `.client`, else the page default. */
|
|
200
318
|
get resolvedClient(): ChatClient | null;
|
|
@@ -202,9 +320,26 @@ export declare class SinglebaseChat extends LitElement {
|
|
|
202
320
|
get chatId(): string | null;
|
|
203
321
|
/** The open conversation's messages. */
|
|
204
322
|
get thread(): readonly ChatMessage[];
|
|
323
|
+
/** `format`, falling back to the default for anything unknown. */
|
|
324
|
+
private get formatLevel();
|
|
205
325
|
/** The loaded chat list. */
|
|
206
326
|
get chats(): readonly ChatSummary[];
|
|
327
|
+
/**
|
|
328
|
+
* Every setting in one object, keyed by property name:
|
|
329
|
+
*
|
|
330
|
+
* chat.config = { client, mode: "rag", format: "rich", retrieval: [...], chatId: "…" };
|
|
331
|
+
*
|
|
332
|
+
* Unknown keys are ignored. `chatId` opens that chat; reading `config`
|
|
333
|
+
* returns the current settings with `chatId` as the open chat.
|
|
334
|
+
*/
|
|
207
335
|
set config(value: Partial<ChatConfig>);
|
|
336
|
+
/**
|
|
337
|
+
* Changes settings on the fly. Only the keys you pass change; the chat keeps
|
|
338
|
+
* its conversation and re-renders in place. Returns the element, so calls chain.
|
|
339
|
+
*
|
|
340
|
+
* chat.configure({ format: "rich" }).configure({ theme: "dark" });
|
|
341
|
+
*/
|
|
342
|
+
configure(options: Partial<ChatConfig>): this;
|
|
208
343
|
get config(): Partial<ChatConfig>;
|
|
209
344
|
connectedCallback(): void;
|
|
210
345
|
disconnectedCallback(): void;
|
|
@@ -264,6 +399,7 @@ export declare class SinglebaseChat extends LitElement {
|
|
|
264
399
|
private regenerate;
|
|
265
400
|
private retry;
|
|
266
401
|
private saveEdit;
|
|
402
|
+
private toggleRaw;
|
|
267
403
|
private copy;
|
|
268
404
|
private toggleMessageBookmark;
|
|
269
405
|
private toggleChatBookmark;
|
|
@@ -292,6 +428,7 @@ export declare class SinglebaseChat extends LitElement {
|
|
|
292
428
|
private renderThreadRow;
|
|
293
429
|
private renderHeader;
|
|
294
430
|
private renderExportMenu;
|
|
431
|
+
/** The suggestion cards. `[]` or `"none"` shows none; unset uses the mode's. */
|
|
295
432
|
private promptList;
|
|
296
433
|
private renderWelcome;
|
|
297
434
|
private renderThread;
|
|
@@ -301,6 +438,12 @@ export declare class SinglebaseChat extends LitElement {
|
|
|
301
438
|
private renderAnswer;
|
|
302
439
|
private renderInline;
|
|
303
440
|
private renderBlock;
|
|
441
|
+
private renderList;
|
|
442
|
+
private renderCode;
|
|
443
|
+
/** A host renderer for this language, at the rich level only. */
|
|
444
|
+
private renderCustom;
|
|
445
|
+
private renderTable;
|
|
446
|
+
private renderJsonBlock;
|
|
304
447
|
private renderChart;
|
|
305
448
|
private renderPanel;
|
|
306
449
|
private renderComposer;
|
|
@@ -50,6 +50,8 @@ export interface UploaderConfig {
|
|
|
50
50
|
allowRename: boolean;
|
|
51
51
|
autoUpload: boolean;
|
|
52
52
|
branding: boolean;
|
|
53
|
+
brandingText: string;
|
|
54
|
+
brandingUrl: string;
|
|
53
55
|
logoUrl: string;
|
|
54
56
|
logoText: string;
|
|
55
57
|
heading: string;
|
|
@@ -67,6 +69,7 @@ export interface UploaderConfig {
|
|
|
67
69
|
messages: Partial<SinglebaseUploadMessages>;
|
|
68
70
|
theme: "light" | "dark";
|
|
69
71
|
density: "comfortable" | "compact";
|
|
72
|
+
radius: "sharp" | "default" | "round";
|
|
70
73
|
onComplete: SinglebaseUploader["onComplete"];
|
|
71
74
|
onError: SinglebaseUploader["onError"];
|
|
72
75
|
}
|
|
@@ -93,6 +96,8 @@ export declare class SinglebaseUploader extends LitElement {
|
|
|
93
96
|
accessor messages: Partial<SinglebaseUploadMessages>;
|
|
94
97
|
accessor theme: "light" | "dark" | undefined;
|
|
95
98
|
accessor density: "comfortable" | "compact" | undefined;
|
|
99
|
+
/** Corner preset for this element: `sharp`, `default` or `round`. */
|
|
100
|
+
accessor radius: "sharp" | "default" | "round" | undefined;
|
|
96
101
|
/**
|
|
97
102
|
* `full` is the card with a dropzone and a reviewable list, `compact` the
|
|
98
103
|
* one-line attachments row, `button` a single control that uploads as soon
|
|
@@ -107,6 +112,10 @@ export declare class SinglebaseUploader extends LitElement {
|
|
|
107
112
|
accessor autoUpload: boolean;
|
|
108
113
|
/** The "Files by Singlebase" credit. A plain link — it makes no request. */
|
|
109
114
|
accessor branding: boolean;
|
|
115
|
+
/** The credit's text. Empty uses the element's default ("… by Singlebase"). */
|
|
116
|
+
accessor brandingText: string;
|
|
117
|
+
/** Where the credit links to. Only http(s); anything else uses singlebase.cloud. */
|
|
118
|
+
accessor brandingUrl: string;
|
|
110
119
|
accessor logoUrl: string;
|
|
111
120
|
accessor logoText: string;
|
|
112
121
|
accessor heading: string;
|
|
@@ -168,6 +177,11 @@ export declare class SinglebaseUploader extends LitElement {
|
|
|
168
177
|
* Unknown keys are ignored. Reading it returns the current settings.
|
|
169
178
|
*/
|
|
170
179
|
set config(value: Partial<UploaderConfig>);
|
|
180
|
+
/**
|
|
181
|
+
* Changes settings on the fly. Only the keys you pass change; staged files
|
|
182
|
+
* stay. Returns the element, so calls chain.
|
|
183
|
+
*/
|
|
184
|
+
configure(options: Partial<UploaderConfig>): this;
|
|
171
185
|
get config(): Partial<UploaderConfig>;
|
|
172
186
|
/** Drops every staged file and any notice. */
|
|
173
187
|
clear(): void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { unsafeCSS as i, css as
|
|
1
|
+
import { unsafeCSS as i, css as f, nothing as l, html as p } from "lit";
|
|
2
2
|
const d = {
|
|
3
3
|
font: '"Geist", -apple-system, "Segoe UI", Helvetica, sans-serif',
|
|
4
4
|
mono: '"Geist Mono", ui-monospace, monospace',
|
|
5
5
|
accent: "#111111",
|
|
6
6
|
onAccent: "#ffffff",
|
|
7
7
|
radius: "4px",
|
|
8
|
+
/** Multiplies every corner. The `radius` attribute sets it per element. */
|
|
9
|
+
radiusScale: "1",
|
|
8
10
|
surface: "#ffffff",
|
|
9
11
|
surfaceAlt: "#fafafa",
|
|
10
12
|
ink: "#16181a",
|
|
@@ -23,7 +25,7 @@ const d = {
|
|
|
23
25
|
gap: "16px",
|
|
24
26
|
pad: "20px",
|
|
25
27
|
fieldPad: "11px 13px"
|
|
26
|
-
},
|
|
28
|
+
}, m = f`
|
|
27
29
|
:host {
|
|
28
30
|
display: block;
|
|
29
31
|
box-sizing: border-box;
|
|
@@ -54,12 +56,55 @@ const d = {
|
|
|
54
56
|
--sb-ok-border: rgba(111, 209, 166, 0.28);
|
|
55
57
|
}
|
|
56
58
|
|
|
59
|
+
/* Corner presets. They set the scale on this element only, so a page-wide
|
|
60
|
+
:root { --sb-radius-scale } (or --sb-radius) applies to every element
|
|
61
|
+
that doesn't carry the attribute. */
|
|
62
|
+
:host([radius="sharp"]) {
|
|
63
|
+
--sb-radius-scale: 0.35;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:host([radius="default"]) {
|
|
67
|
+
--sb-radius-scale: 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:host([radius="round"]) {
|
|
71
|
+
--sb-radius-scale: 1.8;
|
|
72
|
+
}
|
|
73
|
+
|
|
57
74
|
:host([density="compact"]) {
|
|
58
75
|
--sb-gap: 12px;
|
|
59
76
|
--sb-pad: 16px;
|
|
60
77
|
--sb-field-pad: 9px 11px;
|
|
61
78
|
}
|
|
62
|
-
`,
|
|
79
|
+
`, x = f`
|
|
80
|
+
.branding {
|
|
81
|
+
text-align: center;
|
|
82
|
+
font-family: var(--sb-mono, "Geist Mono", ui-monospace, monospace);
|
|
83
|
+
font-size: 10.5px;
|
|
84
|
+
line-height: 1.4;
|
|
85
|
+
letter-spacing: 0.06em;
|
|
86
|
+
color: var(--sb-muted-ink, #61666c);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.branding a {
|
|
90
|
+
color: inherit;
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.branding a:hover {
|
|
95
|
+
color: var(--sb-ink, #16181a);
|
|
96
|
+
text-decoration: underline;
|
|
97
|
+
text-underline-offset: 3px;
|
|
98
|
+
}
|
|
99
|
+
`, b = "https://singlebase.cloud";
|
|
100
|
+
function k(e, r, a, n) {
|
|
101
|
+
if (!e) return l;
|
|
102
|
+
const t = /^https?:\/\//i.test((n == null ? void 0 : n.trim()) ?? "") ? n.trim() : b;
|
|
103
|
+
return p`<div class="branding" part="branding">
|
|
104
|
+
<a href=${t} target="_blank" rel="noopener noreferrer">${(r == null ? void 0 : r.trim()) || a}</a>
|
|
105
|
+
</div>`;
|
|
106
|
+
}
|
|
107
|
+
const c = {
|
|
63
108
|
heading: "Upload files",
|
|
64
109
|
description: "Add one or more files. You can review the list before uploading.",
|
|
65
110
|
dropTitle: "Drag and drop files here",
|
|
@@ -93,46 +138,46 @@ const d = {
|
|
|
93
138
|
errTooManyPages: "{name} has {pages} pages; the limit is {max}.",
|
|
94
139
|
brandingLabel: "Files by Singlebase"
|
|
95
140
|
};
|
|
96
|
-
function
|
|
97
|
-
return e ? { ...
|
|
141
|
+
function C(e) {
|
|
142
|
+
return e ? { ...c, ...e } : c;
|
|
98
143
|
}
|
|
99
|
-
function
|
|
144
|
+
function y(e, r) {
|
|
100
145
|
return e.replace(
|
|
101
146
|
/\{(\w+)\}/g,
|
|
102
147
|
(a, n) => n in r ? String(r[n]) : a
|
|
103
148
|
);
|
|
104
149
|
}
|
|
105
|
-
const
|
|
150
|
+
const u = {
|
|
106
151
|
b: 1,
|
|
107
152
|
kb: 1024,
|
|
108
153
|
mb: 1024 * 1024,
|
|
109
154
|
gb: 1024 * 1024 * 1024
|
|
110
155
|
};
|
|
111
|
-
function
|
|
156
|
+
function U(e) {
|
|
112
157
|
if (typeof e == "number") return e > 0 ? e : 0;
|
|
113
158
|
if (!e) return 0;
|
|
114
159
|
const r = String(e).trim().toLowerCase().match(/^([\d.]+)\s*(b|kb|mb|gb)?$/);
|
|
115
160
|
if (!r) return 0;
|
|
116
161
|
const a = Number.parseFloat(r[1]);
|
|
117
|
-
return !Number.isFinite(a) || a <= 0 ? 0 : Math.round(a * (
|
|
162
|
+
return !Number.isFinite(a) || a <= 0 ? 0 : Math.round(a * (u[r[2] ?? "b"] ?? 1));
|
|
118
163
|
}
|
|
119
|
-
function
|
|
164
|
+
function w(e) {
|
|
120
165
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${Math.round(e / 1024)} KB` : e < 1024 * 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(1)} MB` : `${(e / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
121
166
|
}
|
|
122
|
-
function
|
|
167
|
+
function g(e) {
|
|
123
168
|
const r = e.lastIndexOf(".");
|
|
124
169
|
return r <= 0 || r === e.length - 1 ? "" : e.slice(r + 1).toLowerCase();
|
|
125
170
|
}
|
|
126
|
-
function
|
|
127
|
-
return
|
|
171
|
+
function S(e) {
|
|
172
|
+
return g(e).toUpperCase().slice(0, 4);
|
|
128
173
|
}
|
|
129
|
-
function
|
|
130
|
-
const n = e.split(",").map((
|
|
174
|
+
function T(e, r, a) {
|
|
175
|
+
const n = e.split(",").map((o) => o.trim().toLowerCase()).filter(Boolean);
|
|
131
176
|
if (!n.length) return !0;
|
|
132
|
-
const
|
|
133
|
-
return n.some((
|
|
177
|
+
const t = r.toLowerCase(), s = (a || "").toLowerCase();
|
|
178
|
+
return n.some((o) => o.startsWith(".") ? t.endsWith(o) : o.endsWith("/*") ? s.startsWith(o.slice(0, -1)) : s === o);
|
|
134
179
|
}
|
|
135
|
-
function
|
|
180
|
+
function B(e) {
|
|
136
181
|
const r = e.split(",").map((a) => a.trim()).filter(Boolean).map((a) => {
|
|
137
182
|
if (a.startsWith(".")) return a.slice(1).toUpperCase();
|
|
138
183
|
if (a.endsWith("/*")) return a.slice(0, -2).toUpperCase();
|
|
@@ -141,28 +186,30 @@ function w(e) {
|
|
|
141
186
|
});
|
|
142
187
|
return [...new Set(r)].join(", ");
|
|
143
188
|
}
|
|
144
|
-
function
|
|
189
|
+
function L(e) {
|
|
145
190
|
return `${e.name}:${e.size}:${e.lastModified ?? 0}`;
|
|
146
191
|
}
|
|
147
|
-
function
|
|
192
|
+
function M(e, r) {
|
|
148
193
|
const a = r.trim().replace(/[/\\]/g, "");
|
|
149
194
|
if (!a) return e;
|
|
150
|
-
const n = e.lastIndexOf("."),
|
|
151
|
-
return
|
|
195
|
+
const n = e.lastIndexOf("."), t = n > 0 ? e.slice(n) : "";
|
|
196
|
+
return t ? a.toLowerCase().endsWith(t.toLowerCase()) ? a : a + t : a;
|
|
152
197
|
}
|
|
153
198
|
export {
|
|
154
199
|
d as T,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
200
|
+
y as a,
|
|
201
|
+
x as b,
|
|
202
|
+
T as c,
|
|
203
|
+
c as d,
|
|
204
|
+
w as e,
|
|
205
|
+
g as f,
|
|
206
|
+
L as g,
|
|
207
|
+
M as h,
|
|
208
|
+
B as i,
|
|
209
|
+
k as j,
|
|
210
|
+
S as k,
|
|
211
|
+
U as p,
|
|
212
|
+
C as r,
|
|
213
|
+
m as t
|
|
167
214
|
};
|
|
168
|
-
//# sourceMappingURL=files-
|
|
215
|
+
//# sourceMappingURL=files-DDJWPzZW.js.map
|