stimulus-textarea-autogrow
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -9,2 +9,10 @@ # Changelog | ||
## [4.0.0] - 2021-12-27 | ||
### Chore | ||
- Breaking Upgrading Stimulus to 3.x and change namespace from `stimulus` to `@hotwired/stimulus`. | ||
- Upgrading dependencies | ||
- Upgrading Node to `16.13.1`. | ||
## [3.0.0] - 2021-05-25 | ||
@@ -11,0 +19,0 @@ |
@@ -1,1 +0,36 @@ | ||
import{Controller as e}from"stimulus";class t extends e{initialize(){this.autogrow=this.autogrow.bind(this)}connect(){this.element.style.overflow="hidden";const e=this.resizeDebounceDelayValue||100;this.onResize=e>0?function(e,t){let i;return(...s)=>{const o=this;clearTimeout(i),i=setTimeout((()=>e.apply(o,s)),t)}}(this.autogrow,e):this.autogrow,this.autogrow(),this.element.addEventListener("input",this.autogrow),window.addEventListener("resize",this.onResize)}disconnect(){window.removeEventListener("resize",this.onResize)}autogrow(){this.element.style.height="auto",this.element.style.height=`${this.element.scrollHeight}px`}}t.values={resizeDebounceDelay:Number};export default t; | ||
import { Controller } from "@hotwired/stimulus"; | ||
function debounce(callback, delay) { | ||
let timeout; | ||
return (...args) => { | ||
const context = this; | ||
clearTimeout(timeout); | ||
timeout = setTimeout(() => callback.apply(context, args), delay); | ||
}; | ||
} | ||
class src_default extends Controller { | ||
initialize() { | ||
this.autogrow = this.autogrow.bind(this); | ||
} | ||
connect() { | ||
this.element.style.overflow = "hidden"; | ||
const delay = this.resizeDebounceDelayValue; | ||
this.onResize = delay > 0 ? debounce(this.autogrow, delay) : this.autogrow; | ||
this.autogrow(); | ||
this.element.addEventListener("input", this.autogrow); | ||
window.addEventListener("resize", this.onResize); | ||
} | ||
disconnect() { | ||
window.removeEventListener("resize", this.onResize); | ||
} | ||
autogrow() { | ||
this.element.style.height = "auto"; | ||
this.element.style.height = `${this.element.scrollHeight}px`; | ||
} | ||
} | ||
src_default.values = { | ||
resizeDebounceDelay: { | ||
type: Number, | ||
default: 100 | ||
} | ||
}; | ||
export { src_default as default }; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("stimulus")):"function"==typeof define&&define.amd?define(["stimulus"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["stimulus-textarea-autogrow"]=t(e.Stimulus)}(this,(function(e){"use strict";class t extends e.Controller{initialize(){this.autogrow=this.autogrow.bind(this)}connect(){this.element.style.overflow="hidden";const e=this.resizeDebounceDelayValue||100;this.onResize=e>0?function(e,t){let i;return(...s)=>{const o=this;clearTimeout(i),i=setTimeout((()=>e.apply(o,s)),t)}}(this.autogrow,e):this.autogrow,this.autogrow(),this.element.addEventListener("input",this.autogrow),window.addEventListener("resize",this.onResize)}disconnect(){window.removeEventListener("resize",this.onResize)}autogrow(){this.element.style.height="auto",this.element.style.height=`${this.element.scrollHeight}px`}}return t.values={resizeDebounceDelay:Number},t})); | ||
(function(e,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t(require("@hotwired/stimulus")):typeof define=="function"&&define.amd?define(["@hotwired/stimulus"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,e["stimulus-textarea-autogrow"]=t(e.Stimulus))})(this,function(e){"use strict";function t(o,i){let n;return(...u)=>{const r=this;clearTimeout(n),n=setTimeout(()=>o.apply(r,u),i)}}class s extends e.Controller{initialize(){this.autogrow=this.autogrow.bind(this)}connect(){this.element.style.overflow="hidden";const i=this.resizeDebounceDelayValue;this.onResize=i>0?t(this.autogrow,i):this.autogrow,this.autogrow(),this.element.addEventListener("input",this.autogrow),window.addEventListener("resize",this.onResize)}disconnect(){window.removeEventListener("resize",this.onResize)}autogrow(){this.element.style.height="auto",this.element.style.height=`${this.element.scrollHeight}px`}}return s.values={resizeDebounceDelay:{type:Number,default:100}},s}); |
{ | ||
"name": "stimulus-textarea-autogrow", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "A Stimulus controller for autogrowing textarea.", | ||
@@ -22,15 +22,15 @@ "repository": "git@github.com:stimulus-components/stimulus-textarea-autogrow.git", | ||
"devDependencies": { | ||
"@babel/core": "7.11.6", | ||
"@babel/plugin-syntax-class-properties": "7.10.4", | ||
"@babel/preset-env": "^7.14.2", | ||
"@babel/preset-typescript": "^7.13.0", | ||
"np": "^7.5.0", | ||
"prettier-standard": "16.3.0", | ||
"stimulus": "^2.0.0", | ||
"typescript": "^4.2.4", | ||
"vite": "^2.3.4" | ||
"@babel/core": "7.16.5", | ||
"@babel/plugin-syntax-class-properties": "7.12.13", | ||
"@babel/preset-env": "^7.16.5", | ||
"@babel/preset-typescript": "^7.16.5", | ||
"@hotwired/stimulus": "^3.0.1", | ||
"np": "^7.6.0", | ||
"prettier-standard": "16.4.1", | ||
"typescript": "^4.5.4", | ||
"vite": "^2.7.7" | ||
}, | ||
"peerDependencies": { | ||
"stimulus": "^2.0.0" | ||
"@hotwired/stimulus": "^3.0.1" | ||
} | ||
} |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
6623
40
0