@ai-ecoverse/slicc-spectrum 1.23.1 → 1.23.3

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