@atlassian/aui
Version:
Atlassian User Interface Framework
32 lines • 11.4 kB
JavaScript
/*!!
* @atlassian/aui - Atlassian User Interface Framework
* @version v8.0.0-alpha.1
* @link https://aui.atlassian.com
* @license SEE LICENSE IN LICENSE.md
* @author Atlassian Pty Ltd.
*/
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=292)}({289:
/*!*****************************************!*\
!*** ../src/js/jquery/jquery.moveto.js ***!
\*****************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){"use strict";jQuery.fn.moveTo=function(e){var t,r=jQuery.extend({transition:!1,scrollOffset:35},e),n=this,o=n.offset().top;if((jQuery(window).scrollTop()+jQuery(window).height()-this.outerHeight()<o||jQuery(window).scrollTop()+r.scrollOffset>o)&&jQuery(window).height()>r.scrollOffset){if(t=jQuery(window).scrollTop()+r.scrollOffset>o?o-(jQuery(window).height()-this.outerHeight())+r.scrollOffset:o-r.scrollOffset,!jQuery.fn.moveTo.animating&&r.transition)return jQuery(document).trigger("moveToStarted",this),jQuery.fn.moveTo.animating=!0,jQuery("html,body").animate({scrollTop:t},1e3,function(){jQuery(document).trigger("moveToFinished",n),delete jQuery.fn.moveTo.animating}),this;var i=jQuery("html, body");return i.is(":animated")&&(i.stop(),delete jQuery.fn.moveTo.animating),jQuery(document).trigger("moveToStarted"),jQuery(window).scrollTop(t),setTimeout(function(){jQuery(document).trigger("moveToFinished",n)},100),this}return jQuery(document).trigger("moveToFinished",this),this}},290:
/*!******************************************!*\
!*** ../src/js/jquery/jquery.hotkeys.js ***!
\******************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){"use strict";!function(e){function t(e){this.num=0,this.timer=e>0&&e}function r(r){if(e.isPlainObject(r.data)||e.isArray(r.data)||"string"==typeof r.data){var o,i=r.handler,u={timer:700,combo:[]};"string"==typeof(o=r.data)?u.combo=[o]:e.isArray(o)?u.combo=o:e.extend(u,o),u.combo=e.map(u.combo,function(e){return e.toLowerCase()}),r.index=new t(u.timer),r.handler=function(t){if(this===t.target||!/textarea|select|input/i.test(t.target.nodeName)&&"true"!==e(t.target).prop("contenteditable")){var o="keypress"!==t.type?e.hotkeys.specialKeys[t.which]:null,a=String.fromCharCode(t.which).toLowerCase(),s="",f={};t.altKey&&"alt"!==o&&(s+="alt+"),t.ctrlKey&&"ctrl"!==o&&(s+="ctrl+"),t.metaKey&&!t.ctrlKey&&"meta"!==o&&(s+="meta+"),t.shiftKey&&"shift"!==o&&(s+="shift+"),t.metaKey&&"["===a&&(a=null),o&&(f[s+o]=!0),a&&(f[s+a]=!0),/shift+/.test(s)&&(f[s.replace("shift+","")+e.hotkeys.shiftNums[o||a]]=!0);var c=r.index,l=u.combo;if(n(l[c.val()],f)){if(c.val()===l.length-1)return c.reset(),i.apply(this,arguments);c.inc()}else c.reset(),n(l[0],f)&&c.inc()}}}}function n(e,t){for(var r=e.split(" "),n=0,o=r.length;n<o;n++)if(t[r[n]])return!0;return!1}e.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",91:"meta",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",188:",",190:".",191:"/",224:"meta",219:"[",221:"]"},keypressKeys:["<",">","?"],shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"}},e.each(e.hotkeys.keypressKeys,function(t,r){e.hotkeys.shiftNums[r]=r}),t.prototype.val=function(){return this.num},t.prototype.inc=function(){this.timer&&(clearTimeout(this.timeout),this.timeout=setTimeout(e.proxy(t.prototype.reset,this),this.timer)),this.num++},t.prototype.reset=function(){this.timer&&clearTimeout(this.timeout),this.num=0},e.each(["keydown","keyup","keypress"],function(){e.event.special[this]={add:r}})}(jQuery)},291:
/*!************************************!*\
!*** ../src/js/aui/when-i-type.js ***!
\************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=f(r(/*! ./jquery */0));r(/*! ../jquery/jquery.hotkeys */290),r(/*! ../jquery/jquery.moveto */289);var o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(/*! ./internal/log */6)),i=r(/*! ./dialog */80),u=f(r(/*! ./internal/globalize */1)),a=f(r(/*! ./key-code */8)),s=f(r(/*! underscore */15));function f(e){return e&&e.__esModule?e:{default:e}}var c=-1!==navigator.platform.indexOf("Mac"),l=-1!==navigator.userAgent.indexOf("Safari"),d=/^(backspace|tab|r(ight|eturn)|s(hift|pace|croll)|c(trl|apslock)|alt|pa(use|ge(up|down))|e(sc|nd)|home|left|up|d(el|own)|insert|f\d\d?|numlock|meta)/i,h=function(e){var t=e[0];if(t){var r;r=new MouseEvent("click",{bubbles:!0,cancelable:!0}),t.dispatchEvent(r)}};function p(e){var t=[],r=n.default.Callbacks();function o(e){!i.popup.current&&r&&r.fire(e)}function u(e){e.preventDefault()}function a(e){(e&&e.split?n.default.trim(e).split(" "):[e]).forEach(function(e){!function(e){var r=e instanceof Array?e:function(e){var t=[],r="";for(;e.length;){var n=e.match(/^(ctrl|meta|shift|alt)\+/i),o=e.match(d);n?(r+=n[0],e=e.substring(n[0].length)):o?(t.push(r+o[0]),e=e.substring(o[0].length),r=""):(t.push(r+e[0]),e=e.substring(1),r="")}return t}(e.toString()),i=function(e){var t=e.length;for(;t--;)if(e[t].length>1&&"space"!==e[t])return!0;return!1}(r)?"keydown":"keypress";t.push(r),(0,n.default)(document).bind(i,r,o),(0,n.default)(document).bind(i+" keyup",r,u)}(e)})}function f(e,t,r){return r?t+=" ("+AJS.I18n.getText("aui.keyboard.shortcut.type.x",e.shift()):(t=t.replace(/\)$/,""),t+=AJS.I18n.getText("aui.keyboard.shortcut.or.x",e.shift())),e.forEach(function(e){t+=" "+AJS.I18n.getText("aui.keyboard.shortcut.then.x",e)}),t+=")"}return a(e),p.makeShortcut({executor:r,bindKeys:a,addShortcutsToTitle:function(e){for(var r=(0,n.default)(e),o=r.attr("title")||"",i=t.slice(),u=r.data("boundKeyCombos")||[],a=r.data("kbShortcutAppended")||"",l=!a,d=l?o:o.substring(0,o.length-a.length);i.length;){var h=i.shift();u.some(function(e){return s.default.isEqual(h,e)})||(a=f(h.slice(),a,l),l=!1)}c&&(a=a.replace(/Meta/gi,"⌘").replace(/Shift/gi,"⇧")),r.attr("title",d+a),r.data("kbShortcutAppended",a),r.data("boundKeyCombos",u.concat(t))},removeShortcutsFromTitle:function(e){var t=(0,n.default)(e),r=t.data("kbShortcutAppended");if(r){var o=t.attr("title");t.attr("title",o.replace(r,"")),t.removeData("kbShortcutAppended"),t.removeData("boundKeyCombos")}},keypressHandler:o,defaultPreventionHandler:u})}p.makeShortcut=function(e){var t=e.executor,r=e.bindKeys,o=e.addShortcutsToTitle,i=e.removeShortcutsFromTitle,u=e.keypressHandler,s=e.defaultPreventionHandler,f=[];function c(e){return function(r,o){var i=(o=o||{}).focusedClass||"focused",u=!o.hasOwnProperty("wrapAround")||o.wrapAround,s=!o.hasOwnProperty("escToCancel")||o.escToCancel;return t.add(function(){var t=(0,n.default)(r),o=t.filter("."+i),f=0===o.length?void 0:{transition:!0};s&&(0,n.default)(document).one("keydown",function(e){e.keyCode===a.default.ESCAPE&&o&&o.removeClass(i)}),o.length&&o.removeClass(i),(o=e(o,t,u))&&o.length>0&&(o.addClass(i),o.moveTo(f),o.is("a")?o.focus():o.find("a:first").focus())}),this}}return{moveToNextItem:c(function(e,t,r){var o;return r&&0===e.length?t.eq(0):(o=n.default.inArray(e.get(0),t))<t.length-1?(o+=1,t.eq(o)):r?t.eq(0):e}),moveToPrevItem:c(function(e,t,r){var o;return r&&0===e.length?t.filter(":last"):(o=n.default.inArray(e.get(0),t))>0?(o-=1,t.eq(o)):r?t.filter(":last"):e}),click:function(e){return f.push(e),o(e),t.add(function(){var t=(0,n.default)(e);h(t)}),this},goTo:function(e){return t.add(function(){window.location.href=e}),this},followLink:function(e){return f.push(e),o(e),t.add(function(){var t=(0,n.default)(e)[0];t&&{a:!0,link:!0}[t.nodeName.toLowerCase()]&&(window.location.href=t.href)}),this},execute:function(e){var r=this;return t.add(function(){e.apply(r,arguments)}),this},evaluate:function(e){e.call(this)},moveToAndClick:function(e){return f.push(e),o(e),t.add(function(){var t=(0,n.default)(e);t.length>0&&(h(t),t.moveTo())}),this},moveToAndFocus:function(e){return f.push(e),o(e),t.add(function(t){var r=(0,n.default)(e);r.length>0&&(r.focus(),r.moveTo&&r.moveTo(),r.is(":input")&&t.preventDefault())}),this},or:function(e){return r(e),this},unbind:function(){(0,n.default)(document).unbind("keydown keypress",u).unbind("keydown keypress keyup",s);for(var e=0,t=f.length;e<t;e++)i(f[e]);f=[]}}},p.fromJSON=function(e,t){var r=[];return e&&n.default.each(e,function(e,i){var u=i.op,a=i.param,s=void 0;if("execute"===u||"evaluate"===u)s=[new Function(a)];else if(/^\[[^\]\[]*,[^\]\[]*\]$/.test(a)){try{s=JSON.parse(a)}catch(e){o.error("When using a parameter array, array must be in strict JSON format: "+a)}n.default.isArray(s)||o.error("Badly formatted shortcut parameter. String or JSON Array of parameters required: "+a)}else s=[a];n.default.each(i.keys,function(){var e=this;t&&c&&(e=n.default.map(e,function(e){return e.replace(/ctrl/i,"meta")}));var o=p(e);o[u].apply(o,s),r.push(o)})}),r},(0,n.default)(document).bind("iframeAppended",function(e,t){(0,n.default)(t).load(function(){(0,n.default)(t).contents().bind("keyup keydown keypress",function(e){l&&"keypress"===e.type||(0,n.default)(e.target).is(":input")||n.default.event.trigger(e,arguments,document,!0)})})}),(0,u.default)("whenIType",p),t.default=p,e.exports=t.default},292:
/*!********************************************************!*\
!*** ./behaviours/aui.behaviour.keyboard-shortcuts.js ***!
\********************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(/*! @atlassian/aui/src/js/aui/when-i-type */291);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})})}});