@testgorilla/tgo-typing-test 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/fesm2022/testgorilla-tgo-typing-test.mjs +4691 -0
  2. package/fesm2022/testgorilla-tgo-typing-test.mjs.map +1 -0
  3. package/lib/components/tgo-typing-replay-input/tgo-typing-replay-input.component.d.ts +14 -0
  4. package/lib/components/tgo-typing-test/tgo-typing-test.component.d.ts +54 -0
  5. package/lib/helpers/config.d.ts +98 -0
  6. package/lib/helpers/constants/default-config.d.ts +3 -0
  7. package/lib/helpers/controllers/input-controller.d.ts +16 -0
  8. package/lib/helpers/controllers/quotes-controller.d.ts +20 -0
  9. package/lib/helpers/observables/config-event.d.ts +5 -0
  10. package/lib/helpers/observables/timer-event.d.ts +4 -0
  11. package/lib/helpers/states/active-page.d.ts +2 -0
  12. package/lib/helpers/states/composition.d.ts +10 -0
  13. package/lib/helpers/states/page-transition.d.ts +2 -0
  14. package/lib/helpers/states/slow-timer.d.ts +3 -0
  15. package/lib/helpers/states/test-active.d.ts +2 -0
  16. package/lib/helpers/states/time.d.ts +3 -0
  17. package/lib/helpers/test/caps-warning.d.ts +5 -0
  18. package/lib/helpers/test/caret.d.ts +11 -0
  19. package/lib/helpers/test/custom-text.d.ts +16 -0
  20. package/lib/helpers/test/english-punctuation.d.ts +3 -0
  21. package/lib/helpers/test/focus.d.ts +7 -0
  22. package/lib/helpers/test/manual-restart-tracker.d.ts +3 -0
  23. package/lib/helpers/test/out-of-focus.d.ts +4 -0
  24. package/lib/helpers/test/replay.d.ts +20 -0
  25. package/lib/helpers/test/test-input.d.ts +86 -0
  26. package/lib/helpers/test/test-logic.d.ts +25 -0
  27. package/lib/helpers/test/test-state.d.ts +7 -0
  28. package/lib/helpers/test/test-stats.d.ts +92 -0
  29. package/lib/helpers/test/test-timer.d.ts +6 -0
  30. package/lib/helpers/test/test-ui.d.ts +27 -0
  31. package/lib/helpers/test/test-words.d.ts +23 -0
  32. package/lib/helpers/test/timer-progress.d.ts +3 -0
  33. package/lib/helpers/test/weak-spot.d.ts +3 -0
  34. package/lib/helpers/test/wordset.d.ts +7 -0
  35. package/lib/utils/misc.d.ts +80 -0
  36. package/package.json +17 -4
  37. package/.eslintrc.json +0 -46
  38. package/jest.config.ts +0 -21
  39. package/ng-package.json +0 -15
  40. package/project.json +0 -36
  41. package/src/lib/components/tgo-typing-replay-input/tgo-typing-replay-input.component.html +0 -30
  42. package/src/lib/components/tgo-typing-replay-input/tgo-typing-replay-input.component.spec.ts +0 -250
  43. package/src/lib/components/tgo-typing-replay-input/tgo-typing-replay-input.component.ts +0 -47
  44. package/src/lib/components/tgo-typing-test/tgo-typing-test.component.html +0 -72
  45. package/src/lib/components/tgo-typing-test/tgo-typing-test.component.spec.ts +0 -699
  46. package/src/lib/components/tgo-typing-test/tgo-typing-test.component.ts +0 -287
  47. package/src/lib/helpers/config.ts +0 -28
  48. package/src/lib/helpers/constants/default-config.ts +0 -103
  49. package/src/lib/helpers/controllers/input-controller.ts +0 -710
  50. package/src/lib/helpers/controllers/quotes-controller.ts +0 -183
  51. package/src/lib/helpers/observables/banner-event.ts +0 -18
  52. package/src/lib/helpers/observables/config-event.ts +0 -31
  53. package/src/lib/helpers/observables/timer-event.ts +0 -18
  54. package/src/lib/helpers/states/active-page.ts +0 -9
  55. package/src/lib/helpers/states/composition.ts +0 -29
  56. package/src/lib/helpers/states/page-transition.ts +0 -9
  57. package/src/lib/helpers/states/slow-timer.ts +0 -16
  58. package/src/lib/helpers/states/test-active.ts +0 -9
  59. package/src/lib/helpers/states/time.ts +0 -13
  60. package/src/lib/helpers/test/caps-warning.ts +0 -50
  61. package/src/lib/helpers/test/caret.ts +0 -92
  62. package/src/lib/helpers/test/custom-text.ts +0 -73
  63. package/src/lib/helpers/test/english-punctuation.ts +0 -38
  64. package/src/lib/helpers/test/focus.ts +0 -39
  65. package/src/lib/helpers/test/manual-restart-tracker.ts +0 -13
  66. package/src/lib/helpers/test/out-of-focus.ts +0 -19
  67. package/src/lib/helpers/test/replay.ts +0 -265
  68. package/src/lib/helpers/test/test-input.ts +0 -320
  69. package/src/lib/helpers/test/test-logic.ts +0 -1039
  70. package/src/lib/helpers/test/test-state.ts +0 -17
  71. package/src/lib/helpers/test/test-stats.ts +0 -442
  72. package/src/lib/helpers/test/test-timer.ts +0 -209
  73. package/src/lib/helpers/test/test-ui.ts +0 -370
  74. package/src/lib/helpers/test/test-words.ts +0 -72
  75. package/src/lib/helpers/test/timer-progress.ts +0 -16
  76. package/src/lib/helpers/test/tts.ts +0 -42
  77. package/src/lib/helpers/test/weak-spot.ts +0 -74
  78. package/src/lib/helpers/test/wordset.ts +0 -109
  79. package/src/lib/styles/animations.scss +0 -101
  80. package/src/lib/styles/caret.scss +0 -108
  81. package/src/lib/styles/core.scss +0 -498
  82. package/src/lib/styles/index.scss +0 -19
  83. package/src/lib/styles/inputs.scss +0 -290
  84. package/src/lib/styles/popups.scss +0 -1311
  85. package/src/lib/styles/test.scss +0 -1008
  86. package/src/lib/styles/z_media-queries.scss +0 -848
  87. package/src/lib/types/types.d.ts +0 -731
  88. package/src/lib/utils/misc.ts +0 -776
  89. package/src/test-setup.ts +0 -20
  90. package/tsconfig.json +0 -16
  91. package/tsconfig.lib.json +0 -14
  92. package/tsconfig.lib.prod.json +0 -9
  93. package/tsconfig.spec.json +0 -11
  94. /package/{src/assets → assets}/typing-test-languages/english.json +0 -0
  95. /package/{src/assets → assets}/typing-test-languages/english_punctuation.json +0 -0
  96. /package/{src/assets → assets}/typing-test-languages/quotes/english_version_1.json +0 -0
  97. /package/{src/assets → assets}/typing-test-languages/quotes/english_version_2.json +0 -0
  98. /package/{src/assets → assets}/typing-test-languages/quotes/filtered_sources.json +0 -0
  99. /package/{src/index.ts → index.d.ts} +0 -0
