|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565 |
- @charset "UTF-8";
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $breakpoints: (
- 'phone': 320px,
- 'tablet': 768px,
- 'desktop': 1024px
- ) !default;
-
-
-
-
-
-
-
-
-
-
-
-
-
- $media-expressions: (
- 'screen': 'screen',
- 'print': 'print',
- 'handheld': 'handheld',
- 'landscape': '(orientation: landscape)',
- 'portrait': '(orientation: portrait)',
- 'retina2x': '(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 2dppx)',
- 'retina3x': '(-webkit-min-device-pixel-ratio: 3), (min-resolution: 350dpi), (min-resolution: 3dppx)'
- ) !default;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $unit-intervals: (
- 'px': 1,
- 'em': 0.01,
- 'rem': 0.1,
- '': 0
- ) !default;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $im-media-support: true !default;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $im-no-media-breakpoint: 'desktop' !default;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $im-no-media-expressions: ('screen', 'portrait', 'landscape') !default;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function im-log($message) {
- @if feature-exists('at-error') {
- @error $message;
- } @else {
- @warn $message;
- $_: noop();
- }
-
- @return $message;
- }
-
-
-
-
-
-
-
-
-
-
- @mixin log($message) {
- @if im-log($message) {}
- }
-
-
-
-
-
-
- @function noop() {}
-
-
-
-
-
-
-
-
- @function im-intercepts-static-breakpoint($conditions...) {
- $no-media-breakpoint-value: map-get($breakpoints, $im-no-media-breakpoint);
-
- @if not $no-media-breakpoint-value {
- @if im-log('`#{$im-no-media-breakpoint}` is not a valid breakpoint.') {}
- }
-
- @each $condition in $conditions {
- @if not map-has-key($media-expressions, $condition) {
- $operator: get-expression-operator($condition);
- $prefix: get-expression-prefix($operator);
- $value: get-expression-value($condition, $operator);
-
- @if ($prefix == 'max' and $value <= $no-media-breakpoint-value) or
- ($prefix == 'min' and $value > $no-media-breakpoint-value) {
- @return false;
- }
- } @else if not index($im-no-media-expressions, $condition) {
- @return false;
- }
- }
-
- @return true;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function get-expression-operator($expression) {
- @each $operator in ('>=', '>', '<=', '<', '≥', '≤') {
- @if str-index($expression, $operator) {
- @return $operator;
- }
- }
-
-
-
-
-
-
- $_: im-log('No operator found in `#{$expression}`.');
- }
-
-
-
-
-
-
-
-
-
-
- @function get-expression-dimension($expression, $operator) {
- $operator-index: str-index($expression, $operator);
- $parsed-dimension: str-slice($expression, 0, $operator-index - 1);
- $dimension: 'width';
-
- @if str-length($parsed-dimension) > 0 {
- $dimension: $parsed-dimension;
- }
-
- @return $dimension;
- }
-
-
-
-
-
-
-
-
-
- @function get-expression-prefix($operator) {
- @return if(index(('<', '<=', '≤'), $operator), 'max', 'min');
- }
-
-
-
-
-
-
-
-
-
-
- @function get-expression-value($expression, $operator) {
- $operator-index: str-index($expression, $operator);
- $value: str-slice($expression, $operator-index + str-length($operator));
-
- @if map-has-key($breakpoints, $value) {
- $value: map-get($breakpoints, $value);
- } @else {
- $value: to-number($value);
- }
-
- $interval: map-get($unit-intervals, unit($value));
-
- @if not $interval {
-
-
-
-
-
- $_: im-log('Unknown unit `#{unit($value)}`.');
- }
-
- @if $operator == '>' {
- $value: $value + $interval;
- } @else if $operator == '<' {
- $value: $value - $interval;
- }
-
- @return $value;
- }
-
-
-
-
-
-
-
-
-
- @function parse-expression($expression) {
-
-
- @if map-has-key($media-expressions, $expression) {
- @return map-get($media-expressions, $expression);
- }
-
- $operator: get-expression-operator($expression);
- $dimension: get-expression-dimension($expression, $operator);
- $prefix: get-expression-prefix($operator);
- $value: get-expression-value($expression, $operator);
-
- @return '(#{$prefix}-#{$dimension}: #{$value})';
- }
-
-
-
-
-
-
-
-
-
-
-
-
- @function slice($list, $start: 1, $end: length($list)) {
- @if length($list) < 1 or $start > $end {
- @return ();
- }
-
- $result: ();
-
- @for $i from $start through $end {
- $result: append($result, nth($list, $i));
- }
-
- @return $result;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function to-number($value) {
- @if type-of($value) == 'number' {
- @return $value;
- } @else if type-of($value) != 'string' {
- $_: im-log('Value for `to-number` should be a number or a string.');
- }
-
- $first-character: str-slice($value, 1, 1);
- $result: 0;
- $digits: 0;
- $minus: ($first-character == '-');
- $numbers: ('0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9);
-
-
- @if ($first-character == '+' or $first-character == '-') {
- $value: str-slice($value, 2);
- }
-
- @for $i from 1 through str-length($value) {
- $character: str-slice($value, $i, $i);
-
- @if not (index(map-keys($numbers), $character) or $character == '.') {
- @return to-length(if($minus, -$result, $result), str-slice($value, $i))
- }
-
- @if $character == '.' {
- $digits: 1;
- } @else if $digits == 0 {
- $result: $result * 10 + map-get($numbers, $character);
- } @else {
- $digits: $digits * 10;
- $result: $result + map-get($numbers, $character) / $digits;
- }
- }
-
- @return if($minus, -$result, $result);
- }
-
-
-
-
-
-
-
-
-
-
- @function to-length($value, $unit) {
- $units: ('px': 1px, 'cm': 1cm, 'mm': 1mm, '%': 1%, 'ch': 1ch, 'pc': 1pc, 'in': 1in, 'em': 1em, 'rem': 1rem, 'pt': 1pt, 'ex': 1ex, 'vw': 1vw, 'vh': 1vh, 'vmin': 1vmin, 'vmax': 1vmax);
-
- @if not index(map-keys($units), $unit) {
- $_: im-log('Invalid unit `#{$unit}`.');
- }
-
- @return $value * map-get($units, $unit);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @mixin media-context($tweakpoints: (), $tweak-media-expressions: ()) {
-
- $global-breakpoints: $breakpoints;
- $global-media-expressions: $media-expressions;
-
-
- $breakpoints: map-merge($breakpoints, $tweakpoints) !global;
- $media-expressions: map-merge($media-expressions, $tweak-media-expressions) !global;
-
- @content;
-
-
- $breakpoints: $global-breakpoints !global;
- $media-expressions: $global-media-expressions !global;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @mixin media($conditions...) {
- @if ($im-media-support and length($conditions) == 0) or
- (not $im-media-support and im-intercepts-static-breakpoint($conditions...)) {
- @content;
- } @else if ($im-media-support and length($conditions) > 0) {
- @media #{unquote(parse-expression(nth($conditions, 1)))} {
-
- @include media(slice($conditions, 2)...) {
- @content;
- }
- }
- }
- }
|