flexdesk 0.4.4 → 0.4.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/dist/wm.js CHANGED
@@ -912,6 +912,7 @@ var TileTree = class _TileTree {
912
912
  split(leafId, dir) {
913
913
  const leaf = this.get(leafId);
914
914
  if (!leaf || leaf.kind !== "leaf") return null;
915
+ if (_isPanel(leaf)) return null;
915
916
  const newLeaf = makeLeaf();
916
917
  if (!leaf.parentId) {
917
918
  const wrap2 = makeSplit({ dir, children: [leaf.id, newLeaf.id] });
@@ -4539,7 +4540,7 @@ var WindowManager = class _WindowManager {
4539
4540
  // ── Split / close / focus / move ────────────────────────────────
4540
4541
  split(dir) {
4541
4542
  const tree = this._tree();
4542
- const focused = tree.focusedLeafId;
4543
+ const focused = this._contentLeafId(tree.focusedLeafId);
4543
4544
  if (!focused) return;
4544
4545
  const newId = tree.split(focused, dir);
4545
4546
  if (newId) this._seedHome(tree, newId);
@@ -4566,6 +4567,7 @@ var WindowManager = class _WindowManager {
4566
4567
  * leaf id, or null if the leaf can't be split. */
4567
4568
  splitLeafWith(leafId, dir, kind, props = {}, title = "") {
4568
4569
  const tree = this._tree();
4570
+ leafId = this._contentLeafId(leafId);
4569
4571
  const src = leafId ? tree.get(leafId) : null;
4570
4572
  if (!src || src.kind !== "leaf") return null;
4571
4573
  const newId = tree.split(leafId, dir);
@@ -4577,6 +4579,15 @@ var WindowManager = class _WindowManager {
4577
4579
  this._notifyChange("split-with");
4578
4580
  return newId;
4579
4581
  }
4582
+ /** A leaf that can hold content: `leafId` itself, or the primary tile when
4583
+ * `leafId` is a panel, a window placeholder or gone. */
4584
+ _contentLeafId(leafId) {
4585
+ const tree = this._tree();
4586
+ const leaf = leafId ? tree.get(leafId) : null;
4587
+ const kind = String(leaf?.content?.kind || "");
4588
+ if (leaf && leaf.kind === "leaf" && !kind.startsWith("panel:") && kind !== PLACEHOLDER_KIND) return leafId;
4589
+ return tree.primaryLeafId();
4590
+ }
4580
4591
  /** Resolve the focused tile's active content for the keyboard-driven
4581
4592
  * "open focused tile elsewhere" chords (Alt+T / Alt+N / Alt+Shift+H /
4582
4593
  * Alt+Shift+V). Returns null for panels, window placeholders and