ratchet_design 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/ratchet/base/mobilemenu.js +20 -8
- data/app/assets/javascripts/ratchet/base/validation.js +44 -11
- data/app/assets/javascripts/ratchet/core.js +43 -40
- data/app/assets/javascripts/ratchet/enhancement/waypoints.js +15 -15
- data/app/assets/stylesheets/ratchet/base/_button.scss +20 -1
- data/app/assets/stylesheets/ratchet/base/_document.scss +27 -14
- data/app/assets/stylesheets/ratchet/utility/_global.scss +1 -1
- data/app/helpers/ratchet/application_helper.rb +5 -0
- data/app/views/layouts/ratchet/default.html.slim +1 -1
- data/app/views/shared/ratchet/_header.html.slim +1 -3
- data/lib/ratchet_design/version.rb +1 -1
- data/public/assets/ratchet/{core-0.1.0.js → core-0.1.1.js} +6 -6
- data/public/assets/ratchet/core-0.1.1.js.gz +0 -0
- data/public/assets/ratchet/core-0.1.1.map.json +1 -0
- data/public/assets/ratchet/{fonts-woff-0.1.0.css → fonts-woff-0.1.1.css} +0 -0
- data/public/assets/ratchet/{fonts-woff-0.1.0.css.gz → fonts-woff-0.1.1.css.gz} +0 -0
- data/public/assets/ratchet/{fonts-woff2-0.1.0.css → fonts-woff2-0.1.1.css} +0 -0
- data/public/assets/ratchet/{fonts-woff2-0.1.0.css.gz → fonts-woff2-0.1.1.css.gz} +0 -0
- metadata +17 -15
- data/public/assets/ratchet/core-0.1.0.js.gz +0 -0
- data/public/assets/ratchet/core-0.1.0.map.json +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05e52118e10d1100b0d48fc879d875a872586559
|
4
|
+
data.tar.gz: a4b56310564057e3446f8b8d16c7a39f7d728b0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44157e35a90e6263f377a3477956cce463aba8a69d4a207af25cfeb30dab9d2c2298e02ee61dc4228533242c75d3cc3e90127d55c8594799e5a13db8f52e50b3
|
7
|
+
data.tar.gz: 6e94d09f3ea42db5ac4c61775d39f65d6fa3dfe666a40cba15959bf4bc493879f733288b70bf4b31ae74b18378d24359192e166c53494711e7c8d3a788de7496
|
@@ -5,19 +5,24 @@
|
|
5
5
|
* @license MIT (http://www.opensource.org/licenses/mit-license.php/)
|
6
6
|
**/
|
7
7
|
|
8
|
+
// Dependencies
|
9
|
+
var matches = require( '../utility/matches' );
|
10
|
+
|
8
11
|
// Public API function
|
9
12
|
var mobileMenu = function( element, settings ) {
|
10
13
|
|
11
14
|
// Overridable defaults
|
12
15
|
var defaults = {
|
13
|
-
initWidth
|
14
|
-
openClass
|
15
|
-
|
16
|
+
initWidth : '700px',
|
17
|
+
openClass : 'menu-open',
|
18
|
+
menuButton : '.mobile-menu-button'
|
19
|
+
},
|
16
20
|
|
17
21
|
// Scoped variables
|
18
|
-
|
19
|
-
|
20
|
-
|
22
|
+
options = Object.assign( {}, defaults, settings ),
|
23
|
+
selector = document.querySelector( element ),
|
24
|
+
widthQuery = window.matchMedia( '(max-width: ' + options.initWidth + ')' ),
|
25
|
+
docBody = document.body;
|
21
26
|
|
22
27
|
// Attach listeners
|
23
28
|
if ( selector ) {
|
@@ -33,9 +38,16 @@ var mobileMenu = function( element, settings ) {
|
|
33
38
|
// Click handler function
|
34
39
|
function clickHandler( event ) {
|
35
40
|
|
36
|
-
|
41
|
+
// Combine element selector with anchor links
|
42
|
+
var toggleSelector = options.menuButton + ', .' + options.openClass + ' ' + element + ' a[href^="#"]';
|
43
|
+
|
44
|
+
// Only run on menu button
|
45
|
+
if ( matches( event.target, toggleSelector ) ) {
|
37
46
|
|
38
|
-
|
47
|
+
// Toggle body class
|
48
|
+
docBody.classList.toggle( options.openClass );
|
49
|
+
|
50
|
+
}
|
39
51
|
|
40
52
|
}
|
41
53
|
|
@@ -46,28 +46,31 @@ var validation = function( element, settings ) {
|
|
46
46
|
// Scoped variables
|
47
47
|
var element = event.target,
|
48
48
|
minWords = element.dataset.minWords,
|
49
|
+
maxWords = element.dataset.maxWords,
|
49
50
|
indicator = getClosest( element, 'label' ) || element,
|
50
51
|
validity;
|
51
52
|
|
53
|
+
// If element only contains whitespace, strip value
|
54
|
+
if ( element.value && !element.value.replace( /\s/g, '' ).length ) {
|
55
|
+
element.value = '';
|
56
|
+
}
|
57
|
+
|
52
58
|
// Remove pre-existing validation message
|
53
59
|
messageHandler( 'hide', element );
|
54
60
|
|
55
61
|
// If element has `data-min-words` attribute
|
56
62
|
if ( minWords ) {
|
57
63
|
|
58
|
-
//
|
59
|
-
|
60
|
-
|
61
|
-
// Set a custom error message
|
62
|
-
element.setCustomValidity( 'Please write at least ' + minWords + ' words.' );
|
64
|
+
// Run respective validation function
|
65
|
+
validateWords( 'min', element, minWords );
|
63
66
|
|
64
|
-
|
65
|
-
} else {
|
67
|
+
}
|
66
68
|
|
67
|
-
|
68
|
-
|
69
|
+
// If element has `data-min-words` attribute
|
70
|
+
if ( maxWords ) {
|
69
71
|
|
70
|
-
|
72
|
+
// Run respective validation function
|
73
|
+
validateWords( 'max', element, maxWords );
|
71
74
|
|
72
75
|
}
|
73
76
|
|
@@ -103,7 +106,7 @@ var validation = function( element, settings ) {
|
|
103
106
|
function submissionHandler( event ) {
|
104
107
|
|
105
108
|
// Only run on submission
|
106
|
-
if ( !matches( event.target, 'input[type=submit], button
|
109
|
+
if ( !matches( event.target, 'input[type=submit], button[type=submit]' ) ) return;
|
107
110
|
|
108
111
|
// Scoped variables
|
109
112
|
var invalidForm = getClosest( event.target, 'form' ),
|
@@ -224,6 +227,36 @@ var validation = function( element, settings ) {
|
|
224
227
|
|
225
228
|
}
|
226
229
|
|
230
|
+
// Min- or max-words validation function
|
231
|
+
function validateWords( type, element, goal ) {
|
232
|
+
|
233
|
+
// Defaults settings to min-words
|
234
|
+
var value = element.value,
|
235
|
+
condition = wordCount( value ) < goal,
|
236
|
+
verbiage = 'at least ';
|
237
|
+
|
238
|
+
// Overwrite defaults in case of max-words
|
239
|
+
if ( type === 'max' ) {
|
240
|
+
condition = wordCount( value ) > goal;
|
241
|
+
verbiage = 'no more than ';
|
242
|
+
}
|
243
|
+
|
244
|
+
// If value exists and it meets invalid condition
|
245
|
+
if ( value && condition ) {
|
246
|
+
|
247
|
+
// Set a custom error message
|
248
|
+
element.setCustomValidity( 'Please write ' + verbiage + goal + ' words.' );
|
249
|
+
|
250
|
+
// Otherwise
|
251
|
+
} else {
|
252
|
+
|
253
|
+
// Default to normal error messaging
|
254
|
+
element.setCustomValidity( '' );
|
255
|
+
|
256
|
+
}
|
257
|
+
|
258
|
+
}
|
259
|
+
|
227
260
|
};
|
228
261
|
|
229
262
|
// Public API
|
@@ -1,74 +1,77 @@
|
|
1
1
|
// Shim modules
|
2
|
-
require( './shim/classlist'
|
2
|
+
require( './shim/classlist' );
|
3
3
|
require( './shim/object.assign' );
|
4
4
|
|
5
5
|
// Utility modules
|
6
|
-
var loadFont = require( './utility/load_font'
|
7
|
-
var fullStop = require( './utility/full_stop'
|
8
|
-
var unhover = require( './utility/unhover'
|
9
|
-
var throttle = require( './utility/throttle'
|
10
|
-
var loadScript = require( './utility/load_script'
|
11
|
-
var fromTop = require( './utility/from_top'
|
12
|
-
var scrollTo = require( './utility/scroll_to'
|
13
|
-
var matches = require( './utility/matches'
|
14
|
-
var getClosest = require( './utility/get_closest'
|
15
|
-
var getNext = require( './utility/get_next'
|
16
|
-
var wordCount = require( './utility/word_count'
|
6
|
+
var loadFont = require( './utility/load_font' );
|
7
|
+
var fullStop = require( './utility/full_stop' );
|
8
|
+
var unhover = require( './utility/unhover' );
|
9
|
+
var throttle = require( './utility/throttle' );
|
10
|
+
var loadScript = require( './utility/load_script' );
|
11
|
+
var fromTop = require( './utility/from_top' );
|
12
|
+
var scrollTo = require( './utility/scroll_to' );
|
13
|
+
var matches = require( './utility/matches' );
|
14
|
+
var getClosest = require( './utility/get_closest' );
|
15
|
+
var getNext = require( './utility/get_next' );
|
16
|
+
var wordCount = require( './utility/word_count' );
|
17
17
|
var compileData = require( './utility/compile_data' );
|
18
|
-
var timeout = require( './utility/timeout'
|
18
|
+
var timeout = require( './utility/timeout' );
|
19
19
|
|
20
20
|
// Base modules
|
21
21
|
var mobileMenu = require( './base/mobilemenu' );
|
22
|
-
var form = require( './base/form'
|
22
|
+
var form = require( './base/form' );
|
23
23
|
var validation = require( './base/validation' );
|
24
24
|
|
25
25
|
// Enhancement modules
|
26
|
-
var loader = require( './enhancement/loader'
|
26
|
+
var loader = require( './enhancement/loader' );
|
27
27
|
var waypoints = require( './enhancement/waypoints' );
|
28
|
-
var notice = require( './enhancement/notice'
|
29
|
-
var sticky = require( './enhancement/sticky'
|
30
|
-
var esvg = require( './_svg'
|
31
|
-
// var swap = require( './enhancement/swap'
|
28
|
+
var notice = require( './enhancement/notice' );
|
29
|
+
var sticky = require( './enhancement/sticky' );
|
30
|
+
var esvg = require( './_svg' );
|
31
|
+
// var swap = require( './enhancement/swap' );
|
32
32
|
|
33
33
|
// Vendor modules
|
34
|
-
var event = require( 'compose-event'
|
34
|
+
var event = require( 'compose-event' );
|
35
35
|
var highlighter = require( 'compose-code-highlighter' );
|
36
|
-
require( 'codemirror/mode/htmlmixed/htmlmixed'
|
37
|
-
require( 'codemirror/mode/slim/slim'
|
38
|
-
require( 'codemirror/mode/javascript/javascript'
|
39
|
-
require( 'codemirror/mode/css/css'
|
40
|
-
require( 'codemirror/mode/sql/sql'
|
41
|
-
require( 'codemirror/mode/php/php'
|
42
|
-
require( 'codemirror/mode/ruby/ruby'
|
43
|
-
require( 'codemirror/mode/shell/shell'
|
44
|
-
require( 'codemirror/mode/go/go'
|
45
|
-
require( 'codemirror/mode/python/python'
|
46
|
-
require( 'codemirror/mode/yaml/yaml'
|
47
|
-
require( 'codemirror/mode/clike/clike'
|
48
|
-
require( 'codemirror/addon/runmode/runmode'
|
49
|
-
require( 'codemirror/addon/edit/matchbrackets'
|
36
|
+
require( 'codemirror/mode/htmlmixed/htmlmixed' );
|
37
|
+
require( 'codemirror/mode/slim/slim' );
|
38
|
+
require( 'codemirror/mode/javascript/javascript' );
|
39
|
+
require( 'codemirror/mode/css/css' );
|
40
|
+
require( 'codemirror/mode/sql/sql' );
|
41
|
+
require( 'codemirror/mode/php/php' );
|
42
|
+
require( 'codemirror/mode/ruby/ruby' );
|
43
|
+
require( 'codemirror/mode/shell/shell' );
|
44
|
+
require( 'codemirror/mode/go/go' );
|
45
|
+
require( 'codemirror/mode/python/python' );
|
46
|
+
require( 'codemirror/mode/yaml/yaml' );
|
47
|
+
require( 'codemirror/mode/clike/clike' );
|
48
|
+
require( 'codemirror/addon/runmode/runmode' );
|
49
|
+
require( 'codemirror/addon/edit/matchbrackets' );
|
50
50
|
|
51
51
|
// Public API object
|
52
52
|
window.ratchet = module.exports = {
|
53
|
-
esvg : esvg,
|
54
|
-
event : event,
|
55
53
|
loadFont : loadFont,
|
54
|
+
fullStop : fullStop,
|
55
|
+
unhover : unhover,
|
56
56
|
throttle : throttle,
|
57
57
|
loadScript : loadScript,
|
58
|
+
fromTop : fromTop,
|
58
59
|
scrollTo : scrollTo,
|
59
|
-
|
60
|
-
getNext : getNext,
|
60
|
+
matches : matches,
|
61
61
|
getClosest : getClosest,
|
62
|
+
getNext : getNext,
|
63
|
+
wordCount : wordCount,
|
62
64
|
compileData : compileData,
|
63
65
|
timeout : timeout,
|
64
66
|
mobileMenu : mobileMenu,
|
65
67
|
form : form,
|
66
68
|
validation : validation,
|
67
69
|
loader : loader,
|
68
|
-
// swap : swap,
|
69
70
|
waypoints : waypoints,
|
70
71
|
notice : notice,
|
71
|
-
sticky : sticky
|
72
|
+
sticky : sticky,
|
73
|
+
esvg : esvg,
|
74
|
+
event : event
|
72
75
|
}
|
73
76
|
|
74
77
|
// Default events instantiation
|
@@ -18,7 +18,6 @@ var waypoints = function( elements, settings ) {
|
|
18
18
|
// Overridable defaults
|
19
19
|
var defaults = {
|
20
20
|
initWidth : '700px',
|
21
|
-
navigation : '.secondary',
|
22
21
|
activeAnchor : 'active',
|
23
22
|
elemOffset : 0,
|
24
23
|
showLandmarks : false,
|
@@ -40,8 +39,9 @@ var waypoints = function( elements, settings ) {
|
|
40
39
|
} else {
|
41
40
|
|
42
41
|
// Scoped variables
|
43
|
-
var
|
44
|
-
widthQuery = window.matchMedia( '(min-width: ' +
|
42
|
+
var initWidth = options.initWidth ? options.initWidth : '0px',
|
43
|
+
widthQuery = window.matchMedia( '(min-width: ' + initWidth + ')' ),
|
44
|
+
docBody = document.body,
|
45
45
|
coordinates = [],
|
46
46
|
oldActiveItem,
|
47
47
|
windowHash,
|
@@ -100,7 +100,7 @@ var waypoints = function( elements, settings ) {
|
|
100
100
|
window.addEventListener( 'optimizedScroll', scrollHandler, false );
|
101
101
|
|
102
102
|
// Click function listener
|
103
|
-
|
103
|
+
docBody.addEventListener( 'click', clickHandler, false );
|
104
104
|
|
105
105
|
// Call hash change listener function explicitly at run time
|
106
106
|
hashHandler();
|
@@ -118,7 +118,7 @@ var waypoints = function( elements, settings ) {
|
|
118
118
|
window.removeEventListener( 'optimizedScroll', scrollHandler, false );
|
119
119
|
|
120
120
|
// Remove click listener
|
121
|
-
|
121
|
+
docBody.removeEventListener( 'click', clickHandler, false );
|
122
122
|
|
123
123
|
// Remove hash change listener
|
124
124
|
window.removeEventListener( 'hashchange', hashHandler, false );
|
@@ -131,7 +131,7 @@ var waypoints = function( elements, settings ) {
|
|
131
131
|
function resizeHandler() {
|
132
132
|
|
133
133
|
// Update document height variable
|
134
|
-
docHeight =
|
134
|
+
docHeight = docBody.scrollHeight;
|
135
135
|
|
136
136
|
// Update window height variable
|
137
137
|
winHeight = window.innerHeight;
|
@@ -200,13 +200,13 @@ var waypoints = function( elements, settings ) {
|
|
200
200
|
if ( newActiveItem === oldActiveItem ) return false;
|
201
201
|
|
202
202
|
// Update active link
|
203
|
-
activeLink =
|
203
|
+
activeLink = docBody.querySelector( 'a[href="#' + newActiveItem + '"]' );
|
204
204
|
|
205
205
|
// If no active link is found, abort
|
206
206
|
if ( !activeLink ) return false;
|
207
207
|
|
208
208
|
// And enable navigation item
|
209
|
-
activate(
|
209
|
+
activate( activeLink, options.activeAnchor );
|
210
210
|
|
211
211
|
// If landmarks are turned on
|
212
212
|
if ( options.showLandmarks === true ) {
|
@@ -215,7 +215,7 @@ var waypoints = function( elements, settings ) {
|
|
215
215
|
landmark = getClosest( activeLink, options.landmarkSelector );
|
216
216
|
|
217
217
|
// Enable active landmark
|
218
|
-
activate(
|
218
|
+
activate( landmark, options.activeLandmark );
|
219
219
|
|
220
220
|
}
|
221
221
|
|
@@ -229,12 +229,12 @@ var waypoints = function( elements, settings ) {
|
|
229
229
|
// Click handler function
|
230
230
|
function clickHandler( event ) {
|
231
231
|
|
232
|
-
// Prevent default behavior
|
233
|
-
event.preventDefault();
|
234
|
-
|
235
232
|
// Matches selector function init
|
236
233
|
if ( matches( event.target, 'a[href^="#"]' ) ) {
|
237
234
|
|
235
|
+
// Prevent default behavior
|
236
|
+
event.preventDefault();
|
237
|
+
|
238
238
|
// Travel to clicked target
|
239
239
|
travel( event.target, 'click' );
|
240
240
|
|
@@ -268,7 +268,7 @@ var waypoints = function( elements, settings ) {
|
|
268
268
|
if ( targetElement ) {
|
269
269
|
|
270
270
|
// Enable new active navigation item
|
271
|
-
activate(
|
271
|
+
activate( destination, options.activeAnchor );
|
272
272
|
|
273
273
|
// Loop through coordinates
|
274
274
|
for ( var i = 0; i < coordinates.length; i++ ) {
|
@@ -309,10 +309,10 @@ var waypoints = function( elements, settings ) {
|
|
309
309
|
}
|
310
310
|
|
311
311
|
// Link activation function
|
312
|
-
function activate(
|
312
|
+
function activate( selector, cls ) {
|
313
313
|
|
314
314
|
// Find currently active link
|
315
|
-
var activeLink =
|
315
|
+
var activeLink = docBody.querySelector( '.' + cls );
|
316
316
|
|
317
317
|
// And if it exists, disable it
|
318
318
|
if ( activeLink ) activeLink.classList.remove( cls );
|
@@ -6,6 +6,25 @@
|
|
6
6
|
* i. Utility
|
7
7
|
* ------------------------------------- */
|
8
8
|
|
9
|
+
// Reset default <button> styles
|
10
|
+
@mixin button-reset() {
|
11
|
+
font: initial;
|
12
|
+
margin: initial;
|
13
|
+
padding: initial;
|
14
|
+
border: initial;
|
15
|
+
background: initial;
|
16
|
+
-moz-user-select: text;
|
17
|
+
|
18
|
+
&:focus {
|
19
|
+
outline: initial;
|
20
|
+
}
|
21
|
+
|
22
|
+
&::-moz-focus-inner {
|
23
|
+
padding: 0;
|
24
|
+
border: 0;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
9
28
|
// Resizable / colorable buttons
|
10
29
|
@mixin button($color: $cerulean, $size: normal, $fill: on, $bevel: off) {
|
11
30
|
|
@@ -46,7 +65,7 @@
|
|
46
65
|
}
|
47
66
|
|
48
67
|
// Declarations
|
49
|
-
display: inline-
|
68
|
+
display: inline-block;
|
50
69
|
width: auto;
|
51
70
|
text-align: center;
|
52
71
|
font-size: $font-size;
|
@@ -65,33 +65,46 @@ $breakpoint: 800px;
|
|
65
65
|
|
66
66
|
// Shown on smaller screens
|
67
67
|
@media (max-width: $breakpoint) {
|
68
|
+
@include button-reset;
|
68
69
|
@include shown;
|
69
70
|
z-index: 4;
|
70
71
|
width: 36px;
|
71
72
|
height: 36px;
|
72
|
-
|
73
|
+
margin-left: auto;
|
73
74
|
padding: 12px 10px;
|
75
|
+
border-radius: 50%;
|
76
|
+
transition: .5s transform;
|
74
77
|
box-shadow: 0 0 0 1px $white;
|
75
|
-
|
78
|
+
background: transparent linear-gradient(to bottom, $white, $white) 50% 50% / 16px 2px no-repeat;
|
76
79
|
|
77
|
-
|
80
|
+
&:after,
|
81
|
+
&:before {
|
82
|
+
content: '';
|
78
83
|
display: block;
|
79
84
|
width: 16px;
|
80
85
|
height: 2px;
|
81
86
|
background: $white;
|
82
|
-
transition:
|
83
|
-
|
87
|
+
transition:
|
88
|
+
.5s opacity,
|
89
|
+
.5s transform;
|
84
90
|
}
|
85
91
|
|
86
|
-
|
87
|
-
margin:
|
92
|
+
&:after {
|
93
|
+
margin: 8px 0;
|
88
94
|
}
|
89
95
|
|
90
96
|
// Fancy animation when menu open
|
91
|
-
.menu-open &
|
92
|
-
|
93
|
-
|
94
|
-
&:
|
97
|
+
.menu-open & {
|
98
|
+
transform: rotate(-45deg);
|
99
|
+
|
100
|
+
&:after {
|
101
|
+
transform: translateY(-5px) rotate(-90deg);
|
102
|
+
}
|
103
|
+
|
104
|
+
&:before {
|
105
|
+
transform: translateY(5px);
|
106
|
+
opacity: 0;
|
107
|
+
}
|
95
108
|
}
|
96
109
|
}
|
97
110
|
}
|
@@ -191,10 +204,11 @@ header[role=banner] > nav[role=navigation] {
|
|
191
204
|
position: fixed;
|
192
205
|
top: 0;
|
193
206
|
left: 0;
|
194
|
-
|
195
|
-
|
207
|
+
width: 100vw;
|
208
|
+
height: 100vh;
|
196
209
|
opacity: 0;
|
197
210
|
z-index: 3;
|
211
|
+
align-items: center;
|
198
212
|
flex-direction: column;
|
199
213
|
justify-content: center;
|
200
214
|
background: transparent;
|
@@ -218,7 +232,6 @@ header[role=banner] > nav[role=navigation] {
|
|
218
232
|
|
219
233
|
// Main navigation
|
220
234
|
header[role=banner] > nav[role=navigation] {
|
221
|
-
left: 0;
|
222
235
|
opacity: 1;
|
223
236
|
transform: translateX(0);
|
224
237
|
background: rgba($shark, .95);
|
@@ -44,6 +44,11 @@ module Ratchet
|
|
44
44
|
selector ? content_for(:selector) { selector } : content_for(:selector).presence
|
45
45
|
end
|
46
46
|
|
47
|
+
# Consolidated page class output
|
48
|
+
def page_classes
|
49
|
+
request.path_parameters[:page].split("/").last + (selector ? " #{selector}" : "")
|
50
|
+
end
|
51
|
+
|
47
52
|
# TODO:
|
48
53
|
# sitemap "ignore"
|
49
54
|
|
@@ -3,11 +3,11 @@
|
|
3
3
|
},{}],2:[function(require,module,exports){
|
4
4
|
"use strict";var evt=require("compose-event"),form=function(e,t){function n(e){var t=e.parentNode;"LABEL"===t.tagName?t.classList.add("tick-label"):(e.insertAdjacentHTML("beforebegin",'<label class="tick-label"></label>'),e.previousSibling.insertAdjacentElement("afterbegin",e)),e.insertAdjacentHTML("afterend","<span></span>")}function r(e){return"number"===e.target.type&&void((e.which<48||e.which>57)&&e.preventDefault())}function a(e){var t=e.target?e.target:e;if("range"!==t.type)return!1;var n=t.max?t.value/t.max*100:t.value/100*100;t.style.backgroundImage="linear-gradient(90deg, #009DDC "+n+"%, #D1D1D1 "+n+"%)"}function i(e){function t(e){var t=(""+e).match(/( ?:\.( \d+ ) )?( ?:[eE]( [+-]?\d+ ) )?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}function n(e,n){if(n<1){var r=t(parseInt(n));return parseFloat(e.toFixed(r))}return Math.round(e/n)*n}function r(e){var t,r=e.target,a=e.changedTouches[0],i=parseFloat(r.getAttribute("min"))||0,u=parseFloat(r.getAttribute("max"))||100,c=parseFloat(r.getAttribute("step"))||1,l=u-i,d=r.getBoundingClientRect(),s=100/d.width*(o/2)/100;return t=100/d.width*(a.clientX-d.left),t<0?t=0:t>100&&(t=100),t<50?t-=(100-2*t)*s:t>50&&(t+=2*(t-50)*s),i+n(l*(t/100),c)}function a(e){"range"===e.target.type&&(e.preventDefault(),e.target.value=r(e),evt.fire(e.target,"touchend"===e.type?"change":"input"))}if("ontouchstart"in document.documentElement){for(var i=document.querySelectorAll("[type=range]"),o=e||20,u=i.length-1;u>=0;u--)i[u].style.touchAction="manipulation",i[u].style.webkitUserSelect="none";d.addEventListener("touchstart",a,!1),d.addEventListener("touchmove",a,!1),d.addEventListener("touchend",a,!1)}}var o={},u=document.querySelector(e)||document.querySelector("form");if(!u)return!1;var c=(Object.assign({},o,t),document.querySelectorAll("input[type=range]")),l=document.querySelectorAll("input[type=checkbox], input[type=radio]"),d=document.body;d.addEventListener("keypress",r,!1),d.addEventListener("input",a,!0);for(var s=0;s<c.length;s++)a(c[s]);for(var g=0;g<l.length;g++)n(l[g]);i()};module.exports=form;
|
5
5
|
},{"compose-event":42}],3:[function(require,module,exports){
|
6
|
-
"use strict";var mobileMenu=function(e,t){function n(
|
7
|
-
},{}],4:[function(require,module,exports){
|
8
|
-
"use strict";var matches=require("../utility/matches"),getClosest=require("../utility/get_closest"),wordCount=require("../utility/word_count"),validation=function(e,t){function a(e){if(!matches(e.target,"input:not([type=submit]), textarea"))return!1;var t,a=e.target,i=a.dataset.minWords,
|
6
|
+
"use strict";var matches=require("../utility/matches"),mobileMenu=function(e,t){function n(t){var n=s.menuButton+", ."+s.openClass+" "+e+' a[href^="#"]';matches(t.target,n)&&c.classList.toggle(s.openClass)}function i(e){e.matches?a.addEventListener("click",n,!1):a.removeEventListener("click",n,!1)}var o={initWidth:"700px",openClass:"menu-open",menuButton:".mobile-menu-button"},s=Object.assign({},o,t),a=document.querySelector(e),u=window.matchMedia("(max-width: "+s.initWidth+")"),c=document.body;a&&(i(u),u.addListener(i))};module.exports=mobileMenu;
|
7
|
+
},{"../utility/matches":19}],4:[function(require,module,exports){
|
8
|
+
"use strict";var matches=require("../utility/matches"),getClosest=require("../utility/get_closest"),wordCount=require("../utility/word_count"),validation=function(e,t){function a(e){if(!matches(e.target,"input:not([type=submit]), textarea"))return!1;var t,a=e.target,i=a.dataset.minWords,r=a.dataset.maxWords,l=getClosest(a,"label")||a;a.value&&!a.value.replace(/\s/g,"").length&&(a.value=""),s("hide",a),i&&n("min",a,i),r&&n("max",a,r),t=a.checkValidity(),a.value&&!t?(l.classList.remove("valid"),l.classList.add("invalid")):a.value&&t?(l.classList.remove("invalid"),l.classList.add("valid")):a.value||(l.classList.remove("valid"),l.classList.remove("invalid"))}function i(e){if(matches(e.target,"input[type=submit], button[type=submit]")){var t,a=getClosest(e.target,"form"),i=a.querySelector("input:invalid, textarea:invalid");if(i){if(t=getClosest(i,"label")||i,matches(i,"[data-stripe=number]")&&(i.value=i.value.replace(/[^0-9 -]/g,""),i=a.querySelector("input:invalid, textarea:invalid"),!i))return;return e.preventDefault(),"none"!==i.style.display?i.focus():i.nextSibling.focus(),t.classList.remove("valid"),t.classList.add("invalid"),s("show",i),!1}}}function s(e,t){var a=getClosest(t,"form"),i=a.querySelector(".validation-message"),s=t.validationMessage,n=function(){i.parentNode.removeChild(i)},r=function(){var e=getClosest(t,"label");return!!e&&void e.insertAdjacentHTML("beforeend",'<aside class="validation-message"><p>'+s+"</p></aside>")};t.dataset.message&&(s=t.dataset.message),i&&"hide"===e&&n(),"show"!==e||i?"show"===e&&i&&(i.parentNode!==t.parentNode?(n(),r()):i.childNodes[0].textContent=s):r()}function n(e,t,a){var i=t.value,s=wordCount(i)<a,n="at least ";"max"===e&&(s=wordCount(i)>a,n="no more than "),i&&s?t.setCustomValidity("Please write "+n+a+" words."):t.setCustomValidity("")}var r={},l=document.querySelector(e)||document.querySelector("[required]");if(!l||"function"!=typeof document.createElement("input").checkValidity)return!1;var o=(Object.assign({},r,t),document.body);o.addEventListener("invalid",function(e){e.preventDefault()},!0),o.addEventListener("blur",a,!0),o.addEventListener("click",i,!1)};module.exports=validation;
|
9
9
|
},{"../utility/get_closest":15,"../utility/matches":19,"../utility/word_count":24}],5:[function(require,module,exports){
|
10
|
-
"use strict";require("./shim/classlist"),require("./shim/object.assign");var loadFont=require("./utility/load_font"),fullStop=require("./utility/full_stop"),unhover=require("./utility/unhover"),throttle=require("./utility/throttle"),loadScript=require("./utility/load_script"),fromTop=require("./utility/from_top"),scrollTo=require("./utility/scroll_to"),matches=require("./utility/matches"),getClosest=require("./utility/get_closest"),getNext=require("./utility/get_next"),wordCount=require("./utility/word_count"),compileData=require("./utility/compile_data"),timeout=require("./utility/timeout"),mobileMenu=require("./base/mobilemenu"),form=require("./base/form"),validation=require("./base/validation"),loader=require("./enhancement/loader"),waypoints=require("./enhancement/waypoints"),notice=require("./enhancement/notice"),sticky=require("./enhancement/sticky"),esvg=require("./_svg"),event=require("compose-event"),highlighter=require("compose-code-highlighter");require("codemirror/mode/htmlmixed/htmlmixed"),require("codemirror/mode/slim/slim"),require("codemirror/mode/javascript/javascript"),require("codemirror/mode/css/css"),require("codemirror/mode/sql/sql"),require("codemirror/mode/php/php"),require("codemirror/mode/ruby/ruby"),require("codemirror/mode/shell/shell"),require("codemirror/mode/go/go"),require("codemirror/mode/python/python"),require("codemirror/mode/yaml/yaml"),require("codemirror/mode/clike/clike"),require("codemirror/addon/runmode/runmode"),require("codemirror/addon/edit/matchbrackets"),window.ratchet=module.exports={
|
10
|
+
"use strict";require("./shim/classlist"),require("./shim/object.assign");var loadFont=require("./utility/load_font"),fullStop=require("./utility/full_stop"),unhover=require("./utility/unhover"),throttle=require("./utility/throttle"),loadScript=require("./utility/load_script"),fromTop=require("./utility/from_top"),scrollTo=require("./utility/scroll_to"),matches=require("./utility/matches"),getClosest=require("./utility/get_closest"),getNext=require("./utility/get_next"),wordCount=require("./utility/word_count"),compileData=require("./utility/compile_data"),timeout=require("./utility/timeout"),mobileMenu=require("./base/mobilemenu"),form=require("./base/form"),validation=require("./base/validation"),loader=require("./enhancement/loader"),waypoints=require("./enhancement/waypoints"),notice=require("./enhancement/notice"),sticky=require("./enhancement/sticky"),esvg=require("./_svg"),event=require("compose-event"),highlighter=require("compose-code-highlighter");require("codemirror/mode/htmlmixed/htmlmixed"),require("codemirror/mode/slim/slim"),require("codemirror/mode/javascript/javascript"),require("codemirror/mode/css/css"),require("codemirror/mode/sql/sql"),require("codemirror/mode/php/php"),require("codemirror/mode/ruby/ruby"),require("codemirror/mode/shell/shell"),require("codemirror/mode/go/go"),require("codemirror/mode/python/python"),require("codemirror/mode/yaml/yaml"),require("codemirror/mode/clike/clike"),require("codemirror/addon/runmode/runmode"),require("codemirror/addon/edit/matchbrackets"),window.ratchet=module.exports={loadFont:loadFont,fullStop:fullStop,unhover:unhover,throttle:throttle,loadScript:loadScript,fromTop:fromTop,scrollTo:scrollTo,matches:matches,getClosest:getClosest,getNext:getNext,wordCount:wordCount,compileData:compileData,timeout:timeout,mobileMenu:mobileMenu,form:form,validation:validation,loader:loader,waypoints:waypoints,notice:notice,sticky:sticky,esvg:esvg,event:event},event.change(function(){unhover(),fullStop(),form(),validation(),highlighter.highlight()},!1);
|
11
11
|
},{"./_svg":1,"./base/form":2,"./base/mobilemenu":3,"./base/validation":4,"./enhancement/loader":6,"./enhancement/notice":7,"./enhancement/sticky":8,"./enhancement/waypoints":9,"./shim/classlist":10,"./shim/object.assign":11,"./utility/compile_data":12,"./utility/from_top":13,"./utility/full_stop":14,"./utility/get_closest":15,"./utility/get_next":16,"./utility/load_font":17,"./utility/load_script":18,"./utility/matches":19,"./utility/scroll_to":20,"./utility/throttle":21,"./utility/timeout":22,"./utility/unhover":23,"./utility/word_count":24,"codemirror/addon/edit/matchbrackets":25,"codemirror/addon/runmode/runmode":26,"codemirror/mode/clike/clike":28,"codemirror/mode/css/css":29,"codemirror/mode/go/go":30,"codemirror/mode/htmlmixed/htmlmixed":31,"codemirror/mode/javascript/javascript":32,"codemirror/mode/php/php":33,"codemirror/mode/python/python":34,"codemirror/mode/ruby/ruby":35,"codemirror/mode/shell/shell":36,"codemirror/mode/slim/slim":37,"codemirror/mode/sql/sql":38,"codemirror/mode/yaml/yaml":40,"compose-code-highlighter":41,"compose-event":42}],6:[function(require,module,exports){
|
12
12
|
"use strict";var loader=function(s){var e={selector:document.body,loaderClass:"loader",loadingMessage:"Hang tight…",loadingClass:"loading",successMessage:"Got it!",successClass:"success",failureMessage:"Hold up!",failureClass:"failure"},a=Object.assign({},e,s);a.selector.insertAdjacentHTML("afterbegin",'<div class="'+a.loaderClass+'"></div>');var l=document.querySelector("div."+a.loaderClass),t=function(s){"pending"===s?(l.textContent=a.loadingMessage,l.classList.remove(a.successClass,a.failureClass),l.classList.add(a.loadingClass)):"failure"===s?(l.textContent=a.failureMessage,l.classList.remove(a.loadingClass),l.classList.add(a.failureClass)):"success"===s&&(l.textContent=a.successMessage,l.classList.remove(a.loadingClass),l.classList.add(a.successClass))},i=function(){l.classList.remove(a.loadingClass,a.successClass,a.failureClass)};return{show:t,hide:i}};module.exports=loader;
|
13
13
|
},{}],7:[function(require,module,exports){
|
@@ -15,7 +15,7 @@
|
|
15
15
|
},{}],8:[function(require,module,exports){
|
16
16
|
"use strict";var throttle=require("../utility/throttle"),fromTop=require("../utility/from_top"),sticky=function(t,e){function i(t){t.matches?(o(),window.addEventListener("optimizedResize",o,!1),n(),window.addEventListener("optimizedScroll",n,!1)):(h.classList.remove("sticky"),window.removeEventListener("optimizedResize",o,!1),window.removeEventListener("optimizedScroll",n,!1))}function o(){c=document.body.scrollHeight,l=window.innerHeight}function n(){var t=window.pageYOffset,e=t>u,i=w?t>=c-p-w+a:null;e&&!i?(h.classList.remove("anchored"),h.classList.add("sticky")):e&&i?(h.classList.remove("sticky"),h.classList.add("anchored")):h.classList.remove("sticky")}var s={topPadding:!1,initWidth:"700px",stickyClass:"sticky",anchorPoint:null},r=Object.assign({},s,e),d=document.querySelector(t);if(!d)return!1;var c,l,a=r.topPadding===!0?parseInt(window.getComputedStyle(d,null).getPropertyValue("padding-top")):0,m=window.matchMedia("(min-width: "+r.initWidth+")"),u=fromTop(d)+a,p=d.offsetHeight,w=r.anchorPoint,h=document.body;throttle("resize","optimizedResize"),throttle("scroll","optimizedScroll"),i(m),m.addListener(i)};module.exports=sticky;
|
17
17
|
},{"../utility/from_top":13,"../utility/throttle":21}],9:[function(require,module,exports){
|
18
|
-
"use strict";var matches=require("../utility/matches"),fromTop=require("../utility/from_top"),scrollTo=require("../utility/scroll_to"),getClosest=require("../utility/get_closest"),throttle=require("../utility/throttle"),waypoints=function(e,t){function i(e){e.matches?(o(),window.addEventListener("optimizedResize",o,!1),n(),window.addEventListener("optimizedScroll",n,!1),
|
18
|
+
"use strict";var matches=require("../utility/matches"),fromTop=require("../utility/from_top"),scrollTo=require("../utility/scroll_to"),getClosest=require("../utility/get_closest"),throttle=require("../utility/throttle"),waypoints=function(e,t){function i(e){e.matches?(o(),window.addEventListener("optimizedResize",o,!1),n(),window.addEventListener("optimizedScroll",n,!1),L.addEventListener("click",r,!1),l(),window.addEventListener("hashchange",l,!1)):(window.removeEventListener("optimizedResize",o,!1),window.removeEventListener("optimizedScroll",n,!1),L.removeEventListener("click",r,!1),window.removeEventListener("hashchange",l,!1))}function o(){w=L.scrollHeight,u=window.innerHeight;for(var e=0;e<f.length;e++){var t={elem:f[e],offset:fromTop(f[e])};g[e]=t}}function n(){for(var e,t,i,o=window.pageYOffset,n=o<0||o+u>=w,r=0;r<g.length;r++){var l=g[0],a=g[r],c=g[r+1],f=g[g.length-1];o<l.offset?e=l.elem.id:n||o>f.offset-d.elemOffset?e=f.elem.id:o>a.offset-d.elemOffset&&o<c.offset-d.elemOffset&&(e=a.elem.id)}if(e){if(e===h)return!1;if(t=L.querySelector('a[href="#'+e+'"]'),!t)return!1;s(t,d.activeAnchor),d.showLandmarks===!0&&(i=getClosest(t,d.landmarkSelector),s(i,d.activeLandmark)),h=e}}function r(e){matches(e.target,'a[href^="#"]')&&(e.preventDefault(),a(e.target,"click"))}function l(){if(!window.location.hash)return!1;var e=document.querySelector('a[href="'+window.location.hash+'"]');a(e,"hash")}function a(e,t){var i,o=e.href.split("#")[1],r=document.querySelector("#"+o);if(r){s(e,d.activeAnchor);for(var l=0;l<g.length;l++)g[l].elem===r&&(i=g[l].offset);"click"===t?(window.removeEventListener("optimizedScroll",n,!1),history.pushState(null,"","#"+o),scrollTo(i-d.elemOffset+1,function(){window.addEventListener("optimizedScroll",n,!1)})):"hash"===t&&window.scrollTo(0,i-d.elemOffset+1)}}function s(e,t){var i=L.querySelector("."+t);i&&i.classList.remove(t),e.classList.add(t)}var c={initWidth:"700px",activeAnchor:"active",elemOffset:0,showLandmarks:!1,landmarkSelector:".landmark",activeLandmark:"pinned"},d=Object.assign({},c,t),f=document.querySelectorAll(e);if(!f.length)return!1;var h,m,w,u,v=d.initWidth?d.initWidth:"0px",p=window.matchMedia("(min-width: "+v+")"),L=document.body,g=[];window.location.hash&&(m=window.location.hash.replace("#",""),window.location.hash="",history.replaceState(null,"","#"+m)),throttle("resize","optimizedResize"),throttle("scroll","optimizedScroll"),window.addEventListener("load",function(){i(p),p.addListener(i)},!1)};module.exports=waypoints;
|
19
19
|
},{"../utility/from_top":13,"../utility/get_closest":15,"../utility/matches":19,"../utility/scroll_to":20,"../utility/throttle":21}],10:[function(require,module,exports){
|
20
20
|
"use strict";"document"in self&&("classList"in document.createElement("_")?!function(){var t=document.createElement("_");if(t.classList.add("c1","c2"),!t.classList.contains("c2")){var e=function(t){var e=DOMTokenList.prototype[t];DOMTokenList.prototype[t]=function(t){var n,i=arguments.length;for(n=0;n<i;n++)t=arguments[n],e.call(this,t)}};e("add"),e("remove")}if(t.classList.toggle("c3",!1),t.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:n.call(this,t)}}t=null}():!function(t){if("Element"in t){var e="classList",n="prototype",i=t.Element[n],s=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},o=Array[n].indexOf||function(t){for(var e=0;e<this.length;e++)if(e in this&&this[e]===t)return e;return-1},a=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},c=function(t,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return o.call(t,e)},l=function(t){for(var e=r.call(t.getAttribute("class")||""),n=e?e.split(/\s+/):[],i=0;i<n.length;i++)this.push(n[i]);this._updateClassName=function(){t.setAttribute("class",this.toString())}},u=l[n]=[],f=function(){return new l(this)};if(a[n]=Error[n],u.item=function(t){return this[t]||null},u.contains=function(t){return t+="",c(this,t)!==-1},u.add=function(){var t,e=arguments,n=0,i=e.length,s=!1;do t=e[n]+"",c(this,t)===-1&&(this.push(t),s=!0);while(++n<i);s&&this._updateClassName()},u.remove=function(){var t,e,n=arguments,i=0,s=n.length,r=!1;do for(t=n[i]+"",e=c(this,t);e!==-1;)this.splice(e,1),r=!0,e=c(this,t);while(++i<s);r&&this._updateClassName()},u.toggle=function(t,e){t+="";var n=this.contains(t),i=n?e!==!0&&"remove":e!==!1&&"add";return i&&this[i](t),e===!0||e===!1?e:!n},u.toString=function(){return this.join(" ")},s.defineProperty){var h={get:f,enumerable:!0,configurable:!0};try{s.defineProperty(i,e,h)}catch(t){t.number===-2146823252&&(h.enumerable=!1,s.defineProperty(i,e,h))}}else s[n].__defineGetter__&&i.__defineGetter__(e,f)}}(self));
|
21
21
|
},{}],11:[function(require,module,exports){
|
@@ -100,4 +100,4 @@ function Tap(e,t){function n(t){function n(n){if(t!==n&&(a(),!n.defaultPrevented
|
|
100
100
|
});
|
101
101
|
|
102
102
|
|
103
|
-
//# sourceMappingURL=/assets/ratchet/core-0.1.
|
103
|
+
//# sourceMappingURL=/assets/ratchet/core-0.1.1.map.json
|
Binary file
|