@limetech/lime-elements
Version:
521 lines (488 loc) • 14.5 kB
CSS
@charset "UTF-8";
/**
* Note! This file is forwarded via `src/style/exports.scss`
* and exposed to consumers through the root `index.scss`.
*
* Consumers import it using:
* `@use '@limetech/lime-elements' as lime-elements;`
*
* Legacy import paths (`dist/scss/mixins`) are maintained
* for backward compatibility via copy rules in the Stencil config.
*/
/**
* This can be used on a trigger element that opens a dropdown menu or a popover.
*/
/**
* This mixin will mask out the content that is close to
* the edges of a scrollable area.
* - If the scrollable content has `overflow-y`, use `vertically`
* as an argument for `$direction`.
- If the scrollable content has `overflow-x`, use `horizontally`
* as an argument for `$direction`.
*
* For the visual effect to work smoothly, we need to make sure that
* the size of the fade-out edge effect is the same as the
* internal paddings of the scrollable area. Otherwise, content of a
* scrollable area that does not have a padding will fade out before
* any scrolling has been done.
* This is why this mixin already adds paddings, which automatically
* default to the size of the fade-out effect.
* This size defaults to `1rem`, but to override the size use
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
* when `vertically` argument is set, and use
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
* when `horizontally` argument is set.
* Of course you can also programmatically increase and decrease the
* size of these variables for each edge, based on the amount of
* scrolling that has been done by the user. In this case, make sure
* to add a custom padding where the mixin is used, to override
* the paddings that are automatically added by the mixin in the
* compiled CSS code.
*/
/**
* This mixin will add an animated underline to the bottom of an `a` elements.
* Note that you may need to add `all: unset;` –depending on your use case–
* before using this mixin.
*/
/**
* This mixin creates a cross-browser font stack.
* - `sans-serif` can be used for the UI of the components.
* - `monospace` can be used for code.
*
* ⚠️ If we change the font stacks, we need to update
* 1. the consumer documentation in `README.md`, and
* 2. the CSS variables of `--kompendium-example-font-family`
* in the `<style>` tag of `index.html`.
*/
/**
* This mixin is a hack, using old CSS syntax
* to enable you to truncate a piece of text,
* after a certain number of lines.
*/
/**
* This mixin will add a chessboard background pattern,
* typically used to visualize transparency.
*/
/**
* Make a container resizable by the user.
* This is used in the documentations and examples
* of some components, to demonstrate how the component
* behaves in a resizable container.
*/
/**
* Drag to reorder mixins
*/
/**
* The breakpoints below are used to create responsive designs
* in Lime's products. Therefore, they are here to get distributed
* to all components in other private repos, which rely on this `mixins`
* file, to create consistent styles.
*
* :::important
* In very rare cases you should used media queries!
* Nowadays, there are many better ways of achieving responsive design
* without media queries. For example, using CSS Grid, Flexbox, and their features.
* :::
*/
/**
* Media query mixins for responsive design based on screen width.
* Note that these mixins do not detect the device type!
*/
/**
* @prop --code-diff-max-height: Maximum height before scrolling, defaults to `none` (no limit).
* @prop --code-diff-font-size: Font size of the diff content, defaults to `0.75rem`.
*/
*,
*::before,
*::after {
box-sizing: border-box;
min-width: 0;
min-height: 0;
}
:host(limel-code-diff) {
--diff-added-bg: rgb(var(--color-green-default), 0.1);
--diff-added-bg-hover: rgb(var(--color-green-default), 0.3);
--diff-added-highlight-bg: rgb(var(--color-green-default), 0.3);
--diff-removed-bg: rgb(var(--color-red-default), 0.1);
--diff-removed-bg-hover: rgb(var(--color-red-default), 0.3);
--diff-removed-highlight-bg: rgb(var(--color-red-default), 0.3);
--diff-context-bg: transparent;
--diff-indicator-added-color: rgb(var(--color-green-default));
--diff-indicator-removed-color: rgb(var(--color-red-default));
--diff-stat-added-color: rgb(var(--color-green-default));
--diff-stat-removed-color: rgb(var(--color-red-default));
--search-match-bg: rgb(var(--color-amber-default), 0.3);
--search-match-current-bg: rgb(var(--color-amber-default), 0.6);
--diff-line-hover-bg: rgb(var(--contrast-800), 0.08);
--diff-gutter-bg: rgb(var(--contrast-200));
--diff-gutter-text-color: rgb(var(--contrast-700));
--diff-text-color: rgb(var(--contrast-1100));
--diff-border-color: rgb(var(--contrast-400));
--diff-collapsed-bg: rgb(var(--contrast-200));
--diff-collapsed-text-color: rgb(var(--contrast-800));
--diff-header-bg: rgb(var(--contrast-200));
--diff-empty-text-color: rgb(var(--contrast-700));
--diff-split-divider-color: rgb(var(--contrast-400));
--diff-empty-cell-bg: rgb(var(--contrast-100));
--syntax-string-color: rgb(var(--color-green-dark));
--syntax-number-color: rgb(var(--color-blue-default));
--syntax-boolean-color: rgb(var(--color-amber-darker));
--syntax-key-color: rgb(var(--color-sky-dark));
--syntax-null-color: rgb(var(--contrast-700));
--syntax-punctuation-color: rgb(var(--contrast-700));
--search-bar-bg: rgb(var(--contrast-100));
--search-bar-border: rgb(var(--contrast-400));
--limel-code-diff-line-number-padding: 0.25rem;
font-family: ui-sans-serif, system-ui, sans-serif;
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
color: var(--diff-text-color);
border: 1px solid var(--diff-border-color);
border-radius: 0.5rem;
max-height: var(--code-diff-max-height, none);
}
.screen-reader-only {
position: absolute;
width: 0;
height: 0;
margin: -1px;
padding: 0;
border: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
white-space: nowrap;
}
.diff-header {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.125rem 0.125rem 0.125rem 0.5rem;
background: var(--diff-header-bg);
border-bottom: 1px solid var(--diff-border-color);
font-family: ui-sans-serif, system-ui, sans-serif;
font-size: 0.75rem;
border-radius: 0.5rem 0.5rem 0 0;
}
.diff-header__labels {
display: flex;
gap: 0.75rem;
font-weight: 500;
}
.diff-header__old,
.diff-header__new {
padding: 0.125rem 0.25rem;
border-radius: 0.25rem;
box-shadow: var(--shadow-brighten-edges-outside);
}
.diff-header__old {
background-color: var(--diff-removed-bg);
}
.diff-header__new {
background-color: var(--diff-added-bg);
}
.diff-header__actions {
display: flex;
align-items: center;
gap: 0.25rem;
}
.search-toggle--active {
--limel-theme-on-surface-color: var(--mdc-theme-primary);
}
.diff-header__stats {
font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
display: flex;
gap: 0.5rem;
margin-right: 0.5rem;
}
.stat {
font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
font-size: 0.8125rem;
font-weight: 600;
}
.stat--added {
color: var(--diff-stat-added-color);
}
.stat--removed {
color: var(--diff-stat-removed-color);
}
.search-bar {
flex-shrink: 0;
display: flex;
align-items: center;
gap: 0.25rem;
padding: 0.25rem 0 0.25rem 0.25rem;
background: var(--search-bar-bg);
border-bottom: 1px solid var(--search-bar-border);
}
.search-bar limel-action-bar {
--action-bar-background-color: transparent;
min-width: 2.5rem;
flex-shrink: 0;
}
.search-bar limel-input-field {
flex-grow: 1;
}
.search-bar__count {
color: var(--diff-collapsed-text-color);
white-space: nowrap;
min-width: 4rem;
text-align: center;
font-size: 0.75rem;
}
.search-match {
background: var(--search-match-bg);
color: inherit;
border-radius: 0.125rem;
}
.search-match--current {
background: var(--search-match-current-bg);
outline: 1px solid rgb(var(--color-amber-dark), 0.5);
}
.change-group {
position: relative;
}
.change-group__copy {
--icon-background-color: rgb(var(--contrast-100));
scale: 0.9;
position: absolute;
top: 0.125rem;
right: 0.5rem;
display: none;
}
.change-group:hover .change-group__copy {
display: inline-flex;
}
.diff-body {
flex-grow: 1;
overflow-x: auto;
font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
font-size: var(--code-diff-font-size, 0.75rem);
}
.diff-body:focus {
outline: none;
}
.diff-body:focus-visible {
outline: 0.125rem solid rgb(var(--color-blue-default));
outline-offset: 0.125rem;
border-radius: 0.25rem;
}
.diff-line {
display: flex;
align-items: stretch;
min-height: 1.25rem;
line-height: 1.25rem;
}
.diff-line:hover .line-content {
transition-duration: 0.2s;
background: var(--diff-line-hover-bg);
}
.diff-line--added .line-content {
background: var(--diff-added-bg);
}
.diff-line--added .line-indicator {
color: var(--diff-indicator-added-color);
}
.diff-line--added:hover .line-content {
background: var(--diff-added-bg-hover);
}
.diff-line--removed .line-content {
background: var(--diff-removed-bg);
}
.diff-line--removed .line-indicator {
color: var(--diff-indicator-removed-color);
}
.diff-line--removed:hover .line-content {
background: var(--diff-removed-bg-hover);
}
.diff-line--context .line-content {
background: var(--diff-context-bg);
}
.diff-line--collapsed {
display: flex;
justify-content: center;
background: var(--diff-collapsed-bg);
border-top: 1px solid var(--diff-border-color);
border-bottom: 1px solid var(--diff-border-color);
}
.diff-line--focused {
outline: 0.125rem solid rgb(var(--color-blue-default));
outline-offset: -0.125rem;
z-index: 1;
}
.line-number {
display: inline-flex;
align-items: center;
justify-content: flex-end;
min-width: calc(1ch + 2 * var(--limel-code-diff-line-number-padding));
width: var(--limel-line-number-min-width);
padding: 0 var(--limel-code-diff-line-number-padding);
background: var(--diff-gutter-bg);
color: var(--diff-gutter-text-color);
user-select: none;
text-align: right;
flex-shrink: 0;
}
.line-number--old {
border-right: 1px solid var(--diff-border-color);
}
.line-indicator {
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.25rem;
flex-shrink: 0;
user-select: none;
font-weight: 600;
background: var(--diff-gutter-bg);
}
.line-content {
flex: 1;
padding: 0 0.75rem;
white-space: pre;
overflow-x: visible;
min-width: 0;
transition: background-color 0.6s ease;
}
mark {
background: transparent;
color: inherit;
border-radius: 0.125rem;
}
mark.segment--added {
background: var(--diff-added-highlight-bg);
}
mark.segment--removed {
background: var(--diff-removed-highlight-bg);
}
.syntax--string {
color: var(--syntax-string-color);
}
.syntax--number {
color: var(--syntax-number-color);
}
.syntax--boolean {
color: var(--syntax-boolean-color);
}
.syntax--null {
color: var(--syntax-null-color);
font-style: italic;
}
.syntax--key {
color: var(--syntax-key-color);
}
.syntax--punctuation {
color: var(--syntax-punctuation-color);
}
.expand-button {
all: unset;
transition: color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);
cursor: pointer;
color: var(--limel-theme-on-surface-color);
background-color: transparent;
}
.expand-button:hover, .expand-button:focus, .expand-button:focus-visible {
will-change: color, background-color, box-shadow, transform;
}
.expand-button:hover, .expand-button:focus-visible {
transform: translate3d(0, 0.01rem, 0);
color: var(--limel-theme-on-surface-color);
background-color: var(--lime-elevated-surface-background-color);
}
.expand-button:hover {
box-shadow: var(--button-shadow-hovered);
}
.expand-button:active {
--limel-clickable-transform-timing-function: cubic-bezier(
0.83,
-0.15,
0.49,
1.16
);
transform: translate3d(0, 0.05rem, 0);
box-shadow: var(--button-shadow-pressed);
}
.expand-button:hover, .expand-button:active {
--limel-clickable-transition-speed: 0.2s;
--limel-clickable-transform-speed: 0.16s;
}
.expand-button:focus {
outline: none;
}
.expand-button:focus-visible {
outline: none;
box-shadow: var(--shadow-depth-8-focused);
}
.expand-button {
padding: 0 0.75rem;
border-radius: 0.25rem;
margin: 0.125rem;
width: calc(100% - 0.25rem);
text-align: center;
}
.diff-empty {
padding: 2rem;
text-align: center;
color: var(--diff-empty-text-color);
font-style: italic;
}
.diff-line--split {
display: flex;
align-items: stretch;
min-height: 1.25rem;
line-height: 1.25rem;
}
.diff-line--split:hover .split-content--removed {
background: var(--diff-removed-bg-hover);
}
.diff-line--split:hover .split-content--added {
background: var(--diff-added-bg-hover);
}
.diff-line--split:hover .split-content--context {
background: var(--diff-line-hover-bg);
}
.split-content {
flex: 1;
padding: 0 0.75rem;
white-space: pre;
overflow-x: visible;
min-width: 0;
}
.split-content--left {
border-right: 1px solid var(--diff-split-divider-color);
}
.split-content--removed {
background: var(--diff-removed-bg);
}
.split-content--added {
background: var(--diff-added-bg);
}
.split-content--context {
background: var(--diff-context-bg);
}
.split-content--empty {
background: var(--diff-empty-cell-bg);
}
.split-content--left {
overflow-x: hidden;
text-overflow: ellipsis;
}
.change-group:has(.diff-line--split) > .change-group__copy {
right: calc(50% - var(--limel-line-number-min-width));
}
:host(limel-code-diff[line-wrapping]) .diff-body {
overflow-x: hidden;
}
:host(limel-code-diff[line-wrapping]) .line-content,
:host(limel-code-diff[line-wrapping]) .split-content {
white-space: pre-wrap;
overflow-wrap: break-word;
word-break: break-all;
}
:host(limel-code-diff[line-wrapping]) .diff-line--split .split-content {
flex: 1 1 0%;
max-width: calc(50% - var(--limel-line-number-min-width));
}