@design.estate/dees-catalog 22.3.1 → 22.4.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.
@@ -49554,6 +49554,7 @@ var harnessRecordStyles = i`
49554
49554
  }
49555
49555
 
49556
49556
  .item {
49557
+ container: harness-record / inline-size;
49557
49558
  display: grid;
49558
49559
  gap: 4px;
49559
49560
  padding: 8px 12px;
@@ -49596,14 +49597,15 @@ var harnessRecordStyles = i`
49596
49597
 
49597
49598
  .changes {
49598
49599
  display: grid;
49599
- grid-template-columns: auto minmax(0, 1fr);
49600
+ grid-template-columns: minmax(0, 1fr) minmax(8rem, 1fr);
49600
49601
  gap: var(--dees-spacing-2xs) var(--dees-spacing-md);
49601
49602
  margin: 0;
49602
49603
  }
49603
49604
 
49604
49605
  .changes dt {
49605
49606
  color: var(--dees-color-text-secondary);
49606
- white-space: nowrap;
49607
+ min-width: 0;
49608
+ overflow-wrap: anywhere;
49607
49609
  }
49608
49610
 
49609
49611
  .changes dd {
@@ -49612,6 +49614,17 @@ var harnessRecordStyles = i`
49612
49614
  overflow-wrap: anywhere;
49613
49615
  }
49614
49616
 
49617
+ /* A record in a narrow assistant still needs readable values, even in a wide window. */
49618
+ @container harness-record (max-width: 320px) {
49619
+ .changes {
49620
+ grid-template-columns: minmax(0, 1fr);
49621
+ }
49622
+
49623
+ .changes dd:not(:last-child) {
49624
+ margin-block-end: var(--dees-spacing-xs);
49625
+ }
49626
+ }
49627
+
49615
49628
  .before {
49616
49629
  color: var(--dees-color-text-secondary);
49617
49630
  text-decoration: line-through;
@@ -65367,8 +65380,8 @@ var _DeesAppui = class _DeesAppui extends (_a86 = DeesElement, _appbarMenuItems_
65367
65380
  __publicField(this, "historyIndex", 0);
65368
65381
  /** Numbers the history entries this shell writes, so an entry it pushes can name the one it was pushed from. */
65369
65382
  __publicField(this, "historyEntries", 0);
65370
- /** The location each history entry this shell wrote shows, by the entry's number: what a return finds before it (`returnsBack`). */
65371
- __publicField(this, "historyEntryLocations", /* @__PURE__ */ new Map());
65383
+ /** Each history entry this shell wrote, by its number: what a return finds before the current one (`stepsBackTo`). */
65384
+ __publicField(this, "historyEntryRecords", /* @__PURE__ */ new Map());
65372
65385
  /** The traversal back a refused browser change started, to `location`; the next change of any address ends it. */
65373
65386
  __publicField(this, "restoringHistory");
65374
65387
  /** A storage operation failed: the host hears it once, and the shell goes on without it. */
@@ -66637,15 +66650,32 @@ var _DeesAppui = class _DeesAppui extends (_a86 = DeesElement, _appbarMenuItems_
66637
66650
  * `options.history` decides whether that leaves a step behind: `push` (the
66638
66651
  * default) adds a history entry, `replace` rewrites the current one, which is
66639
66652
  * what a screen correcting its own route needs, and `return` goes back to the
66640
- * screen a step was taken from, where the entry before the current one shows
66641
- * it, and replaces the current entry elsewhere.
66653
+ * screen a flow was started from, across the steps it took on its own screen,
66654
+ * and replaces the current entry where no entry before shows it. With
66655
+ * `options.origin`, a return ends the flow on another screen, such as the one
66656
+ * it made: it goes back to the origin and pushes the screen after it.
66642
66657
  */
66643
66658
  navigateToView(viewId, params = {}, query2 = {}, options) {
66644
66659
  const mode = options?.history === "replace" || options?.history === "return" ? options.history : "push";
66645
- return this.queueNavigation(viewId, { ...params }, { ...query2 }, mode, mode === "replace" ? "system" : "reader");
66660
+ const origin = mode === "return" && options?.origin ? this.locationOf(options.origin) ?? null : void 0;
66661
+ return this.queueNavigation(
66662
+ viewId,
66663
+ { ...params },
66664
+ { ...query2 },
66665
+ mode,
66666
+ mode === "replace" ? "system" : "reader",
66667
+ void 0,
66668
+ void 0,
66669
+ origin
66670
+ );
66671
+ }
66672
+ /** The location of a screen named by a view and its parameters; none for a route that names no screen. */
66673
+ locationOf(routeArg) {
66674
+ const address = this.addressOf({ viewId: routeArg.viewId, params: { ...routeArg.params }, query: { ...routeArg.query } });
66675
+ return address === void 0 ? void 0 : this.addressing.locationOf(address);
66646
66676
  }
66647
- queueNavigation(viewId, params, query2, mode, intent, index, traversalLocation) {
66648
- return this.enqueue((generation, request) => this.performNavigation(viewId, params, query2, mode, intent, generation, request, index, traversalLocation));
66677
+ queueNavigation(viewId, params, query2, mode, intent, index, traversalLocation, origin) {
66678
+ return this.enqueue((generation, request) => this.performNavigation(viewId, params, query2, mode, intent, generation, request, index, traversalLocation, origin));
66649
66679
  }
66650
66680
  /**
66651
66681
  * Runs a navigation after every one queued before it. Each is numbered as it
@@ -66668,7 +66698,7 @@ var _DeesAppui = class _DeesAppui extends (_a86 = DeesElement, _appbarMenuItems_
66668
66698
  this.navigationQueue = result.catch(() => false);
66669
66699
  return result;
66670
66700
  }
66671
- async performNavigation(viewId, params, query2, mode, intent, generation, request, index, traversalLocation) {
66701
+ async performNavigation(viewId, params, query2, mode, intent, generation, request, index, traversalLocation, origin) {
66672
66702
  const stale = /* @__PURE__ */ __name(() => !this.isConnected || generation !== this.routingGeneration, "stale");
66673
66703
  const superseded = /* @__PURE__ */ __name(() => stale() || request !== this.latestNavigationRequest, "superseded");
66674
66704
  if (stale()) return false;
@@ -66725,11 +66755,16 @@ var _DeesAppui = class _DeesAppui extends (_a86 = DeesElement, _appbarMenuItems_
66725
66755
  void this.takeReaderTo(element);
66726
66756
  void this.announceView(view.name);
66727
66757
  }
66758
+ const stepsBack = mode === "return" && origin !== null ? this.stepsBackTo(origin ?? location) : 0;
66728
66759
  if (mode === "push") {
66729
66760
  this.historyIndex++;
66730
66761
  window.history.pushState(this.routeHistoryState(location, true), "", location);
66731
- } else if (mode === "return" && this.returnsBack(location)) {
66732
- await this.goBackTo(location);
66762
+ } else if (stepsBack > 0) {
66763
+ await this.goBackTo(origin ?? location, stepsBack);
66764
+ if (origin !== void 0 && origin !== location && !stale() && this.addressing.currentLocation() === origin) {
66765
+ this.historyIndex++;
66766
+ window.history.pushState(this.routeHistoryState(location, true), "", location);
66767
+ }
66733
66768
  } else {
66734
66769
  if (index !== void 0) this.historyIndex = index;
66735
66770
  if (mode === "replace" || mode === "return" || this.addressing.currentLocation() === traversalLocation) {
@@ -66740,7 +66775,7 @@ var _DeesAppui = class _DeesAppui extends (_a86 = DeesElement, _appbarMenuItems_
66740
66775
  } catch (error) {
66741
66776
  if (superseded()) return false;
66742
66777
  this.viewLifecycle$.next({ type: "loadError", viewId, error });
66743
- this.failedNavigation = { view, params, query: query2, mode, location };
66778
+ this.failedNavigation = { view, params, query: query2, mode, location, origin };
66744
66779
  this.markViewInMainMenu(viewId);
66745
66780
  return false;
66746
66781
  }
@@ -66782,7 +66817,8 @@ var _DeesAppui = class _DeesAppui extends (_a86 = DeesElement, _appbarMenuItems_
66782
66817
  const failed = this.failedNavigation;
66783
66818
  if (!failed) return;
66784
66819
  const mode = failed.mode === "replace" || this.addressing.currentLocation() === failed.location ? "replace" : failed.mode === "return" ? "return" : "push";
66785
- void this.queueNavigation(failed.view.id, failed.params, failed.query, mode, "reader");
66820
+ const origin = mode === "return" ? failed.origin : void 0;
66821
+ void this.queueNavigation(failed.view.id, failed.params, failed.query, mode, "reader", void 0, void 0, origin);
66786
66822
  }
66787
66823
  /**
66788
66824
  * A guard that returns a string asks a question, and the shell asks it in a
@@ -66809,15 +66845,17 @@ var _DeesAppui = class _DeesAppui extends (_a86 = DeesElement, _appbarMenuItems_
66809
66845
  * The state of a history entry the shell writes, showing a location: where the
66810
66846
  * entry stands (`historyIndex`) and a number of its own. An entry pushed also
66811
66847
  * names the entry it was pushed from, the one right before it; one rewritten
66812
- * keeps its number and the entry before it. The location an entry shows is
66813
- * kept by its number, so a return can tell what the entry before shows
66814
- * (`returnsBack`).
66848
+ * keeps its number and the entry before it. The location an entry shows, the
66849
+ * view on show there and the entry before it are kept by its number, so a
66850
+ * return can tell what the entries before show (`stepsBackTo`).
66815
66851
  */
66816
66852
  routeHistoryState(locationArg, pushedArg = false) {
66817
66853
  const current = this.historyMarker();
66818
66854
  const entry = pushedArg || !current ? ++this.historyEntries : current.entry;
66819
66855
  const previous = pushedArg ? current?.entry : current?.previous;
66820
- if (locationArg !== void 0) this.historyEntryLocations.set(entry, locationArg);
66856
+ if (locationArg !== void 0) {
66857
+ this.historyEntryRecords.set(entry, { location: locationArg, viewId: this.currentRoute?.viewId, previous });
66858
+ }
66821
66859
  const marker = { owner: this.historyOwner, index: this.historyIndex, entry, previous };
66822
66860
  return { ...window.history.state, deesAppui: marker };
66823
66861
  }
@@ -66841,29 +66879,42 @@ var _DeesAppui = class _DeesAppui extends (_a86 = DeesElement, _appbarMenuItems_
66841
66879
  return current.location !== positionArg.location || current.index !== positionArg.index;
66842
66880
  }
66843
66881
  /**
66844
- * Whether a return to a location goes back: the browser stands where this
66845
- * shell is, on an entry it pushed, and the entry that one was pushed from —
66846
- * the one right before it — still shows the location. An entry the shell did
66847
- * not push from one of its own, such as the first one after a reload or a deep
66848
- * link into a flow, has no entry before it the shell knows, so a return from it
66849
- * replaces. So does one whose address shows the location already: going back
66850
- * from it would change no address, and no change would say it landed.
66882
+ * How many entries a return to a location goes back: the browser stands where
66883
+ * this shell is, on an entry it pushed, and walks back along the entries each
66884
+ * one was pushed from — the one right before it — to the nearest that shows
66885
+ * the location. The entries it passes are the steps of a flow on the current
66886
+ * entry's own screen; an entry of another screen in between was a stop of the
66887
+ * reader's own, so the walk ends there and the return replaces, as it does
66888
+ * from an entry the shell did not push from one of its own, such as the first
66889
+ * one after a reload or a deep link into a flow. So does a return from an
66890
+ * entry whose address shows the location already: going back from it would
66891
+ * change no address, and no change would say it landed. None is `0`.
66851
66892
  */
66852
- returnsBack(locationArg) {
66893
+ stepsBackTo(locationArg) {
66853
66894
  const marker = this.historyMarker();
66854
- return marker?.index === this.historyIndex && marker.previous !== void 0 && this.historyEntryLocations.get(marker.previous) === locationArg && this.addressing.currentLocation() !== locationArg;
66895
+ if (marker?.index !== this.historyIndex || this.addressing.currentLocation() === locationArg) return 0;
66896
+ const flowView = this.historyEntryRecords.get(marker.entry)?.viewId;
66897
+ let previous = marker.previous;
66898
+ for (let steps = 1; previous !== void 0; steps++) {
66899
+ const record = this.historyEntryRecords.get(previous);
66900
+ if (!record) return 0;
66901
+ if (record.location === locationArg) return steps;
66902
+ if (record.viewId !== flowView) return 0;
66903
+ previous = record.previous;
66904
+ }
66905
+ return 0;
66855
66906
  }
66856
66907
  /**
66857
- * Goes back one entry, to the location of the screen already on show, and
66858
- * waits until the browser stands there, so no request writes history from
66859
- * the entry it leaves. The change the browser brings finds that location
66860
- * and is not taken as a move of the reader's (`restoringHistory`).
66908
+ * Goes back a number of entries, to the location they show, and waits until
66909
+ * the browser stands there, so no request writes history from the entry it
66910
+ * leaves. The change the browser brings finds that location and is not taken
66911
+ * as a move of the reader's (`restoringHistory`).
66861
66912
  */
66862
- goBackTo(locationArg) {
66863
- this.historyIndex--;
66913
+ goBackTo(locationArg, stepsArg) {
66914
+ this.historyIndex -= stepsArg;
66864
66915
  return new Promise((resolve) => {
66865
66916
  this.restoringHistory = { location: locationArg, resolve };
66866
- window.history.back();
66917
+ window.history.go(-stepsArg);
66867
66918
  });
66868
66919
  }
66869
66920
  /**
@@ -67034,7 +67085,7 @@ var _DeesAppui = class _DeesAppui extends (_a86 = DeesElement, _appbarMenuItems_
67034
67085
  this.failedNavigation = void 0;
67035
67086
  this.historyOwner = `${Date.now()}-${Math.random()}`;
67036
67087
  this.historyIndex = 0;
67037
- this.historyEntryLocations.clear();
67088
+ this.historyEntryRecords.clear();
67038
67089
  }
67039
67090
  /** Follow the address: mark the entry the shell stands on, listen for its changes, show the first screen. */
67040
67091
  startRouting() {
@@ -127751,7 +127802,7 @@ var bright = {
127751
127802
  // ts_web/00_commitinfo_data.ts
127752
127803
  var commitinfo = {
127753
127804
  name: "@design.estate/dees-catalog",
127754
- version: "22.3.1",
127805
+ version: "22.4.1",
127755
127806
  description: "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript."
127756
127807
  };
127757
127808
  export {