dsh-conversation-float 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/client.js +34 -4
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -355,9 +355,11 @@ window.__ModuleLoader__.load({
355
355
  // The float is leaving the screen: the rest of DSH has to come back.
356
356
  if (chromeless) setChromeless(false)
357
357
  // A float that goes home hands the sidebars back as they were — but only
358
- // when the user has not reshaped them meanwhile, and never while the tab
359
- // is merely moving into the right sidebar.
360
- if (!dockingRight && !suspendRestore) restoreChrome()
358
+ // when it really goes home. Moving the live column between hosts (back
359
+ // out of the left drawer, a remounted float body) also detaches it for
360
+ // a frame; restoring there would collapse the sidebars under a float
361
+ // that is still on screen.
362
+ if (!dockingRight && !suspendRestore) scheduleRestoreChrome()
361
363
  dockingRight = false
362
364
  if (column === null) return
363
365
  column.style.width = ''
@@ -425,6 +427,8 @@ window.__ModuleLoader__.load({
425
427
  }
426
428
  noteChromeChange()
427
429
  }
430
+
431
+
428
432
  const schedule = () => {
429
433
  if (frame !== 0) return
430
434
  frame = window.requestAnimationFrame(check)
@@ -649,6 +653,10 @@ window.__ModuleLoader__.load({
649
653
  // left sidebar on its own there, and reading that as the user's choice
650
654
  // would cancel the restore the float promised.
651
655
  if (chromeless || pendingChromeless) return
656
+ // A re-host (out of the drawer, a remounted body) leaves the column out
657
+ // of the document and the right column reading "not expanded" for a
658
+ // frame. That is the plugin moving, never the user choosing.
659
+ if (dockedLeft || (floatPanel() !== null && movedColumn === null)) return
652
660
  const now = performance.now()
653
661
  if (now < holdOffUntil) return
654
662
  const current = chromeNow()
@@ -659,6 +667,25 @@ window.__ModuleLoader__.load({
659
667
  chromeTouched = true
660
668
  }
661
669
 
670
+ /**
671
+ * A detach is not a close until the float is really gone. The drawer row
672
+ * re-hosts the live column and a remounted body re-attaches it, and both
673
+ * detach it for a frame; the chrome is restored only when nothing took the
674
+ * column back and no panel is left to finish tearing down.
675
+ */
676
+ function scheduleRestoreChrome(depth = 0) {
677
+ window.requestAnimationFrame(() => {
678
+ // A host took the column back: the float is still open, not closed.
679
+ if (dockedLeft || movedColumn !== null) return
680
+ // The panel is still on its way out; give it a few frames.
681
+ if (floatPanel() !== null) {
682
+ if (depth < 12) scheduleRestoreChrome(depth + 1)
683
+ return
684
+ }
685
+ restoreChrome()
686
+ })
687
+ }
688
+
662
689
  /**
663
690
  * Put back what the user had, unless they changed it themselves. This runs
664
691
  * while the float's tab is still being torn down, and the dock kit can
@@ -725,7 +752,9 @@ window.__ModuleLoader__.load({
725
752
  dockedLeft = false
726
753
  syncDockRow()
727
754
  unstowFloat()
728
- setChromeless(true)
755
+ // The drawer row lives on a normal window: taking the float back out
756
+ // puts it ON that window, not instead of it. Blanking the window here
757
+ // is what made the drawer and the right column look collapsed.
729
758
  }
730
759
 
731
760
  /** The tab id of our floating occurrence, or null when it is not minted. */
@@ -1373,6 +1402,7 @@ window.__ModuleLoader__.load({
1373
1402
  for (const el of document.querySelectorAll('[data-dsh-conversation-float-core-tab]')) el.removeAttribute('data-dsh-conversation-float-core-tab')
1374
1403
  setChromeless(false)
1375
1404
 
1405
+
1376
1406
  ctx.effect(() =>
1377
1407
  ctx.slots.inject('main', () =>
1378
1408
  ctx.slots.register({ name: 'main', key: DOCK_ROW_ID, locale: NS }, DockPanel),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-conversation-float",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./index.js",