spinners 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjAyOTAzODJiNDhlM2EwNjcwNGI2OThhZmRmNmVkYjdlMTExMGIwNQ==
5
+ data.tar.gz: !binary |-
6
+ Mjk0ZmMwYzE5NjA4ZjU2ZTlkZmM0ZmQ2YmZmOTEwYjc3MWVlN2Y3ZA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ Y2YwZDZmYTgyMzEwOWZhYTViZWIxMDdmZGNkNWFjMTM3ODI3YWQzOGVmYzlm
10
+ MmY0YmIxYTg1MDg1NDQ1ZWRlZWFkZTg4MzE1YmY5Yzk1MGQ3MjExNWNkYTRl
11
+ ZGVlZTM0OTUzNTk3ZWFhN2JmNDUxYWI5ODhmOTE5ZjdiOTI0YTU=
12
+ data.tar.gz: !binary |-
13
+ MGI2MTFjMDQ2NmRlMjJkZTY0YjJjMWU1NGM0ZWNmZDU0YmZmNTEwNjEwNWQ2
14
+ ZWE2ODg5ZDRkMmE5OTMxN2ExNzM1MGUwNTUxM2I2MjU0MDM4NDZjMzFjNmE4
15
+ YmE4NjNlM2ZkN2FmNDFlMmE3MzE3YzhjODIwNjE3NTliOTc5MjU=
@@ -0,0 +1,131 @@
1
+ #spinner
2
+
3
+ [![Bower version](https://badge.fury.io/bo/spinners.svg)](http://badge.fury.io/bo/spinners) [![Gem Version](https://badge.fury.io/rb/spinners.svg)](http://badge.fury.io/rb/spinners)
4
+
5
+
6
+ A Sass mixin to generate pure CSS3 loading/busy indicators.
7
+ Uses a single rotating element and a partial border.
8
+ Fully customizable.
9
+ Works with plain Sass or [Compass](http://compass-style.org).
10
+
11
+
12
+ ##Install
13
+
14
+ ### Download
15
+ To use Spinners straightaway without any package manager, the only file you'll need is `stylesheets/_spinner.scss`. Place this in the appropriate `sass` folder of your project, import it into your main .scss file or -module you deem fit, and you're good to go:
16
+
17
+ @import "spinners";
18
+
19
+
20
+ ### Bower
21
+ To install in your current project using bower run:
22
+
23
+ bower install --save-dev spinners
24
+
25
+
26
+ ### Compass Extension
27
+
28
+ To install the Compass extension as a Ruby Gem:
29
+
30
+ gem install spinners
31
+
32
+ and require it in your `config.rb`:
33
+
34
+ require 'spinners'
35
+
36
+
37
+ Spinners is also on [Sache](http://www.sache.in/).
38
+
39
+ ##Usage
40
+
41
+ First, import Spinner into your main .scss file or -module:
42
+
43
+ @import "spinners";
44
+
45
+ Then declare a selector of your choice and call the mixin:
46
+
47
+ .my-loading-spinner {
48
+ @include spinner();
49
+ }
50
+
51
+ In your html, you can use any markup element you want, a `div`, `span`, `i`, or what have you.
52
+
53
+
54
+ Spinners come set to `display: inline-block` and `vertical-align: middle` by default so you can put it inside buttons, alerts and the like and have it aligned. If this doesn't work for you, declare you overrides ***after*** calling the mixin:
55
+
56
+ .my-spinner {
57
+ @include spinner();
58
+ vertical-align: top;
59
+ margin-right: .5em;
60
+ }
61
+
62
+ ### Customizing Spinners
63
+ Size, border-width, -style, -color, and the speed of the animation can be customized.
64
+
65
+
66
+ #### Adjusting Size
67
+ By default, Spinners are set to be `1em` wide and high, so a spinner will size proportionally to its context. To customize its size, you may use any valid dimensional unit such as `px`, `em`, or `rem`:
68
+
69
+ .my-spinner {
70
+ @include spinner(1.25em);
71
+ }
72
+
73
+ #### Adjusting border (width, style and thickness)
74
+ For adjusting the border, you may use any valid shorthand css border declaration or individual `border-{property} {value}` (no colon!) pairs:
75
+
76
+ .my-spinner {
77
+ @include spinner(3px solid #ccc);
78
+ }
79
+
80
+
81
+
82
+ .my-spinner {
83
+ @include spinner(border-width 3px, border-style solid);
84
+ }
85
+
86
+ #### Adjusting animation speed
87
+ To customize a spinner's animation speed, pass the number of seconds for one full rotation:
88
+
89
+ .my-spinner {
90
+ @include spinner(.6s);
91
+ }
92
+
93
+ All arguments are optional. When using mulitple customizations, pass your arguments comma-separated:
94
+
95
+ .my-spinner {
96
+ @include spinner(28px, 3px solid #555, .7s);
97
+ }
98
+
99
+ In case of invalid arguments compilation will not fail, but Spinners will output a warning and use its defaults.
100
+
101
+
102
+
103
+
104
+ ## Compatibility
105
+ Works in any modern browser and IE 10+.
106
+ Spinners does not come with a fallback for IE < 10, so if you need one, roll your own!
107
+
108
+
109
+ The MIT License (MIT)
110
+ ---
111
+
112
+
113
+ Copyright (c) 2014 Franz Heidl
114
+
115
+ Permission is hereby granted, free of charge, to any person obtaining a copy
116
+ of this software and associated documentation files (the "Software"), to deal
117
+ in the Software without restriction, including without limitation the rights
118
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
119
+ copies of the Software, and to permit persons to whom the Software is
120
+ furnished to do so, subject to the following conditions:
121
+
122
+ The above copyright notice and this permission notice shall be included in
123
+ all copies or substantial portions of the Software.
124
+
125
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
126
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
127
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
128
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
129
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
130
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
131
+ THE SOFTWARE.
@@ -0,0 +1,8 @@
1
+ require 'compass'
2
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
3
+ Compass::Frameworks.register('Spinners', :path => extension_path)
4
+
5
+ module Spinners
6
+ VERSION = "1.0.3"
7
+ DATE = "2014-05-16"
8
+ end
@@ -0,0 +1,236 @@
1
+ /*
2
+ ================================================================================
3
+ SPINNER
4
+ ================================================================================
5
+ A Sass mixin to generate a pure CSS3 loading/busy indicator.
6
+ https://github.com/franzheidl/spinner
7
+ Franz Heidl 2014
8
+ MIT License
9
+ --------------------------------------------------------------------------------
10
+ USAGE
11
+
12
+ Default:
13
+
14
+ .my-spinner {
15
+ @include spinner();
16
+ }
17
+
18
+
19
+ Custom:
20
+
21
+ .my-spinner {
22
+ @include spinner(1.25em, 3px solid #555, .7s);
23
+ }
24
+
25
+ All arguments are optional.
26
+
27
+ Acceppts any valid CSS dimensional declaration, e.g px, em, rem as an argument for size.
28
+
29
+ Use either shorthand border declarations or individual 'border-[property] [value]' (no colon!) pairs for the style.
30
+
31
+ Pass any number of seconds referring to the duration of one full rotation for animation speed.
32
+
33
+ --------------------------------------------------------------------------------
34
+ */
35
+
36
+
37
+ @mixin spinner-keyframes {
38
+ @-webkit-keyframes spinner-animation {
39
+ 0% {
40
+ -webkit-transform: rotate(0deg);
41
+ }
42
+ 100% {
43
+ -webkit-transform: rotate(360deg);
44
+ }
45
+ }
46
+ @-moz-keyframes spinner-animation {
47
+ 0% {
48
+ -moz-transform: rotate(0deg);
49
+ }
50
+ 100% {
51
+ -moz-transform: rotate(360deg);
52
+ }
53
+ }
54
+ @-ms-keyframes spinner-animation {
55
+ 0% {
56
+ -ms-transform: rotate(0deg);
57
+ }
58
+ 100% {
59
+ -ms-transform: rotate(360deg);
60
+ }
61
+ }
62
+ @-o-keyframes spinner-animation {
63
+ 0% {
64
+ -o-transform: rotate(0deg);
65
+ }
66
+ 100% {
67
+ -o-transform: rotate(100deg);
68
+ }
69
+ }
70
+ @keyframes spinner-animation {
71
+ 0% {
72
+ transform: rotate(0deg);
73
+ }
74
+ 100% {
75
+ transform: rotate(360deg);
76
+ }
77
+ }
78
+ }
79
+
80
+
81
+
82
+ @include spinner-keyframes();
83
+
84
+
85
+
86
+ @mixin spinner($args...) {
87
+ $prefixes: -webkit- -moz- -o- -ms- "";
88
+ $dimensional-units: ('px', 'em', 'rem', '%', 'ex');
89
+ $border-props: 'border-width' 'border-style' 'border-color';
90
+ $border-styles: solid dotted dashed double;
91
+ $size: 1em;
92
+ $border-width: 3px;
93
+ $border-style: solid;
94
+ $border-color: #4285f4;
95
+ $border: $border-width $border-style $border-color;
96
+ $duration: .65s;
97
+
98
+ // Parse arguments:
99
+ @if $args {
100
+ @each $arg in $args {
101
+ @if length($arg) == 1 {
102
+ @if type-of($arg) == number {
103
+ @if unit($arg) != "" {
104
+ @if unit($arg) == 's' {
105
+ $duration: $arg;
106
+ }
107
+ @else if isIn($dimensional-units, unit($arg)) {
108
+ $size: $arg;
109
+ }
110
+ @else {
111
+ @warn "Spinner: \"#{$arg}\" is not a valid size or duration declaration!";
112
+ }
113
+ }
114
+ @else {
115
+ @warn "Spinner: \"#{$arg}\" is not a valid size or duration declaration!";
116
+ }
117
+ }
118
+ }
119
+ @else if length($arg) == 2 {
120
+ $prop: nth($arg, 1);
121
+ $val: nth($arg, 2);
122
+ @if isIn($border-props, $prop) {
123
+ @if $prop == 'border-width' {
124
+ @if unit($val) == 'px' {
125
+ $border-width: $val;
126
+ }
127
+ @else {
128
+ @warn "Spinner: \"#{unit($val)}\" is not a valid border-width! Using default border-width.";
129
+ }
130
+ }
131
+ @else if $prop == 'border-style' {
132
+ @if isIn($border-styles, $val) {
133
+ $border-style: $val;
134
+ }
135
+ @else {
136
+ @warn "Spinner: \"#{$val}\" is not a valid border-style! Using default border-style.";
137
+ }
138
+ }
139
+ @else if $prop == 'border-color' {
140
+ @if type-of($val) == color {
141
+ $border-color: $val;
142
+ }
143
+ @else {
144
+ @warn "Spinner: \"#{$val}\" is not a valid border-color! Using default border-color.";
145
+ }
146
+ }
147
+ }
148
+ @else {
149
+ @warn "Spinner: \"#{nth($arg, 1)}\" is not a valid border property! Using default border.";
150
+ }
151
+ $border: $border-width $border-style $border-color;
152
+ }
153
+ @else if length($arg) == 3 {
154
+ @if isValidBorder($arg) {
155
+ $border: $arg;
156
+ }
157
+ @else {
158
+ @warn "Spinner: \"#{$arg}\" is not a valid shorthand border declaration! Using default border.";
159
+ }
160
+ }
161
+ }
162
+ }
163
+
164
+
165
+
166
+ background-color: transparent;
167
+ border: $border;
168
+ border-radius: 50%;
169
+ border-top-color: transparent;
170
+ border-right-color: transparent;
171
+ width: $size;
172
+ height: $size;
173
+ display: inline-block;
174
+ vertical-align: middle;
175
+ @each $prefix in $prefixes {
176
+ #{$prefix}box-sizing: border-box;
177
+ }
178
+ @each $prefix in $prefixes {
179
+ #{$prefix}animation: spinner-animation $duration infinite linear;
180
+ }
181
+ }
182
+
183
+
184
+
185
+ @function isValidBorder($border) {
186
+ $validBorderTypes: color string number;
187
+ $borderStyles: solid dotted dashed double;
188
+ $validBorder: false;
189
+ $types: ();
190
+
191
+ @if length($border) == length($validBorderTypes) {
192
+ @each $val in $border {
193
+ @if type-of($val) == number {
194
+ @if unit($val) == "" {
195
+ @return false;
196
+ }
197
+ }
198
+ @else if type-of($val) == string {
199
+ @if not isIn($borderStyles, $val) {
200
+ @return false;
201
+ }
202
+ }
203
+ $types: append($types, type-of($val));
204
+ }
205
+ $validBorder: hasIdenticalValues($validBorderTypes, $types);
206
+ }
207
+
208
+ @return $validBorder;
209
+ }
210
+
211
+
212
+
213
+ @function hasIdenticalValues($arr1, $arr2) {
214
+ $id: false;
215
+ @each $val in $arr1 {
216
+ @if isIn($arr2, $val) {
217
+ $id: true;
218
+ }
219
+ @else {
220
+ @return false;
221
+ }
222
+ }
223
+ @return $id;
224
+ }
225
+
226
+
227
+
228
+ @function isIn($arr1, $val) {
229
+ $hasVal: false;
230
+ @each $item in $arr1 {
231
+ @if $item == $val {
232
+ $hasVal: true;
233
+ }
234
+ }
235
+ @return $hasVal;
236
+ }
@@ -0,0 +1,82 @@
1
+ @import "spinners";
2
+
3
+
4
+ /* Default:
5
+
6
+ .my-spinner {
7
+ @include spinner();
8
+ }
9
+
10
+ */
11
+
12
+ .my-spinner {
13
+ @include spinner();
14
+ }
15
+
16
+ /*
17
+ Border-width:
18
+
19
+ .my-fat-spinner {
20
+ @include spinner(border-width 12px);
21
+ }
22
+
23
+ */
24
+
25
+ .my-fat-spinner {
26
+ @include spinner(border-width 12px);
27
+ }
28
+
29
+ /*
30
+ Color:
31
+
32
+ .my-blue-spinner {
33
+ @include spinner(border-color blue);
34
+ }
35
+
36
+ */
37
+
38
+ .my-blue-spinner {
39
+ @include spinner(border-color blue);
40
+ }
41
+
42
+
43
+ /*
44
+ Duration/Speed:
45
+
46
+ .my-fast-spinner {
47
+ @include spinner(.4s);
48
+ }
49
+
50
+ */
51
+
52
+ .my-fast-spinner {
53
+ @include spinner(.4s);
54
+ }
55
+
56
+ /*
57
+ Full config w/ shorthand border declaration:
58
+
59
+ .my-custom-spinner {
60
+ @include spinner(23px, 2px dotted #456789, .5s);
61
+ }
62
+
63
+ */
64
+
65
+ .my-custom-spinner-shorthand {
66
+ @include spinner(23px, 2px dotted #456789, .5s);
67
+ }
68
+
69
+ /*
70
+ Full config w/ individual border statements:
71
+
72
+ .my-custom-spinner {
73
+ @include spinner(1.3rem, border-width 5px, border-style dashed, border-color rgba(0, 0, 0, .5), .7s);
74
+ }
75
+
76
+ */
77
+
78
+ .my-custom-spinner {
79
+ @include spinner(1.3rem, border-width 5px, border-style dashed, border-color rgba(0, 0, 0, .5), .7s);
80
+ }
81
+
82
+
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spinners
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Franz Heidl
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sass
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: compass
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0.alpha
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0.alpha
41
+ description: A Sass mixin and Compass extension to generate pure CSS3 loading/busy
42
+ indicators
43
+ email:
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - README.md
49
+ - lib/spinners.rb
50
+ - stylesheets/_spinners.scss
51
+ - stylesheets/test.scss
52
+ homepage: https://github.com/franzheidl/spinners
53
+ licenses:
54
+ - MIT
55
+ metadata: {}
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 1.3.6
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 2.0.0.rc.2
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Uses a single rotating element and a partial border. Fully customizable.
76
+ test_files: []