<commit_before>/**
* Namespace: yootil.key
*
* 	This object is a wrapper around the proboards.plugin.key object.
*
* 	Note:  this isn't final, I might change things around a little and add a few more methods.
*
*	Also, things might get changed by ProBoards.
*/

yootil.key = (function(){

	return {

		/**
		* Property: pb_key_obj
		*	*object* Holds a reference to the ProBoards key object.
		*/

		pb_key_obj: pb.plugin.key,

		/**
		* Method: exists
		* 	Checks to see if a key exists.
		*
		* Parameters:
		* 	key - *string* The key to check.
		*
		* Returns:
		* 	*boolean*
		*
		* Examples:
		*	yootil.key.exists("mykey");
		*/

		exists: function(key){
			if(key){
				if(this.pb_key_obj){
					if(this.pb_key_obj(key)){
						return true;
					}
				}
			}

			return false;
		},

		/**
		* Method: get_key
		* 	Returns the key object.
		*
		* Parameters:
		* 	key - *string* The key to get.
		*
		* Returns:
		* 	*object* / *boolean*
		*
		* Examples:
		*	yootil.key.get_key("mykey");
		*/

		get_key: function(key){
			if(this.exists(key)){
				return this.pb_key_obj(key);
			}

			return false;
		},

		/**
		* Method: has_value
		* 	Checks to see if a key has a value.
		*
		* Parameters:
		* 	key - *string* The key to check.
		* 	user - *string* / *integer* This is the user id, proboards defaults to current user if not set.
		*
		* Returns:
		* 	*boolean*
		*
		* Examples:
		*	yootil.key.has_value("mykey");
		*/

		has_value: function(key, user){
			if(this.exists(key)){
				if(typeof this.pb_key_obj(key).get != "undefined"){
					var val = this.pb_key_obj(key).get(user || undefined);

					if(val && val.toString().length){
						return true;
					}
				}
			}

			return false;
		},

		/**
		* Method: value
		* 	Gets the key value
		*
		* Parameters:
		* 	key - *string* The key.
		* 	user - *string* / *integer* This is the user id, proboards defaults to current user if not set.
		* 	is_json - *boolean* If true, it will parse the JSON string.
		*
		* Returns:
		* 	*string*
		*
		* Examples:
		*	yootil.key.value("mykey");
		*
		*	yootil.key.value("mykey", null, true); // Parses JSON
		*/

		value: function(key, user, is_json){
			if(this.exists(key)){
				if(this.has_value(key, user)){
					var value = this.pb_key_obj(key).get(user || undefined);

					if(is_json && yootil.is_json(value)){
						value = JSON.parse(value);
					}

					return value;
				}
			}

			return "";
		},

		/**
		* Method: clear
		* 	Clears out key value.
		*
		* Parameters:
		* 	key - *string* The key.
		*	user - *string* / *integer* This is the user id, proboards defaults to current user if not set.
		*
		* Returns:
		* 	*object* - returns yootil.key object to allow chaining.
		*
		* Examples:
		*	yootil.key.clear("mykey");
		*/

		clear: function(key, user){
			this.set(key, "", user);

			return this;
		},

		/**
		* Method: set
		* 	Sets a keys value.
		*
		* Parameters:
		* 	key - *string* The key.
		* 	value - *string* / *object* Can be a string, or a object that will get .
		* 	user - *string* / *integer This is the user id, proboards defaults to current user if not set.
		*
		* Returns:
		*	*boolean*
		*
		* Examples:
		*	yootil.key.set("mykey", "apples");
		*
		*	yootil.key.set("mykey", "apples", null, true); // Save as JSON
		*/

		set: function(key, value, user){
			if(this.exists(key)){

				// No longer need this as ProBoards handles it

				/*if(is_json){
					value = JSON.stringify(value);
				}*/

				if(typeof user == "undefined" || !user || !user.toString().length){
					user = value;
					value = undefined;
				}

				this.pb_key_obj(key).set({

					object_id: user,
					value: value

				});
			}

			return this;
		},

		/**
		* Method: write
		* 	Checks permission on key to see if the user can write
		*
		* Parameters:
		* 	key - *string* The key.
		* 	user - *string* / *integer This is the user id, proboards defaults to current user if not set.
		*
		* Returns:
		*	*boolean*
		*/

		// @TODO: Fix this when ProBoards API has exposed it

		write: function(key, user){
			if(this.exists(key)){
				return true; // For now until can_write is exposed, we will just return true

				return !!this.pb_key_obj(key).can_write(user);
			}

			return false;
		},

		/**
		* Method: read
		* 	Checks permission on key to see if the user can read
		*
		* Parameters:
		* 	key - *string* The key.
		* 	user - *string* / *integer This is the user id, proboards defaults to current user if not set.
		*
		* Returns:
		*	*boolean*
		*/

		// @TODO: Fix this when ProBoards API has exposed it

		read: function(key, user){
			if(this.exists(key)){
				return true; // For now until can_read is exposed, we will just return true

				return !!this.pb_key_obj(key).can_read(user);
			}

			return false;
		}

	};

})();<commit_msg>Added todo items<commit_after>/**
* Namespace: yootil.key
*
* 	This object is a wrapper around the proboards.plugin.key object.
*
* 	Note:  this isn't final, I might change things around a little and add a few more methods.
*
*	Also, things might get changed by ProBoards.
*/

// @TODO: Add easy pop, shift, increment etc methods.  i.e yootil.key.pop(key, id, num_items).
// @TODO: Add support for callbacks (success, error, complete)

yootil.key = (function(){

	return {

		/**
		* Property: pb_key_obj
		*	*object* Holds a reference to the ProBoards key object.
		*/

		pb_key_obj: pb.plugin.key,

		/**
		* Method: exists
		* 	Checks to see if a key exists.
		*
		* Parameters:
		* 	key - *string* The key to check.
		*
		* Returns:
		* 	*boolean*
		*
		* Examples:
		*	yootil.key.exists("mykey");
		*/

		exists: function(key){
			if(key){
				if(this.pb_key_obj){
					if(this.pb_key_obj(key)){
						return true;
					}
				}
			}

			return false;
		},

		/**
		* Method: get_key
		* 	Returns the key object.
		*
		* Parameters:
		* 	key - *string* The key to get.
		*
		* Returns:
		* 	*object* / *boolean*
		*
		* Examples:
		*	yootil.key.get_key("mykey");
		*/

		get_key: function(key){
			if(this.exists(key)){
				return this.pb_key_obj(key);
			}

			return false;
		},

		/**
		* Method: has_value
		* 	Checks to see if a key has a value.
		*
		* Parameters:
		* 	key - *string* The key to check.
		* 	user - *string* / *integer* This is the user id, proboards defaults to current user if not set.
		*
		* Returns:
		* 	*boolean*
		*
		* Examples:
		*	yootil.key.has_value("mykey");
		*/

		has_value: function(key, user){
			if(this.exists(key)){
				if(typeof this.pb_key_obj(key).get != "undefined"){
					var val = this.pb_key_obj(key).get(user || undefined);

					if(val && val.toString().length){
						return true;
					}
				}
			}

			return false;
		},

		/**
		* Method: value
		* 	Gets the key value
		*
		* Parameters:
		* 	key - *string* The key.
		* 	user - *string* / *integer* This is the user id, proboards defaults to current user if not set.
		* 	is_json - *boolean* If true, it will parse the JSON string.
		*
		* Returns:
		* 	*string*
		*
		* Examples:
		*	yootil.key.value("mykey");
		*
		*	yootil.key.value("mykey", null, true); // Parses JSON
		*/

		value: function(key, user, is_json){
			if(this.exists(key)){
				if(this.has_value(key, user)){
					var value = this.pb_key_obj(key).get(user || undefined);

					if(is_json && yootil.is_json(value)){
						value = JSON.parse(value);
					}

					return value;
				}
			}

			return "";
		},

		/**
		* Method: clear
		* 	Clears out key value.
		*
		* Parameters:
		* 	key - *string* The key.
		*	user - *string* / *integer* This is the user id, proboards defaults to current user if not set.
		*
		* Returns:
		* 	*object* - returns yootil.key object to allow chaining.
		*
		* Examples:
		*	yootil.key.clear("mykey");
		*/

		clear: function(key, user){
			this.set(key, "", user);

			return this;
		},

		/**
		* Method: set
		* 	Sets a keys value.
		*
		* Parameters:
		* 	key - *string* The key.
		* 	value - *string* / *object* Can be a string, or a object that will get .
		* 	user - *string* / *integer This is the user id, proboards defaults to current user if not set.
		*
		* Returns:
		*	*boolean*
		*
		* Examples:
		*	yootil.key.set("mykey", "apples");
		*
		*	yootil.key.set("mykey", "apples", null, true); // Save as JSON
		*/

		set: function(key, value, user){
			if(this.exists(key)){

				// No longer need this as ProBoards handles it

				/*if(is_json){
					value = JSON.stringify(value);
				}*/

				if(typeof user == "undefined" || !user || !user.toString().length){
					user = value;
					value = undefined;
				}

				this.pb_key_obj(key).set({

					object_id: user,
					value: value

				});
			}

			return this;
		},

		/**
		* Method: write
		* 	Checks permission on key to see if the user can write
		*
		* Parameters:
		* 	key - *string* The key.
		* 	user - *string* / *integer This is the user id, proboards defaults to current user if not set.
		*
		* Returns:
		*	*boolean*
		*/

		// @TODO: Fix this when ProBoards API has exposed it

		write: function(key, user){
			if(this.exists(key)){
				return true; // For now until can_write is exposed, we will just return true

				return !!this.pb_key_obj(key).can_write(user);
			}

			return false;
		},

		/**
		* Method: read
		* 	Checks permission on key to see if the user can read
		*
		* Parameters:
		* 	key - *string* The key.
		* 	user - *string* / *integer This is the user id, proboards defaults to current user if not set.
		*
		* Returns:
		*	*boolean*
		*/

		// @TODO: Fix this when ProBoards API has exposed it

		read: function(key, user){
			if(this.exists(key)){
				return true; // For now until can_read is exposed, we will just return true

				return !!this.pb_key_obj(key).can_read(user);
			}

			return false;
		}

	};

})();<|endoftext|>


<commit_before>/* Define your initial state here.
 *
 * If you change the type from object to something else, do not forget to update
 * src/container/App.js accordingly.
 */
import { } from '../actions/const';

const initialState = { };

function reducer(state = initialState, action) {
  /* Keep the reducer clean - do not mutate the original state. */
  // let nextState = Object.assign({}, state);

  switch (action.type) {
    /*
    case YOUR_ACTION: {
      // Modify next state depending on the action and return it
      return nextState;
    }
    */
    default: {
      /* Return original state if no actions were consumed. */
      return state;
    }
  }
}

export default reducer;
<commit_msg>Reducer is a function, not an object.<commit_after>/* Define your initial state here.
 *
 * If you change the type from object to something else, do not forget to update
 * src/container/App.js accordingly.
 */
import {} from '../actions/const';

const initialState = {};

