<commit_before>widget.assets = (function(){
  map = {};

  return {
    map: map,
    get: function get( context, key, defaultValue ) {
      return widget.get( map, context+'.'+key, defaultValue );
    }
  };
})();

widget.layout = (function(){

  var assets = widget.assets;
  var visionUID = 10000;

  function createUrlAction( linkUrl, windowMode ) {
    return function() {
      window.open( linkUrl, (windowMode||'_blank') );
    };
  }

  function createCooperativeFrame( parent, url, label ) {
    return function showCooperativeFrame() {
      var animationTime = 250;

      var holder = $( '<div/>' ).addClass( 'cooperativeFrameHolder' );
      var iframe = $( '<iframe/>', {
        scrolling:true,
        marginheight:0,
        marginwidth:0,
        frameBorder: 0,
        width: '100%',
        height: '100%',
        src: url
      } ).addClass( 'cooperativeFrame' ).appendTo( holder );

      var labelHolder = $( '.panelLabel' ).filter( ':visible' );
      label = label || $( '<div/>', { text: 'X'} ).addClass( 'button' );

      labelHolder.addClass( 'clickable' ).on( 'click', function() {
        holder.remove();
        label.hide( 'slide', {direction:'up'}, animationTime, function() {
          label.remove();
          $('#appHeader').toggleClass( 'sublabelActive', false );
        });
        parent.slideDown( animationTime );
      });

      labelHolder.append( label.hide() );
      label.show( 'slide', {direction:'up'}, animationTime );
      $('#appHeader').toggleClass( 'sublabelActive', true );

      parent.slideUp( animationTime, function() {
        holder.appendTo( parent.parent() );
      } );

    };
  }

  function asArray( obj )
  {
    switch( $.type( obj ) )
    {
      case 'array':
        return obj;

      case 'function':
        return $.isArray( obj() ) ? obj :  asArray( obj() );

      case 'object':
        var result = ko.observableArray();
        result.onKeyAdded = function( key ) {
          result.push( {
            key: key,
            value: obj[key]
          });
        };

        for( var key in obj )
          result.onKeyAdded( key );

        return result;

      default:
        return [ obj ];
    }
  }

  function loadDataSource( dataSource, baseContent, options )
  {
    var db = widget.util.getData( dataSource.type, window[dataSource.type]||{} );

    var path = widget.util.expandPath( dataSource.path );
    var sourceData = widget.get( db, path, {} );
    if( sourceData.content && $.isArray( sourceData.content ) )
      sourceData = sourceData.content;

    var data = asArray( sourceData||[] );

    if( options.sort )
    {
      data = applySort( options.sort, $.isFunction(data) ? data() : data );
    }

    return data;
  }

  function loadCss( cssFile )
  {
    return $.ajax({
      url: cssFile,
      success: function(data){
        $("head").append("<style>" + data + "</style>");
      }
    });
  }

  function doPreload( preload )
  {
    var addStyle = function( cssData ) {
      $("head").append("<style>" + cssData + "</style>");
    };

    if( ! $.isArray( preload ) )
      preload = [ preload ];

    var promises = [];
    for( var j in preload )
      promises.push( $.ajax({ url: preload[j], success: addStyle }) );

    return $.when.apply( this, promises );
  }

  function dispatch( parent, layout, options, defaultHandler, stack )
  {
    // If we have a preload list, then create and return a promise that honors
    // once all of the preloads are done.
    if( layout.preload )
    {
      return doPreload( layout.preload ).done( function onWidgetLoaded() {
        delete layout.preload;
        dispatch( parent, layout, options, defaultHandler, stack );
      } );
    }

    var w = {
      parent: parent,
      data: layout,
      layout: $.extend( {}, layout ),
      options: options || {},
      stack: []
    };

    // Make a shallow copy of the data stack, as it gets pushed and popped a
    // lot, and our downstream code may take a snapshot of things.
    stack = stack || widget.util.getStack();
    if( stack && stack.length )
    {
      for( var i=0; i<stack.length; i++ )
        w.stack.push( stack[i] );
    }
    else
      w.stack.push( layout );

    w.data = w.stack[0];

    function configureRenderer( w, options )
    {
      var typeKey = w.layout.rendererKey || w.layout.type;

      if( options && options.defaultRenderer )
      {
        w.layout.rendererKey = 'renderer';
        w.layout.dynamicRenderer = ( options.renderers && options.renderers[ typeKey ] ) ? options.renderers[ typeKey ] : options.defaultRenderer;
      }
      else if( options && options.renderer )
      {
        w.layout.rendererKey = 'renderer';
        w.layout.staticRenderer = options.renderer;
      }
      else
        w.layout.rendererKey = typeKey;
    }

    // Generate an options object by considering the layout's default values,
    // any options on the data object, and the parameter options (last one wins)
    w.options = $.extend( {}, self.defaults[w.layout.rendererKey]||{}, w.options||{}, w.layout.options||{} );
    var factory = w.options.factory;
    delete w.options.factory;

    lifecycle( 'load', w );

    if( w.layout.hasOwnProperty( 'dataSource' ) )
    {
      w.layout.content = loadDataSource( w.layout.dataSource, w.layout.content, w.options );
    }

    if( w.data )
      w.data._vuid = w.data._vuid||('vuid-'+(visionUID++));

    lifecycle( 'dataReady', w );
    configureRenderer( w, w.options.listOptions );

    if( factory && $.type( factory ) === 'string' )
      factory = widget.layout.registry[ factory ];

    var handler = factory || widget.layout.registry[w.layout.rendererKey] || defaultHandler;
    w.view = $.isFunction( handler ) ? handler( w ) : null;

    if( w.view )
    {
      if( w.data && w.data._vuid )
        w.view.addClass( w.data._vuid );

      if( w.options.styleClass )
      {
        w.options._styleClass = widget.util.expandPath( w.options.styleClass, w.data );
        w.view.addClass( w.options._styleClass );
      }

      if( w.options.tooltip )
      {
        w.options._tooltip = widget.util.expandPath( w.options.tooltip, w.data );
        w.view.attr( 'tooltip', w.options._tooltip );
      }

      w.view.on( 'widget-update', function onUpdate( event, context ) {
        if( $.isFunction( w.view.update ) )
          w.view.update( event, context );

        lifecycle( 'update', w, context );

        if( w.options.styleClass )
        {
          var oldStyle = w.options._styleClass;
          w.options._styleClass = widget.util.expandPath( w.options.styleClass, w.data );
          if( oldStyle != w.options._styleClass )
          {
            w.view.removeClass( oldStyle );
            w.view.addClass( w.options._styleClass );
          }
        }
      } );

      w.view.on( 'remove', function onRemoved() {
        lifecycle( 'cleanup', w );
      });
    }

    lifecycle( 'layout', w );

    if( w.view && w.options.events )
    {
      if( w.options.events.mouseenter || w.options.events.mouseleave )
      {
        w.view.addClass( 'widget-rollover' );
        w.view.on( 'mouseenter', function() { w.view.toggleClass( 'widget-rollover-on', true ); } );
        w.view.on( 'mouseleave', function() { w.view.toggleClass( 'widget-rollover-on', false ); } );
      }

      if( w.options.events.click )
        w.view.addClass( 'widget-clickable' );

      bindIf( 'mouseenter', w.view, w.options.events, w );
      bindIf( 'mouseleave', w.view, w.options.events, w );
      bindIf( 'mousemove', w.view, w.options.events, w );
      bindIf( 'click', w.view, w.options.events, w );
      bindIf( 'change', w.view, w.options.events, w );
      bindIf( 'fieldChange', w.view, w.options.events, w );
      bindIf( 'toggle', w.view, w.options.events, w );
      bindIf( 'enter', w.view, w.options.events, w );
      bindIf( 'selectmenuchange', w.view, w.options.events, w );
      bindIf( 'tabselected', w.view, w.options.events, w );
      bindIf( 'cleanup', w.view, w.options.events, w );
    }

    lifecycle( 'ready', w );

    if( w.view )
      w.view.trigger( 'widget-update', w );

    return w.view;
  }

  function callEvent( events, key, context, event )
  {
    if( events && events[key] && $.isFunction( events[key]) )
    {
      return events[key]( context, event );
    }
  }

  function bindIf( key, view, events, context )
  {
    if( events && events[key] )
      view.on( key, function( event ) { callEvent( events, key, context, event ); } );
  }

  function lifecycle( eventKey, w, data )
  {
    var event = {
      type: 'lifecycle.'+eventKey
    };
    if( data )
      event = $.extend( {}, data, event );

    return callEvent( w.options.events, eventKey, w, event );
  }

  function getTimestamp( article )
  {
    return article.post_date || article.lastModified;
  }

  var comparators = {
    'oldest' : function oldestComparator( a, b ) {
      return ( getTimestamp(a) - getTimestamp(b) );
    },
    'newest' : function newestComparator( a, b ) {
      return ( getTimestamp(b) - getTimestamp(a) );
    }
  };

  /**
   * Applies the given sort to the data.  If the data if an object, then the
   * keys will be lost in the conversion - the result is a simple
   * (non-associative) array
   **/
  function applySort( sortType, data )
  {
    if( data && $.isFunction( comparators[sortType] ) )
    {
      var a = [];
      for( var i in data ) {
        a.push( data[i] );
      }
      return a.sort( comparators[sortType] );
    }
    else
      return data;
  }

  var self = function layout( parent, data, options, stack ) {
    return dispatch( parent, data, self.getOptions( data.type, options ), self.registry.error, stack );
  };

  self.registry = {};
  self.defaults = {};
  self.documentation = {};
  self.register = function register( key, implementation, docs, defaults ) {
    self.registry[ key ] = implementation;
    self.defaults[ key ] = defaults||{};

    if( docs )
    {
      self.documentation[key] = ( $.type(docs)==='string' ) ? { description:docs } : docs;
    }

    return dispatch;
  };
  self.createCooperativeFrame = createCooperativeFrame;

  self.getOptions = function getOptions( type, values )
  {
    return $.extend( {}, self.defaults[type]||{}, values||{} );
  };

  return self;
})();
<commit_msg>whitespace<commit_after>widget.assets = (function(){
  map = {};

  return {
    map: map,
    get: function get( context, key, defaultValue ) {
      return widget.get( map, context+'.'+key, defaultValue );
    }
  };
})();

