unit.gl 0.0.35 → 0.0.39
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 -201
- package/README.md +30 -74
- package/css/unit.gl.css +28 -65
- package/css/unit.gl.min.css +1 -1
- package/package.json +13 -8
- package/scss/_global.scss +5 -23
- package/scss/_reset.scss +13 -15
- package/scss/classes/_guide.scss +126 -0
- package/scss/classes/_index.scss +25 -11
- package/scss/classes/_ratio.scss +30 -0
- package/scss/dev/_banner.scss +30 -1
- package/scss/dev/_index.scss +0 -0
- package/scss/functions/_color.scss +40 -0
- package/scss/functions/_index.scss +39 -16
- package/scss/functions/_layer.scss +48 -0
- package/scss/functions/_ratio.scss +58 -157
- package/scss/functions/_scale.scss +55 -49
- package/scss/functions/_sequence.scss +154 -126
- package/scss/functions/_view.scss +40 -0
- package/scss/functions/math/_arithmetic.scss +102 -0
- package/scss/functions/math/_index.scss +30 -0
- package/scss/functions/unit/_index.scss +30 -0
- package/scss/functions/unit/_unit_conversion.scss +94 -0
- package/scss/functions/{_unit_functions.scss → unit/_unit_functions.scss} +70 -36
- package/scss/index.scss +2 -16
- package/scss/maps/_color.scss +43 -0
- package/scss/maps/_index.scss +1 -0
- package/scss/mixins/_device.scss +63 -25
- package/scss/mixins/_display.scss +106 -44
- package/scss/mixins/_guide.scss +191 -158
- package/scss/mixins/_helper.scss +287 -52
- package/scss/mixins/_index.scss +50 -17
- package/scss/mixins/_paper.scss +38 -17
- package/scss/mixins/_ratio.scss +30 -13
- package/scss/mixins/_unit.scss +94 -0
- package/scss/mixins/_view.scss +123 -44
- package/scss/tags/_index.scss +30 -0
- package/scss/tags/_unit.scss +40 -0
- package/scss/utilities/_guides.scss +103 -0
- package/scss/utilities/_index.scss +6 -0
- package/scss/variables/_color.scss +83 -0
- package/scss/variables/_device.scss +140 -50
- package/scss/variables/_index.scss +84 -16
- package/scss/variables/_layer.scss +148 -51
- package/scss/variables/_paper.scss +243 -17
- package/scss/variables/_ratio.scss +224 -0
- package/scss/variables/_scale.scss +230 -104
- package/scss/variables/_unit.scss +76 -72
- package/scss/variables/_view.scss +135 -39
- package/ts/AspectRatio.ts +29 -0
- package/ts/Border.ts +29 -0
- package/ts/BoxModel.ts +40 -0
- package/ts/FlexContainer.ts +48 -0
- package/ts/Grid.ts +21 -0
- package/ts/GridContainer.ts +33 -0
- package/ts/Layout.ts +34 -0
- package/ts/Position.ts +28 -0
- package/ts/Rectangle.ts +28 -0
- package/ts/ResponsiveImage.ts +28 -0
- package/ts/ResponsiveScale.ts +21 -0
- package/ts/Size.ts +32 -0
- package/ts/Spacing.ts +68 -0
- package/ts/Transform.ts +38 -0
- package/ts/Typography.ts +41 -0
- package/ts/Unit.ts +57 -0
- package/ts/Viewport.ts +24 -0
- package/js/index.d.ts +0 -1
- package/js/index.js +0 -3
- package/js/unit.gl.min.js +0 -1
- package/scss/classes/_paper.scss +0 -97
- package/scss/functions/_arithmetic.scss +0 -64
- package/scss/functions/_unit_conversion.scss +0 -77
package/scss/mixins/_helper.scss
CHANGED
|
@@ -1,105 +1,340 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Poster
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
////
|
|
6
|
+
///
|
|
7
|
+
/// Helper Mixins Module
|
|
8
|
+
/// ===========================================================================
|
|
9
|
+
///
|
|
10
|
+
/// This module provides a collection of utility mixins for common CSS
|
|
11
|
+
/// properties like width, height, font size, padding, margin, and border
|
|
12
|
+
/// properties. These mixins leverage a `q()` function (presumably defined
|
|
13
|
+
/// elsewhere) to standardize the application of units across the project,
|
|
14
|
+
/// promoting consistency and scalability.
|
|
15
|
+
///
|
|
16
|
+
/// @group Helper
|
|
17
|
+
/// @author Scape Agency
|
|
18
|
+
/// @link https://unit.gl
|
|
19
|
+
/// @since 0.1.0 initial release
|
|
20
|
+
/// @todo None
|
|
21
|
+
/// @access public
|
|
22
|
+
///
|
|
23
|
+
////
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// Use
|
|
28
|
+
// ============================================================================
|
|
15
29
|
|
|
16
30
|
@use "../variables" as *;
|
|
17
31
|
|
|
18
32
|
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// Mixins
|
|
35
|
+
// ============================================================================
|
|
19
36
|
|
|
20
|
-
// Dimensions
|
|
21
|
-
// ----------------------------------------------------------------------------
|
|
22
37
|
|
|
23
|
-
|
|
38
|
+
// Dimensions
|
|
39
|
+
// ============================================================================
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
///
|
|
43
|
+
/// Sets the width of an element using the provided value.
|
|
44
|
+
///
|
|
45
|
+
/// @name set_width
|
|
46
|
+
/// @group Dimensions
|
|
47
|
+
/// @param {Length} $value - The width value to apply.
|
|
48
|
+
///
|
|
49
|
+
/// @example scss - Usage
|
|
50
|
+
/// .box {
|
|
51
|
+
/// @include set_width(100px);
|
|
52
|
+
/// }
|
|
53
|
+
///
|
|
54
|
+
@mixin set_width($value) {
|
|
24
55
|
@include q($value, width);
|
|
25
56
|
}
|
|
26
57
|
|
|
27
|
-
|
|
58
|
+
|
|
59
|
+
///
|
|
60
|
+
/// Sets the height of an element using the provided value.
|
|
61
|
+
///
|
|
62
|
+
/// @name set_height
|
|
63
|
+
/// @group Dimensions
|
|
64
|
+
/// @param {Length} $value - The height value to apply.
|
|
65
|
+
///
|
|
66
|
+
/// @example scss - Usage
|
|
67
|
+
/// .box {
|
|
68
|
+
/// @include set_height(200px);
|
|
69
|
+
/// }
|
|
70
|
+
///
|
|
71
|
+
@mixin set_height($value) {
|
|
28
72
|
@include q($value, height);
|
|
29
73
|
}
|
|
30
74
|
|
|
31
|
-
|
|
32
|
-
// Typography
|
|
75
|
+
// TYPOGRAPHY
|
|
33
76
|
// ----------------------------------------------------------------------------
|
|
34
77
|
|
|
35
|
-
|
|
78
|
+
|
|
79
|
+
///
|
|
80
|
+
/// Sets the font size of an element using the provided value.
|
|
81
|
+
///
|
|
82
|
+
/// @name set_font-size
|
|
83
|
+
/// @group Typography
|
|
84
|
+
/// @param {Length} $value - The font size value to apply.
|
|
85
|
+
///
|
|
86
|
+
/// @example scss - Usage
|
|
87
|
+
/// .text {
|
|
88
|
+
/// @include set_font-size(16px);
|
|
89
|
+
/// }
|
|
90
|
+
///
|
|
91
|
+
@mixin set_font-size($value) {
|
|
36
92
|
@include q($value, font-size);
|
|
37
93
|
}
|
|
38
94
|
|
|
39
|
-
|
|
40
|
-
|
|
95
|
+
|
|
96
|
+
///
|
|
97
|
+
/// Sets the line height of an element using the provided value.
|
|
98
|
+
///
|
|
99
|
+
/// @name set_line_height
|
|
100
|
+
/// @group Typography
|
|
101
|
+
/// @param {Length} $value - The line height value to apply.
|
|
102
|
+
///
|
|
103
|
+
/// @example scss - Usage
|
|
104
|
+
/// .text {
|
|
105
|
+
/// @include set_line_height(1.5);
|
|
106
|
+
/// }
|
|
107
|
+
///
|
|
108
|
+
@mixin set_line_height($value) {
|
|
109
|
+
@include q($value, line_height);
|
|
41
110
|
}
|
|
42
111
|
|
|
43
|
-
|
|
112
|
+
|
|
113
|
+
///
|
|
114
|
+
/// Sets the letter spacing of an element using the provided value.
|
|
115
|
+
/// @name set_letter-spacing
|
|
116
|
+
///
|
|
117
|
+
/// @group Typography
|
|
118
|
+
/// @param {Length} $value - The letter spacing value to apply.
|
|
119
|
+
///
|
|
120
|
+
/// @example scss - Usage
|
|
121
|
+
/// .text {
|
|
122
|
+
/// @include set_letter-spacing(0.1em);
|
|
123
|
+
/// }
|
|
124
|
+
///
|
|
125
|
+
@mixin set_letter-spacing($value) {
|
|
44
126
|
@include q($value, letter-spacing);
|
|
45
127
|
}
|
|
46
128
|
|
|
47
|
-
|
|
48
|
-
// Border
|
|
129
|
+
// BORDERS
|
|
49
130
|
// ----------------------------------------------------------------------------
|
|
50
131
|
|
|
51
|
-
@mixin border-width($value) {
|
|
52
|
-
@include q($value, border-width);
|
|
53
|
-
}
|
|
54
132
|
|
|
55
|
-
|
|
56
|
-
|
|
133
|
+
///
|
|
134
|
+
/// Sets the border width of an element using the provided value.
|
|
135
|
+
///
|
|
136
|
+
/// @name set_border_width
|
|
137
|
+
/// @group Borders
|
|
138
|
+
/// @param {Length} $value - The border width value to apply.
|
|
139
|
+
///
|
|
140
|
+
/// @example scss - Usage
|
|
141
|
+
/// .box {
|
|
142
|
+
/// @include set_border_width(2px);
|
|
143
|
+
/// }
|
|
144
|
+
///
|
|
145
|
+
@mixin set_border_width($value) {
|
|
146
|
+
@include q($value, border_width);
|
|
57
147
|
}
|
|
58
148
|
|
|
59
149
|
|
|
60
|
-
|
|
150
|
+
///
|
|
151
|
+
/// Sets the border radius of an element using the provided value.
|
|
152
|
+
///
|
|
153
|
+
/// @name set_border_radius
|
|
154
|
+
/// @group Borders
|
|
155
|
+
/// @param {Length} $value - The border radius value to apply.
|
|
156
|
+
///
|
|
157
|
+
/// @example scss - Usage
|
|
158
|
+
/// .box {
|
|
159
|
+
/// @include set_border_radius(8px);
|
|
160
|
+
/// }
|
|
161
|
+
///
|
|
162
|
+
@mixin set_border_radius($value) {
|
|
163
|
+
@include q($value, border_radius);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// PADDING
|
|
61
167
|
// ----------------------------------------------------------------------------
|
|
62
168
|
|
|
63
|
-
|
|
169
|
+
|
|
170
|
+
///
|
|
171
|
+
/// Sets the padding of an element using the provided value.
|
|
172
|
+
///
|
|
173
|
+
/// @name set_padding
|
|
174
|
+
/// @group Spacing
|
|
175
|
+
/// @param {Length} $value - The padding value to apply.
|
|
176
|
+
///
|
|
177
|
+
/// @example scss - Usage
|
|
178
|
+
/// .box {
|
|
179
|
+
/// @include set_padding(10px);
|
|
180
|
+
/// }
|
|
181
|
+
///
|
|
182
|
+
@mixin set_padding($value) {
|
|
64
183
|
@include q($value, padding);
|
|
65
184
|
}
|
|
66
185
|
|
|
67
|
-
@mixin padding-top($value) {
|
|
68
|
-
@include q($value, padding-top);
|
|
69
|
-
}
|
|
70
186
|
|
|
71
|
-
|
|
72
|
-
|
|
187
|
+
///
|
|
188
|
+
/// Sets the top padding of an element using the provided value.
|
|
189
|
+
///
|
|
190
|
+
/// @name set_padding_top
|
|
191
|
+
/// @group Spacing
|
|
192
|
+
/// @param {Length} $value - The padding_top value to apply.
|
|
193
|
+
///
|
|
194
|
+
/// @example scss - Usage
|
|
195
|
+
/// .box {
|
|
196
|
+
/// @include set_padding_top(10px);
|
|
197
|
+
/// }
|
|
198
|
+
///
|
|
199
|
+
@mixin set_padding_top($value) {
|
|
200
|
+
@include q($value, padding_top);
|
|
73
201
|
}
|
|
74
202
|
|
|
75
|
-
|
|
76
|
-
|
|
203
|
+
|
|
204
|
+
///
|
|
205
|
+
/// Sets the right padding of an element using the provided value.
|
|
206
|
+
///
|
|
207
|
+
/// @name set_padding_right
|
|
208
|
+
/// @group Spacing
|
|
209
|
+
/// @param {Length} $value - The padding_right value to apply.
|
|
210
|
+
///
|
|
211
|
+
/// @example scss - Usage
|
|
212
|
+
/// .box {
|
|
213
|
+
/// @include set_padding_right(10px);
|
|
214
|
+
/// }
|
|
215
|
+
///
|
|
216
|
+
@mixin set_padding_right($value) {
|
|
217
|
+
@include q($value, padding_right);
|
|
77
218
|
}
|
|
78
219
|
|
|
79
|
-
|
|
80
|
-
|
|
220
|
+
|
|
221
|
+
///
|
|
222
|
+
/// Sets the bottom padding of an element using the provided value.
|
|
223
|
+
///
|
|
224
|
+
/// @name set_padding_bottom
|
|
225
|
+
/// @group Spacing
|
|
226
|
+
/// @param {Length} $value - The padding_bottom value to apply.
|
|
227
|
+
///
|
|
228
|
+
/// @example scss - Usage
|
|
229
|
+
/// .box {
|
|
230
|
+
/// @include set_padding_bottom(10px);
|
|
231
|
+
/// }
|
|
232
|
+
///
|
|
233
|
+
@mixin set_padding_bottom($value) {
|
|
234
|
+
@include q($value, padding_bottom);
|
|
81
235
|
}
|
|
82
236
|
|
|
83
237
|
|
|
84
|
-
|
|
238
|
+
///
|
|
239
|
+
/// Sets the left padding of an element using the provided value.
|
|
240
|
+
///
|
|
241
|
+
/// @name set_padding_left
|
|
242
|
+
/// @group Spacing
|
|
243
|
+
/// @param {Length} $value - The padding_left value to apply.
|
|
244
|
+
///
|
|
245
|
+
/// @example scss - Usage
|
|
246
|
+
/// .box {
|
|
247
|
+
/// @include set_padding_left(10px);
|
|
248
|
+
/// }
|
|
249
|
+
///
|
|
250
|
+
@mixin set_padding_left($value) {
|
|
251
|
+
@include q($value, padding_left);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// MARGIN
|
|
85
255
|
// ----------------------------------------------------------------------------
|
|
86
256
|
|
|
87
|
-
|
|
257
|
+
|
|
258
|
+
///
|
|
259
|
+
/// Sets the margin of an element using the provided value.
|
|
260
|
+
///
|
|
261
|
+
/// @name set_margin
|
|
262
|
+
/// @group Spacing
|
|
263
|
+
/// @param {Length} $value - The margin value to apply.
|
|
264
|
+
///
|
|
265
|
+
/// @example scss - Usage
|
|
266
|
+
/// .box {
|
|
267
|
+
/// @include set_margin(10px);
|
|
268
|
+
/// }
|
|
269
|
+
///
|
|
270
|
+
@mixin set_margin($value) {
|
|
88
271
|
@include q($value, margin);
|
|
89
272
|
}
|
|
90
273
|
|
|
91
|
-
|
|
92
|
-
|
|
274
|
+
|
|
275
|
+
///
|
|
276
|
+
/// Sets the top margin of an element using the provided value.
|
|
277
|
+
///
|
|
278
|
+
/// @name set_margin_top
|
|
279
|
+
/// @group Spacing
|
|
280
|
+
/// @param {Length} $value - The margin_top value to apply.
|
|
281
|
+
///
|
|
282
|
+
/// @example scss - Usage
|
|
283
|
+
/// .box {
|
|
284
|
+
/// @include set_margin_top(10px);
|
|
285
|
+
/// }
|
|
286
|
+
///
|
|
287
|
+
@mixin set_margin_top($value) {
|
|
288
|
+
@include q($value, margin_top);
|
|
93
289
|
}
|
|
94
290
|
|
|
95
|
-
|
|
96
|
-
|
|
291
|
+
|
|
292
|
+
///
|
|
293
|
+
/// Sets the right margin of an element using the provided value.
|
|
294
|
+
///
|
|
295
|
+
/// @name set_margin_right
|
|
296
|
+
/// @group Spacing
|
|
297
|
+
/// @param {Length} $value - The margin_right value to apply.
|
|
298
|
+
///
|
|
299
|
+
/// @example scss - Usage
|
|
300
|
+
/// .box {
|
|
301
|
+
/// @include set_margin_right(10px);
|
|
302
|
+
/// }
|
|
303
|
+
///
|
|
304
|
+
@mixin set_margin_right($value) {
|
|
305
|
+
@include q($value, margin_right);
|
|
97
306
|
}
|
|
98
307
|
|
|
99
|
-
|
|
100
|
-
|
|
308
|
+
|
|
309
|
+
///
|
|
310
|
+
/// Sets the bottom margin of an element using the provided value.
|
|
311
|
+
///
|
|
312
|
+
/// @name set_margin_bottom
|
|
313
|
+
/// @group Spacing
|
|
314
|
+
/// @param {Length} $value - The margin_bottom value to apply.
|
|
315
|
+
///
|
|
316
|
+
/// @example scss - Usage
|
|
317
|
+
/// .box {
|
|
318
|
+
/// @include set_margin_bottom(10px);
|
|
319
|
+
/// }
|
|
320
|
+
///
|
|
321
|
+
@mixin set_margin_bottom($value) {
|
|
322
|
+
@include q($value, margin_bottom);
|
|
101
323
|
}
|
|
102
324
|
|
|
103
|
-
|
|
104
|
-
|
|
325
|
+
|
|
326
|
+
///
|
|
327
|
+
/// Sets the left margin of an element using the provided value.
|
|
328
|
+
///
|
|
329
|
+
/// @name set_margin_left
|
|
330
|
+
/// @group Spacing
|
|
331
|
+
/// @param {Length} $value - The margin_left value to apply.
|
|
332
|
+
///
|
|
333
|
+
/// @example scss - Usage
|
|
334
|
+
/// .box {
|
|
335
|
+
/// @include set_margin_left(10px);
|
|
336
|
+
/// }
|
|
337
|
+
///
|
|
338
|
+
@mixin set_margin_left($value) {
|
|
339
|
+
@include q($value, margin_left);
|
|
105
340
|
}
|
package/scss/mixins/_index.scss
CHANGED
|
@@ -1,23 +1,56 @@
|
|
|
1
|
-
//
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Poster
|
|
3
|
+
// ============================================================================
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
////
|
|
6
|
+
///
|
|
7
|
+
/// Mixins Module
|
|
8
|
+
/// ===========================================================================
|
|
9
|
+
///
|
|
10
|
+
/// This file centralizes the forwarding of various SCSS partials/modules used
|
|
11
|
+
/// across the project. By aggregating these forwards, it simplifies imports
|
|
12
|
+
/// in other parts of the codebase, promoting better modularity and
|
|
13
|
+
/// organization.
|
|
14
|
+
///
|
|
15
|
+
/// This module forwards several other modules to streamline imports
|
|
16
|
+
/// and maintain a clean, modular structure. Each forwarded module contains
|
|
17
|
+
/// specific functionalities, from managing viewports to handling aspect
|
|
18
|
+
/// ratios.
|
|
19
|
+
///
|
|
20
|
+
/// Forwarded Modules:
|
|
21
|
+
/// - paper: Contains paper sizes and related utilities.
|
|
22
|
+
/// - view: Manages viewport-specific variables, such as breakpoints.
|
|
23
|
+
/// - ratio: Includes mixins and functions for aspect ratio calculations.
|
|
24
|
+
/// - device: Device-specific configurations for responsive design.
|
|
25
|
+
/// - display: Display-related settings and utilities, including typography.
|
|
26
|
+
/// - guide: Utilities for creating visual guides and overlays.
|
|
27
|
+
/// - helper: General helper functions and mixins for common tasks.
|
|
28
|
+
///
|
|
29
|
+
/// @group Mixins
|
|
30
|
+
/// @author Scape Agency
|
|
31
|
+
/// @link https://unit.gl
|
|
32
|
+
/// @since 0.1.0 initial release
|
|
33
|
+
/// @todo None
|
|
34
|
+
/// @access public
|
|
35
|
+
///
|
|
36
|
+
////
|
|
6
37
|
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
38
|
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
39
|
+
// ============================================================================
|
|
40
|
+
// Use
|
|
41
|
+
// ============================================================================
|
|
14
42
|
|
|
15
43
|
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// Forward
|
|
46
|
+
// ============================================================================
|
|
16
47
|
|
|
17
|
-
|
|
18
|
-
@forward "
|
|
19
|
-
@forward "
|
|
20
|
-
@forward "
|
|
21
|
-
@forward "
|
|
22
|
-
@forward "
|
|
23
|
-
@forward "
|
|
48
|
+
/// Forwarding modules for global access
|
|
49
|
+
@forward "unit";
|
|
50
|
+
@forward "paper"; // Handles paper sizes and related utilities
|
|
51
|
+
@forward "view"; // Manages viewport and breakpoint variables
|
|
52
|
+
@forward "ratio"; // Provides aspect ratio utilities
|
|
53
|
+
@forward "device"; // Device-specific responsive configurations
|
|
54
|
+
@forward "display"; // Typography and display settings
|
|
55
|
+
@forward "guide"; // Visual guide and overlay utilities
|
|
56
|
+
@forward "helper"; // General-purpose helper functions and mixins
|
package/scss/mixins/_paper.scss
CHANGED
|
@@ -1,35 +1,56 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Poster
|
|
3
|
+
// ============================================================================
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
////
|
|
6
|
+
///
|
|
7
|
+
/// Paper Mixins Module
|
|
8
|
+
/// ===========================================================================
|
|
9
|
+
///
|
|
10
|
+
/// This module provides utilities for applying standard paper sizes to
|
|
11
|
+
/// elements. The sizes are defined in the $paper-sizes map and can be applied
|
|
12
|
+
/// using the `set-paper-size` mixin.
|
|
13
|
+
///
|
|
14
|
+
/// @group Paper
|
|
15
|
+
/// @author Scape Agency
|
|
16
|
+
/// @link https://unit.gl
|
|
17
|
+
/// @since 0.1.0 initial release
|
|
18
|
+
/// @todo None
|
|
19
|
+
/// @access public
|
|
20
|
+
///
|
|
21
|
+
////
|
|
14
22
|
|
|
15
23
|
|
|
16
24
|
// ============================================================================
|
|
17
|
-
//
|
|
25
|
+
// Use
|
|
18
26
|
// ============================================================================
|
|
19
27
|
|
|
20
28
|
@use "../variables" as *;
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
|
|
23
31
|
// ============================================================================
|
|
32
|
+
// Mixins
|
|
33
|
+
// ============================================================================
|
|
34
|
+
|
|
24
35
|
|
|
36
|
+
///
|
|
37
|
+
/// Applies the width and height of the specified paper size to the
|
|
38
|
+
/// element. The paper sizes must be predefined in the $paper-sizes map.
|
|
39
|
+
///
|
|
40
|
+
/// @name set_paper_size
|
|
41
|
+
/// @param {String} $size - The key representing the paper size in the $paper-sizes map.
|
|
42
|
+
///
|
|
43
|
+
/// @example scss - Usage
|
|
44
|
+
/// .document {
|
|
45
|
+
/// @include set-paper-size('A4');
|
|
46
|
+
/// }
|
|
47
|
+
///
|
|
25
48
|
@mixin set_paper_size($size) {
|
|
26
49
|
@if map-has-key($paper-sizes, $size) {
|
|
27
50
|
$size-map: map-get($paper-sizes, $size);
|
|
28
51
|
width: map-get($size-map, width);
|
|
29
52
|
height: map-get($size-map, height);
|
|
30
53
|
} @else {
|
|
31
|
-
@warn "Invalid paper size: #{$size}.";
|
|
54
|
+
@warn "Invalid paper size: #{$size}. Available sizes are: #{map-keys($paper-sizes)}.";
|
|
32
55
|
}
|
|
33
56
|
}
|
|
34
|
-
|
|
35
|
-
|
package/scss/mixins/_ratio.scss
CHANGED
|
@@ -1,24 +1,42 @@
|
|
|
1
|
-
//
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Poster
|
|
3
|
+
// ============================================================================
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
////
|
|
6
|
+
///
|
|
7
|
+
/// Ratio Mixins Module
|
|
8
|
+
/// ===========================================================================
|
|
9
|
+
///
|
|
10
|
+
/// This module provides mixins for creating aspect ratio containers.
|
|
11
|
+
/// These containers maintain a specific width-to-height ratio, ensuring
|
|
12
|
+
/// that elements scale proportionally across different screen sizes.
|
|
13
|
+
///
|
|
14
|
+
/// There are two approaches provided: one using the `aspect-ratio` CSS
|
|
15
|
+
/// property, and another using padding percentages for broader browser
|
|
16
|
+
/// support.
|
|
17
|
+
///
|
|
18
|
+
/// @group Ratio
|
|
19
|
+
/// @author Scape Agency
|
|
20
|
+
/// @link https://unit.gl
|
|
21
|
+
/// @since 0.1.0 initial release
|
|
22
|
+
/// @todo None
|
|
23
|
+
/// @access public
|
|
24
|
+
///
|
|
25
|
+
////
|
|
6
26
|
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
27
|
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// Use
|
|
30
|
+
// ============================================================================
|
|
14
31
|
|
|
15
32
|
@use "../variables" as *;
|
|
16
33
|
|
|
17
34
|
|
|
18
35
|
// ============================================================================
|
|
19
|
-
//
|
|
36
|
+
// Mixins
|
|
20
37
|
// ============================================================================
|
|
21
38
|
|
|
39
|
+
|
|
22
40
|
// Aspect Ratio Box:
|
|
23
41
|
// Creates a container with a specific aspect ratio.
|
|
24
42
|
// @mixin aspect-ratio($width, $height) {
|
|
@@ -41,6 +59,7 @@
|
|
|
41
59
|
// @include aspect-ratio(16, 9);
|
|
42
60
|
// }
|
|
43
61
|
|
|
62
|
+
|
|
44
63
|
@mixin ratio ($val01, $val02) {
|
|
45
64
|
aspect-ratio: calc($val01 / $val02);
|
|
46
65
|
width: 100%;
|
|
@@ -79,8 +98,6 @@
|
|
|
79
98
|
.ratio_16x10 { @include ratio_16x10; }
|
|
80
99
|
|
|
81
100
|
|
|
82
|
-
// .
|
|
83
|
-
// ----------------------------------------------------------------------------
|
|
84
101
|
|
|
85
102
|
@mixin ratio_p ($val01) {
|
|
86
103
|
padding-bottom: $val01;
|