-
-
Notifications
You must be signed in to change notification settings - Fork 187
Expand file tree
/
Copy pathindex.ts
More file actions
132 lines (119 loc) · 3.07 KB
/
Copy pathindex.ts
File metadata and controls
132 lines (119 loc) · 3.07 KB
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
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,
RGBA,
WindowQuery,
WordQuery
} from "@nut-tree/shared";
export {
AssertClass,
ClipboardClass,
KeyboardClass,
KeyboardConfig,
MouseClass,
MouseConfig,
ScreenClass,
ScreenConfig,
providerRegistry
};
export { MatchRequest } from "@nut-tree/shared";
export { MatchResult } from "@nut-tree/shared";
export * from "@nut-tree/provider-interfaces";
export * from "@nut-tree/shared";
export { jestMatchers } from "./lib/expect/jest.matcher.function";
export { sleep } from "./lib/sleep.function";
export { centerOf, randomPointIn } from "./lib/location.function";
export { EasingFunction, linear } from "./lib/mouse-movement.function";
export { Window } from "./lib/window.class";
export {
useLogger,
useConsoleLogger,
ConsoleLogLevel
} from "./lib/logging.function";
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
};