widget.layout = (function(){

  var assets = widget.assets;
  var visionUID = 10000;

  function createUrlAction( linkUrl, windowMode ) {
    return function() {
      window.open( linkUrl, (windowMode||'_blank') );
    };
  }

  function createCooperativeFrame( parent, url, label ) {
    return function showCooperativeFrame() {
      var animationTime = 250;

      var holder = $( '<div/>' ).addClass( 'cooperativeFrameHolder' );
      var iframe = $( '<iframe/>', {
        scrolling:true,
        marginheight:0,
        marginwidth:0,
        frameBorder: 0,
        width: '100%',
        height: '100%',
        src: url
      } ).addClass( 'cooperativeFrame' ).appendTo( holder );

      var labelHolder = $( '.panelLabel' ).filter( ':visible' );
      label = label || $( '<div/>', { text: 'X'} ).addClass( 'button' );

      labelHolder.addClass( 'clickable' ).on( 'click', function() {
        holder.remove();
        label.hide( 'slide', {direction:'up'}, animationTime, function() {
          label.remove();
          $('#appHeader').toggleClass( 'sublabelActive', false );
        });
        parent.slideDown( animationTime );
      });

      labelHolder.append( label.hide() );
      label.show( 'slide', {direction:'up'}, animationTime );
      $('#appHeader').toggleClass( 'sublabelActive', true );

      parent.slideUp( animationTime, function() {
        holder.appendTo( parent.parent() );
      } );

    };
  }

  function asArray( obj )
  {
    switch( $.type( obj ) )
    {
      case 'array':
        return obj;

      case 'function':
        return $.isArray( obj() ) ? obj :  asArray( obj() );

      case 'object':
        var result = ko.observableArray();
        result.onKeyAdded = function( key ) {
          result.push( {
            key: key,
            value: obj[key]
          });
        };

        for( var key in obj )
          result.onKeyAdded( key );

        return result;

      default:
        return [ obj ];
    }
  }

  function loadDataSource( dataSource, baseContent, options )
  {
    var db = widget.util.getData( dataSource.type, window[dataSource.type]||{} );

    var path = widget.util.expandPath( dataSource.path );
    var sourceData = widget.get( db, path, {} );
    if( sourceData.content && $.isArray( sourceData.content ) )
      sourceData = sourceData.content;

    var data = asArray( sourceData||[] );

    if( options.sort )
    {
      data = applySort( options.sort, $.isFunction(data) ? data() : data );
    }

    return data;
  }

  function loadCss( cssFile )
  {
    return $.ajax({
      url: cssFile,
      success: function(data){
        $("head").append("<style>" + data + "</style>");
      }
    });
  }

  function doPreload( preload )
  {
    var addStyle = function( cssData ) {
      $("head").append("<style>" + cssData + "</style>");
    };

    if( ! $.isArray( preload ) )
      preload = [ preload ];

    var promises = [];
    for( var j in preload )
      promises.push( $.ajax({ url: preload[j], success: addStyle }) );

    return $.when.apply( this, promises );
  }

  function dispatch( parent, layout, options, defaultHandler, stack )
  {
    // If we have a preload list, then create and return a promise that honors
    // once all of the preloads are done.
    if( layout.preload )
    {
      return doPreload( layout.preload ).done( function onWidgetLoaded() {
        delete layout.preload;
        dispatch( parent, layout, options, defaultHandler, stack );
      } );
    }

    var w = {
      parent: parent,
      data: layout,
      layout: $.extend( {}, layout ),
      options: options || {},
      stack: []
    };

    // Make a shallow copy of the data stack, as it gets pushed and popped a
    // lot, and our downstream code may take a snapshot of things.
    stack = stack || widget.util.getStack();
    if( stack && stack.length )
    {
      for( var i=0; i<stack.length; i++ )
        w.stack.push( stack[i] );
    }
    else
      w.stack.push( layout );

    w.data = w.stack[0];

    function configureRenderer( w, options )
    {
      var typeKey = w.layout.rendererKey || w.layout.type;

      if( options && options.defaultRenderer )
      {
        w.layout.rendererKey = 'renderer';
        w.layout.dynamicRenderer = ( options.renderers && options.renderers[ typeKey ] ) ? options.renderers[ typeKey ] : options.defaultRenderer;
      }
      else if( options && options.renderer )
      {
        w.layout.rendererKey = 'renderer';
        w.layout.staticRenderer = options.renderer;
      }
      else
        w.layout.rendererKey = typeKey;
    }

    // Generate an options object by considering the layout's default values,
    // any options on the data object, and the parameter options (last one wins)
    w.options = $.extend( {}, self.defaults[w.layout.rendererKey]||{}, w.options||{}, w.layout.options||{} );
    var factory = w.options.factory;
    delete w.options.factory;

    lifecycle( 'load', w );

    if( w.layout.hasOwnProperty( 'dataSource' ) )
    {
      w.layout.content = loadDataSource( w.layout.dataSource, w.layout.content, w.options );
    }

    if( w.data )
      w.data._vuid = w.data._vuid||('vuid-'+(visionUID++));

    lifecycle( 'dataReady', w );
    configureRenderer( w, w.options.listOptions );

    if( factory && $.type( factory ) === 'string' )
      factory = widget.layout.registry[ factory ];

    var handler = factory || widget.layout.registry[w.layout.rendererKey] || defaultHandler;
    w.view = $.isFunction( handler ) ? handler( w ) : null;

    if( w.view )
    {
      if( w.data && w.data._vuid )
        w.view.addClass( w.data._vuid );

      if( w.options.styleClass )
      {
        w.options._styleClass = widget.util.expandPath( w.options.styleClass, w.data );
        w.view.addClass( w.options._styleClass );
      }

      if( w.options.tooltip )
      {
        w.options._tooltip = widget.util.expandPath( w.options.tooltip, w.data );
        w.view.attr( 'tooltip', w.options._tooltip );
      }

      w.view.on( 'widget-update', function onUpdate( event, context ) {
        if( $.isFunction( w.view.update ) )
          w.view.update( event, context );

        lifecycle( 'update', w, context );

        if( w.options.styleClass )
        {
          var oldStyle = w.options._styleClass;
          w.options._styleClass = widget.util.expandPath( w.options.styleClass, w.data );
          if( oldStyle != w.options._styleClass )
          {
            w.view.removeClass( oldStyle );
            w.view.addClass( w.options._styleClass );
          }
        }
      } );

      w.view.on( 'remove', function onRemoved() {
        lifecycle( 'cleanup', w );
      });
    }

    lifecycle( 'layout', w );

    if( w.view && w.options.events )
    {
      if( w.options.events.mouseenter || w.options.events.mouseleave )
      {
        w.view.addClass( 'widget-rollover' );
        w.view.on( 'mouseenter', function() { w.view.toggleClass( 'widget-rollover-on', true ); } );
        w.view.on( 'mouseleave', function() { w.view.toggleClass( 'widget-rollover-on', false ); } );
      }

      if( w.options.events.click )
        w.view.addClass( 'widget-clickable' );

      bindIf( 'mouseenter', w.view, w.options.events, w );
      bindIf( 'mouseleave', w.view, w.options.events, w );
      bindIf( 'mousemove', w.view, w.options.events, w );
      bindIf( 'click', w.view, w.options.events, w );
      bindIf( 'change', w.view, w.options.events, w );
      bindIf( 'fieldChange', w.view, w.options.events, w );
      bindIf( 'toggle', w.view, w.options.events, w );
      bindIf( 'enter', w.view, w.options.events, w );
      bindIf( 'selectmenuchange', w.view, w.options.events, w );
      bindIf( 'tabselected', w.view, w.options.events, w );
      bindIf( 'cleanup', w.view, w.options.events, w );
    }

    lifecycle( 'ready', w );

    if( w.view )
      w.view.trigger( 'widget-update', w );

    return w.view;
  }

  function callEvent( events, key, context, event )
  {
    if( events && events[key] && $.isFunction( events[key]) )
    {
      return events[key]( context, event );
    }
  }

  function bindIf( key, view, events, context )
  {
    if( events && events[key] )
      view.on( key, function( event ) { callEvent( events, key, context, event ); } );
  }

  function lifecycle( eventKey, w, data )
  {
    var event = {
      type: 'lifecycle.'+eventKey
    };
    if( data )
      event = $.extend( {}, data, event );

    return callEvent( w.options.events, eventKey, w, event );
  }

  function getTimestamp( article )
  {
    return article.post_date || article.lastModified;
  }

  var comparators = {
    'oldest' : function oldestComparator( a, b ) {
      return ( getTimestamp(a) - getTimestamp(b) );
    },
    'newest' : function newestComparator( a, b ) {
      return ( getTimestamp(b) - getTimestamp(a) );
    }
  };

  /**
   * Applies the given sort to the data.  If the data if an object, then the
   * keys will be lost in the conversion - the result is a simple
   * (non-associative) array
   **/
  function applySort( sortType, data )
  {
    if( data && $.isFunction( comparators[sortType] ) )
    {
      var a = [];
      for( var i in data ) {
        a.push( data[i] );
      }
      return a.sort( comparators[sortType] );
    }
    else
      return data;
  }

  var self = function layout( parent, data, options, stack ) {
    return dispatch( parent, data, self.getOptions( data.type, options ), self.registry.error, stack );
  };

  self.registry = {};
  self.defaults = {};
  self.documentation = {};
  self.register = function register( key, implementation, docs, defaults ) {
    self.registry[ key ] = implementation;
    self.defaults[ key ] = defaults||{};

    if( docs )
    {
      self.documentation[key] = ( $.type(docs)==='string' ) ? { description:docs } : docs;
    }

    return dispatch;
  };
  self.createCooperativeFrame = createCooperativeFrame;

  self.getOptions = function getOptions( type, values )
  {
    return $.extend( {}, self.defaults[type]||{}, values||{} );
  };

  return self;
})();
<|endoftext|>


