material_raingular 0.0.7 → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license AngularJS v1.4.0
3
- * (c) 2010-2015 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.5.3
3
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window, angular, undefined) {'use strict';
@@ -19,21 +19,25 @@
19
19
  *
20
20
  * ## Usage
21
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`.
22
+ * For ngAria to do its magic, simply include the module `ngAria` as a dependency. The following
23
+ * directives are supported:
24
+ * `ngModel`, `ngChecked`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`, `ngClick`,
25
+ * `ngDblClick`, and `ngMessages`.
25
26
  *
26
27
  * Below is a more detailed breakdown of the attributes handled by ngAria:
27
28
  *
28
29
  * | Directive | Supported Attributes |
29
30
  * |---------------------------------------------|----------------------------------------------------------------------------------------|
31
+ * | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles |
30
32
  * | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled |
33
+ * | {@link ng.directive:ngRequired ngRequired} | aria-required |
34
+ * | {@link ng.directive:ngChecked ngChecked} | aria-checked |
35
+ * | {@link ng.directive:ngValue ngValue} | aria-checked |
31
36
  * | {@link ng.directive:ngShow ngShow} | aria-hidden |
32
37
  * | {@link ng.directive:ngHide ngHide} | aria-hidden |
33
38
  * | {@link ng.directive:ngDblclick ngDblclick} | tabindex |
34
39
  * | {@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 |
40
+ * | {@link ng.directive:ngClick ngClick} | tabindex, keypress event, button role |
37
41
  *
38
42
  * Find out more information about each directive by reading the
39
43
  * {@link guide/accessibility ngAria Developer Guide}.
@@ -57,6 +61,16 @@
57
61
  var ngAriaModule = angular.module('ngAria', ['ng']).
58
62
  provider('$aria', $AriaProvider);
59
63
 
64
+ /**
65
+ * Internal Utilities
66
+ */
67
+ var nodeBlackList = ['BUTTON', 'A', 'INPUT', 'TEXTAREA', 'SELECT', 'DETAILS', 'SUMMARY'];
68
+
69
+ var isNodeOneOf = function(elem, nodeTypeArray) {
70
+ if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) {
71
+ return true;
72
+ }
73
+ };
60
74
  /**
61
75
  * @ngdoc provider
62
76
  * @name $ariaProvider
@@ -85,10 +99,10 @@ function $AriaProvider() {
85
99
  ariaDisabled: true,
86
100
  ariaRequired: true,
87
101
  ariaInvalid: true,
88
- ariaMultiline: true,
89
102
  ariaValue: true,
90
103
  tabindex: true,
91
- bindKeypress: true
104
+ bindKeypress: true,
105
+ bindRoleForClick: true
92
106
  };
93
107
 
94
108
  /**
@@ -102,11 +116,12 @@ function $AriaProvider() {
102
116
  * - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags
103
117
  * - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags
104
118
  * - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags
105
- * - **ariaMultiline** – `{boolean}` – Enables/disables aria-multiline tags
106
119
  * - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and aria-valuenow tags
107
120
  * - **tabindex** – `{boolean}` – Enables/disables tabindex tags
108
- * - **bindKeypress** – `{boolean}` – Enables/disables keypress event binding on `<div>` and
109
- * `<li>` elements with ng-click
121
+ * - **bindKeypress** – `{boolean}` – Enables/disables keypress event binding on `div` and
122
+ * `li` elements with ng-click
123
+ * - **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements like `div`
124
+ * using ng-click, making them more accessible to users of assistive technologies
110
125
  *
111
126
  * @description
112
127
  * Enables/disables various ARIA attributes
@@ -115,20 +130,18 @@ function $AriaProvider() {
115
130
  config = angular.extend(config, newConfig);
116
131
  };
117
132
 
118
- function watchExpr(attrName, ariaAttr, negate) {
133
+ function watchExpr(attrName, ariaAttr, nodeBlackList, negate) {
119
134
  return function(scope, elem, attr) {
120
135
  var ariaCamelName = attr.$normalize(ariaAttr);
121
- if (config[ariaCamelName] && !attr[ariaCamelName]) {
136
+ if (config[ariaCamelName] && !isNodeOneOf(elem, nodeBlackList) && !attr[ariaCamelName]) {
122
137
  scope.$watch(attr[attrName], function(boolVal) {
123
- if (negate) {
124
- boolVal = !boolVal;
125
- }
138
+ // ensure boolean value
139
+ boolVal = negate ? !boolVal : !!boolVal;
126
140
  elem.attr(ariaAttr, boolVal);
127
141
  });
128
142
  }
129
143
  };
130
144
  }
131
-
132
145
  /**
133
146
  * @ngdoc service
134
147
  * @name $aria
@@ -145,15 +158,15 @@ function $AriaProvider() {
145
158
  *
146
159
  *```js
147
160
  * ngAriaModule.directive('ngDisabled', ['$aria', function($aria) {
148
- * return $aria.$$watchExpr('ngDisabled', 'aria-disabled');
161
+ * return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nodeBlackList, false);
149
162
  * }])
150
163
  *```
151
164
  * Shown above, the ngAria module creates a directive with the same signature as the
152
165
  * 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`.
166
+ * solely managing accessibility attributes on custom elements. The internal `$aria` service is
167
+ * used to watch the boolean attribute `ngDisabled`. If it has not been explicitly set by the
168
+ * developer, `aria-disabled` is injected as an attribute with its value synchronized to the
169
+ * value in `ngDisabled`.
157
170
  *
158
171
  * Because ngAria hooks into the `ng-disabled` directive, developers do not have to do
159
172
  * anything to enable this feature. The `aria-disabled` attribute is automatically managed
@@ -161,12 +174,15 @@ function $AriaProvider() {
161
174
  *
162
175
  * The full list of directives that interface with ngAria:
163
176
  * * **ngModel**
177
+ * * **ngChecked**
178
+ * * **ngRequired**
179
+ * * **ngDisabled**
180
+ * * **ngValue**
164
181
  * * **ngShow**
165
182
  * * **ngHide**
166
183
  * * **ngClick**
167
184
  * * **ngDblclick**
168
185
  * * **ngMessages**
169
- * * **ngDisabled**
170
186
  *
171
187
  * Read the {@link guide/accessibility ngAria Developer Guide} for a thorough explanation of each
172
188
  * directive.
@@ -187,18 +203,30 @@ function $AriaProvider() {
187
203
 
188
204
 
189
205
  ngAriaModule.directive('ngShow', ['$aria', function($aria) {
190
- return $aria.$$watchExpr('ngShow', 'aria-hidden', true);
206
+ return $aria.$$watchExpr('ngShow', 'aria-hidden', [], true);
191
207
  }])
192
208
  .directive('ngHide', ['$aria', function($aria) {
193
- return $aria.$$watchExpr('ngHide', 'aria-hidden', false);
209
+ return $aria.$$watchExpr('ngHide', 'aria-hidden', [], false);
210
+ }])
211
+ .directive('ngValue', ['$aria', function($aria) {
212
+ return $aria.$$watchExpr('ngValue', 'aria-checked', nodeBlackList, false);
213
+ }])
214
+ .directive('ngChecked', ['$aria', function($aria) {
215
+ return $aria.$$watchExpr('ngChecked', 'aria-checked', nodeBlackList, false);
216
+ }])
217
+ .directive('ngRequired', ['$aria', function($aria) {
218
+ return $aria.$$watchExpr('ngRequired', 'aria-required', nodeBlackList, false);
194
219
  }])
195
220
  .directive('ngModel', ['$aria', function($aria) {
196
221
 
197
- function shouldAttachAttr(attr, normalizedAttr, elem) {
198
- return $aria.config(normalizedAttr) && !elem.attr(attr);
222
+ function shouldAttachAttr(attr, normalizedAttr, elem, allowBlacklistEls) {
223
+ return $aria.config(normalizedAttr) && !elem.attr(attr) && (allowBlacklistEls || !isNodeOneOf(elem, nodeBlackList));
199
224
  }
200
225
 
201
226
  function shouldAttachRole(role, elem) {
227
+ // if element does not have role attribute
228
+ // AND element type is equal to role (if custom element has a type equaling shape) <-- remove?
229
+ // AND element is not INPUT
202
230
  return !elem.attr('role') && (elem.attr('type') === role) && (elem[0].nodeName !== 'INPUT');
203
231
  }
204
232
 
@@ -208,20 +236,19 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
208
236
 
209
237
  return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' :
210
238
  ((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' :
211
- (type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' :
212
- (type || role) === 'textbox' || elem[0].nodeName === 'TEXTAREA' ? 'multiline' : '';
239
+ (type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' : '';
213
240
  }
214
241
 
215
242
  return {
216
243
  restrict: 'A',
217
- require: '?ngModel',
244
+ require: 'ngModel',
218
245
  priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value
219
246
  compile: function(elem, attr) {
220
247
  var shape = getShape(attr, elem);
221
248
 
222
249
  return {
223
250
  pre: function(scope, elem, attr, ngModel) {
224
- if (shape === 'checkbox' && attr.type !== 'checkbox') {
251
+ if (shape === 'checkbox') {
225
252
  //Use the input[checkbox] $isEmpty implementation for elements with checkbox roles
226
253
  ngModel.$isEmpty = function(value) {
227
254
  return value === false;
@@ -229,28 +256,18 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
229
256
  }
230
257
  },
231
258
  post: function(scope, elem, attr, ngModel) {
232
- var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem);
259
+ var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem, false);
233
260
 
234
261
  function ngAriaWatchModelValue() {
235
262
  return ngModel.$modelValue;
236
263
  }
237
264
 
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
- }
265
+ function getRadioReaction(newVal) {
266
+ var boolVal = (attr.value == ngModel.$viewValue);
267
+ elem.attr('aria-checked', boolVal);
251
268
  }
252
269
 
253
- function ngAriaCheckboxReaction() {
270
+ function getCheckboxReaction() {
254
271
  elem.attr('aria-checked', !ngModel.$isEmpty(ngModel.$viewValue));
255
272
  }
256
273
 
@@ -260,9 +277,12 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
260
277
  if (shouldAttachRole(shape, elem)) {
261
278
  elem.attr('role', shape);
262
279
  }
263
- if (shouldAttachAttr('aria-checked', 'ariaChecked', elem)) {
280
+ if (shouldAttachAttr('aria-checked', 'ariaChecked', elem, false)) {
264
281
  scope.$watch(ngAriaWatchModelValue, shape === 'radio' ?
265
- getRadioReaction() : ngAriaCheckboxReaction);
282
+ getRadioReaction : getCheckboxReaction);
283
+ }
284
+ if (needsTabIndex) {
285
+ elem.attr('tabindex', 0);
266
286
  }
267
287
  break;
268
288
  case 'range':
@@ -270,39 +290,43 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
270
290
  elem.attr('role', 'slider');
271
291
  }
272
292
  if ($aria.config('ariaValue')) {
273
- if (attr.min && !elem.attr('aria-valuemin')) {
274
- elem.attr('aria-valuemin', attr.min);
293
+ var needsAriaValuemin = !elem.attr('aria-valuemin') &&
294
+ (attr.hasOwnProperty('min') || attr.hasOwnProperty('ngMin'));
295
+ var needsAriaValuemax = !elem.attr('aria-valuemax') &&
296
+ (attr.hasOwnProperty('max') || attr.hasOwnProperty('ngMax'));
297
+ var needsAriaValuenow = !elem.attr('aria-valuenow');
298
+
299
+ if (needsAriaValuemin) {
300
+ attr.$observe('min', function ngAriaValueMinReaction(newVal) {
301
+ elem.attr('aria-valuemin', newVal);
302
+ });
275
303
  }
276
- if (attr.max && !elem.attr('aria-valuemax')) {
277
- elem.attr('aria-valuemax', attr.max);
304
+ if (needsAriaValuemax) {
305
+ attr.$observe('max', function ngAriaValueMinReaction(newVal) {
306
+ elem.attr('aria-valuemax', newVal);
307
+ });
278
308
  }
279
- if (!elem.attr('aria-valuenow')) {
309
+ if (needsAriaValuenow) {
280
310
  scope.$watch(ngAriaWatchModelValue, function ngAriaValueNowReaction(newVal) {
281
311
  elem.attr('aria-valuenow', newVal);
282
312
  });
283
313
  }
284
314
  }
285
- break;
286
- case 'multiline':
287
- if (shouldAttachAttr('aria-multiline', 'ariaMultiline', elem)) {
288
- elem.attr('aria-multiline', true);
315
+ if (needsTabIndex) {
316
+ elem.attr('tabindex', 0);
289
317
  }
290
318
  break;
291
319
  }
292
320
 
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);
321
+ if (!attr.hasOwnProperty('ngRequired') && ngModel.$validators.required
322
+ && shouldAttachAttr('aria-required', 'ariaRequired', elem, false)) {
323
+ // ngModel.$error.required is undefined on custom controls
324
+ attr.$observe('required', function() {
325
+ elem.attr('aria-required', !!attr['required']);
302
326
  });
303
327
  }
304
328
 
305
- if (shouldAttachAttr('aria-invalid', 'ariaInvalid', elem)) {
329
+ if (shouldAttachAttr('aria-invalid', 'ariaInvalid', elem, true)) {
306
330
  scope.$watch(function ngAriaInvalidWatch() {
307
331
  return ngModel.$invalid;
308
332
  }, function ngAriaInvalidReaction(newVal) {
@@ -315,7 +339,7 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
315
339
  };
316
340
  }])
317
341
  .directive('ngDisabled', ['$aria', function($aria) {
318
- return $aria.$$watchExpr('ngDisabled', 'aria-disabled');
342
+ return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nodeBlackList, false);
319
343
  }])
320
344
  .directive('ngMessages', function() {
321
345
  return {
@@ -335,32 +359,28 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
335
359
  var fn = $parse(attr.ngClick, /* interceptorFn */ null, /* expensiveChecks */ true);
