UNPKG

7.63 kBTypeScriptView Raw
1/**
2 * vue tsx @tarojs/components 类型提示文件
3 * 如何使用?
4 * 请在醒目全局的类型文件中写入以下代码,覆盖默认的组件类型提示
5 * ```typescript
6 * export declare module '@tarojs/components' {
7 * export * from '@tarojs/components/types/index.vue3'
8 * }
9 * ```
10 */
11import { TaroElement } from '@tarojs/runtime'
12import { StandardProps } from './common'
13import * as CSS from 'csstype'
14/** 视图容器 */
15import { CoverImageProps } from './CoverImage'
16import { CoverViewProps } from './CoverView'
17import { MatchMediaProps } from './MatchMedia'
18import { MovableAreaProps } from './MovableArea'
19import { MovableViewProps } from './MovableView'
20import { PageContainerProps } from './PageContainer'
21import { ScrollViewProps } from './ScrollView'
22import { ShareElementProps } from './ShareElement'
23import { SwiperProps } from './Swiper'
24import { SwiperItemProps } from './SwiperItem'
25import { ViewProps } from './View'
26/** 基础内容 */
27import { IconProps } from './Icon'
28import { ProgressProps } from './Progress'
29import { RichTextProps } from './RichText'
30import { TextProps } from './Text'
31/** 表单组件 */
32import { ButtonProps } from './Button'
33import { CheckboxProps } from './Checkbox'
34import { CheckboxGroupProps } from './CheckboxGroup'
35import { EditorProps } from './Editor'
36import { FormProps } from './Form'
37import { InputProps } from './Input'
38import { KeyboardAccessoryProps } from './KeyboardAccessory'
39import { LabelProps } from './Label'
40import { PickerDateProps, PickerTimeProps, PickerRegionProps, PickerSelectorProps, PickerMultiSelectorProps } from './Picker'
41import { PickerViewProps } from './PickerView'
42import { RadioProps } from './Radio'
43import { RadioGroupProps } from './RadioGroup'
44import { SliderProps } from './Slider'
45import { SwitchProps } from './Switch'
46import { TextareaProps } from './Textarea'
47/** 导航 */
48import { FunctionalPageNavigatorProps } from './FunctionalPageNavigator'
49import { NavigatorProps } from './Navigator'
50import { NavigationBarProps } from './NavigationBar'
51/** 媒体组件 */
52import { AudioProps } from './Audio'
53import { CameraProps } from './Camera'
54import { ImageProps } from './Image'
55import { LivePlayerProps } from './LivePlayer'
56import { LivePusherProps } from './LivePusher'
57import { VideoProps } from './Video'
58import { VoipRoomProps } from './VoipRoom'
59/** 地图 */
60import { MapProps } from './Map'
61/** 画布 */
62import { CanvasProps } from './Canvas'
63/** 开放能力 */
64import { AdProps } from './Ad'
65import { AdCustomProps } from './AdCustom'
66import { OfficialAccountProps } from './OfficialAccount'
67import { OpenDataProps } from './OpenData'
68import { WebViewProps } from './WebView'
69/** 配置节点 */
70import { PageMetaProps } from './PageMeta'
71
72import { CustomWrapperProps } from './CustomWrapper'
73import { SlotProps } from './Slot'
74
75// 联合类型不能用omit(比如picker)
76type DistributiveOmit<T, K extends keyof T> = T extends unknown
77 ? Omit<T, K>
78 : never;
79
80type SlimProps = {
81 class?: any
82 style?: CSS.Properties<string | number>
83 innerHTML?: string
84}
85
86/** 转换react的类型到vue */
87type RemoveReactAttribute = 'className' | 'style' | 'key' | 'ref' | 'dangerouslySetInnerHTML'
88export type TransformReact2VueType<P extends StandardProps = Record<string, never>> = DistributiveOmit<P, RemoveReactAttribute> & SlimProps
89
90export declare class VueComponentType<P = Record<string, never>> extends TaroElement {
91 $props: TransformReact2VueType<P>
92 /** WebStorm 提示貌似找的是props */
93 props: this['$props']
94}
95
96/** 视图容器 */
97export declare class Block extends VueComponentType {}
98export declare class CoverImage extends VueComponentType<CoverImageProps> {}
99export declare class CoverView extends VueComponentType<CoverViewProps> {}
100export declare class MatchMedia extends VueComponentType<MatchMediaProps> {}
101export declare class MovableArea extends VueComponentType<MovableAreaProps> {}
102export declare class MovableView extends VueComponentType<MovableViewProps> {}
103export declare class PageContainer extends VueComponentType<PageContainerProps> {}
104export declare class ScrollView extends VueComponentType<ScrollViewProps> {}
105export declare class ShareElement extends VueComponentType<ShareElementProps> {}
106export declare class Swiper extends VueComponentType<SwiperProps> {}
107export declare class SwiperItem extends VueComponentType<SwiperItemProps> {}
108export declare class View extends VueComponentType<ViewProps> {}
109/** 基础内容 */
110export declare class Icon extends VueComponentType<IconProps> {}
111export declare class Progress extends VueComponentType<ProgressProps> {}
112export declare class RichText extends VueComponentType<RichTextProps> {}
113export declare class Text extends VueComponentType<TextProps> {}
114/** 表单组件 */
115export declare class Button extends VueComponentType<ButtonProps> {}
116export declare class Checkbox extends VueComponentType<CheckboxProps> {}
117export declare class CheckboxGroup extends VueComponentType<CheckboxGroupProps> {}
118export declare class Editor extends VueComponentType<EditorProps> {}
119export declare class Form extends VueComponentType<FormProps> {}
120export declare class Input extends VueComponentType<InputProps> {}
121export declare class KeyboardAccessory extends VueComponentType<KeyboardAccessoryProps> {}
122export declare class Label extends VueComponentType<LabelProps> {}
123export declare class Picker extends VueComponentType<PickerMultiSelectorProps | PickerTimeProps | PickerDateProps | PickerRegionProps | PickerSelectorProps> {}
124export declare class PickerView extends VueComponentType<PickerViewProps> {}
125export declare class PickerViewColumn extends VueComponentType {}
126export declare class Radio extends VueComponentType<RadioProps> {}
127export declare class RadioGroup extends VueComponentType<RadioGroupProps> {}
128export declare class Slider extends VueComponentType<SliderProps> {}
129export declare class Switch extends VueComponentType<SwitchProps> {}
130export declare class Textarea extends VueComponentType<TextareaProps> {}
131/** 导航 */
132export declare class FunctionalPageNavigator extends VueComponentType<FunctionalPageNavigatorProps> {}
133export declare class Navigator extends VueComponentType<NavigatorProps> {}
134export declare class NavigationBar extends VueComponentType<NavigationBarProps> {}
135/** 媒体组件 */
136export declare class Audio extends VueComponentType<AudioProps> {}
137export declare class Camera extends VueComponentType<CameraProps> {}
138export declare class Image extends VueComponentType<ImageProps> {}
139export declare class LivePlayer extends VueComponentType<LivePlayerProps> {}
140export declare class LivePusher extends VueComponentType<LivePusherProps> {}
141export declare class Video extends VueComponentType<VideoProps> {}
142export declare class VoipRoom extends VueComponentType<VoipRoomProps> {}
143/** 地图 */
144export declare class Map extends VueComponentType<MapProps> {}
145/** 画布 */
146export declare class Canvas extends VueComponentType<CanvasProps> {}
147/** 开放能力 */
148export declare class Ad extends VueComponentType<AdProps> {}
149export declare class AdCustom extends VueComponentType<AdCustomProps> {}
150export declare class OfficialAccount extends VueComponentType<OfficialAccountProps> {}
151export declare class OpenData extends VueComponentType<OpenDataProps> {}
152export declare class WebView extends VueComponentType<WebViewProps> {}
153/** 配置节点 */
154export declare class PageMeta extends VueComponentType<PageMetaProps> {}
155
156export declare class CustomWrapper extends VueComponentType<CustomWrapperProps> {}
157export declare class Slot extends VueComponentType<SlotProps> {}
158
159export * from './index'