PageSourceSearch

https://www.hillhousehome.com/cdn/shop/t/552/assets/bundled-char-limit.directive.js

js hillhousehome.com collected 2026-09-24 22:11:04 UTC 4,162 bytes, 5 lines download raw bytes

1import { D as Directive, W as createElementWithAttributes, H as HostAttr, a as autobind } from './bundled-app.js';
2
3function t(t,e,i,s){var a,l=arguments.length,r=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var n=t.length-1;n>=0;n--)(a=t[n])&&(r=(l<3?a(r):l>3?a(e,i,r):a(e,i))||r);return l>3&&r&&Object.defineProperty(e,i,r),r}function e(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}class CharLimit extends Directive{onAppInit(){this.disableElement=document.querySelectorAll(this._disableElement),this.wrap(),this.bindEvents();}wrap(){let t={wrapper:createElementWithAttributes("div",{class:this.wrapperClass,"char-limit-holder":""}),textHolder:createElementWithAttributes("span",{class:["charLimit__status",`charLimit__status--${this.position}`,"charLimit__status--idle"]}),characterCount:createElementWithAttributes("span",{class:"charLimit__count"}),alertElement:createElementWithAttributes("span",{class:"charLimit__alert",role:"status","aria-hidden":"true","aria-live":"polite","aria-atomic":"true","aria-relevant":"all"})};"hard"===this.mode&&this.host.setAttribute("maxlength",this.limit.toString());let{wrapper:e,textHolder:i,characterCount:s,alertElement:a}=t;this.host.parentNode.insertBefore(e,this.host),e.appendChild(this.host),i.appendChild(s),i.appendChild(a),e.appendChild(i),Object.assign(this,{wrapperElement:t.wrapper,textHolder:t.textHolder,characterCountElement:t.characterCount,alertElement:t.alertElement});}bindEvents(){this.host.addEventListener("input",this.onInput),this.host.addEventListener("copy",this.onInput);}onInput(){this.host.value.length<=this.limit?this.saveValidState():this.restoreLastValidState(),0===this.host.value.length?this.disableElements():this.enableElements(),this.updateCharacterCount(),this.updateStatusClass(),this.updateAlert();}isAtLimit(){return this.limit-this.host.value.length==0}updateCharacterCount(){let{characterCountElement:t,limit:e}=this;t.innerText=`${this.host.value.length}/${e}`;}updateAlert(){this.alertElement.textContent=this.isAtLimit()?this.alert:"",this.alertElement.setAttribute("aria-hidden",this.isAtLimit()?"false":"true");}updateStatusClass(){let{textHolder:t}=this;t.classList.toggle("charLimit__status--over",this.isAtLimit()),t.classList.toggle("charLimit__status--idle",this.host.value.length<=2);}saveValidState(){this.lastValidState={value:this.host.value,selectionStart:this.host.selectionStart,selectionEnd:this.host.selectionEnd};}restoreLastValidState(){this.host.value=this.lastValidState.value,this.host.selectionStart=this.lastValidState.selectionStart,this.host.selectionEnd=this.lastValidState.selectionEnd;}disableElements(){for(let t=0;t<this.disableElement.length;t++)this.disableElement[t].disabled=!0;}enableElements(){for(let t=0;t<this.disableElement.length;t++)this.disableElement[t].disabled=!1;}constructor(...t){super(...t),this.limit=150,this.mode="soft",this.position="bottomRight",this.alert="The maximum character limit has been reached.",this.wrapperClass="charLimit__holder",this.lastValidState={value:"",selectionStart:0,selectionEnd:0};}}CharLimit.selector="[char-limit]",t([HostAttr("#char-limit"),e("design:type",Number)],CharLimit.prototype,"limit",void 0),t([HostAttr("char-limit-disable"),e("design:type",String)],CharLimit.prototype,"_disableElement",void 0),t([HostAttr("char-limit-mode"),e("design:type",String)],CharLimit.prototype,"mode",void 0),t([HostAttr("char-limit-position"),e("design:type",String)],CharLimit.prototype,"position",void 0),t([HostAttr("char-limit-alert"),e("design:type",String)],CharLimit.prototype,"alert",void 0),t([autobind,e("design:type",Function),e("design:paramtypes",[]),e("design:returntype",void 0)],CharLimit.prototype,"onInput",null),t([autobind,e("design:type",Function),e("design:paramtypes",[]),e("design:returntype",void 0)],CharLimit.prototype,"updateAlert",null),t([autobind,e("design:type",Function),e("design:paramtypes",[]),e("design:returntype",void 0)],CharLimit.prototype,"updateStatusClass",null);
4
5export { CharLimit };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.