@jsvision/ui / withBase
Function: withBase()
withBase<
T>(base,extra):T[]
Defined in: ui/src/router/chrome.ts:35
Compose a chrome contribution from a base list plus per-screen extras: [...base, ...extra]. Works for either bar — a status contribution (View[]) or a menu contribution (MenuItem[]).
Pass fresh base items (e.g. from app.statusBase()), not a shared live list: a View has one parent, so composing with the live base bar's own item instances would re-parent them.
Type Parameters
T
T extends View | { kind: string; }
Parameters
base
readonly T[]
The base items (a fresh list — see above).
extra
readonly T[]
The per-screen items to append.
Returns
T[]
A new array of the base items followed by the extras.
Example
ts
import { createApplication, withBase, statusItem } from '@jsvision/ui';
import type { ScreenBundle } from '@jsvision/ui';
import { resolveCapabilities } from '@jsvision/core';
const caps = resolveCapabilities({ env: {}, platform: 'linux' }).profile;
const app = createApplication({ caps });
// In a route build, keep the app's base status affordances and add a screen-specific one:
const screen: ScreenBundle = {
view: app.desktop,
status: withBase(app.statusBase(), [statusItem('~E~dit', 'detail.edit')]),
};