function reducer(state = initialState, action) {
  /* Keep the reducer clean - do not mutate the original state. */
  // const nextState = Object.assign({}, state);

  switch (action.type) {
    /*
    case YOUR_ACTION: {
      // Modify next state depending on the action and return it
      return nextState;
    }
    */
    default: {
      /* Return original state if no actions were consumed. */
      return state;
    }
  }
}

module.exports = reducer;
<|endoftext|>


<commit_before>/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

/**
* Lint plugins for linting Markdown in JSDoc comments.
*/
var plugins = [ require( 'remark-lint' ) ];

/**
* Require checkboxes to be either empty (unchecked) or have an `x` (checked).
*
* @see [checkbox-character-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-checkbox-character-style}
*
* @example
* <!-- Bad -->
*
* *   [X] checked
*
* @example
* <!-- Good -->
*
* *   [x] checked
*/
plugins.push([
	require( 'remark-lint-checkbox-character-style' ),
	[
		'error',
		{
			'checked': 'x',
			'unchecked': ' '
		}
	]
]);

/**
* Require fenced code blocks to have a language flag.
*
* @see [fenced-code-flag]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-fenced-code-flag}
*
* @example
* <!-- Bad -->
*
* ```
* code
* ```
*
* @example
* <!-- Good -->
*
* ``` text
* code
* ```
*/
plugins.push([
	require( 'remark-lint-fenced-code-flag' ),
	[
		'error',
		{
			'allowEmpty': false
		}
	]
]);

/**
* Require first heading level be a level `2` heading in JSDoc comments. A level `1` heading is implied.
*
* @see [first-heading-level]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-first-heading-level}
*/
plugins.push([
	require( 'remark-lint-first-heading-level' ),
	[ 'error', 2 ]
]);

/**
* Warn when headings increment by more than 1 level.
*
* @see [heading-increment]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-heading-increment}
*/
plugins.push([
	require( 'remark-lint-heading-increment' ),
	[ 'warn' ]
]);

/**
* Require `atx` heading style.
*
* @see [heading-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-heading-style}
*
* @example
* <!-- Bad -->
*
* Beep
* ===
*
* ## Boop
*
* @example
* <!-- Good -->
*
* # Beep
*
* ## Boop
*
*/
plugins.push([
	require( 'remark-lint-heading-style' ),
	[ 'error', 'atx' ]
]);

/**
* Require Unix linebreaks.
*
* @see [linebreak-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-linebreak-style}
*/
plugins.push([
	require( 'remark-lint-linebreak-style' ),
	[ 'error', 'unix' ]
]);

/**
* Require double quotes for link titles.
*
* @see [link-title-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-link-title-style}
*
* @example
* <!-- Bad -->
*
* [example](https://example.com (Example))
*
* @example
* <!-- Good -->
*
* [example](https://example.com "Example")
*/
plugins.push([
	require( 'remark-lint-link-title-style' ),
	[ 'error', '"' ]
]);

/**
* Require list items use tab-size indentation.
*
* @see [list-item-indent]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-list-item-indent}
*
* @example
* <!-- Bad -->
*
* * Hello
* * World
*
* @example
* <!-- Good -->
*
* *   Hello
* *   World
*
* @example
* <!-- Good -->
*
* *   Beep
*     boop
*
* *   Bop
*     bip
*
*/
plugins.push([
	require( 'remark-lint-list-item-indent' ),
	[ 'error', 'tab-size' ]
]);

/**
* Require consistent list item spacing.
*
* @see [list-item-spacing]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-list-item-spacing}
*
* @example
* <!-- Bad -->
*
* *   Beep
* *   Boop
*
* *   Bop
*
* @example
* <!-- Good -->
*
* *   Beep
* *   Boop
* *   Bop
*
* @example
* <!-- Okay -->
*
* *   Beep
*
* *   Boop
*
* *   Bop
*
*/
plugins.push([
	require( 'remark-lint-list-item-spacing' ),
	[ 'error' ]
]);

/**
* Require that heading lengths be less than or equal to `80` characters.
*
* @see [maximum-heading-length]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-maximum-heading-length}
*/
plugins.push([
	require( 'remark-lint-maximum-heading-length' ),
	[ 'error', 80 ]
]);

/**
* Do not enforce a maximum line length.
*
* @see [maximum-line-length]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-maximum-line-length}
*/
plugins.push([
	require( 'remark-lint-maximum-line-length' ),
	[ 'off' ]
]);

/**
* Allow consecutive blank lines.
*
* @see [no-consecutive-blank-lines]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-no-consecutive-blank-lines}
*/
plugins.push([
	require( 'remark-lint-no-consecutive-blank-lines' ),
	[ 'off' ]
]);

/**
* Require blank lines between block nodes.
*
* @see [no-missing-blank-lines]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-no-missing-blank-lines}
*
* @example
* <!-- Bad -->
*
* # Beep
* ## Boop
*
* @example
* <!-- Good -->
*
* # Beep
*
* ## Boop
*
*/
plugins.push([
	require( 'remark-lint-no-missing-blank-lines' ),
	[
		'error',
		{
			'exceptTightLists': true
		}
	]
]);

/**
* Allow multiple top-level headings.
*
* @see [no-multiple-toplevel-headings]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-no-multiple-toplevel-headings}
*
* @example
* <!-- Okay -->
*
* # Beep
*
* # Boop
*
*/
plugins.push([
	require( 'remark-lint-no-multiple-toplevel-headings' ),
	[ 'off' ]
]);

/**
* Require ordered lists to use periods (e.g., `1.`, `2.`, etc).
*
* @see [ordered-list-marker-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-ordered-list-marker-style}
*
* @example
* <!-- Bad -->
*
* 1) Foo
* 2) Bar
*
* @example
* <!-- Good -->
*
* 1. Foo
* 2. Bar
*
*/
plugins.push([
	require( 'remark-lint-ordered-list-marker-style' ),
	[ 'error', '.' ]
]);

/**
* Prefer ordered, but allow discretion when determining appropriate ordered list marker value.
*
* @see [ordered-list-marker-value]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-ordered-list-marker-value}
*
* @example
* <!-- Okay -->
*
* 1. Foo
* 2. Bar
* 3. Beep
* 4. Boop
*
* @example
* <!-- Okay -->
*
* 1. Foo
* 1. Bar
* 1. Beep
* 1. Boop
*
*/
plugins.push([
	require( 'remark-lint-ordered-list-marker-value' ),
	[ 'off', 'ordered' ]
]);

/**
* Require that the horizontal rule style be three consecutive asterisks `---`.
*
* @see [rule-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-rule-style}
*
* @example
* <!-- Bad -->
*
* ---
*
* @example
* <!-- Good -->
*
* * * *
*
*/
plugins.push([
	require( 'remark-lint-rule-style' ),
	[ 'error', '* * *' ]
]);

/**
* Set the strong marker to asterisks.
*
* @see [strong-marker]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-strong-marker}
*
* @example
* <!-- Bad -->
*
* __Beep__.
*
* @example
* <!-- Good -->
*
* **Beep**.
*
*/
plugins.push([
	require( 'remark-lint-strong-marker' ),
	[ 'error', '*' ]
]);

/**
* Require table padding.
*
* @see [table-cell-padding]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-table-cell-padding}
*
* @example
* <!-- Bad -->
*
* |Beep|Boop|
* |----|----|
* |foo |bar |
*
* @example
* <!-- Good -->
*
* | Beep | Boop |
* | ---- | ---- |
* | foo  | bar  |
*
*/
plugins.push([
	require( 'remark-lint-table-cell-padding' ),
	[ 'error', 'padded' ]
]);

/**
* Require that the unordered list marker be a dash `-`.
*
* @see [unordered-list-marker-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-unordered-list-marker-style}
*
* @example
* <!-- Bad -->
*
* *   Beep
* *   Boop
*
* @example
* <!-- Okay -->
*
* -   Beep
*
*     -   Foo
*     -   Bar
*
* -   Boop
*
*/
plugins.push([
	require( 'remark-lint-unordered-list-marker-style' ),
	[ 'error', '-' ]
]);

// EXPORTS //

module.exports = plugins;
<commit_msg>Remove plugin<commit_after>/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

/**
* Lint plugins for linting Markdown in JSDoc comments.
*/
var plugins = [ require( 'remark-lint' ) ];

/**
* Require checkboxes to be either empty (unchecked) or have an `x` (checked).
*
* @see [checkbox-character-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-checkbox-character-style}
*
* @example
* <!-- Bad -->
*
* *   [X] checked
*
* @example
* <!-- Good -->
*
* *   [x] checked
*/
plugins.push([
	require( 'remark-lint-checkbox-character-style' ),
	[
		'error',
		{
			'checked': 'x',
			'unchecked': ' '
		}
	]
]);

/**
* Require fenced code blocks to have a language flag.
*
* @see [fenced-code-flag]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-fenced-code-flag}
*
* @example
* <!-- Bad -->
*
* ```
* code
* ```
*
* @example
* <!-- Good -->
*
* ``` text
* code
* ```
*/
plugins.push([
	require( 'remark-lint-fenced-code-flag' ),
	[
		'error',
		{
			'allowEmpty': false
		}
	]
]);

/**
* Require first heading level be a level `2` heading in JSDoc comments. A level `1` heading is implied.
*
* @see [first-heading-level]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-first-heading-level}
*/
plugins.push([
	require( 'remark-lint-first-heading-level' ),
	[ 'error', 2 ]
]);

/**
* Warn when headings increment by more than 1 level.
*
* @see [heading-increment]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-heading-increment}
*/
plugins.push([
	require( 'remark-lint-heading-increment' ),
	[ 'warn' ]
]);

/**
* Require `atx` heading style.
*
* @see [heading-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-heading-style}
*
* @example
* <!-- Bad -->
*
* Beep
* ===
*
* ## Boop
*
* @example
* <!-- Good -->
*
* # Beep
*
* ## Boop
*
*/
plugins.push([
	require( 'remark-lint-heading-style' ),
	[ 'error', 'atx' ]
]);

/**
* Require Unix linebreaks.
*
* @see [linebreak-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-linebreak-style}
*/
plugins.push([
	require( 'remark-lint-linebreak-style' ),
	[ 'error', 'unix' ]
]);

/**
* Require double quotes for link titles.
*
* @see [link-title-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-link-title-style}
*
* @example
* <!-- Bad -->
*
* [example](https://example.com (Example))
*
* @example
* <!-- Good -->
*
* [example](https://example.com "Example")
*/
plugins.push([
	require( 'remark-lint-link-title-style' ),
	[ 'error', '"' ]
]);

/**
* Require list items use tab-size indentation.
*
* @see [list-item-indent]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-list-item-indent}
*
* @example
* <!-- Bad -->
*
* * Hello
* * World
*
* @example
* <!-- Good -->
*
* *   Hello
* *   World
*
* @example
* <!-- Good -->
*
* *   Beep
*     boop
*
* *   Bop
*     bip
*
*/
plugins.push([
	require( 'remark-lint-list-item-indent' ),
	[ 'error', 'tab-size' ]
]);

