| 29 | }, |
| 30 | }) |
| 31 | export class Header implements ComponentInterface { |
| 32 | private scrollEl?: HTMLElement; |
| 33 | private contentScrollCallback?: () => void; |
| 34 | private intersectionObserver?: IntersectionObserver; |
| 35 | private collapsibleMainHeader?: HTMLElement; |
| 36 | private inheritedAttributes: Attributes = {}; |
| 37 | |
| 38 | @Element() el!: HTMLElement; |
| 39 | |
| 40 | /** |
| 41 | * Describes the scroll effect that will be applied to the header. |
| 42 | * Only applies in iOS mode. |
| 43 | * |
| 44 | * Typically used for [Collapsible Large Titles](https://ionicframework.com/docs/api/title#collapsible-large-titles) |
| 45 | */ |
| 46 | @Prop() collapse?: 'condense' | 'fade'; |
| 47 | |
| 48 | /** |
| 49 | * If `true`, the header will be translucent. |
| 50 | * Only applies when the mode is `"ios"` and the device supports |
| 51 | * [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility). |
| 52 | * |
| 53 | * Note: In order to scroll content behind the header, the `fullscreen` |
| 54 | * attribute needs to be set on the content. |
| 55 | */ |
| 56 | @Prop() translucent = false; |
| 57 | |
| 58 | componentWillLoad() { |
| 59 | this.inheritedAttributes = inheritAriaAttributes(this.el); |
| 60 | } |
| 61 | |
| 62 | componentDidLoad() { |
| 63 | this.checkCollapsibleHeader(); |
| 64 | } |
| 65 | |
| 66 | componentDidUpdate() { |
| 67 | this.checkCollapsibleHeader(); |
| 68 | } |
| 69 | |
| 70 | disconnectedCallback() { |
| 71 | this.destroyCollapsibleHeader(); |
| 72 | } |
| 73 | |
| 74 | private async checkCollapsibleHeader() { |
| 75 | const mode = getIonMode(this); |
| 76 | |
| 77 | if (mode !== 'ios') { |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | const { collapse } = this; |
| 82 | const hasCondense = collapse === 'condense'; |
| 83 | const hasFade = collapse === 'fade'; |
| 84 | |
| 85 | this.destroyCollapsibleHeader(); |
| 86 | |
| 87 | if (hasCondense) { |
| 88 | const pageEl = this.el.closest('ion-app,ion-page,.ion-page,page-inner'); |
nothing calls this directly
no test coverage detected