1 | import { CSSProperties, LegacyRef, ReactNode } from 'react'
|
2 | import { COMPILE_MODE_SUB_RENDER_FN } from '@tarojs/shared'
|
3 |
|
4 | export interface StandardProps<T = any, TouchEvent extends BaseTouchEvent<any> = ITouchEvent> extends EventProps<TouchEvent> {
|
5 |
|
6 | id?: string
|
7 |
|
8 | className?: string
|
9 |
|
10 | style?: string | CSSProperties
|
11 |
|
12 | children?: ReactNode
|
13 | |
14 |
|
15 |
|
16 | key?: string | number
|
17 |
|
18 | hidden?: boolean
|
19 |
|
20 | animation?: { actions: TaroGeneral.IAnyObject[] } | TaroGeneral.IAnyObject
|
21 |
|
22 | ref?: LegacyRef<T>
|
23 | |
24 |
|
25 |
|
26 |
|
27 | dangerouslySetInnerHTML?: {
|
28 | __html: string
|
29 | }
|
30 | |
31 |
|
32 |
|
33 |
|
34 | compileMode?: boolean | string | typeof COMPILE_MODE_SUB_RENDER_FN
|
35 | |
36 |
|
37 |
|
38 |
|
39 | harmonyDirection?: 'row' | 'column' | 'flex'
|
40 | }
|
41 |
|
42 | export interface FormItemProps {
|
43 |
|
44 | name?: string
|
45 | }
|
46 |
|
47 | export interface EventProps<TouchEvent extends BaseTouchEvent<any> = ITouchEvent> {
|
48 |
|
49 | onTouchStart?: (event: TouchEvent) => void
|
50 |
|
51 |
|
52 | onTouchMove?: (event: TouchEvent) => void
|
53 |
|
54 |
|
55 | onTouchCancel?: (event: TouchEvent) => void
|
56 |
|
57 |
|
58 | onTouchEnd?: (event: TouchEvent) => void
|
59 |
|
60 |
|
61 | onClick?: (event: ITouchEvent) => void
|
62 |
|
63 |
|
64 | onLongPress?: (event: CommonEvent) => void
|
65 |
|
66 |
|
67 | onLongClick?: (event: CommonEvent) => void
|
68 |
|
69 |
|
70 | onTransitionEnd?: (event: CommonEvent) => void
|
71 |
|
72 |
|
73 | onAnimationStart?: (event: CommonEvent) => void
|
74 |
|
75 |
|
76 | onAnimationIteration?: (event: CommonEvent) => void
|
77 |
|
78 |
|
79 | onAnimationEnd?: (event: CommonEvent) => void
|
80 |
|
81 |
|
82 | onTouchForceChange?: (event: CommonEvent) => void
|
83 | }
|
84 |
|
85 | export type BaseEventOrigFunction<T> = (event: BaseEventOrig<T>) => void
|
86 |
|
87 | export type TouchEventFunction = (event: ITouchEvent) => void
|
88 |
|
89 | export type CanvasTouchEventFunction = (event: CanvasTouchEvent) => void
|
90 |
|
91 | export type CommonEvent<T = any> = BaseEventOrig<T>
|
92 |
|
93 | export type CommonEventFunction<T = any> = BaseEventOrigFunction<T>
|
94 |
|
95 | export interface BaseEventOrig<T = any> {
|
96 |
|
97 | type: string
|
98 |
|
99 |
|
100 | timeStamp: number
|
101 |
|
102 |
|
103 | target: Target
|
104 |
|
105 |
|
106 | currentTarget: currentTarget
|
107 |
|
108 |
|
109 | detail: T
|
110 |
|
111 |
|
112 | preventDefault: () => void
|
113 |
|
114 |
|
115 | stopPropagation: () => void
|
116 | }
|
117 |
|
118 | interface BaseTouchEvent<TouchDetail, T = any> extends BaseEventOrig<T> {
|
119 |
|
120 | touches: Array<TouchDetail>
|
121 |
|
122 |
|
123 | changedTouches: Array<TouchDetail>
|
124 | }
|
125 |
|
126 | export type CanvasTouchEvent = BaseTouchEvent<CanvasTouch, never>
|
127 |
|
128 | export type ITouchEvent = BaseTouchEvent<ITouch>
|
129 |
|
130 | export interface CanvasTouch {
|
131 | identifier: number
|
132 | x: number
|
133 | y: number
|
134 | }
|
135 |
|
136 | export interface ITouch extends Touch {
|
137 |
|
138 | identifier: number
|
139 |
|
140 | pageX: number
|
141 |
|
142 | pageY: number
|
143 |
|
144 | clientX: number
|
145 |
|
146 | clientY: number
|
147 | }
|
148 |
|
149 | export interface Target {
|
150 |
|
151 | id: string
|
152 |
|
153 | tagName: string
|
154 |
|
155 | dataset: {
|
156 | [key: string]: any
|
157 | }
|
158 | }
|
159 |
|
160 | export type currentTarget = Target
|
161 |
|
162 |
|
163 | export interface NetStatus {
|
164 |
|
165 | videoBitrate?: number
|
166 |
|
167 | audioBitrate?: number
|
168 |
|
169 | videoFPS?: number | string
|
170 |
|
171 | videoGOP?: number
|
172 |
|
173 | netSpeed?: number
|
174 |
|
175 | netJitter?: number
|
176 |
|
177 | videoWidth?: number | string
|
178 |
|
179 | videoHeight?: number | string
|
180 | }
|