/**
* Require consistent list item spacing.
*
* @see [list-item-spacing]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-list-item-spacing}
*
* @example
* <!-- Bad -->
*
* *   Beep
* *   Boop
*
* *   Bop
*
* @example
* <!-- Good -->
*
* *   Beep
* *   Boop
* *   Bop
*
* @example
* <!-- Okay -->
*
* *   Beep
*
* *   Boop
*
* *   Bop
*
*/
plugins.push([
	require( 'remark-lint-list-item-spacing' ),
	[ 'error' ]
]);

/**
* Require that heading lengths be less than or equal to `80` characters.
*
* @see [maximum-heading-length]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-maximum-heading-length}
*/
plugins.push([
	require( 'remark-lint-maximum-heading-length' ),
	[ 'error', 80 ]
]);

/**
* Do not enforce a maximum line length.
*
* @see [maximum-line-length]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-maximum-line-length}
*/
plugins.push([
	require( 'remark-lint-maximum-line-length' ),
	[ 'off' ]
]);

/**
* Require blank lines between block nodes.
*
* @see [no-missing-blank-lines]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-no-missing-blank-lines}
*
* @example
* <!-- Bad -->
*
* # Beep
* ## Boop
*
* @example
* <!-- Good -->
*
* # Beep
*
* ## Boop
*
*/
plugins.push([
	require( 'remark-lint-no-missing-blank-lines' ),
	[
		'error',
		{
			'exceptTightLists': true
		}
	]
]);

/**
* Allow multiple top-level headings.
*
* @see [no-multiple-toplevel-headings]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-no-multiple-toplevel-headings}
*
* @example
* <!-- Okay -->
*
* # Beep
*
* # Boop
*
*/
plugins.push([
	require( 'remark-lint-no-multiple-toplevel-headings' ),
	[ 'off' ]
]);

/**
* Require ordered lists to use periods (e.g., `1.`, `2.`, etc).
*
* @see [ordered-list-marker-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-ordered-list-marker-style}
*
* @example
* <!-- Bad -->
*
* 1) Foo
* 2) Bar
*
* @example
* <!-- Good -->
*
* 1. Foo
* 2. Bar
*
*/
plugins.push([
	require( 'remark-lint-ordered-list-marker-style' ),
	[ 'error', '.' ]
]);

/**
* Prefer ordered, but allow discretion when determining appropriate ordered list marker value.
*
* @see [ordered-list-marker-value]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-ordered-list-marker-value}
*
* @example
* <!-- Okay -->
*
* 1. Foo
* 2. Bar
* 3. Beep
* 4. Boop
*
* @example
* <!-- Okay -->
*
* 1. Foo
* 1. Bar
* 1. Beep
* 1. Boop
*
*/
plugins.push([
	require( 'remark-lint-ordered-list-marker-value' ),
	[ 'off', 'ordered' ]
]);

/**
* Require that the horizontal rule style be three consecutive asterisks `---`.
*
* @see [rule-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-rule-style}
*
* @example
* <!-- Bad -->
*
* ---
*
* @example
* <!-- Good -->
*
* * * *
*
*/
plugins.push([
	require( 'remark-lint-rule-style' ),
	[ 'error', '* * *' ]
]);

/**
* Set the strong marker to asterisks.
*
* @see [strong-marker]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-strong-marker}
*
* @example
* <!-- Bad -->
*
* __Beep__.
*
* @example
* <!-- Good -->
*
* **Beep**.
*
*/
plugins.push([
	require( 'remark-lint-strong-marker' ),
	[ 'error', '*' ]
]);

/**
* Require table padding.
*
* @see [table-cell-padding]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-table-cell-padding}
*
* @example
* <!-- Bad -->
*
* |Beep|Boop|
* |----|----|
* |foo |bar |
*
* @example
* <!-- Good -->
*
* | Beep | Boop |
* | ---- | ---- |
* | foo  | bar  |
*
*/
plugins.push([
	require( 'remark-lint-table-cell-padding' ),
	[ 'error', 'padded' ]
]);

/**
* Require that the unordered list marker be a dash `-`.
*
* @see [unordered-list-marker-style]{@link https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-unordered-list-marker-style}
*
* @example
* <!-- Bad -->
*
* *   Beep
* *   Boop
*
* @example
* <!-- Okay -->
*
* -   Beep
*
*     -   Foo
*     -   Bar
*
* -   Boop
*
*/
plugins.push([
	require( 'remark-lint-unordered-list-marker-style' ),
	[ 'error', '-' ]
]);

// EXPORTS //

module.exports = plugins;
<|endoftext|>


<commit_before>import screenJs from '../../lib/screen';

/**
 * @param html:String
 * @param findFile:Function
 * @param scriptFiles:Array<_File>
 * @return Promise<String>
 *
 * iframe にユーザーが入力したHTMLに、次の操作を加える
 * 1. headタグの一番上に screenJs を埋め込む
 * 2. src 属性を BinaryFile の Data URL に差し替える
 * 3. screenJs のすぐ下で、全てのスクリプトを define する
 * 4. スクリプトタグの src 属性を requirejs を Data URL に差し替える
 */
export default async (html, findFile, scriptFiles) => {

  const parser = new DOMParser();
  const doc = parser.parseFromString(html, 'text/html');

  // 1. headタグの一番上に screenJs を埋め込む
  const screenJsScript = doc.createElement('script');
  screenJsScript.text = screenJs;
  doc.head.insertBefore(screenJsScript, doc.head.firstChild);

  // 2. src 属性を BinaryFile の Data URL に差し替える
  const binaries = [...doc.images];
  for (const node of binaries) {
    const file = findFile(node.getAttribute('src'));
    if (!file) continue;

    const dataURL = await file.toDataURL();
    node.setAttribute('src', dataURL);
  }

  // 3. screenJs のすぐ下で、全てのスクリプトを define する
  const defineScript = doc.createElement('script');
  defineScript.text = scriptFiles.map(defineTemplate).join('');
  doc.head.insertBefore(defineScript, screenJs.nextSibling);

  // 4. スクリプトタグの src 属性を requirejs を Data URL に差し替える
  for (const node of doc.scripts) {
    const file = findFile(node.getAttribute('src'));
    if (!file) continue;

    const dataURL =
      'data:text/javascript;charset=UTF-8,' +
      encodeURIComponent(requireTemplate(file.moduleName, scriptFiles));
    node.setAttribute('src', dataURL);
  }

  return doc.documentElement.outerHTML;

}

const defineTemplate = (file) => `;
define('${file.moduleName}', new Function('require, exports, module', '${
  file.text
    .replace(/\'/g, '\\\'')
    .replace(/\n/g, '\\n')
}'))`;

const requireTemplate = (src, scriptFiles) =>
`requirejs({
  map: {
    '*': {
      ${scriptFiles.map(nameToModuleName).join()}
    }
  }
}, ['${src}'], function () {})`;

const nameToModuleName = (file) => `"${file.name}":"${file.moduleName}"`;
<commit_msg>bug fix<commit_after>import screenJs from '../../lib/screen';

/**
 * @param html:String
 * @param findFile:Function
 * @param scriptFiles:Array<_File>
 * @return Promise<String>
 *
 * iframe にユーザーが入力したHTMLに、次の操作を加える
 * 1. headタグの一番上に screenJs を埋め込む
 * 2. src 属性を BinaryFile の Data URL に差し替える
 * 3. screenJs のすぐ下で、全てのスクリプトを define する
 * 4. スクリプトタグの src 属性を requirejs を Data URL に差し替える
 */
export default async (html, findFile, scriptFiles) => {

  const parser = new DOMParser();
  const doc = parser.parseFromString(html, 'text/html');

  // 1. headタグの一番上に screenJs を埋め込む
  const screenJsScript = doc.createElement('script');
  screenJsScript.text = screenJs;
  doc.head.insertBefore(screenJsScript, doc.head.firstChild);

  // 2. src 属性を BinaryFile の Data URL に差し替える
  const binaries = [...doc.images];
  for (const node of binaries) {
    const file = findFile(node.getAttribute('src'));
    if (!file) continue;

    const dataURL = await file.toDataURL();
    node.setAttribute('src', dataURL);
  }

  // 3. screenJs のすぐ下で、全てのスクリプトを define する
  const defineScript = doc.createElement('script');
  defineScript.text = scriptFiles.map(defineTemplate).join('');
  doc.head.insertBefore(defineScript, screenJs.nextSibling);

  // 4. スクリプトタグの src 属性を requirejs を Data URL に差し替える
  for (const node of [...doc.scripts]) {
    const file = findFile(node.getAttribute('src'));
    if (!file) continue;

    const dataURL =
      'data:text/javascript;charset=UTF-8,' +
      encodeURIComponent(requireTemplate(file.moduleName, scriptFiles));
    node.setAttribute('src', dataURL);
  }

  return doc.documentElement.outerHTML;

}

const defineTemplate = (file) => `;
define('${file.moduleName}', new Function('require, exports, module', '${
  file.text
    .replace(/\'/g, '\\\'')
    .replace(/\n/g, '\\n')
}'))`;

const requireTemplate = (src, scriptFiles) =>
`requirejs({
  map: {
    '*': {
      ${scriptFiles.map(nameToModuleName).join()}
    }
  }
}, ['${src}'], function () {})`;

const nameToModuleName = (file) => `"${file.name}":"${file.moduleName}"`;
<|endoftext|>


<commit_before>'use strict';

exports.join = function(app, socket){
  return function() {
    socket.visitor = 'guest';
    if (socket.handshake.user) {
      socket.visitor = socket.handshake.user.username;
    }

    socket.join('/account/timeline/');
    socket.broadcast.to('/account/timeline').emit('/account/timeline/#newVisitor', socket.visitor);
  };
};

exports.clock = function(app, socket){
	var io = require('socket.io-client');
	var ex_socket = new io.connect("http://171.65.102.132:3006");
	ex_socket.on('connect', function() {
		ex_socket.emit('lookclock');
	});
	ex_socket.on('server_clock', function(data){
  		return function(data) {
    		socket.broadcast.to('/account/timeline').emit('/about/timeline/#show-clock', data);
  	  };
  });
};

exports.blocks-delivery = function(app, socket){
  return function(message) {
    socket.broadcast.to('/account/timeline').emit('/about/timeline/#incoming', socket.visitor, message);
  };
};

exports.reserve = function(app, socket){
  return function(message) {
    socket.broadcast.to('/account/timeline').emit('/about/timeline/#incoming', socket.visitor, message);
  };
};

