@jjlmoya/utils-hardware 1.29.0 → 1.30.0

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 (33) hide show
  1. package/package.json +1 -1
  2. package/src/category/index.ts +2 -1
  3. package/src/entries.ts +4 -1
  4. package/src/index.ts +1 -0
  5. package/src/tests/locale_completeness.test.ts +1 -1
  6. package/src/tests/tool_validation.test.ts +1 -1
  7. package/src/tool/mouseJitterAngleSnappingTest/bibliography.astro +14 -0
  8. package/src/tool/mouseJitterAngleSnappingTest/bibliography.ts +16 -0
  9. package/src/tool/mouseJitterAngleSnappingTest/component.astro +110 -0
  10. package/src/tool/mouseJitterAngleSnappingTest/entry.ts +29 -0
  11. package/src/tool/mouseJitterAngleSnappingTest/i18n/de.ts +289 -0
  12. package/src/tool/mouseJitterAngleSnappingTest/i18n/en.ts +289 -0
  13. package/src/tool/mouseJitterAngleSnappingTest/i18n/es.ts +289 -0
  14. package/src/tool/mouseJitterAngleSnappingTest/i18n/fr.ts +289 -0
  15. package/src/tool/mouseJitterAngleSnappingTest/i18n/id.ts +289 -0
  16. package/src/tool/mouseJitterAngleSnappingTest/i18n/it.ts +289 -0
  17. package/src/tool/mouseJitterAngleSnappingTest/i18n/ja.ts +289 -0
  18. package/src/tool/mouseJitterAngleSnappingTest/i18n/ko.ts +289 -0
  19. package/src/tool/mouseJitterAngleSnappingTest/i18n/nl.ts +289 -0
  20. package/src/tool/mouseJitterAngleSnappingTest/i18n/pl.ts +289 -0
  21. package/src/tool/mouseJitterAngleSnappingTest/i18n/pt.ts +289 -0
  22. package/src/tool/mouseJitterAngleSnappingTest/i18n/ru.ts +289 -0
  23. package/src/tool/mouseJitterAngleSnappingTest/i18n/sv.ts +289 -0
  24. package/src/tool/mouseJitterAngleSnappingTest/i18n/tr.ts +289 -0
  25. package/src/tool/mouseJitterAngleSnappingTest/i18n/zh.ts +289 -0
  26. package/src/tool/mouseJitterAngleSnappingTest/index.ts +9 -0
  27. package/src/tool/mouseJitterAngleSnappingTest/logic.ts +245 -0
  28. package/src/tool/mouseJitterAngleSnappingTest/model.ts +38 -0
  29. package/src/tool/mouseJitterAngleSnappingTest/mouse-jitter-angle-snapping-test.css +412 -0
  30. package/src/tool/mouseJitterAngleSnappingTest/render.ts +48 -0
  31. package/src/tool/mouseJitterAngleSnappingTest/seo.astro +15 -0
  32. package/src/tool/mouseJitterAngleSnappingTest/ui.ts +29 -0
  33. package/src/tools.ts +2 -1
