From 5d05110701ba88aa8d1b1564fe575c058226bccb Mon Sep 17 00:00:00 2001 From: minkyu-yi Date: Thu, 10 Nov 2016 17:18:01 +0900 Subject: [PATCH] chore & fix chore: api page, build, tests, readme, ... fix: support tui.dom 2.1.0 --- .eslintrc.json => .eslintrc | 0 README.md | 11 +- bower.json | 7 +- contextmenu.js | 1789 ------ contextmenu.min.js | 1 - contextmenu.css => dist/contextmenu.css | 0 dist/tui-component-contextmenu.js | 1935 ++++++ dist/tui-component-contextmenu.min.js | 5 + jsdoc-conf.json | 32 +- karma.conf.bs.js | 43 +- karma.conf.js | 32 - karma.conf.local.js | 56 + karma.conf.private.js | 35 +- package.json | 38 +- samples/css/contextmenu.css | 40 - samples/default.html | 104 +- samples/js/code-snippet.js | 3958 ------------ samples/js/contextmenu.js | 1789 ------ samples/js/domutil.js | 7607 ----------------------- samples/js/floatinglayer.js | 673 -- src/contextmenu.hbs | 54 +- src/contextmenu.js | 20 +- src/core.js | 6 +- test/contextmenu.spec.js | 5 +- test/core.spec.js | 2 +- webpack.config.js | 48 + 26 files changed, 2243 insertions(+), 16047 deletions(-) rename .eslintrc.json => .eslintrc (100%) delete mode 100644 contextmenu.js delete mode 100644 contextmenu.min.js rename contextmenu.css => dist/contextmenu.css (100%) create mode 100644 dist/tui-component-contextmenu.js create mode 100644 dist/tui-component-contextmenu.min.js delete mode 100644 karma.conf.js create mode 100644 karma.conf.local.js delete mode 100644 samples/css/contextmenu.css delete mode 100644 samples/js/code-snippet.js delete mode 100644 samples/js/contextmenu.js delete mode 100644 samples/js/domutil.js delete mode 100644 samples/js/floatinglayer.js create mode 100644 webpack.config.js diff --git a/.eslintrc.json b/.eslintrc similarity index 100% rename from .eslintrc.json rename to .eslintrc diff --git a/README.md b/README.md index 6ed2802..e09f059 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,13 @@ ContextMenu Component ## Documentation * **API** : https://nhnent.github.io/tui.component.contextmenu/latest * **Tutorial** : https://github.com/nhnent/tui.component.contextmenu/wiki/ContextMenu-Tutorial -* **Sample** : https://nhnent.github.io/tui.component.contextmenu/latest/tutorial.html +* **Sample** : https://nhnent.github.io/tui.component.contextmenu/latest/tutorial-default.html ## Dependency -* tui-code-snippet : 1.2.0 -* tui-domutil : 1.0.4 -* tui-component-floatinglayer : 1.0.0 +* tui-code-snippet: ^1.2.0 +* tui-domutil: ^2.1.0 +* tui-component-floatinglayer: ^1.0.1 +* (To support IE8+): [Babel-polyfill](https://babeljs.io/docs/usage/polyfill/) ## Test environment * browser @@ -25,7 +26,7 @@ ContextMenu Component ## Download/Install * Bower : - * Latest : `bower install tui-component-contextmenu#master` + * Latest : `bower install tui-component-contextmenu` * Each Version : `bower install tui-component-contextmenu[#tag]` * Download : https://github.com/nhnent/tui.component.contextmenu diff --git a/bower.json b/bower.json index df77553..bfec3ad 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "name": "tui-component-contextmenu", "description": "contextmenu component", "authors": [ - "NHNEnt FE Development Team " + "NHNEnt FE Development Lab " ], "license": "MIT", "keywords": [ @@ -19,7 +19,7 @@ "demo", "samples", ".gitignore", - ".eslintrc.json", + ".eslintrc", "index.js", "jsdoc-conf.json", "karma.conf.js", @@ -29,6 +29,7 @@ ], "dependencies": { "tui-code-snippet": "^1.2.0", - "tui-component-floatinglayer": "^1.0.0" + "tui-component-floatinglayer": "^1.0.1", + "tui-dom": "^2.1.0" } } diff --git a/contextmenu.js b/contextmenu.js deleted file mode 100644 index 1f653a3..0000000 --- a/contextmenu.js +++ /dev/null @@ -1,1789 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 2.0.0-beta.1', - 7: '>= 4.0.0' -}; - -exports.REVISION_CHANGES = REVISION_CHANGES; -var objectType = '[object Object]'; - -function HandlebarsEnvironment(helpers, partials, decorators) { - this.helpers = helpers || {}; - this.partials = partials || {}; - this.decorators = decorators || {}; - - _helpers.registerDefaultHelpers(this); - _decorators.registerDefaultDecorators(this); -} - -HandlebarsEnvironment.prototype = { - constructor: HandlebarsEnvironment, - - logger: _logger2['default'], - log: _logger2['default'].log, - - registerHelper: function registerHelper(name, fn) { - if (_utils.toString.call(name) === objectType) { - if (fn) { - throw new _exception2['default']('Arg not supported with multiple helpers'); - } - _utils.extend(this.helpers, name); - } else { - this.helpers[name] = fn; - } - }, - unregisterHelper: function unregisterHelper(name) { - delete this.helpers[name]; - }, - - registerPartial: function registerPartial(name, partial) { - if (_utils.toString.call(name) === objectType) { - _utils.extend(this.partials, name); - } else { - if (typeof partial === 'undefined') { - throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); - } - this.partials[name] = partial; - } - }, - unregisterPartial: function unregisterPartial(name) { - delete this.partials[name]; - }, - - registerDecorator: function registerDecorator(name, fn) { - if (_utils.toString.call(name) === objectType) { - if (fn) { - throw new _exception2['default']('Arg not supported with multiple decorators'); - } - _utils.extend(this.decorators, name); - } else { - this.decorators[name] = fn; - } - }, - unregisterDecorator: function unregisterDecorator(name) { - delete this.decorators[name]; - } -}; - -var log = _logger2['default'].log; - -exports.log = log; -exports.createFrame = _utils.createFrame; -exports.logger = _logger2['default']; - - -},{"./decorators":4,"./exception":6,"./helpers":7,"./logger":15,"./utils":19}],4:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -exports.registerDefaultDecorators = registerDefaultDecorators; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _decoratorsInline = require('./decorators/inline'); - -var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); - -function registerDefaultDecorators(instance) { - _decoratorsInline2['default'](instance); -} - - -},{"./decorators/inline":5}],5:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var _utils = require('../utils'); - -exports['default'] = function (instance) { - instance.registerDecorator('inline', function (fn, props, container, options) { - var ret = fn; - if (!props.partials) { - props.partials = {}; - ret = function (context, options) { - // Create a new partials stack frame prior to exec. - var original = container.partials; - container.partials = _utils.extend({}, original, props.partials); - var ret = fn(context, options); - container.partials = original; - return ret; - }; - } - - props.partials[options.args[0]] = options.fn; - - return ret; - }); -}; - -module.exports = exports['default']; - - -},{"../utils":19}],6:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; - -function Exception(message, node) { - var loc = node && node.loc, - line = undefined, - column = undefined; - if (loc) { - line = loc.start.line; - column = loc.start.column; - - message += ' - ' + line + ':' + column; - } - - var tmp = Error.prototype.constructor.call(this, message); - - // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. - for (var idx = 0; idx < errorProps.length; idx++) { - this[errorProps[idx]] = tmp[errorProps[idx]]; - } - - /* istanbul ignore else */ - if (Error.captureStackTrace) { - Error.captureStackTrace(this, Exception); - } - - if (loc) { - this.lineNumber = line; - this.column = column; - } -} - -Exception.prototype = new Error(); - -exports['default'] = Exception; -module.exports = exports['default']; - - -},{}],7:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -exports.registerDefaultHelpers = registerDefaultHelpers; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _helpersBlockHelperMissing = require('./helpers/block-helper-missing'); - -var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); - -var _helpersEach = require('./helpers/each'); - -var _helpersEach2 = _interopRequireDefault(_helpersEach); - -var _helpersHelperMissing = require('./helpers/helper-missing'); - -var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); - -var _helpersIf = require('./helpers/if'); - -var _helpersIf2 = _interopRequireDefault(_helpersIf); - -var _helpersLog = require('./helpers/log'); - -var _helpersLog2 = _interopRequireDefault(_helpersLog); - -var _helpersLookup = require('./helpers/lookup'); - -var _helpersLookup2 = _interopRequireDefault(_helpersLookup); - -var _helpersWith = require('./helpers/with'); - -var _helpersWith2 = _interopRequireDefault(_helpersWith); - -function registerDefaultHelpers(instance) { - _helpersBlockHelperMissing2['default'](instance); - _helpersEach2['default'](instance); - _helpersHelperMissing2['default'](instance); - _helpersIf2['default'](instance); - _helpersLog2['default'](instance); - _helpersLookup2['default'](instance); - _helpersWith2['default'](instance); -} - - -},{"./helpers/block-helper-missing":8,"./helpers/each":9,"./helpers/helper-missing":10,"./helpers/if":11,"./helpers/log":12,"./helpers/lookup":13,"./helpers/with":14}],8:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var _utils = require('../utils'); - -exports['default'] = function (instance) { - instance.registerHelper('blockHelperMissing', function (context, options) { - var inverse = options.inverse, - fn = options.fn; - - if (context === true) { - return fn(this); - } else if (context === false || context == null) { - return inverse(this); - } else if (_utils.isArray(context)) { - if (context.length > 0) { - if (options.ids) { - options.ids = [options.name]; - } - - return instance.helpers.each(context, options); - } else { - return inverse(this); - } - } else { - if (options.data && options.ids) { - var data = _utils.createFrame(options.data); - data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); - options = { data: data }; - } - - return fn(context, options); - } - }); -}; - -module.exports = exports['default']; - - -},{"../utils":19}],9:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _utils = require('../utils'); - -var _exception = require('../exception'); - -var _exception2 = _interopRequireDefault(_exception); - -exports['default'] = function (instance) { - instance.registerHelper('each', function (context, options) { - if (!options) { - throw new _exception2['default']('Must pass iterator to #each'); - } - - var fn = options.fn, - inverse = options.inverse, - i = 0, - ret = '', - data = undefined, - contextPath = undefined; - - if (options.data && options.ids) { - contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; - } - - if (_utils.isFunction(context)) { - context = context.call(this); - } - - if (options.data) { - data = _utils.createFrame(options.data); - } - - function execIteration(field, index, last) { - if (data) { - data.key = field; - data.index = index; - data.first = index === 0; - data.last = !!last; - - if (contextPath) { - data.contextPath = contextPath + field; - } - } - - ret = ret + fn(context[field], { - data: data, - blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) - }); - } - - if (context && typeof context === 'object') { - if (_utils.isArray(context)) { - for (var j = context.length; i < j; i++) { - if (i in context) { - execIteration(i, i, i === context.length - 1); - } - } - } else { - var priorKey = undefined; - - for (var key in context) { - if (context.hasOwnProperty(key)) { - // We're running the iterations one step out of sync so we can detect - // the last iteration without have to scan the object twice and create - // an itermediate keys array. - if (priorKey !== undefined) { - execIteration(priorKey, i - 1); - } - priorKey = key; - i++; - } - } - if (priorKey !== undefined) { - execIteration(priorKey, i - 1, true); - } - } - } - - if (i === 0) { - ret = inverse(this); - } - - return ret; - }); -}; - -module.exports = exports['default']; - - -},{"../exception":6,"../utils":19}],10:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _exception = require('../exception'); - -var _exception2 = _interopRequireDefault(_exception); - -exports['default'] = function (instance) { - instance.registerHelper('helperMissing', function () /* [args, ]options */{ - if (arguments.length === 1) { - // A missing field in a {{foo}} construct. - return undefined; - } else { - // Someone is actually trying to call something, blow up. - throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); - } - }); -}; - -module.exports = exports['default']; - - -},{"../exception":6}],11:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var _utils = require('../utils'); - -exports['default'] = function (instance) { - instance.registerHelper('if', function (conditional, options) { - if (_utils.isFunction(conditional)) { - conditional = conditional.call(this); - } - - // Default behavior is to render the positive path if the value is truthy and not empty. - // The `includeZero` option may be set to treat the condtional as purely not empty based on the - // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. - if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - - instance.registerHelper('unless', function (conditional, options) { - return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); - }); -}; - -module.exports = exports['default']; - - -},{"../utils":19}],12:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -exports['default'] = function (instance) { - instance.registerHelper('log', function () /* message, options */{ - var args = [undefined], - options = arguments[arguments.length - 1]; - for (var i = 0; i < arguments.length - 1; i++) { - args.push(arguments[i]); - } - - var level = 1; - if (options.hash.level != null) { - level = options.hash.level; - } else if (options.data && options.data.level != null) { - level = options.data.level; - } - args[0] = level; - - instance.log.apply(instance, args); - }); -}; - -module.exports = exports['default']; - - -},{}],13:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -exports['default'] = function (instance) { - instance.registerHelper('lookup', function (obj, field) { - return obj && obj[field]; - }); -}; - -module.exports = exports['default']; - - -},{}],14:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var _utils = require('../utils'); - -exports['default'] = function (instance) { - instance.registerHelper('with', function (context, options) { - if (_utils.isFunction(context)) { - context = context.call(this); - } - - var fn = options.fn; - - if (!_utils.isEmpty(context)) { - var data = options.data; - if (options.data && options.ids) { - data = _utils.createFrame(options.data); - data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); - } - - return fn(context, { - data: data, - blockParams: _utils.blockParams([context], [data && data.contextPath]) - }); - } else { - return options.inverse(this); - } - }); -}; - -module.exports = exports['default']; - - -},{"../utils":19}],15:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var _utils = require('./utils'); - -var logger = { - methodMap: ['debug', 'info', 'warn', 'error'], - level: 'info', - - // Maps a given level value to the `methodMap` indexes above. - lookupLevel: function lookupLevel(level) { - if (typeof level === 'string') { - var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); - if (levelMap >= 0) { - level = levelMap; - } else { - level = parseInt(level, 10); - } - } - - return level; - }, - - // Can be overridden in the host environment - log: function log(level) { - level = logger.lookupLevel(level); - - if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { - var method = logger.methodMap[level]; - if (!console[method]) { - // eslint-disable-line no-console - method = 'log'; - } - - for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - message[_key - 1] = arguments[_key]; - } - - console[method].apply(console, message); // eslint-disable-line no-console - } - } -}; - -exports['default'] = logger; -module.exports = exports['default']; - - -},{"./utils":19}],16:[function(require,module,exports){ -(function (global){ -/* global window */ -'use strict'; - -exports.__esModule = true; - -exports['default'] = function (Handlebars) { - /* istanbul ignore next */ - var root = typeof global !== 'undefined' ? global : window, - $Handlebars = root.Handlebars; - /* istanbul ignore next */ - Handlebars.noConflict = function () { - if (root.Handlebars === Handlebars) { - root.Handlebars = $Handlebars; - } - return Handlebars; - }; -}; - -module.exports = exports['default']; - - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],17:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -exports.checkRevision = checkRevision; -exports.template = template; -exports.wrapProgram = wrapProgram; -exports.resolvePartial = resolvePartial; -exports.invokePartial = invokePartial; -exports.noop = noop; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } - -var _utils = require('./utils'); - -var Utils = _interopRequireWildcard(_utils); - -var _exception = require('./exception'); - -var _exception2 = _interopRequireDefault(_exception); - -var _base = require('./base'); - -function checkRevision(compilerInfo) { - var compilerRevision = compilerInfo && compilerInfo[0] || 1, - currentRevision = _base.COMPILER_REVISION; - - if (compilerRevision !== currentRevision) { - if (compilerRevision < currentRevision) { - var runtimeVersions = _base.REVISION_CHANGES[currentRevision], - compilerVersions = _base.REVISION_CHANGES[compilerRevision]; - throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); - } else { - // Use the embedded version info since the runtime doesn't know about this revision yet - throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } - } -} - -function template(templateSpec, env) { - /* istanbul ignore next */ - if (!env) { - throw new _exception2['default']('No environment passed to template'); - } - if (!templateSpec || !templateSpec.main) { - throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); - } - - templateSpec.main.decorator = templateSpec.main_d; - - // Note: Using env.VM references rather than local var references throughout this section to allow - // for external users to override these as psuedo-supported APIs. - env.VM.checkRevision(templateSpec.compiler); - - function invokePartialWrapper(partial, context, options) { - if (options.hash) { - context = Utils.extend({}, context, options.hash); - if (options.ids) { - options.ids[0] = true; - } - } - - partial = env.VM.resolvePartial.call(this, partial, context, options); - var result = env.VM.invokePartial.call(this, partial, context, options); - - if (result == null && env.compile) { - options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, options); - } - if (result != null) { - if (options.indent) { - var lines = result.split('\n'); - for (var i = 0, l = lines.length; i < l; i++) { - if (!lines[i] && i + 1 === l) { - break; - } - - lines[i] = options.indent + lines[i]; - } - result = lines.join('\n'); - } - return result; - } else { - throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); - } - } - - // Just add water - var container = { - strict: function strict(obj, name) { - if (!(name in obj)) { - throw new _exception2['default']('"' + name + '" not defined in ' + obj); - } - return obj[name]; - }, - lookup: function lookup(depths, name) { - var len = depths.length; - for (var i = 0; i < len; i++) { - if (depths[i] && depths[i][name] != null) { - return depths[i][name]; - } - } - }, - lambda: function lambda(current, context) { - return typeof current === 'function' ? current.call(context) : current; - }, - - escapeExpression: Utils.escapeExpression, - invokePartial: invokePartialWrapper, - - fn: function fn(i) { - var ret = templateSpec[i]; - ret.decorator = templateSpec[i + '_d']; - return ret; - }, - - programs: [], - program: function program(i, data, declaredBlockParams, blockParams, depths) { - var programWrapper = this.programs[i], - fn = this.fn(i); - if (data || depths || blockParams || declaredBlockParams) { - programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); - } else if (!programWrapper) { - programWrapper = this.programs[i] = wrapProgram(this, i, fn); - } - return programWrapper; - }, - - data: function data(value, depth) { - while (value && depth--) { - value = value._parent; - } - return value; - }, - merge: function merge(param, common) { - var obj = param || common; - - if (param && common && param !== common) { - obj = Utils.extend({}, common, param); - } - - return obj; - }, - - noop: env.VM.noop, - compilerInfo: templateSpec.compiler - }; - - function ret(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var data = options.data; - - ret._setup(options); - if (!options.partial && templateSpec.useData) { - data = initData(context, data); - } - var depths = undefined, - blockParams = templateSpec.useBlockParams ? [] : undefined; - if (templateSpec.useDepths) { - if (options.depths) { - depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths; - } else { - depths = [context]; - } - } - - function main(context /*, options*/) { - return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); - } - main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); - return main(context, options); - } - ret.isTop = true; - - ret._setup = function (options) { - if (!options.partial) { - container.helpers = container.merge(options.helpers, env.helpers); - - if (templateSpec.usePartial) { - container.partials = container.merge(options.partials, env.partials); - } - if (templateSpec.usePartial || templateSpec.useDecorators) { - container.decorators = container.merge(options.decorators, env.decorators); - } - } else { - container.helpers = options.helpers; - container.partials = options.partials; - container.decorators = options.decorators; - } - }; - - ret._child = function (i, data, blockParams, depths) { - if (templateSpec.useBlockParams && !blockParams) { - throw new _exception2['default']('must pass block params'); - } - if (templateSpec.useDepths && !depths) { - throw new _exception2['default']('must pass parent depths'); - } - - return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); - }; - return ret; -} - -function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { - function prog(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var currentDepths = depths; - if (depths && context !== depths[0]) { - currentDepths = [context].concat(depths); - } - - return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); - } - - prog = executeDecorators(fn, prog, container, depths, data, blockParams); - - prog.program = i; - prog.depth = depths ? depths.length : 0; - prog.blockParams = declaredBlockParams || 0; - return prog; -} - -function resolvePartial(partial, context, options) { - if (!partial) { - if (options.name === '@partial-block') { - partial = options.data['partial-block']; - } else { - partial = options.partials[options.name]; - } - } else if (!partial.call && !options.name) { - // This is a dynamic partial that returned a string - options.name = partial; - partial = options.partials[partial]; - } - return partial; -} - -function invokePartial(partial, context, options) { - options.partial = true; - if (options.ids) { - options.data.contextPath = options.ids[0] || options.data.contextPath; - } - - var partialBlock = undefined; - if (options.fn && options.fn !== noop) { - options.data = _base.createFrame(options.data); - partialBlock = options.data['partial-block'] = options.fn; - - if (partialBlock.partials) { - options.partials = Utils.extend({}, options.partials, partialBlock.partials); - } - } - - if (partial === undefined && partialBlock) { - partial = partialBlock; - } - - if (partial === undefined) { - throw new _exception2['default']('The partial ' + options.name + ' could not be found'); - } else if (partial instanceof Function) { - return partial(context, options); - } -} - -function noop() { - return ''; -} - -function initData(context, data) { - if (!data || !('root' in data)) { - data = data ? _base.createFrame(data) : {}; - data.root = context; - } - return data; -} - -function executeDecorators(fn, prog, container, depths, data, blockParams) { - if (fn.decorator) { - var props = {}; - prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); - Utils.extend(prog, props); - } - return prog; -} - - -},{"./base":3,"./exception":6,"./utils":19}],18:[function(require,module,exports){ -// Build out our basic SafeString type -'use strict'; - -exports.__esModule = true; -function SafeString(string) { - this.string = string; -} - -SafeString.prototype.toString = SafeString.prototype.toHTML = function () { - return '' + this.string; -}; - -exports['default'] = SafeString; -module.exports = exports['default']; - - -},{}],19:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -exports.extend = extend; -exports.indexOf = indexOf; -exports.escapeExpression = escapeExpression; -exports.isEmpty = isEmpty; -exports.createFrame = createFrame; -exports.blockParams = blockParams; -exports.appendContextPath = appendContextPath; -var escape = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`', - '=': '=' -}; - -var badChars = /[&<>"'`=]/g, - possible = /[&<>"'`=]/; - -function escapeChar(chr) { - return escape[chr]; -} - -function extend(obj /* , ...source */) { - for (var i = 1; i < arguments.length; i++) { - for (var key in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { - obj[key] = arguments[i][key]; - } - } - } - - return obj; -} - -var toString = Object.prototype.toString; - -exports.toString = toString; -// Sourced from lodash -// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt -/* eslint-disable func-style */ -var isFunction = function isFunction(value) { - return typeof value === 'function'; -}; -// fallback for older versions of Chrome and Safari -/* istanbul ignore next */ -if (isFunction(/x/)) { - exports.isFunction = isFunction = function (value) { - return typeof value === 'function' && toString.call(value) === '[object Function]'; - }; -} -exports.isFunction = isFunction; - -/* eslint-enable func-style */ - -/* istanbul ignore next */ -var isArray = Array.isArray || function (value) { - return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; -}; - -exports.isArray = isArray; -// Older IE versions do not directly support indexOf so we must implement our own, sadly. - -function indexOf(array, value) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { - return i; - } - } - return -1; -} - -function escapeExpression(string) { - if (typeof string !== 'string') { - // don't escape SafeStrings, since they're already safe - if (string && string.toHTML) { - return string.toHTML(); - } else if (string == null) { - return ''; - } else if (!string) { - return string + ''; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = '' + string; - } - - if (!possible.test(string)) { - return string; - } - return string.replace(badChars, escapeChar); -} - -function isEmpty(value) { - if (!value && value !== 0) { - return true; - } else if (isArray(value) && value.length === 0) { - return true; - } else { - return false; - } -} - -function createFrame(object) { - var frame = extend({}, object); - frame._parent = object; - return frame; -} - -function blockParams(params, ids) { - params.path = ids; - return params; -} - -function appendContextPath(contextPath, id) { - return (contextPath ? contextPath + '.' : '') + id; -} - - -},{}],20:[function(require,module,exports){ -// Create a simple path alias to allow browserify to resolve -// the runtime on a supported path. -module.exports = require('./dist/cjs/handlebars.runtime')['default']; - -},{"./dist/cjs/handlebars.runtime":2}],21:[function(require,module,exports){ -module.exports = require("handlebars/runtime")["default"]; - -},{"handlebars/runtime":20}],22:[function(require,module,exports){ -// hbsfy compiled Handlebars template -var HandlebarsCompiler = require('hbsfy/runtime'); -module.exports = HandlebarsCompiler.template({"1":function(container,depth0,helpers,partials,data) { - var stack1; - - return "
\n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},depth0,{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
\n"; -},"2":function(container,depth0,helpers,partials,data) { - var stack1; - - return "
\n" - + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.separator : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.program(5, data, 0),"data":data})) != null ? stack1 : "") - + "
\n"; -},"3":function(container,depth0,helpers,partials,data) { - return "
\n"; -},"5":function(container,depth0,helpers,partials,data) { - var stack1; - - return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.menu : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.program(11, data, 0),"data":data})) != null ? stack1 : ""); -},"6":function(container,depth0,helpers,partials,data) { - var stack1; - - return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.disable : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.program(9, data, 0),"data":data})) != null ? stack1 : ""); -},"7":function(container,depth0,helpers,partials,data) { - var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; - - return "
" - + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) - + "
\n"; -},"9":function(container,depth0,helpers,partials,data) { - var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; - - return "
" - + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) - + "
\n
\n" - + ((stack1 = container.invokePartial(partials.menuItem,(depth0 != null ? depth0.menu : depth0),{"name":"menuItem","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
\n"; -},"11":function(container,depth0,helpers,partials,data) { - var stack1; - - return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.disable : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.program(12, data, 0),"data":data})) != null ? stack1 : ""); -},"12":function(container,depth0,helpers,partials,data) { - var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; - - return "
" - + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) - + "
\n"; -},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { - var stack1; - - return "
\n" - + ((stack1 = container.invokePartial(partials.menuItem,depth0,{"name":"menuItem","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
\n"; -},"main_d": function(fn, props, container, depth0, data, blockParams, depths) { - - var decorators = container.decorators; - - fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.noop,"args":["menuItem"],"data":data}) || fn; - return fn; - } - -,"useDecorators":true,"usePartial":true,"useData":true,"useDepths":true}); - -},{"hbsfy/runtime":21}],23:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _core = require('./core'); - -var core = _interopRequireWildcard(_core); - -var _contextmenu = require('./contextmenu.hbs'); - -var _contextmenu2 = _interopRequireDefault(_contextmenu); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/** - * @fileoverview Context menu component - * @author NHN Ent. FE Development team - */ -var util = tui.util; - -var MODALESS = { modaless: true }; - -/** - * @typedef ContextMenu~MenuItem - * @property {string} title - title of menu item - * @property {string} [command] - string for alternative of using title to command - * @property {boolean} [separator=false] - set true then this menu will use - * separator - * @property {MenuItem[]} [menu] - you can define submenu recursivly - */ - -/** - * ContextMenu - */ - -var ContextMenu = function () { - /** - * Constructor - * @param {HTMLElement} container - container for placing context menu - * floating layers - * @param {object} options - options for context menu - * @param {number} [options.delay=100] - delay for displaying submenu - * @example - * var menu = new tui.component.ContextMenu(document.querySelector('#fl')); - */ - - function ContextMenu(container) { - var options = arguments.length <= 1 || arguments[1] === undefined ? { - delay: 130 - } : arguments[1]; - - _classCallCheck(this, ContextMenu); - - /** - * @type {object} - */ - this.options = Object.assign({}, options); - /** - * @type {HTMLElement} - */ - this.container = container; - - /** - * @type {Map} - */ - this.layerMap = new Map(); - - /** - * @type {FloatingLayer} - */ - this.activeLayer = null; - - /** - * @type {boolean} - */ - this.pageScrolled = false; - - /** - * @type {function} - */ - this.cloneMouseMoveEvent = null; - - dom.on(document, 'contextmenu', this._onContextMenu, this); - } - - /** - * Destructor - * @api - */ - - - ContextMenu.prototype.destroy = function destroy() { - dom.off(document, 'contextmenu', this._onContextMenu, this); - - this._hideContextMenu(); - - this.container = this.layerMap = this.activeLayer = this.pageScolled = this.cloneMouseMoveEvent = null; - }; - - /** - * Hide activated context menu and unbind related DOM events - * @private - */ - - - ContextMenu.prototype._hideContextMenu = function _hideContextMenu() { - var layer = this.activeLayer; - - if (!layer) { - return; - } - - dom.off(layer.container, 'mousemove', this.cloneMouseMoveEvent, this); - dom.off(document, 'mousedown', this._onMouseDown, this); - dom.off(document, 'click', this._onMouseClick, this); - dom.off(document, 'scroll', this._onPageScroll, this); - - layer.hide(); - - var hideElement = function hideElement(menu) { - dom.css(menu, { - display: 'none', - marginTop: '' - }); - }; - - dom.findAll(layer.container, '.js-menu-root').forEach(hideElement); - dom.findAll(layer.container, '.js-menu-submenu').forEach(hideElement); - - this.pageScrolled = false; - this.activeLayer = this.cloneMouseMoveEvent = null; - }; - - /** - * Mouse down event handler for close context menu - * @param {MouseEvent} mouseDownEvent - mouseDown event object - * @private - */ - - - ContextMenu.prototype._onMouseDown = function _onMouseDown(mouseDownEvent) { - var target = mouseDownEvent.target || mouseDownEvent.srcElement; - - if (!dom.closest(target, '.js-menu-root')) { - this._hideContextMenu(); - } - }; - - /** - * Mouse click event handler for invoking callback when click menu item - * @param {MouseEvent} clickEvent - click MouseEvent object - * @private - */ - - - ContextMenu.prototype._onMouseClick = function _onMouseClick(clickEvent) { - var target = clickEvent.target || clickEvent.srcElement; - var title = dom.textContent(target).trim(); - var command = dom.getData(target, 'command'); - var container = dom.closest(target, '.floating-layer'); - var isMenuButton = dom.hasClass(target, 'js-menu-button'); - var isSeparator = dom.hasClass(target, 'js-menu-separator'); - var hasSubmenu = dom.hasClass(target, 'js-menu-has-submenu'); - var isDisableButton = dom.hasClass(target, 'js-menu-disable'); - - if (isDisableButton) { - this._hideContextMenu(); - - return; - } - - if (!(container && isMenuButton)) { - return; - } - - if (isSeparator || hasSubmenu) { - return; - } - - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = this.layerMap.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var layer = _step.value; - - if (container === layer.container) { - layer.callback(clickEvent, command || title); - this._hideContextMenu(); - - return; - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator['return']) { - _iterator['return'](); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - }; - - /** - * Show menu element without veil browser viewport - * @param {HTMLElement} element - menu element - * @param {object} [strategy] - methods for handle situations that - * menu veil by browser viewports - * @param {object} [initialStyle] - initial style before - * calculating new bound - * @private - */ - - - ContextMenu.prototype._showWithoutOverflow = function _showWithoutOverflow(element) { - var strategy = arguments.length <= 1 || arguments[1] === undefined ? { rightOverflow: core.noop, bottomOverflow: core.noop } : arguments[1]; - var initialStyle = arguments.length <= 2 || arguments[2] === undefined ? { marginTop: '', marginLeft: '' } : arguments[2]; - - dom.css(element, 'visibility', 'hidden'); - dom.css(element, initialStyle); - dom.css(element, 'display', 'block'); - - var _dom$getRect = dom.getRect(element); - - var menuRight = _dom$getRect.right; - var menuBottom = _dom$getRect.bottom; - - - var menuDoc = (element.document || element.ownerDocument).documentElement; - var viewportWidth = menuDoc.clientWidth; - var viewportHeight = menuDoc.clientHeight; - - - var isRightOverflowed = menuRight > viewportWidth; - var isBottomOverflowed = menuBottom > viewportHeight; - - if (isRightOverflowed) { - strategy.rightOverflow(element, menuRight, viewportWidth); - } - - if (isBottomOverflowed) { - strategy.bottomOverflow(element, menuBottom, viewportHeight); - } - - dom.css(element, 'visibility', ''); - }; - - /** - * Show root menu element - * @param {number} left - left pixel position - * @param {number} top - top pixel position - * @private - */ - - - ContextMenu.prototype._showRootMenu = function _showRootMenu(left, top) { - var layer = this.activeLayer; - - if (!layer) { - return; - } - - var rootMenuElement = dom.find(layer.container, '.js-menu-root'); - - layer.setBound({ left: left, top: top }); - layer.show(); - - this._showWithoutOverflow(rootMenuElement, { - rightOverflow: function rightOverflow(el, right, viewportWidth) { - dom.css(el, 'marginLeft', viewportWidth - right + 'px'); - }, - bottomOverflow: function bottomOverflow(el, bottom, viewportHeight) { - dom.css(el, 'marginTop', viewportHeight - bottom + 'px'); - } - }); - }; - - /** - * Show sub menu element - * @param {HTMLElement} element - submenu root element - * @private - */ - - - ContextMenu.prototype._showSubMenu = function _showSubMenu(element) { - this._showWithoutOverflow(element, { - rightOverflow: function rightOverflow(el, right, viewportWidth) { - dom.css(el, 'marginLeft', viewportWidth - right + el.clientWidth + 'px'); - }, - bottomOverflow: function bottomOverflow(el, bottom, viewportHeight) { - dom.css(el, 'marginTop', viewportHeight - bottom + 'px'); - } - }, { - marginTop: '', - marginLeft: '100%' - }); - }; - - /** - * Refresh all submenu element - * - * Hide elements that no related with mouse event and show others - * @param {HTMLElement} layerOnCursor - layer element on cursor - * @private - */ - - - ContextMenu.prototype._refreshMenuDisplay = function _refreshMenuDisplay(layerOnCursor) { - var container = this.activeLayer.container; - var allSubmenus = dom.findAll(container, '.js-menu-submenu'); - var layersUntilRoot = []; - - while (layerOnCursor && container !== layerOnCursor) { - if (dom.hasClass(layerOnCursor, 'js-menu-submenu')) { - layersUntilRoot.push(layerOnCursor); - } - - layerOnCursor = layerOnCursor.parentNode; - } - - allSubmenus.forEach(function (menuElement) { - if (layersUntilRoot.indexOf(menuElement) < 0) { - dom.css(menuElement, 'display', 'none'); - } - }); - - layersUntilRoot.forEach(util.bind(this._showSubMenu, this)); - }; - - /** - * Mouse move event handler for reveal context menus - * @param {MouseEvent} mouseMoveEvent - mouse move event object - * @private - */ - - - ContextMenu.prototype._onMouseMove = function _onMouseMove(mouseMoveEvent) { - if (this.pageScrolled) { - this.pageScrolled = false; - - return; - } - - var target = mouseMoveEvent.target || mouseMoveEvent.srcElement; - var activeLayer = this.activeLayer; - - if (!(activeLayer && dom.closest(target, '.js-menu-root'))) { - return; - } - - var layerOnCursor = void 0; - - if (dom.hasClass(target, 'js-menu-has-submenu')) { - layerOnCursor = dom.find(target.parentNode, '.js-menu-submenu'); - } else { - layerOnCursor = dom.closest(target, '.js-menu-submenu'); - } - - this._refreshMenuDisplay(layerOnCursor); - }; - - /** - * Scroll handle for prevent break position after scrolling - * @private - */ - - - ContextMenu.prototype._onPageScroll = function _onPageScroll() { - this.pageScrolled = true; - }; - - /** - * Event handler - * @param {MouseEvent} clickEvent - mouse event object - * @private - */ - - - ContextMenu.prototype._onContextMenu = function _onContextMenu(clickEvent) { - var opt = this.options; - - var target = clickEvent.target || clickEvent.srcElement; - var relatedLayer = void 0; - - while (target.parentNode) { - var findElement = this.layerMap.get(target); - - if (findElement) { - relatedLayer = findElement; - break; - } - - target = target.parentNode; - } - - if (!relatedLayer) { - return; - } - - dom.preventDefault(clickEvent); - - this.activeLayer = relatedLayer; - - var position = dom.getMousePosition(clickEvent, document.body || document.documentElement); - - var left = position[0]; //clickEvent.clientX; - var top = position[1]; //clickEvent.clientY; - var debouncedMouseMove = util.debounce(util.bind(this._onMouseMove, this), opt.delay); - - this.cloneMouseMoveEvent = function (mouseMoveEvent) { - var virtualMouseEvent = { - target: mouseMoveEvent.target || mouseMoveEvent.srcElement - }; - - debouncedMouseMove(virtualMouseEvent); - }; - - this._showRootMenu(left, top); - - dom.on(relatedLayer.container, 'mousemove', this.cloneMouseMoveEvent, this); - dom.on(document, 'mousedown', this._onMouseDown, this); - dom.on(document, 'click', this._onMouseClick, this); - dom.on(document, 'scroll', this._onPageScroll, this); - }; - - /** - * Register context menu - * @param {string} selector - css selector for displaying contextmenu at - * secondary mouse button click - * @param {function} callback - callback for each menu item clicked - * @param {MenuItem[]} menuItems - menu item schema - * @api - */ - - - ContextMenu.prototype.register = function register(selector, callback, menuItems) { - var target = dom.find(selector); - - if (!target) { - return; - } - - var layer = new tui.component.FloatingLayer(this.container, MODALESS); - - layer.callback = callback; - layer.setBound({ width: 'auto', height: 'auto' }); - layer.setContent((0, _contextmenu2['default'])(menuItems)); - - this.layerMap.set(target, layer); - }; - - /** - * Unregister context menu - * @param {string} selector - css selector used for register context menu - * @returns {boolean} whether unregister is successful? - * @api - */ - - - ContextMenu.prototype.unregister = function unregister(selector) { - var layerMap = this.layerMap; - var target = dom.find(selector); - - if (!target) { - return false; - } - - var layer = layerMap.get(target); - - if (!layer) { - return false; - } - - layer.destroy(); - - layerMap['delete'](target); - - return true; - }; - - return ContextMenu; -}(); - -exports['default'] = ContextMenu; - -},{"./contextmenu.hbs":22,"./core":24}],24:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.noop = noop; -exports.uniq = uniq; -exports.reduce = reduce; -exports.remove = remove; - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -/** - * @fileoverview Core utility methods module - * @author NHN Ent. FE Development team - */ -var util = tui.util; - -/** - * A no-operation function that returns undefined regardless of the arguments - * it receives. - */ -function noop() {} - -/** - * Create a duplicate-free version of an array - * @param {Array} array - The array to inspect. - * @returns {Array} Returns the new duplicate free array. - */ -function uniq(array) { - return [].concat(_toConsumableArray(new Set(array))); -} - -/** - * @param {Collection} collection - The collection to iterate over. - * @param {function} [iteratee] - The function invoked per iteration. - * @param {*} accumulator - The initial value. - * @returns {*} Returns the accumulated value. - */ -function reduce(collection, iteratee, accumulator) { - if (util.isArray(collection)) { - if (accumulator) { - return collection.reduce(iteratee, accumulator); - } - - return collection.reduce(iteratee); - } - - util.forEach(collection, function (value, index) { - if (typeof accumulator === 'undefined') { - accumulator = value; - } else { - accumulator = iteratee(accumulator, value, index); - } - }); - - return accumulator; -} - -/** - * Removes all elements from array that predicate returns truthy for and - * returns an array of the removed elements. The predicate is invoked with - * three arguments: (value, index, array). - * @param {Array} array - The array to modify. - * @param {(Function|String|Number)} predicate - The function invoked per - * iteration. - * @returns {Array} Returns the new array of removed elements. - */ -function remove(array, predicate) { - var match = void 0; - - if (util.isFunction(predicate)) { - match = function match(v) { - return predicate(v); - }; - } else { - match = function match(v) { - return predicate === v; - }; - } - - var removed = []; - - for (var idx = 0, len = array.length; idx < len; idx += 1) { - var value = array[idx]; - if (match(value, idx, array)) { - removed.push(value); - array.splice(idx, 1); - len -= 1; - idx -= 1; - } - } - - return removed; -} - -},{}]},{},[1]); diff --git a/contextmenu.min.js b/contextmenu.min.js deleted file mode 100644 index c3508a2..0000000 --- a/contextmenu.min.js +++ /dev/null @@ -1 +0,0 @@ -!function e(t,n,r){function o(i,s){if(!n[i]){if(!t[i]){var l="function"==typeof require&&require;if(!s&&l)return l(i,!0);if(a)return a(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[i]={exports:{}};t[i][0].call(c.exports,function(e){var n=t[i][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i= 2.0.0-beta.1",7:">= 4.0.0"};n.REVISION_CHANGES=h;var m="[object Object]";o.prototype={constructor:o,logger:d["default"],log:d["default"].log,registerHelper:function(e,t){if(a.toString.call(e)===m){if(t)throw new s["default"]("Arg not supported with multiple helpers");a.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(a.toString.call(e)===m)a.extend(this.partials,e);else{if("undefined"==typeof t)throw new s["default"]('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if(a.toString.call(e)===m){if(t)throw new s["default"]("Arg not supported with multiple decorators");a.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]}};var v=d["default"].log;n.log=v,n.createFrame=a.createFrame,n.logger=d["default"]},{"./decorators":4,"./exception":6,"./helpers":7,"./logger":15,"./utils":19}],4:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){i["default"](e)}n.__esModule=!0,n.registerDefaultDecorators=o;var a=e("./decorators/inline"),i=r(a)},{"./decorators/inline":5}],5:[function(e,t,n){"use strict";n.__esModule=!0;var r=e("../utils");n["default"]=function(e){e.registerDecorator("inline",function(e,t,n,o){var a=e;return t.partials||(t.partials={},a=function(o,a){var i=n.partials;n.partials=r.extend({},i,t.partials);var s=e(o,a);return n.partials=i,s}),t.partials[o.args[0]]=o.fn,a})},t.exports=n["default"]},{"../utils":19}],6:[function(e,t,n){"use strict";function r(e,t){var n=t&&t.loc,a=void 0,i=void 0;n&&(a=n.start.line,i=n.start.column,e+=" - "+a+":"+i);for(var s=Error.prototype.constructor.call(this,e),l=0;l0?(n.ids&&(n.ids=[n.name]),e.helpers.each(t,n)):o(this);if(n.data&&n.ids){var i=r.createFrame(n.data);i.contextPath=r.appendContextPath(n.data.contextPath,n.name),n={data:i}}return a(t,n)})},t.exports=n["default"]},{"../utils":19}],9:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}n.__esModule=!0;var o=e("../utils"),a=e("../exception"),i=r(a);n["default"]=function(e){e.registerHelper("each",function(e,t){function n(t,n,a){u&&(u.key=t,u.index=n,u.first=0===n,u.last=!!a,c&&(u.contextPath=c+t)),l+=r(e[t],{data:u,blockParams:o.blockParams([e[t],t],[c+t,null])})}if(!t)throw new i["default"]("Must pass iterator to #each");var r=t.fn,a=t.inverse,s=0,l="",u=void 0,c=void 0;if(t.data&&t.ids&&(c=o.appendContextPath(t.data.contextPath,t.ids[0])+"."),o.isFunction(e)&&(e=e.call(this)),t.data&&(u=o.createFrame(t.data)),e&&"object"==typeof e)if(o.isArray(e))for(var d=e.length;s=0?t:parseInt(e,10)}return e},log:function(e){if(e=o.lookupLevel(e),"undefined"!=typeof console&&o.lookupLevel(o.level)<=e){var t=o.methodMap[e];console[t]||(t="log");for(var n=arguments.length,r=Array(n>1?n-1:0),a=1;a":">",'"':""","'":"'","`":"`","=":"="},f=/[&<>"'`=]/g,p=/[&<>"'`=]/,h=Object.prototype.toString;n.toString=h;var m=function(e){return"function"==typeof e};m(/x/)&&(n.isFunction=m=function(e){return"function"==typeof e&&"[object Function]"===h.call(e)}),n.isFunction=m;var v=Array.isArray||function(e){return!(!e||"object"!=typeof e)&&"[object Array]"===h.call(e)};n.isArray=v},{}],20:[function(e,t,n){t.exports=e("./dist/cjs/handlebars.runtime")["default"]},{"./dist/cjs/handlebars.runtime":2}],21:[function(e,t,n){t.exports=e("handlebars/runtime")["default"]},{"handlebars/runtime":20}],22:[function(e,t,n){var r=e("hbsfy/runtime");t.exports=r.template({1:function(e,t,n,r,o){var a;return'
\n'+(null!=(a=n.each.call(null!=t?t:{},t,{name:"each",hash:{},fn:e.program(2,o,0),inverse:e.noop,data:o}))?a:"")+"
\n"},2:function(e,t,n,r,o){var a;return'
\n'+(null!=(a=n["if"].call(null!=t?t:{},null!=t?t.separator:t,{name:"if",hash:{},fn:e.program(3,o,0),inverse:e.program(5,o,0),data:o}))?a:"")+"
\n"},3:function(e,t,n,r,o){return'
\n'},5:function(e,t,n,r,o){var a;return null!=(a=n["if"].call(null!=t?t:{},null!=t?t.menu:t,{name:"if",hash:{},fn:e.program(6,o,0),inverse:e.program(11,o,0),data:o}))?a:""},6:function(e,t,n,r,o){var a;return null!=(a=n["if"].call(null!=t?t:{},null!=t?t.disable:t,{name:"if",hash:{},fn:e.program(7,o,0),inverse:e.program(9,o,0),data:o}))?a:""},7:function(e,t,n,r,o){var a,i=null!=t?t:{},s=n.helperMissing,l="function",u=e.escapeExpression;return'
'+u((a=null!=(a=n.title||(null!=t?t.title:t))?a:s,typeof a===l?a.call(i,{name:"title",hash:{},data:o}):a))+"
\n"},9:function(e,t,n,r,o){var a,i,s=null!=t?t:{},l=n.helperMissing,u="function",c=e.escapeExpression;return'
'+c((i=null!=(i=n.title||(null!=t?t.title:t))?i:l,typeof i===u?i.call(s,{name:"title",hash:{},data:o}):i))+'
\n \n"},11:function(e,t,n,r,o){var a;return null!=(a=n["if"].call(null!=t?t:{},null!=t?t.disable:t,{name:"if",hash:{},fn:e.program(7,o,0),inverse:e.program(12,o,0),data:o}))?a:""},12:function(e,t,n,r,o){var a,i=null!=t?t:{},s=n.helperMissing,l="function",u=e.escapeExpression;return'
'+u((a=null!=(a=n.title||(null!=t?t.title:t))?a:s,typeof a===l?a.call(i,{name:"title",hash:{},data:o}):a))+"
\n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,o,a,i){var s;return'
\n'+(null!=(s=e.invokePartial(r.menuItem,t,{name:"menuItem",data:o,indent:" ",helpers:n,partials:r,decorators:e.decorators}))?s:"")+"
\n"},main_d:function(e,t,n,r,o,a,i){var s=n.decorators;return e=s.inline(e,t,n,{name:"inline",hash:{},fn:n.program(1,o,0,a,i),inverse:n.noop,args:["menuItem"],data:o})||e},useDecorators:!0,usePartial:!0,useData:!0,useDepths:!0})},{"hbsfy/runtime":21}],23:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./core"),s=o(i),l=e("./contextmenu.hbs"),u=r(l),c=tui.util,d={modaless:!0},f=function(){function e(t){var n=arguments.length<=1||void 0===arguments[1]?{delay:130}:arguments[1];a(this,e),this.options=Object.assign({},n),this.container=t,this.layerMap=new Map,this.activeLayer=null,this.pageScrolled=!1,this.cloneMouseMoveEvent=null,dom.on(document,"contextmenu",this._onContextMenu,this)}return e.prototype.destroy=function(){dom.off(document,"contextmenu",this._onContextMenu,this),this._hideContextMenu(),this.container=this.layerMap=this.activeLayer=this.pageScolled=this.cloneMouseMoveEvent=null},e.prototype._hideContextMenu=function(){var e=this.activeLayer;if(e){dom.off(e.container,"mousemove",this.cloneMouseMoveEvent,this),dom.off(document,"mousedown",this._onMouseDown,this),dom.off(document,"click",this._onMouseClick,this),dom.off(document,"scroll",this._onPageScroll,this),e.hide();var t=function(e){dom.css(e,{display:"none",marginTop:""})};dom.findAll(e.container,".js-menu-root").forEach(t),dom.findAll(e.container,".js-menu-submenu").forEach(t),this.pageScrolled=!1,this.activeLayer=this.cloneMouseMoveEvent=null}},e.prototype._onMouseDown=function(e){var t=e.target||e.srcElement;dom.closest(t,".js-menu-root")||this._hideContextMenu()},e.prototype._onMouseClick=function(e){var t=e.target||e.srcElement,n=dom.textContent(t).trim(),r=dom.getData(t,"command"),o=dom.closest(t,".floating-layer"),a=dom.hasClass(t,"js-menu-button"),i=dom.hasClass(t,"js-menu-separator"),s=dom.hasClass(t,"js-menu-has-submenu"),l=dom.hasClass(t,"js-menu-disable");if(l)return void this._hideContextMenu();if(o&&a&&!i&&!s){var u=!0,c=!1,d=void 0;try{for(var f,p=this.layerMap.values()[Symbol.iterator]();!(u=(f=p.next()).done);u=!0){var h=f.value;if(o===h.container)return h.callback(e,r||n),void this._hideContextMenu()}}catch(m){c=!0,d=m}finally{try{!u&&p["return"]&&p["return"]()}finally{if(c)throw d}}}},e.prototype._showWithoutOverflow=function(e){var t=arguments.length<=1||void 0===arguments[1]?{rightOverflow:s.noop,bottomOverflow:s.noop}:arguments[1],n=arguments.length<=2||void 0===arguments[2]?{marginTop:"",marginLeft:""}:arguments[2];dom.css(e,"visibility","hidden"),dom.css(e,n),dom.css(e,"display","block");var r=dom.getRect(e),o=r.right,a=r.bottom,i=(e.document||e.ownerDocument).documentElement,l=i.clientWidth,u=i.clientHeight,c=o>l,d=a>u;c&&t.rightOverflow(e,o,l),d&&t.bottomOverflow(e,a,u),dom.css(e,"visibility","")},e.prototype._showRootMenu=function(e,t){var n=this.activeLayer;if(n){var r=dom.find(n.container,".js-menu-root");n.setBound({left:e,top:t}),n.show(),this._showWithoutOverflow(r,{rightOverflow:function(e,t,n){dom.css(e,"marginLeft",n-t+"px")},bottomOverflow:function(e,t,n){dom.css(e,"marginTop",n-t+"px")}})}},e.prototype._showSubMenu=function(e){this._showWithoutOverflow(e,{rightOverflow:function(e,t,n){dom.css(e,"marginLeft",n-t+e.clientWidth+"px")},bottomOverflow:function(e,t,n){dom.css(e,"marginTop",n-t+"px")}},{marginTop:"",marginLeft:"100%"})},e.prototype._refreshMenuDisplay=function(e){for(var t=this.activeLayer.container,n=dom.findAll(t,".js-menu-submenu"),r=[];e&&t!==e;)dom.hasClass(e,"js-menu-submenu")&&r.push(e),e=e.parentNode;n.forEach(function(e){r.indexOf(e)<0&&dom.css(e,"display","none")}),r.forEach(c.bind(this._showSubMenu,this))},e.prototype._onMouseMove=function(e){if(this.pageScrolled)return void(this.pageScrolled=!1);var t=e.target||e.srcElement,n=this.activeLayer;if(n&&dom.closest(t,".js-menu-root")){var r=void 0;r=dom.hasClass(t,"js-menu-has-submenu")?dom.find(t.parentNode,".js-menu-submenu"):dom.closest(t,".js-menu-submenu"),this._refreshMenuDisplay(r)}},e.prototype._onPageScroll=function(){this.pageScrolled=!0},e.prototype._onContextMenu=function(e){for(var t=this.options,n=e.target||e.srcElement,r=void 0;n.parentNode;){var o=this.layerMap.get(n);if(o){r=o;break}n=n.parentNode}if(r){dom.preventDefault(e),this.activeLayer=r;var a=dom.getMousePosition(e,document.body||document.documentElement),i=a[0],s=a[1],l=c.debounce(c.bind(this._onMouseMove,this),t.delay);this.cloneMouseMoveEvent=function(e){var t={target:e.target||e.srcElement};l(t)},this._showRootMenu(i,s),dom.on(r.container,"mousemove",this.cloneMouseMoveEvent,this),dom.on(document,"mousedown",this._onMouseDown,this),dom.on(document,"click",this._onMouseClick,this),dom.on(document,"scroll",this._onPageScroll,this)}},e.prototype.register=function(e,t,n){var r=dom.find(e);if(r){var o=new tui.component.FloatingLayer(this.container,d);o.callback=t,o.setBound({width:"auto",height:"auto"}),o.setContent((0,u["default"])(n)),this.layerMap.set(r,o)}},e.prototype.unregister=function(e){var t=this.layerMap,n=dom.find(e);if(!n)return!1;var r=t.get(n);return!!r&&(r.destroy(),t["delete"](n),!0)},e}();n["default"]=f},{"./contextmenu.hbs":22,"./core":24}],24:[function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t + */ + var util = tui.util; + + /** + * A no-operation function that returns undefined regardless of the arguments + * it receives. + * @ignore + */ + function noop() {} + + /** + * Create a duplicate-free version of an array + * @param {Array} array - The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @ignore + */ + function uniq(array) { + return [].concat(_toConsumableArray(new Set(array))); + } + + /** + * @param {Collection} collection - The collection to iterate over. + * @param {function} [iteratee] - The function invoked per iteration. + * @param {*} accumulator - The initial value. + * @returns {*} Returns the accumulated value. + * @ignore + */ + function reduce(collection, iteratee, accumulator) { + if (util.isArray(collection)) { + if (accumulator) { + return collection.reduce(iteratee, accumulator); + } + + return collection.reduce(iteratee); + } + + util.forEach(collection, function (value, index) { + if (typeof accumulator === 'undefined') { + accumulator = value; + } else { + accumulator = iteratee(accumulator, value, index); + } + }); + + return accumulator; + } + + /** + * Removes all elements from array that predicate returns truthy for and + * returns an array of the removed elements. The predicate is invoked with + * three arguments: (value, index, array). + * @param {Array} array - The array to modify. + * @param {(Function|String|Number)} predicate - The function invoked per + * iteration. + * @returns {Array} Returns the new array of removed elements. + * @ignore + */ + function remove(array, predicate) { + var match = void 0; + + if (util.isFunction(predicate)) { + match = function match(v) { + return predicate(v); + }; + } else { + match = function match(v) { + return predicate === v; + }; + } + + var removed = []; + + for (var idx = 0, len = array.length; idx < len; idx += 1) { + var value = array[idx]; + if (match(value, idx, array)) { + removed.push(value); + array.splice(idx, 1); + len -= 1; + idx -= 1; + } + } + + return removed; + } + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _core = __webpack_require__(1); + + var core = _interopRequireWildcard(_core); + + var _contextmenu = __webpack_require__(3); + + var _contextmenu2 = _interopRequireDefault(_contextmenu); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @fileoverview Context menu component + * @author NHN Ent. FE Development Lab + */ + var util = tui.util; + var dom = tui.dom; + + var MODALESS = { modaless: true }; + + /** + * @typedef MenuItem + * @property {string} title - title of menu item + * @property {string} [command] - string for alternative of using title to command + * @property {boolean} [separator=false] - set true then this menu will use + * separator + * @property {MenuItem[]} [menu] - you can define submenu recursivly + */ + + /** + * ContextMenu + * @tutorial default + */ + + var ContextMenu = function () { + /** + * Constructor + * @constructor + * @param {HTMLElement} container - container for placing context menu + * floating layers + * @param {object} options - options for context menu + * @param {number} [options.delay=100] - delay for displaying submenu + * @example + * var menu = new tui.component.ContextMenu(document.querySelector('#fl')); + */ + function ContextMenu(container) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + delay: 130 + }; + + _classCallCheck(this, ContextMenu); + + /** + * @type {object} + * @private + */ + this.options = Object.assign({}, options); + /** + * @type {HTMLElement} + * @private + */ + this.container = container; + + /** + * @type {Map} + * @private + */ + this.layerMap = new Map(); + + /** + * @type {FloatingLayer} + * @private + */ + this.activeLayer = null; + + /** + * @type {boolean} + * @private + */ + this.pageScrolled = false; + + /** + * @type {function} + * @private + */ + this.cloneMouseMoveEvent = null; + + dom.on(document, 'contextmenu', this._onContextMenu, this); + } + + /** + * Destructor + */ + + + ContextMenu.prototype.destroy = function destroy() { + dom.off(document, 'contextmenu', this._onContextMenu, this); + + this._hideContextMenu(); + + this.container = this.layerMap = this.activeLayer = this.pageScolled = this.cloneMouseMoveEvent = null; + }; + + /** + * Hide activated context menu and unbind related DOM events + * @private + */ + + + ContextMenu.prototype._hideContextMenu = function _hideContextMenu() { + var layer = this.activeLayer; + + if (!layer) { + return; + } + + dom.off(layer.container, 'mousemove', this.cloneMouseMoveEvent, this); + dom.off(document, 'mousedown', this._onMouseDown, this); + dom.off(document, 'click', this._onMouseClick, this); + dom.off(document, 'scroll', this._onPageScroll, this); + + layer.hide(); + + var hideElement = function hideElement(menu) { + dom.css(menu, { + display: 'none', + marginTop: '' + }); + }; + + dom.findAll(layer.container, '.js-menu-root').forEach(hideElement); + dom.findAll(layer.container, '.js-menu-submenu').forEach(hideElement); + + this.pageScrolled = false; + this.activeLayer = this.cloneMouseMoveEvent = null; + }; + + /** + * Mouse down event handler for close context menu + * @param {MouseEvent} mouseDownEvent - mouseDown event object + * @private + */ + + + ContextMenu.prototype._onMouseDown = function _onMouseDown(mouseDownEvent) { + var target = mouseDownEvent.target || mouseDownEvent.srcElement; + + if (!dom.closest(target, '.js-menu-root')) { + this._hideContextMenu(); + } + }; + + /** + * Mouse click event handler for invoking callback when click menu item + * @param {MouseEvent} clickEvent - click MouseEvent object + * @private + */ + + + ContextMenu.prototype._onMouseClick = function _onMouseClick(clickEvent) { + var target = clickEvent.target || clickEvent.srcElement; + var title = dom.textContent(target).trim(); + var command = dom.getData(target, 'command'); + var container = dom.closest(target, '.floating-layer'); + var isMenuButton = dom.hasClass(target, 'js-menu-button'); + var isSeparator = dom.hasClass(target, 'js-menu-separator'); + var hasSubmenu = dom.hasClass(target, 'js-menu-has-submenu'); + var isDisableButton = dom.hasClass(target, 'js-menu-disable'); + + if (isDisableButton) { + this._hideContextMenu(); + + return; + } + + if (!(container && isMenuButton)) { + return; + } + + if (isSeparator || hasSubmenu) { + return; + } + + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = this.layerMap.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var layer = _step.value; + + if (container === layer.container) { + layer.callback(clickEvent, command || title); + this._hideContextMenu(); + + return; + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator['return']) { + _iterator['return'](); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + }; + + /** + * Show menu element without veil browser viewport + * @param {HTMLElement} element - menu element + * @param {object} [strategy] - methods for handle situations that + * menu veil by browser viewports + * @param {object} [initialStyle] - initial style before + * calculating new bound + * @private + */ + + + ContextMenu.prototype._showWithoutOverflow = function _showWithoutOverflow(element) { + var strategy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { rightOverflow: core.noop, bottomOverflow: core.noop }; + var initialStyle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { marginTop: '', marginLeft: '' }; + + dom.css(element, 'visibility', 'hidden'); + dom.css(element, initialStyle); + dom.css(element, 'display', 'block'); + + var _dom$getRect = dom.getRect(element), + menuRight = _dom$getRect.right, + menuBottom = _dom$getRect.bottom; + + var menuDoc = (element.document || element.ownerDocument).documentElement; + var viewportWidth = menuDoc.clientWidth, + viewportHeight = menuDoc.clientHeight; + + + var isRightOverflowed = menuRight > viewportWidth; + var isBottomOverflowed = menuBottom > viewportHeight; + + if (isRightOverflowed) { + strategy.rightOverflow(element, menuRight, viewportWidth); + } + + if (isBottomOverflowed) { + strategy.bottomOverflow(element, menuBottom, viewportHeight); + } + + dom.css(element, 'visibility', ''); + }; + + /** + * Show root menu element + * @param {number} left - left pixel position + * @param {number} top - top pixel position + * @private + */ + + + ContextMenu.prototype._showRootMenu = function _showRootMenu(left, top) { + var layer = this.activeLayer; + + if (!layer) { + return; + } + + var rootMenuElement = dom.find(layer.container, '.js-menu-root'); + + layer.setBound({ left: left, top: top }); + layer.show(); + + this._showWithoutOverflow(rootMenuElement, { + rightOverflow: function rightOverflow(el, right, viewportWidth) { + dom.css(el, 'marginLeft', viewportWidth - right + 'px'); + }, + bottomOverflow: function bottomOverflow(el, bottom, viewportHeight) { + dom.css(el, 'marginTop', viewportHeight - bottom + 'px'); + } + }); + }; + + /** + * Show sub menu element + * @param {HTMLElement} element - submenu root element + * @private + */ + + + ContextMenu.prototype._showSubMenu = function _showSubMenu(element) { + this._showWithoutOverflow(element, { + rightOverflow: function rightOverflow(el, right, viewportWidth) { + dom.css(el, 'marginLeft', viewportWidth - right + el.clientWidth + 'px'); + }, + bottomOverflow: function bottomOverflow(el, bottom, viewportHeight) { + dom.css(el, 'marginTop', viewportHeight - bottom + 'px'); + } + }, { + marginTop: '', + marginLeft: '100%' + }); + }; + + /** + * Refresh all submenu element + * + * Hide elements that no related with mouse event and show others + * @param {HTMLElement} layerOnCursor - layer element on cursor + * @private + */ + + + ContextMenu.prototype._refreshMenuDisplay = function _refreshMenuDisplay(layerOnCursor) { + var container = this.activeLayer.container; + var allSubmenus = dom.findAll(container, '.js-menu-submenu'); + var layersUntilRoot = []; + + while (layerOnCursor && container !== layerOnCursor) { + if (dom.hasClass(layerOnCursor, 'js-menu-submenu')) { + layersUntilRoot.push(layerOnCursor); + } + + layerOnCursor = layerOnCursor.parentNode; + } + + allSubmenus.forEach(function (menuElement) { + if (layersUntilRoot.indexOf(menuElement) < 0) { + dom.css(menuElement, 'display', 'none'); + } + }); + + layersUntilRoot.forEach(util.bind(this._showSubMenu, this)); + }; + + /** + * Mouse move event handler for reveal context menus + * @param {MouseEvent} mouseMoveEvent - mouse move event object + * @private + */ + + + ContextMenu.prototype._onMouseMove = function _onMouseMove(mouseMoveEvent) { + if (this.pageScrolled) { + this.pageScrolled = false; + + return; + } + + var target = mouseMoveEvent.target || mouseMoveEvent.srcElement; + var activeLayer = this.activeLayer; + + if (!(activeLayer && dom.closest(target, '.js-menu-root'))) { + return; + } + + var layerOnCursor = void 0; + + if (dom.hasClass(target, 'js-menu-has-submenu')) { + layerOnCursor = dom.find(target.parentNode, '.js-menu-submenu'); + } else { + layerOnCursor = dom.closest(target, '.js-menu-submenu'); + } + + this._refreshMenuDisplay(layerOnCursor); + }; + + /** + * Scroll handle for prevent break position after scrolling + * @private + */ + + + ContextMenu.prototype._onPageScroll = function _onPageScroll() { + this.pageScrolled = true; + }; + + /** + * Event handler + * @param {MouseEvent} clickEvent - mouse event object + * @private + */ + + + ContextMenu.prototype._onContextMenu = function _onContextMenu(clickEvent) { + var opt = this.options; + + var target = clickEvent.target || clickEvent.srcElement; + var relatedLayer = void 0; + + while (target.parentNode) { + var findElement = this.layerMap.get(target); + + if (findElement) { + relatedLayer = findElement; + break; + } + + target = target.parentNode; + } + + if (!relatedLayer) { + return; + } + + dom.preventDefault(clickEvent); + + this.activeLayer = relatedLayer; + + var position = dom.getMousePosition(clickEvent, document.body || document.documentElement); + + var left = position[0]; //clickEvent.clientX; + var top = position[1]; //clickEvent.clientY; + var debouncedMouseMove = util.debounce(util.bind(this._onMouseMove, this), opt.delay); + + this.cloneMouseMoveEvent = function (mouseMoveEvent) { + var virtualMouseEvent = { + target: mouseMoveEvent.target || mouseMoveEvent.srcElement + }; + + debouncedMouseMove(virtualMouseEvent); + }; + + this._showRootMenu(left, top); + + dom.on(relatedLayer.container, 'mousemove', this.cloneMouseMoveEvent, this); + dom.on(document, 'mousedown', this._onMouseDown, this); + dom.on(document, 'click', this._onMouseClick, this); + dom.on(document, 'scroll', this._onPageScroll, this); + }; + + /** + * Register context menu + * @param {string} selector - css selector for displaying contextmenu at + * secondary mouse button click + * @param {function} callback - callback for each menu item clicked + * @param {MenuItem[]} menuItems - menu item schema + */ + + + ContextMenu.prototype.register = function register(selector, callback, menuItems) { + var target = dom.find(selector); + + if (!target) { + return; + } + + var layer = new tui.component.FloatingLayer(this.container, MODALESS); + + layer.callback = callback; + layer.setBound({ width: 'auto', height: 'auto' }); + layer.setContent((0, _contextmenu2['default'])(menuItems)); + + this.layerMap.set(target, layer); + }; + + /** + * Unregister context menu + * @param {string} selector - css selector used for register context menu + * @returns {boolean} whether unregister is successful? + */ + + + ContextMenu.prototype.unregister = function unregister(selector) { + var layerMap = this.layerMap; + var target = dom.find(selector); + + if (!target) { + return false; + } + + var layer = layerMap.get(target); + + if (!layer) { + return false; + } + + layer.destroy(); + + layerMap['delete'](target); + + return true; + }; + + return ContextMenu; + }(); + + exports['default'] = ContextMenu; + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + // hbsfy compiled Handlebars template + var HandlebarsCompiler = __webpack_require__(4); + module.exports = HandlebarsCompiler.template({"1":function(container,depth0,helpers,partials,data) { + var stack1; + + return "
\n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},depth0,{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
\n"; + },"2":function(container,depth0,helpers,partials,data) { + var stack1; + + return "
\n" + + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.separator : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.program(5, data, 0),"data":data})) != null ? stack1 : "") + + "
\n"; + },"3":function(container,depth0,helpers,partials,data) { + return "
\n"; + },"5":function(container,depth0,helpers,partials,data) { + var stack1; + + return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.menu : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.program(11, data, 0),"data":data})) != null ? stack1 : ""); + },"6":function(container,depth0,helpers,partials,data) { + var stack1; + + return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.disable : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.program(9, data, 0),"data":data})) != null ? stack1 : ""); + },"7":function(container,depth0,helpers,partials,data) { + var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + + return "
" + + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) + + "
\n"; + },"9":function(container,depth0,helpers,partials,data) { + var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + + return "
" + + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) + + "
\n
\n" + + ((stack1 = container.invokePartial(partials.menuItem,(depth0 != null ? depth0.menu : depth0),{"name":"menuItem","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
\n"; + },"11":function(container,depth0,helpers,partials,data) { + var stack1; + + return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.disable : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.program(12, data, 0),"data":data})) != null ? stack1 : ""); + },"12":function(container,depth0,helpers,partials,data) { + var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + + return "
" + + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) + + "
\n"; + },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { + var stack1; + + return "\n\n
\n" + + ((stack1 = container.invokePartial(partials.menuItem,depth0,{"name":"menuItem","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
\n"; + },"main_d": function(fn, props, container, depth0, data, blockParams, depths) { + + var decorators = container.decorators; + + fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.noop,"args":["menuItem"],"data":data}) || fn; + return fn; + } + + ,"useDecorators":true,"usePartial":true,"useData":true,"useDepths":true}); + + +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(5)["default"]; + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + // Create a simple path alias to allow browserify to resolve + // the runtime on a supported path. + module.exports = __webpack_require__(6)['default']; + + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + // istanbul ignore next + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + // istanbul ignore next + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + + var _handlebarsBase = __webpack_require__(7); + + var base = _interopRequireWildcard(_handlebarsBase); + + // Each of these augment the Handlebars object. No need to setup here. + // (This is done to easily share code between commonjs and browse envs) + + var _handlebarsSafeString = __webpack_require__(21); + + var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); + + var _handlebarsException = __webpack_require__(9); + + var _handlebarsException2 = _interopRequireDefault(_handlebarsException); + + var _handlebarsUtils = __webpack_require__(8); + + var Utils = _interopRequireWildcard(_handlebarsUtils); + + var _handlebarsRuntime = __webpack_require__(22); + + var runtime = _interopRequireWildcard(_handlebarsRuntime); + + var _handlebarsNoConflict = __webpack_require__(23); + + var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); + + // For compatibility and usage outside of module systems, make the Handlebars object a namespace + function create() { + var hb = new base.HandlebarsEnvironment(); + + Utils.extend(hb, base); + hb.SafeString = _handlebarsSafeString2['default']; + hb.Exception = _handlebarsException2['default']; + hb.Utils = Utils; + hb.escapeExpression = Utils.escapeExpression; + + hb.VM = runtime; + hb.template = function (spec) { + return runtime.template(spec, hb); + }; + + return hb; + } + + var inst = create(); + inst.create = create; + + _handlebarsNoConflict2['default'](inst); + + inst['default'] = inst; + + exports['default'] = inst; + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL2xpYi9oYW5kbGViYXJzLnJ1bnRpbWUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OEJBQXNCLG1CQUFtQjs7SUFBN0IsSUFBSTs7Ozs7b0NBSU8sMEJBQTBCOzs7O21DQUMzQix3QkFBd0I7Ozs7K0JBQ3ZCLG9CQUFvQjs7SUFBL0IsS0FBSzs7aUNBQ1Esc0JBQXNCOztJQUFuQyxPQUFPOztvQ0FFSSwwQkFBMEI7Ozs7O0FBR2pELFNBQVMsTUFBTSxHQUFHO0FBQ2hCLE1BQUksRUFBRSxHQUFHLElBQUksSUFBSSxDQUFDLHFCQUFxQixFQUFFLENBQUM7O0FBRTFDLE9BQUssQ0FBQyxNQUFNLENBQUMsRUFBRSxFQUFFLElBQUksQ0FBQyxDQUFDO0FBQ3ZCLElBQUUsQ0FBQyxVQUFVLG9DQUFhLENBQUM7QUFDM0IsSUFBRSxDQUFDLFNBQVMsbUNBQVksQ0FBQztBQUN6QixJQUFFLENBQUMsS0FBSyxHQUFHLEtBQUssQ0FBQztBQUNqQixJQUFFLENBQUMsZ0JBQWdCLEdBQUcsS0FBSyxDQUFDLGdCQUFnQixDQUFDOztBQUU3QyxJQUFFLENBQUMsRUFBRSxHQUFHLE9BQU8sQ0FBQztBQUNoQixJQUFFLENBQUMsUUFBUSxHQUFHLFVBQVMsSUFBSSxFQUFFO0FBQzNCLFdBQU8sT0FBTyxDQUFDLFFBQVEsQ0FBQyxJQUFJLEVBQUUsRUFBRSxDQUFDLENBQUM7R0FDbkMsQ0FBQzs7QUFFRixTQUFPLEVBQUUsQ0FBQztDQUNYOztB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vudmlyb25tZW50KCk7XG5cbiAgVXRpbHMuZXh0ZW5kKGhiLCBiYXNlKTtcbiAgaGIuU2FmZVN0cmluZyA9IFNhZmVTdHJpbmc7XG4gIGhiLkV4Y2VwdGlvbiA9IEV4Y2VwdGlvbjtcbiAgaGIuVXRpbHMgPSBVdGlscztcbiAgaGIuZXNjYXBlRXhwcmVzc2lvbiA9IFV0aWxzLmVzY2FwZUV4cHJlc3Npb247XG5cbiAgaGIuVk0gPSBydW50aW1lO1xuICBoYi50ZW1wbGF0ZSA9IGZ1bmN0aW9uKHNwZWMpIHtcbiAgICByZXR1cm4gcnVudGltZS50ZW1wbGF0ZShzcGVjLCBoYik7XG4gIH07XG5cbiAgcmV0dXJuIGhiO1xufVxuXG5sZXQgaW5zdCA9IGNyZWF0ZSgpO1xuaW5zdC5jcmVhdGUgPSBjcmVhdGU7XG5cbm5vQ29uZmxpY3QoaW5zdCk7XG5cbmluc3RbJ2RlZmF1bHQnXSA9IGluc3Q7XG5cbmV4cG9ydCBkZWZhdWx0IGluc3Q7XG4iXX0= + + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.HandlebarsEnvironment = HandlebarsEnvironment; + // istanbul ignore next + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _utils = __webpack_require__(8); + + var _exception = __webpack_require__(9); + + var _exception2 = _interopRequireDefault(_exception); + + var _helpers = __webpack_require__(10); + + var _decorators = __webpack_require__(18); + + var _logger = __webpack_require__(20); + + var _logger2 = _interopRequireDefault(_logger); + + var VERSION = '4.0.5'; + exports.VERSION = VERSION; + var COMPILER_REVISION = 7; + + exports.COMPILER_REVISION = COMPILER_REVISION; + var REVISION_CHANGES = { + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it + 2: '== 1.0.0-rc.3', + 3: '== 1.0.0-rc.4', + 4: '== 1.x.x', + 5: '== 2.0.0-alpha.x', + 6: '>= 2.0.0-beta.1', + 7: '>= 4.0.0' + }; + + exports.REVISION_CHANGES = REVISION_CHANGES; + var objectType = '[object Object]'; + + function HandlebarsEnvironment(helpers, partials, decorators) { + this.helpers = helpers || {}; + this.partials = partials || {}; + this.decorators = decorators || {}; + + _helpers.registerDefaultHelpers(this); + _decorators.registerDefaultDecorators(this); + } + + HandlebarsEnvironment.prototype = { + constructor: HandlebarsEnvironment, + + logger: _logger2['default'], + log: _logger2['default'].log, + + registerHelper: function registerHelper(name, fn) { + if (_utils.toString.call(name) === objectType) { + if (fn) { + throw new _exception2['default']('Arg not supported with multiple helpers'); + } + _utils.extend(this.helpers, name); + } else { + this.helpers[name] = fn; + } + }, + unregisterHelper: function unregisterHelper(name) { + delete this.helpers[name]; + }, + + registerPartial: function registerPartial(name, partial) { + if (_utils.toString.call(name) === objectType) { + _utils.extend(this.partials, name); + } else { + if (typeof partial === 'undefined') { + throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); + } + this.partials[name] = partial; + } + }, + unregisterPartial: function unregisterPartial(name) { + delete this.partials[name]; + }, + + registerDecorator: function registerDecorator(name, fn) { + if (_utils.toString.call(name) === objectType) { + if (fn) { + throw new _exception2['default']('Arg not supported with multiple decorators'); + } + _utils.extend(this.decorators, name); + } else { + this.decorators[name] = fn; + } + }, + unregisterDecorator: function unregisterDecorator(name) { + delete this.decorators[name]; + } + }; + + var log = _logger2['default'].log; + + exports.log = log; + exports.createFrame = _utils.createFrame; + exports.logger = _logger2['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2Jhc2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7cUJBQTRDLFNBQVM7O3lCQUMvQixhQUFhOzs7O3VCQUNFLFdBQVc7OzBCQUNSLGNBQWM7O3NCQUNuQyxVQUFVOzs7O0FBRXRCLElBQU0sT0FBTyxHQUF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}, +/* 8 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + exports.extend = extend; + exports.indexOf = indexOf; + exports.escapeExpression = escapeExpression; + exports.isEmpty = isEmpty; + exports.createFrame = createFrame; + exports.blockParams = blockParams; + exports.appendContextPath = appendContextPath; + var escape = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`', + '=': '=' + }; + + var badChars = /[&<>"'`=]/g, + possible = /[&<>"'`=]/; + + function escapeChar(chr) { + return escape[chr]; + } + + function extend(obj /* , ...source */) { + for (var i = 1; i < arguments.length; i++) { + for (var key in arguments[i]) { + if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { + obj[key] = arguments[i][key]; + } + } + } + + return obj; + } + + var toString = Object.prototype.toString; + + exports.toString = toString; + // Sourced from lodash + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt + /* eslint-disable func-style */ + var isFunction = function isFunction(value) { + return typeof value === 'function'; + }; + // fallback for older versions of Chrome and Safari + /* istanbul ignore next */ + if (isFunction(/x/)) { + exports.isFunction = isFunction = function (value) { + return typeof value === 'function' && toString.call(value) === '[object Function]'; + }; + } + exports.isFunction = isFunction; + + /* eslint-enable func-style */ + + /* istanbul ignore next */ + var isArray = Array.isArray || function (value) { + return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; + }; + + exports.isArray = isArray; + // Older IE versions do not directly support indexOf so we must implement our own, sadly. + + function indexOf(array, value) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; + } + } + return -1; + } + + function escapeExpression(string) { + if (typeof string !== 'string') { + // don't escape SafeStrings, since they're already safe + if (string && string.toHTML) { + return string.toHTML(); + } else if (string == null) { + return ''; + } else if (!string) { + return string + ''; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = '' + string; + } + + if (!possible.test(string)) { + return string; + } + return string.replace(badChars, escapeChar); + } + + function isEmpty(value) { + if (!value && value !== 0) { + return true; + } else if (isArray(value) && value.length === 0) { + return true; + } else { + return false; + } + } + + function createFrame(object) { + var frame = extend({}, object); + frame._parent = object; + return frame; + } + + function blockParams(params, ids) { + params.path = ids; + return params; + } + + function appendContextPath(contextPath, id) { + return (contextPath ? contextPath + '.' : '') + id; + } + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL3V0aWxzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSxJQUFNLE1BQU0sR0FBRztBQUNiLEtBQUcsRUFBRSxPQUFPO0FBQ1osS0FBRyxFQUFFLE1BQU07QUFDWCxLQUFHLEVBQUUsTUFBTTtBQUNYLEtBQUcsRUFBRSxRQUFRO0FBQ2IsS0FBRyxFQUFFLFFBQVE7QUFDYixLQUFHLEVBQUUsUUFBUTtBQUNiLEtBQUcsRUFBRSxRQUFRO0NBQ2QsQ0FBQzs7QUFFRixJQUFNLFFBQVEsR0FBRyxZQUFZO0lBQ3ZCLFFBQVEsR0FBRyxXQUFXLENBQUM7O0FBRTdCLFNBQVMsVUFBVSxDQUFDLEdBQUcsRUFBRTtBQUN2QixTQUFPLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQztDQUNwQjs7QUFFTSxTQUFTLE1BQU0sQ0FBQyxHQUFHLG9CQUFtQjtBQUMzQyxPQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsU0FBUyxDQUFDLE1BQU0sRUFBRSxDQUFDLEVBQUUsRUFBRTtBQUN6QyxTQUFLLElBQUksR0FBRyxJQUFJLFNBQVMsQ0FBQyxDQUFDLENBQUMsRUFBRTtBQUM1QixVQUFJLE1BQU0sQ0FBQyxTQUFTLENBQUMsY0FBYyxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLEVBQUUsR0FBRyxDQUFDL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* 9 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + + function Exception(message, node) { + var loc = node && node.loc, + line = undefined, + column = undefined; + if (loc) { + line = loc.start.line; + column = loc.start.column; + + message += ' - ' + line + ':' + column; + } + + var tmp = Error.prototype.constructor.call(this, message); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } + + /* istanbul ignore else */ + if (Error.captureStackTrace) { + Error.captureStackTrace(this, Exception); + } + + if (loc) { + this.lineNumber = line; + this.column = column; + } + } + + Exception.prototype = new Error(); + + exports['default'] = Exception; + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2V4Y2VwdGlvbi5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQ0EsSUFBTSxVQUFVLEdBQUcsQ0FBQyxhQUFhLEVBQUUsVUFBVSxFQUFFLFlBQVksRUFBRSxTQUFTLEVBQUUsTUFBTSxFQUFFLFFBQVEsRUFBRSxPQUFPLENBQUMsQ0FBQzs7QUFFbkcsU0FBUyxTQUFTLENBQUMsT0FBTyxFQUFFLElBQUksRUFBRTtBQUNoQyxNQUFJLEdBQUcsR0FBRyxJQUFJLElBQUksSUFBSSxDQUFDLEdBQUc7TUFDdEIsSUFBSSxZQUFBO01BQ0osTUFBTSxZQUFBLENBQUM7QUFDWCxNQUFJLEdBQUcsRUFBRTtBQUNQLFFBQUksR0FBRyxHQUFHLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQztBQUN0QixVQUFNLEdBQUcsR0FBRyxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUM7O0FBRTFCLFdBQU8sSUFBSSxLQUFLLEdBQUcsSUF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obG9jKSB7XG4gICAgbGluZSA9IGxvYy5zdGFydC5saW5lO1xuICAgIGNvbHVtbiA9IGxvYy5zdGFydC5jb2x1bW47XG5cbiAgICBtZXNzYWdlICs9ICcgLSAnICsgbGluZSArICc6JyArIGNvbHVtbjtcbiAgfVxuXG4gIGxldCB0bXAgPSBFcnJvci5wcm90b3R5cGUuY29uc3RydWN0b3IuY2FsbCh0aGlzLCBtZXNzYWdlKTtcblxuICAvLyBVbmZvcnR1bmF0ZWx5IGVycm9ycyBhcmUgbm90IGVudW1lcmFibGUgaW4gQ2hyb21lIChhdCBsZWFzdCksIHNvIGBmb3IgcHJvcCBpbiB0bXBgIGRvZXNuJ3Qgd29yay5cbiAgZm9yIChsZXQgaWR4ID0gMDsgaWR4IDwgZXJyb3JQcm9wcy5sZW5ndGg7IGlkeCsrKSB7XG4gICAgdGhpc1tlcnJvclByb3BzW2lkeF1dID0gdG1wW2Vycm9yUHJvcHNbaWR4XV07XG4gIH1cblxuICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICBpZiAoRXJyb3IuY2FwdHVyZVN0YWNrVHJhY2UpIHtcbiAgICBFcnJvci5jYXB0dXJlU3RhY2tUcmFjZSh0aGlzLCBFeGNlcHRpb24pO1xuICB9XG5cbiAgaWYgKGxvYykge1xuICAgIHRoaXMubGluZU51bWJlciA9IGxpbmU7XG4gICAgdGhpcy5jb2x1bW4gPSBjb2x1bW47XG4gIH1cbn1cblxuRXhjZXB0aW9uLnByb3RvdHlwZSA9IG5ldyBFcnJvcigpO1xuXG5leHBvcnQgZGVmYXVsdCBFeGNlcHRpb247XG4iXX0= + + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.registerDefaultHelpers = registerDefaultHelpers; + // istanbul ignore next + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _helpersBlockHelperMissing = __webpack_require__(11); + + var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); + + var _helpersEach = __webpack_require__(12); + + var _helpersEach2 = _interopRequireDefault(_helpersEach); + + var _helpersHelperMissing = __webpack_require__(13); + + var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); + + var _helpersIf = __webpack_require__(14); + + var _helpersIf2 = _interopRequireDefault(_helpersIf); + + var _helpersLog = __webpack_require__(15); + + var _helpersLog2 = _interopRequireDefault(_helpersLog); + + var _helpersLookup = __webpack_require__(16); + + var _helpersLookup2 = _interopRequireDefault(_helpersLookup); + + var _helpersWith = __webpack_require__(17); + + var _helpersWith2 = _interopRequireDefault(_helpersWith); + + function registerDefaultHelpers(instance) { + _helpersBlockHelperMissing2['default'](instance); + _helpersEach2['default'](instance); + _helpersHelperMissing2['default'](instance); + _helpersIf2['default'](instance); + _helpersLog2['default'](instance); + _helpersLookup2['default'](instance); + _helpersWith2['default'](instance); + } + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2hlbHBlcnMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7eUNBQXVDLGdDQUFnQzs7OzsyQkFDOUMsZ0JBQWdCOzs7O29DQUNQLDBCQUEwQjs7Ozt5QkFDckMsY0FBYzs7OzswQkFDYixlQUFlOzs7OzZCQUNaLGtCQUFrQjs7OzsyQkFDcEIsZ0JBQWdCOzs7O0FBRWxDLFNBQVMsc0JBQXNCLENBQUMsUUFBUSxFQUFFO0FBQy9DLHlDQUEyQixRQUFRLENBQUMsQ0FBQztBQUNyQywyQkFBYSxRQUFRLENBQUMsQ0FBQztBQUN2QixvQ0FBc0IsUUFBUSxDQUFDLENBQUM7QUFDaEMseUJBQVcsUUFBUSxDQUFDLENBQUM7QUFDckIsMEJBQVksUUFBUSxDQUFDLENBQUM7QUFDdEIsNkJBQWUsUUFBUSxDQUFDLENBQUM7QUFDekIsMkJBQWEsUUFBUSxDQUFDLENBQUM7Q0FDeEIiLCJmaWxlIjoiaGVscGVycy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCByZWdpc3RlckJsb2NrSGVscGVyTWlzc2luZyBmcm9tICcuL2hlbHBlcnMvYmxvY2staGVscGVyLW1pc3NpbmcnO1xuaW1wb3J0IHJlZ2lzdGVyRWFjaCBmcm9tICcuL2hlbHBlcnMvZWFjaCc7XG5pbXBvcnQgcmVnaXN0ZXJIZWxwZXJNaXNzaW5nIGZyb20gJy4vaGVscGVycy9oZWxwZXItbWlzc2luZyc7XG5pbXBvcnQgcmVnaXN0ZXJJZiBmcm9tICcuL2hlbHBlcnMvaWYnO1xuaW1wb3J0IHJlZ2lzdGVyTG9nIGZyb20gJy4vaGVscGVycy9sb2cnO1xuaW1wb3J0IHJlZ2lzdGVyTG9va3VwIGZyb20gJy4vaGVscGVycy9sb29rdXAnO1xuaW1wb3J0IHJlZ2lzdGVyV2l0aCBmcm9tICcuL2hlbHBlcnMvd2l0aCc7XG5cbmV4cG9ydCBmdW5jdGlvbiByZWdpc3RlckRlZmF1bHRIZWxwZXJzKGluc3RhbmNlKSB7XG4gIHJlZ2lzdGVyQmxvY2tIZWxwZXJNaXNzaW5nKGluc3RhbmNlKTtcbiAgcmVnaXN0ZXJFYWNoKGluc3RhbmNlKTtcbiAgcmVnaXN0ZXJIZWxwZXJNaXNzaW5nKGluc3RhbmNlKTtcbiAgcmVnaXN0ZXJJZihpbnN0YW5jZSk7XG4gIHJlZ2lzdGVyTG9nKGluc3RhbmNlKTtcbiAgcmVnaXN0ZXJMb29rdXAoaW5zdGFuY2UpO1xuICByZWdpc3RlcldpdGgoaW5zdGFuY2UpO1xufVxuIl19 + + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(8); + + exports['default'] = function (instance) { + instance.registerHelper('blockHelperMissing', function (context, options) { + var inverse = options.inverse, + fn = options.fn; + + if (context === true) { + return fn(this); + } else if (context === false || context == null) { + return inverse(this); + } else if (_utils.isArray(context)) { + if (context.length > 0) { + if (options.ids) { + options.ids = [options.name]; + } + + return instance.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + if (options.data && options.ids) { + var data = _utils.createFrame(options.data); + data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); + options = { data: data }; + } + + return fn(context, options); + } + }); + }; + + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2hlbHBlcnMvYmxvY2staGVscGVyLW1pc3NpbmcuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztxQkFBc0QsVUFBVTs7cUJBRWpELFVBQVMsUUFBUSxFQUFFO0FBQ2hDLFVBQVEsQ0FBQyxjQUFjLENBQUMsb0JBQW9CLEVBQUUsVUFBUyxPQUFPLEVBQUUsT0FBTyxFQUFFO0FBQ3ZFLFFBQUksT0FBTyxHQUFHLE9BQU8sQ0FBQyxPQUFPO1FBQ3pCLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxDQUFDOztBQUVwQixRQUFJLE9BQU8sS0FBSyxJQUFJLEVBQUU7QUFDcEIsYUFBTyxFQUFFLENBQUMsSUFBSSxDQUFDLENBQUM7S0FDakIsTUFBTSxJQUFJLE9BQU8sS0FBSyxLQUFLLElBQUksT0FBTyxJQUFJLElBQUksRUFBRTtBQUMvQyxhQUFPLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztLQUN0QixNQUFNLElBQUksZUFBUSxPQUFPLENBQUMsRUFBRTtBQUMzQixVQUFJLE9BQU8sQ0FBQyxNQUFNLEdBQUcsQ0FBQyxFQUFFO0FBQ3RCLFlBQUksT0FBTyxDQUFDLEdBQUcsRUFBRTtBQUNmLGlCQUFPLENBQUMsR0FBRyxHQUFHLENBQUMsT0FBTyxDQUFDLElBQ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pcyk7XG4gICAgfSBlbHNlIGlmIChjb250ZXh0ID09PSBmYWxzZSB8fCBjb250ZXh0ID09IG51bGwpIHtcbiAgICAgIHJldHVybiBpbnZlcnNlKHRoaXMpO1xuICAgIH0gZWxzZSBpZiAoaXNBcnJheShjb250ZXh0KSkge1xuICAgICAgaWYgKGNvbnRleHQubGVuZ3RoID4gMCkge1xuICAgICAgICBpZiAob3B0aW9ucy5pZHMpIHtcbiAgICAgICAgICBvcHRpb25zLmlkcyA9IFtvcHRpb25zLm5hbWVdO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGluc3RhbmNlLmhlbHBlcnMuZWFjaChjb250ZXh0LCBvcHRpb25zKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHJldHVybiBpbnZlcnNlKHRoaXMpO1xuICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICBpZiAob3B0aW9ucy5kYXRhICYmIG9wdGlvbnMuaWRzKSB7XG4gICAgICAgIGxldCBkYXRhID0gY3JlYXRlRnJhbWUob3B0aW9ucy5kYXRhKTtcbiAgICAgICAgZGF0YS5jb250ZXh0UGF0aCA9IGFwcGVuZENvbnRleHRQYXRoKG9wdGlvbnMuZGF0YS5jb250ZXh0UGF0aCwgb3B0aW9ucy5uYW1lKTtcbiAgICAgICAgb3B0aW9ucyA9IHtkYXRhOiBkYXRhfTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIGZuKGNvbnRleHQsIG9wdGlvbnMpO1xuICAgIH1cbiAgfSk7XG59XG4iXX0= + + +/***/ }, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + // istanbul ignore next + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _utils = __webpack_require__(8); + + var _exception = __webpack_require__(9); + + var _exception2 = _interopRequireDefault(_exception); + + exports['default'] = function (instance) { + instance.registerHelper('each', function (context, options) { + if (!options) { + throw new _exception2['default']('Must pass iterator to #each'); + } + + var fn = options.fn, + inverse = options.inverse, + i = 0, + ret = '', + data = undefined, + contextPath = undefined; + + if (options.data && options.ids) { + contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; + } + + if (_utils.isFunction(context)) { + context = context.call(this); + } + + if (options.data) { + data = _utils.createFrame(options.data); + } + + function execIteration(field, index, last) { + if (data) { + data.key = field; + data.index = index; + data.first = index === 0; + data.last = !!last; + + if (contextPath) { + data.contextPath = contextPath + field; + } + } + + ret = ret + fn(context[field], { + data: data, + blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) + }); + } + + if (context && typeof context === 'object') { + if (_utils.isArray(context)) { + for (var j = context.length; i < j; i++) { + if (i in context) { + execIteration(i, i, i === context.length - 1); + } + } + } else { + var priorKey = undefined; + + for (var key in context) { + if (context.hasOwnProperty(key)) { + // We're running the iterations one step out of sync so we can detect + // the last iteration without have to scan the object twice and create + // an itermediate keys array. + if (priorKey !== undefined) { + execIteration(priorKey, i - 1); + } + priorKey = key; + i++; + } + } + if (priorKey !== undefined) { + execIteration(priorKey, i - 1, true); + } + } + } + + if (i === 0) { + ret = inverse(this); + } + + return ret; + }); + }; + + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2hlbHBlcnMvZWFjaC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7O3FCQUErRSxVQUFVOzt5QkFDbkUsY0FBYzs7OztxQkFFckIsVUFBUyxRQUFRLEVBQUU7QUFDaEMsVUFBUSxDQUFDLGNBQWMsQ0FBQyxNQUFNLEVBQUUsVUFBUyxPQUFPLEVBQUUsT0FBTyxFQUFFO0FBQ3pELFFBQUksQ0FBQyxPQUFPLEVBQUU7QUFDWixZQUFNLDJCQUFjLDZCQUE2QixDQUFDLENBQUM7S0FDcEQ7O0FBRUQsUUFBSSxFQUFFLEdBQUcsT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Jy4nO1xuICAgIH1cblxuICAgIGlmIChpc0Z1bmN0aW9uKGNvbnRleHQpKSB7IGNvbnRleHQgPSBjb250ZXh0LmNhbGwodGhpcyk7IH1cblxuICAgIGlmIChvcHRpb25zLmRhdGEpIHtcbiAgICAgIGRhdGEgPSBjcmVhdGVGcmFtZShvcHRpb25zLmRhdGEpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGV4ZWNJdGVyYXRpb24oZmllbGQsIGluZGV4LCBsYXN0KSB7XG4gICAgICBpZiAoZGF0YSkge1xuICAgICAgICBkYXRhLmtleSA9IGZpZWxkO1xuICAgICAgICBkYXRhLmluZGV4ID0gaW5kZXg7XG4gICAgICAgIGRhdGEuZmlyc3QgPSBpbmRleCA9PT0gMDtcbiAgICAgICAgZGF0YS5sYXN0ID0gISFsYXN0O1xuXG4gICAgICAgIGlmIChjb250ZXh0UGF0aCkge1xuICAgICAgICAgIGRhdGEuY29udGV4dFBhdGggPSBjb250ZXh0UGF0aCArIGZpZWxkO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHJldCA9IHJldCArIGZuKGNvbnRleHRbZmllbGRdLCB7XG4gICAgICAgIGRhdGE6IGRhdGEsXG4gICAgICAgIGJsb2NrUGFyYW1zOiBibG9ja1BhcmFtcyhbY29udGV4dFtmaWVsZF0sIGZpZWxkXSwgW2NvbnRleHRQYXRoICsgZmllbGQsIG51bGxdKVxuICAgICAgfSk7XG4gICAgfVxuXG4gICAgaWYgKGNvbnRleHQgJiYgdHlwZW9mIGNvbnRleHQgPT09ICdvYmplY3QnKSB7XG4gICAgICBpZiAoaXNBcnJheShjb250ZXh0KSkge1xuICAgICAgICBmb3IgKGxldCBqID0gY29udGV4dC5sZW5ndGg7IGkgPCBqOyBpKyspIHtcbiAgICAgICAgICBpZiAoaSBpbiBjb250ZXh0KSB7XG4gICAgICAgICAgICBleGVjSXRlcmF0aW9uKGksIGksIGkgPT09IGNvbnRleHQubGVuZ3RoIC0gMSk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBsZXQgcHJpb3JLZXk7XG5cbiAgICAgICAgZm9yIChsZXQga2V5IGluIGNvbnRleHQpIHtcbiAgICAgICAgICBpZiAoY29udGV4dC5oYXNPd25Qcm9wZXJ0eShrZXkpKSB7XG4gICAgICAgICAgICAvLyBXZSdyZSBydW5uaW5nIHRoZSBpdGVyYXRpb25zIG9uZSBzdGVwIG91dCBvZiBzeW5jIHNvIHdlIGNhbiBkZXRlY3RcbiAgICAgICAgICAgIC8vIHRoZSBsYXN0IGl0ZXJhdGlvbiB3aXRob3V0IGhhdmUgdG8gc2NhbiB0aGUgb2JqZWN0IHR3aWNlIGFuZCBjcmVhdGVcbiAgICAgICAgICAgIC8vIGFuIGl0ZXJtZWRpYXRlIGtleXMgYXJyYXkuXG4gICAgICAgICAgICBpZiAocHJpb3JLZXkgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICBleGVjSXRlcmF0aW9uKHByaW9yS2V5LCBpIC0gMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwcmlvcktleSA9IGtleTtcbiAgICAgICAgICAgIGkrKztcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByaW9yS2V5ICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICBleGVjSXRlcmF0aW9uKHByaW9yS2V5LCBpIC0gMSwgdHJ1ZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG5cbiAgICBpZiAoaSA9PT0gMCkge1xuICAgICAgcmV0ID0gaW52ZXJzZSh0aGlzKTtcbiAgICB9XG5cbiAgICByZXR1cm4gcmV0O1xuICB9KTtcbn1cbiJdfQ== + + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + // istanbul ignore next + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _exception = __webpack_require__(9); + + var _exception2 = _interopRequireDefault(_exception); + + exports['default'] = function (instance) { + instance.registerHelper('helperMissing', function () /* [args, ]options */{ + if (arguments.length === 1) { + // A missing field in a {{foo}} construct. + return undefined; + } else { + // Someone is actually trying to call something, blow up. + throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); + } + }); + }; + + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2hlbHBlcnMvaGVscGVyLW1pc3NpbmcuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozt5QkFBc0IsY0FBYzs7OztxQkFFckIsVUFBUyxRQUFRLEVBQUU7QUFDaEMsVUFBUSxDQUFDLGNBQWMsQ0FBQyxlQUFlLEVBQUUsaUNBQWdDO0FBQ3ZFLFFBQUksU0FBUyxDQUFDLE1BQU0sS0FBSyxDQUFDLEVBQUU7O0FBRTFCLGFBQU8sU0FBUyxDQUFDO0tBQ2xCLE1BQU07O0FBRUwsWUFBTSwyQkFBYyxtQkFBbUIsR0FBRyxTQUFTLENBQUMsU0FBUyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQyxJQUFJLEdBQUcsR0FBRyxDQUFDLENBQUM7S0FDdkY7R0FDRixDQUFDLENBQUM7Q0FDSiIsImZpbGUiOiJoZWxwZXItbWlzc2luZy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBFeGNlcHRpb24gZnJvbSAnLi4vZXhjZXB0aW9uJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24oaW5zdGFuY2UpIHtcbiAgaW5zdGFuY2UucmVnaXN0ZXJIZWxwZXIoJ2hlbHBlck1pc3NpbmcnLCBmdW5jdGlvbigvKiBbYXJncywgXW9wdGlvbnMgKi8pIHtcbiAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PT0gMSkge1xuICAgICAgLy8gQSBtaXNzaW5nIGZpZWxkIGluIGEge3tmb299fSBjb25zdHJ1Y3QuXG4gICAgICByZXR1cm4gdW5kZWZpbmVkO1xuICAgIH0gZWxzZSB7XG4gICAgICAvLyBTb21lb25lIGlzIGFjdHVhbGx5IHRyeWluZyB0byBjYWxsIHNvbWV0aGluZywgYmxvdyB1cC5cbiAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oJ01pc3NpbmcgaGVscGVyOiBcIicgKyBhcmd1bWVudHNbYXJndW1lbnRzLmxlbmd0aCAtIDFdLm5hbWUgKyAnXCInKTtcbiAgICB9XG4gIH0pO1xufVxuIl19 + + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(8); + + exports['default'] = function (instance) { + instance.registerHelper('if', function (conditional, options) { + if (_utils.isFunction(conditional)) { + conditional = conditional.call(this); + } + + // Default behavior is to render the positive path if the value is truthy and not empty. + // The `includeZero` option may be set to treat the condtional as purely not empty based on the + // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. + if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { + return options.inverse(this); + } else { + return options.fn(this); + } + }); + + instance.registerHelper('unless', function (conditional, options) { + return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); + }); + }; + + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2hlbHBlcnMvaWYuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztxQkFBa0MsVUFBVTs7cUJBRTdCLFVBQVMsUUFBUSxFQUFFO0FBQ2hDLFVBQVEsQ0FBQyxjQUFjLENBQUMsSUFBSSxFQUFFLFVBQVMsV0FBVyxFQUFFLE9BQU8sRUFBRTtBQUMzRCxRQUFJLGtCQUFXLFdBQVcsQ0FBQ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k7IH1cblxuICAgIC8vIERlZmF1bHQgYmVoYXZpb3IgaXMgdG8gcmVuZGVyIHRoZSBwb3NpdGl2ZSBwYXRoIGlmIHRoZSB2YWx1ZSBpcyB0cnV0aHkgYW5kIG5vdCBlbXB0eS5cbiAgICAvLyBUaGUgYGluY2x1ZGVaZXJvYCBvcHRpb24gbWF5IGJlIHNldCB0byB0cmVhdCB0aGUgY29uZHRpb25hbCBhcyBwdXJlbHkgbm90IGVtcHR5IGJhc2VkIG9uIHRoZVxuICAgIC8vIGJlaGF2aW9yIG9mIGlzRW1wdHkuIEVmZmVjdGl2ZWx5IHRoaXMgZGV0ZXJtaW5lcyBpZiAwIGlzIGhhbmRsZWQgYnkgdGhlIHBvc2l0aXZlIHBhdGggb3IgbmVnYXRpdmUuXG4gICAgaWYgKCghb3B0aW9ucy5oYXNoLmluY2x1ZGVaZXJvICYmICFjb25kaXRpb25hbCkgfHwgaXNFbXB0eShjb25kaXRpb25hbCkpIHtcbiAgICAgIHJldHVybiBvcHRpb25zLmludmVyc2UodGhpcyk7XG4gICAgfSBlbHNlIHtcbiAgICAgIHJldHVybiBvcHRpb25zLmZuKHRoaXMpO1xuICAgIH1cbiAgfSk7XG5cbiAgaW5zdGFuY2UucmVnaXN0ZXJIZWxwZXIoJ3VubGVzcycsIGZ1bmN0aW9uKGNvbmRpdGlvbmFsLCBvcHRpb25zKSB7XG4gICAgcmV0dXJuIGluc3RhbmNlLmhlbHBlcnNbJ2lmJ10uY2FsbCh0aGlzLCBjb25kaXRpb25hbCwge2ZuOiBvcHRpb25zLmludmVyc2UsIGludmVyc2U6IG9wdGlvbnMuZm4sIGhhc2g6IG9wdGlvbnMuaGFzaH0pO1xuICB9KTtcbn1cbiJdfQ== + + +/***/ }, +/* 15 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + exports['default'] = function (instance) { + instance.registerHelper('log', function () /* message, options */{ + var args = [undefined], + options = arguments[arguments.length - 1]; + for (var i = 0; i < arguments.length - 1; i++) { + args.push(arguments[i]); + } + + var level = 1; + if (options.hash.level != null) { + level = options.hash.level; + } else if (options.data && options.data.level != null) { + level = options.data.level; + } + args[0] = level; + + instance.log.apply(instance, args); + }); + }; + + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2hlbHBlcnMvbG9nLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7cUJBQWUsVUFBUyxRQUFRLEVBQUU7QUFDaEMsVUFBUSxDQUFDLGNBQWMsQ0FBQyxLQUFLLEVBQUUsa0NBQWlDO0FBQzlELFFBQUksSUFBSSxHQUFHLENBQUMsU0FBUyxDQUFDO1FBQ2xCLE9BQU8sR0FBRyxTQUFTLENBQUMsU0FBUyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQztBQUM5QyxTQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsU0FBUyxDQUFDLE1BQU0sR0FBRyxDQUFDLEVBQUUsQ0FBQyxFQUFFLEVBQUU7QUFDN0MsVUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztLQUN6Qjs7QUFFRCxRQUFJLEtBQUssR0FBRyxDQUFDLENBQUM7QUFDZCxRQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsS0FBSyxJQUFJLElBQUksRUFBRTtBQUM5QixXQUFLLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUM7S0FDNUIsTUFBTSxJQUFJLE9BQU8sQ0FBQyxJQUFJLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxLQUFLLElBQUksSUFBSSxFQUFFO0FBQ3JELFdBQUssR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQztLQUM1QjtBQUNELFFBQUksQ0FBQyxDQUFDLENBQUMsR0FBRyxLQUFLLENBQUM7O0FBRWhCLFlBQVEsQ0FBQyxHQUFHLE1BQUEsQ0FBWixRQUFRLEVBQVMsSUFBSSxDQUFDLENBQUM7R0FDeEIsQ0FBQyxDQUFDO0NBQ0oiLCJmaWxlIjoibG9nLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24oaW5zdGFuY2UpIHtcbiAgaW5zdGFuY2UucmVnaXN0ZXJIZWxwZXIoJ2xvZycsIGZ1bmN0aW9uKC8qIG1lc3NhZ2UsIG9wdGlvbnMgKi8pIHtcbiAgICBsZXQgYXJncyA9IFt1bmRlZmluZWRdLFxuICAgICAgICBvcHRpb25zID0gYXJndW1lbnRzW2FyZ3VtZW50cy5sZW5ndGggLSAxXTtcbiAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyZ3VtZW50cy5sZW5ndGggLSAxOyBpKyspIHtcbiAgICAgIGFyZ3MucHVzaChhcmd1bWVudHNbaV0pO1xuICAgIH1cblxuICAgIGxldCBsZXZlbCA9IDE7XG4gICAgaWYgKG9wdGlvbnMuaGFzaC5sZXZlbCAhPSBudWxsKSB7XG4gICAgICBsZXZlbCA9IG9wdGlvbnMuaGFzaC5sZXZlbDtcbiAgICB9IGVsc2UgaWYgKG9wdGlvbnMuZGF0YSAmJiBvcHRpb25zLmRhdGEubGV2ZWwgIT0gbnVsbCkge1xuICAgICAgbGV2ZWwgPSBvcHRpb25zLmRhdGEubGV2ZWw7XG4gICAgfVxuICAgIGFyZ3NbMF0gPSBsZXZlbDtcblxuICAgIGluc3RhbmNlLmxvZyguLi4gYXJncyk7XG4gIH0pO1xufVxuIl19 + + +/***/ }, +/* 16 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + exports['default'] = function (instance) { + instance.registerHelper('lookup', function (obj, field) { + return obj && obj[field]; + }); + }; + + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2hlbHBlcnMvbG9va3VwLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7cUJBQWUsVUFBUyxRQUFRLEVBQUU7QUFDaEMsVUFBUSxDQUFDLGNBQWMsQ0FBQyxRQUFRLEVBQUUsVUFBUyxHQUFHLEVBQUUsS0FBSyxFQUFFO0FBQ3JELFdBQU8sR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsQ0FBQztHQUMxQixDQUFDLENBQUM7Q0FDSiIsImZpbGUiOiJsb29rdXAuanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBmdW5jdGlvbihpbnN0YW5jZSkge1xuICBpbnN0YW5jZS5yZWdpc3RlckhlbHBlcignbG9va3VwJywgZnVuY3Rpb24ob2JqLCBmaWVsZCkge1xuICAgIHJldHVybiBvYmogJiYgb2JqW2ZpZWxkXTtcbiAgfSk7XG59XG4iXX0= + + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(8); + + exports['default'] = function (instance) { + instance.registerHelper('with', function (context, options) { + if (_utils.isFunction(context)) { + context = context.call(this); + } + + var fn = options.fn; + + if (!_utils.isEmpty(context)) { + var data = options.data; + if (options.data && options.ids) { + data = _utils.createFrame(options.data); + data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); + } + + return fn(context, { + data: data, + blockParams: _utils.blockParams([context], [data && data.contextPath]) + }); + } else { + return options.inverse(this); + } + }); + }; + + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2hlbHBlcnMvd2l0aC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O3FCQUErRSx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oLCBibG9ja1BhcmFtcywgY3JlYXRlRnJhbWUsIGlzRW1wdHksIGlzRnVuY3Rpb259IGZyb20gJy4uL3V0aWxzJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24oaW5zdGFuY2UpIHtcbiAgaW5zdGFuY2UucmVnaXN0ZXJIZWxwZXIoJ3dpdGgnLCBmdW5jdGlvbihjb250ZXh0LCBvcHRpb25zKSB7XG4gICAgaWYgKGlzRnVuY3Rpb24oY29udGV4dCkpIHsgY29udGV4dCA9IGNvbnRleHQuY2FsbCh0aGlzKTsgfVxuXG4gICAgbGV0IGZuID0gb3B0aW9ucy5mbjtcblxuICAgIGlmICghaXNFbXB0eShjb250ZXh0KSkge1xuICAgICAgbGV0IGRhdGEgPSBvcHRpb25zLmRhdGE7XG4gICAgICBpZiAob3B0aW9ucy5kYXRhICYmIG9wdGlvbnMuaWRzKSB7XG4gICAgICAgIGRhdGEgPSBjcmVhdGVGcmFtZShvcHRpb25zLmRhdGEpO1xuICAgICAgICBkYXRhLmNvbnRleHRQYXRoID0gYXBwZW5kQ29udGV4dFBhdGgob3B0aW9ucy5kYXRhLmNvbnRleHRQYXRoLCBvcHRpb25zLmlkc1swXSk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBmbihjb250ZXh0LCB7XG4gICAgICAgIGRhdGE6IGRhdGEsXG4gICAgICAgIGJsb2NrUGFyYW1zOiBibG9ja1BhcmFtcyhbY29udGV4dF0sIFtkYXRhICYmIGRhdGEuY29udGV4dFBhdGhdKVxuICAgICAgfSk7XG4gICAgfSBlbHNlIHtcbiAgICAgIHJldHVybiBvcHRpb25zLmludmVyc2UodGhpcyk7XG4gICAgfVxuICB9KTtcbn1cbiJdfQ== + + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.registerDefaultDecorators = registerDefaultDecorators; + // istanbul ignore next + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _decoratorsInline = __webpack_require__(19); + + var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); + + function registerDefaultDecorators(instance) { + _decoratorsInline2['default'](instance); + } + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2RlY29yYXRvcnMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Z0NBQTJCLHFCQUFxQjs7OztBQUV6QyxTQUFTLHlCQUF5QixDQUFDLFFBQVEsRUFBRTtBQUNsRCxnQ0FBZSxRQUFRLENBQUMsQ0FBQztDQUMxQiIsImZpbGUiOiJkZWNvcmF0b3JzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHJlZ2lzdGVySW5saW5lIGZyb20gJy4vZGVjb3JhdG9ycy9pbmxpbmUnO1xuXG5leHBvcnQgZnVuY3Rpb24gcmVnaXN0ZXJEZWZhdWx0RGVjb3JhdG9ycyhpbnN0YW5jZSkge1xuICByZWdpc3RlcklubGluZShpbnN0YW5jZSk7XG59XG5cbiJdfQ== + + +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(8); + + exports['default'] = function (instance) { + instance.registerDecorator('inline', function (fn, props, container, options) { + var ret = fn; + if (!props.partials) { + props.partials = {}; + ret = function (context, options) { + // Create a new partials stack frame prior to exec. + var original = container.partials; + container.partials = _utils.extend({}, original, props.partials); + var ret = fn(context, options); + container.partials = original; + return ret; + }; + } + + props.partials[options.args[0]] = options.fn; + + return ret; + }); + }; + + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2RlY29yYXRvcnMvaW5saW5lLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7cUJB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CBmdW5jdGlvbihmbiwgcHJvcHMsIGNvbnRhaW5lciwgb3B0aW9ucykge1xuICAgIGxldCByZXQgPSBmbjtcbiAgICBpZiAoIXByb3BzLnBhcnRpYWxzKSB7XG4gICAgICBwcm9wcy5wYXJ0aWFscyA9IHt9O1xuICAgICAgcmV0ID0gZnVuY3Rpb24oY29udGV4dCwgb3B0aW9ucykge1xuICAgICAgICAvLyBDcmVhdGUgYSBuZXcgcGFydGlhbHMgc3RhY2sgZnJhbWUgcHJpb3IgdG8gZXhlYy5cbiAgICAgICAgbGV0IG9yaWdpbmFsID0gY29udGFpbmVyLnBhcnRpYWxzO1xuICAgICAgICBjb250YWluZXIucGFydGlhbHMgPSBleHRlbmQoe30sIG9yaWdpbmFsLCBwcm9wcy5wYXJ0aWFscyk7XG4gICAgICAgIGxldCByZXQgPSBmbihjb250ZXh0LCBvcHRpb25zKTtcbiAgICAgICAgY29udGFpbmVyLnBhcnRpYWxzID0gb3JpZ2luYWw7XG4gICAgICAgIHJldHVybiByZXQ7XG4gICAgICB9O1xuICAgIH1cblxuICAgIHByb3BzLnBhcnRpYWxzW29wdGlvbnMuYXJnc1swXV0gPSBvcHRpb25zLmZuO1xuXG4gICAgcmV0dXJuIHJldDtcbiAgfSk7XG59XG4iXX0= + + +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _utils = __webpack_require__(8); + + var logger = { + methodMap: ['debug', 'info', 'warn', 'error'], + level: 'info', + + // Maps a given level value to the `methodMap` indexes above. + lookupLevel: function lookupLevel(level) { + if (typeof level === 'string') { + var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); + if (levelMap >= 0) { + level = levelMap; + } else { + level = parseInt(level, 10); + } + } + + return level; + }, + + // Can be overridden in the host environment + log: function log(level) { + level = logger.lookupLevel(level); + + if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { + var method = logger.methodMap[level]; + if (!console[method]) { + // eslint-disable-line no-console + method = 'log'; + } + + for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + message[_key - 1] = arguments[_key]; + } + + console[method].apply(console, message); // eslint-disable-line no-console + } + } + }; + + exports['default'] = logger; + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2xvZ2dlci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O3FCQUFzQixTQUFTOztBQUUvQixJQUFJLE1BQU0sR0FBRztBQUNYLFdBQVMsRUFBRSxDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxFQUFFLE9BQU8sQ0FBQztBQUM3QyxPQUFLLEVBQUUsTUFBTTs7O0FBR2IsYUFBVyxFQUFFLHFCQUFTLEtBQUssRUFBRTtBQUMzQixRQUFJLE9BQU8sS0FBSyxLQUFLLFFBQVEsRUFBRTtBQUM3QixVQUFJLFFBQVEsR0FBRyxlQUFRLE1BQU0sQ0FBQyxTQUFTLEVBQUUsS0FBSyxDQUFDLFdBQVcsRUFBRSxDQUFDLENBQUM7QUFDOUQsVUFBSSxRQUFRLElBQUksQ0FBQyxFQUFFO0FBQ2pCLGFBQUssR0FBRyxRQUFRLENBQUM7T0FDbEIsTUFBTTtBQUNMLGFBQUssR0FBRyxRQUFRLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO09BQzdCO0tBQ0Y7O0FBRUQsV0FBTyxLQUFLLENBQUM7R0FDZDs7O0FBR0QsS0FBRyxFQUFFLGFBQVMsS0FBSyxFQUFjO0FBQy9CLFNBQUssR0FBRyxNQUFNLENBQUMsV0FBVyxDQUFDLEtBQUssQ0FBQyxDQUFDOztBQUVsQyxRQUFJLE9BQU8sT0FBTyxLQUFLLFdBQVcsSUFBSSxNQUFNLENBQUMsV0FBVyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENB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ZXJyaWRkZW4gaW4gdGhlIGhvc3QgZW52aXJvbm1lbnRcbiAgbG9nOiBmdW5jdGlvbihsZXZlbCwgLi4ubWVzc2FnZSkge1xuICAgIGxldmVsID0gbG9nZ2VyLmxvb2t1cExldmVsKGxldmVsKTtcblxuICAgIGlmICh0eXBlb2YgY29uc29sZSAhPT0gJ3VuZGVmaW5lZCcgJiYgbG9nZ2VyLmxvb2t1cExldmVsKGxvZ2dlci5sZXZlbCkgPD0gbGV2ZWwpIHtcbiAgICAgIGxldCBtZXRob2QgPSBsb2dnZXIubWV0aG9kTWFwW2xldmVsXTtcbiAgICAgIGlmICghY29uc29sZVttZXRob2RdKSB7ICAgLy8gZXNsaW50LWRpc2FibGUtbGluZSBuby1jb25zb2xlXG4gICAgICAgIG1ldGhvZCA9ICdsb2cnO1xuICAgICAgfVxuICAgICAgY29uc29sZVttZXRob2RdKC4uLm1lc3NhZ2UpOyAgICAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG5vLWNvbnNvbGVcbiAgICB9XG4gIH1cbn07XG5cbmV4cG9ydCBkZWZhdWx0IGxvZ2dlcjtcbiJdfQ== + + +/***/ }, +/* 21 */ +/***/ function(module, exports) { + + // Build out our basic SafeString type + 'use strict'; + + exports.__esModule = true; + function SafeString(string) { + this.string = string; + } + + SafeString.prototype.toString = SafeString.prototype.toHTML = function () { + return '' + this.string; + }; + + exports['default'] = SafeString; + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL3NhZmUtc3RyaW5nLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFDQSxTQUFTLFVBQVUsQ0FBQyxNQUFNLEVBQUU7QUFDMUIsTUFBSSxDQUFDLE1BQU0sR0FBRyxNQUFNLENBQUM7Q0FDdEI7O0FBRUQsVUFBVSxDQUFDLFNBQVMsQ0FBQyxRQUFRLEdBQUcsVUFBVSxDQUFDLFNBQVMsQ0FBQyxNQUFNLEdBQUcsWUFBVztBQUN2RSxTQUFPLEVBQUUsR0FBRyxJQUFJLENBQUMsTUFBTSxDQUFDO0NBQ3pCLENBQUM7O3FCQUVhLFVBQVUiLCJmaWxlIjoic2FmZS1zdHJpbmcuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBCdWlsZCBvdXQgb3VyIGJhc2ljIFNhZmVTdHJpbmcgdHlwZVxuZnVuY3Rpb24gU2FmZVN0cmluZyhzdHJpbmcpIHtcbiAgdGhpcy5zdHJpbmcgPSBzdHJpbmc7XG59XG5cblNhZmVTdHJpbmcucHJvdG90eXBlLnRvU3RyaW5nID0gU2FmZVN0cmluZy5wcm90b3R5cGUudG9IVE1MID0gZnVuY3Rpb24oKSB7XG4gIHJldHVybiAnJyArIHRoaXMuc3RyaW5nO1xufTtcblxuZXhwb3J0IGRlZmF1bHQgU2FmZVN0cmluZztcbiJdfQ== + + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.checkRevision = checkRevision; + exports.template = template; + exports.wrapProgram = wrapProgram; + exports.resolvePartial = resolvePartial; + exports.invokePartial = invokePartial; + exports.noop = noop; + // istanbul ignore next + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + // istanbul ignore next + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + + var _utils = __webpack_require__(8); + + var Utils = _interopRequireWildcard(_utils); + + var _exception = __webpack_require__(9); + + var _exception2 = _interopRequireDefault(_exception); + + var _base = __webpack_require__(7); + + function checkRevision(compilerInfo) { + var compilerRevision = compilerInfo && compilerInfo[0] || 1, + currentRevision = _base.COMPILER_REVISION; + + if (compilerRevision !== currentRevision) { + if (compilerRevision < currentRevision) { + var runtimeVersions = _base.REVISION_CHANGES[currentRevision], + compilerVersions = _base.REVISION_CHANGES[compilerRevision]; + throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); + } else { + // Use the embedded version info since the runtime doesn't know about this revision yet + throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); + } + } + } + + function template(templateSpec, env) { + /* istanbul ignore next */ + if (!env) { + throw new _exception2['default']('No environment passed to template'); + } + if (!templateSpec || !templateSpec.main) { + throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); + } + + templateSpec.main.decorator = templateSpec.main_d; + + // Note: Using env.VM references rather than local var references throughout this section to allow + // for external users to override these as psuedo-supported APIs. + env.VM.checkRevision(templateSpec.compiler); + + function invokePartialWrapper(partial, context, options) { + if (options.hash) { + context = Utils.extend({}, context, options.hash); + if (options.ids) { + options.ids[0] = true; + } + } + + partial = env.VM.resolvePartial.call(this, partial, context, options); + var result = env.VM.invokePartial.call(this, partial, context, options); + + if (result == null && env.compile) { + options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); + result = options.partials[options.name](context, options); + } + if (result != null) { + if (options.indent) { + var lines = result.split('\n'); + for (var i = 0, l = lines.length; i < l; i++) { + if (!lines[i] && i + 1 === l) { + break; + } + + lines[i] = options.indent + lines[i]; + } + result = lines.join('\n'); + } + return result; + } else { + throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); + } + } + + // Just add water + var container = { + strict: function strict(obj, name) { + if (!(name in obj)) { + throw new _exception2['default']('"' + name + '" not defined in ' + obj); + } + return obj[name]; + }, + lookup: function lookup(depths, name) { + var len = depths.length; + for (var i = 0; i < len; i++) { + if (depths[i] && depths[i][name] != null) { + return depths[i][name]; + } + } + }, + lambda: function lambda(current, context) { + return typeof current === 'function' ? current.call(context) : current; + }, + + escapeExpression: Utils.escapeExpression, + invokePartial: invokePartialWrapper, + + fn: function fn(i) { + var ret = templateSpec[i]; + ret.decorator = templateSpec[i + '_d']; + return ret; + }, + + programs: [], + program: function program(i, data, declaredBlockParams, blockParams, depths) { + var programWrapper = this.programs[i], + fn = this.fn(i); + if (data || depths || blockParams || declaredBlockParams) { + programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); + } else if (!programWrapper) { + programWrapper = this.programs[i] = wrapProgram(this, i, fn); + } + return programWrapper; + }, + + data: function data(value, depth) { + while (value && depth--) { + value = value._parent; + } + return value; + }, + merge: function merge(param, common) { + var obj = param || common; + + if (param && common && param !== common) { + obj = Utils.extend({}, common, param); + } + + return obj; + }, + + noop: env.VM.noop, + compilerInfo: templateSpec.compiler + }; + + function ret(context) { + var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var data = options.data; + + ret._setup(options); + if (!options.partial && templateSpec.useData) { + data = initData(context, data); + } + var depths = undefined, + blockParams = templateSpec.useBlockParams ? [] : undefined; + if (templateSpec.useDepths) { + if (options.depths) { + depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths; + } else { + depths = [context]; + } + } + + function main(context /*, options*/) { + return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); + } + main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); + return main(context, options); + } + ret.isTop = true; + + ret._setup = function (options) { + if (!options.partial) { + container.helpers = container.merge(options.helpers, env.helpers); + + if (templateSpec.usePartial) { + container.partials = container.merge(options.partials, env.partials); + } + if (templateSpec.usePartial || templateSpec.useDecorators) { + container.decorators = container.merge(options.decorators, env.decorators); + } + } else { + container.helpers = options.helpers; + container.partials = options.partials; + container.decorators = options.decorators; + } + }; + + ret._child = function (i, data, blockParams, depths) { + if (templateSpec.useBlockParams && !blockParams) { + throw new _exception2['default']('must pass block params'); + } + if (templateSpec.useDepths && !depths) { + throw new _exception2['default']('must pass parent depths'); + } + + return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); + }; + return ret; + } + + function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { + function prog(context) { + var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var currentDepths = depths; + if (depths && context !== depths[0]) { + currentDepths = [context].concat(depths); + } + + return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); + } + + prog = executeDecorators(fn, prog, container, depths, data, blockParams); + + prog.program = i; + prog.depth = depths ? depths.length : 0; + prog.blockParams = declaredBlockParams || 0; + return prog; + } + + function resolvePartial(partial, context, options) { + if (!partial) { + if (options.name === '@partial-block') { + partial = options.data['partial-block']; + } else { + partial = options.partials[options.name]; + } + } else if (!partial.call && !options.name) { + // This is a dynamic partial that returned a string + options.name = partial; + partial = options.partials[partial]; + } + return partial; + } + + function invokePartial(partial, context, options) { + options.partial = true; + if (options.ids) { + options.data.contextPath = options.ids[0] || options.data.contextPath; + } + + var partialBlock = undefined; + if (options.fn && options.fn !== noop) { + options.data = _base.createFrame(options.data); + partialBlock = options.data['partial-block'] = options.fn; + + if (partialBlock.partials) { + options.partials = Utils.extend({}, options.partials, partialBlock.partials); + } + } + + if (partial === undefined && partialBlock) { + partial = partialBlock; + } + + if (partial === undefined) { + throw new _exception2['default']('The partial ' + options.name + ' could not be found'); + } else if (partial instanceof Function) { + return partial(context, options); + } + } + + function noop() { + return ''; + } + + function initData(context, data) { + if (!data || !('root' in data)) { + data = data ? _base.createFrame(data) : {}; + data.root = context; + } + return data; + } + + function executeDecorators(fn, prog, container, depths, data, blockParams) { + if (fn.decorator) { + var props = {}; + prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); + Utils.extend(prog, props); + } + return prog; + } + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL3J1bnRpbWUuanMiXSwibmFtZXMiOltdLC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JiYgcGFydGlhbEJsb2NrKSB7XG4gICAgcGFydGlhbCA9IHBhcnRpYWxCbG9jaztcbiAgfVxuXG4gIGlmIChwYXJ0aWFsID09PSB1bmRlZmluZWQpIHtcbiAgICB0aHJvdyBuZXcgRXhjZXB0aW9uKCdUaGUgcGFydGlhbCAnICsgb3B0aW9ucy5uYW1lICsgJyBjb3VsZCBub3QgYmUgZm91bmQnKTtcbiAgfSBlbHNlIGlmIChwYXJ0aWFsIGluc3RhbmNlb2YgRnVuY3Rpb24pIHtcbiAgICByZXR1cm4gcGFydGlhbChjb250ZXh0LCBvcHRpb25zKTtcbiAgfVxufVxuXG5leHBvcnQgZnVuY3Rpb24gbm9vcCgpIHsgcmV0dXJuICcnOyB9XG5cbmZ1bmN0aW9uIGluaXREYXRhKGNvbnRleHQsIGRhdGEpIHtcbiAgaWYgKCFkYXRhIHx8ICEoJ3Jvb3QnIGluIGRhdGEpKSB7XG4gICAgZGF0YSA9IGRhdGEgPyBjcmVhdGVGcmFtZShkYXRhKSA6IHt9O1xuICAgIGRhdGEucm9vdCA9IGNvbnRleHQ7XG4gIH1cbiAgcmV0dXJuIGRhdGE7XG59XG5cbmZ1bmN0aW9uIGV4ZWN1dGVEZWNvcmF0b3JzKGZuLCBwcm9nLCBjb250YWluZXIsIGRlcHRocywgZGF0YSwgYmxvY2tQYXJhbXMpIHtcbiAgaWYgKGZuLmRlY29yYXRvcikge1xuICAgIGxldCBwcm9wcyA9IHt9O1xuICAgIHByb2cgPSBmbi5kZWNvcmF0b3IocHJvZywgcHJvcHMsIGNvbnRhaW5lciwgZGVwdGhzICYmIGRlcHRoc1swXSwgZGF0YSwgYmxvY2tQYXJhbXMsIGRlcHRocyk7XG4gICAgVXRpbHMuZXh0ZW5kKHByb2csIHByb3BzKTtcbiAgfVxuICByZXR1cm4gcHJvZztcbn1cbiJdfQ== + + +/***/ }, +/* 23 */ +/***/ function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {/* global window */ + 'use strict'; + + exports.__esModule = true; + + exports['default'] = function (Handlebars) { + /* istanbul ignore next */ + var root = typeof global !== 'undefined' ? global : window, + $Handlebars = root.Handlebars; + /* istanbul ignore next */ + Handlebars.noConflict = function () { + if (root.Handlebars === Handlebars) { + root.Handlebars = $Handlebars; + } + return Handlebars; + }; + }; + + module.exports = exports['default']; + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL25vLWNvbmZsaWN0LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O3FCQUNlLFVBQVMsVUFBVSxFQUFFOztBQUVsQyxNQUFJLElBQUksR0FBRyxPQUFPLE1BQU0sS0FBSyxXQUFXLEdBQUcsTUFBTSxHQUFHLE1BQU07TUFDdEQsV0FBVyxHQUFHLElBQUksQ0FBQyxVQUFVLENBQUM7O0FBRWxDLFlBQVUsQ0FBQyxVQUFVLEdBQUcsWUFBVztBQUNqQyxRQUFJLElBQUksQ0FBQyxVQUFVLEtBQUssVUFBVSxFQUFFO0FBQ2xDLFVBQUksQ0FBQyxVQUFVLEdBQUcsV0FBVyxDQUFDO0tBQy9CO0FBQ0QsV0FBTyxVQUFVLENBQUM7R0FDbkIsQ0FBQztDQUNIIiwiZmlsZSI6Im5vLWNvbmZsaWN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyogZ2xvYmFsIHdpbmRvdyAqL1xuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24oSGFuZGxlYmFycykge1xuICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xuICBsZXQgcm9vdCA9IHR5cGVvZiBnbG9iYWwgIT09ICd1bmRlZmluZWQnID8gZ2xvYmFsIDogd2luZG93LFxuICAgICAgJEhhbmRsZWJhcnMgPSByb290LkhhbmRsZWJhcnM7XG4gIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gIEhhbmRsZWJhcnMubm9Db25mbGljdCA9IGZ1bmN0aW9uKCkge1xuICAgIGlmIChyb290LkhhbmRsZWJhcnMgPT09IEhhbmRsZWJhcnMpIHtcbiAgICAgIHJvb3QuSGFuZGxlYmFycyA9ICRIYW5kbGViYXJzO1xuICAgIH1cbiAgICByZXR1cm4gSGFuZGxlYmFycztcbiAgfTtcbn1cbiJdfQ== + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/dist/tui-component-contextmenu.min.js b/dist/tui-component-contextmenu.min.js new file mode 100644 index 0000000..38c35c0 --- /dev/null +++ b/dist/tui-component-contextmenu.min.js @@ -0,0 +1,5 @@ +/*! + * tui-component-contextmenu.min.js + * Version: 1.1.2 + */ +!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}var a=n(1),i=o(a),s=n(2),u=r(s);tui.util.defineNamespace("tui.component",{ContextMenu:u.default}),tui.component.ContextMenu.core=i},function(e,t){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:{delay:130};a(this,e),this.options=Object.assign({},n),this.container=t,this.layerMap=new Map,this.activeLayer=null,this.pageScrolled=!1,this.cloneMouseMoveEvent=null,f.on(document,"contextmenu",this._onContextMenu,this)}return e.prototype.destroy=function(){f.off(document,"contextmenu",this._onContextMenu,this),this._hideContextMenu(),this.container=this.layerMap=this.activeLayer=this.pageScolled=this.cloneMouseMoveEvent=null},e.prototype._hideContextMenu=function(){var e=this.activeLayer;if(e){f.off(e.container,"mousemove",this.cloneMouseMoveEvent,this),f.off(document,"mousedown",this._onMouseDown,this),f.off(document,"click",this._onMouseClick,this),f.off(document,"scroll",this._onPageScroll,this),e.hide();var t=function(e){f.css(e,{display:"none",marginTop:""})};f.findAll(e.container,".js-menu-root").forEach(t),f.findAll(e.container,".js-menu-submenu").forEach(t),this.pageScrolled=!1,this.activeLayer=this.cloneMouseMoveEvent=null}},e.prototype._onMouseDown=function(e){var t=e.target||e.srcElement;f.closest(t,".js-menu-root")||this._hideContextMenu()},e.prototype._onMouseClick=function(e){var t=e.target||e.srcElement,n=f.textContent(t).trim(),r=f.getData(t,"command"),o=f.closest(t,".floating-layer"),a=f.hasClass(t,"js-menu-button"),i=f.hasClass(t,"js-menu-separator"),s=f.hasClass(t,"js-menu-has-submenu"),u=f.hasClass(t,"js-menu-disable");if(u)return void this._hideContextMenu();if(o&&a&&!i&&!s){var l=!0,c=!1,d=void 0;try{for(var p,h=this.layerMap.values()[Symbol.iterator]();!(l=(p=h.next()).done);l=!0){var m=p.value;if(o===m.container)return m.callback(e,r||n),void this._hideContextMenu()}}catch(e){c=!0,d=e}finally{try{!l&&h.return&&h.return()}finally{if(c)throw d}}}},e.prototype._showWithoutOverflow=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{rightOverflow:s.noop,bottomOverflow:s.noop},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{marginTop:"",marginLeft:""};f.css(e,"visibility","hidden"),f.css(e,n),f.css(e,"display","block");var r=f.getRect(e),o=r.right,a=r.bottom,i=(e.document||e.ownerDocument).documentElement,u=i.clientWidth,l=i.clientHeight,c=o>u,d=a>l;c&&t.rightOverflow(e,o,u),d&&t.bottomOverflow(e,a,l),f.css(e,"visibility","")},e.prototype._showRootMenu=function(e,t){var n=this.activeLayer;if(n){var r=f.find(n.container,".js-menu-root");n.setBound({left:e,top:t}),n.show(),this._showWithoutOverflow(r,{rightOverflow:function(e,t,n){f.css(e,"marginLeft",n-t+"px")},bottomOverflow:function(e,t,n){f.css(e,"marginTop",n-t+"px")}})}},e.prototype._showSubMenu=function(e){this._showWithoutOverflow(e,{rightOverflow:function(e,t,n){f.css(e,"marginLeft",n-t+e.clientWidth+"px")},bottomOverflow:function(e,t,n){f.css(e,"marginTop",n-t+"px")}},{marginTop:"",marginLeft:"100%"})},e.prototype._refreshMenuDisplay=function(e){for(var t=this.activeLayer.container,n=f.findAll(t,".js-menu-submenu"),r=[];e&&t!==e;)f.hasClass(e,"js-menu-submenu")&&r.push(e),e=e.parentNode;n.forEach(function(e){r.indexOf(e)<0&&f.css(e,"display","none")}),r.forEach(c.bind(this._showSubMenu,this))},e.prototype._onMouseMove=function(e){if(this.pageScrolled)return void(this.pageScrolled=!1);var t=e.target||e.srcElement,n=this.activeLayer;if(n&&f.closest(t,".js-menu-root")){var r=void 0;r=f.hasClass(t,"js-menu-has-submenu")?f.find(t.parentNode,".js-menu-submenu"):f.closest(t,".js-menu-submenu"),this._refreshMenuDisplay(r)}},e.prototype._onPageScroll=function(){this.pageScrolled=!0},e.prototype._onContextMenu=function(e){for(var t=this.options,n=e.target||e.srcElement,r=void 0;n.parentNode;){var o=this.layerMap.get(n);if(o){r=o;break}n=n.parentNode}if(r){f.preventDefault(e),this.activeLayer=r;var a=f.getMousePosition(e,document.body||document.documentElement),i=a[0],s=a[1],u=c.debounce(c.bind(this._onMouseMove,this),t.delay);this.cloneMouseMoveEvent=function(e){var t={target:e.target||e.srcElement};u(t)},this._showRootMenu(i,s),f.on(r.container,"mousemove",this.cloneMouseMoveEvent,this),f.on(document,"mousedown",this._onMouseDown,this),f.on(document,"click",this._onMouseClick,this),f.on(document,"scroll",this._onPageScroll,this)}},e.prototype.register=function(e,t,n){var r=f.find(e);if(r){var o=new tui.component.FloatingLayer(this.container,d);o.callback=t,o.setBound({width:"auto",height:"auto"}),o.setContent((0,l.default)(n)),this.layerMap.set(r,o)}},e.prototype.unregister=function(e){var t=this.layerMap,n=f.find(e);if(!n)return!1;var r=t.get(n);return!!r&&(r.destroy(),t.delete(n),!0)},e}();t.default=p},function(e,t,n){var r=n(4);e.exports=r.template({1:function(e,t,n,r,o){var a;return'
\n'+(null!=(a=n.each.call(null!=t?t:{},t,{name:"each",hash:{},fn:e.program(2,o,0),inverse:e.noop,data:o}))?a:"")+"
\n"},2:function(e,t,n,r,o){var a;return'
\n'+(null!=(a=n.if.call(null!=t?t:{},null!=t?t.separator:t,{name:"if",hash:{},fn:e.program(3,o,0),inverse:e.program(5,o,0),data:o}))?a:"")+"
\n"},3:function(e,t,n,r,o){return'
\n'},5:function(e,t,n,r,o){var a;return null!=(a=n.if.call(null!=t?t:{},null!=t?t.menu:t,{name:"if",hash:{},fn:e.program(6,o,0),inverse:e.program(11,o,0),data:o}))?a:""},6:function(e,t,n,r,o){var a;return null!=(a=n.if.call(null!=t?t:{},null!=t?t.disable:t,{name:"if",hash:{},fn:e.program(7,o,0),inverse:e.program(9,o,0),data:o}))?a:""},7:function(e,t,n,r,o){var a,i=null!=t?t:{},s=n.helperMissing,u="function",l=e.escapeExpression;return'
'+l((a=null!=(a=n.title||(null!=t?t.title:t))?a:s,typeof a===u?a.call(i,{name:"title",hash:{},data:o}):a))+"
\n"},9:function(e,t,n,r,o){var a,i,s=null!=t?t:{},u=n.helperMissing,l="function",c=e.escapeExpression;return'
'+c((i=null!=(i=n.title||(null!=t?t.title:t))?i:u,typeof i===l?i.call(s,{name:"title",hash:{},data:o}):i))+'
\n \n"},11:function(e,t,n,r,o){var a;return null!=(a=n.if.call(null!=t?t:{},null!=t?t.disable:t,{name:"if",hash:{},fn:e.program(7,o,0),inverse:e.program(12,o,0),data:o}))?a:""},12:function(e,t,n,r,o){var a,i=null!=t?t:{},s=n.helperMissing,u="function",l=e.escapeExpression;return'
'+l((a=null!=(a=n.title||(null!=t?t.title:t))?a:s,typeof a===u?a.call(i,{name:"title",hash:{},data:o}):a))+"
\n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,o,a,i){var s;return'\n\n
\n'+(null!=(s=e.invokePartial(r.menuItem,t,{name:"menuItem",data:o,indent:" ",helpers:n,partials:r,decorators:e.decorators}))?s:"")+"
\n"},main_d:function(e,t,n,r,o,a,i){var s=n.decorators;return e=s.inline(e,t,n,{name:"inline",hash:{},fn:n.program(1,o,0,a,i),inverse:n.noop,args:["menuItem"],data:o})||e},useDecorators:!0,usePartial:!0,useData:!0,useDepths:!0})},function(e,t,n){e.exports=n(5).default},function(e,t,n){e.exports=n(6).default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function a(){var e=new s.HandlebarsEnvironment;return p.extend(e,s),e.SafeString=l.default,e.Exception=f.default,e.Utils=p,e.escapeExpression=p.escapeExpression,e.VM=m,e.template=function(t){return m.template(t,e)},e}t.__esModule=!0;var i=n(7),s=o(i),u=n(21),l=r(u),c=n(9),f=r(c),d=n(8),p=o(d),h=n(22),m=o(h),v=n(23),g=r(v),y=a();y.create=a,g.default(y),y.default=y,t.default=y,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},u.registerDefaultHelpers(this),l.registerDefaultDecorators(this)}t.__esModule=!0,t.HandlebarsEnvironment=o;var a=n(8),i=n(9),s=r(i),u=n(10),l=n(18),c=n(20),f=r(c),d="4.0.5";t.VERSION=d;var p=7;t.COMPILER_REVISION=p;var h={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0"};t.REVISION_CHANGES=h;var m="[object Object]";o.prototype={constructor:o,logger:f.default,log:f.default.log,registerHelper:function(e,t){if(a.toString.call(e)===m){if(t)throw new s.default("Arg not supported with multiple helpers");a.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(a.toString.call(e)===m)a.extend(this.partials,e);else{if("undefined"==typeof t)throw new s.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if(a.toString.call(e)===m){if(t)throw new s.default("Arg not supported with multiple decorators");a.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]}};var v=f.default.log;t.log=v,t.createFrame=a.createFrame,t.logger=f.default},function(e,t){"use strict";function n(e){return c[e]}function r(e){for(var t=1;t":">",'"':""","'":"'","`":"`","=":"="},f=/[&<>"'`=]/g,d=/[&<>"'`=]/,p=Object.prototype.toString;t.toString=p;var h=function(e){return"function"==typeof e};h(/x/)&&(t.isFunction=h=function(e){return"function"==typeof e&&"[object Function]"===p.call(e)}),t.isFunction=h;var m=Array.isArray||function(e){return!(!e||"object"!=typeof e)&&"[object Array]"===p.call(e)};t.isArray=m},function(e,t){"use strict";function n(e,t){var o=t&&t.loc,a=void 0,i=void 0;o&&(a=o.start.line,i=o.start.column,e+=" - "+a+":"+i);for(var s=Error.prototype.constructor.call(this,e),u=0;u0?(n.ids&&(n.ids=[n.name]),e.helpers.each(t,n)):o(this);if(n.data&&n.ids){var i=r.createFrame(n.data);i.contextPath=r.appendContextPath(n.data.contextPath,n.name),n={data:i}}return a(t,n)})},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(8),a=n(9),i=r(a);t.default=function(e){e.registerHelper("each",function(e,t){function n(t,n,a){l&&(l.key=t,l.index=n,l.first=0===n,l.last=!!a,c&&(l.contextPath=c+t)),u+=r(e[t],{data:l,blockParams:o.blockParams([e[t],t],[c+t,null])})}if(!t)throw new i.default("Must pass iterator to #each");var r=t.fn,a=t.inverse,s=0,u="",l=void 0,c=void 0;if(t.data&&t.ids&&(c=o.appendContextPath(t.data.contextPath,t.ids[0])+"."),o.isFunction(e)&&(e=e.call(this)),t.data&&(l=o.createFrame(t.data)),e&&"object"==typeof e)if(o.isArray(e))for(var f=e.length;s=0?t:parseInt(e,10)}return e},log:function(e){if(e=o.lookupLevel(e),"undefined"!=typeof console&&o.lookupLevel(o.level)<=e){var t=o.methodMap[e];console[t]||(t="log");for(var n=arguments.length,r=Array(n>1?n-1:0),a=1;a", + "author": "NHNEnt FE Development Lab ", "license": "MIT", "devDependencies": { + "babel-loader": "^6.2.7", "babel-plugin-transform-es2015-classes": "^6.7.7", "babel-plugin-transform-es3-member-expression-literals": "^6.5.0", "babel-plugin-transform-es3-property-literals": "^6.5.0", + "babel-polyfill": "^6.16.0", "babel-preset-es2015": "^6.6.0", "babelify": "^7.2.0", "browserify": "^13.0.0", - "component-floatinglayer": "git+https://github.nhnent.com/fe/component-floatinglayer", - "dom": "git+https://github.nhnent.com/fe/dom#1.0.0", + "eslint": "^3.9.1", + "eslint-loader": "^1.6.1", "eslint-plugin-babel": "^3.2.0", - "fedoc-template": "git+https://github.nhnent.com/fe/share-fedoc-template.git#develop", "handlebars": "^4.0.5", "hbsfy": "^2.7.0", "jasmine-core": "^2.4.1", - "karma": "^0.13.22", - "karma-browserstack-launcher": "^0.1.9", - "karma-chrome-launcher": "^0.2.3", + "karma": "^1.3.0", + "karma-browserstack-launcher": "^1.1.1", + "karma-chrome-launcher": "^2.0.0", "karma-fixture": "^0.2.6", - "karma-jasmine": "^0.3.8", - "karma-junit-reporter": "^0.4.2", + "karma-jasmine": "^1.0.2", + "karma-junit-reporter": "^1.1.0", "karma-webdriver-launcher": "github:everedifice/karma-webdriver-launcher", - "uglify-js": "^2.6.2" + "karma-webpack": "^1.8.0", + "transform-loader": "^0.2.3", + "tui-jsdoc-template": "^1.0.3", + "uglify-js": "^2.6.2", + "webpack": "^1.13.3" } } diff --git a/samples/css/contextmenu.css b/samples/css/contextmenu.css deleted file mode 100644 index 39ed05f..0000000 --- a/samples/css/contextmenu.css +++ /dev/null @@ -1,40 +0,0 @@ -.js-menu { - position: absolute; - z-index: 1; - top: -1px; - width: 180px; - border: 1px solid #bbb; - background-color: #eee; -} - -.js-menu-disable { - color: #999; -} - -.js-menu-item { - position: relative; - cursor: pointer; -} - -.js-menu-button { - width: 100%; - border: none; - background-color: #eee; -} - -.js-menu-button:hover { - background-color: #ccc; -} - -.js-menu-has-submenu:after { - content: '►'; - display: inline; - float: right; - font-size: 0.8em; -} - -.js-menu-separator { - margin-bottom: 2px; - height: 2px; - border-bottom: 1px solid #ccc; -} diff --git a/samples/default.html b/samples/default.html index 1e95d0d..18acfab 100644 --- a/samples/default.html +++ b/samples/default.html @@ -1,64 +1,50 @@ - - - ContextMenu DEMO - - - - - - - - -
-
-
-
- -
- - - - - - - - - - - - + + + + + - + ]); + + diff --git a/samples/js/code-snippet.js b/samples/js/code-snippet.js deleted file mode 100644 index 3b75a13..0000000 --- a/samples/js/code-snippet.js +++ /dev/null @@ -1,3958 +0,0 @@ -/*!code-snippet v1.2.0 | NHN Entertainment*/ -/********** - * array.js - **********/ - -/** - * @fileoverview This module has some functions for handling array. - * @author NHN Ent. - * FE Development Team - * @dependency type.js, collection.js - */ - -(function(tui) { - 'use strict'; - if (!tui) { - tui = window.tui = {}; - } - if (!tui.util) { - tui.util = window.tui.util = {}; - } - var aps = Array.prototype.slice; - - /** - * This variable saves whether the 'indexOf' method is in Array.prototype or not.
- * And it will be checked only once when the page is loaded. - * @type {boolean} - */ - var hasIndexOf = !!Array.prototype.indexOf; - - /** - * Generate an integer Array containing an arithmetic progression. - * @memberof tui.util - * @param {number} start - * @param {number} stop - * @param {number} step - * @returns {Array} - * @example - * - * var arr = tui.util.range(5); - * console.log(arr); // [0,1,2,3,4] - * - * arr = tui.util.range(1, 5); - * console.log(arr); // [1,2,3,4] - * - * arr = tui.util.range(2, 10, 2); - * console.log(arr); // [2,4,6,8] - * - * arr = tui.util.range(10, 2, -2); - * console.log(arr); // [10,8,6,4] - */ - var range = function(start, stop, step) { - var arr = [], - flag; - - if (tui.util.isUndefined(stop)) { - stop = start || 0; - start = 0; - } - - step = step || 1; - flag = step < 0 ? -1 : 1; - stop *= flag; - - for(; start * flag < stop; start += step) { - arr.push(start); - } - - return arr; - }; - - /** - * Zip together multiple lists into a single array - * @memberof tui.util - * @param {...Array} - * @returns {Array} - * @example - * - * var result = tui.util.zip([1, 2, 3], ['a', 'b','c'], [true, false, true]); - * - * console.log(result[0]); // [1, 'a', true] - * console.log(result[1]); // [2, 'b', false] - * console.log(result[2]); // [3, 'c', true] - */ - var zip = function() { - var arr2d = aps.call(arguments), - result = []; - - tui.util.forEach(arr2d, function(arr) { - tui.util.forEach(arr, function(value, index) { - if (!result[index]) { - result[index] = []; - } - result[index].push(value); - }); - }); - - return result; - }; - - /** - * Returns the first index at which a given element can be found in the array from start index(default 0), or -1 if it is not present.
- * It compares searchElement to elements of the Array using strict equality (the same method used by the ===, or triple-equals, operator). - * @memberof tui.util - * @param {*} searchElement Element to locate in the array - * @param {Array} array Array that will be traversed. - * @param {number} startIndex Start index in array for searching (default 0) - * @return {number} the First index at which a given element, or -1 if it is not present - * @example - * - * var arr = ['one', 'two', 'three', 'four'], - * idx1, - * idx2; - * - * idx1 = tui.util.inArray('one', arr, 3); - * alert(idx1); // -1 - * - * idx2 = tui.util.inArray('one', arr); - * alert(idx2); // 0 - */ - var inArray = function(searchElement, array, startIndex) { - var i, length; - - if (!tui.util.isArray(array)) { - return -1; - } - - if (hasIndexOf) { - return Array.prototype.indexOf.call(array, searchElement, startIndex); - } - - length = array.length; - if (tui.util.isUndefined(startIndex)) { - startIndex = 0; - } else if (startIndex >= length || startIndex < 0) { - return -1; - } - - for (i = startIndex; i < length; i++) { - if (array[i] === searchElement) { - return i; - } - } - - return -1; - }; - - tui.util.inArray = inArray; - tui.util.range = range; - tui.util.zip = zip; -})(window.tui); - -/********** - * browser.js - **********/ - -/** - * @fileoverview This module detects the kind of well-known browser and version. - * @author NHN Ent. - * FE Development Team - * @namespace tui.util - */ - -(function(tui) { - 'use strict'; - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - /* istanbul ignore if */ - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - /** - * This object has an information that indicate the kind of browser.
- * The list below is a detectable browser list. - * - ie7 ~ ie11 - * - chrome - * - firefox - * - safari - * - edge - * @memberof tui.util - * @example - * tui.util.browser.chrome === true; // chrome - * tui.util.browser.firefox === true; // firefox - * tui.util.browser.safari === true; // safari - * tui.util.browser.msie === true; // IE - * tui.util.browser.edge === true; // edge - * tui.util.browser.other === true; // other browser - * tui.util.browser.version; // browser version - */ - var browser = { - chrome: false, - firefox: false, - safari: false, - msie: false, - edge: false, - others: false, - version: 0 - }; - - var nav = window.navigator, - appName = nav.appName.replace(/\s/g, '_'), - userAgent = nav.userAgent; - - var rIE = /MSIE\s([0-9]+[.0-9]*)/, - rIE11 = /Trident.*rv:11\./, - rEdge = /Edge\/(\d+)\./, - versionRegex = { - 'firefox': /Firefox\/(\d+)\./, - 'chrome': /Chrome\/(\d+)\./, - 'safari': /Version\/([\d\.]+)\sSafari\/(\d+)/ - }; - - var key, tmp; - - var detector = { - 'Microsoft_Internet_Explorer': function() { - // ie8 ~ ie10 - browser.msie = true; - browser.version = parseFloat(userAgent.match(rIE)[1]); - }, - 'Netscape': function() { - var detected = false; - - if (rIE11.exec(userAgent)) { - browser.msie = true; - browser.version = 11; - detected = true; - } else if (rEdge.exec(userAgent)) { - browser.edge = true; - browser.version = userAgent.match(rEdge)[1]; - detected = true; - } else { - for (key in versionRegex) { - if (versionRegex.hasOwnProperty(key)) { - tmp = userAgent.match(versionRegex[key]); - if (tmp && tmp.length > 1) { - browser[key] = detected = true; - browser.version = parseFloat(tmp[1] || 0); - break; - } - } - } - } - if (!detected) { - browser.others = true; - } - } - }; - - var fn = detector[appName]; - - if (fn) { - detector[appName](); - } - - tui.util.browser = browser; -})(window.tui); - -/********** - * collection.js - **********/ - -/** - * @fileoverview This module has some functions for handling object as collection. - * @author NHN Ent. - * FE Development Team - * @dependency type.js, object.js - */ - -(function(tui) { - 'use strict'; - if (!tui) { - tui = window.tui = {}; - } - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - /** - * Execute the provided callback once for each element present in the array(or Array-like object) in ascending order.
- * If the callback function returns false, the loop will be stopped.
- * Callback function(iteratee) is invoked with three arguments: - * - The value of the element - * - The index of the element - * - The array(or Array-like object) being traversed - * @param {Array} arr The array(or Array-like object) that will be traversed - * @param {function} iteratee Callback function - * @param {Object} [context] Context(this) of callback function - * @memberof tui.util - * @example - * var sum = 0; - * - * forEachArray([1,2,3], function(value){ - * sum += value; - * }); - * alert(sum); // 6 - */ - function forEachArray(arr, iteratee, context) { - var index = 0, - len = arr.length; - - context = context || null; - - for (; index < len; index++) { - if (iteratee.call(context, arr[index], index, arr) === false) { - break; - } - } - } - - - /** - * Execute the provided callback once for each property of object which actually exist.
- * If the callback function returns false, the loop will be stopped.
- * Callback function(iteratee) is invoked with three arguments: - * - The value of the property - * - The name of the property - * - The object being traversed - * @param {Object} obj The object that will be traversed - * @param {function} iteratee Callback function - * @param {Object} [context] Context(this) of callback function - * @memberof tui.util - * @example - * var sum = 0; - * - * forEachOwnProperties({a:1,b:2,c:3}, function(value){ - * sum += value; - * }); - * alert(sum); // 6 - **/ - function forEachOwnProperties(obj, iteratee, context) { - var key; - - context = context || null; - - for (key in obj) { - if (obj.hasOwnProperty(key)) { - if (iteratee.call(context, obj[key], key, obj) === false) { - break; - } - } - } - } - - /** - * Execute the provided callback once for each property of object(or element of array) which actually exist.
- * If the object is Array-like object(ex-arguments object), It needs to transform to Array.(see 'ex2' of example).
- * If the callback function returns false, the loop will be stopped.
- * Callback function(iteratee) is invoked with three arguments: - * - The value of the property(or The value of the element) - * - The name of the property(or The index of the element) - * - The object being traversed - * @param {Object} obj The object that will be traversed - * @param {function} iteratee Callback function - * @param {Object} [context] Context(this) of callback function - * @memberof tui.util - * @example - * //ex1 - * var sum = 0; - * - * forEach([1,2,3], function(value){ - * sum += value; - * }); - * alert(sum); // 6 - * - * //ex2 - In case of Array-like object - * function sum(){ - * var factors = Array.prototype.slice.call(arguments); - * forEach(factors, function(value){ - * //...... - * }); - * } - */ - function forEach(obj, iteratee, context) { - if (tui.util.isArray(obj)) { - tui.util.forEachArray(obj, iteratee, context); - } else { - tui.util.forEachOwnProperties(obj, iteratee, context); - } - } - - /** - * Execute the provided callback function once for each element in an array, in order, and constructs a new array from the results.
- * If the object is Array-like object(ex-arguments object), It needs to transform to Array.(see 'ex2' of forEach example)
- * Callback function(iteratee) is invoked with three arguments: - * - The value of the property(or The value of the element) - * - The name of the property(or The index of the element) - * - The object being traversed - * @param {Object} obj The object that will be traversed - * @param {function} iteratee Callback function - * @param {Object} [context] Context(this) of callback function - * @returns {Array} A new array composed of returned values from callback function - * @memberof tui.util - * @example - * var result = map([0,1,2,3], function(value) { - * return value + 1; - * }); - * - * alert(result); // 1,2,3,4 - */ - function map(obj, iteratee, context) { - var resultArray = []; - - context = context || null; - - tui.util.forEach(obj, function() { - resultArray.push(iteratee.apply(context, arguments)); - }); - - return resultArray; - } - - /** - * Execute the callback function once for each element present in the array(or Array-like object or plain object).
- * If the object is Array-like object(ex-arguments object), It needs to transform to Array.(see 'ex2' of forEach example)
- * Callback function(iteratee) is invoked with four arguments: - * - The previousValue - * - The currentValue - * - The index - * - The object being traversed - * @param {Object} obj The object that will be traversed - * @param {function} iteratee Callback function - * @param {Object} [context] Context(this) of callback function - * @returns {*} The result value - * @memberof tui.util - * @example - * var result = reduce([0,1,2,3], function(stored, value) { - * return stored + value; - * }); - * - * alert(result); // 6 - */ - function reduce(obj, iteratee, context) { - var keys, - index = 0, - length, - store; - - context = context || null; - - if (!tui.util.isArray(obj)) { - keys = tui.util.keys(obj); - } - - length = keys ? keys.length : obj.length; - - store = obj[keys ? keys[index++] : index++]; - - for (; index < length; index++) { - store = iteratee.call(context, store, obj[keys ? keys[index] : index]); - } - - return store; - } - /** - * Transform the Array-like object to Array.
- * In low IE (below 8), Array.prototype.slice.call is not perfect. So, try-catch statement is used. - * @param {*} arrayLike Array-like object - * @return {Array} Array - * @memberof tui.util - * @example - * var arrayLike = { - * 0: 'one', - * 1: 'two', - * 2: 'three', - * 3: 'four', - * length: 4 - * }; - * var result = toArray(arrayLike); - * - * alert(result instanceof Array); // true - * alert(result); // one,two,three,four - */ - function toArray(arrayLike) { - var arr; - try { - arr = Array.prototype.slice.call(arrayLike); - } catch (e) { - arr = []; - forEachArray(arrayLike, function(value) { - arr.push(value); - }); - } - return arr; - } - - /** - * Create a new array or plain object with all elements(or properties) that pass the test implemented by the provided function.
- * Callback function(iteratee) is invoked with three arguments: - * - The value of the property(or The value of the element) - * - The name of the property(or The index of the element) - * - The object being traversed - * @param {Object} obj Object(plain object or Array) that will be traversed - * @param {function} iteratee Callback function - * @param {Object} [context] Context(this) of callback function - * @returns {Object} plain object or Array - * @memberof tui.util - * @example - * var result1 = filter([0,1,2,3], function(value) { - * return (value % 2 === 0); - * }); - * alert(result1); // 0,2 - * - * var result2 = filter({a : 1, b: 2, c: 3}, function(value) { - * return (value % 2 !== 0); - * }); - * alert(result2.a); // 1 - * alert(result2.b); // undefined - * alert(result2.c); // 3 - */ - var filter = function(obj, iteratee, context) { - var result, - add; - - context = context || null; - - if (!tui.util.isObject(obj) || !tui.util.isFunction(iteratee)) { - throw new Error('wrong parameter'); - } - - if (tui.util.isArray(obj)) { - result = []; - add = function(result, args) { - result.push(args[0]); - }; - } else { - result = {}; - add = function(result, args) { - result[args[1]] = args[0]; - }; - } - - tui.util.forEach(obj, function() { - if (iteratee.apply(context, arguments)) { - add(result, arguments); - } - }, context); - - return result; - }; - - /** - * fetching a property - * @param {Array} arr target collection - * @param {String|Number} property property name - * @memberof tui.util - * @returns {Array} - * @example - * var objArr = [ - * {'abc': 1, 'def': 2, 'ghi': 3}, - * {'abc': 4, 'def': 5, 'ghi': 6}, - * {'abc': 7, 'def': 8, 'ghi': 9} - * ], - * arr2d = [ - * [1, 2, 3], - * [4, 5, 6], - * [7, 8, 9] - * ], - * result; - * - * result = tui.util.pluck(objArr, 'abc'); - * console.log(result) // [1, 4, 7] - * - * result = tui.util.pluck(arr2d, 2); - * console.log(result) // [3, 6, 9] - */ - var pluck = function(arr, property) { - var result = tui.util.map(arr, function(item) { - return item[property]; - }); - return result; - }; - - tui.util.forEachOwnProperties = forEachOwnProperties; - tui.util.forEachArray = forEachArray; - tui.util.forEach = forEach; - tui.util.toArray = toArray; - tui.util.map = map; - tui.util.reduce = reduce; - tui.util.filter = filter; - tui.util.pluck = pluck; -})(window.tui); - -/********** - * customEvent.js - **********/ - -/** - * @fileoverview - * This module provides some functions for custom events.
- * And it is implemented in the observer design pattern. - * @author NHN Ent. - * FE Development Team - * @dependency type.js, collection.js object.js - */ - -(function(tui) { - 'use strict'; - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - - /* istanbul ignore if */ - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - var R_EVENTNAME_SPLIT = /\s+/g; // eslint-disable-line - - /** - * A unit of event handler item. - * @ignore - * @typedef {object} HandlerItem - * @property {function} fn - event handler - * @property {object} ctx - context of event handler - */ - - /** - * @constructor - * @memberof tui.util - */ - function CustomEvents() { - /** - * @type {HandlerItem[]} - */ - this.events = null; - - /** - * only for checking specific context event was binded - * @type {object[]} - */ - this.contexts = null; - } - - /** - * Mixin custom events feature to specific constructor - * @param {function} func - constructor - * @example - * function Model() { - * this.name = ''; - * } - * tui.util.CustomEvents.mixin(Model); - * - * var model = new Model(); - * model.on('change', function() { this.name = 'model'; }, this); - * - * model.fire('change'); - * alert(model.name); // 'model'; - */ - CustomEvents.mixin = function(func) { - tui.util.extend(func.prototype, CustomEvents.prototype); - }; - - /** - * Get HandlerItem object - * @param {function} handler - handler function - * @param {object} [context] - context for handler - * @returns {HandlerItem} HandlerItem object - * @private - */ - CustomEvents.prototype._getHandlerItem = function(handler, context) { - var item = {handler: handler}; - - if (context) { - item.context = context; - } - - return item; - }; - - /** - * Get event object safely - * @param {string} [eventName] - create sub event map if not exist. - * @returns {(object|array)} event object. if you supplied `eventName` - * parameter then make new array and return it - * @private - */ - CustomEvents.prototype._safeEvent = function(eventName) { - var events = this.events, - byName; - - if (!events) { - events = this.events = {}; - } - - if (eventName) { - byName = events[eventName]; - - if (!byName) { - byName = []; - events[eventName] = byName; - } - - events = byName; - } - - return events; - }; - - /** - * Get context array safely - * @returns {array} context array - */ - CustomEvents.prototype._safeContext = function() { - var context = this.contexts; - - if (!context) { - context = this.contexts = []; - } - - return context; - }; - - /** - * Get index of context - * @param {object} ctx - context that used for bind custom event - * @returns {number} index of context - */ - CustomEvents.prototype._indexOfContext = function(ctx) { - var context = this._safeContext(), - index = 0; - - while (context[index]) { - if (ctx === context[index][0]) { - return index; - } - - index += 1; - } - - return -1; - }; - - /** - * Memorize supplied context for recognize supplied object is context or - * name: handler pair object when off() - * @param {object} ctx - context object to memorize - */ - CustomEvents.prototype._memorizeContext = function(ctx) { - var context, index; - - if (!tui.util.isExisty(ctx)) { - return; - } - - context = this._safeContext(); - index = this._indexOfContext(ctx); - - if (index > -1) { - context[index][1] += 1; - } else { - context.push([ctx, 1]); - } - }; - - /** - * Forget supplied context object - * @param {object} ctx - context object to forget - */ - CustomEvents.prototype._forgetContext = function(ctx) { - var context, contextIndex; - - if (!tui.util.isExisty(ctx)) { - return; - } - - context = this._safeContext(); - contextIndex = this._indexOfContext(ctx); - - if (contextIndex > -1) { - context[contextIndex][1] -= 1; - - if (context[contextIndex][1] <= 0) { - context.splice(contextIndex, 1); - } - } - }; - - /** - * Bind event handler - * @param {(string|{name:string, handler:function})} eventName - custom - * event name or an object {eventName: handler} - * @param {(function|object)} [handler] - handler function or context - * @param {object} [context] - context for binding - * @private - */ - CustomEvents.prototype._bindEvent = function(eventName, handler, context) { - var events = this._safeEvent(eventName); - this._memorizeContext(context); - events.push(this._getHandlerItem(handler, context)); - }; - - /** - * Bind event handlers - * @param {(string|{name:string, handler:function})} eventName - custom - * event name or an object {eventName: handler} - * @param {(function|object)} [handler] - handler function or context - * @param {object} [context] - context for binding - * @example - * // 1. Basic - * customEvent.on('onload', handler); - * - * // 2. With context - * customEvent.on('onload', handler, myObj); - * - * // 3. Bind by object that name, handler pairs - * customEvent.on({ - * 'play': handler, - * 'pause': handler2 - * }); - * - * // 4. Bind by object that name, handler pairs with context object - * customEvent.on({ - * 'play': handler - * }, myObj); - */ - CustomEvents.prototype.on = function(eventName, handler, context) { - var self = this; - - if (tui.util.isString(eventName)) { - // [syntax 1, 2] - eventName = eventName.split(R_EVENTNAME_SPLIT); - tui.util.forEach(eventName, function(name) { - self._bindEvent(name, handler, context); - }); - } else if (tui.util.isObject(eventName)) { - // [syntax 3, 4] - context = handler; - tui.util.forEach(eventName, function(func, name) { - self.on(name, func, context); - }); - } - }; - - /** - * Bind one-shot event handlers - * @param {(string|{name:string, handler:function})} eventName - custom - * event name or an object {eventName: handler} - * @param {(function|object)} [handler] - handler function or context - * @param {object} [context] - context for binding - */ - CustomEvents.prototype.once = function(eventName, handler, context) { - var self = this; - - if (tui.util.isObject(eventName)) { - context = handler; - tui.util.forEach(eventName, function(func, name) { - self.once(name, func, context); - }); - return; - } - - function onceHandler() { - handler.apply(context, arguments); - self.off(eventName, onceHandler, context); - } - - this.on(eventName, onceHandler, context); - }; - - /** - * Splice supplied array by callback result - * @param {array} arr - array to splice - * @param {function} predicate - function return boolean - * @private - */ - CustomEvents.prototype._spliceMatches = function(arr, predicate) { - var i, len; - - if (!tui.util.isArray(arr)) { - return; - } - - for (i = 0, len = arr.length; i < len; i += 1) { - if (predicate(arr[i]) === true) { - arr.splice(i, 1); - len -= 1; - i -= 1; - } - } - }; - - /** - * Get matcher for unbind specific handler events - * @param {function} handler - handler function - * @returns {function} handler matcher - * @private - */ - CustomEvents.prototype._matchHandler = function(handler) { - var self = this; - - return function(item) { - var needRemove = handler === item.handler; - - if (needRemove) { - self._forgetContext(item.context); - } - - return needRemove; - }; - }; - - /** - * Get matcher for unbind specific context events - * @param {object} context - context - * @returns {function} object matcher - * @private - */ - CustomEvents.prototype._matchContext = function(context) { - var self = this; - - return function(item) { - var needRemove = context === item.context; - - if (needRemove) { - self._forgetContext(item.context); - } - - return needRemove; - }; - }; - - /** - * Get matcher for unbind specific hander, context pair events - * @param {function} handler - handler function - * @param {object} context - context - * @returns {function} handler, context matcher - * @private - */ - CustomEvents.prototype._matchHandlerAndContext = function(handler, context) { - var self = this; - - return function(item) { - var matchHandler = (handler === item.handler), - matchContext = (context === item.context), - needRemove = (matchHandler && matchContext); - - if (needRemove) { - self._forgetContext(item.context); - } - - return needRemove; - }; - }; - - /** - * Unbind event by event name - * @param {string} eventName - custom event name to unbind - * @param {function} [handler] - handler function - * @private - */ - CustomEvents.prototype._offByEventName = function(eventName, handler) { - var self = this, - forEach = tui.util.forEachArray, - andByHandler = tui.util.isFunction(handler), - matchHandler = self._matchHandler(handler); - - eventName = eventName.split(R_EVENTNAME_SPLIT); - - forEach(eventName, function(name) { - var handlerItems = self._safeEvent(name); - - if (andByHandler) { - self._spliceMatches(handlerItems, matchHandler); - } else { - forEach(handlerItems, function(item) { - self._forgetContext(item.context); - }); - - self.events[name] = []; - } - }); - }; - - /** - * Unbind event by handler function - * @param {function} handler - handler function - * @private - */ - CustomEvents.prototype._offByHandler = function(handler) { - var self = this, - matchHandler = this._matchHandler(handler); - - tui.util.forEach(this._safeEvent(), function(handlerItems) { - self._spliceMatches(handlerItems, matchHandler); - }); - }; - - /** - * Unbind event by object(name: handler pair object or context object) - * @param {object} obj - context or {name: handler} pair object - * @param {function} handler - handler function - * @private - */ - CustomEvents.prototype._offByObject = function(obj, handler) { - var self = this, - matchFunc; - - if (this._indexOfContext(obj) < 0) { - tui.util.forEach(obj, function(func, name) { - self.off(name, func); - }); - } else if (tui.util.isString(handler)) { - matchFunc = this._matchContext(obj); - - self._spliceMatches(this._safeEvent(handler), matchFunc); - } else if (tui.util.isFunction(handler)) { - matchFunc = this._matchHandlerAndContext(handler, obj); - - tui.util.forEach(this._safeEvent(), function(handlerItems) { - self._spliceMatches(handlerItems, matchFunc); - }); - } else { - matchFunc = this._matchContext(obj); - - tui.util.forEach(this._safeEvent(), function(handlerItems) { - self._spliceMatches(handlerItems, matchFunc); - }); - } - }; - - /** - * Unbind custom events - * @param {(string|object|function)} eventName - event name or context or - * {name: handler} pair object or handler function - * @param {(function)} handler - handler function - * @example - * // 1. off by event name - * customEvent.off('onload'); - * - * // 2. off by event name and handler - * customEvent.off('play', handler); - * - * // 3. off by handler - * customEvent.off(handler); - * - * // 4. off by context - * customEvent.off(myObj); - * - * // 5. off by context and handler - * customEvent.off(myObj, handler); - * - * // 6. off by context and event name - * customEvent.off(myObj, 'onload'); - * - * // 7. off by an Object. that is {eventName: handler} - * customEvent.off({ - * 'play': handler, - * 'pause': handler2 - * }); - * - * // 8. off the all events - * customEvent.off(); - */ - CustomEvents.prototype.off = function(eventName, handler) { - if (tui.util.isString(eventName)) { - // [syntax 1, 2] - this._offByEventName(eventName, handler); - } else if (!arguments.length) { - // [syntax 8] - this.events = {}; - this.contexts = []; - } else if (tui.util.isFunction(eventName)) { - // [syntax 3] - this._offByHandler(eventName); - } else if (tui.util.isObject(eventName)) { - // [syntax 4, 5, 6] - this._offByObject(eventName, handler); - } - }; - - /** - * Fire custom event - * @param {string} eventName - name of custom event - */ - CustomEvents.prototype.fire = function(eventName) { // eslint-disable-line - this.invoke.apply(this, arguments); - }; - - /** - * Fire a event and returns the result of operation 'boolean AND' with all - * listener's results. - * - * So, It is different from {@link CustomEvents#fire}. - * - * In service code, use this as a before event in component level usually - * for notifying that the event is cancelable. - * @param {string} eventName - Custom event name - * @param {...*} data - Data for event - * @returns {boolean} The result of operation 'boolean AND' - * @example - * if (this.invoke('beforeZoom')) { // check the result of 'beforeZoom' - * // if true, - * // doSomething - * } - * - * // In service code, - * map.on({ - * 'beforeZoom': function() { - * // It should cancel the 'zoom' event by some conditions. - * if (that.disabled && this.getState()) { - * return false; - * } - * return true; - * } - * }); - */ - CustomEvents.prototype.invoke = function(eventName) { - var events, args, index, item; - - if (!this.hasListener(eventName)) { - return true; - } - - events = this._safeEvent(eventName); - args = Array.prototype.slice.call(arguments, 1); - index = 0; - - while (events[index]) { - item = events[index]; - - if (item.handler.apply(item.context, args) === false) { - return false; - } - - index += 1; - } - - return true; - }; - - /** - * Return whether at least one of the handlers is registered in the given - * event name. - * @param {string} eventName - Custom event name - * @returns {boolean} Is there at least one handler in event name? - */ - CustomEvents.prototype.hasListener = function(eventName) { - return this.getListenerLength(eventName) > 0; - }; - - /** - * Return a count of events registered. - * @param {string} eventName - Custom event name - * @returns {number} number of event - */ - CustomEvents.prototype.getListenerLength = function(eventName) { - var events = this._safeEvent(eventName); - return events.length; - }; - - tui.util.CustomEvents = CustomEvents; -})(window.tui); - -/********** - * defineClass.js - **********/ - -/** - * @fileoverview - * This module provides a function to make a constructor that can inherit from the other constructors like the CLASS easily. - * @author NHN Ent. - * FE Development Team - * @dependency inheritance.js, object.js - */ - -(function(tui) { - 'use strict'; - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - /* istanbul ignore if */ - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - /** - * Help a constructor to be defined and to inherit from the other constructors - * @param {*} [parent] Parent constructor - * @param {Object} props Members of constructor - * @param {Function} props.init Initialization method - * @param {Object} [props.static] Static members of constructor - * @returns {*} Constructor - * @memberof tui.util - * @example - * var Parent = defineClass({ - * init: function() { - * this.name = 'made by def'; - * }, - * method: function() { - * //..can do something with this - * }, - * static: { - * staticMethod: function() { - * //..do something - * } - * } - * }); - * - * var Child = defineClass(Parent, { - * method2: function() {} - * }); - * - * Parent.staticMethod(); - * - * var parentInstance = new Parent(); - * console.log(parentInstance.name); //made by def - * parentInstance.staticMethod(); // Error - * - * var childInstance = new Child(); - * childInstance.method(); - * childInstance.method2(); - */ - tui.util.defineClass = function(parent, props) { - var obj; - - if (!props) { - props = parent; - parent = null; - } - - obj = props.init || function() {}; - - if (parent) { - tui.util.inherit(obj, parent); - } - - if (props.hasOwnProperty('static')) { - tui.util.extend(obj, props['static']); - delete props['static']; - } - - tui.util.extend(obj.prototype, props); - - return obj; - }; -})(window.tui); - -/********** - * defineModule.js - **********/ - -/** - * @fileoverview Define module - * @author NHN Ent. - * FE Development Team - * @dependency type.js, defineNamespace.js - */ -(function(tui) { - 'use strict'; - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - /* istanbul ignore if */ - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - var util = tui.util, - INITIALIZATION_METHOD_NAME = 'initialize'; - - /** - * Define module - * @param {string} namespace - Namespace of module - * @param {Object} moduleDefinition - Object literal for module - * @returns {Object} Defined module - * @memberof tui.util - * @example - * var myModule = tui.util.defineModule('modules.myModule', { - * name: 'john', - * message: '', - * initialize: function() { - * this.message = 'hello world'; - * }, - * getMessage: function() { - * return this.name + ': ' + this.message - * } - * }); - * - * console.log(myModule.getMessage()); // 'john: hello world'; - * console.log(window.modules.myModule.getMessage()); // 'john: hello world'; - */ - function defineModule(namespace, moduleDefinition) { - var base = moduleDefinition || {}; - - if (util.isFunction(base[INITIALIZATION_METHOD_NAME])) { - base[INITIALIZATION_METHOD_NAME](); - } - - return util.defineNamespace(namespace, base); - } - tui.util.defineModule = defineModule; -})(window.tui); - -/********** - * defineNamespace.js - **********/ - -/** - * @fileoverview Define namespace - * @author NHN Ent. - * FE Development Team - * @dependency inheritance.js, object.js, collection.js - */ -(function(tui) { - - 'use strict'; - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - /* istanbul ignore if */ - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - var util = tui.util; - - /** - * Define namespace - * @param {string} namespace - Namespace (ex- 'foo.bar.baz') - * @param {(object|function)} props - A set of modules or one module - * @param {boolean} [isOverride] - Override the props to the namespace.
- * (It removes previous properties of this namespace) - * @returns {(object|function)} Defined namespace - * @memberof tui.util - * @example - * var neComp = tui.util.defineNamespace('ne.component'); - * neComp.listMenu = tui.util.defineClass({ - * init: function() { - * // code - * } - * }); - */ - tui.util.defineNamespace = function(namespace, props, isOverride) { - var names, result, prevLast, last; - - names = namespace.split('.'); - names.unshift(window); - - result = util.reduce(names, function(obj, name) { - obj[name] = obj[name] || {}; - return obj[name]; - }); - - if (isOverride) { - last = names.pop(); - prevLast = util.pick.apply(null, names); - result = prevLast[last] = props; - } else { - util.extend(result, props); - } - - return result; - }; -})(window.tui); - -/********** - * enum.js - **********/ - -/** - * @fileoverview This module provides a Enum Constructor. - * @author NHN Ent. - * FE Development Team - * @dependency type, collection.js - */ - -(function(tui) { - -'use strict'; - -/* istanbul ignore if */ -if (!tui) { - tui = window.tui = {}; -} -if (!tui.util) { - tui.util = window.tui.util = {}; -} - -/** - * Check whether the defineProperty() method is supported. - * @type {boolean} - */ -var isSupportDefinedProperty = (function () { - try { - Object.defineProperty({}, 'x', {}); - return true; - } catch (e) { - return false; - } -}()); - -/** - * A unique value of a constant. - * @type {number} - */ -var enumValue = 0; - -/** - * Make a constant-list that has unique values.
- * In modern browsers (except IE8 and lower),
- * a value defined once can not be changed. - * - * @param {...string | string[]} itemList Constant-list (An array of string is available) - * @exports Enum - * @constructor - * @class - * @memberof tui.util - * @examples - * //create - * var MYENUM = new Enum('TYPE1', 'TYPE2'); - * var MYENUM2 = new Enum(['TYPE1', 'TYPE2']); - * - * //usage - * if (value === MYENUM.TYPE1) { - * .... - * } - * - * //add (If a duplicate name is inputted, will be disregarded.) - * MYENUM.set('TYPE3', 'TYPE4'); - * - * //get name of a constant by a value - * MYENUM.getName(MYENUM.TYPE1); // 'TYPE1'이 리턴된다. - * - * // In modern browsers (except IE8 and lower), a value can not be changed in constants. - * var originalValue = MYENUM.TYPE1; - * MYENUM.TYPE1 = 1234; // maybe TypeError - * MYENUM.TYPE1 === originalValue; // true - * - **/ -function Enum(itemList) { - if (itemList) { - this.set.apply(this, arguments); - } -} - -/** - * Define a constants-list - * @param {...string| string[]} itemList Constant-list (An array of string is available) - */ -Enum.prototype.set = function(itemList) { - var self = this; - - if (!tui.util.isArray(itemList)) { - itemList = tui.util.toArray(arguments); - } - - tui.util.forEach(itemList, function itemListIteratee(item) { - self._addItem(item); - }); -}; - -/** - * Return a key of the constant. - * @param {number} value A value of the constant. - * @returns {string|undefined} Key of the constant. - */ -Enum.prototype.getName = function(value) { - var foundedKey, - self = this; - - tui.util.forEach(this, function(itemValue, key) { - if (self._isEnumItem(key) && value === itemValue) { - foundedKey = key; - return false; - } - }); - - return foundedKey; -}; - -/** - * Create a constant. - * @private - * @param {string} name Constant name. (It will be a key of a constant) - */ -Enum.prototype._addItem = function(name) { - var value; - - if (!this.hasOwnProperty(name)) { - value = this._makeEnumValue(); - - if (isSupportDefinedProperty) { - Object.defineProperty(this, name, { - enumerable: true, - configurable: false, - writable: false, - value: value - }); - } else { - this[name] = value; - } - } -}; - -/** - * Return a unique value for assigning to a constant. - * @private - * @returns {number} A unique value - */ -Enum.prototype._makeEnumValue = function() { - var value; - - value = enumValue; - enumValue += 1; - - return value; -}; - -/** - * Return whether a constant from the given key is in instance or not. - * @param {string} key - A constant key - * @returns {boolean} Result - * @private - */ -Enum.prototype._isEnumItem = function(key) { - return tui.util.isNumber(this[key]); -}; - -tui.util.Enum = Enum; - -})(window.tui); - -/********** - * exMap.js - **********/ - -/** - * @fileoverview - * Implements the ExMap (Extended Map) object. - * @author NHN Ent. - * FE Development Team - * @dependency Map.js, collection.js - */ - -(function(tui) { - 'use strict'; - - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - // Caching tui.util for performance enhancing - var util = tui.util, - mapAPIsForRead = ['get', 'has', 'forEach', 'keys', 'values', 'entries'], - mapAPIsForDelete = ['delete', 'clear']; - - /** - * The ExMap object is Extended Version of the tui.util.Map object.
- * and added some useful feature to make it easy to manage the Map object. - * @constructor - * @param {Array} initData - Array of key-value pairs (2-element Arrays). - * Each key-value pair will be added to the new Map - * @memberof tui.util - */ - function ExMap(initData) { - this._map = new util.Map(initData); - this.size = this._map.size; - } - - util.forEachArray(mapAPIsForRead, function(name) { - ExMap.prototype[name] = function() { - return this._map[name].apply(this._map, arguments); - }; - }); - - util.forEachArray(mapAPIsForDelete, function(name) { - ExMap.prototype[name] = function() { - var result = this._map[name].apply(this._map, arguments); - this.size = this._map.size; - return result; - }; - }); - - ExMap.prototype.set = function() { - this._map.set.apply(this._map, arguments); - this.size = this._map.size; - return this; - }; - - /** - * Sets all of the key-value pairs in the specified object to the Map object. - * @param {Object} object - Plain object that has a key-value pair - */ - ExMap.prototype.setObject = function(object) { - util.forEachOwnProperties(object, function(value, key) { - this.set(key, value); - }, this); - }; - - /** - * Removes the elements associated with keys in the specified array. - * @param {Array} keys - Array that contains keys of the element to remove - */ - ExMap.prototype.deleteByKeys = function(keys) { - util.forEachArray(keys, function(key) { - this['delete'](key); - }, this); - }; - - /** - * Sets all of the key-value pairs in the specified Map object to this Map object. - * @param {Map} map - Map object to be merged into this Map object - */ - ExMap.prototype.merge = function(map) { - map.forEach(function(value, key) { - this.set(key, value); - }, this); - }; - - /** - * Looks through each key-value pair in the map and returns the new ExMap object of - * all key-value pairs that pass a truth test implemented by the provided function. - * @param {function} predicate - Function to test each key-value pair of the Map object.
- * Invoked with arguments (value, key). Return true to keep the element, false otherwise. - * @return {ExMap} A new ExMap object - */ - ExMap.prototype.filter = function(predicate) { - var filtered = new ExMap(); - - this.forEach(function(value, key) { - if (predicate(value, key)) { - filtered.set(key, value); - } - }); - - return filtered; - }; - - util.ExMap = ExMap; -})(window.tui); - -/********** - * formatDate.js - **********/ - -/** - * @fileoverview This module has a function for date format. - * @author NHN Ent. - * FE Development Team - * @dependency type.js, object.js - */ - -(function(tui) { - 'use strict'; - - var tokens = /[\\]*YYYY|[\\]*YY|[\\]*MMMM|[\\]*MMM|[\\]*MM|[\\]*M|[\\]*DD|[\\]*D|[\\]*HH|[\\]*H|[\\]*A/gi; - var MONTH_STR = ["Invalid month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; - var MONTH_DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - var replaceMap = { - M: function(date) { - return Number(date.month); - }, - MM: function(date) { - var month = date.month; - return (Number(month) < 10) ? '0' + month : month; - }, - MMM: function(date) { - return MONTH_STR[Number(date.month)].substr(0, 3); - }, - MMMM: function(date) { - return MONTH_STR[Number(date.month)]; - }, - D: function(date) { - return Number(date.date); - }, - d: function(date) { - return replaceMap.D(date); - }, - DD: function(date) { - var dayInMonth = date.date; - return (Number(dayInMonth) < 10) ? '0' + dayInMonth : dayInMonth; - }, - dd: function(date) { - return replaceMap.DD(date); - }, - YY: function(date) { - return Number(date.year) % 100; - }, - yy: function(date) { - return replaceMap.YY(date); - }, - YYYY: function(date) { - var prefix = '20', - year = date.year; - if (year > 69 && year < 100) { - prefix = '19'; - } - return (Number(year) < 100) ? prefix + String(year) : year; - }, - yyyy: function(date) { - return replaceMap.YYYY(date); - }, - A: function(date) { - return date.meridiem; - }, - a: function(date) { - return date.meridiem; - }, - hh: function(date) { - var hour = date.hour; - return (Number(hour) < 10) ? '0' + hour : hour; - }, - HH: function(date) { - return replaceMap.hh(date); - }, - h: function(date) { - return String(Number(date.hour)); - }, - H: function(date) { - return replaceMap.h(date); - }, - m: function(date) { - return String(Number(date.minute)); - }, - mm: function(date) { - var minute = date.minute; - return (Number(minute) < 10) ? '0' + minute : minute; - } - }; - - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - /* istanbul ignore if */ - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - /** - * Check whether the given variables are valid date or not. - * @param {number} year - Year - * @param {number} month - Month - * @param {number} date - Day in month. - * @returns {boolean} Is valid? - */ - function isValidDate(year, month, date) { - var isValidYear, - isValidMonth, - isValid, - lastDayInMonth; - - year = Number(year); - month = Number(month); - date = Number(date); - - isValidYear = (year > -1 && year < 100) || (year > 1969) && (year < 2070); - isValidMonth = (month > 0) && (month < 13); - - if (!isValidYear || !isValidMonth) { - return false; - } - - lastDayInMonth = MONTH_DAYS[month]; - if (month === 2 && year % 4 === 0) { - if (year % 100 !== 0 || year % 400 === 0) { - lastDayInMonth = 29; - } - } - - isValid = (date > 0) && (date <= lastDayInMonth); - return isValid; - } - - /** - * Return a string that transformed from the given form and date. - * @param {string} form - Date form - * @param {Date|Object} date - Date object - * @param {{meridiemSet: {AM: string, PM: string}}} option - Option - * @returns {boolean|string} A transformed string or false. - * @memberOf tui.util - * @example - * // key | Shorthand - * // --------------- |----------------------- - * // years | YY / YYYY / yy / yyyy - * // months(n) | M / MM - * // months(str) | MMM / MMMM - * // days | D / DD / d / dd - * // hours | H / HH / h / hh - * // minutes | m / mm - * // meridiem(AM,PM) | A / a - * - * var dateStr1 = formatDate('yyyy-MM-dd', { - * year: 2014, - * month: 12, - * date: 12 - * }); - * alert(dateStr1); // '2014-12-12' - * - * var dateStr2 = formatDate('MMM DD YYYY HH:mm', { - * year: 1999, - * month: 9, - * date: 9, - * hour: 0, - * minute: 2 - * }) - * alert(dateStr2); // 'Sep 09 1999 00:02' - * - * var dt = new Date(2010, 2, 13), - * dateStr3 = formatDate('yyyy년 M월 dd일', dt); - * - * alert(dateStr3); // '2010년 3월 13일' - * - * var option4 = { - * meridiemSet: { - * AM: '오전', - * PM: '오후' - * } - * }; - * var date4 = {year: 1999, month: 9, date: 9, hour: 13, minute: 2}; - * var dateStr4 = formatDate('yyyy-MM-dd A hh:mm', date4, option4)); - * - * alert(dateStr4); // '1999-09-09 오후 01:02' - */ - function formatDate(form, date, option) { - var meridiem, nDate, resultStr; - - if (tui.util.isDate(date)) { - nDate = { - year: date.getFullYear(), - month: date.getMonth() + 1, - date: date.getDate(), - hour: date.getHours(), - minute: date.getMinutes() - }; - } else { - nDate = { - year: date.year, - month: date.month, - date: date.date, - hour: date.hour, - minute: date.minute - }; - } - - if (!isValidDate(nDate.year, nDate.month, nDate.date)) { - return false; - } - - nDate.meridiem = ''; - if (/[^\\][aA]\b/g.test(form)) { - meridiem = (nDate.hour > 12) ? - tui.util.pick(option, 'meridiemSet', 'PM') || 'PM' - : tui.util.pick(option, 'meridiemSet', 'AM') || 'AM'; - nDate.hour %= 12; - nDate.meridiem = meridiem; - } - - resultStr = form.replace(tokens, function(key) { - if (key.indexOf('\\') > -1) { // escape character - return key.replace(/\\/g, ''); - } else { - return replaceMap[key](nDate) || ''; - } - }); - return resultStr; - } - - tui.util.formatDate = formatDate; -})(window.tui); - - -/********** - * func.js - **********/ - -/** - * @fileoverview This module provides a bind() function for context binding. - * @author NHN Ent. - * FE Development Team - */ - -(function(tui) { - 'use strict'; - - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - /** - * Create a new function that, when called, has its this keyword set to the provided value. - * @param {function} fn A original function before binding - * @param {*} obj context of function in arguments[0] - * @return {function()} A new bound function with context that is in arguments[1] - * @memberof tui.util - */ - function bind(fn, obj) { - var slice = Array.prototype.slice; - - if (fn.bind) { - return fn.bind.apply(fn, slice.call(arguments, 1)); - } - - /* istanbul ignore next */ - var args = slice.call(arguments, 2); - - /* istanbul ignore next */ - return function() { - /* istanbul ignore next */ - return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments); - }; - } - - tui.util.bind = bind; - -})(window.tui); - -/********** - * hashMap.js - **********/ - -/** - * @fileoverview This module provides the HashMap constructor. - * @author NHN Ent. - * FE Development Team - * @dependency type, collection.js - */ - -(function(tui) { - 'use strict'; - - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - /** - * All the data in hashMap begin with _MAPDATAPREFIX; - * @type {string} - * @private - */ - var _MAPDATAPREFIX = 'å'; - - /** - * HashMap can handle the key-value pairs.
- * Caution:
- * HashMap instance has a length property but is not an instance of Array. - * @param {Object} [obj] A initial data for creation. - * @constructor - * @memberof tui.util - * @example - * var hm = new tui.util.HashMap({ - * 'mydata': { - * 'hello': 'imfine' - * }, - * 'what': 'time' - * }); - */ - function HashMap(obj) { - /** - * size - * @type {number} - */ - this.length = 0; - - if (obj) { - this.setObject(obj); - } - } - - /** - * Set a data from the given key with value or the given object. - * @param {string|Object} key A string or object for key - * @param {*} [value] A data - * @example - * var hm = new HashMap(); - * - * hm.set('key', 'value'); - * hm.set({ - * 'key1': 'data1', - * 'key2': 'data2' - * }); - */ - HashMap.prototype.set = function(key, value) { - if(arguments.length === 2) { - this.setKeyValue(key, value); - } else { - this.setObject(key); - } - }; - - /** - * Set a data from the given key with value. - * @param {string} key A string for key - * @param {*} value A data - * @example - * var hm = new HashMap(); - * hm.setKeyValue('key', 'value'); - */ - HashMap.prototype.setKeyValue = function(key, value) { - if (!this.has(key)) { - this.length += 1; - } - this[this.encodeKey(key)] = value; - }; - - /** - * Set a data from the given object. - * @param {Object} obj A object for data - * @example - * var hm = new HashMap(); - * - * hm.setObject({ - * 'key1': 'data1', - * 'key2': 'data2' - * }); - */ - HashMap.prototype.setObject = function(obj) { - var self = this; - - tui.util.forEachOwnProperties(obj, function(value, key) { - self.setKeyValue(key, value); - }); - }; - - /** - * Merge with the given another hashMap. - * @param {HashMap} hashMap Another hashMap instance - */ - HashMap.prototype.merge = function(hashMap) { - var self = this; - - hashMap.each(function(value, key) { - self.setKeyValue(key, value); - }); - }; - - /** - * Encode the given key for hashMap. - * @param {string} key A string for key - * @returns {string} A encoded key - * @private - */ - HashMap.prototype.encodeKey = function(key) { - return _MAPDATAPREFIX + key; - }; - - /** - * Decode the given key in hashMap. - * @param {string} key A string for key - * @returns {string} A decoded key - * @private - */ - HashMap.prototype.decodeKey = function(key) { - var decodedKey = key.split(_MAPDATAPREFIX); - return decodedKey[decodedKey.length-1]; - }; - - /** - * Return the value from the given key. - * @param {string} key A string for key - * @returns {*} The value from a key - * @example - * var hm = new HashMap(); - * hm.set('key', 'value'); - * - * hm.get('key') // value - */ - HashMap.prototype.get = function(key) { - return this[this.encodeKey(key)]; - }; - - /** - * Check the existence of a value from the key. - * @param {string} key A string for key - * @returns {boolean} Indicating whether a value exists or not. - * @example - * var hm = new HashMap(); - * hm.set('key', 'value'); - * - * hm.has('key') // true - */ - HashMap.prototype.has = function(key) { - return this.hasOwnProperty(this.encodeKey(key)); - }; - - /** - * Remove a data(key-value pairs) from the given key or the given key-list. - * @param {...string|string[]} key A string for key - * @returns {string|string[]} A removed data - * @example - * var hm = new HashMap(); - * hm.set('key', 'value'); - * hm.set('key2', 'value'); - * - * //ex1 - * hm.remove('key'); - * - * //ex2 - * hm.remove('key', 'key2'); - * - * //ex3 - * hm.remove(['key', 'key2']); - */ - HashMap.prototype.remove = function(key) { - if (arguments.length > 1) { - key = tui.util.toArray(arguments); - } - - return tui.util.isArray(key) ? this.removeByKeyArray(key) : this.removeByKey(key); - }; - - /** - * Remove data(key-value pair) from the given key. - * @param {string} key A string for key - * @returns {*|null} A removed data - * @example - * var hm = new HashMap(); - * hm.set('key', 'value'); - * - * hm.removeByKey('key') - */ - HashMap.prototype.removeByKey = function(key) { - var data = this.has(key) ? this.get(key) : null; - - if (data !== null) { - delete this[this.encodeKey(key)]; - this.length -= 1; - } - - return data; - }; - - /** - * Remove a data(key-value pairs) from the given key-list. - * @param {string[]} keyArray An array of keys - * @returns {string[]} A removed data - * @example - * var hm = new HashMap(); - * hm.set('key', 'value'); - * hm.set('key2', 'value'); - * - * hm.removeByKeyArray(['key', 'key2']); - */ - HashMap.prototype.removeByKeyArray = function(keyArray) { - var data = [], - self = this; - - tui.util.forEach(keyArray, function(key) { - data.push(self.removeByKey(key)); - }); - - return data; - }; - - /** - * Remove all the data - */ - HashMap.prototype.removeAll = function() { - var self = this; - - this.each(function(value, key) { - self.remove(key); - }); - }; - - /** - * Execute the provided callback once for each all the data. - * @param {Function} iteratee Callback function - * @example - * var hm = new HashMap(); - * hm.set('key', 'value'); - * hm.set('key2', 'value'); - * - * hm.each(function(value, key) { - * //do something... - * }); - */ - HashMap.prototype.each = function(iteratee) { - var self = this, - flag; - - tui.util.forEachOwnProperties(this, function(value, key) { - if (key.charAt(0) === _MAPDATAPREFIX) { - flag = iteratee(value, self.decodeKey(key)); - } - - if (flag === false) { - return flag; - } - }); - }; - - /** - * Return the key-list stored. - * @returns {Array} A key-list - * @example - * var hm = new HashMap(); - * hm.set('key', 'value'); - * hm.set('key2', 'value'); - * - * hm.keys(); //['key', 'key2'); - */ - HashMap.prototype.keys = function() { - var keys = [], - self = this; - - this.each(function(value, key) { - keys.push(self.decodeKey(key)); - }); - - return keys; - }; - - /** - * Work similarly to Array.prototype.map().
- * It executes the provided callback that checks conditions once for each element of hashMap,
- * and returns a new array having elements satisfying the conditions - * @param {Function} condition A function that checks conditions - * @returns {Array} A new array having elements satisfying the conditions - * @example - * //ex1 - * var hm = new HashMap(); - * hm.set('key', 'value'); - * hm.set('key2', 'value'); - * - * hm.find(function(value, key) { - * return key === 'key2'; - * }); // ['value'] - * - * //ex2 - * var hm = new HashMap({ - * 'myobj1': { - * visible: true - * }, - * 'mybobj2': { - * visible: false - * } - * }); - * - * hm.find(function(obj, key) { - * return obj.visible === true; - * }); // [{visible: true}]; - */ - HashMap.prototype.find = function(condition) { - var founds = []; - - this.each(function(value, key) { - if (condition(value, key)) { - founds.push(value); - } - }); - - return founds; - }; - - /** - * Return a new Array having all values. - * @returns {Array} A new array having all values - */ - HashMap.prototype.toArray = function() { - var result = []; - - this.each(function(v) { - result.push(v); - }); - - return result; - }; - - tui.util.HashMap = HashMap; - -})(window.tui); - -/********** - * inheritance.js - **********/ - -/** - * @fileoverview This module provides some simple function for inheritance. - * @author NHN Ent. - * FE Development Team - */ - -(function(tui) { - 'use strict'; - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - /* istanbul ignore if */ - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - - - /** - * Create a new object with the specified prototype object and properties. - * @param {Object} obj This object will be a prototype of the newly-created object. - * @return {Object} - * @memberof tui.util - */ - function createObject() { - function F() {} - - return function(obj) { - F.prototype = obj; - return new F(); - }; - } - - /** - * Provide a simple inheritance in prototype-oriented. - * Caution : - * Don't overwrite the prototype of child constructor. - * - * @param {function} subType Child constructor - * @param {function} superType Parent constructor - * @memberof tui.util - * @example - * // Parent constructor - * function Animal(leg) { - * this.leg = leg; - * } - * - * Animal.prototype.growl = function() { - * // ... - * }; - * - * // Child constructor - * function Person(name) { - * this.name = name; - * } - * - * // Inheritance - * core.inherit(Person, Animal); - * - * // After this inheritance, please use only the extending of property. - * // Do not overwrite prototype. - * Person.prototype.walk = function(direction) { - * // ... - * }; - */ - function inherit(subType, superType) { - var prototype = tui.util.createObject(superType.prototype); - prototype.constructor = subType; - subType.prototype = prototype; - } - - tui.util.createObject = createObject(); - tui.util.inherit = inherit; - -})(window.tui); - -/********** - * map.js - **********/ - -/** - * @fileoverview - * Implements the Map object. - * @author NHN Ent. - * FE Development Team - * @dependency type.js, collection.js - */ - -(function(tui) { - 'use strict'; - - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - - // Caching tui.util for performance enhancing - var util = tui.util, - - /** - * Using undefined for a key can be ambiguous if there's deleted item in the array,
- * which is also undefined when accessed by index.
- * So use this unique object as an undefined key to distinguish it from deleted keys. - * @private - * @constant - */ - _KEY_FOR_UNDEFINED = {}, - - /** - * For using NaN as a key, use this unique object as a NaN key.
- * This makes it easier and faster to compare an object with each keys in the array
- * through no exceptional comapring for NaN. - */ - _KEY_FOR_NAN = {}; - - /** - * Constructor of MapIterator
- * Creates iterator object with new keyword. - * @constructor - * @param {Array} keys - The array of keys in the map - * @param {function} valueGetter - Function that returns certain value, - * taking key and keyIndex as arguments. - */ - function MapIterator(keys, valueGetter) { - this._keys = keys; - this._valueGetter = valueGetter; - this._length = this._keys.length; - this._index = -1; - this._done = false; - } - - /** - * Implementation of Iterator protocol. - * @return {{done: boolean, value: *}} Object that contains done(boolean) and value. - */ - MapIterator.prototype.next = function() { - var data = {}; - do { - this._index += 1; - } while (util.isUndefined(this._keys[this._index]) && this._index < this._length); - - if (this._index >= this._length) { - data.done = true; - } else { - data.done = false; - data.value = this._valueGetter(this._keys[this._index], this._index); - } - return data; - }; - - /** - * The Map object implements the ES6 Map specification as closely as possible.
- * For using objects and primitive values as keys, this object uses array internally.
- * So if the key is not a string, get(), set(), has(), delete() will operates in O(n),
- * and it can cause performance issues with a large dataset. - * - * Features listed below are not supported. (can't be implented without native support) - * - Map object is iterable
- * - Iterable object can be used as an argument of constructor - * - * If the browser supports full implementation of ES6 Map specification, native Map obejct - * will be used internally. - * @constructor - * @param {Array} initData - Array of key-value pairs (2-element Arrays). - * Each key-value pair will be added to the new Map - * @memberof tui.util - */ - function Map(initData) { - this._valuesForString = {}; - this._valuesForIndex = {}; - this._keys = []; - - if (initData) { - this._setInitData(initData); - } - - this.size = 0; - } - - /** - * Add all elements in the initData to the Map object. - * @private - * @param {Array} initData - Array of key-value pairs to add to the Map object - */ - Map.prototype._setInitData = function(initData) { - if (!util.isArray(initData)) { - throw new Error('Only Array is supported.'); - } - util.forEachArray(initData, function(pair) { - this.set(pair[0], pair[1]); - }, this); - }; - - /** - * Returns true if the specified value is NaN.
- * For unsing NaN as a key, use this method to test equality of NaN
- * because === operator doesn't work for NaN. - * @private - * @param {*} value - Any object to be tested - * @return {boolean} True if value is NaN, false otherwise. - */ - Map.prototype._isNaN = function(value) { - return typeof value === 'number' && value !== value; - }; - - /** - * Returns the index of the specified key. - * @private - * @param {*} key - The key object to search for. - * @return {number} The index of the specified key - */ - Map.prototype._getKeyIndex = function(key) { - var result = -1, - value; - - if (util.isString(key)) { - value = this._valuesForString[key]; - if (value) { - result = value.keyIndex; - } - } else { - result = util.inArray(key, this._keys); - } - return result; - }; - - /** - * Returns the original key of the specified key. - * @private - * @param {*} key - key - * @return {*} Original key - */ - Map.prototype._getOriginKey = function(key) { - var originKey = key; - if (key === _KEY_FOR_UNDEFINED) { - originKey = undefined; - } else if (key === _KEY_FOR_NAN) { - originKey = NaN; - } - return originKey; - }; - - /** - * Returns the unique key of the specified key. - * @private - * @param {*} key - key - * @return {*} Unique key - */ - Map.prototype._getUniqueKey = function(key) { - var uniqueKey = key; - if (util.isUndefined(key)) { - uniqueKey = _KEY_FOR_UNDEFINED; - } else if (this._isNaN(key)) { - uniqueKey = _KEY_FOR_NAN; - } - return uniqueKey; - }; - - /** - * Returns the value object of the specified key. - * @private - * @param {*} key - The key of the value object to be returned - * @param {number} keyIndex - The index of the key - * @return {{keyIndex: number, origin: *}} Value object - */ - Map.prototype._getValueObject = function(key, keyIndex) { - if (util.isString(key)) { - return this._valuesForString[key]; - } else { - if (util.isUndefined(keyIndex)) { - keyIndex = this._getKeyIndex(key); - } - if (keyIndex >= 0) { - return this._valuesForIndex[keyIndex]; - } - } - }; - - /** - * Returns the original value of the specified key. - * @private - * @param {*} key - The key of the value object to be returned - * @param {number} keyIndex - The index of the key - * @return {*} Original value - */ - Map.prototype._getOriginValue = function(key, keyIndex) { - return this._getValueObject(key, keyIndex).origin; - }; - - /** - * Returns key-value pair of the specified key. - * @private - * @param {*} key - The key of the value object to be returned - * @param {number} keyIndex - The index of the key - * @return {Array} Key-value Pair - */ - Map.prototype._getKeyValuePair = function(key, keyIndex) { - return [this._getOriginKey(key), this._getOriginValue(key, keyIndex)]; - }; - - /** - * Creates the wrapper object of original value that contains a key index - * and returns it. - * @private - * @param {type} origin - Original value - * @param {type} keyIndex - Index of the key - * @return {{keyIndex: number, origin: *}} Value object - */ - Map.prototype._createValueObject = function(origin, keyIndex) { - return { - keyIndex: keyIndex, - origin: origin - }; - }; - - /** - * Sets the value for the key in the Map object. - * @param {*} key - The key of the element to add to the Map object - * @param {*} value - The value of the element to add to the Map object - * @return {Map} The Map object - */ - Map.prototype.set = function(key, value) { - var uniqueKey = this._getUniqueKey(key), - keyIndex = this._getKeyIndex(uniqueKey), - valueObject; - - if (keyIndex < 0) { - keyIndex = this._keys.push(uniqueKey) - 1; - this.size += 1; - } - valueObject = this._createValueObject(value, keyIndex); - - if (util.isString(key)) { - this._valuesForString[key] = valueObject; - } else { - this._valuesForIndex[keyIndex] = valueObject; - } - return this; - }; - - /** - * Returns the value associated to the key, or undefined if there is none. - * @param {*} key - The key of the element to return - * @return {*} Element associated with the specified key - */ - Map.prototype.get = function(key) { - var uniqueKey = this._getUniqueKey(key), - value = this._getValueObject(uniqueKey); - - return value && value.origin; - }; - - /** - * Returns a new Iterator object that contains the keys for each element - * in the Map object in insertion order. - * @return {Iterator} A new Iterator object - */ - Map.prototype.keys = function() { - return new MapIterator(this._keys, util.bind(this._getOriginKey, this)); - }; - - /** - * Returns a new Iterator object that contains the values for each element - * in the Map object in insertion order. - * @return {Iterator} A new Iterator object - */ - Map.prototype.values = function() { - return new MapIterator(this._keys, util.bind(this._getOriginValue, this)); - }; - - /** - * Returns a new Iterator object that contains the [key, value] pairs - * for each element in the Map object in insertion order. - * @return {Iterator} A new Iterator object - */ - Map.prototype.entries = function() { - return new MapIterator(this._keys, util.bind(this._getKeyValuePair, this)); - }; - - /** - * Returns a boolean asserting whether a value has been associated to the key - * in the Map object or not. - * @param {*} key - The key of the element to test for presence - * @return {boolean} True if an element with the specified key exists; - * Otherwise false - */ - Map.prototype.has = function(key) { - return !!this._getValueObject(key); - }; - - /** - * Removes the specified element from a Map object. - * @param {*} key - The key of the element to remove - */ - // cannot use reserved keyword as a property name in IE8 and under. - Map.prototype['delete'] = function(key) { - var keyIndex; - - if (util.isString(key)) { - if (this._valuesForString[key]) { - keyIndex = this._valuesForString[key].keyIndex; - delete this._valuesForString[key]; - } - } else { - keyIndex = this._getKeyIndex(key); - if (keyIndex >= 0) { - delete this._valuesForIndex[keyIndex]; - } - } - - if (keyIndex >= 0) { - delete this._keys[keyIndex]; - this.size -= 1; - } - }; - - /** - * Executes a provided function once per each key/value pair in the Map object, - * in insertion order. - * @param {function} callback - Function to execute for each element - * @param {thisArg} thisArg - Value to use as this when executing callback - */ - Map.prototype.forEach = function(callback, thisArg) { - thisArg = thisArg || this; - util.forEachArray(this._keys, function(key) { - if (!util.isUndefined(key)) { - callback.call(thisArg, this._getValueObject(key).origin, key, this); - } - }, this); - }; - - /** - * Removes all elements from a Map object. - */ - Map.prototype.clear = function() { - Map.call(this); - }; - - // Use native Map object if exists. - // But only latest versions of Chrome and Firefox support full implementation. - (function() { - var browser = util.browser; - if (window.Map && ( - (browser.firefox && browser.version >= 37) || - (browser.chrome && browser.version >= 42) )) { - Map = window.Map; - } - })(); - - util.Map = Map; -})(window.tui); - -/********** - * object.js - **********/ - -/** - * @fileoverview This module has some functions for handling a plain object, json. - * @author NHN Ent. - * FE Development Team - * @dependency type.js, collection.js - */ - -(function(tui) { - 'use strict'; - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - /** - * Extend the target object from other objects. - * @param {object} target - Object that will be extended - * @param {...object} objects - Objects as sources - * @return {object} Extended object - * @memberOf tui.util - */ - function extend(target, objects) { - var source, - prop, - hasOwnProp = Object.prototype.hasOwnProperty, - i, - len; - - for (i = 1, len = arguments.length; i < len; i++) { - source = arguments[i]; - for (prop in source) { - if (hasOwnProp.call(source, prop)) { - target[prop] = source[prop]; - } - } - } - return target; - } - - /** - * The last id of stamp - * @type {number} - */ - var lastId = 0; - - /** - * Assign a unique id to an object - * @param {object} obj - Object that will be assigned id. - * @return {number} Stamped id - * @memberOf tui.util - */ - function stamp(obj) { - obj.__fe_id = obj.__fe_id || ++lastId; - return obj.__fe_id; - } - - /** - * Verify whether an object has a stamped id or not. - * @param {object} obj - * @returns {boolean} - * @memberOf tui.util - */ - function hasStamp(obj) { - return tui.util.isExisty(tui.util.pick(obj, '__fe_id')); - } - - /** - * Reset the last id of stamp - */ - function resetLastId() { - lastId = 0; - } - - /** - * Return a key-list(array) of a given object - * @param {object} obj - Object from which a key-list will be extracted - * @returns {Array} A key-list(array) - * @memberOf tui.util - */ - function keys(obj) { - var keys = [], - key; - - for (key in obj) { - if (obj.hasOwnProperty(key)) { - keys.push(key); - } - } - - return keys; - } - - /** - * Return the equality for multiple objects(jsonObjects).
- * See {@link http://stackoverflow.com/questions/1068834/object-comparison-in-javascript} - * @param {...object} object - Multiple objects for comparing. - * @return {boolean} Equality - * @example - * - * var jsonObj1 = {name:'milk', price: 1000}, - * jsonObj2 = {name:'milk', price: 1000}, - * jsonObj3 = {name:'milk', price: 1000}; - * - * tui.util.compareJSON(jsonObj1, jsonObj2, jsonObj3); // true - * - * - * var jsonObj4 = {name:'milk', price: 1000}, - * jsonObj5 = {name:'beer', price: 3000}; - * - * tui.util.compareJSON(jsonObj4, jsonObj5); // false - - * @memberOf tui.util - */ - function compareJSON(object) { - var leftChain, - rightChain, - argsLen = arguments.length, - i; - - function isSameObject(x, y) { - var p; - - // remember that NaN === NaN returns false - // and isNaN(undefined) returns true - if (isNaN(x) && - isNaN(y) && - tui.util.isNumber(x) && - tui.util.isNumber(y)) { - return true; - } - - // Compare primitives and functions. - // Check if both arguments link to the same object. - // Especially useful on step when comparing prototypes - if (x === y) { - return true; - } - - // Works in case when functions are created in constructor. - // Comparing dates is a common scenario. Another built-ins? - // We can even handle functions passed across iframes - if ((tui.util.isFunction(x) && tui.util.isFunction(y)) || - (x instanceof Date && y instanceof Date) || - (x instanceof RegExp && y instanceof RegExp) || - (x instanceof String && y instanceof String) || - (x instanceof Number && y instanceof Number)) { - return x.toString() === y.toString(); - } - - // At last checking prototypes as good a we can - if (!(x instanceof Object && y instanceof Object)) { - return false; - } - - if (x.isPrototypeOf(y) || - y.isPrototypeOf(x) || - x.constructor !== y.constructor || - x.prototype !== y.prototype) { - return false; - } - - // check for infinitive linking loops - if (tui.util.inArray(x, leftChain) > -1 || - tui.util.inArray(y, rightChain) > -1) { - return false; - } - - // Quick checking of one object beeing a subset of another. - for (p in y) { - if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) { - return false; - } - else if (typeof y[p] !== typeof x[p]) { - return false; - } - } - - //This for loop executes comparing with hasOwnProperty() and typeof for each property in 'x' object, - //and verifying equality for x[property] and y[property]. - for (p in x) { - if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) { - return false; - } - else if (typeof y[p] !== typeof x[p]) { - return false; - } - - if (typeof(x[p]) === 'object' || typeof(x[p]) === 'function') { - leftChain.push(x); - rightChain.push(y); - - if (!isSameObject(x[p], y[p])) { - return false; - } - - leftChain.pop(); - rightChain.pop(); - } else if (x[p] !== y[p]) { - return false; - } - } - - return true; - } - - if (argsLen < 1) { - return true; - } - - for (i = 1; i < argsLen; i++) { - leftChain = []; - rightChain = []; - - if (!isSameObject(arguments[0], arguments[i])) { - return false; - } - } - - return true; - } - - /** - * Retrieve a nested item from the given object/array - * @param {object|Array} obj - Object for retrieving - * @param {...string|number} paths - Paths of property - * @returns {*} Value - * @example - * var obj = { - * 'key1': 1, - * 'nested' : { - * 'key1': 11, - * 'nested': { - * 'key1': 21 - * } - * } - * }; - * tui.util.pick(obj, 'nested', 'nested', 'key1'); // 21 - * tui.util.pick(obj, 'nested', 'nested', 'key2'); // undefined - * - * var arr = ['a', 'b', 'c']; - * tui.util.pick(arr, 1); // 'b' - */ - function pick(obj, paths) { - var args = arguments, - target = args[0], - length = args.length, - i; - try { - for (i = 1; i < length; i++) { - target = target[args[i]]; - } - return target; - } catch(e) { - return; - } - } - - tui.util.extend = extend; - tui.util.stamp = stamp; - tui.util.hasStamp = hasStamp; - tui.util._resetLastId = resetLastId; - tui.util.keys = Object.keys || keys; - tui.util.compareJSON = compareJSON; - tui.util.pick = pick; -})(window.tui); - -/********** - * string.js - **********/ - -/** - * @fileoverview This module has some functions for handling the string. - * @author NHN Ent. - * FE Development Team - */ - -(function(tui) { - 'use strict'; - - if (!tui) { - tui = window.tui = {}; - } - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - /** - * Transform the given HTML Entity string into plain string - * @param {String} htmlEntity - HTML Entity type string - * @return {String} Plain string - * @memberof tui.util - * @example - * var htmlEntityString = "A 'quote' is <b>bold</b>" - * var result = decodeHTMLEntity(htmlEntityString); //"A 'quote' is bold" - */ - function decodeHTMLEntity(htmlEntity) { - var entities = {'"' : '"', '&' : '&', '<' : '<', '>' : '>', ''' : '\'', ' ' : ' '}; - return htmlEntity.replace(/&|<|>|"|'| /g, function(m0) { - return entities[m0] ? entities[m0] : m0; - }); - } - - /** - * Transform the given string into HTML Entity string - * @param {String} html - String for encoding - * @return {String} HTML Entity - * @memberof tui.util - * @example - * var htmlEntityString = ""; - * var result = encodeHTMLEntity(htmlEntityString); //"<script> alert('test');</script><a href='test'>" - */ - function encodeHTMLEntity(html) { - var entities = {'"': 'quot', '&': 'amp', '<': 'lt', '>': 'gt', '\'': '#39'}; - return html.replace(/[<>&"']/g, function(m0) { - return entities[m0] ? '&' + entities[m0] + ';' : m0; - }); - } - - /** - * Return whether the string capable to transform into plain string is in the given string or not. - * @param {String} string - * @memberof tui.util - * @return {boolean} - */ - function hasEncodableString(string) { - return (/[<>&"']/).test(string); - } - - /** - * Return duplicate charters - * @param {string} operandStr1 The operand string - * @param {string} operandStr2 The operand string - * @private - * @memberof tui.util - * @returns {string} - * @example - * tui.util.getDuplicatedChar('fe dev', 'nhn entertainment'); - * => 'e' - * tui.util.getDuplicatedChar('fdsa', 'asdf'); - * => 'asdf' - */ - function getDuplicatedChar(operandStr1, operandStr2) { - var dupl, - key, - i = 0, - len = operandStr1.length, - pool = {}; - - for (; i < len; i += 1) { - key = operandStr1.charAt(i); - pool[key] = 1; - } - - for (i = 0, len = operandStr2.length; i < len; i += 1) { - key = operandStr2.charAt(i); - if(pool[key]) { - pool[key] += 1; - } - } - - pool = tui.util.filter(pool, function(item) { - return item > 1; - }); - - pool = tui.util.keys(pool).sort(); - dupl = pool.join(''); - - return dupl; - } - - tui.util.decodeHTMLEntity = decodeHTMLEntity; - tui.util.encodeHTMLEntity = encodeHTMLEntity; - tui.util.hasEncodableString = hasEncodableString; - tui.util.getDuplicatedChar = getDuplicatedChar; - -})(window.tui); - -/********** - * tricks.js - **********/ - -/** - * @fileoverview collections of some technic methods. - * @author NHN Ent. FE Development Team - */ - -/** @namespace tui */ -/** @namespace tui.util */ - -(function(tui) { - 'use strict'; - var aps = Array.prototype.slice; - - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - /* istanbul ignore if */ - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - /** - * Creates a debounced function that delays invoking fn until after delay milliseconds has elapsed - * since the last time the debouced function was invoked. - * @param {function} fn The function to debounce. - * @param {number} [delay=0] The number of milliseconds to delay - * @memberof tui.util - * @returns {function} debounced function. - * @example - * - * function someMethodToInvokeDebounced() {} - * - * var debounced = tui.util.debounce(someMethodToInvokeDebounced, 300); - * - * // invoke repeatedly - * debounced(); - * debounced(); - * debounced(); - * debounced(); - * debounced(); - * debounced(); // last invoke of debounced() - * - * // invoke someMethodToInvokeDebounced() after 300 milliseconds. - */ - function debounce(fn, delay) { - var timer, - args; - - /* istanbul ignore next */ - delay = delay || 0; - - function debounced() { - args = aps.call(arguments); - - window.clearTimeout(timer); - timer = window.setTimeout(function() { - fn.apply(null, args); - }, delay); - } - - return debounced; - } - - /** - * return timestamp - * @memberof tui.util - * @returns {number} The number of milliseconds from Jan. 1970 00:00:00 (GMT) - */ - function timestamp() { - return +(new Date()); - } - - /** - * Creates a throttled function that only invokes fn at most once per every interval milliseconds. - * - * You can use this throttle short time repeatedly invoking functions. (e.g MouseMove, Resize ...) - * - * if you need reuse throttled method. you must remove slugs (e.g. flag variable) related with throttling. - * @param {function} fn function to throttle - * @param {number} [interval=0] the number of milliseconds to throttle invocations to. - * @memberof tui.util - * @returns {function} throttled function - * @example - * - * function someMethodToInvokeThrottled() {} - * - * var throttled = tui.util.throttle(someMethodToInvokeThrottled, 300); - * - * // invoke repeatedly - * throttled(); // invoke (leading) - * throttled(); - * throttled(); // invoke (near 300 milliseconds) - * throttled(); - * throttled(); - * throttled(); // invoke (near 600 milliseconds) - * // ... - * // invoke (trailing) - * - * // if you need reuse throttled method. then invoke reset() - * throttled.reset(); - */ - function throttle(fn, interval) { - var base, - _timestamp = tui.util.timestamp, - debounced, - isLeading = true, - stamp, - args, - tick = function(_args) { - fn.apply(null, _args); - base = null; - }; - - /* istanbul ignore next */ - interval = interval || 0; - - debounced = tui.util.debounce(tick, interval); - - function throttled() { - args = aps.call(arguments); - - if (isLeading) { - tick(args); - isLeading = false; - return; - } - - stamp = _timestamp(); - - base = base || stamp; - - // pass array directly because `debounce()`, `tick()` are already use - // `apply()` method to invoke developer's `fn` handler. - // - // also, this `debounced` line invoked every time for implements - // `trailing` features. - debounced(args); - - if ((stamp - base) >= interval) { - tick(args); - } - } - - function reset() { - isLeading = true; - base = null; - } - - throttled.reset = reset; - return throttled; - } - - tui.util.timestamp = timestamp; - tui.util.debounce = debounce; - tui.util.throttle = throttle; -})(window.tui); - - -/********** - * type.js - **********/ - -/** - * @fileoverview This module provides some functions to check the type of variable - * @author NHN Ent. - * FE Development Team - * @dependency collection.js - */ - -(function(tui) { - 'use strict'; - /* istanbul ignore if */ - if (!tui) { - tui = window.tui = {}; - } - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - /** - * Check whether the given variable is existing or not.
- * If the given variable is not null and not undefined, returns true. - * @param {*} param - Target for checking - * @returns {boolean} Is existy? - * @memberOf tui.util - * @example - * tui.util.isExisty(''); //true - * tui.util.isExisty(0); //true - * tui.util.isExisty([]); //true - * tui.util.isExisty({}); //true - * tui.util.isExisty(null); //false - * tui.util.isExisty(undefined); //false - */ - function isExisty(param) { - return param != null; - } - - /** - * Check whether the given variable is undefined or not.
- * If the given variable is undefined, returns true. - * @param {*} obj - Target for checking - * @returns {boolean} Is undefined? - * @memberOf tui.util - */ - function isUndefined(obj) { - return obj === undefined; - } - - /** - * Check whether the given variable is null or not.
- * If the given variable(arguments[0]) is null, returns true. - * @param {*} obj - Target for checking - * @returns {boolean} Is null? - * @memberOf tui.util - */ - function isNull(obj) { - return obj === null; - } - - /** - * Check whether the given variable is truthy or not.
- * If the given variable is not null or not undefined or not false, returns true.
- * (It regards 0 as true) - * @param {*} obj - Target for checking - * @return {boolean} Is truthy? - * @memberOf tui.util - */ - function isTruthy(obj) { - return isExisty(obj) && obj !== false; - } - - /** - * Check whether the given variable is falsy or not.
- * If the given variable is null or undefined or false, returns true. - * @param {*} obj - Target for checking - * @return {boolean} Is falsy? - * @memberOf tui.util - */ - function isFalsy(obj) { - return !isTruthy(obj); - } - - - var toString = Object.prototype.toString; - - /** - * Check whether the given variable is an arguments object or not.
- * If the given variable is an arguments object, return true. - * @param {*} obj - Target for checking - * @return {boolean} Is arguments? - * @memberOf tui.util - */ - function isArguments(obj) { - var result = isExisty(obj) && - ((toString.call(obj) === '[object Arguments]') || !!obj.callee); - - return result; - } - - /** - * Check whether the given variable is an instance of Array or not.
- * If the given variable is an instance of Array, return true. - * @param {*} obj - Target for checking - * @return {boolean} Is array instance? - * @memberOf tui.util - */ - function isArray(obj) { - return obj instanceof Array; - } - - /** - * Check whether the given variable is an object or not.
- * If the given variable is an object, return true. - * @param {*} obj - Target for checking - * @return {boolean} Is object? - * @memberOf tui.util - */ - function isObject(obj) { - return obj === Object(obj); - } - - /** - * Check whether the given variable is a function or not.
- * If the given variable is a function, return true. - * @param {*} obj - Target for checking - * @return {boolean} Is function? - * @memberOf tui.util - */ - function isFunction(obj) { - return obj instanceof Function; - } - - /** - * Check whether the given variable is a number or not.
- * If the given variable is a number, return true. - * @param {*} obj - Target for checking - * @return {boolean} Is number? - * @memberOf tui.util - */ - function isNumber(obj) { - return typeof obj === 'number' || obj instanceof Number; - } - - /** - * Check whether the given variable is a string or not.
- * If the given variable is a string, return true. - * @param {*} obj - Target for checking - * @return {boolean} Is string? - * @memberOf tui.util - */ - function isString(obj) { - return typeof obj === 'string' || obj instanceof String; - } - - /** - * Check whether the given variable is a boolean or not.
- * If the given variable is a boolean, return true. - * @param {*} obj - Target for checking - * @return {boolean} Is boolean? - * @memberOf tui.util - */ - function isBoolean(obj) { - return typeof obj === 'boolean' || obj instanceof Boolean; - } - - - /** - * Check whether the given variable is an instance of Array or not.
- * If the given variable is an instance of Array, return true.
- * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @return {boolean} Is an instance of array? - * @memberOf tui.util - */ - function isArraySafe(obj) { - return toString.call(obj) === '[object Array]'; - } - - /** - * Check whether the given variable is a function or not.
- * If the given variable is a function, return true.
- * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @return {boolean} Is a function? - * @memberOf tui.util - */ - function isFunctionSafe(obj) { - return toString.call(obj) === '[object Function]'; - } - - /** - * Check whether the given variable is a number or not.
- * If the given variable is a number, return true.
- * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @return {boolean} Is a number? - * @memberOf tui.util - */ - function isNumberSafe(obj) { - return toString.call(obj) === '[object Number]'; - } - - /** - * Check whether the given variable is a string or not.
- * If the given variable is a string, return true.
- * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @return {boolean} Is a string? - * @memberOf tui.util - */ - function isStringSafe(obj) { - return toString.call(obj) === '[object String]'; - } - - /** - * Check whether the given variable is a boolean or not.
- * If the given variable is a boolean, return true.
- * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @return {boolean} Is a boolean? - * @memberOf tui.util - */ - function isBooleanSafe(obj) { - return toString.call(obj) === '[object Boolean]'; - } - - /** - * Check whether the given variable is a instance of HTMLNode or not.
- * If the given variables is a instance of HTMLNode, return true. - * @param {*} html - Target for checking - * @return {boolean} Is HTMLNode ? - * @memberOf tui.util - */ - function isHTMLNode(html) { - if (typeof(HTMLElement) === 'object') { - return (html && (html instanceof HTMLElement || !!html.nodeType)); - } - return !!(html && html.nodeType); - } - - /** - * Check whether the given variable is a HTML tag or not.
- * If the given variables is a HTML tag, return true. - * @param {*} html - Target for checking - * @return {Boolean} Is HTML tag? - * @memberOf tui.util - */ - function isHTMLTag(html) { - if (typeof(HTMLElement) === 'object') { - return (html && (html instanceof HTMLElement)); - } - return !!(html && html.nodeType && html.nodeType === 1); - } - - /** - * Check whether the given variable is empty(null, undefined, or empty array, empty object) or not.
- * If the given variables is empty, return true. - * @param {*} obj - Target for checking - * @return {boolean} Is empty? - * @memberOf tui.util - */ - function isEmpty(obj) { - var hasKey = false; - - if (!isExisty(obj)) { - return true; - } - - if (isString(obj) && obj === '') { - return true; - } - - if (isArray(obj) || isArguments(obj)) { - return obj.length === 0; - } - - if (isObject(obj) && !isFunction(obj)) { - tui.util.forEachOwnProperties(obj, function() { - hasKey = true; - return false; - }); - - return !hasKey; - } - - return true; - - } - - /** - * Check whether the given variable is not empty(not null, not undefined, or not empty array, not empty object) or not.
- * If the given variables is not empty, return true. - * @param {*} obj - Target for checking - * @return {boolean} Is not empty? - * @memberOf tui.util - */ - function isNotEmpty(obj) { - return !isEmpty(obj); - } - - /** - * Check whether the given variable is an instance of Date or not.
- * If the given variables is an instance of Date, return true. - * @param {*} obj - Target for checking - * @returns {boolean} Is an instance of Date? - * @memberOf tui.util - */ - function isDate(obj) { - return obj instanceof Date; - } - - /** - * Check whether the given variable is an instance of Date or not.
- * If the given variables is an instance of Date, return true.
- * (It is used for multiple frame environments) - * @param {*} obj - Target for checking - * @returns {boolean} Is an instance of Date? - * @memberOf tui.util - */ - function isDateSafe(obj) { - return toString.call(obj) === '[object Date]'; - } - - - tui.util.isExisty = isExisty; - tui.util.isUndefined = isUndefined; - tui.util.isNull = isNull; - tui.util.isTruthy = isTruthy; - tui.util.isFalsy = isFalsy; - tui.util.isArguments = isArguments; - tui.util.isArray = Array.isArray || isArray; - tui.util.isArraySafe = Array.isArray || isArraySafe; - tui.util.isObject = isObject; - tui.util.isFunction = isFunction; - tui.util.isFunctionSafe = isFunctionSafe; - tui.util.isNumber = isNumber; - tui.util.isNumberSafe = isNumberSafe; - tui.util.isDate = isDate; - tui.util.isDateSafe = isDateSafe; - tui.util.isString = isString; - tui.util.isStringSafe = isStringSafe; - tui.util.isBoolean = isBoolean; - tui.util.isBooleanSafe = isBooleanSafe; - tui.util.isHTMLNode = isHTMLNode; - tui.util.isHTMLTag = isHTMLTag; - tui.util.isEmpty = isEmpty; - tui.util.isNotEmpty = isNotEmpty; - -})(window.tui); - -/********** - * window.js - **********/ - -/** - * @fileoverview This module has some methods for handling popup-window - * @author NHN Ent. - * FE Development Team - * @dependency browser.js, type.js, object.js, collection.js, func.js, window.js - */ - -(function(tui) { - 'use strict'; - if (!tui) { - tui = window.tui = {}; - } - if (!tui.util) { - tui.util = window.tui.util = {}; - } - - var popup_id = 0; - - /** - * Popup management class - * @constructor - * @memberof tui.util - */ - function Popup() { - - /** - * Caching the window-contexts of opened popups - * @type {Object} - */ - this.openedPopup = {}; - - /** - * In IE7, an error occurs when the closeWithParent property attaches to window object.
- * So, It is for saving the value of closeWithParent instead of attaching to window object. - * @type {Object} - */ - this.closeWithParentPopup = {}; - - /** - * Post data bridge for IE11 popup - * @type {string} - */ - this.postBridgeUrl = ''; - } - - /********** - * public methods - **********/ - - /** - * Returns a popup-list administered by current window. - * @param {string} [key] The key of popup. - * @returns {Object} popup window list object - */ - Popup.prototype.getPopupList = function(key) { - var target; - if (tui.util.isExisty(key)) { - target = this.openedPopup[key]; - } else { - target = this.openedPopup; - } - return target; - }; - - /** - * Open popup - * Caution: - * In IE11, when transfer data to popup by POST, must set the postBridgeUrl. - * - * @param {string} url - popup url - * @param {Object} options - * @param {string} [options.popupName] - Key of popup window.
- * If the key is set, when you try to open by this key, the popup of this key is focused.
- * Or else a new popup window having this key is opened. - * - * @param {string} [options.popupOptionStr=""] - Option string of popup window
- * It is same with the third parameter of window.open() method.
- * See {@link http://www.w3schools.com/jsref/met_win_open.asp} - * - * @param {boolean} [options.closeWithParent=true] - Is closed when parent window closed? - * - * @param {boolean} [options.useReload=false] - This property indicates whether reload the popup or not.
- * If true, the popup will be reloaded when you try to re-open the popup that has been opened.
- * When transmit the POST-data, some browsers alert a message for confirming whether retransmit or not. - * - * @param {string} [options.postBridgeUrl=''] - Use this url to avoid a certain bug occuring when transmitting POST data to the popup in IE11.
- * This specific buggy situation is known to happen because IE11 tries to open the requested url not in a new popup window as intended, but in a new tab.
- * See {@link http://wiki.nhnent.com/pages/viewpage.action?pageId=240562844} - * - * @param {string} [options.method=get] - The method of transmission when the form-data is transmitted to popup-window. - * - * @param {Object} [options.param=null] - Using as parameters for transmission when the form-data is transmitted to popup-window. - */ - Popup.prototype.openPopup = function(url, options) { - options = tui.util.extend({ - popupName: 'popup_' + popup_id + '_' + (+new Date()), - popupOptionStr: '', - useReload: true, - closeWithParent: true, - method: 'get', - param: {} - }, options || {}); - - options.method = options.method.toUpperCase(); - - this.postBridgeUrl = options.postBridgeUrl || this.postBridgeUrl; - - var popup, - formElement, - useIEPostBridge = options.method === 'POST' && options.param && - tui.util.browser.msie && tui.util.browser.version === 11; - - if (!tui.util.isExisty(url)) { - throw new Error('Popup#open() need popup url.'); - } - - popup_id += 1; - - /* - * In form-data transmission - * 1. Create a form before opening a popup. - * 2. Transmit the form-data. - * 3. Remove the form after transmission. - */ - if (options.param) { - if (options.method === 'GET') { - url = url + (/\?/.test(url) ? '&' : '?') + this._parameterize(options.param); - } else if (options.method === 'POST') { - if (!useIEPostBridge) { - formElement = this.createForm(url, options.param, options.method, options.popupName); - url = 'about:blank'; - } - } - } - - popup = this.openedPopup[options.popupName]; - - if (!tui.util.isExisty(popup)) { - this.openedPopup[options.popupName] = popup = this._open(useIEPostBridge, options.param, - url, options.popupName, options.popupOptionStr); - - } else { - if (popup.closed) { - this.openedPopup[options.popupName] = popup = this._open(useIEPostBridge, options.param, - url, options.popupName, options.popupOptionStr); - - } else { - if (options.useReload) { - popup.location.replace(url); - } - popup.focus(); - } - } - - this.closeWithParentPopup[options.popupName] = options.closeWithParent; - - if (!popup || popup.closed || tui.util.isUndefined(popup.closed)) { - alert('please enable popup windows for this website'); - } - - if (options.param && options.method === 'POST' && !useIEPostBridge) { - if (popup) { - formElement.submit(); - } - if (formElement.parentNode) { - formElement.parentNode.removeChild(formElement); - } - } - - window.onunload = tui.util.bind(this.closeAllPopup, this); - }; - - /** - * Close the popup - * @param {boolean} [skipBeforeUnload] - If true, the 'window.onunload' will be null and skip unload event. - * @param {Window} [popup] - Window-context of popup for closing. If omit this, current window-context will be closed. - */ - Popup.prototype.close = function(skipBeforeUnload, popup) { - skipBeforeUnload = tui.util.isExisty(skipBeforeUnload) ? skipBeforeUnload : false; - - var target = popup || window; - - if (skipBeforeUnload) { - window.onunload = null; - } - - if (!target.closed) { - target.opener = window.location.href; - target.close(); - } - }; - - /** - * Close all the popups in current window. - * @param {boolean} closeWithParent - If true, popups having the closeWithParentPopup property as true will be closed. - */ - Popup.prototype.closeAllPopup = function(closeWithParent) { - var hasArg = tui.util.isExisty(closeWithParent); - - tui.util.forEachOwnProperties(this.openedPopup, function(popup, key) { - if ((hasArg && this.closeWithParentPopup[key]) || !hasArg) { - this.close(false, popup); - } - }, this); - }; - - /** - * Activate(or focus) the popup of the given name. - * @param {string} popupName - Name of popup for activation - */ - Popup.prototype.focus = function(popupName) { - this.getPopupList(popupName).focus(); - }; - - /** - * Return an object made of parsing the query string. - * @return {Object} An object having some information of the query string. - * @private - */ - Popup.prototype.parseQuery = function() { - var search, - pair, - param = {}; - - search = window.location.search.substr(1); - tui.util.forEachArray(search.split('&'), function(part) { - pair = part.split('='); - param[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); - }); - - return param; - }; - - /** - * Create a hidden form from the given arguments and return this form. - * @param {string} action - URL for form transmission - * @param {Object} [data] - Data for form transmission - * @param {string} [method] - Method of transmission - * @param {string} [target] - Target of transmission - * @param {HTMLElement} [container] - Container element of form. - * @returns {HTMLElement} Form element - */ - Popup.prototype.createForm = function(action, data, method, target, container) { - var form = document.createElement('form'), - input; - - container = container || document.body; - - form.method = method || 'POST'; - form.action = action || ''; - form.target = target || ''; - form.style.display = 'none'; - - tui.util.forEachOwnProperties(data, function(value, key) { - input = document.createElement('input'); - input.name = key; - input.type = 'hidden'; - input.value = value; - form.appendChild(input); - }); - - container.appendChild(form); - - return form; - }; - - /********** - * private methods - **********/ - - /** - * Return an query string made by parsing the given object - * @param {Object} object - An object that has information for query string - * @returns {string} - Query string - * @private - */ - Popup.prototype._parameterize = function(object) { - var query = []; - - tui.util.forEachOwnProperties(object, function(value, key) { - query.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); - }); - - return query.join('&'); - }; - - /** - * Open popup - * @param {boolean} useIEPostBridge - A switch option whether to use alternative of tossing POST data to the popup window in IE11 - * @param {Object} param - A data for tossing to popup - * @param {string} url - Popup url - * @param {string} popupName - Popup name - * @param {string} optionStr - Setting for popup, ex) 'width=640,height=320,scrollbars=yes' - * @returns {Window} Window context of popup - * @private - */ - Popup.prototype._open = function(useIEPostBridge, param, url, popupName, optionStr) { - var popup; - - if (useIEPostBridge) { - popup = window.open(this.postBridgeUrl, popupName, optionStr); - setTimeout(function() { - popup.redirect(url, param); - }, 100); - } else { - popup = window.open(url, popupName, optionStr); - } - - return popup; - }; - - tui.util.popup = new Popup(); -})(window.tui); diff --git a/samples/js/contextmenu.js b/samples/js/contextmenu.js deleted file mode 100644 index 1f653a3..0000000 --- a/samples/js/contextmenu.js +++ /dev/null @@ -1,1789 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 2.0.0-beta.1', - 7: '>= 4.0.0' -}; - -exports.REVISION_CHANGES = REVISION_CHANGES; -var objectType = '[object Object]'; - -function HandlebarsEnvironment(helpers, partials, decorators) { - this.helpers = helpers || {}; - this.partials = partials || {}; - this.decorators = decorators || {}; - - _helpers.registerDefaultHelpers(this); - _decorators.registerDefaultDecorators(this); -} - -HandlebarsEnvironment.prototype = { - constructor: HandlebarsEnvironment, - - logger: _logger2['default'], - log: _logger2['default'].log, - - registerHelper: function registerHelper(name, fn) { - if (_utils.toString.call(name) === objectType) { - if (fn) { - throw new _exception2['default']('Arg not supported with multiple helpers'); - } - _utils.extend(this.helpers, name); - } else { - this.helpers[name] = fn; - } - }, - unregisterHelper: function unregisterHelper(name) { - delete this.helpers[name]; - }, - - registerPartial: function registerPartial(name, partial) { - if (_utils.toString.call(name) === objectType) { - _utils.extend(this.partials, name); - } else { - if (typeof partial === 'undefined') { - throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); - } - this.partials[name] = partial; - } - }, - unregisterPartial: function unregisterPartial(name) { - delete this.partials[name]; - }, - - registerDecorator: function registerDecorator(name, fn) { - if (_utils.toString.call(name) === objectType) { - if (fn) { - throw new _exception2['default']('Arg not supported with multiple decorators'); - } - _utils.extend(this.decorators, name); - } else { - this.decorators[name] = fn; - } - }, - unregisterDecorator: function unregisterDecorator(name) { - delete this.decorators[name]; - } -}; - -var log = _logger2['default'].log; - -exports.log = log; -exports.createFrame = _utils.createFrame; -exports.logger = _logger2['default']; - - -},{"./decorators":4,"./exception":6,"./helpers":7,"./logger":15,"./utils":19}],4:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -exports.registerDefaultDecorators = registerDefaultDecorators; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _decoratorsInline = require('./decorators/inline'); - -var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); - -function registerDefaultDecorators(instance) { - _decoratorsInline2['default'](instance); -} - - -},{"./decorators/inline":5}],5:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var _utils = require('../utils'); - -exports['default'] = function (instance) { - instance.registerDecorator('inline', function (fn, props, container, options) { - var ret = fn; - if (!props.partials) { - props.partials = {}; - ret = function (context, options) { - // Create a new partials stack frame prior to exec. - var original = container.partials; - container.partials = _utils.extend({}, original, props.partials); - var ret = fn(context, options); - container.partials = original; - return ret; - }; - } - - props.partials[options.args[0]] = options.fn; - - return ret; - }); -}; - -module.exports = exports['default']; - - -},{"../utils":19}],6:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; - -function Exception(message, node) { - var loc = node && node.loc, - line = undefined, - column = undefined; - if (loc) { - line = loc.start.line; - column = loc.start.column; - - message += ' - ' + line + ':' + column; - } - - var tmp = Error.prototype.constructor.call(this, message); - - // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. - for (var idx = 0; idx < errorProps.length; idx++) { - this[errorProps[idx]] = tmp[errorProps[idx]]; - } - - /* istanbul ignore else */ - if (Error.captureStackTrace) { - Error.captureStackTrace(this, Exception); - } - - if (loc) { - this.lineNumber = line; - this.column = column; - } -} - -Exception.prototype = new Error(); - -exports['default'] = Exception; -module.exports = exports['default']; - - -},{}],7:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -exports.registerDefaultHelpers = registerDefaultHelpers; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _helpersBlockHelperMissing = require('./helpers/block-helper-missing'); - -var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); - -var _helpersEach = require('./helpers/each'); - -var _helpersEach2 = _interopRequireDefault(_helpersEach); - -var _helpersHelperMissing = require('./helpers/helper-missing'); - -var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); - -var _helpersIf = require('./helpers/if'); - -var _helpersIf2 = _interopRequireDefault(_helpersIf); - -var _helpersLog = require('./helpers/log'); - -var _helpersLog2 = _interopRequireDefault(_helpersLog); - -var _helpersLookup = require('./helpers/lookup'); - -var _helpersLookup2 = _interopRequireDefault(_helpersLookup); - -var _helpersWith = require('./helpers/with'); - -var _helpersWith2 = _interopRequireDefault(_helpersWith); - -function registerDefaultHelpers(instance) { - _helpersBlockHelperMissing2['default'](instance); - _helpersEach2['default'](instance); - _helpersHelperMissing2['default'](instance); - _helpersIf2['default'](instance); - _helpersLog2['default'](instance); - _helpersLookup2['default'](instance); - _helpersWith2['default'](instance); -} - - -},{"./helpers/block-helper-missing":8,"./helpers/each":9,"./helpers/helper-missing":10,"./helpers/if":11,"./helpers/log":12,"./helpers/lookup":13,"./helpers/with":14}],8:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var _utils = require('../utils'); - -exports['default'] = function (instance) { - instance.registerHelper('blockHelperMissing', function (context, options) { - var inverse = options.inverse, - fn = options.fn; - - if (context === true) { - return fn(this); - } else if (context === false || context == null) { - return inverse(this); - } else if (_utils.isArray(context)) { - if (context.length > 0) { - if (options.ids) { - options.ids = [options.name]; - } - - return instance.helpers.each(context, options); - } else { - return inverse(this); - } - } else { - if (options.data && options.ids) { - var data = _utils.createFrame(options.data); - data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); - options = { data: data }; - } - - return fn(context, options); - } - }); -}; - -module.exports = exports['default']; - - -},{"../utils":19}],9:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _utils = require('../utils'); - -var _exception = require('../exception'); - -var _exception2 = _interopRequireDefault(_exception); - -exports['default'] = function (instance) { - instance.registerHelper('each', function (context, options) { - if (!options) { - throw new _exception2['default']('Must pass iterator to #each'); - } - - var fn = options.fn, - inverse = options.inverse, - i = 0, - ret = '', - data = undefined, - contextPath = undefined; - - if (options.data && options.ids) { - contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; - } - - if (_utils.isFunction(context)) { - context = context.call(this); - } - - if (options.data) { - data = _utils.createFrame(options.data); - } - - function execIteration(field, index, last) { - if (data) { - data.key = field; - data.index = index; - data.first = index === 0; - data.last = !!last; - - if (contextPath) { - data.contextPath = contextPath + field; - } - } - - ret = ret + fn(context[field], { - data: data, - blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) - }); - } - - if (context && typeof context === 'object') { - if (_utils.isArray(context)) { - for (var j = context.length; i < j; i++) { - if (i in context) { - execIteration(i, i, i === context.length - 1); - } - } - } else { - var priorKey = undefined; - - for (var key in context) { - if (context.hasOwnProperty(key)) { - // We're running the iterations one step out of sync so we can detect - // the last iteration without have to scan the object twice and create - // an itermediate keys array. - if (priorKey !== undefined) { - execIteration(priorKey, i - 1); - } - priorKey = key; - i++; - } - } - if (priorKey !== undefined) { - execIteration(priorKey, i - 1, true); - } - } - } - - if (i === 0) { - ret = inverse(this); - } - - return ret; - }); -}; - -module.exports = exports['default']; - - -},{"../exception":6,"../utils":19}],10:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _exception = require('../exception'); - -var _exception2 = _interopRequireDefault(_exception); - -exports['default'] = function (instance) { - instance.registerHelper('helperMissing', function () /* [args, ]options */{ - if (arguments.length === 1) { - // A missing field in a {{foo}} construct. - return undefined; - } else { - // Someone is actually trying to call something, blow up. - throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); - } - }); -}; - -module.exports = exports['default']; - - -},{"../exception":6}],11:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var _utils = require('../utils'); - -exports['default'] = function (instance) { - instance.registerHelper('if', function (conditional, options) { - if (_utils.isFunction(conditional)) { - conditional = conditional.call(this); - } - - // Default behavior is to render the positive path if the value is truthy and not empty. - // The `includeZero` option may be set to treat the condtional as purely not empty based on the - // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. - if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - - instance.registerHelper('unless', function (conditional, options) { - return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); - }); -}; - -module.exports = exports['default']; - - -},{"../utils":19}],12:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -exports['default'] = function (instance) { - instance.registerHelper('log', function () /* message, options */{ - var args = [undefined], - options = arguments[arguments.length - 1]; - for (var i = 0; i < arguments.length - 1; i++) { - args.push(arguments[i]); - } - - var level = 1; - if (options.hash.level != null) { - level = options.hash.level; - } else if (options.data && options.data.level != null) { - level = options.data.level; - } - args[0] = level; - - instance.log.apply(instance, args); - }); -}; - -module.exports = exports['default']; - - -},{}],13:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -exports['default'] = function (instance) { - instance.registerHelper('lookup', function (obj, field) { - return obj && obj[field]; - }); -}; - -module.exports = exports['default']; - - -},{}],14:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var _utils = require('../utils'); - -exports['default'] = function (instance) { - instance.registerHelper('with', function (context, options) { - if (_utils.isFunction(context)) { - context = context.call(this); - } - - var fn = options.fn; - - if (!_utils.isEmpty(context)) { - var data = options.data; - if (options.data && options.ids) { - data = _utils.createFrame(options.data); - data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); - } - - return fn(context, { - data: data, - blockParams: _utils.blockParams([context], [data && data.contextPath]) - }); - } else { - return options.inverse(this); - } - }); -}; - -module.exports = exports['default']; - - -},{"../utils":19}],15:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var _utils = require('./utils'); - -var logger = { - methodMap: ['debug', 'info', 'warn', 'error'], - level: 'info', - - // Maps a given level value to the `methodMap` indexes above. - lookupLevel: function lookupLevel(level) { - if (typeof level === 'string') { - var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); - if (levelMap >= 0) { - level = levelMap; - } else { - level = parseInt(level, 10); - } - } - - return level; - }, - - // Can be overridden in the host environment - log: function log(level) { - level = logger.lookupLevel(level); - - if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { - var method = logger.methodMap[level]; - if (!console[method]) { - // eslint-disable-line no-console - method = 'log'; - } - - for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - message[_key - 1] = arguments[_key]; - } - - console[method].apply(console, message); // eslint-disable-line no-console - } - } -}; - -exports['default'] = logger; -module.exports = exports['default']; - - -},{"./utils":19}],16:[function(require,module,exports){ -(function (global){ -/* global window */ -'use strict'; - -exports.__esModule = true; - -exports['default'] = function (Handlebars) { - /* istanbul ignore next */ - var root = typeof global !== 'undefined' ? global : window, - $Handlebars = root.Handlebars; - /* istanbul ignore next */ - Handlebars.noConflict = function () { - if (root.Handlebars === Handlebars) { - root.Handlebars = $Handlebars; - } - return Handlebars; - }; -}; - -module.exports = exports['default']; - - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],17:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -exports.checkRevision = checkRevision; -exports.template = template; -exports.wrapProgram = wrapProgram; -exports.resolvePartial = resolvePartial; -exports.invokePartial = invokePartial; -exports.noop = noop; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } - -var _utils = require('./utils'); - -var Utils = _interopRequireWildcard(_utils); - -var _exception = require('./exception'); - -var _exception2 = _interopRequireDefault(_exception); - -var _base = require('./base'); - -function checkRevision(compilerInfo) { - var compilerRevision = compilerInfo && compilerInfo[0] || 1, - currentRevision = _base.COMPILER_REVISION; - - if (compilerRevision !== currentRevision) { - if (compilerRevision < currentRevision) { - var runtimeVersions = _base.REVISION_CHANGES[currentRevision], - compilerVersions = _base.REVISION_CHANGES[compilerRevision]; - throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); - } else { - // Use the embedded version info since the runtime doesn't know about this revision yet - throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } - } -} - -function template(templateSpec, env) { - /* istanbul ignore next */ - if (!env) { - throw new _exception2['default']('No environment passed to template'); - } - if (!templateSpec || !templateSpec.main) { - throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); - } - - templateSpec.main.decorator = templateSpec.main_d; - - // Note: Using env.VM references rather than local var references throughout this section to allow - // for external users to override these as psuedo-supported APIs. - env.VM.checkRevision(templateSpec.compiler); - - function invokePartialWrapper(partial, context, options) { - if (options.hash) { - context = Utils.extend({}, context, options.hash); - if (options.ids) { - options.ids[0] = true; - } - } - - partial = env.VM.resolvePartial.call(this, partial, context, options); - var result = env.VM.invokePartial.call(this, partial, context, options); - - if (result == null && env.compile) { - options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, options); - } - if (result != null) { - if (options.indent) { - var lines = result.split('\n'); - for (var i = 0, l = lines.length; i < l; i++) { - if (!lines[i] && i + 1 === l) { - break; - } - - lines[i] = options.indent + lines[i]; - } - result = lines.join('\n'); - } - return result; - } else { - throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); - } - } - - // Just add water - var container = { - strict: function strict(obj, name) { - if (!(name in obj)) { - throw new _exception2['default']('"' + name + '" not defined in ' + obj); - } - return obj[name]; - }, - lookup: function lookup(depths, name) { - var len = depths.length; - for (var i = 0; i < len; i++) { - if (depths[i] && depths[i][name] != null) { - return depths[i][name]; - } - } - }, - lambda: function lambda(current, context) { - return typeof current === 'function' ? current.call(context) : current; - }, - - escapeExpression: Utils.escapeExpression, - invokePartial: invokePartialWrapper, - - fn: function fn(i) { - var ret = templateSpec[i]; - ret.decorator = templateSpec[i + '_d']; - return ret; - }, - - programs: [], - program: function program(i, data, declaredBlockParams, blockParams, depths) { - var programWrapper = this.programs[i], - fn = this.fn(i); - if (data || depths || blockParams || declaredBlockParams) { - programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); - } else if (!programWrapper) { - programWrapper = this.programs[i] = wrapProgram(this, i, fn); - } - return programWrapper; - }, - - data: function data(value, depth) { - while (value && depth--) { - value = value._parent; - } - return value; - }, - merge: function merge(param, common) { - var obj = param || common; - - if (param && common && param !== common) { - obj = Utils.extend({}, common, param); - } - - return obj; - }, - - noop: env.VM.noop, - compilerInfo: templateSpec.compiler - }; - - function ret(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var data = options.data; - - ret._setup(options); - if (!options.partial && templateSpec.useData) { - data = initData(context, data); - } - var depths = undefined, - blockParams = templateSpec.useBlockParams ? [] : undefined; - if (templateSpec.useDepths) { - if (options.depths) { - depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths; - } else { - depths = [context]; - } - } - - function main(context /*, options*/) { - return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); - } - main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); - return main(context, options); - } - ret.isTop = true; - - ret._setup = function (options) { - if (!options.partial) { - container.helpers = container.merge(options.helpers, env.helpers); - - if (templateSpec.usePartial) { - container.partials = container.merge(options.partials, env.partials); - } - if (templateSpec.usePartial || templateSpec.useDecorators) { - container.decorators = container.merge(options.decorators, env.decorators); - } - } else { - container.helpers = options.helpers; - container.partials = options.partials; - container.decorators = options.decorators; - } - }; - - ret._child = function (i, data, blockParams, depths) { - if (templateSpec.useBlockParams && !blockParams) { - throw new _exception2['default']('must pass block params'); - } - if (templateSpec.useDepths && !depths) { - throw new _exception2['default']('must pass parent depths'); - } - - return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); - }; - return ret; -} - -function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { - function prog(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var currentDepths = depths; - if (depths && context !== depths[0]) { - currentDepths = [context].concat(depths); - } - - return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); - } - - prog = executeDecorators(fn, prog, container, depths, data, blockParams); - - prog.program = i; - prog.depth = depths ? depths.length : 0; - prog.blockParams = declaredBlockParams || 0; - return prog; -} - -function resolvePartial(partial, context, options) { - if (!partial) { - if (options.name === '@partial-block') { - partial = options.data['partial-block']; - } else { - partial = options.partials[options.name]; - } - } else if (!partial.call && !options.name) { - // This is a dynamic partial that returned a string - options.name = partial; - partial = options.partials[partial]; - } - return partial; -} - -function invokePartial(partial, context, options) { - options.partial = true; - if (options.ids) { - options.data.contextPath = options.ids[0] || options.data.contextPath; - } - - var partialBlock = undefined; - if (options.fn && options.fn !== noop) { - options.data = _base.createFrame(options.data); - partialBlock = options.data['partial-block'] = options.fn; - - if (partialBlock.partials) { - options.partials = Utils.extend({}, options.partials, partialBlock.partials); - } - } - - if (partial === undefined && partialBlock) { - partial = partialBlock; - } - - if (partial === undefined) { - throw new _exception2['default']('The partial ' + options.name + ' could not be found'); - } else if (partial instanceof Function) { - return partial(context, options); - } -} - -function noop() { - return ''; -} - -function initData(context, data) { - if (!data || !('root' in data)) { - data = data ? _base.createFrame(data) : {}; - data.root = context; - } - return data; -} - -function executeDecorators(fn, prog, container, depths, data, blockParams) { - if (fn.decorator) { - var props = {}; - prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); - Utils.extend(prog, props); - } - return prog; -} - - -},{"./base":3,"./exception":6,"./utils":19}],18:[function(require,module,exports){ -// Build out our basic SafeString type -'use strict'; - -exports.__esModule = true; -function SafeString(string) { - this.string = string; -} - -SafeString.prototype.toString = SafeString.prototype.toHTML = function () { - return '' + this.string; -}; - -exports['default'] = SafeString; -module.exports = exports['default']; - - -},{}],19:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; -exports.extend = extend; -exports.indexOf = indexOf; -exports.escapeExpression = escapeExpression; -exports.isEmpty = isEmpty; -exports.createFrame = createFrame; -exports.blockParams = blockParams; -exports.appendContextPath = appendContextPath; -var escape = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`', - '=': '=' -}; - -var badChars = /[&<>"'`=]/g, - possible = /[&<>"'`=]/; - -function escapeChar(chr) { - return escape[chr]; -} - -function extend(obj /* , ...source */) { - for (var i = 1; i < arguments.length; i++) { - for (var key in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { - obj[key] = arguments[i][key]; - } - } - } - - return obj; -} - -var toString = Object.prototype.toString; - -exports.toString = toString; -// Sourced from lodash -// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt -/* eslint-disable func-style */ -var isFunction = function isFunction(value) { - return typeof value === 'function'; -}; -// fallback for older versions of Chrome and Safari -/* istanbul ignore next */ -if (isFunction(/x/)) { - exports.isFunction = isFunction = function (value) { - return typeof value === 'function' && toString.call(value) === '[object Function]'; - }; -} -exports.isFunction = isFunction; - -/* eslint-enable func-style */ - -/* istanbul ignore next */ -var isArray = Array.isArray || function (value) { - return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; -}; - -exports.isArray = isArray; -// Older IE versions do not directly support indexOf so we must implement our own, sadly. - -function indexOf(array, value) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { - return i; - } - } - return -1; -} - -function escapeExpression(string) { - if (typeof string !== 'string') { - // don't escape SafeStrings, since they're already safe - if (string && string.toHTML) { - return string.toHTML(); - } else if (string == null) { - return ''; - } else if (!string) { - return string + ''; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = '' + string; - } - - if (!possible.test(string)) { - return string; - } - return string.replace(badChars, escapeChar); -} - -function isEmpty(value) { - if (!value && value !== 0) { - return true; - } else if (isArray(value) && value.length === 0) { - return true; - } else { - return false; - } -} - -function createFrame(object) { - var frame = extend({}, object); - frame._parent = object; - return frame; -} - -function blockParams(params, ids) { - params.path = ids; - return params; -} - -function appendContextPath(contextPath, id) { - return (contextPath ? contextPath + '.' : '') + id; -} - - -},{}],20:[function(require,module,exports){ -// Create a simple path alias to allow browserify to resolve -// the runtime on a supported path. -module.exports = require('./dist/cjs/handlebars.runtime')['default']; - -},{"./dist/cjs/handlebars.runtime":2}],21:[function(require,module,exports){ -module.exports = require("handlebars/runtime")["default"]; - -},{"handlebars/runtime":20}],22:[function(require,module,exports){ -// hbsfy compiled Handlebars template -var HandlebarsCompiler = require('hbsfy/runtime'); -module.exports = HandlebarsCompiler.template({"1":function(container,depth0,helpers,partials,data) { - var stack1; - - return "
\n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},depth0,{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
\n"; -},"2":function(container,depth0,helpers,partials,data) { - var stack1; - - return "
\n" - + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.separator : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.program(5, data, 0),"data":data})) != null ? stack1 : "") - + "
\n"; -},"3":function(container,depth0,helpers,partials,data) { - return "
\n"; -},"5":function(container,depth0,helpers,partials,data) { - var stack1; - - return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.menu : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.program(11, data, 0),"data":data})) != null ? stack1 : ""); -},"6":function(container,depth0,helpers,partials,data) { - var stack1; - - return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.disable : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.program(9, data, 0),"data":data})) != null ? stack1 : ""); -},"7":function(container,depth0,helpers,partials,data) { - var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; - - return "
" - + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) - + "
\n"; -},"9":function(container,depth0,helpers,partials,data) { - var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; - - return "
" - + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) - + "
\n
\n" - + ((stack1 = container.invokePartial(partials.menuItem,(depth0 != null ? depth0.menu : depth0),{"name":"menuItem","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
\n"; -},"11":function(container,depth0,helpers,partials,data) { - var stack1; - - return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.disable : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.program(12, data, 0),"data":data})) != null ? stack1 : ""); -},"12":function(container,depth0,helpers,partials,data) { - var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; - - return "
" - + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) - + "
\n"; -},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { - var stack1; - - return "
\n" - + ((stack1 = container.invokePartial(partials.menuItem,depth0,{"name":"menuItem","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
\n"; -},"main_d": function(fn, props, container, depth0, data, blockParams, depths) { - - var decorators = container.decorators; - - fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.noop,"args":["menuItem"],"data":data}) || fn; - return fn; - } - -,"useDecorators":true,"usePartial":true,"useData":true,"useDepths":true}); - -},{"hbsfy/runtime":21}],23:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _core = require('./core'); - -var core = _interopRequireWildcard(_core); - -var _contextmenu = require('./contextmenu.hbs'); - -var _contextmenu2 = _interopRequireDefault(_contextmenu); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/** - * @fileoverview Context menu component - * @author NHN Ent. FE Development team - */ -var util = tui.util; - -var MODALESS = { modaless: true }; - -/** - * @typedef ContextMenu~MenuItem - * @property {string} title - title of menu item - * @property {string} [command] - string for alternative of using title to command - * @property {boolean} [separator=false] - set true then this menu will use - * separator - * @property {MenuItem[]} [menu] - you can define submenu recursivly - */ - -/** - * ContextMenu - */ - -var ContextMenu = function () { - /** - * Constructor - * @param {HTMLElement} container - container for placing context menu - * floating layers - * @param {object} options - options for context menu - * @param {number} [options.delay=100] - delay for displaying submenu - * @example - * var menu = new tui.component.ContextMenu(document.querySelector('#fl')); - */ - - function ContextMenu(container) { - var options = arguments.length <= 1 || arguments[1] === undefined ? { - delay: 130 - } : arguments[1]; - - _classCallCheck(this, ContextMenu); - - /** - * @type {object} - */ - this.options = Object.assign({}, options); - /** - * @type {HTMLElement} - */ - this.container = container; - - /** - * @type {Map} - */ - this.layerMap = new Map(); - - /** - * @type {FloatingLayer} - */ - this.activeLayer = null; - - /** - * @type {boolean} - */ - this.pageScrolled = false; - - /** - * @type {function} - */ - this.cloneMouseMoveEvent = null; - - dom.on(document, 'contextmenu', this._onContextMenu, this); - } - - /** - * Destructor - * @api - */ - - - ContextMenu.prototype.destroy = function destroy() { - dom.off(document, 'contextmenu', this._onContextMenu, this); - - this._hideContextMenu(); - - this.container = this.layerMap = this.activeLayer = this.pageScolled = this.cloneMouseMoveEvent = null; - }; - - /** - * Hide activated context menu and unbind related DOM events - * @private - */ - - - ContextMenu.prototype._hideContextMenu = function _hideContextMenu() { - var layer = this.activeLayer; - - if (!layer) { - return; - } - - dom.off(layer.container, 'mousemove', this.cloneMouseMoveEvent, this); - dom.off(document, 'mousedown', this._onMouseDown, this); - dom.off(document, 'click', this._onMouseClick, this); - dom.off(document, 'scroll', this._onPageScroll, this); - - layer.hide(); - - var hideElement = function hideElement(menu) { - dom.css(menu, { - display: 'none', - marginTop: '' - }); - }; - - dom.findAll(layer.container, '.js-menu-root').forEach(hideElement); - dom.findAll(layer.container, '.js-menu-submenu').forEach(hideElement); - - this.pageScrolled = false; - this.activeLayer = this.cloneMouseMoveEvent = null; - }; - - /** - * Mouse down event handler for close context menu - * @param {MouseEvent} mouseDownEvent - mouseDown event object - * @private - */ - - - ContextMenu.prototype._onMouseDown = function _onMouseDown(mouseDownEvent) { - var target = mouseDownEvent.target || mouseDownEvent.srcElement; - - if (!dom.closest(target, '.js-menu-root')) { - this._hideContextMenu(); - } - }; - - /** - * Mouse click event handler for invoking callback when click menu item - * @param {MouseEvent} clickEvent - click MouseEvent object - * @private - */ - - - ContextMenu.prototype._onMouseClick = function _onMouseClick(clickEvent) { - var target = clickEvent.target || clickEvent.srcElement; - var title = dom.textContent(target).trim(); - var command = dom.getData(target, 'command'); - var container = dom.closest(target, '.floating-layer'); - var isMenuButton = dom.hasClass(target, 'js-menu-button'); - var isSeparator = dom.hasClass(target, 'js-menu-separator'); - var hasSubmenu = dom.hasClass(target, 'js-menu-has-submenu'); - var isDisableButton = dom.hasClass(target, 'js-menu-disable'); - - if (isDisableButton) { - this._hideContextMenu(); - - return; - } - - if (!(container && isMenuButton)) { - return; - } - - if (isSeparator || hasSubmenu) { - return; - } - - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = this.layerMap.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var layer = _step.value; - - if (container === layer.container) { - layer.callback(clickEvent, command || title); - this._hideContextMenu(); - - return; - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator['return']) { - _iterator['return'](); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - }; - - /** - * Show menu element without veil browser viewport - * @param {HTMLElement} element - menu element - * @param {object} [strategy] - methods for handle situations that - * menu veil by browser viewports - * @param {object} [initialStyle] - initial style before - * calculating new bound - * @private - */ - - - ContextMenu.prototype._showWithoutOverflow = function _showWithoutOverflow(element) { - var strategy = arguments.length <= 1 || arguments[1] === undefined ? { rightOverflow: core.noop, bottomOverflow: core.noop } : arguments[1]; - var initialStyle = arguments.length <= 2 || arguments[2] === undefined ? { marginTop: '', marginLeft: '' } : arguments[2]; - - dom.css(element, 'visibility', 'hidden'); - dom.css(element, initialStyle); - dom.css(element, 'display', 'block'); - - var _dom$getRect = dom.getRect(element); - - var menuRight = _dom$getRect.right; - var menuBottom = _dom$getRect.bottom; - - - var menuDoc = (element.document || element.ownerDocument).documentElement; - var viewportWidth = menuDoc.clientWidth; - var viewportHeight = menuDoc.clientHeight; - - - var isRightOverflowed = menuRight > viewportWidth; - var isBottomOverflowed = menuBottom > viewportHeight; - - if (isRightOverflowed) { - strategy.rightOverflow(element, menuRight, viewportWidth); - } - - if (isBottomOverflowed) { - strategy.bottomOverflow(element, menuBottom, viewportHeight); - } - - dom.css(element, 'visibility', ''); - }; - - /** - * Show root menu element - * @param {number} left - left pixel position - * @param {number} top - top pixel position - * @private - */ - - - ContextMenu.prototype._showRootMenu = function _showRootMenu(left, top) { - var layer = this.activeLayer; - - if (!layer) { - return; - } - - var rootMenuElement = dom.find(layer.container, '.js-menu-root'); - - layer.setBound({ left: left, top: top }); - layer.show(); - - this._showWithoutOverflow(rootMenuElement, { - rightOverflow: function rightOverflow(el, right, viewportWidth) { - dom.css(el, 'marginLeft', viewportWidth - right + 'px'); - }, - bottomOverflow: function bottomOverflow(el, bottom, viewportHeight) { - dom.css(el, 'marginTop', viewportHeight - bottom + 'px'); - } - }); - }; - - /** - * Show sub menu element - * @param {HTMLElement} element - submenu root element - * @private - */ - - - ContextMenu.prototype._showSubMenu = function _showSubMenu(element) { - this._showWithoutOverflow(element, { - rightOverflow: function rightOverflow(el, right, viewportWidth) { - dom.css(el, 'marginLeft', viewportWidth - right + el.clientWidth + 'px'); - }, - bottomOverflow: function bottomOverflow(el, bottom, viewportHeight) { - dom.css(el, 'marginTop', viewportHeight - bottom + 'px'); - } - }, { - marginTop: '', - marginLeft: '100%' - }); - }; - - /** - * Refresh all submenu element - * - * Hide elements that no related with mouse event and show others - * @param {HTMLElement} layerOnCursor - layer element on cursor - * @private - */ - - - ContextMenu.prototype._refreshMenuDisplay = function _refreshMenuDisplay(layerOnCursor) { - var container = this.activeLayer.container; - var allSubmenus = dom.findAll(container, '.js-menu-submenu'); - var layersUntilRoot = []; - - while (layerOnCursor && container !== layerOnCursor) { - if (dom.hasClass(layerOnCursor, 'js-menu-submenu')) { - layersUntilRoot.push(layerOnCursor); - } - - layerOnCursor = layerOnCursor.parentNode; - } - - allSubmenus.forEach(function (menuElement) { - if (layersUntilRoot.indexOf(menuElement) < 0) { - dom.css(menuElement, 'display', 'none'); - } - }); - - layersUntilRoot.forEach(util.bind(this._showSubMenu, this)); - }; - - /** - * Mouse move event handler for reveal context menus - * @param {MouseEvent} mouseMoveEvent - mouse move event object - * @private - */ - - - ContextMenu.prototype._onMouseMove = function _onMouseMove(mouseMoveEvent) { - if (this.pageScrolled) { - this.pageScrolled = false; - - return; - } - - var target = mouseMoveEvent.target || mouseMoveEvent.srcElement; - var activeLayer = this.activeLayer; - - if (!(activeLayer && dom.closest(target, '.js-menu-root'))) { - return; - } - - var layerOnCursor = void 0; - - if (dom.hasClass(target, 'js-menu-has-submenu')) { - layerOnCursor = dom.find(target.parentNode, '.js-menu-submenu'); - } else { - layerOnCursor = dom.closest(target, '.js-menu-submenu'); - } - - this._refreshMenuDisplay(layerOnCursor); - }; - - /** - * Scroll handle for prevent break position after scrolling - * @private - */ - - - ContextMenu.prototype._onPageScroll = function _onPageScroll() { - this.pageScrolled = true; - }; - - /** - * Event handler - * @param {MouseEvent} clickEvent - mouse event object - * @private - */ - - - ContextMenu.prototype._onContextMenu = function _onContextMenu(clickEvent) { - var opt = this.options; - - var target = clickEvent.target || clickEvent.srcElement; - var relatedLayer = void 0; - - while (target.parentNode) { - var findElement = this.layerMap.get(target); - - if (findElement) { - relatedLayer = findElement; - break; - } - - target = target.parentNode; - } - - if (!relatedLayer) { - return; - } - - dom.preventDefault(clickEvent); - - this.activeLayer = relatedLayer; - - var position = dom.getMousePosition(clickEvent, document.body || document.documentElement); - - var left = position[0]; //clickEvent.clientX; - var top = position[1]; //clickEvent.clientY; - var debouncedMouseMove = util.debounce(util.bind(this._onMouseMove, this), opt.delay); - - this.cloneMouseMoveEvent = function (mouseMoveEvent) { - var virtualMouseEvent = { - target: mouseMoveEvent.target || mouseMoveEvent.srcElement - }; - - debouncedMouseMove(virtualMouseEvent); - }; - - this._showRootMenu(left, top); - - dom.on(relatedLayer.container, 'mousemove', this.cloneMouseMoveEvent, this); - dom.on(document, 'mousedown', this._onMouseDown, this); - dom.on(document, 'click', this._onMouseClick, this); - dom.on(document, 'scroll', this._onPageScroll, this); - }; - - /** - * Register context menu - * @param {string} selector - css selector for displaying contextmenu at - * secondary mouse button click - * @param {function} callback - callback for each menu item clicked - * @param {MenuItem[]} menuItems - menu item schema - * @api - */ - - - ContextMenu.prototype.register = function register(selector, callback, menuItems) { - var target = dom.find(selector); - - if (!target) { - return; - } - - var layer = new tui.component.FloatingLayer(this.container, MODALESS); - - layer.callback = callback; - layer.setBound({ width: 'auto', height: 'auto' }); - layer.setContent((0, _contextmenu2['default'])(menuItems)); - - this.layerMap.set(target, layer); - }; - - /** - * Unregister context menu - * @param {string} selector - css selector used for register context menu - * @returns {boolean} whether unregister is successful? - * @api - */ - - - ContextMenu.prototype.unregister = function unregister(selector) { - var layerMap = this.layerMap; - var target = dom.find(selector); - - if (!target) { - return false; - } - - var layer = layerMap.get(target); - - if (!layer) { - return false; - } - - layer.destroy(); - - layerMap['delete'](target); - - return true; - }; - - return ContextMenu; -}(); - -exports['default'] = ContextMenu; - -},{"./contextmenu.hbs":22,"./core":24}],24:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.noop = noop; -exports.uniq = uniq; -exports.reduce = reduce; -exports.remove = remove; - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -/** - * @fileoverview Core utility methods module - * @author NHN Ent. FE Development team - */ -var util = tui.util; - -/** - * A no-operation function that returns undefined regardless of the arguments - * it receives. - */ -function noop() {} - -/** - * Create a duplicate-free version of an array - * @param {Array} array - The array to inspect. - * @returns {Array} Returns the new duplicate free array. - */ -function uniq(array) { - return [].concat(_toConsumableArray(new Set(array))); -} - -/** - * @param {Collection} collection - The collection to iterate over. - * @param {function} [iteratee] - The function invoked per iteration. - * @param {*} accumulator - The initial value. - * @returns {*} Returns the accumulated value. - */ -function reduce(collection, iteratee, accumulator) { - if (util.isArray(collection)) { - if (accumulator) { - return collection.reduce(iteratee, accumulator); - } - - return collection.reduce(iteratee); - } - - util.forEach(collection, function (value, index) { - if (typeof accumulator === 'undefined') { - accumulator = value; - } else { - accumulator = iteratee(accumulator, value, index); - } - }); - - return accumulator; -} - -/** - * Removes all elements from array that predicate returns truthy for and - * returns an array of the removed elements. The predicate is invoked with - * three arguments: (value, index, array). - * @param {Array} array - The array to modify. - * @param {(Function|String|Number)} predicate - The function invoked per - * iteration. - * @returns {Array} Returns the new array of removed elements. - */ -function remove(array, predicate) { - var match = void 0; - - if (util.isFunction(predicate)) { - match = function match(v) { - return predicate(v); - }; - } else { - match = function match(v) { - return predicate === v; - }; - } - - var removed = []; - - for (var idx = 0, len = array.length; idx < len; idx += 1) { - var value = array[idx]; - if (match(value, idx, array)) { - removed.push(value); - array.splice(idx, 1); - len -= 1; - idx -= 1; - } - } - - return removed; -} - -},{}]},{},[1]); diff --git a/samples/js/domutil.js b/samples/js/domutil.js deleted file mode 100644 index 6e7b788..0000000 --- a/samples/js/domutil.js +++ /dev/null @@ -1,7607 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 2 ? arguments[2] : undefined - , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to) - , inc = 1; - if(from < to && to < from + count){ - inc = -1; - from += count - 1; - to += count - 1; - } - while(count-- > 0){ - if(from in O)O[to] = O[from]; - else delete O[to]; - to += inc; - from += inc; - } return O; -}; -},{"./_to-index":106,"./_to-length":109,"./_to-object":110}],10:[function(require,module,exports){ -// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) -'use strict'; -var toObject = require('./_to-object') - , toIndex = require('./_to-index') - , toLength = require('./_to-length'); -module.exports = function fill(value /*, start = 0, end = @length */){ - var O = toObject(this) - , length = toLength(O.length) - , aLen = arguments.length - , index = toIndex(aLen > 1 ? arguments[1] : undefined, length) - , end = aLen > 2 ? arguments[2] : undefined - , endPos = end === undefined ? length : toIndex(end, length); - while(endPos > index)O[index++] = value; - return O; -}; -},{"./_to-index":106,"./_to-length":109,"./_to-object":110}],11:[function(require,module,exports){ -var forOf = require('./_for-of'); - -module.exports = function(iter, ITERATOR){ - var result = []; - forOf(iter, false, result.push, result, ITERATOR); - return result; -}; - -},{"./_for-of":38}],12:[function(require,module,exports){ -// false -> Array#indexOf -// true -> Array#includes -var toIObject = require('./_to-iobject') - , toLength = require('./_to-length') - , toIndex = require('./_to-index'); -module.exports = function(IS_INCLUDES){ - return function($this, el, fromIndex){ - var O = toIObject($this) - , length = toLength(O.length) - , index = toIndex(fromIndex, length) - , value; - // Array#includes uses SameValueZero equality algorithm - if(IS_INCLUDES && el != el)while(length > index){ - value = O[index++]; - if(value != value)return true; - // Array#toIndex ignores holes, Array#includes - not - } else for(;length > index; index++)if(IS_INCLUDES || index in O){ - if(O[index] === el)return IS_INCLUDES || index || 0; - } return !IS_INCLUDES && -1; - }; -}; -},{"./_to-index":106,"./_to-iobject":108,"./_to-length":109}],13:[function(require,module,exports){ -// 0 -> Array#forEach -// 1 -> Array#map -// 2 -> Array#filter -// 3 -> Array#some -// 4 -> Array#every -// 5 -> Array#find -// 6 -> Array#findIndex -var ctx = require('./_ctx') - , IObject = require('./_iobject') - , toObject = require('./_to-object') - , toLength = require('./_to-length') - , asc = require('./_array-species-create'); -module.exports = function(TYPE, $create){ - var IS_MAP = TYPE == 1 - , IS_FILTER = TYPE == 2 - , IS_SOME = TYPE == 3 - , IS_EVERY = TYPE == 4 - , IS_FIND_INDEX = TYPE == 6 - , NO_HOLES = TYPE == 5 || IS_FIND_INDEX - , create = $create || asc; - return function($this, callbackfn, that){ - var O = toObject($this) - , self = IObject(O) - , f = ctx(callbackfn, that, 3) - , length = toLength(self.length) - , index = 0 - , result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined - , val, res; - for(;length > index; index++)if(NO_HOLES || index in self){ - val = self[index]; - res = f(val, index, O); - if(TYPE){ - if(IS_MAP)result[index] = res; // map - else if(res)switch(TYPE){ - case 3: return true; // some - case 5: return val; // find - case 6: return index; // findIndex - case 2: result.push(val); // filter - } else if(IS_EVERY)return false; // every - } - } - return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; - }; -}; -},{"./_array-species-create":16,"./_ctx":26,"./_iobject":46,"./_to-length":109,"./_to-object":110}],14:[function(require,module,exports){ -var aFunction = require('./_a-function') - , toObject = require('./_to-object') - , IObject = require('./_iobject') - , toLength = require('./_to-length'); - -module.exports = function(that, callbackfn, aLen, memo, isRight){ - aFunction(callbackfn); - var O = toObject(that) - , self = IObject(O) - , length = toLength(O.length) - , index = isRight ? length - 1 : 0 - , i = isRight ? -1 : 1; - if(aLen < 2)for(;;){ - if(index in self){ - memo = self[index]; - index += i; - break; - } - index += i; - if(isRight ? index < 0 : length <= index){ - throw TypeError('Reduce of empty array with no initial value'); - } - } - for(;isRight ? index >= 0 : length > index; index += i)if(index in self){ - memo = callbackfn(memo, self[index], index, O); - } - return memo; -}; -},{"./_a-function":4,"./_iobject":46,"./_to-length":109,"./_to-object":110}],15:[function(require,module,exports){ -var isObject = require('./_is-object') - , isArray = require('./_is-array') - , SPECIES = require('./_wks')('species'); - -module.exports = function(original){ - var C; - if(isArray(original)){ - C = original.constructor; - // cross-realm fallback - if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined; - if(isObject(C)){ - C = C[SPECIES]; - if(C === null)C = undefined; - } - } return C === undefined ? Array : C; -}; -},{"./_is-array":48,"./_is-object":50,"./_wks":118}],16:[function(require,module,exports){ -// 9.4.2.3 ArraySpeciesCreate(originalArray, length) -var speciesConstructor = require('./_array-species-constructor'); - -module.exports = function(original, length){ - return new (speciesConstructor(original))(length); -}; -},{"./_array-species-constructor":15}],17:[function(require,module,exports){ -'use strict'; -var aFunction = require('./_a-function') - , isObject = require('./_is-object') - , invoke = require('./_invoke') - , arraySlice = [].slice - , factories = {}; - -var construct = function(F, len, args){ - if(!(len in factories)){ - for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']'; - factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); - } return factories[len](F, args); -}; - -module.exports = Function.bind || function bind(that /*, args... */){ - var fn = aFunction(this) - , partArgs = arraySlice.call(arguments, 1); - var bound = function(/* args... */){ - var args = partArgs.concat(arraySlice.call(arguments)); - return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that); - }; - if(isObject(fn.prototype))bound.prototype = fn.prototype; - return bound; -}; -},{"./_a-function":4,"./_invoke":45,"./_is-object":50}],18:[function(require,module,exports){ -// getting tag from 19.1.3.6 Object.prototype.toString() -var cof = require('./_cof') - , TAG = require('./_wks')('toStringTag') - // ES3 wrong here - , ARG = cof(function(){ return arguments; }()) == 'Arguments'; - -// fallback for IE11 Script Access Denied error -var tryGet = function(it, key){ - try { - return it[key]; - } catch(e){ /* empty */ } -}; - -module.exports = function(it){ - var O, T, B; - return it === undefined ? 'Undefined' : it === null ? 'Null' - // @@toStringTag case - : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T - // builtinTag case - : ARG ? cof(O) - // ES3 arguments fallback - : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; -}; -},{"./_cof":19,"./_wks":118}],19:[function(require,module,exports){ -var toString = {}.toString; - -module.exports = function(it){ - return toString.call(it).slice(8, -1); -}; -},{}],20:[function(require,module,exports){ -'use strict'; -var dP = require('./_object-dp').f - , create = require('./_object-create') - , hide = require('./_hide') - , redefineAll = require('./_redefine-all') - , ctx = require('./_ctx') - , anInstance = require('./_an-instance') - , defined = require('./_defined') - , forOf = require('./_for-of') - , $iterDefine = require('./_iter-define') - , step = require('./_iter-step') - , setSpecies = require('./_set-species') - , DESCRIPTORS = require('./_descriptors') - , fastKey = require('./_meta').fastKey - , SIZE = DESCRIPTORS ? '_s' : 'size'; - -var getEntry = function(that, key){ - // fast case - var index = fastKey(key), entry; - if(index !== 'F')return that._i[index]; - // frozen object case - for(entry = that._f; entry; entry = entry.n){ - if(entry.k == key)return entry; - } -}; - -module.exports = { - getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ - var C = wrapper(function(that, iterable){ - anInstance(that, C, NAME, '_i'); - that._i = create(null); // index - that._f = undefined; // first entry - that._l = undefined; // last entry - that[SIZE] = 0; // size - if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); - }); - redefineAll(C.prototype, { - // 23.1.3.1 Map.prototype.clear() - // 23.2.3.2 Set.prototype.clear() - clear: function clear(){ - for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){ - entry.r = true; - if(entry.p)entry.p = entry.p.n = undefined; - delete data[entry.i]; - } - that._f = that._l = undefined; - that[SIZE] = 0; - }, - // 23.1.3.3 Map.prototype.delete(key) - // 23.2.3.4 Set.prototype.delete(value) - 'delete': function(key){ - var that = this - , entry = getEntry(that, key); - if(entry){ - var next = entry.n - , prev = entry.p; - delete that._i[entry.i]; - entry.r = true; - if(prev)prev.n = next; - if(next)next.p = prev; - if(that._f == entry)that._f = next; - if(that._l == entry)that._l = prev; - that[SIZE]--; - } return !!entry; - }, - // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) - // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) - forEach: function forEach(callbackfn /*, that = undefined */){ - anInstance(this, C, 'forEach'); - var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3) - , entry; - while(entry = entry ? entry.n : this._f){ - f(entry.v, entry.k, this); - // revert to the last existing entry - while(entry && entry.r)entry = entry.p; - } - }, - // 23.1.3.7 Map.prototype.has(key) - // 23.2.3.7 Set.prototype.has(value) - has: function has(key){ - return !!getEntry(this, key); - } - }); - if(DESCRIPTORS)dP(C.prototype, 'size', { - get: function(){ - return defined(this[SIZE]); - } - }); - return C; - }, - def: function(that, key, value){ - var entry = getEntry(that, key) - , prev, index; - // change existing entry - if(entry){ - entry.v = value; - // create new entry - } else { - that._l = entry = { - i: index = fastKey(key, true), // <- index - k: key, // <- key - v: value, // <- value - p: prev = that._l, // <- previous entry - n: undefined, // <- next entry - r: false // <- removed - }; - if(!that._f)that._f = entry; - if(prev)prev.n = entry; - that[SIZE]++; - // add to index - if(index !== 'F')that._i[index] = entry; - } return that; - }, - getEntry: getEntry, - setStrong: function(C, NAME, IS_MAP){ - // add .keys, .values, .entries, [@@iterator] - // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 - $iterDefine(C, NAME, function(iterated, kind){ - this._t = iterated; // target - this._k = kind; // kind - this._l = undefined; // previous - }, function(){ - var that = this - , kind = that._k - , entry = that._l; - // revert to the last existing entry - while(entry && entry.r)entry = entry.p; - // get next entry - if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){ - // or finish the iteration - that._t = undefined; - return step(1); - } - // return step by kind - if(kind == 'keys' )return step(0, entry.k); - if(kind == 'values')return step(0, entry.v); - return step(0, [entry.k, entry.v]); - }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true); - - // add [@@species], 23.1.2.2, 23.2.2.2 - setSpecies(NAME); - } -}; -},{"./_an-instance":7,"./_ctx":26,"./_defined":28,"./_descriptors":29,"./_for-of":38,"./_hide":41,"./_iter-define":54,"./_iter-step":56,"./_meta":63,"./_object-create":67,"./_object-dp":68,"./_redefine-all":87,"./_set-species":92}],21:[function(require,module,exports){ -// https://github.com/DavidBruant/Map-Set.prototype.toJSON -var classof = require('./_classof') - , from = require('./_array-from-iterable'); -module.exports = function(NAME){ - return function toJSON(){ - if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic"); - return from(this); - }; -}; -},{"./_array-from-iterable":11,"./_classof":18}],22:[function(require,module,exports){ -'use strict'; -var redefineAll = require('./_redefine-all') - , getWeak = require('./_meta').getWeak - , anObject = require('./_an-object') - , isObject = require('./_is-object') - , anInstance = require('./_an-instance') - , forOf = require('./_for-of') - , createArrayMethod = require('./_array-methods') - , $has = require('./_has') - , arrayFind = createArrayMethod(5) - , arrayFindIndex = createArrayMethod(6) - , id = 0; - -// fallback for uncaught frozen keys -var uncaughtFrozenStore = function(that){ - return that._l || (that._l = new UncaughtFrozenStore); -}; -var UncaughtFrozenStore = function(){ - this.a = []; -}; -var findUncaughtFrozen = function(store, key){ - return arrayFind(store.a, function(it){ - return it[0] === key; - }); -}; -UncaughtFrozenStore.prototype = { - get: function(key){ - var entry = findUncaughtFrozen(this, key); - if(entry)return entry[1]; - }, - has: function(key){ - return !!findUncaughtFrozen(this, key); - }, - set: function(key, value){ - var entry = findUncaughtFrozen(this, key); - if(entry)entry[1] = value; - else this.a.push([key, value]); - }, - 'delete': function(key){ - var index = arrayFindIndex(this.a, function(it){ - return it[0] === key; - }); - if(~index)this.a.splice(index, 1); - return !!~index; - } -}; - -module.exports = { - getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ - var C = wrapper(function(that, iterable){ - anInstance(that, C, NAME, '_i'); - that._i = id++; // collection id - that._l = undefined; // leak store for uncaught frozen objects - if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); - }); - redefineAll(C.prototype, { - // 23.3.3.2 WeakMap.prototype.delete(key) - // 23.4.3.3 WeakSet.prototype.delete(value) - 'delete': function(key){ - if(!isObject(key))return false; - var data = getWeak(key); - if(data === true)return uncaughtFrozenStore(this)['delete'](key); - return data && $has(data, this._i) && delete data[this._i]; - }, - // 23.3.3.4 WeakMap.prototype.has(key) - // 23.4.3.4 WeakSet.prototype.has(value) - has: function has(key){ - if(!isObject(key))return false; - var data = getWeak(key); - if(data === true)return uncaughtFrozenStore(this).has(key); - return data && $has(data, this._i); - } - }); - return C; - }, - def: function(that, key, value){ - var data = getWeak(anObject(key), true); - if(data === true)uncaughtFrozenStore(that).set(key, value); - else data[that._i] = value; - return that; - }, - ufstore: uncaughtFrozenStore -}; -},{"./_an-instance":7,"./_an-object":8,"./_array-methods":13,"./_for-of":38,"./_has":40,"./_is-object":50,"./_meta":63,"./_redefine-all":87}],23:[function(require,module,exports){ -'use strict'; -var global = require('./_global') - , $export = require('./_export') - , redefine = require('./_redefine') - , redefineAll = require('./_redefine-all') - , meta = require('./_meta') - , forOf = require('./_for-of') - , anInstance = require('./_an-instance') - , isObject = require('./_is-object') - , fails = require('./_fails') - , $iterDetect = require('./_iter-detect') - , setToStringTag = require('./_set-to-string-tag') - , inheritIfRequired = require('./_inherit-if-required'); - -module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){ - var Base = global[NAME] - , C = Base - , ADDER = IS_MAP ? 'set' : 'add' - , proto = C && C.prototype - , O = {}; - var fixMethod = function(KEY){ - var fn = proto[KEY]; - redefine(proto, KEY, - KEY == 'delete' ? function(a){ - return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'has' ? function has(a){ - return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'get' ? function get(a){ - return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; } - : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; } - ); - }; - if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){ - new C().entries().next(); - }))){ - // create collection constructor - C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); - redefineAll(C.prototype, methods); - meta.NEED = true; - } else { - var instance = new C - // early implementations not supports chaining - , HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance - // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false - , THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); }) - // most early implementations doesn't supports iterables, most modern - not close it correctly - , ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new - // for early implementations -0 and +0 not the same - , BUGGY_ZERO = !IS_WEAK && fails(function(){ - // V8 ~ Chromium 42- fails only with 5+ elements - var $instance = new C() - , index = 5; - while(index--)$instance[ADDER](index, index); - return !$instance.has(-0); - }); - if(!ACCEPT_ITERABLES){ - C = wrapper(function(target, iterable){ - anInstance(target, C, NAME); - var that = inheritIfRequired(new Base, target, C); - if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); - return that; - }); - C.prototype = proto; - proto.constructor = C; - } - if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){ - fixMethod('delete'); - fixMethod('has'); - IS_MAP && fixMethod('get'); - } - if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER); - // weak collections should not contains .clear method - if(IS_WEAK && proto.clear)delete proto.clear; - } - - setToStringTag(C, NAME); - - O[NAME] = C; - $export($export.G + $export.W + $export.F * (C != Base), O); - - if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP); - - return C; -}; -},{"./_an-instance":7,"./_export":33,"./_fails":35,"./_for-of":38,"./_global":39,"./_inherit-if-required":44,"./_is-object":50,"./_iter-detect":55,"./_meta":63,"./_redefine":88,"./_redefine-all":87,"./_set-to-string-tag":93}],24:[function(require,module,exports){ -var core = module.exports = {version: '2.3.0'}; -if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef -},{}],25:[function(require,module,exports){ -'use strict'; -var $defineProperty = require('./_object-dp') - , createDesc = require('./_property-desc'); - -module.exports = function(object, index, value){ - if(index in object)$defineProperty.f(object, index, createDesc(0, value)); - else object[index] = value; -}; -},{"./_object-dp":68,"./_property-desc":86}],26:[function(require,module,exports){ -// optional / simple context binding -var aFunction = require('./_a-function'); -module.exports = function(fn, that, length){ - aFunction(fn); - if(that === undefined)return fn; - switch(length){ - case 1: return function(a){ - return fn.call(that, a); - }; - case 2: return function(a, b){ - return fn.call(that, a, b); - }; - case 3: return function(a, b, c){ - return fn.call(that, a, b, c); - }; - } - return function(/* ...args */){ - return fn.apply(that, arguments); - }; -}; -},{"./_a-function":4}],27:[function(require,module,exports){ -'use strict'; -var anObject = require('./_an-object') - , toPrimitive = require('./_to-primitive') - , NUMBER = 'number'; - -module.exports = function(hint){ - if(hint !== 'string' && hint !== NUMBER && hint !== 'default')throw TypeError('Incorrect hint'); - return toPrimitive(anObject(this), hint != NUMBER); -}; -},{"./_an-object":8,"./_to-primitive":111}],28:[function(require,module,exports){ -// 7.2.1 RequireObjectCoercible(argument) -module.exports = function(it){ - if(it == undefined)throw TypeError("Can't call method on " + it); - return it; -}; -},{}],29:[function(require,module,exports){ -// Thank's IE8 for his funny defineProperty -module.exports = !require('./_fails')(function(){ - return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; -}); -},{"./_fails":35}],30:[function(require,module,exports){ -var isObject = require('./_is-object') - , document = require('./_global').document - // in old IE typeof document.createElement is 'object' - , is = isObject(document) && isObject(document.createElement); -module.exports = function(it){ - return is ? document.createElement(it) : {}; -}; -},{"./_global":39,"./_is-object":50}],31:[function(require,module,exports){ -// IE 8- don't enum bug keys -module.exports = ( - 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' -).split(','); -},{}],32:[function(require,module,exports){ -// all enumerable object keys, includes symbols -var getKeys = require('./_object-keys') - , gOPS = require('./_object-gops') - , pIE = require('./_object-pie'); -module.exports = function(it){ - var result = getKeys(it) - , getSymbols = gOPS.f; - if(getSymbols){ - var symbols = getSymbols(it) - , isEnum = pIE.f - , i = 0 - , key; - while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key); - } return result; -}; -},{"./_object-gops":74,"./_object-keys":77,"./_object-pie":78}],33:[function(require,module,exports){ -var global = require('./_global') - , core = require('./_core') - , hide = require('./_hide') - , redefine = require('./_redefine') - , ctx = require('./_ctx') - , PROTOTYPE = 'prototype'; - -var $export = function(type, name, source){ - var IS_FORCED = type & $export.F - , IS_GLOBAL = type & $export.G - , IS_STATIC = type & $export.S - , IS_PROTO = type & $export.P - , IS_BIND = type & $export.B - , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE] - , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) - , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}) - , key, own, out, exp; - if(IS_GLOBAL)source = name; - for(key in source){ - // contains in native - own = !IS_FORCED && target && target[key] !== undefined; - // export native or passed - out = (own ? target : source)[key]; - // bind timers to global for call from export context - exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - // extend global - if(target)redefine(target, key, out, type & $export.U); - // export - if(exports[key] != out)hide(exports, key, exp); - if(IS_PROTO && expProto[key] != out)expProto[key] = out; - } -}; -global.core = core; -// type bitmap -$export.F = 1; // forced -$export.G = 2; // global -$export.S = 4; // static -$export.P = 8; // proto -$export.B = 16; // bind -$export.W = 32; // wrap -$export.U = 64; // safe -$export.R = 128; // real proto method for `library` -module.exports = $export; -},{"./_core":24,"./_ctx":26,"./_global":39,"./_hide":41,"./_redefine":88}],34:[function(require,module,exports){ -var MATCH = require('./_wks')('match'); -module.exports = function(KEY){ - var re = /./; - try { - '/./'[KEY](re); - } catch(e){ - try { - re[MATCH] = false; - return !'/./'[KEY](re); - } catch(f){ /* empty */ } - } return true; -}; -},{"./_wks":118}],35:[function(require,module,exports){ -module.exports = function(exec){ - try { - return !!exec(); - } catch(e){ - return true; - } -}; -},{}],36:[function(require,module,exports){ -'use strict'; -var hide = require('./_hide') - , redefine = require('./_redefine') - , fails = require('./_fails') - , defined = require('./_defined') - , wks = require('./_wks'); - -module.exports = function(KEY, length, exec){ - var SYMBOL = wks(KEY) - , fns = exec(defined, SYMBOL, ''[KEY]) - , strfn = fns[0] - , rxfn = fns[1]; - if(fails(function(){ - var O = {}; - O[SYMBOL] = function(){ return 7; }; - return ''[KEY](O) != 7; - })){ - redefine(String.prototype, KEY, strfn); - hide(RegExp.prototype, SYMBOL, length == 2 - // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) - // 21.2.5.11 RegExp.prototype[@@split](string, limit) - ? function(string, arg){ return rxfn.call(string, this, arg); } - // 21.2.5.6 RegExp.prototype[@@match](string) - // 21.2.5.9 RegExp.prototype[@@search](string) - : function(string){ return rxfn.call(string, this); } - ); - } -}; -},{"./_defined":28,"./_fails":35,"./_hide":41,"./_redefine":88,"./_wks":118}],37:[function(require,module,exports){ -'use strict'; -// 21.2.5.3 get RegExp.prototype.flags -var anObject = require('./_an-object'); -module.exports = function(){ - var that = anObject(this) - , result = ''; - if(that.global) result += 'g'; - if(that.ignoreCase) result += 'i'; - if(that.multiline) result += 'm'; - if(that.unicode) result += 'u'; - if(that.sticky) result += 'y'; - return result; -}; -},{"./_an-object":8}],38:[function(require,module,exports){ -var ctx = require('./_ctx') - , call = require('./_iter-call') - , isArrayIter = require('./_is-array-iter') - , anObject = require('./_an-object') - , toLength = require('./_to-length') - , getIterFn = require('./core.get-iterator-method'); -module.exports = function(iterable, entries, fn, that, ITERATOR){ - var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable) - , f = ctx(fn, that, entries ? 2 : 1) - , index = 0 - , length, step, iterator; - if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!'); - // fast case for arrays with default iterator - if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){ - entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); - } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){ - call(iterator, f, step.value, entries); - } -}; -},{"./_an-object":8,"./_ctx":26,"./_is-array-iter":47,"./_iter-call":52,"./_to-length":109,"./core.get-iterator-method":119}],39:[function(require,module,exports){ -// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 -var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); -if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef -},{}],40:[function(require,module,exports){ -var hasOwnProperty = {}.hasOwnProperty; -module.exports = function(it, key){ - return hasOwnProperty.call(it, key); -}; -},{}],41:[function(require,module,exports){ -var dP = require('./_object-dp') - , createDesc = require('./_property-desc'); -module.exports = require('./_descriptors') ? function(object, key, value){ - return dP.f(object, key, createDesc(1, value)); -} : function(object, key, value){ - object[key] = value; - return object; -}; -},{"./_descriptors":29,"./_object-dp":68,"./_property-desc":86}],42:[function(require,module,exports){ -module.exports = require('./_global').document && document.documentElement; -},{"./_global":39}],43:[function(require,module,exports){ -module.exports = !require('./_descriptors') && !require('./_fails')(function(){ - return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7; -}); -},{"./_descriptors":29,"./_dom-create":30,"./_fails":35}],44:[function(require,module,exports){ -var isObject = require('./_is-object') - , setPrototypeOf = require('./_set-proto').set; -module.exports = function(that, target, C){ - var P, S = target.constructor; - if(S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf){ - setPrototypeOf(that, P); - } return that; -}; -},{"./_is-object":50,"./_set-proto":91}],45:[function(require,module,exports){ -// fast apply, http://jsperf.lnkit.com/fast-apply/5 -module.exports = function(fn, args, that){ - var un = that === undefined; - switch(args.length){ - case 0: return un ? fn() - : fn.call(that); - case 1: return un ? fn(args[0]) - : fn.call(that, args[0]); - case 2: return un ? fn(args[0], args[1]) - : fn.call(that, args[0], args[1]); - case 3: return un ? fn(args[0], args[1], args[2]) - : fn.call(that, args[0], args[1], args[2]); - case 4: return un ? fn(args[0], args[1], args[2], args[3]) - : fn.call(that, args[0], args[1], args[2], args[3]); - } return fn.apply(that, args); -}; -},{}],46:[function(require,module,exports){ -// fallback for non-array-like ES3 and non-enumerable old V8 strings -var cof = require('./_cof'); -module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ - return cof(it) == 'String' ? it.split('') : Object(it); -}; -},{"./_cof":19}],47:[function(require,module,exports){ -// check on default Array iterator -var Iterators = require('./_iterators') - , ITERATOR = require('./_wks')('iterator') - , ArrayProto = Array.prototype; - -module.exports = function(it){ - return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); -}; -},{"./_iterators":57,"./_wks":118}],48:[function(require,module,exports){ -// 7.2.2 IsArray(argument) -var cof = require('./_cof'); -module.exports = Array.isArray || function isArray(arg){ - return cof(arg) == 'Array'; -}; -},{"./_cof":19}],49:[function(require,module,exports){ -// 20.1.2.3 Number.isInteger(number) -var isObject = require('./_is-object') - , floor = Math.floor; -module.exports = function isInteger(it){ - return !isObject(it) && isFinite(it) && floor(it) === it; -}; -},{"./_is-object":50}],50:[function(require,module,exports){ -module.exports = function(it){ - return typeof it === 'object' ? it !== null : typeof it === 'function'; -}; -},{}],51:[function(require,module,exports){ -// 7.2.8 IsRegExp(argument) -var isObject = require('./_is-object') - , cof = require('./_cof') - , MATCH = require('./_wks')('match'); -module.exports = function(it){ - var isRegExp; - return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); -}; -},{"./_cof":19,"./_is-object":50,"./_wks":118}],52:[function(require,module,exports){ -// call something on iterator step with safe closing on error -var anObject = require('./_an-object'); -module.exports = function(iterator, fn, value, entries){ - try { - return entries ? fn(anObject(value)[0], value[1]) : fn(value); - // 7.4.6 IteratorClose(iterator, completion) - } catch(e){ - var ret = iterator['return']; - if(ret !== undefined)anObject(ret.call(iterator)); - throw e; - } -}; -},{"./_an-object":8}],53:[function(require,module,exports){ -'use strict'; -var create = require('./_object-create') - , descriptor = require('./_property-desc') - , setToStringTag = require('./_set-to-string-tag') - , IteratorPrototype = {}; - -// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() -require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function(){ return this; }); - -module.exports = function(Constructor, NAME, next){ - Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); - setToStringTag(Constructor, NAME + ' Iterator'); -}; -},{"./_hide":41,"./_object-create":67,"./_property-desc":86,"./_set-to-string-tag":93,"./_wks":118}],54:[function(require,module,exports){ -'use strict'; -var LIBRARY = require('./_library') - , $export = require('./_export') - , redefine = require('./_redefine') - , hide = require('./_hide') - , has = require('./_has') - , Iterators = require('./_iterators') - , $iterCreate = require('./_iter-create') - , setToStringTag = require('./_set-to-string-tag') - , getPrototypeOf = require('./_object-gpo') - , ITERATOR = require('./_wks')('iterator') - , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` - , FF_ITERATOR = '@@iterator' - , KEYS = 'keys' - , VALUES = 'values'; - -var returnThis = function(){ return this; }; - -module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ - $iterCreate(Constructor, NAME, next); - var getMethod = function(kind){ - if(!BUGGY && kind in proto)return proto[kind]; - switch(kind){ - case KEYS: return function keys(){ return new Constructor(this, kind); }; - case VALUES: return function values(){ return new Constructor(this, kind); }; - } return function entries(){ return new Constructor(this, kind); }; - }; - var TAG = NAME + ' Iterator' - , DEF_VALUES = DEFAULT == VALUES - , VALUES_BUG = false - , proto = Base.prototype - , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] - , $default = $native || getMethod(DEFAULT) - , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined - , $anyNative = NAME == 'Array' ? proto.entries || $native : $native - , methods, key, IteratorPrototype; - // Fix native - if($anyNative){ - IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); - if(IteratorPrototype !== Object.prototype){ - // Set @@toStringTag to native iterators - setToStringTag(IteratorPrototype, TAG, true); - // fix for some old engines - if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); - } - } - // fix Array#{values, @@iterator}.name in V8 / FF - if(DEF_VALUES && $native && $native.name !== VALUES){ - VALUES_BUG = true; - $default = function values(){ return $native.call(this); }; - } - // Define iterator - if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ - hide(proto, ITERATOR, $default); - } - // Plug for library - Iterators[NAME] = $default; - Iterators[TAG] = returnThis; - if(DEFAULT){ - methods = { - values: DEF_VALUES ? $default : getMethod(VALUES), - keys: IS_SET ? $default : getMethod(KEYS), - entries: $entries - }; - if(FORCED)for(key in methods){ - if(!(key in proto))redefine(proto, key, methods[key]); - } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); - } - return methods; -}; -},{"./_export":33,"./_has":40,"./_hide":41,"./_iter-create":53,"./_iterators":57,"./_library":59,"./_object-gpo":75,"./_redefine":88,"./_set-to-string-tag":93,"./_wks":118}],55:[function(require,module,exports){ -var ITERATOR = require('./_wks')('iterator') - , SAFE_CLOSING = false; - -try { - var riter = [7][ITERATOR](); - riter['return'] = function(){ SAFE_CLOSING = true; }; - Array.from(riter, function(){ throw 2; }); -} catch(e){ /* empty */ } - -module.exports = function(exec, skipClosing){ - if(!skipClosing && !SAFE_CLOSING)return false; - var safe = false; - try { - var arr = [7] - , iter = arr[ITERATOR](); - iter.next = function(){ return {done: safe = true}; }; - arr[ITERATOR] = function(){ return iter; }; - exec(arr); - } catch(e){ /* empty */ } - return safe; -}; -},{"./_wks":118}],56:[function(require,module,exports){ -module.exports = function(done, value){ - return {value: value, done: !!done}; -}; -},{}],57:[function(require,module,exports){ -module.exports = {}; -},{}],58:[function(require,module,exports){ -var getKeys = require('./_object-keys') - , toIObject = require('./_to-iobject'); -module.exports = function(object, el){ - var O = toIObject(object) - , keys = getKeys(O) - , length = keys.length - , index = 0 - , key; - while(length > index)if(O[key = keys[index++]] === el)return key; -}; -},{"./_object-keys":77,"./_to-iobject":108}],59:[function(require,module,exports){ -module.exports = false; -},{}],60:[function(require,module,exports){ -// 20.2.2.14 Math.expm1(x) -var $expm1 = Math.expm1; -module.exports = (!$expm1 - // Old FF bug - || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168 - // Tor Browser bug - || $expm1(-2e-17) != -2e-17 -) ? function expm1(x){ - return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; -} : $expm1; -},{}],61:[function(require,module,exports){ -// 20.2.2.20 Math.log1p(x) -module.exports = Math.log1p || function log1p(x){ - return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); -}; -},{}],62:[function(require,module,exports){ -// 20.2.2.28 Math.sign(x) -module.exports = Math.sign || function sign(x){ - return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; -}; -},{}],63:[function(require,module,exports){ -var META = require('./_uid')('meta') - , isObject = require('./_is-object') - , has = require('./_has') - , setDesc = require('./_object-dp').f - , id = 0; -var isExtensible = Object.isExtensible || function(){ - return true; -}; -var FREEZE = !require('./_fails')(function(){ - return isExtensible(Object.preventExtensions({})); -}); -var setMeta = function(it){ - setDesc(it, META, {value: { - i: 'O' + ++id, // object ID - w: {} // weak collections IDs - }}); -}; -var fastKey = function(it, create){ - // return primitive with prefix - if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if(!has(it, META)){ - // can't set metadata to uncaught frozen object - if(!isExtensible(it))return 'F'; - // not necessary to add metadata - if(!create)return 'E'; - // add missing metadata - setMeta(it); - // return object ID - } return it[META].i; -}; -var getWeak = function(it, create){ - if(!has(it, META)){ - // can't set metadata to uncaught frozen object - if(!isExtensible(it))return true; - // not necessary to add metadata - if(!create)return false; - // add missing metadata - setMeta(it); - // return hash weak collections IDs - } return it[META].w; -}; -// add metadata on freeze-family methods calling -var onFreeze = function(it){ - if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it); - return it; -}; -var meta = module.exports = { - KEY: META, - NEED: false, - fastKey: fastKey, - getWeak: getWeak, - onFreeze: onFreeze -}; -},{"./_fails":35,"./_has":40,"./_is-object":50,"./_object-dp":68,"./_uid":115}],64:[function(require,module,exports){ -var Map = require('./es6.map') - , $export = require('./_export') - , shared = require('./_shared')('metadata') - , store = shared.store || (shared.store = new (require('./es6.weak-map'))); - -var getOrCreateMetadataMap = function(target, targetKey, create){ - var targetMetadata = store.get(target); - if(!targetMetadata){ - if(!create)return undefined; - store.set(target, targetMetadata = new Map); - } - var keyMetadata = targetMetadata.get(targetKey); - if(!keyMetadata){ - if(!create)return undefined; - targetMetadata.set(targetKey, keyMetadata = new Map); - } return keyMetadata; -}; -var ordinaryHasOwnMetadata = function(MetadataKey, O, P){ - var metadataMap = getOrCreateMetadataMap(O, P, false); - return metadataMap === undefined ? false : metadataMap.has(MetadataKey); -}; -var ordinaryGetOwnMetadata = function(MetadataKey, O, P){ - var metadataMap = getOrCreateMetadataMap(O, P, false); - return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); -}; -var ordinaryDefineOwnMetadata = function(MetadataKey, MetadataValue, O, P){ - getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); -}; -var ordinaryOwnMetadataKeys = function(target, targetKey){ - var metadataMap = getOrCreateMetadataMap(target, targetKey, false) - , keys = []; - if(metadataMap)metadataMap.forEach(function(_, key){ keys.push(key); }); - return keys; -}; -var toMetaKey = function(it){ - return it === undefined || typeof it == 'symbol' ? it : String(it); -}; -var exp = function(O){ - $export($export.S, 'Reflect', O); -}; - -module.exports = { - store: store, - map: getOrCreateMetadataMap, - has: ordinaryHasOwnMetadata, - get: ordinaryGetOwnMetadata, - set: ordinaryDefineOwnMetadata, - keys: ordinaryOwnMetadataKeys, - key: toMetaKey, - exp: exp -}; -},{"./_export":33,"./_shared":95,"./es6.map":151,"./es6.weak-map":257}],65:[function(require,module,exports){ -var global = require('./_global') - , macrotask = require('./_task').set - , Observer = global.MutationObserver || global.WebKitMutationObserver - , process = global.process - , Promise = global.Promise - , isNode = require('./_cof')(process) == 'process'; - -module.exports = function(){ - var head, last, notify; - - var flush = function(){ - var parent, fn; - if(isNode && (parent = process.domain))parent.exit(); - while(head){ - fn = head.fn; - head = head.next; - try { - fn(); - } catch(e){ - if(head)notify(); - else last = undefined; - throw e; - } - } last = undefined; - if(parent)parent.enter(); - }; - - // Node.js - if(isNode){ - notify = function(){ - process.nextTick(flush); - }; - // browsers with MutationObserver - } else if(Observer){ - var toggle = true - , node = document.createTextNode(''); - new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new - notify = function(){ - node.data = toggle = !toggle; - }; - // environments with maybe non-completely correct, but existent Promise - } else if(Promise && Promise.resolve){ - var promise = Promise.resolve(); - notify = function(){ - promise.then(flush); - }; - // for other environments - macrotask based on: - // - setImmediate - // - MessageChannel - // - window.postMessag - // - onreadystatechange - // - setTimeout - } else { - notify = function(){ - // strange IE + webpack dev server bug - use .call(global) - macrotask.call(global, flush); - }; - } - - return function(fn){ - var task = {fn: fn, next: undefined}; - if(last)last.next = task; - if(!head){ - head = task; - notify(); - } last = task; - }; -}; -},{"./_cof":19,"./_global":39,"./_task":105}],66:[function(require,module,exports){ -'use strict'; -// 19.1.2.1 Object.assign(target, source, ...) -var getKeys = require('./_object-keys') - , gOPS = require('./_object-gops') - , pIE = require('./_object-pie') - , toObject = require('./_to-object') - , IObject = require('./_iobject') - , $assign = Object.assign; - -// should work with symbols and should have deterministic property order (V8 bug) -module.exports = !$assign || require('./_fails')(function(){ - var A = {} - , B = {} - , S = Symbol() - , K = 'abcdefghijklmnopqrst'; - A[S] = 7; - K.split('').forEach(function(k){ B[k] = k; }); - return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; -}) ? function assign(target, source){ // eslint-disable-line no-unused-vars - var T = toObject(target) - , aLen = arguments.length - , index = 1 - , getSymbols = gOPS.f - , isEnum = pIE.f; - while(aLen > index){ - var S = IObject(arguments[index++]) - , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) - , length = keys.length - , j = 0 - , key; - while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; - } return T; -} : $assign; -},{"./_fails":35,"./_iobject":46,"./_object-gops":74,"./_object-keys":77,"./_object-pie":78,"./_to-object":110}],67:[function(require,module,exports){ -// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) -var anObject = require('./_an-object') - , dPs = require('./_object-dps') - , enumBugKeys = require('./_enum-bug-keys') - , IE_PROTO = require('./_shared-key')('IE_PROTO') - , Empty = function(){ /* empty */ } - , PROTOTYPE = 'prototype'; - -// Create object with fake `null` prototype: use iframe Object with cleared prototype -var createDict = function(){ - // Thrash, waste and sodomy: IE GC bug - var iframe = require('./_dom-create')('iframe') - , i = enumBugKeys.length - , gt = '>' - , iframeDocument; - iframe.style.display = 'none'; - require('./_html').appendChild(iframe); - iframe.src = 'javascript:'; // eslint-disable-line no-script-url - // createDict = iframe.contentWindow.Object; - // html.removeChild(iframe); - iframeDocument = iframe.contentWindow.document; - iframeDocument.open(); - iframeDocument.write('