@ai-ecoverse/slicc-spectrum 1.53.1 → 1.54.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/slicc-ui.js CHANGED
@@ -26058,19 +26058,19 @@ var SliccComposer = class extends ModelElement {
26058
26058
  };
26059
26059
  }
26060
26060
  pick(choice) {
26061
- const popup = this.popup;
26062
- if (!popup) return;
26063
- if (popup.kind === "file") {
26061
+ const popup2 = this.popup;
26062
+ if (!popup2) return;
26063
+ if (popup2.kind === "file") {
26064
26064
  this.popup = null;
26065
26065
  void this.attachPath(choice.value);
26066
26066
  return;
26067
26067
  }
26068
26068
  const area = this.#textarea;
26069
26069
  const caret = area.selectionStart ?? this.value.length;
26070
- const insert = popup.kind === "command" ? `/${choice.value} ` : popup.kind === "mention" ? `@${choice.value} ` : `${choice.value} `;
26071
- this.value = this.value.slice(0, popup.start) + insert + this.value.slice(caret);
26070
+ const insert = popup2.kind === "command" ? `/${choice.value} ` : popup2.kind === "mention" ? `@${choice.value} ` : `${choice.value} `;
26071
+ this.value = this.value.slice(0, popup2.start) + insert + this.value.slice(caret);
26072
26072
  this.popup = null;
26073
- const position = popup.start + insert.length;
26073
+ const position = popup2.start + insert.length;
26074
26074
  void this.updateComplete.then(() => this.#field?.updateComplete).then(() => {
26075
26075
  area.focus();
26076
26076
  area.setSelectionRange(position, position);
@@ -26089,20 +26089,20 @@ var SliccComposer = class extends ModelElement {
26089
26089
  return true;
26090
26090
  }
26091
26091
  #popupKey(event2) {
26092
- const popup = this.popup;
26093
- if (!popup || popup.kind === "secret") return false;
26092
+ const popup2 = this.popup;
26093
+ if (!popup2 || popup2.kind === "secret") return false;
26094
26094
  if (event2.key === "Escape") {
26095
26095
  this.popup = null;
26096
26096
  return true;
26097
26097
  }
26098
- const count = popup.items.length;
26098
+ const count = popup2.items.length;
26099
26099
  if ((event2.key === "ArrowDown" || event2.key === "ArrowUp") && count) {
26100
26100
  const step = event2.key === "ArrowDown" ? 1 : -1;
26101
- this.popup = { ...popup, index: (popup.index + step + count) % count };
26101
+ this.popup = { ...popup2, index: (popup2.index + step + count) % count };
26102
26102
  return true;
26103
26103
  }
26104
26104
  if ((event2.key === "Enter" || event2.key === "Tab") && count && !event2.shiftKey) {
26105
- this.pick(popup.items[popup.index]);
26105
+ this.pick(popup2.items[popup2.index]);
26106
26106
  return true;
26107
26107
  }
26108
26108
  return false;
@@ -26207,9 +26207,9 @@ var SliccComposer = class extends ModelElement {
26207
26207
  </swc-upload-attachment>`;
26208
26208
  }
26209
26209
  #popup() {
26210
- const popup = this.popup;
26211
- if (!popup) return A;
26212
- if (popup.kind === "secret") {
26210
+ const popup2 = this.popup;
26211
+ if (!popup2) return A;
26212
+ if (popup2.kind === "secret") {
26213
26213
  const submit = (event2) => {
26214
26214
  event2.preventDefault();
26215
26215
  const form = event2.currentTarget;
@@ -26228,11 +26228,11 @@ var SliccComposer = class extends ModelElement {
26228
26228
  argument: "Options",
26229
26229
  mention: "Mention",
26230
26230
  file: "Attach a file from SLICC"
26231
- }[popup.kind];
26231
+ }[popup2.kind];
26232
26232
  const option2 = (item2, index) => b`<div
26233
26233
  class="item"
26234
26234
  role="option"
26235
- aria-selected=${index === popup.index ? "true" : "false"}
26235
+ aria-selected=${index === popup2.index ? "true" : "false"}
26236
26236
  data-value=${item2.value}
26237
26237
  @mousedown=${(event2) => {
26238
26238
  event2.preventDefault();
@@ -26242,13 +26242,13 @@ var SliccComposer = class extends ModelElement {
26242
26242
  <span class="label">${item2.label}</span><span class="detail">${item2.detail}</span>
26243
26243
  </div>`;
26244
26244
  const sections2 = [];
26245
- popup.items.forEach((item2, index) => {
26245
+ popup2.items.forEach((item2, index) => {
26246
26246
  const last = sections2.at(-1);
26247
26247
  if (last && last.group === item2.group) last.entries.push([item2, index]);
26248
26248
  else sections2.push({ group: item2.group, entries: [[item2, index]] });
26249
26249
  });
26250
- return b`<div class="popup" role="listbox" aria-label=${title} data-kind=${popup.kind}>
26251
- ${popup.items.length ? sections2.map(
26250
+ return b`<div class="popup" role="listbox" aria-label=${title} data-kind=${popup2.kind}>
26251
+ ${popup2.items.length ? sections2.map(
26252
26252
  ({ group, entries }) => group ? b`<div class="section" role="group" aria-label=${group} data-group=${group}>
26253
26253
  <div class="heading" aria-hidden="true">${group}</div>
26254
26254
  ${entries.map(([item2, index]) => option2(item2, index))}
@@ -27066,8 +27066,11 @@ var accountStatus = {
27066
27066
  expired: ["notice", "Expired"],
27067
27067
  disconnected: ["neutral", "Not connected"],
27068
27068
  "signing-in": ["info", "Signing in\u2026"],
27069
- rejected: ["notice", "Rejected"]
27069
+ rejected: ["notice", "Rejected"],
27070
+ "needs-sign-in": ["neutral", "Needs sign-in"],
27071
+ "sign-in-expired": ["notice", "Sign-in expired"]
27070
27072
  };
27073
+ var popup = (account) => account.group === "mcp" && account.auth === "oauth";
27071
27074
  var secretNames = { "api-key": "API key", token: "token" };
27072
27075
  var rejectedNames = { "api-key": "API key rejected", token: "Token rejected" };
27073
27076
  var SliccSettings = class extends ModelElement {
@@ -27317,14 +27320,14 @@ var SliccSettings = class extends ModelElement {
27317
27320
  @click=${() => this.#disconnect(account)}
27318
27321
  >Disconnect</swc-button>`;
27319
27322
  }
27320
- const label = account.status === "expired" ? "Reconnect" : "Connect";
27323
+ const label = popup(account) ? "Sign in" : account.status === "expired" ? "Reconnect" : "Connect";
27321
27324
  const entering = this.entering === account.id;
27322
27325
  const busy = this.#signingIn(account) || !entering && this.pending.has(account.id);
27323
27326
  return b`<swc-button
27324
27327
  size="m"
27325
27328
  variant="secondary"
27326
27329
  data-action="connect"
27327
- accessible-label=${`${label} ${account.provider}`}
27330
+ accessible-label=${popup(account) ? `Sign in to ${account.provider}` : `${label} ${account.provider}`}
27328
27331
  ?pending=${busy}
27329
27332
  ?disabled=${entering}
27330
27333
  @click=${() => this.#start(account)}
@@ -27333,6 +27336,8 @@ var SliccSettings = class extends ModelElement {
27333
27336
  #status(account) {
27334
27337
  if (this.#signingIn(account)) return "signing-in";
27335
27338
  if (account.status === "expired" && account.auth === "api-key") return "rejected";
27339
+ if (popup(account) && account.status === "disconnected") return "needs-sign-in";
27340
+ if (popup(account) && account.status === "expired") return "sign-in-expired";
27336
27341
  return account.status;
27337
27342
  }
27338
27343
  #account(account) {
@@ -61675,7 +61680,7 @@ var TabsContainer = class extends CompositeDisposable {
61675
61680
  groupById.set(tg.id, tg);
61676
61681
  if (overflowGroupSet.has(tg.id)) for (const pid of tg.panelIds) panelToGroup.set(pid, tg);
61677
61682
  }
61678
- const popup = () => this.accessor.getPopupServiceForGroup(this.group);
61683
+ const popup2 = () => this.accessor.getPopupServiceForGroup(this.group);
61679
61684
  const buildGroupHeader = (tg) => {
61680
61685
  const groupHeader = document.createElement("div");
61681
61686
  groupHeader.className = "dv-tabs-overflow-group-header";
@@ -61694,7 +61699,7 @@ var TabsContainer = class extends CompositeDisposable {
61694
61699
  groupHeader.appendChild(badge);
61695
61700
  }
61696
61701
  groupHeader.addEventListener("click", () => {
61697
- popup().close();
61702
+ popup2().close();
61698
61703
  if (tg.collapsed) tg.expand();
61699
61704
  const firstPanelId = tg.panelIds[0];
61700
61705
  if (firstPanelId) {
@@ -61746,7 +61751,7 @@ var TabsContainer = class extends CompositeDisposable {
61746
61751
  this.accessor.withOrigin("user", () => panel.api.setActive());
61747
61752
  };
61748
61753
  wrapper.addEventListener("click", (event2) => {
61749
- popup().close();
61754
+ popup2().close();
61750
61755
  if (event2.defaultPrevented) return;
61751
61756
  doActivate();
61752
61757
  });
@@ -61755,15 +61760,15 @@ var TabsContainer = class extends CompositeDisposable {
61755
61760
  element: wrapper,
61756
61761
  panel,
61757
61762
  activate: () => {
61758
- popup().close();
61763
+ popup2().close();
61759
61764
  doActivate();
61760
61765
  }
61761
61766
  };
61762
61767
  },
61763
61768
  open: (body4) => {
61764
- popup().openPopover(body4, anchor);
61769
+ popup2().openPopover(body4, anchor);
61765
61770
  },
61766
- close: () => popup().close(),
61771
+ close: () => popup2().close(),
61767
61772
  focusTrigger: () => {
61768
61773
  root2.tabIndex = -1;
61769
61774
  root2.focus();