<commit_before>/**
 * The OverlayContext Utility
 *
 * @module aui-overlay
 * @submodule aui-overlay-context
 */

var L = A.Lang,
	isString = L.isString,
	isNumber = L.isNumber,
	isObject = L.isObject,
	isBoolean = L.isBoolean,

	isNodeList = function(v) {
		return (v instanceof A.NodeList);
	},

	ALIGN = 'align',
	BL = 'bl',
	BOUNDING_BOX = 'boundingBox',
	CANCELLABLE_HIDE = 'cancellableHide',
	OVERLAY_CONTEXT = 'overlaycontext',
	CURRENT_NODE = 'currentNode',
	FOCUSED = 'focused',
	HIDE = 'hide',
	HIDE_DELAY = 'hideDelay',
	HIDE_ON = 'hideOn',
	HIDE_ON_DOCUMENT_CLICK = 'hideOnDocumentClick',
	MOUSEDOWN = 'mousedown',
	SHOW = 'show',
	SHOW_DELAY = 'showDelay',
	SHOW_ON = 'showOn',
	TL = 'tl',
	TRIGGER = 'trigger',
	VISIBLE = 'visible';

/**
 * <p><img src="assets/images/aui-overlay-context/main.png"/></p>
 *
 * A base class for OverlayContext, providing:
 * <ul>
 *    <li>Widget Lifecycle (initializer, renderUI, bindUI, syncUI, destructor)</li>
 *    <li>Able to display an <a href="Overlay.html">Overlay</a> at a specified corner of an element <a href="OverlayContext.html#config_trigger">trigger</a></li>
 * </ul>
 *
 * Quick Example:<br/>
 *
 * <pre><code>var instance = new A.OverlayContext({
 *  boundingBox: '#OverlayBoundingBox',
 *  hideOn: 'mouseleave',
 *  showOn: 'mouseenter',
 *	trigger: '.menu-trigger'
 * }).render();
 * </code></pre>
 *
 * Check the list of <a href="OverlayContext.html#configattributes">Configuration Attributes</a> available for
 * OverlayContext.
 *
 * @class OverlayContext
 * @constructor
 * @extends OverlayBase
 * @param config {Object} Object literal specifying widget configuration properties.
 */
function OverlayContext(config) {
	var instance = this;

	instance._hideTask = new A.DelayedTask(instance.hide, instance);
	instance._showTask = new A.DelayedTask(instance.show, instance);

	instance._showCallback = null;
	instance._hideCallback = null;

 	OverlayContext.superclass.constructor.apply(this, arguments);
}

