@design.estate/dees-catalog 6.8.0 → 6.8.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.
@@ -179350,6 +179350,10 @@ var _DeesHarnessMessageList = class _DeesHarnessMessageList extends (_a86 = Dees
179350
179350
  __publicField(this, "lastVirtualViewportWidth", 0);
179351
179351
  __publicField(this, "pendingVirtualAnchor");
179352
179352
  __publicField(this, "pendingFullAnchor");
179353
+ __publicField(this, "activeFullAnchor");
179354
+ __publicField(this, "fullAnchorRestoreGeneration", 0);
179355
+ __publicField(this, "fullAnchorRestoreFrame", null);
179356
+ __publicField(this, "fullAnchorRestoreSecondFrame", null);
179353
179357
  __publicField(this, "measurementAnchor");
179354
179358
  __publicField(this, "pendingVirtualRepin", false);
179355
179359
  __publicField(this, "virtualizationEnabled", false);
@@ -179383,9 +179387,18 @@ var _DeesHarnessMessageList = class _DeesHarnessMessageList extends (_a86 = Dees
179383
179387
  if (event.composedPath().some(
179384
179388
  (candidate) => candidate instanceof _DeesHarnessMessageList && candidate !== this
179385
179389
  )) return;
179386
- if (event.type === "wheel" && event.deltaY >= 0) return;
179387
- if (event.type === "keydown" && !["ArrowUp", "PageUp", "Home"].includes(event.key)) return;
179390
+ if (event.type === "wheel") {
179391
+ this.cancelFullAnchorRestore();
179392
+ if (event.deltaY >= 0) return;
179393
+ }
179394
+ if (event.type === "keydown" && !["ArrowUp", "PageUp", "Home"].includes(event.key)) {
179395
+ if (["ArrowDown", "PageDown", "End", " "].includes(event.key)) {
179396
+ this.cancelFullAnchorRestore();
179397
+ }
179398
+ return;
179399
+ }
179388
179400
  if (event.type === "pointerdown" && event.target !== this.scrollContainer) return;
179401
+ this.cancelFullAnchorRestore();
179389
179402
  this.userUnpinned = true;
179390
179403
  this.measurementAnchor = void 0;
179391
179404
  }, "handleUserScrollIntent"));
