@8wave/ai-elements 0.124.0-beta.1 → 0.124.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -296,6 +296,7 @@ Same attributes as the floating widget except `floating-button-position`, plus:
296
296
  | `forwarded-slots` | `string` | none | Comma-separated slot names forwarded to the inner chat (for example `"tool-showArtifact,subagent"`). |
297
297
  | `theme` | `'light' \| 'dark'` | none | The color scheme, over the agent's own setting too, where `system-theme` only applies to an agent set to automatic. For a page that switches theme around a `panel`, which shows the page's background through it. Reactive. |
298
298
  | `follow-page-dialogs` | `boolean` | `false` | While your page has a modal `<dialog>` open, the chat moves into it and stays usable. See [Your modal dialogs](#your-modal-dialogs). Reactive. |
299
+ | `closable` | `boolean` | `false` | The chat's menu offers "Close", which dispatches `close-requested`: for a `panel` your page opens and closes. The widget does not hide itself. Reactive. |
299
300
 
300
301
  ## JavaScript API
301
302
 
@@ -345,6 +346,7 @@ Listen on the element or on any ancestor, `document` included.
345
346
  | `external-token-expiring` | `null` | The session's external token expires in a minute (or is halfway through, when it lives two minutes or less), while the session goes on. Answer with `signIn(freshToken)`, a new JWT of the same user: the session keeps going with it. See [External token](#external-token-jwt). |
346
347
  | `opened` | `null` | The floating panel opened, by the user or by the API. |
347
348
  | `closed` | `null` | The floating panel closed, by the user or by the API. |
349
+ | `close-requested` | `null` | The user chose "Close" in the menu of an embedded widget with `closable`. Close the panel that holds it. |
348
350
  | `chat-error` | `{ type: string, title: string, status: number }` | An API error in the chat. Not named `error`, so it never reaches `window.onerror` and the error monitoring of your page. |
349
351
  | `working-started` | `null` | The agent started answering or running a tool. See [Working state](#working-state). |
350
352
  | `working-ended` | `null` | The agent stopped, or is waiting for the user to confirm an action. |
@@ -1428,6 +1430,7 @@ export interface FloatingChatWidgetElement extends ChatWidgetElement {
1428
1430
  export interface EmbeddedChatWidgetElement extends ChatWidgetElement {
1429
1431
  displayMode?: 'widget' | 'fullscreen' | 'panel'
1430
1432
  forwardedSlots?: string
1433
+ closable?: boolean
1431
1434
  }
1432
1435
 
1433
1436
  declare global {
@@ -1439,6 +1442,7 @@ declare global {
1439
1442
  'signed-in': CustomEvent<{ userId: string; isAnonymous: boolean }>
1440
1443
  'external-auth-expired': CustomEvent<null>
1441
1444
  'chat-error': CustomEvent<{ type: string; title: string; status: number }>
1445
+ 'close-requested': CustomEvent<null>
1442
1446
  'working-started': CustomEvent<null>
1443
1447
  'working-ended': CustomEvent<null>
1444
1448
  'page-control-started': CustomEvent<null>
@@ -18954,7 +18954,8 @@ var hC = { class: "pk-chatbot__header-start" }, gC = ["title"], _C = { key: 1 },
18954
18954
  pageForms: { type: Function },
18955
18955
  modifier: { type: String },
18956
18956
  userName: { type: String },
18957
- userFilesEnabled: { type: Boolean }
18957
+ userFilesEnabled: { type: Boolean },
18958
+ closable: { type: Boolean }
18958
18959
  }, {
18959
18960
  chatId: {
18960
18961
  type: String,
@@ -18967,7 +18968,8 @@ var hC = { class: "pk-chatbot__header-start" }, gC = ["title"], _C = { key: 1 },
18967
18968
  "show-info",
18968
18969
  "revise",
18969
18970
  "error",
18970
- "loaded"
18971
+ "loaded",
18972
+ "close"
18971
18973
  ], ["update:chatId"]),
18972
18974
  setup(e, { expose: t, emit: n }) {
18973
18975
  let r = ge(), { t: i } = ze({ useScope: "global" }), a = e, o = n, s = oe(e, "chatId"), c = Lf(a.agentId);
@@ -18989,7 +18991,7 @@ var hC = { class: "pk-chatbot__header-start" }, gC = ["title"], _C = { key: 1 },
18989
18991
  o("error", t);
18990
18992
  } catch {}
18991
18993
  });
18992
- let E = B(() => a.modifier === "fullscreen"), D = B(() => a.modifier === "panel"), k = he("chatbotEl"), { width: ae } = hn(k), se = B(() => ae.value > 0 && ae.value < 576), ce = B(() => ae.value > 0 && ae.value < 640), le = B(() => ae.value >= 848), fe = B(() => a.agentType === "reasoning"), M = B(() => fe.value && !l.value.some((e) => e.role === "user")), N = B(() => !D.value && a.agentInterface?.useColorsForAgentHeader), P = B(() => !D.value || w.value || T.value || m.value || !!a.userFilesEnabled && !!u.value), me = B(() => ["theme", `theme--${p.value ? "dark" : "light"}`]), _e = B(() => a.agentInterface?.mainColor), be = B(() => jt(a.agentInterface?.textColor, _e.value)), xe = B(() => $t(_e.value, be.value)), Se = jn(() => a.agentInterface?.footerMessage), L = B(() => d.value === "conversations" ? i("label.conversations") : d.value === "profile" ? i("label.profile") : d.value === "auth" ? i("label.authentication") : d.value === "files" ? i("userFiles.chatFilesTitle") : a.name), z = B(() => l.value?.[l.value.length - 1]);
18994
+ let E = B(() => a.modifier === "fullscreen"), D = B(() => a.modifier === "panel"), k = he("chatbotEl"), { width: ae } = hn(k), se = B(() => ae.value > 0 && ae.value < 576), ce = B(() => ae.value > 0 && ae.value < 640), le = B(() => ae.value >= 848), fe = B(() => a.agentType === "reasoning"), M = B(() => fe.value && !l.value.some((e) => e.role === "user")), N = B(() => !D.value && a.agentInterface?.useColorsForAgentHeader), P = B(() => !D.value || w.value || T.value || m.value || a.closable || !!a.userFilesEnabled && !!u.value), me = B(() => ["theme", `theme--${p.value ? "dark" : "light"}`]), _e = B(() => a.agentInterface?.mainColor), be = B(() => jt(a.agentInterface?.textColor, _e.value)), xe = B(() => $t(_e.value, be.value)), Se = jn(() => a.agentInterface?.footerMessage), L = B(() => d.value === "conversations" ? i("label.conversations") : d.value === "profile" ? i("label.profile") : d.value === "auth" ? i("label.authentication") : d.value === "files" ? i("userFiles.chatFilesTitle") : a.name), z = B(() => l.value?.[l.value.length - 1]);
18993
18995
  return t({
18994
18996
  startNewChat: _,
18995
18997
  regenerate: y,
@@ -19111,6 +19113,13 @@ var hC = { class: "pk-chatbot__header-start" }, gC = ["title"], _C = { key: 1 },
19111
19113
  }, {
19112
19114
  default: G(() => [j(s, { name: "ri:account-circle-line" }), Fe(" " + H(J(i)("action.signIn")), 1)]),
19113
19115
  _: 1
19116
+ })) : K("", !0),
19117
+ e.closable ? (X(), F(c, {
19118
+ key: 6,
19119
+ onClick: n[9] ||= (e) => o("close")
19120
+ }, {
19121
+ default: G(() => [j(s, { name: "ri:close-line" }), Fe(" " + H(J(i)("action.close")), 1)]),
19122
+ _: 1
19114
19123
  })) : K("", !0)
19115
19124
  ]),
