<commit_before>/**
    _moon.Drawer_, a control designed for use with [moon.Drawers](#moon.Drawers),
    consists of two drawers and a [moon.DrawerHandle](#moon.DrawerHandle).
    The main drawer is populated with any child components that are specified in
    the constructor; the optional second drawer (_controlDrawer_) is populated
    with components passed into the _controlDrawerComponents_ property.

    If the second drawer has no components, the main drawer will take up the full
    height of the containing view; otherwise, its height will be equal to the
    height of the containing view minus the height of the _controlDrawerComponents_.

    A call to _toggleDrawer()_ will open the _controlDrawer_ if
    _controlDrawerComponents_ is non-empty; otherwise, it will open the main
    drawer.

    The control's child components may be of any kind.

        {
            name: "musicDrawer",
            kind: "moon.Drawer",
            handle: {kind: "moon.DrawerHandle", content: "Handle"},
            components: [
                {content: "Drawer Content"}
            ],
            controlDrawerComponents: [
                {content: "Controls"}
            ]
        }
*/
enyo.kind({
	name: "moon.Drawer",
	kind:"enyo.Control",
	//* @protected
	classes: "moon-drawer moon-neutral",
	//* @public
	published: {
		//* Components that are to be placed in the control drawer
		controlDrawerComponents: null,
		//* Typically set to an instance of _moon.DrawerHandle_
		handle: null,
		//* Visibility state of the main drawer
		open: false,
		//* Visibility state of the control drawer
		controlsOpen: false
	},
	events: {
		//* Fires when either the main drawer or the control drawer is activated.
		onActivate: "",
		//* Fires when either the main drawer or the control drawer is deactivated.
		onDeactivate: ""
	},
	//* @protected
	handlers: {
		//* Handler for initial rendering event
		onDrawersRendered: "drawersRendered",
		//* Handler for initial resizing event to size drawers to full screen
		onDrawersResized: "drawersResized"
	},
	components: [
		{name: "client", kind: "moon.FullScreenDrawer", resizeContainer:false},
		{name: "controlDrawer", kind: "enyo.Drawer", resizeContainer:false}
	],
	create: function() {
		this.inherited(arguments);
		this.$.controlDrawer.createComponents(this.controlDrawerComponents, {owner:this.owner});
		//* Todo: remove padding on client
		this.$.client.$.client.addClass('moon-drawer-client');
		this.$.controlDrawer.$.client.addClass('moon-drawer-partial-client');
	},
	drawersRendered: function(inSender, inEvent) {
		this.$.client.setDrawerProps({height: this.calcDrawerHeight(inEvent.drawersHeight)});
		this.openChanged();
		if (!this.controlsOpen) {
			this.$.controlDrawer.setAnimated(false);
			this.$.controlDrawer.setOpen(this.controlsOpen);
			this.$.controlDrawer.setAnimated(true);
		}
	},
	calcDrawerHeight: function(drawersHeight) {
		var clientHeight = drawersHeight;
		if (this.controlDrawerComponents == null) {
			return clientHeight;
		} else {
			this.controlDrawerHeight = (this.controlDrawerHeight) ? this.controlDrawerHeight : this.$.controlDrawer.hasNode().getBoundingClientRect().height
			return (clientHeight - this.controlDrawerHeight);
		}
	},
	toggleDrawer: function() {
		if (this.controlDrawerComponents == null) {
			this.setOpen(!this.open);
		} else {
			this.setControlsOpen(!this.controlsOpen);
		}
		return true;
	},
	openChanged: function() {
		this.$.client.setOpen(this.open);
		if (this.open) {
			this.doActivate();
			enyo.Spotlight.spot(this.$.client);
		} else {
			this.doDeactivate();
		}<commit_msg>GF-33990-latest code merged<commit_after>/**
    _moon.Drawer_, a control designed for use with [moon.Drawers](#moon.Drawers),
    consists of two drawers and a [moon.DrawerHandle](#moon.DrawerHandle).
    The main drawer is populated with any child components that are specified in
    the constructor; the optional second drawer (_controlDrawer_) is populated
    with components passed into the _controlDrawerComponents_ property.

    If the second drawer has no components, the main drawer will take up the full
    height of the containing view; otherwise, its height will be equal to the
    height of the containing view minus the height of the _controlDrawerComponents_.

    A call to _toggleDrawer()_ will open the _controlDrawer_ if
    _controlDrawerComponents_ is non-empty; otherwise, it will open the main
    drawer.

    The control's child components may be of any kind.

        {
            name: "musicDrawer",
            kind: "moon.Drawer",
            handle: {kind: "moon.DrawerHandle", content: "Handle"},
            components: [
                {content: "Drawer Content"}
            ],
            controlDrawerComponents: [
                {content: "Controls"}
            ]
        }
*/
enyo.kind({
	name: "moon.Drawer",
	kind:"enyo.Control",
	//* @protected
	classes: "moon-drawer moon-neutral",
	//* @public
	published: {
		//* Components that are to be placed in the control drawer
		controlDrawerComponents: null,
		//* Typically set to an instance of _moon.DrawerHandle_
		handle: null,
		//* Visibility state of the main drawer
		open: false,
		//* Visibility state of the control drawer
		controlsOpen: false
	},
	events: {
		//* Fires when either the main drawer or the control drawer is activated.
		onActivate: "",
		//* Fires when either the main drawer or the control drawer is deactivated.
		onDeactivate: ""
	},
	//* @protected
	handlers: {
		//* Handler for initial rendering event
		onDrawersRendered: "drawersRendered",
		//* Handler for initial resizing event to size drawers to full screen
		onDrawersResized: "drawersResized"
	},
	components: [
		{name: "client", kind: "moon.FullScreenDrawer", resizeContainer:false},
		{name: "controlDrawer", kind: "enyo.Drawer", resizeContainer:false}
	],
	create: function() {
		this.inherited(arguments);
		this.$.controlDrawer.createComponents(this.controlDrawerComponents, {owner:this.owner});
		//* Todo: remove padding on client
		this.$.client.$.client.addClass('moon-drawer-client');
		this.$.controlDrawer.$.client.addClass('moon-drawer-partial-client');
	},
	drawersRendered: function(inSender, inEvent) {
		this.$.client.setDrawerProps({height: this.calcDrawerHeight(inEvent.drawersHeight)});
		this.openChanged();
		if (!this.controlsOpen) {
			this.$.controlDrawer.setAnimated(false);
			this.$.controlDrawer.setOpen(this.controlsOpen);
			this.$.controlDrawer.setAnimated(true);
		}
	},
	calcDrawerHeight: function(drawersHeight) {
		var clientHeight = drawersHeight;
		if (this.controlDrawerComponents == null) {
			return clientHeight;
		} else {
			this.controlDrawerHeight = (this.controlDrawerHeight) ? this.controlDrawerHeight : this.$.controlDrawer.hasNode().getBoundingClientRect().height;
			return (clientHeight - this.controlDrawerHeight);
		}
	},
	toggleDrawer: function() {
		if (this.controlDrawerComponents == null) {
			this.setOpen(!this.open);
		} else {
			this.setControlsOpen(!this.controlsOpen);
		}
		return true;
	},
	openChanged: function() {
		this.$.client.setOpen(this.open);
		if (this.open) {
			this.doActivate();
			enyo.Spotlight.spot(this.$.client);
		} else {
			this.doDeactivate();
		}
{'fraction_non_alphanumeric': 0.11497584541062802, 'fraction_numerical': 0.0006901311249137336, 'mean_word_length': 3.6006349206349206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1152424', 'n_tokens_mistral': 2350, 'n_tokens_neox': 2185, 'n_words': 592}