/*

// look clock
socket.emit('lookclock');

//call blocks
socket.emit('timeline', { type: 'callblocks', user:username, begintime: beginT, endtime: endT});

//reserve block
socket.emit('timeline', { type: 'reserveblock', user:user.username, begintime: beginT, endtime: endT});<commit_msg>socket migration<commit_after>'use strict';

exports.join = function(app, socket){
  return function() {
    socket.visitor = 'guest';
    if (socket.handshake.user) {
      socket.visitor = socket.handshake.user.username;
    }

    socket.join('/account/timeline/');
    socket.broadcast.to('/account/timeline').emit('/account/timeline/#newVisitor', socket.visitor);
  };
};

exports.clock = function(app, socket){
	var io = require('socket.io-client');
	var ex_socket = new io.connect("http://171.65.102.132:3006");
	ex_socket.on('connect', function() {
		ex_socket.emit('lookclock');
	});
	ex_socket.on('server_clock', function(data){
  		return function(data) {
    		socket.broadcast.to('/account/timeline').emit('/about/timeline/#show-clock', data);
  	  };
  });
};

exports.blocks-delivery = function(app, socket){
  return function(message) {
    socket.broadcast.to('/account/timeline').emit('/about/timeline/#incoming', socket.visitor, message);
  };
};

exports.reserve = function(app, socket){
  return function(message) {
    socket.broadcast.to('/account/timeline').emit('/about/timeline/#incoming', socket.visitor, message);
  };
};

/*

// look clock
socket.emit('lookclock');

//call blocks
socket.emit('timeline', { type: 'callblocks', user:username, begintime: beginT, endtime: endT});

//reserve block
socket.emit('timeline', { type: 'reserveblock', user:user.username, begintime: beginT, endtime: endT});*/<|endoftext|>


<commit_before>var columnDefs = [
    {headerName: "Athlete", field: "athlete", width: 150},
    {headerName: "Age", field: "age", width: 90, filter: 'agNumberColumnFilter'},
    {headerName: "Country", field: "country", width: 120},
    {headerName: "Year", field: "year", width: 90},
    {headerName: "Date", field: "date", width: 160, filter:'agDateColumnFilter', filterParams:{
        comparator:function (filterLocalDateAtMidnight, cellValue){
            var dateAsString = cellValue;
            var dateParts  = dateAsString.split("/");
            var cellDate = new Date(Number(dateParts[2]), Number(dateParts[1]) - 1, Number(dateParts[0]));

            if (filterLocalDateAtMidnight.getTime() === cellDate.getTime()) {
                return 0
            }

            if (cellDate < filterLocalDateAtMidnight) {
                return -1;
            }

            if (cellDate > filterLocalDateAtMidnight) {
                return 1;
            }
        }
    }},
    {headerName: "Sport", field: "sport", width: 110},
    {headerName: "Gold", field: "gold", width: 100, filter: 'agNumberColumnFilter'},
    {headerName: "Silver", field: "silver", width: 100, filter: 'agNumberColumnFilter'},
    {headerName: "Bronze", field: "bronze", width: 100, filter: 'agNumberColumnFilter'},
    {headerName: "Total", field: "total", width: 100, filter: 'agNumberColumnFilter', suppressFilter: true}
];

var gridOptions = {
    floatingFilter:true,
    columnDefs: columnDefs,
    rowData: null,
    enableFilter: true,
    // Here is where we specify the component to be used as the date picker widget
    components:{
        dateComponent: CustomDateComponent
    }
};

// function onFilterChanged(value) {
//     gridOptions.api.setQuickFilter(value);
// }

// setup the grid after the page has finished loading
document.addEventListener('DOMContentLoaded', function() {
    var gridDiv = document.querySelector('#myGrid');
    new agGrid.Grid(gridDiv, gridOptions);

    // do http request to get our sample data - not using any framework to keep the example self contained.
    // you will probably use a framework like JQuery, Angular or something else to do your HTTP calls.
    var httpRequest = new XMLHttpRequest();
    httpRequest.open('GET', 'https://raw.githubusercontent.com/ag-grid/ag-grid-docs/master/src/olympicWinners.json');
    httpRequest.send();
    httpRequest.onreadystatechange = function() {
        if (httpRequest.readyState === 4 && httpRequest.status === 200) {
            var httpResult = JSON.parse(httpRequest.responseText);
            gridOptions.api.setRowData(httpResult);
        }
    };
});
<commit_msg>AG-661 Correct examples<commit_after>var columnDefs = [
    {headerName: "Athlete", field: "athlete", width: 150},
    {headerName: "Age", field: "age", width: 90, filter: 'agNumberColumnFilter'},
    {headerName: "Country", field: "country", width: 120},
    {headerName: "Year", field: "year", width: 90},
    {headerName: "Date", field: "date", width: 160, filter:'agDateColumnFilter', filterParams:{
        comparator:function (filterLocalDateAtMidnight, cellValue){
            var dateAsString = cellValue;
            var dateParts  = dateAsString.split("/");
            var cellDate = new Date(Number(dateParts[2]), Number(dateParts[1]) - 1, Number(dateParts[0]));

            if (filterLocalDateAtMidnight.getTime() === cellDate.getTime()) {
                return 0
            }

            if (cellDate < filterLocalDateAtMidnight) {
                return -1;
            }

            if (cellDate > filterLocalDateAtMidnight) {
                return 1;
            }
        }
    }},
    {headerName: "Sport", field: "sport", width: 110},
    {headerName: "Gold", field: "gold", width: 100, filter: 'agNumberColumnFilter'},
    {headerName: "Silver", field: "silver", width: 100, filter: 'agNumberColumnFilter'},
    {headerName: "Bronze", field: "bronze", width: 100, filter: 'agNumberColumnFilter'},
    {headerName: "Total", field: "total", width: 100, filter: 'agNumberColumnFilter', suppressFilter: true}
];

var gridOptions = {
    floatingFilter:true,
    columnDefs: columnDefs,
    rowData: null,
    enableFilter: true,
    // Here is where we specify the component to be used as the date picker widget
    components:{
        agDateColumnFilter: CustomDateComponent
    }
};

// setup the grid after the page has finished loading
document.addEventListener('DOMContentLoaded', function() {
    var gridDiv = document.querySelector('#myGrid');
    new agGrid.Grid(gridDiv, gridOptions);

    // do http request to get our sample data - not using any framework to keep the example self contained.
    // you will probably use a framework like JQuery, Angular or something else to do your HTTP calls.
    var httpRequest = new XMLHttpRequest();
    httpRequest.open('GET', 'https://raw.githubusercontent.com/ag-grid/ag-grid-docs/master/src/olympicWinners.json');
    httpRequest.send();
    httpRequest.onreadystatechange = function() {
        if (httpRequest.readyState === 4 && httpRequest.status === 200) {
            var httpResult = JSON.parse(httpRequest.responseText);
            gridOptions.api.setRowData(httpResult);
        }
    };
});
<|endoftext|>


<commit_before>/**
 * Created by Roland on 4/3/2014.
 */
var formExtensionTranslations = {
    required: "{0} is verplicht.",
    email: "Het veld {0} moet een geldig email adres zijn..",
    minlength: "{0} moet minstens {1} karakters(s) zijn.",
    maxlength: "{0} moet minder dan {1} karakters(s) zijn.",
    min: "{0} moet minstens {1} zijn.",
    max: "{0} moet maximaal {1} zijn.",
    pattern: "{0} is ongeldig.",
    url: "{0} moet een geldige URL zijn.",
    number: "{0} moet een getal zijn.",
    thisFieldLabel:'Dit veld'
};<commit_msg>Update aa.validationMessageTranslations.js<commit_after>/**
 * Created by Roland on 4/3/2014.
 */
var formExtensionTranslations = {
    required: "{0} is verplicht.",
    email: "Het veld {0} moet een geldig email adres zijn..",
    minlength: "{0} moet minstens {1} karakters(s) zijn.",
    maxlength: "{0} moet minder dan {1} karakters(s) zijn.",
    min: "{0} moet minstens {1} zijn.",
    max: "{0} moet maximaal {1} zijn.",
    pattern: "{0} is ongeldig.",
    url: "{0} moet een geldige URL zijn.",
    number: "{0} moet een getal zijn.",
    thisFieldLabel:'Dit veld'
    validationTitle: 'There are some validation errors'
};
<|endoftext|>


<commit_before>const BinarySocket     = require('../socket');
const showLoadingImage = require('../../base/utility').showLoadingImage;
const getHighstock     = require('../../common_functions/common_functions').requireHighstock;

const currencyFormatter = function () {
    return `$${this.value.toFixed(2)}`;
};
const tooltipFormatter = function () {
    return `$${this.y.toFixed(2)}`;
};
const chartConfig = ({keys, values, callback}) => ({
    chart: {
        type  : 'column',
        events: {
            load: callback,
        },
    },
    title: { text: '', enabled: false },
    xAxis: {
        categories: keys,
        crosshair : true,
        labels    : {
            formatter: currencyFormatter,
            style    : { color: '#C2C2C2' },
        },
    },
    yAxis: {
        min   : 0,
        title : { enabled: false },
        labels: {
            style: { color: '#C2C2C2' },
        },
    },
    tooltip: {
        formatter: tooltipFormatter,
        shared   : true,
        useHTML  : true,
    },
    plotOptions: {
        column: {
            color       : '#E98024',
            pointPadding: 0,
            borderWidth : 0,
        },
    },
    legend : false,
    credits: false,
    series : [{
        data: values,
    }],
});

const ICOInfo = (() => {
    let is_initialized,
        Highcharts,
        $loading,
        $labels,
        $root,
        chart;

    const init = (ico_info) => {
        if (is_initialized) return;

        $root.find('.finalPrice').text(ico_info.final_price);

        const keys = Object.keys(ico_info.histogram).map(key => +key).sort();
        const values = keys.map((key) => ico_info.histogram[`${key}`]);
        const config = chartConfig({
            keys,
            values,
            callback: () => {
                $loading.hide();
                $labels.setVisibility(1);
            },
        });

        if (keys.length > 0) {
            const $chart = $root.find('.barChart');
            chart = Highcharts.chart($chart[0],  config);
            is_initialized = true;
        } else {
            $root.hide();
        }

        console.warn(ico_info);
    };

    const onLoad = () => {
        $root = $('#ico_info');
        $loading = $root.find('> .loading');
        $labels = $root.find('.x-label,.y-label');
        $loading.show();
        showLoadingImage($loading[0]);

        getHighstock((Highstock) => {
            Highcharts = Highstock;
            BinarySocket.wait('website_status').then((response) => {
                init(response.website_status.ico_info);
            });
        });
    };

    const onUnload = () => {
        if (is_initialized) {
            chart.destroy();
            chart = null;
        }
        is_initialized = false;
    };

    return {
        onLoad,
        onUnload,
    };
})();

module.exports = ICOInfo;
<commit_msg>add plotline for final price<commit_after>const BinarySocket     = require('../socket');
const showLoadingImage = require('../../base/utility').showLoadingImage;
const getHighstock     = require('../../common_functions/common_functions').requireHighstock;

const tooltipFormatter = function () {
    return `$${this.y.toFixed(2)}`;
};
const chartConfig = ({categories, values, plotLineIndex, plotLineLabel, callback}) => ({
    chart: {
        type  : 'column',
        events: {
            load: callback,
        },
    },
    title: { text: '', enabled: false },
    xAxis: {
        categories,
        crosshair: true,
        labels   : {
            style: { color: '#C2C2C2' },
        },
        plotLines: !!plotLineIndex && [{
            color    : '#E98024',
            width    : 2,
            dashStyle: 'ShortDash',
            value    : plotLineIndex,
            label    : { text: plotLineLabel },
        }],
    },
    yAxis: {
        min   : 0,
        title : { enabled: false },
        labels: {
            style: { color: '#C2C2C2' },
        },
    },
    tooltip: {
        formatter: tooltipFormatter,
        shared   : true,
        useHTML  : true,
    },
    plotOptions: {
        column: {
            color       : '#E98024',
            pointPadding: 0,
            borderWidth : 0,
        },
    },
    legend : false,
    credits: false,
    series : [{
        data: values,
    }],
});

