forked from software-mansion/react-native-svg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js.flow
539 lines (537 loc) · 14.3 KB
/
index.js.flow
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
/**
* Flowtype definitions for index
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.17.0
*/
import * as React from "react";
import * as ReactNative from "react-native";
import {
GestureResponderEvent,
TransformsStyle,
OpaqueColorValue,
} from "react-native";
export type NumberProp = string | number;
export type NumberArray = NumberProp[] | NumberProp;
export type FillRule = "evenodd" | "nonzero";
export type Units = "userSpaceOnUse" | "objectBoundingBox";
export type TextAnchor = "start" | "middle" | "end";
export type FontStyle = "normal" | "italic" | "oblique";
export type FontVariant = "normal" | "small-caps";
export type FontWeight =
| NumberProp
| "normal"
| "bold"
| "bolder"
| "lighter"
| "100"
| "200"
| "300"
| "400"
| "500"
| "600"
| "700"
| "800"
| "900";
export type FontStretch =
| "normal"
| "wider"
| "narrower"
| "ultra-condensed"
| "extra-condensed"
| "condensed"
| "semi-condensed"
| "semi-expanded"
| "expanded"
| "extra-expanded"
| "ultra-expanded";
export type TextDecoration =
| "none"
| "underline"
| "overline"
| "line-through"
| "blink";
export type FontVariantLigatures = "normal" | "none";
export type AlignmentBaseline =
| "baseline"
| "text-bottom"
| "alphabetic"
| "ideographic"
| "middle"
| "central"
| "mathematical"
| "text-top"
| "bottom"
| "center"
| "top"
| "text-before-edge"
| "text-after-edge"
| "before-edge"
| "after-edge"
| "hanging";
export type BaselineShift =
| "sub"
| "super"
| "baseline"
| $ReadOnlyArray<NumberProp>
| NumberProp;
export type LengthAdjust = "spacing" | "spacingAndGlyphs";
export type TextPathMethod = "align" | "stretch";
export type TextPathSpacing = "auto" | "exact";
export type TextPathMidLine = "sharp" | "smooth";
export type Linecap = "butt" | "square" | "round";
export type Linejoin = "miter" | "bevel" | "round";
export interface TouchableProps {
disabled?: boolean;
onPress?: (event: GestureResponderEvent) => void;
onPressIn?: (event: GestureResponderEvent) => void;
onPressOut?: (event: GestureResponderEvent) => void;
onLongPress?: (event: GestureResponderEvent) => void;
delayPressIn?: number;
delayPressOut?: number;
delayLongPress?: number;
}
export type ResponderProps = {
pointerEvents?: "box-none" | "none" | "box-only" | "auto",
...
} & ReactNative.GestureResponderHandlers;
export type rgbaArray = $ReadOnlyArray<number>;
export type int32ARGBColor = number;
export type Color = int32ARGBColor | rgbaArray | OpaqueColorValue | string;
export interface FillProps {
fill?: Color;
fillOpacity?: NumberProp;
fillRule?: FillRule;
}
export interface ClipProps {
clipRule?: FillRule;
clipPath?: string;
}
export interface VectorEffectProps {
vectorEffect?:
| "none"
| "non-scaling-stroke"
| "nonScalingStroke"
| "default"
| "inherit"
| "uri";
}
export interface DefinitionProps {
id?: string;
}
export interface StrokeProps {
stroke?: Color;
strokeWidth?: NumberProp;
strokeOpacity?: NumberProp;
strokeDasharray?: $ReadOnlyArray<NumberProp> | NumberProp;
strokeDashoffset?: NumberProp;
strokeLinecap?: Linecap;
strokeLinejoin?: Linejoin;
strokeMiterlimit?: NumberProp;
}
export interface FontObject {
fontStyle?: FontStyle;
fontVariant?: FontVariant;
fontWeight?: FontWeight;
fontStretch?: FontStretch;
fontSize?: NumberProp;
fontFamily?: string;
textAnchor?: TextAnchor;
textDecoration?: TextDecoration;
letterSpacing?: NumberProp;
wordSpacing?: NumberProp;
kerning?: NumberProp;
fontFeatureSettings?: string;
fontVariantLigatures?: FontVariantLigatures;
fontVariationSettings?: string;
}
export type FontProps = {
font?: FontObject,
...
} & FontObject;
export interface TransformObject {
translate?: NumberArray;
translateX?: NumberProp;
translateY?: NumberProp;
origin?: NumberArray;
originX?: NumberProp;
originY?: NumberProp;
scale?: NumberArray;
scaleX?: NumberProp;
scaleY?: NumberProp;
skew?: NumberArray;
skewX?: NumberProp;
skewY?: NumberProp;
rotation?: NumberProp;
x?: NumberArray;
y?: NumberArray;
}
export type ColumnMajorTransformMatrix = [
number,
number,
number,
number,
number,
number
];
export type TransformProps = {
transform?:
| ColumnMajorTransformMatrix
| string
| TransformObject
| $PropertyType<TransformsStyle, "transform">,
...
} & TransformObject;
export interface CommonMaskProps {
mask?: string;
}
export interface CommonMarkerProps {
marker?: string;
markerStart?: string;
markerMid?: string;
markerEnd?: string;
}
export type CommonPathProps = { ... } & FillProps &
StrokeProps &
ClipProps &
TransformProps &
VectorEffectProps &
ResponderProps &
TouchableProps &
DefinitionProps &
CommonMarkerProps &
CommonMaskProps;
export type CircleProps = {
cx?: NumberProp,
cy?: NumberProp,
opacity?: NumberProp,
r?: NumberProp,
...
} & CommonPathProps;
declare export var Circle: React.ComponentClass<CircleProps>;
export type CircleType = React.ComponentClass<CircleProps>;
export interface ClipPathProps {
id?: string;
}
declare export var ClipPath: React.ComponentClass<ClipPathProps>;
export type ClipPathType = React.ComponentClass<ClipPathProps>;
declare export var Defs: React.ComponentClass<{ ... }>;
export type DefsType = React.ComponentClass<{ ... }>;
export type EllipseProps = {
cx?: NumberProp,
cy?: NumberProp,
opacity?: NumberProp,
rx?: NumberProp,
ry?: NumberProp,
...
} & CommonPathProps;
declare export var Ellipse: React.ComponentClass<EllipseProps>;
export type EllipseType = React.ComponentClass<EllipseProps>;
export type GProps = {
opacity?: NumberProp,
...
} & CommonPathProps &
FontProps;
declare export var G: React.ComponentClass<GProps>;
export type GType = React.ComponentClass<GProps>;
export interface ForeignObjectProps {
x?: NumberProp;
y?: NumberProp;
width?: NumberProp;
height?: NumberProp;
}
declare export var ForeignObject: React.ComponentClass<ForeignObjectProps>;
export type ForeignObjectType = React.ComponentClass<ForeignObjectProps>;
export type ImageProps = {
x?: NumberProp,
y?: NumberProp,
width?: NumberProp,
height?: NumberProp,
xlinkHref?: $PropertyType<ReactNative.ImageProps, "source">,
href?: $PropertyType<ReactNative.ImageProps, "source">,
preserveAspectRatio?: string,
opacity?: NumberProp,
clipPath?: string,
id?: string,
...
} & ResponderProps &
CommonMaskProps &
ClipProps &
TouchableProps;
declare export var Image: React.ComponentClass<ImageProps>;
export type ImageType = React.ComponentClass<ImageProps>;
export type LineProps = {
opacity?: NumberProp,
x1?: NumberProp,
x2?: NumberProp,
y1?: NumberProp,
y2?: NumberProp,
...
} & CommonPathProps;
declare export var Line: React.ComponentClass<LineProps>;
export type LineType = React.ComponentClass<LineProps>;
export interface LinearGradientProps {
x1?: NumberProp;
x2?: NumberProp;
y1?: NumberProp;
y2?: NumberProp;
gradientUnits?: Units;
gradientTransform?: ColumnMajorTransformMatrix | string;
id?: string;
}
declare export var LinearGradient: React.ComponentClass<LinearGradientProps>;
export type LinearGradientType = React.ComponentClass<LinearGradientProps>;
export type PathProps = {
d?: string,
opacity?: NumberProp,
...
} & CommonPathProps;
declare export var Path: React.ComponentClass<PathProps>;
export type PathType = React.ComponentClass<PathProps>;
export interface PatternProps {
id?: string;
x?: NumberProp;
y?: NumberProp;
width?: NumberProp;
height?: NumberProp;
patternTransform?: ColumnMajorTransformMatrix | string;
patternUnits?: Units;
patternContentUnits?: Units;
viewBox?: string;
preserveAspectRatio?: string;
}
declare export var Pattern: React.ComponentClass<PatternProps>;
export type PatternType = React.ComponentClass<PatternProps>;
export type PolygonProps = {
opacity?: NumberProp,
points?: string | $ReadOnlyArray<NumberProp>,
...
} & CommonPathProps;
declare export var Polygon: React.ComponentClass<PolygonProps>;
export type PolygonType = React.ComponentClass<PolygonProps>;
export type PolylineProps = {
opacity?: NumberProp,
points?: string | $ReadOnlyArray<NumberProp>,
...
} & CommonPathProps;
declare export var Polyline: React.ComponentClass<PolylineProps>;
export type PolylineType = React.ComponentClass<PolylineProps>;
export interface RadialGradientProps {
fx?: NumberProp;
fy?: NumberProp;
rx?: NumberProp;
ry?: NumberProp;
cx?: NumberProp;
cy?: NumberProp;
r?: NumberProp;
gradientUnits?: Units;
gradientTransform?: ColumnMajorTransformMatrix | string;
id?: string;
}
declare export var RadialGradient: React.ComponentClass<RadialGradientProps>;
export type RadialGradientType = React.ComponentClass<RadialGradientProps>;
export type RectProps = {
x?: NumberProp,
y?: NumberProp,
width?: NumberProp,
height?: NumberProp,
rx?: NumberProp,
ry?: NumberProp,
opacity?: NumberProp,
...
} & CommonPathProps;
declare export var Rect: React.ComponentClass<RectProps>;
export type RectType = React.ComponentClass<RectProps>;
export interface StopProps {
stopColor?: Color;
stopOpacity?: NumberProp;
offset?: NumberProp;
}
declare export var Stop: React.ComponentClass<StopProps>;
export type StopType = React.ComponentClass<StopProps>;
export type SvgProps = {
width?: NumberProp,
height?: NumberProp,
viewBox?: string,
preserveAspectRatio?: string,
color?: Color,
title?: string,
...
} & GProps &
ReactNative.ViewProperties;
declare export var Svg: React.ComponentClass<SvgProps>;
export type SvgType = React.ComponentClass<SvgProps>;
declare export default typeof Svg;
export interface SymbolProps {
id?: string;
viewBox?: string;
preserveAspectRatio?: string;
opacity?: NumberProp;
}
declare export var Symbol: React.ComponentClass<SymbolProps>;
export type SymbolType = React.ComponentClass<SymbolProps>;
export type TSpanProps = {
x?: NumberArray,
y?: NumberArray,
dx?: NumberArray,
dy?: NumberArray,
rotate?: NumberArray,
inlineSize?: NumberProp,
...
} & CommonPathProps &
FontProps;
declare export var TSpan: React.ComponentClass<TSpanProps>;
export type TSpanType = React.ComponentClass<TSpanProps>;
export type TextSpecificProps = {
alignmentBaseline?: AlignmentBaseline,
baselineShift?: BaselineShift,
verticalAlign?: NumberProp,
lengthAdjust?: LengthAdjust,
textLength?: NumberProp,
fontData?: null | {
[name: string]: mixed,
...
},
fontFeatureSettings?: string,
...
} & CommonPathProps &
FontProps;
export type TextProps = {
x?: NumberArray,
y?: NumberArray,
dx?: NumberArray,
dy?: NumberArray,
rotate?: NumberArray,
opacity?: NumberProp,
inlineSize?: NumberProp,
...
} & TextSpecificProps;
declare export var Text: React.ComponentClass<TextProps>;
export type TextType = React.ComponentClass<TextProps>;
export type TextPathProps = {
xlinkHref?: string,
href?: string,
startOffset?: NumberProp,
method?: TextPathMethod,
spacing?: TextPathSpacing,
midLine?: TextPathMidLine,
...
} & TextSpecificProps;
declare export var TextPath: React.ComponentClass<TextPathProps>;
export type TextPathType = React.ComponentClass<TextPathProps>;
export type UseProps = {
xlinkHref?: string,
href?: string,
width?: NumberProp,
height?: NumberProp,
x?: NumberProp,
y?: NumberProp,
opacity?: NumberProp,
...
} & CommonPathProps;
declare export var Use: React.ComponentClass<UseProps>;
export type UseType = React.ComponentClass<UseProps>;
declare export var EMaskUnits: {|
+USER_SPACE_ON_USE: "userSpaceOnUse", // "userSpaceOnUse"
+OBJECT_BOUNDING_BOX: "objectBoundingBox", // "objectBoundingBox"
|};
export type TMaskUnits =
| typeof EMaskUnits.USER_SPACE_ON_USE
| typeof EMaskUnits.OBJECT_BOUNDING_BOX;
export type MaskProps = {
id?: string,
x?: NumberProp,
y?: NumberProp,
width?: NumberProp,
height?: NumberProp,
maskTransform?: ColumnMajorTransformMatrix | string,
maskUnits?: TMaskUnits,
maskContentUnits?: TMaskUnits,
...
} & CommonPathProps;
declare export var Mask: React.ComponentClass<MaskProps>;
export type MaskType = React.ComponentClass<MaskProps>;
declare export var MarkerUnits: {|
+STROKE_WIDTH: "strokeWidth", // "strokeWidth"
+USER_SPACE_ON_USE: "userSpaceOnUse", // "userSpaceOnUse"
|};
declare export var Orient: {|
+AUTO: "auto", // "auto"
+AUTO_START_REVERSE: "auto-start-reverse", // "auto-start-reverse"
|};
export interface MarkerProps {
id?: string;
viewBox?: string;
preserveAspectRatio?: string;
refX?: NumberProp;
refY?: NumberProp;
markerWidth?: NumberProp;
markerHeight?: NumberProp;
markerUnits?: $Values<typeof MarkerUnits>;
orient?: $Values<typeof Orient> | NumberProp;
}
declare export var Marker: React.ComponentClass<MarkerProps>;
export type MarkerType = React.ComponentClass<MarkerProps>;
export type Styles = {
[property: string]: string,
...
};
export interface AST {
tag: string;
style?: Styles;
styles?: string;
priority?: Map<string, boolean | void>;
parent: AST | null;
children: (AST | string)[] | (React$Node | string)[];
props: {
[prop: string]: Styles | string | void,
...
};
Tag: React.ComponentType<>;
}
export type XmlAST = {
children: (XmlAST | string)[],
parent: XmlAST | null,
...
} & AST;
export type JsxAST = {
children: (React$Node | string)[],
...
} & AST;
export type UriProps = {
uri: string | null,
override?: SvgProps,
...
} & SvgProps;
export type UriState = {
xml: string | null,
...
};
export type XmlProps = {
xml: string | null,
override?: SvgProps,
...
} & SvgProps;
export type XmlState = {
ast: JsxAST | null,
...
};
export type AstProps = {
ast: JsxAST | null,
override?: SvgProps,
...
} & SvgProps;
export type Middleware = (ast: XmlAST) => XmlAST;
declare export function parse(
source: string,
middleware?: Middleware
): JsxAST | null;
declare export var SvgAst: React.FunctionComponent<AstProps>;
declare export var SvgXml: React.FunctionComponent<XmlProps>;
declare export var SvgFromXml: React.ComponentClass<XmlProps, XmlState>;
declare export var SvgUri: React.FunctionComponent<UriProps>;
declare export var SvgFromUri: React.ComponentClass<UriProps, UriState>;
declare export var SvgCss: React.FunctionComponent<XmlProps>;
declare export var SvgWithCss: React.ComponentClass<XmlProps, XmlState>;
declare export var SvgCssUri: React.FunctionComponent<UriProps>;
declare export var SvgWithCssUri: React.ComponentClass<UriProps, UriState>;
declare export var inlineStyles: Middleware;