336
360
  return function(scope, elem, attr) {
337
361
 
338
- var nodeBlackList = ['BUTTON', 'A', 'INPUT', 'TEXTAREA'];
362
+ if (!isNodeOneOf(elem, nodeBlackList)) {
339
363
 
340
- function isNodeOneOf(elem, nodeTypeArray) {
341
- if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) {
342
- return true;
364
+ if ($aria.config('bindRoleForClick') && !elem.attr('role')) {
365
+ elem.attr('role', 'button');
343
366
  }
344
- }
345
- if (!elem.attr('role') && !isNodeOneOf(elem, nodeBlackList)) {
346
- elem.attr('role', 'button');
347
- }
348
367
 
349
- if ($aria.config('tabindex') && !elem.attr('tabindex')) {
350
- elem.attr('tabindex', 0);
351
- }
368
+ if ($aria.config('tabindex') && !elem.attr('tabindex')) {
369
+ elem.attr('tabindex', 0);
370
+ }
352
371
 
353
- if ($aria.config('bindKeypress') && !attr.ngKeypress && !isNodeOneOf(elem, nodeBlackList)) {
354
- elem.on('keypress', function(event) {
355
- var keyCode = event.which || event.keyCode;
356
- if (keyCode === 32 || keyCode === 13) {
357
- scope.$apply(callback);
358
- }
372
+ if ($aria.config('bindKeypress') && !attr.ngKeypress) {
373
+ elem.on('keypress', function(event) {
374
+ var keyCode = event.which || event.keyCode;
375
+ if (keyCode === 32 || keyCode === 13) {
376
+ scope.$apply(callback);
377
+ }
359
378
 
360
- function callback() {
361
- fn(scope, { $event: event });
362
- }
363
- });
379
+ function callback() {
380
+ fn(scope, { $event: event });
381
+ }
382
+ });
383
+ }
364
384
  }
365
385
  };
366
386
  }