const ICOInfo = (() => {
    let is_initialized,
        Highcharts,
        $loading,
        $labels,
        $root,
        chart;

    const init = (ico_info) => {
        if (is_initialized) return;

        $root.find('.finalPrice').text(ico_info.final_price);
        const final_price = +ico_info.final_price;
        let plotLineIndex = 0;

        const BUCKET_COUNT = 40;;
        const bucket_size = ico_info.histogram_bucket_size;

        const keys = Object.keys(ico_info.histogram)
                           .map(key => +key)
                           .sort((a,b) => a - b);
        const allKeys = [];
        const allValues = [];
        let categories = [];
        if (keys.length > 0) {
            const max = keys[keys.length - 1];
            const min = Math.max(
                +(max - BUCKET_COUNT * bucket_size).toFixed(2), 1
            );
            for(let key = max; key >= min; key -= bucket_size ) {
                key = +key.toFixed(2);
                allKeys.unshift(key);
                const value = keys.indexOf(key) !== -1 ? ico_info.histogram[`${key}`] : 0;
                const color = key >= final_price ? '#E98024' : '#C2C2C2';
                allValues.unshift({ y: value, color });
            }

            const lessThanMin = keys.filter(key => key < min)
                .map(key => ico_info.histogram[`${key}`])
                .reduce((a,b) => a+b, 0);
            if (lessThanMin !== 0) {
                allKeys.unshift(0);
                const color = min >= final_price ? '#E98024' : '#C2C2C2';
                allValues.unshift({ y: lessThanMin, color});
            }
            for (let inx = 0; inx < allKeys.length; ++inx) {
                if (final_price === allKeys[inx]) {
                    plotLineIndex = inx;
                } else if (final_price > allKeys[inx]) {
                    plotLineIndex = inx + 0.5;
                }
            }
            categories = allKeys.map(key => key ===  0 ? `< ${min}` : `$${key}`);
        }
        const config = chartConfig({
            categories,
            plotLineIndex,
            values       : allValues,
            plotLineLabel: `Final Price ($${final_price})`,
            callback     : () => {
                $loading.hide();
                $labels.setVisibility(1);
            },
        });

        if (keys.length > 0) {
            const $chart = $root.find('.barChart');
            chart = Highcharts.chart($chart[0],  config);
            is_initialized = true;
        } else {
            $root.hide();
        }
    };

    const onLoad = () => {
        $root = $('#ico_info');
        $loading = $root.find('> .loading');
        $labels = $root.find('.x-label,.y-label');
        $loading.show();
        showLoadingImage($loading[0]);

        getHighstock((Highstock) => {
            Highcharts = Highstock;
            BinarySocket.wait('website_status').then((response) => {
                init(response.website_status.ico_info);
            });
        });
    };

    const onUnload = () => {
        if (is_initialized) {
            chart.destroy();
            chart = null;
        }
        is_initialized = false;
    };

    return {
        onLoad,
        onUnload,
    };
})();

module.exports = ICOInfo;
<|endoftext|>


<commit_before>import { LightningElement, api, track, wire } from 'lwc';
import { getPicklistValues } from 'lightning/uiObjectInfoApi';

export default class GeFormFieldPicklist extends LightningElement {
    @api objectName;
    @api fieldName;
    @api label;
    @api variant;
    @api required;
    @api value;
    @api objectDescribeInfo;
    @api className;

    @track _objectDescribeInfo;
    @track picklistValues;
    @track defaultRecordTypeId;

    @wire(getPicklistValues, {
        fieldApiName: '$fullFieldApiName',
        recordTypeId: '$defaultRecordTypeId' })
    wiredPicklistValues({error, data}) {
        if(data) {
            this.picklistValues = data.values;
        }
        if(error) {
            console.error(error);
        }
    }

    @api
    set objectDescribeInfo(val) {
        this._objectDescribeInfo = val;
        if(val) {
            this.defaultRecordTypeId = val.defaultRecordTypeId;
        } else {
            this.defaultRecordTypeId = null;
        }
    }

    get objectDescribeInfo() {
        return this._objectDescribeInfo;
    }

    get fullFieldApiName() {
        return `${this.objectName}.${this.fieldName}`;
    }

    handleValueChange(event) {
        this.value = event.detail.value;
        this.dispatchEvent(new CustomEvent('onchange', event)); // bubble up to ge-form-field
    }

    @api
    reportValidity(){
        const picklistField = this.template.querySelector('lightning-combobox');
        return picklistField.reportValidity();
    }

    @api
    checkValidity(){
        const picklistField = this.template.querySelector('lightning-combobox');
        return picklistField.checkValidity();
    }

}<commit_msg>Remove duplicate objectDescribeInfo<commit_after>import { LightningElement, api, track, wire } from 'lwc';
import { getPicklistValues } from 'lightning/uiObjectInfoApi';

export default class GeFormFieldPicklist extends LightningElement {
    @api objectName;
    @api fieldName;
    @api label;
    @api variant;
    @api required;
    @api value;
    @api className;

    @track _objectDescribeInfo;
    @track picklistValues;
    @track defaultRecordTypeId;

    @wire(getPicklistValues, {
        fieldApiName: '$fullFieldApiName',
        recordTypeId: '$defaultRecordTypeId' })
    wiredPicklistValues({error, data}) {
        if(data) {
            this.picklistValues = data.values;
        }
        if(error) {
            console.error(error);
        }
    }

    @api
    set objectDescribeInfo(val) {
        this._objectDescribeInfo = val;
        if(val) {
            this.defaultRecordTypeId = val.defaultRecordTypeId;
        } else {
            this.defaultRecordTypeId = null;
        }
    }

    get objectDescribeInfo() {
        return this._objectDescribeInfo;
    }

    get fullFieldApiName() {
        return `${this.objectName}.${this.fieldName}`;
    }

    handleValueChange(event) {
        this.value = event.detail.value;
        this.dispatchEvent(new CustomEvent('onchange', event)); // bubble up to ge-form-field
    }

    @api
    reportValidity(){
        const picklistField = this.template.querySelector('lightning-combobox');
        return picklistField.reportValidity();
    }

    @api
    checkValidity(){
        const picklistField = this.template.querySelector('lightning-combobox');
        return picklistField.checkValidity();
    }

}<|endoftext|>


<commit_before>angular.module('rt.eventemitter', []).factory('eventEmitter', function () {
    var key = '_listeners';

    function on($scope, event, fn) {
        if (typeof $scope === 'string') {
            fn = event;
            event = $scope;
            $scope = null;
        }

        if (!this[key]) {
            this[key] = {};
        }

        var events = this[key];
        if (!events[event]) {
            events[event] = [];
        }

        events[event].push(fn);

        var self = this;
        if ($scope) {
            $scope.$on('$destroy', function () {
                self.off(event, fn);
            });
        }

        return this;
    }

    function once($scope, event, fn) {
        if (typeof $scope === 'string') {
            fn = event;
            event = $scope;
            $scope = null;
        }

        var self = this;
        var cb = function () {
            fn.apply(this, arguments);
            self.off(event, cb);
        };

        this.on($scope, event, cb);
        return this;
    }

    function off(event, fn) {
        if (!this[key] || !this[key][event]) {
            return this;
        }

        var events = this[key];
        if (!fn) {
            delete events[event];
        } else {
            var listeners = events[event];
            var index = listeners.indexOf(fn);
            if (index > -1) {
                listeners.splice(index, 1);
            }
        }
        return this;
    }

    function emit(event) {
        if (!this[key] || !this[key][event]) {
            return;
        }

        // Making a copy here to allow `off` in listeners.
        var listeners = this[key][event].slice(0);
        var params = [].slice.call(arguments, 1);
        for (var i = 0; i < listeners.length; i++) {
            listeners[i].apply(null, params);
        }
        return this;
    }

    return {
        inject: function (cls) {
            var proto = cls.prototype || cls;
            proto.on = on;
            proto.once = once;
            proto.off = off;
            proto.emit = emit;
        }
    };
});
<commit_msg>Update tiny-eventemitter.js<commit_after>angular.module('rt.eventemitter', []).factory('eventEmitter', function () {
    var key = '$$listeners';

    function on($scope, event, fn) {
        if (typeof $scope === 'string') {
            fn = event;
            event = $scope;
            $scope = null;
        }

        if (!this[key]) {
            this[key] = {};
        }

        var events = this[key];
        if (!events[event]) {
            events[event] = [];
        }

        events[event].push(fn);

        var self = this;
        if ($scope) {
            $scope.$on('$destroy', function () {
                self.off(event, fn);
            });
        }

        return this;
    }

    function once($scope, event, fn) {
        if (typeof $scope === 'string') {
            fn = event;
            event = $scope;
            $scope = null;
        }

        var self = this;
        var cb = function () {
            fn.apply(this, arguments);
            self.off(event, cb);
        };

        this.on($scope, event, cb);
        return this;
    }

    function off(event, fn) {
        if (!this[key] || !this[key][event]) {
            return this;
        }

        var events = this[key];
        if (!fn) {
            delete events[event];
        } else {
            var listeners = events[event];
            var index = listeners.indexOf(fn);
            if (index > -1) {
                listeners.splice(index, 1);
            }
        }
        return this;
    }

    function emit(event) {
        if (!this[key] || !this[key][event]) {
            return;
        }

        // Making a copy here to allow `off` in listeners.
        var listeners = this[key][event].slice(0);
        var params = [].slice.call(arguments, 1);
        for (var i = 0; i < listeners.length; i++) {
            listeners[i].apply(null, params);
        }
        return this;
    }

    return {
        inject: function (cls) {
            var proto = cls.prototype || cls;
            proto.on = on;
            proto.once = once;
            proto.off = off;
            proto.emit = emit;
        }
    };
});
<|endoftext|>


<commit_before>// Copyright 2014 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
// limitations under the License.

