<commit_before>/*
---

name: Bar

description: Provides a control that displays a bar.

license: MIT-style license.

authors:
	- <NAME> (<EMAIL>)

requires:
	- Control

provides:
	- Bar

...
*/

/**
 * @see    http://moobilejs.com/doc/latest/Control/Bar
 * @author <NAME> (<EMAIL>)
 * @edited 0.2.0
 * @since  0.1.0
 */
Moobile.Bar = new Class({

	Extends: Moobile.Control,

	/**
	 * @see    http://moobilejs.com/doc/latest/View/View#contentElement
	 * @author <NAME> (<EMAIL>)
	 * @since  0.2.0
	 */
	contentElement: null,

	/**
	 * @overridden
	 * @author <NAME> (<EMAIL>)
	 * @since  0.1.0
	 */
	willBuild: function() {

		this.parent();

		this.addClass('bar');

		var content = this.getRoleElement('content');
		if (content === null) {
			content = document.createElement('div');
			content.ingest(this.element);
			content.inject(this.element);
			content.setRole('content');
		}
	},

	/**
	 * @overridden
	 * @author <NAME> (<EMAIL>)
	 * @since  0.1.0
	 */
	destroy: function() {
		this._item = null;
		this.contentElement = null;
		this.parent();
	},

	// <0.2-compat>

	/**
	 * @deprecated
	 * @author <NAME> (<EMAIL>)
	 * @since  0.1.0
	 */
	setItem: function(item) {

		console.log('[DEPRECATION NOTICE] The method "setItem" will be removed in 0.5, all the methods from the "BarItem" class were moved to "Bar" class');

		if (this._item === item)
			return this;

		if (this._item) {
			this._item.replaceWithComponent(item, true);
		} else {
			this.addChildComponentInside(item, this.contentElement);
		}

		this._item = item;
		this._item.addClass('bar-item');

		return this;
	},

	/**
	 * @deprecated
	 * @author <NAME> (<EMAIL>)
	 * @since  0.1.0
	 */
	getItem: function() {
		console.log('[DEPRECATION NOTICE] The method "getItem" will be removed in 0.5, all the methods from the "BarItem" class were moved to "Bar" class');
		return this._item;
	}

	// </0.2-compat>

});

//------------------------------------------------------------------------------
// Roles
//------------------------------------------------------------------------------

/**
 * @author <NAME> (<EMAIL>)
 * @since  0.1.0
 */
Moobile.Component.defineRole('bar', null, null, function(element) {
	this.addChildComponent(Moobile.Component.create(Moobile.Bar, element, 'data-bar'));
});

/**
 * @author <NAME> (<EMAIL>)
 * @since  0.3.0
 */
Moobile.Component.defineRole('content', Moobile.Bar, {traversable: true}, function(element) {
	this.contentElement = element;
	this.contentElement.addClass('bar-content');
});

//------------------------------------------------------------------------------
// Styles
//------------------------------------------------------------------------------

/* Dark Style - iOS - Android */
Moobile.Component.defineStyle('dark', Moobile.Bar, {
	attach: function(element) { element.addClass('style-dark'); },
	detach: function(element) { element.removeClass('style-dark'); }
});

/* Light Style - iOS - Android */
Moobile.Component.defineStyle('light', Moobile.Bar, {
	attach: function(element) { element.addClass('style-light'); },
	detach: function(element) { element.removeClass('style-light'); }
});
<commit_msg>Making sure components added to the bar will go into the content element<commit_after>/*
---

name: Bar

description: Provides a control that displays a bar.

license: MIT-style license.

authors:
	- <NAME> (<EMAIL>)

requires:
	- Control

provides:
	- Bar

...
*/

/**
 * @see    http://moobilejs.com/doc/latest/Control/Bar
 * @author <NAME> (<EMAIL>)
 * @edited 0.2.0
 * @since  0.1.0
 */
Moobile.Bar = new Class({

	Extends: Moobile.Control,

	/**
	 * @see    http://moobilejs.com/doc/latest/View/View#contentElement
	 * @author <NAME> (<EMAIL>)
	 * @since  0.2.0
	 */
	contentElement: null,

	/**
	 * @overridden
	 * @author <NAME> (<EMAIL>)
	 * @since  0.1.0
	 */
	willBuild: function() {

		this.parent();

		this.addClass('bar');

		var content = this.getRoleElement('content');
		if (content === null) {
			content = document.createElement('div');
			content.ingest(this.element);
			content.inject(this.element);
			content.setRole('content');
		}
	},

	/**
	 * @overridden
	 * @author <NAME> (<EMAIL>)
	 * @since  0.1.0
	 */
	destroy: function() {
		this._item = null;
		this.contentElement = null;
		this.parent();
	},

	/**
	 * @overridden
	 * @author <NAME> (<EMAIL>)
	 * @since  0.3.0
	 */
	addChildComponent: function(component, where) {
		return this.addChildComponentInside(component, this.contentElement, where);
	},

	// <0.2-compat>

	/**
	 * @deprecated
	 * @author <NAME> (<EMAIL>)
	 * @since  0.1.0
	 */
	setItem: function(item) {

		console.log('[DEPRECATION NOTICE] The method "setItem" will be removed in 0.5, all the methods from the "BarItem" class were moved to "Bar" class');

		if (this._item === item)
			return this;

		if (this._item) {
			this._item.replaceWithComponent(item, true);
		} else {
			this.addChildComponentInside(item, this.contentElement);
		}

		this._item = item;
		this._item.addClass('bar-item');

		return this;
	},

	/**
	 * @deprecated
	 * @author <NAME> (<EMAIL>)
	 * @since  0.1.0
	 */
	getItem: function() {
		console.log('[DEPRECATION NOTICE] The method "getItem" will be removed in 0.5, all the methods from the "BarItem" class were moved to "Bar" class');
		return this._item;
	}

	// </0.2-compat>

});

//------------------------------------------------------------------------------
// Roles
//------------------------------------------------------------------------------

/**
 * @author <NAME> (<EMAIL>)
 * @since  0.1.0
 */
Moobile.Component.defineRole('bar', null, null, function(element) {
	this.addChildComponent(Moobile.Component.create(Moobile.Bar, element, 'data-bar'));
});

/**
 * @author <NAME> (<EMAIL>)
 * @since  0.3.0
 */
Moobile.Component.defineRole('content', Moobile.Bar, {traversable: true}, function(element) {
	this.contentElement = element;
	this.contentElement.addClass('bar-content');
});

//------------------------------------------------------------------------------
// Styles
//------------------------------------------------------------------------------

/* Dark Style - iOS - Android */
Moobile.Component.defineStyle('dark', Moobile.Bar, {
	attach: function(element) { element.addClass('style-dark'); },
	detach: function(element) { element.removeClass('style-dark'); }
});

/* Light Style - iOS - Android */
Moobile.Component.defineStyle('light', Moobile.Bar, {
	attach: function(element) { element.addClass('style-light'); },
	detach: function(element) { element.removeClass('style-light'); }
});

{'fraction_non_alphanumeric': 0.26339149066421796, 'fraction_numerical': 0.011172329354147536, 'mean_word_length': 2.341002044989775, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, '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': '4853092', 'n_tokens_mistral': 2233, 'n_tokens_neox': 2067, 'n_words': 445}