@volverjs/style 0.1.22 → 0.1.24-beta.1
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/README.md +30 -0
- package/dist/base.css +1 -1
- package/dist/components/vv-accordion.css +1 -1
- package/dist/components/vv-alert.css +1 -1
- package/dist/components/vv-badge.css +1 -1
- package/dist/components/vv-button.css +1 -1
- package/dist/components/vv-card.css +1 -1
- package/dist/components/vv-checkbox.css +1 -1
- package/dist/components/vv-dropdown-action.css +1 -1
- package/dist/components/vv-dropdown-option.css +1 -1
- package/dist/components/vv-dropdown.css +1 -1
- package/dist/components/vv-input-file.css +1 -1
- package/dist/components/vv-input-text.css +1 -1
- package/dist/components/vv-nav.css +1 -1
- package/dist/components/vv-radio.css +1 -1
- package/dist/components/vv-select.css +1 -1
- package/dist/components/vv-text.css +1 -1
- package/dist/components/vv-tooltip.css +1 -1
- package/dist/components.css +1 -1
- package/dist/export.css +1 -1
- package/dist/props/breakpoints.css +1 -1
- package/dist/props/colors.css +1 -1
- package/dist/props/effects.css +1 -1
- package/dist/props/spacing.css +1 -1
- package/dist/props/transitions.css +1 -1
- package/dist/props/typography.css +1 -1
- package/dist/props.css +1 -1
- package/dist/reset.css +1 -1
- package/dist/themes/dark/components.css +1 -1
- package/dist/themes/dark/props.css +1 -1
- package/dist/themes/dark/volver.css +1 -1
- package/dist/utilities/borders.css +1 -1
- package/dist/utilities/colors.css +1 -1
- package/dist/utilities/effects.css +1 -1
- package/dist/utilities/flexbox.css +1 -1
- package/dist/utilities/grid.css +1 -1
- package/dist/utilities/layout.css +1 -1
- package/dist/utilities/sizing.css +1 -1
- package/dist/utilities/typography.css +1 -1
- package/dist/utilities.css +1 -1
- package/dist/volver.css +1 -1
- package/package.json +22 -22
- package/src/_config.scss +12 -0
- package/src/_layers.scss +4 -0
- package/src/_preflight.scss +2 -0
- package/src/components/vv-accordion-group.scss +3 -0
- package/src/components/vv-accordion.scss +3 -0
- package/src/components/vv-alert-group.scss +3 -0
- package/src/components/vv-alert.scss +3 -0
- package/src/components/vv-avatar-group.scss +3 -0
- package/src/components/vv-avatar.scss +3 -0
- package/src/components/vv-badge.scss +3 -0
- package/src/components/vv-breadcrumb.scss +3 -0
- package/src/components/vv-button-group.scss +3 -0
- package/src/components/vv-button.scss +3 -0
- package/src/components/vv-card.scss +3 -0
- package/src/components/vv-checkbox-group.scss +3 -0
- package/src/components/vv-checkbox.scss +3 -0
- package/src/components/vv-dialog.scss +3 -0
- package/src/components/vv-dropdown-action.scss +3 -0
- package/src/components/vv-dropdown-optgroup.scss +3 -0
- package/src/components/vv-dropdown-option.scss +3 -0
- package/src/components/vv-dropdown.scss +3 -0
- package/src/components/vv-input-file.scss +3 -0
- package/src/components/vv-input-text.scss +3 -0
- package/src/components/vv-nav.scss +3 -0
- package/src/components/vv-progress.scss +3 -0
- package/src/components/vv-radio-group.scss +3 -0
- package/src/components/vv-radio.scss +3 -0
- package/src/components/vv-select.scss +3 -0
- package/src/components/vv-skeleton.scss +3 -0
- package/src/components/vv-tab.scss +3 -0
- package/src/components/vv-table.scss +3 -0
- package/src/components/vv-text.scss +3 -0
- package/src/components/vv-textarea.scss +3 -0
- package/src/components/vv-tooltip.scss +5 -7
- package/src/export.scss +0 -1
- package/src/props/background.scss +5 -3
- package/src/props/borders.scss +5 -3
- package/src/props/breakpoints.scss +11 -9
- package/src/props/colors.scss +4 -2
- package/src/props/effects.scss +5 -3
- package/src/props/filters.scss +6 -4
- package/src/props/input.scss +4 -2
- package/src/props/layout.scss +5 -3
- package/src/props/sizing.scss +5 -3
- package/src/props/spacing.scss +16 -16
- package/src/props/transitions.scss +150 -118
- package/src/props/typography.scss +24 -24
- package/src/reset.scss +4 -3
- package/src/settings/_colors.scss +80 -50
- package/src/settings/_effects.scss +7 -7
- package/src/settings/components/_vv-accordion.scss +2 -1
- package/src/settings/components/_vv-badge.scss +2 -10
- package/src/settings/components/_vv-button.scss +1 -1
- package/src/settings/components/_vv-card.scss +3 -17
- package/src/settings/components/_vv-nav.scss +1 -6
- package/src/settings/components/_vv-text.scss +1 -0
- package/src/themes/dark/components/_vv-alert.scss +14 -10
- package/src/themes/dark/components/_vv-avatar.scss +14 -10
- package/src/themes/dark/components/_vv-badge.scss +14 -10
- package/src/themes/dark/components/_vv-button.scss +14 -10
- package/src/themes/dark/components/_vv-dropdown-action.scss +14 -10
- package/src/themes/dark/components/_vv-dropdown-option.scss +14 -10
- package/src/themes/dark/components/_vv-nav.scss +14 -10
- package/src/themes/dark/components/_vv-select.scss +14 -10
- package/src/themes/dark/props/_background.scss +3 -0
- package/src/themes/dark/props/_colors.scss +3 -0
- package/src/themes/dark/props/_input.scss +3 -0
- package/src/themes/dark/settings/_colors.scss +42 -28
- package/src/themes/dark/settings/components/_vv-alert.scss +23 -0
- package/src/themes/dark/settings/components/_vv-avatar.scss +3 -0
- package/src/themes/dark/settings/components/_vv-button.scss +0 -1
- package/src/tools/_breakpoints.scss +20 -4
- package/src/tools/_functions.scss +157 -0
- package/src/tools/_mixins.scss +5 -1216
- package/src/tools/mixin-modules/_attrs.scss +178 -0
- package/src/tools/mixin-modules/_bem.scss +751 -0
- package/src/tools/mixin-modules/_helpers.scss +23 -0
- package/src/tools/mixin-modules/_index.scss +25 -0
- package/src/tools/mixin-modules/_layers.scss +42 -0
- package/src/tools/mixin-modules/_props.scss +41 -0
- package/src/tools/mixin-modules/_theme.scss +354 -0
- package/src/tools/mixin-modules/_utilities.scss +121 -0
- package/src/utilities/backgrounds.scss +3 -0
- package/src/utilities/borders.scss +3 -0
- package/src/utilities/colors.scss +3 -0
- package/src/utilities/effects.scss +3 -0
- package/src/utilities/filters.scss +3 -0
- package/src/utilities/flexbox.scss +3 -0
- package/src/utilities/grid.scss +3 -0
- package/src/utilities/interactivity.scss +3 -0
- package/src/utilities/layout.scss +3 -0
- package/src/utilities/sizing.scss +3 -0
- package/src/utilities/spacing.scss +3 -0
- package/src/utilities/tables.scss +3 -0
- package/src/utilities/transforms.scss +11 -6
- package/src/utilities/transitions.scss +3 -0
- package/src/utilities/typography.scss +3 -0
- package/src/volver.scss +2 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
|
|
4
|
+
// ============================================
|
|
5
|
+
// Utility Helpers
|
|
6
|
+
// ============================================
|
|
7
|
+
|
|
8
|
+
// Wrap selector with :where() for zero specificity
|
|
9
|
+
// @param {String|List} $selector - The selector to wrap
|
|
10
|
+
// @param {Bool} $enabled - Whether to wrap in :where()
|
|
11
|
+
@mixin wrap-with-where($selector, $enabled: true) {
|
|
12
|
+
@if meta.type-of($selector) == 'map' or meta.type-of($selector) == 'list' {
|
|
13
|
+
$selector: #{$selector};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@if $enabled {
|
|
17
|
+
$selector: ':where(#{string.unquote($selector)})';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#{$selector} {
|
|
21
|
+
@content;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// Mixins Index
|
|
3
|
+
// Re-exports all mixins for easy importing
|
|
4
|
+
// ============================================
|
|
5
|
+
|
|
6
|
+
// Core helpers (wrap-with-where)
|
|
7
|
+
@forward 'helpers';
|
|
8
|
+
|
|
9
|
+
// CSS Custom Properties (spread-map-into-props)
|
|
10
|
+
@forward 'props';
|
|
11
|
+
|
|
12
|
+
// CSS Attributes (spread-map-into-attrs)
|
|
13
|
+
@forward 'attrs';
|
|
14
|
+
|
|
15
|
+
// CSS Layers (layer, define-layers)
|
|
16
|
+
@forward 'layers';
|
|
17
|
+
|
|
18
|
+
// Utilities (spread-map-into-utilities)
|
|
19
|
+
@forward 'utilities';
|
|
20
|
+
|
|
21
|
+
// BEM structure (spread-map-into-bem, modifiers, elements, states, breakpoints, transitions)
|
|
22
|
+
@forward 'bem';
|
|
23
|
+
|
|
24
|
+
// Theme utilities (spread-theme-component)
|
|
25
|
+
@forward 'theme';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// CSS @layer utilities
|
|
3
|
+
// ============================================
|
|
4
|
+
|
|
5
|
+
// Wrap content in a CSS @layer
|
|
6
|
+
// @param {String} $name - Layer name (reset, props, utilities, components, themes)
|
|
7
|
+
// @param {Bool} $enabled - Whether to wrap in @layer (default: false)
|
|
8
|
+
// @param {String} $prefix - Layer prefix (default: 'volver')
|
|
9
|
+
@mixin layer($name, $enabled: false, $prefix: 'volver') {
|
|
10
|
+
@if $enabled {
|
|
11
|
+
/* stylelint-disable-next-line layer-name-pattern */
|
|
12
|
+
@layer #{$prefix + '.' + $name} {
|
|
13
|
+
@content;
|
|
14
|
+
}
|
|
15
|
+
} @else {
|
|
16
|
+
@content;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Define layer order (call once at the start of your stylesheet)
|
|
21
|
+
// This establishes the cascade priority: later layers win
|
|
22
|
+
// @param {Bool} $enabled - Whether to output @layer declaration
|
|
23
|
+
// @param {List} $order - Layer order list
|
|
24
|
+
// @param {String} $prefix - Layer prefix
|
|
25
|
+
@mixin define-layers($enabled: false, $order: (reset, props, utilities, components, themes), $prefix: 'volver') {
|
|
26
|
+
@if $enabled {
|
|
27
|
+
$layers: null;
|
|
28
|
+
|
|
29
|
+
@each $name in $order {
|
|
30
|
+
$layer-name: $prefix + '.' + $name;
|
|
31
|
+
|
|
32
|
+
@if $layers {
|
|
33
|
+
$layers: $layers + ', ' + $layer-name;
|
|
34
|
+
} @else {
|
|
35
|
+
$layers: $layer-name;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* stylelint-disable-next-line layer-name-pattern */
|
|
40
|
+
@layer #{$layers};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'sass:meta';
|
|
3
|
+
@use 'sass:string';
|
|
4
|
+
@use '../functions' as *;
|
|
5
|
+
|
|
6
|
+
// ============================================
|
|
7
|
+
// CSS Custom Properties (Variables) Mixin
|
|
8
|
+
// ============================================
|
|
9
|
+
|
|
10
|
+
// Transform a map into a list of CSS custom properties
|
|
11
|
+
// @param {Map} $map - The map to transform
|
|
12
|
+
// @param {String} $prefix - Variable name prefix
|
|
13
|
+
// @param {String} $old-key - Previous key for recursion
|
|
14
|
+
// @param {Bool} $deep - Whether to recurse into nested maps
|
|
15
|
+
@mixin spread-map-into-props($map: (), $prefix: '', $old-key: '', $deep: true) {
|
|
16
|
+
@each $key, $value in $map {
|
|
17
|
+
$name: meta.inspect($key);
|
|
18
|
+
|
|
19
|
+
@if $name == meta.inspect($old-key) {
|
|
20
|
+
$name: $prefix;
|
|
21
|
+
} @else if $prefix != '' and meta.inspect($prefix) != meta.inspect($key) {
|
|
22
|
+
$name: $prefix + '-' + $key;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// fix name
|
|
26
|
+
$name: str-replace($name, '\\/', '-');
|
|
27
|
+
|
|
28
|
+
@if string.slice(meta.inspect($key), 1, 1) != '_' and
|
|
29
|
+
string.slice(meta.inspect($key), 1, 2) != '--' and
|
|
30
|
+
string.slice(meta.inspect($key), 1, 1) != '['
|
|
31
|
+
{
|
|
32
|
+
@if meta.type-of($value) == 'map' {
|
|
33
|
+
@if $deep {
|
|
34
|
+
@include spread-map-into-props($value, $name, $key);
|
|
35
|
+
}
|
|
36
|
+
} @else {
|
|
37
|
+
#{'--' + $name}: #{$value};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'sass:list';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use 'props' as *;
|
|
5
|
+
@use 'attrs' as *;
|
|
6
|
+
|
|
7
|
+
// ============================================
|
|
8
|
+
// Theme component utilities
|
|
9
|
+
// Generates CSS for theme overrides without @extend
|
|
10
|
+
// (needed to work inside media queries)
|
|
11
|
+
// ============================================
|
|
12
|
+
|
|
13
|
+
// Extract values from base-map that match the keys in theme-map
|
|
14
|
+
// This is used to generate light reset rules
|
|
15
|
+
// @param {Map} $base-map - Original component map with light values
|
|
16
|
+
// @param {Map} $theme-map - Theme override map (used to determine which keys to extract)
|
|
17
|
+
// @return {Map|null} - Map with light values for keys modified in theme-map, or null if empty
|
|
18
|
+
@function extract-light-values($base-map, $theme-map) {
|
|
19
|
+
$result: ();
|
|
20
|
+
|
|
21
|
+
@each $key, $value in $theme-map {
|
|
22
|
+
@if map.has-key($base-map, $key) {
|
|
23
|
+
$base-value: map.get($base-map, $key);
|
|
24
|
+
|
|
25
|
+
@if meta.type-of($value) == 'map' and meta.type-of($base-value) == 'map' {
|
|
26
|
+
// Recursively extract nested maps
|
|
27
|
+
$nested: extract-light-values($base-value, $value);
|
|
28
|
+
|
|
29
|
+
@if $nested and list.length(map.keys($nested)) > 0 {
|
|
30
|
+
$result: map.set($result, $key, $nested);
|
|
31
|
+
}
|
|
32
|
+
} @else {
|
|
33
|
+
// Direct value - use the base (light) value
|
|
34
|
+
$result: map.set($result, $key, $base-value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Return null if empty map
|
|
40
|
+
@if list.length(map.keys($result)) == 0 {
|
|
41
|
+
@return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@return $result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Apply theme overrides to a component
|
|
48
|
+
// - With $use-custom-props: true → generates CSS variables only
|
|
49
|
+
// - With $use-custom-props: false → generates CSS attributes directly
|
|
50
|
+
// @param {Map} $base-map - Original component map (e.g., $vv-button)
|
|
51
|
+
// @param {Map} $theme-map - Theme override map (e.g., $dark-vv-button)
|
|
52
|
+
// @param {String} $component-name - Component name (e.g., 'vv-button')
|
|
53
|
+
// @param {Map} $bps - Breakpoints map
|
|
54
|
+
// @param {Bool} $use-custom-props - Whether to use CSS custom properties
|
|
55
|
+
// @param {Bool} $generate-light-reset - Auto-generate light reset from base-map (default: true)
|
|
56
|
+
// @param {String} $light-reset-selector - Selector for light reset (default: '.theme.theme--light')
|
|
57
|
+
@mixin spread-theme-component(
|
|
58
|
+
$base-map,
|
|
59
|
+
$theme-map,
|
|
60
|
+
$component-name,
|
|
61
|
+
$bps: (xxs: 0),
|
|
62
|
+
$use-custom-props: true,
|
|
63
|
+
$generate-light-reset: true,
|
|
64
|
+
$light-reset-selector: '.theme.theme--light'
|
|
65
|
+
) {
|
|
66
|
+
// Calculate light reset map from base-map if needed
|
|
67
|
+
$light-reset-map: null;
|
|
68
|
+
|
|
69
|
+
@if $generate-light-reset {
|
|
70
|
+
$light-reset-map: extract-light-values($base-map, $theme-map);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@if $use-custom-props {
|
|
74
|
+
// Generate CSS variables only (themes override variables)
|
|
75
|
+
@include spread-map-into-props(
|
|
76
|
+
$map: $theme-map,
|
|
77
|
+
$prefix: $component-name
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
// Light reset with custom props
|
|
81
|
+
@if $light-reset-map and $generate-light-reset {
|
|
82
|
+
#{$light-reset-selector} {
|
|
83
|
+
@include spread-map-into-props(
|
|
84
|
+
$map: $light-reset-map,
|
|
85
|
+
$prefix: $component-name
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} @else {
|
|
90
|
+
// Generate CSS attributes directly for theme overrides
|
|
91
|
+
$selector: '.' + $component-name;
|
|
92
|
+
|
|
93
|
+
// Block styles (base attributes, ignoring nested structures)
|
|
94
|
+
#{$selector} {
|
|
95
|
+
@include spread-map-into-attrs(
|
|
96
|
+
$map: $theme-map,
|
|
97
|
+
$prefix: $component-name,
|
|
98
|
+
$props: false,
|
|
99
|
+
$ignore: (modifier, element, state, breakpoint, transition)
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Process modifiers recursively
|
|
104
|
+
@if map.has-key($theme-map, 'modifier') {
|
|
105
|
+
@include _theme-spread-modifiers(
|
|
106
|
+
$map: map.get($theme-map, 'modifier'),
|
|
107
|
+
$prefix: $component-name,
|
|
108
|
+
$block: $selector,
|
|
109
|
+
$bps: $bps
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Process elements
|
|
114
|
+
@if map.has-key($theme-map, 'element') {
|
|
115
|
+
@include _theme-spread-elements(
|
|
116
|
+
$map: map.get($theme-map, 'element'),
|
|
117
|
+
$prefix: $component-name,
|
|
118
|
+
$block: $selector,
|
|
119
|
+
$bps: $bps
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Process states at block level
|
|
124
|
+
@if map.has-key($theme-map, 'state') {
|
|
125
|
+
@include _theme-spread-states(
|
|
126
|
+
$map: map.get($theme-map, 'state'),
|
|
127
|
+
$prefix: $component-name,
|
|
128
|
+
$block: $selector,
|
|
129
|
+
$parent-selector: $selector,
|
|
130
|
+
$bps: $bps
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Generate light reset rules if enabled
|
|
135
|
+
@if $light-reset-map and $generate-light-reset {
|
|
136
|
+
#{$light-reset-selector} {
|
|
137
|
+
@include _theme-generate-all(
|
|
138
|
+
$map: $light-reset-map,
|
|
139
|
+
$prefix: $component-name,
|
|
140
|
+
$block: $selector,
|
|
141
|
+
$bps: $bps
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Helper to generate all theme rules (block, modifiers, elements, states)
|
|
149
|
+
@mixin _theme-generate-all($map, $prefix, $block, $bps) {
|
|
150
|
+
// Block styles
|
|
151
|
+
#{$block} {
|
|
152
|
+
@include spread-map-into-attrs(
|
|
153
|
+
$map: $map,
|
|
154
|
+
$prefix: $prefix,
|
|
155
|
+
$props: false,
|
|
156
|
+
$ignore: (modifier, element, state, breakpoint, transition)
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Process modifiers
|
|
161
|
+
@if map.has-key($map, 'modifier') {
|
|
162
|
+
@include _theme-spread-modifiers(
|
|
163
|
+
$map: map.get($map, 'modifier'),
|
|
164
|
+
$prefix: $prefix,
|
|
165
|
+
$block: $block,
|
|
166
|
+
$bps: $bps
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Process elements
|
|
171
|
+
@if map.has-key($map, 'element') {
|
|
172
|
+
@include _theme-spread-elements(
|
|
173
|
+
$map: map.get($map, 'element'),
|
|
174
|
+
$prefix: $prefix,
|
|
175
|
+
$block: $block,
|
|
176
|
+
$bps: $bps
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Process states
|
|
181
|
+
@if map.has-key($map, 'state') {
|
|
182
|
+
@include _theme-spread-states(
|
|
183
|
+
$map: map.get($map, 'state'),
|
|
184
|
+
$prefix: $prefix,
|
|
185
|
+
$block: $block,
|
|
186
|
+
$parent-selector: $block,
|
|
187
|
+
$bps: $bps
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// ============================================
|
|
193
|
+
// Private helper mixins for theme spreading
|
|
194
|
+
// ============================================
|
|
195
|
+
|
|
196
|
+
// Spread modifiers for theme (no @extend)
|
|
197
|
+
@mixin _theme-spread-modifiers($map, $prefix, $block, $parent-selector: null, $bps: (xxs: 0)) {
|
|
198
|
+
@each $mod-name, $mod-value in $map {
|
|
199
|
+
$mod-selector: '#{$block}#{$block}--#{$mod-name}';
|
|
200
|
+
|
|
201
|
+
@if $parent-selector {
|
|
202
|
+
$mod-selector: '#{$parent-selector}#{$block}--#{$mod-name}';
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Modifier base styles
|
|
206
|
+
#{$mod-selector} {
|
|
207
|
+
@include spread-map-into-attrs(
|
|
208
|
+
$map: $mod-value,
|
|
209
|
+
$prefix: $prefix,
|
|
210
|
+
$props: false,
|
|
211
|
+
$ignore: (modifier, element, state, breakpoint)
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// States inside modifier
|
|
216
|
+
@if map.has-key($mod-value, 'state') {
|
|
217
|
+
@include _theme-spread-states(
|
|
218
|
+
$map: map.get($mod-value, 'state'),
|
|
219
|
+
$prefix: $prefix,
|
|
220
|
+
$block: $block,
|
|
221
|
+
$parent-selector: $mod-selector,
|
|
222
|
+
$bps: $bps
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Elements inside modifier
|
|
227
|
+
@if map.has-key($mod-value, 'element') {
|
|
228
|
+
@include _theme-spread-elements(
|
|
229
|
+
$map: map.get($mod-value, 'element'),
|
|
230
|
+
$prefix: $prefix,
|
|
231
|
+
$block: $block,
|
|
232
|
+
$parent-selector: $mod-selector,
|
|
233
|
+
$bps: $bps
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Nested modifiers
|
|
238
|
+
@if map.has-key($mod-value, 'modifier') {
|
|
239
|
+
@include _theme-spread-modifiers(
|
|
240
|
+
$map: map.get($mod-value, 'modifier'),
|
|
241
|
+
$prefix: $prefix,
|
|
242
|
+
$block: $block,
|
|
243
|
+
$parent-selector: $mod-selector,
|
|
244
|
+
$bps: $bps
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Spread elements for theme (no @extend)
|
|
251
|
+
@mixin _theme-spread-elements($map, $prefix, $block, $parent-selector: null, $bps: (xxs: 0)) {
|
|
252
|
+
@each $el-name, $el-value in $map {
|
|
253
|
+
$el-selector: '#{$block}__#{$el-name}';
|
|
254
|
+
$full-selector: $el-selector;
|
|
255
|
+
|
|
256
|
+
@if $parent-selector {
|
|
257
|
+
$full-selector: '#{$parent-selector} #{$el-selector}';
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Element base styles
|
|
261
|
+
#{$full-selector} {
|
|
262
|
+
@include spread-map-into-attrs(
|
|
263
|
+
$map: $el-value,
|
|
264
|
+
$prefix: $prefix,
|
|
265
|
+
$props: false,
|
|
266
|
+
$ignore: (modifier, element, state, breakpoint)
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// States inside element
|
|
271
|
+
@if map.has-key($el-value, 'state') {
|
|
272
|
+
@include _theme-spread-states(
|
|
273
|
+
$map: map.get($el-value, 'state'),
|
|
274
|
+
$prefix: $prefix,
|
|
275
|
+
$block: $el-selector,
|
|
276
|
+
$parent-selector: $parent-selector,
|
|
277
|
+
$bps: $bps
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Spread states for theme (no @extend)
|
|
284
|
+
@mixin _theme-spread-states($map, $prefix, $block, $parent-selector: null, $bps: (xxs: 0)) {
|
|
285
|
+
$state-list: (
|
|
286
|
+
active, focus, hover, focus-within, target, visited, focus-visible,
|
|
287
|
+
disabled, checked, checked-within, multiple, selected, readonly,
|
|
288
|
+
empty, placeholder-shown, dirty, valid, invalid, indeterminate,
|
|
289
|
+
first-child, last-child, open, close, determinate, pressed, current
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
@each $state-name, $state-value in $map {
|
|
293
|
+
@if list.index($state-list, $state-name) {
|
|
294
|
+
$base: $block;
|
|
295
|
+
|
|
296
|
+
@if $parent-selector {
|
|
297
|
+
$base: $parent-selector;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// BEM modifier style: .block--state
|
|
301
|
+
#{$base}#{$block}--#{$state-name},
|
|
302
|
+
// Class style: .block.state
|
|
303
|
+
#{$base}.#{$state-name} {
|
|
304
|
+
@include spread-map-into-attrs(
|
|
305
|
+
$map: $state-value,
|
|
306
|
+
$prefix: $prefix,
|
|
307
|
+
$props: false,
|
|
308
|
+
$ignore: (modifier, element, state, breakpoint)
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Pseudo-class style based on state type
|
|
313
|
+
@if $state-name == 'disabled' or $state-name == 'readonly' or $state-name == 'multiple' {
|
|
314
|
+
#{$base}[#{$state-name}] {
|
|
315
|
+
@include spread-map-into-attrs(
|
|
316
|
+
$map: $state-value,
|
|
317
|
+
$prefix: $prefix,
|
|
318
|
+
$props: false,
|
|
319
|
+
$ignore: (modifier, element, state, breakpoint)
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
} @else if $state-name == 'focus-visible' {
|
|
323
|
+
#{$base}:not(:active):not([disabled]):not([tabindex="-1"]):not([aria-disabled="true"]):#{$state-name} {
|
|
324
|
+
@include spread-map-into-attrs(
|
|
325
|
+
$map: $state-value,
|
|
326
|
+
$prefix: $prefix,
|
|
327
|
+
$props: false,
|
|
328
|
+
$ignore: (modifier, element, state, breakpoint)
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
} @else if $state-name != 'current' {
|
|
332
|
+
#{$base}:not([disabled]):#{$state-name} {
|
|
333
|
+
@include spread-map-into-attrs(
|
|
334
|
+
$map: $state-value,
|
|
335
|
+
$prefix: $prefix,
|
|
336
|
+
$props: false,
|
|
337
|
+
$ignore: (modifier, element, state, breakpoint)
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Elements inside state
|
|
343
|
+
@if map.has-key($state-value, 'element') {
|
|
344
|
+
@include _theme-spread-elements(
|
|
345
|
+
$map: map.get($state-value, 'element'),
|
|
346
|
+
$prefix: $prefix,
|
|
347
|
+
$block: $block,
|
|
348
|
+
$parent-selector: '#{$base}#{$block}--#{$state-name}',
|
|
349
|
+
$bps: $bps
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
@use '../functions' as *;
|
|
4
|
+
@use '../breakpoints' as *;
|
|
5
|
+
@use 'helpers' as *;
|
|
6
|
+
|
|
7
|
+
// ============================================
|
|
8
|
+
// Utilities Mixin
|
|
9
|
+
// Generates utility classes from maps
|
|
10
|
+
// ============================================
|
|
11
|
+
|
|
12
|
+
// Transform a map into a list of utility classes
|
|
13
|
+
// @param {Map|List} $map - The map or list to transform
|
|
14
|
+
// @param {String} $class - Base class name
|
|
15
|
+
// @param {String|List} $attribute - CSS attribute(s) to set
|
|
16
|
+
// @param {String} $prop - CSS custom property name
|
|
17
|
+
// @param {String} $name - Name for nested recursion
|
|
18
|
+
// @param {Bool} $deep - Whether to recurse into nested maps
|
|
19
|
+
// @param {Map} $bps - Breakpoints map
|
|
20
|
+
// @param {String} $prefix - Class prefix for breakpoints
|
|
21
|
+
// @param {Bool} $zero-specificity - Whether to wrap in :where()
|
|
22
|
+
@mixin spread-map-into-utilities(
|
|
23
|
+
$map: (),
|
|
24
|
+
$class: '',
|
|
25
|
+
$attribute: '',
|
|
26
|
+
$prop: '',
|
|
27
|
+
$name: '',
|
|
28
|
+
$deep: true,
|
|
29
|
+
$bps: (xxs: 0),
|
|
30
|
+
$prefix: '',
|
|
31
|
+
$zero-specificity: false
|
|
32
|
+
) {
|
|
33
|
+
@if (meta.type-of($map) == 'map' or meta.type-of($map) == 'list') and $attribute != '' {
|
|
34
|
+
@each $breakpoint, $breakpoint-value in $bps {
|
|
35
|
+
@if $breakpoint-value > 0 {
|
|
36
|
+
$prefix: $breakpoint + '\\:';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@each $key, $value in $map {
|
|
40
|
+
@if $name != '' and meta.inspect($key) != meta.inspect($name) {
|
|
41
|
+
$key: #{$name}-#{meta.inspect($key)};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@if meta.type-of($value) == 'map' and $deep {
|
|
45
|
+
@include spread-map-into-utilities(
|
|
46
|
+
$map: $value,
|
|
47
|
+
$class: $class,
|
|
48
|
+
$attribute: $attribute,
|
|
49
|
+
$prop: $prop,
|
|
50
|
+
$name: $key,
|
|
51
|
+
$bps: $bps,
|
|
52
|
+
$prefix: $prefix,
|
|
53
|
+
$zero-specificity: $zero-specificity
|
|
54
|
+
);
|
|
55
|
+
} @else {
|
|
56
|
+
$default: null;
|
|
57
|
+
$class-name: $class;
|
|
58
|
+
$key: meta.inspect($key);
|
|
59
|
+
$var: $prop;
|
|
60
|
+
|
|
61
|
+
// fix class name
|
|
62
|
+
@if $class-name != $key and $prop != $key {
|
|
63
|
+
@if $class-name != '' {
|
|
64
|
+
$class-name: $class-name + '-';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
$class-name: $class-name + $key;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// fix variable name
|
|
71
|
+
@if $var != '' and $var != $key {
|
|
72
|
+
$var: $var + '-' + $key;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
$var: str-replace($var, '\\/', '-');
|
|
76
|
+
|
|
77
|
+
// check if value is not a map (spacing-dynamic)
|
|
78
|
+
@if meta.type-of($value) != 'map' {
|
|
79
|
+
$default: $value;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// check if map is a list
|
|
83
|
+
@if meta.type-of($map) == 'list' and (not $default or $default == '') {
|
|
84
|
+
$default: $key;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@if meta.type-of($default) == 'string' {
|
|
88
|
+
$default: string.unquote($default);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
%#{$prefix}#{$class-name} {
|
|
92
|
+
@include media-breakpoint-up($breakpoint, $bps) {
|
|
93
|
+
@if meta.type-of($attribute) != 'list' {
|
|
94
|
+
$attribute: ($attribute);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@each $attr in $attribute {
|
|
98
|
+
@if $default {
|
|
99
|
+
@if $var != '' {
|
|
100
|
+
#{$attr}: var(--#{$var}, $default);
|
|
101
|
+
} @else {
|
|
102
|
+
#{$attr}: $default;
|
|
103
|
+
}
|
|
104
|
+
} @else if $var != '' {
|
|
105
|
+
#{$attr}: var(--#{$var});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@include wrap-with-where(
|
|
112
|
+
$selector: '.' + $prefix + $class-name,
|
|
113
|
+
$enabled: $zero-specificity
|
|
114
|
+
) {
|
|
115
|
+
@extend %#{$prefix}#{$class-name};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use '../context' as *;
|
|
2
2
|
|
|
3
|
+
@include layer(utilities, $use-css-layers, $layer-prefix) {
|
|
3
4
|
// background-attachment
|
|
4
5
|
@include spread-map-into-utilities(
|
|
5
6
|
$map: $background-attachment,
|
|
@@ -65,3 +66,5 @@
|
|
|
65
66
|
$prop: gradient,
|
|
66
67
|
$zero-specificity: $zero-specificity-for-utilities
|
|
67
68
|
);
|
|
69
|
+
|
|
70
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '../context' as *;
|
|
3
3
|
|
|
4
|
+
@include layer(utilities, $use-css-layers, $layer-prefix) {
|
|
4
5
|
// border-radius
|
|
5
6
|
@include spread-map-into-utilities(
|
|
6
7
|
$map: $border-radius,
|
|
@@ -88,3 +89,5 @@
|
|
|
88
89
|
$bps: $breakpoints,
|
|
89
90
|
$zero-specificity: $zero-specificity-for-utilities
|
|
90
91
|
);
|
|
92
|
+
|
|
93
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use '../context' as *;
|
|
2
2
|
|
|
3
|
+
@include layer(utilities, $use-css-layers, $layer-prefix) {
|
|
3
4
|
// background-color
|
|
4
5
|
@include spread-map-into-utilities(
|
|
5
6
|
$map: $colors,
|
|
@@ -35,3 +36,5 @@
|
|
|
35
36
|
$prop: color,
|
|
36
37
|
$zero-specificity: $zero-specificity-for-utilities
|
|
37
38
|
);
|
|
39
|
+
|
|
40
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use '../context' as *;
|
|
2
2
|
|
|
3
|
+
@include layer(utilities, $use-css-layers, $layer-prefix) {
|
|
3
4
|
// box shadow
|
|
4
5
|
@include spread-map-into-utilities(
|
|
5
6
|
$map: $box-shadow,
|
|
@@ -31,3 +32,5 @@
|
|
|
31
32
|
$attribute: background-blend-mode,
|
|
32
33
|
$zero-specificity: $zero-specificity-for-utilities
|
|
33
34
|
);
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use '../context' as *;
|
|
2
2
|
|
|
3
|
+
@include layer(utilities, $use-css-layers, $layer-prefix) {
|
|
3
4
|
// blur
|
|
4
5
|
@include spread-map-into-utilities(
|
|
5
6
|
$map: $blur,
|
|
@@ -31,3 +32,5 @@
|
|
|
31
32
|
$attribute: backdrop-filter,
|
|
32
33
|
$zero-specificity: $zero-specificity-for-utilities
|
|
33
34
|
);
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@use 'sass:meta';
|
|
3
3
|
@use '../context' as *;
|
|
4
4
|
|
|
5
|
+
@include layer(utilities, $use-css-layers, $layer-prefix) {
|
|
5
6
|
// flex direction
|
|
6
7
|
@include spread-map-into-utilities(
|
|
7
8
|
$map: $flex-direction,
|
|
@@ -134,3 +135,5 @@
|
|
|
134
135
|
$zero-specificity: $zero-specificity-for-utilities
|
|
135
136
|
);
|
|
136
137
|
}
|
|
138
|
+
|
|
139
|
+
}
|
package/src/utilities/grid.scss
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '../context' as *;
|
|
3
3
|
|
|
4
|
+
@include layer(utilities, $use-css-layers, $layer-prefix) {
|
|
4
5
|
// grid template columns
|
|
5
6
|
@include spread-map-into-utilities(
|
|
6
7
|
$map: $grid-template-columns,
|
|
@@ -82,3 +83,5 @@
|
|
|
82
83
|
$zero-specificity: $zero-specificity-for-utilities
|
|
83
84
|
);
|
|
84
85
|
}
|
|
86
|
+
|
|
87
|
+
}
|