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/_reset.scss
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
// Copyright 2024 Scape Agency BV
|
|
2
|
-
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
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
|
|
8
|
-
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
|
|
16
1
|
// ============================================================================
|
|
17
2
|
// Base | Reset
|
|
18
3
|
// ============================================================================
|
|
19
4
|
|
|
5
|
+
// Reset margin and padding for all elements
|
|
20
6
|
@mixin reset_bleed {
|
|
21
7
|
margin: 0;
|
|
22
8
|
margin-block-start: 0;
|
|
@@ -24,8 +10,14 @@
|
|
|
24
10
|
margin-inline-start: 0;
|
|
25
11
|
margin-inline-end: 0;
|
|
26
12
|
padding: 0;
|
|
13
|
+
border: 0; // Ensures no borders are applied unless explicitly defined
|
|
14
|
+
font-size: 100%; // Prevent scaling issues by setting default font size
|
|
15
|
+
font: inherit; // Ensures fonts are consistently inherited from parent elements
|
|
16
|
+
vertical-align: baseline; // Aligns elements to the baseline to avoid layout shifts
|
|
27
17
|
}
|
|
28
18
|
|
|
19
|
+
|
|
20
|
+
// Apply the reset mixin to all elements
|
|
29
21
|
*,
|
|
30
22
|
a,
|
|
31
23
|
abbr,
|
|
@@ -153,6 +145,12 @@ wbr
|
|
|
153
145
|
@include reset_bleed;
|
|
154
146
|
}
|
|
155
147
|
|
|
148
|
+
// HTML5 display-role reset for older browsers
|
|
149
|
+
// Ensures HTML5 elements are displayed correctly in older browsers
|
|
150
|
+
article, aside, details, figcaption, figure,
|
|
151
|
+
footer, header, hgroup, menu, nav, section, main {
|
|
152
|
+
display: block;
|
|
153
|
+
}
|
|
156
154
|
|
|
157
155
|
// html, body, div, span, applet, object, iframe,
|
|
158
156
|
// h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Poster
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
////
|
|
6
|
+
///
|
|
7
|
+
/// Guide Class Module
|
|
8
|
+
/// ===========================================================================
|
|
9
|
+
///
|
|
10
|
+
/// This module creates utility classes for visual guides, such as grid
|
|
11
|
+
/// overlays and baseline grids, using predefined mixins. These classes can
|
|
12
|
+
/// be applied directly in your HTML for rapid prototyping or debugging.
|
|
13
|
+
///
|
|
14
|
+
/// Dependencies:
|
|
15
|
+
/// - Mixins from the Guides module
|
|
16
|
+
///
|
|
17
|
+
/// @group Guides
|
|
18
|
+
/// @author Scape Agency
|
|
19
|
+
/// @link https://unit.gl
|
|
20
|
+
/// @since 0.1.0 initial release
|
|
21
|
+
/// @todo None
|
|
22
|
+
/// @access public
|
|
23
|
+
///
|
|
24
|
+
////
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// ============================================================================
|
|
28
|
+
// Use
|
|
29
|
+
// ============================================================================
|
|
30
|
+
|
|
31
|
+
@use "../variables" as *;
|
|
32
|
+
@use "../mixins" as *;
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Classes
|
|
37
|
+
// ============================================================================
|
|
38
|
+
|
|
39
|
+
///
|
|
40
|
+
/// Applies a full-page guide overlay with a high z-index.
|
|
41
|
+
///
|
|
42
|
+
/// @name guide_overlay
|
|
43
|
+
///
|
|
44
|
+
.guide {
|
|
45
|
+
@include guide;
|
|
46
|
+
}
|
|
47
|
+
.guide_overlay {
|
|
48
|
+
@include guide;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
///
|
|
52
|
+
/// Applies a grid overlay with a customizable grid size and color.
|
|
53
|
+
///
|
|
54
|
+
/// @name guide_graph
|
|
55
|
+
///
|
|
56
|
+
/// @example HTML
|
|
57
|
+
/// <div class="guide_graph"></div>
|
|
58
|
+
///
|
|
59
|
+
.guide_graph {
|
|
60
|
+
@include guide_graph($rhythm_base); // Default size, customize as needed
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
///
|
|
65
|
+
/// Applies a baseline grid overlay to maintain vertical rhythm.
|
|
66
|
+
///
|
|
67
|
+
/// @name guide_baseline
|
|
68
|
+
///
|
|
69
|
+
/// @example HTML
|
|
70
|
+
/// <div class="guide_baseline"></div>
|
|
71
|
+
///
|
|
72
|
+
.guide_baseline {
|
|
73
|
+
@include guide_baseline($line_height_base); // Default size, customize as needed
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
///
|
|
78
|
+
/// Applies a full baseline grid with both vertical and horizontal lines.
|
|
79
|
+
///
|
|
80
|
+
/// @name baseline_grid
|
|
81
|
+
///
|
|
82
|
+
/// @example HTML
|
|
83
|
+
/// <div class="baseline-grid"></div>
|
|
84
|
+
///
|
|
85
|
+
.baseline_grid {
|
|
86
|
+
@include baseline_grid(60px, 24px); // Default sizes, customize as needed
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
///
|
|
91
|
+
/// Creates a centered guide box for alignment checks.
|
|
92
|
+
///
|
|
93
|
+
/// @name guide_centered
|
|
94
|
+
///
|
|
95
|
+
/// @example HTML
|
|
96
|
+
/// <div class="guide_centered"></div>
|
|
97
|
+
///
|
|
98
|
+
.guide_centered {
|
|
99
|
+
@include guide_centered(200px, 200px); // Default size, customize as needed
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
///
|
|
104
|
+
/// Visualizes the margin area around content.
|
|
105
|
+
///
|
|
106
|
+
/// @name guide_margin
|
|
107
|
+
///
|
|
108
|
+
/// @example HTML
|
|
109
|
+
/// <div class="guide_margin"></div>
|
|
110
|
+
///
|
|
111
|
+
.guide_margin {
|
|
112
|
+
@include guide_margin(20px); // Default margin size, customize as needed
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
///
|
|
117
|
+
/// Visualizes a larger margin area around content.
|
|
118
|
+
///
|
|
119
|
+
/// @name guide_margin)_wide
|
|
120
|
+
///
|
|
121
|
+
/// @example HTML
|
|
122
|
+
/// <div class="guide_margin_wide"></div>
|
|
123
|
+
///
|
|
124
|
+
.guide_margin_wide {
|
|
125
|
+
@include guide_margin(40px); // Wider margin size, customize as needed
|
|
126
|
+
}
|
package/scss/classes/_index.scss
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
//
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Poster
|
|
3
|
+
// ============================================================================
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
////
|
|
6
|
+
///
|
|
7
|
+
/// Class Module
|
|
8
|
+
/// ===========================================================================
|
|
9
|
+
///
|
|
10
|
+
/// @group Classes
|
|
11
|
+
/// @author Scape Agency
|
|
12
|
+
/// @link https://unit.gl
|
|
13
|
+
/// @since 0.1.0 initial release
|
|
14
|
+
/// @todo None
|
|
15
|
+
/// @access public
|
|
16
|
+
///
|
|
17
|
+
////
|
|
6
18
|
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
19
|
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Use
|
|
22
|
+
// ============================================================================
|
|
14
23
|
|
|
15
24
|
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Forward
|
|
27
|
+
// ============================================================================
|
|
16
28
|
|
|
17
|
-
|
|
29
|
+
/// Forwarding modules for global access
|
|
30
|
+
@forward "ratio";
|
|
31
|
+
// @forward "guide";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Poster
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
////
|
|
6
|
+
///
|
|
7
|
+
/// Ratio Class Module
|
|
8
|
+
/// ===========================================================================
|
|
9
|
+
///
|
|
10
|
+
/// @group Ratio
|
|
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
|
+
|
|
19
|
+
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Use
|
|
22
|
+
// ============================================================================
|
|
23
|
+
|
|
24
|
+
@use "../variables" as *;
|
|
25
|
+
@use "../mixins" as *;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// Classes
|
|
30
|
+
// ============================================================================
|
package/scss/dev/_banner.scss
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Poster
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
////
|
|
6
|
+
///
|
|
7
|
+
/// Dev Functions Module
|
|
8
|
+
/// ===========================================================================
|
|
9
|
+
///
|
|
10
|
+
/// @group Dev
|
|
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
|
+
|
|
19
|
+
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Use
|
|
22
|
+
// ============================================================================
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Variables
|
|
27
|
+
// ============================================================================
|
|
28
|
+
|
|
29
|
+
|
|
1
30
|
/**
|
|
2
31
|
* unit.gl
|
|
3
32
|
*
|
|
4
|
-
* @description Layout Engine
|
|
33
|
+
* @description Dynamic Layout Engine
|
|
5
34
|
* @author Scape Agency (https://www.scape.agency)
|
|
6
35
|
* @version v1.0.0
|
|
7
36
|
* @copyright 2020-2024 Scape Agency (https://www.scape.agency)
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Poster
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
////
|
|
6
|
+
///
|
|
7
|
+
/// Color Variables Module
|
|
8
|
+
/// ===========================================================================
|
|
9
|
+
///
|
|
10
|
+
/// These colors are used for visual guides such as grid overlays, baselines,
|
|
11
|
+
/// and alignment guides. The colors are defined with varying levels of opacity
|
|
12
|
+
/// to ensure they are visible yet non-intrusive on the design.
|
|
13
|
+
///
|
|
14
|
+
/// @group Color
|
|
15
|
+
/// @author Scape Agency
|
|
16
|
+
/// @link https://unit.gl
|
|
17
|
+
/// @since 0.1.0 initial release
|
|
18
|
+
/// @todo None
|
|
19
|
+
/// @access public
|
|
20
|
+
///
|
|
21
|
+
////
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// Use
|
|
26
|
+
// ============================================================================
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// Functions
|
|
31
|
+
// ============================================================================
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
///
|
|
35
|
+
/// Function to Retrieve Guide Colors (Optional for Flexibility)
|
|
36
|
+
/// ---------------------------------------------------------------------------
|
|
37
|
+
///
|
|
38
|
+
@function guide_color($name) {
|
|
39
|
+
@return map-get($guide_colors, $name);
|
|
40
|
+
}
|
|
@@ -1,22 +1,45 @@
|
|
|
1
|
-
//
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Poster
|
|
3
|
+
// ============================================================================
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
////
|
|
6
|
+
///
|
|
7
|
+
/// Functions Module
|
|
8
|
+
/// ===========================================================================
|
|
9
|
+
///
|
|
10
|
+
/// This module serves as a central hub for all core SCSS functions used across
|
|
11
|
+
/// the project. By forwarding various function modules, it allows for
|
|
12
|
+
/// consistent access to utilities like mathematical operations, ratio
|
|
13
|
+
/// calculations, scaling utilities, sequence generation, and unit handling.
|
|
14
|
+
///
|
|
15
|
+
/// Forwarded Modules:
|
|
16
|
+
/// - math: Core mathematical operations and utilities.
|
|
17
|
+
/// - ratio: Functions for handling and calculating various ratios.
|
|
18
|
+
/// - scale: Utilities for implementing modular scales in responsive design.
|
|
19
|
+
/// - sequence: Functions for generating and working with numeric sequences.
|
|
20
|
+
/// - unit: Functions for unit conversions and calculations.
|
|
21
|
+
///
|
|
22
|
+
/// @group Functions
|
|
23
|
+
/// @author Scape Agency
|
|
24
|
+
/// @link https://unit.gl
|
|
25
|
+
/// @since 0.1.0 initial release
|
|
26
|
+
/// @todo None
|
|
27
|
+
/// @access public
|
|
28
|
+
///
|
|
29
|
+
////
|
|
6
30
|
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
31
|
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Use
|
|
34
|
+
// ============================================================================
|
|
14
35
|
|
|
15
36
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@forward "sequence";
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// Forward
|
|
39
|
+
// ============================================================================
|
|
20
40
|
|
|
21
|
-
@forward "
|
|
22
|
-
@forward "
|
|
41
|
+
@forward "math"; // Core mathematical operations and utilities
|
|
42
|
+
@forward "ratio"; // Functions for handling and calculating ratios
|
|
43
|
+
@forward "scale"; // Scaling utilities for responsive design
|
|
44
|
+
@forward "sequence"; // Functions for numeric sequence generation
|
|
45
|
+
@forward "unit"; // Functions for unit conversion and calculations
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Poster
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
////
|
|
6
|
+
///
|
|
7
|
+
/// Layer Functions Module
|
|
8
|
+
/// ===========================================================================
|
|
9
|
+
///
|
|
10
|
+
/// @group Layer
|
|
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
|
+
|
|
19
|
+
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Use
|
|
22
|
+
// ============================================================================
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Functions
|
|
27
|
+
// ============================================================================
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
///
|
|
32
|
+
/// Z-Index Layer Function
|
|
33
|
+
/// ---------------------------------------------------------------------------
|
|
34
|
+
///
|
|
35
|
+
/// This function retrieves the z-index value from the $layers map based on
|
|
36
|
+
/// the provided layer name. If the layer is not found, a warning is issued.
|
|
37
|
+
///
|
|
38
|
+
/// @name z
|
|
39
|
+
/// @param {String} $layer - The name of the layer to retrieve the z-index for.
|
|
40
|
+
/// @return {Number | Null} - The z-index value associated with the layer, or null if not found.
|
|
41
|
+
///
|
|
42
|
+
@function z($layer) {
|
|
43
|
+
@if not map-has-key($layers, $layer) {
|
|
44
|
+
@warn "Layer `#{$layer}` not found in the $layers map. z-index property omitted.";
|
|
45
|
+
@return null;
|
|
46
|
+
}
|
|
47
|
+
@return map-get($layers, $layer);
|
|
48
|
+
}
|