1
0
mirror of https://github.com/locomotivemtl/locomotive-boilerplate.git synced 2026-01-15 00:55:08 +08:00

Merge branch 'master' into feature/config-speed

This commit is contained in:
Lucas Bigot
2024-03-26 15:06:16 -04:00
18 changed files with 224 additions and 295 deletions

View File

@@ -1,3 +1,3 @@
{ {
"version": 1711478194756 "version": 1711479960586
} }

View File

@@ -0,0 +1,124 @@
// ==========================================================================
// Elements / Normalize
// ==========================================================================
// Modern CSS Normalize
// Based on the reset by Andy.set with some tweaks.
// Original by Andy.set: https://piccalil.li/blog/a-more-modern-css-reset/
// Review by Chris collier: https://chriscoyier.net/2023/10/03/being-picky-about-a-css-reset-for-fun-pleasure/
// Box sizing rules
*,
*:after,
*:before {
box-sizing: border-box;
}
// Prevent font size inflation
html {
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
text-size-adjust: none;
}
// Remove default margin in favour of better control in authored CSS
p,
h1,
h2,
h3,
h4,
h5,
h6,
dl,
dd,
figure,
blockquote {
margin-block: unset;
}
// Remove list styles on ul, ol elements with a class, which suggests default styling will be removed
ul[class],
ol[class] {
margin: 0;
padding: 0;
list-style: none;
}
// Set core defaults
html {
line-height: 1.5;
}
body {
margin: unset;
}
// Set shorter line heights on headings and interactive elements
h1,
h2,
h3,
h4,
h5,
h6,
input,
label,
button {
line-height: 1.1;
}
// Balance text wrapping on headings
h1,
h2,
h3,
h4,
h5,
h6 {
text-wrap: balance;
}
// Remove a elements default styles if they have a class
a[class] {
color: inherit;
text-decoration: none;
}
// Make assets easier to work with
img,
svg,
canvas,
picture {
display: block;
max-inline-size: 100%;
block-size: auto;
}
// Inherit fonts for inputs and buttons
input,
button,
select,
textarea {
font: inherit;
}
// Make sure textareas without a rows attribute are not tiny
textarea:not([rows]) {
min-height: 10em;
}
// Anything that has been anchored to should have extra scroll margin
:target {
scroll-margin-block: 1rlh;
}
// Reduced mootion preference
@media (prefers-reduced-motion: reduce) {
*,
*:after,
*:before {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}

View File

@@ -1,34 +0,0 @@
// ==========================================================================
// Generic / Buttons
// ==========================================================================
// 1. Allow us to style box model properties.
// 2. Fixes odd inner spacing in IE7.
// 3. Reset/normalize some styles.
// 4. Line different sized buttons up a little nicer.
// 5. Make buttons inherit font styles (often necessary when styling `input`s as buttons).
// 6. Force all button-styled elements to appear clickable.
button,
.c-button {
@include u-hocus {
text-decoration: none;
}
display: inline-block; // [1]
overflow: visible; // [2]
margin: 0; // [3]
padding: 0;
outline: 0;
border: 0;
background: none transparent;
color: inherit;
vertical-align: middle; // [4]
text-align: center; // [3]
text-decoration: none;
text-transform: none;
font: inherit; // [5]
line-height: normal;
cursor: pointer; // [6]
user-select: none;
}

View File

@@ -1,44 +0,0 @@
// ==========================================================================
// Generic / Forms
// ==========================================================================
input,
select,
textarea {
display: block;
margin: 0;
padding: 0;
width: 100%;
outline: 0;
border: 0;
border-radius: 0;
background: none transparent;
color: inherit;
font: inherit;
line-height: normal;
appearance: none;
}
select {
text-transform: none;
&::-ms-expand {
display: none;
}
&::-ms-value {
background: none;
color: inherit;
}
// // Remove Firefox :focus dotted outline, breaks color inherit
// // &:-moz-focusring {
// // color: transparent;
// // text-shadow: 0 0 0 #000000; // Text :focus color
// // }
}
textarea {
overflow: auto;
resize: vertical;
}

View File

@@ -1,87 +0,0 @@
// ==========================================================================
// Generic
// ==========================================================================
html {
box-sizing: border-box;
}
// Add the correct display in IE 10-.
// 1. Add the correct display in IE.
template, // [1]
[hidden] {
display: none;
}
*,
:before,
:after {
box-sizing: inherit;
}
address {
font-style: inherit;
}
dfn,
cite,
em,
i {
font-style: italic;
}
b,
strong {
font-weight: $font-weight-bold;
}
a {
text-decoration: none;
svg {
pointer-events: none;
}
}
ul,
ol {
margin: 0;
padding: 0;
list-style: none;
}
p,
figure {
margin: 0;
padding: 0;
}
h1, h2, h3, h4, h5, h6 {
margin: 0;
}
// 1. Single taps should be dispatched immediately on clickable elements
a, area, button, input, label, select, textarea, [tabindex] {
-ms-touch-action: manipulation; // [1]
touch-action: manipulation;
}
[hreflang] > abbr[title] {
text-decoration: none;
}
table {
border-spacing: 0;
border-collapse: collapse;
}
hr {
display: block;
margin: 1em 0;
padding: 0;
height: 1px;
border: 0;
border-top: 1px solid #CCCCCC;
}

View File

@@ -1,52 +0,0 @@
// ==========================================================================
// Generic / Media
// ==========================================================================
// 1. Setting `vertical-align` removes the whitespace that appears under `img`
// elements when they are dropped into a page as-is. Safer alternative to
// using `display: block;`.
audio,
canvas,
iframe,
img,
svg,
video {
vertical-align: middle; // [1]
}
// Add the correct display in iOS 4-7.
audio:not([controls]) {
display: none;
height: 0;
}
// 2. Fluid media for responsive purposes.
img,
svg {
max-width: 100%; // [2]
height: auto;
// 4. If a `width` and/or `height` attribute have been explicitly defined,
// lets not make the image fluid.
&[width], // [4]
&[height] {
// [4]
max-width: none;
}
}
// 4. Offset `alt` text from surrounding copy.
img {
font-style: italic; // [4]
}
// 5. SVG elements should fallback to their surrounding text color.
svg {
fill: currentColor; // [5]
}

View File

@@ -20,25 +20,16 @@
// Settings // Settings
// ========================================================================== // ==========================================================================
@import "settings/config";
@import "settings/config.breakpoints"; @import "settings/config.breakpoints";
@import "settings/config.colors"; @import "settings/config.colors";
@import "settings/config.eases"; @import "settings/config.eases";
@import "settings/config.fonts"; @import "settings/config.fonts";
@import "settings/config.spacers"; @import "settings/config.spacings";
@import "settings/config.speeds"; @import "settings/config.speeds";
@import "settings/config.zindexes"; @import "settings/config.zindexes";
@import "settings/config";
@import "settings/config.variables"; @import "settings/config.variables";
// Generic
// ==========================================================================
@import "node_modules/normalize.css/normalize";
@import "generic/generic";
@import "generic/media";
@import "generic/form";
@import "generic/button";
// Vendors // Vendors
// ========================================================================== // ==========================================================================
@import "node_modules/locomotive-scroll/dist/locomotive-scroll"; @import "node_modules/locomotive-scroll/dist/locomotive-scroll";
@@ -46,6 +37,7 @@
// Elements // Elements
// ========================================================================== // ==========================================================================
@import "elements/normalize";
@import "elements/document"; @import "elements/document";
// Objects // Objects

View File

@@ -32,12 +32,13 @@ $easing: ease("power2.out");
// Spacing Units // Spacing Units
// ============================================================================= // =============================================================================
$unit: 60px; $unit: 60px;
$unit-small: 20px; $unit-small: 20px;
$vw-viewport: 1440;
// Container // Container
// ========================================================================== // ==========================================================================
$padding: $unit; $padding: $unit;
// Grid // Grid
// ========================================================================== // ==========================================================================

View File

@@ -1,40 +0,0 @@
// ==========================================================================
// Settings / Config / Spacers
// ==========================================================================
// Spacers
// ==========================================================================
$spacers: (
'gutter': var(--grid-gutter),
'xs': #{vh(5)},
'sm': #{vh(7.5)},
'md': #{vh(10)},
'lg': #{vh(12.5)},
'xl': #{vh(15)},
);
// Function
// ==========================================================================
// Returns spacer.
//
// ```scss
// .c-box {
// margin-top: spacer(gutter);
// }
// ```
//
// @param {string} $key - The spacer key in $spacers.
// @param {number} $multiplier - The multiplier of the spacer value.
// @return {size}
@function spacer($spacer: $spacer-default, $multiplier: 1) {
@if not map-has-key($spacers, $spacer) {
@error "Unknown master spacer: #{$spacer}";
}
$index: map-get($spacers, $spacer);
@return calc(#{$index} * #{$multiplier});
}

View File

@@ -0,0 +1,69 @@
// ==========================================================================
// Settings / Config / Spacings
// ==========================================================================
:root {
--spacing-2xs-mobile: 6;
--spacing-2xs-desktop: 10;
--spacing-xs-mobile: 12;
--spacing-xs-desktop: 16;
--spacing-sm-mobile: 22;
--spacing-sm-desktop: 32;
--spacing-md-mobile: 32;
--spacing-md-desktop: 56;
--spacing-lg-mobile: 48;
--spacing-lg-desktop: 96;
--spacing-xl-mobile: 64;
--spacing-xl-desktop: 128;
--spacing-2xl-mobile: 88;
--spacing-2xl-desktop: 176;
--spacing-3xl-mobile: 122;
--spacing-3xl-desktop: 224;
}
// Spacings
// ==========================================================================
$spacings: (
'gutter': var(--grid-gutter),
'2xs': #{size-clamp('2xs')},
'xs': #{size-clamp('xs')},
'sm': #{size-clamp('sm')},
'md': #{size-clamp('md')},
'lg': #{size-clamp('lg')},
'xl': #{size-clamp('xl')},
'2xl': #{size-clamp('2xl')},
'3xl': #{size-clamp('3xl')},
);
// Function
// ==========================================================================
// Returns spacing.
//
// ```scss
// .c-box {
// margin-top: spacing(gutter);
// }
// ```
//
// @param {string} $key - The spacing key in $spacings.
// @param {number} $multiplier - The multiplier of the spacing value.
// @return {size}
@function spacing($spacing: 'sm', $multiplier: 1) {
@if not map-has-key($spacings, $spacing) {
@error "Unknown master spacing: #{$spacing}";
}
$index: map-get($spacings, $spacing);
@return calc(#{$index} * #{$multiplier});
}

View File

@@ -178,6 +178,19 @@ $context: 'frontend' !default;
@return calc(#{$number} * var(--vw, 1vw)); @return calc(#{$number} * var(--vw, 1vw));
} }
@function clamp-with-max($min, $size, $max) {
$vw-context: $vw-viewport * 0.01;
@return clamp(#{$min}, calc(#{$size} / #{$vw-context} * 1vw), #{$max});
}
@function size-clamp($size) {
@return clamp-with-max(
calc(#{rem(1px)} * var(--spacing-#{$size}-mobile)),
var(--spacing-#{$size}-desktop),
calc(#{rem(1px)} * var(--spacing-#{$size}-desktop))
);
}
// Returns clamp of calculated preferred responsive font size // Returns clamp of calculated preferred responsive font size
// within a font size and breakpoint range. // within a font size and breakpoint range.
// //

View File

@@ -8,12 +8,11 @@
/// ///
/// @example /// @example
/// .u-margin-top {} /// .u-margin-top {}
/// .u-padding-left-large {} /// .u-margin-top-xs {}
/// .u-margin-right-small {} /// .u-padding-left-lg {}
/// .u-margin-right-sm {}
/// .u-padding {} /// .u-padding {}
/// .u-padding-right-none {} /// .u-padding-right-none {}
/// .u-padding-horizontal {}
/// .u-padding-vertical-small {}
/// ///
/// @link https://github.com/inuitcss/inuitcss/blob/512977a/utilities/_utilities.spacing.scss /// @link https://github.com/inuitcss/inuitcss/blob/512977a/utilities/_utilities.spacing.scss
//// ////
@@ -35,7 +34,7 @@ $spacing-properties: (
'margin': 'margin', 'margin': 'margin',
) !default; ) !default;
$spacing-sizes: join($spacers, ( $spacing-sizes: join($spacings, (
null: var(--grid-gutter), null: var(--grid-gutter),
'none': 0 'none': 0
)); ));
@@ -51,7 +50,7 @@ $spacing-sizes: join($spacers, (
// Base class // Base class
$base-class: ".u-" + #{$property-namespace}#{$direction-namespace}#{$size-namespace}; $base-class: ".u-" + #{$property-namespace}#{$direction-namespace}#{$size-namespace};
// Spacer without media query // Spacing without media query
@if $breakpoint == "tiny" { @if $breakpoint == "tiny" {
#{$base-class} { #{$base-class} {
@each $direction in $directions { @each $direction in $directions {
@@ -60,7 +59,7 @@ $spacing-sizes: join($spacers, (
} }
} }
// Spacer min-width breakpoints `@from-*` // Spacing min-width breakpoints `@from-*`
#{$base-class}\@from-#{$breakpoint} { #{$base-class}\@from-#{$breakpoint} {
@media #{mq-min($breakpoint)} { @media #{mq-min($breakpoint)} {
@each $direction in $directions { @each $direction in $directions {
@@ -69,7 +68,7 @@ $spacing-sizes: join($spacers, (
} }
} }
// Spacer max-width breakpoints @to-*` // Spacing max-width breakpoints @to-*`
#{$base-class}\@to-#{$breakpoint} { #{$base-class}\@to-#{$breakpoint} {
@media #{mq-max($breakpoint)} { @media #{mq-max($breakpoint)} {
@each $direction in $directions { @each $direction in $directions {

View File

@@ -15,7 +15,7 @@
"dest": "./www/assets/scripts" "dest": "./www/assets/scripts"
}, },
"svgs": { "svgs": {
"src": "./assets/images/sprite", "src": "./assets/svgs",
"dest": "./www/assets/images" "dest": "./www/assets/images"
}, },
"views": { "views": {

11
package-lock.json generated
View File

@@ -11,7 +11,6 @@
"locomotive-scroll": "^5.0.0-beta.11", "locomotive-scroll": "^5.0.0-beta.11",
"modujs": "^1.4.2", "modujs": "^1.4.2",
"modularload": "^1.2.6", "modularload": "^1.2.6",
"normalize.css": "^8.0.1",
"svg4everybody": "^2.1.9" "svg4everybody": "^2.1.9"
}, },
"devDependencies": { "devDependencies": {
@@ -3021,11 +3020,6 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/normalize.css": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/normalize.css/-/normalize.css-8.0.1.tgz",
"integrity": "sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg=="
},
"node_modules/object-assign": { "node_modules/object-assign": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -7126,11 +7120,6 @@
"integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=",
"dev": true "dev": true
}, },
"normalize.css": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/normalize.css/-/normalize.css-8.0.1.tgz",
"integrity": "sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg=="
},
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",

View File

@@ -17,7 +17,6 @@
"locomotive-scroll": "^5.0.0-beta.11", "locomotive-scroll": "^5.0.0-beta.11",
"modujs": "^1.4.2", "modujs": "^1.4.2",
"modularload": "^1.2.6", "modularload": "^1.2.6",
"normalize.css": "^8.0.1",
"svg4everybody": "^2.1.9" "svg4everybody": "^2.1.9"
}, },
"devDependencies": { "devDependencies": {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long