diff --git a/package.json b/package.json index 6259c7d..5c04428 100755 --- a/package.json +++ b/package.json @@ -17,8 +17,7 @@ "leaflet": "^1.7.1", "sass": "^1.26.3", "semver": "^6.3.0", - "slugify": "^1.4.0", - "stalfos": "github:hankchizljaw/stalfos#c8971d22726326cfc04089b2da4d51eeb1ebb0eb" + "slugify": "^1.4.0" }, "devDependencies": { "@erquhart/rollup-plugin-node-builtins": "^2.1.5", diff --git a/src/scss/_config.scss b/src/scss/_config.scss index 8b8636b..bcc0d44 100644 --- a/src/scss/_config.scss +++ b/src/scss/_config.scss @@ -6,22 +6,14 @@ * it is relevant for (font-size, margin, padding). All items are * calcuated off these tokens. */ -$stalfos-size-scale: map-get($tokens, 'size-scale'); +$size-scale: map-get($tokens, 'size-scale'); /** * COLORS * Colors are shared between backgrounds and text by default. * You can also use them to power borders, fills or shadows, for example. */ -$stalfos-colors: map-get($tokens, 'colors'); - -/** - * UTIL PREFIX - * All pre-built, framework utilities will have this prefix. - * Example: the wrapper utility is '.sf-wrapper' because the default - * prefix is 'sf-'. - */ -$stalfos-util-prefix: 'sf-'; +$colors: map-get($tokens, 'colors'); /** * METRICS @@ -32,151 +24,3 @@ $metrics: ( 'wrap-inner-max-width': 47rem, 'md-breakpoint': 48rem ); - -/** - * CORE CONFIG - * This powers everything from utility class generation to breakpoints - * to enabling/disabling pre-built components/utilities. - */ -$stalfos-config: ( - 'align': ( - 'items': ( - 'start': 'flex-start', - 'center': 'center', - 'end': 'flex-end' - ), - 'output': 'responsive', - 'property': 'align-items' - ), - 'bg': ( - 'items': $stalfos-colors, - 'output': 'standard', - 'property': 'background' - ), - 'color': ( - 'items': $stalfos-colors, - 'output': 'standard', - 'property': 'color' - ), - 'box': ( - 'items': ( - 'block': 'block', - 'flex': 'flex', - 'inline-flex': 'inline-flex', - 'hide': 'none' - ), - 'output': 'responsive', - 'property': 'display' - ), - 'font': ( - 'items': map-get($tokens, 'fonts'), - 'output': 'standard', - 'property': 'font-family' - ), - 'gap-top': ( - 'items': $stalfos-size-scale, - 'output': 'standard', - 'property': 'margin-top' - ), - 'gap-bottom': ( - 'items': $stalfos-size-scale, - 'output': 'standard', - 'property': 'margin-bottom' - ), - 'leading': ( - 'items': ( - 'tight': '1.2', - 'mid': '1.5', - 'loose': '1.7' - ), - 'output': 'standard', - 'property': 'line-height' - ), - 'measure': ( - 'items': ( - 'long': '75ch', - 'short': '60ch', - 'compact': '40ch' - ), - 'output': 'standard', - 'property': 'max-width' - ), - 'pad-top': ( - 'items': $stalfos-size-scale, - 'output': 'standard', - 'property': 'padding-top' - ), - 'pad-bottom': ( - 'items': $stalfos-size-scale, - 'output': 'standard', - 'property': 'padding-bottom' - ), - 'pad-left': ( - 'items': $stalfos-size-scale, - 'output': 'standard', - 'property': 'padding-left' - ), - 'space': ( - 'items': ( - 'between': 'space-between', - 'around': 'space-around', - 'before': 'flex-end' - ), - 'output': 'responsive', - 'property': 'justify-content' - ), - 'stack': ( - 'items': ( - '300': 0, - '400': 10, - '500': 20, - '600': 30, - '700': 40 - ), - 'output': 'standard', - 'property': 'z-index' - ), - 'ta': ( - 'items': ( - 'right': 'right', - 'left': 'left', - 'center': 'center' - ), - 'output': 'responsive', - 'property': 'text-align' - ), - 'text': ( - 'items': $stalfos-size-scale, - 'output': 'responsive', - 'property': 'font-size' - ), - 'weight': ( - 'items': ( - 'light': '300', - 'regular': '400', - 'mid': '600', - 'bold': '700' - ), - 'output': 'standard', - 'property': 'font-weight' - ), - 'width': ( - 'items': ( - 'full': '100%', - 'half': percentage(.5), - 'quarter': percentage(.25), - 'third': percentage(.33) - ), - 'output': 'responsive', - 'property': 'width' - ), - 'breakpoints': ( - 'md': #{'(min-width: ' + map-get($metrics, 'md-breakpoint') + ')'} - ), - 'utilities': ( - 'reset': 'on', - 'icon': 'off', - 'flow': 'on', - 'wrapper': 'off' - ) -); diff --git a/src/scss/_functions.scss b/src/scss/_functions.scss new file mode 100644 index 0000000..9f9bcc1 --- /dev/null +++ b/src/scss/_functions.scss @@ -0,0 +1,25 @@ +/** + * CUSTOM FUNCTIONS + * Replacement functions for stalfos get-size() and get-color() functions + */ + +/** + * Get size from the size scale + * @param {string|number} $size - The size key from the scale + * @return {string} - The size value + */ +@function get-size($size) { + @if $size == 'base' { + @return map-get($tokens, 'size-scale', 'base'); + } + @return map-get($tokens, 'size-scale', $size); +} + +/** + * Get color from the color palette + * @param {string} $color - The color key from the palette + * @return {string} - The color value + */ +@function get-color($color) { + @return map-get($tokens, 'colors', $color); +} diff --git a/src/scss/_theme.scss b/src/scss/_theme.scss index 379d212..84dd54c 100644 --- a/src/scss/_theme.scss +++ b/src/scss/_theme.scss @@ -1,6 +1,6 @@ :root { // Pull the tokens and generate custom props - @each $color in $stalfos-colors { + @each $color in $colors { #{'--color-' + nth($color, 1)}: #{nth($color, 2)}; } diff --git a/src/scss/_typography.scss b/src/scss/_typography.scss index 4bccc8e..deed951 100644 --- a/src/scss/_typography.scss +++ b/src/scss/_typography.scss @@ -58,7 +58,7 @@ body { $line-height: get-size(600); - @include apply-utility('font', 'base'); + font-family: #{map-get($tokens, 'fonts', 'base')}; // Strip the unit off the size ratio to generate a line height line-height: calc($line-height / 1); @@ -66,7 +66,7 @@ body { h1, h2 { - @include apply-utility('font', 'brand'); + font-family: #{map-get($tokens, 'fonts', 'brand')}; } h1 { diff --git a/src/scss/components/_form.scss b/src/scss/components/_form.scss index be85e22..9f1e785 100644 --- a/src/scss/components/_form.scss +++ b/src/scss/components/_form.scss @@ -40,7 +40,7 @@ label { input, textarea, select { - @include apply-utility('font', 'base'); + font-family: #{map-get($tokens, 'fonts', 'base')}; background-color: var(--color-primary-glare); font: inherit; border: 0; diff --git a/src/scss/components/_heading-permalink.scss b/src/scss/components/_heading-permalink.scss index e9e10d7..6071d7a 100644 --- a/src/scss/components/_heading-permalink.scss +++ b/src/scss/components/_heading-permalink.scss @@ -4,7 +4,7 @@ margin-left: .3em; margin-top: .2em; - @include media-query('md') { + @media (min-width: 48rem) { font-size: .6em; margin-top: .4em; } diff --git a/src/scss/components/_modal.scss b/src/scss/components/_modal.scss index 7bf7c22..b3ad986 100644 --- a/src/scss/components/_modal.scss +++ b/src/scss/components/_modal.scss @@ -10,7 +10,7 @@ } h3 { - @include apply-utility('font', 'brand'); + font-family: #{map-get($tokens, 'fonts', 'brand')}; font-size: 1.5rem; } } diff --git a/src/scss/components/_nav.scss b/src/scss/components/_nav.scss index 68f9e11..8c7741f 100644 --- a/src/scss/components/_nav.scss +++ b/src/scss/components/_nav.scss @@ -23,7 +23,7 @@ flex-shrink: 0; a { - @include apply-utility('weight', 'mid'); + font-weight: 600; color: currentColor; &:not(:hover) { diff --git a/src/scss/components/_post.scss b/src/scss/components/_post.scss index 87f90e5..41b552f 100644 --- a/src/scss/components/_post.scss +++ b/src/scss/components/_post.scss @@ -11,7 +11,7 @@ h2, h3 { - @include apply-utility('leading', 'tight'); + line-height: 1.2; position: relative; } @@ -288,7 +288,7 @@ } h2 { - @include apply-utility('font', 'base'); + font-family: #{map-get($tokens, 'fonts', 'base')}; text-align: left; font-weight: 600; margin-bottom: 1rem; diff --git a/src/scss/components/_video-player.scss b/src/scss/components/_video-player.scss index fe3d9b1..1618b82 100644 --- a/src/scss/components/_video-player.scss +++ b/src/scss/components/_video-player.scss @@ -2,7 +2,7 @@ position: relative; padding-top: 56.25%; - @include media-query('md') { + @media (min-width: 48rem) { .post & { padding-top: 66%; } diff --git a/src/scss/global.scss b/src/scss/global.scss index d37d138..7b49130 100644 --- a/src/scss/global.scss +++ b/src/scss/global.scss @@ -1,7 +1,5 @@ @import 'config'; - -// Pull in the stalfos lib -@import '../../node_modules/stalfos/stalfos'; +@import 'functions'; @import 'theme';