(function(scope, testing) {

  // This returns a function for converting transform functions to equivalent
  // primitive functions, which will take an array of values from the
  // derivative type and fill in the blanks (underscores) with them.
  var _ = null;
  function cast(pattern) {
    return function(contents) {
      var i = 0;
      return pattern.map(function(x) { return x === _ ? contents[i++] : x; });
    }
  }

  function id(x) { return x; }

  var Opx = {px: 0};
  var Odeg = {deg: 0};

  // FIXME: We should support perspective

  // type: [argTypes, convertTo3D, convertTo2D]
  // In the argument types string, lowercase characters represent optional arguments
  var transformFunctions = {
    matrix: ['NNNNNN', [_, _, 0, 0, _, _, 0, 0, 0, 0, 1, 0, _, _, 0, 1], id],
    matrix3d: ['NNNNNNNNNNNNNNNN', id],
    rotate: ['A'],
    rotatex: ['A'],
    rotatey: ['A'],
    rotatez: ['A'],
    rotate3d: ['NNNA'],
    scale: ['Nn', cast([_, _, 1]), id],
    scalex: ['N', cast([_, 1, 1]), cast([_, 1])],
    scaley: ['N', cast([1, _, 1]), cast([1, _])],
    scalez: ['N', cast([1, 1, _])],
    scale3d: ['NNN', id],
    skew: ['Aa', null, id],
    skewx: ['A', null, cast([_, Odeg])],
    skewy: ['A', null, cast([Odeg, _])],
    translate: ['Tt', cast([_, _, Opx]), id],
    translatex: ['T', cast([_, Opx, Opx]), cast([_, Opx])],
    translatey: ['T', cast([Opx, _, Opx]), cast([Opx, _])],
    translatez: ['L', cast([Opx, Opx, _])],
    translate3d: ['TTL', id],
  };

  function parseTransform(string) {
    string = string.toLowerCase().trim();
    if (string == 'none')
      return [];
    // FIXME: Using a RegExp means calcs won't work here
    var transformRegExp = /\s*(\w+)\(([^)]*)\)/g;
    var result = [];
    var match;
    var prevLastIndex = 0;
    while (match = transformRegExp.exec(string)) {
      if (match.index != prevLastIndex)
        return;
      prevLastIndex = match.index + match[0].length;
      var functionName = match[1];
      var functionData = transformFunctions[functionName];
      if (!functionData)
        return;
      var args = match[2].split(',');
      var argTypes = functionData[0];
      if (argTypes.length < args.length)
        return;

      var parsedArgs = [];
      for (var i = 0; i < argTypes.length; i++) {
        var arg = args[i];
        var type = argTypes[i];
        var parsedArg;
        if (!arg)
          parsedArg = ({a: Odeg,
                        n: parsedArgs[0],
                        t: Opx})[type];
        else
          parsedArg = ({A: function(s) { return s.trim() == '0' ? Odeg : scope.parseAngle(s); },
                        N: scope.parseNumber,
                        T: scope.parseLengthOrPercent,
                        L: scope.parseLength})[type.toUpperCase()](arg);
        if (parsedArg === undefined)
          return;
        parsedArgs.push(parsedArg);
      }
      result.push({t: functionName, d: parsedArgs});

      if (transformRegExp.lastIndex == string.length)
        return result;
    }
  };

  function mergeMatrices(left, right) {
    if (left.decompositionPair !== right) {
      left.decompositionPair = right;
      var leftArgs = scope.makeMatrixDecomposition(left);
      leftArgs[0].push(0);
    }
    if (right.decompositionPair !== left) {
      right.decompositionPair = left;
      var rightArgs = scope.makeMatrixDecomposition(right);
      rightArgs[0].push(1);
    }
    return [
      leftArgs,
      rightArgs,
      function(list) {
        var quat = scope.quat(leftArgs[0][3], rightArgs[0][3], list[5]);
        var mat = scope.composeMatrix(list[0], list[1], list[2], quat, list[4]);
        var stringifiedArgs = mat.map(scope.numberToString).join(',');
        return stringifiedArgs;
      }
    ];
  }

  function typeTo2D(type) {
    return type.replace(/[xy]/, '');
  }

  function typeTo3D(type) {
    return type.replace(/(x|y|z|3d)?$/, '3d');
  }

  function mergeTransforms(left, right) {
    var flipResults = false;
    if (!left.length || !right.length) {
      if (!left.length) {
        flipResults = true;
        left = right;
        right = [];
      }
      for (var i = 0; i < left.length; i++) {
        var type = left[i].t;
        var args = left[i].d;
        var defaultValue = type.substr(0, 5) == 'scale' ? 1 : 0;
        right.push({t: type, d: args.map(function(arg) {
          if (typeof arg == 'number')
            return defaultValue;
          var result = {};
          for (var unit in arg)
            result[unit] = defaultValue;
          return result;
        })});
      }
    }

    var leftResult = [];
    var rightResult = [];
    var types = [];

    if (left.length != right.length) {
      var merged = mergeMatrices(left, right);
      leftResult = [merged[0]];
      rightResult = [merged[1]];
      types = [['matrix', [merged[2]]]];
    } else {
      for (var i = 0; i < left.length; i++) {
        var leftType = left[i].t;
        var rightType = right[i].t;
        var leftArgs = left[i].d;
        var rightArgs = right[i].d;

        var leftFunctionData = transformFunctions[leftType];
        var rightFunctionData = transformFunctions[rightType];

        var type;
        if ((leftType == 'matrix' || leftType == 'matrix3d') && (rightType == 'matrix' || rightType == 'matrix3d')) {
          var merged = mergeMatrices([left[i]], [right[i]]);
          leftResult.push(merged[0]);
          rightResult.push(merged[1]);
          types.push(['matrix', [merged[2]]]);
          continue;
        } else if (leftType == rightType) {
          type = leftType;
        } else if (leftFunctionData[2] && rightFunctionData[2] && typeTo2D(leftType) == typeTo2D(rightType)) {
          type = typeTo2D(leftType);
          leftArgs = leftFunctionData[2](leftArgs);
          rightArgs = rightFunctionData[2](rightArgs);
        } else if (leftFunctionData[1] && rightFunctionData[1] && typeTo3D(leftType) == typeTo3D(rightType)) {
          type = typeTo3D(leftType);
          leftArgs = leftFunctionData[1](leftArgs);
          rightArgs = rightFunctionData[1](rightArgs);
        } else {
          var merged = mergeMatrices(left, right);
          leftResult = [merged[0]];
          rightResult = [merged[1]];
          types = [['matrix', [merged[2]]]];
          break;
        }

        var leftArgsCopy = [];
        var rightArgsCopy = [];
        var stringConversions = [];
        for (var j = 0; j < leftArgs.length; j++) {
          var merge = typeof leftArgs[j] == 'number' ? scope.mergeNumbers : scope.mergeDimensions;
          var merged = merge(leftArgs[j], rightArgs[j]);
          leftArgsCopy[j] = merged[0];
          rightArgsCopy[j] = merged[1];
          stringConversions.push(merged[2]);
        }
        leftResult.push(leftArgsCopy);
        rightResult.push(rightArgsCopy);
        types.push([type, stringConversions]);
      }
    }

    if (flipResults) {
      var tmp = leftResult;
      leftResult = rightResult;
      rightResult = tmp;
    }

    return [leftResult, rightResult, function(list) {
      return list.map(function(args, i) {
        var stringifiedArgs = args.map(function(arg, j) {
          return types[i][1][j](arg);
        }).join(',');

        if (types[i][0] == 'matrix' && stringifiedArgs.split(',').length == 16)
          return 'matrix3d(' + stringifiedArgs + ')';
        else
          return types[i][0] + '(' + stringifiedArgs + ')';

      }).join(' ');
    }];
  }

  scope.addPropertiesHandler(parseTransform, mergeTransforms, ['transform']);

  if (WEB_ANIMATIONS_TESTING)
    testing.parseTransform = parseTransform;

})(webAnimationsMinifill, webAnimationsTesting);
<commit_msg>Small change<commit_after>// Copyright 2014 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
// limitations under the License.

(function(scope, testing) {

  // This returns a function for converting transform functions to equivalent
  // primitive functions, which will take an array of values from the
  // derivative type and fill in the blanks (underscores) with them.
  var _ = null;
  function cast(pattern) {
    return function(contents) {
      var i = 0;
      return pattern.map(function(x) { return x === _ ? contents[i++] : x; });
    }
  }

  function id(x) { return x; }

  var Opx = {px: 0};
  var Odeg = {deg: 0};

  // FIXME: We should support perspective

  // type: [argTypes, convertTo3D, convertTo2D]
  // In the argument types string, lowercase characters represent optional arguments
  var transformFunctions = {
    matrix: ['NNNNNN', [_, _, 0, 0, _, _, 0, 0, 0, 0, 1, 0, _, _, 0, 1], id],
    matrix3d: ['NNNNNNNNNNNNNNNN', id],
    rotate: ['A'],
    rotatex: ['A'],
    rotatey: ['A'],
    rotatez: ['A'],
    rotate3d: ['NNNA'],
    scale: ['Nn', cast([_, _, 1]), id],
    scalex: ['N', cast([_, 1, 1]), cast([_, 1])],
    scaley: ['N', cast([1, _, 1]), cast([1, _])],
    scalez: ['N', cast([1, 1, _])],
    scale3d: ['NNN', id],
    skew: ['Aa', null, id],
    skewx: ['A', null, cast([_, Odeg])],
    skewy: ['A', null, cast([Odeg, _])],
    translate: ['Tt', cast([_, _, Opx]), id],
    translatex: ['T', cast([_, Opx, Opx]), cast([_, Opx])],
    translatey: ['T', cast([Opx, _, Opx]), cast([Opx, _])],
    translatez: ['L', cast([Opx, Opx, _])],
    translate3d: ['TTL', id],
  };

  function parseTransform(string) {
    string = string.toLowerCase().trim();
    if (string == 'none')
      return [];
    // FIXME: Using a RegExp means calcs won't work here
    var transformRegExp = /\s*(\w+)\(([^)]*)\)/g;
    var result = [];
    var match;
    var prevLastIndex = 0;
    while (match = transformRegExp.exec(string)) {
      if (match.index != prevLastIndex)
        return;
      prevLastIndex = match.index + match[0].length;
      var functionName = match[1];
      var functionData = transformFunctions[functionName];
      if (!functionData)
        return;
      var args = match[2].split(',');
      var argTypes = functionData[0];
      if (argTypes.length < args.length)
        return;

      var parsedArgs = [];
      for (var i = 0; i < argTypes.length; i++) {
        var arg = args[i];
        var type = argTypes[i];
        var parsedArg;
        if (!arg)
          parsedArg = ({a: Odeg,
                        n: parsedArgs[0],
                        t: Opx})[type];
        else
          parsedArg = ({A: function(s) { return s.trim() == '0' ? Odeg : scope.parseAngle(s); },
                        N: scope.parseNumber,
                        T: scope.parseLengthOrPercent,
                        L: scope.parseLength})[type.toUpperCase()](arg);
        if (parsedArg === undefined)
          return;
        parsedArgs.push(parsedArg);
      }
      result.push({t: functionName, d: parsedArgs});

      if (transformRegExp.lastIndex == string.length)
        return result;
    }
  };

  function mergeMatrices(left, right) {
    if (left.decompositionPair !== right) {
      left.decompositionPair = right;
      var leftArgs = scope.makeMatrixDecomposition(left);
      leftArgs[0].push(0);
    }
    if (right.decompositionPair !== left) {
      right.decompositionPair = left;
      var rightArgs = scope.makeMatrixDecomposition(right);
      rightArgs[0].push(1);
    }
    return [
      leftArgs,
      rightArgs,
      function(list) {
        var quat = scope.quat(leftArgs[0][3], rightArgs[0][3], list[5]);
        var mat = scope.composeMatrix(list[0], list[1], list[2], quat, list[4]);
        var stringifiedArgs = mat.map(scope.numberToString).join(',');
        return stringifiedArgs;
      }
    ];
  }

  function typeTo2D(type) {
    return type.replace(/[xy]/, '');
  }

  function typeTo3D(type) {
    return type.replace(/(x|y|z|3d)?$/, '3d');
  }

  function mergeTransforms(left, right) {
    var flipResults = false;
    if (!left.length || !right.length) {
      if (!left.length) {
        flipResults = true;
        left = right;
        right = [];
      }
      for (var i = 0; i < left.length; i++) {
        var type = left[i].t;
        var args = left[i].d;
        var defaultValue = type.substr(0, 5) == 'scale' ? 1 : 0;
        right.push({t: type, d: args.map(function(arg) {
          if (typeof arg == 'number')
            return defaultValue;
          var result = {};
          for (var unit in arg)
            result[unit] = defaultValue;
          return result;
        })});
      }
    }

    var leftResult = [];
    var rightResult = [];
    var types = [];

    if (left.length != right.length) {
      var merged = mergeMatrices(left, right);
      leftResult = [merged[0]];
      rightResult = [merged[1]];
      types = [['matrix', [merged[2]]]];
    } else {
      for (var i = 0; i < left.length; i++) {
        var leftType = left[i].t;
        var rightType = right[i].t;
        var leftArgs = left[i].d;
        var rightArgs = right[i].d;

        var leftFunctionData = transformFunctions[leftType];
        var rightFunctionData = transformFunctions[rightType];

        var type;
        if ((leftType == 'matrix' || leftType == 'matrix3d') && (rightType == 'matrix' || rightType == 'matrix3d')) {
          var merged = mergeMatrices([left[i]], [right[i]]);
          leftResult.push(merged[0]);
          rightResult.push(merged[1]);
          types.push(['matrix', [merged[2]]]);
          continue;
        } else if (leftType == rightType) {
          type = leftType;
        } else if (leftFunctionData[2] && rightFunctionData[2] && typeTo2D(leftType) == typeTo2D(rightType)) {
          type = typeTo2D(leftType);
          leftArgs = leftFunctionData[2](leftArgs);
          rightArgs = rightFunctionData[2](rightArgs);
        } else if (leftFunctionData[1] && rightFunctionData[1] && typeTo3D(leftType) == typeTo3D(rightType)) {
          type = typeTo3D(leftType);
          leftArgs = leftFunctionData[1](leftArgs);
          rightArgs = rightFunctionData[1](rightArgs);
        } else {
          var merged = mergeMatrices(left, right);
          leftResult = [merged[0]];
          rightResult = [merged[1]];
          types = [['matrix', [merged[2]]]];
          break;
        }

        var leftArgsCopy = [];
        var rightArgsCopy = [];
        var stringConversions = [];
        for (var j = 0; j < leftArgs.length; j++) {
          var merge = typeof leftArgs[j] == 'number' ? scope.mergeNumbers : scope.mergeDimensions;
          var merged = merge(leftArgs[j], rightArgs[j]);
          leftArgsCopy[j] = merged[0];
          rightArgsCopy[j] = merged[1];
          stringConversions.push(merged[2]);
        }
        leftResult.push(leftArgsCopy);
        rightResult.push(rightArgsCopy);
        types.push([type, stringConversions]);
      }
    }

    if (flipResults) {
      var tmp = leftResult;
      leftResult = rightResult;
      rightResult = tmp;
    }

    return [leftResult, rightResult, function(list) {
      return list.map(function(args, i) {
        var stringifiedArgs = args.map(function(arg, j) {
          return types[i][1][j](arg);
        }).join(',');
        if (types[i][0] == 'matrix' && stringifiedArgs.split(',').length == 16)
          types[i][0] = 'matrix3d';
        return types[i][0] + '(' + stringifiedArgs + ')';

      }).join(' ');
    }];
  }

  scope.addPropertiesHandler(parseTransform, mergeTransforms, ['transform']);

  if (WEB_ANIMATIONS_TESTING)
    testing.parseTransform = parseTransform;

})(webAnimationsMinifill, webAnimationsTesting);
<|endoftext|>


