@ulu/frontend 0.4.3 → 0.4.5
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/lib/scss/_cssvar.scss
CHANGED
|
@@ -179,7 +179,7 @@ $config: (
|
|
|
179
179
|
/// @param {String} $key The key used to retrieve values from the map.
|
|
180
180
|
/// @param {String} $prefix The optional prefix for CSS variables.
|
|
181
181
|
@mixin declare-theme-values($theme, $key, $prefix: get("prefix")) {
|
|
182
|
-
@warn "ulu.cssvar-declare-theme-values() is deprecated. Please use ulu.themes-declare
|
|
182
|
+
@warn "ulu.cssvar-declare-theme-values() is deprecated. Please use ulu.themes-declare() instead.";
|
|
183
183
|
@each $name, $definition in $theme {
|
|
184
184
|
$value: map.get($definition, $key);
|
|
185
185
|
@if ($value) {
|
package/lib/scss/_utils.scss
CHANGED
|
@@ -323,8 +323,8 @@ $config: (
|
|
|
323
323
|
///
|
|
324
324
|
|
|
325
325
|
@function map-has($map, $key) {
|
|
326
|
-
@if (
|
|
327
|
-
@error "map-has(): Incorrect type for $map (should be map)";
|
|
326
|
+
@if (not is-map($map)) {
|
|
327
|
+
@error "map-has(): Incorrect type for $map (should be map) got (#{ $type-passed })";
|
|
328
328
|
}
|
|
329
329
|
@return map.get($map, $key) != null;
|
|
330
330
|
}
|
|
@@ -793,7 +793,12 @@ $config: (
|
|
|
793
793
|
/// @return {Boolean} Whether the item was type map
|
|
794
794
|
|
|
795
795
|
@function is-map($value) {
|
|
796
|
-
|
|
796
|
+
$type: meta.type-of($value);
|
|
797
|
+
@if ($type == "list") {
|
|
798
|
+
@return list.length($value) == 0;
|
|
799
|
+
} @else {
|
|
800
|
+
@return meta.type-of($value) == "map";
|
|
801
|
+
}
|
|
797
802
|
}
|
|
798
803
|
|
|
799
804
|
/// Determines if value passed is a number
|
package/lib/scss/base/_root.scss
CHANGED
|
@@ -63,12 +63,22 @@ $cssvars: () !default;
|
|
|
63
63
|
@include utils.file-header('base', 'root');
|
|
64
64
|
// Core/default css-vars
|
|
65
65
|
:root {
|
|
66
|
-
@include
|
|
67
|
-
@include cssvar.declare-breakpoint();
|
|
68
|
-
@include cssvar.declare-all($cssvars);
|
|
66
|
+
@include declare();
|
|
69
67
|
}
|
|
70
68
|
}
|
|
71
69
|
|
|
70
|
+
/// Declare custom properties for ulu (without selector)
|
|
71
|
+
/// @example scss
|
|
72
|
+
/// .cms-backend {
|
|
73
|
+
/// @include ulu.base-root-declare();
|
|
74
|
+
/// }
|
|
75
|
+
|
|
76
|
+
@mixin declare() {
|
|
77
|
+
@include custom-properties();
|
|
78
|
+
@include cssvar.declare-breakpoint();
|
|
79
|
+
@include cssvar.declare-all($cssvars);
|
|
80
|
+
}
|
|
81
|
+
|
|
72
82
|
/// Output custom properties for ulu
|
|
73
83
|
|
|
74
84
|
@mixin custom-properties() {
|
|
@@ -14,12 +14,18 @@
|
|
|
14
14
|
/// Module Settings
|
|
15
15
|
/// @type Map
|
|
16
16
|
/// @prop {Boolean} output-inverse [true] Whether to output the `.theme-inverse` utility and corresponding inverse variables
|
|
17
|
-
/// @prop {Color} fake-
|
|
18
|
-
/// @prop {String} fake-
|
|
17
|
+
/// @prop {Color} fake-invert-color [black] The fallback text color applied to elements using the fake inversion utilities. Note: This should be the color that, when inverted, results in the desired theme color.
|
|
18
|
+
/// @prop {String} fake-invert-filter [invert(1) hue-rotate(180deg) saturate(0.7)] The filter applied to elements using the fake inversion utilities.
|
|
19
|
+
/// @prop {String} token-color ["color-type"] The token name used for the `color` property on theme classes.
|
|
20
|
+
/// @prop {String} token-background-color [null] The token name used for the `background-color` property on theme classes. This is not included by default (normally we don't want to set a specific background color but if you do add the background-color token name from the theme)
|
|
21
|
+
/// @prop {Boolean} token-warnings [true] Since this is an opinionated stylesheet we warn if you have "token-color" set but it's key is not found in the theme. If this is intentional
|
|
19
22
|
$config: (
|
|
20
23
|
"output-inverse": true,
|
|
21
|
-
"fake-
|
|
22
|
-
"fake-
|
|
24
|
+
"fake-invert-color": black,
|
|
25
|
+
"fake-invert-filter": invert(1) hue-rotate(180deg) saturate(0.7),
|
|
26
|
+
"token-color": "color-type",
|
|
27
|
+
"token-background-color": null,
|
|
28
|
+
"token-warnings" : true,
|
|
23
29
|
) !default;
|
|
24
30
|
|
|
25
31
|
/// Change modules $config
|
|
@@ -44,7 +50,7 @@ $config: (
|
|
|
44
50
|
$keys: themes.get-keys();
|
|
45
51
|
$default: themes.get("default");
|
|
46
52
|
$prefix: selector.class("theme");
|
|
47
|
-
$
|
|
53
|
+
$fake-selectors: ();
|
|
48
54
|
$inverses: themes.get("inverses");
|
|
49
55
|
$inverse-prefix: selector.class("theme-inverse");
|
|
50
56
|
$output-inverse: get("output-inverse");
|
|
@@ -66,6 +72,20 @@ $config: (
|
|
|
66
72
|
}
|
|
67
73
|
@include themes.declare($key);
|
|
68
74
|
|
|
75
|
+
// Force color and background-color if tokens are set
|
|
76
|
+
$color-token: get("token-color");
|
|
77
|
+
$bg-token: get("token-background-color");
|
|
78
|
+
|
|
79
|
+
@include -token-warning("token-color", $key);
|
|
80
|
+
@include -token-warning("token-background-color", $key);
|
|
81
|
+
|
|
82
|
+
@if ($color-token) {
|
|
83
|
+
color: cssvar.use($color-token);
|
|
84
|
+
}
|
|
85
|
+
@if ($bg-token) {
|
|
86
|
+
background-color: cssvar.use($bg-token);
|
|
87
|
+
}
|
|
88
|
+
|
|
69
89
|
// Optional Inverse Variables (Variable Swap Approach)
|
|
70
90
|
// Can use @scope in the future but for now we suffix -"inverse"
|
|
71
91
|
@if ($output-inverse) {
|
|
@@ -88,26 +108,40 @@ $config: (
|
|
|
88
108
|
}
|
|
89
109
|
}
|
|
90
110
|
|
|
91
|
-
// Contextual trigger for the fake
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
111
|
+
// Contextual trigger for the fake inversion utility
|
|
112
|
+
--ulu-theme-fake-filter: #{ get("fake-invert-filter") };
|
|
113
|
+
|
|
114
|
+
$fake-color: get("fake-invert-color");
|
|
115
|
+
$fake-bg: inherit;
|
|
116
|
+
$color-token: get("token-color");
|
|
117
|
+
$bg-token: get("token-background-color");
|
|
118
|
+
|
|
119
|
+
@if ($output-inverse) {
|
|
120
|
+
$inverse-key: map.get($inverses, $key);
|
|
121
|
+
@if ($inverse-key) {
|
|
122
|
+
@if ($color-token) {
|
|
123
|
+
$fake-color: var(#{ cssvar.name("inverse-" + $color-token) }, #{ $fake-color });
|
|
124
|
+
}
|
|
125
|
+
@if ($bg-token) {
|
|
126
|
+
$fake-bg: var(#{ cssvar.name("inverse-" + $bg-token) }, white);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
98
129
|
}
|
|
99
|
-
}
|
|
100
130
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
131
|
+
--ulu-theme-fake-color: #{ $fake-color };
|
|
132
|
+
--ulu-theme-fake-background-color: #{ $fake-bg };
|
|
133
|
+
|
|
134
|
+
$fake-selectors: list.append($fake-selectors, $selectors, comma);
|
|
135
|
+
|
|
136
|
+
// Ensure fake utility applies to inverted themes
|
|
137
|
+
@if ($output-inverse) {
|
|
138
|
+
@each $current-theme, $inverse-target in $inverses {
|
|
139
|
+
@if ($inverse-target == $key) {
|
|
140
|
+
$fake-selectors: list.append($fake-selectors, "#{ $prefix }-#{ $current-theme } #{ $inverse-prefix }", comma);
|
|
141
|
+
@if ($current-theme == $default) {
|
|
142
|
+
$fake-selectors: list.append($fake-selectors, ":root #{ $inverse-prefix }", comma);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
111
145
|
}
|
|
112
146
|
}
|
|
113
147
|
}
|
|
@@ -124,20 +158,44 @@ $config: (
|
|
|
124
158
|
@include cssvar.declare($prop, var(#{ $inv-name }));
|
|
125
159
|
}
|
|
126
160
|
}
|
|
161
|
+
// Force color and background-color if tokens are set
|
|
162
|
+
$color-token: get("token-color");
|
|
163
|
+
$bg-token: get("token-background-color");
|
|
164
|
+
@if ($color-token) {
|
|
165
|
+
color: cssvar.use($color-token);
|
|
166
|
+
}
|
|
167
|
+
@if ($bg-token) {
|
|
168
|
+
background-color: cssvar.use($bg-token);
|
|
169
|
+
}
|
|
127
170
|
}
|
|
128
171
|
}
|
|
129
172
|
|
|
130
|
-
// 3. The Fake
|
|
131
|
-
/// Can be used on elements that need
|
|
173
|
+
// 3. The Fake Inversion Utility Class
|
|
174
|
+
/// Can be used on elements that need a theme but that have colors that can't be updated (canvas charts for example)
|
|
132
175
|
/// It inverts the items color, and then inverts/spins the element colors so they match the hue before inversion
|
|
133
176
|
/// It also decreases the contrast slightly
|
|
134
|
-
@if (list.length($
|
|
135
|
-
#{ $
|
|
136
|
-
#{ $prefix }-
|
|
177
|
+
@if (list.length($fake-selectors) > 0) {
|
|
178
|
+
#{ $fake-selectors } {
|
|
179
|
+
#{ $prefix }-fake-invert,
|
|
180
|
+
#{ $prefix }-dark-fake { // Legacy support
|
|
137
181
|
filter: var(--ulu-theme-fake-filter, none);
|
|
138
182
|
color: var(--ulu-theme-fake-color, inherit);
|
|
183
|
+
background-color: var(--ulu-theme-fake-background-color, transparent);
|
|
139
184
|
}
|
|
140
185
|
}
|
|
141
186
|
}
|
|
142
187
|
}
|
|
143
188
|
}
|
|
189
|
+
|
|
190
|
+
/// Internal mixin for warnings (DRY)
|
|
191
|
+
@mixin -token-warning($token-property, $theme-key) {
|
|
192
|
+
@if (get("token-warnings")) {
|
|
193
|
+
$token: get($token-property);
|
|
194
|
+
@if ($token) {
|
|
195
|
+
$def: utils.ensure-map(map.get(themes.$tokens, $token));
|
|
196
|
+
@if (not utils.map-has($def, $theme-key)) {
|
|
197
|
+
@warn "ULU Themes: The token '#{ $token }' (#{ $token-property}) is missing a value for theme '#{ $theme-key }'. This may cause color inheritance issues.";
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -59,6 +59,8 @@ $-fallbacks: (
|
|
|
59
59
|
/// @prop {Boolean} vertical-indicator-left [true] The indicator for selected tab should be on the left when vertical (false will be on right/inside)
|
|
60
60
|
/// @prop {Boolean} vertical-breakpoint [true] Set the breakpoint when the vertical tabs should switch to horizontal (defaults to breakpoint 'default')
|
|
61
61
|
/// @prop {Boolean} horizontal-tab-wrap [false] Set to true to allow line wrapping when the tabs are in horizontal orientation, vertical is always allowed to wrap
|
|
62
|
+
/// @prop {Color} full-width-tablist-background-color [null] Optional background color for full-width tabs tablist
|
|
63
|
+
/// @prop {Color} full-width-tabpanel-background-color [transparent] Optional background color for full-width tabs tabpanel
|
|
62
64
|
|
|
63
65
|
$config: (
|
|
64
66
|
"margin" : (2rem 0),
|
|
@@ -88,7 +90,9 @@ $config: (
|
|
|
88
90
|
"vertical-tab-gap" : 0.75em,
|
|
89
91
|
"vertical-indicator-left" : true,
|
|
90
92
|
"vertical-breakpoint" : true,
|
|
91
|
-
"horizontal-tab-wrap" : false
|
|
93
|
+
"horizontal-tab-wrap" : false,
|
|
94
|
+
"full-width-tablist-background-color" : null,
|
|
95
|
+
"full-width-tabpanel-background-color" : transparent,
|
|
92
96
|
) !default;
|
|
93
97
|
|
|
94
98
|
/// Change modules $config
|
|
@@ -254,9 +258,10 @@ $config: (
|
|
|
254
258
|
#{ $prefix }--full-width {
|
|
255
259
|
> [role="tablist"] {
|
|
256
260
|
justify-content: safe center;
|
|
261
|
+
background-color: color.get(get("full-width-tablist-background-color"));
|
|
257
262
|
}
|
|
258
263
|
>[role="tabpanel"] {
|
|
259
|
-
background-color:
|
|
264
|
+
background-color: color.get(get("full-width-tabpanel-background-color"));
|
|
260
265
|
padding: 0;
|
|
261
266
|
}
|
|
262
267
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ulu/frontend",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "A framework-agnostic frontend toolkit providing a modular, tree-shakable library of accessible components and utilities. Designed for seamless integration, it features a highly configurable SCSS system for any environment and vanilla JavaScript modules optimized for traditional websites and content management systems.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|