@ai-ecoverse/slicc-spectrum 1.23.0 → 1.23.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
@@ -10338,6 +10338,7 @@ function deepActive(root2) {
10338
10338
  return active?.shadowRoot ? deepActive(active.shadowRoot) ?? active : active;
10339
10339
  }
10340
10340
  var scrollback = 1 << 18;
10341
+ var laid = ({ width, height }) => width > 0 && height > 0;
10341
10342
  var ended = { write() {
10342
10343
  }, resize() {
10343
10344
  }, close() {
@@ -10540,7 +10541,14 @@ var SliccTerminalPanel = class extends ThemedElement {
10540
10541
  if (this.#screen && bound?.port === model.terminals && bound.id === info.id)
10541
10542
  return this.#screen;
10542
10543
  const terminal = document.createElement("slicc-terminal");
10543
- terminal.backend = keep(model.terminals, info.id);
10544
+ const backend = keep(model.terminals, info.id);
10545
+ terminal.backend = {
10546
+ open: async (sink) => {
10547
+ await this.#placed(info.id);
10548
+ terminal.fit();
10549
+ return backend.open(sink, { cols: terminal.cols, rows: terminal.rows });
10550
+ }
10551
+ };
10544
10552
  terminal.addEventListener("exit", () => model.terminals.close(info.id));
10545
10553
  this.#screen = terminal;
10546
10554
  this.#bound = { port: model.terminals, id: info.id };
@@ -10556,6 +10564,18 @@ var SliccTerminalPanel = class extends ThemedElement {
10556
10564
  );
10557
10565
  return terminal;
10558
10566
  }
10567
+ #placed(id) {
10568
+ const host2 = this.getRootNode().host;
10569
+ const panel = host2?.localName === "slicc-dock" ? host2.api.getPanel(terminalPanel(id)) : void 0;
10570
+ if (!panel || laid(panel.api)) return Promise.resolve();
10571
+ return new Promise((resolve) => {
10572
+ const watch = panel.api.onDidDimensionsChange((size4) => {
10573
+ if (!laid(size4)) return;
10574
+ watch.dispose();
10575
+ resolve();
10576
+ });
10577
+ });
10578
+ }
10559
10579
  #request() {
10560
10580
  this.dispatchEvent(new CustomEvent("new-terminal", { bubbles: true, composed: true }));
10561
10581
  }