-
-
Notifications
You must be signed in to change notification settings - Fork 135
/
index.ts
141 lines (128 loc) · 3.55 KB
/
index.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
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
import { AssertClass } from "./lib/assert.class";
import { ClipboardClass } from "./lib/clipboard.class";
import { KeyboardClass, KeyboardConfig } from "./lib/keyboard.class";
import { MouseClass, MouseConfig } from "./lib/mouse.class";
import { createMovementApi } from "./lib/movement.function";
import { ScreenClass, ScreenConfig } from "./lib/screen.class";
import { LineHelper } from "./lib/util/linehelper.class";
import { createWindowApi } from "./lib/window.function";
import providerRegistry from "./lib/provider/provider-registry.class";
import { loadImageResource } from "./lib/imageResources.function";
import {
ColorQuery,
LineQuery,
WindowQuery,
WordQuery,
} from "./lib/query.class";
import { RGBA } from "./lib/rgba.class";
export {
AssertClass,
ClipboardClass,
KeyboardClass,
KeyboardConfig,
MouseClass,
MouseConfig,
ScreenClass,
ScreenConfig,
providerRegistry,
};
export { MatchRequest } from "./lib/match-request.class";
export { MatchResult } from "./lib/match-result.class";
export * from "./lib/provider";
export { jestMatchers } from "./lib/expect/jest.matcher.function";
export { sleep } from "./lib/sleep.function";
export { Image } from "./lib/image.class";
export { RGBA } from "./lib/rgba.class";
export { Key } from "./lib/key.enum";
export { Button } from "./lib/button.enum";
export { centerOf, randomPointIn } from "./lib/location.function";
export { OptionalSearchParameters } from "./lib/optionalsearchparameters.class";
export { EasingFunction, linear } from "./lib/mouse-movement.function";
export { Point } from "./lib/point.class";
export { Region } from "./lib/region.class";
export { Window } from "./lib/window.class";
export { FileType } from "./lib/file-type.enum";
export { ColorMode } from "./lib/colormode.enum";
export {
useLogger,
useConsoleLogger,
ConsoleLogLevel,
} from "./lib/logging.function";
export * from "./lib/query.class";
const lineHelper = new LineHelper();
const clipboard = new ClipboardClass(providerRegistry);
const keyboard = new KeyboardClass(providerRegistry);
const mouse = new MouseClass(providerRegistry);
const screen = new ScreenClass(providerRegistry);
const assert = new AssertClass(screen);
const { straightTo, up, down, left, right } = createMovementApi(
providerRegistry,
lineHelper
);
const { getWindows, getActiveWindow } = createWindowApi(providerRegistry);
const loadImage = providerRegistry.getImageReader().load;
const saveImage = providerRegistry.getImageWriter().store;
const imageResource = (fileName: string) =>
loadImageResource(
providerRegistry,
screen.config.resourceDirectory,
fileName
);
const singleWord = (word: string): WordQuery => {
return {
type: "text",
id: `word-query-${word}`,
by: {
word,
},
};
};
const textLine = (line: string): LineQuery => {
return {
type: "text",
id: `line-query-${line}`,
by: {
line,
},
};
};
const windowWithTitle = (title: string | RegExp): WindowQuery => {
return {
type: "window",
id: `window-by-title-query-${title}`,
by: {
title,
},
};
};
const pixelWithColor = (color: RGBA): ColorQuery => {
return {
type: "color",
id: `pixel-by-color-query-RGBA(${color.R},${color.G},${color.B},${color.A})`,
by: {
color,
},
};
};
export { fetchFromUrl } from "./lib/imageResources.function";
export {
clipboard,
keyboard,
mouse,
screen,
assert,
straightTo,
up,
down,
left,
right,
getWindows,
getActiveWindow,
loadImage,
saveImage,
imageResource,
singleWord,
textLine,
windowWithTitle,
pixelWithColor,
};