element-plus
Version:
A Component Library for Vue 3
1 lines • 3.37 kB
Source Map (JSON)
{"version":3,"file":"anchor.mjs","names":[],"sources":["../../../../../../packages/components/anchor/src/anchor.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isString,\n isUndefined,\n} from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type Anchor from './anchor.vue'\n\nexport interface AnchorProps {\n /**\n * @description scroll container\n */\n container?: string | HTMLElement | Window | null\n /**\n * @description Set the offset of the anchor scroll\n */\n offset?: number\n /**\n * @description The offset of the element starting to trigger the anchor\n */\n bound?: number\n /**\n * @description Set the scroll duration of the container when the anchor is clicked, in milliseconds\n */\n duration?: number\n /**\n * @description Whether to show the marker\n */\n marker?: boolean\n /**\n * @description Set Anchor type\n */\n type?: 'default' | 'underline'\n /**\n * @description Set Anchor direction\n */\n direction?: 'vertical' | 'horizontal'\n /**\n * @description Scroll whether link is selected at the top\n */\n selectScrollTop?: boolean\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `AnchorProps` instead.\n */\nexport const anchorProps = buildProps({\n /**\n * @description scroll container\n */\n container: {\n type: definePropType<string | HTMLElement | Window | null>([\n String,\n Object,\n ]),\n },\n /**\n * @description Set the offset of the anchor scroll\n */\n offset: {\n type: Number,\n default: 0,\n },\n /**\n * @description The offset of the element starting to trigger the anchor\n */\n bound: {\n type: Number,\n default: 15,\n },\n /**\n * @description Set the scroll duration of the container when the anchor is clicked, in milliseconds\n */\n duration: {\n type: Number,\n default: 300,\n },\n /**\n * @description Whether to show the marker\n */\n marker: {\n type: Boolean,\n default: true,\n },\n /**\n * @description Set Anchor type\n */\n type: {\n type: definePropType<'default' | 'underline'>(String),\n default: 'default',\n },\n /**\n * @description Set Anchor direction\n */\n direction: {\n type: definePropType<'vertical' | 'horizontal'>(String),\n default: 'vertical',\n },\n /**\n * @description Scroll whether link is selected at the top\n */\n selectScrollTop: Boolean,\n})\n\n/**\n * @deprecated Removed after 3.0.0, Use `AnchorProps` instead.\n */\nexport type AnchorPropsPublic = ExtractPublicPropTypes<typeof anchorProps>\nexport type AnchorInstance = InstanceType<typeof Anchor> & unknown\n\nexport const anchorEmits = {\n change: (href: string) => isString(href),\n click: (e: MouseEvent, href?: string) =>\n e instanceof MouseEvent && (isString(href) || isUndefined(href)),\n}\nexport type AnchorEmits = typeof anchorEmits\n"],"mappings":";;;;;;;AAgDA,MAAa,cAAc,WAAW;CAIpC,WAAW,EACT,MAAM,eAAqD,CACzD,QACA,OACD,CAAC,EACH;CAID,QAAQ;EACN,MAAM;EACN,SAAS;EACV;CAID,OAAO;EACL,MAAM;EACN,SAAS;EACV;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,QAAQ;EACN,MAAM;EACN,SAAS;EACV;CAID,MAAM;EACJ,MAAM,eAAwC,OAAO;EACrD,SAAS;EACV;CAID,WAAW;EACT,MAAM,eAA0C,OAAO;EACvD,SAAS;EACV;CAID,iBAAiB;CAClB,CAAC;AAQF,MAAa,cAAc;CACzB,SAAS,SAAiB,SAAS,KAAK;CACxC,QAAQ,GAAe,SACrB,aAAa,eAAe,SAAS,KAAK,IAAI,YAAY,KAAK;CAClE"}