@ai-ecoverse/slicc-spectrum 1.57.0 → 1.58.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
@@ -9668,6 +9668,7 @@ var SliccFiles = class extends ModelElement {
9668
9668
  ...ModelElement.properties,
9669
9669
  count: { state: true },
9670
9670
  mounted: { state: true },
9671
+ sources: { state: true },
9671
9672
  mounting: { state: true },
9672
9673
  ejecting: { state: true },
9673
9674
  waiting: { state: true },
@@ -9681,6 +9682,7 @@ var SliccFiles = class extends ModelElement {
9681
9682
  super();
9682
9683
  this.count = 0;
9683
9684
  this.mounted = [];
9685
+ this.sources = /* @__PURE__ */ new Map();
9684
9686
  this.mounting = false;
9685
9687
  this.ejecting = /* @__PURE__ */ new Set();
9686
9688
  this.waiting = [];
@@ -9733,6 +9735,38 @@ var SliccFiles = class extends ModelElement {
9733
9735
  gap: var(--swc-spacing-100);
9734
9736
  min-height: var(--swc-component-height-75);
9735
9737
  }
9738
+ .mounts .source {
9739
+ color: var(--swc-neutral-subdued-content-color-default);
9740
+ }
9741
+ .mounts .path[data-source] {
9742
+ --sep: 2ch;
9743
+ display: flex;
9744
+ flex-wrap: wrap;
9745
+ margin-left: calc(-1 * var(--sep));
9746
+ clip-path: inset(0 0 0 var(--sep));
9747
+ }
9748
+ .mounts .path[data-source] > span {
9749
+ display: flex;
9750
+ min-width: 0;
9751
+ max-width: calc(100% - var(--sep));
9752
+ margin-left: var(--sep);
9753
+ }
9754
+ .mounts .target,
9755
+ .mounts .source .name {
9756
+ min-width: 0;
9757
+ overflow: hidden;
9758
+ text-overflow: ellipsis;
9759
+ white-space: pre;
9760
+ }
9761
+ .mounts .source {
9762
+ position: relative;
9763
+ }
9764
+ .mounts .source .sep {
9765
+ position: absolute;
9766
+ right: 100%;
9767
+ width: var(--sep);
9768
+ text-align: center;
9769
+ }
9736
9770
  .mounts .path {
9737
9771
  flex: 1;
9738
9772
  min-width: 0;
@@ -9780,7 +9814,11 @@ var SliccFiles = class extends ModelElement {
9780
9814
  void this.updateComplete.then(() => this.#sync());
9781
9815
  }
9782
9816
  #mounts(files) {
9783
- this.mounted = files.mounts?.() ?? [];
9817
+ const info = files.mountInfo?.();
9818
+ this.mounted = info ? info.map((item2) => item2.target) : files.mounts?.() ?? [];
9819
+ this.sources = new Map(
9820
+ (info ?? []).flatMap((item2) => item2.source ? [[item2.target, item2.source]] : [])
9821
+ );
9784
9822
  this.waiting = files.needsFolder?.() ?? [];
9785
9823
  }
9786
9824
  #sync() {
@@ -9887,6 +9925,11 @@ var SliccFiles = class extends ModelElement {
9887
9925
  </ul>
9888
9926
  </section>`;
9889
9927
  }
9928
+ #mounted(path) {
9929
+ const source = this.sources.get(path);
9930
+ if (!source) return b`<span class="path" title=${path}>${path}</span>`;
9931
+ return b`<span class="path" title=${`${path} \xB7 ${source}`} data-source=${source}><span class="target">${path}</span><span class="source"><span class="sep">·</span><span class="name">${source}</span></span></span>`;
9932
+ }
9890
9933
  #strip(files) {
9891
9934
  if (this.mounted.length === 0) return A;
9892
9935
  const eject = files?.eject?.bind(files);
@@ -9895,7 +9938,7 @@ var SliccFiles = class extends ModelElement {
9895
9938
  <ul aria-labelledby="mounted">
9896
9939
  ${this.mounted.map(
9897
9940
  (path) => b`<li>
9898
- <span class="path" title=${path}>${path}</span>
9941
+ ${this.#mounted(path)}
9899
9942
  ${eject ? b`<swc-action-button
9900
9943
  size="s"
9901
9944
  quiet
@@ -12080,7 +12123,7 @@ var automation = {
12080
12123
  extension: "Browser automation: through the SLICC extension.",
12081
12124
  proxy: "Browser automation: through slicc-node.",
12082
12125
  link: "Browser automation: through a linked device.",
12083
- none: "Browser automation: not available. Install the extension or run slicc-node."
12126
+ none: "Browser automation: not available. Install the extension, or run slicc-node or npx sliccy@next."
12084
12127
  };
12085
12128
  function automationOf(browser) {
12086
12129
  return browser.via ?? "none";
@@ -12523,7 +12566,43 @@ var SliccNetwork = class extends ModelElement {
12523
12566
  color: var(--swc-neutral-subdued-content-color-default);
12524
12567
  overflow-wrap: anywhere;
12525
12568
  }
12569
+ .folders ul {
12570
+ display: flex;
12571
+ flex-direction: column;
12572
+ gap: var(--swc-spacing-75);
12573
+ margin: var(--swc-spacing-75) 0 0;
12574
+ padding: 0;
12575
+ list-style: none;
12576
+ }
12577
+ .folders li {
12578
+ display: flex;
12579
+ align-items: center;
12580
+ gap: var(--swc-spacing-100);
12581
+ min-width: 0;
12582
+ }
12583
+ .folders swc-icon-folder {
12584
+ flex: none;
12585
+ color: var(--swc-neutral-subdued-content-color-default);
12586
+ }
12587
+ .folder {
12588
+ flex: 1;
12589
+ display: flex;
12590
+ flex-wrap: wrap;
12591
+ align-items: center;
12592
+ gap: var(--swc-spacing-50) var(--swc-spacing-100);
12593
+ min-width: 0;
12594
+ overflow-wrap: anywhere;
12595
+ }
12596
+ .folder > code {
12597
+ flex: none;
12598
+ max-width: 100%;
12599
+ }
12600
+ .folder .muted {
12601
+ flex-basis: 100%;
12602
+ font-size: var(--swc-font-size-75);
12603
+ }
12526
12604
  .where code,
12605
+ .folder code,
12527
12606
  [data-browsers] code {
12528
12607
  font-family: var(--swc-code-font-family-stack);
12529
12608
  }
@@ -12908,10 +12987,35 @@ var SliccNetwork = class extends ModelElement {
12908
12987
  <span class="where">${device.host ? b`<code>${device.host}</code>` : A}<span>${device.address ? b`<code>${device.address}</code> · ` : A}${device.mode === "local" ? "This computer" : "Remote"}${device.kind === "seven" ? " \xB7 Follower" : ""}</span></span>
12909
12988
  ${device.policy ? b`<span class="muted" data-policy>Reaches ${device.policy}.</span>` : A}
12910
12989
  ${device.browsers?.length ? b`<span class="muted" data-browsers>${device.browsers.length === 1 ? "Browser" : "Browsers"}: ${device.browsers.map((item2, index) => b`${index ? ", " : ""}${item2.name} (<code>${item2.runtime}</code>)`)}</span>` : A}
12990
+ ${device.folders?.length ? this.#folders(port, device, device.folders) : A}
12911
12991
  ${device.asking ? this.#ask(port, device) : this.#access(port, device)}
12912
12992
  ${device.offers.includes("ssh") ? b`<div class="command" data-copy="ssh"><code>ssh ${device.host}</code>${this.#copyButton(`ssh:${device.id}`, "ssh", "ssh command", `ssh ${device.host}`, "linksError")}</div>` : A}
12913
12993
  </li>`;
12914
12994
  }
12995
+ #folders(port, device, folders) {
12996
+ const heading = `folders-${device.id}`;
12997
+ return b`<div class="folders" data-folders>
12998
+ <span class="muted" id=${heading}>Folders</span>
12999
+ <ul aria-labelledby=${heading}>${folders.map((folder2) => this.#folder(port, device, folder2))}</ul>
13000
+ </div>`;
13001
+ }
13002
+ #folder(port, device, folder2) {
13003
+ const action = `folder:${folder2.source}`;
13004
+ const busy = this.busy === action;
13005
+ const button = folder2.mounted ? port.ejectFolder ? b`<swc-button size="s" variant="secondary" fill-style="outline" data-action="eject-folder" data-id=${folder2.source} accessible-label=${`Eject ${folder2.mounted}`} ?pending=${busy} ?disabled=${this.#waiting(action)} @click=${() => this.#act(action, () => port.ejectFolder?.(folder2.source), "linksError")}>Eject</swc-button>` : A : port.mountFolder ? b`<swc-button size="s" variant="secondary" fill-style="outline" data-action="mount-folder" data-id=${folder2.source} accessible-label=${`Mount ${folder2.source}`} ?pending=${busy} ?disabled=${this.#waiting(action) || device.state !== "connected"} @click=${() => this.#act(action, () => this.#mountFolder(port, folder2.source), "linksError")}>Mount</swc-button>` : A;
13006
+ return b`<li data-folder=${folder2.source} data-mounted=${folder2.mounted ? "yes" : "no"}>
13007
+ <swc-icon-folder size="s" aria-hidden="true"></swc-icon-folder>
13008
+ <span class="folder">
13009
+ <code title=${folder2.source}>${folder2.name}</code>
13010
+ ${folder2.readonly ? b`<swc-badge size="s" variant="neutral" subtle data-readonly>Read-only</swc-badge>` : A}
13011
+ ${folder2.mounted ? b`<span class="muted" data-mounted-at>Mounted at <code>${folder2.mounted}</code></span>` : A}
13012
+ </span>
13013
+ ${button}
13014
+ </li>`;
13015
+ }
13016
+ async #mountFolder(port, source) {
13017
+ await port.mountFolder?.(source);
13018
+ }
12915
13019
  #join(port, links) {
12916
13020
  const ready = links.joinCommand || links.joinUrl;
12917
13021
  const follow = links.followUrl;