Skip to content

Commit 4e9f14a

Browse files
committed
v1.4.0-rc.0
1 parent 0033b0b commit 4e9f14a

File tree

2,473 files changed

+299894
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,473 files changed

+299894
-0
lines changed

1.4.0-rc.0/angular-1.4.0-rc.0.zip

9.28 MB
Binary file not shown.

1.4.0-rc.0/angular-animate.js

Lines changed: 3268 additions & 0 deletions
Large diffs are not rendered by default.

1.4.0-rc.0/angular-animate.min.js

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1.4.0-rc.0/angular-animate.min.js.map

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1.4.0-rc.0/angular-aria.js

Lines changed: 377 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,377 @@
1+
/**
2+
* @license AngularJS v1.4.0-rc.0
3+
* (c) 2010-2015 Google, Inc. http://angularjs.org
4+
* License: MIT
5+
*/
6+
(function(window, angular, undefined) {'use strict';
7+
8+
/**
9+
* @ngdoc module
10+
* @name ngAria
11+
* @description
12+
*
13+
* The `ngAria` module provides support for common
14+
* [<abbr title="Accessible Rich Internet Applications">ARIA</abbr>](http://www.w3.org/TR/wai-aria/)
15+
* attributes that convey state or semantic information about the application for users
16+
* of assistive technologies, such as screen readers.
17+
*
18+
* <div doc-module-components="ngAria"></div>
19+
*
20+
* ## Usage
21+
*
22+
* For ngAria to do its magic, simply include the module as a dependency. The directives supported
23+
* by ngAria are:
24+
* `ngModel`, `ngDisabled`, `ngShow`, `ngHide`, `ngClick`, `ngDblClick`, and `ngMessages`.
25+
*
26+
* Below is a more detailed breakdown of the attributes handled by ngAria:
27+
*
28+
* | Directive | Supported Attributes |
29+
* |---------------------------------------------|----------------------------------------------------------------------------------------|
30+
* | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled |
31+
* | {@link ng.directive:ngShow ngShow} | aria-hidden |
32+
* | {@link ng.directive:ngHide ngHide} | aria-hidden |
33+
* | {@link ng.directive:ngDblclick ngDblclick} | tabindex |
34+
* | {@link module:ngMessages ngMessages} | aria-live |
35+
* | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles |
36+
* | {@link ng.directive:ngClick ngClick} | tabindex, keypress event, button role |
37+
*
38+
* Find out more information about each directive by reading the
39+
* {@link guide/accessibility ngAria Developer Guide}.
40+
*
41+
* ##Example
42+
* Using ngDisabled with ngAria:
43+
* ```html
44+
* <md-checkbox ng-disabled="disabled">
45+
* ```
46+
* Becomes:
47+
* ```html
48+
* <md-checkbox ng-disabled="disabled" aria-disabled="true">
49+
* ```
50+
*
51+
* ##Disabling Attributes
52+
* It's possible to disable individual attributes added by ngAria with the
53+
* {@link ngAria.$ariaProvider#config config} method. For more details, see the
54+
* {@link guide/accessibility Developer Guide}.
55+
*/
56+
/* global -ngAriaModule */
57+
var ngAriaModule = angular.module('ngAria', ['ng']).
58+
provider('$aria', $AriaProvider);
59+
60+
/**
61+
* @ngdoc provider
62+
* @name $ariaProvider
63+
*
64+
* @description
65+
*
66+
* Used for configuring the ARIA attributes injected and managed by ngAria.
67+
*
68+
* ```js
69+
* angular.module('myApp', ['ngAria'], function config($ariaProvider) {
70+
* $ariaProvider.config({
71+
* ariaValue: true,
72+
* tabindex: false
73+
* });
74+
* });
75+
*```
76+
*
77+
* ## Dependencies
78+
* Requires the {@link ngAria} module to be installed.
79+
*
80+
*/
81+
function $AriaProvider() {
82+
var config = {
83+
ariaHidden: true,
84+
ariaChecked: true,
85+
ariaDisabled: true,
86+
ariaRequired: true,
87+
ariaInvalid: true,
88+
ariaMultiline: true,
89+
ariaValue: true,
90+
tabindex: true,
91+
bindKeypress: true
92+
};
93+
94+
/**
95+
* @ngdoc method
96+
* @name $ariaProvider#config
97+
*
98+
* @param {object} config object to enable/disable specific ARIA attributes
99+
*
100+
* - **ariaHidden** – `{boolean}` – Enables/disables aria-hidden tags
101+
* - **ariaChecked** – `{boolean}` – Enables/disables aria-checked tags
102+
* - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags
103+
* - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags
104+
* - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags
105+
* - **ariaMultiline** – `{boolean}` – Enables/disables aria-multiline tags
106+
* - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and aria-valuenow tags
107+
* - **tabindex** – `{boolean}` – Enables/disables tabindex tags
108+
* - **bindKeypress** – `{boolean}` – Enables/disables keypress event binding on `&lt;div&gt;` and
109+
* `&lt;li&gt;` elements with ng-click
110+
*
111+
* @description
112+
* Enables/disables various ARIA attributes
113+
*/
114+
this.config = function(newConfig) {
115+
config = angular.extend(config, newConfig);
116+
};
117+
118+
function watchExpr(attrName, ariaAttr, negate) {
119+
return function(scope, elem, attr) {
120+
var ariaCamelName = attr.$normalize(ariaAttr);
121+
if (config[ariaCamelName] && !attr[ariaCamelName]) {
122+
scope.$watch(attr[attrName], function(boolVal) {
123+
if (negate) {
124+
boolVal = !boolVal;
125+
}
126+
elem.attr(ariaAttr, boolVal);
127+
});
128+
}
129+
};
130+
}
131+
132+
/**
133+
* @ngdoc service
134+
* @name $aria
135+
*
136+
* @description
137+
* @priority 200
138+
*
139+
* The $aria service contains helper methods for applying common
140+
* [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
141+
*
142+
* ngAria injects common accessibility attributes that tell assistive technologies when HTML
143+
* elements are enabled, selected, hidden, and more. To see how this is performed with ngAria,
144+
* let's review a code snippet from ngAria itself:
145+
*
146+
*```js
147+
* ngAriaModule.directive('ngDisabled', ['$aria', function($aria) {
148+
* return $aria.$$watchExpr('ngDisabled', 'aria-disabled');
149+
* }])
150+
*```
151+
* Shown above, the ngAria module creates a directive with the same signature as the
152+
* traditional `ng-disabled` directive. But this ngAria version is dedicated to
153+
* solely managing accessibility attributes. The internal `$aria` service is used to watch the
154+
* boolean attribute `ngDisabled`. If it has not been explicitly set by the developer,
155+
* `aria-disabled` is injected as an attribute with its value synchronized to the value in
156+
* `ngDisabled`.
157+
*
158+
* Because ngAria hooks into the `ng-disabled` directive, developers do not have to do
159+
* anything to enable this feature. The `aria-disabled` attribute is automatically managed
160+
* simply as a silent side-effect of using `ng-disabled` with the ngAria module.
161+
*
162+
* The full list of directives that interface with ngAria:
163+
* * **ngModel**
164+
* * **ngShow**
165+
* * **ngHide**
166+
* * **ngClick**
167+
* * **ngDblclick**
168+
* * **ngMessages**
169+
* * **ngDisabled**
170+
*
171+
* Read the {@link guide/accessibility ngAria Developer Guide} for a thorough explanation of each
172+
* directive.
173+
*
174+
*
175+
* ## Dependencies
176+
* Requires the {@link ngAria} module to be installed.
177+
*/
178+
this.$get = function() {
179+
return {
180+
config: function(key) {
181+
return config[key];
182+
},
183+
$$watchExpr: watchExpr
184+
};
185+
};
186+
}
187+
188+
189+
ngAriaModule.directive('ngShow', ['$aria', function($aria) {
190+
return $aria.$$watchExpr('ngShow', 'aria-hidden', true);
191+
}])
192+
.directive('ngHide', ['$aria', function($aria) {
193+
return $aria.$$watchExpr('ngHide', 'aria-hidden', false);
194+
}])
195+
.directive('ngModel', ['$aria', function($aria) {
196+
197+
function shouldAttachAttr(attr, normalizedAttr, elem) {
198+
return $aria.config(normalizedAttr) && !elem.attr(attr);
199+
}
200+
201+
function shouldAttachRole(role, elem) {
202+
return !elem.attr('role') && (elem.attr('type') === role) && (elem[0].nodeName !== 'INPUT');
203+
}
204+
205+
function getShape(attr, elem) {
206+
var type = attr.type,
207+
role = attr.role;
208+
209+
return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' :
210+
((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' :
211+
(type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' :
212+
(type || role) === 'textbox' || elem[0].nodeName === 'TEXTAREA' ? 'multiline' : '';
213+
}
214+
215+
return {
216+
restrict: 'A',
217+
require: '?ngModel',
218+
priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value
219+
compile: function(elem, attr) {
220+
var shape = getShape(attr, elem);
221+
222+
return {
223+
pre: function(scope, elem, attr, ngModel) {
224+
if (shape === 'checkbox' && attr.type !== 'checkbox') {
225+
//Use the input[checkbox] $isEmpty implementation for elements with checkbox roles
226+
ngModel.$isEmpty = function(value) {
227+
return value === false;
228+
};
229+
}
230+
},
231+
post: function(scope, elem, attr, ngModel) {
232+
var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem);
233+
234+
function ngAriaWatchModelValue() {
235+
return ngModel.$modelValue;
236+
}
237+
238+
function getRadioReaction() {
239+
if (needsTabIndex) {
240+
needsTabIndex = false;
241+
return function ngAriaRadioReaction(newVal) {
242+
var boolVal = (attr.value == ngModel.$viewValue);
243+
elem.attr('aria-checked', boolVal);
244+
elem.attr('tabindex', 0 - !boolVal);
245+
};
246+
} else {
247+
return function ngAriaRadioReaction(newVal) {
248+
elem.attr('aria-checked', (attr.value == ngModel.$viewValue));
249+
};
250+
}
251+
}
252+
253+
function ngAriaCheckboxReaction() {
254+
elem.attr('aria-checked', !ngModel.$isEmpty(ngModel.$viewValue));
255+
}
256+
257+
switch (shape) {
258+
case 'radio':
259+
case 'checkbox':
260+
if (shouldAttachRole(shape, elem)) {
261+
elem.attr('role', shape);
262+
}
263+
if (shouldAttachAttr('aria-checked', 'ariaChecked', elem)) {
264+
scope.$watch(ngAriaWatchModelValue, shape === 'radio' ?
265+
getRadioReaction() : ngAriaCheckboxReaction);
266+
}
267+
break;
268+
case 'range':
269+
if (shouldAttachRole(shape, elem)) {
270+
elem.attr('role', 'slider');
271+
}
272+
if ($aria.config('ariaValue')) {
273+
if (attr.min && !elem.attr('aria-valuemin')) {
274+
elem.attr('aria-valuemin', attr.min);
275+
}
276+
if (attr.max && !elem.attr('aria-valuemax')) {
277+
elem.attr('aria-valuemax', attr.max);
278+
}
279+
if (!elem.attr('aria-valuenow')) {
280+
scope.$watch(ngAriaWatchModelValue, function ngAriaValueNowReaction(newVal) {
281+
elem.attr('aria-valuenow', newVal);
282+
});
283+
}
284+
}
285+
break;
286+
case 'multiline':
287+
if (shouldAttachAttr('aria-multiline', 'ariaMultiline', elem)) {
288+
elem.attr('aria-multiline', true);
289+
}
290+
break;
291+
}
292+
293+
if (needsTabIndex) {
294+
elem.attr('tabindex', 0);
295+
}
296+
297+
if (ngModel.$validators.required && shouldAttachAttr('aria-required', 'ariaRequired', elem)) {
298+
scope.$watch(function ngAriaRequiredWatch() {
299+
return ngModel.$error.required;
300+
}, function ngAriaRequiredReaction(newVal) {
301+
elem.attr('aria-required', !!newVal);
302+
});
303+
}
304+
305+
if (shouldAttachAttr('aria-invalid', 'ariaInvalid', elem)) {
306+
scope.$watch(function ngAriaInvalidWatch() {
307+
return ngModel.$invalid;
308+
}, function ngAriaInvalidReaction(newVal) {
309+
elem.attr('aria-invalid', !!newVal);
310+
});
311+
}
312+
}
313+
};
314+
}
315+
};
316+
}])
317+
.directive('ngDisabled', ['$aria', function($aria) {
318+
return $aria.$$watchExpr('ngDisabled', 'aria-disabled');
319+
}])
320+
.directive('ngMessages', function() {
321+
return {
322+
restrict: 'A',
323+
require: '?ngMessages',
324+
link: function(scope, elem, attr, ngMessages) {
325+
if (!elem.attr('aria-live')) {
326+
elem.attr('aria-live', 'assertive');
327+
}
328+
}
329+
};
330+
})
331+
.directive('ngClick',['$aria', '$parse', function($aria, $parse) {
332+
return {
333+
restrict: 'A',
334+
compile: function(elem, attr) {
335+
var fn = $parse(attr.ngClick, /* interceptorFn */ null, /* expensiveChecks */ true);
336+
return function(scope, elem, attr) {
337+
338+
var nodeBlackList = ['BUTTON', 'A', 'INPUT', 'TEXTAREA'];
339+
340+
function isNodeOneOf(elem, nodeTypeArray) {
341+
if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) {
342+
return true;
343+
}
344+
}
345+
if (!elem.attr('role') && !isNodeOneOf(elem, nodeBlackList)) {
346+
elem.attr('role', 'button');
347+
}
348+
349+
if ($aria.config('tabindex') && !elem.attr('tabindex')) {
350+
elem.attr('tabindex', 0);
351+
}
352+
353+
if ($aria.config('bindKeypress') && !attr.ngKeypress && !isNodeOneOf(elem, nodeBlackList)) {
354+
elem.on('keypress', function(event) {
355+
if (event.keyCode === 32 || event.keyCode === 13) {
356+
scope.$apply(callback);
357+
}
358+
359+
function callback() {
360+
fn(scope, { $event: event });
361+
}
362+
});
363+
}
364+
};
365+
}
366+
};
367+
}])
368+
.directive('ngDblclick', ['$aria', function($aria) {
369+
return function(scope, elem, attr) {
370+
if ($aria.config('tabindex') && !elem.attr('tabindex')) {
371+
elem.attr('tabindex', 0);
372+
}
373+
};
374+
}]);
375+
376+
377+
})(window, window.angular);

1.4.0-rc.0/angular-aria.min.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)