<commit_before>import Normalize from '../utils/normalize'

/**
 * Add mark to text at `offset` and `length` in node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {Number} length
 * @param {Mixed} mark
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function addMarkByKey(transform, key, offset, length, mark, options = {}) {
  const { normalize = true } = options
  mark = Normalize.mark(mark)
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.addMarkOperation(path, offset, length, mark)
  if (normalize) {
    transform = transform.normalizeNodeByKey(parent.key)
  }

  return transform
}

/**
 * Insert a `node` at `index` in a node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} index
 * @param {Node} node
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function insertNodeByKey(transform, key, index, node, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)

  transform = transform.insertNodeOperation(path, index, node)
  if (normalize) {
    transform = transform.normalizeNodeByKey(key)
  }

  return transform
}

/**
 * Insert `text` at `offset` in node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {String} text
 * @param {Set} marks (optional)
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function insertTextByKey(transform, key, offset, text, marks, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.insertTextOperation(path, offset, text, marks)
  if (normalize) {
    transform = transform.normalizeNodeByKey(parent.key)
  }

  return transform
}

/**
 * Join a node by `key` with a node `withKey`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {String} withKey
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function joinNodeByKey(transform, key, withKey, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const withPath = document.getPath(withKey)
  const parent = document.getCommonAncestor(key, withKey)

  transform = transform.joinNodeOperation(path, withPath)

  if (normalize) {
    if (parent) {
      transform = transform.normalizeNodeByKey(parent.key)
    } else {
      transform = transform.normalizeDocument()
    }
  }

  return transform
}

/**
 * Move a node by `key` to a new parent by `key` and `index`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {String} newKey
 * @param {Number} index
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function moveNodeByKey(transform, key, newKey, newIndex, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const newPath = document.getPath(newKey)

  transform = transform.moveNodeOperation(path, newPath, newIndex)
  const parent = document.getCommonAncestor(key, newKey)

  if (normalize) {
    if (parent) {
      transform = transform.normalizeNodeByKey(parent.key)
    } else {
      transform = transform.normalizeDocument()
    }
  }

  return transform
}

/**
 * Remove mark from text at `offset` and `length` in node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {Number} length
 * @param {Mark} mark
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function removeMarkByKey(transform, key, offset, length, mark, options = {}) {
  const { normalize = true } = options
  mark = Normalize.mark(mark)
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.removeMarkOperation(path, offset, length, mark)
  if (normalize) {
    transform = transform.normalizeNodeByKey(parent.key)
  }

  return transform
}

/**
 * Remove a node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function removeNodeByKey(transform, key, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  let { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.removeNodeOperation(path)

  if (normalize) {
    if (parent) {
      transform = transform.normalizeNodeByKey(parent.key)
    } else {
      transform = transform.normalizeDocument()
    }
  }

  return transform
}

/**
 * Remove text at `offset` and `length` in node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {Number} length
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function removeTextByKey(transform, key, offset, length, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  let { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.removeTextOperation(path, offset, length)
  if (normalize) {
    transform = transform.normalizeNodeByKey(parent.key)
  }

  return transform
}

/**
 * Set `properties` on mark on text at `offset` and `length` in node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {Number} length
 * @param {Mark} mark
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function setMarkByKey(transform, key, offset, length, mark, properties, options = {}) {
  const { normalize = true } = options
  mark = Normalize.mark(mark)
  properties = Normalize.markProperties(properties)
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.setMarkOperation(path, offset, length, mark, properties)
  if (normalize) {
    transform = transform.normalizeNodeByKey(parent.key)
  }

  return transform
}

/**
 * Set `properties` on a node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Object || String} properties
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function setNodeByKey(transform, key, properties, options = {}) {
  const { normalize = true } = options
  properties = Normalize.nodeProperties(properties)
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.setNodeOperation(path, properties)

  if (normalize) {
    if (parent) {
      transform = transform.normalizeNodeByKey(parent.key)
    } else {
      transform = transform.normalizeDocument()
    }
  }

  return transform
}

/**
 * Split a node by `key` at `offset`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function splitNodeByKey(transform, key, offset, options = {}) {
  const { normalize = true } = options
  let { state } = transform
  let { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.splitNodeOperation(path, offset)

  if (normalize) {
    if (parent) {
      transform = transform.normalizeNodeByKey(parent.key)
    } else {
      transform = transform.normalizeDocument()
    }
  }

  return transform
}
<commit_msg>Fix transform moveNodeByKey when container is the parent<commit_after>import Normalize from '../utils/normalize'

/**
 * Add mark to text at `offset` and `length` in node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {Number} length
 * @param {Mixed} mark
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function addMarkByKey(transform, key, offset, length, mark, options = {}) {
  const { normalize = true } = options
  mark = Normalize.mark(mark)
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.addMarkOperation(path, offset, length, mark)
  if (normalize) {
    transform = transform.normalizeNodeByKey(parent.key)
  }

  return transform
}

/**
 * Insert a `node` at `index` in a node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} index
 * @param {Node} node
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function insertNodeByKey(transform, key, index, node, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)

  transform = transform.insertNodeOperation(path, index, node)
  if (normalize) {
    transform = transform.normalizeNodeByKey(key)
  }

  return transform
}

/**
 * Insert `text` at `offset` in node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {String} text
 * @param {Set} marks (optional)
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function insertTextByKey(transform, key, offset, text, marks, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.insertTextOperation(path, offset, text, marks)
  if (normalize) {
    transform = transform.normalizeNodeByKey(parent.key)
  }

  return transform
}

/**
 * Join a node by `key` with a node `withKey`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {String} withKey
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function joinNodeByKey(transform, key, withKey, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const withPath = document.getPath(withKey)
  const parent = document.getCommonAncestor(key, withKey)

  transform = transform.joinNodeOperation(path, withPath)

  if (normalize) {
    if (parent) {
      transform = transform.normalizeNodeByKey(parent.key)
    } else {
      transform = transform.normalizeDocument()
    }
  }

  return transform
}

/**
 * Move a node by `key` to a new parent by `newKey` and `index`.
 * `newKey` is the key of the container (it can be the document itself)
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {String} newKey
 * @param {Number} index
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function moveNodeByKey(transform, key, newKey, newIndex, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const newPath = document.getPath(newKey)
  const parent = document.key == newKey ? null : document.getCommonAncestor(key, newKey)

  transform = transform.moveNodeOperation(path, newPath, newIndex)

  if (normalize) {
    transform = transform.normalizeNodeByKey(parent.key)
  }

  return transform
}

/**
 * Remove mark from text at `offset` and `length` in node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {Number} length
 * @param {Mark} mark
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function removeMarkByKey(transform, key, offset, length, mark, options = {}) {
  const { normalize = true } = options
  mark = Normalize.mark(mark)
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.removeMarkOperation(path, offset, length, mark)
  if (normalize) {
    transform = transform.normalizeNodeByKey(parent.key)
  }

  return transform
}

/**
 * Remove a node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function removeNodeByKey(transform, key, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  let { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.removeNodeOperation(path)

  if (normalize) {
    if (parent) {
      transform = transform.normalizeNodeByKey(parent.key)
    } else {
      transform = transform.normalizeDocument()
    }
  }

  return transform
}

/**
 * Remove text at `offset` and `length` in node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {Number} length
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function removeTextByKey(transform, key, offset, length, options = {}) {
  const { normalize = true } = options
  const { state } = transform
  let { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.removeTextOperation(path, offset, length)
  if (normalize) {
    transform = transform.normalizeNodeByKey(parent.key)
  }

  return transform
}

/**
 * Set `properties` on mark on text at `offset` and `length` in node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {Number} length
 * @param {Mark} mark
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function setMarkByKey(transform, key, offset, length, mark, properties, options = {}) {
  const { normalize = true } = options
  mark = Normalize.mark(mark)
  properties = Normalize.markProperties(properties)
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.setMarkOperation(path, offset, length, mark, properties)
  if (normalize) {
    transform = transform.normalizeNodeByKey(parent.key)
  }

  return transform
}

/**
 * Set `properties` on a node by `key`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Object || String} properties
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function setNodeByKey(transform, key, properties, options = {}) {
  const { normalize = true } = options
  properties = Normalize.nodeProperties(properties)
  const { state } = transform
  const { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.setNodeOperation(path, properties)

  if (normalize) {
    if (parent) {
      transform = transform.normalizeNodeByKey(parent.key)
    } else {
      transform = transform.normalizeDocument()
    }
  }

  return transform
}

/**
 * Split a node by `key` at `offset`.
 *
 * @param {Transform} transform
 * @param {String} key
 * @param {Number} offset
 * @param {Object} options
 *   @param {Boolean} normalize
 * @return {Transform}
 */

