Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.lib.components.VSlideGroup.helpers.mjs.map Maven / Gradle / Ivy
{"version":3,"file":"helpers.mjs","names":["calculateUpdatedTarget","_ref","selectedElement","containerElement","isRtl","isHorizontal","containerSize","getOffsetSize","scrollPosition","getScrollPosition","childrenSize","childrenStartPosition","getOffsetPosition","additionalOffset","calculateCenteredTarget","_ref2","containerOffsetSize","childrenOffsetPosition","childrenOffsetSize","getScrollSize","element","key","getClientSize","rtl","scrollLeft","offsetWidth","scrollWidth","scrollTop"],"sources":["../../../src/components/VSlideGroup/helpers.ts"],"sourcesContent":["export function calculateUpdatedTarget ({\n selectedElement,\n containerElement,\n isRtl,\n isHorizontal,\n}: {\n selectedElement: HTMLElement\n containerElement: HTMLElement\n isRtl: boolean\n isHorizontal: boolean\n}): number {\n const containerSize = getOffsetSize(isHorizontal, containerElement)\n const scrollPosition = getScrollPosition(isHorizontal, isRtl, containerElement)\n\n const childrenSize = getOffsetSize(isHorizontal, selectedElement)\n const childrenStartPosition = getOffsetPosition(isHorizontal, selectedElement)\n\n const additionalOffset = childrenSize * 0.4\n\n if (scrollPosition > childrenStartPosition) {\n return childrenStartPosition - additionalOffset\n } else if (scrollPosition + containerSize < childrenStartPosition + childrenSize) {\n return childrenStartPosition - containerSize + childrenSize + additionalOffset\n }\n\n return scrollPosition\n}\n\nexport function calculateCenteredTarget ({\n selectedElement,\n containerElement,\n isHorizontal,\n}: {\n selectedElement: HTMLElement\n containerElement: HTMLElement\n isHorizontal: boolean\n}): number {\n const containerOffsetSize = getOffsetSize(isHorizontal, containerElement)\n const childrenOffsetPosition = getOffsetPosition(isHorizontal, selectedElement)\n const childrenOffsetSize = getOffsetSize(isHorizontal, selectedElement)\n\n return childrenOffsetPosition - (containerOffsetSize / 2) + (childrenOffsetSize / 2)\n}\n\nexport function getScrollSize (isHorizontal: boolean, element?: HTMLElement) {\n const key = isHorizontal ? 'scrollWidth' : 'scrollHeight'\n return element?.[key] || 0\n}\n\nexport function getClientSize (isHorizontal: boolean, element?: HTMLElement) {\n const key = isHorizontal ? 'clientWidth' : 'clientHeight'\n return element?.[key] || 0\n}\n\nexport function getScrollPosition (isHorizontal: boolean, rtl: boolean, element?: HTMLElement) {\n if (!element) {\n return 0\n }\n\n const {\n scrollLeft,\n offsetWidth,\n scrollWidth,\n } = element\n\n if (isHorizontal) {\n return rtl\n ? scrollWidth - offsetWidth + scrollLeft\n : scrollLeft\n }\n\n return element.scrollTop\n}\n\nexport function getOffsetSize (isHorizontal: boolean, element?: HTMLElement) {\n const key = isHorizontal ? 'offsetWidth' : 'offsetHeight'\n return element?.[key] || 0\n}\n\nexport function getOffsetPosition (isHorizontal: boolean, element?: HTMLElement) {\n const key = isHorizontal ? 'offsetLeft' : 'offsetTop'\n return element?.[key] || 0\n}\n"],"mappings":"AAAA,OAAO,SAASA,sBAAsBA,CAAAC,IAAA,EAU3B;EAAA,IAV6B;IACtCC,eAAe;IACfC,gBAAgB;IAChBC,KAAK;IACLC;EAMF,CAAC,GAAAJ,IAAA;EACC,MAAMK,aAAa,GAAGC,aAAa,CAACF,YAAY,EAAEF,gBAAgB,CAAC;EACnE,MAAMK,cAAc,GAAGC,iBAAiB,CAACJ,YAAY,EAAED,KAAK,EAAED,gBAAgB,CAAC;EAE/E,MAAMO,YAAY,GAAGH,aAAa,CAACF,YAAY,EAAEH,eAAe,CAAC;EACjE,MAAMS,qBAAqB,GAAGC,iBAAiB,CAACP,YAAY,EAAEH,eAAe,CAAC;EAE9E,MAAMW,gBAAgB,GAAGH,YAAY,GAAG,GAAG;EAE3C,IAAIF,cAAc,GAAGG,qBAAqB,EAAE;IAC1C,OAAOA,qBAAqB,GAAGE,gBAAgB;EACjD,CAAC,MAAM,IAAIL,cAAc,GAAGF,aAAa,GAAGK,qBAAqB,GAAGD,YAAY,EAAE;IAChF,OAAOC,qBAAqB,GAAGL,aAAa,GAA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