flexdesk 0.8.0 → 0.9.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.
@@ -65,7 +65,10 @@ import { openForm } from '../ui/components/modal.js';
65
65
  * @param {object} [cfg.tableStore] threaded into ctx for table persistence
66
66
  * @param {object} [cfg.events] bus-event NAMES the WM listens for
67
67
  * @param {object} [cfg.rootCrumb] the breadcrumb's leading segment
68
- * @param {object} [cfg.palette] { placeholder, onPick } — C30. `onPick`
68
+ * @param {object} [cfg.palette] { placeholder, onPick, …C39 } — C39's
69
+ * grouped layout and its options are
70
+ * documented in `command_palette.js`.
71
+ * C30. `onPick`
69
72
  * is `(pick) => truthy` and CLAIMS the
70
73
  * open of a picked entity, so an embedder
71
74
  * with a rule about where its own entities
@@ -110,6 +113,11 @@ import { openForm } from '../ui/components/modal.js';
110
113
  * `data-twm-tabs` and watches it, so an
111
114
  * embedder whose settings pane holds only
112
115
  * the root element can change it live.
116
+ * @param {boolean} [cfg.newTabButton] C38. Whether the `'header'` strip
117
+ * draws its `+`. Default on; an embedder
118
+ * whose new tab has nowhere useful to go
119
+ * passes `false`. `wm.newTab()` is there
120
+ * either way.
113
121
  * @param {object} [cfg.chrome] { topNav?, paletteButton?, desktops?,
114
122
  * panelToggles?: { left?, right?, bottom? },
115
123
  * zoom? }
@@ -138,6 +146,7 @@ export async function createShell({
138
146
  backToOpenList = false,
139
147
  floatActiveTab = false,
140
148
  tabLayout = null,
149
+ newTabButton = true,
141
150
  chrome = {},
142
151
  // An embedder that moved its sections out of the top bar — into an icon
143
152
  // rail, say — passes the selector its own buttons match, and F1..F8 keep
@@ -181,6 +190,7 @@ export async function createShell({
181
190
  backToOpenList,
182
191
  floatActiveTab,
183
192
  tabLayout,
193
+ newTabButton,
184
194
  // `ctx` is the delivery vehicle for leaf-mounted chrome: tile_renderer
185
195
  // spreads it into every content factory, which is how the breadcrumb
186
196
  // gets `taxonomy` + `rootCrumb` without a content factory knowing they
@@ -43,7 +43,9 @@
43
43
  *
44
44
  * `+` appends a tab holding the taxonomy root, which is what a split seeds the
45
45
  * new pane with (`wm.newTab`). It is a button, so `CHROME_NO_FLOAT` already
46
- * makes it inert to the pull and the double-click.
46
+ * makes it inert to the pull and the double-click. `newTabButton: false`
47
+ * leaves it out, for an embedder whose root is not somewhere a new tab should
48
+ * start; the tabs still replace the title.
47
49
  *
48
50
  * The chrome stops being a drag source here (C33): a single-tab leaf now has a
49
51
  * tab to grab, and a strip that names the tab is the reason C33 limited the
@@ -285,7 +287,7 @@ export class TileRenderer {
285
287
  static get TAB_MIME() { return TILE_TAB_MIME; }
286
288
 
287
289
  constructor({ root, tree, content, ctx, onFocusChange, onAfterRender,
288
- tabLayout = null }) {
290
+ tabLayout = null, newTabButton = true }) {
289
291
  if (!content || typeof content.mount !== 'function') {
290
292
  throw new Error('TileRenderer: a content registry is required');
291
293
  }
@@ -308,6 +310,9 @@ export class TileRenderer {
308
310
  * The renderer cannot know about windows, so it says "I have
309
311
  * repainted" and the WM re-homes what it owns. */
310
312
  this.onAfterRender = onAfterRender || (() => {});
313
+ /** C38. Whether the `header` strip draws its `+`. An embedder whose
314
+ * new tab would open nothing useful turns it off; `wm.newTab` stays. */
315
+ this.newTabButton = newTabButton !== false;
311
316
  // leafId -> { wrapEl, bodyEl, chromeEl, content, kindKey, tabStrip }
312
317
  this._leafCache = new Map();
313
318
  this._drag = null;
@@ -1225,7 +1230,8 @@ export class TileRenderer {
1225
1230
  // component's container so its `update()` never rewrites it, and
1226
1231
  // built with the strip so `setTabLayout` (which empties the bar and
1227
1232
  // disposes the strip) takes it away with the strip.
1228
- if (this.tabLayout === 'header' && !bar.querySelector('.twm-leaf__tab-new')) {
1233
+ if (this.tabLayout === 'header' && this.newTabButton
1234
+ && !bar.querySelector('.twm-leaf__tab-new')) {
1229
1235
  const add = document.createElement('button');
1230
1236
  add.type = 'button';
1231
1237
  add.className = 'twm-leaf__tab-new';
package/src/tiling/wm.js CHANGED
@@ -35,7 +35,7 @@ export class WindowManager {
35
35
  constructor({ rootEl, api, ctx, onChange, eventBus, host, taxonomy, events, content,
36
36
  panelDefaults = null, snapPromotion = false,
37
37
  promoteInPlace = false, tabLayout = null, backToOpenList = false,
38
- floatActiveTab = false }) {
38
+ floatActiveTab = false, newTabButton = true }) {
39
39
  if (!taxonomy) throw new Error('WindowManager: a taxonomy is required');
40
40
  if (!content || typeof content.mount !== 'function') {
41
41
  throw new Error('WindowManager: a content registry is required '
@@ -121,6 +121,8 @@ export class WindowManager {
121
121
  * `data-twm-tabs` and watches it, so an embedder can change it
122
122
  * live without holding a renderer reference. */
123
123
  tabLayout,
124
+ /** C38. Whether the `header` strip draws its `+`. */
125
+ newTabButton,
124
126
  ctx: {
125
127
  ...this.ctx,
126
128
  wm: this,