@ai-ecoverse/slicc-spectrum 1.65.1 → 1.65.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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SliccTerminal,
3
3
  define
4
- } from "./chunk-XI74SELH.js";
4
+ } from "./chunk-ZGJM5WUN.js";
5
5
  import {
6
6
  kernelBackend
7
7
  } from "./chunk-XYPGNJAO.js";
package/dist/slicc-ui.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  } from "./chunk-EN3XGF2M.js";
25
25
  import {
26
26
  define
27
- } from "./chunk-XI74SELH.js";
27
+ } from "./chunk-ZGJM5WUN.js";
28
28
  import {
29
29
  isVaultFailure,
30
30
  nameProblem,
@@ -13843,13 +13843,13 @@ function resolve(panels, raw2, reachable2, cone) {
13843
13843
  return found?.id ?? null;
13844
13844
  }
13845
13845
  function state(info) {
13846
- const shown3 = info.active ? "active" : info.visible ? "shown" : info.open ? "open" : "closed";
13847
- return info.busy ? `${shown3} \xB7 busy: ${info.busy}` : shown3;
13846
+ const shown4 = info.active ? "active" : info.visible ? "shown" : info.open ? "open" : "closed";
13847
+ return info.busy ? `${shown4} \xB7 busy: ${info.busy}` : shown4;
13848
13848
  }
13849
13849
  function table(rows) {
13850
13850
  const lines = [["ID", "TITLE", "STATE"], ...rows.map((row) => [row.id, row.title, state(row)])];
13851
13851
  const widths = [0, 1].map((column) => Math.max(...lines.map((line) => line[column].length)));
13852
- return lines.map(([id, title, shown3]) => `${id.padEnd(widths[0])} ${title.padEnd(widths[1])} ${shown3}`).join("\n");
13852
+ return lines.map(([id, title, shown4]) => `${id.padEnd(widths[0])} ${title.padEnd(widths[1])} ${shown4}`).join("\n");
13853
13853
  }
13854
13854
  var done = (result, note = "") => result.code === 0 ? { stdout: `${result.message}${note}
13855
13855
  `, stderr: "", code: 0 } : { stdout: "", stderr: `panel: ${result.message}
@@ -14105,6 +14105,17 @@ function settled(element2) {
14105
14105
  requestAnimationFrame(frame);
14106
14106
  });
14107
14107
  }
14108
+ function shown2() {
14109
+ if (!document.hidden) return Promise.resolve();
14110
+ return new Promise((resolve2) => {
14111
+ const seen = () => {
14112
+ if (document.hidden) return;
14113
+ document.removeEventListener("visibilitychange", seen);
14114
+ resolve2();
14115
+ };
14116
+ document.addEventListener("visibilitychange", seen);
14117
+ });
14118
+ }
14108
14119
  var ended = { write() {
14109
14120
  }, resize() {
14110
14121
  }, close() {
@@ -14132,6 +14143,9 @@ var KeptSession = class {
14132
14143
  }) : this.#start(size4);
14133
14144
  return session.then((live) => this.#handle(live, sink));
14134
14145
  }
14146
+ replay(write) {
14147
+ for (const chunk of this.#log) write(chunk);
14148
+ }
14135
14149
  dispose() {
14136
14150
  this.#sink = null;
14137
14151
  this.#log = [];
@@ -14310,9 +14324,12 @@ var SliccTerminalPanel = class extends ThemedElement {
14310
14324
  const backend = keep(model.terminals, info.id);
14311
14325
  terminal.backend = {
14312
14326
  open: async (sink) => {
14313
- await this.#placed(info.id, terminal);
14327
+ const hidden = await this.#placed(info.id, terminal);
14314
14328
  terminal.fit();
14315
- return backend.open(sink, { cols: terminal.cols, rows: terminal.rows });
14329
+ const cols = terminal.cols;
14330
+ const session = await backend.open(sink, { cols, rows: terminal.rows });
14331
+ if (hidden) void this.#relayout(terminal, backend, cols);
14332
+ return session;
14316
14333
  }
14317
14334
  };
14318
14335
  terminal.addEventListener("exit", () => model.terminals.close(info.id));
@@ -14333,7 +14350,25 @@ var SliccTerminalPanel = class extends ThemedElement {
14333
14350
  #placed(id, screen) {
14334
14351
  const host4 = this.getRootNode().host;
14335
14352
  const panel = host4?.localName === "slicc-dock" ? host4.api.getPanel(terminalPanel(id)) : void 0;
14336
- if (!panel) return Promise.resolve();
14353
+ if (!panel) return Promise.resolve(false);
14354
+ if (!document.hidden) return this.#seen(panel, screen).then(() => false);
14355
+ if (laid(screen.getBoundingClientRect())) return Promise.resolve(true);
14356
+ return new Promise((resolve2) => {
14357
+ const done2 = (hidden) => {
14358
+ watch.dispose();
14359
+ document.removeEventListener("visibilitychange", visible2);
14360
+ resolve2(hidden);
14361
+ };
14362
+ const watch = panel.api.onDidDimensionsChange((size4) => {
14363
+ if (laid(size4)) done2(true);
14364
+ });
14365
+ const visible2 = () => {
14366
+ if (!document.hidden) done2(false);
14367
+ };
14368
+ document.addEventListener("visibilitychange", visible2);
14369
+ }).then((hidden) => hidden || this.#seen(panel, screen).then(() => false));
14370
+ }
14371
+ #seen(panel, screen) {
14337
14372
  const sized = laid(panel.api) ? Promise.resolve() : new Promise((resolve2) => {
14338
14373
  const watch = panel.api.onDidDimensionsChange((size4) => {
14339
14374
  if (!laid(size4)) return;
@@ -14343,6 +14378,14 @@ var SliccTerminalPanel = class extends ThemedElement {
14343
14378
  });
14344
14379
  return sized.then(() => settled(screen));
14345
14380
  }
14381
+ async #relayout(screen, backend, cols) {
14382
+ await shown2();
14383
+ await settled(screen);
14384
+ screen.fit();
14385
+ if (screen.cols === cols) return;
14386
+ screen.redraw("\x1Bc");
14387
+ backend.replay((data) => screen.redraw(data));
14388
+ }
14346
14389
  #request() {
14347
14390
  this.dispatchEvent(new CustomEvent("new-terminal", { bubbles: true, composed: true }));
14348
14391
  }
@@ -22010,8 +22053,8 @@ var SliccUpdates = class extends ModelElement {
22010
22053
  #checked(at) {
22011
22054
  if (at === null) return b`<span>Not checked yet</span>`;
22012
22055
  const date = new Date(at);
22013
- const shown3 = date.toLocaleString("en-GB", { dateStyle: "medium", timeStyle: "short" });
22014
- return b`<span>Checked <time datetime=${date.toISOString()}>${shown3}</time></span>`;
22056
+ const shown4 = date.toLocaleString("en-GB", { dateStyle: "medium", timeStyle: "short" });
22057
+ return b`<span>Checked <time datetime=${date.toISOString()}>${shown4}</time></span>`;
22015
22058
  }
22016
22059
  #item(item2) {
22017
22060
  const [variant, state3] = states[item2.state];
@@ -22076,14 +22119,14 @@ var SliccUpdates = class extends ModelElement {
22076
22119
  #package(item2, all2, act2) {
22077
22120
  const light = packageLight(item2);
22078
22121
  const busy = this.busy.get(item2.id);
22079
- const shown3 = busy ? [busy] : act2 ? item2.actions : [];
22122
+ const shown4 = busy ? [busy] : act2 ? item2.actions : [];
22080
22123
  const error = this.problems.get(item2.id) ?? item2.error;
22081
22124
  return b`<li data-id=${item2.id} data-state=${item2.state}>
22082
22125
  <div class="name">
22083
22126
  <h3 title=${item2.package}>${item2.label}</h3>
22084
22127
  ${light ? b`<swc-status-light size="s" variant=${light[0]}>${light[1]}</swc-status-light>` : A}
22085
22128
  </div>
22086
- <div class="buttons">${shown3.map(
22129
+ <div class="buttons">${shown4.map(
22087
22130
  (action) => b`<swc-button
22088
22131
  size="s"
22089
22132
  variant="secondary"
@@ -22839,11 +22882,11 @@ var SliccApp = class extends ThemedElement {
22839
22882
  #rail(items, side) {
22840
22883
  const primary = side === "bottom" ? items.filter((item2) => phoneRail.includes(item2.id)) : items;
22841
22884
  const fit = primary.length < items.length ? Math.min(primary.length, railCapacity(this.#width, Infinity)) : railCapacity(this.#width, items.length);
22842
- const shown3 = side === "bottom" ? primary.slice(0, fit) : items;
22843
- const grouped = new Set(shown3.map((item2) => item2.cone).filter(Boolean)).size > 1;
22844
- return b`<nav class=${`rail ${side}`} aria-label=${`Panels, ${side}`} @dragover=${this.#railOver} @dragleave=${this.#railLeave} @drop=${this.#railDrop}>${shown3.map(
22845
- (item2, index) => b`${grouped && index && shown3[index - 1].cone !== item2.cone ? b`<span class="cones" aria-hidden="true"></span>` : A}${this.#railButton(item2, side)}`
22846
- )}${this.#more(items.filter((item2) => !shown3.includes(item2)))}</nav>`;
22885
+ const shown4 = side === "bottom" ? primary.slice(0, fit) : items;
22886
+ const grouped = new Set(shown4.map((item2) => item2.cone).filter(Boolean)).size > 1;
22887
+ return b`<nav class=${`rail ${side}`} aria-label=${`Panels, ${side}`} @dragover=${this.#railOver} @dragleave=${this.#railLeave} @drop=${this.#railDrop}>${shown4.map(
22888
+ (item2, index) => b`${grouped && index && shown4[index - 1].cone !== item2.cone ? b`<span class="cones" aria-hidden="true"></span>` : A}${this.#railButton(item2, side)}`
22889
+ )}${this.#more(items.filter((item2) => !shown4.includes(item2)))}</nav>`;
22847
22890
  }
22848
22891
  #rails() {
22849
22892
  const dock = this.renderRoot.querySelector("slicc-dock");
@@ -26688,7 +26731,7 @@ var fieldStyles = i`
26688
26731
  outline-offset: var(--swc-focus-ring-gap);
26689
26732
  }
26690
26733
  `;
26691
- function shown2(element2, style = getComputedStyle(element2)) {
26734
+ function shown3(element2, style = getComputedStyle(element2)) {
26692
26735
  return !element2.hidden && !element2.inert && style.display !== "none";
26693
26736
  }
26694
26737
  function disabled(element2) {
@@ -26718,10 +26761,10 @@ function tabbables(root2, stop, out = []) {
26718
26761
  continue;
26719
26762
  }
26720
26763
  const style = getComputedStyle(child);
26721
- if (!shown2(child, style)) continue;
26764
+ if (!shown3(child, style)) continue;
26722
26765
  if (child.localName === "details" && !child.open) {
26723
26766
  const summary = child.querySelector(":scope > summary");
26724
- if (summary && shown2(summary) && getComputedStyle(summary).visibility !== "hidden" && !(summary.hasAttribute("tabindex") && summary.tabIndex < 0))
26767
+ if (summary && shown3(summary) && getComputedStyle(summary).visibility !== "hidden" && !(summary.hasAttribute("tabindex") && summary.tabIndex < 0))
26725
26768
  out.push(summary);
26726
26769
  continue;
26727
26770
  }
@@ -28106,8 +28149,8 @@ var SliccMemory = class extends ModelElement {
28106
28149
  const scopes = this.#scopes;
28107
28150
  const scope = this.scope;
28108
28151
  const option2 = (item2) => b`<sp-menu-item value=${item2.id}>${item2.label}</sp-menu-item>`;
28109
- const shown3 = visible(all2, scope, this.tag, this.query);
28110
- return b`<div class="bar"><span>${shown3.length} of ${all2.filter((memory) => memory.scope === scope).length} memories</span><span class="spacer"></span>
28152
+ const shown4 = visible(all2, scope, this.tag, this.query);
28153
+ return b`<div class="bar"><span>${shown4.length} of ${all2.filter((memory) => memory.scope === scope).length} memories</span><span class="spacer"></span>
28111
28154
  <swc-action-button size="s" quiet @click=${() => this.editing = "new"}><swc-icon-add slot="icon"></swc-icon-add>Remember</swc-action-button>
28112
28155
  </div>
28113
28156
  <div class="tools">
@@ -28129,7 +28172,7 @@ var SliccMemory = class extends ModelElement {
28129
28172
  </div>
28130
28173
  <div class="list">
28131
28174
  ${this.editing === "new" ? b`<div class="row">${this.#form({ scope })}</div>` : A}
28132
- ${shown3.length ? sections(shown3).map(
28175
+ ${shown4.length ? sections(shown4).map(
28133
28176
  ([section, items]) => b`<h3>${section}</h3>${items.map((memory) => this.#row(memory))}`
28134
28177
  ) : b`<div class="note">${all2.length ? "No memories match." : "No memories yet."}</div>`}
28135
28178
  </div>`;
@@ -29474,8 +29517,8 @@ var SliccSecrets = class extends ThemedElement {
29474
29517
  const before = entries[entries.length - 1]?.seq;
29475
29518
  const page = await vault.audit(before);
29476
29519
  if (this.model?.vault !== vault || !this.isConnected) return;
29477
- const shown3 = merged(vault.list()?.audit ?? [], this.older);
29478
- if (shown3[shown3.length - 1]?.seq !== before) return;
29520
+ const shown4 = merged(vault.list()?.audit ?? [], this.older);
29521
+ if (shown4[shown4.length - 1]?.seq !== before) return;
29479
29522
  this.older = merged(this.older, page.audit);
29480
29523
  this.more = page.more;
29481
29524
  } catch (error) {
@@ -29657,7 +29700,7 @@ var SliccSecrets = class extends ThemedElement {
29657
29700
  </li>`;
29658
29701
  }
29659
29702
  #audit(vault, list5, entries, devices) {
29660
- const shown3 = this.reveals ? entries.filter((entry) => entry.type === "materialize") : entries;
29703
+ const shown4 = this.reveals ? entries.filter((entry) => entry.type === "materialize") : entries;
29661
29704
  const more = this.more ?? list5.auditMore;
29662
29705
  return b`<div class="audit-head">
29663
29706
  <h3 id="secrets-audit">Activity</h3>
@@ -29665,7 +29708,7 @@ var SliccSecrets = class extends ThemedElement {
29665
29708
  this.reveals = event2.target.checked;
29666
29709
  }}>Only reveals to programs</sp-switch>
29667
29710
  </div>
29668
- ${shown3.length ? b`<ol class="audit" aria-labelledby="secrets-audit">${shown3.map((entry) => this.#entry(entry, devices))}</ol>` : b`<p class="muted" data-audit-empty>${this.reveals ? more ? "No reveals in the activity loaded so far." : "No program has been given a secret." : "Nothing has used a secret yet."}</p>`}
29711
+ ${shown4.length ? b`<ol class="audit" aria-labelledby="secrets-audit">${shown4.map((entry) => this.#entry(entry, devices))}</ol>` : b`<p class="muted" data-audit-empty>${this.reveals ? more ? "No reveals in the activity loaded so far." : "No program has been given a secret." : "Nothing has used a secret yet."}</p>`}
29669
29712
  ${more ? b`<div class="row"><swc-button size="s" variant="secondary" fill-style="outline" data-action="older" ?pending=${this.loading} @click=${() => this.showOlder(vault, entries)}>Show older</swc-button></div>` : A}`;
29670
29713
  }
29671
29714
  #feedback() {
@@ -30843,10 +30886,10 @@ var SliccValueRequest = class extends ThemedElement {
30843
30886
  if (!vault || !request2) return A;
30844
30887
  const locked = !!vault.status()?.locked;
30845
30888
  const rest = queue.length - 1;
30846
- const shown3 = this.problem?.id === request2.id ? this.problem : null;
30847
- const problem = shown3?.text ?? "";
30848
- const name = this.#aria("name", shown3);
30849
- const field = this.#aria("value", shown3);
30889
+ const shown4 = this.problem?.id === request2.id ? this.problem : null;
30890
+ const problem = shown4?.text ?? "";
30891
+ const name = this.#aria("name", shown4);
30892
+ const field = this.#aria("value", shown4);
30850
30893
  return i17(
30851
30894
  request2.id,
30852
30895
  b`<dialog role="alertdialog" aria-labelledby="title" aria-describedby="asked" data-request=${request2.id} @cancel=${(event2) => {