UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 1.34 kB
{"version":3,"file":"util.mjs","names":[],"sources":["../../../../../../packages/components/scrollbar/src/util.ts"],"sourcesContent":["import type { CSSProperties } from 'vue'\nimport type { ThumbProps } from './thumb'\n\nexport const GAP = 4 // top 2 + bottom 2 of bar instance\n\nexport const BAR_MAP = {\n vertical: {\n offset: 'offsetHeight',\n scroll: 'scrollTop',\n scrollSize: 'scrollHeight',\n size: 'height',\n key: 'vertical',\n axis: 'Y',\n client: 'clientY',\n direction: 'top',\n },\n horizontal: {\n offset: 'offsetWidth',\n scroll: 'scrollLeft',\n scrollSize: 'scrollWidth',\n size: 'width',\n key: 'horizontal',\n axis: 'X',\n client: 'clientX',\n direction: 'left',\n },\n} as const\n\nexport const renderThumbStyle = ({\n move,\n size,\n bar,\n}: Pick<ThumbProps, 'move' | 'size'> & {\n bar: (typeof BAR_MAP)[keyof typeof BAR_MAP]\n}): CSSProperties => ({\n [bar.size]: size,\n transform: `translate${bar.axis}(${move}%)`,\n})\n"],"mappings":";AAGA,MAAa,MAAM;AAEnB,MAAa,UAAU;CACrB,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,YAAY;EACZ,MAAM;EACN,KAAK;EACL,MAAM;EACN,QAAQ;EACR,WAAW;EACZ;CACD,YAAY;EACV,QAAQ;EACR,QAAQ;EACR,YAAY;EACZ,MAAM;EACN,KAAK;EACL,MAAM;EACN,QAAQ;EACR,WAAW;EACZ;CACF;AAED,MAAa,oBAAoB,EAC/B,MACA,MACA,WAGoB;EACnB,IAAI,OAAO;CACZ,WAAW,YAAY,IAAI,KAAK,GAAG,KAAK;CACzC"}