export function splitNodeByKey(transform, key, offset, options = {}) {
  const { normalize = true } = options
  let { state } = transform
  let { document } = state
  const path = document.getPath(key)
  const parent = document.getParent(key)

  transform = transform.splitNodeOperation(path, offset)

  if (normalize) {
    if (parent) {
      transform = transform.normalizeNodeByKey(parent.key)
    } else {
      transform = transform.normalizeDocument()
    }
  }

  return transform
}
<|endoftext|>


<commit_before>import { selectionFilter } from '../selection/filter';
import { Transition } from '../core/Transition';

export function filter(value) {
  var subgroups = [], subgroup, group, node;

  if (typeof value !== "function") {
    value = selectionFilter(value);
  }

  let j, m;
  for (j = 0, m = this.length; j < m; j++) {
    subgroups.push(subgroup = []);
    let i, n;
    for (group = this[j], i = 0, n = group.length; i < n; i++) {
      if ((node = group[i]) && value.call(node, node.__data__, i, j)) {
        subgroup.push(node);
      }
    }
  }

  return Transition.from(subgroups, this.namespace, this.id);
}
<commit_msg>update transition filter<commit_after>import { filter as selectionFilter } from '../selection/filter';
import { Transition } from '../core/Transition';

export function filter(value) {
  var subgroups = [], subgroup, group, node;

  if (typeof value !== "function") {
    value = selectionFilter(value);
  }

  let j, m;
  for (j = 0, m = this.length; j < m; j++) {
    subgroups.push(subgroup = []);
    let i, n;
    for (group = this[j], i = 0, n = group.length; i < n; i++) {
      if ((node = group[i]) && value.call(node, node.__data__, i, j)) {
        subgroup.push(node);
      }
    }
  }

  return Transition.from(subgroups, this.namespace, this.id);
}
<|endoftext|>


<commit_before>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Controls from './Controls';
import styles from './styles/10.11';
import WindowFocus from '../../windowFocus';
import Dimension, { dimensionPropTypes } from '../../style/dimension';

@Dimension({ width: '100%' })
@WindowFocus()
class TitleBar extends Component {
  static propTypes = {
    ...dimensionPropTypes,
    title: PropTypes.node,
    inset: PropTypes.bool,
    controls: PropTypes.bool,
    transparent: PropTypes.bool,
    isFullscreen: PropTypes.bool,
    onCloseClick: PropTypes.func,
    onMinimizeClick: PropTypes.func,
    onMaximizeClick: PropTypes.func,
    onResizeClick: PropTypes.func,
    disableClose: PropTypes.bool,
    disableMinimize: PropTypes.bool,
    disableResize: PropTypes.bool,
    disableFullscreen: PropTypes.bool
  };

  static childContextTypes = {
    titlebarChild: PropTypes.bool
  };

  getChildContext() {
    return {
      titlebarChild: true
    };
  }

  componentDidMount() {
    window.addEventListener('resize', this.resize);
    this.resize();
  }

  componentWillUnmount() {
    window.removeEventListener('resize', this.resize);
  }

  componentDidUpdate() {
    this.resize();
  }

  resize = () => {
    if (this.refs.title) {
      const barRect = this.refs.element.getBoundingClientRect();
      this.refs.title.style.overflow = 'visible';
      this.refs.title.style.paddingRight = 0;
      this.refs.title.style.flexGrow = 0;
      const titleRect = this.refs.title.getBoundingClientRect();
      this.refs.title.style.overflow = 'hidden';
      this.refs.title.style.flexGrow = 1;

      const barWidth = barRect.width - 6;
      const contentWidth = titleRect.width + (this.props.controls ? 60 : 0);

      let padding = barWidth - contentWidth;
      if (padding > 60) padding = 60;

      this.refs.title.style.paddingRight = padding + 'px';
    }
  };

  render() {
    let {
      children,
      inset,
      controls,
      title,
      transparent,
      isWindowFocused,
      style,
      ...props
    } = this.props;

    delete props.isFullscreen;
    delete props.onCloseClick;
    delete props.onMinimizeClick;
    delete props.onMaximizeClick;
    delete props.onResizeClick;

    let componentStyle = { ...styles.titleBar };

    let titleStyle = styles.title;

    if (inset) {
      componentStyle = { ...componentStyle, ...styles.titleBarInset };
    }

    if (!isWindowFocused) {
      componentStyle = { ...componentStyle, ...styles.unfocusedTitleBar };
      titleStyle = { ...titleStyle, ...styles.unfocusedTitle };
    }

    controls = !controls || (
      <Controls ref="controls" inset={inset} {...this.props} />
    );
    title = !title || (

        {title}

    );

    if (transparent) {
      delete componentStyle.backgroundImage;
      delete componentStyle.borderBottomWidth;
      delete componentStyle.borderBottomStyle;
      delete componentStyle.borderBottomColor;
      delete componentStyle.borderTopWidth;
      delete componentStyle.borderTopStyle;
      delete componentStyle.borderTopColor;
      delete componentStyle.borderTopLeftRadius;
      delete componentStyle.borderTopRightRadius;
    }

    return (

        {controls}
        {title}
        {children}

    );
  }
}

export default TitleBar;
<commit_msg>Prevent `disableX` props from being spread onto
<commit_after>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Controls from './Controls';
import styles from './styles/10.11';
import WindowFocus from '../../windowFocus';
import Dimension, { dimensionPropTypes } from '../../style/dimension';

@Dimension({ width: '100%' })
@WindowFocus()
class TitleBar extends Component {
  static propTypes = {
    ...dimensionPropTypes,
    title: PropTypes.node,
    inset: PropTypes.bool,
    controls: PropTypes.bool,
    transparent: PropTypes.bool,
    isFullscreen: PropTypes.bool,
    onCloseClick: PropTypes.func,
    onMinimizeClick: PropTypes.func,
    onMaximizeClick: PropTypes.func,
    onResizeClick: PropTypes.func,
    disableClose: PropTypes.bool,
    disableMinimize: PropTypes.bool,
    disableResize: PropTypes.bool,
    disableFullscreen: PropTypes.bool
  };

  static childContextTypes = {
    titlebarChild: PropTypes.bool
  };

  getChildContext() {
    return {
      titlebarChild: true
    };
  }

  componentDidMount() {
    window.addEventListener('resize', this.resize);
    this.resize();
  }

  componentWillUnmount() {
    window.removeEventListener('resize', this.resize);
  }

  componentDidUpdate() {
    this.resize();
  }

  resize = () => {
    if (this.refs.title) {
      const barRect = this.refs.element.getBoundingClientRect();
      this.refs.title.style.overflow = 'visible';
      this.refs.title.style.paddingRight = 0;
      this.refs.title.style.flexGrow = 0;
      const titleRect = this.refs.title.getBoundingClientRect();
      this.refs.title.style.overflow = 'hidden';
      this.refs.title.style.flexGrow = 1;

      const barWidth = barRect.width - 6;
      const contentWidth = titleRect.width + (this.props.controls ? 60 : 0);

      let padding = barWidth - contentWidth;
      if (padding > 60) padding = 60;

      this.refs.title.style.paddingRight = padding + 'px';
    }
  };

  render() {
    let {
      children,
      inset,
      controls,
      title,
      transparent,
      isWindowFocused,
      style,
      ...props
    } = this.props;

    delete props.isFullscreen;
    delete props.onCloseClick;
    delete props.onMinimizeClick;
    delete props.onMaximizeClick;
    delete props.onResizeClick;
    delete props.disableClose;
    delete props.disableMinimize;
    delete props.disableResize;
    delete props.disableFullscreen;

    let componentStyle = { ...styles.titleBar };

    let titleStyle = styles.title;

    if (inset) {
      componentStyle = { ...componentStyle, ...styles.titleBarInset };
    }

    if (!isWindowFocused) {
      componentStyle = { ...componentStyle, ...styles.unfocusedTitleBar };
      titleStyle = { ...titleStyle, ...styles.unfocusedTitle };
    }

    controls = !controls || (
      <Controls ref="controls" inset={inset} {...this.props} />
    );
    title = !title || (

        {title}

    );

    if (transparent) {
      delete componentStyle.backgroundImage;
      delete componentStyle.borderBottomWidth;
      delete componentStyle.borderBottomStyle;
      delete componentStyle.borderBottomColor;
      delete componentStyle.borderTopWidth;
      delete componentStyle.borderTopStyle;
      delete componentStyle.borderTopColor;
      delete componentStyle.borderTopLeftRadius;
      delete componentStyle.borderTopRightRadius;
    }

    return (

        {controls}
        {title}
        {children}

    );
  }
}

export default TitleBar;
<|endoftext|>


<commit_before>/*global casper*/
casper.test.begin('Landing Page Welcome Text', 1, function suite(test) {
  'use strict';

  casper.start('http://127.0.0.1:8124')
    .waitForSelector('section#one', function() {
      // var element = this.getElementInfo('section#one');
      // test.assertTruthy(element.text, 'Hello, world.', 'Welcome text should be \'Hello, world.\'');
      test.assertSelectorHasText('section#one', 'Hello, world.');
    })
    .run(function() {
      test.done();
    });

});<commit_msg>rollback of target load site to localhost. works with python simple server running on jenkins for build.<commit_after>/*global casper*/
casper.test.begin('Landing Page Welcome Text', 1, function suite(test) {
  'use strict';

  casper.start('http://localhost:8124')
    .waitForSelector('section#one', function() {
      // var element = this.getElementInfo('section#one');
      // test.assertTruthy(element.text, 'Hello, world.', 'Welcome text should be \'Hello, world.\'');
      test.assertSelectorHasText('section#one', 'Hello, world.');
    })
    .run(function() {
      test.done();
    });

});<|endoftext|>