<commit_before>//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
//>>description: Responsive presentation and behavior for HTML data panels
//>>label: Panel
//>>group: Widgets
//>>css.structure: ../css/structure/jquery.mobile.panel.css
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css

define( [ "jquery", "../jquery.mobile.widget", "./page", "./page.sections" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {

$.widget( "mobile.panel", $.mobile.widget, {
	options: {
		classes: {
			panel: "ui-panel",
			contentWrap: "ui-panel-content-wrap"
		},
		theme: null,
		position: "left",
		dismissible: true,
		display: "reveal",
		initSelector: ":jqmData(role='panel')"
	},
	_handleLink: function( roleType , callback ){
		var elId = this.element.attr( "id" ),
			self = this;
		$( document ).on( "click" , "a", function( e ) {
			var $link = $( this ),
				id = $link.attr( "href" ).split( "#" )[1];
			if( elId === id ){
				e.preventDefault();
				callback.call( self , $link , id );
				return false;
			}
		});
	},
	_blockPage: function( options ){
		var deferred = $.Deferred();
		var $div = $( "
" ),
			$panel = this,
			slideDir = options.position === "left" ? "right" : "left",
			clickable = options.dismissible && options.display !== "push",
			klass = clickable ? "ui-panel-dismiss" : "ui-panel-no-dismiss";
		setTimeout(function(){
			if( $panel.element.hasClass( "ui-responsive" ) ){
				$div.addClass( "ui-responsive" );
			}
			$div.addClass( "ui-panel-dismiss-overlay" )
				.css( "height" , $.mobile.activePage.height() )
				.css( slideDir , 0 )
				.attr( "id" , "page-block" )
				.addClass( klass )
				.appendTo( $.mobile.activePage );
			if( clickable ){
				$div.bind( "vclick" , function(){
					$panel.close();
				});
			}
			deferred.resolve( options );
		}, 0); // TODO get rid of setTimeout 0 hacks
		return deferred.promise();
	},
	_create: function() {
		var o = this.options,
			klass = o.classes.panel,
			$el = this.element,
			$closeLink = $el.find( "[data-rel=close]" );
		$el.addClass( klass );
		if( $( "." + o.classes.contentWrap ).length === 0 ){
			$( ".ui-header, .ui-content, .ui-footer" ).wrapAll( '
' );
		}
		if( o.theme ){
			$el.addClass( "ui-body-" + o.theme );
		}
		this._handleLink( "panel" , function( $link , id ){
			var options = $.extend( {} , this.options ),
				op = {
					position: $link.jqmData( "position" ),
					dismissible: $link.jqmData( "dismissible" ),
					display: $link.jqmData( "display" )
				};
			for( var i in op ){
				if( op.hasOwnProperty( i ) && typeof op[ i ] !== "undefined" ){
					options[ i ] = op[ i ];
				}
			}
			$( "#" + id ).panel( "toggle" , {
				position: options.position,//left right
				dismissible: options.dismissible,//true or false
				display: options.display,// overlay or push
				link: $link
			});
		});
		$closeLink.on( "vclick" , function( e ){
			e.preventDefault();
			$el.panel( "close" );
			return false;
		});
		this._trigger( "create" );
	},
	_position: function( options ){
		var deferred = $.Deferred();
		var o = options,
			klass = o.classes.panel,
			$el = this.element;
		setTimeout(function(){
			$el.addClass( "hidden" )
				.addClass( klass + "-position-" + o.position )
				.addClass( klass + "-dismissible-" + o.dismissible )
				.addClass( klass + "-display-" + o.display )
				.jqmData( "position" , o.position )
				.jqmData( "display" , o.display )
				.jqmData( "dismissible" , o.dismissible )
				.removeClass( "hidden" );
				deferred.resolve( options );
		}, 0); // TODO get rid of setTimeout 0 hacks
		return deferred.promise();
	},
	_openPanel: function( options ){
		var deferred = $.Deferred();
		var o = options,
			$el = this.element,
			klass = o.classes.panel,
			$contentsWrap = $( "." + o.classes.contentWrap ),
			self = this,
			_triggerAndResolve = function(){
				self._trigger( "open" , "open" , { link: o.link } );
				deferred.resolve( options );
			};
		if( o.display === "reveal" ){
			$contentsWrap.one( "webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd" , _triggerAndResolve );
		} else {
			$el.one( "webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd" , _triggerAndResolve );
		}
		setTimeout(function(){
			$el.addClass( klass + "-active" );
			if( o.display === "reveal" || o.display === "push" ){
				$contentsWrap.addClass( "panel-shift-" + o.position );
			}
			if( o.display === "push" ){
				$contentsWrap.addClass( "panel-push" );
			}
			$( "body" ).addClass( "ui-panel-body-scroll-block" );
		}, 0);//TODO setTimout hacks
		return deferred.promise();
	},
	_destroy: function(){},
	open: function( options , toggle ){
		var self = this;
		var deferred = $.Deferred();
		var o = $.extend( {} , this.options ),
			klass = o.classes.panel,
			$el = this.element,
			$contentsWrap = $( "." + o.classes.contentWrap );
		for( var i in options ){
			if( options.hasOwnProperty( i ) ){
				o[ i ] = options[ i ];
			}
		}
		if( $el.hasClass( "ui-responsive" ) ){
			$contentsWrap.addClass( "ui-responsive" );
		}
		this._position( o )
		.then( function( o ){
			return self._openPanel( o );
		})
		.then( function( o ){
			return self._blockPage( o );
		})
		.then( function( o ){
			deferred.resolve( o );
		});
		return deferred.promise();
	},
	close: function( options , toggle ){
		var deferred = $.Deferred();
		var o = $.extend( {} , this.options ),
			klass = o.classes.panel,
			$el = this.element,
			position = $el.jqmData( "position" ),
			display = $el.jqmData( "display" ),
			dismissible = $el.jqmData( "dismissible" ),
			$contentsWrap = $( "." + o.classes.contentWrap );
			_closePanel = function(){
				$el.removeClass( klass + "-position-" + position )
					.removeClass( klass + "-display-" + display )
					.removeClass( klass + "-dismissible-" + dismissible );
				$contentsWrap.removeClass( "ui-responsive" );
				$el.data( "mobile-panel" )._trigger( "close" , "close" , { link: o.link } );
				deferred.resolve( o , toggle );
			};
		for( var i in options ){
			if( options.hasOwnProperty( i ) ){
				o[ i ] = options[ i ];
			}
		}
		if( toggle ){
			$el.addClass( "ui-panel-toggle" );
		}
		if( display === "reveal" ){
			$contentsWrap.one( "webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd" , _closePanel );
		} else {
			$el.one( "webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd" , _closePanel );
		}

		$el.removeClass( klass + "-active" );
		$( "#page-block" ).remove();
		$( "." + o.classes.contentWrap ).removeClass( "panel-shift-" + position )
			.removeClass( "panel-push" );
		$( "body" ).removeClass( "ui-panel-body-scroll-block" );
		return deferred.promise();
	},
	toggle: function( options ){
		var $el = this.element,
			active = $( ".ui-panel-active" ).data( "mobile-panel" ),
			self = this;
		if( active &&
				( active.element.jqmData( "position") === options.position ) &&
				( active.element.attr( "id" ) === $el.attr( "id" ) ) &&
				( active.element.jqmData( "display" ) === options.display ) ){
			return active.close( options );
		} else if ( active ){
			active.close( options , true ).
			then( function( options , toggle ){
				self.open( options , toggle );
			});
		} else {
			return this.open( options );
		}
	},
	refresh: function(){
	}
});

$( document ).bind( "panelopen panelclose" , function( e , data ){
	var $link = data.link, $parent;
	if( $link ){
		$parent = $link.parent().parent();
		if ($parent.hasClass("ui-li")) {
			$link = $parent.parent();
		}
		$link.removeClass( $.mobile.activeBtnClass );
	}
});

$( document ).bind( "pagehide" , function( e , data ){
	$( ".ui-panel-active" ).panel( "close" );
});

$(document).keyup(function(e) {
	if( e.keyCode === 27 ){
		$( ".ui-panel-active" ).panel( "close" );
	}
});

//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ) {
	$.mobile.panel.prototype.enhanceWithin( e.target );
});

})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
});
//>>excludeEnd("jqmBuildExclude");

<commit_msg>Qualifies translateX styles.<commit_after>//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
//>>description: Responsive presentation and behavior for HTML data panels
//>>label: Panel
//>>group: Widgets
//>>css.structure: ../css/structure/jquery.mobile.panel.css
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css