@@ -1,287 +0,0 @@
1
- import { animate, state, style, transition, trigger } from '@angular/animations';
2
- import {
3
- AfterViewInit,
4
- Component,
5
- ElementRef,
6
- EventEmitter,
7
- HostListener,
8
- Input,
9
- OnChanges,
10
- OnDestroy,
11
- OnInit,
12
- Output,
13
- SimpleChanges,
14
- ViewChild,
15
- } from '@angular/core';
16
- import { BehaviorSubject, Observable, Subscription } from 'rxjs';
17
- import {
18
- setCustomTGQuotes,
19
- setFunbox,
20
- setNumbers,
21
- setPunctuation,
22
- setTestVersionForSentences,
23
- setTime,
24
- } from '../../helpers/config';
25
- import {
26
- inputKeydown,
27
- setWordsInputElement,
28
- wordsInputBeforeinput,
29
- wordsInputCompositionend,
30
- wordsInputCompositionstart,
31
- wordsInputCopy,
32
- wordsInputFocus,
33
- wordsInputInput,
34
- wordsInputKeyup,
35
- wordsInputPaste,
36
- } from '../../helpers/controllers/input-controller';
37
- import { capsKeydown, capsKeyup, showCaps } from '../../helpers/test/caps-warning';
38
- import { caretAnimation, caretLeft, caretShow, caretTop } from '../../helpers/test/caret';
39
- import { mousemove, setCapsWarningElement, setMiddleElement } from '../../helpers/test/focus';
40
- import { outOfFocusShow } from '../../helpers/test/out-of-focus';
41
- import { getReplayExport } from '../../helpers/test/replay';
42
- import * as TestLogic from '../../helpers/test/test-logic';
43
- import * as TestUI from '../../helpers/test/test-ui';
44
- import {
45
- setWordsElement,
46
- setWordsInputElementTestUI,
47
- setWordsWrapperElement,
48
- wordsInputFocusOut,
49
- wordsInputFocusTestUI,
50
- wordsWrapperClick,
51
- } from '../../helpers/test/test-ui';
52
- import { timeLeft } from '../../helpers/test/timer-progress';
53
- import { QuoteNetworkError$ } from '../../utils/misc';
54
- import * as TestActive from '../../helpers/states/test-active';
55
- import quoteController from '../../helpers/controllers/quotes-controller';
56
- import { disableCheckIfTimeIsUp } from '../../helpers/test/test-timer';
57
- import { CommonModule } from '@angular/common';
58
-
59
- @Component({
60
- selector: 'tgo-typing-test',
61
- imports: [CommonModule],
62
- templateUrl: './tgo-typing-test.component.html',
63
- styleUrl: '../../styles/index.scss',
64
- animations: [
65
- trigger('fadeIn', [
66
- state('show', style({ opacity: 1 })),
67
- state('hide', style({ opacity: 0 })),
68
- transition('show => hide', [
69
- animate('125ms')
70
- ]),
71
- transition('hide => show', [
72
- animate('125ms')
73
- ])
74
- ]),
75
- trigger('updatePositionCaret', [
76
- state('true', style({
77
- top: '{{caretTopPos}}px',
78
- left: '{{caretLeftPos}}px'
79
- }), {
80
- params: { caretTopPos: 0, caretLeftPos: 0 }
81
- }),
82
- state('false', style({
83
- top: '{{caretTopPos}}px',
84
- left: '{{caretLeftPos}}px'
85
- }), {
86
- params: { caretTopPos: 0, caretLeftPos: 0 }
87
- }),
88
- transition('true => false', [
89
- animate('100ms')
90
- ]),
91
- transition('false => true', [
92
- animate('100ms')
93
- ])
94
- ])
95
- ]
96
- })
97
- export class TgoTypingTestComponent implements OnInit, OnChanges, AfterViewInit, OnDestroy {
98
- showCaps$: BehaviorSubject<boolean>;
99
- showCaret$: BehaviorSubject<boolean>;
100
- caretAnimation$: BehaviorSubject<string>;
101
- showTimer$: BehaviorSubject<boolean>;
102
- timeLeft$: BehaviorSubject<string>;
103
- caretLeft = 0;
104
- caretTop = 0;
105
- state = 'true';
106
- outOfFocusShow$: BehaviorSubject<boolean>;
107
-
108
- subscriptions: Subscription[] = [];
109
- replayIntervalID: any;
110
-
111
- @Output() resultEvent = new EventEmitter<any>();
112
- @Output() replayExport = new EventEmitter<any>();
113
- @Output() errorEvent = new EventEmitter<string>();
114
-
115
- @Input() time = 180;
116
- @Input() punctuation = false;
117
- @Input() numbers = false;
118
- @Input() funbox = 'none';
119
- @Input() customTGQuotes = false;
120
- @Input() showMiniTimerAndLiveWpm = true;
121
- @Input() restartTest = false;
122
- @Input() testVersion = 1;
123
- @Input() testExpiration$?: Observable<void>;
124
-
125
- constructor() {
126
- this.showCaps$ = showCaps;
127
- this.showCaret$ = caretShow;
128
- this.caretAnimation$ = caretAnimation;
129
- this.showTimer$ = TestLogic.startTestSubject;
130
- this.outOfFocusShow$ = outOfFocusShow;
131
- this.timeLeft$ = timeLeft;
132
- }
133
-
134
- @ViewChild('wordsInput') wordsInput!: ElementRef;
135
- @ViewChild('wordsWrapper') wordsWrapper!: ElementRef;
136
- @ViewChild('words') words!: ElementRef;
137
- @ViewChild('middle') middle!: ElementRef;
138
- @ViewChild('capsWarning') capsWarning!: ElementRef;
139
-
140
- ngOnInit() {
141
- TestUI.setResultCalculating(false);
142
- TestUI.setResultVisible(false);
143
- this.caretLeft = 0;
144
- this.caretTop = 0;
145
- setTime(this.time);
146
- setPunctuation(this.punctuation);
147
- setNumbers(this.numbers);
148
- setFunbox(this.funbox);
149
- setCustomTGQuotes(this.customTGQuotes);
150
- setTestVersionForSentences(this.testVersion);
151
- const caretLeftSub = caretLeft.subscribe(res => {
152
- if (res !== this.caretLeft) {
153
- this.caretLeft = res;
154
- if (this.state == 'true') {
155
- this.state = 'false';
156
- } else {
157
- this.state = 'true';
158
- }
159
- }
160
- });
161
-
162
- const caretTopSub = caretTop.subscribe(res => {
163
- this.caretTop = res;
164
- });
165
-
166
- const testResultSub = TestLogic.resultSub.subscribe(res => {
167
- this.replayExport.emit(getReplayExport());
168
- this.resultEvent.emit(res);
169
- });
170
-
171
- const errorSub = QuoteNetworkError$.subscribe({
172
- next: e => {
173
- if (!e) return;
174
- this.errorEvent.emit(e);
175
- TestLogic.stopTest();
176
- },
177
- });
178
-
179
- this.replayIntervalID = setInterval(() => {
180
- this.replayExport.emit(getReplayExport());
181
- }, 20000);
182
-
183
- this.subscriptions.push(caretLeftSub, caretTopSub, testResultSub, errorSub);
184
-
185
- if (this.testExpiration$) {
186
- disableCheckIfTimeIsUp();
187
- this.subscriptions.push(
188
- this.testExpiration$.subscribe(() => {
189
- TestLogic.finish();
190
- })
191
- );
192
- }
193
- }
194
-
195
- ngOnChanges(changes: SimpleChanges) {
196
- if (changes['restartTest']) {
197
- if (!changes['restartTest'].isFirstChange()) {
198
- this.restart();
199
- }
200
- }
201
- }
202
-
203
- wordsInputKeyup(event: any) {
204
- wordsInputKeyup(event);
205
- }
206
-
207
- wordsInputBeforeinput(event: any) {
208
- wordsInputBeforeinput(event);
209
- }
210
-
211
- wordsInputInput(event: any) {
212
- wordsInputInput(event);
213
- }
214
-
215
- wordsInputFocus(event: any) {
216
- if (!TestActive.get()) return;
217
- wordsInputFocus(event);
218
- wordsInputFocusTestUI();
219
- }
220
-
221
- wordsInputFocusOut() {
222
- if (!TestActive.get()) return;
223
- wordsInputFocusOut();
224
- }
225
-
226
- wordsInputCopy(event: any) {
227
- wordsInputCopy(event);
228
- }
229
-
230
- wordsInputPaste(event: any) {
231
- wordsInputPaste(event);
232
- }
233
-
234
- wordsInputCompositionstart() {
235
- wordsInputCompositionstart();
236
- }
237
-
238
- wordsInputCompositionend() {
239
- wordsInputCompositionend();
240
- }
241
-
242
- wordsWrapperClick() {
243
- wordsWrapperClick();
244
- }
245
-
246
- ngAfterViewInit() {
247
- setWordsInputElement(this.wordsInput.nativeElement);
248
- setWordsInputElementTestUI(this.wordsInput.nativeElement);
249
- TestLogic.setWordsInputElementTestLogic(this.wordsInput.nativeElement);
250
- setWordsWrapperElement(this.wordsWrapper.nativeElement);
251
- setWordsElement(this.words.nativeElement);
252
- setMiddleElement(this.middle.nativeElement);
253
- setCapsWarningElement(this.capsWarning.nativeElement);
254
- TestLogic.restart();
255
- }
256
-
257
- restart() {
258
- TestUI.setResultCalculating(false);
259
- TestUI.setResultVisible(false);
260
- this.caretLeft = 0;
261
- this.caretTop = 0;
262
- TestLogic.restart();
263
- }
264
-
265
- @HostListener('document:keydown', ['$event'])
266
- handleKeyboardDown(event: KeyboardEvent) {
267
- capsKeydown(event);
268
- inputKeydown(event, document.activeElement === this.wordsInput.nativeElement);
269
- }
270
-
271
- @HostListener('document:keyup', ['$event'])
272
- handleKeyboardUp(event: KeyboardEvent) {
273
- capsKeyup(event);
274
- }
275
-
276
- @HostListener('document:mousemove', ['$event'])
277
- handleMouseMove(event: MouseEvent) {
278
- mousemove(event);
279
- }
280
-
281
- ngOnDestroy(): void {
282
- TestLogic.stopTest();
283
- quoteController.resetQuotes();
284
- clearInterval(this.replayIntervalID);
285
- this.subscriptions.forEach(sub => sub.unsubscribe());
286
- }
287
- }
@@ -1,28 +0,0 @@
1
- import DefaultConfig from "./constants/default-config";
2
- const config = {
3
- ...DefaultConfig,
4
- };
5
-
6
- export function setNumbers(numb: boolean) {
7
- config.numbers = numb;
8
- }
9
- export function setPunctuation(punc: boolean) {
10
- config.punctuation = punc;
11
- }
12
- export function setTime(time: number) {
13
- config.time = time;
14
- }
15
-
16
- export function setFunbox(funbox: string) {
17
- config.funbox = funbox;
18
- }
19
-
20
- export function setCustomTGQuotes(customTGQuotes: boolean) {
21
- config.customTGQuotes = customTGQuotes;
22
- }
23
-
24
- export function setTestVersionForSentences(testVersion: number) {
25
- config.testVersion = testVersion;
26
- }
27
-
28
- export default config;
@@ -1,103 +0,0 @@
1
- import { MonkeyTypes } from '../../types/types';
2
- export default <MonkeyTypes.Config>{
3
- theme: 'serika_dark',
4
- themeLight: 'serika',
5
- themeDark: 'serika_dark',
6
- autoSwitchTheme: false,
7
- customTheme: false,
8
- customThemeColors: [
9
- '#323437',
10
- '#e2b714',
11
- '#e2b714',
12
- '#646669',
13
- '#2c2e31',
14
- '#d1d0c5',
15
- '#ca4754',
16
- '#7e2a33',
17
- '#ca4754',
18
- '#7e2a33',
19
- ],
20
- favThemes: [],
21
- showKeyTips: true,
22
- showLiveWpm: false,
23
- showTimerProgress: true,
24
- smoothCaret: true,
25
- quickRestart: 'off',
26
- punctuation: false,
27
- numbers: false,
28
- words: 50,
29
- time: 15,
30
- mode: 'time',
31
- quoteLength: [2],
32
- language: 'english',
33
- fontSize: '15',
34
- freedomMode: false,
35
- resultFilters: null,
36
- difficulty: 'normal',
37
- blindMode: false,
38
- quickEnd: false,
39
- caretStyle: 'default',
40
- paceCaretStyle: 'default',
41
- flipTestColors: false,
42
- layout: 'default',
43
- funbox: 'none',
44
- confidenceMode: 'on',
45
- indicateTypos: 'below',
46
- timerStyle: 'mini',
47
- colorfulMode: false,
48
- randomTheme: 'off',
49
- timerColor: 'main',
50
- timerOpacity: '1',
51
- stopOnError: 'off',
52
- showAllLines: false,
53
- keymapMode: 'off',
54
- keymapStyle: 'staggered',
55
- keymapLegendStyle: 'lowercase',
56
- keymapLayout: 'overrideSync',
57
- keymapShowTopRow: 'layout',
58
- fontFamily: 'Roboto_Mono',
59
- smoothLineScroll: false,
60
- alwaysShowDecimalPlaces: false,
61
- alwaysShowWordsHistory: false,
62
- singleListCommandLine: 'manual',
63
- capsLockWarning: true,
64
- playSoundOnError: false,
65
- playSoundOnClick: 'off',
66
- soundVolume: '0.5',
67
- startGraphsAtZero: true,
68
- showOutOfFocusWarning: true,
69
- paceCaret: 'off',
70
- paceCaretCustomSpeed: 100,
71
- repeatedPace: true,
72
- pageWidth: '125',
73
- chartAccuracy: true,
74
- chartStyle: 'line',
75
- minWpm: 'off',
76
- minWpmCustomSpeed: 100,
77
- highlightMode: 'letter',
78
- alwaysShowCPM: false,
79
- ads: 'result',
80
- hideExtraLetters: false,
81
- strictSpace: false,
82
- minAcc: 'off',
83
- minAccCustom: 90,
84
- showLiveAcc: false,
85
- showLiveBurst: false,
86
- monkey: false,
87
- repeatQuotes: 'off',
88
- oppositeShiftMode: 'off',
89
- customBackground: '',
90
- customBackgroundSize: 'cover',
91
- customBackgroundFilter: [0, 1, 1, 1, 1],
92
- customLayoutfluid: 'qwerty#dvorak#colemak',
93
- monkeyPowerLevel: 'off',
94
- minBurst: 'off',
95
- minBurstCustomSpeed: 100,
96
- burstHeatmap: false,
97
- britishEnglish: false,
98
- lazyMode: false,
99
- showAverage: 'off',
100
- tapeMode: 'off',
101
- customTGQuotes: false,
102
- testVersion: 1,
103
- };