view.js
1 lines
| 1 | import*as e from"@wordpress/interactivity";var t={2833(t,r,o){t.exports=(e=>{var t={};return o.d(t,e),t})({getContext:()=>e.getContext,store:()=>e.store})},4349(e,t,r){function o(e,t,r){const o=Number(e),n=Number(t);let a=Number(r);a=Number.isNaN(a)?o:a,a=Math.max(o,Math.min(a,n));const i=100*(a-o)/(n-o);return`calc(${i}% + (${16-.32*i}px))`}r.d(t,{h:()=>o})}},r={};function o(e){var n=r[e];if(void 0!==n)return n.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n=o(2833),a=o(4349);function i(e){return{min:void 0!==e.min?Number(e.min):0,max:void 0!==e.max?Number(e.max):100}}(0,n.store)("jetpack/form",{state:{get getSliderValue(){const e=(0,n.getContext)(),{min:t}=i(e);return e.fieldValue??e.default??t??0},get getSliderPosition(){const e=(0,n.getContext)(),{min:t,max:r}=i(e),o=e.fieldValue??e.default??t;return(0,a.h)(t,r,o)}},actions:{onSliderChange(e){(0,n.getContext)().fieldValue=e.target.value}}}); |