define( [ "jquery", "../jquery.mobile.widget", "./page", "./page.sections" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {

$.widget( "mobile.panel", $.mobile.widget, {
	options: {
		classes: {
			panel: "ui-panel",
			contentWrap: "ui-panel-content-wrap"
		},
		theme: null,
		position: "left",
		dismissible: true,
		display: "reveal",
		initSelector: ":jqmData(role='panel')"
	},
	_handleLink: function( roleType , callback ){
		var elId = this.element.attr( "id" ),
			self = this;
		$( document ).on( "click" , "a", function( e ) {
			var $link = $( this ),
				id = $link.attr( "href" ).split( "#" )[1];
			if( elId === id ){
				e.preventDefault();
				callback.call( self , $link , id );
				return false;
			}
		});
	},
	_blockPage: function( options ){
		var deferred = $.Deferred();
		var $div = $( "
" ),
			$panel = this,
			slideDir = options.position === "left" ? "right" : "left",
			clickable = options.dismissible && options.display !== "push",
			klass = clickable ? "ui-panel-dismiss" : "ui-panel-no-dismiss";
		setTimeout(function(){
			if( $panel.element.hasClass( "ui-responsive" ) ){
				$div.addClass( "ui-responsive" );
			}
			$div.addClass( "ui-panel-dismiss-overlay" )
				.css( "height" , $.mobile.activePage.height() )
				.css( slideDir , 0 )
				.attr( "id" , "page-block" )
				.addClass( klass )
				.appendTo( $.mobile.activePage );
			if( clickable ){
				$div.bind( "vclick" , function(){
					$panel.close();
				});
			}
			deferred.resolve( options );
		}, 0); // TODO get rid of setTimeout 0 hacks
		return deferred.promise();
	},
	_create: function() {
		var o = this.options,
			klass = o.classes.panel,
			$el = this.element,
			$closeLink = $el.find( "[data-rel=close]" ),
			$page = $el.closest( ":jqmData(role='page')" );

		$el.addClass( klass );
		if( $( "." + o.classes.contentWrap ).length === 0 ){
			$( ".ui-header, .ui-content, .ui-footer" ).wrapAll( '
' );
		}
		if( o.theme ){
			$el.addClass( "ui-body-" + o.theme );
		}

		$page.addClass( $.support.cssTransform3d ? "ui-panel-transforms" : "ui-panel-positioning" );

		this._handleLink( "panel" , function( $link , id ){
			var options = $.extend( {} , this.options ),
				op = {
					position: $link.jqmData( "position" ),
					dismissible: $link.jqmData( "dismissible" ),
					display: $link.jqmData( "display" )
				};
			for( var i in op ){
				if( op.hasOwnProperty( i ) && typeof op[ i ] !== "undefined" ){
					options[ i ] = op[ i ];
				}
			}
			$( "#" + id ).panel( "toggle" , {
				position: options.position,//left right
				dismissible: options.dismissible,//true or false
				display: options.display,// overlay or push
				link: $link
			});
		});
		$closeLink.on( "vclick" , function( e ){
			e.preventDefault();
			$el.panel( "close" );
			return false;
		});
		this._trigger( "create" );
	},
	_position: function( options ){
		var deferred = $.Deferred();
		var o = options,
			klass = o.classes.panel,
			$el = this.element;
		setTimeout(function(){
			$el.addClass( "hidden" )
				.addClass( klass + "-position-" + o.position )
				.addClass( klass + "-dismissible-" + o.dismissible )
				.addClass( klass + "-display-" + o.display )
				.jqmData( "position" , o.position )
				.jqmData( "display" , o.display )
				.jqmData( "dismissible" , o.dismissible )
				.removeClass( "hidden" );
				deferred.resolve( options );
		}, 0); // TODO get rid of setTimeout 0 hacks
		return deferred.promise();
	},
	_openPanel: function( options ){
		var deferred = $.Deferred();
		var o = options,
			$el = this.element,
			klass = o.classes.panel,
			$contentsWrap = $( "." + o.classes.contentWrap ),
			self = this,
			_triggerAndResolve = function(){
				self._trigger( "open" , "open" , { link: o.link } );
				deferred.resolve( options );
			};
		if( o.display === "reveal" ){
			$contentsWrap.one( "webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd" , _triggerAndResolve );
		} else {
			$el.one( "webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd" , _triggerAndResolve );
		}
		setTimeout(function(){
			$el.addClass( klass + "-active" );
			if( o.display === "reveal" || o.display === "push" ){
				$contentsWrap.addClass( "panel-shift-" + o.position );
			}
			if( o.display === "push" ){
				$contentsWrap.addClass( "panel-push" );
			}
			$( "body" ).addClass( "ui-panel-body-scroll-block" );
		}, 0);//TODO setTimout hacks
		return deferred.promise();
	},
	_destroy: function(){},
	open: function( options , toggle ){
		var self = this;
		var deferred = $.Deferred();
		var o = $.extend( {} , this.options ),
			klass = o.classes.panel,
			$el = this.element,
			$contentsWrap = $( "." + o.classes.contentWrap );
		for( var i in options ){
			if( options.hasOwnProperty( i ) ){
				o[ i ] = options[ i ];
			}
		}
		if( $el.hasClass( "ui-responsive" ) ){
			$contentsWrap.addClass( "ui-responsive" );
		}
		this._position( o )
		.then( function( o ){
			return self._openPanel( o );
		})
		.then( function( o ){
			return self._blockPage( o );
		})
		.then( function( o ){
			deferred.resolve( o );
		});
		return deferred.promise();
	},
	close: function( options , toggle ){
		var deferred = $.Deferred();
		var o = $.extend( {} , this.options ),
			klass = o.classes.panel,
			$el = this.element,
			position = $el.jqmData( "position" ),
			display = $el.jqmData( "display" ),
			dismissible = $el.jqmData( "dismissible" ),
			$contentsWrap = $( "." + o.classes.contentWrap );
			_closePanel = function(){
				$el.removeClass( klass + "-position-" + position )
					.removeClass( klass + "-display-" + display )
					.removeClass( klass + "-dismissible-" + dismissible );
				$contentsWrap.removeClass( "ui-responsive" );
				$el.data( "mobile-panel" )._trigger( "close" , "close" , { link: o.link } );
				deferred.resolve( o , toggle );
			};
		for( var i in options ){
			if( options.hasOwnProperty( i ) ){
				o[ i ] = options[ i ];
			}
		}
		if( toggle ){
			$el.addClass( "ui-panel-toggle" );
		}
		if( display === "reveal" ){
			$contentsWrap.one( "webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd" , _closePanel );
		} else {
			$el.one( "webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd" , _closePanel );
		}

		$el.removeClass( klass + "-active" );
		$( "#page-block" ).remove();
		$( "." + o.classes.contentWrap ).removeClass( "panel-shift-" + position )
			.removeClass( "panel-push" );
		$( "body" ).removeClass( "ui-panel-body-scroll-block" );
		return deferred.promise();
	},
	toggle: function( options ){
		var $el = this.element,
			active = $( ".ui-panel-active" ).data( "mobile-panel" ),
			self = this;
		if( active &&
				( active.element.jqmData( "position") === options.position ) &&
				( active.element.attr( "id" ) === $el.attr( "id" ) ) &&
				( active.element.jqmData( "display" ) === options.display ) ){
			return active.close( options );
		} else if ( active ){
			active.close( options , true ).
			then( function( options , toggle ){
				self.open( options , toggle );
			});
		} else {
			return this.open( options );
		}
	},
	refresh: function(){
	}
});

$( document ).bind( "panelopen panelclose" , function( e , data ){
	var $link = data.link, $parent;
	if( $link ){
		$parent = $link.parent().parent();
		if ($parent.hasClass("ui-li")) {
			$link = $parent.parent();
		}
		$link.removeClass( $.mobile.activeBtnClass );
	}
});

$( document ).bind( "pagehide" , function( e , data ){
	$( ".ui-panel-active" ).panel( "close" );
});

$(document).keyup(function(e) {
	if( e.keyCode === 27 ){
		$( ".ui-panel-active" ).panel( "close" );
	}
});

//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ) {
	$.mobile.panel.prototype.enhanceWithin( e.target );
});

})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
});
//>>excludeEnd("jqmBuildExclude");

<|endoftext|>


<commit_before>/**
 * Copyright (c) 2013-2017 Memba Sarl. All rights reserved.
 * Sources at https://github.com/Memba
 */

/* jshint browser: true, jquery: true */
/* globals define: false */

