@singlebase/elements 0.6.0 → 0.8.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.
Files changed (50) hide show
  1. package/dist/authui-display-C2o9gApg.cjs +961 -0
  2. package/dist/authui-display-C2o9gApg.cjs.map +1 -0
  3. package/dist/{authui-display-CKfGK5va.js → authui-display-CRUABt43.js} +1034 -913
  4. package/dist/authui-display-CRUABt43.js.map +1 -0
  5. package/dist/authui.cjs +1 -1
  6. package/dist/authui.js +2 -2
  7. package/dist/{chat-C-gsskho.cjs → chat-BWcGH9lr.cjs} +310 -287
  8. package/dist/chat-BWcGH9lr.cjs.map +1 -0
  9. package/dist/chat-messages.d.ts +8 -1
  10. package/dist/{chat-CEh6RygY.js → chat-t4o5FsxM.js} +796 -656
  11. package/dist/chat-t4o5FsxM.js.map +1 -0
  12. package/dist/chat.cjs +1 -1
  13. package/dist/chat.d.ts +1 -1
  14. package/dist/chat.js +1 -1
  15. package/dist/elements/authui-account.d.ts +0 -1
  16. package/dist/elements/authui-buttons.d.ts +1 -1
  17. package/dist/elements/authui.d.ts +25 -5
  18. package/dist/elements/chat.d.ts +46 -8
  19. package/dist/elements/uploader.d.ts +0 -6
  20. package/dist/files-4T62wkwj.cjs +77 -0
  21. package/dist/files-4T62wkwj.cjs.map +1 -0
  22. package/dist/{files-DDJWPzZW.js → files-DS-H-3yN.js} +56 -57
  23. package/dist/files-DS-H-3yN.js.map +1 -0
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.js +4 -4
  26. package/dist/messages.d.ts +34 -5
  27. package/dist/singlebase-elements.min.js +2555 -2292
  28. package/dist/singlebase-elements.min.js.map +1 -1
  29. package/dist/upload-messages.d.ts +0 -1
  30. package/dist/{uploader-660JIgIN.cjs → uploader-C57vgFME.cjs} +33 -7
  31. package/dist/uploader-C57vgFME.cjs.map +1 -0
  32. package/dist/{uploader-vfczkX51.js → uploader-Cz9yfzfV.js} +261 -262
  33. package/dist/uploader-Cz9yfzfV.js.map +1 -0
  34. package/dist/uploader.cjs +1 -1
  35. package/dist/uploader.js +2 -2
  36. package/dist/utils/auth-errors.d.ts +7 -0
  37. package/dist/utils/branding.d.ts +5 -5
  38. package/dist/utils/oauth.d.ts +24 -0
  39. package/dist/utils/password.d.ts +16 -0
  40. package/package.json +3 -3
  41. package/dist/authui-display-CKfGK5va.js.map +0 -1
  42. package/dist/authui-display-aWNht0cW.cjs +0 -956
  43. package/dist/authui-display-aWNht0cW.cjs.map +0 -1
  44. package/dist/chat-C-gsskho.cjs.map +0 -1
  45. package/dist/chat-CEh6RygY.js.map +0 -1
  46. package/dist/files-DDJWPzZW.js.map +0 -1
  47. package/dist/files-DyxcjZsx.cjs +0 -75
  48. package/dist/files-DyxcjZsx.cjs.map +0 -1
  49. package/dist/uploader-660JIgIN.cjs.map +0 -1
  50. package/dist/uploader-vfczkX51.js.map +0 -1
package/dist/chat.cjs CHANGED
@@ -1,2 +1,2 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chat-BWcGH9lr.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,7 +3,7 @@
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 { ChatAfterParse, ChatAttachment, ChatBeforeSend, ChatBlockRenderer, ChatClient, ChatConfig, ChatEmbed, ChatExportFormat, ChatGlow, ChatMessage, ChatMode, ChatPrompt, ChatSidebar, ChatSummary } from "./elements/chat.js";
6
+ export type { ChatAfterParse, ChatAttachment, ChatBeforeSend, ChatBlockRenderer, ChatClient, ChatConfig, ChatEmbed, ChatExportFormat, ChatGlow, ChatMessage, ChatMode, ChatPrompt, ChatSavedAttachment, ChatSidebar, ChatSummary } from "./elements/chat.js";
7
7
  export { adaptBlocks, citedNumbers, parseInline, parseMarkdown, settleStreaming, splitFollowups } from "./utils/markdown.js";
8
8
  export { svgDataUrl } from "./utils/svg.js";
9
9
  export type { Block, ChartSpec, ChatFormat, Segment } from "./utils/markdown.js";
