flexdesk 0.4.6 → 0.5.0

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
@@ -2,10 +2,11 @@ import {
2
2
  HelpModal,
3
3
  openForm,
4
4
  showContextMenu
5
- } from "./chunk-ELXVW542.js";
5
+ } from "./chunk-24MS7W5Y.js";
6
6
  import {
7
- ManagedWindow
8
- } from "./chunk-LH5TSOZW.js";
7
+ ManagedWindow,
8
+ isRowActivation
9
+ } from "./chunk-6JSOVNID.js";
9
10
  import "./chunk-FL5KFNQH.js";
10
11
  import {
11
12
  NotebookTabBar
@@ -1708,7 +1709,7 @@ function attachLandingTableBehavior(host, getRow, entityActions, options = {}) {
1708
1709
  dispatch(actionBtn.dataset.twmAction, tr2 ? getRow(tr2.__rowIndex) : null);
1709
1710
  return;
1710
1711
  }
1711
- if (ev.target.closest("button, a, input, select, textarea")) return;
1712
+ if (!isRowActivation(ev, "click", { scope: host })) return;
1712
1713
  const tr = bodyRowFor(ev);
1713
1714
  if (tr) dispatch("open", getRow(tr.__rowIndex));
1714
1715
  };
@@ -2450,6 +2451,9 @@ function _segments(kind, props, taxonomy, rootCrumb, rootLabel, navigate, trail)
2450
2451
  }
2451
2452
  return segs;
2452
2453
  }
