# @embedpdf/angular — ./shell EpdfPanelToggle [ClassDeclaration] (from packages/framework/angular/shell/src/shell.ts): @Directive({ selector: '[epdfPanelToggle]', exportAs: 'epdfPanelToggle', host:{ '(click)': 'toggle()', '[attr.aria-expanded]': 'isOpen()', } , } ) export class EpdfPanelToggle{ readonly id = input.required({ alias: 'epdfPanelToggle'} ); readonly exclusive = input(undefined, { alias: 'epdfPanelToggleExclusive'} ); private readonly panel = inject(EpdfShell).surface(() => this.id()); readonly isOpen: Signal = this.panel.isOpen; toggle(): void{ const exclusive = this.exclusive(); this.panel.toggle(exclusive === undefined ? undefined :{ exclusive} ); } } EpdfShell [ClassDeclaration] (from packages/framework/angular/shell/src/shell.ts): @Injectable({ providedIn: 'root'} ) export class EpdfShell extends pluginService({ name: 'EpdfShell', feature: 'withShell()', token: ShellToken, state: shellState, methods: [ 'isOpen', 'getSurface', 'listOpenSurfaces', 'open', 'close', 'toggle', 'updateSurfaceProps', 'closeAll', 'isMenuOpen', 'listOpenMenus', 'openMenu', 'closeMenu', 'toggleMenu', 'closeAllMenus', 'getSnapshot', 'applySnapshot', ], events: ['onSurfaceOpened', 'onSurfaceClosed', 'onMenuOpened', 'onMenuClosed'], } ){ surface(id: string | (() => string)): EpdfSurface{ const idOf = typeof id === 'function' ? id : () => id; const shell = this.binding.capability; const now = () => untracked(shell); return{ isOpen: this.binding.select((shell) => shell.isOpen(idOf()), false, Object.is), props: this.binding.select( (shell) => shell.getSurface(idOf())?.props ?? NO_PROPS, NO_PROPS, Object.is, ), open: (options) => now()?.open(untracked(idOf), options), close: () => now()?.close(untracked(idOf)), toggle: (options) => now()?.toggle(untracked(idOf), options), } ; } } EpdfSurface [InterfaceDeclaration] (from packages/framework/angular/shell/src/shell.ts): export interface EpdfSurface{ readonly isOpen: Signal; readonly props: Signal; open(options?: OpenSurfaceOptions): void; close(): void; toggle(options?: OpenSurfaceOptions): void; } EpdfSurfaceFocus [ClassDeclaration] (from packages/framework/angular/shell/src/shell.ts): @Directive({ selector: '[epdfSurfaceFocus]'} ) export class EpdfSurfaceFocus{ readonly id = input.required({ alias: 'epdfSurfaceFocus'} ); readonly select = input(false, { alias: 'epdfSurfaceFocusSelect', transform: booleanAttribute} ); constructor(){ inject(EpdfShell); const element = inject>(ElementRef).nativeElement; const shell = new CapabilityBinding( injectKernelHost('epdfSurfaceFocus'), () => ShellToken, injectDocumentScope(), ); const request = shell.select( (current) => current.getSurface(this.id())?.focusRequest ?? 0, 0, Object.is, ); const follower = createSurfaceFocusFollower(); afterRenderEffect({ write: () =>{ const current = shell.capability(); const value = request(); const select = this.select(); untracked(() => follower.follow(element, current, value, { select} )); } , } ); } } MenuClosedEvent [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface MenuClosedEvent{ readonly id: string; } MenuOpenedEvent [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface MenuOpenedEvent{ readonly id: string; } OpenSurfaceOptions [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface OpenSurfaceOptions{ readonly exclusive?: string; readonly props?: SurfaceProps; readonly focus?: boolean; } ShellCapability [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface ShellCapability{ isOpen(id: string): boolean; getSurface(id: string): SurfaceState | null; listOpenSurfaces(): readonly SurfaceState[]; open(id: string, options?: OpenSurfaceOptions): void; close(id: string): void; toggle(id: string, options?: OpenSurfaceOptions): void; updateSurfaceProps(id: string, props: SurfaceProps): void; closeAll(): void; isMenuOpen(id: string): boolean; listOpenMenus(): readonly string[]; openMenu(id: string): void; closeMenu(id: string): void; toggleMenu(id: string): void; closeAllMenus(): void; getSnapshot(): ShellSnapshot; applySnapshot(snapshot: ShellSnapshot): void; readonly onSurfaceOpened: EventHook; readonly onSurfaceClosed: EventHook; readonly onMenuOpened: EventHook; readonly onMenuClosed: EventHook; } ShellSnapshot [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface ShellSnapshot{ readonly surfaces: Readonly>>; readonly openMenus: readonly string[]; } ShellState [InterfaceDeclaration] (from packages/plugin/shell/src/state.ts): export interface ShellState{ readonly openSurfaces: readonly SurfaceState[]; readonly openMenus: readonly string[]; } ShellToken [VariableDeclaration] (from packages/plugin/shell/src/token.ts): ShellToken = createCapabilityToken('shell', { hint: `add shellPlugin() from '@embedpdf/plugin-shell' to your plugins list`, } ) SurfaceClosedEvent [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface SurfaceClosedEvent{ readonly id: string; } SurfaceOpenedEvent [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface SurfaceOpenedEvent{ readonly id: string; readonly props?: SurfaceProps; } SurfaceProps [TypeAliasDeclaration] (from packages/plugin/shell/src/contract.ts): export type SurfaceProps = Readonly>; SurfaceState [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface SurfaceState{ readonly id: string; readonly open: boolean; readonly exclusive?: string; readonly props?: SurfaceProps; readonly focusRequest: number; } shellPlugin [VariableDeclaration] (from packages/plugin/shell/src/shell.plugin.ts): shellPlugin = () => definePlugin({ id: 'shell', scope: 'document', token: ShellToken, state: initialShellModel, create: createShellController, } ) shellState [VariableDeclaration] (from packages/plugin/shell/src/state.ts): shellState = defineState(ShellToken, { read: (shell): ShellState => ({ openSurfaces: shell.listOpenSurfaces(), openMenus: shell.listOpenMenus(), } ), empty:{ openSurfaces: [], openMenus: []} , } ) withShell [FunctionDeclaration] (from packages/framework/angular/shell/src/shell.ts): export function withShell(): EmbedPdfFeature{ return{ plugins: [shellPlugin()], services: [EpdfShell]} ; }