flexdesk 0.8.0 → 0.8.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flexdesk",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "A tiling window manager and widget set for desktop-class web applications. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -110,6 +110,11 @@ import { openForm } from '../ui/components/modal.js';
110
110
  * `data-twm-tabs` and watches it, so an
111
111
  * embedder whose settings pane holds only
112
112
  * the root element can change it live.
113
+ * @param {boolean} [cfg.newTabButton] C38. Whether the `'header'` strip
114
+ * draws its `+`. Default on; an embedder
115
+ * whose new tab has nowhere useful to go
116
+ * passes `false`. `wm.newTab()` is there
117
+ * either way.
113
118
  * @param {object} [cfg.chrome] { topNav?, paletteButton?, desktops?,
114
119
  * panelToggles?: { left?, right?, bottom? },
115
120
  * zoom? }
@@ -138,6 +143,7 @@ export async function createShell({
138
143
  backToOpenList = false,
139
144
  floatActiveTab = false,
140
145
  tabLayout = null,
146
+ newTabButton = true,
141
147
  chrome = {},
142
148
  // An embedder that moved its sections out of the top bar — into an icon
143
149
  // rail, say — passes the selector its own buttons match, and F1..F8 keep
@@ -181,6 +187,7 @@ export async function createShell({
181
187
  backToOpenList,
182
188
  floatActiveTab,
183
189
  tabLayout,
190
+ newTabButton,
184
191
  // `ctx` is the delivery vehicle for leaf-mounted chrome: tile_renderer
185
192
  // spreads it into every content factory, which is how the breadcrumb
186
193
  // 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,