Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/type/mixins/_fluid-type.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
// Set base properties
--#{$css-ns}-#{$type}-#{$size}-family: #{type-property-check($theme-config, $size, 'family')};
--#{$css-ns}-#{$type}-#{$size}-family-fallback: #{type-property-check($theme-config, $size, 'familyFallback')};
--#{$css-ns}-#{$type}-#{$size}-letter-spacing: #{type-property-check($theme-config, $size, 'letter-spacing')};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Unconditionally setting the letter-spacing CSS variable may produce empty values when the config is missing that property.

Previously this variable was only emitted when letter-spacing existed in the config. Now, when type-property-check returns null, #{null} becomes an empty string, yielding:

--foo-bar-letter-spacing: ;

This can change how other code distinguishes between “not set” and “intentionally empty” (e.g., via var(--..., <fallback>) or computed style checks).

If the variable should only exist when configured, keep the conditional:

$letter-spacing: type-property-check($theme-config, $size, 'letter-spacing');
@if $letter-spacing != null {
  --#{$css-ns}-#{$type}-#{$size}-letter-spacing: #{$letter-spacing};
}

If it must always exist, consider a clear sentinel value (e.g., initial or normal) instead of an empty value, depending on consumers’ expectations.

--#{$css-ns}-#{$type}-#{$size}-weight: #{type-property-check($theme-config, $size, 'weight')};
--#{$css-ns}-#{$type}-#{$size}-line-height: #{type-property-check($theme-config, $size, 'line-height')};

@if type-property-check($theme-config, $size, 'letter-spacing') != null {
--#{$css-ns}-#{$type}-#{$size}-letter-spacing: #{type-property-check($theme-config, $size, 'letter-spacing')};
}

// Get min, preferred and max values from the config
$min-size: auro_map-deep-get($theme-config, 'sizes', $size, 'font-size', 'min');
$preferred-size: auro_map-deep-get($theme-config, 'sizes', $size, 'font-size', 'preferred');
Expand Down
14 changes: 9 additions & 5 deletions src/type/mixins/_theme-generator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@
@import "../mixins/type-generator";

// Theme generator
@mixin generate-theme($theme-name, $body-config, $display-config, $heading-config, $accent-config) {
@mixin generate-theme(
$theme-name,
$body-config,
$display-config,
$heading-config,
$accent-config,
$accent-uses-letter-spacing: true
) {
// Map of all type configs for the theme
$theme-configs: (
'body': $body-config,
'display': $display-config,
'heading': $heading-config,
'accent': $accent-config
);

// Derive letter-spacing behavior from accent config data rather than theme name
$accent-uses-letter-spacing: type-property-check($accent-config, '2xl', 'letter-spacing') != null;

// Generate CSS variables for the theme
@include generate-theme-type-css-vars($theme-configs);

// Generate theme type classes
@include generate-theme-type-classes($use-letter-spacing: $accent-uses-letter-spacing);
@include generate-theme-type-classes($accent-use-letter-spacing: $accent-uses-letter-spacing);
}
4 changes: 2 additions & 2 deletions src/type/mixins/_type-generator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
}

// Generate theme type classes
@mixin generate-theme-type-classes($use-fallback: false, $fallback-configs: null, $use-letter-spacing: true) {
@mixin generate-theme-type-classes($use-fallback: false, $fallback-configs: null, $accent-use-letter-spacing: true) {
@include generate-body-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'body'), null));
@include generate-display-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'display'), null));
@include generate-heading-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'heading'), null));
@include generate-accent-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'accent'), null), $use-letter-spacing);
@include generate-accent-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'accent'), null), $accent-use-letter-spacing);
Comment on lines +17 to +21
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Align naming between $accent-use-letter-spacing and $accent-uses-letter-spacing to reduce confusion.

generate-theme uses $accent-uses-letter-spacing while this mixin uses $accent-use-letter-spacing. This small difference (use vs uses) can cause mistakes with named arguments and code search. Please standardize on one name across both mixins (e.g., $accent-use-letter-spacing).

}
3 changes: 2 additions & 1 deletion src/type/themes/hawaiian/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
$hawaiian-type-body-config,
$hawaiian-type-display-config,
$hawaiian-type-heading-config,
$hawaiian-type-accent-config
$hawaiian-type-accent-config,
$accent-uses-letter-spacing: false
);
Loading