@@ -0,0 +1,48 @@
1
+ import type { PointSample } from './model';
2
+
3
+ interface RenderOptions {
4
+ points: PointSample[];
5
+ jitter: number;
6
+ getCss: (name: string, fallback: string) => string;
7
+ }
8
+
9
+ export function drawGrid(ctx: CanvasRenderingContext2D, width: number, height: number, getCss: RenderOptions['getCss']) {
10
+ ctx.fillStyle = getCss('--mjas-canvas-bg', '#071013');
11
+ ctx.fillRect(0, 0, width, height);
12
+ ctx.strokeStyle = getCss('--mjas-grid', 'rgba(103, 232, 249, 0.14)');
13
+ ctx.lineWidth = 1;
14
+ drawGridLines(ctx, width, height, 'x');
15
+ drawGridLines(ctx, width, height, 'y');
16
+ }
17
+
18
+ export function drawTrace(ctx: CanvasRenderingContext2D, { points, getCss }: RenderOptions) {
19
+ ctx.lineWidth = 2;
20
+ ctx.strokeStyle = getCss('--mjas-line', '#67e8f9');
21
+ ctx.beginPath();
22
+ points.forEach((point, index) => (index === 0 || point.fresh ? ctx.moveTo(point.x, point.y) : ctx.lineTo(point.x, point.y)));
23
+ ctx.stroke();
24
+ }
25
+
26
+ export function drawNodes(ctx: CanvasRenderingContext2D, { points, jitter, getCss }: RenderOptions) {
27
+ const nodeColor = getCss('--mjas-node', '#facc15');
28
+ const hotColor = getCss('--mjas-hot-node', '#fb7185');
29
+ points.slice(-380).forEach((point, index, list) => {
30
+ const age = index / list.length;
31
+ ctx.fillStyle = age > 0.82 && jitter > 55 ? hotColor : nodeColor;
32
+ ctx.globalAlpha = Math.max(0.25, age);
33
+ ctx.beginPath();
34
+ ctx.arc(point.x, point.y, age > 0.82 ? 3.2 : 2.1, 0, Math.PI * 2);
35
+ ctx.fill();
36
+ });
37
+ ctx.globalAlpha = 1;
38
+ }
39
+
40
+ function drawGridLines(ctx: CanvasRenderingContext2D, width: number, height: number, axis: 'x' | 'y') {
41
+ const limit = axis === 'x' ? width : height;
42
+ for (let position = 0; position < limit; position += 34) {
43
+ ctx.beginPath();
44
+ ctx.moveTo(axis === 'x' ? position : 0, axis === 'x' ? 0 : position);
45
+ ctx.lineTo(axis === 'x' ? position : width, axis === 'x' ? height : position);
46
+ ctx.stroke();
47
+ }
48
+ }
@@ -0,0 +1,15 @@
1
+ ---
2
+ import { SEORenderer } from '@jjlmoya/utils-shared';
3
+ import { mouseJitterAngleSnappingTest } from './index';
4
+ import type { KnownLocale } from '../../types';
5
+
6
+ interface Props {
7
+ locale?: KnownLocale;
8
+ }
9
+
10
+ const { locale = 'en' } = Astro.props;
11
+ const content = await mouseJitterAngleSnappingTest.i18n[locale]?.();
12
+ if (!content) return null;
13
+ ---
14
+
15
+ {content.seo?.length > 0 && <SEORenderer content={{ locale, sections: content.seo }} />}
@@ -0,0 +1,29 @@
1
+ export interface MouseJitterAngleSnappingTestUI extends Record<string, string> {
2
+ badge: string;
3
+ canvasLabel: string;
4
+ canvasHint: string;
5
+ pointerPrompt: string;
6
+ samples: string;
7
+ jitterScore: string;
8
+ snappingScore: string;
9
+ straightness: string;
10
+ rawDeviation: string;
11
+ statusIdle: string;
12
+ statusHealthy: string;
13
+ statusJitter: string;
14
+ statusSnapping: string;
15
+ statusMixed: string;
16
+ reset: string;
17
+ holdShift: string;
18
+ sensitivity: string;
19
+ low: string;
20
+ high: string;
21
+ traceLog: string;
22
+ emptyLog: string;
23
+ jitterEvent: string;
24
+ snappingEvent: string;
25
+ combinedEvent: string;
26
+ cleanEvent: string;
27
+ pxUnit: string;
28
+ percentUnit: string;
29
+ }
package/src/tools.ts CHANGED
@@ -20,5 +20,6 @@ import { WEB_USB_SERIAL_MONITOR_TOOL } from './tool/webUsbSerialMonitor/index';
20
20
  import { USB_POWER_BUDGET_CALCULATOR_TOOL } from './tool/usbPowerBudgetCalculator/index';
21
21
  import { MOBILE_SENSOR_TEST_TOOL } from './tool/mobileSensorTest/index';
22
22
  import { SUBWOOFER_CROSSOVER_TEST_TOOL } from './tool/subwooferCrossoverTest/index';
23
+ import { MOUSE_JITTER_ANGLE_SNAPPING_TEST_TOOL } from './tool/mouseJitterAngleSnappingTest/index';
23
24
 
24
- export const ALL_TOOLS: ToolDefinition[] = [PIXELES_PANTALLA_TOOL, TEST_TECLADO_TOOL, KEYBOARD_CHATTER_TEST_TOOL, TEST_MANDO_TOOL, PROBADOR_VIBRACION_MANDO_TOOL, TEST_RATON_TOOL, MOUSE_DOUBLE_CLICK_TEST_TOOL, MOUSE_SCROLL_TEST_TOOL, ESTIMADOR_SALUD_BATERIA_TOOL, TONE_GENERATOR_TOOL, SUBWOOFER_CROSSOVER_TEST_TOOL, REFRESH_RATE_DETECTOR_TOOL, MONITOR_GHOSTING_TEST_TOOL, SPECTRUM_CANVAS_TOOL, UPS_RUNTIME_CALCULATOR_TOOL, USB_POWER_BUDGET_CALCULATOR_TOOL, MOBILE_SENSOR_TEST_TOOL, STEREO_AUDIO_TEST_TOOL, WEB_BLUETOOTH_BLE_SCANNER_TOOL, WEB_USB_SERIAL_MONITOR_TOOL];
25
+ export const ALL_TOOLS: ToolDefinition[] = [PIXELES_PANTALLA_TOOL, TEST_TECLADO_TOOL, KEYBOARD_CHATTER_TEST_TOOL, TEST_MANDO_TOOL, PROBADOR_VIBRACION_MANDO_TOOL, TEST_RATON_TOOL, MOUSE_DOUBLE_CLICK_TEST_TOOL, MOUSE_SCROLL_TEST_TOOL, MOUSE_JITTER_ANGLE_SNAPPING_TEST_TOOL, ESTIMADOR_SALUD_BATERIA_TOOL, TONE_GENERATOR_TOOL, SUBWOOFER_CROSSOVER_TEST_TOOL, REFRESH_RATE_DETECTOR_TOOL, MONITOR_GHOSTING_TEST_TOOL, SPECTRUM_CANVAS_TOOL, UPS_RUNTIME_CALCULATOR_TOOL, USB_POWER_BUDGET_CALCULATOR_TOOL, MOBILE_SENSOR_TEST_TOOL, STEREO_AUDIO_TEST_TOOL, WEB_BLUETOOTH_BLE_SCANNER_TOOL, WEB_USB_SERIAL_MONITOR_TOOL];