Skip to content

Commit

Permalink
clean the output from setup-typo a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
lunelson committed Aug 9, 2019
1 parent 29ad051 commit cd924a6
Show file tree
Hide file tree
Showing 19 changed files with 1,233 additions and 1,160 deletions.
2,226 changes: 1,155 additions & 1,071 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"test:visual": "penny serve tests/_visual"
},
"devDependencies": {
"@lunelson/penny": "next",
"@lunelson/penny": "^2.0.0-alpha.14",
"@lunelson/sass-calc": "latest",
"@lunelson/sass-lerp": "latest",
"@lunelson/sass-maps-next": "latest",
Expand Down
6 changes: 3 additions & 3 deletions scss/_setup-root.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@include --output-medium-props();
}
}
html {
font-size: var(--font-size);
}
// html {
// font-size: var(--font-size);
// }
}
4 changes: 2 additions & 2 deletions scss/_setup-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ $colors: () !default;
}

body {
background-color: rgb(var(--color-#{$type}));
color: rgb(var(--contrast-#{$type}));
color: rgb(var(--fg-default));
background-color: rgb(var(--bg-default));
}

#{stateful-base-class('fg', false)} {
Expand Down
18 changes: 10 additions & 8 deletions scss/_setup-typo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@

@mixin homework-setup-typo( $trim: true, $trim-excl: div table figure img svg video iframe object section aside header footer article ) {

body { font-family: var(--font-family); }
html {
// NB: --font-size variable is set in setup-root(), it is responsive by $medium
font-size: var(--font-size);
font-family: var(--font-family);
line-height: var(--line-height);
}

// normalize $fonts
$fonts: if(length($fonts) > 0, $fonts, $fonts-defaults) !global;
Expand All @@ -28,9 +33,9 @@
// make first font in $fonts the default
@if $f == nth(map-keys($fonts), 1) {
--font-family: var(--font-family-#{$f});
--font-feature-settings: var(--font-feature-settings-#{$f});
--line-height: var(--line-height-#{$f});
--letter-spacing: var(--letter-spacing-#{$f});
--font-feature-settings: var(--font-feature-settings-#{$f});
}

$ff: map-get($font, 'font-family');
Expand All @@ -40,9 +45,9 @@

// output variant properties
--font-family-#{$f}: #{$ff};
--font-feature-settings-#{$f}: #{inspect($ffs)};
--line-height-#{$f}: #{decalc($lh)};
--letter-spacing-#{$f}: #{decalc($ls)};
--font-feature-settings-#{$f}: #{inspect($ffs)};

@if $trim {
$oc: map-get($font, 'dist-capline');
Expand Down Expand Up @@ -80,12 +85,10 @@
#{base-class('f', false)},
#{selector-combine(base-class('plain'), '*', '>')} {
font-size: var(--font-size); // TODO allow a lerp calc() expression here too

font-family: var(--font-family);
line-height: calc(var(--line-height)); // raw calc values
letter-spacing: calc(var(--letter-spacing)); // raw calc values
font-feature-settings: var(--font-feature-settings);
// NB using calc(var()) below because these are raw calc values
line-height: calc(var(--line-height));
letter-spacing: calc(var(--letter-spacing));
}

@if $trim {
Expand Down Expand Up @@ -116,7 +119,6 @@

#{base-class('f-#{$f}')} {
--font-family: var(--font-family-#{$f});
--line-height: var(--line-height-#{$f});
--letter-spacing: var(--letter-spacing-#{$f});
--font-feature-settings: var(--font-feature-settings-#{$f});

Expand Down
35 changes: 21 additions & 14 deletions tests/_visual/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
*/


@import 'fonts/messina-sans';
@import 'fonts/messina-serif';
@import 'fonts/messina-modern';

@import 'fonts/hack';
@import 'fonts/google';
@import 'fonts/neutral';
@import 'fonts/gt-america';
@import 'fonts/maison-neue';
// @import 'fonts/messina-sans';
// @import 'fonts/messina-serif';
// @import 'fonts/messina-modern';

// @import 'fonts/hack';
// @import 'fonts/google';
// @import 'fonts/neutral';
// @import 'fonts/gt-america';
// @import 'fonts/maison-neue';
@import 'fonts/theinhardt';
@import 'fonts/untitled-sans';
// @import 'fonts/untitled-sans';

@import 'prism';

Expand Down Expand Up @@ -80,13 +80,20 @@ $media: (

$fonts: (
// sans: $theinhardt,
sans: $neutral,
mono: $hack,
sans: (
family: ('Arial'),
dist-capline: 0.1,
dist-baseline: 0.1,
spacing: 1px,
spacing-max: 0.75,
spacing-end: 100
),
// mono: $hack,
// sans: $messina-sans,
// sans: $source-sans-pro,
serif: $messina-serif,
// serif: $messina-serif,
// serif: $source-serif-pro,
modern: $messina-modern,
// modern: $messina-modern,
// mono: $source-code-pro
);

Expand Down
2 changes: 1 addition & 1 deletion tests/_visual/fonts/_neutral.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

$neutral: (
font-family: "Neutral",
letter-spacing: calc(0.5px - 0.025em),
dist-capline: 0.1,
dist-baseline: 0.1,
letter-spacing: calc(0.5px - 0.025em),
);
4 changes: 0 additions & 4 deletions tests/renders/output-core-root.dartsass.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,4 @@
}
}

html {
font-size: var(--font-size);
}

/* ( a: ( font-size: 16px, inner-x: 1rem, inner-y: 1.5rem, outer-top: 2rem, outer-right: calc(31.25vw + -6.25rem), outer-bottom: 2rem, outer-left: calc(31.25vw + -6.25rem), column-count: 12, font-mods: ( sans: ( m: 18px 1.3, l: 24px 1.2 ), serif: ( m: 18px 1.3, l: 24px 1.2 ) ), inner-mods: ( s: 0.5, m: 1, l: 2 ), inner-y-mods: ( s: 0.5, m: 3.5rem, l: 2 ), outer-width: 30rem, breakpoint: 30em ), b: ( font-size: 16px, inner-x: 1rem, inner-y: 1.5rem, outer-top: 2rem, outer-right: calc(31.25vw + -6.25rem), outer-bottom: 2rem, outer-left: calc(31.25vw + -6.25rem), column-count: 12, font-mods: ( sans: ( m: 18px 1.3, l: 24px 1.2 ), serif: ( m: 18px 1.3, l: 30px 1.1 ) ), inner-mods: ( s: 0.5, m: 1, l: 2 ), inner-y-mods: ( s: 0.5, m: 3.5rem, l: 2 ), outer-width: 40rem, breakpoint: 40em ), c: ( font-size: 18px, inner-x: 1rem, inner-y: 1.5rem, outer-top: 2rem, outer-right: 200px, outer-bottom: 2rem, outer-left: 200px, column-count: 12, font-mods: ( sans: ( m: 18px 1.3, l: 24px 1.2 ), serif: ( m: 18px 1.3, l: 30px 1.1 ) ), inner-mods: ( s: 0.5, m: 1, l: 2 ), inner-y-mods: ( s: 0.5, m: 3.5rem, l: 2 ), outer-width: 53.3333333333rem, breakpoint: 60em ) ) */
4 changes: 0 additions & 4 deletions tests/renders/output-core-root.libsass.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@
}
}

html {
font-size: var(--font-size);
}

/* (
a: (
font-size: 16px,
Expand Down
4 changes: 2 additions & 2 deletions tests/renders/output-theme.dartsass.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
}

body {
background-color: rgb(var(--color-lite));
color: rgb(var(--contrast-lite));
color: rgb(var(--fg-default));
background-color: rgb(var(--bg-default));
}

[class^=fg-]:not([class$=fg-]), [class*=" fg-"]:not([class$=fg-]), [class*=__fg-]:not([class*=" __fg-"]):not([class*="__fg- "]):not([class$=__fg-]):not([class^=__fg-]) {
Expand Down
4 changes: 2 additions & 2 deletions tests/renders/output-theme.libsass.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
}

body {
background-color: rgb(var(--color-lite));
color: rgb(var(--contrast-lite));
color: rgb(var(--fg-default));
background-color: rgb(var(--bg-default));
}

[class^="fg-"]:not([class$="fg-"]), [class*=" fg-"]:not([class$="fg-"]), [class*="__fg-"]:not([class*=" __fg-"]):not([class*="__fg- "]):not([class$="__fg-"]):not([class^="__fg-"]) {
Expand Down
17 changes: 8 additions & 9 deletions tests/renders/output-typo.dartsass.css
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
body {
html {
font-size: var(--font-size);
font-family: var(--font-family);
line-height: var(--line-height);
}

:root {
--font-family: var(--font-family-sans);
--font-feature-settings: var(--font-feature-settings-sans);
--line-height: var(--line-height-sans);
--letter-spacing: var(--letter-spacing-sans);
--font-feature-settings: var(--font-feature-settings-sans);
--font-family-sans: MessinaSans;
--font-feature-settings-sans: ();
--line-height-sans: 1.4em;
--letter-spacing-sans: 0px;
--font-feature-settings-sans: ();
--dist-capline-sans: 0em;
--dist-baseline-sans: 0em;
--trim-sides-sans: 0;
--trim-adjacent-sans: 0.125em;
--font-family-serif: MessinaSerif;
--font-feature-settings-serif: ();
--line-height-serif: 1.4em;
--letter-spacing-serif: 0px;
--font-feature-settings-serif: ();
--dist-capline-serif: 0em;
--dist-baseline-serif: 0em;
--trim-sides-serif: 0;
--trim-adjacent-serif: 0.125em;
--font-family-modern: MessinaModern;
--font-feature-settings-modern: ();
--line-height-modern: 1.4em;
--letter-spacing-modern: 0px;
--font-feature-settings-modern: ();
--dist-capline-modern: 0em;
--dist-baseline-modern: 0em;
--trim-sides-modern: 0;
Expand Down Expand Up @@ -81,9 +83,9 @@ body {
.plain > *, [class^=plain-]:not([class$=plain-]) > *, [class*=" plain-"]:not([class$=plain-]) > * {
font-size: var(--font-size);
font-family: var(--font-family);
font-feature-settings: var(--font-feature-settings);
line-height: calc(var(--line-height));
letter-spacing: calc(var(--letter-spacing));
font-feature-settings: var(--font-feature-settings);
}

.trim > [class^=f-]:not([class$=f-]), .trim > [class*=" f-"]:not([class$=f-]),
Expand All @@ -109,7 +111,6 @@ body {

.f-sans, [class^=f-sans-]:not([class$=f-sans-]), [class*=" f-sans-"]:not([class$=f-sans-]) {
--font-family: var(--font-family-sans);
--line-height: var(--line-height-sans);
--letter-spacing: var(--letter-spacing-sans);
--font-feature-settings: var(--font-feature-settings-sans);
--dist-capline: 0em;
Expand All @@ -120,7 +121,6 @@ body {

.f-serif, [class^=f-serif-]:not([class$=f-serif-]), [class*=" f-serif-"]:not([class$=f-serif-]) {
--font-family: var(--font-family-serif);
--line-height: var(--line-height-serif);
--letter-spacing: var(--letter-spacing-serif);
--font-feature-settings: var(--font-feature-settings-serif);
--dist-capline: 0em;
Expand All @@ -131,7 +131,6 @@ body {

.f-modern, [class^=f-modern-]:not([class$=f-modern-]), [class*=" f-modern-"]:not([class$=f-modern-]) {
--font-family: var(--font-family-modern);
--line-height: var(--line-height-modern);
--letter-spacing: var(--letter-spacing-modern);
--font-feature-settings: var(--font-feature-settings-modern);
--dist-capline: 0em;
Expand Down
17 changes: 8 additions & 9 deletions tests/renders/output-typo.libsass.css
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
body {
html {
font-size: var(--font-size);
font-family: var(--font-family);
line-height: var(--line-height);
}

:root {
--font-family: var(--font-family-sans);
--font-feature-settings: var(--font-feature-settings-sans);
--line-height: var(--line-height-sans);
--letter-spacing: var(--letter-spacing-sans);
--font-feature-settings: var(--font-feature-settings-sans);
--font-family-sans: MessinaSans;
--font-feature-settings-sans: ();
--line-height-sans: 1.4em;
--letter-spacing-sans: 0px;
--font-feature-settings-sans: ();
--dist-capline-sans: 0em;
--dist-baseline-sans: 0em;
--trim-sides-sans: 0;
--trim-adjacent-sans: 0.125em;
--font-family-serif: MessinaSerif;
--font-feature-settings-serif: ();
--line-height-serif: 1.4em;
--letter-spacing-serif: 0px;
--font-feature-settings-serif: ();
--dist-capline-serif: 0em;
--dist-baseline-serif: 0em;
--trim-sides-serif: 0;
--trim-adjacent-serif: 0.125em;
--font-family-modern: MessinaModern;
--font-feature-settings-modern: ();
--line-height-modern: 1.4em;
--letter-spacing-modern: 0px;
--font-feature-settings-modern: ();
--dist-capline-modern: 0em;
--dist-baseline-modern: 0em;
--trim-sides-modern: 0;
Expand Down Expand Up @@ -83,9 +85,9 @@ body {
.plain > *, [class^="plain-"]:not([class$="plain-"]) > *, [class*=" plain-"]:not([class$="plain-"]) > * {
font-size: var(--font-size);
font-family: var(--font-family);
font-feature-settings: var(--font-feature-settings);
line-height: calc(var(--line-height));
letter-spacing: calc(var(--letter-spacing));
font-feature-settings: var(--font-feature-settings);
}

.trim > [class^="f-"]:not([class$="f-"]), .trim > [class*=" f-"]:not([class$="f-"]),
Expand All @@ -111,7 +113,6 @@ body {

.f-sans, [class^="f-sans-"]:not([class$="f-sans-"]), [class*=" f-sans-"]:not([class$="f-sans-"]) {
--font-family: var(--font-family-sans);
--line-height: var(--line-height-sans);
--letter-spacing: var(--letter-spacing-sans);
--font-feature-settings: var(--font-feature-settings-sans);
--dist-capline: 0em;
Expand All @@ -122,7 +123,6 @@ body {

.f-serif, [class^="f-serif-"]:not([class$="f-serif-"]), [class*=" f-serif-"]:not([class$="f-serif-"]) {
--font-family: var(--font-family-serif);
--line-height: var(--line-height-serif);
--letter-spacing: var(--letter-spacing-serif);
--font-feature-settings: var(--font-feature-settings-serif);
--dist-capline: 0em;
Expand All @@ -133,7 +133,6 @@ body {

.f-modern, [class^="f-modern-"]:not([class$="f-modern-"]), [class*=" f-modern-"]:not([class$="f-modern-"]) {
--font-family: var(--font-family-modern);
--line-height: var(--line-height-modern);
--letter-spacing: var(--letter-spacing-modern);
--font-feature-settings: var(--font-feature-settings-modern);
--dist-capline: 0em;
Expand Down
8 changes: 0 additions & 8 deletions tests/snapshots/output-core-root.scss.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ Generated by [AVA](https://ava.li).
}␊
}␊
html {␊
font-size: var(--font-size);␊
}␊
`

## output-core-root[libsass]
Expand Down Expand Up @@ -200,9 +196,5 @@ Generated by [AVA](https://ava.li).
}␊
}␊
html {␊
font-size: var(--font-size);␊
}␊
`
Binary file modified tests/snapshots/output-core-root.scss.snap
Binary file not shown.
8 changes: 4 additions & 4 deletions tests/snapshots/output-theme.scss.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Generated by [AVA](https://ava.li).
}␊
body {␊
background-color: rgb(var(--color-lite));␊
color: rgb(var(--contrast-lite));␊
color: rgb(var(--fg-default));␊
background-color: rgb(var(--bg-default));␊
}␊
[class^=fg-]:not([class$=fg-]), [class*=" fg-"]:not([class$=fg-]), [class*=__fg-]:not([class*=" __fg-"]):not([class*="__fg- "]):not([class$=__fg-]):not([class^=__fg-]) {␊
Expand Down Expand Up @@ -5753,8 +5753,8 @@ Generated by [AVA](https://ava.li).
}␊
body {␊
background-color: rgb(var(--color-lite));␊
color: rgb(var(--contrast-lite));␊
color: rgb(var(--fg-default));␊
background-color: rgb(var(--bg-default));␊
}␊
[class^="fg-"]:not([class$="fg-"]), [class*=" fg-"]:not([class$="fg-"]), [class*="__fg-"]:not([class*=" __fg-"]):not([class*="__fg- "]):not([class$="__fg-"]):not([class^="__fg-"]) {␊
Expand Down
Binary file modified tests/snapshots/output-theme.scss.snap
Binary file not shown.
Loading

0 comments on commit cd924a6

Please sign in to comment.