diff --git a/dist/plugins/tcrs-moving-tooltip.min.js b/dist/plugins/tcrs-moving-tooltip.min.js index 9e4656fd..73b3ea8f 100644 --- a/dist/plugins/tcrs-moving-tooltip.min.js +++ b/dist/plugins/tcrs-moving-tooltip.min.js @@ -4,7 +4,7 @@ https://github.com/mzusin/toolcool-range-slider MIT License Copyright (c) 2022-present, Miriam Zusin */ -(()=>{var _=o=>!isNaN(parseFloat(o))&&isFinite(o),a=(o,n)=>_(o)?Number(o):n;var A=o=>o==null?!1:typeof o=="boolean"?o:o.trim().toLowerCase()==="true";window.tcRangeSliderPlugins=window.tcRangeSliderPlugins||[];var S=40,U=35,O=30,q="#475569",X="#fff",j=20,w=()=>{let o=null,n=null,T=!1,c=S,v=U,h=O,I=q,P=X,b="",E="",L,f=[],r=null,y=null,Z=()=>{r==null||r.classList.toggle("is-after",c<=0)},J=()=>{var e;let t=(e=o==null?void 0:o.shadowRoot)==null?void 0:e.querySelector("#range-slider");r=document.createElement("div"),r.classList.add("tooltips"),t.prepend(r),Z()},H=t=>{let e=document.createElement("div");return e.style.zIndex=j.toString(),e.className=t,e},D=(t,e,u,s,d)=>{!t||(e==="vertical"?(t.style.left=`${-c}px`,t.style.top=s!=null?s:"0"):(t.style.left=u!=null?u:"0",t.style.top=`${-c}px`),t.style.width=`${v}px`,t.style.height=`${h}px`,t.style.background=I,t.style.color=P,t.style.zIndex=d.toString())},z=t=>{let e=t;return typeof L=="function"&&(e=L(t)),E==="prefix"?`${b}${e}`:`${e}${b}`},p=()=>{var s,d,i,g;let t=(s=n==null?void 0:n.getValues())!=null?s:[],e=(d=n==null?void 0:n.getPointerElements())!=null?d:[],u=(i=n==null?void 0:n.getType())!=null?i:"horizontal";if(!!t)for(let l=0;l{var e;let t=(e=n==null?void 0:n.getValues())!=null?e:[];if(!!t){for(let u=0;u{!o||(y=new ResizeObserver(t=>{for(let e of t)p()}),y.observe(o))},C=t=>{T=t,T?(J(),K(),Q()):N()},M=t=>{c=t,p()},F=t=>{v=t,p()},B=t=>{h=t,p()},R=t=>{I=t,p()},k=t=>{P=t,p()},G=t=>{b=t,p()},W=t=>{E=t,p()},Y=t=>{L=t,p()},V=t=>{var s,d;if(!T||!t.values)return;let e=(s=n==null?void 0:n.getPointerElements())!=null?s:[],u=(d=n==null?void 0:n.getType())!=null?d:"horizontal";for(let i=0;i{r==null||r.remove();for(let t of f)!t||t.remove();f=[],y==null||y.disconnect()};return{get name(){return"Moving Tooltip"},init:(t,e,u,s)=>{o=t,n=s,c=a(t.getAttribute("moving-tooltip-distance-to-pointer"),S),v=a(t.getAttribute("moving-tooltip-width"),U),h=a(t.getAttribute("moving-tooltip-height"),O),I=t.getAttribute("moving-tooltip-bg")||q,P=t.getAttribute("moving-tooltip-text-color")||X,b=t.getAttribute("moving-tooltip-units")||"",E=t.getAttribute("moving-tooltip-units-type")||"",C(A(t.getAttribute("moving-tooltip")))},update:V,onAttrChange:(t,e)=>{t==="moving-tooltip"&&C(A(e)),t==="moving-tooltip-distance-to-pointer"&&M(a(e,S)),t==="moving-tooltip-width"&&F(a(e,U)),t==="moving-tooltip-height"&&B(a(e,O)),t==="moving-tooltip-bg"&&R(e),t==="moving-tooltip-text-color"&&k(e),t==="moving-tooltip-units"&&G(e),t==="moving-tooltip-units-type"&&W(e)},gettersAndSetters:[{name:"movingTooltip",attributes:{get(){return T!=null?T:!1},set:t=>{C(A(t))}}},{name:"distanceToPointer",attributes:{get(){return c!=null?c:!1},set:t=>{M(a(t,S))}}},{name:"tooltipWidth",attributes:{get(){return v},set:t=>{F(a(t,U))}}},{name:"tooltipHeight",attributes:{get(){return h},set:t=>{B(a(t,O))}}},{name:"tooltipBg",attributes:{get(){return I},set:t=>{R(t)}}},{name:"tooltipTextColor",attributes:{get(){return P},set:t=>{k(t)}}},{name:"tooltipUnits",attributes:{get(){return b},set:t=>{G(t)}}},{name:"tooltipUnitType",attributes:{get(){return E},set:t=>{W(t)}}},{name:"formatTooltipValue",attributes:{get(){return L},set:t=>{Y(t)}}}],css:` +(()=>{var F=i=>!isNaN(parseFloat(i))&&isFinite(i),a=(i,n)=>F(i)?Number(i):n;var m=i=>i==null?!1:typeof i=="boolean"?i:i.trim().toLowerCase()==="true";window.tcRangeSliderPlugins=window.tcRangeSliderPlugins||[];var U=40,D="auto",O=30,Z="#475569",w="#fff",J=!1,K=20,Q=()=>{let i=null,n=null,T=!1,c=U,b=D,P=O,E=Z,L=w,x=J,v="",A="",H,f=[],r=null,h=null,Y=()=>{r==null||r.classList.toggle("is-after",c<=0)},V=()=>{var e;let t=(e=i==null?void 0:i.shadowRoot)==null?void 0:e.querySelector("#range-slider");r=document.createElement("div"),r.classList.add("tooltips"),t.prepend(r),Y()},M=t=>{let e=document.createElement("div");return e.style.zIndex=K.toString(),e.className=t,x&&(e.style.opacity="0"),e},S=(t,e,o,s,l)=>{!t||(e==="vertical"?(t.style.left=`${-c}px`,t.style.top=s!=null?s:"0"):(t.style.left=o!=null?o:"0",t.style.top=`${-c}px`),t.style.width=`${F(b)?b+"px":b}`,t.style.height=`${P}px`,t.style.background=E,t.style.color=L,t.style.zIndex=l.toString())},z=t=>{let e=t;return typeof H=="function"&&(e=H(t)),A==="prefix"?`${v}${e}`:`${e}${v}`},u=()=>{var s,l,g,I;let t=(s=n==null?void 0:n.getValues())!=null?s:[],e=(l=n==null?void 0:n.getPointerElements())!=null?l:[],o=(g=n==null?void 0:n.getType())!=null?g:"horizontal";if(!!t)for(let p=0;p{var e;let t=(e=n==null?void 0:n.getValues())!=null?e:[];if(!!t){for(let o=0;o{!i||(h=new ResizeObserver(t=>{for(let e of t)u()}),h.observe(i))},C=t=>{T=t,T?(V(),$(),_()):j()},B=t=>{c=t,u()},R=t=>{b=t,u()},N=t=>{P=t,u()},k=t=>{E=t,u()},G=t=>{L=t,u()},W=t=>{v=t,u()},q=t=>{x=t,u()},X=t=>{A=t,u()},tt=t=>{H=t,u()},et=t=>{var I,p,y;if(!T||!t.values)return;let e=(I=n==null?void 0:n.getPointerElements())!=null?I:[],o=(p=n==null?void 0:n.getActivePointerIndex())!=null?p:void 0,s=(y=n==null?void 0:n.getType())!=null?y:"horizontal";if(o===void 0)return;let l=t.values[o],g=f[o];if(l===void 0&&!!g&&(g.remove(),f[o]=void 0),l!==void 0&&!g){let d=M(`tooltip tooltip-${o+1}`),nt=(l!=null?l:"").toString();d.textContent=z(nt),d.style.position="absolute",S(d,s,e[o].style.left,e[o].style.top,e[o].style.zIndex),f[o]=d,r==null||r.append(d)}if(g){let d=(l!=null?l:"").toString();g.textContent=z(d),x&&(g.style.opacity=(n==null?void 0:n.getEventName())==="mouseup"||(n==null?void 0:n.getEventName())==="touchend"?"0":"1"),S(g,s,e[o].style.left,e[o].style.top,e[o].style.zIndex)}},j=()=>{r==null||r.remove();for(let t of f)!t||t.remove();f=[],h==null||h.disconnect()};return{get name(){return"Moving Tooltip"},init:(t,e,o,s)=>{i=t,n=s,c=a(t.getAttribute("moving-tooltip-distance-to-pointer"),U),b=a(t.getAttribute("moving-tooltip-width"),D),P=a(t.getAttribute("moving-tooltip-height"),O),E=t.getAttribute("moving-tooltip-bg")||Z,L=t.getAttribute("moving-tooltip-text-color")||w,v=t.getAttribute("moving-tooltip-units")||"",x=m(t.getAttribute("moving-tooltip-hidden"))||J,A=t.getAttribute("moving-tooltip-units-type")||"",C(m(t.getAttribute("moving-tooltip")))},update:et,onAttrChange:(t,e)=>{t==="moving-tooltip"&&C(m(e)),t==="moving-tooltip-distance-to-pointer"&&B(a(e,U)),t==="moving-tooltip-width"&&R(a(e,D)),t==="moving-tooltip-height"&&N(a(e,O)),t==="moving-tooltip-bg"&&k(e),t==="moving-tooltip-text-color"&&G(e),t==="moving-tooltip-units"&&W(e),t==="moving-tooltip-hidden"&&q(m(e)),t==="moving-tooltip-units-type"&&X(e)},gettersAndSetters:[{name:"movingTooltip",attributes:{get(){return T!=null?T:!1},set:t=>{C(m(t))}}},{name:"distanceToPointer",attributes:{get(){return c!=null?c:!1},set:t=>{B(a(t,U))}}},{name:"tooltipWidth",attributes:{get(){return b},set:t=>{R(a(t,D))}}},{name:"tooltipHeight",attributes:{get(){return P},set:t=>{N(a(t,O))}}},{name:"tooltipBg",attributes:{get(){return E},set:t=>{k(t)}}},{name:"tooltipTextColor",attributes:{get(){return L},set:t=>{G(t)}}},{name:"tooltipUnits",attributes:{get(){return v},set:t=>{W(t)}}},{name:"tooltipHidden",attributes:{get(){return x},set:t=>{q(m(t))}}},{name:"tooltipUnitType",attributes:{get(){return A},set:t=>{X(t)}}},{name:"formatTooltipValue",attributes:{get(){return H},set:t=>{tt(t)}}}],css:` .tooltip{ background: #475569; color: #fff; @@ -16,7 +16,8 @@ Copyright (c) 2022-present, Miriam Zusin text-align: center; transform: translate(-50%, -50%); pointer-events: none; - z-index: ${j}; + padding: 0 4px; + z-index: ${K}; } .tooltip::after { @@ -47,4 +48,4 @@ Copyright (c) 2022-present, Miriam Zusin .animate-on-click .tooltip{ transition: all var(--animate-onclick); } - `,destroy:N}};window.tcRangeSliderPlugins.push(w);var it=w;})(); + `,destroy:j}};window.tcRangeSliderPlugins.push(Q);var lt=Q;})(); diff --git a/dist/plugins/tcrs-moving-tooltip.min.js.map b/dist/plugins/tcrs-moving-tooltip.min.js.map index c403da03..17b9e0b9 100644 --- a/dist/plugins/tcrs-moving-tooltip.min.js.map +++ b/dist/plugins/tcrs-moving-tooltip.min.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../../src/core/domain/math-provider.ts", "../../src/plugins/moving-tooltip-plugin/index.ts"], - "sourcesContent": ["/**\n * scale a range [min,max] to [a,b]\n * f(x) = (b - a) * (x - min) / (max - min) + a\n */\nexport const convertRange = (min: number, max: number, a: number, b: number, x: number) => {\n const temp = (max - min);\n if(temp === 0) return a;\n return ((b - a) * (x - min)) / temp + a;\n};\n\n// eslint-disable-next-line\nexport const isNumber = (input: any) => {\n return !isNaN(parseFloat(input)) && isFinite(input);\n};\n\n// the below function should receive any\n// eslint-disable-next-line\nexport const getNumber = (input: any, defaultValue: any) : number => {\n return isNumber(input) ? Number(input) : defaultValue;\n};\n\n/**\n * Round up to the next multiple of X,\n * where X is the step provided by the user.\n */\nexport const roundToStep = (num: number, step: number) => {\n return step === 0 ? 0 : Math.round(num / step) * step;\n};\n\n/**\n * round to decimal places\n * https://stackoverflow.com/questions/11832914/how-to-round-to-at-most-2-decimal-places-if-necessary\n */\nexport const setDecimalPlaces = (num: number, decimalPlaces = Infinity) => {\n if (decimalPlaces === Infinity) return num;\n\n const coeff = 10 ** decimalPlaces;\n return Math.round(num * coeff) / coeff;\n};\n\nexport const getBoolean = (val: string | null | undefined | boolean) => {\n if(val === null || val === undefined) return false;\n if(typeof val === 'boolean') return val;\n return val.trim().toLowerCase() === 'true';\n};\n", "import { IPlugin, IPluginGetters, IPluginSetters, IPluginUpdateData } from '../../core/plugins/interfaces';\nimport RangeSlider from '../../core';\nimport { getBoolean, getNumber } from '../../core/domain/math-provider';\n\n/**\n * Moving Tooltip Plugin.\n * Important: the plugin script should be included BEFORE the core script.\n */\n\n/**\n * Required: init ToolCool Range Slider plugins namespace if not defined yet\n */\nwindow.tcRangeSliderPlugins = window.tcRangeSliderPlugins || [];\n\nconst DISTANCE_TO_POINTER_DEFAULT = 40; // px\nconst DEFAULT_TOOLTIP_WIDTH = 35;\nconst DEFAULT_TOOLTIP_HEIGHT = 30;\nconst DEFAULT_TOOLTIP_BG = '#475569';\nconst DEFAULT_TOOLTIP_TEXT_COLOR = '#fff';\nconst DEFAULT_Z_INDEX = 20;\n\nconst MovingTooltipPlugin = () : IPlugin => {\n\n let $component: HTMLElement | null = null;\n let getters: IPluginGetters | null = null;\n\n let enabled = false;\n let distanceToPointer = DISTANCE_TO_POINTER_DEFAULT; // px\n let tooltipWidth = DEFAULT_TOOLTIP_WIDTH;\n let tooltipHeight = DEFAULT_TOOLTIP_HEIGHT;\n let tooltipBg = DEFAULT_TOOLTIP_BG;\n let tooltipTextColor = DEFAULT_TOOLTIP_TEXT_COLOR;\n let tooltipUnits = '';\n let unitType = '';\n\n // https://github.com/mzusin/toolcool-range-slider/issues/16\n let formatTooltipValue: ((value: string | number | undefined) => string) | undefined = undefined;\n\n let $tooltips: (HTMLElement | undefined)[] = [];\n let $tooltipsRow: HTMLElement | null = null;\n let resizeObserver: ResizeObserver | null = null;\n\n const updateRowClass = () => {\n $tooltipsRow?.classList.toggle('is-after', distanceToPointer <= 0);\n };\n\n const createTooltipsRow = () => {\n const $slider = $component?.shadowRoot?.querySelector('#range-slider') as HTMLElement;\n $tooltipsRow = document.createElement('div');\n $tooltipsRow.classList.add('tooltips');\n $slider.prepend($tooltipsRow);\n updateRowClass();\n };\n\n const createTooltip = (className: string) => {\n const $tooltip = document.createElement('div');\n $tooltip.style.zIndex = DEFAULT_Z_INDEX.toString();\n $tooltip.className = className;\n return $tooltip;\n };\n\n const updateTooltip = ($tooltip: HTMLElement, type: string, left: string, top: string, zIndex: string|number) => {\n if(!$tooltip) return;\n\n if(type === 'vertical'){\n $tooltip.style.left = `${ -distanceToPointer }px`;\n $tooltip.style.top = top ?? '0';\n }\n else{\n $tooltip.style.left = left ?? '0';\n $tooltip.style.top = `${ -distanceToPointer }px`;\n }\n\n $tooltip.style.width = `${ tooltipWidth }px`;\n $tooltip.style.height = `${ tooltipHeight }px`;\n $tooltip.style.background = tooltipBg;\n $tooltip.style.color = tooltipTextColor;\n $tooltip.style.zIndex = zIndex.toString();\n };\n\n const getTooltipText = (text: string) => {\n let tooltipText = text;\n if(typeof formatTooltipValue === 'function') {\n tooltipText = formatTooltipValue(text);\n }\n return unitType === 'prefix' ? `${ tooltipUnits }${ tooltipText }` : `${ tooltipText }${ tooltipUnits }`;\n };\n\n const updateTooltips = () => {\n const values = getters?.getValues() ?? [];\n const $pointers = getters?.getPointerElements() ?? [];\n const type = getters?.getType() ?? 'horizontal';\n\n if(!values) return;\n\n for(let i=0; i {\n const values = getters?.getValues() ?? [];\n\n if(!values) return;\n\n for(let i=0; i {\n if(!$component) return;\n resizeObserver = new ResizeObserver(entries => {\n // eslint-disable-next-line\n for (const _entry of entries) {\n updateTooltips();\n }\n });\n resizeObserver.observe($component);\n };\n\n const toggleEnabled = (_enabled: boolean) => {\n enabled = _enabled;\n\n if(!enabled){\n destroy();\n }\n else{\n createTooltipsRow();\n createTooltips();\n initResizeObserver();\n }\n };\n\n const setDistanceToPointer = (newDistance: number) => {\n distanceToPointer = newDistance;\n updateTooltips();\n };\n\n const setTooltipWidth = (newWidth: number) => {\n tooltipWidth = newWidth;\n updateTooltips();\n };\n\n const setTooltipHeight = (newHeight: number) => {\n tooltipHeight = newHeight;\n updateTooltips();\n };\n\n const setTooltipBg = (newValue: string) => {\n tooltipBg = newValue;\n updateTooltips();\n };\n\n const setTooltipTextColor = (newValue: string) => {\n tooltipTextColor = newValue;\n updateTooltips();\n };\n\n const setTooltipUnits = (newValue: string) => {\n tooltipUnits = newValue;\n updateTooltips();\n };\n\n const setUnitType = (newValue: string) => {\n unitType = newValue;\n updateTooltips();\n };\n\n const setFormatTooltipValue = (newFunc: ((value: string | number | undefined) => string) | undefined) => {\n formatTooltipValue = newFunc;\n updateTooltips();\n };\n\n const update = (data: IPluginUpdateData) => {\n\n if(!enabled || !data.values) return;\n\n const $pointers = getters?.getPointerElements() ?? [];\n const type = getters?.getType() ?? 'horizontal';\n\n for(let i=0; i {\n $tooltipsRow?.remove();\n\n for(const $tooltip of $tooltips){\n if(!$tooltip) continue;\n $tooltip.remove();\n }\n\n $tooltips = [];\n\n resizeObserver?.disconnect();\n };\n\n return {\n\n /**\n * Required: unique plugin name\n */\n get name() {\n return 'Moving Tooltip';\n },\n\n /**\n * Optional: plugin initialization\n */\n init: (\n _$component,\n _requestUpdate,\n _setters: IPluginSetters,\n _getters: IPluginGetters\n ) => {\n $component = _$component;\n getters = _getters;\n\n distanceToPointer = getNumber(_$component.getAttribute('moving-tooltip-distance-to-pointer'), DISTANCE_TO_POINTER_DEFAULT);\n tooltipWidth = getNumber(_$component.getAttribute('moving-tooltip-width'), DEFAULT_TOOLTIP_WIDTH);\n tooltipHeight = getNumber(_$component.getAttribute('moving-tooltip-height'), DEFAULT_TOOLTIP_HEIGHT);\n tooltipBg = _$component.getAttribute('moving-tooltip-bg') || DEFAULT_TOOLTIP_BG;\n tooltipTextColor = _$component.getAttribute('moving-tooltip-text-color') || DEFAULT_TOOLTIP_TEXT_COLOR;\n tooltipUnits = _$component.getAttribute('moving-tooltip-units') || '';\n unitType = _$component.getAttribute('moving-tooltip-units-type') || '';\n toggleEnabled(getBoolean(_$component.getAttribute('moving-tooltip')));\n },\n\n /**\n * Optional:\n * this will be called each time\n * range slider updates pointer positions or other properties\n */\n update,\n\n /**\n * Optional:\n * this will be called each time observed HTML attribute changes;\n * observed attributes are defined in window.tcRangeSliderObservedAttr array above.\n */\n onAttrChange: (_attrName: string, _newValue: string) => {\n if(_attrName === 'moving-tooltip'){\n toggleEnabled(getBoolean(_newValue));\n }\n\n if(_attrName === 'moving-tooltip-distance-to-pointer'){\n setDistanceToPointer(getNumber(_newValue, DISTANCE_TO_POINTER_DEFAULT));\n }\n\n if(_attrName === 'moving-tooltip-width'){\n setTooltipWidth(getNumber(_newValue, DEFAULT_TOOLTIP_WIDTH));\n }\n\n if(_attrName === 'moving-tooltip-height'){\n setTooltipHeight(getNumber(_newValue, DEFAULT_TOOLTIP_HEIGHT));\n }\n\n if(_attrName === 'moving-tooltip-bg'){\n setTooltipBg(_newValue);\n }\n\n if(_attrName === 'moving-tooltip-text-color'){\n setTooltipTextColor(_newValue);\n }\n\n if(_attrName === 'moving-tooltip-units'){\n setTooltipUnits(_newValue);\n }\n\n if(_attrName === 'moving-tooltip-units-type'){\n setUnitType(_newValue);\n }\n },\n\n /**\n * Optional:\n * List of getters and setter that can be used to create slider API.\n */\n gettersAndSetters: [\n {\n name: 'movingTooltip',\n attributes: {\n get () {\n return enabled ?? false;\n },\n\n set: (_enabled) => {\n toggleEnabled(getBoolean(_enabled));\n },\n }\n },\n\n {\n name: 'distanceToPointer',\n attributes: {\n get () {\n return distanceToPointer ?? false;\n },\n\n set: (_value) => {\n setDistanceToPointer(getNumber(_value, DISTANCE_TO_POINTER_DEFAULT));\n },\n }\n },\n\n {\n name: 'tooltipWidth',\n attributes: {\n get () {\n return tooltipWidth;\n },\n\n set: (_value) => {\n setTooltipWidth(getNumber(_value, DEFAULT_TOOLTIP_WIDTH));\n },\n }\n },\n\n {\n name: 'tooltipHeight',\n attributes: {\n get () {\n return tooltipHeight;\n },\n\n set: (_value) => {\n setTooltipHeight(getNumber(_value, DEFAULT_TOOLTIP_HEIGHT));\n },\n }\n },\n\n {\n name: 'tooltipBg',\n attributes: {\n get () {\n return tooltipBg;\n },\n\n set: (_value) => {\n setTooltipBg(_value);\n },\n }\n },\n\n {\n name: 'tooltipTextColor',\n attributes: {\n get () {\n return tooltipTextColor;\n },\n\n set: (_value) => {\n setTooltipTextColor(_value);\n },\n }\n },\n\n {\n name: 'tooltipUnits',\n attributes: {\n get () {\n return tooltipUnits;\n },\n\n set: (_value) => {\n setTooltipUnits(_value);\n },\n }\n },\n\n {\n name: 'tooltipUnitType',\n attributes: {\n get () {\n return unitType;\n },\n\n set: (_value) => {\n setUnitType(_value);\n },\n }\n },\n\n // https://github.com/mzusin/toolcool-range-slider/issues/16\n {\n name: 'formatTooltipValue',\n attributes: {\n get () {\n return formatTooltipValue;\n },\n\n set: (_func) => {\n setFormatTooltipValue(_func);\n },\n }\n },\n ],\n\n css: `\n.tooltip{\n background: #475569;\n color: #fff;\n font-size: 0.8rem;\n border-radius: 3px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n transform: translate(-50%, -50%);\n pointer-events: none;\n z-index: ${ DEFAULT_Z_INDEX };\n} \n\n.tooltip::after {\n content: '';\n position: absolute;\n width: 7px;\n height: 6px;\n transform: translate(0%, -50%) rotate(45deg);\n background-color: inherit;\n z-index: -1;\n top: 100%;\n}\n\n.is-after .tooltip::after {\n top: 0;\n}\n\n.type-vertical .tooltip::after{\n transform: translate(-50%, 0%) rotate(45deg);\n left: 100%;\n top: auto;\n}\n\n.type-vertical .is-after .tooltip::after{\n left: 0%;\n}\n\n.animate-on-click .tooltip{\n transition: all var(--animate-onclick);\n}\n `,\n\n destroy,\n };\n};\n\n/**\n * Required: add current plugin to the plugins list.\n */\nwindow.tcRangeSliderPlugins.push(MovingTooltipPlugin);\n\nexport default MovingTooltipPlugin;\n\n/**\n * export dynamic properties\n */\nexport interface IMovingTooltipPlugin extends RangeSlider{\n movingTooltip: boolean;\n distanceToPointer: number;\n tooltipWidth: number;\n tooltipHeight: number;\n tooltipBg: string;\n tooltipTextColor: string;\n tooltipUnits: string;\n tooltipUnitType: string;\n\n // https://github.com/mzusin/toolcool-range-slider/issues/16\n formatTooltipValue?: (value: string | number | undefined) => string;\n}\n"], - "mappings": ";;;;;;MAWO,IAAMA,EAAYC,GAChB,CAAC,MAAM,WAAWA,CAAK,CAAC,GAAK,SAASA,CAAK,EAKvCC,EAAY,CAACD,EAAYE,IAC7BH,EAASC,CAAK,EAAI,OAAOA,CAAK,EAAIE,EAsBpC,IAAMC,EAAcC,GACtBA,GAAQ,KAAkC,GAC1C,OAAOA,GAAQ,UAAkBA,EAC7BA,EAAI,KAAK,EAAE,YAAY,IAAM,OC/BtC,OAAO,qBAAuB,OAAO,sBAAwB,CAAC,EAE9D,IAAMC,EAA8B,GAC9BC,EAAwB,GACxBC,EAAyB,GACzBC,EAAqB,UACrBC,EAA6B,OAC7BC,EAAkB,GAElBC,EAAsB,IAAgB,CAE1C,IAAIC,EAAiC,KACjCC,EAAiC,KAEjCC,EAAU,GACVC,EAAoBV,EACpBW,EAAeV,EACfW,EAAgBV,EAChBW,EAAYV,EACZW,EAAmBV,EACnBW,EAAe,GACfC,EAAW,GAGXC,EAEAC,EAAyC,CAAC,EAC1CC,EAAmC,KACnCC,EAAwC,KAEtCC,EAAiB,IAAM,CAC3BF,GAAA,MAAAA,EAAc,UAAU,OAAO,WAAYT,GAAqB,EAClE,EAEMY,EAAoB,IAAM,CA9ClC,IAAAC,EA+CI,IAA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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAiCV,QAAA4C,CACF,CACF,EAKA,OAAO,qBAAqB,KAAK3C,CAAmB,EAEpD,IAAOsE,GAAQtE", - "names": ["isNumber", "input", "getNumber", "defaultValue", "getBoolean", "val", "DISTANCE_TO_POINTER_DEFAULT", "DEFAULT_TOOLTIP_WIDTH", "DEFAULT_TOOLTIP_HEIGHT", "DEFAULT_TOOLTIP_BG", "DEFAULT_TOOLTIP_TEXT_COLOR", "DEFAULT_Z_INDEX", "MovingTooltipPlugin", "$component", "getters", "enabled", "distanceToPointer", "tooltipWidth", "tooltipHeight", "tooltipBg", "tooltipTextColor", "tooltipUnits", "unitType", "formatTooltipValue", "$tooltips", "$tooltipsRow", "resizeObserver", "updateRowClass", "createTooltipsRow", "_a", "$slider", "createTooltip", "className", "$tooltip", "updateTooltip", "type", "left", "top", "zIndex", "getTooltipText", "text", "tooltipText", "updateTooltips", "_b", "_c", "_d", "values", "$pointers", "i", "createTooltips", "initResizeObserver", "entries", "_entry", "toggleEnabled", "_enabled", "destroy", "setDistanceToPointer", "newDistance", "setTooltipWidth", "newWidth", "setTooltipHeight", "newHeight", "setTooltipBg", "newValue", "setTooltipTextColor", "setTooltipUnits", "setUnitType", "setFormatTooltipValue", "newFunc", "update", "data", "value", "_$component", "_requestUpdate", "_setters", "_getters", "getNumber", "getBoolean", "_attrName", "_newValue", "_value", "_func", "moving_tooltip_plugin_default"] + "sourcesContent": ["/**\n * scale a range [min,max] to [a,b]\n * f(x) = (b - a) * (x - min) / (max - min) + a\n */\nexport const convertRange = (min: number, max: number, a: number, b: number, x: number) => {\n const temp = (max - min);\n if(temp === 0) return a;\n return ((b - a) * (x - min)) / temp + a;\n};\n\n// eslint-disable-next-line\nexport const isNumber = (input: any) => {\n return !isNaN(parseFloat(input)) && isFinite(input);\n};\n\n// the below function should receive any\n// eslint-disable-next-line\nexport const getNumber = (input: any, defaultValue: any) : number => {\n return isNumber(input) ? Number(input) : defaultValue;\n};\n\n/**\n * Round up to the next multiple of X,\n * where X is the step provided by the user.\n */\nexport const roundToStep = (num: number, step: number) => {\n return step === 0 ? 0 : Math.round(num / step) * step;\n};\n\n/**\n * round to decimal places\n * https://stackoverflow.com/questions/11832914/how-to-round-to-at-most-2-decimal-places-if-necessary\n */\nexport const setDecimalPlaces = (num: number, decimalPlaces = Infinity) => {\n if (decimalPlaces === Infinity) return num;\n\n const coeff = 10 ** decimalPlaces;\n return Math.round(num * coeff) / coeff;\n};\n\nexport const getBoolean = (val: string | null | undefined | boolean) => {\n if(val === null || val === undefined) return false;\n if(typeof val === 'boolean') return val;\n return val.trim().toLowerCase() === 'true';\n};\n", "import { IPlugin, IPluginGetters, IPluginSetters, IPluginUpdateData } from '../../core/plugins/interfaces';\nimport RangeSlider from '../../core';\nimport { getBoolean, getNumber, isNumber } from '../../core/domain/math-provider';\n\n/**\n * Moving Tooltip Plugin.\n * Important: the plugin script should be included BEFORE the core script.\n */\n\n/**\n * Required: init ToolCool Range Slider plugins namespace if not defined yet\n */\nwindow.tcRangeSliderPlugins = window.tcRangeSliderPlugins || [];\n\nconst DISTANCE_TO_POINTER_DEFAULT = 40; // px\nconst DEFAULT_TOOLTIP_WIDTH = 'auto';\nconst DEFAULT_TOOLTIP_HEIGHT = 30;\nconst DEFAULT_TOOLTIP_BG = '#475569';\nconst DEFAULT_TOOLTIP_TEXT_COLOR = '#fff';\nconst DEFAULT_TOOLTIP_HIDDEN = false;\nconst DEFAULT_Z_INDEX = 20;\n\nconst MovingTooltipPlugin = () : IPlugin => {\n\n let $component: HTMLElement | null = null;\n let getters: IPluginGetters | null = null;\n\n let enabled = false;\n let distanceToPointer = DISTANCE_TO_POINTER_DEFAULT; // px\n let tooltipWidth: string | number = DEFAULT_TOOLTIP_WIDTH;\n let tooltipHeight = DEFAULT_TOOLTIP_HEIGHT;\n let tooltipBg = DEFAULT_TOOLTIP_BG;\n let tooltipTextColor = DEFAULT_TOOLTIP_TEXT_COLOR;\n let tooltipHidden = DEFAULT_TOOLTIP_HIDDEN;\n let tooltipUnits = '';\n let unitType = '';\n\n // https://github.com/mzusin/toolcool-range-slider/issues/16\n let formatTooltipValue: ((value: string | number | undefined) => string) | undefined = undefined;\n\n let $tooltips: (HTMLElement | undefined)[] = [];\n let $tooltipsRow: HTMLElement | null = null;\n let resizeObserver: ResizeObserver | null = null;\n\n const updateRowClass = () => {\n $tooltipsRow?.classList.toggle('is-after', distanceToPointer <= 0);\n };\n\n const createTooltipsRow = () => {\n const $slider = $component?.shadowRoot?.querySelector('#range-slider') as HTMLElement;\n $tooltipsRow = document.createElement('div');\n $tooltipsRow.classList.add('tooltips');\n $slider.prepend($tooltipsRow);\n\n updateRowClass();\n };\n\n const createTooltip = (className: string) => {\n const $tooltip = document.createElement('div');\n $tooltip.style.zIndex = DEFAULT_Z_INDEX.toString();\n $tooltip.className = className;\n\n if (tooltipHidden) {\n $tooltip.style.opacity = '0';\n }\n\n return $tooltip;\n };\n\n const updateTooltip = ($tooltip: HTMLElement, type: string, left: string, top: string, zIndex: string|number) => {\n if(!$tooltip) return;\n\n if(type === 'vertical'){\n $tooltip.style.left = `${ -distanceToPointer }px`;\n $tooltip.style.top = top ?? '0';\n }\n else{\n $tooltip.style.left = left ?? '0';\n $tooltip.style.top = `${ -distanceToPointer }px`;\n }\n\n $tooltip.style.width = `${ isNumber(tooltipWidth) ? tooltipWidth + 'px' : tooltipWidth }`;\n $tooltip.style.height = `${ tooltipHeight }px`;\n $tooltip.style.background = tooltipBg;\n $tooltip.style.color = tooltipTextColor;\n $tooltip.style.zIndex = zIndex.toString();\n };\n\n const getTooltipText = (text: string) => {\n let tooltipText = text;\n if(typeof formatTooltipValue === 'function') {\n tooltipText = formatTooltipValue(text);\n }\n return unitType === 'prefix' ? `${ tooltipUnits }${ tooltipText }` : `${ tooltipText }${ tooltipUnits }`;\n };\n\n const updateTooltips = () => {\n const values = getters?.getValues() ?? [];\n const $pointers = getters?.getPointerElements() ?? [];\n const type = getters?.getType() ?? 'horizontal';\n\n if(!values) return;\n\n for(let i=0; i {\n const values = getters?.getValues() ?? [];\n\n if(!values) return;\n\n for(let i=0; i {\n if(!$component) return;\n resizeObserver = new ResizeObserver(entries => {\n // eslint-disable-next-line\n for (const _entry of entries) {\n updateTooltips();\n }\n });\n resizeObserver.observe($component);\n };\n\n const toggleEnabled = (_enabled: boolean) => {\n enabled = _enabled;\n\n if(!enabled){\n destroy();\n }\n else{\n createTooltipsRow();\n createTooltips();\n initResizeObserver();\n }\n };\n\n const setDistanceToPointer = (newDistance: number) => {\n distanceToPointer = newDistance;\n updateTooltips();\n };\n\n const setTooltipWidth = (newWidth: number | string) => {\n tooltipWidth = newWidth;\n updateTooltips();\n };\n\n const setTooltipHeight = (newHeight: number) => {\n tooltipHeight = newHeight;\n updateTooltips();\n };\n\n const setTooltipBg = (newValue: string) => {\n tooltipBg = newValue;\n updateTooltips();\n };\n\n const setTooltipTextColor = (newValue: string) => {\n tooltipTextColor = newValue;\n updateTooltips();\n };\n\n const setTooltipUnits = (newValue: string) => {\n tooltipUnits = newValue;\n updateTooltips();\n };\n\n const settooltipHidden = (newValue: boolean) => {\n tooltipHidden = newValue;\n updateTooltips();\n };\n\n const setUnitType = (newValue: string) => {\n unitType = newValue;\n updateTooltips();\n };\n\n const setFormatTooltipValue = (newFunc: ((value: string | number | undefined) => string) | undefined) => {\n formatTooltipValue = newFunc;\n updateTooltips();\n };\n\n const update = (data: IPluginUpdateData) => {\n if(!enabled || !data.values) return;\n\n const $pointers = getters?.getPointerElements() ?? [];\n const activePointerIndex = getters?.getActivePointerIndex() ?? undefined;\n const type = getters?.getType() ?? 'horizontal';\n\n if (activePointerIndex === undefined) return;\n\n const value = data.values[activePointerIndex];\n const $tooltip = $tooltips[activePointerIndex];\n\n if(value === undefined && !!$tooltip){\n $tooltip.remove();\n $tooltips[activePointerIndex] = undefined;\n }\n\n if(value !== undefined && !$tooltip){\n\n const $tooltip = createTooltip(`tooltip tooltip-${ activePointerIndex + 1 }`);\n const text = (value ?? '').toString();\n $tooltip.textContent = getTooltipText(text);\n $tooltip.style.position = 'absolute';\n updateTooltip($tooltip, type, $pointers[activePointerIndex].style.left, $pointers[activePointerIndex].style.top, $pointers[activePointerIndex].style.zIndex);\n\n $tooltips[activePointerIndex] = $tooltip;\n $tooltipsRow?.append($tooltip);\n }\n\n if ($tooltip) {\n const text = (value ?? '').toString();\n $tooltip.textContent = getTooltipText(text);\n\n if (tooltipHidden) {\n $tooltip.style.opacity = getters?.getEventName() === 'mouseup' || getters?.getEventName() === 'touchend' ? '0' : '1'\n }\n\n updateTooltip($tooltip, type, $pointers[activePointerIndex].style.left, $pointers[activePointerIndex].style.top, $pointers[activePointerIndex].style.zIndex);\n }\n };\n\n const destroy = () => {\n $tooltipsRow?.remove();\n\n for(const $tooltip of $tooltips){\n if(!$tooltip) continue;\n $tooltip.remove();\n }\n\n $tooltips = [];\n\n resizeObserver?.disconnect();\n };\n\n return {\n\n /**\n * Required: unique plugin name\n */\n get name() {\n return 'Moving Tooltip';\n },\n\n /**\n * Optional: plugin initialization\n */\n init: (\n _$component,\n _requestUpdate,\n _setters: IPluginSetters,\n _getters: IPluginGetters\n ) => {\n $component = _$component;\n getters = _getters;\n\n distanceToPointer = getNumber(_$component.getAttribute('moving-tooltip-distance-to-pointer'), DISTANCE_TO_POINTER_DEFAULT);\n tooltipWidth = getNumber(_$component.getAttribute('moving-tooltip-width'), DEFAULT_TOOLTIP_WIDTH);\n tooltipHeight = getNumber(_$component.getAttribute('moving-tooltip-height'), DEFAULT_TOOLTIP_HEIGHT);\n tooltipBg = _$component.getAttribute('moving-tooltip-bg') || DEFAULT_TOOLTIP_BG;\n tooltipTextColor = _$component.getAttribute('moving-tooltip-text-color') || DEFAULT_TOOLTIP_TEXT_COLOR;\n tooltipUnits = _$component.getAttribute('moving-tooltip-units') || '';\n tooltipHidden = getBoolean(_$component.getAttribute('moving-tooltip-hidden')) || DEFAULT_TOOLTIP_HIDDEN\n unitType = _$component.getAttribute('moving-tooltip-units-type') || '';\n toggleEnabled(getBoolean(_$component.getAttribute('moving-tooltip')));\n },\n\n /**\n * Optional:\n * this will be called each time\n * range slider updates pointer positions or other properties\n */\n update,\n\n /**\n * Optional:\n * this will be called each time observed HTML attribute changes;\n * observed attributes are defined in window.tcRangeSliderObservedAttr array above.\n */\n onAttrChange: (_attrName: string, _newValue: string) => {\n if(_attrName === 'moving-tooltip'){\n toggleEnabled(getBoolean(_newValue));\n }\n\n if(_attrName === 'moving-tooltip-distance-to-pointer'){\n setDistanceToPointer(getNumber(_newValue, DISTANCE_TO_POINTER_DEFAULT));\n }\n\n if(_attrName === 'moving-tooltip-width'){\n setTooltipWidth(getNumber(_newValue, DEFAULT_TOOLTIP_WIDTH));\n }\n\n if(_attrName === 'moving-tooltip-height'){\n setTooltipHeight(getNumber(_newValue, DEFAULT_TOOLTIP_HEIGHT));\n }\n\n if(_attrName === 'moving-tooltip-bg'){\n setTooltipBg(_newValue);\n }\n\n if(_attrName === 'moving-tooltip-text-color'){\n setTooltipTextColor(_newValue);\n }\n\n if(_attrName === 'moving-tooltip-units'){\n setTooltipUnits(_newValue);\n }\n\n if(_attrName === 'moving-tooltip-hidden'){\n settooltipHidden(getBoolean(_newValue));\n }\n\n if(_attrName === 'moving-tooltip-units-type'){\n setUnitType(_newValue);\n }\n },\n\n /**\n * Optional:\n * List of getters and setter that can be used to create slider API.\n */\n gettersAndSetters: [\n {\n name: 'movingTooltip',\n attributes: {\n get () {\n return enabled ?? false;\n },\n\n set: (_enabled) => {\n toggleEnabled(getBoolean(_enabled));\n },\n }\n },\n\n {\n name: 'distanceToPointer',\n attributes: {\n get () {\n return distanceToPointer ?? false;\n },\n\n set: (_value) => {\n setDistanceToPointer(getNumber(_value, DISTANCE_TO_POINTER_DEFAULT));\n },\n }\n },\n\n {\n name: 'tooltipWidth',\n attributes: {\n get () {\n return tooltipWidth;\n },\n\n set: (_value) => {\n setTooltipWidth(getNumber(_value, DEFAULT_TOOLTIP_WIDTH));\n },\n }\n },\n\n {\n name: 'tooltipHeight',\n attributes: {\n get () {\n return tooltipHeight;\n },\n\n set: (_value) => {\n setTooltipHeight(getNumber(_value, DEFAULT_TOOLTIP_HEIGHT));\n },\n }\n },\n\n {\n name: 'tooltipBg',\n attributes: {\n get () {\n return tooltipBg;\n },\n\n set: (_value) => {\n setTooltipBg(_value);\n },\n }\n },\n\n {\n name: 'tooltipTextColor',\n attributes: {\n get () {\n return tooltipTextColor;\n },\n\n set: (_value) => {\n setTooltipTextColor(_value);\n },\n }\n },\n\n {\n name: 'tooltipUnits',\n attributes: {\n get () {\n return tooltipUnits;\n },\n\n set: (_value) => {\n setTooltipUnits(_value);\n },\n }\n },\n\n {\n name: 'tooltipHidden',\n attributes: {\n get () {\n return tooltipHidden;\n },\n\n set: (_value) => {\n settooltipHidden(getBoolean(_value));\n },\n }\n },\n\n {\n name: 'tooltipUnitType',\n attributes: {\n get () {\n return unitType;\n },\n\n set: (_value) => {\n setUnitType(_value);\n },\n }\n },\n\n // https://github.com/mzusin/toolcool-range-slider/issues/16\n {\n name: 'formatTooltipValue',\n attributes: {\n get () {\n return formatTooltipValue;\n },\n\n set: (_func) => {\n setFormatTooltipValue(_func);\n },\n }\n },\n ],\n\n css: `\n.tooltip{\n background: #475569;\n color: #fff;\n font-size: 0.8rem;\n border-radius: 3px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n transform: translate(-50%, -50%);\n pointer-events: none;\n padding: 0 4px;\n z-index: ${ DEFAULT_Z_INDEX };\n} \n\n.tooltip::after {\n content: '';\n position: absolute;\n width: 7px;\n height: 6px;\n transform: translate(0%, -50%) rotate(45deg);\n background-color: inherit;\n z-index: -1;\n top: 100%;\n}\n\n.is-after .tooltip::after {\n top: 0;\n}\n\n.type-vertical .tooltip::after{\n transform: translate(-50%, 0%) rotate(45deg);\n left: 100%;\n top: auto;\n}\n\n.type-vertical .is-after .tooltip::after{\n left: 0%;\n}\n\n.animate-on-click .tooltip{\n transition: all var(--animate-onclick);\n}\n `,\n\n destroy,\n };\n};\n\n/**\n * Required: add current plugin to the plugins list.\n */\nwindow.tcRangeSliderPlugins.push(MovingTooltipPlugin);\n\nexport default MovingTooltipPlugin;\n\n/**\n * export dynamic properties\n */\nexport interface IMovingTooltipPlugin extends RangeSlider{\n movingTooltip: boolean;\n distanceToPointer: number;\n tooltipWidth: number;\n tooltipHeight: number;\n tooltipBg: string;\n tooltipTextColor: string;\n tooltipUnits: string;\n tooltipHidden: boolean;\n tooltipUnitType: string;\n\n // https://github.com/mzusin/toolcool-range-slider/issues/16\n formatTooltipValue?: (value: string | number | undefined) => string;\n}\n"], + "mappings": ";;;;;;MAWO,IAAMA,EAAYC,GAChB,CAAC,MAAM,WAAWA,CAAK,CAAC,GAAK,SAASA,CAAK,EAKvCC,EAAY,CAACD,EAAYE,IAC7BH,EAASC,CAAK,EAAI,OAAOA,CAAK,EAAIE,EAsBpC,IAAMC,EAAcC,GACtBA,GAAQ,KAAkC,GAC1C,OAAOA,GAAQ,UAAkBA,EAC7BA,EAAI,KAAK,EAAE,YAAY,IAAM,OC/BtC,OAAO,qBAAuB,OAAO,sBAAwB,CAAC,EAE9D,IAAMC,EAA8B,GAC9BC,EAAwB,OACxBC,EAAyB,GACzBC,EAAqB,UACrBC,EAA6B,OAC7BC,EAAyB,GACzBC,EAAkB,GAElBC,EAAsB,IAAgB,CAE1C,IAAIC,EAAiC,KACjCC,EAAiC,KAEjCC,EAAU,GACVC,EAAoBX,EACpBY,EAAgCX,EAChCY,EAAgBX,EAChBY,EAAYX,EACZY,EAAmBX,EACnBY,EAAgBX,EAChBY,EAAe,GACfC,EAAW,GAGXC,EAEAC,EAAyC,CAAC,EAC1CC,EAAmC,KACnCC,EAAwC,KAEtCC,EAAiB,IAAM,CAC3BF,GAAA,MAAAA,EAAc,UAAU,OAAO,WAAYV,GAAqB,EAClE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WAAY,CACV,KAAO,CACL,OAAO9D,CACT,EAEA,IAAM8D,GAAW,CACfjB,EAAgBiB,CAAM,CACxB,CACF,CACF,EAEA,CACE,KAAM,gBACN,WAAY,CACV,KAAO,CACL,OAAO/D,CACT,EAEA,IAAM+D,GAAW,CACfhB,EAAiBa,EAAWG,CAAM,CAAC,CACrC,CACF,CACF,EAEA,CACE,KAAM,kBACN,WAAY,CACV,KAAO,CACL,OAAO7D,CACT,EAEA,IAAM6D,GAAW,CACff,EAAYe,CAAM,CACpB,CACF,CACF,EAGA,CACE,KAAM,qBACN,WAAY,CACV,KAAO,CACL,OAAO5D,CACT,EAEA,IAAM6D,GAAU,CACdf,GAAsBe,CAAK,CAC7B,CACF,CACF,CACF,EAEA,IAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAaK1E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAiCV,QAAA8C,CACF,CACF,EAKA,OAAO,qBAAqB,KAAK7C,CAAmB,EAEpD,IAAO0E,GAAQ1E", + "names": ["isNumber", "input", "getNumber", "defaultValue", "getBoolean", "val", "DISTANCE_TO_POINTER_DEFAULT", "DEFAULT_TOOLTIP_WIDTH", "DEFAULT_TOOLTIP_HEIGHT", "DEFAULT_TOOLTIP_BG", "DEFAULT_TOOLTIP_TEXT_COLOR", "DEFAULT_TOOLTIP_HIDDEN", "DEFAULT_Z_INDEX", "MovingTooltipPlugin", "$component", "getters", "enabled", "distanceToPointer", "tooltipWidth", "tooltipHeight", "tooltipBg", "tooltipTextColor", "tooltipHidden", "tooltipUnits", "unitType", "formatTooltipValue", "$tooltips", "$tooltipsRow", "resizeObserver", "updateRowClass", "createTooltipsRow", "_a", "$slider", "createTooltip", "className", "$tooltip", "updateTooltip", "type", "left", "top", "zIndex", "isNumber", "getTooltipText", "text", "tooltipText", "updateTooltips", "_b", "_c", "_d", "values", "$pointers", "i", "createTooltips", "initResizeObserver", "entries", "_entry", "toggleEnabled", "_enabled", "destroy", "setDistanceToPointer", "newDistance", "setTooltipWidth", "newWidth", "setTooltipHeight", "newHeight", "setTooltipBg", "newValue", "setTooltipTextColor", "setTooltipUnits", "settooltipHidden", "setUnitType", "setFormatTooltipValue", "newFunc", "update", "data", "activePointerIndex", "value", "_$component", "_requestUpdate", "_setters", "_getters", "getNumber", "getBoolean", "_attrName", "_newValue", "_value", "_func", "moving_tooltip_plugin_default"] } diff --git a/dist/toolcool-range-slider.min.js b/dist/toolcool-range-slider.min.js index ee5b0aec..564701f0 100644 --- a/dist/toolcool-range-slider.min.js +++ b/dist/toolcool-range-slider.min.js @@ -4,5 +4,5 @@ https://github.com/mzusin/toolcool-range-slider MIT License Copyright (c) 2022-present, Miriam Zusin */ -(()=>{var jn=Object.defineProperty;var Et=Math.pow,qn=(r,i,t)=>i in r?jn(r,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[i]=t;var ae=(r,i,t)=>(qn(r,typeof i!="symbol"?i+"":i,t),t);var St=(r,i)=>` ${i&&i.length>0?i.map(t=>``).join(""):""}
`;var Tt=":host{--width:300px;--height:.25rem;--opacity:.4;--panel-bg:#cbd5e1;--panel-bg-hover:#94a3b8;--panel-bg-fill:#475569;--panel-bg-border-radius:1rem;--pointer-width:1rem;--pointer-height:1rem;--pointer-bg:#fff;--pointer-bg-hover:#dcdcdc;--pointer-bg-focus:#dcdcdc;--pointer-shadow:0 0 2px rgba(0,0,0,0.8);--pointer-shadow-hover:0 0 2px #000;--pointer-shadow-focus:var(--pointer-shadow-hover);--pointer-border:1px solid hsla(0,0%,88%,0.5);--pointer-border-hover:1px solid #94a3b8;--pointer-border-focus:var(--pointer-border-hover);--pointer-border-radius:100%;--animate-onclick:.3s}:host{max-width:100%}.range-slider-box{display:flex;position:relative;flex-direction:column}.range-slider{position:relative;width:var(--width,100%);height:var(--height,0.25rem);touch-action:none;max-width:100%;box-sizing:border-box;cursor:pointer}.row{width:100%;display:flex;align-items:center}.range-slider.disabled{opacity:var(--opacity,0.4);cursor:default}.pointer.disabled{-webkit-filter:brightness(0.8);filter:brightness(0.8);cursor:default}.range-slider *{box-sizing:border-box}.container{position:absolute;width:100%;height:100%}.panel{position:absolute;z-index:10;width:100%;height:100%;background:var(--panel-bg,#2d4373);border-radius:var(--panel-bg-border-radius,1rem);overflow:hidden;transition:.3s all ease}.panel-fill{background:var(--panel-bg-fill,#000);border-radius:var(--panel-bg-border-radius,1rem);overflow:hidden;height:100%;position:absolute;z-index:10}.panel:hover{background:var(--panel-bg-hover,#5f79b7)}.disabled .panel:hover{background:var(--panel-bg,#5f79b7)}.pointer{position:absolute;z-index:20;outline:0;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.pointer-shape{background:var(--pointer-bg,#fff);background-size:contain;box-shadow:var(--pointer-shadow);border:var(--pointer-border);border-radius:var(--pointer-border-radius,100%);-webkit-transform:translateX(-50%);transform:translateX(-50%);width:var(--pointer-width,15px);height:var(--pointer-height,15px);transition:.3s all ease}.pointer-shape:hover{background:var(--pointer-bg-hover,#fff);background-size:contain;border:var(--pointer-border-hover);box-shadow:var(--pointer-shadow-hover)}.disabled .pointer-shape:hover{background:var(--pointer-bg,#fff);background-size:contain;border:var(--pointer-border);box-shadow:var(--pointer-shadow)}.pointer:focus .pointer-shape{background:var(--pointer-bg-focus,#fff);background-size:contain;border:var(--pointer-border-focus);box-shadow:var(--pointer-shadow-focus)}.disabled .pointer:focus .pointer-shape{background:var(--pointer-bg,#fff);background-size:contain;border:var(--pointer-border);box-shadow:var(--pointer-shadow)}.type-vertical .range-slider{--width:.25rem;--height:300px;max-height:100%}.type-vertical .range-slider .pointer{left:50%}.type-vertical .range-slider .panel-fill{width:100%}.type-vertical.range-slider-box{flex-direction:row}.type-vertical .row{flex-direction:column}.animate-on-click .pointer,.animate-on-click .panel-fill{transition:all var(--animate-onclick)}.range-dragging .panel-fill{cursor:move}";var le="pointers-overlap",ue="pointers-min-distance",de="pointers-max-distance",ce="range-dragging",pe="data",be="min",ge="max",fe="step",me="round",he="type",ve="theme",ye="rtl",xe="btt",Pe="disabled",Ee="keyboard-disabled",Se="mousewheel-disabled",At="slider-width",Mt="slider-height",wt="slider-radius",Dt="slider-bg",Lt="slider-bg-hover",Ct="slider-bg-fill",kt="pointer-width",Ht="pointer-height",It="pointer-radius",Rt="pointer-bg",Ot="pointer-bg-hover",Bt="pointer-bg-focus",Ft="pointer-shadow",Nt="pointer-shadow-hover",Vt="pointer-shadow-focus",Ut="pointer-border",zt="pointer-border-hover",Wt="pointer-border-focus",Te="animate-onclick",Kt="css-links";var I="vertical",V="horizontal";var we=(r,i,t,n,s)=>{let d=i-r;return d===0?t:(n-t)*(s-r)/d+t},B=r=>!isNaN(parseFloat(r))&&isFinite(r),E=(r,i)=>B(r)?Number(r):i,Qe=(r,i)=>i===0?0:Math.round(r/i)*i,jt=(r,i=1/0)=>{if(i===1/0)return r;let t=Et(10,i);return Math.round(r*t)/t},D=r=>r==null?!1:typeof r=="boolean"?r:r.trim().toLowerCase()==="true";var qt=(r,i)=>{r.dispatchEvent(new CustomEvent("onPointerClicked",{detail:{$pointer:i}}))},Xt=(r,i)=>{r.dispatchEvent(new CustomEvent("onMouseDown",{detail:{nativeEvent:i}}))},Gt=(r,i)=>{r.dispatchEvent(new CustomEvent("onMouseUp",{detail:{nativeEvent:i}}))},Yt=(r,i)=>{r.dispatchEvent(new CustomEvent("onKeyDown",{detail:{nativeEvent:i}}))},Zt=(r,i)=>{if(!i||i.length<=0)return;let t=i.map(s=>B(s)?E(s,s):s),n={values:t||[]};n.value=t[0],n.value0=t[0],n.value1=t[0];for(let s=1;s{let n=0,s,d,m,l,a=!1,f=(g,S,L,P,A,k)=>{let F=n;L!==void 0&&g>L&&(g=L),S!==void 0&&gg===i||i.contains(g),p=(g,S,L,P)=>{s=g,d=S,m=L,l=P},b=g=>{a=g,i.classList.toggle("disabled",a),a?i.setAttribute("aria-disabled","true"):i.hasAttribute("aria-disabled")&&i.removeAttribute("aria-disabled")},T=(g,S)=>{S==null?i.removeAttribute(g):i.setAttribute(g,S)},C=g=>i.getAttribute(g),c=g=>{if(!a){switch(g.key){case"ArrowLeft":{g.preventDefault(),typeof s=="function"&&s(t);break}case"ArrowRight":{g.preventDefault(),typeof d=="function"&&d(t);break}case"ArrowUp":{g.preventDefault(),typeof m=="function"&&m(t);break}case"ArrowDown":{g.preventDefault(),typeof l=="function"&&l(t);break}}Yt(r,g)}},h=()=>{a||qt(r,i)};return i.className=`pointer pointer-${t}`,i.addEventListener("keydown",c),i.addEventListener("click",h),{$pointer:i,get percent(){return n},get disabled(){return a},set disabled(g){b(g)},updatePosition:f,isClicked:x,setCallbacks:p,setAttr:T,getAttr:C,destroy:()=>{i.removeEventListener("keydown",c),i.removeEventListener("click",h),i.remove()}}};var Jt=r=>{if(r==null)return;if(Array.isArray(r))return r;if(r.trim()==="")return;let t=r.split(","),n=[],s=!0;for(let d=0;dNumber(d)):n},Qt=(r,i)=>i?i.findIndex(t=>t===r||t.toString().trim()===r.toString().trim()):-1;var _t=r=>({updatePosition:(t,n,s,d)=>{if(n.length<=0)return;let m=n.length===1,l=n[0],a=n[n.length-1];t===I?(r.style.removeProperty("width"),r.style.removeProperty("right"),r.style.removeProperty("left"),m?r.style.height=`${l}%`:r.style.height=`${Math.abs(l-a)}%`,d?(r.style.bottom="0%",m?r.style.top="auto":r.style.top=`${Math.min(100-a,100-l)}%`):(r.style.bottom="auto",m?r.style.top="0%":r.style.top=`${Math.min(l,a)}%`)):(r.style.removeProperty("height"),r.style.removeProperty("top"),r.style.removeProperty("bottom"),m?r.style.width=`${l}%`:r.style.width=`${Math.abs(l-a)}%`,s?(r.style.right="0%",m?r.style.left="auto":r.style.left=`${Math.min(100-a,100-l)}%`):(r.style.right="auto",m?r.style.left="0%":r.style.left=`${Math.min(l,a)}%`))}});var _e="--animate-onclick",$t="--width",en="--height",tn="--panel-bg-border-radius",nn="--panel-bg",rn="--panel-bg-hover",on="--panel-bg-fill",sn="--pointer-width",an="--pointer-height",ln="--pointer-border-radius",un="--pointer-bg",dn="--pointer-bg-hover",cn="--pointer-bg-focus",pn="--pointer-shadow",bn="--pointer-shadow-hover",gn="--pointer-shadow-focus",fn="--pointer-border",mn="--pointer-border-hover",hn="--pointer-border-focus";var q=(r,i,t)=>{let n=new Map;for(let s of r.attributes){let d=s.nodeName.trim().toLowerCase();if(!i.test(d))continue;let l=d.replace(/\D/g,"").trim(),a=l===""||l==="0"||l==="1"?0:E(l,0)-1,f=t&&typeof t=="function"?t(s.value):s.value;n.set(a,f)}return n},yn=r=>{if(!r)return null;let i=r.getAttribute(Kt);if(!i)return null;let t=i.split(";"),n=[];for(let s of t)s.trim()!==""&&n.push(s.trim());return n};var $e=[[$t,At,"sliderWidth",null],[en,Mt,"sliderHeight",null],[tn,wt,"sliderRadius",null],[nn,Dt,"sliderBg",null],[rn,Lt,"sliderBgHover",null],[on,Ct,"sliderBgFill",null],[sn,kt,"pointer#Width",/^pointer([0-9]*)-width$/],[an,Ht,"pointer#Height",/^pointer([0-9]*)-height$/],[ln,It,"pointer#Radius",/^pointer([0-9]*)-radius$/],[un,Rt,"pointer#Bg",/^pointer([0-9]*)-bg$/],[dn,Ot,"pointer#BgHover",/^pointer([0-9]*)-bg-hover$/],[cn,Bt,"pointer#BgFocus",/^pointer([0-9]*)-bg-focus$/],[pn,Ft,"pointer#Shadow",/^pointer([0-9]*)-shadow$/],[bn,Nt,"pointer#ShadowHover",/^pointer([0-9]*)-shadow-hover$/],[gn,Vt,"pointer#ShadowFocus",/^pointer([0-9]*)-shadow-focus$/],[fn,Ut,"pointer#Border",/^pointer([0-9]*)-border$/],[mn,zt,"pointer#BorderHover",/^pointer([0-9]*)-border-hover$/],[hn,Wt,"pointer#BorderFocus",/^pointer([0-9]*)-border-focus$/]],xn=(r,i,t)=>{let n=null,s=[],d=new Map,m=(c,h=i)=>{let w=[...h.classList];for(let g of w)g.startsWith(c)&&i.classList.remove(g)},l=()=>{m("shape");let c=i.querySelectorAll(".pointer");for(let h of c)m("shape",h)},a=c=>{n=c,m("theme-"),typeof c=="string"&&i.classList.add(`theme-${c}`)},f=()=>{if(l(),!(s.length<=0)){i.classList.add("shape",`shape-${s[0]}`);for(let c=1;c{s[c]=h,f()},p=()=>{l();let c=q(r,/^pointer([0-9]*)-shape$/);if(!(c.size<=0)){for(let h of c){let w=h[0];s[w]=h[1]}f()}},b=(c,h)=>`${c}-${h}`,T=(c,h,w)=>{let g=t[w];if(!g)return;let S=w===0?i:g.$pointer;if(h==null){d.has(b(c,w))&&d.delete(b(c,w)),S.style.removeProperty(c);return}d.set(b(c,w),h),S.style.setProperty(c,h)},C=(c,h)=>d.get(b(c,h));return(()=>{for(let c of $e){let[h,w,g,S]=c;if(S){let P=q(r,S);for(let A of P){let k=A[0],F=A[1];T(h,F,k)}}else{let P=r.getAttribute(w);T(h,P,0)}let L=[];if(g.indexOf("#")===-1)L.push([g,0]);else{L.push([g.replace("#",""),0]),L.push([g.replace("#","0"),0]),L.push([g.replace("#","1"),0]);for(let P=1;P{T(h,F,k)}})}catch(A){console.error(A)}}a(r.getAttribute(ve)),p()})(),{setStyle:T,getStyle:C,get theme(){return n},set theme(c){a(c)},get pointerShapes(){return s},setPointerShape:x}};var K="animate-on-click",et="range-dragging";var Pn=(r,i,t,n)=>{let s=[],d=p=>{for(let b of s)b.update&&typeof b.update=="function"&&b.update(p)},m=()=>{for(let p of s)p.destroy&&typeof p.destroy=="function"&&p.destroy()},l=(p,b)=>{for(let T of s)T.onAttrChange&&typeof T.onAttrChange=="function"&&T.onAttrChange(p,b)},a=p=>{if(!!p.gettersAndSetters){for(let b of p.gettersAndSetters)if(!(!b.name||!b.attributes))try{Object.prototype.hasOwnProperty.call(r,b.name)||Object.defineProperty(r,b.name,b.attributes)}catch(T){console.error("defineSettersGetters error:",T)}}},f=p=>{var T;if(!p.css)return;let b=(T=r.shadowRoot)==null?void 0:T.querySelector("style");!b||(b.innerHTML+=p.css)};return{init:()=>{if(!!window.tcRangeSliderPlugins)for(let p of window.tcRangeSliderPlugins){let b=p();s.push(b),b.init&&typeof b.init=="function"&&(b.init(r,i,t,n),a(b),f(b))}},update:d,onAttrChange:l,destroy:m}};var Yn=10,En=20,Sn=(r,i)=>{let t=new Map,n=/^value([0-9]*)$/;for(let l of r.attributes){let a=l.nodeName.trim().toLowerCase();if(!n.test(a))continue;let x=a.replace("value","").trim(),p=x===""||x==="0"||x==="1"?0:E(x,0)-1,b=B(l.value)?E(l.value,0):l.value;t.set(p,b)}let s=Math.max(...Array.from(t.keys())),d=[];d.push([Y(r,i,0),t.get(0)]);let m=i;for(let l=1;l<=s;l++){let a=i.cloneNode(!0);m.after(a),m=a,d.push([Y(r,a,l),t.get(l)])}return d},tt=(r,i,t,n,s,d,m)=>{try{Object.defineProperty(r,n,{configurable:!0,get(){if(!i)return;let l=i.pointers[t];if(!l)return;let a=i.getTextValue(l.percent);return B(a)?E(a,a):a},set:l=>{i.pointers[t]?i==null||i.setValue(l,t):i==null||i.addPointer(l)}}),Object.defineProperty(r,s,{configurable:!0,get(){var l,a;return(a=(l=i==null?void 0:i.pointers[t])==null?void 0:l.getAttr("aria-label"))!=null?a:void 0},set:l=>{!i||i.setAriaLabel(t,l)}}),Object.defineProperty(r,d,{configurable:!0,get(){var l,a;return(a=(l=i==null?void 0:i.styles)==null?void 0:l.pointerShapes[t])!=null?a:null},set:l=>{!i||!i.styles||i.styles.setPointerShape(t,l)}}),Object.defineProperty(r,m,{configurable:!0,get(){var l;return(l=i==null?void 0:i.pointers[t].disabled)!=null?l:!1},set:l=>{if(!i)return;let a=i==null?void 0:i.pointers[t];!a||(a.disabled=l)}})}catch(l){console.error(l)}},Tn=(r,i)=>{let t=[["value","ariaLabel","pointerShape","pointerDisabled",0],["value0","ariaLabel0","pointerShape0","pointer0Disabled",0],["value1","ariaLabel1","pointerShape1","pointer1Disabled",0]];for(let n=2;n{var s;let n=(s=t.shadowRoot)==null?void 0:s.querySelector(".container");if(!!n)for(let d of r)i?n.prepend(d.$pointer):n.append(d.$pointer)},An=(r,i)=>{if(!(!i||r.length<=1)){for(let t of r)t.$pointer.style.zIndex=En.toString();i.$pointer.style.zIndex=(En*2).toString()}};var rt=0,Z=100,U=2,Mn="0.3s",wn=(r,i,t)=>{let n=t.map(e=>e[0]),s=null,d=null,m=null,l=null,a=rt,f=Z,x,p,b=V,T=U,C=!1,c=!1,h=!1,w=0,g=1/0,S=!1,L,P,A=!1,k=!1,F=!1,R=Mn,ot=[],st=e=>{A||(e.preventDefault&&e.preventDefault(),z(e),window.addEventListener("mousemove",z),window.addEventListener("mouseup",J),Xt(r,e))},J=e=>{A||(L=void 0,P=void 0,window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",J),R&&i.classList.add(K),Gt(r,e))},Ln=(e,o)=>{if(n.length<=0)return;if(n.length===1)return n[0].isClicked(e)&&R&&i.classList.remove(K),n[0];let u=kn(e);if(S){let v=o,O=_(v);O!==void 0&&(v=Qe(v,O)),u?(L=v,P=0,R&&i.classList.remove(K)):L!==void 0&&(P=v-L,L=v)}if(!Cn(e)&&!u){for(let v of n)if(!(!v.isClicked(e)||v.disabled))return R&&i.classList.remove(K),v;for(let v of n)if(s===v)return v}let y=1/0,M=null;for(let v of n){if(v.disabled)continue;let O=Math.abs(o-v.percent);On.findIndex(e=>s===e&&!e.disabled),z=e=>{let o;if(b===I){let{height:y,top:M}=i.getBoundingClientRect(),v=e.type.indexOf("mouse")!==-1?e.clientY:e.touches[0].clientY;o=Math.min(Math.max(0,v-M),y)*100/y}else{let{width:y,left:M}=i.getBoundingClientRect(),v=e.type.indexOf("mouse")!==-1?e.clientX:e.touches[0].clientX;o=Math.min(Math.max(0,v-M),y)*100/y}if((C||c)&&(o=100-o),s=Ln(e.target,o),s&&An(n,s),S&&n.length>1&&P!==void 0){let y=n[0],M=n[n.length-1],v=y.percent+P<0,O=M.percent+P>100;if(v||O)return;for(let se=0;se{if(A||document.activeElement!==r||(s==null?void 0:s.disabled))return;e.stopPropagation(),e.preventDefault();let o=e.deltaY<0,u=C||c,y=o?!u:u,M=at();M!==-1&&(y?X(M,n[M].percent):G(M,n[M].percent))},lt=e=>{A||k||(b===I?c?H(e,100):H(e,0):C?G(e,n[e].percent):X(e,n[e].percent))},ut=e=>{A||k||(b===I?c?H(e,0):H(e,100):C?X(e,n[e].percent):G(e,n[e].percent))},dt=e=>{A||k||(b===I?c?G(e,n[e].percent):X(e,n[e].percent):C?H(e,100):H(e,0))},ct=e=>{A||k||(b===I?c?X(e,n[e].percent):G(e,n[e].percent):C?H(e,0):H(e,100))},Cn=e=>e.classList.contains("panel"),kn=e=>e.classList.contains("panel-fill"),X=(e,o)=>{if(o===void 0)return;let u=_(o);u==null&&(u=1),o-=u,o<0&&(o=0),H(e,o)},G=(e,o)=>{if(o===void 0)return;let u=_(o);u==null&&(u=1),o+=u,o>100&&(o=100),H(e,o)},W=()=>{!l||l.update({percents:pt(),values:bt(),$pointers:gt(),min:ft(),max:mt(),data:Ce(),step:Le(),round:He(),type:ke(),textMin:$(),textMax:ee(),rightToLeft:Oe(),bottomToTop:Be(),pointersOverlap:Ue(),pointersMinDistance:Ie(),pointersMaxDistance:Re(),rangeDragging:ze(),disabled:Fe(),keyboardDisabled:Ne(),mousewheelDisabled:Ve()})},Hn=()=>{W()},In=e=>{if(!(h||n.length<=1||f===a))if(e===0){let o=g*100/(f-a);return Math.max(0,n[e+1].percent-o)}else{let o=w*100/(f-a);return Math.min(n[e-1].percent+o,100)}},Rn=e=>{if(!(h||n.length<=1||f===a))if(e===n.length-1){let o=g*100/(f-a);return Math.min(n[e-1].percent+o,100)}else{let o=w*100/(f-a);return Math.max(0,n[e+1].percent-o)}},_=e=>{let o;if(typeof x=="function"){let u=we(0,100,a,f,e);o=x(u,e)}else o=x;if(B(o)){let u=f-a;return o=u===0?0:o*100/u,o}},j=e=>{if(e===void 0)return;let o=we(0,100,a,f,e);return p!==void 0?p[Math.round(o)]:jt(o,T)},$=()=>p!==void 0?p[a]:a,ee=()=>p!==void 0?p[f]:f,Le=()=>x,On=e=>{var o;return e<=0||h?$():(o=j(n[e-1].percent))!=null?o:""},Bn=e=>{var o;return n.length<=1||e>=n.length-1||h?ee():(o=j(n[e+1].percent))!=null?o:""},pt=()=>n.map(e=>e.percent),bt=()=>n.map(e=>j(e.percent)),gt=()=>n.map(e=>e.$pointer),ft=()=>a,mt=()=>f,Ce=()=>p,ke=()=>b,He=()=>T,Ie=()=>w,Re=()=>g,Fn=e=>ot[e],Oe=()=>C,Be=()=>c,Fe=()=>A,Ne=()=>k,Ve=()=>F,Ue=()=>h,ze=()=>S,H=(e,o)=>{if(o===void 0)return;let u=_(o);u!==void 0&&(o=Qe(o,u));let y=n[e];if(!y)return;let M=y.updatePosition(o,In(e),Rn(e),b,C,c);d==null||d.updatePosition(b,n.map(v=>v.percent),C,c),W();for(let v of n){let O=j(v.percent);O!==void 0&&(v.setAttr("aria-valuenow",O.toString()),v.setAttr("aria-valuetext",O.toString()))}Vn(),M&&Zt(r,n.map(v=>j(v.percent)))},N=()=>{for(let e=0;e{a=p!==void 0?0:E(e,rt),f=p!==void 0?p.length-1:E(o,Z),te(a),ne(f)},Vn=()=>{var e,o;for(let u=0;u{a=E(e,rt),a>f&&(f=a+Z),N()},ne=e=>{f=E(e,Z),f{h=!0;for(let o=0;o{let u;p!==void 0?(u=e==null?0:Qt(e,p),u===-1&&(u=0)):(u=E(e,a),uf&&(u=f));let y=we(a,f,0,100,u);H(o,y)},ie=e=>{if(e==null){x=void 0;return}if(typeof e=="function"){x=e,N();return}if(B(e)){x=E(e,1);let o=Math.abs(f-a);x>o&&(x=void 0),N();return}x=void 0},We=e=>{h=e,N()},Ke=e=>{(!B(e)||e<0)&&(e=0),w=e},je=e=>{(!B(e)||e<0)&&(e=1/0),g=e},qe=e=>{A=e,i.classList.toggle("disabled",A),A?i.setAttribute("aria-disabled","true"):i.hasAttribute("aria-disabled")&&i.removeAttribute("aria-disabled")},vt=e=>{k=e},yt=e=>{F=e,F?document.removeEventListener("wheel",Q):document.addEventListener("wheel",Q,{passive:!1})},Xe=e=>{if(e==null){p=void 0;return}if(p=Jt(e),p===void 0||p.length<=0){p=void 0;return}te(0),ne(p.length-1),x===void 0&&ie(1)},Ge=e=>{var y;typeof e=="string"?b=e.trim().toLowerCase()===I?I:V:b=V;let o=(y=r.shadowRoot)==null?void 0:y.querySelector(".range-slider-box");if(!o)return;o.className=`range-slider-box type-${b}`,N();let u=b===I?"vertical":"horizontal";for(let M of n)M.setAttr("aria-orientation",u)},Ye=e=>{C=e,n.length>1&&nt(n,C,r),N(),W()},Ze=e=>{c=e,n.length>1&&nt(n,c,r),N(),W()},Je=e=>{T=E(e,U),T<0&&(T=U),W()},xt=e=>{e==null||e.toString().trim().toLowerCase()==="false"?(R=void 0,i.style.removeProperty(_e),i.classList.remove(K)):(R=e.toString(),i.style.setProperty(_e,R),i.classList.add(K))},Pt=(e,o)=>{let u=n[e];!u||(u.setAttr("aria-label",o),ot[e]=o)},oe=e=>{if(L=void 0,n.length<=1){S=!1,i.classList.remove(et);return}S=e,i.classList.toggle(et,S)},Un=()=>{qe(D(r.getAttribute(Pe))),k=D(r.getAttribute(Ee)),F=D(r.getAttribute(Se));let e=q(r,/^pointer([0-9]*)-disabled$/,o=>D(o));for(let o of e){let u=o[0];!n[u]||(n[u].disabled=o[1])}},zn=()=>{let e=q(r,/^aria-label([0-9]*)$/);for(let o of e){let u=o[0];Pt(u,o[1])}},Wn=e=>{let o=n.length,u=n[o-1].$pointer,y=u.cloneNode(!0);u.after(y);let M=Y(r,y,o);return M.setCallbacks(lt,ut,dt,ct),n.push(M),re(e,o),N(),W(),o},Kn=()=>{let e=n.length,o=n[e-1];return o?(o.destroy(),n.pop(),n.length<=1&&oe(!1),N(),W(),e-1):-1};return(()=>{var o,u;for(let y of n)y.setCallbacks(lt,ut,dt,ct);let e=(o=r.shadowRoot)==null?void 0:o.querySelector(".panel-fill");e&&(d=_t(e)),Ge(r.getAttribute(he)),Ye(D(r.getAttribute(ye))),Ze(D(r.getAttribute(xe))),Nn(r.getAttribute(be),r.getAttribute(ge)),ie(r.getAttribute(fe)),Xe(r.getAttribute(pe)),ht(t.map(y=>y[1])),We(D(r.getAttribute(le))),Ke(E(r.getAttribute(ue),0)),je(E(r.getAttribute(de),1/0)),oe(D(r.getAttribute(ce))),Je(E(r.getAttribute(me),U)),Un(),zn(),m=xn(r,i,n),xt((u=r.getAttribute(Te))!=null?u:Mn),i.addEventListener("mousedown",st),i.addEventListener("mouseup",J),i.addEventListener("touchmove",z),i.addEventListener("touchstart",z),F||document.addEventListener("wheel",Q,{passive:!1}),l=Pn(r,Hn,{setValues:ht,setMin:te,setMax:ne,setStep:ie,setPointersOverlap:We,setPointersMinDistance:Ke,setPointersMaxDistance:je,setDisabled:qe,setType:Ge,setRightToLeft:Ye,setBottomToTop:Ze,setRound:Je,setKeyboardDisabled:vt,setMousewheelDisabled:yt,setRangeDragging:oe,setData:Xe},{getPercents:pt,getValues:bt,getPointerElements:gt,getMin:ft,getMax:mt,getStep:Le,getData:Ce,getType:ke,getRound:He,getTextMin:$,getTextMax:ee,isRightToLeft:Oe,isBottomToTop:Be,isDisabled:Fe,isKeyboardDisabled:Ne,isMousewheelDisabled:Ve,isPointersOverlap:Ue,isRangeDraggingEnabled:ze,getPointersMinDistance:Ie,getPointersMaxDistance:Re}),l.init()})(),{get pointers(){return n},get styles(){return m},get pluginsManager(){return l},get min(){return $()},get max(){return ee()},get step(){return Le()},get pointersOverlap(){return Ue()},set pointersOverlap(e){We(e)},get pointersMinDistance(){return Ie()},set pointersMinDistance(e){Ke(e)},get pointersMaxDistance(){return Re()},set pointersMaxDistance(e){je(e)},get disabled(){return Fe()},set disabled(e){qe(e)},get data(){return Ce()},get type(){return ke()},set type(e){Ge(e)},get rightToLeft(){return Oe()},set rightToLeft(e){Ye(e)},get bottomToTop(){return Be()},set bottomToTop(e){Ze(e)},get round(){return He()},set round(e){Je(e)},get animateOnClick(){return R},set animateOnClick(e){xt(e)},get keyboardDisabled(){return Ne()},set keyboardDisabled(e){vt(e)},get mousewheelDisabled(){return Ve()},set mousewheelDisabled(e){yt(e)},get rangeDragging(){return ze()},set rangeDragging(e){oe(e)},setMin:te,setMax:ne,setValue:re,setStep:ie,setData:Xe,getTextValue:j,setAriaLabel:Pt,getAriaLabel:Fn,addPointer:Wn,removePointer:Kn,destroy:()=>{i.removeEventListener("mousedown",st),i.removeEventListener("mouseup",J),i.removeEventListener("touchmove",z),i.removeEventListener("touchstart",z),document.removeEventListener("wheel",Q);for(let e of n)e.destroy();l==null||l.destroy()}}};var Dn=(r,i,t)=>{let n=$e.find(([l,a,f,x])=>a.replace("#","")===i.replace(/\d+/g,""));if(n&&r.styles){let[l,a,f,x]=n,p=i.replace(/\D/g,"").trim(),b=p===""||p==="0"||p==="1"?0:E(p,0)-1;r.styles.setStyle(l,t,b);return}switch(r&&r.pluginsManager&&r.pluginsManager.onAttrChange(i,t),i){case be:{r.setMin(t);break}case ge:{r.setMax(t);break}case fe:{r.setStep(t);break}case le:{r.pointersOverlap=D(t);break}case ue:{r.pointersMinDistance=E(t,0);break}case ce:{r.rangeDragging=D(t);break}case de:{r.pointersMaxDistance=E(t,1/0);break}case Pe:{r.disabled=D(t);break}case Ee:{r.keyboardDisabled=D(t);break}case Se:{r.mousewheelDisabled=D(t);break}case pe:{r.setData(t);break}case he:{r.type=t;break}case ye:{r.rightToLeft=D(t);break}case xe:{r.bottomToTop=D(t);break}case me:{r.round=E(t,U);break}case ve:{r.styles&&(r.styles.theme=t);break}case Te:{r.animateOnClick=t;break}}let s=null;if(/^value([0-9]*)$/.test(i)&&(s="value"),/^pointer([0-9]*)-disabled$/.test(i)&&(s="pointer-disabled"),/^aria-label([0-9]*)$/.test(i)&&(s="aria-label"),/^pointer([0-9]*)-shape$/.test(i)&&(s="pointer-shape"),!s)return;let d=i.replace(/\D/g,"").trim(),m=d===""||d==="0"||d==="1"?0:E(d,0)-1;switch(s){case"value":{r.setValue(t,m);break}case"pointer-disabled":{let l=r==null?void 0:r.pointers[m];if(!l)return;l.disabled=D(t);break}case"aria-label":{r.setAriaLabel(m,t);break}case"pointer-shape":{r.styles&&r.styles.setPointerShape(m,t);break}}};var it=class extends HTMLElement{constructor(){super();ae(this,"slider");ae(this,"_externalCSSList",[]);ae(this,"_observer",null);this.attachShadow({mode:"open"})}set step(t){this.slider&&this.slider.setStep(t)}get step(){var t;return(t=this.slider)==null?void 0:t.step}set disabled(t){this.slider&&(this.slider.disabled=t)}get disabled(){var t,n;return(n=(t=this.slider)==null?void 0:t.disabled)!=null?n:!1}set data(t){var n;(n=this.slider)==null||n.setData(t)}get data(){var t;return(t=this.slider)==null?void 0:t.data}set min(t){var n;(n=this.slider)==null||n.setMin(t)}get min(){var t;return(t=this.slider)==null?void 0:t.min}set max(t){var n;(n=this.slider)==null||n.setMax(t)}get max(){var t;return(t=this.slider)==null?void 0:t.max}set round(t){!this.slider||(this.slider.round=t)}get round(){var t,n;return(n=(t=this.slider)==null?void 0:t.round)!=null?n:U}set type(t){!this.slider||(this.slider.type=t!=null?t:V)}get type(){var t;return((t=this.slider)==null?void 0:t.type)||V}set pointersOverlap(t){!this.slider||(this.slider.pointersOverlap=t)}get pointersOverlap(){var t,n;return(n=(t=this.slider)==null?void 0:t.pointersOverlap)!=null?n:!1}set pointersMinDistance(t){!this.slider||(this.slider.pointersMinDistance=t)}get pointersMinDistance(){var t,n;return(n=(t=this.slider)==null?void 0:t.pointersMinDistance)!=null?n:0}set pointersMaxDistance(t){!this.slider||(this.slider.pointersMaxDistance=t)}get pointersMaxDistance(){var t,n;return(n=(t=this.slider)==null?void 0:t.pointersMaxDistance)!=null?n:1/0}set theme(t){!this.slider||!this.slider.styles||(this.slider.styles.theme=t)}get theme(){var t,n,s;return(s=(n=(t=this.slider)==null?void 0:t.styles)==null?void 0:n.theme)!=null?s:null}set rtl(t){!this.slider||(this.slider.rightToLeft=t)}get rtl(){var t,n;return(n=(t=this.slider)==null?void 0:t.rightToLeft)!=null?n:!1}set btt(t){!this.slider||(this.slider.bottomToTop=t)}get btt(){var t,n;return(n=(t=this.slider)==null?void 0:t.bottomToTop)!=null?n:!1}set keyboardDisabled(t){!this.slider||(this.slider.keyboardDisabled=t)}get keyboardDisabled(){var t,n;return(n=(t=this.slider)==null?void 0:t.keyboardDisabled)!=null?n:!1}set mousewheelDisabled(t){!this.slider||(this.slider.mousewheelDisabled=t)}get mousewheelDisabled(){var t,n;return(n=(t=this.slider)==null?void 0:t.mousewheelDisabled)!=null?n:!1}set animateOnClick(t){!this.slider||(this.slider.animateOnClick=t)}get animateOnClick(){var t;return(t=this.slider)==null?void 0:t.animateOnClick}get rangeDragging(){var t,n;return(n=(t=this.slider)==null?void 0:t.rangeDragging)!=null?n:!1}set rangeDragging(t){this.slider&&(this.slider.rangeDragging=D(t))}get externalCSSList(){return this._externalCSSList}addPointer(t){var s,d;if(!this.slider)return;let n=(d=(s=this.slider)==null?void 0:s.addPointer(t))!=null?d:0;tt(this,this.slider,n,`value${n+1}`,`ariaLabel${n+1}`,`pointerShape${n+1}`,`pointer${n+1}Disabled`)}removePointer(){var t;!this.slider||(t=this.slider)==null||t.removePointer()}addCSS(t){if(!this.shadowRoot)return;let n=document.createElement("style");n.textContent=t,this.shadowRoot.appendChild(n)}connectedCallback(){var d,m;if(!this.shadowRoot)return;this._externalCSSList=yn(this),this.shadowRoot.innerHTML=St(Tt,this._externalCSSList);let t=(d=this.shadowRoot)==null?void 0:d.querySelector(".pointer");if(!t)return;let n=(m=this.shadowRoot)==null?void 0:m.getElementById("range-slider");if(!n)return;let s=Sn(this,t);this.slider=wn(this,n,s),Tn(this,this.slider),this._observer=new MutationObserver(l=>{l.forEach(a=>{var x;if(!this.slider||a.type!=="attributes")return;let f=a.attributeName;!f||Dn(this.slider,f,(x=this.getAttribute(f))!=null?x:"")})}),this._observer.observe(this,{attributes:!0})}disconnectedCallback(){this._observer&&this._observer.disconnect(),this.slider&&this.slider.destroy()}},De=it;window.tcRangeSlider=De;customElements.get("toolcool-range-slider")||customElements.define("toolcool-range-slider",De);customElements.get("tc-range-slider")||customElements.define("tc-range-slider",class extends De{});})(); +(()=>{var Zn=Object.defineProperty;var Mt=Math.pow,Jn=(r,i,t)=>i in r?Zn(r,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[i]=t;var ae=(r,i,t)=>(Jn(r,typeof i!="symbol"?i+"":i,t),t);var wt=(r,i)=>` ${i&&i.length>0?i.map(t=>``).join(""):""}
`;var Dt=":host{--width:300px;--height:.25rem;--opacity:.4;--panel-bg:#cbd5e1;--panel-bg-hover:#94a3b8;--panel-bg-fill:#475569;--panel-bg-border-radius:1rem;--pointer-width:1rem;--pointer-height:1rem;--pointer-bg:#fff;--pointer-bg-hover:#dcdcdc;--pointer-bg-focus:#dcdcdc;--pointer-shadow:0 0 2px rgba(0,0,0,0.8);--pointer-shadow-hover:0 0 2px #000;--pointer-shadow-focus:var(--pointer-shadow-hover);--pointer-border:1px solid hsla(0,0%,88%,0.5);--pointer-border-hover:1px solid #94a3b8;--pointer-border-focus:var(--pointer-border-hover);--pointer-border-radius:100%;--animate-onclick:.3s}:host{max-width:100%}.range-slider-box{display:flex;position:relative;flex-direction:column}.range-slider{position:relative;width:var(--width,100%);height:var(--height,0.25rem);touch-action:none;max-width:100%;box-sizing:border-box;cursor:pointer}.row{width:100%;display:flex;align-items:center}.range-slider.disabled{opacity:var(--opacity,0.4);cursor:default}.pointer.disabled{filter:brightness(0.8);cursor:default}.range-slider *{box-sizing:border-box}.container{position:absolute;width:100%;height:100%}.panel{position:absolute;z-index:10;width:100%;height:100%;background:var(--panel-bg,#2d4373);border-radius:var(--panel-bg-border-radius,1rem);overflow:hidden;transition:.3s all ease}.panel-fill{background:var(--panel-bg-fill,#000);border-radius:var(--panel-bg-border-radius,1rem);overflow:hidden;height:100%;position:absolute;z-index:10}.panel:hover{background:var(--panel-bg-hover,#5f79b7)}.disabled .panel:hover{background:var(--panel-bg,#5f79b7)}.pointer{position:absolute;z-index:20;outline:0;top:50%;transform:translateY(-50%)}.pointer-shape{background:var(--pointer-bg,#fff);background-size:contain;box-shadow:var(--pointer-shadow);border:var(--pointer-border);border-radius:var(--pointer-border-radius,100%);transform:translateX(-50%);width:var(--pointer-width,15px);height:var(--pointer-height,15px);transition:.3s all ease}.pointer-shape:hover{background:var(--pointer-bg-hover,#fff);background-size:contain;border:var(--pointer-border-hover);box-shadow:var(--pointer-shadow-hover)}.disabled .pointer-shape:hover{background:var(--pointer-bg,#fff);background-size:contain;border:var(--pointer-border);box-shadow:var(--pointer-shadow)}.pointer:focus .pointer-shape{background:var(--pointer-bg-focus,#fff);background-size:contain;border:var(--pointer-border-focus);box-shadow:var(--pointer-shadow-focus)}.disabled .pointer:focus .pointer-shape{background:var(--pointer-bg,#fff);background-size:contain;border:var(--pointer-border);box-shadow:var(--pointer-shadow)}.type-vertical .range-slider{--width:.25rem;--height:300px;max-height:100%}.type-vertical .range-slider .pointer{left:50%}.type-vertical .range-slider .panel-fill{width:100%}.type-vertical.range-slider-box{flex-direction:row}.type-vertical .row{flex-direction:column}.animate-on-click .pointer,.animate-on-click .panel-fill{transition:all var(--animate-onclick)}.range-dragging .panel-fill{cursor:move}";var le="pointers-overlap",ue="pointers-min-distance",de="pointers-max-distance",ce="range-dragging",pe="data",be="min",ge="max",fe="step",me="round",he="type",ve="theme",ye="rtl",xe="btt",Pe="disabled",Ee="keyboard-disabled",Se="mousewheel-disabled",Lt="slider-width",Ct="slider-height",kt="slider-radius",Ht="slider-bg",It="slider-bg-hover",Rt="slider-bg-fill",Ot="pointer-width",Bt="pointer-height",Ft="pointer-radius",Nt="pointer-bg",Vt="pointer-bg-hover",Ut="pointer-bg-focus",zt="pointer-shadow",Wt="pointer-shadow-hover",Kt="pointer-shadow-focus",jt="pointer-border",qt="pointer-border-hover",Xt="pointer-border-focus",Te="animate-onclick",Gt="css-links";var I="vertical",U="horizontal";var we=(r,i,t,n,s)=>{let d=i-r;return d===0?t:(n-t)*(s-r)/d+t},B=r=>!isNaN(parseFloat(r))&&isFinite(r),E=(r,i)=>B(r)?Number(r):i,_e=(r,i)=>i===0?0:Math.round(r/i)*i,Yt=(r,i=1/0)=>{if(i===1/0)return r;let t=Mt(10,i);return Math.round(r*t)/t},D=r=>r==null?!1:typeof r=="boolean"?r:r.trim().toLowerCase()==="true";var Zt=(r,i)=>{r.dispatchEvent(new CustomEvent("onPointerClicked",{detail:{$pointer:i}}))},Jt=(r,i)=>{r.dispatchEvent(new CustomEvent("onMouseDown",{detail:{nativeEvent:i}}))},Qt=(r,i)=>{r.dispatchEvent(new CustomEvent("onMouseUp",{detail:{nativeEvent:i}}))},_t=(r,i)=>{r.dispatchEvent(new CustomEvent("onKeyDown",{detail:{nativeEvent:i}}))},$t=(r,i)=>{if(!i||i.length<=0)return;let t=i.map(s=>B(s)?E(s,s):s),n={values:t||[]};n.value=t[0],n.value0=t[0],n.value1=t[0];for(let s=1;s{let n=0,s,d,m,l,a=!1,f=(g,S,L,P,A,k)=>{let F=n;L!==void 0&&g>L&&(g=L),S!==void 0&&gg===i||i.contains(g),p=(g,S,L,P)=>{s=g,d=S,m=L,l=P},b=g=>{a=g,i.classList.toggle("disabled",a),a?i.setAttribute("aria-disabled","true"):i.hasAttribute("aria-disabled")&&i.removeAttribute("aria-disabled")},T=(g,S)=>{S==null?i.removeAttribute(g):i.setAttribute(g,S)},C=g=>i.getAttribute(g),c=g=>{if(!a){switch(g.key){case"ArrowLeft":{g.preventDefault(),typeof s=="function"&&s(t);break}case"ArrowRight":{g.preventDefault(),typeof d=="function"&&d(t);break}case"ArrowUp":{g.preventDefault(),typeof m=="function"&&m(t);break}case"ArrowDown":{g.preventDefault(),typeof l=="function"&&l(t);break}}_t(r,g)}},h=()=>{a||Zt(r,i)};return i.className=`pointer pointer-${t}`,i.addEventListener("keydown",c),i.addEventListener("click",h),{$pointer:i,get percent(){return n},get disabled(){return a},set disabled(g){b(g)},updatePosition:f,isClicked:x,setCallbacks:p,setAttr:T,getAttr:C,destroy:()=>{i.removeEventListener("keydown",c),i.removeEventListener("click",h),i.remove()}}};var en=r=>{if(r==null)return;if(Array.isArray(r))return r;if(r.trim()==="")return;let t=r.split(","),n=[],s=!0;for(let d=0;dNumber(d)):n},tn=(r,i)=>i?i.findIndex(t=>t===r||t.toString().trim()===r.toString().trim()):-1;var nn=r=>({updatePosition:(t,n,s,d)=>{if(n.length<=0)return;let m=n.length===1,l=n[0],a=n[n.length-1];t===I?(r.style.removeProperty("width"),r.style.removeProperty("right"),r.style.removeProperty("left"),m?r.style.height=`${l}%`:r.style.height=`${Math.abs(l-a)}%`,d?(r.style.bottom="0%",m?r.style.top="auto":r.style.top=`${Math.min(100-a,100-l)}%`):(r.style.bottom="auto",m?r.style.top="0%":r.style.top=`${Math.min(l,a)}%`)):(r.style.removeProperty("height"),r.style.removeProperty("top"),r.style.removeProperty("bottom"),m?r.style.width=`${l}%`:r.style.width=`${Math.abs(l-a)}%`,s?(r.style.right="0%",m?r.style.left="auto":r.style.left=`${Math.min(100-a,100-l)}%`):(r.style.right="auto",m?r.style.left="0%":r.style.left=`${Math.min(l,a)}%`))}});var $e="--animate-onclick",rn="--width",on="--height",sn="--panel-bg-border-radius",an="--panel-bg",ln="--panel-bg-hover",un="--panel-bg-fill",dn="--pointer-width",cn="--pointer-height",pn="--pointer-border-radius",bn="--pointer-bg",gn="--pointer-bg-hover",fn="--pointer-bg-focus",mn="--pointer-shadow",hn="--pointer-shadow-hover",vn="--pointer-shadow-focus",yn="--pointer-border",xn="--pointer-border-hover",Pn="--pointer-border-focus";var q=(r,i,t)=>{let n=new Map;for(let s of r.attributes){let d=s.nodeName.trim().toLowerCase();if(!i.test(d))continue;let l=d.replace(/\D/g,"").trim(),a=l===""||l==="0"||l==="1"?0:E(l,0)-1,f=t&&typeof t=="function"?t(s.value):s.value;n.set(a,f)}return n},Sn=r=>{if(!r)return null;let i=r.getAttribute(Gt);if(!i)return null;let t=i.split(";"),n=[];for(let s of t)s.trim()!==""&&n.push(s.trim());return n};var et=[[rn,Lt,"sliderWidth",null],[on,Ct,"sliderHeight",null],[sn,kt,"sliderRadius",null],[an,Ht,"sliderBg",null],[ln,It,"sliderBgHover",null],[un,Rt,"sliderBgFill",null],[dn,Ot,"pointer#Width",/^pointer([0-9]*)-width$/],[cn,Bt,"pointer#Height",/^pointer([0-9]*)-height$/],[pn,Ft,"pointer#Radius",/^pointer([0-9]*)-radius$/],[bn,Nt,"pointer#Bg",/^pointer([0-9]*)-bg$/],[gn,Vt,"pointer#BgHover",/^pointer([0-9]*)-bg-hover$/],[fn,Ut,"pointer#BgFocus",/^pointer([0-9]*)-bg-focus$/],[mn,zt,"pointer#Shadow",/^pointer([0-9]*)-shadow$/],[hn,Wt,"pointer#ShadowHover",/^pointer([0-9]*)-shadow-hover$/],[vn,Kt,"pointer#ShadowFocus",/^pointer([0-9]*)-shadow-focus$/],[yn,jt,"pointer#Border",/^pointer([0-9]*)-border$/],[xn,qt,"pointer#BorderHover",/^pointer([0-9]*)-border-hover$/],[Pn,Xt,"pointer#BorderFocus",/^pointer([0-9]*)-border-focus$/]],Tn=(r,i,t)=>{let n=null,s=[],d=new Map,m=(c,h=i)=>{let w=[...h.classList];for(let g of w)g.startsWith(c)&&i.classList.remove(g)},l=()=>{m("shape");let c=i.querySelectorAll(".pointer");for(let h of c)m("shape",h)},a=c=>{n=c,m("theme-"),typeof c=="string"&&i.classList.add(`theme-${c}`)},f=()=>{if(l(),!(s.length<=0)){i.classList.add("shape",`shape-${s[0]}`);for(let c=1;c{s[c]=h,f()},p=()=>{l();let c=q(r,/^pointer([0-9]*)-shape$/);if(!(c.size<=0)){for(let h of c){let w=h[0];s[w]=h[1]}f()}},b=(c,h)=>`${c}-${h}`,T=(c,h,w)=>{let g=t[w];if(!g)return;let S=w===0?i:g.$pointer;if(h==null){d.has(b(c,w))&&d.delete(b(c,w)),S.style.removeProperty(c);return}d.set(b(c,w),h),S.style.setProperty(c,h)},C=(c,h)=>d.get(b(c,h));return(()=>{for(let c of et){let[h,w,g,S]=c;if(S){let P=q(r,S);for(let A of P){let k=A[0],F=A[1];T(h,F,k)}}else{let P=r.getAttribute(w);T(h,P,0)}let L=[];if(g.indexOf("#")===-1)L.push([g,0]);else{L.push([g.replace("#",""),0]),L.push([g.replace("#","0"),0]),L.push([g.replace("#","1"),0]);for(let P=1;P{T(h,F,k)}})}catch(A){console.error(A)}}a(r.getAttribute(ve)),p()})(),{setStyle:T,getStyle:C,get theme(){return n},set theme(c){a(c)},get pointerShapes(){return s},setPointerShape:x}};var K="animate-on-click",tt="range-dragging";var An=(r,i,t,n)=>{let s=[],d=p=>{for(let b of s)b.update&&typeof b.update=="function"&&b.update(p)},m=()=>{for(let p of s)p.destroy&&typeof p.destroy=="function"&&p.destroy()},l=(p,b)=>{for(let T of s)T.onAttrChange&&typeof T.onAttrChange=="function"&&T.onAttrChange(p,b)},a=p=>{if(!!p.gettersAndSetters){for(let b of p.gettersAndSetters)if(!(!b.name||!b.attributes))try{Object.prototype.hasOwnProperty.call(r,b.name)||Object.defineProperty(r,b.name,b.attributes)}catch(T){console.error("defineSettersGetters error:",T)}}},f=p=>{var T;if(!p.css)return;let b=(T=r.shadowRoot)==null?void 0:T.querySelector("style");!b||(b.innerHTML+=p.css)};return{init:()=>{if(!!window.tcRangeSliderPlugins)for(let p of window.tcRangeSliderPlugins){let b=p();s.push(b),b.init&&typeof b.init=="function"&&(b.init(r,i,t,n),a(b),f(b))}},update:d,onAttrChange:l,destroy:m}};var $n=10,Mn=20,wn=(r,i)=>{let t=new Map,n=/^value([0-9]*)$/;for(let l of r.attributes){let a=l.nodeName.trim().toLowerCase();if(!n.test(a))continue;let x=a.replace("value","").trim(),p=x===""||x==="0"||x==="1"?0:E(x,0)-1,b=B(l.value)?E(l.value,0):l.value;t.set(p,b)}let s=Math.max(...Array.from(t.keys())),d=[];d.push([Y(r,i,0),t.get(0)]);let m=i;for(let l=1;l<=s;l++){let a=i.cloneNode(!0);m.after(a),m=a,d.push([Y(r,a,l),t.get(l)])}return d},nt=(r,i,t,n,s,d,m)=>{try{Object.defineProperty(r,n,{configurable:!0,get(){if(!i)return;let l=i.pointers[t];if(!l)return;let a=i.getTextValue(l.percent);return B(a)?E(a,a):a},set:l=>{i.pointers[t]?i==null||i.setValue(l,t):i==null||i.addPointer(l)}}),Object.defineProperty(r,s,{configurable:!0,get(){var l,a;return(a=(l=i==null?void 0:i.pointers[t])==null?void 0:l.getAttr("aria-label"))!=null?a:void 0},set:l=>{!i||i.setAriaLabel(t,l)}}),Object.defineProperty(r,d,{configurable:!0,get(){var l,a;return(a=(l=i==null?void 0:i.styles)==null?void 0:l.pointerShapes[t])!=null?a:null},set:l=>{!i||!i.styles||i.styles.setPointerShape(t,l)}}),Object.defineProperty(r,m,{configurable:!0,get(){var l;return(l=i==null?void 0:i.pointers[t].disabled)!=null?l:!1},set:l=>{if(!i)return;let a=i==null?void 0:i.pointers[t];!a||(a.disabled=l)}})}catch(l){console.error(l)}},Dn=(r,i)=>{let t=[["value","ariaLabel","pointerShape","pointerDisabled",0],["value0","ariaLabel0","pointerShape0","pointer0Disabled",0],["value1","ariaLabel1","pointerShape1","pointer1Disabled",0]];for(let n=2;n<$n;n++)t.push([`value${n}`,`ariaLabel${n}`,`pointer${n}Shape`,`pointer${n}Disabled`,n-1]);for(let n of t)nt(r,i,n[4],n[0],n[1],n[2],n[3])},rt=(r,i,t)=>{var s;let n=(s=t.shadowRoot)==null?void 0:s.querySelector(".container");if(!!n)for(let d of r)i?n.prepend(d.$pointer):n.append(d.$pointer)},Ln=(r,i)=>{if(!(!i||r.length<=1)){for(let t of r)t.$pointer.style.zIndex=Mn.toString();i.$pointer.style.zIndex=(Mn*2).toString()}};var it=0,Z=100,z=2,Cn="0.3s",kn=(r,i,t)=>{let n=t.map(e=>e[0]),s=null,d=null,m=null,l=null,a=it,f=Z,x,p,b=U,T=z,C=!1,c=!1,h=!1,w=0,g=1/0,S=!1,L,P,A=!1,k=!1,F=!1,R=Cn,st,at,lt,ut=[],dt=e=>{A||(e.preventDefault&&e.preventDefault(),V(e),window.addEventListener("mousemove",V),window.addEventListener("mouseup",J),Jt(r,e))},J=e=>{A||(L=void 0,P=void 0,V(e),window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",J),R&&i.classList.add(K),Qt(r,e))},In=(e,o)=>{if(n.length<=0)return;if(n.length===1)return n[0].isClicked(e)&&R&&i.classList.remove(K),n[0];let u=On(e);if(S){let v=o,O=_(v);O!==void 0&&(v=_e(v,O)),u?(L=v,P=0,R&&i.classList.remove(K)):L!==void 0&&(P=v-L,L=v)}if(!Rn(e)&&!u){for(let v of n)if(!(!v.isClicked(e)||v.disabled))return R&&i.classList.remove(K),v;for(let v of n)if(s===v)return v}let y=1/0,M=null;for(let v of n){if(v.disabled)continue;let O=Math.abs(o-v.percent);On.findIndex(e=>s===e&&!e.disabled),V=e=>{xt(e.type),e instanceof TouchEvent&&e.touches[0]&&(at=e.touches[0].clientX),e instanceof TouchEvent&&e.touches[0]&&(lt=e.touches[0].clientY);let o;if(b===I){let{height:y,top:M}=i.getBoundingClientRect(),v=e.type.indexOf("mouse")!==-1?e.clientY:lt;o=Math.min(Math.max(0,v-M),y)*100/y}else{let{width:y,left:M}=i.getBoundingClientRect(),v=e.type.indexOf("mouse")!==-1?e.clientX:at;o=Math.min(Math.max(0,v-M),y)*100/y}if((C||c)&&(o=100-o),s=In(e.target,o),s&&Ln(n,s),S&&n.length>1&&P!==void 0){let y=n[0],M=n[n.length-1],v=y.percent+P<0,O=M.percent+P>100;if(v||O)return;for(let se=0;se{if(xt(e.type),A||document.activeElement!==r||(s==null?void 0:s.disabled))return;e.stopPropagation(),e.preventDefault();let o=e.deltaY<0,u=C||c,y=o?!u:u,M=Le();M!==-1&&(y?X(M,n[M].percent):G(M,n[M].percent))},ct=e=>{A||k||(b===I?c?H(e,100):H(e,0):C?G(e,n[e].percent):X(e,n[e].percent))},pt=e=>{A||k||(b===I?c?H(e,0):H(e,100):C?X(e,n[e].percent):G(e,n[e].percent))},bt=e=>{A||k||(b===I?c?G(e,n[e].percent):X(e,n[e].percent):C?H(e,100):H(e,0))},gt=e=>{A||k||(b===I?c?X(e,n[e].percent):G(e,n[e].percent):C?H(e,0):H(e,100))},Rn=e=>e.classList.contains("panel"),On=e=>e.classList.contains("panel-fill"),X=(e,o)=>{if(o===void 0)return;let u=_(o);u==null&&(u=1),o-=u,o<0&&(o=0),H(e,o)},G=(e,o)=>{if(o===void 0)return;let u=_(o);u==null&&(u=1),o+=u,o>100&&(o=100),H(e,o)},W=()=>{!l||l.update({percents:ft(),values:mt(),$pointers:ht(),min:vt(),max:yt(),data:ke(),step:Ce(),round:Ie(),type:He(),textMin:$(),textMax:ee(),rightToLeft:Be(),bottomToTop:Fe(),pointersOverlap:ze(),pointersMinDistance:Re(),pointersMaxDistance:Oe(),rangeDragging:We(),disabled:Ne(),keyboardDisabled:Ve(),mousewheelDisabled:Ue()})},Bn=()=>{W()},Fn=()=>st,Nn=e=>{if(!(h||n.length<=1||f===a))if(e===0){let o=g*100/(f-a);return Math.max(0,n[e+1].percent-o)}else{let o=w*100/(f-a);return Math.min(n[e-1].percent+o,100)}},Vn=e=>{if(!(h||n.length<=1||f===a))if(e===n.length-1){let o=g*100/(f-a);return Math.min(n[e-1].percent+o,100)}else{let o=w*100/(f-a);return Math.max(0,n[e+1].percent-o)}},_=e=>{let o;if(typeof x=="function"){let u=we(0,100,a,f,e);o=x(u,e)}else o=x;if(B(o)){let u=f-a;return o=u===0?0:o*100/u,o}},j=e=>{if(e===void 0)return;let o=we(0,100,a,f,e);return p!==void 0?p[Math.round(o)]:Yt(o,T)},$=()=>p!==void 0?p[a]:a,ee=()=>p!==void 0?p[f]:f,Ce=()=>x,Un=e=>{var o;return e<=0||h?$():(o=j(n[e-1].percent))!=null?o:""},zn=e=>{var o;return n.length<=1||e>=n.length-1||h?ee():(o=j(n[e+1].percent))!=null?o:""},ft=()=>n.map(e=>e.percent),mt=()=>n.map(e=>j(e.percent)),ht=()=>n.map(e=>e.$pointer),vt=()=>a,yt=()=>f,ke=()=>p,He=()=>b,Ie=()=>T,Re=()=>w,Oe=()=>g,Wn=e=>ut[e],Be=()=>C,Fe=()=>c,Ne=()=>A,Ve=()=>k,Ue=()=>F,ze=()=>h,We=()=>S,xt=e=>{st=e},H=(e,o)=>{if(o===void 0)return;let u=_(o);u!==void 0&&(o=_e(o,u));let y=n[e];if(!y)return;let M=y.updatePosition(o,Nn(e),Vn(e),b,C,c);d==null||d.updatePosition(b,n.map(v=>v.percent),C,c),W();for(let v of n){let O=j(v.percent);O!==void 0&&(v.setAttr("aria-valuenow",O.toString()),v.setAttr("aria-valuetext",O.toString()))}jn(),M&&$t(r,n.map(v=>j(v.percent)))},N=()=>{for(let e=0;e{a=p!==void 0?0:E(e,it),f=p!==void 0?p.length-1:E(o,Z),te(a),ne(f)},jn=()=>{var e,o;for(let u=0;u{a=E(e,it),a>f&&(f=a+Z),N()},ne=e=>{f=E(e,Z),f{h=!0;for(let o=0;o{let u;p!==void 0?(u=e==null?0:tn(e,p),u===-1&&(u=0)):(u=E(e,a),uf&&(u=f));let y=we(a,f,0,100,u);H(o,y)},ie=e=>{if(e==null){x=void 0;return}if(typeof e=="function"){x=e,N();return}if(B(e)){x=E(e,1);let o=Math.abs(f-a);x>o&&(x=void 0),N();return}x=void 0},Ke=e=>{h=e,N()},je=e=>{(!B(e)||e<0)&&(e=0),w=e},qe=e=>{(!B(e)||e<0)&&(e=1/0),g=e},Xe=e=>{A=e,i.classList.toggle("disabled",A),A?i.setAttribute("aria-disabled","true"):i.hasAttribute("aria-disabled")&&i.removeAttribute("aria-disabled")},Et=e=>{k=e},St=e=>{F=e,F?document.removeEventListener("wheel",Q):document.addEventListener("wheel",Q,{passive:!1})},Ge=e=>{if(e==null){p=void 0;return}if(p=en(e),p===void 0||p.length<=0){p=void 0;return}te(0),ne(p.length-1),x===void 0&&ie(1)},Ye=e=>{var y;typeof e=="string"?b=e.trim().toLowerCase()===I?I:U:b=U;let o=(y=r.shadowRoot)==null?void 0:y.querySelector(".range-slider-box");if(!o)return;o.className=`range-slider-box type-${b}`,N();let u=b===I?"vertical":"horizontal";for(let M of n)M.setAttr("aria-orientation",u)},Ze=e=>{C=e,n.length>1&&rt(n,C,r),N(),W()},Je=e=>{c=e,n.length>1&&rt(n,c,r),N(),W()},Qe=e=>{T=E(e,z),T<0&&(T=z),W()},Tt=e=>{e==null||e.toString().trim().toLowerCase()==="false"?(R=void 0,i.style.removeProperty($e),i.classList.remove(K)):(R=e.toString(),i.style.setProperty($e,R),i.classList.add(K))},At=(e,o)=>{let u=n[e];!u||(u.setAttr("aria-label",o),ut[e]=o)},oe=e=>{if(L=void 0,n.length<=1){S=!1,i.classList.remove(tt);return}S=e,i.classList.toggle(tt,S)},qn=()=>{Xe(D(r.getAttribute(Pe))),k=D(r.getAttribute(Ee)),F=D(r.getAttribute(Se));let e=q(r,/^pointer([0-9]*)-disabled$/,o=>D(o));for(let o of e){let u=o[0];!n[u]||(n[u].disabled=o[1])}},Xn=()=>{let e=q(r,/^aria-label([0-9]*)$/);for(let o of e){let u=o[0];At(u,o[1])}},Gn=e=>{let o=n.length,u=n[o-1].$pointer,y=u.cloneNode(!0);u.after(y);let M=Y(r,y,o);return M.setCallbacks(ct,pt,bt,gt),n.push(M),re(e,o),N(),W(),o},Yn=()=>{let e=n.length,o=n[e-1];return o?(o.destroy(),n.pop(),n.length<=1&&oe(!1),N(),W(),e-1):-1};return(()=>{var o,u;for(let y of n)y.setCallbacks(ct,pt,bt,gt);let e=(o=r.shadowRoot)==null?void 0:o.querySelector(".panel-fill");e&&(d=nn(e)),Ye(r.getAttribute(he)),Ze(D(r.getAttribute(ye))),Je(D(r.getAttribute(xe))),Kn(r.getAttribute(be),r.getAttribute(ge)),ie(r.getAttribute(fe)),Ge(r.getAttribute(pe)),Pt(t.map(y=>y[1])),Ke(D(r.getAttribute(le))),je(E(r.getAttribute(ue),0)),qe(E(r.getAttribute(de),1/0)),oe(D(r.getAttribute(ce))),Qe(E(r.getAttribute(me),z)),qn(),Xn(),m=Tn(r,i,n),Tt((u=r.getAttribute(Te))!=null?u:Cn),i.addEventListener("mousedown",dt),i.addEventListener("mouseup",J),i.addEventListener("touchmove",V),i.addEventListener("touchstart",V),i.addEventListener("touchend",V),F||document.addEventListener("wheel",Q,{passive:!1}),l=An(r,Bn,{setValues:Pt,setMin:te,setMax:ne,setStep:ie,setPointersOverlap:Ke,setPointersMinDistance:je,setPointersMaxDistance:qe,setDisabled:Xe,setType:Ye,setRightToLeft:Ze,setBottomToTop:Je,setRound:Qe,setKeyboardDisabled:Et,setMousewheelDisabled:St,setRangeDragging:oe,setData:Ge},{getPercents:ft,getValues:mt,getPointerElements:ht,getActivePointerIndex:Le,getMin:vt,getMax:yt,getStep:Ce,getData:ke,getType:He,getRound:Ie,getTextMin:$,getTextMax:ee,isRightToLeft:Be,isBottomToTop:Fe,isDisabled:Ne,isKeyboardDisabled:Ve,isMousewheelDisabled:Ue,isPointersOverlap:ze,isRangeDraggingEnabled:We,getPointersMinDistance:Re,getPointersMaxDistance:Oe,getEventName:Fn}),l.init()})(),{get pointers(){return n},get styles(){return m},get pluginsManager(){return l},get min(){return $()},get max(){return ee()},get step(){return Ce()},get pointersOverlap(){return ze()},set pointersOverlap(e){Ke(e)},get pointersMinDistance(){return Re()},set pointersMinDistance(e){je(e)},get pointersMaxDistance(){return Oe()},set pointersMaxDistance(e){qe(e)},get disabled(){return Ne()},set disabled(e){Xe(e)},get data(){return ke()},get type(){return He()},set type(e){Ye(e)},get rightToLeft(){return Be()},set rightToLeft(e){Ze(e)},get bottomToTop(){return Fe()},set bottomToTop(e){Je(e)},get round(){return Ie()},set round(e){Qe(e)},get animateOnClick(){return R},set animateOnClick(e){Tt(e)},get keyboardDisabled(){return Ve()},set keyboardDisabled(e){Et(e)},get mousewheelDisabled(){return Ue()},set mousewheelDisabled(e){St(e)},get rangeDragging(){return We()},set rangeDragging(e){oe(e)},setMin:te,setMax:ne,setValue:re,setStep:ie,setData:Ge,getTextValue:j,setAriaLabel:At,getAriaLabel:Wn,addPointer:Gn,removePointer:Yn,destroy:()=>{i.removeEventListener("mousedown",dt),i.removeEventListener("mouseup",J),i.removeEventListener("touchmove",V),i.removeEventListener("touchstart",V),document.removeEventListener("wheel",Q);for(let e of n)e.destroy();l==null||l.destroy()}}};var Hn=(r,i,t)=>{let n=et.find(([l,a,f,x])=>a.replace("#","")===i.replace(/\d+/g,""));if(n&&r.styles){let[l,a,f,x]=n,p=i.replace(/\D/g,"").trim(),b=p===""||p==="0"||p==="1"?0:E(p,0)-1;r.styles.setStyle(l,t,b);return}switch(r&&r.pluginsManager&&r.pluginsManager.onAttrChange(i,t),i){case be:{r.setMin(t);break}case ge:{r.setMax(t);break}case fe:{r.setStep(t);break}case le:{r.pointersOverlap=D(t);break}case ue:{r.pointersMinDistance=E(t,0);break}case ce:{r.rangeDragging=D(t);break}case de:{r.pointersMaxDistance=E(t,1/0);break}case Pe:{r.disabled=D(t);break}case Ee:{r.keyboardDisabled=D(t);break}case Se:{r.mousewheelDisabled=D(t);break}case pe:{r.setData(t);break}case he:{r.type=t;break}case ye:{r.rightToLeft=D(t);break}case xe:{r.bottomToTop=D(t);break}case me:{r.round=E(t,z);break}case ve:{r.styles&&(r.styles.theme=t);break}case Te:{r.animateOnClick=t;break}}let s=null;if(/^value([0-9]*)$/.test(i)&&(s="value"),/^pointer([0-9]*)-disabled$/.test(i)&&(s="pointer-disabled"),/^aria-label([0-9]*)$/.test(i)&&(s="aria-label"),/^pointer([0-9]*)-shape$/.test(i)&&(s="pointer-shape"),!s)return;let d=i.replace(/\D/g,"").trim(),m=d===""||d==="0"||d==="1"?0:E(d,0)-1;switch(s){case"value":{r.setValue(t,m);break}case"pointer-disabled":{let l=r==null?void 0:r.pointers[m];if(!l)return;l.disabled=D(t);break}case"aria-label":{r.setAriaLabel(m,t);break}case"pointer-shape":{r.styles&&r.styles.setPointerShape(m,t);break}}};var ot=class extends HTMLElement{constructor(){super();ae(this,"slider");ae(this,"_externalCSSList",[]);ae(this,"_observer",null);this.attachShadow({mode:"open"})}set step(t){this.slider&&this.slider.setStep(t)}get step(){var t;return(t=this.slider)==null?void 0:t.step}set disabled(t){this.slider&&(this.slider.disabled=t)}get disabled(){var t,n;return(n=(t=this.slider)==null?void 0:t.disabled)!=null?n:!1}set data(t){var n;(n=this.slider)==null||n.setData(t)}get data(){var t;return(t=this.slider)==null?void 0:t.data}set min(t){var n;(n=this.slider)==null||n.setMin(t)}get min(){var t;return(t=this.slider)==null?void 0:t.min}set max(t){var n;(n=this.slider)==null||n.setMax(t)}get max(){var t;return(t=this.slider)==null?void 0:t.max}set round(t){!this.slider||(this.slider.round=t)}get round(){var t,n;return(n=(t=this.slider)==null?void 0:t.round)!=null?n:z}set type(t){!this.slider||(this.slider.type=t!=null?t:U)}get type(){var t;return((t=this.slider)==null?void 0:t.type)||U}set pointersOverlap(t){!this.slider||(this.slider.pointersOverlap=t)}get pointersOverlap(){var t,n;return(n=(t=this.slider)==null?void 0:t.pointersOverlap)!=null?n:!1}set pointersMinDistance(t){!this.slider||(this.slider.pointersMinDistance=t)}get pointersMinDistance(){var t,n;return(n=(t=this.slider)==null?void 0:t.pointersMinDistance)!=null?n:0}set pointersMaxDistance(t){!this.slider||(this.slider.pointersMaxDistance=t)}get pointersMaxDistance(){var t,n;return(n=(t=this.slider)==null?void 0:t.pointersMaxDistance)!=null?n:1/0}set theme(t){!this.slider||!this.slider.styles||(this.slider.styles.theme=t)}get theme(){var t,n,s;return(s=(n=(t=this.slider)==null?void 0:t.styles)==null?void 0:n.theme)!=null?s:null}set rtl(t){!this.slider||(this.slider.rightToLeft=t)}get rtl(){var t,n;return(n=(t=this.slider)==null?void 0:t.rightToLeft)!=null?n:!1}set btt(t){!this.slider||(this.slider.bottomToTop=t)}get btt(){var t,n;return(n=(t=this.slider)==null?void 0:t.bottomToTop)!=null?n:!1}set keyboardDisabled(t){!this.slider||(this.slider.keyboardDisabled=t)}get keyboardDisabled(){var t,n;return(n=(t=this.slider)==null?void 0:t.keyboardDisabled)!=null?n:!1}set mousewheelDisabled(t){!this.slider||(this.slider.mousewheelDisabled=t)}get mousewheelDisabled(){var t,n;return(n=(t=this.slider)==null?void 0:t.mousewheelDisabled)!=null?n:!1}set animateOnClick(t){!this.slider||(this.slider.animateOnClick=t)}get animateOnClick(){var t;return(t=this.slider)==null?void 0:t.animateOnClick}get rangeDragging(){var t,n;return(n=(t=this.slider)==null?void 0:t.rangeDragging)!=null?n:!1}set rangeDragging(t){this.slider&&(this.slider.rangeDragging=D(t))}get externalCSSList(){return this._externalCSSList}addPointer(t){var s,d;if(!this.slider)return;let n=(d=(s=this.slider)==null?void 0:s.addPointer(t))!=null?d:0;nt(this,this.slider,n,`value${n+1}`,`ariaLabel${n+1}`,`pointerShape${n+1}`,`pointer${n+1}Disabled`)}removePointer(){var t;!this.slider||(t=this.slider)==null||t.removePointer()}addCSS(t){if(!this.shadowRoot)return;let n=document.createElement("style");n.textContent=t,this.shadowRoot.appendChild(n)}connectedCallback(){var d,m;if(!this.shadowRoot)return;this._externalCSSList=Sn(this),this.shadowRoot.innerHTML=wt(Dt,this._externalCSSList);let t=(d=this.shadowRoot)==null?void 0:d.querySelector(".pointer");if(!t)return;let n=(m=this.shadowRoot)==null?void 0:m.getElementById("range-slider");if(!n)return;let s=wn(this,t);this.slider=kn(this,n,s),Dn(this,this.slider),this._observer=new MutationObserver(l=>{l.forEach(a=>{var x;if(!this.slider||a.type!=="attributes")return;let f=a.attributeName;!f||Hn(this.slider,f,(x=this.getAttribute(f))!=null?x:"")})}),this._observer.observe(this,{attributes:!0})}disconnectedCallback(){this._observer&&this._observer.disconnect(),this.slider&&this.slider.destroy()}},De=ot;window.tcRangeSlider=De;customElements.get("toolcool-range-slider")||customElements.define("toolcool-range-slider",De);customElements.get("tc-range-slider")||customElements.define("tc-range-slider",class extends De{});})(); //# sourceMappingURL=toolcool-range-slider.min.js.map diff --git a/dist/toolcool-range-slider.min.js.map b/dist/toolcool-range-slider.min.js.map index 16ea6065..20c6e4fa 100644 --- a/dist/toolcool-range-slider.min.js.map +++ b/dist/toolcool-range-slider.min.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/core/templates/main.html.js", "../src/core/enums/attributes-enum.ts", "../src/core/enums/type-enum.ts", "../src/core/domain/math-provider.ts", "../src/core/domain/events-provider.ts", "../src/core/ui/pointer.ts", "../src/core/dal/data-provider.ts", "../src/core/ui/panel-fill.ts", "../src/core/enums/css-vars-enum.ts", "../src/core/domain/common-provider.ts", "../src/core/ui/styles.ts", "../src/core/enums/css-classes-enum.ts", "../src/core/plugins/plugins-manager.ts", "../src/core/domain/pointers-provider.ts", "../src/core/ui/slider.ts", "../src/core/domain/attributes-provider.ts", "../src/core/app/range-slider.ts", "../src/core/index.ts"], - "sourcesContent": ["export default (styles, linkHrefs) => { return ` ${ linkHrefs && linkHrefs.length > 0 ? linkHrefs.map(linkHref => ``).join('') : '' }
`; }; ", "/**\n * Constants instead of typescript enums ---> smaller bundle size\n */\nexport const PointersOverlap = 'pointers-overlap';\nexport const PointersMinDistance = 'pointers-min-distance';\nexport const PointersMaxDistance = 'pointers-max-distance';\nexport const RangeDragging = 'range-dragging';\n\nexport const Data = 'data';\nexport const Min = 'min';\nexport const Max = 'max';\nexport const Step = 'step';\nexport const Round = 'round';\nexport const Type = 'type';\nexport const Theme = 'theme';\nexport const RightToLeft = 'rtl';\nexport const BottomToTop = 'btt';\n\nexport const Disabled = 'disabled';\nexport const KeyboardDisabled = 'keyboard-disabled';\nexport const MousewheelDisabled = 'mousewheel-disabled';\n\nexport const SliderWidth = 'slider-width';\nexport const SliderHeight = 'slider-height';\nexport const SliderRadius = 'slider-radius';\n\nexport const SliderBg = 'slider-bg';\nexport const SliderBgHover = 'slider-bg-hover';\nexport const SliderBgFill = 'slider-bg-fill';\n\nexport const PointerWidth = 'pointer-width';\nexport const PointerHeight = 'pointer-height';\nexport const PointerRadius = 'pointer-radius';\nexport const PointerBg = 'pointer-bg';\nexport const PointerBgHover = 'pointer-bg-hover';\nexport const PointerBgFocus = 'pointer-bg-focus';\nexport const PointerShadow = 'pointer-shadow';\nexport const PointerShadowHover = 'pointer-shadow-hover';\nexport const PointerShadowFocus = 'pointer-shadow-focus';\nexport const PointerBorder = 'pointer-border';\nexport const PointerBorderHover = 'pointer-border-hover';\nexport const PointerBorderFocus = 'pointer-border-focus';\n\nexport const AnimateOnClick = 'animate-onclick';\nexport const CSSLinks = 'css-links';\n", "/**\n * Constants instead of typescript enums ---> smaller bundle size\n */\nexport const Vertical = 'vertical';\nexport const Horizontal = 'horizontal';\n", "/**\n * scale a range [min,max] to [a,b]\n * f(x) = (b - a) * (x - min) / (max - min) + a\n */\nexport const convertRange = (min: number, max: number, a: number, b: number, x: number) => {\n const temp = (max - min);\n if(temp === 0) return a;\n return ((b - a) * (x - min)) / temp + a;\n};\n\n// eslint-disable-next-line\nexport const isNumber = (input: any) => {\n return !isNaN(parseFloat(input)) && isFinite(input);\n};\n\n// the below function should receive any\n// eslint-disable-next-line\nexport const getNumber = (input: any, defaultValue: any) : number => {\n return isNumber(input) ? Number(input) : defaultValue;\n};\n\n/**\n * Round up to the next multiple of X,\n * where X is the step provided by the user.\n */\nexport const roundToStep = (num: number, step: number) => {\n return step === 0 ? 0 : Math.round(num / step) * step;\n};\n\n/**\n * round to decimal places\n * https://stackoverflow.com/questions/11832914/how-to-round-to-at-most-2-decimal-places-if-necessary\n */\nexport const setDecimalPlaces = (num: number, decimalPlaces = Infinity) => {\n if (decimalPlaces === Infinity) return num;\n\n const coeff = 10 ** decimalPlaces;\n return Math.round(num * coeff) / coeff;\n};\n\nexport const getBoolean = (val: string | null | undefined | boolean) => {\n if(val === null || val === undefined) return false;\n if(typeof val === 'boolean') return val;\n return val.trim().toLowerCase() === 'true';\n};\n", "import { getNumber, isNumber } from './math-provider';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface IIndexable { [key: string]: T }\n\nexport const sendPointerClickedEvent = ($component: HTMLElement, $pointer: HTMLElement) => {\n $component.dispatchEvent(\n new CustomEvent('onPointerClicked', {\n detail: {\n $pointer: $pointer,\n },\n })\n );\n};\n\nexport const sendMouseDownEvent = ($component: HTMLElement, evt: MouseEvent) => {\n $component.dispatchEvent(\n new CustomEvent('onMouseDown', {\n detail: {\n nativeEvent: evt,\n },\n })\n );\n};\n\nexport const sendMouseUpEvent = ($component: HTMLElement, evt: MouseEvent) => {\n $component.dispatchEvent(\n new CustomEvent('onMouseUp', {\n detail: {\n nativeEvent: evt,\n },\n })\n );\n};\n\nexport const sendOnKeyDownEvent = ($component: HTMLElement, evt: KeyboardEvent) => {\n $component.dispatchEvent(\n new CustomEvent('onKeyDown', {\n detail: {\n nativeEvent: evt,\n },\n })\n );\n};\n\nexport const sendChangeEvent = (\n $component: HTMLElement,\n values: (string | number | undefined)[],\n) => {\n\n if(!values || values.length <= 0) return;\n\n const transformed = values.map(value => isNumber(value) ? getNumber(value, value) : value);\n\n const detail: IIndexable = {\n values: transformed || [],\n };\n\n detail.value = transformed[0];\n detail.value0 = transformed[0];\n detail.value1 = transformed[0];\n\n for(let i=1; i boolean;\n\n disabled: boolean;\n\n isClicked: ($target: HTMLElement) => boolean;\n setCallbacks: (\n arrowLeft: (pointerIndex: number) => void,\n arrowRight: (pointerIndex: number) => void,\n arrowUp: (pointerIndex: number) => void,\n arrowDown: (pointerIndex: number) => void\n ) => void;\n\n setAttr: (key: string, value: string | null | undefined) => void;\n getAttr: (key: string) => string | null;\n\n destroy: () => void;\n}\n\nexport const Pointer = ($component: HTMLElement, $pointer: HTMLElement, index: number) : IPointer => {\n\n // the pointer value in % in the range [0, 100] -\n // used to render the pointer position\n let percent = 0;\n\n let arrowLeft: (pointerIndex: number) => void;\n let arrowRight: (pointerIndex: number) => void;\n let arrowUp: (pointerIndex: number) => void;\n let arrowDown: (pointerIndex: number) => void;\n\n let disabled = false;\n\n // -------------- APIs -------------------------\n\n /**\n * Update pointer position according to its percent (value).\n * Returns true if change position has changed.\n */\n const updatePosition = (\n _percent: number,\n _leftWall: number | undefined,\n _rightWall: number | undefined,\n _type: string,\n _rightToLeft: boolean,\n _bottomToTop: boolean): boolean => {\n\n const oldValue = percent;\n\n if(_rightWall !== undefined && _percent > _rightWall){\n _percent = _rightWall;\n }\n\n if(_leftWall !== undefined && _percent < _leftWall){\n _percent = _leftWall;\n }\n\n percent = _percent;\n // $pointer.focus();\n\n // the below code should not change the global pointer percent,\n // only its position on the panel\n let percentPos = percent;\n if((_type === TypeEnum.Vertical && _bottomToTop) ||\n (_type === TypeEnum.Horizontal && _rightToLeft)) {\n percentPos = 100 - percentPos;\n }\n\n if (_type === TypeEnum.Vertical) {\n $pointer.style.top = `${ percentPos }%`;\n }\n else {\n $pointer.style.left = `${ percentPos }%`;\n }\n\n return oldValue !== percent;\n };\n\n const isClicked = ($target: HTMLElement) => {\n return $target === $pointer || $pointer.contains($target);\n };\n\n const setCallbacks = (\n _arrowLeft: (pointerIndex: number) => void,\n _arrowRight: (pointerIndex: number) => void,\n _arrowUp: (pointerIndex: number) => void,\n _arrowDown: (pointerIndex: number) => void\n ) => {\n arrowLeft = _arrowLeft;\n arrowRight = _arrowRight;\n arrowUp = _arrowUp;\n arrowDown = _arrowDown;\n };\n\n const setDisabled = (_disabled: boolean) => {\n disabled = _disabled;\n $pointer.classList.toggle('disabled', disabled);\n\n if(disabled){\n $pointer.setAttribute('aria-disabled', 'true');\n }\n else{\n if ($pointer.hasAttribute('aria-disabled')) {\n $pointer.removeAttribute('aria-disabled');\n }\n }\n };\n\n const setAttr = (key: string, value: string | null | undefined) => {\n if(value === null || value === undefined){\n $pointer.removeAttribute(key);\n }\n else{\n $pointer.setAttribute(key, value);\n }\n };\n\n const getAttr = (key: string) => {\n return $pointer.getAttribute(key);\n };\n\n // -------------- Events ------------------------\n\n const pointerKeyDown = (evt: KeyboardEvent) => {\n if(disabled) return;\n\n switch (evt.key) {\n case 'ArrowLeft': {\n evt.preventDefault();\n if(typeof arrowLeft === 'function'){\n arrowLeft(index);\n }\n break;\n }\n\n case 'ArrowRight': {\n evt.preventDefault();\n if(typeof arrowRight === 'function'){\n arrowRight(index);\n }\n break;\n }\n\n case 'ArrowUp': {\n evt.preventDefault();\n if(typeof arrowUp === 'function'){\n arrowUp(index);\n }\n break;\n }\n\n case 'ArrowDown': {\n evt.preventDefault();\n if(typeof arrowDown === 'function'){\n arrowDown(index);\n }\n break;\n }\n }\n\n sendOnKeyDownEvent($component, evt);\n };\n\n const pointerClicked = () => {\n if(disabled) return;\n sendPointerClickedEvent($component, $pointer);\n };\n\n // ---------- Lifecycle ------------------------\n\n (() => {\n $pointer.className = `pointer pointer-${ index }`;\n\n $pointer.addEventListener('keydown', pointerKeyDown);\n $pointer.addEventListener('click', pointerClicked);\n })();\n\n const destroy = () => {\n $pointer.removeEventListener('keydown', pointerKeyDown);\n $pointer.removeEventListener('click', pointerClicked);\n $pointer.remove();\n };\n\n return {\n $pointer,\n\n get percent() {\n return percent;\n },\n\n get disabled() {\n return disabled;\n },\n\n set disabled(_disabled) {\n setDisabled(_disabled);\n },\n\n updatePosition,\n\n isClicked,\n setCallbacks,\n setAttr,\n getAttr,\n\n destroy,\n };\n};\n\n", "import { isNumber } from '../domain/math-provider';\n\nexport const parseData = (dataString: string | undefined | null): (string | number)[] | undefined => {\n if (dataString === undefined || dataString === null) return undefined;\n\n if(Array.isArray(dataString)) return dataString as (string | number)[];\n\n const result = dataString.trim();\n if (result === '') return undefined;\n\n const parts = dataString.split(',');\n const list: string[] = [];\n let allValuesAreNumbers = true;\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i].trim();\n if (part === '') continue;\n\n list.push(part);\n\n if (!isNumber(part)) {\n allValuesAreNumbers = false;\n }\n }\n\n if (!allValuesAreNumbers) return list;\n\n return list.map((item) => Number(item));\n};\n\nexport const findValueIndexInData = (val: string | number, data: (string | number)[] | undefined) => {\n return data ? data.findIndex((item) => item === val || item.toString().trim() === val.toString().trim()) : -1;\n};", "import * as TypeEnum from '../enums/type-enum';\n\nexport interface IPanelFill {\n updatePosition: (type: string, percents: (number | undefined)[], rightToLeft: boolean, bottomToTop: boolean) => void;\n}\n\nexport const PanelFill = ($fill: HTMLElement) : IPanelFill => {\n\n const updatePosition = (type: string, percents: (number | undefined)[], rightToLeft: boolean, bottomToTop: boolean) => {\n\n if(percents.length <= 0) return;\n\n const oneOnly = percents.length === 1;\n const first = percents[0] as number;\n const last = percents[percents.length - 1] as number;\n\n if (type === TypeEnum.Vertical) {\n $fill.style.removeProperty('width');\n $fill.style.removeProperty('right');\n $fill.style.removeProperty('left');\n\n if (!oneOnly) {\n $fill.style.height = `${Math.abs(first - last)}%`;\n }\n else{\n $fill.style.height = `${ first }%`;\n }\n\n if (bottomToTop) {\n $fill.style.bottom = '0%';\n\n if (!oneOnly) {\n $fill.style.top = `${Math.min(100 - last, 100 - first)}%`;\n }\n else{\n $fill.style.top = 'auto';\n }\n }\n else {\n $fill.style.bottom = 'auto';\n\n if (!oneOnly) {\n $fill.style.top = `${Math.min(first, last)}%`;\n }\n else{\n $fill.style.top = '0%';\n }\n }\n }\n else {\n $fill.style.removeProperty('height');\n $fill.style.removeProperty('top');\n $fill.style.removeProperty('bottom');\n\n if (!oneOnly) {\n $fill.style.width = `${ Math.abs(first - last) }%`;\n }\n else{\n $fill.style.width = `${ first }%`;\n }\n\n if (rightToLeft) {\n $fill.style.right = '0%';\n\n if (!oneOnly) {\n $fill.style.left = `${ Math.min(100 - last, 100 - first) }%`;\n }\n else{\n $fill.style.left = 'auto';\n }\n }\n else {\n $fill.style.right = 'auto';\n\n if (!oneOnly) {\n $fill.style.left = `${ Math.min(first, last) }%`;\n }\n else{\n $fill.style.left = '0%';\n }\n }\n }\n };\n\n return {\n updatePosition,\n };\n};", "/**\n * Constants instead of typescript enums ---> smaller bundle size\n */\nexport const AnimateOnClick = '--animate-onclick';\nexport const SliderWidth = '--width';\nexport const SliderHeight = '--height';\nexport const SliderRadius = '--panel-bg-border-radius';\n\nexport const SliderBg = '--panel-bg';\nexport const SliderBgHover = '--panel-bg-hover';\nexport const SliderBgFill = '--panel-bg-fill';\n\nexport const PointerWidth = '--pointer-width';\nexport const PointerHeight = '--pointer-height';\nexport const PointerRadius = '--pointer-border-radius';\nexport const PointerBg = '--pointer-bg';\nexport const PointerBgHover = '--pointer-bg-hover';\nexport const PointerBgFocus = '--pointer-bg-focus';\nexport const PointerShadow = '--pointer-shadow';\nexport const PointerShadowHover = '--pointer-shadow-hover';\nexport const PointerShadowFocus = '--pointer-shadow-focus';\nexport const PointerBorder = '--pointer-border';\nexport const PointerBorderHover = '--pointer-border-hover';\nexport const PointerBorderFocus = '--pointer-border-focus';\n", "import * as AttributesEnum from '../enums/attributes-enum';\nimport { getNumber } from './math-provider';\n\nexport const getAttributesByRegex = ($component: HTMLElement, regex: RegExp, parseValue?: (val: string) => T) : Map => {\n\n const map = new Map();\n\n for (const attr of $component.attributes) {\n const valueProp = attr.nodeName.trim().toLowerCase();\n const isValue = regex.test(valueProp);\n if(!isValue) continue;\n\n const key = valueProp.replace(/\\D/g, '').trim();\n const keyNum = (key === '' || key === '0' || key === '1') ? 0 : (getNumber(key, 0) - 1);\n const value = parseValue && typeof parseValue === 'function' ? parseValue(attr.value) : attr.value;\n map.set(keyNum, value as T);\n }\n\n return map;\n};\n\nexport const getExternalCSSList = ($component: HTMLElement) => {\n if(!$component) return null;\n\n const str = $component.getAttribute(AttributesEnum.CSSLinks);\n if(!str) return null;\n\n const parts = str.split(';');\n const cssList: string[] = [];\n\n for(const part of parts){\n if(part.trim() === '') continue;\n cssList.push(part.trim());\n }\n\n return cssList;\n};", "import * as AttributesEnum from '../enums/attributes-enum';\nimport * as CSSVariables from '../enums/css-vars-enum';\nimport { IPointer } from './pointer';\nimport { getAttributesByRegex } from '../domain/common-provider';\n\nexport interface IStyles {\n\n setStyle: (key: string, value: string | null | undefined, index: number) => void;\n getStyle: (key: string, index: number) => string | undefined;\n\n theme: string | null;\n readonly pointerShapes: (string | null)[];\n setPointerShape: (index: number, value: string | null) => void;\n}\n\nexport const stylePropertiesList: [string, string, string, RegExp | null][] = [\n [CSSVariables.SliderWidth, AttributesEnum.SliderWidth, 'sliderWidth', null],\n [CSSVariables.SliderHeight, AttributesEnum.SliderHeight, 'sliderHeight', null],\n [CSSVariables.SliderRadius, AttributesEnum.SliderRadius, 'sliderRadius', null],\n\n [CSSVariables.SliderBg, AttributesEnum.SliderBg, 'sliderBg', null],\n [CSSVariables.SliderBgHover, AttributesEnum.SliderBgHover, 'sliderBgHover', null],\n [CSSVariables.SliderBgFill, AttributesEnum.SliderBgFill, 'sliderBgFill', null],\n\n [CSSVariables.PointerWidth, AttributesEnum.PointerWidth, 'pointer#Width', /^pointer([0-9]*)-width$/], // pointer-width, pointer2-width, ...\n [CSSVariables.PointerHeight, AttributesEnum.PointerHeight, 'pointer#Height', /^pointer([0-9]*)-height$/], // pointer-height$, pointer2-height, ...\n [CSSVariables.PointerRadius, AttributesEnum.PointerRadius, 'pointer#Radius', /^pointer([0-9]*)-radius$/], // pointer-radius, pointer2-radius, ...\n [CSSVariables.PointerBg, AttributesEnum.PointerBg, 'pointer#Bg', /^pointer([0-9]*)-bg$/], // pointer-bg, pointer2-bg, ...\n [CSSVariables.PointerBgHover, AttributesEnum.PointerBgHover, 'pointer#BgHover', /^pointer([0-9]*)-bg-hover$/], // pointer-bg-hover, pointer2-bg-hover, ...\n [CSSVariables.PointerBgFocus, AttributesEnum.PointerBgFocus, 'pointer#BgFocus', /^pointer([0-9]*)-bg-focus$/], // pointer-bg-focus, pointer2-bg-focus, ...\n [CSSVariables.PointerShadow, AttributesEnum.PointerShadow, 'pointer#Shadow', /^pointer([0-9]*)-shadow$/], // pointer-shadow, pointer2-shadow, ...\n [CSSVariables.PointerShadowHover, AttributesEnum.PointerShadowHover, 'pointer#ShadowHover', /^pointer([0-9]*)-shadow-hover$/], // pointer-shadow-hover, pointer2-shadow-hover, ...\n [CSSVariables.PointerShadowFocus, AttributesEnum.PointerShadowFocus, 'pointer#ShadowFocus', /^pointer([0-9]*)-shadow-focus$/], // pointer-shadow-focus, pointer2-shadow-focus, .\n [CSSVariables.PointerBorder, AttributesEnum.PointerBorder, 'pointer#Border', /^pointer([0-9]*)-border$/], // pointer-border, pointer2-border, ...\n [CSSVariables.PointerBorderHover, AttributesEnum.PointerBorderHover, 'pointer#BorderHover', /^pointer([0-9]*)-border-hover$/], // pointer-border-hover, pointer2-border-hover, ...\n [CSSVariables.PointerBorderFocus, AttributesEnum.PointerBorderFocus, 'pointer#BorderFocus', /^pointer([0-9]*)-border-focus$/], // pointer-border-focus, pointer2-border-focus, ...\n];\n\nexport const Styles = ($component: HTMLElement, $slider: HTMLElement, pointers: IPointer[]) : IStyles => {\n\n let theme: string | null = null;\n const pointerShapes: (string | null)[] = [];\n const stylesMap: Map = new Map();\n\n // ----- SETTERS ---------------------------\n\n const removeClassesStartWith = (prefix: string, $element = $slider) => {\n const classList = [...$element.classList];\n for(const className of classList){\n if(className.startsWith(prefix)){\n $slider.classList.remove(className);\n }\n }\n };\n\n const removeClasses = () => {\n // remove shape classes from $slider\n removeClassesStartWith('shape');\n\n // remove shape classes from pointers (if there are any)\n const $pointers = $slider.querySelectorAll('.pointer');\n for(const $pointer of $pointers){\n removeClassesStartWith('shape', $pointer as HTMLElement);\n }\n };\n\n const setTheme = (val: string | null) => {\n theme = val;\n removeClassesStartWith('theme-');\n\n if(typeof val === 'string'){\n $slider.classList.add(`theme-${ val }`);\n }\n };\n\n const updatePointerShapes = () => {\n removeClasses();\n\n if(pointerShapes.length <= 0) return;\n\n // first shape is added to the slider, as it should be applied on all pointers (potentially)\n $slider.classList.add('shape', `shape-${ pointerShapes[0] }`);\n\n // other shapes should be added to the relevant pointers each;\n for(let i=1; i {\n pointerShapes[index] = value;\n updatePointerShapes();\n };\n\n const setPointerShapes = () => {\n\n removeClasses();\n\n // pointer-shape, pointer2-shape, ...\n const list = getAttributesByRegex($component, /^pointer([0-9]*)-shape$/);\n if(list.size <= 0) return;\n\n // save shapes to the list that can be used for the getter APIs later\n for(const item of list){\n const index = item[0] as number;\n pointerShapes[index] = item[1] as string;\n }\n\n updatePointerShapes();\n };\n\n const getKey = (key: string, index: number) => {\n return `${ key }-${ index }`;\n };\n\n const setStyle = (key: string, value: string | null | undefined, index: number) => {\n\n const pointer = pointers[index];\n if(!pointer) return;\n\n const $styleHolder = index === 0 ? $slider : pointer.$pointer;\n\n if(value === null || value === undefined){\n if(stylesMap.has(getKey(key, index))){\n stylesMap.delete(getKey(key, index));\n }\n $styleHolder.style.removeProperty(key);\n return;\n }\n\n stylesMap.set(getKey(key, index), value);\n $styleHolder.style.setProperty(key, value);\n };\n\n const getStyle = (key: string, index: number) => {\n return stylesMap.get(getKey(key, index));\n };\n\n // ---- initialization ---------------------\n (() => {\n\n for(const item of stylePropertiesList){\n\n // '--pointer-width', 'pointer-width', 'pointerWidth', regex or null\n const [cssVariableName, attrName, apiProperty, regex] = item;\n\n // apply the styles via CSS variables;\n // if index = 0 ---> apply the style on the whole slider, so all\n // pointers will inherit it;\n // otherwise, apply styles on the individual pointers;\n if(regex){\n const list = getAttributesByRegex($component, regex);\n for(const item of list){\n const index = item[0];\n const value = item[1] as string;\n setStyle(cssVariableName, value, index);\n }\n }\n else{\n const cssVariableValue = $component.getAttribute(attrName);\n setStyle(cssVariableName, cssVariableValue, 0);\n }\n\n // add APIs --------------------------\n const apiProperties: [string, number][] = [];\n\n if(apiProperty.indexOf('#') === -1){\n apiProperties.push([apiProperty, 0]);\n }\n else{\n apiProperties.push([apiProperty.replace('#', ''), 0]);\n apiProperties.push([apiProperty.replace('#', '0'), 0]);\n apiProperties.push([apiProperty.replace('#', '1'), 0]);\n for(let i=1; i {\n setStyle(cssVariableName, val, index);\n },\n });\n }\n }\n catch (ex){\n console.error(ex);\n }\n }\n }\n\n setTheme($component.getAttribute(AttributesEnum.Theme));\n setPointerShapes();\n })();\n\n return {\n setStyle,\n getStyle,\n\n get theme() {\n return theme;\n },\n\n set theme(val){\n setTheme(val);\n },\n\n get pointerShapes() {\n return pointerShapes;\n },\n\n setPointerShape,\n };\n};", "/**\n * Constants instead of typescript enums ---> smaller bundle size\n */\nexport const AnimateOnClick = 'animate-on-click';\nexport const RangeDragging = 'range-dragging';\n", "import { IPlugin, IPluginGetters, IPluginSetters, IPluginUpdateData } from './interfaces';\n\ndeclare global {\n interface Window {\n tcRangeSliderPlugins: (() => IPlugin)[];\n tcRangeSliderObservedAttr: string[];\n }\n}\n\nexport interface IPluginsManager {\n init: () => void;\n\n update: (data: IPluginUpdateData) => void;\n\n onAttrChange: (attrName: string, newValue: string) => void;\n\n destroy: () => void;\n}\n\nexport const PluginsManager = (\n $component: HTMLElement,\n requestUpdatePlugins: () => void,\n setters: IPluginSetters,\n getters: IPluginGetters,\n) : IPluginsManager => {\n\n const plugins: IPlugin[] = [];\n\n // ------ APIs ----------------------------\n\n const update = (data: IPluginUpdateData) => {\n for(const plugin of plugins){\n if(plugin.update && typeof plugin.update === 'function'){\n plugin.update(data);\n }\n }\n };\n\n const destroy = () => {\n for(const plugin of plugins){\n if(plugin.destroy && typeof plugin.destroy === 'function'){\n plugin.destroy();\n }\n }\n };\n\n const onAttrChange = (_attrName: string, _newValue: string) => {\n for(const plugin of plugins){\n if(plugin.onAttrChange && typeof plugin.onAttrChange === 'function'){\n plugin.onAttrChange(\n _attrName,\n _newValue\n );\n }\n }\n };\n\n const defineSettersGetters = (plugin: IPlugin) => {\n if(!plugin.gettersAndSetters) return;\n\n for(const item of plugin.gettersAndSetters){\n if(!item.name || !item.attributes) continue;\n\n try{\n if(!Object.prototype.hasOwnProperty.call($component, item.name)){\n Object.defineProperty($component, item.name, item.attributes);\n }\n }\n catch (ex){\n console.error('defineSettersGetters error:', ex);\n }\n }\n };\n\n const initStyles = (plugin: IPlugin) => {\n if(!plugin.css) return;\n\n const $style = $component.shadowRoot?.querySelector('style');\n if(!$style) return;\n\n $style.innerHTML += plugin.css;\n };\n\n // ------ initialization ------------------\n const init = () => {\n if(!window.tcRangeSliderPlugins) return;\n\n for(const pluginFunc of window.tcRangeSliderPlugins){\n const plugin = pluginFunc();\n plugins.push(plugin);\n\n if(plugin.init && typeof plugin.init === 'function'){\n\n // call plugin initialization function\n plugin.init(\n $component,\n requestUpdatePlugins,\n setters,\n getters,\n );\n\n // if plugin has getters and setters that used for APIs ---> define them\n defineSettersGetters(plugin);\n\n // if plugin has css rules defined as plain text ---> they can be added dynamically\n initStyles(plugin);\n }\n }\n };\n\n return {\n init,\n update,\n onAttrChange,\n destroy,\n };\n};", "import { getNumber, isNumber } from './math-provider';\nimport { IPointer, Pointer } from '../ui/pointer';\nimport { ISlider } from '../ui/slider';\n\nexport const MAX_VALUES_API = 10;\nexport const POINTER_Z_INDEX_DEFAULT = 20;\n\nexport const initPointers = ($component: HTMLElement, $pointer: HTMLElement) => {\n const map = new Map();\n const regex = /^value([0-9]*)$/;\n\n // collect data about key / value pairs: value=50, value2=70, etc.\n // value = value0 = value1 (all these are aliases of each other)\n for (const attr of $component.attributes) {\n const valueProp = attr.nodeName.trim().toLowerCase();\n const isValue = regex.test(valueProp);\n if(!isValue) continue;\n\n const key = valueProp.replace('value', '').trim();\n const keyNum = (key === '' || key === '0' || key === '1') ? 0 : (getNumber(key, 0) - 1);\n const value = isNumber(attr.value) ? getNumber(attr.value, 0) : attr.value;\n\n map.set(keyNum, value);\n }\n\n // find the max value number in the map\n const max = Math.max(...Array.from(map.keys()));\n const pointers: [IPointer, string | number | undefined][] = [];\n\n // first pointer always exists\n pointers.push([Pointer($component, $pointer, 0), map.get(0)]);\n\n // add all other pointers\n let $latestPointer = $pointer;\n\n for(let i=1; i<=max; i++){\n const $newPointer = $pointer.cloneNode(true) as HTMLElement;\n $latestPointer.after($newPointer);\n\n $latestPointer = $newPointer;\n pointers.push([Pointer($component, $newPointer, i), map.get(i)]);\n }\n\n return pointers;\n};\n\nexport const initPointerAPI = (\n $component: HTMLElement,\n slider: ISlider,\n index: number,\n valueProp: string,\n ariaLabelProp: string,\n pointerShapeProp: string,\n pointerDisabledProp: string\n) => {\n\n try{\n\n // `value${ index + 1 }`: value, value0, value1, value2, etc.\n Object.defineProperty($component, valueProp, {\n configurable: true,\n get () {\n if(!slider) return undefined;\n\n const pointer = slider.pointers[index];\n if(!pointer) return undefined;\n\n const val = slider.getTextValue(pointer.percent);\n return isNumber(val) ? getNumber(val, val) : val;\n },\n\n set: (val) => {\n const pointer = slider.pointers[index];\n if(!pointer){\n slider?.addPointer(val);\n }\n else{\n slider?.setValue(val, index);\n }\n },\n });\n\n // `ariaLabel${ index + 1 }`\n Object.defineProperty($component, ariaLabelProp, {\n configurable: true,\n get () {\n return slider?.pointers[index]?.getAttr('aria-label') ?? undefined;\n },\n\n set: (val) => {\n if(!slider) return;\n slider.setAriaLabel(index, val);\n },\n });\n\n // `pointerShape${ index + 1 }`\n Object.defineProperty($component, pointerShapeProp, {\n configurable: true,\n get () {\n return slider?.styles?.pointerShapes[index] ?? null;\n },\n\n set: (val) => {\n if(!slider || !slider.styles) return;\n slider.styles.setPointerShape(index, val);\n },\n });\n\n // `pointer${ index + 1 }Disabled`\n Object.defineProperty($component, pointerDisabledProp, {\n configurable: true,\n get () {\n return slider?.pointers[index].disabled ?? false;\n },\n\n set: (val) => {\n if(!slider) return;\n\n const pointer = slider?.pointers[index];\n if(!pointer) return;\n\n pointer.disabled = val;\n },\n });\n }\n catch (ex){\n console.error(ex);\n }\n};\n\nexport const initPointerAPIs = ($component: HTMLElement, slider: ISlider) => {\n\n const apiProperties: [string, string, string, string, number][] = [\n ['value', 'ariaLabel', 'pointerShape', 'pointerDisabled', 0],\n ['value0', 'ariaLabel0', 'pointerShape0', 'pointer0Disabled', 0],\n ['value1', 'ariaLabel1', 'pointerShape1', 'pointer1Disabled', 0],\n ];\n\n // The maximum number of such pointers is determined by the MAX_VALUES_API API constant (for performance reasons).\n // https://github.com/mzusin/toolcool-range-slider/issues/2\n for(let i=2; i {\n\n const $container = $component.shadowRoot?.querySelector('.container') as HTMLElement\n if(!$container) return;\n\n for(const pointer of pointers){\n if(isDesc){\n $container.prepend(pointer.$pointer);\n }\n else{\n $container.append(pointer.$pointer);\n }\n }\n};\n\n/**\n * Set greater z-index only to the active pointer.\n * https://github.com/mzusin/toolcool-range-slider/issues/15\n */\nexport const setZIndex = (pointers: IPointer[], selectedPointer: IPointer | null | undefined) => {\n if(!selectedPointer || pointers.length <= 1) return;\n\n for(const pointer of pointers) {\n pointer.$pointer.style.zIndex = POINTER_Z_INDEX_DEFAULT.toString();\n }\n\n selectedPointer.$pointer.style.zIndex = (POINTER_Z_INDEX_DEFAULT * 2).toString();\n};\n", "import { IPointer, Pointer } from './pointer';\nimport { convertRange, getBoolean, getNumber, isNumber, roundToStep, setDecimalPlaces } from '../domain/math-provider';\nimport * as AttributesEnum from '../enums/attributes-enum';\nimport { TData, TStep } from '../types';\nimport { findValueIndexInData, parseData } from '../dal/data-provider';\nimport * as TypeEnum from '../enums/type-enum';\nimport { IPanelFill, PanelFill } from './panel-fill';\nimport { sendChangeEvent, sendMouseDownEvent, sendMouseUpEvent } from '../domain/events-provider';\nimport { IStyles, Styles } from './styles';\nimport * as CSSVariables from '../enums/css-vars-enum';\nimport * as CssClasses from '../enums/css-classes-enum';\nimport { getAttributesByRegex } from '../domain/common-provider';\nimport { IPluginsManager, PluginsManager } from '../plugins/plugins-manager';\nimport { changePointersOrder, setZIndex } from '../domain/pointers-provider';\n\nexport interface ISlider {\n readonly pointers: IPointer[];\n readonly styles: IStyles | null;\n readonly pluginsManager: IPluginsManager | null;\n\n pointersOverlap: boolean;\n pointersMinDistance: number;\n pointersMaxDistance: number;\n rangeDragging: boolean;\n\n readonly min: number | string;\n readonly max: number | string;\n readonly step: TStep;\n readonly data: TData;\n\n type: string;\n rightToLeft: boolean;\n bottomToTop: boolean;\n disabled: boolean;\n keyboardDisabled: boolean;\n mousewheelDisabled: boolean;\n round: number;\n animateOnClick: string | undefined | boolean;\n\n getAriaLabel: (index: number) => (string | undefined);\n setAriaLabel: (index: number, ariaLabel: string | undefined) => void;\n\n setMin: (value: number | string | undefined | null) => void;\n setMax: (value: number | string | undefined | null) => void;\n setValue: (value: number | string | undefined | null, index: number) => void;\n setStep: (value: TStep | string) => void;\n setData: (value: TData | string | null | number) => void;\n getTextValue: (_percent: number | undefined) => undefined | string | number;\n\n addPointer: (value: number | string | undefined | null) => number;\n removePointer: () => number;\n\n destroy: () => void;\n}\n\nexport const MIN_DEFAULT = 0;\nexport const MAX_DEFAULT = 100;\nexport const ROUND_DEFAULT = 2;\nexport const ANIMATE_ON_CLICK_DEFAULT = '0.3s';\n\nexport const Slider = ($component: HTMLElement, $slider: HTMLElement, pointersList: [IPointer, string | number | undefined][]) : ISlider => {\n\n const pointers = pointersList.map(item => item[0]);\n let selectedPointer: IPointer | null | undefined = null;\n let panelFill: IPanelFill | null = null;\n let styles: IStyles | null = null;\n let pluginsManager: IPluginsManager | null = null;\n\n let min = MIN_DEFAULT;\n let max = MAX_DEFAULT;\n let step: TStep = undefined; // step is defined in absolute units (not percent!)\n let data: TData = undefined;\n let type: string = TypeEnum.Horizontal;\n let round: number = ROUND_DEFAULT;\n let rightToLeft = false;\n let bottomToTop = false;\n\n let pointersOverlap = false;\n let pointersMinDistance = 0;\n let pointersMaxDistance = Infinity;\n\n let rangeDragging = false;\n\n let rangeDraggingStart: number | undefined = undefined;\n let rangeDraggingDiff: number | undefined = undefined;\n\n let disabled = false;\n let keyboardDisabled = false;\n let mousewheelDisabled = false;\n let animateOnClick: string | undefined = ANIMATE_ON_CLICK_DEFAULT;\n\n const ariaLabels: (string | undefined)[] = [];\n\n // -------------- EVENTS --------------------\n\n const onMouseDown = (evt: MouseEvent) => {\n if(disabled) return;\n\n if (evt.preventDefault) {\n evt.preventDefault();\n }\n\n onValueChange(evt);\n\n window.addEventListener('mousemove', onValueChange);\n window.addEventListener('mouseup', onMouseUp);\n\n sendMouseDownEvent($component, evt);\n };\n\n const onMouseUp = (evt: MouseEvent) => {\n if(disabled) return;\n\n rangeDraggingStart = undefined;\n rangeDraggingDiff = undefined;\n\n window.removeEventListener('mousemove', onValueChange);\n window.removeEventListener('mouseup', onMouseUp);\n\n if(animateOnClick){\n $slider.classList.add(CssClasses.AnimateOnClick);\n }\n\n sendMouseUpEvent($component, evt);\n };\n\n const getActivePointer = ($target: HTMLElement, percent: number) => {\n if(pointers.length <= 0) return;\n\n // if only 1 pointer exists --> return it\n if(pointers.length === 1){\n if(pointers[0].isClicked($target) && animateOnClick){\n $slider.classList.remove(CssClasses.AnimateOnClick);\n }\n\n return pointers[0];\n }\n\n const panelFillClicked = isPanelFillClicked($target);\n\n if(rangeDragging){\n\n let _dragPercent = percent;\n const stepPercent = getStepPercent(_dragPercent);\n if(stepPercent !== undefined){\n _dragPercent = roundToStep(_dragPercent, stepPercent);\n }\n\n if(panelFillClicked){\n rangeDraggingStart = _dragPercent;\n rangeDraggingDiff = 0;\n\n if(animateOnClick){\n $slider.classList.remove(CssClasses.AnimateOnClick);\n }\n }\n else{\n if(rangeDraggingStart !== undefined){\n rangeDraggingDiff = _dragPercent - rangeDraggingStart;\n rangeDraggingStart = _dragPercent;\n }\n }\n }\n\n if(!isPanelClicked($target) && !panelFillClicked){\n // if clicked directly on 1 of the pointers ---> return it\n for(const pointer of pointers){\n if(!pointer.isClicked($target) || pointer.disabled) continue;\n\n if(animateOnClick){\n $slider.classList.remove(CssClasses.AnimateOnClick);\n }\n\n return pointer;\n }\n\n // if already selected pointer ---> return it\n for(const pointer of pointers){\n if(selectedPointer === pointer) return pointer;\n }\n }\n\n // find the closest pointer and return it\n let minDistance = Infinity;\n let minDistancePointer = null;\n\n for(const pointer of pointers){\n if(pointer.disabled) continue;\n\n const distance = Math.abs(percent - pointer.percent);\n if(distance < minDistance){\n minDistance = distance;\n minDistancePointer = pointer;\n }\n }\n\n return minDistancePointer;\n };\n\n const getSelectedPointerIndex = () => {\n return pointers.findIndex(pointer => selectedPointer === pointer && !pointer.disabled);\n };\n\n const onValueChange = (evt: MouseEvent | TouchEvent) => {\n\n // find the percent [0, 100] of the current mouse position in vertical or horizontal slider\n let percent;\n\n if(type === TypeEnum.Vertical){\n const { height: boxHeight, top: boxTop } = $slider.getBoundingClientRect();\n const mouseY = evt.type.indexOf('mouse') !== -1 ? (evt as MouseEvent).clientY : (evt as TouchEvent).touches[0].clientY;\n const top = Math.min(Math.max(0, mouseY - boxTop), boxHeight);\n percent = (top * 100) / boxHeight;\n }\n else{\n const { width: boxWidth, left: boxLeft } = $slider.getBoundingClientRect();\n const mouseX = evt.type.indexOf('mouse') !== -1 ? (evt as MouseEvent).clientX : (evt as TouchEvent).touches[0].clientX;\n const left = Math.min(Math.max(0, mouseX - boxLeft), boxWidth);\n percent = (left * 100) / boxWidth;\n }\n\n if(rightToLeft || bottomToTop){\n percent = 100 - percent;\n }\n\n selectedPointer = getActivePointer(evt.target as HTMLElement, percent);\n\n if(selectedPointer) {\n // https://github.com/mzusin/toolcool-range-slider/issues/15\n setZIndex(pointers, selectedPointer);\n }\n\n // handle range dragging\n if(rangeDragging && pointers.length > 1 && rangeDraggingDiff !== undefined){\n\n const firstPointer = pointers[0];\n const lastPointer = pointers[pointers.length - 1];\n\n const firstSmallerThanMin = firstPointer.percent + rangeDraggingDiff < 0;\n const lastGreaterThanMax = lastPointer.percent + rangeDraggingDiff > 100;\n if(firstSmallerThanMin || lastGreaterThanMax) return;\n\n for(let i=0; i {\n if (disabled ||\n document.activeElement !== $component ||\n selectedPointer?.disabled) return;\n\n evt.stopPropagation();\n evt.preventDefault();\n\n const scrollTop = evt.deltaY < 0;\n const rightOrBottom = rightToLeft || bottomToTop;\n const shouldGoPrev = scrollTop ? !rightOrBottom : rightOrBottom;\n\n const foundIndex = getSelectedPointerIndex();\n if(foundIndex === -1) return;\n\n if(shouldGoPrev){\n goPrev(foundIndex, pointers[foundIndex].percent);\n }\n else{\n goNext(foundIndex, pointers[foundIndex].percent);\n }\n };\n\n // -------------- Arrows --------------------\n\n const arrowLeft = (pointerIndex: number) => {\n if(disabled || keyboardDisabled) return;\n\n if(type === TypeEnum.Vertical){\n if(bottomToTop){\n // jump to the max value\n setPositions(pointerIndex, 100);\n }\n else{\n // jump to the min value\n setPositions(pointerIndex, 0);\n }\n }\n else{\n if(rightToLeft){\n // go forward\n goNext(pointerIndex, pointers[pointerIndex].percent);\n }\n else{\n // go backwards\n goPrev(pointerIndex, pointers[pointerIndex].percent);\n }\n }\n };\n\n const arrowRight = (pointerIndex: number) => {\n if(disabled || keyboardDisabled) return;\n\n if(type === TypeEnum.Vertical){\n if(bottomToTop){\n // jump to the min value\n setPositions(pointerIndex, 0);\n }\n else{\n // jump to the max value\n setPositions(pointerIndex, 100);\n }\n }\n else{\n if(rightToLeft){\n // go backward\n goPrev(pointerIndex, pointers[pointerIndex].percent);\n }\n else{\n // go forward\n goNext(pointerIndex, pointers[pointerIndex].percent);\n }\n }\n };\n\n const arrowUp = (pointerIndex: number) => {\n if(disabled || keyboardDisabled) return;\n\n if(type === TypeEnum.Vertical){\n if(bottomToTop){\n // go forwards\n goNext(pointerIndex, pointers[pointerIndex].percent);\n }\n else{\n // go backwards\n goPrev(pointerIndex, pointers[pointerIndex].percent);\n }\n }\n else{\n if(rightToLeft){\n // jump to the max value\n setPositions(pointerIndex, 100);\n }\n else{\n // jump to the min value\n setPositions(pointerIndex, 0);\n }\n }\n };\n\n const arrowDown = (pointerIndex: number) => {\n if(disabled || keyboardDisabled) return;\n\n if(type === TypeEnum.Vertical){\n if(bottomToTop){\n // go backward\n goPrev(pointerIndex, pointers[pointerIndex].percent);\n }\n else{\n // go forward\n goNext(pointerIndex, pointers[pointerIndex].percent);\n }\n }\n else{\n if(rightToLeft){\n // jump to the min value\n setPositions(pointerIndex, 0);\n }\n else{\n // jump to the max value\n setPositions(pointerIndex, 100);\n }\n }\n };\n\n // -------------- Helpers ------------------------\n\n const isPanelClicked = ($target: HTMLElement) => {\n return $target.classList.contains('panel');\n };\n\n const isPanelFillClicked = ($target: HTMLElement) => {\n return $target.classList.contains('panel-fill');\n };\n\n const goPrev = (index: number, _percent: number | undefined) => {\n if(_percent === undefined) return;\n\n let stepPercent = getStepPercent(_percent);\n\n if(stepPercent == undefined){\n stepPercent = 1;\n }\n\n _percent -= stepPercent;\n\n if(_percent < 0){\n _percent = 0;\n }\n\n setPositions(index, _percent);\n };\n\n const goNext = (index: number, _percent: number | undefined) => {\n\n if(_percent === undefined) return;\n\n let stepPercent = getStepPercent(_percent);\n\n if(stepPercent == undefined){\n stepPercent = 1;\n }\n\n _percent += stepPercent;\n\n if(_percent > 100){\n _percent = 100;\n }\n\n setPositions(index, _percent);\n };\n\n const updatePlugins = () => {\n\n if(!pluginsManager) return;\n pluginsManager.update({\n percents: getPercents(),\n values: getValues(),\n $pointers: getPointerElements(),\n\n min: getNumericMin(),\n max: getNumericMax(),\n\n data: getData(),\n step: getStep(),\n round: getRound(),\n type: getType(),\n\n textMin: getMin(),\n textMax: getMax(),\n\n rightToLeft: isRightToLeft(),\n bottomToTop: isBottomToTop(),\n\n pointersOverlap: isPointersOverlap(),\n pointersMinDistance: getPointersMinDistance(),\n pointersMaxDistance: getPointersMaxDistance(),\n rangeDragging: isRangeDraggingEnabled(),\n\n disabled: isDisabled(),\n keyboardDisabled: isKeyboardDisabled(),\n mousewheelDisabled: isMousewheelDisabled(),\n });\n };\n\n const requestUpdatePlugins = () => {\n updatePlugins();\n };\n\n // -------------- Getters --------------------\n\n const getPointerLeftWall = (pointerIndex: number) => {\n if(pointersOverlap || pointers.length <= 1 || max === min) return undefined;\n\n if(pointerIndex === 0){\n // by default 0, but if min distance between pointers is defined --->\n // then the distance to the next pointer\n const converted = pointersMaxDistance * 100 / (max - min);\n return Math.max(0, pointers[pointerIndex + 1].percent - converted);\n }\n else{\n // by default previous pointer, but if min distance between pointers is defined --->\n // then the distance to the next pointer\n const converted = pointersMinDistance * 100 / (max - min);\n return Math.min(pointers[pointerIndex - 1].percent + converted, 100);\n }\n };\n\n const getPointerRightWall = (pointerIndex: number) => {\n if(pointersOverlap || pointers.length <= 1 || max === min) return undefined;\n\n if(pointerIndex === pointers.length - 1){\n // by default 100, but if min distance between pointers is defined --->\n // then the distance to the previous pointer\n const converted = pointersMaxDistance * 100 / (max - min);\n return Math.min(pointers[pointerIndex - 1].percent + converted, 100);\n }\n else{\n // distance to the next pointer\n const converted = pointersMinDistance * 100 / (max - min);\n return Math.max(0, pointers[pointerIndex + 1].percent - converted);\n }\n };\n\n /**\n * user step is defined in absolute values;\n * this function return it as %\n */\n const getStepPercent = (_percent: number) => {\n\n let _step: number | undefined | null;\n\n if(typeof step === 'function'){\n // convert percent to value: [0, 100] to [min, max]\n const currentValue = convertRange(0, 100, min, max, _percent);\n\n // the slider function provided by user should return an absolute value, not %\n _step = step(currentValue, _percent);\n }\n else{\n // the step value provided by the user should be absolute value (not %), undefined, or null\n _step = step;\n }\n\n // round percent to step\n if(isNumber(_step)){\n\n /*\n min ......... max (step = 1)\n 0 ........... 100 (step = ?)\n\n (max - min) ....... step (=1)\n 100 ............... ?\n\n ? = 100 * step / (max - min)\n */\n\n const diff = max - min;\n _step = diff === 0 ? 0 : (_step as number) * 100 / diff;\n\n return _step;\n }\n\n return undefined;\n };\n\n const getTextValue = (_percent: number | undefined) => {\n if(_percent === undefined) return undefined;\n\n const val = convertRange(0, 100, min, max, _percent);\n\n if(data !== undefined){\n return data[Math.round(val)];\n }\n\n return setDecimalPlaces(val, round);\n };\n\n const getMin = () => {\n\n if(data !== undefined){\n return data[min];\n }\n\n return min;\n };\n\n const getMax = () => {\n\n if(data !== undefined){\n return data[max];\n }\n\n return max;\n };\n\n const getStep = () => {\n return step;\n };\n\n const getPointerMin = (index: number) => {\n if(index <= 0 || pointersOverlap) return getMin();\n return getTextValue(pointers[index - 1].percent) ?? '';\n };\n\n const getPointerMax = (index: number) => {\n if(pointers.length <= 1 ||\n index >= pointers.length - 1 ||\n pointersOverlap) return getMax();\n\n return getTextValue(pointers[index + 1].percent) ?? '';\n };\n\n const getPercents = () => {\n return pointers.map(pointer => pointer.percent);\n };\n\n const getValues = () => {\n return pointers.map(pointer => getTextValue(pointer.percent));\n }\n\n const getPointerElements = () => {\n return pointers.map(pointer => pointer.$pointer);\n };\n\n const getNumericMin = () => {\n return min;\n };\n\n const getNumericMax = () => {\n return max;\n };\n\n const getData = () => {\n return data;\n };\n\n const getType = () => {\n return type;\n };\n\n const getRound = () => {\n return round;\n };\n\n const getPointersMinDistance = () => {\n return pointersMinDistance;\n };\n\n const getPointersMaxDistance = () => {\n return pointersMaxDistance;\n };\n\n const getAriaLabel = (index: number) => {\n return ariaLabels[index];\n };\n\n const isRightToLeft = () => {\n return rightToLeft;\n };\n\n const isBottomToTop = () => {\n return bottomToTop;\n };\n\n const isDisabled = () => {\n return disabled;\n };\n\n const isKeyboardDisabled = () => {\n return keyboardDisabled;\n };\n\n const isMousewheelDisabled = () => {\n return mousewheelDisabled;\n };\n\n const isPointersOverlap = () => {\n return pointersOverlap;\n };\n\n const isRangeDraggingEnabled = () => {\n return rangeDragging;\n };\n\n // -------------- Setters --------------------\n\n const setPositions = (index: number, _percent: number | undefined) => {\n if(_percent === undefined) return;\n\n // round percent to step\n const stepPercent = getStepPercent(_percent);\n\n if(stepPercent !== undefined){\n _percent = roundToStep(_percent, stepPercent);\n }\n\n const pointer = pointers[index];\n if(!pointer) return;\n\n const percentChanged = pointer.updatePosition(_percent, getPointerLeftWall(index), getPointerRightWall(index), type, rightToLeft, bottomToTop);\n panelFill?.updatePosition(type, pointers.map(pointer => pointer.percent), rightToLeft, bottomToTop);\n\n updatePlugins();\n\n for(const pointer of pointers){\n const valueText = getTextValue(pointer.percent);\n if(valueText !== undefined){\n pointer.setAttr('aria-valuenow', valueText.toString());\n pointer.setAttr('aria-valuetext', valueText.toString());\n }\n }\n\n setAriaMinMax();\n\n if(percentChanged){\n sendChangeEvent($component, pointers.map(pointer => getTextValue(pointer.percent)));\n }\n };\n\n const setAllPositions = () => {\n for(let i=0; i {\n\n min = data !== undefined ? 0 : getNumber(_min, MIN_DEFAULT);\n max = data !== undefined ? data.length - 1 : getNumber(_max, MAX_DEFAULT);\n\n // perform validations\n setMin(min);\n setMax(max);\n };\n\n const setAriaMinMax = () => {\n for(let i=0; i {\n min = getNumber(_min, MIN_DEFAULT);\n\n if(min > max){\n max = min + MAX_DEFAULT;\n }\n\n setAllPositions();\n };\n\n const setMax = (_max: number | string | undefined | null) => {\n\n max = getNumber(_max, MAX_DEFAULT);\n\n if(max < min){\n max = min + MAX_DEFAULT;\n }\n\n setAllPositions();\n };\n\n const setValues = (values: (number | string | undefined)[]) => {\n\n // initial values should be initialized together\n // because their validations may depend on each other;\n\n // init initial values with pointers overlap ----------\n pointersOverlap = true;\n\n for(let i=0; i {\n\n let val: number;\n\n if(data !== undefined){\n\n val = (_val === undefined || _val === null) ? 0 : findValueIndexInData(_val, data);\n if(val === -1){\n val = 0;\n }\n }\n else{\n val = getNumber(_val, min);\n\n if(val < min){\n val = min;\n }\n\n if(val > max){\n val = max;\n }\n }\n\n // scale a range [min,max] to [a,b]\n const percent = convertRange(min, max, 0, 100, val);\n\n setPositions(index, percent);\n };\n\n const setStep = (_step: TStep | string) => {\n if(_step === null || _step === undefined){\n step = undefined;\n return;\n }\n\n if (typeof _step === 'function') {\n step = _step;\n setAllPositions();\n return;\n }\n\n if(isNumber(_step)){\n step = getNumber(_step, 1);\n\n const diff = Math.abs(max - min);\n if (step > diff) {\n step = undefined;\n }\n\n setAllPositions();\n return;\n }\n\n step = undefined;\n };\n\n const setPointersOverlap = (_pointersOverlap: boolean) => {\n pointersOverlap = _pointersOverlap;\n setAllPositions();\n };\n\n const setPointersMinDistance = (_pointersMinDistance: number) => {\n if(!isNumber(_pointersMinDistance) || _pointersMinDistance < 0){\n _pointersMinDistance = 0;\n }\n pointersMinDistance = _pointersMinDistance;\n };\n\n const setPointersMaxDistance = (_pointersMaxDistance: number) => {\n if(!isNumber(_pointersMaxDistance) || _pointersMaxDistance < 0){\n _pointersMaxDistance = Infinity;\n }\n pointersMaxDistance = _pointersMaxDistance;\n };\n\n const setDisabled = (_disabled: boolean) => {\n disabled = _disabled;\n $slider.classList.toggle('disabled', disabled);\n\n if(disabled){\n $slider.setAttribute('aria-disabled', 'true');\n }\n else{\n if ($slider.hasAttribute('aria-disabled')) {\n $slider.removeAttribute('aria-disabled');\n }\n }\n };\n\n const setKeyboardDisabled = (_disabled: boolean) => {\n keyboardDisabled = _disabled;\n };\n\n const setMousewheelDisabled = (_disabled: boolean) => {\n mousewheelDisabled = _disabled;\n\n if(mousewheelDisabled){\n document.removeEventListener('wheel', pointerMouseWheel);\n }\n else{\n document.addEventListener('wheel', pointerMouseWheel, { passive: false });\n }\n };\n\n const setData = (_data: TData | string | number | null) => {\n\n if(_data === null || _data === undefined){\n data = undefined;\n return;\n }\n\n data = parseData(_data as string);\n if(data === undefined || data.length <= 0){\n data = undefined;\n return;\n }\n\n setMin(0);\n setMax(data.length - 1);\n\n if(step === undefined){\n setStep(1);\n }\n };\n\n const setType = (_type: string | null | undefined) => {\n\n if(typeof _type === 'string'){\n type = _type.trim().toLowerCase() === TypeEnum.Vertical ? TypeEnum.Vertical : TypeEnum.Horizontal;\n }\n else{\n type = TypeEnum.Horizontal;\n }\n\n const $box = $component.shadowRoot?.querySelector('.range-slider-box');\n if(!$box) return;\n $box.className = `range-slider-box type-${ type }`;\n\n setAllPositions();\n\n // update accessibility properties\n const aria = type === TypeEnum.Vertical ? 'vertical' : 'horizontal';\n for(const pointer of pointers){\n pointer.setAttr('aria-orientation', aria);\n }\n };\n\n const setRightToLeft = (_rightToLeft: boolean) => {\n rightToLeft = _rightToLeft;\n\n if(pointers.length > 1){\n changePointersOrder(pointers, rightToLeft, $component);\n }\n\n setAllPositions();\n updatePlugins();\n };\n\n const setBottomToTop = (_bottomToTop: boolean) => {\n bottomToTop = _bottomToTop;\n\n if(pointers.length > 1){\n changePointersOrder(pointers, bottomToTop, $component);\n }\n\n setAllPositions();\n updatePlugins();\n };\n\n const setRound = (_round: number) => {\n round = getNumber(_round, ROUND_DEFAULT);\n\n if(round < 0){\n round = ROUND_DEFAULT;\n }\n\n updatePlugins();\n };\n\n const setAnimateOnClick = (_animateOnClick: string | boolean | null | undefined) => {\n if(_animateOnClick === null ||\n _animateOnClick === undefined ||\n _animateOnClick.toString().trim().toLowerCase() === 'false'){\n animateOnClick = undefined;\n $slider.style.removeProperty(CSSVariables.AnimateOnClick);\n $slider.classList.remove(CssClasses.AnimateOnClick);\n }\n else{\n animateOnClick = _animateOnClick.toString();\n $slider.style.setProperty(CSSVariables.AnimateOnClick, animateOnClick);\n $slider.classList.add(CssClasses.AnimateOnClick);\n }\n };\n\n const setAriaLabel = (index: number, _ariaLabel: string | undefined) => {\n\n const pointer = pointers[index];\n if(!pointer) return;\n\n pointer.setAttr('aria-label', _ariaLabel);\n ariaLabels[index] = _ariaLabel;\n };\n\n const setRangeDragging = (_rangeDragging: boolean) => {\n rangeDraggingStart = undefined;\n\n if(pointers.length <= 1){\n rangeDragging = false;\n $slider.classList.remove(CssClasses.RangeDragging);\n return;\n }\n\n rangeDragging = _rangeDragging;\n $slider.classList.toggle(CssClasses.RangeDragging, rangeDragging);\n };\n\n // initialization -------------------------------------\n\n const initDisabled = () => {\n setDisabled(getBoolean($component.getAttribute(AttributesEnum.Disabled)));\n keyboardDisabled = getBoolean($component.getAttribute(AttributesEnum.KeyboardDisabled));\n mousewheelDisabled = getBoolean($component.getAttribute(AttributesEnum.MousewheelDisabled));\n\n // handle 'pointer1-disabled, pointer2-disabled, etc.\n const disabledList = getAttributesByRegex($component, /^pointer([0-9]*)-disabled$/, (val: string) => {\n return getBoolean(val);\n });\n\n for(const item of disabledList){\n const pointerIndex = item[0];\n if(!pointers[pointerIndex]) continue;\n pointers[pointerIndex].disabled = item[1];\n }\n };\n\n const initAriaLabels = () => {\n // handle 'aria-label1', 'aria-label2', etc.\n const ariaLabelsList = getAttributesByRegex($component, /^aria-label([0-9]*)$/);\n\n for(const item of ariaLabelsList){\n const index = item[0];\n setAriaLabel(index, item[1] as string);\n }\n };\n\n // add pointer - always to the end\n const addPointer = (value: string | number | undefined) => {\n const len = pointers.length;\n const $latestPointer = pointers[len - 1].$pointer;\n\n const $newPointer = $latestPointer.cloneNode(true) as HTMLElement;\n $latestPointer.after($newPointer);\n const newPointer = Pointer($component, $newPointer, len);\n\n newPointer.setCallbacks(arrowLeft, arrowRight, arrowUp, arrowDown);\n pointers.push(newPointer);\n\n setValue(value, len);\n setAllPositions();\n updatePlugins();\n\n return len;\n };\n\n // always from the end\n const removePointer = () => {\n const len = pointers.length;\n const pointer = pointers[len - 1];\n if(!pointer) return -1;\n\n pointer.destroy();\n pointers.pop();\n\n if(pointers.length <= 1){\n setRangeDragging(false);\n }\n\n setAllPositions();\n updatePlugins();\n\n return len - 1;\n };\n\n (() => {\n\n // init pointer callbacks for arrow keys\n for(const pointer of pointers){\n pointer.setCallbacks(arrowLeft, arrowRight, arrowUp, arrowDown);\n }\n\n // init panel fill\n const $fill = $component.shadowRoot?.querySelector('.panel-fill') as HTMLElement;\n if($fill){\n panelFill = PanelFill($fill);\n }\n\n // init main properties from HTML attributes\n setType($component.getAttribute(AttributesEnum.Type));\n setRightToLeft(getBoolean($component.getAttribute(AttributesEnum.RightToLeft)));\n setBottomToTop(getBoolean($component.getAttribute(AttributesEnum.BottomToTop)));\n\n setMinMax($component.getAttribute(AttributesEnum.Min), $component.getAttribute(AttributesEnum.Max));\n setStep($component.getAttribute(AttributesEnum.Step));\n setData($component.getAttribute(AttributesEnum.Data));\n\n // set value and render the pointers ----------------------\n setValues(pointersList.map(item => item[1]));\n\n // overlaps MUST be defined after the pointer values\n setPointersOverlap(getBoolean($component.getAttribute(AttributesEnum.PointersOverlap)));\n setPointersMinDistance(getNumber($component.getAttribute(AttributesEnum.PointersMinDistance), 0));\n setPointersMaxDistance(getNumber($component.getAttribute(AttributesEnum.PointersMaxDistance), Infinity));\n setRangeDragging(getBoolean($component.getAttribute(AttributesEnum.RangeDragging)));\n\n // additional properties -----------------------------\n setRound(getNumber($component.getAttribute(AttributesEnum.Round), ROUND_DEFAULT));\n initDisabled();\n initAriaLabels();\n\n // init styles ---------\n styles = Styles($component, $slider, pointers);\n setAnimateOnClick($component.getAttribute(AttributesEnum.AnimateOnClick) ?? ANIMATE_ON_CLICK_DEFAULT);\n\n // init slider events -------------------------------------\n $slider.addEventListener('mousedown', onMouseDown);\n $slider.addEventListener('mouseup', onMouseUp);\n $slider.addEventListener('touchmove', onValueChange);\n $slider.addEventListener('touchstart', onValueChange);\n\n if(!mousewheelDisabled){\n document.addEventListener('wheel', pointerMouseWheel, { passive: false });\n }\n\n // init plugins ---------------\n pluginsManager = PluginsManager(\n $component,\n requestUpdatePlugins,\n {\n setValues,\n setMin,\n setMax,\n setStep,\n setPointersOverlap,\n setPointersMinDistance,\n setPointersMaxDistance,\n setDisabled,\n setType,\n setRightToLeft,\n setBottomToTop,\n setRound,\n setKeyboardDisabled,\n setMousewheelDisabled,\n setRangeDragging,\n setData,\n },\n {\n getPercents,\n getValues,\n getPointerElements,\n\n getMin: getNumericMin,\n getMax: getNumericMax,\n\n getStep,\n getData,\n getType,\n getRound,\n\n getTextMin: getMin,\n getTextMax: getMax,\n\n isRightToLeft,\n isBottomToTop,\n\n isDisabled,\n isKeyboardDisabled,\n isMousewheelDisabled,\n\n isPointersOverlap,\n isRangeDraggingEnabled,\n getPointersMinDistance,\n getPointersMaxDistance,\n }\n );\n pluginsManager.init();\n })();\n\n const destroy = () => {\n $slider.removeEventListener('mousedown', onMouseDown);\n $slider.removeEventListener('mouseup', onMouseUp);\n $slider.removeEventListener('touchmove', onValueChange);\n $slider.removeEventListener('touchstart', onValueChange);\n document.removeEventListener('wheel', pointerMouseWheel);\n\n for(const pointer of pointers){\n pointer.destroy();\n }\n\n pluginsManager?.destroy();\n };\n\n return {\n get pointers() {\n return pointers;\n },\n\n get styles() {\n return styles;\n },\n\n get pluginsManager() {\n return pluginsManager;\n },\n\n get min() {\n return getMin();\n },\n\n get max() {\n return getMax();\n },\n\n get step() {\n return getStep();\n },\n\n get pointersOverlap() {\n return isPointersOverlap();\n },\n\n set pointersOverlap(_pointersOverlap) {\n setPointersOverlap(_pointersOverlap);\n },\n\n get pointersMinDistance() {\n return getPointersMinDistance();\n },\n\n set pointersMinDistance(_pointersMinDistance) {\n setPointersMinDistance(_pointersMinDistance);\n },\n\n get pointersMaxDistance() {\n return getPointersMaxDistance();\n },\n\n set pointersMaxDistance(_pointersMaxDistance) {\n setPointersMaxDistance(_pointersMaxDistance);\n },\n\n get disabled() {\n return isDisabled();\n },\n\n set disabled(_disabled) {\n setDisabled(_disabled);\n },\n\n get data() {\n return getData();\n },\n\n get type() {\n return getType();\n },\n\n set type(_type) {\n setType(_type);\n },\n\n get rightToLeft() {\n return isRightToLeft();\n },\n\n set rightToLeft(_rightToLeft) {\n setRightToLeft(_rightToLeft);\n },\n\n get bottomToTop() {\n return isBottomToTop();\n },\n\n set bottomToTop(_bottomToTop) {\n setBottomToTop(_bottomToTop);\n },\n\n get round() {\n return getRound();\n },\n\n set round(_round) {\n setRound(_round);\n },\n\n get animateOnClick() {\n return animateOnClick;\n },\n\n set animateOnClick(_animateOnClick) {\n setAnimateOnClick(_animateOnClick);\n },\n\n get keyboardDisabled() {\n return isKeyboardDisabled();\n },\n\n set keyboardDisabled(_keyboardDisabled){\n setKeyboardDisabled(_keyboardDisabled);\n },\n\n get mousewheelDisabled() {\n return isMousewheelDisabled();\n },\n\n set mousewheelDisabled(_mousewheelDisabled){\n setMousewheelDisabled(_mousewheelDisabled);\n },\n\n get rangeDragging() {\n return isRangeDraggingEnabled();\n },\n\n set rangeDragging(_rangeDragging) {\n setRangeDragging(_rangeDragging);\n },\n\n setMin,\n setMax,\n setValue,\n setStep,\n setData,\n getTextValue,\n setAriaLabel,\n getAriaLabel,\n\n addPointer,\n removePointer,\n\n destroy,\n };\n};\n\n", "import * as AttributesEnum from '../enums/attributes-enum';\nimport { ISlider, ROUND_DEFAULT } from '../ui/slider';\nimport { getBoolean, getNumber } from './math-provider';\nimport { stylePropertiesList } from '../ui/styles';\n\nexport const onAttributeChange = (slider: ISlider, attrName: string, newValue: string) => {\n\n // handle style properties ------------------------------------\n // try to get style property - ['--pointer-width', 'pointer-width', 1, 'pointerWidth']\n const found = stylePropertiesList.find(([_cssVariableName, _attrName, _apiProperty, _regex]) => {\n return _attrName.replace('#', '') === attrName.replace(/\\d+/g, '');\n });\n\n if(found && slider.styles){\n const [_cssVariableName, _attrName, _apiProperty, _regex] = found;\n\n const key = attrName.replace(/\\D/g, '').trim();\n const index = (key === '' || key === '0' || key === '1') ? 0 : (getNumber(key, 0) - 1);\n\n slider.styles.setStyle(_cssVariableName, newValue, index);\n return;\n }\n\n if(slider && slider.pluginsManager){\n slider.pluginsManager.onAttrChange(attrName, newValue);\n }\n\n // handle static properties ----------------------------------\n switch (attrName) {\n\n case AttributesEnum.Min: {\n slider.setMin(newValue);\n break;\n }\n\n case AttributesEnum.Max: {\n slider.setMax(newValue);\n break;\n }\n\n case AttributesEnum.Step: {\n slider.setStep(newValue);\n break;\n }\n\n case AttributesEnum.PointersOverlap: {\n slider.pointersOverlap = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.PointersMinDistance: {\n slider.pointersMinDistance = getNumber(newValue, 0);\n break;\n }\n\n case AttributesEnum.RangeDragging: {\n slider.rangeDragging = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.PointersMaxDistance: {\n slider.pointersMaxDistance = getNumber(newValue, Infinity);\n break;\n }\n\n case AttributesEnum.Disabled: {\n slider.disabled = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.KeyboardDisabled: {\n slider.keyboardDisabled = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.MousewheelDisabled: {\n slider.mousewheelDisabled = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.Data: {\n slider.setData(newValue);\n break;\n }\n\n case AttributesEnum.Type: {\n slider.type = newValue;\n break;\n }\n\n case AttributesEnum.RightToLeft: {\n slider.rightToLeft = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.BottomToTop: {\n slider.bottomToTop = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.Round: {\n slider.round = getNumber(newValue, ROUND_DEFAULT);\n break;\n }\n\n case AttributesEnum.Theme: {\n if(slider.styles){\n slider.styles.theme = newValue;\n }\n break;\n }\n\n case AttributesEnum.AnimateOnClick: {\n slider.animateOnClick = newValue;\n break;\n }\n }\n\n // handle dynamic properties ------------------------------------\n let property: string | null = null;\n\n if(/^value([0-9]*)$/.test(attrName)){\n property = 'value';\n }\n\n if(/^pointer([0-9]*)-disabled$/.test(attrName)){\n property = 'pointer-disabled';\n }\n\n if(/^aria-label([0-9]*)$/.test(attrName)){\n property = 'aria-label';\n }\n\n if(/^pointer([0-9]*)-shape$/.test(attrName)){\n property = 'pointer-shape';\n }\n\n if(!property) return;\n\n const key = attrName.replace(/\\D/g, '').trim();\n const index = (key === '' || key === '0' || key === '1') ? 0 : (getNumber(key, 0) - 1)\n\n switch (property) {\n\n case 'value': {\n slider.setValue(newValue, index);\n break;\n }\n\n case 'pointer-disabled': {\n const pointer = slider?.pointers[index];\n if(!pointer) return;\n\n pointer.disabled = getBoolean(newValue);\n break;\n }\n\n case 'aria-label': {\n slider.setAriaLabel(index, newValue);\n break;\n }\n\n case 'pointer-shape': {\n if(slider.styles){\n slider.styles.setPointerShape(index, newValue);\n }\n break;\n }\n }\n};", "import mainTemplate from '../templates/main.html.js'; // esbuild custom loader\nimport styles from './styles.pcss';\nimport { onAttributeChange } from '../domain/attributes-provider';\nimport { ISlider, ROUND_DEFAULT, Slider } from '../ui/slider';\nimport { TData, TStep } from '../types';\nimport { getBoolean } from '../domain/math-provider';\nimport * as TypeEnum from '../enums/type-enum';\nimport { getExternalCSSList } from '../domain/common-provider';\nimport { initPointerAPI, initPointerAPIs, initPointers } from '../domain/pointers-provider';\n\n/**\n * Usage: \n * Documentation: https://github.com/mzusin/toolcool-range-slider\n */\nclass TCRangeSlider extends HTMLElement {\n\n public slider: ISlider | undefined;\n\n private _externalCSSList: string[] | null = [];\n\n private _observer: MutationObserver | null = null;\n\n // -------------- APIs --------------------\n\n public set step(_step: TStep) {\n if(this.slider){\n this.slider.setStep(_step);\n }\n }\n\n public get step() {\n return this.slider?.step;\n }\n\n public set disabled(_disabled: boolean) {\n if(this.slider){\n this.slider.disabled = _disabled;\n }\n }\n\n public get disabled() {\n return this.slider?.disabled ?? false;\n }\n\n public set data(_data: TData) {\n this.slider?.setData(_data);\n }\n\n public get data() {\n return this.slider?.data;\n }\n\n public set min(_min: number | string | undefined | null) {\n this.slider?.setMin(_min);\n }\n\n public get min() {\n return this.slider?.min;\n }\n\n public set max(_max: number | string | undefined | null) {\n this.slider?.setMax(_max);\n }\n\n public get max() {\n return this.slider?.max;\n }\n\n public set round(_round: number) {\n if(!this.slider) return;\n this.slider.round = _round;\n }\n\n public get round() {\n return this.slider?.round ?? ROUND_DEFAULT;\n }\n\n public set type(_type: string | undefined) {\n if(!this.slider) return;\n this.slider.type = _type ?? TypeEnum.Horizontal;\n }\n\n public get type() {\n return this.slider?.type || TypeEnum.Horizontal;\n }\n\n public set pointersOverlap(_pointersOverlap: boolean) {\n if(!this.slider) return;\n this.slider.pointersOverlap = _pointersOverlap;\n }\n\n public get pointersOverlap() {\n return this.slider?.pointersOverlap ?? false;\n }\n\n public set pointersMinDistance(_pointersMinDistance: number) {\n if(!this.slider) return;\n this.slider.pointersMinDistance = _pointersMinDistance;\n }\n\n public get pointersMinDistance() {\n return this.slider?.pointersMinDistance ?? 0;\n }\n\n public set pointersMaxDistance(_pointersMaxDistance: number) {\n if(!this.slider) return;\n this.slider.pointersMaxDistance = _pointersMaxDistance;\n }\n\n public get pointersMaxDistance() {\n return this.slider?.pointersMaxDistance ?? Infinity;\n }\n\n public set theme(_theme: string | null) {\n if(!this.slider || !this.slider.styles) return;\n this.slider.styles.theme = _theme;\n }\n\n public get theme() {\n return this.slider?.styles?.theme ?? null;\n }\n\n public set rtl(_rtl: boolean) {\n if(!this.slider) return;\n this.slider.rightToLeft = _rtl;\n }\n\n public get rtl() {\n return this.slider?.rightToLeft ?? false;\n }\n\n public set btt(_btt: boolean) {\n if(!this.slider) return;\n this.slider.bottomToTop = _btt;\n }\n\n public get btt() {\n return this.slider?.bottomToTop ?? false;\n }\n\n public set keyboardDisabled(_keyboardDisabled: boolean) {\n if(!this.slider) return;\n this.slider.keyboardDisabled = _keyboardDisabled;\n }\n\n public get keyboardDisabled() {\n return this.slider?.keyboardDisabled ?? false;\n }\n\n public set mousewheelDisabled(_mousewheelDisabled: boolean) {\n if(!this.slider) return;\n this.slider.mousewheelDisabled = _mousewheelDisabled;\n }\n\n public get mousewheelDisabled() {\n return this.slider?.mousewheelDisabled ?? false;\n }\n\n public set animateOnClick(_animateOnClick: string | boolean | undefined) {\n if(!this.slider) return;\n this.slider.animateOnClick = _animateOnClick;\n }\n\n public get animateOnClick() {\n return this.slider?.animateOnClick;\n }\n\n public get rangeDragging(){\n return this.slider?.rangeDragging ?? false;\n }\n\n public set rangeDragging(_rangeDragging: boolean | string | undefined | null) {\n if(this.slider){\n this.slider.rangeDragging = getBoolean(_rangeDragging);\n }\n }\n\n public get externalCSSList() {\n return this._externalCSSList;\n }\n\n public addPointer(value: number | string | undefined) {\n if(!this.slider) return;\n\n const index = this.slider?.addPointer(value) ?? 0;\n\n initPointerAPI(this,\n this.slider,\n index,\n `value${ index + 1 }`,\n `ariaLabel${ index + 1 }`,\n `pointerShape${ index + 1 }`,\n `pointer${ index + 1 }Disabled`\n );\n }\n\n public removePointer() {\n if(!this.slider) return;\n this.slider?.removePointer();\n }\n\n public addCSS(css: string) {\n if(!this.shadowRoot) return;\n\n const sheet = document.createElement('style')\n sheet.textContent = css;\n this.shadowRoot.appendChild(sheet);\n }\n\n // ----------------------------------------------\n\n constructor() {\n super();\n\n this.attachShadow({\n mode: 'open', // 'closed', 'open',\n });\n }\n\n /**\n * when the custom element connected to DOM\n */\n connectedCallback() {\n if (!this.shadowRoot) return;\n\n // get optional external CSS list\n this._externalCSSList = getExternalCSSList(this);\n this.shadowRoot.innerHTML = mainTemplate(styles, this._externalCSSList);\n\n // init first pointer\n const $pointer = this.shadowRoot?.querySelector('.pointer') as HTMLElement;\n if(!$pointer) return;\n\n // init the slider\n const $slider = this.shadowRoot?.getElementById('range-slider') as HTMLElement;\n if(!$slider) return;\n\n const pointers = initPointers(this, $pointer);\n this.slider = Slider(this, $slider, pointers);\n\n initPointerAPIs(this, this.slider);\n\n this._observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n if (!this.slider || mutation.type !== 'attributes') return;\n\n const attrName = mutation.attributeName;\n if(!attrName) return;\n\n onAttributeChange(this.slider, attrName, this.getAttribute(attrName) ?? '');\n });\n });\n\n this._observer.observe(this, {\n attributes: true, //configure it to listen to attribute changes\n });\n }\n\n /**\n * when the custom element disconnected from DOM\n */\n disconnectedCallback() {\n if(this._observer){\n this._observer.disconnect();\n }\n\n if(!this.slider) return\n\n this.slider.destroy();\n }\n}\n\nexport default TCRangeSlider;\n", "import TCRangeSlider from './app/range-slider';\nimport { DynamicFields } from './types';\n\ntype RangeSlider = TCRangeSlider & HTMLElement & DynamicFields;\n\ndeclare global {\n interface Window {\n tcRangeSlider: typeof TCRangeSlider;\n }\n}\n\nwindow.tcRangeSlider = TCRangeSlider;\n\n// register web components\nif (!customElements.get('toolcool-range-slider')) {\n customElements.define('toolcool-range-slider', TCRangeSlider);\n}\n\nif (!customElements.get('tc-range-slider')) {\n customElements.define('tc-range-slider', class extends TCRangeSlider{});\n}\n\nexport default RangeSlider;\n\n\n"], - "mappings": ";;;;;;+LAAA,IAAOA,GAAQ,CAACC,EAAQC,IAAuB,IAAKA,GAAaA,EAAU,OAAS,EAAIA,EAAU,IAAIC,GAAY,gCAAiCA,OAAe,EAAE,KAAK,EAAE,EAAI,cAAeF,80GCGv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Aa,CAAC,CAAC", - "names": ["main_html_default", "styles", "linkHrefs", "linkHref", "PointersOverlap", "PointersMinDistance", "PointersMaxDistance", "RangeDragging", "Data", "Min", "Max", "Step", "Round", "Type", "Theme", "RightToLeft", "BottomToTop", "Disabled", "KeyboardDisabled", "MousewheelDisabled", "SliderWidth", "SliderHeight", "SliderRadius", "SliderBg", "SliderBgHover", "SliderBgFill", "PointerWidth", "PointerHeight", "PointerRadius", "PointerBg", "PointerBgHover", "PointerBgFocus", "PointerShadow", "PointerShadowHover", "PointerShadowFocus", "PointerBorder", "PointerBorderHover", "PointerBorderFocus", "AnimateOnClick", "CSSLinks", "Vertical", "Horizontal", "convertRange", "min", "max", "a", "b", "x", "temp", "isNumber", "input", "getNumber", "defaultValue", "roundToStep", "num", "step", "setDecimalPlaces", "decimalPlaces", "coeff", "__pow", "getBoolean", "val", "sendPointerClickedEvent", "$component", "$pointer", "sendMouseDownEvent", "evt", "sendMouseUpEvent", "sendOnKeyDownEvent", "sendChangeEvent", "values", "transformed", "value", "isNumber", "getNumber", "detail", "i", "Pointer", "$component", "$pointer", "index", "percent", "arrowLeft", "arrowRight", "arrowUp", "arrowDown", "disabled", "updatePosition", "_percent", "_leftWall", "_rightWall", "_type", "_rightToLeft", "_bottomToTop", "oldValue", "percentPos", "Vertical", "Horizontal", "isClicked", "$target", "setCallbacks", "_arrowLeft", "_arrowRight", "_arrowUp", "_arrowDown", "setDisabled", "_disabled", "setAttr", "key", "value", "getAttr", "pointerKeyDown", "evt", "sendOnKeyDownEvent", "pointerClicked", "sendPointerClickedEvent", "parseData", "dataString", "parts", "list", "allValuesAreNumbers", "i", "part", "isNumber", "item", "findValueIndexInData", "val", "data", "PanelFill", "$fill", "type", "percents", "rightToLeft", "bottomToTop", "oneOnly", "first", "last", "Vertical", "AnimateOnClick", "SliderWidth", "SliderHeight", "SliderRadius", "SliderBg", "SliderBgHover", "SliderBgFill", "PointerWidth", "PointerHeight", "PointerRadius", "PointerBg", "PointerBgHover", "PointerBgFocus", "PointerShadow", "PointerShadowHover", "PointerShadowFocus", "PointerBorder", "PointerBorderHover", "PointerBorderFocus", "getAttributesByRegex", "$component", "regex", "parseValue", "map", "attr", "valueProp", "key", "keyNum", "getNumber", "value", "getExternalCSSList", "str", "CSSLinks", "parts", "cssList", "part", "stylePropertiesList", "SliderWidth", "SliderHeight", "SliderRadius", "SliderBg", "SliderBgHover", "SliderBgFill", "PointerWidth", "PointerHeight", "PointerRadius", "PointerBg", "PointerBgHover", "PointerBgFocus", "PointerShadow", "PointerShadowHover", "PointerShadowFocus", "PointerBorder", "PointerBorderHover", "PointerBorderFocus", "Styles", "$component", "$slider", "pointers", "theme", "pointerShapes", "stylesMap", "removeClassesStartWith", "prefix", "$element", "classList", "className", "removeClasses", "$pointers", "$pointer", "setTheme", "val", "updatePointerShapes", "i", "item", "setPointerShape", "index", "value", "setPointerShapes", "list", "getAttributesByRegex", "getKey", "key", "setStyle", "pointer", "$styleHolder", "getStyle", "cssVariableName", "attrName", "apiProperty", "regex", "cssVariableValue", "apiProperties", "propName", "ex", "Theme", "AnimateOnClick", "RangeDragging", "PluginsManager", "$component", "requestUpdatePlugins", "setters", "getters", "plugins", "update", "data", "plugin", "destroy", "onAttrChange", "_attrName", "_newValue", "defineSettersGetters", "item", "ex", "initStyles", "_a", "$style", "pluginFunc", "MAX_VALUES_API", "POINTER_Z_INDEX_DEFAULT", "initPointers", "$component", "$pointer", "map", "regex", "attr", "valueProp", "key", "keyNum", "getNumber", "value", "isNumber", "max", "pointers", "Pointer", "$latestPointer", "i", "$newPointer", "initPointerAPI", "slider", "index", "ariaLabelProp", "pointerShapeProp", "pointerDisabledProp", "pointer", "val", "_a", "_b", "ex", "initPointerAPIs", "apiProperties", "item", "changePointersOrder", "isDesc", "$container", "setZIndex", "selectedPointer", "MIN_DEFAULT", "MAX_DEFAULT", "ROUND_DEFAULT", "ANIMATE_ON_CLICK_DEFAULT", "Slider", "$component", "$slider", "pointersList", "pointers", "item", "selectedPointer", "panelFill", "styles", "pluginsManager", "min", "max", "step", "data", "type", "Horizontal", "round", "rightToLeft", "bottomToTop", "pointersOverlap", "pointersMinDistance", "pointersMaxDistance", "rangeDragging", "rangeDraggingStart", "rangeDraggingDiff", "disabled", "keyboardDisabled", "mousewheelDisabled", "animateOnClick", "ariaLabels", "onMouseDown", "evt", "onValueChange", "onMouseUp", "sendMouseDownEvent", "AnimateOnClick", "sendMouseUpEvent", "getActivePointer", "$target", "percent", "panelFillClicked", "isPanelFillClicked", "_dragPercent", "stepPercent", "getStepPercent", "roundToStep", "isPanelClicked", "pointer", "minDistance", "minDistancePointer", "distance", "getSelectedPointerIndex", "Vertical", "boxHeight", "boxTop", "mouseY", "boxWidth", "boxLeft", "mouseX", "setZIndex", "firstPointer", "lastPointer", "firstSmallerThanMin", "lastGreaterThanMax", "i", "setPositions", "foundIndex", "pointerMouseWheel", "scrollTop", "rightOrBottom", "shouldGoPrev", "goPrev", "goNext", "arrowLeft", "pointerIndex", "arrowRight", "arrowUp", "arrowDown", "index", "_percent", "updatePlugins", "getPercents", "getValues", "getPointerElements", "getNumericMin", "getNumericMax", "getData", "getStep", "getRound", "getType", "getMin", "getMax", "isRightToLeft", "isBottomToTop", "isPointersOverlap", "getPointersMinDistance", "getPointersMaxDistance", "isRangeDraggingEnabled", "isDisabled", "isKeyboardDisabled", "isMousewheelDisabled", "requestUpdatePlugins", "getPointerLeftWall", "converted", "getPointerRightWall", "_step", "currentValue", "convertRange", "isNumber", "diff", "getTextValue", "val", "setDecimalPlaces", "getPointerMin", "_a", "getPointerMax", "getAriaLabel", "percentChanged", "valueText", "setAriaMinMax", "sendChangeEvent", "setAllPositions", "setMinMax", "_min", "_max", "getNumber", "setMin", "setMax", "_b", "setValues", "values", "setValue", "_val", "findValueIndexInData", "setStep", "setPointersOverlap", "_pointersOverlap", "setPointersMinDistance", "_pointersMinDistance", "setPointersMaxDistance", "_pointersMaxDistance", "setDisabled", "_disabled", "setKeyboardDisabled", "setMousewheelDisabled", "setData", "_data", "parseData", "setType", "_type", "$box", "aria", "setRightToLeft", "_rightToLeft", "changePointersOrder", "setBottomToTop", "_bottomToTop", "setRound", "_round", "setAnimateOnClick", "_animateOnClick", "setAriaLabel", "_ariaLabel", "setRangeDragging", "_rangeDragging", "RangeDragging", "initDisabled", "getBoolean", "Disabled", "KeyboardDisabled", "MousewheelDisabled", "disabledList", "getAttributesByRegex", "initAriaLabels", "ariaLabelsList", "addPointer", "value", "len", "$latestPointer", "$newPointer", "newPointer", "Pointer", "removePointer", "$fill", "PanelFill", "Type", "RightToLeft", "BottomToTop", "Min", "Max", "Step", "Data", "PointersOverlap", "PointersMinDistance", "PointersMaxDistance", "Round", "Styles", "PluginsManager", "_keyboardDisabled", "_mousewheelDisabled", "onAttributeChange", "slider", "attrName", "newValue", "found", "stylePropertiesList", "_cssVariableName", "_attrName", "_apiProperty", "_regex", "key", "index", "getNumber", "Min", "Max", "Step", "PointersOverlap", "getBoolean", "PointersMinDistance", "RangeDragging", "PointersMaxDistance", "Disabled", "KeyboardDisabled", "MousewheelDisabled", "Data", "Type", "RightToLeft", "BottomToTop", "Round", "ROUND_DEFAULT", "Theme", "AnimateOnClick", "property", "pointer", "TCRangeSlider", "__publicField", "_step", "_a", "_disabled", "_b", "_data", "_min", "_max", "_round", "ROUND_DEFAULT", "_type", "Horizontal", "_pointersOverlap", "_pointersMinDistance", "_pointersMaxDistance", "_theme", "_c", "_rtl", "_btt", "_keyboardDisabled", "_mousewheelDisabled", "_animateOnClick", "_rangeDragging", "getBoolean", "value", "index", "initPointerAPI", "css", "sheet", "getExternalCSSList", "main_html_default", "styles_default", "$pointer", "$slider", "pointers", "initPointers", "Slider", "initPointerAPIs", "mutations", "mutation", "attrName", "onAttributeChange", "range_slider_default", "range_slider_default"] + "sourcesContent": ["export default (styles, linkHrefs) => { return ` ${ linkHrefs && linkHrefs.length > 0 ? linkHrefs.map(linkHref => ``).join('') : '' }
`; }; ", "/**\n * Constants instead of typescript enums ---> smaller bundle size\n */\nexport const PointersOverlap = 'pointers-overlap';\nexport const PointersMinDistance = 'pointers-min-distance';\nexport const PointersMaxDistance = 'pointers-max-distance';\nexport const RangeDragging = 'range-dragging';\n\nexport const Data = 'data';\nexport const Min = 'min';\nexport const Max = 'max';\nexport const Step = 'step';\nexport const Round = 'round';\nexport const Type = 'type';\nexport const Theme = 'theme';\nexport const RightToLeft = 'rtl';\nexport const BottomToTop = 'btt';\n\nexport const Disabled = 'disabled';\nexport const KeyboardDisabled = 'keyboard-disabled';\nexport const MousewheelDisabled = 'mousewheel-disabled';\n\nexport const SliderWidth = 'slider-width';\nexport const SliderHeight = 'slider-height';\nexport const SliderRadius = 'slider-radius';\n\nexport const SliderBg = 'slider-bg';\nexport const SliderBgHover = 'slider-bg-hover';\nexport const SliderBgFill = 'slider-bg-fill';\n\nexport const PointerWidth = 'pointer-width';\nexport const PointerHeight = 'pointer-height';\nexport const PointerRadius = 'pointer-radius';\nexport const PointerBg = 'pointer-bg';\nexport const PointerBgHover = 'pointer-bg-hover';\nexport const PointerBgFocus = 'pointer-bg-focus';\nexport const PointerShadow = 'pointer-shadow';\nexport const PointerShadowHover = 'pointer-shadow-hover';\nexport const PointerShadowFocus = 'pointer-shadow-focus';\nexport const PointerBorder = 'pointer-border';\nexport const PointerBorderHover = 'pointer-border-hover';\nexport const PointerBorderFocus = 'pointer-border-focus';\n\nexport const AnimateOnClick = 'animate-onclick';\nexport const CSSLinks = 'css-links';\n", "/**\n * Constants instead of typescript enums ---> smaller bundle size\n */\nexport const Vertical = 'vertical';\nexport const Horizontal = 'horizontal';\n", "/**\n * scale a range [min,max] to [a,b]\n * f(x) = (b - a) * (x - min) / (max - min) + a\n */\nexport const convertRange = (min: number, max: number, a: number, b: number, x: number) => {\n const temp = (max - min);\n if(temp === 0) return a;\n return ((b - a) * (x - min)) / temp + a;\n};\n\n// eslint-disable-next-line\nexport const isNumber = (input: any) => {\n return !isNaN(parseFloat(input)) && isFinite(input);\n};\n\n// the below function should receive any\n// eslint-disable-next-line\nexport const getNumber = (input: any, defaultValue: any) : number => {\n return isNumber(input) ? Number(input) : defaultValue;\n};\n\n/**\n * Round up to the next multiple of X,\n * where X is the step provided by the user.\n */\nexport const roundToStep = (num: number, step: number) => {\n return step === 0 ? 0 : Math.round(num / step) * step;\n};\n\n/**\n * round to decimal places\n * https://stackoverflow.com/questions/11832914/how-to-round-to-at-most-2-decimal-places-if-necessary\n */\nexport const setDecimalPlaces = (num: number, decimalPlaces = Infinity) => {\n if (decimalPlaces === Infinity) return num;\n\n const coeff = 10 ** decimalPlaces;\n return Math.round(num * coeff) / coeff;\n};\n\nexport const getBoolean = (val: string | null | undefined | boolean) => {\n if(val === null || val === undefined) return false;\n if(typeof val === 'boolean') return val;\n return val.trim().toLowerCase() === 'true';\n};\n", "import { getNumber, isNumber } from './math-provider';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface IIndexable { [key: string]: T }\n\nexport const sendPointerClickedEvent = ($component: HTMLElement, $pointer: HTMLElement) => {\n $component.dispatchEvent(\n new CustomEvent('onPointerClicked', {\n detail: {\n $pointer: $pointer,\n },\n })\n );\n};\n\nexport const sendMouseDownEvent = ($component: HTMLElement, evt: MouseEvent) => {\n $component.dispatchEvent(\n new CustomEvent('onMouseDown', {\n detail: {\n nativeEvent: evt,\n },\n })\n );\n};\n\nexport const sendMouseUpEvent = ($component: HTMLElement, evt: MouseEvent) => {\n $component.dispatchEvent(\n new CustomEvent('onMouseUp', {\n detail: {\n nativeEvent: evt,\n },\n })\n );\n};\n\nexport const sendOnKeyDownEvent = ($component: HTMLElement, evt: KeyboardEvent) => {\n $component.dispatchEvent(\n new CustomEvent('onKeyDown', {\n detail: {\n nativeEvent: evt,\n },\n })\n );\n};\n\nexport const sendChangeEvent = (\n $component: HTMLElement,\n values: (string | number | undefined)[],\n) => {\n\n if(!values || values.length <= 0) return;\n\n const transformed = values.map(value => isNumber(value) ? getNumber(value, value) : value);\n\n const detail: IIndexable = {\n values: transformed || [],\n };\n\n detail.value = transformed[0];\n detail.value0 = transformed[0];\n detail.value1 = transformed[0];\n\n for(let i=1; i boolean;\n\n disabled: boolean;\n\n isClicked: ($target: HTMLElement) => boolean;\n setCallbacks: (\n arrowLeft: (pointerIndex: number) => void,\n arrowRight: (pointerIndex: number) => void,\n arrowUp: (pointerIndex: number) => void,\n arrowDown: (pointerIndex: number) => void\n ) => void;\n\n setAttr: (key: string, value: string | null | undefined) => void;\n getAttr: (key: string) => string | null;\n\n destroy: () => void;\n}\n\nexport const Pointer = ($component: HTMLElement, $pointer: HTMLElement, index: number) : IPointer => {\n\n // the pointer value in % in the range [0, 100] -\n // used to render the pointer position\n let percent = 0;\n\n let arrowLeft: (pointerIndex: number) => void;\n let arrowRight: (pointerIndex: number) => void;\n let arrowUp: (pointerIndex: number) => void;\n let arrowDown: (pointerIndex: number) => void;\n\n let disabled = false;\n\n // -------------- APIs -------------------------\n\n /**\n * Update pointer position according to its percent (value).\n * Returns true if change position has changed.\n */\n const updatePosition = (\n _percent: number,\n _leftWall: number | undefined,\n _rightWall: number | undefined,\n _type: string,\n _rightToLeft: boolean,\n _bottomToTop: boolean): boolean => {\n\n const oldValue = percent;\n\n if(_rightWall !== undefined && _percent > _rightWall){\n _percent = _rightWall;\n }\n\n if(_leftWall !== undefined && _percent < _leftWall){\n _percent = _leftWall;\n }\n\n percent = _percent;\n // $pointer.focus();\n\n // the below code should not change the global pointer percent,\n // only its position on the panel\n let percentPos = percent;\n if((_type === TypeEnum.Vertical && _bottomToTop) ||\n (_type === TypeEnum.Horizontal && _rightToLeft)) {\n percentPos = 100 - percentPos;\n }\n\n if (_type === TypeEnum.Vertical) {\n $pointer.style.top = `${ percentPos }%`;\n }\n else {\n $pointer.style.left = `${ percentPos }%`;\n }\n\n return oldValue !== percent;\n };\n\n const isClicked = ($target: HTMLElement) => {\n return $target === $pointer || $pointer.contains($target);\n };\n\n const setCallbacks = (\n _arrowLeft: (pointerIndex: number) => void,\n _arrowRight: (pointerIndex: number) => void,\n _arrowUp: (pointerIndex: number) => void,\n _arrowDown: (pointerIndex: number) => void\n ) => {\n arrowLeft = _arrowLeft;\n arrowRight = _arrowRight;\n arrowUp = _arrowUp;\n arrowDown = _arrowDown;\n };\n\n const setDisabled = (_disabled: boolean) => {\n disabled = _disabled;\n $pointer.classList.toggle('disabled', disabled);\n\n if(disabled){\n $pointer.setAttribute('aria-disabled', 'true');\n }\n else{\n if ($pointer.hasAttribute('aria-disabled')) {\n $pointer.removeAttribute('aria-disabled');\n }\n }\n };\n\n const setAttr = (key: string, value: string | null | undefined) => {\n if(value === null || value === undefined){\n $pointer.removeAttribute(key);\n }\n else{\n $pointer.setAttribute(key, value);\n }\n };\n\n const getAttr = (key: string) => {\n return $pointer.getAttribute(key);\n };\n\n // -------------- Events ------------------------\n\n const pointerKeyDown = (evt: KeyboardEvent) => {\n if(disabled) return;\n\n switch (evt.key) {\n case 'ArrowLeft': {\n evt.preventDefault();\n if(typeof arrowLeft === 'function'){\n arrowLeft(index);\n }\n break;\n }\n\n case 'ArrowRight': {\n evt.preventDefault();\n if(typeof arrowRight === 'function'){\n arrowRight(index);\n }\n break;\n }\n\n case 'ArrowUp': {\n evt.preventDefault();\n if(typeof arrowUp === 'function'){\n arrowUp(index);\n }\n break;\n }\n\n case 'ArrowDown': {\n evt.preventDefault();\n if(typeof arrowDown === 'function'){\n arrowDown(index);\n }\n break;\n }\n }\n\n sendOnKeyDownEvent($component, evt);\n };\n\n const pointerClicked = () => {\n if(disabled) return;\n sendPointerClickedEvent($component, $pointer);\n };\n\n // ---------- Lifecycle ------------------------\n\n (() => {\n $pointer.className = `pointer pointer-${ index }`;\n\n $pointer.addEventListener('keydown', pointerKeyDown);\n $pointer.addEventListener('click', pointerClicked);\n })();\n\n const destroy = () => {\n $pointer.removeEventListener('keydown', pointerKeyDown);\n $pointer.removeEventListener('click', pointerClicked);\n $pointer.remove();\n };\n\n return {\n $pointer,\n\n get percent() {\n return percent;\n },\n\n get disabled() {\n return disabled;\n },\n\n set disabled(_disabled) {\n setDisabled(_disabled);\n },\n\n updatePosition,\n\n isClicked,\n setCallbacks,\n setAttr,\n getAttr,\n\n destroy,\n };\n};\n\n", "import { isNumber } from '../domain/math-provider';\n\nexport const parseData = (dataString: string | undefined | null): (string | number)[] | undefined => {\n if (dataString === undefined || dataString === null) return undefined;\n\n if(Array.isArray(dataString)) return dataString as (string | number)[];\n\n const result = dataString.trim();\n if (result === '') return undefined;\n\n const parts = dataString.split(',');\n const list: string[] = [];\n let allValuesAreNumbers = true;\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i].trim();\n if (part === '') continue;\n\n list.push(part);\n\n if (!isNumber(part)) {\n allValuesAreNumbers = false;\n }\n }\n\n if (!allValuesAreNumbers) return list;\n\n return list.map((item) => Number(item));\n};\n\nexport const findValueIndexInData = (val: string | number, data: (string | number)[] | undefined) => {\n return data ? data.findIndex((item) => item === val || item.toString().trim() === val.toString().trim()) : -1;\n};", "import * as TypeEnum from '../enums/type-enum';\n\nexport interface IPanelFill {\n updatePosition: (type: string, percents: (number | undefined)[], rightToLeft: boolean, bottomToTop: boolean) => void;\n}\n\nexport const PanelFill = ($fill: HTMLElement) : IPanelFill => {\n\n const updatePosition = (type: string, percents: (number | undefined)[], rightToLeft: boolean, bottomToTop: boolean) => {\n\n if(percents.length <= 0) return;\n\n const oneOnly = percents.length === 1;\n const first = percents[0] as number;\n const last = percents[percents.length - 1] as number;\n\n if (type === TypeEnum.Vertical) {\n $fill.style.removeProperty('width');\n $fill.style.removeProperty('right');\n $fill.style.removeProperty('left');\n\n if (!oneOnly) {\n $fill.style.height = `${Math.abs(first - last)}%`;\n }\n else{\n $fill.style.height = `${ first }%`;\n }\n\n if (bottomToTop) {\n $fill.style.bottom = '0%';\n\n if (!oneOnly) {\n $fill.style.top = `${Math.min(100 - last, 100 - first)}%`;\n }\n else{\n $fill.style.top = 'auto';\n }\n }\n else {\n $fill.style.bottom = 'auto';\n\n if (!oneOnly) {\n $fill.style.top = `${Math.min(first, last)}%`;\n }\n else{\n $fill.style.top = '0%';\n }\n }\n }\n else {\n $fill.style.removeProperty('height');\n $fill.style.removeProperty('top');\n $fill.style.removeProperty('bottom');\n\n if (!oneOnly) {\n $fill.style.width = `${ Math.abs(first - last) }%`;\n }\n else{\n $fill.style.width = `${ first }%`;\n }\n\n if (rightToLeft) {\n $fill.style.right = '0%';\n\n if (!oneOnly) {\n $fill.style.left = `${ Math.min(100 - last, 100 - first) }%`;\n }\n else{\n $fill.style.left = 'auto';\n }\n }\n else {\n $fill.style.right = 'auto';\n\n if (!oneOnly) {\n $fill.style.left = `${ Math.min(first, last) }%`;\n }\n else{\n $fill.style.left = '0%';\n }\n }\n }\n };\n\n return {\n updatePosition,\n };\n};", "/**\n * Constants instead of typescript enums ---> smaller bundle size\n */\nexport const AnimateOnClick = '--animate-onclick';\nexport const SliderWidth = '--width';\nexport const SliderHeight = '--height';\nexport const SliderRadius = '--panel-bg-border-radius';\n\nexport const SliderBg = '--panel-bg';\nexport const SliderBgHover = '--panel-bg-hover';\nexport const SliderBgFill = '--panel-bg-fill';\n\nexport const PointerWidth = '--pointer-width';\nexport const PointerHeight = '--pointer-height';\nexport const PointerRadius = '--pointer-border-radius';\nexport const PointerBg = '--pointer-bg';\nexport const PointerBgHover = '--pointer-bg-hover';\nexport const PointerBgFocus = '--pointer-bg-focus';\nexport const PointerShadow = '--pointer-shadow';\nexport const PointerShadowHover = '--pointer-shadow-hover';\nexport const PointerShadowFocus = '--pointer-shadow-focus';\nexport const PointerBorder = '--pointer-border';\nexport const PointerBorderHover = '--pointer-border-hover';\nexport const PointerBorderFocus = '--pointer-border-focus';\n", "import * as AttributesEnum from '../enums/attributes-enum';\nimport { getNumber } from './math-provider';\n\nexport const getAttributesByRegex = ($component: HTMLElement, regex: RegExp, parseValue?: (val: string) => T) : Map => {\n\n const map = new Map();\n\n for (const attr of $component.attributes) {\n const valueProp = attr.nodeName.trim().toLowerCase();\n const isValue = regex.test(valueProp);\n if(!isValue) continue;\n\n const key = valueProp.replace(/\\D/g, '').trim();\n const keyNum = (key === '' || key === '0' || key === '1') ? 0 : (getNumber(key, 0) - 1);\n const value = parseValue && typeof parseValue === 'function' ? parseValue(attr.value) : attr.value;\n map.set(keyNum, value as T);\n }\n\n return map;\n};\n\nexport const getExternalCSSList = ($component: HTMLElement) => {\n if(!$component) return null;\n\n const str = $component.getAttribute(AttributesEnum.CSSLinks);\n if(!str) return null;\n\n const parts = str.split(';');\n const cssList: string[] = [];\n\n for(const part of parts){\n if(part.trim() === '') continue;\n cssList.push(part.trim());\n }\n\n return cssList;\n};", "import * as AttributesEnum from '../enums/attributes-enum';\nimport * as CSSVariables from '../enums/css-vars-enum';\nimport { IPointer } from './pointer';\nimport { getAttributesByRegex } from '../domain/common-provider';\n\nexport interface IStyles {\n\n setStyle: (key: string, value: string | null | undefined, index: number) => void;\n getStyle: (key: string, index: number) => string | undefined;\n\n theme: string | null;\n readonly pointerShapes: (string | null)[];\n setPointerShape: (index: number, value: string | null) => void;\n}\n\nexport const stylePropertiesList: [string, string, string, RegExp | null][] = [\n [CSSVariables.SliderWidth, AttributesEnum.SliderWidth, 'sliderWidth', null],\n [CSSVariables.SliderHeight, AttributesEnum.SliderHeight, 'sliderHeight', null],\n [CSSVariables.SliderRadius, AttributesEnum.SliderRadius, 'sliderRadius', null],\n\n [CSSVariables.SliderBg, AttributesEnum.SliderBg, 'sliderBg', null],\n [CSSVariables.SliderBgHover, AttributesEnum.SliderBgHover, 'sliderBgHover', null],\n [CSSVariables.SliderBgFill, AttributesEnum.SliderBgFill, 'sliderBgFill', null],\n\n [CSSVariables.PointerWidth, AttributesEnum.PointerWidth, 'pointer#Width', /^pointer([0-9]*)-width$/], // pointer-width, pointer2-width, ...\n [CSSVariables.PointerHeight, AttributesEnum.PointerHeight, 'pointer#Height', /^pointer([0-9]*)-height$/], // pointer-height$, pointer2-height, ...\n [CSSVariables.PointerRadius, AttributesEnum.PointerRadius, 'pointer#Radius', /^pointer([0-9]*)-radius$/], // pointer-radius, pointer2-radius, ...\n [CSSVariables.PointerBg, AttributesEnum.PointerBg, 'pointer#Bg', /^pointer([0-9]*)-bg$/], // pointer-bg, pointer2-bg, ...\n [CSSVariables.PointerBgHover, AttributesEnum.PointerBgHover, 'pointer#BgHover', /^pointer([0-9]*)-bg-hover$/], // pointer-bg-hover, pointer2-bg-hover, ...\n [CSSVariables.PointerBgFocus, AttributesEnum.PointerBgFocus, 'pointer#BgFocus', /^pointer([0-9]*)-bg-focus$/], // pointer-bg-focus, pointer2-bg-focus, ...\n [CSSVariables.PointerShadow, AttributesEnum.PointerShadow, 'pointer#Shadow', /^pointer([0-9]*)-shadow$/], // pointer-shadow, pointer2-shadow, ...\n [CSSVariables.PointerShadowHover, AttributesEnum.PointerShadowHover, 'pointer#ShadowHover', /^pointer([0-9]*)-shadow-hover$/], // pointer-shadow-hover, pointer2-shadow-hover, ...\n [CSSVariables.PointerShadowFocus, AttributesEnum.PointerShadowFocus, 'pointer#ShadowFocus', /^pointer([0-9]*)-shadow-focus$/], // pointer-shadow-focus, pointer2-shadow-focus, .\n [CSSVariables.PointerBorder, AttributesEnum.PointerBorder, 'pointer#Border', /^pointer([0-9]*)-border$/], // pointer-border, pointer2-border, ...\n [CSSVariables.PointerBorderHover, AttributesEnum.PointerBorderHover, 'pointer#BorderHover', /^pointer([0-9]*)-border-hover$/], // pointer-border-hover, pointer2-border-hover, ...\n [CSSVariables.PointerBorderFocus, AttributesEnum.PointerBorderFocus, 'pointer#BorderFocus', /^pointer([0-9]*)-border-focus$/], // pointer-border-focus, pointer2-border-focus, ...\n];\n\nexport const Styles = ($component: HTMLElement, $slider: HTMLElement, pointers: IPointer[]) : IStyles => {\n\n let theme: string | null = null;\n const pointerShapes: (string | null)[] = [];\n const stylesMap: Map = new Map();\n\n // ----- SETTERS ---------------------------\n\n const removeClassesStartWith = (prefix: string, $element = $slider) => {\n const classList = [...$element.classList];\n for(const className of classList){\n if(className.startsWith(prefix)){\n $slider.classList.remove(className);\n }\n }\n };\n\n const removeClasses = () => {\n // remove shape classes from $slider\n removeClassesStartWith('shape');\n\n // remove shape classes from pointers (if there are any)\n const $pointers = $slider.querySelectorAll('.pointer');\n for(const $pointer of $pointers){\n removeClassesStartWith('shape', $pointer as HTMLElement);\n }\n };\n\n const setTheme = (val: string | null) => {\n theme = val;\n removeClassesStartWith('theme-');\n\n if(typeof val === 'string'){\n $slider.classList.add(`theme-${ val }`);\n }\n };\n\n const updatePointerShapes = () => {\n removeClasses();\n\n if(pointerShapes.length <= 0) return;\n\n // first shape is added to the slider, as it should be applied on all pointers (potentially)\n $slider.classList.add('shape', `shape-${ pointerShapes[0] }`);\n\n // other shapes should be added to the relevant pointers each;\n for(let i=1; i {\n pointerShapes[index] = value;\n updatePointerShapes();\n };\n\n const setPointerShapes = () => {\n\n removeClasses();\n\n // pointer-shape, pointer2-shape, ...\n const list = getAttributesByRegex($component, /^pointer([0-9]*)-shape$/);\n if(list.size <= 0) return;\n\n // save shapes to the list that can be used for the getter APIs later\n for(const item of list){\n const index = item[0] as number;\n pointerShapes[index] = item[1] as string;\n }\n\n updatePointerShapes();\n };\n\n const getKey = (key: string, index: number) => {\n return `${ key }-${ index }`;\n };\n\n const setStyle = (key: string, value: string | null | undefined, index: number) => {\n\n const pointer = pointers[index];\n if(!pointer) return;\n\n const $styleHolder = index === 0 ? $slider : pointer.$pointer;\n\n if(value === null || value === undefined){\n if(stylesMap.has(getKey(key, index))){\n stylesMap.delete(getKey(key, index));\n }\n $styleHolder.style.removeProperty(key);\n return;\n }\n\n stylesMap.set(getKey(key, index), value);\n $styleHolder.style.setProperty(key, value);\n };\n\n const getStyle = (key: string, index: number) => {\n return stylesMap.get(getKey(key, index));\n };\n\n // ---- initialization ---------------------\n (() => {\n\n for(const item of stylePropertiesList){\n\n // '--pointer-width', 'pointer-width', 'pointerWidth', regex or null\n const [cssVariableName, attrName, apiProperty, regex] = item;\n\n // apply the styles via CSS variables;\n // if index = 0 ---> apply the style on the whole slider, so all\n // pointers will inherit it;\n // otherwise, apply styles on the individual pointers;\n if(regex){\n const list = getAttributesByRegex($component, regex);\n for(const item of list){\n const index = item[0];\n const value = item[1] as string;\n setStyle(cssVariableName, value, index);\n }\n }\n else{\n const cssVariableValue = $component.getAttribute(attrName);\n setStyle(cssVariableName, cssVariableValue, 0);\n }\n\n // add APIs --------------------------\n const apiProperties: [string, number][] = [];\n\n if(apiProperty.indexOf('#') === -1){\n apiProperties.push([apiProperty, 0]);\n }\n else{\n apiProperties.push([apiProperty.replace('#', ''), 0]);\n apiProperties.push([apiProperty.replace('#', '0'), 0]);\n apiProperties.push([apiProperty.replace('#', '1'), 0]);\n for(let i=1; i {\n setStyle(cssVariableName, val, index);\n },\n });\n }\n }\n catch (ex){\n console.error(ex);\n }\n }\n }\n\n setTheme($component.getAttribute(AttributesEnum.Theme));\n setPointerShapes();\n })();\n\n return {\n setStyle,\n getStyle,\n\n get theme() {\n return theme;\n },\n\n set theme(val){\n setTheme(val);\n },\n\n get pointerShapes() {\n return pointerShapes;\n },\n\n setPointerShape,\n };\n};", "/**\n * Constants instead of typescript enums ---> smaller bundle size\n */\nexport const AnimateOnClick = 'animate-on-click';\nexport const RangeDragging = 'range-dragging';\n", "import { IPlugin, IPluginGetters, IPluginSetters, IPluginUpdateData } from './interfaces';\n\ndeclare global {\n interface Window {\n tcRangeSliderPlugins: (() => IPlugin)[];\n tcRangeSliderObservedAttr: string[];\n }\n}\n\nexport interface IPluginsManager {\n init: () => void;\n\n update: (data: IPluginUpdateData) => void;\n\n onAttrChange: (attrName: string, newValue: string) => void;\n\n destroy: () => void;\n}\n\nexport const PluginsManager = (\n $component: HTMLElement,\n requestUpdatePlugins: () => void,\n setters: IPluginSetters,\n getters: IPluginGetters,\n) : IPluginsManager => {\n\n const plugins: IPlugin[] = [];\n\n // ------ APIs ----------------------------\n\n const update = (data: IPluginUpdateData) => {\n for(const plugin of plugins){\n if(plugin.update && typeof plugin.update === 'function'){\n plugin.update(data);\n }\n }\n };\n\n const destroy = () => {\n for(const plugin of plugins){\n if(plugin.destroy && typeof plugin.destroy === 'function'){\n plugin.destroy();\n }\n }\n };\n\n const onAttrChange = (_attrName: string, _newValue: string) => {\n for(const plugin of plugins){\n if(plugin.onAttrChange && typeof plugin.onAttrChange === 'function'){\n plugin.onAttrChange(\n _attrName,\n _newValue\n );\n }\n }\n };\n\n const defineSettersGetters = (plugin: IPlugin) => {\n if(!plugin.gettersAndSetters) return;\n\n for(const item of plugin.gettersAndSetters){\n if(!item.name || !item.attributes) continue;\n\n try{\n if(!Object.prototype.hasOwnProperty.call($component, item.name)){\n Object.defineProperty($component, item.name, item.attributes);\n }\n }\n catch (ex){\n console.error('defineSettersGetters error:', ex);\n }\n }\n };\n\n const initStyles = (plugin: IPlugin) => {\n if(!plugin.css) return;\n\n const $style = $component.shadowRoot?.querySelector('style');\n if(!$style) return;\n\n $style.innerHTML += plugin.css;\n };\n\n // ------ initialization ------------------\n const init = () => {\n if(!window.tcRangeSliderPlugins) return;\n\n for(const pluginFunc of window.tcRangeSliderPlugins){\n const plugin = pluginFunc();\n plugins.push(plugin);\n\n if(plugin.init && typeof plugin.init === 'function'){\n\n // call plugin initialization function\n plugin.init(\n $component,\n requestUpdatePlugins,\n setters,\n getters,\n );\n\n // if plugin has getters and setters that used for APIs ---> define them\n defineSettersGetters(plugin);\n\n // if plugin has css rules defined as plain text ---> they can be added dynamically\n initStyles(plugin);\n }\n }\n };\n\n return {\n init,\n update,\n onAttrChange,\n destroy,\n };\n};", "import { getNumber, isNumber } from './math-provider';\nimport { IPointer, Pointer } from '../ui/pointer';\nimport { ISlider } from '../ui/slider';\n\nexport const MAX_VALUES_API = 10;\nexport const POINTER_Z_INDEX_DEFAULT = 20;\n\nexport const initPointers = ($component: HTMLElement, $pointer: HTMLElement) => {\n const map = new Map();\n const regex = /^value([0-9]*)$/;\n\n // collect data about key / value pairs: value=50, value2=70, etc.\n // value = value0 = value1 (all these are aliases of each other)\n for (const attr of $component.attributes) {\n const valueProp = attr.nodeName.trim().toLowerCase();\n const isValue = regex.test(valueProp);\n if(!isValue) continue;\n\n const key = valueProp.replace('value', '').trim();\n const keyNum = (key === '' || key === '0' || key === '1') ? 0 : (getNumber(key, 0) - 1);\n const value = isNumber(attr.value) ? getNumber(attr.value, 0) : attr.value;\n\n map.set(keyNum, value);\n }\n\n // find the max value number in the map\n const max = Math.max(...Array.from(map.keys()));\n const pointers: [IPointer, string | number | undefined][] = [];\n\n // first pointer always exists\n pointers.push([Pointer($component, $pointer, 0), map.get(0)]);\n\n // add all other pointers\n let $latestPointer = $pointer;\n\n for(let i=1; i<=max; i++){\n const $newPointer = $pointer.cloneNode(true) as HTMLElement;\n $latestPointer.after($newPointer);\n\n $latestPointer = $newPointer;\n pointers.push([Pointer($component, $newPointer, i), map.get(i)]);\n }\n\n return pointers;\n};\n\nexport const initPointerAPI = (\n $component: HTMLElement,\n slider: ISlider,\n index: number,\n valueProp: string,\n ariaLabelProp: string,\n pointerShapeProp: string,\n pointerDisabledProp: string\n) => {\n\n try{\n\n // `value${ index + 1 }`: value, value0, value1, value2, etc.\n Object.defineProperty($component, valueProp, {\n configurable: true,\n get () {\n if(!slider) return undefined;\n\n const pointer = slider.pointers[index];\n if(!pointer) return undefined;\n\n const val = slider.getTextValue(pointer.percent);\n return isNumber(val) ? getNumber(val, val) : val;\n },\n\n set: (val) => {\n const pointer = slider.pointers[index];\n if(!pointer){\n slider?.addPointer(val);\n }\n else{\n slider?.setValue(val, index);\n }\n },\n });\n\n // `ariaLabel${ index + 1 }`\n Object.defineProperty($component, ariaLabelProp, {\n configurable: true,\n get () {\n return slider?.pointers[index]?.getAttr('aria-label') ?? undefined;\n },\n\n set: (val) => {\n if(!slider) return;\n slider.setAriaLabel(index, val);\n },\n });\n\n // `pointerShape${ index + 1 }`\n Object.defineProperty($component, pointerShapeProp, {\n configurable: true,\n get () {\n return slider?.styles?.pointerShapes[index] ?? null;\n },\n\n set: (val) => {\n if(!slider || !slider.styles) return;\n slider.styles.setPointerShape(index, val);\n },\n });\n\n // `pointer${ index + 1 }Disabled`\n Object.defineProperty($component, pointerDisabledProp, {\n configurable: true,\n get () {\n return slider?.pointers[index].disabled ?? false;\n },\n\n set: (val) => {\n if(!slider) return;\n\n const pointer = slider?.pointers[index];\n if(!pointer) return;\n\n pointer.disabled = val;\n },\n });\n }\n catch (ex){\n console.error(ex);\n }\n};\n\nexport const initPointerAPIs = ($component: HTMLElement, slider: ISlider) => {\n\n const apiProperties: [string, string, string, string, number][] = [\n ['value', 'ariaLabel', 'pointerShape', 'pointerDisabled', 0],\n ['value0', 'ariaLabel0', 'pointerShape0', 'pointer0Disabled', 0],\n ['value1', 'ariaLabel1', 'pointerShape1', 'pointer1Disabled', 0],\n ];\n\n // The maximum number of such pointers is determined by the MAX_VALUES_API API constant (for performance reasons).\n // https://github.com/mzusin/toolcool-range-slider/issues/2\n for(let i=2; i {\n\n const $container = $component.shadowRoot?.querySelector('.container') as HTMLElement\n if(!$container) return;\n\n for(const pointer of pointers){\n if(isDesc){\n $container.prepend(pointer.$pointer);\n }\n else{\n $container.append(pointer.$pointer);\n }\n }\n};\n\n/**\n * Set greater z-index only to the active pointer.\n * https://github.com/mzusin/toolcool-range-slider/issues/15\n */\nexport const setZIndex = (pointers: IPointer[], selectedPointer: IPointer | null | undefined) => {\n if(!selectedPointer || pointers.length <= 1) return;\n\n for(const pointer of pointers) {\n pointer.$pointer.style.zIndex = POINTER_Z_INDEX_DEFAULT.toString();\n }\n\n selectedPointer.$pointer.style.zIndex = (POINTER_Z_INDEX_DEFAULT * 2).toString();\n};\n", "import { IPointer, Pointer } from './pointer';\nimport { convertRange, getBoolean, getNumber, isNumber, roundToStep, setDecimalPlaces } from '../domain/math-provider';\nimport * as AttributesEnum from '../enums/attributes-enum';\nimport { TData, TStep } from '../types';\nimport { findValueIndexInData, parseData } from '../dal/data-provider';\nimport * as TypeEnum from '../enums/type-enum';\nimport { IPanelFill, PanelFill } from './panel-fill';\nimport { sendChangeEvent, sendMouseDownEvent, sendMouseUpEvent } from '../domain/events-provider';\nimport { IStyles, Styles } from './styles';\nimport * as CSSVariables from '../enums/css-vars-enum';\nimport * as CssClasses from '../enums/css-classes-enum';\nimport { getAttributesByRegex } from '../domain/common-provider';\nimport { IPluginsManager, PluginsManager } from '../plugins/plugins-manager';\nimport { changePointersOrder, setZIndex } from '../domain/pointers-provider';\n\nexport interface ISlider {\n readonly pointers: IPointer[];\n readonly styles: IStyles | null;\n readonly pluginsManager: IPluginsManager | null;\n\n pointersOverlap: boolean;\n pointersMinDistance: number;\n pointersMaxDistance: number;\n rangeDragging: boolean;\n\n readonly min: number | string;\n readonly max: number | string;\n readonly step: TStep;\n readonly data: TData;\n\n type: string;\n rightToLeft: boolean;\n bottomToTop: boolean;\n disabled: boolean;\n keyboardDisabled: boolean;\n mousewheelDisabled: boolean;\n round: number;\n animateOnClick: string | undefined | boolean;\n\n getAriaLabel: (index: number) => (string | undefined);\n setAriaLabel: (index: number, ariaLabel: string | undefined) => void;\n\n setMin: (value: number | string | undefined | null) => void;\n setMax: (value: number | string | undefined | null) => void;\n setValue: (value: number | string | undefined | null, index: number) => void;\n setStep: (value: TStep | string) => void;\n setData: (value: TData | string | null | number) => void;\n getTextValue: (_percent: number | undefined) => undefined | string | number;\n\n addPointer: (value: number | string | undefined | null) => number;\n removePointer: () => number;\n\n destroy: () => void;\n}\n\nexport const MIN_DEFAULT = 0;\nexport const MAX_DEFAULT = 100;\nexport const ROUND_DEFAULT = 2;\nexport const ANIMATE_ON_CLICK_DEFAULT = '0.3s';\n\nexport const Slider = ($component: HTMLElement, $slider: HTMLElement, pointersList: [IPointer, string | number | undefined][]) : ISlider => {\n\n const pointers = pointersList.map(item => item[0]);\n let selectedPointer: IPointer | null | undefined = null;\n let panelFill: IPanelFill | null = null;\n let styles: IStyles | null = null;\n let pluginsManager: IPluginsManager | null = null;\n\n let min = MIN_DEFAULT;\n let max = MAX_DEFAULT;\n let step: TStep = undefined; // step is defined in absolute units (not percent!)\n let data: TData = undefined;\n let type: string = TypeEnum.Horizontal;\n let round: number = ROUND_DEFAULT;\n let rightToLeft = false;\n let bottomToTop = false;\n\n let pointersOverlap = false;\n let pointersMinDistance = 0;\n let pointersMaxDistance = Infinity;\n\n let rangeDragging = false;\n\n let rangeDraggingStart: number | undefined = undefined;\n let rangeDraggingDiff: number | undefined = undefined;\n\n let disabled = false;\n let keyboardDisabled = false;\n let mousewheelDisabled = false;\n let animateOnClick: string | undefined = ANIMATE_ON_CLICK_DEFAULT;\n\n let eventName: 'mousedown' | 'mouseup' | 'mousemove' | 'wheel' | 'touchemove' | 'touchstart' | string |undefined = undefined\n let touchClientX: number;\n let touchClientY: number;\n\n const ariaLabels: (string | undefined)[] = [];\n\n // -------------- EVENTS --------------------\n\n const onMouseDown = (evt: MouseEvent) => {\n if(disabled) return;\n\n if (evt.preventDefault) {\n evt.preventDefault();\n }\n\n onValueChange(evt);\n\n window.addEventListener('mousemove', onValueChange);\n window.addEventListener('mouseup', onMouseUp);\n\n sendMouseDownEvent($component, evt);\n };\n\n const onMouseUp = (evt: MouseEvent) => {\n if(disabled) return;\n\n rangeDraggingStart = undefined;\n rangeDraggingDiff = undefined;\n\n onValueChange(evt);\n\n window.removeEventListener('mousemove', onValueChange);\n window.removeEventListener('mouseup', onMouseUp);\n\n if(animateOnClick){\n $slider.classList.add(CssClasses.AnimateOnClick);\n }\n\n sendMouseUpEvent($component, evt);\n };\n\n const getActivePointer = ($target: HTMLElement, percent: number) => {\n if(pointers.length <= 0) return;\n\n // if only 1 pointer exists --> return it\n if(pointers.length === 1){\n if(pointers[0].isClicked($target) && animateOnClick){\n $slider.classList.remove(CssClasses.AnimateOnClick);\n }\n\n return pointers[0];\n }\n\n const panelFillClicked = isPanelFillClicked($target);\n\n if(rangeDragging){\n\n let _dragPercent = percent;\n const stepPercent = getStepPercent(_dragPercent);\n if(stepPercent !== undefined){\n _dragPercent = roundToStep(_dragPercent, stepPercent);\n }\n\n if(panelFillClicked){\n rangeDraggingStart = _dragPercent;\n rangeDraggingDiff = 0;\n\n if(animateOnClick){\n $slider.classList.remove(CssClasses.AnimateOnClick);\n }\n }\n else{\n if(rangeDraggingStart !== undefined){\n rangeDraggingDiff = _dragPercent - rangeDraggingStart;\n rangeDraggingStart = _dragPercent;\n }\n }\n }\n\n if(!isPanelClicked($target) && !panelFillClicked){\n // if clicked directly on 1 of the pointers ---> return it\n for(const pointer of pointers){\n if(!pointer.isClicked($target) || pointer.disabled) continue;\n\n if(animateOnClick){\n $slider.classList.remove(CssClasses.AnimateOnClick);\n }\n\n return pointer;\n }\n\n // if already selected pointer ---> return it\n for(const pointer of pointers){\n if(selectedPointer === pointer) return pointer;\n }\n }\n\n // find the closest pointer and return it\n let minDistance = Infinity;\n let minDistancePointer = null;\n\n for(const pointer of pointers){\n if(pointer.disabled) continue;\n\n const distance = Math.abs(percent - pointer.percent);\n if(distance < minDistance){\n minDistance = distance;\n minDistancePointer = pointer;\n }\n }\n\n return minDistancePointer;\n };\n\n const getSelectedPointerIndex = () => {\n return pointers.findIndex(pointer => selectedPointer === pointer && !pointer.disabled);\n };\n\n const onValueChange = (evt: MouseEvent | TouchEvent) => {\n setEventType(evt.type);\n\n if (evt instanceof TouchEvent && evt.touches[0]) {\n touchClientX = evt.touches[0].clientX;\n }\n\n if (evt instanceof TouchEvent && evt.touches[0]) {\n touchClientY = evt.touches[0].clientY;\n }\n\n // find the percent [0, 100] of the current mouse position in vertical or horizontal slider\n let percent;\n\n if(type === TypeEnum.Vertical){\n const { height: boxHeight, top: boxTop } = $slider.getBoundingClientRect();\n const mouseY = evt.type.indexOf('mouse') !== -1 ? (evt as MouseEvent).clientY : touchClientY;\n const top = Math.min(Math.max(0, mouseY - boxTop), boxHeight);\n percent = (top * 100) / boxHeight;\n }\n else{\n const { width: boxWidth, left: boxLeft } = $slider.getBoundingClientRect();\n const mouseX = evt.type.indexOf('mouse') !== -1 ? (evt as MouseEvent).clientX : touchClientX;\n const left = Math.min(Math.max(0, mouseX - boxLeft), boxWidth);\n percent = (left * 100) / boxWidth;\n }\n\n if(rightToLeft || bottomToTop){\n percent = 100 - percent;\n }\n\n selectedPointer = getActivePointer(evt.target as HTMLElement, percent);\n\n if(selectedPointer) {\n // https://github.com/mzusin/toolcool-range-slider/issues/15\n setZIndex(pointers, selectedPointer);\n }\n\n // handle range dragging\n if(rangeDragging && pointers.length > 1 && rangeDraggingDiff !== undefined){\n\n const firstPointer = pointers[0];\n const lastPointer = pointers[pointers.length - 1];\n\n const firstSmallerThanMin = firstPointer.percent + rangeDraggingDiff < 0;\n const lastGreaterThanMax = lastPointer.percent + rangeDraggingDiff > 100;\n if(firstSmallerThanMin || lastGreaterThanMax) return;\n\n for(let i=0; i {\n setEventType(evt.type);\n\n if (disabled ||\n document.activeElement !== $component ||\n selectedPointer?.disabled) return;\n\n evt.stopPropagation();\n evt.preventDefault();\n\n const scrollTop = evt.deltaY < 0;\n const rightOrBottom = rightToLeft || bottomToTop;\n const shouldGoPrev = scrollTop ? !rightOrBottom : rightOrBottom;\n\n const foundIndex = getSelectedPointerIndex();\n if(foundIndex === -1) return;\n\n if(shouldGoPrev){\n goPrev(foundIndex, pointers[foundIndex].percent);\n }\n else{\n goNext(foundIndex, pointers[foundIndex].percent);\n }\n };\n\n // -------------- Arrows --------------------\n\n const arrowLeft = (pointerIndex: number) => {\n if(disabled || keyboardDisabled) return;\n\n if(type === TypeEnum.Vertical){\n if(bottomToTop){\n // jump to the max value\n setPositions(pointerIndex, 100);\n }\n else{\n // jump to the min value\n setPositions(pointerIndex, 0);\n }\n }\n else{\n if(rightToLeft){\n // go forward\n goNext(pointerIndex, pointers[pointerIndex].percent);\n }\n else{\n // go backwards\n goPrev(pointerIndex, pointers[pointerIndex].percent);\n }\n }\n };\n\n const arrowRight = (pointerIndex: number) => {\n if(disabled || keyboardDisabled) return;\n\n if(type === TypeEnum.Vertical){\n if(bottomToTop){\n // jump to the min value\n setPositions(pointerIndex, 0);\n }\n else{\n // jump to the max value\n setPositions(pointerIndex, 100);\n }\n }\n else{\n if(rightToLeft){\n // go backward\n goPrev(pointerIndex, pointers[pointerIndex].percent);\n }\n else{\n // go forward\n goNext(pointerIndex, pointers[pointerIndex].percent);\n }\n }\n };\n\n const arrowUp = (pointerIndex: number) => {\n if(disabled || keyboardDisabled) return;\n\n if(type === TypeEnum.Vertical){\n if(bottomToTop){\n // go forwards\n goNext(pointerIndex, pointers[pointerIndex].percent);\n }\n else{\n // go backwards\n goPrev(pointerIndex, pointers[pointerIndex].percent);\n }\n }\n else{\n if(rightToLeft){\n // jump to the max value\n setPositions(pointerIndex, 100);\n }\n else{\n // jump to the min value\n setPositions(pointerIndex, 0);\n }\n }\n };\n\n const arrowDown = (pointerIndex: number) => {\n if(disabled || keyboardDisabled) return;\n\n if(type === TypeEnum.Vertical){\n if(bottomToTop){\n // go backward\n goPrev(pointerIndex, pointers[pointerIndex].percent);\n }\n else{\n // go forward\n goNext(pointerIndex, pointers[pointerIndex].percent);\n }\n }\n else{\n if(rightToLeft){\n // jump to the min value\n setPositions(pointerIndex, 0);\n }\n else{\n // jump to the max value\n setPositions(pointerIndex, 100);\n }\n }\n };\n\n // -------------- Helpers ------------------------\n\n const isPanelClicked = ($target: HTMLElement) => {\n return $target.classList.contains('panel');\n };\n\n const isPanelFillClicked = ($target: HTMLElement) => {\n return $target.classList.contains('panel-fill');\n };\n\n const goPrev = (index: number, _percent: number | undefined) => {\n if(_percent === undefined) return;\n\n let stepPercent = getStepPercent(_percent);\n\n if(stepPercent == undefined){\n stepPercent = 1;\n }\n\n _percent -= stepPercent;\n\n if(_percent < 0){\n _percent = 0;\n }\n\n setPositions(index, _percent);\n };\n\n const goNext = (index: number, _percent: number | undefined) => {\n\n if(_percent === undefined) return;\n\n let stepPercent = getStepPercent(_percent);\n\n if(stepPercent == undefined){\n stepPercent = 1;\n }\n\n _percent += stepPercent;\n\n if(_percent > 100){\n _percent = 100;\n }\n\n setPositions(index, _percent);\n };\n\n const updatePlugins = () => {\n\n if(!pluginsManager) return;\n pluginsManager.update({\n percents: getPercents(),\n values: getValues(),\n $pointers: getPointerElements(),\n\n min: getNumericMin(),\n max: getNumericMax(),\n\n data: getData(),\n step: getStep(),\n round: getRound(),\n type: getType(),\n\n textMin: getMin(),\n textMax: getMax(),\n\n rightToLeft: isRightToLeft(),\n bottomToTop: isBottomToTop(),\n\n pointersOverlap: isPointersOverlap(),\n pointersMinDistance: getPointersMinDistance(),\n pointersMaxDistance: getPointersMaxDistance(),\n rangeDragging: isRangeDraggingEnabled(),\n\n disabled: isDisabled(),\n keyboardDisabled: isKeyboardDisabled(),\n mousewheelDisabled: isMousewheelDisabled(),\n });\n };\n\n const requestUpdatePlugins = () => {\n updatePlugins();\n };\n\n // -------------- Getters --------------------\nconst getEventType = () => {\n return eventName;\n}\n\n const getPointerLeftWall = (pointerIndex: number) => {\n if(pointersOverlap || pointers.length <= 1 || max === min) return undefined;\n\n if(pointerIndex === 0){\n // by default 0, but if min distance between pointers is defined --->\n // then the distance to the next pointer\n const converted = pointersMaxDistance * 100 / (max - min);\n return Math.max(0, pointers[pointerIndex + 1].percent - converted);\n }\n else{\n // by default previous pointer, but if min distance between pointers is defined --->\n // then the distance to the next pointer\n const converted = pointersMinDistance * 100 / (max - min);\n return Math.min(pointers[pointerIndex - 1].percent + converted, 100);\n }\n };\n\n const getPointerRightWall = (pointerIndex: number) => {\n if(pointersOverlap || pointers.length <= 1 || max === min) return undefined;\n\n if(pointerIndex === pointers.length - 1){\n // by default 100, but if min distance between pointers is defined --->\n // then the distance to the previous pointer\n const converted = pointersMaxDistance * 100 / (max - min);\n return Math.min(pointers[pointerIndex - 1].percent + converted, 100);\n }\n else{\n // distance to the next pointer\n const converted = pointersMinDistance * 100 / (max - min);\n return Math.max(0, pointers[pointerIndex + 1].percent - converted);\n }\n };\n\n /**\n * user step is defined in absolute values;\n * this function return it as %\n */\n const getStepPercent = (_percent: number) => {\n\n let _step: number | undefined | null;\n\n if(typeof step === 'function'){\n // convert percent to value: [0, 100] to [min, max]\n const currentValue = convertRange(0, 100, min, max, _percent);\n\n // the slider function provided by user should return an absolute value, not %\n _step = step(currentValue, _percent);\n }\n else{\n // the step value provided by the user should be absolute value (not %), undefined, or null\n _step = step;\n }\n\n // round percent to step\n if(isNumber(_step)){\n\n /*\n min ......... max (step = 1)\n 0 ........... 100 (step = ?)\n\n (max - min) ....... step (=1)\n 100 ............... ?\n\n ? = 100 * step / (max - min)\n */\n\n const diff = max - min;\n _step = diff === 0 ? 0 : (_step as number) * 100 / diff;\n\n return _step;\n }\n\n return undefined;\n };\n\n const getTextValue = (_percent: number | undefined) => {\n if(_percent === undefined) return undefined;\n\n const val = convertRange(0, 100, min, max, _percent);\n\n if(data !== undefined){\n return data[Math.round(val)];\n }\n\n return setDecimalPlaces(val, round);\n };\n\n const getMin = () => {\n\n if(data !== undefined){\n return data[min];\n }\n\n return min;\n };\n\n const getMax = () => {\n\n if(data !== undefined){\n return data[max];\n }\n\n return max;\n };\n\n const getStep = () => {\n return step;\n };\n\n const getPointerMin = (index: number) => {\n if(index <= 0 || pointersOverlap) return getMin();\n return getTextValue(pointers[index - 1].percent) ?? '';\n };\n\n const getPointerMax = (index: number) => {\n if(pointers.length <= 1 ||\n index >= pointers.length - 1 ||\n pointersOverlap) return getMax();\n\n return getTextValue(pointers[index + 1].percent) ?? '';\n };\n\n const getPercents = () => {\n return pointers.map(pointer => pointer.percent);\n };\n\n const getValues = () => {\n return pointers.map(pointer => getTextValue(pointer.percent));\n }\n\n const getPointerElements = () => {\n return pointers.map(pointer => pointer.$pointer);\n };\n\n const getNumericMin = () => {\n return min;\n };\n\n const getNumericMax = () => {\n return max;\n };\n\n const getData = () => {\n return data;\n };\n\n const getType = () => {\n return type;\n };\n\n const getRound = () => {\n return round;\n };\n\n const getPointersMinDistance = () => {\n return pointersMinDistance;\n };\n\n const getPointersMaxDistance = () => {\n return pointersMaxDistance;\n };\n\n const getAriaLabel = (index: number) => {\n return ariaLabels[index];\n };\n\n const isRightToLeft = () => {\n return rightToLeft;\n };\n\n const isBottomToTop = () => {\n return bottomToTop;\n };\n\n const isDisabled = () => {\n return disabled;\n };\n\n const isKeyboardDisabled = () => {\n return keyboardDisabled;\n };\n\n const isMousewheelDisabled = () => {\n return mousewheelDisabled;\n };\n\n const isPointersOverlap = () => {\n return pointersOverlap;\n };\n\n const isRangeDraggingEnabled = () => {\n return rangeDragging;\n };\n\n // -------------- Setters --------------------\n\n const setEventType = (_eventName: string) => {\n eventName = _eventName;\n }\n const setPositions = (index: number, _percent: number | undefined) => {\n if(_percent === undefined) return;\n\n // round percent to step\n const stepPercent = getStepPercent(_percent);\n\n if(stepPercent !== undefined){\n _percent = roundToStep(_percent, stepPercent);\n }\n\n const pointer = pointers[index];\n if(!pointer) return;\n\n const percentChanged = pointer.updatePosition(_percent, getPointerLeftWall(index), getPointerRightWall(index), type, rightToLeft, bottomToTop);\n panelFill?.updatePosition(type, pointers.map(pointer => pointer.percent), rightToLeft, bottomToTop);\n\n updatePlugins();\n\n for(const pointer of pointers){\n const valueText = getTextValue(pointer.percent);\n if(valueText !== undefined){\n pointer.setAttr('aria-valuenow', valueText.toString());\n pointer.setAttr('aria-valuetext', valueText.toString());\n }\n }\n\n setAriaMinMax();\n\n if(percentChanged){\n sendChangeEvent($component, pointers.map(pointer => getTextValue(pointer.percent)));\n }\n };\n\n const setAllPositions = () => {\n for(let i=0; i {\n\n min = data !== undefined ? 0 : getNumber(_min, MIN_DEFAULT);\n max = data !== undefined ? data.length - 1 : getNumber(_max, MAX_DEFAULT);\n\n // perform validations\n setMin(min);\n setMax(max);\n };\n\n const setAriaMinMax = () => {\n for(let i=0; i {\n min = getNumber(_min, MIN_DEFAULT);\n\n if(min > max){\n max = min + MAX_DEFAULT;\n }\n\n setAllPositions();\n };\n\n const setMax = (_max: number | string | undefined | null) => {\n\n max = getNumber(_max, MAX_DEFAULT);\n\n if(max < min){\n max = min + MAX_DEFAULT;\n }\n\n setAllPositions();\n };\n\n const setValues = (values: (number | string | undefined)[]) => {\n\n // initial values should be initialized together\n // because their validations may depend on each other;\n\n // init initial values with pointers overlap ----------\n pointersOverlap = true;\n\n for(let i=0; i {\n\n let val: number;\n\n if(data !== undefined){\n\n val = (_val === undefined || _val === null) ? 0 : findValueIndexInData(_val, data);\n if(val === -1){\n val = 0;\n }\n }\n else{\n val = getNumber(_val, min);\n\n if(val < min){\n val = min;\n }\n\n if(val > max){\n val = max;\n }\n }\n\n // scale a range [min,max] to [a,b]\n const percent = convertRange(min, max, 0, 100, val);\n\n setPositions(index, percent);\n };\n\n const setStep = (_step: TStep | string) => {\n if(_step === null || _step === undefined){\n step = undefined;\n return;\n }\n\n if (typeof _step === 'function') {\n step = _step;\n setAllPositions();\n return;\n }\n\n if(isNumber(_step)){\n step = getNumber(_step, 1);\n\n const diff = Math.abs(max - min);\n if (step > diff) {\n step = undefined;\n }\n\n setAllPositions();\n return;\n }\n\n step = undefined;\n };\n\n const setPointersOverlap = (_pointersOverlap: boolean) => {\n pointersOverlap = _pointersOverlap;\n setAllPositions();\n };\n\n const setPointersMinDistance = (_pointersMinDistance: number) => {\n if(!isNumber(_pointersMinDistance) || _pointersMinDistance < 0){\n _pointersMinDistance = 0;\n }\n pointersMinDistance = _pointersMinDistance;\n };\n\n const setPointersMaxDistance = (_pointersMaxDistance: number) => {\n if(!isNumber(_pointersMaxDistance) || _pointersMaxDistance < 0){\n _pointersMaxDistance = Infinity;\n }\n pointersMaxDistance = _pointersMaxDistance;\n };\n\n const setDisabled = (_disabled: boolean) => {\n disabled = _disabled;\n $slider.classList.toggle('disabled', disabled);\n\n if(disabled){\n $slider.setAttribute('aria-disabled', 'true');\n }\n else{\n if ($slider.hasAttribute('aria-disabled')) {\n $slider.removeAttribute('aria-disabled');\n }\n }\n };\n\n const setKeyboardDisabled = (_disabled: boolean) => {\n keyboardDisabled = _disabled;\n };\n\n const setMousewheelDisabled = (_disabled: boolean) => {\n mousewheelDisabled = _disabled;\n\n if(mousewheelDisabled){\n document.removeEventListener('wheel', pointerMouseWheel);\n }\n else{\n document.addEventListener('wheel', pointerMouseWheel, { passive: false });\n }\n };\n\n const setData = (_data: TData | string | number | null) => {\n\n if(_data === null || _data === undefined){\n data = undefined;\n return;\n }\n\n data = parseData(_data as string);\n if(data === undefined || data.length <= 0){\n data = undefined;\n return;\n }\n\n setMin(0);\n setMax(data.length - 1);\n\n if(step === undefined){\n setStep(1);\n }\n };\n\n const setType = (_type: string | null | undefined) => {\n\n if(typeof _type === 'string'){\n type = _type.trim().toLowerCase() === TypeEnum.Vertical ? TypeEnum.Vertical : TypeEnum.Horizontal;\n }\n else{\n type = TypeEnum.Horizontal;\n }\n\n const $box = $component.shadowRoot?.querySelector('.range-slider-box');\n if(!$box) return;\n $box.className = `range-slider-box type-${ type }`;\n\n setAllPositions();\n\n // update accessibility properties\n const aria = type === TypeEnum.Vertical ? 'vertical' : 'horizontal';\n for(const pointer of pointers){\n pointer.setAttr('aria-orientation', aria);\n }\n };\n\n const setRightToLeft = (_rightToLeft: boolean) => {\n rightToLeft = _rightToLeft;\n\n if(pointers.length > 1){\n changePointersOrder(pointers, rightToLeft, $component);\n }\n\n setAllPositions();\n updatePlugins();\n };\n\n const setBottomToTop = (_bottomToTop: boolean) => {\n bottomToTop = _bottomToTop;\n\n if(pointers.length > 1){\n changePointersOrder(pointers, bottomToTop, $component);\n }\n\n setAllPositions();\n updatePlugins();\n };\n\n const setRound = (_round: number) => {\n round = getNumber(_round, ROUND_DEFAULT);\n\n if(round < 0){\n round = ROUND_DEFAULT;\n }\n\n updatePlugins();\n };\n\n const setAnimateOnClick = (_animateOnClick: string | boolean | null | undefined) => {\n if(_animateOnClick === null ||\n _animateOnClick === undefined ||\n _animateOnClick.toString().trim().toLowerCase() === 'false'){\n animateOnClick = undefined;\n $slider.style.removeProperty(CSSVariables.AnimateOnClick);\n $slider.classList.remove(CssClasses.AnimateOnClick);\n }\n else{\n animateOnClick = _animateOnClick.toString();\n $slider.style.setProperty(CSSVariables.AnimateOnClick, animateOnClick);\n $slider.classList.add(CssClasses.AnimateOnClick);\n }\n };\n\n const setAriaLabel = (index: number, _ariaLabel: string | undefined) => {\n\n const pointer = pointers[index];\n if(!pointer) return;\n\n pointer.setAttr('aria-label', _ariaLabel);\n ariaLabels[index] = _ariaLabel;\n };\n\n const setRangeDragging = (_rangeDragging: boolean) => {\n rangeDraggingStart = undefined;\n\n if(pointers.length <= 1){\n rangeDragging = false;\n $slider.classList.remove(CssClasses.RangeDragging);\n return;\n }\n\n rangeDragging = _rangeDragging;\n $slider.classList.toggle(CssClasses.RangeDragging, rangeDragging);\n };\n\n // initialization -------------------------------------\n\n const initDisabled = () => {\n setDisabled(getBoolean($component.getAttribute(AttributesEnum.Disabled)));\n keyboardDisabled = getBoolean($component.getAttribute(AttributesEnum.KeyboardDisabled));\n mousewheelDisabled = getBoolean($component.getAttribute(AttributesEnum.MousewheelDisabled));\n\n // handle 'pointer1-disabled, pointer2-disabled, etc.\n const disabledList = getAttributesByRegex($component, /^pointer([0-9]*)-disabled$/, (val: string) => {\n return getBoolean(val);\n });\n\n for(const item of disabledList){\n const pointerIndex = item[0];\n if(!pointers[pointerIndex]) continue;\n pointers[pointerIndex].disabled = item[1];\n }\n };\n\n const initAriaLabels = () => {\n // handle 'aria-label1', 'aria-label2', etc.\n const ariaLabelsList = getAttributesByRegex($component, /^aria-label([0-9]*)$/);\n\n for(const item of ariaLabelsList){\n const index = item[0];\n setAriaLabel(index, item[1] as string);\n }\n };\n\n // add pointer - always to the end\n const addPointer = (value: string | number | undefined) => {\n const len = pointers.length;\n const $latestPointer = pointers[len - 1].$pointer;\n\n const $newPointer = $latestPointer.cloneNode(true) as HTMLElement;\n $latestPointer.after($newPointer);\n const newPointer = Pointer($component, $newPointer, len);\n\n newPointer.setCallbacks(arrowLeft, arrowRight, arrowUp, arrowDown);\n pointers.push(newPointer);\n\n setValue(value, len);\n setAllPositions();\n updatePlugins();\n\n return len;\n };\n\n // always from the end\n const removePointer = () => {\n const len = pointers.length;\n const pointer = pointers[len - 1];\n if(!pointer) return -1;\n\n pointer.destroy();\n pointers.pop();\n\n if(pointers.length <= 1){\n setRangeDragging(false);\n }\n\n setAllPositions();\n updatePlugins();\n\n return len - 1;\n };\n\n (() => {\n\n // init pointer callbacks for arrow keys\n for(const pointer of pointers){\n pointer.setCallbacks(arrowLeft, arrowRight, arrowUp, arrowDown);\n }\n\n // init panel fill\n const $fill = $component.shadowRoot?.querySelector('.panel-fill') as HTMLElement;\n if($fill){\n panelFill = PanelFill($fill);\n }\n\n // init main properties from HTML attributes\n setType($component.getAttribute(AttributesEnum.Type));\n setRightToLeft(getBoolean($component.getAttribute(AttributesEnum.RightToLeft)));\n setBottomToTop(getBoolean($component.getAttribute(AttributesEnum.BottomToTop)));\n\n setMinMax($component.getAttribute(AttributesEnum.Min), $component.getAttribute(AttributesEnum.Max));\n setStep($component.getAttribute(AttributesEnum.Step));\n setData($component.getAttribute(AttributesEnum.Data));\n\n // set value and render the pointers ----------------------\n setValues(pointersList.map(item => item[1]));\n\n // overlaps MUST be defined after the pointer values\n setPointersOverlap(getBoolean($component.getAttribute(AttributesEnum.PointersOverlap)));\n setPointersMinDistance(getNumber($component.getAttribute(AttributesEnum.PointersMinDistance), 0));\n setPointersMaxDistance(getNumber($component.getAttribute(AttributesEnum.PointersMaxDistance), Infinity));\n setRangeDragging(getBoolean($component.getAttribute(AttributesEnum.RangeDragging)));\n\n // additional properties -----------------------------\n setRound(getNumber($component.getAttribute(AttributesEnum.Round), ROUND_DEFAULT));\n initDisabled();\n initAriaLabels();\n\n // init styles ---------\n styles = Styles($component, $slider, pointers);\n setAnimateOnClick($component.getAttribute(AttributesEnum.AnimateOnClick) ?? ANIMATE_ON_CLICK_DEFAULT);\n\n // init slider events -------------------------------------\n $slider.addEventListener('mousedown', onMouseDown);\n $slider.addEventListener('mouseup', onMouseUp);\n $slider.addEventListener('touchmove', onValueChange);\n $slider.addEventListener('touchstart', onValueChange);\n $slider.addEventListener('touchend', onValueChange);\n\n if(!mousewheelDisabled){\n document.addEventListener('wheel', pointerMouseWheel, { passive: false });\n }\n\n // init plugins ---------------\n pluginsManager = PluginsManager(\n $component,\n requestUpdatePlugins,\n {\n setValues,\n setMin,\n setMax,\n setStep,\n setPointersOverlap,\n setPointersMinDistance,\n setPointersMaxDistance,\n setDisabled,\n setType,\n setRightToLeft,\n setBottomToTop,\n setRound,\n setKeyboardDisabled,\n setMousewheelDisabled,\n setRangeDragging,\n setData,\n },\n {\n getPercents,\n getValues,\n getPointerElements,\n getActivePointerIndex: getSelectedPointerIndex,\n\n getMin: getNumericMin,\n getMax: getNumericMax,\n\n getStep,\n getData,\n getType,\n getRound,\n\n getTextMin: getMin,\n getTextMax: getMax,\n\n isRightToLeft,\n isBottomToTop,\n\n isDisabled,\n isKeyboardDisabled,\n isMousewheelDisabled,\n\n isPointersOverlap,\n isRangeDraggingEnabled,\n getPointersMinDistance,\n getPointersMaxDistance,\n\n getEventName: getEventType\n }\n );\n pluginsManager.init();\n })();\n\n const destroy = () => {\n $slider.removeEventListener('mousedown', onMouseDown);\n $slider.removeEventListener('mouseup', onMouseUp);\n $slider.removeEventListener('touchmove', onValueChange);\n $slider.removeEventListener('touchstart', onValueChange);\n document.removeEventListener('wheel', pointerMouseWheel);\n\n for(const pointer of pointers){\n pointer.destroy();\n }\n\n pluginsManager?.destroy();\n };\n\n return {\n get pointers() {\n return pointers;\n },\n\n get styles() {\n return styles;\n },\n\n get pluginsManager() {\n return pluginsManager;\n },\n\n get min() {\n return getMin();\n },\n\n get max() {\n return getMax();\n },\n\n get step() {\n return getStep();\n },\n\n get pointersOverlap() {\n return isPointersOverlap();\n },\n\n set pointersOverlap(_pointersOverlap) {\n setPointersOverlap(_pointersOverlap);\n },\n\n get pointersMinDistance() {\n return getPointersMinDistance();\n },\n\n set pointersMinDistance(_pointersMinDistance) {\n setPointersMinDistance(_pointersMinDistance);\n },\n\n get pointersMaxDistance() {\n return getPointersMaxDistance();\n },\n\n set pointersMaxDistance(_pointersMaxDistance) {\n setPointersMaxDistance(_pointersMaxDistance);\n },\n\n get disabled() {\n return isDisabled();\n },\n\n set disabled(_disabled) {\n setDisabled(_disabled);\n },\n\n get data() {\n return getData();\n },\n\n get type() {\n return getType();\n },\n\n set type(_type) {\n setType(_type);\n },\n\n get rightToLeft() {\n return isRightToLeft();\n },\n\n set rightToLeft(_rightToLeft) {\n setRightToLeft(_rightToLeft);\n },\n\n get bottomToTop() {\n return isBottomToTop();\n },\n\n set bottomToTop(_bottomToTop) {\n setBottomToTop(_bottomToTop);\n },\n\n get round() {\n return getRound();\n },\n\n set round(_round) {\n setRound(_round);\n },\n\n get animateOnClick() {\n return animateOnClick;\n },\n\n set animateOnClick(_animateOnClick) {\n setAnimateOnClick(_animateOnClick);\n },\n\n get keyboardDisabled() {\n return isKeyboardDisabled();\n },\n\n set keyboardDisabled(_keyboardDisabled){\n setKeyboardDisabled(_keyboardDisabled);\n },\n\n get mousewheelDisabled() {\n return isMousewheelDisabled();\n },\n\n set mousewheelDisabled(_mousewheelDisabled){\n setMousewheelDisabled(_mousewheelDisabled);\n },\n\n get rangeDragging() {\n return isRangeDraggingEnabled();\n },\n\n set rangeDragging(_rangeDragging) {\n setRangeDragging(_rangeDragging);\n },\n\n setMin,\n setMax,\n setValue,\n setStep,\n setData,\n getTextValue,\n setAriaLabel,\n getAriaLabel,\n\n addPointer,\n removePointer,\n\n destroy,\n };\n};\n\n", "import * as AttributesEnum from '../enums/attributes-enum';\nimport { ISlider, ROUND_DEFAULT } from '../ui/slider';\nimport { getBoolean, getNumber } from './math-provider';\nimport { stylePropertiesList } from '../ui/styles';\n\nexport const onAttributeChange = (slider: ISlider, attrName: string, newValue: string) => {\n\n // handle style properties ------------------------------------\n // try to get style property - ['--pointer-width', 'pointer-width', 1, 'pointerWidth']\n const found = stylePropertiesList.find(([_cssVariableName, _attrName, _apiProperty, _regex]) => {\n return _attrName.replace('#', '') === attrName.replace(/\\d+/g, '');\n });\n\n if(found && slider.styles){\n const [_cssVariableName, _attrName, _apiProperty, _regex] = found;\n\n const key = attrName.replace(/\\D/g, '').trim();\n const index = (key === '' || key === '0' || key === '1') ? 0 : (getNumber(key, 0) - 1);\n\n slider.styles.setStyle(_cssVariableName, newValue, index);\n return;\n }\n\n if(slider && slider.pluginsManager){\n slider.pluginsManager.onAttrChange(attrName, newValue);\n }\n\n // handle static properties ----------------------------------\n switch (attrName) {\n\n case AttributesEnum.Min: {\n slider.setMin(newValue);\n break;\n }\n\n case AttributesEnum.Max: {\n slider.setMax(newValue);\n break;\n }\n\n case AttributesEnum.Step: {\n slider.setStep(newValue);\n break;\n }\n\n case AttributesEnum.PointersOverlap: {\n slider.pointersOverlap = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.PointersMinDistance: {\n slider.pointersMinDistance = getNumber(newValue, 0);\n break;\n }\n\n case AttributesEnum.RangeDragging: {\n slider.rangeDragging = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.PointersMaxDistance: {\n slider.pointersMaxDistance = getNumber(newValue, Infinity);\n break;\n }\n\n case AttributesEnum.Disabled: {\n slider.disabled = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.KeyboardDisabled: {\n slider.keyboardDisabled = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.MousewheelDisabled: {\n slider.mousewheelDisabled = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.Data: {\n slider.setData(newValue);\n break;\n }\n\n case AttributesEnum.Type: {\n slider.type = newValue;\n break;\n }\n\n case AttributesEnum.RightToLeft: {\n slider.rightToLeft = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.BottomToTop: {\n slider.bottomToTop = getBoolean(newValue);\n break;\n }\n\n case AttributesEnum.Round: {\n slider.round = getNumber(newValue, ROUND_DEFAULT);\n break;\n }\n\n case AttributesEnum.Theme: {\n if(slider.styles){\n slider.styles.theme = newValue;\n }\n break;\n }\n\n case AttributesEnum.AnimateOnClick: {\n slider.animateOnClick = newValue;\n break;\n }\n }\n\n // handle dynamic properties ------------------------------------\n let property: string | null = null;\n\n if(/^value([0-9]*)$/.test(attrName)){\n property = 'value';\n }\n\n if(/^pointer([0-9]*)-disabled$/.test(attrName)){\n property = 'pointer-disabled';\n }\n\n if(/^aria-label([0-9]*)$/.test(attrName)){\n property = 'aria-label';\n }\n\n if(/^pointer([0-9]*)-shape$/.test(attrName)){\n property = 'pointer-shape';\n }\n\n if(!property) return;\n\n const key = attrName.replace(/\\D/g, '').trim();\n const index = (key === '' || key === '0' || key === '1') ? 0 : (getNumber(key, 0) - 1)\n\n switch (property) {\n\n case 'value': {\n slider.setValue(newValue, index);\n break;\n }\n\n case 'pointer-disabled': {\n const pointer = slider?.pointers[index];\n if(!pointer) return;\n\n pointer.disabled = getBoolean(newValue);\n break;\n }\n\n case 'aria-label': {\n slider.setAriaLabel(index, newValue);\n break;\n }\n\n case 'pointer-shape': {\n if(slider.styles){\n slider.styles.setPointerShape(index, newValue);\n }\n break;\n }\n }\n};", "import mainTemplate from '../templates/main.html.js'; // esbuild custom loader\nimport styles from './styles.pcss';\nimport { onAttributeChange } from '../domain/attributes-provider';\nimport { ISlider, ROUND_DEFAULT, Slider } from '../ui/slider';\nimport { TData, TStep } from '../types';\nimport { getBoolean } from '../domain/math-provider';\nimport * as TypeEnum from '../enums/type-enum';\nimport { getExternalCSSList } from '../domain/common-provider';\nimport { initPointerAPI, initPointerAPIs, initPointers } from '../domain/pointers-provider';\n\n/**\n * Usage: \n * Documentation: https://github.com/mzusin/toolcool-range-slider\n */\nclass TCRangeSlider extends HTMLElement {\n\n public slider: ISlider | undefined;\n\n private _externalCSSList: string[] | null = [];\n\n private _observer: MutationObserver | null = null;\n\n // -------------- APIs --------------------\n\n public set step(_step: TStep) {\n if(this.slider){\n this.slider.setStep(_step);\n }\n }\n\n public get step() {\n return this.slider?.step;\n }\n\n public set disabled(_disabled: boolean) {\n if(this.slider){\n this.slider.disabled = _disabled;\n }\n }\n\n public get disabled() {\n return this.slider?.disabled ?? false;\n }\n\n public set data(_data: TData) {\n this.slider?.setData(_data);\n }\n\n public get data() {\n return this.slider?.data;\n }\n\n public set min(_min: number | string | undefined | null) {\n this.slider?.setMin(_min);\n }\n\n public get min() {\n return this.slider?.min;\n }\n\n public set max(_max: number | string | undefined | null) {\n this.slider?.setMax(_max);\n }\n\n public get max() {\n return this.slider?.max;\n }\n\n public set round(_round: number) {\n if(!this.slider) return;\n this.slider.round = _round;\n }\n\n public get round() {\n return this.slider?.round ?? ROUND_DEFAULT;\n }\n\n public set type(_type: string | undefined) {\n if(!this.slider) return;\n this.slider.type = _type ?? TypeEnum.Horizontal;\n }\n\n public get type() {\n return this.slider?.type || TypeEnum.Horizontal;\n }\n\n public set pointersOverlap(_pointersOverlap: boolean) {\n if(!this.slider) return;\n this.slider.pointersOverlap = _pointersOverlap;\n }\n\n public get pointersOverlap() {\n return this.slider?.pointersOverlap ?? false;\n }\n\n public set pointersMinDistance(_pointersMinDistance: number) {\n if(!this.slider) return;\n this.slider.pointersMinDistance = _pointersMinDistance;\n }\n\n public get pointersMinDistance() {\n return this.slider?.pointersMinDistance ?? 0;\n }\n\n public set pointersMaxDistance(_pointersMaxDistance: number) {\n if(!this.slider) return;\n this.slider.pointersMaxDistance = _pointersMaxDistance;\n }\n\n public get pointersMaxDistance() {\n return this.slider?.pointersMaxDistance ?? Infinity;\n }\n\n public set theme(_theme: string | null) {\n if(!this.slider || !this.slider.styles) return;\n this.slider.styles.theme = _theme;\n }\n\n public get theme() {\n return this.slider?.styles?.theme ?? null;\n }\n\n public set rtl(_rtl: boolean) {\n if(!this.slider) return;\n this.slider.rightToLeft = _rtl;\n }\n\n public get rtl() {\n return this.slider?.rightToLeft ?? false;\n }\n\n public set btt(_btt: boolean) {\n if(!this.slider) return;\n this.slider.bottomToTop = _btt;\n }\n\n public get btt() {\n return this.slider?.bottomToTop ?? false;\n }\n\n public set keyboardDisabled(_keyboardDisabled: boolean) {\n if(!this.slider) return;\n this.slider.keyboardDisabled = _keyboardDisabled;\n }\n\n public get keyboardDisabled() {\n return this.slider?.keyboardDisabled ?? false;\n }\n\n public set mousewheelDisabled(_mousewheelDisabled: boolean) {\n if(!this.slider) return;\n this.slider.mousewheelDisabled = _mousewheelDisabled;\n }\n\n public get mousewheelDisabled() {\n return this.slider?.mousewheelDisabled ?? false;\n }\n\n public set animateOnClick(_animateOnClick: string | boolean | undefined) {\n if(!this.slider) return;\n this.slider.animateOnClick = _animateOnClick;\n }\n\n public get animateOnClick() {\n return this.slider?.animateOnClick;\n }\n\n public get rangeDragging(){\n return this.slider?.rangeDragging ?? false;\n }\n\n public set rangeDragging(_rangeDragging: boolean | string | undefined | null) {\n if(this.slider){\n this.slider.rangeDragging = getBoolean(_rangeDragging);\n }\n }\n\n public get externalCSSList() {\n return this._externalCSSList;\n }\n\n public addPointer(value: number | string | undefined) {\n if(!this.slider) return;\n\n const index = this.slider?.addPointer(value) ?? 0;\n\n initPointerAPI(this,\n this.slider,\n index,\n `value${ index + 1 }`,\n `ariaLabel${ index + 1 }`,\n `pointerShape${ index + 1 }`,\n `pointer${ index + 1 }Disabled`\n );\n }\n\n public removePointer() {\n if(!this.slider) return;\n this.slider?.removePointer();\n }\n\n public addCSS(css: string) {\n if(!this.shadowRoot) return;\n\n const sheet = document.createElement('style')\n sheet.textContent = css;\n this.shadowRoot.appendChild(sheet);\n }\n\n // ----------------------------------------------\n\n constructor() {\n super();\n\n this.attachShadow({\n mode: 'open', // 'closed', 'open',\n });\n }\n\n /**\n * when the custom element connected to DOM\n */\n connectedCallback() {\n if (!this.shadowRoot) return;\n\n // get optional external CSS list\n this._externalCSSList = getExternalCSSList(this);\n this.shadowRoot.innerHTML = mainTemplate(styles, this._externalCSSList);\n\n // init first pointer\n const $pointer = this.shadowRoot?.querySelector('.pointer') as HTMLElement;\n if(!$pointer) return;\n\n // init the slider\n const $slider = this.shadowRoot?.getElementById('range-slider') as HTMLElement;\n if(!$slider) return;\n\n const pointers = initPointers(this, $pointer);\n this.slider = Slider(this, $slider, pointers);\n\n initPointerAPIs(this, this.slider);\n\n this._observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n if (!this.slider || mutation.type !== 'attributes') return;\n\n const attrName = mutation.attributeName;\n if(!attrName) return;\n\n onAttributeChange(this.slider, attrName, this.getAttribute(attrName) ?? '');\n });\n });\n\n this._observer.observe(this, {\n attributes: true, //configure it to listen to attribute changes\n });\n }\n\n /**\n * when the custom element disconnected from DOM\n */\n disconnectedCallback() {\n if(this._observer){\n this._observer.disconnect();\n }\n\n if(!this.slider) return\n\n this.slider.destroy();\n }\n}\n\nexport default TCRangeSlider;\n", "import TCRangeSlider from './app/range-slider';\nimport { DynamicFields } from './types';\n\ntype RangeSlider = TCRangeSlider & HTMLElement & DynamicFields;\n\ndeclare global {\n interface Window {\n tcRangeSlider: typeof TCRangeSlider;\n }\n}\n\nwindow.tcRangeSlider = TCRangeSlider;\n\n// register web components\nif (!customElements.get('toolcool-range-slider')) {\n customElements.define('toolcool-range-slider', TCRangeSlider);\n}\n\nif (!customElements.get('tc-range-slider')) {\n customElements.define('tc-range-slider', class extends TCRangeSlider{});\n}\n\nexport default RangeSlider;\n\n\n"], + "mappings": ";;;;;;+LAAA,IAAOA,GAAQ,CAACC,EAAQC,IAAuB,IAAKA,GAAaA,EAAU,OAAS,EAAIA,EAAU,IAAIC,GAAY,gCAAiCA,OAAe,EAAE,KAAK,EAAE,EAAI,cAAeF,yuGCGvL,IAAMG,GAAkB,mBAClBC,GAAsB,wBACtBC,GAAsB,wBACtBC,GAAgB,iBAEhBC,GAAO,OACPC,GAAM,MACNC,GAAM,MACNC,GAAO,OACPC,GAAQ,QACRC,GAAO,OACPC,GAAQ,QACRC,GAAc,MACdC,GAAc,MAEdC,GAAW,WACXC,GAAmB,oBACnBC,GAAqB,sBAErBC,GAAc,eACdC,GAAe,gBACfC,GAAe,gBAEfC,GAAW,YACXC,GAAgB,kBAChBC,GAAe,iBAEfC,GAAe,gBACfC,GAAgB,iBAChBC,GAAgB,iBAChBC,GAAY,aACZC,GAAi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"names": ["main_html_default", "styles", "linkHrefs", "linkHref", "PointersOverlap", "PointersMinDistance", "PointersMaxDistance", "RangeDragging", "Data", "Min", "Max", "Step", "Round", "Type", "Theme", "RightToLeft", "BottomToTop", "Disabled", "KeyboardDisabled", "MousewheelDisabled", "SliderWidth", "SliderHeight", "SliderRadius", "SliderBg", "SliderBgHover", "SliderBgFill", "PointerWidth", "PointerHeight", "PointerRadius", "PointerBg", "PointerBgHover", "PointerBgFocus", "PointerShadow", "PointerShadowHover", "PointerShadowFocus", "PointerBorder", "PointerBorderHover", "PointerBorderFocus", "AnimateOnClick", "CSSLinks", "Vertical", "Horizontal", "convertRange", "min", "max", "a", "b", "x", "temp", "isNumber", "input", "getNumber", "defaultValue", "roundToStep", "num", "step", "setDecimalPlaces", "decimalPlaces", "coeff", "__pow", "getBoolean", "val", "sendPointerClickedEvent", "$component", "$pointer", "sendMouseDownEvent", "evt", "sendMouseUpEvent", "sendOnKeyDownEvent", "sendChangeEvent", "values", "transformed", "value", "isNumber", "getNumber", "detail", "i", "Pointer", "$component", "$pointer", "index", "percent", "arrowLeft", "arrowRight", "arrowUp", "arrowDown", "disabled", "updatePosition", "_percent", "_leftWall", "_rightWall", "_type", "_rightToLeft", "_bottomToTop", "oldValue", "percentPos", "Vertical", "Horizontal", "isClicked", "$target", "setCallbacks", "_arrowLeft", "_arrowRight", "_arrowUp", "_arrowDown", "setDisabled", "_disabled", "setAttr", "key", "value", "getAttr", "pointerKeyDown", "evt", "sendOnKeyDownEvent", "pointerClicked", "sendPointerClickedEvent", "parseData", "dataString", "parts", "list", "allValuesAreNumbers", "i", "part", "isNumber", "item", "findValueIndexInData", "val", "data", "PanelFill", "$fill", "type", "percents", "rightToLeft", "bottomToTop", "oneOnly", "first", "last", "Vertical", "AnimateOnClick", "SliderWidth", "SliderHeight", "SliderRadius", "SliderBg", "SliderBgHover", "SliderBgFill", "PointerWidth", "PointerHeight", "PointerRadius", "PointerBg", "PointerBgHover", "PointerBgFocus", "PointerShadow", "PointerShadowHover", "PointerShadowFocus", "PointerBorder", "PointerBorderHover", "PointerBorderFocus", "getAttributesByRegex", "$component", "regex", "parseValue", "map", "attr", "valueProp", "key", "keyNum", "getNumber", "value", "getExternalCSSList", "str", "CSSLinks", "parts", "cssList", "part", "stylePropertiesList", "SliderWidth", "SliderHeight", "SliderRadius", "SliderBg", "SliderBgHover", "SliderBgFill", "PointerWidth", "PointerHeight", "PointerRadius", "PointerBg", "PointerBgHover", "PointerBgFocus", "PointerShadow", "PointerShadowHover", "PointerShadowFocus", "PointerBorder", "PointerBorderHover", "PointerBorderFocus", "Styles", "$component", "$slider", "pointers", "theme", "pointerShapes", "stylesMap", "removeClassesStartWith", "prefix", "$element", "classList", "className", "removeClasses", "$pointers", "$pointer", "setTheme", "val", "updatePointerShapes", "i", "item", "setPointerShape", "index", "value", "setPointerShapes", "list", "getAttributesByRegex", "getKey", "key", "setStyle", "pointer", "$styleHolder", "getStyle", "cssVariableName", "attrName", "apiProperty", "regex", "cssVariableValue", "apiProperties", "propName", "ex", "Theme", "AnimateOnClick", "RangeDragging", "PluginsManager", "$component", "requestUpdatePlugins", "setters", "getters", "plugins", "update", "data", "plugin", "destroy", "onAttrChange", "_attrName", "_newValue", "defineSettersGetters", "item", "ex", "initStyles", "_a", "$style", "pluginFunc", "MAX_VALUES_API", "POINTER_Z_INDEX_DEFAULT", "initPointers", "$component", "$pointer", "map", "regex", "attr", "valueProp", "key", "keyNum", "getNumber", "value", "isNumber", "max", "pointers", "Pointer", "$latestPointer", "i", "$newPointer", "initPointerAPI", "slider", "index", "ariaLabelProp", "pointerShapeProp", "pointerDisabledProp", "pointer", "val", "_a", "_b", "ex", "initPointerAPIs", "apiProperties", "item", "changePointersOrder", "isDesc", "$container", "setZIndex", "selectedPointer", "MIN_DEFAULT", "MAX_DEFAULT", "ROUND_DEFAULT", "ANIMATE_ON_CLICK_DEFAULT", "Slider", "$component", "$slider", "pointersList", "pointers", "item", "selectedPointer", "panelFill", "styles", "pluginsManager", "min", "max", "step", "data", "type", "Horizontal", "round", "rightToLeft", "bottomToTop", "pointersOverlap", "pointersMinDistance", "pointersMaxDistance", "rangeDragging", "rangeDraggingStart", "rangeDraggingDiff", "disabled", "keyboardDisabled", "mousewheelDisabled", "animateOnClick", "eventName", "touchClientX", "touchClientY", "ariaLabels", "onMouseDown", "evt", "onValueChange", "onMouseUp", "sendMouseDownEvent", "AnimateOnClick", "sendMouseUpEvent", "getActivePointer", "$target", "percent", "panelFillClicked", "isPanelFillClicked", "_dragPercent", "stepPercent", "getStepPercent", "roundToStep", "isPanelClicked", "pointer", "minDistance", "minDistancePointer", "distance", "getSelectedPointerIndex", "setEventType", "Vertical", "boxHeight", "boxTop", "mouseY", "boxWidth", "boxLeft", "mouseX", "setZIndex", "firstPointer", "lastPointer", "firstSmallerThanMin", "lastGreaterThanMax", "i", "setPositions", "foundIndex", "pointerMouseWheel", "scrollTop", "rightOrBottom", "shouldGoPrev", "goPrev", "goNext", "arrowLeft", "pointerIndex", "arrowRight", "arrowUp", "arrowDown", "index", "_percent", "updatePlugins", "getPercents", "getValues", "getPointerElements", "getNumericMin", "getNumericMax", "getData", "getStep", "getRound", "getType", "getMin", "getMax", "isRightToLeft", "isBottomToTop", "isPointersOverlap", "getPointersMinDistance", "getPointersMaxDistance", "isRangeDraggingEnabled", "isDisabled", "isKeyboardDisabled", "isMousewheelDisabled", "requestUpdatePlugins", "getEventType", "getPointerLeftWall", "converted", "getPointerRightWall", "_step", "currentValue", "convertRange", "isNumber", "diff", "getTextValue", "val", "setDecimalPlaces", "getPointerMin", "_a", "getPointerMax", "getAriaLabel", "_eventName", "percentChanged", "valueText", "setAriaMinMax", "sendChangeEvent", "setAllPositions", "setMinMax", "_min", "_max", "getNumber", "setMin", "setMax", "_b", "setValues", "values", "setValue", "_val", "findValueIndexInData", "setStep", "setPointersOverlap", "_pointersOverlap", "setPointersMinDistance", "_pointersMinDistance", "setPointersMaxDistance", "_pointersMaxDistance", "setDisabled", "_disabled", "setKeyboardDisabled", "setMousewheelDisabled", "setData", "_data", "parseData", "setType", "_type", "$box", "aria", "setRightToLeft", "_rightToLeft", "changePointersOrder", "setBottomToTop", "_bottomToTop", "setRound", "_round", "setAnimateOnClick", "_animateOnClick", "setAriaLabel", "_ariaLabel", "setRangeDragging", "_rangeDragging", "RangeDragging", "initDisabled", "getBoolean", "Disabled", "KeyboardDisabled", "MousewheelDisabled", "disabledList", "getAttributesByRegex", "initAriaLabels", "ariaLabelsList", "addPointer", "value", "len", "$latestPointer", "$newPointer", "newPointer", "Pointer", "removePointer", "$fill", "PanelFill", "Type", "RightToLeft", "BottomToTop", "Min", "Max", "Step", "Data", "PointersOverlap", "PointersMinDistance", "PointersMaxDistance", "Round", "Styles", "PluginsManager", "_keyboardDisabled", "_mousewheelDisabled", "onAttributeChange", "slider", "attrName", "newValue", "found", "stylePropertiesList", "_cssVariableName", "_attrName", "_apiProperty", "_regex", "key", "index", "getNumber", "Min", "Max", "Step", "PointersOverlap", "getBoolean", "PointersMinDistance", "RangeDragging", "PointersMaxDistance", "Disabled", "KeyboardDisabled", "MousewheelDisabled", "Data", "Type", "RightToLeft", "BottomToTop", "Round", "ROUND_DEFAULT", "Theme", "AnimateOnClick", "property", "pointer", "TCRangeSlider", "__publicField", "_step", "_a", "_disabled", "_b", "_data", "_min", "_max", "_round", "ROUND_DEFAULT", "_type", "Horizontal", "_pointersOverlap", "_pointersMinDistance", "_pointersMaxDistance", "_theme", "_c", "_rtl", "_btt", "_keyboardDisabled", "_mousewheelDisabled", "_animateOnClick", "_rangeDragging", "getBoolean", "value", "index", "initPointerAPI", "css", "sheet", "getExternalCSSList", "main_html_default", "styles_default", "$pointer", "$slider", "pointers", "initPointers", "Slider", "initPointerAPIs", "mutations", "mutation", "attrName", "onAttributeChange", "range_slider_default", "range_slider_default"] } diff --git a/docs/pages/moving-tooltip-plugin.html b/docs/pages/moving-tooltip-plugin.html index d0307ac7..c122e657 100644 --- a/docs/pages/moving-tooltip-plugin.html +++ b/docs/pages/moving-tooltip-plugin.html @@ -117,35 +117,35 @@
- Getting Started + Getting Started
- Styles + Styles
- Additional Features + Additional Features
- Advanced + Advanced
- Plugins + Plugins @@ -186,7 +186,7 @@ <script src="tcrs-moving-tooltip.min.js"></script> <script src="toolcool-range-slider.min.js"></script>
- moving-tooltip-bg="#387ec7" moving-tooltip-text-color="#efefef"></tc-range-slider>
- moving-tooltip-text-color="#efefef"></tc-range-slider> <!-- The plugin should be included before the core library. --> -<script +<script src="https://cdn.jsdelivr.net/npm/toolcool-range-slider/dist/plugins/tcrs-moving-tooltip.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/toolcool-range-slider/dist/toolcool-range-slider.min.js"></script> @@ -309,6 +309,12 @@ “” or “prefix” tooltipUnitType + + moving-tooltip-hidden + false + boolean + tooltipHidden + - undefined @@ -383,22 +389,22 @@
Previous
Right To Left Support
-
- +
+
- + - + -
+ @@ -413,4 +419,4 @@ - \ No newline at end of file + diff --git a/examples/28-moving-tooltip-plugin.html b/examples/28-moving-tooltip-plugin.html index 54585844..aaaa4e52 100644 --- a/examples/28-moving-tooltip-plugin.html +++ b/examples/28-moving-tooltip-plugin.html @@ -33,6 +33,29 @@

Horizontal

slider-width="100%"> +

Horizontal and tooltip hidden by default

+
+ +
+

Units as a prefix

Vertical Negative }; - \ No newline at end of file + diff --git a/package-lock.json b/package-lock.json index 1d723feb..02ffb725 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "toolcool-range-slider", - "version": "4.0.26", + "version": "4.0.28", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "toolcool-range-slider", - "version": "4.0.26", + "version": "4.0.28", "license": "MIT", "devDependencies": { "@sindresorhus/slugify": "^2.2.0", diff --git a/src/core/plugins/interfaces.ts b/src/core/plugins/interfaces.ts index 2144930f..9ac27b99 100644 --- a/src/core/plugins/interfaces.ts +++ b/src/core/plugins/interfaces.ts @@ -55,6 +55,7 @@ export interface IPluginGetters { getPercents: () => number[]; getValues: () => (string | number | undefined)[]; getPointerElements: () => HTMLElement[]; + getActivePointerIndex: () => number; getMin: () => number; getMax: () => number; @@ -77,6 +78,8 @@ export interface IPluginGetters { isRangeDraggingEnabled: () => boolean; getPointersMinDistance: () => number; getPointersMaxDistance: () => number; + + getEventName: () => 'mousedown' | 'mouseup' | 'mousemove' | 'wheel' | 'touchemove' | 'touchstart' | 'touchend' | string | undefined } export interface IPlugin { @@ -102,4 +105,4 @@ export interface IPlugin { css?: string, destroy?: () => void; -} \ No newline at end of file +} diff --git a/src/core/ui/slider.ts b/src/core/ui/slider.ts index 51964a36..9614f6f8 100644 --- a/src/core/ui/slider.ts +++ b/src/core/ui/slider.ts @@ -89,6 +89,10 @@ export const Slider = ($component: HTMLElement, $slider: HTMLElement, pointersLi let mousewheelDisabled = false; let animateOnClick: string | undefined = ANIMATE_ON_CLICK_DEFAULT; + let eventName: 'mousedown' | 'mouseup' | 'mousemove' | 'wheel' | 'touchemove' | 'touchstart' | string |undefined = undefined + let touchClientX: number; + let touchClientY: number; + const ariaLabels: (string | undefined)[] = []; // -------------- EVENTS -------------------- @@ -114,6 +118,8 @@ export const Slider = ($component: HTMLElement, $slider: HTMLElement, pointersLi rangeDraggingStart = undefined; rangeDraggingDiff = undefined; + onValueChange(evt); + window.removeEventListener('mousemove', onValueChange); window.removeEventListener('mouseup', onMouseUp); @@ -202,19 +208,28 @@ export const Slider = ($component: HTMLElement, $slider: HTMLElement, pointersLi }; const onValueChange = (evt: MouseEvent | TouchEvent) => { + setEventType(evt.type); + + if (evt instanceof TouchEvent && evt.touches[0]) { + touchClientX = evt.touches[0].clientX; + } + + if (evt instanceof TouchEvent && evt.touches[0]) { + touchClientY = evt.touches[0].clientY; + } // find the percent [0, 100] of the current mouse position in vertical or horizontal slider let percent; if(type === TypeEnum.Vertical){ const { height: boxHeight, top: boxTop } = $slider.getBoundingClientRect(); - const mouseY = evt.type.indexOf('mouse') !== -1 ? (evt as MouseEvent).clientY : (evt as TouchEvent).touches[0].clientY; + const mouseY = evt.type.indexOf('mouse') !== -1 ? (evt as MouseEvent).clientY : touchClientY; const top = Math.min(Math.max(0, mouseY - boxTop), boxHeight); percent = (top * 100) / boxHeight; } else{ const { width: boxWidth, left: boxLeft } = $slider.getBoundingClientRect(); - const mouseX = evt.type.indexOf('mouse') !== -1 ? (evt as MouseEvent).clientX : (evt as TouchEvent).touches[0].clientX; + const mouseX = evt.type.indexOf('mouse') !== -1 ? (evt as MouseEvent).clientX : touchClientX; const left = Math.min(Math.max(0, mouseX - boxLeft), boxWidth); percent = (left * 100) / boxWidth; } @@ -256,6 +271,8 @@ export const Slider = ($component: HTMLElement, $slider: HTMLElement, pointersLi }; const pointerMouseWheel = (evt: WheelEvent) => { + setEventType(evt.type); + if (disabled || document.activeElement !== $component || selectedPointer?.disabled) return; @@ -465,6 +482,9 @@ export const Slider = ($component: HTMLElement, $slider: HTMLElement, pointersLi }; // -------------- Getters -------------------- +const getEventType = () => { + return eventName; +} const getPointerLeftWall = (pointerIndex: number) => { if(pointersOverlap || pointers.length <= 1 || max === min) return undefined; @@ -662,6 +682,9 @@ export const Slider = ($component: HTMLElement, $slider: HTMLElement, pointersLi // -------------- Setters -------------------- + const setEventType = (_eventName: string) => { + eventName = _eventName; + } const setPositions = (index: number, _percent: number | undefined) => { if(_percent === undefined) return; @@ -1092,6 +1115,7 @@ export const Slider = ($component: HTMLElement, $slider: HTMLElement, pointersLi $slider.addEventListener('mouseup', onMouseUp); $slider.addEventListener('touchmove', onValueChange); $slider.addEventListener('touchstart', onValueChange); + $slider.addEventListener('touchend', onValueChange); if(!mousewheelDisabled){ document.addEventListener('wheel', pointerMouseWheel, { passive: false }); @@ -1123,6 +1147,7 @@ export const Slider = ($component: HTMLElement, $slider: HTMLElement, pointersLi getPercents, getValues, getPointerElements, + getActivePointerIndex: getSelectedPointerIndex, getMin: getNumericMin, getMax: getNumericMax, @@ -1146,6 +1171,8 @@ export const Slider = ($component: HTMLElement, $slider: HTMLElement, pointersLi isRangeDraggingEnabled, getPointersMinDistance, getPointersMaxDistance, + + getEventName: getEventType } ); pluginsManager.init(); diff --git a/src/plugins/moving-tooltip-plugin/index.ts b/src/plugins/moving-tooltip-plugin/index.ts index 2bd93bc6..1f674d31 100644 --- a/src/plugins/moving-tooltip-plugin/index.ts +++ b/src/plugins/moving-tooltip-plugin/index.ts @@ -1,6 +1,6 @@ import { IPlugin, IPluginGetters, IPluginSetters, IPluginUpdateData } from '../../core/plugins/interfaces'; import RangeSlider from '../../core'; -import { getBoolean, getNumber } from '../../core/domain/math-provider'; +import { getBoolean, getNumber, isNumber } from '../../core/domain/math-provider'; /** * Moving Tooltip Plugin. @@ -13,10 +13,11 @@ import { getBoolean, getNumber } from '../../core/domain/math-provider'; window.tcRangeSliderPlugins = window.tcRangeSliderPlugins || []; const DISTANCE_TO_POINTER_DEFAULT = 40; // px -const DEFAULT_TOOLTIP_WIDTH = 35; +const DEFAULT_TOOLTIP_WIDTH = 'auto'; const DEFAULT_TOOLTIP_HEIGHT = 30; const DEFAULT_TOOLTIP_BG = '#475569'; const DEFAULT_TOOLTIP_TEXT_COLOR = '#fff'; +const DEFAULT_TOOLTIP_HIDDEN = false; const DEFAULT_Z_INDEX = 20; const MovingTooltipPlugin = () : IPlugin => { @@ -26,10 +27,11 @@ const MovingTooltipPlugin = () : IPlugin => { let enabled = false; let distanceToPointer = DISTANCE_TO_POINTER_DEFAULT; // px - let tooltipWidth = DEFAULT_TOOLTIP_WIDTH; + let tooltipWidth: string | number = DEFAULT_TOOLTIP_WIDTH; let tooltipHeight = DEFAULT_TOOLTIP_HEIGHT; let tooltipBg = DEFAULT_TOOLTIP_BG; let tooltipTextColor = DEFAULT_TOOLTIP_TEXT_COLOR; + let tooltipHidden = DEFAULT_TOOLTIP_HIDDEN; let tooltipUnits = ''; let unitType = ''; @@ -49,6 +51,7 @@ const MovingTooltipPlugin = () : IPlugin => { $tooltipsRow = document.createElement('div'); $tooltipsRow.classList.add('tooltips'); $slider.prepend($tooltipsRow); + updateRowClass(); }; @@ -56,6 +59,11 @@ const MovingTooltipPlugin = () : IPlugin => { const $tooltip = document.createElement('div'); $tooltip.style.zIndex = DEFAULT_Z_INDEX.toString(); $tooltip.className = className; + + if (tooltipHidden) { + $tooltip.style.opacity = '0'; + } + return $tooltip; }; @@ -71,7 +79,7 @@ const MovingTooltipPlugin = () : IPlugin => { $tooltip.style.top = `${ -distanceToPointer }px`; } - $tooltip.style.width = `${ tooltipWidth }px`; + $tooltip.style.width = `${ isNumber(tooltipWidth) ? tooltipWidth + 'px' : tooltipWidth }`; $tooltip.style.height = `${ tooltipHeight }px`; $tooltip.style.background = tooltipBg; $tooltip.style.color = tooltipTextColor; @@ -147,7 +155,7 @@ const MovingTooltipPlugin = () : IPlugin => { updateTooltips(); }; - const setTooltipWidth = (newWidth: number) => { + const setTooltipWidth = (newWidth: number | string) => { tooltipWidth = newWidth; updateTooltips(); }; @@ -172,6 +180,11 @@ const MovingTooltipPlugin = () : IPlugin => { updateTooltips(); }; + const settooltipHidden = (newValue: boolean) => { + tooltipHidden = newValue; + updateTooltips(); + }; + const setUnitType = (newValue: string) => { unitType = newValue; updateTooltips(); @@ -183,41 +196,43 @@ const MovingTooltipPlugin = () : IPlugin => { }; const update = (data: IPluginUpdateData) => { - if(!enabled || !data.values) return; const $pointers = getters?.getPointerElements() ?? []; + const activePointerIndex = getters?.getActivePointerIndex() ?? undefined; const type = getters?.getType() ?? 'horizontal'; - for(let i=0; i { tooltipBg = _$component.getAttribute('moving-tooltip-bg') || DEFAULT_TOOLTIP_BG; tooltipTextColor = _$component.getAttribute('moving-tooltip-text-color') || DEFAULT_TOOLTIP_TEXT_COLOR; tooltipUnits = _$component.getAttribute('moving-tooltip-units') || ''; + tooltipHidden = getBoolean(_$component.getAttribute('moving-tooltip-hidden')) || DEFAULT_TOOLTIP_HIDDEN unitType = _$component.getAttribute('moving-tooltip-units-type') || ''; toggleEnabled(getBoolean(_$component.getAttribute('moving-tooltip'))); }, @@ -306,6 +322,10 @@ const MovingTooltipPlugin = () : IPlugin => { setTooltipUnits(_newValue); } + if(_attrName === 'moving-tooltip-hidden'){ + settooltipHidden(getBoolean(_newValue)); + } + if(_attrName === 'moving-tooltip-units-type'){ setUnitType(_newValue); } @@ -407,6 +427,19 @@ const MovingTooltipPlugin = () : IPlugin => { } }, + { + name: 'tooltipHidden', + attributes: { + get () { + return tooltipHidden; + }, + + set: (_value) => { + settooltipHidden(getBoolean(_value)); + }, + } + }, + { name: 'tooltipUnitType', attributes: { @@ -447,6 +480,7 @@ const MovingTooltipPlugin = () : IPlugin => { text-align: center; transform: translate(-50%, -50%); pointer-events: none; + padding: 0 4px; z-index: ${ DEFAULT_Z_INDEX }; } @@ -502,6 +536,7 @@ export interface IMovingTooltipPlugin extends RangeSlider{ tooltipBg: string; tooltipTextColor: string; tooltipUnits: string; + tooltipHidden: boolean; tooltipUnitType: string; // https://github.com/mzusin/toolcool-range-slider/issues/16