@singlebase/elements 0.3.0 → 0.5.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 (51) hide show
  1. package/README.md +2 -0
  2. package/dist/{display-8HEcKYR4.js → authui-display-BCZBP7HR.js} +11 -10
  3. package/dist/authui-display-BCZBP7HR.js.map +1 -0
  4. package/dist/{display-CLDNNZQy.cjs → authui-display-CLGFSqRi.cjs} +21 -21
  5. package/dist/authui-display-CLGFSqRi.cjs.map +1 -0
  6. package/dist/authui.cjs +1 -1
  7. package/dist/authui.d.ts +9 -9
  8. package/dist/authui.js +2 -2
  9. package/dist/chat-DRenTJlI.cjs +3001 -0
  10. package/dist/chat-DRenTJlI.cjs.map +1 -0
  11. package/dist/chat-bXaRWel7.js +4926 -0
  12. package/dist/chat-bXaRWel7.js.map +1 -0
  13. package/dist/chat-messages.d.ts +109 -0
  14. package/dist/chat.cjs +2 -0
  15. package/dist/chat.cjs.map +1 -0
  16. package/dist/chat.d.ts +10 -0
  17. package/dist/chat.js +13 -0
  18. package/dist/chat.js.map +1 -0
  19. package/dist/elements/{account-screen.d.ts → authui-account.d.ts} +1 -1
  20. package/dist/elements/{buttons.d.ts → authui-buttons.d.ts} +1 -1
  21. package/dist/elements/{display.d.ts → authui-display.d.ts} +1 -1
  22. package/dist/elements/{form-base.d.ts → authui-form-base.d.ts} +1 -1
  23. package/dist/elements/{guard.d.ts → authui-guard.d.ts} +1 -1
  24. package/dist/elements/{auth-screen.d.ts → authui.d.ts} +3 -3
  25. package/dist/elements/chat.d.ts +312 -0
  26. package/dist/files-BOwtpYyQ.js +168 -0
  27. package/dist/files-BOwtpYyQ.js.map +1 -0
  28. package/dist/files-DW8A4Jl-.cjs +38 -0
  29. package/dist/files-DW8A4Jl-.cjs.map +1 -0
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.d.ts +3 -2
  32. package/dist/index.js +36 -25
  33. package/dist/index.js.map +1 -1
  34. package/dist/singlebase-elements.min.js +6841 -1824
  35. package/dist/singlebase-elements.min.js.map +1 -1
  36. package/dist/styles/chat.d.ts +6 -0
  37. package/dist/styles/tokens.d.ts +1 -1
  38. package/dist/{uploader-eFYKpk8b.cjs → uploader-DGV2y9uT.cjs} +41 -77
  39. package/dist/uploader-DGV2y9uT.cjs.map +1 -0
  40. package/dist/{uploader-D-Da1trc.js → uploader-abQoem5q.js} +309 -463
  41. package/dist/uploader-abQoem5q.js.map +1 -0
  42. package/dist/uploader.cjs +1 -1
  43. package/dist/uploader.js +5 -4
  44. package/dist/uploader.js.map +1 -1
  45. package/dist/utils/markdown.d.ts +108 -0
  46. package/package.json +13 -5
  47. package/dist/display-8HEcKYR4.js.map +0 -1
  48. package/dist/display-CLDNNZQy.cjs.map +0 -1
  49. package/dist/uploader-D-Da1trc.js.map +0 -1
  50. package/dist/uploader-eFYKpk8b.cjs.map +0 -1
  51. /package/dist/elements/{base.d.ts → authui-base.d.ts} +0 -0
package/README.md CHANGED
@@ -4,6 +4,7 @@ Singlebase web components, framework-free:
4
4
 
5
5
  - `<singlebase-authui>` and friends — sign-in, sign-up, codes, OAuth and the account view
6
6
  - `<singlebase-uploader>` — pick, check and upload files straight to storage
7
+ - `<singlebase-chat>` — an AI chat workspace on the `llm` service
7
8
 
8
9
  ```bash
9
10
  npm install @singlebase/elements @singlebase/singlebase-sdk
@@ -13,6 +14,7 @@ npm install @singlebase/elements @singlebase/singlebase-sdk
13
14
  import "@singlebase/elements"; // everything
14
15
  import "@singlebase/elements/authui"; // auth elements only
15
16
  import "@singlebase/elements/uploader"; // uploader only
17
+ import "@singlebase/elements/chat"; // chat only
16
18
  ```
17
19
 
18
20
  Or with no build step:
@@ -9,8 +9,9 @@ import { LitElement as ss, html as a, nothing as d, css as je } from "lit";
9
9
  import { property as p, state as m, customElement as fe } from "lit/decorators.js";
10
10
  import { ifDefined as k } from "lit/directives/if-defined.js";
