UNPKG

@ionic/core

Version:
397 lines (373 loc) • 13.1 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 --background: Background of the menu * * @prop --min-width: Minimum width of the menu * @prop --width: Width of the menu * @prop --max-width: Maximum width of the menu * * @prop --min-height: Minimum height of the menu * @prop --height: Height of the menu * @prop --max-height: Maximum height of the menu */ --width: 304px; --min-width: auto; --max-width: auto; --height: 100%; --min-height: auto; --max-height: auto; --background: var(--ion-background-color, #fff); left: 0; right: 0; top: 0; bottom: 0; display: none; position: absolute; contain: strict; } :host(.show-menu) { display: block; } .menu-inner { transform: translateX(-9999px); display: flex; position: absolute; flex-direction: column; justify-content: space-between; width: var(--width); min-width: var(--min-width); max-width: var(--max-width); height: var(--height); min-height: var(--min-height); max-height: var(--max-height); background: var(--background); contain: strict; } :host(.menu-side-start) .menu-inner { /** * Menu does not cover the whole screen so we need to set the safe area for the * side that touches the screen edge only. Since safe area is not logical, it * needs to be applied to the correct side depending on the language direction. * Otherwise, the content will have less space on both sides. * * LTR: * The left side of the menu touches the screen edge. The safe area padding has * already been set in the core styles, so there's no need to set it again. * The right side of the menu is not touching the screen edge. Padding is not * applied to the right side of the menu. A value of 0 is set. */ --ion-safe-area-right: 0px; top: 0; bottom: 0; } :host(.menu-side-start) .menu-inner { inset-inline-start: 0; inset-inline-end: auto; } :host-context([dir=rtl]):host(.menu-side-start) .menu-inner, :host-context([dir=rtl]).menu-side-start .menu-inner { /** * Menu does not cover the whole screen so we need to set the safe area for the * side that touches the screen edge only. Since safe area is not logical, it * needs to be applied to the correct side depending on the language direction. * Otherwise, the content will have less space on both sides. * * RTL: * The right side of the menu touches the screen edge. * The right side needs to revert back to the default value that was set in the core styles, so we unset it here. * This would keep the variable consistent with the core styles. * Additionally, it would continue to allow users to override the variable if they choose to. * The left side of the menu is not touching the screen edge. Padding is not * applied to the left side of the menu. A value of 0 is set. */ --ion-safe-area-right: unset; --ion-safe-area-left: 0px; } @supports selector(:dir(rtl)) { :host(.menu-side-start:dir(rtl)) .menu-inner { /** * Menu does not cover the whole screen so we need to set the safe area for the * side that touches the screen edge only. Since safe area is not logical, it * needs to be applied to the correct side depending on the language direction. * Otherwise, the content will have less space on both sides. * * RTL: * The right side of the menu touches the screen edge. * The right side needs to revert back to the default value that was set in the core styles, so we unset it here. * This would keep the variable consistent with the core styles. * Additionally, it would continue to allow users to override the variable if they choose to. * The left side of the menu is not touching the screen edge. Padding is not * applied to the left side of the menu. A value of 0 is set. */ --ion-safe-area-right: unset; --ion-safe-area-left: 0px; } } :host(.menu-side-end) .menu-inner { /** * Menu does not cover the whole screen so we need to set the safe area for the * side that touches the screen edge only. Since safe area is not logical, it * needs to be applied to the correct side depending on the language direction. * Otherwise, the content will have less space on both sides. * * LTR: * The right side of the menu touches the screen edge. The safe area padding has * already been set in the core styles, so there's no need to set it again. * The left side of the menu is not touching the screen edge. Padding is not * applied to the left side of the menu. A value of 0 is set. */ --ion-safe-area-left: 0px; top: 0; bottom: 0; } :host(.menu-side-end) .menu-inner { inset-inline-start: auto; inset-inline-end: 0; } :host-context([dir=rtl]):host(.menu-side-end) .menu-inner, :host-context([dir=rtl]).menu-side-end .menu-inner { /** * Menu does not cover the whole screen so we need to set the safe area for the * side that touches the screen edge only. Since safe area is not logical, it * needs to be applied to the correct side depending on the language direction. * Otherwise, the content will have less space on both sides. * * RTL: * The left side of the menu touches the screen edge. * The left side needs to revert back to the default value that was set in the core styles, so we unset it here. * This would keep the variable consistent with the core styles. * Additionally, it would continue to allow users to override the variable if they choose to. * The right side of the menu is not touching the screen edge. Padding is not * applied to the right side of the menu. A value of 0 is set. */ --ion-safe-area-left: unset; --ion-safe-area-right: 0px; } @supports selector(:dir(rtl)) { :host(.menu-side-end:dir(rtl)) .menu-inner { /** * Menu does not cover the whole screen so we need to set the safe area for the * side that touches the screen edge only. Since safe area is not logical, it * needs to be applied to the correct side depending on the language direction. * Otherwise, the content will have less space on both sides. * * RTL: * The left side of the menu touches the screen edge. * The left side needs to revert back to the default value that was set in the core styles, so we unset it here. * This would keep the variable consistent with the core styles. * Additionally, it would continue to allow users to override the variable if they choose to. * The right side of the menu is not touching the screen edge. Padding is not * applied to the right side of the menu. A value of 0 is set. */ --ion-safe-area-left: unset; --ion-safe-area-right: 0px; } } ion-backdrop { display: none; opacity: 0.01; z-index: -1; } @media (max-width: 340px) { .menu-inner { --width: 264px; } } :host(.menu-type-reveal) { z-index: 0; } :host(.menu-type-reveal.show-menu) .menu-inner { transform: translate3d(0, 0, 0); } :host(.menu-type-overlay) { z-index: 1000; } :host(.menu-type-overlay) .show-backdrop { display: block; cursor: pointer; } /** * The split pane styles for menu are defined * in the menu stylesheets instead in the split pane * stylesheets with ::slotted to allow for menus * to be wrapped in custom components. * If we used ::slotted to target the menu * then menus wrapped in components would never * receive these styles because they are not * children of the split pane. */ /** * Do not pass CSS Variables down on larger * screens as we want them to affect the outer * `ion-menu` rather than the inner content */ :host(.menu-pane-visible) { flex: 0 1 auto; width: var(--side-width, var(--width)); min-width: var(--side-min-width, var(--min-width)); max-width: var(--side-max-width, var(--max-width)); } :host(.menu-pane-visible.split-pane-side) { left: 0; right: 0; top: 0; bottom: 0; position: relative; box-shadow: none; z-index: 0; } :host(.menu-pane-visible.split-pane-side.menu-enabled) { display: flex; flex-shrink: 0; } :host(.menu-pane-visible.split-pane-side) { order: -1; } :host(.menu-pane-visible.split-pane-side[side=end]) { order: 1; } :host(.menu-pane-visible) .menu-inner { left: 0; right: 0; width: auto; transform: none; box-shadow: none; } :host(.menu-pane-visible) ion-backdrop { /* stylelint-disable-next-line declaration-no-important */ display: hidden !important; } :host(.menu-pane-visible.split-pane-side) { -webkit-border-start: 0; border-inline-start: 0; -webkit-border-end: var(--border); border-inline-end: var(--border); border-top: 0; border-bottom: 0; min-width: var(--side-min-width); max-width: var(--side-max-width); } :host(.menu-pane-visible.split-pane-side[side=end]) { -webkit-border-start: var(--border); border-inline-start: var(--border); -webkit-border-end: 0; border-inline-end: 0; border-top: 0; border-bottom: 0; min-width: var(--side-min-width); max-width: var(--side-max-width); } /** * 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(.menu-type-push) { z-index: 1000; } :host(.menu-type-push) .show-backdrop { display: block; }