@@ -179555,16 +179568,15 @@ var _DeesHarnessMessageList = class _DeesHarnessMessageList extends (_a86 = Dees
179555
179568
  rebuildTimeline() {
179556
179569
  const container = this.scrollContainer;
179557
179570
  const preserveAnchor = this.userUnpinned || !this.autoFollow;
179558
- const anchor = container && preserveAnchor ? this.captureCurrentAnchor(container) : void 0;
179571
+ const anchor = container && preserveAnchor ? this.activeFullAnchor ?? this.captureCurrentAnchor(container) : void 0;
179572
+ const anchorContentBoundaryKey = anchor ? this.lastContentKeyForTimelineItem(anchor.key) : void 0;
179573
+ this.cancelFullAnchorRestore();
179559
179574
  const nextItems = this.buildTimelineRenderItems();
179560
179575
  const retainedKeys = new Set(nextItems.map((item) => item.key));
179561
- const contentKeys = [
179562
- ...this.messages.map((message2) => `message:${message2.id}`),
179563
- ...this.permissions.map((request) => `permission:${request.id}`),
179564
- ...this.questions.map((request) => `question:${request.id}`)
179565
- ];
179576
+ const contentKeys = nextItems.flatMap((item) => this.contentKeysForTimelineItem(item));
179577
+ const anchorContentBoundaryIndex = anchorContentBoundaryKey ? contentKeys.indexOf(anchorContentBoundaryKey) : -1;
179566
179578
  this.currentNewContentKeys = new Set(
179567
- contentKeys.filter((key2) => !this.knownContentKeys.has(key2))
179579
+ contentKeys.filter((key2, index3) => !this.knownContentKeys.has(key2) && (anchorContentBoundaryIndex < 0 || index3 > anchorContentBoundaryIndex))
179568
179580
  );
179569
179581
  this.knownContentKeys.clear();
179570
179582
  for (const key2 of contentKeys) this.knownContentKeys.add(key2);
@@ -179641,6 +179653,14 @@ var _DeesHarnessMessageList = class _DeesHarnessMessageList extends (_a86 = Dees
179641
179653
  this.setInitialVirtualRange();
179642
179654
  }
179643
179655
  }
179656
+ contentKeysForTimelineItem(itemArg) {
179657
+ return itemArg.kind === "tool-group" ? itemArg.messages.map((item) => item.key) : [itemArg.key];
179658
+ }
179659
+ lastContentKeyForTimelineItem(keyArg) {
179660
+ const item = this.timelineRenderItems.find((candidate) => candidate.key === keyArg);
179661
+ if (!item) return void 0;
179662
+ return item.kind === "tool-group" ? item.messages.at(-1)?.key : item.key;
179663
+ }
179644
179664
  pruneViewState(stateArg, messageIdsArg, permissionIdsArg, questionIdsArg) {
179645
179665
  const messageIds = new Set(messageIdsArg);
179646
179666
  const permissionIds = new Set(permissionIdsArg);
@@ -179998,6 +180018,7 @@ var _DeesHarnessMessageList = class _DeesHarnessMessageList extends (_a86 = Dees
179998
180018
  const container = this.scrollContainer;
179999
180019
  if (!container) return;
180000
180020
  if (force) {
180021
+ this.cancelFullAnchorRestore();
180001
180022
  this.userUnpinned = false;
180002
180023
  this.measurementAnchor = void 0;
180003
180024
  }
@@ -180072,7 +180093,7 @@ var _DeesHarnessMessageList = class _DeesHarnessMessageList extends (_a86 = Dees
180072
180093
  } else {
180073
180094
  this.disconnectVirtualObservers();
180074
180095
  if (this.pendingFullAnchor) {
180075
- this.restoreFullAnchor(this.scrollContainer, this.pendingFullAnchor);
180096
+ this.scheduleFullAnchorRestore(this.scrollContainer, this.pendingFullAnchor);
180076
180097
  this.pendingFullAnchor = void 0;
180077
180098
  }
180078
180099
  }
@@ -180220,6 +180241,37 @@ var _DeesHarnessMessageList = class _DeesHarnessMessageList extends (_a86 = Dees
180220
180241
  if (!element4) return;
180221
180242
  containerArg.scrollTop += element4.getBoundingClientRect().top - containerArg.getBoundingClientRect().top + anchorArg.offset;
180222
180243
  }
180244
+ scheduleFullAnchorRestore(containerArg, anchorArg) {
180245
+ this.cancelFullAnchorRestore();
180246
+ const generation = this.fullAnchorRestoreGeneration;
180247
+ this.activeFullAnchor = anchorArg;
180248
+ const restore = /* @__PURE__ */ __name(() => {
180249
+ if (generation !== this.fullAnchorRestoreGeneration || !this.isConnected || this.scrollContainer !== containerArg) return false;
180250
+ this.restoreFullAnchor(containerArg, anchorArg);
180251
+ return true;
180252
+ }, "restore");
180253
+ restore();
180254
+ queueMicrotask(() => {
180255
+ if (!restore()) return;
180256
+ this.fullAnchorRestoreFrame = requestAnimationFrame(() => {
180257
+ this.fullAnchorRestoreFrame = null;
180258
+ if (!restore()) return;
180259
+ this.fullAnchorRestoreSecondFrame = requestAnimationFrame(() => {
180260
+ this.fullAnchorRestoreSecondFrame = null;
180261
+ if (!restore()) return;
180262
+ this.activeFullAnchor = void 0;
180263
+ });
180264
+ });
180265
+ });
180266
+ }
180267
+ cancelFullAnchorRestore() {
180268
+ this.fullAnchorRestoreGeneration += 1;
180269
+ if (this.fullAnchorRestoreFrame !== null) cancelAnimationFrame(this.fullAnchorRestoreFrame);
180270
+ if (this.fullAnchorRestoreSecondFrame !== null) cancelAnimationFrame(this.fullAnchorRestoreSecondFrame);
180271
+ this.fullAnchorRestoreFrame = null;
180272
+ this.fullAnchorRestoreSecondFrame = null;
180273
+ this.activeFullAnchor = void 0;
180274
+ }
180223
180275
  virtualLocalScrollTop(containerArg) {
180224
180276
  const stack = this.shadowRoot?.querySelector(".virtualStack");
180225
180277
  return Math.max(0, containerArg.scrollTop - (stack?.offsetTop ?? 0));
@@ -180425,6 +180477,7 @@ var _DeesHarnessMessageList = class _DeesHarnessMessageList extends (_a86 = Dees
180425
180477
  }
180426
180478
  async disconnectedCallback() {
180427
180479
  this.disconnectSelectionChangeListener();
180480
+ this.cancelFullAnchorRestore();
180428
180481
  if (this.followFrame !== null) cancelAnimationFrame(this.followFrame);
180429
180482
  if (this.followSecondFrame !== null) cancelAnimationFrame(this.followSecondFrame);
180430
180483
  if (this.entryFrame !== null) cancelAnimationFrame(this.entryFrame);
@@ -183550,9 +183603,12 @@ var _DeesHarnessSessionList = class _DeesHarnessSessionList extends (_a91 = Dees
183550
183603
  if (this.resourceContextResourceId && !this.resourcesById.has(this.resourceContextResourceId)) this.closeResourceContext(this.resourceContextGeneration);
183551
183604
  this.reconcilePendingResourceAssociation();
183552
183605
  }
183553
- if (changedProperties.has("eligibleSessionIdsByResourceId")) {
183606
+ if (changedProperties.has("sessions") || changedProperties.has("eligibleSessionIdsByResourceId")) {
183554
183607
  const gesture = this.pointerDragGesture;
183555
- if (gesture?.type === "resource") this.finishPointerDrag(false);
183608
+ if (gesture?.type === "resource" && !this.sameSessionIds(
183609
+ gesture.eligibleSessionIds,
183610
+ new Set(this.eligibleSessionIds(gesture.resourceId))
183611
+ )) this.finishPointerDrag(false);
183556
183612
  }
183557
183613
  }
183558
183614
  async connectedCallback() {
@@ -184065,6 +184121,7 @@ var _DeesHarnessSessionList = class _DeesHarnessSessionList extends (_a91 = Dees
184065
184121
  source,
184066
184122
  resourceId: resourceArg.id,
184067
184123
  fromSessionId: fromSessionIdArg,
184124
+ eligibleSessionIds: new Set(this.eligibleSessionIds(resourceArg.id)),
184068
184125
  startClientX: eventArg.clientX,
184069
184126
  startClientY: eventArg.clientY,
184070
184127
  grabOffsetX: eventArg.clientX - sourceRect.left,
@@ -184352,6 +184409,9 @@ var _DeesHarnessSessionList = class _DeesHarnessSessionList extends (_a91 = Dees
184352
184409
  }
184353
184410
  return result;
184354
184411
  }
184412
+ sameSessionIds(firstArg, secondArg) {
184413
+ return firstArg.size === secondArg.size && [...firstArg].every((sessionId) => secondArg.has(sessionId));
184414
+ }
184355
184415
  isResourceTargetEligible(resourceIdArg, sessionIdArg) {
184356
184416
  return this.eligibleSessionIds(resourceIdArg).includes(sessionIdArg);
184357
184417
  }
@@ -207453,7 +207513,7 @@ init_group_runtime();
207453
207513
  // ts_web/00_commitinfo_data.ts
207454
207514
  var commitinfo = {
207455
207515
  name: "@design.estate/dees-catalog",
207456
- version: "6.8.0",
207516
+ version: "6.8.2",
207457
207517
  description: "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript."
207458
207518
  };
207459
207519
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '6.8.0',
6
+ version: '6.8.2',
7
7
  description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfd2ViLzAwX2NvbW1pdGluZm9fZGF0YS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUNILE1BQU0sQ0FBQyxNQUFNLFVBQVUsR0FBRztJQUN4QixJQUFJLEVBQUUsNkJBQTZCO0lBQ25DLE9BQU8sRUFBRSxPQUFPO0lBQ2hCLFdBQVcsRUFBRSxzSkFBc0o7Q0FDcEssQ0FBQSJ9
@@ -69,6 +69,10 @@ export declare class DeesHarnessMessageList extends DeesElement {
69
69
  private lastVirtualViewportWidth;
70
70
  private pendingVirtualAnchor;
71
71
  private pendingFullAnchor;
72
+ private activeFullAnchor;
73
+ private fullAnchorRestoreGeneration;
74
+ private fullAnchorRestoreFrame;
75
+ private fullAnchorRestoreSecondFrame;
72
76
  private measurementAnchor;
73
77
  private pendingVirtualRepin;
74
78
  private virtualizationEnabled;
@@ -83,6 +87,8 @@ export declare class DeesHarnessMessageList extends DeesElement {
83
87
  willUpdate(changedProperties: Map<PropertyKey, unknown>): void;
84
88
  private appendToolRun;
85
89
  private rebuildTimeline;
90
+ private contentKeysForTimelineItem;
91
+ private lastContentKeyForTimelineItem;
86
92
  private pruneViewState;
87
93
  private clearTranscriptViewState;
88
94
  private syncSubtaskViewState;
@@ -147,6 +153,8 @@ export declare class DeesHarnessMessageList extends DeesElement {
147
153
  private captureVirtualOffsetAnchorAt;
148
154
  private restoreVirtualAnchor;
149
155
  private restoreFullAnchor;
156
+ private scheduleFullAnchorRestore;
157
+ private cancelFullAnchorRestore;
150
158
  private virtualLocalScrollTop;
151
159
  private virtualIndexAtOffset;
152
160
  private scheduleVirtualRangeUpdate;