@@ -368,7 +388,7 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
368
388
  }])
369
389
  .directive('ngDblclick', ['$aria', function($aria) {
370
390
  return function(scope, elem, attr) {
371
- if ($aria.config('tabindex') && !elem.attr('tabindex')) {
391
+ if ($aria.config('tabindex') && !elem.attr('tabindex') && !isNodeOneOf(elem, nodeBlackList)) {
372
392
  elem.attr('tabindex', 0);
373
393
  }
374
394
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license AngularJS v1.4.0
3
- * (c) 2010-2015 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.5.3
3
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window, angular, undefined) {'use strict';
@@ -17,8 +17,7 @@
17
17
  *
18
18
  * <div doc-module-components="ngCookies"></div>
19
19
  *
20
- * See {@link ngCookies.$cookies `$cookies`} and
21
- * {@link ngCookies.$cookieStore `$cookieStore`} for usage.
20
+ * See {@link ngCookies.$cookies `$cookies`} for usage.
22
21
  */
23
22
 
24
23
 
@@ -40,16 +39,17 @@ angular.module('ngCookies', ['ng']).
40
39
  * The object may have following properties:
41
40
  *
42
41
  * - **path** - `{string}` - The cookie will be available only for this path and its
43
- * sub-paths. By default, this would be the URL that appears in your base tag.
42
+ * sub-paths. By default, this is the URL that appears in your `<base>` tag.
44
43
  * - **domain** - `{string}` - The cookie will be available only for this domain and
45
- * its sub-domains. For obvious security reasons the user agent will not accept the
46
- * cookie if the current domain is not a sub domain or equals to the requested domain.
44
+ * its sub-domains. For security reasons the user agent will not accept the cookie
45
+ * if the current domain is not a sub-domain of this domain or equal to it.
47
46
  * - **expires** - `{string|Date}` - String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT"
48
47
  * or a Date object indicating the exact date/time this cookie will expire.
49
- * - **secure** - `{boolean}` - The cookie will be available only in secured connection.
48
+ * - **secure** - `{boolean}` - If `true`, then the cookie will only be available through a
49
+ * secured connection.
50
50
  *
51
- * Note: by default the address that appears in your <base> tag will be used as path.
52
- * This is import so that cookies will be visible for all routes in case html5mode is enabled
51
+ * Note: By default, the address that appears in your `<base>` tag will be used as the path.
52
+ * This is important so that cookies will be visible for all routes when html5mode is enabled.
53
53
  *
54
54
  **/
55
55
  var defaults = this.defaults = {};
@@ -65,9 +65,11 @@ angular.module('ngCookies', ['ng']).
65
65
  * @description
66
66
  * Provides read/write access to browser's cookies.
67
67
  *
68
- * BREAKING CHANGE: `$cookies` no longer exposes properties that represent the
69
- * current browser cookie values. Now you must use the get/put/remove/etc. methods
70
- * as described below.
68
+ * <div class="alert alert-info">
69
+ * Up until Angular 1.3, `$cookies` exposed properties that represented the
70
+ * current browser cookie values. In version 1.4, this behavior has changed, and
71
+ * `$cookies` now provides a standard api of getters, setters etc.
72
+ * </div>
71
73
  *
72
74
  * Requires the {@link ngCookies `ngCookies`} module to be installed.
73
75
  *
@@ -192,7 +194,7 @@ angular.module('ngCookies').
192
194
  * Requires the {@link ngCookies `ngCookies`} module to be installed.
193
195
  *
194
196
  * <div class="alert alert-danger">
195
- * **Note:** The $cookieStore service is deprecated.
197
+ * **Note:** The $cookieStore service is **deprecated**.
196
198
  * Please use the {@link ngCookies.$cookies `$cookies`} service instead.
197
199
  * </div>
198
200
  *
@@ -277,7 +279,7 @@ function $$CookieWriter($document, $log, $browser) {
277
279
  options = options || {};
278
280
  expires = options.expires;
279
281
  path = angular.isDefined(options.path) ? options.path : cookiePath;
280
- if (value === undefined) {
282
+ if (angular.isUndefined(value)) {
281
283
  expires = 'Thu, 01 Jan 1970 00:00:00 GMT';
282
284
  value = '';
283
285
  }