/** * Copyright Aquera Inc 2023 * * This source code is licensed under the BSD-3-Clause license found in the * LICENSE file in the root directory of this source tree. */ import { CSSResultArray, TemplateResult, PropertyValues } from 'lit'; import NileElement from '../internal/nile-element'; import '../nile-button/nile-button'; /** The mode the AI panel is currently in. */ export type NileAppShellPanelMode = 'docked' | 'overlay'; /** Where the top bar is mounted. */ export type NileAppShellTopBarPlacement = 'content' | 'shell'; /** How the main region lays its content out. */ export type NileAppShellContentAlign = 'fluid' | 'centered'; /** The `detail` of the `nile-click` the header back control emits. */ export interface NileAppShellClickDetail { value: 'back'; } /** * @summary The application frame every route inherits: a side nav, a content container, an optional aside and an AI assistant panel. * * @status stable * @since 2.0 * * @tag nile-app-shell * * @dependency nile-button * @dependency nile-glyph * * @slot - The page body, inside the content container. * @slot banner - A full-width strip above every other region. * @slot top-bar - The page-title bar, mounted inside the container by default or spanning the shell when `top-bar-placement="shell"`. * @slot top-bar-actions - Controls pinned to the end of the top bar. * @slot tabs - A hoisted second-level tab strip, flush under the top bar and outside `
`'s scroller. * @slot app-icon - The mark shown before the page title whenever this slot has content, clipped to the shell's box. * @slot side-nav - The navigation track. Works best with ``. * @slot aside - A secondary column between the content container and the panel. * @slot panel - The AI panel's body. When empty the panel is unmounted and `openPanel()` is a no-op. * @slot panel-header - Replaces the default panel heading (mark plus title). * @slot panel-actions - Controls added before the panel's close button. * @slot panel-footer - A bar docked below the panel's scroll region, for a composer. * * @event nile-nav-toggle - Emitted after the nav's collapsed state or forced-rail lock changes. `detail: { collapsed, locked }`. * @event nile-panel-toggle - Emitted after the panel opens or closes. `detail: { open, mode }`. * @event nile-panel-mode-change - Emitted when the panel flips between docked and overlay. `detail: { mode }`. * @event nile-click - Emitted when the header's back control is pressed, or `goBackHeader()` is called. `detail: { value: 'back' }`. Emitted on the shell itself, so check `event.target === shell` as well as the value: a `nile-click` from page content bubbles through the shell too. * @event nile-panel-back - Emitted when the panel's back control is pressed, whether the shell's built-in panel chrome or a slotted `nile-app-shell-panel` draws it. * * @csspart skip-link - The skip-to-content link. * @csspart banner - The banner region. * @csspart shell-top-bar - The top bar when it spans the shell. * @csspart top-bar - The top bar, in either placement. * @csspart nav-toggle - The built-in nav toggle button. * @csspart rule - The vertical rule after the nav toggle. * @csspart ask-rule - The vertical rule before the Ask button, drawn when `top-bar-actions` has content. * @csspart top-bar-actions - The end-aligned top bar action group. * @csspart ask - The built-in Ask button, the shell's single door to the panel. * @csspart title-area - The header's own title block: back control, app icon, title, badge and description. * @csspart page-title - The title text, exposed as a heading whose level `headingLevel` sets. * @csspart description - The second line under the title. * @csspart badge - The pill after the title. * @csspart back - The header back control, shown by `headerBack`. * @csspart app-icon - The block holding the `app-icon` slot, shown when the slot has content and sized by `--nile-app-shell-app-icon-size`. * @csspart tabs - The hoisted tab-strip region, under the top bar. * @csspart side-nav - The navigation track. * @csspart content-section - The flex row holding container, aside and panel. * @csspart container - The content container. * @csspart main - The scrolling page body. * @csspart aside - The aside region. * @csspart panel - The AI panel. * @csspart panel-header - The panel's header bar. * @csspart panel-back - The panel's back control, shown by `panelBack`. * @csspart panel-title - The panel's title text. * @csspart panel-actions - The panel's header action group. * @csspart panel-close - The panel's close button. * @csspart panel-body - The panel's scroll region. * @csspart panel-footer - The panel's footer. * * @cssproperty [--nile-app-shell-side-nav-width=240px] - Expanded nav track. * @cssproperty [--nile-app-shell-side-nav-rail-width=70px] - Collapsed track. * @cssproperty [--nile-app-shell-side-nav-bg=transparent] - Surface behind a slotted side nav. * @cssproperty [--nile-app-shell-side-nav-border=0] - Edge on a slotted side nav. * @cssproperty [--nile-app-shell-gutter=4px] - Content-section padding, and the gap between container, aside and panel. * @cssproperty [--nile-app-shell-content-padding=24px] - Container inner padding. * @cssproperty [--nile-app-shell-top-bar-height=68px] - Top bar height. * @cssproperty [--nile-app-shell-panel-header-height=56px] - The panel header's own height. * @cssproperty [--nile-app-shell-tabs-height=33px] - Tab strip height. * @cssproperty [--nile-app-shell-panel-width=480px] - Docked panel width, and the `min()` ceiling for the overlay drawer. * @cssproperty [--nile-app-shell-panel-min-width=360px] - How far a docked panel shrinks to keep pushing rather than covering the page. * @cssproperty [--nile-app-shell-aside-width=320px] - Aside width. * @cssproperty [--nile-app-shell-aside-min-width=240px] - How far the aside shrinks before the page is asked for room. * @cssproperty [--nile-app-shell-content-min-width=640px] - Container floor. * @cssproperty [--nile-app-shell-min-width=768px] - Below this the window scrolls rather than the shell compressing. * @cssproperty [--nile-app-shell-centered-width=824px] - Column width under `content-align="centered"`. * @cssproperty [--nile-app-shell-app-icon-size=20px] - The app icon's box. * @cssproperty [--nile-app-shell-utility-size=32px] - Box the shell's own icon controls sit in. * @cssproperty [--nile-app-shell-radius=16px] - Container, aside and panel radius. * @cssproperty [--nile-app-shell-duration=250ms] - Track and panel motion. * @cssproperty [--nile-app-shell-ease] - Easing for moves and resizes. * * @method openPanel() - Open the AI panel. No-op when the panel is unavailable. * @method closePanel() - Close the AI panel. * @method togglePanel(force?) - Toggle, or force a specific open state. * @method expandNav() - Expand the side nav. * @method collapseNav() - Collapse the side nav to a rail. * @method toggleNav(force?) - Toggle, or force a specific collapsed state. * @method goBackHeader() - Emit `nile-click` with `{ value: 'back' }`, as the header's back control does. * @method goBackPanel() - Emit `nile-panel-back`, as the panel's back control does. * @method goBack() - Deprecated alias of `goBackPanel()`. */ export declare class NileAppShell extends NileElement { static get styles(): CSSResultArray; /** The user's nav preference. The nav can still render as a rail while this is false — see `navLocked`. */ navCollapsed: boolean; /** Whether the AI panel is open. */ panelOpen: boolean; /** Unmounts the AI panel for this route even when the `panel` slot is filled; `openPanel()` becomes a no-op. */ noPanel: boolean; /** The default panel heading. Ignored when `panel-header` is slotted. */ panelLabel: string; /** The page title, rendered as the top bar's own heading (`role="heading"`, level from `headingLevel`) before anything slotted into `top-bar`; leave unset and no title block renders. */ pageTitle?: string; /** The `aria-level` of the `pageTitle` heading, 1–6, so the title can fit the page's own heading outline; e.g. 2 when the page body or banner already has its h1. Out-of-range values clamp to 1–6 and non-numbers fall back to 1. */ headingLevel: number; /** A second line under the page title; a modifier on `pageTitle` that renders nothing with no title, and takes the bar to 76px. */ description?: string; /** A pill after the page title; a modifier on `pageTitle` like `description`, so with no title there is no badge. */ badge?: string; /** Shows the back arrow before the page title; pressing it emits `nile-click` with `{ value: 'back' }`. Independent of the `app-icon` slot. */ headerBack: boolean; /** Accessible name of the header back control. Never rendered as visible text. */ headerBackLabel: string; /** Hides the built-in nav toggle. Mount `nile-app-shell-nav-toggle` yourself. */ noNavToggle: boolean; /** Drops the Cmd/Ctrl+J and Escape panel shortcuts. */ noPanelShortcut: boolean; /** Hides the skip-to-content link. */ noSkipLink: boolean; /** Label for the skip-to-content link. */ skipLinkLabel: string; /** Where the top bar is mounted: inside the container, or spanning the shell. */ topBarPlacement: NileAppShellTopBarPlacement; /** `centered` caps the page body at `--nile-app-shell-centered-width`. */ contentAlign: NileAppShellContentAlign; /** Makes the slotted page root a size query container, so page CSS can size against the content container instead of the viewport. */ contentContainer: boolean; /** Drops the container's card chrome for a full-bleed page. */ flat: boolean; /** Removes the container's inner padding. */ noPadding: boolean; /** The label on the built-in Ask button. */ askLabel: string; /** Drops the built-in Ask button, for a bar that renders its own. */ noAsk: boolean; /** Shows a back control at the start of the panel header for a panel sub-view; emits `nile-panel-back`. */ panelBack: boolean; /** Accessible name of the panel's back control. */ panelBackLabel: string; /** Hides the tab strip for this route even when the `tabs` slot is filled. */ noTabs: boolean; /** Sizes the shell to the viewport instead of its parent. */ fullHeight: boolean; /** Below this shell width the panel overlays the content instead of pushing it, and the nav is forced to a rail; zero (default) means never. */ overlayBreakpoint: number; /** Below this shell width an open docked panel forces the nav to a rail. */ dockedRailBreakpoint: number; /** Persists the nav preference and docked panel state under this key. Overlay panel state is never persisted. */ persistKey?: string; /** The panel's current mode. Derived from the shell's width. */ private _panelMode; /** Whether the nav is held at a rail by the shell's width. */ private _navLocked; private _hasBanner; private _hasSideNav; private _hasTopBar; private _hasTopBarActions; private _hasTabs; private _hasAppIcon; private _hasPanel; private _hasPanelFooter; /** True when a `nile-app-shell-panel` is slotted, owning the panel's own chrome so the shell renders a bare region. */ private _panelOwnsChrome; private _hasAside; private _main?; private _width; private _resizeObserver?; private _restoredPanelOpen; /** The panel's current mode: `docked` or `overlay`. */ get panelMode(): NileAppShellPanelMode; /** Whether the shell is holding the nav at a rail. The toggle is disabled. */ get navLocked(): boolean; /** Whether a panel is mounted for this route. */ get panelAvailable(): boolean; /** Whether the tab strip is rendered: something slotted, and not switched off. */ get tabsVisible(): boolean; /** Whether the built-in Ask button is rendered. */ get askVisible(): boolean; /** Whether the nav renders as a rail right now, preference or lock. */ get rail(): boolean; connectedCallback(): void; disconnectedCallback(): void; protected willUpdate(changed: PropertyValues): void; protected updated(changed: PropertyValues): void; /** Open the AI panel. No-op when no panel is mounted for this route. */ openPanel(): void; /** Close the AI panel. */ closePanel(): void; /** Toggle the panel, or force a state. */ togglePanel(force?: boolean): void; /** Emit `nile-click` with `{ value: 'back' }`, as the header's back control does; the page owns the history. */ goBackHeader(): void; /** Emit `nile-panel-back`, as the panel's back control does; the page owns the view stack. */ goBackPanel(): void; /** @deprecated Use `goBackPanel()`; kept as an alias that emits `nile-panel-back`. */ goBack(): void; /** Expand the side nav. */ expandNav(): void; /** Collapse the side nav to a rail. */ collapseNav(): void; /** Toggle the side nav, or force a collapsed state. */ toggleNav(force?: boolean): void; /** Move focus to the page body. */ focusMain(): void; private _setPanelOpen; private _setNavCollapsed; /** Records the shell's width and re-derives everything that depends on it. */ private _measure; /** The shell's geometry, read off its own custom properties, falling back to defaults before a computed style exists. */ private _geometry; /** The shell width a docked panel needs to sit beside the content floor, over a side-nav `track` wide. */ private _dockRequirement; private _recompute; /** Mirrors the effective rail state onto a slotted `nile-side-bar`. */ private _syncSideNav; /** A slotted sidebar's own expand button is the same toggle. */ private _onSideNavToggle; private _onKeyDown; private _storageKey; private _restore; private _persist; private _onSlotChange; private _renderNavToggle; /** Whether the header has a title block of its own to draw: a title, the back arrow or a slotted app icon mounts it. */ private get _hasTitleBlock(); /** `headingLevel` as a safe `aria-level`: a whole number clamped to 1–6, and 1 for anything non-numeric. */ private get _headingLevel(); private _renderBack; private _renderAppIconSlot; private _renderAppIconProbe; private _renderTitleBlock; private _renderTopBar; render(): TemplateResult; } export default NileAppShell; declare global { interface HTMLElementTagNameMap { 'nile-app-shell': NileAppShell; } }