-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
99 lines (99 loc) · 4.67 KB
/
index.d.ts
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
declare module "index" {
export namespace flounderStyle {
const sin: (rate: number) => number;
const cos: (rate: number) => number;
const atan2: (direction: {
x: number;
y: number;
}) => number;
type StyleKey = string;
type StyleValue = string | undefined;
type StyleProperty = {
key: StyleKey;
value: StyleValue;
};
type Style = {
[key: StyleKey]: StyleValue;
};
const styleToStylePropertyList: (style: Style) => StyleProperty[];
const setStyleProperty: (element: HTMLElement, style: StyleProperty) => HTMLElement;
const makeSureStyle: (styleOrArguments: Style | Arguments) => Style;
const setStyle: (element: HTMLElement, styleOrArguments: Style | Arguments) => HTMLElement;
const stylePropertyToString: (style: StyleProperty) => string;
const styleToString: (styleOrArguments: Style | Arguments, separator?: string) => string;
type FlounderType = Arguments["type"];
type Color = string;
type LayoutAngle = "regular" | "alternative";
type Real = number;
type Rate = Real;
type SignedRate = Real;
type Pixel = Real;
type SignedPixel = Real;
type Integer = number;
type Count = Integer;
type DirectionAngle = "right" | "right-down" | "down" | "left-down" | "left" | "left-up" | "up" | "right-up" | SignedRate;
const regulateRate: (rate: SignedRate) => Rate;
const directionAngleToRate: (angle: DirectionAngle) => Rate;
interface ArgumentsBase {
type: FlounderType;
layoutAngle?: LayoutAngle | SignedRate;
offsetX?: SignedPixel;
offsetY?: SignedPixel;
foregroundColor: Color;
backgroundColor?: Color;
intervalSize?: Pixel;
depth: Rate;
blur?: Pixel;
maxPatternSize?: Pixel;
reverseRate?: SignedRate | "auto" | "-auto";
anglePerDepth?: SignedRate | "auto" | "-auto";
maximumFractionDigits?: Count;
}
interface SpotArguments extends ArgumentsBase {
type: "trispot" | "tetraspot";
layoutAngle?: LayoutAngle | 0;
anglePerDepth?: never | 0;
}
interface LineArguments extends ArgumentsBase {
type: "stripe" | "diline" | "triline";
}
type Arguments = SpotArguments | LineArguments;
const isArguments: (value: unknown) => value is Arguments;
const getPatternType: (data: Arguments) => FlounderType;
const getLayoutAngle: (data: Arguments) => LayoutAngle;
const getActualLayoutAngle: (data: Arguments) => number;
const getAutoAnglePerDepth: (data: Arguments) => number;
const getActualAnglePerDepth: (data: Arguments) => number;
const getAngleOffsetByDepth: (data: Arguments) => number;
const getAngleOffset: (data: Arguments) => number;
const getBackgroundColor: (data: Arguments) => Color;
const getIntervalSize: (data: Arguments) => number;
const getBlur: (data: Arguments) => number;
const getActualReverseRate: (data: Arguments) => number;
const getAbsoulteReverseRate: (data: Arguments) => undefined | number | "auto";
const makeStyle: (data: Arguments) => Style;
const makePlainStyleOrNull: (data: Arguments) => Style | null;
const simpleStructuredClone: <T>(value: T) => T;
const reverseArguments: (data: Arguments) => Arguments;
const makeTrispotStyle: (data: Arguments) => Style;
const makeTetraspotStyle: (data: Arguments) => Style;
const makeStripeStyle: (data: Arguments) => Style;
const makeDilineStyle: (data: Arguments) => Style;
const makeTrilineStyle: (data: Arguments) => Style;
interface OffsetCoefficientDirection {
x: number;
y: number;
}
interface OffsetCoefficient {
directions: OffsetCoefficientDirection[];
intervalSize: number;
radius: number;
}
const calculateOffsetCoefficientDirections: (data: Arguments) => OffsetCoefficientDirection[];
const calculateOffsetCoefficient: (data: Arguments) => OffsetCoefficient;
const comparer: <valueT>(a: valueT, b: valueT) => 0 | 1 | -1;
const makeComparer: <objectT, valueT>(f: (o: objectT) => valueT) => (a: objectT, b: objectT) => 0 | 1 | -1;
const compareAngles: (a: SignedRate, b: SignedRate) => SignedRate;
const selectClosestAngleDirection: (directions: OffsetCoefficientDirection[], angle: DirectionAngle) => OffsetCoefficientDirection;
}
}