govuk_publishing_components 11.2.0 → 12.0.0

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.
Files changed (181) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/favicon-example.png +0 -0
  3. data/app/assets/images/govuk_publishing_components/favicon-production.png +0 -0
  4. data/app/assets/javascripts/component_guide/application.js +1 -1
  5. data/app/assets/javascripts/component_guide/no_slimmer.js +15 -0
  6. data/app/assets/javascripts/govuk_publishing_components/admin_scripts.js +2 -4
  7. data/app/assets/javascripts/govuk_publishing_components/all_components.js +4 -0
  8. data/app/assets/stylesheets/component_guide/application.scss +80 -74
  9. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +4 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +26 -5
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +2 -0
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +21 -1
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +7 -1
  14. data/app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss +2 -0
  15. data/app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss +1 -0
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +24 -5
  17. data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +2 -0
  18. data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +19 -7
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +11 -1
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +12 -0
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +9 -2
  22. data/app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss +2 -0
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +11 -0
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_notice.scss +7 -2
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +9 -8
  26. data/app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss +4 -2
  27. data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +12 -1
  28. data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +6 -0
  29. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +16 -2
  30. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +7 -0
  31. data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +8 -2
  32. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +2 -0
  33. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +5 -0
  34. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +30 -7
  35. data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +14 -4
  36. data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +2 -0
  37. data/app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-list.scss +2 -1
  38. data/app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-navigation.scss +10 -0
  39. data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +4 -0
  40. data/app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss +7 -2
  41. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +4 -0
  42. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +24 -8
  43. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +47 -13
  44. data/app/controllers/govuk_publishing_components/application_controller.rb +5 -6
  45. data/app/views/govuk_publishing_components/component_guide/index.html.erb +2 -2
  46. data/app/views/govuk_publishing_components/component_guide/show.html.erb +9 -9
  47. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
  48. data/app/views/govuk_publishing_components/components/_feedback.html.erb +2 -2
  49. data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -1
  50. data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +4 -7
  51. data/app/views/govuk_publishing_components/components/_notice.html.erb +2 -2
  52. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +2 -2
  53. data/app/views/govuk_publishing_components/components/_radio.html.erb +1 -1
  54. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +1 -1
  55. data/app/views/govuk_publishing_components/components/_subscription-links.html.erb +2 -2
  56. data/app/views/govuk_publishing_components/components/_taxonomy_navigation.html.erb +2 -2
  57. data/app/views/govuk_publishing_components/components/_translation-nav.html.erb +1 -1
  58. data/app/views/govuk_publishing_components/components/docs/fieldset.yml +1 -1
  59. data/app/views/govuk_publishing_components/components/docs/layout_for_admin.yml +1 -0
  60. data/app/views/govuk_publishing_components/components/docs/tabs.yml +7 -7
  61. data/app/views/govuk_publishing_components/components/metadata/_sentence.html.erb +1 -1
  62. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +3 -3
  63. data/app/views/layouts/govuk_publishing_components/application.html.erb +43 -44
  64. data/config/initializers/assets.rb +2 -0
  65. data/lib/govuk_publishing_components/app_helpers/environment.rb +1 -0
  66. data/lib/govuk_publishing_components/config.rb +1 -1
  67. data/lib/govuk_publishing_components/engine.rb +0 -1
  68. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +1 -1
  69. data/lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb +1 -1
  70. data/lib/govuk_publishing_components/version.rb +1 -1
  71. data/node_modules/jquery/AUTHORS.txt +266 -0
  72. data/node_modules/jquery/LICENSE.txt +36 -0
  73. data/node_modules/jquery/README.md +65 -0
  74. data/node_modules/jquery/bower.json +14 -0
  75. data/node_modules/jquery/dist/jquery.js +11008 -0
  76. data/node_modules/jquery/dist/jquery.min.js +5 -0
  77. data/node_modules/jquery/dist/jquery.min.map +1 -0
  78. data/node_modules/jquery/external/sizzle/LICENSE.txt +36 -0
  79. data/node_modules/jquery/external/sizzle/dist/sizzle.js +2143 -0
  80. data/node_modules/jquery/external/sizzle/dist/sizzle.min.js +3 -0
  81. data/node_modules/jquery/external/sizzle/dist/sizzle.min.map +1 -0
  82. data/node_modules/jquery/package.json +157 -0
  83. data/node_modules/jquery/src/ajax.js +842 -0
  84. data/node_modules/jquery/src/ajax/jsonp.js +100 -0
  85. data/node_modules/jquery/src/ajax/load.js +83 -0
  86. data/node_modules/jquery/src/ajax/parseJSON.js +53 -0
  87. data/node_modules/jquery/src/ajax/parseXML.js +31 -0
  88. data/node_modules/jquery/src/ajax/script.js +95 -0
  89. data/node_modules/jquery/src/ajax/var/location.js +3 -0
  90. data/node_modules/jquery/src/ajax/var/nonce.js +5 -0
  91. data/node_modules/jquery/src/ajax/var/rquery.js +3 -0
  92. data/node_modules/jquery/src/ajax/xhr.js +229 -0
  93. data/node_modules/jquery/src/attributes.js +11 -0
  94. data/node_modules/jquery/src/attributes/attr.js +281 -0
  95. data/node_modules/jquery/src/attributes/classes.js +174 -0
  96. data/node_modules/jquery/src/attributes/prop.js +156 -0
  97. data/node_modules/jquery/src/attributes/support.js +70 -0
  98. data/node_modules/jquery/src/attributes/val.js +191 -0
  99. data/node_modules/jquery/src/callbacks.js +232 -0
  100. data/node_modules/jquery/src/core.js +529 -0
  101. data/node_modules/jquery/src/core/access.js +65 -0
  102. data/node_modules/jquery/src/core/init.js +140 -0
  103. data/node_modules/jquery/src/core/parseHTML.js +41 -0
  104. data/node_modules/jquery/src/core/ready.js +163 -0
  105. data/node_modules/jquery/src/core/var/rsingleTag.js +5 -0
  106. data/node_modules/jquery/src/css.js +563 -0
  107. data/node_modules/jquery/src/css/addGetHookIf.js +24 -0
  108. data/node_modules/jquery/src/css/adjustCSS.js +65 -0
  109. data/node_modules/jquery/src/css/curCSS.js +137 -0
  110. data/node_modules/jquery/src/css/defaultDisplay.js +72 -0
  111. data/node_modules/jquery/src/css/hiddenVisibleSelectors.js +42 -0
  112. data/node_modules/jquery/src/css/showHide.js +45 -0
  113. data/node_modules/jquery/src/css/support.js +184 -0
  114. data/node_modules/jquery/src/css/var/cssExpand.js +3 -0
  115. data/node_modules/jquery/src/css/var/isHidden.js +16 -0
  116. data/node_modules/jquery/src/css/var/rmargin.js +3 -0
  117. data/node_modules/jquery/src/css/var/rnumnonpx.js +5 -0
  118. data/node_modules/jquery/src/css/var/swap.js +24 -0
  119. data/node_modules/jquery/src/data.js +342 -0
  120. data/node_modules/jquery/src/data/support.js +23 -0
  121. data/node_modules/jquery/src/data/var/acceptData.js +20 -0
  122. data/node_modules/jquery/src/deferred.js +159 -0
  123. data/node_modules/jquery/src/deprecated.js +34 -0
  124. data/node_modules/jquery/src/dimensions.js +56 -0
  125. data/node_modules/jquery/src/effects.js +640 -0
  126. data/node_modules/jquery/src/effects/Tween.js +121 -0
  127. data/node_modules/jquery/src/effects/animatedSelector.js +13 -0
  128. data/node_modules/jquery/src/effects/support.js +58 -0
  129. data/node_modules/jquery/src/event.js +1134 -0
  130. data/node_modules/jquery/src/event/ajax.js +20 -0
  131. data/node_modules/jquery/src/event/alias.js +25 -0
  132. data/node_modules/jquery/src/event/support.js +28 -0
  133. data/node_modules/jquery/src/exports/amd.js +24 -0
  134. data/node_modules/jquery/src/exports/global.js +26 -0
  135. data/node_modules/jquery/src/intro.js +44 -0
  136. data/node_modules/jquery/src/jquery.js +37 -0
  137. data/node_modules/jquery/src/manipulation.js +585 -0
  138. data/node_modules/jquery/src/manipulation/_evalUrl.js +21 -0
  139. data/node_modules/jquery/src/manipulation/buildFragment.js +157 -0
  140. data/node_modules/jquery/src/manipulation/createSafeFragment.js +20 -0
  141. data/node_modules/jquery/src/manipulation/getAll.js +33 -0
  142. data/node_modules/jquery/src/manipulation/setGlobalEval.js +19 -0
  143. data/node_modules/jquery/src/manipulation/support.js +72 -0
  144. data/node_modules/jquery/src/manipulation/var/nodeNames.js +5 -0
  145. data/node_modules/jquery/src/manipulation/var/rcheckableType.js +3 -0
  146. data/node_modules/jquery/src/manipulation/var/rleadingWhitespace.js +3 -0
  147. data/node_modules/jquery/src/manipulation/var/rscriptType.js +3 -0
  148. data/node_modules/jquery/src/manipulation/var/rtagName.js +3 -0
  149. data/node_modules/jquery/src/manipulation/wrapMap.js +30 -0
  150. data/node_modules/jquery/src/offset.js +219 -0
  151. data/node_modules/jquery/src/outro.js +2 -0
  152. data/node_modules/jquery/src/queue.js +144 -0
  153. data/node_modules/jquery/src/queue/delay.js +22 -0
  154. data/node_modules/jquery/src/selector-sizzle.js +14 -0
  155. data/node_modules/jquery/src/selector.js +1 -0
  156. data/node_modules/jquery/src/serialize.js +125 -0
  157. data/node_modules/jquery/src/support.js +63 -0
  158. data/node_modules/jquery/src/traversing.js +179 -0
  159. data/node_modules/jquery/src/traversing/findFilter.js +100 -0
  160. data/node_modules/jquery/src/traversing/var/dir.js +20 -0
  161. data/node_modules/jquery/src/traversing/var/rneedsContext.js +6 -0
  162. data/node_modules/jquery/src/traversing/var/siblings.js +15 -0
  163. data/node_modules/jquery/src/var/class2type.js +5 -0
  164. data/node_modules/jquery/src/var/concat.js +5 -0
  165. data/node_modules/jquery/src/var/deletedIds.js +3 -0
  166. data/node_modules/jquery/src/var/document.js +3 -0
  167. data/node_modules/jquery/src/var/documentElement.js +5 -0
  168. data/node_modules/jquery/src/var/hasOwn.js +5 -0
  169. data/node_modules/jquery/src/var/indexOf.js +5 -0
  170. data/node_modules/jquery/src/var/pnum.js +3 -0
  171. data/node_modules/jquery/src/var/push.js +5 -0
  172. data/node_modules/jquery/src/var/rcssNum.js +7 -0
  173. data/node_modules/jquery/src/var/rnotwhite.js +3 -0
  174. data/node_modules/jquery/src/var/slice.js +5 -0
  175. data/node_modules/jquery/src/var/support.js +5 -0
  176. data/node_modules/jquery/src/var/toString.js +5 -0
  177. data/node_modules/jquery/src/wrap.js +77 -0
  178. metadata +111 -19
  179. data/app/assets/images/govuk_publishing_components/favicon-test.png +0 -0
  180. data/app/assets/stylesheets/govuk_publishing_components/admin_styles_ie8.scss +0 -3
  181. data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_touch-friendly-links.scss +0 -11
