@ai-ecoverse/slicc-spectrum 1.23.1 → 1.23.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/dist/slicc-ui.js CHANGED
@@ -8541,8 +8541,8 @@ var ModelElement = class extends i2 {
8541
8541
  subscribe(model) {
8542
8542
  return [];
8543
8543
  }
8544
- focusOn(selector) {
8545
- const focus = () => this.renderRoot.querySelector(selector)?.focus();
8544
+ focusOn(...selectors) {
8545
+ const focus = () => selectors.map((selector) => this.renderRoot.querySelector(selector)).find(Boolean)?.focus();
8546
8546
  if (this.hasUpdated) focus();
8547
8547
  else void this.updateComplete.then(focus);
8548
8548
  }
@@ -13709,6 +13709,10 @@ var SliccUpdates = class extends ModelElement {
13709
13709
  padding: var(--swc-spacing-400);
13710
13710
  margin: 0 auto;
13711
13711
  }
13712
+ .page:focus-visible {
13713
+ outline: var(--swc-focus-indicator-thickness) solid var(--swc-focus-indicator-color);
13714
+ outline-offset: calc(-1 * var(--swc-focus-indicator-thickness));
13715
+ }
13712
13716
  .hint {
13713
13717
  margin: 0 0 var(--swc-spacing-300);
13714
13718
  color: var(--swc-neutral-subdued-content-color-default);
@@ -13825,7 +13829,7 @@ var SliccUpdates = class extends ModelElement {
13825
13829
  ];
13826
13830
  }
13827
13831
  focus() {
13828
- this.focusOn("swc-button, summary");
13832
+ this.focusOn("swc-button, summary", ".page");
13829
13833
  }
13830
13834
  async act(id, action) {
13831
13835
  const port = this.model?.updates;
@@ -13910,7 +13914,7 @@ var SliccUpdates = class extends ModelElement {
13910
13914
  }
13911
13915
  render() {
13912
13916
  const port = this.model?.updates;
13913
- return b`<div class="page">
13917
+ return b`<div class="page" tabindex="-1">
13914
13918
  <p class="hint">${hint(port)}</p>
13915
13919
  ${c(
13916
13920
  port?.list() ?? [],
@@ -15560,9 +15564,7 @@ var SliccBrowser = class extends ModelElement {
15560
15564
  }
15561
15565
  focus() {
15562
15566
  void this.updateComplete.then(
15563
- () => this.focusOn(
15564
- this.renderRoot.querySelector('.window[aria-current="true"]') ? '.window[aria-current="true"]' : ".window"
15565
- )
15567
+ () => this.focusOn('.window[aria-current="true"]', ".window", "form swc-button")
15566
15568
  );
15567
15569
  }
15568
15570
  #key(tab) {
@@ -17138,6 +17140,21 @@ var messageCss = i`
17138
17140
  `;
17139
17141
 
17140
17142
  // src/app/chat.ts
17143
+ var touched = false;
17144
+ document.addEventListener(
17145
+ "pointerdown",
17146
+ (event) => {
17147
+ touched = event.pointerType !== "mouse";
17148
+ },
17149
+ true
17150
+ );
17151
+ document.addEventListener(
17152
+ "keydown",
17153
+ () => {
17154
+ touched = false;
17155
+ },
17156
+ true
17157
+ );
17141
17158
  var SliccChat = class extends ThemedElement {
17142
17159
  static properties = { ...ThemedElement.properties, agent: {} };
17143
17160
  constructor() {
@@ -17189,6 +17206,10 @@ var SliccChat = class extends ThemedElement {
17189
17206
  overflow-y: auto;
17190
17207
  padding: 12px 16px 24px;
17191
17208
  }
17209
+ .log:focus-visible {
17210
+ outline: var(--swc-focus-indicator-thickness) solid var(--swc-focus-indicator-color);
17211
+ outline-offset: calc(-1 * var(--swc-focus-indicator-thickness));
17212
+ }
17192
17213
  .column {
17193
17214
  max-width: 860px;
17194
17215
  margin: 0 auto;
@@ -17267,7 +17288,9 @@ var SliccChat = class extends ThemedElement {
17267
17288
  this.#observe();
17268
17289
  }
17269
17290
  focus() {
17270
- this.focusOn("slicc-composer");
17291
+ if (!touched && globalThis.matchMedia("(pointer: fine)").matches)
17292
+ this.focusOn("slicc-composer");
17293
+ else this.focusOn(".log");
17271
17294
  }
17272
17295
  #id() {
17273
17296
  return this.agent || (this.model?.agent.active() ?? "");
@@ -17360,7 +17383,14 @@ var SliccChat = class extends ThemedElement {
17360
17383
  <header>
17361
17384
  ${agent ? this.#meta(agent) : b`<span>No agent</span>`}
17362
17385
  </header>
17363
- <div class="log" role="log" aria-live="polite" aria-label="Conversation" @scroll=${this.#scroll}>
17386
+ <div
17387
+ class="log"
17388
+ role="log"
17389
+ aria-live="polite"
17390
+ aria-label="Conversation"
17391
+ tabindex="-1"
17392
+ @scroll=${this.#scroll}
17393
+ >
17364
17394
  <div class="column">
17365
17395
  ${agent && messages.length > 0 ? this.#items(messages, agent) : b`<div class="empty">No messages yet. Ask ${agent?.name ?? "the agent"} something.</div>`}
17366
17396
  </div>
@@ -18435,7 +18465,7 @@ var SliccMemory = class extends ModelElement {
18435
18465
  return [model.memory.on("memories", update), model.agent.on("agents", update)];
18436
18466
  }
18437
18467
  focus() {
18438
- this.focusOn("sp-search");
18468
+ this.focusOn(".head", ".bar swc-action-button");
18439
18469
  }
18440
18470
  #save(memory) {
18441
18471
  const form = this.renderRoot.querySelector(".editor");
@@ -18671,6 +18701,9 @@ var SliccMonitor = class extends ModelElement {
18671
18701
  subscribe(model) {
18672
18702
  return [model.monitor.on("snapshot", () => this.requestUpdate())];
18673
18703
  }
18704
+ focus() {
18705
+ this.focusOn(".bar swc-action-button");
18706
+ }
18674
18707
  #vital(vital) {
18675
18708
  if (vital.ratio !== void 0) {
18676
18709
  return b`<div class="vital" data-id=${vital.id}>
@@ -19226,6 +19259,10 @@ var SliccSprinkle = class extends ThemedElement {
19226
19259
  height: 100%;
19227
19260
  border: 0;
19228
19261
  }
19262
+ iframe:focus-visible {
19263
+ outline: var(--swc-focus-indicator-thickness) solid var(--swc-focus-indicator-color);
19264
+ outline-offset: calc(-1 * var(--swc-focus-indicator-thickness));
19265
+ }
19229
19266
  .frame {
19230
19267
  border: 1px solid var(--spectrum-gray-200);
19231
19268
  background: var(--spectrum-background-layer-1-color);
@@ -19294,6 +19331,9 @@ var SliccSprinkle = class extends ThemedElement {
19294
19331
  }
19295
19332
  };
19296
19333
  #dips = new Dips();
19334
+ focus() {
19335
+ this.focusOn("iframe");
19336
+ }
19297
19337
  subscribe(model) {
19298
19338
  this.#dips = dipsOf(this) ?? this.#dips;
19299
19339
  globalThis.addEventListener("message", this.#message);