UNPKG

@ionic/core

Version:
164 lines (154 loc) 4.35 kB
/** * Convert a font size to a dynamic font size. * Fonts that participate in Dynamic Type should use * dynamic font sizes. * @param size - The initial font size including the unit (i.e. px or pt) * @param unit (optional) - The unit to convert to. Use this if you want to * convert to a unit other than $baselineUnit. */ /** * Convert a font size to a dynamic font size but impose * a maximum font size. * @param size - The initial font size including the unit (i.e. px or pt) * @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale). * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to * convert to a unit other than $baselineUnit. */ /** * Convert a font size to a dynamic font size but impose * a minimum font size. * @param size - The initial font size including the unit (i.e. px or pt) * @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale). * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to * convert to a unit other than $baselineUnit. */ /** * Convert a font size to a dynamic font size but impose * maximum and minimum font sizes. * @param size - The initial font size including the unit (i.e. px or pt) * @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale). * @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale). * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to * convert to a unit other than $baselineUnit. */ /** * A heuristic that applies CSS to tablet * viewports. * * Usage: * @include tablet-viewport() { * :host { * background-color: green; * } * } */ /** * A heuristic that applies CSS to mobile * viewports (i.e. phones, not tablets). * * Usage: * @include mobile-viewport() { * :host { * background-color: blue; * } * } */ :host { /** * @prop --color: Text color of the title */ --color: initial; display: flex; flex: 1; align-items: center; transform: translateZ(0); color: var(--color); } :host(.ion-color) { color: var(--ion-color-base); } .toolbar-title { display: block; width: 100%; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; pointer-events: auto; } :host(.title-small) .toolbar-title { white-space: normal; } :host { top: 0; -webkit-padding-start: 90px; padding-inline-start: 90px; -webkit-padding-end: 90px; padding-inline-end: 90px; padding-top: var(--padding-top); padding-bottom: var(--padding-bottom); position: absolute; width: 100%; height: 100%; transform: translateZ(0); font-size: min(1.0625rem, 20.4px); font-weight: 600; text-align: center; box-sizing: border-box; pointer-events: none; } :host { inset-inline-start: 0; } :host(.title-small) { -webkit-padding-start: 9px; padding-inline-start: 9px; -webkit-padding-end: 9px; padding-inline-end: 9px; padding-top: 6px; padding-bottom: 16px; position: relative; font-size: min(0.8125rem, 23.4px); font-weight: normal; } :host(.title-large) { -webkit-padding-start: 12px; padding-inline-start: 12px; -webkit-padding-end: 12px; padding-inline-end: 12px; padding-top: 2px; padding-bottom: 4px; transform-origin: left center; position: static; align-items: flex-end; min-width: 100%; font-size: min(2.125rem, 61.2px); font-weight: 700; text-align: start; } :host(.title-large.title-rtl) { transform-origin: right center; } :host(.title-large.ion-cloned-element) { --color: var(--ion-text-color, #000); font-family: var(--ion-font-family); } :host(.title-large) .toolbar-title { transform-origin: inherit; /** * During a page transition * if the large title and the back button * texts match up, the back button should be * scaled to roughly match the dimensions of * the large title text. The following line * ensures that the scale values are accurate. */ width: auto; } :host-context([dir=rtl]):host(.title-large) .toolbar-title, :host-context([dir=rtl]).title-large .toolbar-title { transform-origin: calc(100% - inherit); } @supports selector(:dir(rtl)) { :host(.title-large:dir(rtl)) .toolbar-title { transform-origin: calc(100% - inherit); } }