package/dist/chat.js CHANGED
@@ -1,4 +1,4 @@
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";
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-t4o5FsxM.js";
2
2
  export {
3
3
  e as SinglebaseChat,
4
4
  r as adaptBlocks,
@@ -38,7 +38,6 @@ export declare class SinglebaseAccountScreen extends SinglebaseFormBase {
38
38
  private accessor emailCode;
39
39
  private accessor emailError;
40
40
  private accessor emailSaved;
41
- private accessor curPass;
42
41
  private accessor newPass;
43
42
  private accessor confirmPass;
44
43
  private settingsCtl;
@@ -20,7 +20,7 @@ export declare class SinglebaseAuthButtons extends SinglebaseFormBase {
20
20
  accessor intent: OAuthIntent;
21
21
  /** link: the provider to connect to the signed-in account. */
22
22
  accessor provider: string;
23
- /** link: display name, when it differs from the provider id. */
23
+ /** link: label override. By default it's the project's `provider_name`. */
24
24
  accessor providerName: string;
25
25
  /** Inside a card that already supplies chrome, drop this element's own. */
26
26
  accessor embedded: boolean;
@@ -70,10 +70,6 @@ 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;
77
73
  /**
78
74
  * Where to send the user once a session exists. Same-origin only — an
79
75
  * absolute URL pointing anywhere else is refused, because a login widget
@@ -112,7 +108,6 @@ export declare class SinglebaseAuthScreen extends SinglebaseElementBase {
112
108
  private accessor emailError;
113
109
  private accessor passError;
114
110
  private accessor newPassError;
115
- private accessor attempts;
116
111
  private accessor needsMfaCode;
117
112
  private settingsCtl;
118
113
  private bridge;
@@ -157,8 +152,16 @@ export declare class SinglebaseAuthScreen extends SinglebaseElementBase {
157
152
  private get redirectParam();
158
153
  /** Navigates to the post-login destination if there is a safe one. */
159
154
  private followRedirect;
155
+ /**
156
+ * Only the OAuth return counts: `?access_code=`, `?error=oauth_denied` or
157
+ * `?oauth_error=<CODE>`. Any other `?error=` belongs to the host page.
158
+ */
160
159
  private get isOAuthCallback();
161
160
  private accessor callbackDone;
161
+ /** Where the OAuth return stands once its URL has been cleaned. */
162
+ private accessor callbackPhase;
163
+ /** "{name} is now connected", after a provider link completes. */
164
+ private accessor linkNotice;
162
165
  /** Strips the provider's parameters so a reload cannot replay the exchange. */
163
166
  private cleanCallbackUrl;
164
167
  /**
@@ -177,6 +180,17 @@ export declare class SinglebaseAuthScreen extends SinglebaseElementBase {
177
180
  private setScreen;
178
181
  private withLoading;
179
182
  private describeError;
183
+ /**
184
+ * The message for a code the backend sent back on the redirect. The code is
185
+ * only ever looked up, never shown, so a crafted URL can't put text on the page.
186
+ */
187
+ private describeOAuthError;
188
+ /** The requirements hint under a field that creates a password. */
189
+ private get passwordHint();
190
+ /** The placeholder for a field that creates a password. */
191
+ private get newPasswordHint();
192
+ /** The project's password rules, checked wherever a password is created. */
193
+ private checkNewPassword;
180
194
  private get codeValue();
181
195
  private onSubmit;
182
196
  private abortController;
@@ -210,6 +224,12 @@ export declare class SinglebaseAuthScreen extends SinglebaseElementBase {
210
224
  private onInterstitialSignOut;
211
225
  /** The Terms/Privacy consent line, rendered only when the host supplies a link. */
212
226
  private renderConsent;
227
+ /**
228
+ * The OAuth return is handled after the first render, not during it: state
229
+ * set while rendering is dropped, so the widget wouldn't leave the callback
230
+ * screen once the URL is cleaned.
231
+ */
232
+ protected updated(changed: PropertyValues): void;
213
233
  protected render(): typeof nothing | import("lit").TemplateResult<1>;
214
234
  }
215
235
  declare global {
@@ -1,7 +1,11 @@
1
1
  import { LitElement, type PropertyValues, type TemplateResult } from "lit";
2
2
  import { type SinglebaseChatMessages } from "../chat-messages.js";
3
3
  import { type Block, type ChatFormat } from "../utils/markdown.js";
4
- export type ChatMode = "chat" | "rag";
4
+ /**
5
+ * How answers use sources: `chat` free-form, `rag` prefers sources and cites
6
+ * them, `kb` answers only from sources (docsets, retrieval, attachments).
7
+ */
8
+ export type ChatMode = "chat" | "rag" | "kb";
5
9
  export type ChatEmbed = "page" | "inline" | "launcher";
6
10
  export type ChatGlow = "subtle" | "vivid" | "off";
7
11
  export type ChatExportFormat = "md" | "txt" | "json" | "copy";
@@ -29,6 +33,16 @@ export interface ChatAttachment {
29
33
  name: string;
30
34
  size: number;
31
35
  content: string;
36
+ mime?: string;
37
+ }
38
+ /** A file the service keeps on the chat (attachments-mode="payload"). */
39
+ export interface ChatSavedAttachment {
40
+ id: string;
41
+ name: string;
42
+ type?: string;
43
+ mime?: string;
44
+ size?: number;
45
+ status?: string;
32
46
  }
33
47
  export interface ChatMessage {
34
48
  /** Local identity, stable across renders. */
@@ -114,10 +128,11 @@ export interface ChatConfig {
114
128
  showTime: boolean;
115
129
  showComposer: boolean;
116
130
  footnote: string;
117
- brandingText: string;
118
- brandingUrl: string;
119
131
  branding: boolean;
120
132
  followups: boolean;
133
+ docsets: string | string[];
134
+ attachmentsMode: "retrieval" | "payload";
135
+ saveAttachments: boolean;
121
136
  showFollowups: boolean;
122
137
  showSources: boolean;
123
138
  showNewChat: boolean;
@@ -137,6 +152,7 @@ export interface ChatConfig {
137
152
  export declare function describeSource(source: Record<string, unknown>, n: number): {
138
153
  n: number;
139
154
  title: string;
155
+ section: string;
140
156
  path: string;
141
157
  collection: string;
142
158
  updated: string;
@@ -182,6 +198,19 @@ export declare class SinglebaseChat extends LitElement {
182
198
  /** Rewrites a reply's parsed blocks before they're drawn. Returns the blocks. */
183
199
  accessor afterParse: ChatAfterParse | null;
184
200
  accessor glow: ChatGlow;
201
+ /**
202
+ * Docsets to answer from: slugs or ids, comma-separated in markup or an
203
+ * array in JavaScript. Sent as `{ source: "docset", ids }`.
204
+ */
205
+ accessor docsets: string | string[];
206
+ /**
207
+ * How attached files reach the service: `payload` (as `attachments`, which
208
+ * the service keeps on the chat for later turns) or `retrieval` (with this
209
+ * message only).
210
+ */
211
+ accessor attachmentsMode: "retrieval" | "payload";
212
+ /** With attachments-mode="payload": keep attached files on the chat. */
213
+ accessor saveAttachments: boolean;
185
214
  /** Ask the model for follow-up questions with each reply. */
186
215
  accessor followups: boolean;
187
216
  /** The "Cited sources" cards and the "Searched n sources" row under answers. */
@@ -261,10 +290,6 @@ export declare class SinglebaseChat extends LitElement {
261
290
  accessor allowRaw: boolean;
262
291
  /** The "Chat by Singlebase" credit. A plain link — it makes no request. */
263
292
  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;
268
293
  private accessor chatList;
269
294
  private accessor listState;
270
295
  private accessor activeId;
@@ -289,6 +314,7 @@ export declare class SinglebaseChat extends LitElement {
289
314
  private accessor copiedKey;
290
315
  private accessor retrievalOpen;
291
316
  private accessor rawKeys;
317
+ private accessor savedFiles;
292
318
  private accessor hasSidebarContent;
293
319
  private accessor sorts;
294
320
  private accessor arrivedKey;
@@ -321,6 +347,10 @@ export declare class SinglebaseChat extends LitElement {
321
347
  /** The open conversation's messages. */
322
348
  get thread(): readonly ChatMessage[];
323
349
  /** `format`, falling back to the default for anything unknown. */
350
+ /** `docsets` as a clean list of ids. */
351
+ private get docsetIds();
352
+ /** The files this chat keeps on the service. */
353
+ get attachments(): readonly ChatSavedAttachment[];
324
354
  private get formatLevel();
325
355
  /** The loaded chat list. */
326
356
  get chats(): readonly ChatSummary[];
@@ -392,14 +422,22 @@ export declare class SinglebaseChat extends LitElement {
392
422
  private renameChat;
393
423
  private fromServer;
394
424
  private loadChats;
425
+ /**
426
+ * A new chat goes on top. A chat already in the list is updated where it is,
427
+ * keeping its dates, so opening or using a chat never reorders the list; the
428
+ * next load from the server brings the fresh order.
429
+ */
395
430
  private upsertChat;
396
- private touchChat;
397
431
  private resetViewState;
398
432
  private deleteOnServer;
399
433
  private regenerate;
400
434
  private retry;
401
435
  private saveEdit;
402
436
  private toggleRaw;
437
+ /** Adds newly saved files, and says which ones the service couldn't read. */
438
+ private applyAttachmentResults;
439
+ /** Removes a file the service keeps on this chat. */
440
+ private removeSavedFile;
403
441
  private copy;
404
442
  private toggleMessageBookmark;
405
443
  private toggleChatBookmark;
@@ -50,8 +50,6 @@ export interface UploaderConfig {
50
50
  allowRename: boolean;
51
51
  autoUpload: boolean;
52
52
  branding: boolean;
53
- brandingText: string;
54
- brandingUrl: string;
55
53
  logoUrl: string;
56
54
  logoText: string;
57
55
  heading: string;
@@ -112,10 +110,6 @@ export declare class SinglebaseUploader extends LitElement {
112
110
  accessor autoUpload: boolean;
113
111
  /** The "Files by Singlebase" credit. A plain link — it makes no request. */
114
112
  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;
119
113
  accessor logoUrl: string;
120
114
  accessor logoText: string;
121
115
  accessor heading: string;
@@ -0,0 +1,77 @@
1
+ "use strict";const o=require("lit"),i={font:'"Geist", -apple-system, "Segoe UI", Helvetica, sans-serif',mono:'"Geist Mono", ui-monospace, monospace',accent:"#111111",onAccent:"#ffffff",radius:"4px",radiusScale:"1",surface:"#ffffff",surfaceAlt:"#fafafa",ink:"#16181a",mutedInk:"#61666c",border:"#e4e6e9",borderStrong:"#cdd1d6",danger:"#b4231a",dangerBg:"#fdf1f0",dangerBorder:"#f3d6d3",dangerOutline:"#e8c4c0",dangerPanelBorder:"#efd9d6",dangerPanelBg:"#fdf7f6",ok:"#0f6b4a",okBg:"#f0f7f3",okBorder:"#cfe5da",gap:"16px",pad:"20px",fieldPad:"11px 13px"},f=o.css`
2
+ :host {
3
+ display: block;
4
+ box-sizing: border-box;
5
+ font-family: var(--sb-font, ${o.unsafeCSS(i.font)});
6
+ color: var(--sb-ink, ${o.unsafeCSS(i.ink)});
7
+ }
8
+
9
+ :host([theme="dark"]) {
10
+ /* The light default accent is near-black, which disappears on a dark
11
+ surface — primary buttons and links both use it. A host that sets its
12
+ own --sb-accent still wins: outer-page declarations beat :host rules. */
13
+ --sb-accent: #f3f4f5;
14
+ --sb-on-accent: #17181b;
15
+ --sb-surface: #17181b;
16
+ --sb-surface-alt: #202226;
17
+ --sb-ink: #f3f4f5;
18
+ --sb-muted-ink: #a2a8ae;
19
+ --sb-border: #2c2f34;
20
+ --sb-border-strong: #3a3e44;
21
+ --sb-danger: #f08379;
22
+ --sb-danger-bg: rgba(240, 131, 121, 0.1);
23
+ --sb-danger-border: rgba(240, 131, 121, 0.3);
24
+ --sb-danger-outline: rgba(240, 131, 121, 0.4);
25
+ --sb-danger-panel-border: rgba(240, 131, 121, 0.3);
26
+ --sb-danger-panel-bg: rgba(240, 131, 121, 0.06);
27
+ --sb-ok: #6fd1a6;
28
+ --sb-ok-bg: rgba(111, 209, 166, 0.1);
29
+ --sb-ok-border: rgba(111, 209, 166, 0.28);
30
+ }
31
+
32
+ /* Corner presets. They set the scale on this element only, so a page-wide
33
+ :root { --sb-radius-scale } (or --sb-radius) applies to every element
34
+ that doesn't carry the attribute. */
35
+ :host([radius="sharp"]) {
36
+ --sb-radius-scale: 0.35;
37
+ }
38
+
39
+ :host([radius="default"]) {
40
+ --sb-radius-scale: 1;
41
+ }
42
+
43
+ :host([radius="round"]) {
44
+ --sb-radius-scale: 1.8;
45
+ }
46
+
47
+ :host([density="compact"]) {
48
+ --sb-gap: 12px;
49
+ --sb-pad: 16px;
50
+ --sb-field-pad: 9px 11px;
51
+ }
52
+ `,p=o.css`
53
+ .branding {
54
+ text-align: center;
55
+ font-family: var(--sb-mono, "Geist Mono", ui-monospace, monospace);
56
+ font-size: 10.5px;
57
+ line-height: 1.4;
58
+ letter-spacing: 0.06em;
59
+ color: var(--sb-muted-ink, #61666c);
60
+ }
61
+
62
+ .branding a {
63
+ color: inherit;
64
+ text-decoration: none;
65
+ }
66
+
67
+ .branding a:hover {
68
+ color: var(--sb-ink, #16181a);
69
+ text-decoration: underline;
70
+ text-underline-offset: 3px;
71
+ }
72
+ `,u="https://singlebase.io",b="Singlebase.io";function g(e,r){return e?o.html`<div class="branding" part="branding">
73
+ <a href=${u} title=${b} target="_blank" rel="noopener noreferrer"
74
+ >${r} by Singlebase</a
75
+ >
76
+ </div>`:o.nothing}const d={heading:"Upload files",description:"Add one or more files. You can review the list before uploading.",dropTitle:"Drag and drop files here",dropSub:"or browse from your device",hintUpTo:"up to {size} each",chooseFiles:"Choose files",chooseFile:"Choose file",addMore:"+ Add more files",remove:"Remove",rename:"Rename",retry:"Retry",uploadCtaOne:"Upload {n} file",uploadCtaMany:"Upload {n} files",attachments:"Attachments",dropOrChoose:"Drop files or choose",checking:"Checking…",pagesLabel:"{n} pages",countOne:"{n} file of {max}",countMany:"{n} files of {max}",uploading:"Uploading…",uploaded:"Uploaded",failedLabel:"Failed",errTooMany:"You can upload up to {max} files.",errTooLarge:"{name} is larger than {size}.",errTooSmall:"{name} is smaller than {size}.",errDuplicate:"{name} is already in the list.",errType:"{name} isn't an accepted file type.",errNoClient:"No Singlebase client found on this page.",errUpload:"Upload failed.",errProtected:"{name} is password protected.",errTooManyPages:"{name} has {pages} pages; the limit is {max}."};function m(e){return e?{...d,...e}:d}function h(e,r){return e.replace(/\{(\w+)\}/g,(n,t)=>t in r?String(r[t]):n)}const x={b:1,kb:1024,mb:1024*1024,gb:1024*1024*1024};function S(e){if(typeof e=="number")return e>0?e:0;if(!e)return 0;const r=String(e).trim().toLowerCase().match(/^([\d.]+)\s*(b|kb|mb|gb)?$/);if(!r)return 0;const n=Number.parseFloat(r[1]);return!Number.isFinite(n)||n<=0?0:Math.round(n*(x[r[2]??"b"]??1))}function k(e){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`}function c(e){const r=e.lastIndexOf(".");return r<=0||r===e.length-1?"":e.slice(r+1).toLowerCase()}function y(e){return c(e).toUpperCase().slice(0,4)}function C(e,r,n){const t=e.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean);if(!t.length)return!0;const s=r.toLowerCase(),l=(n||"").toLowerCase();return t.some(a=>a.startsWith(".")?s.endsWith(a):a.endsWith("/*")?l.startsWith(a.slice(0,-1)):l===a)}function U(e){const r=e.split(",").map(n=>n.trim()).filter(Boolean).map(n=>{if(n.startsWith("."))return n.slice(1).toUpperCase();if(n.endsWith("/*"))return n.slice(0,-2).toUpperCase();const t=n.indexOf("/");return(t>=0?n.slice(t+1):n).toUpperCase()});return[...new Set(r)].join(", ")}function w(e){return`${e.name}:${e.size}:${e.lastModified??0}`}function T(e,r){const n=r.trim().replace(/[/\\]/g,"");if(!n)return e;const t=e.lastIndexOf("."),s=t>0?e.slice(t):"";return s?n.toLowerCase().endsWith(s.toLowerCase())?n:n+s:n}exports.TOKEN_DEFAULTS=i;exports.acceptSummary=U;exports.acceptsFile=C;exports.brandingStyles=p;exports.defaultUploadMessages=d;exports.extensionOf=y;exports.fileExtension=c;exports.fileKey=w;exports.fill=h;exports.formatSize=k;exports.parseSize=S;exports.renameKeepingExtension=T;exports.renderBranding=g;exports.resolveUploadMessages=m;exports.tokenDefaults=f;
77
+ //# sourceMappingURL=files-4T62wkwj.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files-4T62wkwj.cjs","sources":["../src/styles/tokens.ts","../src/styles/branding.ts","../src/utils/branding.ts","../src/upload-messages.ts","../src/utils/files.ts"],"sourcesContent":["import { css, unsafeCSS } from \"lit\";\n\n/**\n * Default values for every --sb-* design token, ported from the design\n * mock's tokens()/styles() functions. These are consumed as var(--sb-x,\n * DEFAULT) fallbacks at each point of use (see shared.ts) — never assigned\n * unconditionally on :host — so that a value set by a host application, or\n * by a theme/density attribute forwarded down from a composing parent\n * element, actually inherits through\n * nested shadow roots instead of being reset back to these defaults by every\n * descendant's own :host rule.\n */\nexport const TOKEN_DEFAULTS = {\n font: `\"Geist\", -apple-system, \"Segoe UI\", Helvetica, sans-serif`,\n mono: `\"Geist Mono\", ui-monospace, monospace`,\n accent: \"#111111\",\n onAccent: \"#ffffff\",\n radius: \"4px\",\n /** Multiplies every corner. The `radius` attribute sets it per element. */\n radiusScale: \"1\",\n surface: \"#ffffff\",\n surfaceAlt: \"#fafafa\",\n ink: \"#16181a\",\n mutedInk: \"#61666c\",\n border: \"#e4e6e9\",\n borderStrong: \"#cdd1d6\",\n danger: \"#b4231a\",\n dangerBg: \"#fdf1f0\",\n dangerBorder: \"#f3d6d3\",\n dangerOutline: \"#e8c4c0\",\n dangerPanelBorder: \"#efd9d6\",\n dangerPanelBg: \"#fdf7f6\",\n ok: \"#0f6b4a\",\n okBg: \"#f0f7f3\",\n okBorder: \"#cfe5da\",\n gap: \"16px\",\n pad: \"20px\",\n fieldPad: \"11px 13px\"\n} as const;\n\n/**\n * Base host layout plus the theme=\"dark\"/density=\"compact\" attribute\n * overrides. These overrides are legitimate unconditional assignments —\n * they only fire when *this* element carries the attribute — but every\n * composite element (<singlebase-authui>, <singlebase-authui-account>) must forward\n * theme/density/field-style to the singlebase-* children it renders for the\n * override to reach elements that don't carry the attribute directly.\n */\nexport const tokenDefaults = css`\n :host {\n display: block;\n box-sizing: border-box;\n font-family: var(--sb-font, ${unsafeCSS(TOKEN_DEFAULTS.font)});\n color: var(--sb-ink, ${unsafeCSS(TOKEN_DEFAULTS.ink)});\n }\n\n :host([theme=\"dark\"]) {\n /* The light default accent is near-black, which disappears on a dark\n surface — primary buttons and links both use it. A host that sets its\n own --sb-accent still wins: outer-page declarations beat :host rules. */\n --sb-accent: #f3f4f5;\n --sb-on-accent: #17181b;\n --sb-surface: #17181b;\n --sb-surface-alt: #202226;\n --sb-ink: #f3f4f5;\n --sb-muted-ink: #a2a8ae;\n --sb-border: #2c2f34;\n --sb-border-strong: #3a3e44;\n --sb-danger: #f08379;\n --sb-danger-bg: rgba(240, 131, 121, 0.1);\n --sb-danger-border: rgba(240, 131, 121, 0.3);\n --sb-danger-outline: rgba(240, 131, 121, 0.4);\n --sb-danger-panel-border: rgba(240, 131, 121, 0.3);\n --sb-danger-panel-bg: rgba(240, 131, 121, 0.06);\n --sb-ok: #6fd1a6;\n --sb-ok-bg: rgba(111, 209, 166, 0.1);\n --sb-ok-border: rgba(111, 209, 166, 0.28);\n }\n\n /* Corner presets. They set the scale on this element only, so a page-wide\n :root { --sb-radius-scale } (or --sb-radius) applies to every element\n that doesn't carry the attribute. */\n :host([radius=\"sharp\"]) {\n --sb-radius-scale: 0.35;\n }\n\n :host([radius=\"default\"]) {\n --sb-radius-scale: 1;\n }\n\n :host([radius=\"round\"]) {\n --sb-radius-scale: 1.8;\n }\n\n :host([density=\"compact\"]) {\n --sb-gap: 12px;\n --sb-pad: 16px;\n --sb-field-pad: 9px 11px;\n }\n`;\n","import { css } from \"lit\";\n\n/**\n * The \"… by Singlebase\" credit, identical in every element: same font, size,\n * spacing and hover. Each element only decides where it sits.\n */\nexport const brandingStyles = css`\n .branding {\n text-align: center;\n font-family: var(--sb-mono, \"Geist Mono\", ui-monospace, monospace);\n font-size: 10.5px;\n line-height: 1.4;\n letter-spacing: 0.06em;\n color: var(--sb-muted-ink, #61666c);\n }\n\n .branding a {\n color: inherit;\n text-decoration: none;\n }\n\n .branding a:hover {\n color: var(--sb-ink, #16181a);\n text-decoration: underline;\n text-underline-offset: 3px;\n }\n`;\n","import { html, nothing } from \"lit\";\n\nexport const BRANDING_URL = \"https://singlebase.io\";\nexport const BRANDING_TITLE = \"Singlebase.io\";\n\n/**\n * The fixed \"… by Singlebase\" credit. It can be hidden, never changed.\n * It's a plain link: it makes no request until someone clicks it.\n */\nexport function renderBranding(show: boolean, product: \"Auth\" | \"Chat\" | \"Files\") {\n if (!show) return nothing;\n return html`<div class=\"branding\" part=\"branding\">\n <a href=${BRANDING_URL} title=${BRANDING_TITLE} target=\"_blank\" rel=\"noopener noreferrer\"\n >${product} by Singlebase</a\n >\n </div>`;\n}\n","/**\n * Default copy for <singlebase-uploader>. Same shape and contract as the\n * auth bag in messages.ts: a flat set of strings, overridable in whole or in\n * part through the element's `.messages` property.\n *\n * `{n}`, `{max}`, `{name}` and `{size}` are filled in by `fill()`.\n */\nexport interface SinglebaseUploadMessages {\n heading: string;\n description: string;\n\n // dropzone\n dropTitle: string;\n dropSub: string;\n hintUpTo: string;\n\n // controls\n chooseFiles: string;\n chooseFile: string;\n addMore: string;\n remove: string;\n rename: string;\n retry: string;\n uploadCtaOne: string;\n uploadCtaMany: string;\n\n // compact view\n attachments: string;\n dropOrChoose: string;\n\n // status\n checking: string;\n pagesLabel: string;\n countOne: string;\n countMany: string;\n uploading: string;\n uploaded: string;\n failedLabel: string;\n\n // problems\n errTooMany: string;\n errTooLarge: string;\n errTooSmall: string;\n errDuplicate: string;\n errType: string;\n errNoClient: string;\n errUpload: string;\n errProtected: string;\n errTooManyPages: string;\n}\n\nexport const defaultUploadMessages: SinglebaseUploadMessages = {\n heading: \"Upload files\",\n description: \"Add one or more files. You can review the list before uploading.\",\n\n dropTitle: \"Drag and drop files here\",\n dropSub: \"or browse from your device\",\n hintUpTo: \"up to {size} each\",\n\n chooseFiles: \"Choose files\",\n chooseFile: \"Choose file\",\n addMore: \"+ Add more files\",\n remove: \"Remove\",\n rename: \"Rename\",\n retry: \"Retry\",\n uploadCtaOne: \"Upload {n} file\",\n uploadCtaMany: \"Upload {n} files\",\n\n attachments: \"Attachments\",\n dropOrChoose: \"Drop files or choose\",\n\n checking: \"Checking…\",\n pagesLabel: \"{n} pages\",\n countOne: \"{n} file of {max}\",\n countMany: \"{n} files of {max}\",\n uploading: \"Uploading…\",\n uploaded: \"Uploaded\",\n failedLabel: \"Failed\",\n\n errTooMany: \"You can upload up to {max} files.\",\n errTooLarge: \"{name} is larger than {size}.\",\n errTooSmall: \"{name} is smaller than {size}.\",\n errDuplicate: \"{name} is already in the list.\",\n errType: \"{name} isn't an accepted file type.\",\n errNoClient: \"No Singlebase client found on this page.\",\n errUpload: \"Upload failed.\",\n errProtected: \"{name} is password protected.\",\n errTooManyPages: \"{name} has {pages} pages; the limit is {max}.\"\n};\n\nexport function resolveUploadMessages(\n overrides?: Partial<SinglebaseUploadMessages>\n): SinglebaseUploadMessages {\n return overrides ? { ...defaultUploadMessages, ...overrides } : defaultUploadMessages;\n}\n\n/** Fills `{token}` placeholders. Values are plain text and rendered as text. */\nexport function fill(template: string, values: Record<string, string | number>): string {\n return template.replace(/\\{(\\w+)\\}/g, (match, key) =>\n key in values ? String(values[key]) : match\n );\n}\n","/**\n * Small pure helpers for <singlebase-uploader>: parsing and printing\n * sizes, matching an `accept` list, and the identity a duplicate is judged by.\n * Kept out of the element so they can be tested without a DOM.\n */\n\nconst UNITS: Record<string, number> = {\n b: 1,\n kb: 1024,\n mb: 1024 * 1024,\n gb: 1024 * 1024 * 1024\n};\n\n/** \"25MB\" / \"500 kb\" / \"1048576\" → bytes. 0 means \"no limit\". */\nexport function parseSize(value: string | number | null | undefined): number {\n if (typeof value === \"number\") return value > 0 ? value : 0;\n if (!value) return 0;\n const match = String(value)\n .trim()\n .toLowerCase()\n .match(/^([\\d.]+)\\s*(b|kb|mb|gb)?$/);\n if (!match) return 0;\n const amount = Number.parseFloat(match[1]);\n if (!Number.isFinite(amount) || amount <= 0) return 0;\n return Math.round(amount * (UNITS[match[2] ?? \"b\"] ?? 1));\n}\n\nexport function formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`;\n if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;\n}\n\n/** The extension in lowercase, without the dot. \"\" when there is none. */\nexport function fileExtension(filename: string): string {\n const dot = filename.lastIndexOf(\".\");\n if (dot <= 0 || dot === filename.length - 1) return \"\";\n return filename.slice(dot + 1).toLowerCase();\n}\n\n/** The extension, uppercased and clipped, for the little type chip. */\nexport function extensionOf(filename: string): string {\n return fileExtension(filename).toUpperCase().slice(0, 4);\n}\n\n/**\n * Matches one file against an `accept` list, using the same vocabulary as the\n * attribute on `<input type=\"file\">`: extensions (\".pdf\"), exact MIME types\n * (\"application/pdf\") and wildcards (\"image/*\"). An empty list accepts\n * everything.\n *\n * This is a convenience, not a security control — the browser's own file\n * dialog filter and this check are both trivially bypassed by a drop, so the\n * server remains the authority on what it will store.\n */\nexport function acceptsFile(accept: string, name: string, type: string): boolean {\n const rules = accept\n .split(\",\")\n .map((rule) => rule.trim().toLowerCase())\n .filter(Boolean);\n if (!rules.length) return true;\n\n const lowerName = name.toLowerCase();\n const lowerType = (type || \"\").toLowerCase();\n\n return rules.some((rule) => {\n if (rule.startsWith(\".\")) return lowerName.endsWith(rule);\n if (rule.endsWith(\"/*\")) return lowerType.startsWith(rule.slice(0, -1));\n return lowerType === rule;\n });\n}\n\n/** Human list of accepted kinds for the hint line: \".pdf,image/png\" → \"PDF, PNG\". */\nexport function acceptSummary(accept: string): string {\n const parts = accept\n .split(\",\")\n .map((rule) => rule.trim())\n .filter(Boolean)\n .map((rule) => {\n if (rule.startsWith(\".\")) return rule.slice(1).toUpperCase();\n if (rule.endsWith(\"/*\")) return rule.slice(0, -2).toUpperCase();\n const slash = rule.indexOf(\"/\");\n return (slash >= 0 ? rule.slice(slash + 1) : rule).toUpperCase();\n });\n return [...new Set(parts)].join(\", \");\n}\n\n/**\n * Two picks are the same file when name, size and mtime all match. Content\n * hashing would be exact but means reading every byte before the user has\n * even pressed upload; this is what a file manager uses, and it is enough to\n * stop the common case of dropping the same batch twice.\n */\nexport function fileKey(file: { name: string; size: number; lastModified?: number }): string {\n return `${file.name}:${file.size}:${file.lastModified ?? 0}`;\n}\n\n/** Replaces the base name, keeping the original extension. */\nexport function renameKeepingExtension(original: string, typed: string): string {\n const clean = typed.trim().replace(/[/\\\\]/g, \"\");\n if (!clean) return original;\n const dot = original.lastIndexOf(\".\");\n const extension = dot > 0 ? original.slice(dot) : \"\";\n if (!extension) return clean;\n return clean.toLowerCase().endsWith(extension.toLowerCase()) ? clean : clean + extension;\n}\n"],"names":["TOKEN_DEFAULTS","tokenDefaults","css","unsafeCSS","brandingStyles","BRANDING_URL","BRANDING_TITLE","renderBranding","show","product","html","nothing","defaultUploadMessages","resolveUploadMessages","overrides","fill","template","values","match","key","UNITS","parseSize","value","amount","formatSize","bytes","fileExtension","filename","dot","extensionOf","acceptsFile","accept","name","type","rules","rule","lowerName","lowerType","acceptSummary","parts","slash","fileKey","file","renameKeepingExtension","original","typed","clean","extension"],"mappings":"oCAYaA,EAAiB,CAC5B,KAAM,4DACN,KAAM,wCACN,OAAQ,UACR,SAAU,UACV,OAAQ,MAER,YAAa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AQD,EAAM,KAAA,EAAO,QAAQ,SAAU,EAAE,EAC/C,GAAI,CAACC,EAAO,OAAOF,EACnB,MAAMhB,EAAMgB,EAAS,YAAY,GAAG,EAC9BG,EAAYnB,EAAM,EAAIgB,EAAS,MAAMhB,CAAG,EAAI,GAClD,OAAKmB,EACED,EAAM,cAAc,SAASC,EAAU,aAAa,EAAID,EAAQA,EAAQC,EADxDD,CAEzB"}
@@ -25,7 +25,7 @@ const d = {
25
25
  gap: "16px",
26
26
  pad: "20px",
27
27
  fieldPad: "11px 13px"
28
- }, m = f`
28
+ }, x = f`
29
29
  :host {
30
30
  display: block;
31
31
  box-sizing: border-box;
@@ -76,7 +76,7 @@ const d = {
76
76
  --sb-pad: 16px;
77
77
  --sb-field-pad: 9px 11px;
78
78
  }
79
- `, x = f`
79
+ `, k = f`
80
80
  .branding {
81
81
  text-align: center;
82
82
  font-family: var(--sb-mono, "Geist Mono", ui-monospace, monospace);
@@ -96,13 +96,13 @@ const d = {
96
96
  text-decoration: underline;
97
97
  text-underline-offset: 3px;
98
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>`;
99
+ `, b = "https://singlebase.io", u = "Singlebase.io";
100
+ function C(e, a) {
101
+ return e ? p`<div class="branding" part="branding">
102
+ <a href=${b} title=${u} target="_blank" rel="noopener noreferrer"
103
+ >${a} by Singlebase</a
104
+ >
105
+ </div>` : l;
106
106
  }
107
107
  const c = {
108
108
  heading: "Upload files",
@@ -135,81 +135,80 @@ const c = {
135
135
  errNoClient: "No Singlebase client found on this page.",
136
136
  errUpload: "Upload failed.",
137
137
  errProtected: "{name} is password protected.",
138
- errTooManyPages: "{name} has {pages} pages; the limit is {max}.",
139
- brandingLabel: "Files by Singlebase"
138
+ errTooManyPages: "{name} has {pages} pages; the limit is {max}."
140
139
  };
141
- function C(e) {
140
+ function y(e) {
142
141
  return e ? { ...c, ...e } : c;
143
142
  }
144
- function y(e, r) {
143
+ function S(e, a) {
145
144
  return e.replace(
146
145
  /\{(\w+)\}/g,
147
- (a, n) => n in r ? String(r[n]) : a
146
+ (r, n) => n in a ? String(a[n]) : r
148
147
  );
149
148
  }
150
- const u = {
149
+ const g = {
151
150
  b: 1,
152
151
  kb: 1024,
153
152
  mb: 1024 * 1024,
154
153
  gb: 1024 * 1024 * 1024
155
154
  };
156
- function U(e) {
155
+ function w(e) {
157
156
  if (typeof e == "number") return e > 0 ? e : 0;
158
157
  if (!e) return 0;
159
- const r = String(e).trim().toLowerCase().match(/^([\d.]+)\s*(b|kb|mb|gb)?$/);
160
- if (!r) return 0;
161
- const a = Number.parseFloat(r[1]);
162
- return !Number.isFinite(a) || a <= 0 ? 0 : Math.round(a * (u[r[2] ?? "b"] ?? 1));
158
+ const a = String(e).trim().toLowerCase().match(/^([\d.]+)\s*(b|kb|mb|gb)?$/);
159
+ if (!a) return 0;
160
+ const r = Number.parseFloat(a[1]);
161
+ return !Number.isFinite(r) || r <= 0 ? 0 : Math.round(r * (g[a[2] ?? "b"] ?? 1));
163
162
  }
164
- function w(e) {
163
+ function U(e) {
165
164
  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`;
166
165
  }
167
- function g(e) {
168
- const r = e.lastIndexOf(".");
169
- return r <= 0 || r === e.length - 1 ? "" : e.slice(r + 1).toLowerCase();
166
+ function h(e) {
167
+ const a = e.lastIndexOf(".");
168
+ return a <= 0 || a === e.length - 1 ? "" : e.slice(a + 1).toLowerCase();
170
169
  }
171
- function S(e) {
172
- return g(e).toUpperCase().slice(0, 4);
170
+ function T(e) {
171
+ return h(e).toUpperCase().slice(0, 4);
173
172
  }
174
- function T(e, r, a) {
175
- const n = e.split(",").map((o) => o.trim().toLowerCase()).filter(Boolean);
173
+ function B(e, a, r) {
174
+ const n = e.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
176
175
  if (!n.length) return !0;
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);
176
+ const o = a.toLowerCase(), s = (r || "").toLowerCase();
177
+ return n.some((t) => t.startsWith(".") ? o.endsWith(t) : t.endsWith("/*") ? s.startsWith(t.slice(0, -1)) : s === t);
179
178
  }
180
- function B(e) {
181
- const r = e.split(",").map((a) => a.trim()).filter(Boolean).map((a) => {
182
- if (a.startsWith(".")) return a.slice(1).toUpperCase();
183
- if (a.endsWith("/*")) return a.slice(0, -2).toUpperCase();
184
- const n = a.indexOf("/");
185
- return (n >= 0 ? a.slice(n + 1) : a).toUpperCase();
179
+ function L(e) {
180
+ const a = e.split(",").map((r) => r.trim()).filter(Boolean).map((r) => {
181
+ if (r.startsWith(".")) return r.slice(1).toUpperCase();
182
+ if (r.endsWith("/*")) return r.slice(0, -2).toUpperCase();
183
+ const n = r.indexOf("/");
184
+ return (n >= 0 ? r.slice(n + 1) : r).toUpperCase();
186
185
  });
187
- return [...new Set(r)].join(", ");
186
+ return [...new Set(a)].join(", ");
188
187
  }
189
- function L(e) {
188
+ function M(e) {
190
189
  return `${e.name}:${e.size}:${e.lastModified ?? 0}`;
191
190
  }
192
- function M(e, r) {
193
- const a = r.trim().replace(/[/\\]/g, "");
194
- if (!a) return e;
195
- const n = e.lastIndexOf("."), t = n > 0 ? e.slice(n) : "";
196
- return t ? a.toLowerCase().endsWith(t.toLowerCase()) ? a : a + t : a;
191
+ function $(e, a) {
192
+ const r = a.trim().replace(/[/\\]/g, "");
193
+ if (!r) return e;
194
+ const n = e.lastIndexOf("."), o = n > 0 ? e.slice(n) : "";
195
+ return o ? r.toLowerCase().endsWith(o.toLowerCase()) ? r : r + o : r;
197
196
  }
198
197
  export {
199
198
  d as T,
200
- y as a,
201
- x as b,
202
- T as c,
199
+ S as a,
200
+ k as b,
201
+ B as c,
203
202
  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
203
+ U as e,
204
+ h as f,
205
+ M as g,
206
+ $ as h,
207
+ L as i,
208
+ C as j,
209
+ T as k,
210
+ w as p,
211
+ y as r,
212
+ x as t
214
213
  };
215
- //# sourceMappingURL=files-DDJWPzZW.js.map
214
+ //# sourceMappingURL=files-DS-H-3yN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files-DS-H-3yN.js","sources":["../src/styles/tokens.ts","../src/styles/branding.ts","../src/utils/branding.ts","../src/upload-messages.ts","../src/utils/files.ts"],"sourcesContent":["import { css, unsafeCSS } from \"lit\";\n\n/**\n * Default values for every --sb-* design token, ported from the design\n * mock's tokens()/styles() functions. These are consumed as var(--sb-x,\n * DEFAULT) fallbacks at each point of use (see shared.ts) — never assigned\n * unconditionally on :host — so that a value set by a host application, or\n * by a theme/density attribute forwarded down from a composing parent\n * element, actually inherits through\n * nested shadow roots instead of being reset back to these defaults by every\n * descendant's own :host rule.\n */\nexport const TOKEN_DEFAULTS = {\n font: `\"Geist\", -apple-system, \"Segoe UI\", Helvetica, sans-serif`,\n mono: `\"Geist Mono\", ui-monospace, monospace`,\n accent: \"#111111\",\n onAccent: \"#ffffff\",\n radius: \"4px\",\n /** Multiplies every corner. The `radius` attribute sets it per element. */\n radiusScale: \"1\",\n surface: \"#ffffff\",\n surfaceAlt: \"#fafafa\",\n ink: \"#16181a\",\n mutedInk: \"#61666c\",\n border: \"#e4e6e9\",\n borderStrong: \"#cdd1d6\",\n danger: \"#b4231a\",\n dangerBg: \"#fdf1f0\",\n dangerBorder: \"#f3d6d3\",\n dangerOutline: \"#e8c4c0\",\n dangerPanelBorder: \"#efd9d6\",\n dangerPanelBg: \"#fdf7f6\",\n ok: \"#0f6b4a\",\n okBg: \"#f0f7f3\",\n okBorder: \"#cfe5da\",\n gap: \"16px\",\n pad: \"20px\",\n fieldPad: \"11px 13px\"\n} as const;\n\n/**\n * Base host layout plus the theme=\"dark\"/density=\"compact\" attribute\n * overrides. These overrides are legitimate unconditional assignments —\n * they only fire when *this* element carries the attribute — but every\n * composite element (<singlebase-authui>, <singlebase-authui-account>) must forward\n * theme/density/field-style to the singlebase-* children it renders for the\n * override to reach elements that don't carry the attribute directly.\n */\nexport const tokenDefaults = css`\n :host {\n display: block;\n box-sizing: border-box;\n font-family: var(--sb-font, ${unsafeCSS(TOKEN_DEFAULTS.font)});\n color: var(--sb-ink, ${unsafeCSS(TOKEN_DEFAULTS.ink)});\n }\n\n :host([theme=\"dark\"]) {\n /* The light default accent is near-black, which disappears on a dark\n surface — primary buttons and links both use it. A host that sets its\n own --sb-accent still wins: outer-page declarations beat :host rules. */\n --sb-accent: #f3f4f5;\n --sb-on-accent: #17181b;\n --sb-surface: #17181b;\n --sb-surface-alt: #202226;\n --sb-ink: #f3f4f5;\n --sb-muted-ink: #a2a8ae;\n --sb-border: #2c2f34;\n --sb-border-strong: #3a3e44;\n --sb-danger: #f08379;\n --sb-danger-bg: rgba(240, 131, 121, 0.1);\n --sb-danger-border: rgba(240, 131, 121, 0.3);\n --sb-danger-outline: rgba(240, 131, 121, 0.4);\n --sb-danger-panel-border: rgba(240, 131, 121, 0.3);\n --sb-danger-panel-bg: rgba(240, 131, 121, 0.06);\n --sb-ok: #6fd1a6;\n --sb-ok-bg: rgba(111, 209, 166, 0.1);\n --sb-ok-border: rgba(111, 209, 166, 0.28);\n }\n\n /* Corner presets. They set the scale on this element only, so a page-wide\n :root { --sb-radius-scale } (or --sb-radius) applies to every element\n that doesn't carry the attribute. */\n :host([radius=\"sharp\"]) {\n --sb-radius-scale: 0.35;\n }\n\n :host([radius=\"default\"]) {\n --sb-radius-scale: 1;\n }\n\n :host([radius=\"round\"]) {\n --sb-radius-scale: 1.8;\n }\n\n :host([density=\"compact\"]) {\n --sb-gap: 12px;\n --sb-pad: 16px;\n --sb-field-pad: 9px 11px;\n }\n`;\n","import { css } from \"lit\";\n\n/**\n * The \"… by Singlebase\" credit, identical in every element: same font, size,\n * spacing and hover. Each element only decides where it sits.\n */\nexport const brandingStyles = css`\n .branding {\n text-align: center;\n font-family: var(--sb-mono, \"Geist Mono\", ui-monospace, monospace);\n font-size: 10.5px;\n line-height: 1.4;\n letter-spacing: 0.06em;\n color: var(--sb-muted-ink, #61666c);\n }\n\n .branding a {\n color: inherit;\n text-decoration: none;\n }\n\n .branding a:hover {\n color: var(--sb-ink, #16181a);\n text-decoration: underline;\n text-underline-offset: 3px;\n }\n`;\n","import { html, nothing } from \"lit\";\n\nexport const BRANDING_URL = \"https://singlebase.io\";\nexport const BRANDING_TITLE = \"Singlebase.io\";\n\n/**\n * The fixed \"… by Singlebase\" credit. It can be hidden, never changed.\n * It's a plain link: it makes no request until someone clicks it.\n */\nexport function renderBranding(show: boolean, product: \"Auth\" | \"Chat\" | \"Files\") {\n if (!show) return nothing;\n return html`<div class=\"branding\" part=\"branding\">\n <a href=${BRANDING_URL} title=${BRANDING_TITLE} target=\"_blank\" rel=\"noopener noreferrer\"\n >${product} by Singlebase</a\n >\n </div>`;\n}\n","/**\n * Default copy for <singlebase-uploader>. Same shape and contract as the\n * auth bag in messages.ts: a flat set of strings, overridable in whole or in\n * part through the element's `.messages` property.\n *\n * `{n}`, `{max}`, `{name}` and `{size}` are filled in by `fill()`.\n */\nexport interface SinglebaseUploadMessages {\n heading: string;\n description: string;\n\n // dropzone\n dropTitle: string;\n dropSub: string;\n hintUpTo: string;\n\n // controls\n chooseFiles: string;\n chooseFile: string;\n addMore: string;\n remove: string;\n rename: string;\n retry: string;\n uploadCtaOne: string;\n uploadCtaMany: string;\n\n // compact view\n attachments: string;\n dropOrChoose: string;\n\n // status\n checking: string;\n pagesLabel: string;\n countOne: string;\n countMany: string;\n uploading: string;\n uploaded: string;\n failedLabel: string;\n\n // problems\n errTooMany: string;\n errTooLarge: string;\n errTooSmall: string;\n errDuplicate: string;\n errType: string;\n errNoClient: string;\n errUpload: string;\n errProtected: string;\n errTooManyPages: string;\n}\n\nexport const defaultUploadMessages: SinglebaseUploadMessages = {\n heading: \"Upload files\",\n description: \"Add one or more files. You can review the list before uploading.\",\n\n dropTitle: \"Drag and drop files here\",\n dropSub: \"or browse from your device\",\n hintUpTo: \"up to {size} each\",\n\n chooseFiles: \"Choose files\",\n chooseFile: \"Choose file\",\n addMore: \"+ Add more files\",\n remove: \"Remove\",\n rename: \"Rename\",\n retry: \"Retry\",\n uploadCtaOne: \"Upload {n} file\",\n uploadCtaMany: \"Upload {n} files\",\n\n attachments: \"Attachments\",\n dropOrChoose: \"Drop files or choose\",\n\n checking: \"Checking…\",\n pagesLabel: \"{n} pages\",\n countOne: \"{n} file of {max}\",\n countMany: \"{n} files of {max}\",\n uploading: \"Uploading…\",\n uploaded: \"Uploaded\",\n failedLabel: \"Failed\",\n\n errTooMany: \"You can upload up to {max} files.\",\n errTooLarge: \"{name} is larger than {size}.\",\n errTooSmall: \"{name} is smaller than {size}.\",\n errDuplicate: \"{name} is already in the list.\",\n errType: \"{name} isn't an accepted file type.\",\n errNoClient: \"No Singlebase client found on this page.\",\n errUpload: \"Upload failed.\",\n errProtected: \"{name} is password protected.\",\n errTooManyPages: \"{name} has {pages} pages; the limit is {max}.\"\n};\n\nexport function resolveUploadMessages(\n overrides?: Partial<SinglebaseUploadMessages>\n): SinglebaseUploadMessages {\n return overrides ? { ...defaultUploadMessages, ...overrides } : defaultUploadMessages;\n}\n\n/** Fills `{token}` placeholders. Values are plain text and rendered as text. */\nexport function fill(template: string, values: Record<string, string | number>): string {\n return template.replace(/\\{(\\w+)\\}/g, (match, key) =>\n key in values ? String(values[key]) : match\n );\n}\n","/**\n * Small pure helpers for <singlebase-uploader>: parsing and printing\n * sizes, matching an `accept` list, and the identity a duplicate is judged by.\n * Kept out of the element so they can be tested without a DOM.\n */\n\nconst UNITS: Record<string, number> = {\n b: 1,\n kb: 1024,\n mb: 1024 * 1024,\n gb: 1024 * 1024 * 1024\n};\n\n/** \"25MB\" / \"500 kb\" / \"1048576\" → bytes. 0 means \"no limit\". */\nexport function parseSize(value: string | number | null | undefined): number {\n if (typeof value === \"number\") return value > 0 ? value : 0;\n if (!value) return 0;\n const match = String(value)\n .trim()\n .toLowerCase()\n .match(/^([\\d.]+)\\s*(b|kb|mb|gb)?$/);\n if (!match) return 0;\n const amount = Number.parseFloat(match[1]);\n if (!Number.isFinite(amount) || amount <= 0) return 0;\n return Math.round(amount * (UNITS[match[2] ?? \"b\"] ?? 1));\n}\n\nexport function formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`;\n if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;\n}\n\n/** The extension in lowercase, without the dot. \"\" when there is none. */\nexport function fileExtension(filename: string): string {\n const dot = filename.lastIndexOf(\".\");\n if (dot <= 0 || dot === filename.length - 1) return \"\";\n return filename.slice(dot + 1).toLowerCase();\n}\n\n/** The extension, uppercased and clipped, for the little type chip. */\nexport function extensionOf(filename: string): string {\n return fileExtension(filename).toUpperCase().slice(0, 4);\n}\n\n/**\n * Matches one file against an `accept` list, using the same vocabulary as the\n * attribute on `<input type=\"file\">`: extensions (\".pdf\"), exact MIME types\n * (\"application/pdf\") and wildcards (\"image/*\"). An empty list accepts\n * everything.\n *\n * This is a convenience, not a security control — the browser's own file\n * dialog filter and this check are both trivially bypassed by a drop, so the\n * server remains the authority on what it will store.\n */\nexport function acceptsFile(accept: string, name: string, type: string): boolean {\n const rules = accept\n .split(\",\")\n .map((rule) => rule.trim().toLowerCase())\n .filter(Boolean);\n if (!rules.length) return true;\n\n const lowerName = name.toLowerCase();\n const lowerType = (type || \"\").toLowerCase();\n\n return rules.some((rule) => {\n if (rule.startsWith(\".\")) return lowerName.endsWith(rule);\n if (rule.endsWith(\"/*\")) return lowerType.startsWith(rule.slice(0, -1));\n return lowerType === rule;\n });\n}\n\n/** Human list of accepted kinds for the hint line: \".pdf,image/png\" → \"PDF, PNG\". */\nexport function acceptSummary(accept: string): string {\n const parts = accept\n .split(\",\")\n .map((rule) => rule.trim())\n .filter(Boolean)\n .map((rule) => {\n if (rule.startsWith(\".\")) return rule.slice(1).toUpperCase();\n if (rule.endsWith(\"/*\")) return rule.slice(0, -2).toUpperCase();\n const slash = rule.indexOf(\"/\");\n return (slash >= 0 ? rule.slice(slash + 1) : rule).toUpperCase();\n });\n return [...new Set(parts)].join(\", \");\n}\n\n/**\n * Two picks are the same file when name, size and mtime all match. Content\n * hashing would be exact but means reading every byte before the user has\n * even pressed upload; this is what a file manager uses, and it is enough to\n * stop the common case of dropping the same batch twice.\n */\nexport function fileKey(file: { name: string; size: number; lastModified?: number }): string {\n return `${file.name}:${file.size}:${file.lastModified ?? 0}`;\n}\n\n/** Replaces the base name, keeping the original extension. */\nexport function renameKeepingExtension(original: string, typed: string): string {\n const clean = typed.trim().replace(/[/\\\\]/g, \"\");\n if (!clean) return original;\n const dot = original.lastIndexOf(\".\");\n const extension = dot > 0 ? original.slice(dot) : \"\";\n if (!extension) return clean;\n return clean.toLowerCase().endsWith(extension.toLowerCase()) ? clean : clean + extension;\n}\n"],"names":["TOKEN_DEFAULTS","tokenDefaults","css","unsafeCSS","brandingStyles","BRANDING_URL","BRANDING_TITLE","renderBranding","show","product","html","nothing","defaultUploadMessages","resolveUploadMessages","overrides","fill","template","values","match","key","UNITS","parseSize","value","amount","formatSize","bytes","fileExtension","filename","dot","extensionOf","acceptsFile","accept","name","type","rules","rule","lowerName","lowerType","acceptSummary","parts","slash","fileKey","file","renameKeepingExtension","original","typed","clean","extension"],"mappings":";A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AAOA,EAAK,MAAM,GAAG,EAAE,EAAE,YAAA;AAClD,UAAMK,IAAQL,EAAK,QAAQ,GAAG;AAC9B,YAAQK,KAAS,IAAIL,EAAK,MAAMK,IAAQ,CAAC,IAAIL,GAAM,YAAA;AAAA,EACrD,CAAC;AACH,SAAO,CAAC,GAAG,IAAI,IAAII,CAAK,CAAC,EAAE,KAAK,IAAI;AACtC;AAQO,SAASE,EAAQC,GAAqE;AAC3F,SAAO,GAAGA,EAAK,IAAI,IAAIA,EAAK,IAAI,IAAIA,EAAK,gBAAgB,CAAC;AAC5D;AAGO,SAASC,EAAuBC,GAAkBC,GAAuB;AAC9E,QAAMC,IAAQD,EAAM,KAAA,EAAO,QAAQ,UAAU,EAAE;AAC/C,MAAI,CAACC,EAAO,QAAOF;AACnB,QAAMhB,IAAMgB,EAAS,YAAY,GAAG,GAC9BG,IAAYnB,IAAM,IAAIgB,EAAS,MAAMhB,CAAG,IAAI;AAClD,SAAKmB,IACED,EAAM,cAAc,SAASC,EAAU,aAAa,IAAID,IAAQA,IAAQC,IADxDD;AAEzB;"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./authui-display-aWNht0cW.cjs"),r=require("./uploader-660JIgIN.cjs"),s=require("@singlebase/core"),a=require("./files-DyxcjZsx.cjs"),t=require("./chat-C-gsskho.cjs");exports.AuthController=e.AuthController;exports.SettingsController=e.SettingsController;Object.defineProperty(exports,"SinglebaseAccountScreen",{enumerable:!0,get:()=>e.SinglebaseAccountScreen});Object.defineProperty(exports,"SinglebaseAuthButtons",{enumerable:!0,get:()=>e.SinglebaseAuthButtons});Object.defineProperty(exports,"SinglebaseAuthDisplay",{enumerable:!0,get:()=>e.SinglebaseAuthDisplay});Object.defineProperty(exports,"SinglebaseAuthGuard",{enumerable:!0,get:()=>e.SinglebaseAuthGuard});Object.defineProperty(exports,"SinglebaseAuthScreen",{enumerable:!0,get:()=>e.SinglebaseAuthScreen});exports.defaultMessages=e.defaultMessages;exports.fullNameOf=e.fullNameOf;exports.initialsOf=e.initialsOf;exports.isGuestScreen=e.isGuestScreen;exports.isProtectedScreen=e.isProtectedScreen;exports.isScreen=e.isScreen;exports.resolveMessages=e.resolveMessages;Object.defineProperty(exports,"SinglebaseUploader",{enumerable:!0,get:()=>r.SinglebaseUploader});exports.inspectFile=r.inspectFile;exports.isInspectable=r.isInspectable;exports.resolveRedirectTarget=r.resolveRedirectTarget;Object.defineProperty(exports,"OPERATORS",{enumerable:!0,get:()=>s.OPERATORS});Object.defineProperty(exports,"matchesPredicate",{enumerable:!0,get:()=>s.matchesPredicate});Object.defineProperty(exports,"validatePredicate",{enumerable:!0,get:()=>s.validatePredicate});exports.TOKEN_DEFAULTS=a.TOKEN_DEFAULTS;exports.defaultUploadMessages=a.defaultUploadMessages;exports.resolveUploadMessages=a.resolveUploadMessages;Object.defineProperty(exports,"SinglebaseChat",{enumerable:!0,get:()=>t.SinglebaseChat});exports.adaptBlocks=t.adaptBlocks;exports.citedNumbers=t.citedNumbers;exports.defaultChatMessages=t.defaultChatMessages;exports.describeSource=t.describeSource;exports.parseInline=t.parseInline;exports.parseMarkdown=t.parseMarkdown;exports.resolveChatMessages=t.resolveChatMessages;exports.settleStreaming=t.settleStreaming;exports.splitFollowups=t.splitFollowups;exports.svgDataUrl=t.svgDataUrl;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./authui-display-C2o9gApg.cjs"),r=require("./uploader-C57vgFME.cjs"),s=require("@singlebase/core"),a=require("./files-4T62wkwj.cjs"),t=require("./chat-BWcGH9lr.cjs");exports.AuthController=e.AuthController;exports.SettingsController=e.SettingsController;Object.defineProperty(exports,"SinglebaseAccountScreen",{enumerable:!0,get:()=>e.SinglebaseAccountScreen});Object.defineProperty(exports,"SinglebaseAuthButtons",{enumerable:!0,get:()=>e.SinglebaseAuthButtons});Object.defineProperty(exports,"SinglebaseAuthDisplay",{enumerable:!0,get:()=>e.SinglebaseAuthDisplay});Object.defineProperty(exports,"SinglebaseAuthGuard",{enumerable:!0,get:()=>e.SinglebaseAuthGuard});Object.defineProperty(exports,"SinglebaseAuthScreen",{enumerable:!0,get:()=>e.SinglebaseAuthScreen});exports.defaultMessages=e.defaultMessages;exports.fullNameOf=e.fullNameOf;exports.initialsOf=e.initialsOf;exports.isGuestScreen=e.isGuestScreen;exports.isProtectedScreen=e.isProtectedScreen;exports.isScreen=e.isScreen;exports.resolveMessages=e.resolveMessages;Object.defineProperty(exports,"SinglebaseUploader",{enumerable:!0,get:()=>r.SinglebaseUploader});exports.inspectFile=r.inspectFile;exports.isInspectable=r.isInspectable;exports.resolveRedirectTarget=r.resolveRedirectTarget;Object.defineProperty(exports,"OPERATORS",{enumerable:!0,get:()=>s.OPERATORS});Object.defineProperty(exports,"matchesPredicate",{enumerable:!0,get:()=>s.matchesPredicate});Object.defineProperty(exports,"validatePredicate",{enumerable:!0,get:()=>s.validatePredicate});exports.TOKEN_DEFAULTS=a.TOKEN_DEFAULTS;exports.defaultUploadMessages=a.defaultUploadMessages;exports.resolveUploadMessages=a.resolveUploadMessages;Object.defineProperty(exports,"SinglebaseChat",{enumerable:!0,get:()=>t.SinglebaseChat});exports.adaptBlocks=t.adaptBlocks;exports.citedNumbers=t.citedNumbers;exports.defaultChatMessages=t.defaultChatMessages;exports.describeSource=t.describeSource;exports.parseInline=t.parseInline;exports.parseMarkdown=t.parseMarkdown;exports.resolveChatMessages=t.resolveChatMessages;exports.settleStreaming=t.settleStreaming;exports.splitFollowups=t.splitFollowups;exports.svgDataUrl=t.svgDataUrl;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A as a, S as r, a as t, b as l, c as i, d as o, e as n, f as c, g as S, i as d, h as g, j as p, k as u, r as f } from "./authui-display-CKfGK5va.js";
2
- import { S as h, i as m, a as A, r as M } from "./uploader-vfczkX51.js";
1
+ import { A as a, S as r, a as t, b as l, c as i, d as o, e as n, f as c, g as S, i as d, h as g, j as p, k as u, r as f } from "./authui-display-CRUABt43.js";
2
+ import { S as h, i as m, a as A, r as M } from "./uploader-Cz9yfzfV.js";
3
3
  import { OPERATORS as x, matchesPredicate as C, validatePredicate as O } from "@singlebase/core";
4
- import { T as U, d as P, r as k } from "./files-DDJWPzZW.js";
5
- import { S as E, a as F, c as N, d as R, b as w, p as B, e as G, r as I, s as j, f as y, g as K } from "./chat-CEh6RygY.js";
4
+ import { T as U, d as P, r as k } from "./files-DS-H-3yN.js";
5
+ import { S as E, a as F, c as N, d as R, b as w, p as B, e as G, r as I, s as j, f as y, g as K } from "./chat-t4o5FsxM.js";
6
6
  export {
7
7
  a as AuthController,
8
8
  x as OPERATORS,