mirror of
				https://github.com/antd-tiny-vue/antd-tiny-vue.git
				synced 2025-11-04 18:41:45 +08:00 
			
		
		
		
	fix: fix provide inject error
This commit is contained in:
		
							
								
								
									
										11
									
								
								components/_util/wave/index.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								components/_util/wave/index.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
import { defineComponent } from 'vue'
 | 
			
		||||
 | 
			
		||||
const Wave = defineComponent({
 | 
			
		||||
  name: 'Wave',
 | 
			
		||||
  inheritAttrs: false,
 | 
			
		||||
  setup() {
 | 
			
		||||
    return () => {}
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
export default Wave
 | 
			
		||||
							
								
								
									
										34
									
								
								components/_util/wave/style.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								components/_util/wave/style.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
import { genComponentStyleHook } from '../../theme/internal'
 | 
			
		||||
import type { FullToken, GenerateStyle } from '../../theme/internal'
 | 
			
		||||
 | 
			
		||||
export interface ComponentToken {}
 | 
			
		||||
 | 
			
		||||
export interface WaveToken extends FullToken<'Wave'> {}
 | 
			
		||||
 | 
			
		||||
const genWaveStyle: GenerateStyle<WaveToken> = token => {
 | 
			
		||||
  const { componentCls, colorPrimary } = token
 | 
			
		||||
  return {
 | 
			
		||||
    [componentCls]: {
 | 
			
		||||
      position: 'absolute',
 | 
			
		||||
      background: 'transparent',
 | 
			
		||||
      pointerEvents: 'none',
 | 
			
		||||
      boxSizing: 'border-box',
 | 
			
		||||
      color: `var(--wave-color, ${colorPrimary})`,
 | 
			
		||||
 | 
			
		||||
      boxShadow: `0 0 0 0 currentcolor`,
 | 
			
		||||
      opacity: 0.2,
 | 
			
		||||
 | 
			
		||||
      // =================== Motion ===================
 | 
			
		||||
      '&.wave-motion-appear': {
 | 
			
		||||
        transition: [`box-shadow 0.4s ${token.motionEaseOutCirc}`, `opacity 2s ${token.motionEaseOutCirc}`].join(','),
 | 
			
		||||
 | 
			
		||||
        '&-active': {
 | 
			
		||||
          boxShadow: `0 0 0 6px currentcolor`,
 | 
			
		||||
          opacity: 0
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default genComponentStyleHook('Wave', token => [genWaveStyle(token)])
 | 
			
		||||
							
								
								
									
										35
									
								
								components/_util/wave/util.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								components/_util/wave/util.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
export function isNotGrey(color: string) {
 | 
			
		||||
  // eslint-disable-next-line no-useless-escape
 | 
			
		||||
  const match = (color || '').match(/rgba?\((\d*), (\d*), (\d*)(, [\d.]*)?\)/)
 | 
			
		||||
  if (match && match[1] && match[2] && match[3]) {
 | 
			
		||||
    return !(match[1] === match[2] && match[2] === match[3])
 | 
			
		||||
  }
 | 
			
		||||
  return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function isValidWaveColor(color: string) {
 | 
			
		||||
  return (
 | 
			
		||||
    color &&
 | 
			
		||||
    color !== '#fff' &&
 | 
			
		||||
    color !== '#ffffff' &&
 | 
			
		||||
    color !== 'rgb(255, 255, 255)' &&
 | 
			
		||||
    color !== 'rgba(255, 255, 255, 1)' &&
 | 
			
		||||
    isNotGrey(color) &&
 | 
			
		||||
    !/rgba\((?:\d*, ){3}0\)/.test(color) && // any transparent rgba color
 | 
			
		||||
    color !== 'transparent'
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function getTargetWaveColor(node: HTMLElement) {
 | 
			
		||||
  const { borderTopColor, borderColor, backgroundColor } = getComputedStyle(node)
 | 
			
		||||
  if (isValidWaveColor(borderTopColor)) {
 | 
			
		||||
    return borderTopColor
 | 
			
		||||
  }
 | 
			
		||||
  if (isValidWaveColor(borderColor)) {
 | 
			
		||||
    return borderColor
 | 
			
		||||
  }
 | 
			
		||||
  if (isValidWaveColor(backgroundColor)) {
 | 
			
		||||
    return backgroundColor
 | 
			
		||||
  }
 | 
			
		||||
  return null
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user