Skip to content

Commit

Permalink
refactor: rebuild with sass module api
Browse files Browse the repository at this point in the history
  • Loading branch information
nzbin committed Nov 27, 2022
1 parent b286792 commit f0fcf7b
Show file tree
Hide file tree
Showing 26 changed files with 298 additions and 235 deletions.
1 change: 1 addition & 0 deletions _index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@forward 'scss/three-dots.scss';
2 changes: 1 addition & 1 deletion dist/three-dots.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/three-dots.min.css.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"start": "run-p build watch",
"build": "run-s clean sass sassmin postcss copy",
"clean": "rimraf dist",
"sass": "sass --style=expanded sass/three-dots.scss dist/three-dots.css",
"sassmin": "sass --style=compressed sass/three-dots.scss dist/three-dots.min.css",
"sass": "sass --style=expanded scss/three-dots.scss dist/three-dots.css",
"sassmin": "sass --style=compressed scss/three-dots.scss dist/three-dots.min.css",
"copy": "cp dist/three-dots.css docs/css",
"postcss": "postcss -r dist/*.css --map",
"watch": "onchange sass -- run-s sass copy",
"lint": "stylelint \"sass/**/*.scss\" --fix",
"lint": "stylelint \"scss/**/*.scss\" --fix",
"prepublish": "npm run build"
},
"devDependencies": {
Expand Down
11 changes: 7 additions & 4 deletions scss/_dot-bouncing.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
* ==============================================
*/

@use './variables';
@use './mixins';

$d: 20px;

.dot-bouncing {
position: relative;
height: $dot-height;
height: variables.$dot-height;
font-size: 10px;

&::before {
Expand All @@ -22,7 +25,7 @@ $d: 20px;

@keyframes dot-bouncing {
0% {
top: -$d;
top: - $d;
animation-timing-function: ease-in;
}

Expand All @@ -41,10 +44,10 @@ $d: 20px;
}

90% {
top: -$d;
top: - $d;
}

100% {
top: -$d;
top: - $d;
}
}
97 changes: 50 additions & 47 deletions scss/_dot-bricks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,117 +4,120 @@
* ==============================================
*/

$spacing: $dot-width + 6px;
@use './variables';
@use './mixins';

$spacing: variables.$dot-width + 6px;
$top-pos: $spacing * .5;
$left-pos: -9999px;
$x1: -$left-pos - $top-pos;
$x2: -$left-pos - $top-pos + $spacing;
$x1: - $left-pos - $top-pos;
$x2: - $left-pos - $top-pos + $spacing;
$y1: 0;
$y2: -$spacing;
$y2: - $spacing;

.dot-bricks {
position: relative;
top: $top-pos;
left: $left-pos;

@include dot;
@include mixins.dot;

box-shadow:
$x1 $y2 0 0 $dot-before-color,
$x1 $y1 0 0 $dot-color,
$x2 $y1 0 0 $dot-after-color;
$x1 $y2 0 0 variables.$dot-before-color,
$x1 $y1 0 0 variables.$dot-color,
$x2 $y1 0 0 variables.$dot-after-color;
animation: dot-bricks 2s infinite ease;
}

@keyframes dot-bricks {
0% {
box-shadow:
$x1 $y2 0 0 $dot-before-color,
$x1 $y1 0 0 $dot-color,
$x2 $y1 0 0 $dot-after-color;
$x1 $y2 0 0 variables.$dot-before-color,
$x1 $y1 0 0 variables.$dot-color,
$x2 $y1 0 0 variables.$dot-after-color;
}

8.333% {
box-shadow:
$x2 $y2 0 0 $dot-before-color,
$x1 $y1 0 0 $dot-color,
$x2 $y1 0 0 $dot-after-color;
$x2 $y2 0 0 variables.$dot-before-color,
$x1 $y1 0 0 variables.$dot-color,
$x2 $y1 0 0 variables.$dot-after-color;
}

16.667% {
box-shadow:
$x2 $y2 0 0 $dot-before-color,
$x1 $y2 0 0 $dot-color,
$x2 $y1 0 0 $dot-after-color;
$x2 $y2 0 0 variables.$dot-before-color,
$x1 $y2 0 0 variables.$dot-color,
$x2 $y1 0 0 variables.$dot-after-color;
}

25% {
box-shadow:
$x2 $y2 0 0 $dot-before-color,
$x1 $y2 0 0 $dot-color,
$x1 $y1 0 0 $dot-after-color;
$x2 $y2 0 0 variables.$dot-before-color,
$x1 $y2 0 0 variables.$dot-color,
$x1 $y1 0 0 variables.$dot-after-color;
}

33.333% {
box-shadow:
$x2 $y1 0 0 $dot-before-color,
$x1 $y2 0 0 $dot-color,
$x1 $y1 0 0 $dot-after-color;
$x2 $y1 0 0 variables.$dot-before-color,
$x1 $y2 0 0 variables.$dot-color,
$x1 $y1 0 0 variables.$dot-after-color;
}

41.667% {
box-shadow:
$x2 $y1 0 0 $dot-before-color,
$x2 $y2 0 0 $dot-color,
$x1 $y1 0 0 $dot-after-color;
$x2 $y1 0 0 variables.$dot-before-color,
$x2 $y2 0 0 variables.$dot-color,
$x1 $y1 0 0 variables.$dot-after-color;
}

50% {
box-shadow:
$x2 $y1 0 0 $dot-before-color,
$x2 $y2 0 0 $dot-color,
$x1 $y2 0 0 $dot-after-color;
$x2 $y1 0 0 variables.$dot-before-color,
$x2 $y2 0 0 variables.$dot-color,
$x1 $y2 0 0 variables.$dot-after-color;
}

58.333% {
box-shadow:
$x1 $y1 0 0 $dot-before-color,
$x2 $y2 0 0 $dot-color,
$x1 $y2 0 0 $dot-after-color;
$x1 $y1 0 0 variables.$dot-before-color,
$x2 $y2 0 0 variables.$dot-color,
$x1 $y2 0 0 variables.$dot-after-color;
}

66.666% {
box-shadow:
$x1 $y1 0 0 $dot-before-color,
$x2 $y1 0 0 $dot-color,
$x1 $y2 0 0 $dot-after-color;
$x1 $y1 0 0 variables.$dot-before-color,
$x2 $y1 0 0 variables.$dot-color,
$x1 $y2 0 0 variables.$dot-after-color;
}

75% {
box-shadow:
$x1 $y1 0 0 $dot-before-color,
$x2 $y1 0 0 $dot-color,
$x2 $y2 0 0 $dot-after-color;
$x1 $y1 0 0 variables.$dot-before-color,
$x2 $y1 0 0 variables.$dot-color,
$x2 $y2 0 0 variables.$dot-after-color;
}

83.333% {
box-shadow:
$x1 $y2 0 0 $dot-before-color,
$x2 $y1 0 0 $dot-color,
$x2 $y2 0 0 $dot-after-color;
$x1 $y2 0 0 variables.$dot-before-color,
$x2 $y1 0 0 variables.$dot-color,
$x2 $y2 0 0 variables.$dot-after-color;
}

91.667% {
box-shadow:
$x1 $y2 0 0 $dot-before-color,
$x1 $y1 0 0 $dot-color,
$x2 $y2 0 0 $dot-after-color;
$x1 $y2 0 0 variables.$dot-before-color,
$x1 $y1 0 0 variables.$dot-color,
$x2 $y2 0 0 variables.$dot-after-color;
}

100% {
box-shadow:
$x1 $y2 0 0 $dot-before-color,
$x1 $y1 0 0 $dot-color,
$x2 $y1 0 0 $dot-after-color;
$x1 $y2 0 0 variables.$dot-before-color,
$x1 $y1 0 0 variables.$dot-color,
$x2 $y1 0 0 variables.$dot-after-color;
}
}
35 changes: 19 additions & 16 deletions scss/_dot-carousel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,46 @@
* ==============================================
*/

@use './variables';
@use './mixins';

$left-pos: -9999px;
$x1: -$left-pos - $dot-spacing;
$x2: -$left-pos;
$x3: -$left-pos + $dot-spacing;
$x1: - $left-pos - variables.$dot-spacing;
$x2: - $left-pos;
$x3: - $left-pos + variables.$dot-spacing;

.dot-carousel {
position: relative;
left: $left-pos;

@include dot;
@include mixins.dot;

box-shadow:
$x1 0 0 0 $dot-before-color,
$x2 0 0 0 $dot-color,
$x3 0 0 0 $dot-after-color;
$x1 0 0 0 variables.$dot-before-color,
$x2 0 0 0 variables.$dot-color,
$x3 0 0 0 variables.$dot-after-color;
animation: dot-carousel 1.5s infinite linear;
}

@keyframes dot-carousel {
0% {
box-shadow:
$x1 0 0 -1px $dot-before-color,
$x2 0 0 1px $dot-color,
$x3 0 0 -1px $dot-after-color;
$x1 0 0 -1px variables.$dot-before-color,
$x2 0 0 1px variables.$dot-color,
$x3 0 0 -1px variables.$dot-after-color;
}

50% {
box-shadow:
$x3 0 0 -1px $dot-before-color,
$x1 0 0 -1px $dot-color,
$x2 0 0 1px $dot-after-color;
$x3 0 0 -1px variables.$dot-before-color,
$x1 0 0 -1px variables.$dot-color,
$x2 0 0 1px variables.$dot-after-color;
}

100% {
box-shadow:
$x2 0 0 1px $dot-before-color,
$x3 0 0 -1px $dot-color,
$x1 0 0 -1px $dot-after-color;
$x2 0 0 1px variables.$dot-before-color,
$x3 0 0 -1px variables.$dot-color,
$x1 0 0 -1px variables.$dot-after-color;
}
}
17 changes: 10 additions & 7 deletions scss/_dot-collision.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
* ==============================================
*/

@use './variables';
@use './mixins';

.dot-collision {
position: relative;

@include dot;
@include mixins.dot;

&::before,
&::after {
Expand All @@ -18,17 +21,17 @@
}

&::before {
left: -$dot-width;
left: - variables.$dot-width;

@include dot($bg-color: $dot-before-color);
@include mixins.dot($bg-color: variables.$dot-before-color);

animation: dot-collision-before 2s infinite ease-in;
}

&::after {
left: $dot-width;
left: variables.$dot-width;

@include dot($bg-color: $dot-after-color);
@include mixins.dot($bg-color: variables.$dot-after-color);

animation: dot-collision-after 2s infinite ease-in;
animation-delay: 1s;
Expand All @@ -44,7 +47,7 @@
}

25% {
transform: translateX(-$dot-spacing);
transform: translateX(- variables.$dot-spacing);
}
}

Expand All @@ -57,6 +60,6 @@
}

25% {
transform: translateX($dot-spacing);
transform: translateX(variables.$dot-spacing);
}
}
13 changes: 8 additions & 5 deletions scss/_dot-elastic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
* ==============================================
*/

@use './variables';
@use './mixins';

.dot-elastic {
position: relative;

@include dot;
@include mixins.dot;

animation: dot-elastic 1s infinite linear;

Expand All @@ -20,17 +23,17 @@
}

&::before {
left: -$dot-spacing;
left: - variables.$dot-spacing;

@include dot($bg-color: $dot-before-color);
@include mixins.dot($bg-color: variables.$dot-before-color);

animation: dot-elastic-before 1s infinite linear;
}

&::after {
left: $dot-spacing;
left: variables.$dot-spacing;

@include dot($bg-color: $dot-after-color);
@include mixins.dot($bg-color: variables.$dot-after-color);

animation: dot-elastic-after 1s infinite linear;
}
Expand Down
Loading

0 comments on commit f0fcf7b

Please sign in to comment.