@warp-ds/elements 2.2.0-next.14 → 2.2.0-next.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +107 -99
- package/dist/packages/slider/index.js +19 -19
- package/dist/packages/slider/index.js.map +3 -3
- package/dist/packages/slider/slider-thumb.d.ts +2 -0
- package/dist/packages/slider/slider-thumb.js +15 -15
- package/dist/packages/slider/slider-thumb.js.map +3 -3
- package/dist/packages/slider/slider.js +3 -3
- package/dist/packages/slider/slider.js.map +2 -2
- package/dist/packages/slider/slider.test.js +21 -0
- package/dist/vscode.html-custom-data.json +18 -18
- package/dist/web-types.json +40 -35
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ie=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var U=a=>{throw TypeError(a)};var u=(a,o,e,r)=>{for(var n=r>1?void 0:r?se(o,e):o,p=a.length-1,g;p>=0;p--)(g=a[p])&&(n=(r?g(o,e,n):g(n))||n);return r&&n&&ie(o,e,n),n};var
|
|
1
|
+
var ie=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var U=a=>{throw TypeError(a)};var u=(a,o,e,r)=>{for(var n=r>1?void 0:r?se(o,e):o,p=a.length-1,g;p>=0;p--)(g=a[p])&&(n=(r?g(o,e,n):g(n))||n);return r&&n&&ie(o,e,n),n};var L=(a,o,e)=>o.has(a)||U("Cannot "+e);var B=(a,o,e)=>(L(a,o,"read from private field"),e?e.call(a):o.get(a)),R=(a,o,e)=>o.has(a)?U("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(a):o.set(a,e),G=(a,o,e,r)=>(L(a,o,"write to private field"),r?r.call(a,e):o.set(a,e),e),m=(a,o,e)=>(L(a,o,"access private method"),e);import{html as Q,LitElement as ee,nothing as le}from"lit";var s=function(a,o,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof o=="function"?a!==o||!r:!o.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(a):r?r.value:o.get(a)},d=function(a,o,e,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof o=="function"?a!==o||!n:!o.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(a,e):n?n.value=e:o.set(a,e),e};function D(a){var o,e,r,n,p,g,f,P,z,j,A,X,S,C,T,k,Z,I,N;class ae extends a{constructor(...t){var i,l,c;super(...t),o.add(this),this.internals=this.attachInternals(),e.set(this,!1),r.set(this,!1),n.set(this,!1),p.set(this,void 0),g.set(this,void 0),f.set(this,!0),z.set(this,""),j.set(this,()=>{d(this,n,!0,"f"),d(this,e,!0,"f"),s(this,o,"m",k).call(this)}),A.set(this,()=>{d(this,e,!1,"f"),s(this,o,"m",Z).call(this,this.shouldFormValueUpdate()?s(this,z,"f"):""),!this.validity.valid&&s(this,n,"f")&&d(this,r,!0,"f");let x=s(this,o,"m",k).call(this);this.validationMessageCallback&&this.validationMessageCallback(x?this.internals.validationMessage:"")}),X.set(this,()=>{var x;s(this,f,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),d(this,f,!1,"f")),d(this,n,!0,"f"),d(this,r,!0,"f"),s(this,o,"m",k).call(this),(x=this===null||this===void 0?void 0:this.validationMessageCallback)===null||x===void 0||x.call(this,this.showError?this.internals.validationMessage:"")}),S.set(this,void 0),C.set(this,!1),T.set(this,Promise.resolve()),(i=this.addEventListener)===null||i===void 0||i.call(this,"focus",s(this,j,"f")),(l=this.addEventListener)===null||l===void 0||l.call(this,"blur",s(this,A,"f")),(c=this.addEventListener)===null||c===void 0||c.call(this,"invalid",s(this,X,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let t=this.validators.map(c=>c.attribute).flat(),i=super.observedAttributes||[];return[...new Set([...i,...t])]}static getValidator(t){return this.validators.find(i=>i.attribute===t)||null}static getValidators(t){return this.validators.filter(i=>{var l;if(i.attribute===t||!((l=i.attribute)===null||l===void 0)&&l.includes(t))return!0})}get form(){return this.internals.form}get showError(){return s(this,o,"m",k).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(t,i,l){var c;(c=super.attributeChangedCallback)===null||c===void 0||c.call(this,t,i,l);let V=this.constructor.getValidators(t);V!=null&&V.length&&this.validationTarget&&this.setValue(s(this,z,"f"))}setValue(t){var i;d(this,r,!1,"f"),(i=this.validationMessageCallback)===null||i===void 0||i.call(this,""),d(this,z,t,"f");let c=this.shouldFormValueUpdate()?t:null;this.internals.setFormValue(c),s(this,o,"m",Z).call(this,c),this.valueChangedCallback&&this.valueChangedCallback(c),s(this,o,"m",k).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(t=>t(s(this,T,"f")))}formResetCallback(){var t,i;d(this,n,!1,"f"),d(this,r,!1,"f"),s(this,o,"m",k).call(this),(t=this.resetFormControl)===null||t===void 0||t.call(this),(i=this.validationMessageCallback)===null||i===void 0||i.call(this,s(this,o,"m",k).call(this)?this.validationMessage:"")}}return e=new WeakMap,r=new WeakMap,n=new WeakMap,p=new WeakMap,g=new WeakMap,f=new WeakMap,z=new WeakMap,j=new WeakMap,A=new WeakMap,X=new WeakMap,S=new WeakMap,C=new WeakMap,T=new WeakMap,o=new WeakSet,P=function(){let t=this.getRootNode(),i=`${this.localName}[name="${this.getAttribute("name")}"]`;return t.querySelectorAll(i)},k=function(){if(this.hasAttribute("disabled"))return!1;let t=s(this,r,"f")||s(this,n,"f")&&!this.validity.valid&&!s(this,e,"f");return t&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),t},Z=function(t){let i=this.constructor,l={},c=i.validators,x=[],V=c.some(v=>v.isValid instanceof Promise);s(this,C,"f")||(d(this,T,new Promise(v=>{d(this,S,v,"f")}),"f"),d(this,C,!0,"f")),s(this,p,"f")&&(s(this,p,"f").abort(),d(this,g,s(this,p,"f"),"f"));let M=new AbortController;d(this,p,M,"f");let Y,O=!1;c.length&&(c.forEach(v=>{let $=v.key||"customError",y=v.isValid(this,t,M.signal);y instanceof Promise?(x.push(y),y.then(q=>{q!=null&&(l[$]=!q,Y=s(this,o,"m",N).call(this,v,t),s(this,o,"m",I).call(this,l,Y))})):(l[$]=!y,this.validity[$]!==!y&&(O=!0),!y&&!Y&&(Y=s(this,o,"m",N).call(this,v,t)))}),Promise.allSettled(x).then(()=>{var v;M!=null&&M.signal.aborted||(d(this,C,!1,"f"),(v=s(this,S,"f"))===null||v===void 0||v.call(this))}),(O||!V)&&s(this,o,"m",I).call(this,l,Y))},I=function(t,i){if(this.validationTarget)this.internals.setValidity(t,i,this.validationTarget),d(this,f,!1,"f");else{if(this.internals.setValidity(t,i),this.internals.validity.valid)return;d(this,f,!0,"f")}},N=function(t,i){if(this.validityCallback){let l=this.validityCallback(t.key||"customError");if(l)return l}return t.message instanceof Function?t.message(this,i):t.message},ae}import{property as w}from"lit/decorators.js";import{css as H}from"lit";var J=H`
|
|
2
2
|
*,
|
|
3
3
|
:before,
|
|
4
4
|
:after {
|
|
@@ -2553,7 +2553,7 @@ var ie=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var U=a=>{th
|
|
|
2553
2553
|
bottom: 0;
|
|
2554
2554
|
grid-area: slider;
|
|
2555
2555
|
}
|
|
2556
|
-
`;var E,b,_,re,oe,
|
|
2556
|
+
`;var E,b,_,re,oe,W,te,h=class extends D(ee){constructor(){super(...arguments);R(this,b);this.disabled=!1;this.invalid=!1;this.required=!1;R(this,E)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.style.setProperty("--min",this.min),this.style.setProperty("--max",this.max),this.markers&&this.style.setProperty("--markers",String(this.markers));let e=getComputedStyle(this.shadowRoot.querySelector(".w-slider"));G(this,E,Number.parseFloat(e.getPropertyValue("--w-slider-thumb-size").replace("px",""))),m(this,b,_).call(this)}updated(e){(e.has("disabled")||e.has("invalid")||e.has("required")||e.has("min")||e.has("step")||e.has("max")||e.has("suffix")||e.has("formatter"))&&m(this,b,_).call(this)}render(){return Q`
|
|
2557
2557
|
<fieldset id="fieldset" class="w-slider" @input="${m(this,b,re)}" @slidervalidity="${m(this,b,oe)}">
|
|
2558
2558
|
<legend class="w-slider__label">
|
|
2559
2559
|
<slot id="label" name="label">${this.label}</slot>
|
|
@@ -2565,5 +2565,5 @@ var ie=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var U=a=>{th
|
|
|
2565
2565
|
<slot class="w-slider__slider" name="from" @slotchange=${m(this,b,_)}></slot>
|
|
2566
2566
|
<slot class="w-slider__slider" name="to" @slotchange=${m(this,b,_)}></slot>
|
|
2567
2567
|
</fieldset>
|
|
2568
|
-
`}};E=new WeakMap,b=new WeakSet,_=function(){let e=this.querySelectorAll("w-slider-thumb");for(let r of e.values())r.min=this.min,r.max=this.max,r.step=this.step,r.suffix=this.suffix,r.formatter=this.formatter,r.ariaLabel||(r.slot||(r.ariaLabel=this.label),r.slot==="from"&&(r.ariaLabel=`${this.label} min`),r.slot==="to"&&(r.ariaLabel=`${this.label} max`)),r.forceDisabled=this.disabled,r.forceInvalid=this.invalid,m(this,b,
|
|
2568
|
+
`}};E=new WeakMap,b=new WeakSet,_=function(){let e=this.querySelectorAll("w-slider-thumb");for(let r of e.values())r.min=this.min,r.max=this.max,r.step=this.step,r.suffix=this.suffix,r.required=this.required,r.formatter=this.formatter,r.ariaLabel||(r.slot||(r.ariaLabel=this.label),r.slot==="from"&&(r.ariaLabel=`${this.label} min`),r.slot==="to"&&(r.ariaLabel=`${this.label} max`)),r.forceDisabled=this.disabled,r.forceInvalid=this.invalid,m(this,b,W).call(this,r)},re=function(e){let r=e.target;m(this,b,W).call(this,r)},oe=function(e){e.stopPropagation(),this.invalid=e.detail.invalid},W=function(e){var n,p;let r=e.slot;if(r){let g=m(this,b,te).call(this),f=B(this,E),P=f-g;g<=f&&this.style.setProperty("--thumb-offset",String(P))}if(r||this.style.setProperty("--from","0"),r==="from"){let g=(n=e.value)!=null?n:e.value=this.min;this.style.setProperty("--from",g)}if(!r||r==="to"){let g=(p=e.value)!=null?p:e.value=this.max;this.style.setProperty("--to",g)}},te=function(){let e=window.getComputedStyle(this.shadowRoot.querySelector(".w-slider__active-range"),"::before").width;return Number.parseFloat(e.replace("px",""))},h.shadowRootOptions={...ee.shadowRootOptions,delegatesFocus:!0},h.styles=[J,K],u([w()],h.prototype,"label",2),u([w({type:Boolean,reflect:!0})],h.prototype,"disabled",2),u([w({type:Boolean,reflect:!0})],h.prototype,"invalid",2),u([w({type:Boolean,reflect:!0})],h.prototype,"required",2),u([w({reflect:!0})],h.prototype,"min",2),u([w({reflect:!0})],h.prototype,"max",2),u([w({type:Number})],h.prototype,"markers",2),u([w({type:Number})],h.prototype,"step",2),u([w()],h.prototype,"suffix",2),u([w({attribute:!1})],h.prototype,"formatter",2);customElements.get("w-slider")||customElements.define("w-slider",h);export{h as WarpSlider};
|
|
2569
2569
|
//# sourceMappingURL=slider.js.map
|