module.exports = { mixins: [require("vue-mixins/isOpened"), require("vue-mixins/style")], props: { "taclass": { "default": function() { return []; } }, "style": { "default": function() { return []; } }, "autofocus": { type: Boolean, "default": false }, "disabled": { type: Boolean, "default": false }, "readonly": { type: Boolean, "default": false }, "noExtraLine": { type: Boolean, "default": false }, "value": { type: String, "default": "" }, "transitionIn": { type: Function, "default": function(arg) { var cb, el, style; el = arg.el, style = arg.style, cb = arg.cb; return cb(); } }, "transitionOut": { type: Function, "default": function(arg) { var cb, el, style; el = arg.el, style = arg.style, cb = arg.cb; return cb(); } }, "maxSize": { type: Object, "default": function() { return {}; } }, "size": { type: Object, "default": function() { return {}; } }, "hoverSize": { type: Object, "default": function() { return {}; } } }, data: function() { return { content: {}, current: { width: null, height: null }, loaded: false, hovered: false, tastyle: null, elstyle: null }; }, computed: { inner: function() { var border, i, inner, len, name, padding, ref; if (!this.tastyle) { return null; } inner = {}; ref = ["top", "right", "bottom", "left"]; for (i = 0, len = ref.length; i < len; i++) { name = ref[i]; padding = parseFloat(this.tastyle.getPropertyValue("padding-" + name).replace("px", "")); border = parseFloat(this.tastyle.getPropertyValue("border-" + name + "-width").replace("px", "")); inner[name] = padding + border; } return inner; }, sizerStyle: function() { var style; if (!(this.tastyle && this.elstyle)) { return null; } style = { fontSize: this.tastyle.getPropertyValue("font-size"), lineHeight: this.lineHeight + "px", fontFamily: this.tastyle.getPropertyValue("font-family"), letterSpacing: this.tastyle.getPropertyValue("letter-spacing"), minHeight: this.tastyle.getPropertyValue("min-height"), maxWidth: this.maxWidth != null ? this.maxWidth + "px" : null, maxHeight: this.maxHeight + "px", paddingTop: this.inner.top + "px", paddingBottom: this.inner.bottom + "px", paddingLeft: this.inner.left + "px", paddingRight: this.inner.right + "px", top: this.elstyle.getPropertyValue("padding-top"), left: this.elstyle.getPropertyValue("padding-left"), marginTop: this.tastyle.getPropertyValue("margin-top"), marginBottom: this.tastyle.getPropertyValue("margin-bottom"), marginLeft: this.tastyle.getPropertyValue("margin-left"), marginRight: this.tastyle.getPropertyValue("margin-right"), boxSizing: this.tastyle.getPropertyValue("box-sizing") }; return style; }, lineHeight: function() { var lh; if (!this.tastyle) { return null; } lh = this.tastyle.getPropertyValue("line-height"); if (lh === "normal") { return null; } else { return parseFloat(lh.replace("px", "")); } }, lineHeightOrFontSize: function() { if (this.lineHeight) { return this.lineHeight; } else { return parseFloat(this.sizerStyle.fontSize.replace("px", "")); } }, maxWidth: function() { if (this.maxSize.width != null) { return this.maxSize.width; } return null; }, maxHeight: function() { if (this.maxSize.height != null) { return this.maxSize.height; } return null; }, closed: function() { var height, width; height = this.size.height; if (height == null) { height = this.$els.ta.offsetHeight; } if ((this.maxheight != null) && height > this.maxheight) { height = this.maxheight; } width = this.size.width; if (width == null) { width = this.$els.ta.offsetWidth; } if ((this.maxWidth != null) && width > this.maxWidth) { width = this.maxWidth; } return { width: width, height: height }; }, taStyle: function() { if (!this.inner) { return null; } return { height: this.offsetHeight(this.current.height) + "px", width: this.offsetWidth(this.current.width) + "px", visibility: this.loaded ? null : "hidden", overflow: this.opened ? null : "hidden" }; }, mergeStyle: function() { if (!this.tastyle) { return null; } return { position: "relative", height: this.current.height + "px", width: this.maxWidth != null ? this.maxWidth + "px" : null }; } }, watch: { value: "valueChanged" }, methods: { offsetHeight: function(height) { if (height == null) { height = this.height; } return height - this.inner.top - this.inner.bottom; }, offsetWidth: function(width) { if (width == null) { width = this.width; } return width - this.inner.left - this.inner.right; }, setCurrent: function(style) { this.current.height = style.height; return this.current.width = style.width; }, onClick: function(e) { if (!e.defaultPrevented) { if (!(this.opened || this.value !== '')) { e.preventDefault(); this.focus(); } return this.open(); } }, onFocus: function(e) { return this.$emit("focus", e); }, onBlur: function(e) { this.close(); return this.$emit("blur", e); }, onScroll: function(e) { return this.$emit("scroll", e); }, focus: function() { this.open(); return this.$els.ta.focus(); }, blur: function() { this.close(); return this.$els.ta.blur(); }, onKeyup: function(e) { return this.$emit("keyup", e); }, onInput: function(e) { return e.stopPropagation(); }, mouseenter: function() { if (!this.opened) { if (this.hoverSize.height > this.hoverSize.height || this.hoverSize.width > this.closed.width) { this.hovered = true; return this.move(this.hoverSize); } } }, mouseleave: function() { if (!this.opened && this.hovered) { return this.move(this.closed); } }, valueChanged: function(value) { this.$emit("input", value); return this.processContent(value); }, processContent: function(content) { this.content.height = this.$els.sizer.clientHeight; if (!this.noExtraLine) { this.content.height += this.lineHeightOrFontSize; } if (this.content.height < this.closed.height) { this.content.height = this.closed.height; } if (this.maxHeight && this.content.height > this.maxHeight) { this.content.height = this.maxHeight; } this.content.width = this.$els.sizer.offsetWidth; if (this.content.width < this.closed.width) { this.content.width = this.closed.width; } if (content && this.opened) { return this.move(this.content); } }, getOffsetStyle: function(style) { return { height: this.offsetHeight(style.height), width: this.offsetWidth(style.width) }; }, move: function(style, cb) { var area, newArea; area = this.current.height * this.current.width; newArea = style.height * style.width; if (area === newArea) { return typeof cb === "function" ? cb() : void 0; } else if (area <= newArea) { return this.transitionIn({ el: this.$els.ta, style: this.getOffsetStyle(style), cb: (function(_this) { return function() { _this.setCurrent(style); return typeof cb === "function" ? cb() : void 0; }; })(this) }); } else { return this.transitionOut({ el: this.$els.ta, style: this.getOffsetStyle(style), cb: (function(_this) { return function() { _this.setCurrent(style); return typeof cb === "function" ? cb() : void 0; }; })(this) }); } }, show: function() { this.setOpened(); this.$emit("before-enter"); return this.move(this.content, (function(_this) { return function() { return _this.$emit("after-enter"); }; })(this)); }, hide: function() { this.$emit("before-leave"); return this.move(this.closed, (function(_this) { return function() { _this.setClosed(); return _this.$emit("after-leave"); }; })(this)); }, open: function() { if (this.opened) { return; } return this.show(); }, close: function() { if (!this.opened) { return; } return this.hide(); }, toggle: function() { if (this.opened) { return this.close(); } else { return this.open(); } } }, ready: function() { var ref; if (!this.value) { this.value = (ref = this.$els.content) != null ? ref.textContent : void 0; } this.tastyle = window.getComputedStyle(this.$els.ta); this.elstyle = window.getComputedStyle(this.$el); this.processContent(); this.loaded = true; if (this.isOpened) { return this.setCurrent(this.content); } else { return this.setCurrent(this.closed); } } }; if (module.exports.__esModule) module.exports = module.exports.default ;(typeof module.exports === "function"? module.exports.options: module.exports).template = "