frankenstyle 0.3.6 → 0.3.7-next.1
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.
|
@@ -392,7 +392,7 @@ var __COMPONENTS__=(function(o,c,Tt,te){"use strict";function ee(a){const t=Obje
|
|
|
392
392
|
|
|
393
393
|
${this.renderHidden()}
|
|
394
394
|
</div>
|
|
395
|
-
`}},D([u({type:Boolean})],o.InputPin.prototype,"autofocus",2),D([u({type:Number})],o.InputPin.prototype,"length",2),D([u({type:String,attribute:"input-mode"})],o.InputPin.prototype,"input-mode",2),D([u({type:String})],o.InputPin.prototype,"pattern",2),D([m()],o.InputPin.prototype,"$cls",2),D([m()],o.InputPin.prototype,"$stl",2),D([m()],o.InputPin.prototype,"$focus",2),D([m()],o.InputPin.prototype,"$pin",2),o.InputPin=D([_("uk-input-pin")],o.InputPin);var ze=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,E=(a,t,e,i)=>{for(var s=i>1?void 0:i?Be(t,e):t,n=a.length-1,r;n>=0;n--)(r=a[n])&&(s=(i?r(t,e,s):r(s))||s);return i&&s&&ze(t,e,s),s};o.InputRange=class extends N(v){constructor(){super(...arguments),this["cls-default-element"]="host-inner",this["stl-default-element"]="host-inner",this["input-event"]="uk-input-range:input",this.multiple=!1,this.min=0,this.max=100,this.step=1,this.label=!1,this["label-position"]="top",this["aria-label"]="",this._lowValue=this.min,this._highValue=this.max,this._label=!1,this.activeKnob=null,this.trackElement=null,this.isDragging=!1,this.defaultI18n={"aria-value-text":"Value: {value}","aria-range-text":"Range from {low} to {high}","low-knob-label":"Minimum value","high-knob-label":"Maximum value","aria-label":"Range slider"},this.$cls={"host-inner":"uk-input-range",runnable:"",fill:"",knob:"","knob-low":"","knob-high":"","knob-dragging":"",label:"","label-top":"","label-bottom":""},this.$stl={"host-inner":"",runnable:"",fill:"",knob:"","knob-low":"","knob-high":"",label:"","label-top":"","label-bottom":""},this.preventScrolling=t=>{this.isDragging&&t.preventDefault()},this.onPointerStart=(t,e)=>{this.disabled||(t.preventDefault(),t.stopPropagation(),this.activeKnob=e,this.isDragging=!0,t.currentTarget.focus(),document.addEventListener("pointermove",this.onPointerMove,{passive:!1}),document.addEventListener("pointerup",this.onPointerEnd),document.addEventListener("pointercancel",this.onPointerEnd),document.addEventListener("touchmove",this.onTouchMove,{passive:!1}),document.addEventListener("touchend",this.onPointerEnd),document.addEventListener("touchcancel",this.onPointerEnd))},this.onPointerMove=t=>{if(!this.isDragging||!this.activeKnob||this.disabled)return;t.preventDefault();const e=this.positionToValue(t.clientX);this.handleValueChange(this.activeKnob,e)},this.onTouchMove=t=>{if(!this.isDragging||!this.activeKnob||this.disabled)return;t.preventDefault();const e=this.positionToValue(t.touches[0].clientX);this.handleValueChange(this.activeKnob,e)},this.onPointerEnd=()=>{this.isDragging=!1,this.activeKnob=null,this.cleanupEventListeners()},this.onKeyDown=(t,e)=>{if(this.disabled)return;const i=e==="low"?this._lowValue:this._highValue;let s=0;switch(t.key){case"ArrowRight":case"ArrowUp":s=this.step;break;case"ArrowLeft":case"ArrowDown":s=-this.step;break;case"Home":this.handleValueChange(e,e==="low"?this.min:this._lowValue),t.preventDefault();return;case"End":this.handleValueChange(e,
|
|
395
|
+
`}},D([u({type:Boolean})],o.InputPin.prototype,"autofocus",2),D([u({type:Number})],o.InputPin.prototype,"length",2),D([u({type:String,attribute:"input-mode"})],o.InputPin.prototype,"input-mode",2),D([u({type:String})],o.InputPin.prototype,"pattern",2),D([m()],o.InputPin.prototype,"$cls",2),D([m()],o.InputPin.prototype,"$stl",2),D([m()],o.InputPin.prototype,"$focus",2),D([m()],o.InputPin.prototype,"$pin",2),o.InputPin=D([_("uk-input-pin")],o.InputPin);var ze=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,E=(a,t,e,i)=>{for(var s=i>1?void 0:i?Be(t,e):t,n=a.length-1,r;n>=0;n--)(r=a[n])&&(s=(i?r(t,e,s):r(s))||s);return i&&s&&ze(t,e,s),s};o.InputRange=class extends N(v){constructor(){super(...arguments),this["cls-default-element"]="host-inner",this["stl-default-element"]="host-inner",this["input-event"]="uk-input-range:input",this.multiple=!1,this.min=0,this.max=100,this.step=1,this.label=!1,this["label-position"]="top",this["aria-label"]="",this._lowValue=this.min,this._highValue=this.max,this._label=!1,this.activeKnob=null,this.trackElement=null,this.isDragging=!1,this.defaultI18n={"aria-value-text":"Value: {value}","aria-range-text":"Range from {low} to {high}","low-knob-label":"Minimum value","high-knob-label":"Maximum value","aria-label":"Range slider"},this.$cls={"host-inner":"uk-input-range",runnable:"",fill:"",knob:"","knob-low":"","knob-high":"","knob-dragging":"",label:"","label-top":"","label-bottom":""},this.$stl={"host-inner":"",runnable:"",fill:"",knob:"","knob-low":"","knob-high":"",label:"","label-top":"","label-bottom":""},this.preventScrolling=t=>{this.isDragging&&t.preventDefault()},this.onPointerStart=(t,e)=>{this.disabled||(t.preventDefault(),t.stopPropagation(),this.activeKnob=e,this.isDragging=!0,t.currentTarget.focus(),document.addEventListener("pointermove",this.onPointerMove,{passive:!1}),document.addEventListener("pointerup",this.onPointerEnd),document.addEventListener("pointercancel",this.onPointerEnd),document.addEventListener("touchmove",this.onTouchMove,{passive:!1}),document.addEventListener("touchend",this.onPointerEnd),document.addEventListener("touchcancel",this.onPointerEnd))},this.onPointerMove=t=>{if(!this.isDragging||!this.activeKnob||this.disabled)return;t.preventDefault();const e=this.positionToValue(t.clientX);this.handleValueChange(this.activeKnob,e)},this.onTouchMove=t=>{if(!this.isDragging||!this.activeKnob||this.disabled)return;t.preventDefault();const e=this.positionToValue(t.touches[0].clientX);this.handleValueChange(this.activeKnob,e)},this.onPointerEnd=()=>{this.isDragging=!1,this.activeKnob=null,this.cleanupEventListeners()},this.onKeyDown=(t,e)=>{if(this.disabled)return;const i=e==="low"?this._lowValue:this._highValue;let s=0;switch(t.key){case"ArrowRight":case"ArrowUp":s=this.step;break;case"ArrowLeft":case"ArrowDown":s=-this.step;break;case"Home":this.handleValueChange(e,e==="low"?this.min:this._lowValue),t.preventDefault();return;case"End":this.handleValueChange(e,this.max),t.preventDefault();return;case"PageUp":s=this.step*10;break;case"PageDown":s=-this.step*10;break;default:return}s&&(t.preventDefault(),this.handleValueChange(e,i+s))}}get $text(){return""}get $value(){return this.multiple?this.value.split(",").map(t=>t.trim()):this.value}get precision(){const t=this.step.toString();return t.includes(".")?t.split(".")[1].length:0}connectedCallback(){super.connectedCallback();const t=this.getAttribute("label");this._label=t===""?!0:t||!1,this.addEventListener("touchstart",this.preventScrolling,{passive:!1})}disconnectedCallback(){this.removeEventListener("touchstart",this.preventScrolling),this.cleanupEventListeners(),super.disconnectedCallback?.()}updated(t){(t.has("value")||t.has("multiple"))&&this.parseValue()}initializeValue(){this.value?this.parseValue():(this._lowValue=this.min,this._highValue=this.max,this.value=this.multiple?`${this.formatValue(this._lowValue)},${this.formatValue(this._highValue)}`:this.formatValue(this._lowValue))}parseValue(){if(this.multiple){const[t,e]=this.value.split(",").map(i=>parseFloat(i));t!==void 0&&e!==void 0&&(this._lowValue=this.clamp(t),this._highValue=this.clamp(e))}else this._lowValue=this.clamp(parseFloat(this.value))}formatValue(t){return t.toFixed(this.precision)}clamp(t){const e=Math.min(Math.max(t,this.min),this.max);return parseFloat(e.toFixed(this.precision))}valueToPercent(t){return(t-this.min)/(this.max-this.min)*100}positionToValue(t){this.trackElement||(this.trackElement=this.querySelector("[data-range-track]"));const e=this.trackElement.getBoundingClientRect(),i=Math.max(0,Math.min(1,(t-e.left)/e.width));return this.min+i*(this.max-this.min)}updateValue(){this.value=this.multiple?`${this.formatValue(this._lowValue)},${this.formatValue(this._highValue)}`:this.formatValue(this._lowValue),this.emit()}handleValueChange(t,e){const i=Math.round(e/this.step)*this.step,s=parseFloat(i.toFixed(this.precision));e=this.clamp(s),t==="low"?this._lowValue=this.multiple?Math.min(e,this._highValue):e:this._highValue=Math.max(e,this._lowValue),this.updateValue(),this.requestUpdate()}cleanupEventListeners(){document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerEnd),document.removeEventListener("pointercancel",this.onPointerEnd),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onPointerEnd),document.removeEventListener("touchcancel",this.onPointerEnd)}getAriaValueText(t){return this.multiple?this.getI18nText("aria-range-text",this.defaultI18n,{low:this.formatValue(this._lowValue),high:this.formatValue(this._highValue)}):this.getI18nText("aria-value-text",this.defaultI18n,{value:this.formatValue(t)})}getKnobAriaLabel(t){const e=t==="low"?"low-knob-label":"high-knob-label";return this.getI18nText(e,this.defaultI18n)}renderKnob(t){const e=t==="low"?this._lowValue:this._highValue,i=this.valueToPercent(e),s=t==="low"?this.min:this._lowValue,n=t==="low"?this.multiple?this._highValue:this.max:this.max,r=this.isDragging&&this.activeKnob===t,h=[this.$cls.knob||"uk-input-range-knob",this.$cls[t==="low"?"knob-low":"knob-high"]||"",r&&this.$cls["knob-dragging"]||""].filter(Boolean).join(" "),l=this["label-position"]==="top"?this.$cls["label-top"]||"uk-input-range-label-top":this.$cls["label-bottom"]||"uk-input-range-label-bottom";return c.html`
|
|
396
396
|
<button
|
|
397
397
|
type="button"
|
|
398
398
|
data-part="knob"
|
package/package.json
CHANGED