Blame view

天文台pc/tianwentai-ui/node_modules/@emotion/styled/src/index.ts 999 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  import { Theme } from '@emotion/react'
  import baseStyled from './base'
  import { ReactJSXIntrinsicElements } from './jsx-namespace'
  import { tags } from './tags'
  import {
    CreateStyledComponent,
    CreateStyled as BaseCreateStyled
  } from './types'
  export type {
    ArrayInterpolation,
    ComponentSelector,
    CSSObject,
    FunctionInterpolation,
    Interpolation
  } from '@emotion/serialize'
  export type {
    CreateStyledComponent,
    FilteringStyledOptions,
    StyledComponent,
    StyledOptions
  } from './types'
  
  export type StyledTags = {
    [Tag in keyof ReactJSXIntrinsicElements]: CreateStyledComponent<
      {
        theme?: Theme
        as?: React.ElementType
      },
      ReactJSXIntrinsicElements[Tag]
    >
  }
  
  export interface CreateStyled extends BaseCreateStyled, StyledTags {}
  
  // bind it to avoid mutating the original function
  const styled = baseStyled.bind(null) as CreateStyled
  
  tags.forEach(tagName => {
    ;(styled as any)[tagName] = styled(tagName as keyof typeof styled)
  })
  
  export default styled