11
11
  import { SinglebaseAuthError as ye, mapErrorToHint as is, createFilesUploadApi as as, resolveScreen as rs } from "@singlebase/singlebase-sdk";
12
- import { t as ns, s as os, r as ls } from "./uploader-D-Da1trc.js";
13
- import { getDefaultClient as hs, AUTHUI_PROP_KEYS as ds, authUIAttributeFor as cs, matchesPredicate as us, validatePredicate as ps, getPath as Le } from "@singlebase/core";
12
+ import { s as ns, r as os } from "./uploader-abQoem5q.js";
13
+ import { getDefaultClient as ls, AUTHUI_PROP_KEYS as hs, authUIAttributeFor as ds, matchesPredicate as cs, validatePredicate as us, getPath as Le } from "@singlebase/core";
14
+ import { t as ps } from "./files-BOwtpYyQ.js";
14
15
  class gs {
15
16
  constructor(t) {
16
17
  b(this, "host");
@@ -230,7 +231,7 @@ class $ extends ss {
230
231
  */
231
232
  get resolvedClient() {
232
233
  var e;
233
- return this.client ? this.client : ((e = hs()) == null ? void 0 : e.auth) ?? null;
234
+ return this.client ? this.client : ((e = ls()) == null ? void 0 : e.auth) ?? null;
234
235
  }
235
236
  /** Page-wide UI config from SinglebaseClient({ authui }), if there is one. */
236
237
  get uiConfig() {
@@ -258,9 +259,9 @@ class $ extends ss {
258
259
  applyUIConfig() {
259
260
  const e = this.uiConfig;
260
261
  if (e) {
261
- for (const s of ds) {
262
+ for (const s of hs) {
262
263
  const i = e[s];
263
- i !== void 0 && s in this && (this.hasAttribute(cs(s)) || this.appliedConfig.has(s) || (this.appliedConfig.add(s), this[s] = i));
264
+ i !== void 0 && s in this && (this.hasAttribute(ds(s)) || this.appliedConfig.has(s) || (this.appliedConfig.add(s), this[s] = i));
264
265
  }
265
266
  for (const [s, i] of Object.entries(e.tokens ?? {}))
266
267
  s.startsWith("--") && (this.style.getPropertyValue(s) || this.style.setProperty(s, i));
@@ -287,7 +288,7 @@ class $ extends ss {
287
288
  super.willUpdate(e), this.auth.bind(this.resolvedClient), this.applyUIConfig();
288
289
  }
289
290
  }
290
- x = new WeakMap(), T = new WeakMap(), U = new WeakMap(), L = new WeakMap(), A = new WeakMap(), b($, "styles", [ns, os]);
291
+ x = new WeakMap(), T = new WeakMap(), U = new WeakMap(), L = new WeakMap(), A = new WeakMap(), b($, "styles", [ps, ns]);
291
292
  ve([
292
293
  p({ attribute: !1 })
293
294
  ], $.prototype, "client");
@@ -2119,7 +2120,7 @@ let u = (Be = class extends $ {
2119
2120
  */
2120
2121
  get redirectTarget() {
2121
2122
  var t;
2122
- return ls(
2123
+ return os(
2123
2124
  this.redirectUrl || this.redirectParam,
2124
2125
  (t = globalThis.location) == null ? void 0 : t.href,
2125
2126
  (e) => console.warn(`[singlebase] ${e}`)
@@ -3227,14 +3228,14 @@ let O = (Re = class extends $ {
3227
3228
  if (!this.predicate) return "authenticated";
3228
3229
  this.warnOnce(this.predicate);
3229
3230
  const e = this.auth.state.user;
3230
- return us(e, this.predicate) ? "authenticated" : this.onMismatch === "hidden" ? "hidden" : "unauthenticated";
3231
+ return cs(e, this.predicate) ? "authenticated" : this.onMismatch === "hidden" ? "hidden" : "unauthenticated";
3231
3232
  }
3232
3233
  /** Surfaces a malformed predicate once, rather than silently never matching. */
3233
3234
  warnOnce(t) {
3234
3235
  const e = JSON.stringify(t);
3235
3236
  if (this.warnedFor !== e) {
3236
3237
  this.warnedFor = e;
3237
- for (const s of ps(t))
3238
+ for (const s of us(t))
3238
3239
  console.warn(`[singlebase] <singlebase-authui-guard> predicate: ${s}`);
3239
3240
  }
3240
3241
  }
@@ -3441,4 +3442,4 @@ export {
3441
3442
  Ie as k,
3442
3443
  ms as r
3443
3444
  };
3444
- //# sourceMappingURL=display-8HEcKYR4.js.map
3445
+ //# sourceMappingURL=authui-display-BCZBP7HR.js.map