19116
19125
  default: G(() => [j(a, ne(re({
@@ -19142,8 +19151,8 @@ var hC = { class: "pk-chatbot__header-start" }, gC = ["title"], _C = { key: 1 },
19142
19151
  "agent-id": e.agentId,
19143
19152
  modifier: e.modifier,
19144
19153
  "user-name": e.userName,
19145
- onShowInfo: n[9] ||= (e) => o("show-info", e),
19146
- onRevise: n[10] ||= (e) => o("revise", e)
19154
+ onShowInfo: n[10] ||= (e) => o("show-info", e),
19155
+ onRevise: n[11] ||= (e) => o("revise", e)
19147
19156
  }, ve({ _: 2 }, [pe(Object.keys(J(r)), (e) => ({
19148
19157
  name: e,
19149
19158
  fn: G((n) => [ie(t.$slots, e, ne(re(n)))])
@@ -20905,6 +20914,10 @@ var aT = {
20905
20914
  followPageDialogs: {
20906
20915
  type: [Boolean, String],
20907
20916
  default: !1
20917
+ },
20918
+ closable: {
20919
+ type: [Boolean, String],
20920
+ default: !1
20908
20921
  }
20909
20922
  },
20910
20923
  setup(e, { expose: t }) {
@@ -21173,8 +21186,10 @@ var aT = {
21173
21186
  "page-access": J(re).capabilities?.pageAccess,
21174
21187
  "page-tool-registry": J(ge),
21175
21188
  "page-forms": J(_e),
21189
+ closable: !!e.closable && e.closable !== "false",
21176
21190
  onError: T,
21177
- onLoaded: J(w).onLoaded
21191
+ onLoaded: J(w).onLoaded,
21192
+ onClose: n[7] ||= (e) => J(a)("close-requested")
21178
21193
  }, ve({
21179
21194
  "header-actions": G(() => [ie(t.$slots, "header-actions")]),
21180
21195
  actions: G(() => [ie(t.$slots, "actions")]),
@@ -21231,6 +21246,7 @@ var aT = {
21231
21246
  "page-access",
21232
21247
  "page-tool-registry",
21233
21248
  "page-forms",
21249
+ "closable",
21234
21250
  "onLoaded"
21235
21251
  ])) : K("", !0),
21236
21252
  j(J(i))