@lukstei/dsh-client-split-view 0.2.2-rc.5.4 → 0.2.2-rc.5.5

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/README.md CHANGED
@@ -60,7 +60,7 @@ Used by: [`dsh-client-kanban`](../dsh-client-kanban/README.md) (optional), [`dsh
60
60
  | Member | Purpose |
61
61
  |---|---|
62
62
  | `getSnapshot`, `subscribe` | Observe `SplitState` (`sessionIds`, `focusedSessionId`, `maximizedSessionId`, `hoveredSessionId`, `suspended`, `overlays`) |
63
- | `openSession`, `toggleSession`, `removeSession`, `resetToSingle` | Pane membership |
63
+ | `openSession`, `toggleSession`, `removeSession`, `replaceSession`, `resetToSingle` | Pane membership |
64
64
  | `setFocus`, `toggleMaximize`, `setHoveredSession`, `reorderSession` | Pane state |
65
65
  | `suspend`, `resume`, `isSuspended`, `isSplitActive` | Switch between split and native view |
66
66
  | `openSlotOverlay(hostId, slotName, title, props)`, `closeOverlay(hostId)` | Factory overlays |
package/dist/client.js CHANGED
@@ -653,6 +653,45 @@ window.__ModuleLoader__.load({
653
653
  this.emit();
654
654
  };
655
655
  /**
656
+ * Replace a single session in split view with another session in-place.
657
+ */
658
+ replaceSession = (oldId, newId) => {
659
+ if (this.sessionsProvider === void 0) throw new Error("SplitStore: ISessions provider not configured");
660
+ if (isMobileViewport()) {
661
+ this.openSession(newId);
662
+ return;
663
+ }
664
+ if (oldId === newId) {
665
+ if (this.sessionIds.includes(newId)) this.setFocus(newId);
666
+ return;
667
+ }
668
+ const index = this.sessionIds.indexOf(oldId);
669
+ if (index === -1) {
670
+ if (this.sessionIds.includes(newId)) this.setFocus(newId);
671
+ else this.toggleSession(newId);
672
+ return;
673
+ }
674
+ const effectiveSessions = this.sessionsProvider();
675
+ this.retain(newId, effectiveSessions);
676
+ this.release(oldId);
677
+ this.releaseOverlay(oldId);
678
+ const next = [...this.sessionIds];
679
+ const existingNewIndex = next.indexOf(newId);
680
+ if (existingNewIndex !== -1) {
681
+ next.splice(existingNewIndex, 1);
682
+ const targetIndex = next.indexOf(oldId);
683
+ next[targetIndex] = newId;
684
+ } else next[index] = newId;
685
+ this.sessionIds = next;
686
+ if (this.hoveredSessionId === oldId) this.hoveredSessionId = void 0;
687
+ if (this.maximizedSessionId === oldId) this.maximizedSessionId = newId;
688
+ if (this.sessionIds.length <= 1) this.maximizedSessionId = void 0;
689
+ this.focusedSessionId = newId;
690
+ this.suspended = false;
691
+ this.emit();
692
+ if (this.navCallbacks !== void 0) this.navCallbacks.selectPanel("split-view");
693
+ };
694
+ /**
656
695
  * Show one pane's session in the native Conversation view while keeping the split.
657
696
  */
658
697
  suspend = (targetId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukstei/dsh-client-split-view",
3
- "version": "0.2.2-rc.5.4",
3
+ "version": "0.2.2-rc.5.5",
4
4
  "description": "Concurrent multi-session split view and overlay layout plugin for DeepSeek Harness",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -93,7 +93,7 @@
93
93
  "react": "*"
94
94
  },
95
95
  "dependencies": {
96
- "@lukstei/util-review-ui": "0.2.2-rc.5.4"
96
+ "@lukstei/util-review-ui": "0.2.2-rc.5.5"
97
97
  },
98
98
  "license": "MIT",
99
99
  "repository": {
@@ -67,6 +67,7 @@ export interface ISplitView {
67
67
  readonly toggleSession: (targetId: SessionId) => void;
68
68
  readonly openSession: (targetId: SessionId) => void;
69
69
  readonly removeSession: (targetId: SessionId) => void;
70
+ readonly replaceSession: (oldId: SessionId, newId: SessionId) => void;
70
71
  readonly resetToSingle: () => void;
71
72
  readonly suspend: (targetId: SessionId) => void;
72
73
  readonly resume: () => void;
@@ -438,6 +438,67 @@ export class SplitStore implements ISplitView {
438
438
  this.emit();
439
439
  };
440
440
 
441
+ /**
442
+ * Replace a single session in split view with another session in-place.
443
+ */
444
+ replaceSession = (oldId: SessionId, newId: SessionId): void => {
445
+ if (this.sessionsProvider === undefined) {
446
+ throw new Error("SplitStore: ISessions provider not configured");
447
+ }
448
+ if (isMobileViewport()) {
449
+ this.openSession(newId);
450
+ return;
451
+ }
452
+ if (oldId === newId) {
453
+ if (this.sessionIds.includes(newId)) {
454
+ this.setFocus(newId);
455
+ }
456
+ return;
457
+ }
458
+ const index = this.sessionIds.indexOf(oldId);
459
+ if (index === -1) {
460
+ if (this.sessionIds.includes(newId)) {
461
+ this.setFocus(newId);
462
+ } else {
463
+ this.toggleSession(newId);
464
+ }
465
+ return;
466
+ }
467
+
468
+ const effectiveSessions = this.sessionsProvider();
469
+ this.retain(newId, effectiveSessions);
470
+ this.release(oldId);
471
+ this.releaseOverlay(oldId);
472
+
473
+ const next = [...this.sessionIds];
474
+ const existingNewIndex = next.indexOf(newId);
475
+ if (existingNewIndex !== -1) {
476
+ next.splice(existingNewIndex, 1);
477
+ const targetIndex = next.indexOf(oldId);
478
+ next[targetIndex] = newId;
479
+ } else {
480
+ next[index] = newId;
481
+ }
482
+ this.sessionIds = next;
483
+
484
+ if (this.hoveredSessionId === oldId) {
485
+ this.hoveredSessionId = undefined;
486
+ }
487
+ if (this.maximizedSessionId === oldId) {
488
+ this.maximizedSessionId = newId;
489
+ }
490
+ if (this.sessionIds.length <= 1) {
491
+ this.maximizedSessionId = undefined;
492
+ }
493
+ this.focusedSessionId = newId;
494
+ this.suspended = false;
495
+
496
+ this.emit();
497
+ if (this.navCallbacks !== undefined) {
498
+ this.navCallbacks.selectPanel("split-view");
499
+ }
500
+ };
501
+
441
502
  /**
442
503
  * Show one pane's session in the native Conversation view while keeping the split.
443
504
  */