@@ -0,0 +1,159 @@
1
+ define( [
2
+ "./core",
3
+ "./var/slice",
4
+ "./callbacks"
5
+ ], function( jQuery, slice ) {
6
+
7
+ jQuery.extend( {
8
+
9
+ Deferred: function( func ) {
10
+ var tuples = [
11
+
12
+ // action, add listener, listener list, final state
13
+ [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
14
+ [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
15
+ [ "notify", "progress", jQuery.Callbacks( "memory" ) ]
16
+ ],
17
+ state = "pending",
18
+ promise = {
19
+ state: function() {
20
+ return state;
21
+ },
22
+ always: function() {
23
+ deferred.done( arguments ).fail( arguments );
24
+ return this;
25
+ },
26
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
27
+ var fns = arguments;
28
+ return jQuery.Deferred( function( newDefer ) {
29
+ jQuery.each( tuples, function( i, tuple ) {
30
+ var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
31
+
32
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
33
+ deferred[ tuple[ 1 ] ]( function() {
34
+ var returned = fn && fn.apply( this, arguments );
35
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
36
+ returned.promise()
37
+ .progress( newDefer.notify )
38
+ .done( newDefer.resolve )
39
+ .fail( newDefer.reject );
40
+ } else {
41
+ newDefer[ tuple[ 0 ] + "With" ](
42
+ this === promise ? newDefer.promise() : this,
43
+ fn ? [ returned ] : arguments
44
+ );
45
+ }
46
+ } );
47
+ } );
48
+ fns = null;
49
+ } ).promise();
50
+ },
51
+
52
+ // Get a promise for this deferred
53
+ // If obj is provided, the promise aspect is added to the object
54
+ promise: function( obj ) {
55
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
56
+ }
57
+ },
58
+ deferred = {};
59
+
60
+ // Keep pipe for back-compat
61
+ promise.pipe = promise.then;
62
+
63
+ // Add list-specific methods
64
+ jQuery.each( tuples, function( i, tuple ) {
65
+ var list = tuple[ 2 ],
66
+ stateString = tuple[ 3 ];
67
+
68
+ // promise[ done | fail | progress ] = list.add
69
+ promise[ tuple[ 1 ] ] = list.add;
70
+
71
+ // Handle state
72
+ if ( stateString ) {
73
+ list.add( function() {
74
+
75
+ // state = [ resolved | rejected ]
76
+ state = stateString;
77
+
78
+ // [ reject_list | resolve_list ].disable; progress_list.lock
79
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
80
+ }
81
+
82
+ // deferred[ resolve | reject | notify ]
83
+ deferred[ tuple[ 0 ] ] = function() {
84
+ deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
85
+ return this;
86
+ };
87
+ deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
88
+ } );
89
+
90
+ // Make the deferred a promise
91
+ promise.promise( deferred );
92
+
93
+ // Call given func if any
94
+ if ( func ) {
95
+ func.call( deferred, deferred );
96
+ }
97
+
98
+ // All done!
99
+ return deferred;
100
+ },
101
+
102
+ // Deferred helper
103
+ when: function( subordinate /* , ..., subordinateN */ ) {
104
+ var i = 0,
105
+ resolveValues = slice.call( arguments ),
106
+ length = resolveValues.length,
107
+
108
+ // the count of uncompleted subordinates
109
+ remaining = length !== 1 ||
110
+ ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
111
+
112
+ // the master Deferred.
113
+ // If resolveValues consist of only a single Deferred, just use that.
114
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
115
+
116
+ // Update function for both resolve and progress values
117
+ updateFunc = function( i, contexts, values ) {
118
+ return function( value ) {
119
+ contexts[ i ] = this;
120
+ values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
121
+ if ( values === progressValues ) {
122
+ deferred.notifyWith( contexts, values );
123
+
124
+ } else if ( !( --remaining ) ) {
125
+ deferred.resolveWith( contexts, values );
126
+ }
127
+ };
128
+ },
129
+
130
+ progressValues, progressContexts, resolveContexts;
131
+
132
+ // add listeners to Deferred subordinates; treat others as resolved
133
+ if ( length > 1 ) {
134
+ progressValues = new Array( length );
135
+ progressContexts = new Array( length );
136
+ resolveContexts = new Array( length );
137
+ for ( ; i < length; i++ ) {
138
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
139
+ resolveValues[ i ].promise()
140
+ .progress( updateFunc( i, progressContexts, progressValues ) )
141
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
142
+ .fail( deferred.reject );
143
+ } else {
144
+ --remaining;
145
+ }
146
+ }
147
+ }
148
+
149
+ // if we're not waiting on anything, resolve the master
150
+ if ( !remaining ) {
151
+ deferred.resolveWith( resolveContexts, resolveValues );
152
+ }
153
+
154
+ return deferred.promise();
155
+ }
156
+ } );
157
+
158
+ return jQuery;
159
+ } );
@@ -0,0 +1,34 @@
1
+ define( [
2
+ "./core",
3
+ "./traversing"
4
+ ], function( jQuery ) {
5
+
6
+ jQuery.fn.extend( {
7
+
8
+ bind: function( types, data, fn ) {
9
+ return this.on( types, null, data, fn );
10
+ },
11
+ unbind: function( types, fn ) {
12
+ return this.off( types, null, fn );
13
+ },
14
+
15
+ delegate: function( selector, types, data, fn ) {
16
+ return this.on( types, selector, data, fn );
17
+ },
18
+ undelegate: function( selector, types, fn ) {
19
+
20
+ // ( namespace ) or ( selector, types [, fn] )
21
+ return arguments.length === 1 ?
22
+ this.off( selector, "**" ) :
23
+ this.off( types, selector || "**", fn );
24
+ }
25
+ } );
26
+
27
+ // The number of elements contained in the matched element set
28
+ jQuery.fn.size = function() {
29
+ return this.length;
30
+ };
31
+
32
+ jQuery.fn.andSelf = jQuery.fn.addBack;
33
+
34
+ } );
@@ -0,0 +1,56 @@
1
+ define( [
2
+ "./core",
3
+ "./core/access",
4
+ "./css"
5
+ ], function( jQuery, access ) {
6
+
7
+ // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
8
+ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
9
+ jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
10
+ function( defaultExtra, funcName ) {
11
+
12
+ // margin is only for outerHeight, outerWidth
13
+ jQuery.fn[ funcName ] = function( margin, value ) {
14
+ var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
15
+ extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
16
+
17
+ return access( this, function( elem, type, value ) {
18
+ var doc;
19
+
20
+ if ( jQuery.isWindow( elem ) ) {
21
+
22
+ // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
23
+ // isn't a whole lot we can do. See pull request at this URL for discussion:
24
+ // https://github.com/jquery/jquery/pull/764
25
+ return elem.document.documentElement[ "client" + name ];
26
+ }
27
+
28
+ // Get document width or height
29
+ if ( elem.nodeType === 9 ) {
30
+ doc = elem.documentElement;
31
+
32
+ // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
33
+ // whichever is greatest
34
+ // unfortunately, this causes bug #3838 in IE6/8 only,
35
+ // but there is currently no good, small way to fix it.
36
+ return Math.max(
37
+ elem.body[ "scroll" + name ], doc[ "scroll" + name ],
38
+ elem.body[ "offset" + name ], doc[ "offset" + name ],
39
+ doc[ "client" + name ]
40
+ );
41
+ }
42
+
43
+ return value === undefined ?
44
+
45
+ // Get width or height on the element, requesting but not forcing parseFloat
46
+ jQuery.css( elem, type, extra ) :
47
+
48
+ // Set width or height on the element
49
+ jQuery.style( elem, type, value, extra );
50
+ }, type, chainable ? margin : undefined, chainable, null );
51
+ };
52
+ } );
53
+ } );
54
+
55
+ return jQuery;
56
+ } );
@@ -0,0 +1,640 @@
1
+ define( [
2
+ "./core",
3
+ "./effects/support",
4
+ "./var/rcssNum",
5
+ "./var/rnotwhite",
6
+ "./css/var/cssExpand",
7
+ "./css/var/isHidden",
8
+ "./css/adjustCSS",
9
+ "./css/defaultDisplay",
10
+
11
+ "./var/document",
12
+ "./core/init",
13
+ "./effects/Tween",
14
+ "./queue",
15
+ "./css",
16
+ "./deferred",
17
+ "./traversing"
18
+ ], function( jQuery, support, rcssNum, rnotwhite,
19
+ cssExpand, isHidden, adjustCSS, defaultDisplay ) {
20
+
21
+ var
22
+ fxNow, timerId,
23
+ rfxtypes = /^(?:toggle|show|hide)$/,
24
+ rrun = /queueHooks$/;
25
+
26
+ // Animations created synchronously will run synchronously
27
+ function createFxNow() {
28
+ window.setTimeout( function() {
29
+ fxNow = undefined;
30
+ } );
31
+ return ( fxNow = jQuery.now() );
32
+ }
33
+
34
+ // Generate parameters to create a standard animation
35
+ function genFx( type, includeWidth ) {
36
+ var which,
37
+ attrs = { height: type },
38
+ i = 0;
39
+
40
+ // if we include width, step value is 1 to do all cssExpand values,
41
+ // if we don't include width, step value is 2 to skip over Left and Right
42
+ includeWidth = includeWidth ? 1 : 0;
43
+ for ( ; i < 4 ; i += 2 - includeWidth ) {
44
+ which = cssExpand[ i ];
45
+ attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
46
+ }
47
+
48
+ if ( includeWidth ) {
49
+ attrs.opacity = attrs.width = type;
50
+ }
51
+
52
+ return attrs;
53
+ }
54
+
55
+ function createTween( value, prop, animation ) {
56
+ var tween,
57
+ collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
58
+ index = 0,
59
+ length = collection.length;
60
+ for ( ; index < length; index++ ) {
61
+ if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
62
+
63
+ // we're done with this property
64
+ return tween;
65
+ }
66
+ }
67
+ }
68
+
69
+ function defaultPrefilter( elem, props, opts ) {
70
+ /* jshint validthis: true */
71
+ var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
72
+ anim = this,
73
+ orig = {},
74
+ style = elem.style,
75
+ hidden = elem.nodeType && isHidden( elem ),
76
+ dataShow = jQuery._data( elem, "fxshow" );
77
+
78
+ // handle queue: false promises
79
+ if ( !opts.queue ) {
80
+ hooks = jQuery._queueHooks( elem, "fx" );
81
+ if ( hooks.unqueued == null ) {
82
+ hooks.unqueued = 0;
83
+ oldfire = hooks.empty.fire;
84
+ hooks.empty.fire = function() {
85
+ if ( !hooks.unqueued ) {
86
+ oldfire();
87
+ }
88
+ };
89
+ }
90
+ hooks.unqueued++;
91
+
92
+ anim.always( function() {
93
+
94
+ // doing this makes sure that the complete handler will be called
95
+ // before this completes
96
+ anim.always( function() {
97
+ hooks.unqueued--;
98
+ if ( !jQuery.queue( elem, "fx" ).length ) {
99
+ hooks.empty.fire();
100
+ }
101
+ } );
102
+ } );
103
+ }
104
+
105
+ // height/width overflow pass
106
+ if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
107
+
108
+ // Make sure that nothing sneaks out
109
+ // Record all 3 overflow attributes because IE does not
110
+ // change the overflow attribute when overflowX and
111
+ // overflowY are set to the same value
112
+ opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
113
+
114
+ // Set display property to inline-block for height/width
115
+ // animations on inline elements that are having width/height animated
116
+ display = jQuery.css( elem, "display" );
117
+
118
+ // Test default display if display is currently "none"
119
+ checkDisplay = display === "none" ?
120
+ jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
121
+
122
+ if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
123
+
124
+ // inline-level elements accept inline-block;
125
+ // block-level elements need to be inline with layout
126
+ if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
127
+ style.display = "inline-block";
128
+ } else {
129
+ style.zoom = 1;
130
+ }
131
+ }
132
+ }
133
+
134
+ if ( opts.overflow ) {
135
+ style.overflow = "hidden";
136
+ if ( !support.shrinkWrapBlocks() ) {
137
+ anim.always( function() {
138
+ style.overflow = opts.overflow[ 0 ];
139
+ style.overflowX = opts.overflow[ 1 ];
140
+ style.overflowY = opts.overflow[ 2 ];
141
+ } );
142
+ }
143
+ }
144
+
145
+ // show/hide pass
146
+ for ( prop in props ) {
147
+ value = props[ prop ];
148
+ if ( rfxtypes.exec( value ) ) {
149
+ delete props[ prop ];
150
+ toggle = toggle || value === "toggle";
151
+ if ( value === ( hidden ? "hide" : "show" ) ) {
152
+
153
+ // If there is dataShow left over from a stopped hide or show
154
+ // and we are going to proceed with show, we should pretend to be hidden
155
+ if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
156
+ hidden = true;
157
+ } else {
158
+ continue;
159
+ }
160
+ }
161
+ orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
162
+
163
+ // Any non-fx value stops us from restoring the original display value
164
+ } else {
165
+ display = undefined;
166
+ }
167
+ }
168
+
169
+ if ( !jQuery.isEmptyObject( orig ) ) {
170
+ if ( dataShow ) {
171
+ if ( "hidden" in dataShow ) {
172
+ hidden = dataShow.hidden;
173
+ }
174
+ } else {
175
+ dataShow = jQuery._data( elem, "fxshow", {} );
176
+ }
177
+
178
+ // store state if its toggle - enables .stop().toggle() to "reverse"
179
+ if ( toggle ) {
180
+ dataShow.hidden = !hidden;
181
+ }
182
+ if ( hidden ) {
183
+ jQuery( elem ).show();
184
+ } else {
185
+ anim.done( function() {
186
+ jQuery( elem ).hide();
187
+ } );
188
+ }
189
+ anim.done( function() {
190
+ var prop;
191
+ jQuery._removeData( elem, "fxshow" );
192
+ for ( prop in orig ) {
193
+ jQuery.style( elem, prop, orig[ prop ] );
194
+ }
195
+ } );
196
+ for ( prop in orig ) {
197
+ tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
198
+
199
+ if ( !( prop in dataShow ) ) {
200
+ dataShow[ prop ] = tween.start;
201
+ if ( hidden ) {
202
+ tween.end = tween.start;
203
+ tween.start = prop === "width" || prop === "height" ? 1 : 0;
204
+ }
205
+ }
206
+ }
207
+
208
+ // If this is a noop like .hide().hide(), restore an overwritten display value
209
+ } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
210
+ style.display = display;
211
+ }
212
+ }
213
+
214
+ function propFilter( props, specialEasing ) {
215
+ var index, name, easing, value, hooks;
216
+
217
+ // camelCase, specialEasing and expand cssHook pass
218
+ for ( index in props ) {
219
+ name = jQuery.camelCase( index );
220
+ easing = specialEasing[ name ];
221
+ value = props[ index ];
222
+ if ( jQuery.isArray( value ) ) {
223
+ easing = value[ 1 ];
224
+ value = props[ index ] = value[ 0 ];
225
+ }
226
+
227
+ if ( index !== name ) {
228
+ props[ name ] = value;
229
+ delete props[ index ];
230
+ }
231
+
232
+ hooks = jQuery.cssHooks[ name ];
233
+ if ( hooks && "expand" in hooks ) {
234
+ value = hooks.expand( value );
235
+ delete props[ name ];
236
+
237
+ // not quite $.extend, this wont overwrite keys already present.
238
+ // also - reusing 'index' from above because we have the correct "name"
239
+ for ( index in value ) {
240
+ if ( !( index in props ) ) {
241
+ props[ index ] = value[ index ];
242
+ specialEasing[ index ] = easing;
243
+ }
244
+ }
245
+ } else {
246
+ specialEasing[ name ] = easing;
247
+ }
248
+ }
249
+ }
250
+
251
+ function Animation( elem, properties, options ) {
252
+ var result,
253
+ stopped,
254
+ index = 0,
255
+ length = Animation.prefilters.length,
256
+ deferred = jQuery.Deferred().always( function() {
257
+
258
+ // don't match elem in the :animated selector
259
+ delete tick.elem;
260
+ } ),
261
+ tick = function() {
262
+ if ( stopped ) {
263
+ return false;
264
+ }
265
+ var currentTime = fxNow || createFxNow(),
266
+ remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
267
+
268
+ // Support: Android 2.3
269
+ // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
270
+ temp = remaining / animation.duration || 0,
271
+ percent = 1 - temp,
272
+ index = 0,
273
+ length = animation.tweens.length;
274
+
275
+ for ( ; index < length ; index++ ) {
276
+ animation.tweens[ index ].run( percent );
277
+ }
278
+
279
+ deferred.notifyWith( elem, [ animation, percent, remaining ] );
280
+
281
+ if ( percent < 1 && length ) {
282
+ return remaining;
283
+ } else {
284
+ deferred.resolveWith( elem, [ animation ] );
285
+ return false;
286
+ }
287
+ },
288
+ animation = deferred.promise( {
289
+ elem: elem,
290
+ props: jQuery.extend( {}, properties ),
291
+ opts: jQuery.extend( true, {
292
+ specialEasing: {},
293
+ easing: jQuery.easing._default
294
+ }, options ),
295
+ originalProperties: properties,
296
+ originalOptions: options,
297
+ startTime: fxNow || createFxNow(),
298
+ duration: options.duration,
299
+ tweens: [],
300
+ createTween: function( prop, end ) {
301
+ var tween = jQuery.Tween( elem, animation.opts, prop, end,
302
+ animation.opts.specialEasing[ prop ] || animation.opts.easing );
303
+ animation.tweens.push( tween );
304
+ return tween;
305
+ },
306
+ stop: function( gotoEnd ) {
307
+ var index = 0,
308
+
309
+ // if we are going to the end, we want to run all the tweens
310
+ // otherwise we skip this part
311
+ length = gotoEnd ? animation.tweens.length : 0;
312
+ if ( stopped ) {
313
+ return this;
314
+ }
315
+ stopped = true;
316
+ for ( ; index < length ; index++ ) {
317
+ animation.tweens[ index ].run( 1 );
318
+ }
319
+
320
+ // resolve when we played the last frame
321
+ // otherwise, reject
322
+ if ( gotoEnd ) {
323
+ deferred.notifyWith( elem, [ animation, 1, 0 ] );
324
+ deferred.resolveWith( elem, [ animation, gotoEnd ] );
325
+ } else {
326
+ deferred.rejectWith( elem, [ animation, gotoEnd ] );
327
+ }
328
+ return this;
329
+ }
330
+ } ),
331
+ props = animation.props;
332
+
333
+ propFilter( props, animation.opts.specialEasing );
334
+
335
+ for ( ; index < length ; index++ ) {
336
+ result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
337
+ if ( result ) {
338
+ if ( jQuery.isFunction( result.stop ) ) {
339
+ jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
340
+ jQuery.proxy( result.stop, result );
341
+ }
342
+ return result;
343
+ }
344
+ }
345
+
346
+ jQuery.map( props, createTween, animation );
347
+
348
+ if ( jQuery.isFunction( animation.opts.start ) ) {
349
+ animation.opts.start.call( elem, animation );
350
+ }
351
+
352
+ jQuery.fx.timer(
353
+ jQuery.extend( tick, {
354
+ elem: elem,
355
+ anim: animation,
356
+ queue: animation.opts.queue
357
+ } )
358
+ );
359
+
360
+ // attach callbacks from options
361
+ return animation.progress( animation.opts.progress )
362
+ .done( animation.opts.done, animation.opts.complete )
363
+ .fail( animation.opts.fail )
364
+ .always( animation.opts.always );
365
+ }
366
+
367
+ jQuery.Animation = jQuery.extend( Animation, {
368
+
369
+ tweeners: {
370
+ "*": [ function( prop, value ) {
371
+ var tween = this.createTween( prop, value );
372
+ adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
373
+ return tween;
374
+ } ]
375
+ },
376
+
377
+ tweener: function( props, callback ) {
378
+ if ( jQuery.isFunction( props ) ) {
379
+ callback = props;
380
+ props = [ "*" ];
381
+ } else {
382
+ props = props.match( rnotwhite );
383
+ }
384
+
385
+ var prop,
386
+ index = 0,
387
+ length = props.length;
388
+
389
+ for ( ; index < length ; index++ ) {
390
+ prop = props[ index ];
391
+ Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
392
+ Animation.tweeners[ prop ].unshift( callback );
393
+ }
394
+ },
395
+
396
+ prefilters: [ defaultPrefilter ],
397
+
398
+ prefilter: function( callback, prepend ) {
399
+ if ( prepend ) {
400
+ Animation.prefilters.unshift( callback );
401
+ } else {
402
+ Animation.prefilters.push( callback );
403
+ }
404
+ }
405
+ } );
406
+
407
+ jQuery.speed = function( speed, easing, fn ) {
408
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
409
+ complete: fn || !fn && easing ||
410
+ jQuery.isFunction( speed ) && speed,
411
+ duration: speed,
412
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
413
+ };
414
+
415
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
416
+ opt.duration in jQuery.fx.speeds ?
417
+ jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
418
+
419
+ // normalize opt.queue - true/undefined/null -> "fx"
420
+ if ( opt.queue == null || opt.queue === true ) {
421
+ opt.queue = "fx";
422
+ }
423
+
424
+ // Queueing
425
+ opt.old = opt.complete;
426
+
427
+ opt.complete = function() {
428
+ if ( jQuery.isFunction( opt.old ) ) {
429
+ opt.old.call( this );
430
+ }
431
+
432
+ if ( opt.queue ) {
433
+ jQuery.dequeue( this, opt.queue );
434
+ }
435
+ };
436
+
437
+ return opt;
438
+ };
439
+
440
+ jQuery.fn.extend( {
441
+ fadeTo: function( speed, to, easing, callback ) {
442
+
443
+ // show any hidden elements after setting opacity to 0
444
+ return this.filter( isHidden ).css( "opacity", 0 ).show()
445
+
446
+ // animate to the value specified
447
+ .end().animate( { opacity: to }, speed, easing, callback );
448
+ },
449
+ animate: function( prop, speed, easing, callback ) {
450
+ var empty = jQuery.isEmptyObject( prop ),
451
+ optall = jQuery.speed( speed, easing, callback ),
452
+ doAnimation = function() {
453
+
454
+ // Operate on a copy of prop so per-property easing won't be lost
455
+ var anim = Animation( this, jQuery.extend( {}, prop ), optall );
456
+
457
+ // Empty animations, or finishing resolves immediately
458
+ if ( empty || jQuery._data( this, "finish" ) ) {
459
+ anim.stop( true );
460
+ }
461
+ };
462
+ doAnimation.finish = doAnimation;
463
+
464
+ return empty || optall.queue === false ?
465
+ this.each( doAnimation ) :
466
+ this.queue( optall.queue, doAnimation );
467
+ },
468
+ stop: function( type, clearQueue, gotoEnd ) {
469
+ var stopQueue = function( hooks ) {
470
+ var stop = hooks.stop;
471
+ delete hooks.stop;
472
+ stop( gotoEnd );
473
+ };
474
+
475
+ if ( typeof type !== "string" ) {
476
+ gotoEnd = clearQueue;
477
+ clearQueue = type;
478
+ type = undefined;
479
+ }
480
+ if ( clearQueue && type !== false ) {
481
+ this.queue( type || "fx", [] );
482
+ }
483
+
484
+ return this.each( function() {
485
+ var dequeue = true,
486
+ index = type != null && type + "queueHooks",
487
+ timers = jQuery.timers,
488
+ data = jQuery._data( this );
489
+
490
+ if ( index ) {
491
+ if ( data[ index ] && data[ index ].stop ) {
492
+ stopQueue( data[ index ] );
493
+ }
494
+ } else {
495
+ for ( index in data ) {
496
+ if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
497
+ stopQueue( data[ index ] );
498
+ }
499
+ }
500
+ }
501
+
502
+ for ( index = timers.length; index--; ) {
503
+ if ( timers[ index ].elem === this &&
504
+ ( type == null || timers[ index ].queue === type ) ) {
505
+
506
+ timers[ index ].anim.stop( gotoEnd );
507
+ dequeue = false;
508
+ timers.splice( index, 1 );
509
+ }
510
+ }
511
+
512
+ // start the next in the queue if the last step wasn't forced
513
+ // timers currently will call their complete callbacks, which will dequeue
514
+ // but only if they were gotoEnd
515
+ if ( dequeue || !gotoEnd ) {
516
+ jQuery.dequeue( this, type );
517
+ }
518
+ } );
519
+ },
520
+ finish: function( type ) {
521
+ if ( type !== false ) {
522
+ type = type || "fx";
523
+ }
524
+ return this.each( function() {
525
+ var index,
526
+ data = jQuery._data( this ),
527
+ queue = data[ type + "queue" ],
528
+ hooks = data[ type + "queueHooks" ],
529
+ timers = jQuery.timers,
530
+ length = queue ? queue.length : 0;
531
+
532
+ // enable finishing flag on private data
533
+ data.finish = true;
534
+
535
+ // empty the queue first
536
+ jQuery.queue( this, type, [] );
537
+
538
+ if ( hooks && hooks.stop ) {
539
+ hooks.stop.call( this, true );
540
+ }
541
+
542
+ // look for any active animations, and finish them
543
+ for ( index = timers.length; index--; ) {
544
+ if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
545
+ timers[ index ].anim.stop( true );
546
+ timers.splice( index, 1 );
547
+ }
548
+ }
549
+
550
+ // look for any animations in the old queue and finish them
551
+ for ( index = 0; index < length; index++ ) {
552
+ if ( queue[ index ] && queue[ index ].finish ) {
553
+ queue[ index ].finish.call( this );
554
+ }
555
+ }
556
+
557
+ // turn off finishing flag
558
+ delete data.finish;
559
+ } );
560
+ }
561
+ } );
562
+
563
+ jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
564
+ var cssFn = jQuery.fn[ name ];
565
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
566
+ return speed == null || typeof speed === "boolean" ?
567
+ cssFn.apply( this, arguments ) :
568
+ this.animate( genFx( name, true ), speed, easing, callback );
569
+ };
570
+ } );
571
+
572
+ // Generate shortcuts for custom animations
573
+ jQuery.each( {
574
+ slideDown: genFx( "show" ),
575
+ slideUp: genFx( "hide" ),
576
+ slideToggle: genFx( "toggle" ),
577
+ fadeIn: { opacity: "show" },
578
+ fadeOut: { opacity: "hide" },
579
+ fadeToggle: { opacity: "toggle" }
580
+ }, function( name, props ) {
581
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
582
+ return this.animate( props, speed, easing, callback );
583
+ };
584
+ } );
585
+
586
+ jQuery.timers = [];
587
+ jQuery.fx.tick = function() {
588
+ var timer,
589
+ timers = jQuery.timers,
590
+ i = 0;
591
+
592
+ fxNow = jQuery.now();
593
+
594
+ for ( ; i < timers.length; i++ ) {
595
+ timer = timers[ i ];
596
+
597
+ // Checks the timer has not already been removed
598
+ if ( !timer() && timers[ i ] === timer ) {
599
+ timers.splice( i--, 1 );
600
+ }
601
+ }
602
+
603
+ if ( !timers.length ) {
604
+ jQuery.fx.stop();
605
+ }
606
+ fxNow = undefined;
607
+ };
608
+
609
+ jQuery.fx.timer = function( timer ) {
610
+ jQuery.timers.push( timer );
611
+ if ( timer() ) {
612
+ jQuery.fx.start();
613
+ } else {
614
+ jQuery.timers.pop();
615
+ }
616
+ };
617
+
618
+ jQuery.fx.interval = 13;
619
+
620
+ jQuery.fx.start = function() {
621
+ if ( !timerId ) {
622
+ timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
623
+ }
624
+ };
625
+
626
+ jQuery.fx.stop = function() {
627
+ window.clearInterval( timerId );
628
+ timerId = null;
629
+ };
630
+
631
+ jQuery.fx.speeds = {
632
+ slow: 600,
633
+ fast: 200,
634
+
635
+ // Default speed
636
+ _default: 400
637
+ };
638
+
639
+ return jQuery;
640
+ } );