@ai-ecoverse/slicc-spectrum 1.22.0 → 1.22.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
@@ -16709,18 +16709,46 @@ var SliccChat = class extends ThemedElement {
16709
16709
  })
16710
16710
  ];
16711
16711
  }
16712
+ #stuck = true;
16713
+ #last = 0;
16714
+ #resize = new ResizeObserver(() => this.#pin());
16715
+ #log() {
16716
+ return this.renderRoot.querySelector(".log");
16717
+ }
16718
+ #pin() {
16719
+ if (!this.#stuck) return;
16720
+ const log = this.#log();
16721
+ log.scrollTop = log.scrollHeight;
16722
+ this.#last = log.scrollTop;
16723
+ }
16724
+ #scroll = () => {
16725
+ const log = this.#log();
16726
+ if (log.scrollHeight - log.scrollTop - log.clientHeight < 48) this.#stuck = true;
16727
+ else if (log.scrollTop < this.#last) this.#stuck = false;
16728
+ this.#last = log.scrollTop;
16729
+ };
16712
16730
  #refresh(jump) {
16713
- const log = this.renderRoot.querySelector(".log");
16714
- const stuck = !log || log.scrollHeight - log.scrollTop - log.clientHeight < 48;
16731
+ if (jump) this.#stuck = true;
16715
16732
  this.requestUpdate();
16716
- void this.updateComplete.then(() => {
16717
- const next = this.renderRoot.querySelector(".log");
16718
- if (next && (jump || stuck)) next.scrollTop = next.scrollHeight;
16719
- });
16733
+ void this.updateComplete.then(() => this.#pin());
16720
16734
  }
16721
- firstUpdated() {
16735
+ #observe() {
16736
+ const log = this.#log();
16737
+ this.#resize.observe(log);
16738
+ this.#resize.observe(log.firstElementChild);
16722
16739
  this.#refresh(true);
16723
16740
  }
16741
+ connectedCallback() {
16742
+ super.connectedCallback();
16743
+ if (this.hasUpdated) this.#observe();
16744
+ }
16745
+ disconnectedCallback() {
16746
+ super.disconnectedCallback();
16747
+ this.#resize.disconnect();
16748
+ }
16749
+ firstUpdated() {
16750
+ this.#observe();
16751
+ }
16724
16752
  focus() {
16725
16753
  this.focusOn("slicc-composer");
16726
16754
  }
@@ -16815,7 +16843,7 @@ var SliccChat = class extends ThemedElement {
16815
16843
  <header>
16816
16844
  ${agent ? this.#meta(agent) : b`<span>No agent</span>`}
16817
16845
  </header>
16818
- <div class="log" role="log" aria-live="polite" aria-label="Conversation">
16846
+ <div class="log" role="log" aria-live="polite" aria-label="Conversation" @scroll=${this.#scroll}>
16819
16847
  <div class="column">
16820
16848
  ${agent && messages.length > 0 ? this.#items(messages, agent) : b`<div class="empty">No messages yet. Ask ${agent?.name ?? "the agent"} something.</div>`}
16821
16849
  </div>
@@ -70164,6 +70192,10 @@ var css = `
70164
70192
  .mount {
70165
70193
  height: 100%;
70166
70194
  }
70195
+
70196
+ file-tree-container {
70197
+ color-scheme: inherit;
70198
+ }
70167
70199
  `;
70168
70200
  var SliccFileTree = class extends HTMLElement {
70169
70201
  static loaded = FileTreeContainerLoaded;