mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-26 04:27:26 +08:00
refactor(project): removing packages/tokens (#11769)
* refactor(tokens): remove tokens * Remove tokens/breadcrumb. * refactor(tokens): remove tokens/button * refactor(tokens): remove tokens/carousel * refactor(tokens): removing tokens/checkbox * refactor(tokens): removing tokens/collapse * refactor(tokens): removing tokens/dialog * refactor(tokens): removing tokens/pagination * refactor(tokens): removing tokens/radio * refactor(tokens): removing tokens/row * refactor(tokens): removing tokens/scrollbar * refactor(tokens): removing tokens/slider * refactor(tokens): removing tokens/tabs * refactor(tokens): removing tokens/upload * refactor(tokens): removing tokens/popper * refactor(tokens): removing tokens/tooltip * refactor(tokens): removing tokens/tooltip-v2 * refactor(tokens): removing tokens/date-picker * refactor(project): removing tokens/experimentals * Remove tokens/experimentals * Remove package/tokens * Remove tokens related parts * refactor(project): removing packages/tokens completely * chore: update import statement
This commit is contained in:
@ -12,5 +12,6 @@ export const ElCarouselItem = withNoopInstall(CarouselItem)
|
||||
|
||||
export * from './src/carousel'
|
||||
export * from './src/carousel-item'
|
||||
export * from './src/constants'
|
||||
|
||||
export type { CarouselInstance, CarouselItemInstance } from './src/instance'
|
||||
|
34
packages/components/carousel/src/constants.ts
Normal file
34
packages/components/carousel/src/constants.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import type { InjectionKey, Ref } from 'vue'
|
||||
|
||||
import type { CarouselItemProps } from './carousel-item'
|
||||
|
||||
export type CarouselItemStates = {
|
||||
hover: boolean
|
||||
translate: number
|
||||
scale: number
|
||||
active: boolean
|
||||
ready: boolean
|
||||
inStage: boolean
|
||||
animating: boolean
|
||||
}
|
||||
|
||||
export type CarouselItemContext = {
|
||||
props: CarouselItemProps
|
||||
states: CarouselItemStates
|
||||
uid: number
|
||||
translateItem: (index: number, activeIndex: number, oldIndex?: number) => void
|
||||
}
|
||||
|
||||
export type CarouselContext = {
|
||||
root: Ref<HTMLElement | undefined>
|
||||
items: Ref<CarouselItemContext[]>
|
||||
isCardType: Ref<boolean>
|
||||
isVertical: Ref<boolean>
|
||||
loop: boolean
|
||||
addItem: (item: CarouselItemContext) => void
|
||||
removeItem: (uid: number) => void
|
||||
setActiveItem: (index: number) => void
|
||||
}
|
||||
|
||||
export const carouselContextKey: InjectionKey<CarouselContext> =
|
||||
Symbol('carouselContextKey')
|
@ -8,7 +8,7 @@ import {
|
||||
unref,
|
||||
} from 'vue'
|
||||
import { debugWarn, isUndefined } from '@element-plus/utils'
|
||||
import { carouselContextKey } from '@element-plus/tokens'
|
||||
import { carouselContextKey } from './constants'
|
||||
|
||||
import type { CarouselItemProps } from './carousel-item'
|
||||
|
||||
|
@ -12,11 +12,11 @@ import {
|
||||
import { throttle } from 'lodash-unified'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { debugWarn, isString } from '@element-plus/utils'
|
||||
import { carouselContextKey } from '@element-plus/tokens'
|
||||
import { useOrderedChildren } from '@element-plus/hooks'
|
||||
import { carouselContextKey } from './constants'
|
||||
|
||||
import type { SetupContext } from 'vue'
|
||||
import type { CarouselItemContext } from '@element-plus/tokens'
|
||||
import type { CarouselItemContext } from './constants'
|
||||
import type { CarouselEmits, CarouselProps } from './carousel'
|
||||
|
||||
const THROTTLE_TIME = 300
|
||||
|
Reference in New Issue
Block a user