@ai-ecoverse/slicc-spectrum 1.8.0 → 1.8.1

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
@@ -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);
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();