A.mix(OverlayContext, {
	/**
	 * Static property provides a string to identify the class.
	 *
	 * @property OverlayContext.NAME
	 * @type String
	 * @static
	 */
	NAME: OVERLAY_CONTEXT,

	/**
	 * Static property used to define the default attribute
	 * configuration for the OverlayContext.
	 *
	 * @property OverlayContext.ATTRS
	 * @type Object
	 * @static
	 */
	ATTRS: {
		/**
		 * Inherited from <a href="Overlay.html#config_align">Overlay</a>.
		 *
		 * @attribute align
		 * @default { node: null, points: [ TL, BL ] }
		 * @type Object
		 */
		align: {
            value: { node: null, points: [ TL, BL ] }
        },

		/**
		 * Cancel auto hide delay if the user interact with the Overlay
         * (focus, click, mouseover)
		 *
		 * @attribute cancellableHide
		 * @default true
		 * @type boolean
		 */
		cancellableHide: {
			value: true,
			validator: isBoolean
		},

		/**
		 * OverlayContext allow multiple elements to be the
         * <a href="OverlayContext.html#config_trigger">trigger</a>, the
         * currentNode stores the current active one.
		 *
		 * @attribute currentNode
		 * @default First item of the
         * <a href="OverlayContext.html#config_trigger">trigger</a> NodeList.
		 * @type Node
		 */
		currentNode: {
			valueFn: function() {
				// define default currentNode as the first item from trigger
				return this.get(TRIGGER).item(0);
			}
		},

		delay: {
			value: null,
			validator: isObject
		},

		/**
		 * The event which is responsible to hide the OverlayContext.
		 *
		 * @attribute hideOn
		 * @default mouseout
		 * @type String
		 */
		hideOn: {
			lazyAdd: false,
			value: 'mouseout',
			validator: isString,
			setter: function(v) {
				return this._setHideOn(v);
			}
		},

		/**
		 * If true the instance is registered on the
         * <a href="OverlayContextManager.html">OverlayContextManager</a> static
         * class and will be hide when the user click on document.
		 *
		 * @attribute hideOnDocumentClick
		 * @default true
		 * @type boolean
		 */
		hideOnDocumentClick: {
			lazyAdd: false,
			setter: function(v) {
				return this._setHideOnDocumentClick(v);
			},
			value: true,
			validator: isBoolean
		},

		/**
		 * Number of milliseconds after the hide method is invoked to hide the
         * OverlayContext.
		 *
		 * @attribute hideDelay
		 * @default 0
		 * @type Number
		 */
		hideDelay: {
			value: 0
		},

		/**
		 * The event which is responsible to show the OverlayContext.
		 *
		 * @attribute showOn
		 * @default mouseover
		 * @type String
		 */
		showOn: {
			lazyAdd: false,
			value: 'mouseover',
			validator: isString,
			setter: function(v) {
				return this._setShowOn(v);
			}
		},

		/**
		 * Number of milliseconds after the show method is invoked to show the
         * OverlayContext.
		 *
		 * @attribute showDelay
		 * @default 0
		 * @type Number
		 */
		showDelay: {
			value: 0,
			validator: isNumber
		},<commit_msg>AUI-32 - Allow mutliple events to be passed into OverlayContext<commit_after>/**
 * The OverlayContext Utility
 *
 * @module aui-overlay
 * @submodule aui-overlay-context
 */

var L = A.Lang,
	isString = L.isString,
	isNumber = L.isNumber,
	isObject = L.isObject,
	isBoolean = L.isBoolean,

	isNodeList = function(v) {
		return (v instanceof A.NodeList);
	},

	ALIGN = 'align',
	BL = 'bl',
	BOUNDING_BOX = 'boundingBox',
	CANCELLABLE_HIDE = 'cancellableHide',
	OVERLAY_CONTEXT = 'overlaycontext',
	CURRENT_NODE = 'currentNode',
	FOCUSED = 'focused',
	HIDE = 'hide',
	HIDE_DELAY = 'hideDelay',
	HIDE_ON = 'hideOn',
	HIDE_ON_DOCUMENT_CLICK = 'hideOnDocumentClick',
	MOUSEDOWN = 'mousedown',
	SHOW = 'show',
	SHOW_DELAY = 'showDelay',
	SHOW_ON = 'showOn',
	TL = 'tl',
	TRIGGER = 'trigger',
	VISIBLE = 'visible';

/**
 * <p><img src="assets/images/aui-overlay-context/main.png"/></p>
 *
 * A base class for OverlayContext, providing:
 * <ul>
 *    <li>Widget Lifecycle (initializer, renderUI, bindUI, syncUI, destructor)</li>
 *    <li>Able to display an <a href="Overlay.html">Overlay</a> at a specified corner of an element <a href="OverlayContext.html#config_trigger">trigger</a></li>
 * </ul>
 *
 * Quick Example:<br/>
 *
 * <pre><code>var instance = new A.OverlayContext({
 *  boundingBox: '#OverlayBoundingBox',
 *  hideOn: 'mouseleave',
 *  showOn: 'mouseenter',
 *	trigger: '.menu-trigger'
 * }).render();
 * </code></pre>
 *
 * Check the list of <a href="OverlayContext.html#configattributes">Configuration Attributes</a> available for
 * OverlayContext.
 *
 * @class OverlayContext
 * @constructor
 * @extends OverlayBase
 * @param config {Object} Object literal specifying widget configuration properties.
 */
function OverlayContext(config) {
	var instance = this;

	instance._hideTask = new A.DelayedTask(instance.hide, instance);
	instance._showTask = new A.DelayedTask(instance.show, instance);

	instance._showCallback = null;
	instance._hideCallback = null;

 	OverlayContext.superclass.constructor.apply(this, arguments);
}

A.mix(OverlayContext, {
	/**
	 * Static property provides a string to identify the class.
	 *
	 * @property OverlayContext.NAME
	 * @type String
	 * @static
	 */
	NAME: OVERLAY_CONTEXT,

	/**
	 * Static property used to define the default attribute
	 * configuration for the OverlayContext.
	 *
	 * @property OverlayContext.ATTRS
	 * @type Object
	 * @static
	 */
	ATTRS: {
		/**
		 * Inherited from <a href="Overlay.html#config_align">Overlay</a>.
		 *
		 * @attribute align
		 * @default { node: null, points: [ TL, BL ] }
		 * @type Object
		 */
		align: {
            value: { node: null, points: [ TL, BL ] }
        },

		/**
		 * Cancel auto hide delay if the user interact with the Overlay
         * (focus, click, mouseover)
		 *
		 * @attribute cancellableHide
		 * @default true
		 * @type boolean
		 */
		cancellableHide: {
			value: true,
			validator: isBoolean
		},

		/**
		 * OverlayContext allow multiple elements to be the
         * <a href="OverlayContext.html#config_trigger">trigger</a>, the
         * currentNode stores the current active one.
		 *
		 * @attribute currentNode
		 * @default First item of the
         * <a href="OverlayContext.html#config_trigger">trigger</a> NodeList.
		 * @type Node
		 */
		currentNode: {
			valueFn: function() {
				// define default currentNode as the first item from trigger
				return this.get(TRIGGER).item(0);
			}
		},

		delay: {
			value: null,
			validator: isObject
		},

		/**
		 * The event which is responsible to hide the OverlayContext.
		 *
		 * @attribute hideOn
		 * @default mouseout
		 * @type String
		 */
		hideOn: {
			lazyAdd: false,
			value: 'mouseout',
			setter: function(v) {
				return this._setHideOn(v);
			}
		},

		/**
		 * If true the instance is registered on the
         * <a href="OverlayContextManager.html">OverlayContextManager</a> static
         * class and will be hide when the user click on document.
		 *
		 * @attribute hideOnDocumentClick
		 * @default true
		 * @type boolean
		 */
		hideOnDocumentClick: {
			lazyAdd: false,
			setter: function(v) {
				return this._setHideOnDocumentClick(v);
			},
			value: true,
			validator: isBoolean
		},

		/**
		 * Number of milliseconds after the hide method is invoked to hide the
         * OverlayContext.
		 *
		 * @attribute hideDelay
		 * @default 0
		 * @type Number
		 */
		hideDelay: {
			value: 0
		},

		/**
		 * The event which is responsible to show the OverlayContext.
		 *
		 * @attribute showOn
		 * @default mouseover
		 * @type String
		 */
		showOn: {
			lazyAdd: false,
			value: 'mouseover',
			setter: function(v) {
				return this._setShowOn(v);
			}
		},

		/**
		 * Number of milliseconds after the show method is invoked to show the
         * OverlayContext.
		 *
		 * @attribute showDelay
		 * @default 0
		 * @type Number
		 */
		showDelay: {
			value: 0,
			validator: isNumber
		},
{'fraction_non_alphanumeric': 0.1274949083503055, 'fraction_numerical': 0.0012219959266802445, 'mean_word_length': 3.109205020920502, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7138186', 'n_tokens_mistral': 3534, 'n_tokens_neox': 3122, 'n_words': 838}