@trismegisto/angular 3.3.13 → 3.3.14
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/fesm2022/trismegisto-angular-command-palette.mjs +27 -6
- package/fesm2022/trismegisto-angular-command-palette.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-data-grid.mjs +2 -2
- package/fesm2022/trismegisto-angular-data-grid.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-dialog.mjs +1 -1
- package/fesm2022/trismegisto-angular-dialog.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-drawer.mjs +30 -7
- package/fesm2022/trismegisto-angular-drawer.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-floating-window.mjs +65 -6
- package/fesm2022/trismegisto-angular-floating-window.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-menu-button.mjs +23 -2
- package/fesm2022/trismegisto-angular-menu-button.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-modal.mjs +29 -6
- package/fesm2022/trismegisto-angular-modal.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-overlay-stage.mjs +16 -0
- package/fesm2022/trismegisto-angular-overlay-stage.mjs.map +1 -0
- package/fesm2022/trismegisto-angular-reason-dialog.mjs +1 -1
- package/fesm2022/trismegisto-angular-reason-dialog.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-settings.mjs +59 -7
- package/fesm2022/trismegisto-angular-settings.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-tooltip.mjs +27 -2
- package/fesm2022/trismegisto-angular-tooltip.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-wizard.mjs +1 -1
- package/fesm2022/trismegisto-angular-wizard.mjs.map +1 -1
- package/fesm2022/trismegisto-angular.mjs +1 -0
- package/fesm2022/trismegisto-angular.mjs.map +1 -1
- package/package.json +9 -5
- package/types/trismegisto-angular-command-palette.d.ts +14 -1
- package/types/trismegisto-angular-command-palette.d.ts.map +1 -1
- package/types/trismegisto-angular-drawer.d.ts +14 -1
- package/types/trismegisto-angular-drawer.d.ts.map +1 -1
- package/types/trismegisto-angular-floating-window.d.ts +14 -1
- package/types/trismegisto-angular-floating-window.d.ts.map +1 -1
- package/types/trismegisto-angular-menu-button.d.ts +3 -0
- package/types/trismegisto-angular-menu-button.d.ts.map +1 -1
- package/types/trismegisto-angular-modal.d.ts +13 -1
- package/types/trismegisto-angular-modal.d.ts.map +1 -1
- package/types/trismegisto-angular-overlay-stage.d.ts +20 -0
- package/types/trismegisto-angular-overlay-stage.d.ts.map +1 -0
- package/types/trismegisto-angular-settings.d.ts +14 -1
- package/types/trismegisto-angular-settings.d.ts.map +1 -1
- package/types/trismegisto-angular-tooltip.d.ts +7 -0
- package/types/trismegisto-angular-tooltip.d.ts.map +1 -1
- package/types/trismegisto-angular.d.ts +1 -0
- package/types/trismegisto-angular.d.ts.map +1 -1
|
@@ -80,7 +80,7 @@ class DialogHostComponent {
|
|
|
80
80
|
</div>
|
|
81
81
|
}
|
|
82
82
|
</hm-modal>
|
|
83
|
-
`, isInline: true, dependencies: [{ kind: "component", type: ModalComponent, selector: "hm-modal", inputs: ["open", "heading", "size", "closeLabel", "closable", "beforeClose"], outputs: ["openChange", "closed"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: ButtonComponent, selector: "hm-button", inputs: ["emphasis", "intent", "size", "type", "icon", "iconDirection", "iconEnd", "disabled", "loading", "loadingState", "block", "link", "newTab", "caret", "inMenu", "toggle", "pressed"], outputs: ["loadingStateChange", "pressedChange", "clicked"] }, { kind: "component", type: IconComponent, selector: "hm-icon", inputs: ["shape", "direction", "size", "solid", "badge", "status", "flip", "inverse", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
83
|
+
`, isInline: true, dependencies: [{ kind: "component", type: ModalComponent, selector: "hm-modal", inputs: ["open", "heading", "size", "closeLabel", "closable", "scope", "beforeClose"], outputs: ["openChange", "closed"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: ButtonComponent, selector: "hm-button", inputs: ["emphasis", "intent", "size", "type", "icon", "iconDirection", "iconEnd", "disabled", "loading", "loadingState", "block", "link", "newTab", "caret", "inMenu", "toggle", "pressed"], outputs: ["loadingStateChange", "pressedChange", "clicked"] }, { kind: "component", type: IconComponent, selector: "hm-icon", inputs: ["shape", "direction", "size", "solid", "badge", "status", "flip", "inverse", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
84
84
|
}
|
|
85
85
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: DialogHostComponent, decorators: [{
|
|
86
86
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trismegisto-angular-dialog.mjs","sources":["../../src/dialog/dialog-ref.ts","../../src/dialog/icons.generated.ts","../../src/dialog/dialog-host.component.ts","../../src/dialog/dialog.service.ts","../../src/dialog/index.ts","../../src/dialog/trismegisto-angular-dialog.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { ModalSize } from '@trismegisto/primitives/classes';\n\n/** Dados passados em `open(…, { data })`, injetáveis no componente aberto. */\nexport const HERMES_DIALOG_DATA = new InjectionToken<unknown>('HERMES_DIALOG_DATA');\n\nexport interface HermesDialogConfig<D = unknown> {\n /** Título da janela — também o nome acessível do diálogo. */\n readonly heading: string;\n readonly size?: ModalSize;\n /** Mostra o X e aceita Esc. Padrão: `true`. */\n readonly closable?: boolean;\n readonly data?: D;\n}\n\nexport interface HermesConfirmOptions {\n readonly heading: string;\n /** Texto do corpo, abaixo do ícone (ex.: \"O rascunho será descartado.\"). */\n readonly message: string;\n /** Rótulo do botão de confirmar. Padrão do catálogo (\"Confirmar\"). */\n readonly confirmLabel?: string;\n /** Rótulo do botão de cancelar. Padrão do catálogo (\"Cancelar\"). */\n readonly cancelLabel?: string;\n /** Operação destrutiva: botão `danger` e ícone de atenção. */\n readonly danger?: boolean;\n}\n\n/**\n * Referência a um diálogo aberto por `HermesDialogService`. O componente aberto a recebe por injeção\n * (`inject(HermesDialogRef)`) para fechar com um resultado; quem abriu espera `closed`.\n * Fechar pelo X ou pelo Esc resolve com `undefined`.\n */\nexport class HermesDialogRef<R = unknown> {\n private resolve!: (result: R | undefined) => void;\n private done = false;\n /** Resolve uma vez, quando o diálogo fecha. */\n readonly closed: Promise<R | undefined> = new Promise((resolve) => (this.resolve = resolve));\n\n /** @internal chamado pelo serviço para desmontar o diálogo. */\n onClose: () => void = () => {};\n\n close(result?: R): void {\n if (this.done) return;\n this.done = true;\n this.resolve(result);\n this.onClose();\n }\n}\n","// GERADO por scripts/generate-internal-icons.mjs — não editar à mão.\n// Ícones que esta pasta usa por dentro; cada @Component/@Directive daqui os registra com\n// `readonly #icons = useHermesIcons(DIALOG_ICONS);`.\nimport type { RegisteredIcon } from '@trismegisto/icons';\nimport {\n ICON_EXCLAMATION_TRIANGLE,\n ICON_INFO_CIRCLE,\n} from '@trismegisto/angular/icon';\n\nexport const DIALOG_ICONS: readonly RegisteredIcon[] = [ICON_EXCLAMATION_TRIANGLE, ICON_INFO_CIRCLE];\n","import { NgComponentOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, Injector, Type, inject, signal } from '@angular/core';\nimport { HERMES_MESSAGES } from '@trismegisto/angular/i18n';\nimport { ButtonComponent } from '@trismegisto/angular/button';\nimport { IconComponent } from '@trismegisto/angular/icon';\nimport { ModalComponent } from '@trismegisto/angular/modal';\nimport { HermesConfirmOptions, HermesDialogConfig, HermesDialogRef } from './dialog-ref';\nimport { useHermesIcons } from '@trismegisto/angular/icon';\nimport { DIALOG_ICONS } from './icons.generated';\n\n/**\n * Casca montada por `HermesDialogService`: um `hm-modal` com o componente pedido dentro (`open`) ou\n * com o aviso de confirmação (`confirm`). Não é usado direto em template.\n */\n@Component({\n selector: 'hm-dialog-host',\n imports: [ModalComponent, NgComponentOutlet, ButtonComponent, IconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <hm-modal\n [open]=\"open()\"\n (openChange)=\"onOpenChange($event)\"\n [heading]=\"config.heading\"\n [size]=\"config.size ?? (confirmOptions ? 'small' : 'medium')\"\n [closable]=\"config.closable ?? true\"\n >\n <!-- Um bloco por slot, cada um com UMA raiz: um @if com duas raízes não é distribuído pelo\n <ng-content select> e o rodapé cairia no corpo do modal. -->\n @if (confirmOptions; as confirm) {\n <div class=\"hm-dialog-confirm\" [class.hm-dialog-confirm--danger]=\"confirm.danger\">\n <hm-icon class=\"hm-dialog-confirm__icon\" [shape]=\"confirm.danger ? 'exclamation-triangle' : 'info-circle'\" />\n <p class=\"hm-dialog-confirm__message\">{{ confirm.message }}</p>\n </div>\n } @else if (component) {\n <ng-container *ngComponentOutlet=\"component; injector: contentInjector\" />\n }\n @if (confirmOptions; as confirm) {\n <div footer>\n <hm-button emphasis=\"minimal\" (clicked)=\"ref.close(false)\">{{ confirm.cancelLabel || text.cancel }}</hm-button>\n <hm-button [intent]=\"confirm.danger ? 'danger' : 'primary'\" (clicked)=\"ref.close(true)\">\n {{ confirm.confirmLabel || text.confirm }}\n </hm-button>\n </div>\n }\n </hm-modal>\n `,\n})\nexport class DialogHostComponent {\n readonly #icons = useHermesIcons(DIALOG_ICONS);\n protected readonly text = inject(HERMES_MESSAGES).dialog;\n protected readonly ref = inject(HermesDialogRef);\n protected readonly contentInjector = inject(Injector);\n protected readonly open = signal(true);\n\n /** Preenchidos pelo serviço logo depois de criar a casca. */\n config!: HermesDialogConfig;\n component: Type<unknown> | null = null;\n confirmOptions: HermesConfirmOptions | null = null;\n\n /** X ou Esc fecharam o modal: o diálogo fecha sem resultado. */\n protected onOpenChange(open: boolean): void {\n this.open.set(open);\n if (!open) this.ref.close(undefined);\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { ApplicationRef, EnvironmentInjector, Injectable, Injector, Type, createComponent, inject } from '@angular/core';\nimport { copyThemeScope } from '@trismegisto/primitives/theme';\nimport { DialogHostComponent } from './dialog-host.component';\nimport { HERMES_DIALOG_DATA, HermesConfirmOptions, HermesDialogConfig, HermesDialogRef } from './dialog-ref';\n\n/**\n * Diálogos imperativos sobre o `hm-modal` — o equivalente do `MatDialog`/`Dialog` do Angular CDK e do\n * `modal-stack.service` do Hermes anterior:\n *\n * ```ts\n * const ok = await this.dialogs.confirm({ heading: 'Remover servidor?', message: 'Não pode ser desfeito.', danger: true });\n * const ref = this.dialogs.open<Servidor>(EditarServidor, { heading: 'Editar', data: servidor });\n * const salvo = await ref.closed;\n * ```\n *\n * O componente aberto recebe `HERMES_DIALOG_DATA` e `HermesDialogRef` por injeção. Vários diálogos podem\n * ficar abertos ao mesmo tempo (empilhados); foco preso, Esc e devolução do foco vêm do `hm-modal`.\n * Para um modal fixo num template, continue usando `<hm-modal [(open)]>`.\n */\n@Injectable({ providedIn: 'root' })\nexport class HermesDialogService {\n private readonly appRef = inject(ApplicationRef);\n private readonly environmentInjector = inject(EnvironmentInjector);\n private readonly injector = inject(Injector);\n private readonly document = inject(DOCUMENT);\n\n open<R = unknown, D = unknown>(component: Type<unknown>, config: HermesDialogConfig<D>): HermesDialogRef<R> {\n return this.mount<R>(config, (host) => (host.component = component));\n }\n\n /** `true` se a pessoa confirmou; `false` se cancelou, fechou no X ou no Esc. */\n async confirm(options: HermesConfirmOptions): Promise<boolean> {\n const ref = this.mount<boolean>({ heading: options.heading, closable: true }, (host) => (host.confirmOptions = options));\n return (await ref.closed) === true;\n }\n\n private mount<R>(config: HermesDialogConfig, setup: (host: DialogHostComponent) => void): HermesDialogRef<R> {\n const ref = new HermesDialogRef<R>();\n const elementInjector = Injector.create({\n parent: this.injector,\n providers: [\n { provide: HermesDialogRef, useValue: ref },\n { provide: HERMES_DIALOG_DATA, useValue: config.data },\n ],\n });\n const componentRef = createComponent(DialogHostComponent, { environmentInjector: this.environmentInjector, elementInjector });\n componentRef.instance.config = config;\n setup(componentRef.instance);\n\n const element = componentRef.location.nativeElement as HTMLElement;\n // Fora do elemento que carrega o tema, o diálogo voltaria ao tema padrão: leva o escopo junto.\n copyThemeScope(this.document.querySelector('[data-theme]'), element);\n this.document.body.appendChild(element);\n this.appRef.attachView(componentRef.hostView);\n componentRef.changeDetectorRef.detectChanges();\n\n ref.onClose = () => {\n this.appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n };\n return ref;\n }\n}\n","// Ponto de import `@trismegisto/angular/dialog` (secundário do ng-packagr): o que o public-api e as outras pastas usam\n// daqui. Gerado em 2026-10-03; ao criar arquivo público novo na pasta, acrescente a linha.\nexport * from './dialog-ref';\nexport * from './dialog.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAGA;MACa,kBAAkB,GAAG,IAAI,cAAc,CAAU,oBAAoB;AAuBlF;;;;AAIG;MACU,eAAe,CAAA;AAClB,IAAA,OAAO;IACP,IAAI,GAAG,KAAK;;AAEX,IAAA,MAAM,GAA2B,IAAI,OAAO,CAAC,CAAC,OAAO,MAAM,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC;;AAG5F,IAAA,OAAO,GAAe,MAAK,EAAE,CAAC;AAE9B,IAAA,KAAK,CAAC,MAAU,EAAA;QACd,IAAI,IAAI,CAAC,IAAI;YAAE;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI,CAAC,OAAO,EAAE;IAChB;AACD;;ACtCM,MAAM,YAAY,GAA8B,CAAC,yBAAyB,EAAE,gBAAgB,CAAC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CAAC,iBAAiB,CAAC,aAAa,EAAE;AAE9C,QAAA,GAAG,CAAC,OAAO,GAAG,MAAK;YACjB,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC;YAC7C,YAAY,CAAC,OAAO,EAAE;AACxB,QAAA,CAAC;AACD,QAAA,OAAO,GAAG;IACZ;wGAzCW,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADN,MAAM,EAAA,CAAA;;4FACnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACpBlC;AACA;;ACDA;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"trismegisto-angular-dialog.mjs","sources":["../../src/dialog/dialog-ref.ts","../../src/dialog/icons.generated.ts","../../src/dialog/dialog-host.component.ts","../../src/dialog/dialog.service.ts","../../src/dialog/index.ts","../../src/dialog/trismegisto-angular-dialog.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { ModalSize } from '@trismegisto/primitives/classes';\n\n/** Dados passados em `open(…, { data })`, injetáveis no componente aberto. */\nexport const HERMES_DIALOG_DATA = new InjectionToken<unknown>('HERMES_DIALOG_DATA');\n\nexport interface HermesDialogConfig<D = unknown> {\n /** Título da janela — também o nome acessível do diálogo. */\n readonly heading: string;\n readonly size?: ModalSize;\n /** Mostra o X e aceita Esc. Padrão: `true`. */\n readonly closable?: boolean;\n readonly data?: D;\n}\n\nexport interface HermesConfirmOptions {\n readonly heading: string;\n /** Texto do corpo, abaixo do ícone (ex.: \"O rascunho será descartado.\"). */\n readonly message: string;\n /** Rótulo do botão de confirmar. Padrão do catálogo (\"Confirmar\"). */\n readonly confirmLabel?: string;\n /** Rótulo do botão de cancelar. Padrão do catálogo (\"Cancelar\"). */\n readonly cancelLabel?: string;\n /** Operação destrutiva: botão `danger` e ícone de atenção. */\n readonly danger?: boolean;\n}\n\n/**\n * Referência a um diálogo aberto por `HermesDialogService`. O componente aberto a recebe por injeção\n * (`inject(HermesDialogRef)`) para fechar com um resultado; quem abriu espera `closed`.\n * Fechar pelo X ou pelo Esc resolve com `undefined`.\n */\nexport class HermesDialogRef<R = unknown> {\n private resolve!: (result: R | undefined) => void;\n private done = false;\n /** Resolve uma vez, quando o diálogo fecha. */\n readonly closed: Promise<R | undefined> = new Promise((resolve) => (this.resolve = resolve));\n\n /** @internal chamado pelo serviço para desmontar o diálogo. */\n onClose: () => void = () => {};\n\n close(result?: R): void {\n if (this.done) return;\n this.done = true;\n this.resolve(result);\n this.onClose();\n }\n}\n","// GERADO por scripts/generate-internal-icons.mjs — não editar à mão.\n// Ícones que esta pasta usa por dentro; cada @Component/@Directive daqui os registra com\n// `readonly #icons = useHermesIcons(DIALOG_ICONS);`.\nimport type { RegisteredIcon } from '@trismegisto/icons';\nimport {\n ICON_EXCLAMATION_TRIANGLE,\n ICON_INFO_CIRCLE,\n} from '@trismegisto/angular/icon';\n\nexport const DIALOG_ICONS: readonly RegisteredIcon[] = [ICON_EXCLAMATION_TRIANGLE, ICON_INFO_CIRCLE];\n","import { NgComponentOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, Injector, Type, inject, signal } from '@angular/core';\nimport { HERMES_MESSAGES } from '@trismegisto/angular/i18n';\nimport { ButtonComponent } from '@trismegisto/angular/button';\nimport { IconComponent } from '@trismegisto/angular/icon';\nimport { ModalComponent } from '@trismegisto/angular/modal';\nimport { HermesConfirmOptions, HermesDialogConfig, HermesDialogRef } from './dialog-ref';\nimport { useHermesIcons } from '@trismegisto/angular/icon';\nimport { DIALOG_ICONS } from './icons.generated';\n\n/**\n * Casca montada por `HermesDialogService`: um `hm-modal` com o componente pedido dentro (`open`) ou\n * com o aviso de confirmação (`confirm`). Não é usado direto em template.\n */\n@Component({\n selector: 'hm-dialog-host',\n imports: [ModalComponent, NgComponentOutlet, ButtonComponent, IconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <hm-modal\n [open]=\"open()\"\n (openChange)=\"onOpenChange($event)\"\n [heading]=\"config.heading\"\n [size]=\"config.size ?? (confirmOptions ? 'small' : 'medium')\"\n [closable]=\"config.closable ?? true\"\n >\n <!-- Um bloco por slot, cada um com UMA raiz: um @if com duas raízes não é distribuído pelo\n <ng-content select> e o rodapé cairia no corpo do modal. -->\n @if (confirmOptions; as confirm) {\n <div class=\"hm-dialog-confirm\" [class.hm-dialog-confirm--danger]=\"confirm.danger\">\n <hm-icon class=\"hm-dialog-confirm__icon\" [shape]=\"confirm.danger ? 'exclamation-triangle' : 'info-circle'\" />\n <p class=\"hm-dialog-confirm__message\">{{ confirm.message }}</p>\n </div>\n } @else if (component) {\n <ng-container *ngComponentOutlet=\"component; injector: contentInjector\" />\n }\n @if (confirmOptions; as confirm) {\n <div footer>\n <hm-button emphasis=\"minimal\" (clicked)=\"ref.close(false)\">{{ confirm.cancelLabel || text.cancel }}</hm-button>\n <hm-button [intent]=\"confirm.danger ? 'danger' : 'primary'\" (clicked)=\"ref.close(true)\">\n {{ confirm.confirmLabel || text.confirm }}\n </hm-button>\n </div>\n }\n </hm-modal>\n `,\n})\nexport class DialogHostComponent {\n readonly #icons = useHermesIcons(DIALOG_ICONS);\n protected readonly text = inject(HERMES_MESSAGES).dialog;\n protected readonly ref = inject(HermesDialogRef);\n protected readonly contentInjector = inject(Injector);\n protected readonly open = signal(true);\n\n /** Preenchidos pelo serviço logo depois de criar a casca. */\n config!: HermesDialogConfig;\n component: Type<unknown> | null = null;\n confirmOptions: HermesConfirmOptions | null = null;\n\n /** X ou Esc fecharam o modal: o diálogo fecha sem resultado. */\n protected onOpenChange(open: boolean): void {\n this.open.set(open);\n if (!open) this.ref.close(undefined);\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { ApplicationRef, EnvironmentInjector, Injectable, Injector, Type, createComponent, inject } from '@angular/core';\nimport { copyThemeScope } from '@trismegisto/primitives/theme';\nimport { DialogHostComponent } from './dialog-host.component';\nimport { HERMES_DIALOG_DATA, HermesConfirmOptions, HermesDialogConfig, HermesDialogRef } from './dialog-ref';\n\n/**\n * Diálogos imperativos sobre o `hm-modal` — o equivalente do `MatDialog`/`Dialog` do Angular CDK e do\n * `modal-stack.service` do Hermes anterior:\n *\n * ```ts\n * const ok = await this.dialogs.confirm({ heading: 'Remover servidor?', message: 'Não pode ser desfeito.', danger: true });\n * const ref = this.dialogs.open<Servidor>(EditarServidor, { heading: 'Editar', data: servidor });\n * const salvo = await ref.closed;\n * ```\n *\n * O componente aberto recebe `HERMES_DIALOG_DATA` e `HermesDialogRef` por injeção. Vários diálogos podem\n * ficar abertos ao mesmo tempo (empilhados); foco preso, Esc e devolução do foco vêm do `hm-modal`.\n * Para um modal fixo num template, continue usando `<hm-modal [(open)]>`.\n */\n@Injectable({ providedIn: 'root' })\nexport class HermesDialogService {\n private readonly appRef = inject(ApplicationRef);\n private readonly environmentInjector = inject(EnvironmentInjector);\n private readonly injector = inject(Injector);\n private readonly document = inject(DOCUMENT);\n\n open<R = unknown, D = unknown>(component: Type<unknown>, config: HermesDialogConfig<D>): HermesDialogRef<R> {\n return this.mount<R>(config, (host) => (host.component = component));\n }\n\n /** `true` se a pessoa confirmou; `false` se cancelou, fechou no X ou no Esc. */\n async confirm(options: HermesConfirmOptions): Promise<boolean> {\n const ref = this.mount<boolean>({ heading: options.heading, closable: true }, (host) => (host.confirmOptions = options));\n return (await ref.closed) === true;\n }\n\n private mount<R>(config: HermesDialogConfig, setup: (host: DialogHostComponent) => void): HermesDialogRef<R> {\n const ref = new HermesDialogRef<R>();\n const elementInjector = Injector.create({\n parent: this.injector,\n providers: [\n { provide: HermesDialogRef, useValue: ref },\n { provide: HERMES_DIALOG_DATA, useValue: config.data },\n ],\n });\n const componentRef = createComponent(DialogHostComponent, { environmentInjector: this.environmentInjector, elementInjector });\n componentRef.instance.config = config;\n setup(componentRef.instance);\n\n const element = componentRef.location.nativeElement as HTMLElement;\n // Fora do elemento que carrega o tema, o diálogo voltaria ao tema padrão: leva o escopo junto.\n copyThemeScope(this.document.querySelector('[data-theme]'), element);\n this.document.body.appendChild(element);\n this.appRef.attachView(componentRef.hostView);\n componentRef.changeDetectorRef.detectChanges();\n\n ref.onClose = () => {\n this.appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n };\n return ref;\n }\n}\n","// Ponto de import `@trismegisto/angular/dialog` (secundário do ng-packagr): o que o public-api e as outras pastas usam\n// daqui. Gerado em 2026-10-03; ao criar arquivo público novo na pasta, acrescente a linha.\nexport * from './dialog-ref';\nexport * from './dialog.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAGA;MACa,kBAAkB,GAAG,IAAI,cAAc,CAAU,oBAAoB;AAuBlF;;;;AAIG;MACU,eAAe,CAAA;AAClB,IAAA,OAAO;IACP,IAAI,GAAG,KAAK;;AAEX,IAAA,MAAM,GAA2B,IAAI,OAAO,CAAC,CAAC,OAAO,MAAM,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC;;AAG5F,IAAA,OAAO,GAAe,MAAK,EAAE,CAAC;AAE9B,IAAA,KAAK,CAAC,MAAU,EAAA;QACd,IAAI,IAAI,CAAC,IAAI;YAAE;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI,CAAC,OAAO,EAAE;IAChB;AACD;;ACtCM,MAAM,YAAY,GAA8B,CAAC,yBAAyB,EAAE,gBAAgB,CAAC;;ACCpG;;;AAGG;MAkCU,mBAAmB,CAAA;AACrB,IAAA,MAAM,GAAG,cAAc,CAAC,YAAY,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MAAK;YACjB,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC;YAC7C,YAAY,CAAC,OAAO,EAAE;AACxB,QAAA,CAAC;AACD,QAAA,OAAO,GAAG;IACZ;wGAzCW,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADN,MAAM,EAAA,CAAA;;4FACnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACpBlC;AACA;;ACDA;;AAEG;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { model, input, booleanAttribute, inject, output, viewChild, DOCUMENT, afterRenderEffect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { activateOverlay, handleOverlayKeydown } from '@trismegisto/primitives/focus';
|
|
3
|
+
import { activateStagedOverlay, activateOverlay, handleOverlayKeydown } from '@trismegisto/primitives/focus';
|
|
4
|
+
import { HM_OVERLAY_STAGE, HM_OVERLAY_SCOPE } from '@trismegisto/angular/overlay-stage';
|
|
4
5
|
import { HERMES_MESSAGES } from '@trismegisto/angular/i18n';
|
|
5
6
|
import { IconButtonComponent } from '@trismegisto/angular/icon-button';
|
|
6
7
|
import { ICON_TIMES, useHermesIcons } from '@trismegisto/angular/icon';
|
|
@@ -40,6 +41,13 @@ class DrawerComponent {
|
|
|
40
41
|
* se o foco estava nele, o foco volta à origem. `Esc` com o foco no painel fecha.
|
|
41
42
|
*/
|
|
42
43
|
pinned = input(false, { ...(ngDevMode ? { debugName: "pinned" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
44
|
+
/**
|
|
45
|
+
* Onde o painel aparece: `viewport` cobre a página inteira; `content` fica preso à área de conteúdo da tela (o palco
|
|
46
|
+
* `HM_OVERLAY_STAGE` que o layout fornece, ex.: o Spine, um por aba), com cabeçalho e menu livres: o fundo cobre só o
|
|
47
|
+
* conteúdo, só ele fica inerte, o `Esc` fecha e o `Tab` pode sair para o cabeçalho e o menu. Vazio: o escopo do
|
|
48
|
+
* injetor (`HM_OVERLAY_SCOPE`), senão `viewport`. Sem palco disponível, vale `viewport`. Não se aplica a `pinned`.
|
|
49
|
+
*/
|
|
50
|
+
scope = input(null, ...(ngDevMode ? [{ debugName: "scope" }] : /* istanbul ignore next */ []));
|
|
43
51
|
/** Catálogo de textos da lib, no idioma em uso (rótulo padrão do X). */
|
|
44
52
|
i18n = inject(HERMES_MESSAGES);
|
|
45
53
|
/** Nome acessível do X. Vazio usa `drawer.close` do catálogo. */
|
|
@@ -57,13 +65,28 @@ class DrawerComponent {
|
|
|
57
65
|
closed = output();
|
|
58
66
|
headingId = `hm-drawer-heading-${++sequence}`;
|
|
59
67
|
windowRef = viewChild('windowEl', ...(ngDevMode ? [{ debugName: "windowRef" }] : /* istanbul ignore next */ []));
|
|
68
|
+
rootRef = viewChild('rootEl', ...(ngDevMode ? [{ debugName: "rootRef" }] : /* istanbul ignore next */ []));
|
|
60
69
|
document = inject(DOCUMENT);
|
|
70
|
+
stage = inject(HM_OVERLAY_STAGE, { optional: true });
|
|
71
|
+
defaultScope = inject(HM_OVERLAY_SCOPE, { optional: true });
|
|
72
|
+
/** O palco em uso, quando o painel está preso à área de conteúdo; `null` = página inteira (ou fixado). */
|
|
73
|
+
stageElement() {
|
|
74
|
+
if (this.pinned() || (this.scope() ?? this.defaultScope ?? 'viewport') !== 'content')
|
|
75
|
+
return null;
|
|
76
|
+
return this.stage?.element() ?? null;
|
|
77
|
+
}
|
|
61
78
|
constructor() {
|
|
62
79
|
afterRenderEffect((onCleanup) => {
|
|
63
80
|
const win = this.windowRef()?.nativeElement;
|
|
64
81
|
if (!this.open() || !win)
|
|
65
82
|
return;
|
|
66
|
-
|
|
83
|
+
if (this.pinned()) {
|
|
84
|
+
onCleanup(this.activatePinned(win));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const stage = this.stageElement();
|
|
88
|
+
const root = this.rootRef()?.nativeElement;
|
|
89
|
+
onCleanup(stage && root ? activateStagedOverlay(root, win, stage, this.document) : activateOverlay(win, this.document));
|
|
67
90
|
});
|
|
68
91
|
}
|
|
69
92
|
closing = false;
|
|
@@ -91,8 +114,8 @@ class DrawerComponent {
|
|
|
91
114
|
void this.close();
|
|
92
115
|
}
|
|
93
116
|
onKeydown(event) {
|
|
94
|
-
if (this.pinned()) {
|
|
95
|
-
// Fixado não prende o Tab: só o Esc é tratado aqui.
|
|
117
|
+
if (this.pinned() || this.stageElement()) {
|
|
118
|
+
// Fixado ou preso ao conteúdo não prende o Tab: só o Esc é tratado aqui.
|
|
96
119
|
if (event.key === 'Escape') {
|
|
97
120
|
event.preventDefault();
|
|
98
121
|
void this.close();
|
|
@@ -113,12 +136,12 @@ class DrawerComponent {
|
|
|
113
136
|
};
|
|
114
137
|
}
|
|
115
138
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: DrawerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
116
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: DrawerComponent, isStandalone: true, selector: "hm-drawer", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: true, transformFunction: null }, heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, closeLabel: { classPropertyName: "closeLabel", publicName: "closeLabel", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdrop: { classPropertyName: "closeOnBackdrop", publicName: "closeOnBackdrop", isSignal: true, isRequired: false, transformFunction: null }, beforeClose: { classPropertyName: "beforeClose", publicName: "beforeClose", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", closed: "closed" }, viewQueries: [{ propertyName: "windowRef", first: true, predicate: ["windowEl"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (open()) {\n <div\n class=\"hm-drawer\"\n [class.hm-drawer--pinned]=\"pinned()\"\n [class.hm-drawer--start]=\"position() === 'start'\"\n [class.hm-drawer--bottom]=\"position() === 'bottom'\"\n (keydown)=\"onKeydown($event)\"\n >\n @if (!pinned()) {\n <div class=\"hm-drawer__backdrop\" aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n }\n\n <div\n #windowEl\n class=\"hm-drawer__window\"\n [class.hm-drawer__window--small]=\"size() === 'small'\"\n [class.hm-drawer__window--large]=\"size() === 'large'\"\n [class.hm-drawer__window--xlarge]=\"size() === 'xlarge'\"\n [class.hm-drawer__window--full]=\"size() === 'full'\"\n [attr.role]=\"pinned() ? 'complementary' : 'dialog'\"\n [attr.aria-modal]=\"pinned() ? null : 'true'\"\n [attr.aria-labelledby]=\"headingId\"\n tabindex=\"-1\"\n >\n <div class=\"hm-drawer__header\">\n <h2 class=\"hm-drawer__heading\" [id]=\"headingId\">{{ heading() }}</h2>\n\n @if (closable()) {\n <hm-icon-button\n [label]=\"(closeLabel() || i18n.drawer.close)\"\n icon=\"times\"\n emphasis=\"subtle\"\n (clicked)=\"close()\"\n />\n }\n </div>\n\n <div class=\"hm-drawer__body\">\n <ng-content />\n </div>\n\n <div class=\"hm-drawer__footer\">\n <ng-content select=\"[footer]\" />\n </div>\n </div>\n </div>\n}\n", dependencies: [{ kind: "component", type: IconButtonComponent, selector: "hm-icon-button", inputs: ["label", "icon", "solid", "iconDirection", "emphasis", "intent", "size", "disabled", "toggle", "pressed", "keyShortcuts"], outputs: ["pressedChange", "clicked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
139
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: DrawerComponent, isStandalone: true, selector: "hm-drawer", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: true, transformFunction: null }, heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, scope: { classPropertyName: "scope", publicName: "scope", isSignal: true, isRequired: false, transformFunction: null }, closeLabel: { classPropertyName: "closeLabel", publicName: "closeLabel", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdrop: { classPropertyName: "closeOnBackdrop", publicName: "closeOnBackdrop", isSignal: true, isRequired: false, transformFunction: null }, beforeClose: { classPropertyName: "beforeClose", publicName: "beforeClose", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", closed: "closed" }, viewQueries: [{ propertyName: "windowRef", first: true, predicate: ["windowEl"], descendants: true, isSignal: true }, { propertyName: "rootRef", first: true, predicate: ["rootEl"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (open()) {\n <div\n #rootEl\n class=\"hm-drawer\"\n [class.hm-drawer--content]=\"!!stageElement()\"\n [class.hm-drawer--pinned]=\"pinned()\"\n [class.hm-drawer--start]=\"position() === 'start'\"\n [class.hm-drawer--bottom]=\"position() === 'bottom'\"\n (keydown)=\"onKeydown($event)\"\n >\n @if (!pinned()) {\n <div class=\"hm-drawer__backdrop\" aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n }\n\n <div\n #windowEl\n class=\"hm-drawer__window\"\n [class.hm-drawer__window--small]=\"size() === 'small'\"\n [class.hm-drawer__window--large]=\"size() === 'large'\"\n [class.hm-drawer__window--xlarge]=\"size() === 'xlarge'\"\n [class.hm-drawer__window--full]=\"size() === 'full'\"\n [attr.role]=\"pinned() ? 'complementary' : 'dialog'\"\n [attr.aria-modal]=\"pinned() || stageElement() ? null : 'true'\"\n [attr.aria-labelledby]=\"headingId\"\n tabindex=\"-1\"\n >\n <div class=\"hm-drawer__header\">\n <h2 class=\"hm-drawer__heading\" [id]=\"headingId\">{{ heading() }}</h2>\n\n @if (closable()) {\n <hm-icon-button\n [label]=\"(closeLabel() || i18n.drawer.close)\"\n icon=\"times\"\n emphasis=\"subtle\"\n (clicked)=\"close()\"\n />\n }\n </div>\n\n <div class=\"hm-drawer__body\">\n <ng-content />\n </div>\n\n <div class=\"hm-drawer__footer\">\n <ng-content select=\"[footer]\" />\n </div>\n </div>\n </div>\n}\n", dependencies: [{ kind: "component", type: IconButtonComponent, selector: "hm-icon-button", inputs: ["label", "icon", "solid", "iconDirection", "emphasis", "intent", "size", "disabled", "toggle", "pressed", "keyShortcuts"], outputs: ["pressedChange", "clicked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
117
140
|
}
|
|
118
141
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: DrawerComponent, decorators: [{
|
|
119
142
|
type: Component,
|
|
120
|
-
args: [{ selector: 'hm-drawer', imports: [IconButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (open()) {\n <div\n class=\"hm-drawer\"\n [class.hm-drawer--pinned]=\"pinned()\"\n [class.hm-drawer--start]=\"position() === 'start'\"\n [class.hm-drawer--bottom]=\"position() === 'bottom'\"\n (keydown)=\"onKeydown($event)\"\n >\n @if (!pinned()) {\n <div class=\"hm-drawer__backdrop\" aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n }\n\n <div\n #windowEl\n class=\"hm-drawer__window\"\n [class.hm-drawer__window--small]=\"size() === 'small'\"\n [class.hm-drawer__window--large]=\"size() === 'large'\"\n [class.hm-drawer__window--xlarge]=\"size() === 'xlarge'\"\n [class.hm-drawer__window--full]=\"size() === 'full'\"\n [attr.role]=\"pinned() ? 'complementary' : 'dialog'\"\n [attr.aria-modal]=\"pinned() ? null : 'true'\"\n [attr.aria-labelledby]=\"headingId\"\n tabindex=\"-1\"\n >\n <div class=\"hm-drawer__header\">\n <h2 class=\"hm-drawer__heading\" [id]=\"headingId\">{{ heading() }}</h2>\n\n @if (closable()) {\n <hm-icon-button\n [label]=\"(closeLabel() || i18n.drawer.close)\"\n icon=\"times\"\n emphasis=\"subtle\"\n (clicked)=\"close()\"\n />\n }\n </div>\n\n <div class=\"hm-drawer__body\">\n <ng-content />\n </div>\n\n <div class=\"hm-drawer__footer\">\n <ng-content select=\"[footer]\" />\n </div>\n </div>\n </div>\n}\n" }]
|
|
121
|
-
}], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: true }] }, { type: i0.Output, args: ["openChange"] }], heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], closeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeLabel", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], closeOnBackdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnBackdrop", required: false }] }], beforeClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "beforeClose", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], windowRef: [{ type: i0.ViewChild, args: ['windowEl', { isSignal: true }] }] } });
|
|
143
|
+
args: [{ selector: 'hm-drawer', imports: [IconButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (open()) {\n <div\n #rootEl\n class=\"hm-drawer\"\n [class.hm-drawer--content]=\"!!stageElement()\"\n [class.hm-drawer--pinned]=\"pinned()\"\n [class.hm-drawer--start]=\"position() === 'start'\"\n [class.hm-drawer--bottom]=\"position() === 'bottom'\"\n (keydown)=\"onKeydown($event)\"\n >\n @if (!pinned()) {\n <div class=\"hm-drawer__backdrop\" aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n }\n\n <div\n #windowEl\n class=\"hm-drawer__window\"\n [class.hm-drawer__window--small]=\"size() === 'small'\"\n [class.hm-drawer__window--large]=\"size() === 'large'\"\n [class.hm-drawer__window--xlarge]=\"size() === 'xlarge'\"\n [class.hm-drawer__window--full]=\"size() === 'full'\"\n [attr.role]=\"pinned() ? 'complementary' : 'dialog'\"\n [attr.aria-modal]=\"pinned() || stageElement() ? null : 'true'\"\n [attr.aria-labelledby]=\"headingId\"\n tabindex=\"-1\"\n >\n <div class=\"hm-drawer__header\">\n <h2 class=\"hm-drawer__heading\" [id]=\"headingId\">{{ heading() }}</h2>\n\n @if (closable()) {\n <hm-icon-button\n [label]=\"(closeLabel() || i18n.drawer.close)\"\n icon=\"times\"\n emphasis=\"subtle\"\n (clicked)=\"close()\"\n />\n }\n </div>\n\n <div class=\"hm-drawer__body\">\n <ng-content />\n </div>\n\n <div class=\"hm-drawer__footer\">\n <ng-content select=\"[footer]\" />\n </div>\n </div>\n </div>\n}\n" }]
|
|
144
|
+
}], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: true }] }, { type: i0.Output, args: ["openChange"] }], heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], scope: [{ type: i0.Input, args: [{ isSignal: true, alias: "scope", required: false }] }], closeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeLabel", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], closeOnBackdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnBackdrop", required: false }] }], beforeClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "beforeClose", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], windowRef: [{ type: i0.ViewChild, args: ['windowEl', { isSignal: true }] }], rootRef: [{ type: i0.ViewChild, args: ['rootEl', { isSignal: true }] }] } });
|
|
122
145
|
|
|
123
146
|
// Ponto de import `@trismegisto/angular/drawer` (secundário do ng-packagr): o que o public-api e as outras pastas usam
|
|
124
147
|
// daqui. Gerado em 2026-10-03; ao criar arquivo público novo na pasta, acrescente a linha.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trismegisto-angular-drawer.mjs","sources":["../../src/drawer/icons.generated.ts","../../src/drawer/drawer.component.ts","../../src/drawer/drawer.component.html","../../src/drawer/index.ts","../../src/drawer/trismegisto-angular-drawer.ts"],"sourcesContent":["// GERADO por scripts/generate-internal-icons.mjs — não editar à mão.\n// Ícones que esta pasta usa por dentro; cada @Component/@Directive daqui os registra com\n// `readonly #icons = useHermesIcons(DRAWER_ICONS);`.\nimport type { RegisteredIcon } from '@trismegisto/icons';\nimport {\n ICON_TIMES,\n} from '@trismegisto/angular/icon';\n\nexport const DRAWER_ICONS: readonly RegisteredIcon[] = [ICON_TIMES];\n","import {\n afterRenderEffect,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n DOCUMENT,\n ElementRef,\n inject,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\nimport { ModalSize } from '@trismegisto/primitives/classes';\nimport { activateOverlay, handleOverlayKeydown } from '@trismegisto/primitives/focus';\nimport { HERMES_MESSAGES } from '@trismegisto/angular/i18n';\nimport { IconButtonComponent } from '@trismegisto/angular/icon-button';\nimport { useHermesIcons } from '@trismegisto/angular/icon';\nimport { DRAWER_ICONS } from './icons.generated';\n\n/**\n * Borda de onde o painel entra: `end` (padrão — a direita, em escrita da esquerda para a direita),\n * `start` (a borda oposta) ou `bottom` (folha que sobe de baixo, boa para celular).\n */\nexport type DrawerPosition = 'end' | 'start' | 'bottom';\n\nlet sequence = 0;\n\n/**\n * Painel que desliza de uma borda da tela, para conteúdo que não cabe bem num modal sem que a tela de\n * origem desapareça por completo (detalhe de um registro, formulário longo, filtros).\n *\n * **Modo padrão (sobreposição modal).** Comporta-se como o `hm-modal`: página inerte por trás, `Tab`\n * preso no painel, rolagem travada, foco devolvido ao fechar. Fecha pelo X, pelo `Esc` ou pelo\n * rodapé; o clique no fundo é ignorado.\n *\n * **Fixado (`pinned`).** O painel vira parte do layout, ao lado da página, e empurra o conteúdo em vez\n * de cobri-lo. Não há véu nem bloqueio: `Tab` e rolagem seguem livres pela página. O lugar dele no DOM\n * decide a ordem de leitura.\n */\n@Component({\n selector: 'hm-drawer',\n imports: [IconButtonComponent],\n templateUrl: './drawer.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DrawerComponent {\n readonly #icons = useHermesIcons(DRAWER_ICONS);\n /** Aberto ou fechado, em mão dupla (`[(open)]`); o X e o `Esc` gravam `false` sozinhos. */\n readonly open = model.required<boolean>();\n\n /** Título do cabeçalho e nome acessível do painel (do diálogo ou, fixado, da região). */\n readonly heading = input.required<string>();\n\n /**\n * Largura (painel lateral) ou altura máxima (folha inferior), com os mesmos valores do `hm-modal`:\n * `small`, `medium` (padrão), `large`, `xlarge` e `full`. `full` cobre a tela; fixado, ocupa toda a\n * largura do contêiner.\n */\n readonly size = input<ModalSize>('medium');\n /** Borda de entrada; ver `DrawerPosition`. */\n readonly position = input<DrawerPosition>('end');\n /**\n * Fixa o painel no layout: deixa de ser sobreposição e passa a dividir o espaço com a página, sem véu\n * nem bloqueio. Vira uma região complementar nomeada pelo título. Ao abrir recebe o foco; ao fechar,\n * se o foco estava nele, o foco volta à origem. `Esc` com o foco no painel fecha.\n */\n readonly pinned = input(false, { transform: booleanAttribute });\n /** Catálogo de textos da lib, no idioma em uso (rótulo padrão do X). */\n protected readonly i18n = inject(HERMES_MESSAGES);\n /** Nome acessível do X. Vazio usa `drawer.close` do catálogo. */\n readonly closeLabel = input('');\n /** `false` tira o X e ignora o `Esc`. */\n readonly closable = input(true, { transform: booleanAttribute });\n /** Clicar no véu fecha, passando pela mesma guarda do X (`closable=false` continua impedindo). Sem efeito se `pinned`. */\n readonly closeOnBackdrop = input(false, { transform: booleanAttribute });\n /**\n * Guarda consultada quando a pessoa tenta sair pelo X, pelo `Esc` ou pelo véu, igual à do `hm-modal`: `false`\n * (ou Promise com `false`) mantém aberto. Não é chamada quando o app muda `[(open)]`.\n */\n readonly beforeClose = input<(() => boolean | Promise<boolean>) | null>(null);\n\n /** Emitido depois que a pessoa fechou pelo X, pelo `Esc` ou pelo véu. */\n readonly closed = output<void>();\n\n protected readonly headingId = `hm-drawer-heading-${++sequence}`;\n\n private readonly windowRef = viewChild<ElementRef<HTMLElement>>('windowEl');\n private readonly document = inject(DOCUMENT);\n\n constructor() {\n afterRenderEffect((onCleanup) => {\n const win = this.windowRef()?.nativeElement;\n if (!this.open() || !win) return;\n onCleanup(this.pinned() ? this.activatePinned(win) : activateOverlay(win, this.document));\n });\n }\n\n private closing = false;\n\n protected async close(): Promise<void> {\n if (!this.open() || !this.closable() || this.closing) return;\n const guard = this.beforeClose();\n if (guard) {\n this.closing = true;\n try {\n if (!(await guard())) return;\n } finally {\n this.closing = false;\n }\n if (!this.open()) return;\n }\n this.open.set(false);\n this.closed.emit();\n }\n\n protected onBackdropClick(): void {\n if (this.closeOnBackdrop()) void this.close();\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.pinned()) {\n // Fixado não prende o Tab: só o Esc é tratado aqui.\n if (event.key === 'Escape') {\n event.preventDefault();\n void this.close();\n }\n return;\n }\n handleOverlayKeydown(event, this.windowRef()?.nativeElement, this.document, () => void this.close());\n }\n\n /** Foco ao abrir fixado; a limpeza devolve o foco à origem só se ele ainda estava no painel. */\n private activatePinned(win: HTMLElement): () => void {\n const trigger = this.document.activeElement;\n win.focus();\n return () => {\n const active = this.document.activeElement;\n const focusWasInside = !active || active === this.document.body || win.contains(active);\n if (focusWasInside && trigger instanceof HTMLElement && trigger.isConnected) trigger.focus();\n };\n }\n}\n","@if (open()) {\n <div\n class=\"hm-drawer\"\n [class.hm-drawer--pinned]=\"pinned()\"\n [class.hm-drawer--start]=\"position() === 'start'\"\n [class.hm-drawer--bottom]=\"position() === 'bottom'\"\n (keydown)=\"onKeydown($event)\"\n >\n @if (!pinned()) {\n <div class=\"hm-drawer__backdrop\" aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n }\n\n <div\n #windowEl\n class=\"hm-drawer__window\"\n [class.hm-drawer__window--small]=\"size() === 'small'\"\n [class.hm-drawer__window--large]=\"size() === 'large'\"\n [class.hm-drawer__window--xlarge]=\"size() === 'xlarge'\"\n [class.hm-drawer__window--full]=\"size() === 'full'\"\n [attr.role]=\"pinned() ? 'complementary' : 'dialog'\"\n [attr.aria-modal]=\"pinned() ? null : 'true'\"\n [attr.aria-labelledby]=\"headingId\"\n tabindex=\"-1\"\n >\n <div class=\"hm-drawer__header\">\n <h2 class=\"hm-drawer__heading\" [id]=\"headingId\">{{ heading() }}</h2>\n\n @if (closable()) {\n <hm-icon-button\n [label]=\"(closeLabel() || i18n.drawer.close)\"\n icon=\"times\"\n emphasis=\"subtle\"\n (clicked)=\"close()\"\n />\n }\n </div>\n\n <div class=\"hm-drawer__body\">\n <ng-content />\n </div>\n\n <div class=\"hm-drawer__footer\">\n <ng-content select=\"[footer]\" />\n </div>\n </div>\n </div>\n}\n","// Ponto de import `@trismegisto/angular/drawer` (secundário do ng-packagr): o que o public-api e as outras pastas usam\n// daqui. Gerado em 2026-10-03; ao criar arquivo público novo na pasta, acrescente a linha.\nexport * from './drawer.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQO,MAAM,YAAY,GAA8B,CAAC,UAAU,CAAC;;ACkBnE,IAAI,QAAQ,GAAG,CAAC;AAEhB;;;;;;;;;;;AAWG;MAOU,eAAe,CAAA;AACjB,IAAA,MAAM,GAAG,cAAc,CAAC,YAAY,CAAC;;AAErC,IAAA,IAAI,GAAG,KAAK,CAAC,QAAQ,0EAAW;;AAGhC,IAAA,OAAO,GAAG,KAAK,CAAC,QAAQ,6EAAU;AAE3C;;;;AAIG;AACM,IAAA,IAAI,GAAG,KAAK,CAAY,QAAQ,2EAAC;;AAEjC,IAAA,QAAQ,GAAG,KAAK,CAAiB,KAAK,+EAAC;AAChD;;;;AAIG;IACM,MAAM,GAAG,KAAK,CAAC,KAAK,8EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAE5C,IAAA,IAAI,GAAG,MAAM,CAAC,eAAe,CAAC;;AAExC,IAAA,UAAU,GAAG,KAAK,CAAC,EAAE,iFAAC;;IAEtB,QAAQ,GAAG,KAAK,CAAC,IAAI,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAEvD,eAAe,GAAG,KAAK,CAAC,KAAK,uFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AACxE;;;AAGG;AACM,IAAA,WAAW,GAAG,KAAK,CAA4C,IAAI,kFAAC;;IAGpE,MAAM,GAAG,MAAM,EAAQ;AAEb,IAAA,SAAS,GAAG,CAAA,kBAAA,EAAqB,EAAE,QAAQ,EAAE;AAE/C,IAAA,SAAS,GAAG,SAAS,CAA0B,UAAU,gFAAC;AAC1D,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAE5C,IAAA,WAAA,GAAA;AACE,QAAA,iBAAiB,CAAC,CAAC,SAAS,KAAI;YAC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,IAAA,EAAA,WAAA,EAAA,IAAA,EDLY,mBAAmB,EAAA,QAAA,EAAA,gBAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,EAAA,eAAA,EAAA,UAAA,EAAA,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,QAAA,EAAA,SAAA,EAAA,cAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAIlB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAN3B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,WACZ,CAAC,mBAAmB,CAAC,EAAA,eAAA,EAEb,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,67CAAA,EAAA;6hCA2CiB,UAAU,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEvF5E;AACA;;ACDA;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"trismegisto-angular-drawer.mjs","sources":["../../src/drawer/icons.generated.ts","../../src/drawer/drawer.component.ts","../../src/drawer/drawer.component.html","../../src/drawer/index.ts","../../src/drawer/trismegisto-angular-drawer.ts"],"sourcesContent":["// GERADO por scripts/generate-internal-icons.mjs — não editar à mão.\n// Ícones que esta pasta usa por dentro; cada @Component/@Directive daqui os registra com\n// `readonly #icons = useHermesIcons(DRAWER_ICONS);`.\nimport type { RegisteredIcon } from '@trismegisto/icons';\nimport {\n ICON_TIMES,\n} from '@trismegisto/angular/icon';\n\nexport const DRAWER_ICONS: readonly RegisteredIcon[] = [ICON_TIMES];\n","import {\n afterRenderEffect,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n DOCUMENT,\n ElementRef,\n inject,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\nimport { ModalSize } from '@trismegisto/primitives/classes';\nimport { activateOverlay, activateStagedOverlay, handleOverlayKeydown } from '@trismegisto/primitives/focus';\nimport { HM_OVERLAY_SCOPE, HM_OVERLAY_STAGE, HermesOverlayScope } from '@trismegisto/angular/overlay-stage';\nimport { HERMES_MESSAGES } from '@trismegisto/angular/i18n';\nimport { IconButtonComponent } from '@trismegisto/angular/icon-button';\nimport { useHermesIcons } from '@trismegisto/angular/icon';\nimport { DRAWER_ICONS } from './icons.generated';\n\n/**\n * Borda de onde o painel entra: `end` (padrão — a direita, em escrita da esquerda para a direita),\n * `start` (a borda oposta) ou `bottom` (folha que sobe de baixo, boa para celular).\n */\nexport type DrawerPosition = 'end' | 'start' | 'bottom';\n\nlet sequence = 0;\n\n/**\n * Painel que desliza de uma borda da tela, para conteúdo que não cabe bem num modal sem que a tela de\n * origem desapareça por completo (detalhe de um registro, formulário longo, filtros).\n *\n * **Modo padrão (sobreposição modal).** Comporta-se como o `hm-modal`: página inerte por trás, `Tab`\n * preso no painel, rolagem travada, foco devolvido ao fechar. Fecha pelo X, pelo `Esc` ou pelo\n * rodapé; o clique no fundo é ignorado.\n *\n * **Fixado (`pinned`).** O painel vira parte do layout, ao lado da página, e empurra o conteúdo em vez\n * de cobri-lo. Não há véu nem bloqueio: `Tab` e rolagem seguem livres pela página. O lugar dele no DOM\n * decide a ordem de leitura.\n */\n@Component({\n selector: 'hm-drawer',\n imports: [IconButtonComponent],\n templateUrl: './drawer.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DrawerComponent {\n readonly #icons = useHermesIcons(DRAWER_ICONS);\n /** Aberto ou fechado, em mão dupla (`[(open)]`); o X e o `Esc` gravam `false` sozinhos. */\n readonly open = model.required<boolean>();\n\n /** Título do cabeçalho e nome acessível do painel (do diálogo ou, fixado, da região). */\n readonly heading = input.required<string>();\n\n /**\n * Largura (painel lateral) ou altura máxima (folha inferior), com os mesmos valores do `hm-modal`:\n * `small`, `medium` (padrão), `large`, `xlarge` e `full`. `full` cobre a tela; fixado, ocupa toda a\n * largura do contêiner.\n */\n readonly size = input<ModalSize>('medium');\n /** Borda de entrada; ver `DrawerPosition`. */\n readonly position = input<DrawerPosition>('end');\n /**\n * Fixa o painel no layout: deixa de ser sobreposição e passa a dividir o espaço com a página, sem véu\n * nem bloqueio. Vira uma região complementar nomeada pelo título. Ao abrir recebe o foco; ao fechar,\n * se o foco estava nele, o foco volta à origem. `Esc` com o foco no painel fecha.\n */\n readonly pinned = input(false, { transform: booleanAttribute });\n /**\n * Onde o painel aparece: `viewport` cobre a página inteira; `content` fica preso à área de conteúdo da tela (o palco\n * `HM_OVERLAY_STAGE` que o layout fornece, ex.: o Spine, um por aba), com cabeçalho e menu livres: o fundo cobre só o\n * conteúdo, só ele fica inerte, o `Esc` fecha e o `Tab` pode sair para o cabeçalho e o menu. Vazio: o escopo do\n * injetor (`HM_OVERLAY_SCOPE`), senão `viewport`. Sem palco disponível, vale `viewport`. Não se aplica a `pinned`.\n */\n readonly scope = input<HermesOverlayScope | null>(null);\n /** Catálogo de textos da lib, no idioma em uso (rótulo padrão do X). */\n protected readonly i18n = inject(HERMES_MESSAGES);\n /** Nome acessível do X. Vazio usa `drawer.close` do catálogo. */\n readonly closeLabel = input('');\n /** `false` tira o X e ignora o `Esc`. */\n readonly closable = input(true, { transform: booleanAttribute });\n /** Clicar no véu fecha, passando pela mesma guarda do X (`closable=false` continua impedindo). Sem efeito se `pinned`. */\n readonly closeOnBackdrop = input(false, { transform: booleanAttribute });\n /**\n * Guarda consultada quando a pessoa tenta sair pelo X, pelo `Esc` ou pelo véu, igual à do `hm-modal`: `false`\n * (ou Promise com `false`) mantém aberto. Não é chamada quando o app muda `[(open)]`.\n */\n readonly beforeClose = input<(() => boolean | Promise<boolean>) | null>(null);\n\n /** Emitido depois que a pessoa fechou pelo X, pelo `Esc` ou pelo véu. */\n readonly closed = output<void>();\n\n protected readonly headingId = `hm-drawer-heading-${++sequence}`;\n\n private readonly windowRef = viewChild<ElementRef<HTMLElement>>('windowEl');\n private readonly rootRef = viewChild<ElementRef<HTMLElement>>('rootEl');\n private readonly document = inject(DOCUMENT);\n private readonly stage = inject(HM_OVERLAY_STAGE, { optional: true });\n private readonly defaultScope = inject(HM_OVERLAY_SCOPE, { optional: true });\n\n /** O palco em uso, quando o painel está preso à área de conteúdo; `null` = página inteira (ou fixado). */\n protected stageElement(): HTMLElement | null {\n if (this.pinned() || (this.scope() ?? this.defaultScope ?? 'viewport') !== 'content') return null;\n return this.stage?.element() ?? null;\n }\n\n constructor() {\n afterRenderEffect((onCleanup) => {\n const win = this.windowRef()?.nativeElement;\n if (!this.open() || !win) return;\n if (this.pinned()) {\n onCleanup(this.activatePinned(win));\n return;\n }\n const stage = this.stageElement();\n const root = this.rootRef()?.nativeElement;\n onCleanup(stage && root ? activateStagedOverlay(root, win, stage, this.document) : activateOverlay(win, this.document));\n });\n }\n\n private closing = false;\n\n protected async close(): Promise<void> {\n if (!this.open() || !this.closable() || this.closing) return;\n const guard = this.beforeClose();\n if (guard) {\n this.closing = true;\n try {\n if (!(await guard())) return;\n } finally {\n this.closing = false;\n }\n if (!this.open()) return;\n }\n this.open.set(false);\n this.closed.emit();\n }\n\n protected onBackdropClick(): void {\n if (this.closeOnBackdrop()) void this.close();\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.pinned() || this.stageElement()) {\n // Fixado ou preso ao conteúdo não prende o Tab: só o Esc é tratado aqui.\n if (event.key === 'Escape') {\n event.preventDefault();\n void this.close();\n }\n return;\n }\n handleOverlayKeydown(event, this.windowRef()?.nativeElement, this.document, () => void this.close());\n }\n\n /** Foco ao abrir fixado; a limpeza devolve o foco à origem só se ele ainda estava no painel. */\n private activatePinned(win: HTMLElement): () => void {\n const trigger = this.document.activeElement;\n win.focus();\n return () => {\n const active = this.document.activeElement;\n const focusWasInside = !active || active === this.document.body || win.contains(active);\n if (focusWasInside && trigger instanceof HTMLElement && trigger.isConnected) trigger.focus();\n };\n }\n}\n","@if (open()) {\n <div\n #rootEl\n class=\"hm-drawer\"\n [class.hm-drawer--content]=\"!!stageElement()\"\n [class.hm-drawer--pinned]=\"pinned()\"\n [class.hm-drawer--start]=\"position() === 'start'\"\n [class.hm-drawer--bottom]=\"position() === 'bottom'\"\n (keydown)=\"onKeydown($event)\"\n >\n @if (!pinned()) {\n <div class=\"hm-drawer__backdrop\" aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n }\n\n <div\n #windowEl\n class=\"hm-drawer__window\"\n [class.hm-drawer__window--small]=\"size() === 'small'\"\n [class.hm-drawer__window--large]=\"size() === 'large'\"\n [class.hm-drawer__window--xlarge]=\"size() === 'xlarge'\"\n [class.hm-drawer__window--full]=\"size() === 'full'\"\n [attr.role]=\"pinned() ? 'complementary' : 'dialog'\"\n [attr.aria-modal]=\"pinned() || stageElement() ? null : 'true'\"\n [attr.aria-labelledby]=\"headingId\"\n tabindex=\"-1\"\n >\n <div class=\"hm-drawer__header\">\n <h2 class=\"hm-drawer__heading\" [id]=\"headingId\">{{ heading() }}</h2>\n\n @if (closable()) {\n <hm-icon-button\n [label]=\"(closeLabel() || i18n.drawer.close)\"\n icon=\"times\"\n emphasis=\"subtle\"\n (clicked)=\"close()\"\n />\n }\n </div>\n\n <div class=\"hm-drawer__body\">\n <ng-content />\n </div>\n\n <div class=\"hm-drawer__footer\">\n <ng-content select=\"[footer]\" />\n </div>\n </div>\n </div>\n}\n","// Ponto de import `@trismegisto/angular/drawer` (secundário do ng-packagr): o que o public-api e as outras pastas usam\n// daqui. Gerado em 2026-10-03; ao criar arquivo público novo na pasta, acrescente a linha.\nexport * from './drawer.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAQO,MAAM,YAAY,GAA8B,CAAC,UAAU,CAAC;;ACmBnE,IAAI,QAAQ,GAAG,CAAC;AAEhB;;;;;;;;;;;AAWG;MAOU,eAAe,CAAA;AACjB,IAAA,MAAM,GAAG,cAAc,CAAC,YAAY,CAAC;;AAErC,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@angular/core';
|
|
3
3
|
import { signal, inject, DOCUMENT, PLATFORM_ID, DestroyRef, Injectable, model, input, booleanAttribute, output, viewChild, computed, effect, untracked, afterRenderEffect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
-
import { createFloatingStack, FLOATING_RESIZE_EDGES, maximizedFloatingRect, clampFloatingRect, serializeFloatingWindow, moveFloatingRect, resizeFloatingRect, floatingKeyAction, applyFloatingKeyAction, parseFloatingWindow, initialFloatingRect } from '@trismegisto/primitives/floating-window';
|
|
4
|
+
import { createFloatingStack, FLOATING_RESIZE_EDGES, maximizedFloatingRect, clampFloatingRect, serializeFloatingWindow, moveFloatingRect, resizeFloatingRect, floatingSheetKeyAction, floatingKeyAction, applyFloatingKeyAction, floatingSheetGesture, parseFloatingWindow, initialFloatingRect } from '@trismegisto/primitives/floating-window';
|
|
5
5
|
import { FOCUSABLE_SELECTOR } from '@trismegisto/primitives/focus';
|
|
6
6
|
import { formatMessage } from '@trismegisto/primitives/i18n';
|
|
7
7
|
import { HERMES_MESSAGES } from '@trismegisto/angular/i18n';
|
|
@@ -170,6 +170,11 @@ let sequence = 0;
|
|
|
170
170
|
* setas redimensiona (com `Ctrl`, passo grande) — alternativa ao arrasto (WCAG 2.5.7), com anúncio
|
|
171
171
|
* em região viva; `F6`/`Shift`+`F6` alterna entre as janelas abertas e a página. `Esc` não fecha
|
|
172
172
|
* por padrão (janela não modal; `closeOnEscape` liga).
|
|
173
|
+
*
|
|
174
|
+
* **Tela estreita** (`sheetBelow`): abaixo dessa largura (px) a janela vira uma **folha inferior** não modal —
|
|
175
|
+
* largura toda, presa embaixo (respeita a área segura), sem cobrir o cabeçalho, com uma barra para arrastar:
|
|
176
|
+
* para baixo recolhe (e, recolhida, fecha), para cima abre, tocar alterna; `Alt`+`↓`/`↑` fazem o mesmo pelo
|
|
177
|
+
* teclado. Sem redimensionar nem maximizar. Ao voltar à tela larga, ela volta a flutuar onde estava.
|
|
173
178
|
*/
|
|
174
179
|
class FloatingWindowComponent {
|
|
175
180
|
#icons = useHermesIcons(FLOATING_WINDOW_ICONS);
|
|
@@ -199,6 +204,8 @@ class FloatingWindowComponent {
|
|
|
199
204
|
closeOnEscape = input(false, { ...(ngDevMode ? { debugName: "closeOnEscape" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
200
205
|
/** Leva o foco para dentro ao abrir. */
|
|
201
206
|
autoFocus = input(true, { ...(ngDevMode ? { debugName: "autoFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
207
|
+
/** Abaixo desta largura da tela (px), a janela vira folha inferior (ver acima). `0` = nunca. */
|
|
208
|
+
sheetBelow = input(0, ...(ngDevMode ? [{ debugName: "sheetBelow" }] : /* istanbul ignore next */ []));
|
|
202
209
|
/** Chave do `localStorage` para lembrar posição, tamanho e estado. Vazio = não persiste. */
|
|
203
210
|
storageKey = input('', ...(ngDevMode ? [{ debugName: "storageKey" }] : /* istanbul ignore next */ []));
|
|
204
211
|
/** Geometria atual (px). Two-way; `null` = posição inicial automática. */
|
|
@@ -213,6 +220,8 @@ class FloatingWindowComponent {
|
|
|
213
220
|
hintId = `${this.id}-hint`;
|
|
214
221
|
edges = FLOATING_RESIZE_EDGES;
|
|
215
222
|
dragging = signal(false, ...(ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []));
|
|
223
|
+
/** Deslocamento vertical (px) da folha durante o arrasto da barra (só visual; o estado muda ao soltar). */
|
|
224
|
+
sheetOffset = signal(0, ...(ngDevMode ? [{ debugName: "sheetOffset" }] : /* istanbul ignore next */ []));
|
|
216
225
|
announcement = signal('', ...(ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []));
|
|
217
226
|
stack = inject(HermesOverlayStack);
|
|
218
227
|
document = inject(DOCUMENT);
|
|
@@ -232,7 +241,9 @@ class FloatingWindowComponent {
|
|
|
232
241
|
top = computed(() => this.stack.isTop(this.id), ...(ngDevMode ? [{ debugName: "top" }] : /* istanbul ignore next */ []));
|
|
233
242
|
minimized = computed(() => this.state() === 'minimized', ...(ngDevMode ? [{ debugName: "minimized" }] : /* istanbul ignore next */ []));
|
|
234
243
|
maximized = computed(() => this.state() === 'maximized', ...(ngDevMode ? [{ debugName: "maximized" }] : /* istanbul ignore next */ []));
|
|
235
|
-
|
|
244
|
+
/** Folha inferior: `sheetBelow` ligado e a tela mais estreita que ele. */
|
|
245
|
+
sheet = computed(() => this.sheetBelow() > 0 && this.viewport().width < this.sheetBelow(), ...(ngDevMode ? [{ debugName: "sheet" }] : /* istanbul ignore next */ []));
|
|
246
|
+
showHandles = computed(() => this.resizable() && this.state() === 'normal' && !this.sheet(), ...(ngDevMode ? [{ debugName: "showHandles" }] : /* istanbul ignore next */ []));
|
|
236
247
|
constructor() {
|
|
237
248
|
const destroyRef = inject(DestroyRef);
|
|
238
249
|
// Abrir: geometria salva (ou inicial), registro na pilha; fechar: sai da pilha.
|
|
@@ -299,7 +310,7 @@ class FloatingWindowComponent {
|
|
|
299
310
|
this.setState(this.state() === 'minimized' ? 'normal' : 'minimized');
|
|
300
311
|
}
|
|
301
312
|
toggleMaximize() {
|
|
302
|
-
if (!this.maximizable())
|
|
313
|
+
if (!this.maximizable() || this.sheet())
|
|
303
314
|
return;
|
|
304
315
|
this.setState(this.state() === 'maximized' ? 'normal' : 'maximized');
|
|
305
316
|
}
|
|
@@ -316,6 +327,11 @@ class FloatingWindowComponent {
|
|
|
316
327
|
}
|
|
317
328
|
/** Arrastar pela barra de título (os botões dela não arrastam). */
|
|
318
329
|
startMove(event) {
|
|
330
|
+
if (this.sheet()) {
|
|
331
|
+
if (event.button === 0 && !this.isControl(event.target))
|
|
332
|
+
this.sheetGesture(event);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
319
335
|
if (!this.movable() || this.state() === 'maximized' || event.button !== 0 || this.isControl(event.target))
|
|
320
336
|
return;
|
|
321
337
|
this.gesture(event, (start, dx, dy) => moveFloatingRect(start, dx, dy, this.viewport(), this.limits()));
|
|
@@ -331,6 +347,14 @@ class FloatingWindowComponent {
|
|
|
331
347
|
this.close();
|
|
332
348
|
return;
|
|
333
349
|
}
|
|
350
|
+
if (this.sheet()) {
|
|
351
|
+
const sheetAction = floatingSheetKeyAction(this.state(), event);
|
|
352
|
+
if (sheetAction) {
|
|
353
|
+
event.preventDefault();
|
|
354
|
+
this.setState(sheetAction === 'minimize' ? 'minimized' : 'normal');
|
|
355
|
+
}
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
334
358
|
const action = floatingKeyAction(event);
|
|
335
359
|
if (!action || this.state() === 'maximized' || (action.kind !== 'move' && (!this.resizable() || this.minimized())))
|
|
336
360
|
return;
|
|
@@ -363,6 +387,41 @@ class FloatingWindowComponent {
|
|
|
363
387
|
target.addEventListener('pointerup', end);
|
|
364
388
|
target.addEventListener('pointercancel', end);
|
|
365
389
|
}
|
|
390
|
+
/** Arrasto vertical da barra da folha: acompanha o dedo e, ao soltar, recolhe, abre, fecha ou alterna. */
|
|
391
|
+
sheetGesture(event) {
|
|
392
|
+
const target = event.currentTarget;
|
|
393
|
+
const originY = event.clientY;
|
|
394
|
+
event.preventDefault();
|
|
395
|
+
target.setPointerCapture?.(event.pointerId);
|
|
396
|
+
this.dragging.set(true);
|
|
397
|
+
const minimized = this.minimized();
|
|
398
|
+
const move = (e) => {
|
|
399
|
+
const dy = e.clientY - originY;
|
|
400
|
+
// Aberta só desce (puxar para cima não tem para onde ir); recolhida sobe um pouco, como dica.
|
|
401
|
+
this.sheetOffset.set(minimized ? Math.max(dy, -48) : Math.max(dy, 0));
|
|
402
|
+
};
|
|
403
|
+
const end = (e) => {
|
|
404
|
+
target.removeEventListener('pointermove', move);
|
|
405
|
+
target.removeEventListener('pointerup', end);
|
|
406
|
+
target.removeEventListener('pointercancel', end);
|
|
407
|
+
this.dragging.set(false);
|
|
408
|
+
this.sheetOffset.set(0);
|
|
409
|
+
if (e.type === 'pointercancel')
|
|
410
|
+
return;
|
|
411
|
+
const action = floatingSheetGesture(this.state(), e.clientY - originY, this.closable());
|
|
412
|
+
if (action === 'close')
|
|
413
|
+
this.close();
|
|
414
|
+
else if (action === 'minimize')
|
|
415
|
+
this.setState('minimized');
|
|
416
|
+
else if (action === 'restore')
|
|
417
|
+
this.setState('normal');
|
|
418
|
+
else if (action === 'toggle' && this.minimizable())
|
|
419
|
+
this.toggleMinimize();
|
|
420
|
+
};
|
|
421
|
+
target.addEventListener('pointermove', move);
|
|
422
|
+
target.addEventListener('pointerup', end);
|
|
423
|
+
target.addEventListener('pointercancel', end);
|
|
424
|
+
}
|
|
366
425
|
setState(next) {
|
|
367
426
|
if (this.state() === 'normal' || !this.rect())
|
|
368
427
|
this.rect.set(this.box());
|
|
@@ -418,12 +477,12 @@ class FloatingWindowComponent {
|
|
|
418
477
|
return { width: view?.innerWidth ?? 1024, height: view?.innerHeight ?? 768 };
|
|
419
478
|
}
|
|
420
479
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: FloatingWindowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
421
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: FloatingWindowComponent, isStandalone: true, selector: "hm-floating-window", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: true, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, x: { classPropertyName: "x", publicName: "x", isSignal: true, isRequired: false, transformFunction: null }, y: { classPropertyName: "y", publicName: "y", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, movable: { classPropertyName: "movable", publicName: "movable", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, minimizable: { classPropertyName: "minimizable", publicName: "minimizable", isSignal: true, isRequired: false, transformFunction: null }, maximizable: { classPropertyName: "maximizable", publicName: "maximizable", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, autoFocus: { classPropertyName: "autoFocus", publicName: "autoFocus", isSignal: true, isRequired: false, transformFunction: null }, storageKey: { classPropertyName: "storageKey", publicName: "storageKey", isSignal: true, isRequired: false, transformFunction: null }, rect: { classPropertyName: "rect", publicName: "rect", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", rect: "rectChange", state: "stateChange", closed: "closed" }, viewQueries: [{ propertyName: "windowRef", first: true, predicate: ["windowEl"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (open()) {\n <section\n #windowEl\n class=\"hm-floating-window\"\n [class.hm-floating-window--minimized]=\"minimized()\"\n [class.hm-floating-window--maximized]=\"maximized()\"\n [class.hm-floating-window--dragging]=\"dragging()\"\n [class.hm-floating-window--top]=\"top()\"\n [id]=\"id\"\n role=\"dialog\"\n aria-modal=\"false\"\n [attr.aria-labelledby]=\"headingId\"\n [attr.aria-describedby]=\"hintId\"\n tabindex=\"-1\"\n [style.left.px]=\"box().x\"\n [style.top.px]=\"box().y\"\n [style.width.px]=\"box().width\"\n [style.height.px]=\"minimized() ? null : box().height\"\n [style.--hm-floating-window-layer]=\"layer()\"\n (pointerdown)=\"bringToFront()\"\n (focusin)=\"bringToFront()\"\n (keydown)=\"onKeydown($event)\"\n >\n <!-- A barra de t\u00EDtulo \u00E9 a al\u00E7a de arrastar (Pointer Events: mouse, caneta e toque). Os bot\u00F5es\n dela n\u00E3o arrastam; dois cliques maximizam/restauram. -->\n <header\n class=\"hm-floating-window__titlebar\"\n [class.hm-floating-window__titlebar--movable]=\"movable() && !maximized()\"\n (pointerdown)=\"startMove($event)\"\n (dblclick)=\"onTitleDoubleClick($event)\"\n >\n @if (icon()) {\n <hm-icon class=\"hm-floating-window__icon\" [shape]=\"icon()\" />\n }\n <h2 class=\"hm-floating-window__heading\" [id]=\"headingId\">{{ heading() }}</h2>\n <div class=\"hm-floating-window__actions\">\n <ng-content select=\"[actions]\" />\n @if (minimizable()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n [icon]=\"minimized() ? 'window-restore' : 'window-min'\"\n [label]=\"minimized() ? i18n.floatingWindow.restore : i18n.floatingWindow.minimize\"\n (clicked)=\"toggleMinimize()\"\n />\n }\n @if (maximizable() && !minimized()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n [icon]=\"maximized() ? 'window-restore' : 'window-max'\"\n [label]=\"maximized() ? i18n.floatingWindow.restore : i18n.floatingWindow.maximize\"\n (clicked)=\"toggleMaximize()\"\n />\n }\n @if (closable()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n icon=\"times\"\n [label]=\"i18n.floatingWindow.close\"\n (clicked)=\"close()\"\n />\n }\n </div>\n </header>\n\n <div class=\"hm-floating-window__body\" [hidden]=\"minimized()\">\n <ng-content />\n </div>\n\n <div class=\"hm-floating-window__footer\" [hidden]=\"minimized()\">\n <ng-content select=\"[footer]\" />\n </div>\n\n <!-- Al\u00E7as de redimensionar: s\u00F3 ponteiro (o teclado usa Alt+Shift+setas, descrito na dica). -->\n @if (showHandles()) {\n @for (edge of edges; track edge) {\n <div\n class=\"hm-floating-window__handle hm-floating-window__handle--{{ edge }}\"\n aria-hidden=\"true\"\n (pointerdown)=\"startResize($event, edge)\"\n ></div>\n }\n }\n\n <span class=\"hm-visually-hidden\" [id]=\"hintId\">{{ i18n.floatingWindow.keyboardHint }}</span>\n <span class=\"hm-visually-hidden\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</span>\n </section>\n}\n", dependencies: [{ kind: "component", type: IconButtonComponent, selector: "hm-icon-button", inputs: ["label", "icon", "solid", "iconDirection", "emphasis", "intent", "size", "disabled", "toggle", "pressed", "keyShortcuts"], outputs: ["pressedChange", "clicked"] }, { kind: "component", type: IconComponent, selector: "hm-icon", inputs: ["shape", "direction", "size", "solid", "badge", "status", "flip", "inverse", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
480
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: FloatingWindowComponent, isStandalone: true, selector: "hm-floating-window", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: true, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, x: { classPropertyName: "x", publicName: "x", isSignal: true, isRequired: false, transformFunction: null }, y: { classPropertyName: "y", publicName: "y", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, movable: { classPropertyName: "movable", publicName: "movable", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, minimizable: { classPropertyName: "minimizable", publicName: "minimizable", isSignal: true, isRequired: false, transformFunction: null }, maximizable: { classPropertyName: "maximizable", publicName: "maximizable", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, autoFocus: { classPropertyName: "autoFocus", publicName: "autoFocus", isSignal: true, isRequired: false, transformFunction: null }, sheetBelow: { classPropertyName: "sheetBelow", publicName: "sheetBelow", isSignal: true, isRequired: false, transformFunction: null }, storageKey: { classPropertyName: "storageKey", publicName: "storageKey", isSignal: true, isRequired: false, transformFunction: null }, rect: { classPropertyName: "rect", publicName: "rect", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", rect: "rectChange", state: "stateChange", closed: "closed" }, viewQueries: [{ propertyName: "windowRef", first: true, predicate: ["windowEl"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (open()) {\n <section\n #windowEl\n class=\"hm-floating-window\"\n [class.hm-floating-window--minimized]=\"minimized()\"\n [class.hm-floating-window--maximized]=\"maximized()\"\n [class.hm-floating-window--dragging]=\"dragging()\"\n [class.hm-floating-window--sheet]=\"sheet()\"\n [class.hm-floating-window--top]=\"top()\"\n [id]=\"id\"\n role=\"dialog\"\n aria-modal=\"false\"\n [attr.aria-labelledby]=\"headingId\"\n [attr.aria-describedby]=\"hintId\"\n tabindex=\"-1\"\n [style.left.px]=\"sheet() ? null : box().x\"\n [style.top.px]=\"sheet() ? null : box().y\"\n [style.width.px]=\"sheet() ? null : box().width\"\n [style.height.px]=\"minimized() || sheet() ? null : box().height\"\n [style.translate]=\"sheet() && sheetOffset() ? '0 ' + sheetOffset() + 'px' : null\"\n [style.--hm-floating-window-layer]=\"layer()\"\n (pointerdown)=\"bringToFront()\"\n (focusin)=\"bringToFront()\"\n (keydown)=\"onKeydown($event)\"\n >\n <!-- A barra de t\u00EDtulo \u00E9 a al\u00E7a de arrastar (Pointer Events: mouse, caneta e toque). Os bot\u00F5es\n dela n\u00E3o arrastam; dois cliques maximizam/restauram. -->\n <header\n class=\"hm-floating-window__titlebar\"\n [class.hm-floating-window__titlebar--movable]=\"sheet() || (movable() && !maximized())\"\n (pointerdown)=\"startMove($event)\"\n (dblclick)=\"onTitleDoubleClick($event)\"\n >\n @if (sheet()) {\n <!-- Barra de arrastar da folha (decorativa: o gesto tem alternativa no bot\u00E3o recolher e em Alt+setas). -->\n <span class=\"hm-floating-window__grabber\" aria-hidden=\"true\"></span>\n }\n @if (icon()) {\n <hm-icon class=\"hm-floating-window__icon\" [shape]=\"icon()\" />\n }\n <h2 class=\"hm-floating-window__heading\" [id]=\"headingId\">{{ heading() }}</h2>\n <div class=\"hm-floating-window__actions\">\n <ng-content select=\"[actions]\" />\n @if (minimizable()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n [icon]=\"minimized() ? 'window-restore' : 'window-min'\"\n [label]=\"minimized() ? i18n.floatingWindow.restore : i18n.floatingWindow.minimize\"\n (clicked)=\"toggleMinimize()\"\n />\n }\n @if (maximizable() && !minimized() && !sheet()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n [icon]=\"maximized() ? 'window-restore' : 'window-max'\"\n [label]=\"maximized() ? i18n.floatingWindow.restore : i18n.floatingWindow.maximize\"\n (clicked)=\"toggleMaximize()\"\n />\n }\n @if (closable()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n icon=\"times\"\n [label]=\"i18n.floatingWindow.close\"\n (clicked)=\"close()\"\n />\n }\n </div>\n </header>\n\n <div class=\"hm-floating-window__body\" [hidden]=\"minimized()\">\n <ng-content />\n </div>\n\n <div class=\"hm-floating-window__footer\" [hidden]=\"minimized()\">\n <ng-content select=\"[footer]\" />\n </div>\n\n <!-- Al\u00E7as de redimensionar: s\u00F3 ponteiro (o teclado usa Alt+Shift+setas, descrito na dica). -->\n @if (showHandles()) {\n @for (edge of edges; track edge) {\n <div\n class=\"hm-floating-window__handle hm-floating-window__handle--{{ edge }}\"\n aria-hidden=\"true\"\n (pointerdown)=\"startResize($event, edge)\"\n ></div>\n }\n }\n\n <span class=\"hm-visually-hidden\" [id]=\"hintId\">{{ sheet() ? (i18n.floatingWindow.sheetHint || i18n.floatingWindow.keyboardHint) : i18n.floatingWindow.keyboardHint }}</span>\n <span class=\"hm-visually-hidden\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</span>\n </section>\n}\n", dependencies: [{ kind: "component", type: IconButtonComponent, selector: "hm-icon-button", inputs: ["label", "icon", "solid", "iconDirection", "emphasis", "intent", "size", "disabled", "toggle", "pressed", "keyShortcuts"], outputs: ["pressedChange", "clicked"] }, { kind: "component", type: IconComponent, selector: "hm-icon", inputs: ["shape", "direction", "size", "solid", "badge", "status", "flip", "inverse", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
422
481
|
}
|
|
423
482
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: FloatingWindowComponent, decorators: [{
|
|
424
483
|
type: Component,
|
|
425
|
-
args: [{ selector: 'hm-floating-window', imports: [IconButtonComponent, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (open()) {\n <section\n #windowEl\n class=\"hm-floating-window\"\n [class.hm-floating-window--minimized]=\"minimized()\"\n [class.hm-floating-window--maximized]=\"maximized()\"\n [class.hm-floating-window--dragging]=\"dragging()\"\n [class.hm-floating-window--top]=\"top()\"\n [id]=\"id\"\n role=\"dialog\"\n aria-modal=\"false\"\n [attr.aria-labelledby]=\"headingId\"\n [attr.aria-describedby]=\"hintId\"\n tabindex=\"-1\"\n [style.left.px]=\"box().x\"\n [style.top.px]=\"box().y\"\n [style.width.px]=\"box().width\"\n [style.height.px]=\"minimized() ? null : box().height\"\n [style.--hm-floating-window-layer]=\"layer()\"\n (pointerdown)=\"bringToFront()\"\n (focusin)=\"bringToFront()\"\n (keydown)=\"onKeydown($event)\"\n >\n <!-- A barra de t\u00EDtulo \u00E9 a al\u00E7a de arrastar (Pointer Events: mouse, caneta e toque). Os bot\u00F5es\n dela n\u00E3o arrastam; dois cliques maximizam/restauram. -->\n <header\n class=\"hm-floating-window__titlebar\"\n [class.hm-floating-window__titlebar--movable]=\"movable() && !maximized()\"\n (pointerdown)=\"startMove($event)\"\n (dblclick)=\"onTitleDoubleClick($event)\"\n >\n @if (icon()) {\n <hm-icon class=\"hm-floating-window__icon\" [shape]=\"icon()\" />\n }\n <h2 class=\"hm-floating-window__heading\" [id]=\"headingId\">{{ heading() }}</h2>\n <div class=\"hm-floating-window__actions\">\n <ng-content select=\"[actions]\" />\n @if (minimizable()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n [icon]=\"minimized() ? 'window-restore' : 'window-min'\"\n [label]=\"minimized() ? i18n.floatingWindow.restore : i18n.floatingWindow.minimize\"\n (clicked)=\"toggleMinimize()\"\n />\n }\n @if (maximizable() && !minimized()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n [icon]=\"maximized() ? 'window-restore' : 'window-max'\"\n [label]=\"maximized() ? i18n.floatingWindow.restore : i18n.floatingWindow.maximize\"\n (clicked)=\"toggleMaximize()\"\n />\n }\n @if (closable()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n icon=\"times\"\n [label]=\"i18n.floatingWindow.close\"\n (clicked)=\"close()\"\n />\n }\n </div>\n </header>\n\n <div class=\"hm-floating-window__body\" [hidden]=\"minimized()\">\n <ng-content />\n </div>\n\n <div class=\"hm-floating-window__footer\" [hidden]=\"minimized()\">\n <ng-content select=\"[footer]\" />\n </div>\n\n <!-- Al\u00E7as de redimensionar: s\u00F3 ponteiro (o teclado usa Alt+Shift+setas, descrito na dica). -->\n @if (showHandles()) {\n @for (edge of edges; track edge) {\n <div\n class=\"hm-floating-window__handle hm-floating-window__handle--{{ edge }}\"\n aria-hidden=\"true\"\n (pointerdown)=\"startResize($event, edge)\"\n ></div>\n }\n }\n\n <span class=\"hm-visually-hidden\" [id]=\"hintId\">{{ i18n.floatingWindow.keyboardHint }}</span>\n <span class=\"hm-visually-hidden\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</span>\n </section>\n}\n" }]
|
|
426
|
-
}], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: true }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], x: [{ type: i0.Input, args: [{ isSignal: true, alias: "x", required: false }] }], y: [{ type: i0.Input, args: [{ isSignal: true, alias: "y", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], movable: [{ type: i0.Input, args: [{ isSignal: true, alias: "movable", required: false }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], minimizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "minimizable", required: false }] }], maximizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "maximizable", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], autoFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFocus", required: false }] }], storageKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "storageKey", required: false }] }], rect: [{ type: i0.Input, args: [{ isSignal: true, alias: "rect", required: false }] }, { type: i0.Output, args: ["rectChange"] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }, { type: i0.Output, args: ["stateChange"] }], closed: [{ type: i0.Output, args: ["closed"] }], windowRef: [{ type: i0.ViewChild, args: ['windowEl', { isSignal: true }] }] } });
|
|
484
|
+
args: [{ selector: 'hm-floating-window', imports: [IconButtonComponent, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (open()) {\n <section\n #windowEl\n class=\"hm-floating-window\"\n [class.hm-floating-window--minimized]=\"minimized()\"\n [class.hm-floating-window--maximized]=\"maximized()\"\n [class.hm-floating-window--dragging]=\"dragging()\"\n [class.hm-floating-window--sheet]=\"sheet()\"\n [class.hm-floating-window--top]=\"top()\"\n [id]=\"id\"\n role=\"dialog\"\n aria-modal=\"false\"\n [attr.aria-labelledby]=\"headingId\"\n [attr.aria-describedby]=\"hintId\"\n tabindex=\"-1\"\n [style.left.px]=\"sheet() ? null : box().x\"\n [style.top.px]=\"sheet() ? null : box().y\"\n [style.width.px]=\"sheet() ? null : box().width\"\n [style.height.px]=\"minimized() || sheet() ? null : box().height\"\n [style.translate]=\"sheet() && sheetOffset() ? '0 ' + sheetOffset() + 'px' : null\"\n [style.--hm-floating-window-layer]=\"layer()\"\n (pointerdown)=\"bringToFront()\"\n (focusin)=\"bringToFront()\"\n (keydown)=\"onKeydown($event)\"\n >\n <!-- A barra de t\u00EDtulo \u00E9 a al\u00E7a de arrastar (Pointer Events: mouse, caneta e toque). Os bot\u00F5es\n dela n\u00E3o arrastam; dois cliques maximizam/restauram. -->\n <header\n class=\"hm-floating-window__titlebar\"\n [class.hm-floating-window__titlebar--movable]=\"sheet() || (movable() && !maximized())\"\n (pointerdown)=\"startMove($event)\"\n (dblclick)=\"onTitleDoubleClick($event)\"\n >\n @if (sheet()) {\n <!-- Barra de arrastar da folha (decorativa: o gesto tem alternativa no bot\u00E3o recolher e em Alt+setas). -->\n <span class=\"hm-floating-window__grabber\" aria-hidden=\"true\"></span>\n }\n @if (icon()) {\n <hm-icon class=\"hm-floating-window__icon\" [shape]=\"icon()\" />\n }\n <h2 class=\"hm-floating-window__heading\" [id]=\"headingId\">{{ heading() }}</h2>\n <div class=\"hm-floating-window__actions\">\n <ng-content select=\"[actions]\" />\n @if (minimizable()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n [icon]=\"minimized() ? 'window-restore' : 'window-min'\"\n [label]=\"minimized() ? i18n.floatingWindow.restore : i18n.floatingWindow.minimize\"\n (clicked)=\"toggleMinimize()\"\n />\n }\n @if (maximizable() && !minimized() && !sheet()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n [icon]=\"maximized() ? 'window-restore' : 'window-max'\"\n [label]=\"maximized() ? i18n.floatingWindow.restore : i18n.floatingWindow.maximize\"\n (clicked)=\"toggleMaximize()\"\n />\n }\n @if (closable()) {\n <hm-icon-button\n size=\"small\"\n emphasis=\"subtle\"\n icon=\"times\"\n [label]=\"i18n.floatingWindow.close\"\n (clicked)=\"close()\"\n />\n }\n </div>\n </header>\n\n <div class=\"hm-floating-window__body\" [hidden]=\"minimized()\">\n <ng-content />\n </div>\n\n <div class=\"hm-floating-window__footer\" [hidden]=\"minimized()\">\n <ng-content select=\"[footer]\" />\n </div>\n\n <!-- Al\u00E7as de redimensionar: s\u00F3 ponteiro (o teclado usa Alt+Shift+setas, descrito na dica). -->\n @if (showHandles()) {\n @for (edge of edges; track edge) {\n <div\n class=\"hm-floating-window__handle hm-floating-window__handle--{{ edge }}\"\n aria-hidden=\"true\"\n (pointerdown)=\"startResize($event, edge)\"\n ></div>\n }\n }\n\n <span class=\"hm-visually-hidden\" [id]=\"hintId\">{{ sheet() ? (i18n.floatingWindow.sheetHint || i18n.floatingWindow.keyboardHint) : i18n.floatingWindow.keyboardHint }}</span>\n <span class=\"hm-visually-hidden\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</span>\n </section>\n}\n" }]
|
|
485
|
+
}], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: true }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], x: [{ type: i0.Input, args: [{ isSignal: true, alias: "x", required: false }] }], y: [{ type: i0.Input, args: [{ isSignal: true, alias: "y", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], movable: [{ type: i0.Input, args: [{ isSignal: true, alias: "movable", required: false }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], minimizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "minimizable", required: false }] }], maximizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "maximizable", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], autoFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFocus", required: false }] }], sheetBelow: [{ type: i0.Input, args: [{ isSignal: true, alias: "sheetBelow", required: false }] }], storageKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "storageKey", required: false }] }], rect: [{ type: i0.Input, args: [{ isSignal: true, alias: "rect", required: false }] }, { type: i0.Output, args: ["rectChange"] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }, { type: i0.Output, args: ["stateChange"] }], closed: [{ type: i0.Output, args: ["closed"] }], windowRef: [{ type: i0.ViewChild, args: ['windowEl', { isSignal: true }] }] } });
|
|
427
486
|
|
|
428
487
|
// Ponto de import `@trismegisto/angular/floating-window` (secundário do ng-packagr): o que o public-api e as outras pastas usam
|
|
429
488
|
// daqui. Gerado em 2026-10-03; ao criar arquivo público novo na pasta, acrescente a linha.
|