@wildwinter/app-shell 0.35.0 → 0.36.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/index.d.cts CHANGED
@@ -150,6 +150,11 @@ interface PaneSideConfig {
150
150
  label?: string;
151
151
  /** Shortcut hint appended to the tooltip, e.g. "Cmd+1". */
152
152
  shortcutHint?: string;
153
+ /** false = the pane is not offered at all: no toggle, togglePane ignored,
154
+ * forced closed whatever the remembered state says. For a slot a host has
155
+ * retired but keeps mounted (Storyletter's inspector) - the shell used to
156
+ * offer a chevron that opened a paneful of nothing. Default true. */
157
+ offered?: boolean;
153
158
  }
154
159
  interface PaneShellState {
155
160
  open: Record<PaneSide, boolean>;
package/dist/index.d.ts CHANGED
@@ -150,6 +150,11 @@ interface PaneSideConfig {
150
150
  label?: string;
151
151
  /** Shortcut hint appended to the tooltip, e.g. "Cmd+1". */
152
152
  shortcutHint?: string;
153
+ /** false = the pane is not offered at all: no toggle, togglePane ignored,
154
+ * forced closed whatever the remembered state says. For a slot a host has
155
+ * retired but keeps mounted (Storyletter's inspector) - the shell used to
156
+ * offer a chevron that opened a paneful of nothing. Default true. */
157
+ offered?: boolean;
153
158
  }
154
159
  interface PaneShellState {
155
160
  open: Record<PaneSide, boolean>;
package/dist/index.js CHANGED
@@ -336,7 +336,11 @@ var openVar = { nav: "--nav-open-w", inspector: "--insp-open-w" };
336
336
  var collapseClass = { nav: "no-nav", inspector: "no-inspector" };
337
337
  function mountPaneShell(host, opts) {
338
338
  const cfg = { nav: opts.nav, inspector: opts.inspector };
339
- const open = { nav: opts.initial?.open?.nav ?? true, inspector: opts.initial?.open?.inspector ?? true };
339
+ const offered = (side) => cfg[side].offered !== false;
340
+ const open = {
341
+ nav: offered("nav") && (opts.initial?.open?.nav ?? true),
342
+ inspector: offered("inspector") && (opts.initial?.open?.inspector ?? true)
343
+ };
340
344
  const width = { ...opts.initial?.width ?? {} };
341
345
  const el2 = (tag, cls) => {
342
346
  const n = document.createElement(tag);
@@ -366,6 +370,8 @@ function mountPaneShell(host, opts) {
366
370
  const root = el2("div", "pane-shell");
367
371
  root.append(topbar, panes);
368
372
  host.append(root);
373
+ if (!offered("nav")) navToggle.remove();
374
+ if (!offered("inspector")) inspToggle.remove();
369
375
  function applyToggleGlyph(side, button) {
370
376
  const isOpen = open[side];
371
377
  button.textContent = side === "nav" ? isOpen ? "\u2039" : "\u203A" : isOpen ? "\u203A" : "\u2039";
@@ -382,8 +388,8 @@ function mountPaneShell(host, opts) {
382
388
  panes.style.setProperty(openVar.inspector, width.inspector !== void 0 ? `${width.inspector}px` : cfg.inspector.defaultWidth);
383
389
  applyToggleGlyph("nav", navToggle);
384
390
  applyToggleGlyph("inspector", inspToggle);
385
- navResizer.style.display = cfg.nav.resizable === false ? "none" : "";
386
- inspResizer.style.display = cfg.inspector.resizable === false ? "none" : "";
391
+ navResizer.style.display = cfg.nav.resizable === false || !offered("nav") ? "none" : "";
392
+ inspResizer.style.display = cfg.inspector.resizable === false || !offered("inspector") ? "none" : "";
387
393
  }
388
394
  const snapshot = () => ({ open: { ...open }, width: { ...width } });
389
395
  const persist = () => opts.onChange?.(snapshot());
@@ -394,7 +400,7 @@ function mountPaneShell(host, opts) {
394
400
  persist();
395
401
  }
396
402
  function togglePane(side) {
397
- setPaneOpen(side, !open[side]);
403
+ if (offered(side)) setPaneOpen(side, !open[side]);
398
404
  }
399
405
  function resetWidths() {
400
406
  delete width.nav;