2454
+ function renderBreadcrumb(container, segments) {
2455
+ _renderInto(container, segments);
2456
+ }
2453
2457
  function _renderInto(container, segments) {
2454
2458
  container.innerHTML = "";
2455
2459
  if (!segments?.length) return;
@@ -3041,6 +3045,16 @@ var TileRenderer = class {
3041
3045
  const leaf = this.tree?.get?.(leafId);
3042
3046
  return leaf && leaf.kind === "leaf" ? this._leafKindKey(leaf) : null;
3043
3047
  }
3048
+ /**
3049
+ * C37. WHAT A LEAF'S CONTENT FACTORY RETURNED for the tab on screen, or
3050
+ * `null` — so the window manager can ask the content a question about
3051
+ * itself (`wm.navigateBack`: *"have you a level of your own to go up?"*)
3052
+ * without reaching into the cache. Read-only; a leaf that has not been
3053
+ * rendered yet has none.
3054
+ */
3055
+ contentOf(leafId) {
3056
+ return this._leafCache.get(leafId)?.content ?? null;
3057
+ }
3044
3058
  /**
3045
3059
  * C34. ACCEPT A PROPS WRITE THE CONTENT MADE ABOUT ITSELF, WITHOUT
3046
3060
  * REBUILDING THE TILE THAT MADE IT.
@@ -4159,10 +4173,21 @@ var WindowManager = class _WindowManager {
4159
4173
  * Adding a new "Open from X" click that should be a back-able
4160
4174
  * navigation just needs to use one of the in-tile routing
4161
4175
  * methods (openFromContext / openInLeaf / navigateActiveTab) —
4162
- * they all record history by default. */
4176
+ * they all record history by default.
4177
+ *
4178
+ * (0) C37. BEFORE ALL OF THAT, THE CONTENT'S OWN LEVELS. A page can have
4179
+ * levels that are not tabs — a settings page whose section opened one
4180
+ * member in place of its list, an organization page showing one of its
4181
+ * projects — and Backspace must climb those before it walks the tile. The
4182
+ * content factory says so by returning `navigateBack()` from its mount: it
4183
+ * is asked first, in the scope Backspace acts on (`_backScope`, so a
4184
+ * floating window's content and the focused tile's alike), and `true`
4185
+ * means it climbed. `false`, or no such function, and the walk below runs
4186
+ * exactly as it always has. */
4163
4187
  navigateBack() {
4164
4188
  const scope = this._backScope();
4165
4189
  if (!scope) return;
4190
+ if (this._contentNavigateBack(scope)) return;
4166
4191
  if (scope.leafId && this._popTabHistory(scope.leafId)) return;
4167
4192
  if (this._returnToOpenList(scope)) return;
4168
4193
  const active = this._scopeActiveTab(scope);
@@ -4199,21 +4224,36 @@ var WindowManager = class _WindowManager {
4199
4224
  this._navigateInScope(scope, kind, props);
4200
4225
  }
4201
4226
  /** True when `navigateBack` would do something user-visible — i.e.
4202
- * the active tab has per-tab history, OR the current kind has a
4203
- * taxonomy parent. Used by the breadcrumb to grey out / hide the
4204
- * Back button when there's nowhere to go. */
4227
+ * the content has a level of its own above the one it shows (C37), the
4228
+ * active tab has per-tab history, OR the current kind has a taxonomy
4229
+ * parent. Used by the breadcrumb to grey out / hide the Back button when
4230
+ * there's nowhere to go.
4231
+ *
4232
+ * IT ANSWERS FOR THE SCOPE BACKSPACE ACTS ON — `_backScope`'s: a floating
4233
+ * window last pressed in, else the focused content tile, else the primary
4234
+ * one. It used to pick the tile alone, so after a press inside a window it
4235
+ * reported on the tile BEHIND it while Backspace climbed the window, and
4236
+ * C37's question went to the wrong content. For a tile the answer is
4237
+ * exactly what it always was; only a window scope answers differently. */
4205
4238
  canNavigateBack() {
4206
- const tree = this._tree();
4207
- const focusedId = tree.focusedLeafId;
4208
- const primaryId = tree.primaryLeafId();
4209
- const focusedLeaf = focusedId ? tree.get(focusedId) : null;
4210
- const focusedKind = focusedLeaf?.content?.kind || "";
4211
- const id = focusedId && focusedKind && !focusedKind.startsWith("panel:") && focusedKind !== "window-placeholder" ? focusedId : primaryId;
4212
- if (!id) return false;
4213
- const history = tree.activeTabHistory?.(id) || [];
4214
- if (history.length > 0) return true;
4215
- const leaf = tree.get(id);
4216
- const kind = leaf?.content?.kind;
4239
+ const scope = this._backScope();
4240
+ if (!scope) return false;
4241
+ const content = this._scopeContent(scope);
4242
+ if (typeof content?.canNavigateBack === "function") {
4243
+ try {
4244
+ if (content.canNavigateBack() === true) return true;
4245
+ } catch (err) {
4246
+ console.warn("[wm] content canNavigateBack threw", err);
4247
+ }
4248
+ }
4249
+ if (scope.leafId) {
4250
+ const tree = this._tree();
4251
+ const history = tree.activeTabHistory?.(scope.leafId) || [];
4252
+ if (history.length > 0) return true;
4253
+ const kind2 = tree.get(scope.leafId)?.content?.kind;
4254
+ return !!(kind2 && this.taxonomy.parentKindFor(kind2));
4255
+ }
4256
+ const kind = this._scopeActiveTab(scope)?.kind;
4217
4257
  return !!(kind && this.taxonomy.parentKindFor(kind));
4218
4258
  }
4219
4259
  /** Persist editor sub-state (e.g. active sub-tab) into the active
@@ -4276,6 +4316,25 @@ var WindowManager = class _WindowManager {
4276
4316
  const src = this._scopeTabs(scope);
4277
4317
  return src ? src.tabs[src.activeIdx] || null : null;
4278
4318
  }
4319
+ /** C37. What the scope's content factory returned for what is on screen:
4320
+ * a window's `mountInfo`, or the tile's mounted content. */
4321
+ _scopeContent(scope) {
4322
+ if (scope?.windowId) return this._windowToLeaf.get(scope.windowId)?.mountInfo || null;
4323
+ return scope?.leafId ? this.renderer?.contentOf?.(scope.leafId) || null : null;
4324
+ }
4325
+ /** C37. Ask the content to climb one of its own levels; `true` if it did.
4326
+ * A content that throws is treated as having nowhere to go, so Backspace
4327
+ * still walks the tile rather than doing nothing. */
4328
+ _contentNavigateBack(scope) {
4329
+ const content = this._scopeContent(scope);
4330
+ if (typeof content?.navigateBack !== "function") return false;
4331
+ try {
4332
+ return content.navigateBack() === true;
4333
+ } catch (err) {
4334
+ console.warn("[wm] content navigateBack threw", err);
4335
+ return false;
4336
+ }
4337
+ }
4279
4338
  /** Replace what a scope shows, in place: the tile's active tab (recording
4280
4339
  * history) or the window's content. */
4281
4340
  _navigateInScope(scope, kind, props = {}) {
@@ -8008,6 +8067,7 @@ export {
8008
8067
  openTileTabMenu,
8009
8068
  openTileTabSwitcher,
8010
8069
  registerPanelKeys,
8070
+ renderBreadcrumb,
8011
8071
  saveDesktops,
8012
8072
  uninstallPanelKeyRouter,
8013
8073
  wireLandingPaneFocus