unit.gl 0.0.40 → 0.1.2

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