@ai-ecoverse/slicc-spectrum 1.8.0 → 1.8.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
@@ -6669,7 +6669,7 @@ function chatAgent(id) {
6669
6669
  function chats(dock) {
6670
6670
  return dock.api.panels.map((panel) => panel.id).filter((id) => chatAgent(id) !== null);
6671
6671
  }
6672
- function openChat(dock, agent, screen, focus = true) {
6672
+ function openChat(dock, agent, screen, focus = true, reveal = true) {
6673
6673
  const id = chatId(agent.id);
6674
6674
  if (!dock.has(id)) {
6675
6675
  const sibling = chats(dock)[0];
@@ -6684,7 +6684,7 @@ function openChat(dock, agent, screen, focus = true) {
6684
6684
  });
6685
6685
  }
6686
6686
  if (focus) dock.focusPanel(id);
6687
- else dock.reveal(id);
6687
+ else if (reveal) dock.reveal(id);
6688
6688
  return id;
6689
6689
  }
6690
6690
  function openDocument(dock, kind, path, screen) {
@@ -6976,13 +6976,13 @@ var SliccApp = class extends ThemedElement {
6976
6976
  const width = this.getBoundingClientRect().width;
6977
6977
  if (width > 0) this.screen = screenClass(width);
6978
6978
  }
6979
- updated() {
6980
- if (this.model && this.#started !== this.screen) this.#start(this.model);
6979
+ updated(changed) {
6980
+ if (!this.model) return;
6981
+ if (this.#started !== this.screen) this.#start(this.model);
6982
+ else if (changed.has("model")) this.#rebind(this.model);
6981
6983
  }
6982
- #start(model) {
6983
- const dock = this.dock;
6984
- this.#saving = false;
6985
- dock.factories = {
6984
+ #factories(model) {
6985
+ return {
6986
6986
  ...Object.fromEntries(this.surfaces.map((item2) => [item2.id, () => create(item2.tag, model)])),
6987
6987
  ...Object.fromEntries(
6988
6988
  Object.entries(documents).map(([kind, document2]) => [
@@ -6993,6 +6993,22 @@ var SliccApp = class extends ThemedElement {
6993
6993
  ...this.#offers("chat") ? { chat: (params) => create("slicc-chat", model, params) } : {},
6994
6994
  sprinkle: (params) => create("slicc-sprinkle", model, params)
6995
6995
  };
6996
+ }
6997
+ #rebind(model) {
6998
+ const dock = this.dock;
6999
+ dock.factories = this.#factories(model);
7000
+ for (const panel of dock.api.panels) {
7001
+ const element2 = dock.content(panel.id);
7002
+ if (element2 && "model" in element2) element2.model = model;
7003
+ }
7004
+ this.#prune();
7005
+ const agent = this.#active();
7006
+ if (agent && this.#offers("chat")) openChat(dock, agent, this.screen, false, false);
7007
+ }
7008
+ #start(model) {
7009
+ const dock = this.dock;
7010
+ this.#saving = false;
7011
+ dock.factories = this.#factories(model);
6996
7012
  dock.accepts = [dipType];
6997
7013
  this.dips.load(this.storage);
6998
7014
  const saved = this.#saved();