aboutsummaryrefslogtreecommitdiffstats
path: root/library/textcomplete/textcomplete.js.map
diff options
context:
space:
mode:
Diffstat (limited to 'library/textcomplete/textcomplete.js.map')
-rw-r--r--library/textcomplete/textcomplete.js.map1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/textcomplete/textcomplete.js.map b/library/textcomplete/textcomplete.js.map
new file mode 100644
index 000000000..42ed11883
--- /dev/null
+++ b/library/textcomplete/textcomplete.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///webpack/bootstrap 0bc74e584933ddf1c7ac","webpack:///./src/search_result.js","webpack:///./node_modules/eventemitter3/index.js","webpack:///./src/strategy.js","webpack:///./src/utils.js","webpack:///./src/editor.js","webpack:///./src/main.js","webpack:///(webpack)/buildin/global.js","webpack:///./src/textcomplete.js","webpack:///./src/completer.js","webpack:///./src/query.js","webpack:///./src/dropdown.js","webpack:///./src/dropdown_item.js","webpack:///./src/textarea.js","webpack:///./node_modules/undate/lib/update.js","webpack:///./node_modules/textarea-caret/index.js"],"names":["SearchResult","data","term","strategy","beforeCursor","afterCursor","replacement","replace","Array","isArray","match","matchText","_","p1","parseInt","slice","index","length","join","template","DEFAULT_INDEX","DEFAULT_TEMPLATE","value","Strategy","props","cache","callback","searchWithCache","search","results","text","calculateElementOffset","getLineHeightPx","calculateLineHeightPx","createCustomEvent","window","CustomEvent","type","options","document","defaultView","cancelable","detail","undefined","event","createEvent","initCustomEvent","el","rect","getBoundingClientRect","ownerDocument","documentElement","offset","top","pageYOffset","left","pageXOffset","clientTop","clientLeft","CHAR_CODE_ZERO","charCodeAt","CHAR_CODE_NINE","isDigit","charCode","node","computedStyle","getComputedStyle","lineHeight","parseFloat","fontSize","nodeName","body","tempNode","createElement","innerHTML","style","fontFamily","padding","appendChild","HTMLTextAreaElement","rows","height","offsetHeight","removeChild","Editor","Error","code","moveEvent","emit","enterEvent","changeEvent","getBeforeCursor","escEvent","e","keyCode","ctrlKey","editors","global","Textcomplete","Textarea","CALLBACK_METHODS","editor","completer","isQueryInFlight","nextPendingQuery","dropdown","forEach","method","bind","startListening","destroyEditor","destroy","stopListening","deactivate","strategyPropsArray","registerStrategy","run","searchResults","render","getCursorOffset","trigger","up","down","activeItem","getActiveItem","select","preventDefault","shown","selectEvent","defaultPrevented","applySearchResult","searchResult","on","handleMove","handleEnter","handleEsc","handleChange","handleSelect","eventName","handleHit","removeAllListeners","removeListener","Completer","strategies","push","query","extractQuery","execute","handleQueryResult","i","build","Query","context","map","result","DEFAULT_CLASS_NAME","Dropdown","display","position","zIndex","items","footer","header","maxCount","className","rotate","hasOwnProperty","placement","itemOptions","item","Object","keys","key","parentNode","clear","_el","cursorOffset","renderEvent","rawResults","dropdownItems","setStrategyId","renderEdge","append","show","setOffset","hide","dropdownItem","moveActiveItem","fragment","createDocumentFragment","appended","doc","elementWidth","offsetWidth","browserWidth","clientWidth","right","isPlacementTop","bottom","clientHeight","showEvent","hideEvent","direction","nextActiveItem","next","prev","activate","strategyId","id","setAttribute","removeAttribute","source","content","li","classList","add","DropdownItem","active","activeClassName","removeEventListener","onClick","onMouseover","siblings","a","addEventListener","nextIndex","getCaretCoordinates","require","before","getAfterCursor","focus","dispatchEvent","Event","elOffset","elScroll","getElScroll","cursorPosition","getCursorPosition","dir","selectionStart","selectionEnd","substring","scrollTop","scrollLeft","emitChangeEvent","getCode","emitMoveEvent","emitEnterEvent","emitEscEvent","onInput","onKeydown"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;AC3DA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AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,0DAA0D,OAAO;AACjE;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yCAAyC,SAAS;AAClD;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA,eAAe,YAAY;AAC3B;;AAEA;AACA,2DAA2D;AAC3D,+DAA+D;AAC/D,mEAAmE;AACnE,uEAAuE;AACvE;AACA,0DAA0D,SAAS;AACnE;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,SAAS;AACpB,WAAW,MAAM;AACjB,aAAa,aAAa;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,SAAS;AACpB,WAAW,MAAM;AACjB,aAAa,aAAa;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,SAAS;AACpB,WAAW,MAAM;AACjB,WAAW,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A;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,kCAAkC;AACjE,GAAG;AACH;AACA;AACA;AACA;AACA,C;;;;;;ACtDA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,+BAA+B;AAC9C;;AAEA;AACA;AACA;AACA;;AAEA;AACA,2FAA2F;;AAE3F;AACA;AACA;AACA,kCAAkC;;AAElC;AACA,8BAA8B;AAC9B;AACA,gCAAgC;;AAEhC;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;AACH,8BAA8B,0CAA0C;AACxE;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;AACD;AACA;;AAEA,CAAC","file":"textcomplete.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 0bc74e584933ddf1c7ac","// @flow\n\nimport Strategy from \"./strategy\"\n\n/**\n * Encapsulate an result of each search results.\n */\nexport default class SearchResult {\n data: Object\n term: string\n strategy: Strategy\n\n /**\n * @param {object} data - An element of array callbacked by search function.\n */\n constructor(data: Object, term: string, strategy: Strategy) {\n this.data = data\n this.term = term\n this.strategy = strategy\n }\n\n replace(beforeCursor: string, afterCursor: string) {\n let replacement = this.strategy.replace(this.data)\n if (replacement !== null) {\n if (Array.isArray(replacement)) {\n afterCursor = replacement[1] + afterCursor\n replacement = replacement[0]\n }\n const match = this.strategy.matchText(beforeCursor)\n if (match) {\n replacement = replacement\n .replace(/\\$&/g, match[0])\n .replace(/\\$(\\d)/g, (_, p1) => match[parseInt(p1, 10)])\n return [\n [\n beforeCursor.slice(0, match.index),\n replacement,\n beforeCursor.slice(match.index + match[0].length),\n ].join(\"\"),\n afterCursor,\n ]\n }\n }\n }\n\n render(): string {\n return this.strategy.template(this.data, this.term)\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/search_result.js","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @api private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {Mixed} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @api private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @api public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @api public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Boolean} exists Only check if there are listeners.\n * @returns {Array|Boolean}\n * @api public\n */\nEventEmitter.prototype.listeners = function listeners(event, exists) {\n var evt = prefix ? prefix + event : event\n , available = this._events[evt];\n\n if (exists) return !!available;\n if (!available) return [];\n if (available.fn) return [available.fn];\n\n for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n ee[i] = available[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @api public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n var listener = new EE(fn, context || this)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n var listener = new EE(fn, context || this, true)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {Mixed} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn\n && (!once || listeners.once)\n && (!context || listeners.context === context)\n ) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn\n || (once && !listeners[i].once)\n || (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {String|Symbol} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// This function doesn't apply anymore.\n//\nEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n return this;\n};\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/eventemitter3/index.js\n// module id = 1\n// module chunks = 0","// @flow\n\ndeclare class MatchData extends Array<string> {\n index: number;\n}\n\nexport type { MatchData }\n\nconst DEFAULT_INDEX = 2\n\nfunction DEFAULT_TEMPLATE(value) {\n return value\n}\n\n/**\n * Properties for a strategy.\n *\n * @typedef\n */\nexport type StrategyProperties = {\n match: RegExp | (string => MatchData | null),\n search: Function,\n replace: any => string[] | string | null,\n cache?: boolean,\n context?: Function,\n template?: any => string,\n index?: number,\n id?: string,\n}\n\n/**\n * Encapsulate a single strategy.\n */\nexport default class Strategy {\n props: StrategyProperties\n cache: ?Object\n\n constructor(props: StrategyProperties) {\n this.props = props\n this.cache = props.cache ? {} : null\n }\n\n /**\n * @return {this}\n */\n destroy() {\n this.cache = null\n return this\n }\n\n search(term: string, callback: Function, match: MatchData): void {\n if (this.cache) {\n this.searchWithCache(term, callback, match)\n } else {\n this.props.search(term, callback, match)\n }\n }\n\n /**\n * @param {object} data - An element of array callbacked by search function.\n */\n replace(data: any) {\n return this.props.replace(data)\n }\n\n /** @private */\n searchWithCache(term: string, callback: Function, match: MatchData): void {\n if (this.cache && this.cache[term]) {\n callback(this.cache[term])\n } else {\n this.props.search(\n term,\n results => {\n if (this.cache) {\n this.cache[term] = results\n }\n callback(results)\n },\n match,\n )\n }\n }\n\n /** @private */\n matchText(text: string): MatchData | null {\n if (typeof this.match === \"function\") {\n return this.match(text)\n } else {\n return (text.match(this.match): any)\n }\n }\n\n /** @private */\n get match(): $PropertyType<StrategyProperties, \"match\"> {\n return this.props.match\n }\n\n /** @private */\n get index(): number {\n return typeof this.props.index === \"number\"\n ? this.props.index\n : DEFAULT_INDEX\n }\n\n get template(): (...any) => string {\n return this.props.template || DEFAULT_TEMPLATE\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/strategy.js","// @flow\n\n/**\n * Create a custom event\n *\n * @private\n */\nexport const createCustomEvent = (() => {\n if (typeof window.CustomEvent === \"function\") {\n return function(\n type: string,\n options: ?{ detail?: Object, cancelable?: boolean },\n ): CustomEvent {\n return new document.defaultView.CustomEvent(type, {\n cancelable: (options && options.cancelable) || false,\n detail: (options && options.detail) || undefined,\n })\n }\n } else {\n // Custom event polyfill from\n // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#polyfill\n return function(\n type: string,\n options: ?{ detail?: Object, cancelable?: boolean },\n ): CustomEvent {\n const event = document.createEvent(\"CustomEvent\")\n event.initCustomEvent(\n type,\n /* bubbles */ false,\n (options && options.cancelable) || false,\n (options && options.detail) || undefined,\n )\n return event\n }\n }\n})()\n\n/**\n * Get the current coordinates of the `el` relative to the document.\n *\n * @private\n */\nexport function calculateElementOffset(\n el: HTMLElement,\n): { top: number, left: number } {\n const rect = el.getBoundingClientRect()\n const { defaultView, documentElement } = el.ownerDocument\n const offset = {\n top: rect.top + defaultView.pageYOffset,\n left: rect.left + defaultView.pageXOffset,\n }\n if (documentElement) {\n offset.top -= documentElement.clientTop\n offset.left -= documentElement.clientLeft\n }\n return offset\n}\n\nconst CHAR_CODE_ZERO = \"0\".charCodeAt(0)\nconst CHAR_CODE_NINE = \"9\".charCodeAt(0)\n\nfunction isDigit(charCode: number): boolean {\n return charCode >= CHAR_CODE_ZERO && charCode <= CHAR_CODE_NINE\n}\n\n/**\n * Returns the line-height of the given node in pixels.\n *\n * @private\n */\nexport function getLineHeightPx(node: HTMLElement): number {\n const computedStyle = window.getComputedStyle(node)\n\n // If the char code starts with a digit, it is either a value in pixels,\n // or unitless, as per:\n // https://drafts.csswg.org/css2/visudet.html#propdef-line-height\n // https://drafts.csswg.org/css2/cascade.html#computed-value\n if (isDigit(computedStyle.lineHeight.charCodeAt(0))) {\n // In real browsers the value is *always* in pixels, even for unit-less\n // line-heights. However, we still check as per the spec.\n if (\n isDigit(\n computedStyle.lineHeight.charCodeAt(\n computedStyle.lineHeight.length - 1,\n ),\n )\n ) {\n return (\n parseFloat(computedStyle.lineHeight) *\n parseFloat(computedStyle.fontSize)\n )\n } else {\n return parseFloat(computedStyle.lineHeight)\n }\n }\n\n // Otherwise, the value is \"normal\".\n // If the line-height is \"normal\", calculate by font-size\n return calculateLineHeightPx(node.nodeName, computedStyle)\n}\n\n/**\n * Returns calculated line-height of the given node in pixels.\n *\n * @private\n */\nexport function calculateLineHeightPx(\n nodeName: string,\n computedStyle: CSSStyleDeclaration,\n): number {\n const body = document.body\n if (!body) {\n return 0\n }\n\n const tempNode = document.createElement(nodeName)\n tempNode.innerHTML = \"&nbsp;\"\n tempNode.style.fontSize = computedStyle.fontSize\n tempNode.style.fontFamily = computedStyle.fontFamily\n tempNode.style.padding = \"0\"\n body.appendChild(tempNode)\n\n // Make sure textarea has only 1 row\n if (tempNode instanceof HTMLTextAreaElement) {\n ;(tempNode: HTMLTextAreaElement).rows = 1\n }\n\n // Assume the height of the element is the line-height\n const height = tempNode.offsetHeight\n body.removeChild(tempNode)\n\n return height\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils.js","// @flow\n/*eslint no-unused-vars: off*/\n\nimport EventEmitter from \"eventemitter3\"\n\nimport { createCustomEvent } from \"./utils\"\nimport SearchResult from \"./search_result\"\n\n/** @typedef */\nexport type CursorOffset = {\n lineHeight: number,\n top: number,\n left?: number,\n right?: number,\n}\n\ntype KeyCode = \"ESC\" | \"ENTER\" | \"UP\" | \"DOWN\" | \"OTHER\"\n\n/**\n * Abstract class representing a editor target.\n *\n * Editor classes must implement `#applySearchResult`, `#getCursorOffset` and\n * `#getBeforeCursor` methods.\n *\n * Editor classes must invoke `#emitMoveEvent`, `#emitEnterEvent`,\n * `#emitChangeEvent` and `#emitEscEvent` at proper timing.\n *\n * @abstract\n */\nexport default class Editor extends EventEmitter {\n /**\n * It is called when associated textcomplete object is destroyed.\n *\n * @return {this}\n */\n destroy() {\n return this\n }\n\n /**\n * It is called when a search result is selected by a user.\n */\n applySearchResult(_: SearchResult): void {\n throw new Error(\"Not implemented.\")\n }\n\n /**\n * The input cursor's absolute coordinates from the window's left\n * top corner.\n */\n getCursorOffset(): CursorOffset {\n throw new Error(\"Not implemented.\")\n }\n\n /**\n * Editor string value from head to cursor.\n * Returns null if selection type is range not cursor.\n */\n getBeforeCursor(): ?string {\n throw new Error(\"Not implemented.\")\n }\n\n /**\n * Emit a move event, which moves active dropdown element.\n * Child class must call this method at proper timing with proper parameter.\n *\n * @see {@link Textarea} for live example.\n */\n emitMoveEvent(code: \"UP\" | \"DOWN\"): CustomEvent {\n const moveEvent = createCustomEvent(\"move\", {\n cancelable: true,\n detail: {\n code: code,\n },\n })\n this.emit(\"move\", moveEvent)\n return moveEvent\n }\n\n /**\n * Emit a enter event, which selects current search result.\n * Child class must call this method at proper timing.\n *\n * @see {@link Textarea} for live example.\n */\n emitEnterEvent(): CustomEvent {\n const enterEvent = createCustomEvent(\"enter\", { cancelable: true })\n this.emit(\"enter\", enterEvent)\n return enterEvent\n }\n\n /**\n * Emit a change event, which triggers auto completion.\n * Child class must call this method at proper timing.\n *\n * @see {@link Textarea} for live example.\n */\n emitChangeEvent(): CustomEvent {\n const changeEvent = createCustomEvent(\"change\", {\n detail: {\n beforeCursor: this.getBeforeCursor(),\n },\n })\n this.emit(\"change\", changeEvent)\n return changeEvent\n }\n\n /**\n * Emit a esc event, which hides dropdown element.\n * Child class must call this method at proper timing.\n *\n * @see {@link Textarea} for live example.\n */\n emitEscEvent(): CustomEvent {\n const escEvent = createCustomEvent(\"esc\", { cancelable: true })\n this.emit(\"esc\", escEvent)\n return escEvent\n }\n\n /**\n * Helper method for parsing KeyboardEvent.\n *\n * @see {@link Textarea} for live example.\n */\n getCode(e: KeyboardEvent): KeyCode {\n return e.keyCode === 9\n ? \"ENTER\" // tab\n : e.keyCode === 13\n ? \"ENTER\" // enter\n : e.keyCode === 27\n ? \"ESC\" // esc\n : e.keyCode === 38\n ? \"UP\" // up\n : e.keyCode === 40\n ? \"DOWN\" // down\n : e.keyCode === 78 && e.ctrlKey\n ? \"DOWN\" // ctrl-n\n : e.keyCode === 80 && e.ctrlKey\n ? \"UP\" // ctrl-p\n : \"OTHER\"\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/editor.js","import Textcomplete from \"./textcomplete\"\nimport Textarea from \"./textarea\"\n\nlet editors\nif (global.Textcomplete && global.Textcomplete.editors) {\n editors = global.Textcomplete.editors\n} else {\n editors = {}\n}\neditors.Textarea = Textarea\n\nglobal.Textcomplete = Textcomplete\nglobal.Textcomplete.editors = editors\n\n\n\n// WEBPACK FOOTER //\n// ./src/main.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 6\n// module chunks = 0","// @flow\n\nimport Completer from \"./completer\"\nimport Editor from \"./editor\"\nimport Dropdown, { type DropdownOptions } from \"./dropdown\"\nimport Strategy, { type StrategyProperties } from \"./strategy\"\nimport SearchResult from \"./search_result\"\n\nimport EventEmitter from \"eventemitter3\"\n\nconst CALLBACK_METHODS = [\n \"handleChange\",\n \"handleEnter\",\n \"handleEsc\",\n \"handleHit\",\n \"handleMove\",\n \"handleSelect\",\n]\n\n/** @typedef */\ntype TextcompleteOptions = {\n dropdown?: DropdownOptions,\n}\n\n/**\n * The core of textcomplete. It acts as a mediator.\n */\nexport default class Textcomplete extends EventEmitter {\n dropdown: Dropdown\n editor: Editor\n options: TextcompleteOptions\n completer: Completer\n isQueryInFlight: boolean\n nextPendingQuery: string | null\n\n /**\n * @param {Editor} editor - Where the textcomplete works on.\n */\n constructor(editor: Editor, options: TextcompleteOptions = {}) {\n super()\n\n this.completer = new Completer()\n this.isQueryInFlight = false\n this.nextPendingQuery = null\n this.dropdown = new Dropdown(options.dropdown || {})\n this.editor = editor\n this.options = options\n\n CALLBACK_METHODS.forEach(method => {\n ;(this: any)[method] = (this: any)[method].bind(this)\n })\n\n this.startListening()\n }\n\n /**\n * @return {this}\n */\n destroy(destroyEditor: boolean = true) {\n this.completer.destroy()\n this.dropdown.destroy()\n if (destroyEditor) {\n this.editor.destroy()\n }\n this.stopListening()\n return this\n }\n\n /**\n * @return {this}\n */\n hide() {\n this.dropdown.deactivate()\n return this\n }\n\n /**\n * @return {this}\n * @example\n * textcomplete.register([{\n * match: /(^|\\s)(\\w+)$/,\n * search: function (term, callback) {\n * $.ajax({ ... })\n * .done(callback)\n * .fail([]);\n * },\n * replace: function (value) {\n * return '$1' + value + ' ';\n * }\n * }]);\n */\n register(strategyPropsArray: StrategyProperties[]) {\n strategyPropsArray.forEach(props => {\n this.completer.registerStrategy(new Strategy(props))\n })\n return this\n }\n\n /**\n * Start autocompleting.\n *\n * @param {string} text - Head to input cursor.\n * @return {this}\n */\n trigger(text: string) {\n if (this.isQueryInFlight) {\n this.nextPendingQuery = text\n } else {\n this.isQueryInFlight = true\n this.nextPendingQuery = null\n this.completer.run(text)\n }\n return this\n }\n\n /** @private */\n handleHit({ searchResults }: { searchResults: SearchResult[] }) {\n if (searchResults.length) {\n this.dropdown.render(searchResults, this.editor.getCursorOffset())\n } else {\n this.dropdown.deactivate()\n }\n this.isQueryInFlight = false\n if (this.nextPendingQuery !== null) {\n this.trigger(this.nextPendingQuery)\n }\n }\n\n /** @private */\n handleMove(e: CustomEvent) {\n e.detail.code === \"UP\" ? this.dropdown.up(e) : this.dropdown.down(e)\n }\n\n /** @private */\n handleEnter(e: CustomEvent) {\n const activeItem = this.dropdown.getActiveItem()\n if (activeItem) {\n this.dropdown.select(activeItem)\n e.preventDefault()\n } else {\n this.dropdown.deactivate()\n }\n }\n\n /** @private */\n handleEsc(e: CustomEvent) {\n if (this.dropdown.shown) {\n this.dropdown.deactivate()\n e.preventDefault()\n }\n }\n\n /** @private */\n handleChange(e: CustomEvent) {\n if (e.detail.beforeCursor != null) {\n this.trigger(e.detail.beforeCursor)\n } else {\n this.dropdown.deactivate()\n }\n }\n\n /** @private */\n handleSelect(selectEvent: CustomEvent) {\n this.emit(\"select\", selectEvent)\n if (!selectEvent.defaultPrevented) {\n this.editor.applySearchResult(selectEvent.detail.searchResult)\n }\n }\n\n /** @private */\n startListening() {\n this.editor\n .on(\"move\", this.handleMove)\n .on(\"enter\", this.handleEnter)\n .on(\"esc\", this.handleEsc)\n .on(\"change\", this.handleChange)\n this.dropdown.on(\"select\", this.handleSelect)\n ;[\n \"show\",\n \"shown\",\n \"render\",\n \"rendered\",\n \"selected\",\n \"hidden\",\n \"hide\",\n ].forEach(eventName => {\n this.dropdown.on(eventName, () => this.emit(eventName))\n })\n this.completer.on(\"hit\", this.handleHit)\n }\n\n /** @private */\n stopListening() {\n this.completer.removeAllListeners()\n this.dropdown.removeAllListeners()\n this.editor\n .removeListener(\"move\", this.handleMove)\n .removeListener(\"enter\", this.handleEnter)\n .removeListener(\"esc\", this.handleEsc)\n .removeListener(\"change\", this.handleChange)\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/textcomplete.js","// @flow\n\nimport EventEmitter from \"eventemitter3\"\n\nimport Query from \"./query\"\nimport SearchResult from \"./search_result\"\nimport Strategy from \"./strategy\"\n\nconst CALLBACK_METHODS = [\"handleQueryResult\"]\n\n/**\n * Complete engine.\n */\nexport default class Completer extends EventEmitter {\n strategies: Strategy[]\n\n constructor() {\n super()\n this.strategies = []\n\n CALLBACK_METHODS.forEach(method => {\n ;(this: any)[method] = (this: any)[method].bind(this)\n })\n }\n\n /**\n * @return {this}\n */\n destroy() {\n this.strategies.forEach(strategy => strategy.destroy())\n return this\n }\n\n /**\n * Register a strategy to the completer.\n *\n * @return {this}\n */\n registerStrategy(strategy: Strategy) {\n this.strategies.push(strategy)\n return this\n }\n\n /**\n * @param {string} text - Head to input cursor.\n */\n run(text: string): void {\n const query = this.extractQuery(text)\n if (query) {\n query.execute(this.handleQueryResult)\n } else {\n this.handleQueryResult([])\n }\n }\n\n /**\n * Find a query, which matches to the given text.\n *\n * @private\n */\n extractQuery(text: string) {\n for (let i = 0; i < this.strategies.length; i++) {\n const query = Query.build(this.strategies[i], text)\n if (query) {\n return query\n }\n }\n return null\n }\n\n /**\n * Callbacked by {@link Query#execute}.\n *\n * @private\n */\n handleQueryResult(searchResults: SearchResult[]) {\n this.emit(\"hit\", { searchResults })\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/completer.js","// @flow\n\nimport SearchResult from \"./search_result\"\nimport Strategy from \"./strategy\"\nimport type { MatchData } from \"./strategy\"\n\n/**\n * Encapsulate matching condition between a Strategy and current editor's value.\n */\nexport default class Query {\n strategy: Strategy\n term: string\n match: MatchData\n\n /**\n * Build a Query object by the given string if this matches to the string.\n *\n * @param {string} text - Head to input cursor.\n */\n static build(strategy: Strategy, text: string): ?Query {\n if (typeof strategy.props.context === \"function\") {\n const context = strategy.props.context(text)\n if (typeof context === \"string\") {\n text = context\n } else if (!context) {\n return null\n }\n }\n const match = strategy.matchText(text)\n return match ? new Query(strategy, match[strategy.index], match) : null\n }\n\n constructor(strategy: Strategy, term: string, match: MatchData) {\n this.strategy = strategy\n this.term = term\n this.match = match\n }\n\n /**\n * Invoke search strategy and callback the given function.\n */\n execute(callback: (SearchResult[]) => void) {\n this.strategy.search(\n this.term,\n results => {\n callback(\n results.map(result => {\n return new SearchResult(result, this.term, this.strategy)\n }),\n )\n },\n this.match,\n )\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/query.js","// @flow\nimport EventEmitter from \"eventemitter3\"\n\nimport DropdownItem, { type DropdownItemOptions } from \"./dropdown_item\"\nimport SearchResult from \"./search_result\"\nimport { createCustomEvent } from \"./utils\"\nimport type { CursorOffset } from \"./editor\"\n\nconst DEFAULT_CLASS_NAME = \"dropdown-menu textcomplete-dropdown\"\n\n/** @typedef */\nexport type DropdownOptions = {\n className?: string,\n footer?: any => string | string,\n header?: any => string | string,\n maxCount?: number,\n placement?: string,\n rotate?: boolean,\n style?: { [string]: string },\n item?: DropdownItemOptions,\n}\n\n/**\n * Encapsulate a dropdown view.\n *\n * @prop {boolean} shown - Whether the #el is shown or not.\n * @prop {DropdownItem[]} items - The array of rendered dropdown items.\n */\nexport default class Dropdown extends EventEmitter {\n shown: boolean\n items: DropdownItem[]\n activeItem: DropdownItem | null\n footer: $PropertyType<DropdownOptions, \"footer\">\n header: $PropertyType<DropdownOptions, \"header\">\n maxCount: $PropertyType<DropdownOptions, \"maxCount\">\n rotate: $PropertyType<DropdownOptions, \"rotate\">\n placement: $PropertyType<DropdownOptions, \"placement\">\n itemOptions: DropdownItemOptions\n _el: ?HTMLUListElement\n\n static createElement(): HTMLUListElement {\n const el = document.createElement(\"ul\")\n const style = el.style\n style.display = \"none\"\n style.position = \"absolute\"\n style.zIndex = \"10000\"\n const body = document.body\n if (body) {\n body.appendChild(el)\n }\n return el\n }\n\n constructor(options: DropdownOptions) {\n super()\n this.shown = false\n this.items = []\n this.activeItem = null\n this.footer = options.footer\n this.header = options.header\n this.maxCount = options.maxCount || 10\n this.el.className = options.className || DEFAULT_CLASS_NAME\n this.rotate = options.hasOwnProperty(\"rotate\") ? options.rotate : true\n this.placement = options.placement\n this.itemOptions = options.item || {}\n const style = options.style\n if (style) {\n Object.keys(style).forEach(key => {\n ;(this.el.style: any)[key] = style[key]\n })\n }\n }\n\n /**\n * @return {this}\n */\n destroy() {\n const parentNode = this.el.parentNode\n if (parentNode) {\n parentNode.removeChild(this.el)\n }\n this.clear()._el = null\n return this\n }\n\n get el(): HTMLUListElement {\n if (!this._el) {\n this._el = Dropdown.createElement()\n }\n return this._el\n }\n\n /**\n * Render the given data as dropdown items.\n *\n * @return {this}\n */\n render(searchResults: SearchResult[], cursorOffset: CursorOffset) {\n const renderEvent = createCustomEvent(\"render\", { cancelable: true })\n this.emit(\"render\", renderEvent)\n if (renderEvent.defaultPrevented) {\n return this\n }\n const rawResults = searchResults.map(searchResult => searchResult.data)\n const dropdownItems = searchResults\n .slice(0, this.maxCount || searchResults.length)\n .map(searchResult => new DropdownItem(searchResult, this.itemOptions))\n this.clear()\n .setStrategyId(searchResults[0])\n .renderEdge(rawResults, \"header\")\n .append(dropdownItems)\n .renderEdge(rawResults, \"footer\")\n .show()\n .setOffset(cursorOffset)\n this.emit(\"rendered\", createCustomEvent(\"rendered\"))\n return this\n }\n\n /**\n * Hide the dropdown then sweep out items.\n *\n * @return {this}\n */\n deactivate() {\n return this.hide().clear()\n }\n\n /**\n * @return {this}\n */\n select(dropdownItem: DropdownItem) {\n const detail = { searchResult: dropdownItem.searchResult }\n const selectEvent = createCustomEvent(\"select\", {\n cancelable: true,\n detail: detail,\n })\n this.emit(\"select\", selectEvent)\n if (selectEvent.defaultPrevented) {\n return this\n }\n this.deactivate()\n this.emit(\"selected\", createCustomEvent(\"selected\", { detail }))\n return this\n }\n\n /**\n * @return {this}\n */\n up(e: CustomEvent) {\n return this.shown ? this.moveActiveItem(\"prev\", e) : this\n }\n\n /**\n * @return {this}\n */\n down(e: CustomEvent) {\n return this.shown ? this.moveActiveItem(\"next\", e) : this\n }\n\n /**\n * Retrieve the active item.\n */\n getActiveItem(): DropdownItem | null {\n return this.activeItem\n }\n\n /**\n * Add items to dropdown.\n *\n * @private\n */\n append(items: DropdownItem[]) {\n const fragment = document.createDocumentFragment()\n items.forEach(item => {\n this.items.push(item)\n item.appended(this)\n fragment.appendChild(item.el)\n })\n this.el.appendChild(fragment)\n return this\n }\n\n /** @private */\n setOffset(cursorOffset: CursorOffset) {\n const doc = document.documentElement\n if (doc) {\n const elementWidth = this.el.offsetWidth\n if (cursorOffset.left) {\n const browserWidth = doc.clientWidth\n if (cursorOffset.left + elementWidth > browserWidth) {\n cursorOffset.left = browserWidth - elementWidth\n }\n this.el.style.left = `${cursorOffset.left}px`\n } else if (cursorOffset.right) {\n if (cursorOffset.right - elementWidth < 0) {\n cursorOffset.right = 0\n }\n this.el.style.right = `${cursorOffset.right}px`\n }\n if (this.isPlacementTop()) {\n this.el.style.bottom = `${doc.clientHeight -\n cursorOffset.top +\n cursorOffset.lineHeight}px`\n } else {\n this.el.style.top = `${cursorOffset.top}px`\n }\n }\n return this\n }\n\n /**\n * Show the element.\n *\n * @private\n */\n show() {\n if (!this.shown) {\n const showEvent = createCustomEvent(\"show\", { cancelable: true })\n this.emit(\"show\", showEvent)\n if (showEvent.defaultPrevented) {\n return this\n }\n this.el.style.display = \"block\"\n this.shown = true\n this.emit(\"shown\", createCustomEvent(\"shown\"))\n }\n return this\n }\n\n /**\n * Hide the element.\n *\n * @private\n */\n hide() {\n if (this.shown) {\n const hideEvent = createCustomEvent(\"hide\", { cancelable: true })\n this.emit(\"hide\", hideEvent)\n if (hideEvent.defaultPrevented) {\n return this\n }\n this.el.style.display = \"none\"\n this.shown = false\n this.emit(\"hidden\", createCustomEvent(\"hidden\"))\n }\n return this\n }\n\n /**\n * Clear search results.\n *\n * @private\n */\n clear() {\n this.el.innerHTML = \"\"\n this.items.forEach(item => item.destroy())\n this.items = []\n return this\n }\n\n /** @private */\n moveActiveItem(direction: \"next\" | \"prev\", e: CustomEvent) {\n const nextActiveItem =\n direction === \"next\"\n ? this.activeItem ? this.activeItem.next : this.items[0]\n : this.activeItem\n ? this.activeItem.prev\n : this.items[this.items.length - 1]\n if (nextActiveItem) {\n nextActiveItem.activate()\n e.preventDefault()\n }\n return this\n }\n\n /** @private */\n setStrategyId(searchResult: ?SearchResult) {\n const strategyId = searchResult && searchResult.strategy.props.id\n if (strategyId) {\n this.el.setAttribute(\"data-strategy\", strategyId)\n } else {\n this.el.removeAttribute(\"data-strategy\")\n }\n return this\n }\n\n /**\n * @private\n * @param {object[]} rawResults - What callbacked by search function.\n */\n renderEdge(rawResults: Object[], type: \"header\" | \"footer\") {\n const source = (type === \"header\" ? this.header : this.footer) || \"\"\n const content: any =\n typeof source === \"function\" ? source(rawResults) : source\n const li = document.createElement(\"li\")\n li.classList.add(`textcomplete-${type}`)\n li.innerHTML = content\n this.el.appendChild(li)\n return this\n }\n\n /** @private */\n isPlacementTop() {\n return this.placement === \"top\"\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/dropdown.js","// @flow\n\nimport SearchResult from \"./search_result\"\n\nexport const DEFAULT_CLASS_NAME = \"textcomplete-item\"\nconst CALLBACK_METHODS = [\"onClick\", \"onMouseover\"]\n\n/** @typedef */\nexport type DropdownItemOptions = {\n className?: string,\n}\n\n// Declare interface instead of importing Dropdown itself to prevent circular dependency.\ninterface Dropdown {\n activeItem: DropdownItem | null;\n items: DropdownItem[];\n rotate: ?Boolean;\n getActiveItem(): DropdownItem | null;\n select(DropdownItem): DropdownItem;\n}\n\n/**\n * Encapsulate an item of dropdown.\n */\nexport default class DropdownItem {\n searchResult: SearchResult\n active: boolean\n className: string\n activeClassName: string\n siblings: DropdownItem[]\n dropdown: Dropdown\n index: number\n _el: ?HTMLLIElement\n\n constructor(searchResult: SearchResult, options: DropdownItemOptions) {\n this.searchResult = searchResult\n this.active = false\n this.className = options.className || DEFAULT_CLASS_NAME\n this.activeClassName = `${this.className} active`\n\n CALLBACK_METHODS.forEach(method => {\n ;(this: any)[method] = (this: any)[method].bind(this)\n })\n }\n\n get el(): HTMLLIElement {\n if (this._el) {\n return this._el\n }\n const li = document.createElement(\"li\")\n li.className = this.active ? this.activeClassName : this.className\n const a = document.createElement(\"a\")\n a.innerHTML = this.searchResult.render()\n li.appendChild(a)\n this._el = li\n li.addEventListener(\"mousedown\", this.onClick)\n li.addEventListener(\"mouseover\", this.onMouseover)\n li.addEventListener(\"touchstart\", this.onClick)\n return li\n }\n\n /**\n * Try to free resources and perform other cleanup operations.\n */\n destroy() {\n this.el.removeEventListener(\"mousedown\", this.onClick, false)\n this.el.removeEventListener(\"mouseover\", this.onMouseover, false)\n this.el.removeEventListener(\"touchstart\", this.onClick, false)\n if (this.active) {\n this.dropdown.activeItem = null\n }\n // This element has already been removed by {@link Dropdown#clear}.\n this._el = null\n }\n\n /**\n * Callbacked when it is appended to a dropdown.\n *\n * @see Dropdown#append\n */\n appended(dropdown: Dropdown) {\n this.dropdown = dropdown\n this.siblings = dropdown.items\n this.index = this.siblings.length - 1\n }\n\n /**\n * Deactivate active item then activate itself.\n *\n * @return {this}\n */\n activate() {\n if (!this.active) {\n const activeItem = this.dropdown.getActiveItem()\n if (activeItem) {\n activeItem.deactivate()\n }\n this.dropdown.activeItem = this\n this.active = true\n this.el.className = this.activeClassName\n }\n return this\n }\n\n /**\n * Get the next sibling.\n */\n get next(): ?DropdownItem {\n let nextIndex\n if (this.index === this.siblings.length - 1) {\n if (!this.dropdown.rotate) {\n return null\n }\n nextIndex = 0\n } else {\n nextIndex = this.index + 1\n }\n return this.siblings[nextIndex]\n }\n\n /**\n * Get the previous sibling.\n */\n get prev(): ?DropdownItem {\n let nextIndex\n if (this.index === 0) {\n if (!this.dropdown.rotate) {\n return null\n }\n nextIndex = this.siblings.length - 1\n } else {\n nextIndex = this.index - 1\n }\n return this.siblings[nextIndex]\n }\n\n /** @private */\n deactivate() {\n if (this.active) {\n this.active = false\n this.el.className = this.className\n this.dropdown.activeItem = null\n }\n return this\n }\n\n /** @private */\n onClick(e: Event) {\n e.preventDefault() // Prevent blur event\n this.dropdown.select(this)\n }\n\n /** @private */\n onMouseover() {\n this.activate()\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/dropdown_item.js","// @flow\n\nimport update from \"undate/lib/update\"\n\nimport Editor from \"./editor\"\nimport { calculateElementOffset, getLineHeightPx } from \"./utils\"\nimport SearchResult from \"./search_result\"\n\nconst getCaretCoordinates = require(\"textarea-caret\")\n\nconst CALLBACK_METHODS = [\"onInput\", \"onKeydown\"]\n\n/**\n * Encapsulate the target textarea element.\n */\nexport default class Textarea extends Editor {\n el: HTMLTextAreaElement\n\n /**\n * @param {HTMLTextAreaElement} el - Where the textcomplete works on.\n */\n constructor(el: HTMLTextAreaElement) {\n super()\n this.el = el\n\n CALLBACK_METHODS.forEach(method => {\n ;(this: any)[method] = (this: any)[method].bind(this)\n })\n\n this.startListening()\n }\n\n /**\n * @return {this}\n */\n destroy() {\n super.destroy()\n this.stopListening()\n // Release the element reference early to help garbage collection.\n ;(this: any).el = null\n return this\n }\n\n /**\n * Implementation for {@link Editor#applySearchResult}\n */\n applySearchResult(searchResult: SearchResult) {\n const before = this.getBeforeCursor()\n if (before != null) {\n const replace = searchResult.replace(before, this.getAfterCursor())\n this.el.focus() // Clicking a dropdown item removes focus from the element.\n if (Array.isArray(replace)) {\n update(this.el, replace[0], replace[1])\n this.el.dispatchEvent(new Event(\"input\"))\n }\n }\n }\n\n /**\n * Implementation for {@link Editor#getCursorOffset}\n */\n getCursorOffset() {\n const elOffset = calculateElementOffset(this.el)\n const elScroll = this.getElScroll()\n const cursorPosition = this.getCursorPosition()\n const lineHeight = getLineHeightPx(this.el)\n const top = elOffset.top - elScroll.top + cursorPosition.top + lineHeight\n const left = elOffset.left - elScroll.left + cursorPosition.left\n if (this.el.dir !== \"rtl\") {\n return { top, left, lineHeight }\n } else {\n const right = document.documentElement\n ? document.documentElement.clientWidth - left\n : 0\n return { top, right, lineHeight }\n }\n }\n\n /**\n * Implementation for {@link Editor#getBeforeCursor}\n */\n getBeforeCursor() {\n return this.el.selectionStart !== this.el.selectionEnd\n ? null\n : this.el.value.substring(0, this.el.selectionEnd)\n }\n\n /** @private */\n getAfterCursor() {\n return this.el.value.substring(this.el.selectionEnd)\n }\n\n /** @private */\n getElScroll(): { top: number, left: number } {\n return { top: this.el.scrollTop, left: this.el.scrollLeft }\n }\n\n /**\n * The input cursor's relative coordinates from the textarea's left\n * top corner.\n *\n * @private\n */\n getCursorPosition(): { top: number, left: number } {\n return getCaretCoordinates(this.el, this.el.selectionEnd)\n }\n\n /** @private */\n onInput() {\n this.emitChangeEvent()\n }\n\n /** @private */\n onKeydown(e: KeyboardEvent) {\n const code = this.getCode(e)\n let event\n if (code === \"UP\" || code === \"DOWN\") {\n event = this.emitMoveEvent(code)\n } else if (code === \"ENTER\") {\n event = this.emitEnterEvent()\n } else if (code === \"ESC\") {\n event = this.emitEscEvent()\n }\n if (event && event.defaultPrevented) {\n e.preventDefault()\n }\n }\n\n /** @private */\n startListening() {\n this.el.addEventListener(\"input\", this.onInput)\n this.el.addEventListener(\"keydown\", this.onKeydown)\n }\n\n /** @private */\n stopListening() {\n this.el.removeEventListener(\"input\", this.onInput)\n this.el.removeEventListener(\"keydown\", this.onKeydown)\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/textarea.js","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nexports.default = function (el, headToCursor, cursorToTail) {\n var curr = el.value,\n // strA + strB1 + strC\n next = headToCursor + (cursorToTail || ''),\n // strA + strB2 + strC\n activeElement = document.activeElement;\n\n // Calculate length of strA and strC\n var aLength = 0,\n cLength = 0;\n while (aLength < curr.length && aLength < next.length && curr[aLength] === next[aLength]) {\n aLength++;\n }\n while (curr.length - cLength - 1 >= 0 && next.length - cLength - 1 >= 0 && curr[curr.length - cLength - 1] === next[next.length - cLength - 1]) {\n cLength++;\n }\n aLength = Math.min(aLength, Math.min(curr.length, next.length) - cLength);\n\n // Select strB1\n el.setSelectionRange(aLength, curr.length - cLength);\n\n // Get strB2\n var strB2 = next.substring(aLength, next.length - cLength);\n\n // Replace strB1 with strB2\n el.focus();\n if (!document.execCommand('insertText', false, strB2)) {\n // Document.execCommand returns false if the command is not supported.\n // Firefox and IE returns false in this case.\n el.value = next;\n el.dispatchEvent(createInputEvent());\n }\n\n // Move cursor to the end of headToCursor\n el.setSelectionRange(headToCursor.length, headToCursor.length);\n\n activeElement && activeElement.focus();\n return el;\n};\n\nfunction createInputEvent() {\n if (typeof Event !== \"undefined\") {\n return new Event(\"input\", { bubbles: true, cancelable: true });\n } else {\n var event = document.createEvent(\"Event\");\n event.initEvent(\"input\", true, true);\n return event;\n }\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/undate/lib/update.js\n// module id = 13\n// module chunks = 0","/* jshint browser: true */\n\n(function () {\n\n// The properties that we copy into a mirrored div.\n// Note that some browsers, such as Firefox,\n// do not concatenate properties, i.e. padding-top, bottom etc. -> padding,\n// so we have to do every single property specifically.\nvar properties = [\n 'direction', // RTL support\n 'boxSizing',\n 'width', // on Chrome and IE, exclude the scrollbar, so the mirror div wraps exactly as the textarea does\n 'height',\n 'overflowX',\n 'overflowY', // copy the scrollbar for IE\n\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'borderStyle',\n\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/font\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration', // might not make a difference, but better be safe\n\n 'letterSpacing',\n 'wordSpacing',\n\n 'tabSize',\n 'MozTabSize'\n\n];\n\nvar isBrowser = (typeof window !== 'undefined');\nvar isFirefox = (isBrowser && window.mozInnerScreenX != null);\n\nfunction getCaretCoordinates(element, position, options) {\n if(!isBrowser) {\n throw new Error('textarea-caret-position#getCaretCoordinates should only be called in a browser');\n }\n\n var debug = options && options.debug || false;\n if (debug) {\n var el = document.querySelector('#input-textarea-caret-position-mirror-div');\n if ( el ) { el.parentNode.removeChild(el); }\n }\n\n // mirrored div\n var div = document.createElement('div');\n div.id = 'input-textarea-caret-position-mirror-div';\n document.body.appendChild(div);\n\n var style = div.style;\n var computed = window.getComputedStyle? getComputedStyle(element) : element.currentStyle; // currentStyle for IE < 9\n\n // default textarea styles\n style.whiteSpace = 'pre-wrap';\n if (element.nodeName !== 'INPUT')\n style.wordWrap = 'break-word'; // only for textarea-s\n\n // position off-screen\n style.position = 'absolute'; // required to return coordinates properly\n if (!debug)\n style.visibility = 'hidden'; // not 'display: none' because we want rendering\n\n // transfer the element's properties to the div\n properties.forEach(function (prop) {\n style[prop] = computed[prop];\n });\n\n if (isFirefox) {\n // Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275\n if (element.scrollHeight > parseInt(computed.height))\n style.overflowY = 'scroll';\n } else {\n style.overflow = 'hidden'; // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll'\n }\n\n div.textContent = element.value.substring(0, position);\n // the second special handling for input type=\"text\" vs textarea: spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037\n if (element.nodeName === 'INPUT')\n div.textContent = div.textContent.replace(/\\s/g, '\\u00a0');\n\n var span = document.createElement('span');\n // Wrapping must be replicated *exactly*, including when a long word gets\n // onto the next line, with whitespace at the end of the line before (#7).\n // The *only* reliable way to do that is to copy the *entire* rest of the\n // textarea's content into the <span> created at the caret position.\n // for inputs, just '.' would be enough, but why bother?\n span.textContent = element.value.substring(position) || '.'; // || because a completely empty faux span doesn't render at all\n div.appendChild(span);\n\n var coordinates = {\n top: span.offsetTop + parseInt(computed['borderTopWidth']),\n left: span.offsetLeft + parseInt(computed['borderLeftWidth'])\n };\n\n if (debug) {\n span.style.backgroundColor = '#aaa';\n } else {\n document.body.removeChild(div);\n }\n\n return coordinates;\n}\n\nif (typeof module != 'undefined' && typeof module.exports != 'undefined') {\n module.exports = getCaretCoordinates;\n} else if(isBrowser){\n window.getCaretCoordinates = getCaretCoordinates;\n}\n\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/textarea-caret/index.js\n// module id = 14\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file