unit.gl 0.1.13 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scss/functions/_layer.scss +14 -1
- package/scss/functions/_ratio.scss +3 -2
- package/scss/functions/_scale.scss +9 -2
- package/scss/functions/_sequence.scss +6 -5
- package/scss/functions/math/_arithmetic.scss +15 -12
- package/scss/functions/unit/_unit_conversion.scss +59 -7
- package/scss/functions/unit/_unit_functions.scss +3 -3
- package/scss/mixins/_display.scss +9 -2
- package/scss/mixins/_guide.scss +73 -11
- package/scss/mixins/_paper.scss +3 -2
- package/scss/mixins/_view.scss +2 -1
- package/scss/tags/_global.scss +18 -0
- package/scss/test.scss +17 -0
- package/scss/variables/_color.scss +9 -9
- package/scss/variables/_guide.scss +17 -0
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
// ============================================================================
|
|
16
16
|
// Use
|
|
17
17
|
// ============================================================================
|
|
18
|
+
@use "sass:map";
|
|
18
19
|
|
|
19
20
|
// ============================================================================
|
|
20
21
|
// Functions
|
|
@@ -32,8 +33,20 @@
|
|
|
32
33
|
/// @return {Number | Null} - The z-index value associated with the layer,
|
|
33
34
|
/// or null if not found.
|
|
34
35
|
///
|
|
36
|
+
/// @example scss - Usage
|
|
37
|
+
/// // Define layers map (typically in variables)
|
|
38
|
+
/// $layers: (
|
|
39
|
+
/// "base": 1,
|
|
40
|
+
/// "modal": 1000,
|
|
41
|
+
/// "guides": 9999
|
|
42
|
+
/// );
|
|
43
|
+
///
|
|
44
|
+
/// .modal {
|
|
45
|
+
/// z-index: z("modal");
|
|
46
|
+
/// }
|
|
47
|
+
///
|
|
35
48
|
@function z($layer) {
|
|
36
|
-
@if not map
|
|
49
|
+
@if not map.has-key($layers, $layer) {
|
|
37
50
|
@warn "Layer `#{$layer}` not found in the $layers map. z-index property omitted.";
|
|
38
51
|
@return null;
|
|
39
52
|
}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
// ============================================================================
|
|
21
21
|
// Use
|
|
22
22
|
// ============================================================================
|
|
23
|
+
@use "sass:math";
|
|
23
24
|
|
|
24
25
|
// ============================================================================
|
|
25
26
|
// Functions
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
$golden-ratio: 1.618;
|
|
54
55
|
|
|
55
56
|
// Validate the input size
|
|
56
|
-
@if not unitless($size) and type-of($size) != "number" {
|
|
57
|
+
@if not math.is-unitless($size) and type-of($size) != "number" {
|
|
57
58
|
@error "The size parameter must be a valid number or unitless value.";
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -63,5 +64,5 @@
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
// Return the size scaled by the golden ratio raised to the increment
|
|
66
|
-
@return $size * pow($golden-ratio, $increment);
|
|
67
|
+
@return $size * math.pow($golden-ratio, $increment);
|
|
67
68
|
}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
// ============================================================================
|
|
21
21
|
// Use
|
|
22
22
|
// ============================================================================
|
|
23
|
+
@use "sass:math";
|
|
23
24
|
|
|
24
25
|
// ============================================================================
|
|
25
26
|
// Functions
|
|
@@ -41,13 +42,19 @@
|
|
|
41
42
|
/// olden Ratio (1.618).
|
|
42
43
|
/// @return {Number} - The calculated value based on the modular scale.
|
|
43
44
|
///
|
|
45
|
+
/// @example scss - Usage
|
|
46
|
+
/// // Font sizing using a modular scale
|
|
47
|
+
/// h1 { font-size: modular_scale(3, 1rem, 1.25); }
|
|
48
|
+
/// h2 { font-size: modular_scale(2, 1rem, 1.25); }
|
|
49
|
+
/// p { margin-bottom: modular_scale(1, 1rem, 1.25); }
|
|
50
|
+
///
|
|
44
51
|
@function modular_scale($increment: 1, $base: 1em, $ratio: 1.618) {
|
|
45
52
|
// Validate inputs
|
|
46
53
|
@if type-of($increment) != "number" {
|
|
47
54
|
@error "Step must be a number.";
|
|
48
55
|
}
|
|
49
56
|
|
|
50
|
-
@if type-of($base) != "number" and not unitless($base) {
|
|
57
|
+
@if type-of($base) != "number" and not math.is-unitless($base) {
|
|
51
58
|
@error "Base must be a number with or without units.";
|
|
52
59
|
}
|
|
53
60
|
|
|
@@ -56,5 +63,5 @@
|
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
// Calculate the modular scale value
|
|
59
|
-
@return $base * pow($ratio, $increment);
|
|
66
|
+
@return $base * math.pow($ratio, $increment);
|
|
60
67
|
}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
// ============================================================================
|
|
21
21
|
// Use
|
|
22
22
|
// ============================================================================
|
|
23
|
+
@use "sass:math";
|
|
23
24
|
|
|
24
25
|
// ============================================================================
|
|
25
26
|
// Functions
|
|
@@ -132,7 +133,7 @@
|
|
|
132
133
|
/// @return {Number} - The nth Catalan number.
|
|
133
134
|
///
|
|
134
135
|
@function sequence_catalan($n) {
|
|
135
|
-
@return factorial(2 * $n)
|
|
136
|
+
@return math.div(factorial(2 * $n), (factorial($n + 1) * factorial($n)));
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
///
|
|
@@ -151,7 +152,7 @@
|
|
|
151
152
|
@warn "Index #{$n} is not valid for the harmonic series.";
|
|
152
153
|
@return null;
|
|
153
154
|
}
|
|
154
|
-
@return 1
|
|
155
|
+
@return math.div(1, $n);
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
///
|
|
@@ -171,7 +172,7 @@
|
|
|
171
172
|
@warn "Negative index #{$n} is not valid for the geometric series.";
|
|
172
173
|
@return null;
|
|
173
174
|
}
|
|
174
|
-
@return pow(2, $n - 1);
|
|
175
|
+
@return math.pow(2, $n - 1);
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
///
|
|
@@ -213,7 +214,7 @@
|
|
|
213
214
|
@warn "Index #{$n} is not valid for the triangular series.";
|
|
214
215
|
@return null;
|
|
215
216
|
}
|
|
216
|
-
@return $n * ($n + 1)
|
|
217
|
+
@return math.div($n * ($n + 1), 2);
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
///
|
|
@@ -252,7 +253,7 @@
|
|
|
252
253
|
@warn "Index #{$n} is not valid for the pentagonal series.";
|
|
253
254
|
@return null;
|
|
254
255
|
}
|
|
255
|
-
@return (3 * $n * $n - $n)
|
|
256
|
+
@return math.div((3 * $n * $n - $n), 2);
|
|
256
257
|
}
|
|
257
258
|
|
|
258
259
|
///
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
// ============================================================================
|
|
24
24
|
// Use
|
|
25
25
|
// ============================================================================
|
|
26
|
+
@use "sass:math";
|
|
26
27
|
|
|
27
28
|
// ============================================================================
|
|
28
29
|
// Functions
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
/// units, they must be the same unit; otherwise, a warning is issued and
|
|
40
41
|
/// `null` is returned.
|
|
41
42
|
///
|
|
43
|
+
/// @name add
|
|
42
44
|
/// @param {Number} $value1 - The first value, which may or may not include
|
|
43
45
|
/// units.
|
|
44
46
|
/// @param {Number} $value2 - The second value, which may or may not include
|
|
@@ -47,13 +49,13 @@
|
|
|
47
49
|
/// incompatible.
|
|
48
50
|
///
|
|
49
51
|
@function add($value1, $value2) {
|
|
50
|
-
@if unitless($value1) and unitless($value2) {
|
|
52
|
+
@if math.is-unitless($value1) and math.is-unitless($value2) {
|
|
51
53
|
@return $value1 + $value2;
|
|
52
|
-
} @else if unitless($value1) {
|
|
53
|
-
@return $value1 +
|
|
54
|
-
} @else if unitless($value2) {
|
|
55
|
-
@return
|
|
56
|
-
} @else if unit($value1) == unit($value2) {
|
|
54
|
+
} @else if math.is-unitless($value1) {
|
|
55
|
+
@return $value1 + unit_strip($value2);
|
|
56
|
+
} @else if math.is-unitless($value2) {
|
|
57
|
+
@return unit_strip($value1) + $value2;
|
|
58
|
+
} @else if math.unit($value1) == math.unit($value2) {
|
|
57
59
|
@return $value1 + $value2;
|
|
58
60
|
} @else {
|
|
59
61
|
@warn "Cannot add values with different units: #{$value1} and #{$value2}";
|
|
@@ -72,6 +74,7 @@
|
|
|
72
74
|
/// units, they must be the same unit; otherwise, a warning is issued and
|
|
73
75
|
/// `null` is returned.
|
|
74
76
|
///
|
|
77
|
+
/// @name subtract
|
|
75
78
|
/// @param {Number} $value1 - The first value, which may or may not include
|
|
76
79
|
/// units.
|
|
77
80
|
/// @param {Number} $value2 - The second value, which may or may not include
|
|
@@ -80,13 +83,13 @@
|
|
|
80
83
|
/// units are incompatible.
|
|
81
84
|
///
|
|
82
85
|
@function subtract($value1, $value2) {
|
|
83
|
-
@if unitless($value1) and unitless($value2) {
|
|
86
|
+
@if math.is-unitless($value1) and math.is-unitless($value2) {
|
|
84
87
|
@return $value1 - $value2;
|
|
85
|
-
} @else if unitless($value1) {
|
|
86
|
-
@return $value1 -
|
|
87
|
-
} @else if unitless($value2) {
|
|
88
|
-
@return
|
|
89
|
-
} @else if unit($value1) == unit($value2) {
|
|
88
|
+
} @else if math.is-unitless($value1) {
|
|
89
|
+
@return $value1 - unit_strip($value2);
|
|
90
|
+
} @else if math.is-unitless($value2) {
|
|
91
|
+
@return unit_strip($value1) - $value2;
|
|
92
|
+
} @else if math.unit($value1) == math.unit($value2) {
|
|
90
93
|
@return $value1 - $value2;
|
|
91
94
|
} @else {
|
|
92
95
|
@warn "Cannot subtract values with different units: #{$value1} and #{$value2}";
|
|
@@ -28,56 +28,108 @@ $base-font-size: 16px !default;
|
|
|
28
28
|
/// Create functions to convert between different measurement units, such as
|
|
29
29
|
/// pixels to rem, em to pixels, etc.
|
|
30
30
|
|
|
31
|
+
@use "sass:math";
|
|
32
|
+
|
|
33
|
+
///
|
|
34
|
+
/// Converts pixels to rem units using a configurable base.
|
|
35
|
+
///
|
|
36
|
+
/// @name px_to_rem
|
|
37
|
+
/// @param {Number} $size - Size in pixels.
|
|
38
|
+
/// @param {Number} $base - Base pixel size to convert against (default: 16px).
|
|
39
|
+
/// @return {Number} - Size expressed in rem.
|
|
31
40
|
@function px_to_rem($size, $base: 16px) {
|
|
32
|
-
@return $size
|
|
41
|
+
@return math.div($size, $base) * 1rem;
|
|
33
42
|
}
|
|
34
43
|
|
|
44
|
+
///
|
|
45
|
+
/// Converts rem units to pixels using a configurable base.
|
|
46
|
+
///
|
|
47
|
+
/// @name rem_to_px
|
|
48
|
+
/// @param {Number} $size - Size in rem.
|
|
49
|
+
/// @param {Number} $base - Base pixel size to convert against (default: 16px).
|
|
50
|
+
/// @return {Number} - Size expressed in pixels.
|
|
35
51
|
@function rem_to_px($size, $base: 16px) {
|
|
36
52
|
@return $size * $base;
|
|
37
53
|
}
|
|
38
54
|
|
|
55
|
+
///
|
|
56
|
+
/// Converts `em` units to pixels using a context size.
|
|
57
|
+
///
|
|
58
|
+
/// @name em_to_px
|
|
59
|
+
/// @param {Number} $size - Size in em.
|
|
60
|
+
/// @param {Number} $context - Context pixel size (default: 16px).
|
|
61
|
+
/// @return {Number} - Size expressed in pixels.
|
|
39
62
|
@function em_to_px($size, $context: 16px) {
|
|
40
63
|
@return $size * $context;
|
|
41
64
|
}
|
|
42
65
|
|
|
66
|
+
///
|
|
67
|
+
/// Converts pixels to `em` units using a context size.
|
|
68
|
+
///
|
|
69
|
+
/// @name px_to_em
|
|
70
|
+
/// @param {Number} $size - Size in pixels.
|
|
71
|
+
/// @param {Number} $context - Context pixel size (default: 16px).
|
|
72
|
+
/// @return {Number} - Size expressed in em.
|
|
43
73
|
@function px_to_em($size, $context: 16px) {
|
|
44
|
-
@return $size
|
|
74
|
+
@return math.div($size, $context) * 1em;
|
|
45
75
|
}
|
|
46
76
|
|
|
47
77
|
/// Validate that the input is a pixel value
|
|
78
|
+
///
|
|
79
|
+
/// @name validate_px
|
|
80
|
+
/// @param {Number} $value - Value to validate.
|
|
81
|
+
/// @return {Number} - Returns the input when validation passes; throws otherwise.
|
|
48
82
|
@function validate_px($value) {
|
|
49
|
-
@if unit($value) != "px" {
|
|
83
|
+
@if math.unit($value) != "px" {
|
|
50
84
|
@error "Expected a pixel value, but got `#{$value}`.";
|
|
51
85
|
}
|
|
52
86
|
@return $value;
|
|
53
87
|
}
|
|
54
88
|
|
|
55
89
|
/// Convert pixels to rem
|
|
90
|
+
///
|
|
91
|
+
/// @name px_to_rem
|
|
92
|
+
/// @param {Number} $size - Size in pixels.
|
|
93
|
+
/// @return {Number} - Size expressed in rem.
|
|
56
94
|
@function px_to_rem($size) {
|
|
57
95
|
$validated_size: validate_px($size);
|
|
58
|
-
@return $validated_size
|
|
96
|
+
@return math.div($validated_size, $base-font-size) * 1rem;
|
|
59
97
|
}
|
|
60
98
|
|
|
61
99
|
/// Convert rem to pixels
|
|
100
|
+
///
|
|
101
|
+
/// @name rem_to_px
|
|
102
|
+
/// @param {Number} $size - Size in rem.
|
|
103
|
+
/// @return {Number} - Size expressed in pixels.
|
|
62
104
|
@function rem_to_px($size) {
|
|
63
|
-
@if unit($size) != "rem" {
|
|
105
|
+
@if math.unit($size) != "rem" {
|
|
64
106
|
@error "Expected a rem value, but got `#{$size}`.";
|
|
65
107
|
}
|
|
66
108
|
@return $size * $base-font-size;
|
|
67
109
|
}
|
|
68
110
|
|
|
69
111
|
/// Convert em to pixels
|
|
112
|
+
///
|
|
113
|
+
/// @name em_to_px
|
|
114
|
+
/// @param {Number} $size - Size in em.
|
|
115
|
+
/// @param {Number} $context - Context pixel size.
|
|
116
|
+
/// @return {Number} - Size expressed in pixels.
|
|
70
117
|
@function em_to_px($size, $context: $base-font-size) {
|
|
71
118
|
$validated_context: validate_px($context);
|
|
72
|
-
@if unit($size) != "em" {
|
|
119
|
+
@if math.unit($size) != "em" {
|
|
73
120
|
@error "Expected an em value, but got `#{$size}`.";
|
|
74
121
|
}
|
|
75
122
|
@return $size * $validated_context;
|
|
76
123
|
}
|
|
77
124
|
|
|
78
125
|
/// Convert pixels to em
|
|
126
|
+
///
|
|
127
|
+
/// @name px_to_em
|
|
128
|
+
/// @param {Number} $size - Size in pixels.
|
|
129
|
+
/// @param {Number} $context - Context pixel size.
|
|
130
|
+
/// @return {Number} - Size expressed in em.
|
|
79
131
|
@function px_to_em($size, $context: $base-font-size) {
|
|
80
132
|
$validated_size: validate_px($size);
|
|
81
133
|
$validated_context: validate_px($context);
|
|
82
|
-
@return $validated_size
|
|
134
|
+
@return math.div($validated_size, $validated_context) * 1em;
|
|
83
135
|
}
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
///
|
|
76
76
|
@function linear_interpolation($start, $end, $min, $max, $actual: 100vw) {
|
|
77
77
|
// Validate parameters
|
|
78
|
-
@if unitless($min) == false and unit($min) != "px" {
|
|
78
|
+
@if math.is-unitless($min) == false and math.unit($min) != "px" {
|
|
79
79
|
@error "Parameter `$min` must be unitless or in 'px'.";
|
|
80
80
|
}
|
|
81
|
-
@if unitless($max) == false and unit($max) != "px" {
|
|
81
|
+
@if math.is-unitless($max) == false and math.unit($max) != "px" {
|
|
82
82
|
@error "Parameter `$max` must be unitless or in 'px'.";
|
|
83
83
|
}
|
|
84
84
|
@if $max <= $min {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
// Convert all values to a common unit for calculation
|
|
89
|
-
$unit: 1#{unit($start)};
|
|
89
|
+
$unit: 1#{math.unit($start)};
|
|
90
90
|
|
|
91
91
|
// Convert coordinate values to unitless for calculations
|
|
92
92
|
$x0: #{unit_strip($min)};
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
@use "../variables" as *;
|
|
27
27
|
@use "../maps" as *;
|
|
28
28
|
|
|
29
|
-
|
|
30
29
|
// ============================================================================
|
|
31
30
|
// Mixins
|
|
32
31
|
// ============================================================================
|
|
@@ -34,6 +33,8 @@
|
|
|
34
33
|
///
|
|
35
34
|
/// Applies styles in landscape orientation, optionally above a min-width.
|
|
36
35
|
///
|
|
36
|
+
/// @name display_orientation_landscape
|
|
37
|
+
///
|
|
37
38
|
/// @param {Length|null} $min-width - Optional breakpoint to combine with orientation
|
|
38
39
|
///
|
|
39
40
|
/// @example scss
|
|
@@ -56,6 +57,8 @@
|
|
|
56
57
|
///
|
|
57
58
|
/// Applies styles in portrait orientation, optionally above a min-width.
|
|
58
59
|
///
|
|
60
|
+
/// @name display_orientation_portrait
|
|
61
|
+
///
|
|
59
62
|
/// @param {Length|null} $min-width - Optional breakpoint to combine with orientation
|
|
60
63
|
///
|
|
61
64
|
/// @example scss
|
|
@@ -79,6 +82,8 @@
|
|
|
79
82
|
/// Applies styles on high-density (Retina) displays.
|
|
80
83
|
/// Targets modern and older syntax for broad support.
|
|
81
84
|
///
|
|
85
|
+
/// @name display_retina
|
|
86
|
+
///
|
|
82
87
|
/// @example scss
|
|
83
88
|
/// @include display_retina {
|
|
84
89
|
/// // high-resolution styles
|
|
@@ -95,6 +100,8 @@
|
|
|
95
100
|
///
|
|
96
101
|
/// Applies styles when the screen matches a specific aspect ratio.
|
|
97
102
|
///
|
|
103
|
+
/// @name display_ratio
|
|
104
|
+
///
|
|
98
105
|
/// @param {Number} $width - The horizontal component of the aspect ratio
|
|
99
106
|
/// @param {Number} $height - The vertical component of the aspect ratio
|
|
100
107
|
///
|
|
@@ -104,7 +111,7 @@
|
|
|
104
111
|
/// }
|
|
105
112
|
///
|
|
106
113
|
@mixin display_ratio($width, $height) {
|
|
107
|
-
@media (aspect-ratio: #{ $width / $height }) {
|
|
114
|
+
@media (aspect-ratio: #{ $width } / #{ $height }) {
|
|
108
115
|
@content;
|
|
109
116
|
}
|
|
110
117
|
}
|
package/scss/mixins/_guide.scss
CHANGED
|
@@ -22,11 +22,35 @@
|
|
|
22
22
|
|
|
23
23
|
@use "sass:map";
|
|
24
24
|
@use "sass:meta";
|
|
25
|
+
@use "sass:color";
|
|
25
26
|
|
|
26
27
|
@use "../functions" as *;
|
|
27
28
|
@use "../variables" as *;
|
|
28
29
|
@use "../maps" as *;
|
|
29
30
|
|
|
31
|
+
// ----------------------------------------------------------------------------
|
|
32
|
+
// Helpers
|
|
33
|
+
// ----------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
///
|
|
36
|
+
/// Guide Z-Index Helper
|
|
37
|
+
/// ---------------------------------------------------------------------------
|
|
38
|
+
///
|
|
39
|
+
/// Resolves the z-index for guide overlays. If the project defines a `z()`
|
|
40
|
+
/// function and a `"guides"` layer in `$layers`, it uses that value; otherwise
|
|
41
|
+
/// it falls back to `9999`.
|
|
42
|
+
///
|
|
43
|
+
/// @name guide-z-index
|
|
44
|
+
/// @return {Number} - The resolved z-index for guide elements.
|
|
45
|
+
///
|
|
46
|
+
@function guide-z-index() {
|
|
47
|
+
$value: 9999;
|
|
48
|
+
@if meta.function-exists("z") {
|
|
49
|
+
$value: z("guides");
|
|
50
|
+
}
|
|
51
|
+
@return $value;
|
|
52
|
+
}
|
|
53
|
+
|
|
30
54
|
// ============================================================================
|
|
31
55
|
// Mixins
|
|
32
56
|
// ============================================================================
|
|
@@ -46,7 +70,7 @@
|
|
|
46
70
|
/// }
|
|
47
71
|
///
|
|
48
72
|
@mixin guide {
|
|
49
|
-
z-index:
|
|
73
|
+
z-index: guide-z-index();
|
|
50
74
|
position: absolute;
|
|
51
75
|
top: 0;
|
|
52
76
|
left: 0;
|
|
@@ -59,6 +83,19 @@
|
|
|
59
83
|
background-attachment: local;
|
|
60
84
|
}
|
|
61
85
|
|
|
86
|
+
///
|
|
87
|
+
/// Guide Layer Mixin
|
|
88
|
+
/// ---------------------------------------------------------------------------
|
|
89
|
+
///
|
|
90
|
+
/// Provides a single guide layer that can be toggled via the `.active` class.
|
|
91
|
+
/// Useful for composing multiple overlay layers and enabling them selectively.
|
|
92
|
+
///
|
|
93
|
+
/// @name guide--layer
|
|
94
|
+
/// @example scss - Usage
|
|
95
|
+
/// .guide-layer {
|
|
96
|
+
/// @include guide--layer;
|
|
97
|
+
/// }
|
|
98
|
+
///
|
|
62
99
|
@mixin guide--layer {
|
|
63
100
|
display: none;
|
|
64
101
|
position: absolute;
|
|
@@ -67,7 +104,7 @@
|
|
|
67
104
|
width: 100%;
|
|
68
105
|
min-height: 100vh;
|
|
69
106
|
pointer-events: none;
|
|
70
|
-
z-index:
|
|
107
|
+
z-index: guide-z-index();
|
|
71
108
|
&.active {
|
|
72
109
|
display: block !important;
|
|
73
110
|
}
|
|
@@ -127,7 +164,8 @@
|
|
|
127
164
|
background-repeat: repeat;
|
|
128
165
|
background-size: $column_width $row_height;
|
|
129
166
|
|
|
130
|
-
background-image:
|
|
167
|
+
background-image:
|
|
168
|
+
repeating-linear-gradient(
|
|
131
169
|
to right,
|
|
132
170
|
$column_color 0,
|
|
133
171
|
$column_color 1px,
|
|
@@ -143,6 +181,25 @@
|
|
|
143
181
|
);
|
|
144
182
|
}
|
|
145
183
|
|
|
184
|
+
///
|
|
185
|
+
/// Centered Graph Guide Mixin
|
|
186
|
+
/// ---------------------------------------------------------------------------
|
|
187
|
+
///
|
|
188
|
+
/// Renders a grid overlay centered in the viewport by offsetting the grid so
|
|
189
|
+
/// the middle column aligns with the viewport center.
|
|
190
|
+
///
|
|
191
|
+
/// @name guide--graph_centered
|
|
192
|
+
/// @param {Number} $columns - Number of columns in the grid.
|
|
193
|
+
/// @param {Length} $column_width - Width of each column.
|
|
194
|
+
/// @param {Length} $row_height - Height of each row.
|
|
195
|
+
/// @param {Color} $column_color - Color of the column lines. Defaults to `$guide--graph_primary`.
|
|
196
|
+
/// @param {Color} $baseline_color - Color of the baseline lines. Defaults to `$guide--graph_primary`.
|
|
197
|
+
///
|
|
198
|
+
/// @example scss - Usage
|
|
199
|
+
/// .guide--graph-centered {
|
|
200
|
+
/// @include guide--graph_centered(12, 60px, 20px);
|
|
201
|
+
/// }
|
|
202
|
+
///
|
|
146
203
|
@mixin guide--graph_centered(
|
|
147
204
|
$columns: 12,
|
|
148
205
|
$column_width: baseline(4),
|
|
@@ -161,7 +218,8 @@
|
|
|
161
218
|
|
|
162
219
|
background-position: $half_offset 0;
|
|
163
220
|
|
|
164
|
-
background-image:
|
|
221
|
+
background-image:
|
|
222
|
+
repeating-linear-gradient(
|
|
165
223
|
to right,
|
|
166
224
|
$column_color 0,
|
|
167
225
|
$column_color 1px,
|
|
@@ -216,8 +274,8 @@
|
|
|
216
274
|
/// @name guide--baseline
|
|
217
275
|
/// @param {Length} $column_width - The width of each column in the grid.
|
|
218
276
|
/// @param {Length} $baseline_height - The height of each baseline.
|
|
219
|
-
/// @param {Color} $column_color - The color of the column lines. Defaults to
|
|
220
|
-
/// @param {Color} $baseline_color - The color of the baseline lines. Defaults to
|
|
277
|
+
/// @param {Color} $column_color - The color of the column lines. Defaults to `color.change(rgb(200, 0, 0), $alpha: 0.2)`.
|
|
278
|
+
/// @param {Color} $baseline_color - The color of the baseline lines. Defaults to `$guide--color`.
|
|
221
279
|
///
|
|
222
280
|
/// @example scss - Usage
|
|
223
281
|
/// .guide--baseline {
|
|
@@ -227,10 +285,11 @@
|
|
|
227
285
|
@mixin grid_baseline(
|
|
228
286
|
$column_width,
|
|
229
287
|
$baseline_height,
|
|
230
|
-
$column_color:
|
|
288
|
+
$column_color: color.change(rgb(200, 0, 0), $alpha: 0.2),
|
|
231
289
|
$baseline_color: $guide--color
|
|
232
290
|
) {
|
|
233
|
-
background-image:
|
|
291
|
+
background-image:
|
|
292
|
+
linear-gradient(
|
|
234
293
|
to right,
|
|
235
294
|
$column_color 0 $column_width,
|
|
236
295
|
transparent $column_width transparent
|
|
@@ -254,14 +313,17 @@
|
|
|
254
313
|
///
|
|
255
314
|
/// @name guide--margin
|
|
256
315
|
/// @param {Length} $margin - The size of the margin to visualize.
|
|
257
|
-
/// @param {Color} $color - The color of the margin area. Defaults to
|
|
316
|
+
/// @param {Color} $color - The color of the margin area. Defaults to `color.change(rgb(0, 255, 0), $alpha: 0.1)`.
|
|
258
317
|
///
|
|
259
318
|
/// @example scss - Usage
|
|
260
319
|
/// .guide--margin {
|
|
261
|
-
/// @include guide--margin(20px,
|
|
320
|
+
/// @include guide--margin(20px, color.change(rgb(0, 255, 0), $alpha: 0.1));
|
|
262
321
|
/// }
|
|
263
322
|
///
|
|
264
|
-
@mixin guide--margin(
|
|
323
|
+
@mixin guide--margin(
|
|
324
|
+
$margin,
|
|
325
|
+
$color: color.change(rgb(0, 255, 0), $alpha: 0.1)
|
|
326
|
+
) {
|
|
265
327
|
@include guide;
|
|
266
328
|
top: $margin;
|
|
267
329
|
left: $margin;
|
package/scss/mixins/_paper.scss
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// Use
|
|
21
21
|
// ============================================================================
|
|
22
|
+
@use "sass:map";
|
|
22
23
|
|
|
23
24
|
@use "../functions" as *;
|
|
24
25
|
@use "../variables" as *;
|
|
@@ -41,11 +42,11 @@
|
|
|
41
42
|
/// }
|
|
42
43
|
///
|
|
43
44
|
@mixin set_paper_size($size) {
|
|
44
|
-
@if map
|
|
45
|
+
@if map.has-key($paper-sizes, $size) {
|
|
45
46
|
$size-map: map.get($paper-sizes, $size);
|
|
46
47
|
width: map.get($size-map, width);
|
|
47
48
|
height: map.get($size-map, height);
|
|
48
49
|
} @else {
|
|
49
|
-
@warn "Invalid paper size: #{$size}. Available sizes are: #{map
|
|
50
|
+
@warn "Invalid paper size: #{$size}. Available sizes are: #{map.keys($paper-sizes)}.";
|
|
50
51
|
}
|
|
51
52
|
}
|
package/scss/mixins/_view.scss
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
// ============================================================================
|
|
22
22
|
// Use
|
|
23
23
|
// ============================================================================
|
|
24
|
+
@use "sass:map";
|
|
24
25
|
|
|
25
26
|
@use "../variables" as *;
|
|
26
27
|
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
/// }
|
|
44
45
|
///
|
|
45
46
|
@mixin breakpoint($size) {
|
|
46
|
-
@if map
|
|
47
|
+
@if map.has-key($breakpoints, $size) {
|
|
47
48
|
@media (min-width: map.get($breakpoints, $size)) {
|
|
48
49
|
@content;
|
|
49
50
|
}
|
package/scss/tags/_global.scss
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
////
|
|
2
|
+
///
|
|
3
|
+
/// Global Tags Module
|
|
4
|
+
/// =========================================================================
|
|
5
|
+
///
|
|
6
|
+
/// Base element resets and global defaults for `html`, `body`, and
|
|
7
|
+
/// universal selectors. Provides consistent box-sizing, text adjustments,
|
|
8
|
+
/// and baseline resets that apply across the application.
|
|
9
|
+
///
|
|
10
|
+
/// @group Tags
|
|
11
|
+
/// @author Scape Agency
|
|
12
|
+
/// @link https://unit.gl
|
|
13
|
+
/// @since 0.1.0 initial release
|
|
14
|
+
/// @todo None
|
|
15
|
+
/// @access public
|
|
16
|
+
///
|
|
17
|
+
////
|
|
18
|
+
|
|
1
19
|
// Base | Body
|
|
2
20
|
// ============================================================================
|
|
3
21
|
|
package/scss/test.scss
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
////
|
|
2
|
+
///
|
|
3
|
+
/// Test Styles Module
|
|
4
|
+
/// =========================================================================
|
|
5
|
+
///
|
|
6
|
+
/// Placeholder for ad-hoc style tests and experiments. Not included in
|
|
7
|
+
/// production builds; used locally to validate mixins, functions, and
|
|
8
|
+
/// variables during development.
|
|
9
|
+
///
|
|
10
|
+
/// @group Dev
|
|
11
|
+
/// @author Scape Agency
|
|
12
|
+
/// @link https://unit.gl
|
|
13
|
+
/// @since 0.1.0 initial release
|
|
14
|
+
/// @todo Replace with targeted component/style demos when needed
|
|
15
|
+
/// @access private
|
|
16
|
+
///
|
|
17
|
+
////
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// Use
|
|
21
21
|
// ============================================================================
|
|
22
|
+
@use "sass:color";
|
|
22
23
|
|
|
23
24
|
// ============================================================================
|
|
24
25
|
// Variables
|
|
@@ -29,10 +30,9 @@ $guide--baseline_secondary: rgb(125, 181, 203);
|
|
|
29
30
|
|
|
30
31
|
$guide--color: rgb(0, 200, 255);
|
|
31
32
|
|
|
32
|
-
$guide--graph_primary:
|
|
33
|
-
|
|
34
|
-
$guide--bleed_primary: rgba(178, 51, 170, 0.5);
|
|
33
|
+
$guide--graph_primary: color.change(rgb(111, 124, 126), $alpha: 0.483);
|
|
35
34
|
|
|
35
|
+
$guide--bleed_primary: color.change(rgb(178, 51, 170), $alpha: 0.5);
|
|
36
36
|
|
|
37
37
|
///
|
|
38
38
|
/// Primary Guide Color
|
|
@@ -40,7 +40,7 @@ $guide--bleed_primary: rgba(178, 51, 170, 0.5);
|
|
|
40
40
|
///
|
|
41
41
|
/// Neutral gray for general guide overlays
|
|
42
42
|
///
|
|
43
|
-
$guide--color_primary:
|
|
43
|
+
$guide--color_primary: color.change(rgb(50, 50, 50), $alpha: 0.25);
|
|
44
44
|
|
|
45
45
|
///
|
|
46
46
|
/// Secondary Guide Color
|
|
@@ -48,7 +48,7 @@ $guide--color_primary: rgba(50, 50, 50, 0.25);
|
|
|
48
48
|
///
|
|
49
49
|
/// Highlight color for key guides or emphasis
|
|
50
50
|
///
|
|
51
|
-
$guide--color_secondary:
|
|
51
|
+
$guide--color_secondary: color.change(rgb(178, 51, 170), $alpha: 0.5);
|
|
52
52
|
|
|
53
53
|
///
|
|
54
54
|
/// Tertiary Guide Color (Extended)
|
|
@@ -56,7 +56,7 @@ $guide--color_secondary: rgba(178, 51, 170, 0.5);
|
|
|
56
56
|
///
|
|
57
57
|
/// A warm orange for alternate guide markings
|
|
58
58
|
///
|
|
59
|
-
$guide--color_tertiary:
|
|
59
|
+
$guide--color_tertiary: color.change(rgb(255, 102, 0), $alpha: 0.3);
|
|
60
60
|
|
|
61
61
|
///
|
|
62
62
|
/// Quaternary Guide Color (Extended)
|
|
@@ -64,7 +64,7 @@ $guide--color_tertiary: rgba(255, 102, 0, 0.3);
|
|
|
64
64
|
///
|
|
65
65
|
/// A cool blue for additional grid or alignment lines
|
|
66
66
|
///
|
|
67
|
-
$guide--color_quaternary:
|
|
67
|
+
$guide--color_quaternary: color.change(rgb(0, 102, 255), $alpha: 0.3);
|
|
68
68
|
|
|
69
69
|
///
|
|
70
70
|
/// Light Guide Color (Extended)
|
|
@@ -72,7 +72,7 @@ $guide--color_quaternary: rgba(0, 102, 255, 0.3);
|
|
|
72
72
|
///
|
|
73
73
|
/// Light color for subtle or background guides
|
|
74
74
|
///
|
|
75
|
-
$guide--color_light:
|
|
75
|
+
$guide--color_light: color.change(rgb(255, 255, 255), $alpha: 0.2);
|
|
76
76
|
|
|
77
77
|
///
|
|
78
78
|
/// Dark Guide Color (Extended)
|
|
@@ -80,4 +80,4 @@ $guide--color_light: rgba(255, 255, 255, 0.2);
|
|
|
80
80
|
///
|
|
81
81
|
/// Dark color for use on lighter backgrounds
|
|
82
82
|
///
|
|
83
|
-
$guide--color_dark:
|
|
83
|
+
$guide--color_dark: color.change(rgb(0, 0, 0), $alpha: 0.2);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
////
|
|
2
|
+
///
|
|
3
|
+
/// Guide Variables Module
|
|
4
|
+
/// =========================================================================
|
|
5
|
+
///
|
|
6
|
+
/// Reserved for variables related to visual guides (grid overlays,
|
|
7
|
+
/// baselines, alignment helpers). Centralizing guide-specific variables
|
|
8
|
+
/// here keeps concerns separated from general color or layout variables.
|
|
9
|
+
///
|
|
10
|
+
/// @group Variables
|
|
11
|
+
/// @author Scape Agency
|
|
12
|
+
/// @link https://unit.gl
|
|
13
|
+
/// @since 0.1.0 initial release
|
|
14
|
+
/// @todo Populate with guide-specific tokens as they are formalized
|
|
15
|
+
/// @access public
|
|
16
|
+
///
|
|
17
|
+
////
|