@atlassian/aui 10.1.4 → 10.1.6

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlassian/aui",
3
3
  "description": "Atlassian User Interface library",
4
- "version": "10.1.4",
4
+ "version": "10.1.6",
5
5
  "author": "Atlassian Pty Ltd.",
6
6
  "homepage": "https://aui.atlassian.com",
7
7
  "license": "Apache-2.0",
@@ -21,15 +21,7 @@ const makePopup = ({ horizontalAlignment, datePickerUUID }) => {
21
21
  return popup;
22
22
  };
23
23
 
24
- const makeConfig = ({
25
- minDate,
26
- maxDate,
27
- dateFormat,
28
- $field,
29
- onSelect,
30
- hide,
31
- onChangeMonthYear,
32
- }) => ({
24
+ const makeConfig = ({ minDate, maxDate, dateFormat, $field, onSelect, hide }) => ({
33
25
  dateFormat,
34
26
  defaultDate: $field.val(),
35
27
  maxDate: maxDate || $field.attr('max'),
@@ -42,7 +34,6 @@ const makeConfig = ({
42
34
  // TODO make sure the docs are explicit about the fact that onSelect cannot be an arrow function
43
35
  onSelect && onSelect.call(this, dateText);
44
36
  },
45
- onChangeMonthYear,
46
37
  prevText: '<',
47
38
  });
48
39
 
@@ -146,11 +137,6 @@ const makeDefaultPopupController = ($field, datePickerUUID) => {
146
137
  popup.get(0).open = false;
147
138
  };
148
139
 
149
- const handleChangeMonthYear = () => {
150
- // defer refresh call until current stack has cleared (after month has rendered)
151
- setTimeout(popup.refresh, 0);
152
- };
153
-
154
140
  const getCalendarNode = () => popup.get(0).childNodes[0];
155
141
 
156
142
  const destroyPolyfill = () => {
@@ -170,7 +156,6 @@ const makeDefaultPopupController = ($field, datePickerUUID) => {
170
156
  handleFieldFocus,
171
157
  showDatePicker,
172
158
  hideDatePicker,
173
- handleChangeMonthYear,
174
159
  getCalendarNode,
175
160
  destroyPolyfill,
176
161
  createPolyfill,
@@ -189,7 +174,6 @@ const initPolyfill = function (datePicker) {
189
174
  handleFieldFocus,
190
175
  showDatePicker,
191
176
  hideDatePicker,
192
- handleChangeMonthYear,
193
177
  getCalendarNode,
194
178
  destroyPolyfill,
195
179
  createPolyfill,
@@ -301,7 +285,6 @@ const initPolyfill = function (datePicker) {
301
285
  $field,
302
286
  onSelect: options.onSelect,
303
287
  hide: datePicker.hide,
304
- onChangeMonthYear: handleChangeMonthYear,
305
288
  });
306
289
  const config = $.extend(undefined, baseConfig, i18nConfig);
307
290
 
@@ -488,7 +488,7 @@ the specific language governing permissions and limitations under the Apache Lic
488
488
  data = { results: tmp };
489
489
  }
490
490
 
491
- if (data !== 'function') {
491
+ if (typeof data !== 'function') {
492
492
  tmp = data;
493
493
  data = function() { return tmp; };
494
494
  }
@@ -497,7 +497,7 @@ the specific language governing permissions and limitations under the Apache Lic
497
497
  if (dataItem.text) {
498
498
  text = dataItem.text;
499
499
  // if text is not a function we assume it to be a key name
500
- if (text !== 'function') {
500
+ if (typeof text !== 'function') {
501
501
  dataText = dataItem.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available
502
502
  text = function (item) { return item[dataText]; };
503
503
  }
@@ -2824,7 +2824,7 @@ the specific language governing permissions and limitations under the Apache Lic
2824
2824
  }
2825
2825
  return is_match;
2826
2826
  },
2827
- callback: callback !== 'function' ? $.noop : function() {
2827
+ callback: typeof callback !== 'function' ? $.noop : function() {
2828
2828
  // reorder matches based on the order they appear in the ids array because right now
2829
2829
  // they are in the order in which they appear in data array
2830
2830
  var ordered = [];
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2014 Gonzalo Casas
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,54 +0,0 @@
1
- # jquery-aop
2
-
3
- Add features of aspect-oriented programming (AOP) to jQuery.
4
-
5
- ## Introduction
6
-
7
- jQuery AOP is a very small plugin that adds [AOP](http://en.wikipedia.org/wiki/Aspect-oriented_programming) features to javascript. It allows to add [advices](http://en.wikipedia.org/wiki/Advice_in_aspect-oriented_programming) (_Before_, _After_, _After Throw_, _After Finally_, _Around_ and _Introduction_) to any global or instance object.
8
-
9
- ## Features
10
-
11
- * Allows to add _Before_, _After_, _After Throw_, _After Finally_, _Around_ and _Introduction_ advices.
12
- * Allows to define point-cuts using regex to match multiple methods.
13
- * Works with global function and object methods.
14
- * Advices can be removed after being applied.
15
- * **Just 1091 bytes!** (Packed and Gzipped)
16
- * Integrated into jQuery.
17
-
18
- ## Quick Start
19
-
20
- Starting with jQuery AOP is really easy!
21
-
22
- ```
23
-
24
- jQuery.aop.before( {target: String, method: 'replace'},
25
- function(regex, newString) {
26
- alert("About to replace string '" + this + "' with '" + newString + "' using regEx '" + regex + "'");
27
- }
28
- );
29
-
30
- ```
31
-
32
- More samples on [Reference](Reference.md)...
33
-
34
- ### What is new on 1.3?
35
-
36
- The latest release of jQuery AOP includes:
37
- * Support **after throw** and **after finally** advices
38
- * some bug fixes
39
-
40
- No breaking changes from 1.2.
41
-
42
- ### What is new on 1.2?
43
-
44
- This is a bug fix release, solving some minor issues reported. No breaking changes from 1.1.
45
-
46
- ### What is new on 1.1?
47
-
48
- The latest release of jQuery AOP includes two new features:
49
- * Support for **introductions**
50
- * and support for **regex matching** of method names!
51
-
52
- The new regex matching support breaks compatibility with the previous version because now the weaving methods return an array of functions instead of just one function.
53
-
54
- But don't worry! You can revert to the old behavior if you need to: more details on [BackwardsCompatibility](BackwardsCompatibility.md)!
@@ -1,395 +0,0 @@
1
- /**
2
- * jQuery AOP - jQuery plugin to add features of aspect-oriented programming (AOP) to jQuery.
3
- * https://github.com/gonzalocasas/jquery-aop
4
- *
5
- * Licensed under the MIT license:
6
- * http://www.opensource.org/licenses/mit-license.php
7
- *
8
- * Version: 1.3
9
- *
10
- * Cross-frame type detection based on Daniel Steigerwald's code (http://daniel.steigerwald.cz)
11
- * http://gist.github.com/204554
12
- *
13
- * Modified by Atlassian (workaround for IE6/7 removed)
14
- */
15
-
16
- (function() {
17
-
18
- var _after = 1;
19
- var _afterThrow = 2;
20
- var _afterFinally = 3;
21
- var _before = 4;
22
- var _around = 5;
23
- var _intro = 6;
24
- var _regexEnabled = true;
25
- var _arguments = 'arguments';
26
- var _undef = 'undefined';
27
-
28
- var getType = (function() {
29
-
30
- var toString = Object.prototype.toString,
31
- toStrings = {},
32
- nodeTypes = { 1: 'element', 3: 'textnode', 9: 'document', 11: 'fragment' },
33
- types = 'Arguments Array Boolean Date Document Element Error Fragment Function NodeList Null Number Object RegExp String TextNode Undefined Window'.split(' ');
34
-
35
- for (var i = types.length; i--; ) {
36
- var type = types[i], constructor = window[type];
37
- if (constructor) {
38
- try { toStrings[toString.call(new constructor)] = type.toLowerCase(); }
39
- catch (e) { }
40
- }
41
- }
42
-
43
- return function(item) {
44
- return item == null && (item === undefined ? _undef : 'null') ||
45
- item.nodeType && nodeTypes[item.nodeType] ||
46
- typeof item.length == 'number' && (
47
- item.callee && _arguments ||
48
- item.alert && 'window' ||
49
- item.item && 'nodelist') ||
50
- toStrings[toString.call(item)];
51
- };
52
-
53
- })();
54
-
55
- var isFunc = function(obj) { return getType(obj) == 'function'; };
56
-
57
- /**
58
- * Private weaving function.
59
- */
60
- var weaveOne = function(source, method, advice) {
61
-
62
- var old = source[method];
63
-
64
- // IE6/7 behavior on some native method return object instances instead of functions
65
- // and may cause the issue https://github.com/gonzalocasas/jquery-aop/issues/7.
66
- // Workaround was removed as it uses eval. See: http://ecosystem.atlassian.net/browse/AUI-4391
67
-
68
- var aspect;
69
- if (advice.type == _after || advice.type == _afterThrow || advice.type == _afterFinally)
70
- aspect = function() {
71
- var returnValue, exceptionThrown = null;
72
-
73
- try {
74
- returnValue = old.apply(this, arguments);
75
- } catch (e) {
76
- exceptionThrown = e;
77
- }
78
-
79
- if (advice.type == _after)
80
- if (exceptionThrown == null)
81
- returnValue = advice.value.apply(this, [returnValue, method]);
82
- else
83
- throw exceptionThrown;
84
- else if (advice.type == _afterThrow && exceptionThrown != null)
85
- returnValue = advice.value.apply(this, [exceptionThrown, method]);
86
- else if (advice.type == _afterFinally)
87
- returnValue = advice.value.apply(this, [returnValue, exceptionThrown, method]);
88
-
89
- return returnValue;
90
- };
91
- else if (advice.type == _before)
92
- aspect = function() {
93
- advice.value.apply(this, [arguments, method]);
94
- return old.apply(this, arguments);
95
- };
96
- else if (advice.type == _intro)
97
- aspect = function() {
98
- return advice.value.apply(this, arguments);
99
- };
100
- else if (advice.type == _around) {
101
- aspect = function() {
102
- var invocation = { object: this, args: Array.prototype.slice.call(arguments) };
103
- return advice.value.apply(invocation.object, [{ arguments: invocation.args, method: method, proceed :
104
- function() {
105
- return old.apply(invocation.object, invocation.args);
106
- }
107
- }] );
108
- };
109
- }
110
-
111
- aspect.unweave = function() {
112
- source[method] = old;
113
- pointcut = source = aspect = old = null;
114
- };
115
-
116
- source[method] = aspect;
117
-
118
- return aspect;
119
-
120
- };
121
-
122
- /**
123
- * Private method search
124
- */
125
- var search = function(source, pointcut, advice) {
126
-
127
- var methods = [];
128
-
129
- for (var method in source) {
130
-
131
- var item = null;
132
-
133
- // Ignore exceptions during method retrival
134
- try {
135
- item = source[method];
136
- }
137
- catch (e) { }
138
-
139
- if (item != null && method.match(pointcut.method) && isFunc(item))
140
- methods[methods.length] = { source: source, method: method, advice: advice };
141
-
142
- }
143
-
144
- return methods;
145
- };
146
-
147
- /**
148
- * Private weaver and pointcut parser.
149
- */
150
- var weave = function(pointcut, advice) {
151
-
152
- var source = typeof(pointcut.target.prototype) != _undef ? pointcut.target.prototype : pointcut.target;
153
- var advices = [];
154
-
155
- // If it's not an introduction and no method was found, try with regex...
156
- if (advice.type != _intro && typeof(source[pointcut.method]) == _undef) {
157
-
158
- // First try directly on target
159
- var methods = search(pointcut.target, pointcut, advice);
160
-
161
- // No method found, re-try directly on prototype
162
- if (methods.length == 0)
163
- methods = search(source, pointcut, advice);
164
-
165
- for (var i in methods)
166
- advices[advices.length] = weaveOne(methods[i].source, methods[i].method, methods[i].advice);
167
-
168
- }
169
- else
170
- {
171
- // Return as an array of one element
172
- advices[0] = weaveOne(source, pointcut.method, advice);
173
- }
174
-
175
- return _regexEnabled ? advices : advices[0];
176
-
177
- };
178
-
179
- jQuery.aop =
180
- {
181
- /**
182
- * Creates an advice after the defined point-cut. The advice will be executed after the point-cut method
183
- * has completed execution successfully, and will receive one parameter with the result of the execution.
184
- * This function returns an array of weaved aspects (Function).
185
- *
186
- * @example jQuery.aop.after( {target: window, method: 'MyGlobalMethod'}, function(result) {
187
- * alert('Returned: ' + result);
188
- * return result;
189
- * } );
190
- * @result Array<Function>
191
- *
192
- * @example jQuery.aop.after( {target: String, method: 'indexOf'}, function(index) {
193
- * alert('Result found at: ' + index + ' on:' + this);
194
- * return index;
195
- * } );
196
- * @result Array<Function>
197
- *
198
- * @name after
199
- * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
200
- * @option Object target Target object to be weaved.
201
- * @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
202
- * @param Function advice Function containing the code that will get called after the execution of the point-cut. It receives one parameter
203
- * with the result of the point-cut's execution. The function can choose to return this same value or a different one.
204
- *
205
- * @type Array<Function>
206
- * @cat Plugins/General
207
- */
208
- after : function(pointcut, advice)
209
- {
210
- return weave( pointcut, { type: _after, value: advice } );
211
- },
212
-
213
- /**
214
- * Creates an advice after the defined point-cut only for unhandled exceptions. The advice will be executed
215
- * after the point-cut method only if the execution failed and an exception has been thrown. It will receive one
216
- * parameter with the exception thrown by the point-cut method.
217
- * This function returns an array of weaved aspects (Function).
218
- *
219
- * @example jQuery.aop.afterThrow( {target: String, method: 'indexOf'}, function(exception) {
220
- * alert('Unhandled exception: ' + exception);
221
- * return -1;
222
- * } );
223
- * @result Array<Function>
224
- *
225
- * @example jQuery.aop.afterThrow( {target: calculator, method: 'Calculate'}, function(exception) {
226
- * console.log('Unhandled exception: ' + exception);
227
- * throw exception;
228
- * } );
229
- * @result Array<Function>
230
- *
231
- * @name afterThrow
232
- * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
233
- * @option Object target Target object to be weaved.
234
- * @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
235
- * @param Function advice Function containing the code that will get called after the execution of the point-cut. It receives one parameter
236
- * with the exception thrown by the point-cut method.
237
- *
238
- * @type Array<Function>
239
- * @cat Plugins/General
240
- */
241
- afterThrow : function(pointcut, advice)
242
- {
243
- return weave( pointcut, { type: _afterThrow, value: advice } );
244
- },
245
-
246
- /**
247
- * Creates an advice after the defined point-cut. The advice will be executed after the point-cut method
248
- * regardless of its success or failure, and it will receive two parameters: one with the
249
- * result of a successful execution or null, and another one with the exception thrown or null.
250
- * This function returns an array of weaved aspects (Function).
251
- *
252
- * @example jQuery.aop.afterFinally( {target: window, method: 'MyGlobalMethod'}, function(result, exception) {
253
- * if (exception == null)
254
- * return 'Returned: ' + result;
255
- * else
256
- * return 'Unhandled exception: ' + exception;
257
- * } );
258
- * @result Array<Function>
259
- *
260
- * @name afterFinally
261
- * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
262
- * @option Object target Target object to be weaved.
263
- * @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
264
- * @param Function advice Function containing the code that will get called after the execution of the point-cut regardless of its success or failure.
265
- * It receives two parameters, the first one with the result of a successful execution or null, and the second one with the
266
- * exception or null.
267
- *
268
- * @type Array<Function>
269
- * @cat Plugins/General
270
- */
271
- afterFinally : function(pointcut, advice)
272
- {
273
- return weave( pointcut, { type: _afterFinally, value: advice } );
274
- },
275
-
276
-
277
- /**
278
- * Creates an advice before the defined point-cut. The advice will be executed before the point-cut method
279
- * but cannot modify the behavior of the method, or prevent its execution.
280
- * This function returns an array of weaved aspects (Function).
281
- *
282
- * @example jQuery.aop.before( {target: window, method: 'MyGlobalMethod'}, function() {
283
- * alert('About to execute MyGlobalMethod');
284
- * } );
285
- * @result Array<Function>
286
- *
287
- * @example jQuery.aop.before( {target: String, method: 'indexOf'}, function(index) {
288
- * alert('About to execute String.indexOf on: ' + this);
289
- * } );
290
- * @result Array<Function>
291
- *
292
- * @name before
293
- * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
294
- * @option Object target Target object to be weaved.
295
- * @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
296
- * @param Function advice Function containing the code that will get called before the execution of the point-cut.
297
- *
298
- * @type Array<Function>
299
- * @cat Plugins/General
300
- */
301
- before : function(pointcut, advice)
302
- {
303
- return weave( pointcut, { type: _before, value: advice } );
304
- },
305
-
306
-
307
- /**
308
- * Creates an advice 'around' the defined point-cut. This type of advice can control the point-cut method execution by calling
309
- * the functions '.proceed()' on the 'invocation' object, and also, can modify the arguments collection before sending them to the function call.
310
- * This function returns an array of weaved aspects (Function).
311
- *
312
- * @example jQuery.aop.around( {target: window, method: 'MyGlobalMethod'}, function(invocation) {
313
- * alert('# of Arguments: ' + invocation.arguments.length);
314
- * return invocation.proceed();
315
- * } );
316
- * @result Array<Function>
317
- *
318
- * @example jQuery.aop.around( {target: String, method: 'indexOf'}, function(invocation) {
319
- * alert('Searching: ' + invocation.arguments[0] + ' on: ' + this);
320
- * return invocation.proceed();
321
- * } );
322
- * @result Array<Function>
323
- *
324
- * @example jQuery.aop.around( {target: window, method: /Get(\d+)/}, function(invocation) {
325
- * alert('Executing ' + invocation.method);
326
- * return invocation.proceed();
327
- * } );
328
- * @desc Matches all global methods starting with 'Get' and followed by a number.
329
- * @result Array<Function>
330
- *
331
- *
332
- * @name around
333
- * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
334
- * @option Object target Target object to be weaved.
335
- * @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
336
- * @param Function advice Function containing the code that will get called around the execution of the point-cut. This advice will be called with one
337
- * argument containing one function '.proceed()', the collection of arguments '.arguments', and the matched method name '.method'.
338
- *
339
- * @type Array<Function>
340
- * @cat Plugins/General
341
- */
342
- around : function(pointcut, advice)
343
- {
344
- return weave( pointcut, { type: _around, value: advice } );
345
- },
346
-
347
- /**
348
- * Creates an introduction on the defined point-cut. This type of advice replaces any existing methods with the same
349
- * name. To restore them, just unweave it.
350
- * This function returns an array with only one weaved aspect (Function).
351
- *
352
- * @example jQuery.aop.introduction( {target: window, method: 'MyGlobalMethod'}, function(result) {
353
- * alert('Returned: ' + result);
354
- * } );
355
- * @result Array<Function>
356
- *
357
- * @example jQuery.aop.introduction( {target: String, method: 'log'}, function() {
358
- * alert('Console: ' + this);
359
- * } );
360
- * @result Array<Function>
361
- *
362
- * @name introduction
363
- * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
364
- * @option Object target Target object to be weaved.
365
- * @option String method Name of the function to be weaved.
366
- * @param Function advice Function containing the code that will be executed on the point-cut.
367
- *
368
- * @type Array<Function>
369
- * @cat Plugins/General
370
- */
371
- introduction : function(pointcut, advice)
372
- {
373
- return weave( pointcut, { type: _intro, value: advice } );
374
- },
375
-
376
- /**
377
- * Configures global options.
378
- *
379
- * @name setup
380
- * @param Map settings Configuration options.
381
- * @option Boolean regexMatch Enables/disables regex matching of method names.
382
- *
383
- * @example jQuery.aop.setup( { regexMatch: false } );
384
- * @desc Disable regex matching.
385
- *
386
- * @type Void
387
- * @cat Plugins/General
388
- */
389
- setup: function(settings)
390
- {
391
- _regexEnabled = settings.regexMatch;
392
- }
393
- };
394
-
395
- })();
@@ -1,5 +0,0 @@
1
- jQuery AOP plugin v1.3
2
- https://github.com/gonzalocasas/jquery-aop
3
-
4
- Licensed under the MIT license:
5
- http://www.opensource.org/licenses/mit-license.php
@@ -1,16 +0,0 @@
1
- {
2
- "name": "jquery-aop",
3
- "version": "1.3.0",
4
- "description": "Add features of aspect-oriented programming (AOP) to jQuery.",
5
- "main": "aop.js",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/gonzalocasas/jquery-aop.git"
9
- },
10
- "author": "Gonzalo Casas <gonzalocasas@gmail.com>",
11
- "license": "MIT",
12
- "bugs": {
13
- "url": "https://github.com/gonzalocasas/jquery-aop/issues"
14
- },
15
- "homepage": "https://github.com/gonzalocasas/jquery-aop"
16
- }