@birdycom/omniacss 0.0.0-stage → 0.11.0
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/LICENSE +21 -0
- package/README.md +43 -2
- package/dist/oc-colors.css +4429 -0
- package/dist/oc-theme.css +69 -0
- package/dist/omnia.css +465435 -0
- package/dist/omnia.min.css +2 -0
- package/dist/omnia.starter.css +13459 -0
- package/dist/omnia.starter.min.css +1 -0
- package/dist/tokens/omnia.dtcg.json +1496 -0
- package/dist/tokens/omnia.tokens.json +580 -0
- package/dist/tokens/omnia_tokens.py +189 -0
- package/package.json +61 -4
- package/scss/base/_reset.scss +88 -0
- package/scss/config/omniacss.config.scss +114 -0
- package/scss/config/omniacss.fonts.scss +34 -0
- package/scss/functions/_functions.scss +407 -0
- package/scss/json/html-colors.json +1998 -0
- package/scss/json/omnia-colors.json +500 -0
- package/scss/json/ral-colors.json +3430 -0
- package/scss/layout/_media_query.scss +18 -0
- package/scss/omnia_colors.scss +7 -0
- package/scss/omnia_main.scss +143 -0
- package/scss/profiles/omnia_main.hsl.scss +12 -0
- package/scss/profiles/omnia_main.oklab.scss +12 -0
- package/scss/profiles/omnia_main.oklch.scss +12 -0
- package/scss/utilities/_accessibility.scss +42 -0
- package/scss/utilities/_alignment.scss +861 -0
- package/scss/utilities/_anchor_positioning.scss +65 -0
- package/scss/utilities/_animation_properties.scss +143 -0
- package/scss/utilities/_aspect.scss +73 -0
- package/scss/utilities/_backgrounds.scss +49 -0
- package/scss/utilities/_borders_extended.scss +97 -0
- package/scss/utilities/_borders_outlines.scss +161 -0
- package/scss/utilities/_clamp.scss +111 -0
- package/scss/utilities/_colors_html.scss +341 -0
- package/scss/utilities/_colors_mix.scss +84 -0
- package/scss/utilities/_colors_omnia.scss +315 -0
- package/scss/utilities/_colors_ral.scss +151 -0
- package/scss/utilities/_colors_tokens.scss +87 -0
- package/scss/utilities/_container.scss +58 -0
- package/scss/utilities/_containment.scss +82 -0
- package/scss/utilities/_corner_shape.scss +30 -0
- package/scss/utilities/_css_functions.scss +34 -0
- package/scss/utilities/_dark_mode.scss +117 -0
- package/scss/utilities/_display.scss +58 -0
- package/scss/utilities/_drop_shadow_colors.scss +26 -0
- package/scss/utilities/_effects.scss +50 -0
- package/scss/utilities/_effects_advanced.scss +102 -0
- package/scss/utilities/_experimental_css.scss +149 -0
- package/scss/utilities/_filters.scss +89 -0
- package/scss/utilities/_flexbox.scss +318 -0
- package/scss/utilities/_font_variants.scss +139 -0
- package/scss/utilities/_fonts.scss +276 -0
- package/scss/utilities/_gap.scss +104 -0
- package/scss/utilities/_gradient_stops.scss +48 -0
- package/scss/utilities/_gradients.scss +99 -0
- package/scss/utilities/_grid.scss +673 -0
- package/scss/utilities/_index.scss +22 -0
- package/scss/utilities/_interactivity.scss +198 -0
- package/scss/utilities/_layering.scss +24 -0
- package/scss/utilities/_layout_extras.scss +171 -0
- package/scss/utilities/_layout_flow.scss +210 -0
- package/scss/utilities/_mask_extras.scss +62 -0
- package/scss/utilities/_motion_transforms.scss +167 -0
- package/scss/utilities/_overflow.scss +41 -0
- package/scss/utilities/_position.scss +49 -0
- package/scss/utilities/_responsive.scss +272 -0
- package/scss/utilities/_scroll_animations.scss +80 -0
- package/scss/utilities/_scroll_spacing.scss +33 -0
- package/scss/utilities/_scrollbar.scss +49 -0
- package/scss/utilities/_shadow_tokens.scss +21 -0
- package/scss/utilities/_shapes.scss +72 -0
- package/scss/utilities/_sizing.scss +458 -0
- package/scss/utilities/_sizing_logical.scss +99 -0
- package/scss/utilities/_space_divide.scss +85 -0
- package/scss/utilities/_spacing_margin.scss +199 -0
- package/scss/utilities/_spacing_padding.scss +195 -0
- package/scss/utilities/_starting_style.scss +53 -0
- package/scss/utilities/_state_variants.scss +196 -0
- package/scss/utilities/_svg.scss +100 -0
- package/scss/utilities/_table.scss +46 -0
- package/scss/utilities/_table_advanced.scss +19 -0
- package/scss/utilities/_text.scss +1331 -0
- package/scss/utilities/_transforms_3d.scss +76 -0
- package/scss/utilities/_typography_advanced.scss +124 -0
- package/scss/utilities/_typography_modern.scss +83 -0
- package/scss/utilities/_view_transitions.scss +64 -0
- package/scss/utilities/_writing_modes.scss +72 -0
- package/scss/variables/_color_tone.scss +39 -0
- package/scss/variables/_hulp.scss +108 -0
- package/scss/variables/_mixins.scss +40 -0
- package/scss/variables/_modifiers.scss +32 -0
- package/scss/variables/_variables.scss +302 -0
- package/scss/variables/_variables_colors_html.scss +2019 -0
- package/scss/variables/_variables_colors_omnia.scss +465 -0
- package/scss/variables/_variables_colors_ral.scss +3472 -0
- package/scss/variables/_variables_effects.scss +109 -0
- package/scss/variables/_variables_flex_grid.scss +427 -0
- package/scss/variables/_variables_layout.scss +591 -0
- package/scss/variables/_variables_typography.scss +550 -0
- package/src/engine.mjs +258 -0
- package/src/postcss.mjs +43 -0
- package/src/starter-classes.mjs +124 -0
- package/src/tokens.mjs +377 -0
- package/src/variants.mjs +278 -0
- package/tokens/semantic.json +80 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
// SCSS Document
|
|
2
|
+
// File: src/scss/utilities/_functions.scss
|
|
3
|
+
// Description: All the sass functions
|
|
4
|
+
// Copyright: 2021-2022 Birdycom
|
|
5
|
+
// Autor: Serge Cools
|
|
6
|
+
// Version: 0.2.0
|
|
7
|
+
// Framework: OmniaCSS
|
|
8
|
+
// Functions: str_replace
|
|
9
|
+
@use "sass:math";
|
|
10
|
+
@use "sass:list";
|
|
11
|
+
@use "sass:string";
|
|
12
|
+
@use '../config/omniacss.config.scss' as *;
|
|
13
|
+
///
|
|
14
|
+
/// The functions
|
|
15
|
+
/// @group Functions
|
|
16
|
+
///
|
|
17
|
+
|
|
18
|
+
///
|
|
19
|
+
/// Replace `$search` with `$replace` in `$string` for sass
|
|
20
|
+
/// @group Functions
|
|
21
|
+
///
|
|
22
|
+
/// @name str-replace
|
|
23
|
+
///
|
|
24
|
+
/// @since 1.0.0
|
|
25
|
+
/// @author Serge Cools
|
|
26
|
+
///
|
|
27
|
+
/// @param {String} $string - Initial string
|
|
28
|
+
/// @param {String} $search - Substring to replace
|
|
29
|
+
/// @param {String} $replace ('') - New value
|
|
30
|
+
/// @return {String} - Updated string
|
|
31
|
+
@function str-replace($string, $search, $replace: '') {
|
|
32
|
+
$index: string.index($string, $search);
|
|
33
|
+
|
|
34
|
+
@if $index {
|
|
35
|
+
@return string.slice($string, 1, $index - 1) + $replace + str-replace(string.slice($string, $index + string.length($search)), $search, $replace);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@return $string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
///
|
|
42
|
+
/// Replace `$search` with `$trim` in `$string` for sass
|
|
43
|
+
/// @group Functions
|
|
44
|
+
///
|
|
45
|
+
/// @name str-trim
|
|
46
|
+
///
|
|
47
|
+
/// @since 1.0.0
|
|
48
|
+
/// @author Serge Cools
|
|
49
|
+
///
|
|
50
|
+
/// @param {String} $string - Initial string
|
|
51
|
+
/// @param {String} $search - Substring to replace
|
|
52
|
+
/// @param {String} $replace ('') - New value
|
|
53
|
+
/// @return {String} - Updated string
|
|
54
|
+
@function str-trim($string) {
|
|
55
|
+
@if (string.slice($string, 1, 1) == ' ') {
|
|
56
|
+
@return str-trim(string.slice($string, 2));
|
|
57
|
+
} @else if (string.slice($string, string.length($string), -1) == ' ') {
|
|
58
|
+
@return str-trim(string.slice($string, 1, -2));
|
|
59
|
+
} @else {
|
|
60
|
+
@return $string;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// @see https://github.com/zurb/foundation/blob/master/scss/foundation/_functions.scss
|
|
65
|
+
// CASTING A STRING TO A NUMBER
|
|
66
|
+
// @see http://hugogiraudel.com/2014/01/15/sass-string-to-number/
|
|
67
|
+
|
|
68
|
+
///
|
|
69
|
+
/// This code defines a SASS function called "omnia-length" that takes two arguments: a number and a unit.
|
|
70
|
+
/// It then creates two lists: $strings and $units.
|
|
71
|
+
/// The $strings list holds strings representing various CSS unit types, while the $units list holds numerical values for each unit type.
|
|
72
|
+
///
|
|
73
|
+
/// The function then uses the SASS index function to find the index of the unit type passed in as an argument.
|
|
74
|
+
/// If the unit type is not found in the $strings list, the function issues a warning message and returns false.
|
|
75
|
+
///
|
|
76
|
+
/// If the unit is successfully found, the function multiplies the numerical value of the input number by
|
|
77
|
+
/// the corresponding value in the $units list and returns the result.
|
|
78
|
+
///
|
|
79
|
+
/// @group Functions
|
|
80
|
+
///
|
|
81
|
+
/// @name omnia-length
|
|
82
|
+
///
|
|
83
|
+
/// @since 1.0.0
|
|
84
|
+
/// @author Serge Cools
|
|
85
|
+
///
|
|
86
|
+
/// @param {Number} $number - the given number
|
|
87
|
+
/// @param {String} $unit - the type of unit (px, cm, mm, %, ch, pica, in, em, rem, pt, pc, ex, vw, vh, vmin, vmax)
|
|
88
|
+
/// @return {String} - the string that was mutiplies with the number and also get the value of the unit.
|
|
89
|
+
@function omnia-length($number, $unit) {
|
|
90
|
+
$strings: "px" "cm" "mm" "%" "ch" "pica" "in" "em" "rem" "pt" "pc" "ex" "vw" "vh" "vmin" "vmax";
|
|
91
|
+
$units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax;
|
|
92
|
+
$index: list.index($strings, $unit);
|
|
93
|
+
|
|
94
|
+
@if not $index {
|
|
95
|
+
@warn "Invalid unit `#{$unit}`.";
|
|
96
|
+
|
|
97
|
+
@return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@return $number * list.nth($units, $index);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
///
|
|
104
|
+
/// This code defines a function called "omnia-number" that takes in a string as an argument.
|
|
105
|
+
/// The function then loops through each character in the string and determines if it is a digit or
|
|
106
|
+
/// a separator (a hyphen or a period). If the character is a digit, it is added to the result.
|
|
107
|
+
/// If the character is a separator, the code sets a flag to indicate that the next digit is to the
|
|
108
|
+
/// right of the decimal place. The final result is returned as a number.
|
|
109
|
+
/// If the string begins with a hyphen, the result will be made negative.
|
|
110
|
+
/// If there are any invalid characters in the string, the function will return NaN.
|
|
111
|
+
///
|
|
112
|
+
/// @group Functions
|
|
113
|
+
///
|
|
114
|
+
/// @name omnia-number
|
|
115
|
+
///
|
|
116
|
+
/// @since 1.0.0
|
|
117
|
+
/// @author Serge Cools
|
|
118
|
+
///
|
|
119
|
+
/// @param {String} $string - the given string
|
|
120
|
+
/// @return {String} - a number.
|
|
121
|
+
///
|
|
122
|
+
@function omnia-number($string) {
|
|
123
|
+
// Matrices
|
|
124
|
+
$strings: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9";
|
|
125
|
+
$numbers: 0 1 2 3 4 5 6 7 8 9;
|
|
126
|
+
|
|
127
|
+
// Result
|
|
128
|
+
$result: 0;
|
|
129
|
+
$divider: 0;
|
|
130
|
+
$minus: false;
|
|
131
|
+
|
|
132
|
+
// Looping through all characters
|
|
133
|
+
@for $i from 1 through string.length($string) {
|
|
134
|
+
$character: string.slice($string, $i, $i);
|
|
135
|
+
$index: list.index($strings, $character);
|
|
136
|
+
|
|
137
|
+
@if $character == "-" {
|
|
138
|
+
$minus: true;
|
|
139
|
+
}
|
|
140
|
+
@else if $character == "." {
|
|
141
|
+
$divider: 1;
|
|
142
|
+
}
|
|
143
|
+
@else {
|
|
144
|
+
@if not $index {
|
|
145
|
+
@if $minus {
|
|
146
|
+
$result: $result * -1;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@return omnia-length($result, string.slice($string, $i));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
$number: list.nth($numbers, $index);
|
|
153
|
+
|
|
154
|
+
@if $divider == 0 {
|
|
155
|
+
$result: $result * 10;
|
|
156
|
+
}
|
|
157
|
+
@else {
|
|
158
|
+
// Move the decimal dot to the left
|
|
159
|
+
$divider: $divider * 10;
|
|
160
|
+
$number: math.div($number, $divider);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
$result: $result + $number;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@if $minus {
|
|
168
|
+
@return $result * -1;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@return $result;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// UNIT MANAGER
|
|
175
|
+
// @see https://github.com/zurb/foundation/blob/master/scss/foundation/_functions.scss
|
|
176
|
+
|
|
177
|
+
///
|
|
178
|
+
/// This code defines a function called "omnia-strip-unit" that removes the unit from a CSS value passed as a parameter.
|
|
179
|
+
/// The parameter is named "$num" and is expected to be a numeric value with a unit attached (e.g. "10px" or "5em").
|
|
180
|
+
///
|
|
181
|
+
/// The function uses the Sass built-in function "math.div" to divide the value by itself multiplied by 0 plus 1.
|
|
182
|
+
/// This "tricks" Sass into removing the unit from the value, effectively returning just the numeric part of
|
|
183
|
+
/// the original value.
|
|
184
|
+
///
|
|
185
|
+
/// The function then returns the stripped numeric value.
|
|
186
|
+
///
|
|
187
|
+
/// @group Functions
|
|
188
|
+
///
|
|
189
|
+
/// @name omnia-strip-unit
|
|
190
|
+
///
|
|
191
|
+
/// @since 1.0.0
|
|
192
|
+
/// @author Serge Cools
|
|
193
|
+
///
|
|
194
|
+
/// @param {number} $num - the given string
|
|
195
|
+
/// @return {number} - a stripped numeric value.
|
|
196
|
+
///
|
|
197
|
+
@function omnia-strip-unit($num) {
|
|
198
|
+
|
|
199
|
+
@return math.div($num , ($num * 0 + 1));
|
|
200
|
+
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
///
|
|
204
|
+
/// This code defines a SASS function called omnia-convert that takes two required arguments unit and value,
|
|
205
|
+
/// and one optional argument base-font-size.
|
|
206
|
+
/// The function converts a value from one unit to another based on the base-font-size.
|
|
207
|
+
/// The unit argument specifies the unit to which the value will be converted.
|
|
208
|
+
/// The default value of base-font-size is set to $DEFAULT-BASE-FONT-SIZE.
|
|
209
|
+
///
|
|
210
|
+
/// The function uses SASS' built-in math.div() and math.add() functions to perform the necessary calculations.
|
|
211
|
+
/// It strips the unit from the value and the base-font-size arguments using the custom omnia-strip-unit() function
|
|
212
|
+
/// and then calculates the result using basic arithmetic operations.
|
|
213
|
+
///
|
|
214
|
+
/// An if statement is used to check whether the final result should be 0 plus the unit.
|
|
215
|
+
/// If so, the function sets the result to 0 to avoid unnecessary 0 values with units.
|
|
216
|
+
/// Finally, the calculated value is returned using the SASS @return directive.
|
|
217
|
+
///
|
|
218
|
+
/// @group Functions
|
|
219
|
+
///
|
|
220
|
+
/// @name omnia-convert
|
|
221
|
+
///
|
|
222
|
+
/// @since 1.0.0
|
|
223
|
+
/// @author Serge Cools
|
|
224
|
+
///
|
|
225
|
+
/// @param {string} $unit - the target unit to which the input value should be converted
|
|
226
|
+
/// @param {string} $value - the input value to be converted
|
|
227
|
+
/// @param {string} $base-font-size - The setting of the base font size, if not set then the default setting
|
|
228
|
+
/// @return {string} - the converted value with the target unit.
|
|
229
|
+
///
|
|
230
|
+
@function omnia-convert($unit, $value, $base-font-size : $DEFAULT-BASE-FONT-SIZE) {
|
|
231
|
+
|
|
232
|
+
$value: math.div(omnia-strip-unit($value), omnia-strip-unit($base-font-size)) * omnia-number(1 + $unit);
|
|
233
|
+
|
|
234
|
+
@if $value == 0 + $unit {
|
|
235
|
+
$value: 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@return $value;
|
|
239
|
+
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// REM AND EM CALCULATOR
|
|
243
|
+
|
|
244
|
+
///
|
|
245
|
+
/// Function for making the px to rem
|
|
246
|
+
/// This code defines a SCSS/Sass function named omnia-px2rem that takes two parameters,
|
|
247
|
+
/// $px and $base-font-size (which defaults to $DEFAULT-BASE-FONT-SIZE).
|
|
248
|
+
///
|
|
249
|
+
/// The purpose of the function is to convert a given value in pixels to rems (a relative unit used to specify font-sizes).
|
|
250
|
+
/// It does so by dividing $px by $base-font-size and then multiplying that by 1rem.
|
|
251
|
+
///
|
|
252
|
+
/// The resulting value is returned by the function using the @return directive.
|
|
253
|
+
/// @group Functions
|
|
254
|
+
///
|
|
255
|
+
/// @name omnia-px2rem
|
|
256
|
+
///
|
|
257
|
+
/// @since 1.0.0
|
|
258
|
+
/// @author Serge Cools
|
|
259
|
+
///
|
|
260
|
+
/// @param {String} $px - is the size value in pixels that needs to be converted to rem
|
|
261
|
+
/// @param {String} $base-font-size - is the base font size from which the rem calculations will be based.
|
|
262
|
+
/// The default is set to $DEFAULT-BASE-FONT-SIZE.
|
|
263
|
+
/// @return {String} - result of the conversion in rem units
|
|
264
|
+
///
|
|
265
|
+
@function omnia-px2rem($px, $base-font-size: $DEFAULT-BASE-FONT-SIZE) {
|
|
266
|
+
|
|
267
|
+
@return omnia-convert("rem", $px , $base-font-size);
|
|
268
|
+
|
|
269
|
+
}
|
|
270
|
+
// The code defines a SASS function called "omnia-px2rem" that takes
|
|
271
|
+
// two parameters: $px is the size in pixels (to be converted to rem), and $base-font-size (optional) is the base font size in pixels.
|
|
272
|
+
// The function uses math to calculate the corresponding size in rem by dividing the input size by the base font size and multiplying by 1rem.
|
|
273
|
+
// It then returns the calculated value as the output of the function.
|
|
274
|
+
// This function can be used in SASS code to convert pixel sizes to rem sizes for responsive design.
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
///
|
|
278
|
+
/// Function for making the px to em
|
|
279
|
+
/// This code defines a SCSS/Sass function named omnia-px2em that takes two parameters,
|
|
280
|
+
/// $px and $base-font-size (which defaults to $DEFAULT-BASE-FONT-SIZE).
|
|
281
|
+
///
|
|
282
|
+
/// The purpose of the function is to convert a given value in pixels to rems (a relative unit used to specify font-sizes).
|
|
283
|
+
/// It does so by dividing $px by $base-font-size and then multiplying that by 1em.
|
|
284
|
+
///
|
|
285
|
+
/// The resulting value is returned by the function using the @return directive.
|
|
286
|
+
/// @group Functions
|
|
287
|
+
///
|
|
288
|
+
/// @name omnia-px2em
|
|
289
|
+
///
|
|
290
|
+
/// @since 1.0.0
|
|
291
|
+
/// @author Serge Cools
|
|
292
|
+
///
|
|
293
|
+
/// @param {String} $px - is the size value in pixels that needs to be converted to em
|
|
294
|
+
/// @param {String} $base-font-size - is the base font size from which the rem calculations will be based.
|
|
295
|
+
/// The default is set to $DEFAULT-BASE-FONT-SIZE.
|
|
296
|
+
/// @return {String} - result of the conversion in rem units
|
|
297
|
+
///
|
|
298
|
+
@function omnia-px2em($px, $base-font-size: $DEFAULT-BASE-FONT-SIZE) {
|
|
299
|
+
|
|
300
|
+
@return omnia-convert("em", $px , $base-font-size);
|
|
301
|
+
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
///
|
|
306
|
+
/// This is a Sass function called "omnia-generate-sizing".
|
|
307
|
+
/// The purpose of this function is to generate CSS classes with different sizing based on a
|
|
308
|
+
/// given minimum size value, a step increment, and a prefix.
|
|
309
|
+
/// This function takes in three parameters:
|
|
310
|
+
///
|
|
311
|
+
/// The function first initializes two variables, "$css-classe" and "$command", both set to "null".
|
|
312
|
+
/// Then it creates the "$command" variable by concatenating the provided $min-group value with a CSS command.
|
|
313
|
+
/// The $value variable is assigned the value of "$min-group" converted from pixels to rems,
|
|
314
|
+
/// and "$valuetrim" is assigned the value of "$value" without the "rem" unit.
|
|
315
|
+
///
|
|
316
|
+
/// The function then uses conditional statements to determine the class name to be generated.
|
|
317
|
+
/// If "$value" is equal to 0rem, "$css-classe" will be set to 0. Otherwise,
|
|
318
|
+
/// if "$valuetrim" is greater than or equal to 10, "$css-classe" will be set to the first
|
|
319
|
+
/// four digits of "$valuetrim" with a period replaced by a backslash. Finally, if "$valuetrim"
|
|
320
|
+
/// is between 1 and 9, "$css-classe" will be set to the first three digits of "$valuetrim"
|
|
321
|
+
/// with a period replaced by a backslash. This class name is then associated with the current
|
|
322
|
+
/// "$min-group" value, and the process is repeated for the next size using the incremented minimum size.
|
|
323
|
+
///
|
|
324
|
+
/// The function returns a list containing five values: the new minimum size,
|
|
325
|
+
/// the generated class name, the "$value" converted to rems, the CSS command, and the prefix.
|
|
326
|
+
/// This list can be used to generate the appropriate CSS properties for each generated class.
|
|
327
|
+
/// @group Functions
|
|
328
|
+
///
|
|
329
|
+
/// @name omnia-generate-sizing
|
|
330
|
+
///
|
|
331
|
+
/// @since 1.0.0
|
|
332
|
+
/// @author Serge Cools
|
|
333
|
+
///
|
|
334
|
+
/// @param {String} $min-group - The starting minimum size for the generated classes
|
|
335
|
+
/// @param {String} $step - The increment by which the minimum size will increase for each generated class.
|
|
336
|
+
/// @param {String} $prefix - A string that will be appended to the beginning of each class name.
|
|
337
|
+
///
|
|
338
|
+
/// @return {List} - a list containing five values: the new minimum size,
|
|
339
|
+
/// the generated class name, the "$value" converted to rems, the CSS command, and the prefix.
|
|
340
|
+
///
|
|
341
|
+
@function omnia-generate-sizing($min-group, $prefix, $auto: false, $run ){
|
|
342
|
+
|
|
343
|
+
$css-classe: null;
|
|
344
|
+
$command: null;
|
|
345
|
+
$step: null;
|
|
346
|
+
|
|
347
|
+
// setting for auto
|
|
348
|
+
@if $auto == true and $run == 0 and $min-group == 0 {
|
|
349
|
+
|
|
350
|
+
$css-classe: 'auto';
|
|
351
|
+
$auto: false;
|
|
352
|
+
$run: 1;
|
|
353
|
+
$result: (1: $min-group, 2: $css-classe, 3: auto, 4: '; /* auto */', 5: $prefix, 6: $run);
|
|
354
|
+
|
|
355
|
+
@return $result;
|
|
356
|
+
|
|
357
|
+
} @else {
|
|
358
|
+
|
|
359
|
+
$command: '; /* ' + $min-group + 'px */'; //make the css command
|
|
360
|
+
$value: omnia-px2rem($min-group);
|
|
361
|
+
$valuetrim: omnia-strip-unit($value);
|
|
362
|
+
|
|
363
|
+
// step for 1px setting
|
|
364
|
+
@if $min-group == 1 {
|
|
365
|
+
|
|
366
|
+
$set: null;
|
|
367
|
+
$set: $min-group;
|
|
368
|
+
$css-classe: 'px';
|
|
369
|
+
$min-group: $DEFAULT-BASE-FIRST-STEP;
|
|
370
|
+
$result: (1: $min-group, 2: $css-classe, 3: $set + px, 4: $command, 5: $prefix);
|
|
371
|
+
|
|
372
|
+
@return $result;
|
|
373
|
+
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
@if $valuetrim < 1 {
|
|
377
|
+
|
|
378
|
+
$step: $DEFAULT-BASE-FIRST-STEP;
|
|
379
|
+
|
|
380
|
+
} @else {
|
|
381
|
+
|
|
382
|
+
$step: $DEFAULT-BASE-SECOND-STEP;
|
|
383
|
+
|
|
384
|
+
} ;
|
|
385
|
+
|
|
386
|
+
@if $min-group == 0 {
|
|
387
|
+
|
|
388
|
+
$css-classe: 0;
|
|
389
|
+
$step: 1;
|
|
390
|
+
|
|
391
|
+
} @else if $valuetrim >= 10 {
|
|
392
|
+
|
|
393
|
+
$css-classe: str-replace(string.slice(#{$valuetrim}, 1, 4),'.', '\\.');
|
|
394
|
+
|
|
395
|
+
} @else {
|
|
396
|
+
|
|
397
|
+
$css-classe: str-replace(string.slice(#{$valuetrim}, 1, 3),'.', '\\.');
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
$min-group: $min-group + $step;
|
|
401
|
+
$result: (1: $min-group, 2: $css-classe, 3: $value, 4: $command, 5: $prefix);
|
|
402
|
+
|
|
403
|
+
@return $result;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// End Functions
|