(function (f, define) {
    'use strict';
    define([], f);
})(function () {

    'use strict';

    (function (undefined) {

        var STRING = 'string';
        var OBJECT = 'object';
        var FUNCTION = 'function';
        var UNDEFINED = 'undefined';

        // Populate the class2type map
        var class2type = {};
        'Boolean Number String Function Array Date RegExp Object Error Symbol'.split(' ').forEach(function (name) {
            class2type[ '[object ' + name + ']' ] = name.toLowerCase();
        });
        var toString = class2type.toString;
        var hasOwn = class2type.hasOwnProperty;

        // jQuery core functions to remove any dependencies
        // @see https://github.com/jquery/jquery/blob/99e8ff1baa7ae341e94bb89c3e84570c7c3ad9ea/src/core.js
        var $ = {
            isArray: Array.isArray,
            isFunction: function (obj) {
                return $.type(obj) === FUNCTION;
            },
            isEmptyObject: function (obj) {
                var name;
                for (name in obj) {
                    return false;
                }
                return true;
            },
            isNumeric: function (obj) {
                // parseFloat NaNs numeric-cast false positives (null|true|false|"")
                // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
                // subtraction forces infinities to NaN
                // adding 1 corrects loss of precision from parseFloat (#15100)
                return !$.isArray(obj) && (obj - parseFloat(obj) + 1) >= 0;
            },
            isPlainObject: function (obj) {
                // Not plain objects:
                // - Any object or value whose internal [[Class]] property is not "[object Object]"
                // - DOM nodes
                // - window
                if ($.type(obj) !== OBJECT || obj.nodeType || $.isWindow(obj)) {
                    return false;
                }
                if (obj.constructor && !hasOwn.call(obj.constructor.prototype, 'isPrototypeOf')) {
                    return false;
                }
                // If the function hasn't returned already, we're confident that
                // |obj| is a plain object, created by {} or constructed with new Object
                return true;
            },
            isWindow: function (obj) {
                return obj !== null && obj === obj.window;
            },
            type: function (obj) {
                if (obj === null) {
                    return obj + '';
                }
                // Support: Android<4.0 (functionish RegExp)
                return typeof obj === OBJECT || typeof obj === FUNCTION ? class2type[toString.call(obj)] || OBJECT : typeof obj;
            }
        };

        /**
         * Asserts
         * Note: Use asserts where unmet conditions are independent from user entries, and
         * developers should be warned that there is probably something unexpected in their code
         */
        var assert = window.assert = function (test, message) {
            if (!test) { throw new Error(message); }
        };

        // By extending assert, we ensure we can call both assert() and assert.ok() for the same result (like in nodeJS)

        /**
         * Assert enumeration
         * @param array
         * @param value
         * @param message
         */
        assert.enum = function (array, value, message) {
            if (array.indexOf(value) === -1) {
                throw new RangeError(message);
            }
        };

        /**
         * Assert equal
         * @param expected
         * @param actual
         * @param message
         */
        assert.equal = function (expected, actual, message) {
            if (expected !== actual) {
                throw new RangeError(message);
            }
        };

        /**
         * Assert format (note: prefer kendo.format when available)
         * @param message
         */
        assert.format = function (message) {
            var values = arguments;
            return message.replace(/\{(\d+)\}/g, function (match, index) {
                var value = values[parseInt(index, 10) + 1];
                return value + '';
            });
        };

        /**
         * Assert the length property (for Arrays and jQuery)
         * @param el
         * @param message
         */
        assert.hasLength = function (el, message) {
            if (!el || !el.length) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert instance of
         * @param Class
         * @param value
         * @param message
         */
        assert.instanceof = function (Class, value, message) {
            if (!(value instanceof Class)) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert isArray
         * @param value
         * @param message
         */
        assert.isArray = function (value, message) {
            if (!$.isArray(value)) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert empty object (i.e. {})
         * @param value
         * @param message
         */
        assert.isEmptyObject = function (value, message) {
            if (!$.isEmptyObject(value)) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert isFunction
         * @param value
         * @param message
         */
        assert.isFunction = function (value, message) {
            if (!$.isFunction(value)) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert optional object (can be undefined but mot an empty object, i.e. {})
         * @param value
         * @param message
         */
        assert.isOptionalObject = function (value, message) {
            if ($.type(value) !== UNDEFINED && (!$.isPlainObject(value) || $.isEmptyObject(value))) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert a plain object (not empty)
         * @param value
         * @param message
         */
        assert.isPlainObject = function (value, message) {
            if (!$.isPlainObject(value) || $.isEmptyObject(value)) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert undefined
         * @param value
         * @param message
         */
        assert.isUndefined = function (value, message) {
            if ($.type(value) !== UNDEFINED) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert regular expression match
         * @param rx
         * @param value
         * @param message
         */
        assert.match = function (rx, value, message) {
            if ($.type(value) !== STRING || !rx.test(value)) {
                throw new RangeError(message);
            }
        };

        /**
         * Assert true condition
         * @param test
         * @param message
         * @returns {*}
         */
        assert.ok = function (test, message) {
            return assert(test, message);
        };

        /**
         * Assert type
         * @param type
         * @param value
         * @param message
         */
        assert.type = function (type, value, message) {
            if ($.type(value) !== type) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert typeOrUndef
         * @param type
         * @param value
         * @param message
         */
        assert.typeOrUndef = function (type, value, message) {
            if ($.type(value) !== UNDEFINED && $.type(value) !== type) {
                throw new TypeError(message);
            }
        };

        assert.messages = {
            enum: {
                default: '`{0}` is expected to be any of `{1}`'
            },
            equal: {
                default: '`{0}` is expected to equal `{1}`'
            },
            hasLength: {
                default: '`{0}` has neither length nor any item'
            },
            instanceof: {
                default: '`{0}` is expected to be an instance of `{1}`'
            },
            isArray: {
                default: '`{0}` is expected to be an array'
            },
            isEmptyObject: {
                default: '`{0}` is expected to be an empty object'
            },
            isFunction: {
                default: '`{0}` is expected to be a function'
            },
            isOptionalObject: {
                default: '`{0}` is expected to be undefined or a plain object'
            },
            isPlainObject: {
                default: '`{0}` is expected to be a plain object'
            },
            isUndefined: {
                default: '`{0}` is expected to be undefined'
            },
            match: {
                default: '`{0}` is expected to match `{1}`'
            },
            ok: {
                default: 'A statement is expected to be true'
            },
            type: {
                default: '`{0}` is expected to have type `{1}`'
            },
            typeOrUndef: {
                default: '`{0}` is expected to have type `{1}` or be undefined'
            }
        };

    }());

    return window.assert;

}, typeof define === 'function' && define.amd ? define : function (_, f) { 'use strict'; f(); });
<commit_msg>Fixed jscs and jshint errors<commit_after>/**
 * Copyright (c) 2013-2017 Memba Sarl. All rights reserved.
 * Sources at https://github.com/Memba
 */

/* jshint browser: true, jquery: true */
/* globals define: false */

(function (f, define) {
    'use strict';
    define([], f);
})(function () {

    'use strict';

    /* This function has too many statements. */
    /* jshint -W071 */

    (function (undefined) {

        var STRING = 'string';
        var OBJECT = 'object';
        var FUNCTION = 'function';
        var UNDEFINED = 'undefined';

        // Populate the class2type map
        var class2type = {};
        'Boolean Number String Function Array Date RegExp Object Error Symbol'.split(' ').forEach(function (name) {
            class2type[ '[object ' + name + ']' ] = name.toLowerCase();
        });
        var toString = class2type.toString;
        var hasOwn = class2type.hasOwnProperty;

        // jQuery core functions to remove any dependencies
        // @see https://github.com/jquery/jquery/blob/99e8ff1baa7ae341e94bb89c3e84570c7c3ad9ea/src/core.js
        var $ = {
            isArray: Array.isArray,
            isFunction: function (obj) {
                return $.type(obj) === FUNCTION;
            },
            isEmptyObject: function (obj) {
                var name;
                for (name in obj) {
                    return false;
                }
                return true;
            },
            isNumeric: function (obj) {
                // parseFloat NaNs numeric-cast false positives (null|true|false|"")
                // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
                // subtraction forces infinities to NaN
                // adding 1 corrects loss of precision from parseFloat (#15100)
                return !$.isArray(obj) && (obj - parseFloat(obj) + 1) >= 0;
            },
            isPlainObject: function (obj) {
                // Not plain objects:
                // - Any object or value whose internal [[Class]] property is not "[object Object]"
                // - DOM nodes
                // - window
                if ($.type(obj) !== OBJECT || obj.nodeType || $.isWindow(obj)) {
                    return false;
                }
                if (obj.constructor && !hasOwn.call(obj.constructor.prototype, 'isPrototypeOf')) {
                    return false;
                }
                // If the function hasn't returned already, we're confident that
                // |obj| is a plain object, created by {} or constructed with new Object
                return true;
            },
            isWindow: function (obj) {
                return obj !== null && obj === obj.window;
            },
            type: function (obj) {
                if (obj === null) {
                    return obj + '';
                }
                // Support: Android<4.0 (functionish RegExp)
                return typeof obj === OBJECT || typeof obj === FUNCTION ? class2type[toString.call(obj)] || OBJECT : typeof obj;
            }
        };

        /**
         * Asserts
         * Note: Use asserts where unmet conditions are independent from user entries, and
         * developers should be warned that there is probably something unexpected in their code
         */
        var assert = window.assert = function (test, message) {
            if (!test) { throw new Error(message); }
        };

        // By extending assert, we ensure we can call both assert() and assert.ok() for the same result (like in nodeJS)

        /**
         * Assert enumeration
         * @param array
         * @param value
         * @param message
         */
        assert.enum = function (array, value, message) {
            if (array.indexOf(value) === -1) {
                throw new RangeError(message);
            }
        };

        /**
         * Assert equal
         * @param expected
         * @param actual
         * @param message
         */
        assert.equal = function (expected, actual, message) {
            if (expected !== actual) {
                throw new RangeError(message);
            }
        };

        /**
         * Assert format (note: prefer kendo.format when available)
         * @param message
         */
        assert.format = function (message) {
            var values = arguments;
            return message.replace(/\{(\d+)\}/g, function (match, index) {
                var value = values[parseInt(index, 10) + 1];
                return value + '';
            });
        };

        /**
         * Assert the length property (for Arrays and jQuery)
         * @param el
         * @param message
         */
        assert.hasLength = function (el, message) {
            if (!el || !el.length) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert instance of
         * @param Class
         * @param value
         * @param message
         */
        assert.instanceof = function (Class, value, message) {
            if (!(value instanceof Class)) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert isArray
         * @param value
         * @param message
         */
        assert.isArray = function (value, message) {
            if (!$.isArray(value)) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert empty object (i.e. {})
         * @param value
         * @param message
         */
        assert.isEmptyObject = function (value, message) {
            if (!$.isEmptyObject(value)) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert isFunction
         * @param value
         * @param message
         */
        assert.isFunction = function (value, message) {
            if (!$.isFunction(value)) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert optional object (can be undefined but mot an empty object, i.e. {})
         * @param value
         * @param message
         */
        assert.isOptionalObject = function (value, message) {
            if ($.type(value) !== UNDEFINED && (!$.isPlainObject(value) || $.isEmptyObject(value))) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert a plain object (not empty)
         * @param value
         * @param message
         */
        assert.isPlainObject = function (value, message) {
            if (!$.isPlainObject(value) || $.isEmptyObject(value)) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert undefined
         * @param value
         * @param message
         */
        assert.isUndefined = function (value, message) {
            if ($.type(value) !== UNDEFINED) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert regular expression match
         * @param rx
         * @param value
         * @param message
         */
        assert.match = function (rx, value, message) {
            if ($.type(value) !== STRING || !rx.test(value)) {
                throw new RangeError(message);
            }
        };

        /**
         * Assert true condition
         * @param test
         * @param message
         * @returns {*}
         */
        assert.ok = function (test, message) {
            return assert(test, message);
        };

        /**
         * Assert type
         * @param type
         * @param value
         * @param message
         */
        assert.type = function (type, value, message) {
            if ($.type(value) !== type) {
                throw new TypeError(message);
            }
        };

        /**
         * Assert typeOrUndef
         * @param type
         * @param value
         * @param message
         */
        assert.typeOrUndef = function (type, value, message) {
            if ($.type(value) !== UNDEFINED && $.type(value) !== type) {
                throw new TypeError(message);
            }
        };

        assert.messages = {
            enum: {
                default: '`{0}` is expected to be any of `{1}`'
            },
            equal: {
                default: '`{0}` is expected to equal `{1}`'
            },
            hasLength: {
                default: '`{0}` has neither length nor any item'
            },
            instanceof: {
                default: '`{0}` is expected to be an instance of `{1}`'
            },
            isArray: {
                default: '`{0}` is expected to be an array'
            },
            isEmptyObject: {
                default: '`{0}` is expected to be an empty object'
            },
            isFunction: {
                default: '`{0}` is expected to be a function'
            },
            isOptionalObject: {
                default: '`{0}` is expected to be undefined or a plain object'
            },
            isPlainObject: {
                default: '`{0}` is expected to be a plain object'
            },
            isUndefined: {
                default: '`{0}` is expected to be undefined'
            },
            match: {
                default: '`{0}` is expected to match `{1}`'
            },
            ok: {
                default: 'A statement is expected to be true'
            },
            type: {
                default: '`{0}` is expected to have type `{1}`'
            },
            typeOrUndef: {
                default: '`{0}` is expected to have type `{1}` or be undefined'
            }
        };

    }());

    /* jshint +W071 */

    return window.assert;

}, typeof define === 'function' && define.amd ? define : function (_, f) { 'use strict'; f(); });
<|endoftext|>


<commit_before>$(function() {
	var mydiv = $('
',{
   class:  'div_obsh',
	}).appendTo('body');
	var myform = $("<form/>", {
  	action: "/",
	}).appendTo(mydiv);
	mydiv = $('
',{
   class:  'divTabs',
	}).appendTo(myform);
	var div = $('
',{
   class:  'div',
	}).appendTo(mydiv);
	$('', {
    for:     'firstname',
    text:  'Firstname'
	}).appendTo(div);
	$('<input/>', {
    id:     'firstname',
    type: 	'text',
    name: 	'firstname',
    title:  'Please provide your firstname.'
	}).appendTo(div);
	var div = $('
',{
   class:  'div',
	}).appendTo(mydiv);
	$('', {
    for:     'lasttname',
    text:  'Lastname'
	}).appendTo(div);
	$('<input/>', {
    id:     'lastname',
    type: 	'text',
    name: 	'lastname',
    title:  'Please provide your lastname.'
	}).appendTo(div);
	var div = $('
',{
   class:  'div',
	}).appendTo(mydiv);
	$('', {
    for:     'address',
    text:  'Address'
	}).appendTo(div);
	$('<input/>', {
    id:     'address',
    type: 	'text',
    name: 	'address',
    title:  'Your home or work address.'
	}).appendTo(div);
	$('<input/>', {
    type: 	'submit',
    name: 	'but',
    val: 	'Show help'
}).appendTo(myform);

$('input[type="text"]').hover(
  function(event) {
	var el = $(this);
	var title = el.attr('title');
	el.attr('title', '').parent().append('
' + title + '
');
	$div=el.parent().find("div");
	$div.css(
	{"margin-left": "+="+(el.width()+80)+"px",
	  "margin-top": "-="+(el.height()+7)+"px",
		"height": el.height()+""
	})
	$div.animate({
    opacity: 0
  }, 3000, function(){});
	},
	function() {
	var el = $(this);
	var $div=el.parent().find("div");
	el.attr('title',$div.text());
	$div.remove();
	}
	)

});
<commit_msg>Update script.js<commit_after>$(function() {
	var mydiv = $('
',{
   class:  'div_obsh',
	}).appendTo('body');
	var myform = $("<form/>", {
  	action: "/",
	}).appendTo(mydiv);
	mydiv = $('
',{
   class:  'divTabs',
	}).appendTo(myform);
	var div = $('
',{
   class:  'div',
	}).appendTo(mydiv);
	$('', {
    for:     'firstname',
    text:  'Firstname'
	}).appendTo(div);
	$('<input/>', {
    id:     'firstname',
    type: 	'text',
    name: 	'firstname',
    title:  'Please provide your firstname.'
	}).appendTo(div);
	var div = $('
',{
   class:  'div',
	}).appendTo(mydiv);
	$('', {
    for:     'lasttname',
    text:  'Lastname'
	}).appendTo(div);
	$('<input/>', {
    id:     'lastname',
    type: 	'text',
    name: 	'lastname',
    title:  'Please provide your lastname.'
	}).appendTo(div);
	var div = $('
',{
   class:  'div',
	}).appendTo(mydiv);
	$('', {
    for:     'address',
    text:  'Address'
	}).appendTo(div);
	$('<input/>', {
    id:     'address',
    type: 	'text',
    name: 	'address',
    title:  'Your home or work address.'
	}).appendTo(div);
	$('<input/>', {
    type: 	'submit',
    name: 	'but',
    val: 	'Show help'
}).appendTo(myform);

var $inputText = $('input[type="text"]');

function hoverIn(el){
	if (el.parent().find("div").length===0) {
		var title = el.attr('title');
		el.attr('title', '').parent().append('
' + title + '
');
		var $div=el.parent().find("div");
		$div.css(
		{"margin-left": "+="+(el.width()+80)+"px",
			"margin-top": "-="+(el.height()+7)+"px",
			"height": el.height()+""
		});
		$div.animate({
			opacity: 0
		}, 3000, function(){});
	}
};

	function hoverFrom(el){
		var $div=el.parent().find("div");
	/*	if ($div) {*/
		el.attr('title',$div.text());
		$div.remove();

	};

	$inputText.hover(function(){hoverIn($(this))},function(){hoverFrom($(this))});

	$('input[type="submit"]').click(function(){
		$inputText.each(function(i,elem) {hoverIn($(elem));});
	});

});

<|endoftext|>


<commit_before>// A grid component using the following libs as inspiration.
//
// For the implementation:
// - http://v4-alpha.getbootstrap.com/layout/flexbox-grid/
// - https://github.com/kristoferjoseph/flexboxgrid/blob/master/src/css/flexboxgrid.css
// - https://github.com/roylee0704/react-flexbox-grid
// - https://material.angularjs.org/latest/layout/introduction
//
// Follow this flexbox Guide to better understand the underlying model:
// - https://css-tricks.com/snippets/css/a-guide-to-flexbox/

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import { keys as breakpointKeys } from '../styles/createBreakpoints';
import requirePropFactory from '../utils/requirePropFactory';

const GUTTERS = [0, 8, 16, 24, 32, 40];
const GRID_SIZES = [true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];

function generateGrid(globalStyles, theme, breakpoint) {
  // For the auto layouting
  const styles = {
    [`grid-${breakpoint}`]: {
      flexBasis: 0,
      flexGrow: 1,
      maxWidth: '100%',
    },
  };

  GRID_SIZES.forEach(size => {
    if (typeof size === 'boolean') {
      // Skip the first one as handle above.
      return;
    }

    // Only keep 6 significant numbers.
    const width = `${Math.round(size / 12 * 10e6) / 10e4}%`;

    /* eslint-disable max-len */
    // Close to the bootstrap implementation:
    // https://github.com/twbs/bootstrap/blob/8fccaa2439e97ec72a4b7dc42ccc1f649790adb0/scss/mixins/_grid.scss#L41
    /* eslint-enable max-len */
    styles[`grid-${breakpoint}-${size}`] = {
      flexBasis: width,
      maxWidth: width,
    };
  });

  // No need for a media query for the first size.
  if (breakpoint === 'xs') {
    Object.assign(globalStyles, styles);
  } else {
    globalStyles[theme.breakpoints.up(breakpoint)] = styles;
  }
}

function generateGutter(theme, breakpoint) {
  const styles = {};

  GUTTERS.forEach((spacing, index) => {
    if (index === 0) {
      // Skip the default style.
      return;
    }

    styles[`spacing-${breakpoint}-${spacing}`] = {
      margin: -spacing / 2,
      width: `calc(100% + ${spacing}px)`,
      '& > $item': {
        padding: spacing / 2,
      },
    };
  });

  return styles;
}

// Default CSS values
// flex: '0 1 auto',
// flexDirection: 'row',
// alignItems: 'flex-start',
// flexWrap: 'nowrap',
// justifyContent: 'flex-start',
export const styles = theme => ({
  container: {
    boxSizing: 'border-box',
    display: 'flex',
    flexWrap: 'wrap',
    width: '100%',
  },
  item: {
    boxSizing: 'border-box',
    flex: '0 0 auto',
    margin: '0', // For instance, it's useful when used with a `figure` element.
  },
  zeroMinWidth: {
    minWidth: 0,
  },
  'direction-xs-column': {
    flexDirection: 'column',
  },
  'direction-xs-column-reverse': {
    flexDirection: 'column-reverse',
  },
  'direction-xs-row-reverse': {
    flexDirection: 'row-reverse',
  },
  'wrap-xs-nowrap': {
    flexWrap: 'nowrap',
  },
  'wrap-xs-wrap-reverse': {
    flexWrap: 'wrap-reverse',
  },
  'align-items-xs-center': {
    alignItems: 'center',
  },
  'align-items-xs-flex-start': {
    alignItems: 'flex-start',
  },
  'align-items-xs-flex-end': {
    alignItems: 'flex-end',
  },
  'align-items-xs-baseline': {
    alignItems: 'baseline',
  },
  'align-content-xs-center': {
    alignContent: 'center',
  },
  'align-content-xs-flex-start': {
    alignContent: 'flex-start',
  },
  'align-content-xs-flex-end': {
    alignContent: 'flex-end',
  },
  'align-content-xs-space-between': {
    alignContent: 'space-between',
  },
  'align-content-xs-space-around': {
    alignContent: 'space-around',
  },
  'justify-xs-center': {
    justifyContent: 'center',
  },
  'justify-xs-flex-end': {
    justifyContent: 'flex-end',
  },
  'justify-xs-space-between': {
    justifyContent: 'space-between',
  },
  'justify-xs-space-around': {
    justifyContent: 'space-around',
  },
  ...generateGutter(theme, 'xs'),
  ...breakpointKeys.reduce((accumulator, key) => {
    // Use side effect over immutability for better performance.
    generateGrid(accumulator, theme, key);
    return accumulator;
  }, {}),
});

function Grid(props) {
  const {
    alignContent,
    alignItems,
    classes,
    className: classNameProp,
    component: Component,
    container,
    direction,
    item,
    justify,
    lg,
    md,
    sm,
    spacing,
    wrap,
    xl,
    xs,
    zeroMinWidth,
    ...other
  } = props;

  const className = classNames(
    {
      [classes.container]: container,
      [classes.item]: item,
      [classes.zeroMinWidth]: zeroMinWidth,
      [classes[`spacing-xs-${String(spacing)}`]]: container && spacing !== 0,
      [classes[`direction-xs-${String(direction)}`]]: direction !== Grid.defaultProps.direction,
      [classes[`wrap-xs-${String(wrap)}`]]: wrap !== Grid.defaultProps.wrap,
      [classes[`align-items-xs-${String(alignItems)}`]]:
        alignItems !== Grid.defaultProps.alignItems,
      [classes[`align-content-xs-${String(alignContent)}`]]:
        alignContent !== Grid.defaultProps.alignContent,
      [classes[`justify-xs-${String(justify)}`]]: justify !== Grid.defaultProps.justify,
      [classes['grid-xs']]: xs === true,
      [classes[`grid-xs-${String(xs)}`]]: xs && xs !== true,
      [classes['grid-sm']]: sm === true,
      [classes[`grid-sm-${String(sm)}`]]: sm && sm !== true,
      [classes['grid-md']]: md === true,
      [classes[`grid-md-${String(md)}`]]: md && md !== true,
      [classes['grid-lg']]: lg === true,
      [classes[`grid-lg-${String(lg)}`]]: lg && lg !== true,
      [classes['grid-xl']]: xl === true,
      [classes[`grid-xl-${String(xl)}`]]: xl && xl !== true,
    },
    classNameProp,
  );

  return <Component className={className} {...other} />;
}

Grid.propTypes = {
  /**
   * Defines the `align-content` style property.
   * It's applied for all screen sizes.
   */
  alignContent: PropTypes.oneOf([
    'stretch',
    'center',
    'flex-start',
    'flex-end',
    'space-between',
    'space-around',
  ]),
  /**
   * Defines the `align-items` style property.
   * It's applied for all screen sizes.
   */
  alignItems: PropTypes.oneOf(['flex-start', 'center', 'flex-end', 'stretch', 'baseline']),
  /**
   * The content of the component.
   */
  children: PropTypes.node,
  /**
   * Override or extend the styles applied to the component.
   * See [CSS API](#css-api) below for more details.
   */
  classes: PropTypes.object.isRequired,
  /**
   * @ignore
   */
  className: PropTypes.string,
  /**
   * The component used for the root node.
   * Either a string to use a DOM element or a component.
   */
  component: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
  /**
   * If `true`, the component will have the flex *container* behavior.
   * You should be wrapping *items* with a *container*.
   */
  container: PropTypes.bool,
  /**
   * Defines the `flex-direction` style property.
   * It is applied for all screen sizes.
   */
  direction: PropTypes.oneOf(['row', 'row-reverse', 'column', 'column-reverse']),
  /**
   * If `true`, the component will have the flex *item* behavior.
   * You should be wrapping *items* with a *container*.
   */
  item: PropTypes.bool,
  /**
   * Defines the `justify-content` style property.
   * It is applied for all screen sizes.
   */
  justify: PropTypes.oneOf(['flex-start', 'center', 'flex-end', 'space-between', 'space-around']),
  /**
   * Defines the number of grids the component is going to use.
   * It's applied for the `lg` breakpoint and wider screens if not overridden.
   */
  lg: PropTypes.oneOf([false, true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
  /**
   * Defines the number of grids the component is going to use.
   * It's applied for the `md` breakpoint and wider screens if not overridden.
   */
  md: PropTypes.oneOf([false, true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
  /**
   * Defines the number of grids the component is going to use.
   * It's applied for the `sm` breakpoint and wider screens if not overridden.
   */
  sm: PropTypes.oneOf([false, true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
  /**
   * Defines the space between the type `item` component.
   * It can only be used on a type `container` component.
   */
  spacing: PropTypes.oneOf(GUTTERS),
  /**
   * Defines the `flex-wrap` style property.
   * It's applied for all screen sizes.
   */
  wrap: PropTypes.oneOf(['nowrap', 'wrap', 'wrap-reverse']),
  /**
   * Defines the number of grids the component is going to use.
   * It's applied for the `xl` breakpoint and wider screens.
   */
  xl: PropTypes.oneOf([false, true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
  /**
   * Defines the number of grids the component is going to use.
   * It's applied for all the screen sizes with the lowest priority.
   */
  xs: PropTypes.oneOf([false, true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
  /**
   * If `true`, it sets `min-width: 0` on the item.
   * Refer to the limitations section of the documentation to better understand the use case.
   */
  zeroMinWidth: PropTypes.bool,
};

Grid.defaultProps = {
  alignContent: 'stretch',
  alignItems: 'stretch',
  component: 'div',
  container: false,
  direction: 'row',
  item: false,
  justify: 'flex-start',
  lg: false,
  md: false,
  sm: false,
  spacing: 0,
  wrap: 'wrap',
  xl: false,
  xs: false,
  zeroMinWidth: false,
};

// Add a wrapper component to generate some helper messages in the development
// environment.
/* eslint-disable react/no-multi-comp */
// eslint-disable-next-line import/no-mutable-exports
let GridWrapper = Grid;

if (process.env.NODE_ENV !== 'production') {
  GridWrapper = props => <Grid {...props} />;

  const requireProp = requirePropFactory('Grid');
  GridWrapper.propTypes = {
    alignContent: requireProp('container'),
    alignItems: requireProp('container'),
    direction: requireProp('container'),
    justify: requireProp('container'),
    lg: requireProp('item'),
    md: requireProp('item'),
    sm: requireProp('item'),
    spacing: requireProp('container'),
    wrap: requireProp('container'),
    xs: requireProp('item'),
    zeroMinWidth: requireProp('zeroMinWidth'),
  };
}

export default withStyles(styles, { name: 'MuiGrid' })(GridWrapper);
<commit_msg>[Grid] Allow shrink in items so text will wrap by default (#11411)<commit_after>// A grid component using the following libs as inspiration.
//
// For the implementation:
// - http://v4-alpha.getbootstrap.com/layout/flexbox-grid/
// - https://github.com/kristoferjoseph/flexboxgrid/blob/master/src/css/flexboxgrid.css
// - https://github.com/roylee0704/react-flexbox-grid
// - https://material.angularjs.org/latest/layout/introduction
//
// Follow this flexbox Guide to better understand the underlying model:
// - https://css-tricks.com/snippets/css/a-guide-to-flexbox/

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import { keys as breakpointKeys } from '../styles/createBreakpoints';
import requirePropFactory from '../utils/requirePropFactory';

const GUTTERS = [0, 8, 16, 24, 32, 40];
const GRID_SIZES = [true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];

function generateGrid(globalStyles, theme, breakpoint) {
  // For the auto layouting
  const styles = {
    [`grid-${breakpoint}`]: {
      flexBasis: 0,
      flexGrow: 1,
      maxWidth: '100%',
    },
  };

  GRID_SIZES.forEach(size => {
    if (typeof size === 'boolean') {
      // Skip the first one as handle above.
      return;
    }

    // Only keep 6 significant numbers.
    const width = `${Math.round(size / 12 * 10e6) / 10e4}%`;

    /* eslint-disable max-len */
    // Close to the bootstrap implementation:
    // https://github.com/twbs/bootstrap/blob/8fccaa2439e97ec72a4b7dc42ccc1f649790adb0/scss/mixins/_grid.scss#L41
    /* eslint-enable max-len */
    styles[`grid-${breakpoint}-${size}`] = {
      flexBasis: width,
      maxWidth: width,
    };
  });

  // No need for a media query for the first size.
  if (breakpoint === 'xs') {
    Object.assign(globalStyles, styles);
  } else {
    globalStyles[theme.breakpoints.up(breakpoint)] = styles;
  }
}

function generateGutter(theme, breakpoint) {
  const styles = {};

  GUTTERS.forEach((spacing, index) => {
    if (index === 0) {
      // Skip the default style.
      return;
    }

    styles[`spacing-${breakpoint}-${spacing}`] = {
      margin: -spacing / 2,
      width: `calc(100% + ${spacing}px)`,
      '& > $item': {
        padding: spacing / 2,
      },
    };
  });

  return styles;
}

// Default CSS values
// flex: '0 1 auto',
// flexDirection: 'row',
// alignItems: 'flex-start',
// flexWrap: 'nowrap',
// justifyContent: 'flex-start',
export const styles = theme => ({
  container: {
    boxSizing: 'border-box',
    display: 'flex',
    flexWrap: 'wrap',
    width: '100%',
  },
  item: {
    boxSizing: 'border-box',
    margin: '0', // For instance, it's useful when used with a `figure` element.
  },
  zeroMinWidth: {
    minWidth: 0,
  },
  'direction-xs-column': {
    flexDirection: 'column',
  },
  'direction-xs-column-reverse': {
    flexDirection: 'column-reverse',
  },
  'direction-xs-row-reverse': {
    flexDirection: 'row-reverse',
  },
  'wrap-xs-nowrap': {
    flexWrap: 'nowrap',
  },
  'wrap-xs-wrap-reverse': {
    flexWrap: 'wrap-reverse',
  },
  'align-items-xs-center': {
    alignItems: 'center',
  },
  'align-items-xs-flex-start': {
    alignItems: 'flex-start',
  },
  'align-items-xs-flex-end': {
    alignItems: 'flex-end',
  },
  'align-items-xs-baseline': {
    alignItems: 'baseline',
  },
  'align-content-xs-center': {
    alignContent: 'center',
  },
  'align-content-xs-flex-start': {
    alignContent: 'flex-start',
  },
  'align-content-xs-flex-end': {
    alignContent: 'flex-end',
  },
  'align-content-xs-space-between': {
    alignContent: 'space-between',
  },
  'align-content-xs-space-around': {
    alignContent: 'space-around',
  },
  'justify-xs-center': {
    justifyContent: 'center',
  },
  'justify-xs-flex-end': {
    justifyContent: 'flex-end',
  },
  'justify-xs-space-between': {
    justifyContent: 'space-between',
  },
  'justify-xs-space-around': {
    justifyContent: 'space-around',
  },
  ...generateGutter(theme, 'xs'),
  ...breakpointKeys.reduce((accumulator, key) => {
    // Use side effect over immutability for better performance.
    generateGrid(accumulator, theme, key);
    return accumulator;
  }, {}),
});

function Grid(props) {
  const {
    alignContent,
    alignItems,
    classes,
    className: classNameProp,
    component: Component,
    container,
    direction,
    item,
    justify,
    lg,
    md,
    sm,
    spacing,
    wrap,
    xl,
    xs,
    zeroMinWidth,
    ...other
  } = props;

  const className = classNames(
    {
      [classes.container]: container,
      [classes.item]: item,
      [classes.zeroMinWidth]: zeroMinWidth,
      [classes[`spacing-xs-${String(spacing)}`]]: container && spacing !== 0,
      [classes[`direction-xs-${String(direction)}`]]: direction !== Grid.defaultProps.direction,
      [classes[`wrap-xs-${String(wrap)}`]]: wrap !== Grid.defaultProps.wrap,
      [classes[`align-items-xs-${String(alignItems)}`]]:
        alignItems !== Grid.defaultProps.alignItems,
      [classes[`align-content-xs-${String(alignContent)}`]]:
        alignContent !== Grid.defaultProps.alignContent,
      [classes[`justify-xs-${String(justify)}`]]: justify !== Grid.defaultProps.justify,
      [classes['grid-xs']]: xs === true,
      [classes[`grid-xs-${String(xs)}`]]: xs && xs !== true,
      [classes['grid-sm']]: sm === true,
      [classes[`grid-sm-${String(sm)}`]]: sm && sm !== true,
      [classes['grid-md']]: md === true,
      [classes[`grid-md-${String(md)}`]]: md && md !== true,
      [classes['grid-lg']]: lg === true,
      [classes[`grid-lg-${String(lg)}`]]: lg && lg !== true,
      [classes['grid-xl']]: xl === true,
      [classes[`grid-xl-${String(xl)}`]]: xl && xl !== true,
    },
    classNameProp,
  );

  return <Component className={className} {...other} />;
}

Grid.propTypes = {
  /**
   * Defines the `align-content` style property.
   * It's applied for all screen sizes.
   */
  alignContent: PropTypes.oneOf([
    'stretch',
    'center',
    'flex-start',
    'flex-end',
    'space-between',
    'space-around',
  ]),
  /**
   * Defines the `align-items` style property.
   * It's applied for all screen sizes.
   */
  alignItems: PropTypes.oneOf(['flex-start', 'center', 'flex-end', 'stretch', 'baseline']),
  /**
   * The content of the component.
   */
  children: PropTypes.node,
  /**
   * Override or extend the styles applied to the component.
   * See [CSS API](#css-api) below for more details.
   */
  classes: PropTypes.object.isRequired,
  /**
   * @ignore
   */
  className: PropTypes.string,
  /**
   * The component used for the root node.
   * Either a string to use a DOM element or a component.
   */
  component: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
  /**
   * If `true`, the component will have the flex *container* behavior.
   * You should be wrapping *items* with a *container*.
   */
  container: PropTypes.bool,
  /**
   * Defines the `flex-direction` style property.
   * It is applied for all screen sizes.
   */
  direction: PropTypes.oneOf(['row', 'row-reverse', 'column', 'column-reverse']),
  /**
   * If `true`, the component will have the flex *item* behavior.
   * You should be wrapping *items* with a *container*.
   */
  item: PropTypes.bool,
  /**
   * Defines the `justify-content` style property.
   * It is applied for all screen sizes.
   */
  justify: PropTypes.oneOf(['flex-start', 'center', 'flex-end', 'space-between', 'space-around']),
  /**
   * Defines the number of grids the component is going to use.
   * It's applied for the `lg` breakpoint and wider screens if not overridden.
   */
  lg: PropTypes.oneOf([false, true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
  /**
   * Defines the number of grids the component is going to use.
   * It's applied for the `md` breakpoint and wider screens if not overridden.
   */
  md: PropTypes.oneOf([false, true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
  /**
   * Defines the number of grids the component is going to use.
   * It's applied for the `sm` breakpoint and wider screens if not overridden.
   */
  sm: PropTypes.oneOf([false, true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
  /**
   * Defines the space between the type `item` component.
   * It can only be used on a type `container` component.
   */
  spacing: PropTypes.oneOf(GUTTERS),
  /**
   * Defines the `flex-wrap` style property.
   * It's applied for all screen sizes.
   */
  wrap: PropTypes.oneOf(['nowrap', 'wrap', 'wrap-reverse']),
  /**
   * Defines the number of grids the component is going to use.
   * It's applied for the `xl` breakpoint and wider screens.
   */
  xl: PropTypes.oneOf([false, true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
  /**
   * Defines the number of grids the component is going to use.
   * It's applied for all the screen sizes with the lowest priority.
   */
  xs: PropTypes.oneOf([false, true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
  /**
   * If `true`, it sets `min-width: 0` on the item.
   * Refer to the limitations section of the documentation to better understand the use case.
   */
  zeroMinWidth: PropTypes.bool,
};

Grid.defaultProps = {
  alignContent: 'stretch',
  alignItems: 'stretch',
  component: 'div',
  container: false,
  direction: 'row',
  item: false,
  justify: 'flex-start',
  lg: false,
  md: false,
  sm: false,
  spacing: 0,
  wrap: 'wrap',
  xl: false,
  xs: false,
  zeroMinWidth: false,
};

// Add a wrapper component to generate some helper messages in the development
// environment.
/* eslint-disable react/no-multi-comp */
// eslint-disable-next-line import/no-mutable-exports
let GridWrapper = Grid;

if (process.env.NODE_ENV !== 'production') {
  GridWrapper = props => <Grid {...props} />;

  const requireProp = requirePropFactory('Grid');
  GridWrapper.propTypes = {
    alignContent: requireProp('container'),
    alignItems: requireProp('container'),
    direction: requireProp('container'),
    justify: requireProp('container'),
    lg: requireProp('item'),
    md: requireProp('item'),
    sm: requireProp('item'),
    spacing: requireProp('container'),
    wrap: requireProp('container'),
    xs: requireProp('item'),
    zeroMinWidth: requireProp('zeroMinWidth'),
  };
}

export default withStyles(styles, { name: 'MuiGrid' })(GridWrapper);
<|endoftext|>


<commit_before>Meteor = {
  isClient: false,
  isServer: true
};

Meteor.settings = {};
if (process.env.METEOR_SETTINGS) {
  try {
    Meteor.settings = JSON.parse(process.env.METEOR_SETTINGS);
  } catch (e) {
    throw new Error("Settings are not valid JSON");
  }
}
// Push a subset of settings to the client.
if (Meteor.settings && Meteor.settings.public &&
    typeof __meteor_runtime_config__ === "object") {
  __meteor_runtime_config__.PUBLIC_SETTINGS = Meteor.settings.public;
}
<commit_msg>add settings from APP_CONFIG<commit_after>Meteor = {
  isClient: false,
  isServer: true
};

Meteor.settings = {};
if (process.env.METEOR_SETTINGS) {
  try {
    Meteor.settings = JSON.parse(process.env.METEOR_SETTINGS);
  } catch (e) {
    throw new Error("Settings are not valid JSON");
  }
} else if ( process.env.APP_CONFIG) {
  // put settings from the app configuration in the settings.  Don't depend on
  // the Galaxy package for now, to avoid silly loops.
 try {
    Meteor.settings = JSON.parse(process.env.APP_CONFIG).settings || {};
  } catch (e) {
    throw new Error("Settings are not valid JSON");
  }
}
// Push a subset of settings to the client.
if (Meteor.settings && Meteor.settings.public &&
    typeof __meteor_runtime_config__ === "object") {
  __meteor_runtime_config__.PUBLIC_SETTINGS = Meteor.settings.public;
}
<|endoftext|>


<commit_before>Package.describe({
  name: "my-custom-package"
});

Package.onUse( function(api) {

  api.versionsFrom("METEOR@1.0");

  api.use([
    'fourseven:scss',

    'nova:core',
    'nova:base-components',
    'nova:posts',
    'nova:users',
	'nova:forms-tags',
  'nova:custom-autoform',
  'nova:countries',
  'nova:notification',
  'nova:notifications'
    ]);

  api.addFiles([
    'lib/modules.js'
  ], ['client', 'server']);

  api.addFiles([
    'lib/stylesheets/custom.scss',
    'lib/stylesheets/customPostPage.scss',
    'lib/stylesheets/CustomNotification.scss'
  ], ['client']);

  api.addFiles([
    'lib/server/templates.js'
  ], ['server']);

  api.addAssets([
    'lib/server/emails/customNewPost.handlebars',
    'lib/server/emails/customEmail.handlebars'
  ], ['server']);

      api.addAssets([
      'lib/stylesheets/UbuntuTitlingBold.ttf',
       'lib/components/public/releasarylogo.png'
    ], ['client']);

});
<commit_msg>customNotficatiom.scss commented<commit_after>Package.describe({
  name: "my-custom-package"
});

Package.onUse( function(api) {

  api.versionsFrom("METEOR@1.0");

  api.use([
    'fourseven:scss',

    'nova:core',
    'nova:base-components',
    'nova:posts',
    'nova:users',
	'nova:forms-tags',
  'nova:custom-autoform',
  'nova:countries',
  'nova:notification',
  'nova:notifications'
    ]);

  api.addFiles([
    'lib/modules.js'
  ], ['client', 'server']);

  api.addFiles([
    'lib/stylesheets/custom.scss',
    'lib/stylesheets/customPostPage.scss',
   // 'lib/stylesheets/CustomNotification.scss'
  ], ['client']);

  api.addFiles([
    'lib/server/templates.js'
  ], ['server']);

  api.addAssets([
    'lib/server/emails/customNewPost.handlebars',
    'lib/server/emails/customEmail.handlebars'
  ], ['server']);

      api.addAssets([
      'lib/stylesheets/UbuntuTitlingBold.ttf',
       'lib/components/public/releasarylogo.png'
    ], ['client']);

});
<|endoftext|>